blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
30f2dc8da25d7f65626b6f4ee2dcdabb716f7455 | 6253283b67c01a0d7395e38aeeea65e06f62504b | /decompile/app/Mms/src/main/java/com/huawei/hwid/core/datatype/EmailInfo.java | da593c90cb846b055aad8899568cb2467ef1c79d | [] | no_license | sufadi/decompile-hw | 2e0457a0a7ade103908a6a41757923a791248215 | 4c3efd95f3e997b44dd4ceec506de6164192eca3 | refs/heads/master | 2023-03-15T15:56:03.968086 | 2017-11-08T03:29:10 | 2017-11-08T03:29:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package com.huawei.hwid.core.datatype;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
public class EmailInfo implements Parcelable {
public static final Creator CREATOR = new e();
private String a;
private String b;
public EmailInfo(String str, String str2) {
this.a = str;
this.b = str2;
}
private EmailInfo() {
}
public String a() {
return this.a;
}
public String toString() {
return "[" + this.a + "," + this.b + "]";
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(this.a);
parcel.writeString(this.b);
}
}
| [
"liming@droi.com"
] | liming@droi.com |
9f85da9e68790ec83c2e9da35128f4a0f411472a | 6dea232b027810607198afa1107a9905433d58ab | /src/Admin/AdminDeleteTheme.java | fe1b993448ce008569cde52763076575cd961c94 | [] | no_license | anthoxo/nepal-hangman | 246fccaa0a6c83bfd9fa1a50ef46717b56b70cc8 | 976b0ed772f2b7d612c0a649a01a6e880caf3bca | refs/heads/master | 2021-01-23T10:30:12.970549 | 2017-06-15T20:36:23 | 2017-06-15T20:36:23 | 93,068,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,013 | java | package Admin;
import Models.Dictionary;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
public class AdminDeleteTheme extends JPanel{
private AdminView frame;
private int key;
private JPanel panelUp = new JPanel();
private JPanel panelTheme = new JPanel();
private JPanel panelButton = new JPanel();
private JPanel panelDown = new JPanel();
private JComboBox listTheme = new JComboBox();
private JLabel labelUp = new JLabel("Delete a theme from the dictionary");
private JLabel labelTheme = new JLabel("Theme : ");
private JLabel labelDown = new JLabel();
private JButton buttonOk = new JButton("Delete !");
public AdminDeleteTheme(AdminView frame){
this.frame = frame;
Dictionary dico = frame.getDico();
listTheme.setPreferredSize(new Dimension(150, 30));
this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
this.add(panelUp);
this.add(panelTheme);
this.add(panelButton);
this.add(panelDown);
panelUp.add(labelUp);
panelTheme.add(labelTheme);
panelTheme.add(listTheme);
panelButton.add(buttonOk);
panelDown.add(labelDown);
Enumeration tab = dico.getThemes().elements();
while (tab.hasMoreElements()){
listTheme.addItem(tab.nextElement().toString());
}
this.key = -1;
tab = dico.getThemes().keys();
while (tab.hasMoreElements() && key==-1){
int tmp = (int) tab.nextElement();
if (listTheme.getSelectedItem().equals(dico.getThemes().get(tmp))){
key = tmp;
}
}
listTheme.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
key=-1;
Dictionary dico = frame.getDico();
Enumeration tab = dico.getThemes().keys();
while (tab.hasMoreElements() && key==-1){
int tmp = (int) tab.nextElement();
if (listTheme.getSelectedItem().equals(dico.getThemes().get(tmp))){
key = tmp;
}
}
}
});
buttonOk.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
String theme = frame.getDico().getThemes().get(key);
boolean result = frame.getDico().delete(theme);
if (result){
labelDown.setText(theme+" has been removed !");
}
else{
labelDown.setText("There is a problem with removing "+theme+"...");
}
}
}
);
}
}
| [
"anthonynjiva@free.fr"
] | anthonynjiva@free.fr |
7a93d0b663baded02ee586cc6802e536cbc32159 | c386eecbe7eebca4552cde05a72138a194e619b3 | /com/example/SpringCore/scope/prototype/SecondBean.java | 89bd031ce6592cdb26fd4d3e4339cef19cc9c685 | [] | no_license | nammavar-guru/java | 34184f3b718637b32b289a2856fef7fbdd192b3a | 7bf0784decc22b42580cb62f4bbedd002fc5d067 | refs/heads/master | 2020-08-31T12:44:58.756400 | 2020-02-25T14:35:11 | 2020-02-25T14:35:11 | 218,694,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | package com.example.SpringCore.scope.prototype;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
@Scope(value=ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class SecondBean {
public SecondBean() {
System.out.println("Second Bean Constructor");
}
public void testSingletonAlongWithPrototype() {
System.out.println("Testing Singleton Along with prototype");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
131ddbd4c73e2c11737f227811f7a44268dadbcb | a19ca438798ce54d6be33ce1fd4adb03b4280943 | /src/main/java/kz/kazgisa/data/repositories/RegionRepository.java | a8e5ed21b4ffc1d3050e439efdf174880b49a625 | [] | no_license | Adil-web/sedbpmn_last | 73c472222cc81b0feeb9f166b98f1a260efc0313 | 79889a34439c82c6e98fbdef3953f562b75d56f3 | refs/heads/main | 2023-03-30T04:35:07.941103 | 2021-03-31T03:52:43 | 2021-03-31T03:52:43 | 353,217,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package kz.kazgisa.data.repositories;
import kz.kazgisa.data.entity.Region;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface RegionRepository extends JpaRepository<Region, Long> {
Region findFirstById(Long id);
}
| [
"englishm224@gmail.com"
] | englishm224@gmail.com |
afd5400b69cda93b838d0641a9c84b1b02cf5179 | 30f60aa71762951e094572250778049323b42488 | /app/src/main/java/com/example/zafar/sartcrowd/other/CustomListOrder.java | c23bc812769bc094d5b163c13934e5883174f04c | [] | no_license | hasnain72/SmartCrowd | 5423f9a92d5979e76136a53de578016fc22a7f48 | cab14643537375d5e118c7ce1ff00b7dfc84570d | refs/heads/master | 2021-08-31T23:23:06.396873 | 2017-12-23T12:33:12 | 2017-12-23T12:33:12 | 115,194,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,318 | java | package com.example.zafar.sartcrowd.other;
import android.app.Activity;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.zafar.sartcrowd.Model.Order;
import com.example.zafar.sartcrowd.R;
import java.util.ArrayList;
public class CustomListOrder extends ArrayAdapter<Order> {
private final Activity context;
ArrayList<Order> orders = new ArrayList<Order>();
public CustomListOrder(Activity context, ArrayList<Order> orders ) {
super(context, R.layout.list_single_order, orders);
this.context = context;
this.orders = orders;
}
@Override
public View getView(int position, View view, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView= inflater.inflate(R.layout.list_single_order, null, true);
TextView OrderNo = (TextView) rowView.findViewById(R.id.order_no);
TextView CustomerName = (TextView) rowView.findViewById(R.id.customer_name);
TextView Status = (TextView) rowView.findViewById(R.id.status);
TextView Amount = (TextView) rowView.findViewById(R.id.order_amount);
OrderNo.setText("#" + orders.get(position).getOrder_time());
CustomerName.setText(orders.get(position).getOrder_id());
Amount.setText("Rs." + orders.get(position).getTotal_price() + "/");
String status = "";
if(orders.get(position).getOrder_status().equals("0")) {
status = "Pending";
}else if(orders.get(position).getOrder_status().equals("1")){
status = "Active";
}else{
status = "Completed";
}
Status.setText(status);
if(orders.get(position).getOrder_status().equals("1")) {
Status.setTextColor(Color.parseColor("#39b550"));
}else if(orders.get(position).getOrder_status().equals("0")){
Status.setTextColor(Color.parseColor("#FF7F00"));
}else if(orders.get(position).getOrder_status().equals("2")){
Status.setTextColor(Color.parseColor("#39b550"));
}
// Status.setText(status[position]);
return rowView;
}
} | [
"1993syed@gmail.com"
] | 1993syed@gmail.com |
0013dc5e741071c17a7779b2b4513ee4c190cacf | 952789d549bf98b84ffc02cb895f38c95b85e12c | /V_2.x/Server/tags/SpagoBI-2.6.0(20100707)/SpagoBIUtils/src/it/eng/spagobi/tools/dataset/common/behaviour/IDataSetBehaviour.java | 484554c82c73188656c8c06c66c2189dfe8a9dd9 | [] | no_license | emtee40/testingazuan | de6342378258fcd4e7cbb3133bb7eed0ebfebeee | f3bd91014e1b43f2538194a5eb4e92081d2ac3ae | refs/heads/master | 2020-03-26T08:42:50.873491 | 2015-01-09T16:17:08 | 2015-01-09T16:17:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,157 | java | /**
SpagoBI - The Business Intelligence Free Platform
Copyright (C) 2005 Engineering Ingegneria Informatica S.p.A.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**/
package it.eng.spagobi.tools.dataset.common.behaviour;
import it.eng.spagobi.tools.dataset.bo.IDataSet;
/**
* @author Andrea Gioia (andrea.gioia@eng.it)
*
*/
public interface IDataSetBehaviour {
String getId();
IDataSet getTargetDataSet();
void setTargetDataSet(IDataSet targetDataSet);
}
| [
"bernabei@99afaf0d-6903-0410-885a-c66a8bbb5f81"
] | bernabei@99afaf0d-6903-0410-885a-c66a8bbb5f81 |
87fc371849e792202c3e1f804f69d8206ad4d3b4 | f5452c217864a407625bcfdc2cff2ac2d3795c3a | /Array/src/MajorityElementII.java | 07e80d8f6bcd0a25e7ec29e7f23729c448ff0b59 | [] | no_license | srxiaoj/LeetCode_HW | da82aec4cf93125a7802f1a7b2d7ba094a36ef92 | 095772f45c8b29562b7818dd223c4fd3a99bd86d | refs/heads/master | 2020-04-16T18:08:49.122785 | 2020-04-07T00:49:41 | 2020-04-07T00:49:41 | 49,519,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,673 | java | import java.util.ArrayList;
import java.util.List;
public class MajorityElementII {
public static void main(String[] args) {
int[] test = {1, 2, 3, 3, 3, 7, 7, 7, 7, 7, 7};
int[] test2 = {0, 0, 0};
System.out.println(majorityElement(test));
System.out.println(majorityElement(test2));
}
/**
* 初始化vote1 = 0, vote2 = 1, 先寻找到vote1以及vote2
* 然后判断vote1, vote2是否大于 n / 3个
*/
public static List<Integer> majorityElement(int[] nums) {
// the maximum number of elements more than floor(n / 3) is 2
List<Integer> list = new ArrayList<Integer>();
if (nums == null || nums.length == 0) return list;
int count1 = 0, count2 = 0, vote1 = 0, vote2 = 1;
for (int num : nums) {
if (num == vote1) count1++;
else if (num == vote2) count2++;
else if (count1 == 0) {
vote1 = num;
count1 = 1;
} else if (count2 == 0) {
vote2 = num;
count2 = 1;
} else {
count1--;
count2--;
}
}
// to make sure count1 and count2 is larger than n / 3
count1 = 0;
count2 = 0;
for (int num : nums) {
if (num == vote1) {
count1 += 2;
} else {
count1--;
}
if (num == vote2) {
count2 += 2;
} else {
count2--;
}
}
if (count1 > 0) list.add(vote1);
if (count2 > 0) list.add(vote2);
return list;
}
}
| [
"srxiaoj@gmail.com"
] | srxiaoj@gmail.com |
72d06f074f18fe8c84185c78348095d99aeabec0 | 75dc85de42373c5ba3445b25dc8d8069244f8dcf | /src/main/java/br/com/vivo/api/plans/infra/handler/exception/badRequest/UndefinedDDDTypeException.java | 62fab63ef9bf5ed1913a53e2bdb014b9787350df | [] | no_license | andrefilth/plans-contact-more | 7e84db0f4f62d1c10968e5c5acf1207bc9a95cf6 | dfa51a7694f03ffcaf62f612326ab7787815a167 | refs/heads/main | 2023-02-20T23:59:32.898450 | 2021-01-21T11:25:30 | 2021-01-21T11:25:30 | 319,333,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package br.com.vivo.api.plans.infra.handler.exception.badRequest;
/**
* Class comments go here...
*
* @author André Franco
* @version 1.0 05/12/2020
*/
public class UndefinedDDDTypeException extends BadRequestException {
/**
* Instantiates a new Api exception.
*
* @param msg the msg
*/
public UndefinedDDDTypeException(final String msg) {
super(msg);
}
}
| [
"andrelgfranco@gmail.com"
] | andrelgfranco@gmail.com |
cf520870ad339ccd8a743bed88320c160c2e3f86 | 07496cd8b5fce659f914eae5aa2d7b8f615df937 | /src/main/java/net/metricspace/crypto/math/ec/point/ExtendedEdwardsDecafPoint.java | b06175b1c97c017d9372f82971dacab25f506cbd | [
"BSD-3-Clause"
] | permissive | dsiproject/safecurves-java | 0ea94d952a4814d0cd7730fd99de852bcce6a5c5 | b0f9ac282ed5f23470071fbc845b9e71b5015d34 | refs/heads/devel | 2018-09-01T17:26:35.481793 | 2018-07-28T00:18:51 | 2018-07-28T00:18:51 | 101,671,685 | 4 | 0 | BSD-3-Clause | 2018-07-28T02:41:41 | 2017-08-28T17:59:52 | Java | UTF-8 | Java | false | false | 5,187 | java | /* Copyright (c) 2018, Eric McCorkle. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.metricspace.crypto.math.ec.point;
import javax.security.auth.Destroyable;
import net.metricspace.crypto.math.ec.curve.EdwardsCurve;
import net.metricspace.crypto.math.ec.ladder.MontgomeryLadder;
import net.metricspace.crypto.math.field.PrimeField;
/**
* Extended Edwards curve points, as described in Hisil, Koon-Ho,
* Carter, and Dawson in their paper, <a
* href="https://eprint.iacr.org/2008/522.pdf">"Twisted Edwards Curves
* Revisited"</a>, with Decaf point compression. Curve points are
* represented as a quad, {@code (X, Y, Z, T)}, where {@code X = x/Z},
* {@code Y = y/Z}, and {@code T = X * Y}, where {@code x} and {@code
* y} are the original curve coordinates.
* <p>
* Decaf point compression was described by Hamburg in his paper <a
* href="https://eprint.iacr.org/2015/673.pdf">"Decaf: Eliminating
* Cofactors through Point Compression"</a>. It reduces the cofactor
* by a factor of {@code 4}
*
* @param <S> Scalar values.
* @param <P> Point type used as an argument.
*/
public abstract class
ExtendedEdwardsDecafPoint<S extends PrimeField<S>,
P extends ExtendedEdwardsDecafPoint<S, P, T>,
T extends ExtendedEdwardsPoint.Scratchpad<S>>
extends ExtendedEdwardsPoint<S, P, T>
implements EdwardsDecafPoint<S, P, T> {
/**
* Initialize an {@code ExtendedPoint} with three scalar objects.
* This constructor takes possession of the parameters, which are
* used as the coordinate objects. This constructor does
* <i>not</i> scale the parameters.
*
* @param x The scalar object for x.
* @param y The scalar object for y.
* @param z The scalar object for z.
* @param t The scalar object for t.
*/
protected ExtendedEdwardsDecafPoint(final S x,
final S y,
final S z,
final S t) {
super(x, y, z, t);
}
/**
* Initialize an {@code ExtendedEdwardsPoint} with two scalar objects.
* This constructor takes possession of the parameters, which are
* used as the coordinate objects.
*
* @param x The scalar object for x.
* @param y The scalar object for y.
*/
protected ExtendedEdwardsDecafPoint(final S x,
final S y) {
super(x, y);
}
/**
* {@inheritDoc}
*/
@Override
public boolean mmequals(final ProjectivePoint<S, P, T> other) {
try(final T scratch = scratchpad()) {
return mmequals(other, scratch);
}
}
/**
* Compare against a point, when both points are scaled, using a
* scratchpad..
*
* @param other The point against which to compare.
* @return Whether this point is equal to {@code other}.
*/
private boolean mmequals(final ProjectivePoint<S, P, T> other,
final T scratch) {
final S r0 = scratch.r0;
final S r1 = scratch.r1;
r0.set(x);
r1.set(other.x);
r0.mul(other.y);
r1.mul(y);
return r0.equals(r1);
}
/**
* {@inheritDoc}
*/
@Override
public S compress(final T scratch) {
return DecafPoint.compress(edwardsD(), x, y, z, t, scratch);
}
/**
* {@inheritDoc}
*/
@Override
public void decompress(final S s,
final T scratch)
throws IllegalArgumentException {
DecafPoint.decompress(edwardsD(), s, x, y, z, t, scratch);
}
}
| [
"eric@metricspace.net"
] | eric@metricspace.net |
e6b30249b485c66c2b26f87686cb2acf0e82cb18 | afd7a09bd04a21d268a2995ee15cf4f3dac92259 | /app/src/main/java/com/example/editme/services/upload_services/UploadImagesService.java | 18751922f58502e94f1b2d7b9c850749c45cf60d | [] | no_license | noumannaseer/editme-android | 0b6b93b944d3f2f5aa141d99394d54e6ba60bef0 | 4045853f151b18283c55aa6aca2ec09a8cfdea1d | refs/heads/master | 2020-05-21T00:18:38.823277 | 2019-10-14T17:54:29 | 2019-10-14T17:54:29 | 185,822,392 | 0 | 0 | null | 2019-10-14T17:54:30 | 2019-05-09T15:09:03 | Java | UTF-8 | Java | false | false | 8,492 | java | package com.example.editme.services.upload_services;
import android.app.IntentService;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import com.example.editme.EditMe;
import com.example.editme.activities.CheckOutActivity;
import com.example.editme.activities.HomeActivity;
import com.example.editme.utils.AndroidUtil;
import com.example.editme.utils.Constants;
import com.example.editme.utils.UIUtils;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import lombok.NonNull;
import lombok.val;
public class UploadImagesService
extends IntentService
{
public UploadImagesService()
{
super("Service");
}
private NotificationCompat.Builder notificationBuilder;
private NotificationManager notificationManager;
public static String ORDER_IMAGES_URI = "ORDER_IMAGES_URI";
public static String ORDER_IMAGES_ID = "ORDER_IMAGES_ID";
private int mImageId;
private Uri mImageIntentURI;
public static final String IMAGE_URL = "IMAGE_URL";
// private static int mChannelId = 0;
@Override
protected void onHandleIntent(Intent intent)
{
notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
if (intent.getExtras()
.containsKey(ORDER_IMAGES_URI) && intent.getExtras()
.containsKey(ORDER_IMAGES_ID))
{
//mSelectedImage = intent.getParcelableExtra(ORDER_IMAGES);
mImageId = intent.getIntExtra(ORDER_IMAGES_ID, -1);
mImageIntentURI = Uri.parse(intent.getStringExtra(ORDER_IMAGES_URI));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
NotificationChannel notificationChannel = new NotificationChannel("id", "an",
NotificationManager.IMPORTANCE_LOW);
notificationChannel.setDescription("You Image is uploading");
notificationChannel.setSound(null, null);
notificationChannel.enableLights(false);
notificationChannel.setLightColor(Color.BLUE);
notificationChannel.enableVibration(false);
notificationManager.createNotificationChannel(notificationChannel);
}
// Create an Intent for the activity you want to start
Intent resultIntent = new Intent(this, HomeActivity.class);
resultIntent.putExtra(Constants.IMAGE_DOWNLOADED, true);
// Create the TaskStackBuilder and add the intent, which inflates the back stack
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addNextIntentWithParentStack(resultIntent);
// Get the PendingIntent containing the entire back stack
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
notificationBuilder = new NotificationCompat.Builder(this, "id")
.setSmallIcon(android.R.drawable.stat_sys_download)
.setContentTitle("Image" + mImageId)
.setContentText("Your Image is uploading")
.setDefaults(0)
.setContentIntent(resultPendingIntent)
.setAutoCancel(true);
notificationManager.notify(mImageId, notificationBuilder.build());
// mChannelId++;
//initRetrofit();
uploadImageToFireBase();
}
private void uploadImageToFireBase()
{
String orderId = UIUtils.randomAlphaNumeric(5);
val userId = EditMe.instance()
.getMUserId();
val mStorage = EditMe.instance()
.getMStorageReference()
.getReference();
StorageReference filePath = mStorage.child(Constants.ORDER_IMAGES)
.child(userId);
Task<Uri> uriTask = filePath.putFile(mImageIntentURI)
.addOnProgressListener(taskSnapshot -> {
double progress = (100.0 * taskSnapshot
.getBytesTransferred()) / taskSnapshot
.getTotalByteCount();
updateNotification((int)progress);
})
.addOnPausedListener(taskSnapshot -> {
})
.continueWithTask(
new Continuation<UploadTask.TaskSnapshot, Task<Uri>>()
{
@Override
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task)
throws Exception
{
if (!task.isSuccessful())
{
AndroidUtil.toast(false,
task.getException()
.toString());
throw task.getException();
}
return filePath.getDownloadUrl();
}
})
.addOnCompleteListener(new OnCompleteListener<Uri>()
{
@Override
public void onComplete(@NonNull Task<Uri> task)
{
if (task.isSuccessful())
{
Log.d("image_url", task.getResult()
.toString());
onDownloadComplete(true, task.getResult()
.toString());
}
}
});
}
private void updateNotification(int currentProgress)
{
notificationBuilder.setProgress(100, currentProgress, false);
notificationBuilder.setContentText("Uploaded: " + currentProgress + "%");
notificationManager.notify(mImageId, notificationBuilder.build());
}
private void sendProgressUpdate(boolean downloadComplete, String imageUrl)
{
Intent intent = new Intent(CheckOutActivity.PROGRESS_UPDATE);
intent.putExtra("Image" + mImageId + " UploadComplete", downloadComplete);
intent.putExtra(ORDER_IMAGES_ID, mImageId);
intent.putExtra(IMAGE_URL, imageUrl);
LocalBroadcastManager.getInstance(UploadImagesService.this)
.sendBroadcast(intent);
}
private void onDownloadComplete(boolean downloadComplete, String imageUrl)
{
sendProgressUpdate(downloadComplete, imageUrl);
notificationManager.cancel(0);
notificationBuilder.setProgress(0, 0, false);
notificationBuilder.setContentText("Image Upload Complete");
notificationManager.notify(mImageId, notificationBuilder.build());
}
@Override
public void onTaskRemoved(Intent rootIntent)
{
notificationManager.cancel(0);
}
}
| [
"usman.okara@hotmail.com"
] | usman.okara@hotmail.com |
44aee3a76ff91f6d5b722530112fbf7825705e41 | 0dca8c47c6920fb2c3e627da07ffd49cefa9e9f6 | /applications/recommendation-api/src/main/java/com/virginvoyages/recommendations/model/Recommendation.java | 473b225eb8fffaed75a4a8d7e1ee68954e0f8be7 | [] | no_license | joe83/Virgin | e7faf98047a39603034f4cee683121b3eff9ba38 | 015467d800a1af3806302c9687198c77b5d2c9e3 | refs/heads/master | 2020-04-16T07:41:17.255516 | 2017-12-04T12:08:17 | 2017-12-04T12:08:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.virginvoyages.recommendations.model;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(fluent = true, chain = true)
public class Recommendation {
@JsonProperty("reco")
private List<KeyValue> reco = new ArrayList<KeyValue>();
}
| [
"rpraveen@LIN66004745.corp.capgemini.com"
] | rpraveen@LIN66004745.corp.capgemini.com |
a1d92cdf74dd9e00c3d06f7e0deab5dce81ece3d | 96ecad5e9377e0158eca0382b88188450e93e0e5 | /myhome2/src/visit/VisitDeleteServlet.java | 4f1b4bf05ed9a9cea06f23e9e0b589c47a6bb7c8 | [] | no_license | Jihyun-han94/JSP | 430fd83fad7cce49e988914bfaee4e091a35e3dd | 2f4a752f40748194096a5163d96889e32797d4e5 | refs/heads/master | 2023-04-22T06:50:39.343380 | 2021-03-31T13:54:55 | 2021-03-31T13:54:55 | 349,301,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,070 | java | package visit;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/visit/delete")
public class VisitDeleteServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public VisitDeleteServlet() {
super();
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// 1. 클라이언트가 전달한 파라메터 추출
int id = Integer.parseInt(request.getParameter("id"));
// 2. VisitDAO 를 생성
VisitDAO visit = new VisitDAO();
// 3. 생성된 VisitDAO에 삭제할 데이터를 구분 할 수 있는 값 전달 후 삭제
visit.deleteData(id);
visit.close();
// 4. 삭제 완료 후 localhost:8080/home2/visit 를 다시 요청하도록
// 리다이렉트 메시지 전달
response.sendRedirect("../visit");
}
}
| [
"gkswlgus923@gamil.com"
] | gkswlgus923@gamil.com |
18d06f4ab019c1088348ba932ae1e513f08d00d5 | ff85a249b021f8e30891c79576150a2e128b1430 | /src/main/java/project/demo/models/Image.java | eacaead24858eab39e72601884704396c3d25002 | [] | no_license | mohammad-alsharif10/demo | 448df01ea85bd409638689ba1a27ea81c82db3f8 | a200501cf3b5c6a20d174f54d472dcd50215b971 | refs/heads/master | 2022-02-22T17:20:14.488472 | 2019-08-05T10:12:22 | 2019-08-05T10:12:22 | 198,080,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 734 | java | package project.demo.models;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "IMAGE")
@ApiModel
public class Image extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "IMAGE_ID")
private Long imageId;
@Column(name = "PATH")
private String path;
@Column(name = "STUDENT_ID")
private Long studentId;
@Column(name = "DOCTOR_ID")
private Long doctorId;
@Column(name = "CURRENT_PROFILE_IMAGE")
private Boolean isCurrentProfileImage;
}
| [
"mohammad-alsharif@zad-solution.com"
] | mohammad-alsharif@zad-solution.com |
64c438b9afdeca838224fcacb1b580cfbe1e5715 | ca01f9394ee8fa135ca3cf20bd2d9eebaac97cde | /sc-hsf-consumer/src/main/java/com/aliware/edas/async/TestAsyncController.java | 1d341faec95da4ec9fd77d6cfc8444e911891931 | [] | no_license | hjue/edas-demo | a51a00a93d9b698e6760a9329a558e0d67162370 | c29331b426918b8a8270594354d1609e21de7ebb | refs/heads/master | 2021-05-13T16:13:38.349661 | 2018-01-09T08:21:27 | 2018-01-09T08:21:27 | 116,786,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,610 | java | package com.aliware.edas.async;
import com.taobao.hsf.tbremoting.invoke.CallbackInvocationContext;
import com.taobao.hsf.tbremoting.invoke.HSFFuture;
import com.taobao.hsf.tbremoting.invoke.HSFResponseFuture;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by yizhan on 2017/12/12.
*/
@RestController
public class TestAsyncController {
@Autowired
private AsyncEchoService asyncEchoService;
@RequestMapping(value = "/hsf-future/{str}", method = RequestMethod.GET)
public String testFuture(@PathVariable String str) {
String str1 = asyncEchoService.future(str);
String str2;
try {
HSFFuture hsfFuture = HSFResponseFuture.getFuture();
str2 = (String) hsfFuture.getResponse(3000);
} catch (Throwable t) {
t.printStackTrace();
str2 = "future-exception";
}
return str1 + " " + str2;
}
@RequestMapping(value = "/hsf-future-list/{str}", method = RequestMethod.GET)
public String testFutureList(@PathVariable String str) {
try {
int num = Integer.parseInt(str);
List<String> params = new ArrayList<String>();
for (int i = 1; i <= num; i++) {
params.add(i + "");
}
List<HSFFuture> hsfFutures = new ArrayList<HSFFuture>();
for (String param : params) {
asyncEchoService.future(param);
hsfFutures.add(HSFResponseFuture.getFuture());
}
ArrayList<String> results = new ArrayList<String>();
for (HSFFuture hsfFuture : hsfFutures) {
results.add((String) hsfFuture.getResponse(3000));
}
return Arrays.toString(results.toArray());
} catch (Throwable t) {
return "exception";
}
}
@RequestMapping(value = "/hsf-callback/{str}", method = RequestMethod.GET)
public String testCallback(@PathVariable String str) {
String timestamp = System.currentTimeMillis() + "";
CallbackInvocationContext.setContext(timestamp);
String str1 = asyncEchoService.callback(str);
CallbackInvocationContext.setContext(null);
return str1 + " " + timestamp;
}
}
| [
"haoyu@gionee.com"
] | haoyu@gionee.com |
f6e80fb5dd6226c3d10fd5d0fba87e0c566d6f4f | d8019fd46ad88385e97f2464d642b2ce56058b35 | /Assignment RMI and Soap Services/src/rmiconfig/RmiService.java | 44fbf3b77cbab2f6c2d502a75526b56f45bc4a6c | [] | no_license | DevAkshayRaj/TrainingLabOne | b0822f3424a9e323fa655076f6c672baf1f3bf19 | 7911e4feea7ad8edb219d60e9f4e48b6a5abbecc | refs/heads/main | 2023-04-18T08:45:32.705901 | 2021-05-04T06:57:19 | 2021-05-04T06:57:19 | 340,455,586 | 1 | 0 | null | 2021-05-04T06:57:19 | 2021-02-19T18:26:36 | Java | UTF-8 | Java | false | false | 401 | java | package rmiconfig;
import java.io.File;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface RmiService extends Remote{
public File getPdfFromXml(File f) throws RemoteException;
public File getExcelFromXml(File f) throws RemoteException;
public String sendEmailFromXml(File f)throws RemoteException;
public String sendSmsFromXml(File f)throws RemoteException;
}
| [
"noreply@github.com"
] | noreply@github.com |
e059d5e25b459103c62b64b253021b866782c5bc | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/model_seeding/103_sweethome3d-com.eteks.sweethome3d.model.LightSource-1.0-5/com/eteks/sweethome3d/model/LightSource_ESTest.java | 57cbf48a473b4cae98b83bda5e854abd7e4f6009 | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | /*
* This file was automatically generated by EvoSuite
* Fri Oct 25 20:35:42 GMT 2019
*/
package com.eteks.sweethome3d.model;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class LightSource_ESTest extends LightSource_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pderakhshanfar@bsr01.win.tue.nl"
] | pderakhshanfar@bsr01.win.tue.nl |
d176e0badeb4c64637e7ab699d6e258df13ef23c | df4dfb9faa695b52e998bb928fac87629e46fa91 | /src/test/java/com/github/arielcarrera/hibernate/other/test/config/TransactionalConnectionProvider.java | 14a90e5cfdb68008cef62c54a897cf5dcd418e5e | [
"Apache-2.0"
] | permissive | arielcarrera/hibernate-agroal-test | 1a38db2e41dd2727677aaefba73d803da56ff577 | cbe0f470db41e7305941fee7f88dfe959b6e51fc | refs/heads/master | 2022-03-20T20:58:56.201906 | 2019-08-02T20:16:10 | 2019-08-02T20:16:10 | 189,098,282 | 0 | 0 | Apache-2.0 | 2022-02-09T23:48:41 | 2019-05-28T20:26:44 | Java | UTF-8 | Java | false | false | 2,475 | java | package com.github.arielcarrera.hibernate.other.test.config;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.h2.jdbcx.JdbcDataSource;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.service.UnknownUnwrapTypeException;
import com.arjuna.ats.jdbc.TransactionalDriver;
public class TransactionalConnectionProvider implements ConnectionProvider {
private static final long serialVersionUID = -574599543316476526L;
public static final String DATASOURCE_JNDI = "java:testDS";
public static final String USERNAME = "";
public static final String PASSWORD = "";
private final TransactionalDriver transactionalDriver;
public TransactionalConnectionProvider() {
transactionalDriver = new TransactionalDriver();
}
public static JdbcDataSource getDataSource() {
JdbcDataSource dataSource = new JdbcDataSource();
dataSource.setURL("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;LOCK_MODE=3");
dataSource.setUser(USERNAME);
dataSource.setPassword(PASSWORD);
return dataSource;
}
public static void bindDataSource() {
try {
InitialContext initialContext = new InitialContext();
initialContext.bind(DATASOURCE_JNDI, getDataSource());
}
catch (NamingException e) {
throw new RuntimeException(e);
}
}
@Override
public Connection getConnection() throws SQLException {
Properties properties = new Properties();
properties.setProperty(TransactionalDriver.userName, USERNAME);
properties.setProperty(TransactionalDriver.password, PASSWORD);
return transactionalDriver.connect("jdbc:arjuna:" + DATASOURCE_JNDI, properties);
}
@Override
public void closeConnection(Connection connection) throws SQLException {
if (!connection.isClosed()) {
connection.close();
}
}
@Override
public boolean supportsAggressiveRelease() {
return false;
}
@Override
public boolean isUnwrappableAs(Class aClass) {
return getClass().isAssignableFrom(aClass);
}
@Override
public <T> T unwrap(Class<T> aClass) {
if (isUnwrappableAs(aClass)) {
return (T) this;
}
throw new UnknownUnwrapTypeException(aClass);
}
} | [
"cesar.carrera@pjn.gov.ar"
] | cesar.carrera@pjn.gov.ar |
03a6f664f912dcd0fd86bd3f110bf289480eede3 | 67d335a23d66d4fef15ee9d9813e69372d15c896 | /ecs-runtime/src/main/java/io/polymorphicpanda/ge0/zero/component/ComponentManager.java | 8c072a314a93c2bd5bc7d460c64791d966f41307 | [] | no_license | raniejade/ge0 | c6c754c6e1295995bd8207f78bee5042f19ab7c6 | 010db88affbabac41bb67bdd705a35954d4e81ee | refs/heads/master | 2020-04-11T14:52:05.792768 | 2016-02-13T15:42:39 | 2016-02-13T15:42:39 | 50,025,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,530 | java | package io.polymorphicpanda.ge0.zero.component;
import java.util.BitSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import io.polymorphicpanda.ge0.ecs.component.Component;
import io.polymorphicpanda.ge0.zero.pool.Pool;
import io.polymorphicpanda.ge0.zero.util.CompositionBits;
import io.polymorphicpanda.ge0.zero.util.identity.IdentityFactories;
import io.polymorphicpanda.ge0.zero.util.identity.IdentityFactory;
/**
* @author Ranie Jade Ramiso
*/
public class ComponentManager {
private final IdentityFactory identityFactory = IdentityFactories.basic();
private final Map<Class, Integer> componentIdentities = new HashMap<>();
private final Map<Integer, Pool> componentPool = new HashMap<>();
public BitSet compose(Set<Class<? extends Component>> components) {
final List<Integer> identities = components.stream()
.map(this::getIdentity)
.collect(Collectors.toList());
return CompositionBits.compose(builder -> identities.stream()
.forEach(builder::set));
}
@SuppressWarnings("unchecked")
public <T extends Component> Pool<T> poolFor(Class<T> component) {
return (Pool<T>) componentPool.computeIfAbsent(getIdentity(component), key -> new ComponentPool(component));
}
private int getIdentity(Class<? extends Component> component) {
return componentIdentities.computeIfAbsent(component, key -> identityFactory.generate());
}
}
| [
"raniejaderamiso@gmail.com"
] | raniejaderamiso@gmail.com |
71a2b8a785c1d94da5ec9b7232da8f9ce1ab5ef7 | 18b4c0cc1cc0a890b59f3e786510d55544e8d809 | /AppTec/practice/TeamA/WebApp/bbs/src/bbs/exception/NoRowsUpdatedRuntimeException.java | bb0cba3bd2bba8710bab70e0968a1cc8e89a36f6 | [] | no_license | systemi-yokohama/Systemi_Training_2020 | ee1bcdd9547cd1f1f68e2f3229e4d1210d097060 | 3710a3b9db22c191c129dd24c8ef23b091108f12 | refs/heads/master | 2022-07-14T13:57:50.184173 | 2020-07-11T23:15:56 | 2020-07-11T23:15:56 | 252,630,204 | 2 | 34 | null | 2022-06-21T03:37:41 | 2020-04-03T04:13:40 | Java | UTF-8 | Java | false | false | 147 | java | package bbs.exception;
public class NoRowsUpdatedRuntimeException extends RuntimeException {
private static final long serialVersionUID = 1L;
}
| [
"m.ishiga@systemi.co.jp"
] | m.ishiga@systemi.co.jp |
3b5c209c6a21ec9c838d663b770988421358279c | af6a6b4465d8b77fe534a460d0c6167df573a889 | /app/src/main/java/com/garry/runningmap/overlayutil/TransitRouteOverlay.java | b928e0ae8051ee96d43e9a656ffc9161c714acdf | [] | no_license | GaolengYan/RunningMap | 81b623eb6e56f465a7ad8ced9a48113f2e903916 | 148939f35a234e180a12efeeb59ce77fbd3a9001 | refs/heads/master | 2021-09-09T19:25:31.661562 | 2018-03-19T07:42:03 | 2018-03-19T07:42:03 | 121,607,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,678 | java | package com.garry.runningmap.overlayutil;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.Marker;
import com.baidu.mapapi.map.MarkerOptions;
import com.baidu.mapapi.map.Overlay;
import com.baidu.mapapi.map.OverlayOptions;
import com.baidu.mapapi.map.Polyline;
import com.baidu.mapapi.map.PolylineOptions;
import com.baidu.mapapi.search.route.TransitRouteLine;
import java.util.ArrayList;
import java.util.List;
/**
* 用于显示换乘路线的Overlay,自3.4.0版本起可实例化多个添加在地图中显示
*/
public class TransitRouteOverlay extends OverlayManager {
private TransitRouteLine mRouteLine = null;
/**
* 构造函数
*
* @param baiduMap
* 该TransitRouteOverlay引用的 BaiduMap 对象
*/
public TransitRouteOverlay(BaiduMap baiduMap) {
super(baiduMap);
}
@Override
public final List<OverlayOptions> getOverlayOptions() {
if (mRouteLine == null) {
return null;
}
List<OverlayOptions> overlayOptionses = new ArrayList<OverlayOptions>();
// step node
if (mRouteLine.getAllStep() != null
&& mRouteLine.getAllStep().size() > 0) {
for (TransitRouteLine.TransitStep step : mRouteLine.getAllStep()) {
Bundle b = new Bundle();
b.putInt("index", mRouteLine.getAllStep().indexOf(step));
if (step.getEntrance() != null) {
overlayOptionses.add((new MarkerOptions())
.position(step.getEntrance().getLocation())
.anchor(0.5f, 0.5f).zIndex(10).extraInfo(b)
.icon(getIconForStep(step)));
}
// 最后路段绘制出口点
if (mRouteLine.getAllStep().indexOf(step) == (mRouteLine
.getAllStep().size() - 1) && step.getExit() != null) {
overlayOptionses.add((new MarkerOptions())
.position(step.getExit().getLocation())
.anchor(0.5f, 0.5f).zIndex(10)
.icon(getIconForStep(step)));
}
}
}
if (mRouteLine.getStarting() != null) {
overlayOptionses.add((new MarkerOptions())
.position(mRouteLine.getStarting().getLocation())
.icon(getStartMarker() != null ? getStartMarker() :
BitmapDescriptorFactory
.fromAssetWithDpi("Icon_start.png")).zIndex(10));
}
if (mRouteLine.getTerminal() != null) {
overlayOptionses
.add((new MarkerOptions())
.position(mRouteLine.getTerminal().getLocation())
.icon(getTerminalMarker() != null ? getTerminalMarker() :
BitmapDescriptorFactory
.fromAssetWithDpi("Icon_end.png"))
.zIndex(10));
}
// polyline
if (mRouteLine.getAllStep() != null
&& mRouteLine.getAllStep().size() > 0) {
for (TransitRouteLine.TransitStep step : mRouteLine.getAllStep()) {
if (step.getWayPoints() == null) {
continue;
}
int color = 0;
if (step.getStepType() != TransitRouteLine.TransitStep.TransitRouteStepType.WAKLING) {
// color = Color.argb(178, 0, 78, 255);
color = getLineColor() != 0 ? getLineColor() : Color.argb(178, 0, 78, 255);
} else {
// color = Color.argb(178, 88, 208, 0);
color = getLineColor() != 0 ? getLineColor() : Color.argb(178, 88, 208, 0);
}
overlayOptionses.add(new PolylineOptions()
.points(step.getWayPoints()).width(10).color(color)
.zIndex(0));
}
}
return overlayOptionses;
}
private BitmapDescriptor getIconForStep(TransitRouteLine.TransitStep step) {
switch (step.getStepType()) {
case BUSLINE:
return BitmapDescriptorFactory.fromAssetWithDpi("Icon_bus_station.png");
case SUBWAY:
return BitmapDescriptorFactory.fromAssetWithDpi("Icon_subway_station.png");
case WAKLING:
return BitmapDescriptorFactory.fromAssetWithDpi("Icon_walk_route.png");
default:
return null;
}
}
/**
* 设置路线数据
*
* @param routeOverlay
* 路线数据
*/
public void setData(TransitRouteLine routeOverlay) {
this.mRouteLine = routeOverlay;
}
/**
* 覆写此方法以改变默认起点图标
*
* @return 起点图标
*/
public BitmapDescriptor getStartMarker() {
return null;
}
/**
* 覆写此方法以改变默认终点图标
*
* @return 终点图标
*/
public BitmapDescriptor getTerminalMarker() {
return null;
}
public int getLineColor() {
return 0;
}
/**
* 覆写此方法以改变起默认点击行为
*
* @param i
* 被点击的step在
* {@link TransitRouteLine#getAllStep()}
* 中的索引
* @return 是否处理了该点击事件
*/
public boolean onRouteNodeClick(int i) {
if (mRouteLine.getAllStep() != null
&& mRouteLine.getAllStep().get(i) != null) {
Log.i("baidumapsdk", "TransitRouteOverlay onRouteNodeClick");
}
return false;
}
@Override
public final boolean onMarkerClick(Marker marker) {
for (Overlay mMarker : mOverlayList) {
if (mMarker instanceof Marker && mMarker.equals(marker)) {
if (marker.getExtraInfo() != null) {
onRouteNodeClick(marker.getExtraInfo().getInt("index"));
}
}
}
return true;
}
@Override
public boolean onPolylineClick(Polyline polyline) {
// TODO Auto-generated method stub
return false;
}
}
| [
"a349162727@qq.com"
] | a349162727@qq.com |
18b5807a0310a5e490116092048e3729ca61ae7d | 2bd5ffe6437cc1bdfbbd99564226005bfab548cb | /src/main/java/com/bjpowernode/eception/NotEnoughException.java | 26fd09b0af8b033e3e794f386ca4ae0e858ffd6e | [] | no_license | Chris-Tao-XY/BookStore | 1621c04e8d72d8ac66500183649e32c46944a478 | 4826082ac703ba8fd462884df19db51629cccba4 | refs/heads/master | 2023-06-11T18:31:49.726677 | 2021-07-06T09:18:59 | 2021-07-06T09:18:59 | 383,405,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.bjpowernode.eception;
public class NotEnoughException extends RuntimeException{
public NotEnoughException(){
super();
}
public NotEnoughException(String string){
super(string);
}
}
| [
"txy_0620@163.com"
] | txy_0620@163.com |
d9277b2e367c605598d5ed6e2358271069a17aa2 | 79350c7955fe713ecaffda29c3d2b32aaf55476c | /src/test/java/com/consumer/github/rest/RepoControllerTest.java | d5bb2f6d0725915efb44774606e9cd1258c8ca70 | [] | no_license | a5rar/GitHubConsumerApi | e35e8000b752b7aa716ed3637b731966d55a7932 | 29649ee275f4f2ab389cae3e92e4ee049d31d427 | refs/heads/master | 2016-08-12T08:49:11.715363 | 2015-11-19T17:47:56 | 2015-11-19T17:47:56 | 46,497,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,925 | java | package com.consumer.github.rest;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertEquals;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.net.URI;
import org.json.JSONObject;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.web.FilterChainProxy;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.util.Base64Utils;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.WebApplicationContext;
import com.consumer.github.Application;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@IntegrationTest
public class RepoControllerTest {
@Autowired
WebApplicationContext context;
@Autowired
private FilterChainProxy springSecurityFilterChain;
private MockMvc mvc;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mvc = MockMvcBuilders.webAppContextSetup(context)
.addFilter(springSecurityFilterChain).build();
}
@Test
public void testValidUser() throws Exception {
String token = getAccessToken("roy", "spring");
RestTemplate template = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", token);
HttpEntity<String> entity = new HttpEntity<String>("", headers);
ResponseEntity<String> response = template
.exchange(new URI("http://127.0.0.1:8080/listRepos/spring-projects"),
HttpMethod.GET, entity, String.class);
response = template
.exchange(new URI("http://127.0.0.1:8080/listRepos/spring-projects"),
HttpMethod.GET, entity, String.class);
assertEquals(HttpStatus.OK,response.getStatusCode());
}
@Test
public void testInValidUser() throws Exception {
String token = getAccessToken("roy", "spring");
RestTemplate template = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", token);
HttpEntity<String> entity = new HttpEntity<String>("", headers);
ResponseEntity<String> response = null;;
try {
response = template.exchange(
new URI("http://127.0.0.1:8080/listRepos/fdwefdwfwg"),
HttpMethod.GET, entity, String.class);
} catch (HttpClientErrorException e) {
// TODO Auto-generated catch block
response = new ResponseEntity<String>(e.getMessage(),e.getStatusCode());
}
assertEquals(HttpStatus.NOT_FOUND,response.getStatusCode());
}
@Test
public void testValidSearchByUser() throws Exception {
String token = getAccessToken("roy", "spring");
RestTemplate template = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", token);
HttpEntity<String> entity = new HttpEntity<String>("", headers);
ResponseEntity<String> response = null;;
response = template.exchange(
new URI("http://127.0.0.1:8080/searchRepos/spring-projects?search=security"),
HttpMethod.GET, entity, String.class);
System.out.println(response);
}
@Test
public void testInValidSearchByUser() throws Exception {
String token = getAccessToken("roy", "spring");
RestTemplate template = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", token);
HttpEntity<String> entity = new HttpEntity<String>("", headers);
ResponseEntity<String> response = null;
try {
response = template.exchange(
new URI("http://127.0.0.1:8080/searchRepos/mferfwf?search=mfdwfdkfdwf"),
HttpMethod.GET, entity, String.class);
} catch (HttpClientErrorException e) {
// TODO Auto-generated catch block
response = new ResponseEntity<String>(e.getMessage(),e.getStatusCode());
}
assertEquals(HttpStatus.NOT_FOUND,response.getStatusCode());
}
@Test
public void testValidFilterByUserAndRepoName() throws Exception {
String token = getAccessToken("roy", "spring");
RestTemplate template = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", token);
HttpEntity<String> entity = new HttpEntity<String>("", headers);
ResponseEntity<String> response = null;;
response = template.exchange(
new URI("http://127.0.0.1:8080/filterRepos/spring-projects?name=security"),
HttpMethod.GET, entity, String.class);
}
@Test
public void testInValidFilterByUserAndRepoName() throws Exception {
String token = getAccessToken("roy", "spring");
RestTemplate template = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", token);
HttpEntity<String> entity = new HttpEntity<String>("", headers);
ResponseEntity<String> response = null;
try {
response = template.exchange(
new URI("http://127.0.0.1:8080/filterRepos/spring-projects?name=gffegefg"),
HttpMethod.GET, entity, String.class);
} catch (HttpClientErrorException e) {
// TODO Auto-generated catch block
response = new ResponseEntity<String>(e.getMessage(),e.getStatusCode());
}
//Github appears to thin this is ok so lets not suprise the users by doing anything different.
assertEquals(HttpStatus.OK,response.getStatusCode());
}
private String getAccessToken(String username, String password) throws Exception {
String authorization = "Basic "
+ new String(Base64Utils.encode("clientapp:123456".getBytes()));
String contentType = MediaType.APPLICATION_JSON + ";charset=UTF-8";
// @formatter:off
String content = mvc
.perform(
post("/oauth/token")
.header("Authorization", authorization)
.contentType(
MediaType.APPLICATION_FORM_URLENCODED)
.param("username", username)
.param("password", password)
.param("grant_type", "password")
.param("scope", "read write")
.param("client_id", "clientapp")
.param("client_secret", "123456"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$.access_token", is(notNullValue())))
.andExpect(jsonPath("$.token_type", is(equalTo("bearer"))))
.andExpect(jsonPath("$.refresh_token", is(notNullValue())))
.andExpect(jsonPath("$.expires_in", is(greaterThan(4000))))
.andExpect(jsonPath("$.scope", is(equalTo("read write"))))
.andReturn().getResponse().getContentAsString();
// @formatter:on
JSONObject json = new JSONObject(content);
return "Bearer "+json.getString("access_token");
}
}
| [
"a5rar@msn.com"
] | a5rar@msn.com |
2d2ec42decd802de698d619095638f34b2c53753 | 82c1a71221e894c945550ca924a36f4c7e883c6a | /jedi-one/src/main/java/com/ldap/jedi/JediException.java | 1a433721078797a0af676557e8fcbaabc40b4905 | [] | no_license | dalamar66/jedi-obi | 33c61c5646f9cc621195e2e710ed9cd218cdcc1d | b73d594f0ac135c01022689ed15b9dc8b50be894 | refs/heads/master | 2021-01-10T12:42:39.899446 | 2014-05-21T14:28:24 | 2014-05-21T14:28:24 | 53,042,981 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 734 | java | package com.ldap.jedi;
/**
* File : JediException.java
* Component : Version : 1.0
* Creation date : 2010-03-04
* Modification date : 2010-03-04
*/
/**
* Classe générant les messages d'erreurs pour les exceptions Jedi.
*
* @author HUMEAU Xavier
* @version Version 1.0
*/
public class JediException extends Exception {
private static final long serialVersionUID = -4333840510082819466L;
/**
* Constructeur vide.
*/
public JediException() {
super();
}
/**
* Constructeur prenant en paramètre le message à afficher.
*
* @param message
* Message à afficher.
*/
public JediException(String message) {
super(message);
}
}// fin de l'interface | [
"xhumeau@gmail.com"
] | xhumeau@gmail.com |
de405f9d4ea574340be8d832ece4e7925b1c78cc | 9176ff8dd14ccbfdcd7374d03e94188de681e198 | /src/main/java/spring/dao/SubjectDao.java | 6fe590c48f517894b54eb52d17289b4c46f0959a | [] | no_license | lagneshthakur/CSE_ERP | 6034e9de98993a9d3683562cbf109c591b0a8386 | 582b31ef37fcee261e5b2f6d6b83b3392db3d8fd | refs/heads/master | 2021-05-01T01:04:49.815678 | 2017-05-07T18:37:11 | 2017-05-07T18:37:11 | 65,716,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package spring.dao;
import java.util.List;
import spring.model.Subject;
public interface SubjectDao {
public Subject getSubjectById(int id);
public List<Subject> listSubjects();
}
| [
"lagneshthakur@gmail.com"
] | lagneshthakur@gmail.com |
0caa3a5934679a5bccc74b074140a9ebab399442 | aeaa3d0846b82ed62b85a401ad6a39899c3d56f3 | /app/src/main/java/azubakov/edu/caloriescalc/dialogs/AddItemActs.java | baff8111173f89057a925b14274561fd01a21397 | [] | no_license | azubakov/CaloriesCalcn | 264cfd3cc222f075650302fcbf1e8fdecad8e1d4 | a419d895160cf00139c2b08a4a35e097c9c35e30 | refs/heads/master | 2020-04-12T09:36:17.381022 | 2016-11-04T12:36:28 | 2016-11-04T12:36:28 | 65,639,550 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,712 | java | package azubakov.edu.caloriescalc.dialogs;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import azubakov.edu.caloriescalc.R;
import azubakov.edu.caloriescalc.models.ActsItem;
/*import tomerbu.edu.fabaddmeal.R;
import tomerbu.edu.fabaddmeal.models.MealItem;*/
/**
* A simple {@link Fragment} subclass.
*/
public class AddItemActs extends DialogFragment implements View.OnClickListener {
private static String ARG_CATEGORY = "Category";
EditText etTypeActivity;
//MaterialTextField etTypeActivity;
//TextInputLayout etTypeActivity;
EditText etTimeActivity;
//TextInputLayout etTimeActivity;
EditText etKCal;
//TextInputLayout etKCal;
ImageButton ibAdd;
private String category;
public static AddItemActs newInstance(String categoryName) {
Bundle args = new Bundle();
args.putString(ARG_CATEGORY, categoryName);
AddItemActs fragment = new AddItemActs();
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_add_item_acts, container, false);
this.category = getArguments().getString(ARG_CATEGORY);
etKCal = (EditText) v.findViewById(R.id.etKCal);
//etKCal = (TextInputLayout) v.findViewById(R.id.etKCal);
etTypeActivity = (EditText) v.findViewById(R.id.etTypeActivity);
//etTypeActivity = (MaterialTextField) v.findViewById(R.id.etTypeActivity);
//etTypeActivity = (TextInputLayout) v.findViewById(R.id.etTypeActivity);
etTimeActivity = (EditText) v.findViewById(R.id.etTimeActivity);
//etTimeActivity = (TextInputLayout) v.findViewById(R.id.etTimeActivity);
ibAdd = (ImageButton) v.findViewById(R.id.ibAdd);
ibAdd.setOnClickListener(this);
return v;
}
@Override
public void onClick(View view) {
try {
double cal = Double.valueOf(etKCal.getText().toString());
//double cal = Double.valueOf(etKCal.getEditText().toString());
//double weight = Double.valueOf(etKCal.getText().toString());
double time = Double.valueOf(etTimeActivity.getText().toString());
////double time = Double.valueOf(etTimeActivity.getText().toString());
////double time = Double.valueOf(etTimeActivity.getEditText().toString());
//String productName = etKCal.getText().toString();
String typeactivity = etTypeActivity.getText().toString();
////String typeactivity = etTypeActivity.getEditText().toString();
// FireBaseDatabase.
String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference ref = FirebaseDatabase.getInstance().getReference().child(uid).child(category).push();
ActsItem item = new ActsItem(typeactivity, time, cal, ref.getKey());
//String uid...
//
ref.setValue(item);
dismiss();
}
catch (NumberFormatException e){
Toast.makeText(getContext(), "Numbers Only", Toast.LENGTH_SHORT).show();
}
}
}
| [
"azubakov@gmail.com"
] | azubakov@gmail.com |
1a5ceb55f9ba70a2783ec57423ee0c11f904cdf0 | 1a8ccd61c87d50f91a61763d098369741c711bd7 | /src/com/simple/sjge/engine/iMouseListener.java | dccbc7efad34cfb691be438c962bc892038390ac | [] | no_license | iPeer/SJGE | fbbf34ad513f75e1a16c39282e8b6c9f82b4a88c | 8a9461ed26fc62e0235c519982ccaf183c51fb6c | refs/heads/master | 2016-09-06T09:40:32.027184 | 2012-03-26T19:58:04 | 2012-03-26T19:58:04 | 3,835,100 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,128 | java | package com.simple.sjge.engine;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import com.simple.sjge.gui.Gui;
import com.simple.sjge.gui.controls.GuiButton;
public class iMouseListener implements MouseListener {
protected Engine engine;
public iMouseListener(Engine engine) {
this.engine = engine;
}
@Override
public void mouseClicked(MouseEvent e) {
int i = e.getX();
int j = e.getY();
Gui gui = engine.currentGui;
if (gui != null) {
ArrayList controls = gui.controls;
for (int l = 0; l < controls.size(); l++) {
GuiButton button = (GuiButton)controls.get(l);
if (button.mousePressed(i, j))
if (e.getButton() == 3)
button.actionPerformedRight(button); // [Roxy] Enables the button to take right click input
else
button.actionPerformed(button);
}
}
}
@Override
public void mouseEntered(MouseEvent arg0) {
}
@Override
public void mouseExited(MouseEvent arg0) {
}
@Override
public void mousePressed(MouseEvent arg0) {
}
@Override
public void mouseReleased(MouseEvent arg0) {
}
}
| [
"ipeer@ipeerftw.co.cc"
] | ipeer@ipeerftw.co.cc |
1c60e48a34e35459adbd04d0059a893eba19b58d | 0cda5cfbd9d97b90f6c323422c63e3e10ca2c16b | /Tag_Facebook/Question84.java | 96a7079f30a560182670207e6fe8fd62abef651b | [] | no_license | JiedaokouWangguan/leetcode | 7be9d2356d771649a83550cb5b963c10df0c916e | dd47dc0fb6ee3c331394d9a1c6f3657397763af1 | refs/heads/master | 2021-07-13T13:11:33.771139 | 2018-12-15T02:55:24 | 2018-12-15T02:55:24 | 132,697,062 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | import java.util.ArrayDeque;
public class Question84{
// 11.47-11.58
public int largestRectangleArea(int[] heights) {
int[] heightsP = new int[heights.length+2];
heightsP[0] = 0;
heightsP[heightsP.length-1] = 0;
for(int i = 0;i<heights.length;i++) heightsP[i+1] = heights[i];
ArrayDeque<Integer> stack = new ArrayDeque<>();
int result = 0;
for(int i = 0;i<heightsP.length;i++){
while(stack.size()>0 && heightsP[i] < heightsP[stack.peek()]){
int tmpMidIndex = stack.pop();
int left = stack.size() >0?stack.peek():-1;
int right = i;
int width = right - left - 1;
int height = heightsP[tmpMidIndex];
result = Math.max(result, height * width);
}
stack.push(i);
}
return result;
}
}
}
| [
"yuanfangsong@Yuanfangs-MacBook-Pro.local"
] | yuanfangsong@Yuanfangs-MacBook-Pro.local |
fc179710cb968b23797bca530510393de181cc56 | 2ca4808a277b0091373121e5ae2bce1bb9dd0be5 | /myview/src/main/java/com/example/myview/JsonHttpListener.java | 24baf4205bc42ffdaad7dab3fc0ea65d0ff45b9a | [] | no_license | Jourray/Looper | 71334d3e78360aa80714fc66589e917877ee4fe4 | 85128632c2b0f43999d43c0f777d6a9b61744d7e | refs/heads/master | 2020-07-09T05:58:07.721593 | 2019-08-21T10:36:15 | 2019-08-21T10:36:15 | 203,900,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,070 | java | package com.example.myview;
import android.os.Handler;
import android.os.Looper;
import com.alibaba.fastjson.JSON;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* author : ZhiG
* e-mail : 1120121044@163.com
* date : 2019/8/2111:40
* desc :
* package: Shop:
*/
public class JsonHttpListener<M> implements IHttpListener {
//字节码
Class<M> responseClass;
IDataListener dataListener;
//用于换线程
Handler handler = new Handler(Looper.getMainLooper());
public JsonHttpListener(Class<M> responseClass, IDataListener dataListener) {
this.responseClass = responseClass;
this.dataListener = dataListener;
}
@Override
public void onSueecs(InputStream inputStream) {
//获得相应结果,转换String
try {
String content = getContent(inputStream);
//转换字符串为对象
final M m = JSON.parseObject(content, responseClass);
//返回结果调用层
handler.post(new Runnable() {
@Override
public void run() {
dataListener.onSuccess(m);
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onFailure() {
//结构传到调用层
handler.post(new Runnable() {
@Override
public void run() {
if (dataListener != null) {
dataListener.onFailure();
}
}
});
}
private String getContent(InputStream inputStream) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
StringBuffer stringBuffer = new StringBuffer();
String line = null;
while ((line = bufferedReader.readLine()) != null) {
stringBuffer.append(line + "\n");
}
return stringBuffer.toString();
}
}
| [
"jourray1993"
] | jourray1993 |
670dc1136c80db5a9fa422a31b932283a1b0d64c | d4e352d660a9790c601a4b95dc594c80f0df2b00 | /src/main/java/com/zby/test/CodeGenerator.java | bdcd222f42c51b7f2d65616465213368fedf7b92 | [] | no_license | Endless-zby/Maven_Spring_MyBatisPlus | 5dd39e308ca9b7fa0f747352f172499474ccad89 | 09e96f51b5e616bc8a91af36fbbdcc2503921691 | refs/heads/master | 2022-01-26T13:22:56.334145 | 2019-05-14T13:38:42 | 2019-05-14T13:38:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,050 | java | package com.zby.test;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* 代码生成器
*
*/
// 演示例子,执行 main 方法控制台输入模块表名回车自动生成对应项目目录中
public class CodeGenerator {
/**
* <p>
* 读取控制台内容
* </p>
*/
public static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
StringBuilder help = new StringBuilder();
help.append("请输入" + tip + ":");
System.out.println(help.toString());
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StringUtils.isNotEmpty(ipt)) {
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
public static void main(String[] args) {
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("jobob");
gc.setOpen(false);
// gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://localhost:3306/mydb?useUnicode=true&useSSL=false&characterEncoding=utf8");
// dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("zby123456");
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setModuleName(scanner("模块名"));
pc.setParent("com.zby.student");
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
// 如果模板引擎是 freemarker
//String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity
String templatePath = "/templates/mapper.xml.vm";
// 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + "/src/main/resources/" + pc.getModuleName()
+ "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
}
});
/*
cfg.setFileCreate(new IFileCreate() {
@Override
public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
// 判断自定义文件夹是否需要创建
checkDir("调用默认方法创建的目录");
return false;
}
});
*/
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
// 配置模板
TemplateConfig templateConfig = new TemplateConfig();
// 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService();
// templateConfig.setController();
templateConfig.setXml(null);
mpg.setTemplate(templateConfig);
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
strategy.setSuperEntityClass("com.zby.student.common.Model");
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true);
strategy.setSuperControllerClass("com.zby.student.common.BaseController");
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
strategy.setSuperEntityColumns("id");
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix(pc.getModuleName() + "_");
mpg.setStrategy(strategy);
mpg.execute();
}
}
| [
"381016296@qq.com"
] | 381016296@qq.com |
dcca7248e77c78d16b7e2633d1d655b922f5e4fe | 8e6c080e1d9ecb7cceede0d7326fea5d92a788a4 | /ConsultorioMedico-master_v6/src/Ventanas/Gui_AgreAtencionMedica.java | a8b9bab8479a1b84e5d0200a441ae74f48c3684a | [] | no_license | DanielAlexanderBeltran/Calidad_Software | a356bf5c240b714d584459e7e936fc307549b642 | 6868567da69285ff2fa28b61f4faa398767bca0f | refs/heads/master | 2020-03-18T20:15:48.401541 | 2018-06-05T19:40:28 | 2018-06-05T19:40:28 | 135,204,474 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 28,477 | 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 Ventanas;
import Clases.Conexion;
import java.awt.Color;
import java.awt.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumnModel;
/**
*
* @author UNI
*/
public class Gui_AgreAtencionMedica extends javax.swing.JInternalFrame {
/**
* Creates new form AgregarDoctor
*/
public Gui_AgreAtencionMedica() {
initComponents();
jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
/**
* 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();
jPanel2 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jCalendar1 = new com.toedter.calendar.JCalendar();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jPanel3 = new javax.swing.JPanel();
ckL = new javax.swing.JCheckBox();
ckM = new javax.swing.JCheckBox();
ckX = new javax.swing.JCheckBox();
ckJ = new javax.swing.JCheckBox();
ckV = new javax.swing.JCheckBox();
ckS = new javax.swing.JCheckBox();
ckD = new javax.swing.JCheckBox();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
setBackground(new java.awt.Color(153, 255, 153));
setClosable(true);
setIconifiable(true);
setTitle("ATENCIÓN MÉDICA\n");
addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
formInternalFrameClosing(evt);
}
public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
}
public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
formInternalFrameOpened(evt);
}
});
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(153, 255, 153));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setLayout(new java.awt.GridLayout(3, 2));
jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(53, 15, 533, -1));
jButton1.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/nuevo.png"))); // NOI18N
jButton1.setText("Nueva Atención");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel1.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 370, -1, 40));
jButton2.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
jButton2.setForeground(new java.awt.Color(0, 51, 0));
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/entrar.png"))); // NOI18N
jButton2.setText("Registrar Atención Médica");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel1.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(850, 475, -1, 40));
jButton3.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
jButton3.setForeground(new java.awt.Color(255, 0, 0));
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/salir.png"))); // NOI18N
jButton3.setText("Salir");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jPanel1.add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 370, 110, 40));
jCalendar1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
jCalendar1PropertyChange(evt);
}
});
jPanel1.add(jCalendar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 140, 533, 220));
jTable1.setFont(new java.awt.Font("Noto Sans", 0, 24)); // NOI18N
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
},
new String [] {
}
));
jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jTable1.setRowHeight(40);
jTable1.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(jTable1);
jPanel1.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 110, 620, 360));
jPanel3.setBackground(new java.awt.Color(153, 255, 153));
jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
ckL.setBackground(new java.awt.Color(153, 255, 153));
ckL.setText("Lunes");
ckL.setEnabled(false);
jPanel3.add(ckL, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
ckM.setBackground(new java.awt.Color(153, 255, 153));
ckM.setText("Martes");
ckM.setEnabled(false);
jPanel3.add(ckM, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 0, -1, -1));
ckX.setBackground(new java.awt.Color(153, 255, 153));
ckX.setText("Miércoles");
ckX.setEnabled(false);
jPanel3.add(ckX, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 0, -1, -1));
ckJ.setBackground(new java.awt.Color(153, 255, 153));
ckJ.setText("Jueves");
ckJ.setEnabled(false);
jPanel3.add(ckJ, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 0, -1, -1));
ckV.setBackground(new java.awt.Color(153, 255, 153));
ckV.setText("Viernes");
ckV.setEnabled(false);
jPanel3.add(ckV, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 0, -1, -1));
ckS.setBackground(new java.awt.Color(153, 255, 153));
ckS.setText("Sábado");
ckS.setEnabled(false);
jPanel3.add(ckS, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 0, -1, -1));
ckD.setBackground(new java.awt.Color(153, 255, 153));
ckD.setText("Domingo");
ckD.setEnabled(false);
jPanel3.add(ckD, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 0, -1, -1));
jPanel1.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 30, 480, 30));
jLabel2.setFont(new java.awt.Font("Noto Sans", 1, 14)); // NOI18N
jLabel2.setText("Horario de Citas Médicas");
jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(830, 60, 260, 30));
jLabel3.setFont(new java.awt.Font("Noto Sans", 1, 14)); // NOI18N
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("Fecha de las Citas Médicas");
jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 80, 420, 30));
jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel4.setText("Calendario");
jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 120, -1, 10));
jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel5.setText("Agenda de Citas");
jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(620, 90, -1, -1));
jLabel1.setFont(new java.awt.Font("Noto Sans", 1, 14)); // NOI18N
jLabel1.setText(" Dias Laborables del Médico ");
jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 0, 250, 30));
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 100, 1240, 520));
jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel6.setForeground(new java.awt.Color(255, 0, 0));
jLabel6.setText("AGENDA MÉDICA");
getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 0, 150, 20));
jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/citas.png"))); // NOI18N
getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(670, 20, 90, 70));
setBounds(0, 0, 1255, 646);
}// </editor-fold>//GEN-END:initComponents
public void Guardar() {
int fila = jTable1.getSelectedRow();
if (fila >= 0) {
String ID = (String) model.getValueAt(fila, 2);
String Estado = (String) model.getValueAt(fila, 1);
CharSequence Pendiente = "(Pendiente)";
if(!Estado.contains(Pendiente)){
JOptionPane.showMessageDialog(this, "Seleccione una cita PENDIENTE unicamente", "Seleccione",
JOptionPane.ERROR_MESSAGE);
return;
}
int ID_Cita = Integer.parseInt(ID);
String Paciente = "";
String Dr = "";
try {
resultado = Conexion.consulta("Select Nombres_Med, Apellidos_Med, Nombres, Apellidos"
+ " from CitaV Where ID_Cita = " + ID_Cita);
while (resultado.next()) {
Dr = resultado.getString(1).trim() + " " + resultado.getString(2).trim();
Paciente = resultado.getString(3).trim() + " " + resultado.getString(4).trim();
}
} catch (SQLException ex) {
}
Gui_AñadirDiagnostico AD = new Gui_AñadirDiagnostico(null, true);
AD.setID_Cita(ID_Cita);
AD.setPaciente(Paciente);
AD.setMedico(Dr);
AD.MostrarDrPaciente();
AD.setAC(this);
AD.setVisible(true);
AD.toFront();
} else {
JOptionPane.showMessageDialog(this, "Seleccione la cita para registrar la consulta | diagnóstico | receta | archivos al expediente",
"Seleccione", JOptionPane.ERROR_MESSAGE);
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Guardar();
}//GEN-LAST:event_jButton2ActionPerformed
ResultSet resultado;
int ID_Medico = 0;
boolean flag = false;
public void CargarMedico(){
try{
resultado = Conexion.consulta("Select ID_Medico from Medico where ID_Usuario = "+Gui_Principal.ID_Usuario);
while(resultado.next()){
ID_Medico = resultado.getInt(1);
System.out.println("ID "+ID_Medico);
}
}catch(SQLException ex){}
}
private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened
CargarMedico();
Date Hoy = new Date();
jCalendar1.setMinSelectableDate(Hoy);
jCalendar1.setDate(Hoy);
flag = true;
String[] Header = {"Hora", "Estado", "ID"};
model.setColumnIdentifiers(Header);
jTable1.setModel(model);
TableColumnModel columnModel = jTable1.getColumnModel();
columnModel.getColumn(0).setPreferredWidth(115);
columnModel.getColumn(1).setPreferredWidth(535);
columnModel.getColumn(0).setResizable(false);
columnModel.getColumn(1).setResizable(false);
columnModel.getColumn(2).setResizable(false);
columnModel.getColumn(2).setPreferredWidth(0);
columnModel.getColumn(2).setMaxWidth(0);
columnModel.getColumn(2).setMinWidth(0);
columnModel.getColumn(2).setWidth(0);
jTable1.setColumnModel(columnModel);
// jTable1.removeColumn(jTable1.getColumnModel().getColumn(2));
CargarHorario();
// TODO add your handling code here:
}//GEN-LAST:event_formInternalFrameOpened
public void Limpiar() {
ckD.setSelected(false);
ckJ.setSelected(false);
ckL.setSelected(false);
ckM.setSelected(false);
ckS.setSelected(false);
ckV.setSelected(false);
ckX.setSelected(false);
Date hoy = new Date();
jCalendar1.setDate(hoy);
String[] Horas = {"7:00 A.M","8:00 A.M", "9:00 A.M", "10:00 A.M", "11:00 A.M", "12:00 P.M", "1:00 P.M",
"2:00 P.M", "3:00 P.M", "4:00 P.M", "5:00 P.M","6:00 P.M","7:00 P.M"};
model.setRowCount(10);
for (int k = 0; k < 10; k++) {
String hr = Horas[k];
model.setValueAt(hr, k, 0);
model.setValueAt("", k, 1);
model.setValueAt("", k, 2);
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
Limpiar(); // TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
this.dispose(); // TODO add your handling code here:
}//GEN-LAST:event_jButton3ActionPerformed
public void CargarHorario() {
this.jTable1.setEnabled(true);
String[] Horas = {"7:00 A.M","8:00 A.M", "9:00 A.M", "10:00 A.M", "11:00 A.M", "12:00 P.M", "1:00 P.M",
"2:00 P.M", "3:00 P.M", "4:00 P.M", "5:00 P.M","6:00 P.M","7:00 P.M"};
model.setRowCount(10);
for (int k = 0; k < 10; k++) {
String hr = Horas[k];
model.setValueAt(hr, k, 0);
}
String HoraInicio = "7:00 AM";
String HoraFinal = "7:00 PM";
boolean L = false;
boolean M = false;
boolean Mi = false;
boolean J = false;
boolean V = false;
boolean S = false;
boolean D = false;
ckL.setSelected(L);
ckM.setSelected(M);
ckX.setSelected(Mi);
ckJ.setSelected(J);
ckV.setSelected(V);
ckS.setSelected(S);
ckD.setSelected(D);
ArrayList<String> Dias = new ArrayList<>();
ArrayList<String> Hora_Inicial = new ArrayList<>();
ArrayList<String> Hora_Final = new ArrayList<>();
try {
resultado = Conexion.consulta("Select Dia, Hora_Inicial, Hora_Final"
+ " from Horario where ID_Medico = " + ID_Medico);
while (resultado.next()) {
Dias.add(resultado.getString(1));
Hora_Inicial.add(resultado.getString(2));
Hora_Final.add(resultado.getString(3));
}
} catch (SQLException ex) {
}
ArrayList<String> Hrs = new ArrayList<String>();
ArrayList<String> Estados = new ArrayList<String>();
ArrayList<String> Pacientes = new ArrayList<String>();
ArrayList<String> Citas = new ArrayList<String>();
long date = 0;
try {
Date Fecha = jCalendar1.getDate();
date = Fecha.getTime();
java.sql.Date Fechac = new java.sql.Date(date);
resultado = Conexion.consulta("Select Hora_Cita, Estado, Nombres, Apellidos, ID_Cita"
+ " from CitaV where (ID_Medico = " + ID_Medico
+ ") and (Fecha_Cita = '" + Fechac + "')");
while (resultado.next()) {
Hrs.add(resultado.getString(1));
Estados.add(resultado.getString(2));
Pacientes.add(resultado.getString(3).trim() + " " + resultado.getString(4).trim());
Citas.add(String.valueOf(resultado.getInt(5)));
}
} catch (SQLException ex) {
}
Date Hoy = jCalendar1.getDate();
long hoy = Hoy.getTime();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(hoy);
int Dia = cal.get(Calendar.DAY_OF_WEEK);
String Day = "";
switch (Dia) {
case 1:
Day = "D";
break;
case 2:
Day = "L";
break;
case 3:
Day = "M";
break;
case 4:
Day = "X";
break;
case 5:
Day = "J";
break;
case 6:
Day = "V";
break;
case 7:
Day = "S";
break;
default:
break;
}
int item = 0;
if(Dias.contains(Day)){
item = Dias.indexOf(Day);
}
else{
for(int r=0; r<jTable1.getRowCount();r++){
jTable1.setValueAt("No Disponible", r, 1);
}
this.jTable1.setEnabled(false);
jTable1.setDefaultRenderer(Object.class, new MiRenderDisable());
return;
}
int Horai = 0;
int Horaf = 0;
HoraInicio = Hora_Inicial.get(item);
HoraFinal = Hora_Final.get(item);
for (int r = 0; r < 10; r++) {
String HRM = (String) model.getValueAt(r, 0);
if (HRM.equalsIgnoreCase(HoraInicio)) {
Horai = r;
}
if (HRM.equalsIgnoreCase(HoraFinal)) {
Horaf = r;
}
}
if (ID_Medico != 0) {
model.setRowCount(0);
Horaf++;
int TamanoHorario = Horaf - Horai;
for (int k = 0; k < TamanoHorario; k++) {
model.addRow(new Object[]{"", ""});
String hr = Horas[Horai];
Horai++;
model.setValueAt(hr, k, 0);
model.setValueAt(" Libre", k, 1);
model.setValueAt("0", k, 2);
}
for (int q = 0; q < model.getRowCount(); q++) {
String HRM = (String) model.getValueAt(q, 0);
for (int p = 0; p < Hrs.size(); p++) {
if (Hrs.get(p).equalsIgnoreCase(HRM)) {
model.setValueAt(" Cita con " + Pacientes.get(p) +
" (" + Estados.get(p).trim() +")", q, 1);
model.setValueAt(Citas.get(p), q, 2);
}
}
}
}
for (String Dia1 : Dias) {
if(Dia1.equalsIgnoreCase("L")){
L=true;
}
if(Dia1.equalsIgnoreCase("M")){
M=true;
}
if(Dia1.equalsIgnoreCase("X")){
Mi=true;
}
if(Dia1.equalsIgnoreCase("J")){
J=true;
}
if(Dia1.equalsIgnoreCase("V")){
V=true;
}
if(Dia1.equalsIgnoreCase("S")){
S=true;
}
if(Dia1.equalsIgnoreCase("D")){
D=true;
}
}
ckL.setSelected(L);
ckM.setSelected(M);
ckX.setSelected(Mi);
ckJ.setSelected(J);
ckV.setSelected(V);
ckS.setSelected(S);
ckD.setSelected(D);
jTable1.setModel(model);
jTable1.setDefaultRenderer(Object.class, new MiRender());
jTable1.removeColumn(jTable1.getColumnModel().getColumn(2));
}
public void DiaDisponible() {
Date Fecha = jCalendar1.getDate();
long date = Fecha.getTime();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(date);
int Dia = cal.get(Calendar.DAY_OF_WEEK);
this.jTable1.setEnabled(true);
jTable1.setDefaultRenderer(Object.class, new MiRender());
if (!ckD.isSelected() && Dia == 1) {
this.jTable1.setEnabled(false);
jTable1.setDefaultRenderer(Object.class, new MiRenderDisable());
JOptionPane.showMessageDialog(this, "Dia Domingo no disponible en horario del medico", "No disponible",
JOptionPane.ERROR_MESSAGE);
return;
}
if (!ckL.isSelected() && Dia == 2) {
this.jTable1.setEnabled(false);
jTable1.setDefaultRenderer(Object.class, new MiRenderDisable());
JOptionPane.showMessageDialog(this, "Dia Lunes no disponible en horario del medico", "No disponible",
JOptionPane.ERROR_MESSAGE);
return;
}
if (!ckM.isSelected() && Dia == 3) {
this.jTable1.setEnabled(false);
jTable1.setDefaultRenderer(Object.class, new MiRenderDisable());
JOptionPane.showMessageDialog(this, "Dia Martes no disponible en horario del medico", "No disponible",
JOptionPane.ERROR_MESSAGE);
return;
}
if (!ckX.isSelected() && Dia == 4) {
this.jTable1.setEnabled(false);
jTable1.setDefaultRenderer(Object.class, new MiRenderDisable());
JOptionPane.showMessageDialog(this, "Dia Miércoles no disponible en horario del medico", "No disponible",
JOptionPane.ERROR_MESSAGE);
return;
}
if (!ckJ.isSelected() && Dia == 5) {
this.jTable1.setEnabled(false);
jTable1.setDefaultRenderer(Object.class, new MiRenderDisable());
JOptionPane.showMessageDialog(this, "Dia Jueves no disponible en horario del medico", "No disponible",
JOptionPane.ERROR_MESSAGE);
return;
}
if (!ckV.isSelected() && Dia == 6) {
this.jTable1.setEnabled(false);
jTable1.setDefaultRenderer(Object.class, new MiRenderDisable());
JOptionPane.showMessageDialog(this, "Dia Viernes no disponible en horario del medico", "No disponible",
JOptionPane.ERROR_MESSAGE);
return;
}
if (!ckS.isSelected() && Dia == 7) {
this.jTable1.setEnabled(false);
jTable1.setDefaultRenderer(Object.class, new MiRenderDisable());
JOptionPane.showMessageDialog(this, "Dia Sábado no disponible en horario del medico", "No disponible",
JOptionPane.ERROR_MESSAGE);
}
}
private void jCalendar1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jCalendar1PropertyChange
if (flag) {
try {
CargarHorario();
} catch (java.lang.ArrayIndexOutOfBoundsException ex) {
}
if (ID_Medico != 0) {
DiaDisponible();
}
}
// TODO add your handling code here:
}//GEN-LAST:event_jCalendar1PropertyChange
private void formInternalFrameClosing(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosing
flag = false; // TODO add your handling code here:
}//GEN-LAST:event_formInternalFrameClosing
public class MiRender extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
CharSequence Libre = " Libre";
CharSequence Atendida = "(Atendida)";
CharSequence Cancelada = "(Cancelada)";
CharSequence Pendiente = "(Pendiente)";
String Valor = (String) value;
if (column == 1 && Valor.contains(Libre)) {
this.setBackground(new Color(0, 153, 153));
this.setForeground(Color.WHITE);
}
if (column == 1 && Valor.contains(Atendida)) {
this.setBackground(new Color(51, 255, 0));
this.setForeground(Color.WHITE);
}
if (column == 1 && Valor.contains(Cancelada)) {
this.setBackground(new Color(191, 54, 12));
this.setForeground(Color.WHITE);
}
if (column == 1 && Valor.contains(Pendiente)) {
this.setBackground(new Color(255,255, 51));
this.setForeground(Color.BLACK);
}
if (column == 0) {
this.setOpaque(true);
this.setBackground(new Color(204, 204, 204));
this.setForeground(Color.BLACK);
}
// Restaurar los valores por defecto
return this;
}
}
public class MiRenderDisable extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
this.setBackground(Color.GRAY);
this.setForeground(Color.BLACK);
return this;
}
}
DefaultTableModel model = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox ckD;
private javax.swing.JCheckBox ckJ;
private javax.swing.JCheckBox ckL;
private javax.swing.JCheckBox ckM;
private javax.swing.JCheckBox ckS;
private javax.swing.JCheckBox ckV;
private javax.swing.JCheckBox ckX;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private com.toedter.calendar.JCalendar jCalendar1;
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.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}
| [
"danbelven@gmail.com"
] | danbelven@gmail.com |
60c7dc2429937bb2d073da38f09e0e156eb76b8a | e9d1b2db15b3ae752d61ea120185093d57381f73 | /mytcuml-src/src/java/components/diagram_elements/trunk/src/java/tests/com/topcoder/gui/diagramviewer/elements/accuracytests/TestSelectionCornerAccuracy.java | 731bfaf413068392ecbe0e0e4328485031d6b60a | [] | no_license | kinfkong/mytcuml | 9c65804d511ad997e0c4ba3004e7b831bf590757 | 0786c55945510e0004ff886ff01f7d714d7853ab | refs/heads/master | 2020-06-04T21:34:05.260363 | 2014-10-21T02:31:16 | 2014-10-21T02:31:16 | 25,495,964 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,148 | java | /*
* Copyright (C) 2007, TopCoder, Inc. All rights reserved
*/
package com.topcoder.gui.diagramviewer.elements.accuracytests;
import java.awt.Color;
import java.awt.Point;
import com.topcoder.gui.diagramviewer.elements.SelectionCorner;
import com.topcoder.gui.diagramviewer.elements.SelectionCornerType;
import junit.framework.TestCase;
/**
* Accuracy test cases for class <code>SelectionCorner </code>.
*
* @author Chenhong
* @version 1.0
*/
public class TestSelectionCornerAccuracy extends TestCase {
/**
* Represents the SelectionCorner instance for testing.
*/
private SelectionCorner sc = null;
/**
* Set up.
*/
public void setUp() {
sc = new SelectionCorner(SelectionCornerType.NORTH, new Point(1, 10));
}
/**
* Test the constructor <code> SelectionCorner(SelectionCornerType type, Point center) </code>.
*
*/
public void testSelectionCornerSelectionCornerTypePoint() {
assertNotNull("should not be null.", sc);
assertEquals("Equal is expected.", new Point(1, 10), sc.getCenter());
assertEquals("Equal is epxected.", SelectionCorner.DEFAULT_RADIUS, sc.getRadius());
}
/**
* Test constructor
* <code> SelectionCorner(SelectionCornerType type, Point center,
* int radius, Color strokeColor, Color fillColor) </code>.
*
*/
public void testSelectionCornerSelectionCornerTypePointIntColorColor() {
Color s = new Color(1);
Color f = new Color(2);
Point c = new Point(1, 1);
int r = 100;
sc = new SelectionCorner(SelectionCornerType.EAST, c, r, s, f);
assertNotNull("The SelectionCorner instance should be created.", sc);
assertEquals("Equal is expected.", c, sc.getCenter());
assertEquals("Equal is expected.", s, sc.getStrokeColor());
assertEquals("Equal is expected.", r, sc.getRadius());
assertEquals("Equal is expected.", f, sc.getFillColor());
}
/**
* Test method <code>boolean contains(int x, int y) </code>.
*
*/
public void testContainsIntInt() {
Color s = new Color(1);
Color f = new Color(2);
Point c = new Point(1, 1);
int r = 100;
sc = new SelectionCorner(SelectionCornerType.EAST, c, r, s, f);
assertTrue("True is expected.", sc.contains(101,1));
assertTrue("True is expected.", sc.contains(1,101));
/*
* BugFix: UML-9867
* The circle center should be (radius, radius).
*/
// old code
// assertTrue("True is expected.", sc.contains(-99,1));
// assertFalse("False is expected.", sc.contains(102, 3));
assertFalse("False is expected.", sc.contains(-99,1));
assertTrue("True is expected.", sc.contains(102, 3));
}
/**
* Test method <code>SelectionCornerType getType() </code>.
*
*/
public void testGetType() {
assertEquals("Equal is expected.", SelectionCornerType.NORTH, sc.getType());
}
/**
* Test method <code> void setType(SelectionCornerType type) </code>.
*
*/
public void testSetType() {
sc.setType(SelectionCornerType.NORTHEAST);
assertEquals("Equal is expected.", SelectionCornerType.NORTHEAST, sc.getType());
}
/**
* Test method <code>int getRadius() </code>.
*
*/
public void testGetRadius() {
assertEquals("Equal is expected.", 5, sc.getRadius());
}
/**
* Test method <code>void setRadius(int radius) </code>.
*
*/
public void testSetRadius() {
sc.setRadius(10);
assertEquals("Equal is expected.", 10, sc.getRadius());
}
/**
* Test method <code>Point getCenter() </code>.
*
*/
public void testGetCenter() {
assertEquals("Equal is expected.", new Point(1, 10), sc.getCenter());
}
/**
* Test method <code> void setCenter(Point center) </code>.
*
*/
public void testSetCenter() {
Point center = new Point(1, 1);
sc.setCenter(center);
assertEquals("Equal is expected.", new Point(1, 1), sc.getCenter());
}
/**
* Test method <code>Color getStrokeColor() </code>.
*
*/
public void testGetStrokeColor() {
assertEquals("Equal is expected.", SelectionCorner.DEFAULT_STROKECOLOR, sc.getStrokeColor());
}
/**
* Test method <code>void setStrokeColor(Color strokeColor) </code>.
*
*/
public void testSetStrokeColor() {
Color c = new Color(1);
sc.setStrokeColor(c);
assertEquals("Equal is expected.", c, sc.getStrokeColor());
}
/**
* Test method <code> Color getFillColor() </code>.
*
*/
public void testGetFillColor() {
assertEquals("Equal is expected.", SelectionCorner.DEFAULT_FILLCOLOR, sc.getFillColor());
}
/**
* Test method <code>void setFillColor(Color fillColor) </code>.
*
*/
public void testSetFillColor() {
Color f = new Color(10);
sc.setFillColor(f);
assertEquals("Equal is expected.", f, sc.getFillColor());
}
}
| [
"kinfkong@126.com"
] | kinfkong@126.com |
74b45b5a98ac2618c99ba7444a1dd320781aedb1 | 4b4c1f47ed5d52f6686975bc250bd8573e8e9e5e | /src/particles/ParticleSystem.java | 52b0ae6a14888ff172c6c67fe2b08c8ecf06764a | [] | no_license | DragonS0u1623/OpenGL-Test | da8a09386f215d75e2f3ed2db4d8016fa74652c0 | fdaddfef5a4c88f4071854d8ecd49b0d86cdb74b | refs/heads/master | 2021-09-10T21:47:56.848874 | 2018-04-02T21:35:11 | 2018-04-02T21:35:11 | 106,212,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,119 | java | package particles;
import java.util.Random;
import org.lwjgl.util.vector.*;
import renderEngine.DisplayManager;
public class ParticleSystem {
private float pps, averageSpeed, gravityComplient, averageLifeLength, averageScale;
private float speedError, lifeError, scaleError = 0;
private boolean randomRotation = false;
private Vector3f direction;
private float directionDeviation = 0;
private ParticleTextures texture;
private Random random = new Random();
public ParticleSystem(ParticleTextures texture, float pps, float speed, float gravityComplient, float lifeLength, float scale) {
this.texture = texture;
this.pps = pps;
this.averageSpeed = speed;
this.gravityComplient = gravityComplient;
this.averageLifeLength = lifeLength;
this.averageScale = scale;
}
/**
* @param direction - The average direction in which particles are emitted.
* @param deviation - A value between 0 and 1 indicating how far from the chosen direction particles can deviate.
*/
public void setDirection(Vector3f direction, float deviation) {
this.direction = new Vector3f(direction);
this.directionDeviation = (float) (deviation * Math.PI);
}
public void randomizeRotation() {
randomRotation = true;
}
/**
* @param error
* - A number between 0 and 1, where 0 means no error margin.
*/
public void setSpeedError(float error) {
this.speedError = error * averageSpeed;
}
/**
* @param error
* - A number between 0 and 1, where 0 means no error margin.
*/
public void setLifeError(float error) {
this.lifeError = error * averageLifeLength;
}
/**
* @param error
* - A number between 0 and 1, where 0 means no error margin.
*/
public void setScaleError(float error) {
this.scaleError = error * averageScale;
}
public void generateParticles(Vector3f systemCenter) {
float delta = DisplayManager.getFrameTimeSeconds();
float particlesToCreate = pps * delta;
int count = (int) Math.floor(particlesToCreate);
float partialParticle = particlesToCreate % 1;
for (int i = 0; i < count; i++) {
emitParticle(systemCenter);
}
if (Math.random() < partialParticle) {
emitParticle(systemCenter);
}
}
private void emitParticle(Vector3f center) {
Vector3f velocity = null;
if(direction!=null){
velocity = generateRandomUnitVectorWithinCone(direction, directionDeviation);
}else{
velocity = generateRandomUnitVector();
}
velocity.normalise();
velocity.scale(generateValue(averageSpeed, speedError));
float scale = generateValue(averageScale, scaleError);
float lifeLength = generateValue(averageLifeLength, lifeError);
new Particle(texture, new Vector3f(center), velocity, gravityComplient, lifeLength, generateRotation(), scale);
}
private float generateValue(float average, float errorMargin) {
float offset = (random.nextFloat() - 0.5f) * 2f * errorMargin;
return average + offset;
}
private float generateRotation() {
if (randomRotation) {
return random.nextFloat() * 360f;
} else {
return 0;
}
}
private static Vector3f generateRandomUnitVectorWithinCone(Vector3f coneDirection, float angle) {
float cosAngle = (float) Math.cos(angle);
Random random = new Random();
float theta = (float) (random.nextFloat() * 2f * Math.PI);
float z = cosAngle + (random.nextFloat() * (1 - cosAngle));
float rootOneMinusZSquared = (float) Math.sqrt(1 - z * z);
float x = (float) (rootOneMinusZSquared * Math.cos(theta));
float y = (float) (rootOneMinusZSquared * Math.sin(theta));
Vector4f direction = new Vector4f(x, y, z, 1);
if (coneDirection.x != 0 || coneDirection.y != 0 || (coneDirection.z != 1 && coneDirection.z != -1)) {
Vector3f rotateAxis = Vector3f.cross(coneDirection, new Vector3f(0, 0, 1), null);
rotateAxis.normalise();
float rotateAngle = (float) Math.acos(Vector3f.dot(coneDirection, new Vector3f(0, 0, 1)));
Matrix4f rotationMatrix = new Matrix4f();
rotationMatrix.rotate(-rotateAngle, rotateAxis);
Matrix4f.transform(rotationMatrix, direction, direction);
} else if (coneDirection.z == -1) {
direction.z *= -1;
}
return new Vector3f(direction);
}
private Vector3f generateRandomUnitVector() {
float theta = (float) (random.nextFloat() * 2f * Math.PI);
float z = (random.nextFloat() * 2) - 1;
float rootOneMinusZSquared = (float) Math.sqrt(1 - z * z);
float x = (float) (rootOneMinusZSquared * Math.cos(theta));
float y = (float) (rootOneMinusZSquared * Math.sin(theta));
return new Vector3f(x, y, z);
}
} | [
"DragonS0u1623@gmail.com"
] | DragonS0u1623@gmail.com |
249186b4943b7539c037d95d8f5fd914c4b1c429 | e808bcc1c062fd94c5f2323456abca54f4c33781 | /WALNUTS/app/src/main/java/com/njjd/walnuts/SearchActivity.java | 76307df68ee72f4110ff22990ca3a520fd7c03ff | [] | no_license | djp0507/WALNUTS | 865fbf00bc7259274441fba3adbfb0792a887e17 | 745c6c04c6b030e9c0f5370df27aa7e4f72e6a3b | refs/heads/master | 2021-09-01T06:27:02.054148 | 2017-12-25T10:10:22 | 2017-12-25T10:10:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,469 | java | package com.njjd.walnuts;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.bigkoo.pickerview.OptionsPickerView;
import com.example.retrofit.entity.SubjectPost;
import com.example.retrofit.listener.HttpOnNextListener;
import com.example.retrofit.subscribers.ProgressSubscriber;
import com.example.retrofit.util.JSONUtils;
import com.google.gson.JsonArray;
import com.njjd.adapter.HistoryAdapter;
import com.njjd.adapter.SearchArticleAdapter;
import com.njjd.adapter.SearchQuesAdapter;
import com.njjd.adapter.SearchUserAdapter;
import com.njjd.dao.SearchHistoryDao;
import com.njjd.db.DBHelper;
import com.njjd.domain.CommonEntity;
import com.njjd.domain.SearchArticleEntity;
import com.njjd.domain.SearchHistory;
import com.njjd.domain.SearchQuesEntity;
import com.njjd.domain.SearchUserEntity;
import com.njjd.http.HttpManager;
import com.njjd.utils.CommonUtils;
import com.njjd.utils.IconCenterEditText;
import com.njjd.utils.KeybordS;
import com.njjd.utils.LogUtils;
import com.njjd.utils.SPUtils;
import com.njjd.utils.ToastUtils;
import java.nio.channels.FileLock;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
/**
* Created by mrwim on 17/8/18.
*/
public class SearchActivity extends BaseActivity {
@BindView(R.id.et_search)
IconCenterEditText etSearch;
@BindView(R.id.list_ques)
ListView listQues;
@BindView(R.id.list_article)
ListView listArticle;
@BindView(R.id.list_user)
ListView listUser;
@BindView(R.id.list_label)
ListView listLabel;
@BindView(R.id.list_history)
ListView listHistory;
@BindView(R.id.txt_province)
TextView txtProvince;
@BindView(R.id.txt_vocation)
TextView txtVocation;
@BindView(R.id.lv_search)
LinearLayout lvSearch;
private List<SearchHistory> historyList, templist;
private HistoryAdapter adapter;
private SearchHistory history;
private int searchItem = 1;
SubjectPost postEntity;
private boolean isNew = true;
private SearchQuesAdapter quesAdapter;
private SearchArticleAdapter articleAdapter;
private SearchUserAdapter userAdapter;
private List<SearchQuesEntity> quesEntities = new ArrayList<>();
private List<SearchArticleEntity> articleEntities = new ArrayList<>();
private List<SearchUserEntity> userEntities = new ArrayList<>();
//省份一级菜单
private List<String> provinces;
private List<CommonEntity> provinceEntities;
//城市二级菜单
private List<List<CommonEntity>> cityList;
private List<List<String>> cityEntities;
//行业一级菜单
private List<String> industrys1;
private List<CommonEntity> industryList1;
//行业二级菜单
private List<List<String>> industrys2;
private List<List<CommonEntity>> industryList2;
private OptionsPickerView<String> provincePickview, industryPickview;
private String cityId = "0", industryId = "0";
@Override
public int bindLayout() {
return R.layout.activity_search;
}
@Override
public void initView(View view) {
historyList = DBHelper.getInstance().getmDaoSession().getSearchHistoryDao().queryBuilder().orderDesc(SearchHistoryDao.Properties.Date).build().list();
adapter = new HistoryAdapter(this, historyList);
listHistory.setAdapter(adapter);
if (historyList.size() == 0) {
findViewById(R.id.lv_history).setVisibility(View.GONE);
}
KeybordS.openKeybord(etSearch, this);
etSearch.setOnSearchClickListener(new IconCenterEditText.OnSearchClickListener() {
@Override
public void onSearchClick(View view) {
etSearch.onFocusChange(etSearch, false);
if (!"".equals(etSearch.getText().toString())) {
SearchUserAdapter.CURRENTPAGE = 1;
SearchArticleAdapter.CURRENTPAGE = 1;
SearchQuesAdapter.CURRENTPAGE = 1;
quesEntities.clear();
userEntities.clear();
articleEntities.clear();
searchByKeyWords();
} else {
ToastUtils.showShortToast(SearchActivity.this, "请输入搜索内容");
}
}
});
etSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
etSearch.onFocusChange(etSearch, hasFocus);
}
});
// etSearch.addTextChangedListener(new TextWatcher() {
// @Override
// public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//
// }
//
// @Override
// public void onTextChanged(CharSequence s, int start, int before, int count) {
// HttpManager.getInstance().cancle();
// switch (searchItem) {
// case 1:
// SearchQuesAdapter.CURRENTPAGE = 1;
// break;
// case 2:
// SearchArticleAdapter.CURRENTPAGE = 1;
// break;
// case 3:
// SearchUserAdapter.CURRENTPAGE = 1;
// break;
// case 4:
//// listLabel.setVisibility(View.GONE);
// break;
// }
// }
//
// @Override
// public void afterTextChanged(Editable s) {
// if (etSearch.getText().toString().equals("")) {
// if(historyList.size()==0){
// findViewById(R.id.lv_history).setVisibility(View.GONE);
// }else{
// findViewById(R.id.lv_history).setVisibility(View.VISIBLE);
// listHistory.setVisibility(View.VISIBLE);
// }
// switch (searchItem) {
// case 1:
// listQues.setVisibility(View.GONE);
// break;
// case 2:
// listArticle.setVisibility(View.GONE);
// break;
// case 3:
// findViewById(R.id.lv_history).setVisibility(View.GONE);
// listUser.setVisibility(View.VISIBLE);
// break;
// case 4:
// listLabel.setVisibility(View.GONE);
// break;
// }
// return;
// }
// //做搜索操作
// etSearch.setSelection(etSearch.getText().toString().length());
// switch (searchItem) {
// case 1:
// quesEntities.clear();
// quesAdapter.notifyDataSetChanged();
// break;
// case 2:
// articleEntities.clear();
// articleAdapter.notifyDataSetChanged();
// break;
// case 3:
// userEntities.clear();
// userAdapter.notifyDataSetChanged();
// break;
// case 4:
// listLabel.setVisibility(View.GONE);
// break;
// }
// searchByKeyWords();
// }
// });
listHistory.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
etSearch.setText(historyList.get(position).getKeywords());
SearchUserAdapter.CURRENTPAGE = 1;
SearchArticleAdapter.CURRENTPAGE = 1;
SearchQuesAdapter.CURRENTPAGE = 1;
KeybordS.closeBoard(SearchActivity.this);
searchByKeyWords();
etSearch.setSelection(etSearch.getText().toString().length());
}
});
quesAdapter = new SearchQuesAdapter(this, quesEntities);
listQues.setAdapter(quesAdapter);
articleAdapter = new SearchArticleAdapter(this, articleEntities);
listArticle.setAdapter(articleAdapter);
userAdapter = new SearchUserAdapter(this, userEntities);
listUser.setAdapter(userAdapter);
listQues.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// 当不滚动时
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
// 判断是否滚动到底部
if (view.getLastVisiblePosition() == view.getCount() - 1) {
SearchQuesAdapter.CURRENTPAGE++;
searchByKeyWords();
}
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
listUser.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// 当不滚动时
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
// 判断是否滚动到底部
if (view.getLastVisiblePosition() == view.getCount() - 1) {
SearchArticleAdapter.CURRENTPAGE++;
searchByKeyWords();
}
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
listArticle.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// 当不滚动时
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
// 判断是否滚动到底部
if (view.getLastVisiblePosition() == view.getCount() - 1) {
SearchUserAdapter.CURRENTPAGE++;
searchByKeyWords();
}
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
listArticle.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(SearchActivity.this, ColumnDetailActivity.class);
intent.putExtra("article_id", Float.valueOf(articleEntities.get(position).getArticleId()).intValue() + "");
startActivity(intent);
overridePendingTransition(R.anim.in, R.anim.out);
}
});
listQues.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(SearchActivity.this, SearchQuesDetailActivity.class);
intent.putExtra("id", Float.valueOf(quesEntities.get(position).getArticleId()).intValue() + "");
startActivity(intent);
overridePendingTransition(R.anim.in, R.anim.out);
}
});
listUser.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(SearchActivity.this, PeopleInfoActivity.class);
intent.putExtra("uid", userEntities.get(position).getUid());
startActivity(intent);
overridePendingTransition(R.anim.in, R.anim.out);
}
});
provinces = CommonUtils.getInstance().getProvincesList();
provinces.add(0, "区域不限");
provinceEntities = CommonUtils.getInstance().getProvinceEntities();
provinceEntities.add(0, new CommonEntity("0", "区域不限", "000"));
cityEntities = CommonUtils.getInstance().getCityEntities();
List<List<String>> a = new ArrayList<>();
List<String> b = new ArrayList<>();
b.add("区域不限");
a.add(b);
cityEntities.add(0, b);
cityList = CommonUtils.getInstance().getCityList();
List<CommonEntity> t = new ArrayList<>();
t.add(new CommonEntity("0", "区域不限", "000"));
cityList.add(0, t);
industrys1 = CommonUtils.getInstance().getIndustrys1();
industrys1.add(0, "行业不限");
industrys2 = CommonUtils.getInstance().getIndustrys2();
List<String> d = new ArrayList<>();
d.add("行业不限");
industrys2.add(0, d);
industryList1 = CommonUtils.getInstance().getIndustryList1();
industryList1.add(new CommonEntity("0", "行业不限", "000"));
industryList2 = CommonUtils.getInstance().getIndustryList2();
List<CommonEntity> c = new ArrayList<>();
c.add(new CommonEntity("0", "行业不限", "000"));
industryList2.add(0, c);
provincePickview = new OptionsPickerView.Builder(SearchActivity.this, new OptionsPickerView.OnOptionsSelectListener() {
@Override
public void onOptionsSelect(int options1, int options2, int options3, View v) {
cityId = Float.valueOf(cityList.get(options1).get(options2).getId()).intValue() + "";
txtProvince.setText(cityEntities.get(options1).get(options2));
userEntities.clear();
userAdapter.notifyDataSetChanged();
SearchUserAdapter.CURRENTPAGE = 1;
searchByKeyWords();
}
}).build();
provincePickview.setPicker(provinces, cityEntities);
industryPickview = new OptionsPickerView.Builder(SearchActivity.this, new OptionsPickerView.OnOptionsSelectListener() {
@Override
public void onOptionsSelect(int options1, int options2, int options3, View v) {
txtVocation.setText(industrys2.get(options1).get(options2));
industryId = Float.valueOf(industryList2.get(options1).get(options2).getId()).intValue() + "";
userEntities.clear();
SearchUserAdapter.CURRENTPAGE = 1;
userAdapter.notifyDataSetChanged();
searchByKeyWords();
}
}).build();
industryPickview.setPicker(industrys1, industrys2);
}
private void searchByKeyWords() {
if (etSearch.getText().toString().equals("")) {
if (searchItem != 3) {
return;
}
} else {
updateHistory();
}
findViewById(R.id.lv_history).setVisibility(View.GONE);
listHistory.setVisibility(View.GONE);
Map<String, Object> map = new HashMap<>();
map.put("uid", SPUtils.get(this, "userId", "").toString());
map.put("keyword", etSearch.getText().toString());
switch (searchItem) {
case 1:
//搜问题
quesAdapter.setText(etSearch.getText().toString());
listQues.setVisibility(View.VISIBLE);
map.put("page", SearchQuesAdapter.CURRENTPAGE++);
postEntity = new SubjectPost(new ProgressSubscriber(searchQuestion, this, true, true), map);
HttpManager.getInstance().searchQuest(postEntity);
break;
case 2:
//搜文章
articleAdapter.setText(etSearch.getText().toString());
listArticle.setVisibility(View.VISIBLE);
map.put("page", SearchArticleAdapter.CURRENTPAGE++);
postEntity = new SubjectPost(new ProgressSubscriber(searchArticle, this, true, true), map);
HttpManager.getInstance().searchArticle(postEntity);
break;
case 3:
//搜用户
userAdapter.setText(etSearch.getText().toString());
lvSearch.setVisibility(View.VISIBLE);
listUser.setVisibility(View.VISIBLE);
if (!cityId.equals("0")) {
map.put("city_id", Float.valueOf(cityId).intValue());
}
if (!industryId.equals("0")) {
map.put("industry_id", Float.valueOf(industryId).intValue());
}
map.put("page", SearchUserAdapter.CURRENTPAGE++);
postEntity = new SubjectPost(new ProgressSubscriber(searchUser, this, true, true), map);
HttpManager.getInstance().searchUser(postEntity);
break;
case 4:
listLabel.setVisibility(View.VISIBLE);
// map.put("page",etSearch.getText().toString());
//搜话题
// ToastUtils.showShortToast(this, "搜话题");
// postEntity= new SubjectPost(new ProgressSubscriber(searchLabel, this, true, false), map);
// HttpManager.getInstance().phoneCode(postEntity);
break;
}
}
HttpOnNextListener searchQuestion = new HttpOnNextListener() {
@Override
public void onNext(Object o) {
JsonArray array = JSONUtils.getAsJsonArray(o);
SearchQuesEntity entity;
if (SearchQuesAdapter.CURRENTPAGE == 1) {
quesEntities.clear();
}
for (int i = 0; i < array.size(); i++) {
entity = new SearchQuesEntity(array.get(i).getAsJsonObject());
quesEntities.add(entity);
}
quesAdapter.notifyDataSetChanged();
}
};
HttpOnNextListener searchArticle = new HttpOnNextListener() {
@Override
public void onNext(Object o) {
JsonArray array = JSONUtils.getAsJsonArray(o);
SearchArticleEntity entity;
if (SearchArticleAdapter.CURRENTPAGE == 1) {
articleEntities.clear();
}
for (int i = 0; i < array.size(); i++) {
entity = new SearchArticleEntity(array.get(i).getAsJsonObject());
articleEntities.add(entity);
}
articleAdapter.notifyDataSetChanged();
}
};
HttpOnNextListener searchUser = new HttpOnNextListener() {
@Override
public void onNext(Object o) {
JsonArray array = JSONUtils.getAsJsonArray(o);
SearchUserEntity entity;
if (SearchUserAdapter.CURRENTPAGE == 1) {
userEntities.clear();
}
for (int i = 0; i < array.size(); i++) {
entity = new SearchUserEntity(array.get(i).getAsJsonObject());
userEntities.add(entity);
}
userAdapter.notifyDataSetChanged();
}
};
HttpOnNextListener searchLabel = new HttpOnNextListener() {
@Override
public void onNext(Object o) {
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SearchQuesAdapter.CURRENTPAGE = 1;
SearchArticleAdapter.CURRENTPAGE = 1;
SearchUserAdapter.CURRENTPAGE = 1;
}
private void updateHistory() {
isNew = true;
templist = DBHelper.getInstance().getmDaoSession().getSearchHistoryDao().queryBuilder().orderAsc(SearchHistoryDao.Properties.Id).build().list();
for (int i = 0; i < templist.size(); i++) {
if (templist.get(i).getKeywords().equals(etSearch.getText().toString())) {
history = templist.get(i);
history.setDate(new Date());
DBHelper.getInstance().getmDaoSession().getSearchHistoryDao().update(history);
isNew = false;
break;
}
}
if (isNew) {
if (templist.size() > 0) {
history = new SearchHistory(templist.get(templist.size() - 1).getId() + 1, etSearch.getText().toString(), new Date());
} else {
history = new SearchHistory(1, etSearch.getText().toString(), new Date());
}
DBHelper.getInstance().getmDaoSession().getSearchHistoryDao().insert(history);
}
}
@OnClick({R.id.back, R.id.radio1, R.id.radio2, R.id.radio3, R.id.radio4, R.id.delete_history, R.id.txt_province, R.id.txt_vocation, R.id.txt_advanced})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.back:
KeybordS.closeBoard(this);
finish();
break;
case R.id.txt_province:
if (provincePickview != null) {
provincePickview.show();
}
KeybordS.closeBoard(this);
break;
case R.id.txt_advanced:
startActivity(new Intent(this, AdvancedSearchActivity.class));
KeybordS.closeBoard(this);
break;
case R.id.txt_vocation:
if (industryPickview != null) {
industryPickview.show();
}
industryPickview.show();
KeybordS.closeBoard(this);
break;
case R.id.radio1:
searchItem = 1;
if (listHistory.getVisibility() == View.VISIBLE) {
lvSearch.setVisibility(View.GONE);
return;
}
SearchQuesAdapter.CURRENTPAGE = 1;
quesEntities.clear();
listQues.setVisibility(View.VISIBLE);
listArticle.setVisibility(View.GONE);
listUser.setVisibility(View.GONE);
lvSearch.setVisibility(View.GONE);
listLabel.setVisibility(View.GONE);
searchByKeyWords();
break;
case R.id.radio2:
searchItem = 2;
if (listHistory.getVisibility() == View.VISIBLE) {
lvSearch.setVisibility(View.GONE);
return;
}
SearchArticleAdapter.CURRENTPAGE = 1;
articleEntities.clear();
listQues.setVisibility(View.GONE);
listArticle.setVisibility(View.VISIBLE);
listUser.setVisibility(View.GONE);
lvSearch.setVisibility(View.GONE);
listLabel.setVisibility(View.GONE);
searchByKeyWords();
break;
case R.id.radio3:
searchItem = 3;
userEntities.clear();
SearchUserAdapter.CURRENTPAGE = 1;
listQues.setVisibility(View.GONE);
listArticle.setVisibility(View.GONE);
lvSearch.setVisibility(View.VISIBLE);
listUser.setVisibility(View.VISIBLE);
listLabel.setVisibility(View.GONE);
searchByKeyWords();
break;
case R.id.radio4:
searchItem = 4;
if (listHistory.getVisibility() == View.VISIBLE) {
lvSearch.setVisibility(View.GONE);
return;
}
listQues.setVisibility(View.GONE);
listArticle.setVisibility(View.GONE);
listUser.setVisibility(View.GONE);
lvSearch.setVisibility(View.GONE);
listLabel.setVisibility(View.VISIBLE);
searchByKeyWords();
break;
case R.id.delete_history:
DBHelper.getInstance().getmDaoSession().getSearchHistoryDao().deleteAll();
historyList.clear();
adapter.notifyDataSetChanged();
findViewById(R.id.lv_history).setVisibility(View.GONE);
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
KeybordS.closeBoard(this);
provinces.remove(0);
cityEntities.remove(0);
cityList.remove(0);
provinceEntities.remove(0);
industrys1.remove(0);
industryList1.remove(0);
industrys2.remove(0);
industryList2.remove(0);
}
@Override
public void onBackPressed() {
super.onBackPressed();
KeybordS.closeBoard(this);
}
}
| [
"847443371@qq.com"
] | 847443371@qq.com |
8171a076383895e31e082f594594ef6c39c45ba2 | a46aee93666e8580d8ae31db4883b209e8a97cc0 | /spring-boot-rabbitmq/src/main/java/com/zhw/study/springbootrabbitmq/component/config/RabbitmqConfiguration.java | 9fe68716eb6a955d973dba7e877326f1500967d7 | [] | no_license | ctg12581/spring-boot-learning | d8eaed9a25281bce3676ecb14655b1cd17765b0a | f95ee0ccdedcbb297e7282d7d0c2ec9e3419daed | refs/heads/master | 2023-04-04T01:05:09.157266 | 2020-06-18T01:59:00 | 2020-06-18T01:59:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package com.zhw.study.springbootrabbitmq.component.config;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author innerpeacez
* @since 2018/12/28
*/
@Configuration
public class RabbitmqConfiguration {
@Bean
public Queue helloQueue() {
return new Queue("hello");
}
}
| [
"zhaihw0417@163.com"
] | zhaihw0417@163.com |
350ce725a2910314df35415604f9a86e729df262 | a2e6e7192124e74c5ef4169905a050343f18538b | /src/main/java/com/dyagilevaskripko/crystallball/Core.java | 4d44931f5196b7f3806f1abb8aa816f72f8c4254 | [] | no_license | Dyagileva/crystal_ball | 74405ba4139d5ae3c72a3b8dc4557b12fdfd4bc2 | c7061259cc1855b312cbe701834a63e9497d9b2c | refs/heads/master | 2020-04-16T04:19:33.034816 | 2016-12-13T02:52:51 | 2016-12-13T02:52:51 | 68,237,530 | 0 | 0 | null | 2016-09-19T21:45:22 | 2016-09-14T19:42:52 | Java | UTF-8 | Java | false | false | 575 | java | package com.dyagilevaskripko.crystallball;
import com.dyagilevaskripko.crystallball.db.DataBase;
import javafx.stage.Stage;
public class Core
{
private WindowManager windowManager;
private Stage primaryStage;
public Core(Stage stage)
{
this.primaryStage = stage;
windowManager = new WindowManager();
}
public void execute()
{
boolean connectionResult = DataBase.connection();
if (connectionResult){
DataBase.createTable();
windowManager.showMainWindow(primaryStage);
}
}
}
| [
"dyagileva.1995@mail.ru"
] | dyagileva.1995@mail.ru |
02035dca989325127d1280bebb5b2f5c79875c2c | c72e953e7b3cf473627f59c5fdae22b56fdb06ed | /Algorithm-Study/src/Day07/Solution01.java | 3f88c0ba4af9d577259419e5f0b134e92ce536a9 | [] | no_license | dev-mong/Algorithm | 5d490c8db4f6926d56895581e38aec2dd6507c6c | 1d6f4c89dc5d2291ca66c3959a80effb15d2156f | refs/heads/master | 2023-07-09T20:58:18.442836 | 2021-08-05T07:07:33 | 2021-08-05T07:07:33 | 263,282,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,477 | java | package Day07;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Scanner;
public class Solution01 {
public static void main(String[] args) {
String str = null;
HashMap<String, String> phoneList = new HashMap<String, String>();
String name = null;
String number = null;
try {
// 파일 객체 생성
File file = new File("C:/temp/phone.txt");
// 입력 스트림 생성
FileReader file_reader = new FileReader(file);
BufferedReader br = new BufferedReader(file_reader);
while (true) {
str = br.readLine();
if (str == null) {
break;
}
name = str.substring(0, 3);
// System.out.println(name);
number = str.substring(4, 17);
// System.out.println(number);
phoneList.put(name, number);
}
br.close();
} catch (FileNotFoundException e) {
e.getStackTrace();
} catch (IOException e) {
e.getStackTrace();
}
System.out.println("총 7개의 전화번호를 읽었습니다.");
while (true) {
System.out.println("이름>>");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
if (input.equals("그만")) {
break;
}
String phoneNumber = phoneList.get(input);
if (phoneNumber == null) {
System.out.println("찾는 이름이 없습니다.");
} else {
System.out.println(phoneNumber);
}
}
}
}
| [
"qkrwlsaud0118@gmail.com"
] | qkrwlsaud0118@gmail.com |
725bc3ee5eadacc8eb711c66336f105fe40bd389 | 5148293c98b0a27aa223ea157441ac7fa9b5e7a3 | /Method_Scraping/xml_scraping/NicadOutputFile_t1_flink_new2/Nicad_t1_flink_new2314.java | 69abb6a5561f9b93c24f141180cc41412878252c | [] | no_license | ryosuke-ku/TestCodeSeacherPlus | cfd03a2858b67a05ecf17194213b7c02c5f2caff | d002a52251f5461598c7af73925b85a05cea85c6 | refs/heads/master | 2020-05-24T01:25:27.000821 | 2019-08-17T06:23:42 | 2019-08-17T06:23:42 | 187,005,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | // clone pairs:8743:92%
// 9502:flink/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/checkpoints/TaskCheckpointStatisticsWithSubtaskDetails.java
public class Nicad_t1_flink_new2314
{
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
TaskCheckpointStatisticsWithSubtaskDetails that = (TaskCheckpointStatisticsWithSubtaskDetails) o;
return Objects.equals(summary, that.summary) &&
Objects.equals(subtaskCheckpointStatistics, that.subtaskCheckpointStatistics);
}
} | [
"naist1020@gmail.com"
] | naist1020@gmail.com |
2ac6b2e5089855ba3e7c5e5cd18b68098605c116 | 0b123cda9e6214f284f0091eec2668cc59e1e605 | /src/by/epam/javatraining/veranikayarashevich/tasks/maintask01/model/ArrayReversal.java | a2738c3da53ae768246c30e99d27ea42627bffc5 | [] | no_license | yarashevichv/Java-0 | 3ca748162cf9cc400049dca2e9e3fd032e1affc9 | c92e36f8b9bd73e84a942e10c9c8fe92577c0b15 | refs/heads/master | 2020-04-11T08:23:04.837456 | 2019-01-28T06:58:18 | 2019-01-28T06:58:18 | 161,641,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package by.epam.javatraining.veranikayarashevich.tasks.maintask01.model;
import by.epam.javatraining.veranikayarashevich.tasks.maintask01.userexceptions.EmptyArrayException;
/**
* Class reverses elements of array.
*
* @author Veranika Yarashevich
* @version 1.0 22 Dec 2018
*/
public class ArrayReversal {
public static int[] reverseArray(int[] numbers) throws EmptyArrayException {
int[] array = numbers;
int temp;
int sizeOfArray = array.length;
if (sizeOfArray == 0) {
throw new EmptyArrayException();
} else {
for (int i = 0; i < array.length / 2; i++, sizeOfArray--) {
temp = array[i];
array[i] = array[sizeOfArray - 1];
array[sizeOfArray - 1] = temp;
}
return array;
}
}
}
| [
"veronika_yara@mail.ru"
] | veronika_yara@mail.ru |
9a1557ae56710c6043e222714f7744b5421dcf07 | 84d8aafd90d33e329949f686a68bb884d859ec07 | /src/test/java/org/generationcp/middleware/data/initializer/WorkbenchUserTestDataInitializer.java | 8a6195a319ce7d5b05deefdb34ac3572aff097e9 | [] | no_license | qatestuser2019/Middleware | b27d3395a948d3873efa9b38b0291d78788889e8 | a562605fcdb2fcdf4cb17562e1e39279de683bc7 | refs/heads/master | 2022-02-09T05:10:47.493123 | 2019-07-22T14:41:03 | 2019-07-22T14:41:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package org.generationcp.middleware.data.initializer;
import org.generationcp.middleware.pojos.workbench.WorkbenchUser;
public class WorkbenchUserTestDataInitializer {
public static WorkbenchUser createWorkbenchUser() {
final WorkbenchUser user = new WorkbenchUser(1);
user.setPersonid(1);
return user;
}
}
| [
"marc.ramos@leafnode.io"
] | marc.ramos@leafnode.io |
2daf50b7c561a173f8db41a0027e258dc15f5c6b | 3817bff8f1703351c69cf9cabba938e510fdf3aa | /src/com/erhuo/bean/Banner.java | bb8a432f531975217f4333e5da5af446041b61bf | [] | no_license | zheng7641/erhuo | 89869672fe4ea9f05372e5e6781cd2ccffffcb52 | b9266b975d47637a1d553276ea69ddd76684cdd0 | refs/heads/master | 2021-01-10T01:48:15.655122 | 2015-12-07T13:14:55 | 2015-12-07T13:14:55 | 46,209,840 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 989 | java | package com.erhuo.bean;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name="banner")
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
public class Banner {
private int bannerId;
private String bannerName;
@Override
public String toString() {
return "Banner [bannerId=" + bannerId + ", bannerName=" + bannerName + "]";
}
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "increment")
public int getBannerId() {
return bannerId;
}
public void setBannerId(int bannerId) {
this.bannerId = bannerId;
}
public String getBannerName() {
return bannerName;
}
public void setBannerName(String bannerName) {
this.bannerName = bannerName;
}
}
| [
"zheng7641@163.com"
] | zheng7641@163.com |
f7df1fe6f1b07f2e8f144d91215840480b5767e7 | 4693c86f1bd7fd7341bfdd25f4bd6c722cfd8ea4 | /item_provider/dm_item_provider/src/main/java/cn/dm/service/RestDmCinemaSeatService.java | 29b9d39d654bc124e9a3398cb104a25969858ab9 | [] | no_license | AlexKingGo/dami | 8f260df50668df5aa8118fa3f42bcf71a54d399c | b80228d4bbae59e8c6308035f339f1bf0851d4c1 | refs/heads/master | 2020-05-01T16:44:28.354673 | 2019-03-25T12:20:31 | 2019-03-25T12:20:31 | 177,580,586 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,133 | java | package cn.dm.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.dm.mapper.DmCinemaSeatMapper;
import cn.dm.pojo.DmCinemaSeat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Created by 北大课工场
*/
@RestController
public class RestDmCinemaSeatService {
@Autowired
private DmCinemaSeatMapper dmCinemaSeatMapper;
@RequestMapping(value = "/getDmCinemaSeatById",method = RequestMethod.POST)
public DmCinemaSeat getDmCinemaSeatById(@RequestParam("id") Long id)throws Exception{
return dmCinemaSeatMapper.getDmCinemaSeatById(id);
}
@RequestMapping(value = "/getDmCinemaSeatListByMap",method = RequestMethod.POST)
public List<DmCinemaSeat> getDmCinemaSeatListByMap(@RequestParam Map<String,Object> param)throws Exception{
return dmCinemaSeatMapper.getDmCinemaSeatListByMap(param);
}
@RequestMapping(value = "/getDmCinemaSeatCountByMap",method = RequestMethod.POST)
public Integer getDmCinemaSeatCountByMap(@RequestParam Map<String,Object> param)throws Exception{
return dmCinemaSeatMapper.getDmCinemaSeatCountByMap(param);
}
@RequestMapping(value = "/qdtxAddDmCinemaSeat",method = RequestMethod.POST)
public Integer qdtxAddDmCinemaSeat(@RequestBody DmCinemaSeat dmCinemaSeat)throws Exception{
dmCinemaSeat.setCreatedTime(new Date());
return dmCinemaSeatMapper.insertDmCinemaSeat(dmCinemaSeat);
}
@RequestMapping(value = "/qdtxModifyDmCinemaSeat",method = RequestMethod.POST)
public Integer qdtxModifyDmCinemaSeat(@RequestBody DmCinemaSeat dmCinemaSeat)throws Exception{
dmCinemaSeat.setUpdatedTime(new Date());
return dmCinemaSeatMapper.updateDmCinemaSeat(dmCinemaSeat);
}
}
| [
"292598389@qq.com"
] | 292598389@qq.com |
7a098dabadf3f33fdddc2b8bfd7777d29a3e9913 | 7e30402daa8b6d252a930f7c0998312af4831118 | /src/Lab6/Sort.java | 2839f4833d89d14a65b207468e3d87bc5ab947a2 | [] | no_license | Equilibriumty/oop_labs | 88d1cd25655f54134485390e75bc9d27dc6c7795 | ce4c852f1d650bcdb9f6ec1cdbd78ef6855c7e7a | refs/heads/master | 2022-08-21T05:22:39.875161 | 2020-05-30T10:34:10 | 2020-05-30T10:34:10 | 262,010,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package Lab6;
import java.util.Comparator;
public class Sort implements Comparator <Stones> {
@Override
public int compare(Stones obj1, Stones obj2) {
return obj2.getPrice() - obj1.getPrice();
}
}
| [
"fanflackplay@gmail.com"
] | fanflackplay@gmail.com |
c5e46d6942015951612043d44bede1550c60f4f2 | 11e53b7840cbce13c6e45f9c081adf087d62872a | /src/main/java/com/shelf/recommender/BookSimilarityServlet.java | 3b8cf72ea33c80007f0a35b0cc3d12eb31de1c8e | [
"MIT"
] | permissive | devkhatri9/FunDeveloping | ea28e88ec3cd6a8ecc361f354fcdb7a2ef82b6cd | 3ca6d4ebdec907f1a0c466786f5d874b9c1160ca | refs/heads/master | 2022-12-06T11:12:47.983360 | 2020-02-21T13:55:27 | 2020-02-21T13:55:27 | 242,149,619 | 0 | 0 | MIT | 2022-11-16T04:55:31 | 2020-02-21T13:50:05 | Java | UTF-8 | Java | false | false | 4,611 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.shelf.recommender;
import com.shelf.search.BookBean;
import java.io.IOException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Resource;
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 javax.servlet.http.HttpSession;
import javax.sql.DataSource;
import org.apache.mahout.cf.taste.common.TasteException;
/**
*
* @author Lenovo
*/
@WebServlet(asyncSupported = true)
public class BookSimilarityServlet extends HttpServlet {
private ScheduledExecutorService scheduler;
private @Resource(name = "jdbc/taste_preferences",
lookup = "jdbc/taste_preferences",
authenticationType = Resource.AuthenticationType.APPLICATION,
shareable = false)
DataSource tasteDS;
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
* @throws org.apache.mahout.cf.taste.common.TasteException
* @throws java.lang.InterruptedException
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, TasteException, InterruptedException {
if (request.getAttribute("bookdetails") != null) {
BookBean bookdetails = (BookBean) request.getAttribute("bookdetails");
HttpSession session = request.getSession(true);
scheduler = Executors.newScheduledThreadPool(20);
session.setAttribute("bookid", bookdetails.getBookID());
System.out.println("Created Item Similarity Scheduler");
scheduler.schedule(new SimilarBookRecommenderService(session, tasteDS), 0, TimeUnit.SECONDS);
System.out.println("Scheduled Recommendation Task");
String url = response.encodeRedirectURL("productdetails.jsp");
scheduler.shutdown();
scheduler.awaitTermination(0, TimeUnit.HOURS);
request.getRequestDispatcher("productdetails.jsp").forward(request, response);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (TasteException ex) {
Logger.getLogger(BookSimilarityServlet.class.getName()).log(Level.SEVERE, null, ex);
} catch (InterruptedException ex) {
Logger.getLogger(BookSimilarityServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (TasteException ex) {
Logger.getLogger(BookSimilarityServlet.class.getName()).log(Level.SEVERE, null, ex);
} catch (InterruptedException ex) {
Logger.getLogger(BookSimilarityServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"khatridev6609@gmail.com"
] | khatridev6609@gmail.com |
15b55cce14f781fe7fb12596b3f5ab8dc758c8d8 | e929e625b4c616c13b7d26eba497d4c9f5bbc4b6 | /src/test/java/_04_webdriverpractice/basics/manipulate/ManipulateExerciseDropdownTest.java | 93ad6ed8703b202c3bbca01fd5b312ff7e07a275 | [] | no_license | kartheekch970/webdriverpractice | 45e6f054502302bd2fdba1195139e995b297f4db | 7ec2dceb243bf7685d61f101e543e2f8db8bc9a6 | refs/heads/master | 2022-12-02T17:56:58.124840 | 2020-08-15T10:43:17 | 2020-08-15T10:43:17 | 277,140,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,890 | java | package _04_webdriverpractice.basics.manipulate;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertTrue;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class ManipulateExerciseDropdownTest {
static WebDriver driver;
@BeforeClass
public static void setupDriverByManager() {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
@BeforeMethod
public void setupBrowser() {
driver.manage().window().maximize();
driver.get("http://www.compendiumdev.co.uk" +
"/selenium/basic_html_form.html");
}
@Test
public void submitFormWithDropDown5SelectedChainOfFindElements() {
WebElement dropDownSelect, dropDownOption;
dropDownSelect = driver.findElement(
By.cssSelector("select[name='dropdown']"));
dropDownOption = dropDownSelect.findElement(
By.cssSelector("option[value='dd5']"));
dropDownOption.click();
clickSubmitButton();
new WebDriverWait(driver,10).until(ExpectedConditions.titleIs("Processed Form Details"));
assertDropdownValueIsCorrect();
}
@Test
public void submitFormWithDropDown5SelectedOptionFiveDirect() {
WebElement dropDownOption;
dropDownOption = driver.findElement(
By.cssSelector("option[value='dd5']"));
dropDownOption.click();
clickSubmitButton();
new WebDriverWait(driver,10).until(ExpectedConditions.titleIs("Processed Form Details"));
assertDropdownValueIsCorrect();
}
@Test
public void submitFormWithDropDownFiveUsingKeyboardFullText() {
WebElement dropDownSelect;
dropDownSelect = driver.findElement(
By.cssSelector("select[name='dropdown']"));
dropDownSelect.sendKeys("Drop Down Item 5");
waitForOption5ToBeSelected();
clickSubmitButton();
new WebDriverWait(driver,10).until(ExpectedConditions.titleIs("Processed Form Details"));
assertDropdownValueIsCorrect();
}
@Test
public void submitFormUsingSelectClass() {
WebElement dropDown;
dropDown = driver.findElement(
By.cssSelector("select[name='dropdown']"));
Select dropdownSelect = new Select(dropDown);
dropdownSelect.selectByVisibleText("Drop Down Item 5");
waitForOption5ToBeSelected();
clickSubmitButton();
new WebDriverWait(driver,10).until(ExpectedConditions.titleIs("Processed Form Details"));
assertDropdownValueIsCorrect();
}
private void waitForOption5ToBeSelected() {
WebElement option5Item;
WebDriverWait wait = new WebDriverWait(driver, 10);
option5Item = driver.findElement(
By.cssSelector("option[value='dd5']"));
wait.until(ExpectedConditions.
elementToBeSelected(option5Item));
}
private void clickSubmitButton() {
WebElement submitButton;
submitButton = driver.findElement(
By.cssSelector(
"input[type='submit'][name='submitbutton']"));
submitButton.click();
}
private void assertDropdownValueIsCorrect() {
WebElement dropDownResult;
dropDownResult = driver.findElement(By.id("_valuedropdown"));
assertEquals(dropDownResult.getText(), "dd5");
}
@AfterClass
public static void teardown() {
driver.close();
}
}
| [
"Kartheekch970@gmail.com"
] | Kartheekch970@gmail.com |
563b61e0852d54e9d881d7445c2c24e32e83f5a3 | 8be84d5f6e5685b02ba42b60f9ae7a99c053cc82 | /user/src/main/java/com/opensource/soft/BlogServer/user/comment/service/CommentService.java | 4045c4d3a394e8680e85cb61ab35b7fa04374992 | [] | no_license | blogserver/BlogServer | 057e85b507905ea1005e62c79b997624a3445a6b | 76cdd74c1f53c21718ace2078d929213fb1f2010 | refs/heads/master | 2021-04-18T19:03:42.749610 | 2018-05-18T13:30:13 | 2018-05-18T13:30:13 | 126,579,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package com.opensource.soft.BlogServer.user.comment.service;
import com.opensource.soft.BlogServer.user.comment.model.Comment;
public interface CommentService {
int save(Comment comment);
}
| [
"liqiwei123@outlook.com"
] | liqiwei123@outlook.com |
6cd27262ee83da2a1b6cdb0f89da87f057892ccc | 9da8752fb176fbb54397dd9676b27f2ff6408372 | /health_common/src/test/java/com/itheima/test/TestCode.java | 082decaa3ed6f33bfff4e82ede8786445971855c | [] | no_license | yq199020/health | f1933ccd3c144842e2f78524a2ba155e64e43678 | 608390b4a3327818e0e97c193c5b9e8fc6b5c87c | refs/heads/master | 2022-12-23T05:43:54.629593 | 2019-07-27T12:02:38 | 2019-07-27T12:02:51 | 199,164,606 | 1 | 0 | null | 2022-12-16T04:29:15 | 2019-07-27T12:53:07 | JavaScript | UTF-8 | Java | false | false | 438 | java | package com.itheima.test;
import com.itheima.health.utils.ValidateCodeUtils;
import org.junit.Test;
/**
* @ClassName TestPOI
* @Description TODO
* @Author ly
* @Company 深圳黑马程序员
* @Date 2019/6/29 14:49
* @Version V1.0
*/
public class TestCode {
@Test
public void importData() throws Exception {
Integer value = ValidateCodeUtils.generateValidateCode(6);
System.out.println(value);
}
}
| [
"yiqi2012@126.com"
] | yiqi2012@126.com |
848251ebdcf121b1d3518d4aa9e547e54ceabcf8 | 40ad96ae34368d288ff2309b9f5f9b8a24bd0761 | /Java+/JSE+/RegExp/test/deserialization/SpecialCharacters.java | b4e437b3af790170750c40bd7c24e496e051cb62 | [] | no_license | Testudinate/yaal_examples | efffeca2b31eb3a845c55c58769377b89b9f381f | cb576ebb3d981ca7f1a59a2d871ef6d8e519e969 | refs/heads/master | 2020-12-25T21:12:57.271788 | 2015-11-11T20:23:27 | 2015-11-11T20:23:27 | 46,030,837 | 1 | 0 | null | 2015-11-12T05:09:42 | 2015-11-12T05:09:42 | null | UTF-8 | Java | false | false | 1,204 | java | package deserialization;
import org.junit.Test;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.junit.Assert.*;
/**
* Поиск специальных символов.
*/
public class SpecialCharacters {
@Test
public void ampersand() {
final String source = "concert $Einaudi ludovico einaudi today ";
Pattern p = Pattern.compile("\\$Einaudi");
Matcher m = p.matcher(source);
assertTrue(m.find());
assertEquals("$Einaudi", m.group());
assertFalse(m.find());
}
@Test
public void brace() {
final String source = "concert {Einaudi} ludovico einaudi today ";
Pattern p = Pattern.compile("\\{Einaudi\\}");
Matcher m = p.matcher(source);
assertTrue(m.find());
assertEquals("{Einaudi}", m.group());
assertFalse(m.find());
}
@Test
public void wordInBraces() {
final String source = "concert {Einaudi} ludovico einaudi today ";
Pattern p = Pattern.compile("\\{\\w*\\}");
Matcher m = p.matcher(source);
assertTrue(m.find());
assertEquals("{Einaudi}", m.group());
assertFalse(m.find());
}
} | [
"ya_al@bk.ru"
] | ya_al@bk.ru |
d6dc678d31a8e0b80f9666b91b82b4e597c3b0e7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/25/25_07c152c351fd09edc4cf5134159c3bd9227714d2/GPXUtilities/25_07c152c351fd09edc4cf5134159c3bd9227714d2_GPXUtilities_s.java | 187fa0c13751ad7e03f2ec883ada5627323e14a2 | [] | 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 | 15,469 | java | package net.osmand;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Stack;
import java.util.TimeZone;
import net.osmand.plus.R;
import org.apache.commons.logging.Log;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
import android.content.Context;
import android.location.Location;
import android.util.Xml;
public class GPXUtilities {
public final static Log log = LogUtil.getLog(GPXUtilities.class);
private final static String GPX_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
private final static NumberFormat latLonFormat = new DecimalFormat("0.00#####", new DecimalFormatSymbols(Locale.US));
public static class GPXExtensions {
Map<String, String> extensions = null;
public Map<String, String> getExtensionsToRead() {
if(extensions == null){
return Collections.emptyMap();
}
return extensions;
}
public Map<String, String> getExtensionsToWrite() {
if(extensions == null){
extensions = new LinkedHashMap<String, String>();
}
return extensions;
}
}
public static class WptPt extends GPXExtensions {
public double lat;
public double lon;
public String name = null;
public String desc = null;
// by default
public long time = 0;
public double ele = Double.NaN;
public double speed = 0;
public double hdop = Double.NaN;
}
public static class TrkSegment extends GPXExtensions {
public List<WptPt> points = new ArrayList<WptPt>();
}
public static class Track extends GPXExtensions {
public String name = null;
public String desc = null;
public List<TrkSegment> segments = new ArrayList<TrkSegment>();
}
public static class Route extends GPXExtensions {
public String name = null;
public String desc = null;
public List<WptPt> points = new ArrayList<WptPt>();
}
public static class GPXFile extends GPXExtensions {
public String author;
public List<Track> tracks = new ArrayList<Track>();
public List<WptPt> points = new ArrayList<WptPt>();
public List<Route> routes = new ArrayList<Route>();
public String warning = null;
public String path = "";
public boolean isCloudmadeRouteFile(){
return "cloudmade".equalsIgnoreCase(author);
}
public WptPt findPointToShow(){
for(Track t : tracks){
for(TrkSegment s : t.segments){
if(s.points.size() > 0){
return s.points.get(0);
}
}
}
for (Route s : routes) {
if (s.points.size() > 0) {
return s.points.get(0);
}
}
if (points.size() > 0) {
return points.get(0);
}
return null;
}
}
public static String writeGpxFile(File fout, GPXFile file, Context ctx) {
try {
SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT);
format.setTimeZone(TimeZone.getTimeZone("UTC"));
FileOutputStream output = new FileOutputStream(fout);
XmlSerializer serializer = Xml.newSerializer();
serializer.setOutput(output, "UTF-8"); //$NON-NLS-1$
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); //$NON-NLS-1$
serializer.startDocument("UTF-8", true); //$NON-NLS-1$
serializer.startTag(null, "gpx"); //$NON-NLS-1$
serializer.attribute(null, "version", "1.1"); //$NON-NLS-1$ //$NON-NLS-2$
if(file.author == null ){
serializer.attribute(null, "creator", Version.APP_NAME_VERSION); //$NON-NLS-1$
} else {
serializer.attribute(null, "creator", file.author); //$NON-NLS-1$
}
serializer.attribute(null, "xmlns", "http://www.topografix.com/GPX/1/1"); //$NON-NLS-1$ //$NON-NLS-2$
serializer.attribute(null, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
serializer.attribute(null, "xsi:schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd");
for (Track track : file.tracks) {
serializer.startTag(null, "trk"); //$NON-NLS-1$
writeNotNullText(serializer, "name", track.name);
writeNotNullText(serializer, "desc", track.desc);
for (TrkSegment segment : track.segments) {
serializer.startTag(null, "trkseg"); //$NON-NLS-1$
for (WptPt p : segment.points) {
serializer.startTag(null, "trkpt"); //$NON-NLS-1$
writeWpt(format, serializer, p);
serializer.endTag(null, "trkpt"); //$NON-NLS-1$
}
serializer.endTag(null, "trkseg"); //$NON-NLS-1$
}
writeExtensions(serializer, track);
serializer.endTag(null, "trk"); //$NON-NLS-1$
}
for (Route track : file.routes) {
serializer.startTag(null, "rte"); //$NON-NLS-1$
writeNotNullText(serializer, "name", track.name);
writeNotNullText(serializer, "desc", track.desc);
for (WptPt p : track.points) {
serializer.startTag(null, "rtept"); //$NON-NLS-1$
writeWpt(format, serializer, p);
serializer.endTag(null, "rtept"); //$NON-NLS-1$
}
writeExtensions(serializer, track);
serializer.endTag(null, "rte"); //$NON-NLS-1$
}
for (WptPt l : file.points) {
serializer.startTag(null, "wpt"); //$NON-NLS-1$
writeWpt(format, serializer, l);
serializer.endTag(null, "wpt"); //$NON-NLS-1$
}
serializer.endTag(null, "gpx"); //$NON-NLS-1$
serializer.flush();
serializer.endDocument();
} catch (RuntimeException e) {
log.error("Error saving gpx", e); //$NON-NLS-1$
return ctx.getString(R.string.error_occurred_saving_gpx);
} catch (IOException e) {
log.error("Error saving gpx", e); //$NON-NLS-1$
return ctx.getString(R.string.error_occurred_saving_gpx);
}
return null;
}
private static void writeNotNullText(XmlSerializer serializer, String tag, String value) throws IOException {
if(value != null){
serializer.startTag(null, tag);
serializer.text(value);
serializer.endTag(null, tag);
}
}
private static void writeExtensions(XmlSerializer serializer, GPXExtensions p) throws IOException {
if (!p.getExtensionsToRead().isEmpty()) {
serializer.startTag(null, "extensions");
for (Map.Entry<String, String> s : p.getExtensionsToRead().entrySet()) {
writeNotNullText(serializer, s.getKey(), s.getValue());
}
serializer.endTag(null, "extensions");
}
}
private static void writeWpt(SimpleDateFormat format, XmlSerializer serializer, WptPt p) throws IOException {
serializer.attribute(null, "lat", latLonFormat.format(p.lat)); //$NON-NLS-1$ //$NON-NLS-2$
serializer.attribute(null, "lon", latLonFormat.format(p.lon)); //$NON-NLS-1$ //$NON-NLS-2$
if(!Double.isNaN(p.ele)){
writeNotNullText(serializer, "ele", p.ele+"");
}
writeNotNullText(serializer, "name", p.name);
writeNotNullText(serializer, "desc", p.desc);
if(!Double.isNaN(p.hdop)){
writeNotNullText(serializer, "hdop", p.hdop+"");
}
if(p.time != 0){
writeNotNullText(serializer, "time", format.format(new Date(p.time)));
}
if (p.speed > 0) {
p.getExtensionsToWrite().put("speed", p.speed+"");
}
writeExtensions(serializer, p);
}
public static class GPXFileResult {
public ArrayList<List<Location>> locations = new ArrayList<List<Location>>();
public ArrayList<WptPt> wayPoints = new ArrayList<WptPt>();
// special case for cloudmate gpx : they discourage common schema
// by using waypoint as track points and rtept are not very close to real way
// such as wpt. However they provide additional information into gpx.
public boolean cloudMadeFile;
public String error;
public Location findFistLocation(){
for(List<Location> l : locations){
for(Location ls : l){
if(ls != null){
return ls;
}
}
}
return null;
}
}
private static String readText(XmlPullParser parser, String key) throws XmlPullParserException, IOException {
int tok;
String text = null;
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
if(tok == XmlPullParser.END_TAG && parser.getName().equals(key)){
break;
} else if(tok == XmlPullParser.TEXT){
if(text == null){
text = parser.getText();
} else {
text += parser.getText();
}
}
}
return text;
}
public static GPXFile loadGPXFile(Context ctx, File f, boolean convertCloudmadeSource) {
try {
GPXFile file = loadGPXFile(ctx, new FileInputStream(f), convertCloudmadeSource);
file.path = f.getAbsolutePath();
return file;
} catch (FileNotFoundException e) {
GPXFile res = new GPXFile();
res.path = f.getAbsolutePath();
log.error("Error reading gpx", e); //$NON-NLS-1$
res.warning = ctx.getString(R.string.error_reading_gpx);
return res;
}
}
public static GPXFile loadGPXFile(Context ctx, InputStream f, boolean convertCloudmadeSource) {
GPXFile res = new GPXFile();
SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT);
format.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
XmlPullParser parser = Xml.newPullParser();
parser.setInput(f, "UTF-8"); //$NON-NLS-1$
Stack<Object> parserState = new Stack<Object>();
boolean extensionReadMode = false;
parserState.push(res);
int tok;
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
if (tok == XmlPullParser.START_TAG) {
Object parse = parserState.peek();
String tag = parser.getName();
if (extensionReadMode && parse instanceof GPXExtensions) {
String value = readText(parser, tag);
if (value != null) {
((GPXExtensions) parse).getExtensionsToWrite().put(tag, value);
if (tag.equals("speed") && parse instanceof WptPt) {
try {
((WptPt) parse).speed = Float.parseFloat(value);
} catch (NumberFormatException e) {
}
}
}
} else if (parse instanceof GPXExtensions && tag.equals("extensions")) {
extensionReadMode = true;
} else {
if (parse instanceof GPXFile) {
if (parser.getName().equals("gpx")) {
((GPXFile) parse).author = parser.getAttributeValue("", "creator");
}
if (parser.getName().equals("trk")) {
Track track = new Track();
((GPXFile) parse).tracks.add(track);
parserState.push(track);
}
if (parser.getName().equals("rte")) {
Route route = new Route();
((GPXFile) parse).routes.add(route);
parserState.push(route);
}
if (parser.getName().equals("wpt")) {
WptPt wptPt = parseWptAttributes(parser);
((GPXFile) parse).points.add(wptPt);
parserState.push(wptPt);
}
} else if (parse instanceof Route) {
if (parser.getName().equals("name")) {
((Route) parse).name = readText(parser, "name");
}
if (parser.getName().equals("desc")) {
((Route) parse).desc = readText(parser, "desc");
}
if (parser.getName().equals("rtept")) {
WptPt wptPt = parseWptAttributes(parser);
((Route) parse).points.add(wptPt);
parserState.push(wptPt);
}
} else if (parse instanceof Track) {
if (parser.getName().equals("name")) {
((Track) parse).name = readText(parser, "name");
}
if (parser.getName().equals("desc")) {
((Track) parse).desc = readText(parser, "desc");
}
if (parser.getName().equals("trkseg")) {
TrkSegment trkSeg = new TrkSegment();
((Track) parse).segments.add(trkSeg);
parserState.push(trkSeg);
}
} else if (parse instanceof TrkSegment) {
if (parser.getName().equals("trkpt")) {
WptPt wptPt = parseWptAttributes(parser);
((TrkSegment) parse).points.add(wptPt);
parserState.push(wptPt);
}
// main object to parse
} else if (parse instanceof WptPt) {
if (parser.getName().equals("name")) {
((WptPt) parse).name = readText(parser, "name");
} else if (parser.getName().equals("desc")) {
((WptPt) parse).desc = readText(parser, "desc");
} else if (parser.getName().equals("ele")) {
String text = readText(parser, "ele");
if (text != null) {
try {
((WptPt) parse).ele = Float.parseFloat(text);
} catch (NumberFormatException e) {
}
}
} else if (parser.getName().equals("hdop")) {
String text = readText(parser, "hdop");
if (text != null) {
try {
((WptPt) parse).hdop = Float.parseFloat(text);
} catch (NumberFormatException e) {
}
}
} else if (parser.getName().equals("time")) {
String text = readText(parser, "time");
if (text != null) {
try {
((WptPt) parse).time = format.parse(text).getTime();
} catch (ParseException e) {
}
}
}
}
}
} else if (tok == XmlPullParser.END_TAG) {
Object parse = parserState.peek();
String tag = parser.getName();
if (parse instanceof GPXExtensions && tag.equals("extensions")) {
extensionReadMode = false;
}
if(tag.equals("trkpt")){
Object pop = parserState.pop();
assert pop instanceof WptPt;
} else if(tag.equals("wpt")){
Object pop = parserState.pop();
assert pop instanceof WptPt;
} else if(tag.equals("rtept")){
Object pop = parserState.pop();
assert pop instanceof WptPt;
} else if(tag.equals("trk")){
Object pop = parserState.pop();
assert pop instanceof Track;
} else if(tag.equals("rte")){
Object pop = parserState.pop();
assert pop instanceof Route;
} else if(tag.equals("trkseg")){
Object pop = parserState.pop();
assert pop instanceof TrkSegment;
}
}
}
if(convertCloudmadeSource && res.isCloudmadeRouteFile()){
Track tk = new Track();
res.tracks.add(tk);
TrkSegment segment = new TrkSegment();
tk.segments.add(segment);
for(WptPt wp : res.points){
segment.points.add(wp);
}
res.points.clear();
}
} catch (XmlPullParserException e) {
log.error("Error reading gpx", e); //$NON-NLS-1$
res.warning = ctx.getString(R.string.error_reading_gpx);
} catch (IOException e) {
log.error("Error reading gpx", e); //$NON-NLS-1$
res.warning = ctx.getString(R.string.error_reading_gpx);
}
return res;
}
private static WptPt parseWptAttributes(XmlPullParser parser) {
WptPt wpt = new WptPt();
try {
wpt.lat = Double.parseDouble(parser.getAttributeValue("", "lat")); //$NON-NLS-1$ //$NON-NLS-2$
wpt.lon = Double.parseDouble(parser.getAttributeValue("", "lon")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (NumberFormatException e) {
}
return wpt;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
97639ce9b62adfd2ca4dadda597592308f99daf1 | 288ed6d8c81cacc98b60492461321428f8d0b1e7 | /src/main/java/com/gymMS/serviceImp/PermissionServiceImp.java | aa754d54ae579d9e97f30ebe2f46e9e9e5b12aa2 | [] | no_license | JingJianQiang/gymMS | 5ea0aded9c8a2e90efd95b62ce7997b39c260069 | e8a0545d66266372bc36c18424de86d60bae3b34 | refs/heads/master | 2023-08-15T09:15:13.177982 | 2020-01-13T08:28:55 | 2020-01-13T08:28:55 | 192,487,583 | 1 | 1 | null | 2023-07-22T08:38:59 | 2019-06-18T07:21:31 | Java | UTF-8 | Java | false | false | 1,797 | java | package com.gymMS.serviceImp;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gymMS.dao.PermissionMapper;
import com.gymMS.dao.RolePermissionMapper;
import com.gymMS.pojo.Permission;
import com.gymMS.pojo.Role;
import com.gymMS.pojo.RolePermission;
import com.gymMS.service.PermissionService;
import com.gymMS.service.RoleService;
@Service
public class PermissionServiceImp implements PermissionService{
@Autowired PermissionMapper permissionMapper;
@Autowired RolePermissionMapper rolePermissionMapper;
@Autowired RoleService roleService;
@Override
public List<Permission> list() {
List<Permission> permission=permissionMapper.findAll();
return permission;
}
@Override
public Permission getPermissiom(int permission_id) {
Permission permission=permissionMapper.getPermissionById(permission_id);
return permission;
}
@Override
public int getPermissionId(String permission_name) {
int permissionId=permissionMapper.getIdByName(permission_name);
return permissionId;
}
@Override
public void addPermission(Permission permission) {
permissionMapper.addPermission(permission);
}
@Override
public void changeDescription(Permission permission) {
permissionMapper.changePermission(permission);
}
// 根据role 查permission
@Override
public List<String> list(Role role) {
List<String> result = new ArrayList<>();
List<RolePermission> rps = rolePermissionMapper.findPermission(role.getRole_id());//根据角色id查role_permission表
for (RolePermission rolePermission : rps) {
result.add(permissionMapper.getNameById(rolePermission.getPermission_id()));//根据permission_id查name存入list
}
return result;
}
}
| [
"Jing_jq@163.com"
] | Jing_jq@163.com |
e2358dfd9e72b35e89871bb6ac218da4b578f6d8 | 153aeb822c4c6050263bc47fa7cb91a83175452d | /src/main/java/ex28/App.java | 9bad70a652d5ab4e40c1b4abadcee1e2844399fb | [] | no_license | SeanMcCorma/McCormack-cop3330-assignment2 | 4d6cb535f5a1bc038f6fb2ec87adf9337f82fe52 | 162716424269ac5dc0981bcc32d09705adbd1a13 | refs/heads/master | 2023-08-19T11:34:59.014400 | 2021-09-27T03:55:50 | 2021-09-27T03:55:50 | 410,734,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 566 | java | package ex28;
import java.util.Scanner;
/*
* UCF COP3330 Fall 2021 Assignment 2 Solution
* Copyright 2021 Sean McCormack
*/
public class App {
public static void main (String [] args){
int total=adding();
System.out.println("The total is "+total);
}
public static int adding(){
int total = 0;
Scanner scan = new Scanner(System.in);
for(int x = 1; x <= 5;x++){
System.out.print("Enter a number: ");
total += Integer.parseInt(scan.nextLine());
}
return total;
}
}
| [
"55803970+Seanfrogs@users.noreply.github.com"
] | 55803970+Seanfrogs@users.noreply.github.com |
09ddb592877592163a4ad894a8f7a103132d1e9f | 6aba528865a7489af7a90a875a23fb3be17a4662 | /app/src/main/java/com/example/potigianhh/fragments/decorators/RequestMarginDecorator.java | fb53f071b842e276d983d26dacaa4b9053b431d4 | [] | no_license | gonzalezgustavo/potigianhh | 78fdd1e66fb3b7aa8a68795aae83c45078d6516b | 1873209a4dccef22d0c022eb5cecca0cbc623092 | refs/heads/master | 2021-02-13T12:34:43.644914 | 2020-02-28T23:39:09 | 2020-02-28T23:39:09 | 244,696,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | package com.example.potigianhh.fragments.decorators;
import android.graphics.Rect;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class RequestMarginDecorator extends RecyclerView.ItemDecoration {
private int spaceBetween;
public RequestMarginDecorator(int spaceBetween) {
this.spaceBetween = spaceBetween;
}
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
RecyclerView parent, @NonNull RecyclerView.State state) {
if (parent.getChildAdapterPosition(view) == 0) {
outRect.top = spaceBetween;
}
outRect.bottom = spaceBetween;
outRect.left = 0;
outRect.right = 0;
}
}
| [
"fmbesteiro@gmail.com"
] | fmbesteiro@gmail.com |
047e4a2ba75908dc0c859b84af54edceb618b778 | 96f8d42c474f8dd42ecc6811b6e555363f168d3e | /zuiyou/sources/com/meizu/cloud/pushsdk/networking/core/MainThreadExecutor.java | f7d5f04f0753efd7bbb6b9d3ccd260f65294b324 | [] | 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 | 360 | java | package com.meizu.cloud.pushsdk.networking.core;
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.Executor;
public class MainThreadExecutor implements Executor {
private final Handler handler = new Handler(Looper.getMainLooper());
public void execute(Runnable runnable) {
this.handler.post(runnable);
}
}
| [
"aheadlcxzhang@gmail.com"
] | aheadlcxzhang@gmail.com |
fc38f745d0370fb6ed95cabb012db506ae0f3e51 | 93aa900895de3d403f88e4b5dcc53229562e394e | /src/main/java/com/ferdev/aop/dtd/throwadvice/ThrowAdviceContoh.java | 459f62e2967f5d399195ba7c817c905172dedb65 | [] | no_license | feriwnarta/spring-aop-aspectj | f8643cea87bc3467a9a1153bb4ca19c78ebe1297 | 5a14cf62f79d69ba19c6bb31007b8678095e772b | refs/heads/main | 2023-08-27T15:31:34.635227 | 2021-11-03T10:14:21 | 2021-11-03T10:14:21 | 424,175,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.ferdev.aop.dtd.throwadvice;
import org.springframework.aop.ThrowsAdvice;
public class ThrowAdviceContoh implements ThrowsAdvice {
// nama method harus sama
public void afterThrowing(Exception ex){
System.out.println("additional concern if exception occurs");
System.out.println("error handling dari after throwing advice");
ex.printStackTrace();
}
}
| [
"feriwnarta26@gmail.com"
] | feriwnarta26@gmail.com |
9a20d8c3457ea469f5dc816131e99b346ef3f164 | 56fa6b8f4092a9b72c0517cb1e29b0187df25e07 | /BOOTCXFDemo/src/main/java/com/ekaplus/dataobject/integration/storagelocationdetail/MessageInformationType.java | 736c8969feb88b46010831a01d91ed529d8b4dd1 | [] | no_license | springprjects/boot | 5b69dca8f76b3ee65d3c776686e15913837ba292 | c5d40cf4d868d12d2536b6b099d221f2bfdfae72 | refs/heads/master | 2021-06-15T12:25:49.395187 | 2020-03-03T11:13:03 | 2020-03-03T11:13:03 | 197,339,794 | 1 | 0 | null | 2021-06-03T19:42:35 | 2019-07-17T07:38:09 | Java | UTF-8 | Java | false | false | 5,659 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
// 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: 2018.10.05 at 03:10:32 PM IST
//
package com.ekaplus.dataobject.integration.storagelocationdetail;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <p>Java class for MessageInformationType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="MessageInformationType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="MsgSourceSystem">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MsgEnvironment">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MsgType">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MsgTransmissionNo">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="100"/>
* </restriction>
* </simpleType>
* </element>
* <element name="MsgCreated" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MessageInformationType", propOrder = {
"msgSourceSystem",
"msgEnvironment",
"msgType",
"msgTransmissionNo",
"msgCreated"
})
public class MessageInformationType {
@XmlElement(name = "MsgSourceSystem", required = true)
protected String msgSourceSystem;
@XmlElement(name = "MsgEnvironment", required = true)
protected String msgEnvironment;
@XmlElement(name = "MsgType", required = true)
protected String msgType;
@XmlElement(name = "MsgTransmissionNo", required = true)
protected String msgTransmissionNo;
@XmlElement(name = "MsgCreated", required = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar msgCreated;
/**
* Gets the value of the msgSourceSystem property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMsgSourceSystem() {
return msgSourceSystem;
}
/**
* Sets the value of the msgSourceSystem property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsgSourceSystem(String value) {
this.msgSourceSystem = value;
}
/**
* Gets the value of the msgEnvironment property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMsgEnvironment() {
return msgEnvironment;
}
/**
* Sets the value of the msgEnvironment property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsgEnvironment(String value) {
this.msgEnvironment = value;
}
/**
* Gets the value of the msgType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMsgType() {
return msgType;
}
/**
* Sets the value of the msgType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsgType(String value) {
this.msgType = value;
}
/**
* Gets the value of the msgTransmissionNo property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMsgTransmissionNo() {
return msgTransmissionNo;
}
/**
* Sets the value of the msgTransmissionNo property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsgTransmissionNo(String value) {
this.msgTransmissionNo = value;
}
/**
* Gets the value of the msgCreated property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getMsgCreated() {
return msgCreated;
}
/**
* Sets the value of the msgCreated property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setMsgCreated(XMLGregorianCalendar value) {
this.msgCreated = value;
}
}
| [
"khuthbu123@gmail.com"
] | khuthbu123@gmail.com |
7a37373ef88ef85cfa534a92802254b68daa9ff4 | cbcdee754dcc98003036afe49a4ca4ede1b48996 | /OODP/21700034_YeongHye_Kwak/Banking.java | cb1ca6721f4d7390fca93e458979979e08bd73d9 | [] | no_license | jasonpeterwayne/2020_1_S7 | ade57e0bfbd572ae3ad8a963dee229705b024110 | a1709df81a56310cc57314720955ed42d7e7ebf1 | refs/heads/master | 2022-12-15T22:22:45.246398 | 2020-08-24T01:30:00 | 2020-08-24T01:30:00 | 289,790,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | public interface Banking {
public void visit( FM1 e );
public int reValue( FM1 e );
public int reSValue( FM1 e );
public void visit( FM2 e );
public int reValue( FM2 e );
public int reSValue( FM2 e );
public void visit( FM3 e );
public int reValue( FM3 e );
public int reSValue( FM3 e );
public void visit( FM4 e );
public int reValue( FM4 e );
public int reSValue( FM4 e );
public void visit( FM5 e );
public int reValue( FM5 e );
public int reSValue( FM5 e );
public void visit( FM6 e );
public int reValue( FM6 e );
public int reSValue( FM6 e );
}
| [
"noreply@github.com"
] | noreply@github.com |
6d95a10664eda79364885b89b54a54b0eb53468f | a9f8d06516a9e3c3716f0209166db097cea94f26 | /Easy/TwoSum.java | 9500ffde379993d51afe655d6f1e49af17d66ddf | [] | no_license | cathy810218/Leetcode-Sol | b10e4ad58b6de1c2719adadc6799e35d487c9325 | 1232e1897703987668685fc68084774ad01cce0b | refs/heads/master | 2021-01-21T15:04:44.023091 | 2017-08-13T19:55:00 | 2017-08-13T19:55:00 | 59,377,617 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 975 | java | public class Solution {
public int[] twoSum(int[] nums, int target) {
int[] result = new int[2];
// Best way to do it is with hashmap -> containsKey: O(1)
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < nums.length; i++) {
int curr = nums[i];
int key = target - curr;
if (map.containsKey(key)) {
result[0] = map.get(key);
result[1] = i;
}
map.put(curr, i);
}
// //Time complexity O(N^2), Space O(1)
// for (int i = 0; i < nums.length; i++) {
// for (int j = i + 1; j < nums.length; j++) {
// int sum = nums[i] + nums[j];
// if (sum == target) {
// // add indexes to the array
// result[0] = i;
// result[1] = j;
// }
// }
// }
return result;
}
} | [
"cathy810218@gmail.com"
] | cathy810218@gmail.com |
1b424faaa661a9f9a223cfd5a22e7342d6937153 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project111/src/main/java/org/gradle/test/performance/largejavamultiproject/project111/p555/Production11109.java | 43efd704eeecfefa53a0e850df16da322096beeb | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,889 | java | package org.gradle.test.performance.largejavamultiproject.project111.p555;
public class Production11109 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
74a8a887a7be9261bf7e9a6909e74af6345a9785 | fefbc4a3d859a9ed6b339f45f5484b74cf1c0273 | /spring5webapp-jpa-entities/src/main/java/guru/springframework/spring5webapp/model/Author.java | 3de12577369366b6f98c2dd7a7c47756f9740317 | [] | no_license | anuragpkul/spring5sandbox | c09657fc23d1d6c47f79bb7bab74b8c8497246b7 | f11a5be699fec31e950521c5f0fe93f84611c08f | refs/heads/master | 2020-04-09T03:12:22.488903 | 2018-12-04T01:22:10 | 2018-12-04T01:22:10 | 159,973,626 | 0 | 0 | null | 2018-12-03T01:44:16 | 2018-12-01T18:14:51 | Java | UTF-8 | Java | false | false | 1,855 | java | package guru.springframework.spring5webapp.model;
import javax.annotation.Generated;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@Entity
public class Author {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String firstName;
private String lastName;
@ManyToMany(mappedBy = "authors")
private Set<Book> books = new HashSet();
public Author() {
}
public Author(String firstName) {
this.firstName = firstName;
}
public Author(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Set<Book> getBooks() {
return books;
}
public void setBooks(Set<Book> books) {
this.books = books;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Author author = (Author) o;
return Objects.equals(id, author.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public String toString() {
return "Author{" +
"id=" + id +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", books=" + books +
'}';
}
}
| [
"anurag.p.kul@gmail.com"
] | anurag.p.kul@gmail.com |
9741a5cbd2323f9363a7b2d0a32a87c707fd66c3 | 2ac01908cb7d74b53cc2714c3a1554fc46393480 | /himsi/src/main/java/com/himsi/dao/IuranBulananDao.java | 68b5a86dc82e490f5da4ceef4c11a1ab80fcb828 | [] | no_license | iss14036/himsi | 1479479b53e48da61b99e2dd5919f1892c2aa316 | 4171ec7751f1d6b373d19f6b55ac8f844fc7e8d4 | refs/heads/master | 2020-03-25T11:19:04.421345 | 2018-08-06T12:48:17 | 2018-08-06T12:48:17 | 143,727,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,400 | java | package com.himsi.dao;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.himsi.models.LaporanKeuangan;
import com.himsi.models.IuranBulanan;
import com.himsi.models.User;
import com.himsi.services.IuranBulananService;
import com.himsi.services.UserService;
@Service
public class IuranBulananDao implements IuranBulananService {
private EntityManagerFactory emf;
private UserService userService;
public UserService getUserService() {
return userService;
}
@Autowired
public void setUserService(UserService userService) {
this.userService = userService;
}
@Override
public IuranBulanan saveOrUpdate(IuranBulanan iuranBulanan) {
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
IuranBulanan saved = em.merge(iuranBulanan);
em.getTransaction().commit();
return saved;
}
@Override
public List<IuranBulanan> getAllIuranBulanan() {
EntityManager em = emf.createEntityManager();
return em.createQuery("from IuranBulanan", IuranBulanan.class).getResultList();
}
@Override
public List<IuranBulanan> getAllById(int id) {
EntityManager em = emf.createEntityManager();
return em.createQuery("from IuranBulanan where id="+id, IuranBulanan.class).getResultList();
}
public EntityManagerFactory getEmf() {
return emf;
}
@Autowired
public void setEmf(EntityManagerFactory emf) {
this.emf = emf;
}
@Override
public void createAllPembayaran(IuranBulanan transaki, String bulan) {
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
List<User> users = userService.getAllUser();
for(int i=0; i<users.size(); i++){
transaki.setStatus("Belum Bayar");
transaki.setTotal_bayar(3000);
transaki.setTanggal_pembayaran("none");
transaki.setUser(users.get(i));
transaki.setBulan_iuran(bulan);
em.merge(transaki);
}
em.getTransaction().commit();
}
@Override
public List<IuranBulanan> getAllByLaporan(LaporanKeuangan lKeuangan) {
EntityManager em = emf.createEntityManager();
return em.createQuery("from IuranBulanan where laporanKeuangan="+lKeuangan.getId(), IuranBulanan.class).getResultList();
}
@Override
public IuranBulanan getIuranBulananById(int id) {
EntityManager em = emf.createEntityManager();
return em.find(IuranBulanan.class, id);
}
@Override
public int getMahasiswaBlmBayar(LaporanKeuangan lKeuangan) {
List<IuranBulanan> IuranBulanans = getAllByLaporan(lKeuangan);
int total = 0;
for(IuranBulanan IuranBulanan : IuranBulanans){
if(IuranBulanan.getStatus().equalsIgnoreCase("Belum Bayar")) total++;
}
return total;
}
@Override
public int getMahasiswaSdhBayar(LaporanKeuangan lKeuangan) {
List<IuranBulanan> IuranBulanans = getAllByLaporan(lKeuangan);
int total = 0;
for(IuranBulanan IuranBulanan : IuranBulanans){
if(IuranBulanan.getStatus().equalsIgnoreCase("Sudah Lunas")) total++;
}
return total;
}
@Override
public List<IuranBulanan> getAllByIdUser(int id) {
EntityManager em = emf.createEntityManager();
return em.createQuery("from IuranBulanan where user="+id, IuranBulanan.class).getResultList();
}
}
| [
"nielsinz123@gmail.com"
] | nielsinz123@gmail.com |
8d168f213d0a951072c8d191123a660f2e1bebf3 | 8d94740aebd15045a7077c19c21d708da59a325c | /app/src/main/java/top/totoro/linkcollection/android/util/FindView.java | 3d336c9a1beab92f70f8b2d108bf79e1fece0e87 | [] | no_license | totoro-dev/LinkCollectionForAndroid | 82aefb05fa920530a5c62a5ded9fc8c87f81d500 | ca0b619f45dba13968efcdd44f79ed23dd01bfc0 | refs/heads/master | 2021-01-05T22:10:56.636724 | 2020-03-08T04:48:23 | 2020-03-08T04:48:23 | 241,150,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,375 | java | package top.totoro.linkcollection.android.util;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
/**
* 通过该类获取对应类型的视图元素
* Create by HLM on 2020-01-15
*/
public class FindView {
private View parent;
public FindView(View parent) {
this.parent = parent;
}
private View findView(int id) {
View view = parent.findViewById(id);
if (view == null)
throw new RuntimeException("findView(int id): 当前界面不存在资源ID为" + id + "的视图元素。");
return view;
}
public RelativeLayout RelativeLayout(int id) {
View view = findView(id);
if (view instanceof RelativeLayout) return (RelativeLayout) view;
else
throw new RuntimeException("findRelativeLayout(int id): 资源ID为" + id + "的视图无法转换成RelativeLayout");
}
public LinearLayout LinearLayout(int id) {
View view = findView(id);
if (view instanceof LinearLayout) return (LinearLayout) view;
else
throw new RuntimeException("findLinearLayout(int id): 资源ID为" + id + "的视图无法转换成LinearLayout");
}
public TextView TextView(int id) {
View view = findView(id);
if (view instanceof TextView) return (TextView) view;
else
throw new RuntimeException("findTextView(int id): 资源ID为" + id + "的视图无法转换成TextView");
}
public RadioButton RadioButton(int id) {
View view = findView(id);
if (view instanceof RadioButton) return (RadioButton) view;
else
throw new RuntimeException("findRadioButton(int id): 资源ID为" + id + "的视图无法转换成RadioButton");
}
public EditText EditText(int id) {
View view = findView(id);
if (view instanceof EditText) return (EditText) view;
else
throw new RuntimeException("findEditText(int id): 资源ID为" + id + "的视图无法转换成EditText");
}
public ImageView ImageView(int id) {
View view = findView(id);
if (view instanceof ImageView) return (ImageView) view;
else
throw new RuntimeException("findImageView(int id): 资源ID为" + id + "的视图无法转换成ImageView");
}
public ImageButton ImageButton(int id) {
View view = findView(id);
if (view instanceof ImageButton) return (ImageButton) view;
else
throw new RuntimeException("findImageButton(int id): 资源ID为" + id + "的视图无法转换成ImageButton");
}
public Button Button(int id) {
View view = findView(id);
if (view instanceof Button) return (Button) view;
else
throw new RuntimeException("findButton(int id): 资源ID为" + id + "的视图无法转换成Button");
}
public <T> T View(Class<T> clazz, int id) {
View view = findView(id);
if (view != null) {
return (T) view;
} else
throw new RuntimeException("findButton(int id): 资源ID为" + id + "的视图无法转换成Button");
}
}
| [
"2844150336@qq.com"
] | 2844150336@qq.com |
7d407ddeaa0836ecccb91a04c21d402b95b95a90 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_51d23fa4fd50456b37047ec81bfc0133eb71c047/WeatherAPI/2_51d23fa4fd50456b37047ec81bfc0133eb71c047_WeatherAPI_t.java | a45c1ee43d4652cb5da1b7b9a40509a77476d339 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 4,572 | java | // Copyright 2012 John Luetke
//
// 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 WeatherAPI;
import WeatherAPI.Providers.LocationSource;
import WeatherAPI.Providers.WeatherProvider;
import java.util.ArrayList;
import java.util.List;
import org.reflections.Reflections;
/**
* Gateway class to the WeatherAPI.
*/
public class WeatherAPI {
private static final WeatherAPI INSTANCE = new WeatherAPI();
/**
* Gets the weather for the given city and state.
*
* @param city City name for which weather information should be retrieved
* @param state State name for which weather information should be retrieved
*
* @return A class adhereing to IWeather which will contain weather data for
* the requested location
*/
public static IWeather getWeather(String city, String state) {
return WeatherAPI.getInstance(LocationSource.CityState, String.format("%s, %s", city, state));
}
/**
* Gets the weather for the given airport code
*
* @param airportCode The Airport code for which weather information should be retrieved.
*
* @return A class adhereing to IWeather which will contain weather data for
* the requested location
*/
public static IWeather getWeather(String airportCode) {
return WeatherAPI.getInstance(LocationSource.AirportCode, airportCode);
}
/**
* Gets the weather for the given ZIP code
*
* @param zipCode The ZIP code for which weather information should be retrieved.
*
* @return A class adhereing to IWeather which will contain weather data for
* the requested location
*/
public static IWeather getWeather(int zipCode) {
return WeatherAPI.getInstance(LocationSource.ZipCode, String.format("%s", zipCode));
}
/**
* Gets the weather for the given latitude and longitude
*
* @param latitude The latitude coordinate for which weather information should be
* @param longitude The longitude coordinate for which weather information should be retrieved.
*
* @return A class adhereing to IWeather which will contain weather data for
* the requested location
*/
public static IWeather getWeather(double latitude, double longitude) {
return WeatherAPI.getInstance(LocationSource.LatitudeLongitude, String.format("%s,%s", latitude, longitude));
}
private List<WeatherProvider> _providers;
/**
* Initializes a new instance of the WeatherAPI class. All providers
* discovered via reflection and added to a List for use in
* getInstance
*/
private WeatherAPI() {
_providers = new ArrayList<WeatherProvider>();
Reflections reflections = new Reflections("WeatherAPI.Providers");
try {
for (Class clazz : reflections.getSubTypesOf(WeatherProvider.class)) {
_providers.add((WeatherProvider)clazz.newInstance());
}
}
catch (InstantiationException e) {
e.printStackTrace(System.err);
}
catch (IllegalAccessException e) {
e.printStackTrace(System.err);
}
}
/**
* Factory method for obtaining an instance of a provider
*
* @param sourceType Type of location that weather data will be retrieved from.
* @param source The string value of the source to give to the provider.
*
* @returns An instance of IWeather containing weather data from the provider.
*
* @throws ArgumentException when the provider cannot fetch weather data for the LocationSource provided.
*/
private static IWeather getInstance(LocationSource sourceType, String source) {
// Go through the available providers until we get one that can fulfill the request
for (WeatherProvider provider : INSTANCE._providers) {
if (provider.IsAvailable() && provider.Supports(sourceType)) {
provider.setLocation(source);
provider.setSource(sourceType);
provider.Update();
return (IWeather)provider;
}
}
// No providers can fullfill the request
throw new IllegalArgumentException(String.format("No available provider supports a %s source: %s", sourceType, source));
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
c79185dd06cbddbe5604c48d67dab6a193bf036d | 88db47635242a03008bad6b721765cbd746ecdad | /FileClient/FileClient/src/com/client/DefHandler.java | 20014004caffad41d9bc9ca6da4e3f8fec262d69 | [] | no_license | cjk3469/Filetransfer | 385754e83a7e331ee34f2843cd7da6f0b0c5ab1d | dd41f51d59d45324db205e6ca67c1eeb227015aa | refs/heads/master | 2023-04-15T02:48:13.787772 | 2021-05-08T06:57:05 | 2021-05-08T06:57:05 | 365,440,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,656 | java | package com.client;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.IOException;
import com.common.Protocol;
public class DefHandler implements ActionListener, WindowListener{
private DefaultView defView = null;
private ClientSocket client = null;
DefHandler(DefaultView defView,ClientSocket client){
this.defView = defView;
this.client = client;
}
@Override
public void actionPerformed(ActionEvent ae) {
Object obj = ae.getSource();
try {
if (obj.equals(defView.jbtn_chat)) {
client.send(Protocol.createRoomView, Protocol.myID);
}
// 로그아웃
else if (obj.equals(defView.jbtn_logout)) {
client.send(Protocol.logout, Protocol.myID);
System.exit(0);
}
} catch (Exception e) {
// TODO: handle exception
}
}
@Override
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent we) {
try {
client.send(Protocol.logout, Protocol.myID);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
}
| [
"edc3665@gmail.com"
] | edc3665@gmail.com |
27dd97c746a49e759b778ca3403aa0ddfdedd1cf | 3535a79f70c9652cc5c46f2f3b8d5415989c4e75 | /LeetCode/Arrays&String/Problem3.java | 3501aa83cfc922e7f10443c5da4e9c4851794bab | [] | no_license | nehaagarwal0719/DataStructures-Algorithms | 729c439edf00cd40a4ce11c6d2fe88b99cf52d53 | c4c247cd27e83bc5afa2c7f12b1a51af54fcc8ca | refs/heads/master | 2023-02-22T21:05:36.135426 | 2023-02-20T07:21:21 | 2023-02-20T07:21:21 | 237,877,740 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | class Solution {
public int pivotIndex(int[] nums) {
int sum = 0, leftsum = 0;
for (int x: nums) sum += x;
for (int i = 0; i < nums.length; ++i) {
if (leftsum == sum - leftsum - nums[i]) return i;
leftsum += nums[i];
}
return -1;
}
}
| [
"nehaagarwal0464@gmail.com"
] | nehaagarwal0464@gmail.com |
70925e234d82766377a81176d87f173f3a1b58a0 | ac87068568563953e940c20d7a804d08c8fe568c | /src/main/java/com/brunodles/annotationprocessorhelper/SupportedAnnotations.java | 19feea6532c5189f26cd437fa60666a2d305f667 | [
"MIT"
] | permissive | brunodles/AnnotationProcessorHelper | 680136a284ffcc133878b52b2beaee11398f5141 | a71bc6bc6ae17e40e648581e37f77e9d68e21cef | refs/heads/master | 2021-01-18T16:37:16.786302 | 2017-03-03T01:10:28 | 2017-03-03T01:10:28 | 73,465,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package com.brunodles.annotationprocessorhelper;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by bruno on 05/11/16.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface SupportedAnnotations {
Class<? extends Annotation>[] value();
}
| [
"dlimaun@gmail.com"
] | dlimaun@gmail.com |
c11545aee6d5ecc9920a525e89405a8334dda746 | 240ec0196c63dc76a378cf42a28b5c511d867b83 | /entity-manager/src/main/java/guru/zaidel/entity/manager/AuditServiceBean.java | 6144f23ffa269316d2f0409b30dd33846a75a794 | [] | no_license | teazaid/road-to-oce-jpa | 5b3e7803bc3373acfe7a3cda7b17e77f44f4fdd3 | b8f5abe27326dd089705ccfd69585b3cabffb81e | refs/heads/master | 2021-01-10T02:51:50.842517 | 2016-03-13T16:45:36 | 2016-03-13T16:45:36 | 50,282,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package guru.zaidel.entity.manager;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* Created by Alexander on 25.01.2016.
*/
@Stateless
public class AuditServiceBean implements AuditService {
@PersistenceContext
private EntityManager em;
@Override
public void logTransaction(int empId, String action) {
if(em.find(String.class, empId) == null) {
throw new IllegalArgumentException("");
}
}
}
| [
"boom_doom@mail.ru"
] | boom_doom@mail.ru |
0c691bcf496c5dcd3885f3c26d03a163686aec4c | 487550df09a3002a15d85d976c1f911accd018d5 | /src/main/java/testjavafound/net/mindview/util/CountingMapData.java | cae1ed33096b006227724d257853d383224d5b20 | [
"Apache-2.0"
] | permissive | knowNoEnd/javaFoundation | abaf283bfd6a403975d5c170a9ccfcac7fe5a30a | e32f2222e4069240afe22892694ca1acdd261ea6 | refs/heads/main | 2023-03-16T02:37:33.639694 | 2021-03-04T11:56:48 | 2021-03-04T11:56:48 | 336,143,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,862 | java | //: net/mindview/util/CountingMapData.java
// Unlimited-length Map containing sample data.
package main.java.testjavafound.net.mindview.util;
import java.util.*;
public class CountingMapData
extends AbstractMap<Integer,String> {
private int size;
private static String[] chars =
"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
.split(" ");
public CountingMapData(int size) {
if(size < 0) this.size = 0;
this.size = size;
}
private static class Entry
implements Map.Entry<Integer,String> {
int index;
Entry(int index) { this.index = index; }
public boolean equals(Object o) {
return Integer.valueOf(index).equals(o);
}
public Integer getKey() { return index; }
public String getValue() {
return
chars[index % chars.length] +
Integer.toString(index / chars.length);
}
public String setValue(String value) {
throw new UnsupportedOperationException();
}
public int hashCode() {
return Integer.valueOf(index).hashCode();
}
}
public Set<Map.Entry<Integer,String>> entrySet() {
// LinkedHashSet retains initialization order:
Set<Map.Entry<Integer,String>> entries =
new LinkedHashSet<Map.Entry<Integer,String>>();
for(int i = 0; i < size; i++)
entries.add(new Entry(i));
return entries;
}
public static void main(String[] args) {
System.out.println(new CountingMapData(60));
}
} /* Output:
{0=A0, 1=B0, 2=C0, 3=D0, 4=E0, 5=F0, 6=G0, 7=H0, 8=I0, 9=J0, 10=K0, 11=L0, 12=M0, 13=N0, 14=O0, 15=P0, 16=Q0, 17=R0, 18=S0, 19=T0, 20=U0, 21=V0, 22=W0, 23=X0, 24=Y0, 25=Z0, 26=A1, 27=B1, 28=C1, 29=D1, 30=E1, 31=F1, 32=G1, 33=H1, 34=I1, 35=J1, 36=K1, 37=L1, 38=M1, 39=N1, 40=O1, 41=P1, 42=Q1, 43=R1, 44=S1, 45=T1, 46=U1, 47=V1, 48=W1, 49=X1, 50=Y1, 51=Z1, 52=A2, 53=B2, 54=C2, 55=D2, 56=E2, 57=F2, 58=G2, 59=H2}
*///:~
| [
"mengfanxin@mengfanxin.com"
] | mengfanxin@mengfanxin.com |
5b85c5e6c7ca159c8d422e2f12a5d1613cabfd12 | b67413fec4de69b1a60ae981de3dae83f1d74598 | /app/src/main/java/com/sprocomm/ofoscenetest/utils/CoordinateUtil.java | 240fec561fb20c46c8e6f311b3f618112f51996f | [] | no_license | wujiabin17/ofoScenceTest | dd44017630e33a21f30c77086e306f261ae81701 | 630925797433002f8c0a1342859c2562b8aefb4c | refs/heads/master | 2021-01-19T15:16:17.724571 | 2017-08-22T01:16:12 | 2017-08-22T01:16:12 | 100,955,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,580 | java | package com.sprocomm.ofoscenetest.utils;
import com.amap.api.maps.model.LatLng;
/**
* Created by wujiabin on 2017/3/24.
*/
public class CoordinateUtil {
private static double a = 6378245.0;
private static double ee = 0.00669342162296594323;
/**
* 手机GPS坐标转火星坐标
*
* @param wgLoc
* @return
*/
public static LatLng transformFromWGSToGCJ(LatLng wgLoc) {
//如果在国外,则默认不进行转换
if (outOfChina(wgLoc.latitude, wgLoc.longitude)) {
return new LatLng(wgLoc.latitude, wgLoc.longitude);
}
double dLat = transformLat(wgLoc.longitude - 105.0,
wgLoc.latitude - 35.0);
double dLon = transformLon(wgLoc.longitude - 105.0,
wgLoc.latitude - 35.0);
double radLat = wgLoc.latitude / 180.0 * Math.PI;
double magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
double sqrtMagic = Math.sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * Math.PI);
dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * Math.PI);
return new LatLng(wgLoc.latitude + dLat, wgLoc.longitude + dLon);
}
public static double transformLat(double x, double y) {
double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y
+ 0.2 * Math.sqrt(x > 0 ? x : -x);
ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x
* Math.PI)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(y * Math.PI) + 40.0 * Math.sin(y / 3.0
* Math.PI)) * 2.0 / 3.0;
ret += (160.0 * Math.sin(y / 12.0 * Math.PI) + 320 * Math.sin(y
* Math.PI / 30.0)) * 2.0 / 3.0;
return ret;
}
public static double transformLon(double x, double y) {
double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1
* Math.sqrt(x > 0 ? x : -x);
ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x
* Math.PI)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(x * Math.PI) + 40.0 * Math.sin(x / 3.0
* Math.PI)) * 2.0 / 3.0;
ret += (150.0 * Math.sin(x / 12.0 * Math.PI) + 300.0 * Math.sin(x
/ 30.0 * Math.PI)) * 2.0 / 3.0;
return ret;
}
public static boolean outOfChina(double lat, double lon) {
if (lon < 72.004 || lon > 137.8347)
return true;
if (lat < 0.8293 || lat > 55.8271)
return true;
return false;
}
}
| [
"wujiabin1@hotmail.com"
] | wujiabin1@hotmail.com |
90ca9c02a5d7bd0d5d03673302a42843b2324c1e | e545d0d1a91f9c69738c2dcbb9d38faa3bdf9fbd | /zen-playground/src/test/java/com/bluexiii/zenscaffold/service/ProductServiceTest.java | 47128cb4f2cd5a2e4f153c87ed4741e5856bbb03 | [] | no_license | yangmain/zen-scaffold | f5997fbcb1ee9d4398976652c46014541124281f | e58401b6a2352f3fdc0c5e20cc9c884a76f8db9a | refs/heads/master | 2020-06-30T23:41:36.568605 | 2017-09-15T04:34:20 | 2017-09-15T04:34:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,672 | java | package com.bluexiii.zenscaffold.service;
import com.bluexiii.zenscaffold.domain.TdBProduct;
import com.bluexiii.zenscaffold.exception.ResourceNotFoundException;
import com.bluexiii.zenscaffold.repository.TdBProductRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
/**
* Created by bluexiii on 17/08/2017.
*/
@RunWith(SpringRunner.class)
public class ProductServiceTest {
@InjectMocks
private ProductService productService;
@MockBean
private TdBProductRepository tdBProductRepository;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
private TdBProduct mockDiscnt(Long productId) {
TdBProduct mock = new TdBProduct();
mock.setProductId(productId);
return mock;
}
@Test
public void getProductInfo() throws Exception {
Long productId = 99999830L;
given(tdBProductRepository.findOne(productId)).willReturn(mockDiscnt(productId));
TdBProduct productInfo = productService.getProductInfo(99999830L);
assertThat(productInfo.getProductId()).isEqualTo(productId);
}
@Test(expected = ResourceNotFoundException.class)
public void getProductInfoResourceNotFoundException() throws Exception {
Long productId = 1L;
productService.getProductInfo(99999830L);
}
} | [
"bluexiii@163.com"
] | bluexiii@163.com |
773d591f7daa9a04b62e561672cd6fa26d139283 | 20c0cb99f52d11c3f8781ee5d1cd6d5cb45ca61a | /src/main/java/com/icbc/dagger/hunter/checker/JcommonChecker.java | 1b4556cf7001b6e3ea5c40aa9bb1769c304004c4 | [] | no_license | herbageh3h/dagger | 96dd1ebf4f7fd28b27596f9afbbf0520b804a792 | fc563f0331b57c3e6e03e55d5203cdc50848147d | refs/heads/master | 2021-01-20T04:54:16.161091 | 2017-05-01T17:49:53 | 2017-05-01T17:49:53 | 89,748,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | package com.icbc.dagger.hunter.checker;
/**
* jcommon: A set of common utility libraries used inside Facebook java
* projects, internal and open source.
*
* @author kfzx-huanghao
* @since 20170426
*
*/
public class JcommonChecker extends NamePatternChecker {
public JcommonChecker() {
super("jcommon");
}
@Override
protected void setupPattern() {
this.setRegex(".*jcommon.*\\.jar$");
}
}
| [
"herbage_h2h@sina.com"
] | herbage_h2h@sina.com |
04d551d86f488cf5ee472c0a6c81e6a19aed3357 | 1248751e4a94429f76c86a9662d78f789b7b3dee | /src/com/wemall/foundation/domain/IntegralGoodsCart.java | 58d2aeac01c4bf0238a79c4ca137cb26faf24691 | [
"MIT"
] | permissive | mxzjzj/wemall | d5a0add32e51f4bea97c848ca9b3055a1e1c52a8 | eca2a02f6c5924c1a69cfd0a855d231f2a25bd0b | refs/heads/master | 2021-05-20T23:41:23.487224 | 2020-04-03T12:20:19 | 2020-04-03T12:20:19 | 252,455,577 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,681 | java | package com.wemall.foundation.domain;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import com.wemall.core.domain.IdEntity;
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Entity
@Table(name = "wemall_integral_goodscart")
public class IntegralGoodsCart extends IdEntity {
//商品
@ManyToOne(fetch = FetchType.LAZY)
private IntegralGoods goods;
//总数
private int count;
//订单
@ManyToOne(fetch = FetchType.LAZY, cascade = {javax.persistence.CascadeType.REMOVE})
private IntegralGoodsOrder order;
@Column(precision = 12, scale = 2)
private BigDecimal trans_fee;
private int integral;
public IntegralGoodsOrder getOrder() {
return this.order;
}
public void setOrder(IntegralGoodsOrder order) {
this.order = order;
}
public BigDecimal getTrans_fee() {
return this.trans_fee;
}
public void setTrans_fee(BigDecimal trans_fee) {
this.trans_fee = trans_fee;
}
public int getIntegral() {
return this.integral;
}
public void setIntegral(int integral) {
this.integral = integral;
}
public IntegralGoods getGoods() {
return this.goods;
}
public void setGoods(IntegralGoods goods) {
this.goods = goods;
}
public int getCount() {
return this.count;
}
public void setCount(int count) {
this.count = count;
}
}
| [
"297368592@qq.com"
] | 297368592@qq.com |
305d966725c27445cdb117f773b781ca0aaa522c | d985c4ae71d15ac67e8f107d419a288cbe183c69 | /src/main/java/io/github/hhui64/titlex/TItem/ShopChest.java | 76837d4ceb45f91576a032a96885da1ba1f34575 | [
"MIT"
] | permissive | hhui64/titlex | c9fb2b177a9305c0c88646188e16b4dbe842570e | 7bb63ffd93cc2c534ba94f8e15441ab4177f2243 | refs/heads/master | 2021-02-27T21:28:20.165290 | 2020-03-28T12:03:19 | 2020-03-28T12:03:19 | 245,636,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package io.github.hhui64.titlex.TItem;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
public class ShopChest extends Chest {
public ShopChest(String chestTitle, int chestSlot) {
super(chestTitle, chestSlot);
}
@Override
public void open(Player player) {
Inventory inventoryChest = Bukkit.createInventory(null, this.chestSlot, this.chestTitle);
player.openInventory(inventoryChest);
}
@Override
public void reset(Player player, Inventory inventoryChest) {
// TODO Auto-generated method stub
}
} | [
"907322015@qq.com"
] | 907322015@qq.com |
8b6d9c56195bb5f53041489a63a2ed6b955b73a3 | 345b595478c8c74c257c894ecc18c8ffa1126ccd | /zadaca4/src/main/java/hr/fer/apr/geneticalgorithm/reproductioner/HeuristicBinaryReproductioner.java | e094c6ffa917b7aa54178f4b9d64efe3e142ea21 | [] | no_license | stelagasi/APR | 60f6e519335c157c1da6028696a9e472b1aefcb6 | b19163e0477badb717e4eb53d0cd28ffaf0fe263 | refs/heads/master | 2023-02-16T11:49:12.043804 | 2021-01-09T21:19:58 | 2021-01-09T21:19:58 | 302,445,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | package hr.fer.apr.geneticalgorithm.reproductioner;
import hr.fer.apr.geneticalgorithm.individual.BinaryIndividual;
import java.util.ArrayList;
import java.util.List;
public class HeuristicBinaryReproductioner implements IReproductioner<BinaryIndividual> {
@Override
public BinaryIndividual reproduce(BinaryIndividual firstParent, BinaryIndividual secondParent) {
BinaryIndividual first = firstParent;
BinaryIndividual second = secondParent;
if (firstParent.getPenalty() > secondParent.getPenalty()) {
first = secondParent;
second = firstParent;
}
List<List<Boolean>> childChromosomes = new ArrayList<>();
for (int i = 0; i < firstParent.getChromosomes().size(); i++) {
List<Boolean> chromosome = new ArrayList<>();
childChromosomes.add(chromosome);
for (int j = 0; j < firstParent.getChromosomes().get(0).size(); j++) {
childChromosomes.get(i).add(Math.random() < 0.75 ? first.getChromosomes().get(i).get(j) : second.getChromosomes().get(i).get(j));
}
}
return new BinaryIndividual(childChromosomes);
}
@Override
public List<BinaryIndividual> reproduceMultiple(List<BinaryIndividual> parents) {
List<BinaryIndividual> children = new ArrayList<>();
for (int i = 0; i < parents.size(); i += 2) {
children.add(reproduce(parents.get(i), parents.get(i + 1)));
}
return children;
}
} | [
"sg50985@fer.hr"
] | sg50985@fer.hr |
e15b2990310d3b63996c1e54c5826532dcbcc1ab | 6fe207430803a17afac153d794057e7469201cdf | /src/main/java/org/json/JSONArray.java | 9772b2d73f89f508c9c902219c08baacb9686f91 | [
"Apache-2.0"
] | permissive | giosil/multi-rpc | 7daf6dfd0a9fde2c4fa992ec90b2aad672cd8e05 | 5b53ab2f63f1ff528a0f82172a7cc8bd21bd707c | refs/heads/master | 2022-11-05T23:18:54.137304 | 2022-10-13T08:18:45 | 2022-10-13T08:18:45 | 221,964,080 | 0 | 0 | Apache-2.0 | 2020-10-13T17:29:41 | 2019-11-15T16:37:13 | Java | UTF-8 | Java | false | false | 37,217 | java | package org.json;
/*
Copyright (c) 2002 JSON.org
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 shall be used for Good, not Evil.
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.
*/
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
/**
* A JSONArray is an ordered sequence of values. Its external text form is a
* string wrapped in square brackets with commas separating the values. The
* internal form is an object having <code>get</code> and <code>opt</code>
* methods for accessing the values by index, and <code>put</code> methods for
* adding or replacing values. The values can be any of these types:
* <code>Boolean</code>, <code>JSONArray</code>, <code>JSONObject</code>,
* <code>Number</code>, <code>String</code>, or the
* <code>JSONObject.NULL object</code>.
* <p>
* The constructor can convert a JSON text into a Java object. The
* <code>toString</code> method converts to JSON text.
* <p>
* A <code>get</code> method returns a value if one can be found, and throws an
* exception if one cannot be found. An <code>opt</code> method returns a
* default value instead of throwing an exception, and so is useful for
* obtaining optional values.
* <p>
* The generic <code>get()</code> and <code>opt()</code> methods return an
* object which you can cast or query for type. There are also typed
* <code>get</code> and <code>opt</code> methods that do type checking and type
* coercion for you.
* <p>
* The texts produced by the <code>toString</code> methods strictly conform to
* JSON syntax rules. The constructors are more forgiving in the texts they will
* accept:
* <ul>
* <li>An extra <code>,</code> <small>(comma)</small> may appear just
* before the closing bracket.</li>
* <li>The <code>null</code> value will be inserted when there is <code>,</code>
* <small>(comma)</small> elision.</li>
* <li>Strings may be quoted with <code>'</code> <small>(single
* quote)</small>.</li>
* <li>Strings do not need to be quoted at all if they do not begin with a quote
* or single quote, and if they do not contain leading or trailing spaces, and
* if they do not contain any of these characters:
* <code>{ } [ ] / \ : , #</code> and if they do not look like numbers and
* if they are not the reserved words <code>true</code>, <code>false</code>, or
* <code>null</code>.</li>
* </ul>
*
* @author JSON.org
* @version 2014-04-21
*/
@SuppressWarnings({"rawtypes","unchecked"})
public class JSONArray {
/**
* The arrayList where the JSONArray's properties are kept.
*/
private final ArrayList myArrayList;
/**
* Construct an empty JSONArray.
*/
public JSONArray() {
this.myArrayList = new ArrayList();
}
/**
* Construct a JSONArray from a JSONTokener.
*
* @param x
* A JSONTokener
* @throws JSONException
* If there is a syntax error.
*/
public JSONArray(JSONTokener x) throws JSONException {
this();
if(x.nextClean() != '[') {
throw x.syntaxError("A JSONArray text must start with '['");
}
if(x.nextClean() != ']') {
x.back();
for(;;) {
if(x.nextClean() == ',') {
x.back();
this.myArrayList.add(JSONObject.NULL);
} else {
x.back();
this.myArrayList.add(x.nextValue());
}
switch(x.nextClean()) {
case ',':
if(x.nextClean() == ']') {
return;
}
x.back();
break;
case ']':
return;
default:
throw x.syntaxError("Expected a ',' or ']'");
}
}
}
}
/**
* Construct a JSONArray from a source JSON text.
*
* @param source
* A string that begins with <code>[</code> <small>(left
* bracket)</small> and ends with <code>]</code>
* <small>(right bracket)</small>.
* @throws JSONException
* If there is a syntax error.
*/
public JSONArray(String source) throws JSONException {
this(new JSONTokener(source));
}
/**
* Construct a JSONArray from a Collection.
*
* @param collection
* A Collection.
*/
public JSONArray(Collection collection) {
this.myArrayList = new ArrayList();
if(collection != null) {
Iterator iter = collection.iterator();
while(iter.hasNext()) {
this.myArrayList.add(JSONObject.wrap(iter.next()));
}
}
}
/**
* Construct a JSONArray from an array
*
* @param array Values
* @throws JSONException
* If not an array.
*/
public JSONArray(Object array) throws JSONException {
this();
if(array.getClass().isArray()) {
int length = Array.getLength(array);
for(int i = 0; i < length; i += 1) {
this.put(JSONObject.wrap(Array.get(array, i)));
}
} else {
throw new JSONException(
"JSONArray initial value should be a string or collection or array.");
}
}
/**
* Get the object value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return An object value.
* @throws JSONException
* If there is no value for the index.
*/
public Object get(int index) throws JSONException {
Object object = this.opt(index);
if(object == null) {
throw new JSONException("JSONArray[" + index + "] not found.");
}
return object;
}
/**
* Get the boolean value associated with an index. The string values "true"
* and "false" are converted to boolean.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The truth.
* @throws JSONException
* If there is no value for the index or if the value is not
* convertible to boolean.
*/
public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if(object.equals(Boolean.FALSE)
||(object instanceof String &&((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if(object.equals(Boolean.TRUE)
||(object instanceof String &&((String) object)
.equalsIgnoreCase("true"))) {
return true;
}
throw new JSONException("JSONArray[" + index + "] is not a boolean.");
}
/**
* Get the double value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException
* If the key is not found or if the value cannot be converted
* to a number.
*/
public double getDouble(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ?((Number) object).doubleValue()
: Double.parseDouble((String) object);
} catch(Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
/**
* Get the int value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException
* If the key is not found or if the value is not a number.
*/
public int getInt(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ?((Number) object).intValue()
: Integer.parseInt((String) object);
} catch(Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
/**
* Get the JSONArray associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return A JSONArray value.
* @throws JSONException
* If there is no value for the index. or if the value is not a
* JSONArray
*/
public JSONArray getJSONArray(int index) throws JSONException {
Object object = this.get(index);
if(object instanceof JSONArray) {
return (JSONArray) object;
}
throw new JSONException("JSONArray[" + index + "] is not a JSONArray.");
}
/**
* Get the JSONObject associated with an index.
*
* @param index
* subscript
* @return A JSONObject value.
* @throws JSONException
* If there is no value for the index or if the value is not a
* JSONObject
*/
public JSONObject getJSONObject(int index) throws JSONException {
Object object = this.get(index);
if(object instanceof JSONObject) {
return (JSONObject) object;
}
throw new JSONException("JSONArray[" + index + "] is not a JSONObject.");
}
/**
* Get the long value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException
* If the key is not found or if the value cannot be converted
* to a number.
*/
public long getLong(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ?((Number) object).longValue()
: Long.parseLong((String) object);
} catch(Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
}
/**
* Get the string associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return A string value.
* @throws JSONException
* If there is no string value for the index.
*/
public String getString(int index) throws JSONException {
Object object = this.get(index);
if(object instanceof String) {
return (String) object;
}
throw new JSONException("JSONArray[" + index + "] not a string.");
}
/**
* Determine if the value is null.
*
* @param index
* The index must be between 0 and length() - 1.
* @return true if the value at the index is null, or if there is no value.
*/
public boolean isNull(int index) {
return JSONObject.NULL.equals(this.opt(index));
}
/**
* Make a string from the contents of this JSONArray. The
* <code>separator</code> string is inserted between each element. Warning:
* This method assumes that the data structure is acyclical.
*
* @param separator
* A string that will be inserted between the elements.
* @return a string.
* @throws JSONException
* If the array contains an invalid number.
*/
public String join(String separator) throws JSONException {
int len = this.length();
StringBuffer sb = new StringBuffer();
for(int i = 0; i < len; i += 1) {
if(i > 0) {
sb.append(separator);
}
sb.append(JSONObject.valueToString(this.myArrayList.get(i)));
}
return sb.toString();
}
/**
* Get the number of elements in the JSONArray, included nulls.
*
* @return The length (or size).
*/
public int length() {
return this.myArrayList.size();
}
/**
* Get the optional object value associated with an index.
*
* @param index
* The index must be between 0 and length() - 1.
* @return An object value, or null if there is no object at that index.
*/
public Object opt(int index) {
return (index < 0 || index >= this.length()) ? null : this.myArrayList
.get(index);
}
/**
* Get the optional boolean value associated with an index. It returns false
* if there is no value at that index, or if the value is not Boolean.TRUE
* or the String "true".
*
* @param index
* The index must be between 0 and length() - 1.
* @return The truth.
*/
public boolean optBoolean(int index) {
return this.optBoolean(index, false);
}
/**
* Get the optional boolean value associated with an index. It returns the
* defaultValue if there is no value at that index or if it is not a Boolean
* or the String "true" or "false" (case insensitive).
*
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* A boolean default.
* @return The truth.
*/
public boolean optBoolean(int index, boolean defaultValue) {
try {
return this.getBoolean(index);
} catch(Exception e) {
return defaultValue;
}
}
/**
* Get the optional double value associated with an index. NaN is returned
* if there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public double optDouble(int index) {
return this.optDouble(index, Double.NaN);
}
/**
* Get the optional double value associated with an index. The defaultValue
* is returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index
* subscript
* @param defaultValue
* The default value.
* @return The value.
*/
public double optDouble(int index, double defaultValue) {
try {
return this.getDouble(index);
} catch(Exception e) {
return defaultValue;
}
}
/**
* Get the optional int value associated with an index. Zero is returned if
* there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public int optInt(int index) {
return this.optInt(index, 0);
}
/**
* Get the optional int value associated with an index. The defaultValue is
* returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return The value.
*/
public int optInt(int index, int defaultValue) {
try {
return this.getInt(index);
} catch(Exception e) {
return defaultValue;
}
}
/**
* Get the optional JSONArray associated with an index.
*
* @param index
* subscript
* @return A JSONArray value, or null if the index has no value, or if the
* value is not a JSONArray.
*/
public JSONArray optJSONArray(int index) {
Object o = this.opt(index);
return o instanceof JSONArray ?(JSONArray) o : null;
}
/**
* Get the optional JSONObject associated with an index. Null is returned if
* the key is not found, or null if the index has no value, or if the value
* is not a JSONObject.
*
* @param index
* The index must be between 0 and length() - 1.
* @return A JSONObject value.
*/
public JSONObject optJSONObject(int index) {
Object o = this.opt(index);
return o instanceof JSONObject ?(JSONObject) o : null;
}
/**
* Get the optional long value associated with an index. Zero is returned if
* there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public long optLong(int index) {
return this.optLong(index, 0);
}
/**
* Get the optional long value associated with an index. The defaultValue is
* returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return The value.
*/
public long optLong(int index, long defaultValue) {
try {
return this.getLong(index);
} catch(Exception e) {
return defaultValue;
}
}
/**
* Get the optional string value associated with an index. It returns an
* empty string if there is no value at that index. If the value is not a
* string and is not null, then it is coverted to a string.
*
* @param index
* The index must be between 0 and length() - 1.
* @return A String value.
*/
public String optString(int index) {
return this.optString(index, "");
}
/**
* Get the optional string associated with an index. The defaultValue is
* returned if the key is not found.
*
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return A String value.
*/
public String optString(int index, String defaultValue) {
Object object = this.opt(index);
return JSONObject.NULL.equals(object) ? defaultValue : object
.toString();
}
/**
* Append a boolean value. This increases the array's length by one.
*
* @param value
* A boolean value.
* @return this.
*/
public JSONArray put(boolean value) {
this.put(value ? Boolean.TRUE : Boolean.FALSE);
return this;
}
/**
* Put a value in the JSONArray, where the value will be a JSONArray which
* is produced from a Collection.
*
* @param value
* A Collection value.
* @return this.
*/
public JSONArray put(Collection value) {
this.put(new JSONArray(value));
return this;
}
/**
* Append a double value. This increases the array's length by one.
*
* @param value
* A double value.
* @throws JSONException
* if the value is not finite.
* @return this.
*/
public JSONArray put(double value) throws JSONException {
Double d = new Double(value);
JSONObject.testValidity(d);
this.put(d);
return this;
}
/**
* Append an int value. This increases the array's length by one.
*
* @param value
* An int value.
* @return this.
*/
public JSONArray put(int value) {
this.put(new Integer(value));
return this;
}
/**
* Append an long value. This increases the array's length by one.
*
* @param value
* A long value.
* @return this.
*/
public JSONArray put(long value) {
this.put(new Long(value));
return this;
}
/**
* Put a value in the JSONArray, where the value will be a JSONObject which
* is produced from a Map.
*
* @param value
* A Map value.
* @return this.
*/
public JSONArray put(Map value) {
this.put(new JSONObject(value));
return this;
}
/**
* Append an object value. This increases the array's length by one.
*
* @param value
* An object value. The value should be a Boolean, Double,
* Integer, JSONArray, JSONObject, Long, or String, or the
* JSONObject.NULL object.
* @return this.
*/
public JSONArray put(Object value) {
this.myArrayList.add(value);
return this;
}
/**
* Put or replace a boolean value in the JSONArray. If the index is greater
* than the length of the JSONArray, then null elements will be added as
* necessary to pad it out.
*
* @param index
* The subscript.
* @param value
* A boolean value.
* @return this.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, boolean value) throws JSONException {
this.put(index, value ? Boolean.TRUE : Boolean.FALSE);
return this;
}
/**
* Put a value in the JSONArray, where the value will be a JSONArray which
* is produced from a Collection.
*
* @param index
* The subscript.
* @param value
* A Collection value.
* @return this.
* @throws JSONException
* If the index is negative or if the value is not finite.
*/
public JSONArray put(int index, Collection value) throws JSONException {
this.put(index, new JSONArray(value));
return this;
}
/**
* Put or replace a double value. If the index is greater than the length of
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index
* The subscript.
* @param value
* A double value.
* @return this.
* @throws JSONException
* If the index is negative or if the value is not finite.
*/
public JSONArray put(int index, double value) throws JSONException {
this.put(index, new Double(value));
return this;
}
/**
* Put or replace an int value. If the index is greater than the length of
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index
* The subscript.
* @param value
* An int value.
* @return this.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, int value) throws JSONException {
this.put(index, new Integer(value));
return this;
}
/**
* Put or replace a long value. If the index is greater than the length of
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index
* The subscript.
* @param value
* A long value.
* @return this.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, long value) throws JSONException {
this.put(index, new Long(value));
return this;
}
/**
* Put a value in the JSONArray, where the value will be a JSONObject that
* is produced from a Map.
*
* @param index
* The subscript.
* @param value
* The Map value.
* @return this.
* @throws JSONException
* If the index is negative or if the the value is an invalid
* number.
*/
public JSONArray put(int index, Map value) throws JSONException {
this.put(index, new JSONObject(value));
return this;
}
/**
* Put or replace an object value in the JSONArray. If the index is greater
* than the length of the JSONArray, then null elements will be added as
* necessary to pad it out.
*
* @param index
* The subscript.
* @param value
* The value to put into the array. The value should be a
* Boolean, Double, Integer, JSONArray, JSONObject, Long, or
* String, or the JSONObject.NULL object.
* @return this.
* @throws JSONException
* If the index is negative or if the the value is an invalid
* number.
*/
public JSONArray put(int index, Object value) throws JSONException {
JSONObject.testValidity(value);
if(index < 0) {
throw new JSONException("JSONArray[" + index + "] not found.");
}
if(index < this.length()) {
this.myArrayList.set(index, value);
} else {
while(index != this.length()) {
this.put(JSONObject.NULL);
}
this.put(value);
}
return this;
}
/**
* Remove an index and close the hole.
*
* @param index
* The index of the element to be removed.
* @return The value that was associated with the index, or null if there
* was no value.
*/
public Object remove(int index) {
return index >= 0 && index < this.length()
? this.myArrayList.remove(index)
: null;
}
/**
* Determine if two JSONArrays are similar.
* They must contain similar sequences.
*
* @param other The other JSONArray
* @return true if they are equal
*/
public boolean similar(Object other) {
if(!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if(len != ((JSONArray)other).length()) {
return false;
}
for(int i = 0; i < len; i += 1) {
Object valueThis = this.get(i);
Object valueOther = ((JSONArray)other).get(i);
if(valueThis instanceof JSONObject) {
if(!((JSONObject)valueThis).similar(valueOther)) {
return false;
}
} else if(valueThis instanceof JSONArray) {
if(!((JSONArray)valueThis).similar(valueOther)) {
return false;
}
} else if(!valueThis.equals(valueOther)) {
return false;
}
}
return true;
}
/**
* Produce a JSONObject by combining a JSONArray of names with the values of
* this JSONArray.
*
* @param names
* A JSONArray containing a list of key strings. These will be
* paired with the values.
* @return A JSONObject, or null if there are no names or if this JSONArray
* has no values.
* @throws JSONException
* If any of the names are null.
*/
public JSONObject toJSONObject(JSONArray names) throws JSONException {
if(names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for(int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.opt(i));
}
return jo;
}
/**
* Make a JSON text of this JSONArray. For compactness, no unnecessary
* whitespace is added. If it is not possible to produce a syntactically
* correct JSON text then null will be returned instead. This could occur if
* the array contains an invalid number.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @return a printable, displayable, transmittable representation of the
* array.
*/
public String toString() {
try {
return this.toString(0);
} catch(Exception e) {
return null;
}
}
/**
* Make a prettyprinted JSON text of this JSONArray. Warning: This method
* assumes that the data structure is acyclical.
*
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @return a printable, displayable, transmittable representation of the
* object, beginning with <code>[</code> <small>(left
* bracket)</small> and ending with <code>]</code>
* <small>(right bracket)</small>.
* @throws JSONException Exception
*/
public String toString(int indentFactor) throws JSONException {
StringWriter sw = new StringWriter();
synchronized(sw.getBuffer()) {
return this.write(sw, indentFactor, 0).toString();
}
}
public Vector toVector() {
if(myArrayList == null || myArrayList.isEmpty()) return new Vector(0);
Vector vResult = new Vector(myArrayList.size());
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONArray) {
vResult.add(((JSONArray) oItem).toVector());
}
else
if(oItem instanceof JSONObject) {
vResult.add(((JSONObject) oItem).toHashtable());
}
else
if(oItem instanceof JSONObject.Null) {
vResult.add(null);
}
else {
vResult.add(oItem);
}
}
return vResult;
}
public ArrayList toArrayList() {
if(myArrayList == null || myArrayList.isEmpty()) return new ArrayList(0);
ArrayList lResult = new ArrayList(myArrayList.size());
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONArray) {
lResult.add(((JSONArray) oItem).toArrayList());
}
else
if(oItem instanceof JSONObject) {
lResult.add(((JSONObject) oItem).toHashMap());
}
else
if(oItem instanceof JSONObject.Null) {
lResult.add(null);
}
else {
lResult.add(oItem);
}
}
return lResult;
}
public HashSet toHashSet() {
if(myArrayList == null || myArrayList.isEmpty()) return new HashSet(0);
HashSet setResult = new HashSet(myArrayList.size());
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONArray) {
setResult.add(((JSONArray) oItem).toHashSet());
}
else
if(oItem instanceof JSONObject) {
setResult.add(((JSONObject) oItem).toHashMap());
}
else
if(!(oItem instanceof JSONObject.Null)) {
setResult.add(oItem);
}
}
return setResult;
}
public byte[] toArrayOfByte() {
if(myArrayList == null || myArrayList.isEmpty()) return new byte[0];
byte[] aResult = new byte[myArrayList.size()];
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONObject.Null) {
aResult[i] = (byte) 0;
}
else
if(oItem instanceof Number) {
aResult[i] = ((Number) oItem).byteValue();
}
else {
return null;
}
}
return aResult;
}
public char[] toArrayOfChar() {
if(myArrayList == null || myArrayList.isEmpty()) return new char[0];
char[] aResult = new char[myArrayList.size()];
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONObject.Null) {
aResult[i] = '\0';
}
else
if(oItem instanceof Number) {
aResult[i] = (char)((Number) oItem).intValue();
}
else {
return null;
}
}
return aResult;
}
public int[] toArrayOfInt() {
if(myArrayList == null || myArrayList.isEmpty()) return new int[0];
int[] aResult = new int[myArrayList.size()];
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONObject.Null) {
aResult[i] = 0;
}
else
if(oItem instanceof Number) {
aResult[i] = ((Number) oItem).intValue();
}
else {
return null;
}
}
return aResult;
}
public double[] toArrayOfDouble() {
if(myArrayList == null || myArrayList.isEmpty()) return new double[0];
double[] aResult = new double[myArrayList.size()];
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONObject.Null) {
aResult[i] = 0.0d;
}
else
if(oItem instanceof Number) {
aResult[i] = ((Number) oItem).doubleValue();
}
else {
return null;
}
}
return aResult;
}
public boolean[] toArrayOfBoolean() {
if(myArrayList == null || myArrayList.isEmpty()) return new boolean[0];
boolean[] aResult = new boolean[myArrayList.size()];
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONObject.Null) {
aResult[i] = false;
}
else
if(oItem instanceof Boolean) {
aResult[i] = ((Boolean) oItem).booleanValue();
}
else {
return null;
}
}
return aResult;
}
public String[] toArrayOfString() {
if(myArrayList == null || myArrayList.isEmpty()) return new String[0];
String[] aResult = new String[myArrayList.size()];
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONObject.Null) {
aResult[i] = null;
}
else
if(oItem instanceof String) {
aResult[i] = (String) oItem;
}
else {
return null;
}
}
return aResult;
}
public Date[] toArrayOfDate() {
if(myArrayList == null || myArrayList.isEmpty()) return new java.util.Date[0];
java.util.Date[] aResult = new java.util.Date[myArrayList.size()];
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONObject.Null) {
aResult[i] = null;
}
else
if(oItem instanceof Date) {
aResult[i] = (Date) oItem;
}
else
if(oItem instanceof Calendar) {
aResult[i] = ((Calendar) oItem).getTime();
}
else {
return null;
}
}
return aResult;
}
public Calendar[] toArrayOfCalendar() {
if(myArrayList == null || myArrayList.isEmpty()) return new java.util.Calendar[0];
java.util.Calendar[] aResult = new java.util.Calendar[myArrayList.size()];
for(int i = 0; i < myArrayList.size(); i++) {
Object oItem = myArrayList.get(i);
if(oItem instanceof JSONObject.Null) {
aResult[i] = null;
}
else
if(oItem instanceof Date) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(((Date) oItem).getTime());
aResult[i] = cal;
}
else
if(oItem instanceof Calendar) {
aResult[i] = (Calendar) oItem;
}
else {
return null;
}
}
return aResult;
}
/**
* Write the contents of the JSONArray as JSON text to a writer. For
* compactness, no whitespace is added.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @param writer The writer.
* @return The writer.
* @throws JSONException Exception
*/
public Writer write(Writer writer) throws JSONException {
return this.write(writer, 0, 0);
}
/**
* Write the contents of the JSONArray as JSON text to a writer. For
* compactness, no whitespace is added.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @param indent
* The indention of the top level.
* @return The writer.
* @throws JSONException Exception
*/
Writer write(Writer writer, int indentFactor, int indent)
throws JSONException {
try {
boolean commanate = false;
int length = this.length();
writer.write('[');
if(length == 1) {
JSONObject.writeValue(writer, this.myArrayList.get(0), indentFactor, indent);
} else if(length != 0) {
final int newindent = indent + indentFactor;
for(int i = 0; i < length; i += 1) {
if(commanate) {
writer.write(',');
}
if(indentFactor > 0) {
writer.write('\n');
}
JSONObject.indent(writer, newindent);
JSONObject.writeValue(writer, this.myArrayList.get(i), indentFactor, newindent);
commanate = true;
}
if(indentFactor > 0) {
writer.write('\n');
}
JSONObject.indent(writer, indent);
}
writer.write(']');
return writer;
} catch(IOException e) {
throw new JSONException(e);
}
}
}
| [
"giorgio.silvestris@gmail.com"
] | giorgio.silvestris@gmail.com |
f488d6b16e3c21fdba485a7017b878e68b939ef1 | e62ebb781b3c0999a5e6050273d53e65e1df6a7e | /test/ichikawa/emis/SettingFileCreate.java | 38a30e19b72f285570728f313d141f458371e045 | [
"Apache-2.0"
] | permissive | h-crisis/assistant | 60f3c9af95f91b2936cc3b5c99f6bca3bbd4c425 | 5b28d697d183f02c2e392f9418e27395a9a54c24 | refs/heads/master | 2021-01-23T21:48:32.650745 | 2017-07-25T01:16:12 | 2017-07-25T01:16:12 | 59,541,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,865 | java | package ichikawa.emis;
import com.vividsolutions.jts.geom.MultiPolygon;
import com.vividsolutions.jts.geom.Point;
import ichikawa.common.MeshMap;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.feature.FeatureIterator;
import org.opengis.feature.simple.SimpleFeature;
import java.io.*;
import java.net.MalformedURLException;
import java.nio.charset.Charset;
import java.util.List;
/**
* Created by manabu on 2016/07/08.
*/
public class SettingFileCreate {
public static void main(String args[]) throws IOException {
File inFile = new File("files/ShapeFiles/medical_institute/medical_institute.shp");
File outFile = new File("files/OUT/medical_institute_with_mesh.csv");
File meshFileDir = new File("shape/mesh");
File mesh1stFile = new File("shape/mesh/Mesh1st.shp");
try {
createMedicalInstituteMeshFile(inFile, outFile, "UTF-8", "UTF-8", meshFileDir, mesh1stFile);
}
catch (Exception e) {
System.out.println(e);
}
}
/**
* 医療機関が属する5次メッシュを判別し医療機関コードと5次メッシュコードのCSVを出力する
* @param inFile 医療機関Shapeファイル
* @param outFile 出力ファイル
* @param inFileEncording 医療機関Shapeファイルの文字コード
* @param outFileEncording 出力ファイルの文字コード
* @throws IOException
*/
public static void createMedicalInstituteMeshFile(File inFile, File outFile, String inFileEncording, String outFileEncording,
File meshFileDir, File mesh1stFile) {
MeshMap mm = new MeshMap(meshFileDir, "UTF-8");
try {
// 医療機関Shapeファイルを開く
ShapefileDataStore inFileStore = new ShapefileDataStore(inFile.toURI().toURL());
inFileStore.setCharset(Charset.forName(inFileEncording));
SimpleFeatureSource featureSource = inFileStore.getFeatureSource();
SimpleFeatureCollection c = featureSource.getFeatures();
FeatureIterator i = c.features();
// 出力ファイルの準備をする
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(outFile,false),"UTF-8"));
pw.write("CODE,LAT,LON,MESH1ST,MESH2ND,MESH3RD,MESH4TH,MESH5TH");
// 1次メッシュファイルを開く準備をする
ShapefileDataStore mesh1FileDataStore = new ShapefileDataStore(mesh1stFile.toURI().toURL());
mesh1FileDataStore.setCharset(Charset.forName("UTF-8"));
SimpleFeatureSource mesh1FeatureSource = mesh1FileDataStore.getFeatureSource();
SimpleFeatureCollection mesh1FeatureCollection = mesh1FeatureSource.getFeatures();
int num = 1;
while(i.hasNext()) {
SimpleFeature medicalInstitute = (SimpleFeature) i.next();
System.out.println(num + "/" + c.size() + ": " + medicalInstitute.getAttribute("NAME") + "の5次メッシュを設定します");
FeatureIterator mesh1I = mesh1FeatureCollection.features();
// 1次メッシュ絞り込み
String mesh1Code = "";
while(mesh1I.hasNext()) {
SimpleFeature mesh = (SimpleFeature) mesh1I.next();
if(((Point)medicalInstitute.getAttribute("the_geom")).within((MultiPolygon)mesh.getAttribute("the_geom")) || ((Point)medicalInstitute.getAttribute("the_geom")).touches((MultiPolygon)mesh.getAttribute("the_geom"))) {
mesh1Code = (String) mesh.getAttribute("MESH1ST");
System.out.println("\t" + medicalInstitute.getAttribute("NAME") + "の1次メッシュは " + mesh1Code + " です。");
break;
}
}
mesh1I.close();
// 2次メッシュ絞り込み
String mesh2Code = "";
List<SimpleFeature> mesh2List = mm.getMap(1).get(mesh1Code);
for(int j=0; j<mesh2List.size(); j++) {
SimpleFeature mesh = mesh2List.get(j);
if(((Point)medicalInstitute.getAttribute("the_geom")).within((MultiPolygon)mesh.getAttribute("the_geom")) || ((Point)medicalInstitute.getAttribute("the_geom")).touches((MultiPolygon)mesh.getAttribute("the_geom"))) {
mesh2Code = (String) mesh.getAttribute("MESH2ND");
System.out.println("\t" + medicalInstitute.getAttribute("NAME") + "の2次メッシュは " + mesh2Code + " です。");
break;
}
}
// 3次メッシュ絞り込み
String mesh3Code = "";
List<SimpleFeature> mesh3List = mm.getMap(2).get(mesh2Code);
for(int j=0; j<mesh3List.size(); j++) {
SimpleFeature mesh = mesh3List.get(j);
if(((Point)medicalInstitute.getAttribute("the_geom")).within((MultiPolygon)mesh.getAttribute("the_geom")) || ((Point)medicalInstitute.getAttribute("the_geom")).touches((MultiPolygon)mesh.getAttribute("the_geom"))) {
mesh3Code = (String) mesh.getAttribute("MESH3RD");
System.out.println("\t" + medicalInstitute.getAttribute("NAME") + "の3次メッシュは " + mesh3Code + " です。");
break;
}
}
// 4次メッシュ絞り込み
String mesh4Code = "";
List<SimpleFeature> mesh4List = mm.getMap(3).get(mesh3Code);
for(int j=0; j<mesh4List.size(); j++) {
SimpleFeature mesh = mesh4List.get(j);
if(((Point)medicalInstitute.getAttribute("the_geom")).within((MultiPolygon)mesh.getAttribute("the_geom")) || ((Point)medicalInstitute.getAttribute("the_geom")).touches((MultiPolygon)mesh.getAttribute("the_geom"))) {
mesh4Code = (String) mesh.getAttribute("MESH4TH");
System.out.println("\t" + medicalInstitute.getAttribute("NAME") + "の4次メッシュは " + mesh4Code + " です。");
break;
}
}
// 5次メッシュ絞り込み
String mesh5Code = "";
List<SimpleFeature> mesh5List = mm.getMap(4).get(mesh4Code);
for(int j=0; j<mesh5List.size(); j++) {
SimpleFeature mesh = mesh5List.get(j);
if(((Point)medicalInstitute.getAttribute("the_geom")).within((MultiPolygon)mesh.getAttribute("the_geom")) || ((Point)medicalInstitute.getAttribute("the_geom")).touches((MultiPolygon)mesh.getAttribute("the_geom"))) {
mesh5Code = (String) mesh.getAttribute("MESH5TH");
System.out.println("\t" + medicalInstitute.getAttribute("NAME") + "の5次メッシュは " + mesh5Code + " です。");
break;
}
}
pw.write("\n" + medicalInstitute.getAttribute("CODE") + "," + medicalInstitute.getAttribute("LAT") + "," + medicalInstitute.getAttribute("LON") + ","
+ mesh1Code + "," + mesh2Code + "," + mesh3Code + "," + mesh4Code + "," + mesh5Code);
num++;
}
i.close();
pw.close();
}
catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
finally {
}
}
}
| [
"manabu.ichikawa@ichilab.org"
] | manabu.ichikawa@ichilab.org |
c9f5fb820d9b2b2f336a38f39c7fa366b523866a | 6cce52798f0a675bc3e53552724392280b71757f | /AdministrarHoteles/src/java/com/umg/models/User.java | 7f375fd4ae1046a5866ece786c80f84734c4f7cd | [] | no_license | elialdana/proyecto-hoteles-jsp | ee958064545f990af3ee9b4adc8b461f03ce8782 | 26ba0a18d4782770f4a8524ac998e686257d2198 | refs/heads/master | 2020-04-01T06:19:11.774217 | 2018-10-23T03:31:38 | 2018-10-23T03:31:38 | 152,942,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,408 | java | package com.umg.models;
/**
* @author valdana
* @version 1.0
* @created 08-oct.-2018 11:18:42 p. m.
*/
public class User {
private long id;
private String username;
private String name;
private String email;
private String password;
private int status;
public User(){
}
public User(long id, String username, String name, String email, String password, int status) {
this.id = id;
this.username = username;
this.name = name;
this.email = email;
this.password = password;
this.status = status;
}
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 getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
} | [
"valdanap@miumg.edu.gt"
] | valdanap@miumg.edu.gt |
d114bf8e4b7c9562a7c4e18a92b1266ac0f88477 | f8328cee27b71a977e1ab6ef7e43405312e5eb57 | /app/src/main/java/com/example/third_year_project/search_activity.java | a4d675067d21399c3b230a9020e403ded3dcf0c7 | [] | no_license | rousgidraph/Construction_management_system | 895b02b18600632726dcec20e6d93b1ec6eafe48 | e426963ca4c66b307fd88188183d17723c4c5830 | refs/heads/master | 2023-07-06T11:26:47.938159 | 2021-08-15T13:47:12 | 2021-08-15T13:47:12 | 288,997,317 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,667 | java | package com.example.third_year_project;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import com.example.third_year_project.logic.Item;
import com.example.third_year_project.logic.Stock;
import com.example.third_year_project.storage.Datamanager;
import com.example.third_year_project.storage.databaseGuy;
import java.util.ArrayList;
public class search_activity extends AppCompatActivity implements View.OnClickListener {
TextView title,result_count, no_result;
EditText searchbar;
ListView display_items;
ArrayList<String> search_results;
Context context;
com.example.third_year_project.storage.databaseGuy databaseGuy;
Datamanager datamanager;
ArrayAdapter adapter;
Button btn_search;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_activity);
//declarations
search_results = new ArrayList();
adapter = new ArrayAdapter<String>(this,R.layout.listview,search_results);
context = search_activity.this;
databaseGuy = new databaseGuy(context);
datamanager = new Datamanager(databaseGuy);
title = findViewById(R.id.search_title);
searchbar = findViewById(R.id.input_search_item);
no_result = findViewById(R.id.no_results_found);
display_items = findViewById(R.id.search_results_item);
btn_search = findViewById(R.id.btn_search_items);btn_search.setOnClickListener(this::onClick);
result_count = findViewById(R.id.search_result_count);
display_items.setAdapter(adapter);
display_items.setEmptyView(findViewById(R.id.emptyView));
display_items.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) {
char read_id = search_results.get(pos).charAt(0);
Stock clicked_item = datamanager.fetch_item_stock_data(Integer.parseInt(String.valueOf(read_id)));
Intent view_inventory = new Intent(context,view_inventory.class);
view_inventory.putExtra("selected stock",clicked_item);
context.startActivity(view_inventory);
}
});
}
public void search() {
String searchable = searchbar.getText().toString();
result_count.setText("results");
if (searchbar.getText().length() < 2) {
//searchbar.setError("Can't be empty");
searchbar.requestFocus();
} else {
search_results.removeAll(search_results);
search_results.addAll(datamanager.search_by_item_name(searchable));
empty_data_checker();
result_count.setText( String.valueOf(search_results.size()));
adapter.notifyDataSetChanged();
}
}
public void empty_data_checker(){
if(search_results.size()<=0){
display_items.setVisibility(View.INVISIBLE);
no_result.setVisibility(View.VISIBLE);
}else{
display_items.setVisibility(View.VISIBLE);
no_result.setVisibility(View.INVISIBLE);
}
}
@Override
public void onClick(View view) {
if(view == btn_search){
search();
}
}
} | [
"rousgidraph@gmail.com"
] | rousgidraph@gmail.com |
7c1c914813872e93cb3e53feb33157b45d4e82f4 | 7882cba319ce284cb5a58e31143682073d87a904 | /Exemplos Aulas Android/Aula02_SensibilizandoBotoes/src/br/teste/TesteActivity.java | f9ea1011f0d86e8cf1916d83e25d0a566a9d2300 | [] | no_license | mtheusbrito/Android-Essentials | 9595d3a30edc770fc451097f1cc3b341a250cef6 | 1cf3dd9bdb0ea5d365bb47492af7bc261a7cb199 | refs/heads/master | 2021-05-27T03:38:36.941593 | 2012-07-05T00:31:09 | 2012-07-05T00:31:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package br.teste;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class TesteActivity extends Activity {
/** Called when the activity is first created. */
Button botao;
TextView txtNome;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtNome = (TextView)findViewById(R.id.txtNome);
botao = (Button)findViewById(R.id.btnAcao);
botao.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(),txtNome.getText(), Toast.LENGTH_SHORT).show();
}
});
}
} | [
"raphaelframos@gmail.com"
] | raphaelframos@gmail.com |
50e95eaa67fb9e71ae5d638bffc18f98b322e7fd | 21bcd1da03415fec0a4f3fa7287f250df1d14051 | /sources/com/google/android/play/core/common/PlayCoreDialogWrapperActivity.java | eb16788978d206ca0808f31648865eb3c1039aa1 | [] | no_license | lestseeandtest/Delivery | 9a5cc96bd6bd2316a535271ec9ca3865080c3ec8 | bc3fae8f30804a2520e6699df92c2e6a4a0a7cfc | refs/heads/master | 2022-04-24T12:14:22.396398 | 2020-04-25T21:50:29 | 2020-04-25T21:50:29 | 258,875,870 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,035 | java | package com.google.android.play.core.common;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.os.ResultReceiver;
public class PlayCoreDialogWrapperActivity extends Activity {
/* renamed from: a */
private ResultReceiver f20213a;
/* access modifiers changed from: protected */
public void onActivityResult(int i, int i2, Intent intent) {
int i3;
Bundle bundle;
super.onActivityResult(i, i2, intent);
if (i == 0) {
ResultReceiver resultReceiver = this.f20213a;
if (resultReceiver != null) {
if (i2 == -1) {
i3 = 1;
bundle = new Bundle();
} else if (i2 == 0) {
i3 = 2;
bundle = new Bundle();
}
resultReceiver.send(i3, bundle);
}
}
finish();
}
/* access modifiers changed from: protected */
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
String str = "result_receiver";
if (bundle == null) {
this.f20213a = (ResultReceiver) getIntent().getParcelableExtra(str);
try {
startIntentSenderForResult(((PendingIntent) getIntent().getExtras().get("confirmation_intent")).getIntentSender(), 0, null, 0, 0, 0);
} catch (SendIntentException unused) {
ResultReceiver resultReceiver = this.f20213a;
if (resultReceiver != null) {
resultReceiver.send(3, new Bundle());
}
finish();
}
} else {
this.f20213a = (ResultReceiver) bundle.getParcelable(str);
}
}
/* access modifiers changed from: protected */
public void onSaveInstanceState(Bundle bundle) {
bundle.putParcelable("result_receiver", this.f20213a);
}
}
| [
"zsolimana@uaedomain.local"
] | zsolimana@uaedomain.local |
f3e92b40b7fdc3cc128ae1d20db288f59ddfd278 | aad7475e57cac5c7228292dce412d437d0f981f3 | /src/User/Arrow.java | a979c58a96d62ea49ff6bd5472b31ed42c2aad21 | [] | no_license | patzomir/tile-game | e331945517f8a4ae75d4f4d2583ab942abe418d1 | 766675ae36f401a1c120b894e8ee7a02c2d1e4f1 | refs/heads/master | 2021-07-20T06:44:58.164391 | 2017-10-29T09:23:21 | 2017-10-29T09:23:21 | 108,720,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,119 | 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 User;
/**
*
* @author Patzo
*/
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
public class Arrow extends JPanel {
int angle, x, y;
Image arrow;
public Arrow(){
setOpaque(false);
try {
arrow = ImageIO.read(new File("Resources\\arrowBrown.png"));
} catch (IOException e){ System.out.println("EXCEPTION");}
angle =0;
}
public void paintComponent(Graphics gg)
{
Graphics2D g = (Graphics2D) gg;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
AffineTransform matrix = g.getTransform(); // Backup
g.rotate(Math.toRadians(angle),15,15);
/* Begin */
g.drawImage(arrow,0,0,30,30,null);
/* End */
g.setTransform(matrix); // Restore
}
public void render(int X, int Y, int angle){
x=X;
y=Y;
this.setBounds(x, y, 30, 30);
this.angle=angle;
this.repaint();
}
} | [
"plamen.tarkalanov@ontotext.com"
] | plamen.tarkalanov@ontotext.com |
b4ba41209c0058589dab6c035b4304fd09457fb5 | 97de2b75cee238f98d071dced93274aef2eb4276 | /Server/src/sessions/AssassinsSession.java | 85287eb8ca02270aec6e5629eb1b951651d98ff8 | [] | no_license | mtracy01/MiniMap | 2a4c5e90bd44d16bdc4dd6bb9a39959592243a9d | 7f809bacb3fa2118b852e0ada3641ec7827f31b8 | refs/heads/master | 2016-09-06T12:44:51.749276 | 2015-05-31T20:31:53 | 2015-05-31T20:31:53 | 29,947,115 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,448 | java | package sessions;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.logging.Logger;
import server.Location;
import server.Server;
import server.Team;
import server.User;
import server.Utility;
public class AssassinsSession extends GameSession {
private static final Logger log = Logger.getLogger( Server.class.getName() );
/**
* This stores which users are currently targeting each other
* <user, target>
*/
private HashMap<User, User> targets;
/**
* Store any potential finds
*/
private HashSet<PotentialFind> potentialFinds;
public AssassinsSession(User owner, Server server) {
super("assassins", owner, server);
targets = new HashMap<User, User>();
potentialFinds = new HashSet<PotentialFind>();
}
@Override
public void handleMessage(String message, User user) {
String[] parts = message.split(" ");
if (parts[0].equals("confirmDeath")) {
synchronized (users) {
// Get the potentialFind for the user
PotentialFind find = null;
for (PotentialFind f : potentialFinds) {
if (f.target.equals(user)) {
find = f;
break;
}
}
if (find == null) {
return;
}
if (parts[1].equals("true")) {
// The target confirmed
find.targetConfirm = true;
if (find.bothConfirmed()) {
processKill(find);
}
} else {
// Reject happened, remove any potential find
potentialFinds.remove(find);
}
}
} else if (parts[0].equals("confirmKill")) {
synchronized (users) {
// Get the potentialFind for the user
PotentialFind find = null;
for (PotentialFind f : potentialFinds) {
if (f.assassin.equals(user)) {
find = f;
break;
}
}
if (find == null) {
return;
}
if (parts[1].equals("true")) {
// The assassin confirmed
find.assassinConfirm = true;
if (find.bothConfirmed()) {
processKill(find);
}
} else {
// Reject happened, remove any potential find
potentialFinds.remove(find);
}
}
}
}
/**
* Process a kill
* @param find
*/
private void processKill(PotentialFind find) {
// Send out the global kill message
String killMessage = "kill " + find.assassin.getUserID() + " " + find.target.getUserID();
for (User u : users) {
u.sendMessage(killMessage);
}
potentialFinds.remove(find);
// Remove a potential find where the target is the assassin
PotentialFind toRemove = null;
for (PotentialFind f : potentialFinds) {
if (f.assassin.equals(find.target)) {
toRemove = f;
break;
}
}
if (toRemove != null) {
potentialFinds.remove(toRemove);
}
// Set the new target for the assassin
targets.put(find.assassin, targets.get(find.target));
targets.remove(find.target);
// If we start targeting ourselves, the game is over, end it
if (find.assassin.equals(targets.get(find.assassin))) {
endSession();
return;
}
String targetMessage = "target " + targets.get(find.assassin).getUserID();
find.assassin.sendMessage(targetMessage);
}
@Override
public void handleLocation(Location loc, User user) {
// Update the locations of the relevant clients
String locationMessage = "location " + user.getUserID() + " " + loc.getLatitude() + " " + loc.getLongitude();
for (Entry<User, User> entry : targets.entrySet()) {
if (entry.getValue().equals(user)) {
entry.getKey().sendMessage(locationMessage);
}
}
user.sendMessage(locationMessage);
// Get the target of the user and see if their locations are close
User target = targets.get(user);
// If the user has no target, don't process it
if (target == null) {
return;
}
boolean close = Utility.areClose(user, target, Utility.PROXIMITY_DISTANCE);
if (close) {
// The users are close together and are not in the process of confirming,
// start the process
PotentialFind find = new PotentialFind();
find.assassin = user;
find.target = target;
if (!potentialFinds.contains(find)) {
potentialFinds.add(find);
user.sendMessage("acceptKill " + target.getUserID());
target.sendMessage("acceptDeath " + user.getUserID());
}
}
}
@Override
public void startSession() {
log.fine("Starting game session " + this.getId());
isRunning = true;
synchronized (users) {
// Only assign targets if there is more than 1 person in the game
if (users.size() >= 2) {
// Assign each user a target
Object[] usersArray = users.toArray();
for (int i = 0; i < usersArray.length - 1; i++) {
targets.put((User) usersArray[i], (User) usersArray[i+1]);
}
targets.put((User) usersArray[usersArray.length - 1], (User) usersArray[0]);
// Send the start message
sendStartMessage();
// Send target assignments
for (Entry<User, User> entry : targets.entrySet()) {
String message = "target " + entry.getValue().getUserID();
entry.getKey().sendMessage(message);
}
} else {
// Just one person, start with no targets
sendStartMessage();
}
}
}
@Override
public void endSession() {
log.fine("Session ending");
isRunning = false;
synchronized (users) {
Object[] userArray = users.toArray();
for (Object u : userArray) {
removeUser((User) u);
}
}
// Remove ourselves
server.removeSession(this);
}
@Override
public void removeUser(User user) {
log.finer("Removing user " + user + " from friendfinder session");
user.setInGame(false);
user.setGameSession(null);
synchronized (users) {
log.finer(users.toString());
// Process someone leaving as if they were killed
PotentialFind toRemove = null;
for (Entry<User, User> entry : targets.entrySet()) {
if (entry.getValue().equals(user)) {
PotentialFind find = new PotentialFind();
find.assassin = entry.getKey();
find.target = user;
if (!find.assassin.equals(find.target)) {
toRemove = find;
}
}
}
if (toRemove != null) {
log.fine("Removing find: " + toRemove.assassin.getUserID() + " -> " + toRemove.target.getUserID());
processKill(toRemove);
}
// Actually remove the user
users.remove(user);
// Send the remove message to all users, including the one getting removed
String removeMessage = "userRemoved " + user.getUserID();
for (User u : users) {
u.sendMessage(removeMessage);
}
user.sendMessage(removeMessage);
log.finer(users.toString());
log.finer(users.size() + " users in session");
// Check for empty sessions
if (users.isEmpty()) {
endSession();
}
// Check for owner succession
if (owner.equals(user) && !users.isEmpty()) {
owner = users.iterator().next();
}
}
sendSessionUsers();
}
@Override
public void addUser(User user, int teamid) {
// Don't do anything when a user is added beyond adding them to the user list
synchronized (users) {
users.add(user);
}
sendSessionUsers();
}
@Override
public void addBeacon(int teamid, Location loc) {
// Beacons are not part of the game
}
@Override
public void removeBeacon(int teamid, Integer id) {
// Beacons are not part of the game
}
/**
* A helper class used to store the status of potential finds
*
*/
class PotentialFind {
public User assassin;
public User target;
public boolean assassinConfirm;
public boolean targetConfirm;
public boolean bothConfirmed() {
return assassinConfirm && targetConfirm;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((assassin == null) ? 0 : assassin.hashCode());
result = prime * result
+ ((target == null) ? 0 : target.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PotentialFind other = (PotentialFind) obj;
if (assassin == null) {
if (other.assassin != null)
return false;
} else if (!assassin.equals(other.assassin))
return false;
if (target == null) {
if (other.target != null)
return false;
} else if (!target.equals(other.target))
return false;
return true;
}
}
}
| [
"oggnicki@yahoo.com"
] | oggnicki@yahoo.com |
2e35d17b28169a4491ad26d633fa2a7068e4b32f | 3f4ee9c187ff06b58e19a3613ba121354256d3ce | /JavaAgostDic/src/dostrece/permutaciones.java | fecae578b99f220eb51037f0406891d6299617a4 | [] | no_license | vurokrazia/Java | d6e06ecd547bc92a1773f09537db3f117d4f2421 | ce3b12db16a0045d42f26a0d0910d67d70ee85fd | refs/heads/master | 2021-05-29T18:16:43.422549 | 2015-10-27T03:02:33 | 2015-10-27T03:02:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,682 | 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 dostrece;
import java.io.*;
/**
*
* @author jesus
*/
public class permutaciones {
public static void main(String[] args) throws IOException{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Entrada");
String entrada = bf.readLine();
char [] cadena = entrada.toCharArray();
int repetido = 0;
for(int i = 0;i<entrada.length();i++){
for (int j = 0; j < entrada.length(); j++) {
if(cadena[i] == cadena[j]){
repetido++;
if (repetido>entrada.length()) {
System.out.println("Caracter Repetido");
System.exit(1);
}
}
}
}
int n = entrada.length()*entrada.length();
String [] permutaciones = new String[n];
for (int i = 0; i < entrada.length(); i++) {
permutaciones[i] = ""+ cadena[i];
}
permutaciones(permutaciones,"",entrada.length(),entrada.length());
}
private static void permutaciones(String[] elem, String act, int n, int r) {
if (n == 0) {
System.out.println(act);
} else {
for (int i = 0; i < r; i++) {
if (!act.contains(elem[i])) { // Controla que no haya repeticiones
permutaciones(elem, act + elem[i] + "", n - 1, r);
}
}
}
}
}
| [
"jesus.alberto.vk@gmail.com"
] | jesus.alberto.vk@gmail.com |
37e1a7b315adc7a77fe9e67abac48f6fbfed6dd1 | 10e174bef3f45c61cafb9f300f3ef1556aa0485f | /content-publisher/src/main/java/com/data/content/publisher/service/ContentPublisherService.java | cd9f31a4b0b7c488abbac8db9a896995bcbc517f | [] | no_license | anushyakkutty/dataprocessor | b979da0bacc6348dc30196db6ee8b9c144175274 | 4229ade38d850db52a9dfa42c534a4f9e279a826 | refs/heads/master | 2021-04-14T20:50:24.879443 | 2020-07-23T09:42:09 | 2020-07-23T09:42:09 | 249,265,712 | 0 | 0 | null | 2020-07-23T09:42:10 | 2020-03-22T20:21:50 | Java | UTF-8 | Java | false | false | 182 | java | package com.data.content.publisher.service;
import com.data.content.publisher.model.Content;
public interface ContentPublisherService {
public void publish(Content content);
}
| [
"anushya.k.kutty@gmail.com"
] | anushya.k.kutty@gmail.com |
cca2e17bc04b66c5122e8c534f6fb876cba0107d | 91a3bd1f5bf4d445d8b4778a56f2fe03f4b6dde3 | /app/src/main/java/com/lionel/biometricpromptp/MainActivity.java | d6bcfc979a03088734dbc2946a8d0f5680f4de70 | [] | no_license | LionelC001/BiometricPromptP | 202ac724f7d63ba3cff76c18a77f8270e38eaa0a | 86ea763d33a2a16040d719a548318babffdca6db | refs/heads/master | 2020-07-25T22:57:33.548777 | 2019-09-14T14:14:17 | 2019-09-14T14:14:17 | 208,450,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,193 | java | package com.lionel.biometricpromptp;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.biometric.BiometricManager;
import androidx.biometric.BiometricPrompt;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import static androidx.biometric.BiometricManager.BIOMETRIC_SUCCESS;
public class MainActivity extends AppCompatActivity {
private BiometricPrompt biometricPrompt;
private BiometricPrompt.PromptInfo promptInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
checkIsBiometricHardwareAvailable();
initBiometricPrompt();
}
private void checkIsBiometricHardwareAvailable() {
ImageView imgAvailable = findViewById(R.id.imgAvailable);
if (BiometricManager.from(this).canAuthenticate() == BIOMETRIC_SUCCESS) {
imgAvailable.setImageResource(R.drawable.ic_check_circle);
} else {
imgAvailable.setImageResource(R.drawable.ic_cancel);
}
}
private void initBiometricPrompt() {
Executor newExecutor = Executors.newSingleThreadExecutor();
biometricPrompt = new BiometricPrompt(this, newExecutor, new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
super.onAuthenticationError(errorCode, errString);
Log.d("<>error", errString.toString());
Toast.makeText(MainActivity.this, errString.toString(), Toast.LENGTH_LONG).show();
}
@Override
public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
Log.d("<>success","resutl "+ result.toString());
Log.d("<>success","getCryptoObject "+ result.getCryptoObject());
// Log.d("<>success","getCipher "+ result.getCryptoObject().getCipher());
// Log.d("<>success","getMac "+ result.getCryptoObject().getMac());
// Log.d("<>success","getSignature "+ result.getCryptoObject().getSignature());
runOnUiThread(() -> Toast.makeText(MainActivity.this, "success", Toast.LENGTH_LONG).show());
}
@Override
public void onAuthenticationFailed() {
super.onAuthenticationFailed();
Log.d("<>failed", "thread " + Thread.currentThread().getName());
Toast.makeText(MainActivity.this,"failed", Toast.LENGTH_LONG).show();
}
});
promptInfo = new BiometricPrompt.PromptInfo.Builder()
.setTitle("將 Touch ID 用於「OOXX」")
.setNegativeButtonText("取消")
.build();
}
public void onBiometric(View view) {
biometricPrompt.authenticate(promptInfo);
}
}
| [
"l10ne1"
] | l10ne1 |
b0ab187a8123577e5df813684137bfa676bd5a77 | f9de575e5ef95bc761ebd3136313bf71aed5f20d | /src/basic/basic_15.java | d1efbf6c9e4b4fc663b92995aa935a844c49d7eb | [] | no_license | LaoJu/lanqiaobei_questions | 89ffca0e4258dd23b7faaa44d3198add86cfcae6 | 6d180827f5ba2e806848884b02627b17170bc036 | refs/heads/master | 2020-04-14T06:12:31.919664 | 2019-03-24T14:06:53 | 2019-03-24T14:06:53 | 163,680,071 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,013 | java | package basic;
import java.util.Scanner;
public class basic_15 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str1 = scanner.next();
String str2 = scanner.next();
char[] strs1 = str1.toCharArray();
char[] strs2 = str2.toCharArray();
// 判断情况1
int len1 = strs1.length;
int len2 = strs2.length;
if (len1 != len2) {
System.out.println("1");
return;
}
int flag = 0;
// 判断情况3
if (flag == 0) {
char[] lowStr1 = str1.toLowerCase().toCharArray();
char[] lowStr2 = str2.toLowerCase().toCharArray();
for (int i = 0; i < lowStr1.length; i++) {
if (lowStr1[i] != lowStr2[i]) {
flag = 4;
System.out.println(flag);
return;
}
}
// 判断情况2
if (flag == 0) {
for (int i = 0; i < len1; i++) {
if (strs1[i] != strs2[i]) {
flag = 3;
}
}
if (flag == 0) {
flag = 2;
}
}
}
if (flag == 0) {
flag = 4;
}
System.out.println(flag);
}
}
| [
"864196621@qq.com"
] | 864196621@qq.com |
317bdfe300c41e2fc88f63399dbbd3a841566de4 | 67fbbb08a491db38ed49e3fd3daed4aa3fa48f1b | /src/main/java/com/sihan/dynamicdatasource/utils/PageUtils.java | 9dd0227c70d86e78bf758fbdd0d11f113db6b2e2 | [] | no_license | Tellerattack/dynamic-datasource-1 | 55d2e73a6c13cf335ff477cefe6a9d3f27ec2cf7 | 28a3c6e319a7744dffc5edeb56ff9286568343c9 | refs/heads/master | 2022-07-16T14:49:00.481178 | 2020-05-14T10:27:37 | 2020-05-14T10:27:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,313 | java | /**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有,侵权必究!
*/
package com.sihan.dynamicdatasource.utils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.io.Serializable;
import java.util.List;
/**
* 分页工具类
*
* @author Mark sunlightcs@gmail.com
*/
public class PageUtils implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 总记录数
*/
private int totalCount;
/**
* 每页记录数
*/
private int pageSize;
/**
* 总页数
*/
private int totalPage;
/**
* 当前页数
*/
private int currPage;
/**
* 列表数据
*/
private List<?> list;
/**
* 分页
*
* @param list 列表数据
* @param totalCount 总记录数
* @param pageSize 每页记录数
* @param currPage 当前页数
*/
public PageUtils(List<?> list, int totalCount, int pageSize, int currPage) {
this.list = list;
this.totalCount = totalCount;
this.pageSize = pageSize;
this.currPage = currPage;
this.totalPage = (int) Math.ceil((double) totalCount / pageSize);
}
/**
* 分页
*/
public PageUtils(IPage<?> page) {
this.list = page.getRecords();
this.totalCount = (int) page.getTotal();
this.pageSize = (int) page.getSize();
this.currPage = (int) page.getCurrent();
this.totalPage = (int) page.getPages();
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getCurrPage() {
return currPage;
}
public void setCurrPage(int currPage) {
this.currPage = currPage;
}
public List<?> getList() {
return list;
}
public void setList(List<?> list) {
this.list = list;
}
}
| [
"zhoujdev@163.com"
] | zhoujdev@163.com |
6b72320f53193e55012a0a1c6fd2be8a651d79ea | 8b588da67ca88f03bd983a2306e035e40c87693d | /src/main/java/dev/mohsenkohan/tacocloud/part1/controller/RegisterController.java | cfdfc7bf686d7bb2df4be6c3f4e4307d1b864634 | [] | no_license | MohsenKohan-Dev/taco-cloud | 6fe75e819a9c029c93c893659c6117b6d88ed84c | 8c023faea816091508f113d15fe157871ace5bf8 | refs/heads/master | 2022-06-27T13:37:14.872193 | 2020-05-10T15:31:54 | 2020-05-10T15:31:54 | 259,277,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | package dev.mohsenkohan.tacocloud.part1.controller;
import dev.mohsenkohan.tacocloud.part1.repository.UserRepository;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/register")
public class RegisterController {
private final UserRepository userRepository;
private final PasswordEncoder passwordEncoder;
public RegisterController(UserRepository userRepository, PasswordEncoder passwordEncoder) {
this.userRepository = userRepository;
this.passwordEncoder = passwordEncoder;
}
@GetMapping
public String registerForm() {
return "registration";
}
@PostMapping
public String processRegistration(RegistrationForm form) {
userRepository.save(form.toUser(passwordEncoder));
return "redirect:/login";
}
}
| [
"mohsenkohan.dev@gmail.com"
] | mohsenkohan.dev@gmail.com |
8ad3710edb84ea4427ebbcb8cef4681f98542896 | 3625cd7c3563e9b92ea77b1fe796046fbe76081f | /src/gunbound/src/com/gunbound/shared/dto/UserInfoDTO.java | 6b6ce41556ad1b1a27f845641714bfae4996111b | [] | no_license | vantrox/gunbound | 6e31b0d55b721a6652ab3494cf5d6ec536e3b9ef | 7575f360eddf42cf666e35e70fab5916b1b2d313 | refs/heads/master | 2020-06-07T10:35:02.764614 | 2012-12-16T01:28:31 | 2012-12-16T01:28:31 | 37,171,733 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,458 | java | package com.gunbound.shared.dto;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="userinfo")
public class UserInfoDTO implements Serializable{
private static final long serialVersionUID = -4060597956631410099L;
@Id
@Column(name="userinfoid")
@GeneratedValue
private long userinfoid;
@Id
@Column (name="userid")
private long userid;
@Column (name="won")
private int won;
@Column (name="lost")
private int lost;
@Column (name="draw")
private int draw;
public UserInfoDTO(){}
public UserInfoDTO(long userid, int won, int lost, int draw){
this.userid = userid;
this.won = won;
this.lost = lost;
this.draw = draw;
}
public long getUserinfoid() {
return userinfoid;
}
public void setUserinfoid(long userinfoid) {
this.userinfoid = userinfoid;
}
public long getUserid() {
return userid;
}
public void setUserid(long userid) {
this.userid = userid;
}
public int getWon() {
return won;
}
public void setWon(int won) {
this.won = won;
}
public int getLost() {
return lost;
}
public void setLost(int lost) {
this.lost = lost;
}
public int getDraw() {
return draw;
}
public void setDraw(int draw) {
this.draw = draw;
}
}
| [
"akevalion@gmail.com"
] | akevalion@gmail.com |
d4026cfd48a30085f3b4985ddc166c3d3142f63a | 8f122c01cab7cdd3294c2e69bc0956d6f7dd9e53 | /Portofolio/app/src/androidTest/java/nano/jonask/portofolio/ApplicationTest.java | 5a518f53bb01acebc5fc60e764a92013b455b358 | [
"MIT"
] | permissive | jonaskirkemyr/Nanodegree | 664602cba54c358b9a7088fb7c11ecc25ac321a7 | 57aecec20c0edbf1162a700b20aa279c661ec703 | refs/heads/master | 2020-12-07T15:39:21.321651 | 2015-09-11T13:04:01 | 2015-09-11T13:04:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package nano.jonask.portofolio;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"jonas@kirkemyr.no"
] | jonas@kirkemyr.no |
e8655299744195f2affb2debcd12a3d1bee574ef | 611329400c9ef9c01ada470f5ff86f152b257418 | /src/main/groovy/com/coupang/webapp007/niney/parse/Wemarket.java | 5301cf79f35a8a5cd429908d393e31c0db67b70d | [] | no_license | niney/jesol | b38f73236498d71be594ba25ff52adec2d8339bc | 709cf5893549e778081a8b632347103c71807c22 | refs/heads/master | 2016-09-06T17:09:01.291780 | 2015-07-09T03:51:46 | 2015-07-09T03:51:46 | 38,737,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,765 | java | package com.coupang.webapp007.niney.parse;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.coupang.webapp007.niney.model.Item;
import com.coupang.webapp007.niney.util.Resourcer;
/**
* ??? site parsing
* @author Administrator
*
*/
public class Wemarket extends ParseBase {
@Override
public String getURL(SearchRequest searchRequest) {
String param = "";
try {
param = String.format(Resourcer.getString("WEMARKET_QUERY"), URLEncoder.encode(searchRequest.getKeyword(), "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return Resourcer.getString("WEMARKET_URL") + param;
}
@Override
public void parse() {
Document doc = Jsoup.parseBodyFragment(this.getHtmlString());
Elements listElms = doc.getElementsByClass("list_combine");
Elements detailElms = listElms.first().select("li");
for(Element detailElm : detailElms) {
Item item = new Item();
item.setCompany(Resourcer.getString("WEMARKET_COMPANY"));
Elements titleElms = detailElm.getElementsByClass("standardinfo");
String title = titleElms.html();
item.setTitle(title);
Elements priceElms = detailElm.getElementsByClass("sale");
String price = priceElms.text();
item.setPrice(price);
Elements peopleElms = detailElm.getElementsByClass("point");
String amount = peopleElms.html();
item.setAmount(amount);
this.getItemList().add(item);
}
}
}
| [
"kpeteras@gmail.com"
] | kpeteras@gmail.com |
e01530b0da1ce536e8961a13b99e547dd56d2040 | 7aedb132ab53155ca141d3d89f0e83a0754cc7ac | /src/test/java/Runner/RunnerClass.java | ad80144f6f18954671cb381284c0bad723247817 | [] | no_license | Shreya-tech/WinAppDriver | 9df37e6e5750b7273bcda94ae1060b8d83f1ce5b | 04ab5b7324074495c8e24fe0c017cc5ec7d401f5 | refs/heads/main | 2023-07-17T19:05:48.820385 | 2021-08-25T06:09:31 | 2021-08-25T06:09:31 | 399,704,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package Runner;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
@CucumberOptions(
features = {".\\src\\test\\java\\Features"},
glue = { "StepDefinitions" }, // path of step definition
plugin = { "pretty", "html:test-output", "junit:junit_xml/junit.xml",
"com.cucumber.listener.ExtentCucumberFormatter:Reports/ExtentReport.html " },
monochrome = true,
dryRun = false, // check all the steps have the definitions and will not execute
strict = true, // check if any step is not defined in step definition file
tags = {"@ADD"}
)
/*
* to run addition : @ADD
* to run subtraction : @SUB
* to run all : @Regression
* */
public class RunnerClass extends AbstractTestNGCucumberTests {
}
| [
"55549768+Shreya-tech@users.noreply.github.com"
] | 55549768+Shreya-tech@users.noreply.github.com |
8f19be3d0826e1d59dbd2b51d9df33e49bfbf715 | 57a4a6dd5a0e5cdacb2d9ec7f1af38e9fd9117ce | /metier/src/test/java/com/guillaumetalbot/applicationblanche/metier/service/LibelleServiceTest.java | 3de561637031ae39770bfbc0d028f2396f9165aa | [] | no_license | talbotgui/appliBlanche | c711e14f398ae51f6a6a7cf4ec7cff53d537b96c | 59ea9386f4c936263d9e11bbc9d6a325fdef9be7 | refs/heads/master | 2021-09-21T17:13:32.359319 | 2019-07-03T06:12:43 | 2019-07-03T06:12:43 | 117,350,750 | 0 | 0 | null | 2021-08-28T20:15:49 | 2018-01-13T14:37:41 | Java | UTF-8 | Java | false | false | 1,908 | java | package com.guillaumetalbot.applicationblanche.metier.service;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.Map;
import javax.sql.DataSource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import com.guillaumetalbot.applicationblanche.metier.application.SpringApplicationForTests;
@SpringBootTest(classes = SpringApplicationForTests.class)
public class LibelleServiceTest {
private static final Logger LOG = LoggerFactory.getLogger(LibelleServiceTest.class);
@Autowired
private DataSource dataSource;
@Autowired
private LibelleService libelleService;
@BeforeEach
public void before() throws IOException, URISyntaxException {
LOG.info("---------------------------------------------------------");
// Destruction des données
final Collection<String> strings = Files.readAllLines(Paths.get(ClassLoader.getSystemResource("db/dataPurge.sql").toURI()));
final JdbcTemplate jdbc = new JdbcTemplate(this.dataSource);
LOG.info("Execute SQL : {}", strings);
jdbc.batchUpdate(strings.toArray(new String[strings.size()]));
}
// @Test
@Test
public void test01ListerLibelles() {
//
final String langue = "FR";
final JdbcTemplate jdbc = new JdbcTemplate(this.dataSource);
jdbc.update("insert into LIBELLE (clef, libelle, langue) values (?,?,?)", "clef", "libelle", langue);
//
final Map<String, String> libelles = this.libelleService.listerParLangue(langue);
//
Assertions.assertNotNull(langue);
Assertions.assertEquals(1, libelles.size());
}
}
| [
"talbotgui@gmail.com"
] | talbotgui@gmail.com |
60949e8097a4913a0bfae46b7497e834c1f09c23 | 8e75d25b069005306dd2baebc48dc5a5ea8141c3 | /app/src/main/java/com/urban/admin/firstapp/Adapter/myAdapter.java | 2665d8ca09018b691028e052d9a75e9ee93cb1ce | [] | no_license | DuraiMca/AndroidStudio-SqliteLogin-insert-View | e2ee269ff6269a61ec0c7658ad7362426c50b9cd | c59fd40c70721d02b491b84d65a8d08ca0ee0906 | refs/heads/master | 2020-05-21T05:20:41.072049 | 2019-05-10T04:41:22 | 2019-05-10T04:41:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,824 | java | package com.urban.admin.firstapp.Adapter;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.TextView;
import com.urban.admin.firstapp.Fragments.update;
import com.urban.admin.firstapp.Model.UserData;
import com.urban.admin.firstapp.R;
import java.util.ArrayList;
import java.util.List;
public class myAdapter extends RecyclerView.Adapter<myAdapter.viewholder> {
List<UserData> data = new ArrayList<>();
Context context;
public myAdapter(List<UserData> data, Context context) {
this.data = data;
this.context = context;
}
@NonNull
@Override
public viewholder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(context).inflate(R.layout.row, viewGroup, false);
return new viewholder(view);
}
@Override
public void onBindViewHolder(@NonNull final viewholder viewholder, final int i) {
UserData userData = data.get(i);
viewholder.id.setText(userData.getId());
viewholder.name.setText(userData.getName());
viewholder.email.setText(userData.getEmail());
viewholder.mobile.setText(Long.toString(userData.getMobile()));
viewholder.edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
update update = new update();
Bundle bundle = new Bundle();
bundle.putString("id", data.get(i).getId());
bundle.putString("Name", data.get(i).getName());
bundle.putString("Mobile", String.valueOf(data.get(i).getMobile()));
bundle.putString("Email", data.get(i).getEmail());
AppCompatActivity activity = (AppCompatActivity) v.getContext();
update.setArguments(bundle);
activity.getSupportFragmentManager().beginTransaction().replace(R.id.MainLayout, update).commit();
}
});
}
@Override
public int getItemCount() {
return data.size();
}
class viewholder extends RecyclerView.ViewHolder {
TextView id, name, mobile, email;
ImageButton edit;
public viewholder(@NonNull View itemView) {
super(itemView);
id = itemView.findViewById(R.id.uid);
name = itemView.findViewById(R.id.uname);
mobile = itemView.findViewById(R.id.uphone);
email = itemView.findViewById(R.id.umail);
edit = itemView.findViewById(R.id.uedit);
}
}
}
| [
"30861359+duraidur@users.noreply.github.com"
] | 30861359+duraidur@users.noreply.github.com |
6a2e61022f9ba215bea9425844f191b717423ac7 | 591184fe8b21134c30b47fa86d5a275edd3a6208 | /openejb3/container/openejb-core/src/main/java/org/openejb/alt/config/sys/ContainerTypesDescriptor.java | e58987d3dfdc7496537f1de3be008842cb738b49 | [] | no_license | codehaus/openejb | 41649552c6976bf7d2e1c2fe4bb8a3c2b82f4dcb | c4cd8d75133345a23d5a13b9dda9cb4b43efc251 | refs/heads/master | 2023-09-01T00:17:38.431680 | 2006-09-14T07:14:22 | 2006-09-14T07:14:22 | 36,228,436 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,718 | java | /*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 0.9.5.3</a>, using an XML
* Schema.
* $Id: ContainerTypesDescriptor.java,v 1.2 2004/03/31 00:45:22 dblevins Exp $
*/
package org.openejb.alt.config.sys;
//---------------------------------/
import org.exolab.castor.mapping.AccessMode;
import org.exolab.castor.xml.TypeValidator;
import org.exolab.castor.xml.XMLFieldDescriptor;
import org.exolab.castor.xml.validators.*;
public class ContainerTypesDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
private java.lang.String nsPrefix;
private java.lang.String nsURI;
private java.lang.String xmlName;
private org.exolab.castor.xml.XMLFieldDescriptor identity;
public ContainerTypesDescriptor() {
super();
nsURI = "http://www.openejb.org/System/Configuration";
xmlName = "ContainerTypes";
}
public org.exolab.castor.mapping.AccessMode getAccessMode() {
return null;
}
public org.exolab.castor.mapping.ClassDescriptor getExtends() {
return null;
}
public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
return identity;
}
public java.lang.Class getJavaClass() {
return org.openejb.alt.config.sys.ContainerTypes.class;
}
public java.lang.String getNameSpacePrefix() {
return nsPrefix;
}
public java.lang.String getNameSpaceURI() {
return nsURI;
}
public org.exolab.castor.xml.TypeValidator getValidator() {
return this;
}
public java.lang.String getXMLName() {
return xmlName;
}
}
| [
"hogstrom@2b0c1533-c60b-0410-b8bd-89f67432e5c6"
] | hogstrom@2b0c1533-c60b-0410-b8bd-89f67432e5c6 |
706f655ce20ec5ab6e8963b4d8213f7b9aaab73e | 3ae0bd49479286f2898a2b37e4c80a9aa635d06c | /src/leetcode/LinkedListInsertionSortList.java | 150ec2c07eb9ff9a13db4080af1e0ddd0b12be37 | [] | no_license | tribbianii/leetcode | a41974c2933137288b580f908b9fd98e9d08673a | 6453c63795bac8a9efaf4c3eb6383bdd99bb2e40 | refs/heads/master | 2021-08-02T15:18:29.927371 | 2021-07-23T03:39:06 | 2021-07-23T03:39:06 | 205,751,378 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 888 | java | package leetcode;
//use iterative insertion to sort list
public class LinkedListInsertionSortList{
public ListNode insertionSortList(ListNode head) {
if (head==null||head.next==null){
return head;
}
ListNode prev = new ListNode(0);
prev.next = head;
ListNode node = head;
while (node!=null&&node.next!=null){
if (node.val<=node.next.val){
node = node.next;
}
else {
ListNode curr = node.next;
ListNode temp1 = prev;
while (temp1.next.val < curr.val){
temp1 = temp1.next;
}
ListNode temp2 = curr.next;
node.next = temp2;
curr.next = temp1.next;
temp1.next = curr;
}
}
return prev.next;
}
} | [
"tribbiani108@gmail.com"
] | tribbiani108@gmail.com |
32ba03f152190a9e28ef458d04578b64e27c7cf3 | 7326e3e3baa87ecfd983c2033890324eee442d63 | /view/src/main/java/br/com/arearestrita/view/controller/BaseController.java | cf5c1c1d0b2d11bf5bc619f5b274d9c28bfbaec4 | [] | no_license | daniela-xavier/ProjetoAreaRestrita | 06430e944e93ab99cd0ed4839b41cff8248d1e62 | b2c6a2ab69e3c93158ca389f5ef9dea7b6f69baf | refs/heads/master | 2022-05-31T17:02:50.777262 | 2019-12-16T21:21:56 | 2019-12-16T21:21:56 | 162,329,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package br.com.arearestrita.view.controller;
import br.com.arearestrita.aplicacao.EntityApplication;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Description the class BaseController - Classe base para as requisiçães do
* WebService.
*
* @author Daniela Xavier Conceição - sistemas@fozadvogados.com.br
* @version $Revision: 1
* @since Build 0.1 02/12/019
*/
@RequestMapping("/")
@CrossOrigin(origins = "*")
public class BaseController extends EntityApplication {
}
| [
"daniela.xavier.con@outlook.com.br"
] | daniela.xavier.con@outlook.com.br |
2b63e6e4069a07abea7dd06e9490ad87f6e2f83a | 54f352a242a8ad6ff5516703e91da61e08d9a9e6 | /Source Codes/AtCoder/arc001/B/4014651.java | 2ccca980c4e838d74413b1d5dca51862fdf503e5 | [] | no_license | Kawser-nerd/CLCDSA | 5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb | aee32551795763b54acb26856ab239370cac4e75 | refs/heads/master | 2022-02-09T11:08:56.588303 | 2022-01-26T18:53:40 | 2022-01-26T18:53:40 | 211,783,197 | 23 | 9 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String str = sc.next();
int[] c = new int[5];
for(int i=0; i<n; i++){
int tmp = Integer.parseInt(str.substring(i,i+1));
if(tmp == 1){
c[1]++;
}else if(tmp == 2){
c[2]++;
}else if(tmp == 3){
c[3]++;
}else if(tmp == 4){
c[4]++;
}
}
int max = c[1];
int min = c[1];
for(int i=2; i<5; i++){
max = Math.max(max,c[i]);
min = Math.min(min,c[i]);
}
pl(max + " " +min);
}
private static void pr(Object o){
System.out.print(o);
}
private static void pl(Object o){
System.out.println(o);
}
} | [
"kwnafi@yahoo.com"
] | kwnafi@yahoo.com |
664d40a3cd38b87ea660ba6d55ee6655d52e4a2a | e98b82c9efff0f7e9ce16dfffd714b105a5298b8 | /taskSheduler/src/main/java/com/belova/controller/management/ManagementDbController.java | 8ae97467ccdffe93746de9a3dcd6e1d7dffda005 | [] | no_license | lionchi/TaskSheduler | cc8f2f7b00d3e210bd7b7135e6a6a9a5c4e51fbc | ee4fd8e1f488ec5a3d15d5927d14cd166612102c | refs/heads/master | 2022-06-24T01:58:30.587244 | 2020-01-06T13:36:18 | 2020-01-06T13:36:18 | 151,972,513 | 0 | 0 | null | 2022-06-21T02:35:00 | 2018-10-07T18:30:39 | Java | UTF-8 | Java | false | false | 5,002 | java | package com.belova.controller.management;
import com.belova.common.implementationRunnable.BackupData;
import com.belova.common.supporting.StorageOfTask;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
import javax.annotation.PostConstruct;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.concurrent.ScheduledFuture;
public class ManagementDbController {
public TextField pathDumpField;
public TextField pathSaveField;
public Button explorerFile;
public Button explorerDir;
public MenuItem startItem;
public MenuItem stopItem;
public AnchorPane anchorPane;
@Value("${spring.datasource.username}")
private String user;
@Value("${spring.datasource.password}")
private String password;
@Value("${db.host}")
private String host;
@Value("${db.port}")
private String port;
@Value("${db.name}")
private String database;
@Autowired
private ThreadPoolTaskScheduler taskScheduler;
@Autowired
private CronTrigger cronTriggerToBackupData;
@Autowired
private StorageOfTask storageOfTask;
private Stage stage;
@FXML
public void initialize() {
}
@PostConstruct
public void init() {
explorerDir.setOnAction(event -> showExplorerDir());
explorerFile.setOnAction(event -> showExplorerFile());
startItem.setOnAction(event -> start());
stopItem.setOnAction(event -> stop());
}
private void start() {
File file = new File("configuration.txt");
String config = pathDumpField.getText() + "," + pathSaveField.getText();
try (PrintWriter printWriter = new PrintWriter(file)) {
printWriter.write(config);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
ScheduledFuture<?> schedule = taskScheduler.schedule(new BackupData(pathDumpField.getText(), pathSaveField.getText() + "\\",
user, password, host, port, database), cronTriggerToBackupData);
storageOfTask.put(BackupData.class, schedule);
startItem.setDisable(true);
stopItem.setDisable(false);
new Alert(Alert.AlertType.INFORMATION, "Задача резервирования успешна запущена").showAndWait();
}
private void stop() {
ScheduledFuture<?> value = storageOfTask.getValue(BackupData.class);
if (!value.isCancelled()) {
value.cancel(true);
}
storageOfTask.remove(BackupData.class);
startItem.setDisable(false);
stopItem.setDisable(true);
new Alert(Alert.AlertType.INFORMATION, "Задача резервирования успешна остановлена").showAndWait();
}
private void showExplorerDir() {
DirectoryChooser directoryChooser = new DirectoryChooser();
try {
File dir = directoryChooser.showDialog(stage);
pathSaveField.setText(dir.getAbsolutePath());
} catch (NullPointerException e) {
new Alert(Alert.AlertType.ERROR, "Выберите директорию для сохранения резервных копий базы данных").showAndWait();
}
}
private void showExplorerFile() {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Выберите mysqldump.exe");
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("EXE", "*.exe"));
try {
File file = fileChooser.showOpenDialog(stage);
pathDumpField.setText(file.getAbsolutePath());
} catch (NullPointerException e) {
new Alert(Alert.AlertType.ERROR, "Выберите mysqldump.exe").showAndWait();
}
}
public void setStage(Stage stage) {
this.stage = stage;
if (storageOfTask.contains(BackupData.class)) {
startItem.setDisable(true);
stopItem.setDisable(false);
} else {
startItem.setDisable(false);
stopItem.setDisable(true);
}
}
public void setPathDumpField(String pathDump) {
this.pathDumpField.setText(pathDump);
}
public void setPathSaveField(String pathSave) {
this.pathSaveField.setText(pathSave);
}
public void setStylesheet() {
if (!anchorPane.getStylesheets().contains("css/MyStyle.css"))
anchorPane.getStylesheets().add("css/MyStyle.css");
}
}
| [
"tanya.belova19@yandex.ru"
] | tanya.belova19@yandex.ru |
58f9326f99fc377e041cad11508376d6ead74a9a | 4b6c689d069fb6453b79f8b3bf177d827a47a631 | /src/main/java/edu/cs236/lucene/JSPMain.java | 9fd3155c5b488e1285938f704c3c6264963abe11 | [] | no_license | lilott8/CS242-Search-Engine | d992039e5627adb30fa5fc4989d1308849b4401a | 29151327764c5ca6f40ed2ed3d38faf381346dd1 | refs/heads/master | 2020-05-13T20:57:04.142291 | 2014-10-13T21:27:53 | 2014-10-13T21:27:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,335 | java | package edu.cs236.lucene;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
/**
* Created by jason on 3/10/14.
*/
public class JSPMain {
public ArrayList<LuceneResult> results = new ArrayList<LuceneResult>();
public Controller controller;
public JSPMain(String query) throws Exception {
this.controller = new Controller();
this.controller.createSearcher();
this.controller.query(query, null);
results = this.controller.getResults();
}
public JSPMain(String query, String dir) throws Exception {
this.controller = new Controller(dir);
this.controller.createSearcher();
this.controller.query(query, null);
results = this.controller.getResults();
}
public String[] getResults() {
List<String> r = new ArrayList<String>();
if(results.size() > 0) {
for(LuceneResult lr : results) {
r.add(lr.getHtml());
}
return r.toArray(new String[r.size()]);
} else {
return new String[]{"No Results found"};
}
}
public double getSearchTime() {return this.controller.getSearchTime();}
public void closeSearcher() throws Exception {
this.controller.closeSearcher();
}
}
| [
"hidden"
] | hidden |
6951b71ceee73f785a28232bf0dd0091bbebb3c6 | 42e5e856325e435e16bdfc3eba9a316aab611a9b | /src/main/java/br/univel/utilitarios/StatusBar.java | d5adf033da90dc75bb95cbedd0ab9acf7d39facd | [] | no_license | thais2106/Trabalho4oBim | ca7ea50bde842b907eb39c628cb136affc8d8ea5 | 8123d93fc69b7caac103d31d6edf9a8c5a3c77fc | refs/heads/master | 2021-01-10T02:28:01.268960 | 2015-12-06T01:05:19 | 2015-12-06T01:05:19 | 45,071,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package br.univel.utilitarios;
import java.awt.Dimension;
import javax.swing.JLabel;
public class StatusBar extends JLabel {
public StatusBar() {
super();
super.setPreferredSize(new Dimension(400, 20));
setMessage("Pronto.");
}
public void setMessage(String messagem) {
setText(" " + messagem);
}
}
| [
"Thaís@Thaís-PC"
] | Thaís@Thaís-PC |
24d29144f2e6de801b6ed9f487aa63a7cdbbb6ee | 4686dd88101fa2c7bf401f1338114fcf2f3fc28e | /client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherMetaData.java | 1d84fb943f0c39dd07e32f79867ccaca38a33870 | [
"Apache-2.0",
"LicenseRef-scancode-elastic-license-2018"
] | permissive | strapdata/elassandra | 55f25be97533435d7d3ebaf9fa70d985020163e2 | b90667791768188a98641be0f758ff7cd9f411f0 | refs/heads/v6.8.4-strapdata | 2023-08-27T18:06:35.023045 | 2022-01-03T14:21:32 | 2022-01-03T14:21:32 | 41,209,174 | 1,199 | 203 | Apache-2.0 | 2022-12-08T00:38:37 | 2015-08-22T13:52:08 | Java | UTF-8 | Java | false | false | 1,603 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client.watcher;
import java.util.Objects;
public class WatcherMetaData {
private final boolean manuallyStopped;
public WatcherMetaData(boolean manuallyStopped) {
this.manuallyStopped = manuallyStopped;
}
public boolean manuallyStopped() {
return manuallyStopped;
}
@Override
public String toString() {
return "manuallyStopped["+ manuallyStopped +"]";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WatcherMetaData action = (WatcherMetaData) o;
return manuallyStopped == action.manuallyStopped;
}
@Override
public int hashCode() {
return Objects.hash(manuallyStopped);
}
}
| [
"igor@motovs.org"
] | igor@motovs.org |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.