blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0e987857d293adeec5f7ea6b4ab00c311fa4302b | 7deeb4d7f17151fc584bc77b587eaf74f264f50d | /app/src/main/java/com/example/kulde/myapplication/SelectCar.java | 918eb944ebf9e950cf8848bb5ae18b7cd55c3010 | [] | no_license | kuldeepSBhadoria/MyCar | ad6917a7356d3107b208319f8028f223c383d038 | efbe97f77d96a9d3b50bf8f59b06c346ebdf8fd5 | refs/heads/master | 2021-01-18T21:41:58.586020 | 2017-04-02T21:56:17 | 2017-04-02T21:56:17 | 87,019,017 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,185 | java | package com.example.kulde.myapplication;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import java.util.List;
public class SelectCar extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
DatabaseHandler Db = new DatabaseHandler(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_car);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
TableLayout tl = (TableLayout) findViewById(R.id.Table);
// Reading all contacts
try {
Log.d("Reading: ", "Reading all contacts..");
List<CarDetails> contacts = Db.getAllContacts();
for (CarDetails cn : contacts) {
//String log = "Id: "+cn.getId()+" ,Name: " + cn.getCarname() + " , " + cn.getUTC();
String log = cn.getCarname() ;
{
// create a new TableRow
TableRow row = new TableRow(this);
// create a new TextView
TextView t = new TextView(this);
// set the text to "text xx"
t.setText(log);
// add the TextView and the CheckBox to the new TableRow
row.setId(cn.getId());
Button btn=new Button(this);
btn.setId(cn.getId());
btn.setText(log);
btn.setTextColor(getResources().getColor(R.color.black));
btn.setBackground(getResources().getDrawable(R.drawable.buttonlist));
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
System.out.println("car ID is:- " + v.getId());
{
finish();
Intent intent = new Intent(SelectCar.this, showCardata.class);
intent.putExtra("carid", String.valueOf(v.getId()));
startActivity(intent);
}
}
});
//btn.setBackgroundColor(getResources().getColor(R.color.burlywood));
//btn.setGravity(Gravity.CENTER_HORIZONTAL);
row.addView(btn);
//row.addView(t);
// add the TableRow to the TableLayout
tl.addView(row,new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
}
// Writing Contacts to log
Log.d("Car Details: ", log);
}
}catch (Exception e){}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public void onBackPressed() {
finish();
Intent intent = new Intent(SelectCar.this, Welcomepage.class);
startActivity(intent);
}
public void onclickBackButton(View view) {
finish();
Intent intent = new Intent(SelectCar.this, Welcomepage.class);
startActivity(intent);
}
}
| [
"kuldeep"
] | kuldeep |
5ad43929d6e3b3f4cbf4d8541ba51c7a069ca4b9 | 413590fbe6c428324c508a01f8799aef4ac69ff0 | /src/A_star/GraphLocation.java | 77ba8bbfed7bbf554aa1d5933252b67cea8e6efe | [] | no_license | aadnee/TDAT2005-algdat | 03a05687a1d1143917b3fce1a3752c3b2f00f0a6 | 2a51ba851fd7852729737444e540964b16a983a1 | refs/heads/master | 2020-08-03T18:35:31.100534 | 2019-09-30T12:36:18 | 2019-09-30T12:36:18 | 211,847,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package A_star;
import java.util.HashMap;
import java.util.Map;
public class GraphLocation {
private Map<Integer, String> locations = new HashMap<>();
public void addLocation(int node, String name) {
locations.put(node, name);
}
public int getNode(String name) {
for (Map.Entry<Integer, String> entry : locations.entrySet()) {
if (name.equals(entry.getValue())) {
return entry.getKey();
}
}
return -1;
}
public String getName(int node) {
return locations.get(node);
}
}
| [
"[email protected]"
] | |
bc78f094d3fb9963aaf0f7c3cf9d6b24ef957b37 | 4a00159209ea7c63058c802eb12369a2c5a5ef0b | /src/main/java/com/example/JspForm/database/JDBCExecutor.java | 44864f3262de8392d8431e18937615921b0a604f | [] | no_license | princ3raj/JspForm | d1e278a2c12e22ba9e643cae71168b3f37c8af83 | 1037aab2beddcde0367066dd8d02baf8c7f2bfd2 | refs/heads/master | 2023-03-07T18:56:06.716540 | 2021-01-16T05:21:43 | 2021-01-16T05:21:43 | 329,660,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,021 | java | package com.example.JspForm.database;
import java.sql.Connection;
import java.sql.SQLException;
public class JDBCExecutor {
public static int RegisterOnDataBase(Customer customer){
try {
System.out.println("start running");
DatabaseConnectionManager dcm= new DatabaseConnectionManager("localhost","hplussport","postgres","");
Connection connection= dcm.getConnection();
CustomerDAO customerDAO=new CustomerDAO(connection);
//update Data from Database
// Customer customer=customerDAO.findById(10000);
// System.out.println(customer.getFirstName()+" "+customer.getLastName()+" "+customer.getEmail());
// customer.setEmail("update it yet");
// customer.setFirstName("Kartik");
// customer.setLastName("Goel");
// customer=customerDAO.update(customer);
// System.out.println(customer.getFirstName()+" "+customer.getLastName()+" "+customer.getEmail());
// //Read
// Customer customer1=customerDAO.findById(1000);
// System.out.println(customer1.getFirstName()+" "+customer1.getLastName());
// //Insert
// Customer customer2=new Customer();
// customer2.setFirstName("Prince");
// customer2.setLastName("Raj");
// customer2.setEmail("[email protected]");
// customer2.setPhone("9602723097");
// customer2.setAddress("Delhi");
// customer2.setCity("Noida");
// customer2.setState("Delhi");
// customer2.setZipcode("201303");
customerDAO.create(customer);
// //Read again
// Customer customer3=customerDAO.findById(10005);
// System.out.println(customer3.getFirstName()+customer3.getLastName());
}catch (SQLException e){
e.printStackTrace();
}
return 1;
}
}
| [
"[email protected]"
] | |
53fddc4b3290605cd6302b22f4ac7b3b39c80e3a | 6b1a87ef93ddaf7af6ba10e90abe0537d72960a2 | /Ternary Operator/Main.java | b0b565f490e104168151a3f8e565278dc3af336f | [] | no_license | Chiradeepreddy/Playground | e7f6469031e620a36788d95b2e47b17803f35155 | 10fff993d333d3c8054a3a66dccc5b665549b884 | refs/heads/master | 2021-05-21T03:02:19.335157 | 2020-05-05T09:29:31 | 2020-05-05T09:29:31 | 252,513,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | #include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
if(a%2==0)
cout<<"Even";
else
cout<<"Odd";
} | [
"[email protected]"
] | |
f22bfe27c6b4503897a8d7eb9d904a9b28a0b99b | b26fa0b184d9121c8ce8a77b1cb983e63f8bc609 | /codeForces/Codeforces_1714C_Minimum_Varied_Number.java | 4470b48dbc1a79b071332f87841e3547d796c044 | [] | no_license | Ignorance-of-Dong/Algorithm | ecc1e143ddccd56f2c5e556cfc0de936ac4831f5 | ee3403dcd73c302674e0f911bcfec4d648d3229a | refs/heads/master | 2023-08-16T11:02:23.156599 | 2023-08-13T06:41:37 | 2023-08-13T06:41:37 | 246,977,114 | 1 | 0 | null | 2023-09-12T11:56:06 | 2020-03-13T03:03:46 | Java | UTF-8 | Java | false | false | 1,149 | java | // AC: 202 ms
// Memory: 0 KB
// Greedy.
// T:O(t), S:O(1)
//
import java.util.Scanner;
public class Codeforces_1714C_Minimum_Varied_Number {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++) {
int n = sc.nextInt(), prevDigit = 0;
StringBuilder ret = new StringBuilder();
while (n > 0) {
if (prevDigit == 0) {
if (n < 10) {
ret.append(n);
n = 0;
} else {
ret.append(9);
prevDigit = 9;
n -= 9;
}
} else {
if (n < prevDigit) {
ret.append(n);
n = 0;
} else {
ret.append(prevDigit - 1);
prevDigit--;
n -= prevDigit;
}
}
}
System.out.println(ret.reverse());
}
}
}
| [
"[email protected]"
] | |
7702149ae8f66035d653479ec297e45e4df3f2de | 4976046ab8cc2dcf828083735ab7160ecb84180e | /src/main/java/cn/gnosed/shopping/service/IOrderService.java | 83e63f6c4f043eb8b059b78331722a3c626719e7 | [] | no_license | 4gnosed/seckill | 36acf61999756a10746ffc6fa480df9b479009b9 | 50802702319f0d00b889bcd75494f342f57d0f94 | refs/heads/master | 2023-07-19T07:56:17.826712 | 2021-09-03T07:58:09 | 2021-09-03T07:58:09 | 331,235,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package cn.gnosed.shopping.service;
import cn.gnosed.shopping.entity.Order;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Gnosed Lu
* @since 2020-07-22
*/
public interface IOrderService extends IService<Order> {
void insert(String goodId, Integer quantity, Integer userId, boolean isPlace);
void successPlace(String goodId, Integer quantity,Integer userId);
void failPlace(String goodId, Integer quantity, Integer userId);
}
| [
"[email protected]"
] | |
edb25e35c09881624ed28118ea832d26be0bbb63 | a1c7f7435f39d5736d3410fbe75f74b4ebc0224d | /src/main/java/tn/teamwill/config/Constants.java | 1858e6e7d4d6469568a5fbdfc0d8da9f57efeb22 | [] | no_license | medalibettaieb/silver-octo-sniffle | 1a1c43a3199e74cd65e416d4d4f7aa74e95fcf6a | e2d0f68b01ee3e617125d54d7db8e7bede8ec4b3 | refs/heads/master | 2020-03-16T08:06:30.520730 | 2018-05-08T11:28:17 | 2018-05-08T11:28:17 | 132,590,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package tn.teamwill.config;
/**
* Application constants.
*/
public final class Constants {
// Regex for acceptable logins
public static final String LOGIN_REGEX = "^[_'.@A-Za-z0-9-]*$";
public static final String SYSTEM_ACCOUNT = "system";
public static final String ANONYMOUS_USER = "anonymoususer";
public static final String DEFAULT_LANGUAGE = "en";
private Constants() {
}
}
| [
"[email protected]"
] | |
70b3456c237b6ab5b9b7118615b702fa962e74dc | 52f731baffd867a3462b9bd27750c2dc4678e738 | /common/src/main/java/org/jboss/hal/testsuite/creaper/command/AddKeyStore.java | db7a91568cbf6136bf99e70679162263cef8da9b | [
"Apache-2.0"
] | permissive | hal/testsuite.next | 09d80ba397215182155d70a40315a84cb58c6ffe | 02b5e1dc0e2a9497e65effbc954063e35210f684 | refs/heads/master | 2023-06-24T09:08:27.260583 | 2022-12-02T10:22:46 | 2022-12-02T10:22:46 | 107,442,975 | 2 | 27 | Apache-2.0 | 2023-09-11T08:20:34 | 2017-10-18T17:47:04 | Java | UTF-8 | Java | false | false | 2,135 | java | /*
* Copyright 2022 Red Hat
*
* 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
*
* https://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.jboss.hal.testsuite.creaper.command;
import org.jboss.hal.testsuite.Random;
import org.jboss.hal.testsuite.dmr.CredentialReference;
import org.wildfly.extras.creaper.core.online.OnlineCommand;
import org.wildfly.extras.creaper.core.online.OnlineCommandContext;
import org.wildfly.extras.creaper.core.online.operations.Address;
import org.wildfly.extras.creaper.core.online.operations.Operations;
import org.wildfly.extras.creaper.core.online.operations.Values;
import static org.jboss.hal.dmr.ModelDescriptionConstants.CREDENTIAL_REFERENCE;
import static org.jboss.hal.dmr.ModelDescriptionConstants.ELYTRON;
import static org.jboss.hal.dmr.ModelDescriptionConstants.KEY_STORE;
import static org.jboss.hal.dmr.ModelDescriptionConstants.PATH;
import static org.jboss.hal.dmr.ModelDescriptionConstants.RELATIVE_TO;
import static org.jboss.hal.dmr.ModelDescriptionConstants.TYPE;
public class AddKeyStore implements OnlineCommand {
private final String name;
public AddKeyStore(final String name) {
this.name = name;
}
@Override
public void apply(final OnlineCommandContext context) throws Exception {
Operations operations = new Operations(context.client);
Address address = Address.subsystem(ELYTRON).and(KEY_STORE, name);
operations.add(address, Values.of(TYPE, "JKS")
.and(PATH, Random.name())
.and(RELATIVE_TO, "jboss.server.data.dir")
.and(CREDENTIAL_REFERENCE, CredentialReference.clearText("secret")));
}
}
| [
"[email protected]"
] | |
225db08e5adafc9549e654d208ae985e66e8773d | 9e7308e9bea2afd771aa23f908cb0b4c55c3b269 | /app/src/main/java/com/example/locationplace/placepicker/cardstream/CardStreamState.java | f6d79253912a956a9a118c082badb0aa3aefad7c | [] | no_license | ash-raut/LocationPlace | 5d51bdeb7223a00aee678536bcdcc8e37a8ee015 | b7e2d1005da938713345ebc7ab29727158a05666 | refs/heads/master | 2020-12-12T02:49:20.409568 | 2020-01-15T07:36:56 | 2020-01-15T07:36:56 | 234,024,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,203 | java | /*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.locationplace.placepicker.cardstream;
import java.util.HashSet;
/**
* A struct object that holds the state of a {@link CardStreamFragment}.
*/
public class CardStreamState {
protected Card[] visibleCards;
protected Card[] hiddenCards;
protected HashSet<String> dismissibleCards;
protected String shownTag;
protected CardStreamState(Card[] visible, Card[] hidden, HashSet<String> dismissible, String shownTag) {
visibleCards = visible;
hiddenCards = hidden;
dismissibleCards = dismissible;
this.shownTag = shownTag;
}
}
| [
"[email protected]"
] | |
159c776a65901ec1498cb22a6c0c42bbc089b862 | 94820ca028e90c2e04c7a6bc7b320e4394c6f6d0 | /library_management_system/src/bat/example/LoginServlet.java | baf89a8479939ea25121139c036e330010a27024 | [] | no_license | diptadas/library-management-system | 6b419c30b0eccabff6a246cd31261f885fa761c1 | d73866d9fbb742291ddcc19c5f14d6bdca835184 | refs/heads/master | 2021-09-01T11:39:59.347794 | 2017-04-10T18:00:00 | 2017-04-10T18:00:00 | 115,352,712 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,409 | java | package bat.example;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
int id = Integer.parseInt(request.getParameter("id"));
String type = request.getParameter("type");
String password = request.getParameter("password");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
if (type.equals("Student"))
{
Student student = DBOperation.checkStudentPass(id, password);
if (student != null)
{
CookieRes.setCookie(response, "student_id", student.getStudentId() + "");
CookieRes.setCookie(response, "name", student.getName());
CookieRes.setCookie(response, "type", "student");
response.sendRedirect("student_index.jsp");
} else
{
out.println("<html><div class='alert alert-danger alert-dismissable fade in'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><strong>Login Failed! Please try again.</strong></div></html>");
RequestDispatcher dispatcher = request.getRequestDispatcher("/login.jsp");
dispatcher.include(request, response);
}
} else if (type.equals("Librarian"))
{
Librarian librarian = DBOperation.checkLibrarianPass(id, password);
if (librarian != null)
{
CookieRes.setCookie(response, "user_id", librarian.getUserId() + "");
CookieRes.setCookie(response, "name", librarian.getName());
CookieRes.setCookie(response, "type", "librarian");
response.sendRedirect("librarian_index.jsp");
} else
{
out.println("<html><div class='alert alert-danger alert-dismissable fade in'><a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a><strong>Login Failed! Please try again.</strong></div></html>");
RequestDispatcher dispatcher = request.getRequestDispatcher("/login.jsp");
dispatcher.include(request, response);
}
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
}
}
| [
"[email protected]"
] | |
d5b010965b23474b20955d769fc1ca871d46c2f8 | 0b260cfc4feff284874edc8c0767982a5ec1d3dc | /Hash Table/336_PalindromePairs.java | 8733dba0a42cc609ffa89381867dddb6c6af5b0c | [] | no_license | Xu-Guo/GQQLeetCode | 9b3bac2ed76c8204e24674ff0e1b4c335ef14ea3 | 174277225dffa23b2bb712d2bd41bf6d77abc04e | refs/heads/master | 2021-01-19T15:25:30.876905 | 2017-04-10T23:08:36 | 2017-04-10T23:08:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,681 | java | public class Solution {
public List<List<Integer>> palindromePairs(String[] words) {
Set<List<Integer>> lst = new HashSet<>();
int n = words.length;
if (n <= 1) return new ArrayList<List<Integer>>();
Map<String, Integer> map = new HashMap<>();
// add words to map
for (int i = 0; i < n; i++) {
map.put(words[i], i);
}
for (int i = 0; i < n; i++) {
String curr = words[i];
// using j<=curr.length to include ""
for (int j = 0; j <= curr.length(); j++) {
String str1 = curr.substring(0, j);
String str2 = curr.substring(j);
if (isPalindrome(str1)) {
String str2rvs = reverse(str2);
if (map.containsKey(str2rvs) && map.get(str2rvs) != i) {
lst.add(Arrays.asList(map.get(str2rvs), i));
}
}
if (isPalindrome(str2)) {
String str1rvs = reverse(str1);
if (map.containsKey(str1rvs) && map.get(str1rvs) != i) {
lst.add(Arrays.asList(i, map.get(str1rvs)));
}
}
}
}
return new ArrayList<List<Integer>>(lst);
}
private String reverse(String word) {
return new StringBuilder(word).reverse().toString();
}
public boolean isPalindrome(String s) {
int low = 0, high = s.length() - 1;
while (low <= high) {
if (s.charAt(low) != s.charAt(high)) return false;
low++;
high--;
}
return true;
}
} | [
"[email protected]"
] | |
bad3b10d9415462fee21f99dd7131685a8d257ff | 82d1822c428eaf67ac231773c39172712ff70111 | /src/java/adminhome.java | f8ff0819f2fb6e2c5bb475fa19ae6c3e49ed4dac | [] | no_license | tayyab230996/Web-Application | fee213e437f942afdeaf550db47261c927df004b | 438a8054cc8d5af97f2fc137e2a870851f2105ec | refs/heads/master | 2020-03-22T17:28:00.198117 | 2018-07-10T08:54:43 | 2018-07-10T08:54:43 | 140,397,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,820 | java |
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class adminhome extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
HttpSession session=request.getSession(false);
if(session !=null)
{
String userid=(String)session.getAttribute("adminid");
out.println("<html>\n" +
" <head>\n" +
" <link rel=\"stylesheet\" type=\"text/css\" href=\"homepage.css\">\n" +
" <link rel=\"stylesheet\" type=\"text/css\" href=\"hotels-pics.css\">\n" +
" <link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.0.10/css/all.css\" integrity=\"sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg\" crossorigin=\"anonymous\">\n" +
" <style>\n" +
" .footer{display: inline-block;height:auto;width: 100%;background-color:rgba(165,100,78,0.5);}\n" +
" .end{background-color:rgba(165,100,78,1);}\n" +
" input{border-radius: 5px; padding:10px;}\n" +
" body{margin: 30px; height:auto;background-color:rgba(251,238,201,0.8);}\n" +
" p{text-align:right;color:black;margin-right: 50px;text-shadow:0 0 1px brown;font-size:20px;}\n" +
" p.coment{text-align:center;font-weight: bold;color:black;margin-right: 50px;\n" +
" text-shadow:0 0 2px red;font-size: 24px;}\n" +
" .home-content{\n" +
" height: 20px; color:white; text-shadow:0 0 10px brown;\n" +
" width: 400px; font-size: 24px;\n" +
" background-color:rgba(0,0,0,0.3); \n" +
" text-align: center; \n" +
" text-decoration: none;\n" +
" display: inline-block;\n" +
" padding-top: 10px;padding-left: 20px;padding-bottom: 30px;padding-right: 20px;letter-spacing: 3px;\n" +
" margin: 5px;border-radius:30px 0 30px 0;border: 3px solid white;\n" +
" transition: 1s;\n" +
"}\n" +
" </style>\n" +
" </head>\n" +
" <body>\n" +
" \n" +
" <div class=\"logo\">\n" +
" <table>\n" +
" <tr><td><div class=\"top-img\"><img src=\"WhatsApp Image 2018-05-09 at 1.33.51 PM.jpeg\"></div><td>\n" +
" <td style=\"font-size:40px;font-weight: bold; font-family: Adobe Hebrew;color:black;text-shadow:0 0 5px darkred;letter-spacing: 3px;text-align:right;\">KOLKATA CITY GUIDE</td> \n" +
" <td width=\"30%\">\n" +
" <p><font size=\"3\"><i class=\"fas fa-phone\"></i>CALL US:</font>\n" +
" 9038640962</p>\n" +
" <p><font size=\"3\"><i class=\"fas fa-at\"></i>MAIL US:</font>\n" +
" [email protected]</p>\n" +
" </td></tr>\n" +
" </table>\n" +
" <ul>\n" +
" \n" +
" <li><i class=\"fas fa-sign-in-alt\"></i><a href =\"logoutadmin?id\">LOGOUT</a></li> \n" +
" <li><i class=\"fas fa-calendar-check\"></i><a href =\"booking.html\">BOOKING</a></li> \n" +
" <li><i class=\"fas fa-cog\"></i><a href =\"services.html\">SERVICES</a></li>\n" +
" <li><i class=\"fas fa-home\"></i><a href =\"homepage.html\">HOME</a></li>\n" +
" </ul> \n" +
" </div>\n" +
" <h1 style=\"text-align:center\">ADMIN HOME</h1>\n" +
" <center><table>\n" +
" <tr>\n" +
" <td><h2><a class=\"home-content\" href=\"agency_pending?id\">Travel Agency Requests</a></h2></td></form>\n" +
" <td> <h2><a class=\"home-content\" href=\"pending_customer?id\">Customer Requests</a></h2></td>\n" +
" </tr>\n" +
" <tr>\n" +
" <td> <h2><a class=\"home-content\" href=\"view_details?id\">View Agency Details</a></h2></td>\n" +
" <td> <h2><a class=\"home-content\" href=\"feedback?id\">View Feedback</a></h2></td>\n" +
" </tr>\n" +
" <tr>\n" +
" <td> <h2><a class=\"home-content\" href=\"update_travel.html\">Update Agency Status</a></h2></td>\n" +
" <td> <h2><a class=\"home-content\" href=\"update-package.html\">Update Packages</a></h2></td>\n" +
" </tr>\n" +
" </table></center>\n" +
" <ul class=\"end\">\n" +
" <li><i class=\"fas fa-info-circle\"></i><a href=\"aboutus.html\">ABOUT US</a></li>\n" +
" <li><i class=\"fas fa-envelope\"></i><a href=\"#\">CONTACT US</a></li>\n" +
" </ul> \n" +
" </body>\n" +
"</html>");
}
else{
response.sendRedirect("adminlogin.html");
}
}
}
| [
"[email protected]"
] | |
39fd0e405bfd4a358caa3da4aaa88f98dff4b84d | 9c2b23a2d6da1e762400ae963c1f787c3121eb89 | /core/com.hundsun.ares.studio.ui/src/com/hundsun/ares/studio/ui/ARESResourceCategory.java | 285f53442238363a3a7f8d757853ae53137c2e5d | [
"MIT"
] | permissive | zhuyf03516/ares-studio | 5d67757283a52e51100666c9ce35227a63656f0e | 5648b0f606cb061d06c39ac25b7b206f3307882f | refs/heads/master | 2021-01-11T11:31:51.436304 | 2016-08-11T10:56:31 | 2016-08-11T10:56:31 | 65,444,199 | 0 | 0 | null | 2016-08-11T06:24:33 | 2016-08-11T06:24:32 | null | GB18030 | Java | false | false | 2,124 | java | /**
* <p>Copyright: Copyright (c) 2009</p>
* <p>Company: 恒生电子股份有限公司</p>
*/
package com.hundsun.ares.studio.ui;
import org.eclipse.core.runtime.PlatformObject;
import com.hundsun.ares.studio.core.IARESModule;
import com.hundsun.ares.studio.core.IARESResource;
import com.hundsun.ares.studio.core.registry.ARESResRegistry;
import com.hundsun.ares.studio.core.registry.IResCategoryDescriptor;
import com.hundsun.ares.studio.core.util.Util;
/**
* 资源分类的模型
* @author sundl
*/
public class ARESResourceCategory extends PlatformObject{
private Object parent;
/** 对应的资源类型 */
private String id;
public ARESResourceCategory(Object parent, String id) {
this.parent = parent;
this.id = id;
}
/**
* 获取所在的模块
* @return
*/
public IARESModule getModule() {
Object parent = this.parent;
if (parent instanceof IARESModule) {
return (IARESModule)parent;
} else if (parent instanceof ARESResourceCategory) {
return ((ARESResourceCategory)parent).getModule();
}
return null;
}
public boolean containsResource() {
return getResources().length > 0;
}
/**
* 计算应该显示在分类下的所有资源
* @return
*/
public IARESResource[] getResources() {
ARESResRegistry reg = ARESResRegistry.getInstance();
String[] types = reg.getRestypes(id);
return getModule().getARESResources(types);
}
public String getId() {
return id;
}
public String getName() {
IResCategoryDescriptor desc = ARESResRegistry.getInstance().getCategory(id);
if (desc != null) {
return desc.getName();
}
return id;
}
public boolean isResTypeAllowed(String resType) {
return ARESResRegistry.getInstance().isResTypeInCategory(resType, id);
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ARESResourceCategory)) {
return false;
}
ARESResourceCategory another = (ARESResourceCategory)obj;
return this.parent.equals(another.parent) && this.id.equals(another.id);
}
@Override
public int hashCode() {
return Util.combineHashCodes(parent.hashCode(), id.hashCode());
}
}
| [
"[email protected]"
] | |
dd01b8ac15896f703b902e71f9a7fbd8ac17171a | 46c83659765061da08706d7ffd4f39b10b1790ab | /CPSFramework/src/core/org/cps/framework/core/application/core/ApplicationBuilder (1).java | b152bd49e75864b6601aae50f92f55da33053b6e | [] | no_license | amit-bansil/water | 055fd051ee68a75c9785ac2a334d7b4f051356e4 | 0631dbbf87b9dab89fb8f43542d0be4657d1a155 | refs/heads/master | 2022-01-07T07:18:27.340272 | 2019-03-24T22:44:52 | 2019-03-24T22:44:52 | 124,279,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,623 | java | /*
* CREATED: Jul 26, 2004 AUTHOR: Amit Bansil Copyright 2004 The Center for
* Polymer Studies, Boston University, all rights reserved.
*/
package org.cps.framework.core.application.core;
import org.cps.framework.core.event.queue.CPSQueue;
import org.cps.framework.core.io.LocalVirtualFile;
import org.cps.framework.core.io.VirtualFile;
import javax.swing.ImageIcon;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
/**
* builder to create applications. TODO MacOS X shell integration TODO
* splash,progress screen
*/
public abstract class ApplicationBuilder {
//splash screen stuff
//call this ASAP (from static block in main class)
private static JWindow splash;
private static Image splashImage;
//note that this resource is not looked up using the accessorloader...
public static final void showSplashScreen(String splashImageResName) {
if (splash != null)
throw new IllegalStateException(
"can't show splashscreen over existing");
ImageIcon splashImageIcon = new ImageIcon(ClassLoader.getSystemResource(
splashImageResName));
splashImage = splashImageIcon.getImage();
splash = new JWindow() {
public void update(Graphics g) {
print(g);
}
public void paint(Graphics g) {
if (splash != null) g.drawImage(splashImage, 0, 0, splash);
}
};
splash.setSize(splashImageIcon.getIconWidth(), splashImageIcon
.getIconHeight());
splash.setLocationRelativeTo(null);
splash.setAlwaysOnTop(true);
splash.setVisible(true);
}
//called automatically from cps
private static final void killSplash() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if (splash != null) {
splash.setVisible(false);
splash.dispose();
splashImage.flush();
splashImage = null;
splash = null;
}
}
});
}
//parses a url out of main args or returns null if main args is empty;
//throws IllegalArgument if more than one parameter
//TODO better error handling, should print proper usage to system.err or
// such
public static final File parseMainArgs(String[] args) {
if (args == null || args.length == 0) return null;
else if (args.length == 1) return new File(args[0]);
else
throw new IllegalArgumentException(
"unexpected number of arguments:" + args.length);
}
public ApplicationBuilder() {
this((VirtualFile) null);
}
//simple implementation that will load initial file after startup
//or blank if null
//DO NOT INITIALIZE COMPONENTS IN CONSTRUCTOR since _registerCompoents is
//called asynchronously
public ApplicationBuilder(final File initialFile) {
this(initialFile != null ? new LocalVirtualFile(initialFile) : null);
}
public ApplicationBuilder(final VirtualFile initialFile) {
final Object lock = Application.aquireLock();
CPSQueue.getInstance().postRunnable(new Runnable() {
public void run() {
Application app = new Application(_createDescription(), lock);
_registerComponents(app);
app.startup();
if (initialFile != null) app.getGUI().getDocumentActions()
.loadDocument(initialFile);
else
app.getDocumentManager().loadBlankDocument();
killSplash();
}
});
}
//all these are called from CPSThread
//just create/get description
protected abstract ApplicationDescription _createDescription();
//init components here, register document data, add stuff to GUI
protected abstract void _registerComponents(Application app);
} | [
"[email protected]"
] | |
1f88deaa5d0e9937d956845fb4490c978852e6a7 | 73f83871f33a2a1c2f7217426c5ef2bad8d4b7ec | /src/main/java/com/revolut/money_transfer/account/dto/AccountCreateDto.java | ffc4059fc401857c7495094b40fc5d7bac1ae7b7 | [] | no_license | mastanik/money-transfer | 6cc7dced7d052f58baf8f24737480d3a12a234ca | f9e52147512a5e5dc149cd6c411dcda67ce8b099 | refs/heads/master | 2022-06-16T04:01:01.352647 | 2020-02-24T10:12:44 | 2020-02-24T10:12:44 | 238,488,632 | 0 | 0 | null | 2022-05-20T21:24:13 | 2020-02-05T15:52:40 | Java | UTF-8 | Java | false | false | 708 | java | package com.revolut.money_transfer.account.dto;
import javax.validation.constraints.NotNull;
public class AccountCreateDto {
@NotNull
private final Long customerId;
@NotNull
private final String currency;
public AccountCreateDto(Long customerId, String currency) {
this.customerId = customerId;
this.currency = currency;
}
public Long getCustomerId() {
return customerId;
}
public String getCurrency() {
return currency;
}
@Override
public String toString() {
return "AccountCreateDto{" +
"customerId=" + customerId +
", currency='" + currency + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
c6bab4b5f5f528a111aa572f976720b8a5c43278 | 0e13da505af96d79a1f76d235aeaaa42800d93f8 | /src/main/java/com/youzan/open/sdk/gen/v3_0_0/api/YouzanRetailOpenStockAdjust.java | 68b770b6af5bd347f3ba204cc6fd4fddcf105657 | [] | no_license | giagiigi/youzan-sdk | 430462c65463cd3efcb94cf81efc8a26fc81fa43 | 96e0695dbe86f1e885ca2d215552bf0fa43b90f0 | refs/heads/master | 2022-01-04T22:26:03.823201 | 2019-03-25T07:13:19 | 2019-03-25T07:13:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | package com.youzan.open.sdk.gen.v3_0_0.api;
import com.youzan.open.sdk.api.AbstractAPI;
import com.youzan.open.sdk.api.APIParams;
import com.youzan.open.sdk.gen.v3_0_0.model.YouzanRetailOpenStockAdjustResult;
import com.youzan.open.sdk.gen.v3_0_0.model.YouzanRetailOpenStockAdjustParams;
public class YouzanRetailOpenStockAdjust extends AbstractAPI {
public YouzanRetailOpenStockAdjust() {
}
public YouzanRetailOpenStockAdjust(YouzanRetailOpenStockAdjustParams apiParams) {
this.params = apiParams;
}
public String getHttpMethod() {
return "POST";
}
public String getVersion() {
return "3.0.0";
}
public String getName() {
return "youzan.retail.open.stock.adjust";
}
public Class getResultModelClass() {
return YouzanRetailOpenStockAdjustResult.class;
}
public Class getParamModelClass() {
return YouzanRetailOpenStockAdjustParams.class;
}
public boolean hasFiles() {
return true ;
}
} | [
"[email protected]"
] | |
e58c78bfccc3dbb827bfcf5d079a08acd9b9cad9 | 90b749a62dfcc25a868090988c596e13b449e1dd | /01_java7_features/src/com/terrydhariwal/Main/StaticInit.java | 50f970ccafc39f65e175943ffa631a1378910c00 | [] | no_license | terrydhariwal/Java_advanced_datastructures | 3d2ab29553d07e7a8818edfc3fee32ef590216c0 | 4353cd6e257f8db88874ffcbd1680eaba00c4e55 | refs/heads/master | 2021-01-01T18:22:20.731461 | 2015-01-19T21:14:54 | 2015-01-19T21:14:54 | 29,495,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.terrydhariwal.Main;
import com.terrydhariwal.olives.Olive;
import com.terrydhariwal.olives.OliveJar;
import java.util.ArrayList;
public class StaticInit {
public static void main(String[] args) {
System.out.println("Starting application ...");
ArrayList<Olive> olives = OliveJar.olives_static_member;
for (Olive o:olives) {
System.out.println(o.oliveName);
}
}
}
| [
"[email protected]"
] | |
53eda91a18c7be0a4299ddbc2c69e6c09973a5aa | fa95e7c2e5e7e07915b63695dece480269988704 | /litearouter-annotation/src/main/java/com/charylin/litearouter/facade/enums/RouteType.java | 81536af69bfd8a42ae55b6645820abd7d8dc4f66 | [
"Apache-2.0"
] | permissive | api888/LiteARouter | 30c4e633e8bcd14f30529440cc2b8c18ca58257c | dc95e3e6feb6fb94540f9e6ddb99ceeb868843ff | refs/heads/main | 2023-04-17T08:09:34.825111 | 2021-04-23T02:44:06 | 2021-04-23T02:44:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,277 | java | package com.charylin.litearouter.facade.enums;
/**
* Type of route enum.
*
* @author Alex <a href="mailto:[email protected]">Contact me.</a>
* @version 1.0
* @since 16/8/23 22:33
*/
public enum RouteType {
ACTIVITY(0, "android.app.Activity"),
SERVICE(1, "android.app.Service"),
// PROVIDER(2, "com.alibaba.android.arouter.facade.template.IProvider"),
CONTENT_PROVIDER(-1, "android.app.ContentProvider"),
BOARDCAST(-1, ""),
METHOD(-1, ""),
FRAGMENT(-1, "android.app.Fragment"),
UNKNOWN(-1, "Unknown route type");
int id;
String className;
public int getId() {
return id;
}
public RouteType setId(int id) {
this.id = id;
return this;
}
public String getClassName() {
return className;
}
public RouteType setClassName(String className) {
this.className = className;
return this;
}
RouteType(int id, String className) {
this.id = id;
this.className = className;
}
public static RouteType parse(String name) {
for (RouteType routeType : RouteType.values()) {
if (routeType.getClassName().equals(name)) {
return routeType;
}
}
return UNKNOWN;
}
}
| [
"[email protected]"
] | |
598e0c02c20fe7f2c2fe44438ce243cb69517012 | e07532e2c421a233672bd5911ccaa1bf2a2dbfbb | /reference-data/rest-query/src/main/java/com/networknt/eventuate/reference/restquery/model/ReferenceValue.java | de84827c9eb318f858e61c18dfb188f97a56c397 | [
"Apache-2.0"
] | permissive | networknt/light-eventuate-example | 12621f2dfe0553f0d9bed1b9abf73745f2ac8575 | 26c823ef6d43145ffd32907f277a5e8e2ae69a5f | refs/heads/master | 2023-08-17T21:35:12.969323 | 2019-09-25T19:23:05 | 2019-09-25T19:23:05 | 74,616,511 | 5 | 3 | Apache-2.0 | 2020-05-15T21:02:29 | 2016-11-23T21:48:46 | Java | UTF-8 | Java | false | false | 4,401 | java |
package com.networknt.eventuate.reference.restquery.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ReferenceValue {
private String valueId;
private ValueLocale locales;
private java.math.BigDecimal displayOrder;
private String tableId;
private String valueCode;
private java.time.LocalDateTime startTime;
private java.time.LocalDateTime endTime;
private Relation relations;
public ReferenceValue () {
}
@JsonProperty("valueId")
public String getValueId() {
return valueId;
}
public void setValueId(String valueId) {
this.valueId = valueId;
}
@JsonProperty("locales")
public ValueLocale getLocales() {
return locales;
}
public void setLocales(ValueLocale locales) {
this.locales = locales;
}
@JsonProperty("displayOrder")
public java.math.BigDecimal getDisplayOrder() {
return displayOrder;
}
public void setDisplayOrder(java.math.BigDecimal displayOrder) {
this.displayOrder = displayOrder;
}
@JsonProperty("tableId")
public String getTableId() {
return tableId;
}
public void setTableId(String tableId) {
this.tableId = tableId;
}
@JsonProperty("valueCode")
public String getValueCode() {
return valueCode;
}
public void setValueCode(String valueCode) {
this.valueCode = valueCode;
}
@JsonProperty("startTime")
public java.time.LocalDateTime getStartTime() {
return startTime;
}
public void setStartTime(java.time.LocalDateTime startTime) {
this.startTime = startTime;
}
@JsonProperty("endTime")
public java.time.LocalDateTime getEndTime() {
return endTime;
}
public void setEndTime(java.time.LocalDateTime endTime) {
this.endTime = endTime;
}
@JsonProperty("relations")
public Relation getRelations() {
return relations;
}
public void setRelations(Relation relations) {
this.relations = relations;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ReferenceValue ReferenceValue = (ReferenceValue) o;
return Objects.equals(valueId, ReferenceValue.valueId) &&
Objects.equals(locales, ReferenceValue.locales) &&
Objects.equals(displayOrder, ReferenceValue.displayOrder) &&
Objects.equals(tableId, ReferenceValue.tableId) &&
Objects.equals(valueCode, ReferenceValue.valueCode) &&
Objects.equals(startTime, ReferenceValue.startTime) &&
Objects.equals(endTime, ReferenceValue.endTime) &&
Objects.equals(relations, ReferenceValue.relations);
}
@Override
public int hashCode() {
return Objects.hash(valueId, locales, displayOrder, tableId, valueCode, startTime, endTime, relations);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ReferenceValue {\n");
sb.append(" valueId: ").append(toIndentedString(valueId)).append("\n");
sb.append(" locales: ").append(toIndentedString(locales)).append("\n");
sb.append(" displayOrder: ").append(toIndentedString(displayOrder)).append("\n");
sb.append(" tableId: ").append(toIndentedString(tableId)).append("\n");
sb.append(" valueCode: ").append(toIndentedString(valueCode)).append("\n");
sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n");
sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n");
sb.append(" relations: ").append(toIndentedString(relations)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
3427b950650b9fef827ae9cbe2fa2d3e9845c2bd | 1c1eb038bd3407a0da8a8ce34f17f384dda367f3 | /Migrated/CrackCode/src/solvedTopcoder/RecursiveFigures.java | 1c8d9e8e077598fca06abc932cf9b1f7dbadea04 | [] | no_license | afaly/CrackCode | ae6e7fcd82a250a1332d55e0a7b0040f63f66b55 | 3a6cda4e7d9252e496956c88de6e27c3a6bc9dd7 | refs/heads/master | 2021-01-10T14:04:24.452808 | 2016-01-04T07:12:58 | 2016-01-04T07:12:58 | 45,332,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package solvedTopcoder;
public class RecursiveFigures {
public double getArea(int sideLength, int K) {
double area = 0;
double r = sideLength / 2.0;
for (int i = K; i >= 1; i--) {
if (i == 1) {
area += Math.PI * r * r;
} else {
area += (Math.PI - 2) * r * r;
}
r /= Math.sqrt(2);
}
return area;
}
}
| [
"[email protected]"
] | |
3207cde9a38680848d548f1dca3f1a46f390a2c2 | ca85b4da3635bcbea482196e5445bd47c9ef956f | /iexhub/src/main/java/org/hl7/v3/MCAIMT900001UV01Role.java | 419a4559053defa8e97030fc8fbfa710913bcfd4 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bhits/iexhub-generated | c89a3a9bd127140f56898d503bc0c924d0398798 | e53080ae15f0c57c8111a54d562101d578d6c777 | refs/heads/master | 2021-01-09T05:59:38.023779 | 2017-02-01T13:30:19 | 2017-02-01T13:30:19 | 80,863,998 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,598 | java | /*******************************************************************************
* Copyright (c) 2015, 2016 Substance Abuse and Mental Health Services Administration (SAMHSA)
*
* 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.
*
* Contributors:
* Eversolve, LLC - initial IExHub implementation for Health Information Exchange (HIE) integration
* Anthony Sute, Ioana Singureanu
*******************************************************************************/
package org.hl7.v3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for MCAI_MT900001UV01.Role complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="MCAI_MT900001UV01.Role">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <group ref="{urn:hl7-org:v3}InfrastructureRootElements"/>
* <element name="code" type="{urn:hl7-org:v3}CE" minOccurs="0"/>
* </sequence>
* <attGroup ref="{urn:hl7-org:v3}InfrastructureRootAttributes"/>
* <attribute name="nullFlavor" type="{urn:hl7-org:v3}NullFlavor" />
* <attribute name="classCode" use="required" type="{urn:hl7-org:v3}RoleClassRoot" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MCAI_MT900001UV01.Role", propOrder = {
"realmCode",
"typeId",
"templateId",
"code"
})
public class MCAIMT900001UV01Role {
protected List<CS> realmCode;
protected II typeId;
protected List<II> templateId;
protected CE code;
@XmlAttribute
protected List<String> nullFlavor;
@XmlAttribute(required = true)
protected List<String> classCode;
/**
* Gets the value of the realmCode property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the realmCode property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRealmCode().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CS }
*
*
*/
public List<CS> getRealmCode() {
if (realmCode == null) {
realmCode = new ArrayList<CS>();
}
return this.realmCode;
}
/**
* Gets the value of the typeId property.
*
* @return
* possible object is
* {@link II }
*
*/
public II getTypeId() {
return typeId;
}
/**
* Sets the value of the typeId property.
*
* @param value
* allowed object is
* {@link II }
*
*/
public void setTypeId(II value) {
this.typeId = value;
}
/**
* Gets the value of the templateId property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the templateId property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getTemplateId().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link II }
*
*
*/
public List<II> getTemplateId() {
if (templateId == null) {
templateId = new ArrayList<II>();
}
return this.templateId;
}
/**
* Gets the value of the code property.
*
* @return
* possible object is
* {@link CE }
*
*/
public CE getCode() {
return code;
}
/**
* Sets the value of the code property.
*
* @param value
* allowed object is
* {@link CE }
*
*/
public void setCode(CE value) {
this.code = value;
}
/**
* Gets the value of the nullFlavor property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the nullFlavor property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNullFlavor().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getNullFlavor() {
if (nullFlavor == null) {
nullFlavor = new ArrayList<String>();
}
return this.nullFlavor;
}
/**
* Gets the value of the classCode property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the classCode property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getClassCode().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getClassCode() {
if (classCode == null) {
classCode = new ArrayList<String>();
}
return this.classCode;
}
}
| [
"[email protected]"
] | |
69aafa3e5c8e7d1d091e6d4eaeb38ca5d3822014 | 7da5206be6fac3e181c242d0530d227fe0b70cde | /src/main/java/cn/zjz/ssm/flyweight/Coordinate.java | 9d3665c9484de4d25b658b7e5915db7d42622eee | [] | no_license | missaouib/gof | ee65204123f5b116dff93c960c7da7083cb95901 | f10746ea0988aac439444162267af2b0dfd521fe | refs/heads/master | 2022-12-28T09:43:44.336334 | 2019-07-23T01:49:16 | 2019-07-23T01:49:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package cn.zjz.ssm.flyweight;
/**
* 外部状态UnSharedConcreteFlyWeight
* @author Administrator
*
*/
public class Coordinate {
private int x,y;
public Coordinate(int x, int y) {
super();
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}
| [
"[email protected]"
] | |
7e1ba86f37a79e72cf6c8df594a7a99478f0a1eb | a650bb140db8313eda85af1cd957153acb7c9893 | /src/main/java/algorithms/InsertionSort.java | b343087cd188c30f0e2b5ecae02ead9e9084209f | [] | no_license | kaugustowski/algorithms-and-data-structures | df7f505c738c315e7251efcf903d8af0209d5e83 | a52bf45fcd762c89d3ed4a2441c38303274c6527 | refs/heads/master | 2022-12-19T05:46:45.980720 | 2020-09-21T17:45:47 | 2020-09-21T17:45:47 | 293,357,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,109 | java | package algorithms;
import java.util.Arrays;
public class InsertionSort {
private static int[] insertionSort(int[] inputArray) {
for (int sortingKey = 1; sortingKey < inputArray.length; sortingKey++) {
for (int j = sortingKey; j > 0 && inputArray[j] < inputArray[j - 1]; j--) {
swap(inputArray, j - 1, j);
}
}
return inputArray;
}
private static void swap(int[] array, int index1, int index2) {
int temp = array[index1];
array[index1] = array[index2];
array[index2] = temp;
}
public static void main(String[] args) {
int[] testArray = {15, 28, 17, 2, 7, 4, 1};
int[] testArray2 = {12, 21, 17, 3, 2, 6, 1};
InsertionSort sorter = new InsertionSort();
sorter.sort(testArray);
InsertionSort.insertionSort(testArray2);
System.out.println(Arrays.toString(testArray));
System.out.println(Arrays.toString(testArray2));
}
//O(n^2) complexity
public void sort(int[] array) {
InsertionSort.insertionSort(array);
}
}
| [
"[email protected]"
] | |
92c20a363270eeb2a323c6a607e5c4f73bdfd54a | f6f65fcac33759e4a7ff468a0e822f4921db1a8c | /app/src/main/java/com/example/sheel9/nirmauniversityapp/DataWebView.java | 40de6bf9532232723605939b9a87c90f4dc0757b | [] | no_license | farju/sheelCollegeApp | 06af1fb35f0e30e39225dde6f34ba0712a2372b3 | 7b453012f4a7d347d6a515abf425b4020c59dedb | refs/heads/master | 2020-03-24T13:04:07.197478 | 2018-07-08T17:01:19 | 2018-07-08T17:01:19 | 142,734,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 617 | java | package com.example.sheel9.nirmauniversityapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
public class DataWebView extends AppCompatActivity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_data_web_view);
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://www.nirmauni.ac.in/ITNU/Faculty/Dr-Priyanka-Sharma");
}
}
| [
"[email protected]"
] | |
110451791596e9a010746920790a029658a2cce8 | 6b2fb43d706057ca670fc224a9d08fcf8e101b9d | /src/main/java/completablefuture/j8/exception/ExceptionHandler.java | eda46f44f59e80c8fd3252f498174a865f75f8a3 | [] | no_license | nazar-art/completable-future | bded46df3c8ce6b8cebe61ba747e94d36156d5fd | 22b5502c055154af97b77759a2aa4d6bd6988210 | refs/heads/master | 2023-02-17T08:21:28.463473 | 2021-01-14T13:51:44 | 2021-01-14T13:51:44 | 300,611,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package completablefuture.j8.exception;
import util.QuoteUtil;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ExceptionHandler {
private static final ExecutorService executor = Executors.newFixedThreadPool(10);
public static void main(String[] args) {
QuoteUtil quoteUtil = new QuoteUtil();
CompletableFuture
.supplyAsync(quoteUtil::emptyQuote, executor)
.thenApply(String::length)
.handle((result, throwable) -> {
if (throwable != null) {
return "No quote available: " + throwable;
} else {
return result.toString();
}
})
.thenAccept(System.out::println);
executor.shutdown();
}
}
| [
"[email protected]"
] | |
bc4435b41c215ae08457b5311cb00e95b3453625 | 1ba811a31010aabf572e98a511b1b06444aac018 | /app/src/main/java/com/yeying/aimi/utils/DesUtil.java | 93e2cd5cc5113bfa1ee13175abb65ccf0315c987 | [] | no_license | MagicianKing/AIMI | cb0d2274441b3185a51c53adbc8ecf2a690ce27e | d85179979f7b3898d90e9b39adb2023535c4c3fa | refs/heads/master | 2020-04-05T03:29:09.702391 | 2017-12-19T01:55:45 | 2017-12-19T01:55:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,440 | java | package com.yeying.aimi.utils;
import java.io.IOException;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import Decoder.BASE64Decoder;
import Decoder.BASE64Encoder;
public class DesUtil {
private final static String DES = "DES";
public static void main(String[] args) throws Exception {
String data = "123 456";
String key = "abcdefgh";
System.err.println(encrypt(data, key));
System.err.println(decrypt(encrypt(data, key), key));
System.out.println(decrypt("JF5dX/TlOg529KAhh+vywjzIp5Msktmf", key));
}
/**
* Description 根据键值进行加密
*
* @param data
* @param key 加密键byte数组
* @return
* @throws Exception
*/
public static String encrypt(String data, String key) throws Exception {
byte[] bt = encrypt(data.getBytes(), key.getBytes());
String strs = new BASE64Encoder().encode(bt);
return strs;
}
/**
* Description 根据键值进行解密
*
* @param data
* @param key 加密键byte数组
* @return
* @throws IOException
* @throws Exception
*/
public static String decrypt(String data, String key) throws IOException,
Exception {
if (data == null)
return null;
BASE64Decoder decoder = new BASE64Decoder();
byte[] buf = decoder.decodeBuffer(data);
byte[] bt = decrypt(buf, key.getBytes());
return new String(bt);
}
/**
* Description 根据键值进行加密
*
* @param data
* @param key 加密键byte数组
* @return
* @throws Exception
*/
private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
// 生成一个可信任的随机数源
SecureRandom sr = new SecureRandom();
// 从原始密钥数据创建DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key);
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成加密操作
Cipher cipher = Cipher.getInstance(DES);
// 用密钥初始化Cipher对象
cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
return cipher.doFinal(data);
}
/**
* Description 根据键值进行解密
*
* @param data
* @param key 加密键byte数组
* @return
* @throws Exception
*/
private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
// 生成一个可信任的随机数源
SecureRandom sr = new SecureRandom();
// 从原始密钥数据创建DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key);
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成解密操作
Cipher cipher = Cipher.getInstance(DES);
// 用密钥初始化Cipher对象
cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
return cipher.doFinal(data);
}
}
| [
"[email protected]"
] | |
724c90f59f58ab4376d6593166248396a02a047a | d9257e1d306e7ec365a9ffc40bb778e3b7bddc19 | /src/flappybirds/Ground.java | a0136f345684c80a5e33b83e782a51912045941b | [] | no_license | HoangManhDuy/FlappyBirds | 9c483ada7bdde0480fc5013bd897f708f603c65d | 03b70c6e50311f698590e6ac0bdb6e22b08be2a1 | refs/heads/master | 2021-01-22T03:54:35.534338 | 2017-09-03T11:58:54 | 2017-09-03T11:58:54 | 102,260,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | 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 flappybirds;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
*
* @author Hoangduy
*/
public class Ground {
private BufferedImage groundImage;
private int x1, y1, x2, y2;
public Ground(){
try{
groundImage = ImageIO.read(new File("assets/ground.png")) ;
}catch(IOException ex){}
x1 = 0;
y1 = 500;
x2 = x1 + 830;
y2 = 500;
}
public void update(){
x1 -= 2;
x2 -= 2;
if(x1 < 0) x2 = x1 +830;
if(x2 < 0) x1 = x2 +830;
}
public void Paint(Graphics2D g2){
g2.drawImage(groundImage, x1, y1, null);
g2.drawImage(groundImage, x2, y2, null);
}
public int setYGround(){
return y1;
}
}
| [
"[email protected]"
] | |
164db97b366b1aa2dfcbdbe221577ad7630bdd6d | 2a40db231ecbf5c7cf5230f9af6dc924391fe4f5 | /src/tutorial08/restartActor/Messages.java | 9d10996c2938a21d025e2bac449f277ee5c3e46e | [] | no_license | cpoliwoda/akka-tutorial | e13564686a1a7978f2166aaa72fd2648970c6e23 | ea38e9add73e949b2c3ed5bd1fc1d8423cb0b3a9 | refs/heads/master | 2016-09-06T14:15:22.404983 | 2013-03-06T13:40:08 | 2013-03-06T13:40:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,894 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tutorial08.restartActor;
import akka.actor.ActorRef;
/**
*
* @author Christian Poliwoda <[email protected]>
*/
class Messages {
/**
* base interface for all messages in this package
*/
public static interface Event {
}
/**
* base class for all messages in this package
*/
public static class EventImpl extends Throwable implements Event{
protected String message = "--no-message--";
public EventImpl() {
}
public EventImpl(String message) {
super(message);
this.message = message;
}
@Override
public String toString() {
return message;
}
}
public static class Start extends EventImpl{
public Start() {
super("START");
}
}
public static class Stop extends EventImpl{
public Stop() {
super("STOP");
}
}
public static class Resume extends EventImpl{
public Resume() {
super("RESUME");
}
}
public static class Restart extends EventImpl{
public Restart() {
super("RESTART");
}
}
public static class CheckTermination extends EventImpl{
public CheckTermination() {
super("CHECKTERMINATION");
}
}
public static class ReactivateChild extends EventImpl{
private ActorRef child = null;
public ReactivateChild(ActorRef child) {
super("REACTIVATEchild");
this.child=child;
}
/**
* @return the child
*/
public ActorRef getChild() {
return child;
}
}
}
| [
"[email protected]"
] | |
909ad104b142375741bc7d73dea3b5d21ad3bc06 | f61733b362e2a855203d4496fa3af1b65236474b | /src/main/java/com/atex/plugins/map/MapAspectBean.java | 7b9715ef59084f49772ee90f1436b148a2933d9f | [] | no_license | themnd/map | 0f8aad3cffe3a7fd5a687549683070d24d7a3774 | 6b14469a9447b5eb732b5295cf88f3e5006e8205 | refs/heads/master | 2021-01-21T01:49:34.610704 | 2016-05-13T13:31:31 | 2016-05-13T13:31:31 | 32,465,722 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,462 | java | package com.atex.plugins.map;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List;
import com.atex.onecms.content.aspects.annotations.AspectDefinition;
import com.google.common.collect.Lists;
/**
* Map aspect bean.
* It contains a list of points.
*/
@AspectDefinition
public class MapAspectBean {
/**
* Name of the aspect.
*/
public static final String ASPECT_NAME = MapAspectBean.class.getName();
/**
* First version of the bean.
*/
public static final int VERSION_1 = 1;
/**
* Always point to latest version.
*/
public static final int LATEST_VERSION = VERSION_1;
/**
* Current version.
*/
private int version = LATEST_VERSION;
private List<MapPoint> points = Lists.newArrayList();
/**
* Return the latest version.
*
* @return
*/
public int getVersion() {
return version;
}
/**
* Set the latest version.
*
* @param version
*/
public void setVersion(final int version) {
this.version = version;
}
/**
* The list of points.
*
* @return a not null list.
*/
public List<MapPoint> getPoints() {
return points;
}
/**
* Set the list of points.
*
* @param points a not null list.
*/
public void setPoints(final List<MapPoint> points) {
this.points = checkNotNull(points);
}
}
| [
"[email protected]"
] | |
6382fa43dadc4f0e5207a4ce6277a25e10826d4f | 178ef1239b7b188501395c4d3db3f0266b740289 | /android/service/diskstats/DiskStatsCachedValuesProto.java | 70f0c476e5585080a07bb02bfad9c04b6a5b08ff | [] | no_license | kailashrs/5z_framework | b295e53d20de0b6d2e020ee5685eceeae8c0a7df | 1b7f76b1f06cfb6fb95d4dd41082a003d7005e5d | refs/heads/master | 2020-04-26T12:31:27.296125 | 2019-03-03T08:58:23 | 2019-03-03T08:58:23 | 173,552,503 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | package android.service.diskstats;
public final class DiskStatsCachedValuesProto
{
public static final long AGG_APPS_CACHE_SIZE_KB = 1112396529666L;
public static final long AGG_APPS_DATA_SIZE_KB = 1112396529674L;
public static final long AGG_APPS_SIZE_KB = 1112396529665L;
public static final long APP_SIZES = 2246267895817L;
public static final long AUDIO_SIZE_KB = 1112396529669L;
public static final long DOWNLOADS_SIZE_KB = 1112396529670L;
public static final long OTHER_SIZE_KB = 1112396529672L;
public static final long PHOTOS_SIZE_KB = 1112396529667L;
public static final long SYSTEM_SIZE_KB = 1112396529671L;
public static final long VIDEOS_SIZE_KB = 1112396529668L;
public DiskStatsCachedValuesProto() {}
}
| [
"[email protected]"
] | |
2f42559a8c07b2a04e56b4a0d2f4fdd6eb8fb673 | 7a631f4fd43dbb8283af6dccd77917ae199bb3d6 | /src/main/java/org/caampi4j/ast/common/rule/RuleLoader.java | b240c617754e87063560674d11262483c7be2c20 | [] | no_license | edisonfillus/caampi4j | f588deabed9a5565b77bb36cffdf7b5cdff5e3d8 | 048f45d2e9c1f8ce18df8ffb81f4ed05f1ea7a92 | refs/heads/master | 2021-04-27T00:16:24.325703 | 2018-03-04T12:16:32 | 2018-03-04T12:16:32 | 123,782,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,844 | java | package org.caampi4j.ast.common.rule;
import static org.caampi4j.ast.common.util.CodeAnalyzerConstants.DEFAULT_RULES;
import static org.caampi4j.ast.common.util.CodeAnalyzerConstants.RULE_CONFIG_FILE;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Set;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import org.caampi4j.ast.common.jaxbgen.Rule;
import org.caampi4j.ast.common.jaxbgen.Rules;
/**
* Reads the rules defined for a class from rules.xml configuration file.
*
* @author Seema Richard ([email protected])
* @author Deepa Sobhana ([email protected])
*/
public class RuleLoader {
/**
* Create singleton instance of rule loader class
*/
private static RuleLoader ruleLoader = new RuleLoader();
/**
* Root element of rules.xml file
*/
private static Rules rules = null;
static {
/**
* Initializes the JAXB context for the rules.xml file and retrieves the
* root element of this xml file
*/
try {
JAXBContext jc = JAXBContext.newInstance(
Rules.class.getPackage().getName(),
RuleLoader.class.getClassLoader());
Unmarshaller unmarshaller = jc.createUnmarshaller();
// Load rules.xml file
InputStream inStream = RuleLoader.class.getClassLoader().
getResourceAsStream(RULE_CONFIG_FILE);
// Get the root element
rules = (Rules) unmarshaller.unmarshal(inStream);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Private constructor
*/
private RuleLoader() {
}
/**
* Returns the instance of RuleLoader
*
* @return ruleLoader
* the instance of RuleLoader
*/
public static RuleLoader getInstance() {
return ruleLoader;
}
/**
* Get the list of rules for the given module-type and class-tpe. This
* method will also fetch default rules applicable to all modules.
*
* @param moduleName
* the module type of the source file
* @param classTypeNames
* the class types of the source file
* @return Set of rules applicable for the source file
*/
public Set<String> fetchRules() {
Set<String> ruleNameList = new HashSet<String>();
try {
// Get the rules for all the class types in the given module
for (Rule rule : rules.getRule()) {
ruleNameList.add(rule.getRuleClass());
}
} catch (Exception exception) {
return null;
}
return ruleNameList;
}
}
| [
"[email protected]"
] | |
2570f73cf241a977e6bd991aa8ca91c167d2ccd1 | 27658c1c210d3b282eaed65fb387a6e819b87431 | /BaseAdapter.java | b34152297fac5f4c636fdc9581fcf1bf8fb9c6d3 | [] | no_license | shibin123/niuProject | 0824def3a643b95e9d18fd28611868bf66313b13 | 432aeb46caa30b2175d0c0cec128a5bc71af36ce | refs/heads/master | 2023-02-13T09:19:04.131636 | 2021-01-22T07:24:43 | 2021-01-22T07:24:43 | 328,934,925 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,638 | java | package com.ricefieldpro;
import android.content.Context;
import android.support.annotation.IdRes;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by niu on 2021/1/4
**/
public abstract class BaseAdapter<T> extends RecyclerView.Adapter<BaseAdapter.ViewHolder> {
protected Context mContext;
public List<T> getData() {
return mData;
}
protected List<T> mData = new ArrayList<>();
public void addData(T t) {
if (null != t) {
mData.add(t);
notifyItemChanged(mData.size());
}
}
@Override
public int getItemViewType(int position) {
return super.getItemViewType(position);
}
public void addData(List<T> addList) {
if (addList != null && addList.size() > 0) {
mData.addAll(addList);
notifyItemRangeChanged(mData.size() - addList.size(), addList.size());
}
}
public void insertData(List<T> addList) {
if (addList != null && addList.size() > 0) {
if (mData.size() < 1) {
mData.addAll(addList);
} else {
mData.addAll(0, addList);
}
// notifyDataSetChanged();
notifyItemRangeChanged(0, addList.size());
}
}
public void clear() {
if (mData == null) {
mData = new ArrayList<>();
}
mData.clear();
notifyDataSetChanged();
}
public void setDatas(List<T> data) {
if (null == data) {
data = new ArrayList<>();
}
mData.clear();
mData.addAll(data);
notifyDataSetChanged();
}
public BaseAdapter(List<T> data, Context context) {
mContext = context;
mData = data == null ? (List<T>) new ArrayList<>() : data;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(mContext).inflate(setViewLayoutId(), parent, false));
}
protected abstract int setViewLayoutId();
protected int setViewLayoutId(int viewType) {
return 0;
}
protected abstract void onBindViewHolder(ViewHolder holder, T t);
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
onBindViewHolder(holder, mData.get(position));
}
public boolean isEmpty() {
return getItemCount() == 0;
}
@Override
public int getItemCount() {
if (null == mData) {
return 0;
}
return mData.size();
}
protected static class ViewHolder extends RecyclerView.ViewHolder {
SparseArray<View> views = new SparseArray<>();
public <L extends View> L getView(@IdRes int resId) {
View view = views.get(resId);
if (null == view) {
view = itemView.findViewById(resId);
views.put(resId, view);
}
return (L) view;
}
public void setText(@IdRes int resId, CharSequence text) {
View view = views.get(resId);
if (null == view) {
view = itemView.findViewById(resId);
views.put(resId, view);
}
if (view instanceof TextView) {
((TextView) view).setText(text);
}
}
public ViewHolder(View itemView) {
super(itemView);
}
}
}
| [
"[email protected]"
] | |
1a84486ada06fe09e4c19256d44655265f71d81a | 283fe7633619296a1e126053e4627e17023ef7f5 | /sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/RequestResponseChannelTest.java | 215639eb319aa57057d13f31a778476fba4c4e6a | [
"LicenseRef-scancode-generic-cla",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jyotsnaravikumar/azure-sdk-for-java | c39e79280d0e97f9a1a5c2eec81f71e7ddb4516a | aa39e866c545ea78cf810588ee3209158f6c2a58 | refs/heads/master | 2022-06-22T12:51:23.821173 | 2020-05-06T16:53:16 | 2020-05-06T16:53:16 | 261,849,429 | 1 | 0 | MIT | 2020-05-06T18:45:12 | 2020-05-06T18:45:12 | null | UTF-8 | Java | false | false | 12,203 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.core.amqp.implementation;
import com.azure.core.amqp.AmqpRetryOptions;
import com.azure.core.amqp.exception.AmqpErrorContext;
import com.azure.core.amqp.exception.AmqpException;
import com.azure.core.amqp.implementation.handler.ReceiveLinkHandler;
import com.azure.core.amqp.implementation.handler.SendLinkHandler;
import org.apache.qpid.proton.amqp.UnsignedLong;
import org.apache.qpid.proton.amqp.transport.ReceiverSettleMode;
import org.apache.qpid.proton.amqp.transport.SenderSettleMode;
import org.apache.qpid.proton.engine.Delivery;
import org.apache.qpid.proton.engine.EndpointState;
import org.apache.qpid.proton.engine.Receiver;
import org.apache.qpid.proton.engine.Record;
import org.apache.qpid.proton.engine.Sender;
import org.apache.qpid.proton.engine.Session;
import org.apache.qpid.proton.message.Message;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import reactor.core.publisher.DirectProcessor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;
import reactor.core.publisher.ReplayProcessor;
import reactor.test.StepVerifier;
import java.io.IOException;
import java.time.Duration;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* Request response tests.
*/
class RequestResponseChannelTest {
private static final String CONNECTION_ID = "some-id";
private static final String NAMESPACE = "test fqdn";
private static final String LINK_NAME = "test-link-name";
private static final String ENTITY_PATH = "test-entity-path";
private static final Duration TIMEOUT = Duration.ofSeconds(23);
private final AmqpRetryOptions retryOptions = new AmqpRetryOptions().setTryTimeout(TIMEOUT);
private final DirectProcessor<Delivery> deliveryProcessor = DirectProcessor.create();
private final FluxSink<Delivery> deliverySink = deliveryProcessor.sink();
private final ReplayProcessor<EndpointState> endpointStateReplayProcessor = ReplayProcessor.cacheLast();
@Mock
private ReactorHandlerProvider handlerProvider;
@Mock
private ReactorProvider reactorProvider;
@Mock
private ReactorDispatcher reactorDispatcher;
@Mock
private ReceiveLinkHandler receiveLinkHandler;
@Mock
private SendLinkHandler sendLinkHandler;
@Mock
private Session session;
@Mock
private Sender sender;
@Mock
private Receiver receiver;
@Mock
private MessageSerializer serializer;
@Captor
private ArgumentCaptor<Runnable> dispatcherCaptor;
@BeforeAll
static void beforeAll() {
StepVerifier.setDefaultTimeout(Duration.ofSeconds(10));
}
@AfterAll
static void afterAll() {
StepVerifier.resetDefaultTimeout();
}
@BeforeEach
void beforeEach() {
MockitoAnnotations.initMocks(this);
when(reactorProvider.getReactorDispatcher()).thenReturn(reactorDispatcher);
final Record record = mock(Record.class);
when(sender.attachments()).thenReturn(record);
when(receiver.attachments()).thenReturn(record);
when(session.sender(LINK_NAME + ":sender")).thenReturn(sender);
when(session.receiver(LINK_NAME + ":receiver")).thenReturn(receiver);
when(handlerProvider.createReceiveLinkHandler(CONNECTION_ID, NAMESPACE, LINK_NAME, ENTITY_PATH))
.thenReturn(receiveLinkHandler);
when(handlerProvider.createSendLinkHandler(CONNECTION_ID, NAMESPACE, LINK_NAME, ENTITY_PATH))
.thenReturn(sendLinkHandler);
FluxSink<EndpointState> sink1 = endpointStateReplayProcessor.sink();
sink1.next(EndpointState.ACTIVE);
when(receiveLinkHandler.getEndpointStates()).thenReturn(endpointStateReplayProcessor);
when(receiveLinkHandler.getErrors()).thenReturn(Flux.never());
when(receiveLinkHandler.getDeliveredMessages()).thenReturn(deliveryProcessor);
when(sendLinkHandler.getEndpointStates()).thenReturn(endpointStateReplayProcessor);
when(sendLinkHandler.getErrors()).thenReturn(Flux.never());
}
@AfterEach
void afterEach() {
Mockito.framework().clearInlineMocks();
}
/**
* Validate that this gets and sets properties correctly.
*/
@Test
void getsProperties() {
// Arrange
SenderSettleMode settleMode = SenderSettleMode.SETTLED;
ReceiverSettleMode receiverSettleMode = ReceiverSettleMode.SECOND;
AmqpErrorContext expected = new AmqpErrorContext("namespace-test");
when(receiveLinkHandler.getErrorContext(receiver)).thenReturn(expected);
// Act
final RequestResponseChannel channel = new RequestResponseChannel(CONNECTION_ID, NAMESPACE, LINK_NAME,
ENTITY_PATH, session, retryOptions, handlerProvider, reactorProvider, serializer, settleMode,
receiverSettleMode);
final AmqpErrorContext errorContext = channel.getErrorContext();
channel.dispose();
// Assert
assertEquals(expected, errorContext);
verify(sender).setTarget(argThat(t -> t != null && ENTITY_PATH.equals(t.getAddress())));
verify(sender).setSenderSettleMode(settleMode);
verify(receiver).setTarget(argThat(t -> t != null && t.getAddress().startsWith(ENTITY_PATH)));
verify(receiver).setSource(argThat(s -> s != null && ENTITY_PATH.equals(s.getAddress())));
verify(receiver).setReceiverSettleMode(receiverSettleMode);
}
@Test
void disposes() {
// Arrange
final RequestResponseChannel channel = new RequestResponseChannel(CONNECTION_ID, NAMESPACE, LINK_NAME,
ENTITY_PATH, session, retryOptions, handlerProvider, reactorProvider, serializer, SenderSettleMode.SETTLED,
ReceiverSettleMode.SECOND);
// Act
channel.dispose();
// Assert
verify(sender).close();
verify(receiver).close();
}
/**
* Verifies error when sending with null
*/
@Test
void sendNull() {
// Arrange
final RequestResponseChannel channel = new RequestResponseChannel(CONNECTION_ID, NAMESPACE, LINK_NAME,
ENTITY_PATH, session, retryOptions, handlerProvider, reactorProvider, serializer, SenderSettleMode.SETTLED,
ReceiverSettleMode.SECOND);
// Act & Assert
StepVerifier.create(channel.sendWithAck(null))
.expectError(NullPointerException.class)
.verify();
}
/**
* Verifies error when sending with a reply to property set.
*/
@Test
void sendReplyToSet() {
// Arrange
final RequestResponseChannel channel = new RequestResponseChannel(CONNECTION_ID, NAMESPACE, LINK_NAME,
ENTITY_PATH, session, retryOptions, handlerProvider, reactorProvider, serializer, SenderSettleMode.SETTLED,
ReceiverSettleMode.SECOND);
final Message message = mock(Message.class);
when(message.getReplyTo()).thenReturn("test-reply-to");
// Act & Assert
StepVerifier.create(channel.sendWithAck(message))
.expectError(IllegalArgumentException.class)
.verify();
}
/**
* Verifies error when sending with message id is set.
*/
@Test
void sendMessageIdSet() {
// Arrange
final RequestResponseChannel channel = new RequestResponseChannel(CONNECTION_ID, NAMESPACE, LINK_NAME,
ENTITY_PATH, session, retryOptions, handlerProvider, reactorProvider, serializer, SenderSettleMode.SETTLED,
ReceiverSettleMode.SECOND);
final Message message = mock(Message.class);
when(message.getMessageId()).thenReturn(10L);
// Act & Assert
StepVerifier.create(channel.sendWithAck(message))
.expectError(IllegalArgumentException.class)
.verify();
}
/**
* Verifies a message is received.
*/
@Test
void sendMessage() throws IOException {
// Arrange
// This message was copied from one that was received.
final byte[] messageBytes = new byte[]{0, 83, 115, -64, 15, 13, 64, 64, 64, 64, 64, 83, 1, 64, 64, 64, 64, 64,
64, 64, 0, 83, 116, -63, 49, 4, -95, 11, 115, 116, 97, 116, 117, 115, 45, 99, 111, 100, 101, 113, 0, 0, 0,
-54, -95, 18, 115, 116, 97, 116, 117, 115, 45, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, -95, 8,
65, 99, 99, 101, 112, 116, 101, 100};
final RequestResponseChannel channel = new RequestResponseChannel(CONNECTION_ID, NAMESPACE, LINK_NAME,
ENTITY_PATH, session, retryOptions, handlerProvider, reactorProvider, serializer, SenderSettleMode.SETTLED,
ReceiverSettleMode.SECOND);
final UnsignedLong messageId = UnsignedLong.valueOf(1);
final Message message = mock(Message.class);
final int encodedSize = 143;
when(serializer.getSize(message)).thenReturn(150);
when(message.encode(any(), eq(0), anyInt())).thenReturn(encodedSize);
// Creating a received message because we decodeDelivery calls implementation details for proton-j.
final Delivery delivery = mock(Delivery.class);
when(delivery.pending()).thenReturn(messageBytes.length);
when(receiver.recv(any(), eq(0), eq(messageBytes.length))).thenAnswer(invocation -> {
final byte[] buffer = invocation.getArgument(0);
System.arraycopy(messageBytes, 0, buffer, 0, messageBytes.length);
return messageBytes.length;
});
// Act
StepVerifier.create(channel.sendWithAck(message))
.then(() -> deliverySink.next(delivery))
.assertNext(received -> assertEquals(messageId, received.getCorrelationId()))
.verifyComplete();
// Getting the runnable so we can manually invoke it and verify contents are correct.
verify(reactorDispatcher, atLeastOnce()).invoke(dispatcherCaptor.capture());
dispatcherCaptor.getAllValues().forEach(work -> {
assertNotNull(work);
work.run();
});
// Assert
verify(message).setMessageId(argThat(e -> e instanceof UnsignedLong && messageId.equals(e)));
verify(message).setReplyTo(argThat(path -> path != null && path.startsWith(ENTITY_PATH)));
verify(receiver).flow(1);
verify(sender).delivery(any());
verify(sender).send(any(), eq(0), eq(encodedSize));
verify(sender).advance();
}
@Test
void clearMessagesOnError() {
// Arrange
final RequestResponseChannel channel = new RequestResponseChannel(CONNECTION_ID, NAMESPACE, LINK_NAME,
ENTITY_PATH, session, retryOptions, handlerProvider, reactorProvider, serializer, SenderSettleMode.SETTLED,
ReceiverSettleMode.SECOND);
final AmqpException error = new AmqpException(true, "Message", new AmqpErrorContext("some-context"));
final Message message = mock(Message.class);
when(serializer.getSize(message)).thenReturn(150);
when(message.encode(any(), eq(0), anyInt())).thenReturn(143);
// Act
StepVerifier.create(channel.sendWithAck(message))
.then(() -> endpointStateReplayProcessor.sink().error(error))
.verifyError(AmqpException.class);
// Assert
assertTrue(channel.isDisposed());
}
}
| [
"[email protected]"
] | |
9b00970bf0b85f2663f90388fd9a22a175891390 | e08129cc09d5fa3d7d8bba3e23b3dfde316ddcf9 | /projects/openquote/1.3/openquote/openquote.ear/lib/openquote.jar/com/ail/openquote/ui/AnswerSection.java | 97810b2b0320d3f043f65056f2bcb619b00d7a23 | [] | no_license | zhangjh953166/open-quote | 459dd7b58e7faa8cbb970af30b377c1c1e51c0a2 | d0823cff3254293e0031d818bb1289fbbf3e6aa2 | refs/heads/master | 2020-03-29T05:13:19.380579 | 2014-10-08T08:52:38 | 2014-10-08T08:52:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,930 | java | /* Copyright Applied Industrial Logic Limited 2006. All rights Reserved */
/*
* 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.
*/
package com.ail.openquote.ui;
import static com.ail.openquote.ui.messages.I18N.i18n;
import static com.ail.core.Functions.expand;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.ail.core.Type;
import com.ail.openquote.ui.util.QuotationContext;
/**
* <p>An AnswerSection is generally used on summary pages and acts as a container for listing the answers
* given to previously asked questions. It contains a list of {@link #getAnswer() answers} which may be
* instances of {@link Answer} or {@link AnswerScroller}.</p>
* <p><img src="doc-files/AnswerSection.png"/></p>
* <p>The screenshot shows two answer sections. The first contains 5 {@link Answer Answers}; the second
* contains a single {@link AnswerScroller} which itself contains 3 {@link Answer Answers}.</p>
* <p>The {@link #getTitle() title} may be static (using {@link #setTitle(String)}, or dynamic (using {@link #setTitleBinding(String)}.
* Dynamic titles are defined as XPath expressions which are evaluated at page render time against the quotation model. The
* result of the evaluation is used as the title.
* @see Answer
* @see AnswerScroller
* @version 1.1
*/
public class AnswerSection extends PageElement {
private static final long serialVersionUID = 6794522768423045427L;
/** List of things to be rendered in the section */
private ArrayList<? extends Answer> answer;
/** The fixed title to be displayed with the answer */
private String title;
/**
* An optional XPath value which can be evaluated against the quotation to fetch a dynamic title.
* If defined this is used in preference to the fixed title: @{link #title}
*/
private String titleBinding;
public AnswerSection() {
super();
answer=new ArrayList<Answer>();
}
/**
* List of things ({@link Answer Answers} and {@link AnswerSection AnswerSections} to be rendered
* in the section.
* @return List of contained elements.
*/
public ArrayList<? extends Answer> getAnswer() {
return answer;
}
/**
* @see #getAnswer()
* @param answer
*/
public void setAnswer(ArrayList<? extends Answer> answer) {
this.answer = answer;
}
/**
* The fixed title to be displayed with the answer. This method returns the raw title without
* expanding embedded variables (i.e. xpath references like ${person/firstname}).
* @see #getExpandedTitle(Type)
* @return value of title
*/
public String getTitle() {
return title;
}
/**
* @see #getTitle()
* @param title
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Get the title with all variable references expanded. References are expanded with
* reference to the models passed in. Relative xpaths (i.e. those starting ./) are
* expanded with respect to <i>local</i>, all others are expanded with respect to
* <i>root</i>.
* @param root Model to expand references with respect to.
* @param local Model to expand local references (xpaths starting ./) with respect to.
* @return Title with embedded references expanded
* @since 1.1
*/
public String getExpandedTitle(Type root, Type local) {
if (getTitle()!=null) {
return expand(getTitle(), root, local);
}
// TODO Check getTitleBinding for backward compatibility only - remove for OQ2.0
else if (getTitleBinding()!=null) {
return local.xpathGet(getTitleBinding(), String.class);
}
else {
return null;
}
}
/**
* An optional XPath value which can be evaluated against the quotation to fetch a dynamic title.
* If defined this is used in preference to the fixed title: @{link #title}
* @return Title's XPath binding
* @deprecated Use {@link #getExpandedTitle(Type)} in combination with embedded xpath references within the title.
*/
public String getTitleBinding() {
return titleBinding;
}
/**
* @see #getTitleBinding()
* @param titleBinding
* @deprecated Use {@link #getExpandedTitle(Type)} in combination with embedded xpath references within the title.
*/
public void setTitleBinding(String titleBinding) {
this.titleBinding = titleBinding;
}
@Override
public Type renderResponse(RenderRequest request, RenderResponse response, Type model) throws IllegalStateException, IOException {
if (!conditionIsMet(model)) {
return model;
}
PrintWriter w = response.getWriter();
String title = getExpandedTitle(QuotationContext.getQuotation(), model);
return QuotationContext.getRenderer().renderAnswerSection(w, request, response, model, this, i18n(title));
}
@Override
public void applyElementId(String basedId) {
int idx=0;
for(PageElement e: answer) {
e.applyElementId(basedId+ID_SEPARATOR+(idx++));
}
super.applyElementId(basedId);
}
}
| [
"dickanderson@22cb28ec-0345-0410-b6dc-f8d001edd02c"
] | dickanderson@22cb28ec-0345-0410-b6dc-f8d001edd02c |
39a2ea354e4746ecee6de7fe1759df476a3ed4a9 | 0548dfbcdf2e6c61c579bb1b5661940ddbc34e61 | /src/edu/dlufl/chapter04/example17_2/Student.java | 883e5593eb28d053ff0fd620be7124157c465f6b | [] | no_license | wang53224/java-homework-idea | 35b3e33c0b1821604956cf989163f62e1a62588f | 93619d4751dc01e95537e0c0fdb1536fdf81db09 | refs/heads/master | 2022-12-01T20:23:47.145356 | 2020-08-21T13:11:08 | 2020-08-21T13:11:08 | 275,358,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package edu.dlufl.chapter04.example17_2;
public class Student {
int age;
String name;
public Student(String name,int age) {
super();
this.age = age;
this.name = name;
}
void study(){
System.out.println("开始上课!");
}
public String toString(){
return "Student [name=" + name + ",age=" + age + "]";
}
}
| [
"[email protected]"
] | |
ed677fffd8615e8fd96c9da1fa737c5acb75844c | 9e7719daaba59c95438dec8898b773ce563ff365 | /thread/src/main/java/com/newtouch/blockerqueue/SomeService.java | c38e5d557266b9e81695980f8fb99c8a57d237f6 | [] | no_license | Git-yangrui/java-remote-repository | bbfa1a99466d6768109f6ec63d08cce538ed21fd | 85e78ec7ad4f2515e50280120124cf96ac3e0bf6 | refs/heads/master | 2021-01-19T00:27:26.274418 | 2017-07-13T15:59:21 | 2017-07-13T15:59:21 | 87,173,114 | 3 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 2,146 | java | package com.newtouch.blockerqueue;
import java.util.Random;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import com.newtouc.twophase_termination.AbstractTerminateableThread;
public class SomeService {
public Producer getProducer() {
return producer;
}
public Consumer getConsumer() {
return consumer;
}
private final BlockingQueue<String> queue =
new ArrayBlockingQueue<String>(10);
private final Producer producer = new Producer();
private final Consumer consumer = new Consumer();
public void shutdown() {
producer.terminate(true);
consumer.terminate();
}
public void init() {
producer.start();
consumer.start();
}
private class Producer extends AbstractTerminateableThread {
private int i = 0;
@Override
protected void doRun() throws Exception {
queue.put(String.valueOf(i++));
//System.out.println("producer producted ----------------"+i);
consumer.terminationToken.reservations.incrementAndGet();
//System.out.println("Producer doRun()"+producer.terminationToken.reservations.get());
}
@Override
protected void doCleanUp(Exception cause) {
if(null!=cause&&(cause instanceof InterruptedException)){
System.out.println(Thread.currentThread().getName()+" ±»Ç¿ÐÐÖÕÖ¹ÁË");
cause.printStackTrace();
}
}
}
private class Consumer extends AbstractTerminateableThread {
@Override
protected void doRun() throws Exception {
String take = queue.take();
//System.out.println("Consumer doRun()"+consumer.terminationToken.reservations.get());
System.out.println("processing product-" + take);
try {
Thread.sleep(new Random().nextInt(100));
} catch (Exception e) {
// TODO: handle exception
} finally {
consumer.terminationToken.reservations.decrementAndGet();
}
}
}
public static void main(String[] args) throws Exception {
SomeService service=new SomeService();
service.init();
Thread.sleep(1000);
service.shutdown();
}
}
| [
"[email protected]"
] | |
db1509b428e167b645f03ec11fe992cd4819678c | b156bd662e7025d23ca7d1a5caa378bc85b3e692 | /app/src/main/java/com/qianchang/togetherlesson/activty/MessageDetialActivity.java | a078c45278034d54b35ed0c1485d653df86cd0f0 | [] | no_license | xzwzxd/TogetherLesson | 8db8e888b78099d6710891a06f76c8f30eb4b89e | ec7fb126cd134bc82dd00d13708fb504573f8864 | refs/heads/master | 2021-05-09T08:26:15.932298 | 2018-01-29T13:55:21 | 2018-01-29T13:55:21 | 119,388,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,697 | java | package com.qianchang.togetherlesson.activty;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.qianchang.togetherlesson.R;
import com.qianchang.togetherlesson.base.BaseSwipeBackCompatActivity;
import com.qianchang.togetherlesson.http.api.UrlApi;
/**
* Created by Administrator on 2017/5/21.
*/
public class MessageDetialActivity extends BaseSwipeBackCompatActivity {
private WebView webView;// web页面
private WebSettings webSettings;// web页面设置
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
initView();
initInfo();
}
private void initView() {
setTitle(getIntent().getStringExtra("title"));
webView = (WebView) findViewById(R.id.webview);
}
private void initInfo() {
webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
// 设置可以支持缩放
webView.getSettings().setSupportZoom(true);
// 设置出现缩放工具
webView.getSettings().setBuiltInZoomControls(true);
//扩大比例的缩放
webView.getSettings().setUseWideViewPort(true);
//自适应屏幕
webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webView.getSettings().setLoadWithOverviewMode(true);
webView.loadUrl(UrlApi.ip +"Message/messageshow?"+"id="+getIntent().getStringExtra("id"));
Log.d("HomeBannerDetial",UrlApi.ip +"Message/messageshow?"+"id="+getIntent().getStringExtra("id"));
}
}
| [
"16229555182qq.com"
] | 16229555182qq.com |
31e161a63726a0d0bfd8f6b9ba68388427e941ea | 8532dc6fe71ebf8389d431824de07123e7e0e456 | /src/ealtshul/main.java | 34a6eb1ed482d664a90f3c6fea8ee8e280d7c0b6 | [] | no_license | EliezerAltshul/SkipList | 77297957b175673fb1db6d350492e554b4e55ba5 | e20d2aceade19cd7f94263fed97230461887e7da | refs/heads/main | 2023-03-01T03:59:24.894703 | 2021-02-10T05:17:46 | 2021-02-10T05:17:46 | 335,739,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package ealtshul;
import java.util.*;
public class main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Random rand = new Random();
SkipList<Integer> skipList = new SkipList<Integer>();
for(int i = 0; i<10; i++) {
int index, data;
index = rand.nextInt(15);
data = rand.nextInt(15);
System.out.println("Index: " + index + " Data: " + data);
try {
skipList.insert(index, data);
} catch (NegativeIndexException e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
}
}
System.out.println("Size: " + skipList.size());
System.out.println("Height: " + skipList.height());
System.out.println(skipList.toString());
for(int i = 0; i<10; i++) {
int index = rand.nextInt(15);
System.out.println("Index: " + index + " Data: " + skipList.search(index));
}
}
}
| [
"[email protected]"
] | |
70772a2d0e82164abb748de67a13a46f6ee6f38e | 8f107b9b68cdc3ee4485f1f9c7cd8a382bcc91bb | /a010_storage/src/main/java/com/lec/android/a010_storage/MainActivity.java | 94ad9c9aa0f0db9026188cdfb545f7adc089e6a3 | [] | no_license | gksfk6165/MyAndroidWork | f79f6c3d7b4c089a02d563258fd936fd8c11765c | 35869bc19d89e17d6c4e89aa374ccd970f58e901 | refs/heads/master | 2022-06-03T09:14:27.224930 | 2020-05-06T02:46:04 | 2020-05-06T02:46:04 | 255,477,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,653 | java | package com.lec.android.a010_storage;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/**
* 안드로이드 에서 자료를 저장하는 4가지 수단
* 1. 내부파일 사용 (Internal Storage) : '앱 데이터' 저장 영역
* 2. 외부메모리 사용 (External Storage) : 사진, 동영상등 '사용자 영역'
* 3. SQLite (내장 DataBase)
* 4. SharedPreference
* <p>
* ** 외부에 (서버, 네트워크, 외부 DB) 사용이 아닌 내부 저장수단
* <p>
* https://developer.android.com/training/data-storage
* <p>
* 내부 파일 사용 (Internal Storage, App-specific storage)
* - 앱 데이터가 저장되는 영역
* - 별도의 permission 없이 사용 가능
* - 자신의 앱에서만 사용 가능, 다른 앱에서 접근 못함
* - 앱 제거시, Internal Storage 영역의 모든 데이터도 제거됨.
* - openFileOutput() 를 사용하여 저장 ( FileOutputStream 객체 리턴함 )
*/
// Device File Explorer 에서 생성된 파일 확인 가능
//pixel 폰의 경우 data/data/쭉 내려서 해당 파일에 들어가서 files 폴더안에 있음
public class MainActivity extends AppCompatActivity {
EditText et;
Button btnAppend, btnRead;
TextView tvResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
et = findViewById(R.id.et);
btnAppend = findViewById(R.id.btnAppend);
btnRead = findViewById(R.id.btnRead);
tvResult = findViewById(R.id.tvResult);
//추가하기 버튼 클릭하면 파일에 추가로 저장하기
btnAppend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String data = et.getText().toString();
try {
//openFileOutput 을 사용하여 OutputStream 객체 뽑아내기
FileOutputStream os = openFileOutput("myfile.txt", MODE_APPEND);
PrintWriter out = new PrintWriter(os);
out.println(data);
out.close();
tvResult.setText("파일 저장 완료");
} catch (IOException e) {
e.printStackTrace();
}
}
});
// 파일의 내용을 읽어서 보여주기
btnRead.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
FileInputStream is = openFileInput("myfile.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuffer data = new StringBuffer();
String str = reader.readLine(); //파일에서 한줄을 읽어오기
while(str!=null){
data.append(str +"\n");
str = reader.readLine();
}
tvResult.setText(data);
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}
| [
"[email protected]"
] | |
e8f117eeb32c562a912c0f851fc7d62f91e08463 | b5fcd3e670f9eaac29c2017c7779748b4d73aed0 | /src/main/java/inpt/multilayeredapp/springbootdemo/dao/BookDao.java | 851da8daa49feee4eb062496458a4f7bc90e7804 | [] | no_license | dall49/multilayeredJavaApp | bae4b7baa6ecd0cdab7960f9489a6c64eb8ec645 | 00e9ca5c941f18d065f41a83678ec779dd627b4e | refs/heads/main | 2023-03-20T08:51:24.180985 | 2021-03-19T20:49:01 | 2021-03-19T20:49:01 | 349,550,884 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,127 | java | package inpt.multilayeredapp.springbootdemo.dao;
import inpt.multilayeredapp.springbootdemo.model.Book;
import org.springframework.stereotype.Repository;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import javax.persistence.metamodel.EntityType;
import java.util.List;
@Repository
public class BookDao extends EntityDao<Book, Integer>{
public Class<Book> entity ;
public List<Book> findByTitle(String title){
CriteriaBuilder criteriaBuilder = getCriteriaBuilder();
CriteriaQuery<Book> criteriaQuery = getCriteriaQuery();
Root<Book> root = criteriaQuery.from(entity);
EntityType<Book> type = entityManager.getMetamodel().entity(Book.class);
CriteriaQuery<Book> query = criteriaQuery.select(root).where(
criteriaBuilder.like(
root.get(
type.getDeclaredSingularAttribute("title", String.class)),
"%" + title + "%")
);
return getQuery(query).getResultList();
}
}
| [
"[email protected]"
] | |
01fab6f7be254ce3210c42eb5bec2bbefa44920d | f1503103c7b6e4e8a287ade02ed480c8212db79d | /src/classhandling/swap.java | fbfe60c21f5276f42eaa1bc2ff6e8536656c4f7f | [] | no_license | sushmamarada/java_practies | 2cc2dc713139363e90bb407b2f6008544d08351c | c9ae4d92a8ab5e670765a447cf174d2aaddfd32b | refs/heads/master | 2020-05-16T10:55:18.388009 | 2019-04-23T11:25:24 | 2019-04-23T11:25:24 | 182,999,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | package classhandling;
public class swap {
public void swapNum(int a,int b)
{
//with using 3rd variable
//Example1:
/* int c = a + b; // c= 51 a = 25 b = 26
a = c - a; // a= 26 a = 26 b = 25
b = c - b; // b= 25*/
//Example2:
/* int c = a;
a = b;
b = c;*/
//without using 3rd variable
a = a+b;
b = a-b;
a = b-a;
System.out.println("display a value:-" + a);
System.out.println("display b value:-" + b);
}
}
| [
"[email protected]"
] | |
baf3773311e13b89a0cfd934f95bbf3c69b12f93 | bf744ba24a594529fc2e6729afe19a20b70d6fde | /Proj-supergenius-XO/.svn/pristine/ba/baf3773311e13b89a0cfd934f95bbf3c69b12f93.svn-base | 9e03575eb83e9b2f77dffb1b4df7cda572462dbb | [] | no_license | greatgy/Code | 4e3fc647999d0ff94933c0ff85bf08228de62a1f | e198b7cf90a40e531235fa9e88df211e1978e177 | refs/heads/master | 2021-10-27T16:27:19.551730 | 2019-04-18T09:43:07 | 2019-04-18T09:43:07 | 182,007,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,284 | package com.supergenius.xo.user.serviceimpl;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.genius.xo.base.dao.BaseDao;
import com.genius.xo.base.serviceimpl.BaseSOImpl;
import com.supergenius.xo.common.constants.MapperDict;
import com.supergenius.xo.user.dao.OrderLogDao;
import com.supergenius.xo.user.entity.Order;
import com.supergenius.xo.user.entity.OrderLog;
import com.supergenius.xo.user.service.OrderLogSO;
/**
* 订单日志Service
* @author diaobisong
*/
@Service
public class OrderLogSOImpl extends BaseSOImpl<OrderLog> implements OrderLogSO {
@Autowired
private OrderLogDao dao;
@Override
protected BaseDao<OrderLog> getDao() {
return dao;
}
@Override
public List<OrderLog> getByOrderList(String userUid, List<Order> orderList) {
List<String> orderUidList = new LinkedList<String>();
for(Order order : orderList){
orderUidList.add(order.getUid());
}
Map<String, Object> condition = new HashMap<String, Object>();
condition.put(MapperDict.useruid, userUid);
condition.put(MapperDict.orderuid, orderUidList);
return getDao().getList(condition);
}
}
| [
"[email protected]"
] | ||
b331717b09d7bcd83474050079ca3a7bb5788abb | b84da57f467841908c4f1278af14a1482f3ddef8 | /CompositionChallange/src/com/company/Room.java | 283bbb75a191139f1303d976f825def5e1fcda4b | [] | no_license | arnabpro007/Java-IntelliJ-Files | ff622187c85e4e9e1dbfe5ed9c0ae39b1173e76b | 8cfdb4c1edcc587eb70af476adeacfba924d5239 | refs/heads/master | 2022-11-30T22:39:57.276872 | 2020-08-11T19:33:42 | 2020-08-11T19:33:42 | 286,769,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.company;
public class Room {
private Bed thebed;
private Table thetable;
public Room(Bed thebed, Table thetable) {
this.thebed = thebed;
this.thetable = thetable;
}
public void Description(){
System.out.println("Room Description: ");
this.thebed.Description();
this.thetable.Description();
}
}
| [
"[email protected]"
] | |
d1caf4cc467b4b9b10852186924d44578633e6f5 | 30c5cbfe2d1aa8409ef5d14c37b8a867945727d5 | /HotelMngt/src/com/hospitality/core/Employee.java | 821d41cee7b3091db402124e67fae5c94fed9c65 | [] | no_license | kishore888/kts | da76d9dc095b751d1aab5bedf85af7450257e210 | 0e8919ff97f997100d80148bf33c4b3a80f9a0b3 | refs/heads/master | 2021-07-13T04:16:58.180391 | 2020-08-12T03:53:37 | 2020-08-12T03:53:37 | 190,324,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,932 | java | package com.hospitality.core;
import java.io.Serializable;
import javax.persistence.*;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.hospitality.util.BaseEntity;
import com.voodoodyne.jackson.jsog.JSOGGenerator;
/**
* The persistent class for the employee database table.
*
*/
@Entity
@Table(name="employee")
//@NamedQuery(name="Employee.findAll", query="SELECT e FROM Employee e")
@JsonIdentityInfo(generator = JSOGGenerator.class)
public class Employee extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="employee_id")
private String employeeId;
@Column(name="audhar_card_no")
private String audharCardNo;
@Column(name="correspondence_address")
private String correspondenceAddress;
@Column(name="cur_city")
private String curCity;
@Column(name="cur_state")
private String curState;
@Column(name="cur_street")
private String curStreet;
@Column(name="driving_licence_no")
private String drivingLicenceNo;
@Column(name="email_id")
private String emailId;
@Column(name="employee_name")
private String employeeName;
@Column(name="father_name")
private String fatherName;
@Column(name="gender")
private String gender;
@Column(name="image")
private String image;
@Column(name="marital_status")
private Boolean maritalStatus;
@Column(name="pan_number")
private String panNumber;
@Column(name="passport_no")
private String passportNo;
@Column(name="permanent_address")
private String permanentAddress;
@Column(name="permnt_city")
private String permntCity;
@Column(name="permnt_state")
private String permntState;
@Column(name="permnt_street")
private String permntStreet;
@Column(name="prefix")
private String prefix;
@Column(name="qualification")
private String qualification;
@Column(name="religion")
private String religion;
@Column(name="voter_id")
private String voterId;
//bi-directional many-to-one association to Hotel
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="hotel_id")
private Hotel hotel;
public Employee() {
}
public String getEmployeeId() {
return this.employeeId;
}
public void setEmployeeId(String employeeId) {
this.employeeId = employeeId;
}
public String getAudharCardNo() {
return this.audharCardNo;
}
public void setAudharCardNo(String audharCardNo) {
this.audharCardNo = audharCardNo;
}
public String getCorrespondenceAddress() {
return this.correspondenceAddress;
}
public void setCorrespondenceAddress(String correspondenceAddress) {
this.correspondenceAddress = correspondenceAddress;
}
public String getCurCity() {
return this.curCity;
}
public void setCurCity(String curCity) {
this.curCity = curCity;
}
public String getCurState() {
return this.curState;
}
public void setCurState(String curState) {
this.curState = curState;
}
public String getCurStreet() {
return this.curStreet;
}
public void setCurStreet(String curStreet) {
this.curStreet = curStreet;
}
public String getDrivingLicenceNo() {
return this.drivingLicenceNo;
}
public void setDrivingLicenceNo(String drivingLicenceNo) {
this.drivingLicenceNo = drivingLicenceNo;
}
public String getEmailId() {
return this.emailId;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
public String getEmployeeName() {
return this.employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public String getFatherName() {
return this.fatherName;
}
public void setFatherName(String fatherName) {
this.fatherName = fatherName;
}
public String getGender() {
return this.gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getImage() {
return this.image;
}
public void setImage(String image) {
this.image = image;
}
public Boolean getMaritalStatus() {
return this.maritalStatus;
}
public void setMaritalStatus(Boolean maritalStatus) {
this.maritalStatus = maritalStatus;
}
public String getPanNumber() {
return this.panNumber;
}
public void setPanNumber(String panNumber) {
this.panNumber = panNumber;
}
public Hotel getHotel() {
return hotel;
}
public void setHotel(Hotel hotel) {
this.hotel = hotel;
}
public String getPassportNo() {
return this.passportNo;
}
public void setPassportNo(String passportNo) {
this.passportNo = passportNo;
}
public String getPermanentAddress() {
return this.permanentAddress;
}
public void setPermanentAddress(String permanentAddress) {
this.permanentAddress = permanentAddress;
}
public String getPermntCity() {
return this.permntCity;
}
public void setPermntCity(String permntCity) {
this.permntCity = permntCity;
}
public String getPermntState() {
return this.permntState;
}
public void setPermntState(String permntState) {
this.permntState = permntState;
}
public String getPermntStreet() {
return this.permntStreet;
}
public void setPermntStreet(String permntStreet) {
this.permntStreet = permntStreet;
}
public String getPrefix() {
return this.prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getQualification() {
return this.qualification;
}
public void setQualification(String qualification) {
this.qualification = qualification;
}
public String getReligion() {
return this.religion;
}
public void setReligion(String religion) {
this.religion = religion;
}
public String getVoterId() {
return this.voterId;
}
public void setVoterId(String voterId) {
this.voterId = voterId;
}
} | [
"KISHORE@KISHORE-PC"
] | KISHORE@KISHORE-PC |
96b449b4f6d6bd8a6f3cf1b01baf815bfc507ce8 | 89429f141373bf2c8b151b4dbd3e0f16d906d3fc | /src/java/com/cofar/bean/SolicitudMantenimientoDetalleTareas.java | aef1fa3215b4320b5ccdb57c22f7c859054531f7 | [] | no_license | MarcoLunaGonzales/almacenes | 6805fb3594f32ad15eb583590bc3f89d1a4f423e | 42088040e753e37eb91f9e00700e672edea4b235 | refs/heads/master | 2020-03-11T17:44:29.165175 | 2018-04-19T11:07:15 | 2018-04-19T11:07:15 | 130,155,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,904 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.cofar.bean;
import java.util.Date;
/**
*
* @author hvaldivia
*/
public class SolicitudMantenimientoDetalleTareas extends AbstractBean{
SolicitudMantenimiento solicitudMantenimiento = new SolicitudMantenimiento();
TiposTarea tiposTarea = new TiposTarea();
String descripcion = "";
Personal personal = new Personal();
Date fechaInicial = new Date();
Date fechaFinal = new Date();
Proveedores proveedores = new Proveedores();
float horasHombre = 0;
Boolean conSolicitudMantenimientoPreventiva = new Boolean(false);
private Date horaInicial=new Date();
private Date horaFinal=new Date();
private int turno=0;
private boolean terminado=false;
private boolean repuestos=false;
private float horasExtra=0;
boolean registroHorasExtra=false;
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public Date getFechaFinal() {
return fechaFinal;
}
public void setFechaFinal(Date fechaFinal) {
this.fechaFinal = fechaFinal;
}
public Date getFechaInicial() {
return fechaInicial;
}
public void setFechaInicial(Date fechaInicial) {
this.fechaInicial = fechaInicial;
}
public float getHorasHombre() {
return horasHombre;
}
public void setHorasHombre(float horasHombre) {
this.horasHombre = horasHombre;
}
public Personal getPersonal() {
return personal;
}
public void setPersonal(Personal personal) {
this.personal = personal;
}
public Proveedores getProveedores() {
return proveedores;
}
public void setProveedores(Proveedores proveedores) {
this.proveedores = proveedores;
}
public SolicitudMantenimiento getSolicitudMantenimiento() {
return solicitudMantenimiento;
}
public void setSolicitudMantenimiento(SolicitudMantenimiento solicitudMantenimiento) {
this.solicitudMantenimiento = solicitudMantenimiento;
}
public TiposTarea getTiposTarea() {
return tiposTarea;
}
public void setTiposTarea(TiposTarea tiposTarea) {
this.tiposTarea = tiposTarea;
}
public Boolean getConSolicitudMantenimientoPreventiva() {
return conSolicitudMantenimientoPreventiva;
}
public void setConSolicitudMantenimientoPreventiva(Boolean conSolicitudMantenimientoPreventiva) {
this.conSolicitudMantenimientoPreventiva = conSolicitudMantenimientoPreventiva;
}
public Date getHoraFinal() {
return horaFinal;
}
public void setHoraFinal(Date horaFinal) {
this.horaFinal = horaFinal;
}
public Date getHoraInicial() {
return horaInicial;
}
public void setHoraInicial(Date horaInicial) {
this.horaInicial = horaInicial;
}
public float getHorasExtra() {
return horasExtra;
}
public void setHorasExtra(float horasExtra) {
this.horasExtra = horasExtra;
}
public boolean isRepuestos() {
return repuestos;
}
public void setRepuestos(boolean repuestos) {
this.repuestos = repuestos;
}
public boolean isTerminado() {
return terminado;
}
public void setTerminado(boolean terminado) {
this.terminado = terminado;
}
public int getTurno() {
return turno;
}
public void setTurno(int turno) {
this.turno = turno;
}
public boolean isRegistroHorasExtra() {
return registroHorasExtra;
}
public void setRegistroHorasExtra(boolean registroHorasExtra) {
this.registroHorasExtra = registroHorasExtra;
}
}
| [
"[email protected]"
] | |
0385850595fd0cb9c1d2c281c9136558679cd466 | 97fd7618f4b317497214b74cee3203cf9e696d9c | /app/src/androidTest/java/com/winklix/indu/healthcareapp/ExampleInstrumentedTest.java | cc5b2e5ff9cc4bc4953f1e5078f236c1f3dde23a | [] | no_license | Anki10/HealthCareApp | b48cd10afc717ceabe53a9da28abbc20fbc92e5a | c34a784c3f6d56159c0771fe206156bcb34fdf6c | refs/heads/master | 2021-05-10T07:52:07.714259 | 2018-02-13T09:06:02 | 2018-02-13T09:06:02 | 118,864,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package com.winklix.indu.healthcareapp;
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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.winklix.indu.healthcareapp", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
e13648b36751c11055eef3cdfd616c44f78b6cb0 | 4b69b3d0e7fc611391b5966c5caa9bbacc76e117 | /src/main/java/vn/com/buscu/bean/ErrorException.java | e609737f7fb31b68336227ba3d20075d6d9490b5 | [] | no_license | nguyenducdaitoan/buscu | f90f95b90acc4bb74b62373bcd715848f9ce6d2b | 9a543cb74110f0737407351c32f43af474732b1f | refs/heads/master | 2017-12-16T15:55:51.894934 | 2017-11-07T08:55:47 | 2017-11-07T08:55:47 | 77,502,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package vn.com.buscu.bean;
/**
* ErrorException
*
* @version 1.0
* @author ToanNDD
*/
public class ErrorException {
private String errCode;
private String errMsg;
/**
* Constructor
*/
public ErrorException() {
}
/**
* Constructor error code and error message of objects to create
*
*/
public ErrorException(String errCode, String errMsg) {
this.errCode = errCode;
this.errMsg = errMsg;
}
/**
*
* @return errCode
*/
public String getErrCode() {
return errCode;
}
/**
* @param errCode the errCode to set
*/
public void setErrCode(String errCode) {
this.errCode = errCode;
}
/**
*
* @return errMsg
*/
public String getErrMsg() {
return errMsg;
}
/**
* @param errMsg the errMsg to set
*/
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
}
| [
"[email protected]"
] | |
1fc56afce134c2aaa0e55ca165592470df63908e | 5aed03712104cba4382a4d36fcd5e523a00c494e | /src/main/java/Patterns/MergeIntervals/BurstBalloons.java | 045af4dbd32dc0b2e4fbcba8b1e529e72409d3d1 | [] | no_license | aarora0301/leetcode | 85432124f4ad9808a75b4a193dbbbd9a90d69d7d | 78433499e0ecc51d312b08ca6a7b1aa1245dd2c8 | refs/heads/master | 2022-08-30T01:41:07.944394 | 2022-08-03T18:45:22 | 2022-08-03T18:45:22 | 228,975,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package Patterns.MergeIntervals;
/****
* https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/
*/
public class BurstBalloons {
}
| [
"[email protected]"
] | |
13ef1547eb4ab1d517e2b0fe8fc6fb2c8ebef65c | d7462ec35d59ed68f306b291bd8e505ff1d65946 | /common/asm/src/main/java/com/alibaba/citrus/asm/tree/FieldNode.java | 29383f37bb0eabd39c08abbee1861014e30c5075 | [] | no_license | ixijiass/citrus | e6d10761697392fa51c8a14d4c9f133f0a013265 | 53426f1d73cc86c44457d43fb8cbe354ecb001fd | refs/heads/master | 2023-05-23T13:06:12.253428 | 2021-06-15T13:05:59 | 2021-06-15T13:05:59 | 368,477,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,519 | java | /*
* Copyright 2010 Alibaba Group Holding Limited.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/***
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2007 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.alibaba.citrus.asm.tree;
import com.alibaba.citrus.asm.Attribute;
import com.alibaba.citrus.asm.ClassVisitor;
import com.alibaba.citrus.asm.FieldVisitor;
/**
* A node that represents a field.
*
* @author Eric Bruneton
*/
public class FieldNode extends MemberNode implements FieldVisitor {
/**
* The field's access flags (see {@link com.alibaba.citrus.asm.Opcodes}).
* This field also indicates if the field is synthetic and/or deprecated.
*/
public int access;
/**
* The field's name.
*/
public String name;
/**
* The field's descriptor (see {@link com.alibaba.citrus.asm.Type}).
*/
public String desc;
/**
* The field's signature. May be <tt>null</tt>.
*/
public String signature;
/**
* The field's initial value. This field, which may be <tt>null</tt> if the
* field does not have an initial value, must be an {@link Integer}, a
* {@link Float}, a {@link Long}, a {@link Double} or a {@link String}.
*/
public Object value;
/**
* Constructs a new {@link FieldNode}.
*
* @param access the field's access flags (see
* {@link com.alibaba.citrus.asm.Opcodes}). This parameter also
* indicates if the field is synthetic and/or deprecated.
* @param name the field's name.
* @param desc the field's descriptor (see
* {@link com.alibaba.citrus.asm.Type Type}).
* @param signature the field's signature.
* @param value the field's initial value. This parameter, which may be
* <tt>null</tt> if the field does not have an initial value,
* must be an {@link Integer}, a {@link Float}, a {@link Long}, a
* {@link Double} or a {@link String}.
*/
public FieldNode(final int access, final String name, final String desc, final String signature, final Object value) {
this.access = access;
this.name = name;
this.desc = desc;
this.signature = signature;
this.value = value;
}
/**
* Makes the given class visitor visit this field.
*
* @param cv a class visitor.
*/
public void accept(final ClassVisitor cv) {
FieldVisitor fv = cv.visitField(access, name, desc, signature, value);
if (fv == null) {
return;
}
int i, n;
n = visibleAnnotations == null ? 0 : visibleAnnotations.size();
for (i = 0; i < n; ++i) {
AnnotationNode an = (AnnotationNode) visibleAnnotations.get(i);
an.accept(fv.visitAnnotation(an.desc, true));
}
n = invisibleAnnotations == null ? 0 : invisibleAnnotations.size();
for (i = 0; i < n; ++i) {
AnnotationNode an = (AnnotationNode) invisibleAnnotations.get(i);
an.accept(fv.visitAnnotation(an.desc, false));
}
n = attrs == null ? 0 : attrs.size();
for (i = 0; i < n; ++i) {
fv.visitAttribute((Attribute) attrs.get(i));
}
fv.visitEnd();
}
}
| [
"[email protected]"
] | |
698808d1574da859c80abd3ebb4f13ab8495421a | 57ba5de1dd1f6c07b2589408226a603913ee6519 | /EnhancedAdverts/src/cz/cuni/mff/ms/brodecva/ws/adverts/enhanced/model/Crimes.java | c66627203fafa9502b15b3426b33446b076d8b50 | [] | no_license | brodecva/EnhancedAdvertsWS | f7fbde81dc97d97193c2e35a943fef69b3d2f5c2 | a1bd55f166eaa3783204a974253d81f18a1e11f5 | refs/heads/master | 2021-01-01T04:50:30.536254 | 2016-05-26T10:51:44 | 2016-05-26T10:51:44 | 59,742,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | package cz.cuni.mff.ms.brodecva.ws.adverts.enhanced.model;
import java.util.List;
public class Crimes {
private List<Crime> crimes;
public List<Crime> getCrimes() {
return this.crimes;
}
public void setCrimes(List<Crime> crimes) {
this.crimes = crimes;
}
}
| [
"[email protected]"
] | |
f72fac02155e8e8e597d5fa184130d462219a9b4 | 9ce5a9ea4c0d7d8586fe4c87f732987acf880b43 | /src/main/java/com/example/h2springboot/demo/config/SecurityConfig.java | 7efeb4ef8938241b5c2187f54bd43533ad7ceb1a | [] | no_license | chaminduonline/springbootlogin-h2db | 63b5287ae81c6006c87dd717063521d86429578d | a05892069c762f2c3c08e59cc1ab21e8921ed09a | refs/heads/master | 2020-05-04T15:47:50.557105 | 2019-04-03T10:40:43 | 2019-04-03T10:40:43 | 179,256,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,992 | java | package com.example.h2springboot.demo.config;
import com.example.h2springboot.demo.service.CustomAuthenticationProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final CustomAuthenticationProvider customAuthenticationProvider;
private final BCryptPasswordEncoder passwordEncoder;
@Autowired
public SecurityConfig(CustomAuthenticationProvider customAuthenticationProvider, BCryptPasswordEncoder passwordEncoder) {
this.customAuthenticationProvider = customAuthenticationProvider;
this.passwordEncoder = passwordEncoder;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(this.customAuthenticationProvider).passwordEncoder(this.passwordEncoder);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().antMatcher("/**").authorizeRequests()
.antMatchers("/h2**","/login**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/login")
.defaultSuccessUrl("/home")
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).permitAll()
.and()
.sessionManagement().maximumSessions(1)
.expiredUrl("/login");
}
}
| [
"[email protected]"
] | |
dadb26d2472876b1199e4901b190d04743c93dc2 | 6ea62ba4201a61cba818077802b5105a54ac8952 | /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Originatee.java | 010df6597a395a6ff4585fc5ce3cf2a92a9802ec | [
"Apache-2.0"
] | permissive | astra-zhao/softswitch-gateway | 25649d993c43fc321d0b61db6ac6e828e181e522 | 9185453302e8e06e615eaf842968db73b858d0e6 | refs/heads/main | 2023-08-30T17:46:02.910127 | 2021-11-12T09:04:17 | 2021-11-12T09:04:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.atomscat.freeswitch.cdr.domain;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>Originatee class.</p>
*
* @author : <a href="mailto:[email protected]">zhouhailin</a>
* @version $Id: $Id
*/
@Data
@Accessors(chain = true)
public class Originatee {
private OriginateeCallerProfile originateeCallerProfile;
}
| [
"[email protected]"
] | |
7eae306126bdf6e43b8934fd8bcebf02b968f152 | cf0090786f35d7f7874c8f9a9949ae8d746587b5 | /ServerServlet/src/com/noobyang/header/RefreshServlet.java | cde652e08baf698fbfcc391e7a4360434fddefc5 | [] | no_license | noobyang/server_examples | 1a5233401378ffca255f0d63cdbc893c0b0d03f8 | 50bff6ab92748204d5618e65905c38da16885507 | refs/heads/master | 2023-02-05T17:27:29.954460 | 2020-12-21T07:42:15 | 2020-12-21T07:42:15 | 291,211,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package com.noobyang.header;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(name = "RefreshServlet", urlPatterns = "/RefreshServlet")
public class RefreshServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 每3秒自动刷新网页一次
// resp.setHeader("Refresh", "3");
// resp.getWriter().write("time is :" + System.currentTimeMillis());
resp.setContentType("text/html;charset=UTF-8");
resp.getWriter().write("3秒后跳转页面.....");
// 三秒后跳转到index.jsp页面去,web应用的映射路径我设置成/,url没有写上应用名
resp.setHeader("Refresh", "3;url='/index.jsp'");
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPost(req, resp);
}
}
| [
"1234567890"
] | 1234567890 |
75baafc526f9f0812b7eda49e81ef8b942e1d933 | eda55768edfa9e5611077db44bef49fd9f443227 | /src/brewery/gui/quickStart/ReviewInputStepsPanel.java | 8ff6762f1fa6bc4ce56072944e2c6b574e8a1af4 | [] | no_license | foxirving/BreweryProgram | dedcf5311cbd1e0133f8c80b6e2a320f61241789 | c0520ce5719f7d2e0f45c427541a460343730fbf | refs/heads/master | 2020-05-02T02:30:11.627011 | 2015-05-13T01:29:55 | 2015-05-13T01:29:55 | 32,889,853 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,486 | java | package brewery.gui.quickStart;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import brewery.gui.AllPanels;
import brewery.gui.GuiFactory;
import brewery.gui.MainFrame;
public class ReviewInputStepsPanel extends JPanel {
private static final long serialVersionUID = 1L;
private static MainFrame frame;
private static AllPanels panels;
public ReviewInputStepsPanel(MainFrame mainFrame, AllPanels allPanels) {
// initialize man frame and all the panels
frame = mainFrame;
panels = allPanels;
// defines the panel dimensions
JPanel panel = new JPanel();
panel.setSize(new Dimension(800, 480));
setBackground(new Color(230, 180, 140));
// card layout is very important when adding the panels to the main
// frame
setLayout(new CardLayout(0, 0));
// add all buttons, labels, etc., to this JPanel(container)
JPanel container = new JPanel();
container.setBackground(new Color(204, 153, 102));
add(container, "containerOne");
container.setLayout(null);
GuiFactory.newLabel("Review Input Steps Panel", container, 200, 200);
GuiFactory.addButton(getParent(), "next", container, 400, 50,
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
panels.getReviewInputStepsPanel().setVisible(false);
panels.getInProcessPanel().setVisible(true);
}
});
}
}
| [
"[email protected]"
] | |
585f6ce568bdc048c1bb6c6191cc882e8ac44188 | 1ceffef92c453da11cff27fa3f1b4ed54b6f9867 | /app/src/main/java/com/example/arturmusayelyan/fragments/BlankFragment.java | 3b7b58c2d36dbeee2adb1840aa114ba12a24a084 | [] | no_license | musayelyan/Fragments | 821be911564ca22d81d63b8ceea0666449cc710e | 4db6355b58e085246c425130fba1be2e168e06e0 | refs/heads/master | 2021-08-31T13:40:36.101545 | 2017-12-21T14:38:41 | 2017-12-21T14:38:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,638 | java | package com.example.arturmusayelyan.fragments;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link BlankFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link BlankFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class BlankFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
public BlankFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment BlankFragment.
*/
// TODO: Rename and change types and number of parameters
public static BlankFragment newInstance(String param1, String param2) {
BlankFragment fragment = new BlankFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_blank, container, false);
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
| [
"[email protected]"
] | |
9e56fbd3b18532535b4d7be5d312c59794379ad4 | d5ca8c5fa3d1c08f8807b9e9c3f4c75be02b3519 | /src/main/java/com/sda/zdjavapol92/dp/singleton/Main.java | a854a17722c5b7af9a6df2af703e9549eeb24cce | [] | no_license | SaintAmeN/zd_java_92_dp | 6b72789c65e2a6d1deed0f8818b1d18a1f528109 | 2320e303cd854d034e384429e33f3e7a6c2b9665 | refs/heads/master | 2023-07-05T18:40:33.245725 | 2021-08-12T18:35:31 | 2021-08-12T18:35:31 | 391,576,880 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package com.sda.zdjavapol92.dp.singleton;
public class Main {
public static void main(String[] args) {
// V1 tworzy się po załadowaniu klasy
// eager
// SingletonV1.getInstance().wypiszNazwyPizzy();
// V2 tworzy się w momencie wywołania getInstance()
// lazy
// SingletonV2.getInstance().wypiszNazwyPizzy();
// V3 tworzy się w momencie wywołania getInstance()
// lazy
// jest zabezpieczone wielowątkowo
// SingletonV3.getInstance().wypiszNazwyPizzy();
// V4
// eager jak V1
SingletonV4.INSTANCE.wypiszNazwyPizzy();
}
}
| [
"[email protected]"
] | |
1640a9be149d45910bac26f0374fa80d1366cd94 | 297c070e055a39ae076528fee2816637eb8b8301 | /push-sample/src/main/java/io/pivotal/android/push/sample/service/PushService.java | 09f66d933beabc12a6942851301825e8d3549040 | [] | no_license | tspannatpivotal/push-android-samples | aa21ba7b4ed460c1c4271144df0580f1e10fdded | 81fde41fea1b29e09fc54865e600e6a24ba644f0 | refs/heads/master | 2020-04-05T19:01:51.828325 | 2014-09-03T15:36:07 | 2014-09-03T15:36:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,463 | java | /*
* Copyright (C) 2014 Pivotal Software, Inc. All rights reserved.
*/
package io.pivotal.android.push.sample.service;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import io.pivotal.android.push.sample.R;
import io.pivotal.android.push.sample.activity.MainActivity;
import io.pivotal.android.push.service.GcmService;
import io.pivotal.android.push.util.Logger;
public class PushService extends GcmService {
public static final int NOTIFICATION_ID = 1;
private static final int NOTIFICATION_LIGHTS_COLOUR = 0xff008981;
private static final int NOTIFICATION_LIGHTS_ON_MS = 500;
private static final int NOTIFICATION_LIGHTS_OFF_MS = 1000;
@Override
public void onReceiveMessage(Bundle payload) {
String message;
if (payload.containsKey("message")) {
message = "Received: \"" + payload.getString("message") + "\".";
} else {
message = "Received message with no extras.";
}
Logger.i(message);
sendNotification(message);
}
@Override
public void onReceiveMessageDeleted(Bundle payload) {
Logger.i("Received message with type 'MESSAGE_TYPE_DELETED'.");
sendNotification("Deleted messages on server: " + payload.toString());
}
@Override
public void onReceiveMessageSendError(Bundle payload) {
Logger.i("Received message with type 'MESSAGE_TYPE_SEND_ERROR'.");
sendNotification("Send error: " + payload.toString());
}
private void sendNotification(String msg) {
final NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
final PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setLights(NOTIFICATION_LIGHTS_COLOUR, NOTIFICATION_LIGHTS_ON_MS, NOTIFICATION_LIGHTS_OFF_MS)
.setSmallIcon(R.drawable.ic_pivotal_logo)
.setContentTitle("Push Sample")
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setContentIntent(contentIntent)
.setContentText(msg);
notificationManager.notify(NOTIFICATION_ID, builder.build());
}
}
| [
"[email protected]"
] | |
68f34de54cf40285b290c79cc52a79c9d684f1da | e1f76596ea37d907d44f8c1f0bbcc088d5345c36 | /src/main/java/com/pop/spark/samples/sparkSql/HousePriceProblem.java | e6bfa0fb74f0f418b5d2b18b815d9b195abec301 | [] | no_license | popprem/Spark-examples | a46cbe0fdf638e5ecf2b7d18e839d8be884a4e22 | a1a5b8b360660f774419ea806e397cb8b55659c1 | refs/heads/master | 2021-07-20T00:05:55.507599 | 2017-10-29T12:20:38 | 2017-10-29T12:20:38 | 108,731,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,984 | java | package com.pop.spark.samples.sparkSql;
public class HousePriceProblem {
/* Create a Spark program to read the house data from in/RealEstate.csv,
group by location, aggregate the average price per SQ Ft and max price, and sort by average price per SQ Ft.
The houses dataset contains a collection of recent real estate listings in San Luis Obispo county and
around it.
The dataset contains the following fields:
1. MLS: Multiple listing service number for the house (unique ID).
2. Location: city/town where the house is located. Most locations are in San Luis Obispo county and
northern Santa Barbara county (Santa MariaOrcutt, Lompoc, Guadelupe, Los Alamos), but there
some out of area locations as well.
3. Price: the most recent listing price of the house (in dollars).
4. Bedrooms: number of bedrooms.
5. Bathrooms: number of bathrooms.
6. Size: size of the house in square feet.
7. Price/SQ.ft: price of the house per square foot.
8. Status: type of sale. Thee types are represented in the dataset: Short Sale, Foreclosure and Regular.
Each field is comma separated.
Sample output:
+----------------+-----------------+----------+
| Location| avg(Price SQ Ft)|max(Price)|
+----------------+-----------------+----------+
| Oceano| 1145.0| 1195000|
| Bradley| 606.0| 1600000|
| San Luis Obispo| 459.0| 2369000|
| Santa Ynez| 391.4| 1395000|
| Cayucos| 387.0| 1500000|
|.............................................|
|.............................................|
|.............................................|
*/
}
| [
"[email protected]"
] | |
59ffdf0597c17d2d8b547c6bfbe2051c1184f6a4 | 855b4041b6a7928988a41a5f3f7e7c7ae39565e4 | /hk/src/com/hk/web/hk4/user/RegUser.java | 932bf88763bb24890d8170d7c55b330cb9bf154c | [] | no_license | mestatrit/newbyakwei | 60dca96c4c21ae5fcf6477d4627a0eac0f76df35 | ea9a112ac6fcbc2a51dbdc79f417a1d918aa4067 | refs/heads/master | 2021-01-10T06:29:50.466856 | 2013-03-07T08:09:58 | 2013-03-07T08:09:58 | 36,559,185 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,275 | java | package com.hk.web.hk4.user;
import java.util.ArrayList;
import java.util.List;
import com.hk.bean.User;
import com.hk.frame.util.DataUtil;
import com.hk.frame.util.HkUtil;
import com.hk.frame.web.http.HkRequest;
import com.hk.svr.pub.Err;
public class RegUser {
private String mobile;
private String email;
private String password;
private String repassword;
private byte sex;
private String code;
private String nickName;
private HkRequest req;
/**
* 数据输入验证
*
* @param req
* @param checkPassword 是否检查密码
*/
public RegUser(HkRequest req) {
this.req = req;
code = req.getString("code");
email = req.getString("email");
mobile = req.getString("mobile");
password = req.getString("password");
repassword = req.getString("repassword");
sex = req.getByte("sex", (byte) -1);
nickName = req.getString("nickName");
}
/**
* @param needzyCode true:需要验证码,false:不需要
* @return
* 2010-4-28
*/
public List<Integer> validate(boolean needzyCode) {
List<Integer> list = new ArrayList<Integer>();
if (needzyCode) {
if (DataUtil.isEmpty(code)) {
list.add(Err.REG_INPUT_VALIDATECODE);
}
String session_code = (String) req
.getSessionValue(HkUtil.CLOUD_IMAGE_AUTH);
if (session_code == null || !session_code.equals(code)) {
list.add(Err.REG_INPUT_VALIDATECODE);
}
}
if (password == null) {
list.add(Err.PASSWORD_DATA_ERROR);
}
if (password != null && !password.equals(repassword)) {
list.add(Err.REG_2_PASSWORD_NOT_SAME);
}
if (DataUtil.isEmpty(email)) {
list.add(Err.EMAIL_ERROR);
}
if (!DataUtil.isLegalEmail(email)) {
list.add(Err.EMAIL_ERROR);
}
if (!DataUtil.isEmpty(mobile) && !DataUtil.isLegalMobile(mobile)) {
list.add(Err.MOBILE_ERROR);
}
if (sex != User.SEX_FEMALE && sex != User.SEX_MALE) {
list.add(Err.SEX_ERROR);
}
if (!DataUtil.isLegalPassword(password)) {
list.add(Err.PASSWORD_DATA_ERROR);
}
if (DataUtil.isEmpty(nickName)) {
list.add(Err.NICKNAME_ERROR);
}
int c = User.validateNickName(nickName);
if (c != Err.SUCCESS) {
list.add(Err.NICKNAME_ERROR2);
}
return list;
}
public String getMobile() {
return mobile;
}
public String getEmail() {
return email;
}
public String getPassword() {
return password;
}
public String getRepassword() {
return repassword;
}
public byte getSex() {
return sex;
}
public String getCode() {
return code;
}
public HkRequest getReq() {
return req;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public void setEmail(String email) {
this.email = email;
}
public void setPassword(String password) {
this.password = password;
}
public void setRepassword(String repassword) {
this.repassword = repassword;
}
public void setSex(byte sex) {
this.sex = sex;
}
public void setCode(String code) {
this.code = code;
}
public void setReq(HkRequest req) {
this.req = req;
}
} | [
"[email protected]"
] | |
9892c1037e5b7a9618ba6848bc42a8ccdcc1d973 | 7094ce4a5dbd47a0df24a1e4eccb9551d910f993 | /papercheck/src/test/java/utils/SimHashTest.java | 252b757eae8d7d13d5d96f6a1271258ac585e9ff | [] | no_license | ny0416/3219005489 | a7178cbd82946c4efc1e747f9244641b187ccf50 | fe4fe342ae531bc19a74542a196d8918766bc018 | refs/heads/main | 2023-09-03T11:54:14.539537 | 2021-10-25T14:38:15 | 2021-10-25T14:38:15 | 406,237,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package utils;
@SuppressWarnings("unused")
class SimHashTest {
public void getHashTest(){
String[] strings = {"余华", "是", "一位", "真正", "的", "作家"};
for (String string : strings) {
String stringHash = SimHash.getHash(string);
System.out.println(stringHash.length());
System.out.println(stringHash);
}
}
public void getSimHashTest(){
String str0 = TxtIO.readTxt("D:/JAVA/rg/测试文本/orig.txt");
String str1 = TxtIO.readTxt("D:/JAVA/rg/测试文本/orig_0.8_add.txt");
System.out.println(SimHash.getSimHash(str0));
System.out.println(SimHash.getSimHash(str1));
}
} | [
"[email protected]"
] | |
81b3ec78072bc0dc857123274b55f429563fd307 | 3f3d97f31fd9f6373d57f35d29b7b096fd51878d | /src/main/java/org/vfspoc/core/Attribute.java | f2e950b65b6f797b3100c26488593d7342072f81 | [] | no_license | abarhub/vfspoc | e3d63ad702316ea61e68f4ff2196ab13583a153f | 5001430a4f92cd70aea3030a317ffce48806174a | refs/heads/develop | 2022-01-19T22:27:34.155373 | 2021-12-27T07:20:35 | 2021-12-27T07:20:35 | 202,562,587 | 0 | 0 | null | 2022-01-04T16:35:39 | 2019-08-15T15:07:00 | Java | UTF-8 | Java | false | false | 5,315 | java | package org.vfspoc.core;
import org.vfspoc.exception.VFSInvalidPathException;
import org.vfspoc.util.ValidationUtils;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.attribute.*;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.function.Supplier;
public class Attribute extends AbstractOperation {
public Attribute(FileManager fileManager) {
super(fileManager);
}
public PathName setAttribute(PathName path, String attribute, Object value, LinkOption... options) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
ValidationUtils.checkNotEmpty(attribute,"attribute is empty");
Path p=getRealFile(path);
Path pathRes= Files.setAttribute(p, attribute,value, options);
return convertFromRealPath(pathRes).orElseThrow(throwInvalidePath(pathRes));
}
public PathName setLastModifiedTime(PathName path, FileTime time) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
ValidationUtils.checkNotNull(time,"time is null");
Path p=getRealFile(path);
Path pathRes= Files.setLastModifiedTime(p, time);
return convertFromRealPath(pathRes).orElseThrow(throwInvalidePath(pathRes));
}
public PathName setOwner(PathName path, UserPrincipal userPrincipal) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
ValidationUtils.checkNotNull(userPrincipal,"userPrincipal is null");
Path p=getRealFile(path);
Path pathRes= Files.setOwner(p, userPrincipal);
return convertFromRealPath(pathRes).orElseThrow(throwInvalidePath(pathRes));
}
public PathName setPosixFilePermissions(PathName path, Set<PosixFilePermission> posixFilePermissions) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
ValidationUtils.checkNotNull(posixFilePermissions,"posixFilePermissions is null");
Path p=getRealFile(path);
Path pathRes= Files.setPosixFilePermissions(p, posixFilePermissions);
return convertFromRealPath(pathRes).orElseThrow(throwInvalidePath(pathRes));
}
public Object getAttribute(PathName path, String attribute, LinkOption... options) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
ValidationUtils.checkNotEmpty(attribute,"attribute is empty");
Path p=getRealFile(path);
return Files.getAttribute(p, attribute, options);
}
public <T extends FileAttributeView> T getFileAttributeView(PathName path, Class<T> type, LinkOption... options) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
Path p=getRealFile(path);
return Files.getFileAttributeView(p, type, options);
}
public FileTime getLastModifiedTime(PathName path, LinkOption... options) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
Path p=getRealFile(path);
return Files.getLastModifiedTime(p, options);
}
public UserPrincipal getOwner(PathName path, LinkOption... options) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
Path p=getRealFile(path);
return Files.getOwner(p, options);
}
public Set<PosixFilePermission> getPosixFilePermissions(PathName path, LinkOption... options) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
Path p=getRealFile(path);
return Files.getPosixFilePermissions(p, options);
}
public boolean isExecutable(PathName path) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
Path p=getRealFile(path);
return Files.isExecutable(p);
}
public boolean isReadable(PathName path) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
Path p=getRealFile(path);
return Files.isReadable(p);
}
public boolean isHidden(PathName path) throws IOException {
ValidationUtils.checkNotNull(path,"Path is null");
Path p=getRealFile(path);
return Files.isHidden(p);
}
public boolean isWritable(PathName file) {
ValidationUtils.checkNotNull(file,"Path is null");
Path p=getRealFile(file);
return Files.isWritable(p);
}
public Map<String, Object> readAttributes(PathName file, String attribute, LinkOption... options) throws IOException {
ValidationUtils.checkNotNull(file,"Path is null");
ValidationUtils.checkNotEmpty(attribute,"attribute is empty");
Path p=getRealFile(file);
return Files.readAttributes(p, attribute, options);
}
public <T extends BasicFileAttributes> T readAttributes(PathName file, Class<T> type, LinkOption... options) throws IOException {
ValidationUtils.checkNotNull(file,"Path is null");
ValidationUtils.checkNotNull(type,"type is null");
Path p=getRealFile(file);
return Files.readAttributes(p, type, options);
}
private Supplier<VFSInvalidPathException> throwInvalidePath(Path path) {
return () -> new VFSInvalidPathException("Invalide Path", path);
}
}
| [
"[email protected]"
] | |
1985e70431659a2ba99fb4d34facd25db702537b | 87506e2941c8053d5c3e0410a823af1c33c8531a | /src/main/java/top/atstudy/basic/netty/netty/handler/MessageClientInitializer.java | 5a8926dd3e50526b8075b4906ddc8d4b61901f79 | [] | no_license | HDXin/basic-demo | 7c40e406aec3088ecfee8f7d7d200a8cbbcde36c | ff1d2cb291e4949765938e581d54cd23563c050c | refs/heads/master | 2023-04-24T07:29:03.098106 | 2023-04-02T13:04:00 | 2023-04-02T13:04:00 | 172,630,887 | 0 | 0 | null | 2023-03-11T02:12:17 | 2019-02-26T03:26:46 | Java | UTF-8 | Java | false | false | 775 | java | package top.atstudy.basic.netty.netty.handler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
public class MessageClientInitializer extends ChannelInitializer<SocketChannel> {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
// 获取到管道
ChannelPipeline pipeline = ch.pipeline();
System.out.println("===>> pipeline:" + pipeline.hashCode());
// 加入一个netty提供的ServerCodec codec => [coder - decoder]
pipeline.addLast(new MyLongToByteEncoder());
// 2、添加一个自定义的 handler
pipeline.addLast(new MessageClientHandler());
System.out.println(" ok ~~~ ");
}
}
| [
"[email protected]"
] | |
7a36cf4029e87037a2ac648ab6535c65e9377d80 | 984b4459c3e303cc4a4baf5f5bba7d793018aa53 | /app/src/main/java/com/ckr/mediabrowser/presenter/OnDataLoadListener.java | a180d5cc61c84bf29fdb2bad5b5e0209cd65195d | [] | no_license | ckrgithub/MediaBrowser | b5354f2632b83b33303d02d34eee770b1acd03e7 | ba567a81bb0af6381fafaa0efaeda2d88db7be83 | refs/heads/master | 2020-03-15T17:26:00.403763 | 2018-07-22T14:07:23 | 2018-07-22T14:07:23 | 132,260,232 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package com.ckr.mediabrowser.presenter;
import java.util.List;
/**
* Created by PC大佬 on 2018/5/19.
*/
public interface OnDataLoadListener<T> extends OnLoadingDialogListener {
void onSuccess(List<? extends T> list);
void onFailure(int code, String msg);
}
| [
"[email protected]"
] | |
0a01a2b5217cd96a1795bc45df6317916490a7d9 | 9ac72b4a9e8c307479c21b1997a05a703bd6270a | /app/src/main/java/coffee/prototype/android/cleandrinksapplication/data/DrinksContract.java | 2691a4417be3b710f8042ae611c736900570cf9f | [] | no_license | nathanoodler29/CleanDrinksApp | 6ac2fd399b580c0ab1a1f4cf762d3dae565fde84 | 00a78988e639e3ae3ae469580efef32ae971faa8 | refs/heads/master | 2021-01-22T10:13:54.240033 | 2017-05-05T22:03:11 | 2017-05-05T22:03:11 | 81,994,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package coffee.prototype.android.cleandrinksapplication.data;
import android.provider.BaseColumns;
/**
* created by Nathan on 11/04/2017.
*/
public class DrinksContract {
/**
* This class is used to retrieve column names, to ensure they are spelled correctly.
* As such a columns are referenced in the schema.
*/
private DrinksContract() {
}
public static final class DrinksCategoryEntry implements BaseColumns {
public final static String TABLE_NAME = "drinks_category";
//Base columns is used to reference id in recycler view and each record in the table.
public final static String DRINKS_ID = BaseColumns._ID;
//The name of the drink.
public final static String DRINK_NAME = "drinks_name";
//The type of drink i.e Coffee
public final static String DRINK_TYPE = "drinks_type";
//The volume of the drink i.e 150ml
public final static String DRINKS_VOLUME = "drinks_volume";
// the amount of drink i.e caffine or unit value.
public final static String DRINKS_AMOUNT = "drinks_amount";
//Refers to the drinks image icon
public final static String DRINKS_IMAGE = "drinks_image";
}
}
| [
"[email protected]"
] | |
daff2d2e69f59207d340527f8de0f009dc1c5621 | eb65ca17d1a236911483ffb994bd5f27e351a59a | /src/main/java/Model/Dawg.java | dd602513d801df3ede9a6fc75b156d86750f740b | [] | no_license | nys77/scarbelleIA | 909b2a1a7a9a02b7d2bf687d08c183fda010c536 | bd7a4af5e46cbdf15bfdd95f4f4a267fa2597dcf | refs/heads/master | 2021-07-08T07:22:11.596181 | 2019-11-28T16:48:49 | 2019-11-28T16:48:49 | 201,291,472 | 0 | 1 | null | 2019-11-28T16:43:46 | 2019-08-08T15:57:12 | Java | UTF-8 | Java | false | false | 3,272 | java | package Model;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
public class Dawg {
public Dawg next_;
public Dawg child_;
public Character letter_;
public boolean end_word;
public Dawg ()
{
next_ = null;
child_ = null;
letter_ = null;
end_word = false;
}
public Dawg(Character letter)
{
next_ = null;
child_ = null;
letter_ = letter;
end_word = false;
}
public Dawg create_dawg(String filename)
{
Dawg result = new Dawg();
ArrayList<String> all_word = null;
try {
all_word = create_liste(filename);
} catch (IOException e) {
e.printStackTrace();
}
for(int i = 0; i < all_word.size();i++)
{
create_word(result, all_word.get(i),0);
}
return result;
}
public Dawg create_word(Dawg graph,String word,int cmp)
{
if (cmp == word.length()) {
graph.end_word = true;
return graph;
}
if(graph.letter_ == null)
{
graph.letter_ = word.charAt(cmp);
graph.child_ = new Dawg();
return create_word(graph,word,cmp);
}
if(graph.next_ == null && graph.child_ == null && graph.letter_ != null)
{
graph.child_ = new Dawg();
}
else if(graph.next_ == null && graph.child_ != null && graph.letter_ != null)
{
graph.next_ = new Dawg();
}
if (graph.next_ != null && (graph.child_ == null || graph.letter_ != word.charAt(cmp)))
{
return create_word(graph.next_,word,cmp);
}
else if (graph.letter_ != null && graph.letter_ == word.charAt(cmp))
{
return create_word(graph.child_,word,cmp + 1);
}
return graph;
}
public static ArrayList<String> create_liste(String filename) throws IOException {
ArrayList<String> result = new ArrayList<String>();
BufferedReader br = new BufferedReader(new FileReader(filename));
String line = "";
while ((line = br.readLine()) != null) {
result.add(line);
}
br.close();
return result;
}
public boolean word_existe(Dawg graph,String word,int cmp)
{
if (cmp == word.length() && graph.end_word == true)
return true;
else if (cmp == word.length() && graph.end_word == false)
return false;
if(graph.letter_ == null)
return false;
if(graph.child_ != null && word.charAt(cmp) == graph.letter_ )
{
return word_existe(graph.child_,word,cmp+ 1);
}
else if (word.charAt(cmp) == graph.letter_ && graph.child_ == null && cmp != word.length())
{
return false;
}
else if (word.charAt(cmp) != graph.letter_ && graph.next_ != null)
{
return word_existe(graph.next_,word,cmp);
}
else if (word.charAt(cmp) != graph.letter_ && graph.next_ == null)
{
return false;
}
return false;
}
}
| [
"[email protected]"
] | |
4a76cb92243fd514084c35f76f420ff1ae809ce5 | de354a263a47b849e8833cb0e3ae2559f827c6d1 | /src/by/it/astro_emelya/lesson03/C_HeapMax.java | 8eae4bf3549d092a9a33e1414331a41c5cf8a48c | [] | no_license | VadZim11/CS2016-12-05 | 08a881820dd992adab6f9f26a4f88b01d39140ef | f78c69059a7d8498eae193cc1e4578aac925b92f | refs/heads/master | 2020-06-10T22:42:04.741687 | 2016-12-28T13:53:22 | 2016-12-28T13:53:22 | 75,641,240 | 1 | 0 | null | 2016-12-05T15:54:25 | 2016-12-05T15:54:24 | null | UTF-8 | Java | false | false | 4,213 | java | package by.it.astro_emelya.lesson03;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
// Lesson 3. C_Heap.
// Задача: построить max-кучу = пирамиду = бинарное сбалансированное дерево на массиве.
// ВАЖНО! НЕЛЬЗЯ ИСПОЛЬЗОВАТЬ НИКАКИЕ КОЛЛЕКЦИИ, КРОМЕ ARRAYLIST (его можно, но только для массива)
// Проверка проводится по данным файла
// Первая строка входа содержит число операций 1 ≤ n ≤ 100000.
// Каждая из последующих nn строк задают операцию одного из следующих двух типов:
// Insert x, где 0 ≤ x ≤ 1000000000 — целое число;
// ExtractMax.
// Первая операция добавляет число x в очередь с приоритетами,
// вторая — извлекает максимальное число и выводит его.
// Sample Input:
// 6
// Insert 200
// Insert 10
// ExtractMax
// Insert 5
// Insert 500
// ExtractMax
//
// Sample Output:
// 200
// 500
public class C_HeapMax {
private class MaxHeap {
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! НАЧАЛО ЗАДАЧИ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
//тут запишите ваше решение.
//Будет мало? Ну тогда можете его собрать как Generic и/или использовать в варианте B
private List<Long> heap = new ArrayList<>();
int siftDown(int i) { //просеивание вверх
return i;
}
int siftUp(int i) { //просеивание вниз
return i;
}
void insert(Long value) { //вставка
}
Long extractMax() { //извлечение и удаление максимума
Long result = null;
return result;
}
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! КОНЕЦ ЗАДАЧИ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
}
//эта процедура читает данные из файла, ее можно не менять.
Long findMaxValue(InputStream stream) {
Long maxValue=0L;
MaxHeap heap = new MaxHeap();
//прочитаем строку для кодирования из тестового файла
Scanner scanner = new Scanner(stream);
Integer count = scanner.nextInt();
for (int i = 0; i < count; ) {
String s = scanner.nextLine();
if (s.equalsIgnoreCase("extractMax")) {
Long res=heap.extractMax();
if (res!=null && res>maxValue) maxValue=res;
System.out.println();
i++;
}
if (s.contains(" ")) {
String[] p = s.split(" ");
if (p[0].equalsIgnoreCase("insert"))
heap.insert(Long.parseLong(p[1]));
i++;
//System.out.println(heap); //debug
}
}
return maxValue;
}
public static void main(String[] args) throws FileNotFoundException {
String root = System.getProperty("user.dir") + "/src/";
InputStream stream = new FileInputStream(root + "by/it/astro_emelya/lesson03/heapData.txt");
C_HeapMax instance = new C_HeapMax();
System.out.println("MAX="+instance.findMaxValue(stream));
}
// РЕМАРКА. Это задание исключительно учебное.
// Свои собственные кучи нужны довольно редко.
// "В реальном бою" все существенно иначе. Изучите и используйте коллекции
// TreeSet, TreeMap, PriorityQueue и т.д. с нужным CompareTo() для объекта внутри.
}
| [
"[email protected]"
] | |
cde9b488162a35d35508e94d1e4b8746076b8766 | 26298868ad64a89aae7c984ece7df975b8aa8dc7 | /src/main/java/com/dustbin/practice/algorithms/BinarySearch.java | a543f8a9bc04d33387596f7c0c130ab680534e16 | [] | no_license | avirupbiswas88/practicecode_ds_algo | 50049fa14addd5bcf6f7d323c828a1f916be1595 | 704505fd25a437714d31a153e7a62f6dabb340af | refs/heads/master | 2022-12-15T21:13:58.816747 | 2020-09-15T06:47:34 | 2020-09-15T06:47:34 | 286,393,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,897 | java | package com.dustbin.practice.algorithms;
import java.util.Arrays;
public class BinarySearch {
public static void main(String[] args) {
try {
int[] array = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 85, 90 };
//int[] array = { 5 };
int arrayLength = array.length;
int keyElement = 100;
System.out.println("searched element is at "+searchKeyRecursive(array, keyElement, 0, arrayLength-1));
//System.out.println("searched element is at "+searchKeyLoop(array, keyElement, 0, arrayLength-1));
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
private static int searchKeyRecursive(int[] array, int keyElement, int start, int end) throws Exception {
if(start == end) {
if(keyElement == array[start]) {
return start;
}else {
throw new Exception("element not found");
}
}
System.out.println("start index- "+start+" end index- "+end);
int middleIndex = (start+end)/2;
if (start > end)
throw new Exception("element not found");
System.out.println("middleIndex- "+middleIndex);
if(array[middleIndex] == keyElement) {
return middleIndex;
}else if(keyElement > array[middleIndex]) {
return searchKeyRecursive(array,keyElement,(middleIndex+1),end);
}else if(keyElement < array[middleIndex]) {
return searchKeyRecursive(array,keyElement,start,(middleIndex-1));
}
return 0;
}
private static int searchKeyLoop(int[] array, int keyElement, int start, int end) throws Exception {
int middleIndex =0;
while(start <= end) {
middleIndex =(start+end)/2;
if(keyElement == array[middleIndex]) {
return middleIndex;
}else if(keyElement > array[middleIndex]) {
start=middleIndex+1;
}else if(keyElement < array[middleIndex]){
end=middleIndex-1;
}
if (start > end)
throw new Exception("element not found");
}
return middleIndex;
}
}
| [
"[email protected]"
] | |
7927f5918ed0892c84d4fd38d7a45e5c441bcd60 | a01dca5ef30a4fd3fa0e060959169d021e12e738 | /weiye/beidou/src/om/xiaoan/tljqr/MeR.java | 9eeee3708a5e06731cc5af980697cad4577a7c8d | [] | no_license | yangzuxin/oawps | 6949742a27953fd37bc953fdb2a7d694c638d29b | 540f132d04e2afa1eabc5e33c4c75d0f8b9c308f | refs/heads/master | 2022-07-13T07:24:02.045277 | 2020-05-19T16:44:22 | 2020-05-19T16:44:22 | 265,302,929 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,714 | java | package om.xiaoan.tljqr;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class MeR {
public static void main(String[] args) throws IOException {
System.out.println("**********每日一言**********");
System.out.println("");
System.out.println(jiequ(getResult()));
}
private static String jiequ(String result) {
int a = result.indexOf("hitokoto");
int b = result.indexOf("type");
String str2 = result.substring(a,b);
int c = str2.length();
String str3 = str2.substring(12,(c-11));
if(str3.equals("")){
return "什么都没有";
}else{
return str3;
}
}
public static String getResult() throws IOException{
//https://v1.alapi.cn/api/hitokoto?type=b 每日一言接口
//设置机器人接口 key:6922db142c064f0db4dac5a01dda1c88 秘钥: b53e79c237b60610
// String requestUrl ="https://v1.alapi.cn/api/hitokoto?type=b";
String requestUrl ="http://android.fuliapps.com/vod/listing-13-0-0-0-0-0-2-0-2";
//打开链接
URL url = new URL(requestUrl);
URLConnection uc = url.openConnection();
// System.out.println(uc);
uc.connect();
//程序外部的内容进入程序界面
InputStream open = uc.getInputStream();
InputStreamReader der = new InputStreamReader(open,"UTF-8");
//代码往回拿
BufferedReader br = new BufferedReader(der);
String temp ="";
StringBuffer buffer = new StringBuffer();
//
while((temp = br.readLine()) != null){
buffer.append(temp);
}
//重点逻辑
br.close();
der.close();
//
//
return buffer.toString();
}
}
| [
"[email protected]"
] | |
2f68fa55d4a301f802abbf6614071ad3f1133030 | b1ad65ae9e3992a609fdb57c0ddc1c138dccdb50 | /src/test/java/day3/SeleniumMethods.java | b9074bc50ff81c043a4153ae943b2901236d90d7 | [] | no_license | aravindanath/globalOne | 13130a39146639ffcfdc8c18ad1aa98891501224 | 27a1989a11a3061274940c22a34f0aee19037afc | refs/heads/master | 2023-05-28T07:08:04.159792 | 2021-09-23T10:07:12 | 2021-09-23T10:07:12 | 204,101,749 | 0 | 4 | null | 2023-05-09T18:32:15 | 2019-08-24T03:12:45 | Java | UTF-8 | Java | false | false | 956 | java | package day3;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
import Day1.LaunchBrowser;
public class SeleniumMethods extends LaunchBrowser {
@Test
public void disable() throws InterruptedException {
driver.get("file:///Users/aravindanathdm/Desktop/bank.html");
WebElement ele =driver.findElement(By.xpath("//button[@text='click' and contains(text(),'Click Me!')]"));
System.out.println("Element is displayed?"+ele.isDisplayed());
System.out.println("Element is enabled?"+ele.isEnabled());
ele.click();
driver.get("https://www.facebook.com/");
WebElement fmale = driver.findElement(By.xpath("//input[@type='radio' and @value=1]"));
System.out.println("Female radio btn is selected? "+fmale.isSelected());
if(!fmale.isSelected()) {
fmale.click();
System.out.println("Female radio btn is selected? "+fmale.isSelected());
}
Thread.sleep(2000);
}
}
| [
"[email protected]"
] | |
b78c72e9427d8cc3be9b5d6d9993b07171b2bb17 | 70fbef3dcb71c9bef6ada351f7aa527500643663 | /BitwiseHalfAdder.java | 6dbbc9e2752180d6f7a0922e16a571edfc97e256 | [] | no_license | MendonSudo/ESD_JavaAssignment1 | 304c6a290d1be7d8424031ef181226915413dd8e | 6527dbacba85050951c13dd58429c012b30c264d | refs/heads/master | 2023-04-02T08:44:10.964106 | 2021-04-04T12:01:06 | 2021-04-04T12:01:06 | 349,293,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | /* 10. Implement a JAVA program to implement a Half adder using Bitwise operator. */
class BitwiseHalfAdder {
public static void main(String args[]) {
int a=1, b=2;
int sum,carry;
sum = a ^ b;
carry = a & b;
System.out.println("Sum: "+sum +" Carry: "+carry);
}
} | [
"[email protected]"
] | |
b5018d1dbc67cf4edd94b59773d5e4993b1909f0 | cb29436a8597f82e16bcca07a50f1596e582304e | /Search_Engine_Zensar_Project/src/SearchEngine/RootFinder.java | 892b0af00c9f56f79e0bc2498d415db18e3be711 | [] | no_license | sonu98fietz/Local_Search_Engine | 63198e0305555d4d007108ad40066d86b2391f78 | 3ffd618088a9bc96652380df7fc4529a34fea377 | refs/heads/master | 2023-07-18T20:50:58.866539 | 2021-09-27T07:17:16 | 2021-09-27T07:17:16 | 410,762,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | package SearchEngine;
public interface RootFinder {
}
| [
"[email protected]"
] | |
7e5ab5366ccb22b4f5705609c36156c146298385 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/repairnator/learning/2992/WatchedBuildSerializer.java | 2dc84a3229b13a87a3de30c0989af1a1ce44c71e | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,740 | java | package fr.inria.spirals.repairnator.realtime.serializer;
import com.google.gson.JsonObject;
import fr.inria.jtravis.entities.Build;
import fr.inria.spirals.repairnator.Utils;
import fr.inria.spirals.repairnator.realtime.RTScanner;
import fr.inria.spirals.repairnator.serializer.Serializer;
import fr.inria.spirals.repairnator.serializer.SerializerType;
import fr.inria.spirals.repairnator.serializer.engines.SerializedData;
import fr.inria.spirals.repairnator.serializer.engines.SerializerEngine;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class WatchedBuildSerializer extends Serializer {
RTScanner rtScanner;
public WatchedBuildSerializer(List<SerializerEngine> engines, RTScanner rtScanner) {
super(engines, SerializerType.RTSCANNER);
this.rtScanner = rtScanner;
}
private List<Object> serializeAsList(
Build build) {
List<Object> result = new ArrayList<>();
result.add(Utils.getHostname());
result.add(this.rtScanner.getRunId());
result.add(Utils.formatCompleteDate(new Date()));
result.add(Utils.formatCompleteDate(build.getFinishedAt()));
if (build.getRepository() == null) {
result.add("ID="+build.getRepository().getId());
} else {
result.add(build.getRepository().getSlug());
}
result.add(build.getId());
result.add(build.getState());
return result;
}
private JsonObject serializeAsJson(Build build) {
JsonObject result = new JsonObject();
result.addProperty("hostname", Utils.getHostname());
result.addProperty("runId", this.rtScanner.getRunId());
this.addDate(result, "dateWatched", new Date());
result.addProperty("dateWatchedStr", Utils.formatCompleteDate(new Date()));
this.addDate(result, "dateBuildEnd", build.getFinishedAt());
result.addProperty("dateBuildEndStr", Utils.formatCompleteDate(build.getFinishedAt()));
if (build.getRepository() == null) {
result.addProperty("repository", "ID="+build.getRepository().getId());
} else {
result.addProperty("repository", build.getRepository().getSlug());
}
result.addProperty("buildId", build.getId());
result.addProperty("status", build.getState().name());
return result;
}
public void serialize(Build build) {
SerializedData data = new SerializedData(this.serializeAsList(build), this.serializeAsJson(build));
List<SerializedData> allData = new ArrayList<>();
allData.add(data);
for (SerializerEngine engine : this.getEngines()) {
engine.serialize(allData, this.getType());
}
}
}
| [
"[email protected]"
] | |
94b8359f910cb074a9391125a6c69f0d1be6a434 | b2c64c8098f57e4c6840b4fce669bf0d2952b2c3 | /src/main/java/com/seliniumExpress/lc/config/loveCalcConfig.java | 4969b1b9bb35b336c67c73f7ce8e00b55675c955 | [] | no_license | puksapple/love-calculator | 2f563363b6d230ecaf733a5639febbd8e00639df | ee4a9d2f4297600ac51c8ab627b2687144532cce | refs/heads/master | 2023-04-30T11:27:46.243214 | 2021-05-09T12:06:27 | 2021-05-09T12:06:27 | 365,742,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,290 | java | package com.seliniumExpress.lc.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.format.FormatterRegistry;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import com.seliniumExpress.lc.Formatter.AmountFormatter;
import com.seliniumExpress.lc.Formatter.CreditCardFormatter;
import com.seliniumExpress.lc.Formatter.PhoneNumberFormatter;
import java.util.Properties;
@EnableWebMvc
@Configuration
@ComponentScan(basePackages = "com.seliniumExpress.lc.controllers,com.seliniumExpress.lc.Service")
@PropertySource("classpath:Email.properties")
public class loveCalcConfig implements WebMvcConfigurer{
@Autowired
Environment env;
@Bean
public InternalResourceViewResolver viewResolver() {
InternalResourceViewResolver vr=new InternalResourceViewResolver();
vr.setPrefix("/WEB-INF/");
vr.setSuffix(".jsp");
return vr;
}
public void addFormatters(FormatterRegistry register) {
register.addFormatter(new PhoneNumberFormatter());
register.addFormatter(new CreditCardFormatter());
register.addFormatter(new AmountFormatter());
}
@Bean
public JavaMailSender getJavaMailSend() {
String host=env.getProperty("mail.host");
String username=env.getProperty("mail.username");
String password=env.getProperty("mail.password");
String port=env.getProperty("mail.port");
JavaMailSenderImpl mail=new JavaMailSenderImpl();
mail.setHost(host);
mail.setUsername(username);
mail.setPassword(password);
mail.setPort(Integer.parseInt(port));
Properties p=new Properties();
p.put("mail.smtp.starttls.enable", true);
p.put("mail.smtp.ssl.trust", "smtp.gmail.com");
mail.setJavaMailProperties(p);
return mail;
}
}
| [
"puks-apple@pookar"
] | puks-apple@pookar |
d2c32b4c4ddda31d5168364dfbc3360df89b302f | 53e8c8043d50b1cb10e9db86940dcb74efeb5a55 | /src/main/java/com/dl/demo/common/base/Page.java | ea5628a30b910c117b6876f2e51a2d9d7f1c8061 | [] | no_license | gzz2017gzz/springbootelement | 970efcc72e13944b5747fbf61144a1427369aa0b | 26ac623feffd9f945a38d7e51bee7d2b3a8122db | refs/heads/master | 2020-03-22T11:22:32.559892 | 2019-02-11T05:49:11 | 2019-02-11T05:49:11 | 139,967,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,248 | java | package com.dl.demo.common.base;
import java.util.ArrayList;
import java.util.List;
public class Page<T> {
private List<T> content = new ArrayList<>();
private int pageSize = 10;
private long totalElements;
private int curpage = 0;
private int pageCount;
public Page(List<T> dataList, int curpage, long rowCount, int pagesize, int pageCount) {
this.content.addAll(dataList);
this.pageSize = pagesize;
this.totalElements = rowCount;
this.curpage = curpage;
this.pageCount = pageCount;
}
public int getPageSize() {
return this.pageSize;
}
public long getPageCount() {
return this.pageCount;
}
public int getCurpage() {
return this.curpage;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public void setCurpage(int curpage) {
this.curpage = curpage;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public List<T> getContent() {
return this.content;
}
public void setContent(List<T> content) {
this.content = content;
}
public long getTotalElements() {
return this.totalElements;
}
public void setTotalElements(long totalElements) {
this.totalElements = totalElements;
}
}
| [
"gzz"
] | gzz |
cede67b3948f39a28656ea3268cf267c20a204da | 8a802591d53d82193469f327e84f4db8d4f9983b | /src/main/java/com/ceiba/induccion/infraestructura/mapper/PagoMapper.java | 0eb633a2b795d59386a17a5ad85faf74994230b1 | [] | no_license | elmer7186/ceiba-estacionamiento | 3c501b714f728a0846a0bda02f6be3876b2a9aca | 3ce2a2a489d2cc9c16944e49444933bf1777be47 | refs/heads/master | 2020-04-30T01:31:09.753804 | 2019-03-19T14:36:41 | 2019-03-19T14:36:41 | 176,530,716 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 579 | java | package com.ceiba.induccion.infraestructura.mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ceiba.induccion.dominio.entity.Pago;
import com.ceiba.induccion.infraestructura.entidad.PagoEntity;
@Component
public class PagoMapper {
@Autowired
private RegistroMapper registroMapper;
public PagoEntity mapToEntity(Pago pago) {
return new PagoEntity(pago.getId(), pago.getValor(), registroMapper.mapToEntity(pago.getRegistro()),
pago.getUsuarioRegistro(), pago.getFechaRegistro());
}
}
| [
"[email protected]"
] | |
d708be978cc42ea1c1657a73d2758b095496e8bc | 02449f31dac727b65e3ec47664668a0096896696 | /src/main/spring/mySpring/sixChapterJDBC/Spittle.java | ef1c64f257c22c90b9a6bc0e742c8a6a05acc77a | [] | no_license | dmvasiliev/EpamSpring | 3ab16c583ce9a210cff667bce399198b99ec5a3d | 864354ba4fd9a37c6f31b627b925a3f065c004a5 | refs/heads/master | 2020-05-21T20:58:49.652501 | 2017-05-11T18:30:46 | 2017-05-11T18:30:46 | 63,860,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,115 | java | package mySpring.sixChapterJDBC;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import static javax.persistence.GenerationType.AUTO;
import static org.apache.commons.lang.builder.EqualsBuilder.reflectionEquals;
import static org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode;
import static org.apache.commons.lang.builder.ToStringBuilder.reflectionToString;
@Entity
@Table(name = "spittle")
public class Spittle implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Spitter spitter;
private String text;
@DateTimeFormat(pattern = "hh:mma MMM d, YYYY")
private Date when;
public Spittle() {
this.spitter = new Spitter(); // HARD-CODED FOR NOW
this.spitter.setId((long) 1);
}
@Id
@GeneratedValue(strategy = AUTO)
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "spittleText")
@NotNull
@Size(min = 1, max = 140)
public String getText() {
return this.text;
}
public void setText(String text) {
this.text = text;
}
@Column(name = "postedTime")
public Date getWhen() {
return this.when;
}
public void setWhen(Date when) {
this.when = when;
}
@ManyToOne
@JoinColumn(name = "spitter_id")
public Spitter getSpitter() {
return this.spitter;
}
public void setSpitter(Spitter spitter) {
this.spitter = spitter;
}
// plumbing
@Override
public boolean equals(Object obj) {
return reflectionEquals(this, obj);
}
@Override
public int hashCode() {
return reflectionHashCode(this);
}
@Override
public String toString() {
return reflectionToString(this);
}
}
| [
"[email protected]"
] | |
44c840a2f8e54c0e38907c4475287901716de445 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/5/5_c13345219585a8720c6551430e88d6db27c16269/ResponseMock/5_c13345219585a8720c6551430e88d6db27c16269_ResponseMock_t.java | 5949847e56d7dfa484b4b21673d4bfa60cbc8817 | [] | 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 | 3,280 | java | package com.rambi;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Locale;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
public class ResponseMock implements HttpServletResponse {
private StringBuilder outStr = new StringBuilder();
private ServletOutputStream out = new ServletOutputStream() {
@Override
public void write(int b) throws IOException {
outStr.append((char) b);
}
public void write(byte[] b, int off, int len) throws IOException {
for (int i = off; i < len; i++) {
write(b[i]);
}
};
public void write(byte[] b) throws IOException {
for (int i = 0; i < b.length; i++) {
write(b[i]);
}
};
};
private PrintWriter writer = new PrintWriter(out);
@Override
public void flushBuffer() throws IOException {
}
@Override
public int getBufferSize() {
return 0;
}
@Override
public String getCharacterEncoding() {
return null;
}
@Override
public String getContentType() {
return null;
}
@Override
public Locale getLocale() {
return null;
}
@Override
public ServletOutputStream getOutputStream() throws IOException {
return out;
}
@Override
public PrintWriter getWriter() throws IOException {
return writer;
}
@Override
public boolean isCommitted() {
return false;
}
@Override
public void reset() {
}
@Override
public void resetBuffer() {
}
@Override
public void setBufferSize(int arg0) {
}
@Override
public void setCharacterEncoding(String arg0) {
}
@Override
public void setContentLength(int arg0) {
}
@Override
public void setContentType(String arg0) {
}
@Override
public void setLocale(Locale arg0) {
}
@Override
public void addCookie(Cookie arg0) {
}
@Override
public void addDateHeader(String arg0, long arg1) {
}
@Override
public void addHeader(String arg0, String arg1) {
}
@Override
public void addIntHeader(String arg0, int arg1) {
}
@Override
public boolean containsHeader(String arg0) {
return false;
}
@Override
public String encodeRedirectURL(String arg0) {
return null;
}
@Override
public String encodeRedirectUrl(String arg0) {
return null;
}
@Override
public String encodeURL(String arg0) {
return null;
}
@Override
public String encodeUrl(String arg0) {
return null;
}
@Override
public void sendError(int arg0) throws IOException {
}
@Override
public void sendError(int arg0, String arg1) throws IOException {
}
@Override
public void sendRedirect(String arg0) throws IOException {
}
@Override
public void setDateHeader(String arg0, long arg1) {
}
@Override
public void setHeader(String arg0, String arg1) {
}
@Override
public void setIntHeader(String arg0, int arg1) {
}
@Override
public void setStatus(int arg0) {
}
@Override
public void setStatus(int arg0, String arg1) {
}
public String getOutData() {
try {
getWriter().flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
return outStr.toString();
}
}
| [
"[email protected]"
] | |
7e7217d097a618a2cb79034c8d81c0a437e5b625 | c3708f34d194bfd8370dec2958ed8b6eb4dc37f9 | /Bellman Ford Shortest Path/src/Main.java | 34740bc91b2c73dbbd4ad3af803cadd411b1e99c | [] | no_license | aniquaTabassum/Algorithm | 6050a1974633bca999bdaa4c1b0ae140b5d48746 | 8fa52349b38e6e4491d5dd2ee3c07489714266be | refs/heads/master | 2020-03-19T13:15:38.504694 | 2018-08-03T12:03:18 | 2018-08-03T12:03:18 | 136,570,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,997 | java |
import java.util.*;
class Main {
static Vector<Edge> edge;
static int[] dist;
static int V;
static int E;
public static class Edge {
int src;
int dest;
int weight;
public Edge(int src, int dest, int weight) {
this.src = src;
this.dest = dest;
this.weight = weight;
}
}
static void bellmanFord(int src) {
dist = new int[V];
for (int i = 0; i < V; ++i) {
dist[i] = Integer.MAX_VALUE;
}
dist[src] = 0;
for (int i = 1; i < V; ++i) {
for (int j = 0; j < E; ++j) {
int u = edge.get(j).src;
int v = edge.get(j).dest;
int weight = edge.get(j).weight;
if (dist[u] != Integer.MAX_VALUE && dist[u] + weight < dist[v]) {
dist[v] = dist[u] + weight;
}
}
}
for (int j = 0; j < E; ++j) {
int u = edge.get(j).src;
int v = edge.get(j).dest;
int weight = edge.get(j).weight;
if (dist[u] != Integer.MAX_VALUE
&& dist[u] + weight < dist[v]) {
System.out.println("Graph contains negative weight cycle");
}
}
printArr();
}
static void printArr() {
System.out.println("Vertex Distance from Source");
for (int i = 0; i < V; ++i) {
System.out.println(i + " " + dist[i]);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
V = sc.nextInt(); // Number of vertices in graph
E = sc.nextInt(); // Number of edges in graph
edge = new Vector<Edge>();
for (int i = 0; i < E; i++) {
edge.add(new Edge(sc.nextInt(), sc.nextInt(), sc.nextInt()));
}
bellmanFord(0);
}
}
| [
"[email protected]"
] | |
71d011c7915f569141021466d93e4f8beec12ca2 | 9527159ae953ab377d3c61c0e34b23625953b16b | /src/com/kollway/cl/component/imageview/bitmapview/cache/CLBitmapCacheUtil.java | 5015a7cedd69e3f356a4a3fe44f85dad3203a397 | [] | no_license | kollway/AndroidCommonLib | d4c8ccc83efceda9d0f3356c27ae0854dbcfb3c7 | 9962f0be4427513fd7c1924516ff76a9357189c0 | refs/heads/master | 2020-05-27T15:51:48.312897 | 2013-07-10T02:33:51 | 2013-07-10T02:33:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,277 | java | package com.kollway.cl.component.imageview.bitmapview.cache;
import java.lang.ref.SoftReference;
import java.util.LinkedHashMap;
import android.graphics.Bitmap;
import android.util.Log;
import com.kollway.cl.component.imageview.bitmapview.info.CLBitmapInfo;
import com.kollway.cl.component.imageview.bitmapview.info.CLBitmapInfo.Options;
/**
* Bitmap缓存
*
* @author jianfeng.lao
* @version 1.0
* @CreateDate 2013-3-10
*/
public class CLBitmapCacheUtil {
private static final String TAG = "BitmapCacheUtil";
private int currentCacheSize = -1;
public static final int CACHE_3M = 3 * 1024 * 1024;
public static final int CACHE_4M = 4 * 1024 * 1024;
public static final int CACHE_5M = 5 * 1024 * 1024;
public static final int CACHE_8M = 8 * 1024 * 1024;
public static final int CACHE_10M = 10 * 1024 * 1024;
public static final int CACHE_16M = 16 * 1024 * 1024;
private static final int SOFT_CACHE_CAPACITY = 1;
private CLLruCache<String, CLBitmapCacheItem> mHardBitmapCache;
private LinkedHashMap<String, SoftReference<CLBitmapCacheItem>> mSoftBitmapCache;
public CLBitmapCacheUtil(int cacheSize) {
super();
this.currentCacheSize = cacheSize;
init();
}
/**
*
* @author jianfeng.lao
* @CreateDate 2013-3-10
*/
private void init() {
Log.v(TAG, "init CLBitmapCacheUtil");
mSoftBitmapCache = new LinkedHashMap<String, SoftReference<CLBitmapCacheItem>>(SOFT_CACHE_CAPACITY, 0.75f, true) {
private static final long serialVersionUID = 1L;
@Override
protected boolean removeEldestEntry(Entry<String, SoftReference<CLBitmapCacheItem>> eldest) {
if (size() > SOFT_CACHE_CAPACITY) {
return true;
}
return false;
}
};
mHardBitmapCache = new CLLruCache<String, CLBitmapCacheItem>(currentCacheSize) {
@Override
public int sizeOf(String key, CLBitmapCacheItem value) {
return value.bitmap.getRowBytes() * value.bitmap.getHeight();
}
@Override
protected void entryRemoved(boolean evicted, String key, CLBitmapCacheItem oldValue, CLBitmapCacheItem newValue) {
Log.w(TAG, "硬引用缓存达到上限 , 推一个不经常使用的放到软缓存:" + key);
if (oldValue != null) {
if (oldValue.info != null) {
CLBitmapInfo info = oldValue.info;
Options options = info.getOptions();
if (options != null && options.notPullSoftCache) {
// notify bitmap prepare recycle
info.callBackBeforeRecycle(info);
if (oldValue.bitmap != null) {
Bitmap bitmap = oldValue.bitmap;
if (!bitmap.isRecycled()) {
bitmap.recycle();
}
}
} else {
mSoftBitmapCache.put(key, new SoftReference<CLBitmapCacheItem>(oldValue));
}
} else {
mSoftBitmapCache.put(key, new SoftReference<CLBitmapCacheItem>(oldValue));
}
}
}
};
}
/**
*
* @param bitmap
* @param info
* @author jianfeng.lao
* @CreateDate 2013-3-10
*/
public void putBitmap(Bitmap bitmap, CLBitmapInfo info) {
if (info == null || info.getCacheKey() == null) {
Log.e(TAG, "putBitmap info == null or cache key ==null");
return;
}
if (bitmap == null || bitmap.isRecycled()) {
Log.e(TAG, "bitmap == null");
return;
}
Log.i(TAG, "putBitmap>>");
CLBitmapCacheItem bc = new CLBitmapCacheItem();
bc.bitmap = bitmap;
bc.info = info;
mHardBitmapCache.put(info.getCacheKey(), bc);
}
/**
* @param info
* @return
* @author jianfeng.lao
* @CreateDate 2013-3-10
*/
public Bitmap getBitmap(CLBitmapInfo info) {
if (info == null || info.getCacheKey() == null) {
Log.v(TAG, "getBitmap == null or cache key ==null");
return null;
}
String key = info.getCacheKey();
synchronized (mHardBitmapCache) {
final CLBitmapCacheItem bitmap = mHardBitmapCache.get(info.getCacheKey());
if (bitmap != null && !bitmap.bitmap.isRecycled()) {
return bitmap.bitmap;
} else if (bitmap != null && bitmap.bitmap != null && !bitmap.bitmap.isRecycled()) {
mHardBitmapCache.remove(key);
} else {
mHardBitmapCache.remove(key);
}
}
// 硬引用缓存区间中读取失败,从软引用缓存区间读取
synchronized (mSoftBitmapCache) {
if (!mSoftBitmapCache.containsKey(key)) {
return null;
}
SoftReference<CLBitmapCacheItem> bitmapReference = mSoftBitmapCache.get(key);
if (bitmapReference != null) {
final CLBitmapCacheItem bitmap = bitmapReference.get();
if (bitmap != null && !bitmap.bitmap.isRecycled())
return bitmap.bitmap;
else {
Log.v(TAG, "soft reference 已经被回收");
mSoftBitmapCache.remove(key);
}
}
}
return null;
}
/**
*
*
* @author jianfeng.lao
* @CreateDate 2013-3-10
*/
public void destory() {
if (mHardBitmapCache != null) {
mHardBitmapCache.evictAll();
}
if (mSoftBitmapCache != null) {
mSoftBitmapCache.clear();
}
}
/**
*
* @param info
* @author jianfeng.lao
* @CreateDate 2013-3-10
*/
public void destoryItem(CLBitmapInfo info) {
if (info != null && info.getCacheKey() != null) {
CLBitmapCacheItem item = mHardBitmapCache.remove(info.getCacheKey());
if (item != null) {
if (item.bitmap != null && !item.bitmap.isRecycled()) {
info.callBackBeforeRecycle(info);
item.bitmap.recycle();
}
}
}
}
}
| [
"[email protected]"
] | |
c1b82eaf04cd1d0e0d68cbe313e7fbb53f2c19ab | b9648eb0f0475e4a234e5d956925ff9aa8c34552 | /google-ads-stubs-v9/src/main/java/com/google/ads/googleads/v9/services/UserLocationViewServiceGrpc.java | 47b0648fb3099debb7655f7403102f8928303d39 | [
"Apache-2.0"
] | permissive | wfansh/google-ads-java | ce977abd611d1ee6d6a38b7b3032646d5ffb0b12 | 7dda56bed67a9e47391e199940bb8e1568844875 | refs/heads/main | 2022-05-22T23:45:55.238928 | 2022-03-03T14:23:07 | 2022-03-03T14:23:07 | 460,746,933 | 0 | 0 | Apache-2.0 | 2022-02-18T07:08:46 | 2022-02-18T07:08:45 | null | UTF-8 | Java | false | false | 13,611 | java | package com.google.ads.googleads.v9.services;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
* <pre>
* Service to manage user location views.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: google/ads/googleads/v9/services/user_location_view_service.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class UserLocationViewServiceGrpc {
private UserLocationViewServiceGrpc() {}
public static final String SERVICE_NAME = "google.ads.googleads.v9.services.UserLocationViewService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<com.google.ads.googleads.v9.services.GetUserLocationViewRequest,
com.google.ads.googleads.v9.resources.UserLocationView> getGetUserLocationViewMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetUserLocationView",
requestType = com.google.ads.googleads.v9.services.GetUserLocationViewRequest.class,
responseType = com.google.ads.googleads.v9.resources.UserLocationView.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.ads.googleads.v9.services.GetUserLocationViewRequest,
com.google.ads.googleads.v9.resources.UserLocationView> getGetUserLocationViewMethod() {
io.grpc.MethodDescriptor<com.google.ads.googleads.v9.services.GetUserLocationViewRequest, com.google.ads.googleads.v9.resources.UserLocationView> getGetUserLocationViewMethod;
if ((getGetUserLocationViewMethod = UserLocationViewServiceGrpc.getGetUserLocationViewMethod) == null) {
synchronized (UserLocationViewServiceGrpc.class) {
if ((getGetUserLocationViewMethod = UserLocationViewServiceGrpc.getGetUserLocationViewMethod) == null) {
UserLocationViewServiceGrpc.getGetUserLocationViewMethod = getGetUserLocationViewMethod =
io.grpc.MethodDescriptor.<com.google.ads.googleads.v9.services.GetUserLocationViewRequest, com.google.ads.googleads.v9.resources.UserLocationView>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetUserLocationView"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.ads.googleads.v9.services.GetUserLocationViewRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.ads.googleads.v9.resources.UserLocationView.getDefaultInstance()))
.setSchemaDescriptor(new UserLocationViewServiceMethodDescriptorSupplier("GetUserLocationView"))
.build();
}
}
}
return getGetUserLocationViewMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static UserLocationViewServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UserLocationViewServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UserLocationViewServiceStub>() {
@java.lang.Override
public UserLocationViewServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UserLocationViewServiceStub(channel, callOptions);
}
};
return UserLocationViewServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static UserLocationViewServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UserLocationViewServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UserLocationViewServiceBlockingStub>() {
@java.lang.Override
public UserLocationViewServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UserLocationViewServiceBlockingStub(channel, callOptions);
}
};
return UserLocationViewServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static UserLocationViewServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<UserLocationViewServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<UserLocationViewServiceFutureStub>() {
@java.lang.Override
public UserLocationViewServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UserLocationViewServiceFutureStub(channel, callOptions);
}
};
return UserLocationViewServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* Service to manage user location views.
* </pre>
*/
public static abstract class UserLocationViewServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* Returns the requested user location view in full detail.
* List of thrown errors:
* [AuthenticationError]()
* [AuthorizationError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RequestError]()
* </pre>
*/
public void getUserLocationView(com.google.ads.googleads.v9.services.GetUserLocationViewRequest request,
io.grpc.stub.StreamObserver<com.google.ads.googleads.v9.resources.UserLocationView> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetUserLocationViewMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetUserLocationViewMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.ads.googleads.v9.services.GetUserLocationViewRequest,
com.google.ads.googleads.v9.resources.UserLocationView>(
this, METHODID_GET_USER_LOCATION_VIEW)))
.build();
}
}
/**
* <pre>
* Service to manage user location views.
* </pre>
*/
public static final class UserLocationViewServiceStub extends io.grpc.stub.AbstractAsyncStub<UserLocationViewServiceStub> {
private UserLocationViewServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UserLocationViewServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UserLocationViewServiceStub(channel, callOptions);
}
/**
* <pre>
* Returns the requested user location view in full detail.
* List of thrown errors:
* [AuthenticationError]()
* [AuthorizationError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RequestError]()
* </pre>
*/
public void getUserLocationView(com.google.ads.googleads.v9.services.GetUserLocationViewRequest request,
io.grpc.stub.StreamObserver<com.google.ads.googleads.v9.resources.UserLocationView> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getGetUserLocationViewMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* Service to manage user location views.
* </pre>
*/
public static final class UserLocationViewServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<UserLocationViewServiceBlockingStub> {
private UserLocationViewServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UserLocationViewServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UserLocationViewServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* Returns the requested user location view in full detail.
* List of thrown errors:
* [AuthenticationError]()
* [AuthorizationError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RequestError]()
* </pre>
*/
public com.google.ads.googleads.v9.resources.UserLocationView getUserLocationView(com.google.ads.googleads.v9.services.GetUserLocationViewRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getGetUserLocationViewMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* Service to manage user location views.
* </pre>
*/
public static final class UserLocationViewServiceFutureStub extends io.grpc.stub.AbstractFutureStub<UserLocationViewServiceFutureStub> {
private UserLocationViewServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected UserLocationViewServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new UserLocationViewServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* Returns the requested user location view in full detail.
* List of thrown errors:
* [AuthenticationError]()
* [AuthorizationError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RequestError]()
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.ads.googleads.v9.resources.UserLocationView> getUserLocationView(
com.google.ads.googleads.v9.services.GetUserLocationViewRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getGetUserLocationViewMethod(), getCallOptions()), request);
}
}
private static final int METHODID_GET_USER_LOCATION_VIEW = 0;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final UserLocationViewServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(UserLocationViewServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_GET_USER_LOCATION_VIEW:
serviceImpl.getUserLocationView((com.google.ads.googleads.v9.services.GetUserLocationViewRequest) request,
(io.grpc.stub.StreamObserver<com.google.ads.googleads.v9.resources.UserLocationView>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static abstract class UserLocationViewServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
UserLocationViewServiceBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return com.google.ads.googleads.v9.services.UserLocationViewServiceProto.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("UserLocationViewService");
}
}
private static final class UserLocationViewServiceFileDescriptorSupplier
extends UserLocationViewServiceBaseDescriptorSupplier {
UserLocationViewServiceFileDescriptorSupplier() {}
}
private static final class UserLocationViewServiceMethodDescriptorSupplier
extends UserLocationViewServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
UserLocationViewServiceMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (UserLocationViewServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new UserLocationViewServiceFileDescriptorSupplier())
.addMethod(getGetUserLocationViewMethod())
.build();
}
}
}
return result;
}
}
| [
"[email protected]"
] | |
c4bae15dd01715237dbb9e2d48f3311d22d33ef4 | 8287f5f3249b654f11e30b323bb1780c20dd93e3 | /src/main/java/br/ufrj/cos/qsoftware/service/mapper/ProfessorMapper.java | 3723389906f846a8608670de18f3e2252407e777 | [] | no_license | thiagosteiner/software_quality | 6393859be3cc2af0de743e51eb8866d82f41bc17 | 1232aa8195e42a4545520ebe826133dd7d6d92d7 | refs/heads/master | 2021-01-13T09:50:40.491368 | 2016-12-05T15:43:15 | 2016-12-05T15:43:15 | 69,892,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package br.ufrj.cos.qsoftware.service.mapper;
import br.ufrj.cos.qsoftware.domain.*;
import br.ufrj.cos.qsoftware.service.dto.ProfessorDTO;
import org.mapstruct.*;
import java.util.List;
/**
* Mapper for the entity Professor and its DTO ProfessorDTO.
*/
@Mapper(componentModel = "spring", uses = {UserMapper.class, })
public interface ProfessorMapper {
@Mapping(source = "user.id", target = "userId")
@Mapping(source = "user.email", target = "userEmail")
@Mapping(source = "departamento.id", target = "departamentoId")
@Mapping(source = "departamento.nome", target = "departamentoNome")
ProfessorDTO professorToProfessorDTO(Professor professor);
List<ProfessorDTO> professorsToProfessorDTOs(List<Professor> professors);
@Mapping(source = "userId", target = "user")
@Mapping(source = "departamentoId", target = "departamento")
@Mapping(target = "documentosorientados", ignore = true)
@Mapping(target = "comites", ignore = true)
Professor professorDTOToProfessor(ProfessorDTO professorDTO);
List<Professor> professorDTOsToProfessors(List<ProfessorDTO> professorDTOs);
default Departamento departamentoFromId(Long id) {
if (id == null) {
return null;
}
Departamento departamento = new Departamento();
departamento.setId(id);
return departamento;
}
}
| [
"[email protected]"
] | |
c23247098ced2ddeaeabd3d599b225a19d2906fb | cba210b186ac4814264f4e56b8ac00d3e2bf7a95 | /Java高并发编程详解/示例代码/Java高并发编程详解/src/chapter27/ActiveObjectsTest.java | f84e750b58b9976ba52f0dc98c69b0c301f0ab1f | [] | no_license | GoToSleepEarly/BigData-CloudComputing | 3d6970cff29afa3da21364fd582296b25be641cf | 127780bd73be2a8aaffbd3fab13f8fb1c136e322 | refs/heads/master | 2020-04-29T10:15:57.875072 | 2020-02-16T16:13:18 | 2020-02-16T16:13:18 | 176,055,472 | 2 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 482 | java | package chapter27;
import chapter19.Future;
public class ActiveObjectsTest {
@Deprecated
public void DeprecatedMethod() {
}
public static void main(String[] args) throws InterruptedException {
OrderService orderService = ActiveServiceFactory.active(new OrderServiceImpl());
Future<String> future = orderService.findOrderDetails(2343);
System.out.println(orderService.toString());
System.out.println("Á¢Âí·µ»Ø£¡");
System.out.println(future.get());
}
}
| [
"[email protected]"
] | |
18d52b971d6d6ac5da8668f82e7cd4a7b5b1e2a5 | ce01dc23a87658fefc6f557174afe540addb51f1 | /nature-spirit-ejb/src/main/java/tn/esprit/entities/MemberNewsId.java | ea90eb53d05703e85aaa019bc322fd9c862cc3ea | [] | no_license | HorizenSS/WZ_ESPRIT_JavaEE_JSF_Nature-Spirit_Project | f0b235fa8051679f7e466d1991da7665d2394a66 | 1a03735049e9df2e7e2ec87d28bdc6ad23edb411 | refs/heads/master | 2020-08-29T20:30:59.080305 | 2017-12-09T20:19:02 | 2017-12-09T20:19:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,244 | java | package tn.esprit.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Embeddable;
@Embeddable
public class MemberNewsId implements Serializable{
private static final long serialVersionUID = 1L;
private Integer Id_Member;
private Integer Id_News;
private Date date_Of_Comment;
public MemberNewsId() {
super();
}
public MemberNewsId(Integer id_Member, Integer id_News) {
super();
Id_Member = id_Member;
Id_News = id_News;
this.date_Of_Comment = new Date();
}
public Integer getId_Member() {
return Id_Member;
}
public void setId_Member(Integer id_Member) {
Id_Member = id_Member;
}
public Integer getId_News() {
return Id_News;
}
public void setId_News(Integer id_News) {
Id_News = id_News;
}
public Date getDate_Of_Comment() {
return date_Of_Comment;
}
public void setDate_Of_Comment(Date date_Of_Comment) {
this.date_Of_Comment = date_Of_Comment;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((Id_Member == null) ? 0 : Id_Member.hashCode());
result = prime * result + ((Id_News == null) ? 0 : Id_News.hashCode());
result = prime * result + ((date_Of_Comment == null) ? 0 : date_Of_Comment.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MemberNewsId other = (MemberNewsId) obj;
if (Id_Member == null) {
if (other.Id_Member != null)
return false;
} else if (!Id_Member.equals(other.Id_Member))
return false;
if (Id_News == null) {
if (other.Id_News != null)
return false;
} else if (!Id_News.equals(other.Id_News))
return false;
if (date_Of_Comment == null) {
if (other.date_Of_Comment != null)
return false;
} else if (!date_Of_Comment.equals(other.date_Of_Comment))
return false;
return true;
}
@Override
public String toString() {
return "MemberNewsId [Id_Member=" + Id_Member + ", Id_News=" + Id_News + ", date_Of_Comment=" + date_Of_Comment
+ "]";
}
}
| [
"[email protected]"
] | |
c46f9a8d0cba73095f97c952b300cdc67b84fd44 | 2c5b28ac916033da3eec2d6d60ca252db5214252 | /app/src/main/java/biz/ldlong/com/xgpush/receiver/MessageReceiver.java | 180ac296eb1dfa9e2d78c3fcc1652bd9e1e63341 | [] | no_license | lcl9288/XGPush | 8ea4efb78741388e23f540a1cdaf3d066182462c | da7e704eb0cded2c2fcb93034649491888329b4e | refs/heads/master | 2020-03-27T22:02:21.625025 | 2018-09-03T12:42:13 | 2018-09-03T12:42:13 | 147,198,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,435 | java | package biz.ldlong.com.xgpush.receiver;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
import com.tencent.android.tpush.XGPushBaseReceiver;
import com.tencent.android.tpush.XGPushClickedResult;
import com.tencent.android.tpush.XGPushRegisterResult;
import com.tencent.android.tpush.XGPushShowedResult;
import com.tencent.android.tpush.XGPushTextMessage;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import biz.ldlong.com.xgpush.bean.XGNotification;
import biz.ldlong.com.xgpush.common.NotificationService;
public class MessageReceiver extends XGPushBaseReceiver {
private Intent intent = new Intent("com.qq.xgdemo.activity.UPDATE_LISTVIEW");
public static final String LogTag = "TPushReceiver";
private void show(Context context, String text) {
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
// 通知展示
@Override
public void onNotifactionShowedResult(Context context,
XGPushShowedResult notifiShowedRlt) {
if (context == null || notifiShowedRlt == null) {
return;
}
XGNotification notific = new XGNotification();
notific.setMsg_id(notifiShowedRlt.getMsgId());
notific.setTitle(notifiShowedRlt.getTitle());
notific.setContent(notifiShowedRlt.getContent());
// notificationActionType==1为Activity,2为url,3为intent
notific.setNotificationActionType(notifiShowedRlt
.getNotificationActionType());
//Activity,url,intent都可以通过getActivity()获得
notific.setActivity(notifiShowedRlt.getActivity());
notific.setUpdate_time(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(Calendar.getInstance().getTime()));
NotificationService.getInstance(context).save(notific);
context.sendBroadcast(intent);
show(context, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString());
Log.d("LC", "+++++++++++++++++++++++++++++展示通知的回调");
}
//反注册的回调
@Override
public void onUnregisterResult(Context context, int errorCode) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "反注册成功";
} else {
text = "反注册失败" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
//设置tag的回调
@Override
public void onSetTagResult(Context context, int errorCode, String tagName) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "\"" + tagName + "\"设置成功";
} else {
text = "\"" + tagName + "\"设置失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
//删除tag的回调
@Override
public void onDeleteTagResult(Context context, int errorCode, String tagName) {
if (context == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = "\"" + tagName + "\"删除成功";
} else {
text = "\"" + tagName + "\"删除失败,错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
// 通知点击回调 actionType=1为该消息被清除,actionType=0为该消息被点击。此处不能做点击消息跳转,详细方法请参照官网的Android常见问题文档
@Override
public void onNotifactionClickedResult(Context context,
XGPushClickedResult message) {
Log.e("LC", "+++++++++++++++ 通知被点击 跳转到指定页面。");
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
if (context == null || message == null) {
return;
}
String text = "";
if (message.getActionType() == XGPushClickedResult.NOTIFACTION_CLICKED_TYPE) {
// 通知在通知栏被点击啦。。。。。
// APP自己处理点击的相关动作
// 这个动作可以在activity的onResume也能监听,请看第3点相关内容
text = "通知被打开 :" + message;
} else if (message.getActionType() == XGPushClickedResult.NOTIFACTION_DELETED_TYPE) {
// 通知被清除啦。。。。
// APP自己处理通知被清除后的相关动作
text = "通知被清除 :" + message;
}
Toast.makeText(context, "广播接收到通知被点击:" + message.toString(),
Toast.LENGTH_SHORT).show();
// 获取自定义key-value
String customContent = message.getCustomContent();
if (customContent != null && customContent.length() != 0) {
try {
JSONObject obj = new JSONObject(customContent);
// key1为前台配置的key
if (!obj.isNull("key")) {
String value = obj.getString("key");
Log.d(LogTag, "get custom value:" + value);
}
// ...
} catch (JSONException e) {
e.printStackTrace();
}
}
// APP自主处理的过程。。。
Log.d(LogTag, text);
show(context, text);
}
//注册的回调
@Override
public void onRegisterResult(Context context, int errorCode,
XGPushRegisterResult message) {
// TODO Auto-generated method stub
if (context == null || message == null) {
return;
}
String text = "";
if (errorCode == XGPushBaseReceiver.SUCCESS) {
text = message + "注册成功";
// 在这里拿token
String token = message.getToken();
} else {
text = message + "注册失败错误码:" + errorCode;
}
Log.d(LogTag, text);
show(context, text);
}
// 消息透传的回调
@Override
public void onTextMessage(Context context, XGPushTextMessage message) {
// TODO Auto-generated method stub
String text = "收到消息:" + message.toString();
// 获取自定义key-value
String customContent = message.getCustomContent();
if (customContent != null && customContent.length() != 0) {
try {
JSONObject obj = new JSONObject(customContent);
// key1为前台配置的key
if (!obj.isNull("key")) {
String value = obj.getString("key");
Log.d(LogTag, "get custom value:" + value);
}
// ...
} catch (JSONException e) {
e.printStackTrace();
}
}
Log.d("LC", "++++++++++++++++透传消息");
// APP自主处理消息的过程...
Log.d(LogTag, text);
show(context, text);
}
}
| [
"[email protected]"
] | |
b73e8486485b22935e0d275fc5fe6a91ad0051a6 | 291f06fc2ed22203f32b8d163052722167a6e436 | /DusonJavaFramework-core/src/main/java/duson/java/core/reflect/Generic.java | 7b2b56458dd62b421269af2ee57d20744e072f71 | [] | no_license | duson/javaFramework | 9bd081b44b6f840b1fa37790ef0d0040bf6406d2 | 3cd7047cac5c59d92a09845dca1d2ec56d8b0b07 | refs/heads/master | 2022-12-21T20:53:11.995468 | 2020-02-29T13:59:43 | 2020-02-29T13:59:43 | 21,634,822 | 1 | 1 | null | 2022-12-16T06:56:14 | 2014-07-09T01:22:09 | JavaScript | UTF-8 | Java | false | false | 234 | java | package duson.java.core.reflect;
public class Generic {
public static <T> T getSetting(Class<T> c, String json) throws InstantiationException, IllegalAccessException {
T setting = c.newInstance();
return setting;
}
}
| [
"[email protected]"
] | |
7efc196285898a5fca98b3e7335db30395914995 | e1d15d36dd486518d9339dce74d445f8cced0571 | /core/src/main/java/com/cloudera/labs/envelope/spark/Contexts.java | 1561a3ee4cb9fc90850eaa582ca5e627f57ed61f | [
"Apache-2.0"
] | permissive | epermana/spark-etl | 8e460ecd50b7c8c539828c6bbf6712399f301ef0 | 81ab5bc6b61f078a057c45b9d296b700f7dac755 | refs/heads/master | 2020-04-16T21:59:47.920629 | 2019-01-16T01:06:02 | 2019-01-16T01:06:02 | 165,948,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,310 | java | /*
* Copyright (c) 2015-2018, Cloudera, Inc. All Rights Reserved.
*
* Cloudera, 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
*
* This software 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.cloudera.labs.envelope.spark;
import com.cloudera.labs.envelope.utils.ConfigUtils;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import com.typesafe.config.ConfigRenderOptions;
import com.typesafe.config.ConfigValue;
import org.apache.commons.io.FileUtils;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.streaming.Duration;
import org.apache.spark.streaming.Durations;
import org.apache.spark.streaming.api.java.JavaStreamingContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Map;
/**
* Used as a singleton for any driver code in Envelope to retrieve the various Spark contexts, and have them
* instantiated automatically if they have not already been created.
*/
public enum Contexts {
INSTANCE;
private static final Logger LOG = LoggerFactory.getLogger(Contexts.class);
public static final String APPLICATION_SECTION_PREFIX = "application";
public static final String APPLICATION_NAME_PROPERTY = "name";
public static final String BATCH_MILLISECONDS_PROPERTY = "batch.milliseconds";
public static final String NUM_INITIAL_EXECUTORS_PROPERTY = "executor.initial.instances";
public static final String NUM_EXECUTORS_PROPERTY = "executor.instances";
public static final String NUM_EXECUTOR_CORES_PROPERTY = "executor.cores";
public static final String EXECUTOR_MEMORY_PROPERTY = "executor.memory";
public static final String SPARK_CONF_PROPERTY_PREFIX = "spark.conf";
public static final String SPARK_SESSION_ENABLE_HIVE_SUPPORT = "hive.enabled";
public static final String DRIVER_MEMORY_PROPERTY = "driver.memory";
public static final String SPARK_DRIVER_MEMORY_PROPERTY = "spark.driver.memory";
public static final String SPARK_DEPLOY_MODE_PROPERTY = "spark.submit.deployMode";
public static final String SPARK_DEPLOY_MODE_CLIENT = "client";
public static final String SPARK_DEPLOY_MODE_CLUSTER = "cluster";
public static final String ENVELOPE_CONFIGURATION_SPARK = "spark.envelope.configuration";
public static final boolean SPARK_SESSION_ENABLE_HIVE_SUPPORT_DEFAULT = true;
private Config config = ConfigFactory.empty();
private ExecutionMode mode = ExecutionMode.UNIT_TEST;
private SparkSession ss;
private JavaStreamingContext jsc;
public static synchronized SparkSession getSparkSession() {
if (INSTANCE.ss == null) {
initializeBatchJob();
}
return INSTANCE.ss;
}
public static synchronized JavaStreamingContext getJavaStreamingContext() {
if (INSTANCE.jsc == null) {
initializeStreamingJob();
}
return INSTANCE.jsc;
}
public static synchronized void closeSparkSession() {
closeSparkSession(false);
}
public static synchronized void closeSparkSession(boolean cleanupHiveMetastore) {
if (INSTANCE.ss != null) {
INSTANCE.ss.close();
INSTANCE.ss = null;
}
if (cleanupHiveMetastore) {
FileUtils.deleteQuietly(new File("metastore_db"));
FileUtils.deleteQuietly(new File("derby.log"));
FileUtils.deleteQuietly(new File("spark-warehouse"));
}
}
public static synchronized void closeJavaStreamingContext() {
closeJavaStreamingContext(false);
}
public static synchronized void closeJavaStreamingContext(boolean cleanupHiveMetastore) {
if (INSTANCE.jsc != null) {
INSTANCE.jsc.close();
INSTANCE.jsc = null;
closeSparkSession(cleanupHiveMetastore);
}
}
public static void initialize(Config config, ExecutionMode mode) {
INSTANCE.config = config.hasPath(APPLICATION_SECTION_PREFIX) ?
config.getConfig(APPLICATION_SECTION_PREFIX) : ConfigFactory.empty();
INSTANCE.mode = mode;
}
private static void initializeStreamingJob() {
int batchMilliseconds = INSTANCE.config.getInt(BATCH_MILLISECONDS_PROPERTY);
final Duration batchDuration = Durations.milliseconds(batchMilliseconds);
JavaStreamingContext jsc = new JavaStreamingContext(new JavaSparkContext(getSparkSession().sparkContext()),
batchDuration);
INSTANCE.jsc = jsc;
}
private static void initializeBatchJob() {
SparkConf sparkConf = getSparkConfiguration(INSTANCE.config, INSTANCE.mode);
if (!sparkConf.contains("spark.master")) {
LOG.warn("Spark master not provided, instead using local mode");
sparkConf.setMaster("local[*]");
}
if (!sparkConf.contains("spark.app.name")) {
LOG.warn("Spark application name not provided, instead using empty string");
sparkConf.setAppName("");
}
SparkSession.Builder sparkSessionBuilder = SparkSession.builder();
if (enablesHiveSupport()) {
sparkSessionBuilder.enableHiveSupport();
}
INSTANCE.ss = sparkSessionBuilder.config(sparkConf).getOrCreate();
}
private static synchronized SparkConf getSparkConfiguration(Config config, ExecutionMode mode) {
SparkConf sparkConf = new SparkConf();
if (config.hasPath(APPLICATION_NAME_PROPERTY)) {
String applicationName = config.getString(APPLICATION_NAME_PROPERTY);
sparkConf.setAppName(applicationName);
}
if (mode.equals(ExecutionMode.STREAMING)) {
// Dynamic allocation should not be used for Spark Streaming jobs because the latencies
// of the resource requests are too long.
sparkConf.set("spark.dynamicAllocation.enabled", "false");
// Spark Streaming back-pressure helps automatically tune the size of the micro-batches so
// that they don't breach the micro-batch length.
sparkConf.set("spark.streaming.backpressure.enabled", "true");
// Rate limit the micro-batches when using Apache Kafka to 2000 records per Kafka topic partition
// per second. Without this we could end up with arbitrarily large initial micro-batches
// for existing topics.
sparkConf.set("spark.streaming.kafka.maxRatePerPartition", "2000");
// Override the Spark SQL shuffle partitions with the default number of cores. Otherwise
// the default is typically 200 partitions, which is very high for micro-batches.
sparkConf.set("spark.sql.shuffle.partitions", "2");
// Override the caching of KafkaConsumers which has been shown to be problematic with multi-core executors
// (see SPARK-19185)
sparkConf.set("spark.streaming.kafka.consumer.cache.enabled", "false");
} else if (mode.equals(ExecutionMode.UNIT_TEST)) {
sparkConf.set("spark.sql.catalogImplementation", "in-memory");
sparkConf.set("spark.sql.shuffle.partitions", "1");
sparkConf.set("spark.sql.warehouse.dir", "target/spark-warehouse");
}
if (config.hasPath(NUM_EXECUTORS_PROPERTY)) {
sparkConf.set("spark.executor.instances", config.getString(NUM_EXECUTORS_PROPERTY));
}
if (config.hasPath(NUM_INITIAL_EXECUTORS_PROPERTY)) {
sparkConf.set("spark.dynamicAllocation.initialExecutors", config.getString(NUM_INITIAL_EXECUTORS_PROPERTY));
}
if (config.hasPath(NUM_EXECUTOR_CORES_PROPERTY)) {
sparkConf.set("spark.executor.cores", config.getString(NUM_EXECUTOR_CORES_PROPERTY));
}
if (config.hasPath(EXECUTOR_MEMORY_PROPERTY)) {
sparkConf.set("spark.executor.memory", config.getString(EXECUTOR_MEMORY_PROPERTY));
}
// Override the Spark SQL shuffle partitions with the number of cores, if known.
if (config.hasPath(NUM_EXECUTORS_PROPERTY) && config.hasPath(NUM_EXECUTOR_CORES_PROPERTY)) {
int executors = config.getInt(NUM_EXECUTORS_PROPERTY);
int executorCores = config.getInt(NUM_EXECUTOR_CORES_PROPERTY);
Integer shufflePartitions = executors * executorCores;
sparkConf.set("spark.sql.shuffle.partitions", shufflePartitions.toString());
}
if (enablesHiveSupport()) {
// Allow dynamic partitioning into Hive tables without providing any static partition values
sparkConf.set("hive.exec.dynamic.partition.mode", "nonstrict");
}
if (config.hasPath(DRIVER_MEMORY_PROPERTY)) {
sparkConf.set(SPARK_DRIVER_MEMORY_PROPERTY, config.getString(DRIVER_MEMORY_PROPERTY));
}
// Allow the user to provide any Spark configuration and we will just pass it on. These can
// also override any of the configurations above.
if (config.hasPath(SPARK_CONF_PROPERTY_PREFIX)) {
Config sparkConfigs = config.getConfig(SPARK_CONF_PROPERTY_PREFIX);
for (Map.Entry<String, ConfigValue> entry : sparkConfigs.entrySet()) {
String param = entry.getKey();
String value = entry.getValue().unwrapped().toString();
if (value != null) {
sparkConf.set(param, value);
}
}
}
if ((!sparkConf.contains(SPARK_DEPLOY_MODE_PROPERTY)
|| sparkConf.get(SPARK_DEPLOY_MODE_PROPERTY).equalsIgnoreCase(SPARK_DEPLOY_MODE_CLIENT))
&& (config.hasPath(DRIVER_MEMORY_PROPERTY)
|| config.hasPath(SPARK_CONF_PROPERTY_PREFIX + "." + SPARK_DRIVER_MEMORY_PROPERTY))) {
throw new RuntimeException(
"Driver memory can not be set in configuration file when application is running in client mode. "
+ "Instead, use Spark's --driver-memory command line argument.");
}
String envelopeConf = config.root().render(ConfigRenderOptions.concise());
sparkConf.set(ENVELOPE_CONFIGURATION_SPARK, envelopeConf);
return sparkConf;
}
private static boolean enablesHiveSupport() {
if (INSTANCE.mode == ExecutionMode.UNIT_TEST) return false;
return ConfigUtils.getOrElse(
INSTANCE.config,
SPARK_SESSION_ENABLE_HIVE_SUPPORT,
SPARK_SESSION_ENABLE_HIVE_SUPPORT_DEFAULT);
}
public enum ExecutionMode {
BATCH, STREAMING, UNIT_TEST
}
}
| [
"[email protected]"
] | |
04e896e25dc6f3af4c670a3631a99058f60cbfa7 | 19ed8372b2005b3079fed7995877a397ed25aedd | /src/main/java/lab11/FonNeimon.java | b892ad0639abb6c6de80ed5a34df64a7b6ea4c8e | [] | no_license | papanage/kit_nsu | 3a2d0dd678ea4319ae69a0f094d1c3542995ffd1 | 6cfc2e62907f8034f83d7a782f3ceb7b6ffdb03e | refs/heads/master | 2023-01-23T15:57:57.631280 | 2020-12-07T04:29:27 | 2020-12-07T04:29:27 | 293,752,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,122 | java | package lab11;
public class FonNeimon {
private long startNumber = 1234;
public long nextNumber() {
long sq = startNumber*startNumber;
String s = String.valueOf(sq);
if (s.length() % 2 != 0) {
s = "0" + s;
}
int shift = (s.length() - 4)/2;
StringBuilder stringBuilder = new StringBuilder();
for (int i = shift; i < shift + 4; i++) {
stringBuilder.append(s.charAt(i));
}
String res = stringBuilder.toString();
int r = Integer.parseInt(res);
startNumber = r;
return r;
}
public static void main(String[] args) {
FonNeimon generator = new FonNeimon();
System.out.println(generator.nextNumber());
System.out.println(generator.nextNumber());
System.out.println(generator.nextNumber());
System.out.println(generator.nextNumber());
System.out.println(generator.nextNumber());
System.out.println(generator.nextNumber());
System.out.println(generator.nextNumber());
System.out.println(generator.nextNumber());
}
}
| [
"[email protected]"
] | |
2fcda7af9c6928b2c37d6950355e20505367bc69 | 073649680834d1fce4ecf999218c406814e47aa2 | /src/StrategyPattern/Characters/King.java | 0c7a7cf75a5681c043af12b820125a0a7a1bcd2e | [] | no_license | sunnyaxin/DesignPatterns-Dojo | a2b4ca7e11581360670b995b5b8298a9ea1a5f68 | 71ed82171109045563981c3408d13dc1b105494a | refs/heads/master | 2021-05-07T17:09:37.705176 | 2017-10-28T15:16:21 | 2017-10-28T15:16:21 | 108,659,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package StrategyPattern.Characters;
import StrategyPattern.WeaponBehavior.AxeBehavior;
public class King extends Character{
public King() {
weaponBehavior = new AxeBehavior();
}
@Override
public void fight() {
System.out.println("I am a King, I like use Axe to fight!");
}
}
| [
"[email protected]"
] | |
0868435d9e803319b6c8225287b791aa77567461 | 5307891385e535e38a5eed876036838abb8093dd | /src/main/java/techquizapp/dao/PerformanceDAO.java | f011d7274d3c33833267370c0737eb83b865330d | [] | no_license | i-adarsh/Java-GUI-based-Quiz-Application | c4ea2de91f35ca802d955327a2aa821f80d500c9 | c3527eb75f5594766d362599ff48c443d1d62323 | refs/heads/main | 2023-01-27T15:30:48.172330 | 2020-12-02T04:22:54 | 2020-12-02T04:22:54 | 317,747,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,345 | 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 techquizapp.dao;
/**
*
* @author adarshkumar
*/
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import techquizapp.dbutil.DBConnection;
import techquizapp.pojo.Performance;
public class PerformanceDAO {
public static void addPerformance(Performance performance) throws SQLException {
Connection connection = DBConnection.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("insert into performance values(?,?,?,?,?,?,?)");
preparedStatement.setString(1,performance.getUserId());
preparedStatement.setString(2, performance.getExamId());
preparedStatement.setInt(3, performance.getRight());
preparedStatement.setInt(4, performance.getWrong());
preparedStatement.setInt(5, performance.getUnAttempted());
preparedStatement.setDouble(6,performance.getPercentage());
preparedStatement.setString(7,performance.getLanguage());
preparedStatement.executeUpdate();
}
public static ArrayList<String> getAllExamId(String userName) throws SQLException{
Connection connection = DBConnection.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("select examid from performance where userid=?");
preparedStatement.setString(1,userName);
ResultSet resultSet = preparedStatement.executeQuery();
ArrayList<String> examIdList = new ArrayList<>();
while (resultSet.next()){
examIdList.add(resultSet.getString(1));
}
return examIdList;
}
public static Performance getDetails (String examId, String userId) throws SQLException{
Connection connection = DBConnection.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("select * from performance where examid=? and userid=?");
preparedStatement.setString(1,examId);
preparedStatement.setString(2,userId);
ResultSet resultSet = preparedStatement.executeQuery();
Performance performance = new Performance();
resultSet.next();
performance.setUserId(resultSet.getString(1));
performance.setExamId(resultSet.getString(2));
performance.setRight(resultSet.getInt(3));
performance.setWrong(resultSet.getInt(4));
performance.setUnAttempted(resultSet.getInt(5));
performance.setPercentage(resultSet.getDouble(6));
performance.setLanguage(resultSet.getString(7));
return performance;
}
public static ArrayList<String> getAllStudents() throws SQLException{
Connection connection = DBConnection.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("select * from users where usertype=?");
preparedStatement.setString(1,"Student");
ResultSet resultSet = preparedStatement.executeQuery();
ArrayList<String> studentsList = new ArrayList<>();
while (resultSet.next()){
String student = resultSet.getString(1);
studentsList.add(student);
}
return studentsList;
}
public static ArrayList<Performance> getAllData() throws SQLException{
Connection connection = DBConnection.getConnection();
Statement statement = connection.createStatement();
ArrayList<Performance> performanceList = new ArrayList<>();
ResultSet resultSet = statement.executeQuery("Select * from performance");
while(resultSet.next()){
String userId = resultSet.getString(1);
String examId = resultSet.getString(2);
int right = resultSet.getInt(3);
int wrong = resultSet.getInt(4);
int unAttempted = resultSet.getInt(5);
double percentage = resultSet.getDouble(6);
String language = resultSet.getString(7);
Performance performance = new Performance(userId, examId, right, wrong, unAttempted, percentage, language);
performanceList.add(performance);
}
return performanceList;
}
} | [
"[email protected]"
] | |
90a315b7106c1e87d0529efc4b2485e156ea1a12 | 9606bc24cc7e5be762dc86e6e1a257f93ae339de | /app/src/main/java/com/zmy/laosiji/moudle/activity/PermissionActivity.java | 422abf0f461a18d96deb9d5bdca37dba22307708 | [] | no_license | Zmydhy/LsoSiJi | 7acbc0f15410713aa4b062d7a123bb994e1d3aee | 8586ad6913f4b969de261e32a6e767341bc41a4d | refs/heads/master | 2021-07-14T08:33:33.708791 | 2018-01-17T15:12:10 | 2018-01-17T15:12:10 | 111,345,140 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,407 | java | package com.zmy.laosiji.moudle.activity;
import android.Manifest;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.zmy.laosiji.R;
import com.zmy.laosiji.base.BaseActivity;
import com.zmy.laosiji.rxhttp.HttpOnNextListener;
import com.zmy.laosiji.rxhttp.RxBus;
import com.zmy.laosiji.rxhttp.RxClick;
import com.zmy.laosiji.utils.ConstantUtil;
import com.zmy.laosiji.utils.animatorutils.AnimatorPath;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import permissions.dispatcher.NeedsPermission;
import permissions.dispatcher.RuntimePermissions;
/**
* 这个类 有两个功能
* 1、 加入了权限请求
* 2、 运用rxjava实现的防止二次点击
* 3、添加动画库的使用
* 4、 RxBus的注册和解绑
*/
@RuntimePermissions
public class PermissionActivity extends BaseActivity {
@BindView(R.id.btn_angdou)
Button btnAngdou;
@BindView(R.id.tv_persmion)
TextView tvPersmion;
@BindView(R.id.img_permsion)
ImageView imgPermsion;
@Override
protected void setContentView(Bundle savedInstanceState) {
setContentLayout(R.layout.activity_permission);
RxBus.getRxBus().subscribeOn(String.class, new HttpOnNextListener<String>() {
@Override
public void onStart(Disposable d) {
super.onStart(d);
}
@Override
public void onNext(String s) {
ConstantUtil.log_e(s);
tvPersmion.setText(s);
}
@Override
public void onError(Throwable e) {
super.onError(e);
ConstantUtil.log_e("onError");
}
@Override
public void onComplete() {
super.onComplete();
ConstantUtil.log_e("onComplete");
}
});
/*
* 1. 此处采用了RxBinding:RxView.clicks(button) = 对控件点击进行监听,需要引入依赖:compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
* 2. 传入Button控件,点击时,都会发送数据事件(但由于使用了throttleFirst()操作符,所以只会发送该段时间内的第1次点击事件)
**/
RxClick.setOnClick(btnAngdou, new
HttpOnNextListener() {
@Override
public void onNext(Object o) {
Log.d("TAG", "发送了网络请求");
RxBus.getRxBus().post("caodan1");
RxBus.getRxBus().post("caodan2");
RxBus.getRxBus().post("caodan3");
AnimatorPath animatorPath = new AnimatorPath();
animatorPath.moveto(0, 400);
animatorPath.cubto(200, 0, 600, 800, 800, 400);
animatorPath.lineto(0, 400);
animatorPath.startAnimator(imgPermsion);
}
@Override
public void onError(Throwable e) {
Log.d("TAG", "对Error事件作出响应" + e.toString());
}
@Override
public void onComplete() {
Log.d("TAG", "对Complete事件作出响应");
}
});
}
@OnClick(R.id.btn_getper)
public void onViewClicked() {
//申请单个权限
PermissionActivityPermissionsDispatcher.getCarmerWithCheck(this);
}
@NeedsPermission(Manifest.permission.CAMERA)
void getCarmer() {
ConstantUtil.toast("申请相机权限");
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
PermissionActivityPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
RxBus.getRxBus().unSubscribeOn();
}
// @OnShowRationale(Manifest.permission.CAMERA)
// void showCarmer(final PermissionRequest request) {
//
// new AlertDialog.Builder(this)
// .setMessage("相机权限,下一步将继续请求权限")
// .setPositiveButton("下一步", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// request.proceed();//继续执行请求
// }
// }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// request.cancel();//取消执行请求
// }
// }).show();
// }
}
| [
"[email protected]"
] | |
6cf74bffc875131eec486a2b8a43c664f78704e2 | 79a97b0bcaea314a8da555c54e72a5388949ff3b | /src/ArithmetischeOperatoren.java | f7ed32603adbc3992a4a2d2f4f2ee90f23188fb0 | [] | no_license | Flopinator/Calculator4 | 6c9641bb0e4eb05f0cdde0250efd0c08db5317cf | bd15b89aa9a4eeeb74ee934b60a545e57b97e4ce | refs/heads/master | 2023-08-24T05:46:17.425379 | 2021-10-09T10:03:24 | 2021-10-09T10:03:24 | 415,067,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 681 | java | public class ArithmetischeOperatoren {
public static void main(String[] args) {
int a = 10;
int b = 20;
System.out.println(a);
System.out.println(b);
System.out.println(a-b);
System.out.println(a+b);
System.out.println(b/a);
System.out.println(a*b);
System.out.println(a%b);
printResult(2 + 3);
int g = 2+4;
printResult(g);
int result = add(2,5);
printResult(result);
printResult(add(2,6));
}
public static void printResult(int result){
System.out.println(result);
}
public static int add(int a, int b){
return a+b;
}
} | [
"[email protected]"
] | |
593f17391dc77432086de1826596767a5f1021a0 | 5d222b5560fb1663714bc1368cabc371774d67f9 | /FitChart/src/main/java/com/txusballesteros/widgets/BaseRenderer.java | b0f83b7cfb68dd4f2a10fc1a5c6ff873690a2697 | [] | no_license | neilbrub/TuneDownForWhat | 5a5504cd5ef54fd9ae844e5ed718c3d131419590 | f58b56ac8f77584899f1cc9703ca67c8890cb574 | refs/heads/master | 2021-05-11T16:25:45.177181 | 2018-06-13T03:15:07 | 2018-06-13T03:15:07 | 117,766,760 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,426 | java | /*
* Copyright Txus Ballesteros 2015 (@txusballesteros)
*
* This file is part of some open source application.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* Contact: Txus Ballesteros <[email protected]>
*/
package com.txusballesteros.widgets;
import android.graphics.RectF;
abstract class BaseRenderer {
private final RectF drawingArea;
private final FitChartValue value;
FitChartValue getValue() {
return value;
}
RectF getDrawingArea() {
return drawingArea;
}
public BaseRenderer(RectF drawingArea, FitChartValue value) {
this.drawingArea = drawingArea;
this.value = value;
}
}
| [
"[email protected]"
] | |
9bcec9488c640978a142af533cefac3f3881af58 | 87795806b843323efb85bab95dc988dfaf67abbb | /src/com/designPatterns/BuilderPattern/Address.java | 37749e613ae91d13f6117b51b32d04ec704f7a7c | [] | no_license | jfspps/JavaDesignPatterns | 5f1f9de7e28e7c8b35afc76fe12ebbb5b9933eed | 2875966901dd5bd2381063d524b36c04d515b9ba | refs/heads/main | 2023-03-03T17:41:13.771192 | 2021-02-18T23:54:58 | 2021-02-18T23:54:58 | 308,140,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | package com.designPatterns.BuilderPattern;
public class Address {
private String houseNumber;
private String street;
private String city;
private String zipcode;
private String state;
public String getHouseNumber() {
return houseNumber;
}
public void setHouseNumber(String houseNumber) {
this.houseNumber = houseNumber;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getZipcode() {
return zipcode;
}
public void setZipcode(String zipcode) {
this.zipcode = zipcode;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
| [
"[email protected]"
] | |
d2d50b30e8af62771528f3dfb6f0917e0f4b769a | a7d5c3d9ffd7b2edcbdd91ec69e70ba496121109 | /src/ui/DaoDienBtnThem.java | abaf7a48d8907d36f90cc7f8cf0a3e000690276e | [] | no_license | tuanbk654123/management-car-in-apartment | 2b2f8b65412ee34db72d0a46bc991a673458e09d | 71d4c0d0b8fd0c4a8d59b259186f6c1cece77083 | refs/heads/master | 2020-03-27T04:54:28.960643 | 2018-08-24T10:32:24 | 2018-08-24T10:32:24 | 145,977,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,088 | java | // author : Nguyễn Minh Tuấn--------------------------------------------------------------------------------
// KSTN-ĐTVT-K59 -------------------------------------------------------------------------------------------
// BKHN=====================================================================================================
package ui;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.xml.stream.events.StartElement;
public class DaoDienBtnThem extends JDialog {
JButton btnLuu;
JTextField txtTenChuXe,txtBienSo,txtHangXe ,
txtMauXe ,
txtId,
txtNgayDangKy ,
txtNgayHetHan ;
public static int ketqua = -1;
public static int ketqua1 = -1;
public String idVeThangChon="";
Connection conn=DaoDienChinhUI.conn;
Statement statement=DaoDienChinhUI.statement;
public DaoDienBtnThem(String title)
{
this.setTitle(title);
addControls();
addEvents();
}
private void addControls() {
// TODO Auto-generated method stub
Container con = getContentPane();
JLabel lblVeThang = new JLabel("Thêm Vé tháng");
JLabel lblId = new JLabel(" ID: ");
JLabel lblBienSo = new JLabel("Biển số: ");
JLabel lblTenChuXe = new JLabel("Tên chủ xe: ");
JLabel lblMauXe = new JLabel("Màu Xe: ");
JLabel lblHangXe = new JLabel("Hãng Xe: ");
JLabel lblNgayDangKy = new JLabel("Ngày đăng ký: ");
JLabel lblNgayHetHan = new JLabel("Ngày Hết hạn: ");
lblBienSo.setPreferredSize(lblNgayDangKy.getPreferredSize());
lblHangXe.setPreferredSize(lblNgayDangKy.getPreferredSize());
lblMauXe.setPreferredSize(lblNgayDangKy.getPreferredSize());
lblId.setPreferredSize(lblNgayDangKy.getPreferredSize());
lblTenChuXe.setPreferredSize(lblNgayDangKy.getPreferredSize());
lblNgayHetHan.setPreferredSize(lblNgayDangKy.getPreferredSize());
txtTenChuXe = new JTextField(40);
txtBienSo = new JTextField(40);
txtHangXe = new JTextField(40);
txtMauXe = new JTextField(40) ;
txtId = new JTextField(40) ;
txtNgayDangKy = new JTextField(40) ;
txtNgayHetHan = new JTextField(40) ;
JPanel pnTenChuXe= new JPanel();
JPanel pnBienSo = new JPanel();
JPanel pnHangXe = new JPanel();
JPanel pnMauXe = new JPanel();
JPanel pnID = new JPanel();
JPanel pnNgayDangKy = new JPanel();
JPanel pnNgayHetHan = new JPanel();
pnTenChuXe.add(lblTenChuXe);
pnTenChuXe.add(txtTenChuXe);
pnBienSo.add(lblBienSo);
pnBienSo.add(txtBienSo);
pnHangXe.add(lblHangXe);
pnHangXe.add(txtHangXe);
pnMauXe.add(lblMauXe);
pnMauXe.add(txtMauXe);
pnID.add(lblId);
pnID.add(txtId);
pnNgayDangKy.add(lblNgayDangKy);
pnNgayDangKy.add(txtNgayDangKy);
pnNgayHetHan.add(lblNgayHetHan);
pnNgayHetHan.add(txtNgayHetHan);
JPanel pnLuu = new JPanel();
pnLuu.setLayout(new FlowLayout(FlowLayout.RIGHT));
btnLuu = new JButton("Lưu");
pnLuu.add(btnLuu);
con.setLayout(new BoxLayout(con, BoxLayout.Y_AXIS));
con.add(pnID);
con.add(pnBienSo);
con.add(pnTenChuXe);
con.add(pnMauXe);
con.add(pnHangXe);
con.add(pnNgayDangKy);
con.add(pnNgayHetHan);
con.add(pnLuu);
}
private void addEvents() {
// TODO Auto-generated method stub
btnLuu.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
xuLyLuu();
}
});
}
protected void xuLyLuu() {
// TODO Auto-generated method stub
if (idVeThangChon.length() == 0)
{
try
{
String sql = "insert into vethang values ( '"+txtId.getText()+"', '"+txtBienSo.getText()+"','"+txtTenChuXe.getText()+"','"+txtMauXe.getText()+"','"+txtHangXe.getText()+"','"+txtNgayDangKy.getText()+"','"+txtNgayHetHan.getText()+"' )";
//String sql="insert into taisan values('"+txtMa.getText()+"','"+txtTen.getText()+"','"+txtNgayNhap.getText()+"',"+txtSoNamKhauHao.getText()+","+txtGiaTri.getText()+")";
statement = conn.createStatement();
int x = statement.executeUpdate(sql);
ketqua = x ;
String a = "";
String b = "Không Gửi";
String sql1 = "insert into trangthai values ( '"+txtId.getText()+"','"+txtBienSo.getText()+"','"+a+"','"+a+"','"+b+"' )";
//statement = conn.createStatement();
int x1 = statement.executeUpdate(sql1);
ketqua1 = x1 ;
// dispose();//ẩn màn hình này đi
}
catch (Exception e) {
// TODO: handle exception
}
dispose();//ẩn màn hình này đi
}
else
{
try
{
String sql = "update vethang set bienso = '"+txtBienSo.getText()+"'"
+ ", tenchuxe= '"+txtTenChuXe.getText()+"'"
+ ", mauxe = '"+txtMauXe.getText()+"'"
+ ", loaixe='"+txtHangXe.getText()+"'"
+ ", ngaydangky ='"+txtNgayDangKy.getText()+"'"
+ ", ngayhethan = '"+txtNgayHetHan.getText()+"' where id='"+idVeThangChon+"'";
statement = conn.createStatement();
int x=statement.executeUpdate(sql);
ketqua=x;
String sql2 = "select * from trangthai where bienso = ?";
java.sql.PreparedStatement prepe = conn.prepareStatement(sql2);
prepe.setString(1, txtBienSo.getText());
ResultSet result = prepe.executeQuery();
String timeIn = "";
String timeOut = "";
String trangThai = "";
while ( result.next())
{
timeIn=result.getString(3);
timeOut=result.getString(4);
trangThai=result.getString(5);
}
String sql1="update trangthai set bienso=? where id=?";
PreparedStatement preStatement2=(PreparedStatement) conn.prepareStatement(sql1);
preStatement2.setString(1, txtBienSo.getText());
preStatement2.setString(2, idVeThangChon);
int x1 = preStatement2.executeUpdate();
ketqua1 = x1 ;
dispose();//ẩn màn hình này đi
}
catch (Exception e) {
// TODO: handle exception
}
}
}
public void hienThiThongTinChiTiet()
{
try
{
String sql = "select * from vethang where Id = '"+idVeThangChon+"'";
statement=conn.createStatement();
ResultSet result=statement.executeQuery(sql);
if(result.next())
{
txtId.setText(result.getString(1));
txtBienSo.setText(result.getString(2));
txtTenChuXe.setText(result.getString(3)+"");
txtMauXe.setText(result.getString(4)+"");
txtHangXe.setText(result.getString(5)+"");
txtNgayDangKy.setText(result.getString(6)+"");
txtNgayHetHan.setText(result.getString(7)+"");
}
txtId.setEditable(false);
}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
public void showWindows()
{
this.setSize(600,500);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
this.setModal(true);
this.setVisible(true);
}
}
| [
"[email protected]"
] | |
219c8e384616a8e61dde4b6b5b1ff29d8ffa4a60 | a383201e266356724964ec4e8bc33d7edb0f81a3 | /src/main/java/org/bkiebdaj/cqrsexample/domain/account/service/accountpresentation/action/AccountEntityDecreaseAmount.java | dc9177d0f62da4bd3cb9d3145ae2d6df9586fd7e | [] | no_license | bkiebdaj/cqrs-ddd-es-practice | 9703df0e5fbca64518e095465c397da95906d53a | b731472e284e7c27dd4e7372db148a1dbdd2a4e4 | refs/heads/master | 2020-03-23T22:54:13.553083 | 2018-08-21T17:40:40 | 2018-08-21T17:40:40 | 142,205,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package org.bkiebdaj.cqrsexample.domain.account.service.accountpresentation.action;
import lombok.RequiredArgsConstructor;
import org.bkiebdaj.cqrsexample.core.api.EventHandler;
import org.bkiebdaj.cqrsexample.domain.account.event.AccountMoneyAmountDecreased;
import org.bkiebdaj.cqrsexample.domain.account.service.accountpresentation.AccountPresentationService;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class AccountEntityDecreaseAmount implements EventHandler<AccountMoneyAmountDecreased> {
private final AccountPresentationService accountPresentationService;
@Override
public void handle(AccountMoneyAmountDecreased event) {
accountPresentationService.handle(event);
}
} | [
"[email protected]"
] | |
75059dc7aed9eead16ff02bad528ad6e9b2cf398 | 705879dc61c41198fb2c4f4f6328bba190c8a465 | /src/main/java/org/virtualbox/ISerialPortSetServer.java | e8f3543aff5bf75933ff7efc5a1f2f5b58d97c66 | [] | no_license | abiquo/hypervisor-mock | dcd1d6c8a2fdbc4db01c7a6e9a64edd101e8ed42 | e49e4ca84930415eca72ab6c73140a0f2eea4bbe | refs/heads/master | 2021-01-19T09:40:57.840712 | 2013-08-23T08:54:17 | 2013-08-23T08:54:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,860 | java |
package org.virtualbox;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="_this" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="server" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"_this",
"server"
})
@XmlRootElement(name = "ISerialPort_setServer")
public class ISerialPortSetServer {
@XmlElement(required = true)
protected String _this;
protected boolean server;
/**
* Gets the value of the this property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getThis() {
return _this;
}
/**
* Sets the value of the this property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setThis(String value) {
this._this = value;
}
/**
* Gets the value of the server property.
*
*/
public boolean isServer() {
return server;
}
/**
* Sets the value of the server property.
*
*/
public void setServer(boolean value) {
this.server = value;
}
}
| [
"[email protected]"
] | |
705c6a540e39d1968e1c2ae1de9964eb13bda51e | b8210533daacd755d368170a87bd3268a1671b46 | /src/lib/datastructures/trees/TreeNode.java | c6842e8eb8afd0c1a4e89b3cd254b76bc2b2bb82 | [] | no_license | georgistephanov/Algorithms | 3df245f00faef8bfaba8a9b2891b95f337ea89b7 | 91595a09b4f2223eb6d9fc4e5f48c89739ae33dc | refs/heads/master | 2021-09-07T21:23:27.140061 | 2018-03-01T09:12:00 | 2018-03-01T09:12:00 | 118,658,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package lib.datastructures.trees;
public final class TreeNode<T> {
private final T key;
private TreeNode parent;
private TreeNode left;
private TreeNode right;
private NodeColor color;
public enum NodeColor {
RED, BLACK
}
TreeNode(T key) {
this.key = key;
left = null;
right = null;
}
public T getKey() {
return key;
}
TreeNode getParent() {
return parent;
}
void setParent(TreeNode parent) {
this.parent = parent;
}
TreeNode getLeft() {
return left;
}
void setLeft(TreeNode left) {
this.left = left;
}
TreeNode getRight() {
return right;
}
void setRight(TreeNode right) {
this.right = right;
}
public NodeColor getColor() {
return color;
}
public void setColor(NodeColor color) {
this.color = color;
}
}
| [
"[email protected]"
] | |
5fa36897cc11e131ed9f575b80a226410edf6156 | 9d7aace2b8508ec8b39c2692b5baf3c4bda56623 | /ec-auto-persist/src/main/java/com/ecarinfo/auto/po/Keyword.java | 6bdf75bd5a04f426afb6653d5c1998d133462029 | [] | no_license | xiaobbbbbbb/ec-auto | 317a92ac1d62da0f70b1c95dafceff953e8be087 | 70963565e24860a7f2b460484712dbfdcbe881ed | refs/heads/master | 2021-01-19T13:00:33.691625 | 2014-05-07T07:26:32 | 2014-05-07T07:26:32 | 19,019,623 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package com.ecarinfo.auto.po;
import java.io.Serializable;
import java.util.Date;
public class Keyword implements Serializable {
private static final long serialVersionUID = -2260388125919493487L;
private Long id;
private String name;
private Integer type = 0;//1:article 2:industry_article 3:属于两者
private Date ctime;
public Long getId () {
return id;
}
public void setId (Long id) {
this.id = id;
}
public String getName () {
return name;
}
public void setName (String name) {
this.name = name;
}
public Integer getType () {
return type;
}
public void setType (Integer type) {
this.type = type;
}
public Date getCtime () {
return ctime;
}
public void setCtime (Date ctime) {
this.ctime = ctime;
}
} | [
"[email protected]"
] | |
4f6431ccf23deb2bd8b43fdc3bcbf17ecf25cb2d | 1c5aef2f4df5ad2800548af5771b852f34c9f636 | /app/src/main/java/com/wlhb/hongbao/ui/activity/BindingActivity.java | d5dcc7a77f7914b8de29e19d2ef967e93a9b96f5 | [] | no_license | SingleView/redpick1 | 12ca2319d855abef5f405cbe141cab5ae98bf359 | 59364afbc6c0c0a2104c50971eaf13dbcc0b815b | refs/heads/master | 2020-03-21T22:02:47.394839 | 2018-06-21T15:27:27 | 2018-06-21T15:27:27 | 139,100,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,804 | java | package com.wlhb.hongbao.ui.activity;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.alibaba.fastjson.JSON;
import com.wlhb.administrator.hongbao.R;
import com.wlhb.hongbao.app.App;
import com.wlhb.hongbao.base.BaseActivity;
import com.wlhb.hongbao.bean.Bindmobile;
import com.wlhb.hongbao.http.BaseCallback;
import com.wlhb.hongbao.http.BaseResponse;
import com.wlhb.hongbao.widget.CountDownTimer;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Response;
/**
* Created by Administrator on 2018/3/22/022.
*/
public class BindingActivity extends BaseActivity {
@BindView(R.id.ed_account)
EditText edAccount;
@BindView(R.id.ed_code)
EditText edCode;
@BindView(R.id.bt_vcode)
Button btVcode;
@BindView(R.id.bt_register)
Button btRegister;
private CountDownTimer mTimer;
private String mMobile;
private String mCode;
@Override
protected void initView(Bundle savedInstanceState) {
setTitle("绑定手机号");
}
@Override
public View loadView(LayoutInflater inflater, ViewGroup container) {
return inflater.inflate(R.layout.activity_binding, container, false);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
private void startTimer() {
mTimer = new CountDownTimer(1000, 60 * 1000);
mTimer.start(new CountDownTimer.CountDownListener() {
@Override
public void onStart(final long countTimeMillis) {
runOnUiThread(new Runnable() {
@Override
public void run() {
String str = countTimeMillis / 1000 + "秒后重试";
btVcode.setText(str);
btVcode.setEnabled(false);
btVcode.setTextColor(getResources().getColor(R.color.gray));
btVcode.setBackground(getResources().getDrawable(R.drawable.framebuttongray_bg));
}
});
}
@Override
public void onTick(final long leftTimeMillis) {
runOnUiThread(new Runnable() {
@Override
public void run() {
String str = leftTimeMillis / 1000 + "秒后重试";
btVcode.setText(str);
btVcode.setTextColor(getResources().getColor(R.color.gray));
btVcode.setBackground(getResources().getDrawable(R.drawable.framebuttongray_bg));
}
});
}
@Override
public void onFinish() {
runOnUiThread(new Runnable() {
@Override
public void run() {
String str = "获取验证码";
btVcode.setText(str);
btVcode.setEnabled(true);
btVcode.setTextColor(getResources().getColor(R.color.red));
btVcode.setBackground(getResources().getDrawable(R.drawable.framebutton_bg));
}
});
}
});
}
@OnClick({R.id.bt_vcode, R.id.bt_register})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.bt_vcode://获取验证码
mMobile = edAccount.getText().toString().trim();
if (TextUtils.isEmpty(mMobile)) {
showToast("请输入手机号");
return;
}
Call<BaseResponse<JSON>> call = service.sendsms(mMobile, 3);
call.enqueue(new BaseCallback<BaseResponse<JSON>>(call, this) {
@Override
public void onResponse(Response<BaseResponse<JSON>> response) {
BaseResponse<JSON> body = response.body();
if (body.isOK()) {
startTimer();
showToast(body.message);
} else {
showToast(body.message);
}
}
});
break;
case R.id.bt_register://绑定手机号
register();
break;
}
}
private void register() {
mMobile = edAccount.getText().toString().trim();
mCode = edCode.getText().toString().trim();
if (TextUtils.isEmpty(mMobile)) {
showToast(edAccount.getHint().toString().trim());
return;
}
if (TextUtils.isEmpty(mCode)) {
showToast(edCode.getHint().toString().trim());
return;
}
Call<BaseResponse<Bindmobile>> callbindmobile = service.bindmobile(App.token,mMobile, mCode);
callbindmobile.enqueue(new BaseCallback<BaseResponse<Bindmobile>>(callbindmobile, this) {
@Override
public void onResponse(Response<BaseResponse<Bindmobile>> response) {
BaseResponse<Bindmobile> body = response.body();
if (body.isOK()) {
//成功去主页
readyGo(MainActivity.class);
showToast(body.message);
} else {
showToast(body.message);
}
}
});
}
}
| [
"[email protected]"
] | |
382d2ce9845e9278e4e8ecdd867a67d866be3b83 | f3a13c5e5585c7e737af5bc1a0c72f7b6eb39470 | /web/src/test/java/com/shop/test/MockTest.java | c2ac622a6ef2ab1ffdcde1e816140c597000510f | [] | no_license | finno777/shop | cefa5d555fc8317fa24d9789eaeef665a205fc7f | e266ec50efe97b2303c6339f0df4bdcc1f47c4f9 | refs/heads/master | 2021-04-26T22:59:18.497997 | 2018-03-13T00:02:08 | 2018-03-13T00:02:08 | 123,908,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,849 | java | package com.shop.test;
import com.shop.App;
import com.shop.configuration.MvcConfiguration;
import com.shop.controller.MainController;
import com.shop.server.service.ProductService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { App.class})
public class MockTest {
@Mock
ProductService productService;
private MockMvc mockMvc;
@InjectMocks
private MainController mainController;
@Before
public void setup() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/jsp/");
viewResolver.setSuffix(".jsp");
mockMvc = MockMvcBuilders.standaloneSetup(new MainController())
.setViewResolvers(viewResolver)
.build();
}
@Test
public void setMockMvc()throws Exception{
mockMvc.perform(get("/login")).andExpect(status().isOk());
}
} | [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.