blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
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
listlengths 1
1
| author_id
stringlengths 0
313
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7cf5e1d33b79822a932b43c571c59e7f8a41022f
|
bc3a0dc5974384f8e8a12a29c6a194543cf855c4
|
/src/javatests/com/wix/rulesjvm/test_discovery/JunitSuffixE2E.java
|
f097a07f6c62a542053a5eb792c7b7838cd59aa5
|
[
"MIT"
] |
permissive
|
wix-incubator/rules_jvm_test_discovery
|
19151254ef360f1a01537d36090d1b2704412973
|
947de23620b14e62699fd63d32688718a52d9bec
|
refs/heads/master
| 2023-04-07T05:04:36.818485
| 2021-03-05T05:07:16
| 2021-03-05T05:07:16
| 186,896,710
| 1
| 2
|
MIT
| 2023-03-19T19:58:28
| 2019-05-15T20:16:33
|
Java
|
UTF-8
|
Java
| false
| false
| 210
|
java
|
package com.wix.rulesjvm.test_discovery;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class JunitSuffixE2E {
@Test
public void someTest() {
assertEquals(1, 1);
}
}
|
[
"natans@wix.com"
] |
natans@wix.com
|
8b34e9461f2d045063a91c2cddc3761d58f886bf
|
030f96a0958050f439e5f86dd2367809f034488f
|
/src/instagramimpl/InstagramHandler.java
|
bfd2a2d71de5d4cb642d68273e16b0f84626e345
|
[] |
no_license
|
Ahel11/insta
|
c88ed6df6ab003a4b18678dcf5cbc51a82baf155
|
3b166aa5de3c367802866692484511489938467e
|
refs/heads/master
| 2020-08-06T01:41:14.636508
| 2020-03-13T16:28:39
| 2020-03-13T16:28:39
| 212,787,484
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,089
|
java
|
package instagramimpl;
import model.InstagramUserRecord;
import org.brunocvcunha.instagram4j.Instagram4j;
import org.brunocvcunha.instagram4j.requests.InstagramGetUserFollowersRequest;
import org.brunocvcunha.instagram4j.requests.InstagramSearchUsernameRequest;
import org.brunocvcunha.instagram4j.requests.payload.InstagramGetUserFollowersResult;
import org.brunocvcunha.instagram4j.requests.payload.InstagramSearchUsernameResult;
import org.brunocvcunha.instagram4j.requests.payload.InstagramUser;
import org.brunocvcunha.instagram4j.requests.payload.InstagramUserSummary;
import java.util.ArrayList;
import java.util.List;
public class InstagramHandler {
private String username;
private String pass;
private Instagram4j instagram;
public InstagramHandler(String username, String password) {
this.username = username;
this.pass = password;
login();
}
private void login() {
try {
instagram = Instagram4j.builder().username(this.username).password(this.pass).build();
instagram.setup();
instagram.login();
}catch (Exception e) {
e.printStackTrace();
}
}
public InstagramUserRecord fetchUser(String userId) {
try {
InstagramSearchUsernameResult userResult = instagram.sendRequest(new InstagramSearchUsernameRequest(userId));
userResult.getUser().getPublic_phone_number();
return convertToInstaUser(userResult.getUser());
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
public ArrayList<InstagramUserRecord> getUserFollowerList(long pk) {
ArrayList<InstagramUserRecord> followerList = new ArrayList<>();
try {
InstagramGetUserFollowersResult followers = instagram.sendRequest(new InstagramGetUserFollowersRequest(pk));
List<InstagramUserSummary> users = followers.getUsers();
for(InstagramUserSummary sum: users) {
InstagramUserRecord rec = new InstagramUserRecord();
rec.setPk(sum.getPk());
rec.setName(sum.getUsername());
followerList.add(rec);
}
}catch (Exception e) {
e.printStackTrace();
}
return followerList;
}
private InstagramUserRecord convertToInstaUser(InstagramUser u) {
InstagramUserRecord rec = new InstagramUserRecord();
rec.setName(u.getUsername());
rec.setBio(u.getBiography());
rec.setFollowersCount(u.getFollower_count());
rec.setFollowingCount(u.getFollowing_count());
rec.setPhoneNumber(u.getPublic_phone_number());
rec.setMediaCount(u.getMedia_count());
rec.setPk(u.getPk());
return rec;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
}
|
[
"ahmadelmir7@hotmail.com"
] |
ahmadelmir7@hotmail.com
|
2edf151232adab3c6f394a37564e55aa5d171627
|
9e5a0e0aca2c632403e84ffa477c6fd44eab2949
|
/android/build/generated/source/buildConfig/debug/com/mygdx/game/BuildConfig.java
|
ec59b0f8525b6e169f10f246ac5e55d705dc532f
|
[] |
no_license
|
SarinViktor8755/hm_team_battel
|
81207cae68e6eedb44a47dc7e088b8bb07e9f1bf
|
8cd47dee59770d1be8f62a2cc8dcefe07650f928
|
refs/heads/main
| 2023-06-06T21:38:50.081293
| 2021-07-16T12:55:05
| 2021-07-16T12:55:05
| 351,748,435
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 446
|
java
|
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.mygdx.game;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.HotLine.Team.Battle";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 105;
public static final String VERSION_NAME = "1.3";
}
|
[
"sarin_v@list.ru"
] |
sarin_v@list.ru
|
c37e5d849ce7ffb3433710e128d3db3c58207617
|
e41f66279815a478894b0daa791781d7416ff83b
|
/app/src/main/java/com/club/business/ProfileDetails.java
|
ac0db22d4166c7f6df5fd2b663e9470596785eb6
|
[] |
no_license
|
aakashniwane9/EntrepreneursClub
|
b4bde5838a08e04ec16c14bacb1cb211ae275202
|
3526df5d7262c795370607a05dc27898721652ea
|
refs/heads/master
| 2020-08-02T10:03:04.576757
| 2019-09-27T13:09:08
| 2019-09-27T13:09:08
| 211,311,768
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 12,814
|
java
|
package com.club.business;
import android.Manifest;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.InputType;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.club.business.Firebase.UserFirebase;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.UserProfileChangeRequest;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.mikhaellopez.circularimageview.CircularImageView;
import com.squareup.picasso.Picasso;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import static android.view.View.VISIBLE;
public class ProfileDetails extends AppCompatActivity {
private static final int PICK_IMAGE = 100;
int imageaddedcode;
Button update;
EditText pd_name,pd_email,pd_contact,b_name,b_gstin,b_city,b_haves,b_wants;
Spinner b_industry,b_scale,b_nature;
FirebaseDatabase mDatabase;
FirebaseStorage storage;
FirebaseAuth mAuth;
DatabaseReference myRef;
FirebaseUser firebaseUser;
StorageReference storageReference;
CircularImageView display_picure;
Uri imageUri;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile_details);
mDatabase = FirebaseDatabase.getInstance();
myRef = mDatabase.getReference("Club");
mAuth = FirebaseAuth.getInstance();
imageaddedcode = 5149;
storage = FirebaseStorage.getInstance();
storageReference = storage.getReference();
update= findViewById(R.id.profile_details_btn_update);
pd_name=findViewById(R.id.et_username);
pd_email=findViewById(R.id.et_email);
pd_contact=findViewById(R.id.et_phone);
b_name=findViewById(R.id.profile_details_business_name);
b_gstin=findViewById(R.id.profile_details_business_GSTIN_number);
b_city=findViewById(R.id.profile_details_business_city);
b_haves=findViewById(R.id.profile_details_haves);
b_wants=findViewById(R.id.profile_details_wants);
b_industry=findViewById(R.id.profile_details_business_type);
b_scale=findViewById(R.id.profile_details_business_scale);
b_nature=findViewById(R.id.profile_details_business_nature);
display_picure = findViewById(R.id.activity_profile_profile_display_picture);
pd_name.setEnabled(false);
pd_name.setFocusableInTouchMode(false);
pd_name.setInputType(InputType.TYPE_NULL);
pd_email.setEnabled(false);
pd_email.setFocusableInTouchMode(false);
pd_email.setInputType(InputType.TYPE_NULL);
pd_contact.setEnabled(false);
pd_contact.setFocusableInTouchMode(false);
pd_contact.setInputType(InputType.TYPE_NULL);
firebaseUser = mAuth.getCurrentUser();
myRef.child("users").child(firebaseUser.getUid()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
try {
pd_name.setText(dataSnapshot.child("username").getValue().toString());
pd_email.setText(dataSnapshot.child("email").getValue().toString());
pd_contact.setText(dataSnapshot.child("contact").getValue().toString());
b_name.setText(dataSnapshot.child("BusinessName").getValue().toString());
b_gstin.setText(dataSnapshot.child("GSTIN").getValue().toString());
// b_industry.select(dataSnapshot.child("contact").getValue().toString());
// b_scale.setText(dataSnapshot.child("contact").getValue().toString());
// b_nature.setText(dataSnapshot.child("contact").getValue().toString());
b_city.setText(dataSnapshot.child("City").getValue().toString());
b_haves.setText(dataSnapshot.child("Have").getValue().toString());
b_wants.setText(dataSnapshot.child("Want").getValue().toString());
firebaseUser = mAuth.getCurrentUser();
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
.setPhotoUri(Uri.parse(dataSnapshot.child("displayurl").getValue().toString()))
.build();
firebaseUser.updateProfile(profileUpdates)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(ProfileDetails.this, "User Updated!", Toast.LENGTH_SHORT).show();
//Log.d(TAG, "User profile updated.");
}
}
});
Toast.makeText(getApplicationContext(), "Profile Details Generated", Toast.LENGTH_SHORT).show();
}catch (Exception e){
e.printStackTrace();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText(getApplicationContext(), "Check your Internet", Toast.LENGTH_SHORT).show();
}
});
display_picure.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.M){
if (ContextCompat.checkSelfPermission(ProfileDetails.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){
Toast.makeText(ProfileDetails.this, "Permission Denied", Toast.LENGTH_SHORT).show();
ActivityCompat.requestPermissions(ProfileDetails.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},1);
}else {
Intent dp = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(dp,PICK_IMAGE);
}
}
}
});
update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ProgressDialog pd = new ProgressDialog(ProfileDetails.this);
pd.setMessage("Updating Profile..");
pd.show();
final UserFirebase user=new UserFirebase();
user.setBusinessName(b_name.getText().toString().trim());
user.setGSTIN(b_gstin.getText().toString().trim());
user.setIndustry(b_industry.getSelectedItem().toString().trim());
user.setScale(b_scale.getSelectedItem().toString().trim());
user.setNature(b_nature.getSelectedItem().toString().trim());
user.setCity(b_city.getText().toString().trim() + ", India");
user.setHaves(b_haves.getText().toString().trim());
user.setWants(b_wants.getText().toString().trim());
firebaseUser = mAuth.getCurrentUser();
myRef.child("users").child(firebaseUser.getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(final DataSnapshot dataSnapshot) {
if(imageaddedcode != 5149){
final StorageReference ref = storageReference.child("displayPicture/" + UUID.randomUUID().toString());
UploadTask uploadTask = ref.putFile(imageUri);
Task<Uri> urlTask = uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
@Override
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
if (!task.isSuccessful()) {
throw task.getException();
}
// Continue with the task to get the download URL
return ref.getDownloadUrl();
}
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
@Override
public void onComplete(@NonNull Task<Uri> task) {
if (task.isSuccessful()) {
final Uri downloadUri = task.getResult();
//StaticValues.imageURL=downloadUri.toString();
dataSnapshot.getRef().child("Username").setValue(user.getUsername());
dataSnapshot.getRef().child("BusinessName").setValue(user.getBusinessName());
dataSnapshot.getRef().child("GSTIN").setValue(user.getGSTIN());
dataSnapshot.getRef().child("Industry").setValue(user.getIndustry());
dataSnapshot.getRef().child("Scale").setValue(user.getScale());
dataSnapshot.getRef().child("Nature").setValue(user.getNature());
dataSnapshot.getRef().child("City").setValue(user.getCity());
dataSnapshot.getRef().child("Have").setValue(user.getHaves());
dataSnapshot.getRef().child("Want").setValue(user.getWants());
dataSnapshot.getRef().child("displayurl").setValue(downloadUri.toString());
} else {
// Handle failures
// ...
}
}
});
}
Toast.makeText(ProfileDetails.this, "Updated Successfully", Toast.LENGTH_SHORT).show();
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.d("User", databaseError.getMessage());
}
});
startActivity(new Intent(ProfileDetails.this,HomePage.class));
}
});
}
@Override
protected void onStart() {
super.onStart();
FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();
if (currentUser == null) {
finish();
Intent intent = new Intent(getApplicationContext(),Login.class);
startActivity(intent);
}
}
@Override
protected void onActivityResult(int requestCode,int resultCode, Intent data){
super.onActivityResult(requestCode,resultCode,data);
if (resultCode == RESULT_OK && requestCode == PICK_IMAGE){
imageaddedcode = resultCode;
Toast.makeText(this, ""+resultCode, Toast.LENGTH_SHORT).show();
imageUri = data.getData();
display_picure.setImageURI(imageUri);
}
}
public void sendtoMain(){
Intent intent = new Intent(ProfileDetails.this,Login.class);
startActivity(intent);
finish();
}
}
|
[
"aakash.niwane@spit.ac.in"
] |
aakash.niwane@spit.ac.in
|
27ec27e1757ef40de5c44b213016eac69af873e4
|
fab17be9f8f8e67984da5b6ce26e87d1b2134ca9
|
/javastub/src/PatternStub.java
|
0e82ed9ccd4625e80d50783e642aee17e6df409b
|
[] |
no_license
|
greatitman/javastub
|
c28be6c3b0928afbe17dc5454efed95990417be2
|
83a29f21e6063f1b7a8b5175721f0e79eeb92ff1
|
refs/heads/master
| 2020-12-25T19:27:14.704379
| 2016-05-13T06:36:35
| 2016-05-13T06:36:35
| 58,707,956
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 507
|
java
|
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by skyworth on 2016/5/13.
*/
public class PatternStub {
public static boolean needWordFilePreview(String filename) {
boolean isNeed = true;
String pattern = "(.*)\\.(txt|png|gif|jpg|jpeg)$";
// Create a Pattern object
Pattern r = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
// Now create matcher object.
Matcher m = r.matcher(filename);
if (m.find( )) {
isNeed = false;
}
return isNeed;
}
}
|
[
"agiletiger@qq.com"
] |
agiletiger@qq.com
|
4ac07f33f62fef3aed86c775b1ce80673f8c3db8
|
e584f8793656d7a2683d83a65e0e7e4b01b0759f
|
/src/main/java/ru/geekbrains/persist/repo/ProductRepository.java
|
11037c4bdf176134311f5325d1f42e2a2a977601
|
[] |
no_license
|
alt277/Springboot-HW5.2
|
464c300f9e9fc7ea4a0cf4f22090cca505d17ea2
|
e21f2e7aa3cc03df5c84074254f79d402e06e6a4
|
refs/heads/master
| 2023-01-16T02:58:12.617994
| 2020-11-29T18:27:57
| 2020-11-29T18:27:57
| 317,015,999
| 0
| 0
| null | 2020-11-29T18:33:16
| 2020-11-29T18:26:32
|
Java
|
UTF-8
|
Java
| false
| false
| 1,644
|
java
|
package ru.geekbrains.persist.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import ru.geekbrains.persist.entity.Product;
import java.util.List;
@Repository
public interface ProductRepository extends JpaRepository<Product, Integer> ,JpaSpecificationExecutor<Product>{
List<Product> findByTitleLike(String title);
List<Product> findMaxPrice();
List<Product> findByTitleOrderByPriceDesc(String title);
/* если НЕДОСТАТОЧНО стандартных методов методов JpaRepository
аннотация - @Query указывает Spring чтобы он САМОСТОЯТЕЛЬНО создал ОБЪЕКТ КЛАССА,
реализующего интерфейс JpaRepository
и указаваем свой запрос: */
@Query("select p from Product p where p.price= ( select MIN (p.price) from Product p) ")
Product findMinPrice();
/* если есть параметр у функции
обязательно указать имя столбца в @Param("title"),
которое присваиваивается переменной в запросе */
@Query("select p from Product p where p.title=:title or p.title is null")
List<Product> findByQueryTitle(@Param("title") String title);
}
|
[
"altima875@gmail.com"
] |
altima875@gmail.com
|
b1a75a13777744e72fef83786e1f7c79d3278493
|
0436d6ed1606ef0566193000c882e2f8e6d13fd3
|
/app/src/test/java/com/pamsillah/wakho/ExampleUnitTest.java
|
f14b2aafdcc903f06d46656b52d2cb7431004275
|
[] |
no_license
|
allenbonasy/Wako-APP
|
e89823b9edc276a8f6fd01c1dddfbda7e10f35bc
|
acca9f1d79c6bce4240f39d25dd74d66ec89cd68
|
refs/heads/master
| 2020-09-25T05:28:21.932971
| 2019-12-03T13:00:59
| 2019-12-03T13:00:59
| 225,927,820
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 323
|
java
|
package com.pamsillah.wakho;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"allenbonasy@gmail.com"
] |
allenbonasy@gmail.com
|
fdd61f0299134328da08ea17b87cac3fd98c6e5b
|
90a410507df527c84e4ea1c6262daafaaf68add8
|
/04-jaxrs-protected-customsecuritycontext-ejb-integration/src/main/java/org/thoth/jaxrs/security/principal/MyPrincipal.java
|
f9e71939ef33c2e6501caec11f28ff7e74196e27
|
[] |
no_license
|
mjremijan/thoth-jaxrs
|
eaf7c05df52f4fb9b411af67ea49711db665e32f
|
0e351c73e8b55db702014295f005e86381433b0d
|
refs/heads/master
| 2021-05-03T11:43:06.916422
| 2017-08-27T11:47:49
| 2017-08-27T11:47:49
| 69,028,599
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 629
|
java
|
package org.thoth.jaxrs.security.principal;
import java.security.Principal;
import java.util.Collections;
import java.util.List;
/**
*
* @author Michael Remijan mjremijan@yahoo.com @mjremijan
*/
public class MyPrincipal implements Principal {
private String name;
private List<String> role;
@Override
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getRole() {
return role;
}
public void setRole(List<String> role) {
this.role = Collections.unmodifiableList(role);
}
}
|
[
"mjremijan@yahoo.com"
] |
mjremijan@yahoo.com
|
ee07b1663d41a052b8a47c6af9baa846cd42db09
|
76ec1079627b780eef1b46f5912cd9d95401a1ea
|
/src/main/java/com/mrcrayfish/modelcreator/integrate/IntegrateLoot.java
|
2effdf7ff8b914d462de64384aa7cbb712e8456c
|
[
"Apache-2.0"
] |
permissive
|
Bricktricker/ModelCreator
|
9b19beede0b9f9e10bcf625d6c8a67240868dbef
|
4017e926330ee116dbe7fd50c1c111603cf5ea27
|
refs/heads/master
| 2020-05-30T13:07:21.667382
| 2019-10-12T22:06:57
| 2019-10-12T22:06:57
| 189,751,736
| 1
| 0
|
NOASSERTION
| 2019-06-01T15:59:42
| 2019-06-01T15:59:42
| null |
UTF-8
|
Java
| false
| false
| 2,413
|
java
|
package com.mrcrayfish.modelcreator.integrate;
import java.io.IOException;
import java.nio.file.Path;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.mrcrayfish.modelcreator.block.BlockManager;
import com.mrcrayfish.modelcreator.util.Util;
public class IntegrateLoot extends Integrator
{
@Override
public String generate() {
JsonObject loot = new JsonObject();
loot.addProperty("type", "minecraft:block");
JsonArray pools = new JsonArray();
JsonObject pool = new JsonObject();
pool.addProperty("rolls", BlockManager.loot.getNumDrops());
pool.addProperty("name", "pool1");
JsonArray entries = new JsonArray();
JsonObject entry = new JsonObject();
entry.addProperty("type", "minecraft:item");
String drop;
if(BlockManager.loot.getDropItem() == null) {
drop = getItemForBlock();
}else {
drop = addModid(BlockManager.loot.getDropItem());
}
entry.addProperty("name", drop);
entries.add(entry);
pool.add("entries", entries);
JsonArray conditions = new JsonArray();
JsonObject condition = BlockManager.loot.isSilkTouch() ? getSilkCondition() : getExplotionCondition();
conditions.add(condition);
pool.add("conditions", conditions);
pools.add(pool);
loot.add("pools", pools);
return builder.toJson(loot);
}
@Override
public void integrate() {
Path craftingPath = getDataFolder().resolve("loot_tables").resolve("blocks").resolve(IntegrateDialog.assetName + ".json");
try{
writeToFile(craftingPath, content + "\n");
} catch (IOException e) {
Util.writeCrashLog(e);
}
startTextEditor(craftingPath);
}
private JsonObject getExplotionCondition() {
JsonObject condition = new JsonObject();
condition.addProperty("condition", "minecraft:survives_explosion");
return condition;
}
private JsonObject getSilkCondition() {
JsonObject condition = new JsonObject();
condition.addProperty("condition", "minecraft:match_tool");
JsonObject predicate = new JsonObject();
JsonArray enchantments = new JsonArray();
JsonObject enchantment = new JsonObject();
enchantment.addProperty("enchantment", "minecraft:silk_touch");
JsonObject levels = new JsonObject();
levels.addProperty("min", 1);
enchantment.add("levels", levels);
enchantments.add(enchantment);
predicate.add("enchantments", enchantments);
condition.add("predicate", predicate);
return condition;
}
}
|
[
"philipphuettig@arcor.de"
] |
philipphuettig@arcor.de
|
9da006bea4f2b6ad5de32a9c0b16fb9b00cbbf8f
|
10a61a5d12ff7995a3f1729a213f5c3b11e56cc9
|
/src/main/java/com/st/dream/designPattern/singleton/SingleTonEnum.java
|
cc077aef0a4b042d8f4303670928202e11ef36cb
|
[] |
no_license
|
xuhao890627/dream
|
9e2ace7027c23bc8ebeca22bc39ae2199e7bd301
|
ee5cb5f9b894fa2d604a6a9fd1a4534da4e91340
|
refs/heads/master
| 2022-07-07T09:52:08.888570
| 2019-09-26T13:55:49
| 2019-09-26T13:55:49
| 211,100,562
| 0
| 0
| null | 2022-06-21T01:57:02
| 2019-09-26T13:50:36
|
Java
|
UTF-8
|
Java
| false
| false
| 427
|
java
|
package com.st.dream.designPattern.singleton;
public class SingleTonEnum {
public static SingleTonEnum getInstance(){
return Elvis.INSTANCE.getInstance();
}
private enum Elvis{
INSTANCE;
private SingleTonEnum instance;
Elvis() {
instance = new SingleTonEnum();
}
private SingleTonEnum getInstance() {
return instance;
}
}
}
|
[
"xuhao890627@163.com"
] |
xuhao890627@163.com
|
46730f9d6cf3fb075ade03e303e452af32e6d75c
|
e4eb547141929d5c61b3335c09904f258a65f5ea
|
/minijvm/java/src/main/java/java/io/FilterReader.java
|
45ebff84357aa1b1499b6d9245990bf80fd3215f
|
[
"MIT"
] |
permissive
|
digitalgust/miniJVM
|
14e11fa518e965ebe6c6b8172b2cacffde7a46d7
|
aa504d6c3c17a365a8f8f2ea91eb580d6ec94711
|
refs/heads/master
| 2023-08-22T12:55:31.981267
| 2023-08-10T07:09:28
| 2023-08-10T07:09:28
| 101,243,754
| 269
| 78
| null | 2023-03-08T06:50:54
| 2017-08-24T02:10:21
|
C
|
UTF-8
|
Java
| false
| false
| 3,579
|
java
|
/*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.io;
/**
* Abstract class for reading filtered character streams.
* The abstract class <code>FilterReader</code> itself
* provides default methods that pass all requests to
* the contained stream. Subclasses of <code>FilterReader</code>
* should override some of these methods and may also provide
* additional methods and fields.
*
* @version 1.17, 03/12/19
* @author Mark Reinhold
* @since JDK1.1
*/
public abstract class FilterReader extends Reader {
/**
* The underlying character-input stream.
*/
protected Reader in;
/**
* Create a new filtered reader.
*
* @param in a Reader object providing the underlying stream.
* @throws NullPointerException if <code>in</code> is <code>null</code>
*/
protected FilterReader(Reader in) {
super(in);
this.in = in;
}
/**
* Read a single character.
*
* @exception IOException If an I/O error occurs
*/
public int read() throws IOException {
return in.read();
}
/**
* Read characters into a portion of an array.
*
* @exception IOException If an I/O error occurs
*/
public int read(char cbuf[], int off, int len) throws IOException {
return in.read(cbuf, off, len);
}
/**
* Skip characters.
*
* @exception IOException If an I/O error occurs
*/
public long skip(long n) throws IOException {
return in.skip(n);
}
/**
* Tell whether this stream is ready to be read.
*
* @exception IOException If an I/O error occurs
*/
public boolean ready() throws IOException {
return in.ready();
}
/**
* Tell whether this stream supports the mark() operation.
*/
public boolean markSupported() {
return in.markSupported();
}
/**
* Mark the present position in the stream.
*
* @exception IOException If an I/O error occurs
*/
public void mark(int readAheadLimit) throws IOException {
in.mark(readAheadLimit);
}
/**
* Reset the stream.
*
* @exception IOException If an I/O error occurs
*/
public void reset() throws IOException {
in.reset();
}
/**
* Close the stream.
*
* @exception IOException If an I/O error occurs
*/
public void close() throws IOException {
in.close();
}
}
|
[
"digitalgust@163.com"
] |
digitalgust@163.com
|
921999e3d58a2530e27943988efd1f6a90cd2d8d
|
df77654f5be64b8500b75232374fd2fb860303b9
|
/src/thesis/nlp/util/StringProcessUtil.java
|
528a2af965b1bd8dc9a2fa30c8e459754f46b9e7
|
[] |
no_license
|
umbalaloan/thesisnlp
|
e76c066f14edce945afb4e072ad8965a75e70a8a
|
05406b250f20953dbc220a2c7ce4679c3db924b2
|
refs/heads/master
| 2021-01-10T02:02:41.784619
| 2016-03-22T00:13:28
| 2016-03-22T00:13:28
| 54,145,150
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 596
|
java
|
/**
*
*/
package thesis.nlp.util;
/**
* @author lohuynh
*
*/
public class StringProcessUtil {
public static String valueOf(Object obj)
{
return obj == null ? "" : obj.toString().trim();
}
public static boolean checkStringContainSubString(String str, String subString)
{
if (str.toLowerCase().trim().contains(subString.toLowerCase().trim()))
return true;
else
return false;
}
public static void main(String[] args) {
String str = "Socatoa";
String subStr = "Soca";
System.out.println(checkStringContainSubString(str, subStr));
}
}
|
[
"loanhuynh89@gmail.com"
] |
loanhuynh89@gmail.com
|
84134a5725b9c284af1f53af0bd1528558adf953
|
70d723492db97dcf31c630858ea994c7e15569b4
|
/SunnahActivity.java
|
816ae7f1b964c2927fa4cd15fb47218908c84bd8
|
[] |
no_license
|
ghiriuta/First-Android-Apps
|
2abd9f5a8522bd8d5a69e329387be025b351bb60
|
b3dad0671194dd590db53e16d7525e272eac4a6f
|
refs/heads/master
| 2020-12-08T10:41:56.959161
| 2020-01-10T04:08:15
| 2020-01-10T04:08:15
| 232,961,526
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,224
|
java
|
package agatepie.belajarpuasaramadhan;
import android.content.Intent;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
public class SunnahActivity extends AppCompatActivity {
ImageButton t_home;
ImageButton t_baca;
ImageButton next;
ImageButton prev;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sunnah);
t_home = (ImageButton) findViewById(R.id.home);
t_home.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick (View view) {
Intent MenuActivityIntent = new Intent (SunnahActivity.this, MenuActivity.class);
startActivity (MenuActivityIntent);
}
});
t_baca = (ImageButton) findViewById(R.id.baca);
t_baca.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick (View view) {
Intent doabukaActivityIntent = new Intent (SunnahActivity.this, doabukaActivity.class);
startActivity (doabukaActivityIntent);
}
});
prev = (ImageButton) findViewById(R.id.prev);
prev.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick (View view) {
Intent RukunActivityIntent = new Intent (SunnahActivity.this, RukunActivity.class);
startActivity (RukunActivityIntent);
}
});
next = (ImageButton) findViewById(R.id.next);
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick (View view) {
Intent RusakActivityIntent = new Intent (SunnahActivity.this, RusakActivity.class);
startActivity (RusakActivityIntent);
}
});
MediaPlayer backsound = MediaPlayer.create(SunnahActivity.this,R.raw.backsound);
backsound.start();
}
}
|
[
"noreply@github.com"
] |
ghiriuta.noreply@github.com
|
4e38bf04379b9fb1d2b18e0ef071d8a40bd5f952
|
0d431f22c1f9ccb34c81168cbfb0551619561544
|
/AntonieServer/src/com/antoinecampbell/gcmserver/User.java
|
c677a834195efdd715754125dd317e727983f3e1
|
[] |
no_license
|
tengr/workspace
|
8485c1ff47479c79f04b748d1fcc0a1bc49fd374
|
d7f8e011d42269a61acb3007f6fc23fde7d1257d
|
refs/heads/master
| 2021-01-10T02:58:59.703097
| 2015-10-12T07:20:52
| 2015-10-12T07:20:52
| 44,090,784
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 828
|
java
|
package com.antoinecampbell.gcmserver;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
@DatabaseTable(tableName = "users")
public class User
{
@DatabaseField(id=true)
private String gcm_id;
@DatabaseField(index = true)
private String name;
public User()
{
}
public User(String name, String gcm_id)
{
this.name = name;
this.gcm_id = gcm_id;
}
public String getGcm_id()
{
return gcm_id;
}
public void setGcm_id(String gcm_id)
{
this.gcm_id = gcm_id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
@Override
public String toString()
{
return name + " : " + gcm_id;
}
}
|
[
"ruichent@au1.ibm.com"
] |
ruichent@au1.ibm.com
|
de6979bb91c5350cd537c86db33eae3128b431ec
|
ad11c998c2152b4f485370cfc2d8a9e4bb072aca
|
/src/Main/Listener.java
|
875f05136a983b3e2193e6844acfdbca7abac67e
|
[] |
no_license
|
xtenzQ/2D-metaballs
|
869a8d145d8055e97e4d54f0f6568bbbe3e9d336
|
5f9c53e80267fdb2c8a500a91a67f2b9e1096809
|
refs/heads/master
| 2022-05-02T16:58:11.425568
| 2022-04-08T07:14:27
| 2022-04-08T07:14:27
| 103,397,700
| 5
| 0
| null | null | null | null |
WINDOWS-1251
|
Java
| false
| false
| 3,958
|
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 Main;
import static Main.MetaBalls.*;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import static java.lang.Math.max;
import static java.lang.Math.min;
import javax.media.opengl.GLAutoDrawable;
import javax.swing.JOptionPane;
/**
*
* @author Никита Русецкий
*/
public class Listener implements KeyListener, MouseListener, MouseWheelListener {
Point loc = new Point(0, 0);
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_1) {
Data.type = 0;
}
if (e.getKeyCode() == KeyEvent.VK_2) {
Data.type = 1;
}
if (e.getKeyCode() == KeyEvent.VK_3) {
Data.type = 2;
}
if (e.getKeyCode() == KeyEvent.VK_CONTROL) {
grid = !grid;
}
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
draw = !draw;
}
if (e.getKeyCode() == KeyEvent.VK_TAB) {
}
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
run = !run;
}
if (e.getKeyCode() == KeyEvent.VK_F1) {
JOptionPane.showMessageDialog(null,
"Колесо мыши - изменение размерности сетки \n"
+ "Клавиша 1 - Отображение блоков \n"
+ "Клавиша 2 - Метод Marching Squares \n"
+ "Клавиша 3 - Применение линейной интерполяции \n"
+ "Q / E - Изменение скорости кругов \n"
+ "W / S - Изменение количества кругов \n"
+ "A / D - Изменение размера кругов \n"
+ "SPACE - Отображение кругов \n"
+ "ENTER - Остановка симуляции \n"
+ "CTRL - Отображение сетки", "Справка", 1);
}
}
public void mouseWheelMoved(MouseWheelEvent e) {
int sign = e.getWheelRotation();
Data.tempgridStep = max(10, Data.tempgridStep - (10 * sign));
Data.tempgridStep = min(200, Data.tempgridStep);
Data.stepChanged = true;
}
public void mouseReleased(MouseEvent e) {
}
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_Q) {
Data.speedCoef = max(0, Data.speedCoef - 1);
}
if (e.getKeyCode() == KeyEvent.VK_E) {
Data.speedCoef = min(20, Data.speedCoef + 1);
}
if (e.getKeyCode() == KeyEvent.VK_A) {
Data.circleSize = max(1, Data.circleSize - 1);
}
if (e.getKeyCode() == KeyEvent.VK_D) {
Data.circleSize = min(50, Data.circleSize + 1);
}
if (e.getKeyCode() == KeyEvent.VK_S) {
Data.circleCount = max(1, Data.circleCount - 1);
}
if (e.getKeyCode() == KeyEvent.VK_W) {
Data.circleCount = min(50, Data.circleCount + 1);
}
}
public void keyTyped(KeyEvent e) {
}
public void mouseClicked(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void init(GLAutoDrawable drawable) {
}
public void display(GLAutoDrawable drawable) {
}
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
}
|
[
"rusetscky@outlook.com"
] |
rusetscky@outlook.com
|
69480e136076de03abf46e710dfef7d94c15c5a6
|
14b667f278b14bf391e681e069efa2cea36946a3
|
/TDA550/3labb/orig2011/v4/RectangularTile.java
|
ce60b1f022e524410b88c706595279bf8fc60469
|
[] |
no_license
|
SSundstrom/OOP-OOPF
|
3c5dfa550998f7d9fdd519a1b89171b75082199f
|
30a74855cdf160509ec6b14065e294c615598ffc
|
refs/heads/master
| 2021-01-18T23:58:05.333790
| 2015-12-09T16:08:01
| 2015-12-09T16:08:01
| 42,061,957
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,078
|
java
|
package orig2011.v4;
import java.awt.*;
/**
* A rectangular tile manages painting of a
* filled rectangle in a specified area of the screen.
*
* Whenever the object should paint itself,
* it is told what size and position that
* should be used to paint it.
*/
public class RectangularTile implements GameTile {
/** The color of the rectangle */
private final Color color;
/**
* Creates a rectangular game tile.
*
* @param color
* the color of the rectangle.
*/
public RectangularTile(final Color color) {
this.color = color;
}
/**
* Draws itself in a given graphics context, position and size.
*
* @param g
* graphics context to draw on.
* @param x
* pixel x coordinate of the tile to be drawn.
* @param y
* pixel y coordinate of the tile to be drawn.
* @param d
* size of this object in pixels.
*/
@Override
public void draw(final Graphics g, final int x, final int y,
final Dimension d) {
g.setColor(this.color);
g.fillRect(x, y, d.width, d.height);
}
}
|
[
"felixja@student.chalmers.se"
] |
felixja@student.chalmers.se
|
91e1341dbf631dacf91c0d95b6b12c673f1b4cd1
|
59d51bbdf9e6529865711142cc791cd14a0abb29
|
/src/module-info.java
|
d203d40c335c00df87f5f206c71e6da6d50bed39
|
[] |
no_license
|
thuongnd18406/QuanLiSinhVien
|
25d1c4e57abaeb1ea153b3b4c462446d27aae2bd
|
6aaf0826e45fc6e449d62e57439a787576f15ced
|
refs/heads/master
| 2020-12-07T06:17:42.361591
| 2020-01-08T21:11:06
| 2020-01-08T21:11:06
| 232,656,979
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 26
|
java
|
module QuanLiSinhVien {
}
|
[
"NGO PHAM@DESKTOP-JJ6QIMP.mshome.net"
] |
NGO PHAM@DESKTOP-JJ6QIMP.mshome.net
|
c8bccebecea4cc4bf9f3bfef9b453536d6372761
|
7bd74bd61fb41115f823a8cab6ffcf3f258f4497
|
/app/src/main/java/com/example/saviola44/strengthbuilding/Activities/DisplayTrainingPlanActivity.java
|
7dd57bd72b83eb91266c7bc532202d702084796a
|
[] |
no_license
|
saviola44/StrengthBuilding
|
d52c6e4678343eadbd714d5d482337651b6ef74c
|
f0fac71f4d4e79c07d2b8e8336585eca1b115cdc
|
refs/heads/master
| 2021-01-21T15:26:14.247880
| 2016-06-28T16:19:12
| 2016-06-28T16:19:12
| 59,375,320
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,999
|
java
|
package com.example.saviola44.strengthbuilding.Activities;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import com.example.saviola44.strengthbuilding.Adapters.AddedTrainingsAdapter;
import com.example.saviola44.strengthbuilding.R;
import com.example.saviola44.strengthbuilding.StrengthBuilderApp;
import com.example.saviola44.strengthbuilding.Model.Training;
import java.util.List;
/**
* Created by saviola44 on 27.05.16.
*/
public class DisplayTrainingPlanActivity extends AppCompatActivity {
TextView trainingMathodTV;
List<Training> trainings;
AddedTrainingsAdapter adapter; //adapter dla ponizszej listy
ListView trainingsLV; //wyswietla liste treningow
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.display_cur_plan_layout);
trainingsLV = (ListView) findViewById(R.id.trainingsLV);
trainingMathodTV = (TextView) findViewById(R.id.trainingMethodTV);
StrengthBuilderApp app = StrengthBuilderApp.getInstance(getApplicationContext());
trainings = app.getPlan().getTrainings();
trainingMathodTV.setText(app.getPlan().getTrainingMethod().toString());
adapter = new AddedTrainingsAdapter(getApplicationContext(),
R.layout.added_trainings_row_layout, trainings);
trainingsLV.setAdapter(adapter);
trainingsLV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(getApplicationContext(), DisplayTrainingActivity.class);
intent.putExtra("pos", position);
startActivity(intent);
}
});
}
}
|
[
"saviola44marian@gmail.com"
] |
saviola44marian@gmail.com
|
7ed03b63a6389ee5a2957d7db79b0431991c57f9
|
256ef233af2703e379b0f2c2bd7ece12c62d48b9
|
/TemplateOne/app/src/main/java/com/demo/yadav/templateone/SignupActivity.java
|
cb6d85f9d2b90d334d7ac1fe2da6903057ee4e76
|
[] |
no_license
|
Hiteshmtxb2b/Android-Template
|
03b4eafc0740e4adbb45bcdb62ee88361076017c
|
6c9d65cc03e42d7457c16defa94f4529b4167ed5
|
refs/heads/master
| 2021-08-22T20:43:33.711588
| 2017-12-01T07:32:05
| 2017-12-01T07:32:05
| 112,705,232
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,624
|
java
|
package com.demo.yadav.templateone;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
public class SignupActivity extends AppCompatActivity {
private static final String TAG = "SignupActivity";
EditText _nameText,_addressText,_emailText,_mobileText,_passwordText,_reEnterPasswordText;
Button _signupButton ;
TextView _loginLink;
ScrollView _scroll;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
_nameText = (EditText) findViewById(R.id.input_name);
_emailText = (EditText) findViewById(R.id.input_email);
_mobileText = (EditText) findViewById(R.id.input_mobile);
_passwordText = (EditText) findViewById(R.id.input_password);
_signupButton = (Button) findViewById(R.id.btn_signup);
_loginLink = (TextView) findViewById(R.id.link_login);
_scroll = (ScrollView) findViewById(R.id.signup_scroll);
Drawable drawable=_scroll.getBackground();
drawable.setAlpha(10);
_signupButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
signup();
}
});
_loginLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Finish the registration screen and return to the Login activity
Intent intent = new Intent(getApplicationContext(),LoginActivity.class);
startActivity(intent);
finish();
overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
}
});
}
public void signup() {
Log.d(TAG, "Signup");
if (!validate()) {
onSignupFailed();
return;
}
_signupButton.setEnabled(false);
final ProgressDialog progressDialog = new ProgressDialog(SignupActivity.this,
R.style.AppTheme_Dark_Dialog);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Creating Account...");
progressDialog.show();
String name = _nameText.getText().toString();
String address = _addressText.getText().toString();
String email = _emailText.getText().toString();
String mobile = _mobileText.getText().toString();
String password = _passwordText.getText().toString();
String reEnterPassword = _reEnterPasswordText.getText().toString();
// TODO: Implement your own signup logic here.
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
// On complete call either onSignupSuccess or onSignupFailed
// depending on success
onSignupSuccess();
// onSignupFailed();
progressDialog.dismiss();
}
}, 3000);
}
public void onSignupSuccess() {
_signupButton.setEnabled(true);
setResult(RESULT_OK, null);
finish();
}
public void onSignupFailed() {
Toast.makeText(getBaseContext(), "Login failed", Toast.LENGTH_LONG).show();
_signupButton.setEnabled(true);
}
public boolean validate() {
boolean valid = true;
String name = _nameText.getText().toString();
String address = _addressText.getText().toString();
String email = _emailText.getText().toString();
String mobile = _mobileText.getText().toString();
String password = _passwordText.getText().toString();
String reEnterPassword = _reEnterPasswordText.getText().toString();
if (name.isEmpty() || name.length() < 3) {
_nameText.setError("at least 3 characters");
valid = false;
} else {
_nameText.setError(null);
}
if (address.isEmpty()) {
_addressText.setError("Enter Valid Address");
valid = false;
} else {
_addressText.setError(null);
}
if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
_emailText.setError("enter a valid email address");
valid = false;
} else {
_emailText.setError(null);
}
if (mobile.isEmpty() || mobile.length()!=10) {
_mobileText.setError("Enter Valid Mobile Number");
valid = false;
} else {
_mobileText.setError(null);
}
if (password.isEmpty() || password.length() < 4 || password.length() > 10) {
_passwordText.setError("between 4 and 10 alphanumeric characters");
valid = false;
} else {
_passwordText.setError(null);
}
if (reEnterPassword.isEmpty() || reEnterPassword.length() < 4 || reEnterPassword.length() > 10 || !(reEnterPassword.equals(password))) {
_reEnterPasswordText.setError("Password Do not match");
valid = false;
} else {
_reEnterPasswordText.setError(null);
}
return valid;
}
}
|
[
"hitesh.yadav@mtxb2b.com"
] |
hitesh.yadav@mtxb2b.com
|
e61972bfc690b3903e86e6c78db609397890ee5f
|
3da8612371c77cec5b37e3eff28a21149ba08972
|
/app/src/main/java/com/example/aarontus/helloworldapp/MainActivity.java
|
2c3af561c6e793d700647d925ff9d5fd26a3f253
|
[] |
no_license
|
tushabe/HelloWorldApp
|
0c9fe6c7389a4a8682bcec0b75335768d3d04c00
|
932faba8d6dd3edcbe10b815753da38626583b3e
|
refs/heads/master
| 2021-01-10T02:01:27.276709
| 2018-08-18T14:22:34
| 2018-08-18T14:22:34
| 36,115,803
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,184
|
java
|
package com.example.aarontus.helloworldapp;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
// TODO the needs to get done
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
[
"tushabe.aaron@gmail.com"
] |
tushabe.aaron@gmail.com
|
52b1784a615bbca91db27bd5ef52e51220d05c24
|
51f443e5afaf667e752ecb92365244d1e824b868
|
/Server/src/com/generalprocessingunit/connectivity/AndroidSensorListener.java
|
cd23a74a3e98aa38d73eb0041a68b07ad13fbe3f
|
[] |
no_license
|
Android-BD/AndroidUsbCommunication
|
49b1686159a18c558d5257549bd08de7eb5e8f6d
|
eeb46c9dd93780a63752cb1428c909629242465e
|
refs/heads/master
| 2021-01-17T14:23:18.858608
| 2014-10-03T22:47:35
| 2014-10-03T22:47:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,566
|
java
|
package com.generalprocessingunit.connectivity;
import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.util.Log;
import com.generalprocessingunit.AndroidUsbTcpSocket.AndroidSensorData;
import java.util.List;
public class AndroidSensorListener {
private AndroidSensorData sensorData = new AndroidSensorData();
// TODO: break this out into a generic Android utils project
public AndroidSensorListener(Activity activityInstance) {
SensorManager sensorManager = (SensorManager) activityInstance.getSystemService(Context.SENSOR_SERVICE);
// Log the list of available sensors
List<Sensor> sensorList = sensorManager.getSensorList(Sensor.TYPE_ALL);
for (Sensor s : sensorList) {
Log.i("Sensor", s.getName());
}
final SensorEventListener eventListener = new SensorEventListener() {
public void onAccuracyChanged(Sensor sensor, int accuracy) { }
public void onSensorChanged(SensorEvent event) {
boolean orientationChanged = false;
// Handle the events for which we registered
switch (event.sensor.getType()) {
case Sensor.TYPE_ACCELEROMETER:
System.arraycopy(event.values, 0, sensorData.mValuesAccel, 0, 3);
orientationChanged = true;
break;
case Sensor.TYPE_MAGNETIC_FIELD:
System.arraycopy(event.values, 0, sensorData.mValuesMagnet, 0, 3);
orientationChanged = true;
break;
case Sensor.TYPE_LIGHT:
sensorData.light = event.values[0];
Log.d("Light", "" + sensorData.light);
break;
case Sensor.TYPE_PROXIMITY:
sensorData.proximity = (int) event.values[0] == 0;
Log.d("Proximity", "" + sensorData.proximity);
break;
}
if (orientationChanged) {
SensorManager.getRotationMatrix(sensorData.mRotationMatrix, null, sensorData.mValuesAccel, sensorData.mValuesMagnet);
SensorManager.getOrientation(sensorData.mRotationMatrix, sensorData.mValuesOrientation);
}
onSensorDataChanged(sensorData);
}
};
setListners(sensorManager, eventListener);
}
// Register the event listener and sensor type.
private static void setListners(SensorManager sensorManager, SensorEventListener mEventListener) {
sensorManager.registerListener(mEventListener, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(mEventListener, sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(mEventListener, sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT), SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(mEventListener, sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY), SensorManager.SENSOR_DELAY_FASTEST);
}
/**
* Override to get sensor data
* @param sensorData
*/
public void onSensorDataChanged(AndroidSensorData sensorData) { }
}
|
[
"paulmchristian@gmail.com"
] |
paulmchristian@gmail.com
|
a9cb1baa499a839b9b8e5b2123836484bac88831
|
034bfa7f92c0f9dcc88073ee6bb7d184e18bab51
|
/mobile/src/main/java/sahilguptalive/com/androiddemos/constraintlayout/ConstraintLayoutActivity.java
|
fc4d492eb7018bd76928482d1cb9093188c5fb47
|
[] |
no_license
|
sahilguptalive/AndroidDemos
|
dd6408fd6b01f50262cb947bcacfb5ca995358d2
|
c9f6c043c4f4d4126022c78f90d9968a397ae7b9
|
refs/heads/master
| 2020-07-29T00:38:35.623455
| 2018-11-13T05:47:21
| 2018-11-13T05:47:21
| 73,689,382
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 522
|
java
|
package sahilguptalive.com.androiddemos.constraintlayout;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import sahilguptalive.com.androiddemos.R;
/**
* Created by sahilgupta on 07-03-2017.
*/
public class ConstraintLayoutActivity extends AppCompatActivity{
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.constraint_layout);
}
}
|
[
"sahil.gupta@nagarro.com"
] |
sahil.gupta@nagarro.com
|
8cdebce86a202a0f72be4800312c75852700e7ec
|
cd6b79a19950d55080f23364e70e456eb8e4ffb5
|
/app/src/main/java/eu/droidit/nanodegree/android/popularmovies/stage1/utils/NetworkUtils.java
|
bbb86844edf632425b829a5308c89a8a83ffa144
|
[] |
no_license
|
gjoris/popularmovies_stage1
|
8858f2abf4764b0f39c237d19c52d20b376d314f
|
40b81b34024590607fa3e3c7190a273e4facf9cf
|
refs/heads/master
| 2020-12-02T18:04:25.592212
| 2017-07-16T18:55:59
| 2017-07-16T18:55:59
| 96,468,424
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,779
|
java
|
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.droidit.nanodegree.android.popularmovies.stage1.utils;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
/**
* These utilities will be used to communicate with the network.
*/
public class NetworkUtils {
/**
* This method returns the entire result from the HTTP response.
*
* @param url The URL to fetch the HTTP response from.
* @return The contents of the HTTP response.
* @throws IOException Related to network and stream reading
*/
public static String getResponseFromHttpUrl(URL url) throws IOException {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
InputStream in = urlConnection.getInputStream();
Scanner scanner = new Scanner(in);
scanner.useDelimiter("\\A");
boolean hasInput = scanner.hasNext();
if (hasInput) {
return scanner.next();
} else {
return null;
}
} finally {
urlConnection.disconnect();
}
}
}
|
[
"info@droidit.eu"
] |
info@droidit.eu
|
d9efe260c409a9c9b3b07a6f17ab375269829fc0
|
b0b881aaa9c3c983263a8175c656dc1eea3df340
|
/profile-service/src/main/java/com/shoppingcartsystem/profileservice/service/UserService.java
|
5af4f6cc40d36d27eed3ed1f72daca92a587b547
|
[] |
no_license
|
SN-Vidya/Case-study-Shopping-cart-system
|
c3be5bce9e73901acc8af5ae78ce8139c47cfae0
|
25194c6424fb4ca5747f8a310e90e3e2fa2c5571
|
refs/heads/master
| 2023-06-03T18:31:09.977286
| 2021-06-23T03:05:13
| 2021-06-23T03:05:13
| 374,867,354
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 628
|
java
|
package com.shoppingcartsystem.profileservice.service;
import java.util.List;
import java.util.Optional;
//import java.util.Optional;
import com.shoppingcartsystem.profileservice.model.User;
public interface UserService {
List<User> getAllUser();
User addNewUser(User user);
User getByFullName(String fullName);
User updateProfile(User user);
Optional<User> getById(String _id);
User getByEmail(String email);
/*
* List<User> getAllUser();
*
* Optional<User> getUserById(String _id);
*
* User getUserByName(String fullName);
*
* User saveUser(User user);
*/
}
|
[
"snvidya1998@gmail.com"
] |
snvidya1998@gmail.com
|
a8afd557fdb15f78f20abc45c11b3215e5d5e12e
|
63640a0c358a39d9b68ee410c0ee065976019c19
|
/DebuggingExercises/NumbersDemo.java
|
4ccbafe73d0aaa92838553efeef288354d55424c
|
[] |
no_license
|
TariqTarbuck/cp2406_farrell8_ch03
|
4ad05e5c6427287c3024d59355de67ccd029dd14
|
688b6f5f911a3ab056efd447fbb477a4200d931d
|
refs/heads/master
| 2021-06-21T19:48:12.127709
| 2017-08-15T01:51:26
| 2017-08-15T01:51:26
| 100,321,969
| 0
| 0
| null | 2017-08-15T00:43:53
| 2017-08-15T00:43:53
| null |
UTF-8
|
Java
| false
| false
| 761
|
java
|
/**
* Created by jc320680 on 15/08/17.
*/
public class NumbersDemo {
public static void main(String[] args) {
int value = 100;
int valueTwo = 110;
displayTwiceTwiceTheNumber(value,valueTwo);
displayNumberPlusFive(value, valueTwo);
displayNumberSquared(value, valueTwo);
}
public static void displayTwiceTwiceTheNumber(int value, int valueTwo){
System.out.println(value*2 + " and " +valueTwo*2);
}
public static void displayNumberPlusFive(int value, int valueTwo){
System.out.println(value*5 + " and " +valueTwo*5);
}
public static void displayNumberSquared(int value, int valueTwo){
System.out.println(Math.sqrt(value) + " and " +Math.sqrt(valueTwo));
}
}
|
[
"Stegbar09"
] |
Stegbar09
|
665eb34b8cb49f09b96a69759ea2aa84885d2878
|
df01090754c867a40875f3401f9111f2e9fff16b
|
/Urna/src/main/java/controller/Autenticador.java
|
5ae2bbd392c9f282b7cbcfc681b7fa06be038fc7
|
[] |
no_license
|
KelvinSeverino/VoteON
|
eaa1530e01fa95905ce0dece8d0dec9a9690ed90
|
e743a06ccaed34384c5c772537de1bdee7be2d21
|
refs/heads/master
| 2020-06-04T15:02:37.587428
| 2019-06-29T03:24:20
| 2019-06-29T03:24:20
| 184,223,369
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,782
|
java
|
package controller;
import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import model.Permissao;
import model.Usuario;
import service.UsuarioServiceImpl;
@WebServlet ("/autenticador")
public class Autenticador extends HttpServlet
{
private static final long serialVersionUID = -8608687049026173883L;
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
try
{
req.setCharacterEncoding("UTF-8");
}
catch (Exception e)
{
}
String login = req.getParameter("login");
String senha = req.getParameter("senha");
UsuarioServiceImpl usuarioServ = new UsuarioServiceImpl();
Usuario usuario = usuarioServ.VerificaLogin(login, senha);
try
{
HttpSession sessao = req.getSession();
sessao.setAttribute("usuario", usuario);
if (usuario.getFk_nivel().getNivel() == 1)
{
sessao.getServletContext().getRequestDispatcher("/eleitor").forward(req, resp);
}
else if (usuario.getFk_nivel().getNivel() == 2)
{
sessao.getServletContext().getRequestDispatcher("/mesario").forward(req, resp);
}
else if (usuario.getFk_nivel().getNivel() == 3 )
{
sessao.getServletContext().getRequestDispatcher("/chefesessao").forward(req, resp);
}
}
catch (Exception e)
{
req.setAttribute("falhaAutenticacao", true);
resp.sendRedirect("/Urna");
}
}
}
|
[
"noreply@github.com"
] |
KelvinSeverino.noreply@github.com
|
1f4d59e34c52c82632f9bf8b69342a267fa21089
|
286968d6808673151204505e847385805b0e6f3b
|
/Assignment_1/src/Que11.java
|
2b2a50c67493298d0634fb6aa9351afe809be14c
|
[] |
no_license
|
TanujaJirapure/CoreJavaAssignments
|
b1f315affc0d045cb7f8af9481ad851ec701e619
|
023ff45ee8d4ecf096d9f83ea8b86f311ca496ed
|
refs/heads/main
| 2023-07-02T09:00:09.580722
| 2021-08-04T18:19:53
| 2021-08-04T18:19:53
| 385,300,837
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 261
|
java
|
public class Que11 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a;
System.out.println("Factorial of 10 are:");
for(a=1;a<11;a++) {
if(10%a == 0) {
System.out.print(a+" ");
}
}
}
}
|
[
"noreply@github.com"
] |
TanujaJirapure.noreply@github.com
|
56d96afc448fe8f3975006d8fa8de9b4a7feba38
|
0fd8a368368115ede9092e1d98a786178a325531
|
/src/main/java/app/bot/item/ItemCervejaRepository.java
|
3377facb9d890e4468bf0d4489ffecac9e64368b
|
[] |
no_license
|
brunoreili/LaboratorioChopp
|
88ad4ea885de6b23f471d5a1da98b7ca8d13ee33
|
ae604ff4d28dea6c0d1faa4c3a545b998d1c39b6
|
refs/heads/master
| 2021-01-23T10:43:08.752520
| 2017-06-03T13:01:05
| 2017-06-03T13:01:05
| 93,084,572
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 204
|
java
|
package app.bot.item;
import org.springframework.data.repository.CrudRepository;
//Interface para teste de banco
public interface ItemCervejaRepository extends CrudRepository<ItemCerveja, Long> {
}
|
[
"noreply@github.com"
] |
brunoreili.noreply@github.com
|
3ef27ded399ce207ce95ade98e82b28c01c5a05b
|
08548bbdb8f0605604371253021cf968dc2c710b
|
/src/com/example/test/MC.java
|
4dff858b390d789e3d3c4125a58ebfe8efa65262
|
[] |
no_license
|
hust-MC/Test
|
ec53350d000f1e10ef7c9ff9413ef385a3912ef8
|
3154daf92a375e4efcf310c90d015ab755744a73
|
refs/heads/master
| 2020-04-05T23:38:58.418098
| 2014-03-17T12:40:50
| 2014-03-17T12:40:50
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 530
|
java
|
package com.example.test;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
public class MC
{
private LayoutInflater layoutInflater;
public View MC_Text(Context context)
{
layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.activity_main, null);
TextView text = (TextView)view.findViewById(R.id.textview);
text.setText("yes");
return view;
}
}
|
[
"mc_zy@outlook.com"
] |
mc_zy@outlook.com
|
c91bcbac2a68f28a8858ec2d55dd391c1f1da9de
|
69777514220a0c954d17be879bc8e3ef08e91682
|
/app/src/main/java/com/example/koko/lapazreciclaje/Fragments/PerfilFragment.java
|
1d067b21e33ec8911507526f8985e40586587d10
|
[] |
no_license
|
jorge-loayza/Proy_INF_281
|
d516cbdae6be2fbe7246d634b4fcf33549df2fb5
|
233bc8b2444e0bb0faf681d7239ca48cbde3f3f0
|
refs/heads/master
| 2021-11-10T23:47:07.582997
| 2017-06-08T00:40:06
| 2017-06-08T00:40:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,373
|
java
|
package com.example.koko.lapazreciclaje.Fragments;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.example.koko.lapazreciclaje.Activities.LogInActivity;
import com.example.koko.lapazreciclaje.Activities.NavigationActivity;
import com.example.koko.lapazreciclaje.Activities.RedactarArticuloActivity;
import com.example.koko.lapazreciclaje.Adapters.ArticulosAdapter;
import com.example.koko.lapazreciclaje.Adapters.ArticulosUsuarioAdapter;
import com.example.koko.lapazreciclaje.Objetos.Articulo;
import com.example.koko.lapazreciclaje.R;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class PerfilFragment extends Fragment {
private FirebaseAuth firebaseAuth;
private FirebaseAuth.AuthStateListener authStateListener;
private FirebaseDatabase firebaseDatabase;
private DatabaseReference databaseReferenceArticulos;
private RecyclerView rvListaArticulos;
private List<Articulo> listaArticulos;
private ArticulosUsuarioAdapter articulosUsuarioAdapter;
private Query query;
private View view;
public PerfilFragment() {
// Required empty public constructor
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
this.view = inflater.inflate(R.layout.fragment_perfil, container, false);
firebaseDatabase = FirebaseDatabase.getInstance();
firebaseAuth = FirebaseAuth.getInstance();
authStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
if(firebaseUser == null){
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setCancelable(false).setMessage("Usted no inicio sesion. ¿Desea Iniciar sesión o crear una cuenta?");
builder.setPositiveButton("SI", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(getContext(),LogInActivity.class));
}
});
builder.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(getContext(),NavigationActivity.class));
getActivity().finish();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}else{
String id = firebaseAuth.getCurrentUser().getUid().toString();
Log.i("datos",id);
query = firebaseDatabase.getReference().child("articulo").orderByChild("id_usuario").equalTo(id);
Log.i("datos",query.getRef().toString());
Log.i("datos","entro");
query.keepSynced(true);
mostrarArticulosUsuario();
}
}
};
rvListaArticulos = (RecyclerView) view.findViewById(R.id.rvListaArticulosusuario);
rvListaArticulos.setLayoutManager(new LinearLayoutManager(getContext()));
listaArticulos = new ArrayList<>();
articulosUsuarioAdapter = new ArticulosUsuarioAdapter(listaArticulos,getContext());
rvListaArticulos.setAdapter(articulosUsuarioAdapter);
return view;
}
@Override
public void onStart() {
super.onStart();
firebaseAuth.addAuthStateListener(authStateListener);
if (query != null){
mostrarArticulosUsuario();
}
}
@Override
public void onStop() {
super.onStop();
firebaseAuth.removeAuthStateListener(authStateListener);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_perfil_usuario,menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.salir) {
FirebaseAuth.getInstance().signOut();
startActivity(new Intent(getContext(),NavigationActivity.class));
getActivity().finish();
return true;
}
if (id == R.id.adicionar) {
startActivity(new Intent(getContext(),RedactarArticuloActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
private void mostrarArticulosUsuario() {
listaArticulos.clear();
Log.i("datos",query.getRef().toString());
query.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Articulo articulo = dataSnapshot.getValue(Articulo.class);
Boolean w = true;
for (Articulo art :
listaArticulos) {
if (articulo.getId_articulo().equals(art.getId_articulo())){
w= false;
}
}
if (w){
listaArticulos.add(articulo);
articulosUsuarioAdapter.notifyDataSetChanged();
}
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
mostrarArticulosUsuario();
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
|
[
"kokopunk39@gmail.com"
] |
kokopunk39@gmail.com
|
a94e045bd665dc9bba49bbb89b0b74131fee063d
|
3a17931e4c533079abbc144bcf9d55ed7b38fb18
|
/java/src/sun/misc/Unsafe.java
|
2c376e7f135223970ec2f188cd7aad047c724f3b
|
[] |
no_license
|
Wang-Jun-Chao/java-source-code-reading
|
b71a4caf279cb6d464cd05070b1287bb6419e559
|
32d65b5669d1cc6c0f84c81fb328014a9a8363f5
|
refs/heads/master
| 2020-06-21T17:36:55.771168
| 2019-07-18T08:37:26
| 2019-07-18T08:37:26
| 197,517,156
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 64,726
|
java
|
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.misc;
import java.security.*;
import java.lang.reflect.*;
import sun.reflect.CallerSensitive;
import sun.reflect.Reflection;
/**
* <pre>
* https://www.cnblogs.com/mickole/articles/3757278.html
* java不能直接访问操作系统底层,而是通过本地方法来访问。Unsafe类提供了硬件级别的原子操作,主要提供了以下功能:
*
* 1、通过Unsafe类可以分配内存,可以释放内存;
* 类中提供的3个本地方法allocateMemory、reallocateMemory、freeMemory分别用于分配内存,扩充内存和释放内存,
* 与C语言中的3个方法对应。
*
* 2、可以定位对象某字段的内存位置,也可以修改对象的字段值,即使它是私有的;
*
* 1、Unsafe有可能在未来的Jdk版本移除或者不允许Java应用代码使用,这一点可能导致使用了Unsafe的应用无法运行在高
* 版本的Jdk。
* 2、Unsafe的不少方法中必须提供原始地址(内存地址)和被替换对象的地址,偏移量要自己计算,一旦出现问题就是JVM崩溃
* 级别的异常,会导致整个JVM实例崩溃,表现为应用程序直接crash掉。
* 3、Unsafe提供的直接内存访问的方法中使用的内存不受JVM管理(无法被GC),需要手动管理,一旦出现疏忽很有可能成为内
* 存泄漏的源头。
* </pre>
* A collection of methods for performing low-level, unsafe operations.
* Although the class and all methods are public, use of this class is
* limited because only trusted code can obtain instances of it.
*
* @author John R. Rose
* @see #getUnsafe
*/
public final class Unsafe {
private static native void registerNatives();
static {
registerNatives();
Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe");
}
private Unsafe() {}
private static final Unsafe theUnsafe = new Unsafe();
/**
* 为调用者提供执行不安全操作的能力。
*
* 返回的<code>Unsafe</code>对象应该由调用者小心保护,因为它可以用于在任意内
* 存地址读取和写入数据。 绝不能将其传递给不受信任的代码。
*
* 此类中的大多数方法都是非常低级的,并且对应于少量硬件指令(在典型的机器上)。
* 鼓励编译器相应地优化这些方法。
*
* Provides the caller with the capability of performing unsafe
* operations.
*
* <p> The returned <code>Unsafe</code> object should be carefully guarded
* by the caller, since it can be used to read and write data at arbitrary
* memory addresses. It must never be passed to untrusted code.
*
* <p> Most methods in this class are very low-level, and correspond to a
* small number of hardware instructions (on typical machines). Compilers
* are encouraged to optimize these methods accordingly.
*
* <p> Here is a suggested idiom for using unsafe operations:
*
* <blockquote><pre>
* class MyTrustedClass {
* private static final Unsafe unsafe = Unsafe.getUnsafe();
* ...
* private long myCountAddress = ...;
* public int getCount() { return unsafe.getByte(myCountAddress); }
* }
* </pre></blockquote>
*
* 它可以帮助编译器创建局部变量为final类型
* (It may assist compilers to make the local variable be
* <code>final</code>.)
*
* 如果存在安全管理器且其<code>checkPropertiesAccess </code>方法不允许访问系统属性
* 会抛出SecurityException
* @exception SecurityException if a security manager exists and its
* <code>checkPropertiesAccess</code> method doesn't allow
* access to the system properties.
*/
@CallerSensitive
public static Unsafe getUnsafe() {
Class<?> caller = Reflection.getCallerClass();
// 只有由启动类加载器(BootStrap classLoader)加载的类才能调用这个类中的方法
if (!VM.isSystemDomainLoader(caller.getClassLoader()))
throw new SecurityException("Unsafe");
return theUnsafe;
}
/// peek and poke operations
// (peek和poke操作见:https://en.wikipedia.org/wiki/PEEK_and_POKE)
/// (compilers should optimize these to memory ops)
// (编译器应该优化这些内存操作)
// These work on object fields in the Java heap.
// 这些工作在Java堆中的对象字段上
// They will not work on elements of packed arrays.
// 它们不适用于压缩数组的元素
/**
* Fetches a value from a given Java variable.
* More specifically, fetches a field or array element within the given
* object <code>o</code> at the given offset, or (if <code>o</code> is
* null) from the memory address whose numerical value is the given
* offset.
* 从给定的Java变量中获取值。 更具体地说,从给定偏移量的给定对象<code>o</code>
* 中获取字段或数组元素,或者(如果<code> o </ code>为空)从数据值为给定的内存
* 地址中获取偏移。
*
* <p>
* The results are undefined unless one of the following cases is true:
* 除非下列情况之一成立,否则结果未定义
* <ul>
* <li>The offset was obtained from {@link #objectFieldOffset} on
* the {@link Field} of some Java field and the object
* referred to by <code>o</code> is of a class compatible with that
* field's class.
* 偏移量是从某些Java字段的{@link Field}上的{@link #objectFieldOffset}获得的,
* 而<code>o</code>引用的对象是与该字段的类兼容的类。
*
* <li>The offset and object reference <code>o</code> (either null or
* non-null) were both obtained via {@link #staticFieldOffset}
* and {@link #staticFieldBase} (respectively) from the
* reflective {@link Field} representation of some Java field.
* 偏移量和对象引用<code>o</ code>(null或非null)都是通过
* {@link #staticFieldOffset}和{@link #staticFieldBase}(分别)
* 从反射{@link Field}表示获得的 一些Java领域。
*
*
* <li>The object referred to by <code>o</code> is an array, and the offset
* is an integer of the form <code>B+N*S</code>, where <code>N</code> is
* a valid index into the array, and <code>B</code> and <code>S</code> are
* the values obtained by {@link #arrayBaseOffset} and {@link
* #arrayIndexScale} (respectively) from the array's class. The value
* referred to is the <code>N</code><em>th</em> element of the array.
*
* <code>o</ code>引用的对象是一个数组,偏移量是<code>B+N*S</ code>形式的
* 整数,其中<code>N</code>是一个数组的有效索引,<code>B</ code>和
* <code>S</ code>是数组类中{@link #arrayBaseOffset}和{@link #arrayIndexScale}
* 分别获得的值。 引用的值是数组的<code>N</code><em>th</em>个元素。
* </ul>
* <p>
* If one of the above cases is true, the call references a specific Java
* variable (field or array element). However, the results are undefined
* if that variable is not in fact of the type returned by this method.
* 如果上述情况之一为真,则调用引用特定的Java变量(字段或数组元素)。 但是,如果该变
* 量实际上不是此方法返回的类型,则结果是未定义的。
*
* <p>
* This method refers to a variable by means of two parameters, and so
* it provides (in effect) a <em>double-register</em> addressing mode
* for Java variables. When the object reference is null, this method
* uses its offset as an absolute address. This is similar in operation
* to methods such as {@link #getInt(long)}, which provide (in effect) a
* <em>single-register</em> addressing mode for non-Java variables.
* However, because Java variables may have a different layout in memory
* from non-Java variables, programmers should not assume that these
* two addressing modes are ever equivalent. Also, programmers should
* remember that offsets from the double-register addressing mode cannot
* be portably confused with longs used in the single-register addressing
* mode.
* 此方法通过两个参数引用变量,因此它为Java变量提供(实际上)<em>双寄存器</em>寻址模式。
* 当对象引用为null时,此方法将其偏移量用作绝对地址。 这在操作上类似于{@link #getInt(long)}
* 等方法,它为非Java变量提供(实际上)<em>单寄存器</em>寻址模式。但是,因为Java变量
* 在内存中可能与非Java变量具有不同的布局,所以程序员不应该假设这两种寻址模式是等价的。
* 此外,程序员应该记住,双寄存器寻址模式的偏移不能与单寄存器寻址模式中使用的long混淆。
*
* @param o Java heap object in which the variable resides, if any, else
* null
* 变量所在的Java堆对象(如果有),否则为null
* @param offset indication of where the variable resides in a Java heap
* object, if any, else a memory address locating the variable
* statically
* 指示变量驻留在Java堆对象中的位置(如果有),否则是静态定位变量的内存地址
* @return the value fetched from the indicated Java variable
* 从指示的Java变量获取的值
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
*/
public native int getInt(Object o, long offset);
/**
* 将值存储到给定的Java变量中。
*
* Stores a value into a given Java variable.
* <p>
* The first two parameters are interpreted exactly as with
* {@link #getInt(Object, long)} to refer to a specific
* Java variable (field or array element). The given value
* is stored into that variable.
* <p>
* The variable must be of the same type as the method
* parameter <code>x</code>.
*
* @param o Java heap object in which the variable resides, if any, else
* null
* @param offset indication of where the variable resides in a Java heap
* object, if any, else a memory address locating the variable
* statically
* @param x the value to store into the indicated Java variable
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
*/
public native void putInt(Object o, long offset, int x);
/**
* 通过给定的Java变量获取引用值。这里实际上是获取一个Java对象o中,获取偏移地址为offset的属性的值,
* 此方法可以突破修饰符的抑制,也就是无视private、protected和default修饰符
* Fetches a reference value from a given Java variable.
* @see #getInt(Object, long)
*/
public native Object getObject(Object o, long offset);
/**
* 将引用值存储到给定的Java变量中。这里实际上是设置一个Java对象o中偏移地址为offset的属性的值为x,
* 此方法可以突破修饰符的抑制,也就是无视private、protected和default修饰符
*
* 将引用值存储到给定的Java变量中。 除非存储的引用<code>x</code>为null或与字段类型匹配,
* 否则结果是未定义的。 如果引用<code>o</code>为非null,则更新该对象的car标记或其他存
* 储屏障(如果VM需要它们)。
*
* Stores a reference value into a given Java variable.
* <p>
* Unless the reference <code>x</code> being stored is either null
* or matches the field type, the results are undefined.
* If the reference <code>o</code> is non-null, car marks or
* other store barriers for that object (if the VM requires them)
* are updated.
* @see #putInt(Object, int, int)
*/
public native void putObject(Object o, long offset, Object x);
/** @see #getInt(Object, long) */
public native boolean getBoolean(Object o, long offset);
/** @see #putInt(Object, int, int) */
public native void putBoolean(Object o, long offset, boolean x);
/** @see #getInt(Object, long) */
public native byte getByte(Object o, long offset);
/** @see #putInt(Object, int, int) */
public native void putByte(Object o, long offset, byte x);
/** @see #getInt(Object, long) */
public native short getShort(Object o, long offset);
/** @see #putInt(Object, int, int) */
public native void putShort(Object o, long offset, short x);
/** @see #getInt(Object, long) */
public native char getChar(Object o, long offset);
/** @see #putInt(Object, int, int) */
public native void putChar(Object o, long offset, char x);
/** @see #getInt(Object, long) */
public native long getLong(Object o, long offset);
/** @see #putInt(Object, int, int) */
public native void putLong(Object o, long offset, long x);
/** @see #getInt(Object, long) */
public native float getFloat(Object o, long offset);
/** @see #putInt(Object, int, int) */
public native void putFloat(Object o, long offset, float x);
/** @see #getInt(Object, long) */
public native double getDouble(Object o, long offset);
/** @see #putInt(Object, int, int) */
public native void putDouble(Object o, long offset, double x);
/**
* This method, like all others with 32-bit offsets, was native
* in a previous release but is now a wrapper which simply casts
* the offset to a long value. It provides backward compatibility
* with bytecodes compiled against 1.4.
* 与所有具有32位偏移的其他方法一样,此方法在先前版本中是原生的,但现在是一个包装器,
* 它只是将偏移量转换为long值。 它提供了与1.4编译的字节码的向后兼容性。
*
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* See {@link #staticFieldOffset}.
*/
@Deprecated
public int getInt(Object o, int offset) {
return getInt(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putInt(Object o, int offset, int x) {
putInt(o, (long)offset, x);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public Object getObject(Object o, int offset) {
return getObject(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putObject(Object o, int offset, Object x) {
putObject(o, (long)offset, x);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public boolean getBoolean(Object o, int offset) {
return getBoolean(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putBoolean(Object o, int offset, boolean x) {
putBoolean(o, (long)offset, x);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public byte getByte(Object o, int offset) {
return getByte(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putByte(Object o, int offset, byte x) {
putByte(o, (long)offset, x);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public short getShort(Object o, int offset) {
return getShort(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putShort(Object o, int offset, short x) {
putShort(o, (long)offset, x);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public char getChar(Object o, int offset) {
return getChar(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putChar(Object o, int offset, char x) {
putChar(o, (long)offset, x);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public long getLong(Object o, int offset) {
return getLong(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putLong(Object o, int offset, long x) {
putLong(o, (long)offset, x);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public float getFloat(Object o, int offset) {
return getFloat(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putFloat(Object o, int offset, float x) {
putFloat(o, (long)offset, x);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public double getDouble(Object o, int offset) {
return getDouble(o, (long)offset);
}
/**
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
* 从1.4.1开始,将32位偏移量参数转换为long。
* See {@link #staticFieldOffset}.
*/
@Deprecated
public void putDouble(Object o, int offset, double x) {
putDouble(o, (long)offset, x);
}
// These work on values in the C heap.
// 这些对C堆中的值有效。
/**
* Fetches a value from a given memory address. If the address is zero, or
* does not point into a block obtained from {@link #allocateMemory}, the
* results are undefined.
* 从给定的内存地址中获取值。 如果地址为零,或者没有指向从{@link #allocateMemory}获得的块,
* 则结果是未定义的。
*
* @see #allocateMemory
*/
public native byte getByte(long address);
/**
* Stores a value into a given memory address. If the address is zero, or
* does not point into a block obtained from {@link #allocateMemory}, the
* results are undefined.
* 将值存储到给定的内存地址中。 如果地址为零,或者没有指向从{@link #allocateMemory}获得
* 的块,则结果是未定义的。
*
* @see #getByte(long)
*/
public native void putByte(long address, byte x);
/** @see #getByte(long) */
public native short getShort(long address);
/** @see #putByte(long, byte) */
public native void putShort(long address, short x);
/** @see #getByte(long) */
public native char getChar(long address);
/** @see #putByte(long, byte) */
public native void putChar(long address, char x);
/** @see #getByte(long) */
public native int getInt(long address);
/** @see #putByte(long, byte) */
public native void putInt(long address, int x);
/** @see #getByte(long) */
public native long getLong(long address);
/** @see #putByte(long, byte) */
public native void putLong(long address, long x);
/** @see #getByte(long) */
public native float getFloat(long address);
/** @see #putByte(long, byte) */
public native void putFloat(long address, float x);
/** @see #getByte(long) */
public native double getDouble(long address);
/** @see #putByte(long, byte) */
public native void putDouble(long address, double x);
/**
* Fetches a native pointer from a given memory address. If the address is
* zero, or does not point into a block obtained from {@link
* #allocateMemory}, the results are undefined.
* 从给定的内存地址获取本机指针。 如果地址为零,或者没有指向从{@link #allocateMemory}
* 获得的块,则结果是未定义的。
*
* <p> If the native pointer is less than 64 bits wide, it is extended as
* an unsigned number to a Java long. The pointer may be indexed by any
* given byte offset, simply by adding that offset (as a simple integer) to
* the long representing the pointer. The number of bytes actually read
* from the target address maybe determined by consulting {@link
* #addressSize}.
*
* 如果本机指针的宽度小于64位,则将其作为无符号数扩展为Java long。 指针可以由任何给定的字节
* 偏移索引,简单地通过将该偏移(作为简单整数)添加到long表示指针。 实际从目标地址读取的字节
* 数可以通过查询{@link #addressSize}来确定
*
* @see #allocateMemory
*/
public native long getAddress(long address);
/**
* Stores a native pointer into a given memory address. If the address is
* zero, or does not point into a block obtained from {@link
* #allocateMemory}, the results are undefined.
* 将本机指针存储到给定的内存地址中。 如果地址为零,或者没有指向从{@link #allocateMemory}
* 获得的块,则结果是未定义的。
*
* <p> The number of bytes actually written at the target address maybe
* determined by consulting {@link #addressSize}.
* 实际写入目标地址的字节数可以通过查询{@link #addressSize}来确定。
*
* @see #getAddress(long)
*/
public native void putAddress(long address, long x);
/// wrappers for malloc, realloc, free:
/// malloc,realloc,free的包装器:
/**
* Allocates a new block of native memory, of the given size in bytes. The
* contents of the memory are uninitialized; they will generally be
* garbage. The resulting native pointer will never be zero, and will be
* aligned for all value types. Dispose of this memory by calling {@link
* #freeMemory}, or resize it with {@link #reallocateMemory}.
* 分配给定大小的新的本机内存块(以字节为单位)。 内存的内容是未初始化的; 他们通常会是垃圾。
* 生成的本机指针永远不会为零,并且将针对所有值类型进行对齐。 通过调用{@link #freeMemory}
* 释放此内存,或使用{@link #reallocateMemory}调整其大小
*
* @throws IllegalArgumentException if the size is negative or too large
* for the native size_t type
* 如果原始size_t类型的大小为负或太大
*
* @throws OutOfMemoryError if the allocation is refused by the system
* 如果分配被系统拒绝
* @see #getByte(long)
* @see #putByte(long, byte)
*/
public native long allocateMemory(long bytes);
/**
* Resizes a new block of native memory, to the given size in bytes. The
* contents of the new block past the size of the old block are
* uninitialized; they will generally be garbage. The resulting native
* pointer will be zero if and only if the requested size is zero. The
* resulting native pointer will be aligned for all value types. Dispose
* of this memory by calling {@link #freeMemory}, or resize it with {@link
* #reallocateMemory}. The address passed to this method may be null, in
* which case an allocation will be performed.
* 将新的本机内存块调整为给定大小(以字节为单位)。 超过旧块大小的新块的内容未初始化;
* 他们通常会是垃圾。 当且仅当请求的大小为零时,生成的本机指针将为零。 生成的本机指针
* 将与所有值类型对齐。 通过调用{@link #freeMemory}释放此内存,或使用{@link
* #reallocateMemory}调整其大小。 传递给此方法的地址可以为null,在这种情况下将执行分配。
*
* @throws IllegalArgumentException if the size is negative or too large
* for the native size_t type
* 如果原始size_t类型的大小为负或太大
*
* @throws OutOfMemoryError if the allocation is refused by the system
* 如果分配被系统拒绝
* @see #allocateMemory
*/
public native long reallocateMemory(long address, long bytes);
/**
* Sets all bytes in a given block of memory to a fixed value
* (usually zero).
* 将给定内存块中的所有字节设置为固定值(通常为零)。
*
* <p>This method determines a block's base address by means of two parameters,
* and so it provides (in effect) a <em>double-register</em> addressing mode,
* as discussed in {@link #getInt(Object,long)}. When the object reference is null,
* the offset supplies an absolute base address.
* 此方法通过两个参数确定块的基址,因此它提供(实际上)<em>双寄存器</ em>寻址模式,
* 如{@link #getInt(Object, long)}中所述。 当对象引用为null时,偏移量提供绝对基址。
*
* <p>The stores are in coherent (atomic) units of a size determined
* by the address and length parameters. If the effective address and
* length are all even modulo 8, the stores take place in 'long' units.
* If the effective address and length are (resp.) even modulo 4 or 2,
* the stores take place in units of 'int' or 'short'.
*
* 存储是由地址和长度参数确定的大小的相干(原子)单元。 如果有效地址和长度均为模8,
* 则存储以“long”为单位进行。 如果有效地址和长度(即相等)甚至模4或2,则存储以
* “int”或“short”为单位进行。
*
* @since 1.7
*/
public native void setMemory(Object o, long offset, long bytes, byte value);
/**
* Sets all bytes in a given block of memory to a fixed value
* (usually zero). This provides a <em>single-register</em> addressing mode,
* as discussed in {@link #getInt(Object,long)}.
* 将给定内存块中的所有字节设置为固定值(通常为零)。 这提供了<em>单寄存器</em>寻址模式,
* 如{@link #getInt(Object,long)}中所述。
*
* <p>Equivalent to <code>setMemory(null, address, bytes, value)</code>.
*/
public void setMemory(long address, long bytes, byte value) {
setMemory(null, address, bytes, value);
}
/**
* Sets all bytes in a given block of memory to a copy of another
* block.
* 将给定内存块中的所有字节设置为另一个块的副本。进行内存复制
*
* <p>This method determines each block's base address by means of two parameters,
* and so it provides (in effect) a <em>double-register</em> addressing mode,
* as discussed in {@link #getInt(Object,long)}. When the object reference is null,
* the offset supplies an absolute base address.
* 此方法通过两个参数确定每个块的基址,因此它提供(实际上)<em>双寄存器</em>寻址模式,
* 如{@link #getInt(Object,long)}中所述。 当对象引用为null时,偏移量提供绝对基址。
*
* <p>The transfers are in coherent (atomic) units of a size determined
* by the address and length parameters. If the effective addresses and
* length are all even modulo 8, the transfer takes place in 'long' units.
* If the effective addresses and length are (resp.) even modulo 4 or 2,
* the transfer takes place in units of 'int' or 'short'.
* 存储是由地址和长度参数确定的大小的相干(原子)单元。 如果有效地址和长度均为模8,
* 则存储以“long”为单位进行。 如果有效地址和长度(即相等)甚至模4或2,则存储以
* “int”或“short”为单位进行。
* @since 1.7
*/
public native void copyMemory(Object srcBase, long srcOffset,
Object destBase, long destOffset,
long bytes);
/**
* Sets all bytes in a given block of memory to a copy of another
* block. This provides a <em>single-register</em> addressing mode,
* as discussed in {@link #getInt(Object,long)}.
* 将给定内存块中的所有字节设置为另一个块的副本值。 这提供了<em>单寄存器</em>寻址模式,
* 如{@link #getInt(Object,long)}中所述。
*
* Equivalent to <code>copyMemory(null, srcAddress, null, destAddress, bytes)</code>.
*/
public void copyMemory(long srcAddress, long destAddress, long bytes) {
copyMemory(null, srcAddress, null, destAddress, bytes);
}
/**
* Disposes of a block of native memory, as obtained from {@link
* #allocateMemory} or {@link #reallocateMemory}. The address passed to
* this method may be null, in which case no action is taken.
* 释放从{@link #allocateMemory}或{@link #reallocateMemory}获得的本机内存块。
* 传递给此方法的地址可能为null,在这种情况下不执行任何操作。
* @see #allocateMemory
*/
public native void freeMemory(long address);
/// random queries
/// 随机查询
/**
* This constant differs from all results that will ever be returned from
* {@link #staticFieldOffset}, {@link #objectFieldOffset},
* or {@link #arrayBaseOffset}.
*
* 此常量不同于从{@link #staticFieldOffset},{@link #objectFieldOffset}或
* {@link #arrayBaseOffset}返回的所有结果。
* 用于标记非法的字段偏移地址
*
*/
public static final int INVALID_FIELD_OFFSET = -1;
/**
* Returns the offset of a field, truncated to 32 bits.
* This method is implemented as follows:
* 返回字段的偏移量,截断为32位。 该方法实现如下:
*
* <blockquote><pre>
* public int fieldOffset(Field f) {
* if (Modifier.isStatic(f.getModifiers()))
* return (int) staticFieldOffset(f);
* else
* return (int) objectFieldOffset(f);
* }
* </pre></blockquote>
* @deprecated As of 1.4.1, use {@link #staticFieldOffset} for static
* fields and {@link #objectFieldOffset} for non-static fields.
* 从1.4.1开始,对静态字段使用{@link #staticFieldOffset},对非静态字段使用
* {@link #objectFieldOffset}
*
*/
@Deprecated
public int fieldOffset(Field f) {
if (Modifier.isStatic(f.getModifiers()))
return (int) staticFieldOffset(f);
else
return (int) objectFieldOffset(f);
}
/**
* Returns the base address for accessing some static field
* in the given class. This method is implemented as follows:
* 返回用于访问给定类中的某些静态字段的基址。 该方法实现如下:
* <blockquote><pre>
* public Object staticFieldBase(Class c) {
* Field[] fields = c.getDeclaredFields();
* for (int i = 0; i < fields.length; i++) {
* if (Modifier.isStatic(fields[i].getModifiers())) {
* return staticFieldBase(fields[i]);
* }
* }
* return null;
* }
* </pre></blockquote>
* @deprecated As of 1.4.1, use {@link #staticFieldBase(Field)}
* to obtain the base pertaining to a specific {@link Field}.
* This method works only for JVMs which store all statics
* for a given class in one place.
* 从1.4.1开始,使用{@link #staticFieldBase(Field)}获取与特定
* {@link Field}相关的基址。 此方法仅适用于在一个位置存储给定类的所
* 有静态属性的JVM。
*/
@Deprecated
public Object staticFieldBase(Class<?> c) {
Field[] fields = c.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
if (Modifier.isStatic(fields[i].getModifiers())) {
return staticFieldBase(fields[i]);
}
}
return null;
}
/**
* Report the location of a given field in the storage allocation of its
* class. Do not expect to perform any sort of arithmetic on this offset;
* it is just a cookie which is passed to the unsafe heap memory accessors.
* 返回给定字段在其类的存储分配中的位置。 不要指望对此偏移量执行任何算术运算;
* 它只是一个传递给不安全堆内存访问器的方式(cookie)。
*
* <p>Any given field will always have the same offset and base, and no
* two distinct fields of the same class will ever have the same offset
* and base.
* 任何给定的字段将始终具有相同的偏移量和基数,并且同一类的两个不同字段将不会具有相同
* 的偏移量和基数。
*
* <p>As of 1.4.1, offsets for fields are represented as long values,
* although the Sun JVM does not use the most significant 32 bits.
* However, JVM implementations which store static fields at absolute
* addresses can use long offsets and null base pointers to express
* the field locations in a form usable by {@link #getInt(Object,long)}.
* Therefore, code which will be ported to such JVMs on 64-bit platforms
* must preserve all bits of static field offsets.
* @see #getInt(Object, long)
*
* 从1.4.1开始,字段的偏移量使用long值表示,但是Sun JVM不使用最有影响的32位。
* 但是,对使用绝对地址存储静态字段的JVM,可以使用长偏移量和空基指针以{@link
* #getInt(Object,long)}可用的形式表示字段位置。 因此,被移植到64位JVM的代码
* 必须保留所有静态字段偏移量。
*/
public native long staticFieldOffset(Field f);
/**
* Report the location of a given static field, in conjunction with {@link
* #staticFieldBase}.
* 结合{@link #staticFieldBase},返回给定静态字段的位置。
*
* <p>Do not expect to perform any sort of arithmetic on this offset;
* it is just a cookie which is passed to the unsafe heap memory accessors.
* 不要指望对此偏移量执行任何算术运算; 它只是一个传递给不安全堆内存访问器的方式(cookie)。
*
* <p>Any given field will always have the same offset, and no two distinct
* fields of the same class will ever have the same offset.
* 任何给定字段将始终具有相同的偏移量,并且同一类的两个不同字段将不会具有相同的偏移量。
*
* <p>As of 1.4.1, offsets for fields are represented as long values,
* although the Sun JVM does not use the most significant 32 bits.
* It is hard to imagine a JVM technology which needs more than
* a few bits to encode an offset within a non-array object,
* However, for consistency with other methods in this class,
* this method reports its result as a long value.
* 从1.4.1开始,字段的偏移量表示为long值,尽管Sun JVM不使用最重要的32位。很难想象一种
* JVM技术需要多几位来编码非数组对象内的偏移量,但是,为了与此类中的其他方法保持一致,
* 此方法将其结果返回为long值。
* @see #getInt(Object, long)
*/
public native long objectFieldOffset(Field f);
/**
* Report the location of a given static field, in conjunction with {@link
* #staticFieldOffset}.
* 结合{@link #staticFieldOffset},报告给定静态字段的位置
*
* <p>Fetch the base "Object", if any, with which static fields of the
* given class can be accessed via methods like {@link #getInt(Object,
* long)}. This value may be null. This value may refer to an object
* which is a "cookie", not guaranteed to be a real Object, and it should
* not be used in any way except as argument to the get and put routines in
* this class.
* 获取基址“Object”(如果有),可以通过{@link #getInt(Object,long)}等方法访问
* 给定类的静态字段。 该值可以为null。 这个值可能指的是一个“cookie”的对象,不能保证
* 是一个真正的Object,除了作为此类中get和put例程的参数之外,它不应该以任何方式使用。
*
*/
public native Object staticFieldBase(Field f);
/**
* Detect if the given class may need to be initialized. This is often
* needed in conjunction with obtaining the static field base of a
* class.
* 检测是否需要初始化给定的类。 这通常需要与获得类的静态字段库一起使用。
*
* @return false only if a call to {@code ensureClassInitialized} would have no effect
* 仅当对{@code ensureClassInitialized}的调用无效时才为false
*/
public native boolean shouldBeInitialized(Class<?> c);
/**
* Ensure the given class has been initialized. This is often
* needed in conjunction with obtaining the static field base of a
* class.
* 擦除已初始化的给定类。 这通常需要与获得类的静态字段库一起使用。
*/
public native void ensureClassInitialized(Class<?> c);
/**
* Report the offset of the first element in the storage allocation of a
* given array class. If {@link #arrayIndexScale} returns a non-zero value
* for the same class, you may use that scale factor, together with this
* base offset, to form new offsets to access elements of arrays of the
* given class.
* 返回数组第一个元素的偏移地址,如果{@link #arrayIndexScale}为同一个类返回非零值,
* 则可以使用该比例因子以及此基本偏移量来形成新的偏移量,以访问给定类的数组元素。
*
* @see #getInt(Object, long)
* @see #putInt(Object, long, int)
*/
public native int arrayBaseOffset(Class<?> arrayClass);
/** The value of {@code arrayBaseOffset(boolean[].class)} */
public static final int ARRAY_BOOLEAN_BASE_OFFSET
= theUnsafe.arrayBaseOffset(boolean[].class);
/** The value of {@code arrayBaseOffset(byte[].class)} */
public static final int ARRAY_BYTE_BASE_OFFSET
= theUnsafe.arrayBaseOffset(byte[].class);
/** The value of {@code arrayBaseOffset(short[].class)} */
public static final int ARRAY_SHORT_BASE_OFFSET
= theUnsafe.arrayBaseOffset(short[].class);
/** The value of {@code arrayBaseOffset(char[].class)} */
public static final int ARRAY_CHAR_BASE_OFFSET
= theUnsafe.arrayBaseOffset(char[].class);
/** The value of {@code arrayBaseOffset(int[].class)} */
public static final int ARRAY_INT_BASE_OFFSET
= theUnsafe.arrayBaseOffset(int[].class);
/** The value of {@code arrayBaseOffset(long[].class)} */
public static final int ARRAY_LONG_BASE_OFFSET
= theUnsafe.arrayBaseOffset(long[].class);
/** The value of {@code arrayBaseOffset(float[].class)} */
public static final int ARRAY_FLOAT_BASE_OFFSET
= theUnsafe.arrayBaseOffset(float[].class);
/** The value of {@code arrayBaseOffset(double[].class)} */
public static final int ARRAY_DOUBLE_BASE_OFFSET
= theUnsafe.arrayBaseOffset(double[].class);
/** The value of {@code arrayBaseOffset(Object[].class)} */
public static final int ARRAY_OBJECT_BASE_OFFSET
= theUnsafe.arrayBaseOffset(Object[].class);
/**
* Report the scale factor for addressing elements in the storage
* allocation of a given array class. However, arrays of "narrow" types
* will generally not work properly with accessors like {@link
* #getByte(Object, int)}, so the scale factor for such classes is reported
* as zero.
* 返回在给定数组类的存储分配中寻址元素的比例因子。 但是,“narrow”类型的数组通常无法与
* {@link #getByte(Object,int)}等访问器一起正常工作,因此这类的比例因子返回为零。
* 注narrow类型一般指不小于4字节宽度的类型,比较boolean, short, byte, char等
*
* @see #arrayBaseOffset
* @see #getInt(Object, long)
* @see #putInt(Object, long, int)
*/
public native int arrayIndexScale(Class<?> arrayClass);
// 基本数组类型的偏移量
/** The value of {@code arrayIndexScale(boolean[].class)} */
public static final int ARRAY_BOOLEAN_INDEX_SCALE
= theUnsafe.arrayIndexScale(boolean[].class);
/** The value of {@code arrayIndexScale(byte[].class)} */
public static final int ARRAY_BYTE_INDEX_SCALE
= theUnsafe.arrayIndexScale(byte[].class);
/** The value of {@code arrayIndexScale(short[].class)} */
public static final int ARRAY_SHORT_INDEX_SCALE
= theUnsafe.arrayIndexScale(short[].class);
/** The value of {@code arrayIndexScale(char[].class)} */
public static final int ARRAY_CHAR_INDEX_SCALE
= theUnsafe.arrayIndexScale(char[].class);
/** The value of {@code arrayIndexScale(int[].class)} */
public static final int ARRAY_INT_INDEX_SCALE
= theUnsafe.arrayIndexScale(int[].class);
/** The value of {@code arrayIndexScale(long[].class)} */
public static final int ARRAY_LONG_INDEX_SCALE
= theUnsafe.arrayIndexScale(long[].class);
/** The value of {@code arrayIndexScale(float[].class)} */
public static final int ARRAY_FLOAT_INDEX_SCALE
= theUnsafe.arrayIndexScale(float[].class);
/** The value of {@code arrayIndexScale(double[].class)} */
public static final int ARRAY_DOUBLE_INDEX_SCALE
= theUnsafe.arrayIndexScale(double[].class);
/** The value of {@code arrayIndexScale(Object[].class)} */
public static final int ARRAY_OBJECT_INDEX_SCALE
= theUnsafe.arrayIndexScale(Object[].class);
/**
* Report the size in bytes of a native pointer, as stored via {@link
* #putAddress}. This value will be either 4 or 8. Note that the sizes of
* other primitive types (as stored in native memory blocks) is determined
* fully by their information content.
* 返回通过{@link #putAddress}存储的本机指针的大小(以字节为单位)。 此值将为4或8.
* 请注意,其他基本类型的大小(存储在本机内存块中)完全由其信息内容决定。
*/
public native int addressSize();
// 地址大小
/** The value of {@code addressSize()} */
public static final int ADDRESS_SIZE = theUnsafe.addressSize();
/**
* Report the size in bytes of a native memory page (whatever that is).
* This value will always be a power of two.
* 报告本机内存页面的大小(以字节为单位)(无论是什么)。 该值始终为2的幂。
*/
public native int pageSize();
/// random trusted operations from JNI:
/// 来自JNI的随机可信操作
/**
* Tell the VM to define a class, without security checks. By default, the
* class loader and protection domain come from the caller's class.
* 告诉VM定义一个类,没有安全检查。 默认情况下,类加载器和保护域来自调用者的类。
*/
public native Class<?> defineClass(String name, byte[] b, int off, int len,
ClassLoader loader,
ProtectionDomain protectionDomain);
/**
* Define a class but do not make it known to the class loader or system dictionary.
* 定义一个类,但不要让类加载器或系统字典知道它。
* <p>
* For each CP entry, the corresponding CP patch must either be null or have
* the a format that matches its tag:
* 对于每个CP条目,相应的CP补丁必须为null或具有与其标记匹配的格式
* <ul>
* <li>Integer, Long, Float, Double: the corresponding wrapper object type from java.lang
* Integer,Long,Float,Double:来自java.lang的相应包装器对象类型
* <li>Utf8: a string (must have suitable syntax if used as signature or name)
* Utf8:一个字符串(如果用作签名或名称,必须具有合适的语法)
* <li>Class: any java.lang.Class object
* Class:任何java.lang.Class对象
* <li>String: any object (not just a java.lang.String)
* 字符串(String):任何对象(不仅仅是java.lang.String)
* <li>InterfaceMethodRef: (NYI) a method handle to invoke on that call site's arguments
* InterfaceMethodRef:(NYI)一个方法句柄,用于调用该调用点的参数
* </ul>
* @params hostClass context for linkage, access control, protection domain, and class loader
* 链接,访问控制,保护域和类加载器的上下文
* @params data bytes of a class file
* 类文件的字节
* @params cpPatches where non-null entries exist, they replace corresponding CP entries in data
* 在存在非空条目的情况下,它们替换数据中的相应CP条目
*/
public native Class<?> defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches);
/** Allocate an instance but do not run any constructor.
* Initializes the class if it has not yet been.
* 分配实例但不运行任何构造函数。 如果尚未进行,则初始化该类。
*/
public native Object allocateInstance(Class<?> cls)
throws InstantiationException;
/**
* Lock the object. It must get unlocked via {@link #monitorExit}.
* 锁定对象。 它必须通过{@link #monitorExit}解锁。
*/
@Deprecated
public native void monitorEnter(Object o);
/**
* Unlock the object. It must have been locked via {@link #monitorEnter}.
* 解锁对象。 它必须已通过{@link #monitorEnter}锁定。
*/
@Deprecated
public native void monitorExit(Object o);
/**
* Tries to lock the object. Returns true or false to indicate
* whether the lock succeeded. If it did, the object must be
* unlocked via {@link #monitorExit}.
* 试图锁定对象。 返回true或false以指示锁是否成功。 如果是,则必须通过
* {@link #monitorExit}解锁对象。
*/
@Deprecated
public native boolean tryMonitorEnter(Object o);
/**
* Throw the exception without telling the verifier.
* 抛出异常而不告诉验证者。
*/
public native void throwException(Throwable ee);
/**
* Atomically update Java variable to <tt>x</tt> if it is currently
* holding <tt>expected</tt>.
* 如果Java变量当前持有<tt>expected</tt>,则将其原子地更新为<tt>x</tt>。
* @return <tt>true</tt> if successful
* 更新成功返回true
*/
public final native boolean compareAndSwapObject(Object o, long offset,
Object expected,
Object x);
/**
* Atomically update Java variable to <tt>x</tt> if it is currently
* holding <tt>expected</tt>.
* 如果Java变量当前持有<tt>expected</tt>,则将其原子地更新为<tt>x</tt>。
* @return <tt>true</tt> if successful
* 更新成功返回true
*/
public final native boolean compareAndSwapInt(Object o, long offset,
int expected,
int x);
/**
* Atomically update Java variable to <tt>x</tt> if it is currently
* holding <tt>expected</tt>.
* 如果Java变量当前持有<tt>expected</tt>,则将其原子地更新为<tt>x</tt>。
* @return <tt>true</tt> if successful
* 更新成功返回true
*/
public final native boolean compareAndSwapLong(Object o, long offset,
long expected,
long x);
/**
* Fetches a reference value from a given Java variable, with volatile
* load semantics. Otherwise identical to {@link #getObject(Object, long)}
* 从给定的Java变量中获取具有volatile加载语义的引用值。 否则与{@link
* #getObject(Object,long)}相同
*/
public native Object getObjectVolatile(Object o, long offset);
/**
* Stores a reference value into a given Java variable, with
* volatile store semantics. Otherwise identical to {@link #putObject(Object, long, Object)}
* 使用volatile存储语义将引用值存储到给定的Java变量中。 否则与{@link
* #putObject(Object,long,Object)}相同
*/
public native void putObjectVolatile(Object o, long offset, Object x);
// 基本类型的volatile版本
/** Volatile version of {@link #getInt(Object, long)} */
public native int getIntVolatile(Object o, long offset);
/** Volatile version of {@link #putInt(Object, long, int)} */
public native void putIntVolatile(Object o, long offset, int x);
/** Volatile version of {@link #getBoolean(Object, long)} */
public native boolean getBooleanVolatile(Object o, long offset);
/** Volatile version of {@link #putBoolean(Object, long, boolean)} */
public native void putBooleanVolatile(Object o, long offset, boolean x);
/** Volatile version of {@link #getByte(Object, long)} */
public native byte getByteVolatile(Object o, long offset);
/** Volatile version of {@link #putByte(Object, long, byte)} */
public native void putByteVolatile(Object o, long offset, byte x);
/** Volatile version of {@link #getShort(Object, long)} */
public native short getShortVolatile(Object o, long offset);
/** Volatile version of {@link #putShort(Object, long, short)} */
public native void putShortVolatile(Object o, long offset, short x);
/** Volatile version of {@link #getChar(Object, long)} */
public native char getCharVolatile(Object o, long offset);
/** Volatile version of {@link #putChar(Object, long, char)} */
public native void putCharVolatile(Object o, long offset, char x);
/** Volatile version of {@link #getLong(Object, long)} */
public native long getLongVolatile(Object o, long offset);
/** Volatile version of {@link #putLong(Object, long, long)} */
public native void putLongVolatile(Object o, long offset, long x);
/** Volatile version of {@link #getFloat(Object, long)} */
public native float getFloatVolatile(Object o, long offset);
/** Volatile version of {@link #putFloat(Object, long, float)} */
public native void putFloatVolatile(Object o, long offset, float x);
/** Volatile version of {@link #getDouble(Object, long)} */
public native double getDoubleVolatile(Object o, long offset);
/** Volatile version of {@link #putDouble(Object, long, double)} */
public native void putDoubleVolatile(Object o, long offset, double x);
/**
* Version of {@link #putObjectVolatile(Object, long, Object)}
* that does not guarantee immediate visibility of the store to
* other threads. This method is generally only useful if the
* underlying field is a Java volatile (or if an array cell, one
* that is otherwise only accessed using volatile accesses).
* {@link #putObjectVolatile(Object,long,Object)}的版本,不保证存储立即
* 对其他线程可见。 此方法通常仅在底层字段是Java volatile时(或者如果是数组单元,
* 否则仅使用volatile修饰进行访问)才有用。
*/
public native void putOrderedObject(Object o, long offset, Object x);
/** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */
public native void putOrderedInt(Object o, long offset, int x);
/** Ordered/Lazy version of {@link #putLongVolatile(Object, long, long)} */
public native void putOrderedLong(Object o, long offset, long x);
/**
* Unblock the given thread blocked on <tt>park</tt>, or, if it is
* not blocked, cause the subsequent call to <tt>park</tt> not to
* block. Note: this operation is "unsafe" solely because the
* caller must somehow ensure that the thread has not been
* destroyed. Nothing special is usually required to ensure this
* when called from Java (in which there will ordinarily be a live
* reference to the thread) but this is not nearly-automatically
* so when calling from native code.
* 取消阻塞在<tt> park </ tt>上的给定线程,或者,如果它未被阻塞,则导致对<tt>park</tt>
* 的后续调用不阻塞。 注意:此操作“不安全”仅仅是因为调用者必须以某种方式确保线程未被销毁。
* 从Java调用时通常不需要特殊的东西来确保这一点(通常会有一个对线程的实时引用)但是当从
* 本机代码调用时,这几乎不是自动的。
* @param thread the thread to unpark.
* 取消阻塞的线程
*
*/
public native void unpark(Object thread);
/**
* Block current thread, returning when a balancing
* <tt>unpark</tt> occurs, or a balancing <tt>unpark</tt> has
* already occurred, or the thread is interrupted, or, if not
* absolute and time is not zero, the given time nanoseconds have
* elapsed, or if absolute, the given deadline in milliseconds
* since Epoch has passed, or spuriously (i.e., returning for no
* "reason"). Note: This operation is in the Unsafe class only
* because <tt>unpark</tt> is, so it would be strange to place it
* elsewhere.
* 阻塞当前线程,在以下情况会返回:
* 1、对应的unpark发生了
* 2、对应的unpark已经发生
* 3、当前线程被中断
* 4、如果不是绝对的并且时间不为零,给定时间纳秒已经过去
* 5、如果是绝对地,以毫秒表的时间戳截止时间已经过去
* 6、虚假地(即,没有“理由”返回)?
* 注意:此操作仅在Unsafe类中,因为<tt> unpark </ tt>在Unsafe中,将其放在其他位置会很奇怪。
*/
public native void park(boolean isAbsolute, long time);
/**
* Gets the load average in the system run queue assigned
* to the available processors averaged over various periods of time.
* This method retrieves the given <tt>nelem</tt> samples and
* assigns to the elements of the given <tt>loadavg</tt> array.
* The system imposes a maximum of 3 samples, representing
* averages over the last 1, 5, and 15 minutes, respectively.
* 获取分配给在不同时间段内的可用处理器的系统运行队列中的平均负载。 此方法检索给定的
* <tt>nelem</tt>样本并分配给定<tt>loadavg</tt>数组的元素。系统最多应用3个样本,
* 代表过去1,5,15分钟的平均值。
*
* @params loadavg an array of double of size nelems
* 一个双倍大小的nelems数组
* @params nelems the number of samples to be retrieved and
* must be 1 to 3.
* 要检索的样本数量必须为1到3。
* @return the number of samples actually retrieved; or -1
* if the load average is unobtainable.
* 实际检索的样本数量; 如果无法获得平均负载,则返回-1。
*/
public native int getLoadAverage(double[] loadavg, int nelems);
// The following contain CAS-based Java implementations used on
// platforms not supporting native instructions
// 以下部分包含基于CAS的Java实现,可用于不支持本机指令的平台
/**
* Atomically adds the given value to the current value of a field
* or array element within the given object <code>o</code>
* at the given <code>offset</code>.
* 原子地将给定值相加到到给定对象的字段或数组元素。
*
* @param o object/array to update the field/element in
* 用于更新字段/元素的对象/数组
* @param offset field/element offset
* 字段/元素偏移量
* @param delta the value to add
* 要添加的值
* @return the previous value
* 修改前的值
* @since 1.8
*/
public final int getAndAddInt(Object o, long offset, int delta) {
int v;
do {
v = getIntVolatile(o, offset);
} while (!compareAndSwapInt(o, offset, v, v + delta));
return v;
}
/**
* Atomically adds the given value to the current value of a field
* or array element within the given object <code>o</code>
* at the given <code>offset</code>.
* 原子地将给定值相加到给定对象的字段或数组元素。
*
* @param o object/array to update the field/element in
* 用于更新字段/元素的对象/数组
* @param offset field/element offset
* 字段/元素偏移量
* @param delta the value to add
* 要添加的值
* @return the previous value
* 修改前的值
* @since 1.8
*/
public final long getAndAddLong(Object o, long offset, long delta) {
long v;
do {
v = getLongVolatile(o, offset);
} while (!compareAndSwapLong(o, offset, v, v + delta));
return v;
}
/**
* Atomically exchanges the given value with the current value of
* a field or array element within the given object <code>o</code>
* at the given <code>offset</code>.
* 原子地将给定值设置到给定对象的字段或数组元素。
*
* @param o object/array to update the field/element in
* 用于更新字段/元素的对象/数组
* @param offset field/element offset
* 字段/元素偏移量
* @param newValue new value
* 要更新的值
* @return the previous value
* 修改前的值
* @since 1.8
*/
public final int getAndSetInt(Object o, long offset, int newValue) {
int v;
do {
v = getIntVolatile(o, offset);
} while (!compareAndSwapInt(o, offset, v, newValue));
return v;
}
/**
* Atomically exchanges the given value with the current value of
* a field or array element within the given object <code>o</code>
* at the given <code>offset</code>.
* 原子地将给定值设置到给定对象的字段或数组元素。
*
* @param o object/array to update the field/element in
* 用于更新字段/元素的对象/数组
* @param offset field/element offset
* 字段/元素偏移量
* @param newValue new value
* 要更新的值
* @return the previous value
* 修改前的值
* @since 1.8
*/
public final long getAndSetLong(Object o, long offset, long newValue) {
long v;
do {
v = getLongVolatile(o, offset);
} while (!compareAndSwapLong(o, offset, v, newValue));
return v;
}
/**
* Atomically exchanges the given reference value with the current
* reference value of a field or array element within the given
* object <code>o</code> at the given <code>offset</code>.
* 原子地将给定值设置到给定对象的字段或数组元素。
*
* @param o object/array to update the field/element in
* 用于更新字段/元素的对象/数组
* @param offset field/element offset
* 字段/元素偏移量
* @param newValue new value
* 要更新的值
* @return the previous value
* 修改前的值
* @since 1.8
*/
public final Object getAndSetObject(Object o, long offset, Object newValue) {
Object v;
do {
v = getObjectVolatile(o, offset);
} while (!compareAndSwapObject(o, offset, v, newValue));
return v;
}
/**
* Ensures lack of reordering of loads before the fence
* with loads or stores after the fence.
* 确保栅栏前的存储没有重新排序,栅栏后的存储没有重新排序。
* @since 1.8
*/
public native void loadFence();
/**
* Ensures lack of reordering of stores before the fence
* with loads or stores after the fence.
* 确保栅栏前的存储没有重新排序,栅栏后的存储没有重新排序。
* @since 1.8
*/
public native void storeFence();
/**
* Ensures lack of reordering of loads or stores before the fence
* with loads or stores after the fence.
* 确保栅栏前的加载或存储没有重新排序,栅栏后的加载或存储没有重新排序。
* @since 1.8
*/
public native void fullFence();
/**
* Throws IllegalAccessError; for use by the VM.
* 引发IllegalAccessError; 供VM使用。
* @since 1.8
*/
private static void throwIllegalAccessError() {
throw new IllegalAccessError();
}
}
|
[
"wangjunchao@gf.com.cn"
] |
wangjunchao@gf.com.cn
|
ef18227a0fb7b1653cbcb5c85a3f9394a1579704
|
c75dcbf328e3a7b4451ad9115a48fe438e072747
|
/Monk.java
|
0935a227fa1f74419206c8b6c5794741e89bc2b6
|
[] |
no_license
|
garrisonf/Final-Group-Project
|
990aa7442f74dc5c57f4fe0a1a23ccb010fa58bf
|
a9f0b8f5fbbea0ccad82da0ba3d51333c2cd53dd
|
refs/heads/master
| 2021-03-31T08:36:27.646854
| 2020-06-07T04:56:45
| 2020-06-07T04:56:45
| 248,092,821
| 0
| 1
| null | 2020-06-05T22:24:09
| 2020-03-17T23:19:00
|
Java
|
UTF-8
|
Java
| false
| false
| 1,142
|
java
|
package DungeonsAndDragons;
import java.util.Random;
public class Monk extends Character {
private Random rand;
public Monk() {super();this.rand = new Random();this.initialize();}
public Monk(String name, String characterClass, String description, String race) {
super(name, "Monk", description, race);this.initialize();
}
@Override
public void initialize() {
armorClass = 16;
hitPointMax = rand.nextInt(8) + 8;
ArmorProf.add("None");
WeaponProf.add("Simple weapons");
WeaponProf.add("Shortswords");
ToolsProf.add("Artizans's tool or Musical Instrument");
SavingThrowsProf.add("Strength");
SavingThrowsProf.add("Dexterity");
SkillsProf.add("Acrobatics");
SkillsProf.add("Athletics");
SkillsProf.add("History");
SkillsProf.add("Insight");
SkillsProf.add("Religion");
SkillsProf.add("Stealth");
Spells.add("none");
Equipment = "a shortsword or any simple weapon, "
+ "a dungeoneer's pack or an explorer's pack, "
+ "10 darts";
}
}
|
[
"noreply@github.com"
] |
garrisonf.noreply@github.com
|
5c06b991461e7898da2f50b9a587eb51c7e56898
|
8243168733b3b7a6cc2e11445593f99bc3f3c18f
|
/MyApplication/app/src/main/java/com/example/myapplication/EX43Activity.java
|
e2614950e8ad0fb34f7f8a391d953f69db8ef343
|
[] |
no_license
|
TaeHeeHyeung/kitriAndroid
|
192cd07648be30f629292cb5e80a6375bc92db0d
|
c47bfafd4b2d86b829674f923b4a0981ddcca888
|
refs/heads/master
| 2020-05-30T04:01:12.287901
| 2019-06-11T08:29:26
| 2019-06-11T08:29:26
| 189,151,308
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,948
|
java
|
package com.example.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class EX43Activity extends AppCompatActivity {
TextView result;
EditText e1;
EditText e2;
String text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ex43);
e1= findViewById(R.id.edit1);
e2= findViewById(R.id.edit2);
result= findViewById(R.id.textResult);
text = result.getText().toString();
// findViewById(R.id.bt1).setOnClickListener((listView)->{});
findViewById(R.id.bt_plus).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
float num1 = Integer.parseInt(e1.getText().toString().trim());
float num2 = Integer.parseInt(e2.getText().toString());
result.setText( text+(num1+num2));
}
});
findViewById(R.id.bt_minus).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
float num1 = Integer.parseInt(e1.getText().toString());
float num2 = Integer.parseInt(e2.getText().toString());
result.setText( text+(num1-num2));
}
});
findViewById(R.id.bt_multi).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
float num1 = Integer.parseInt(e1.getText().toString());
float num2 = Integer.parseInt(e2.getText().toString());
result.setText( text+(num1*num2));
}
});
findViewById(R.id.bt_div).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
float num1 = Integer.parseInt(e1.getText().toString());
float num2 = Integer.parseInt(e2.getText().toString());
result.setText( text+(num1/num2));
}
});
}//end onCreate
public boolean isTextEmpty(View view){
switch (view.getId()){
case R.id.bt_plus :
Log.i("EX43Activity","bt_plus가 눌렸습니다.");
break;
}
if(e1.equals("")){
Toast.makeText(EX43Activity.this, "값을 입력해주세요.",Toast.LENGTH_SHORT).show();;
e1.requestFocus();
return true;
}else if(e2.equals("")){
Toast.makeText(EX43Activity.this, "값을 입력해주세요.",Toast.LENGTH_SHORT).show();;
e2.requestFocus();
return true;
}else{
return false;
}
}
}
|
[
"hth0893@naver.com"
] |
hth0893@naver.com
|
886e13db72c36ce88a6629a15290de78b85c4987
|
5d76b555a3614ab0f156bcad357e45c94d121e2d
|
/src/com/fasterxml/jackson/databind/deser/ContextualDeserializer.java
|
ed3c9e60e60aad3c4cad4bf5113f2135f8eb6212
|
[] |
no_license
|
BinSlashBash/xcrumby
|
8e09282387e2e82d12957d22fa1bb0322f6e6227
|
5b8b1cc8537ae1cfb59448d37b6efca01dded347
|
refs/heads/master
| 2016-09-01T05:58:46.144411
| 2016-02-15T13:23:25
| 2016-02-15T13:23:25
| 51,755,603
| 5
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 723
|
java
|
package com.fasterxml.jackson.databind.deser;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonMappingException;
public abstract interface ContextualDeserializer
{
public abstract JsonDeserializer<?> createContextual(DeserializationContext paramDeserializationContext, BeanProperty paramBeanProperty)
throws JsonMappingException;
}
/* Location: /home/dev/Downloads/apk/dex2jar-2.0/crumby-dex2jar.jar!/com/fasterxml/jackson/databind/deser/ContextualDeserializer.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
[
"binslashbash@otaking.top"
] |
binslashbash@otaking.top
|
60f98e63faa791129a5c2ac6be453882faafb161
|
a77767e704d0474d3f0bc0dc22e8822867d210ba
|
/BDD/TP1/squelette_appli.java
|
817d0124dbbe6e9f5c7f37ccadc004f37866240e
|
[] |
no_license
|
leandreSL/M1
|
062e6ce7b98ff7a325dab8833992872302b4db0b
|
4878ddec12a35aacb3be980e85740b23d5434ba3
|
refs/heads/master
| 2020-07-30T22:26:43.326847
| 2019-12-09T09:34:06
| 2019-12-09T09:34:06
| 210,380,121
| 0
| 0
| null | 2019-09-30T20:15:25
| 2019-09-23T14:45:04
|
Jupyter Notebook
|
UTF-8
|
Java
| false
| false
| 5,897
|
java
|
import java.sql.*;
import java.util.Scanner;
public class squelette_appli {
static final String CONN_URL = "jdbc:oracle:thin:@im2ag-oracle.e.ujf-grenoble.fr:1521:im2ag";
static final String USER = "salamanl";
static final String PASSWD = "XXXX";
static Connection conn;
public static void main(String args[]) {
try {
// Enregistrement du driver Oracle
System.out.print("Loading Oracle driver... ");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); System.out.println("loaded");
// Etablissement de la connection
System.out.print("Connecting to the database... ");
conn = DriverManager.getConnection(CONN_URL,USER,PASSWD);
System.out.println("connected");
// Desactivation de l'autocommit
conn.setAutoCommit(false);
System.out.println("Autocommit disabled");
// Liberation des ressources et fermeture de la connexion...
// REQUETE 1
/*
Statement requete = conn.createStatement();
ResultSet resultat = requete.executeQuery("select * from lescages");
while(resultat.next()) {
System.out.println("Numéro de cage = " + resultat.getString("nocage") +
", Fonction = " + resultat.getString("fonction")+
", Numéro Allée = " + resultat.getString("noallee"));
}
resultat.close();
Scanner sc = new Scanner(System.in);
System.out.println("numéro de cage à modifier : ");
String nocage = sc.nextLine();
System.out.println("nouvelle fonction de la cage : ");
String nvfct = sc.nextLine();
ResultSet update_lescages = requete.executeQuery("update lescages set fonction = '" + nvfct.toLowerCase() + "' where nocage = " + nocage);
ResultSet affichage_cage = requete.executeQuery("select * from lescages");
while(affichage_cage.next()) {
System.out.println("Numéro de cage = " + affichage_cage.getString("nocage") +
", Fonction = " + affichage_cage.getString("fonction")+
", Numéro Allée = " + affichage_cage.getString("noallee"));
}
update_lescages.close();
affichage_cage.close();
requete.close();
*/
// FIN REQUETE 1
//REQUETE 2
Statement requete2 = conn.createStatement();
ResultSet affichage_gardiens = requete2.executeQuery("select * from lesgardiens");
while(affichage_gardiens.next()) {
System.out.println("Numéro de cage = " + affichage_gardiens.getString("nocage") +
", Nom = " + affichage_gardiens.getString("nome"));
}
affichage_gardiens.close();
Scanner sc = new Scanner(System.in);
System.out.println("nom du gardien a réaffecter : ");
String nome = sc.nextLine();
ResultSet affichage_gardien_cage = requete2.executeQuery("select * from lesgardiens inner join lescages on lesgardiens.nocage = lescages.nocage where nome = '" + nome + "'");
while(affichage_gardien_cage.next()) {
System.out.println("Numéro de cage = " + affichage_gardien_cage.getString("nocage") +
", Fonction = " + affichage_gardien_cage.getString("fonction") +
", Numero allee = " + affichage_gardien_cage.getString("noallee") );
}
affichage_gardien_cage.close();
System.out.println("numéro de cage où il sera retiré : ");
String nocage_r = sc.nextLine();
ResultSet test_cage_non_vide = requete2.executeQuery("select * from lescages where nocage=" + nocage_r + " and nocage not in (select nocage from lesanimaux) ");
ResultSet test_cage_non_gardee = requete2.executeQuery("select * from lescages inner join lesgardiens on lescages.nocage=lesgardiens.nocage where lescages.nocage="+ nocage_r + " and nome not in (select nome from lesgardiens where nome='" + nome +"')");
if (!test_cage_non_vide.next()){
if (!test_cage_non_gardee.next()){
System.out.println("La cage contient des animaux et ne sera plus surveuillé, veuillez choisir une autre cage : ");
nocage_r = sc.nextLine();
}
}
ResultSet delete_cage_gardien = requete2.executeQuery("delete from lesgardiens where nome = '" + nome + "' and nocage = '" + nocage_r + "'");
delete_cage_gardien.close();
ResultSet affichage_nv_cage = requete2.executeQuery("select * from LesSpecialites inner join LesCages on LesSpecialites.fonction_cage=LesCages.fonction where LesSpecialites.nome = '" + nome + "'");
while(affichage_nv_cage.next()) {
System.out.println("Numéro de cage = " + affichage_nv_cage.getString("nocage") +
", Fonction = " + affichage_nv_cage.getString("fonction") +
", Numero allee = " + affichage_nv_cage.getString("noallee") );
}
System.out.println("numéro de cage à affecter : ");
affichage_nv_cage.close();
String nocage_nv = sc.nextLine();
ResultSet test_cage_vide_gardee = requete2.executeQuery("select * from lesgardiens inner join lescages on lesgardiens.nocage = lescages.nocage where lescages.nocage=" + nocage_nv + " and lescages.nocage not in (select nocage from lesanimaux)");
if (test_cage_vide_gardee.next()){
System.out.println("La cage est vide, et un gardien est déjà affecté, veuillez choisir un autre cage : ");
nocage_nv = sc.nextLine();
}
ResultSet insert_gardien = requete2.executeQuery("insert into LesGardiens values(" + nocage_nv + ", '" + nome + "')");
insert_gardien.close();
requete2.close();
conn.close();
System.out.println("bye.");
// traitement d'exception
} catch (SQLException e) {
System.err.println("failed");
System.out.println("Affichage de la pile d'erreur");
e.printStackTrace(System.err);
System.out.println("Affichage du message d'erreur");
System.out.println(e.getMessage());
System.out.println("Affichage du code d'erreur");
System.out.println(e.getErrorCode());
}
}
}
|
[
"leandre.salamani@gmail.com"
] |
leandre.salamani@gmail.com
|
9237c3becebe8b5932583f9e4c70f3b3fb3681ba
|
f5c64c9df3ff6c204be94a00199831c70334c76e
|
/src/service/ProductService.java
|
cd3dacddbf4094a242905db5afcda4029f65be90
|
[] |
no_license
|
GhaziBenDahmane/CupcakesJavaFx
|
3066ff4f019f1645df00e03737a8da69849e9ca3
|
96330fd81c712c7a77c8bd8b554c095b7c87b196
|
refs/heads/master
| 2021-09-15T03:28:21.994198
| 2018-05-25T07:41:02
| 2018-05-25T07:41:02
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,028
|
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 service;
import util.DataSource;
import entity.Product;
import entity.Promotion;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.image.Image;
import javax.imageio.ImageIO;
/**
*
* @author Arshavin
*/
public class ProductService {
private Connection connection = null;
private boolean statusUpdate = false;
private boolean statusDelete = false;
private boolean statusAdd = false;
public ProductService() {
connection = DataSource.getInstance().getConnection();
}
public void insert(Product p) {
String req = "INSERT INTO product (name,price,type,description,photo,promotion_id,nb_viewed,nb_seller,barcode) VALUES (?,?,?,?,?,?,?,?,?)";
try {
PreparedStatement statment = connection.prepareStatement(req);
statment.setString(1, p.getName());
statment.setDouble(2, p.getPrice());
statment.setString(3, p.getType());
statment.setString(4, p.getDescription());
statment.setString(5, p.getPhoto());
statment.setInt(6, 1);
statment.setInt(7, p.getNb_view());
statment.setInt(8, p.getNb_seller());
statment.setInt(9, p.getBarcode());
statment.execute();
} catch (SQLException ex) {
Logger.getLogger(ProductService.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void insert(Product p, File file) throws FileNotFoundException, IOException {
String req = "INSERT INTO product (name,price,type,description,promotion_id,nb_viewed,photo,barcode,image) VALUES (?,?,?,?,?,?,?,?,?)";
try {
PreparedStatement statment = connection.prepareStatement(req);
statment.setString(1, p.getName());
statment.setDouble(2, p.getPrice());
statment.setString(3, p.getType());
statment.setString(4, p.getDescription());
FileInputStream fis = new FileInputStream(file);
statment.setBinaryStream(9, fis, file.length());
statment.setInt(5, p.getPromotion().getId_promotion());
statment.setInt(6, p.getNb_view());
String[] s;
s = file.getAbsolutePath().split("\\\\");
statment.setString(7,s[s.length-1]);
statment.setInt(8, p.getBarcode());
statment.execute();
} catch (SQLException ex) {
Logger.getLogger(ProductService.class.getName()).log(Level.SEVERE, null, ex);
}
}
public List<Product> selectAll() {
List<Product> products = new ArrayList<>();
String req = "select * from product p join promotion r where p.promotion_id=r.id";
try {
Statement statement = (Statement) connection.createStatement();
ResultSet result = statement.executeQuery(req);
while (result.next()) {
Promotion promotion = new Promotion(result.getInt("promotion_id"), result.getDouble("discount"), result.getDate("starting_date"), result.getDate("ending_date"));
Product p = new Product(result.getInt("id"), result.getString("name"), result.getString(4), result.getDouble(5),
result.getInt(6), result.getInt(7), result.getString(8), result.getString(9), result.getInt("barcode"), promotion, result.getBlob("image"));
products.add(p);
}
} catch (SQLException ex) {
Logger.getLogger(ProductService.class.getName()).log(Level.SEVERE, null, ex);
}
return products;
}
public void update(Product p) {
String req = "Update product set name=? , type=? , price=? ,description=? ,barcode=? where id= ?";
try {
PreparedStatement statment = connection.prepareStatement(req);
statment.setString(1, p.getName());
statment.setDouble(3, p.getPrice());
statment.setString(2, p.getType());
statment.setString(4, p.getDescription());
statment.setInt(5, p.getBarcode());
statment.setInt(6, p.getId());
statment.executeUpdate();
setStatusUpdate(true);
} catch (SQLException ex) {
Logger.getLogger(ProductService.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void delete(int id) {
String req = "Delete from product where id= ?";
try {
PreparedStatement statment = connection.prepareStatement(req);
statment.setInt(1, id);
statment.executeUpdate();
} catch (SQLException ex) {
Logger.getLogger(ProductService.class.getName()).log(Level.SEVERE, null, ex);
}
}
public Product selectProductById(int id) throws IOException {
Product p=null ;
String req = "select * from product p join promotion r where p.promotion_id=r.id and p.id=?";
try {
PreparedStatement statement = connection.prepareStatement(req);
statement.setInt(1, id);
ResultSet result = statement.executeQuery();
while (result.next()) {
Promotion promotion = new Promotion(result.getInt("promotion_id"), result.getDouble("discount"), result.getDate("starting_date"), result.getDate("ending_date"));
System.out.println(promotion);
p = new Product(result.getInt(1), result.getString(3), result.getString(4), result.getDouble(5),
result.getInt(6), result.getInt(8), result.getString(10), result.getString(9), result.getInt(7), promotion,result.getBlob("image"));
}
} catch (SQLException ex) {
Logger.getLogger(ProductService.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println(p);
return p;
}
public Image selectImageById(int id) throws IOException {
Product p = null;
Image image=null;
String req = "select * from product p join promotion r where p.promotion_id=r.id and p.id=?";
try {
PreparedStatement statement = connection.prepareStatement(req);
statement.setInt(1, id);
ResultSet result = statement.executeQuery();
while (result.next()) {
System.out.println(result.getBinaryStream("image"));
InputStream is = result.getBinaryStream("image"); // image from database
BufferedImage imBuff = ImageIO.read(is); //converting to buffered image
image = SwingFXUtils.toFXImage(imBuff, null); //converting to
System.out.println(image);
}
} catch (SQLException ex) {
Logger.getLogger(ProductService.class.getName()).log(Level.SEVERE, null, ex);
}
return image;
}
public boolean isStatusDelete() {
return statusDelete;
}
public void setStatusDelete(boolean statusDelete) {
this.statusDelete = statusDelete;
}
public boolean isStatusAdd() {
return statusAdd;
}
public void setStatusAdd(boolean statusAdd) {
this.statusAdd = statusAdd;
}
public boolean isStatusUpdate() {
return statusUpdate;
}
public void setStatusUpdate(boolean statusUpdate) {
this.statusUpdate = statusUpdate;
}
}
|
[
"achrefarshavin@gmail.Com"
] |
achrefarshavin@gmail.Com
|
033c51fb6134a54b046f7f31c728e48c73d8753a
|
6348a3e9ffa72a0cf68d32e608b3c268b2b4c44e
|
/sample-spring-cloud-config-bus-amqp/sample-config-service/src/main/java/packt/dbatista/services/sample/config/service/ConfigApplication.java
|
24fef535719ccccebcd6a5aceea731c1ba4c0efb
|
[] |
no_license
|
DouglasGo8/mastering-spring-cloud
|
6524ccb0d44168e35be28f79be823737869dfbe2
|
2bd7985be2c843cc1f93374d63be929fe40a0749
|
refs/heads/master
| 2021-07-08T23:40:16.804835
| 2020-04-18T21:08:12
| 2020-04-18T21:08:12
| 187,293,682
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 753
|
java
|
package packt.dbatista.services.sample.config.service;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.monitor.GithubPropertyPathNotificationExtractor;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.context.annotation.Bean;
@EnableConfigServer
@SpringBootApplication
public class ConfigApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigApplication.class, args);
}
@Bean
public GithubPropertyPathNotificationExtractor githubPropertyPathNotificationExtractor() {
return new GithubPropertyPathNotificationExtractor();
}
}
|
[
"sgtear@hotmail.com"
] |
sgtear@hotmail.com
|
c22fc5f4483c7b9d05afebbff643083d210798a6
|
108101bfd9de28e73aa42cb2ff24f64215d642b3
|
/javaweb/day01_basicstrong/src/cn/itcast/annotation/Pro.java
|
15e71cb6febf3ea3540000ba0823e993b298820e
|
[] |
no_license
|
nsbstu/javaweb
|
519315ce13231d6e0ab43f24ce974d7e956e1ca1
|
fc98835c6c23b52e58567bafaea3963fdd64a0d3
|
refs/heads/master
| 2023-07-16T11:43:29.720658
| 2021-08-30T13:30:33
| 2021-08-30T13:30:33
| 401,327,031
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 555
|
java
|
package cn.itcast.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/*
描述需要执行的类名和方法名
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Pro {
String className();
String methodName();
}
/*
public class ProImpl implements Pro{
public String className(){
return "cn.itcast.annotation.Demo1";
}
public String methodName(){
return "show";
}
}
*/
|
[
"964851283@qq.com"
] |
964851283@qq.com
|
e2ba96642565e95aada31725d54fd3deb4d35f86
|
ee4843956e8cb8d29ab98635c5cda745354ae7d5
|
/src/main/java/com/mangopay/entities/subentities/PayInPaymentDetailsPreAuthorized.java
|
6ee526d68daba21cc9dc197222cace402660afa3
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
tlehoux/mangopay2-java-sdk
|
d1619f2096ea5ba290d81ca86cb07fb347aa572f
|
3973617760e524b4ec007b062eda9be4cd58e757
|
refs/heads/master
| 2021-05-03T16:54:50.037334
| 2016-10-21T17:15:29
| 2016-10-21T17:15:29
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 419
|
java
|
package com.mangopay.entities.subentities;
import com.mangopay.core.Dto;
import com.mangopay.core.interfaces.IPayInPaymentDetails;
/**
* Class representing the PreAuthorized type for execution option in PayIn entity.
*/
public class PayInPaymentDetailsPreAuthorized extends Dto implements IPayInPaymentDetails {
/**
* Pre-authorization identifier.
*/
public String PreauthorizationId;
}
|
[
"lukasz.drzewiecki@mosaic-lab.com"
] |
lukasz.drzewiecki@mosaic-lab.com
|
86025fdd8295669926c0dcb1b878e4a4ca123453
|
a8825c4187d33881510b543cf1b7d733d9c7d10a
|
/java/tsingularity/lolexplorer/Model/DTO/StaticData/BasicDataStats.java
|
fb1a294e5ed652dcae7e85c7f7ec32fe93c5abf2
|
[
"MIT"
] |
permissive
|
joancefet/LOLExplorer
|
f613368c03a27c29a2a45e33b3290f0596fe34b4
|
1be964747ace3506531ba6a5a4b6f256ae010d91
|
refs/heads/master
| 2020-01-23T21:32:06.689413
| 2016-02-02T17:38:07
| 2016-02-02T17:38:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,728
|
java
|
package tsingularity.lolexplorer.Model.DTO.StaticData;
public class BasicDataStats {
public double flatArmorMod;
public double flatAttackSpeedMod;
public double flatBlockMod;
public double flatCritChanceMod;
public double flatCritDamageMod;
public double flatEXPBonus;
public double flatEnergyPoolMod;
public double flatEnergyRegenMod;
public double flatHPPoolMod;
public double flatHPRegenMod;
public double flatMPPoolMod;
public double flatMPRegenMod;
public double flatMagicDamageMod;
public double flatMovementSpeedMod;
public double flatPhysicalDamageMod;
public double flatSpellBlockMod;
public double percentArmorMod;
public double percentAttackSpeedMod;
public double percentBlockMod;
public double percentCritChanceMod;
public double percentCritDamageMod;
public double percentDodgeMod;
public double percentEXPBonus;
public double percentHPPoolMod;
public double percentHPRegenMod;
public double percentLifeStealMod;
public double percentMPPoolMod;
public double percentMPRegenMod;
public double percentMagicDamageMod;
public double percentMovementSpeedMod;
public double percentPhysicalDamageMod;
public double percentSpellBlockMod;
public double percentSpellVampMod;
public double rFlatArmorModPerLevel;
public double rFlatArmorPenetrationMod;
public double rFlatArmorPenetrationModPerLevel;
public double rFlatCritChanceModPerLevel;
public double rFlatCritDamageModPerLevel;
public double rFlatDodgeMod;
public double rFlatDodgeModPerLevel;
public double rFlatEnergyModPerLevel;
public double rFlatEnergyRegenModPerLevel;
public double rFlatGoldPer10Mod;
public double rFlatHPModPerLevel;
public double rFlatHPRegenModPerLevel;
public double rFlatMPModPerLevel;
public double rFlatMPRegenModPerLevel;
public double rFlatMagicDamageModPerLevel;
public double rFlatMagicPenetrationMod;
public double rFlatMagicPenetrationModPerLevel;
public double rFlatMovementSpeedModPerLevel;
public double rFlatPhysicalDamageModPerLevel;
public double rFlatSpellBlockModPerLevel;
public double rFlatTimeDeadMod;
public double rFlatTimeDeadModPerLevel;
public double rPercentArmorPenetrationMod;
public double rPercentArmorPenetrationModPerLevel;
public double rPercentAttackSpeedModPerLevel;
public double rPercentCooldownMod;
public double rPercentCooldownModPerLevel;
public double rPercentMagicPenetrationMod;
public double rPercentMagicPenetrationModPerLevel;
public double rPercentMovementSpeedModPerLevel;
public double rPercentTimeDeadMod;
public double rPercentTimeDeadModPerLevel;
public double getFlatArmorMod() {
return flatArmorMod;
}
public double getFlatAttackSpeedMod() {
return flatAttackSpeedMod;
}
public double getFlatCritChanceMod() {
return flatCritChanceMod;
}
public double getFlatBlockMod() {
return flatBlockMod;
}
public double getFlatCritDamageMod() {
return flatCritDamageMod;
}
public double getFlatEXPBonus() {
return flatEXPBonus;
}
public double getFlatEnergyRegenMod() {
return flatEnergyRegenMod;
}
public double getFlatEnergyPoolMod() {
return flatEnergyPoolMod;
}
public double getFlatHPPoolMod() {
return flatHPPoolMod;
}
public double getFlatHPRegenMod() {
return flatHPRegenMod;
}
public double getFlatMPPoolMod() {
return flatMPPoolMod;
}
public double getFlatMPRegenMod() {
return flatMPRegenMod;
}
public double getFlatMagicDamageMod() {
return flatMagicDamageMod;
}
public double getFlatMovementSpeedMod() {
return flatMovementSpeedMod;
}
public double getFlatPhysicalDamageMod() {
return flatPhysicalDamageMod;
}
public double getFlatSpellBlockMod() {
return flatSpellBlockMod;
}
public double getPercentArmorMod() {
return percentArmorMod;
}
public double getPercentAttackSpeedMod() {
return percentAttackSpeedMod;
}
public double getPercentBlockMod() {
return percentBlockMod;
}
public double getPercentCritChanceMod() {
return percentCritChanceMod;
}
public double getPercentCritDamageMod() {
return percentCritDamageMod;
}
public double getPercentDodgeMod() {
return percentDodgeMod;
}
public double getPercentEXPBonus() {
return percentEXPBonus;
}
public double getPercentHPPoolMod() {
return percentHPPoolMod;
}
public double getPercentHPRegenMod() {
return percentHPRegenMod;
}
public double getPercentLifeStealMod() {
return percentLifeStealMod;
}
public double getPercentMPPoolMod() {
return percentMPPoolMod;
}
public double getPercentMPRegenMod() {
return percentMPRegenMod;
}
public double getPercentMagicDamageMod() {
return percentMagicDamageMod;
}
public double getPercentMovementSpeedMod() {
return percentMovementSpeedMod;
}
public double getPercentPhysicalDamageMod() {
return percentPhysicalDamageMod;
}
public double getPercentSpellBlockMod() {
return percentSpellBlockMod;
}
public double getPercentSpellVampMod() {
return percentSpellVampMod;
}
public double getrFlatArmorModPerLevel() {
return rFlatArmorModPerLevel;
}
public double getrFlatArmorPenetrationMod() {
return rFlatArmorPenetrationMod;
}
public double getrFlatArmorPenetrationModPerLevel() {
return rFlatArmorPenetrationModPerLevel;
}
public double getrFlatCritChanceModPerLevel() {
return rFlatCritChanceModPerLevel;
}
public double getrFlatCritDamageModPerLevel() {
return rFlatCritDamageModPerLevel;
}
public double getrFlatDodgeMod() {
return rFlatDodgeMod;
}
public double getrFlatDodgeModPerLevel() {
return rFlatDodgeModPerLevel;
}
public double getrFlatEnergyModPerLevel() {
return rFlatEnergyModPerLevel;
}
public double getrFlatEnergyRegenModPerLevel() {
return rFlatEnergyRegenModPerLevel;
}
public double getrFlatGoldPer10Mod() {
return rFlatGoldPer10Mod;
}
public double getrFlatHPModPerLevel() {
return rFlatHPModPerLevel;
}
public double getrFlatHPRegenModPerLevel() {
return rFlatHPRegenModPerLevel;
}
public double getrFlatMPModPerLevel() {
return rFlatMPModPerLevel;
}
public double getrFlatMPRegenModPerLevel() {
return rFlatMPRegenModPerLevel;
}
public double getrFlatMagicDamageModPerLevel() {
return rFlatMagicDamageModPerLevel;
}
public double getrFlatMagicPenetrationMod() {
return rFlatMagicPenetrationMod;
}
public double getrFlatMagicPenetrationModPerLevel() {
return rFlatMagicPenetrationModPerLevel;
}
public double getrFlatMovementSpeedModPerLevel() {
return rFlatMovementSpeedModPerLevel;
}
public double getrFlatPhysicalDamageModPerLevel() {
return rFlatPhysicalDamageModPerLevel;
}
public double getrFlatSpellBlockModPerLevel() {
return rFlatSpellBlockModPerLevel;
}
public double getrFlatTimeDeadMod() {
return rFlatTimeDeadMod;
}
public double getrFlatTimeDeadModPerLevel() {
return rFlatTimeDeadModPerLevel;
}
public double getrPercentArmorPenetrationModPerLevel() {
return rPercentArmorPenetrationModPerLevel;
}
public double getrPercentArmorPenetrationMod() {
return rPercentArmorPenetrationMod;
}
public double getrPercentAttackSpeedModPerLevel() {
return rPercentAttackSpeedModPerLevel;
}
public double getrPercentCooldownMod() {
return rPercentCooldownMod;
}
public double getrPercentCooldownModPerLevel() {
return rPercentCooldownModPerLevel;
}
public double getrPercentMagicPenetrationModPerLevel() {
return rPercentMagicPenetrationModPerLevel;
}
public double getrPercentMagicPenetrationMod() {
return rPercentMagicPenetrationMod;
}
public double getrPercentMovementSpeedModPerLevel() {
return rPercentMovementSpeedModPerLevel;
}
public double getrPercentTimeDeadMod() {
return rPercentTimeDeadMod;
}
public double getrPercentTimeDeadModPerLevel() {
return rPercentTimeDeadModPerLevel;
}
}
|
[
"111"
] |
111
|
24165c83a85acb83fdcfe88c73de7e9921d388b3
|
896ea842fc4ce802008078f7e155efb180111e1d
|
/marvin-test/src/main/java/cn/jol/ObjectSize.java
|
e83b9ac6304a9f1e740adee5495e755671558e2b
|
[] |
no_license
|
marvinHubLook/marvin-all
|
ae68c418c5148acd58c8623aea502cc0a97638c6
|
2a9d18cccff61ba260feb3c2805e7b7f98c01f25
|
refs/heads/master
| 2020-04-19T08:32:44.522523
| 2019-03-11T02:30:01
| 2019-03-11T02:30:01
| 168,080,760
| 2
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,558
|
java
|
package cn.jol;
import cn.lang.unsafe.UnsafeUtils;
import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.vm.VM;
import sun.misc.Unsafe;
import java.util.HashMap;
/**
* @program: marvin-all
* @description: TODO
* @author: Mr.Wang
* @create: 2018-12-29 12:03
* http://www.importnew.com/1305.html
* https://www.jianshu.com/p/cb5e09facfee
* Java对象所占内存的大小 : https://www.jianshu.com/p/9d729c9c94c4
**/
public class ObjectSize {
public static void main(String[] args) throws NoSuchFieldException {
System.out.println(VM.current().details());
System.out.println(ClassLayout.parseClass(VO.class).toPrintable());
System.out.println("=================");
Unsafe unsafe = UnsafeUtils.unsafe;
VO vo = new VO();
vo.a=2;
vo.b=3;
vo.d=new HashMap<>();
long aoffset = unsafe.objectFieldOffset(VO.class.getDeclaredField("a"));
System.out.println("aoffset="+aoffset);
// 获取a的值
Object va = unsafe.getObject(vo, aoffset);
System.out.println("va="+va);
System.out.println("=======------------==========");
System.out.println(ClassLayout.parseClass(B.class).toPrintable());
}
}
/**
*
* > * 1: 除了对象整体需要按8字节对齐外,每个成员变量都尽量使本身的大小在内存中尽量对齐。比如 int 按 4 位对齐,long 按 8 位对齐。
* >
* > * 2:类属性按照如下优先级进行排列:长整型和双精度类型;整型和浮点型;字符和短整型;字节类型和布尔类型,最后是引用类型。这些属性都按照各自的单位对齐。
* >
* > * 3:优先按照规则一和二处理父类中的成员,接着才是子类的成员。
* >
* > * 4:当父类中最后一个成员和子类第一个成员的间隔如果不够4个字节的话,就必须扩展到4个字节的基本单位。
* >
* > * 5:如果子类第一个成员是一个双精度或者长整型,并且父类并没有用完8个字节,JVM会破坏规则2,按照整形(int),短整型(short),字节型(byte),引用类型(reference)的顺序,向未填满的空间填充。
*/
class VO {
public Integer a = 0;
public long b = 0;
public String c= "123";
public Object d= null;
public int e = 100;
public static int f= 0;
public static String g= "";
public Object h= null;
public boolean i;
public boolean j;
}
class A {
byte a;
}
class B extends A{
long b;
short c;
byte d;
}
|
[
"marvinhublook@gmail.com"
] |
marvinhublook@gmail.com
|
0797f4d993d5615b560af8dd839dda0fff3c68f3
|
c36cf4e5ad75873f45fda1cb660ce0abd7979f25
|
/app/src/main/java/com/example/administrator/project/adapter_my/Adapter_loop_Image.java
|
68a473f84440c4344442860751b60cd488d56701
|
[] |
no_license
|
bluezqf/zqf
|
209cec027757a2f88782a0f826afeef8fa6c5d16
|
593121252fb631e1ffea2f27479e118228620683
|
refs/heads/master
| 2020-04-11T06:28:05.743173
| 2018-12-13T11:42:37
| 2018-12-13T11:42:37
| 161,581,379
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,433
|
java
|
package com.example.administrator.project.adapter_my;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import java.util.List;
/**
* Created by 19209 on 2018/9/19.
*/
public class Adapter_loop_Image extends PagerAdapter {
// private List<Integer>colors = null;
private List<Integer>image =null;//添加一
@Override
public int getCount() {
//if(colors !=null){
// return colors.size();}
if(image !=null){
return Integer.MAX_VALUE;}
return 0;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {//重点
int relposition = position%image.size();
ImageView imageView = new ImageView((container.getContext()));
//imageView.setBackgroundColor(colors.get(position));
imageView.setImageResource(image.get(relposition));//添加一
//设置完数据以后,就添加到容器里
container.addView(imageView);
return imageView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
public void setData(List<Integer>image){
this.image = image;//修改一
}
}
|
[
"1647120852@qq.com"
] |
1647120852@qq.com
|
ca356562d24f7f6d6b7dc2ebc77eb59c044437a7
|
b7e2001c5656cc601938b8148069aa45aae2be8d
|
/iCAide/src/main/java/com/im/sdk/dy/common/view/VerticalImageSpan.java
|
fb5e55f83c5a99402de6b9c8981d9d115bc349e9
|
[] |
no_license
|
xiongzhuo/Nursing
|
f260cec3b2b4c46d395a4cc93040358bd7c2cc38
|
25e6c76ccd69836407dcc6b59ca2daa41a3c9459
|
refs/heads/master
| 2021-01-18T08:10:21.098781
| 2017-08-15T08:56:59
| 2017-08-15T08:57:23
| 100,354,682
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,365
|
java
|
package com.im.sdk.dy.common.view;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.text.style.ImageSpan;
/**
* com.im.sdk.dy.common.view in ECDemo_Android
* Created by Jorstin on 2015/6/9.
*/
public class VerticalImageSpan extends ImageSpan {
private int mPadding = 0;
/**
* @param drawable
*/
public VerticalImageSpan(Drawable drawable) {
super(drawable , 1);
}
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end,
float x, int top, int y, int bottom, Paint paint) {
Drawable drawable = getDrawable();
canvas.save();
int length = 0;
int dy = bottom - drawable.getBounds().bottom + mPadding;
if(mVerticalAlignment == ALIGN_BASELINE) {
length = text.length();
}
for(int i = 0 ; i < length ; i++) {
if (!(Character.isLetterOrDigit(text.charAt(i)))) {
continue;
}
dy -= paint.getFontMetricsInt().descent;
canvas.translate(x, dy);
drawable.draw(canvas);
canvas.restore();
return ;
}
}
/**
*
* @param padding
*/
public final void setPadding(int padding) {
mPadding = padding;
}
}
|
[
"15388953585@163.com"
] |
15388953585@163.com
|
3cf3b9570bc60f22fddaaa933985c8f9a760598f
|
9254e2f92f96b83c781799c05f05941c52ea3dc0
|
/src/com/lmkj/controller/WebService.java
|
cc462808c3d569c5ead501aa44484771c40c4253
|
[] |
no_license
|
radtek/GpsNet
|
e1e6555b29af89f95bbcea4ec14f2b07e1c33f89
|
8dd043b8f63552dd987729e65dec8d0fbf87180c
|
refs/heads/master
| 2020-06-27T15:11:40.384070
| 2017-08-10T15:27:22
| 2017-08-10T15:27:22
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,092
|
java
|
package com.lmkj.controller;
import java.sql.ResultSet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.lmkj.bs.WebServiceBs;
import com.lmkj.util.JsonTools;
@Controller
public class WebService {
@Autowired
WebServiceBs wsb;
@RequestMapping(value = "/GetMenu", method = RequestMethod.POST)
public void GetMenu(HttpServletRequest req, HttpServletResponse resp, String userid) throws Exception {
resp.setContentType("text/hmtl;charset=utf-8");
ResultSet rs = wsb.GetMenu(userid);
resp.getWriter().write(JsonTools.resultSetToJson(rs));
}
@RequestMapping(value = "/GetMap", method = RequestMethod.GET)
public void GetMap(HttpServletRequest req, HttpServletResponse resp) throws Exception {
resp.setContentType("text/hmtl;charset=utf-8");
resp.getWriter().write("OK");
}
}
|
[
"ztar@163.com"
] |
ztar@163.com
|
c376b2b8e130f25205d0d9496a2a354350db5d5e
|
47fb2e1360578975ab585537ddd1cbc0386b63c1
|
/src/trab/SalvarXML.java
|
25f7ce479ab71083e2821d6e7a6e8f0a479a5e3c
|
[] |
no_license
|
Kiykoiam/projeto1
|
aa35c517170cc338817ff479422b4b9496c253e7
|
676bb60aa01073d370837a6d32f93f30b8a93b63
|
refs/heads/master
| 2021-01-18T16:04:20.937221
| 2015-12-02T12:52:31
| 2015-12-02T12:52:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 52
|
java
|
package trab;
public class SalvarXML {
}
|
[
"Aluno@10.2.3.167"
] |
Aluno@10.2.3.167
|
ec53a1dccd08ae6647ea8ba1dcbac6664c0a4e92
|
bc08cd6a4518f6b8424e04eafb5e6b055ee5c075
|
/src/test/java/com/org/CIBC/TableHTML.java
|
8bdedc824179e87fb8c7a18108ef7565ef20b796
|
[] |
no_license
|
dksarvan/RollerBird
|
747c0e0339eb3fa58131ef83ef980d443b60374a
|
c017e8ad55d8b4d3c87814a763e2db0c6db8769b
|
refs/heads/master
| 2021-07-24T14:44:04.649772
| 2017-11-06T05:38:31
| 2017-11-06T05:38:31
| 109,568,739
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,101
|
java
|
package com.org.CIBC;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class TableHTML {
WebDriver driver;
@BeforeTest
public void setup() throws Exception {
driver = new HtmlUnitDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.get("http://only-testing-blog.blogspot.in/2014/05/form.html");
}
@AfterTest
public void tearDown() throws Exception {
driver.quit();
}
@Test
public void Handle_Dynamic_Webtable() {
//To locate table.
WebElement mytable = driver.findElement(By.xpath(".//*[@id='post-body-8228718889842861683']/div[1]/table/tbody"));
//To locate rows of table.
List<WebElement> rows_table = mytable.findElements(By.tagName("tr"));
//To calculate no of rows In table.
int rows_count = rows_table.size();
//Loop will execute till the last row of table.
for (int row=0; row<rows_count; row++){
//To locate columns(cells) of that specific row.
List<WebElement> Columns_row = rows_table.get(row).findElements(By.tagName("td"));
//To calculate no of columns(cells) In that specific row.
int columns_count = Columns_row.size();
System.out.println("Number of cells In Row "+row+" are "+columns_count);
//Loop will execute till the last cell of that specific row.
for (int column=0; column<columns_count; column++){
//To retrieve text from that specific cell.
String celtext = Columns_row.get(column).getText();
System.out.println("Cell Value Of row number "+row+" and column number "+column+" Is "+celtext);
}
System.out.println("--------------------------------------------------");
}
}
}
|
[
"Sarvan@DESKTOP-F48H72M"
] |
Sarvan@DESKTOP-F48H72M
|
6500585fd277a45476203aba113878ea31013f93
|
82c73b14ca77a4e36976aab39d3a406faad399d1
|
/app/src/main/java/com/merrichat/net/activity/groupmarket/VirtualAdressFragment.java
|
a74cf508da630fe8129f90c11e72602ba786fe64
|
[] |
no_license
|
AndroidDeveloperRaj/aaaaa
|
ab85835b3155ebe8701085560c550a676098736d
|
e6733ab804168065926f41b7e8723e0d92cd1682
|
refs/heads/master
| 2020-03-25T11:19:48.899989
| 2018-05-10T05:53:07
| 2018-05-10T05:53:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 11,487
|
java
|
package com.merrichat.net.activity.groupmarket;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.merrichat.net.R;
import com.merrichat.net.adapter.AddressAdapter;
import com.merrichat.net.app.MyEventBusModel;
import com.merrichat.net.callback.StringDialogCallback;
import com.merrichat.net.fragment.BaseFragment;
import com.merrichat.net.http.Urls;
import com.merrichat.net.model.AddressJsonModel;
import com.merrichat.net.model.AddressModel;
import com.merrichat.net.model.UserModel;
import com.merrichat.net.utils.JSONObjectEx;
import com.merrichat.net.utils.RxTools.RxDataTool;
import com.merrichat.net.utils.RxTools.RxToast;
import com.merrichat.net.view.CommomDialog;
import com.merrichat.net.view.DrawableCenterTextView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
/**
* Created by amssy on 18/1/23.
* 收货地址—虚拟地址
*/
public class VirtualAdressFragment extends BaseFragment implements BaseQuickAdapter.OnItemChildClickListener, BaseQuickAdapter.OnItemClickListener {
/**
* 点击回调
*/
public OnVirtualAddressOnClicklinster onVirtualAddressOnClicklinster;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
/**
* 空白页
*/
@BindView(R.id.tv_empty)
DrawableCenterTextView tvEmpty;
private View view;
private Unbinder unbinder;
private AddressAdapter adapter;
private ArrayList<AddressModel> addressList = new ArrayList<>();
private String key = "vir";//vir:表示的虚拟的收货地址, rec:表示的实物的收货地址
private String type = "";//0:表示删除, type:1:表示的是查询单个信息,查询时传空
private CommomDialog dialog;
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
EventBus.getDefault().unregister(this);
}
@Override
public View setContentViewResId(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_virtual_address, container, false);
unbinder = ButterKnife.bind(this, view);
EventBus.getDefault().register(this);
initView();
return view;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
if (addressList.size() > 0) {
tvEmpty.setVisibility(View.GONE);
} else {
//获取地址列表
quDelRecAddr("", 0);
}
}
}
/**
* 个人信息--查询收货地址列表/查询单个收货地址/删除收货地址
*
* @param type //0:表示删除, type:1:表示的是查询单个信息,查询时传空
* @param position 删除条目position
*/
private void quDelRecAddr(final String type, final int position) {
AddressJsonModel addressJsonModel = new AddressJsonModel();
String memberId = UserModel.getUserModel().getMemberId();
if (RxDataTool.isNullString(memberId)) {
RxToast.showToast("请登录后查看!");
return;
}
if (type.equals("0")) {
addressJsonModel.setId(addressList.get(position).getId());
addressJsonModel.setType(type);
}
addressJsonModel.setMemberId(memberId);
addressJsonModel.setKey(key);
String jsonStr = JSON.toJSONString(addressJsonModel);
OkGo.<String>post(Urls.quDelRecAddr)//
.tag(this)//
.params("jsonStr", jsonStr)
.execute(new StringDialogCallback() {
@Override
public void onSuccess(Response<String> response) {
if (response != null) {
try {
JSONObjectEx jsonObjectEx = new JSONObjectEx(response.body());
if (jsonObjectEx.optBoolean("success")) {
JSONObject data = jsonObjectEx.optJSONObject("data");
if (type.equals("0")) {//删除地址
if (data.optBoolean("success")) {
RxToast.showToast("已删除!");
addressList.remove(position);
adapter.notifyDataSetChanged();
}
} else {
if (data != null && data.optBoolean("success")) {
addressList.clear();
JSONArray dataBean = data.optJSONArray("data");
if (dataBean != null) {
List<AddressModel> addressModelList = JSON.parseArray(dataBean.toString(), AddressModel.class);
if (addressModelList != null && addressModelList.size() > 0) {
addressList.addAll(addressModelList);
}
}
} else {
RxToast.showToast(R.string.connect_to_server_fail);
}
}
if (addressList.size() > 0) {
tvEmpty.setVisibility(View.GONE);
} else {
tvEmpty.setVisibility(View.VISIBLE);
}
adapter.notifyDataSetChanged();
} else {
RxToast.showToast(R.string.connect_to_server_fail);
tvEmpty.setVisibility(View.VISIBLE);
}
} catch (JSONException e) {
e.printStackTrace();
tvEmpty.setVisibility(View.VISIBLE);
}
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
tvEmpty.setVisibility(View.VISIBLE);
RxToast.showToast(R.string.connect_to_server_fail);
}
});
}
private void initView() {
//设置布局管理器
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);
adapter = new AddressAdapter(key, R.layout.item_address, addressList);
recyclerView.setAdapter(adapter);
adapter.setOnItemChildClickListener(this);
adapter.setOnItemClickListener(this);
}
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, final int position) {
switch (view.getId()) {
case R.id.tv_editor://编辑按钮
Intent intent = new Intent(getActivity(), VirtualAddressActivity.class);
intent.putExtra("type", "editor");
intent.putExtra("addressModel", addressList.get(position));
startActivity(intent);
break;
case R.id.tv_delete://删除按钮
//弹出提示框
if (dialog != null) {
dialog.show();
} else {
dialog = new CommomDialog(cnt, R.style.dialog, "是否删除该地址吗?", new CommomDialog.OnCloseListener() {
@Override
public void onClick(Dialog dialog, boolean confirm) {
if (confirm) {
dialog.dismiss();
type = "0";
quDelRecAddr(type, position);
}
}
}).setTitle("确认删除");
dialog.show();
}
break;
}
}
@Subscribe
public void OnEvent(MyEventBusModel myEventBusModel) {
if (myEventBusModel.REFRESH_RECEIVING_ADDRESS_VIR) {
quDelRecAddr("", 0);
}
}
/**
* Item的点击事件
*
* @param adapter
* @param view
* @param position
*/
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//账户名
String addresseeName = addressList.get(position).getName();
//账户类型
String addresseePhone = addressList.get(position).getType();
//地址ID
String addresseeTownId = addressList.get(position).getId();
//省市区
String addresseeTownName = addressList.get(position).getRecAddress();
//账户地址
String addresseeAddress = addressList.get(position).getAccountAddr();
JSONObject jsonObject = new JSONObject();
int addressType;//地址类型 0虚拟 1实际
if (key.equals("rec")) {//vir:表示的虚拟的收货地址, rec:表示的实物的收货地址
addressType = 1;
} else {
addressType = 0;
}
try {
jsonObject.put("addresseeName", addresseeName);
jsonObject.put("addresseePhone", addresseePhone);
jsonObject.put("addresseeTownId", addresseeTownId);
jsonObject.put("addressType", addressType);
jsonObject.put("addresseeTownName", addresseeTownName);
jsonObject.put("addresseeAddress", addresseeAddress);
} catch (JSONException e) {
e.printStackTrace();
}
if (onVirtualAddressOnClicklinster != null) {
onVirtualAddressOnClicklinster.onAddress(jsonObject.toString());
}
}
public void setVirtualAddressOnClicklinster(OnVirtualAddressOnClicklinster onVirtualAddressOnClicklinster) {
this.onVirtualAddressOnClicklinster = onVirtualAddressOnClicklinster;
}
@OnClick(R.id.tv_empty)
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_empty:
quDelRecAddr("", 0);
break;
}
}
public interface OnVirtualAddressOnClicklinster {
void onAddress(String addresseeJson);
}
}
|
[
"309672235@qq.com"
] |
309672235@qq.com
|
a187f9715c94d143e4125f615770d1fa78767e4d
|
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
|
/aws-java-sdk-lightsail/src/main/java/com/amazonaws/services/lightsail/model/transform/GetInstanceSnapshotsRequestMarshaller.java
|
78c47cde6156ebafa869ee4f13e3ac12dda7399a
|
[
"Apache-2.0"
] |
permissive
|
aws/aws-sdk-java
|
2c6199b12b47345b5d3c50e425dabba56e279190
|
bab987ab604575f41a76864f755f49386e3264b4
|
refs/heads/master
| 2023-08-29T10:49:07.379135
| 2023-08-28T21:05:55
| 2023-08-28T21:05:55
| 574,877
| 3,695
| 3,092
|
Apache-2.0
| 2023-09-13T23:35:28
| 2010-03-22T23:34:58
| null |
UTF-8
|
Java
| false
| false
| 2,068
|
java
|
/*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.lightsail.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.lightsail.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* GetInstanceSnapshotsRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class GetInstanceSnapshotsRequestMarshaller {
private static final MarshallingInfo<String> PAGETOKEN_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("pageToken").build();
private static final GetInstanceSnapshotsRequestMarshaller instance = new GetInstanceSnapshotsRequestMarshaller();
public static GetInstanceSnapshotsRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(GetInstanceSnapshotsRequest getInstanceSnapshotsRequest, ProtocolMarshaller protocolMarshaller) {
if (getInstanceSnapshotsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getInstanceSnapshotsRequest.getPageToken(), PAGETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
|
[
""
] | |
ef4517a604af48e6fe7ce709bb77b1164cf82d28
|
8e60ba13602952efa24a6ef78bd30310f28166e8
|
/src/com/homecompany/chapter9/exercise8/Bicycle.java
|
f808fe89e6afd68163907c37caabe70acd6431ce
|
[] |
no_license
|
Serginiho/myproject-solutions
|
77e22b403d197d8f58a006206f9a1e145f372efc
|
b25c09b926f2b9c8f150f2b7232399f7591b0eaa
|
refs/heads/master
| 2023-07-13T07:28:12.028304
| 2021-08-26T12:30:14
| 2021-08-26T12:30:14
| 394,315,916
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 292
|
java
|
package com.homecompany.chapter9.exercise8;
class Bicycle implements Cycle{
private int wh2 = 2;
@Override
public void ride() {
System.out.println("Bicycle.ride()"+ ", Wheels: " + wheels());
}
@Override
public int wheels() {
return this.wh2;
}
}
|
[
"serginiho2985@gmail.com"
] |
serginiho2985@gmail.com
|
ce736f48ed7bbabcead922cf02ef48e5b05c24af
|
219747a22422fdc0631f6ecd3443e9026819aeb7
|
/test/FSM_V2/DSLTest.java
|
de04f4b4f5484828a09ee61074e36c13ee074e01
|
[] |
no_license
|
Johanvandeglind/FSM
|
3d97bd0ff880a2ae0fb98c80fc3a3f3e155d4292
|
83605587c4758b8fe052fe1e585e8f0b39112d17
|
refs/heads/master
| 2023-04-27T22:33:57.048227
| 2021-05-17T18:41:03
| 2021-05-17T18:41:03
| 365,995,555
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 910
|
java
|
package FSM_V2;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
import static org.junit.Assert.*;
public class DSLTest {
/**
* dit script test het lezen en inmplementeren van de DSL code
*/
@Test
public void implement_DSL_Script_Equals() throws IOException {
Node s0 = new Node("s0");
Node s1 = new Node("s1");
DSL.implement_DSL_Script("test/FSM_V2/test_DSL.txt",new Node[]{s0,s1});
assertEquals(new HashMap<String, Node>(){{put("A", s0);put("B", s1);}},s0.getDirections());
}
@Test
public void implement_DSL_Script_NotEquals() throws IOException {
Node s0 = new Node("s0");
Node s1 = new Node("s1");
DSL.implement_DSL_Script("test/FSM_V2/test_DSL.txt",new Node[]{s0,s1});
assertNotEquals(new HashMap<String, Node>(){{put("A", s1);put("B", s1);}},s0.getDirections());
}
}
|
[
"31281194+Johanvandeglind@users.noreply.github.com"
] |
31281194+Johanvandeglind@users.noreply.github.com
|
3537665a8fc2c8eedc4eedb2afa7754ca3cdecad
|
6baf1fe00541560788e78de5244ae17a7a2b375a
|
/hollywood/com.oculus.horizon-Horizon/sources/com/google/common/base/Throwables.java
|
8a04c596b5e74a010cd0eba351530ae14251964c
|
[] |
no_license
|
phwd/quest-tracker
|
286e605644fc05f00f4904e51f73d77444a78003
|
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
|
refs/heads/main
| 2023-03-29T20:33:10.959529
| 2021-04-10T22:14:11
| 2021-04-10T22:14:11
| 357,185,040
| 4
| 2
| null | 2021-04-12T12:28:09
| 2021-04-12T12:28:08
| null |
UTF-8
|
Java
| false
| false
| 5,709
|
java
|
package com.google.common.base;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.reflect.Method;
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
@GwtCompatible(emulated = true)
public final class Throwables {
@NullableDecl
@GwtIncompatible
public static final Method getStackTraceDepthMethod;
@NullableDecl
@GwtIncompatible
public static final Method getStackTraceElementMethod;
@NullableDecl
@GwtIncompatible
public static final Object jla;
@NullableDecl
@GwtIncompatible
public static Object getJLA() {
try {
return Class.forName("sun.misc.SharedSecrets", false, null).getMethod("getJavaLangAccess", new Class[0]).invoke(null, new Object[0]);
} catch (ThreadDeath e) {
throw e;
} catch (Throwable unused) {
return null;
}
}
@CanIgnoreReturnValue
@GwtIncompatible
@Deprecated
public static RuntimeException propagate(Throwable th) {
if ((th instanceof RuntimeException) || (th instanceof Error)) {
throw th;
}
throw new RuntimeException(th);
}
@GwtIncompatible
@Deprecated
public static <X extends Throwable> void propagateIfInstanceOf(@NullableDecl Throwable th, Class<X> cls) throws Throwable {
if (th != null && cls.isInstance(th)) {
throw cls.cast(th);
}
}
/* JADX WARNING: Removed duplicated region for block: B:20:? A[ExcHandler: IllegalAccessException | UnsupportedOperationException | InvocationTargetException (unused java.lang.Throwable), SYNTHETIC, Splitter:B:14:0x0044] */
static {
/*
java.lang.Object r0 = getJLA()
com.google.common.base.Throwables.jla = r0
r4 = 0
if (r0 != 0) goto L_0x0011
r0 = r4
L_0x000a:
com.google.common.base.Throwables.getStackTraceElementMethod = r0
java.lang.Object r0 = com.google.common.base.Throwables.jla
if (r0 == 0) goto L_0x0058
goto L_0x002e
L_0x0011:
r0 = 2
java.lang.Class[] r3 = new java.lang.Class[r0]
java.lang.Class<java.lang.Throwable> r1 = java.lang.Throwable.class
r0 = 0
r3[r0] = r1
java.lang.Class r1 = java.lang.Integer.TYPE
r0 = 1
r3[r0] = r1
java.lang.String r2 = "getStackTraceElement"
java.lang.String r1 = "sun.misc.JavaLangAccess"
r0 = 0
java.lang.Class r0 = java.lang.Class.forName(r1, r0, r4) // Catch:{ ThreadDeath -> 0x005b, all -> 0x002c }
java.lang.reflect.Method r0 = r0.getMethod(r2, r3) // Catch:{ ThreadDeath -> 0x005b, all -> 0x002c }
goto L_0x000a
L_0x002c:
r0 = r4
goto L_0x000a
L_0x002e:
java.lang.String r2 = "getStackTraceDepth"
r6 = 1
java.lang.Class[] r1 = new java.lang.Class[r6]
java.lang.Class<java.lang.Throwable> r0 = java.lang.Throwable.class
r5 = 0
r1[r5] = r0
java.lang.String r0 = "sun.misc.JavaLangAccess"
java.lang.Class r0 = java.lang.Class.forName(r0, r5, r4) // Catch:{ ThreadDeath -> 0x0055 }
java.lang.reflect.Method r3 = r0.getMethod(r2, r1) // Catch:{ ThreadDeath -> 0x0055 }
if (r3 == 0) goto L_0x0058
java.lang.Object r2 = getJLA() // Catch:{ IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058, IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058 }
java.lang.Object[] r1 = new java.lang.Object[r6] // Catch:{ IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058, IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058 }
java.lang.Throwable r0 = new java.lang.Throwable // Catch:{ IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058, IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058 }
r0.<init>() // Catch:{ IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058, IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058 }
r1[r5] = r0 // Catch:{ IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058, IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058 }
r3.invoke(r2, r1) // Catch:{ IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058, IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058 }
goto L_0x0057
L_0x0055:
r0 = move-exception
throw r0 // Catch:{ IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058, IllegalAccessException | UnsupportedOperationException | InvocationTargetException -> 0x0058 }
L_0x0057:
r4 = r3
L_0x0058:
com.google.common.base.Throwables.getStackTraceDepthMethod = r4
return
L_0x005b:
r0 = move-exception
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.common.base.Throwables.<clinit>():void");
}
}
|
[
"cyuubiapps@gmail.com"
] |
cyuubiapps@gmail.com
|
8746945becda58da473423cf91015c70f6ec7395
|
71faa46bcfc717ee3e50cc7462331f4918415bd0
|
/src/main/java/com/sawdks/json/stockfinancials/dto/Root.java
|
ce946c02642ccc70bb6ab9e960b078bb5132f5a8
|
[] |
no_license
|
syedaliwasifdaryakazmi/json
|
436d2cdb173794b54e2d65fe8fe953bb4b1534a9
|
efc3c2ccac6b33dd57fd74586a2021110a271659
|
refs/heads/main
| 2023-07-03T05:41:02.861934
| 2021-08-07T09:59:13
| 2021-08-07T09:59:13
| 393,542,256
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 303
|
java
|
package com.sawdks.json.stockfinancials.dto;
import lombok.*;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Root{
private List<Result> results;
private String status;
private String request_id;
private int count;
private String next_url;
}
|
[
"sawdks@gmail.com"
] |
sawdks@gmail.com
|
d4910f47f13578a2cd62d45509e7cc40e70dbdd7
|
78940fe9e955fa5083503120758ec5cb2fbb0f6d
|
/src/main/java/com/mujiang/slack/webcollector/plugin/ram/RamDB.java
|
32c044cb065fa85e2c27269bb96ba8f9da44364a
|
[] |
no_license
|
damujiang/slack
|
1baf8093d64a830318d2a03e68b0ef9d06eb95a4
|
88f7721983fabdc37fb5d42f311de45580dbbf98
|
refs/heads/master
| 2016-08-11T13:51:55.714165
| 2016-03-06T05:29:29
| 2016-03-06T05:29:29
| 52,654,466
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,276
|
java
|
/*
* Copyright (C) 2015 hu
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.mujiang.slack.webcollector.plugin.ram;
import com.mujiang.slack.webcollector.model.CrawlDatum;
import java.util.HashMap;
/**
*
* @author hu
*/
public class RamDB {
protected HashMap<String, CrawlDatum> crawlDB = new HashMap<String, CrawlDatum>();
protected HashMap<String, CrawlDatum> fetchDB = new HashMap<String, CrawlDatum>();
protected HashMap<String, CrawlDatum> linkDB = new HashMap<String, CrawlDatum>();
protected HashMap<String, String> redirectDB = new HashMap<String, String>();
}
|
[
"1819021@qq.com"
] |
1819021@qq.com
|
d763b7c691c6dd444864ccd64e90238f5f209806
|
aa49f99307b9c0c70bf3e831b100680ce7d14228
|
/src/introduction/StringDemo.java
|
e5c2cc93ed655327350a125eac6486643ea4c24a
|
[] |
no_license
|
okletsov/java_udemy_2
|
a933da947b94cd89368455cbc4d87d72231ad42e
|
dacd69d2fe0d235fc63ff68eace3658d71200519
|
refs/heads/master
| 2020-03-18T00:23:43.624647
| 2018-05-20T02:53:13
| 2018-05-20T02:53:13
| 134,090,274
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 293
|
java
|
package introduction;
public class StringDemo {
public static void main(String[] args){
// String constant pool (one object with multiple references)
String str1 = "Hello";
// Heep storage (multiple objects)
String str2 = new String("Welcome");
}
}
|
[
"akletsov88@gmail.com"
] |
akletsov88@gmail.com
|
00be2842c69bfc75f6f807004ab0cb919fcb87eb
|
ddfb3a710952bf5260dfecaaea7d515526f92ebb
|
/build/tmp/expandedArchives/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-sources.jar_c582e790131b6dd3325b282fce9d2d3d/net/minecraft/potion/EffectUtils.java
|
01df00238e5f1d7ae91a5acb361ace38cbb60995
|
[
"Apache-2.0"
] |
permissive
|
TheDarkRob/Sgeorsge
|
88e7e39571127ff3b14125620a6594beba509bd9
|
307a675cd3af5905504e34717e4f853b2943ba7b
|
refs/heads/master
| 2022-11-25T06:26:50.730098
| 2020-08-03T15:42:23
| 2020-08-03T15:42:23
| 284,748,579
| 0
| 0
|
Apache-2.0
| 2020-08-03T16:19:36
| 2020-08-03T16:19:35
| null |
UTF-8
|
Java
| false
| false
| 1,454
|
java
|
package net.minecraft.potion;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.StringUtils;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public final class EffectUtils {
@OnlyIn(Dist.CLIENT)
public static String getPotionDurationString(EffectInstance effect, float durationFactor) {
if (effect.getIsPotionDurationMax()) {
return "**:**";
} else {
int i = MathHelper.floor((float)effect.getDuration() * durationFactor);
return StringUtils.ticksToElapsedTime(i);
}
}
public static boolean hasMiningSpeedup(LivingEntity p_205135_0_) {
return p_205135_0_.isPotionActive(Effects.HASTE) || p_205135_0_.isPotionActive(Effects.CONDUIT_POWER);
}
public static int getMiningSpeedup(LivingEntity p_205134_0_) {
int i = 0;
int j = 0;
if (p_205134_0_.isPotionActive(Effects.HASTE)) {
i = p_205134_0_.getActivePotionEffect(Effects.HASTE).getAmplifier();
}
if (p_205134_0_.isPotionActive(Effects.CONDUIT_POWER)) {
j = p_205134_0_.getActivePotionEffect(Effects.CONDUIT_POWER).getAmplifier();
}
return Math.max(i, j);
}
public static boolean canBreatheUnderwater(LivingEntity p_205133_0_) {
return p_205133_0_.isPotionActive(Effects.WATER_BREATHING) || p_205133_0_.isPotionActive(Effects.CONDUIT_POWER);
}
}
|
[
"iodiceandrea251@gmail.com"
] |
iodiceandrea251@gmail.com
|
43fcee6047793217a9b0115a0925e3a70bef4326
|
5d9e2fe0714b74dd48f7293bddf4711647a89fe5
|
/src/main/java/com/lemon/mapper/ProjectMapper.java
|
9c88bf0e67774b27dfbc471c53927a9abcc17013
|
[] |
no_license
|
maidou1152/my
|
79880964ed7190d629c84d835cd9cd659a72c25b
|
3940ddaa5058e7d70f50cab85d3e6c5480bdddf9
|
refs/heads/master
| 2022-06-27T02:50:43.428012
| 2020-04-30T06:52:52
| 2020-04-30T06:52:52
| 250,946,100
| 0
| 0
| null | 2022-06-21T03:05:10
| 2020-03-29T03:32:23
|
Java
|
UTF-8
|
Java
| false
| false
| 274
|
java
|
package com.lemon.mapper;
import com.lemon.pojo.Project;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author kk
* @since 2020-02-15
*/
public interface ProjectMapper extends BaseMapper<Project> {
}
|
[
"810178563@qq.com"
] |
810178563@qq.com
|
bdbf4597745816ba848826d4c0d7dfd86a9ded99
|
c94f888541c0c430331110818ed7f3d6b27b788a
|
/bbp/java/src/main/java/com/antgroup/antchain/openapi/bbp/models/UploadStaffAttendanceRequest.java
|
331821e21273d7b8a8c973dd191e67f19b6ba419
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
alipay/antchain-openapi-prod-sdk
|
48534eb78878bd708a0c05f2fe280ba9c41d09ad
|
5269b1f55f1fc19cf0584dc3ceea821d3f8f8632
|
refs/heads/master
| 2023-09-03T07:12:04.166131
| 2023-09-01T08:56:15
| 2023-09-01T08:56:15
| 275,521,177
| 9
| 10
|
MIT
| 2021-03-25T02:35:20
| 2020-06-28T06:22:14
|
PHP
|
UTF-8
|
Java
| false
| false
| 1,690
|
java
|
// This file is auto-generated, don't edit it. Thanks.
package com.antgroup.antchain.openapi.bbp.models;
import com.aliyun.tea.*;
public class UploadStaffAttendanceRequest extends TeaModel {
// OAuth模式下的授权token
@NameInMap("auth_token")
public String authToken;
@NameInMap("product_instance_id")
public String productInstanceId;
// 考勤信息
@NameInMap("attendance")
@Validation(required = true)
public Attendance attendance;
// uuid就行
@NameInMap("biz_id")
@Validation(required = true)
public String bizId;
public static UploadStaffAttendanceRequest build(java.util.Map<String, ?> map) throws Exception {
UploadStaffAttendanceRequest self = new UploadStaffAttendanceRequest();
return TeaModel.build(map, self);
}
public UploadStaffAttendanceRequest setAuthToken(String authToken) {
this.authToken = authToken;
return this;
}
public String getAuthToken() {
return this.authToken;
}
public UploadStaffAttendanceRequest setProductInstanceId(String productInstanceId) {
this.productInstanceId = productInstanceId;
return this;
}
public String getProductInstanceId() {
return this.productInstanceId;
}
public UploadStaffAttendanceRequest setAttendance(Attendance attendance) {
this.attendance = attendance;
return this;
}
public Attendance getAttendance() {
return this.attendance;
}
public UploadStaffAttendanceRequest setBizId(String bizId) {
this.bizId = bizId;
return this;
}
public String getBizId() {
return this.bizId;
}
}
|
[
"sdk-team@alibabacloud.com"
] |
sdk-team@alibabacloud.com
|
515c9859556267b360923190122ba469e5ab2cf7
|
f9cb9948122dfa5b50e260ab5557a95127433e26
|
/src/main/java/ua/kruart/jms/basics/fundamentals/JMS2Receiver.java
|
6b550cb5f6afdded16220f935b38b924323db112
|
[] |
no_license
|
kruart/jms4fun
|
78e03ff1baa840e324fd50a7a921e83617eb3519
|
1a6b060be148837e77720c19a0b2fa944b9faba8
|
refs/heads/master
| 2020-12-30T17:10:54.164689
| 2017-05-09T18:17:28
| 2017-05-09T18:17:28
| 91,061,757
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 879
|
java
|
package ua.kruart.jms.basics.fundamentals;
import com.sun.messaging.ConnectionFactory;
import javax.jms.JMSContext;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
/**
* Created by kruart on 29.04.2017.
*/
public class JMS2Receiver {
public static void main(String[] args) throws JMSException {
ConnectionFactory cf = new ConnectionFactory();
// cf.setProperty(ConnectionConfiguration.imqAddressList, "t://localhost:7676");
try(JMSContext jmsContext = cf.createContext()) {
Queue queue = jmsContext.createQueue("EM_JMS2_TRADE.Q");
Message receive = jmsContext
.createConsumer(queue)
.receive();
System.out.println(receive.getBody(String.class));
System.out.println(receive.getStringProperty("TraderName"));
}
}
}
|
[
"weoz@ukr.net"
] |
weoz@ukr.net
|
bd406ce50d857ed02c6b0844d7034fb7930e57cd
|
5ac926a3b889f2d1a212a5b72829aa8ba6dd50d4
|
/src/main/java/com/app1/dell/socialsites/MainActivity.java
|
1f3be2fef7ba10b36f75796c16b91c2ff5b09f3c
|
[] |
no_license
|
prakashtiwaari/SocialSites-Application
|
ada64599522a266d15f79992856703a636429ece
|
46eba6b52cdbf0e7fb0d2aed1475218ba5323902
|
refs/heads/master
| 2021-05-14T00:58:11.264508
| 2018-01-15T13:47:46
| 2018-01-15T13:47:46
| 116,554,068
| 0
| 0
| null | 2018-01-07T09:54:30
| 2018-01-07T09:45:10
| null |
UTF-8
|
Java
| false
| false
| 884
|
java
|
package com.app1.dell.socialsites;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
Button yes;
TextView welcome;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
yes=(Button)findViewById(R.id.wlcmbtn);
welcome=(TextView)findViewById(R.id.welcm);
yes.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v==yes){
Intent i =new Intent(MainActivity.this,SecondActivity.class);
startActivity(i);
}
}
}
|
[
"noreply@github.com"
] |
prakashtiwaari.noreply@github.com
|
f90ffdaa1547bb3c9bf835af9d545c3ca1399719
|
be38fd20a8f6b95506e614a40389c8c4add07c28
|
/PracticedJavaPrograms/interview/questions/fresher/KthHighestElementInMatrix.java
|
3b219108567706ab85ce3a398b2e9bacbc9bdae4
|
[] |
no_license
|
sriramsrikanth1985/LearningsByPractice
|
951f9c9464482583e3ac13a522daa2b65604166f
|
de34d6cf9c6011bece92b9e46dac852456322b59
|
refs/heads/master
| 2021-01-10T03:27:04.984386
| 2019-10-03T10:03:56
| 2019-10-03T10:03:56
| 50,078,102
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 970
|
java
|
package interview.questions.fresher;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Scanner;
public class KthHighestElementInMatrix {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Enter the size of the matrix");
Scanner in = new Scanner(System.in);
int m = in.nextInt();
int n = in.nextInt();
int a=0,b=0;
LinkedHashSet hs = new LinkedHashSet<Integer>();
int[][] mat = new int[m][n];
System.out.println("please enter the elements of matrix "+m+"X"+n);
for(a=0;a<m;a++){
for(b=0;b<n;b++) {
mat[a][b]=in.nextInt();
hs.add(mat[a][b]);
}
}
System.out.println("matrix"+mat);
System.out.println("HashSet:"+hs);
ArrayList<Integer> arr = new ArrayList<Integer>(hs);
Collections.sort(arr);
System.out.println("Array:"+arr);
}
}
|
[
"sriramsrikanth1985@gmail.com"
] |
sriramsrikanth1985@gmail.com
|
cb91c15a44c7bc3ea9709ea90c3d10f7ec35a772
|
c6005eb6e298d8a7c0613cf43f2287ae66996e09
|
/mpomng/src/main/java/com/tangdi/production/mpomng/service/impl/CustBankServiceImpl.java
|
09dd1e807199633acd445ec2e5bb4a163061a472
|
[] |
no_license
|
taotao365s/mbpay
|
5c235a1969074893f991073472fadea6645fe246
|
95fff2efd817e9b37d6aa847498c15a9a5fc8c9e
|
refs/heads/master
| 2022-02-17T06:30:37.919937
| 2019-08-28T07:49:51
| 2019-08-28T07:49:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,744
|
java
|
package com.tangdi.production.mpomng.service.impl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.tangdi.production.mpbase.constants.MsgCT;
import com.tangdi.production.mpomng.bean.CustBankInf;
import com.tangdi.production.mpomng.bean.MeridentifyInf;
import com.tangdi.production.mpomng.bean.MobileMerInf;
import com.tangdi.production.mpomng.constants.CT;
import com.tangdi.production.mpomng.dao.CustBankInfDao;
import com.tangdi.production.mpomng.dao.CustBankInfTempDao;
import com.tangdi.production.mpomng.service.CustBankInfService;
import com.tangdi.production.mpomng.service.CustBankInfTempService;
import com.tangdi.production.mpomng.service.MeridentifyService;
import com.tangdi.production.mpomng.service.MobileMerService;
import com.tangdi.production.tdbase.util.TdExpBasicFunctions;
/**
*
* @author zhuji
* @version 1.0
*
*/
@Service
public class CustBankServiceImpl implements CustBankInfService{
private static final Logger log = LoggerFactory
.getLogger(CustBankServiceImpl.class);
@Autowired
private CustBankInfDao dao;
@Autowired
private CustBankInfTempDao tempDao;
@Autowired
private CustBankInfTempService custBankInfTempService;
@Autowired
private MeridentifyService meridentifyService;
@Autowired
private MobileMerService mobileMerService;
@Override
public List<CustBankInf> getListPage(CustBankInf entity) throws Exception {
return dao.selectList(entity);
}
@Override
public Integer getCount(CustBankInf entity) throws Exception {
return dao.countEntity(entity);
}
@Override
public CustBankInf getEntity(CustBankInf entity) throws Exception {
log.debug("方法参数:"+entity.debug());
CustBankInf custBankInf = null;
try{
custBankInf = dao.selectEntity(entity);
}catch(Exception e){
throw new Exception("查询信息异常!"+e.getMessage(),e);
}
log.debug("处理结果:",custBankInf.debug());
return custBankInf;
}
@Override @Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
public int addEntity(CustBankInf entity) throws Exception {
int rt = 0;
log.debug("方法参数:{}",entity.debug());
try{
rt = dao.insertEntity(entity);
log.debug("处理结果:[{}]",rt);
}catch(Exception e){
log.error(e.getMessage(),e);
throw new Exception("插入数据异常!"+e.getMessage(),e);
}
return rt;
}
@Override @Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
public int modifyEntity(CustBankInf entity) throws Exception {
int rt = 0;
log.debug("方法参数:{}",entity.debug());
try{
rt = dao.updateEntity(entity);
/*
log.debug("处理结果:[{}]",rt);
if(rt>0){
removeEntity(entity);
}
*/
}catch(Exception e){
log.error(e.getMessage(),e);
throw new Exception("更新数据异常!"+e.getMessage(),e);
}
return rt;
}
@Override @Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
public int removeEntity(CustBankInf entity) throws Exception {
int rt = 0;
log.debug("方法参数:{}",entity.debug());
try{
rt = dao.deleteEntity(entity);
log.debug("处理结果:[{}]",rt);
if(rt>0){
tempDao.insertEntity(entity);
}
}catch(Exception e){
log.error(e.getMessage(),e);
throw new Exception("删除数据异常!"+e.getMessage(),e);
}
return rt;
}
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public int audit(CustBankInf custBankInf, String status, String updateDesc)
throws Exception {
try {
CustBankInf entity = custBankInfTempService.getEntityById(custBankInf);
MeridentifyInf meridentifyInf = new MeridentifyInf();
meridentifyInf.setCustId(custBankInf.getCustId());
MeridentifyInf inf = meridentifyService.getEntity(meridentifyInf);
log.info("查询结果:custbankInf={},meridentifyInf={}", entity.debug(),inf.debug());
if ("1".equals(inf.getCustStatus())) {
int rt = 0;
if (status.equals(MsgCT.BANK_CARD_AUDIT_SUCCESS)) {
log.info("修改银行卡状态....");
custBankInf.setUpdateDesc(updateDesc);
custBankInf.setCardState(status);
custBankInfTempService.modifyEntity(custBankInf);
rt = modifyEntity(entity);
if (rt == 0) {
rt = addEntity(entity);
}
log.info("修改商户状态...");
//商户实名认证
meridentifyInf.setCustStatus("2");
meridentifyInf.setAuditIdea(updateDesc);
meridentifyInf.setIdentifyTime(TdExpBasicFunctions.GETDATETIME());
meridentifyService.modifyEntity(meridentifyInf);
//商户登录信息
MobileMerInf mobileMerInf=new MobileMerInf();
mobileMerInf.setAuthStatus("2");
mobileMerInf.setCustId(custBankInf.getCustId());
mobileMerService.modifyEntity(mobileMerInf);
} else if (status.equals(MsgCT.BANK_CARD_AUDIT_FAIL)) {
custBankInf.setUpdateDesc(updateDesc);
custBankInf.setCardState(CT.CUSTBANK_STATUS_4);
custBankInfTempService.modifyEntity(custBankInf);
log.info("修改商户状态...");
//商户实名认证
meridentifyInf.setCustStatus("3");
meridentifyInf.setAuditIdea(updateDesc);
meridentifyInf.setIdentifyTime(TdExpBasicFunctions.GETDATETIME());
meridentifyService.modifyEntity(meridentifyInf);
//商户登录信息
MobileMerInf mobileMerInf=new MobileMerInf();
mobileMerInf.setAuthStatus("3");
mobileMerInf.setCustId(custBankInf.getCustId());
mobileMerService.modifyEntity(mobileMerInf);
}
} else {
int rt = 0;
if (status.equals(MsgCT.BANK_CARD_AUDIT_SUCCESS)) {
custBankInf.setUpdateDesc(updateDesc);
custBankInf.setCardState(status);
custBankInfTempService.modifyEntity(custBankInf);
rt = modifyEntity(entity);
if (rt == 0) {
rt = addEntity(entity);
}
} else if (status.equals(MsgCT.BANK_CARD_AUDIT_FAIL)) {
custBankInf.setUpdateDesc(updateDesc);
custBankInf.setCardState(CT.CUSTBANK_STATUS_4);
custBankInfTempService.modifyEntity(custBankInf);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new Exception("审核失败失败", e);
}
return 0;
}
@Override
public int bankNum(String custId) throws Exception {
return dao.selectBankNum(custId);
}
}
|
[
"w1037704496@163.com"
] |
w1037704496@163.com
|
eb2d25f85f12a2f31a563c44da77ace209357cab
|
83c496f413475dd2d7f09c8437299c887379201d
|
/Encrypt using Armstrong number/Main.java
|
448ab509d9b5ca11ba8ac704ce4b055cdf24db0c
|
[] |
no_license
|
Shivambhat1999/Playground
|
4e83cb8ed47a1b20a0896964c183a2da3ad6075a
|
1216af2d763506a34e92014da5d8e19fbdde3589
|
refs/heads/master
| 2021-05-17T16:26:07.954963
| 2020-05-12T19:06:05
| 2020-05-12T19:06:05
| 250,870,544
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 440
|
java
|
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n,r,s,m,sum=0,temp;
cin>>n;
temp=n;
s=r;
m=n;
int count=0;
while(m>0)
{
count++;
s=m%10;
m=m/10;
}
while(n>0)
{
r=n%10;
sum=sum+(pow(r,count));
n=n/10;
}
if(temp==sum)
cout<<"Kindly proceed with encrypting"<<endl;
else
cout<<"It is not an Armstrong number"<<endl;
return 0;
}
|
[
"62749735+Shivambhat1999@users.noreply.github.com"
] |
62749735+Shivambhat1999@users.noreply.github.com
|
b5bf545a0c6d9e78caf88af66fe2eaa6da97b643
|
7e5c0b31d77d405403cded81f7e47f51bcd81515
|
/ResearcherManagement/src/main/java/model/Researcher.java
|
1e3d26f2ed96177522c0995355438a9df950deff
|
[] |
no_license
|
MaheshaKasthuriarachchi/ResearcherManagement
|
7201e98c25ad103e4b87537a79f46895220a147c
|
61c28fd8fdd3392902438e344f9266f2566886e2
|
refs/heads/master
| 2023-05-05T12:11:52.762668
| 2021-05-22T08:04:00
| 2021-05-22T08:04:00
| 361,690,629
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,756
|
java
|
package model;
import java.sql.*;
public class Researcher {
private Connection connect() {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver");
// Provide the correct details: DBServer/DBName, username, password
con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/researcher_management", "root", "");
} catch (Exception e) {
e.printStackTrace();
}
return con;
}
public String insertReseacher(String reseacherFname, String researcherLname,
String researcherEmail, String researcherPhoneNo, String researcherSpecialization, String researchTitle) {
String output = "";
try {
Connection con = connect();
if (con == null) {
return "Error while connecting to the database for inserting.";
}
// create a prepared statement
String query = " insert into researchers (`researcherID`, `researcherFname`, `researcherLname`, `researcherEmail`, `researcherPhoneNo`, `researcherSpecialization`, `researchTitle`)"
+ " values (?, ?, ?, ?, ?,?,?)";
PreparedStatement preparedStmt = con.prepareStatement(query);
// binding values
preparedStmt.setInt(1, 0);
preparedStmt.setString(2, reseacherFname);
preparedStmt.setString(3, researcherLname);
preparedStmt.setString(4, researcherEmail);
preparedStmt.setInt(5, Integer.parseInt(researcherPhoneNo));
preparedStmt.setString(6, researcherSpecialization);
preparedStmt.setString(7, researchTitle);
// execute the statement
preparedStmt.execute();
con.close();
output = "Inserted successfully";
} catch (Exception e) {
output = "Error while inserting the reseacher.";
System.err.println(e.getMessage());
}
return output;
}
public String readReseachers() {
String output = "";
try {
Connection con = connect();
if (con == null) {
return "Error while connecting to the database for reading.";
}
// Prepare the html table to be displayed
output = "<table border='1'><tr><th>Researcher ID</th><th>First Name</th>"
+ "<th>Last Name</th><th>Email</th>" + "<th>Phone Number</th>"
+ "<th>Specialization</th><th>Research Title</th>" + "<th>Update</th><th>Remove</th></tr>";
String query = "select * from researchers";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
// iterate through the rows in the result set
while (rs.next()) {
String reseacherID = Integer.toString(rs.getInt("reseacherID"));
String researcherFname = rs.getString("researcherFname");
String reseacherLName = rs.getString("reseacherLName");
String researcherEmail = rs.getString("researcherEmail");
String researcherPhoneNo = Integer.toString(rs.getInt("researcherPhoneNo"));
String researcherSpecialization = rs.getString("researcherSpecialization");
String researchTitle = rs.getString("researchTitle");
// Add into the html table
output += "<tr><td>" + researcherFname + "</td>";
output += "<td>" + reseacherLName + "</td>";
output += "<td>" + researcherEmail + "</td>";
output += "<td>" + researcherPhoneNo + "</td>";
output += "<td>" + researcherSpecialization + "</td>";
output += "<td>" + researchTitle + "</td>";
// buttons
output += "<td><input name='btnUpdate' type='button' value='Update'class='btn btn-secondary'></td>"
+ "<td><form method='post' action='reseachers.jsp'>"
+ "<input name='btnRemove' type='submit' value='Remove'class='btn btn-danger'>"
+ "<input name='reseacherID' type='hidden' value='" + reseacherID + "'>" + "</form></td></tr>";
}
con.close();
// Complete the html table
output += "</table>";
} catch (Exception e) {
output = "Error while reading the reseachers.";
System.err.println(e.getMessage());
}
return output;
}
public String updateReseacher(String researcherID, String researcherFname, String researcherLname,
String researcherEmail, String researcherPhoneNo, String researcherSpecialization, String researchTitle) {
String output = "";
try {
Connection con = connect();
if (con == null) {
return "Error while connecting to the database for updating.";
}
// create a prepared statement
String query = "UPDATE researchers SET researcherFname=?,researcherLname=?,researcherEmail=?,researcherPhoneNo=?,researcherSpecialization=?,researchTitle=?WHERE reseacherID=?";
PreparedStatement preparedStmt = con.prepareStatement(query);
// binding values
preparedStmt.setString(1, researcherFname);
preparedStmt.setString(2, researcherLname);
preparedStmt.setString(3, researcherEmail);
preparedStmt.setInt(4, Integer.parseInt(researcherPhoneNo));
preparedStmt.setString(5, researcherSpecialization);
preparedStmt.setString(6, researchTitle);
preparedStmt.setInt(7, Integer.parseInt(researcherID));
// execute the statement
preparedStmt.execute();
con.close();
output = "Updated successfully";
} catch (Exception e) {
output = "Error while updating the reseacher.";
System.err.println(e.getMessage());
}
return output;
}
public String deleteReseacher(String reseacherID) {
String output = "";
try {
Connection con = connect();
if (con == null) {
return "Error while connecting to the database for deleting.";
}
// create a prepared statement
String query = "delete from researchers where reseacherID=?";
PreparedStatement preparedStmt = con.prepareStatement(query);
// binding values
preparedStmt.setInt(1, Integer.parseInt(reseacherID));
// execute the statement
preparedStmt.execute();
con.close();
output = "Deleted successfully";
} catch (Exception e) {
output = "Error while deleting the reseacher.";
System.err.println(e.getMessage());
}
return output;
}
}
|
[
"kmwishmini@gmail.com"
] |
kmwishmini@gmail.com
|
8d8cf31b2509830941df49bdfa27f97e9417b38c
|
2607f1550c672da4d4d2c04a4fc0c2dacc59ae2b
|
/src/com/example/black/lib/model/VersionCode.java
|
68e611002e47066cc216abd31770662762a76fd0
|
[] |
no_license
|
jinjiacun123/black
|
2f38d17adb7a500b201bf6c06d3669544d58db18
|
478047dc2f623b134f466f03a2b7a61b5a48b91e
|
refs/heads/master
| 2016-08-10T17:28:37.639543
| 2016-01-26T08:25:18
| 2016-01-26T08:25:18
| 49,935,411
| 0
| 0
| null | null | null | null |
WINDOWS-1252
|
Java
| false
| false
| 1,194
|
java
|
package com.example.black.lib.model;
/**
* ·þÎñÆ÷°æ±¾
*
* @author Admin
*
*/
public class VersionCode {
private int versionCode;
private String versionName;
private String label;
private String path;
public VersionCode() {
// TODO Auto-generated constructor stub
}
public VersionCode(int versionCode, String versionName, String label,
String path) {
super();
this.versionCode = versionCode;
this.versionName = versionName;
this.label = label;
this.path = path;
}
@Override
public String toString() {
return "VersionCode [versionCode=" + versionCode + ", versionName="
+ versionName + ", label=" + label + ", path=" + path + "]";
}
public int getVersionCode() {
return versionCode;
}
public void setVersionCode(int versionCode) {
this.versionCode = versionCode;
}
public String getVersionName() {
return versionName;
}
public void setVersionName(String versionName) {
this.versionName = versionName;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
|
[
"jinjiacuncucu@sina.com"
] |
jinjiacuncucu@sina.com
|
50b7e2921cc7756447339e5577f67062ad0b42aa
|
314ec3dc7733139dbec6c68856cc9e121ce5feb0
|
/6March/ServletContextApplication/src/com/cognizant/work/ValidateServlet.java
|
53f91226f208741ce9cf8dd63a74458a0ff6cab4
|
[] |
no_license
|
maheshwaripulkit/Daily_work
|
8c036cde257f26e91c547f138a5b9f7f07c56d62
|
74c939883f7db886508ae8fec18c284ac470087a
|
refs/heads/master
| 2021-01-05T13:16:06.930968
| 2020-03-12T12:27:35
| 2020-03-12T12:27:35
| 241,032,696
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,054
|
java
|
package com.cognizant.work;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/ValidateServlet")
public class ValidateServlet extends HttpServlet {
@Override
public void init() throws ServletException {
System.out.println("from init");
}
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println(" from service method");
if(req.getMethod().equals("GET"))
doGet(req, resp);
else
doPost(req, resp);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("from doGet method");
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("from do post method");
}
}
|
[
"pulkitmaheshwari01@gmail.com"
] |
pulkitmaheshwari01@gmail.com
|
d1a90c146284d1db2c5e6ba9fd6b124088f5a742
|
87514d13de195adc59a5fc22cde31a741a23f3d8
|
/plugin/src/main/java/com/stratio/cassandra/lucene/Index.java
|
cfd96c34c8e7173112471bb49794ae2de3d7ceb4
|
[
"Apache-2.0"
] |
permissive
|
denniskline/cassandra-lucene-index
|
eb6cfb3dadbd13cd1d2220713bb4f86f880063f5
|
e6f36a89879a6f99aac587156923e29e06a34acb
|
refs/heads/master
| 2021-12-03T09:20:32.717996
| 2017-04-10T08:05:20
| 2017-04-10T08:05:20
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 19,092
|
java
|
/*
* Licensed to STRATIO (C) under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. The STRATIO (C) licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.stratio.cassandra.lucene;
import com.stratio.cassandra.lucene.search.Search;
import com.stratio.cassandra.lucene.search.SearchBuilder;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.ColumnDefinition;
import org.apache.cassandra.cql3.Operator;
import org.apache.cassandra.db.*;
import org.apache.cassandra.db.filter.RowFilter;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.cassandra.db.partitions.PartitionIterator;
import org.apache.cassandra.db.partitions.PartitionUpdate;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.exceptions.InvalidRequestException;
import org.apache.cassandra.index.IndexRegistry;
import org.apache.cassandra.index.transactions.IndexTransaction;
import org.apache.cassandra.schema.IndexMetadata;
import org.apache.cassandra.service.ClientState;
import org.apache.cassandra.utils.concurrent.OpOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.Callable;
import java.util.function.BiFunction;
/**
* {@link org.apache.cassandra.index.Index} that uses Apache Lucene as backend. It allows, among others, multi-column
* and full-text search.
*
* @author Andres de la Pena {@literal <adelapena@stratio.com>}
*/
public class Index implements org.apache.cassandra.index.Index {
private static final Logger logger = LoggerFactory.getLogger(Index.class);
private final ColumnFamilyStore table;
private final IndexMetadata indexMetadata;
private IndexService service;
private String name;
// Setup CQL query handler
static {
try {
Field field = ClientState.class.getDeclaredField("cqlQueryHandler");
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(null, new IndexQueryHandler());
} catch (Exception e) {
logger.error("Unable to set Lucene CQL query handler", e);
}
}
/**
* Builds a new Lucene index for the specified {@link ColumnFamilyStore} using the specified {@link IndexMetadata}.
*
* @param table the indexed {@link ColumnFamilyStore}
* @param indexMetadata the index's metadata
*/
public Index(ColumnFamilyStore table, IndexMetadata indexMetadata) {
logger.debug("Building Lucene index {} {}", table.metadata, indexMetadata);
this.table = table;
this.indexMetadata = indexMetadata;
try {
service = IndexService.build(table, indexMetadata);
} catch (Exception e) {
throw new IndexException(e);
}
name = service.qualifiedName;
}
/**
* Validates the specified index options.
*
* @param options the options to be validated
* @param metadata the metadata of the table to be indexed
* @return the validated options
* @throws ConfigurationException if the options are not valid
*/
public static Map<String, String> validateOptions(Map<String, String> options, CFMetaData metadata) {
logger.debug("Validating Lucene index options");
try {
IndexOptions.validateOptions(options, metadata);
} catch (IndexException e) {
logger.error("Lucene index options are invalid", e);
throw new ConfigurationException(e.getMessage());
}
logger.debug("Lucene index options are valid");
return Collections.emptyMap();
}
/*
* Management functions
*/
/**
* Return a task to perform any initialization work when a new index instance is created. This may involve costly
* operations such as (re)building the index, and is performed asynchronously by SecondaryIndexManager
*
* @return a task to perform any necessary initialization work
*/
@Override
public Callable<?> getInitializationTask() {
logger.info("Getting initialization task of {}", name);
if (table.isEmpty() || SystemKeyspace.isIndexBuilt(table.keyspace.getName(), indexMetadata.name)) {
logger.info("Index {} doesn't need (re)building", name);
return null;
} else {
logger.info("Index {} needs (re)building", name);
return () -> {
table.forceBlockingFlush();
service.truncate();
table.indexManager.buildIndexBlocking(this);
return null;
};
}
}
/**
* Returns the IndexMetadata which configures and defines the index instance. This should be the same object passed
* as the argument to setIndexMetadata.
*
* @return the index's metadata
*/
@Override
public IndexMetadata getIndexMetadata() {
return indexMetadata;
}
/**
* Return a task to reload the internal metadata of an index. Called when the base table metadata is modified or
* when the configuration of the Index is updated Implementations should return a task which performs any necessary
* work to be done due to updating the configuration(s) such as (re)building etc. This task is performed
* asynchronously by SecondaryIndexManager
*
* @return task to be executed by the index manager during a reload
*/
@Override
public Callable<?> getMetadataReloadTask(IndexMetadata indexMetadata) { // TODO: Check rebuild
return () -> {
logger.debug("Reloading Lucene index {} metadata: {}", name, indexMetadata);
return null;
};
}
/**
* An index must be registered in order to be able to either subscribe to update events on the base table and/or to
* provide IndexSearcher functionality for reads. The double dispatch involved here, where the Index actually
* performs its own registration by calling back to the supplied IndexRegistry's own registerIndex method, is to
* make the decision as to whether or not to register an index belong to the implementation, not the manager.
*
* @param registry the index registry to register the instance with
*/
@Override
public void register(IndexRegistry registry) {
registry.registerIndex(this);
}
/**
* If the index implementation uses a local table to store its index data this method should return a handle to it.
* If not, an empty Optional should be returned. Typically, this is useful for the built-in Index implementations.
*
* @return an Optional referencing the Index's backing storage table if it has one, or Optional.empty() if not
*/
public Optional<ColumnFamilyStore> getBackingTable() {
return Optional.empty();
}
/**
* Return a task which performs a blocking flush of the index's data to persistent storage.
*
* @return task to be executed by the index manager to perform the flush
*/
@Override
public Callable<?> getBlockingFlushTask() {
return () -> {
logger.info("Flushing Lucene index {}", name);
service.commit();
return null;
};
}
/**
* Return a task which invalidates the index, indicating it should no longer be considered usable. This should
* include an clean up and releasing of resources required when dropping an index.
*
* @return task to be executed by the index manager to invalidate the index
*/
@Override
public Callable<?> getInvalidateTask() {
return () -> {
service.delete();
return null;
};
}
/**
* Return a task to truncate the index with the specified truncation timestamp. Called when the base table is
* truncated.
*
* @param truncatedAt timestamp of the truncation operation. This will be the same timestamp used in the truncation
* of the base table.
* @return task to be executed by the index manager when the base table is truncated.
*/
@Override
public Callable<?> getTruncateTask(long truncatedAt) {
logger.trace("Getting truncate task");
return () -> {
logger.info("Truncating Lucene index {}", name);
service.truncate();
logger.info("Truncated Lucene index {}", name);
return null;
};
}
/**
* Return true if this index can be built or rebuilt when the index manager determines it is necessary. Returning
* false enables the index implementation (or some other component) to control if and when SSTable data is
* incorporated into the index.
*
* This is called by SecondaryIndexManager in buildIndexBlocking, buildAllIndexesBlocking and rebuildIndexesBlocking
* where a return value of false causes the index to be excluded from the set of those which will process the
* SSTable data.
*
* @return if the index should be included in the set which processes SSTable data, false otherwise.
*/
@Override
public boolean shouldBuildBlocking() {
logger.trace("Asking if it should build blocking");
return true;
}
/*
* Index selection
*/
/**
* Called to determine whether this index targets a specific column. Used during schema operations such as when
* dropping or renaming a column, to check if the index will be affected by the change. Typically, if an index
* answers that it does depend upon a column, then schema operations on that column are not permitted until the
* index is dropped or altered.
*
* @param column the column definition to check
* @return true if the index depends on the supplied column being present; false if the column may be safely dropped
* or modified without adversely affecting the index
*/
@Override
public boolean dependsOn(ColumnDefinition column) { // TODO: Could return true only for key and/or mapped columns
logger.trace("Asking if it depends on column {}", column);
return service.schema.maps(column);
}
/**
* Called to determine whether this index can provide a searcher to execute a query on the supplied column using the
* specified operator. This forms part of the query validation done before a CQL select statement is executed.
*
* @param column the target column of a search query predicate
* @param operator the operator of a search query predicate
* @return true if this index is capable of supporting such expressions, false otherwise
*/
@Override
public boolean supportsExpression(ColumnDefinition column, Operator operator) {
logger.trace("Asking if it supports the expression {} {}", column, operator);
return false;
}
/**
* If the index supports custom search expressions using the {@code}SELECT * FROM table WHERE expr(index_name,
* expression){@code} syntax, this method should return the expected type of the expression argument. For example,
* if the index supports custom expressions as Strings, calls to this method should return
* {@code}UTF8Type.instance{@code}. If the index implementation does not support custom expressions, then it should
* return null.
*
* @return an the type of custom index expressions supported by this index, or an null if custom expressions are not
* supported.
*/
@Override
public AbstractType<?> customExpressionValueType() {
logger.trace("Requesting the custom expressions value type");
return UTF8Type.instance;
}
/**
* Transform an initial RowFilter into the filter that will still need to applied to a set of Rows after the index
* has performed it's initial scan. Used in ReadCommand#executeLocal to reduce the amount of filtering performed on
* the results of the index query.
*
* @param filter the initial filter belonging to a ReadCommand
* @return the (hopefully) reduced filter that would still need to be applied after the index was used to narrow the
* initial result set
*/
@Override
public RowFilter getPostIndexQueryFilter(RowFilter filter) {
logger.trace("Getting the post index query filter for {}", filter);
return filter;
}
/**
* Return an estimate of the number of results this index is expected to return for any given query that it can be
* used to answer. Used in conjunction with indexes() and supportsExpression() to determine the most selective index
* for a given ReadCommand. Additionally, this is also used by StorageProxy.estimateResultsPerRange to calculate the
* initial concurrency factor for range requests
*
* @return the estimated average number of results aIndexSearcher may return for any given query
*/
@Override
public long getEstimatedResultRows() {
logger.trace("Getting the estimated result rows");
return 1;
}
/*
* Input validation
*/
/**
* Called at write time to ensure that values present in the update are valid according to the rules of all
* registered indexes which will process it. The partition key as well as the clustering and cell values for each
* row in the update may be checked by index implementations
*
* @param update PartitionUpdate containing the values to be validated by registered Index implementations.
* @throws InvalidRequestException If the update doesn't pass through the validation.
*/
@Override
public void validate(PartitionUpdate update) {
logger.trace("Validating {}", update);
try {
service.validate(update);
} catch (Exception e) {
throw new InvalidRequestException(e.getMessage());
}
}
/*
* Update processing
*/
/**
* Creates an new {@code IndexWriter} object for updates to a given partition.
*
* @param key key of the partition being modified
* @param columns the regular and static columns the created indexer will have to deal with. This can be empty as an
* update might only contain partition, range and row deletions, but the indexer is guaranteed to not get any cells
* for a column that is not part of {@code columns}.
* @param nowInSec current time of the update operation
* @param opGroup operation group spanning the update operation
* @param transactionType indicates what kind of update is being performed on the base data i.e. a write time
* insert/update/delete or the result of compaction
* @return the newly created indexer or {@code null} if the index is not interested by the update (this could be
* because the index doesn't care about that particular partition, doesn't care about that type of transaction,
* ...).
*/
@Override
public Indexer indexerFor(DecoratedKey key,
PartitionColumns columns,
int nowInSec,
OpOrder.Group opGroup,
IndexTransaction.Type transactionType) {
return service.indexWriter(key, nowInSec, opGroup, transactionType);
}
/*
* Querying
*/
/**
* Return a function which performs post processing on the results of a partition range read command. In future,
* this may be used as a generalized mechanism for transforming results on the coordinator prior to returning them
* to the caller.
*
* This is used on the coordinator during execution of a range command to perform post processing of merged results
* obtained from the necessary replicas. This is the only way in which results are transformed in this way but this
* may change over time as usage is generalized. See CASSANDRA-8717 for further discussion.
*
* The function takes a PartitionIterator of the results from the replicas which has already been collated and
* reconciled, along with the command being executed. It returns another PartitionIterator containing the results of
* the transformation (which may be the same as the input if the transformation is a no-op).
*/
@Override
public BiFunction<PartitionIterator, ReadCommand, PartitionIterator> postProcessorFor(ReadCommand command) {
return (partitions, readCommand) -> service.postProcess(partitions, readCommand);
}
/**
* Factory method for query time search helper. Custom index implementations should perform any validation of query
* expressions here and throw a meaningful InvalidRequestException when any expression is invalid.
*
* @param command the read command being executed
* @return an IndexSearcher with which to perform the supplied command
* @throws InvalidRequestException if the command's expressions are invalid according to the specific syntax
* supported by the index implementation.
*/
@Override
public Searcher searcherFor(ReadCommand command) {
logger.trace("Getting searcher for {}", command);
try {
return service.searcher(command);
} catch (Exception e) {
logger.error("Error while searching", e);
throw new InvalidRequestException(e.getMessage());
}
}
/**
* Validates the specified {@link RowFilter.CustomExpression}.
*
* @param expression the expression to be validated
* @return the valid search represented by {@code expression}
* @throws InvalidRequestException if the expression is not valid
*/
public Search validate(RowFilter.CustomExpression expression) {
try {
String json = UTF8Type.instance.compose(expression.getValue());
Search search = SearchBuilder.fromJson(json).build();
search.query(service.schema);
return search;
} catch (Exception e) {
throw new InvalidRequestException(e.getMessage());
}
}
}
|
[
"a.penya.garcia@gmail.com"
] |
a.penya.garcia@gmail.com
|
6a43d70207004e5f58b540f32f4fbcbf72a4d061
|
6109e94b1f3d7fdd1aace9982fe0ac70f8e41975
|
/src/main/java/com/devnexus/ting/model/SponsorLevel.java
|
ea7430bac5b33820a87b72bbf2e57b2d78e243d4
|
[] |
no_license
|
padmanabann/devnexus-site
|
78ab7e728deb5987a16738d7347c91f4c8dd1d88
|
04cea85cb7627c610ecf19d1e16903eb316acd9b
|
refs/heads/master
| 2020-11-30T14:39:15.215120
| 2016-02-02T16:50:32
| 2016-02-02T16:50:32
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,882
|
java
|
/*
* Copyright 2014-2016 the original author or authors.
*
* 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.devnexus.ting.model;
import org.springframework.util.Assert;
/**
*
* @author Gunnar Hillert
*
*/
public enum SponsorLevel {
PLATINUM(100L, "Platinum Sponsor", "sponsorsPlatium"),
GOLD( 200L, "Gold Sponsor", "sponsorsGold"),
SILVER( 300L, "Silver Sponsor", "sponsorsSilver"),
MEDIA_PARTNER(350L, "Media Partner", "sponsorsMediaPartner"),
COCKTAIL_HOUR( 400L, "Cocktail Hour Sponsor", "sponsorsCocktail"),
BADGE( 370L, "Badge Sponsor", "sponsorsBadge"),
DEV_LOUNGE( 380L, "Dev Lounge Sponsor", "sponsorsDevLounge");
private Long id;
private String name;
private String cssStyleClass;
/**
* Constructor.
*
*/
SponsorLevel(final Long id, final String name, final String cssStyleClass) {
this.id = id;
this.name = name;
this.cssStyleClass = cssStyleClass;
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public String getCssStyleClass() {
return cssStyleClass;
}
public static SponsorLevel fromId(Long sponsorLevelId) {
Assert.notNull(sponsorLevelId, "Parameter sponsorLevelId, must not be null.");
for (SponsorLevel sponsorLevel : SponsorLevel.values()) {
if (sponsorLevel.getId().equals(sponsorLevelId)) {
return sponsorLevel;
}
}
return null;
}
}
|
[
"gunnar@hillert.com"
] |
gunnar@hillert.com
|
6dc256c5d5112a86f9209b14e2167ae6167c9d8a
|
30e969dbd45ae5c341c0f0192a05b529ef80c98e
|
/src/main/java/com/shanika/uomrmsdesktop/Logic/User.java
|
7c36cd9f1c13728fbbd73dba24f07ced925b9ef4
|
[] |
no_license
|
ShanikaEdiriweera/UoMRMS_DesktopApp
|
fc0ecb470af519ab20106f8c28bc41c7df91932c
|
db72abebe5f9528d2011ee02dcd6062633810e0f
|
refs/heads/master
| 2021-01-09T20:51:57.696548
| 2016-06-15T21:11:23
| 2016-06-15T21:11:23
| 57,172,652
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,053
|
java
|
package com.shanika.uomrmsdesktop.Logic;
/**
*
* @author Shanika Ediriweera
*/
public class User {
private String ID;
private String username;
private String password;
private String name;
private Gender gender;
private UserType userType;
private Department department;
private String state=State.ACTIVE.getState();
public User(){
}
public User(String ID, String username, String password, String name, Gender gender, UserType userType, Department department, String state){
this.ID = ID;
this.username = username;
this.password = password;
this.name = name;
this.gender = gender;
this.userType = userType;
this.department = department;
this.state = state;
}
public String getID() {
return ID;
}
public String getName() {
return name;
}
public Gender getGender() {
return gender;
}
public UserType getUserType() {
return userType;
}
public Department getDepartment() {
return department;
}
public void setName(String name) {
this.name = name;
}
public void setDepartment(Department department) {
this.department = department;
}
public void setUserType(UserType userType) {
this.userType = userType;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public void setID(String ID) {
this.ID = ID;
}
public void setGender(Gender gender) {
this.gender = gender;
}
}
|
[
"shanika.13@cse.mrt.ac.lk"
] |
shanika.13@cse.mrt.ac.lk
|
6207e4c825d042dbd9bf88b2bf54ca32c7ce6598
|
1ef84ea4cd42a655fba83f6617927ac30335d3a7
|
/JaeYeong Han/src/Multiplebelow.java
|
f1068951f412b475677b6f9e5b60e36a2e2d70b4
|
[] |
no_license
|
hanhjy111/Java-project-start
|
803dbb67de24df1284bc5f9fe52e267f7ac39c75
|
327e64e7aa74c4b93dee3902e4b30f689044c66e
|
refs/heads/master
| 2021-05-12T00:41:58.121893
| 2018-02-08T14:37:59
| 2018-02-08T14:37:59
| 117,541,093
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 309
|
java
|
public class Multiplebelow
{
public static void main(String[] args) throws java.io.IOException
{
// TODO Auto-generated method stub
for(int i=0; i<5; i++);
{
for(int j=0; j<=5; j++);
{
System.out.print("*");
}
System.out.println();
}
}
}
|
[
"한Jaeyeong@192.168.0.6"
] |
한Jaeyeong@192.168.0.6
|
46a8d03f8b2e689debbba2b9771896d98e4a9707
|
9ddab3e06f3aed61ac1cb4eb1c5e54858ccaad18
|
/pluginapk/src/main/java/com/anonyper/pluginapk/OrderActivity.java
|
125865f5dc8fff4ec9c0835f9418b5e73957925f
|
[] |
no_license
|
anonygod/PluginApplication
|
ac3005ba2a3cd6b49e9889f882732da64c22cf98
|
b9bc1887aba96103ca8bdd3cacef4e9b4b66b106
|
refs/heads/master
| 2020-06-24T13:42:23.458629
| 2019-07-26T09:41:43
| 2019-07-26T09:41:43
| 198,977,667
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 590
|
java
|
package com.anonyper.pluginapk;
import android.content.Intent;
import android.os.Bundle;
import com.anonyper.pluginlibrary.PluginActivity;
public class OrderActivity extends PluginActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_order);
findViewById(R.id.order_view).setOnClickListener(v -> {
Intent intent = new Intent();
intent.setClass(OrderActivity.this, PluginApkActivity.class);
startActivity(intent);
});
}
}
|
[
"anonyper365@gmail.com"
] |
anonyper365@gmail.com
|
6edfb791940b8ea1a66555aacc09ca8d994eb18d
|
c80a0665f5e2b51a0c3cf0dda3acca7b6af29146
|
/project1/src/com/company/Player.java
|
4dea6a0e1271d1476a5892be01d0485d24f42dc3
|
[] |
no_license
|
melikaabdi96/project1.commit2
|
473a381ba056ae7bcc885d1391f09c67b895a227
|
bafd97e870c97ad75361e3dcdf18c9775d10a057
|
refs/heads/master
| 2023-01-12T16:08:17.156142
| 2020-11-19T11:52:49
| 2020-11-19T11:52:49
| 314,231,866
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,749
|
java
|
package com.company;
import java.util.ArrayList;
import java.util.Collections;
public class Player extends Memoir{
//A group of soldiers
private Soldier[] soldierGroup;
//A group of tanks
private Tank[] tankGroup;
//A group of artilleries
private Artillery[] ArtilleryGroup;
//Board rows
private int boardRow = 9;
//Board columns
private int boardColumn = 13;
private ArrayList<Card.CardType> playerCards;
private ArrayList<String> usedCarts = new ArrayList<>();
public Player(){
this.playerCards = new ArrayList<Card.CardType>();
addCards();
}
private ArrayList<ArrayList> armiesGroups = new ArrayList<>();
public void addCards(){
for(int i =0; i <6; i++){
playerCards.add(Card.CardType.OneGroup);
}
for(int i =0; i <13; i++){
playerCards.add(Card.CardType.TwoGroups);
}
for(int i =0; i <10; i++){
playerCards.add(Card.CardType.ThreeGroups);
}
for(int i =0; i <6; i++){
playerCards.add(Card.CardType.FourGroups);
}
for(int i =0; i <5; i++){
playerCards.add(Card.CardType.ThreeUnits);
}
Collections.shuffle(playerCards);
}
public ArrayList<Card.CardType> getCards() {return playerCards;}
public Card.CardType getCard(int index){
return playerCards.get(index);
}
public void giveCards(){}
public void reuseCards(){
if(playerCards.size() == 0){
addCards();
giveCards();
}
}
public void ChooseCard(Card card){
if (getCards().contains(card)){
playerCards.remove(card);
}
}
}
|
[
"melikaabdi_pc@yahoo.com"
] |
melikaabdi_pc@yahoo.com
|
0c8c1286693e3a19acf875e11a7c05838aacdeec
|
b9410860a1d6590ee322f2bf60c87ae9a2228162
|
/src/test/java/seedu/address/model/statistics/MonthlyRevenueTest.java
|
5875266f72fc120b493c2d02f29c9082892fe53d
|
[
"MIT"
] |
permissive
|
beesaycheese/main
|
2a9d32ea637e6fa529c5c05579b3a8d8fa743779
|
ea4bc2186d21329a9029eb590760d845c6172a0d
|
refs/heads/master
| 2020-04-22T02:40:11.495371
| 2019-04-15T15:32:58
| 2019-04-15T15:32:58
| 170,058,927
| 0
| 0
|
NOASSERTION
| 2019-02-11T03:00:04
| 2019-02-11T03:00:03
| null |
UTF-8
|
Java
| false
| false
| 2,750
|
java
|
package seedu.address.model.statistics;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static seedu.address.testutil.TypicalRestOrRant.MONTHLY_REVENUE1;
import static seedu.address.testutil.TypicalRestOrRant.MONTHLY_REVENUE2;
import org.junit.Test;
import seedu.address.testutil.MonthlyRevenueBuilder;
public class MonthlyRevenueTest {
@Test
public void isSameMonthlyRevenue() {
// same object -> returns true
assertTrue(MONTHLY_REVENUE1.isSameMonthlyRevenue(MONTHLY_REVENUE1));
// null -> returns false
assertFalse(MONTHLY_REVENUE1.isSameMonthlyRevenue(null));
// different month -> returns false
MonthlyRevenue editedMonthlyRevenue = new MonthlyRevenueBuilder(MONTHLY_REVENUE1).withMonth("04").build();
assertFalse(MONTHLY_REVENUE1.isSameMonthlyRevenue(editedMonthlyRevenue));
// different year -> returns false
editedMonthlyRevenue = new MonthlyRevenueBuilder(MONTHLY_REVENUE1).withYear("2010").build();
assertFalse(MONTHLY_REVENUE1.isSameMonthlyRevenue(editedMonthlyRevenue));
// same month, year, different totalMonthlyRevenue -> returns true
editedMonthlyRevenue = new MonthlyRevenueBuilder(MONTHLY_REVENUE1).withTotalMonthlyRevenue("300").build();
assertTrue(MONTHLY_REVENUE1.isSameMonthlyRevenue(editedMonthlyRevenue));
}
@Test
public void equals() {
// same values -> returns true
MonthlyRevenue monthlyRevenueCopy = new MonthlyRevenueBuilder(MONTHLY_REVENUE1).build();
assertTrue(MONTHLY_REVENUE1.equals(monthlyRevenueCopy));
// same object -> returns true
assertTrue(MONTHLY_REVENUE1.equals(MONTHLY_REVENUE1));
// null -> returns false
assertFalse(MONTHLY_REVENUE1.equals(null));
// different type -> returns false
assertFalse(MONTHLY_REVENUE1.equals(5));
// different monthly revenue -> returns false
assertFalse(MONTHLY_REVENUE1.equals(MONTHLY_REVENUE2));
// different month -> returns false
MonthlyRevenue editedMonthlyRevenue = new MonthlyRevenueBuilder(MONTHLY_REVENUE1).withMonth("04").build();
assertFalse(MONTHLY_REVENUE1.equals(editedMonthlyRevenue));
// different year -> returns false
editedMonthlyRevenue = new MonthlyRevenueBuilder(MONTHLY_REVENUE1).withYear("2010").build();
assertFalse(MONTHLY_REVENUE1.equals(editedMonthlyRevenue));
// same month, year, different totalMonthlyRevenue -> returns false
editedMonthlyRevenue = new MonthlyRevenueBuilder(MONTHLY_REVENUE1).withTotalMonthlyRevenue("300").build();
assertFalse(MONTHLY_REVENUE1.equals(editedMonthlyRevenue));
}
}
|
[
"beesaycheese@users.noreply.github.com"
] |
beesaycheese@users.noreply.github.com
|
495af8ab8d6f260cbf2f67bcd46dca69be5a1764
|
25c9b3e528edfd0a4664336fde4d38697b6801d3
|
/Software Development/src/Homework5/Circle.java
|
8e268b184a3ecc165421362893f809645f1a7a0e
|
[] |
no_license
|
GrahamAtkinson035/SoftwareDevelopment
|
52cda464519d9558dae708645f4b745985c27bc2
|
3acda302f111688598d6a01146b9b9ae83993a2a
|
refs/heads/master
| 2021-01-20T11:09:44.881944
| 2016-04-02T23:44:03
| 2016-04-02T23:44:03
| 55,321,157
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 139
|
java
|
package Homework5;
public class Circle extends Shape{
double pi = 3.14;
public Circle(double r){
super();
setArea(pi*r*r);
}
}
|
[
"0.035ounces@gmail.com"
] |
0.035ounces@gmail.com
|
280dbc92111624c58a2d868ade77e9fdc0694129
|
9a0badac21a80f3ed048681535fc3fd2710a8737
|
/src/main/java/com/inflectra/spiratest/addons/testnglistener/soap/AssociationUpdateResponse.java
|
5086a26b9484b77cffb53b7eb1c7069a943e0044
|
[
"Apache-2.0"
] |
permissive
|
fkrivsky/spira-testng
|
90aebb390097b2ff30c7477d19f809f4db46e362
|
3c15be70d130cdb4d52cb86916d90d5dba5c0406
|
refs/heads/master
| 2022-12-21T04:09:24.994281
| 2020-09-21T11:55:26
| 2020-09-21T11:55:26
| 284,718,994
| 0
| 0
|
Apache-2.0
| 2020-08-03T14:15:54
| 2020-08-03T14:15:53
| null |
UTF-8
|
Java
| false
| false
| 830
|
java
|
package com.inflectra.spiratest.addons.testnglistener.soap;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "Association_UpdateResponse")
public class AssociationUpdateResponse {
}
|
[
"fkrivsky@CZPBCLPJVN3PQ2.eu.global.ad"
] |
fkrivsky@CZPBCLPJVN3PQ2.eu.global.ad
|
d7146ecfe2901a79e5b61fe906877800f1f90139
|
4e9c06ff59fe91f0f69cb3dd80a128f466885aea
|
/src/o/氵$ˊ$if.java
|
c3a707b8eefa6728618bf9869d362c2852f8a793
|
[] |
no_license
|
reverseengineeringer/com.eclipsim.gpsstatus2
|
5ab9959cc3280d2dc96f2247c1263d14c893fc93
|
800552a53c11742c6889836a25b688d43ae68c2e
|
refs/heads/master
| 2021-01-17T07:26:14.357187
| 2016-07-21T03:33:07
| 2016-07-21T03:33:07
| 63,834,134
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,745
|
java
|
package o;
import android.os.Build.VERSION;
import android.view.View;
class 氵$ˊ$if
implements ﺜ
{
氵 ﮐ;
boolean ﺙ;
氵$ˊ$if(氵 param氵)
{
ﮐ = param氵;
}
public void ʾ(View paramView)
{
ﺙ = false;
if (氵.ˎ(ﮐ) >= 0) {
ᓱ.ˊ(paramView, 2, null);
}
if (氵.ˊ(ﮐ) != null)
{
localObject1 = 氵.ˊ(ﮐ);
氵.ˋ(ﮐ, null);
((Runnable)localObject1).run();
}
Object localObject2 = paramView.getTag(2113929216);
Object localObject1 = null;
if ((localObject2 instanceof ﺜ)) {
localObject1 = (ﺜ)localObject2;
}
if (localObject1 != null) {
((ﺜ)localObject1).ʾ(paramView);
}
}
public void ʿ(View paramView)
{
if (氵.ˎ(ﮐ) >= 0)
{
ᓱ.ˊ(paramView, 氵.ˎ(ﮐ), null);
氵.ˊ(ﮐ, -1);
}
if ((Build.VERSION.SDK_INT >= 16) || (!ﺙ))
{
if (氵.ˋ(ﮐ) != null)
{
localObject1 = 氵.ˋ(ﮐ);
氵.ˊ(ﮐ, null);
((Runnable)localObject1).run();
}
Object localObject2 = paramView.getTag(2113929216);
Object localObject1 = null;
if ((localObject2 instanceof ﺜ)) {
localObject1 = (ﺜ)localObject2;
}
if (localObject1 != null) {
((ﺜ)localObject1).ʿ(paramView);
}
ﺙ = true;
}
}
public void ᵋ(View paramView)
{
Object localObject = paramView.getTag(2113929216);
ﺜ localﺜ = null;
if ((localObject instanceof ﺜ)) {
localﺜ = (ﺜ)localObject;
}
if (localﺜ != null) {
localﺜ.ᵋ(paramView);
}
}
}
/* Location:
* Qualified Name: o.氵.ˊ.if
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
[
"reverseengineeringer@hackeradmin.com"
] |
reverseengineeringer@hackeradmin.com
|
57638e50ee40479b0acfa0e9632958db8d2de1d2
|
97859807041b7ce06918eff80c6e56841867093c
|
/src/test/java/selenium_08_page_factory/tests/TestDynamicLoading.java
|
67619a4a315c33f7fb66447ed33ff4cdbdcb5e2c
|
[] |
no_license
|
lromanowicz/selenium-testng-workshop
|
f2a13d4771c4f77a16271eff1a9cf2485d64f947
|
f8c35a5f1613ace339e1f8176baac645740e2c33
|
refs/heads/master
| 2021-06-15T17:19:45.651209
| 2019-05-28T08:15:37
| 2019-05-28T08:15:37
| 185,332,475
| 0
| 0
| null | 2021-06-04T01:58:51
| 2019-05-07T06:12:16
|
Java
|
UTF-8
|
Java
| false
| false
| 813
|
java
|
package selenium_08_page_factory.tests;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import selenium_08_page_factory.pageobjects.DynamicLoading;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
public class TestDynamicLoading extends Base {
private DynamicLoading dynamicLoading;
@BeforeClass
public void setUp() {
dynamicLoading = new DynamicLoading(driver);
}
@Test
public void hiddenElementLoads() {
dynamicLoading.loadExample("1");
assertThat(dynamicLoading.finishTextPresent(), equalTo(true));
}
@Test
public void elementAppears() {
dynamicLoading.loadExample("2");
assertThat(dynamicLoading.finishTextPresent(), equalTo(true));
}
}
|
[
"lukasz.romanowicz@testarmy.com"
] |
lukasz.romanowicz@testarmy.com
|
7fef59d0189747cb96db7a42f4a37d490fda169f
|
2e891603272c7ca3d6759a04d84232e3710701c9
|
/src/main/java/Apec/Components/Gui/GuiIngame/GuiElements/GUIComponent.java
|
13e1481c4fb02f79cf8c9c5f2044f8dc811dd5e7
|
[
"MIT"
] |
permissive
|
ludazinovenkova/Apec
|
76fce0c1b2304785d2f46d58973dd07e7b6c76e1
|
3e3e623642772d0a1f663d3d046b7ec2b77e6a59
|
refs/heads/master
| 2023-03-31T22:12:59.700879
| 2021-03-28T12:43:42
| 2021-03-28T12:43:42
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,841
|
java
|
package Apec.Components.Gui.GuiIngame.GuiElements;
import Apec.ApecUtils;
import Apec.Components.Gui.GuiIngame.GUIComponentID;
import Apec.DataInterpretation.DataExtractor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.common.MinecraftForge;
import org.lwjgl.util.vector.Vector2f;
import java.util.ArrayList;
import java.util.List;
public class GUIComponent {
protected Minecraft mc = Minecraft.getMinecraft();
protected Vector2f delta_position = new Vector2f(0, 0);
protected List<Vector2f> subComponentDeltas = new ArrayList<Vector2f>();
protected List<Integer> DisabledSubComponents = new ArrayList<Integer>();
protected float scale = 1;
protected float oneOverScale = 1;
public GUIComponentID gUiComponentID;
protected ScaledResolution g_sr;
public boolean scalable = true;
public GUIComponent(GUIComponentID gUiComponentID) {
this.gUiComponentID = gUiComponentID;
MinecraftForge.EVENT_BUS.register(this);
g_sr = new ScaledResolution(mc);
}
public GUIComponent(GUIComponentID gUiComponentID, int SubElementCount) {
this(gUiComponentID);
for (int i = 0; i < SubElementCount; i++) {
this.subComponentDeltas.add(new Vector2f(0, 0));
}
}
protected void DisableSubComponent(int s) {
DisabledSubComponents.add(s);
}
protected void EnableSubComponent(int s) {
int DisabledCount = DisabledSubComponents.size();
for (int i = 0; i < DisabledCount; i++) {
if (DisabledSubComponents.get(i) == s) {
DisabledSubComponents.remove(i);
break;
}
}
}
public boolean IsSubcomponentDisabled(int s) {
return DisabledSubComponents.contains(s);
}
public GUIComponent(GUIComponentID gUiComponentID, boolean scalable) {
this(gUiComponentID);
this.scalable = scalable;
}
/**
* For texture drawing
*/
public void drawTex(DataExtractor.PlayerStats ps, DataExtractor.ScoreBoardData sd, DataExtractor.OtherData od, ScaledResolution sr, boolean editingMode) {
g_sr = sr;
}
/**
* For rendering text
*/
public void draw(DataExtractor.PlayerStats ps, DataExtractor.ScoreBoardData sd, DataExtractor.OtherData od, ScaledResolution sr, boolean editingMode) {
g_sr = sr;
}
/**
* Is called before the editing menu is opened
*/
public void editInit() {
}
/**
* Initialize function
*/
public void init() {
}
/**
* Sets the delta position vector
*/
public void setDelta_position(Vector2f dp) {
delta_position = dp;
}
/**
* The initial position point
*/
public Vector2f getAnchorPointPosition() {
return new Vector2f(0, 0);
}
/**
* The point at which the object is currently situated
*/
public Vector2f getRealAnchorPoint() {
return ApecUtils.addVec(getAnchorPointPosition(), getDelta_position());
}
/**
* Sets the scale of the element
*/
public void setScale(float s) {
this.scale = s;
this.oneOverScale = 1f/scale;
}
/**
* Gets the distance vector between the anchor position and the current position
*/
public Vector2f getDelta_position() {
return this.delta_position;
}
/**
* Gives the distance vector between the position of the element and the position of the point that describes the rectangle in which the element is confined
*/
public Vector2f getBoundingPoint() {
return new Vector2f(0, 0);
}
/**
* Gets the scale
*/
public float getScale() {
return this.scale;
}
public List<Vector2f> getSubElementsAnchorPoints() {
return new ArrayList<Vector2f>();
}
public List<Vector2f> getSubElementsRealAnchorPoints() {
return ApecUtils.AddVecListToList(getSubElementsAnchorPoints(), getSubElementsDelta_positions());
}
public List<Vector2f> getSubElementsBoundingPoints() {
return new ArrayList<Vector2f>();
}
public List<Vector2f> getSubElementsDelta_positions() {
return this.subComponentDeltas;
}
public void setSubElementDelta_position(Vector2f dp, int id) {
this.subComponentDeltas.set(id, dp);
}
public boolean hasSubComponents() {
return subComponentCount() != 0;
}
public int subComponentCount() {
return this.subComponentDeltas.size();
}
public void resetDeltaPositions() {
this.delta_position = new Vector2f(0, 0);
for (int i = 0; i < this.subComponentDeltas.size(); i++) {
this.subComponentDeltas.set(i, new Vector2f(0, 0));
}
}
}
|
[
"55049439+BananaFructa@users.noreply.github.com"
] |
55049439+BananaFructa@users.noreply.github.com
|
d8a4902be3cf01200925f6806c80b86f5975d2eb
|
5b752e2ef0b151a2e3d16b32a0479051cea068b4
|
/src/pe/edu/upn/main/Matricula.java
|
9ff2305c9d159617a2815c9af02ed532d850c618
|
[] |
no_license
|
ajaflorez-coder/matricula
|
9590c85c15cc43a5e62981685c92316395893c57
|
c4834006a1a77fbf5428d898cc46bd8b34aa9962
|
refs/heads/master
| 2020-06-01T03:56:55.566312
| 2019-06-06T23:49:11
| 2019-06-06T23:49:11
| 190,624,749
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 266
|
java
|
package pe.edu.upn.main;
import pe.edu.upn.view.EstudianteJFrame;
public class Matricula {
public static void main(String[] args) {
EstudianteJFrame ventana = new EstudianteJFrame();
ventana.setVisible(true);
}
}
|
[
"ajaflorez.upc@gmail.com"
] |
ajaflorez.upc@gmail.com
|
fe4d8a3655e8857b50c47a799c96208a4d142d06
|
e6f3ea4cd5b89d7ed1526e5b1c24a903097ed01b
|
/JDBCProj1/src/com/nt/jdbc/SelectTest4.java
|
50a3b35326df98a8d1001af8e32b4d831fa3f7c4
|
[] |
no_license
|
riturajnagar/NTAJ414
|
edab32d7fe122da49f47d9858fdc7b21162b7d7c
|
8ad898b66b08d862a841184cd601d1eef6763f29
|
refs/heads/master
| 2022-12-14T09:00:20.469986
| 2020-09-15T12:17:19
| 2020-09-15T12:17:19
| 295,799,580
| 1
| 0
| null | 2020-09-15T17:20:14
| 2020-09-15T17:20:13
| null |
UTF-8
|
Java
| false
| false
| 2,189
|
java
|
package com.nt.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/* App to get count of records in emp db table
* version: 1.0
* @author Admin
* */
public class SelectTest4 {
public static void main(String[] args) {
Connection con=null;
Statement st=null;
String query=null;
ResultSet rs=null;
try {
// register jdbc driver
//Class.forName("oracle.jdbc.driver.OracleDriver");
//establish the connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system", "manager");
//create JDBC Statement object
if(con!=null)
st=con.createStatement();
//prepare SQL query
//select count(*) from emp;
query="SELECT COUNT(*) FROM EMP";
//send and execute SQL query in DB s/w
if(st!=null)
rs=st.executeQuery(query);
//process the ResultSet object
if(rs!=null) {
rs.next();
//System.out.println("records count::"+rs.getInt(1));
System.out.println("records count::"+rs.getInt("count(*)"));
}//if
System.out.println("..............................");
int count=st.executeUpdate("delete from student where sno=102");
System.out.println("deleted count records::"+count);
System.out.println(" con object class name::"+con.getClass());
System.out.println(" st object class name::"+st.getClass());
System.out.println(" rs object class name::"+rs.getClass());
}//try
catch(SQLException se) {
System.out.println(se);
}
catch(Exception e) {
e.printStackTrace();
}
finally {
//close jdbc objs
try {
if(rs!=null)
rs.close();
}
catch(SQLException se) {
se.printStackTrace();
}
try {
if(st!=null)
st.close();
}
catch(SQLException se) {
se.printStackTrace();
}
try {
if(con!=null)
con.close();
}
catch(SQLException se) {
se.printStackTrace();
}
}//finally
}//main
}//class
|
[
"natarazworld@gmail.com"
] |
natarazworld@gmail.com
|
d1472b2e8e898744e05bc53dab0f1e63ba6e9e73
|
44d4d54fa50462e591d01524a8eb80e975a7ee26
|
/src/de/dis2016/presenter/EstatesPresenter.java
|
9e91583798c2544ceff5e12f90982244c1a138db
|
[] |
no_license
|
crafty501/Estates
|
c4185910099e00c9e4a7ac23014d69e55553a33c
|
fd6046bb334ea2cfbd5a17f8d56ab1a31587da94
|
refs/heads/master
| 2021-01-01T05:01:23.549579
| 2016-04-28T16:30:58
| 2016-04-28T16:30:58
| 56,402,246
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,340
|
java
|
package de.dis2016.presenter;
import de.dis2011.data.DB2;
import de.dis2011.data.Makler;
import de.dis2016.model.Apartment;
import de.dis2016.model.Estate;
import de.dis2016.model.House;
import de.dis2016.ui.EstatesFrame;
public class EstatesPresenter {
EstatesFrame view;
private DB2 data;
public EstatesPresenter(EstatesFrame view, DB2 data) {
this.view = view;
this.data = data;
}
public boolean logIn(String login) {
// TODO Auto-generated method stub
Makler makler = data.Gib_Makler(login);
//TODO loeschen
//makler = new Makler();
//makler.setLogin("test");
// ***************
boolean success = false;
if (makler!=null) {
success = true;
}
if (success) {
view.setMakler(makler);
view.setEstates(data.getEstates(login));
}
return success;
}
public void deleteEstate(Estate estate) {
data.deleteEstate(estate);
view.setEstates(data.getEstates(estate.getLogin()));
}
public void addHouse(House house) {
data.addHouse(house);
view.setEstates(data.getEstates(house.getLogin()));
}
public void addApartment(Apartment apartment) {
data.addApartment(apartment);
view.setEstates(data.getEstates(apartment.getLogin()));
}
public void updateEstate(Estate estate) {
data.updateEstate(estate);
view.setEstates(data.getEstates(estate.getLogin()));
}
}
|
[
"nick4542@yahoo.com"
] |
nick4542@yahoo.com
|
4e87571fd8a828c72833e14714d3562cd4046899
|
c544ab2f6c4211a051211f40a13d3d4e9e4a2369
|
/src/entitySearch/plan/EntitySearchPlan.java
|
f7eb9e48ac6f3dded68f0df22e3ccae8d6a186ac
|
[] |
no_license
|
ruilicoder/Lucene-EntitySearch
|
07923d63afc123a915704274b548bff65d6e6866
|
00e700556408bab34be351c0106fe06e003c1b48
|
refs/heads/master
| 2016-09-05T14:15:21.587232
| 2014-10-29T06:42:06
| 2014-10-29T06:42:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,898
|
java
|
package entitySearch.plan;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import util.ExcutionTimer;
import entitySearch.Configure;
import entitySearch.index.EntityTypeIndex;
import entitySearch.index.KeywordDocumentIndex;
import entitySearch.index.TypeEntityDocumentIndex;
public class EntitySearchPlan extends ExecutionPlan {
KeywordDocumentIndex kdi;
TypeEntityDocumentIndex tedi;
EntityTypeIndex eti;
public EntitySearchPlan(KeywordDocumentIndex kdi, EntityTypeIndex eti, TypeEntityDocumentIndex tedi) {
this.kdi = kdi;
this.tedi = tedi;
this.eti = eti;
//this.dei = dei;
}
HashMap<String,Integer> res;
@Override
public void processQuery(Query q) {
// TODO Auto-generated method stub
String[] keywords = q.keywords;
ArrayList<Integer>[] arrayList = kdi.getDocumentIDs(keywords);
ArrayList<Integer> list = this.getIntersection(arrayList);
//System.out.println(list.size());
HashMap<Integer,HashSet<Integer>> map = tedi.getDocumentEntityPairs(Integer.toString(q.type));
//System.out.println(map.size());
HashMap<Integer,HashSet<Integer>> results = getIntersection(map, list);
res = getEntities(results, eti);
}
public static void main(String[] args) {
KeywordDocumentIndex kdi = new KeywordDocumentIndex();
EntityTypeIndex eti = new EntityTypeIndex(Configure.entityList);
TypeEntityDocumentIndex tedi = new TypeEntityDocumentIndex(Configure.indexDir);
//tedi.buildIndex(fromFile, toDir)
EntitySearchPlan bp = new EntitySearchPlan(kdi, eti, tedi);
ArrayList<Query> queries = Query.loadQuery(Configure.indexDir + "query.txt" );
ExcutionTimer timer = new ExcutionTimer();
timer.setStart();
for (int i = 0; i < queries.size(); i++) {
bp.processQuery(queries.get(i));
}
timer.setEnd();
System.out.println(timer.getTime());
}
}
|
[
"ruililab@skyfox-lm.(none)"
] |
ruililab@skyfox-lm.(none)
|
902aeb9fc25bf535debda6f5bf89b0f0ed0a4146
|
1a0b52730c7095c0afff4344ea8dfeec8e34be41
|
/springboot2-jdbcdoc/src/test/java/com/myz/AppTest.java
|
6b3c0de958194ee270786141f473fc428d2de919
|
[] |
no_license
|
jiecai58/springboot2-study
|
3838f759e63fc3ffcd42b31b5e152dd555f1fca6
|
9646248428b81d1cf160351d37081403a9daffbc
|
refs/heads/master
| 2023-06-12T22:57:09.302769
| 2021-07-04T15:51:08
| 2021-07-04T15:51:08
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 272
|
java
|
package com.myz;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class AppTest {
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue() {
assertTrue(true);
}
}
|
[
"245890416@qq.com"
] |
245890416@qq.com
|
901e746931df35992488aadfcb72add574a6bf2c
|
61b37b520d53d76fd4d5a174e3479b526c4d0ae0
|
/HW3/Q1.java
|
c04d18d2ec940784ccf7b03c6defcbb441f9933c
|
[] |
no_license
|
linyu1021/CSE6242
|
30444e9f8457e5d31c3506a1bc67b6597c103bf4
|
4d22bf98006dd71220e9040248138871df0c03e9
|
refs/heads/master
| 2020-07-06T16:09:05.220767
| 2019-08-19T01:51:24
| 2019-08-19T01:51:24
| 203,076,509
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,209
|
java
|
package edu.gatech.cse6242;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.util.*;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class Q1 {
public static class TokenizerMapper
extends Mapper<Object, Text, Text, IntWritable>{
//private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
StringTokenizer itr = new StringTokenizer(value.toString(),"\t");
String[] array = new String[3];
int i = 0;
while (itr.hasMoreTokens()){
array[i++]=itr.nextToken();
}
word.set(array[1]);
context.write(word, new IntWritable(Integer.parseInt(array[2])));
}
}
public static class IntSumReducer
extends Reducer<Text,IntWritable,Text,IntWritable> {
private IntWritable result = new IntWritable();
public void reduce(Text key, Iterable<IntWritable> values,
Context context
) throws IOException, InterruptedException {
int min = 200;
for (IntWritable val : values) {
if(val.get() < min)
min = val.get();
}
result.set(min);
context.write(key, result);
}
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "Q1");
job.setJarByClass(Q1.class);
job.setMapperClass(TokenizerMapper.class);
job.setCombinerClass(IntSumReducer.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
/* TODO: Needs to be implemented */
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
|
[
"noreply@github.com"
] |
linyu1021.noreply@github.com
|
06b3f59a3894482acdce96556c43bfa1df131a8f
|
e6025348fe07060f7ef747cf4cdbc4f208604829
|
/Garage.java
|
5e1a919abae3f151175218e9db124a1e504f6e19
|
[] |
no_license
|
Alan-MT/CarreraAutos
|
19f17b9d024bc8bf1d43e53e91749f713109a233
|
0f3615f56ead17cd234f07185a8fa9b0fd03e3fe
|
refs/heads/main
| 2023-05-09T23:01:36.180038
| 2021-06-07T05:13:31
| 2021-06-07T05:13:31
| 374,542,050
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,453
|
java
|
import java.util.Scanner;
public class Garage {
Scanner escoger = new Scanner(System.in);
int opcion = 0;
private int eleccion = 0;
private int almacenarAuto;
private double precioMonedas;
private int precioGemas;
private final String Rojo = "Rojo";
private final String Azul = "Azul";
private final String Verde = "Verde";
private final int motor1 = 4;
private final int motor2 = 5;
private final int motor3 = 6;
private Auto seleccion[] = { new Auto("tesla", "Amarilo", 2, 1, 100), new Auto("For Mustang", "Amarillo", 2, 1, 100),
new Auto("Bugatti", "Amarillo", 2, 1, 100), new Auto("Jeep", "Amarillo", 2, 1, 100),
new Auto("Mercedez", "Amarillo", 2 , 1 , 100) };
public Garage(int eleccion, Auto[] seleccion) {
this.eleccion = eleccion;
this.seleccion = seleccion;
}
public Auto[] getSeleccion(){
return seleccion;
}
public void setSelecion(Auto seleccion[]){
this.seleccion = seleccion;
}
public int getEleccion() {
return eleccion;
}
public void setEleccion(int eleccion) {
this.eleccion = eleccion;
}
public void opciones(Jugador jugador) {
do {
jugador.informacionDelJuego();
System.out.println("-----------Bienvenidos a GAS MONKEY-------------");
System.out.println("Ya que estas aqui te ayudaremos a mejorar tu auto");
System.out.println("---------------Que quieres hacer-----------------");
System.out.println("1- Mejorar Potencia");
System.out.println("2- Llenar tanque de gasolina");
System.out.println("3- Mejorar llantas");
System.out.println("4- Cambiar color");
System.out.println("5- Ver propiedades del carro actual");
System.out.println("6- Comprar otro Vehiculo");
System.out.println("7- Cambiar auto");
System.out.println("8- volver al Menu Principal");
opcion = escoger.nextInt();
switch (opcion) {
case 1:
this.mejorPotencia(jugador);
break;
case 2:
this.llenarTanque(jugador);
break;
case 3:
this.mejoraLlantas(jugador);
break;
case 4:
this.cambioColor(jugador);
break;
case 5:
seleccion[eleccion].informacionGeneral();
break;
case 6:
break;
case 7:
break;
case 8:
break;
}
} while (opcion != 8);
}
public Garage() {
}
public void carros(){
System.out.println("\n Es hora de elegir tu auto ");
// son los 3 carros que puede seleecionar el jugador
for (almacenarAuto = 0; almacenarAuto < 3; almacenarAuto++) {
System.out.println("Carros # " + almacenarAuto);
seleccion[almacenarAuto].informacionGeneral();
}
do{
System.out.println("\n Que Carro vas a seleccionar ");
System.out.println("Debes de ver le numero que esta arriab para selecionar");
System.out.print("el que quieres ;");
eleccion = escoger.nextInt();
this.seleccionarAuto(seleccion);
}while(eleccion > 3);
}
public void seleccionarAuto(Auto auto[]) {
seleccion[eleccion].informacionGeneral();
}
public void cambioColor(Jugador jugador) {
System.out.println("Bienvenido a la paleta de colores");
System.out.println("El corto por los colores es de 20 monedas de oro");
System.out.println("el color que tienes actualmente es " + seleccion[eleccion].getColor());
System.out.println("los clores que tenemos son :");
precioMonedas = 20.0;
while (opcion > 3) {
System.out.println("1- ROJO ");
System.out.println("2- AZUL ");
System.out.println("3- VERDE ");
opcion = escoger.nextInt();
if (opcion == 1) {
seleccion[eleccion].setColor(Rojo);
jugador.quitarMonedasYGemas(precioMonedas, precioGemas);
} else if (opcion == 2) {
seleccion[eleccion].setColor(Azul);
jugador.quitarMonedasYGemas(precioMonedas, precioGemas);
} else if (opcion == 3) {
seleccion[eleccion].setColor(Verde);
jugador.quitarMonedasYGemas(precioMonedas, precioGemas);
} else {
System.out.println("Eleccion ERRONEA");
}
}
}
public void mejorPotencia(Jugador jugador) {
System.out.println("Debemos de mejorar tu auto");
System.out.println("Tu auto tiene actualmente un potencia de " + seleccion[eleccion].getMotor());
System.out.println("Te recuerdo que el precio de los motores varia depende ");
System.out.println("de la potencia que quires");
do {
System.out.println("1- Potencia 4");
System.out.println("Precio: 5 Gemas\n");
System.out.println("2- Potencia 5");
System.out.println("Precio: 20 Gemas\n");
System.out.println("3- Potencia de 7");
System.out.println("Precio: 35 Gemas\n");
System.out.println("Selecciona tu motor a travez del numero y enter");
opcion = escoger.nextInt();
switch (opcion) {
case 1:
seleccion[eleccion].setMotor(motor1);
precioGemas = 5;
jugador.quitarMonedasYGemas(precioMonedas, precioGemas);
break;
case 2:
seleccion[eleccion].setMotor(motor2);
precioGemas = 20;
jugador.quitarMonedasYGemas(precioMonedas, precioGemas);
break;
case 3:
seleccion[eleccion].setMotor(motor3);
precioGemas = 35;
jugador.quitarMonedasYGemas(precioMonedas, precioGemas);
break;
default:
System.out.println("Eleccion ERRONEA");
}
} while (opcion > 3);
}
public void llenarTanque(Jugador jugador) {
System.out.println("LLENEMOS ESE TANQUE");
System.out.println("cada galón costará 2.5 monedas de Oro");
System.out.println("Tienes ahorita " + seleccion[eleccion].getGas() + " de gasolina");
System.out.println("Con cuantos galones quieres llenarlo");
opcion = escoger.nextInt();
if (seleccion[eleccion].getGas() == 100) {
System.out.println("Ya esta lleno");
} else {
int llenar = seleccion[eleccion].getGas() + opcion;
seleccion[eleccion].setGas(llenar);
precioMonedas = 2.5 * opcion;
jugador.quitarMonedasYGemas(precioMonedas, precioGemas);
}
}
public void mejoraLlantas(Jugador jugador) {
System.out.println("Bienvenidos a MICHELIN");
System.out.println("Cambiemos esas llantas");
System.out.println("tu numero de rin es " + seleccion[eleccion].getLlantas());
System.out.println("el precio de las llantas varias y son lo siguientes");
System.out.println("1) Calidad baja 2");
System.out.println("precio de 25 monedas de oro");
System.out.println("2) Calidad Media 3");
System.out.println("precio de 50 monedas de oro");
System.out.println("3) Calidad Alta 5");
System.out.println("Precio de 75 monedas de oro");
opcion = escoger.nextInt();
if (opcion == 1) {
seleccion[eleccion].setLlantas(2);
precioMonedas = 25;
jugador.quitarMonedasYGemas(precioGemas, precioGemas);
} else if (opcion == 2) {
seleccion[eleccion].setLlantas(3);
precioMonedas = 50;
jugador.quitarMonedasYGemas(precioGemas, precioGemas);
} else if (opcion == 3) {
seleccion[eleccion].setLlantas(5);
precioMonedas = 75;
jugador.quitarMonedasYGemas(precioGemas, precioGemas);
} else {
System.out.println("Elecciona ERRONEA");
}
}
}
|
[
"moralesalan235@gmail.com"
] |
moralesalan235@gmail.com
|
05401dd47617607a0ff71cb8b3794189be75b50d
|
bcb42774f17ac4d19ff7f39ede1ccc85eccc9e63
|
/src/main/java/com/raidencentral/app/wsdlartifact/package-info.java
|
0855e9ca81d38658935588d29619af83074c40e7
|
[] |
no_license
|
peckwood/d171202-consuming-web-service-spring-boot-soap-wsdl
|
78e7200e5051c03155fcdfd19b620b63be0866b2
|
adc21e67a15c80b8298b5b441054b0027684ff9b
|
refs/heads/master
| 2021-05-15T06:39:18.080800
| 2017-12-13T03:51:57
| 2017-12-13T03:51:57
| 114,070,459
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 199
|
java
|
@javax.xml.bind.annotation.XmlSchema(namespace = "http://raidencentral.com/countries", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.raidencentral.app.wsdlartifact;
|
[
"peckwood@users.noreply.github.com"
] |
peckwood@users.noreply.github.com
|
6f9664cf214f8fa05978e55b048c4174fec6a4bd
|
ee1fa83d365590d2f1f938781dcfacefa49fee25
|
/src/main/java/runner/runtimeHandler.java
|
df5646bbd2bce40b14baf21c59479bc34d53a8a9
|
[] |
no_license
|
joesilveira/joesilveiraProject1
|
ecd93b93ab8fcacf20cdb714c373ecdc2266d64b
|
c08ebbd8c236bb4f1f5c8aaf69a3ceb7f4380234
|
refs/heads/master
| 2022-04-10T00:18:11.482331
| 2020-03-13T03:49:18
| 2020-03-13T03:49:18
| 236,573,588
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,805
|
java
|
package runner;//joe silveira
import java.io.File;
public class runtimeHandler {
//Class Variables
int openFile = 0;
File userFile;
File programFile;
public String getApi() {
return api;
}
public void setApi(String api) {
this.api = api;
}
public String getRssUrl() {
return rssUrl;
}
public void setRssUrl(String rssUrl) {
this.rssUrl = rssUrl;
}
String api = "https://jobs.github.com/positions.json?page=";
String rssUrl = "https://stackoverflow.com/jobs/feed";
String geoCode = "http://www.mapquestapi.com/geocoding/v1/address?key=xGA2gfYEJmplL7GrATFYpONUR1dGkPxx&location=1600+Pennsylvania+Ave+NW,Washington,DC,20500";
String fileName = "jobsAPI.txt";
//Java class variables
//Program class varialbes
//FileResource fileIO = new FileResource();
//Joe silveira
//Method to run the program with all necessary method calls
public void startProgram() throws Exception {
// //ask to open file
// openFile = ms.askToOpenFile();
// if (openFile == 0) {
// //Open the file if supported
// if (Desktop.isDesktopSupported()) {
// Desktop.getDesktop().open(fileIO.getUserFilePath());
// }
// }
// /*
// Methods calls for testing purposes
// */
//
// //*********File Stuff*******
// //Create local file for test and write the exact same contents of the user file to that file
//
// //Create file in program
// fileIO.createProgramFile(fileName);
//
// //Set the program file path
// programFile = fileIO.getProgramFile();
//
// //Write to the program file
// fileIO.writeJobsToFile(http.getJobsList(), programFile);
}
}
|
[
"55754953+joesilveira@users.noreply.github.com"
] |
55754953+joesilveira@users.noreply.github.com
|
67c5c86ed95164a6a68ef8c94ed8632a67433c66
|
d59756ef2122ab9daa2a1962d0b3376aa92c5bdb
|
/app/src/main/java/com/codingrodent/microservice/template/repository/impl/FortuneInMemoryRepository.java
|
14322bf1e7247c55635880a7252db4902dd1c1d0
|
[
"MIT"
] |
permissive
|
codesqueak/SYWTWAM
|
e35c8847b739ebfbe750a137b9cc11b91a02344f
|
0453ab76052d83a9dba1e9fc018447faf68c69cf
|
refs/heads/master
| 2021-09-11T00:04:33.291959
| 2017-08-01T23:28:32
| 2017-08-01T23:28:32
| 75,561,217
| 0
| 0
| null | 2017-08-01T23:28:33
| 2016-12-04T20:04:41
|
Java
|
UTF-8
|
Java
| false
| false
| 2,876
|
java
|
/*
* MIT License
*
* Copyright (c) 2016
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package com.codingrodent.microservice.template.repository.impl;
import com.codingrodent.microservice.template.entity.FortuneEntity;
import com.codingrodent.microservice.template.repository.api.ISyncFortuneRepository;
import org.springframework.context.annotation.Profile;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* In memory version of repository for when Couchbase is unavailable in the environment - minimal implementation of required methods
*/
@Profile({"test", "integration", "aws"})
@Service
public class FortuneInMemoryRepository extends InMemoryRepository<FortuneEntity> implements ISyncFortuneRepository<FortuneEntity> {
public FortuneInMemoryRepository() {
super();
}
@Override
FortuneEntity copy(final FortuneEntity original) {
return new FortuneEntity(original.getId(), original.getText(), original.getAuthor());
}
@Override
public List<FortuneEntity> findAllNamed(final Pageable pageable) {
List<FortuneEntity> list = getStore().keySet().
stream().
map(getStore()::get).
filter(model -> !"".equals(model.getAuthor())).
collect(Collectors.toList());
return getPage(pageable.getPageNumber(), pageable.getPageSize(), list).getContent();
}
@Override
public List<FortuneEntity> findAllAnon(final Pageable pageable) {
List<FortuneEntity> list = getStore().keySet().stream().map(getStore()::get).filter(model -> model.getAuthor().equals("")).collect(Collectors.toList());
return getPage(pageable.getPageNumber(), pageable.getPageSize(), list).getContent();
}
}
|
[
"codesqueak@gmail.com"
] |
codesqueak@gmail.com
|
d680bbc263003604b8f65bfa08d1a4fe15d70992
|
e15422c55a76896fd750200596a0ddac3369617d
|
/smbms/src/main/java/cn/happy/dao/IUserDao.java
|
0597c530a2dc9aa60cfdd59030583c2806c1a8ff
|
[] |
no_license
|
lihuohuo/FenYe
|
3461b288fbb44ab07f5a704873fadf4164535cd0
|
3e8233dc631add6a6659c8b5fa510597a27f625e
|
refs/heads/master
| 2021-08-18T21:58:04.978987
| 2017-11-19T06:21:45
| 2017-11-19T06:21:45
| 111,867,162
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 851
|
java
|
package cn.happy.dao;
import cn.happy.entity.User;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by lenovo on 2017/7/12.
*/
public interface IUserDao {
//登录
public User Login(User u);
// 用户列表
public List<User> SelectAll(@Param("userName") String userName,@Param("pageIndex") int pageIndex,@Param("pageSize") int pageSize);
public List<User> SelectAllU(@Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
//id 查询所有用户信息
public List<User> selectAllUserById(int id);
// 删除
public void DeleUserById(int id);
// 添加
public void InsertUser(User u);
//修改密码
public void UpdatePwd(User u);
//查询记录数
public int getCount(@Param("username") String username);
public int getCount1();
}
|
[
"冰火火"
] |
冰火火
|
8d549ccc55ea2cb9c5eb0ac3ad0918bee478b2c5
|
3a1f689e5ce3961cfca0cbfe5207fed472cfbf0b
|
/JDBCExample/src/sql/NoSuchEntityException.java
|
f75bcf1c0d0878e7b9abbaab31ae9bc98574b792
|
[] |
no_license
|
wang0561/collegeJAVAassignment
|
9521a1c6c84549907018e99de9e490f39c398cd2
|
1c0f395148ac57b81c1020713b033bb8bbfdea06
|
refs/heads/master
| 2021-03-30T16:01:04.139909
| 2019-06-10T14:01:45
| 2019-06-10T14:01:45
| 96,569,302
| 0
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 371
|
java
|
/*
* NoSuchEntityException.java
*
* Created on July 2, 2005, 2:03 PM
*/
package sql;
/**
*
* @author Reg
*/
public class NoSuchEntityException extends Exception {
public NoSuchEntityException() { super(DEFAULT_MESSAGE); }
public NoSuchEntityException(String msg) { super(msg); }
private final static String DEFAULT_MESSAGE = "No Such Entity";
}
|
[
"zbwangtao1985@gmail.com"
] |
zbwangtao1985@gmail.com
|
f85a449fb27dfdd7a82a90c782505a3984d70120
|
bc07a2f204b396df1194546067b3c9e7234b836a
|
/src/fcuiecsoops/GYM.java
|
3ec8a6d7941fbfcc9d2c19db796005cb2375f620
|
[] |
no_license
|
fcu-d0441569/OOP-HW6-Repository
|
2af4a8421a10bc4aebaf1366edb8172d047b0197
|
7ac85da3e346e9756003ef3cdba1338f269bea71
|
refs/heads/master
| 2020-06-10T23:03:38.522970
| 2016-12-07T17:38:55
| 2016-12-07T17:38:55
| 75,849,499
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,729
|
java
|
package fcuiecsoops;
import java.util.Random;
public class GYM {
public static Player fight(Player...players){
int people = 0,win1 = 0, win2 = 0;
Player[] play = new Player[2];
for(Player plays:players){
play[people] = plays;
people++;
}
Pokemon[] pkm1 = new Pokemon[3];
Pokemon[] pkm2 = new Pokemon[3];
pkm1 = play[0].getpokemons();
pkm2 = play[1].getpokemons();
for(int i =0;i<3;i++){
PokemonType type1 = pkm1[i].getType();
PokemonType type2 = pkm2[i].getType();
if(type1 == PokemonType.FIRE){
if(type2 == PokemonType.FIRE){
if(pkm1[i].getcp() == pkm2[i].getcp()){
Random num = new Random();
if(num.nextInt(100)%2==1){
win1++;
}
else{
win2++;
}
}
else if(pkm1[i].getcp() > pkm2[i].getcp()){
win1++;
}
else if(pkm1[i].getcp() < pkm2[i].getcp()){
win2++;
}
}
else if(type2 == PokemonType.GRASS){
win1++;
}
else if(type2 == PokemonType.WATER){
win2++;
}
}
else if(type1 == PokemonType.GRASS){
if(type2 == PokemonType.GRASS){
if(pkm1[i].getcp() == pkm2[i].getcp()){
Random num = new Random();
if(num.nextInt(100)%2==1){
win1++;
}
else{
win2++;
}
}
else if(pkm1[i].getcp() > pkm2[i].getcp()){
win1++;
}
else if(pkm1[i].getcp() < pkm2[i].getcp()){
win2++;
}
}
else if(type2 == PokemonType.WATER){
win1++;
}
else if(type2 == PokemonType.FIRE){
win2++;
}
}
else if(type1 == PokemonType.WATER){
if(type2 == PokemonType.WATER){
if(pkm1[i].getcp() == pkm2[i].getcp()){
Random num = new Random();
if(num.nextInt(100)%2==1){
win1++;
}
else{
win2++;
}
}
else if(pkm1[i].getcp() > pkm2[i].getcp()){
win1++;
}
else if(pkm1[i].getcp() < pkm2[i].getcp()){
win2++;
}
}
else if(type2 == PokemonType.FIRE){
win1++;
}
else if(type2 == PokemonType.GRASS){
win2++;
}
}
if(win1 == 2||win2 == 2){
break;
}
}
if(win1>win2){
play[0].setlevel(play[0].getlevel()+1);
System.out.println("Winner is "+play[0].getplayerName()+",and his/her level becomes"+play[0].getlevel());
return play[0];
}
else{
play[1].setlevel(play[1].getlevel()+1);
System.out.println("Winner is "+play[1].getplayerName()+",and his/her level becomes"+play[1].getlevel());
return play[1];
}
}
}
|
[
"Ryan@Ryan-PC"
] |
Ryan@Ryan-PC
|
588acbdc80a8cd63b6b7160f44e661fb07202e16
|
d36d30379a7002f600c7ef7b8d7f0a42fa6b473a
|
/src/main/java/com/shengsiyuan/grpc/StudentServiceImpl.java
|
4f724e7c1e03a3f31568ca4925f4f91067164666
|
[] |
no_license
|
kusebingtang/my_netty_lecture_code
|
f46b6b98bc651415c7d59bcff7855c2f81803f18
|
cea8dc5e707a0c62fd926d16298196e106e54dcb
|
refs/heads/master
| 2021-12-14T00:48:25.561159
| 2021-12-07T12:45:26
| 2021-12-07T12:45:26
| 218,420,205
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,154
|
java
|
package com.shengsiyuan.grpc;
import com.shengsiyuan.proto.*;
import io.grpc.stub.StreamObserver;
import java.util.UUID;
public class StudentServiceImpl extends StudentServiceGrpc.StudentServiceImplBase {
@Override
public void getRealNameByUsername(MyRequest request, StreamObserver<MyResponse> responseObserver) {
System.out.println("接受到客户端信息: " + request.getUsername());
responseObserver.onNext(MyResponse.newBuilder().setRealname("张三").build());
responseObserver.onCompleted();
}
@Override
public void getStudentsByAge(StudentRequest request, StreamObserver<StudentResponse> responseObserver) {
System.out.println("接受到客户端信息: " + request.getAge());
responseObserver.onNext(StudentResponse.newBuilder().setName("张三").setAge(20).setCity("北京").build());
responseObserver.onNext(StudentResponse.newBuilder().setName("李四").setAge(30).setCity("天津").build());
responseObserver.onNext(StudentResponse.newBuilder().setName("王五").setAge(40).setCity("成都").build());
responseObserver.onNext(StudentResponse.newBuilder().setName("赵六").setAge(50).setCity("深圳").build());
responseObserver.onCompleted();
}
@Override
public StreamObserver<StudentRequest> getStudentsWrapperByAges(StreamObserver<StudentResponseList> responseObserver) {
return new StreamObserver<StudentRequest>() {
@Override
public void onNext(StudentRequest value) {
System.out.println("onNext: " + value.getAge());
}
@Override
public void onError(Throwable t) {
System.out.println(t.getMessage());
}
@Override
public void onCompleted() {
StudentResponse studentResponse = StudentResponse.newBuilder().setName("张三").setAge(20).setCity("西安").build();
StudentResponse studentResponse2 = StudentResponse.newBuilder().setName("李四").setAge(30).setCity("广州").build();
StudentResponseList studentResponseList = StudentResponseList.newBuilder().
addStudentResponse(studentResponse).addStudentResponse(studentResponse2).build();
responseObserver.onNext(studentResponseList);
responseObserver.onCompleted();
}
};
}
@Override
public StreamObserver<StreamRequest> biTalk(StreamObserver<StreamResponse> responseObserver) {
return new StreamObserver<StreamRequest>() {
@Override
public void onNext(StreamRequest value) {
System.out.println(value.getRequestInfo());
responseObserver.onNext(StreamResponse.newBuilder().setResponseInfo(UUID.randomUUID().toString()).build());
}
@Override
public void onError(Throwable t) {
System.out.println(t.getMessage());
}
@Override
public void onCompleted() {
responseObserver.onCompleted();
}
};
}
}
|
[
"jb@98game.cn"
] |
jb@98game.cn
|
1b5b615a094a96dbb606639a07b8288dae72dac3
|
0b243bbce62d0207dfe4aeef0728bbfc9c16ec05
|
/harp-project/src/main/java/org/apache/hadoop/mapreduce/v2/app/MapCollectiveAppMaster.java
|
66c620608d7df311d1a0badf284f8f34f9e748d7
|
[
"Apache-2.0"
] |
permissive
|
argowtham/harp
|
3309a9530144350f948bcae35158100d2194448a
|
9fddb59b1d8302f948f3d7623ea6eac0375e1f8d
|
refs/heads/master
| 2021-01-21T10:04:59.117994
| 2017-05-09T14:57:21
| 2017-05-09T14:57:21
| 83,374,541
| 0
| 0
| null | 2017-03-06T06:22:40
| 2017-02-28T01:18:41
|
Java
|
UTF-8
|
Java
| false
| false
| 9,608
|
java
|
/*
* Copyright 2013-2016 Indiana University
*
* 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.apache.hadoop.mapreduce.v2.app;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapreduce.MRJobConfig;
import org.apache.hadoop.mapreduce.v2.app.client.ClientService;
import org.apache.hadoop.mapreduce.v2.app.launcher.ContainerLauncher;
import org.apache.hadoop.mapreduce.v2.app.launcher.ContainerLauncherEvent;
import org.apache.hadoop.mapreduce.v2.app.launcher.MapCollectiveContainerLauncherImpl;
import org.apache.hadoop.mapreduce.v2.app.rm.ContainerAllocator;
import org.apache.hadoop.mapreduce.v2.app.rm.ContainerAllocatorEvent;
import org.apache.hadoop.mapreduce.v2.app.rm.MapCollectiveContainerAllocator;
import org.apache.hadoop.mapreduce.v2.app.rm.RMCommunicator;
import org.apache.hadoop.mapreduce.v2.app.rm.RMHeartbeatHandler;
import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil;
import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.service.Service;
import org.apache.hadoop.service.ServiceOperations;
import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.util.ShutdownHookManager;
import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler;
import org.apache.hadoop.yarn.api.ApplicationConstants;
import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.util.ConverterUtils;
/*******************************************************
* The Map-Reduce Application Master. The state machine is encapsulated in the
* implementation of Job interface. All state changes happens via Job interface.
* Each event results in a Finite State Transition in Job.
*
* MR AppMaster is the composition of loosely coupled services. The services
* interact with each other via events. The components resembles the Actors
* model. The component acts on received event and send out the events to other
* components. This keeps it highly concurrent with no or minimal
* synchronization needs.
*
* The events are dispatched by a central Dispatch mechanism. All components
* register to the Dispatcher.
*
* The information is shared across different components using AppContext.
******************************************************/
public class MapCollectiveAppMaster extends MRAppMaster {
private static final Log LOG = LogFactory.getLog(MapCollectiveAppMaster.class);
public MapCollectiveAppMaster(ApplicationAttemptId applicationAttemptId, ContainerId containerId, String nmHost,
int nmPort, int nmHttpPort, long appSubmitTime) {
super(applicationAttemptId, containerId, nmHost, nmPort, nmHttpPort, appSubmitTime);
}
protected void serviceInit(final Configuration conf) throws Exception {
// conf will be written as the config of this
// AppMaster and the job
conf.setBoolean(MRJobConfig.JOB_UBERTASK_ENABLE, false);
conf.setBoolean(MRJobConfig.MAP_SPECULATIVE, false);
conf.getBoolean(MRJobConfig.REDUCE_SPECULATIVE, false);
super.serviceInit(conf);
}
protected ContainerAllocator createContainerAllocator(final ClientService clientService, final AppContext context) {
return new ContainerAllocatorRouter(clientService, context);
}
protected ContainerLauncher createContainerLauncher(final AppContext context) {
return new ContainerLauncherRouter(context);
}
/**
* This ContainerAllocatorRouter doesn't do local resource allocation for
* job uber mode
*/
private final class ContainerAllocatorRouter extends AbstractService
implements ContainerAllocator, RMHeartbeatHandler {
private final ClientService clientService;
private final AppContext context;
private ContainerAllocator containerAllocator;
ContainerAllocatorRouter(ClientService clientService, AppContext context) {
super(ContainerAllocatorRouter.class.getName());
this.clientService = clientService;
this.context = context;
}
@Override
protected void serviceStart() throws Exception {
this.containerAllocator = new MapCollectiveContainerAllocator(this.clientService, this.context);
((Service) this.containerAllocator).init(getConfig());
((Service) this.containerAllocator).start();
super.serviceStart();
}
@Override
protected void serviceStop() throws Exception {
ServiceOperations.stop((Service) this.containerAllocator);
super.serviceStop();
}
@Override
public void handle(ContainerAllocatorEvent event) {
this.containerAllocator.handle(event);
}
public void setSignalled(boolean isSignalled) {
((RMCommunicator) this.containerAllocator).setSignalled(isSignalled);
}
public void setShouldUnregister(boolean shouldUnregister) {
((RMCommunicator) this.containerAllocator).setShouldUnregister(shouldUnregister);
}
@Override
public long getLastHeartbeatTime() {
return ((RMCommunicator) this.containerAllocator).getLastHeartbeatTime();
}
@Override
public void runOnNextHeartbeat(Runnable callback) {
((RMCommunicator) this.containerAllocator).runOnNextHeartbeat(callback);
}
}
/**
* By the time life-cycle of this router starts, job-init would have already
* happened.
*/
private final class ContainerLauncherRouter extends AbstractService implements ContainerLauncher {
private final AppContext context;
private ContainerLauncher containerLauncher;
ContainerLauncherRouter(AppContext context) {
super(ContainerLauncherRouter.class.getName());
this.context = context;
}
@Override
protected void serviceStart() throws Exception {
this.containerLauncher = new MapCollectiveContainerLauncherImpl(context);
((Service) this.containerLauncher).init(getConfig());
((Service) this.containerLauncher).start();
super.serviceStart();
}
@Override
public void handle(ContainerLauncherEvent event) {
this.containerLauncher.handle(event);
}
@Override
protected void serviceStop() throws Exception {
ServiceOperations.stop((Service) this.containerLauncher);
super.serviceStop();
}
}
private static void validateInputParam(String value, String param) throws IOException {
if (value == null) {
String msg = param + " is null";
LOG.error(msg);
throw new IOException(msg);
}
}
public static void main(String[] args) {
// Log that a modified MRAppMaster starts
LOG.info("MapCollectiveAppMaster (MRAppMaster) starts.");
try {
Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
String containerIdStr = System.getenv(Environment.CONTAINER_ID.name());
String nodeHostString = System.getenv(Environment.NM_HOST.name());
String nodePortString = System.getenv(Environment.NM_PORT.name());
String nodeHttpPortString = System.getenv(Environment.NM_HTTP_PORT.name());
String appSubmitTimeStr = System.getenv(ApplicationConstants.APP_SUBMIT_TIME_ENV);
validateInputParam(containerIdStr, Environment.CONTAINER_ID.name());
validateInputParam(nodeHostString, Environment.NM_HOST.name());
validateInputParam(nodePortString, Environment.NM_PORT.name());
validateInputParam(nodeHttpPortString, Environment.NM_HTTP_PORT.name());
validateInputParam(appSubmitTimeStr, ApplicationConstants.APP_SUBMIT_TIME_ENV);
ContainerId containerId = ConverterUtils.toContainerId(containerIdStr);
ApplicationAttemptId applicationAttemptId = containerId.getApplicationAttemptId();
long appSubmitTime = Long.parseLong(appSubmitTimeStr);
MRAppMaster appMaster = new MapCollectiveAppMaster(applicationAttemptId, containerId, nodeHostString,
Integer.parseInt(nodePortString), Integer.parseInt(nodeHttpPortString), appSubmitTime);
ShutdownHookManager.get().addShutdownHook(new MRAppMasterShutdownHook(appMaster), SHUTDOWN_HOOK_PRIORITY);
JobConf conf = new JobConf(new YarnConfiguration());
conf.addResource(new Path(MRJobConfig.JOB_CONF_FILE));
MRWebAppUtil.initialize(conf);
String jobUserName = System.getenv(ApplicationConstants.Environment.USER.name());
conf.set(MRJobConfig.USER_NAME, jobUserName);
// Do not automatically close FileSystem
// objects so that in case of
// SIGTERM I have a chance to write out the
// job history. I'll be closing
// the objects myself.
conf.setBoolean("fs.automatic.close", false);
initAndStartAppMaster(appMaster, conf, jobUserName);
} catch (Throwable t) {
LOG.fatal("Error starting MRAppMaster", t);
ExitUtil.terminate(1, t);
}
}
}
|
[
"li526@indiana.edu"
] |
li526@indiana.edu
|
e4b81bb80e4b308f6ca34ad094683c94b575ee44
|
ac94d4a2cb9e509c22f5e59e8f8f6eabac34519c
|
/BeeHive/backend/mafenghive/src/beehive/controller/LoginAction.java
|
f2657c6ac9616f10f716f9b0fde6a95b3174eaf5
|
[] |
no_license
|
ranf999/Arduino-Environment-Monitor
|
0c164d6262f9b9aa1b1a3435bb5939c3f83f36a3
|
b12ef5ebd56e1a9f7541ee1d6591478162929238
|
refs/heads/master
| 2020-12-05T10:01:48.712772
| 2016-09-15T05:39:07
| 2016-09-15T05:39:07
| 66,060,401
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,478
|
java
|
package beehive.controller;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import beehive.dao.UserDao;
import beehive.bean.User;
public class LoginAction extends HttpServlet {
private UserDao userDao = new UserDao();
public LoginAction() {
super();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
request.setCharacterEncoding("utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// Read report data from <form>
String phone = request.getParameter("phone");
String password = request.getParameter("password");
// If user phone not exist, forward to UsrNotExist
if(userDao == null)
{
response.sendRedirect("./page_not_found.jsp");
return;
}
if(!userDao.has(phone))
{
response.sendRedirect("./user_not_found.jsp");
return;
}
// Call ReportDao to get the object
User user = userDao.getUser(phone);
request.setAttribute("user", user);
request.getSession().setAttribute("user", user);
if( password.equals(user.getPassword()) )
response.sendRedirect("DisplayAction");
//request.getRequestDispatcher("DisplayAction").forward(request, response);
else
response.sendRedirect("./user_not_found.jsp");
}
}
|
[
"1253936027@qq.com"
] |
1253936027@qq.com
|
1d9a3ffe1db884d041c4564e3cc801531a4dc56f
|
621d311a5fb3c2a02be557b202e914455f172e02
|
/app/src/main/java/com/example/julolopop/datosxmltema3/adapter/AdapterAemet.java
|
8457119951705f07987a160e723a1679899bb2be
|
[] |
no_license
|
julolopop/DatosXmlTema3
|
80b5d6891305de8cb4649b30d2e51451be6ca140
|
7f057d6f65d07066ab6196c5baf403b28563079f
|
refs/heads/master
| 2021-05-12T02:22:57.918889
| 2018-01-15T19:11:47
| 2018-01-15T19:11:47
| 117,585,156
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,605
|
java
|
package com.example.julolopop.datosxmltema3.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.example.julolopop.datosxmltema3.Eje2Activity;
import com.example.julolopop.datosxmltema3.R;
import com.example.julolopop.datosxmltema3.pojo.Aemet;
import java.util.ArrayList;
/**
* Created by Julolopop on 03/01/2018.
*/
public class AdapterAemet extends ArrayAdapter<Aemet>{
public AdapterAemet(@NonNull Context context) {
super(context, R.layout.item_aemet,new ArrayList<Aemet>());
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
AemetHorler horler;
if(convertView == null){
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_aemet,null);
horler = new AemetHorler();
horler.fecha = (TextView)convertView.findViewById(R.id.txv_Fecha);
horler.lluvia1 = (TextView)convertView.findViewById(R.id.txv_Precipitacion1);
horler.lluvia2 = (TextView)convertView.findViewById(R.id.txv_Precipitacion2);
horler.lluvia3 = (TextView)convertView.findViewById(R.id.txv_Precipitacion3);
horler.lluvia4 = (TextView)convertView.findViewById(R.id.txv_Precipitacion4);
horler.nieve1 = (TextView)convertView.findViewById(R.id.txv_Nieve1);
horler.nieve2 = (TextView)convertView.findViewById(R.id.txv_Nieve2);
horler.nieve3 = (TextView)convertView.findViewById(R.id.txv_Nieve3);
horler.nieve4 = (TextView)convertView.findViewById(R.id.txv_Nieve4);
horler.stado1 = (TextView)convertView.findViewById(R.id.txv_estado1);
horler.stado2 = (TextView)convertView.findViewById(R.id.txv_estado2);
horler.stado3 = (TextView)convertView.findViewById(R.id.txv_estado3);
horler.stado4 = (TextView)convertView.findViewById(R.id.txv_estado4);
horler.direccion1 = (TextView)convertView.findViewById(R.id.txv_direccion1);
horler.direccion2 = (TextView)convertView.findViewById(R.id.txv_direccion2);
horler.direccion3 = (TextView)convertView.findViewById(R.id.txv_direccion3);
horler.direccion4 = (TextView)convertView.findViewById(R.id.txv_direccion4);
horler.velocidad1 = (TextView)convertView.findViewById(R.id.txv_velocidad1);
horler.velocidad2 = (TextView)convertView.findViewById(R.id.txv_velocidad2);
horler.velocidad3 = (TextView)convertView.findViewById(R.id.txv_velocidad3);
horler.velocidad4 = (TextView)convertView.findViewById(R.id.txv_velocidad4);
horler.temperatura1 = (TextView)convertView.findViewById(R.id.txv_temperatura1);
horler.temperatura2 = (TextView)convertView.findViewById(R.id.txv_temperatura2);
horler.temperatura3 = (TextView)convertView.findViewById(R.id.txv_temperatura3);
horler.temperatura4 = (TextView)convertView.findViewById(R.id.txv_temperatura4);
horler.humedad1 = (TextView)convertView.findViewById(R.id.txv_humedad1);
horler.humedad2 = (TextView)convertView.findViewById(R.id.txv_humedad2);
horler.humedad3 = (TextView)convertView.findViewById(R.id.txv_humedad3);
horler.humedad4 = (TextView)convertView.findViewById(R.id.txv_humedad4);
convertView.setTag(horler);
}else{
horler = (AemetHorler) convertView.getTag();
}
horler.fecha.setText((CharSequence) getItem(position).getFecha());
horler.lluvia1.setText((getItem(position).getLluvia1()));
horler.lluvia2.setText((getItem(position).getLluvia2()));
horler.lluvia3.setText((getItem(position).getLluvia3()));
horler.lluvia4.setText((getItem(position).getLluvia4()));
horler.nieve1.setText((getItem(position).getNieve1()));
horler.nieve2.setText((getItem(position).getNieve2()));
horler.nieve3.setText((getItem(position).getNieve3()));
horler.nieve4.setText((getItem(position).getNieve4()));
horler.stado1.setText((getItem(position).getStado1()));
horler.stado2.setText((getItem(position).getStado2()));
horler.stado3.setText((getItem(position).getStado3()));
horler.stado4.setText((getItem(position).getStado4()));
horler.direccion1.setText((getItem(position).getDireccion1()));
horler.direccion2.setText((getItem(position).getDireccion2()));
horler.direccion3.setText((getItem(position).getDireccion3()));
horler.direccion4.setText((getItem(position).getDireccion4()));
horler.velocidad1.setText((getItem(position).getVelocidad1()));
horler.velocidad2.setText((getItem(position).getVelocidad2()));
horler.velocidad3.setText((getItem(position).getVelocidad3()));
horler.velocidad4.setText((getItem(position).getVelocidad4()));
horler.temperatura1.setText((getItem(position).getTemperatura1()));
horler.temperatura2.setText((getItem(position).getTemperatura2()));
horler.temperatura3.setText((getItem(position).getTemperatura3()));
horler.temperatura4.setText((getItem(position).getTemperatura4()));
horler.humedad1.setText((getItem(position).getHumedad1()));
horler.humedad2.setText((getItem(position).getHumedad2()));
horler.humedad3.setText((getItem(position).getHumedad3()));
horler.humedad4.setText((getItem(position).getHumedad4()));
return convertView;
}
class AemetHorler{
TextView fecha;
TextView lluvia1;
TextView lluvia2;
TextView lluvia3;
TextView lluvia4;
TextView nieve1;
TextView nieve2;
TextView nieve3;
TextView nieve4;
TextView stado1;
TextView stado2;
TextView stado3;
TextView stado4;
TextView direccion1;
TextView direccion2;
TextView direccion3;
TextView direccion4;
TextView velocidad1;
TextView velocidad2;
TextView velocidad3;
TextView velocidad4;
TextView temperatura1;
TextView temperatura2;
TextView temperatura3;
TextView temperatura4;
TextView humedad1;
TextView humedad2;
TextView humedad3;
TextView humedad4;
}
}
|
[
"jjm5@hotmail.es"
] |
jjm5@hotmail.es
|
2d16d9ceebb4b65c653323959dd65b2995709eda
|
1c37c0691f453be67b122017b614a27e17fcf928
|
/src/test/java/Orange/Steps/Conexion.java
|
39bae77336e5610bd9b46ec4ca1981092144f369
|
[] |
no_license
|
NicolasHerrera69/ProyectoAutomatizacion
|
cb726cc626a4cb80de8f4c46225768bd2b818151
|
e351d98f3a253ba61490edf4eec50615fb97a9da
|
refs/heads/master
| 2023-08-04T13:32:21.461900
| 2021-09-27T23:10:56
| 2021-09-27T23:10:56
| 409,755,597
| 0
| 0
| null | 2021-09-27T23:10:56
| 2021-09-23T22:02:26
|
Java
|
UTF-8
|
Java
| false
| false
| 676
|
java
|
package Orange.Steps;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import cucumber.api.java.Before;
import net.thucydides.core.annotations.Step;
public class Conexion {
private WebDriver driver;
@Before
@Step
public WebDriver abrirNavegador() {
System.setProperty("webdriver.chrome.driver", "Drivers/chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.navigate().to("https://opensource-demo.orangehrmlive.com/index.php/auth/login");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
return this.driver;
}
}
|
[
"nicolasrobayo44@gmail.com"
] |
nicolasrobayo44@gmail.com
|
678565b1de8c49f3f586ff94f557c768def4c53b
|
a48b1b3841c1048cea86d6e34211ccadbf8978ad
|
/src/main/java/multithreading/concurrencyTools/locks/reentrantLockTnterrupt/Application.java
|
a232e90a39294bff2b468fe11af19c0595d3d4ca
|
[] |
no_license
|
BaranovAndrey99/multithreading
|
e2b9822d3a5aa8fa03080f42bf139c91d2e6ed21
|
13d43cf21d157d28d681a315c1b2d875a711a6b9
|
refs/heads/master
| 2020-08-10T20:32:00.296335
| 2019-10-11T11:09:54
| 2019-10-11T11:09:54
| 214,415,161
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 809
|
java
|
package multithreading.concurrencyTools.locks.reentrantLockTnterrupt;
import java.util.concurrent.locks.ReentrantLock;
public class Application {
public static void main(String[] args) throws InterruptedException{
CommonResource commonResource = new CommonResource();
ReentrantLock reentrantLock = new ReentrantLock();
Thread thread1 = new Thread(new ThreadTask(commonResource, reentrantLock));
Thread thread2 = new Thread(new ThreadTask(commonResource, reentrantLock));
Thread thread3 = new Thread(new ThreadTask(commonResource, reentrantLock));
thread1.start();
thread2.start();
thread3.start();
thread1.join();
thread2.join();
thread3.join();
System.out.println(commonResource.getCounter());
}
}
|
[
"pishipismodrug@gmail.com"
] |
pishipismodrug@gmail.com
|
feb3091cf0a4b4f7d7c4906e4b62fa17e763e89a
|
db335184867db96711235a261d8f771f7bbe4a62
|
/java/src/main/java/com/ly/java/thrift/inflectServer4/Iface.java
|
ff28c49222af054f4c0c3ff1e0d1107d5f4289c0
|
[
"MIT"
] |
permissive
|
liyong299/normal
|
91f3b5dd346c7a838c8fb8922833b3ea8b6ff0a6
|
97d7df786b720bacdba7329c35062aff3e6afb60
|
refs/heads/master
| 2020-05-21T04:47:38.732764
| 2017-05-09T15:13:45
| 2017-05-09T15:13:45
| 50,655,353
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 165
|
java
|
package com.ly.java.thrift.inflectServer4;
public interface Iface {
public String invoke(String uri, String request) throws org.apache.thrift.TException;
}
|
[
"314049502@qq.com"
] |
314049502@qq.com
|
e0202d311d784858d14efb3e68962589f43bc848
|
4995dc14675557c49912278ff0d679ef7e5febc5
|
/src/ProjectionPoor.java
|
dd02a81964c4bbd85b983f7fb9b6951ad040d33a
|
[] |
no_license
|
matEhickey/3DViewer
|
ac843f5fed0c43bbb6883f3c2b8766db9c45f5d9
|
2f060834606747f99613643de14f8f9bb3fd52df
|
refs/heads/master
| 2021-01-10T07:18:53.493960
| 2020-10-09T19:59:56
| 2020-10-09T19:59:56
| 35,980,504
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 288
|
java
|
import java.util.*;
public class ProjectionPoor implements Projection {
public int[] getXYcoord(Vertice vertice){
int[] coord = new int[2];
coord[0] = ((int)vertice.x) -((int)(vertice.z/2.0));
coord[1] = ((int)vertice.y) -((int)(vertice.z/2.0));
return(coord);
}
}
|
[
"didier@didier-1015CX.(none)"
] |
didier@didier-1015CX.(none)
|
d88d683fe77566bc4c7c55640c46d0d1e23dfd49
|
00935e3c2595f27132b10176630ab927d08e9d1d
|
/src/main/test/com/tiandu/test/ChangeImage.java
|
78a1136253bd69c1bade8d2ec9a0bdf3a9206a11
|
[] |
no_license
|
scanerliu/tdStoreNew
|
5bbda9b9ec2382d2fd50a6e7e8449ae92e1be4e6
|
f0b4bfb4204057cef1719c69e976b4e8a5385ad6
|
refs/heads/master
| 2020-05-21T16:14:47.226533
| 2017-01-23T05:13:20
| 2017-01-23T05:13:20
| 64,206,523
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,755
|
java
|
package com.tiandu.test;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class ChangeImage {
public static BufferedImage makeRoundedCorner(BufferedImage image,
int cornerRadius) {
int w = image.getWidth();
int h = image.getHeight();
BufferedImage output = new BufferedImage(w, h,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = output.createGraphics();
// This is what we want, but it only does hard-clipping, i.e. aliasing
// g2.setClip(new RoundRectangle2D ...)
// so instead fake soft-clipping by first drawing the desired clip shape
// in fully opaque white with antialiasing enabled...
g2.setComposite(AlphaComposite.Src);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(Color.WHITE);
g2.fill(new RoundRectangle2D.Float(0, 0, w, h, cornerRadius,
cornerRadius));
// ... then compositing the image on top,
// using the white shape from above as alpha source
g2.setComposite(AlphaComposite.SrcAtop);
g2.drawImage(image, 0, 0, null);
g2.dispose();
return output;
}
public static BufferedImage createResizedCopy(Image originalImage, int scaledWidth,
int scaledHeight, boolean preserveAlpha) {
int imageType = preserveAlpha ? BufferedImage.TYPE_INT_RGB
: BufferedImage.TYPE_INT_ARGB;
BufferedImage scaledBI = new BufferedImage(scaledWidth, scaledHeight,
imageType);
Graphics2D g = scaledBI.createGraphics();
if (preserveAlpha) {
g.setComposite(AlphaComposite.Src);
}
g.drawImage(originalImage, 0, 0, scaledWidth, scaledHeight, null);
g.dispose();
return scaledBI;
}
public static void main(String[] args) throws IOException {
BufferedImage icon = ImageIO.read(new File("D://var//qrcode.jpg"));
BufferedImage rounded = makeRoundedCorner(icon, 160);
ImageIO.write(rounded, "png", new File("D://var//qrcode_rounded.png"));
// BufferedImage pic = ImageIO.read(new File("/home/june/桌面/zhang.jpg"));
// BufferedImage resized = createResizedCopy(pic, 250, 250*768/1024, true);
// ImageIO.write(resized, "jpg", new File("/home/june/桌面/zhang_small.jpg"));
}
}
|
[
"liuxinbing@PC-20150724SCAB"
] |
liuxinbing@PC-20150724SCAB
|
0356c687da523090b58d3cab506ee3afa717ddca
|
754e5acb8c4b96f7688be1fd30b4f11581f55026
|
/HolaMundo11/src/main/java/Calculadora.java
|
92301b42aeec2b4d707770e33af79dec6433c153
|
[] |
no_license
|
RonaldoChan/Proyectos-Java
|
163f65e786d09e241a9a8a0824b4799c326b4bc6
|
de243b01f1f8f056a13fc665fc328e4a664e4e85
|
refs/heads/master
| 2022-07-10T19:55:01.098856
| 2020-05-14T01:22:11
| 2020-05-14T01:22:11
| 263,782,056
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 457
|
java
|
import java.util.Scanner;
public class Calculadora {
public static void main(String[] args) {
//int suma = 0;
System.out.println("Digite el primer numero: ");
Scanner scanner = new Scanner(System.in);
String n1 = scanner.nextLine();
System.out.println("Digite el segundo: ");
String n2 = scanner.nextLine();
String suma = n1 + n2;
System.out.println("La suma es: " + suma);
}
}
|
[
"ronaldo973359101@gmail.com"
] |
ronaldo973359101@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.