blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6fd146f9060b88a91733cb4998f70ced92bf83bd | 0f57535b219945520ef886dda154ddf89ff3f11d | /src/frame/GEMenuBar.java | 95a32500d0a806e11eb53dcd98dc0377f78e6dbe | [] | no_license | PKH7850/151214-Paint | 2c14c0c19a5a3a804a3969310f40205563c4aeb5 | b4528b1d95d3e7553de0648a6250fb2d6a350d65 | refs/heads/master | 2020-12-30T16:42:06.383283 | 2017-05-11T19:29:15 | 2017-05-11T19:29:15 | 91,016,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | package frame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import menu.GEMenu;
import constants.GEConstant.EMenu;
public class GEMenuBar extends JMenuBar {
private static final long serialVersionUID = 1L;
public GEMenuBar() {
super();
for (EMenu eMenu: EMenu.values()) {
JMenu menu = eMenu.newMenu();
menu.setText(eMenu.getName());
this.add(menu);
}
}
public void init(GEPanel drawingPanel) {
for (int i=0; i<this.getMenuCount(); i++) {
GEMenu menu = (GEMenu) this.getMenu(i);
menu.init(drawingPanel);
}
}
} | [
"rkdgus337@naver.com"
] | rkdgus337@naver.com |
56c8720805eee308d9e479022f14884ab6ab610d | 467056f1737acae58f0350a477dafc0a1384c2b1 | /prototype/app/src/main/java/com/example/asheransari/prototype/Activities/mapScreen.java | 2ae8d9c350713107d0d65a34821cbd6e3ba6ad2e | [] | no_license | masheransari/login_firebase | 8cefb31f32ead967ad7ca56b24ef3dccc52b71fc | 64f21c8583b88d9a24f1eb035b6173c2741eb2cf | refs/heads/master | 2021-01-22T04:05:23.696492 | 2017-06-04T10:31:58 | 2017-06-04T10:31:58 | 92,430,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,635 | java | package com.example.asheransari.prototype.Activities;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;
import com.example.asheransari.prototype.R;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.firebase.auth.FirebaseAuth;
public class mapScreen extends FragmentActivity implements OnMapReadyCallback, LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private GoogleMap mMap;
private Location loc;
private LocationManager manager = null;
private FirebaseAuth mAuth;
private TextView mTextView, longitudeAndLatitude;
private GoogleApiClient mGoogleApiClient;
private LocationRequest mLocationRequest;
private double currentLatitude;
private double currentLongitude;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map_screen);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
mAuth = FirebaseAuth.getInstance();
manager = (LocationManager) this.getSystemService(LOCATION_SERVICE);
mTextView = (TextView) findViewById(R.id.email_map);
longitudeAndLatitude = (TextView) findViewById(R.id.longLat_text);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
String email = mAuth.getCurrentUser().getEmail();
mTextView.setText("Email : " + email);
mGoogleApiClient = new GoogleApiClient.Builder(this)
// The next two lines tell the new client that “this” current class will handle connection stuff
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
//fourth line adds the LocationServices API endpoint from GooglePlayServices
.addApi(LocationServices.API)
.build();
// Create the LocationRequest object
mLocationRequest = LocationRequest.create()
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
.setInterval(10 * 1000) // 10 seconds, in milliseconds
.setFastestInterval(1 * 1000); // 1 second, in milliseconds
}
@Override
protected void onResume() {
super.onResume();
//Now lets connect to the API
mGoogleApiClient.connect();
}
@Override
protected void onPause() {
super.onPause();
// Log.v(this.getClass().getSimpleName(), "onPause()");
//Disconnect from API onPause()
if (mGoogleApiClient.isConnected()) {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
mGoogleApiClient.disconnect();
}
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(currentLongitude, currentLatitude);
//// loc = manager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
//// manager.requestLocationUpdates(
//// LocationManager.NETWORK_PROVIDER,
//// 0,
//// 0, this);
////
//// loc = manager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
//// double lat = loc.getLatitude();
//// double longi = loc.getLongitude();
//// LatLng currentLocation = new LatLng(longi, lat);
mMap.addMarker(new MarkerOptions().position(sydney).title("Current Location"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
// longitudeAndLatitude.setText("Current Longitude = " + longi + " and Latitude = " + lat);
////// mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
////
mMap.setMyLocationEnabled(true);
}
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
//// return super.onOptionsItemSelected(item);
//// getMenuInflater().inflate(R.menu.menu_map,item);
//// return true;
// int id = item.getItemId();
// switch (id) {
// case R.id.signOut:
// mAuth.signOut();
// Toast.makeText(this, "Sign out Successfully..!!", Toast.LENGTH_SHORT).show();
// Intent i = new Intent(mapScreen.this, login.class);
// startActivity(i);
// finish();
// break;
// default:
// break;
// }
// return super.onOptionsItemSelected(item);
// }
@Override
public void onLocationChanged(Location location) {
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(currentLongitude, currentLatitude);
mMap.addMarker(new MarkerOptions().position(sydney).title("Current Location"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
mMap.setMyLocationEnabled(true);
currentLatitude = location.getLatitude();
currentLongitude = location.getLongitude();
longitudeAndLatitude.setText("Current Longitude = " + currentLongitude + " and Latitude = " + currentLatitude);
}
@Override
public void onConnected(Bundle bundle) {
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
Location location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
if (location == null) {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
} else {
//If everything went fine lets get latitude and longitude
currentLatitude = location.getLatitude();
currentLongitude = location.getLongitude();
Toast.makeText(this, currentLatitude + " WORKS " + currentLongitude + "", Toast.LENGTH_LONG).show();
}
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
}
}
| [
"asher.ansari@nhu.edu.pk"
] | asher.ansari@nhu.edu.pk |
7dc652f0688914380b277f43af87b64fa13e2309 | d371a55ad99e8f18bd083a02acc708c1a1588242 | /src/test/java/e2e/InheritedVersionsTest.java | bf9a7bf4dfc59b3339f63444ab8977de28fac6af | [
"MIT"
] | permissive | danielflower/multi-module-maven-release-plugin | 38b2d565b23c17391b9a32e9c3efe802f136daa2 | a29f1b84d872374a332783cf7d933d92ebbd2a5e | refs/heads/master | 2023-08-25T11:18:53.469550 | 2023-02-18T15:28:25 | 2023-02-18T15:28:25 | 29,593,072 | 130 | 86 | MIT | 2023-08-16T11:59:20 | 2015-01-21T14:23:53 | Java | UTF-8 | Java | false | false | 4,003 | java | package e2e;
import org.apache.maven.shared.invoker.MavenInvocationException;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.ObjectId;
import org.junit.BeforeClass;
import org.junit.Test;
import scaffolding.MvnRunner;
import scaffolding.TestProject;
import java.io.IOException;
import java.util.List;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static scaffolding.ExactCountMatcher.oneOf;
import static scaffolding.ExactCountMatcher.twoOf;
import static scaffolding.GitMatchers.hasCleanWorkingDirectory;
import static scaffolding.GitMatchers.hasTag;
import static scaffolding.MvnRunner.assertArtifactInLocalRepo;
public class InheritedVersionsTest {
public static final String[] ARTIFACT_IDS = new String[]{"inherited-versions-from-parent", "core-utils", "console-app"};
final String buildNumber = String.valueOf(System.currentTimeMillis());
final String expected = "1.0." + buildNumber;
final TestProject testProject = TestProject.inheritedVersionsFromParent();
@BeforeClass
public static void installPluginToLocalRepo() throws MavenInvocationException {
MvnRunner.installReleasePluginToLocalRepo();
}
@Test
public void buildsAndInstallsAndTagsAllModules() throws Exception {
buildsEachProjectOnceAndOnlyOnce(testProject.mvnRelease(buildNumber));
installsAllModulesIntoTheRepoWithTheBuildNumber();
theLocalAndRemoteGitReposAreTaggedWithTheModuleNameAndVersion();
}
private void buildsEachProjectOnceAndOnlyOnce(List<String> commandOutput) throws Exception {
assertThat(
commandOutput,
allOf(
oneOf(containsString("Going to release inherited-versions-from-parent " + expected)),
twoOf(containsString("Building inherited-versions-from-parent")), // once for initial build; once for release build
oneOf(containsString("Building core-utils")),
oneOf(containsString("Building console-app")),
oneOf(containsString("The Calculator Test has run"))
)
);
}
private void installsAllModulesIntoTheRepoWithTheBuildNumber() throws Exception {
assertArtifactInLocalRepo("com.github.danielflower.mavenplugins.testprojects.versioninheritor", "inherited-versions-from-parent", expected);
assertArtifactInLocalRepo("com.github.danielflower.mavenplugins.testprojects.versioninheritor", "core-utils", expected);
assertArtifactInLocalRepo("com.github.danielflower.mavenplugins.testprojects.versioninheritor", "console-app", expected);
}
private void theLocalAndRemoteGitReposAreTaggedWithTheModuleNameAndVersion() throws IOException, InterruptedException {
for (String artifactId : ARTIFACT_IDS) {
String expectedTag = artifactId + "-" + expected;
assertThat(testProject.local, hasTag(expectedTag));
assertThat(testProject.origin, hasTag(expectedTag));
}
}
@Test
public void thePomChangesAreRevertedAfterTheRelease() throws IOException, InterruptedException {
ObjectId originHeadAtStart = head(testProject.origin);
ObjectId localHeadAtStart = head(testProject.local);
assertThat(originHeadAtStart, equalTo(localHeadAtStart));
testProject.mvnRelease(buildNumber);
assertThat(head(testProject.origin), equalTo(originHeadAtStart));
assertThat(head(testProject.local), equalTo(localHeadAtStart));
assertThat(testProject.local, hasCleanWorkingDirectory());
}
// @Test
// public void whenOneModuleDependsOnAnotherThenWhenReleasingThisDependencyHasTheRelaseVersion() {
// // TODO: implement this
// }
private ObjectId head(Git git) throws IOException {
return git.getRepository().getRefDatabase().findRef("HEAD").getObjectId();
}
}
| [
"git@danielflower.com"
] | git@danielflower.com |
e0349a44fb615634b9bbc4e55e83e53e49d44d1a | be3deb9271dbf07a2f7b87e1ecd447587aac0691 | /hopital/src/main/java/sopra/promo404/hopital/repository/IRepositoryConsultation.java | feda1af2de5ba31c946e4deedfcdf60cc93426d9 | [] | no_license | NelbyLeFourbe/projetHosto | 6eab970c81dc9173ae2b58fddb68444b2c51dd50 | 0e48e927998e342f51205491fa0c77c9c8e7dec7 | refs/heads/master | 2020-03-28T12:33:30.808916 | 2018-09-12T14:50:52 | 2018-09-12T14:50:52 | 148,310,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | package sopra.promo404.hopital.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import sopra.promo404.hopital.model.Consultation;
import sopra.promo404.hopital.model.Patient;
public interface IRepositoryConsultation extends JpaRepository<Consultation, Long> {
@Query("select c from Consultation c")
List<Consultation> findAllConsultation();
@Query("select c from Consultation c left join fetch c.salle s where c.id = :id")
Consultation findByIdWithSalles(Long id);
}
| [
"terence.allart@gmail.com"
] | terence.allart@gmail.com |
b4c257b5e5a0cbb5c5d6adb6e6ad9494c8e28db4 | 2337f4fb9177864bf2c569783c3f04e2d1a4da74 | /imooc/src/com/imooc/mooo/ChatMessageAdapter.java | 977d95a5137d0f93aa5a5af801f82d94b1e2957c | [] | no_license | MinzhengHuang/imooc_demo | 9c7fdb16508e9c9a65cbc42e013ba96e8a9d62fa | 6fcdc12ce9f639eccf3fb266971ded7d233d77a1 | refs/heads/master | 2021-01-10T16:23:14.963516 | 2016-03-10T08:19:53 | 2016-03-10T08:19:53 | 44,149,525 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,460 | java | package com.imooc.mooo;
import java.text.SimpleDateFormat;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.imooc.R;
import com.imooc.mooo.ChatMessage.Type;
public class ChatMessageAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private List<ChatMessage> mDatas;
public ChatMessageAdapter(Context context, List<ChatMessage> mDatas) {
mInflater = LayoutInflater.from(context);
this.mDatas = mDatas;
}
@Override
public int getCount() {
return mDatas.size();
}
@Override
public Object getItem(int position) {
return mDatas.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemViewType(int position) {
ChatMessage chatMessage = mDatas.get(position);
if (chatMessage.getType() == Type.INCOMING) {
return 0;
}
return 1;
}
@Override
public int getViewTypeCount() {
return 2;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ChatMessage chatMessage = mDatas.get(position);
ViewHolder viewHolder = null;
if (convertView == null) {
// ͨ��ItemType���ò�ͬ�IJ���
if (getItemViewType(position) == 0) {
convertView = mInflater.inflate(R.layout.item_from_msg, parent,
false);
viewHolder = new ViewHolder();
viewHolder.mDate = (TextView) convertView
.findViewById(R.id.id_form_msg_date);
viewHolder.mMsg = (TextView) convertView
.findViewById(R.id.id_from_msg_info);
} else {
convertView = mInflater.inflate(R.layout.item_to_msg, parent,
false);
viewHolder = new ViewHolder();
viewHolder.mDate = (TextView) convertView
.findViewById(R.id.id_to_msg_date);
viewHolder.mMsg = (TextView) convertView
.findViewById(R.id.id_to_msg_info);
}
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
// 设置数据
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
viewHolder.mDate.setText(df.format(chatMessage.getDate()));
viewHolder.mMsg.setText(chatMessage.getMsg());
return convertView;
}
private final class ViewHolder {
TextView mDate;
TextView mMsg;
}
}
| [
"ahtchmz@163.com"
] | ahtchmz@163.com |
97da1718d134e03e84cce5f2ec3c8091e94ed879 | eb7414b9f90256bfb3a2d33e672b94fb40dd0e03 | /FtcRobotController/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/SteelHawksAutoBlue.java | f8bddf03e3cecdd07a35c348c4245b34d48b8771 | [
"BSD-3-Clause"
] | permissive | evilyou/baseftc201516 | c1c31d7688acf2686aadcc4eed439884c16cf5be | 7a65ef1f9641c904bbc797c1d460ee59ed3ac485 | refs/heads/master | 2020-04-05T18:29:56.451358 | 2016-04-20T19:54:43 | 2016-04-20T19:54:43 | 56,716,522 | 0 | 0 | null | 2016-04-20T19:48:43 | 2016-04-20T19:48:42 | null | UTF-8 | Java | false | false | 7,199 | java | /* Copyright (c) 2014 Qualcomm Technologies Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted (subject to the limitations in the disclaimer below) provided that
the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
Neither the name of Qualcomm Technologies Inc nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
package com.qualcomm.ftcrobotcontroller.opmodes;
import com.qualcomm.hardware.hitechnic.HiTechnicNxtDcMotorController;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorController;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.Range;
import com.qualcomm.robotcore.hardware.TouchSensor;
import java.util.Timer;
/**
* TeleOp Mode
* //<p>
* Enables control of the robot via the gamepad
*/
public class SteelHawksAutoBlue extends OpMode {
final static double CLIMBER_LEFT_MIN_RANGE = 0.35;
final static double CLIMBER_LEFT_MAX_RANGE = 1;
final static double CLIMBER_RIGHT_MIN_RANGE = 0;
final static double CLIMBER_RIGHT_MAX_RANGE = .45;
final static double WINCHHOOK_MIN_RANGE = 0;
final static double WINCHHOOK_MAX_RANGE = 1;
final static double CLIMBER_DUMP_MIN_RANGE = 0;
final static double CLIMBER_DUMP_MAX_RANGE = 0;
// position of the arm servo.
DcMotor motorRight; //driving
DcMotor motorLeft; //driving
DcMotor motorHarvester;
DcMotor motorShoulder;
DcMotor motorArm;
DcMotor motorWinch;
Servo climberLeft;
Servo climberRight;
Servo winchHook;
Servo climberDump;
boolean isTurboOnGamePad1;
boolean isTurboOnGamePad2;
double climberPositionLeft;
double climberPositionRight;
double winchHookPosition;
double climberDumpPosition;
final static double servoDelta = 0.01;
//variables for autonomous only
double motorPowerRight, motorPowerLeft;
boolean killTheBot;
/**
* Constructor - make sure the access keyword is public and is the same name as the class!
*/
public SteelHawksAutoBlue()
{
}
/*
* Code to run when the op mode is first enabled goes here
*/
@Override
public void init() {
/*
* Use the hardwareMap to get the dc motors and servos by name. Note
* that the names of the devices must match the names used when you
* configured your robot and created the configuration file.
*/
motorRight = hardwareMap.dcMotor.get("motorRight");
motorLeft = hardwareMap.dcMotor.get("motorLeft");
motorHarvester = hardwareMap.dcMotor.get("motorHarvester");
motorShoulder = hardwareMap.dcMotor.get("motorShoulder");
motorArm = hardwareMap.dcMotor.get("motorArm");
motorWinch = hardwareMap.dcMotor.get("motorWinch");
climberLeft = hardwareMap.servo.get("climberLeft");
climberRight = hardwareMap.servo.get("climberRight");
winchHook = hardwareMap.servo.get("winchHook");
climberDump = hardwareMap.servo.get("climberDump");
climberPositionLeft = 1.0;
climberPositionRight = 0.0;
winchHookPosition = 1.0;
climberDumpPosition = 0.0;
}
/*\\
* This method will be called repeatedly in a loop
*
* @see com.qualcomm.robotcore.eventloop.opmode.OpMode#run()
*/
@Override
public void loop() {
// if the code has not run, killTheBot will be false (default).
// This if statement will run the code since it was never run.
if (!killTheBot) {
// Time gone by: 0 - 1 sec
// Turn left for .5 sec
if (this.time <= 1) {
motorPowerRight = (0);
motorPowerLeft = (0.5);
}
// Time gone by: 1 - 2.5 sec
// Move forward for 2 sec
if (this.time > 1 && this.time <= 2.5) {
motorPowerRight = (1);
motorPowerLeft = (1);
}
// Time gone by: 2.6 - 3 sec
// Turn left for .5 sec
if (this.time > 2.5 && this.time <= 3.0) {
motorPowerRight = (0);
motorPowerLeft = (0.5);
}
// Time gone by: 3 to *whatever* sec
// Move forward until touch sensor is pressed
if (this.time > 3.0 && this.time <= 5.0) {
// Go forward, slower than before
motorPowerLeft = .75;
motorPowerRight = .75;
// If the touch sensor is pressed
}
if (this.time > 5.0) {
// Stop moving
motorPowerLeft = 0;
motorPowerRight = 0;
// This will stop the code from running again
killTheBot = true;
}
motorLeft.setPower(motorPowerLeft);
motorRight.setPower(motorPowerRight);
}
}
/*
* Send telemetry data back to driver station. Note that if we are using
* a legacy NXT-compatible motor controller, then the getPower() method
* will return a null value. The legacy NXT-compatible motor controllers
* are currently write only.
*/
///telemetry.addData("Text", "*** Robot Data***");
//telemetry.addData("left tgt pwr", "left pwr: " + String.format("%.2f", leftMotorPower));
//telemetry.addData("right tgt pwr", "right pwr: " + String.format("%.2f", rightMotorPower));
/*
* Code to run when the op mode is first disabled goes here
*
* @see com.qualcomm.robotcore.eventloop.opmode.OpMode#stop()
*/
@Override
public void stop() {
}
/*
* This method scales the joystick input so for low joystick values, the
* scaled value is less than linear. This is to make it easier to drive
* the robot more precisely at slower speeds.
*/
double scaleInput(double dVal) {
double[] scaleArray = { 0.0, 0.05, 0.09, 0.10, 0.12, 0.15, 0.18, 0.24,
0.30, 0.36, 0.43, 0.50, 0.60, 0.72, 0.85, 1.00, 1.00 };
// get the corresponding index for the scaleInput array.
int index = (int) (dVal * 16.0);
// index should be positive.
if (index < 0) {
index = -index;
}
// index cannot exceed size of array minus 1.
if (index > 16) {
index = 16;
}
// get value from the array.
double dScale = 0.0;
if (dVal < 0) {
dScale = -scaleArray[index];
} else {
dScale = scaleArray[index];
}
// return scaled value.
return dScale;
}
}
| [
"brian@bronxsoftware.org"
] | brian@bronxsoftware.org |
78eeda211af8c4932ee43a6c569c945f5b1dcce1 | 96f8d42c474f8dd42ecc6811b6e555363f168d3e | /baike/sources/qsbk/app/widget/bu.java | 1ea02312aa79cc82b8934f80cc7bb385f664b567 | [] | no_license | aheadlcx/analyzeApk | 050b261595cecc85790558a02d79739a789ae3a3 | 25cecc394dde4ed7d4971baf0e9504dcb7fabaca | refs/heads/master | 2020-03-10T10:24:49.773318 | 2018-04-13T09:44:45 | 2018-04-13T09:44:45 | 129,332,351 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package qsbk.app.widget;
import android.view.View;
import android.view.View.OnClickListener;
class bu implements OnClickListener {
final /* synthetic */ GroupDialog a;
bu(GroupDialog groupDialog) {
this.a = groupDialog;
}
public void onClick(View view) {
if (GroupDialog.b(this.a) != null) {
GroupDialog.b(this.a).onClick(this.a, -1);
}
this.a.dismiss();
}
}
| [
"aheadlcxzhang@gmail.com"
] | aheadlcxzhang@gmail.com |
c248f6a5cb8d3a07cc885f738021dce66ad1ec33 | c6f3ec60a5dce3dcd83450e92dfb01a3c8b4290c | /dina-datamodel/src/main/java/se/nrm/dina/datamodel/Splocalecontaineritem.java | ce0424f86eb1f14a2d880fad546aec727804e6cf | [] | no_license | idali0226/dina-data-services | a916b811dbfa29f2b2a935e674b62d47a0a584af | 94ddd3d1ec61af705c927f05b3bbefc80b73f14a | refs/heads/master | 2021-07-12T03:55:58.385592 | 2017-10-11T18:19:26 | 2017-10-11T18:19:26 | 106,522,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,412 | 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 se.nrm.dina.datamodel;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlIDREF;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import se.nrm.dina.datamodel.util.Util;
/**
*
* @author idali
*/
@Entity
@Table(name = "splocalecontaineritem")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Splocalecontaineritem.findAll", query = "SELECT s FROM Splocalecontaineritem s"),
@NamedQuery(name = "Splocalecontaineritem.findBySpLocaleContainerItemID", query = "SELECT s FROM Splocalecontaineritem s WHERE s.spLocaleContainerItemID = :spLocaleContainerItemID"),
@NamedQuery(name = "Splocalecontaineritem.findByFormat", query = "SELECT s FROM Splocalecontaineritem s WHERE s.format = :format"),
@NamedQuery(name = "Splocalecontaineritem.findByIsUIFormatter", query = "SELECT s FROM Splocalecontaineritem s WHERE s.isUIFormatter = :isUIFormatter"),
@NamedQuery(name = "Splocalecontaineritem.findByName", query = "SELECT s FROM Splocalecontaineritem s WHERE s.name = :name"),
@NamedQuery(name = "Splocalecontaineritem.findByPickListName", query = "SELECT s FROM Splocalecontaineritem s WHERE s.pickListName = :pickListName"),
@NamedQuery(name = "Splocalecontaineritem.findByType", query = "SELECT s FROM Splocalecontaineritem s WHERE s.type = :type"),
@NamedQuery(name = "Splocalecontaineritem.findByIsRequired", query = "SELECT s FROM Splocalecontaineritem s WHERE s.isRequired = :isRequired"),
@NamedQuery(name = "Splocalecontaineritem.findByWebLinkName", query = "SELECT s FROM Splocalecontaineritem s WHERE s.webLinkName = :webLinkName")})
public class Splocalecontaineritem extends BaseEntity {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "SpLocaleContainerItemID")
private Integer spLocaleContainerItemID;
@Column(name = "Format")
private String format;
@Basic(optional = false)
@NotNull
@Column(name = "IsHidden")
private boolean isHidden;
@Basic(optional = false)
@NotNull
@Column(name = "IsSystem")
private boolean isSystem;
@Column(name = "IsUIFormatter")
private Boolean isUIFormatter;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 64)
@Column(name = "Name")
private String name;
@Size(max = 64)
@Column(name = "PickListName")
private String pickListName;
@Size(max = 32)
@Column(name = "Type")
private String type;
@Column(name = "IsRequired")
private Boolean isRequired;
@Size(max = 32)
@Column(name = "WebLinkName")
private String webLinkName;
@OneToMany(mappedBy = "spLocaleContainerItemID", fetch = FetchType.LAZY)
private List<Spexportschemaitem> spexportschemaitemList;
@OneToMany(mappedBy = "spLocaleContainerItemDescID", fetch = FetchType.LAZY)
private List<Splocaleitemstr> splocaleitemstrList;
@OneToMany(mappedBy = "spLocaleContainerItemNameID", fetch = FetchType.LAZY)
private List<Splocaleitemstr> splocaleitemstrList1;
@JoinColumn(name = "ModifiedByAgentID", referencedColumnName = "AgentID")
@ManyToOne
private Agent modifiedByAgentID;
@JoinColumn(name = "CreatedByAgentID", referencedColumnName = "AgentID")
@ManyToOne
private Agent createdByAgentID;
@JoinColumn(name = "SpLocaleContainerID", referencedColumnName = "SpLocaleContainerID")
@ManyToOne(optional = false)
private Splocalecontainer spLocaleContainerID;
public Splocalecontaineritem() {
}
public Splocalecontaineritem(Integer spLocaleContainerItemID) {
this.spLocaleContainerItemID = spLocaleContainerItemID;
}
public Splocalecontaineritem(Integer spLocaleContainerItemID, Date timestampCreated, boolean isHidden, boolean isSystem, String name) {
this.spLocaleContainerItemID = spLocaleContainerItemID;
this.timestampCreated = timestampCreated;
this.isHidden = isHidden;
this.isSystem = isSystem;
this.name = name;
}
@XmlID
@XmlAttribute(name = "id")
@Override
public String getIdentityString() {
return Util.getInstance().getURLLink(this.getClass().getSimpleName()) + spLocaleContainerItemID;
}
@Override
public int getEntityId() {
return spLocaleContainerItemID;
}
public Integer getSpLocaleContainerItemID() {
return spLocaleContainerItemID;
}
public void setSpLocaleContainerItemID(Integer spLocaleContainerItemID) {
this.spLocaleContainerItemID = spLocaleContainerItemID;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public boolean getIsHidden() {
return isHidden;
}
public void setIsHidden(boolean isHidden) {
this.isHidden = isHidden;
}
public boolean getIsSystem() {
return isSystem;
}
public void setIsSystem(boolean isSystem) {
this.isSystem = isSystem;
}
public Boolean getIsUIFormatter() {
return isUIFormatter;
}
public void setIsUIFormatter(Boolean isUIFormatter) {
this.isUIFormatter = isUIFormatter;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPickListName() {
return pickListName;
}
public void setPickListName(String pickListName) {
this.pickListName = pickListName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Boolean getIsRequired() {
return isRequired;
}
public void setIsRequired(Boolean isRequired) {
this.isRequired = isRequired;
}
public String getWebLinkName() {
return webLinkName;
}
public void setWebLinkName(String webLinkName) {
this.webLinkName = webLinkName;
}
@XmlTransient
public List<Spexportschemaitem> getSpexportschemaitemList() {
return spexportschemaitemList;
}
public void setSpexportschemaitemList(List<Spexportschemaitem> spexportschemaitemList) {
this.spexportschemaitemList = spexportschemaitemList;
}
@XmlTransient
public List<Splocaleitemstr> getSplocaleitemstrList() {
return splocaleitemstrList;
}
public void setSplocaleitemstrList(List<Splocaleitemstr> splocaleitemstrList) {
this.splocaleitemstrList = splocaleitemstrList;
}
@XmlTransient
public List<Splocaleitemstr> getSplocaleitemstrList1() {
return splocaleitemstrList1;
}
public void setSplocaleitemstrList1(List<Splocaleitemstr> splocaleitemstrList1) {
this.splocaleitemstrList1 = splocaleitemstrList1;
}
@XmlIDREF
public Agent getModifiedByAgentID() {
return modifiedByAgentID;
}
public void setModifiedByAgentID(Agent modifiedByAgentID) {
this.modifiedByAgentID = modifiedByAgentID;
}
@XmlIDREF
public Agent getCreatedByAgentID() {
return createdByAgentID;
}
public void setCreatedByAgentID(Agent createdByAgentID) {
this.createdByAgentID = createdByAgentID;
}
@XmlIDREF
public Splocalecontainer getSpLocaleContainerID() {
return spLocaleContainerID;
}
public void setSpLocaleContainerID(Splocalecontainer spLocaleContainerID) {
this.spLocaleContainerID = spLocaleContainerID;
}
@Override
public int hashCode() {
int hash = 0;
hash += (spLocaleContainerItemID != null ? spLocaleContainerItemID.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Splocalecontaineritem)) {
return false;
}
Splocalecontaineritem other = (Splocalecontaineritem) object;
return !((this.spLocaleContainerItemID == null && other.spLocaleContainerItemID != null) || (this.spLocaleContainerItemID != null && !this.spLocaleContainerItemID.equals(other.spLocaleContainerItemID)));
}
@Override
public String toString() {
return "se.nrm.dina.datamodel.Splocalecontaineritem[ spLocaleContainerItemID=" + spLocaleContainerItemID + " ]";
}
}
| [
"ida.li@nrm.se"
] | ida.li@nrm.se |
3b081e81a5c193d5cef777429c0bff31281a137d | 342379b0e7a0572860158a34058dfad1c8944186 | /core/src/test/java/com/vladmihalcea/hpjp/hibernate/query/hierarchical/TreeTest.java | 5e2a4bf1330eb2ff3d37f50f8bd0662b10e82b0f | [
"Apache-2.0"
] | permissive | vladmihalcea/high-performance-java-persistence | 80a20e67fa376322f5b1c5eddf75758b29247a2a | acef7e84e8e2dff89a6113f007eb7656bc6bdea4 | refs/heads/master | 2023-09-01T03:43:41.263446 | 2023-08-31T14:44:54 | 2023-08-31T14:44:54 | 44,294,727 | 1,211 | 518 | Apache-2.0 | 2023-07-21T19:06:38 | 2015-10-15T04:57:57 | Java | UTF-8 | Java | false | false | 885 | java | package com.vladmihalcea.hpjp.hibernate.query.hierarchical;
import org.hibernate.*;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* @author Vlad Mihalcea
*/
public class TreeTest extends AbstractTreeTest {
@Test
public void test() {
List<PostComment> comments = doInJPA(entityManager -> {
return (List<PostComment>) entityManager
.unwrap(Session.class)
.createQuery(
"SELECT c " +
"FROM PostComment c " +
"WHERE c.status = :status")
.setParameter("status", Status.APPROVED)
.setResultTransformer(PostCommentTreeTransformer.INSTANCE)
.getResultList();
});
assertEquals(2, comments.size());
}
}
| [
"mihalcea.vlad@gmail.com"
] | mihalcea.vlad@gmail.com |
5938eeb3193c289ffcdf6496b16584082f9af2fb | b64bf7f7394854681fc287318061a2d871426846 | /src/main/java/com/c2/template/service/FacultyService.java | c627bdfda2b3a2fa08e78f4d11124bcfdcddcee6 | [] | no_license | vivektiwaricct/csquare | 6380ed093ebc2df0a4a57e496d269573e7ae46d7 | e88c7f60c4c05a4efa7201082a1cedd5574f4822 | refs/heads/master | 2021-01-22T01:10:20.058843 | 2017-09-22T15:40:30 | 2017-09-22T15:40:30 | 102,199,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.c2.template.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.c2.template.auth.repository.FacultyRepository;
import com.c2.template.entities.Faculty;
@Service
public class FacultyService {
@Autowired
private FacultyRepository facultyRepository;
public void registerFaculty(Faculty faculty) {
facultyRepository.save(faculty);
}
}
| [
"vivek.tiwari1@yatra.com"
] | vivek.tiwari1@yatra.com |
7abaded15f765e13715880104108e5252ba43f0f | caa125234a3c3e8fff496a9d4e11f49ac7701309 | /main/java/com/maywide/biz/prd/entity/Salespkg.java | f7b3d4b61a40d77ff2162461236d9a96182d0e41 | [] | no_license | lisongkang/my-first-project-for-revcocomcmms | 1885f49fa1a7ef8686c3d8b7d9b5a50585bb3b8d | 6079a3d9d24bd44ae3af24dc603846d460910f3b | refs/heads/master | 2022-05-01T16:34:20.261009 | 2022-04-18T13:55:04 | 2022-04-18T13:55:04 | 207,246,589 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,421 | java | package com.maywide.biz.prd.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.domain.Persistable;
import com.maywide.core.entity.PersistableEntity;
@Entity
@Table(name = "PRD_SALESPKG")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Salespkg extends PersistableEntity<Long> implements Persistable<Long> {
private Long id;
private String salespkgcode;
private String salespkgname;
private String sclass;
private String ssubclass;
private String bizcode;
private Double sums;
private String hotflag;
private java.util.Date sdate;
private java.util.Date edate;
private Long appnums;
private String status;
private String feecode;
private String ifeecode;
private String rfeecode;
private String scopeflag;
private Long createoper;
private java.util.Date createtime;
private Long updateoper;
private java.util.Date updatetime;
private String memo;
private String ordertype;
private String areas;
private String isshowpost; // �Ƿ���ʾ����˳����-��
private String pkgtype; //Ӫ������
private String postflag;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "SALESPKGID")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Transient
public String getDisplay() {
return salespkgname;
}
@Column(name = "SALESPKGCODE", nullable = false, unique = false, insertable = true, updatable = true)
public String getSalespkgcode() {
return salespkgcode;
}
public void setSalespkgcode(String salespkgcode) {
this.salespkgcode = salespkgcode;
}
@Column(name = "SALESPKGNAME", nullable = false, unique = false, insertable = true, updatable = true)
public String getSalespkgname() {
return salespkgname;
}
public void setSalespkgname(String salespkgname) {
this.salespkgname = salespkgname;
}
@Column(name = "SCLASS", nullable = false, unique = false, insertable = true, updatable = true)
public String getSclass() {
return sclass;
}
public void setSclass(String sclass) {
this.sclass = sclass;
}
@Column(name = "SSUBCLASS", nullable = false, unique = false, insertable = true, updatable = true)
public String getSsubclass() {
return ssubclass;
}
public void setSsubclass(String ssubclass) {
this.ssubclass = ssubclass;
}
@Column(name = "BIZCODE", nullable = false, unique = false, insertable = true, updatable = true)
public String getBizcode() {
return bizcode;
}
public void setBizcode(String bizcode) {
this.bizcode = bizcode;
}
@Column(name = "SUMS", nullable = true, unique = false, insertable = true, updatable = true)
public Double getSums() {
return sums;
}
public void setSums(Double sums) {
this.sums = sums;
}
@Column(name = "HOTFLAG", nullable = false, unique = false, insertable = true, updatable = true)
public String getHotflag() {
return hotflag;
}
public void setHotflag(String hotflag) {
this.hotflag = hotflag;
}
@Column(name = "SDATE", nullable = false, unique = false, insertable = true, updatable = true)
public java.util.Date getSdate() {
return sdate;
}
public void setSdate(java.util.Date sdate) {
this.sdate = sdate;
}
@Column(name = "EDATE", nullable = false, unique = false, insertable = true, updatable = true)
public java.util.Date getEdate() {
return edate;
}
public void setEdate(java.util.Date edate) {
this.edate = edate;
}
@Column(name = "APPNUMS", nullable = false, unique = false, insertable = true, updatable = true)
public Long getAppnums() {
return appnums;
}
public void setAppnums(Long appnums) {
this.appnums = appnums;
}
@Column(name = "STATUS", nullable = false, unique = false, insertable = true, updatable = true)
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Column(name = "FEECODE", nullable = true, unique = false, insertable = true, updatable = true)
public String getFeecode() {
return feecode;
}
public void setFeecode(String feecode) {
this.feecode = feecode;
}
@Column(name = "IFEECODE", nullable = true, unique = false, insertable = true, updatable = true)
public String getIfeecode() {
return ifeecode;
}
public void setIfeecode(String ifeecode) {
this.ifeecode = ifeecode;
}
@Column(name = "RFEECODE", nullable = true, unique = false, insertable = true, updatable = true)
public String getRfeecode() {
return rfeecode;
}
public void setRfeecode(String rfeecode) {
this.rfeecode = rfeecode;
}
@Column(name = "SCOPEFLAG", nullable = false, unique = false, insertable = true, updatable = true)
public String getScopeflag() {
return scopeflag;
}
public void setScopeflag(String scopeflag) {
this.scopeflag = scopeflag;
}
@Column(name = "CREATEOPER", nullable = false, unique = false, insertable = true, updatable = true)
public Long getCreateoper() {
return createoper;
}
public void setCreateoper(Long createoper) {
this.createoper = createoper;
}
@Column(name = "CREATETIME", nullable = false, unique = false, insertable = true, updatable = true)
public java.util.Date getCreatetime() {
return createtime;
}
public void setCreatetime(java.util.Date createtime) {
this.createtime = createtime;
}
@Column(name = "UPDATEOPER", nullable = false, unique = false, insertable = true, updatable = true)
public Long getUpdateoper() {
return updateoper;
}
public void setUpdateoper(Long updateoper) {
this.updateoper = updateoper;
}
@Column(name = "UPDATETIME", nullable = false, unique = false, insertable = true, updatable = true)
public java.util.Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(java.util.Date updatetime) {
this.updatetime = updatetime;
}
@Column(name = "MEMO", nullable = true, unique = false, insertable = true, updatable = true)
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
@Column(name = "ORDERTYPE", nullable = true, unique = false, insertable = true, updatable = true)
public String getOrdertype() {
return ordertype;
}
public void setOrdertype(String ordertype) {
this.ordertype = ordertype;
}
@Column(name = "AREAS", nullable = true, unique = false, insertable = true, updatable = true)
public String getAreas() {
return areas;
}
public void setAreas(String areas) {
this.areas = areas;
}
@Column(name = "ISSHOWPOST", nullable = true, unique = false, insertable = true, updatable = true)
public String getIsshowpost() {
return isshowpost;
}
@Column(name= "POSTFLAG", nullable = true, unique = false, insertable = true, updatable = true)
public String getPostflag() {
return postflag;
}
public void setPostflag(String postflag) {
this.postflag = postflag;
}
public void setIsshowpost(String isshowpost) {
this.isshowpost = isshowpost;
}
@Column(name = "PKGTYPE", nullable = true, unique = false, insertable = true, updatable = true)
public String getPkgtype() {
return pkgtype;
}
public void setPkgtype(String pkgtype) {
this.pkgtype = pkgtype;
}
}
| [
"1223128449@qq.com"
] | 1223128449@qq.com |
6937895455fd8c32b0ea35d702804bad336fcbe8 | 2ebde2efb44aa4afe1fe2e167adf01dc0c4f8304 | /work/decompile-1be99b59/net/minecraft/server/LocaleLanguage.java | 8fe8e28aa3cd1164c00c059256da91cb0582d63d | [] | no_license | channing173/bukkitserver | 49a1b782b3b96c0c2bdaf23e53b850fce490e833 | d7eadbbbe45f0a58e9c73ece902f3e6bb1a43e84 | refs/heads/master | 2020-05-20T16:02:58.495191 | 2019-07-22T23:28:02 | 2019-07-22T23:28:02 | 185,651,406 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,306 | java | package net.minecraft.server;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class LocaleLanguage {
private static final Logger LOGGER = LogManager.getLogger();
private static final Pattern b = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]");
private static final LocaleLanguage c = new LocaleLanguage();
private final Map<String, String> d = Maps.newHashMap();
private long e;
public LocaleLanguage() {
try {
InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
JsonElement jsonelement = (JsonElement) (new Gson()).fromJson(new InputStreamReader(inputstream, StandardCharsets.UTF_8), JsonElement.class);
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "strings");
Iterator iterator = jsonobject.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, JsonElement> entry = (Entry) iterator.next();
String s = LocaleLanguage.b.matcher(ChatDeserializer.a((JsonElement) entry.getValue(), (String) entry.getKey())).replaceAll("%$1s");
this.d.put(entry.getKey(), s);
}
this.e = SystemUtils.getMonotonicMillis();
} catch (JsonParseException jsonparseexception) {
LocaleLanguage.LOGGER.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", jsonparseexception);
}
}
public static LocaleLanguage a() {
return LocaleLanguage.c;
}
public synchronized String a(String s) {
return this.c(s);
}
private String c(String s) {
String s1 = (String) this.d.get(s);
return s1 == null ? s : s1;
}
public synchronized boolean b(String s) {
return this.d.containsKey(s);
}
public long b() {
return this.e;
}
}
| [
"willi7cg@dukes.jmu.edu"
] | willi7cg@dukes.jmu.edu |
f6e3042100746e0ae6901ecae35fc5475069f4a9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/6/6_89f7ab3e12da5cc652a5b56395fb7624db1ae63d/TransactionContextImpl/6_89f7ab3e12da5cc652a5b56395fb7624db1ae63d_TransactionContextImpl_s.java | a41bb1e6708b41d8679842fab2e8688b89f18e62 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,744 | java | /*
* Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.transaction.impl;
import com.hazelcast.collection.CollectionProxyId;
import com.hazelcast.collection.CollectionProxyType;
import com.hazelcast.collection.CollectionService;
import com.hazelcast.collection.list.ObjectListProxy;
import com.hazelcast.collection.set.ObjectSetProxy;
import com.hazelcast.core.*;
import com.hazelcast.map.MapService;
import com.hazelcast.queue.QueueService;
import com.hazelcast.spi.TransactionalService;
import com.hazelcast.spi.impl.NodeEngineImpl;
import com.hazelcast.transaction.*;
import java.util.HashMap;
import java.util.Map;
/**
* @author mdogan 2/26/13
*/
final class TransactionContextImpl implements TransactionContext {
private final NodeEngineImpl nodeEngine;
private final TransactionImpl transaction;
private final Map<TransactionalObjectKey, TransactionalObject> txnObjectMap = new HashMap<TransactionalObjectKey, TransactionalObject>(2);
TransactionContextImpl(TransactionManagerServiceImpl transactionManagerService, NodeEngineImpl nodeEngine,
TransactionOptions options, String ownerUuid) {
this.nodeEngine = nodeEngine;
this.transaction = new TransactionImpl(transactionManagerService, nodeEngine, options, ownerUuid);
}
public String getTxnId() {
return transaction.getTxnId();
}
public void beginTransaction() {
transaction.begin();
}
public void commitTransaction() throws TransactionException {
if (transaction.getTransactionType().equals(TransactionOptions.TransactionType.TWO_PHASE)) {
transaction.prepare();
}
transaction.commit();
}
public void rollbackTransaction() {
transaction.rollback();
}
@SuppressWarnings("unchecked")
public <K, V> TransactionalMap<K, V> getMap(String name) {
return (TransactionalMap<K, V>) getTransactionalObject(MapService.SERVICE_NAME, name);
}
@SuppressWarnings("unchecked")
public <E> TransactionalQueue<E> getQueue(String name) {
return (TransactionalQueue<E>) getTransactionalObject(QueueService.SERVICE_NAME, name);
}
@SuppressWarnings("unchecked")
public <K, V> TransactionalMultiMap<K, V> getMultiMap(String name) {
return (TransactionalMultiMap<K, V>) getTransactionalObject(CollectionService.SERVICE_NAME, new CollectionProxyId(name, null, CollectionProxyType.MULTI_MAP));
}
@SuppressWarnings("unchecked")
public <E> TransactionalList<E> getList(String name) {
return (TransactionalList<E>) getTransactionalObject(CollectionService.SERVICE_NAME, new CollectionProxyId(ObjectListProxy.COLLECTION_LIST_NAME, name, CollectionProxyType.LIST));
}
@SuppressWarnings("unchecked")
public <E> TransactionalSet<E> getSet(String name) {
return (TransactionalSet<E>) getTransactionalObject(CollectionService.SERVICE_NAME, new CollectionProxyId(ObjectSetProxy.COLLECTION_SET_NAME, name, CollectionProxyType.SET));
}
@SuppressWarnings("unchecked")
public TransactionalObject getTransactionalObject(String serviceName, Object id) {
if (transaction.getState() != Transaction.State.ACTIVE) {
throw new TransactionNotActiveException("No transaction is found while accessing " +
"transactional object -> " + serviceName + "[" + id + "]!");
}
TransactionalObjectKey key = new TransactionalObjectKey(serviceName, id);
TransactionalObject obj = txnObjectMap.get(key);
if (obj == null) {
final Object service = nodeEngine.getService(serviceName);
if (service instanceof TransactionalService) {
nodeEngine.getProxyService().initializeDistributedObject(serviceName, id);
obj = ((TransactionalService) service).createTransactionalObject(id, transaction);
txnObjectMap.put(key, obj);
} else {
throw new IllegalArgumentException("Service[" + serviceName + "] is not transactional!");
}
}
return obj;
}
Transaction getTransaction() {
return transaction;
}
private class TransactionalObjectKey {
private final String serviceName;
private final Object id;
TransactionalObjectKey(String serviceName, Object id) {
this.serviceName = serviceName;
this.id = id;
}
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TransactionalObjectKey)) return false;
TransactionalObjectKey that = (TransactionalObjectKey) o;
if (!id.equals(that.id)) return false;
if (!serviceName.equals(that.serviceName)) return false;
return true;
}
public int hashCode() {
int result = serviceName.hashCode();
result = 31 * result + id.hashCode();
return result;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b801930f47afcc8f89f2fbd2963723321d712552 | f2288b819e032cdb0dad1126d7500cff55065d7e | /src/test/java/SeleniumCodingPractice/Proxy1.java | 05a1a73cc391c83fb50904fe18e83b7979c4e40d | [] | no_license | rajesh9487git/LatestProject | 30e4a4ab2033a11137289dabe8f57ed8196bbe81 | 3a1b458a63e116805202473afaf1acdbb361c5c1 | refs/heads/master | 2022-07-05T17:17:20.938323 | 2020-12-29T10:21:44 | 2020-12-29T10:21:44 | 200,613,194 | 0 | 0 | null | 2022-06-29T17:57:26 | 2019-08-05T08:19:25 | Java | UTF-8 | Java | false | false | 659 | java | package SeleniumCodingPractice;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class Proxy1 {
public static void main(String[] args) {
Proxy p = new Proxy();
p.setHttpProxy("localhost:7777");
DesiredCapabilities ch= DesiredCapabilities.chrome();
ch.setCapability(CapabilityType.PROXY, p);
ChromeOptions options = new ChromeOptions();
options.merge(ch);
WebDriver driver = new ChromeDriver(options);
}
}
| [
"raora9487@gmail.com"
] | raora9487@gmail.com |
faff8f3948e24fea97261c29142df09d1ba6f928 | 4a22526c2acde105b19301b84d65877acf0e3846 | /src/main/java/com/ectrl/authentication/dto/MqttWpapskDTO.java | 1cdb75cd4ef76836a1652a3393ccf48714fd43b9 | [] | no_license | 942292801/authentication | 48a238fe33e39e0ec51f6c4bfaccbcaddbf50155 | b9e62a0403238131c6f75d3001b2a0f7329de4cb | refs/heads/master | 2022-12-07T09:05:19.950849 | 2020-04-10T02:51:09 | 2020-04-10T02:51:09 | 241,246,171 | 1 | 0 | null | 2022-11-16T00:47:04 | 2020-02-18T01:33:47 | Java | UTF-8 | Java | false | false | 416 | java | package com.ectrl.authentication.dto;
import lombok.Data;
import java.io.Serializable;
/**
*@Author: Wen zhenwei
*@date: 2020/3/13 14:42
*@Description: 公私钥匙传输对象
*@Param:
*@return:
*/
@Data
public class MqttWpapskDTO implements Serializable {
/** serverName */
private String serverName;
/** wpapsk */
private String wpapsk;
/** publicKey */
private String publicKey;
}
| [
"942292801@qq.com"
] | 942292801@qq.com |
0f6e4b4bcb3ad81b8916768029985af8956cc4b7 | 894242e097699fe38cde3cfd312c04040d34ec3e | /javafx_test/src/module-info.java | 5d01bbd4611f25c08155751a424ce3d13db2a208 | [] | no_license | hiwebhi/web0714 | 500c11bbc819869a95a63b477bc00e8862f153e3 | 6a8d1c1a8d922aaae228bd45cb90ff149d50fb7a | refs/heads/master | 2023-08-11T12:54:06.783139 | 2021-10-05T06:27:06 | 2021-10-05T06:27:06 | 401,337,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 109 | java | module javafx_test {
requires javafx.controls;
opens application to javafx.graphics, javafx.fxml;
}
| [
"gpqls@DESKTOP-3ALHJSJ"
] | gpqls@DESKTOP-3ALHJSJ |
20d94180771ff7a0e3bcc523d4f56a1c7c04e66a | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project93/src/test/java/org/gradle/test/performance93_4/Test93_317.java | e64551c79e809fae0c96729b78fffd1ccd48a7d4 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 292 | java | package org.gradle.test.performance93_4;
import static org.junit.Assert.*;
public class Test93_317 {
private final Production93_317 production = new Production93_317("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
6c36a832fdce45d134b5608bb84f8559f54a62fb | 195c9b6058f42bb6e68a32893c14a0f6d0b8072a | /src/main/java/com/sonymm/bxwtfk/util/Charsets.java | feb63721886af473acb4554f7f3999a0c47b17ab | [] | no_license | suojingxi/yy02-bxwtfk | 8e5780957af91f36f0a4cd896750c3d243b4695a | b789a5c4ec0406fa08f0a789a4547c9242afa9be | refs/heads/master | 2021-01-21T13:14:19.571067 | 2016-05-31T04:03:15 | 2016-05-31T04:03:15 | 55,945,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 941 | java | package com.sonymm.bxwtfk.util;
import java.io.UnsupportedEncodingException;
/**
* 字符编码
*
* @author haoxw
* @since 2011-8-16
*/
public enum Charsets {
GBK("GBK"), UTF8("UTF-8");
public final String encoding;
private Charsets(String value) {
this.encoding = value;
}
public String toString(byte[] bytes) {
return toString(bytes, encoding);
}
public byte[] getBytes(String s) {
return getBytes(s, encoding);
}
public static byte[] getBytes(String s, String encoding) {
try {
return s.getBytes(encoding);
} catch (UnsupportedEncodingException e) {
return s.getBytes();
}
}
public static String toString(byte[] bytes, String encoding) {
try {
return new String(bytes, encoding);
} catch (UnsupportedEncodingException e) {
return new String(bytes);
}
}
}
| [
"1466200463@qq.com"
] | 1466200463@qq.com |
eea37752d6448bba0988f977fb91557dd5960980 | c670fe9624e7490e262e90716145fe1f966a9f60 | /app_tms_required/src/main/java/tms/space/lbs_driver/tms_required/business_person/PersonalVh.java | f542dafb5f0aa4cbc31ec3bf0c19088d7bc67cd9 | [] | no_license | 15608447849/lbs_driver | 8c747a15ae43555840c75dc8f168fa14fa54b949 | f675232d5f51def0cad386c7cfa4574149d8ba49 | refs/heads/master | 2020-03-27T17:38:12.646649 | 2018-12-25T09:48:54 | 2018-12-25T09:48:54 | 146,863,268 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package tms.space.lbs_driver.tms_required.business_person;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import com.leezp.lib.viewholder.annotations.RidClass;
import tms.space.lbs_driver.tms_base.recycler.FragmentRecycleViewHolderAbs;
import tms.space.lbs_driver.tms_base.viewholder.base.IncRecyclerView;
import tms.space.lbs_driver.tms_required.R;
/**
* Created by Leeping on 2018/7/25.
* email: 793065165@qq.com
*/
@RidClass(R.id.class)
public class PersonalVh extends FragmentRecycleViewHolderAbs {
public IncRecyclerView list;
public PersonalVh(Context context) {
super(context, R.layout.frg_person);
}
@Override
public RecyclerView getRecyclerView() {
return list.recycler;
}
}
| [
"793065165@qq.com"
] | 793065165@qq.com |
b7769537c417ac5debe8607a0b52ec4cb6fe188d | c20faa8aa41496e3002f212f9c43a6bcf06c8f47 | /transaction-manager/src/test/java/com/thh/tpc/transactionmanager/service/LogRecordRepositoryTest.java | 662c8bf1246e9dc06e080954ad5233e5d9f8039c | [] | no_license | lianbian/2pc_code | e96a8d4a5fa158dbfcc7d69a774b305bcc838947 | eff078315b52b791e18bdcef3db50ceffb8eee50 | refs/heads/master | 2023-08-21T12:53:05.584964 | 2021-09-23T03:04:46 | 2021-09-23T03:04:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,562 | java | package com.thh.tpc.transactionmanager.service;
import com.thh.tpc.protocol.domain.LogRecordEntity;
import com.thh.tpc.protocol.domain.TransactionStatus;
import com.thh.tpc.protocol.service.LogRecordRepository;
import com.thh.tpc.protocol.util.TransactionIdGenerator;
import com.thh.tpc.transactionmanager.TestBase;
import org.junit.Test;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author daidai@yiji.com
*/
public class LogRecordRepositoryTest extends TestBase{
private LogRecordRepository logRecordRepository;
private static final String id = TransactionIdGenerator.getTransactionId();
@Test
public void testFindOne() throws Exception {
final LogRecordEntity logRecordEntity = new LogRecordEntity();
logRecordEntity.setTransactionId(id);
logRecordEntity.setStatus(TransactionStatus.Start2PC);
logRecordEntity.setCreateTime(new Timestamp(new Date().getTime()));
logRecordEntity.setLastModifyTime(new Timestamp(new Date().getTime()));
logRecordRepository.save(logRecordEntity);
final LogRecordEntity one = logRecordRepository.findOne(id);
assertThat(one).isNotNull();
final List<LogRecordEntity> byStatusIn = logRecordRepository.findByStatusInAndCreateTimeLessThan(
Arrays.asList(TransactionStatus.Start2PC, TransactionStatus.No), new Timestamp(System.currentTimeMillis()));
assertThat(byStatusIn).isNotEmpty();
}
} | [
"daidai@yiji.com"
] | daidai@yiji.com |
4220d61f2935fe6dc4d6148d751c73057d0983b0 | 98b1622addbf4e96dffd9998b6378c6f10b76cc8 | /src/main/java/leetcode/hash/ValidSudoku.java | c4aa33fe151a4bdd5275930676a83b4a56986722 | [] | no_license | huangqian/Algorithms | 3150de410a2a3f8e7f25370d23b8fb33ea949955 | 6c383a7adb2013fda17fd5106b19041509401353 | refs/heads/master | 2021-07-12T02:21:37.660709 | 2020-06-12T01:49:04 | 2020-06-12T01:49:04 | 61,378,433 | 0 | 0 | null | 2021-03-31T22:03:06 | 2016-06-17T14:11:19 | Java | UTF-8 | Java | false | false | 3,256 | java | package leetcode.hash;
/**
* @author huangqian
* @version 1.0.0
* @time 2020/6/11 - 11:41
* @description: 36. 有效的数独
* <pre>
* 判断一个 9x9 的数独是否有效。只需要根据以下规则,验证已经填入的数字是否有效即可。
*
* 数字 1-9 在每一行只能出现一次。
* 数字 1-9 在每一列只能出现一次。
* 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。
*
*
* 上图是一个部分填充的有效的数独。
*
* 数独部分空格内已填入了数字,空白格用 '.' 表示。
*
* 示例 1:
*
* 输入:
* [
* ["5","3",".",".","7",".",".",".","."],
* ["6",".",".","1","9","5",".",".","."],
* [".","9","8",".",".",".",".","6","."],
* ["8",".",".",".","6",".",".",".","3"],
* ["4",".",".","8",".","3",".",".","1"],
* ["7",".",".",".","2",".",".",".","6"],
* [".","6",".",".",".",".","2","8","."],
* [".",".",".","4","1","9",".",".","5"],
* [".",".",".",".","8",".",".","7","9"]
* ]
* 输出: true
* 示例 2:
*
* 输入:
* [
* ["8","3",".",".","7",".",".",".","."],
* ["6",".",".","1","9","5",".",".","."],
* [".","9","8",".",".",".",".","6","."],
* ["8",".",".",".","6",".",".",".","3"],
* ["4",".",".","8",".","3",".",".","1"],
* ["7",".",".",".","2",".",".",".","6"],
* [".","6",".",".",".",".","2","8","."],
* [".",".",".","4","1","9",".",".","5"],
* [".",".",".",".","8",".",".","7","9"]
* ]
* 输出: false
* 解释: 除了第一行的第一个数字从 5 改为 8 以外,空格内其他数字均与 示例1 相同。
* 但由于位于左上角的 3x3 宫内有两个 8 存在, 因此这个数独是无效的。
* 说明:
*
* 一个有效的数独(部分已被填充)不一定是可解的。
* 只需要根据以上规则,验证已经填入的数字是否有效即可。
* 给定数独序列只包含数字 1-9 和字符 '.' 。
* 给定数独永远是 9x9 形式的。
*
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/valid-sudoku
* </pre>
*/
public class ValidSudoku {
public boolean isValidSudoku(char[][] board) {
if (board == null || board.length != 9) return false;
int[] map = new int[9];
for (int row = 0; row < 9; row++) {
//不是9X9的看板,不合法
if (board[row] == null || board[row].length != 9) return false;
for (int column = 0; column < 9; column++) {
int key = board[row][column] - '1';
//验证数字是否合法
if (key >= 0 && key <= 8) {
int index = (1 << column) //最低9位存储列编号
| (1 << (row + 9)) //中间9位存放行号
| (1 << (column / 3 + row / 3 * 3 + 18)); //z为宫格区域内序号
int old = map[key];
if ((old & index) == 0) { //无重复,则按位或,加入位集合
map[key] = old | index;
} else { //有重复
return false;
}
}
}
}
return true;
}
}
| [
"huangqian866@163.com"
] | huangqian866@163.com |
d7f4b936dd4bba3f31238411b5791eaf5973ce96 | 188ed38eee8b6492d3a3b8d3d15533f745126126 | /src/main/java/com/hvn/velocity/repository/MemberDao.java | 4aa26b511f3fd0f667bef6e1ad70e8e516205409 | [] | no_license | RetinaInc/affablebean-spring-tutorial | 9435f4259d197f0942e6277669c7f5c26c10d714 | 67132a53d27ef88df28393f7d33bc5f3670f26d0 | refs/heads/master | 2021-01-22T17:23:04.731629 | 2014-11-23T09:21:38 | 2014-11-23T09:21:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package com.hvn.velocity.repository;
import java.util.List;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.hvn.velocity.domain.Member;
@Repository
public class MemberDao {
@Autowired
private SessionFactory sessionFactory;
public List<Member> findAll() {
return sessionFactory.getCurrentSession().createQuery("from Member").list();
}
public Member findByUsername(String username) {
Member member = (Member) sessionFactory.getCurrentSession()
.createCriteria(Member.class)
.add(Restrictions.eq("username", username))
.uniqueResult(); // note: we can add many Restrictions, refer Hibernate querying
return member;
}
}
| [
"tony.wu90@yahoo.com"
] | tony.wu90@yahoo.com |
e7f72b9d93d8e6570a64083f6b6aa4788b5f1146 | 39111d4db92c7650fc188df422a92616978df427 | /JavaExceptionHandling.java | 4902650da632171b70633199a04ccd9f36e05857 | [] | no_license | aadya28/HackerRank | 6e7911c0dff25e786e255eecf694eb0116d14bb9 | 173b3669df14b83d7fd280e7f3c92f89dbb29b55 | refs/heads/main | 2023-06-12T17:10:34.258087 | 2023-06-10T16:39:08 | 2023-06-10T16:39:08 | 623,036,709 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 966 | java | //Program to solve HackerRank problem Java Exception Handling.
import java.util.Scanner;
class PowerCalculator {
public long power(int n,int p) throws Exception {
if(n==0 && p==0){
throw new Exception("n and p should not be zero.");
}
else if(n<0 || p<0){
throw new Exception("n or p should not be negative.");
}
else{
return (long)Math.pow(n,p);
}
}
}
public class JavaExceptionHandling {
public static final PowerCalculator power_calculator = new PowerCalculator();
public static final Scanner in = new Scanner(System.in);
public static void main(String[] args) {
while (in.hasNextInt()) {
int n = in.nextInt();
int p = in.nextInt();
try {
System.out.println(power_calculator.power(n, p));
} catch (Exception e) {
System.out.println(e);
}
}
}
} | [
"aadya28.srivastava@gmail.com"
] | aadya28.srivastava@gmail.com |
1f6b98b5ef72a38327fe4c917dcb4cee5948bbab | 26f33890053eb146751df8e62b613fdc3e4e7e0e | /app/src/main/java/com/example/newtechnologies/MenuActivity.java | 8f48bb418a57a3e1157e9196403739515d2a12d3 | [] | no_license | max1call/NewTechnologies | 4c6640f20903b04ad597ce9f514965788efd7d8e | f24b3b4f60be5c1349ad62b31830b2cbe11c3f57 | refs/heads/master | 2021-09-06T19:18:22.833243 | 2018-02-10T09:38:57 | 2018-02-10T09:38:57 | 119,138,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,295 | java | package com.example.newtechnologies;
import android.app.Activity;
import android.content.Intent;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
import java.io.IOException;
public class MenuActivity extends Activity implements SoundPool.OnLoadCompleteListener {
// ToggleButton btn_new;
final int MAX_STREAM = 5;
private SoundPool sp;
// private AssetManager assetManager;
int idBgMusic, idJumpSound, idWinSound;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_layout);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
sp = new SoundPool(MAX_STREAM, AudioManager.STREAM_MUSIC, 0);
sp.setOnLoadCompleteListener(this);
idJumpSound = sp.load(this, R.raw.a, 1);
idWinSound = sp.load(this, R.raw.egor, 1);
idBgMusic = loadSound("muz.wav");
Log.d("war", "idBgMusic= "+idBgMusic);
// btn_new = (ToggleButton) findViewById(R.id.btn_new);
}
public void newGame(View v){
Intent intent = new Intent(MenuActivity.this, MainActivity.class);
startActivity(intent);
}
private int loadSound(String fileName) {
int idLoad = -1;
try {
idLoad = sp.load(getAssets().openFd(fileName), 1);
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Не могу загрузить файл " + fileName,
Toast.LENGTH_SHORT).show();
return -1;
}
return idLoad;
}
public void onClick(View view){
sp.play(idBgMusic, 1, 1, 0, 0, 1);
}
public void onClick2(View view){
sp.play(idJumpSound, 1, 1, 0, 0, 1);
}
public void onClick3(View view){
sp.play(idWinSound, 1, 1, 1, 2, 1);
}
@Override
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
Log.d("war", "onLoadComplete, sampleId = " + sampleId + ", status = " + status);
}
}
| [
"max1call@yandex.ru"
] | max1call@yandex.ru |
41da8550dc1cfb789b26384265b7b0b44cda9d6f | ca1b659861cfd4bbe6da6598603bb262d94f5c09 | /src/main/java/se/kry/codetest/KryServiceDAOImpl.java | 631d15091ef66b3b5206e44bb57ad4729fe2316a | [] | no_license | markdowman/fullstack-code-test | 562b3fcd9c4286c1e5d0e77dca3d0509718991c0 | 8856e5e032032756c549e0109b4389615d06770d | refs/heads/master | 2023-02-03T11:37:14.120058 | 2020-12-23T08:19:57 | 2020-12-23T08:19:57 | 323,678,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,812 | java | package se.kry.codetest;
import io.vertx.core.Future;
import io.vertx.core.json.JsonArray;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class KryServiceDAOImpl implements KryServiceDAO {
private DBConnector connector;
@Override
public void initialise(DBConnector connector) {
this.connector = connector;
}
/***
* create a new Kry Service in db
* @param
* @return id of newly created row
*/
@Override
public Future<Integer> create(KryService service) {
String insertQuery = "INSERT INTO SERVICE (`url`,`name`,`added`, 'status') VALUES (?, ?, ?, ?);";
JsonArray params = new JsonArray()
.add(service.getUrl())
.add(service.getName())
.add(service.getAdded().toString())
.add(service.getStatus());
Future<Integer> future = Future.future();
connector.query(insertQuery, params).setHandler(done -> {
if (done.succeeded()) {
// TODO: make this a bit cleaner, use compose?
connector.query("SELECT last_insert_rowid();").setHandler(done2 -> {
if (done2.succeeded()) {
future.complete(done2.result().getResults().get(0).getInteger(0));
} else {
done2.cause().printStackTrace();
future.fail(done2.cause().getMessage());
}
});
} else {
done.cause().printStackTrace();
future.fail(done.cause().getMessage());
}
});
return future;
}
@Override
public Future<Void> delete(Integer krServiceId) {
String deleteQuery = "DELETE FROM SERVICE WHERE ? = `id`;";
Future<Void> future = Future.future();
JsonArray params = new JsonArray().add(krServiceId);
connector.query(deleteQuery, params).setHandler(done -> {
if (done.succeeded()) {
future.complete();
} else {
done.cause().printStackTrace();
future.fail(done.cause());
}
});
return future;
}
@Override
public Future<Void> updateStatus(KryService service) {
String updateQuery = "UPDATE SERVICE SET `status` = ? WHERE ? = `id`;";
Future<Void> future = Future.future();
JsonArray params = new JsonArray()
.add(service.getStatus())
.add(service.getId());
connector.query(updateQuery, params).setHandler(done -> {
if (done.succeeded()) {
future.complete();
} else {
done.cause().printStackTrace();
future.fail(done.cause());
}
});
return future;
}
@Override
public Future<List<KryService>> findServices() {
String selectAllQuery = "SELECT * FROM SERVICE;";
Future<List<KryService>> future = Future.future();
List<KryService> serviceList = new ArrayList<>();
connector.query(selectAllQuery).setHandler(done -> {
if (done.succeeded()) {
done.result().getResults().stream().forEach(s -> {
try {
serviceList.add(new KryService(
s.getInteger(0),
s.getString(1),
s.getString(2),
convertToTimestamp(s.getString(3)),
ServiceStatus.valueOf(s.getString(4))));
} catch (ParseException e) {
// TODO: handle this more elegantly
e.printStackTrace();
}
});
future.complete(serviceList);
} else {
done.cause().printStackTrace();
future.fail(done.cause().getMessage());
}
});
return future;
}
private Timestamp convertToTimestamp(String s) throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
Date parsedDate = dateFormat.parse(s);
return new java.sql.Timestamp(parsedDate.getTime());
}
}
| [
"mark.dowman@gmail.com"
] | mark.dowman@gmail.com |
103effabfaf252baaff1d25f5b1cc42c42098487 | 21e3224e7f27120048f2032c52a7d967b154b6ea | /src/main/java/com/covidmanage/controller/SupplyController.java | 921a3bcf97b153ebeaa311ff3ee39d1fb6e3c6e4 | [] | no_license | kouteisang/Covid19Management | 405772c0ab1a52563ca64a63a0aeac0226f77fcf | dbe8434691e7aa457d581f1fe9a362baf44844c4 | refs/heads/main | 2023-05-11T18:57:24.795387 | 2021-05-29T08:20:21 | 2021-05-29T08:20:21 | 345,494,622 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,628 | java | package com.covidmanage.controller;
import com.covidmanage.dto.SupplyNeedDTO;
import com.covidmanage.pojo.CommunityUser;
import com.covidmanage.pojo.VerifyUser;
import com.covidmanage.service.CommonService;
import com.covidmanage.service.CommunityUserService;
import com.covidmanage.service.SupplyService;
import com.covidmanage.service.VerifyService;
import com.covidmanage.utils.CommonUtil;
import com.covidmanage.utils.ResponseCode;
import com.covidmanage.utils.ResponseTemplate;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@CrossOrigin(origins = "http://172.20.10.2:8080", allowCredentials = "true")
@RestController
@RequestMapping("/user/supply")
public class SupplyController {
@Autowired
public CommunityUserService communityUserService;
@Autowired
public SupplyService supplyService;
@Autowired
public CommonService commonService;
@Autowired
public VerifyService verifyService;
/**
* 物资申请
* @param identityId
* @param supplyType
* @param supplyContent
* @param age
* @param isEmergency
* @param suggestion
* @return
*/
@PostMapping("/applySupply")
public ResponseTemplate applySupply(@RequestParam(value = "identityId") String identityId,
@RequestParam(value = "supplyType") String supplyType,
@RequestParam(value = "supplyContent") String supplyContent,
@RequestParam(value = "age") Integer age,
@RequestParam(value = "isEmergency") Integer isEmergency,
@RequestParam(value = "suggestion",defaultValue = "暂无建议") String suggestion){
VerifyUser userInfo = verifyService.getUserInfo(identityId);
if(userInfo == null){
return ResponseTemplate.fail(ResponseCode.NO_VERIFY.val(), ResponseCode.NO_VERIFY.msg());
}
if(!CommonUtil.isIDNumber(identityId)){
return ResponseTemplate.fail(ResponseCode.ERROR.val(),ResponseCode.ERROR.msg());
}
CommunityUser user = communityUserService.findUserByIndentityId(identityId);
if(user == null)
return ResponseTemplate.fail(ResponseCode.NO_THIS_PERSON.val(), ResponseCode.NO_THIS_PERSON.msg());
int i = supplyService.applySupply(identityId, supplyType, supplyContent, age, isEmergency, suggestion);
if(i > 0)
return ResponseTemplate.success(ResponseCode.SUCCESS.val(), ResponseCode.SUCCESS.msg());
return ResponseTemplate.fail(ResponseCode.ERROR.val(), ResponseCode.ERROR.msg());
}
/**
* 得到需要求助物资列表
* @param supplyType
* @param supplyContent
* @param isEmergency
* @return
*/
@GetMapping("/getAskForSupplyList")
public ResponseTemplate getAskForSupplyList(@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "size", required = false, defaultValue = "10") Integer size,
@RequestParam(value = "supplyType", required = false) String supplyType,
@RequestParam(value = "supplyContent", required = false) String supplyContent,
@RequestParam(value = "isEmergency", required = false) Integer isEmergency){
PageHelper.startPage(page, size);
Map<Object, Object> map = supplyService.getAskForSupplyList(page, size, supplyType, supplyContent, isEmergency);
return ResponseTemplate.success(map);
}
/**
* 得到每个年龄段最想要的物资
* @return
*/
@GetMapping("/getSupplyContentByAge")
public ResponseTemplate getSupplyContentByAge(){
List<String> supplyContent = new ArrayList<>();
List<Integer> supplyCount = new ArrayList<>();
for(Integer i = 1; i <= 5; i ++){
String supplyContentByAge = supplyService.getSupplyContentByAge(i);
supplyContent.add(supplyContentByAge);
Integer supplyCountByAge = supplyService.getSupplyCountByAge(i);
supplyCount.add(supplyCountByAge);
}
Map<String, Object> map = new HashMap<>();
map.put("supplyContent", supplyContent);
map.put("supplyCount", supplyCount);
return ResponseTemplate.success(map);
}
/**
* 近五日缺少物品种类统计
*/
@GetMapping("/getSupplyKindByDay")
public ResponseTemplate getSupplyKindByDay(){
List<String> supplyKinds = commonService.getAllSupplyKind();
List<String> days = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
int num = 0;
for(String sk : supplyKinds){
List<Integer> list = new ArrayList<>();
num ++;
for(int i = 5; i >= 1; i --){
int mus = -1 * i;
String day = LocalDateTime.now().plusDays(mus).toString();
String day0 = day.split("T")[0];
Integer supplyKindCountByDay = supplyService.getSupplyKindCountByDay(sk, day0);
list.add(supplyKindCountByDay);
if(num == 1)
days.add(day0);
}
map.put(sk, list);
}
map.put("days", days);
return ResponseTemplate.success(map);
}
/**
* 推荐购买物资
*/
@GetMapping("/recommendBuySupply")
public ResponseTemplate recommendBuySupply(){
String beginTime = LocalDateTime.now().plusDays(-6).toString().split("T")[0];
String endTime = LocalDateTime.now().toString().split("T")[0];
List<String> supplyNeedDTOS = supplyService.recommendBuySupply(beginTime, endTime);
StringBuilder sb = new StringBuilder();
for(int i = 0; i < supplyNeedDTOS.size(); i ++){
if(i != supplyNeedDTOS.size()-1){
sb.append(supplyNeedDTOS.get(i)).append(",");
}else if(i == supplyNeedDTOS.size() - 1){
sb.append(supplyNeedDTOS.get(i));
}
}
Map<Object, Object> map = new HashMap<>();
map.put("sb", sb.toString());
return ResponseTemplate.success(map);
}
} | [
"huangchengadam@gmail.com"
] | huangchengadam@gmail.com |
79fde991b5597aced253229dfc80c9383482a9d6 | e58094fcf56f511f1084bff84e2a5ec455a0d0db | /wfx/src/main/java/com/blb/wfx/controller/WxbGoodTypeController.java | 1e8cc8c2419d2e252d55d7609acc0bf50a5b118d | [] | no_license | sunezee/wfx | 1b69c66fef12daa8da71d1ec273a4b596719e095 | 5dd499064b00465e9ef5e741aad8e3293255c9a7 | refs/heads/master | 2023-02-27T11:01:37.987991 | 2021-02-08T09:51:05 | 2021-02-08T09:51:05 | 285,467,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,510 | java | package com.blb.wfx.controller;
import com.blb.wfx.entity.JsonResult;
import com.blb.wfx.entity.ModuleTreeNodes;
import com.blb.wfx.feign.GoodsFeignClients;
import com.blb.wfx.service.WxbGoodTypeService;
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.ResponseBody;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping("goodType")
public class WxbGoodTypeController {
@Autowired
private WxbGoodTypeService wxbGoodTypeService;
@Autowired
private GoodsFeignClients goodsFeignClients;
@ResponseBody
@RequestMapping("typeList")
public JsonResult getGoodType(){
try{
// List<ModuleTreeNodes> goodTypes = wxbGoodTypeService.getGoodType();
// for (ModuleTreeNodes goodType:goodTypes
// ) {
// goodType.setText("商品分类");
// goodType.setHref("/good/goodList?pageNo=1");
// }
// List<ModuleTreeNodes> goodTypes1=new ArrayList<>();
// goodTypes1.add(goodTypes.get(0));
// return new JsonResult(200,"success",goodTypes1);
JsonResult result = goodsFeignClients.getGoodType();
return result;
}catch (Exception e){
e.printStackTrace();
return new JsonResult(500,"failed",e.getMessage());
}
}
}
| [
"1149431945@qq.com"
] | 1149431945@qq.com |
68205c3afb30b0027fe395db40b261d232f4f07a | 7aaf228671f58700508abac770ea5c522e39e95f | /src/Ui/EditarUsuario.java | bbf0c5f4d63d8a991e3f196dbf1ccb26105b9f8c | [] | no_license | Pirris-Salas/AplicacionCodigoBarras | ddc5316df61bcc5ca91a9c445e0f89c463fde16c | a61a0de9ee321bfa6b25780d91db10d34e3d0600 | refs/heads/master | 2021-06-21T23:23:28.939123 | 2020-04-10T00:45:37 | 2020-04-10T00:45:37 | 254,505,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,227 | 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 Ui;
import static Ui.frmEditarJornada.lblId;
import static Ui.infrmAgregar.jTable1;
import static Ui.infrmAgregar.validateEmail;
import static Ui.infrmAgregar.validateTelephone;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import logic.clsEmpleados;
import logic.clsGestorAdmin;
import logic.clsGestorJornada;
/**
*
* @author INVENIO122
*/
public class EditarUsuario extends javax.swing.JFrame {
clsGestorAdmin gestorAdmin;
clsEmpleados empleados;
ResultSet rs;
public EditarUsuario() {
gestorAdmin = new clsGestorAdmin();
empleados = new clsEmpleados();
initComponents();
rs = null;
this.setLocationRelativeTo(null);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
tvID = new javax.swing.JLabel();
tfID = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
tfNombre = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
tfApellido = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
cboTipoUsuario = new javax.swing.JComboBox();
jLabel4 = new javax.swing.JLabel();
tfEmail = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
tfTelefono = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
tfUser = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
tfPass = new javax.swing.JPasswordField();
btEditar = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
lbl = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Edición de Datos");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);
}
public void windowDeactivated(java.awt.event.WindowEvent evt) {
formWindowDeactivated(evt);
}
});
tvID.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
tvID.setText("Cedula:");
tfID.setEditable(false);
tfID.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel1.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel1.setText("Nombre:");
tfNombre.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel2.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel2.setText("Apellido:");
tfApellido.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel3.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel3.setText("Tipo de Usuario:");
cboTipoUsuario.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
cboTipoUsuario.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Administrador", "Empleado" }));
cboTipoUsuario.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cboTipoUsuarioActionPerformed(evt);
}
});
jLabel4.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel4.setText("Correo:");
tfEmail.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel6.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel6.setText("Telefono:");
tfTelefono.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel5.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel5.setText("Usuario:");
tfUser.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel7.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
jLabel7.setText("Contraseña:");
tfPass.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N
tfPass.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tfPassActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1)
.addComponent(tvID)
.addComponent(jLabel4)
.addComponent(jLabel6)
.addComponent(jLabel5)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tfPass)
.addComponent(tfUser)
.addComponent(tfTelefono)
.addComponent(tfEmail)
.addComponent(tfNombre)
.addComponent(cboTipoUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tfApellido)
.addComponent(tfID)))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(tvID))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(tfID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addComponent(tfNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(tfApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(33, 33, 33)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(cboTipoUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(tfEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(tfTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(tfUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(tfPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(19, Short.MAX_VALUE))
);
btEditar.setText("Actualizar");
btEditar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btEditarActionPerformed(evt);
}
});
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 3)); // NOI18N
jLabel8.setForeground(new java.awt.Color(51, 51, 51));
lbl.setFont(new java.awt.Font("Tahoma", 0, 3)); // NOI18N
lbl.setForeground(new java.awt.Color(51, 51, 51));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(114, 114, 114)
.addComponent(btEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(155, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(60, 60, 60))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(lbl)
.addGap(92, 92, 92))))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(37, 37, 37))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(jLabel8)
.addGap(9, 9, 9)
.addComponent(lbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(55, 55, 55))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void cboTipoUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboTipoUsuarioActionPerformed
if (cboTipoUsuario.getSelectedItem() == "Administrador"){
lbl.setText("1");
}else{
lbl.setText("2");
}
}//GEN-LAST:event_cboTipoUsuarioActionPerformed
private void tfPassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfPassActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_tfPassActionPerformed
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
gestorAdmin.conectarBD();
rs = gestorAdmin.buscarporid(Integer.parseInt(tfID.getText()));
try {
if (rs.next()) {
tfNombre.setText(rs.getString("nombre"));
tfApellido.setText(rs.getString("apellidos"));
tfUser.setText(rs.getString("usuario"));
tfEmail.setText(rs.getString("email"));
tfPass.setText(rs.getString("password"));
tfTelefono.setText(rs.getString("telefono"));
lbl.setText(rs.getString("idtipousuario"));
} } catch (SQLException ex) {
Logger.getLogger(EditarUsuario.class.getName()).log(Level.SEVERE, null, ex);
} gestorAdmin.desconectarBD();
rs = null ;
if ("1".equals(lbl.getText())){
cboTipoUsuario.setSelectedItem("Administrador");
}else{
cboTipoUsuario.setSelectedItem("Empleado");
}
// if(lbl.getText() == ""){
// JOptionPane.showInputDialog("No se obtuvo el tipo de usuario, llamar al creador del software");
// }
}//GEN-LAST:event_formWindowActivated
private void btEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btEditarActionPerformed
if (validarDatos().equals("")) {
empleados = new clsEmpleados();
empleados.setIdUsuario(Integer.parseInt(tfID.getText()));
empleados.setNombre(tfNombre.getText());
empleados.setApellido(tfApellido.getText());
empleados.setTipo(Integer.parseInt(lbl.getText()));
empleados.setEmail(tfEmail.getText());
empleados.setTelefono(tfTelefono.getText());
empleados.setUsuario(tfUser.getText());
empleados.setPassword(tfPass.getText());
gestorAdmin.conectarBD();
rs = gestorAdmin.buscarUsuario(Integer.parseInt(tfID.getText()));
try {
if (rs.next()) {
gestorAdmin.editarUsuario(empleados);
JOptionPane.showMessageDialog(rootPane, "La información del empleado "+empleados.getNombre() + " ha sido editado (a) exitosamente.");
} else {
JOptionPane.showMessageDialog(rootPane, "Cedula no encontrada");
}
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
gestorAdmin.desconectarBD();
this.dispose();
}else {
JOptionPane.showMessageDialog(rootPane, validarDatos());
}
}//GEN-LAST:event_btEditarActionPerformed
private void formWindowDeactivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowDeactivated
gestorAdmin.conectarBD();
ResultSet sr = gestorAdmin.TodosUsuarios();
if (sr != null) {
jTable1.setModel(gestorAdmin.cargarEnTabla(sr));
}
gestorAdmin.desconectarBD();
}//GEN-LAST:event_formWindowDeactivated
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(EditarUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(EditarUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(EditarUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(EditarUsuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new EditarUsuario().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btEditar;
private javax.swing.JComboBox cboTipoUsuario;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lbl;
private javax.swing.JTextField tfApellido;
private javax.swing.JTextField tfEmail;
public static javax.swing.JTextField tfID;
private javax.swing.JTextField tfNombre;
private javax.swing.JTextField tfPass;
private javax.swing.JTextField tfTelefono;
private javax.swing.JTextField tfUser;
private javax.swing.JLabel tvID;
// End of variables declaration//GEN-END:variables
private String validarDatos() {
String msg = "";
if (tfID.getText().equals("")) {
msg += "Por favor digite la identificacion del cliente\n";
} else if (!IsNumero(tfID.getText())) {
msg += "Por favor digite la identificacion del cliente solo con numeros\n";
}
if (tfNombre.getText().equals("")) {
msg += "Por favor digite el nombre del usuario "+" "+""+tfID.getText()+"\n";
}
if (lbl.getText().equals("")) {
msg += "Por favor seleccione el roll que va a desempeñar el usuario "+" "+""+tfNombre.getText()+"\n";
}
if (tfApellido.getText().equals("")) {
msg += "Por favor digite los apellidos del usuario "+" "+""+tfNombre.getText()+"\n";
}
if (tfEmail.getText().equals("")) {
msg += "Por favor digite el correo electronico del usuario "+" "+""+tfNombre.getText()+"\n";
}else if (validateEmail(tfEmail.getText())==false) {
msg += "Verifique el correo electronico ya que no coincide con el formato conocido \n";
}
if (tfTelefono.getText().equals("")) {
msg += "Por favor digite el # de telefono del usuario "+" "+""+tfNombre.getText()+"\n";
} else if (validateTelephone(tfTelefono.getText())==false) {
msg += "Escriba el numero de telefono en el siguiente formato: xxxx-xxxx, no olvide el guión \n";
}
if (tfUser.getText().equals("")) {
msg += "Por favor digite el nombre de la cuenta del usuario "+" "+""+tfNombre.getText()+"\n";
}
if (tfPass.getText().equals("")) {
msg += "Por favor digite la contraseña del usuario "+" "+""+tfNombre.getText()+"\n";
}
return msg;
}
boolean IsNumero(String dato)
{
try {
int num = Integer.parseInt(dato);
return true;
} catch (NumberFormatException ex) {
return false;
}
}
private static final String EMAIL_PATTERN =
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
public static boolean validateEmail(String email) {
try{
// Compiles the given regular expression into a pattern.
Pattern pattern = Pattern.compile(EMAIL_PATTERN);
// Match the given input against this pattern
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}catch(Exception e){
e.printStackTrace();
}
return false;
}
private static final String TELEPHONE_PATTERN =
"^([0-9]{4})*-"
+ "[0-9]{4}$";
public static boolean validateTelephone(String telephone) {
try{
// Compiles the given regular expression into a pattern.
Pattern pattern = Pattern.compile(TELEPHONE_PATTERN);
// Match the given input against this pattern
Matcher matcher = pattern.matcher(telephone);
return matcher.matches();
}catch(Exception e){
e.printStackTrace();
}
return false;
}
}
| [
"pirrissalas_10@hotmail.com"
] | pirrissalas_10@hotmail.com |
f6d8034d26a850ca016455cb5c67971c100c79ff | cd5c476bfc36a9f2639ab667ddfca5d94a8b686c | /src/main/java/Builder/Director.java | c69da5727a157d7501e2a41eb11d8f4a2ad584de | [] | no_license | Bweijia/23-Design-Mode | e68be90b69638c866dd16d1dbcbb755f9c73acfb | f0ad9b511744c943fedf0dd34cd4d4e9d0490b95 | refs/heads/master | 2020-06-08T06:28:00.081330 | 2019-06-30T08:52:08 | 2019-06-30T08:52:08 | 193,177,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package main.java.Builder;
/**
* create BWJ
*/
public class Director {
public void Construct(Builder builder){
builder. BuildCPU();
builder.BuildMainboard();
builder. BuildHD();
}
}
| [
"1094443622@qq.com"
] | 1094443622@qq.com |
54cea53e38264dae48b40b5cc97153326ec4ab09 | ed84e80142efce9d6c36cc0751ba9f4a3cb4c9fc | /compilertools/src/com/strobel/decompiler/languages/java/ast/NameVariables.java | 3cdfd8c6f69accce5e0ced1cc99610a612569b3b | [] | no_license | fxxing/procyon | 0c02da60ff598942e600490a2d18f47ded62b592 | 623e3966a25345e3985d4eb70c49100ae4e76661 | refs/heads/master | 2021-03-12T23:55:46.386475 | 2013-12-20T07:55:44 | 2013-12-20T07:55:44 | 15,332,921 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,224 | java | /*
* NameVariables.java
*
* Copyright (c) 2013 Mike Strobel
*
* This source code is based on Mono.Cecil from Jb Evain, Copyright (c) Jb Evain;
* and ILSpy/ICSharpCode from SharpDevelop, Copyright (c) AlphaSierraPapa.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0.
* A copy of the license can be found in the License.html file at the root of this distribution.
* By using this source code in any fashion, you are agreeing to be bound by the terms of the
* Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*/
package com.strobel.decompiler.languages.java.ast;
import com.strobel.assembler.metadata.*;
import com.strobel.core.IntegerBox;
import com.strobel.core.StringUtilities;
import com.strobel.core.StrongBox;
import com.strobel.decompiler.DecompilerContext;
import com.strobel.decompiler.ast.AstCode;
import com.strobel.decompiler.ast.Block;
import com.strobel.decompiler.ast.Expression;
import com.strobel.decompiler.ast.Loop;
import com.strobel.decompiler.ast.PatternMatching;
import com.strobel.decompiler.ast.Variable;
import com.strobel.decompiler.languages.java.JavaOutputVisitor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static com.strobel.core.CollectionUtilities.getOrDefault;
public class NameVariables {
private final static char MAX_LOOP_VARIABLE_NAME = 'm';
private final static String[] METHOD_PREFIXES = { "get", "is", "are", "to", "as", "create", "make", "new", "read", "parse", "extract", "find" };
private final static String[] METHOD_SUFFIXES = { "At", "For", "From", "Of" };
private final static Map<String, String> BUILT_IN_TYPE_NAMES;
private final static Map<String, String> METHOD_NAME_MAPPINGS;
static {
final Map<String, String> builtInTypeNames = new LinkedHashMap<>();
final Map<String, String> methodNameMappings = new LinkedHashMap<>();
builtInTypeNames.put(BuiltinTypes.Boolean.getInternalName(), "b");
builtInTypeNames.put("java/lang/Boolean", "b");
builtInTypeNames.put(BuiltinTypes.Byte.getInternalName(), "b");
builtInTypeNames.put("java/lang/Byte", "b");
builtInTypeNames.put(BuiltinTypes.Short.getInternalName(), "n");
builtInTypeNames.put("java/lang/Short", "n");
builtInTypeNames.put(BuiltinTypes.Integer.getInternalName(), "n");
builtInTypeNames.put("java/lang/Integer", "n");
builtInTypeNames.put(BuiltinTypes.Long.getInternalName(), "n");
builtInTypeNames.put("java/lang/Long", "n");
builtInTypeNames.put(BuiltinTypes.Float.getInternalName(), "n");
builtInTypeNames.put("java/lang/Float", "n");
builtInTypeNames.put(BuiltinTypes.Double.getInternalName(), "n");
builtInTypeNames.put("java/lang/Double", "n");
builtInTypeNames.put(BuiltinTypes.Character.getInternalName(), "c");
builtInTypeNames.put("java/lang/Number", "n");
builtInTypeNames.put("java/io/Serializable", "s");
builtInTypeNames.put("java/lang/Character", "c");
builtInTypeNames.put("java/lang/Object", "o");
builtInTypeNames.put("java/lang/String", "s");
builtInTypeNames.put("java/lang/StringBuilder", "sb");
builtInTypeNames.put("java/lang/StringBuffer", "sb");
builtInTypeNames.put("java/lang/Class", "clazz");
BUILT_IN_TYPE_NAMES = Collections.unmodifiableMap(builtInTypeNames);
methodNameMappings.put("get", "value");
METHOD_NAME_MAPPINGS = methodNameMappings;
}
private final ArrayList<String> _fieldNamesInCurrentType;
private final Map<String, Integer> _typeNames = new HashMap<>();
public NameVariables(final DecompilerContext context) {
_fieldNamesInCurrentType = new ArrayList<>();
for (final FieldDefinition field : context.getCurrentType().getDeclaredFields()) {
_fieldNamesInCurrentType.add(field.getName());
}
}
public final void addExistingName(final String name) {
if (StringUtilities.isNullOrEmpty(name)) {
return;
}
final IntegerBox number = new IntegerBox();
final String nameWithoutDigits = splitName(name, number);
final Integer existingNumber = _typeNames.get(nameWithoutDigits);
if (existingNumber != null) {
_typeNames.put(nameWithoutDigits, Math.max(number.value, existingNumber));
}
else {
_typeNames.put(nameWithoutDigits, number.value);
}
}
final String splitName(final String name, final IntegerBox number) {
int position = name.length();
while (position > 0 && name.charAt(position - 1) >= '0' && name.charAt(position - 1) <= '9') {
position--;
}
if (position < name.length()) {
number.value = Integer.parseInt(name.substring(position));
return name.substring(0, position);
}
number.value = 1;
return name;
}
public static void assignNamesToVariables(
final DecompilerContext context,
final Iterable<Variable> parameters,
final Iterable<Variable> variables,
final Block methodBody) {
final NameVariables nv = new NameVariables(context);
for (final String name : context.getReservedVariableNames()) {
nv.addExistingName(name);
}
for (final Variable p : parameters) {
nv.addExistingName(p.getName());
}
if (context.getCurrentMethod().isTypeInitializer()) {
//
// We cannot assign final static variables with a type qualifier, so make sure we
// don't have variable/field name collisions in type initializers which must assign
// those fields.
//
for (final FieldDefinition f : context.getCurrentType().getDeclaredFields()) {
if (f.isStatic() && f.isFinal() && !f.hasConstantValue()) {
nv.addExistingName(f.getName());
}
}
}
for (final Variable v : variables) {
if (v.isGenerated()) {
nv.addExistingName(v.getName());
}
else {
final VariableDefinition originalVariable = v.getOriginalVariable();
if (originalVariable != null) {
/*
if (originalVariable.isFromMetadata() && originalVariable.hasName()) {
v.setName(originalVariable.getName());
continue;
}
*/
final String varName = originalVariable.getName();
if (StringUtilities.isNullOrEmpty(varName) || varName.startsWith("V_") || !isValidName(varName)) {
v.setName(null);
}
else {
v.setName(nv.getAlternativeName(varName));
}
}
else {
v.setName(null);
}
}
}
for (final Variable p : parameters) {
if (!p.getOriginalParameter().hasName()) {
p.setName(nv.generateNameForVariable(p, methodBody));
}
}
for (final Variable varDef : variables) {
final boolean generateName = StringUtilities.isNullOrEmpty(varDef.getName()) ||
varDef.isGenerated() ||
!varDef.isParameter() && !varDef.getOriginalVariable().isFromMetadata();
if (generateName) {
varDef.setName(nv.generateNameForVariable(varDef, methodBody));
}
}
}
static boolean isValidName(final String name) {
if (StringUtilities.isNullOrEmpty(name)) {
return false;
}
if (!Character.isJavaIdentifierPart(name.charAt(0))) {
return false;
}
for (int i = 1; i < name.length(); i++) {
if (!Character.isJavaIdentifierPart(name.charAt(i))) {
return false;
}
}
return true;
}
public String getAlternativeName(final String oldVariableName) {
final IntegerBox number = new IntegerBox();
final String nameWithoutDigits = splitName(oldVariableName, number);
if (!_typeNames.containsKey(nameWithoutDigits) && !JavaOutputVisitor.isKeyword(oldVariableName)) {
_typeNames.put(nameWithoutDigits, Math.min(number.value, 1));
return oldVariableName;
}
if (oldVariableName.length() == 1 &&
oldVariableName.charAt(0) >= 'i' &&
oldVariableName.charAt(0) <= MAX_LOOP_VARIABLE_NAME) {
for (char c = 'i'; c <= MAX_LOOP_VARIABLE_NAME; c++) {
final String cs = String.valueOf(c);
if (!_typeNames.containsKey(cs)) {
_typeNames.put(cs, 1);
return cs;
}
}
}
if (!_typeNames.containsKey(nameWithoutDigits)) {
_typeNames.put(nameWithoutDigits, number.value - 1);
}
final int count = _typeNames.get(nameWithoutDigits) + 1;
_typeNames.put(nameWithoutDigits, count);
if (count != 1 || JavaOutputVisitor.isKeyword(nameWithoutDigits)) {
return nameWithoutDigits + count;
}
else {
return nameWithoutDigits;
}
}
@SuppressWarnings("ConstantConditions")
private String generateNameForVariable(final Variable variable, final Block methodBody) {
String proposedName = null;
if (variable.getType().getSimpleType() == JvmType.Integer) {
boolean isLoopCounter = false;
loopSearch:
for (final Loop loop : methodBody.getSelfAndChildrenRecursive(Loop.class)) {
Expression e = loop.getCondition();
while (e != null && e.getCode() == AstCode.LogicalNot) {
e = e.getArguments().get(0);
}
if (e != null) {
switch (e.getCode()) {
case CmpEq:
case CmpNe:
case CmpLe:
case CmpGt:
case CmpGe:
case CmpLt: {
final StrongBox<Variable> loadVariable = new StrongBox<>();
if (PatternMatching.matchGetOperand(e.getArguments().get(0), AstCode.Load, loadVariable) &&
loadVariable.get() == variable) {
isLoopCounter = true;
break loopSearch;
}
break;
}
}
}
}
if (isLoopCounter) {
for (char c = 'i'; c < MAX_LOOP_VARIABLE_NAME; c++) {
final String name = String.valueOf(c);
if (!_typeNames.containsKey(name)) {
proposedName = name;
break;
}
}
}
}
if (StringUtilities.isNullOrEmpty(proposedName)) {
String proposedNameForStore = null;
for (final Expression e : methodBody.getSelfAndChildrenRecursive(Expression.class)) {
if (e.getCode() == AstCode.Store && e.getOperand() == variable) {
final String name = getNameFromExpression(e.getArguments().get(0));
if (name != null/* && !_fieldNamesInCurrentType.contains(name)*/) {
if (proposedNameForStore != null) {
proposedNameForStore = null;
break;
}
proposedNameForStore = name;
}
}
}
if (proposedNameForStore != null) {
proposedName = proposedNameForStore;
}
}
if (StringUtilities.isNullOrEmpty(proposedName)) {
String proposedNameForLoad = null;
for (final Expression e : methodBody.getSelfAndChildrenRecursive(Expression.class)) {
final List<Expression> arguments = e.getArguments();
for (int i = 0; i < arguments.size(); i++) {
final Expression a = arguments.get(i);
if (a.getCode() == AstCode.Load && a.getOperand() == variable) {
final String name = getNameForArgument(e, i);
if (name != null/* && !_fieldNamesInCurrentType.contains(name)*/) {
if (proposedNameForLoad != null) {
proposedNameForLoad = null;
break;
}
proposedNameForLoad = name;
}
}
}
}
if (proposedNameForLoad != null) {
proposedName = proposedNameForLoad;
}
}
if (StringUtilities.isNullOrEmpty(proposedName)) {
proposedName = getNameForType(variable.getType());
}
return this.getAlternativeName(proposedName);
/*
while (true) {
proposedName = this.getAlternativeName(proposedName);
if (!_fieldNamesInCurrentType.contains(proposedName)) {
return proposedName;
}
}
*/
}
private static String cleanUpVariableName(final String s) {
if (s == null) {
return null;
}
String name = s;
if (name.length() > 2 && name.startsWith("m_")) {
name = name.substring(2);
}
else if (name.length() > 1 && name.startsWith("_")) {
name = name.substring(1);
}
final int length = name.length();
if (length == 0) {
return "obj";
}
int lowerEnd;
for (lowerEnd = 1;
lowerEnd < length && Character.isUpperCase(name.charAt(lowerEnd));
lowerEnd++) {
if (lowerEnd < length - 1) {
final char nextChar = name.charAt(lowerEnd + 1);
if (Character.isLowerCase(nextChar)) {
break;
}
if (!Character.isAlphabetic(nextChar)) {
lowerEnd++;
break;
}
}
}
name = name.substring(0, lowerEnd).toLowerCase() + name.substring(lowerEnd);
if (JavaOutputVisitor.isKeyword(name)) {
return name + "1";
}
return name;
}
private static String getNameFromExpression(final Expression e) {
switch (e.getCode()) {
case ArrayLength: {
return cleanUpVariableName("length");
}
case GetField:
case GetStatic: {
return cleanUpVariableName(((FieldReference) e.getOperand()).getName());
}
case InvokeVirtual:
case InvokeSpecial:
case InvokeStatic:
case InvokeInterface: {
final MethodReference method = (MethodReference) e.getOperand();
if (method != null) {
final String methodName = method.getName();
String name = methodName;
final String mappedMethodName = METHOD_NAME_MAPPINGS.get(methodName);
if (mappedMethodName != null) {
return cleanUpVariableName(mappedMethodName);
}
for (final String prefix : METHOD_PREFIXES) {
if (methodName.length() > prefix.length() &&
methodName.startsWith(prefix) &&
Character.isUpperCase(methodName.charAt(prefix.length()))) {
name = methodName.substring(prefix.length());
break;
}
}
for (final String suffix : METHOD_SUFFIXES) {
if (name.length() > suffix.length() &&
name.endsWith(suffix) &&
Character.isLowerCase(name.charAt(name.length() - suffix.length() - 1))) {
name = name.substring(0, name.length() - suffix.length());
break;
}
}
return cleanUpVariableName(name);
}
break;
}
}
return null;
}
private static String getNameForArgument(final Expression parent, final int i) {
switch (parent.getCode()) {
case PutField:
case PutStatic: {
if (i == parent.getArguments().size() - 1) {
return cleanUpVariableName(((FieldReference) parent.getOperand()).getName());
}
break;
}
case InvokeVirtual:
case InvokeSpecial:
case InvokeStatic:
case InvokeInterface:
case InitObject: {
final MethodReference method = (MethodReference) parent.getOperand();
if (method != null) {
final String methodName = method.getName();
final List<ParameterDefinition> parameters = method.getParameters();
if (parameters.size() == 1 && i == parent.getArguments().size() - 1) {
if (methodName.length() > 3 &&
StringUtilities.startsWith(methodName, "set") &&
Character.isUpperCase(methodName.charAt(3))) {
return cleanUpVariableName(methodName.substring(3));
}
}
final MethodDefinition definition = method.resolve();
if (definition != null) {
final ParameterDefinition p = getOrDefault(
definition.getParameters(),
parent.getCode() != AstCode.InitObject && !definition.isStatic() ? i - 1 : i
);
if (p != null && p.hasName() && !StringUtilities.isNullOrEmpty(p.getName())) {
return cleanUpVariableName(p.getName());
}
}
}
break;
}
}
return null;
}
private String getNameForType(final TypeReference type) {
TypeReference nameSource = type;
String name;
if (nameSource.isArray()) {
name = "array";
}
else if (StringUtilities.equals(nameSource.getInternalName(), "java/lang/Throwable")) {
name = "t";
}
else if (StringUtilities.endsWith(nameSource.getName(), "Exception")) {
name = "ex";
}
else if (StringUtilities.endsWith(nameSource.getName(), "List")) {
name = "list";
}
else if (StringUtilities.endsWith(nameSource.getName(), "Set")) {
name = "set";
}
else if (StringUtilities.endsWith(nameSource.getName(), "Collection")) {
name = "collection";
}
else {
name = BUILT_IN_TYPE_NAMES.get(nameSource.getInternalName());
if (name != null) {
return name;
}
if (!nameSource.isDefinition()) {
final TypeDefinition resolvedType = nameSource.resolve();
if (resolvedType != null) {
nameSource = resolvedType;
}
}
name = nameSource.getSimpleName();
//
// Remove leading 'I' for interfaces.
//
if (name.length() > 2 &&
name.charAt(0) == 'I' &&
Character.isUpperCase(name.charAt(1)) &&
Character.isLowerCase(name.charAt(2))) {
name = name.substring(1);
}
name = cleanUpVariableName(name);
}
return name;
}
}
| [
"xingfengxiang@gmail.com"
] | xingfengxiang@gmail.com |
b9d15eba11b56e3f189a83b39345548519c02d31 | 93aea46d807a19a28b7a346bd648a50dd60fb694 | /library/src/test/java/com/fanhl/library/ExampleUnitTest.java | a79184359b5c24b5a54f4326392a25d2a3d5c9d9 | [] | no_license | dyguests/KotlinAnnotationDemo | fbd0bb5df89370f32429d8ca6536cc9006018888 | 74f81c8ad6218ad6fe1182da72dacaf6b26a5db6 | refs/heads/master | 2020-03-27T13:38:41.629906 | 2018-08-29T15:27:13 | 2018-08-29T15:27:13 | 146,620,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package com.fanhl.library;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"dyguests@qq.com"
] | dyguests@qq.com |
a31f60da68f483c2f0a8a0ff5af13789dc66323c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/5/5_7ec19d137055d22dcbdd5f834e0f2df01bb7cdcb/LoadEventDetailsAction/5_7ec19d137055d22dcbdd5f834e0f2df01bb7cdcb_LoadEventDetailsAction_t.java | c6ce5e53cfe01aecf0dd7cefb339de358ea9ee20 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 32,345 | java |
package edu.wustl.clinportal.action;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.ehcache.CacheException;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import edu.common.dynamicextensions.exception.DynamicExtensionsApplicationException;
import edu.common.dynamicextensions.exception.DynamicExtensionsSystemException;
import edu.wustl.clinportal.action.annotations.AnnotationConstants;
import edu.wustl.clinportal.actionForm.EventEntryForm;
import edu.wustl.clinportal.bizlogic.AnnotationBizLogic;
import edu.wustl.clinportal.bizlogic.ClinicalStudyEventBizlogic;
import edu.wustl.clinportal.bizlogic.ClinicalStudyRegistrationBizLogic;
import edu.wustl.clinportal.bizlogic.EventEntryBizlogic;
import edu.wustl.clinportal.domain.ClinicalStudyEvent;
import edu.wustl.clinportal.domain.ClinicalStudyRegistration;
import edu.wustl.clinportal.domain.EventEntry;
import edu.wustl.clinportal.domain.RecordEntry;
import edu.wustl.clinportal.domain.StudyFormContext;
import edu.wustl.clinportal.util.CatissueCoreCacheManager;
import edu.wustl.clinportal.util.DataEntryUtil;
import edu.wustl.clinportal.util.EventTreeObject;
import edu.wustl.clinportal.util.global.Constants;
import edu.wustl.clinportal.util.global.Utility;
import edu.wustl.clinportal.util.global.Variables;
import edu.wustl.common.action.BaseAction;
import edu.wustl.common.beans.NameValueBean;
import edu.wustl.common.beans.SessionDataBean;
import edu.wustl.common.bizlogic.AbstractBizLogic;
import edu.wustl.common.bizlogic.DefaultBizLogic;
import edu.wustl.common.exception.BizLogicException;
import edu.wustl.dao.exception.DAOException;
import edu.wustl.security.exception.UserNotAuthorizedException;
/**
* @author falguni_sachde
*
*/
public class LoadEventDetailsAction extends BaseAction
{
int commonSerialNo;
private boolean readOnly = false;
/**
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
* @see edu.wustl.common.action.BaseAction#executeAction(
* org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm,
* javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected ActionForward executeAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception
{
// Getting required parameters to form XML/insert encountered date
String target = null;
if (request.getParameter(Constants.OPERATION) != null
&& request.getParameter(Constants.OPERATION).equals(Constants.DELETE_XML))
{
String xmlFileName = request.getParameter("XMLFileName");
deleteXMLFilesIfExists(xmlFileName);
}
else
{
target = Constants.SUCCESS;
String eventId = request.getParameter(Constants.PROTOCOL_EVENT_ID);
String studyId = request.getParameter(Constants.CP_SEARCH_CP_ID);
String participantId = request.getParameter(Constants.CP_SEARCH_PARTICIPANT_ID);
String key = getTreeViewKey(request);
EventTreeObject eventTreeObj = new EventTreeObject();
eventTreeObj.populateObject(key);
// Check whether control is coming from DE
String strIsComingFromDE = request.getParameter("comingFromDE");
/*
* If control is coming from DE page, all parameters will be null
* So, get those from the session.
*/
if (strIsComingFromDE != null && Boolean.valueOf(strIsComingFromDE))
{
eventId = (String) request.getSession().getAttribute(Constants.PROTOCOL_EVENT_ID);
studyId = (String) request.getSession().getAttribute(Constants.CP_SEARCH_CP_ID);
participantId = (String) request.getSession().getAttribute(
AnnotationConstants.SELECTED_STATIC_ENTITY_RECORDID);
/*
* If the form having single record then EventEntry node will be returned else
* FormEntry node will be returned
*/
key = getKeyForEventOrFormEntry(eventTreeObj, key);
request.getSession().setAttribute(AnnotationConstants.TREE_VIEW_KEY, key);
}
EventEntryForm eventEntryForm = (EventEntryForm) form;
// Get the ClinicalStudyRegistration object
ClinicalStudyRegistrationBizLogic regBizLogic = new ClinicalStudyRegistrationBizLogic();
ClinicalStudyRegistration cstudyReg = regBizLogic.getCSRegistration(Long
.valueOf(studyId), Long.valueOf(participantId));
// Get the ClinicalStudyEvent object
ClinicalStudyEventBizlogic bizlogic = new ClinicalStudyEventBizlogic();
ClinicalStudyEvent event = bizlogic.getClinicalStudyEventById(Long.valueOf(eventId));
EventEntry eventEntry = null;
if (eventEntryForm != null)
{
if (eventEntryForm.getEncounterDate() == null
|| eventEntryForm.getEncounterDate().equals(""))
{
eventEntryForm.setEncounterDate(edu.wustl.common.util.Utility
.parseDateToString(new Date(System.currentTimeMillis()),
Constants.DATE_PATTERN_DD_MM_YYYY));
}
String entryNumber = eventTreeObj.getEventEntryNumber(); //entryArr[2];
// Check the database whether the eventEntry object exists
eventEntry = getEventEntry(Integer.parseInt(entryNumber), eventEntry, cstudyReg,
event);
// If eventEntry exists update or else insert the eventEntry.
if (Boolean.valueOf(request.getParameter(Constants.IS_EVENT_DATE_SUBMITTED)))
{
String encounterDate = "";
if (eventEntryForm.getEncounterDate() != null)
{
encounterDate = eventEntryForm.getEncounterDate();
}
eventEntry = insertOrUpdateEventEntry(cstudyReg, event, eventEntry,
encounterDate, eventTreeObj, request);
eventTreeObj.setEventEntryId(String.valueOf(eventEntry.getId()));
request.getSession().setAttribute(AnnotationConstants.TREE_VIEW_KEY,
eventTreeObj.createKeyFromObject());
}
if (eventEntry != null)
{
eventEntryForm.setAllValues(eventEntry);
}
if (cstudyReg != null)
{
eventEntryForm.setCSRActivityStatus(cstudyReg.getActivityStatus());
}
getActivityStatus(eventEntryForm, participantId, studyId);
}
StringBuffer formsXML = new StringBuffer();
formsXML.append("<?xml version='1.0' encoding='UTF-8'?><rows>");
//if (eventList != null && !eventList.isEmpty())
if (event != null)
{
//When clicked node is Event
if (eventTreeObj.getObjectName().equals(Constants.CLINICAL_STUDY_EVENT_OBJECT))
{
formXMLForEvent(formsXML, studyId, participantId, event, eventEntry, request,
cstudyReg, eventTreeObj, eventEntryForm);
}
else
{
String entryNumber = eventTreeObj.getEventEntryNumber();
String nodeId = eventTreeObj.getEventEntryId();//entryArr[3];
StringBuffer studyFormHQL = new StringBuffer(25);
studyFormHQL.append("from ").append(StudyFormContext.class.getName());
studyFormHQL.append(" as studyFrm where studyFrm.clinicalStudyEvent.id=");
studyFormHQL.append(event.getId());
studyFormHQL.append(" and studyFrm.activityStatus!='");
studyFormHQL.append(Constants.ACTIVITY_STATUS_DISABLED+ "'");
if (eventTreeObj.getObjectName() != null
&& eventTreeObj.getObjectName().equals(Constants.FORM_ENTRY_OBJECT)
|| eventTreeObj.getObjectName().equals(Constants.FORM_CONTEXT_OBJECT))
{
studyFormHQL.append(" and studyFrm.id=");
studyFormHQL.append(eventTreeObj.getFormContextId());
}
studyFormHQL.append(" order by studyFrm.id asc");
Collection<StudyFormContext> studyFormColl = (Collection<StudyFormContext>) Utility
.executeQuery(studyFormHQL.toString());
commonSerialNo = 0;
SessionDataBean sessionDataBean = (SessionDataBean) request.getSession().getAttribute(
Constants.SESSION_DATA);
formsXML = generateFormXMLForEachEntry(formsXML, studyId, participantId,
Integer.parseInt(nodeId), studyFormColl, eventEntry, event, cstudyReg
.getId(), Integer.parseInt(entryNumber), eventTreeObj,
eventEntryForm, sessionDataBean);
}
}
formsXML.append("</rows>");
/*
* This method generates XML file out of the StringBuffer(XML String). This file name will be
* sent as request attribute to the JSP and that XML file will be displayed as grid.
*
*/
String genXMLFName = generateXMLFile(formsXML, request);
request.setAttribute("XMLFileName", genXMLFName);
}
return mapping.findForward(target);
}
/**
*
* @param eventTreeObj
* @param key
* @return
*/
private String getKeyForEventOrFormEntry(EventTreeObject eventTreeObj, String key)
{
String returnKey;
if (eventTreeObj.getObjectName().equals(Constants.SINGLE_RECORD_FORM)
|| eventTreeObj.getObjectName().equals(Constants.SINGLE_RECORD_FORM_EDIT))
{
returnKey = eventTreeObj.getEntryKey(key);
}
else
{
returnKey = eventTreeObj.getFormEntryKey(key);
}
return returnKey;
}
/**
*
* @param request
* @return
*/
private String getTreeViewKey(HttpServletRequest request)
{
String key = request.getParameter(AnnotationConstants.TREE_VIEW_KEY);
if (key == null)//when comes from data entry key = null
{
key = (String) request.getSession().getAttribute(AnnotationConstants.TREE_VIEW_KEY);
}
else
{
request.getSession().setAttribute(AnnotationConstants.TREE_VIEW_KEY, key);
}
return key;
}
/**
*
* @param eventEntryForm
* @param participantId
* @param studyId
* @throws DAOException
*/
private void getActivityStatus(EventEntryForm eventEntryForm, String participantId,
String studyId) throws DAOException
{
DataEntryUtil dataUtil = new DataEntryUtil();
String hql = "select part.activityStatus from edu.wustl.clinportal.domain.Participant "
+ "as part where part.id=" + participantId;
List dataList = dataUtil.executeQuery(hql);
if (dataList != null && !dataList.isEmpty())
{
eventEntryForm.setParticipantActivityStatus(dataList.get(0).toString());
}
hql = "select cs.activityStatus from edu.wustl.clinportal.domain.ClinicalStudy "
+ "as cs where cs.id=" + studyId;
dataList = dataUtil.executeQuery(hql);
if (dataList != null && !dataList.isEmpty())
{
eventEntryForm.setCSActivityStatus(dataList.get(0).toString());
}
}
/**
* This method insert or updates the event entry
* @param csRegn
* @param event
* @param eventEntry
* @param encounterDate
* @param eventTreeObj
* @param request
* @return
* @throws ParseException
* @throws BizLogicException
* @throws UserNotAuthorizedException
* @throws DAOException
*/
private EventEntry insertOrUpdateEventEntry(ClinicalStudyRegistration csRegn,
ClinicalStudyEvent event, EventEntry eventEntry, String encounterDate,
EventTreeObject eventTreeObj, HttpServletRequest request) throws ParseException,
BizLogicException, UserNotAuthorizedException, DAOException
{
String objectName = eventTreeObj.getObjectName();
if (objectName.equals(Constants.EVENT_ENTRY_OBJECT))
{
AbstractBizLogic bizlogic = new EventEntryBizlogic();
ActionErrors errors = new ActionErrors();
SessionDataBean sessionDataBean = (SessionDataBean) request.getSession().getAttribute(
Constants.SESSION_DATA);
try
{
if (eventEntry != null && eventEntry.getId() != null)
{
List<EventEntry> eventList = bizlogic.retrieve(EventEntry.class.getName(),
"id", eventEntry.getId());
EventEntry eventEntryOld = null;
for (EventEntry entry : eventList)
{
eventEntryOld = entry;
}
eventEntry.setEncounterDate(edu.wustl.common.util.Utility
.parseDate(encounterDate,Constants.DATE_PATTERN_DD_MM_YYYY));
bizlogic.update(eventEntry, eventEntryOld, Constants.HIBERNATE_DAO,
sessionDataBean);
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError(
"eventEntry.date.update"));
}
else
{
String entryNumber = eventTreeObj.getEventEntryNumber();
eventEntry = new EventEntry();
eventEntry.setActivityStatus(Constants.ACTIVITY_STATUS_ACTIVE);
eventEntry.setClinicalStudyEvent(event);
eventEntry.setClinicalStudyRegistration(csRegn);
eventEntry.setEncounterDate(edu.wustl.common.util.Utility
.parseDate(encounterDate,Constants.DATE_PATTERN_DD_MM_YYYY));
eventEntry.setEntryNumber(Integer.parseInt(entryNumber));
bizlogic.insert(eventEntry, sessionDataBean, Constants.HIBERNATE_DAO);
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError(
"eventEntry.date.insert"));
}
}
catch (BizLogicException excp)
{
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.item", excp
.getMessage()));
String key = (String) request.getSession().getAttribute(
AnnotationConstants.TREE_VIEW_KEY);
EventTreeObject treeObject = new EventTreeObject(key);
new DataEntryUtil().genrateEventKey(treeObject);
String treeViewKey = treeObject.createKeyFromObject();
request.getSession().setAttribute(AnnotationConstants.TREE_VIEW_KEY, treeViewKey);
}
saveErrors(request, errors);
}
return eventEntry;
}
/**
*
* @param formsXML
* @param studyId
* @param participantId
* @param studyEvent
* @param eventEntry
* @param request
* @param csRegn
* @param eventTreeObj
* @param eventEntryForm
* @throws DAOException
* @throws CacheException
* @throws SQLException
* @throws DynamicExtensionsApplicationException
* @throws DynamicExtensionsSystemException
* @throws BizLogicException
* @throws UserNotAuthorizedException
* @throws ClassNotFoundException
*/
private String formXMLForEvent(StringBuffer formsXML, String studyId, String participantId,
ClinicalStudyEvent studyEvent, EventEntry eventEntry, HttpServletRequest request,
ClinicalStudyRegistration csRegn, EventTreeObject eventTreeObj,
EventEntryForm eventEntryForm) throws DAOException, CacheException,
DynamicExtensionsSystemException, DynamicExtensionsApplicationException, SQLException,
UserNotAuthorizedException, BizLogicException, ClassNotFoundException
{
SessionDataBean sessionDataBean = (SessionDataBean) request.getSession().getAttribute(
Constants.SESSION_DATA);
request.setAttribute(Constants.INFINITE_ENTRY, studyEvent.getIsInfiniteEntry());
DataEntryUtil dataEntryUtil = new DataEntryUtil();
if (studyEvent.getIsInfiniteEntry() != null
&& studyEvent.getIsInfiniteEntry().booleanValue()
&& request.getParameter("addEntry") != null)
{
ActionErrors err = dataEntryUtil.getClosedStatus(request, participantId, studyId,
csRegn.getId().toString());
if (!err.isEmpty())
{
saveErrors(request, err);
}
else
{
List<EventEntry> eventEntryList = dataEntryUtil.getEventEntry(studyEvent, csRegn);
dataEntryUtil.createEventEntry(studyEvent, csRegn, eventEntryList.size() + 1,
request);
}
request.setAttribute(Constants.IS_TO_REFRESH_TREE, Constants.TRUE);
}
int noOfEntries = 1;
int nodeId = 1;
commonSerialNo = 0;
int entryCount = 0;
if (studyEvent.getIsInfiniteEntry() != null && studyEvent.getIsInfiniteEntry())
{
List<EventEntry> evntNtry = dataEntryUtil.getEventEntry(studyEvent, csRegn);
if (!evntNtry.isEmpty())
{
entryCount = evntNtry.size();
}
}
else
{
entryCount = studyEvent.getNoOfEntries();
}
request.setAttribute("numberOfVisits", String.valueOf(entryCount));
//Map studyFormMap = new HashMap();
List studyFormMap = new ArrayList();
String userId = sessionDataBean.getUserId().toString();
String userName = sessionDataBean.getUserName().toString();
for (; noOfEntries <= entryCount; noOfEntries++)
{
eventEntry = new EventEntry();
eventEntry = getEventEntry(noOfEntries, eventEntry, csRegn, studyEvent);
StringBuffer studyFormHQL = new StringBuffer();
studyFormHQL.append("from ").append(StudyFormContext.class.getName());
studyFormHQL.append(" as studyFrm where studyFrm.clinicalStudyEvent.id=");
studyFormHQL.append(studyEvent.getId()).append(" and studyFrm.activityStatus!='");
studyFormHQL.append(Constants.ACTIVITY_STATUS_DISABLED);
studyFormHQL.append("' order by studyFrm.id asc");
Collection<StudyFormContext> studyFormColl = (Collection<StudyFormContext>) Utility
.executeQuery(studyFormHQL.toString());
if (studyFormColl != null)
{
if(studyFormMap.isEmpty())
{
for (StudyFormContext studyFormContext : studyFormColl)
{
Map<String, Boolean> privMap = Utility.checkFormPrivileges(studyFormContext
.getId().toString(), userId, userName);
boolean hideForm = privMap.get(Constants.HIDEFORMS);
if (!hideForm)
{
NameValueBean nameValueBean = new NameValueBean();
nameValueBean.setName(studyFormContext.getId());
nameValueBean.setValue(studyFormContext.getStudyFormLabel());
studyFormMap.add(nameValueBean);
}
}
request.setAttribute("studyFormMap", studyFormMap);
}
formsXML = generateFormXMLForEachEntry(formsXML, studyId, participantId, nodeId,
studyFormColl, eventEntry, studyEvent, csRegn.getId(), noOfEntries,
eventTreeObj, eventEntryForm, sessionDataBean);
}
nodeId++;
}
return formsXML.toString();
}
/**
* This method forms XML required to populate spreadsheet on event click
* @param formsXML
* @param studyId
* @param participantId
* @param nodeId
* @param studyFormColl
* @param eventEntry
* @param studyEvent
* @param regId
* @param eventEntryCount
* @param eventTreeObj
* @param eventEntryForm
* @param sessionDataBean
* @return
* @throws DAOException
* @throws DynamicExtensionsSystemException
* @throws DynamicExtensionsApplicationException
* @throws CacheException
* @throws SQLException
*/
private StringBuffer generateFormXMLForEachEntry(StringBuffer formsXML, String studyId,
String participantId, int nodeId, Collection<StudyFormContext> studyFormColl,
EventEntry eventEntry, ClinicalStudyEvent studyEvent, Long regId, int eventEntryCount,
EventTreeObject eventTreeObj, EventEntryForm eventEntryForm,
SessionDataBean sessionDataBean) throws DAOException, DynamicExtensionsSystemException,
DynamicExtensionsApplicationException, CacheException, SQLException
{
String userId = sessionDataBean.getUserId().toString();
String userName = sessionDataBean.getUserName().toString();
CatissueCoreCacheManager cache = CatissueCoreCacheManager.getInstance();
String recEntryEntityId = cache.getObjectFromCache(
AnnotationConstants.RECORD_ENTRY_ENTITY_ID).toString();
Date encounterDate = null;
boolean isCsEventObject = false;
if (eventTreeObj.getObjectName() != null
&& eventTreeObj.getObjectName().equals(
Constants.CLINICAL_STUDY_EVENT_OBJECT))
{
isCsEventObject = true;
}
Collection recIdList = new HashSet();
AnnotationBizLogic annoBizLogic = new AnnotationBizLogic();
for (StudyFormContext studyFormContext : studyFormColl)
{
Map<String, Boolean> privilegeMap = Utility.checkFormPrivileges(studyFormContext.getId()
.toString(), userId, userName);
boolean hideForm = privilegeMap.get(Constants.HIDEFORMS);
readOnly = privilegeMap.get(Constants.READ_ONLY);
if (!hideForm)
{
boolean flag = false;
String eventEntryId = "";
if (nodeId < 0)
{
eventEntryId = String.valueOf(nodeId);
}
else
{
eventEntryId = "-" + nodeId;
}
String recEntryId = "0";
String dateString = "";
String dynamicRecId = "0";
int frmCount = 0;
if (eventEntry != null && eventEntry.getId() != null)
{
eventEntryId = eventEntry.getId().toString();
encounterDate = eventEntry.getEncounterDate();
if (encounterDate != null)
{
SimpleDateFormat customFormat = new SimpleDateFormat("MMM-dd-yyyy");
dateString = dateString + customFormat.format(encounterDate);
}
if (eventEntry.getEntryNumber() != null)
{
frmCount = eventEntry.getEntryNumber();
}
//get records
StringBuffer recEntryHQL = new StringBuffer();
recEntryHQL.append("select recEntry.id from ");
recEntryHQL.append(RecordEntry.class.getName());
recEntryHQL.append(" recEntry where recEntry.eventEntry.id=");
recEntryHQL.append(eventEntry.getId());
recEntryHQL.append(" and recEntry.studyFormContext.id=");
recEntryHQL.append(studyFormContext.getId());
recEntryHQL.append(" order by recEntry.id");
List<Long> recEntryColl = new DataEntryUtil().executeQuery(recEntryHQL
.toString());
if (recEntryColl != null && !recEntryColl.isEmpty())
{
commonSerialNo = 0;
for (Long entryId : recEntryColl)
{
commonSerialNo++;
flag = true;
recEntryId = entryId.toString();
recIdList = annoBizLogic.getDynamicRecordFromStaticId(recEntryId,
studyFormContext.getContainerId(), recEntryEntityId);
if (recIdList != null && !recIdList.isEmpty())
{
dynamicRecId = ((Long) recIdList.iterator().next()).toString();
}
String dyRecordurl = getDynamicRecordURL(studyId, participantId,
studyEvent.getId().toString(), studyFormContext, regId
.toString(), frmCount, eventEntryId, recEntryId,
dynamicRecId);
if (eventTreeObj.getObjectName() != null
&& eventTreeObj.getObjectName().equals(
Constants.CLINICAL_STUDY_EVENT_OBJECT))
{
getEntryURL(studyId, participantId, studyEvent.getId().toString(),
regId.toString(), eventEntryId, frmCount);
}
formsXML = formXml(formsXML, studyFormContext, dynamicRecId,
dyRecordurl, frmCount, commonSerialNo, dateString,
eventEntryForm, isCsEventObject);
}
}
}
else
{
frmCount = eventEntryCount;
}
if (!flag && !eventTreeObj.getObjectName().equals(Constants.FORM_ENTRY_OBJECT))
{
//commonSerialNo++;
commonSerialNo = 0;
String url = getDynamicRecordURL(studyId, participantId, studyEvent.getId()
.toString(), studyFormContext, regId.toString(), frmCount,
eventEntryId, recEntryId, dynamicRecId);
if (eventTreeObj.getObjectName() != null
&& eventTreeObj.getObjectName().equals(
Constants.CLINICAL_STUDY_EVENT_OBJECT))
{
getEntryURL(studyId, participantId, studyEvent.getId().toString(), regId
.toString(), eventEntryId, frmCount);
}
formsXML = formXml(formsXML, studyFormContext, dynamicRecId, url, frmCount,
commonSerialNo, dateString, eventEntryForm, isCsEventObject);
}
}
}
return formsXML;
}
/**
* returns event entry object as per given entry number
* @param noOfEntries
* @param eventEntry
* @param CSRegistration
* @param event
* @return
* @throws BizLogicException
*/
private EventEntry getEventEntry(Integer noOfEntries, EventEntry eventEntry,
ClinicalStudyRegistration CSRegistration, ClinicalStudyEvent event)
throws BizLogicException //throws DAOException
{
DataEntryUtil dataEntryUtil = new DataEntryUtil();
List<EventEntry> eventEntryCol = dataEntryUtil.getEventEntryFromEntryNum(event,
CSRegistration, noOfEntries);
if (eventEntryCol != null && !eventEntryCol.isEmpty())
{
eventEntry = eventEntryCol.get(0);
}
return eventEntry;
}
/**
* This method forms XML format required to populate grid using DHTML
* @param formsXML
* @param studyFormContext
* @param dynamicRecId
* @param url
* @param frmCount
* @param serialNo
* @param dateString
* @param eventEntryForm
* @param isCsEventObj
* @return
*/
private StringBuffer formXml(StringBuffer formsXML, StudyFormContext studyFormContext,
String dynamicRecId, String url, int frmCount, int serialNo, String dateString,
EventEntryForm eventEntryForm, boolean isCsEventObj)
{
String operation = "";
if ("0".equals(dynamicRecId))
{
operation = Constants.ADVANCED_QUERY_ADD;
}
else
{
String csStatus = eventEntryForm.getCSActivityStatus();
String csrStatus = eventEntryForm.getCSRActivityStatus();
String partiStatus = eventEntryForm.getParticipantActivityStatus();
if ((csStatus != null && csStatus.equals(Constants.ACTIVITY_STATUS_CLOSED))
|| (csrStatus != null && csrStatus.equals(Constants.ACTIVITY_STATUS_CLOSED))
|| (partiStatus != null && partiStatus.equals(Constants.ACTIVITY_STATUS_CLOSED)))
{
operation = Constants.VIEW;
}
else
{
operation = Constants.ADVANCED_QUERY_EDIT;
}
}
if (readOnly)
{
operation = Constants.VIEW;
}
//String entryText = "Visit-";//+ frmCount;
formsXML.append("<row><cell>");
if(isCsEventObj)
{
//String entryText = "Visit-" + frmCount + dateString;
formsXML.append(frmCount);
formsXML.append("</cell><cell>");
formsXML.append(dateString);
formsXML.append("</cell><cell>");
}
formsXML.append(studyFormContext.getStudyFormLabel());
if(studyFormContext.getCanHaveMultipleRecords() && serialNo != 0)
{
formsXML.append(" (Record-" + serialNo + ")");
}
formsXML.append("</cell><cell>" + operation + "^" + url + "^_self</cell></row>");
return formsXML;
}
/**
* @param studyId
* @param participantId
* @param eventId
* @param regId
* @param eventEntryId
* @param entryNumber
* @return
*/
private String getEntryURL(String studyId, String participantId, String eventId, String regId,
String eventEntryId, int entryNumber)
{
StringBuffer eventEntryURL = new StringBuffer("LoadEventDetails.do?");
StringBuffer treeKey = new StringBuffer(Constants.EVENT_ENTRY_OBJECT);
treeKey.append("_" + eventId + "_0_0_" + regId + "_" + eventEntryId + "_" + entryNumber
+ "_0_0");
eventEntryURL.append(Constants.CP_SEARCH_PARTICIPANT_ID);
eventEntryURL.append("=");
eventEntryURL.append(participantId);
eventEntryURL.append("&");
eventEntryURL.append(Constants.CP_SEARCH_CP_ID);
eventEntryURL.append("=");
eventEntryURL.append(studyId);
eventEntryURL.append("&");
eventEntryURL.append(Constants.PROTOCOL_EVENT_ID);
eventEntryURL.append("=");
eventEntryURL.append(eventId);
eventEntryURL.append("&entryId=");
eventEntryURL.append(eventEntryId);
eventEntryURL.append("&treeViewKey=");
eventEntryURL.append(treeKey.toString());
eventEntryURL.append("&");
eventEntryURL.append(Utility.attachDummyParam());
return eventEntryURL.toString();
}
/**
*
* @param studyId
* @param participantId
* @param eventId
* @param formContext
* @param regId
* @param eventEntryId
* @param recEntryId
* @param dynamicRecId
* @return
*/
private String getDynamicRecordURL(String studyId, String participantId, String eventId,
StudyFormContext formContext, String regId, int eventEntryCount, String eventEntryId,
String recEntryId, String dynamicRecId)
{
StringBuffer url = new StringBuffer();
String objectName = "";
url.append("LoadDynamicExtentionsDataEntryPage.do?formId=");
url.append(formContext.getContainerId());
url.append("&" + Constants.CP_SEARCH_PARTICIPANT_ID + "=" + participantId);
url.append("&" + Constants.CP_SEARCH_CP_ID + "=" + studyId);
url.append("&" + AnnotationConstants.FORM_CONTEXT_ID + "=" + formContext.getId());
url.append("&" + Constants.PROTOCOL_EVENT_ID + "=" + eventId);
if (dynamicRecId != null && !dynamicRecId.equals("0"))
{
url.append("&recordId=");
url.append(dynamicRecId);
/*
* If the study form is having single record then set it's object name as
* SingleRecordFormEdit
*/
if (formContext.getCanHaveMultipleRecords())
{
objectName = Constants.FORM_CONTEXT_OBJECT;
}
else
{
objectName = Constants.SINGLE_RECORD_FORM_EDIT;
}
}
else
{
dynamicRecId = "0";
recEntryId = "0";
/*
* If the study form is having single record then set it's object name as
* SingleRecordForm
*/
if (formContext.getCanHaveMultipleRecords())
{
objectName = Constants.FORM_ENTRY_OBJECT;
}
else
{
objectName = Constants.SINGLE_RECORD_FORM;
}
}
StringBuffer buffer = new StringBuffer();
buffer.append(objectName);
buffer.append('_');
buffer.append(eventId);
buffer.append('_');
buffer.append(formContext.getContainerId());
buffer.append('_');
buffer.append(formContext.getId());
buffer.append('_');
buffer.append(regId);
buffer.append('_');
buffer.append(eventEntryId);
buffer.append('_');
buffer.append(eventEntryCount);
buffer.append('_');
buffer.append(recEntryId);
buffer.append('_');
buffer.append(dynamicRecId);
String treeViewKey = buffer.toString();
url.append("&");
url.append(AnnotationConstants.TREE_VIEW_KEY);
url.append("=");
url.append(treeViewKey);
url.append("&");
url.append(Constants.FORWARD_CONTROLLER);
url.append("=CSBasedSearch&");
url.append(Utility.attachDummyParam());
return url.toString();
}
/**
* @param strBuffer
* @param request
* @return
* @throws IOException
*/
private String generateXMLFile(StringBuffer strBuffer, HttpServletRequest request)
throws IOException
{
String xmlFileName = getFileName(request);
deleteXMLFilesIfExists(xmlFileName);
File outFile = new File(Variables.applicationHome + File.separator + xmlFileName);
FileWriter out = new FileWriter(outFile);
out.write(strBuffer.toString());
out.close();
return xmlFileName;
}
/**
* returns xmlFileName
* @param request
* @return
*/
private String getFileName(HttpServletRequest request)
{
String sessionId = request.getSession().getId();
return "gridData" + sessionId + Math.random() + ".xml";
}
/**
* Deleting existing XML file that starts with 'Test'
* @param baseFolder
*/
public void deleteXMLFilesIfExists(String filename)
{
File file = new File(Variables.applicationHome + File.separator + filename);
if (file.exists())
{
file.delete();
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
14fc21458849da9ada90a4fd4f256451418dcc60 | ba1b2b9d7f7ab3d025655c0d5ad9133f888fd59a | /src/exercicios/Heranca/ex1/Preguica.java | 167b1f9ff39fd1aa2c0aacc6004382f9adeb962f | [] | no_license | vinibol22/exercicios-java | c9593acee1587e4e411f24b0755e2e8ef8c45f48 | 8b376717808a39139a1846eb94f907809a4b8acf | refs/heads/main | 2023-07-02T02:39:05.747613 | 2021-08-11T21:25:15 | 2021-08-11T21:25:15 | 392,105,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package exercicios.Heranca.ex1;
public class Preguica extends Animal {
}
| [
"vinicius.vbb98@gmail.com"
] | vinicius.vbb98@gmail.com |
eef31322262203c708d7e8a0cf195cafd7d1df34 | e06ff6e129ffb5226b835a4c908a44db14a7a6db | /bsong/src/controller/AdminAddCatController.java | 80375bec3e7268fa006069729adbd5fd2d13bb31 | [] | no_license | hungqtc/Pxu | 4fe9c336092c18a1f2cc2b2d759ff67813cd99a3 | 838c2fe6fd827889d8ee14562c9f31e792516a14 | refs/heads/master | 2023-06-24T10:55:18.967774 | 2021-07-20T08:42:57 | 2021-07-20T08:42:57 | 276,290,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,567 | java | package controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.bean.Category;
import model.dao.CategoryDAO;
import utils.AuthUtil;
import utils.CodeMessageUtil;
public class AdminAddCatController extends HttpServlet {
private static final long serialVersionUID = 1L;
public AdminAddCatController() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if (!AuthUtil.isLogin(request)) {
response.sendRedirect(request.getContextPath()+"/auth/login");
return;
}
RequestDispatcher rd = request.getRequestDispatcher("/views/admin/cat/add.jsp");
rd.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
CategoryDAO catDAO = new CategoryDAO();
String name = request.getParameter("name");
//validation
Category objCat = new Category(name);
if (catDAO.addItem(objCat) > 0) {
//redirect admin/cat/index ==> display message
response.sendRedirect(request.getContextPath()+"/admin/cat/index?msg="+CodeMessageUtil.ADD_SUCCESS);
return;
} else {
response.sendRedirect(request.getContextPath()+"/admin/cat/add?msg="+CodeMessageUtil.ERROR);
}
}
}
| [
"hungqtc97@gmail.com"
] | hungqtc97@gmail.com |
15794f9b5683f3ce0f1f46d08b74456b93999b87 | 9d80f1673739384b31a90c92fe32e56daafdc8bf | /stackutils/src/main/java/icurious/stackutils/mToast.java | 279f76827c37f143ee50e6cd68032520621e4c5a | [] | no_license | meTowhid/mUtils | 9b780607575df7943e6786412b478f2d3beb5d95 | 6bb1edff9b740ba776090a64f2e88cf431fed201 | refs/heads/master | 2021-01-18T16:30:31.212862 | 2017-08-16T08:33:31 | 2017-08-16T08:33:31 | 100,461,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,054 | java | package icurious.stackutils;
import android.widget.Toast;
import static icurious.stackutils.StackUtils.sContext;
/**
* Created by Towhid on 8/16/17.
*/
public class mToast {
private static void check() {
if (sContext == null) {
throw new NullPointerException(
"Must initial call ToastUtils.register(Context context) in your " +
"<? " +
"extends Application class>");
}
}
public static void showShort(int resId) {
check();
Toast.makeText(sContext, resId, Toast.LENGTH_SHORT).show();
}
public static void showShort(String message) {
check();
Toast.makeText(sContext, message, Toast.LENGTH_SHORT).show();
}
public static void showLong(int resId) {
check();
Toast.makeText(sContext, resId, Toast.LENGTH_LONG).show();
}
public static void showLong(String message) {
check();
Toast.makeText(sContext, message, Toast.LENGTH_LONG).show();
}
}
| [
"towhid@stsbde.com"
] | towhid@stsbde.com |
2d882e012402cbabe46034395e9fd6e2a1b0d19b | 13e4a65f024d6b38079f33358c453a7ad0356e23 | /src/main/java/com/wen/crawler/dao/ChapterDao.java | d901e6e85921ef272219f55c114bb89833690ecc | [] | no_license | windy35/crawlerFiction | 88315bf71de98957af6efb20fb5c2ca3bc1be8d0 | d0be36a0906d53fbdf52ae1bcb0dac101ab69481 | refs/heads/master | 2022-09-09T01:39:50.173835 | 2020-03-23T09:23:01 | 2020-03-23T09:23:01 | 249,386,479 | 0 | 0 | null | 2022-09-01T23:21:52 | 2020-03-23T09:24:31 | Java | UTF-8 | Java | false | false | 629 | java | package com.wen.crawler.dao;
import com.wen.crawler.model.Chapter;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ChapterDao extends JpaRepository<Chapter, Long>{
@Query(value = "SELECT * FROM chapter where book_id=?1", nativeQuery = true)
List<Chapter> getByBookId(long bookId);
@Query(value = "SELECT * FROM chapter where book_id=?1 AND chapter_id=?2", nativeQuery = true)
Chapter getOneBookOneChapter(long bookId, long chapterId);
}
| [
"37435559+windy35@users.noreply.github.com"
] | 37435559+windy35@users.noreply.github.com |
bd634a87181c7292f70470651953c9fe63b66996 | 584b4aaa6dac0b213257f579b005926876829196 | /Test/src/com/day20190401/test1/Test.java | 897b30395b8e7ca9d1ed49b46a9f688025506835 | [] | no_license | GeekCracker/workspace_learn | 4595881e665cb6a0ee3617f0a92c818566b71d15 | 103b10e538cd3c0535ff2db8313eb1189a172b35 | refs/heads/master | 2023-01-23T00:26:20.261720 | 2023-01-12T15:47:50 | 2023-01-12T15:47:50 | 199,761,106 | 0 | 0 | null | 2022-06-21T04:10:00 | 2019-07-31T02:16:06 | Java | UTF-8 | Java | false | false | 190 | java | package com.day20190401.test1;
public class Test {
public static void main(String[] args) {
Integer num = null;
assert false : "333333333";
System.out.println(num.intValue());
}
}
| [
"1127766234@qq.com"
] | 1127766234@qq.com |
0b7a62f5dcbf32caff553c22cfcafe98d6774b20 | cdf45feab95cbf6670801c5b27e90ed3657d8ea7 | /firebaseconnector/src/main/java/it/cosenonjaviste/firebaseconnector/Survey.java | 6c28378f69f8b4e84422d5a99c4621adc3f52add | [] | no_license | fabioCollini/AndroidWearCodeLab | eb5895512d185d2a530f5fc078a3a179cff17b4c | 19009ba5d14a4ce8288e9924563758d5559824b1 | HEAD | 2016-08-11T06:25:27.031915 | 2015-11-04T08:08:39 | 2015-11-04T08:08:39 | 45,523,819 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,491 | java | package it.cosenonjaviste.firebaseconnector;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
import java.util.Map;
public class Survey {
private String question;
private Map<String, String> answers;
private long timestamp;
public Survey() {
}
public Survey(String question, Map<String, String> answers) {
this.question = question;
this.answers = answers;
}
public String getQuestion() {
return question;
}
public Map<String, String> getAnswers() {
return answers;
}
public int getYesCount() {
return countAnswers("yes");
}
public int getNoCount() {
return countAnswers("no");
}
private int countAnswers(String value) {
int tot = 0;
for (Map.Entry<String, String> entry : answers.entrySet()) {
if (value.equals(entry.getValue())) {
tot++;
}
}
return tot;
}
public String toJson() {
timestamp = System.currentTimeMillis();
return new Gson().toJson(this);
}
public static Survey parse(String json) {
return new Gson().fromJson(json, Survey.class);
}
@Nullable public String getUserAnswer(String userName) {
for (Map.Entry<String, String> entry : answers.entrySet()) {
if (userName.equals(entry.getKey())) {
return entry.getValue();
}
}
return null;
}
}
| [
"fabio.collini@gmail.com"
] | fabio.collini@gmail.com |
424a71c67645e9699bdec76e4046dcdcd0f70106 | 2192d57c99654e43be79b4246cf32a74bf85bb25 | /src/test/java/com/equiz/db/TestQuestionDAO.java | 6338798bf709f205abf94f752c30754d7193d06c | [] | no_license | bkalika/equiz | 8cf7509394bb3cf86e4d976597d2e08a904b8db5 | 443ba6c67c350075a0515728115bf82a0e64db72 | refs/heads/main | 2023-06-02T11:49:51.406635 | 2021-06-13T22:12:50 | 2021-06-13T22:12:50 | 373,502,696 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,781 | java | package com.equiz.db;
import java.util.List;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import static org.junit.Assert.*;
import org.apache.log4j.PropertyConfigurator;
import org.apache.naming.java.javaURLContextFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import com.equiz.db.daos.DAOFactory;
import com.equiz.db.dtos.Question;
import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
public class TestQuestionDAO {
static Context context;
@BeforeClass
public static void setupBeforeClass() throws Exception {
MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
PropertyConfigurator.configure("E:/JAVA/eclipse-workspace/equiz/src/main/webapp/WEB-INF/log4j.properties");
ds.setURL("jdbc:mysql://localhost:3306/testingsysdb");
ds.setUser("site");
ds.setPassword("site");
DataSource dataSource = ds;
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, javaURLContextFactory.class.getName());
context = new InitialContext();
Context ctx = context.createSubcontext("java");
ctx.createSubcontext("comp").createSubcontext("env").createSubcontext("jdbc")
.bind("testingsysdb", dataSource);
context.bind("java:", ctx);
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
context.destroySubcontext("java");
context.unbind("java:");
context.close();
}
@Test
public void findAllQuestionsTest() throws Exception {
List<Question> questions = DAOFactory.getQuestionDAO().findAll(68L);
assertNotNull(questions);
}
@Test
public void findQuestionTest() throws Exception {
Question question = DAOFactory.getQuestionDAO().find(54L);
assertEquals(question.getName(), "What is the fastest bird in the world?");
}
@Test
public void insertQuestionTest() throws Exception {
List<Question> questions = DAOFactory.getQuestionDAO().findAll(68L);
int size = questions.size();
DAOFactory.getQuestionDAO().insert("What is the fastest bird in the world?", 1L, 68L, true);
List<Question> questionsAfter = DAOFactory.getQuestionDAO().findAll(68L);
assertEquals(questionsAfter.size(), size+1);
}
@Test
public void deleteQuestionTest() throws Exception {
List<Question> questions = DAOFactory.getQuestionDAO().findAll(68L);
int size = questions.size();
DAOFactory.getQuestionDAO().delete(51L);
List<Question> questionsAfter = DAOFactory.getQuestionDAO().findAll(68L);
assertEquals(questionsAfter.size(), size);
}
@Test
public void updateQuestionTest() throws Exception {
DAOFactory.getQuestionDAO().update(54L, "What is the fastest bird in the world?", 2L, true);
Question question = DAOFactory.getQuestionDAO().find(54L);
assertEquals(question.getScore(), 2L);
}
}
| [
"bogdan.kalika@gmail.com"
] | bogdan.kalika@gmail.com |
f6de3c5b8b83cd8f1f94822ba738a9784c988a6e | f2d53c6e4f5488168cb47ef0c6551667bcbc8d62 | /Djikstra/djikstra2.java | 83d4d93a73a8cd9eca4dc6fc7b6e645ded12b072 | [
"MIT"
] | permissive | ropok/tutorialProgrammingII | 820488ac7235ff00d7fb5c0f6f101edc8f9c2d22 | 4f3f1654b6e7a75baf889c05b0889ea936c6dd1c | refs/heads/master | 2020-04-11T00:37:58.882703 | 2018-05-25T06:04:41 | 2018-05-25T06:04:41 | 124,314,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,211 | java |
public class djikstra2{
public static void main(String[] args){
System.out.println("Hello Djikstra");
// Variable Array to store the edge's value
// [vert1][vert2]
int[][] route;
int start, finish;
int destination, currVert;
int size = 4;
int newEdge;
int[] edge,pointEdge;
edge = new int[size];
pointEdge = new int[size];
route = new int[size][size];
// edgeTable = new int[size][size];
// anArray[1][1] = 100;
// System.out.println(anArray[1][2]);
// -- Init edges (the route)
route[0][1] = 1;
route[0][2] = 2;
route[0][3] = 10;
route[2][3] = 2;
// -- Start the tabeling
start = 0;
finish = 2;
for (int i=0;i<size;i++){ // currVert
currVert = i;
// System.out.print(currVert);
for (int j=0;j<size;j++){ // the destination
destination = j;
if(destination != start){
if(route[currVert][destination]!=0){
newEdge = edge[currVert] + route[currVert][destination];
System.out.println(currVert + " -> " + destination + " " + newEdge);
if(newEdge <= edge[destination]){ // Found the shorter one
edge[destination] = newEdge;
}
else edge[destination] = newEdge;
// if(newEdge != 0 && newEdge <= edge[destination]){
// edge[destination] = newEdge;
// // pointEdge[currVert] = currVert;
// }
// System.out.println(destination + " " + newEdge);
// System.out.println(edge[currVert]);
// System.out.println(route[currVert][destination]);
}
}
}
}
System.out.println(edge[finish]);
// if(anArray[1][2] == 0){
// System.out.println("'null'");
// }
}
} | [
"jalerse@gmail.com"
] | jalerse@gmail.com |
cecb95f55745f32e1db9e4cb2c14a59eaa711266 | 892a7d07368e64e884b14b84c6659ffbe073f533 | /User_Input/src/Userdelimiter.java | 5edd3fcd3f774accfc9831549e20db17d9ad5292 | [
"Apache-2.0"
] | permissive | Alok255/Core-Java-Code-Practice | 3c812e0db2af96044f3ee7df9a71c0f832520438 | d72f5cf770f2759b795b37b5989932f767154b23 | refs/heads/master | 2021-08-26T09:12:43.801394 | 2017-11-22T19:35:49 | 2017-11-22T19:35:49 | 111,722,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | import java.io.Closeable;
import java.util.Scanner;
public class Userdelimiter {
public static void main(String[] args) {
// TODO Auto-generated method stub
String input = "10 tea 20 coffee 30 tea buiscuits";
Scanner s = new Scanner(input).useDelimiter("\\s");
System.out.println(s.nextInt());
System.out.println(s.next());
System.out.println(s.nextInt());
System.out.println(s.next());
System.out.println(s.nextLine());
s.close();
}
}
| [
"alokrajsingh255@gmail.com"
] | alokrajsingh255@gmail.com |
c9c0519f99c4a64859623ab8329a6f981768b9b9 | cdceb0cd5840af01e21dd21b2648f571c840e53d | /src/main/java/win/hupubao/mapper/hupubao/ArticleTagMapper.java | fd7525e3d343722e5dd74a6f3d3e1aa4a292f868 | [] | no_license | ysdxz207/hupubao | 3175935a22e4c1c0e06e11f3399caba24767f556 | 697edf2e278acd906999576d1e2708f5cbe3d6df | refs/heads/master | 2020-03-23T22:29:54.512721 | 2019-01-18T06:23:18 | 2019-01-18T06:23:18 | 52,258,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package win.hupubao.mapper.hupubao;
import org.springframework.stereotype.Repository;
import win.hupubao.domain.ArticleTag;
import win.hupubao.utils.mybatis.MyMapper;
@Repository
public interface ArticleTagMapper extends MyMapper<ArticleTag> {
}
| [
"ysdxz207@qq.com"
] | ysdxz207@qq.com |
6ad07d3dfd15c0750b204445ccf1165976c20693 | 4b89ee01156a70b6fe04bf6421334563e903ef5d | /BeerWindow/src/main/java/com/tetsuchem/beerwindow/fragment/TwitterFragment.java | cf196ea917564af00c8684eb8ace8b954561b660 | [] | no_license | matsuo0/BeerWindows | c1264ac31a1318e23c5617080837b8881f82ab7a | 3f6aa776dfc925c8db0e055b6757ad42a4f0fce0 | refs/heads/master | 2016-09-06T06:34:57.993474 | 2014-03-06T05:45:36 | 2014-03-06T05:45:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,931 | java | package com.tetsuchem.beerwindow.fragment;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.loopj.android.image.SmartImageView;
import com.tetsuchem.beerwindow.R;
import com.tetsuchem.beerwindow.TwitterOAuthActivity;
import com.tetsuchem.beerwindow.util.SwipeDetector;
import com.tetsuchem.beerwindow.util.TwitterUtils;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import twitter4j.HashtagEntity;
import twitter4j.Query;
import twitter4j.QueryResult;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
public class TwitterFragment extends Fragment {
private static final String TAG = TwitterFragment.class.getName();
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
static final private String hashTaga = "swallows";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private ListView lvTweet;
TweetAdapter adapter;
TweetAdapter adapterShow;
private Twitter twitter;
private int count;
private int position;
Timer timer = null;
Timer reloadTimer = null;
Handler handler;
SharedPreferences sharedPreferences;
private String hashTag;
private int refreshTime;
private int scrollTime;
Preference preference;
//sharedPreferences = getPreferences(MODE_PRIVATE);
//sharedPreferences.getInt(,);
//sharedPreferences.getInt(,);
//sharedPreferences.getString(,);
//scroll_ad_frequency
//twitter_hash
//sync_twitter_frequency
//scroll_twitter_frequency
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment BlankFragment.
*/
// TODO: Rename and change types and number of parameters
public static TwitterFragment newInstance(String param1, String param2) {
TwitterFragment fragment = new TwitterFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
public TwitterFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
hashTag = sharedPreferences.getString("twitter_hash", "swallows");
refreshTime = Integer.valueOf(sharedPreferences.getString("sync_twitter_frequency", "50000"));
scrollTime = Integer.valueOf(sharedPreferences.getString("scroll_twitter_frequency", "5000"));
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_twitter, container, false);
lvTweet = (ListView)view.findViewById(R.id.lvTwitter);
initializeUI();
return view;
}
public void initializeUI(){
if (!TwitterUtils.hasAccessToken(getActivity())) {
Intent intent = new Intent(getActivity(), TwitterOAuthActivity.class);
startActivity(intent);
getActivity().finish();
} else {
adapter = new TweetAdapter(getActivity(), 0);
adapterShow = new TweetAdapter(getActivity(), 0);
lvTweet.setAdapter(adapterShow);
twitter = TwitterUtils.getTwitterInstance(getActivity());
reloadTimeLine();
}
final Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_out);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (adapterShow.getCount() > 0){
adapterShow.clear();
position = position + 1;
if (position == count){
position = 0;
}
adapterShow.add(adapter.getItem(position));
}
adapterShow.notifyDataSetChanged();
}
});
final Animation animation_in = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in);
animation_in.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (adapterShow.getCount() > 0){
adapterShow.clear();
position = position + 1;
if (position == count){
position = 0;
}
adapterShow.add(adapter.getItem(position));
}
adapterShow.notifyDataSetChanged();
}
});
final SwipeDetector swipeDetector = new SwipeDetector();
lvTweet.setOnTouchListener(swipeDetector);
lvTweet.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (swipeDetector.swipeDetected()){
switch (swipeDetector.getAction()){
case LR:
view.startAnimation(animation);
break;
default :
break;
}
}
}
});
timer = new Timer(true);
handler = new Handler(); // (1)
timer.schedule( new TimerTask(){
@Override
public void run() {
// mHandlerを通じてUI Threadへ処理をキューイング
handler.post( new Runnable() {
public void run() {
lvTweet.startAnimation(animation_in);
}
});
}
}, scrollTime, scrollTime);
reloadTimer = new Timer(true);
reloadTimer.schedule(new TimerTask() {
@Override
public void run() {
reloadTimeLine();
}
}, refreshTime, refreshTime);
}
private class TweetAdapter extends ArrayAdapter<Status> {
private LayoutInflater mInflater;
public TweetAdapter(Context context, int textViewResourceId){
super(context, textViewResourceId);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public TweetAdapter(Context context, int textViewResourceId, List<Status> objects){
super(context, textViewResourceId, objects);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater
.inflate(R.layout.tweet_item, null);
holder = new ViewHolder();
// Icon
holder.vIcon = (SmartImageView) convertView.findViewById(R.id.ivIcon);
// 名前
holder.vName = (TextView) convertView.findViewById(R.id.tvName);
//holder.vName.setTextColor(getResources().getColor(android.R.color.black));
// ID
holder.vID = (TextView) convertView.findViewById(R.id.tvID);
//holder.vID.setTextColor(getResources().getColor(android.R.color.black));
// 書き込み日付
holder.vDateTime = (TextView) convertView.findViewById(R.id.tvDateTime);
//holder.vDateTime.setTextColor(getResources().getColor(android.R.color.black));
// Tweet
holder.vTweet = (TextView) convertView.findViewById(R.id.tvTweet);
//holder.vTweet.setTextColor(getResources().getColor(android.R.color.black));
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
//final BeerInfo beerInfo = this.getItem(position);
Status item = getItem(position);
if (item != null) {
holder.vIcon.setImageUrl(item.getUser().getProfileImageURL());
holder.vName.setText(item.getUser().getName());
//holder.vID.setText("@" + item.getUser().getScreenName() + " : " + String.valueOf(item.getId()));
holder.vID.setText("@" + item.getUser().getScreenName());
holder.vDateTime.setText(String.valueOf(item.getCreatedAt()));
holder.vTweet.setText(item.getText());
}
return convertView;
}
class ViewHolder {
SmartImageView vIcon;
TextView vName;
TextView vID;
TextView vDateTime;
TextView vTweet;
}
}
private void reloadTimeLine() {
AsyncTask<Void, Void, List<Status>> task = new AsyncTask<Void, Void, List<Status>>() {
@Override
protected List<twitter4j.Status> doInBackground(Void... params) {
// Log.d(TAG, "doInBackground()--Start");
try {
Query query = new Query();
//1度のリクエストで取得するTweetの数(100が最大)
query.setCount(30);
query.setLang("ja");
query.setQuery("#" + hashTag);
//query.setQuery(hashTaga);
QueryResult result = twitter.search(query);
return result.getTweets();
} catch (TwitterException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(List<twitter4j.Status> result) {
Log.d(TAG, "onPostExecute()--Start");
if (result != null) {
adapter.clear();
for (twitter4j.Status status : result) {
HashtagEntity[] hashtagEntity = status.getHashtagEntities();
for (HashtagEntity hashTags : hashtagEntity){
if (hashTags.getText().equals(hashTag)){
adapter.add(status);
// Log.d(TAG, status.getCreatedAt().toLocaleString() + "-" + status.getText());
}
}
// Log.d(TAG, status.getCreatedAt().toLocaleString() + "-" + status.getText());
}
adapterShow.clear(); // Adapterに登録するのは1つのみ
if (adapter.getCount() > 0) {
adapterShow.add(adapter.getItem(0));
}
count = adapter.getCount();
position = 0;
lvTweet.setSelection(0);
} else {
}
Log.d(TAG, "onPostExecute()--End");
}
};
task.execute();
}
}
| [
"uno831@gmail.com"
] | uno831@gmail.com |
891c794d7af2ccf2252bcb63be8fdee343cfe144 | f5a551d3b217c0d6caf044eaba50298792d49453 | /src/main/java/com/longshao/Test/Test2_SigninController.java | f9c9fb69dafca51cc2ed40d7aafa95be4ef363f3 | [] | no_license | qlh2561808384/SshProject | 14f0205b897fd66c41e8199840646c51a1970808 | e3046b94a1510f71fdf7ffb1d2e42613e3349961 | refs/heads/master | 2022-12-23T01:04:36.400871 | 2019-08-01T07:18:47 | 2019-08-01T07:18:47 | 199,978,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,911 | java | /**
* Hangzhou Lejian Technology Co., Ltd.
* Copyright (c) 2019 All Rights Reserved.
*/
package com.longshao.Test;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 用户注册入口
*
* @author qilonghui
*
*/
@Controller
public class Test2_SigninController {
/**
* TODO 请从这里开始补充代码
*
* 测试1:138 1234 1234
* 结果:通过此手机号注册成功
*
* 测试2:13812345abc
* 结果:通知本手机号无法注册,提示为非法手机号
*
* 测试3:13812345678
* 结果:通知此手机号注册成功
*
* 测试4:138 1234 5678
* 结果:提示此手机号已经被其他用户注册
*
* 测试5:98765432101
* 结果:此手机号码为中国大陆非法手机号码
*/
private static final int NumOfPho = 11;
public String checkPhone(String str, HttpSession session) {
String checkmsg = "";
// int NumOfPho = 11;
//手机号去空格
String phone = str.replaceAll("\\s+", "");
String ssionpho = session.getAttribute(phone) == null ? "" : session.getAttribute(phone).toString();
//校验手机号正则表达式
String PHONE_NUMBER_REG = "^(1[3-9])\\d{9}$";
Pattern pattern = null;
Matcher matcher = null;
boolean b = false;
//判断手机号是否包含非法字符
boolean checkletter = Pattern.compile("[^0-9]").matcher(phone).find();
if (!checkletter) {
if (NumOfPho == phone.length()) {
if (phone.equals(ssionpho)) {
checkmsg += "此手机号已经被其他用户注册";
} else {
pattern = Pattern.compile(PHONE_NUMBER_REG);
matcher = pattern.matcher(phone);
b = matcher.matches();
if (b) {
checkmsg += "手机号注册成功";
session.setAttribute(phone, phone);
} else {
checkmsg += "此手机号为中国大陆非法手机号";
}
}
} else {
checkmsg += "手机号应为11位";
}
} else {
checkmsg += "手机号" + str + "为非法手机号,无法注册";
}
return checkmsg;
}
@RequestMapping("check")
@ResponseBody
public void checkphone(HttpSession session) {
//TODO 测试1
String phone1 = "14567";//校验手机位数
//TODO 测试2
String phone2 = "138 1234 1234";//手机号注册成功
//TODO 测试3
String phone3 = "13812345abc";//记号无法注册 非法手机号
//TODO 测试4
String phone4 = "13812345678";//手机号注册成功
//TODO 测试5
String phone5 = "138 1234 5678";//手机号已经被其他用户注册
//TODO 测试6
String phone6 = "98765432101";//此手机号为中国大陆非法手机号
//测试
String phonCheck = checkPhone(phone1, session);
System.out.println(phonCheck);
}
}
| [
"2561808384@qq.com"
] | 2561808384@qq.com |
c28002a0c53e31fbce2d588003aa09919eee7676 | 69736cac0f131234afe0c6aa02e2ac4679f42874 | /Dddml.Wms.JavaCommon/src/org/dddml/wms/domain/OrganizationStateEventIdDto.java | 5d8f3c547054ebd76c039265d5c9697e65a4efcc | [] | no_license | 573000126/wms-4 | 4455f5238eb651a5026c15bdcbea9071cfb9c5de | 7ed986e44a8a801b221288511e7f23c76548d2e9 | refs/heads/master | 2021-03-10T22:28:53.440247 | 2016-08-18T09:32:17 | 2016-08-18T09:32:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,275 | java | package org.dddml.wms.domain;
public class OrganizationStateEventIdDto
{
private OrganizationStateEventId value;
public OrganizationStateEventIdDto()
{
this(new OrganizationStateEventId());
}
public OrganizationStateEventIdDto(OrganizationStateEventId value)
{
this.value = value;
}
public OrganizationStateEventId toOrganizationStateEventId()
{
return this.value;
}
public String getOrganizationId()
{
return this.value.getOrganizationId();
}
public void setOrganizationId(String organizationId)
{
this.value.setOrganizationId(organizationId);
}
public Long getVersion()
{
return this.value.getVersion();
}
public void setVersion(Long version)
{
this.value.setVersion(version);
}
@Override
public boolean equals(Object obj)
{
if (obj == this) {
return true;
}
if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
OrganizationStateEventIdDto other = (OrganizationStateEventIdDto)obj;
return value.equals(other.value);
}
@Override
public int hashCode()
{
return value.hashCode();
}
}
| [
"yangjiefeng@gmail.com"
] | yangjiefeng@gmail.com |
df70b32d4dbf80bd0190c1557fa6fff14e52ae75 | 6b1497e325d6ca5d08db7740cb9856a3e1917a87 | /src/mag5/draw/Bounds.java | 9a1b588349537b1abd87e7ff81c576c5b56920af | [] | no_license | johanley/bobcaygeon | fbb8150bccb3efcb7db194860d3a4dba2f0b3206 | fe9d664922675418b3c6b2e5e0fcc5e2fa554efe | refs/heads/master | 2020-08-02T20:35:47.148374 | 2020-07-13T19:01:51 | 2020-07-13T19:01:51 | 211,498,970 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,005 | java | package mag5.draw;
/**
The bounds of the area shown by a chart, and related data derived from the bounds.
WARNING: the units are in degrees and hours only!
*/
public class Bounds {
public Bounds(Double minDecDeg, Double maxDecDeg, Double minRaHours, Double maxRaHours) {
this.minDecDeg = minDecDeg;
this.maxDecDeg = maxDecDeg;
this.minRaHours = minRaHours;
this.maxRaHours = maxRaHours;
}
public Double minDecDeg;
public Double maxDecDeg;
public Double minRaHours;
public Double maxRaHours;
/** Right ascension of the center of the equatorial chart.*/
public Double raCenterHours() {
double max = maxRaHours;
if (maxRaHours < minRaHours) {
//straddles 0h
max = max + 24;
}
return (max + minRaHours)/2.0;
}
/** Half the width in right ascension of the equatorial chart. */
public Double raHalfWidthHours() {
double w = maxRaHours - minRaHours;
if (w < 0) {
//straddles 0h
w = w + 24;
}
return w/2.0;
}
/** True only if the chart is for north of the celestial equator. */
public boolean isNorth() {
return maxDecDeg >= 0 && minDecDeg >= 0;
}
/** True only if the chart is equatorial, not polar. */
public boolean isEquatorial() {
return minDecDeg == 0 || maxDecDeg == 0;
}
/** True only if the chart is polar, not equatorial. */
public boolean isPolar() {
return ! isEquatorial();
}
/**
Return true only if the chart is an upper chart, not a lower chart.
When using the charts, they are held sideways, with one upper chart, and one lower chart, across two pages.
*/
public boolean isTopChart() {
boolean result = false;
if (isEquatorial()) {
if (Hemisphere.NORTH == ChartUtil.HEMISPHERE) {
result = maxDecDeg > 0;
}
else {
result = maxDecDeg == 0;
}
}
else {
boolean topNorthPole = maxDecDeg == 90 && raCenterHours() > 12;
boolean topSouthPole = maxDecDeg < 0 && raCenterHours() < 12;
result = topNorthPole || topSouthPole;
}
return result;
}
/** Equatorial charts only. This situation requires special handling. */
public boolean straddlesVernalEquinox() {
return maxRaHours < minRaHours;
}
/** Return the declination that is furtherst from the pole. Retains the sign. ONLY WORKS for polar charts. */
public double decFurthestFromPole() {
double result = 0.0;
if (isNorth()) {
result = minDecDeg;
}
else {
result = maxDecDeg;
}
return result;
}
/** Return the declination furthest from the celestial equator. Retains the sign. ONLY WORKS for equatorial charts. */
public double decFurthestFromEq() {
double result = 0.0;
if (isNorth()) {
result = maxDecDeg;
}
else {
result = minDecDeg;
}
return result;
}
/** The maximum declination less the minumumb declination. Always positive! */
public double decRange() {
return maxDecDeg - minDecDeg;
}
}
| [
"webmaster@javapractices.com"
] | webmaster@javapractices.com |
e9f8a150de79351edbe54693f46133abff391caf | 10e35f47583b6f0b1d79a7694f55f1037072b035 | /latte-ui/src/main/java/com/flj/latte/ui/launcher/LauncherHolder.java | 4c8befa26d6e12f2dbd71c80bb49d0f9240e5127 | [] | no_license | DolphZiggler/order_print | f80549abfa6dd480242aa696974f62b3e17cef24 | 785187be078c3389153e05059634c5fc66960241 | refs/heads/master | 2020-03-21T22:10:18.383365 | 2018-06-29T08:43:16 | 2018-06-29T08:43:16 | 139,108,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | package com.flj.latte.ui.launcher;
import android.content.Context;
import android.support.v7.widget.AppCompatImageView;
import android.view.View;
import com.bigkoo.convenientbanner.holder.Holder;
/**
* Created by gg on 2017/4/22
*/
public class LauncherHolder implements Holder<Integer> {
private AppCompatImageView mImageView = null;
@Override
public View createView(Context context) {
mImageView = new AppCompatImageView(context);
return mImageView;
}
@Override
public void UpdateUI(Context context, int position, Integer data) {
mImageView.setBackgroundResource(data);
}
}
| [
"2814240322@qq.com"
] | 2814240322@qq.com |
189ba6e0b19b936520d5535b5162342d0df19477 | aeb932b777a87f8db00bf4b043c2b6a30876d95b | /wechat-frameword/src/main/java/com/water/wechat/framework/message/resp/NewsMessage.java | b8a5b22095c1d89a91729d2ab1c4e14383538f13 | [] | no_license | zhangxiaoxu132113/mw-weichart | b26e4fc8f1e836ed58479798704ca939f0382fdc | 47dd0d8c11fafc2fcb8579ea22a165f79cbd2bbe | refs/heads/master | 2020-12-02T22:39:54.314388 | 2017-08-22T10:01:11 | 2017-08-22T10:01:11 | 96,163,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package com.water.wechat.framework.message.resp;
import java.util.List;
/**
* ClassName: NewsMessage
* @Description: 多图文消息
*/
public class NewsMessage extends BaseMessage {
// 图文消息个数,限制为10条以内
private int ArticleCount;
// 多条图文消息信息,默认第一个item为大图
private List<Article> Articles;
public int getArticleCount() {
return ArticleCount;
}
public void setArticleCount(int articleCount) {
ArticleCount = articleCount;
}
public List<Article> getArticles() {
return Articles;
}
public void setArticles(List<Article> articles) {
Articles = articles;
}
}
| [
"136218949@qq.com"
] | 136218949@qq.com |
2c67ef24ba50214ee447e78c032ee12f9d8f623b | ace322a5ecedca360a8a7271cd84cc13e5b01197 | /forge-gui-desktop/src/main/java/forge/itemmanager/filters/CardCMCRangeFilter.java | b79602c991ec10b9e5e2a780a61e103859aa73f0 | [] | no_license | diab0l/mtg-forge | 32d4739f99d201b04b81c1b9bfe3a09260f98143 | 3277a0c2e02dabca5b03f365c593e6ce8091e317 | refs/heads/master | 2021-01-17T06:09:49.780171 | 2016-01-26T17:51:32 | 2016-01-26T17:51:32 | 50,458,943 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,075 | java | package forge.itemmanager.filters;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import forge.card.CardRules;
import forge.card.CardRulesPredicates;
import forge.item.PaperCard;
import forge.itemmanager.ItemManager;
/**
* TODO: Write javadoc for this type.
*
*/
public class CardCMCRangeFilter extends ValueRangeFilter<PaperCard> {
public CardCMCRangeFilter(ItemManager<? super PaperCard> itemManager0) {
super(itemManager0);
}
@Override
public ItemFilter<PaperCard> createCopy() {
return new CardCMCRangeFilter(itemManager);
}
@Override
protected String getCaption() {
return "CMC";
}
@Override
protected Predicate<PaperCard> buildPredicate() {
Predicate<CardRules> predicate = getCardRulesFieldPredicate(CardRulesPredicates.LeafNumber.CardField.CMC);
if (predicate == null) {
return Predicates.alwaysTrue();
}
return Predicates.compose(predicate, PaperCard.FN_GET_RULES);
}
}
| [
"drdev@269b9781-a132-4a9b-9d4e-f004f1b56b58"
] | drdev@269b9781-a132-4a9b-9d4e-f004f1b56b58 |
05f1b1804ee2e98676d13c0ab422a56c73e3fac8 | b7227b43cd5d43d8fb0599ed07f06538daf14763 | /src/db/DBConnectionFactory.java | f1130e8b70c44298fbe5f9f4fd64f1cbc7220b03 | [] | no_license | FGrace/Jupite | 6aed73e8dd04912645867816bff692c1aa3a8782 | 62e255573c34d1bc966c251c43cd62aff56c66ef | refs/heads/master | 2020-03-28T13:06:34.346550 | 2018-09-11T19:23:32 | 2018-09-11T19:23:32 | 148,367,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | java | package db;
import db.mongodb.MongoDBConnection;
import db.msql.MySQLConnection;
public class DBConnectionFactory {
private static final String DEFAULT_DB = "mongodb";
public static DBConnection getConnection(String db) {
switch(db) {
case "mysql":
return new MySQLConnection();
case "mongodb":
//return new MongoDBConnection();
return new MongoDBConnection();
default:
throw new IllegalArgumentException("Invalid db: " + db);
}
}
public static DBConnection getConnection() {
return getConnection(DEFAULT_DB);
}
}
| [
"jiefang2012@u.northwestern.edu"
] | jiefang2012@u.northwestern.edu |
7f74fd9096852a0f6a9a592bd99b3af4ad2dd04e | ba8b1d98b56e2cb0648cbfbd382059b0909b5e1f | /mediaplayer/src/test/java/com/media/player/ExampleUnitTest.java | bcde16d84df12153d148442ab3c0614b4804b0d9 | [] | no_license | zhaotong/MediaPlayer | 80600508d1dbbbecbd43804cd86d9ae4e4551a62 | 1190a5cf88bbd35aee1e21ca3a3c0fef83733573 | refs/heads/master | 2020-09-05T00:00:33.336791 | 2019-11-06T06:39:29 | 2019-11-06T06:39:29 | 219,929,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package com.media.player;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"tone@thecover.co"
] | tone@thecover.co |
b89cd014a5a55f3196d557d2b94c87ac80853abd | ce538beb7e43357f60cf9cb291fe10e8a7b2076a | /spring-cloud/config-server/src/main/java/com/example/config/ConfigServerApplication.java | face2100409df1ab879b34c3a94bec738a6c3658 | [] | no_license | kaiserkli/SpringCloud2 | 2a20bf2fad5f3a74b2fca0c384c07ffd6d813d2d | 6905addffad94011bdb609537a075e9ba99343e3 | refs/heads/master | 2020-04-23T14:29:09.603192 | 2019-03-13T08:35:32 | 2019-03-13T08:35:32 | 171,232,959 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package com.example.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
| [
"lit@acsm.cn"
] | lit@acsm.cn |
dff963c82ef3aa4b1f668ce70c5236b87d663ace | c9031206be0be3fa70de1689d5448807c4f4609b | /pigeon-core/src/main/java/payne/framework/pigeon/core/exception/SignerException.java | 7e5f69a0d9a5ea7067b673eef1f3a29c0fb953a1 | [] | no_license | liangmingjie/pigeon | 3d2dff89c32a94c44914cb1d15ef2ca4f4a190f8 | a1076afda2cab8ac6aa0f5d41c1f086f45948ef6 | refs/heads/master | 2020-12-03T05:12:25.785988 | 2016-01-07T07:21:10 | 2016-01-07T07:21:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | java | package payne.framework.pigeon.core.exception;
public class SignerException extends Exception {
private static final long serialVersionUID = 2868413020300168866L;
public SignerException() {
super();
}
public SignerException(String message, Throwable cause) {
super(message, cause);
}
public SignerException(String message) {
super(message);
}
public SignerException(Throwable cause) {
super(cause);
}
}
| [
"646742615@qq.com"
] | 646742615@qq.com |
6e74454490c068c3e5ba2a421d9176e853b84e8a | 4a089c2fea62a203dc6b9514bd1a195774d9c1d4 | /SummaryTask04_2/SummaryTask04_2/src/ua/nure/kolodiazhny/SummaryTask04_2/web/model/entity/CatalogBean.java | a6c0d5ed0a9a2b7c40b30163d2476b84d31379e5 | [] | no_license | kolodyazhny/SummaryTask04_2 | 96cbeef3a9cd9f56a5de8c4cd384ac037fcd35bb | e27f85dd95a785213e050755d403c824b1605934 | refs/heads/master | 2020-12-30T23:50:00.864520 | 2017-01-31T19:40:15 | 2017-01-31T19:40:15 | 80,554,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,494 | java | package ua.nure.kolodiazhny.SummaryTask04_2.web.model.entity;
import java.io.Serializable;
/**
* Used for representation catalog table from database.
*
* @author Nikolay Kolodiazhny
* @version 1.0
*
*/
public class CatalogBean implements Serializable {
/**
* Contains serial number.
*/
private static final long serialVersionUID = -8339906049337470895L;
/**
* Title of product.
*/
private String title;
/**
* Article of product.
*/
private String article;
/**
* Desc_1 of product.
*/
private String desc_1;
/**
* Desct_2 of product.
*/
private String desc_2;
/**
* Price of product.
*/
private Double price;
/**
* Contains link to another one language table.
*/
private LanguageBean langId;
/**
* Date when product was added.
*/
private String date;
/**
* Path to image.
*/
private String path;
/**
* Amount of available products.
*/
private Integer amount;
/////////////////////////////////
// BELOW ARE GETTERS AND SETTERS//
/////////////////////////////////
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getArticle() {
return article;
}
public void setArticle(String article) {
this.article = article;
}
public String getDesc_1() {
return desc_1;
}
public void setDesc_1(String desc_1) {
this.desc_1 = desc_1;
}
public String getDesc_2() {
return desc_2;
}
public void setDesc_2(String desc_2) {
this.desc_2 = desc_2;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public LanguageBean getLangId() {
return langId;
}
public void setLangId(LanguageBean langId) {
this.langId = langId;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Integer getAmount() {
return amount;
}
public void setAmount(Integer amount) {
this.amount = amount;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((amount == null) ? 0 : amount.hashCode());
result = prime * result + ((article == null) ? 0 : article.hashCode());
result = prime * result + ((date == null) ? 0 : date.hashCode());
result = prime * result + ((desc_1 == null) ? 0 : desc_1.hashCode());
result = prime * result + ((desc_2 == null) ? 0 : desc_2.hashCode());
result = prime * result + ((langId == null) ? 0 : langId.hashCode());
result = prime * result + ((path == null) ? 0 : path.hashCode());
result = prime * result + ((price == null) ? 0 : price.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CatalogBean other = (CatalogBean) obj;
if (amount == null) {
if (other.amount != null)
return false;
} else if (!amount.equals(other.amount))
return false;
if (article == null) {
if (other.article != null)
return false;
} else if (!article.equals(other.article))
return false;
if (date == null) {
if (other.date != null)
return false;
} else if (!date.equals(other.date))
return false;
if (desc_1 == null) {
if (other.desc_1 != null)
return false;
} else if (!desc_1.equals(other.desc_1))
return false;
if (desc_2 == null) {
if (other.desc_2 != null)
return false;
} else if (!desc_2.equals(other.desc_2))
return false;
if (langId == null) {
if (other.langId != null)
return false;
} else if (!langId.equals(other.langId))
return false;
if (path == null) {
if (other.path != null)
return false;
} else if (!path.equals(other.path))
return false;
if (price == null) {
if (other.price != null)
return false;
} else if (!price.equals(other.price))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
return true;
}
@Override
public String toString() {
return "CatalogBean [title=" + title + ", article=" + article + ", desc_1=" + desc_1 + ", desc_2=" + desc_2
+ ", price=" + price + ", langId=" + langId + ", date=" + date + ", path=" + path + ", amount=" + amount
+ "]";
}
} | [
"kolyan199410@meta.ua"
] | kolyan199410@meta.ua |
e0f7a2481b686728470c4a5622a1d9525d765ee4 | bdb7569ba5a4acc66971cdd108c1ec125f910f11 | /Strategy/src/Main.java | a4f968553537771794d9c246f8e480e68f08e13a | [
"MIT"
] | permissive | resont/design-patterns | 7d9c8832152782723f7a57fb049190fa748fe545 | e1cf86d1418d9c58003ecf9cd4d948072cf90f97 | refs/heads/master | 2020-09-09T19:40:22.500269 | 2019-12-17T20:44:59 | 2019-12-17T20:44:59 | 221,545,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | import java.util.Map;
public class Main {
public static void main(String[] args) {
Map <String,Double> Artykuly = Map.of("CocaCola",1.99,"Mars",2.99,"KitKat",3.99);
PodatekPolska PL = new PodatekPolska();
PodatekNiemcy GER = new PodatekNiemcy();
Zamowienie zamowienie = new Zamowienie(PL,Artykuly);
System.out.println("Polska:");
zamowienie.obliczPodatek();
System.out.println("\nNiemcy:");
zamowienie.kraj(GER);
zamowienie.obliczPodatek();
}
}
| [
"wojtasfor@gmail.com"
] | wojtasfor@gmail.com |
04284fa97333d99ba1418fca26a7da3b18d52d8c | 0c741344df7a46e65283bdf6eb1c445c91099ca0 | /cool-erp/sale/src/main/java/com/sopra/coolerp/sale/service/SaleServiceImpl.java | d661a422a3dd8373bab839aa9ffdaac28893de3b | [] | no_license | odume/spring-cloud-sopra-exercise | 89a5c06cbe79c7885dc9a0b99c3d96f7beec0607 | 77f562240b385d38c334f403f61da1281413d467 | refs/heads/master | 2021-01-01T16:16:47.492881 | 2017-07-21T21:29:01 | 2017-07-21T21:29:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 497 | java | package com.sopra.coolerp.sale.service;
import org.springframework.stereotype.Service;
import com.sopra.coolerp.sale.model.Sale;
import com.sopra.coolerp.sale.model.SaleRepository;
@Service
public class SaleServiceImpl implements SaleService {
private SaleRepository saleRepository;
public SaleServiceImpl(SaleRepository saleRepository) {
this.saleRepository = saleRepository;
}
@Override
public Sale save(Sale sale) {
return saleRepository.save(sale);
}
}
| [
"michael.clavier.cv@gmail.com"
] | michael.clavier.cv@gmail.com |
e9aa8b0c87817417e718df60caad1a966ce9fdf0 | 9eeaf6ff82ef2303061dea7f048b08640dbfec30 | /NoteSyncDemo-Android/src/com/notesyncdemo/Setup.java | cd5f3fac47bcd520685ff75fcc601c7851e29d55 | [] | no_license | zaxebo1/notesyncdemo | f8fb7b4a09c5c1e02fccc481ba0d472e2c10fdbd | 832f4c4cff54563d92dba7cb029f47981656d06b | refs/heads/master | 2021-01-19T08:00:45.440737 | 2012-03-27T18:00:33 | 2012-03-27T18:00:33 | 41,275,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,483 | java | /*******************************************************************************
* Copyright 2011 Google Inc. All Rights Reserved.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* 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.notesyncdemo;
/**
* Class to be customized with app-specific data. The Eclipse plugin will set
* these values when the project is created.
*/
public class Setup {
/**
* The AppEngine app name, used to construct the production service URL
* below.
*/
private static final String APP_NAME = "vettukal";
/**
* The URL of the production service.
*/
public static final String PROD_URL = "https://" + APP_NAME + ".appspot.com";
/**
* The C2DM sender ID for the server. A C2DM registration with this name
* must exist for the app to function correctly.
*/
public static final String SENDER_ID = "vettukal@gmail.com";
}
| [
"vettukal@gmail.com"
] | vettukal@gmail.com |
29ffa8d5161de3c99479f26f6ddf975eb6bece01 | 557451cbe472d9f2675a0aba06d063eb66389d73 | /src/main/java/com/optioninfo/jctp/ctp/CThostFtdcAccountregisterField.java | 0b04ee1387675e7de2ae8e441babc5f34939e17d | [
"Apache-2.0"
] | permissive | yangjing83/ctp | 2c82734280b65ec8e7178b8f99419488276c0baf | 40ed013676fbd0d083e33962e60e3ded8f1661c8 | refs/heads/master | 2023-07-02T02:50:52.679022 | 2021-08-08T23:59:43 | 2021-08-08T23:59:43 | 330,542,911 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,027 | java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.optioninfo.jctp.ctp;
public class CThostFtdcAccountregisterField {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected CThostFtdcAccountregisterField(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(CThostFtdcAccountregisterField obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
ThostTradeApiJNI.delete_CThostFtdcAccountregisterField(swigCPtr);
}
swigCPtr = 0;
}
}
public void setTradeDay(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_TradeDay_set(swigCPtr, this, value);
}
public String getTradeDay() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_TradeDay_get(swigCPtr, this);
}
public void setBankID(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_BankID_set(swigCPtr, this, value);
}
public String getBankID() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_BankID_get(swigCPtr, this);
}
public void setBankBranchID(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_BankBranchID_set(swigCPtr, this, value);
}
public String getBankBranchID() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_BankBranchID_get(swigCPtr, this);
}
public void setBankAccount(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_BankAccount_set(swigCPtr, this, value);
}
public String getBankAccount() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_BankAccount_get(swigCPtr, this);
}
public void setBrokerID(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_BrokerID_set(swigCPtr, this, value);
}
public String getBrokerID() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_BrokerID_get(swigCPtr, this);
}
public void setBrokerBranchID(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_BrokerBranchID_set(swigCPtr, this, value);
}
public String getBrokerBranchID() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_BrokerBranchID_get(swigCPtr, this);
}
public void setAccountID(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_AccountID_set(swigCPtr, this, value);
}
public String getAccountID() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_AccountID_get(swigCPtr, this);
}
public void setIdCardType(char value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_IdCardType_set(swigCPtr, this, value);
}
public char getIdCardType() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_IdCardType_get(swigCPtr, this);
}
public void setIdentifiedCardNo(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_IdentifiedCardNo_set(swigCPtr, this, value);
}
public String getIdentifiedCardNo() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_IdentifiedCardNo_get(swigCPtr, this);
}
public void setCustomerName(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_CustomerName_set(swigCPtr, this, value);
}
public String getCustomerName() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_CustomerName_get(swigCPtr, this);
}
public void setCurrencyID(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_CurrencyID_set(swigCPtr, this, value);
}
public String getCurrencyID() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_CurrencyID_get(swigCPtr, this);
}
public void setOpenOrDestroy(char value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_OpenOrDestroy_set(swigCPtr, this, value);
}
public char getOpenOrDestroy() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_OpenOrDestroy_get(swigCPtr, this);
}
public void setRegDate(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_RegDate_set(swigCPtr, this, value);
}
public String getRegDate() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_RegDate_get(swigCPtr, this);
}
public void setOutDate(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_OutDate_set(swigCPtr, this, value);
}
public String getOutDate() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_OutDate_get(swigCPtr, this);
}
public void setTID(int value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_TID_set(swigCPtr, this, value);
}
public int getTID() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_TID_get(swigCPtr, this);
}
public void setCustType(char value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_CustType_set(swigCPtr, this, value);
}
public char getCustType() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_CustType_get(swigCPtr, this);
}
public void setBankAccType(char value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_BankAccType_set(swigCPtr, this, value);
}
public char getBankAccType() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_BankAccType_get(swigCPtr, this);
}
public void setLongCustomerName(String value) {
ThostTradeApiJNI.CThostFtdcAccountregisterField_LongCustomerName_set(swigCPtr, this, value);
}
public String getLongCustomerName() {
return ThostTradeApiJNI.CThostFtdcAccountregisterField_LongCustomerName_get(swigCPtr, this);
}
public CThostFtdcAccountregisterField() {
this(ThostTradeApiJNI.new_CThostFtdcAccountregisterField(), true);
}
}
| [
"yaghf2000@163.com"
] | yaghf2000@163.com |
55bb8c2836629126885e5c7f63392f8512e3937f | 3ef55e152decb43bdd90e3de821ffea1a2ec8f75 | /large/module1758_public/tests/unittests/src/java/module1758_public_tests_unittests/a/Foo2.java | 11f8e1d10d3521d877411ea6b5f2a87029877951 | [
"BSD-3-Clause"
] | permissive | salesforce/bazel-ls-demo-project | 5cc6ef749d65d6626080f3a94239b6a509ef145a | 948ed278f87338edd7e40af68b8690ae4f73ebf0 | refs/heads/master | 2023-06-24T08:06:06.084651 | 2023-03-14T11:54:29 | 2023-03-14T11:54:29 | 241,489,944 | 0 | 5 | BSD-3-Clause | 2023-03-27T11:28:14 | 2020-02-18T23:30:47 | Java | UTF-8 | Java | false | false | 1,674 | java | package module1758_public_tests_unittests.a;
import java.awt.datatransfer.*;
import java.beans.beancontext.*;
import java.io.*;
/**
* Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
* labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
* Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
*
* @see java.awt.datatransfer.DataFlavor
* @see java.beans.beancontext.BeanContext
* @see java.io.File
*/
@SuppressWarnings("all")
public abstract class Foo2<K> extends module1758_public_tests_unittests.a.Foo0<K> implements module1758_public_tests_unittests.a.IFoo2<K> {
java.rmi.Remote f0 = null;
java.nio.file.FileStore f1 = null;
java.sql.Array f2 = null;
public K element;
public static Foo2 instance;
public static Foo2 getInstance() {
return instance;
}
public static <T> T create(java.util.List<T> input) {
return module1758_public_tests_unittests.a.Foo0.create(input);
}
public String getName() {
return module1758_public_tests_unittests.a.Foo0.getInstance().getName();
}
public void setName(String string) {
module1758_public_tests_unittests.a.Foo0.getInstance().setName(getName());
return;
}
public K get() {
return (K)module1758_public_tests_unittests.a.Foo0.getInstance().get();
}
public void set(Object element) {
this.element = (K)element;
module1758_public_tests_unittests.a.Foo0.getInstance().set(this.element);
}
public K call() throws Exception {
return (K)module1758_public_tests_unittests.a.Foo0.getInstance().call();
}
}
| [
"gwagenknecht@salesforce.com"
] | gwagenknecht@salesforce.com |
90795b748f644127699774fa4a2de0964193cac4 | 59d0acab882c30074208371f9d8270901dcc4f33 | /app/src/main/java/com/example/afaf/enterprisecrm/opportunity.java | 1992437cbba5c7e7cf2d026256e06dcd11cd5b62 | [] | no_license | Mariem-Ahmed/CRM | 9314fae26bb9faf33329ddd75860281875b60f82 | dbf4cafbcfd8bd99980cdf7a87c4d566fbe74255 | refs/heads/master | 2021-05-07T03:13:57.144553 | 2017-11-15T11:20:31 | 2017-11-15T11:20:31 | 110,819,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,963 | java | package com.example.afaf.enterprisecrm;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.example.afaf.enterprisecrm.Helper_Database.JCGSQLiteHelper_Leads;
import com.example.afaf.enterprisecrm.Helper_Database.JCGSQLiteHelper_Oppo;
import com.example.afaf.enterprisecrm.Helper_Database.assignedTo_spinner_helper;
import com.example.afaf.enterprisecrm.Helper_Database.assignedTo_spinner_model;
import com.example.afaf.enterprisecrm.Helper_Database.opportunityModedel;
import com.example.afaf.enterprisecrm.Helper_Database.relatedLead_Model;
import org.json.JSONArray;
import org.json.JSONException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* Created by enterprise on 25/09/16.
*/
public class opportunity extends AppCompatActivity {
String oppid, oppleadid= null;
static EditText closedate;
EditText subjectName, amont , probablity;
Spinner relatedLead, assignedTo;
int y ,z, x = 0;
String oppoId ="0";
public static opportunityModedel Em= new opportunityModedel();
//------------------- url -------------------------------------------------------------
public static final String MyPREFERENCES = "MyPrefs" ;
// public static final String URL = "nameKey";
SharedPreferences sharedpreferences;
String uRl="";
// ----------------------- log in ------------------------------------------------------
public static final String LoginPREFERENCES = "LoginPrefs" ;
public static final String UserName = "username";
public static final String PassWord = "password";
SharedPreferences sharedpreferencesLogin;
String uname="";
String passw="";
String userId="";
public static String lid;
public static String lidname;
public static String actid;
public static String aname;
boolean doneflag=false;
// requried
boolean check, cancel = false;
View focusView = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.opportunity);
// if (lid==null && lidname==null) {
Intent ii3 = getIntent();
lid = ii3.getStringExtra("leadidid");
lidname = ii3.getStringExtra("ComName");
// }
// if (actid==null && aname==null) {
Intent ii4 = getIntent();
actid = ii4.getStringExtra("actidid");
aname = ii4.getStringExtra("subName");
oppoId =ii4.getStringExtra("iddd");
// }
//-----------------------------url & login ------------------------------------------
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
uRl= sharedpreferences.getString("URL",null);
if (uRl != null) {
sharedpreferencesLogin = getSharedPreferences(LoginPREFERENCES, Context.MODE_PRIVATE);
uname = sharedpreferencesLogin.getString("uName", null);
passw = sharedpreferencesLogin.getString("passWord", null);
userId = sharedpreferencesLogin.getString("userId", null);
if (uname == null && passw == null) {
Intent i1 = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(i1);
finish();
}
}
else{
Intent i = new Intent(getApplicationContext(), insertUrl.class);
startActivity(i);
finish();
}
if(MainActivity.opportunityflag==true&& MainActivity.listFlag==true || lead_oppo_adapter.tabbedoppolead==true ) {
if(LoginActivity.arabicflag==true ){
setTitle("تعديل الفرصه");
}
else if(insertUrl.arflagURL==true ){
setTitle("تعديل الفرصه");
}else{
setTitle(" Edit Opportunity");
}
}else{
if (LoginActivity.arabicflag == true) {
setTitle("اضافه فرصه ");
} else if (insertUrl.arflagURL == true) {
setTitle("اضافه فرصه ");
} else {
setTitle("Add Opportunity");
}
}
subjectName = (EditText) findViewById(R.id.editText1);
subjectName.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
subjectName.setError(null);
cancel=false;
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {}
});
//closeDate = (TextView) findViewById(R.id.textDate);
amont = (EditText) findViewById(R.id.editText3);
amont.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
amont.setError(null);
cancel=false;
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {}
});
probablity = (EditText) findViewById(R.id.editText4);
probablity.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
probablity.setError(null);
cancel=false;
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {}
});
relatedLead = (Spinner) findViewById(R.id.relatedLeadSpinner);
// change color of selected item
relatedLead.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
((TextView) view).setTextColor(Color.BLACK); //Change selected text color
}
@Override
public void onNothingSelected(AdapterView<?> parent) {}
});
assignedTo = (Spinner) findViewById(R.id.assignedToSpinner);
// change color of selected item
assignedTo.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
((TextView) view).setTextColor(Color.BLACK); //Change selected text color
}
@Override
public void onNothingSelected(AdapterView<?> parent) {}
});
closedate= (EditText) findViewById(R.id.textcloseddate);
closedate.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
closedate.setError(null);
cancel=false;
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {}
});
closedate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showDatePickerDialog(view);
}
});
// --------------------------------------- set data -----------------------------
Intent i = getIntent();
String opplead = i.getStringExtra("oppleadid");
oppleadid=opplead;
String opid = i.getStringExtra("oppid");
oppid=opid;
// ---------------------------------------assignedTo-------------------------------------------------------------
String assigne = i.getStringExtra("assignto");
String oppAssignedToid = i.getStringExtra("oppAssignedToid");
assignedTo_spinner_helper db1 = new assignedTo_spinner_helper(this);
assignedTo_spinner_model assignedLists = null;
List<String> list1 = new ArrayList<String>();
for (int ii = 0; ii < db1.getAllAssignedTo().size(); ii++) {
try {
assignedLists = db1.readAssignedToSpinner(ii+1);
} catch (JSONException e) {
}
list1.add(assignedLists.getUserName());
if (assignedLists.getUserId().equals(oppAssignedToid)||assignedLists.getUserId().equals(userId))
z = ii;
}
ArrayAdapter<String> spinnerAdapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list1);
spinnerAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
assignedTo.setAdapter(spinnerAdapter1);
assignedTo.setSelection(z);
// ------------------------------r lead ----------------------------------------
String rlead = i.getStringExtra("relatedLead");
String leadnameid = i.getStringExtra("oppleadid");
if (Main4Activity.fabcasesFlag==true){
JCGSQLiteHelper_Leads db3 = new JCGSQLiteHelper_Leads(this);
relatedLead_Model rleadLists1 = null;
List<String> list3 = new ArrayList<String>();
for (int i1 = 0; i1 < db3.getAllRLeads().size(); i1++) {
rleadLists1 = db3.getAllRLeads().get(i1);
list3.add(rleadLists1.getrLeadName());
if (rleadLists1.getrLeadId().equals(lead_info_activity.leadid))
x = i1+1;
}
ArrayAdapter<String> spinnerAdapter3 = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item, list3);
spinnerAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
relatedLead.setAdapter(spinnerAdapter3);
relatedLead.setSelection(x-1);
}else{
JCGSQLiteHelper_Leads db3 = new JCGSQLiteHelper_Leads(this);
relatedLead_Model rleadLists1 = null;
List<String> list3 = new ArrayList<String>();
list3.add(0," ");
for (int i1 = 0; i1 < db3.getAllRLeads().size(); i1++) {
rleadLists1 = db3.getAllRLeads().get(i1);
list3.add(rleadLists1.getrLeadName());
if (rleadLists1.getrLeadId().equals(leadnameid))
x = i1+1;
}
ArrayAdapter<String> spinnerAdapter3 = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item, list3);
spinnerAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
relatedLead.setAdapter(spinnerAdapter3);
}
// ---------------------------------------------------------------------
if(MainActivity.listFlag==true && MainActivity.fabFlag==false) {
String subName = i.getStringExtra("subName");
try {
final String s = new String(subName.getBytes(), "UTF-8");
subjectName.setText(s);
} catch (UnsupportedEncodingException e) {
}
String closeD = i.getStringExtra("closedate");
if (!closeD.isEmpty()) {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
SimpleDateFormat output = new SimpleDateFormat("yyyy-MM-dd");
Date d = null;
try {
d = output.parse(closeD);
} catch (ParseException e) {
e.printStackTrace();
}
long millisecond = d.getTime();
String currentDate = getDate(millisecond, "yyyy-MM-dd");
closedate.setText(currentDate);
} else {
closedate.setText(closeD);
}
String amount = i.getStringExtra("amount");
amont.setText(amount);
String prob = i.getStringExtra("probablity");
probablity.setText(prob);
// }
assignedTo.setSelection(z - 1);
relatedLead.setSelection(x);
}
}
public static String getDate(long milliSeconds, String dateFormat)
{
// Create a DateFormatter object for displaying date in specified format.
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
// Create a calendar object that will convert the date and time value in milliseconds to date.
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(milliSeconds);
return formatter.format(calendar.getTime());
}
// ----------------------------------------------------------------------
// Check for requried fields.
public void check(){
if ( MainActivity.navFlag==true || MainActivity.fabFlag==true || Main4Activity.fabcasesFlag==true && Main4Activity.editleadflag==false) {
if (TextUtils.isEmpty(subjectName.getText())) {
subjectName.setError(getString(R.string.error_field_required));
focusView = subjectName;
cancel = true;
}
if (TextUtils.isEmpty(closedate.getText())) {
closedate.setError(getString(R.string.error_field_required));
focusView = closedate;
cancel = true;
}
if (TextUtils.isEmpty(amont.getText())) {
amont.setError(getString(R.string.error_field_required));
focusView = amont;
cancel = true;
}
if (TextUtils.isEmpty(probablity.getText())) {
probablity.setError(getString(R.string.error_field_required));
focusView = probablity;
cancel = true;
}
}
// return true;
}
// ---------------------------------------------------
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.nav_menu, menu);
return true;
}
@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();
if (id==R.id.done){
if (MainActivity.listFlag==true && MainActivity.fabFlag==false) {
doneflag=true;
String subname = subjectName.getText().toString();
String cdate = closedate.getText().toString();
String oppoamont = amont.getText().toString();
String oppopro = probablity.getText().toString();
String oppolead = relatedLead.getSelectedItem()+"";
String oppoassigned = assignedTo.getSelectedItem()+"";
String oppoid= oppotunity_fragment.oppoID;
Em.setId(Integer.parseInt(oppoId));
Em.setOppoSubject(subname);
Em.setOppoCloseDate(cdate);
Em.setOppoAmount(oppoamont);
Em.setOppoProbablity(oppopro);
JCGSQLiteHelper_Leads leads = new JCGSQLiteHelper_Leads(this);
if(leads.getLeadByName(oppolead).size()!=0)
Em.setOppoRelatedLead(leads.getLeadByName(oppolead).get(0).getLeadId());
else Em.setOppoRelatedLead("");
if(leads.getLeadByName(oppolead).size()!=0)
Em.setOppoRelatedLeadID(leads.getLeadByName(oppolead).get(0).getLeadId());
else Em.setOppoRelatedLead("");
Em.setOppoAssignedto(oppoassigned);
JCGSQLiteHelper_Oppo h = new JCGSQLiteHelper_Oppo(this);
h.updateEvent(Em);
AsyncCallWS task = new AsyncCallWS();
task.execute();
} else {
String subname = subjectName.getText()+"";
String cdate = closedate.getText()+"";
String oppoamont = amont.getText()+"";
String oppopro = probablity.getText()+"";
String oppolead = relatedLead.getSelectedItem()+"";
String oppoassigned = assignedTo.getSelectedItem()+"";
JCGSQLiteHelper_Leads leads = new JCGSQLiteHelper_Leads(this);
Em.setOppoRelatedLead(leads.getLeadByName(oppolead).get(0).getLeadId());
JCGSQLiteHelper_Oppo h = new JCGSQLiteHelper_Oppo(this);
Em.setId(h.getAllOpportunity().size()+1);
Em.setOppoSubject(subname);
Em.setOppoCloseDate(cdate);
Em.setOppoAmount(oppoamont);
Em.setOppoProbablity(oppopro);
if(leads.getLeadByName(oppolead).size()!=0)
Em.setOppoRelatedLead(leads.getLeadByName(oppolead).get(0).getLeadId());
else Em.setOppoRelatedLead("");
if(leads.getLeadByName(oppolead).size()!=0)
Em.setOppoRelatedLeadID(leads.getLeadByName(oppolead).get(0).getLeadId());
else Em.setOppoRelatedLead("");
Em.setOppoAssignedto(oppoassigned);
// check ----------------
check();
if (cancel==true) {
Toast.makeText(getApplicationContext(), "Something went wrong", Toast.LENGTH_LONG).show();
// cancel=false;
check=true;
}else{
h.insertEvent(Em);
check=false;
AsyncCallWS1 task = new AsyncCallWS1();
task.execute();
}
}
if (check==false) {
if (MainActivity.listFlag == true || MainActivity.navFlag == true) {
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window", "4");
startActivity(i);
finish();
} else if (Main4Activity.fabcasesFlag == true) {
Intent i = new Intent(this, Main4Activity.class);
i.putExtra("leadid", lid);
i.putExtra("leadname", lidname);
startActivity(i);
finish();
} else if (MainActivity.fabFlag == true) {
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window", "4");
startActivity(i);
finish();
}
}
}
else if (id==R.id.close){
if (Main4Activity.fabcasesFlag==true || lead_oppo_adapter.tabbedoppolead==true){
Intent i = new Intent(this, Main4Activity.class);
i.putExtra("leadid", lid);
i.putExtra("leadname",lidname);
startActivity(i);
finish();
return true;
}
else if (MainActivity.listFlag==true ){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
return true;
}
else if (MainActivity.fabFlag==true){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
return true;
}
else if (MainActivity.navFlag==true ){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
return true;
}
}
else if (id ==android.R.id.home) {
if (Main4Activity.fabcasesFlag==true || lead_oppo_adapter.tabbedoppolead==true){
Intent i = new Intent(this, Main4Activity.class);
i.putExtra("leadid", lid);
i.putExtra("leadname",lidname);
startActivity(i);
finish();
return true;
}
else if (MainActivity.listFlag==true ){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
return true;
}
else if (MainActivity.fabFlag==true){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
return true;
}
else if (MainActivity.navFlag==true ){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
return true;
}
}
return false;
//return super.onOptionsItemSelected(item);
}
// insert
private class AsyncCallWS1 extends AsyncTask<String, Void, Void> {
@Override
protected Void doInBackground(String... params) {
testinsert("/ws/it.openia.crm.insertOppo?");
//testUpdate();
return null;
}
@Override
protected void onPostExecute(Void result) {
}
@Override
protected void onPreExecute() {
}
@Override
protected void onProgressUpdate(Void... values) {
}
}
// update
private class AsyncCallWS extends AsyncTask<String, Void, Void> {
@Override
protected Void doInBackground(String... params) {
testUpdate("/ws/it.openia.crm.updateOppo?");
//testUpdate();
return null;
}
@Override
protected void onPostExecute(Void result) {
}
@Override
protected void onPreExecute() {
}
@Override
protected void onProgressUpdate(Void... values) {
}
}
// insert connection
public String testinsert(String content) {
try {
HttpURLConnection conn = createConnection( content,"POST");
conn.connect();
ArrayList<Object> list=new ArrayList<Object>();
// ArrayList<String> list = new ArrayList<String>();
list.add(0,subjectName.getText().toString());
list.add(1, closedate.getText().toString());
list.add(2, amont.getText().toString());
list.add(3,probablity.getText().toString());
list.add(4,relatedLead.getSelectedItem()+"");
list.add(5,assignedTo.getSelectedItem()+"");
JSONArray jsArray = new JSONArray(list);
OutputStream os = conn.getOutputStream();
String s=jsArray.toString();
os.write(s.getBytes());
os.flush();
if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
conn.disconnect();
} catch (MalformedURLException e) {
} catch (IOException e) {
} catch (Exception e) {
}
return null;
}
// update connection
public String testUpdate(String content) {
try {
HttpURLConnection conn = createConnection( content,"POST");
conn.connect();
ArrayList<Object> list=new ArrayList<Object>();
// ArrayList<String> list = new ArrayList<String>();
list.add(0,subjectName.getText().toString());
list.add(1, closedate.getText().toString());
list.add(2, amont.getText().toString());
list.add(3,probablity.getText().toString());
list.add(4,oppleadid);
//assigned to
String as=null;
assignedTo_spinner_helper dba = new assignedTo_spinner_helper(this);
assignedTo_spinner_model assignedLists = null;
for (int ii = 0; ii < dba.getAllAssignedTo().size(); ii++) {
try {
assignedLists = dba.readAssignedToSpinner(ii+1);
} catch (JSONException e) {
e.printStackTrace();
}
if (assignedLists.getUserName().equals(assignedTo.getSelectedItem()+"")) {
as = assignedLists.getUserId().toString();
list.add(5,as);
}
}
list.add(6,oppid);
JSONArray jsArray = new JSONArray(list);
OutputStream os = conn.getOutputStream();
String s=jsArray.toString();
os.write(s.getBytes());
os.flush();
if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
conn.disconnect();
} catch (MalformedURLException e) {
} catch (IOException e) {
} catch (Exception e) {
}
return null;
}
public HttpURLConnection createConnection(String wsPart, String method) throws Exception {
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(uname, passw.toCharArray());
}
});
final URL url = new URL(uRl + wsPart);
final HttpURLConnection hc = (HttpURLConnection) url.openConnection();
hc.setRequestMethod(method);
hc.setAllowUserInteraction(false);
hc.setDefaultUseCaches(false);
hc.setDoOutput(true);
hc.setDoInput(true);
hc.setInstanceFollowRedirects(true);
hc.setUseCaches(false);
hc.setRequestProperty("Content-Type", "text/xml");
return hc;
}
// --------------------------------- Date ------------------------------------
public static class DatePickerFragment extends DialogFragment
implements DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
month=month+1;
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), this, year, month, day);
}
public void onDateSet(DatePicker view, int year, int month, int day) {
// Do something with the date chosen by the user
closedate .setText(year + "-" + month + "-" + day);
}
}
public void showDatePickerDialog(View v) {
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getSupportFragmentManager(), "datePicker");
}
// -------------------------------------------------------------------------------------------------
@Override
public void onBackPressed() {
if (Main4Activity.fabcasesFlag==true || lead_oppo_adapter.tabbedoppolead==true){
Intent i = new Intent(this, Main4Activity.class);
i.putExtra("leadid", lid);
i.putExtra("leadname",lidname);
startActivity(i);
finish();
}
else if (MainActivity.listFlag==true ){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
}
else if (MainActivity.fabFlag==true){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
}
else if (MainActivity.navFlag==true ){
Intent i = new Intent(this, MainActivity.class);
i.putExtra("Window","4");
startActivity(i);
finish();
}
}
}
| [
"Mariem.Ahmed.Abdelrahman@outlook.com"
] | Mariem.Ahmed.Abdelrahman@outlook.com |
dc83ca9f99464e3a86e96e7a642bdf4887393b0f | ea05d2b77cd6b413d476d2137ba5f778e12c30dd | /src/test/java/readExcelpgms/CreateParentterritory.java | 6c3f90434b9897baf5dac49587b1e755b7523c55 | [] | no_license | kvnaveenkumar/SelBootcamp | 57b70c34039528fca4a727ad1656a511d025542a | 0c90f4ee07d38d731b826c6e8c40b138aa0876ca | refs/heads/master | 2023-06-04T20:16:46.443937 | 2021-06-27T09:53:26 | 2021-06-27T09:53:26 | 369,798,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,533 | java | package readExcelpgms;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import testNG.BaseClass;
public class CreateParentterritory extends BaseClass{
@Test
public void tc_CreateParrentterritory() throws IOException {
d.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
WebElement appLauncher=d.findElement(By.xpath("//button[@class='bare slds-icon-waffle_container slds-context-bar__button slds-button uiButton forceHeaderButton salesforceIdentityAppLauncherHeader']"));
appLauncher.click();
WebDriverWait w=new WebDriverWait(d, 60);
WebElement viewAll=d.findElement(By.xpath("//button[@class='slds-button']"));
w.until(ExpectedConditions.elementToBeClickable(viewAll));
viewAll.click();
WebElement serviceTerritories=d.findElement(By.xpath("//p[text()='Service Territories']"));
JavascriptExecutor j=(JavascriptExecutor)d;
j.executeScript("arguments[0].scrollIntoView();",serviceTerritories);
serviceTerritories.click();
WebElement New=d.findElement(By.xpath("//a[@class='forceActionLink']"));
New.click();
WebElement name=d.findElement(By.xpath("//input[@class=' input']"));
name.sendKeys(ReadExcel.excelValue("CreateParentterritory", 1, 0));
WebElement city=d.findElement(By.xpath("//input[@class='city compoundBorderBottom compoundBorderRight input']"));
JavascriptExecutor j1=(JavascriptExecutor)d;
j1.executeScript("arguments[0].scrollIntoView();",city);
WebElement parentTerritory=d.findElement(By.xpath("//input[@title='Search Service Territories']"));
parentTerritory.click();
WebElement newServiceTerritory=d.findElement(By.xpath("//span[@title='New Service Territory']"));
w.until(ExpectedConditions.elementToBeClickable(newServiceTerritory));
newServiceTerritory.click();
d.switchTo().activeElement();
WebElement name_NewServiceTerritory=d.findElement(By.xpath("(//input[@class=' input'])[2]"));
name_NewServiceTerritory.sendKeys(ReadExcel.excelValue("CreateParentterritory", 2, 0));
WebElement cityNewServiceTerritory=d.findElement(By.xpath("(//input[@class='city compoundBorderBottom compoundBorderRight input'])[2]"));
j1.executeScript("arguments[0].scrollIntoView();",cityNewServiceTerritory);
WebElement operatingHours=d.findElement(By.xpath("(//input[@title='Search Operating Hours'])[2]"));
operatingHours.click();
WebElement newOperatingHours=d.findElement(By.xpath("//span[@title='New Operating Hours']"));
w.until(ExpectedConditions.elementToBeClickable(newOperatingHours));
newOperatingHours.click();
d.switchTo().activeElement();
WebElement name_OperatingHours=d.findElement(By.xpath("(//input[@class=' input'])[3]"));
name_OperatingHours.sendKeys("Mukesh Ambani");
WebElement timeZone=d.findElement(By.xpath("//a[text()='(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)']"));
timeZone.click();
WebElement selectIndiaTime=d.findElement(By.xpath("//a[@title='(GMT+05:30) India Standard Time (Asia/Kolkata)']"));
w.until(ExpectedConditions.elementToBeClickable(selectIndiaTime));
selectIndiaTime.click();
WebElement save=d.findElement(By.xpath("(//button[@title='Save'])[3]"));
save.click();
WebElement toastMessage=d.findElement(By.xpath("//span[@class='toastMessage slds-text-heading--small forceActionsText']"));
System.out.println(toastMessage.getText());
WebElement operatingHours_final=d.findElement(By.xpath("//span[@class='pillText']"));
System.out.println(operatingHours_final.getText());
WebElement saveNewServiceTerritory=d.findElement(By.xpath("(//button[@title='Save'])[2]"));
w.until(ExpectedConditions.elementToBeClickable(saveNewServiceTerritory));
saveNewServiceTerritory.click();
WebElement toastMessageFinal=d.findElement(By.xpath("//span[@class='toastMessage slds-text-heading--small forceActionsText']"));
System.out.println(toastMessageFinal.getText());
}
}
| [
"naveenkumar.kv@sanmina.com"
] | naveenkumar.kv@sanmina.com |
83af835d532e3dc7e38273a41524f0292902d733 | 76d7be5c7be33ce4d44b39c6afafb92b66934c1f | /src/test/java/executionScript/TestCase011_BuySeveralProducts.java | 05e1ec3025c92ca4d3b17b90ee885fcf83e876eb | [] | no_license | DIZhang1109/ToolsQA_OnlineStore_Automation | 8a07b8112d23e755605bdd079562c0493cd485a2 | 81dbb1fa8b51226783f800af639fd3a406822430 | refs/heads/master | 2021-01-10T17:57:48.939932 | 2016-04-04T21:41:17 | 2016-04-04T21:41:17 | 52,191,754 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package executionScript;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.Test;
import executionAction.AddToCart_Action;
public class TestCase011_BuySeveralProducts {
@Test
public void testCase011_BuySeveralProducts() throws Exception {
AddToCart_Action atca = new AddToCart_Action();
WebDriver driver = atca.driver;
atca.get();
System.out.println("TestCase011_BuySeveralProducts" + "\n" + "-----------------------------------------------------");
atca.addtoCartSeveralTime(3);
driver.close();
System.out.println("-----------------------------------------------------" + "\n\n");
}
}
| [
"taylorzhang@126.com"
] | taylorzhang@126.com |
0558cee988abcd759d4f2d8c7289b437b37c5ec9 | 39813c04c66565a3f4a4364bebb27e90a3b42d9a | /compgraf_trabalho2_2/GraficoBase.java | 3598a956693b92016cd39a5b64888eb557dc9cad | [] | no_license | thiago-thomas/ProjetoLeopoldoCG | 02887bf6e8b60c8926cf62cfc777e06f675cf790 | 6bf113ed781ae86413f8862c357e5e3508fd63ab | refs/heads/master | 2022-03-17T18:48:17.204161 | 2019-11-18T21:55:19 | 2019-11-18T21:55:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,457 | java | package compgraf_trabalho2_2;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JPanel;
public class GraficoBase extends JPanel{
//Variaveis
int indice;
int x;
int y;
public GraficoBase() {
setBackground(Color.WHITE);
setPreferredSize(new Dimension(640,480));
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
//Eixos
g.drawLine(0, this.getHeight()/2, this.getWidth(),this.getHeight()/2); //Eixo Horizontal
g.drawLine(20,0,20,this.getHeight()); //Eixo Vertical
//Indice 0
x = 20;
y = getHeight()/2;
g.setColor(Color.BLUE);
g.drawString(""+indice, x, y+20);
g.setColor(Color.BLACK);
//Indice Horizontal
indice = 1;
x+=50;
while(x < getWidth()) {
g.drawLine(x, y-5, x, y+5);
g.setColor(Color.BLUE);
g.drawString(""+indice, x-2, y+20);
g.setColor(Color.BLACK);
x+=50;
indice++;
}
//Indice vertical subindo
indice = 1;
x = 20;
y = getHeight()/2 -50;
while(y > 0) {
g.drawLine(x-5, y, x+5, y);
g.setColor(Color.BLUE);
g.drawString(""+indice, x-15, y+5);
g.setColor(Color.BLACK);
y-=50;
indice++;
}
//Indice vertical descendo
indice = -1;
x = 20;
y = getHeight()/2 +50;
while(y < getHeight()) {
g.drawLine(x-5, y, x+5, y);
g.setColor(Color.BLUE);
g.drawString(""+indice, x-15, y+5);
g.setColor(Color.BLACK);
y+=50;
indice--;
}
}
}
| [
"thiago_rocha17@hotmail.com"
] | thiago_rocha17@hotmail.com |
f944864c7e24b45d92959eef6c07c24a60fe4282 | 0cdcbcf02e6ededdb5c6e1ef79a098e70a951834 | /JiaZhengService/JiaZhengService-dao/src/main/java/com/platform/JiaZhengService/dao/entity/TArea.java | 12844b9f7124c0a12ee66c0d680a92f8e6a23be4 | [] | no_license | tc792617871/JiaZhengService | 1472335ca5351b8b951ce9f5d96250872d80d480 | 047f2494f627d8130dde3277afc6a4a7984d7bc1 | refs/heads/master | 2020-12-30T09:14:36.392177 | 2018-05-19T06:38:00 | 2018-05-19T06:38:00 | 100,394,267 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 4,051 | java | package com.platform.JiaZhengService.dao.entity;
import com.platform.JiaZhengService.common.pojo.StringAndEqualsPojo;
import java.io.Serializable;
import java.util.Date;
/**
* @ClassName: TArea
* @Description: t_area表对应的java bean类
* @author: peiyu
*/
public class TArea extends StringAndEqualsPojo implements Serializable {
/**
* @Fields serialVersionUID : 自动生成默认序列化ID
*/
private static final long serialVersionUID = 1L;
/** 树路径分隔符 */
public static final String TREE_PATH_SEPARATOR = ",";
/**
* @Fields t_area.id :
*/
private Long id;
/**
* @Fields t_area.create_date :
*/
private Date createDate;
/**
* @Fields t_area.modify_date :
*/
private Date modifyDate;
/**
* @Fields t_area.orders :
*/
private Integer orders;
/**
* @Fields t_area.name :
*/
private String name;
/**
* @Fields t_area.tree_path :
*/
private String treePath;
/**
* @Fields t_area.parent :
*/
private Long parent;
/**
* @Fields t_area.abbreviation :
*/
private String abbreviation;
/**
* @Fields t_area.phone_code :
*/
private String phoneCode;
/**
* @Fields t_area.zh_name :
*/
private String zhName;
/**
* @Fields t_area.full_name :
*/
private String fullName;
/**
* @return t_area.id : 返回
*/
public Long getId() {
return id;
}
/**
* @param id
* of t_area : 设置
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return t_area.create_date : 返回
*/
public Date getCreateDate() {
return createDate;
}
/**
* @param createDate
* of t_area : 设置
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* @return t_area.modify_date : 返回
*/
public Date getModifyDate() {
return modifyDate;
}
/**
* @param modifyDate
* of t_area : 设置
*/
public void setModifyDate(Date modifyDate) {
this.modifyDate = modifyDate;
}
/**
* @return t_area.orders : 返回
*/
public Integer getOrders() {
return orders;
}
/**
* @param orders
* of t_area : 设置
*/
public void setOrders(Integer orders) {
this.orders = orders;
}
/**
* @return t_area.name : 返回
*/
public String getName() {
return name;
}
/**
* @param name
* of t_area : 设置
*/
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
/**
* @return t_area.tree_path : 返回
*/
public String getTreePath() {
return treePath;
}
/**
* @param treePath
* of t_area : 设置
*/
public void setTreePath(String treePath) {
this.treePath = treePath == null ? null : treePath.trim();
}
/**
* @return t_area.parent : 返回
*/
public Long getParent() {
return parent;
}
/**
* @param parent
* of t_area : 设置
*/
public void setParent(Long parent) {
this.parent = parent;
}
/**
* @return t_area.abbreviation : 返回
*/
public String getAbbreviation() {
return abbreviation;
}
/**
* @param abbreviation
* of t_area : 设置
*/
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation == null ? null : abbreviation.trim();
}
/**
* @return t_area.phone_code : 返回
*/
public String getPhoneCode() {
return phoneCode;
}
/**
* @param phoneCode
* of t_area : 设置
*/
public void setPhoneCode(String phoneCode) {
this.phoneCode = phoneCode == null ? null : phoneCode.trim();
}
/**
* @return t_area.zh_name : 返回
*/
public String getZhName() {
return zhName;
}
/**
* @param zhName
* of t_area : 设置
*/
public void setZhName(String zhName) {
this.zhName = zhName == null ? null : zhName.trim();
}
/**
* @return t_area.full_name : 返回
*/
public String getFullName() {
return fullName;
}
/**
* @param fullName
* of t_area : 设置
*/
public void setFullName(String fullName) {
this.fullName = fullName == null ? null : fullName.trim();
}
} | [
"792617871@qq.com"
] | 792617871@qq.com |
9cc381ba0ec3c0c658473f55c4270c75fbcdd9ae | 10ced62fb0c5f241fa3e5967d81b1b011dbb3f48 | /src/main/java/com/snb/offsets/KafkaConsumerOffset03.java | d130741acf20e3279cc1491147e073c0a0898b19 | [] | no_license | yinzhen0908/kafka_mq | 04b811bac227b830d2e3ac0fd14ebcfbbff7c282 | e3e6ced4581f6a1827808abba9e83d3926367822 | refs/heads/master | 2023-01-28T10:45:03.205099 | 2020-12-08T04:51:02 | 2020-12-08T04:51:02 | 319,526,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,903 | java | package com.snb.offsets;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.serialization.StringDeserializer;
import java.time.Duration;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Properties;
//开启类的并行运行模式:点击这个类,选择edit configurations,勾选allow parallel run
//启动消费者,启动成功后,有一个消费者协调器ConsumerCoordinator,负责将topic中的分区分发给当前的消费者
//同一组内的消费者,对topic的消费是均分分区的,再启动一个消费者实例,kafka就会重新分配每个消费者消费的分区
//不同组的消费者,他们之间没有均分的概念
/**
* @Auther:yinzhen
* @Date:2020/11/25 11:45
* @Description:com.snb.quickstart
* @version: 1.0
*/
public class KafkaConsumerOffset03 {
public static void main(String[] ags) {
//1. 创建消费者KafkaConsumer
Properties props = new Properties();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "CentOSA:9092,CentOSB:9092,CentOSC:9092");
//因为消息消费者,需要从kafka的网络服务获取消息,所以需要对key和value进行反序列化
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
//在kafka中,采用订阅模式时,消费者一定要属于某一个消费组,以组的形式去管理消费者,所以,要配置消费者的组信息
props.put(ConsumerConfig.GROUP_ID_CONFIG, "g4");
props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
//配置offset自动提交的时间间隔,10s自动提交offset
props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 10000);
//offset偏移量自动提交
props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true);
//一旦,启动成功后,这两个设置的消费者,后续的读取都一样了,因为,消费者消费完成后,会自动向系统提交偏移量
KafkaConsumer<String, String> consumer = new KafkaConsumer<String, String>(props);
//2. 订阅相关的topics,参数可以是若干个topics,也可以是正则表达式
//这个模式下,我们的消费者是处在一种订阅的形式下的,在这种模式下,我们必须设置消费者所属的消费者组
//它的特性:当当前组的消费者宕机时,kafka会自动将这个消费者所分配的分区分给其他的消费者
consumer.subscribe(Arrays.asList("topic01"));
//3. 遍历消息队列
while (true){
//获取记录,设置隔多长时间抓取数据,设置隔一秒获取一次数据
ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(1));
if (!records.isEmpty()) {//从队列中取到了数据
Iterator<ConsumerRecord<String, String>> recordIterator = records.iterator();
while (recordIterator.hasNext()) {
//获取一个消费消息
ConsumerRecord<String, String> record = recordIterator.next();
String topic = record.topic();
int partition = record.partition();
long offset = record.offset();
String key = record.key();
String value = record.value();
long timestamp = record.timestamp();
System.out.println(topic+"\t"+partition+","+offset+"\t"+key+" "+value+" "+timestamp);
}
}
}
}
}
| [
"869583098@qq.com"
] | 869583098@qq.com |
eb28b8118296ff4ce8029c1da8e3d95fcac847cc | 90346e35c0a1c7b45e76e161e81c98eeaa2ac348 | /apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-6_4/src/test/java/co/elastic/apm/agent/es/restclient/v6_4/AbstractEs6_4ClientInstrumentationTest.java | 779e62f2bbf4352a9efd3845ed6a86868f6e9c1d | [
"Apache-2.0",
"MIT",
"CC0-1.0",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | gregkalapos/apm-agent-java | 0278f4e2e51275b58db3ee8c93c38aa42bad02fa | 504827fa467e0ff70df2eaf7fa62f5d0a9006ba9 | refs/heads/master | 2020-06-13T12:13:01.521765 | 2019-07-21T06:49:15 | 2019-07-21T06:49:15 | 194,649,698 | 0 | 0 | Apache-2.0 | 2019-07-01T10:14:37 | 2019-07-01T10:14:36 | null | UTF-8 | Java | false | false | 11,648 | java | /*-
* #%L
* Elastic APM Java agent
* %%
* Copyright (C) 2018 - 2019 Elastic and contributors
* %%
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. 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.
* #L%
*/
package co.elastic.apm.agent.es.restclient.v6_4;
import co.elastic.apm.agent.es.restclient.AbstractEsClientInstrumentationTest;
import co.elastic.apm.agent.impl.transaction.Span;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
public abstract class AbstractEs6_4ClientInstrumentationTest extends AbstractEsClientInstrumentationTest {
protected static final String USER_NAME = "elastic-user";
protected static final String PASSWORD = "elastic-pass";
@SuppressWarnings("NullableProblems")
protected static RestHighLevelClient client;
@Test
public void testCreateAndDeleteIndex() throws IOException, ExecutionException, InterruptedException {
// Create an Index
doCreateIndex(new CreateIndexRequest(SECOND_INDEX));
validateSpanContentAfterIndexCreateRequest();
// Delete the index
reporter.reset();
doDeleteIndex(new DeleteIndexRequest(SECOND_INDEX));
validateSpanContentAfterIndexDeleteRequest();
}
@Test
public void testTryToDeleteNonExistingIndex() throws IOException, InterruptedException {
ElasticsearchStatusException ese = null;
try {
doDeleteIndex(new DeleteIndexRequest(SECOND_INDEX));
} catch (ElasticsearchStatusException e) {
// sync scenario
ese = e;
} catch (ExecutionException e) {
// async scenario
ese = (ElasticsearchStatusException) e.getCause();
}
assertThat(ese).isNotNull();
assertThat(ese.status().getStatus()).isEqualTo(404);
assertThatErrorsExistWhenDeleteNonExistingIndex();
}
@Test
public void testDocumentScenario() throws Exception {
// Index a document
IndexResponse ir = doIndex(new IndexRequest(INDEX, DOC_TYPE, DOC_ID).source(
jsonBuilder()
.startObject()
.field(FOO, BAR)
.endObject()
).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE));
assertThat(ir.status().getStatus()).isEqualTo(201);
System.out.println(reporter.generateTransactionPayloadJson());
List<Span> spans = reporter.getSpans();
assertThat(spans).hasSize(1);
validateSpanContent(spans.get(0), String.format("Elasticsearch: PUT /%s/%s/%s", INDEX, DOC_TYPE, DOC_ID), 201, "PUT");
// Search the index
reporter.reset();
SearchRequest searchRequest = new SearchRequest(INDEX);
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(QueryBuilders.termQuery(FOO, BAR));
sourceBuilder.from(0);
sourceBuilder.size(5);
searchRequest.source(sourceBuilder);
SearchResponse sr = doSearch(searchRequest);
verifyTotalHits(sr.getHits());
System.out.println(reporter.generateTransactionPayloadJson());
spans = reporter.getSpans();
assertThat(spans).hasSize(1);
Span searchSpan = spans.get(0);
validateSpanContent(searchSpan, String.format("Elasticsearch: POST /%s/_search", INDEX), 200, "POST");
validateDbContextContent(searchSpan, "{\"from\":0,\"size\":5,\"query\":{\"term\":{\"foo\":{\"value\":\"bar\",\"boost\":1.0}}}}");
// Now update and re-search
reporter.reset();
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put(FOO, BAZ);
UpdateRequest updateRequest = new UpdateRequest(INDEX, DOC_TYPE, DOC_ID).doc(jsonMap).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
UpdateResponse ur = doUpdate(updateRequest);
assertThat(ur.status().getStatus()).isEqualTo(200);
sr = doSearch(new SearchRequest(INDEX));
assertThat(sr.getHits().getAt(0).getSourceAsMap().get(FOO)).isEqualTo(BAZ);
System.out.println(reporter.generateTransactionPayloadJson());
spans = reporter.getSpans();
assertThat(spans).hasSize(2);
boolean updateSpanFound = false;
for(Span span: spans) {
if(span.getName().toString().contains("_update")) {
updateSpanFound = true;
break;
}
}
assertThat(updateSpanFound).isTrue();
// Finally - delete the document
reporter.reset();
DeleteResponse dr = doDelete(new DeleteRequest(INDEX, DOC_TYPE, DOC_ID));
assertThat(dr.status().getStatus()).isEqualTo(200);
validateSpanContent(spans.get(0), String.format("Elasticsearch: DELETE /%s/%s/%s", INDEX, DOC_TYPE, DOC_ID), 200, "DELETE");
System.out.println(reporter.generateTransactionPayloadJson());
}
protected void verifyTotalHits(SearchHits searchHits) {
}
@Test
public void testScenarioAsBulkRequest() throws IOException, ExecutionException, InterruptedException {
doBulk(new BulkRequest()
.add(new IndexRequest(INDEX, DOC_TYPE, "2").source(
jsonBuilder()
.startObject()
.field(FOO, BAR)
.endObject()
))
.add(new DeleteRequest(INDEX, DOC_TYPE, "2")));
validateSpanContentAfterBulkRequest();
}
private interface ClientMethod<Req, Res> {
void invoke(Req request, RequestOptions options, ActionListener<Res> listener);
}
private <Req, Res> Res invokeAsync(Req request, ClientMethod<Req, Res> method) throws InterruptedException, ExecutionException {
final CompletableFuture<Res> resultFuture = new CompletableFuture<>();
method.invoke(request, RequestOptions.DEFAULT, new ActionListener<>() {
@Override
public void onResponse(Res response) {
resultFuture.complete(response);
}
@Override
public void onFailure(Exception e) {
resultFuture.completeExceptionally(e);
}
});
return resultFuture.get();
}
protected CreateIndexResponse doCreateIndex(CreateIndexRequest createIndexRequest) throws IOException, ExecutionException, InterruptedException {
if (async) {
ClientMethod<CreateIndexRequest, CreateIndexResponse> method =
(request, options, listener) -> client.indices().createAsync(request, options, listener);
return invokeAsync(createIndexRequest, method);
}
return client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
}
protected AcknowledgedResponse doDeleteIndex(DeleteIndexRequest deleteIndexRequest) throws IOException, ExecutionException, InterruptedException {
if (async) {
ClientMethod<DeleteIndexRequest, AcknowledgedResponse> method =
(request, options, listener) -> client.indices().deleteAsync(request, options, listener);
return invokeAsync(deleteIndexRequest, method);
}
return client.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT);
}
protected IndexResponse doIndex(IndexRequest indexRequest) throws ExecutionException, InterruptedException, IOException {
if (async) {
ClientMethod<IndexRequest, IndexResponse> method =
(request, options, listener) -> client.indexAsync(request, options, listener);
return invokeAsync(indexRequest, method);
}
return client.index(indexRequest, RequestOptions.DEFAULT);
}
protected SearchResponse doSearch(SearchRequest searchRequest) throws IOException, ExecutionException, InterruptedException {
if (async) {
ClientMethod<SearchRequest, SearchResponse> method =
(request, options, listener) -> client.searchAsync(request, options, listener);
return invokeAsync(searchRequest, method);
}
return client.search(searchRequest, RequestOptions.DEFAULT);
}
protected UpdateResponse doUpdate(UpdateRequest updateRequest) throws IOException, ExecutionException, InterruptedException {
if (async) {
ClientMethod<UpdateRequest, UpdateResponse> method =
(request, options, listener) -> client.updateAsync(request, options, listener);
return invokeAsync(updateRequest, method);
}
return client.update(updateRequest, RequestOptions.DEFAULT);
}
protected DeleteResponse doDelete(DeleteRequest deleteRequest) throws IOException, ExecutionException, InterruptedException {
if (async) {
ClientMethod<DeleteRequest, DeleteResponse> method =
(request, options, listener) -> client.deleteAsync(request, options, listener);
return invokeAsync(deleteRequest, method);
}
return client.delete(deleteRequest, RequestOptions.DEFAULT);
}
protected BulkResponse doBulk(BulkRequest bulkRequest) throws IOException, ExecutionException, InterruptedException {
if (async) {
ClientMethod<BulkRequest, BulkResponse> method =
(request, options, listener) -> client.bulkAsync(request, options, listener);
return invokeAsync(bulkRequest, method);
}
return client.bulk(bulkRequest, RequestOptions.DEFAULT);
}
}
| [
"41850454+eyalkoren@users.noreply.github.com"
] | 41850454+eyalkoren@users.noreply.github.com |
2fb17c4d0b25944db167a264c20d8a59a5a103dd | d204c68f20d6dfa9bc3915dd63f26b0bd118d70a | /src/main/java/icfpc2020/eval/value/UndefinedValue.java | c9c6fc7abe39f78fd3a0c5b0d857aea1c87b413f | [
"MIT"
] | permissive | olegs/icfpc2020 | 04345f173b2dc01f6942acc1ffd1be9e4569ef2b | 2986c7a968fa1a82045eddd8a74fb1f8275ee6f9 | refs/heads/master | 2022-11-21T15:20:54.067015 | 2020-07-20T13:03:12 | 2020-07-20T13:03:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 636 | java | package icfpc2020.eval.value;
import org.jetbrains.annotations.NotNull;
/**
* @author incubos
*/
public class UndefinedValue implements LazyValue {
@NotNull
private final String name;
public UndefinedValue(@NotNull final String name) {
this.name = name;
}
@Override
public String toString() {
return "undefined " + name;
}
@Override
@NotNull
public LazyValue apply(@NotNull LazyValue arg) {
throw new UnsupportedOperationException(toString());
}
@Override
public LazyValue eval() {
throw new UnsupportedOperationException(toString());
}
}
| [
"alesavin@gmail.com"
] | alesavin@gmail.com |
b8034f2c5c1975d2abc57e0f915f0eb200a7fe88 | d094fdcfc264e03978a843fa8a90b2fd531718d4 | /src/ast/AbstractCuerpoMetodo.java | 386bf57f5bc7860f3d730c79c23f84ae7a2b4713 | [] | no_license | alcalaperez/Dlp-2016-2017 | 5cf5541480cd67ddfe137023c473e623384c58fe | c83e2fe6cef4d1835eba9c22178f7eb2a545afae | refs/heads/master | 2021-01-21T22:06:29.580622 | 2017-06-23T14:06:25 | 2017-06-23T14:06:25 | 95,170,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | /**
* @generated VGen 1.3.3
*/
package ast;
public abstract class AbstractCuerpoMetodo extends AbstractTraceable implements CuerpoMetodo {
private DefMetodo metodo;
@Override
public void setMetodoActual(DefMetodo node) {
metodo = node;
}
@Override
public DefMetodo getMetodoActual() {
return metodo;
}
}
| [
"uo226321@uniovi.es"
] | uo226321@uniovi.es |
2de1f4b7da625b467d28ef817d926028f191a961 | 5bddc192c552b584b5c19f581c7eaaa3da273b98 | /org/spongepowered/asm/util/SignaturePrinter.java | ff18b9cc241ed216f97a0975be807f1a1c390301 | [] | no_license | noatmc-archived/jigokusense-leak | 97f557bf41f8e45c71ca705950ed5fdf56e6b3ad | d8df9210d3a5a03183af4518ad5367c899e7515a | refs/heads/main | 2023-08-28T10:44:51.901066 | 2021-11-12T04:28:05 | 2021-11-12T04:28:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,985 | java | /*
* Decompiled with CFR 0.151.
*
* Could not load the following classes:
* com.google.common.base.Strings
*/
package org.spongepowered.asm.util;
import com.google.common.base.Strings;
import org.spongepowered.asm.lib.Type;
import org.spongepowered.asm.lib.tree.LocalVariableNode;
import org.spongepowered.asm.lib.tree.MethodNode;
import org.spongepowered.asm.mixin.injection.struct.MemberInfo;
public class SignaturePrinter {
private final String name;
private final Type returnType;
private final Type[] argTypes;
private final String[] argNames;
private String modifiers = "private void";
private boolean fullyQualified;
public SignaturePrinter(MethodNode method) {
this(method.name, Type.VOID_TYPE, Type.getArgumentTypes(method.desc));
this.setModifiers(method);
}
public SignaturePrinter(MethodNode method, String[] argNames) {
this(method.name, Type.VOID_TYPE, Type.getArgumentTypes(method.desc), argNames);
this.setModifiers(method);
}
public SignaturePrinter(MemberInfo member) {
this(member.name, member.desc);
}
public SignaturePrinter(String name, String desc) {
this(name, Type.getReturnType(desc), Type.getArgumentTypes(desc));
}
public SignaturePrinter(String name, Type returnType, Type[] args) {
this.name = name;
this.returnType = returnType;
this.argTypes = new Type[args.length];
this.argNames = new String[args.length];
int v = 0;
for (int l = 0; l < args.length; ++l) {
if (args[l] == null) continue;
this.argTypes[l] = args[l];
this.argNames[l] = "var" + v++;
}
}
public SignaturePrinter(String name, Type returnType, LocalVariableNode[] args) {
this.name = name;
this.returnType = returnType;
this.argTypes = new Type[args.length];
this.argNames = new String[args.length];
for (int l = 0; l < args.length; ++l) {
if (args[l] == null) continue;
this.argTypes[l] = Type.getType(args[l].desc);
this.argNames[l] = args[l].name;
}
}
public SignaturePrinter(String name, Type returnType, Type[] argTypes, String[] argNames) {
this.name = name;
this.returnType = returnType;
this.argTypes = argTypes;
this.argNames = argNames;
if (this.argTypes.length > this.argNames.length) {
throw new IllegalArgumentException(String.format("Types array length must not exceed names array length! (names=%d, types=%d)", this.argNames.length, this.argTypes.length));
}
}
public String getFormattedArgs() {
return this.appendArgs(new StringBuilder(), true, true).toString();
}
public String getReturnType() {
return SignaturePrinter.getTypeName(this.returnType, false, this.fullyQualified);
}
public void setModifiers(MethodNode method) {
String returnType = SignaturePrinter.getTypeName(Type.getReturnType(method.desc), false, this.fullyQualified);
if ((method.access & 1) != 0) {
this.setModifiers("public " + returnType);
} else if ((method.access & 4) != 0) {
this.setModifiers("protected " + returnType);
} else if ((method.access & 2) != 0) {
this.setModifiers("private " + returnType);
} else {
this.setModifiers(returnType);
}
}
public SignaturePrinter setModifiers(String modifiers) {
this.modifiers = modifiers.replace("${returnType}", this.getReturnType());
return this;
}
public SignaturePrinter setFullyQualified(boolean fullyQualified) {
this.fullyQualified = fullyQualified;
return this;
}
public boolean isFullyQualified() {
return this.fullyQualified;
}
public String toString() {
return this.appendArgs(new StringBuilder().append(this.modifiers).append(" ").append(this.name), false, true).toString();
}
public String toDescriptor() {
StringBuilder args = this.appendArgs(new StringBuilder(), true, false);
return args.append(SignaturePrinter.getTypeName(this.returnType, false, this.fullyQualified)).toString();
}
private StringBuilder appendArgs(StringBuilder sb, boolean typesOnly, boolean pretty) {
sb.append('(');
for (int var = 0; var < this.argTypes.length; ++var) {
if (this.argTypes[var] == null) continue;
if (var > 0) {
sb.append(',');
if (pretty) {
sb.append(' ');
}
}
try {
String name = typesOnly ? null : (Strings.isNullOrEmpty((String)this.argNames[var]) ? "unnamed" + var : this.argNames[var]);
this.appendType(sb, this.argTypes[var], name);
continue;
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
}
return sb.append(")");
}
private StringBuilder appendType(StringBuilder sb, Type type, String name) {
switch (type.getSort()) {
case 9: {
return SignaturePrinter.appendArraySuffix(this.appendType(sb, type.getElementType(), name), type);
}
case 10: {
return this.appendType(sb, type.getClassName(), name);
}
}
sb.append(SignaturePrinter.getTypeName(type, false, this.fullyQualified));
if (name != null) {
sb.append(' ').append(name);
}
return sb;
}
private StringBuilder appendType(StringBuilder sb, String typeName, String name) {
if (!this.fullyQualified) {
typeName = typeName.substring(typeName.lastIndexOf(46) + 1);
}
sb.append(typeName);
if (typeName.endsWith("CallbackInfoReturnable")) {
sb.append('<').append(SignaturePrinter.getTypeName(this.returnType, true, this.fullyQualified)).append('>');
}
if (name != null) {
sb.append(' ').append(name);
}
return sb;
}
public static String getTypeName(Type type, boolean box) {
return SignaturePrinter.getTypeName(type, box, false);
}
public static String getTypeName(Type type, boolean box, boolean fullyQualified) {
switch (type.getSort()) {
case 0: {
return box ? "Void" : "void";
}
case 1: {
return box ? "Boolean" : "boolean";
}
case 2: {
return box ? "Character" : "char";
}
case 3: {
return box ? "Byte" : "byte";
}
case 4: {
return box ? "Short" : "short";
}
case 5: {
return box ? "Integer" : "int";
}
case 6: {
return box ? "Float" : "float";
}
case 7: {
return box ? "Long" : "long";
}
case 8: {
return box ? "Double" : "double";
}
case 9: {
return SignaturePrinter.getTypeName(type.getElementType(), box, fullyQualified) + SignaturePrinter.arraySuffix(type);
}
case 10: {
String typeName = type.getClassName();
if (!fullyQualified) {
typeName = typeName.substring(typeName.lastIndexOf(46) + 1);
}
return typeName;
}
}
return "Object";
}
private static String arraySuffix(Type type) {
return Strings.repeat((String)"[]", (int)type.getDimensions());
}
private static StringBuilder appendArraySuffix(StringBuilder sb, Type type) {
for (int i = 0; i < type.getDimensions(); ++i) {
sb.append("[]");
}
return sb;
}
}
| [
"noatprotonvpn@gmail.com"
] | noatprotonvpn@gmail.com |
03a63df934a73381ae0e82c5cd06524ae7c8ffc9 | 76d979403f324461155c505c6bc95009b7f74cde | /blogserver/src/main/java/org/sang/controller/blog/ArticleController.java | 68f19d3177cf2f9e781536dc5e0cd202d8253560 | [] | no_license | xutong8/blogserver | e5644f28c19d542df52c9fc7c5c914834eb88de0 | fa783eedcd9e255bd0615b7ff2b8be0cfb1120f3 | refs/heads/master | 2021-04-04T00:41:32.179089 | 2020-03-18T14:49:52 | 2020-03-18T14:49:52 | 248,409,572 | 1 | 0 | null | 2020-03-19T04:20:53 | 2020-03-19T04:20:52 | null | UTF-8 | Java | false | false | 4,435 | java | package org.sang.controller.blog;
import org.apache.commons.io.IOUtils;
import org.sang.bean.blog.Article;
import org.sang.bean.blog.RespBean;
import org.sang.service.blog.ArticleService;
import org.sang.utils.Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Created by sang on 2017/12/20.
*/
@RestController
@RequestMapping("/article")
public class ArticleController {
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
@Autowired
ArticleService articleService;
@RequestMapping(value = "/", method = RequestMethod.POST)
public RespBean addNewArticle(Article article) {
int result = articleService.addNewArticle(article);
if (result == 1) {
return new RespBean("success", article.getId() + "");
} else {
return new RespBean("error", article.getState() == 0 ? "文章保存失败!" : "文章发表失败!");
}
}
/**
* 上传图片
*
* @return 返回值为图片的地址
*/
@RequestMapping(value = "/uploadimg", method = RequestMethod.POST)
public RespBean uploadImg(HttpServletRequest req, MultipartFile image) {
StringBuffer url = new StringBuffer();
String filePath = "/blogimg/" + sdf.format(new Date());
String imgFolderPath = req.getServletContext().getRealPath(filePath);
File imgFolder = new File(imgFolderPath);
if (!imgFolder.exists()) {
imgFolder.mkdirs();
}
url.append(req.getScheme())
.append("://")
.append(req.getServerName())
.append(":")
.append(req.getServerPort())
.append(req.getContextPath())
.append(filePath);
String imgName = UUID.randomUUID() + "_" + image.getOriginalFilename().replaceAll(" ", "");
try {
IOUtils.write(image.getBytes(), new FileOutputStream(new File(imgFolder, imgName)));
url.append("/").append(imgName);
return new RespBean("success", url.toString());
} catch (IOException e) {
e.printStackTrace();
}
return new RespBean("error", "上传失败!");
}
@RequestMapping(value = "/all", method = RequestMethod.GET)
public Map<String, Object> getArticleByState(@RequestParam(value = "state", defaultValue = "-1") Integer state, @RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "count", defaultValue = "6") Integer count,String keywords) {
int totalCount = articleService.getArticleCountByState(state, Util.getCurrentUser().getId(),keywords);
List<Article> articles = articleService.getArticleByState(state, page, count,keywords);
Map<String, Object> map = new HashMap<>();
map.put("totalCount", totalCount);
map.put("articles", articles);
return map;
}
@RequestMapping(value = "/{aid}", method = RequestMethod.GET)
public Article getArticleById(@PathVariable Long aid) {
return articleService.getArticleById(aid);
}
@RequestMapping(value = "/dustbin", method = RequestMethod.PUT)
public RespBean updateArticleState(Long[] aids, Integer state) {
if (articleService.updateArticleState(aids, state) == aids.length) {
return new RespBean("success", "删除成功!");
}
return new RespBean("error", "删除失败!");
}
@RequestMapping(value = "/restore", method = RequestMethod.PUT)
public RespBean restoreArticle(Integer articleId) {
if (articleService.restoreArticle(articleId) == 1) {
return new RespBean("success", "还原成功!");
}
return new RespBean("error", "还原失败!");
}
@RequestMapping("/dataStatistics")
public Map<String,Object> dataStatistics() {
Map<String, Object> map = new HashMap<>();
List<String> categories = articleService.getCategories();
List<Integer> dataStatistics = articleService.getDataStatistics();
map.put("categories", categories);
map.put("ds", dataStatistics);
return map;
}
}
| [
"735113294@qq.com"
] | 735113294@qq.com |
87beca8fad722ffdfeada849c8909be3e0737024 | fc7f0ffa8c365d37a15c6515e0d845bcbab6081b | /mBase/src/main/java/com/phoenix/phoenixbase/test/ImageHelper.java | 035c9b3562da72477893eea6ce012583cbf1ee40 | [] | no_license | PhoenixGJH/PhoenixBase | 1cdd1bffe28755b728c94af45f7531a12fa6319a | 99ebeb5b16ca370fcdecc7e0f9cde9f47712553c | refs/heads/master | 2016-08-12T14:52:36.800757 | 2016-03-07T05:27:23 | 2016-03-07T05:27:23 | 53,296,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,513 | java | package com.phoenix.phoenixbase.test;
import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;
import com.phoenix.phoenixbase.R;
public class ImageHelper extends com.phoenix.phoenixbase.image.ImageHelper {
private final static String TAG = "ImageHelper";
private static ImageHelper instance;
private Context mContext;
public static ImageHelper getInstance() {
if (instance == null) {
synchronized (ImageHelper.class) {
if (instance == null) {
instance = new ImageHelper();
}
}
}
return instance;
}
protected ImageHelper() {
mContext = TApplication.getContext();
}
@Override
protected String getDiskCachePath() {
return TAppConfig.IMAGE_CACHE_PATH;
}
@Override
protected int getDiskCacheSize() {
return TAppConfig.IMAGE_CACHE_MAX_SIZE;
}
@Override
protected int getErrorImageID() {
return R.mipmap.ic_launcher;
}
@Override
protected int getDefaultImageID() {
return R.mipmap.ic_launcher;
}
@Override
protected void get(String url, ImageView imageView) {
super.get(url, imageView);
}
@Override
protected void loadImage(ImageView imageView, String path) {
super.loadImage(imageView, path);
}
@Override
protected void loadImage(ImageView imageView, Uri uri) {
super.loadImage(imageView, uri);
}
}
| [
"jianhua_gou@hiersun.com"
] | jianhua_gou@hiersun.com |
7246fe58a67ae4f3d90c4583038415dd2f9c4c02 | b9ee4c4312890ea661901d5c96f5dfca7f681f29 | /TDALista/Position.java | d972f9d6cf8a23b004a983ebc3ea2cdd02260808 | [] | no_license | MatiasPericolo/Proyecto1-Parte2-Pericolo | 66dad5204afc5158ec794ab782678a3585834d16 | 5e6855f0d6f1bfbbf393071fbaa7dc6e26ee00a8 | refs/heads/master | 2022-12-22T20:42:38.915770 | 2020-09-27T18:43:27 | 2020-09-27T18:43:27 | 298,897,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package TDALista;
/**
* Interface Position
* @author Horus Moro, Tomas Scandalitta -- ED 2018.
*/
public interface Position<E> {
/**
* Devuelve el elemento de la posicion.
* @return Elemento de la posicion.
*/
public E element();
}
| [
"matiaspericolo@gmail.com"
] | matiaspericolo@gmail.com |
677e1ae290ef079bee45cef9e577925660896bb3 | 6b87a819bea2a777e0e022243c200aaecac92cd0 | /Java/src/Tema5/Ejercicio_28.java | 028a0be335e36f6a1ec03458ca4d9fbbdcecba20 | [] | no_license | AngelBarrosoDelRio/EjerciciosJava | 02694d0857b4897573937ae7c4b9e2da99265dd3 | fb9a19e53b0f5deeefc30c3ea414da2379c2a30f | refs/heads/master | 2021-01-17T07:15:23.625260 | 2016-05-23T19:18:49 | 2016-05-23T19:18:49 | 43,482,033 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,614 | java | /*
* Escribe un programa que calcule el factorial de un número entero leído por teclado.
*/
package Tema5;
import java.util.Scanner;
/**
*
* @author angelo
*/
public class Ejercicio_28 {
public static void main(String[] args) {
Scanner entrada = new Scanner (System.in);
System.out.println("A continuacion le pedire que introduzca un numero "
+ "entero POSITIVO y le dire su factorial");
int numeroIntro;
do{
System.out.print("Por favor introduzca un numero: ");
numeroIntro= entrada.nextInt();
if(numeroIntro<0){
System.out.println("el numero introducido debe ser positivo.");
}
}while(numeroIntro<0);
int factorial=numeroIntro;
if(numeroIntro==0){
System.out.println("El factorial de "+numeroIntro+"!=1");
}else if(numeroIntro>0){
System.out.print("El factorial de "+numeroIntro+"!=");
for(int i=1;i<numeroIntro;i++){
factorial*=i;
System.out.print(" x ");
if(i<=numeroIntro){
System.out.print(i);
}
}
System.out.println(" = "+factorial);
System.out.println("");
}
}
}
| [
"you@example.com"
] | you@example.com |
156ad20b7f33180ac383ef852c056de6798618b7 | e86e60cc260a1a287eafe6a083bb3a3ecfc65fc3 | /src/main/java/br/com/sidlar/dailyquiz/domain/resposta/CartaoResposta.java | 32a0e7833e361627307a0fa663ed94bdebb16a3f | [] | no_license | admilsonernesto/DailyQuiz-1 | 9fb4ad6f359de790293ad4ca4ce224ec20bf2c1b | 2a50823caa7fcfb85b43978628980bec34df68ff | refs/heads/master | 2021-01-14T14:16:24.440550 | 2015-02-03T15:56:45 | 2015-02-03T15:56:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,692 | java | package br.com.sidlar.dailyquiz.domain.resposta;
import br.com.sidlar.dailyquiz.domain.questionario.Questao;
import br.com.sidlar.dailyquiz.domain.questionario.Questionario;
import com.google.common.collect.Lists;
import java.util.List;
/**
* D.T.O.
* @author Admilson
*/
public class CartaoResposta {
private Long idQuestionario;
private String nomeQuestionario;
private List<ItemCartaoResposta> itensCartao;
public CartaoResposta() {
}
public CartaoResposta(Questionario questionario) {
this.nomeQuestionario = questionario.getNome();
this.idQuestionario = questionario.getId();
this.itensCartao = criaItensCartaoResposta(questionario);
}
private List<ItemCartaoResposta> criaItensCartaoResposta(Questionario questionario) {
List<ItemCartaoResposta> itensQuestoes = Lists.newArrayList();
for (Questao questao : questionario.getQuestoes()) {
itensQuestoes.add(new ItemCartaoResposta(questao.getId(), questao.getEnunciado(), questao.getAlternativas()));
}
return itensQuestoes;
}
public String getNomeQuestionario() {
return nomeQuestionario;
}
public void setNomeQuestionario(String nomeQuestionario) {
this.nomeQuestionario = nomeQuestionario;
}
public Long getIdQuestionario() {
return idQuestionario;
}
public void setIdQuestionario(Long idQuestionario) {
this.idQuestionario = idQuestionario;
}
public List<ItemCartaoResposta> getItensCartao() {
return itensCartao;
}
public void setItensCartao(List<ItemCartaoResposta> itensCartao) {
this.itensCartao = itensCartao;
}
}
| [
"admilsonernesto@globomail.com"
] | admilsonernesto@globomail.com |
62783e831368fb6abd255333115b4d20251105b5 | 21b0e08b02a6f351f14811999dca6e510ef1c304 | /src/test/java/kr/co/hta/board/service/BoardServiceTest.java | 55ad35680a14a145f5d50c64ff9d869f665e855c | [] | no_license | EunSungChoi/sample-pro | 87d2db120762022b66260cd93441911152e77470 | 7b228aebc360afc6d8cceff2ed88dde92e0ed96d | refs/heads/master | 2020-03-17T13:16:15.599442 | 2018-05-18T03:39:34 | 2018-05-18T03:39:34 | 133,624,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | package kr.co.hta.board.service;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import kr.co.hta.board.vo.Board;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:/META-INF/spring/test-root-context.xml")
public class BoardServiceTest {
@Autowired
BoardService boardService;
@Test
public void testConfig() {
assertThat(boardService, notNullValue());
}
@Test
public void testBoardList() {
List<Board> boards = boardService.getAllBoards();
assertThat(boards.size(), is(8));
}
@Test
public void testBoardDetail() {
Board board = boardService.getBoardDetail(141);
assertThat(board, notNullValue());
}
public void test() {
}
}
| [
"ces3080@gmail.com"
] | ces3080@gmail.com |
6f568822cbb81dfc2b2881a098d5536a529096bd | 332a48b1ced9e192a19c160fb76196f305e8816b | /src/test/java/kr/re/kitri/hello/dao/UserDaoTests.java | 61346f33ab1f510abf048afc738ba89b85e50c72 | [] | no_license | choi-young-min/spring-init | d651a5536d1195539b77f9f63e286521bd2d4985 | b00c4812838d7a33cd49bf095044652f09b83c45 | refs/heads/master | 2022-08-21T21:28:06.362028 | 2020-05-29T07:48:54 | 2020-05-29T07:48:54 | 267,245,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 974 | java | package kr.re.kitri.hello.dao;
import kr.re.kitri.hello.model.User;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
//Junit Test
@SpringBootTest
public class UserDaoTests {
@Autowired
private UserDAO userDAO;
@Test
public void testInsertUser(){
User user = new User("kkkk","aaaa",30);
userDAO.insertUser(user);
}
@Test
public void testSelectAllUsers(){
List<User> users = userDAO.selectAllUsers();
//참이면 통과
assertTrue(users.size()>0);
}
@Test
public void testSelectUserByUserId(){
String userid = "LEE";
User user = userDAO.selectUserByUserId(userid);
assertEquals("LEE",user.getUserId());
}
}
| [
"chldudals025@naver.com"
] | chldudals025@naver.com |
5081b8bad0f3d8394848a9db83db9478c125b544 | 6259a830a3d9e735e6779e41a678a71b4c27feb2 | /anchor-plugin-image-task/src/main/java/org/anchoranalysis/plugin/image/task/bean/grouped/selectchannels/All.java | 4cbcde6ef9b38c72d2516ffff4f812e9f0ed5284 | [
"MIT"
] | permissive | anchoranalysis/anchor-plugins | 103168052419b1072d0f8cd0201dabfb7dc84f15 | 5817d595d171b8598ab9c0195586c5d1f83ad92e | refs/heads/master | 2023-07-24T02:38:11.667846 | 2023-07-18T07:51:10 | 2023-07-18T07:51:10 | 240,064,307 | 2 | 0 | MIT | 2023-07-18T07:51:12 | 2020-02-12T16:48:04 | Java | UTF-8 | Java | false | false | 3,565 | java | /*-
* #%L
* anchor-plugin-image-task
* %%
* Copyright (C) 2010 - 2020 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche
* %%
* 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.
* #L%
*/
package org.anchoranalysis.plugin.image.task.bean.grouped.selectchannels;
import java.util.Set;
import java.util.stream.Stream;
import org.anchoranalysis.core.exception.OperationFailedException;
import org.anchoranalysis.core.functional.CheckedStream;
import org.anchoranalysis.core.identifier.provider.NamedProviderGetException;
import org.anchoranalysis.image.core.stack.Stack;
import org.anchoranalysis.plugin.image.task.channel.aggregator.NamedChannels;
import org.anchoranalysis.plugin.image.task.grouped.ChannelSource;
/**
* Selects all possible channels from all possible stacks
*
* <p>If a stack has a single-channel, it it uses this name as an output If a stack has multiple
* channels, this name is used but suffixed with a number of each channel (00, 01 etc.)
*
* @author Owen Feehan
*/
public class All extends FromStacks {
@Override
public NamedChannels selectChannels(ChannelSource source, boolean checkType)
throws OperationFailedException {
Set<String> keys = source.getStackStore().keys();
Stream<NamedChannels> stream =
CheckedStream.map(
keys.stream(),
OperationFailedException.class,
key -> extractAllChannels(source, key, checkType));
return new NamedChannels(stream);
}
private NamedChannels extractAllChannels(
ChannelSource source, String stackName, boolean checkType)
throws OperationFailedException {
try {
// We make a single histogram
Stack stack = source.getStackStore().getException(stackName);
NamedChannels out = new NamedChannels(stack.isRGB());
for (int i = 0; i < stack.getNumberChannels(); i++) {
String outputName = stackName + createSuffix(i, stack.getNumberChannels() > 1);
out.add(outputName, source.extractChannel(stack, checkType, i));
}
return out;
} catch (NamedProviderGetException e) {
throw new OperationFailedException(e.summarize());
}
}
private static String createSuffix(int index, boolean hasMultipleChannels) {
if (hasMultipleChannels) {
return String.format("%02d", index);
} else {
return "";
}
}
}
| [
"owenfeehan@users.noreply.github.com"
] | owenfeehan@users.noreply.github.com |
8305519624c0965379f0b6c13570cb1cc546acbf | dbb672669f7484f617fd9f909e62601c447915f5 | /src/main/java/com/shoppinglist/model/database/TokenType.java | 2a4106a64402880c38bf98201c63a4d74fdd391c | [] | no_license | sd-2019-30238/final-project-nicu97o | 495efd4734fb5aa4735bc2a1b4f89b1a1c78efda | db6ada4715e958b95e28e23b67cd70c19844ea87 | refs/heads/master | 2020-04-30T21:36:38.238846 | 2019-05-21T17:14:25 | 2019-05-21T17:14:25 | 177,097,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 99 | java | package com.shoppinglist.model.database;
public enum TokenType {
ACTIVATION, PASSWORD_RESET
}
| [
"tuturuganicu@gmail.com"
] | tuturuganicu@gmail.com |
1c9cd553d5bac8f650cbf7e35b6ee783d1f4e57f | 242368d8c6865e97532882b53527a5edbd55c117 | /src/com/factory/ConnectionFactory.java | 44d41ae69535484557f851a2c8be71d89bb3a360 | [] | no_license | AkshayJavaBoy/Form_Validation2 | 3a5f99ebffe2439cc1b1cc68e33ba8270a0dccc4 | 93b67e245183783b48c4bae57083b5e297c814ec | refs/heads/main | 2023-05-19T01:42:57.082986 | 2021-06-12T15:09:08 | 2021-06-12T15:09:08 | 376,284,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | package com.factory;
import java.sql.Connection;
import java.sql.DriverManager;
public class ConnectionFactory
{
private static Connection conn = null;
static {
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/akshay", "root", "12345");
} catch (Exception e) {
e.printStackTrace();
}
}
public static Connection getConnection() {
return conn;
}
}
| [
"akshay.maske15@it.sce.edu.in"
] | akshay.maske15@it.sce.edu.in |
20503271e9add46dceeb2182e3f1c90abbaca405 | cdeee1295065d0ba965dd0c502973e9c3aa60618 | /gameserver/data/scripts/quests/_147_PathToBecomingAnEliteMercenary.java | a3c2519a262c0cea94402c2c7b6532e104566af9 | [] | no_license | forzec/l-server | 526b1957f289a4223942d3746143769c981a5508 | 0f39edf60a14095b269b4a87c1b1ac01c2eb45d8 | refs/heads/master | 2021-01-10T11:39:14.088518 | 2016-03-19T18:28:04 | 2016-03-19T18:28:04 | 54,065,298 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,565 | java | package quests;
import org.mmocore.gameserver.model.Player;
import org.mmocore.gameserver.model.entity.events.impl.DominionSiegeEvent;
import org.mmocore.gameserver.model.entity.residence.Castle;
import org.mmocore.gameserver.model.instances.NpcInstance;
import org.mmocore.gameserver.model.quest.Quest;
import org.mmocore.gameserver.model.quest.QuestState;
import org.mmocore.gameserver.network.l2.components.NpcString;
import org.mmocore.gameserver.network.l2.s2c.ExShowScreenMessage;
/**
* @author pchayka
*/
public class _147_PathToBecomingAnEliteMercenary extends Quest
{
private final int[] MERCENARY_CAPTAINS = {
36481,
36482,
36483,
36484,
36485,
36486,
36487,
36488,
36489
};
private final int[] CATAPULTAS = {
36499,
36500,
36501,
36502,
36503,
36504,
36505,
36506,
36507
};
public _147_PathToBecomingAnEliteMercenary()
{
super(PARTY_ALL);
addStartNpc(MERCENARY_CAPTAINS);
addKillId(CATAPULTAS);
}
@Override
public String onEvent(String event, QuestState st, NpcInstance npc)
{
String htmltext = event;
if(event.equalsIgnoreCase("gludio_merc_cap_q0147_04b.htm"))
{
st.giveItems(13766, 1);
}
else if(event.equalsIgnoreCase("gludio_merc_cap_q0147_07.htm"))
{
st.setCond(1);
st.setState(STARTED);
st.playSound(SOUND_ACCEPT);
}
return htmltext;
}
@Override
public String onTalk(NpcInstance npc, QuestState st)
{
Player player = st.getPlayer();
Castle castle = npc.getCastle();
String htmlText = NO_QUEST_DIALOG;
int cond = st.getCond();
if(cond == 0)
{
if(player.getClan() != null)
{
if(player.getClan().getCastle() == castle.getId())
return "gludio_merc_cap_q0147_01.htm";
else if(player.getClan().getCastle() > 0)
return "gludio_merc_cap_q0147_02.htm";
}
if(player.getLevel() < 40 || player.getClassId().getLevel() <= 2)
htmlText = "gludio_merc_cap_q0147_03.htm";
else if(st.getQuestItemsCount(13766) < 1)
htmlText = "gludio_merc_cap_q0147_04a.htm";
else
htmlText = "gludio_merc_cap_q0147_04.htm";
}
else if(cond == 1 || cond == 2 || cond == 3)
htmlText = "gludio_merc_cap_q0147_08.htm";
else if(cond == 4)
{
htmlText = "gludio_merc_cap_q0147_09.htm";
st.takeAllItems(13766);
st.giveItems(13767, 1);
st.setState(COMPLETED);
st.playSound(SOUND_FINISH);
st.exitCurrentQuest(false);
}
return htmlText;
}
@Override
public String onKill(Player killed, QuestState st)
{
if(st.getCond() == 1 || st.getCond() == 3)
{
if(isValidKill(killed, st.getPlayer()))
{
int killedCount = st.getInt("enemies");
int maxCount = 10;
killedCount++;
if(killedCount < maxCount)
{
st.set("enemies", killedCount);
st.getPlayer().sendPacket(new ExShowScreenMessage(NpcString.YOU_HAVE_DEFEATED_S2_OF_S1_ENEMIES, 4000, ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER, true, String.valueOf(maxCount), String.valueOf(killedCount)));
}
else
{
if(st.getCond() == 1)
st.setCond(2);
else if(st.getCond() == 3)
st.setCond(4);
st.unset("enemies");
st.getPlayer().sendPacket(new ExShowScreenMessage(NpcString.YOU_WEAKENED_THE_ENEMYS_ATTACK, 4000, ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER, true));
}
}
}
return null;
}
@Override
public String onKill(NpcInstance npc, QuestState st)
{
if(isValidNpcKill(st.getPlayer(), npc))
{
if(st.getCond() == 1)
st.setCond(3);
else if(st.getCond() == 2)
st.setCond(4);
}
return null;
}
private boolean isValidKill(Player killed, Player killer)
{
DominionSiegeEvent killedSiegeEvent = killed.getEvent(DominionSiegeEvent.class);
DominionSiegeEvent killerSiegeEvent = killer.getEvent(DominionSiegeEvent.class);
if(killedSiegeEvent == null || killerSiegeEvent == null)
return false;
if(killedSiegeEvent == killerSiegeEvent)
return false;
if(killed.getLevel() < 61)
return false;
return true;
}
private boolean isValidNpcKill(Player killer, NpcInstance npc)
{
DominionSiegeEvent npcSiegeEvent = npc.getEvent(DominionSiegeEvent.class);
DominionSiegeEvent killerSiegeEvent = killer.getEvent(DominionSiegeEvent.class);
if(npcSiegeEvent == null || killerSiegeEvent == null)
return false;
if(npcSiegeEvent == killerSiegeEvent)
return false;
return true;
}
@Override
public void onCreate(QuestState qs)
{
super.onCreate(qs);
qs.addPlayerOnKillListener();
}
@Override
public void onAbort(QuestState qs)
{
qs.removePlayerOnKillListener();
super.onAbort(qs);
}
}
| [
"dmitry@0xffff"
] | dmitry@0xffff |
3f20026993e2ec593e9ff633b39d1c6f90f64794 | abc31f87a253ae4d73cb9d3219af6874f917d955 | /aliyun-java-sdk-iot/src/main/java/com/aliyuncs/iot/model/v20160530/SubTopicFilterRequest.java | 12d1e727fe9d8c4138795df85dbd21d8153224cd | [
"Apache-2.0"
] | permissive | nocb/aliyun-openapi-java-sdk | edd274a67671df07c399e5d0b780f47ac6ac5178 | ddbb07da2743fd9f64dd018c658fcbc35b813027 | refs/heads/master | 2021-01-01T06:37:16.017716 | 2017-07-14T10:08:31 | 2017-07-14T10:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,039 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.aliyuncs.iot.model.v20160530;
import com.aliyuncs.RpcAcsRequest;
import java.util.List;
/**
* @author auto create
* @version
*/
public class SubTopicFilterRequest extends RpcAcsRequest<SubTopicFilterResponse> {
public SubTopicFilterRequest() {
super("Iot", "2016-05-30", "SubTopicFilter");
}
private List<String> topics;
private Long productKey;
private String subCallback;
public List<String> getTopics() {
return this.topics;
}
public void setTopics(List<String> topics) {
this.topics = topics;
for (int i = 0; i < topics.size(); i++) {
putQueryParameter("Topic." + (i + 1) , topics.get(i));
}
}
public Long getProductKey() {
return this.productKey;
}
public void setProductKey(Long productKey) {
this.productKey = productKey;
putQueryParameter("ProductKey", productKey);
}
public String getSubCallback() {
return this.subCallback;
}
public void setSubCallback(String subCallback) {
this.subCallback = subCallback;
putQueryParameter("SubCallback", subCallback);
}
@Override
public Class<SubTopicFilterResponse> getResponseClass() {
return SubTopicFilterResponse.class;
}
}
| [
"ling.wu@alibaba-inc.com"
] | ling.wu@alibaba-inc.com |
7a86b3e9b85bfd293db2608a8de0c2722d7011cf | 48e7e1bd5b7c2b0fc7172e284d2eed7583c43881 | /src/test/java/com/test/spring/hubert/sprinttest/SprintTestApplicationTests.java | 8c27f5b4fd29d8f41d00407a4be8c98a0dcfa184 | [] | no_license | hubert1224/ClotherSpring | b2851a8b1a05d7e4224bdbc57e64fa3dd23e5f13 | 1dbdb4e3f09eab771a56c5a451cf1b95826cce3c | refs/heads/master | 2020-03-19T06:38:20.427212 | 2018-06-12T21:42:11 | 2018-06-12T21:42:11 | 136,041,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package com.test.spring.hubert.sprinttest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SprintTestApplicationTests
{
@Test
public void contextLoads()
{
}
}
| [
"hubert1224@wp.pl"
] | hubert1224@wp.pl |
072db8ff680d7a3823b4139cf5c039eb9308a7e4 | 8563fe82723ead28031115a9bf7c541deebeda39 | /wildfly/commons/src/main/java/org/infinispan/server/commons/controller/Metric.java | c570b0fd530ab720687b8a934b426e899e1760f6 | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | permissive | benjifin/infinispan | 05e2ea59a286bc4db27bd57a79521edc42d7ef4f | 4ea78a75d2bb2cc690dd1e3b5ae786d10c36cdd1 | refs/heads/master | 2023-07-24T11:33:22.894967 | 2019-11-22T11:04:51 | 2019-11-25T13:13:23 | 223,975,130 | 0 | 1 | Apache-2.0 | 2023-09-01T18:36:17 | 2019-11-25T15:01:43 | null | UTF-8 | Java | false | false | 1,373 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2014 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.infinispan.server.commons.controller;
import org.jboss.as.controller.AttributeDefinition;
/**
* Interface to be implemented by metric enumerations.
* @author Paul Ferraro
* @param <C> metric context
*/
public interface Metric<C> extends Executable<C> {
/**
* The definition of this metric.
* @return an attribute definition
*/
AttributeDefinition getDefinition();
}
| [
"mudokonman@gmail.com"
] | mudokonman@gmail.com |
1f720d0fea8aeaa1cc5094198b02ad031d07852e | 94627113820f905c92fde0de5b5f1d85de18cc4c | /src/main/java/info/localzone/util/StringUtils.java | 305bbc95750e93fed3bc2979b7a3888f6a9b2e70 | [] | no_license | goettw/localzone-library | 617ae2bd5d5777b2ab8a1fe761af3057955cc044 | e2c0d9872d8391b1d66a48d3714f6b8871d11f18 | refs/heads/master | 2021-05-15T01:48:44.990627 | 2018-05-08T12:16:36 | 2018-05-08T12:16:36 | 28,959,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 907 | java | package info.localzone.util;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
public class StringUtils {
static String standardEncoding = "UTF-8";
static public String byteToString (byte[] bytes) throws CharacterCodingException
{
Charset charset = Charset.forName(standardEncoding);
CharsetDecoder decoder = charset.newDecoder();
String string = decoder.decode(ByteBuffer.wrap(bytes)).toString();
return string;
}
static public byte[] stringToByte (String string) throws CharacterCodingException {
Charset charset = Charset.forName(standardEncoding);
CharsetEncoder encoder = charset.newEncoder();
CharBuffer charBuffer = CharBuffer.wrap(string.toCharArray());
return encoder.encode(charBuffer).array();
}
}
| [
"wolfgang.goette@googlemail.com"
] | wolfgang.goette@googlemail.com |
707297e777198d07d4d41c2b2f92e46fb3a0cf32 | dcb1d68912d10c6f5507f9124564e125379dd44a | /src/main/java/com/novway/buildit/web/rest/vm/package-info.java | d7fdc5ab845cafc41576aedcdccf3a9a51c07a8e | [] | no_license | koloraben/builditTest | 1bc6a2671507483c065cfda893f4b3b67f66a71e | 81bd32845d9502fcab967697b5b1cefa14cd2eea | refs/heads/master | 2020-03-22T09:24:24.290533 | 2018-07-05T10:43:23 | 2018-07-05T10:43:23 | 139,835,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 100 | java | /**
* View Models used by Spring MVC REST controllers.
*/
package com.novway.buildit.web.rest.vm;
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
c57d2dce87d1fa9116d91af1e2adcffcdcdf34ac | 3fcf946f4c0100323daf98fe8baa3f0e11b31f76 | /sdk/src/main/java/com/wonderpush/sdk/segmentation/parser/value/BooleanValueNode.java | e85702f2582f731a9e6a52d3818d2339166cf105 | [
"Apache-2.0"
] | permissive | wonderpush/wonderpush-android-sdk | 51505c679cf436c1627e8f11d0be82d21da1a97b | cde1387a21b25fde5853b44946776b63611f5183 | refs/heads/master | 2023-09-01T09:33:16.886706 | 2023-08-25T10:01:31 | 2023-08-25T10:01:31 | 22,420,454 | 4 | 7 | Apache-2.0 | 2021-09-10T09:18:10 | 2014-07-30T09:38:45 | Java | UTF-8 | Java | false | false | 540 | java | package com.wonderpush.sdk.segmentation.parser.value;
import com.wonderpush.sdk.segmentation.parser.ASTValueNode;
import com.wonderpush.sdk.segmentation.parser.ASTValueVisitor;
import com.wonderpush.sdk.segmentation.parser.ParsingContext;
public class BooleanValueNode extends ASTValueNode<Boolean> {
public BooleanValueNode(ParsingContext context, Boolean value) {
super(context, value);
}
@Override
public <U> U accept(ASTValueVisitor<U> visitor) {
return visitor.visitBooleanValueNode(this);
}
}
| [
"olivier@wonderpush.com"
] | olivier@wonderpush.com |
cb46afc399e1a26f99bb44e5cb69bcaeb62070f4 | bc67eebae76dff0dfd74d5cccc9fb8f26083fc85 | /src/main/java/net/tjeerd/camt053parser/model/RateType4Choice.java | 3df3b98303d3cfe01ac41e3eb951eb7162c5afac | [
"MIT"
] | permissive | maslick/CAMT053Parser | b6ce5578a7e0299beff80be00c27096c9940ec90 | 7e3dd9d6095a0a2824ba78f8f8b65422c3132824 | refs/heads/master | 2023-03-23T08:36:47.733647 | 2021-03-11T15:28:28 | 2021-03-11T15:28:28 | 346,731,058 | 1 | 0 | MIT | 2021-03-11T15:21:19 | 2021-03-11T14:33:10 | null | UTF-8 | Java | false | false | 2,474 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.04.08 at 10:37:47 AM CEST
//
package net.tjeerd.camt053parser.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.math.BigDecimal;
/**
* <p>Java class for RateType4Choice complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="RateType4Choice">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <choice>
* <element name="Pctg" type="{urn:iso:std:iso:20022:tech:xsd:camt.053.001.02}PercentageRate"/>
* <element name="Othr" type="{urn:iso:std:iso:20022:tech:xsd:camt.053.001.02}Max35Text"/>
* </choice>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RateType4Choice", propOrder = {
"pctg",
"othr"
})
public class RateType4Choice {
@XmlElement(name = "Pctg")
protected BigDecimal pctg;
@XmlElement(name = "Othr")
protected String othr;
/**
* Gets the value of the pctg property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getPctg() {
return pctg;
}
/**
* Sets the value of the pctg property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setPctg(BigDecimal value) {
this.pctg = value;
}
/**
* Gets the value of the othr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOthr() {
return othr;
}
/**
* Sets the value of the othr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOthr(String value) {
this.othr = value;
}
}
| [
"tjeerd.abma@stipter.nl"
] | tjeerd.abma@stipter.nl |
43ec1eeae192f6e05a25971571a1c17214396446 | 3925b181de7ade446e62ba03ef66e5364b414fd7 | /src/main/java/com/github/notyy/principle/isp/Wood.java | 55f2d1e5dad9f991cbd98ec78d47fbd29df46cd1 | [
"Unlicense"
] | permissive | notyy/javaRefactorPractice | 0241042914813441bdd6877e47818707dcc63226 | 5ff0d3ba0ad0165f9f68f632c5715d81007fb473 | refs/heads/master | 2020-04-04T15:54:26.892092 | 2014-05-12T07:35:14 | 2014-05-12T07:35:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | package com.github.notyy.principle.isp;
public interface Wood {
public void fire();
}
| [
"notyycn@gmail.com"
] | notyycn@gmail.com |
cf75b5b4ba0fe5090c54d86249fcf5fa6e36c912 | d37def9e6cab539e1c266925e879f9acdcb57ea6 | /OOPsTest/src/com/oops/test/Abstractimpl.java | 9e5c7c0d43903cc9ad3c1784db10fd97099df1b7 | [] | no_license | raja117/myProjects | d476417515c629a53901e2e2d4338aa9c883f201 | 4ed4a46fe20c8679a4f9820328961cc22202f9f9 | refs/heads/master | 2021-01-01T18:25:04.993079 | 2019-01-18T05:42:38 | 2019-01-18T05:42:38 | 98,331,801 | 0 | 0 | null | 2017-12-30T02:14:11 | 2017-07-25T17:18:32 | Java | UTF-8 | Java | false | false | 328 | java | package com.oops.test;
import java.util.Scanner;
public class Abstractimpl implements AbstractDemo{
@Override
public void add() {
Scanner s = new Scanner(System.in);
System.out.println("Enter Numnber: ");
int a = s.nextInt();
int b = s.nextInt();
int c = a + b;
System.out.println(c);
}
}
| [
"santh@192.168.0.8"
] | santh@192.168.0.8 |
565732093bae062d257e9cf913c1b79b6cd6d189 | dc8f56aca3d2eddd229f3c4dc6f9e7094ca02a57 | /car-app-server/src/main/java/ru/gothmog/carappserver/model/User.java | 9600af8bad692442ff7d3bb11c974b67f84804f1 | [] | no_license | dgrushetskiy/car_full_stack | 36560c06501da855462e7ae09460d68a2abe5b9c | e649b05b4c60509ccc8543c70841833560ad66ed | refs/heads/master | 2020-04-08T16:29:30.015589 | 2018-11-28T15:29:05 | 2018-11-28T15:29:05 | 159,520,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,226 | java | package ru.gothmog.carappserver.model;
import javax.persistence.*;
@Entity
@Table(name = "users", schema = "car")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false, updatable = false)
private Long id;
@Column(nullable = false, unique = true)
private String username;
@Column(nullable = false)
private String password;
@Column(nullable = false)
private String role;
public User() {
}
public User(String username, String password, String role) {
super();
this.username = username;
this.password = password;
this.role = role;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
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 getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
}
| [
"d_grushetskiy@dev-city.local"
] | d_grushetskiy@dev-city.local |
5504194193b5535d3c6b6ae8579188a1e6671655 | 6fe7380b6bc5399d3a7e737725a3fefa461b0a2c | /TaxCalculation/src/yury/graphics/MaritalStatus.java | 4fbc415afb0f641b670cc2f307b650469e4b9224 | [] | no_license | yurymal/IrishIncomeTaxP60 | 00e955d24ca4cccea97f3a21eacc2955890e8763 | 3473681891ad4d465256d63f00aeed622ed0b158 | refs/heads/master | 2021-01-17T12:00:11.310756 | 2012-11-28T09:37:58 | 2012-11-28T09:37:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package yury.graphics;
public enum MaritalStatus {Single("Sigle"), MarriedOneIncome("Married one income"), MarriedTwoIncomes("Married two incomes");
private final String display;
private MaritalStatus(String s) {
display = s;
}
@Override
public String toString() {
return display;
}
}
| [
"javadublin@gmail.com"
] | javadublin@gmail.com |
7540b07e47c4c32fd9b601ce582134562dccaa68 | 4ba6beb20a7af8c87471893e84a9efbc76f4874f | /src/main/java/br/uema/mestrado/lista2/Q12.java | 103dcca03c5a515ffa6ca545bbd82cbd7a22cfb2 | [] | no_license | IsaaCurvelo/aed | cca2ee166db99f94f9cb29d82e52a28143adea3e | 9f27e8a1fc94bf538357dda1d4735c1550692839 | refs/heads/master | 2022-12-28T13:21:08.884110 | 2020-07-27T23:48:47 | 2020-07-27T23:48:47 | 268,359,314 | 0 | 0 | null | 2020-10-13T22:35:13 | 2020-05-31T20:32:18 | Java | UTF-8 | Java | false | false | 783 | java | package br.uema.mestrado.lista2;
public class Q12 {
private final char letra;
private Q12(char l) {
this.letra = l;
if (letra == 'a' || letra == 'e' || letra == 'i' || letra == 'o' || letra == 'u') {
System.out.println("Vogal!");
} else if (letra == 'q' || letra == 'w' || letra == 'r' || letra == 't' || letra == 'y' || letra == 'p' || letra == 's'
|| letra == 'd' || letra == 'f' || letra == 'g' || letra == 'h' || letra == 'j' || letra == 'k' || letra == 'l'
|| letra == 'z' || letra == 'x' || letra == 'c' || letra == 'v' || letra == 'b' || letra == 'n' || letra == 'm') {
System.out.println("Consoante!");
}
}
public static void main(String[] args) {
new Q12('s');
new Q12('e');
new Q12('x');
}
}
| [
"isaacfrancis-cm@hotmail.com"
] | isaacfrancis-cm@hotmail.com |
36e6c436d005676fff032ce6888c63e38ceda623 | 70a69a26d79df60185687d718fcf03eb825596fe | /src/test/java/CarTest.java | ca4b2d7cea6b2e565baba9bdf74d249b01b721c9 | [] | no_license | digest15/task1_JDBC | 03aa082330ac2b0f54bd0ffd2bcffed086493a19 | 0416425e557ccfd430444b199ed7ccef2d02b4c0 | refs/heads/master | 2021-06-08T13:34:54.907518 | 2021-05-02T14:03:07 | 2021-05-02T14:03:07 | 127,515,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | import com.edu.task1_JDBC.dao.DaoFactory;
import com.edu.task1_JDBC.dao.GenericDao;
import com.edu.task1_JDBC.entity.Car;
import com.edu.task1_JDBC.entity.Identified;
import java.util.Date;
public class CarTest extends MachineTest {
public CarTest(DaoFactory factory) throws Exception {
super(factory);
}
@Override
public Identified createEntity() {
Car car = new Car();
car.setNamePicking("Люкс");
car.setColor(null);
car.setNumberPassengerSeats(5);
car.setMark(null);
car.setReleaseYear(new Date());
car.setVin("1234567891234567898");
return car;
}
@Override
public GenericDao<?> getDao() {
if (dao == null) {
return factory.getCarDao(connection, factory);
} else {
return dao;
}
}
}
| [
"digest15@yandex.ru"
] | digest15@yandex.ru |
c06cca975329d7aff6ef2251002c4fb006869995 | 10c0a6612b2567ba8b6ac292ff756a9d92f53121 | /app/src/main/java/com/wujie/daggerwanandroid/ui/fragment/navigation/NavigationContact.java | 58213b5567e156604873a49ea94497359b3b4cac | [] | no_license | shiwukuanghun/DaggerWanAndroid | 524e814b2f1dc06080e35a7e67b527728c909468 | 038277991be5f6953070d4822c882ad93659e445 | refs/heads/master | 2020-05-17T00:23:08.295276 | 2019-04-25T08:52:34 | 2019-04-25T08:52:34 | 183,394,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package com.wujie.daggerwanandroid.ui.fragment.navigation;
import com.wujie.commonmoudle.presenter.IPresenter;
import com.wujie.commonmoudle.view.IBaseView;
import com.wujie.daggerwanandroid.bean.NavigationBean;
import java.util.List;
/**
* Time:2019/1/25 0025 下午 18:09
* Author:WuChen
* Description:
**/
public interface NavigationContact {
interface View extends IBaseView {
void getNavigationSuccess(List<NavigationBean> navigationBeanList);
}
interface Presenter extends IPresenter<View> {
void getNavigation();
}
}
| [
"warcraft89757"
] | warcraft89757 |
4448a4f6de7de4f9accdad39da7a6ec633eafb99 | 5ac1a27a83f6ee2e29704d33aa8d301918ea8a2e | /app/src/test/java/com/catata/spinnerasynctask/ExampleUnitTest.java | 2ef1336c3ff3eb043f88b15ee32720cacece5e79 | [] | no_license | sdram58/SpinnerAsyncTask | b3983e0d076d78932e0c9c3bec531ceba730b1c4 | dc2ec5c0001ce9e2d1b3fd057c236e62f0b612ac | refs/heads/master | 2023-02-21T12:04:39.609291 | 2021-01-27T00:24:15 | 2021-01-27T00:24:15 | 332,928,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.catata.spinnerasynctask;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"sdram58@hotmail.com"
] | sdram58@hotmail.com |
ebe8f13e8d9b04b68f90eb1a095147e25b9f9f92 | c0f3196cff152b90ced36ab2d6950014a77d04d1 | /DesignPatterns/src/structuralpatterns/bridge/Window.java | 6526de16ac89c0ee6c228e1009d63cf3eceab187 | [] | no_license | raffccc/designPatterns | a6c601c9c0e77d13166e2b3e7af4557cbb58d8e2 | b63e30b4841b13f70b9e62cbe732ddf9adfdb917 | refs/heads/master | 2021-01-20T06:22:37.181670 | 2014-11-13T17:04:55 | 2014-11-13T17:04:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | package structuralpatterns.bridge;
import java.awt.Point;
import javax.swing.text.View;
public abstract class Window {
//Implementor is the bridge
private WindowImp implementor;
private View contents;
public void drawContents() {
}
public void drawLine(Point a, Point b) {
}
public void drawRect(Point a, Point b) {
getWindowImp().deviceRect(a.x, a.y, b.x, b.y);
}
public void drawPolygon(Point[] points, int n) {
}
public void drawText(String text, Point a) {
}
/*
* Window operations are defined in terms of this
* implementor
*/
protected WindowImp getWindowImp() {
if (implementor == null) {
implementor = WindowSystemFactory.getInstance().makeWindowImp();
}
return implementor;
}
protected View getView() {
return contents;
}
}
| [
"raffccc@gmail.com"
] | raffccc@gmail.com |
ca3bb93326764b05677c3d259e6a12764ec6d427 | acd9b11687fd0b5d536823daf4183a596d4502b2 | /java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelStats.java | 6446023640de7d9a525e6f477d48c57431917a64 | [
"Apache-2.0"
] | permissive | szabosteve/elasticsearch-java | 75be71df80a4e010abe334a5288b53fa4a2d6d5e | 79a1249ae77be2ce9ebd5075c1719f3c8be49013 | refs/heads/main | 2023-08-24T15:36:51.047105 | 2021-10-01T14:23:34 | 2021-10-01T14:23:34 | 399,091,850 | 0 | 0 | Apache-2.0 | 2021-08-23T12:15:19 | 2021-08-23T12:15:19 | null | UTF-8 | Java | false | false | 7,407 | java | /*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. 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.
*/
//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------
package co.elastic.clients.elasticsearch.ml;
import co.elastic.clients.json.DelegatingDeserializer;
import co.elastic.clients.json.JsonData;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.JsonpSerializable;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ModelTypeHelper;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.lang.Integer;
import java.lang.String;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;
// typedef: ml._types.TrainedModelStats
@JsonpDeserializable
public final class TrainedModelStats implements JsonpSerializable {
private final String modelId;
private final int pipelineCount;
@Nullable
private final TrainedModelInferenceStats inferenceStats;
@Nullable
private final Map<String, JsonData> ingest;
// ---------------------------------------------------------------------------------------------
public TrainedModelStats(Builder builder) {
this.modelId = Objects.requireNonNull(builder.modelId, "model_id");
this.pipelineCount = Objects.requireNonNull(builder.pipelineCount, "pipeline_count");
this.inferenceStats = builder.inferenceStats;
this.ingest = ModelTypeHelper.unmodifiable(builder.ingest);
}
public TrainedModelStats(Function<Builder, Builder> fn) {
this(fn.apply(new Builder()));
}
/**
* The unique identifier of the trained model.
* <p>
* API name: {@code model_id}
*/
public String modelId() {
return this.modelId;
}
/**
* The number of ingest pipelines that currently refer to the model.
* <p>
* API name: {@code pipeline_count}
*/
public int pipelineCount() {
return this.pipelineCount;
}
/**
* A collection of inference stats fields.
* <p>
* API name: {@code inference_stats}
*/
@Nullable
public TrainedModelInferenceStats inferenceStats() {
return this.inferenceStats;
}
/**
* A collection of ingest stats for the model across all nodes. The values are
* summations of the individual node statistics. The format matches the ingest
* section in Nodes stats.
* <p>
* API name: {@code ingest}
*/
@Nullable
public Map<String, JsonData> ingest() {
return this.ingest;
}
/**
* Serialize this object to JSON.
*/
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("model_id");
generator.write(this.modelId);
generator.writeKey("pipeline_count");
generator.write(this.pipelineCount);
if (this.inferenceStats != null) {
generator.writeKey("inference_stats");
this.inferenceStats.serialize(generator, mapper);
}
if (this.ingest != null) {
generator.writeKey("ingest");
generator.writeStartObject();
for (Map.Entry<String, JsonData> item0 : this.ingest.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}
}
// ---------------------------------------------------------------------------------------------
/**
* Builder for {@link TrainedModelStats}.
*/
public static class Builder implements ObjectBuilder<TrainedModelStats> {
private String modelId;
private Integer pipelineCount;
@Nullable
private TrainedModelInferenceStats inferenceStats;
@Nullable
private Map<String, JsonData> ingest;
/**
* The unique identifier of the trained model.
* <p>
* API name: {@code model_id}
*/
public Builder modelId(String value) {
this.modelId = value;
return this;
}
/**
* The number of ingest pipelines that currently refer to the model.
* <p>
* API name: {@code pipeline_count}
*/
public Builder pipelineCount(int value) {
this.pipelineCount = value;
return this;
}
/**
* A collection of inference stats fields.
* <p>
* API name: {@code inference_stats}
*/
public Builder inferenceStats(@Nullable TrainedModelInferenceStats value) {
this.inferenceStats = value;
return this;
}
/**
* A collection of inference stats fields.
* <p>
* API name: {@code inference_stats}
*/
public Builder inferenceStats(
Function<TrainedModelInferenceStats.Builder, ObjectBuilder<TrainedModelInferenceStats>> fn) {
return this.inferenceStats(fn.apply(new TrainedModelInferenceStats.Builder()).build());
}
/**
* A collection of ingest stats for the model across all nodes. The values are
* summations of the individual node statistics. The format matches the ingest
* section in Nodes stats.
* <p>
* API name: {@code ingest}
*/
public Builder ingest(@Nullable Map<String, JsonData> value) {
this.ingest = value;
return this;
}
/**
* Add a key/value to {@link #ingest(Map)}, creating the map if needed.
*/
public Builder putIngest(String key, JsonData value) {
if (this.ingest == null) {
this.ingest = new HashMap<>();
}
this.ingest.put(key, value);
return this;
}
/**
* Builds a {@link TrainedModelStats}.
*
* @throws NullPointerException
* if some of the required fields are null.
*/
public TrainedModelStats build() {
return new TrainedModelStats(this);
}
}
// ---------------------------------------------------------------------------------------------
/**
* Json deserializer for {@link TrainedModelStats}
*/
public static final JsonpDeserializer<TrainedModelStats> _DESERIALIZER = ObjectBuilderDeserializer
.lazy(Builder::new, TrainedModelStats::setupTrainedModelStatsDeserializer, Builder::build);
protected static void setupTrainedModelStatsDeserializer(DelegatingDeserializer<TrainedModelStats.Builder> op) {
op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id");
op.add(Builder::pipelineCount, JsonpDeserializer.integerDeserializer(), "pipeline_count");
op.add(Builder::inferenceStats, TrainedModelInferenceStats._DESERIALIZER, "inference_stats");
op.add(Builder::ingest, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "ingest");
}
}
| [
"sylvain@elastic.co"
] | sylvain@elastic.co |
c80b8d80b8bda9eb72087f3a83f1a46823080fde | 587bfbedeecbafdfa7b2337d4320b398e4357074 | /app/src/main/java/com/fax/showdt/manager/location/LocationManager.java | 6ecd29413d127e8a80cbac8ecd7c7ec58dd4d220 | [] | no_license | fangxiong/CountDownDesktop | 3775f097bb4ea6f90d01fcf9979e91db6800ac3b | c751d9846eb1caa6bbd8147cc31a2bef1fff3ed9 | refs/heads/master | 2020-09-25T23:37:42.351923 | 2020-05-27T13:11:43 | 2020-05-27T13:11:43 | 226,113,908 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,003 | java | package com.fax.showdt.manager.location;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.fax.showdt.AppContext;
/**
* Author: fax
* Email: fxiong1995@gmail.com
* Date: 19-9-4
* Description:通过高德定位sdk获取用户当前位置信息
*/
public class LocationManager {
//声明AMapLocationClient类对象
public AMapLocationClient mLocationClient = null;
//声明定位回调监听器
public AMapLocationListener mLocationListener ;
//声明AMapLocationClientOption对象
public AMapLocationClientOption mLocationOption = null;
public static LocationManager mInstance;
private LocationChangedCallback mLocationChangedCallback;
public static String LOCATION_CITY_CODE = "";
public static String LOCATION = "北京市";
private final int UPDATE_GAP = 3600000;
private LocationManager(){}
public static LocationManager getInstance(){
if(mInstance == null){
synchronized (LocationManager.class){
if(mInstance == null){
mInstance = new LocationManager();
}
}
}
return mInstance;
}
public void setLocationChangedCallback(LocationChangedCallback mCallback){
this.mLocationChangedCallback = mCallback;
}
/**
* 开始定位服务
*/
public synchronized void startLocation(){
if(mLocationClient != null && mLocationClient.isStarted()){
return;
}
//初始化定位
mLocationClient = new AMapLocationClient(AppContext.get());
//设置定位回调监听
mLocationListener = new AMapLocationListener() {
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if(aMapLocation != null){
if(aMapLocation.getErrorCode() == 0){
LOCATION_CITY_CODE = aMapLocation.getAdCode();
LOCATION = aMapLocation.getCity();
if(mLocationChangedCallback != null){
mLocationChangedCallback.locChanged(true,aMapLocation.getCity(),aMapLocation.getCityCode());
}
}else {
if(mLocationChangedCallback != null){
mLocationChangedCallback.locChanged(false,"0","0");
}
//定位失败时,可通过ErrCode(错误码)信息来确定失败的原因,errInfo是错误信息,详见错误码表。
}
}
}
};
mLocationClient.setLocationListener(mLocationListener);
mLocationOption = new AMapLocationClientOption();
AMapLocationClientOption option = new AMapLocationClientOption();
option.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.Transport);
option.setLocationMode(AMapLocationClientOption.AMapLocationMode.Battery_Saving);
option.setInterval(UPDATE_GAP);
option.setNeedAddress(true);
if(null != mLocationClient){
mLocationClient.setLocationOption(option);
//设置场景模式后最好调用一次stop,再调用start以保证场景模式生效
mLocationClient.stopLocation();
mLocationClient.startLocation();
}
}
/**
* 停止定位服务
*/
public void stopLocation(){
if(mLocationClient != null) {
mLocationClient.stopLocation();
mLocationClient.onDestroy();
//onDestroy后需要重新实例化AMapLocationClient,之前的对象需要手动置空
mLocationClient = null;
}
}
public interface LocationChangedCallback{
void locChanged(boolean reqStatus, String location, String locCode);
}
}
| [
"xiong.fang@maimob.cn"
] | xiong.fang@maimob.cn |
17898e592e3690cd79b1f5abb1cd91179d003b77 | 1e7f68d62f0b9408054a7ddee252a02d94bf93fc | /CommModule/src/ca/uhn/hl7v2/model/v26/group/PEX_P07_RX_ADMINISTRATION.java | 7c853893e93c49cd3c0e472cd69dd9ea268ea822 | [] | no_license | sac10nikam/TX | 8b296211601cddead3749e48876e3851e867b07d | e5a5286f1092ce720051036220e1780ba3408893 | refs/heads/master | 2021-01-15T16:00:19.517997 | 2013-01-21T09:38:09 | 2013-01-21T09:38:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,615 | java | /*
* This class is an auto-generated source file for a HAPI
* HL7 v2.x standard structure class.
*
* For more information, visit: http://hl7api.sourceforge.net/
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (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.mozilla.org/MPL/
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
* specific language governing rights and limitations under the License.
*
* The Original Code is "[file_name]". Description:
* "[one_line_description]"
*
* The Initial Developer of the Original Code is University Health Network. Copyright (C)
* 2012. All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* Alternatively, the contents of this file may be used under the terms of the
* GNU General Public License (the "GPL"), in which case the provisions of the GPL are
* applicable instead of those above. If you wish to allow use of your version of this
* file only under the terms of the GPL and not to allow others to use your version
* of this file under the MPL, indicate your decision by deleting the provisions above
* and replace them with the notice and other provisions required by the GPL License.
* If you do not delete the provisions above, a recipient may use your version of
* this file under either the MPL or the GPL.
*
*/
package ca.uhn.hl7v2.model.v26.group;
import ca.uhn.hl7v2.model.v26.segment.*;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.parser.ModelClassFactory;
import ca.uhn.hl7v2.model.*;
import net.newel.android.Log;
import ca.uhn.hl7v2.util.Constants;
/**
* <p>Represents a PEX_P07_RX_ADMINISTRATION group structure (a Group object).
* A Group is an ordered collection of message segments that can repeat together or be optionally in/excluded together.
* This Group contains the following elements:
* </p>
* <ul>
* <li>1: RXA (Pharmacy/Treatment Administration) <b> </b></li>
* <li>2: RXR (Pharmacy/Treatment Route) <b>optional </b></li>
* </ul>
*/
public class PEX_P07_RX_ADMINISTRATION extends AbstractGroup {
private static final long serialVersionUID = 1L;
/**
* Creates a new PEX_P07_RX_ADMINISTRATION group
*/
public PEX_P07_RX_ADMINISTRATION(Group parent, ModelClassFactory factory) {
super(parent, factory);
init(factory);
}
private void init(ModelClassFactory factory) {
try {
this.add(RXA.class, true, false);
this.add(RXR.class, false, false);
} catch(HL7Exception e) {
Log.e(Constants.TAG, "Unexpected error creating PEX_P07_RX_ADMINISTRATION - this is probably a bug in the source code generator.", e);
}
}
/**
* Returns "2.6"
*/
public String getVersion() {
return "2.6";
}
/**
* Returns
* RXA (Pharmacy/Treatment Administration) - creates it if necessary
*/
public RXA getRXA() {
RXA retVal = getTyped("RXA", RXA.class);
return retVal;
}
/**
* Returns
* RXR (Pharmacy/Treatment Route) - creates it if necessary
*/
public RXR getRXR() {
RXR retVal = getTyped("RXR", RXR.class);
return retVal;
}
}
| [
"nacrotic@hotmail.com"
] | nacrotic@hotmail.com |
e75d50006b4ee1275b656ec83c038be1ac66e7d0 | e2f889cb42bc30c6b43b45812655aeb3f169eef0 | /src/main/java/com/intellect/empapp/response/EmployeeResponse.java | 33db3fa6710d6cbd8fda941643b6d67ad1a10c3a | [] | no_license | yogesh333/empapp | 6a7584c52b6d43026fcbe0e88bbd855262d3312b | bf979128eb4a3665f9749ee803440cef98e7d620 | refs/heads/master | 2021-08-15T22:31:55.808071 | 2017-11-18T12:07:54 | 2017-11-18T12:07:54 | 111,191,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | package com.intellect.empapp.response;
import java.util.Map;
public class EmployeeResponse {
private String resMsg;
private String userId;
private Map<String,String> valErrors;
public String getResMsg() {
return resMsg;
}
public void setResMsg(String resMsg) {
this.resMsg = resMsg;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Map<String, String> getValErrors() {
return valErrors;
}
public void setValErrors(Map<String, String> valErrors) {
this.valErrors = valErrors;
}
}
| [
"yogeshmahawar@gmail.com"
] | yogeshmahawar@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.