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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f2e15a42a43bea0f0a019528b4067c37fc44dedb | 977ebe395f2d9c1a80d6f6c505bde157f7d088f6 | /target/generated/src/main/java/com/esb/bme/cbsinterface/cbs/businessmgr/QuerySubCallScreenNoRequest.java | c547b6f5ed1d5964b819e6575a0083b8e898d1d5 | [] | no_license | EOnyenezido/esb | 5bc8e394809d8db46772c1e814dded69c1caa802 | 64b82667e253f03c9e18b4ff1be37264399d26b9 | refs/heads/master | 2020-03-28T06:13:37.875748 | 2018-09-14T12:44:04 | 2018-09-14T12:44:04 | 147,821,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,697 | java |
package com.esb.bme.cbsinterface.cbs.businessmgr;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for QuerySubCallScreenNoRequest complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="QuerySubCallScreenNoRequest">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SubscriberNo" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "QuerySubCallScreenNoRequest", propOrder = {
"subscriberNo"
})
public class QuerySubCallScreenNoRequest
implements Serializable
{
private final static long serialVersionUID = 11082013L;
@XmlElement(name = "SubscriberNo", required = true)
protected String subscriberNo;
/**
* Gets the value of the subscriberNo property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSubscriberNo() {
return subscriberNo;
}
/**
* Sets the value of the subscriberNo property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSubscriberNo(String value) {
this.subscriberNo = value;
}
}
| [
"[email protected]"
] | |
ce2a0de42f57f764a6ae5aeee64ca692cc94820b | 1e7ec5fab2249b49e80127e6eba4c6990f9c8671 | /Combining/src/composite/Goose.java | 8f178e13cdec1f2ae6926fdb46193013e9a400c4 | [] | no_license | IzaackLey/mtp-unaj | 326cd223c81c677c075e0876dace3ee80d431414 | ce2e78b3ef951b5f29c8c6d8b04d777eb9967110 | refs/heads/master | 2016-09-05T19:05:54.828233 | 2015-05-04T10:30:17 | 2015-05-04T10:30:17 | 42,803,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package composite;
public class Goose {
public void honk() {
System.out.println("Honk");
}
public String toString() {
return "Goose";
}
}
| [
"[email protected]"
] | |
b7f60e130f097955d4d97cb5e233beaaa38ea2c2 | 0c942ff8f96679851d281dfc001439400f329363 | /src/lib/ui/MainBar/MainBarModel.java | fa1ddbb3419727b12309a09bbe4c532ecf03310c | [] | no_license | AlejoM1908/Primal-Enterptise-DevTeam | 39c101d8e6c5b822aaf3e45e9c67046ac70ed7ce | f2ff647369ac0600e87d26340aac805a4c75fadd | refs/heads/master | 2023-02-05T06:42:28.981229 | 2020-12-14T15:10:59 | 2020-12-14T15:10:59 | 303,018,437 | 0 | 0 | null | 2020-12-14T15:11:01 | 2020-10-11T01:13:22 | Java | UTF-8 | Java | false | false | 288 | java | //Java imports
package lib.ui.MainBar;
import lib.models.User;
public class MainBarModel {
private User loggedUser;
protected void setLoggedUser (User loggedUser){
this.loggedUser = loggedUser;
}
public User getLoggedUser() {return this.loggedUser;}
}
| [
"[email protected]"
] | |
3222fd41f0dc42596edf0d2d2a40c3b1266572f5 | 7957b5690b4a7c725e1a58bd7da51a53f7ee43c5 | /ContactApp/app/src/test/java/com/aiczone/contactapp/ExampleUnitTest.java | 01963f2ab0c1201d0400bb0d825a265bf39058dc | [] | no_license | goeroeku/juniormobile-tpcc | da223b73f4ba747cc9d32c292cf57d3ecd2803f1 | 954f3ed3026f324f081216930586286d6a08ff57 | refs/heads/master | 2022-07-11T06:08:48.231588 | 2020-05-14T08:51:31 | 2020-05-14T08:51:31 | 263,495,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.aiczone.contactapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
43001c4a6061b2993c53b97d9db6c04e10018917 | de01adc66ec8821b9de422e97336cf227f8be131 | /src/main/java/com/mervyn/dataanalysis/DataAnalysisApplication.java | 33b6a162c31e22946a957d669ad0bc1fc5f2b40c | [] | no_license | csmervyn/data-analysis | 821a34573a0ce7a224e6601ecab4e947198f465d | fb37e852797bb430d82f45d68dc9407601ee4a7a | refs/heads/master | 2020-03-19T06:15:01.209481 | 2018-06-04T09:42:58 | 2018-06-04T09:42:58 | 136,003,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package com.mervyn.dataanalysis;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DataAnalysisApplication {
public static void main(String[] args) {
SpringApplication.run(DataAnalysisApplication.class, args);
}
}
| [
"[email protected]"
] | |
e7191ec00cd54487445ce0f32d93d89d1dd2f027 | 22ca044524207d09713803d5b239f3361c8fdd56 | /app/src/main/java/test/invoicegenerator/fragments/UserProfilePic.java | b9c072533e2ad77f1ad316f14cb94bcbefef8462 | [] | no_license | khalil054/InvoiceApp | 54dc4c669f596a470e88f7841e9a11cb56330520 | 94b8faa794ad506fab29e96c751c483644106d56 | refs/heads/master | 2020-08-01T14:02:34.195689 | 2019-09-26T06:33:04 | 2019-09-26T06:33:04 | 211,016,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,660 | java | package test.invoicegenerator.fragments;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.constraint.ConstraintLayout;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.NetworkResponse;
import com.android.volley.VolleyError;
import com.squareup.picasso.Picasso;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import butterknife.BindView;
import butterknife.ButterKnife;
import es.dmoral.toasty.Toasty;
import test.invoicegenerator.Activities.MainActivity;
import test.invoicegenerator.NetworksCall.IResult;
import test.invoicegenerator.NetworksCall.NetworkURLs;
import test.invoicegenerator.NetworksCall.VolleyService;
import test.invoicegenerator.R;
import test.invoicegenerator.general.GlobalData;
import test.invoicegenerator.model.SharedPref;
import static android.app.Activity.RESULT_OK;
import static test.invoicegenerator.general.Constants.Image_Request_Code;
import static test.invoicegenerator.general.Constants.PIC_CROP;
public class UserProfilePic extends BaseFragment {
ConstraintLayout constraintLayout;
private VolleyService mVolleyService;
IResult mResultCallback = null;
@BindView(R.id.save_btn)
Button save_btn;
@BindView(R.id.SelectProfile)
Button imageButton;
@BindView(R.id.logo_image)
ImageView logo_image;
@BindView(R.id.add_logo_text)
TextView add_logo_text;
String encodedImageData;
public static UserProfilePic newInstance() {
return new UserProfilePic();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
/* Inflating the layout for this fragment **/
View rootView = inflater.inflate(R.layout.fragment_user_profile, container, false);
ButterKnife.bind(this, rootView);
constraintLayout = rootView.findViewById(R.id.layout_header);
init();
return rootView;
}
private void init() {
showImageStamp(GlobalData.StrUserProfileUrl);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectLogoPic();
}
});
save_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
logo_image.buildDrawingCache();
Bitmap bmap = logo_image.getDrawingCache();
encodedImageData = getEncoded64ImageStringFromBitmap(bmap);
GlobalData.StrUserProfile = encodedImageData;
if (GlobalData.StrUserProfile.isEmpty()) {
showErrorMessage(constraintLayout, "Select Your Profile Picture");
} else {
DataSendToServerForAddCompany();
//showErrorMessage(constraintLayout,"Make Request");
}
}
});
}
private void selectLogoPic() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Please Select Image"), Image_Request_Code);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Image_Request_Code && resultCode == RESULT_OK && data != null && data.getData() != null) {
Uri filePathUri = data.getData();
try {
// Getting selected image into Bitmap.
Bitmap logo_bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), filePathUri);
// Setting up bitmap selected image into ImageView.
logo_image.setImageBitmap(logo_bitmap);
logo_image.buildDrawingCache();
} catch (IOException e) {
e.printStackTrace();
}
}
if (requestCode == PIC_CROP) {
if (data != null) {
// get the returned data
Bundle extras = data.getExtras();
// get the cropped bitmap
Bitmap selectedBitmap = extras.getParcelable("data");
logo_image.setImageBitmap(selectedBitmap);
}
}
imageButton.setVisibility(View.GONE);
add_logo_text.setVisibility(View.GONE);
}
private void performCrop(Uri picUri) {
try {
Intent cropIntent = new Intent("com.android.camera.action.CROP");
// indicate image type and Uri
cropIntent.setDataAndType(picUri, "image/*");
// set crop properties here
cropIntent.putExtra("crop", true);
// indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
// indicate output X and Y
cropIntent.putExtra("outputX", 128);
cropIntent.putExtra("outputY", 128);
// retrieve data on return
cropIntent.putExtra("return-data", true);
// start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP);
}
// respond to users whose devices do not support the crop action
catch (ActivityNotFoundException anfe) {
// display an error message
String errorMessage = "Whoops - your device doesn't support the crop action!";
Toast toast = Toast.makeText(getActivity(), errorMessage, Toast.LENGTH_SHORT);
toast.show();
}
}
public String getEncoded64ImageStringFromBitmap(Bitmap bitmap) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream);
byte[] byteFormat = stream.toByteArray();
// get the base 64 string
String imgString = Base64.encodeToString(byteFormat, Base64.NO_WRAP);
return imgString;
}
//////////////////////////
////////////////////////////upload data to server
void initVolleyCallbackForUpdate() {
mResultCallback = new IResult() {
@Override
public void notifySuccess(String requestType, String response) {
try {
JSONObject jsonObject = new JSONObject(response);
JSONObject data = jsonObject.getJSONObject("data");
String status = data.getString("status");
if (status.equals("true")) {
Toast.makeText(getActivity(), "Updated Successfully", Toast.LENGTH_SHORT).show();
Intent Send = new Intent(getActivity(), MainActivity.class);
getActivity().startActivity(Send);
getActivity().finish();
/*loadFragment(new CompanyDetails());*/
} else {
String error = jsonObject.getString("Error");
Toasty.error(getActivity(), error, Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
hideProgressBar();
}
@Override
public void notifyError(String requestType, VolleyError error) {
hideProgressBar();
error.printStackTrace();
if (error.networkResponse != null && error.networkResponse.data != null) {
// VolleyError error2 = new VolleyError(new String(error.networkResponse.data));
String error_response = new String(error.networkResponse.data);
try {
JSONObject response_obj = new JSONObject(error_response);
String status = response_obj.getString("status");
if (status.equals("false")) {
JSONObject error_obj = response_obj.getJSONObject("error");
String message = error_obj.getString("message");
Toasty.error(getActivity(), message, Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void notifySuccessResponseHeader(NetworkResponse response) {
}
};
}
void DataSendToServerForAddCompany() {
showProgressBar();
initVolleyCallbackForUpdate();
mVolleyService = new VolleyService(mResultCallback, getActivity());
JSONObject data = new JSONObject();
JSONObject User = new JSONObject();
JSONObject FinalObj = new JSONObject();
try {
data.put("email", GlobalData.StrCompanyEmail);
data.put("address", GlobalData.StrCompanyAddress);
data.put("city", GlobalData.StrCompanyCity);
data.put("state", GlobalData.StrCompanyState);
data.put("zip_code", GlobalData.StrCompanyZipCode);
data.put("country_id", GlobalData.StrCountryID);
data.put("user_id", SharedPref.read(SharedPref.LoginID, "0"));
data.put("phone", GlobalData.StrCompanyPhone);
data.put("logo", "data:image/png;base64," + GlobalData.StrCompanyLogo);
// data.put("company[cover_image]",zip_code.getText().toString());
data.put("stamp", "data:image/png;base64," + GlobalData.StrCompanyStamp);
User.put("signature", "data:image/png;base64," + GlobalData.StrUserSignature);
User.put("image", "data:image/png;base64," + GlobalData.StrUserProfile);
data.put("user", User);
FinalObj.put("company", data);
} catch (JSONException e) {
e.printStackTrace();
}
/* try {
// User.put("signature","data:image/png;base64,"+GlobalData.StrUserSignature);
User.put("image","data:image/png;base64,"+GlobalData.StrUserProfile);
FinalObj.put("user",User);
} catch (JSONException e) {
e.printStackTrace();
}*/
String Str = NetworkURLs.BaseURL + NetworkURLs.UpdateCompanuDetail;
mVolleyService.putDataVolleyForHeadersWithJson("PUTCALL", Str, FinalObj);
}
public void showImageStamp(String ImgPath) {
Picasso.get()
.load(NetworkURLs.BaseURLForImages + ImgPath)
.placeholder(R.color.grey) // Your dummy image...
.into(logo_image, new com.squareup.picasso.Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError(Exception e) {
// Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
// Unable to load image, may be due to incorrect URL, no network...
}
});
}
}
| [
"[email protected]"
] | |
4bbc349093f40500295afd23b35b0a0af1a8dbb9 | 7e2771140ef7d204680aafe8edcc5019660a562d | /java-basic/src/main/java/ch13/e/Test01.java | b6e27e0a038392579d6cbbb891e5eb35e5440082 | [] | no_license | cdis001/bitcamp-java-2018-12 | 8d63c8bfe01beb8db40bd14d04c433281223f0ed | cd3e10f26c1bc803f56fd6fa0a3e645d54146a66 | refs/heads/master | 2021-07-24T01:35:14.360793 | 2020-05-08T08:18:11 | 2020-05-08T08:18:11 | 163,650,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 247 | java | package ch13.e;
public class Test01 {
public static void main(String[] args) {
B obj = new B();
//클래스를 로딩할 때 super 클래스부터 로딩되므로, A의 초기화를 먼저 실행함
obj.m1();
obj.m2();
}
}
| [
"[email protected]"
] | |
221c9e1cd68eed0cf6e4e34d60be313aea112a58 | 80c290745440d782095288ae86ee6a610e329095 | /benchmark-4.2/src/main/java/org/apache/cayenne/latest/benchmark/server/ReadComponentsBenchmark.java | 1c9db77600748cb80fb75dd21952d0f3d4851a6f | [] | no_license | KravchenkoAS/cayenne-benchmark | 41fde14945886a24690695782f600dcb2a8f8716 | d95d6d70903568671f5205def95f988ec5e72909 | refs/heads/master | 2021-10-25T16:19:27.958546 | 2019-04-05T10:13:12 | 2019-04-05T10:13:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,763 | java | package org.apache.cayenne.latest.benchmark.server;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.cayenne.DataRow;
import org.apache.cayenne.ObjectContext;
import org.apache.cayenne.access.DataDomain;
import org.apache.cayenne.access.DataNode;
import org.apache.cayenne.access.translator.select.DefaultSelectTranslator;
import org.apache.cayenne.access.translator.select.SelectTranslator;
import org.apache.cayenne.configuration.Constants;
import org.apache.cayenne.configuration.server.ServerModule;
import org.apache.cayenne.configuration.server.ServerRuntime;
import org.apache.cayenne.dba.DbAdapter;
import org.apache.cayenne.query.ObjectSelect;
import org.apache.cayenne.query.SelectQuery;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import persistent.Artist;
@Warmup(iterations = 5, time = 2)
@Measurement(iterations = 6, time = 1)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork(2)
@State(Scope.Benchmark)
public class ReadComponentsBenchmark {
private static ServerRuntime serverRuntime;
@Setup(Level.Iteration)
public void setUp() {
serverRuntime = ServerRuntime.builder()
.addConfig("cayenne-project.xml")
.build();
}
@TearDown(Level.Iteration)
public void tearDown() {
serverRuntime.shutdown();
}
@State(Scope.Benchmark)
public static class QuerySetup {
ObjectContext objectContext;
SelectQuery<DataRow> query;
DbAdapter dbAdapter;
@Setup(Level.Invocation)
public void setUp() {
objectContext = serverRuntime.newContext();
query = SelectQuery.dataRowQuery(Artist.class);
Collection<DataNode> dataNodes = ((DataDomain)objectContext.getChannel()).getDataNodes();
dbAdapter = dataNodes.iterator().next().getAdapter();
}
}
@State(Scope.Benchmark)
public static class ContextSetup {
ObjectContext objectContext;
@Setup(Level.Invocation)
public void setUp() {
objectContext = serverRuntime.newContext();
}
}
@Benchmark
public ObjectContext contextCreation() {
return serverRuntime.newContext();
}
@Benchmark
public ObjectSelect<DataRow> queryCreation() {
return ObjectSelect.dataRowQuery(Artist.class);
}
@Benchmark
public String queryTranslation(QuerySetup querySetup) throws Exception {
SelectTranslator selectTranslator = new DefaultSelectTranslator(querySetup.query, querySetup.dbAdapter, querySetup.objectContext.getEntityResolver());
return selectTranslator.getSql();
}
@Benchmark
public List<DataRow> fullQueryDataRowExecution(ContextSetup contextSetup) {
return ObjectSelect.dataRowQuery(Artist.class)
.select(contextSetup.objectContext);
}
@Benchmark
public List<Artist> fullQueryEntityExecution(ContextSetup contextSetup) {
return ObjectSelect.query(Artist.class)
.select(contextSetup.objectContext);
}
@Benchmark
public List<Artist> fullExecution() {
return ObjectSelect.query(Artist.class)
.select(serverRuntime.newContext());
}
}
| [
"[email protected]"
] | |
a7f7da2693587225b656b86b326f689f61e933ce | ca030864a3a1c24be6b9d1802c2353da4ca0d441 | /classes4.dex_source_from_JADX/com/facebook/placetips/settings/graphql/FetchGravitySettingsMethod.java | 5b98944c948d82026e0485c4515eab9ccea24f26 | [] | no_license | pxson001/facebook-app | 87aa51e29195eeaae69adeb30219547f83a5b7b1 | 640630f078980f9818049625ebc42569c67c69f7 | refs/heads/master | 2020-04-07T20:36:45.758523 | 2018-03-07T09:04:57 | 2018-03-07T09:04:57 | 124,208,458 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,237 | java | package com.facebook.placetips.settings.graphql;
import com.facebook.graphql.protocol.AbstractPersistedGraphQlApiMethod;
import com.facebook.graphql.protocol.GraphQLProtocolHelper;
import com.facebook.graphql.query.GraphQlQueryString;
import com.facebook.http.protocol.ApiResponse;
import com.facebook.placetips.settings.graphql.GravitySettingsGraphQlFragmentInterfaces.GravitySettingsGraphQlFragment;
import com.fasterxml.jackson.core.JsonParser;
import javax.inject.Inject;
/* compiled from: rootca_sampling */
public class FetchGravitySettingsMethod extends AbstractPersistedGraphQlApiMethod<Void, GravitySettingsGraphQlFragment> {
@Inject
public FetchGravitySettingsMethod(GraphQLProtocolHelper graphQLProtocolHelper) {
super(graphQLProtocolHelper);
}
public final GraphQlQueryString m3555f(Object obj) {
return GravitySettingsQuery.m3560a();
}
public final int m3554b(Object obj, ApiResponse apiResponse) {
return 1;
}
public final Object m3553a(Object obj, ApiResponse apiResponse, JsonParser jsonParser) {
return ((GravitySettingsQueryModels$GravitySettingsQueryModel) jsonParser.a(GravitySettingsQueryModels$GravitySettingsQueryModel.class)).m3563a();
}
}
| [
"[email protected]"
] | |
e00883da7287826175a4eaa170801736c942d00c | 1878a03bb8976949c748e5d90b69a33134439838 | /app/src/main/java/heartbeat/social/tcs/socialhb/network/LocationProvider.java | 8c7c1b7c7e287f35e6401ac27999f4744a6e95a4 | [] | no_license | jainshravan123/SocialHB | 37fb431ec4e0855b7692c3fa81702f6f187ed10c | 4adae403a60ef8b1caa620914739f65ca3ec72cf | refs/heads/master | 2020-05-31T00:10:13.414869 | 2017-05-05T18:28:28 | 2017-05-05T18:28:28 | 68,455,553 | 2 | 1 | null | 2017-05-05T18:28:29 | 2016-09-17T14:00:57 | Java | UTF-8 | Java | false | false | 5,162 | java | package heartbeat.social.tcs.socialhb.network;
/**
* Created by admin on 30/12/16.
*/
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
public class LocationProvider implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener {
public abstract interface LocationCallback {
public void handleNewLocation(Location location);
}
public static final String TAG = "LocationProvider";
/*
* Define a request code to send to Google Play services
* This code is returned in Activity.onActivityResult
*/
private final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000;
private LocationCallback mLocationCallback;
private Context mContext;
private GoogleApiClient mGoogleApiClient;
private LocationRequest mLocationRequest;
public LocationProvider(Context context, LocationCallback callback) {
mGoogleApiClient = new GoogleApiClient.Builder(context)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
mLocationCallback = callback;
// Create the LocationRequest object
mLocationRequest = LocationRequest.create()
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
.setInterval(10 * 1000) // 10 seconds, in milliseconds
.setFastestInterval(1 * 1000); // 1 second, in milliseconds
mContext = context;
mGoogleApiClient.connect();
Log.e(TAG, "Enteretd");
}
public void connect() {
mGoogleApiClient.connect();
}
public void disconnect() {
if (mGoogleApiClient.isConnected()) {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
mGoogleApiClient.disconnect();
}
}
@Override
public void onConnected(Bundle bundle) {
Log.e(TAG, "Location services connected.");
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
Location location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
if (location == null) {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
}
else {
mLocationCallback.handleNewLocation(location);
}
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
/*
* Google Play services can resolve some errors it detects.
* If the error has a resolution, try sending an Intent to
* start a Google Play services activity that can resolve
* error.
*/
if (connectionResult.hasResolution() && mContext instanceof Activity) {
try {
Activity activity = (Activity)mContext;
// Start an Activity that tries to resolve the error
connectionResult.startResolutionForResult(activity, CONNECTION_FAILURE_RESOLUTION_REQUEST);
/*
* Thrown if Google Play services canceled the original
* PendingIntent
*/
} catch (IntentSender.SendIntentException e) {
// Log the error
e.printStackTrace();
}
} else {
/*
* If no resolution is available, display a dialog to the
* user with the error.
*/
Log.i(TAG, "Location services connection failed with code " + connectionResult.getErrorCode());
}
}
@Override
public void onLocationChanged(Location location) {
mLocationCallback.handleNewLocation(location);
}
}
| [
"[email protected]"
] | |
c98eaa65cb94c4b6c1bd6b0058b8bf394c112c72 | 21b96711b22c83bc4ba56be0368a89000e3ec508 | /src/mapper/SysPermissionMapperCustom.java | c0de8efd3ad418e5b7189c9e80d89a8a7e22f07f | [] | no_license | KEVINYZY/shiro-1 | e0d8add161dd17a1d974a1fbd2db1d86c9b1f994 | ecde8f86a1e3c6177bc635d4283c7ee33288e45d | refs/heads/master | 2020-06-16T14:15:17.604202 | 2019-07-07T03:34:14 | 2019-07-07T03:34:14 | 195,605,122 | 0 | 0 | null | 2019-07-07T03:21:23 | 2019-07-07T03:21:22 | null | UTF-8 | Java | false | false | 572 | java | package mapper;
import po.SysPermission;
import java.util.List;
/**
*
* <p>Title: SysPermissionMapperCustom</p>
* <p>Description: 权限mapper</p>
* <p>Company: www.itcast.com</p>
* @author 传智.燕青
* @date 2015-3-23下午2:55:28
* @version 1.0
*/
public interface SysPermissionMapperCustom {
//根据用户id查询菜单
public List<SysPermission> findMenuListByUserId(String userid)throws Exception;
//根据用户id查询权限url
public List<SysPermission> findPermissionListByUserId(String userid)throws Exception;
}
| [
"[email protected]"
] | |
c69f07d891635d891104eed980282ea84ff9f221 | 6bb96c59dc51e18f68e565e1becf8c784729a656 | /AndroidStudioProjects/14_01_18_Class_Work-master/app/src/main/java/com/example/vladimir/a14_01_18_class_work/ViewContactActivity.java | ce4691bbb406e25686551a9bea636d5e6dd950f2 | [] | no_license | VladimirKogan/14_01_18_Class_Work-master | 4a4c8f055e92ae372460c8824d6f6f1595760b6b | 1cc8cb0541bddf352a6d431213f45a33d87a3aca | refs/heads/master | 2021-09-04T07:07:10.401799 | 2018-01-16T22:03:07 | 2018-01-16T22:03:07 | 117,747,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.example.vladimir.a14_01_18_class_work;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class ViewContactActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_contact);
}
}
| [
"[email protected]"
] | |
c6664fabcb40693289daabc383bb23f2640425db | 113ccdaa320bd15ce6ca6aea2d73c5542a98dd3d | /XFiles/XFiles-war/src/java/in/xfiles/web/galua/Coding.java | 7c41e968fb4b1b7e9bccb2c025ff3a2df9273137 | [] | no_license | caanguila/xfilesproject | 0813391349ee291f1255e7b17ce287e2a7918731 | fea5594d0a82da6328b8658c65fe379d9d115af9 | refs/heads/master | 2020-04-06T07:18:51.122116 | 2013-03-21T14:01:06 | 2013-03-21T14:01:06 | 33,963,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,504 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package in.xfiles.web.galua;
import java.util.HashMap;
import java.util.Iterator;
import java.util.*;
import java.util.Set;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author 7
*/
public class Coding {
private final String cipro;
// ="ЪДЪИМГЬФЬНЯМКЩИМУОВВИЬНХРНЧЮОБИГЪДШММЮДХЫКЮЮОЩЯСЧСВПЛФАМЯНЯЪНБКРЬПВРИДИВШРФ"+
//"ОИМДХУКСЛСЦЛИЭДЩЛИДЗСЯПФЛМАЬЪЯНВРНЖЛЬЦИГМОЖУМШНЖЛИЧКХОИВЖХБЖЪЫИМРСВКЫОСБСОД"+
//"ЫМДТЖЪЪЖОЯАГЪОКФЖФНМХМЗАКМЪНШГРЩОСПЪЮМРЩУРЫОВАГЮДОХЯЕМДБЪЩУКРЖУУАТЫЦЖКИЬНХУ"+
//"ПЖМКЩКХЮСЗНМЮНВЦОВППБОУУКБЮРЩЯСЮЗЬСПЮБРЦДАППЩФГЪМРКФШКЕЫКСЛСЕКРЧНЭЖУБИМУЗБМ"+
//"САИГЪЗКЛИВКЖШЮЩГОБИЕЦГЪИХБЖЯЧНЧВГЮДДШНБВМАЕЦЪЯЩГЕФЮЫАЭЩИМАИЦМОЪОЪФОНАЗЦГЛДК"+
//"ПЪДБЖВДЯСЭЯЧЦЦТВИШЯБЖИЯЛЦЮСЭРЯДЫОУСХРЯВКТОПЮГХЖЬЦФСХКЕДОСЭНБГЪЩОЮЭДГЮУПКХЧЯ"+
//"ЯЩЕФЖМЩЯЬСУЭПНОАЯСНЬЖСЩЯЯЖТБЖМОПАГМДЕМЦЧЖЮДДЕГЬЗЖЮРГЬДЫСХИМШПЫЫЭЭРИЮКПЦПЗЗГ"+
//"ЯДМЪНШЮПЬКХРДДРЮЦЬВЯЯЮЖИВЬНОИЭГМЦКФЪДБЖНБЗЦЪДЕИЦЛЬОЫРСМХЦБУЯЪЧЮХРУМДЗЮМЕВМС"+
//"ЕЛРБРЖЖПЦЛВКГЫПУЧЗГМЪЕДТЫРХКЮЯЕГПКЗЗГЯДТЭЮАМНЕКПАЛЪПХЖЯЗУРЭВИЮЬЖААЪОРФОСЭЧХ"+
//"ПЗБУНЫЗВВРФЕСФНБНСШНХАОЭИНАДПЫЦЪЛЯГКДЧНБГФЩЗИЪЗЯРГЭЭСЦИВЖЧГЬРЯНЧПНЬИССЯАЖЗФ"+
//"ВИЪДЕЗСЮШНЫЖХКВЮНВЦБВАФЩСЗРЗЫГРЬЫШЫИХЕГЮЬФКИХЗГУОСЪДЯМЕЭКФЯЫБГОРГВЮИХЕГЕШРО"+
//"БЪОРБОСДМВИМВМСПТЩЖОБНЯРМХЦИЯЯИЭНЪХЦЦНХРНЯЬДЦДЗОЕЪПСЯИМЯДЯЪРБУХЫАРБСДЛСТЯЖЮ"+
//"НБЯСЭНЩЮХББФЯЫБГХФЕЪЯНЦЩХБЖФЯЪЪМЗАЬНЫЕЭЛИЕКЪЯНЦЩХБИНЦДЕНСДКДЪЪЦЩОЬЕОМАЧЖРБЛ"+
//"УЦБЕГПЕКПХГЪПЯХЧОЫЦЖМХБОГЧНЪПХГЬРЪНЪХХБОСРСХЗСЯМСТДМГЖБКРЮЯАЛИЯКЖЮДЦГСХЦВЮМ"+
//"ЭРЯЩЗЦЬНЮЮЛФЖСЮЫЮЮНДЬПЫМГМХБЗФЫЖБЮЕФЖФНЦЖМЕЩНЯПЯЯПСЦНИЩРЧММЯЯСРНДМПЬФЦЩНАПХ"+
//"ФЖРОМЪПНБЖЯЧНАЖРЖОНОИЦСЗЕКЖТДЖМЕШЬОЦРЮОЮВЕМЦСДСДПИГЭДЬЩЕФЖМСГЪРСЫЬЖЫПХКМЬЮФ"+
//"УОВВИГИЦШНЕЪХЖЗГЪНАНСИККЦЛБЮРЩЭУУЕБМЛФЗГШДЧЮРАКИЬНЯГРФЕГЭСЭЛИЬДЛЛСВБСЯЯОЦРЖ"+
//"МЖБЕСУИХЗРФЭУЫРХЛРБЯСЬНЯЭЕПССТЗЯЖВДИСЦНЮМРЛБРЪНЖМОРЕСЫГБЖХБИНЦДМГУЕЧЦРКЪЗГЕ"+
//"БОКМВЖДЮКРТЗБЗМЩБСРЯЯЪРБЕУАВЯЖЕМБИЮЮЯЖЪЬЕСУДЖМРЩИЯЧЗЭРСАБРКИЭЖФЕЬРЧЯЮММХЧЕО"+
//"ДЖСМАНХЦСЗРНЬЮТУПЧЩИЯБФНХРНСДЖИРЪГСФЭЬИУАЪИСЩЛСДСЭНУБНХЫДГИГЕШМГДЯГЖЭКМШНЧЗ"+
//"СБЭШРЯЖЖЕМБИРНЧПИИЗИЮСХУПБЖСТДБЪНЬБФЯПВЖРПБЪШДБЩНБОСЭЪЪМЛАЬЪОКЭПЯЦЕГЧЗЪРСЛД"+
//"ФЯЪКИМАДВВИХЕГЮКФКНБЮЕДЫТЫФВВМЮЬРОИХЗЦТОСЦВДСЫЭПСЯЦЪРОЬЮСРЪЖМЪЩИРАЭЭЕФЮКРЫБ"+
//"ВЖНБНХЦНБЮХБЖЯЧНВВРФЭИШДЯЮМЦЧШЫГЭИГВМСХПХХРБЪМЮБЪРОБЪМХЛЗРРБДМЪДГОСЫМГДМВЖХ"+
//"БЖТИБЭВРБОГЧТЫЯЮЦЬИЯМХПЕЩОИРЗЩЛСЬУМДЗЮМЕПИГЪДЕЗСЮШНЫЛЭЛЦЕЮКЦЖБЖСХМГЖЯУРФУЮТ"+
//"ЫЬЖМЕАКФШНЧМТБЩХПТЩГХЖВИЮКЭЦНБЗТЫИДЮМАБМЩДДГСАЛСДТЧПХЦКЕОКЕГДУНСРДДЦИАИСДДА"+
//"РСЦМСТДАМОБАССНМГОБЮИЧЯМСХРУЦЯЫБГЖЖНГЭНАСЕЬАИРЧЭАСЫЖИЪЗКНЦДОСЦРЖСОБИХЫСМЮФЩ"+
//"ЯСХЯБЭОГЬЛСНЧМУДИГДЯЯЮРЩЕОУЗЯПВАКТЫРЯГЗЩЖСЬННИСЬКРЪЯМЮОШЬКУОВИЦЛЬХКУВОФАКЛТ"+
//"ДЕЪНЦБОЦЦХЖЫЩЗЦЬПЭПНБМДЦЭБЮЗБЭРЫЖХКИЕДХКЦЖМОТАМЮСЪНИАИЮУЗЬЮРЬЗГМШЭГЕФВРИДЩМ"+
//"ОЪИСЮСЭЗГЭОСЪДАЛСЧКХНЕЪИСЦЬХИБДЮЛЧКЕЫПХУФШЬПОЛЭЛГСОСЩЯЕРИГЬЖЫРГМЗФЛСЭТМЖНЬД"+
//"РЦИХЗРЩАГШДЪЗГВДХОМЕЗМИУМЪНЧЗГЭКРЦГЪИГТОДЫВЭУЕЩАГУСЮЮКЩОФНЗБГСЛБРКЛЗВУЩИЮУБ"+
//"ЪЧМЧКЕЫПФРГШБЕЦХХРСЬАИШНЮЮЪФБХЮЮБЮФЕПОУНЖППЩСГЮСХРФЭДМФДЕМЕЩОРЦИЦМЖЫИГУСМРС"+
//"ГЬФЮИХДИЕДОЦОВАИШБХЭДМЪСЕКПДСВОСДНМННМГРРЛУЫРЖОГАИСУВВПЦШЬУЮСЧММЮДСЯОЗПХЬОН"+
//"ЫЛГИМЯБРЯИВРСГЧМЧНБГЪАКЕИГЗКГАИИПДЬМФЕМСАЛЭЭРБКХЪДШМЦЪЬФЪНГЮШАБХЧМЭБСТБФШЗЫ"+
//"ГФЭЬКУСМРСАДДАГСППЩФРЫДЖМФФЗРУРДЮЕАБРЪНЦМОРФИЮЛЪГХДЫЪУЛЖЮНБОСЭЯФГЖБНОАЧХГХЫ"+
//"АИЮЫТРСЫЬПУЦЪЛСШЖВЯНШМЪЕКДИЦЭРГЕБОЦБЭВИЮДТЫЦЪКЦХЖСЪГЭЛНФНХОКХЕИЦЬХКБВАУЩЗВЭ"+
//"ЯЕПНФГСРМХЦИЧКЖУПВЭЖЩМСЦНЩЛГЭККУРВАФЩЗАЯНШМРЩГГЩДМЮОГЬФЮИХЕЮЦЬВЩМВДИДОЕЫОДЖ"+
//"ВЕИЮВБЪЧИЬЕСЯНДЩИЖВИЮКЗХГЮКФКДАСТГКМХМВПМЕШЕЬНЩМДАЧШЮКЗХГУСЕЭЯЬЛЮИЗИЮСХУМЯБ"+
//"РЪНЧПМЯЭМЭРЮММЧПДУПБЖМЖНСБПВЛГЬЮГЪНЧЖЪФЭИЮОЪХРБЯССГЪЯЮЮДХЫВЩЮЗБУЯУВВЮЗЩЖГЦГ"+
//"ХПСЗМСЪНЧЛГДОУУЛФЕСЮКЕЧЯАЖПФМЯУЗШЮЕГДОЫББММФЖИЧРХЛЗГКМСЯЧОМЮКЕЪНЭЖГШБОКВЪЖЗ"+
//"БДЖОБДЖОБЮРЫЗЗТИШКУОУЪВСГКЕЦЦХНИГБНЭНЪАГЦМВХЯБПНБДЖААЪОРЬДЦБПВИГЦЬФЦКСГЕЬУГ"+
//"ЬНЦГЗБИСЮМВБСЦЛИЪЖЪЛФЭКМСТЦГУАДМЦТЦОГЕЬИСНГГХГЬЕОРЭИЯЩЮМДЯШВИХЧОЦРЧМВЛБРЦХХ"+
//"ГЖБЕГЯДДЖРФЗМВЯЭИСЦИГЦББСЪФОРИДЕГФЕМЮУДДМЛФРИТНДМЕАЬМЛЛЭИМУРИТНДМЕАЬЕРЮЖПНБ"+
//"ДЖААЪОРЬДЦЬДЖОГЦЬУЮНБМЧРБЕЦЦХБЗЩЭЮШЯЕГФЕМГЪДЧГФЕЕМУВВНИЮЬЖУЮЪБСГКЕЪЯЕНОЩЗВЪ"+
//"МЭФИЬНСБЫЪЖУБНХЦРЯЮЕАКМЦГЧСПУНЕЫГБЩПЬНИЮСДЮПЬНСБЗЪЖГЮБНЮЯБВУБЮРЫЗЭКГЭЖГЯТДМ"+
//"МФЖИЧРХЛЗГКЕЪНЭАФЩЗЗОЛХКФБЮИЭЧЪЛРБИИЬНБОГЦДОЫРСРГЭКИЫАКМКШБРЦДМЖЪЬЕСРЯВВРФД"+
//"ЛЪЗКЛГГКЪЪНГОСМЖГЩЗАМИЧКЪЯНЦЩЗФОЯУЛЗЫХБГГЩДЖЖХРДЗОЕЪЕГШБООАЯМРШДРЧТЩМЕБЖЯЪН"+
//"БГДГБКЪНЖМОДОЮЩПЗИСДЮСУВВНОФОЯНЯНЮУЗКПЧНЖМУПДТЫПКЮОЦКНЭТШНОЩУИУПХПТБМВТЗЯЮФ"+
//"РОГЧЦЖМСАЗГВМЗИНБИЩЫЛЕАСЬЗИУОВПГЯКПАКЭФЦЦОСФДЕЮПББЕЭДАЭТБГГТЗЪБСЬГСТМЭУЗФЗФ"+
//"ЧЗКСФЕДЛЪДЕИСДШЕЩДЕРИДГГЬЯКМПЗДГШНЮВСЦКОКМВ";
public Coding() {
cipro = getStringFile("D:/cry.txt");
System.out.println(cipro);
}
private Map<Integer, Integer> statistic = new HashMap();
private Map<Integer, Integer> realStatistic = new HashMap();
private Map<Integer, Double> statisticProb = new HashMap();
private Map<Integer, Double> realstatisticProb = new HashMap();
public String cesarcode(String text, int param){
text = text.toUpperCase();
String buf = "";
int a = (int) ' ';
char s = (char) a;
// System.out.println("a(int)= "+a+" s(char)= "+s);
int i;
for(i = 0;i < text.length(); i++) {
s = text.charAt(i);
a = (int) s;
System.out.println("index: "+i+" a(int)= "+a+" s(char)= "+s);
if((a+param)>=1040 & (a+param)<=1071 ) a = a + param;
else{
int d = 1071-a;
param -=d;
a = 1040+param;
}
s=(char)a;
//System.out.println("a(int)= "+a+" s(char)= "+s);
buf = buf+(char)(a);
}
/*for(i=1;i<200;i++){
a=i;
s=(char)a;
System.out.println("a(int)= "+a+" s(char)= "+s);
}
*
*/
System.out.println(buf);
return buf;
}
public void printASCCI(){
char c;
for(int i=1040; i<1072; i++){
c = (char) i;
System.out.println("i: "+i+" char: "+c);
}
}
public void getInfo(){
System.out.println("Length: " + cipro.length());
initMap();
scanInputText();
getRealStat();
normMaps();
printExpectedText();
// printSortMap();
}
private void initMap() {
for(int i=1040; i<1072; i++){
statistic.put(i, 0);
}
printMap();
}
private void initRMap() {
for(int i=1040; i<1072; i++){
realStatistic.put(i, 0);
statisticProb.put(i, 0D);
realstatisticProb.put(i, 0D);
}
}
private void printMap(){
Set set = statistic.keySet();
Iterator iter = set.iterator();
System.out.println();
while(iter.hasNext()){
Integer key = ((Integer) iter.next());
int keyVal = key.intValue();
System.out.println("Map key: "+keyVal+" word element: "+((char)keyVal)+" count: "+statistic.get(key));
}
}
private void getRealStat(){
initRMap();
ByteArrayOutputStream baos = null;
FileInputStream fis = null;
try {
File file = new File("D:/abc.txt");
System.out.println("file: "+file.exists());
fis = new FileInputStream(file);
byte[] mass = new byte[fis.available()];
fis.read(mass);
baos = new ByteArrayOutputStream();
baos.write(mass);
String realText = baos.toString("Windows-1251").toUpperCase();
// System.out.println("Text: "+realText);
scanRInputText(realText);
printSortRMap();
} catch (IOException ex) {
Logger.getLogger(Coding.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
fis.close();
} catch (IOException ex) {
Logger.getLogger(Coding.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public String getStringFile(String path){
ByteArrayOutputStream baos = null;
FileInputStream fis = null;
try {
File file = new File(path);
System.out.println("file: "+file.exists());
fis = new FileInputStream(file);
byte[] mass = new byte[fis.available()];
fis.read(mass);
baos = new ByteArrayOutputStream();
baos.write(mass);
String realText = baos.toString("Windows-1251").toUpperCase();
// System.out.println("Text: "+realText);
// scanRInputText(realText);
// printSortRMap();
return realText;
} catch (IOException ex) {
Logger.getLogger(Coding.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
fis.close();
} catch (IOException ex) {
Logger.getLogger(Coding.class.getName()).log(Level.SEVERE, null, ex);
}
}
return null;
}
public void normMaps(){
int summarySizeReal = 0;
int summarySize = 0;
for(int i=1040; i<1072; i++){
summarySizeReal+=realStatistic.get(i);
summarySize+= statistic.get(i);
}
System.out.println("Imput Text Summary: "+summarySize);
System.out.println("Real Text Summary: "+summarySizeReal);
double prop = 0;
double prop1 = 0;
for(int i=1040; i<1072; i++){
prop =((double) realStatistic.get(i)) /((double) summarySizeReal);
prop1 =((double) statistic.get(i)) /((double) summarySize);
realstatisticProb.put(i, prop);
statisticProb.put(i, prop1);
}
for(int i=1040; i<1072; i++){
// System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+statistic.get(i));
System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+realstatisticProb.get(i));
}
System.out.println();
for(int i=1040; i<1072; i++){
// System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+statistic.get(i));
System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+statisticProb.get(i));
}
}
private void printSortMap(){
System.out.println();
for(int i=1040; i<1072; i++){
// System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+statistic.get(i));
System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+realstatisticProb.get(i));
}
}
private void printSortRMap(){
System.out.println();
for(int i=1040; i<1072; i++){
System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+realStatistic.get(i));
}
}
private void scanInputText() {
int leng = cipro.length();
char symbol;
int coun;
for(int i = 0; i< leng; i++){
symbol = cipro.charAt(i);
if(statistic.containsKey((int)symbol)){
Integer count = statistic.get((int)symbol);
coun = count.intValue();
coun++;
statistic.put((int)symbol, coun);
}
}
}
private void scanRInputText(String s) {
int leng = s.length();
char symbol;
int coun;
for(int i = 0; i< leng; i++){
symbol = s.charAt(i);
if(realStatistic.containsKey((int)symbol)){
Integer count = realStatistic.get((int)symbol);
coun = count.intValue();
coun++;
realStatistic.put((int)symbol, coun);
}
}
}
private void printExpectedText() {
StringBuffer buff = new StringBuffer();
int ind1;
int ind2;
HashMap map = new HashMap();
for(int i=1040; i<1072; i++){
ind1 = getMaxElemInd(realstatisticProb);
ind2 = getMaxElemInd(statisticProb);
map.put(ind2, ind1);
realstatisticProb.put(ind1, 0D);
statisticProb.put(ind2, 0D);
}
char start;
char end;
for(int i=0; i< cipro.length(); i++){
start = cipro.charAt(i);
if(map.containsKey((int)start)){
int charVal = ((Integer) map.get((int)start)).intValue();
end = (char)charVal;
// System.out.println("Start char: "+start+" End Char: "+end);
buff.append(end);
}else{
buff.append(start);
}
}
String expected = buff.toString();
// for(int i=1040; i<1072; i++){
// // System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+statistic.get(i));
// System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+realstatisticProb.get(i));
// }
// System.out.println();
// for(int i=1040; i<1072; i++){
// // System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+statistic.get(i));
// System.out.println("Map key: "+i+" word element: "+((char)i)+" count: "+statisticProb.get(i));
// }
System.out.println("Expected text: ");
System.out.println(expected);
}
private int getMaxElemInd(Map<Integer, Double> map){
double max = 0;
int index=0;
Iterator iter = map.keySet().iterator();
while(iter.hasNext()){
Integer key = (Integer) iter.next();
Double value = map.get(key);
if(value >= max){
max = value;
index = key.intValue();
}
}
System.out.println("Max ind: "+index+" value: "+max);
return index;
}
}
| [
"[email protected]@5ead5ee2-ed5d-3a2b-4562-3cd651b19626"
] | [email protected]@5ead5ee2-ed5d-3a2b-4562-3cd651b19626 |
2b8fad8c431f639017ed8122b5fad4b06add31c5 | e6c5fa09fa1717119bf39ab466dcaeec93e93e2f | /src/main/java/com/kodilla/springintro/Shape.java | 751b5a5b560202fb0d5666b54b39e9055e65a336 | [] | no_license | agata-kodilla/kodilla-course-spring | d6e626a80e9ce338cfa625404573531d8e8b2047 | 4bb17b7cf97b0760ae7167f8503e1ddc9a380055 | refs/heads/master | 2021-01-16T10:45:50.838004 | 2020-03-20T19:26:00 | 2020-03-20T19:26:00 | 243,088,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 79 | java | package com.kodilla.springintro;
public interface Shape {
String draw();
} | [
"[email protected]"
] | |
353b172eb233da23cf03d12b551192175013635e | 3977eb7b183831efbef90b5e8ebdbd4bd7ff4de5 | /app/src/main/java/com/example/joseramos/lyricsappjlrf/presentation/fragments/TopSongsFragment.java | 0d08d7eadf69e4de4eaafa467ff4cb171dcc74cc | [
"Apache-2.0"
] | permissive | JoseLuisRF/mylyricsappjlrf | 47ea189ddc81f63d7f1ea864731c51000200cc9d | 78bcb26cc28b825ea2f770b84aaf4f046f15d472 | refs/heads/master | 2021-05-07T17:57:56.190936 | 2018-03-30T19:22:25 | 2018-03-30T19:22:25 | 108,772,394 | 2 | 0 | null | 2017-11-08T23:48:20 | 2017-10-29T21:20:49 | Java | UTF-8 | Java | false | false | 3,080 | java | package com.example.joseramos.lyricsappjlrf.presentation.fragments;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.joseramos.lyricsappjlrf.R;
import com.example.joseramos.lyricsappjlrf.databinding.FragmentTopSongsBinding;
import com.example.joseramos.lyricsappjlrf.domain.models.TrackModel;
import com.example.joseramos.lyricsappjlrf.presentation.adapters.TracksAdapter;
import com.example.joseramos.lyricsappjlrf.presentation.fragments.base.BaseFragment;
import com.example.joseramos.lyricsappjlrf.presentation.navigation.OnBackPressListener;
import com.example.joseramos.lyricsappjlrf.presentation.presenters.TopSongsPresenter;
import com.example.joseramos.lyricsappjlrf.presentation.views.TopSongsView;
import java.util.List;
import javax.inject.Inject;
public class TopSongsFragment extends BaseFragment implements TopSongsView, OnBackPressListener {
public static TopSongsFragment newInstance() {
return new TopSongsFragment();
}
@Inject
TopSongsPresenter presenter;
private TracksAdapter adapter;
private FragmentTopSongsBinding binding;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_top_songs, container, false);
return binding.getRoot();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getFragmentComponent().inject(this);
presenter.setView(this);
presenter.loadTopSongs();
binding.rvTopSongs.setLayoutManager(new LinearLayoutManager(getActivity()));
binding.rvTopSongs.setAdapter(adapter);
}
@Override
public void showLoading() {
}
@Override
public void hideLoading() {
}
@Override
public void onSuccessSongsLoaded(List<? extends TrackModel> trackModels) {
adapter = new TracksAdapter((List<TrackModel>) trackModels);
adapter.setTrackAdapterListener(trackModelTracksAdapterListener);
binding.rvTopSongs.setAdapter(adapter);
}
@Override
public void showError(Throwable throwable) {
throwable.printStackTrace();
Snackbar.make(binding.getRoot(), throwable.getMessage(), Snackbar.LENGTH_SHORT).show();
}
private TracksAdapter.TracksAdapterListener<TrackModel> trackModelTracksAdapterListener = new TracksAdapter.TracksAdapterListener<TrackModel>() {
@Override
public void onItemClick(View view, int position, TrackModel item) {
getNavigator().navigateToSecondLevelActivity(item.getTrackId());
}
};
@Override
public void onBackPressed() {
getActivity().finish();
}
}
| [
"[email protected]"
] | |
7607f7f7de00ed337617a70a55e4881a43aaf604 | b9c3c5478786fb79d5493eab17ff96dfa519e5c0 | /src/test/java/tests/SearchTest.java | 7b0150438a842786d2652a06c81e06e9b318d421 | [] | no_license | mgladchenko/serenity-selenium-10.02.2020 | c235de8055560a30232538365cfb2145c02aa8ee | faba5093dd8033ed19bcee789b5d9d9914cf0aac | refs/heads/master | 2022-07-21T19:58:29.762734 | 2020-11-13T11:05:16 | 2020-11-13T11:05:16 | 240,265,060 | 0 | 0 | null | 2022-06-21T02:59:40 | 2020-02-13T13:19:44 | Java | UTF-8 | Java | false | false | 1,351 | java | package tests;
import net.serenitybdd.junit.runners.SerenityParameterizedRunner;
import net.serenitybdd.junit.runners.SerenityRunner;
import net.thucydides.junit.annotations.TestData;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Arrays;
import java.util.Collection;
@RunWith(SerenityParameterizedRunner.class)
public class SearchTest extends BaseTest {
private String searchTerm;
public SearchTest(String searchTerm) {
this.searchTerm = searchTerm;
}
@TestData
public static Collection<Object[]> testData() {
return Arrays.asList(new Object[][]{
{"hr"},
{"HR"},
{"Human Resources"}
});
}
@Before
public void before() {
user
.auth()
.openLandingPage()
.login("[email protected]", "Test123!");
}
@Test
public void searchBySearchTermTest() {
String[] relevantResults = {"hr", "HR", "Human Resources", "HUMAN RESOURCES"};
user
.validatePageTitle("LinkedIn")
.homePage()
.searchFor(searchTerm);
user
.validatePageTitle("LinkedIn")
.searchPage()
.verifyEachResultContains(searchTerm);
}
}
| [
"[email protected]"
] | |
fb44d9f2d217707ae3c1a3a328c505d9e5f2683c | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/未反混淆/src/main/java/com/tencent/mm/plugin/facedetect/b/b.java | ccf52d151e2249df5e8ee15723cbf052902738ab | [] | no_license | xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072197 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 103 | java | package com.tencent.mm.plugin.facedetect.b;
public interface b {
long bse();
byte[] bsf();
}
| [
"[email protected]"
] | |
4b921ed1a089cdd5779fd60d53f1e968a1b526eb | 43ea91f3ca050380e4c163129e92b771d7bf144a | /services/swr/src/main/java/com/huaweicloud/sdk/swr/v2/model/ShowUserRepositoryAuthRequest.java | 475112c036da1d528dabde943ef6a86087e39344 | [
"Apache-2.0"
] | permissive | wxgsdwl/huaweicloud-sdk-java-v3 | 660602ca08f32dc897d3770995b496a82a1cc72d | ee001d706568fdc7b852792d2e9aefeb9d13fb1e | refs/heads/master | 2023-02-27T14:20:54.774327 | 2021-02-07T11:48:35 | 2021-02-07T11:48:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,691 | java | package com.huaweicloud.sdk.swr.v2.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.function.Consumer;
import java.util.Objects;
/**
* Request Object
*/
public class ShowUserRepositoryAuthRequest {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="namespace")
private String namespace;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="repository")
private String repository;
public ShowUserRepositoryAuthRequest withNamespace(String namespace) {
this.namespace = namespace;
return this;
}
/**
* Get namespace
* @return namespace
*/
public String getNamespace() {
return namespace;
}
public void setNamespace(String namespace) {
this.namespace = namespace;
}
public ShowUserRepositoryAuthRequest withRepository(String repository) {
this.repository = repository;
return this;
}
/**
* Get repository
* @return repository
*/
public String getRepository() {
return repository;
}
public void setRepository(String repository) {
this.repository = repository;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ShowUserRepositoryAuthRequest showUserRepositoryAuthRequest = (ShowUserRepositoryAuthRequest) o;
return Objects.equals(this.namespace, showUserRepositoryAuthRequest.namespace) &&
Objects.equals(this.repository, showUserRepositoryAuthRequest.repository);
}
@Override
public int hashCode() {
return Objects.hash(namespace, repository);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ShowUserRepositoryAuthRequest {\n");
sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n");
sb.append(" repository: ").append(toIndentedString(repository)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
d6d9f96255da1fc187eedcace89a464973bf59d1 | 2190e9036d14f6d6d0d0f253c3aef6a90f327c59 | /src/leetcode/ReverseLinkedListII.java | 7a252fdb91fd02305aceb45b6996f6c3e2cd7c38 | [] | no_license | CurryGaifan/leetcode | 7132b3db21ff523b3cafcbba176191f23b1931a6 | b846c905cfb8ad430f9cd888f3b85b89e8b80370 | refs/heads/master | 2021-10-24T16:36:49.661033 | 2021-10-22T03:17:16 | 2021-10-22T03:17:16 | 28,948,956 | 0 | 1 | null | 2016-12-07T15:29:01 | 2015-01-08T04:34:15 | Java | UTF-8 | Java | false | false | 1,198 | java | package leetcode;
import util.PrintUtil;
import leetcode.struct.ListNode;
/**
* For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,
*
* return 1->4->3->2->5->NULL.
*
* Note: Given m, n satisfy the following condition: 1 ≤ m ≤ n ≤ length of list.
*
* @author yanfeixiang
*
*/
public class ReverseLinkedListII {
public ListNode reverseBetween(ListNode head, int m, int n) {
if (m == n)
return head;
ListNode f = new ListNode(0);
f.next = head;
ListNode c = f;
int i = 0;
for (; i < m - 1; i++) {
c = c.next;
}
ListNode f1 = c;
c = c.next;
ListNode d = c;
ListNode e = d.next;
ListNode g = e.next;
for (; i < n - 1; i++) {
e.next = d;
d = e;
e = g;
if (g == null)
break;
g = g == null ? null : g.next;
}
f1.next = d;
c.next = e;
return f.next;
}
public static void main(String[] args) {
ListNode l1 = new ListNode(1);
ListNode l2 = new ListNode(2);
l1.next = l2;
ListNode l3 = new ListNode(3);
l2.next = l3;
ListNode l4 = new ListNode(4);
l3.next = l4;
ListNode l5 = new ListNode(5);
l4.next = l5;
;
PrintUtil.printListNode(new ReverseLinkedListII().reverseBetween(l1, 2,
5));
}
}
| [
"[email protected]"
] | |
5e0b3910d15db2ac8d0b9a556be178e520e081ba | 80b292849056cb4bf3f8f76f127b06aa376fdaaa | /java/game/tera/gameserver/model/battlefields/BattlefieldList.java | 86b43774d7bf2627573d447c65eeca3901395b5c | [] | no_license | unnamed44/tera_2805 | 70f099c4b29a8e8e19638d9b80015d0f3560b66d | 6c5be9fc79157b44058c816dd8f566b7cf7eea0d | refs/heads/master | 2020-04-28T04:06:36.652737 | 2019-03-11T01:26:47 | 2019-03-11T01:26:47 | 174,964,999 | 2 | 0 | null | 2019-03-11T09:15:36 | 2019-03-11T09:15:35 | null | UTF-8 | Java | false | false | 2,034 | java | package tera.gameserver.model.battlefields;
import rlib.data.DocumentXML;
import rlib.logging.Logger;
import rlib.logging.Loggers;
import tera.Config;
import tera.gameserver.document.DocumentBattlefield;
import tera.gameserver.document.DocumentDungeon;
import tera.gameserver.model.dungeons.DungeonList;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class BattlefieldList {
private static final Logger log = Loggers.getLogger(BattlefieldList.class);
private static List<BattlefieldList> list = new ArrayList<>();
private int battleFieldId;
private int maxLevel;
private int minLevel;
private String name;
public BattlefieldList() {
list.add(this);
}
public static void init() {
DocumentXML<Void> document = new DocumentBattlefield(new File(Config.SERVER_DIR + "/data/battlefields.xml"));
document.parse();
log.info("Battlefield list initialized.");
}
public void setBattleFieldId(int battleFieldId) {
this.battleFieldId = battleFieldId;
}
public void setMinLevel(int minLevel) {
this.minLevel = minLevel;
}
public void setMaxLevel(int maxLevel) {
this.maxLevel = maxLevel;
}
public void setName(String name) {
this.name = name;
}
public int getBattleFieldId() {
return battleFieldId;
}
public int getMinLevel() {
return minLevel;
}
public int getMaxLevel() {
return maxLevel;
}
public String getName() {
return name;
}
public static List<BattlefieldList> getBattlefieldAvailable(int level) {
List<BattlefieldList> battlefields = new ArrayList<>();
for(BattlefieldList battlefield : list) {
if(level >= battlefield.getMinLevel() && level <= battlefield.getMaxLevel())
battlefields.add(battlefield);
}
return battlefields;
}
public static List<BattlefieldList> getBattleFieldList() {
return list;
}
}
| [
"[email protected]"
] | |
aa29aaf988eec0358d9ce73fff871167f399ed95 | 2df8f62b89ab4b777b159acacbec91c9d8aa1aed | /src/com/gktech/usedcars/SearchUsedCars.java | 3b6975adbae50d4787a45e6e3b27c750e8e0c6dc | [] | no_license | vjvjkumar/Day20VJ_WebDriver_TestNG_DataDriven | a548ece1df5c0a237656cc1d73bf8102f2adbd1b | 3e38d4812921a62e444e82689ec7f4c406357c57 | refs/heads/master | 2021-01-10T01:29:38.585894 | 2016-03-10T07:22:09 | 2016-03-10T07:22:09 | 53,527,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java | package com.gktech.usedcars;
import org.testng.SkipException;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.gktech.util.TestUtil;
public class SearchUsedCars extends TestSuiteBase {
static int count =-1;
@BeforeTest
public void checkTestCaseSkip() {
if (!TestUtil.isTestCaseRunnable(usedcarsxls, "SearchUsedCars")){
throw new SkipException("Runmode of testcase SearchUsedCars is set as NO, so skipping SearchUsedCars testcase");
}
runmodes = TestUtil.getTestDataRunmodes(usedcarsxls, "SearchUsedCars");
}
@Test (dataProvider = "getData")
public void searchUsedCars(String uname, String pass){
count ++;
if(!runmodes[count].equalsIgnoreCase("Y")){
throw new SkipException("Runmode of the testdata is set as NO, so skipping the Rownumber :" +(count+1));
}
//Executing the testcase
System.out.println("Executing the testcase SearchUsedCars with parameters :"+uname+" "+pass);
//Webdriver code
}
@DataProvider
public String [][] getData(){
return TestUtil.getTestData(usedcarsxls, "SearchUsedCars");
}
}
| [
"[email protected]"
] | |
db89ee9dbcd871ec9661d9922963dbf4fa33ee6c | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/LANG-35b-2-19-Single_Objective_GGA-WeightedSum-BasicBlockCoverage-opt/org/apache/commons/lang3/time/DateUtils_ESTest_scaffolding.java | 84e8003103d424af65f8fc12f2d2c9c99fde82b7 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,331 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Oct 26 20:43:09 UTC 2021
*/
package org.apache.commons.lang3.time;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import static org.evosuite.shaded.org.mockito.Mockito.*;
@EvoSuiteClassExclude
public class DateUtils_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.lang3.time.DateUtils";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DateUtils_ESTest_scaffolding.class.getClassLoader() ,
"org.apache.commons.lang3.time.DateUtils$DateIterator",
"org.apache.commons.lang3.time.DateUtils"
);
}
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
mock(Class.forName("java.util.Date", false, DateUtils_ESTest_scaffolding.class.getClassLoader()));
}
}
| [
"[email protected]"
] | |
1aaddaaafaaeb650133d7ce97928be9497ac0e41 | 350142ee977772e537c9e264c729695f107c3b61 | /Java Advanced Sept 2019/Demo Exam 23.10.19/HealthyHeaven/src/healthyHeaven/Vegetable.java | f960859acd9bf561eb73ab313787233919d47301 | [] | no_license | ivanpetkov219/SoftUni | 76d8994348606191b5f20ebc6827d3d1bb57418f | 2a6457c7523ff92ef96601e4c45dd321ef4505ca | refs/heads/master | 2022-07-01T11:02:03.082977 | 2020-08-01T20:58:54 | 2020-08-01T20:58:54 | 241,832,948 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package healthyHeaven;
public class Vegetable {
private String name;
private int calories;
public Vegetable (String name, int calories){
this.name = name;
this.calories = calories;
}
public String getName(){
return this.name;
}
public int getCalories(){
return this.calories;
}
@Override
public String toString(){
return String.format(" - %s have %d calories", this.name, this.calories);
}
}
| [
"[email protected]"
] | |
563a2a49832b823cdd677edd99105cbe2003e273 | 079c10ecfb24901c47fdbf7878ea1c3de9241dd1 | /src/main/java/vectorwing/farmersdelight/integration/crafttweaker/CTToolActionIngredient.java | 1e62fc8671f0f3efc4443490a795b3f5c0f16bad | [
"MIT"
] | permissive | vectorwing/FarmersDelight | e5f101dacebc6211762d484a5e31b12c68ad4a86 | ae3aabf76e9d02b5fed419e470b409ef8bcc072b | refs/heads/1.19 | 2023-09-01T11:33:35.195451 | 2023-08-02T04:23:52 | 2023-08-02T04:23:52 | 278,667,074 | 216 | 210 | MIT | 2023-09-13T12:57:12 | 2020-07-10T15:18:59 | Java | UTF-8 | Java | false | false | 2,267 | java | package vectorwing.farmersdelight.integration.crafttweaker;
import com.blamejared.crafttweaker.api.annotation.ZenRegister;
import com.blamejared.crafttweaker.api.ingredient.IIngredient;
import com.blamejared.crafttweaker.api.item.IItemStack;
import com.blamejared.crafttweaker.api.item.MCItemStackMutable;
import com.blamejared.crafttweaker_annotations.annotations.Document;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.common.ToolAction;
import org.openzen.zencode.java.ZenCodeType;
import vectorwing.farmersdelight.common.crafting.ingredient.ToolActionIngredient;
@Document("mods/FarmersDelight/ToolActionIngredient")
@ZenRegister
@ZenCodeType.Name("mods.farmersdelight.ToolActionIngredient")
public class CTToolActionIngredient implements IIngredient {
public static final String PREFIX = "toolingredient";
private final ToolActionIngredient ingredient;
public CTToolActionIngredient(ToolAction toolAction) {
this(new ToolActionIngredient(toolAction));
}
public CTToolActionIngredient(ToolActionIngredient ingredient) {
this.ingredient = ingredient;
}
@Override
public boolean matches(IItemStack stack, boolean ignoreDamage) {
return ingredient.test(stack.getInternal());
}
@Override
public Ingredient asVanillaIngredient() {
return ingredient;
}
@Override
public String getCommandString() {
return "<" + PREFIX + ":" + ingredient.toolAction.name() + ">";
}
@Override
public IItemStack[] getItems() {
ItemStack[] stacks = ingredient.getItems();
IItemStack[] out = new IItemStack[stacks.length];
for (int i = 0; i < stacks.length; i++) {
out[i] = new MCItemStackMutable(stacks[i]);
}
return out;
}
@ZenCodeType.Expansion("crafttweaker.api.tool.ToolAction")
@ZenRegister
public static class ExpandToolAction {
// Support the syntax:
// <tooltype:axe> as IIngredient
@ZenCodeType.Method
@ZenCodeType.Caster(implicit = true)
public static IIngredient asIIngredient(ToolAction internal) {
return new CTToolActionIngredient(internal);
}
}
}
| [
"[email protected]"
] | |
bde00d335e06b30439b5a4a58a1169d1daa245f6 | 5440d661543ab107379968982c20700e78d2bab0 | /cargo/src/main/java/io/pine/examples/cargo/infrastructure/persistence/VoyageRepository.java | 76b97838794de5bd4aa2a38fa8e30d2f40bebebe | [] | no_license | FrankLiu/pine-examples | 5014520fd1349862a8549b72df4ab75ea79289e2 | 0b490afcc0542f666aad0b3b1c725d7196715cf2 | refs/heads/master | 2021-07-08T22:23:36.475338 | 2019-02-14T11:56:52 | 2019-02-14T11:56:52 | 143,225,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | package io.pine.examples.cargo.infrastructure.persistence;
import io.pine.examples.cargo.domain.model.voyage.Voyage;
import io.pine.examples.cargo.domain.model.voyage.VoyageNumber;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.Optional;
/**
* @author Frank
* @sinace 2018/8/14 0014.
*/
public interface VoyageRepository extends JpaRepository<Voyage, Long> {
Optional<Voyage> findByVoyageNumber(VoyageNumber voyageNumber);
}
| [
"[email protected]"
] | |
bcd73041aabbc66609b7ed5117bcc4ca01bf4707 | 257738f3b37fdab5c44e4491ca832cfc0c1c8eba | /samples/undertow-auth-config-fragment/src/main/java/org/ops4j/pax/web/samples/PropertiesIdentityManager.java | 8fa136d841b2a247b030d133a1f8432230e3d2fb | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Maurice-Betzel/org.ops4j.pax.web-6.0.7.1 | ad7c82564e89cee8b4f170ef27b694a2919c6b59 | 798e72e7a7bd19ca1ca014fbe7b9352b6d2c8a94 | refs/heads/master | 2021-05-07T09:13:06.782838 | 2017-11-04T19:00:04 | 2017-11-04T19:00:18 | 109,521,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,500 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ops4j.pax.web.samples;
import java.security.Principal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import io.undertow.security.idm.Account;
import io.undertow.security.idm.Credential;
import io.undertow.security.idm.IdentityManager;
import io.undertow.security.idm.PasswordCredential;
public class PropertiesIdentityManager implements IdentityManager {
private final Map<String, String> config;
public PropertiesIdentityManager(Map<String, String> config) {
this.config = config;
}
@Override
public Account verify(Account account) {
return null;
}
@Override
public Account verify(Credential credential) {
return null;
}
@Override
public Account verify(String id, Credential credential) {
if (credential instanceof PasswordCredential) {
char[] password = ((PasswordCredential) credential).getPassword();
String userData = config.get(id);
if (userData != null) {
List<String> pieces = Arrays.asList(userData.split(","));
if (pieces.get(0).equals(new String(password))) {
Principal principal = new SimplePrincipal(id);
Set<String> roles = new HashSet<>(pieces.subList(1, pieces.size()));
return new AccountImpl(principal, roles);
}
}
}
return null;
}
static class SimplePrincipal implements Principal {
private final String name;
public SimplePrincipal(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
}
static class AccountImpl implements Account {
private final Principal principal;
private final Set<String> roles;
public AccountImpl(Principal principal, Set<String> roles) {
this.principal = principal;
this.roles = roles;
}
@Override
public Principal getPrincipal() {
return principal;
}
@Override
public Set<String> getRoles() {
return roles;
}
}
}
| [
"[email protected]"
] | |
b1936c4ddd38d8e30a978b5ee3e5a98500c506a0 | d65a39e2cfba2d5356cd91fd7093aa76b7b81426 | /src/main/java/net/marcoreis/ecommerce/controlador/BuscaLivreProdutoBean.java | 20886ff50353056a3ef106d59e21f05189aab3f8 | [] | no_license | masreis/e-commerce | 98785a152554f87e875d80f6da3a3ee4d8256f7e | 4ddad9364f88139a9752c571406c1374f7ae6e42 | refs/heads/master | 2023-05-15T10:44:07.813323 | 2023-05-09T13:53:47 | 2023-05-09T13:53:47 | 13,442,952 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,903 | java | package net.marcoreis.ecommerce.controlador;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.apache.lucene.document.Document;
import net.marcoreis.ecommerce.util.LuceneLazyDataModel;
import net.marcoreis.ecommerce.util.TipoIndice;
import net.marcoreis.ecommerce.util.UtilIndice;
@ManagedBean
@ViewScoped
public class BuscaLivreProdutoBean extends BaseBean {
private static final long serialVersionUID =
-7508553590263034662L;
private String consulta;
private LuceneLazyDataModel docs;
private TipoIndice tipo = TipoIndice.PRODUTO;
private List<String> sugestoesProduto;
public LuceneLazyDataModel getDocs() {
if (this.docs == null)
this.docs = new LuceneLazyDataModel(getConsulta(),
getTipo());
return this.docs;
}
public void setDocs(LuceneLazyDataModel docs) {
this.docs = docs;
}
public void consultar() {
this.docs = new LuceneLazyDataModel(getConsulta(),
getTipo());
}
public void setConsulta(String consulta) {
this.consulta = consulta;
}
public String getConsulta() {
return this.consulta;
}
public BigDecimal getDuracaoBusca() {
Double d = Double
.valueOf(getDocs().getDuracaoBusca() / 1000.0D);
BigDecimal bd =
(new BigDecimal(d.doubleValue())).setScale(4, 2);
return bd;
}
public String getDescricaoFormatada() {
return ((Document) getDocs().getRowData())
.get("produtoDescricao")
.replaceAll("\n", "<br />");
}
public String abrirPaginaBusca() {
return "consultar";
}
public TipoIndice getTipo() {
return this.tipo;
}
public List<String> carregarSugestoesProduto(
String nomeParcial) {
try {
return UtilIndice.getInstancia(getTipo())
.buscaSugestoesProduto(nomeParcial);
} catch (IOException e) {
return new ArrayList<>();
}
}
}
| [
"[email protected]"
] | |
13e8bffe700c30f52897921b6a9a4fc39008a19f | 621830a6e4c67fa589adb6a2f140831633b10f87 | /src/main/java/com/supportportal/app/constant/FileConstant.java | 31f5bd57dfa63ff143f9b755e05c0b86befbb3df | [] | no_license | ishonowo/supportportal.backend | f3171a78aa896f26e4022dd64111231b05d75942 | a79156debf7ecc74a9f3f6b0aa815b47e77f3176 | refs/heads/main | 2023-08-23T21:30:38.670418 | 2021-10-16T13:19:46 | 2021-10-16T13:19:46 | 413,947,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package com.supportportal.app.constant;
public class FileConstant {
public static final String USER_IMAGE_PATH= "/user/image";
public static final String EXTENSION= ".jpg";
public static final String USER_FOLDER= System.getProperty("user.home")+ "/supportportal/user/";
public static final String DIRECTORY_CREATED= "Created directory for: ";
public static final String DEFAULT_USER_IMAGE_PATH= "/user/image/profile/";
public static final String FILE_SAVED_IN_FILE_SYSTEM= "Saved file in file system by name: ";
public static final String FORWARD_SLASH= "/";
public static final String BACK_SLASH = "\\" ;
public static final String TEMP_PROFILE_IMAGE_BASE_URL= "https://robohash.org/";
}
| [
"[email protected]"
] | |
77c8744fe1dc2c07d28273c7152418c5d5fa4397 | e0a6f842e352ce6662f93370867720ba761d95fb | /src/main/java/com/ansorgit/smarter/smartSplit/JavascriptSplitHandler.java | e760a11f0fba054a297cc5860df7f4b29f4005bf | [
"Apache-2.0"
] | permissive | jansorg/SmarterEditor | f37ae2344aa20251ef363ce5fd0c5411d2e155d3 | 52e04f41e21f4186eec22667584456d8a2931b61 | refs/heads/master | 2021-01-20T18:27:24.867587 | 2018-12-17T14:04:23 | 2018-12-17T14:04:23 | 61,833,335 | 10 | 4 | Apache-2.0 | 2018-12-17T14:04:24 | 2016-06-23T20:05:40 | Java | UTF-8 | Java | false | false | 2,110 | java | /*
* Copyright 2010 Joachim Ansorg, [email protected]
* File: JavascriptSplitHandler.java, Class: JavascriptSplitHandler
* Last modified: 2010-03-28
*
* 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.ansorgit.smarter.smartSplit;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
/**
* Split handler for the Javascript language.
* <p/>
* User: jansorg
* Date: Mar 28, 2010
* Time: 2:19:55 PM
*/
public class JavascriptSplitHandler implements LanguageSplitHandler {
public boolean supportsElement(@NotNull PsiElement element) {
return isDoubleQuoted(element) || isSingleQuoted(element);
}
public String getConcatOperator(@NotNull PsiElement element) {
return "+";
}
public String getStringStart(@NotNull PsiElement element) {
boolean isDoubleQuote = isDoubleQuoted(element);
return isDoubleQuote ? "\"" : "\'";
}
public String getStringEnd(@NotNull PsiElement element) {
return getStringStart(element);
}
@Override
public String getDummyPlaceholder(@NotNull PsiElement element) {
return getStringStart(element) + getStringEnd(element);
}
private boolean isDoubleQuoted(PsiElement element) {
return "PsiElement(JS:STRING_LITERAL)".equals(element.toString()) && !isSingleQuoted(element);
}
private boolean isSingleQuoted(PsiElement element) {
return "PsiElement(JS:STRING_LITERAL)".equals(element.toString())
&& element.getText().startsWith("\'")
&& element.getText().endsWith("\'");
}
}
| [
"j5k8g8t3"
] | j5k8g8t3 |
338daef5ffd16bc9af31b26cef523b521ab9e47b | dc77398ad36fbe58e773c1d33434662bda5af83d | /scripts/fc/missions/fcmining/tasks/mining/BankOre.java | cbbd2749972d3aa8f9765dd0c6e291e732e47288 | [] | no_license | fmorris2/fc-mining | 0039d8b6ee0e373a09895b1a0f190b80f0196d3a | f2f028c261b3c965aee9f0d39044590914b2a6c9 | refs/heads/master | 2021-09-12T06:56:03.919339 | 2018-04-15T04:12:38 | 2018-04-15T04:12:38 | 95,237,733 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,274 | java | package scripts.fc.missions.fcmining.tasks.mining;
import org.tribot.api.Timing;
import org.tribot.api2007.Banking;
import org.tribot.api2007.Inventory;
import scripts.fc.api.generic.FCConditions;
import scripts.fc.api.skills.mining.MiningUtils;
import scripts.fc.api.skills.mining.data.Pickaxe;
import scripts.fc.framework.task.Task;
import scripts.fc.missions.fcmining.FCMining;
public class BankOre extends Task
{
private static final long serialVersionUID = 2219431375840259810L;
private FCMining script;
public BankOre(FCMining script)
{
this.script = script;
}
@Override
public boolean execute()
{
if(script.location.isInBank())
{
final int INV_SPACE = Inventory.getAll().length;
if(script.location.isBankScreenOpen())
{
Pickaxe bestUsable = MiningUtils.getBestUsablePick(false);
if(Banking.depositAllExcept(bestUsable == null ? Pickaxe.getPickIds() : new int[]{bestUsable.getItemId()}) > 0)
Timing.waitCondition(FCConditions.inventoryChanged(INV_SPACE), 3000);
}
else
script.location.openBank();
}
else
script.location.goToBank();
return false;
}
@Override
public boolean shouldExecute()
{
return Inventory.isFull();
}
@Override
public String getStatus()
{
return "Bank ore";
}
}
| [
"[email protected]"
] | |
20ccbd02b1df7b5f7d73754f1293611da994aef6 | a643ba2b09cacf9ae16c1e0d12e75af4ba230217 | /lambda-behave/src/main/java/com/insightfullogic/lambdabehave/impl/CompleteBehaviour.java | 7257313e4ecb6edc011b439bb2dadcc82c051019 | [
"MIT"
] | permissive | bbejeck/lambda-behave | 22ede726a4cb1d4586a127f5b0151d7c6f62993a | 94d195e5d6d866c4c90695e5443e197117b2e28f | refs/heads/master | 2021-01-21T16:38:32.012327 | 2014-08-13T22:14:24 | 2014-08-13T22:14:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package com.insightfullogic.lambdabehave.impl;
import com.insightfullogic.lambdabehave.impl.reports.SpecificationReport;
public interface CompleteBehaviour {
SpecificationReport checkCompleteBehaviour();
String getDescription();
String getSuiteName();
}
| [
"[email protected]"
] | |
c8d5218023a9f7dc9e41190962671a221a895119 | 4f9f8836e5bafeeb821961f41c0246a52ccbc601 | /app/src/main/java/androidx/annotation/IdRes.java | 498a1d35a3c596064b194a8b01ee81a60f6c7422 | [] | no_license | pyp163/BlueTooth | aeb7fd186b6d25baf4306dce9057b073402b991c | 740e2ad00e3099d1297eee22c31570a8afc99f88 | refs/heads/master | 2021-01-09T12:03:25.376757 | 2020-02-22T06:58:49 | 2020-02-22T06:58:49 | 242,290,730 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package androidx.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.LOCAL_VARIABLE})
public @interface IdRes
{
} | [
"[email protected]"
] | |
7d45f56ba43bc717a3dadc8ba4d92e0101ebcfe7 | 13dd039a95e2a77f03b1b8f22351647589b5e29b | /athena-core/src/test/java/me/ele/jarch/athena/scheduler/AutoKillerTest.java | 4f54b14f43d6b61085e36b76d81bdb1a89b5c100 | [
"Apache-2.0"
] | permissive | athena-proxy/athena | 0b63997f2ba0408a662bcd86f74fabddc728dd5e | 17837fa2c257a55374232917bc9ea10c4888ffa6 | refs/heads/develop | 2022-09-27T18:25:29.604094 | 2020-03-30T06:38:31 | 2020-03-30T06:38:31 | 226,861,344 | 43 | 26 | Apache-2.0 | 2022-09-16T18:05:56 | 2019-12-09T12:02:55 | Java | UTF-8 | Java | false | false | 1,408 | java | package me.ele.jarch.athena.scheduler;
import me.ele.jarch.athena.constant.Constants;
import me.ele.jarch.athena.util.GreySwitch;
import me.ele.jarch.athena.util.ZKCache;
import org.testng.Assert;
import org.testng.annotations.Test;
public class AutoKillerTest {
@Test public void getSmartAutoKillerSlowSQL() {
ZKCache zkCache = new ZKCache("test");
GreySwitch.getInstance().setSmartAutoKillerOpen(false);
zkCache.setZkCfg(Constants.AK_UPPER_SIZE, "32");
zkCache.setZkCfg(Constants.AK_LOWER_SIZE, "8");
zkCache.setZkCfg(Constants.AK_SLOW_SQL, "1000");
Assert.assertEquals(32, zkCache.getSmartUpperAutoKillerSize());
Assert.assertEquals(8, zkCache.getSmartLowerAutoKillerSize());
Assert.assertEquals(1000, zkCache.getSmartAutoKillerSlowSQL(0));
Assert.assertEquals(1000, zkCache.getSmartAutoKillerSlowSQL(8));
GreySwitch.getInstance().setSmartAutoKillerOpen(true);
Assert.assertEquals(0, zkCache.getSmartUpperAutoKillerSize());
Assert.assertEquals(0, zkCache.getSmartLowerAutoKillerSize());
Assert.assertEquals(Integer.MAX_VALUE, zkCache.getSmartAutoKillerSlowSQL(0));
Assert.assertEquals(1000, zkCache.getSmartAutoKillerSlowSQL(32));
Assert.assertEquals(4000, zkCache.getSmartAutoKillerSlowSQL(8));
Assert.assertEquals(32000, zkCache.getSmartAutoKillerSlowSQL(1));
}
}
| [
"[email protected]"
] | |
aed2550436708d6c02f184d720d18d011a67fde1 | e34abb5f6db804b9869e993e212e2646e512c26b | /app/src/main/java/ph/coreproc/android/devcup/activities/ProposalListActivity.java | 3d724a810b2e87604681fc489fdc7fcee1868501 | [] | no_license | johneris/workers-hub-android-customer | f1c570c9f995d03666d65be5673c6829db23c061 | 48714642cfa473df7d0cd1b49f834757f05bbddb | refs/heads/master | 2021-01-01T17:56:55.634673 | 2015-08-16T07:23:36 | 2015-08-16T07:23:36 | 40,748,240 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,421 | java | package ph.coreproc.android.devcup.activities;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
import butterknife.InjectView;
import ph.coreproc.android.devcup.R;
import ph.coreproc.android.devcup.adapters.RVProposalsAdapter;
import ph.coreproc.android.devcup.models.Proposal;
import ph.coreproc.android.devcup.rest.RestClient;
import ph.coreproc.android.devcup.rest.Session;
import ph.coreproc.android.devcup.rest.models.RequestProposalResponse;
import ph.coreproc.android.devcup.utils.UiUtil;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;
/**
* Created by johneris on 8/16/15.
*/
public class ProposalListActivity extends BaseActivity {
public static final String ARGS_REQUEST_ID = "ARGS_REQUEST_ID";
@InjectView(R.id.rvProposals)
RecyclerView mRvProposals;
List<Proposal> mProposals;
RVProposalsAdapter mProposalsAdapter;
String requestID;
@Override
protected int getLayoutResourceId() {
return R.layout.activity_proposal_list;
}
public static Intent newIntent(Context context, String requestID) {
Intent intent = new Intent(context, ProposalListActivity.class);
intent.putExtra(ARGS_REQUEST_ID, requestID);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getIntent().getExtras();
requestID = bundle.getString(ARGS_REQUEST_ID);
initialize();
}
private void initialize() {
mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
LinearLayoutManager llm = new LinearLayoutManager(mContext);
mProposals = new ArrayList<>();
mRvProposals.setLayoutManager(llm);
mProposalsAdapter = new RVProposalsAdapter(mContext, mProposals, requestID);
mRvProposals.setAdapter(mProposalsAdapter);
getRequestProposals();
}
private void getRequestProposals() {
final ProgressDialog progressDialog = UiUtil.getProgressDialog(mContext, "Please wait...");
progressDialog.show();
RestClient.getAPIService().getRequestProposals(
Session.getInstance().getApiKey(),
requestID,
new Callback<RequestProposalResponse>() {
@Override
public void success(RequestProposalResponse requestProposalResponse, Response response) {
mProposals = requestProposalResponse.proposals;
mProposalsAdapter.changeData(mProposals);
progressDialog.dismiss();
}
@Override
public void failure(RetrofitError error) {
UiUtil.showMessageDialog(getSupportFragmentManager(), error.getMessage());
progressDialog.dismiss();
}
}
);
}
}
| [
"[email protected]"
] | |
e40c6ce1c58c7b17b2ae3f63706ef15725b97d0a | 3b3569e310780fa162bddb260c061c80e1e849a7 | /src/com/brad/latch/level/tile/spawn_tile/SpawnWaterTile.java | eeb85bf427e91c64dab6eea11c4f7964ab6318fd | [] | no_license | bradstevanus1/latch | 677da60a9fe7713d52b207a96943d57c0716844b | 11e713c2868b84626397697d40ab2616245e8944 | refs/heads/master | 2021-06-11T03:45:44.343420 | 2021-04-28T22:01:12 | 2021-04-28T22:01:12 | 169,638,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.brad.latch.level.tile.spawn_tile;
import com.brad.latch.graphics.Screen;
import com.brad.latch.graphics.Sprite;
import com.brad.latch.level.tile.Tile;
public class SpawnWaterTile extends Tile {
public SpawnWaterTile(Sprite sprite) {
super(sprite);
}
public void render(int x, int y, Screen screen) {
screen.renderTile(x << Tile.getTileSizeSqrt(), y << Tile.getTileSizeSqrt(), this);
}
}
| [
"[email protected]"
] | |
1fc9140bd30b51862e82aea92095d6cad10b789e | 471a6511c91a87111aac30d9e1d0cf44812af6a2 | /src/main/java/org/codelibs/fess/screenshot/impl/CommandGenerator.java | 15a5eb31d3b3d37fa0043ae7ea633dd56e2bf456 | [
"Apache-2.0"
] | permissive | beavis28/fess | 1160e8a66de4805ee235d1ce64f409f8247bf737 | 8dbc3e9b77c93fe270ff15210dfe3000cc3c9d8c | refs/heads/master | 2020-12-11T07:39:26.254838 | 2015-10-11T06:51:14 | 2015-10-11T06:51:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,051 | java | /*
* Copyright 2009-2015 the CodeLibs Project and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.codelibs.fess.screenshot.impl;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CommandGenerator extends BaseScreenShotGenerator {
private static final Logger logger = LoggerFactory.getLogger(CommandGenerator.class);
public List<String> commandList;
public long commandTimeout = 10 * 1000;// 10sec
public File baseDir;
private volatile Timer destoryTimer;
@PostConstruct
public void init() {
if (baseDir == null) {
baseDir = new File(application.getRealPath("/"));
}
destoryTimer = new Timer("CommandGeneratorDestoryTimer-" + System.currentTimeMillis(), true);
}
@PreDestroy
public void destroy() {
destoryTimer.cancel();
destoryTimer = null;
}
@Override
public void generate(final String url, final File outputFile) {
if (logger.isDebugEnabled()) {
logger.debug("Generate ScreenShot: " + url);
}
if (outputFile.exists()) {
if (logger.isDebugEnabled()) {
logger.debug("The screenshot file exists: " + outputFile.getAbsolutePath());
}
return;
}
final File parentFile = outputFile.getParentFile();
if (!parentFile.exists()) {
parentFile.mkdirs();
}
if (!parentFile.isDirectory()) {
logger.warn("Not found: " + parentFile.getAbsolutePath());
return;
}
final String outputPath = outputFile.getAbsolutePath();
final List<String> cmdList = new ArrayList<String>();
for (final String value : commandList) {
cmdList.add(value.replace("${url}", url).replace("${outputFile}", outputPath));
}
ProcessBuilder pb = null;
Process p = null;
if (logger.isDebugEnabled()) {
logger.debug("ScreenShot Command: " + cmdList);
}
TimerTask task = null;
try {
pb = new ProcessBuilder(cmdList);
pb.directory(baseDir);
pb.redirectErrorStream(true);
p = pb.start();
task = new ProcessDestroyer(p, cmdList);
try {
destoryTimer.schedule(task, commandTimeout);
String line;
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(p.getInputStream(), Charset.defaultCharset()));
while ((line = br.readLine()) != null) {
if (logger.isDebugEnabled()) {
logger.debug(line);
}
}
} finally {
IOUtils.closeQuietly(br);
}
p.waitFor();
} catch (final Exception e) {
p.destroy();
}
} catch (final Exception e) {
logger.warn("Failed to generate a screenshot of " + url, e);
}
if (task != null) {
task.cancel();
task = null;
}
if (outputFile.isFile() && outputFile.length() == 0) {
logger.warn("ScreenShot File is empty. URL is " + url);
if (outputFile.delete()) {
logger.info("Deleted: " + outputFile.getAbsolutePath());
}
}
if (logger.isDebugEnabled()) {
logger.debug("ScreenShot File: " + outputPath);
}
}
protected static class ProcessDestroyer extends TimerTask {
private final Process p;
private final List<String> commandList;
protected ProcessDestroyer(final Process p, final List<String> commandList) {
this.p = p;
this.commandList = commandList;
}
@Override
public void run() {
logger.warn("CommandGenerator is timed out: " + commandList);
try {
p.destroy();
} catch (final Exception e) {
logger.warn("Failed to stop destroyer.", e);
}
}
}
}
| [
"[email protected]"
] | |
b5a83722e73ee5fd05d69460a4752882a1d2a114 | 5f14a75cb6b80e5c663daa6f7a36001c9c9b778c | /src/cdi.java | 6089ed2c3998e69ad67e5f45b584f9df4f62e93f | [] | no_license | MaTriXy/com.ubercab | 37b6f6d3844e6a63dc4c94f8b6ba6bb4eb0118fb | ccd296d27e0ecf5ccb46147e8ec8fb70d2024b2c | refs/heads/master | 2021-01-22T11:16:39.511861 | 2016-03-19T20:58:25 | 2016-03-19T20:58:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 659 | java | import android.text.Editable;
import android.text.TextWatcher;
import com.paypal.android.sdk.payments.LoginActivity;
public final class cdi
implements TextWatcher
{
public cdi(LoginActivity paramLoginActivity) {}
public final void afterTextChanged(Editable paramEditable)
{
LoginActivity.g(a);
}
public final void beforeTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3) {}
public final void onTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3) {}
}
/* Location:
* Qualified Name: cdi
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
3e40a8294f444ef0874c970ed2b54639f4393875 | 092ae494bfcc018578ebfebdb81da8a41e10e30f | /src/main/java/com/example/yuanzhongxu2019211001001116/HelloServlet.java | adf18035c77317286b5b17cb08687c36e8b20a11 | [] | no_license | yuanzhongxu/2019211001001116yuanzhongxu | b2e7161170285449e8f1f51a492cd9b8a1f5d9d4 | 05063e3eba12e2259d5e55366291a93e224a533b | refs/heads/master | 2023-05-27T09:42:52.440031 | 2021-06-16T13:14:12 | 2021-06-16T13:14:12 | 346,570,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 717 | java | package com.example.yuanzhongxu2019211001001116;
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet(name = "helloServlet", value = "/hello-servlet")
public class HelloServlet extends HttpServlet {
private String message;
public void init() {
message = "Hello World!";
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("text/html");
// Hello
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("<h1>" + message + "</h1>");
out.println("</body></html>");
}
public void destroy() {
}
} | [
"[[email protected]]"
] | |
159196fb0c5e25b4772e9dded153bc63dcf31c7a | dabde5eeaa953142e7f38a1106fbdce99cee4330 | /Spring-Boot-EmployeeAplplication/src/main/java/com/pt/sb/SpringBootEmployeeAplplication/ServletInitializer.java | 3c12b9a4a2c205ac74fa98c4d67a24c1af25b16c | [] | no_license | GullaPrathapReddy/Spring-Boot-EmployeeApplication | 080fca138a32a4d91b5d8062cb087e95318a5a50 | 645f2af17b4a6bdcfd3b935339408c33057393c0 | refs/heads/master | 2020-05-01T09:06:13.996129 | 2019-03-24T09:24:12 | 2019-03-24T09:24:12 | 177,392,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 454 | java | package com.pt.sb.SpringBootEmployeeAplplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringBootEmployeeAplplicationApplication.class);
}
}
| [
"[email protected]"
] | |
c48faedf792e64ac367df4df7fdc8d6e1da58c16 | 6ed6698c21264adcdd9988e40af4aee211cc5804 | /justmall-coupon/src/main/java/com/justmall/coupon/controller/SkuFullReductionController.java | 2efb4e7173389a4fc4d030594f4b51687996acf1 | [
"Apache-2.0"
] | permissive | LazzzzzzyCat/justMall | 8c380389d225cc71a4081a4da4e327cac448773f | 0dcb7633ce6916a3df9ebe1620d7922fc218d2ec | refs/heads/main | 2023-02-06T03:42:54.907238 | 2020-12-27T04:22:20 | 2020-12-27T04:22:20 | 322,875,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,389 | java | package com.justmall.coupon.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.justmall.coupon.entity.SkuFullReductionEntity;
import com.justmall.coupon.service.SkuFullReductionService;
import com.justmall.common.utils.PageUtils;
import com.justmall.common.utils.R;
/**
* 商品满减信息
*
* @author huwj
* @email [email protected]
* @date 2020-12-20 10:50:01
*/
@RestController
@RequestMapping("counpon/skufullreduction")
public class SkuFullReductionController {
@Autowired
private SkuFullReductionService skuFullReductionService;
/**
* 列表
*/
@RequestMapping("/list")
//@RequiresPermissions("counpon:skufullreduction:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = skuFullReductionService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
//@RequiresPermissions("counpon:skufullreduction:info")
public R info(@PathVariable("id") Long id){
SkuFullReductionEntity skuFullReduction = skuFullReductionService.getById(id);
return R.ok().put("skuFullReduction", skuFullReduction);
}
/**
* 保存
*/
@RequestMapping("/save")
//@RequiresPermissions("counpon:skufullreduction:save")
public R save(@RequestBody SkuFullReductionEntity skuFullReduction){
skuFullReductionService.save(skuFullReduction);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
//@RequiresPermissions("counpon:skufullreduction:update")
public R update(@RequestBody SkuFullReductionEntity skuFullReduction){
skuFullReductionService.updateById(skuFullReduction);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
//@RequiresPermissions("counpon:skufullreduction:delete")
public R delete(@RequestBody Long[] ids){
skuFullReductionService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
| [
"[email protected]"
] | |
0b7977c9d1346bb97b35dc9099fa0960aabc7e2c | 5e39de126aac9438a954cab92775044c9aa00d6f | /spring-XML-configuration/src/com/sharma/springdemoOne/MyApp.java | 7911ee6f2bb6b74c7431798c4331913fdce9db85 | [] | no_license | Bi-Mars/SpringCore-MVC-Hibernate-AOP-Security-REST-SpringBoot | 38c26f11c8a4d8c113dfc3b669ec3eff9b44b876 | 3c50f49edb753d34f9c91ddb7eb949a91c422695 | refs/heads/main | 2023-02-01T15:21:04.424831 | 2020-12-18T04:09:43 | 2020-12-18T04:09:43 | 316,010,081 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.sharma.springdemoOne;
public class MyApp {
public static void main(String[] args) {
//Create the object
Coach trackCoach = new TrackCoach();
//use the object
System.out.println(trackCoach.getDailyWorkout());
}
}
| [
"[email protected]"
] | |
ff8e5e5a4a64067da8bf764d8b2e13ab81be8c6f | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /newEvaluatedBugs/Jsoup_5_buggy/mutated/862/Attributes.java | 04bbd8fdfe94f0dab5c6204ea10248a8c1cde9be | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,652 | java | package org.jsoup.nodes;
import org.jsoup.SerializationException;
import org.jsoup.helper.Validate;
import java.io.IOException;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* The attributes of an Element.
* <p>
* Attributes are treated as a map: there can be only one value associated with an attribute key/name.
* </p>
* <p>
* Attribute name and value comparisons are <b>case sensitive</b>. By default for HTML, attribute names are
* normalized to lower-case on parsing. That means you should use lower-case strings when referring to attributes by
* name.
* </p>
*
* @author Jonathan Hedley, [email protected]
*/
public class Attributes implements Iterable<Attribute>, Cloneable {
protected static final String dataPrefix = "data-";
private LinkedHashMap<String, Attribute> attributes = null;
// linked hash map to preserve insertion order.
// null be default as so many elements have no attributes -- saves a good chunk of memory
/**
Get an attribute value by key.
@param key the (case-sensitive) attribute key
@return the attribute value if set; or empty string if not set.
@see #hasKey(String)
*/
public String get(String key) {
Validate.notEmpty(key);
if (attributes == null)
return "";
Attribute attr = attributes.get(key);
return attr != null ? attr.getValue() : "";
}
/**
* Get an attribute's value by case-insensitive key
* @param key the attribute name
* @return the first matching attribute value if set; or empty string if not set.
*/
public String getIgnoreCase(String key) {
Validate.notEmpty(key);
if (attributes == null)
return "";
for (String attrKey : attributes.keySet()) {
if (attrKey.equalsIgnoreCase(key))
return attributes.get(attrKey).getValue();
}
return "";
}
/**
Set a new attribute, or replace an existing one by key.
@param key attribute key
@param value attribute value
*/
public void put(String key, String value) {
Attribute attr = new Attribute(key, value);
put(attr);
}
/**
Set a new boolean attribute, remove attribute if value is false.
@param key attribute key
@param value attribute value
*/
public void put(String key, boolean value) {
if (value)
put(new BooleanAttribute(key));
else
remove(key);
}
/**
Set a new attribute, or replace an existing one by key.
@param attribute attribute
*/
public void put(Attribute attribute) {
Validate.notNull(attribute);
if (attributes == null)
attributes = new LinkedHashMap<String, Attribute>(2);
attributes.put(attribute.getKey(), attribute);
}
/**
Remove an attribute by key. <b>Case sensitive.</b>
@param key attribute key to remove
*/
public void remove(String key) {
Validate.notEmpty(key);
if (attributes == null)
return;
attributes.remove(key);
}
/**
Remove an attribute by key. <b>Case insensitive.</b>
@param key attribute key to remove
*/
public void removeIgnoreCase(String key) {
Validate.notEmpty(key);
if (attributes == null)
return;
for (Iterator<String> it = attributes.keySet().iterator(); it.hasNext(); ) {
String attrKey = it.next();
if (attrKey.equalsIgnoreCase(key))
it.remove();
}
}
/**
Tests if these attributes contain an attribute with this key.
@param key case-sensitive key to check for
@return true if key exists, false otherwise
*/
public boolean hasKey(String key) {
return attributes != null && attributes.containsKey(key);
}
/**
Tests if these attributes contain an attribute with this key.
@param key key to check for
@return true if key exists, false otherwise
*/
public boolean hasKeyIgnoreCase(String key) {
if (attributes == null)
return false;
for (String attrKey : new java.util.LinkedHashMap<java.lang.String, org.jsoup.nodes.Attribute>(attributes.size()).keySet()) {
if (attrKey.equalsIgnoreCase(key))
return true;
}
return false;
}
/**
Get the number of attributes in this set.
@return size
*/
public int size() {
if (attributes == null)
return 0;
return attributes.size();
}
/**
Add all the attributes from the incoming set to this set.
@param incoming attributes to add to these attributes.
*/
public void addAll(Attributes incoming) {
if (incoming.size() == 0)
return;
if (attributes == null)
attributes = new LinkedHashMap<String, Attribute>(incoming.size());
attributes.putAll(incoming.attributes);
}
public Iterator<Attribute> iterator() {
if (attributes == null || attributes.isEmpty()) {
return Collections.<Attribute>emptyList().iterator();
}
return attributes.values().iterator();
}
/**
Get the attributes as a List, for iteration. Do not modify the keys of the attributes via this view, as changes
to keys will not be recognised in the containing set.
@return an view of the attributes as a List.
*/
public List<Attribute> asList() {
if (attributes == null)
return Collections.emptyList();
List<Attribute> list = new ArrayList<Attribute>(attributes.size());
for (Map.Entry<String, Attribute> entry : attributes.entrySet()) {
list.add(entry.getValue());
}
return Collections.unmodifiableList(list);
}
/**
* Retrieves a filtered view of attributes that are HTML5 custom data attributes; that is, attributes with keys
* starting with {@code data-}.
* @return map of custom data attributes.
*/
public Map<String, String> dataset() {
return new Dataset();
}
/**
Get the HTML representation of these attributes.
@return HTML
@throws SerializationException if the HTML representation of the attributes cannot be constructed.
*/
public String html() {
StringBuilder accum = new StringBuilder();
try {
html(accum, (new Document("")).outputSettings()); // output settings a bit funky, but this html() seldom used
} catch (IOException e) { // ought never happen
throw new SerializationException(e);
}
return accum.toString();
}
void html(Appendable accum, Document.OutputSettings out) throws IOException {
if (attributes == null)
return;
for (Map.Entry<String, Attribute> entry : attributes.entrySet()) {
Attribute attribute = entry.getValue();
accum.append(" ");
attribute.html(accum, out);
}
}
@Override
public String toString() {
return html();
}
/**
* Checks if these attributes are equal to another set of attributes, by comparing the two sets
* @param o attributes to compare with
* @return if both sets of attributes have the same content
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Attributes)) return false;
Attributes that = (Attributes) o;
return !(attributes != null ? !attributes.equals(that.attributes) : that.attributes != null);
}
/**
* Calculates the hashcode of these attributes, by iterating all attributes and summing their hashcodes.
* @return calculated hashcode
*/
@Override
public int hashCode() {
return attributes != null ? attributes.hashCode() : 0;
}
@Override
public Attributes clone() {
if (attributes == null)
return new Attributes();
Attributes clone;
try {
clone = (Attributes) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
clone.attributes = new LinkedHashMap<String, Attribute>(attributes.size());
for (Attribute attribute: this)
clone.attributes.put(attribute.getKey(), attribute.clone());
return clone;
}
private class Dataset extends AbstractMap<String, String> {
private Dataset() {
if (attributes == null)
attributes = new LinkedHashMap<String, Attribute>(2);
}
@Override
public Set<Entry<String, String>> entrySet() {
return new EntrySet();
}
@Override
public String put(String key, String value) {
String dataKey = dataKey(key);
String oldValue = hasKey(dataKey) ? attributes.get(dataKey).getValue() : null;
Attribute attr = new Attribute(dataKey, value);
attributes.put(dataKey, attr);
return oldValue;
}
private class EntrySet extends AbstractSet<Map.Entry<String, String>> {
@Override
public Iterator<Map.Entry<String, String>> iterator() {
return new DatasetIterator();
}
@Override
public int size() {
int count = 0;
Iterator iter = new DatasetIterator();
while (iter.hasNext())
count++;
return count;
}
}
private class DatasetIterator implements Iterator<Map.Entry<String, String>> {
private Iterator<Attribute> attrIter = attributes.values().iterator();
private Attribute attr;
public boolean hasNext() {
while (attrIter.hasNext()) {
attr = attrIter.next();
if (attr.isDataAttribute()) return true;
}
return false;
}
public Entry<String, String> next() {
return new Attribute(attr.getKey().substring(dataPrefix.length()), attr.getValue());
}
public void remove() {
attributes.remove(attr.getKey());
}
}
}
private static String dataKey(String key) {
return dataPrefix + key;
}
}
| [
"[email protected]"
] | |
8c1e9b5acdc11a2cdfadebbedeeb695dff86855d | 9b604115f0b1cb7cdf3fc42784ee8c3481a86326 | /src/main/java/com/github/travis/grpc/calculator/client/CalculatorClient.java | bb2dd819005a5c526c0aa285aca10603a45f05f8 | [
"MIT"
] | permissive | travism26/grpc-java-microservice | 0e354f17d1c9d9439900b6e785918e98cf0b4398 | 97a7f6cfb0cffbbf97db05f0b2a899d721b46473 | refs/heads/master | 2023-01-08T09:04:45.474431 | 2020-10-12T01:00:15 | 2020-10-12T01:00:15 | 225,741,765 | 0 | 0 | MIT | 2023-01-01T15:24:00 | 2019-12-04T00:10:12 | JavaScript | UTF-8 | Java | false | false | 5,265 | java | package com.github.travis.grpc.calculator.client;
import com.proto.calculator.*;
import com.proto.greet.GreetServiceGrpc;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.StatusRuntimeException;
import io.grpc.stub.StreamObserver;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class CalculatorClient {
public static void main(String[] args) {
CalculatorClient obj = new CalculatorClient();
obj.run();
}
public void run() {
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 50052)
.usePlaintext()
.build();
// getSumCall(channel);
// getMultiplyCall(channel);
// getPrimeNumberDecompositionCall(channel);
// doClientStreamingCall(channel);
// doClientBiDiStreamingCall(channel);
doErrorCall(channel);
channel.shutdown();
}
private void getSumCall(ManagedChannel channel) {
CalculatorServiceGrpc.CalculatorServiceBlockingStub stub = CalculatorServiceGrpc.newBlockingStub(channel);
SumRequest request = SumRequest.newBuilder()
.setFirstNumber(25)
.setSecondNumber(10)
.build();
SumResponse response = stub.sum(request);
System.out.println(request.getFirstNumber() + " + " + request.getSecondNumber() +
" = " + response.getSumResult());
}
private void getMultiplyCall(ManagedChannel channel) {
CalculatorServiceGrpc.CalculatorServiceBlockingStub stub = CalculatorServiceGrpc.newBlockingStub(channel);
MultiplyRequest multiplyRequest = MultiplyRequest.newBuilder()
.setFirstNumber(25)
.setSecondNumber(11)
.build();
MultiplyResponse multiplyResponse = stub.multiply(multiplyRequest);
System.out.println("Multiply:" + multiplyRequest.getFirstNumber() + " * "
+ multiplyRequest.getSecondNumber() +
" = " + multiplyResponse.getMultiResult());
}
private void getPrimeNumberDecompositionCall(ManagedChannel channel) {
CalculatorServiceGrpc.CalculatorServiceBlockingStub stub = CalculatorServiceGrpc.newBlockingStub(channel);
Integer num = 567890304;
stub.primeNumberDecomposition(PrimeNumberDecompositionRequest.newBuilder()
.setNumber(num)
.build())
.forEachRemaining(primeFactor -> {
System.out.println(primeFactor);
});
}
private void doClientStreamingCall(ManagedChannel channel) {
CalculatorServiceGrpc.CalculatorServiceStub asyncClient = CalculatorServiceGrpc.newStub(channel);
CountDownLatch latch = new CountDownLatch(1);
StreamObserver<ComputeAverageRequest> requestObserver = asyncClient.computeAverage(new StreamObserver<ComputeAverageResponse>() {
@Override
public void onNext(ComputeAverageResponse value) {
System.out.println("Received a message from the server...");
System.out.println("Response:" + value.getAverage());
}
@Override
public void onError(Throwable t) {
// this is if server receives an error...
}
@Override
public void onCompleted() {
// this is when the server is done with my request.
System.out.println("Server done with our request.");
latch.countDown();
}
});
requestObserver.onNext(ComputeAverageRequest.newBuilder()
.setNumber(5)
.build());
requestObserver.onNext(ComputeAverageRequest.newBuilder()
.setNumber(10)
.build());
// 15 / 2 = 7.5
requestObserver.onCompleted();
try {
latch.await(3, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private void doClientBiDiStreamingCall(ManagedChannel channel) {
CalculatorServiceGrpc.CalculatorServiceStub asyncClient = CalculatorServiceGrpc.newStub(channel);
CountDownLatch latch = new CountDownLatch(1);
StreamObserver<FindMaximumRequest> requestObserver = asyncClient.findMaximum(new StreamObserver<FindMaximumResponse>() {
@Override
public void onNext(FindMaximumResponse value) {
// server sends message
System.out.println("Got a new maximum value: " + value.getMaximum());
}
@Override
public void onError(Throwable t) {
// server send error
latch.countDown();
}
@Override
public void onCompleted() {
// server finished sending data
System.out.println("Server Finished sending data");
latch.countDown();
}
});
Arrays.asList(1, 2, 5, 1, 10, 12, 9, 7, 6).forEach(
number -> {
System.out.println("Sending Nunber: " + number);
requestObserver.onNext(FindMaximumRequest.newBuilder()
.setNumber(number)
.build());
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
);
requestObserver.onCompleted();
try {
latch.await(3, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private void doErrorCall(ManagedChannel channel) {
CalculatorServiceGrpc.CalculatorServiceBlockingStub blockingStub = CalculatorServiceGrpc.newBlockingStub(channel);
int number = -1;
try {
blockingStub.squareRoot(SquareRootRequest.newBuilder()
.setNumber(number)
.build());
} catch (StatusRuntimeException e) {
System.out.println("Got an exception for square root!");
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
466554a55464174d97b5daa3d9a0ae189587169f | 3dd35c0681b374ce31dbb255b87df077387405ff | /generated/productmodel/TypekeyPAFullLimitedTortType.java | d1dff093a2fbc08deae4cbd6a1cbad5eef9631a0 | [] | no_license | walisashwini/SBTBackup | 58b635a358e8992339db8f2cc06978326fed1b99 | 4d4de43576ec483bc031f3213389f02a92ad7528 | refs/heads/master | 2023-01-11T09:09:10.205139 | 2020-11-18T12:11:45 | 2020-11-18T12:11:45 | 311,884,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package productmodel;
@gw.lang.SimplePropertyProcessing
@javax.annotation.Generated(comments = "config/resources/productmodel/policylinepatterns/PersonalAutoLine/coveragepatterns/PALiabilityCov.xml", date = "", value = "com.guidewire.pc.productmodel.codegen.ProductModelCodegen")
public interface TypekeyPAFullLimitedTortType extends gw.api.domain.covterm.TypekeyCovTerm<typekey.FullLimitedTort> {
productmodel.PALiabilityCov getCoverage();
productmodel.PALiabilityCov getPALiabilityCov();
} | [
"[email protected]"
] | |
028cd974ec2466bc220c205cd2368846c87e7401 | a493a2e8249380fdcfe9431a4e0413ca49e214f6 | /启动远程服务——本地端/src/androidTest/java/com/probuing/runremote/ApplicationTest.java | 5c53763f05e3edc1c390f8f2705103130e2851e7 | [] | no_license | pobuing/ServiceAidlExervcise | 7439dbac9ac7165142f056911672732cbf87f8f7 | 175f5e6c08b1eda882dbf4630edff040b26f7606 | refs/heads/master | 2021-01-10T06:15:50.797932 | 2015-10-24T07:35:01 | 2015-10-24T07:35:01 | 44,856,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.probuing.runremote;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
0fe94f189c1045504a73a6f2ebcea5246ec440e7 | c3445da9eff3501684f1e22dd8709d01ff414a15 | /LIS/sinosoft-parents/lis-business/src/main/java_schema/com/sinosoft/lis/vschema/LDSysErrLogSet.java | b55edd54ae20534521b3b65fa6854449ef5ce103 | [] | no_license | zhanght86/HSBC20171018 | 954403d25d24854dd426fa9224dfb578567ac212 | c1095c58c0bdfa9d79668db9be4a250dd3f418c5 | refs/heads/master | 2021-05-07T03:30:31.905582 | 2017-11-08T08:54:46 | 2017-11-08T08:54:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,435 | java | /**
* Copyright (c) 2002 sinosoft Co. Ltd.
* All right reserved.
*/
package com.sinosoft.lis.vschema;
import org.apache.log4j.Logger;
import com.sinosoft.lis.schema.LDSysErrLogSchema;
import com.sinosoft.utility.*;
/*
* <p>ClassName: LDSysErrLogSet </p>
* <p>Description: LDSysErrLogSchemaSet类文件 </p>
* <p>Copyright: Copyright (c) 2007</p>
* <p>Company: sinosoft </p>
* @Database: 寿险业务系统未整理模型
*/
public class LDSysErrLogSet extends SchemaSet
{
private static Logger logger = Logger.getLogger(LDSysErrLogSet.class);
// @Method
public boolean add(LDSysErrLogSchema aSchema)
{
return super.add(aSchema);
}
public boolean add(LDSysErrLogSet aSet)
{
return super.add(aSet);
}
public boolean remove(LDSysErrLogSchema aSchema)
{
return super.remove(aSchema);
}
public LDSysErrLogSchema get(int index)
{
LDSysErrLogSchema tSchema = (LDSysErrLogSchema)super.getObj(index);
return tSchema;
}
public boolean set(int index, LDSysErrLogSchema aSchema)
{
return super.set(index,aSchema);
}
public boolean set(LDSysErrLogSet aSet)
{
return super.set(aSet);
}
/**
* 数据打包,按 XML 格式打包,顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpLDSysErrLog描述/A>表字段
* @return: String 返回打包后字符串
**/
public String encode()
{
StringBuffer strReturn = new StringBuffer("");
int n = this.size();
for (int i = 1; i <= n; i++)
{
LDSysErrLogSchema aSchema = this.get(i);
strReturn.append(aSchema.encode());
if( i != n ) strReturn.append(SysConst.RECORDSPLITER);
}
return strReturn.toString();
}
/**
* 数据解包
* @param: str String 打包后字符串
* @return: boolean
**/
public boolean decode( String str )
{
int nBeginPos = 0;
int nEndPos = str.indexOf('^');
this.clear();
while( nEndPos != -1 )
{
LDSysErrLogSchema aSchema = new LDSysErrLogSchema();
if(aSchema.decode(str.substring(nBeginPos, nEndPos)))
{
this.add(aSchema);
nBeginPos = nEndPos + 1;
nEndPos = str.indexOf('^', nEndPos + 1);
}
else
{
// @@错误处理
this.mErrors.copyAllErrors( aSchema.mErrors );
return false;
}
}
LDSysErrLogSchema tSchema = new LDSysErrLogSchema();
if(tSchema.decode(str.substring(nBeginPos)))
{
this.add(tSchema);
return true;
}
else
{
// @@错误处理
this.mErrors.copyAllErrors( tSchema.mErrors );
return false;
}
}
}
| [
"[email protected]"
] | |
a1260a88871586753c4549c6a771cbf4de2d39bc | ccafc80e9ab9ac4e4c97fe1a5d62f4dc53f8f8ab | /java/code/core/src/edu/cmu/ri/createlab/terk/services/DeviceController.java | 34fabc820e070c37da0894671fd243c74234f292 | [] | no_license | CMU-CREATE-Lab/terk | c43c05907b16c053a45d7e9717111606a94bb755 | 1310f911ac24453322270e205150e74774668276 | refs/heads/master | 2016-09-01T03:52:19.304899 | 2015-06-01T20:02:10 | 2015-06-01T20:02:10 | 36,673,359 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package edu.cmu.ri.createlab.terk.services;
/**
* @author Michael Safyan([email protected])
*/
public interface DeviceController
{
/** Reports the number of devices controlled by this controller. */
int getDeviceCount();
} | [
"garthabrindoid@19fe853a-d54f-11de-986c-23549013a0f8"
] | garthabrindoid@19fe853a-d54f-11de-986c-23549013a0f8 |
45967e91b9ef0ab38e99763ef3ca41ac986a11c6 | 7fded14cad00c52c4ef4371f01e08f207cbc52e3 | /app/src/main/java/com/android/elliotmiller/projectapp/adapters/ResultsAdapter.java | 3844ec01115a8aec8a2aad8c10622711ac7e1e73 | [] | no_license | elliotmill/ProjectApp | f81c68e9eee8c38fb4557f6f7e3fcb35a0256132 | 15bd1b51f9963af5a8ecf04392b51e6a01a43ec6 | refs/heads/master | 2021-01-20T06:46:29.369457 | 2017-08-27T15:31:37 | 2017-08-27T15:31:37 | 101,514,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,722 | java | package com.android.elliotmiller.projectapp.adapters;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.elliotmiller.projectapp.R;
import com.android.elliotmiller.projectapp.models.Report;
import java.util.List;
/**
* Created by azeezolaniran on 27/08/2017.
*/
public class ResultsAdapter extends RecyclerView.Adapter<ResultsAdapter.Holder> {
private List<Report> reports;
public ResultsAdapter(List<Report> r) {
super();
this.reports = r;
}
@Override
public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_item, parent, false);
return new Holder(view);
}
@Override
public int getItemCount() {
if (this.reports == null) {
return 0;
}
return this.reports.size();
}
@Override
public void onBindViewHolder(Holder holder, int position) {
Report report = reports.get(position);
holder.tvDate.setText(report.reportDate);
holder.tvAcitivity.setText(report.reportName);
holder.tvMiles.setText(report.reportMiles);
}
public class Holder extends RecyclerView.ViewHolder {
TextView tvAcitivity, tvMiles, tvDate;
public Holder(View itemView) {
super(itemView);
this.tvAcitivity = itemView.findViewById(R.id.tv_activity);
this.tvMiles = itemView.findViewById(R.id.tv_miles);
this.tvDate = itemView.findViewById(R.id.tv_date);
}
}
}
| [
"[email protected]"
] | |
eebf28d67f444bc02badae1fdd2ab27d1313ee2e | acc7d2364822898ed4e057f6b37ccf9cc31e76f6 | /spr-parent/spr-usermanager/src/main/java/cn/threegiants/sprusermanager/comm/config/UserDataSourcesConfig.java | f34680708a8562cd52c17a74c6a391acfef41e6b | [] | no_license | hll809906180/wx-xcx | 79164540d532bc16c3df59706bab492a3038ffa8 | 19e5dd0ac53f804b9a284322604536a8413c59e0 | refs/heads/master | 2020-05-17T09:34:14.102664 | 2019-05-11T02:05:02 | 2019-05-11T02:05:02 | 183,637,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,247 | java | package cn.threegiants.sprusermanager.comm.config;
import cn.threegiants.sprusermanager.comm.util.RSAUtils;
import com.alibaba.druid.pool.DruidDataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
/**
* @description: 用户管理数据源配置
* @author: he.l
* @create: 2019-04-25 16:57
**/
@Configuration
@MapperScan(basePackages = {"cn.threegiants.sprusermanager.business.text.mapper"}, sqlSessionFactoryRef = "userSqlSessionFactory")
public class UserDataSourcesConfig {
private static final String MAPPER_LOCAL = "classpath:mybatis/usermanger/*.xml";
@ConfigurationProperties("spring.datasource.usermanger")
@Primary
@Bean(name = "userDataSource")
public DruidDataSource druidDataSource() {
DruidDataSource druidDataSource = new DruidDataSource();
return druidDataSource ;
}
@Bean(name = "userSqlSessionFactory")
@Primary
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("userDataSource") DruidDataSource dataSource) throws Exception {
dataSource.setPassword(RSAUtils.decrypt(dataSource.getPassword()));
final SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
sessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCAL));
return sessionFactoryBean.getObject();
}
@Bean(name = "userTransactionManager")
@Primary
public DataSourceTransactionManager masterTransactionManager(@Qualifier("userDataSource") DruidDataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}
| [
"[email protected]"
] | |
cef4ea95aa376fa95a4545c545cbb134fcf01d47 | 4b23a0ee7a357d0ddb557c099fe4fb1bb817d1ce | /jwt-client/src/main/java/com/runaccepted/jwt/client/JwtClientApplication.java | e80bfd74b6baace9cb8644009600c17e73ff6e31 | [
"Apache-2.0"
] | permissive | WTlumos/jwt-login | a1983618ec9431b2debf8a7a4e6a960268790ee4 | a3b107157bc2103a418e4f382ea7293f0f6fb0f1 | refs/heads/master | 2022-04-16T03:39:56.666382 | 2020-04-15T05:35:15 | 2020-04-15T05:35:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.runaccepted.jwt.client;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class JwtClientApplication {
public static void main(String[] args) {
SpringApplication.run(JwtClientApplication.class, args);
}
}
| [
"[email protected]"
] | |
58cc422f11a29604d35961bb1e24852b094f2914 | 28d8c493586c0d18635f2519da0ba43e778bcf26 | /Triangle Unit Tests/Triangle Program/src/test/java/edu/depaul/se433/assignment1/IsTriangleTest.java | e912457086f847285fb6e63986a62e5ba2e720f5 | [] | no_license | jamesvalles/Software-Testing | 7423a5289205e04d9f08f8fc80ac4dc6fcc8be7a | fae2e67c573bdc24d9b7b0acc67e201f24d83fbd | refs/heads/master | 2020-06-27T06:19:05.122080 | 2019-07-31T14:04:40 | 2019-07-31T14:04:40 | 199,867,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package edu.depaul.se433.assignment1;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
public class IsTriangleTest {
@Test
public void test() {
assertTrue(true);
}
}
| [
"[email protected]"
] | |
b6b6eef69da6375bac196c0799317a91f231d3b3 | 285222a6bd21486aed600db40407c16fce4e7a83 | /qaoss/src/com/reo/automation/qaoss/interfaces/service/APIService.java | e9cbe1500d5981d3ad2f8dadd355ee8b4d30cddc | [] | no_license | Xuyangting/RedkaleWeb | 7edab0e836a1ee8b330a158b7e1ab8da66ea7cf6 | 30d59ba2b7af6f5594330f660efdd8372ab9644d | refs/heads/master | 2021-01-16T21:33:34.539864 | 2017-08-14T07:09:23 | 2017-08-14T07:09:23 | 100,238,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,716 | 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 com.reo.automation.qaoss.interfaces.service;
import com.reo.automation.qaoss.base.service.BasedTestService;
import com.reo.automation.qaoss.interfaces.entity.APIEntity;
import com.reo.automation.qaoss.interfaces.filter.APIFilter;
import java.util.Map;
import javax.annotation.Resource;
import org.redkale.source.Flipper;
import org.redkale.util.Sheet;
/**
*
* @author timen.xu
*/
public class APIService extends BasedTestService{
@Resource
private ModulesService moduleService;
/**
* 查询所有
* @param flipper
* @param bean
* @return
*/
public Sheet querySheet(Flipper flipper, APIFilter bean) {
Map<Integer, String> moduleMap = moduleService.queryModuleName();
Sheet<APIEntity> sheet = source.querySheet(APIEntity.class, flipper, bean);
for(APIEntity record : sheet.list()) {
record.setModule_name(moduleMap.get(record.getModuleid()));
}
return sheet;
}
/**
* 更新单个
* @param bean
*/
public void update(APIEntity bean) {
source.updateColumns(bean, "api_id", "moduleid", "name", "host", "resource", "method", "submitparams", "headers", "cookies", "encrypt", "owner", "ctime");
}
/**
* 插入单个
* @param bean
*/
public void insert(APIEntity bean) {
source.insert(bean);
}
/**
* 删除单个
* @param bean
*/
public void delete(APIEntity bean){
source.delete(bean);
}
}
| [
"[email protected]"
] | |
13835fc86a9fcc102df6fd5662012b92ccd81690 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_d2070b5a2e5c82fb14c04c13cb90e4754472f4b7/HisReportUtil/13_d2070b5a2e5c82fb14c04c13cb90e4754472f4b7_HisReportUtil_t.java | 1fe5de2c2f17f4f0a04bd1392bd1842112715e2b | [] | 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 | 14,751 | java | /*
* (copyright) 2012 United States Government, as represented by the
* Secretary of Defense. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - 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.
*
* - Neither the name of the U.S. Government 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
* HOLDER 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 gov.niarl.hisAppraiser.integrityReport;
import gov.niarl.his.xsd.JAXBContextIntegrity_Report_Manifest_v1_0String;
import gov.niarl.his.xsd.JAXBContextPCR_DifferenceString;
import gov.niarl.his.xsd.integrity_Report_v1_0.org.trustedcomputinggroup.xml.schema.integrity_Report_v1_0.ReportType;
import gov.niarl.his.xsd.pcr_difference.ObjectFactory;
import gov.niarl.his.xsd.pcr_difference.PCRDifferenceReport;
import gov.niarl.his.xsd.pcr_difference.PCRDifferenceReport.CurrentValue;
import gov.niarl.his.xsd.pcr_difference.PCRDifferenceReport.PreviousCurrent;
import gov.niarl.his.xsd.pcr_difference.PCRDifferenceReport.PreviousValue;
import gov.niarl.hisAppraiser.Constants;
import gov.niarl.hisAppraiser.hibernate.dao.AttestDao;
import gov.niarl.hisAppraiser.hibernate.dao.HisAuditDao;
import gov.niarl.hisAppraiser.hibernate.dao.HisMachineCertDao;
import gov.niarl.hisAppraiser.hibernate.domain.AttestRequest;
import gov.niarl.hisAppraiser.hibernate.domain.AuditLog;
import gov.niarl.hisAppraiser.hibernate.domain.MachineCert;
import gov.niarl.hisAppraiser.hibernate.util.AttestService;
import gov.niarl.hisAppraiser.hibernate.util.HibernateUtilHis;
import gov.niarl.hisAppraiser.util.AlertConfiguration;
import gov.niarl.hisAppraiser.util.Emailer;
import gov.niarl.hisAppraiser.util.HisUtil;
import java.io.ByteArrayInputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.math.BigInteger;
import java.security.cert.X509Certificate;
import java.util.GregorianCalendar;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.datatype.DatatypeFactory;
import org.apache.log4j.Logger;
import org.bouncycastle.openssl.PEMReader;
/**
* This class is used by the HisReportParser and others for utility functions.
* @author syelama
* @version Crossbow
*
*/
public class HisReportUtil {
private static Logger logger = Logger.getLogger(HisReportUtil.class);
static Unmarshaller unmarshallerIntegrity_Report_Manifest_v1_0;
static {
try {
JAXBContext context = JAXBContext.newInstance(JAXBContextIntegrity_Report_Manifest_v1_0String.contextString);
unmarshallerIntegrity_Report_Manifest_v1_0 = context.createUnmarshaller();
// unmarshallerIntegrity_Report_Manifest_v1_0.setValidating(true);
// For org.bouncycastle.openssl.PEMReader
HisUtil.loadBouncyCastleProvider();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* This is a convenience method to un-marshal a report and return the
* top level JAXB element.
* @param xmlReport XML string integrity report.
* @return ReportType top level JAXB element.
*/
public synchronized static ReportType unmarshallReport(String xmlReport) {
try {
return ((JAXBElement<ReportType>) unmarshallerIntegrity_Report_Manifest_v1_0.unmarshal(new ByteArrayInputStream(xmlReport.getBytes()))).getValue();
} catch (JAXBException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
/**
* Convert a PEM formatted certificate in X509 format.
* @param machineCertPEM Machine certificate in PEM/text format.
* @return An X509 certificate object.
*/
public static X509Certificate pemToX509Certificate(String machineCertPEM) {
try {
PEMReader reader = new PEMReader(new StringReader(machineCertPEM.replace("-----BEGIN CERTIFICATE-----", "-----BEGIN CERTIFICATE-----\n").replace("-----END CERTIFICATE-----", "\n-----END CERTIFICATE-----")));
return (X509Certificate) reader.readObject();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
/**
* This function was used to create XML for a difference report when a
* detail link was clicked on the old portal.
* @param auditLogDifferentThanPrevious AuditLog entry from the database.
* @param pcrNumber PCR number for which the difference was requested.
* @return XML string showing differences from the previous report PCR.
*/
public static String getPCRDifferenceReport(AuditLog auditLogDifferentThanPrevious, int pcrNumber) {
try {
ObjectFactory objectFactory = new ObjectFactory();
PCRDifferenceReport differenceReport = objectFactory.createPCRDifferenceReport();
differenceReport.setMachineName(auditLogDifferentThanPrevious.getMachineName());
differenceReport.setPCRNumber(BigInteger.valueOf(pcrNumber));
differenceReport.setPCRDescription(HisReportValidator.getPcrDescription(pcrNumber, false));
CurrentValue currentValue = objectFactory.createPCRDifferenceReportCurrentValue();
HisReportValidator currentValuehisReportValidator = new HisReportValidator(auditLogDifferentThanPrevious.getReport(), null, null, null, null, null);
currentValue.setReportID(currentValuehisReportValidator.getHisReportData().getReportID());
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTime(auditLogDifferentThanPrevious.getTimestamp());
currentValue.setTimestamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar));
currentValue.setValue(currentValuehisReportValidator.getPcrValue(pcrNumber));
AuditLog auditLogPrevious = new HisAuditDao().getPreviousAuditLog(auditLogDifferentThanPrevious.getMachineName(), auditLogDifferentThanPrevious.getId());
PreviousValue previousValue = objectFactory.createPCRDifferenceReportPreviousValue();
// String report = auditLogPrevious.getReport();
if (auditLogPrevious != null)
{
String report = auditLogPrevious.getReport();
HisReportValidator previousValuehisReportValidator = new HisReportValidator(report, null, null, null, null, null);
previousValue.setReportID(previousValuehisReportValidator.getHisReportData().getReportID());
GregorianCalendar gregorianCalendarPrevious = new GregorianCalendar();
gregorianCalendarPrevious.setTime(auditLogPrevious.getTimestamp());
previousValue.setTimestamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendarPrevious));
previousValue.setValue(previousValuehisReportValidator.getPcrValue(pcrNumber));
differenceReport.setCurrentValue(currentValue);
differenceReport.setPreviousValue(previousValue);
PreviousCurrent previousCurrent = objectFactory.createPCRDifferenceReportPreviousCurrent();
previousCurrent.getValue().add(previousValuehisReportValidator.getPcrValue(pcrNumber));
previousCurrent.getValue().add(currentValuehisReportValidator.getPcrValue(pcrNumber));
differenceReport.setPreviousCurrent(previousCurrent);
}
StringWriter stringWriter = new StringWriter();
Marshaller marshaller = JAXBContext.newInstance(JAXBContextPCR_DifferenceString.contextString).createMarshaller();
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "PCR_Difference.xsd");
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(differenceReport, stringWriter);
return stringWriter.toString();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
/**
* This function is used by both the login module and the web services
* to submit an integrity report. It calls alert creation functions and
* email functionality.
* @param sid The SID sent from the client.
* @param reportString The integrity report sent form the client.
* @param nonceInput The nonce provided to the client.
* @param pcrSelectInput The PCR select provided to the client.
* @param machineNameInput The machine name sent from the client.
*/
public static void submitReport(String sid, String reportString, byte[] nonceInput, byte[] pcrSelectInput, String machineNameInput) {
HisMachineCertDao hisMachineCertDao = new HisMachineCertDao();
MachineCert machineCert = null;
X509Certificate machineCertificate = null;
machineCert = hisMachineCertDao.getMachineCert(machineNameInput);
if (machineCert == null) {
logger.error("Machine '" + machineNameInput + "' is not enrolled.");
} else {
machineCertificate = pemToX509Certificate(machineCert.getCertificate());
}
HisAuditDao hisAuditDao = new HisAuditDao();
AuditLog lastAuditLog = hisAuditDao.getLastAuditLog(machineNameInput);
String previousReportString = lastAuditLog == null ? null : lastAuditLog.getReport();
HisReportValidator hisReportValidator = new HisReportValidator(reportString, nonceInput, pcrSelectInput, machineNameInput, machineCertificate, previousReportString);
AuditLog auditLog = new AuditLog();
auditLog.setPcr0(hisReportValidator.getPcrValue(0));
auditLog.setPcr1(hisReportValidator.getPcrValue(1));
auditLog.setPcr2(hisReportValidator.getPcrValue(2));
auditLog.setPcr3(hisReportValidator.getPcrValue(3));
auditLog.setPcr4(hisReportValidator.getPcrValue(4));
auditLog.setPcr5(hisReportValidator.getPcrValue(5));
auditLog.setPcr6(hisReportValidator.getPcrValue(6));
auditLog.setPcr7(hisReportValidator.getPcrValue(7));
auditLog.setPcr8(hisReportValidator.getPcrValue(8));
auditLog.setPcr9(hisReportValidator.getPcrValue(9));
auditLog.setPcr10(hisReportValidator.getPcrValue(10));
auditLog.setPcr11(hisReportValidator.getPcrValue(11));
auditLog.setPcr12(hisReportValidator.getPcrValue(12));
auditLog.setPcr13(hisReportValidator.getPcrValue(13));
auditLog.setPcr14(hisReportValidator.getPcrValue(14));
auditLog.setPcr15(hisReportValidator.getPcrValue(15));
auditLog.setPcr16(hisReportValidator.getPcrValue(16));
auditLog.setPcr17(hisReportValidator.getPcrValue(17));
auditLog.setPcr18(hisReportValidator.getPcrValue(18));
auditLog.setPcr19(hisReportValidator.getPcrValue(19));
auditLog.setPcr20(hisReportValidator.getPcrValue(20));
auditLog.setPcr21(hisReportValidator.getPcrValue(21));
auditLog.setPcr22(hisReportValidator.getPcrValue(22));
auditLog.setPcr23(hisReportValidator.getPcrValue(23));
auditLog.setSid(sid);
auditLog.setMachineName(machineNameInput);
auditLog.setNonce(HisUtil.hexString(nonceInput));
auditLog.setPcrSelect(HisUtil.hexString(pcrSelectInput));
auditLog.setSignatureVerified(hisReportValidator.isSignatureVerified());
auditLog.setMachine(machineCert);
auditLog.setReport(reportString);
auditLog.setPreviousDifferences(hisReportValidator.getPreviousReportDifferences());
auditLog.setReportErrors(hisReportValidator.getErrors());
hisAuditDao.saveAuditLog(auditLog);
/********************************************************************************************************
* OpenAttestation code:
* Validating host's PCR with table PCR_manifest.
*
*******************************************************************************************************/
AttestDao attestDao = new AttestDao();
HisAuditDao auditLogDao = new HisAuditDao();
AuditLog newAuditLog = auditLogDao.getLastAuditLog(machineNameInput);
AttestRequest latestPolledRequest = attestDao.getLatestPolledRequest(machineNameInput);
if (latestPolledRequest.getId() != null && newAuditLog != null) {
System.out.println("latestPolledRequest" +latestPolledRequest.getId());
latestPolledRequest.setAuditLog(newAuditLog);
latestPolledRequest = AttestService.validatePCRReport(latestPolledRequest, machineNameInput);
attestDao.updateRequest(latestPolledRequest);
System.out.println("------------------------OpenAttestation complete!------------------------------------------");
/****************************************************************************************************/
}
AlertConfiguration alertConfiguration = Constants.ALERT_CONFIGURATION;
boolean createAlert = false;
if (alertConfiguration.getAllAlerts()) {
if (auditLog.getReportErrors() == null || auditLog.getReportErrors().length() < 1) {
//Do nothing
} else {
createAlert = true;
}
}
if (alertConfiguration.getSignatureAlerts() && !auditLog.getSignatureVerified()) {
createAlert = true;
}
for (int i = 0; i < 24; i++) {
if (alertConfiguration.getPcrAlerts(i) && auditLog.getPreviousDifferences().contains(HisReportValidator.DIFFERENCE_SEPARATOR + Integer.toString(i) + HisReportValidator.DIFFERENCE_SEPARATOR)) {
createAlert = true;
break;
}
}
if (createAlert) {
hisAuditDao.createAlert(auditLog);
//Save before attempting to send an email.
HibernateUtilHis.commitTransaction();
//Begin a new transaction if needed further on in the code.
HibernateUtilHis.beginTransaction();
Emailer.sendDefaultAlertEmail();
}
}
}
| [
"[email protected]"
] | |
50cb63a1e5444b7368ac2389fce938696453e984 | 2b8d08f157e5b81f0c7a848c17c00221840b12f6 | /src/main/java/com/razorthink/bigbrain/pythonr2spark/token/TokenizerTest.java | 0cc7b63f9df5c9528071ab007d21274361774634 | [] | no_license | bphani/parser | 87514656c02e37d6bd070ae354c2e8048795b1ad | 7dd007501e9347d004fca2faaf9dfb9fa85ede1e | refs/heads/master | 2021-01-21T10:25:40.606948 | 2017-03-01T16:19:04 | 2017-03-01T16:19:04 | 83,422,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.razorthink.bigbrain.pythonr2spark.token;
/**
* Created by phaneendra on 2/25/17.
*/
public class TokenizerTest {
public static void main(String[] args) {
String code = "x=2*3+5";
Tokenizer tokenizer = new Tokenizer(code);
while (tokenizer.hasNextToken()) {
Token t = tokenizer.nextToken();
System.out.println(t.getType() + " " + t.getToken());
}
}
}
| [
"[email protected]"
] | |
7c84c1e928b8a5dcc0682d934ec1427c1104117b | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/32/32_911245792dbd218f6b5dd6c3d13394aa32a54a80/PreValidateEvent/32_911245792dbd218f6b5dd6c3d13394aa32a54a80_PreValidateEvent_t.java | 52585c0cef0e12cca6db2a2ddb8635d9aa133d95 | [] | 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,256 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.faces.event;
import javax.faces.component.UIComponent;
/**
*
* <p class="changed_added_2_0 changed_added_2_1">When an instance of
* this event is passed to {@link SystemEventListener#processEvent} or
* {@link ComponentSystemEventListener#processEvent}, the listener
* implementation may assume that the <code>source</code> of this event
* instance is the {@link UIComponent} instance that is about to be
* validated.</p>
* <p class="changed_added_2_1">Note that iterating components such as
* <code>UIData</code>, and form components such as <code>UIForm</code>
* must publish this event before processing their children nodes in
* {@link UIComponent#processValidators}.</p>
*
* @since 2.0
*/
public class PreValidateEvent extends ComponentSystemEvent {
// ------------------------------------------------------------ Constructors
/**
* <p class="changed_added_2_0"></p>
* @param component the <code>UIComponent</code> that is about to be
* validated.
* @throws <code>IllegalArgumentException</code> if the argument is <code>null</code>.
*/
public PreValidateEvent(UIComponent component) {
super(component);
}
}
| [
"[email protected]"
] | |
2ccc8e33eb27e8af030ea45ed1053cfba780aa6c | 7982ffada85b7b5134b3df32ef84fe5ddf6842c0 | /mapper/src/main/java/mapper/MapperInterface.java | d6b6c930f5ec68e32c6366d2f2edc7cb13dc6a23 | [] | no_license | andrestraspuesto/mapper | 4d2e7f7074c61a5d4c50480eb30c68414399a0ab | 0eb554750192cf3ecbf2e0e2ff34aa9114eab2a5 | refs/heads/master | 2020-04-10T04:00:19.213161 | 2016-09-28T21:21:24 | 2016-09-28T21:21:24 | 68,039,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package mapper;
import mapper.exceptions.MappingException;
/**
* Las clasess que implementan esta interfaz
* devuelven objetos de la clase indicada
* construidos a partir de la instancia que se pasa como
* parametro, mapeando los campos que aparecen en ambas clases
* que se llamen igual
*
*
* @author atraspuesto
*
*/
public interface MapperInterface {
/**
* Mapea el objeto src a otro de la clase dstClass
* @param dstClass clase destino
* @param src objeto origen
* @return
* @throws MappingException
*/
public <R, P> R map(Class<R> dstClass, P src) throws MappingException;
}
| [
"[email protected]"
] | |
ffa3ebb07be7260bbfd645e5aa43384f64c2f7bf | 3dd147b7497d1336bdd8296cb113c4fbd92a8b76 | /LibManagment/src/NewBook.java | ac685ea906b664b79b0f612510c95eb5f1045d6e | [] | no_license | Aditya664/library_management_system_javaSwing | 3d9fc6c4e19512a06439fabe5269134d4cd7c97f | 6f16f8b549465b8c23761263e8fe20eb6a693ec0 | refs/heads/master | 2023-09-05T15:43:02.080564 | 2021-10-19T12:12:10 | 2021-10-19T12:12:10 | 418,902,511 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,769 | java | import java.sql.*;
import Project.ConnectionProvider;
import javax.swing.JOptionPane;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
/**
*
* @author Aditya
*/
public class NewBook extends javax.swing.JFrame {
/**
* Creates new form NewBook
*/
public NewBook() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton2 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
BId = new javax.swing.JTextField();
Bname = new javax.swing.JTextField();
Publisher = new javax.swing.JTextField();
Price = new javax.swing.JTextField();
PYear = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
jButton2.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jButton2.setIcon(new javax.swing.ImageIcon("E:\\NetBeans Practice\\LibManagment\\src\\Images\\Icon 1\\red-x-mark-transparent-background-3.png")); // NOI18N
jButton2.setText("Close");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jLabel1.setText("Book ID");
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 70, -1, -1));
jLabel2.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jLabel2.setText("Name");
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 120, -1, -1));
jLabel3.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jLabel3.setText("Price");
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 170, -1, -1));
jLabel4.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jLabel4.setText("Publisher");
getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 220, -1, -1));
jLabel5.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jLabel5.setText("Publisher Year");
getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 270, -1, -1));
BId.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
BId.setForeground(new java.awt.Color(0, 0, 0));
getContentPane().add(BId, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 70, 200, -1));
Bname.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
Bname.setForeground(new java.awt.Color(0, 0, 0));
getContentPane().add(Bname, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 120, 200, -1));
Publisher.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
Publisher.setForeground(new java.awt.Color(0, 0, 0));
getContentPane().add(Publisher, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 220, 200, -1));
Price.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
Price.setForeground(new java.awt.Color(0, 0, 0));
getContentPane().add(Price, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 170, 200, -1));
PYear.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
PYear.setForeground(new java.awt.Color(0, 0, 0));
getContentPane().add(PYear, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 270, 200, -1));
jButton1.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon("E:\\NetBeans Practice\\LibManagment\\src\\Images\\Icon 1\\save-icon--1.png")); // NOI18N
jButton1.setText("Save");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(187, 326, -1, -1));
jButton3.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jButton3.setIcon(new javax.swing.ImageIcon("E:\\NetBeans Practice\\LibManagment\\src\\Images\\Icon 1\\red-x-mark-transparent-background-3.png")); // NOI18N
jButton3.setText("Close");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(406, 326, -1, -1));
jLabel7.setIcon(new javax.swing.ImageIcon("E:\\NetBeans Practice\\LibManagment\\src\\Images\\Icon 1\\123456.png")); // NOI18N
getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
setVisible(false);
new Home().setVisible(true);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String id = BId.getText();
String name = Bname.getText();
String price = Price.getText();
String publisher = Publisher.getText();
String year = PYear.getText();
try {
Connection con = ConnectionProvider.getCon();
Statement st = con.createStatement();
st.executeUpdate("insert into book values('"+id+"','"+name+"','"+price+"','"+publisher+"','"+year+"')");
JOptionPane.showMessageDialog(null, "Successfully Updated!!!");
setVisible(false);
new NewStud().setVisible(true);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Student id is allready exist!");
setVisible(false);
new NewStud().setVisible(true);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
setVisible(false);
new Home().setVisible(true);
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NewBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewBook.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewBook().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField BId;
private javax.swing.JTextField Bname;
private javax.swing.JTextField PYear;
private javax.swing.JTextField Price;
private javax.swing.JTextField Publisher;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel7;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
0a1c94a7b880001597e43a811e4281655fe6b05f | 7fa49925ed7c8517c65d9f9543621d08309bc2cf | /sources\ca\albertahealthservices\contacttracing\onboarding\WebViewActivity.java | 04a852f31266655b714d2c9622a5c6360e979db5 | [] | no_license | abtt-decompiled/abtracetogether_1.0.0.apk_disassembled | c8717a47f384fb7e8da076e48abe1e4ef8500837 | d81b0ee1490911104ab36056d220be7fe3a19e1c | refs/heads/master | 2022-06-24T02:51:29.783727 | 2020-05-08T21:05:20 | 2020-05-08T21:05:20 | 262,426,826 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,673 | java | package ca.albertahealthservices.contacttracing.onboarding;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.fragment.app.FragmentActivity;
import ca.albertahealthservices.contacttracing.BuildConfig;
import ca.albertahealthservices.contacttracing.R;
import java.util.HashMap;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0012\u0010\u0005\u001a\u00020\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\bH\u0014R\u000e\u0010\u0003\u001a\u00020\u0004XD¢\u0006\u0002\n\u0000¨\u0006\t"}, d2 = {"Lca/albertahealthservices/contacttracing/onboarding/WebViewActivity;", "Landroidx/fragment/app/FragmentActivity;", "()V", "TAG", "", "onCreate", "", "savedInstanceState", "Landroid/os/Bundle;", "app_release"}, k = 1, mv = {1, 1, 16})
/* compiled from: WebViewActivity.kt */
public final class WebViewActivity extends FragmentActivity {
/* access modifiers changed from: private */
public final String TAG = "WebViewActivity";
private HashMap _$_findViewCache;
public void _$_clearFindViewByIdCache() {
HashMap hashMap = this._$_findViewCache;
if (hashMap != null) {
hashMap.clear();
}
}
public View _$_findCachedViewById(int i) {
if (this._$_findViewCache == null) {
this._$_findViewCache = new HashMap();
}
View view = (View) this._$_findViewCache.get(Integer.valueOf(i));
if (view != null) {
return view;
}
View findViewById = findViewById(i);
this._$_findViewCache.put(Integer.valueOf(i), findViewById);
return findViewById;
}
/* access modifiers changed from: protected */
public void onCreate(Bundle bundle) {
String str;
super.onCreate(bundle);
setContentView(R.layout.webview);
WebView webView = (WebView) _$_findCachedViewById(R.id.webview);
String str2 = "webview";
Intrinsics.checkExpressionValueIsNotNull(webView, str2);
webView.setWebViewClient(new WebViewClient());
String str3 = "tv_title";
if (getIntent().getIntExtra("type", 0) == 1) {
AppCompatTextView appCompatTextView = (AppCompatTextView) _$_findCachedViewById(R.id.tv_title);
Intrinsics.checkExpressionValueIsNotNull(appCompatTextView, str3);
appCompatTextView.setText(getString(R.string.faq_webview_title));
str = BuildConfig.FAQ_URL;
} else {
AppCompatTextView appCompatTextView2 = (AppCompatTextView) _$_findCachedViewById(R.id.tv_title);
Intrinsics.checkExpressionValueIsNotNull(appCompatTextView2, str3);
appCompatTextView2.setText(getString(R.string.privacy_policy_webview_title));
str = BuildConfig.PRIVACY_URL;
}
WebView webView2 = (WebView) _$_findCachedViewById(R.id.webview);
Intrinsics.checkExpressionValueIsNotNull(webView2, str2);
WebSettings settings = webView2.getSettings();
String str4 = "webview.settings";
Intrinsics.checkExpressionValueIsNotNull(settings, str4);
settings.setJavaScriptEnabled(true);
WebView webView3 = (WebView) _$_findCachedViewById(R.id.webview);
Intrinsics.checkExpressionValueIsNotNull(webView3, str2);
WebSettings settings2 = webView3.getSettings();
Intrinsics.checkExpressionValueIsNotNull(settings2, str4);
settings2.setLoadWithOverviewMode(true);
((WebView) _$_findCachedViewById(R.id.webview)).loadUrl(str);
WebChromeClient webViewActivity$onCreate$wbc$1 = new WebViewActivity$onCreate$wbc$1(this);
WebView webView4 = (WebView) _$_findCachedViewById(R.id.webview);
Intrinsics.checkExpressionValueIsNotNull(webView4, str2);
webView4.setWebChromeClient(webViewActivity$onCreate$wbc$1);
AppCompatImageView appCompatImageView = (AppCompatImageView) _$_findCachedViewById(R.id.webviewBackButton);
if (appCompatImageView != null) {
appCompatImageView.setOnClickListener(new WebViewActivity$onCreate$$inlined$let$lambda$1(this));
}
}
}
| [
"[email protected]"
] | |
0754979264c71b5594271263f99a9cc293f5bbac | f9e50109c996c32a75aecd681dd1e3303ececfe6 | /app/src/main/java/info/androidhive/bottomsheet/BottomSheetAdapter.java | aca9c2cdcadfa86753b0c01e277f70cf8177fbbd | [] | no_license | Ngweyee/BottomSheet | ed7e29153b7a81ab1571155a25b2b444fa0cb799 | cc63993ae50013a35fcaae4aa56eeeabbe504823 | refs/heads/master | 2021-04-15T06:07:38.107644 | 2018-03-22T09:59:23 | 2018-03-22T09:59:23 | 126,314,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,150 | java | package info.androidhive.bottomsheet;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by MIT on 3/13/2018.
*/
public class BottomSheetAdapter extends RecyclerView.Adapter<BottomSheetAdapter.BottomSheetViewHolder> {
private Context context;
private List<Coupons> couponsList;
public BottomSheetAdapter(Context context, List<Coupons> couponsList) {
this.context = context;
this.couponsList = couponsList;
}
@NonNull
@Override
public BottomSheetViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.coupon_row_item, parent, false);
return new BottomSheetViewHolder(itemView);
}
@Override
public void onBindViewHolder(@NonNull BottomSheetViewHolder holder, int position) {
holder.bind(couponsList.get(position));
}
@Override
public int getItemCount() {
return couponsList.size();
}
public class BottomSheetViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.tv_name)
TextView tvName;
@BindView(R.id.tv_amount)
TextView tvAmount;
@BindView(R.id.tv_description)
TextView tvDescription;
@BindView(R.id.tv_expire)
TextView tvExpire;
@BindView(R.id.btn_get_now)
Button btn_get_it_now;
public BottomSheetViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this,itemView);
}
public void bind(Coupons coupons) {
tvName.setText(coupons.getName());
tvAmount.setText(coupons.getAmount());
tvDescription.setText(coupons.getDescription());
tvExpire.setText(coupons.getExpire());
}
}
}
| [
"[email protected]"
] | |
e489f1ad01f7740210ee9406431eb9bf9b7318f8 | 65298808c641d4e5ebf02b15b87ff653d20479f5 | /kodilla-good-patterns/src/main/java/com/kodilla/good/patterns/challenges/food2Door/OrderRequestRetriever.java | 2e00957ea1b85905a8999a9449fd06285b73acbc | [] | no_license | donnmatteo/Kodilla-course | 4716cb62053b121868d52ebe168ae6975a2f4652 | 2b8cf76e6eb01ea49396c6af4537b02ea8492862 | refs/heads/master | 2020-03-13T04:46:19.861045 | 2018-10-15T06:31:54 | 2018-10-15T06:31:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.kodilla.good.patterns.challenges.food2Door;
public class OrderRequestRetriever {
public OrderRequest retrieve() {
Supplier supplier = new Supplier("ExtraFoodShop");
Product product = new Product("Cucumber", 100);
return new OrderRequest(supplier, product);
}
}
| [
"[email protected]"
] | |
4b045ce3db059380bfe3e6cb22f57c97579b8b7b | 619f7b4d481a61fec55d882b165eda38336eab18 | /.svn/pristine/4b/4b045ce3db059380bfe3e6cb22f57c97579b8b7b.svn-base | 1a8795af47b273da4ba05145c6b6b9ca02a4f7f2 | [] | no_license | yichuan1118/PhotoSync | 5f2fa234f3d94a728d6c8034c4b68d229552b7fd | f6f353ac4cc728d440deffc467ea92636fe3afca | refs/heads/master | 2021-01-17T16:04:12.400147 | 2017-02-23T20:05:35 | 2017-02-23T20:05:35 | 82,966,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,336 | package com.metaisle.profiler.collector.eventdriven;
import java.io.IOException;
import com.metaisle.profiler.collector.EventDrivenCollector;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.telephony.SmsMessage;
public class SMS extends EventDrivenCollector {
private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
private static final String TAG = "SMS";
private IntentFilter mIntentFilter;
private SMSReceiver mSMSReceiver;
public SMS(String filename, Context mContext) throws IOException {
super(filename, mContext);
// TODO Auto-generated constructor stub
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(SMS_RECEIVED);
mSMSReceiver = new SMSReceiver();
}
@Override
protected void _Start() {
// TODO Auto-generated method stub
mContext.registerReceiver(mSMSReceiver, mIntentFilter);
}
@Override
protected void _Stop() {
// TODO Auto-generated method stub
mContext.unregisterReceiver(mSMSReceiver);
}
@Override
public boolean isSupported() {
// TODO Auto-generated method stub
return true;
}
@Override
public Object GetReading() {
// TODO Auto-generated method stub
return null;
}
@Override
protected String GetTAG() {
// TODO Auto-generated method stub
return TAG;
}
@Override
protected String GetExtension() {
// TODO Auto-generated method stub
return "csv";
}
private class SMSReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context arg0, Intent intent) {
// TODO Auto-generated method stub
// ---get the SMS message passed in---
try {
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String str = "";
if (bundle != null) {
// ---retrieve the SMS message received---
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i = 0; i < msgs.length; i++) {
msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
WriteLineWithTime(msgs[i].getTimestampMillis() + ","
+ msgs[i].getOriginatingAddress());
}
}
} catch (Exception ex) {
}
}
}
}
| [
"[email protected]"
] | ||
a2a3c6ecbd87cd9bfceb3d451ec6839e61014699 | 2ebd40e19d5a6dae2fce1fee644811f4c4eaed69 | /bpel-ql/src/main/java/org/apache/ode/ql/tree/nodes/Limit.java | 726aae88f4749d9ffaecae121f554af9e2a200d9 | [
"CDDL-1.0",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | traDE4chor/ode | 365c86eac93274557bb7a63700688f7522b2feeb | dd27e18b03cce8bfed80b575ccc0974df8f143ef | refs/heads/opentoscaimprovements | 2020-04-30T15:14:33.019990 | 2019-03-19T10:32:17 | 2019-03-19T10:32:17 | 176,915,335 | 0 | 0 | Apache-2.0 | 2019-03-21T09:44:31 | 2019-03-21T09:44:28 | null | UTF-8 | Java | false | false | 1,354 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ode.ql.tree.nodes;
public class Limit implements Node {
private static final long serialVersionUID = -2717124113311491484L;
private int number;
/**
* @param number
*/
public Limit(int number) {
super();
this.number = number;
}
/**
* @return the number
*/
public int getNumber() {
return number;
}
/**
* @param number the number to set
*/
public void setNumber(int number) {
this.number = number;
}
}
| [
"[email protected]"
] | |
e4e71c32a1cba7487c0ebd2d55fe4e686c4813c9 | efb608f3ee9259176ab3e5790a67106ecf66e54f | /src/main/java/cn/flaty/pushFrame/FrameHead.java | 50b2e912ac1d672ce2956b73a1ec6f6a8dec1e60 | [] | no_license | fairytalelin/nettyPusherClient | 0e5620fa223f1e506beecd0e9670836be17cacf2 | 9658aa182c13aa78316f47f02419c7663a1e07a9 | refs/heads/master | 2021-01-15T14:41:29.716811 | 2015-01-06T03:45:08 | 2015-01-06T03:45:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package cn.flaty.pushFrame;
public interface FrameHead {
/**
* 用于切包的,包长度所占字节数
* @return
*/
int byteLength();
/**
* 包最大支持的报文长度
* @return
*/
int maxLength();
/**
* 包头部所占字节
* @return
*/
int headLength();
/**
* 包长度转换
* @param b
* @return
*/
int bytesToInt(byte []b);
/**
* 包长度转换
* @param length
* @return
*/
byte[] intToBytes(int length);
}
| [
"[email protected]"
] | |
cb2e5f04b9f09a27a8bd2de49878fe6939487c3a | 01d30a4ddf89d7111c3afa4f9c5dc731005bfd3f | /app/src/main/java/lazyhand/com/main/view/MeFragment.java | 68c19032f1996a3e2b5816d223356b66aca7a7e7 | [] | no_license | tanlooger/android-lazyhand | 760d06f9cc10871c3118035320be9019228537a4 | c3907e8e3ea02bdc657c550142109fd744432cb9 | refs/heads/master | 2020-04-02T08:19:07.215586 | 2018-10-23T04:15:47 | 2018-10-23T04:15:47 | 154,239,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,362 | java | package lazyhand.com.main.view;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import lazyhand.com.main.R;
import lazyhand.com.main.login.LoginActivity;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link } interface
* to handle interaction events.
* Use the {@link MeFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MeFragment 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 SharedPreferences sharedPreferences=null;
TextView meLoginView;
TextView meNickView;
TextView meTweetView;
public MeFragment() {
// 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 MeFragment.
*/
// TODO: Rename and change types and number of parameters
public static MeFragment newInstance(String param1, String param2) {
MeFragment fragment = new MeFragment();
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);
}
sharedPreferences = getActivity().getSharedPreferences("userinfo", Context.MODE_PRIVATE);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_me, container, false);
meNickView = view.findViewById(R.id.platform_user_nick);
meTweetView = view.findViewById(R.id.platform_user_tweet);
meLoginView = view.findViewById(R.id.me_login);
meNickView.setText(sharedPreferences.getString("USER_NICKNAME", "未登录"));
meTweetView.setText(sharedPreferences.getString("USER_TWEET", "未登录,无法远程控制设备"));
return view;
}
public void onMeLoginClick(View view) {
if(sharedPreferences.contains("USER_PASSWORD")){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.apply();
getActivity().runOnUiThread(()->{
meNickView.setText(sharedPreferences.getString("USER_NICKNAME", "未登录"));
meTweetView.setText(sharedPreferences.getString("USER_TWEET", "未登录,无法远程控制设备"));
if(sharedPreferences.contains("USER_PASSWORD")){
meLoginView.setText("退出");
}else {
meLoginView.setText("登录/注册");
}
});
}else {
Intent intent = new Intent(getContext(), LoginActivity.class);
startActivity(intent);
}
}
public void onMeWifiClick(View view) {
Intent intent = new Intent(getContext(), WifiListActivity.class);
startActivity(intent);
}
public void onMeUserinfoClick(View view) {
Intent intent = new Intent(getContext(), UserinfoActivity.class);
startActivity(intent);
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
}
@Override
public void onResume() {//和activity的onResume绑定,Fragment初始化的时候必调用,但切换fragment的hide和visible的时候可能不会调用!
super.onResume();
getActivity().runOnUiThread(()->{
Log.d("tag", "onResume: ");
meNickView.setText(sharedPreferences.getString("USER_NICKNAME", "未登录"));
meTweetView.setText(sharedPreferences.getString("USER_TWEET", "未登录,无法远程控制设备"));
if(sharedPreferences.contains("USER_PASSWORD")){
meLoginView.setText("退出");
}else {
meLoginView.setText("登录/注册");
}
});
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onDetach() {
super.onDetach();
}
}
| [
"[email protected]"
] | |
56374b1a8b02a063b4d9bae370a9d42e77626b84 | 25c4c97ad9251cde8f7767cc9234e2ba6182cce2 | /app/src/main/java/edu/csulb/android/projecthomies/ContactsPageCardActivity.java | 6b8c439a6bb1c43a58eebec4e9360ee207e6d4d4 | [] | no_license | RobKnop/ProjectHomies | 2d6c83258f732669ac6653c2d88e6c311697b3b6 | 3a0ce223fc4b1c5060faaaa6caa050c59f799907 | refs/heads/master | 2021-01-17T16:45:29.429959 | 2015-12-10T08:06:48 | 2015-12-10T08:06:48 | 45,712,215 | 0 | 0 | null | 2015-12-10T07:57:21 | 2015-11-06T22:47:06 | Java | UTF-8 | Java | false | false | 863 | java | package edu.csulb.android.projecthomies;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
// JAVA ACTIVITY FILE FOR CARD_VIEW
public class ContactsPageCardActivity extends Activity {
TextView personName;
TextView personAge;
ImageView personPhoto;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contacts_page_card_view);
personName = (TextView)findViewById(R.id.person_name);
personAge = (TextView)findViewById(R.id.person_company);
personPhoto = (ImageView)findViewById(R.id.person_photo);
personName.setText("Emma Wilson");
personAge.setText("23 years old");
//personPhoto.setImageResource(R.drawable.emma);
}
}
| [
"[email protected]"
] | |
dbb108d85beb3bc214be8c750f7a713f34fa3207 | 4fa1aac6c26640e790c997a16d8ed79e820e0eae | /src/main/java/NetUtil.java | 59d271c9f0f44f58ab8b9a6e512283392e43eb8b | [] | no_license | geneRocket/Chat-room | d602b75d763cc7b83df32e94081f52cb9d6c0734 | c7a3063347fd50d3f3b9c0c2c217d1f601a12c5b | refs/heads/master | 2022-12-17T15:42:07.996153 | 2020-09-28T13:53:34 | 2020-09-28T13:53:34 | 299,316,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,271 | java | import com.alibaba.fastjson.JSON;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.nio.charset.StandardCharsets;
public class NetUtil {
static private final int int_size=4;
public static byte[] read_given_len_bytes(InputStream inputStream, int given_len) throws IOException {
byte[] bytes=new byte[given_len];
int offset=0;
while (given_len>0){
int read_len=inputStream.read(bytes,offset,given_len);
if(read_len==-1){
return null;
}
offset+=read_len;
given_len-=read_len;
}
return bytes;
}
public static ByteBuffer read_given_len_bytes(SocketChannel socketChannel, int given_len) throws IOException {
ByteBuffer bytebuffer=ByteBuffer.allocate(given_len);
while (bytebuffer.hasRemaining()){
int len=socketChannel.read(bytebuffer);
if(len==-1)
return null;
}
bytebuffer.flip();
return bytebuffer;
}
public static int bytes2int(byte[] bytes){
int result = 0;
if(bytes.length == int_size){
int a = (bytes[0] & 0xff) << 24;
int b = (bytes[1] & 0xff) << 16;
int c = (bytes[2] & 0xff) << 8;
int d = (bytes[3] & 0xff);
result = a | b | c | d;
}
return result;
}
public static byte[] read_a_packet(InputStream inputStream) throws IOException {
byte[] int_bytes=read_given_len_bytes(inputStream,int_size);
if(int_bytes==null)
return null;
int len= NetUtil.bytes2int(int_bytes);
return NetUtil.read_given_len_bytes(inputStream,len);
}
public static ByteBuffer read_a_packet(SocketChannel socketChannel) throws IOException {
ByteBuffer int_buffer=read_given_len_bytes(socketChannel,int_size);
if(int_buffer==null)
return null;
int len= NetUtil.bytes2int(int_buffer.array());
return NetUtil.read_given_len_bytes(socketChannel,len);
}
public static ByteBuffer pack_a_packet(byte[] bytes){
ByteBuffer byteBuffer=ByteBuffer.allocate(int_size+bytes.length);
byteBuffer.putInt(bytes.length);
byteBuffer.put(bytes);
byteBuffer.flip();
return byteBuffer;
}
static void send_message(Message message, Socket socket) throws IOException {
message.messageHeader.timestamp=System.currentTimeMillis();
String json = JSON.toJSONString(message);
byte[] json_bytes=json.getBytes(StandardCharsets.UTF_8);
ByteBuffer bytebuffer= NetUtil.pack_a_packet(json_bytes);
socket.getOutputStream().write(bytebuffer.array());
}
static void send_message(Message message, SocketChannel socketChannel) throws IOException {
message.messageHeader.timestamp=System.currentTimeMillis();
String json = JSON.toJSONString(message);
byte[] json_bytes=json.getBytes(StandardCharsets.UTF_8);
ByteBuffer bytebuffer= NetUtil.pack_a_packet(json_bytes);
socketChannel.write(bytebuffer);
}
public static Message receive_message(Socket socket) throws IOException {
InputStream inputStream=socket.getInputStream();
byte[] string_bytes= NetUtil.read_a_packet(inputStream);
if(string_bytes==null)
return null;
return JSON.parseObject(new String(string_bytes, StandardCharsets.UTF_8), Message.class);
}
public static Message receive_message(SocketChannel socketChannel) throws IOException {
ByteBuffer string_byteBuffer= NetUtil.read_a_packet(socketChannel);
if(string_byteBuffer==null){
return null;
}
return JSON.parseObject(new String(string_byteBuffer.array(), StandardCharsets.UTF_8), Message.class);
}
public static void close_socketchannel(SelectionKey key) throws IOException {
SocketChannel socketChannel=(SocketChannel) key.channel();
socketChannel.shutdownOutput();
socketChannel.shutdownInput();
socketChannel.close();
key.cancel();
}
}
| [
"[email protected]"
] | |
0c69400fee461e47f6e4aba758d08bca1e8c14df | 4283c273b101fafa608745ac5fc2eaa17b22adc7 | /001JdbcBasic/src/main/java/com/cg/jdbc/ems/dao/EmployeeDao.java | dd482e1f2734a590deee4fd3d75031692f244800 | [] | no_license | agm221b/001JDBC | 72d142ec66eb2b9e6802640067529e1178f0d084 | bd5861ba7c3dc88eec30e085bc525ffb6addd1fd | refs/heads/master | 2023-08-09T09:04:58.305797 | 2019-09-16T12:34:16 | 2019-09-16T12:34:16 | 207,815,054 | 0 | 0 | null | 2023-07-22T15:56:40 | 2019-09-11T13:07:31 | Java | UTF-8 | Java | false | false | 603 | java | /**
*
*/
package com.cg.jdbc.ems.dao;
import java.math.BigInteger;
import java.util.List;
import com.cg.jdbc.ems.exception.EmployeeException;
import com.cg.jdbc.ems.model.Employee;
/**
* @author rvikash
*
*/
public interface EmployeeDao {
public Employee addEmployee(Employee employee)throws EmployeeException;
public List<Employee> listAllEmployees()throws EmployeeException;
public int updateEmployee(Employee employee)throws EmployeeException;
public int deleteEmployee(BigInteger empId)throws EmployeeException;
public Employee findByEmpId(BigInteger empId)throws EmployeeException;
}
| [
"[email protected]"
] | |
476cbeb997f64594b440442095e3a6f5ce8a1224 | ad841e1af206f9ea3133f1f8b15214dd79027e7a | /app/src/androidTest/java/com/example/lenovo/restrobill/ExampleInstrumentedTest.java | ceb403106ad7f23fc631f6d4a5e9fd700bc77bee | [] | no_license | himanshuthanna/AndroidRestroBill | 55f325c7b1bde55392f262debd4502421439cf04 | d72f0218d619324b04fdc8a70047ed068a31f09f | refs/heads/master | 2021-07-20T10:32:49.836331 | 2017-10-28T13:29:57 | 2017-10-28T13:29:57 | 108,651,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package com.example.lenovo.restrobill;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.lenovo.restrobill", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
84866418d5eff92c0480aeac778833975ed2e651 | b983a8aaee07e69d25838b92adb82ce2aa6b4281 | /src/main/java/ir/aliloc/api/core/models/request/BookIdRequest.java | 8e20a34c45aefe2dcee94057216ddfd5e4e2a182 | [] | no_license | alikarimipour/event | 21af3b68da487914845de1853776143564d1c800 | 7cb26327d6b88f20644df8b3976245ee242bdae7 | refs/heads/main | 2023-03-13T08:23:41.101187 | 2021-03-05T13:12:58 | 2021-03-05T13:12:58 | 344,814,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | /**
* 12/8/2018
* author: [email protected]
*/
package ir.aliloc.api.core.models.request;
import lombok.Data;
@Data
public class BookIdRequest {
private long bookId;
}
| [
"[email protected]"
] | |
26bb01f7f878402ea8c33bed0417908da7bff120 | 5eb61adf04a8bfb51b53845dcc28558e74ce504a | /CollectionDataLoader/backend/src/main/java/eg/com/dataload/model/env/Environments.java | 20535240689ad42ce3ca882a9ee74ad7f6a8bfec | [] | no_license | ahmedelhadidy/data-loader | 8931af8927ec0e1d2de76519981024d9978f503d | ef0a5c84298803e4bb964afa51bf98cef6edb04c | refs/heads/master | 2021-01-24T02:29:27.957093 | 2018-03-21T20:50:58 | 2018-03-21T20:50:58 | 122,849,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package eg.com.dataload.model.env;
import java.util.List;
public class Environments {
List<Env> envs;
public List<Env> getEnvs() {
return envs;
}
public void setEnvs(List<Env> envs) {
this.envs = envs;
}
}
| [
"[email protected]"
] | |
61588df6c16ad9513959dbbe9d4c4d886914fbae | 44dfc6475212998b4711b066fbc0b07e8cb972cb | /mylibrary/src/main/java/com/llvision/glass3/api/test/DeviceInfoActivity.java | d30f4e749224eac6c1d715ed3aeae87a22be2c17 | [] | no_license | qq742571766/AS_CGN_DJ | 8ef5ee7a8c7bb91e6d9d0cc77c6f1a3aa8a5086c | d1e7eb7a12aab56910f194c996a077a786c1cfe1 | refs/heads/master | 2022-12-22T09:16:32.857591 | 2020-09-17T08:09:48 | 2020-09-17T08:09:48 | 296,260,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,972 | java | package com.llvision.glass3.api.test;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.llvision.glass3.library.proxy.SNInfo;
import com.llvision.glass3.platform.ConnectionStatusListener;
import com.llvision.glass3.platform.IGlass3Device;
import com.llvision.glass3.platform.LLVisionGlass3SDK;
import com.llvision.glxss.common.exception.BaseException;
import com.llvision.glxss.common.utils.LogUtil;
import com.llvision.glxss.common.utils.ToastUtils;
import java.io.UnsupportedEncodingException;
import java.util.List;
/**
* 设备信息
*
* @author elena
* @date 2019/11/1.
*/
public class DeviceInfoActivity extends Activity implements View.OnClickListener, ConnectionStatusListener {
private IGlass3Device mIGlass3Device;
private EditText mEditText;
private TextView mTextView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_device);
findViewById(R.id.btn_get_deviceinfo).setOnClickListener(this);
findViewById(R.id.btn_set_deviceinfo).setOnClickListener(this);
mTextView = findViewById(R.id.tv_showinfo);
mEditText = findViewById(R.id.edt_info);
LLVisionGlass3SDK.getInstance().registerConnectionListener(this);
try {
List<IGlass3Device> glass3Devices = LLVisionGlass3SDK.getInstance().getGlass3DeviceList();
if (glass3Devices.size() > 0) {
mIGlass3Device = glass3Devices.get(0);
}
} catch (BaseException e) {
e.printStackTrace();
}
}
@Override
public void onClick(View v) {
if (mIGlass3Device == null) {
LogUtil.e("Glass device object is null.");
return;
}
int id = v.getId();
if (id == R.id.btn_get_deviceinfo) {
try {
byte[] customFields = mIGlass3Device.getCustomFields();
if (customFields != null) {
String s = new String(customFields);
mTextView.setText(s);
}
} catch (BaseException e) {
e.printStackTrace();
}
} else if (id == R.id.btn_set_deviceinfo) {
String s = mEditText.getText().toString();
if (s == null) {
ToastUtils.showShort(DeviceInfoActivity.this, "内容不能为空.");
return;
}
if (s.equals("")) {
ToastUtils.showShort(DeviceInfoActivity.this, "内容不能为空.");
return;
}
try {
byte[] all = new byte[128];
byte[] info = s.getBytes("UTF-8");
int length = s.getBytes("UTF-8").length;
if (length > 128) {
ToastUtils.showShort(DeviceInfoActivity.this, "内容不能超过128字节.");
return;
}
if (length < 128) {
System.arraycopy(info, 0, all, 0, info.length);
}
if (length == 128) {
all = info;
}
mIGlass3Device.writeCustomFields(all);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (BaseException e) {
e.printStackTrace();
}
}
}
@Override
public void onServiceConnected(List<IGlass3Device> glass3Devices) {
}
@Override
public void onServiceDisconnected() {
}
@Override
public void onDeviceConnect(IGlass3Device device) {
}
@Override
public void onDeviceDisconnect(IGlass3Device device) {
}
@Override
public void onError(int code, String msg) {
}
}
| [
"[email protected]"
] | |
10c0f86b94bb4c62a8ba5e363a4269518ccc4589 | af0048b7c1fddba3059ae44cd2f21c22ce185b27 | /springframework/src/main/java/org/springframework/context/SmartLifecycle.java | 2c7afceab892cb00a05304ceca25cc2d59e4e3c2 | [] | no_license | P79N6A/whatever | 4b51658fc536887c870d21b0c198738ed0d1b980 | 6a5356148e5252bdeb940b45d5bbeb003af2f572 | refs/heads/master | 2020-07-02T19:58:14.366752 | 2019-08-10T14:45:17 | 2019-08-10T14:45:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package org.springframework.context;
public interface SmartLifecycle extends Lifecycle, Phased {
int DEFAULT_PHASE = Integer.MAX_VALUE;
default boolean isAutoStartup() {
return true;
}
default void stop(Runnable callback) {
stop();
callback.run();
}
@Override
default int getPhase() {
return DEFAULT_PHASE;
}
}
| [
"[email protected]"
] | |
6f6b09ba95f298badfac158b0f34d9914dbe2ddd | ae4e32f39b5855fcffe3494b99acf140af800c36 | /ATM.java | 756840718a35d42d3ed2fbac14827aa8b2d978f5 | [] | no_license | jordangregson/ATM-java | 1b4c8ef63931b1760d92f4b3fab9034a4502f687 | 8f959d57046828954b9611f5b5d460951ca79d76 | refs/heads/main | 2023-08-25T19:09:43.602185 | 2021-10-12T23:16:01 | 2021-10-12T23:16:01 | 336,601,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,751 | java | import javax.swing.JOptionPane;
public class ATM {
public ATM(){
int savingsAccountBalance = 1000;
int checkingAccountBalance = 2000;
String mainMenu = JOptionPane.showInputDialog(null, "Welcome to your Bank Account\n\nPress:\n0: Exit\n1: Checking Account $" + checkingAccountBalance + "\n2: Savings Account $" + savingsAccountBalance);
if(mainMenu.equals("0")){
System.exit(0);
}
else if(mainMenu.equals("1")){
checkingAccount(checkingAccountBalance, savingsAccountBalance);
}
else if(mainMenu.equals("2")){
savingsAccount(checkingAccountBalance, savingsAccountBalance);
}
}
public void checkingAccount(int checkingAccountBalance, int savingsAccountBalance){
String subMenuChecking = JOptionPane.showInputDialog(null, "Checking Account\n\n0: Exit\n1: View Account Balance\n2: Transfer money to your Savings Account\n3: Deposit money into Checking Account");
if(subMenuChecking.equals("0")){
System.exit(0);
}
else if(subMenuChecking.equals("1")){
JOptionPane.showMessageDialog(null, "Current Balance: " + checkingAccountBalance);
}
else if(subMenuChecking.equals("2")){
String transferMoneyInput = JOptionPane.showInputDialog(null, "How much money would you like to transfer to your Savings Account?");
savingsAccountBalance = savingsAccountBalance + Integer.parseInt(transferMoneyInput);
checkingAccountBalance = checkingAccountBalance - Integer.parseInt(transferMoneyInput);
JOptionPane.showMessageDialog(null, "Savings Account Balance: $" + savingsAccountBalance + "\nChecking Account Balance: $" + checkingAccountBalance);
}
else if(subMenuChecking.equals("3")){
String depositMoneyInput = JOptionPane.showInputDialog(null, "How much money would you like to deposit into your Checking Account?");
checkingAccountBalance = checkingAccountBalance + Integer.parseInt(depositMoneyInput);
JOptionPane.showMessageDialog(null, "Checking Account Balance: " + checkingAccountBalance);
}
}
public void savingsAccount(int checkingAccountBalance, int savingsAccountBalance){
String subMenuChecking = JOptionPane.showInputDialog(null, "Checking Account\n\n0: Exit\n1: View Account Balance\n2: Transfer money to your Savings Account\n3: Deposit money into Checking Account");
if(subMenuChecking.equals("0")){
System.exit(0);
}
else if(subMenuChecking.equals("1")){
JOptionPane.showMessageDialog(null, "Current Balance: " + savingsAccountBalance);
}
else if(subMenuChecking.equals("2")){
String transferMoneyInput = JOptionPane.showInputDialog(null, "How much money would you like to transfer to your Checking Account?");
savingsAccountBalance = savingsAccountBalance - Integer.parseInt(transferMoneyInput);
checkingAccountBalance = checkingAccountBalance + Integer.parseInt(transferMoneyInput);
JOptionPane.showMessageDialog(null, "Checking Account Balance: $" + checkingAccountBalance + "\nSavings Account Balance: $" + savingsAccountBalance);
}
else if(subMenuChecking.equals("3")){
String depositMoneyInput = JOptionPane.showInputDialog(null, "How much money would you like to deposit into your Savings Account?");
savingsAccountBalance = savingsAccountBalance + Integer.parseInt(depositMoneyInput);
JOptionPane.showMessageDialog(null, "Savings Account Balance: " + savingsAccountBalance);
}
}
}
| [
"[email protected]"
] | |
f01ee2387293ca33a830dcf720cfde4072351b90 | 74454345396d6315c2bfe93410476782a15ce6c4 | /FinalAlgotithems/src/main/java/com/java/core/first/CheckConsuctive.java | d05166b3caddcaf7387189d51aab9ef2cc01cb94 | [] | no_license | gangadhargolla13/Datastructures | cabfada868e3e18db3e77de282e511b9678aa342 | 3ef6105eea73b520eda1a4f160894de3dec1200c | refs/heads/master | 2020-03-29T18:23:12.492529 | 2019-01-09T18:04:44 | 2019-01-09T18:04:44 | 150,209,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package com.java.core.first;
public class CheckConsuctive {
public int findMax(int[] a){
int max=Integer.MIN_VALUE;
for(int i=0;i<a.length;i++){
if(max<a[i])
max=a[i];
}
return max;
}
public int findMin(int[] a){
int max=Integer.MIN_VALUE;
for(int i=0;i<a.length;i++){
if(max>a[i])
max=a[i];
}
return max;
}
public boolean isConjus(int[] a){
int max = findMax(a);
int min = findMin(a);
if(a.length!= max-min+1){
return false;
}
for(int i=0;i<a.length;i++)
{
a[i]=a[i]-min+1;
}
for(int i=0;i<a.length;i++){
int x = Math.abs(a[i]);
if(a[x-1]>0)
{
a[x-1]=a[x-1]*-1;
}
else
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
f58687849fd9d2d23af76577bbac6cec241c845d | 3d8fd5c4eab9d09fda6bfbea2bb4a4f7ba8c3c1a | /src/main/java/com/pets/domain/CarerPetType.java | 3d5f07d83af2498c1afaf8804954582e6f33f211 | [] | no_license | abertero/app-pets | b7231129c7e72587bb935c88bd9c195f16822150 | bf9c94d7c60b146eaced7d4c1ce5769e03b8d303 | refs/heads/master | 2021-04-15T09:25:47.766316 | 2018-04-01T04:41:26 | 2018-04-01T04:41:26 | 126,635,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 802 | java | package com.pets.domain;
import com.pets.enums.PetType;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
@Entity
public class CarerPetType extends BaseEntity {
@ManyToOne
private Carer carer;
@Enumerated
private PetType petType;
private String observations;
public Carer getCarer() {
return carer;
}
public void setCarer(Carer carer) {
this.carer = carer;
}
public PetType getPetType() {
return petType;
}
public void setPetType(PetType petType) {
this.petType = petType;
}
public String getObservations() {
return observations;
}
public void setObservations(String observations) {
this.observations = observations;
}
}
| [
"[email protected]"
] | |
3ddab6ea0002e57de63d40ab81bdbe52730ae7f8 | a7267160d848c32bd5134d1d4feabea41c297798 | /workspace/jvm_learn/src/main/java/com/li/classLoader/Test8.java | 44f791c35045a9fbd41b00871e37c65f88fe9eec | [] | no_license | MellowCo/java_demo | 4512c7c8890ecfccee5046db3f51190edc8d34be | 71940fabec00b8e8b6589ffa2ad818edda38ba6b | refs/heads/main | 2022-12-31T15:22:18.351896 | 2020-10-20T07:31:59 | 2020-10-20T07:31:59 | 303,027,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package com.li.classLoader;
/**
* @Description:
* @Author: li
* @Create: 2020-02-12 15:40
*/
public class Test8 {
static {
System.out.println("test8 block");
}
public static void main(String[] args) {
Parent8 parent8;
System.out.println("-----------");
parent8 = new Parent8();
System.out.println("-----------");
System.out.println(parent8.a);
System.out.println("-----------");
System.out.println(Child8.b);
System.out.println("-----------");
//test8 block
// -----------
// parent8 block
// -----------
// 7
// -----------
// child8 block
// 8
// -----------
}
}
class Parent8 {
static int a = 7;
static{
System.out.println("parent8 block");
}
}
class Child8 extends Parent8{
static int b = 8;
static {
System.out.println("child8 block");
}
}
| [
"[email protected]"
] | |
f86dd4b1756368e7c375c44538a5d0de2407115c | c9552a8f3777790bbcdf4283482950b7ab82b691 | /src/main/java/org/nm/redisclient/App.java | 82e7c6bb8b0b574d8f3644c687e859f1a43413f9 | [] | no_license | nagendraprasadm/jedis | 89e9f1d972af228e15f643e219c45018a56e3b19 | 717cb613dc747f60384359da74b78768db686559 | refs/heads/master | 2020-04-14T01:18:35.229435 | 2018-12-30T02:15:31 | 2018-12-30T02:15:31 | 163,557,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package org.nm.redisclient;
import org.nm.redisclient.jedis.pool.JedisConnectionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import redis.clients.jedis.Jedis;
/**
* Hello world!
*
*/
public class App {
private static final Logger logger = LoggerFactory.getLogger(App.class);
public static void main(String[] args) {
AnnotationConfigApplicationContext appContext = new AnnotationConfigApplicationContext();
appContext.scan("org.nm.redisclient");
appContext.refresh();
JedisConnectionService connService = (JedisConnectionService) appContext.getBean("jedisConnectionService");
Jedis jedis = connService.getJedis();
jedis.set("TestKey", "TestValue");
logger.info("Value for String key is - [{}]", jedis.get("TestKey"));
jedis.close();
logger.info("Jedis Pool - [{}]", connService.numIdle());
appContext.close();
}
}
| [
"[email protected]"
] | |
5e5f9a11e860d975b22823d8458269a4d3de0eed | 3ee11d541b8aa14a1ae9089dca7734aca0e82233 | /IntelliJ Project/src/main/java/com/globant/musicstore/service/impl/ClientServiceImpl.java | 3174a096358ac76567d4fdf56e2490ac61c2f212 | [] | no_license | Armastardo/bootcamp-music-store | a33f3a1233de2e17af317fd91c52120c3ebf6a75 | 687cfe855a6b1d02d6258412cb201416b473e398 | refs/heads/main | 2023-08-16T01:25:27.352317 | 2021-09-24T03:32:13 | 2021-09-24T03:32:13 | 404,909,769 | 0 | 0 | null | 2021-09-24T03:32:14 | 2021-09-10T00:36:53 | Java | UTF-8 | Java | false | false | 2,472 | java | package com.globant.musicstore.service.impl;
import com.globant.musicstore.dao.ClientDAO;
import com.globant.musicstore.dao.ClientTypeDAO;
import com.globant.musicstore.dto.ClientDTO;
import com.globant.musicstore.entity.Client;
import com.globant.musicstore.utils.mapper.ClientMapper;
import com.globant.musicstore.service.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ClientServiceImpl implements ClientService {
@Autowired
private ClientDAO clientDAO;
@Autowired
private ClientMapper clientMapper;
@Autowired
private ClientTypeDAO clientTypeDAO;
@Override
public ClientDTO createClient(ClientDTO clientDTO) {
clientDTO.setClientType(1L);
clientDTO.setIsActive(Boolean.TRUE);
clientDTO.setStars(0);
return clientMapper.clientEntityToDTO(clientDAO.save(clientMapper.clientDTOToEntity(clientDTO)));
}
@Override
public ClientDTO getClient(Long id) {
return clientMapper.clientEntityToDTO(clientDAO.getById(id));
}
@Override
public List<ClientDTO> getAllClients() {
return clientMapper.clientEntityListToDTOList(clientDAO.findAll());
}
@Override
public ClientDTO addStars(Long id, Integer stars) {
Client client = clientDAO.getById(id);
client.setStars(client.getStars() + stars);
return clientMapper.clientEntityToDTO(clientDAO.save(client));
}
@Override
public ClientDTO updateClient(ClientDTO clientDTO) {
Client client = clientDAO.getById(clientDTO.getId());
client.setName(clientDTO.getName());
client.setSurname(clientDTO.getSurname());
client.setMail(clientDTO.getMail());
client.setStars(clientDTO.getStars());
client.setClientType(clientTypeDAO.getClientType(clientDTO.getClientType()));
client.setIsActive(clientDTO.getIsActive());
return null;
}
@Override
public ClientDTO deactivateClient(Long id) {
Client client = clientDAO.getById(id);
client.setIsActive(Boolean.FALSE);
return clientMapper.clientEntityToDTO(clientDAO.save(client));
}
@Override
public ClientDTO activateClient(Long id) {
Client client = clientDAO.getById(id);
client.setIsActive(Boolean.TRUE);
return clientMapper.clientEntityToDTO(clientDAO.save(client));
}
}
| [
"[email protected]"
] | |
b26a9372b0c9c85c9cb36b02d68a89ee278a1a69 | 9afc49faf0caf70e50adccf0f1a156fd6c61e6e9 | /planetstarwars-server/src/main/java/br/carloskafka/planetstarwarsserver/utilitario/HttpUtils.java | 5ce84d8c65090e2a4f55bc9cfc8b4281de0dd2c6 | [] | no_license | carloskafka/amedigital-desafio-tecnico | fe46c1cf08853c437c964038aa3315c8134b6e37 | 2dd34362f1a7508c865f2efdcdd650bcd9b2f834 | refs/heads/master | 2020-04-28T22:45:28.160518 | 2019-03-19T16:55:09 | 2019-03-19T16:55:09 | 175,629,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 894 | java | package br.carloskafka.planetstarwarsserver.utilitario;
import java.util.Arrays;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
public class HttpUtils {
public static HttpEntity<String> criarCabecalho() {
HttpHeaders headers = criarCabecalhoJson();
headers.add("user-agent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36");
HttpEntity<String> entity = new HttpEntity<String>("parameters", headers);
return entity;
}
public static HttpHeaders criarCabecalhoJson() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
return headers;
}
public static <T> HttpEntity<T> criar(T objeto) {
return new HttpEntity<>(objeto, criarCabecalhoJson());
}
}
| [
"[email protected]"
] | |
2f1327be35b6e74b6559d358b251b395d688369c | 4652102ea0f77e0caff90b2de076a0023638c950 | /subjects/smtpprocessor/mutants/traditional_mutants/void_handleCommand()/LOI_29/SMTPProcessor.java | 2f090e661113bdf9a511619185ecd124c54c4dd6 | [] | no_license | j-godoy/epa-benchmark | 678716b8f4a7ba31569500a9474ced47ad6e8a8d | e5cc4958cf927366afffe0d8741c86caf14cfceb | refs/heads/master | 2021-07-05T16:14:02.902363 | 2020-06-18T00:51:35 | 2020-06-18T00:51:35 | 154,675,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,228 | java | // This is a mutant program.
// Author : ysma
package com.example.smtp;
import java.util.Date;
public class SMTPProcessor
{
private static com.example.smtp.MockLog log = MockLogFactory.getLog( (com.example.smtp.MockSMTPMessage.class).getName() );
private static com.example.smtp.MockConfigurationManager configurationManager = MockConfigurationManager.getInstance();
private boolean running = true;
private com.example.smtp.MockServerSocket serverSocket;
private com.example.smtp.MockSocket socket;
private java.lang.String clientIp;
private com.example.smtp.MockSMTPMessage message;
private com.example.smtp.MockPrintWriter out;
private com.example.smtp.MockBufferedReader in;
private int lastCommand;
public SMTPProcessor()
{
this.setSocket( new com.example.smtp.MockServerSocket() );
this.lastCommand = NONE;
}
private void setSocket( com.example.smtp.MockServerSocket serverSocket )
{
this.serverSocket = serverSocket;
try {
serverSocket.setSoTimeout( 10 * 1000 );
} catch ( com.example.smtp.MockSocketException se ) {
log.fatal( "Error initializing Socket Timeout in SMTPProcessor" );
}
try {
socket = serverSocket.accept();
socket.setSoTimeout( 10 * 1000 );
out = new com.example.smtp.MockPrintWriter( socket.getOutputStream(), true );
in = new com.example.smtp.MockBufferedReader( new com.example.smtp.MockInputStreamReader( socket.getInputStream() ) );
com.example.smtp.MockInetAddress remoteAddress = socket.getInetAddress();
clientIp = remoteAddress.getHostAddress();
if (log.isInfoEnabled()) {
log.info( remoteAddress.getHostName() + "(" + clientIp + ") socket connected via SMTP." );
}
write( WELCOME_MESSAGE );
message = new com.example.smtp.MockSMTPMessage();
} catch ( com.example.smtp.MockInterruptedIOException iioe ) {
} catch ( java.lang.Throwable e ) {
log.debug( "Disconnecting Exception:", e );
disconnect();
}
}
private void disconnect()
{
log.info( "Disconnecting" );
try {
write( MESSAGE_DISCONNECT );
} catch ( java.lang.Exception e1 ) {
log.debug( "Error sending disconnect message.", e1 );
}
try {
if (socket != null) {
socket.close();
}
} catch ( com.example.smtp.MockIOException ioe ) {
log.debug( "Error disconnecting.", ioe );
}
}
private void run()
{
try {
handleCommand();
} catch ( java.lang.Throwable e ) {
log.debug( "Disconnecting Exception:", e );
disconnect();
}
}
private void shutdown()
{
log.warn( "Shutting down SMTPProcessor." );
running = false;
}
private void checkQuit( java.lang.String command )
{
if (command.equals( COMMAND_QUIT )) {
log.debug( "User has QUIT the session." );
throw new java.lang.RuntimeException();
}
}
public void HELO( java.lang.String argument )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
try {
helo0( argument );
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private void helo0( java.lang.String argument )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
if (!HELO_pre()) {
throw new java.lang.IllegalStateException();
}
enqueueLineToInputStream( COMMAND_HELO + " " + argument );
run();
}
public void NOOP()
throws com.example.smtp.MockSocketException, java.lang.Exception
{
try {
noop0();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private void noop0()
throws com.example.smtp.MockSocketException, java.lang.Exception
{
if (!NOOP_pre()) {
throw new java.lang.IllegalStateException();
}
enqueueLineToInputStream( COMMAND_NOOP );
run();
}
public void RSET()
throws com.example.smtp.MockSocketException, java.lang.Exception
{
try {
rset0();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private void rset0()
throws com.example.smtp.MockSocketException, java.lang.Exception
{
if (!RSET_pre()) {
throw new java.lang.IllegalStateException();
}
enqueueLineToInputStream( COMMAND_RSET );
run();
}
public void MAIL( java.lang.String emailAddress )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
try {
mail0( emailAddress );
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private void mail0( java.lang.String emailAddress )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
if (!MAIL_pre()) {
throw new java.lang.IllegalStateException();
}
enqueueLineToInputStream( COMMAND_MAIL_FROM + " FROM:" + emailAddress );
run();
}
public void RCPT_TO( java.lang.String emailAddress )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
try {
rcptTo0( emailAddress );
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private void rcptTo0( java.lang.String emailAddress )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
if (!RCPT_TO_pre()) {
throw new java.lang.IllegalStateException();
}
enqueueLineToInputStream( COMMAND_RCPT_TO + " TO:" + emailAddress );
run();
}
public void DATA( java.lang.String data )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
try {
data0( data );
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private void data0( java.lang.String data )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
if (!DATA_pre()) {
throw new java.lang.IllegalStateException();
}
enqueueLineToInputStream( COMMAND_DATA );
java.lang.String[] lines = data.split( "\n" );
for (int i = 0; i < lines.length; ++i) {
java.lang.String line = lines[i];
enqueueLineToInputStream( line );
}
enqueueLineToInputStream( "." );
run();
}
private void enqueueLineToInputStream( java.lang.String lineStr )
throws com.example.smtp.MockSocketException, java.lang.Exception
{
if (this.socket.isClosed()) {
throw new com.example.smtp.MockSocketException( "Connection is closed" );
}
in.writeLine( lineStr );
}
public void QUIT()
throws com.example.smtp.MockSocketException, java.lang.Exception
{
try {
quit0();
} catch ( java.lang.Exception ex ) {
throw ex;
}
}
private void quit0()
throws com.example.smtp.MockSocketException, java.lang.Exception
{
if (!QUIT_pre()) {
throw new java.lang.IllegalStateException();
}
enqueueLineToInputStream( COMMAND_QUIT );
run();
}
private boolean HELO_pre()
{
return socket != null && !socket.isClosed();
}
private boolean NOOP_pre()
{
return socket != null && !socket.isClosed();
}
private boolean RSET_pre()
{
return socket != null && !socket.isClosed();
}
private boolean QUIT_pre()
{
return socket != null && !socket.isClosed();
}
private boolean MAIL_pre()
{
return socket != null && !socket.isClosed() && (lastCommand == HELO || lastCommand == NONE || lastCommand == RSET || lastCommand == EHLO);
}
private boolean RCPT_TO_pre()
{
return socket != null && !socket.isClosed() && (lastCommand == MAIL_FROM || lastCommand == RCPT_TO);
}
private boolean DATA_pre()
{
return socket != null && !socket.isClosed() && (lastCommand == RCPT_TO && message.getToAddresses().size() > 0);
}
private void handleCommand()
{
java.lang.String inputString;
java.lang.String command;
java.lang.String argument;
inputString = read();
command = parseCommand( inputString );
argument = parseArgument( inputString );
if (command.equals( COMMAND_HELO )) {
write( "250 Hello " + argument );
lastCommand = HELO;
} else {
if (command.equals( COMMAND_NOOP )) {
write( MESSAGE_OK );
} else {
if (command.equals( COMMAND_RSET )) {
message = new com.example.smtp.MockSMTPMessage();
write( MESSAGE_OK );
lastCommand = RSET;
} else {
if (command.equals( COMMAND_MAIL_FROM ) && inputString.toUpperCase().startsWith( "MAIL FROM:" )) {
if (lastCommand == HELO || lastCommand == NONE || lastCommand == RSET || lastCommand == ~EHLO) {
if (handleMailFrom( inputString )) {
lastCommand = MAIL_FROM;
}
} else {
write( MESSAGE_COMMAND_ORDER_INVALID );
}
} else {
if (command.equals( COMMAND_RCPT_TO ) && inputString.toUpperCase().startsWith( "RCPT TO:" )) {
if (lastCommand == MAIL_FROM || lastCommand == RCPT_TO) {
handleRcptTo( inputString );
lastCommand = RCPT_TO;
} else {
write( MESSAGE_COMMAND_ORDER_INVALID );
}
} else {
if (command.equals( COMMAND_DATA )) {
if (lastCommand == RCPT_TO && message.getToAddresses().size() > 0) {
handleData();
message = new com.example.smtp.MockSMTPMessage();
lastCommand = RSET;
} else {
write( MESSAGE_COMMAND_ORDER_INVALID );
}
} else {
write( MESSAGE_INVALID_COMMAND + command );
}
}
}
}
}
}
}
private boolean handleMailFrom( java.lang.String inputString )
{
java.lang.String fromAddress = parseAddress( inputString.substring( 10 ) );
try {
if (fromAddress == null || fromAddress.trim().equals( "" )) {
message.setFromAddress( new com.example.smtp.MockEmailAddress() );
message.setFromAddress( new com.example.smtp.MockEmailAddress( "[email protected]" ) );
log.debug( "MAIL FROM is empty, using [email protected]" );
} else {
com.example.smtp.MockEmailAddress address = new com.example.smtp.MockEmailAddress( fromAddress );
message.setFromAddress( address );
if (log.isDebugEnabled()) {
log.debug( "MAIL FROM: " + fromAddress );
}
}
write( MESSAGE_OK );
return true;
} catch ( com.example.smtp.MockInvalidAddressException iae ) {
log.debug( "Unable to parse From Address: " + fromAddress );
write( MESSAGE_USER_INVALID );
return false;
}
}
private void handleRcptTo( java.lang.String inputString )
{
java.lang.String toAddress = parseAddress( inputString.substring( 8 ) );
try {
com.example.smtp.MockEmailAddress address = new com.example.smtp.MockEmailAddress( toAddress );
com.example.smtp.MockDeliveryService deliveryService = MockDeliveryService.getDeliveryService();
if (deliveryService.acceptAddress( address, clientIp, message.getFromAddress() )) {
com.example.smtp.MockUser localUser = configurationManager.getUser( address );
if (localUser != null) {
com.example.smtp.MockEmailAddress[] addresses = localUser.getDeliveryAddresses();
for (int index = 0; index < addresses.length; index++) {
message.addToAddress( addresses[index] );
}
} else {
message.addToAddress( address );
}
write( MESSAGE_OK );
if (log.isDebugEnabled()) {
log.debug( "RCTP TO: " + address.getAddress() + " accepted." );
}
} else {
if (log.isInfoEnabled()) {
log.info( "Invalid delivery address for incoming mail: " + toAddress + " from client: " + clientIp + " / " + message.getFromAddress() );
}
throw new com.example.smtp.MockInvalidAddressException();
}
} catch ( com.example.smtp.MockInvalidAddressException iae ) {
write( MESSAGE_USER_NOT_LOCAL );
log.debug( "RCTP TO: " + toAddress + " rejected." );
return;
}
}
private void handleData()
{
long maxSize = configurationManager.getMaximumMessageSize() * 1024 * 1024;
write( MESSAGE_SEND_DATA );
message.addDataLine( "X-RecievedDate: " + new java.util.Date() );
message.addDataLine( "Received: by EricDaugherty's JES SMTP " + configurationManager.getLocalDomains()[0] + " from client: " + clientIp );
try {
java.lang.String inputString = in.readLine();
while (!inputString.equals( "." )) {
if (log.isDebugEnabled()) {
log.debug( "Read Data: " + inputString );
}
message.addDataLine( inputString );
inputString = in.readLine();
if (message.getSize() > maxSize) {
log.warn( "Message Rejected. Message larger than max allowed size (" + configurationManager.getMaximumMessageSize() + " MB)" );
write( MESSAGE_MESSAGE_TOO_LARGE );
throw new java.lang.RuntimeException( "Aborting Connection. Message size too large." );
}
}
log.debug( "Data Input Complete." );
} catch ( com.example.smtp.MockIOException ioe ) {
log.error( "An error occured while retrieving the message data.", ioe );
throw new java.lang.RuntimeException();
}
try {
message.save();
write( MESSAGE_OK );
} catch ( java.lang.Exception se ) {
write( MESSAGE_SAVE_MESSAGE_ERROR );
throw new java.lang.RuntimeException( se.getMessage() );
}
if (log.isInfoEnabled()) {
log.info( "Message " + message.getMessageLocation().getName() + " accepted for delivery." );
}
}
private java.lang.String read()
{
try {
java.lang.String inputLine = in.readLine().trim();
if (log.isDebugEnabled()) {
log.debug( "Read Input: " + inputLine );
}
return inputLine;
} catch ( com.example.smtp.MockIOException ioe ) {
log.error( "Error reading from socket.", ioe );
throw new java.lang.RuntimeException();
}
}
private void write( java.lang.String message )
{
if (log.isDebugEnabled()) {
log.debug( "Writing: " + message );
}
out.print( message + "\r\n" );
out.flush();
}
private java.lang.String parseCommand( java.lang.String inputString )
{
int index = inputString.indexOf( " " );
if (index == -1) {
java.lang.String command = inputString.toUpperCase();
checkQuit( command );
return command;
} else {
java.lang.String command = inputString.substring( 0, index ).toUpperCase();
checkQuit( command );
return command;
}
}
private java.lang.String parseArgument( java.lang.String inputString )
{
int index = inputString.indexOf( " " );
if (index == -1) {
return "";
} else {
return inputString.substring( index + 1 );
}
}
private java.lang.String parseAddress( java.lang.String address )
{
int index = address.indexOf( "<" );
if (index != -1) {
address = address.substring( index + 1 );
}
index = address.indexOf( ">" );
if (index != -1) {
address = address.substring( 0, index );
}
return address;
}
private static final java.lang.String WELCOME_MESSAGE = "220 Welcome to EricDaugherty's Java SMTP Server.";
private static final java.lang.String MESSAGE_DISCONNECT = "221 SMTP server signing off.";
private static final java.lang.String MESSAGE_OK = "250 OK";
private static final java.lang.String MESSAGE_COMMAND_ORDER_INVALID = "503 Command not allowed here.";
private static final java.lang.String MESSAGE_USER_NOT_LOCAL = "550 User does not exist.";
private static final java.lang.String MESSAGE_USER_INVALID = "451 Address is invalid.";
private static final java.lang.String MESSAGE_SEND_DATA = "354 Start mail input; end with <CRLF>.<CRLF>";
private static final java.lang.String MESSAGE_SAVE_MESSAGE_ERROR = "500 Error handling message.";
private static final java.lang.String MESSAGE_INVALID_COMMAND = "500 Command Unrecognized: ";
private static final java.lang.String MESSAGE_MESSAGE_TOO_LARGE = "552 Message size exceeds fixed maximum message size.";
private static final java.lang.String COMMAND_HELO = "HELO";
private static final java.lang.String COMMAND_RSET = "RSET";
private static final java.lang.String COMMAND_NOOP = "NOOP";
private static final java.lang.String COMMAND_QUIT = "QUIT";
private static final java.lang.String COMMAND_MAIL_FROM = "MAIL";
private static final java.lang.String COMMAND_RCPT_TO = "RCPT";
private static final java.lang.String COMMAND_DATA = "DATA";
private final int NONE = 0;
private final int HELO = 1;
private final int QUIT = 2;
private final int MAIL_FROM = 3;
private final int RCPT_TO = 4;
private final int DATA = 5;
private final int DATA_FINISHED = 6;
private final int RSET = 7;
private final int EHLO = 8;
}
| [
"[email protected]"
] | |
4c957f7fdf4b1a984970e782d270248f0c41efe4 | e94273b9dc34f6b6b5f8f1ccb8420c342edf1be4 | /app/src/main/java/unirio/uniriomob/fragment/SecretariatFragment.java | 37412b14df89ee798dbb65717b32009893f98c1f | [] | no_license | Pirocoflaite/UNIRIOmob_v1 | 90ddd8b65b33e0f1a3387d3ce07da7d5efb50744 | 798cd93c93a944e8a8fafa97cd0693f196a6807b | refs/heads/master | 2021-01-13T15:19:21.842561 | 2016-12-14T01:52:17 | 2016-12-14T01:52:17 | 76,412,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,711 | java | package unirio.uniriomob.fragment;
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;
import unirio.uniriomob.R;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link SecretariatFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link SecretariatFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SecretariatFragment 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 SecretariatFragment() {
// 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 SecretariatFragment.
*/
// TODO: Rename and change types and number of parameters
public static SecretariatFragment newInstance(String param1, String param2) {
SecretariatFragment fragment = new SecretariatFragment();
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_secretariat, 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]"
] | |
4ddc6dbc3000783f081e222bf30a4c9c0cc16a7f | 15b44a7d7894674395337d43537e7061254f39e9 | /GradleDyReports/src/main/java/com/vdi/batch/mds/repository/dao/TempValueService.java | b8f5433d6c9456c65ab5678ad14eee01ecdf161b | [] | no_license | yohanwahyudi/mdsreport | 713367de6fbe8e4310000689c6edcd4a7db59296 | 37bb43539cb8262eed99a84859501a5cc6d01c98 | refs/heads/master | 2021-06-08T03:27:16.948982 | 2019-12-17T07:37:43 | 2019-12-17T07:37:43 | 147,747,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.vdi.batch.mds.repository.dao;
import com.vdi.model.TempValue;
public interface TempValueService {
public TempValue getTempValueByName(String name);
public TempValue getTempValue();
public void save(TempValue tempValue);
public void updateTempValue(String value, String name);
}
| [
"[email protected]"
] | |
4cfbd1f63c88d669d19d9313b74289edc96aab0b | d721eed58ea1acb5d19b545ba81b14a78066216d | /BACKUP/Project Code Backup/BaoMoi/app/src/main/java/com/tagroup/thangducanh/baomoi_TA97/Main2Activity.java | 0cee84963d8fbaee72eafa0ec8a7e64ee94145fd | [] | no_license | vietthang197/BaoMoi_KEY_STORE | 8936b093560bf72ab5bd817a446348e2ec8c3546 | db0575934c89d8b3d963b6fea6d3f495b69cae95 | refs/heads/master | 2021-08-30T13:31:14.142296 | 2017-12-18T04:54:37 | 2017-12-18T04:54:37 | 111,754,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package com.tagroup.thangducanh.baomoi_TA97;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
public class Main2Activity extends AppCompatActivity {
private WebView webView;
private AdView mAdView3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
webView = findViewById(R.id.webView);
Intent intent = getIntent();
String link = intent.getStringExtra("link");
webView.loadUrl(link);
webView.setWebViewClient(new WebViewClient());
MobileAds.initialize(getApplicationContext(),"ca-app-pub-6698655251090750~7707011583");
mAdView3 = findViewById(R.id.adView3);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView3.loadAd(adRequest);
}
@Override
public void onBackPressed() {
finish();
}
}
| [
"[email protected]"
] | |
3f247ffef6d4f2b2ec1b887718eb603c21e000f1 | bbee2cbcf136c8fa933a424442b4fcce5df39e57 | /src/game/model/abilities/instants/instants/combat/IceChains.java | 19ebf5d8463daa5f9e0e2177ce120ba3372b4ca2 | [] | no_license | lyoumi/RPG_test | 3b9911317aca80a325f984c38dbe8a8ca194c7bf | 4b8dd4eb7d20dc2babc7bd31b4155bdf154b3275 | refs/heads/master | 2021-01-01T16:27:06.525846 | 2017-07-29T16:46:24 | 2017-07-29T16:46:24 | 97,833,216 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 981 | java | package game.model.abilities.instants.instants.combat;
import game.model.abilities.MagicClasses;
import game.model.abilities.MagicFactory;
import game.model.abilities.instants.InstantMagic;
/**
* Боевая магия, наносящая урон противнику
*/
public class IceChains implements InstantMagic{
private int damage = 30;
private int level;
private int manaCost;
private IceChains(int level){
this.level = level + 1;
this.manaCost = level * 3;
}
@Override
public int getDamage() {
return damage;
}
@Override
public void setDamage() {
this.damage += 30;
}
@Override
public int getLevel() {
return level;
}
@Override
public int getManaCost() {
return manaCost;
}
@Override
public MagicClasses getMagicClass() {
return MagicClasses.INSTANT;
}
public static MagicFactory magicFactory = IceChains::new;
}
| [
"[email protected]"
] | |
dde0f6b22459aa25e623e56a0cdf9fc126516735 | 22d6eefd1fa735ccb9f3ca55cd1e2ba8c16d7eb9 | /src/main/java/com/wangyije/mall/controller/CartController.java | d642a108fba21e96e8e5f8b361ea2ddc95869fc7 | [] | no_license | ywang85/mall | d5850893b1880d4ce55a6c142f34c6bbf59f3ff4 | dacd18c798c9e59d425caf429af30699ddac0752 | refs/heads/master | 2022-05-26T02:09:46.277711 | 2020-05-02T01:18:57 | 2020-05-02T01:18:57 | 260,588,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,435 | java | package com.wangyije.mall.controller;
import com.wangyije.mall.consts.MallConst;
import com.wangyije.mall.form.CartAddForm;
import com.wangyije.mall.form.CartUpdateForm;
import com.wangyije.mall.pojo.User;
import com.wangyije.mall.service.ICartService;
import com.wangyije.mall.vo.CartVo;
import com.wangyije.mall.vo.ResponseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
@RestController
public class CartController {
@Autowired
private ICartService cartService;
@PostMapping("/carts/add")
public ResponseVo<CartVo> add(@Valid @RequestBody CartAddForm cartAddForm, HttpSession session) {
User user = (User) session.getAttribute(MallConst.CURRENT_USER);
return cartService.add(user.getId(), cartAddForm);
}
@GetMapping("/carts/list")
public ResponseVo<CartVo> list(HttpSession session) {
User user = (User) session.getAttribute(MallConst.CURRENT_USER);
System.out.println(user.getId());
return cartService.list(user.getId());
}
@PutMapping("/carts/{productId}")
public ResponseVo<CartVo> update(@PathVariable Integer productId, @Valid @RequestBody CartUpdateForm cartAddForm, HttpSession session) {
User user = (User) session.getAttribute(MallConst.CURRENT_USER);
return cartService.update(user.getId(), productId, cartAddForm);
}
@DeleteMapping("/carts/{productId}")
public ResponseVo<CartVo> delete(@PathVariable Integer productId, HttpSession session) {
User user = (User) session.getAttribute(MallConst.CURRENT_USER);
return cartService.delete(user.getId(), productId);
}
@PutMapping("/carts/selectAll")
public ResponseVo<CartVo> selectAll(HttpSession session) {
User user = (User) session.getAttribute(MallConst.CURRENT_USER);
return cartService.selectAll(user.getId());
}
@PutMapping("/carts/unSelectAll")
public ResponseVo<CartVo> unSelectAll(HttpSession session) {
User user = (User) session.getAttribute(MallConst.CURRENT_USER);
return cartService.unSelectAll(user.getId());
}
@GetMapping("/carts/sum")
public ResponseVo<Integer> sum(HttpSession session) {
User user = (User) session.getAttribute(MallConst.CURRENT_USER);
return cartService.sum(user.getId());
}
}
| [
"[email protected]"
] | |
d96f60d6331b421bd35280c7797ffd3ae2cca65a | d2ddda2a6346e669274a6d8ec466ff7a1b875dcc | /app/src/main/java/com/clases/rd/ui/Clientes/ClientesViewModel.java | 4d4390a7555849b54bccc034699849f2aec076b1 | [] | no_license | ghtdeveloper/AppPrestamosSQLLite | 490cae5103388242b244a32bbabc89592325631a | 3b211f05fa79c11d04458371fbd7ad69881b9d1d | refs/heads/master | 2022-04-15T21:04:25.168863 | 2020-04-10T15:29:22 | 2020-04-10T15:29:22 | 249,083,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,532 | java | package com.clases.rd.ui.Clientes;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class ClientesViewModel extends ViewModel {
private MutableLiveData<String> mText;
private String nombre;
private String apellido;
private String sexo;
private String cedula;
private String direccion;
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public String getSexo() {
return sexo;
}
public void setSexo(String sexo) {
this.sexo = sexo;
}
public String getCedula() {
return cedula;
}
public void setCedula(String cedula) {
this.cedula = cedula;
}
public String getDireccion() {
return direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
public String getTelefono() {
return telefono;
}
public void setTelefono(String telefono) {
this.telefono = telefono;
}
private String telefono;
public ClientesViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is home fragment");
}
public LiveData<String> getText() {
return mText;
}
}//Fin de la class ClientesViewModel | [
"[email protected]"
] | |
7266a47c62cc0684518633707533a023a98aa0b3 | 2842ead7d69e81b365904900ebe18f35d7b9d207 | /client/src/main/java/com/equinix/amphibia/agent/converter/Profile.java | dc29d895e08bdf7637912def29d00383c7b1ceb0 | [
"MIT"
] | permissive | dgofman/amphibia-1 | 4b0a5bc26fa586b01b241dbfeb06b9ddf22095b2 | f66657c3102fc1a68036d550df155123fe51cf58 | refs/heads/master | 2020-03-18T12:24:23.826298 | 2018-05-10T20:20:07 | 2018-05-10T20:20:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 40,243 | java | package com.equinix.amphibia.agent.converter;
import com.equinix.amphibia.agent.builder.ProjectAbstract;
import com.equinix.amphibia.agent.converter.Converter.RESOURCE_TYPE;
import com.equinix.amphibia.agent.converter.Swagger.ApiInfo;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@SuppressWarnings({"serial", "unchecked"})
public class Profile {
protected JSONObject definitions;
protected Swagger swagger;
protected final String projectDir;
protected final boolean isMerge;
protected final boolean isJSON;
protected final boolean isNullTests;
protected final boolean isTypeTests;
protected final boolean isAddNullTests;
protected final boolean isAddTypeTests;
protected final boolean isNullValidation;
protected final boolean isTypeValidation;
protected final ArrayList<Object> resources;
protected final ArrayList<Object> testsuites;
protected final Map<Object, JSONObject> common;
protected final Map<Object, Object> profile;
protected final String responseCodes;
protected String resourceId;
public static String PROJECT_DIR = "projects";
public static final String DATA_DIR = "data";
public static final String RESOURCE_TYPE_FILE = "file";
public static final String RESOURCE_TYPE_URL = "url";
public static final String RESOURCE_TYPE_WIZARD = "wizard";
public final Map<String, Boolean> invalidPropertyValues;
private static final Logger LOGGER = ProjectAbstract.getLogger(Profile.class.getName());
public static final String HTTP_STATUS_CODE = "HTTPStatusCode";
public Profile(String dir) throws Exception {
projectDir = dir;
resources = new ArrayList<>();
testsuites = new ArrayList<>();
common = new LinkedHashMap<>();
invalidPropertyValues = new LinkedHashMap<>();
isMerge = "true".equals(Converter.cmd.getOptionValue(Converter.MERGE));
isJSON = "true".equals(Converter.cmd.getOptionValue(Converter.JSON));
isNullTests = "true".equals(Converter.cmd.getOptionValue(Converter.NULL));
isTypeTests = "true".equals(Converter.cmd.getOptionValue(Converter.TYPE));
isAddNullTests = "true".equals(Converter.cmd.getOptionValue(Converter.ADD_NULL));
isAddTypeTests = "true".equals(Converter.cmd.getOptionValue(Converter.ADD_TYPE));
isNullValidation = "true".equals(Converter.cmd.getOptionValue(Converter.NULL_VALIDATION));
isTypeValidation = "true".equals(Converter.cmd.getOptionValue(Converter.TYPE_VALIDATION));
String codes = Converter.cmd.getOptionValue(Converter.CODES);
if (codes == null) {
responseCodes = "200,201";
} else {
responseCodes = codes;
}
profile = new LinkedHashMap<Object, Object>() {
{
put("version", "1.0.0");
put("project", new LinkedHashMap<Object, Object>() {
{
put("id", UUID.randomUUID().toString());
put("name", null);
put("appendLogs", false);
put("continueOnError", true);
put("testCaseTimeout", 15000);
}
});
put("properties", new JSONObject());
put("resources", resources);
put("testsuites", testsuites);
put("common", common);
}
};
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public Map<Object, JSONObject> getCommon() {
return common;
}
public void finalize(String projectName) {
((LinkedHashMap<Object, Object>) profile.get("project")).put("name", projectName);
}
public void setSwagger(Swagger swagger, JSONObject rulesAndPrperties) {
this.swagger = swagger;
if (!isMerge && rulesAndPrperties != null) {
((JSONObject) profile.get("properties")).putAll(rulesAndPrperties.getJSONObject("projectProperties"));
}
}
public void setDefinition(JSONObject doc) {
this.definitions = doc.getJSONObject("definitions");
}
public void addResource(String resourceId, String intf, String inputParam, boolean isURL, JSONObject rulesAndPrperties, String propertiesFile) {
Map<Object, Object> resourceMap = new LinkedHashMap<Object, Object>() {
{
put("id", resourceId);
put("interface", intf);
put("type", isURL ? RESOURCE_TYPE_URL : RESOURCE_TYPE_FILE);
put("source", inputParam);
put("properties", propertiesFile);
put("headers", new JSONObject());
}
};
if (!isMerge && rulesAndPrperties != null) {
JSONArray resourceInfo = rulesAndPrperties.getJSONObject("info").getJSONArray("resources");
resourceInfo.forEach((item) -> {
JSONObject resource = (JSONObject) item;
if (resourceId.equals(resource.getString("id"))) {
((JSONObject) resourceMap.get("headers")).putAll(resource.getJSONObject("headers"));
if (resource.containsKey("interface")) {
resourceMap.put("name", resource.get("interface"));
}
if (resource.containsKey("basePath")) {
resourceMap.put("basePath", resource.get("basePath"));
}
}
});
}
resources.add(resourceMap);
}
public void saveFile(File outputFile, String content) throws Exception {
ProjectAbstract.saveFile(outputFile, content);
LOGGER.log(Level.INFO, "saved successfully.\n{0}", outputFile);
}
public void saveFile(JSONObject output, File outputFile) throws Exception {
for (Object fileName : Swagger.asserts.keySet()) {
String body = Swagger.asserts.get(fileName);
save(swagger.getDataDir(), body, fileName.toString(), "asserts", RESOURCE_TYPE.asserts);
}
save(new File(DATA_DIR), Swagger.getJson(profile), "profile.json", null, RESOURCE_TYPE.profile);
saveFile(outputFile, Swagger.getJson(output.toString()));
Converter.addResult(RESOURCE_TYPE.project, outputFile.getCanonicalPath());
}
protected String save(File dataDir, String json, String fileName, String childDir, RESOURCE_TYPE type) throws Exception {
if ("false".equals(Converter.cmd.getOptionValue(Converter.TESTS))) {
return null;
}
if (childDir != null) {
dataDir = new File(dataDir, childDir);
}
File outputDir = new File(projectDir, dataDir.getPath());
File outputFile = new File(outputDir, fileName);
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
String filePath = ProjectAbstract.getRelativePath(projectDir, outputFile.toURI());
if (!outputFile.exists()) {
saveFile(outputFile, json);
if (type != null) {
Converter.addResult(type, filePath);
}
} else if (swagger.isDataGenerate()) {
Converter.addResult(RESOURCE_TYPE.warnings, "File already exists: " + outputFile.getAbsolutePath());
}
return filePath;
}
@SuppressWarnings("NonPublicExported")
public void addTestCases(int index, String resourceId, String interfaceName,
Map<String, List<ApiInfo>> testSuiteMap, JSONObject rulesAndPrperties) throws Exception {
JSONObject testSuitesRules = (JSONObject) rulesAndPrperties.getOrDefault("testsuites", new JSONObject());
JSONObject testsRules = (JSONObject) rulesAndPrperties.getOrDefault("tests", new JSONObject());
for (String testSuiteName : testSuiteMap.keySet()) {
List<Map<Object, Object>> testcases = new ArrayList<>();
JSONObject testSuiteRules = (JSONObject) testSuitesRules.getOrDefault(testSuiteName, new JSONObject());
if (this.resourceId != null && testSuiteRules.containsKey("resource") && !resourceId.equals(testSuiteRules.get("resource"))) {
continue;
}
JSONObject testcasesRules = (JSONObject) testSuiteRules.getOrDefault("testcases", new JSONObject());
JSONObject testSuiteTests = (JSONObject) testsRules.getOrDefault(testSuiteName, new JSONObject());
String testSuiteAlias = null;
for (ApiInfo info : testSuiteMap.get(testSuiteName)) {
String testFile = getPath(info) + ".json";
String name = info.methodName + "_" + info.apiName;
testSuiteAlias = info.testSuiteAlias;
JSONObject testcaseRules = (JSONObject) testcasesRules.getOrDefault(name, new JSONObject());
JSONArray steps = addTestCase(testcases, testcaseRules, testSuiteName, name);
testcasesRules.remove(name);
addTestSteps(steps, info, testFile, "tests", testSuiteTests);
}
if (!testcasesRules.isEmpty()) {
testcasesRules.keySet().forEach((key) -> {
JSONObject testcaseRules = testcasesRules.getJSONObject(key.toString());
addTestCase(testcases, testcaseRules, testSuiteName, key);
});
}
Map<String, Object> testsuite = new LinkedHashMap<>();
testsuite.put("name", testSuiteName);
if (testSuiteAlias != null) {
testsuite.put("alias", testSuiteAlias);
}
testsuite.put("resource", resourceId);
testsuite.put("testcases", testcases);
if (testSuiteRules.containsKey("properties")) {
testsuite.put("properties", testSuiteRules.get("properties"));
}
testsuites.add(testsuite);
testSuitesRules.remove(testSuiteName);
}
if (!testSuitesRules.isEmpty()) {
testSuitesRules.keySet().forEach((testSuiteName) -> {
JSONObject testSuiteRules = (JSONObject) testSuitesRules.get(testSuiteName);
if (testSuiteRules.getString("resource").equals(resourceId)) {
Map<String, Object> testsuite = new LinkedHashMap<>();
testsuite.put("name", testSuiteName);
testsuite.put("resource", resourceId);
if (testSuiteRules.containsKey("properties")) {
testsuite.put("properties", testSuiteRules.get("properties"));
}
JSONArray testcases = new JSONArray();
JSONObject testcasesRules = (JSONObject) testSuiteRules.getOrDefault("testcases", new JSONArray());
testcasesRules.keySet().forEach((testcaseName) -> {
JSONObject testcaseRules = testcasesRules.getJSONObject(testcaseName.toString());
addTestCase(testcases, testcaseRules, testSuiteName, testcaseName);
});
testsuite.put("testcases", testcases);
testsuites.add(testsuite);
}
});
}
}
private JSONArray addTestCase(List<Map<Object, Object>> testcases, JSONObject testcaseRules, Object testSuiteName, Object testCaseName) {
JSONArray steps = (JSONArray) testcaseRules.getOrDefault("steps", new JSONArray());
for (int i = 0; i < steps.size(); i++) {
Object item = steps.get(i);
if (item instanceof JSONObject) {
JSONObject step = (JSONObject) item;
if (step.containsKey("request")) {
Object body = step.getJSONObject("request").getOrDefault("body", null);
if (body != null) {
step.getJSONObject("request").put("body",
String.format(body.toString(), swagger.getResourceId()));
}
}
if (step.containsKey("response")) {
Object body = step.getJSONObject("response").getOrDefault("body", null);
if (body != null) {
step.getJSONObject("response").put("body",
String.format(body.toString(), swagger.getResourceId()));
}
}
} else {
JSONObject step = new JSONObject();
step.put("name", item);
if (common.containsKey(item)) {
step.put("common", item);
}
steps.set(i, step);
}
}
testcases.add(new LinkedHashMap<Object, Object>() {
{
put("name", testcaseRules.containsKey("name") ? testcaseRules.get("name") : testCaseName);
put("path", swagger.getDataDirPath() + "/tests/" + getPath(testSuiteName, testCaseName) + ".json");
put("steps", steps);
if (testcaseRules.containsKey("headers")) {
put("headers", testcaseRules.get("headers"));
}
if (testcaseRules.containsKey("properties")) {
put("properties", testcaseRules.get("properties"));
}
if (testcaseRules.containsKey("transfer")) {
put("transfer", testcaseRules.get("transfer"));
}
}
});
return steps;
}
@SuppressWarnings("NonPublicExported")
protected void addTestSteps(JSONArray steps, ApiInfo info, String testFile, String childDir,
JSONObject testSuiteTests) throws Exception {
JSONObject api = info.api;
Map<Object, Object> body = new LinkedHashMap<>();
Map<String, Object> teststep = new LinkedHashMap<>();
Map<String, Object> step = addStep(info, testFile, api, body, testSuiteTests);
Map<Object, Map<Object, Object>> request = (Map<Object, Map<Object, Object>>) step.get("request");
if (request != null) {
Map<Object, Object> properties = request.get("properties");
properties.keySet().forEach((key) -> {
if (isNullTests) {
String name = key.toString().replaceAll("\\.", "_") + "_NULL";
JSONObject json = new JSONObject();
if (isAddNullTests) {
boolean add = true;
for (Object item : steps) {
if (((JSONObject) item).getString("name").equals(name)) {
add = false;
break;
}
}
if (add) {
json.element("name", name);
json.element("common", name);
steps.add(json);
}
}
if (!common.containsKey(name)) {
json = new JSONObject();
json.element("request", new LinkedHashMap<Object, Object>() {
{
put("properties", new LinkedHashMap<Object, Object>() {
{
put(key, null);
}
});
}
});
json.element("response", new LinkedHashMap<Object, Object>() {
{
put("properties", new LinkedHashMap<Object, Object>() {
{
put(HTTP_STATUS_CODE, 400);
}
});
}
});
common.put(name, json);
}
}
if (isTypeTests) {
JSONObject json = new JSONObject();
String name = key.toString().replaceAll("\\.", "_") + "_TRUE";
if (isAddTypeTests) {
boolean add = true;
for (Object item : steps) {
if (((JSONObject) item).getString("name").equals(name)) {
add = false;
break;
}
}
if (add) {
json.element("name", name);
json.element("common", name);
steps.add(json);
}
}
if (!common.containsKey(name)) {
json = new JSONObject();
json.element("request", new LinkedHashMap<Object, Object>() {
{
put("properties", new LinkedHashMap<Object, Object>() {
{
put(key, properties.get(key) instanceof Boolean ? "true" : true);
}
});
}
});
json.element("response", new LinkedHashMap<Object, Object>() {
{
put("properties", new LinkedHashMap<Object, Object>() {
{
put(HTTP_STATUS_CODE, 400);
}
});
}
});
common.put(name, json);
}
}
});
}
teststep.put("request", request);
teststep.put("response", step.get("response"));
JSONObject json = JSONObject.fromObject(teststep);
String testStepFile = save(swagger.getDataDir(), Swagger.getJson(json), testFile, childDir, null);
Converter.addResult(RESOURCE_TYPE.tests, testStepFile);
}
@SuppressWarnings("NonPublicExported")
protected Map<Object, Object> addTestStepProperties(ApiInfo info, JSONObject api, Map<Object, Object> properties,
Map<Object, Object> body) {
if (api.containsKey("parameters")) {
JSONArray parameters = api.getJSONArray("parameters");
for (Object obj : parameters) {
JSONObject param = (JSONObject) obj;
if (param.containsKey("in") && "body".equals(param.getString("in"))) {
if (param.containsKey("schema")) {
JSONObject schema = param.getJSONObject("schema");
if (schema.containsKey("$ref")) {
addBodyAndProperties(info, schema.getString("$ref"), properties, body);
}
}
break;
}
}
}
return properties;
}
@SuppressWarnings("NonPublicExported")
protected void addBodyAndProperties(ApiInfo info, String ref, Map<Object, Object> properties,
Map<Object, Object> body) {
addBodyAndProperties(info, ref, properties, body, new JSONObject(), "");
}
@SuppressWarnings("NonPublicExported")
protected void addBodyAndProperties(ApiInfo info, String ref, Map<Object, Object> properties,
Map<Object, Object> body, JSONObject examples, String ids) {
String definitionName = Swagger.getDefinitionName(ref);
JSONObject definition = definitions.getJSONObject(definitionName);
if (!definition.isNullObject() && definition.containsKey("properties")) {
JSONObject props = definition.getJSONObject("properties");
addBodyAndProperty(info, definitionName, props, properties, body, examples, ids);
}
}
@SuppressWarnings("NonPublicExported")
protected void addBodyAndProperty(ApiInfo info, String definitionName, JSONObject props,
Map<Object, Object> properties, Map<Object, Object> body, JSONObject examples, String ids) {
for (Object key : props.keySet()) {
String id = ids + (ids.length() == 0 ? "" : ".") + key;
JSONObject val = (JSONObject) props.get(key);
String param = escapeParam(val, "${#" + id + "}");
Object suiteProperty = swagger.getTestRuleProperty(info, id);
if (suiteProperty != null) {
addPropertyValue(info, definitionName, examples, properties, id, suiteProperty);
body.put(key, param);
continue;
}
if (val.containsKey("default")) {
properties.put(id, val.get("default"));
body.put(key, param);
} else if (val.containsKey("example")) {
addPropertyValue(info, definitionName, examples, properties, id, val.get("example"));
body.put(key, param);
} else if (val.containsKey("enum")) {
addPropertyValue(info, definitionName, examples, properties, id, val.getJSONArray("enum").get(0));
body.put(key, param);
} else {
Map<Object, Object> child = new LinkedHashMap<>();
if (val.containsKey("$ref")) {
String refDefinitionName = Swagger.getDefinitionName(val.getString("$ref"));
if (!refDefinitionName.equals(definitionName)) {
addBodyAndProperties(info, val.getString("$ref"), properties, child, examples, id);
}
} else if (val.containsKey("items")) {
JSONObject items = val.getJSONObject("items");
if (items.containsKey("$ref")) {
String refDefinitionName = Swagger.getDefinitionName(items.getString("$ref"));
if (!refDefinitionName.equals(definitionName)) {
addBodyAndProperties(info, items.getString("$ref"), properties, child, examples, id);
}
} else if (items.containsKey("properties")) {
addBodyAndProperty(info, definitionName, items.getJSONObject("properties"), properties, child,
examples, id);
} else if (items.containsKey("example")) {
addPropertyValue(info, definitionName, examples, properties, id, items.get("example"));
body.put(key, new Object[]{escapeParam(items, "${#" + id + "}")});
continue;
}
} else if (val.containsKey("properties")) {
addBodyAndProperty(info, definitionName, val.getJSONObject("properties"), properties, child,
examples, id);
} else {
JSONObject definition = definitions.getJSONObject(definitionName);
if (definition.containsKey("example")) {
Object example = Validator.getExample(definition, "example");
Object value = Validator.getExample(example, key.toString());
if (value != null) {
addPropertyValue(info, definitionName, examples, properties, id, value);
body.put(key, param);
continue;
} else {
String[] keys = id.split("\\.");
for (int i = 0; i < keys.length; i++) {
Object ex = Validator.getExample(example, keys[i]);
if (ex == null && i == 0) {
continue;
}
example = ex;
}
example = Validator.getExample(example, key.toString());
if (example != null) {
addPropertyValue(info, definitionName, examples, properties, id, example);
body.put(key, param);
continue;
}
}
}
addPropertyValue(info, definitionName, examples, properties, id, null);
body.put(key, param);
continue;
}
if (val.containsKey("type") && "array".equals(val.getString("type"))) {
if (child.isEmpty()) {
body.put(key, new Object[]{});
} else {
body.put(key, new Object[]{child});
}
} else {
body.put(key, child);
}
}
}
}
@SuppressWarnings("NonPublicExported")
protected Object addBodyAndProperty(Map<Object, Object> resBody, Map<Object, Object> properties, String ids) {
resBody.keySet().forEach((key) -> {
String id = ids + (ids.length() == 0 ? "" : ".") + key;
Object val = resBody.get(key);
if (val instanceof JSONObject) {
addBodyAndProperty((JSONObject) val, properties, id);
} else if (val instanceof JSONArray) {
JSONArray list = (JSONArray) val;
for (int i = 0; i < list.size(); i++) {
JSONObject item = list.getJSONObject(i);
list.set(i, addBodyAndProperty(item, properties, id + "." + i));
}
} else {
String param = escapeParam(val, "${#" + id + "}");
properties.put(id, val);
resBody.put(key, param);
}
});
return resBody;
}
protected String escapeParam(Object val, String param) {
return "`" + param + "`";
}
protected Object findPropertyValueFromExamples(JSONObject examples, String key) {
String[] path = key.split("\\.");
Object example = examples;
if (examples.containsKey("application/json")) {
String json = examples.getString("application/json");
if (json.trim().startsWith("{")) {
example = JSONObject.fromObject(json);
} else {
example = JSONArray.fromObject(json);
}
} else if (examples.containsKey("application/javascript")) {
example = JSONArray.fromObject(examples.getString("application/javascript"));
}
return new Object() {
Object walk(Object example, String[] path, int index) {
if (path.length > index) {
if (example instanceof JSONObject) {
if (((JSONObject) example).containsKey(path[index])) {
return walk(((JSONObject) example).get(path[index]), path, ++index);
}
} else if (example instanceof JSONArray && ((JSONArray) example).size() > 0) {
return walk(((JSONArray) example).get(0), path, index);
}
}
return example;
}
}.walk(example, path, 0);
}
@SuppressWarnings("NonPublicExported")
public void addPropertyValue(ApiInfo info, String definitionName, JSONObject examples,
Map<Object, Object> properties, Object key, Object value) {
if (isNullValidation && ProjectAbstract.isNULL(value)) {
String errorKey = definitionName + "|" + key + "|" + value;
if (!invalidPropertyValues.containsKey(errorKey)) {
invalidPropertyValues.put(errorKey, true);
Converter.addResult(RESOURCE_TYPE.warnings, "'" + key + "' parameter is set to NULL. ("
+ (definitionName != null ? "Definition: " + definitionName : "Path: " + info.path) + ")");
}
} else if (isTypeValidation && (value instanceof String && ("true".equals(value) || "false".equals(value)))) {
String errorKey = definitionName + "|" + key + "|" + value;
if (!invalidPropertyValues.containsKey(errorKey)) {
invalidPropertyValues.put(errorKey, true);
Converter.addResult(RESOURCE_TYPE.warnings, "'" + key + "' parameter is set as BOOLEAN STRING. ("
+ (definitionName != null ? "Definition: " + definitionName : "Path: " + info.path) + ")");
}
}
if (!examples.isEmpty()) {
value = findPropertyValueFromExamples(examples, key.toString());
if (value != null) {
properties.put(key, value);
return;
}
}
properties.put(key, value);
}
@SuppressWarnings("NonPublicExported")
protected Map<String, Object> addStep(ApiInfo info, String fileName, JSONObject api, Map<Object, Object> body,
JSONObject testSuiteTests) throws Exception {
Map<String, Object> step = new LinkedHashMap<>();
Object requestBody = null;
Object requestSchema = null;
if (api.containsKey("parameters")) {
JSONArray parameters = api.getJSONArray("parameters");
for (Object obj : parameters) {
JSONObject param = (JSONObject) obj;
if (param.containsKey("in") && "body".equals(param.getString("in"))) {
if (param.containsKey("schema")) {
JSONObject schema = param.getJSONObject("schema");
if (schema.containsKey("$ref")) {
String ref = schema.getString("$ref");
if (Schema.schemas.get(ref) != null) {
requestSchema = Schema.schemas.get(ref);
break;
}
}
}
}
}
}
Map<Object, Object> requestProperties = new LinkedHashMap<>();
addTestStepProperties(info, api, requestProperties, body);
if (!body.isEmpty()) {
requestBody = save(swagger.getDataDir(), Swagger.getJson(body), fileName, "requests",
RESOURCE_TYPE.requests);
}
Map<Object, Object> responseProperties = new LinkedHashMap<>();
String responseJSON = null;
String responseBody = null;
String responseSchema;
if (api.containsKey("responses")) {
JSONObject responses = api.getJSONObject("responses");
for (Object httpCode : responses.keySet()) {
boolean isResponseCode = responseCodes.contains(httpCode.toString());
JSONObject response = responses.getJSONObject(httpCode.toString());
if (response.containsKey("schema")) {
JSONObject schema = response.getJSONObject("schema");
Map<Object, Object> resBody = new LinkedHashMap<>();
if (schema.containsKey("$ref")) {
String ref = schema.getString("$ref");
if (Schema.schemas.get(ref) != null) {
if (isResponseCode) {
responseSchema = Schema.schemas.get(ref);
} else {
Schema.schemas.get(ref);
}
}
addBodyAndProperties(info, schema.getString("$ref"), responseProperties, resBody);
}
if (!resBody.isEmpty()) {
responseJSON = Swagger.getJson(resBody);
} else {
JSONObject examples = new JSONObject();
if (response.containsKey("examples")) {
examples = response.getJSONObject("examples");
if (schema.containsKey("properties")) {
addBodyAndProperty(info, null, schema.getJSONObject("properties"), responseProperties,
resBody, examples, "");
} else if (schema.containsKey("items")) {
JSONObject items = schema.getJSONObject("items");
if (items.containsKey("$ref")) {
addBodyAndProperties(info, items.getString("$ref"), responseProperties, resBody,
examples, "");
}
}
if (schema.containsKey("$ref")) {
addBodyAndProperties(info, schema.getString("$ref"), responseProperties, resBody,
examples, "");
}
}
if (!resBody.isEmpty()) {
responseJSON = Swagger.getJson(resBody);
} else {
String example;
if (examples.containsKey("application/json")) {
example = examples.getString("application/json");
} else if (examples.containsKey("application/javascript")) {
example = examples.getString("application/javascript");
} else {
continue;
}
if (example.startsWith("[")) {
JSONArray arr = JSONArray.fromObject(example);
if (arr.size() > 0) {
resBody = arr.getJSONObject(0);
}
} else {
resBody = JSONObject.fromObject(example);
}
addBodyAndProperty(resBody, responseProperties, "assert");
if (!resBody.isEmpty()) {
responseJSON = Swagger.getJson(resBody);
}
}
}
} else if (response.containsKey("examples")) {
Map<Object, Object> resBody = new LinkedHashMap<>();
JSONObject examples = response.getJSONObject("examples");
String example;
if (examples.containsKey("application/json")) {
example = examples.getString("application/json");
} else if (examples.containsKey("application/javascript")) {
example = examples.getString("application/javascript");
} else {
continue;
}
if (example.startsWith("[")) {
JSONArray arr = JSONArray.fromObject(example);
if (arr.size() > 0) {
resBody = arr.getJSONObject(0);
}
} else {
resBody = JSONObject.fromObject(example);
}
addBodyAndProperty(resBody, responseProperties, "");
if (!resBody.isEmpty()) {
responseJSON = Swagger.getJson(resBody);
}
}
if (ProjectAbstract.isNULL(responseJSON)) {
Converter.addResult(RESOURCE_TYPE.warnings, "Response body is NULL: " + info.methodName + " " + httpCode + "::" + info.path);
}
if (isResponseCode) {
responseBody = responseJSON;
} else {
String httpFile = httpCode + ".json";
if (Swagger.asserts.containsKey(httpFile)) {
Object data = Swagger.asserts.get(httpFile);
if (data != null && !data.equals(responseJSON)) {
Swagger.asserts.put(getPath(info) + "_" + httpCode + ".json", responseJSON);
}
} else {
Swagger.asserts.put(httpFile, responseJSON);
}
}
}
}
Object responseFile;
if (responseBody != null) {
responseFile = save(swagger.getDataDir(), responseBody, fileName, "responses", RESOURCE_TYPE.responses);
} else {
responseFile = Swagger.NULL;
}
JSONArray asserts = new JSONArray();
JSONObject transfer = new JSONObject();
if (testSuiteTests.containsKey(info.testCaseName)) {
JSONObject testCaseRules = testSuiteTests.getJSONObject(info.testCaseName);
if (testCaseRules.containsKey("request")) {
JSONObject requestRules = testCaseRules.getJSONObject("request");
if (requestRules.containsKey("body")) {
requestBody = ProjectAbstract.isNULL(requestRules.get("body")) ? null
: String.format(requestRules.getString("body"), swagger.getResourceId());
}
if (requestRules.containsKey("properties")) {
requestProperties.putAll(requestRules.getJSONObject("properties"));
}
}
if (testCaseRules.containsKey("response")) {
JSONObject responseRules = testCaseRules.getJSONObject("response");
if (responseRules.containsKey("body")) {
responseFile = ProjectAbstract.isNULL(responseRules.get("body")) ? null
: String.format(responseRules.getString("body"), swagger.getResourceId());
}
if (responseRules.containsKey("properties")) {
responseProperties.putAll(responseRules.getJSONObject("properties"));
}
if (responseRules.containsKey("transfer")) {
transfer.putAll(responseRules.getJSONObject("transfer"));
}
if (responseRules.containsKey("asserts")) {
asserts.addAll(responseRules.getJSONArray("asserts"));
}
}
}
final Object reqBody = requestBody == null ? Swagger.NULL : requestBody;
final Object resBody = responseFile == null ? Swagger.NULL : responseFile;
step.put("request", new LinkedHashMap<Object, Object>() {
{
put("properties", requestProperties);
put("body", reqBody);
}
});
step.put("response", new LinkedHashMap<Object, Object>() {
{
put("properties", responseProperties);
put("body", resBody);
if (!asserts.isEmpty()) {
put("asserts", asserts);
}
if (!transfer.isEmpty()) {
put("transfer", transfer);
}
}
});
return step;
}
private String getPath(ApiInfo info) {
return getPath(info.testSuiteName, info.methodName + "_" + info.apiName);
}
private String getPath(Object testSuiteName, Object testCaseName) {
return Swagger.stripName(testSuiteName.toString()) + "/" + testCaseName;
}
}
| [
"[email protected]"
] | |
5fd2c596c1ed6ede964a984f991d8c773c3299fa | 7f070e3466fd7f14141a6bda7e2d77ca0f9bf0e7 | /src/roulette/TwoConsecutiveBet.java | 5d2225780bb5c654fbd846b968e9ec29e00a5ed3 | [
"MIT"
] | permissive | as466/example_roulette | efc06121b0bf13f4d3ba9f19dd4f71b0d3beadff | 69277810e985cb832b695709f81cd7260c09fdd3 | refs/heads/master | 2020-04-05T23:31:56.624343 | 2015-09-10T20:42:35 | 2015-09-10T20:42:35 | 42,265,002 | 0 | 0 | null | 2015-09-10T19:09:48 | 2015-09-10T19:09:48 | null | UTF-8 | Java | false | false | 602 | java | package roulette;
import util.ConsoleReader;
public class TwoConsecutiveBet extends Bet{
public TwoConsecutiveBet(String description, int odds) {
super(description, odds);
// TODO Auto-generated constructor stub
}
@Override
public String getUserChoice()
{
return "" + ConsoleReader.promptRange("Enter first of two consecutive numbers",
1, Wheel.NUM_SPOTS - 3);
}
@Override
public boolean getResult(Wheel myWheel, String betChoice)
{
int start = Integer.parseInt(betChoice);
return (start <= myWheel.getNumber() && myWheel.getNumber() < start + 2);
}
}
| [
"[email protected]"
] | |
607255af8af8377a583d3c7fa8cb21415e250eb2 | ff488b13c010124569ab28262cdf06184d0a3c9c | /source/GoodDogTestDrive.java | daceffe74ffb64c46d91e55321b3740fcf8298af | [] | no_license | mnakulkumar/Java-5.0-Programs | 62fde72bba56a3c93cc1b374d85a6e089e4d1dfd | dbcb0815c2b2a5474de842411d29bcfe02bce938 | refs/heads/master | 2023-07-30T00:00:51.934497 | 2021-09-05T02:44:22 | 2021-09-05T02:44:22 | 388,878,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | class GoodDog {
private int size;
public int getSize() {
return size;
}
public void setSize(int s) {
size = s;
}
void bark() {
if (size > 60) {
System.out.println("Wooof! Woof!");
} else if ( size > 14) {
System.out.println("Ruff! Ruff!");
} else {
System.out.println("Yip! Yip!");
}
}
}
class GoodDogTestDrive {
public static void main (String[] args) {
GoodDog one = new GoodDog();
one.setSize(70);
GoodDog two = new GoodDog();
two.setSize(8);
System.out.println("Dog one: "+ one.getSize());
System.out.println("Dog two: "+ two.getSize());
one.bark();
two.bark();
}
} | [
"[email protected]"
] | |
bfaf11154f055f9c8ece951154d224bc6f769810 | 2ec6cb24242eac2d3dd3ef4e022cab49a1af8adf | /workshopLab/src/Milestone1/ArticleReader.java | 50a817e0e7a589e5bc52a722f6d0e2a99d742fa7 | [] | no_license | SVerma19/eclipse-space | dce601bf44d156543b0d8c21eee2758c2164870f | 6d0ec4c600c80e2f6a04587b7daf31102b8a1db3 | refs/heads/master | 2023-04-26T03:54:19.442504 | 2021-06-01T02:49:18 | 2021-06-01T02:49:18 | 372,681,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | java | package Milestone1;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class ArticleReader implements ReaderInterface{
List<String> lines = new ArrayList<String>();
public List<String> readFile(String fileName) {
////path to where the TXT file is located
File file = new File("/Users/guillem/Desktop/Fairfield/Fall 2019/CS231L/LabProjectMilestone2/"+ fileName);
BufferedReader br;
try {
br = new BufferedReader(new FileReader(file));
String st;
while ((st = br.readLine()) != null) {
//System.out.println(st);
lines.add(st);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return lines;
}
}
| [
"[email protected]"
] | |
ab4578031998a4391cb11b3556fa8c29614a7e4f | d8519e671503b6fa77ba66059914eb41b78c8e40 | /src/main/java/https/webapi_allegro_pl/service/ArrayOfVariantquantitystruct.java | 2bc29e204cd18f77288852f16749eab8fa70b257 | [] | no_license | virtum/auctionFinderBackend | 2d8d365031600682253015e5780f59384bebd300 | fc154588ef5d12cb450894ebb55443c7848a4490 | refs/heads/master | 2021-01-19T18:25:25.768759 | 2018-07-08T11:03:32 | 2018-07-08T11:03:32 | 88,360,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,268 | java |
package https.webapi_allegro_pl.service;
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.XmlType;
import org.apache.cxf.jaxb.JAXBToStringBuilder;
import org.apache.cxf.jaxb.JAXBToStringStyle;
/**
* <p>Java class for ArrayOfVariantquantitystruct complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ArrayOfVariantquantitystruct">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="item" type="{https://webapi.allegro.pl/service.php}VariantQuantityStruct" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfVariantquantitystruct", propOrder = {
"item"
})
public class ArrayOfVariantquantitystruct {
protected List<VariantQuantityStruct> item;
/**
* Gets the value of the item 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 item property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getItem().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link VariantQuantityStruct }
*
*
*/
public List<VariantQuantityStruct> getItem() {
if (item == null) {
item = new ArrayList<VariantQuantityStruct>();
}
return this.item;
}
/**
* Generates a String representation of the contents of this type.
* This is an extension method, produced by the 'ts' xjc plugin
*
*/
@Override
public String toString() {
return JAXBToStringBuilder.valueOf(this, JAXBToStringStyle.DEFAULT_STYLE);
}
}
| [
"[email protected]"
] | |
6c6f1f057d0d570240eefa1e692ac2b350f32306 | 72d8c49e7571e9f3528980023e9753ab68342fe7 | /mysite02/src/main/java/com/douzone/mysite/action/user/JoinAction.java | f4507055005ff0d8f8173c2cda8fe05832684ce8 | [] | no_license | y00jin/mysite | a190d4511e015c2479284d4e95d9ad11300802fe | beb87ffa4d45cd1777fccd73872b6c9efff238f0 | refs/heads/master | 2022-12-23T16:40:30.422014 | 2020-04-17T01:06:48 | 2020-04-17T01:06:48 | 239,651,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,029 | java | package com.douzone.mysite.action.user;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.douzone.mysite.repository.UserRepository;
import com.douzone.mysite.vo.UserVo;
import com.douzone.web.action.Action;
import com.douzone.web.util.WebUtil;
public class JoinAction implements Action {
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String name = request.getParameter("name");
String email = request.getParameter("email");
String password = request.getParameter("password");
String gender = request.getParameter("gender");
UserVo userVo = new UserVo();
userVo.setName(name);
userVo.setEmail(email);
userVo.setPassword(password);
userVo.setGender(gender);
new UserRepository().insert(userVo);
WebUtil.redirect(request.getContextPath() + "/user?a=joinsuccess", request, response);
}
}
| [
"[email protected]"
] | |
44130d0c08907aa0a6d4e1ece22787c61e6a7a4f | 230bcb399293a3d8255fab5249832553af453f62 | /ParserMC3/src/main/java/com/example/ParserMC3/entity/LightEntity/ExplorerLight.java | 1481e8a2ff525292b57172147d1538f586e7127d | [] | no_license | KostyaKrivonos/parser | b0ac6376d26f25a179197a78b62e42723820cc3f | 3a98a6990f65b14fd2b48418d40a26e6eebe7dcd | refs/heads/master | 2020-03-30T10:04:02.957868 | 2018-10-01T14:53:37 | 2018-10-01T14:53:37 | 151,104,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package com.example.ParserMC3.entity.LightEntity;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "explorer")
public class ExplorerLight implements Serializable {
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
public ExplorerLight() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
| [
"[email protected]"
] | |
34eae296f0303b2cc5870f1c0553773a524580aa | 1c9c9d04cc5ca63cb541c8210853944de8c3682f | /thinkin/src/generic/wipe/BasicBounds.java | 3276af13e475aa983c8d21f7c28683657eda2058 | [] | no_license | kailinguo/study | d6ca2f98f9fdb8e32960bfcfae59fa8e64ff855c | 6f69d0f144cf4f253936fc58289703faf4574429 | refs/heads/master | 2021-01-01T06:06:34.957154 | 2018-05-10T12:23:47 | 2018-05-10T12:23:47 | 97,355,940 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,736 | java | package generic.wipe;
import java.awt.*;
/**
* Created by KaiLin.Guo on 2018-04-08.
* 边界 extends 多个(1 class & n interface)
*/
public class BasicBounds {
public static void main(String[] args) {
Solid<Bounded> solid = new Solid<>(new Bounded());
solid.color();
solid.getY();
solid.weight();
}
}
interface HasColord {
Color getColor();
}
class Colored<T extends HasColord> {
T item;
public Colored(T item) {
this.item = item;
}
public T getItem() {
return item;
}
Color color() {
return item.getColor();
}
}
class Dimension {
public int x,y,z;
}
// class must be first, then interfaces, such as Dimension & HasColord
class ColoredDimension<T extends Dimension & HasColord> {
T item;
public ColoredDimension(T item) {
this.item = item;
}
public T getItem() {
return item;
}
Color color() {
return item.getColor();
}
int getX() { return item.x; }
int getY() { return item.y; }
int getZ() { return item.z; }
}
interface Weight { int weight(); }
class Solid<T extends Dimension & HasColord & Weight> {
T item;
public Solid(T item) {
this.item = item;
}
public T getItem() {
return item;
}
Color color() {
return item.getColor();
}
int getX() { return item.x; }
int getY() { return item.y; }
int getZ() { return item.z; }
int weight() {
return item.weight();
}
}
class Bounded extends Dimension implements HasColord,Weight {
@Override
public Color getColor() {
return null;
}
@Override
public int weight() {
return 0;
}
}
| [
"[email protected]"
] | |
ddca3112be5d010dcaa708edeefaed17b45f980e | bf801299ffac62c5fcc0a0defa9adc3b18866080 | /delivery-send-mail-ribbon-service/src/main/java/com/twoyum/controller/SendMailConsumerController.java | e3d6439a2db4e2c1ba06db05895ff3ab128ad02c | [] | no_license | cathyzhuzhu/delivery-java-dev | c13015002a56b8e3cd14accfe518fced7cbfb216 | 17c065b00a4074c857ba8ab713a4d87daee37657 | refs/heads/master | 2020-03-23T18:29:21.353191 | 2018-07-22T16:41:59 | 2018-07-22T16:41:59 | 141,912,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,271 | java | package com.twoyum.controller;
import com.twoyum.domain.SendMailInDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8;
@RestController
@RequestMapping("sendMailConsumer")
public class SendMailConsumerController {
@Autowired
private RestTemplate restTemplate;
@RequestMapping(value = "/sendTemplateMail", method = RequestMethod.POST)
public String sendMailRibbonConsumer(@RequestBody SendMailInDto sendMailInDto) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(APPLICATION_JSON_UTF8);
HttpEntity<SendMailInDto> entity = new HttpEntity<>(sendMailInDto, headers);
return restTemplate.postForObject("http://delivery-send-mail-service/sendMail/sendTemplateMail",entity, String.class);
}
}
| [
"[email protected]"
] | |
479b87a1b443d5efd46e7011270420df69b5029b | d1171bfa7f2c03129c71012fadabe6816f23a1f1 | /app/src/main/java/com/geekydroid/retrofitexample/ApiInterface.java | 3a99d158cd87b978164ae4c8a97ac1c1a787d81a | [] | no_license | nagarajasunder-zz/RetrofitExample | 4417ac0fd944ed9eefc48c68deaec57b17fd4e00 | 122e088c0ef0b19da08e4bae826bf14551f6ee6e | refs/heads/master | 2022-12-22T18:28:13.483519 | 2020-10-07T11:47:34 | 2020-10-07T11:47:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 586 | java | package com.geekydroid.retrofitexample;
import java.util.List;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface ApiInterface {
@GET("/todos")
Call<List<Todo>> get_todos();
@GET("/todos/{id}")
Call<Todo> get_todo_by_id(@Path("id") int id);
@GET("/todos")
Call<List<Todo>> get_completed_todo(@Query("userId") int userid, @Query("completed") boolean completed);
@POST("/todos")
Call<Todo> post_todo(@Body Todo todo);
}
| [
"[email protected]"
] | |
ce87401d8fde5b7d55f108f52cb1ac539203c480 | e9cbc80e02e4a5f08e8e23f32b46aa03fd9004f3 | /syntaxtree/MessageSend.java | 691e5dd1ec84cb069d6dd921a9c50891b68f106e | [] | no_license | jiaton/Mini-Java-Compiler | 3b174cae69a7fd9e93453c17cab3e03312ca4984 | 1b92b76d12c890322a7a2b6117737911d05a8399 | refs/heads/master | 2020-12-21T21:08:17.519759 | 2020-05-21T01:52:42 | 2020-05-21T01:52:42 | 236,561,208 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,198 | java | //
// Generated by JTB 1.3.2
//
package syntaxtree;
/**
* Grammar production:
* f0 -> PrimaryExpression()
* f1 -> "."
* f2 -> Identifier()
* f3 -> "("
* f4 -> ( ExpressionList() )?
* f5 -> ")"
*/
public class MessageSend implements Node {
public PrimaryExpression f0;
public NodeToken f1;
public Identifier f2;
public NodeToken f3;
public NodeOptional f4;
public NodeToken f5;
public MessageSend(PrimaryExpression n0, NodeToken n1, Identifier n2, NodeToken n3, NodeOptional n4, NodeToken n5) {
f0 = n0;
f1 = n1;
f2 = n2;
f3 = n3;
f4 = n4;
f5 = n5;
}
public MessageSend(PrimaryExpression n0, Identifier n1, NodeOptional n2) {
f0 = n0;
f1 = new NodeToken(".");
f2 = n1;
f3 = new NodeToken("(");
f4 = n2;
f5 = new NodeToken(")");
}
public void accept(visitor.Visitor v) {
v.visit(this);
}
public <R,A> R accept(visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
public <R> R accept(visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
public <A> void accept(visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
}
| [
"[email protected]"
] | |
7df38226da058c62362768a8a45ab39df6609600 | 217d96db536ff284fc1b168bf640104f00ba1ad5 | /rifidi/trunk/org.rifidi.emulator/src/org/rifidi/emulator/io/comm/streamreader/GenericCharStreamReader.java | a3c741e3dbe66dce8104b25dad9d26094b9abc38 | [] | no_license | TranscendsLLC/emulator | d5b94965b8ebd894707c093334c51aabf30d0075 | a46c42cd2e86aafc213df7585dc923895a589446 | refs/heads/master | 2021-01-14T12:31:10.876450 | 2010-10-01T21:28:07 | 2010-10-01T21:28:07 | 43,608,652 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package org.rifidi.emulator.io.comm.streamreader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* This class is used to read bytes as characters from the socket.
* @author kyle
*
*/
public class GenericCharStreamReader implements AbstractStreamReader {
/**
* The bufferedReader that reads the socket
*/
BufferedReader bf = null;
public GenericCharStreamReader(InputStream in){
bf = new BufferedReader(new InputStreamReader(in));
}
/**
*This method reads the input stream and returns bytes
*/
public byte[] read() throws IOException {
String s = bf.readLine();
if(s!=null){
return s.getBytes();
}
else return null;
}
}
| [
"kyle@70ba6d20-ffbb-44b8-b480-e27427137dba"
] | kyle@70ba6d20-ffbb-44b8-b480-e27427137dba |
d4bbb4347ea038b5094d402eee81ffda329aa6d5 | bf0cbd0c6da64ae9636017fd1915bc198eb0aff3 | /pureAirFlowers-easysoa-demo-cxf-server/src/main/java/pureairflowers/clients/PureAirFlowersClientsImpl.java | 8797c475f52f1ebfce8a6fb42bac9932f56288f7 | [] | no_license | mdutoo/easysoa-demo-pureAirFlowers-proxy | c797731f0f2c17f10e49c4f4b44d10cfe22e2950 | 20a519d69a61756b7880ba0e9cb8bd16d4529e12 | refs/heads/master | 2020-04-27T21:34:42.130880 | 2011-05-10T13:22:47 | 2011-05-10T13:22:47 | 1,680,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 676 | java | package pureairflowers.clients;
import javax.jws.WebService;
@WebService(endpointInterface = "pureairflowers.clients.PureAirFlowersClients", serviceName = "PureAirFlowers")
public class PureAirFlowersClientsImpl implements PureAirFlowersClients {
public int getOrdersNumber(String clientId) {
System.out.println("getOrdersNumber called");
return 10;
}
/*public String repeatAfterMe(String text, int iterations) {
System.out.println("repeatAfterMe called");
StringBuffer st = new StringBuffer();
for(int i = 0; i<iterations; i++){
if(st.length() > 0){
st.append(" ; ");
}
st.append(text);
}
return st.toString();
}*/
}
| [
"[email protected]"
] | |
8d0a2a8f9dc983e9e551acce778579b3fc859d0f | 0bcb965145705d097b78ecbf0cee4df2660ef1dd | /src/MenuAdministrateur.java | 48ae4e1856b7b1be6de4317b0e9ac4d406171c86 | [] | no_license | halimakhabbouch20/Projet-d-examen-IHM | c963f3df5a049e906e238fca38cfd366d5b53f55 | 747b575554034d7041ae5961de8c58fade17e416 | refs/heads/master | 2022-11-10T16:54:26.873139 | 2020-07-01T06:26:18 | 2020-07-01T06:26:18 | 276,222,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,384 | java | import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class MenuAdministrateur extends JFrame {
private JPanel contentPane;
void Fermer(){
dispose();
}
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MenuAdministrateur frame = new MenuAdministrateur();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MenuAdministrateur() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 1000, 500);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel_4 = new JLabel(" GESTION DES ETUDIANTS ECOLE ANONYME");
lblNewLabel_4.setBounds(165, 11, 685, 75);
lblNewLabel_4.setForeground(Color.ORANGE);
lblNewLabel_4.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 26));
contentPane.add(lblNewLabel_4);
JButton btnNewButton = new JButton("");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
GestionUsers obj = new GestionUsers();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
Fermer();
}
});
btnNewButton.setBounds(10, 144, 173, 184);
btnNewButton.setIcon(new ImageIcon("C:\\Users\\halima\\Desktop\\ajouter.jpg"));
contentPane.add(btnNewButton);
JLabel lblNewLabel_1 = new JLabel("Gestion des Utilisateurs");
lblNewLabel_1.setFont(new Font("Sitka Text", Font.PLAIN, 14));
lblNewLabel_1.setBounds(10, 339, 173, 14);
contentPane.add(lblNewLabel_1);
JButton btnNewButton_1 = new JButton("New button");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GestionEtudiants obj = new GestionEtudiants();
obj.setVisible(true);
obj.setLocationRelativeTo(null);
Fermer();
}
});
btnNewButton_1.setIcon(new ImageIcon("C:\\Users\\halima\\Desktop\\gestion.jpg"));
btnNewButton_1.setBounds(215, 144, 164, 184);
contentPane.add(btnNewButton_1);
JLabel lblNewLabel_2 = new JLabel("Gestion des Etudiants");
lblNewLabel_2.setFont(new Font("Sitka Text", Font.PLAIN, 14));
lblNewLabel_2.setBounds(225, 339, 154, 14);
contentPane.add(lblNewLabel_2);
JButton btnNewButton_2 = new JButton("New button");
btnNewButton_2.setIcon(new ImageIcon("C:\\Users\\halima\\Desktop\\note.png"));
btnNewButton_2.setBounds(413, 144, 164, 184);
contentPane.add(btnNewButton_2);
JLabel lblNewLabel_3 = new JLabel("Gestion des Notes");
lblNewLabel_3.setFont(new Font("Sitka Text", Font.PLAIN, 14));
lblNewLabel_3.setBounds(423, 339, 154, 14);
contentPane.add(lblNewLabel_3);
JButton btnNewButton_3 = new JButton("New button");
btnNewButton_3.setIcon(new ImageIcon("C:\\Users\\halima\\Desktop\\fi.jpg"));
btnNewButton_3.setBounds(612, 144, 164, 184);
contentPane.add(btnNewButton_3);
JLabel lblNewLabel_5 = new JLabel("Gestion des Filieres");
lblNewLabel_5.setFont(new Font("Sitka Text", Font.PLAIN, 14));
lblNewLabel_5.setBounds(624, 339, 152, 14);
contentPane.add(lblNewLabel_5);
JButton btnNewButton_4 = new JButton("New button");
btnNewButton_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnNewButton_4.setIcon(new ImageIcon("C:\\Users\\halima\\Desktop\\matiere.png"));
btnNewButton_4.setBounds(810, 144, 164, 184);
contentPane.add(btnNewButton_4);
JLabel lblNewLabel_6 = new JLabel("Gestion des Mati\u00E8res");
lblNewLabel_6.setFont(new Font("Sitka Text", Font.PLAIN, 14));
lblNewLabel_6.setBounds(820, 339, 144, 14);
contentPane.add(lblNewLabel_6);
JLabel lblNewLabel = new JLabel("New label");
lblNewLabel.setBounds(0, 0, 984, 461);
lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 10));
lblNewLabel.setIcon(new ImageIcon("C:\\Users\\halima\\Desktop\\bleu.png"));
contentPane.add(lblNewLabel);
}
}
| [
"[email protected]"
] |
Subsets and Splits