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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fb376786f2c6e03cb7a428328eefcb6be9a0cddf | 3c5e51a8e59ff1442449a3bdd88bea60e30cfbec | /ch12_20210613/Ch12_3_stream2/Ch12_3.java | 731cce364dfe03d3a66855ddbfce63570f6f1fb7 | [] | no_license | xvpowerg/java20210321 | 8b4e5ff83ff8f9a4d2b3e1cfaae1df182b1eedb8 | 4891cc6b7d2e14cd671a67767a3b96c987b1c89f | refs/heads/main | 2023-05-30T22:41:26.632602 | 2021-06-20T09:09:16 | 2021-06-20T09:09:16 | 349,877,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,701 | 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 ch12_20210613.Ch12_3_stream2;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class Ch12_3 {
public static void main(String[] args) {
ArrayList<Student> list = new ArrayList();
Student st1 = new Student(85,"Ken");
Student st2 = new Student(96,"Vivin");
Student st3 = new Student(75,"Lucy");
Student st4 = new Student(94,"Iris");
Student st5 = new Student(51,"Tom");
Student st6 = new Student(73,"Gigi");
Student st7 = new Student(41,"Lindy");
Student st8 = new Student(76,"Joy");
Student st9 = new Student(81,"Ben");
list.add(st1);
list.add(st2);
list.add(st3);
list.add(st4);
list.add(st5);
list.add(st6);
list.add(st7);
list.add(st8);
list.add(st9);
Map<Integer,List<Student>> group =
list.stream().collect(Collectors.groupingBy(st->st.getScore()/10));
System.out.println(group);
Map<Integer,Long> groupCount =
list.stream().collect(Collectors.groupingBy(st->st.getScore()/10,
Collectors.counting()
));
System.out.println(groupCount);
Map<Boolean,List<Student>> map = list.stream().
collect(Collectors.partitioningBy(st->st.getScore()> 59));
System.out.println(map);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
de0cae78eba6595d0e6cec8f9435f346602d0602 | 8e14f68088b219265ae0565eef38f7a119ec2475 | /app/src/main/java/zhaoliang/com/hmandroid/activity/day06/secondactivity/SecondActivity.java | 420c8a604da3bf92bb6b7ee3d0c635e384f08952 | [] | no_license | BruceAnda/HMAndroid | f1c78af82d484a63f7d202ed1d9af9b8d9e3b541 | cb3fca9fd55644870ca73130b33c982eb00040fd | refs/heads/master | 2021-01-20T14:55:24.846647 | 2017-05-19T02:50:18 | 2017-05-19T02:50:18 | 90,690,592 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package zhaoliang.com.hmandroid.activity.day06.secondactivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import zhaoliang.com.hmandroid.R;
import zhaoliang.com.hmandroid.activity.day06.secondactivity.activity.SecondActivityActivity;
import zhaoliang.com.hmandroid.base.BaseBackActivity;
/**
* <pre>
* 需求:SecondActivity
* 思路:
* 1. 新建一个Activity
* </pre>
*/
public class SecondActivity extends BaseBackActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
}
/**
* 按钮点击调用这个方法
*
* @param view
*/
public void secondActivity(View view) {
startActivity(new Intent(this, SecondActivityActivity.class));
}
@Override
protected String setActionBarTitle() {
return getString(R.string.day06_title1);
}
}
| [
"2668645098@qq.com"
] | 2668645098@qq.com |
e49a868042c5c3ab37124b41d3b63ad0853580a4 | 6b1694afaef3d9b78cc286a261d02015cf078ded | /src/com/zjxfood/indiana/MyIndianaNoPayAdapter.java | 0061951cefae3e7a5bc35cedc4be8eaf1d82b5b4 | [] | no_license | twgdhz/ZjxssnnProject | ccf18a2b6ad8ce13f92ecf3868a67e708390c7be | bce015429423b12a1315d5ed2d20e18a31079ed4 | refs/heads/master | 2021-06-01T05:32:34.428952 | 2016-08-02T03:38:08 | 2016-08-02T03:38:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,545 | java | package com.zjxfood.indiana;
import java.util.ArrayList;
import java.util.HashMap;
import com.lidroid.xutils.BitmapUtils;
import com.project.util.BitmapUtilSingle;
import com.project.util.Utils;
import com.zjxfood.activity.R;
import com.zjxfood.indiana.MyIndianaOrderAdapter.ViewHolder;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MyIndianaNoPayAdapter extends BaseAdapter{
private Context mContext;
private BitmapUtils mBitmapUtils;
private LayoutInflater mInflater;
private ArrayList<HashMap<String, Object>> mList;
public MyIndianaNoPayAdapter(Context context,ArrayList<HashMap<String, Object>> list){
this.mContext = context;
this.mList = list;
mInflater = LayoutInflater.from(mContext);
mBitmapUtils = BitmapUtilSingle.getBitmapInstance(mContext);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mList.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder mHolder = null;
if(convertView==null){
convertView = mInflater.inflate(R.layout.my_indiana_no_pay_item, null);
mHolder = new ViewHolder();
mHolder.mImageView = (ImageView) convertView.findViewById(R.id.my_indiana_no_pay_item_image);
mHolder.mNameText = (TextView) convertView.findViewById(R.id.my_indiana_no_pay_item_content_name);
mHolder.mOrderText = (TextView) convertView.findViewById(R.id.my_indiana_no_pay_item_order);
convertView.setTag(mHolder);
}else{
mHolder = (ViewHolder) convertView.getTag();
}
if(mList.get(position).get("ImgUrl")!=null){
mBitmapUtils.display(mHolder.mImageView, mList.get(position).get("ImgUrl").toString());
}
if(mList.get(position).get("ProductName")!=null && mList.get(position).get("Id")!=null){
mHolder.mNameText.setText("【"+mList.get(position).get("Id")+"期】"+mList.get(position).get("ProductName"));
}
if(mList.get(position).get("OrderId")!=null){
mHolder.mOrderText.setText("订单号:"+mList.get(position).get("OrderId").toString());
}
return convertView;
}
class ViewHolder{
private ImageView mImageView;
private TextView mNameText;
private TextView mOrderText;
}
}
| [
"236543611@qq.com"
] | 236543611@qq.com |
8f379ceb5914ceeff4e3dbf67026857eea987277 | 0b547b288520cba0fac9c479d6ecb6941dd51221 | /sk.stuba.fiit.perconik.utilities/src/sk/stuba/fiit/perconik/utilities/configuration/AbstractOptions.java | 96103b5be8b59651c1174b8139ed8dd68409d3f8 | [
"MIT"
] | permissive | anukat2015/perconik | d1e25bdf9be2008723fb6e88943f7d7dc0dfaff8 | d80dc0c29df4e3faf318ee18adcaa8f03bb50aab | refs/heads/master | 2020-04-05T19:02:48.852160 | 2016-06-16T09:59:14 | 2016-06-16T09:59:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package sk.stuba.fiit.perconik.utilities.configuration;
import java.util.Map;
public abstract class AbstractOptions implements Options {
/**
* Constructor for use by subclasses.
*/
protected AbstractOptions() {}
public void fromMap(final Map<String, Object> map) {
throw new UnsupportedOperationException();
}
@Override
public String toString() {
return this.toMap().toString();
}
public Object put(final String key, final Object value) {
throw new UnsupportedOperationException();
}
public Object get(final String key) {
return this.toMap().get(key);
}
}
| [
"pavol.zbell@gmail.com"
] | pavol.zbell@gmail.com |
fbf783aad30f34c6b7503c4243eadf06ed6f6f1a | 89ffdb5a89516ba5e39ef319fa13e2f8dbab655d | /src/day30_ArrayList/ArrayList_Methods2.java | e7a6407d75a8b87eced9222cc788f6d510c877cb | [] | no_license | AizhanZ/JavaProject | 5550eb9c26c72ca55783d2458ca6851318f46c23 | b1a7c821b67dc877b129cf3ea90a8e3496267116 | refs/heads/master | 2022-11-18T19:01:19.970022 | 2020-07-13T18:47:50 | 2020-07-13T18:47:50 | 279,384,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,400 | java | package day30_ArrayList;
import java.util.ArrayList;
public class ArrayList_Methods2 {
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<>();
list.add("A");//0
list.add("B");//1
list.add("C");//2
//list.remove(1); cannot assign to boolean
//when you pass int as an index it will not work
//but string will pass
String str = "B";
boolean r1 = list.remove(str);//true
boolean r2 = list.remove("A");//true
System.out.println(list);
System.out.println(r1);
System.out.println(r2);
list.clear();//[] will delete everything
System.out.println(list);
System.out.println(list.size());
ArrayList<Integer> list2 = new ArrayList<>();
list2.add(1);//0
list2.add(1);//1
list2.add(2);//2
list2.add(3);//3
//{1,1,2,3}
int num1 = list2.indexOf(1);//0 returns as int - assign to int
//int assigned to Integer object == autoboxing
System.out.println(num1);
//index doesn't exist will give out of bounds
int num2 = list2.indexOf(100);
System.out.println(num2);
//if
//smalles index number is 0
int num3 = list2.indexOf(3);//3
System.out.println(num3);
}
}
| [
"aijan.janakova@gmail.com"
] | aijan.janakova@gmail.com |
780e4ed5c4f6a842e27e341476d7ba2fd50c4d62 | b9179e04d3739643a2cf1659ecb5398517bc1c19 | /ui/dashboard/src/main/java/demo/DashboardApplication.java | 8ff4eb180363884e2beba639c6fd95f30e7e3af8 | [
"Apache-2.0"
] | permissive | charwliu/event-stream-processing-microservices | 740a4b3a06c81dc55b281dd61dfab595a893cd41 | 92d70f62c739acae2766d95a5f817b2a8a8ba3cf | refs/heads/master | 2021-01-13T01:08:30.147211 | 2017-01-18T20:00:03 | 2017-01-18T20:00:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@SpringBootApplication
@EnableEurekaClient
@EnableZuulProxy
public class DashboardApplication {
public static void main(String[] args) {
SpringApplication.run(DashboardApplication.class, args);
}
}
| [
"kb@socialmoon.com"
] | kb@socialmoon.com |
4f2bb019f8cdb46b139073801f4ec9800877951c | b3b33fb359e8b7854448677c62543b450c3c2e41 | /LongestPalindrome.java | 7742ba38046dd257275ce0a005ea6189b43fd52b | [
"MIT"
] | permissive | tiagopnoliveira/programming | bbe81beadec8ad74daa7e19b99910252eb51745d | e00459491956f2cf55a5c7bf98b903b69c647514 | refs/heads/master | 2020-09-13T02:25:33.187180 | 2018-05-30T22:42:30 | 2018-05-30T22:42:30 | 67,540,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 920 | java | public class LongestPalindrome {
private static String input = "cbab";
public static void main(String[] args) {
long startTime = System.currentTimeMillis();
// Core Function here
System.out.println(longestPalindrome(input));
double duration = System.currentTimeMillis() - startTime;
System.out.println();
System.out.print("Processing time: ");
System.out.format("%.3f", duration / 1000);
System.out.println(" seconds.");
}
private static int longestPalindrome(String S) {
int[][] dp = new int[S.length()][S.length()];
for(int i = 0; i < dp.length; i++) {
dp[i][i] = 1;
}
for(int dist = 1; dist < dp.length; dist++) {
for(int l = 0; l < dp.length - dist; l++) {
int r = l + dist;
if(S.charAt(l) == S.charAt(r)) {
dp[l][r] = 2 + dp[l+1][r-1];
} else {
dp[l][r] = Math.max(dp[l+1][r],dp[l][r-1]);
}
}
}
return dp[0][dp.length-1];
}
}
| [
"tiagopnoliveira@gmail.com"
] | tiagopnoliveira@gmail.com |
55a2d0ae56254922516cdadce05bd7f1b0ebdad8 | bfe54324196530a0efc21feb72a2d9ff5458b680 | /cyclops-javaslang/src/main/java/com/aol/cyclops/javaslang/FromCyclopsReact.java | e52cd0ece28e318e8de6de098b89639f1c249797 | [
"MIT"
] | permissive | jayzhs/cyclops | 8ffc67be9cf6e5a1892f65713df671cdc8265a49 | ae2423f0d205363ec36242df073ed58d72928b78 | refs/heads/master | 2021-01-18T08:33:17.407023 | 2016-07-01T16:17:47 | 2016-07-01T16:17:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package com.aol.cyclops.javaslang;
import java.util.stream.Stream;
import com.aol.cyclops.control.Xor;
import com.aol.cyclops.types.MonadicValue;
import com.aol.cyclops.types.MonadicValue2;
import javaslang.concurrent.Future;
import javaslang.control.Either;
import javaslang.control.Option;
import javaslang.control.Try;
import javaslang.control.Validation;
public class FromCyclopsReact {
public static <T> javaslang.collection.Stream<T> fromStream(
Stream<T> s) {
return javaslang.collection.Stream.ofAll(()->s.iterator());
}
public static <T> Try<T> toTry(MonadicValue<T> value){
return value.toTry().visit(s->Try.success(s),f->Try.failure(f));
}
public static <T> Future<T> future(MonadicValue<T> value){
return Future.of(()->value.get());
}
public static <T> Option<T> option(MonadicValue<T> value){
return Option.ofOptional(value.toOptional());
}
public static <L,R> Either<L,R> either(MonadicValue2<L,R> value){
Xor<L,R> xor = (Xor)value.toXor();
return xor.visit(l->Either.left(l),r->Either.right(r));
}
public static <L,R> Validation<L,R> validation(MonadicValue2<L,R> value){
return Validation.fromEither(either(value));
}
}
| [
"john.mcclean@teamaol.com"
] | john.mcclean@teamaol.com |
277f9af45053ecc8c1691ac2612f6bd2d2fcf1ec | c02ef4e88e7dd643084322688f21f33a703fb150 | /model/src/main/java/io/mateu/erp/model/cms/DocumentationWebSite.java | 0c7a5a6d461777ce99e4bdaf58cc7ae49048f9af | [
"CC-BY-3.0",
"Beerware"
] | permissive | miguelperezcolom/mateu-erp | cda7e45a8bec1e3f742ceea195560f4672154d0e | f3d702ca56f3e753476787618a73b3d4ee2fd4b3 | refs/heads/master | 2022-09-16T17:50:25.067718 | 2019-07-02T04:00:44 | 2019-07-02T04:00:44 | 68,085,644 | 0 | 2 | NOASSERTION | 2022-09-01T22:26:31 | 2016-09-13T07:31:00 | Java | UTF-8 | Java | false | false | 623 | java | package io.mateu.erp.model.cms;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Entity;
import java.io.File;
import java.util.List;
@Entity
@Getter
@Setter
public class DocumentationWebSite extends Website {
@Override
public void addLinesAfterGit(List<String> lines, File where) {
lines.add("rm -rf build/*");
lines.add("make html");
lines.add("rst2pdf source/index.rst build/html/manual.pdf");
}
/*
#!/bin/sh
cd /home/doc/quoon-usermanual
git pull
rm -rf build/*
make html
rst2pdf source/index.rst build/html/manual.pdf
*/
}
| [
"miguelperezcolom@gmail.com"
] | miguelperezcolom@gmail.com |
14ba94101b8a024b60393ee72f955c197e079ba0 | 54317fb77aba4bd45eae78883fa48d1b4777b1fb | /ecomShopping/src/main/java/services/authenticationFilter.java | da1b724480b6d9cef51587a54e581120983de82f | [] | no_license | mohdrezki/cs472 | 15899c25a3867f245f8f29e49cb1173ee64db59e | f597b4daa80d76e1b88574382448716ac5685fb7 | refs/heads/master | 2020-03-22T20:39:21.475764 | 2018-07-17T14:58:31 | 2018-07-17T14:58:31 | 140,619,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,305 | java | package services;
import utilities.ApplicationParams;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebFilter(urlPatterns = {"/checkout", "/account"})
public class authenticationFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
HttpSession session = request.getSession(false);
String loginPath = request.getContextPath() + ApplicationParams.LOGIN_PAGE_SHORT_LINK;
boolean isUserLoggedIn = (session != null && session.getAttribute(ApplicationParams.USERNAME_PARAM) != null);
if (isUserLoggedIn) {
chain.doFilter(request, response);
} else {
response.sendRedirect(loginPath);
}
}
@Override
public void init(FilterConfig filterConfig) {
System.out.println("init method ...");
}
@Override
public void destroy() {
System.out.println("destroy method ...");
}
} | [
"mohammed.rezki17@gmail.com"
] | mohammed.rezki17@gmail.com |
7fc95f9a2a1acf3028b827f9dc4a47de4949d554 | 9197cfec38f79300be59076e52d9934da0aa0007 | /DeclareAndEnum/src/ClothingSize.java | 456c2a9e5110f118c7fba1abaf15f5284d49369d | [] | no_license | Karthick-M-18/Java_Course2_davidgassner | 93fd73df911216112ea449feeb921762a445d3cc | ac4efd2e7a89ed46ceeb22e3dcf6806c702916dc | refs/heads/master | 2023-01-23T17:49:48.259374 | 2020-11-28T05:46:25 | 2020-11-28T05:46:25 | 316,666,024 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | public enum ClothingSize {
S("Small"),M("Medium"),L("Large");
private String description;
ClothingSize(String description){
this.description = description;
}
@Override
public String toString() {
return description;
}
}
| [
"karthickmurugesan18@gmail.com"
] | karthickmurugesan18@gmail.com |
d5fbe374099c1257a3511deefb66cffc3fe05db5 | 4368ffa053e37d56d8ac367bb89b3fd488e0393c | /a1/src/HelloThread.java | ebb9012919f512eb26dd4709181fa1211d6c7f88 | [] | no_license | anmolgautam151/CS7301 | f31764bc8b58ed3111ff9419fdef0c8e781a9989 | 0fb31f4c4b8050e824abd37b2ae2ceaa993fbd6e | refs/heads/master | 2023-01-25T01:03:46.595746 | 2020-12-11T18:13:30 | 2020-12-11T18:13:30 | 320,397,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | public class HelloThread {
static int x=1;
public static void main(String[] args) {
TestThread t = new TestThread();
t.start();
//race here, may throw divide by zero exception
int z = t.y+1/x;
System.out.println(z);
}
static class TestThread extends Thread{
int y;
public void run(){
x=0;
y++;
}
}
} | [
"anmolgautam151@gmail.com"
] | anmolgautam151@gmail.com |
f1b0fc320f28100ab094c1e2b3c24d4229415370 | 785b12f81a3c6e3d6d5a4060fc61de12b2d252c0 | /scxml.diagram/src/scxml/diagram/edit/parts/ValidateSchema4EditPart.java | 4318d740ee4a96953d2e2710d2d1062352606444 | [] | no_license | marcofranke/SCXMLEditor | cb61133dcc02ee13c12d2cb24f8221d6f03badd4 | 2545f6647620ddcd770002e8b0bfcf55d7f1fabd | refs/heads/master | 2020-03-13T04:49:26.902881 | 2018-04-25T07:57:52 | 2018-04-25T07:57:53 | 130,970,656 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,240 | java | package scxml.diagram.edit.parts;
import java.util.Collections;
import java.util.List;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.requests.DirectEditRequest;
import org.eclipse.gef.tools.DirectEditManager;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
import org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate;
import org.eclipse.gmf.runtime.diagram.ui.label.WrappingLabelDelegate;
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.tooling.runtime.draw2d.labels.SimpleLabelDelegate;
import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import scxml.diagram.edit.policies.ScxmlTextSelectionEditPolicy;
import scxml.diagram.part.ScxmlVisualIDRegistry;
import scxml.diagram.providers.ScxmlElementTypes;
import scxml.diagram.providers.ScxmlParserProvider;
/**
* @generated
*/
public class ValidateSchema4EditPart extends CompartmentEditPart implements ITextAwareEditPart {
/**
* @generated
*/
public static final int VISUAL_ID = 5063;
/**
* @generated
*/
private DirectEditManager manager;
/**
* @generated
*/
private IParser parser;
/**
* @generated
*/
private List<?> parserElements;
/**
* @generated
*/
private String defaultText;
/**
* @generated
*/
private ILabelDelegate labelDelegate;
/**
* @generated
*/
public ValidateSchema4EditPart(View view) {
super(view);
}
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ScxmlTextSelectionEditPolicy());
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
}
/**
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
if (figure instanceof WrappingLabel) {
return ((WrappingLabel) figure).getText();
} else if (figure instanceof Label) {
return ((Label) figure).getText();
} else {
return getLabelDelegate().getText();
}
}
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
if (figure instanceof WrappingLabel) {
((WrappingLabel) figure).setText(text);
} else if (figure instanceof Label) {
((Label) figure).setText(text);
} else {
getLabelDelegate().setText(text);
}
}
/**
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
if (figure instanceof WrappingLabel) {
return ((WrappingLabel) figure).getIcon();
} else if (figure instanceof Label) {
return ((Label) figure).getIcon();
} else {
return getLabelDelegate().getIcon(0);
}
}
/**
* @generated
*/
protected void setLabelIconHelper(IFigure figure, Image icon) {
if (figure instanceof WrappingLabel) {
((WrappingLabel) figure).setIcon(icon);
return;
} else if (figure instanceof Label) {
((Label) figure).setIcon(icon);
return;
} else {
getLabelDelegate().setIcon(icon, 0);
}
}
/**
* @generated
*/
public void setLabel(WrappingLabel figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
registerVisuals();
refreshVisuals();
}
/**
* @generated
*/
@SuppressWarnings("rawtypes")
protected List getModelChildren() {
return Collections.EMPTY_LIST;
}
/**
* @generated
*/
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
/**
* @generated
*/
protected EObject getParserElement() {
return resolveSemanticElement();
}
/**
* @generated
*/
protected Image getLabelIcon() {
EObject parserElement = getParserElement();
if (parserElement == null) {
return null;
}
return ScxmlElementTypes.getImage(parserElement.eClass());
}
/**
* @generated
*/
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
}
/**
* @generated
*/
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
refreshSelectionFeedback();
}
/**
* @generated
*/
public String getEditText() {
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
}
/**
* @generated
*/
protected boolean isEditable() {
return getParser() != null;
}
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
public String isValid(final Object value) {
if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
.runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() {
public void run() {
setResult(
parser.isValidEditString(new EObjectAdapter(element), (String) value));
}
});
return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
// shouldn't get here
return null;
}
};
}
/**
* @generated
*/
public IContentAssistProcessor getCompletionProcessor() {
if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
}
/**
* @generated
*/
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
/**
* @generated
*/
public IParser getParser() {
if (parser == null) {
parser = ScxmlParserProvider.getParser(ScxmlElementTypes.Validate_3055, getParserElement(),
ScxmlVisualIDRegistry.getType(scxml.diagram.edit.parts.ValidateSchema4EditPart.VISUAL_ID));
}
return parser;
}
/**
* @generated
*/
protected DirectEditManager getManager() {
if (manager == null) {
setManager(new TextDirectEditManager(this, null, ScxmlEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
/**
* @generated
*/
protected void setManager(DirectEditManager manager) {
this.manager = manager;
}
/**
* @generated
*/
protected void performDirectEdit() {
getManager().show();
}
/**
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
if (getManager().getClass() == TextDirectEditManager.class) {
((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
}
}
/**
* @generated
*/
private void performDirectEdit(char initialCharacter) {
if (getManager() instanceof TextDirectEditManager) {
((TextDirectEditManager) getManager()).show(initialCharacter);
} else //
{
performDirectEdit();
}
}
/**
* @generated
*/
protected void performDirectEditRequest(Request request) {
final Request theRequest = request;
try {
getEditingDomain().runExclusive(new Runnable() {
public void run() {
if (isActive() && isEditable()) {
if (theRequest.getExtendedData()
.get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
Character initialChar = (Character) theRequest.getExtendedData()
.get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
performDirectEdit(initialChar.charValue());
} else if ((theRequest instanceof DirectEditRequest)
&& (getEditText().equals(getLabelText()))) {
DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
}
}
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* @generated
*/
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
refreshFont();
refreshFontColor();
refreshUnderline();
refreshStrikeThrough();
}
/**
* @generated
*/
protected void refreshLabel() {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
refreshSelectionFeedback();
}
/**
* @generated
*/
protected void refreshUnderline() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
}
}
/**
* @generated
*/
protected void refreshStrikeThrough() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
}
}
/**
* @generated
*/
protected void refreshFont() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
if (style != null) {
FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
/**
* @generated
*/
private void refreshSelectionFeedback() {
requestEditPolicyFeedbackRefresh(EditPolicy.PRIMARY_DRAG_ROLE);
requestEditPolicyFeedbackRefresh(EditPolicy.SELECTION_FEEDBACK_ROLE);
}
/**
* @generated
*/
private void requestEditPolicyFeedbackRefresh(String editPolicyKey) {
Object editPolicy = getEditPolicy(editPolicyKey);
if (editPolicy instanceof IRefreshableFeedbackEditPolicy) {
((IRefreshableFeedbackEditPolicy) editPolicy).refreshFeedback();
}
}
/**
* @generated
*/
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
/**
* @generated
*/
protected void addSemanticListeners() {
if (getParser() instanceof ISemanticParser) {
EObject element = resolveSemanticElement();
parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
for (int i = 0; i < parserElements.size(); i++) {
addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
}
} else {
super.addSemanticListeners();
}
}
/**
* @generated
*/
protected void removeSemanticListeners() {
if (parserElements != null) {
for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
super.removeSemanticListeners();
}
}
/**
* @generated
*/
protected AccessibleEditPart getAccessibleEditPart() {
if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
public void getName(AccessibleEvent e) {
e.result = getLabelTextHelper(getFigure());
}
};
}
return accessibleEP;
}
/**
* @generated
*/
private View getFontStyleOwnerView() {
return getPrimaryView();
}
/**
* @generated
*/
private ILabelDelegate getLabelDelegate() {
if (labelDelegate == null) {
IFigure label = getFigure();
if (label instanceof WrappingLabel) {
labelDelegate = new WrappingLabelDelegate((WrappingLabel) label);
} else {
labelDelegate = new SimpleLabelDelegate((Label) label);
}
}
return labelDelegate;
}
/**
* @generated
*/
@Override
public Object getAdapter(Class key) {
if (ILabelDelegate.class.equals(key)) {
return getLabelDelegate();
}
return super.getAdapter(key);
}
/**
* @generated
*/
protected void addNotationalListeners() {
super.addNotationalListeners();
addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
}
/**
* @generated
*/
protected void removeNotationalListeners() {
super.removeNotationalListeners();
removeListenerFilter("PrimaryView"); //$NON-NLS-1$
}
/**
* @generated
*/
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
Integer c = (Integer) event.getNewValue();
setFontColor(DiagramColorRegistry.getInstance().getColor(c));
} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
refreshUnderline();
} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
refreshStrikeThrough();
} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature)
|| NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature)
|| NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
refreshFont();
} else {
if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
refreshLabel();
}
if (getParser() instanceof ISemanticParser) {
ISemanticParser modelParser = (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
super.handleNotificationEvent(event);
}
/**
* @generated
*/
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
}
| [
"sir@biba.uni-bremen.de"
] | sir@biba.uni-bremen.de |
46f457096bbc7c3b5617d7a7b9c982a52947a1b0 | 6d320383781e677dc12123adf70bdee3ebacfc13 | /project2_queues/src/main/java/Deque.java | 0372a5a0b521df76b62e64ab1b2bf93fc99393db | [] | no_license | fkruege/algs1Coursera | da7bd2bf6fa8e5861293bc284e3cfcdc6fde2bbd | d7e1705de79550401e40eee56ac951cfceae559c | refs/heads/master | 2021-01-12T06:27:04.076440 | 2017-02-06T00:55:04 | 2017-02-06T00:55:04 | 77,360,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,915 | java | import java.util.AbstractCollection;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Created by fkruege on 1/1/17.
*/
public class Deque<Item> implements Iterable<Item> {
private static final int DEFAULT_SIZE = 1;
private static final int DEFAULT_FIRST_LAST_INDEX = 0;
private int _size = 0;
private int _firstIndex = DEFAULT_FIRST_LAST_INDEX;
private int _lastIndex = DEFAULT_FIRST_LAST_INDEX;
private Item[] _items;
// construct an empty deque
public Deque() {
_items = (Item[]) new Object[DEFAULT_SIZE];
_size = 0;
initFirstLast();
}
public Iterator<Item> iterator() {
return new FrontToEndIterator(_items, _firstIndex, _lastIndex);
}
private void initFirstLast() {
_firstIndex = DEFAULT_FIRST_LAST_INDEX;
_lastIndex = DEFAULT_FIRST_LAST_INDEX;
}
// is the deque empty?
public boolean isEmpty() {
return _size <= 0;
}
// return the number of _items on the deque
public int size() {
return _size;
}
// add the item to the front
public void addFirst(Item item) {
checkItemAdded(item);
_size++;
if (_size == 1) {
initFirstLast();
} else {
if (_firstIndex + 1 >= _items.length) {
doubleAndCopyItems();
}
_firstIndex++;
}
_items[_firstIndex] = item;
}
// add the item to the end
public void addLast(Item item) {
checkItemAdded(item);
_size++;
if (_size == 1) {
initFirstLast();
} else {
if (_lastIndex - 1 < 0) {
doubleAndCopyItems();
}
_lastIndex--;
}
_items[_lastIndex] = item;
}
// remove and return the item from the front
public Item removeFirst() {
if (_size <= 0) {
throw new NoSuchElementException("");
}
Item value = _items[_firstIndex];
_items[_firstIndex] = null;
_size--;
_firstIndex--;
if(isItemsTooSmall()){
halfAndCopyItems();
}
return value;
}
// remove and return the item from the end
public Item removeLast() {
if (_size <= 0) {
throw new NoSuchElementException("");
}
Item value = _items[_lastIndex];
_items[_lastIndex] = null;
_size--;
_lastIndex++;
return value;
}
private void doubleAndCopyItems() {
int doubleSize = (_items.length * 2) + 1;
Item[] newItems = (Item[]) new Object[doubleSize];
int newMiddle = doubleSize / 2;
int offset = _items.length / 2;
int newLastIndex = newMiddle - offset;
int newIndex = newLastIndex;
// copy all elements starting at the head of the old _items array
for (int i = _lastIndex; i <= _firstIndex; i++) {
newItems[newIndex++] = _items[i];
}
// point to the new array and initialize the first and _last indexes
_items = newItems;
_firstIndex = newIndex - 1;
_lastIndex = newLastIndex;
}
private boolean isItemsTooSmall() {
return _size > 0 && _size <= _items.length / 4;
}
private void halfAndCopyItems() {
int halfSize = _items.length / 2;
Item[] newItems = (Item[]) new Object[halfSize];
int newMiddle = halfSize / 2;
int offset = _size / 2;
int newLastIndex = newMiddle - offset;
int newIndex = newLastIndex;
// copy all elements starting at the head of the old _items array
for (int i = _lastIndex; i <= _firstIndex; i++) {
newItems[newIndex++] = _items[i];
}
// point to the new array and initialize the first and _last indexes
_items = newItems;
_firstIndex = newIndex - 1;
_lastIndex = newLastIndex;
}
private void checkItemAdded(Item item) {
if (item == null) {
throw new NullPointerException("Item is null");
}
}
private class FrontToEndIterator implements Iterator<Item> {
private Item[] _items;
private int _first;
private int _last;
public FrontToEndIterator(Item[] items, int first, int last) {
_items = items;
_first = first + 1;
_last = last;
}
public boolean hasNext() {
return _first - 1 >= _last;
}
public Item next() {
_first--;
if (_first < _last) {
throw new NoSuchElementException();
}
return _items[_first];
}
public void remove() {
throw new UnsupportedOperationException();
}
}
// unit testing
public static void main(String[] args) {
}
}
| [
"francis.krueger@metova.com"
] | francis.krueger@metova.com |
1a6f624fcc0a25cd122af7ade8cec23000274e7e | bfdf553fc56bd7a7f57acf06b4b8425d8eb4ec2f | /src/main/java/codewars/tasks/java/calculator/Triangle.java | 04f71f03aaa8ef0e6ad5e15c2a07959df6af8cf8 | [] | no_license | yana-muntianu/codewars-tasks-java | 18a8f9dde1153e4fa4f96a4b5f0dd31cafea9ab1 | b8babbea94839490048eba560d39d9677b2b53a0 | refs/heads/master | 2022-01-12T21:19:33.981599 | 2020-04-14T11:48:11 | 2020-04-14T11:48:11 | 237,474,084 | 2 | 0 | null | 2022-01-04T16:36:15 | 2020-01-31T16:49:28 | Java | UTF-8 | Java | false | false | 314 | java | package codewars.tasks.java.calculator;
public class Triangle extends Figure {
private double base;
private double height;
public Triangle(double base, double height){
this.base = base;
this.height = height;
}
public double getArea(){
return (base/2)*height;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
2ccc1bdd5cfc0757323219ef9978bbdbc4c2388e | f064bc60e33a92031176f4e6942f08c0e8bd2f2e | /src/main/java/com/service/RepresentanteService.java | d1e2646a30f9c9846c4340e3bdb8ae4a01a0f383 | [
"MIT"
] | permissive | carlosgrau/supportWeb | 253460584998415fb2cdf8594259346121b0c897 | 09d07a27590d085e1ab0e4188bdae327896fe1d6 | refs/heads/master | 2022-06-24T08:50:48.816599 | 2019-05-27T08:29:39 | 2019-05-27T08:29:39 | 188,802,838 | 0 | 0 | MIT | 2022-06-21T01:10:52 | 2019-05-27T08:26:52 | PLpgSQL | UTF-8 | Java | false | false | 9,743 | 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.service;
import com.bean.RepresentanteBean;
import com.bean.ReplyBean;
import com.bean.RepresentanteBean;
import com.bean.UsuarioBean;
import com.connection.specificimplementation.HikariConnectionForUser;
import com.dao.RepresentanteDao;
import com.dao.RepresentanteDao;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.helper.ParameterCook;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
/**
*
* @author a021792876p
*/
public class RepresentanteService {
HttpServletRequest oRequest;
String ob = null;
String usuario, password, conexion;
public RepresentanteService(HttpServletRequest oRequest) {
super();
this.oRequest = oRequest;
if ("representante".equals(oRequest.getParameter("ob"))) {
ob = "dat005a";
};
}
public ReplyBean get() throws Exception {
ReplyBean oReplyBean;
Connection oConnection = null;
UsuarioBean oUsuarioBean = null;
HikariConnectionForUser oHikariConectio = new HikariConnectionForUser();
try {
Integer id = Integer.parseInt(oRequest.getParameter("id"));
Integer empresa = Integer.parseInt(oRequest.getParameter("ejercicio"));
oUsuarioBean = (UsuarioBean) oRequest.getSession().getAttribute("user");
usuario = oUsuarioBean.getLoginCli();
password = oUsuarioBean.getPassCli();
conexion = oUsuarioBean.newConnectionClient();
oConnection = (Connection) oHikariConectio.newConnectionParams(usuario, password, conexion);
RepresentanteDao oRepresentanteDao = new RepresentanteDao(oConnection, ob);
RepresentanteBean oRepresentanteBean = oRepresentanteDao.get(id, empresa, 1);
Gson oGson = new Gson();
oReplyBean = new ReplyBean(200, oGson.toJson(oRepresentanteBean));
} catch (Exception ex) {
throw new Exception("ERROR: Service level: get method: " + ob + " object", ex);
} finally {
if (oConnection != null) {
oConnection.close();
}
oHikariConectio.disposeConnection();
}
return oReplyBean;
}
public ReplyBean getpage() throws Exception {
ReplyBean oReplyBean;
Connection oConnection = null;
UsuarioBean oUsuarioBean = null;
HikariConnectionForUser oHikariConectio = new HikariConnectionForUser();
try {
Integer iRpp = Integer.parseInt(oRequest.getParameter("rpp"));
Integer iPage = Integer.parseInt(oRequest.getParameter("page"));
Integer empresa = Integer.parseInt(oRequest.getParameter("ejercicio"));
HashMap<String, String> hmOrder = ParameterCook.getOrderParams(oRequest.getParameter("order"));
oUsuarioBean = (UsuarioBean) oRequest.getSession().getAttribute("user");
usuario = oUsuarioBean.getLoginCli();
password = oUsuarioBean.getPassCli();
conexion = oUsuarioBean.newConnectionClient();
oConnection = (Connection) oHikariConectio.newConnectionParams(usuario, password, conexion);
RepresentanteDao oRepresentanteDao = new RepresentanteDao(oConnection, ob);
ArrayList<RepresentanteBean> alRepresentanteBean = oRepresentanteDao.getpage(iRpp, iPage, empresa, hmOrder);
Gson oGson = new Gson();
oReplyBean = new ReplyBean(200, oGson.toJson(alRepresentanteBean));
} catch (Exception ex) {
throw new Exception("ERROR: Service level: getpage method: " + ob + " object", ex);
} finally {
if (oConnection != null) {
oConnection.close();
}
oHikariConectio.disposeConnection();
}
return oReplyBean;
}
public ReplyBean getcount() throws Exception {
ReplyBean oReplyBean;
Connection oConnection = null;
UsuarioBean oUsuarioBean = null;
HikariConnectionForUser oHikariConectio = new HikariConnectionForUser();
try {
Integer empresa = Integer.parseInt(oRequest.getParameter("ejercicio"));
oUsuarioBean = (UsuarioBean) oRequest.getSession().getAttribute("user");
usuario = oUsuarioBean.getLoginCli();
password = oUsuarioBean.getPassCli();
conexion = oUsuarioBean.newConnectionClient();
oConnection = (Connection) oHikariConectio.newConnectionParams(usuario, password, conexion);
RepresentanteDao oRepresentanteDao = new RepresentanteDao(oConnection, ob);
int registros = oRepresentanteDao.getcount(empresa);
Gson oGson = new Gson();
oReplyBean = new ReplyBean(200, oGson.toJson(registros));
} catch (Exception ex) {
throw new Exception("ERROR: Service level: getpage method: " + ob + " object", ex);
} finally {
if (oConnection != null) {
oConnection.close();
}
oHikariConectio.disposeConnection();
}
return oReplyBean;
}
public ReplyBean create() throws Exception {
ReplyBean oReplyBean;
Connection oConnection = null;
UsuarioBean oUsuarioBean = null;
HikariConnectionForUser oHikariConectio = new HikariConnectionForUser();
try {
String strJsonFromClient = oRequest.getParameter("json");
Gson oGson = (new GsonBuilder()).excludeFieldsWithoutExposeAnnotation().create();
RepresentanteBean oRepresentanteBean = new RepresentanteBean();
oRepresentanteBean = oGson.fromJson(strJsonFromClient, RepresentanteBean.class);
oUsuarioBean = (UsuarioBean) oRequest.getSession().getAttribute("user");
usuario = oUsuarioBean.getLoginCli();
password = oUsuarioBean.getPassCli();
conexion = oUsuarioBean.newConnectionClient();
oConnection = (Connection) oHikariConectio.newConnectionParams(usuario, password, conexion);
RepresentanteDao oRepresentanteDao = new RepresentanteDao(oConnection, ob);
oRepresentanteBean = oRepresentanteDao.create(oRepresentanteBean);
oReplyBean = new ReplyBean(200, oGson.toJson(oUsuarioBean));
} catch (Exception ex) {
throw new Exception("ERROR: Service level: create method: " + ob + " object", ex);
} finally {
if (oConnection != null) {
oConnection.close();
}
oHikariConectio.disposeConnection();
}
return oReplyBean;
}
public ReplyBean update() throws Exception {
ReplyBean oReplyBean;
Connection oConnection = null;
UsuarioBean oUsuarioBean = null;
HikariConnectionForUser oHikariConectio = new HikariConnectionForUser();
try {
String strJsonFromClient = oRequest.getParameter("json");
Gson oGson = (new GsonBuilder()).excludeFieldsWithoutExposeAnnotation().create();
RepresentanteBean oRepresentanteBean = new RepresentanteBean();
oRepresentanteBean = oGson.fromJson(strJsonFromClient, RepresentanteBean.class);
oUsuarioBean = (UsuarioBean) oRequest.getSession().getAttribute("user");
usuario = oUsuarioBean.getLoginCli();
password = oUsuarioBean.getPassCli();
conexion = oUsuarioBean.newConnectionClient();
oConnection = (Connection) oHikariConectio.newConnectionParams(usuario, password, conexion);
RepresentanteDao oRepresentanteDao = new RepresentanteDao(oConnection, ob);
int registros = oRepresentanteDao.update(oRepresentanteBean);
oReplyBean = new ReplyBean(200, oGson.toJson(registros));
} catch (Exception ex) {
throw new Exception("ERROR: Service level: create method: " + ob + " object", ex);
} finally {
if (oConnection != null) {
oConnection.close();
}
oHikariConectio.disposeConnection();
}
return oReplyBean;
}
public ReplyBean remove() throws Exception {
ReplyBean oReplyBean;
Connection oConnection = null;
UsuarioBean oUsuarioBean = null;
HikariConnectionForUser oHikariConectio = new HikariConnectionForUser();
try {
Integer id = Integer.parseInt(oRequest.getParameter("id"));
Integer empresa = Integer.parseInt(oRequest.getParameter("ejercicio"));
oUsuarioBean = (UsuarioBean) oRequest.getSession().getAttribute("user");
usuario = oUsuarioBean.getLoginCli();
password = oUsuarioBean.getPassCli();
conexion = oUsuarioBean.newConnectionClient();
oConnection = (Connection) oHikariConectio.newConnectionParams(usuario, password, conexion);
RepresentanteDao oRepresentanteDao = new RepresentanteDao(oConnection, ob);
int registros = oRepresentanteDao.remove(id, empresa);
Gson oGson = new Gson();
oReplyBean = new ReplyBean(200, oGson.toJson(registros));
} catch (Exception ex) {
throw new Exception("ERROR: Service level: get method: " + ob + " object", ex);
} finally {
if (oConnection != null) {
oConnection.close();
}
oHikariConectio.disposeConnection();
}
return oReplyBean;
}
}
| [
"GADE@DESKTOP-R8C3D2E"
] | GADE@DESKTOP-R8C3D2E |
e27a80b2b4a4a1791eb36a974b478e33b6afb25d | 398680342b46f253446bc7073786b1f88e6e0345 | /src/com/san/Algorithm/二叉树中第二小的节点_671.java | 5b74740992cadfc9251a9c2e84fdf53ff6ac7b8f | [] | no_license | Gxyx/Data_Structure | b4d5624c9d56a1515f37159d6876dbf86422b396 | bd68f72f5f1d866b81f49c0810f7a8b67bc81f7e | refs/heads/master | 2023-05-05T08:04:36.953387 | 2021-05-28T01:26:17 | 2021-05-28T01:26:17 | 323,637,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | package com.san.Algorithm;
/**
* @Auther: Gxyx
* @Date: 2021/01/28/23:24
*/
public class 二叉树中第二小的节点_671 {
/**
* 给定一个非空特殊的二叉树,每个节点都是正数,并且每个节点的子节点数量只能为2或0。
* 如果一个节点有两个子节点的话,那么该节点的值等于两个子节点中较小的一个。
*
* 如果有子节点,那么根节点是最小的节点。
*/
public int findSecondMinimumValue(TreeNode root) {
if (root == null) return -1;
if (root.left == null && root.right == null) return -1;
int leftVal = root.left.val;
int rightVal = root.right.val;
if (leftVal == root.val) leftVal = findSecondMinimumValue(root.left);
if (rightVal == root.val) rightVal = findSecondMinimumValue(root.right);
if (leftVal != -1 && rightVal != -1) return Math.min(leftVal, rightVal);
if (leftVal != -1) return leftVal;
return rightVal;
}
}
| [
"50070756+sanqi777@users.noreply.github.com"
] | 50070756+sanqi777@users.noreply.github.com |
76412987f4fada305186768e884701473b6b0771 | e3ad8ff6e479d906ea3f4d586f9e044088a26dbe | /core/src/test/java/org/wso2/carbon/kernel/securevault/SecureVaultConfigurationProviderTest.java | 29b6bf08a1116a6dcbb4bbafc951db9e5774290a | [
"Apache-2.0"
] | permissive | kasunsiyambalapitiya/m3-feature-uninstall-with-patch-version | ff5229ff12fd6da9576ac5deba7de6c4fbf52ce6 | 3058f882021fdf15a5df34c541efeafda840ba6d | refs/heads/master | 2021-01-11T13:55:17.807124 | 2017-06-23T12:30:23 | 2017-06-23T12:30:23 | 94,893,811 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,332 | java | /*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.kernel.securevault;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.wso2.carbon.kernel.Constants;
import org.wso2.carbon.kernel.internal.securevault.SecureVaultConfigurationProvider;
import org.wso2.carbon.kernel.securevault.config.model.MasterKeyReaderConfiguration;
import org.wso2.carbon.kernel.securevault.config.model.SecretRepositoryConfiguration;
import org.wso2.carbon.kernel.securevault.config.model.SecureVaultConfiguration;
import org.wso2.carbon.kernel.securevault.exception.SecureVaultException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
/**
* Unit tests class for org.wso2.carbon.kernel.internal.securevault.SecureVaultConfigurationProvider.
*
* @since 5.2.0
*/
public class SecureVaultConfigurationProviderTest {
private static final Path secureVaultResourcesPath = Paths.get("src", "test", "resources", "securevault");
@BeforeTest
public void setup() {
}
@Test(expectedExceptions = SecureVaultException.class)
public void testGetConfigurationNoConfigFile() throws SecureVaultException {
System.setProperty(Constants.CARBON_HOME, Paths.get(secureVaultResourcesPath.toString(),
"nonExisting").toString());
SecureVaultConfigurationProvider.getConfiguration();
}
@Test(dependsOnMethods = {"testGetConfigurationNoConfigFile"})
public void testGetConfiguration() throws SecureVaultException {
System.setProperty(Constants.CARBON_HOME, Paths.get(secureVaultResourcesPath.toString()).toString());
SecureVaultConfiguration secureVaultConfiguration = SecureVaultConfigurationProvider.getConfiguration();
Assert.assertNotNull(secureVaultConfiguration);
}
@Test(dependsOnMethods = {"testGetConfiguration"})
public void testReadSecretRepositoryConfig() {
System.setProperty(Constants.CARBON_HOME, Paths.get(secureVaultResourcesPath.toString()).toString());
SecureVaultConfiguration secureVaultConfiguration;
try {
secureVaultConfiguration = SecureVaultConfigurationProvider.getConfiguration();
} catch (SecureVaultException e) {
Assert.fail("Unable to get Secure Vault Configuration.");
return;
}
SecretRepositoryConfiguration secretRepositoryConfiguration = secureVaultConfiguration
.getSecretRepositoryConfig();
Assert.assertEquals(secretRepositoryConfiguration.getType().get(),
"org.wso2.carbon.kernel.securevault.repository.DefaultSecretRepository");
Assert.assertEquals(secretRepositoryConfiguration.getParameter("privateKeyAlias").get(), "wso2carbon");
}
@Test(dependsOnMethods = {"testGetConfiguration"})
public void testReadMasterKeyReaderConfig() {
System.setProperty(Constants.CARBON_HOME, Paths.get(secureVaultResourcesPath.toString()).toString());
SecureVaultConfiguration secureVaultConfiguration;
try {
secureVaultConfiguration = SecureVaultConfigurationProvider.getConfiguration();
} catch (SecureVaultException e) {
Assert.fail("Unable to get Secure Vault Configuration.");
return;
}
MasterKeyReaderConfiguration masterKeyReaderConfiguration = secureVaultConfiguration
.getMasterKeyReaderConfig();
Assert.assertEquals(masterKeyReaderConfiguration.getType().get(),
"org.wso2.carbon.kernel.securevault.utils.DefaultHardCodedMasterKeyReader");
Assert.assertEquals(masterKeyReaderConfiguration.getParameter("nonExistingParam"), Optional.empty());
}
}
| [
"kasun.siyambalapitiya@gmail.com"
] | kasun.siyambalapitiya@gmail.com |
9e8a88eb80fed2da36eaa147396ea303c93ed712 | 136d6d2d399542c63dc661fc31324e4d7d8be3ca | /Givvr/src/com/tech/givvruk/utils/Utilities.java | cda302b7c89286300328e7d80bd33f8784026dc5 | [] | no_license | omprakashmishra/GivvrUk | ec721fe78848fdd946228eba818e239ce8c57c29 | 93a19184b381cae52ae052c061ec3f4e070be5a6 | refs/heads/master | 2016-09-13T06:37:25.027508 | 2016-04-12T09:12:38 | 2016-04-12T09:12:38 | 56,040,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,978 | java | package com.tech.givvruk.utils;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.GradientDrawable.Orientation;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.Log;
import android.view.Gravity;
import android.view.TextureView;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import com.elgroup.givvruk.R;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import java.util.Calendar;
public class Utilities {
public static LayerDrawable MyProgressLayer(Context context,String colorString)
{
BitmapDrawable shape = (BitmapDrawable) context.getResources().getDrawable(R.drawable.stripe);
ClipDrawable clip2 = new ClipDrawable(shape, Gravity.LEFT,ClipDrawable.HORIZONTAL);
GradientDrawable shape2 = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{Color.parseColor(colorString),Color.parseColor(colorString)});
shape2.setCornerRadius(50);
ClipDrawable clip = new ClipDrawable(shape2, Gravity.LEFT,ClipDrawable.HORIZONTAL);
GradientDrawable shape1 = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{Color.WHITE, context.getResources().getColor(R.color.white)});
shape1.setCornerRadius(50);//change the corners of the rectangle
InsetDrawable d1= new InsetDrawable(shape1,0,0,0,0);//the padding u want to use
LayerDrawable mylayer = new LayerDrawable(new Drawable[]{d1,clip,clip2});
return mylayer;
}
public static LayerDrawable MyButtonLayer(Context context,String colorString)
{
GradientDrawable shape1 = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{Color.parseColor(colorString),Color.parseColor(colorString)});
shape1.setCornerRadius(100);//change the corners of the rectangle
InsetDrawable d1= new InsetDrawable(shape1,0,0,0,0);//the padding u want to use
LayerDrawable mylayer = new LayerDrawable(new Drawable[]{d1});
return mylayer;
}
public static LayerDrawable MyPlayButtonLayer(Context context,String colorString)
{
GradientDrawable shape1 = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{Color.parseColor(colorString),Color.parseColor(colorString)});
shape1.setCornerRadius(200);//change the corners of the rectangle
shape1.setStroke(6, Color.WHITE);
shape1.setAlpha(230);
InsetDrawable d1= new InsetDrawable(shape1,0,0,0,0);//the padding u want to use
LayerDrawable mylayer = new LayerDrawable(new Drawable[]{d1});
return mylayer;
}
public void displayMessageAndExit(Activity activity, String tiltleMassage,
String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(tiltleMassage);
builder.setMessage(message);
builder.setPositiveButton("Ok", new FinishListener(activity));
builder.setOnCancelListener(new FinishListener(activity));
builder.setIcon(R.drawable.ic_action_warning);
builder.setCancelable(false);
builder.show();
}
public static void downloadImage(String IMAGE_URL,ImageView imageProjectHome,DisplayImageOptions options,final ProgressBar spinner)
{
com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(IMAGE_URL, imageProjectHome, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
if(spinner!=null)
{
spinner.setVisibility(View.VISIBLE);
}
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
String message = null;
switch (failReason.getType()) {
case IO_ERROR:
message = "Image not found";
break;
case DECODING_ERROR:
message = "Image can't be decoded";
break;
case NETWORK_DENIED:
message = "Downloads are denied";
break;
case OUT_OF_MEMORY:
message = "Out Of Memory error";
break;
case UNKNOWN:
message = "Unknown error";
break;
}
if(spinner!=null)
{
spinner.setVisibility(View.GONE);
}
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if(spinner!=null)
{
spinner.setVisibility(View.GONE);
}
}
});
}
public static void adjustAspectRatio(int videoWidth, int videoHeight,TextureView mTextureView) {
int viewWidth = mTextureView.getWidth();
int viewHeight = mTextureView.getHeight();
double aspectRatio = (double) videoHeight / videoWidth;
int newWidth, newHeight;
if (viewHeight > (int) (viewWidth * aspectRatio)) {
// limited by narrow width; restrict height
newWidth = viewWidth;
newHeight = (int) (viewWidth * aspectRatio);
} else {
// limited by short height; restrict width
newWidth = (int) (viewHeight / aspectRatio);
newHeight = viewHeight;
}
int xoff = (viewWidth - newWidth) / 2;
int yoff = (viewHeight - newHeight) / 2;
Log.v("Mydata", "video=" + videoWidth + "x" + videoHeight +
" view=" + viewWidth + "x" + viewHeight +
" newView=" + newWidth + "x" + newHeight +
" off=" + xoff + "," + yoff);
Matrix txform = new Matrix();
mTextureView.getTransform(txform);
txform.setScale((float) newWidth / viewWidth, (float) newHeight / viewHeight);
//txform.postRotate(10); // just for fun
txform.postTranslate(xoff, yoff);
mTextureView.setTransform(txform);
}
public static void createScheduledNotification(Context context,int days)
{
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.HOUR_OF_DAY, days * 24);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
int id = (int) System.currentTimeMillis();
Intent intent = new Intent(context, AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
}
}
| [
"OM"
] | OM |
75e6effc24b24002b5d4ffaac0df12bb6edfc003 | b21a63a925ada85e92d5e3c6d36c019082869f1b | /OwnerDefineView/dopboxdemo/src/main/java/com/example/android/dopboxdemo/MainActivity.java | 0aaf8fc5230ab130b681d65810f6e6d8d15c6a9f | [] | no_license | liuxiaoping910818/OwnerDefineView | 572fde6a5c9ad5552c7572e3e2330be0578d5bd4 | 283de38fe4af853993fe6521881252408b029dc1 | refs/heads/master | 2016-09-14T07:16:18.086022 | 2016-04-20T12:23:35 | 2016-04-20T12:23:35 | 56,378,911 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,605 | java | package com.example.android.dopboxdemo;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.TextView;
import java.util.ArrayList;
/**
*
* 下拉框练习
*/
public class MainActivity extends AppCompatActivity {
private ListView lvlist;
private EditText et_content;
private ArrayList<String> mList;
private PopupWindow mPopupWin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView iv_Drop= (ImageView) findViewById(R.id.iv_drop);
et_content= (EditText) findViewById(R.id.et_content);
iv_Drop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDropDown();
}
});
lvlist=new ListView(this);
mList=new ArrayList<>();
for (int i=0;i<100;i++){
mList.add("adc"+i);
}
lvlist.setAdapter(new MyAdapter());
//点击Item显示到Editexth
lvlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
et_content.setText(mList.get(position));
mPopupWin.dismiss();
}
});
}
private void showDropDown() {
if (mPopupWin==null){
mPopupWin=new PopupWindow(lvlist,et_content.getWidth(),200,true);
mPopupWin.setBackgroundDrawable(new ColorDrawable());
}
mPopupWin.showAsDropDown(et_content);
}
class MyAdapter extends BaseAdapter {
@Override
public int getCount() {
return mList.size();
}
@Override
public String getItem(int position) {
return mList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView,
ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = View.inflate(getApplicationContext(),
R.layout.list_item, null);
holder = new ViewHolder();
holder.tvContent = (TextView) convertView
.findViewById(R.id.tv_content);
holder.ivDelete = (ImageView) convertView
.findViewById(R.id.iv_delete);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tvContent.setText(getItem(position));
holder.ivDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mList.remove(position);
MyAdapter.this.notifyDataSetChanged();
}
});
return convertView;
}
}
static class ViewHolder {
public TextView tvContent;
public ImageView ivDelete;
}
}
| [
"14747501789@.163.com"
] | 14747501789@.163.com |
06c02b686b5fc216e8da43c5162f87551ca30d43 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_983b6e71d9925e45e6bdac1ebaa0fc80809e3fbd/SameFilenameTitleProvider/10_983b6e71d9925e45e6bdac1ebaa0fc80809e3fbd_SameFilenameTitleProvider_s.java | fda51d9120cacf2212d048399ecf3f287efa476e | [] | 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 | 9,992 | java | /*
* Copyright 2012 Vladimir Rudev
*
* 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 ru.crazycoder.plugins.tabdir;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.FilenameIndex;
import com.intellij.psi.search.ProjectScope;
import com.intellij.util.indexing.FileBasedIndex;
import org.apache.commons.lang.StringUtils;
import ru.crazycoder.plugins.tabdir.configuration.FolderConfiguration;
import ru.crazycoder.plugins.tabdir.configuration.GlobalConfig;
import ru.crazycoder.plugins.tabdir.configuration.ProjectConfig;
import java.io.File;
import java.util.*;
/**
* User: crazycoder
* Date: Aug 14, 2010
* Time: 7:06:45 PM
*/
public class SameFilenameTitleProvider
implements EditorTabTitleProvider {
private final Logger log = Logger.getInstance(this.getClass().getCanonicalName());
private final GlobalConfig configuration = ServiceManager.getService(GlobalConfig.class);
private final Comparator<VirtualFile> comparator = new Comparator<VirtualFile>() {
@Override
public int compare(VirtualFile file1, VirtualFile file2) {
return file1.getPath().length() - file2.getPath().length();
}
};
@Override
public String getEditorTabTitle(Project project, VirtualFile file) {
try {
return getEditorTabTitleInternal(project, file);
} catch (Exception e) {
return null;
}
}
public String getEditorTabTitleInternal(final Project project, final VirtualFile file) {
try {
FolderConfiguration matchedConfiguration = findConfiguration(project, file);
if (!needProcessFile(file, matchedConfiguration)) {
return null;
}
if (StringUtils.isNotEmpty(matchedConfiguration.getRelativeTo())) {
return titleRelativeTo(file, matchedConfiguration);
} else {
return titleWithDiffs(project, file, matchedConfiguration);
}
} catch (Exception e) {
log.error("", e);
}
return null;
}
private FolderConfiguration findConfiguration(final Project project, final VirtualFile file) {
if (!configuration.isProjectConfigEnabled()) {
return configuration;
}
ProjectConfig projectConfig = ServiceManager.getService(project, ProjectConfig.class);
Map<String, FolderConfiguration> folderConfigs = projectConfig.getFolderConfigurations();
FolderConfiguration matchedConfiguration = null;
int biggestKeyLength = 0;
// search configuration where path(key in map) is biggest prefix for file
for (Map.Entry<String, FolderConfiguration> entry : folderConfigs.entrySet()) {
String key = entry.getKey();
if (file.getPath().startsWith(key) && biggestKeyLength < key.length()) {
biggestKeyLength = key.length();
matchedConfiguration = entry.getValue();
}
}
if (matchedConfiguration == null) {
// no project config for current file - use global config
matchedConfiguration = configuration;
}
return matchedConfiguration;
}
private String titleRelativeTo(final VirtualFile file, final FolderConfiguration configuration) {
String relativePath = FileUtil.getRelativePath(configuration.getRelativeTo(), file.getPath(), File.separatorChar);
String[] parts = StringUtils.split(relativePath, File.separatorChar);
List<String> prefixes = new ArrayList<String>(Arrays.asList(parts));
if (prefixes.size() > 1) {
prefixes.remove(prefixes.size() - 1);
return TitleFormatter.format(prefixes, file.getPresentableName(), configuration);
} else {
return file.getPresentableName();
}
}
private String titleWithDiffs(final Project project, final VirtualFile file, final FolderConfiguration configuration) {
Collection<VirtualFile> similarFiles = FileBasedIndex.getInstance().getContainingFiles(FilenameIndex.NAME, file.getName(), ProjectScope.getProjectScope(project));
if (similarFiles.size() < 2) {
return file.getPresentableName();
}
if (configuration.isRemoveDuplicates()) {
LinkedHashMap<String, Set<String>> prefixesWithNeighbours = calculatePrefixesWithoutDuplicates(file, similarFiles);
if (prefixesWithNeighbours.size() > 0) {
return TitleFormatter.format(prefixesWithNeighbours, file.getPresentableName(), configuration);
}
} else {
List<String> prefixes = calculatePrefixes(file, similarFiles);
if (prefixes.size() > 0) {
return TitleFormatter.format(prefixes, file.getPresentableName(), configuration);
}
}
return null;
}
/**
* @return <b>key</b> - ancestor folder name,<br/>
* <b>value</b> - neighbours of key folder that ancestors of similar files.<br/>
* Keys in map stored in order as in {@link #titleWithDiffs(com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile, ru.crazycoder.plugins.tabdir.configuration.FolderConfiguration)}
*/
private LinkedHashMap<String, Set<String>> calculatePrefixesWithoutDuplicates(VirtualFile file, Collection<VirtualFile> similarFiles) {
LinkedHashMap<String, Set<String>> prefixes = new LinkedHashMap<String, Set<String>>();
SortedSet<VirtualFile> ancestors = new TreeSet<VirtualFile>(comparator);
Map<VirtualFile, Set<VirtualFile>> filesWithSameAncestor = new HashMap<VirtualFile, Set<VirtualFile>>();
for (VirtualFile similarFile : similarFiles) {
if (file.equals(similarFile)) {
continue;
}
if (file.getPath() != null) {
VirtualFile ancestor = VfsUtil.getCommonAncestor(similarFile, file);
if (ancestor != null && ancestor.getPath() != null && !(ancestor.equals(file.getParent()))) {
ancestors.add(ancestor);
if (!filesWithSameAncestor.containsKey(ancestor)) {
filesWithSameAncestor.put(ancestor, new HashSet<VirtualFile>());
}
Set<VirtualFile> files = filesWithSameAncestor.get(ancestor);
files.add(similarFile);
}
}
}
for (VirtualFile ancestor : ancestors) {
String prefix = getFolderAfterAncestor(ancestor, file);
if (prefix != null) {
prefixes.put(prefix, getNeighboursNames(ancestor, filesWithSameAncestor.get(ancestor)));
}
}
return prefixes;
}
private Set<String> getNeighboursNames(VirtualFile ancestor, Set<VirtualFile> files) {
Set<String> result = new HashSet<String>();
for (VirtualFile file : files) {
String folder = getFolderAfterAncestor(ancestor, file);
result.add(folder);
}
return result;
}
private List<String> calculatePrefixes(final VirtualFile file, final Collection<VirtualFile> similarFiles) {
List<String> prefixes = new ArrayList<String>();
SortedSet<VirtualFile> ancestors = new TreeSet<VirtualFile>(comparator);
for (VirtualFile similarFile : similarFiles) {
if (file.equals(similarFile)) {
continue;
}
if (file.getPath() != null) {
VirtualFile ancestor = VfsUtil.getCommonAncestor(similarFile, file);
if (ancestor != null && ancestor.getPath() != null) {
ancestors.add(ancestor);
}
}
}
for (VirtualFile ancestor : ancestors) {
String folder = getFolderAfterAncestor(ancestor, file);
if (folder != null) {
prefixes.add(folder);
}
}
return prefixes;
}
private String getFolderAfterAncestor(VirtualFile ancestor, VirtualFile file) {
String relativePath = VfsUtil.getRelativePath(file, ancestor, File.separatorChar);
if (relativePath != null && relativePath.indexOf(File.separatorChar) != -1) {
List<String> pathElements = StringUtil.split(relativePath, File.separator);
return pathElements.get(0);
}
return null;
}
private boolean needProcessFile(VirtualFile file, FolderConfiguration configuration) {
if (file.getExtension() != null) {
String[] extensions = StringUtil.splitByLines(configuration.getFilesExtensions());
boolean isInExtensionsConfig = Arrays.asList(extensions).contains(file.getExtension());
return isInExtensionsConfig == configuration.getUseExtensions().getValue();
}
return true;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
50cda52bfb2b6daa8880c79e1893a4923faf9578 | 6cdf6e3d3cf00b30c77d3bcbd48b375267eec6f1 | /src/test/java/SearchObjectTest.java | 5c432d01e4d6f4c4c13cd6cc009a8b0be3fe5a50 | [] | no_license | aggigie/laboratorium-12-aguua | 003e076f1fc7c08f1f58453f9a8aab1caa65ff0d | 7f9d96325ebaaf90c8e3e4465dfad82d149e1a24 | refs/heads/master | 2022-07-12T23:50:28.616013 | 2020-05-11T15:32:21 | 2020-05-11T15:32:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,496 | java | import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class SearchObjectTest {
private static WebDriver driver;
private SearchObject page;
@BeforeAll
public static void setUpBeforeClass() throws Exception {
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver();
}
@Test
public void testSearchDuckDuck() throws Exception {
String url = "https://duckduckgo.com/";
page = new SearchObject(driver, url);
page.search("wikipedia");
page.waitUntilTitle("at DuckDuckGo");
assertTrue(page.assertTitleContains("wikipedia at DuckDuckGo"));
}
@Test
public void testSearchGoogle() throws Exception {
String url = "https://google.com/";
page = new SearchObject(driver, url);
page.search("wikipedia");
page.waitUntilTitle("Szukaj w Google");
assertTrue(page.assertTitleContains("wikipedia - Szukaj w Google"));
}
@Test
public void testSearchBing() throws Exception {
String url = "https://www.bing.com";;
page = new SearchObject(driver, url);
page.search("wikipedia");
page.waitUntilTitle("wikipedia - Bing");
assertTrue(page.assertTitleContains("wikipedia - Bing"));
}
}
| [
"AHarlozinska@advaoptical.com"
] | AHarlozinska@advaoptical.com |
12d583e6427ad532b45faac7c1e4e5b0917eddc4 | 3b33d6e3c2067446ecb2475f68de74328a6ea66a | /CrowdFundingWorkspace/crowd-funding-project-workspace/modules/crowd-funding-database/crowd-funding-database-service/src/main/java/com/crowd/funding/database/model/impl/CandidateRegistrationCacheModel.java | 72eb5d4a6d1f79f9bb34735d5666c20644c51a54 | [] | no_license | Sumit9727/QuickDaan_LifeRay1 | bbeced3e386f732be861073106848b4237e967ba | 96320146033f182ab32f13a54bdc7a2306986b53 | refs/heads/master | 2020-09-18T11:21:16.519127 | 2019-11-26T09:04:17 | 2019-11-26T09:04:17 | 224,142,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,281 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* 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.
*/
package com.crowd.funding.database.model.impl;
import aQute.bnd.annotation.ProviderType;
import com.crowd.funding.database.model.CandidateRegistration;
import com.liferay.portal.kernel.model.CacheModel;
import com.liferay.portal.kernel.util.HashUtil;
import com.liferay.portal.kernel.util.StringBundler;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Date;
/**
* The cache model class for representing CandidateRegistration in entity cache.
*
* @author Brian Wing Shun Chan
* @see CandidateRegistration
* @generated
*/
@ProviderType
public class CandidateRegistrationCacheModel implements CacheModel<CandidateRegistration>,
Externalizable {
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CandidateRegistrationCacheModel)) {
return false;
}
CandidateRegistrationCacheModel candidateRegistrationCacheModel = (CandidateRegistrationCacheModel)obj;
if (CANDIDATE_ID == candidateRegistrationCacheModel.CANDIDATE_ID) {
return true;
}
return false;
}
@Override
public int hashCode() {
return HashUtil.hash(0, CANDIDATE_ID);
}
@Override
public String toString() {
StringBundler sb = new StringBundler(21);
sb.append("{uuid=");
sb.append(uuid);
sb.append(", CANDIDATE_ID=");
sb.append(CANDIDATE_ID);
sb.append(", POSITION_ID=");
sb.append(POSITION_ID);
sb.append(", NAME=");
sb.append(NAME);
sb.append(", EMAIL=");
sb.append(EMAIL);
sb.append(", MOBILE_NO=");
sb.append(MOBILE_NO);
sb.append(", CURRENT_LOCATION=");
sb.append(CURRENT_LOCATION);
sb.append(", EXPERIENCE=");
sb.append(EXPERIENCE);
sb.append(", DATE=");
sb.append(DATE);
sb.append(", STATUS=");
sb.append(STATUS);
sb.append("}");
return sb.toString();
}
@Override
public CandidateRegistration toEntityModel() {
CandidateRegistrationImpl candidateRegistrationImpl = new CandidateRegistrationImpl();
if (uuid == null) {
candidateRegistrationImpl.setUuid("");
}
else {
candidateRegistrationImpl.setUuid(uuid);
}
candidateRegistrationImpl.setCANDIDATE_ID(CANDIDATE_ID);
candidateRegistrationImpl.setPOSITION_ID(POSITION_ID);
if (NAME == null) {
candidateRegistrationImpl.setNAME("");
}
else {
candidateRegistrationImpl.setNAME(NAME);
}
if (EMAIL == null) {
candidateRegistrationImpl.setEMAIL("");
}
else {
candidateRegistrationImpl.setEMAIL(EMAIL);
}
candidateRegistrationImpl.setMOBILE_NO(MOBILE_NO);
if (CURRENT_LOCATION == null) {
candidateRegistrationImpl.setCURRENT_LOCATION("");
}
else {
candidateRegistrationImpl.setCURRENT_LOCATION(CURRENT_LOCATION);
}
if (EXPERIENCE == null) {
candidateRegistrationImpl.setEXPERIENCE("");
}
else {
candidateRegistrationImpl.setEXPERIENCE(EXPERIENCE);
}
if (DATE == Long.MIN_VALUE) {
candidateRegistrationImpl.setDATE(null);
}
else {
candidateRegistrationImpl.setDATE(new Date(DATE));
}
candidateRegistrationImpl.setSTATUS(STATUS);
candidateRegistrationImpl.resetOriginalValues();
return candidateRegistrationImpl;
}
@Override
public void readExternal(ObjectInput objectInput) throws IOException {
uuid = objectInput.readUTF();
CANDIDATE_ID = objectInput.readLong();
POSITION_ID = objectInput.readLong();
NAME = objectInput.readUTF();
EMAIL = objectInput.readUTF();
MOBILE_NO = objectInput.readLong();
CURRENT_LOCATION = objectInput.readUTF();
EXPERIENCE = objectInput.readUTF();
DATE = objectInput.readLong();
STATUS = objectInput.readInt();
}
@Override
public void writeExternal(ObjectOutput objectOutput)
throws IOException {
if (uuid == null) {
objectOutput.writeUTF("");
}
else {
objectOutput.writeUTF(uuid);
}
objectOutput.writeLong(CANDIDATE_ID);
objectOutput.writeLong(POSITION_ID);
if (NAME == null) {
objectOutput.writeUTF("");
}
else {
objectOutput.writeUTF(NAME);
}
if (EMAIL == null) {
objectOutput.writeUTF("");
}
else {
objectOutput.writeUTF(EMAIL);
}
objectOutput.writeLong(MOBILE_NO);
if (CURRENT_LOCATION == null) {
objectOutput.writeUTF("");
}
else {
objectOutput.writeUTF(CURRENT_LOCATION);
}
if (EXPERIENCE == null) {
objectOutput.writeUTF("");
}
else {
objectOutput.writeUTF(EXPERIENCE);
}
objectOutput.writeLong(DATE);
objectOutput.writeInt(STATUS);
}
public String uuid;
public long CANDIDATE_ID;
public long POSITION_ID;
public String NAME;
public String EMAIL;
public long MOBILE_NO;
public String CURRENT_LOCATION;
public String EXPERIENCE;
public long DATE;
public int STATUS;
} | [
"rohit@prakat.in"
] | rohit@prakat.in |
e6758eed73fb712375b060931b5482b97b19d4a3 | 5e49ae449c262688dc85e6b7832f375290b47931 | /src/main/java/org/jwebsocket/api/WebSocketClientEvent.java | 5f4f50a2518eb5bff0daf35e3982e0e6056f5d3a | [] | no_license | jamieforth/jwebsocket-client-api | 073a1f5a023fbcf0e2216b1240a7ac78280daa4e | 24c00e6b351c88ccf2a3c71057c4a337c0c09bc6 | refs/heads/master | 2016-09-06T02:57:52.908603 | 2012-07-11T20:54:48 | 2012-07-11T20:54:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,569 | java | // ---------------------------------------------------------------------------
// jWebSocket - Copyright (c) 2010 Innotrade GmbH
// ---------------------------------------------------------------------------
// This program 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 3 of the License, or (at your
// option) any later version.
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
// more details.
// You should have received a copy of the GNU Lesser General Public License along
// with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
// ---------------------------------------------------------------------------
package org.jwebsocket.api;
/**
* Base interface jWebSocket events
*
* @author puran
* @author aschulze
* @version $Id: WebSocketClientEvent.java 702 2010-07-18 17:54:17Z
* mailtopuran@gmail.com $
*/
public interface WebSocketClientEvent {
/**
* Returns the name of the event.
*
* @return
*/
String getName();
/**
* Returns the data (usually a message) for the event.
*
* @return
*/
String getData();
/**
* Returns the WebSocket client which fired the event.
*
* @return
*/
WebSocketClient getClient();
}
| [
"j.forth@gold.ac.uk"
] | j.forth@gold.ac.uk |
0609ded158e3885ae7f206e65afa0bd242862cf7 | d376c38ab59ee50315d7c34d4e6b0fe9fcd8732b | /app/src/main/java/com/hencoder/hencoderpracticedraw1/practice/Practice6DrawLineView.java | 195582f75bf628186b3b1991e0f1376acb7979c7 | [] | no_license | kekekuaile/PracticeDraw1Practice | 3c7d454589ea57dc0652909411c0cc5cb687f13f | 54201750e6851042760a4405047fcd5fbadf1bd7 | refs/heads/master | 2021-06-27T22:24:22.928909 | 2017-09-19T03:15:14 | 2017-09-19T03:15:14 | 104,013,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 903 | java | package com.hencoder.hencoderpracticedraw1.practice;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
public class Practice6DrawLineView extends View {
public Practice6DrawLineView(Context context) {
super(context);
}
public Practice6DrawLineView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public Practice6DrawLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 练习内容:使用 canvas.drawLine() 方法画直线
Paint paint = new Paint();
canvas.drawLine(20,50,100,150,paint);
}
}
| [
"kekekeuaile@gmail.com"
] | kekekeuaile@gmail.com |
e00fde28e5085f5979bb22c09ff42b32622166d9 | 6d33a7f11359fff43eb4aa0e8a83129f2cf20ce2 | /src/main/java/org/spongepowered/api/event/inventory/ViewerEvent.java | 893038f1832b9a92ace7bf083b680eba63e89396 | [
"MIT"
] | permissive | Cadiducho/SpongeAPI | a8d11ead9a7bb79773e780a8c07e673267acfa56 | 4c75b0436dec60e2ebbfc23f51a6f5abc44f7640 | refs/heads/master | 2021-01-21T01:16:20.605048 | 2015-03-25T19:55:55 | 2015-03-25T19:55:55 | 33,002,648 | 0 | 1 | null | 2015-03-27T18:31:32 | 2015-03-27T18:31:31 | null | UTF-8 | Java | false | false | 1,668 | java | /*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.event.inventory;
import org.spongepowered.api.entity.living.Human;
/**
* A ViewerEvent is an {@link InventoryEvent} that happens with a
* specific viewer in a transaction.
*/
public interface ViewerEvent extends ContainerEvent {
/**
* Retrieves the Human involved with this inventory event.
*
* @return The viewer in this event
*/
Human getViewer();
}
| [
"zidane@outlook.com"
] | zidane@outlook.com |
2ce1a267b6f1c272295a3fe36f2353b457ad7407 | 65aeca6cf073f69dcc1547340569fa3f121187b1 | /src/main/java/com/mercadolibre/supply/supplier/CatalogProductIdSupplier.java | ff28cfee7f18115c79f68627f8666825447f41b3 | [] | no_license | msosto/viewbuilder | 9e4f1ca07bc5be2d32feaf3115522e9ddd873da0 | 657fc75ad14d88c63b6bca797d3019921f13caa5 | refs/heads/master | 2021-05-12T19:43:55.458758 | 2018-01-24T19:09:48 | 2018-01-24T19:09:48 | 117,102,296 | 0 | 0 | null | 2018-01-24T18:25:17 | 2018-01-11T13:13:23 | Java | UTF-8 | Java | false | false | 186 | java | package com.mercadolibre.supply.supplier;
/**
* Created by mforte on 1/24/18.
*/
@FunctionalInterface
public interface CatalogProductIdSupplier {
String getCatalogProductId();
}
| [
"martinforte@yahoo.com.ar"
] | martinforte@yahoo.com.ar |
d3c475871b4d053de2363c238f4f1eb19f3d85f6 | d524d632082b5b514d2e44c460b7993f46d51d88 | /app/build/generated/not_namespaced_r_class_sources/release/processReleaseResources/r/android/support/customtabs/R.java | 1f08c7b9e8c5f866cc7e28f2ffc5b83055b9fff7 | [] | no_license | juankat82/searcharound | d33bfd7f4e2b942c3eb4bbf0edac62538858dac2 | c0a86fb616b1d91105765330ebb6b12e561071da | refs/heads/master | 2020-04-11T13:25:38.319037 | 2018-12-14T18:55:57 | 2018-12-14T18:55:57 | 160,558,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,193 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.customtabs;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int coordinatorLayoutStyle = 0x7f04007d;
public static final int font = 0x7f0400a6;
public static final int fontProviderAuthority = 0x7f0400a8;
public static final int fontProviderCerts = 0x7f0400a9;
public static final int fontProviderFetchStrategy = 0x7f0400aa;
public static final int fontProviderFetchTimeout = 0x7f0400ab;
public static final int fontProviderPackage = 0x7f0400ac;
public static final int fontProviderQuery = 0x7f0400ad;
public static final int fontStyle = 0x7f0400ae;
public static final int fontWeight = 0x7f0400af;
public static final int keylines = 0x7f0400cb;
public static final int layout_anchor = 0x7f0400d2;
public static final int layout_anchorGravity = 0x7f0400d3;
public static final int layout_behavior = 0x7f0400d4;
public static final int layout_dodgeInsetEdges = 0x7f040100;
public static final int layout_insetEdge = 0x7f040109;
public static final int layout_keyline = 0x7f04010a;
public static final int statusBarBackground = 0x7f04015a;
}
public static final class bool {
private bool() {}
public static final int abc_action_bar_embed_tabs = 0x7f050000;
}
public static final class color {
private color() {}
public static final int browser_actions_bg_grey = 0x7f060025;
public static final int browser_actions_divider_color = 0x7f060026;
public static final int browser_actions_text_color = 0x7f060027;
public static final int browser_actions_title_color = 0x7f060028;
public static final int notification_action_color_filter = 0x7f06005f;
public static final int notification_icon_bg_color = 0x7f060060;
public static final int ripple_material_light = 0x7f060073;
public static final int secondary_text_default_material_light = 0x7f060075;
}
public static final class dimen {
private dimen() {}
public static final int browser_actions_context_menu_max_width = 0x7f07004b;
public static final int browser_actions_context_menu_min_padding = 0x7f07004c;
public static final int compat_button_inset_horizontal_material = 0x7f07004d;
public static final int compat_button_inset_vertical_material = 0x7f07004e;
public static final int compat_button_padding_horizontal_material = 0x7f07004f;
public static final int compat_button_padding_vertical_material = 0x7f070050;
public static final int compat_control_corner_material = 0x7f070051;
public static final int notification_action_icon_size = 0x7f070087;
public static final int notification_action_text_size = 0x7f070088;
public static final int notification_big_circle_margin = 0x7f070089;
public static final int notification_content_margin_start = 0x7f07008a;
public static final int notification_large_icon_height = 0x7f07008b;
public static final int notification_large_icon_width = 0x7f07008c;
public static final int notification_main_column_padding_top = 0x7f07008d;
public static final int notification_media_narrow_margin = 0x7f07008e;
public static final int notification_right_icon_size = 0x7f07008f;
public static final int notification_right_side_padding_top = 0x7f070090;
public static final int notification_small_icon_background_padding = 0x7f070091;
public static final int notification_small_icon_size_as_large = 0x7f070092;
public static final int notification_subtext_size = 0x7f070093;
public static final int notification_top_pad = 0x7f070094;
public static final int notification_top_pad_large_text = 0x7f070095;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f0800a7;
public static final int notification_bg = 0x7f0800a8;
public static final int notification_bg_low = 0x7f0800a9;
public static final int notification_bg_low_normal = 0x7f0800aa;
public static final int notification_bg_low_pressed = 0x7f0800ab;
public static final int notification_bg_normal = 0x7f0800ac;
public static final int notification_bg_normal_pressed = 0x7f0800ad;
public static final int notification_icon_background = 0x7f0800ae;
public static final int notification_template_icon_bg = 0x7f0800af;
public static final int notification_template_icon_low_bg = 0x7f0800b0;
public static final int notification_tile_bg = 0x7f0800b1;
public static final int notify_panel_notification_icon_bg = 0x7f0800b2;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f090012;
public static final int action_divider = 0x7f090014;
public static final int action_image = 0x7f090015;
public static final int action_text = 0x7f09001b;
public static final int actions = 0x7f09001c;
public static final int async = 0x7f090027;
public static final int blocking = 0x7f09002c;
public static final int bottom = 0x7f09002d;
public static final int browser_actions_header_text = 0x7f090030;
public static final int browser_actions_menu_item_icon = 0x7f090031;
public static final int browser_actions_menu_item_text = 0x7f090032;
public static final int browser_actions_menu_items = 0x7f090033;
public static final int browser_actions_menu_view = 0x7f090034;
public static final int chronometer = 0x7f09003f;
public static final int end = 0x7f09005c;
public static final int forever = 0x7f090068;
public static final int icon = 0x7f090074;
public static final int icon_group = 0x7f090075;
public static final int info = 0x7f09007c;
public static final int italic = 0x7f09007e;
public static final int left = 0x7f090081;
public static final int line1 = 0x7f090083;
public static final int line3 = 0x7f090084;
public static final int none = 0x7f0900a6;
public static final int normal = 0x7f0900a7;
public static final int notification_background = 0x7f0900a8;
public static final int notification_main_column = 0x7f0900a9;
public static final int notification_main_column_container = 0x7f0900aa;
public static final int right = 0x7f0900d8;
public static final int right_icon = 0x7f0900d9;
public static final int right_side = 0x7f0900da;
public static final int start = 0x7f090108;
public static final int tag_transition_group = 0x7f09010f;
public static final int text = 0x7f090111;
public static final int text2 = 0x7f090112;
public static final int time = 0x7f090129;
public static final int title = 0x7f09012a;
public static final int top = 0x7f090131;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f0a000a;
}
public static final class layout {
private layout() {}
public static final int browser_actions_context_menu_page = 0x7f0b0020;
public static final int browser_actions_context_menu_row = 0x7f0b0021;
public static final int notification_action = 0x7f0b0039;
public static final int notification_action_tombstone = 0x7f0b003a;
public static final int notification_template_custom_big = 0x7f0b0041;
public static final int notification_template_icon_group = 0x7f0b0042;
public static final int notification_template_part_chronometer = 0x7f0b0046;
public static final int notification_template_part_time = 0x7f0b0047;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0f008a;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f1000ef;
public static final int TextAppearance_Compat_Notification_Info = 0x7f1000f0;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f1000f2;
public static final int TextAppearance_Compat_Notification_Time = 0x7f1000f5;
public static final int TextAppearance_Compat_Notification_Title = 0x7f1000f7;
public static final int Widget_Compat_NotificationActionContainer = 0x7f10016d;
public static final int Widget_Compat_NotificationActionText = 0x7f10016e;
public static final int Widget_Support_CoordinatorLayout = 0x7f10017a;
}
public static final class styleable {
private styleable() {}
public static final int[] CoordinatorLayout = { 0x7f0400cb, 0x7f04015a };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f0400d2, 0x7f0400d3, 0x7f0400d4, 0x7f040100, 0x7f040109, 0x7f04010a };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f0400a8, 0x7f0400a9, 0x7f0400aa, 0x7f0400ab, 0x7f0400ac, 0x7f0400ad };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x7f0400a6, 0x7f0400ae, 0x7f0400af };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_font = 3;
public static final int FontFamilyFont_fontStyle = 4;
public static final int FontFamilyFont_fontWeight = 5;
}
}
| [
"spanishfly82@gmail.com"
] | spanishfly82@gmail.com |
4bb8b50675f89f753d601582a0876ed17c511ff6 | 85023edf87f9a10713087dd05f62028718ec73a9 | /132Fall2016Lec32Examples/src/Problem.java | 6cc678c672259c0cac97036d78fb5b26c7a27acf | [] | no_license | foufouti/CS_PROJECTS | 50891a63323d6529ce5e5cc1bbf4e191563fa7a0 | 5432de3899ce457ab991a70021f65ee85c1699ff | refs/heads/master | 2020-05-15T18:53:20.168736 | 2017-01-27T05:13:24 | 2017-01-27T05:13:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java |
public class Problem {
private static class MyThreadCode implements Runnable {
private static int x = 0;
@Override
public void run() {
for (int i = 0; i < 10000000; i++) {
x++;
x--;
}
System.out.println(x + " " + Thread.currentThread().getName());
}
}
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
Thread t = new Thread(new MyThreadCode());
t.start();
}
}
}
| [
"foofighter67@yahoo.com"
] | foofighter67@yahoo.com |
5af7361bbdc01ac7cc0a43b29548000f38b87da1 | fa41f83be8aa2e069270e3088cfe3654f3e8fe12 | /src/com/finfrock/moneycheck/data/SummaryItem.java | 30c9dbada5427024486a96cbd686bd70d36ef9a4 | [] | no_license | lancewf/Android-Money-Checker | e887b3bfa0d833ca01695e9d7b4a778d22c610e9 | cd876c9b91345eedfd7bd400aa282396f2e24372 | refs/heads/master | 2020-04-01T10:30:09.143808 | 2014-08-17T21:00:19 | 2014-08-17T21:00:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | package com.finfrock.moneycheck.data;
public class SummaryItem
{
private BillType billType;
private double allotted;
private double spent;
private double amountLeft;
private double average;
private double amountLeftOfAverage;
public BillType getBillType()
{
return billType;
}
public void setBillType(BillType billType)
{
this.billType = billType;
}
public double getAllotted()
{
return allotted;
}
public void setAllotted(double allotted)
{
this.allotted = allotted;
}
public double getSpent()
{
return spent;
}
public void setSpent(double spent)
{
this.spent = spent;
}
public double getAmountLeft()
{
return amountLeft;
}
public void setAmountLeft(double amountLeft)
{
this.amountLeft = amountLeft;
}
public double getAverage()
{
return average;
}
public void setAverage(double average)
{
this.average = average;
}
public double getAmountLeftOfAverage()
{
return amountLeftOfAverage;
}
public void setAmountLeftOfAverage(double amountLeftOfAverage)
{
this.amountLeftOfAverage = amountLeftOfAverage;
}
}
| [
"lancewf@gmail.com"
] | lancewf@gmail.com |
e3738723f556613a6c680c079f6f7accadfe27eb | 0e6a786186c7ee50191af2971dbc9fe23d717a20 | /app/src/main/java/com/kingja/cardpackage/adapter/PersonManagerLvAdapter.java | 8fdb06de21e9484aefd61f9504865610d4891796 | [] | no_license | KingJA/RentManager | 9cfefae120bfa3cbe1657da4a322b30a3ec110cd | abbce1227506eb88f7d2b390f11a16c70f640034 | refs/heads/master | 2021-01-12T17:18:29.409161 | 2018-07-17T05:23:15 | 2018-07-17T05:23:15 | 71,545,487 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,083 | java | package com.kingja.cardpackage.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.kingja.cardpackage.entiy.ChuZuWu_MenPaiAuthorizationList;
import com.kingja.cardpackage.ui.DrawHelperLayout;
import com.tdr.wisdome.R;
import java.util.List;
/**
* Description:TODO
* Create Time:2016/8/5 14:32
* Author:KingJA
* Email:kingjavip@gmail.com
*/
public class PersonManagerLvAdapter extends BaseLvAdapter<ChuZuWu_MenPaiAuthorizationList.ContentBean.PERSONNELINFOLISTBean> {
public PersonManagerLvAdapter(Context context, List<ChuZuWu_MenPaiAuthorizationList.ContentBean.PERSONNELINFOLISTBean> list) {
super(context, list);
}
@Override
public View simpleGetView(final int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (convertView == null) {
convertView = View
.inflate(context, R.layout.item_person_manager, null);
viewHolder = new ViewHolder(convertView);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.tvname.setText(list.get(position).getNAME());
viewHolder.tvcardId.setText("身份证号: "+list.get(position).getNAME());
viewHolder.tvphone.setText("手机号: "+list.get(position).getNAME());
return convertView;
}
public class ViewHolder {
public final TextView tvname;
public final TextView tvcardId;
public final TextView tvphone;
public final ImageView iv_delete;
public final View root;
public ViewHolder(View root) {
tvname = (TextView) root.findViewById(R.id.tv_name);
tvcardId = (TextView) root.findViewById(R.id.tv_cardId);
tvphone = (TextView) root.findViewById(R.id.tv_phone);
iv_delete = (ImageView) root.findViewById(R.id.iv_delete);
this.root = root;
}
}
}
| [
"kingjavip@gmail.com"
] | kingjavip@gmail.com |
69c61071eab8b653f5ff7a3b3329b5399024ce70 | 89c130487604bd7d04ad93e33a7bc66f0cd56747 | /Boletin4/src/main/java/Libros/Boletin4_1.java | 6918960b7afdf8646cbcf5823039fca5d38e5bb3 | [] | no_license | Gdominguezborines/Boletines_programacion_nina | 95c37987afd4c50e0fc39f0e76ef4434abd9b7ed | 27fc5c4192e41730a123217275cb39a8b86e63d6 | refs/heads/main | 2023-02-17T11:00:04.678162 | 2021-01-18T10:09:57 | 2021-01-18T10:09:57 | 304,551,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | package Libros;
import java.util.Scanner;
public class Boletin4_1 {
public static void main(String[] args) {
// TODO code application logic here
//metodo para introducir datos
Scanner sc =new Scanner(System.in);
System.out.println("Escribe titulo del libro= ");
String t=sc.nextLine();
System.out.println("Escribe autor del libro= ");
String Au=sc.nextLine();
System.out.println("Escribe ano del libro= ");
int A=sc.nextInt();
System.out.println("Escribe numero de paginas del libro= ");
short Np=sc.nextShort();
System.out.println("Escribe valoracion del libro enforma numerica del 0 al 10 siendo 10 la mejor= ");
float Va=sc.nextFloat();
System.out.println("El libro="+t+" ,"+Au+" ,"+A+" ,"+Np+" ,"+Va+".");
Libro obxLibro =new Libro();
obxLibro.amosar();
Libro obxLibro1 =new Libro("noche oscura ","pepe ",2019,(short)540,5f);
obxLibro1.amosar();
String respuesta=obxLibro1.getTitulo();
System.out.println("El titulo es"+respuesta);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c21193023ebf11f0fc9d95ec40ef34873397ed03 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Closure-111/com.google.javascript.jscomp.type.ClosureReverseAbstractInterpreter/BBC-F0-opt-10/tests/3/com/google/javascript/jscomp/type/ClosureReverseAbstractInterpreter_ESTest.java | 46e4b6de54d58fa082e1cf84487e2c65923fd48c | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 6,091 | java | /*
* This file was automatically generated by EvoSuite
* Wed Oct 13 17:39:55 GMT 2021
*/
package com.google.javascript.jscomp.type;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.google.javascript.jscomp.ClosureCodingConvention;
import com.google.javascript.jscomp.CodingConvention;
import com.google.javascript.jscomp.GoogleCodingConvention;
import com.google.javascript.jscomp.type.ClosureReverseAbstractInterpreter;
import com.google.javascript.jscomp.type.FlowScope;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.SimpleErrorReporter;
import com.google.javascript.rhino.jstype.JSTypeRegistry;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class ClosureReverseAbstractInterpreter_ESTest extends ClosureReverseAbstractInterpreter_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
GoogleCodingConvention googleCodingConvention0 = new GoogleCodingConvention();
SimpleErrorReporter simpleErrorReporter0 = new SimpleErrorReporter();
JSTypeRegistry jSTypeRegistry0 = new JSTypeRegistry(simpleErrorReporter0, true);
Node node0 = Node.newString("Object#Element");
Node node1 = new Node(12);
Node node2 = new Node(37, node1, node0);
node2.addChildrenAfter(node2, node1);
ClosureReverseAbstractInterpreter closureReverseAbstractInterpreter0 = new ClosureReverseAbstractInterpreter(googleCodingConvention0, jSTypeRegistry0);
FlowScope flowScope0 = closureReverseAbstractInterpreter0.firstPreciserScopeKnowingConditionOutcome(node2, (FlowScope) null, true);
assertNull(flowScope0);
}
@Test(timeout = 4000)
public void test1() throws Throwable {
ClosureCodingConvention closureCodingConvention0 = new ClosureCodingConvention();
ClosureReverseAbstractInterpreter closureReverseAbstractInterpreter0 = new ClosureReverseAbstractInterpreter(closureCodingConvention0, (JSTypeRegistry) null);
Node node0 = Node.newString("Ok(1yQ\"");
FlowScope flowScope0 = mock(FlowScope.class, new ViolatedAssumptionAnswer());
doReturn((String) null, (String) null).when(flowScope0).toString();
FlowScope flowScope1 = closureReverseAbstractInterpreter0.firstPreciserScopeKnowingConditionOutcome(node0, flowScope0, false);
FlowScope flowScope2 = closureReverseAbstractInterpreter0.getPreciserScopeKnowingConditionOutcome(node0, flowScope1, false);
assertSame(flowScope2, flowScope1);
}
@Test(timeout = 4000)
public void test2() throws Throwable {
GoogleCodingConvention googleCodingConvention0 = new GoogleCodingConvention();
SimpleErrorReporter simpleErrorReporter0 = new SimpleErrorReporter();
JSTypeRegistry jSTypeRegistry0 = new JSTypeRegistry(simpleErrorReporter0, false);
ClosureReverseAbstractInterpreter closureReverseAbstractInterpreter0 = new ClosureReverseAbstractInterpreter(googleCodingConvention0, jSTypeRegistry0);
// Undeclared exception!
try {
closureReverseAbstractInterpreter0.getPreciserScopeKnowingConditionOutcome((Node) null, (FlowScope) null, true);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.google.javascript.jscomp.type.ClosureReverseAbstractInterpreter", e);
}
}
@Test(timeout = 4000)
public void test3() throws Throwable {
SimpleErrorReporter simpleErrorReporter0 = new SimpleErrorReporter();
JSTypeRegistry jSTypeRegistry0 = new JSTypeRegistry(simpleErrorReporter0, false);
ClosureReverseAbstractInterpreter closureReverseAbstractInterpreter0 = null;
try {
closureReverseAbstractInterpreter0 = new ClosureReverseAbstractInterpreter((CodingConvention) null, jSTypeRegistry0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.google.common.base.Preconditions", e);
}
}
@Test(timeout = 4000)
public void test4() throws Throwable {
GoogleCodingConvention googleCodingConvention0 = new GoogleCodingConvention();
SimpleErrorReporter simpleErrorReporter0 = new SimpleErrorReporter();
JSTypeRegistry jSTypeRegistry0 = new JSTypeRegistry(simpleErrorReporter0, false);
Node node0 = Node.newString("Object#Element");
Node node1 = Node.newString("Object#Element");
Node node2 = new Node(37, node1, node0);
ClosureReverseAbstractInterpreter closureReverseAbstractInterpreter0 = new ClosureReverseAbstractInterpreter(googleCodingConvention0, jSTypeRegistry0);
FlowScope flowScope0 = closureReverseAbstractInterpreter0.getPreciserScopeKnowingConditionOutcome(node2, (FlowScope) null, false);
assertNull(flowScope0);
}
@Test(timeout = 4000)
public void test5() throws Throwable {
GoogleCodingConvention googleCodingConvention0 = new GoogleCodingConvention();
SimpleErrorReporter simpleErrorReporter0 = new SimpleErrorReporter();
JSTypeRegistry jSTypeRegistry0 = new JSTypeRegistry(simpleErrorReporter0, false);
ClosureReverseAbstractInterpreter closureReverseAbstractInterpreter0 = new ClosureReverseAbstractInterpreter(googleCodingConvention0, jSTypeRegistry0);
Node node0 = Node.newNumber(1900.42548);
Node node1 = new Node(37, node0, node0);
FlowScope flowScope0 = closureReverseAbstractInterpreter0.getPreciserScopeKnowingConditionOutcome(node1, (FlowScope) null, true);
assertNull(flowScope0);
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
5c7c758c8e2c2efbabf843af1c43a10511194b8c | 7bf95d62fda4f919130e70de3b48c9105ca73997 | /app/src/main/java/com/example/testproject/fragment/BlankFragment.java | 4cf3d146f9b8da8db6067595571c707dc020b3a9 | [] | no_license | fm183/TestProject | 5c20c8a2453f8f5ec518f4322fe8ac5988f016ed | 1e0aec2b7e9e2cde4bb1673eb409466e2c41e357 | refs/heads/master | 2022-11-17T21:35:31.244567 | 2020-07-23T06:45:09 | 2020-07-23T06:45:09 | 281,870,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,462 | java | package com.example.testproject.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import com.example.testproject.R;
import com.example.testproject.bean.User;
import com.example.testproject.viewmodel.BlankViewModel;
public class BlankFragment extends Fragment {
private BlankViewModel mViewModel;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.blank_fragment, container, false);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (getActivity() == null) {
return;
}
mViewModel = new ViewModelProvider(getActivity()).get(BlankViewModel.class);
mViewModel.setUser(new User());
View view = getView();
if (view == null) {
return;
}
view.findViewById(R.id.tv).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mViewModel.setUserName("Hello Blank");
}
});
}
}
| [
"fanming_183@163.com"
] | fanming_183@163.com |
6c1e8dbe91ff85472826727a135cf29269b20af9 | 2ca48c04958f11ed9834b6692566af6531ea05ef | /app/src/main/java/com/example/harboreye/LoginActivity.java | 4f842bc96950f1a819c21a3a94334de5f4bdff4f | [] | no_license | urtbest86/HarborEye_test | 539b43fe3b7e2114ba2c785f69fd9733c169dd04 | 3854b73e9809398e439a3067ff64ad90d75d8db1 | refs/heads/master | 2023-08-14T18:40:59.823357 | 2021-10-15T08:31:36 | 2021-10-15T08:31:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,422 | java | package com.example.harboreye;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.Task;
public class LoginActivity extends AppCompatActivity implements View.OnClickListener{
private static final int RC_SIGN_IN=100;
private GoogleSignInClient mGoogleSignInClient;
private SignInButton googleButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
// Build a GoogleSignInClient with the options specified by gso.
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
googleButton=findViewById(R.id.button_google);
googleButton.setOnClickListener(this);
}
//한 번 로그인하면 바로 메인화면으로 가는 거
@Override
protected void onStart()
{
super.onStart();
// Check for existing Google Sign In account, if the user is already signed in
// the GoogleSignInAccount will be non-null.
GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
updateUI(account);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
// The Task returned from this call is always completed, no need to attach
// a listener.
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
}
}
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
// Signed in successfully, show authenticated UI.
updateUI(account);
} catch (ApiException e) {
// The ApiException status code indicates the detailed failure reason.
// Please refer to the GoogleSignInStatusCodes class reference for more information.
updateUI(null);
}
}
private void updateUI(GoogleSignInAccount account) {
Intent intent = new Intent(getApplicationContext(), MenuActivity.class);
startActivity(intent);
finish();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button_google:
signIn();
break;
// ...
}
}
private void signIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
}
| [
"urtbest86@gmail.com"
] | urtbest86@gmail.com |
2c52f5572d0a4bb2cee40fd68cce740a1b0d3c9e | 9474744c160c9c68197807d9dce53ea6a27c7fdf | /src/main/java/com/mobian/concurrent/CompletionService.java | 640e6ab5d9d4c91d65e8f8054293d4178e3c9269 | [] | no_license | xuwenming/ethealth | d250a104c5149516bacafb1731b9dc3455aeac4d | ff7238c2ed280927f8ec4f40d0a97673e54d45f4 | refs/heads/master | 2022-12-21T22:49:56.544654 | 2021-01-08T03:00:40 | 2021-01-08T03:00:40 | 109,663,512 | 0 | 0 | null | 2022-12-16T02:00:34 | 2017-11-06T07:47:41 | Java | UTF-8 | Java | false | false | 207 | java | package com.mobian.concurrent;
import java.util.concurrent.Future;
/**
* Created by john on 16/8/7.
*/
public interface CompletionService<V> {
Future<V> submit(Task<?, V> task);
void sync();
}
| [
"252429711@qq.com"
] | 252429711@qq.com |
cb4afaadeee5a098e15aa3c2b4ffccd196b18c3e | 5510132205e406736c6d6d408f270da5f5497107 | /src/core/message/define/CodeMessageBase.java | 82b4e854814b3c681c15de060467ecc07c22c527 | [] | no_license | chongtianfeiyu/JavaServerFramework | c861deb7ae8c3b59a2d9db4246f4fd181429853e | 63c2ef10391b9c542008cc9b3fffbaeae4bb5325 | refs/heads/master | 2022-01-14T10:24:38.661350 | 2019-01-29T01:51:12 | 2019-01-29T01:51:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package core.message.define;
public class CodeMessageBase extends MessageBase
{
public int code;
public String e="";
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getE() {
return e;
}
public void setE(String e) {
this.e = e;
}
}
| [
"kxjhaha@vip.qq.com"
] | kxjhaha@vip.qq.com |
dd2ba3982fdf1603d8d9255cc2f25e30dc05b610 | 5ed0e0904755c34cde293fdab920bb6e73f21623 | /Assignment3/src/MiniCPrintListener.java | 20cdbcd63e21f3ea067f3245dc79cd9d97d5e46a | [] | no_license | sh92/Compiler-University | 277c641d6424894010ff09b6feb4a6dd4af86e0d | 7b7d9d7be2515fd6a7bbe95c2e0324e4a7b771a5 | refs/heads/master | 2021-03-27T14:45:19.674598 | 2018-07-16T06:02:04 | 2018-07-16T06:02:04 | 73,081,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,419 | java | import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.*;
public class MiniCPrintListener extends MiniCBaseListener{
ParseTreeProperty<String> exprProperty = new ParseTreeProperty<String>();
ParseTreeProperty<String> Params = new ParseTreeProperty<String>();
ParseTreeProperty<String> Stmt = new ParseTreeProperty<String>();
ParseTreeProperty<String> ReturnStmt = new ParseTreeProperty<String>();
private int depth=0;
private int ifDepth=0;
private int whileDepth=0;
private static String isFirstBlockType="";
private static boolean isFirst=true;
@Override public void enterIf_stmt(MiniCParser.If_stmtContext ctx) {
ifDepth++;
}
private StringBuffer getIndentation() {
StringBuffer indentation=new StringBuffer();
for(int i =0;i<depth;i++){
indentation.append("....");
}
return indentation;
}
@Override public void exitIf_stmt(MiniCParser.If_stmtContext ctx) {
if(isFirst) {
isFirstBlockType = "if";
isFirst=false;
}
ifDepth--;
}
@Override public void exitStmt(MiniCParser.StmtContext ctx) {
if(ctx.expr_stmt()!=null) {
printExprOutOfBlock(ctx);
}else{
printReturnOutOfBlock(ctx);
}
if(Stmt.get(ctx)==null){
if(ChildStartWith(ctx, "{")) {
putStatement(ctx);
}else if(ChildStartWith(ctx, "if")){
putIfStatement(ctx);
}else if(ChildStartWith(ctx, "while")) {
putWhileStatement(ctx);
}
}
}
private boolean ChildStartWith(MiniCParser.StmtContext ctx, String prefix) {
return ctx.getChild(0).getText().startsWith(prefix);
}
private void putWhileStatement(MiniCParser.StmtContext ctx) {
int count = 0;
StringBuffer sbuf = new StringBuffer("");
boolean makeBracelet=false;
int index =-1;
for (int i = 0; i < ctx.getChild(0).getChildCount(); i++) {
String text = ctx.getChild(0).getChild(i).getText();
String ChildStmt = Stmt.get(ctx.getChild(0).getChild(i));
String exponential = exprProperty.get(ctx.getChild(0).getChild(i));
if(exponential!=null){
count++;
sbuf.append(exponential);
}else{
if (ChildStmt != null) {
count++;
sbuf.append(ChildStmt);
}else {
if(text.equals("while"))
sbuf.append("while ");
else if(text.equals(")")) {
String t_next = ctx.getChild(0).getChild(i+1).getText();
sbuf.append(text + "\n");
if(!t_next.startsWith("{")){
makeBracelet=true;
index=i+1;
break;
}
}
else
sbuf.append(text);
}
}
}
StringBuffer makeStmt;
if(makeBracelet) {
int count2 = 0;
int backup=depth;
while (depth<ifDepth+whileDepth)
depth++;
depth++;
makeStmt= new StringBuffer(getIndentation().toString()+"{\n");
depth++;
for (int i = index; i < ctx.getChild(0).getChildCount(); i++) {
String t = Stmt.get(ctx.getChild(0).getChild(i));
if (t != null) {
count2++;
makeStmt.append(getIndentation().toString());
if(t.startsWith("if") || t.startsWith("while")) {
makeStmt.append(t+"\n");
}else if(t.startsWith("return")){
makeStmt.append(t+"\n");
}
else{
makeStmt.append(t+";\n");
}
}
}
depth--;
makeStmt.append( getIndentation().toString()+"}");
depth=backup;
if (count2 > 0) {
sbuf.append(makeStmt.toString());
}
}
String s2 = sbuf.toString();
if(depth==1 && whileDepth==0 && isFirstBlockType.equals("while")) {
System.out.println(getIndentation() + s2);
}
if (count > 0) {
Stmt.put(ctx, s2);
}
}
private void putIfStatement(MiniCParser.StmtContext ctx) {
int count = 0;
StringBuffer sbuf = new StringBuffer("");
boolean makeBracelet=false;
int index =-1;
for (int i = 0; i < ctx.getChild(0).getChildCount(); i++) {
String text = ctx.getChild(0).getChild(i).getText();
String t = Stmt.get(ctx.getChild(0).getChild(i));
String exp = exprProperty.get(ctx.getChild(0).getChild(i));
if(exp!=null){
count++;
sbuf.append(exp);
}else{
if (t != null) {
count++;
sbuf.append(t);
}else {
if(text.equals("if")) {
sbuf.append("if ");
}
else if(text.equals(")")) {
String t_next = ctx.getChild(0).getChild(i+1).getText();
sbuf.append(text + "\n");
if(!t_next.startsWith("{")){
makeBracelet=true;
index=i+1;
break;
}
}
else
sbuf.append(text);
}
}
}
StringBuffer makeStmt;
if(makeBracelet) {
int count2 = 0;
int backup=depth;
while (depth<ifDepth+whileDepth)
depth++;
depth++;
makeStmt= new StringBuffer(getIndentation().toString()+"{\n");
depth++;
for (int i = index; i < ctx.getChild(0).getChildCount(); i++) {
String t = Stmt.get(ctx.getChild(0).getChild(i));
if (t != null) {
count2++;
makeStmt.append(getIndentation().toString());
if(t.startsWith("if") || t.startsWith("while")) {
makeStmt.append(t+"\n");
}else if(t.startsWith("return")){
makeStmt.append(t+"\n");
}
else{
makeStmt.append(t+";\n");
}
}
}
depth--;
makeStmt.append( getIndentation().toString()+"}");
depth=backup;
if (count2 > 0) {
sbuf.append(makeStmt.toString());
}
}
String s2 = sbuf.toString();
if(depth==1 && ifDepth==0 && isFirstBlockType.equals("if"))
System.out.println(getIndentation()+s2 );
if (count > 0) {
Stmt.put(ctx, s2);
}
}
private void putStatement(MiniCParser.StmtContext ctx) {
int count = 0;
int backup=depth;
while (depth<ifDepth+whileDepth)
depth++;
StringBuffer sbuf = new StringBuffer(getIndentation().toString()+"{\n");
depth++;
for (int i = 0; i < ctx.getChild(0).getChildCount(); i++) {
String t = Stmt.get(ctx.getChild(0).getChild(i));
if (t != null) {
count++;
sbuf.append(getIndentation().toString());
if(t.startsWith("if") || t.startsWith("while")) {
sbuf.append(t+"\n");
}else if(t.startsWith("return")){
sbuf.append(t+"\n");
}
else{
sbuf.append(t+";\n");
}
}
}
depth--;
sbuf.append( getIndentation().toString()+"}");
depth=backup;
if (count > 0) {
Stmt.put(ctx, sbuf.toString());
}
}
private void printReturnOutOfBlock(MiniCParser.StmtContext ctx) {
String returnStmt = ReturnStmt.get(ctx);
if(returnStmt!=null){
Stmt.put(ctx, returnStmt);
if(ifDepth==0 && whileDepth==0 && depth==1){
System.out.println(getIndentation()+returnStmt);
}
}
}
private void printExprOutOfBlock(MiniCParser.StmtContext ctx) {
String s=exprProperty.get(ctx.expr_stmt());
if (ifDepth == 0 && whileDepth == 0 && depth == 1 )
System.out.println(getIndentation().toString() + s + ";");
Stmt.put(ctx,s);
}
// 아래는 보조 메소드이다.
boolean isBinaryOperation(MiniCParser.ExprContext ctx){
return ctx.getChildCount() == 3
&& ctx.getChild(1) != ctx.expr();
// 자식 3개짜리 expr 중 ‘(‘ expr ’)’를 배제
}
@Override
public void exitExpr(MiniCParser.ExprContext ctx) {
String s1 = null, s2 = null, op = null;
if (isBinaryOperation(ctx)) {
// 예: expr ‘+’ expr
s1 = exprProperty.get(ctx.expr(0));
s2 = exprProperty.get(ctx.expr(1));
op = ctx.getChild(1).getText();
if(op.equals("=")){
exprProperty.put(ctx, ctx.getChild(0).getText()+" "+op+" "+s1);
}else {
exprProperty.put(ctx, s1 + " " + op + " " + s2);
}
}else {
exprProperty.put(ctx,ctx.getText());
}
}
@Override public void exitVar_decl(MiniCParser.Var_declContext ctx) {
int i;
for(i=0;i<ctx.getChildCount()-2;i++){
System.out.print(ctx.getChild(i).getText()+" ");
}
System.out.print(ctx.getChild(i));
i++;
System.out.print(ctx.getChild(i));
System.out.println();
}
@Override public void enterFun_decl(MiniCParser.Fun_declContext ctx) {
System.out.print(ctx.getChild(0).getText()+" "+ctx.getChild(1));
}
@Override public void exitFun_decl(MiniCParser.Fun_declContext ctx) {
System.out.println("}");
depth--;
}
@Override public void enterParams(MiniCParser.ParamsContext ctx) {
System.out.print("(");
}
@Override public void exitParams(MiniCParser.ParamsContext ctx) {
int i;
String s;
for(i =0;i<ctx.param().size()-1;i++){
s=Params.get(ctx.param(i));
if(s!=null)
System.out.print(Params.get(ctx.param(i))+", ");
}
s=Params.get(ctx.param(i));
if(s!=null)
System.out.print(s);
System.out.println(")\n{");
depth++;
}
@Override public void exitParam(MiniCParser.ParamContext ctx) {
StringBuilder sbd = new StringBuilder();
for(ParseTree pst: ctx.children){
sbd.append(pst.getText()+" ");
}
sbd.delete(sbd.length()-1,sbd.length());
Params.put(ctx,sbd.toString());
}
@Override public void exitExpr_stmt(MiniCParser.Expr_stmtContext ctx) {
MiniCParser.ExprContext px = ctx.expr();
String s= exprProperty.get(px);
exprProperty.put(ctx,s);
}
@Override public void enterWhile_stmt(MiniCParser.While_stmtContext ctx) {
if(isFirst) {
isFirstBlockType = "while";
isFirst=false;
}
whileDepth++;
}
@Override public void exitWhile_stmt(MiniCParser.While_stmtContext ctx) {
whileDepth--;
}
@Override public void exitLocal_decl(MiniCParser.Local_declContext ctx) {
StringBuffer indentation = getIndentation();
int i;
for( i =0;i<ctx.getChildCount()-2;i++){
System.out.print(indentation.toString()+ctx.getChild(i).getText()+" ");
}
System.out.print(ctx.getChild(i));
i++;
System.out.println(ctx.getChild(i));
}
@Override public void exitReturn_stmt(MiniCParser.Return_stmtContext ctx) {
ParserRuleContext psr = ctx.getParent();
ReturnStmt.put(psr,ctx.getChild(0)+" "+ctx.expr().getText()+ctx.getChild(2));
}
}
| [
"sanghee.lee1992@gmail.com"
] | sanghee.lee1992@gmail.com |
335ef22679e7c2cef9fe7c4fff2418b510c21229 | 5857f948160fc871cca42050a82dee674c9f3add | /src/main/java/co/edu/sena/controllers/TareaJpaController.java | 89967d9679e2f2c7405a18a48ea3fa66d7a1e127 | [] | no_license | lejabamo/98135082_prueba_2 | f36f4f7c0d9e24ace23d4ca151d95997ec8a62c6 | 28de527f44d582bf41cb096cd1772c5012815e39 | refs/heads/master | 2020-04-20T01:12:35.100985 | 2019-01-31T21:32:39 | 2019-01-31T21:32:39 | 168,539,191 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,499 | 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 co.edu.sena.controllers;
import co.edu.sena.controllers.exceptions.NonexistentEntityException;
import co.edu.sena.entidades.Tarea;
import java.io.Serializable;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Query;
import javax.persistence.EntityNotFoundException;
import javax.persistence.Persistence;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
/**
*
* @author LEONARDO
*/
public class TareaJpaController implements Serializable {
public TareaJpaController(){
this.emf = Persistence.createEntityManagerFactory("JPU");
}
public TareaJpaController(EntityManagerFactory emf) {
this.emf = emf;
}
private EntityManagerFactory emf = null;
public EntityManager getEntityManager() {
return emf.createEntityManager();
}
public void create(Tarea tarea) {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
em.persist(tarea);
em.getTransaction().commit();
} finally {
if (em != null) {
em.close();
}
}
}
public void edit(Tarea tarea) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
tarea = em.merge(tarea);
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
Integer id = tarea.getIdtarea();
if (findTarea(id) == null) {
throw new NonexistentEntityException("The tarea with id " + id + " no longer exists.");
}
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public void destroy(Integer id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Tarea tarea;
try {
tarea = em.getReference(Tarea.class, id);
tarea.getIdtarea();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tarea with id " + id + " no longer exists.", enfe);
}
em.remove(tarea);
em.getTransaction().commit();
} finally {
if (em != null) {
em.close();
}
}
}
public List<Tarea> findTareaEntities() {
return findTareaEntities(true, -1, -1);
}
public List<Tarea> findTareaEntities(int maxResults, int firstResult) {
return findTareaEntities(false, maxResults, firstResult);
}
private List<Tarea> findTareaEntities(boolean all, int maxResults, int firstResult) {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(Tarea.class));
Query q = em.createQuery(cq);
if (!all) {
q.setMaxResults(maxResults);
q.setFirstResult(firstResult);
}
return q.getResultList();
} finally {
em.close();
}
}
public Tarea findTarea(Integer id) {
EntityManager em = getEntityManager();
try {
return em.find(Tarea.class, id);
} finally {
em.close();
}
}
public int getTareaCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<Tarea> rt = cq.from(Tarea.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c769210e0f6d15acde5c527777fc54c9817dfbaa | 02291c835f667bfa55cc6908f62e3d19ca5ea5f5 | /bigdata/MapReduce/AdvanceHadoop/src/main/java/com/edge/fileMerge/sequenceFile/WholeFileRecordReader.java | 993f7111b5848c1b1e3c97fe50d3f4d0de567592 | [] | no_license | hadoopedge/edge | b447881badcebf444869bff21c6208f9bbe51f58 | 9451c34abc61bddb804705b64922c070940ddc3c | refs/heads/master | 2020-03-27T07:27:37.144649 | 2018-08-26T15:32:14 | 2018-08-26T15:32:14 | 146,192,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,058 | java | package com.edge.fileMerge.sequenceFile;
//cc WholeFileRecordReader The RecordReader used by WholeFileInputFormat for reading a whole file as a record
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
//vv WholeFileRecordReader
class WholeFileRecordReader extends RecordReader<NullWritable, BytesWritable> {
private FileSplit fileSplit;
private Configuration conf;
private BytesWritable value = new BytesWritable();
private boolean processed = false;
@Override
public void initialize(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException {
this.fileSplit = (FileSplit) split;
this.conf = context.getConfiguration();
}
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
if (!processed) {
byte[] contents = new byte[(int) fileSplit.getLength()];
Path file = fileSplit.getPath();
FileSystem fs = file.getFileSystem(conf);
FSDataInputStream in = null;
try {
in = fs.open(file);
IOUtils.readFully(in, contents, 0, contents.length);
value.set(contents, 0, contents.length);
} finally {
IOUtils.closeStream(in);
}
processed = true;
return true;
}
return false;
}
@Override
public NullWritable getCurrentKey() throws IOException, InterruptedException {
return NullWritable.get();
}
@Override
public BytesWritable getCurrentValue() throws IOException, InterruptedException {
return value;
}
@Override
public float getProgress() throws IOException {
return processed ? 1.0f : 0.0f;
}
@Override
public void close() throws IOException {
}
}
| [
"koushikpaul1@gmail.com"
] | koushikpaul1@gmail.com |
100c5adf34e0218e2bc6a4cc94794ad396064959 | 1942d3444e3711437e8748bb17264bfca9248ae9 | /gleifparser/src/main/java/com/inmemory/gleifparser/model/level1/ValidationSourcesEnum.java | 9cab7a8b9c8f3b055537b4d49a45a51042c475ae | [] | no_license | yamunanr/Yamuna-Nagasandra-Rajaiah | 92b66a645cf1357b85fffeae0f00f755c8f0f2bb | d31f9bf379bb4c84156bdce38d9a3b5c5e1ac67a | refs/heads/master | 2020-05-16T21:02:18.228246 | 2019-04-24T19:48:46 | 2019-04-24T19:48:46 | 183,295,555 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,314 | java |
package com.inmemory.gleifparser.model.level1;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ValidationSourcesEnum.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="ValidationSourcesEnum">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="PENDING"/>
* <enumeration value="ENTITY_SUPPLIED_ONLY"/>
* <enumeration value="PARTIALLY_CORROBORATED"/>
* <enumeration value="FULLY_CORROBORATED"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "ValidationSourcesEnum")
@XmlEnum
public enum ValidationSourcesEnum {
/**
* The validation of the reference data provided by the registrant has not
* yet occurred.
*
*/
PENDING,
/**
* Based on the validation procedures in use by the LOU responsible for the
* record, the information associated with this record has significant reliance on the
* information that a submitter provided due to the unavailability of corroborating
* information.
*
*/
ENTITY_SUPPLIED_ONLY,
/**
* Based on the validation procedures in use by the LOU responsible for the
* record, the information supplied by the registrant can be partially corroborated by
* public authoritative sources, while some of the record is dependent upon the information
* that the registrant submitted, either due to conflicts with authoritative information,
* or due to data unavailability.
*
*/
PARTIALLY_CORROBORATED,
/**
* Based on the validation procedures in use by the LOU responsible for the
* record, there is sufficient information contained in authoritative public sources to
* corroborate the information that the submitter has provided for the
* record.
*
*/
FULLY_CORROBORATED;
public String value() {
return name();
}
public static ValidationSourcesEnum fromValue(String v) {
return valueOf(v);
}
}
| [
"bhuvanesh.leelakrishnan@gmail.com"
] | bhuvanesh.leelakrishnan@gmail.com |
42eacd425c5a680db1d45cb6f1ccfa1926bf3bb0 | d85420b556c249325e2d9b67f658f05e3c43d6fa | /src/main/java/com/cxy/favourite/domain/view/CommentView.java | 1cbc0e1766bd9bea18be3bda6f9a16247658e591 | [] | no_license | currynice/favourite | de264236dfb2b6c8544512d9dd2fcaf8ade77324 | d1664061833e0eaee5b9bd82b006c5eba320955e | refs/heads/master | 2020-05-01T10:07:13.855049 | 2019-04-15T07:49:03 | 2019-04-15T07:49:03 | 177,414,461 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.cxy.favourite.domain.view;
/**
评论
*/
public interface CommentView {
Long getUserId();
String getUserName();
String getProfilePicture();
String getContent();
Long getCreateTime();
Long getReplyUserId();
}
| [
"694975984@qq.com"
] | 694975984@qq.com |
ebd3eaab913339a71b0cf58145e0299cf75b41c7 | 8b1177adf5a08614afb3bc02881fdaaa8ecfb873 | /springbootServiceDiscovery/src/test/java/com/springbootServiceDiscovery/AppTest.java | b1cb759a889674e755a21c7b76390354b9fa2927 | [] | no_license | Vishnu-Prabhakar/springboot-Microservice | 0eea092f712fb161bcc97b95ef4af0db38d7ba61 | 65b0126c804aac4270a1f7f1687ef9e391fb234e | refs/heads/master | 2020-04-07T07:06:43.021823 | 2020-03-28T14:42:58 | 2020-03-28T14:42:58 | 158,164,123 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package com.springbootServiceDiscovery;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"rviprabh@publicisgroupe.net"
] | rviprabh@publicisgroupe.net |
a0451a3c07020f8708c0c65d71f26983695c9f8c | 542f352614185ea134355b61a8ee11d5e7d713af | /zfgj-security-spring-boot/src/main/java/com/dlfc/zfgj/security/exception/GenerateTokenException.java | e60bc70f659bc9ae2dc86abcfd44233cac24fa8e | [] | no_license | iversonwuwei/zfgj-spring-boot-1.0.0 | 1798d3af99bd8a658e206f12627deef04d016ec9 | 2a28568290edd17ac557b878e095e824d8b5d1ed | refs/heads/master | 2021-01-25T09:31:51.563362 | 2017-06-09T10:08:33 | 2017-06-09T10:10:08 | 93,845,536 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | /**
* @Copyright: (c) 2017 DLFC. All rights reserved.
*
* @name: GenerateTokenException.java
* @description:
*
* @version: 1.0
* @date : Apr 18, 2017
* @author: dean
*
* @Modification History:<br>
* Date Author Version Discription
* Apr 18, 2017 dean 1.0 <修改原因描述>
*/
package com.dlfc.zfgj.security.exception;
import com.housecenter.dlfc.framework.exception.model.ApplicationException;
/**
* @name: GenerateTokenException
* @description:
*
* @version 1.0
* @author dean
*
*/
public class GenerateTokenException extends ApplicationException {
private static final long serialVersionUID = 5510160378374641505L;
private static final String ERROR_MESSAGE = "Token生成失败";
public GenerateTokenException() {
this(null);
}
public GenerateTokenException(Throwable cause) {
super(ERROR_MESSAGE, cause);
setErrorCode(CaErrorCode.GENERATE_TOKEN_FAILURE.getErrorCode());
}
}
| [
"wuwei@housecenter.cn"
] | wuwei@housecenter.cn |
bc105b71331c21eef666918f89888dcd9f597c50 | fd7df5602610f52def284804eb21aabc45d342fc | /app/src/androidTest/java/com/rl/riloco/loginconface/ExampleInstrumentedTest.java | 765b397e9252da776726b04b7dbc11b252048741 | [] | no_license | Rickylop/LoginconFace | 568265b615c0d98b57a0fec97e5e30f3bbeb8d4c | 014db2e87855388033b0aa81456ae2c77a2ad99b | refs/heads/master | 2021-01-21T10:59:41.887462 | 2017-03-01T03:53:43 | 2017-03-01T03:53:43 | 83,509,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.rl.riloco.loginconface;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.rl.riloco.loginconface", appContext.getPackageName());
}
}
| [
"riloco@debian"
] | riloco@debian |
c901e3b6074169dafc72beaa17797e000dbfe17e | 2286229b90e1bea4fcbe9aa70723f6583fca1ed1 | /src/Thread/TestJoin.java | 4c961e34daf073513f8ca0f119c5021742ca88c6 | [] | no_license | kco1989/LearningCode | f24933ec17cfa9c023907951a94e5e634f0a1849 | be4b5d71b9ea66d0312c1b4c9abda6cc2ea02a32 | refs/heads/master | 2016-09-06T21:55:21.279613 | 2015-06-30T13:19:20 | 2015-06-30T13:19:20 | 35,318,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,356 | java | package Thread;
/**
* 测试Thread.join
* join() 让"主线程"等待"子线程"结束之后才能继续运行
* @author kco1989
* @email kco1989@qq.com
* @data 2015年5月9日
*/
public class TestJoin {
static class Father extends Thread{
@Override
public void run() {
System.out.println("father start run");
Son s = new Son();
s.start();
try {
s.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("father stop run");
}
}
static class Son extends Thread{
@Override
public void run() {
System.out.println("Son start run");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Son stop run");
}
}
// public static void main(String[] args) {
// System.out.println("main start run");
// new Father().start();
// System.out.println("main stop run");
// }
public static void main(String[] args) {
System.out.println("main start run");
Father f1 = new Father();
f1.start();
try {
f1.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("main stop run");
}
}
| [
"kco1989@qq.com"
] | kco1989@qq.com |
7804e5a790930c4e491270f5953dbe5303a016e6 | 50783e1b1feae6b45697fbacbd39b0d63993f95a | /app/src/main/java/app/wxapkfiles/api/bean/resp/UpdateResp.java | 01e778555693463eac3f307d5a26d09f6f6ff336 | [] | no_license | waelchateur/WeChat-APKFiles-Installer | bf76bd7de0804cb347e4142f2d10951544571750 | bd00dd16e568ac74af9e4c055dc5163f38089e50 | refs/heads/main | 2023-01-22T21:35:46.534144 | 2020-12-09T03:57:32 | 2020-12-09T03:57:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | package app.wxapkfiles.api.bean.resp;
import app.network.bean.BaseResp;
/**
* File: UpdateResp
* Author: CoolSnow(coolsnow2020@gmail.com)
* Created at: 2020/12/8 16:34
* Description:
*/
public class UpdateResp extends BaseResp {
private int vcode;
private String vname;
private String url;
private String hint;
public int getVcode() {
return vcode;
}
public void setVcode(int vcode) {
this.vcode = vcode;
}
public String getVname() {
return vname;
}
public void setVname(String vname) {
this.vname = vname;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getHint() {
return hint;
}
public void setHint(String hint) {
this.hint = hint;
}
}
| [
"coolsnow2020@gmail.com"
] | coolsnow2020@gmail.com |
271e2724cbe08d75ce66d1ceba91dc3115649c6b | 12886e94c2d0620c8c7e376cdce08f3741eef027 | /src/Code/Conexion.java | a4ec6c7eeb3a590c25e6b09740f8e2d3f1abf5f5 | [] | no_license | osneiderDavid/Heladeria | cb81f2fa60c4361a9affb71e583db68bedbe4d70 | 57455672ae6c8dae3ec7067ae40bcae3b1d320d6 | refs/heads/master | 2022-12-10T01:19:52.054613 | 2020-09-08T23:33:48 | 2020-09-08T23:33:48 | 293,929,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | java | package Code;
import java.sql.Connection;
import java.sql.DriverManager;
public class Conexion {
public static Connection Conexion(){
Connection conex = null;
try{
Class.forName("com.mysql.jdbc.Driver");
conex = DriverManager.getConnection("jdbc:mysql://localhost:3306/heladeria", "root", "");
System.out.println("Conectado");
} catch(Exception error){
System.out.println("Error en la conexion: "+error);
}
return conex;
}
}
| [
"escritura.100.com@gmail.com"
] | escritura.100.com@gmail.com |
0128f92d1a909484a51477b92dcc22a80f7f234b | c9c89edaaae860d9981173fe03a4d97cb4d65d6a | /eclipse-workspace/AboutObjets/src/car/CarShow.java | 2aca63144eb82b3f90039ac7b6dbc1f738371ae7 | [] | no_license | Lysenia/FirstGitRepository | c56a31a8e6766e224da7e16d5f67dcbdc2435756 | 0df8c2e6277d21d81d9fc002fdfa2da0d79d43b9 | refs/heads/master | 2021-06-09T12:56:25.244091 | 2020-11-20T03:25:34 | 2020-11-20T03:25:34 | 136,673,120 | 0 | 0 | null | 2021-05-03T03:07:41 | 2018-06-08T22:57:33 | Java | UTF-8 | Java | false | false | 439 | java | package car;
public class CarShow {
public static void main(String args[]) {
Car c1 = new Car();
Car c2 = new Car("Mazda", "Toyota", 2018);
Car c3 = new Car("BMW", "bmw", 2017, "blue", 20000);
Car c4 = new Car("Lucky", "Toyota", 2008, "green", 24000);
Car c5 = new Car("Wix", "Honda", 22000);
c5.setPrice(1000);
Car[] allCars = {c1, c2, c3, c4, c5};
for(Car eachCar: allCars) {
eachCar.Display();
}
}
}
| [
"lesialysiak@gmail.com"
] | lesialysiak@gmail.com |
413b10eebe015d07346dd5a3bf78e0915103cac2 | 9284056ad504e81646f207a94f9c30e59398111e | /cf-app/cf-service/src/main/java/cn/com/jansh/core/security/web/authentication/MyWebAuthenticationDetails.java | 981a27b50ed224db74ff04747fdc6f3b8893eb52 | [] | no_license | ice24for/learnCode | 9e3fd6fe5d5c19799b5010e690dc28fa676b9fd5 | 46baa3c97253127852b3b044f48c4c95b24c0c61 | refs/heads/master | 2023-07-24T10:03:13.820723 | 2019-09-30T02:09:02 | 2019-09-30T02:09:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,995 | java | /**
* MyWebAuthenticationDetails.java
* 2016年1月20日 上午11:23:00
*
* 版权所有(C) 2016 北京坚石诚信科技有限公司
*/
package cn.com.jansh.core.security.web.authentication;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import cn.com.jansh.core.web.util.AppUtil;
/**
* @author nie
*
*/
public class MyWebAuthenticationDetails{
private final String remoteAddress;
private final String sessionId;
// ~ Constructors
// ===================================================================================================
/**
* Records the remote address and will also set the session Id if a session
* already exists (it won't create one).
*
* @param request
* that the authentication request was received from
*/
public MyWebAuthenticationDetails(HttpServletRequest request) {
// this.remoteAddress = request.getRemoteAddr();
this.remoteAddress = AppUtil.getRemoteIpAddr(request);
HttpSession session = request.getSession(false);
this.sessionId = (session != null) ? session.getId() : null;
}
// ~ Methods
// ========================================================================================================
public boolean equals(Object obj) {
if (obj instanceof WebAuthenticationDetails) {
WebAuthenticationDetails rhs = (WebAuthenticationDetails) obj;
if ((remoteAddress == null) && (rhs.getRemoteAddress() != null)) {
return false;
}
if ((remoteAddress != null) && (rhs.getRemoteAddress() == null)) {
return false;
}
if (remoteAddress != null) {
if (!remoteAddress.equals(rhs.getRemoteAddress())) {
return false;
}
}
if ((sessionId == null) && (rhs.getSessionId() != null)) {
return false;
}
if ((sessionId != null) && (rhs.getSessionId() == null)) {
return false;
}
if (sessionId != null) {
if (!sessionId.equals(rhs.getSessionId())) {
return false;
}
}
return true;
}
return false;
}
/**
* Indicates the TCP/IP address the authentication request was received
* from.
*
* @return the address
*/
public String getRemoteAddress() {
return remoteAddress;
}
/**
* Indicates the <code>HttpSession</code> id the authentication request was
* received from.
*
* @return the session ID
*/
public String getSessionId() {
return sessionId;
}
public int hashCode() {
int code = 7654;
if (this.remoteAddress != null) {
code = code * (this.remoteAddress.hashCode() % 7);
}
if (this.sessionId != null) {
code = code * (this.sessionId.hashCode() % 7);
}
return code;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString()).append(": ");
sb.append("RemoteIpAddress: ").append(this.getRemoteAddress()).append("; ");
sb.append("SessionId: ").append(this.getSessionId());
return sb.toString();
}
}
| [
"guolonglong80@163.com"
] | guolonglong80@163.com |
a5df7e34ccda35989a36a79b5c5c198725457f8d | 06271f77f3b3e9f859f53f6a36b0a85e023b50b6 | /WilCard/src/WildCardAnotherExample/B.java | 35e279572e5dee3191b8183dbbbb3ae712386944 | [] | no_license | sunzidanasrin/Core-Java | 14b63850db176c3a23193755b898b7090622aed3 | fc1475eb2a302a4a73359e617f3eaceb9999c895 | refs/heads/master | 2021-01-19T19:30:10.610542 | 2017-10-11T07:12:10 | 2017-10-11T07:12:10 | 101,197,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 184 | java |
package WildCardAnotherExample;
public class B {
private double price;
public B() {
}
public B(double price) {
this.price = price;
}
}
| [
"sunzidanasrin"
] | sunzidanasrin |
aa922b4552b2a5c1587edfa839ef5ab699ffad26 | 97bdf2bb82e9921af1f43a7d424d6f82c5ead5ad | /app/src/androidTest/java/com/hie2j/service/ExampleInstrumentedTest.java | 142bfcdd2381acd05156cad75499921904fbd33d | [] | no_license | Jacob-hie/BindServiceEvent | 4d0394027123bf408b4e6aa9c839918d79588cf2 | a8cedb1f33705f23ff0546038860193ccfb98fca | refs/heads/master | 2020-04-11T22:29:41.896174 | 2018-12-17T13:52:18 | 2018-12-17T13:52:18 | 162,137,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package com.hie2j.service;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.hie2j.service", appContext.getPackageName());
}
}
| [
"634865739@qq.com"
] | 634865739@qq.com |
d6edad555529a2d70ab7add3f3a499c985aaea9d | 52e144f34faec46adbf848edda84aba46b5627de | /src/main/java/com/zq/simpledatax/common/util/StrUtil.java | 2280f943f2f7fb05787240483009e55b833d60bc | [] | no_license | aa8808021/simpledatax-service | 57826b478473a7a639ca29327737774b87106874 | 8070111b39f8ca837a42df158eb677bdb6512982 | refs/heads/master | 2020-08-29T10:48:33.273954 | 2019-07-04T01:36:30 | 2019-07-04T01:36:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,779 | java | package com.zq.simpledatax.common.util;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StrUtil {
private final static long KB_IN_BYTES = 1024;
private final static long MB_IN_BYTES = 1024 * KB_IN_BYTES;
private final static long GB_IN_BYTES = 1024 * MB_IN_BYTES;
private final static long TB_IN_BYTES = 1024 * GB_IN_BYTES;
private final static DecimalFormat df = new DecimalFormat("0.00");
private static final Pattern VARIABLE_PATTERN = Pattern
.compile("(\\$)\\{?(\\w+)\\}?");
private static String SYSTEM_ENCODING = System.getProperty("file.encoding");
static {
if (SYSTEM_ENCODING == null) {
SYSTEM_ENCODING = "UTF-8";
}
}
private StrUtil() {
}
public static String stringify(long byteNumber) {
if (byteNumber / TB_IN_BYTES > 0) {
return df.format((double) byteNumber / (double) TB_IN_BYTES) + "TB";
} else if (byteNumber / GB_IN_BYTES > 0) {
return df.format((double) byteNumber / (double) GB_IN_BYTES) + "GB";
} else if (byteNumber / MB_IN_BYTES > 0) {
return df.format((double) byteNumber / (double) MB_IN_BYTES) + "MB";
} else if (byteNumber / KB_IN_BYTES > 0) {
return df.format((double) byteNumber / (double) KB_IN_BYTES) + "KB";
} else {
return String.valueOf(byteNumber) + "B";
}
}
public static String replaceVariable(final String param) {
Map<String, String> mapping = new HashMap<String, String>();
Matcher matcher = VARIABLE_PATTERN.matcher(param);
while (matcher.find()) {
String variable = matcher.group(2);
String value = System.getProperty(variable);
if (StringUtils.isBlank(value)) {
value = matcher.group();
}
mapping.put(matcher.group(), value);
}
String retString = param;
for (final String key : mapping.keySet()) {
retString = retString.replace(key, mapping.get(key));
}
return retString;
}
public static String compressMiddle(String s, int headLength, int tailLength) {
Validate.notNull(s, "Input string must not be null");
Validate.isTrue(headLength > 0, "Head length must be larger than 0");
Validate.isTrue(tailLength > 0, "Tail length must be larger than 0");
if(headLength + tailLength >= s.length()) {
return s;
}
return s.substring(0, headLength) + "..." + s.substring(s.length() - tailLength);
}
}
| [
"eastzq@gmail.com"
] | eastzq@gmail.com |
bb423973e5495e215b5a621e1a87198a92814eb7 | 243979a80371e53e57b284d321caa78054fa9eb6 | /Leyou-common/src/main/java/com/leyou/paremeter/pojo/BrandQueryByPageParameter.java | 5665b4e8e79b66d53f473d5e36de4c8585d27a78 | [] | no_license | ForeverAndy/Reserch_LeYouMarket | ee53f9c985f044775e7da1c2f0234f4da4789be9 | 3794bcd2ebb71e60693c5266e314620b66773d23 | refs/heads/master | 2022-11-10T06:13:54.375423 | 2020-04-29T10:39:15 | 2020-04-29T10:39:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package com.leyou.paremeter.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.ToString;
/**
* @Author: 98050
* Time: 2018-08-08 11:38
* Feature:
*/
@Data
@AllArgsConstructor
@ToString
public class BrandQueryByPageParameter {
/*
* - page:当前页,int
- rows:每页大小,int
- sortBy:排序字段,String
- desc:是否为降序,boolean
- key:搜索关键词,String
* */
private Integer page;
private Integer rows;
private String sortBy;
private Boolean desc;
private String key;
public BrandQueryByPageParameter(){
super();
}
}
| [
"332450461@qq.com"
] | 332450461@qq.com |
656101783f174c43ff1e46c3ccc86e6e6c928686 | cc472110e87aba7a0caba00e914d4aff3ed8f93c | /app/src/main/java/com/eightventure_it/codewarriors/eventure/MainActivity.java | 751e197d7b25bdf92ac1cd10752aaa8244b58823 | [] | no_license | AVI5HEK/eVenture | 5619df472960464df6b1ac6fbee9c71b0e783ab7 | 77e1a264c3deb9d84498568a1b4c4be9b0f67822 | refs/heads/master | 2016-08-04T17:29:11.549637 | 2015-01-23T22:37:20 | 2015-01-23T22:37:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,352 | java | package com.eightventure_it.codewarriors.eventure;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
//import com.eightventure_it.codewarriors.eventure.library.DatabaseHandler;
//import com.eightventure_it.codewarriors.eventure.library.UserFunctions;
import java.util.HashMap;
public class MainActivity extends Activity {
Button btnLogout;
Button changepas;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
changepas = (Button) findViewById(R.id.btchangepass);
btnLogout = (Button) findViewById(R.id.logout);
DatabaseHandler db = new DatabaseHandler(getApplicationContext());
/**
* Hashmap to load data from the Sqlite database
**/
HashMap<String,String> user = new HashMap<String, String>();
user = db.getUserDetails();
/**
* Change Password Activity Started
**/
changepas.setOnClickListener(new View.OnClickListener(){
public void onClick(View arg0){
Intent chgpass = new Intent(getApplicationContext(), ChangePasswordActivity.class);
startActivity(chgpass);
}
});
/**
*Logout from the User Panel which clears the data in Sqlite database
**/
btnLogout.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
UserFunctions logout = new UserFunctions();
logout.logoutUser(getApplicationContext());
Intent login = new Intent(getApplicationContext(), LoginActivity.class);
login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(login);
finish();
}
});
/**
* Sets user first name and last name in text view.
**/
final TextView login = (TextView) findViewById(R.id.textwelcome);
login.setText("Welcome, "+user.get("fname")+"!");
/*final TextView lname = (TextView) findViewById(R.id.lname);
lname.setText(user.get("lname"));*/
}
} | [
"avishek.khan.91@gmail.com"
] | avishek.khan.91@gmail.com |
139267cdd8ae4c74de9d17391c21098910ea51c1 | 8f479b86ac5e63052e0f2492b25560f59e469006 | /app/src/main/java/com/idtech/christophermiller/finalproject/MainActivity.java | e378104c66834601d125d8224ed4ca4f3dc7c5e9 | [] | no_license | happywaffle222/WaffleNinja | 5caf49e511e01d94ddaa4bdd4f94977d349f7a54 | 854bf5e3402fe4fe60cf58a0267fbadd9f748f0d | refs/heads/master | 2021-01-01T19:43:49.129997 | 2017-07-28T14:46:54 | 2017-07-28T14:46:54 | 98,659,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | package com.idtech.christophermiller.finalproject;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
private int highScore;
boolean play;
MediaPlayer launch;
Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainmenu);
launchMusic();
}
void launchMusic(){
launch = MediaPlayer.create(this, R.raw.afewdollars);
launch.start();
}
void play(View mainmenu){
Intent intent = new Intent(this, GameActivity.class);
startActivity(intent);
launch.stop();
}
void options(View mainmenu){
Intent intent = new Intent(this, OptionsActivity.class);
startActivity(intent);
}
} | [
"millerc@esdallas.org"
] | millerc@esdallas.org |
ef7578efa4907f0d5db05a6d4e67a6cfe4e00815 | a0882700fc17594506a9bc69605ad755ccb94e24 | /ExFinal/src/Main.java | 70f26e78dda31329ea7d26dcd2cab588c9f1ef63 | [] | no_license | andsanav/A01371357 | 88ca1bf7bc58417385c431c942c212fbb8dedb56 | 68702f5fbe27e2dbb2af3df80f232ea9db0d02c8 | refs/heads/master | 2020-12-24T21:54:49.133769 | 2017-12-04T17:14:57 | 2017-12-04T17:14:57 | 99,940,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,948 | java | import java.util.Arrays;
import java.util.LinkedList;
import java.util.Stack;
//Exámen Final Andrea Salas Navarro a01371357
public class Main {
public static String cleanString(String str){
String result = "";
for(int i = 0; i < str.length(); i++){
if(Character.isAlphabetic(str.charAt(i))){
result += String.valueOf(str.charAt(i)).toUpperCase();
}
}
return result;
}
public static int mystery(int m, int n){
if(m == 0)
return n+1;
if(m > 0 && n == 0)
return mystery(m-1,1);
if(m > 0 && n > 0)
return mystery(m-1,mystery(m,n-1));
return 0;
}
public static LinkedList<Integer> union(LinkedList<Integer> list1, LinkedList<Integer> list2){
LinkedList<Integer> result = new LinkedList<Integer>();
LinkedList<Integer> list = list1;
LinkedList<Integer> list3 = list2;
while(!list.isEmpty()){
result.add(list.removeFirst());
}
while(!list3.isEmpty()){
result.add(list3.removeFirst());
}
return result;
}
public static void insertInOrder(LinkedList<Integer> lst,int element){
int i = 0;
boolean add = false;
while(lst.get(i) != null && add == false){
if(lst.get(i) > element || lst.get(i) == element){
if(i == 0){
lst.addFirst(element);
add = true;
} else {
lst.add(i, element);
add = true;
}
}
i++;
}
if(add = false){
lst.addLast(element);
}
}
public static void eraseInOrder(LinkedList<Integer> lst,int count, boolean desc){
if(desc == true){
for(int i = 0; i < count; i++){
lst.removeLast();
if(lst.isEmpty())
break;
}
} else {
for(int i = 0; i < count; i++){
lst.removeFirst();
if(lst.isEmpty())
break;
}
}
}
public static void moveToBeginning(LinkedList<Integer> lst,int i){
if(i > lst.size()-1){
throw new IndexOutOfBoundsException();
}
int toMove = lst.get(i);
lst.remove(i);
lst.addFirst(toMove);
}
public static int get(Stack<Integer> lst, int i){
Stack<Integer> lst2 = lst;
if(i > lst.size())
throw new IndexOutOfBoundsException();
if(i == 0)
return lst.peek();
for(int j = 0; j < i; j++){
lst2.pop();
}
return lst2.peek();
}
public static void moveToTop(Stack<Integer> lst, int x){
Queue<Integer> fila = new Queue<Integer>();
if(x > lst.size())
throw new IndexOutOfBoundsException();
for(int j = 0; j < x; j++){
fila.offer(lst.pop());
}
int toMove = lst.pop();
while(!fila.isEmpty()){
lst.push(fila.remove());
}
lst.push(toMove);
}
public static void superSort(String[] arr){
LinkedList<String> cero = new LinkedList<String>();
LinkedList<String> uno = new LinkedList<String>();
LinkedList<String> dos = new LinkedList<String>();
LinkedList<String> tres = new LinkedList<String>();
LinkedList<String> cuatro = new LinkedList<String>();
LinkedList<String> cinco = new LinkedList<String>();
LinkedList<String> seis = new LinkedList<String>();
LinkedList<String> siete = new LinkedList<String>();
LinkedList<String> ocho = new LinkedList<String>();
LinkedList<String> nueve = new LinkedList<String>();
for(int i = arr[0].length()-1; i >= 0; i--){
for(int j = 0; j < arr.length; j++){
char last = arr[j].charAt(i);
if(last == '0')
cero.addLast(arr[j]);
if(last == '1')
uno.addLast(arr[j]);
if(last == '2')
dos.addLast(arr[j]);
if(last == '3')
tres.addLast(arr[j]);
if(last == '4')
cuatro.addLast(arr[j]);
if(last == '5')
cinco.addLast(arr[j]);
if(last == '6')
seis.addLast(arr[j]);
if(last == '7')
siete.addLast(arr[j]);
if(last == '8')
ocho.addLast(arr[j]);
if(last == '9')
nueve.addLast(arr[j]);
}
for(int m = 0; m < arr.length; m++){
if(!cero.isEmpty())
arr[m] = cero.removeFirst();
else if(!uno.isEmpty())
arr[m] = uno.removeFirst();
else if(!dos.isEmpty())
arr[m] = dos.removeFirst();
else if(!tres.isEmpty())
arr[m] = tres.removeFirst();
else if(!cuatro.isEmpty())
arr[m] = cuatro.removeFirst();
else if(!cinco.isEmpty())
arr[m] = cinco.removeFirst();
else if(!seis.isEmpty())
arr[m] = seis.removeFirst();
else if(!siete.isEmpty())
arr[m] = siete.removeFirst();
else if(!ocho.isEmpty())
arr[m] = ocho.removeFirst();
else if(!nueve.isEmpty())
arr[m] = nueve.removeFirst();
}
}
}
public static void main(String[] args) {
/*System.out.println(cleanString("sbh4b%rs"));
System.out.println(mystery(0,0));
System.out.println(mystery(4,0));
System.out.println(mystery(3,4));*/
String[] toSort = {"123","398","210","019","528","003","513","129","220","294"};
superSort(toSort);
System.out.println(Arrays.toString(toSort));
LinkedList<Integer> a = new LinkedList<Integer>();
LinkedList<Integer> b = new LinkedList<Integer>();
for(int i = 0; i < 6; i++)
a.add(i);
for(int i = 5; i < 9; i++)
b.add(i);
System.out.println(union(a,b).toString());
LinkedList<Integer> c = new LinkedList<Integer>();
c.add(1);
c.add(2);
c.add(6);
c.add(8);
c.add(11);
c.add(54);
System.out.println(c.toString());
insertInOrder(c,10);
System.out.println(c.toString());
LinkedList<Integer> a1 = new LinkedList<Integer>();
LinkedList<Integer> b1 = new LinkedList<Integer>();
LinkedList<Integer> c1 = new LinkedList<Integer>();
for(int i = 0; i < 11; i++)
a1.add(i);
for(int i = 50; i < 58; i++)
b1.add(i);
for(int i = 20; i < 23; i++)
c1.add(i);
eraseInOrder(a1,3,true);
eraseInOrder(b1,5,false);
eraseInOrder(c1,6,true);
System.out.println(a1.toString());
System.out.println(b1.toString());
System.out.println(c1.toString());
moveToBeginning(a1,2);
System.out.println(a1.toString());
Stack<Integer> lst = new Stack<Integer>();
for(int i = 50; i < 58; i++)
lst.push(i);
System.out.println(lst.toString());
System.out.println(get(lst,2));
moveToTop(lst,4);
System.out.println(lst.toString());
}
}
| [
"a01371357@itesm.mx"
] | a01371357@itesm.mx |
ef76911fa6612e74942284cc6afd0b9006d6b863 | 2920b2b1dbbec7519ce4dc03ddb0de57d5b3e6b2 | /NettyClient/src/com/netty/client/ch5/EchoClientHandler.java | 13920b162adacfa24332335de85ea4bacf9e6e14 | [
"Apache-2.0"
] | permissive | mygzk/NettyLearDemo | dac2b4ac6b71a121a2c70f3e9085f6ed5587d897 | 80de166be004efcb18eb903dc8a6e85b3aa6caf8 | refs/heads/master | 2020-03-20T08:03:28.910363 | 2018-06-19T03:39:44 | 2018-06-19T03:39:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,274 | java | package com.netty.client.ch5;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import java.util.logging.Logger;
public class EchoClientHandler extends ChannelHandlerAdapter {
private static final Logger LOGGER = Logger.getLogger(EchoClientHandler.class.getName());
String ECHO_REQ = "Hi Netty. $_";
private int counter;
public EchoClientHandler() {
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
for (int i = 0; i < 100; i++) {
ctx.writeAndFlush(Unpooled.copiedBuffer(ECHO_REQ.getBytes()));
}
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
String body = (String) msg;
System.out.println(" This is " + ++counter + " times receive client : [" + body + "$_]");
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
LOGGER.warning("Unexpected exception from downstream : " + cause.getMessage());
ctx.close();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
ctx.flush();
}
}
| [
"1565619659@qq.com"
] | 1565619659@qq.com |
c6cc5d1bcd5665750b194b76eefa19fe74b489bc | 4d415f123633b1bf0e344cedeec91e5aeac5f4c1 | /JavaCore/src/less14HW/Car.java | 2a1ea9b732fd68469fcf42d72732fc568ebac935 | [] | no_license | ArtemBorodkin/JavaCore | cadc8449037ff66e64819c964fdfd5912a838edd | e898a1626a5d32123977a0cfb46dd5367856d75d | refs/heads/master | 2021-07-18T07:34:06.157705 | 2017-10-25T10:44:33 | 2017-10-25T10:44:33 | 108,251,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,121 | java | package less14HW;
public class Car {
private Handlebar handlebar;
private Body body;
private Wheel wheel;
public Car(Handlebar handlebar, Body body, Wheel wheel) {
this.handlebar = handlebar;
this.body = body;
this.wheel = wheel;
}
public Handlebar getHandlebar() {
return handlebar;
}
public void setHandlebar(Handlebar handlebar) {
this.handlebar = handlebar;
}
public Body getBody() {
return body;
}
public void setBody(Body body) {
this.body = body;
}
public Wheel getWheel() {
return wheel;
}
public void setWheel(Wheel wheel) {
this.wheel = wheel;
}
public void increaseDiameter() {
wheel.increaseDiameter();
}
public void replacementDoors() {
body.replacementDoors();
}
public void increaseSize() {
handlebar.increaseSize();
}
public void changeWheel(){
wheel.changeWheel();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((body == null) ? 0 : body.hashCode());
result = prime * result + ((handlebar == null) ? 0 : handlebar.hashCode());
result = prime * result + ((wheel == null) ? 0 : wheel.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Car))
return false;
Car other = (Car) obj;
if (body == null) {
if (other.body != null)
return false;
} else if (!body.equals(other.body))
return false;
if (handlebar == null) {
if (other.handlebar != null)
return false;
} else if (!handlebar.equals(other.handlebar))
return false;
if (wheel == null) {
if (other.wheel != null)
return false;
} else if (!wheel.equals(other.wheel))
return false;
return true;
}
@Override
public String toString() {
return "Car [ handlebar=" + handlebar + ", body=" + body + ", wheel=" + wheel + "]";
}
public void theCar() {
increaseDiameter();
replacementDoors();
increaseSize();
}
}
| [
"artemborodkin@ukr.net"
] | artemborodkin@ukr.net |
b6d136ce2607f2dd102e612080cbae7811b50199 | 5246cb7897ba13b12e1411e00fc06fa095a9c3b9 | /src/test/java/dbryla/game/yetanotherengine/telegram/session/InMemoryGameStorageTest.java | 0e38fa3a3a69a3b63831bfd0b2760608046c96e5 | [] | no_license | dbryla/yet-another-engine | 54f788d5b1633a02c17416efd2165fbae9698fc2 | 3206a0ed6d3e9c1b14b683d62210b3d443eb74a3 | refs/heads/master | 2022-11-16T17:09:34.074902 | 2020-03-28T21:22:55 | 2020-03-28T21:29:25 | 177,969,124 | 0 | 0 | null | 2022-11-16T07:50:36 | 2019-03-27T10:16:28 | Java | UTF-8 | Java | false | false | 1,236 | java | package dbryla.game.yetanotherengine.telegram.session;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import dbryla.game.yetanotherengine.domain.game.Game;
import java.util.Random;
import org.junit.jupiter.api.Test;
class InMemoryGameStorageTest {
private final GameStorage gameStorage = new InMemoryGameStorage();
private final Random random = new Random();
@Test
void shouldStoreGame() {
Long gameId = random.nextLong();
Game game = mock(Game.class);
gameStorage.put(gameId, game);
assertThat(gameStorage.get(gameId)).isEqualTo(game);
}
@Test
void shouldNotOverwriteGame() {
Long gameId = random.nextLong();
Game oldGame = mock(Game.class);
gameStorage.put(gameId, oldGame);
Game newGame = mock(Game.class);
gameStorage.put(gameId, newGame);
assertThat(gameStorage.get(gameId)).isEqualTo(oldGame);
}
@Test
void shouldRemoveAndCleanupGame() {
Long gameId = random.nextLong();
Game game = mock(Game.class);
gameStorage.put(gameId, game);
gameStorage.clearGame(gameId);
assertThat(gameStorage.get(gameId)).isNull();
verify(game).cleanup();
}
} | [
"dan.bryla@gmail.com"
] | dan.bryla@gmail.com |
bf511427555fb455fa3188d1d663293c57f7a719 | 89cdc7e5e1c012d74f2c3d486ceec5da5d4ab191 | /testsuite/net/sf/eps2pgf/testsuite/pstests/FilePSTest.java | a78177e0c3074c77f6b9d87bef8db67a397362f4 | [] | no_license | econwang/eps2pgf | 6bc84c7dcbd55fd1e74676ce39e74acd5672ada7 | 22b123f377fbd663d66f5d8ac2b5b1afe7fadee9 | refs/heads/master | 2023-03-23T12:26:16.629347 | 2009-09-22T17:58:03 | 2009-09-22T17:58:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,806 | java | /*
* This file is part of Eps2pgf.
*
* Copyright 2007-2009 Paul Wagenaars
*
* 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 net.sf.eps2pgf.testsuite.pstests;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import net.sf.eps2pgf.ps.Interpreter;
/**
* This class contains some test to test the PostScript parser.
*/
public class FilePSTest {
/** The PostScript interpreter. */
private Interpreter interp = null;
/**
* Sets up the class.
*
* @throws Exception the exception
*/
@BeforeClass
public static void setUpClass() throws Exception {
Logger.getLogger("net.sourceforge.eps2pgf").setLevel(Level.OFF);
}
/**
* Set up a single test.
*
* @throws Exception An exception occurred.
*/
@Before
public void setUp() throws Exception {
interp = new Interpreter();
}
/** Test. @throws Exception the exception */
@Test
public void currentfile1() throws Exception {
String cmd = "currentfile type /filetype eq";
assertTrue(Common.testString(interp, cmd, 1));
}
/** Test. @throws Exception the exception */
@Test
public void readstring1() throws Exception {
String cmd = "currentfile (abc) readstring 123 pop exch ( 12) eq";
assertTrue(Common.testString(interp, cmd, 2));
}
/** Test. @throws Exception the exception */
@Test
public void readstring2() throws Exception {
String cmd = "{currentfile () readstring} stopped"
+ " count 1 roll"
+ " 1 1 count 3 sub {pop pop} for";
assertTrue(Common.testString(interp, cmd, 1));
}
/** Test. @throws Exception the exception */
@Test
public void decodeFilters1() throws Exception {
String cmd = "currentfile /ASCII85Decode filter /RunLengthDecode filter"
+ " 100 string readstring\n"
+ "@fQ`D'c\\GJ0fVB&!!`uK*$Zpf3\"?/n#7_Ig,:YD_%L2t=%M]s..NB05#64u='c"
+ "\\GC*#/qg!!`uK*%E0Q\n"
+ "'b1HK#7_J'.O,oJ%L2t=%QH0m,9.F.#64un3&)m-*#/qg!.Y\n"
+ "~> exch"
+ "(\\000\\007\\016\\025\\034#*18?\\007\\000\\007\\016\\025\\034#*1"
+ "8\\016\\007\\000\\007\\016\\025\\034#*1\\025\\016\\007\\000\\007"
+ "\\016\\025\\034#*\\034\\025\\016\\007\\000\\007\\016\\025\\034##"
+ "\\034\\025\\016\\007\\000\\007\\016\\025\\034*#\\034\\025\\016"
+ "\\007\\000\\007\\016\\0251*#\\034\\025\\016\\007\\000\\007\\0168"
+ "1*#\\034\\025\\016\\007\\000\\007?81*#\\034\\025\\016\\007\\000)"
+ "\neq";
assertTrue(Common.testString(interp, cmd, 2));
}
/** Test. @throws Exception the exception. */
@Test
public void readhexstring1() throws Exception {
String cmd = "currentfile 4 string readhexstring 1aBf90f6 exch"
+ " (\032\277\220\366) eq\n";
cmd += "currentfile 6 string readhexstring 123456>notexecutedFexch"
+ " (\0224V\356\316\337) eq";
assertTrue(Common.testString(interp, cmd, 4));
}
/** Test. @throws Exception the exception. */
@Test
public void subFileDecode1() throws Exception {
String cmd = "currentfile 0 (TheEnd) /SubFileDecode filter 99 string"
+ " readstring blablaTheEndfalse eq 2 1 roll (blabla) eq";
assertTrue(Common.testString(interp, cmd, 2));
}
/** Test. @throws Exception the exception. */
@Test
public void subFileDecode2() throws Exception {
String cmd = "currentfile << /Foo (bar) >> 1 (TheEnd) /SubFileDecode"
+ " filter 99 string"
+ " readstring blablaTheEndfalse eq 2 1 roll (blablaTheEnd) eq";
assertTrue(Common.testString(interp, cmd, 2));
}
/** Test. @throws Exception the exception. */
@Test
public void subFileDecode3() throws Exception {
String cmd = "currentfile 6 () /SubFileDecode filter 99 string"
+ " readstring blablafalse eq 2 1 roll (blabla) eq";
assertTrue(Common.testString(interp, cmd, 2));
}
/** Test. @throws Exception the exception. */
@Test
public void subFileDecode4() throws Exception {
String cmd = "currentfile 2 (TheEnd) /SubFileDecode filter 99 string"
+ " readstring blaTheEndblaTheEnd false eq 2 1 roll"
+ " (blaTheEndblaTheEnd) eq";
assertTrue(Common.testString(interp, cmd, 2));
}
/** Test. @throws Exception the exception. */
@Test
public void subFileDecode5() throws Exception {
String cmd = "currentfile << /EODCount 2 /EODString (TheEnd) >>"
+ " /SubFileDecode filter 99 string"
+ " readstring blaTheEndblaTheEnd false eq 2 1 roll"
+ " (blaTheEndblaTheEnd) eq";
assertTrue(Common.testString(interp, cmd, 2));
}
/** Test. @throws Exception the exception. */
@Test
public void status1() throws Exception {
String cmd = "currentfile /ASCIIHexDecode filter dup dup status 3 1"
+ " roll closefile status false eq";
assertTrue(Common.testString(interp, cmd, 2));
}
/** Test. @throws Exception the exception. */
@Test
public void flushfile1() throws Exception {
String cmd = "currentfile 0 (%%End) /SubFileDecode filter dup flushfile"
+ " %%End status false eq";
assertTrue(Common.testString(interp, cmd, 1));
}
/** Test. @throws Exception the exception. */
@Test
public void misc1() throws Exception {
String cmd = "currentfile 5 string readline k\n"
+ "exch (k) eq\n"
+ "currentfile 10 string readline "
+ "foo bar \n"
+ "exch (foo bar ) eq\n"
+ "currentfile 10 string dup 3 1 roll readline\n"
+ "next line\n"
+ "3 1 roll pop (next line\000) eq\n";
assertTrue(Common.testString(interp, cmd, 6));
}
}
| [
"paul@wagenaars.org"
] | paul@wagenaars.org |
bcf58e44c531b50063f16125d0ad2da601ccd4e7 | d9fc33efba5753357554d22f254c4809cf22f096 | /boundless/com/google/android/exoplayer2/mediacodec/MediaCodecUtil.java | 3518f148990458d1eb8232e43cd309f1605e6ada | [] | no_license | cdfx2016/AndroidDecompilePractice | 05bab3f564387df6cfe2c726cdb3f877500414f0 | 1657bc397606b9caadc75bd6d8a5b6db533a1cb5 | refs/heads/master | 2021-01-22T20:03:00.256531 | 2017-03-17T06:37:36 | 2017-03-17T06:37:36 | 85,275,937 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,462 | java | package com.google.android.exoplayer2.mediacodec;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.media.MediaCodecInfo;
import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaCodecInfo.CodecProfileLevel;
import android.media.MediaCodecList;
import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.exoplayer2.util.Util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@SuppressLint({"InlinedApi"})
@TargetApi(16)
public final class MediaCodecUtil {
private static final Map<Integer, Integer> AVC_LEVEL_NUMBER_TO_CONST = new HashMap();
private static final Map<Integer, Integer> AVC_PROFILE_NUMBER_TO_CONST = new HashMap();
private static final String CODEC_ID_AVC1 = "avc1";
private static final String CODEC_ID_AVC2 = "avc2";
private static final String CODEC_ID_HEV1 = "hev1";
private static final String CODEC_ID_HVC1 = "hvc1";
private static final Map<String, Integer> HEVC_CODEC_STRING_TO_PROFILE_LEVEL = new HashMap();
private static final MediaCodecInfo PASSTHROUGH_DECODER_INFO = MediaCodecInfo.newPassthroughInstance("OMX.google.raw.decoder");
private static final Pattern PROFILE_PATTERN = Pattern.compile("^\\D?(\\d+)$");
private static final String TAG = "MediaCodecUtil";
private static final HashMap<CodecKey, List<MediaCodecInfo>> decoderInfosCache = new HashMap();
private static int maxH264DecodableFrameSize = -1;
private static final class CodecKey {
public final String mimeType;
public final boolean secure;
public CodecKey(String mimeType, boolean secure) {
this.mimeType = mimeType;
this.secure = secure;
}
public int hashCode() {
return (((this.mimeType == null ? 0 : this.mimeType.hashCode()) + 31) * 31) + (this.secure ? 1231 : 1237);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || obj.getClass() != CodecKey.class) {
return false;
}
CodecKey other = (CodecKey) obj;
if (TextUtils.equals(this.mimeType, other.mimeType) && this.secure == other.secure) {
return true;
}
return false;
}
}
public static class DecoderQueryException extends Exception {
private DecoderQueryException(Throwable cause) {
super("Failed to query underlying media codecs", cause);
}
}
private interface MediaCodecListCompat {
int getCodecCount();
MediaCodecInfo getCodecInfoAt(int i);
boolean isSecurePlaybackSupported(String str, CodecCapabilities codecCapabilities);
boolean secureDecodersExplicit();
}
private static final class MediaCodecListCompatV16 implements MediaCodecListCompat {
private MediaCodecListCompatV16() {
}
public int getCodecCount() {
return MediaCodecList.getCodecCount();
}
public MediaCodecInfo getCodecInfoAt(int index) {
return MediaCodecList.getCodecInfoAt(index);
}
public boolean secureDecodersExplicit() {
return false;
}
public boolean isSecurePlaybackSupported(String mimeType, CodecCapabilities capabilities) {
return MimeTypes.VIDEO_H264.equals(mimeType);
}
}
@TargetApi(21)
private static final class MediaCodecListCompatV21 implements MediaCodecListCompat {
private final int codecKind;
private MediaCodecInfo[] mediaCodecInfos;
public MediaCodecListCompatV21(boolean includeSecure) {
this.codecKind = includeSecure ? 1 : 0;
}
public int getCodecCount() {
ensureMediaCodecInfosInitialized();
return this.mediaCodecInfos.length;
}
public MediaCodecInfo getCodecInfoAt(int index) {
ensureMediaCodecInfosInitialized();
return this.mediaCodecInfos[index];
}
public boolean secureDecodersExplicit() {
return true;
}
public boolean isSecurePlaybackSupported(String mimeType, CodecCapabilities capabilities) {
return capabilities.isFeatureSupported("secure-playback");
}
private void ensureMediaCodecInfosInitialized() {
if (this.mediaCodecInfos == null) {
this.mediaCodecInfos = new MediaCodecList(this.codecKind).getCodecInfos();
}
}
}
static {
AVC_PROFILE_NUMBER_TO_CONST.put(Integer.valueOf(66), Integer.valueOf(1));
AVC_PROFILE_NUMBER_TO_CONST.put(Integer.valueOf(77), Integer.valueOf(2));
AVC_PROFILE_NUMBER_TO_CONST.put(Integer.valueOf(88), Integer.valueOf(4));
AVC_PROFILE_NUMBER_TO_CONST.put(Integer.valueOf(100), Integer.valueOf(8));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(10), Integer.valueOf(1));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(11), Integer.valueOf(4));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(12), Integer.valueOf(8));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(13), Integer.valueOf(16));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(20), Integer.valueOf(32));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(21), Integer.valueOf(64));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(22), Integer.valueOf(128));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(30), Integer.valueOf(256));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(31), Integer.valueOf(512));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(32), Integer.valueOf(1024));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(40), Integer.valueOf(2048));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(41), Integer.valueOf(4096));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(42), Integer.valueOf(8192));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(50), Integer.valueOf(16384));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(51), Integer.valueOf(32768));
AVC_LEVEL_NUMBER_TO_CONST.put(Integer.valueOf(52), Integer.valueOf(65536));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L30", Integer.valueOf(1));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L60", Integer.valueOf(4));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L63", Integer.valueOf(16));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L90", Integer.valueOf(64));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L93", Integer.valueOf(256));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L120", Integer.valueOf(1024));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L123", Integer.valueOf(4096));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L150", Integer.valueOf(16384));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L153", Integer.valueOf(65536));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L156", Integer.valueOf(262144));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L180", Integer.valueOf(1048576));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L183", Integer.valueOf(AccessibilityEventCompat.TYPE_WINDOWS_CHANGED));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("L186", Integer.valueOf(16777216));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H30", Integer.valueOf(2));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H60", Integer.valueOf(8));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H63", Integer.valueOf(32));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H90", Integer.valueOf(128));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H93", Integer.valueOf(512));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H120", Integer.valueOf(2048));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H123", Integer.valueOf(8192));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H150", Integer.valueOf(32768));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H153", Integer.valueOf(131072));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H156", Integer.valueOf(524288));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H180", Integer.valueOf(2097152));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H183", Integer.valueOf(8388608));
HEVC_CODEC_STRING_TO_PROFILE_LEVEL.put("H186", Integer.valueOf(33554432));
}
private MediaCodecUtil() {
}
public static void warmDecoderInfoCache(String mimeType, boolean secure) {
try {
getDecoderInfos(mimeType, secure);
} catch (DecoderQueryException e) {
Log.e(TAG, "Codec warming failed", e);
}
}
public static MediaCodecInfo getPassthroughDecoderInfo() {
return PASSTHROUGH_DECODER_INFO;
}
public static MediaCodecInfo getDecoderInfo(String mimeType, boolean secure) throws DecoderQueryException {
List<MediaCodecInfo> decoderInfos = getDecoderInfos(mimeType, secure);
return decoderInfos.isEmpty() ? null : (MediaCodecInfo) decoderInfos.get(0);
}
public static synchronized List<MediaCodecInfo> getDecoderInfos(String mimeType, boolean secure) throws DecoderQueryException {
List<MediaCodecInfo> decoderInfos;
synchronized (MediaCodecUtil.class) {
CodecKey key = new CodecKey(mimeType, secure);
List<MediaCodecInfo> decoderInfos2 = (List) decoderInfosCache.get(key);
if (decoderInfos2 != null) {
decoderInfos = decoderInfos2;
} else {
MediaCodecListCompat mediaCodecList;
if (Util.SDK_INT >= 21) {
mediaCodecList = new MediaCodecListCompatV21(secure);
} else {
mediaCodecList = new MediaCodecListCompatV16();
}
decoderInfos2 = getDecoderInfosInternal(key, mediaCodecList);
if (secure && decoderInfos2.isEmpty() && 21 <= Util.SDK_INT && Util.SDK_INT <= 23) {
decoderInfos2 = getDecoderInfosInternal(key, new MediaCodecListCompatV16());
if (!decoderInfos2.isEmpty()) {
Log.w(TAG, "MediaCodecList API didn't list secure decoder for: " + mimeType + ". Assuming: " + ((MediaCodecInfo) decoderInfos2.get(0)).name);
}
}
decoderInfos2 = Collections.unmodifiableList(decoderInfos2);
decoderInfosCache.put(key, decoderInfos2);
decoderInfos = decoderInfos2;
}
}
return decoderInfos;
}
private static List<MediaCodecInfo> getDecoderInfosInternal(CodecKey key, MediaCodecListCompat mediaCodecList) throws DecoderQueryException {
String codecName;
try {
List<MediaCodecInfo> decoderInfos = new ArrayList();
String mimeType = key.mimeType;
int numberOfCodecs = mediaCodecList.getCodecCount();
boolean secureDecodersExplicit = mediaCodecList.secureDecodersExplicit();
loop0:
for (int i = 0; i < numberOfCodecs; i++) {
MediaCodecInfo codecInfo = mediaCodecList.getCodecInfoAt(i);
codecName = codecInfo.getName();
if (isCodecUsableDecoder(codecInfo, codecName, secureDecodersExplicit)) {
for (String supportedType : codecInfo.getSupportedTypes()) {
if (supportedType.equalsIgnoreCase(mimeType)) {
CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(supportedType);
boolean secure = mediaCodecList.isSecurePlaybackSupported(mimeType, capabilities);
if ((!secureDecodersExplicit || key.secure != secure) && (secureDecodersExplicit || key.secure)) {
if (!secureDecodersExplicit && secure) {
decoderInfos.add(MediaCodecInfo.newInstance(codecName + ".secure", mimeType, capabilities));
break loop0;
}
}
decoderInfos.add(MediaCodecInfo.newInstance(codecName, mimeType, capabilities));
}
}
continue;
}
}
return decoderInfos;
} catch (Exception e) {
if (Util.SDK_INT > 23 || decoderInfos.isEmpty()) {
Log.e(TAG, "Failed to query codec " + codecName + " (" + supportedType + ")");
throw e;
}
Log.e(TAG, "Skipping codec " + codecName + " (failed to query capabilities)");
} catch (Exception e2) {
throw new DecoderQueryException(e2);
}
}
private static boolean isCodecUsableDecoder(MediaCodecInfo info, String name, boolean secureDecodersExplicit) {
if (info.isEncoder()) {
return false;
}
if (!secureDecodersExplicit && name.endsWith(".secure")) {
return false;
}
if (Util.SDK_INT < 21 && ("CIPAACDecoder".equals(name) || "CIPMP3Decoder".equals(name) || "CIPVorbisDecoder".equals(name) || "AACDecoder".equals(name) || "MP3Decoder".equals(name))) {
return false;
}
if (Util.SDK_INT < 18 && "OMX.SEC.MP3.Decoder".equals(name)) {
return false;
}
if (Util.SDK_INT < 18 && "OMX.MTK.AUDIO.DECODER.AAC".equals(name) && "a70".equals(Util.DEVICE)) {
return false;
}
if (Util.SDK_INT == 16 && "OMX.qcom.audio.decoder.mp3".equals(name) && ("dlxu".equals(Util.DEVICE) || "protou".equals(Util.DEVICE) || "ville".equals(Util.DEVICE) || "villeplus".equals(Util.DEVICE) || "villec2".equals(Util.DEVICE) || Util.DEVICE.startsWith("gee") || "C6602".equals(Util.DEVICE) || "C6603".equals(Util.DEVICE) || "C6606".equals(Util.DEVICE) || "C6616".equals(Util.DEVICE) || "L36h".equals(Util.DEVICE) || "SO-02E".equals(Util.DEVICE))) {
return false;
}
if (Util.SDK_INT == 16 && "OMX.qcom.audio.decoder.aac".equals(name) && ("C1504".equals(Util.DEVICE) || "C1505".equals(Util.DEVICE) || "C1604".equals(Util.DEVICE) || "C1605".equals(Util.DEVICE))) {
return false;
}
if (Util.SDK_INT <= 19 && ((Util.DEVICE.startsWith("d2") || Util.DEVICE.startsWith("serrano") || Util.DEVICE.startsWith("jflte") || Util.DEVICE.startsWith("santos")) && "samsung".equals(Util.MANUFACTURER) && "OMX.SEC.vp8.dec".equals(name))) {
return false;
}
if (Util.SDK_INT <= 19 && Util.DEVICE.startsWith("jflte") && "OMX.qcom.video.decoder.vp8".equals(name)) {
return false;
}
return true;
}
public static int maxH264DecodableFrameSize() throws DecoderQueryException {
int i = 0;
if (maxH264DecodableFrameSize == -1) {
int result = 0;
MediaCodecInfo decoderInfo = getDecoderInfo(MimeTypes.VIDEO_H264, false);
if (decoderInfo != null) {
CodecProfileLevel[] profileLevels = decoderInfo.getProfileLevels();
int length = profileLevels.length;
while (i < length) {
result = Math.max(avcLevelToMaxFrameSize(profileLevels[i].level), result);
i++;
}
result = Math.max(result, 172800);
}
maxH264DecodableFrameSize = result;
}
return maxH264DecodableFrameSize;
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
public static android.util.Pair<java.lang.Integer, java.lang.Integer> getCodecProfileAndLevel(java.lang.String r6) {
/*
r1 = 0;
r2 = 0;
if (r6 != 0) goto L_0x0005;
L_0x0004:
return r1;
L_0x0005:
r3 = "\\.";
r0 = r6.split(r3);
r4 = r0[r2];
r3 = -1;
r5 = r4.hashCode();
switch(r5) {
case 3006243: goto L_0x0032;
case 3006244: goto L_0x003c;
case 3199032: goto L_0x001f;
case 3214780: goto L_0x0028;
default: goto L_0x0015;
};
L_0x0015:
r2 = r3;
L_0x0016:
switch(r2) {
case 0: goto L_0x001a;
case 1: goto L_0x001a;
case 2: goto L_0x0046;
case 3: goto L_0x0046;
default: goto L_0x0019;
};
L_0x0019:
goto L_0x0004;
L_0x001a:
r1 = getHevcProfileAndLevel(r6, r0);
goto L_0x0004;
L_0x001f:
r5 = "hev1";
r4 = r4.equals(r5);
if (r4 == 0) goto L_0x0015;
L_0x0027:
goto L_0x0016;
L_0x0028:
r2 = "hvc1";
r2 = r4.equals(r2);
if (r2 == 0) goto L_0x0015;
L_0x0030:
r2 = 1;
goto L_0x0016;
L_0x0032:
r2 = "avc1";
r2 = r4.equals(r2);
if (r2 == 0) goto L_0x0015;
L_0x003a:
r2 = 2;
goto L_0x0016;
L_0x003c:
r2 = "avc2";
r2 = r4.equals(r2);
if (r2 == 0) goto L_0x0015;
L_0x0044:
r2 = 3;
goto L_0x0016;
L_0x0046:
r1 = getAvcProfileAndLevel(r6, r0);
goto L_0x0004;
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.exoplayer2.mediacodec.MediaCodecUtil.getCodecProfileAndLevel(java.lang.String):android.util.Pair<java.lang.Integer, java.lang.Integer>");
}
private static Pair<Integer, Integer> getHevcProfileAndLevel(String codec, String[] parts) {
if (parts.length < 4) {
Log.w(TAG, "Ignoring malformed HEVC codec string: " + codec);
return null;
}
Matcher matcher = PROFILE_PATTERN.matcher(parts[1]);
if (matcher.matches()) {
int profile;
String profileString = matcher.group(1);
if ("1".equals(profileString)) {
profile = 1;
} else if ("2".equals(profileString)) {
profile = 2;
} else {
Log.w(TAG, "Unknown HEVC profile string: " + profileString);
return null;
}
Integer level = (Integer) HEVC_CODEC_STRING_TO_PROFILE_LEVEL.get(parts[3]);
if (level != null) {
return new Pair(Integer.valueOf(profile), level);
}
Log.w(TAG, "Unknown HEVC level string: " + matcher.group(1));
return null;
}
Log.w(TAG, "Ignoring malformed HEVC codec string: " + codec);
return null;
}
private static Pair<Integer, Integer> getAvcProfileAndLevel(String codec, String[] codecsParts) {
if (codecsParts.length < 2) {
Log.w(TAG, "Ignoring malformed AVC codec string: " + codec);
return null;
}
try {
Integer profileInteger;
Integer levelInteger;
if (codecsParts[1].length() == 6) {
profileInteger = Integer.valueOf(Integer.parseInt(codecsParts[1].substring(0, 2), 16));
levelInteger = Integer.valueOf(Integer.parseInt(codecsParts[1].substring(4), 16));
} else if (codecsParts.length >= 3) {
profileInteger = Integer.valueOf(Integer.parseInt(codecsParts[1]));
levelInteger = Integer.valueOf(Integer.parseInt(codecsParts[2]));
} else {
Log.w(TAG, "Ignoring malformed AVC codec string: " + codec);
return null;
}
Integer profile = (Integer) AVC_PROFILE_NUMBER_TO_CONST.get(profileInteger);
if (profile == null) {
Log.w(TAG, "Unknown AVC profile: " + profileInteger);
return null;
}
Integer level = (Integer) AVC_LEVEL_NUMBER_TO_CONST.get(levelInteger);
if (level != null) {
return new Pair(profile, level);
}
Log.w(TAG, "Unknown AVC level: " + levelInteger);
return null;
} catch (NumberFormatException e) {
Log.w(TAG, "Ignoring malformed AVC codec string: " + codec);
return null;
}
}
private static int avcLevelToMaxFrameSize(int avcLevel) {
switch (avcLevel) {
case 1:
case 2:
return 25344;
case 8:
return 101376;
case 16:
return 101376;
case 32:
return 101376;
case 64:
return 202752;
case 128:
return 414720;
case 256:
return 414720;
case 512:
return 921600;
case 1024:
return 1310720;
case 2048:
return 2097152;
case 4096:
return 2097152;
case 8192:
return 2228224;
case 16384:
return 5652480;
case 32768:
return 9437184;
default:
return -1;
}
}
}
| [
"残刀飞雪"
] | 残刀飞雪 |
428e2e01630a5be15a9a75b98d932445357ae6d1 | 70b1a78b9d4aedcaaaaa91ecdc4a2861d04fde0e | /app/src/main/java/com/rbapps/programmingcodes/CScount1Fragment.java | fd16c27f5291140f9882386ff0d26d7117b48e24 | [] | no_license | Rajpoot49/Programming-Codes | 3c3a4407441da527772faa8dc9a68b519aaae46b | 10ba67e9896f206706fe0fc626d54c12fa8322e3 | refs/heads/master | 2020-04-20T05:23:17.024717 | 2019-02-01T07:09:09 | 2019-02-01T07:09:09 | 168,650,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,442 | java | package com.rbapps.programmingcodes;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* A simple {@link Fragment} subclass.
*/
public class CScount1Fragment extends Fragment {
public CScount1Fragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_cscount1, container, false);
TextView csoutput_count1=view.findViewById(R.id.csoutput_count1);
TextView cscount1=view.findViewById(R.id.cscount1);
String data="";
StringBuffer sbuffer= new StringBuffer();
InputStream is= this.getResources().openRawResource(R.raw.cscount1);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
if(is!=null){
try{
while((data= reader.readLine())!=null){
sbuffer.append(data +"\n");
}
cscount1.setText(sbuffer);
is.close();
}catch (Exception e){
e.printStackTrace();}
}
String data1="";
StringBuffer sbuffera= new StringBuffer();
InputStream isa= this.getResources().openRawResource(R.raw.csouput_count1);
BufferedReader readera = new BufferedReader(new InputStreamReader(isa));
if(isa!=null){
try{
while((data1= readera.readLine())!=null){
sbuffera.append(data1 +"\n");
}
csoutput_count1.setText(sbuffera);
isa.close();
}catch (Exception e){
e.printStackTrace();}
}
return view;
}
@Override
public void onResume() {
super.onResume();
((AppCompatActivity)getActivity()).getSupportActionBar().setTitle("Count Number of 1's");
}
@Override
public void onStop() {
super.onStop();
((AppCompatActivity)getActivity()).getSupportActionBar().setTitle("C#");
}
}
| [
"kbhatti816@gmail.com"
] | kbhatti816@gmail.com |
92ff6105a88e0c61406561a5b81fd7131dfc4d80 | e5b943b623000fa2f2be16317b9a4d8c1347449f | /src/com/class5/NestedIf.java | 566dae846ac57a9d3c4e3c8e1389965defc3087a | [] | no_license | FALAPARMAK/JavaBatch4 | 342551c5f9a4df2711abd37d24fe48336674ecae | 2e38aca1e829a6260fb6621bc1b0e8b709a6e1e1 | refs/heads/master | 2020-05-03T16:21:39.606517 | 2019-05-18T02:32:24 | 2019-05-18T02:32:24 | 178,721,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | package com.class5;
public class NestedIf {
public static void main(String[] args) {
/* int num1= 23;
int num2=24;
if(num1>num2) {
System.out.println("num1 is larger");
}else {
System.out.println("num1 is smaller");
check if user has credit card
check what is the balance if balance
}*/
boolean creditCard= true;
int balance= 900;
if(creditCard) {
System.out.println("Let is check the balance");
if(balance>=1000) {
System.out.println(" pay off now");
}else if(balance==0) {
System.out.println(" Use your card");
}else {
System.out.println(" You are safe");
}
}else {
System.out.println(" Do you hwant a credit card");
}
}
}
| [
"betulalaparmak1@gmail.com"
] | betulalaparmak1@gmail.com |
eb94db371587d516234a7eb3b6a394433ac3c6da | 3671baae89ddfe8e8cdb23a72fedeeedfd2b12f8 | /app/src/main/java/de/android/drawer/MenuItemCallback.java | fc620344f27d25a90ce49e7684816f9f9bd3af8f | [] | no_license | AIRAT1/TestWallpapersNew | 4f86d1553c72dbc3b10f752678d57698be572f56 | a70e0f6dac3ebe6294d98fbe7cfc4a2769e2c83c | refs/heads/master | 2021-09-08T12:45:22.429294 | 2018-03-09T19:26:39 | 2018-03-09T19:26:39 | 113,476,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package de.android.drawer;
import android.view.MenuItem;
import java.util.List;
public interface MenuItemCallback {
void menuItemClicked(List<NavItem> action, MenuItem item, boolean requiresPurchase);
} | [
"ayrat1@mail.ru"
] | ayrat1@mail.ru |
75c6421eba54a00dc8730b35b33342bdea46672c | ad5b20d973bb96024fe4cb3daca1d26de0fae8e6 | /project3/src/networkingMethods/connectionManager.java | c29703844cdc34e0fee9d0170cd9b0fae5c23647 | [] | no_license | rueand713/JVA1_1305 | 9d64b857bc741a8726d03ac2a46f3984aa6ba165 | d544edd5ea06a1414050f3b41e3ca84cb10e863e | refs/heads/master | 2020-03-30T19:06:05.412394 | 2013-05-30T20:31:58 | 2013-05-30T20:31:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,275 | java | package networkingMethods;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
public class connectionManager {
static Boolean connectionStatus = false;
static String connectionType = "No Connection";
// getter method for retrieving the connectionType
public static String getConnectionType(Context context)
{
// calls the method to check and retrieve the connection data
fetchConnectionData(context);
// return the connection type
return connectionType;
}
// getter method for retrieving the connectionStatus
public static Boolean getConnectionStatus(Context context)
{
// calls the method to check and retrieve the connection data
fetchConnectionData(context);
// return the connection status
return connectionStatus;
}
// method for retrieving the connection details and setting the class fields
private static void fetchConnectionData(Context context)
{
// setup the connectivity manager object
ConnectivityManager conMngr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
// instantiate the networkinfo object to hold the connectivity manager active network
NetworkInfo net411 = conMngr.getActiveNetworkInfo();
// check if the network info object is created
if (net411 != null)
{
// the network info object is created now it checks for a connection
// if there is a connection the connected and connectionType fields are set to reflect that data
// otherwise the fields are set to their default values
if (net411.isConnected())
{
connectionStatus = true;
connectionType = net411.getTypeName();
}
else
{
connectionStatus = false;
connectionType = "No Connection";
}
}
}
// method for making a web request for string data
public static String makeStringRequest(URL urlString)
{
// string object to hold the URL response text
String responseText = "";
try {
// create a new URL connection object
URLConnection connection = urlString.openConnection();
// creates a new buffer input stream with the URL connection object
BufferedInputStream bfStream = new BufferedInputStream(connection.getInputStream());
// create a new byte array
byte[] contentBytes = new byte[1024];
// integer to handle the number of bytes read
int readBytes = 0;
// create a new string buffer object
StringBuffer buffString = new StringBuffer();
// loop to handle the appending of the string content to buffer
while ((readBytes = bfStream.read(contentBytes)) != -1)
{
// set the response string to the string content read
responseText = new String(contentBytes, 0, readBytes);
// appends the new string content to the buffer string object
buffString.append(responseText);
}
// set the responseText to the full buffered string content in buffer
responseText = buffString.toString();
} catch (IOException e) {
Log.e("URL RESPONSE ERROR", "Server failed to respond to request");
}
// return the response string
return responseText;
}
}
| [
"rueand713@fullsail.edu"
] | rueand713@fullsail.edu |
580560e73996776eaafc15deda2784a43dec03c6 | 71cfe0d2d0e78318d5e07b2bcbdf7d085400879d | /plugins/net.bioclipse.reaction/src/net/bioclipse/reaction/editparts/EditPartWithListener.java | 86ebc6504b434eb85cd8a95b2ad6e06bdfec705c | [] | no_license | bioclipse/bioclipse.medea | 31988c594ecf7c386c436fe3046c7f5507d730ea | 579dba6440d7b50365b3a726d7136e7de198687f | refs/heads/master | 2020-04-11T04:23:55.435589 | 2011-09-17T11:47:24 | 2011-09-17T11:47:24 | 833,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | /*******************************************************************************
* Copyright (c) 2007-2009 Miguel Rojas <miguelrojasch@users.sf.net>,
* Stefan Kuhn <shk3@users.sf.net>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* www.eclipse.org—epl-v10.html <http://www.eclipse.org/legal/epl-v10.html>
*
* Contact: http://www.bioclipse.net/
******************************************************************************/
package net.bioclipse.reaction.editparts;
import java.beans.PropertyChangeListener;
import net.bioclipse.reaction.model.AbstractModel;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
/**
*
* @author Miguel Rojas
*/
abstract public class EditPartWithListener extends AbstractGraphicalEditPart implements PropertyChangeListener{
/*
* (non-Javadoc)
* @see org.eclipse.gef.EditPart#activate()
*/
public void activate(){
super.activate();
((AbstractModel)getModel()).addPropertyChangeListener(this);
}
/*
* (non-Javadoc)
* @see org.eclipse.gef.EditPart#deactivate()
*/
public void deactivate(){
super.deactivate();
((AbstractModel)getModel()).removePropertyChangeListener(this);
}
}
| [
"egon.willighagen@gmail.com"
] | egon.willighagen@gmail.com |
7fba50285469d68457dd3d168688109651f63132 | fdc5e56245ede826daa81c24147b22fdbc6e61c5 | /src/io/netty/bio/disguiserAsynchronization/TimeServer.java | 16fcdcacfb38a59c8985b17cd9f4fdf83b66f6da | [] | no_license | YangPeng-Li/JavaCode | 3fd80d6e5e296a1ea476baa3e4fd820ab3e60c16 | 12c77f998fc174d6f7aba03b646d70cec9710e7f | refs/heads/master | 2020-04-15T01:27:23.898852 | 2019-01-06T04:55:31 | 2019-01-06T04:55:31 | 164,276,635 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,872 | java | package io.netty.bio.disguiserAsynchronization;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import io.netty.bio.TimeServerHandle;
/**
* 实现伪异步(DisguiserOfAsynchronization)
*
* @author Lyp
* @date 2018年12月19日
* @version 1.0
*
*/
public class TimeServer {
public static void main(String[] args) throws IOException {
int port = 8080;
if (args !=null && args.length>0)
{
try {
port = Integer.valueOf(port);
} catch (Exception e) {
e.printStackTrace();
}
}
ServerSocket server = null;
try {
server = new ServerSocket(port);
System.out.println("The time server is start in port : "+port);
Socket socket = null;
TimeServerHandlerExecutePool singleExecutor = new TimeServerHandlerExecutePool (50,1000); //创建I/O任务线程池
while (true)
{
socket = server.accept();
singleExecutor.execute(new TimeServerHandle(socket));
}
} finally
{
if (server !=null)
{
System.out.println("The time server close");
server.close();
server = null;
}
}
}
/*
* read()
* This method will block until a character is
* available, an I/O error occurs, or the end of the stream is reached.
* 此法将会阻塞直到获得字符串 或者 流到达 ,一个I/O错误
*
* 有数据可读
* 可用数据读取完毕
* 发生空指针异常
*
* 这一位置对方发送请求或者应答消息比较慢的,或者网络传输较慢时,读取输入流一方的通信时间将被长时间阻塞,
* 如果对方要60s才能将数据发送完,读取一方分I/O也将会阻塞60s,再次期间,其他接入消息只能在消息队列中排队
*
* 当调用OutputStream 的wrter 方法写输出流的时候,他将会被阻塞,直到所要发送的字节全部如入完毕,或者发生异常,
* 在TCP/IP 协议中当消息接受哦处理缓慢的时候,将不能及时地从TCP缓冲区读取数据,这将会导致发送方的TCP window size不断缩小 直到为0
* 双方处于 Keep-Alive 状态,消息发送方不能再向TCP缓存去写入消息,
* 这时如果采用的是同步阻塞I/O,WRITE 操作将会被无限期阻塞,直到TCP window size大于0 或者发生I/O异常
*
*
* 通过输入和输出流的API文档进行分析,了解到读和写操作都是同步阻塞的,阻塞的时间取决于对方的I/O线程的处理速度和网络I/O的传输速度
* 本质上讲,我们无法保证生产环境的网络状态和对端的应用程序足够快,如果我们的应用程序依赖对方的处理速度,它的可靠性就非常差,但是一旦上线,
* 面对恶劣的网络环境和良莠不齐的第三方系统,问题就会喷发出来。
*
* 伪异步I/O实际上仅仅是对之前I/O线程模型的一个简单优化,他无法从根本上解决同步I/O导致的通信阻塞问题。
* 分析通信对方返回应答时间过长会引起的级联故障
* 1)服务端处理缓慢,返回应答消息耗费60s,平时只要10ms
* 2)采用伪异步I/O的线程在读取故障服务节点的响应,由于读取输入流是阻塞的,他将会被同步阻塞60s
* 3)假如所有的key那个线程都被故障服务器阻塞,那后续所有的I/O消息都在消息队列中排队
* 4)由于线程池采用阻塞队列实现,当队列积满之后,后续如队列的操作将被阻塞
* 5)由于前端只有一个Accptor 线程接受客户端接入,它被阻塞在线程池的同步阻塞队列之后,新的客户端请求消息将被拒绝,客户端发送大量连接超时
* 6)由于机会所有的连接都超时,调用者会认为系统已经崩溃,无法接受新的请求消息
*/
}
| [
"googMoring_glb@lyp.com"
] | googMoring_glb@lyp.com |
5aa1edea00a4d4ae2de977c1aab55ecfd6313062 | f153d67fb502bac16d3f8961388531b939c218f3 | /learningPail/src/main/java/com/abhin/learning/writes/LoginPailSchema.java | 55dde212cef1d69debf345b7f816c6d7e4925483 | [] | no_license | abhinavos7a/hadoop | c65a2aa6ab9b3a0cf83f43cb24302ea30f0baba8 | 0924d707259c2c589a2a3632a165cde1b5d7a31b | refs/heads/master | 2016-09-06T10:04:38.300743 | 2015-03-03T04:34:47 | 2015-03-03T04:34:47 | 31,574,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,748 | java | package com.abhin.learning.writes;
import com.abhin.learning.model.Login;
import com.backtype.hadoop.pail.PailStructure;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Created by abhin on 3/2/15.
*/
public class LoginPailSchema implements PailStructure<Login> {
@Override
public boolean isValidTarget(String... var1){
return true;
}
@Override
public List<String> getTarget(Login object){
return Collections.EMPTY_LIST;
}
@Override
public Class getType(){
return Login.class;
}
@Override
public byte[] serialize(Login login){
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(byteOut);
byte[] userBytes = login.getUserName().getBytes();
try {
dataOut.writeInt(userBytes.length);
dataOut.write(userBytes);
dataOut.writeLong(login.getUnixTime());
dataOut.close();
}catch (IOException e){
throw new RuntimeException();
}
return byteOut.toByteArray();
}
@Override
public Login deserialize(byte[] serialized){
DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(serialized));
try {
byte[] userBytes = new byte[dataIn.readInt()];
dataIn.read(userBytes);
return new Login(new String(userBytes), dataIn.readLong());
}catch (IOException e){
throw new RuntimeException();
}
}
}
| [
"abhin@yahoo-inc.com"
] | abhin@yahoo-inc.com |
dd59ddd95865e56c897cb4e051c233f9fcd1ad1f | b5a42186a3c3c7772d473a51706bd4c4904559fb | /src/Project/Client_ChooseController.java | e3f9f7284885de80433cb47f031c24a824bb587f | [] | no_license | NguyenVanNam2002/Project2 | d54c409618b7195bbbd45e23d3a463fb654e7429 | 2165e20e618540949f614ed5bfad67ce29b1d1b7 | refs/heads/master | 2023-06-24T13:29:22.223356 | 2021-07-27T15:26:34 | 2021-07-27T15:26:34 | 380,949,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,082 | 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 Project;
import Project.Data.Category;
import Project.Data.OrderDAO;
import Project.Data.OrderDAOImpl;
import Project.Data.Product;
import Project.Data.ProjectSignUp;
import Project.DbProject.DbProject;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXComboBox;
import com.jfoenix.controls.JFXDrawer;
import com.jfoenix.controls.JFXHamburger;
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Optional;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Spinner;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Modality;
import javafx.stage.Stage;
/**
*
* @author icom
*/
public class Client_ChooseController {
private Category cate;
private OrderDAO od = new OrderDAOImpl();
private Product pd;
private ProjectSignUp psu;
@FXML
private AnchorPane root;
@FXML
private Text user;
@FXML
private Text erross;
@FXML
private Text id;
@FXML
private JFXButton btnSearch;
@FXML
private TextField productname;
@FXML
private JFXButton menu;
@FXML
private GridPane grid;
@FXML
private Text drink;
@FXML
private Text food;
@FXML
private JFXComboBox<String> category;
@FXML
private Text thename;
@FXML
private ImageView imageview;
@FXML
private Text theprice;
@FXML
private Spinner<Integer> sprinner;
@FXML
private JFXButton order;
private MyListener myListener;
ObservableList<Product> list = FXCollections.observableArrayList();
ObservableList<Product> lis = FXCollections.observableArrayList();
@FXML
private JFXHamburger hamberger;
@FXML
private JFXDrawer drawer;
private Product extractProductFromFields() {
Product sign = new Product();
sign.setName(thename.getText());
sign.setId(Integer.parseInt(id.getText()));
return sign;
}
@FXML
void btncategory(ActionEvent event) throws IOException {
if (category.getSelectionModel().getSelectedItem().toString().equals("Tất cả")) {
ProjectSignUp menus = extractSignUpFromFields();
Nagatice.getInstance().goToChoose(menus);
} else if (category.getSelectionModel().getSelectedItem().toString().equals("Đồ ăn")) {
ProjectSignUp menus = extractSignUpFromFields();
Category cate = extractFoodFromFields();
Nagatice.getInstance().goToChoose(menus, cate);
} else if (category.getSelectionModel().getSelectedItem().toString().equals("Nước uống")) {
ProjectSignUp menus = extractSignUpFromFields();
Category cate = extractDrinkFoodFromFields();
Nagatice.getInstance().goToChoose(menus, cate);
}
}
@FXML
void btnSearchClick(ActionEvent event) throws IOException {
ProjectSignUp account = extractSignUpFromFields();
Product name = extractSearchFromFields();
Nagatice.getInstance().goToSearch(account, name);
}
@FXML
void btnfeedback(ActionEvent event) throws IOException {
Product ea = extractProductFromFields();
// Nagatice.getInstance().goFeedbackClient(acc, ea);
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("FXML.fxml"));
AnchorPane anchorPane = fxmlLoader.load();
Client_feedback itemController = fxmlLoader.getController();
itemController.Setdata(ea);
Scene secondScene = new Scene(anchorPane, 806, 620);
// Một cửa sổ mới (Stage)
Stage newWindow = new Stage();
newWindow.setTitle("Second Stage");
newWindow.setScene(secondScene);
newWindow.initModality(Modality.WINDOW_MODAL);
newWindow.show();
}
private Category extractFoodFromFields() {
Category ca = new Category();
ca.setCat_name(food.getText());
return ca;
}
private Category extractDrinkFoodFromFields() {
Category ca = new Category();
ca.setCat_name(drink.getText());
return ca;
}
private Product extractSearchFromFields() {
Product pro = new Product();
pro.setName(productname.getText());
return pro;
}
private void setChosenSnack(Product snack) {
id.setText(Integer.toString(snack.getID()));
thename.setText(snack.getName());
theprice.setText(snack.getPrice().toString());
Image image = new Image(getClass().getResourceAsStream(snack.getImg()));
imageview.setImage(image);
int c = snack.getPrice();
theprice.setText(Integer.toString(snack.getPrice()) + " VNĐ");
}
@FXML
void btnShopping(MouseEvent event) throws IOException {
ProjectSignUp osu = extractSignUpFromFields();
Nagatice.getInstance().goToShopping(osu);
}
@FXML
void btnorder(ActionEvent event) throws IOException {
addShoppingCart();
}
public void initialize(ProjectSignUp p, Category u) throws IOException {
this.psu = p;
this.cate = u;
if (this.psu != null) {
user.setText(p.getAccount());
Category();
}
if (this.cate != null) {
where(u.getCat_name());
}
}
public void initialize(ProjectSignUp p) throws IOException {
this.psu = p;
if (this.psu != null) {
user.setText(p.getAccount());
Index();
Category();
}
}
private ProjectSignUp extractSignUpFromFields() {
ProjectSignUp sign = new ProjectSignUp();
sign.setAccount(user.getText());
return sign;
}
public void initialize() throws IOException {
food.setText("Food");
drink.setText("Drink");
food.setVisible(false);
drink.setVisible(false);
id.setVisible(false);
category.getItems().add("Tất cả");
category.getItems().add("Đồ ăn");
category.getItems().add("Nước uống");
user.setVisible(false);
}
public void where(String b) {
String sql = "SELECT ProductID,ImgLink,Name,Price FROM products as p join category as c on p.CategoryID = c.CategoryID where c.NameC = ?";
try (Connection conn = DbProject.getConnection();
PreparedStatement stmt = conn.prepareStatement(sql);) {
stmt.setString(1, b);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
Product u = new Product();
u.setId(rs.getInt("ProductID"));
u.setName(rs.getString("Name"));
u.setPrice(rs.getInt("Price"));
u.setImg(rs.getString("ImgLink"));
list.add(u);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
if (list.size() > 0) {
setChosenSnack(list.get(0));
myListener = new MyListener() {
@Override
public void onClickListener(Product snack) {
setChosenSnack(snack);
}
@Override
public void addShoppingcart(Product snack) {
setChosenSnack(snack);
try {
addShoppingCart();
} catch (IOException ex) {
Logger.getLogger(Client_ChooseController.class.getName()).log(Level.SEVERE, null, ex);
}
}
};
}
int column = 0;
int row = 1;
try {
for (int i = 0; i < list.size(); i++) {
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("item.fxml"));
AnchorPane anchorPane = fxmlLoader.load();
ItemController itemController = fxmlLoader.getController();
itemController.setData(list.get(i), myListener);
if (column == 4) {
column = 0;
row++;
}
grid.add(anchorPane, column++, row); //(child,column,row)
//set grid width
grid.setMinWidth(Region.USE_COMPUTED_SIZE);
grid.setPrefWidth(Region.USE_COMPUTED_SIZE);
grid.setMaxWidth(Region.USE_PREF_SIZE);
//set grid height
grid.setMinHeight(Region.USE_COMPUTED_SIZE);
grid.setPrefHeight(Region.USE_COMPUTED_SIZE);
grid.setMaxHeight(Region.USE_PREF_SIZE);
GridPane.setMargin(anchorPane, new Insets(10));
}
} catch (IOException e) {
}
}
public void Index() {
String sql = "SELECT ProductID,ImgLink,Name,Price FROM products as p join category as c on p.CategoryID = c.CategoryID ";
try (Connection conn = DbProject.getConnection();
PreparedStatement stmt = conn.prepareStatement(sql);) {
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
Product u = new Product();
u.setId(rs.getInt("ProductID"));
u.setName(rs.getString("Name"));
u.setPrice(rs.getInt("Price"));
u.setImg(rs.getString("ImgLink"));
list.add(u);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
if (list.size() > 0) {
setChosenSnack(list.get(0));
myListener = new MyListener() {
@Override
public void onClickListener(Product snack) {
setChosenSnack(snack);
}
@Override
public void addShoppingcart(Product snack) {
setChosenSnack(snack);
try {
addShoppingCart();
} catch (IOException ex) {
Logger.getLogger(Client_ChooseController.class.getName()).log(Level.SEVERE, null, ex);
}
}
};
}
int column = 0;
int row = 1;
try {
for (int i = 0; i < list.size(); i++) {
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("item.fxml"));
AnchorPane anchorPane = fxmlLoader.load();
ItemController itemController = fxmlLoader.getController();
itemController.setData(list.get(i), myListener);
if (column == 4) {
column = 0;
row++;
}
grid.add(anchorPane, column++, row); //(child,column,row)
//set grid width
grid.setMinWidth(Region.USE_COMPUTED_SIZE);
grid.setPrefWidth(Region.USE_COMPUTED_SIZE);
grid.setMaxWidth(Region.USE_PREF_SIZE);
//set grid height
grid.setMinHeight(Region.USE_COMPUTED_SIZE);
grid.setPrefHeight(Region.USE_COMPUTED_SIZE);
grid.setMaxHeight(Region.USE_PREF_SIZE);
GridPane.setMargin(anchorPane, new Insets(10));
}
} catch (IOException e) {
}
}
public void Search(String b) {
String sql = "SELECT * FROM products WHERE `Name` LIKE CONCAT ('%' , ? ,'%') ";
try (Connection conn = DbProject.getConnection();
PreparedStatement stmt = conn.prepareStatement(sql);) {
stmt.setString(1, b);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
Product u = new Product();
u.setId(rs.getInt("ProductID"));
u.setName(rs.getString("Name"));
u.setPrice(rs.getInt("Price"));
u.setImg(rs.getString("ImgLink"));
u.setProperties(rs.getString("Properties"));
lis.add(u);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
if (lis.size() > 0) {
setChosenSnack(lis.get(0));
myListener = new MyListener() {
@Override
public void onClickListener(Product snack) {
setChosenSnack(snack);
}
@Override
public void addShoppingcart(Product snack) {
setChosenSnack(snack);
try {
addShoppingCart();
} catch (IOException ex) {
Logger.getLogger(Client_ChooseController.class.getName()).log(Level.SEVERE, null, ex);
}
}
};
}
int column = 0;
int row = 1;
try {
for (int i = 0; i < lis.size(); i++) {
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("item.fxml"));
AnchorPane anchorPane = fxmlLoader.load();
ItemController itemController = fxmlLoader.getController();
itemController.setData(lis.get(i), myListener);
if (column == 5) {
column = 0;
row++;
}
grid.add(anchorPane, column++, row); //(child,column,row)
//set grid width
grid.setMinWidth(Region.USE_COMPUTED_SIZE);
grid.setPrefWidth(Region.USE_COMPUTED_SIZE);
grid.setMaxWidth(Region.USE_PREF_SIZE);
//set grid height
grid.setMinHeight(Region.USE_COMPUTED_SIZE);
grid.setPrefHeight(Region.USE_COMPUTED_SIZE);
grid.setMaxHeight(Region.USE_PREF_SIZE);
GridPane.setMargin(anchorPane, new Insets(10));
}
} catch (IOException e) {
}
}
public void initialize(ProjectSignUp p, Product d) throws IOException {
this.psu = p;
this.pd = d;
if (this.psu != null) {
user.setText(p.getAccount());
Category();
}
if (this.pd != null) {
infomaitonselect(d.getName());
Search(d.getName());
if (id.getText().isEmpty()) {
erross.setText("* Cửa hàng không có sản phẩm có kí tự trên , vui lòng tìm sản phẩm khác");
}
}
}
private Product extractFeedbackFromFields() {
Product sign = new Product();
sign.setName(thename.getText());
return sign;
}
public void infomaitonselect(String user) {
String sql = "SELECT p.* , c.* FROM products as p join category as c on p.CategoryID = c.CategoryID WHERE p.Name = ? ";
try (Connection con = DbProject.getConnection();
PreparedStatement stmt = con.prepareStatement(sql);) {
stmt.setString(1, user);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
id.setText(Integer.toString(rs.getInt("p.ProductID")));
thename.setText(rs.getString("p.Name"));
theprice.setText(rs.getString("p.Price"));
Image myimage = new Image(getClass().getResourceAsStream(rs.getString("p.ImgLink")));
imageview.setImage(myimage);
}
}
stmt.close();
con.close();
} catch (Exception e) {
}
}
public void Category() throws IOException {
VBox v = FXMLLoader.load(getClass().getResource("WelcomeScene.fxml"));
drawer.setSidePane(v);
for (Node node : v.getChildren()) {
if (node.getAccessibleText() != null) {
node.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> {
ProjectSignUp u = extractSignUpFromFields();
switch (node.getAccessibleText()) {
case "pas": {
try {
Nagatice.getInstance().goToChangePassword(u);
} catch (IOException ex) {
Logger.getLogger(Client_ChooseController.class.getName()).log(Level.SEVERE, null, ex);
}
}
break;
case "info": {
try {
Nagatice.getInstance().goToInformationClient(u);
} catch (IOException ex) {
Logger.getLogger(Client_ChooseController.class.getName()).log(Level.SEVERE, null, ex);
}
}
break;
case "his":
break;
case "out":
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setHeaderText("Bạn chắc chắn muốn đăng xuất ?");
alert.setTitle("Lưu ý ");
Optional<ButtonType> confirmationResponse
= alert.showAndWait();
if (confirmationResponse.get() == ButtonType.OK) {
try {
Nagatice.getInstance().goToIndex();
} catch (IOException ex) {
Logger.getLogger(Client_ChooseController.class.getName()).log(Level.SEVERE, null, ex);
}
}
break;
}
});
}
}
HamburgerBackArrowBasicTransition tration = new HamburgerBackArrowBasicTransition(hamberger);
tration.setRate(-1);
hamberger.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> {
tration.setRate(tration.getRate() * -1);
tration.play();
if (tration.getRate() == 1) {
drawer.open();
} else {
drawer.close();
}
});
}
public void addShoppingCart() throws IOException{
Product ea = extractProductFromFields();
ProjectSignUp account =extractSignUpFromFields();
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("AddShoppingcart.fxml"));
AnchorPane anchorPane = fxmlLoader.load();
AddShoppingCart itemController = fxmlLoader.getController();
itemController.setData(account,ea);
Scene secondScene = new Scene(anchorPane, 966, 685);
Stage newWindow = new Stage();
newWindow.setTitle(null);
newWindow.setScene(secondScene);
newWindow.initModality(Modality.WINDOW_MODAL);
newWindow.show();
}
}
| [
"namnguyenvan1608@gmail.com"
] | namnguyenvan1608@gmail.com |
01bec7855d90ed5ca0fd39ae974aea62fb803c5c | 0218e5fec5e26eb2284a07f4e09e1759f7de0736 | /AdapterService_xg/src/main/java/com/tecsun/sisp/adapter/modules/sbjf/service/impl/GradeServiceImpl.java | c875be126984cfe6a39d140147196f63f2dd09ee | [] | no_license | KqSMea8/Mestudy | 7dd7d2bda4ea49745f2da10b18e029b086be4518 | f504bdd71ee3a6341d946ca1a03a9d83b5820970 | refs/heads/master | 2020-04-09T06:34:03.624202 | 2018-12-03T01:43:38 | 2018-12-03T01:43:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 749 | java | package com.tecsun.sisp.adapter.modules.sbjf.service.impl;
import com.tecsun.sisp.adapter.modules.common.service.BaseService;
import com.tecsun.sisp.adapter.modules.sbjf.entity.GradeEntity;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by linzetian on 2017/6/6.
*/
@Service("GradeServiceImpl")
public class GradeServiceImpl extends BaseService {
private static String NAMESPACE = "com.tecsun.sisp.adapter.modules.sbjf.service.impl.GradeServiceImpl.";
/**
* 获取缴费档次
*/
public List<GradeEntity> list4other(String insureCode) throws Exception{
List<GradeEntity> res = this.getSqlSessionTemplate().selectList(NAMESPACE+"list",insureCode);
return res;
}
}
| [
"zengyunhuago@163.com"
] | zengyunhuago@163.com |
7d5e30ead445ff62ba53e966322548cecb00261c | 07b3c22b8a6f38f4d9a2a23820ecf87a924af806 | /src/main/java/io/jenkins/plugins/analysis/core/views/LocalizedSeverity.java | 4129574e8cd718880220082ed75c41bd60a471dd | [
"MIT"
] | permissive | JeremyMarshall/warnings-plugin | 6badd97c887873d90bbf5811edaf897e0d1c0a59 | 4f893f50953a1489dc7bcb59ced3bdc12150eacf | refs/heads/master | 2020-04-01T17:24:28.466915 | 2018-10-29T10:01:48 | 2018-10-29T10:01:48 | 153,427,739 | 0 | 0 | MIT | 2018-10-17T09:05:46 | 2018-10-17T09:05:45 | null | UTF-8 | Java | false | false | 1,945 | java | package io.jenkins.plugins.analysis.core.views;
import edu.hm.hafner.analysis.Severity;
/**
* Provides localized messages for {@link Severity}.
*
* @author Ullrich Hafner
*/
public final class LocalizedSeverity {
/**
* Returns a localized description of the specified severity.
*
* @param severity
* the severity to get the text for
*
* @return localized description of the specified severity
*/
public static String getLocalizedString(final Severity severity) {
if (severity == Severity.ERROR) {
return Messages.Severity_Short_Error();
}
if (severity == Severity.WARNING_HIGH) {
return Messages.Severity_Short_High();
}
if (severity == Severity.WARNING_NORMAL) {
return Messages.Severity_Short_Normal();
}
if (severity == Severity.WARNING_LOW) {
return Messages.Severity_Short_Low();
}
return severity.getName(); // No i18n support for custom severities
}
/**
* Returns a long localized description of the specified severity.
*
* @param severity
* the severity to get the text for
*
* @return long localized description of the specified severity
*/
public static String getLongLocalizedString(final Severity severity) {
if (severity == Severity.ERROR) {
return Messages.Severity_Long_Error();
}
if (severity == Severity.WARNING_HIGH) {
return Messages.Severity_Long_High();
}
if (severity == Severity.WARNING_NORMAL) {
return Messages.Severity_Long_Normal();
}
if (severity == Severity.WARNING_LOW) {
return Messages.Severity_Long_Low();
}
return severity.getName(); // No i18n support for custom severities
}
private LocalizedSeverity() {
// prevents instantiation
}
}
| [
"ullrich.hafner@gmail.com"
] | ullrich.hafner@gmail.com |
d93b48c45b24aec5811e599359ea3caf18616fc6 | 4e7a82be75140b816dde34c89cd0be4029e4204f | /assetscenter-web/src/main/java/com/cisco/assetscenter/web/project/ProjectEditController.java | fba7156b13fa888a02790fbcee0a5ef88f44f8e9 | [] | no_license | crackerlover/assetscenter | 2dd7290273a8a25753dc36977f3a1740f481b0ec | 7234c17e415030c7ab9b39f532794b0baea190ec | refs/heads/master | 2021-01-16T19:30:55.079303 | 2012-03-29T07:33:52 | 2012-03-29T07:33:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,173 | java | package com.cisco.assetscenter.web.project;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import com.cisco.assetscenter.dao.dataobject.project.ProjectDO;
import com.cisco.assetscenter.service.asset.ProjectService;
import com.cisco.assetscenter.web.util.DateUtils;
public class ProjectEditController implements Controller {
protected final Logger logger = Logger.getLogger(ProjectEditController.class);
private ProjectService projectService;
public static final String MANAGER_SPLIT = ",";
@Override
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String id = request.getParameter("id");
String name = request.getParameter("name");
String manager = request.getParameter("manager");
String startTime = request.getParameter("START_TIME");
String endTime = request.getParameter("END_TIME");
String description = request.getParameter("description");
ProjectDO project = new ProjectDO();
if(StringUtils.isNotBlank(id)) {
project.setId(Integer.parseInt(id));
}
if(StringUtils.isNotBlank(manager)) {
String[] managers = manager.split(MANAGER_SPLIT);
project.setManagers(managers);
}
if(StringUtils.isNotBlank(name)) {
project.setName(name);
}
if(StringUtils.isNotBlank(description)) {
project.setDescription(description);
}
if(StringUtils.isNotBlank(startTime)) {
project.setStartTime(DateUtils.convertStr2Str(startTime, DateUtils.EASYUI_FORMAT, DateUtils.DATABASE_ASSET_FORMAT));
}
if(StringUtils.isNotBlank(endTime)) {
project.setEndTime(DateUtils.convertStr2Str(endTime, DateUtils.EASYUI_FORMAT, DateUtils.DATABASE_ASSET_FORMAT));
}
projectService.update(project);
String queryString = "?name=&startTime=&endTime=";
return new ModelAndView("project/project_ajax", "queryString", queryString);
}
public void setProjectService(ProjectService projectService) {
this.projectService = projectService;
}
}
| [
"smalldirector@yahoo.com"
] | smalldirector@yahoo.com |
31fa79803967abd2eae1f4859400fdac0bb8e124 | e42a87293d538966c62627fb90ff157a3b68162a | /src/main/java/cn/jzyunqi/ms/uaa/domain/dao/jpa/PrivilegeDao.java | 2da90eff3830b4bd2a506334407064bc7a04274f | [] | no_license | afeiship/project-jkf.cn | 512c69ab8f13a6d9151951bb5cef29d436ac4aa5 | 53c71fba59207817eb0939a1aae487abb6bf441b | refs/heads/master | 2020-03-23T16:32:33.350666 | 2019-05-21T14:50:07 | 2019-05-21T14:50:07 | 141,816,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,621 | java | package cn.jzyunqi.ms.uaa.domain.dao.jpa;
import cn.jzyunqi.common.persistence.dao.BaseDao;
import cn.jzyunqi.ms.uaa.domain.Privilege;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* @author wiiyaya
* @date 2018/5/3
*/
public interface PrivilegeDao extends BaseDao<Privilege, Long> {
/**
* 查找角色拥有的权限名称
*
* @param roleId 角色id
* @return 权限名称
*/
@Query("select p.name from Privilege p join RolePrivilege rp on p.id = rp.privilegeId where rp.roleId = ?1")
List<String> findNamesByRoleId(Long roleId);
/**
* 查找资源拥有的权限名称
*
* @param resourceId 资源id
* @return 权限名称
*/
@Query("select p.name from Privilege p join ResourcePrivilege rp on p.id = rp.privilegeId where rp.resourceId = ?1")
List<String> findNamesByResourceId(Long resourceId);
/**
* 获取权限代码
*
* @param privilegeIds 权限id
* @return 权限代码
*/
@Query("select p.code from Privilege p where p.id in(?1)")
List<String> findCodes(Iterable<Long> privilegeIds);
/**
* 查找除了指定id以外的权限
*
* @param privilegeIds 权限id
* @return 权限
*/
@Query("select p from Privilege p where p.id not in(?1)")
List<Privilege> findAllNotIn(Iterable<Long> privilegeIds);
/**
* 根据权限code查询权限数量
*
* @param code 权限code
* @return 数量
*/
@Query("select count(p.id) from Privilege p where p.code = ?1")
Long countCode(String code);
}
| [
"1290657123@qq.com"
] | 1290657123@qq.com |
ef1bae09bf2a6eed21e50ad5f66d6813230c0fb9 | e8b253d2560f4d70ec8cf2ba45da7dfaca48dd98 | /src/org/refactoringminer/rm2/model/SDEntity.java | 7c179c7a361788528abb1c525ed0a8bca2f17af6 | [] | no_license | lingmengfeng/RefactoringMiner | 96357e93965afb67bdb70a54ddf7394ee1ed3ffe | 1d56695679fbd4888a83d3179981f3b44fcc43f3 | refs/heads/master | 2021-05-07T04:31:59.479760 | 2017-11-16T17:37:34 | 2017-11-16T17:37:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,449 | java | package org.refactoringminer.rm2.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class SDEntity implements Comparable<SDEntity> {
private int id;
protected final SDModel.Snapshot snapshot;
protected final String fullName;
protected final EntityKey key;
protected final SDContainerEntity container;
protected final List<SDEntity> children;
private MembersRepresentation members = null;
public SDEntity(SDModel.Snapshot snapshot, int id, String fullName, EntityKey key, SDContainerEntity container) {
this.snapshot = snapshot;
this.id = id;
this.fullName = fullName;
this.key = key;
this.container = container;
this.children = new ArrayList<SDEntity>();
if (container != null) {
this.container.children.add(this);
}
}
public int getId() {
return id;
}
int setId(int id) {
return this.id = id;
}
public String fullName() {
return fullName;
}
public EntityKey key() {
return key;
}
public EntityKey key(SDEntity parent) {
return new EntityKey(parent.key() + getNameSeparator() + simpleName());
}
// public String fullName(SDEntity parent) {
// return parent.fullName() + getNameSeparator() + simpleName();
// }
protected abstract String getNameSeparator();
public abstract String simpleName();
public SDContainerEntity container() {
return container;
}
public abstract boolean isTestCode();
@Override
public int hashCode() {
// return fullName.hashCode();
return id;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof SDEntity) {
SDEntity e = (SDEntity) obj;
return id == e.id;
//return e.fullName.equals(fullName);
}
return false;
}
@Override
public String toString() {
if (fullName.lastIndexOf('/') != -1) {
return fullName.substring(fullName.lastIndexOf('/') + 1);
}
return fullName;
}
public Iterable<SDEntity> children() {
return children;
}
@Override
public int compareTo(SDEntity o) {
return fullName.compareTo(o.fullName);
}
public SourceRepresentation sourceCode() {
throw new UnsupportedOperationException();
}
public long simpleNameHash() {
long h = 0;
String simpleName = this.simpleName();
for (int i = 0; i < simpleName.length(); i++) {
h = 31 * h + simpleName.charAt(i);
}
return h;
}
public MembersRepresentation membersRepresentation() {
if (this.members == null) {
Map<Long, String> debug = new HashMap<Long, String>();
long[] hashes = new long[this.children.size()];
for (int i = 0; i < hashes.length; i++) {
hashes[i] = this.children.get(i).simpleNameHash();
debug.put(hashes[i], this.children.get(i).simpleName());
}
Arrays.sort(hashes);
this.members = new MembersRepresentation(hashes, debug);
}
return this.members;
}
public void addReferencedBy(SDMethod method) {
throw new UnsupportedOperationException();
}
public void addReferencedBy(SDType type) {
throw new UnsupportedOperationException();
}
public void addReference(SDEntity entity) {
throw new UnsupportedOperationException();
}
public boolean isAnonymous() {
return false;
}
}
| [
"danilofes@gmail.com"
] | danilofes@gmail.com |
b61482c7e8d4dbfa31d053f183d3b87b3bcb9afc | 1f90a62593ec5924609b2f1655adea1c745a7509 | /HotelManagement1.1.0/src/com/vo/DataClass.java | 2805984e0f0dd8d8f757ca3ee25ff7d31bc23b03 | [] | no_license | Black1499/HotelManagement | ab5380663cfebf62f1504f4391ef22e0e72dde2f | 67e380867bf6630e0da12f43351f80d6523af3bf | refs/heads/master | 2020-03-27T08:46:10.480067 | 2018-08-27T11:08:23 | 2018-08-27T11:08:23 | 146,285,585 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,427 | java | package com.vo;
import com.util.JsonUtil;
public class DataClass {
/**相应编码*/
private int code;
/**相应消息*/
private String msg;
/**数据总量*/
private int count;
/**响应数据*/
private Object data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public DataClass(int code, String msg, int count, Object data) {
super();
this.code = code;
this.msg = msg;
this.count = count;
this.data = data;
}
public DataClass() {
super();
}
public static DataClass ok() {
return ok(0,null);
}
public static DataClass ok(int count, Object data){
return new DataClass(0, "操作成功!", count, data);
}
public static DataClass ok(String msg) {
return new DataClass(0,msg, 0,null);
}
public static DataClass error() {
return ok(0,null);
}
public static DataClass error(int count, Object data){
return new DataClass(0, "操作失败!", count, data);
}
public static DataClass error(String msg) {
return new DataClass(0,msg, 0,null);
}
public String toJson() {
return JsonUtil.toJson(this);
}
}
| [
"liu1499@outlook.com"
] | liu1499@outlook.com |
27df19eff69c714503c3a12b21a78619b38a3651 | 55bffebd796eebcd26218e70b3d15b69084985b9 | /Polymorphism/src/Calculator/Operation.java | 8ad449e97213b553a9611f8edbf3a077f3df6ddf | [] | no_license | Bilyana-Vatev-80/Java-OOP | 3d7d92be43e168f9fbf5f56f4fc09290d2aab814 | 90b5dbc7c6de047fb70051fb446f0873ff89b015 | refs/heads/master | 2023-04-07T23:19:09.496675 | 2021-04-14T07:51:56 | 2021-04-14T07:51:56 | 340,654,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package Calculator;
public interface Operation {
void addOperand(int operand);
int getResult();
boolean isCompleted();
}
| [
"engineer_bilyana_vatev@email.com"
] | engineer_bilyana_vatev@email.com |
4ee7cf187459235e43561e56ef86fece4671efe8 | 79cea286fa45833350904b347f07e792fb78dc63 | /ExpApp2/ExpApp/app/src/main/java/com/software/exp/expapp2/Activities/ShapeCreatedActivity.java | 905374dec73c58b4e0a20b286748aa6fd3e3731c | [] | no_license | rc59/verifyooandroid | 82b61b520f80b200def0c184873e6a99c5ebe11e | 1b7bbd3b53cf9a9b869c695d5acab1d8d46d34b8 | refs/heads/master | 2021-01-11T10:23:19.431697 | 2016-12-31T13:53:54 | 2016-12-31T13:53:54 | 78,101,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,684 | java | package com.software.exp.expapp2.Activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
import com.software.exp.expapp2.R;
public class ShapeCreatedActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shape_created);
init();
}
private void init() {
ImageView img = (ImageView) findViewById(R.id.imgView);
img.setImageResource(R.drawable.check);
}
@Override
public void onBackPressed() {
goToMainView();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_shape_created, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_home) {
goToMainView();
}
return super.onOptionsItemSelected(item);
}
private void goToMainView(){
Intent intent = new Intent(getApplicationContext(), LogInActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
}
| [
"dalal.roy@gmail.com"
] | dalal.roy@gmail.com |
fc308ce1299a3d942a7dda93c8a3fea7efa8bae9 | 9b1ac1930d56dc9a0fa5911e5a6baa025755e61d | /PulseChecklist/app/src/main/java/co/za/mtn/pulsechecklist/SplashActivity.java | 8276e1b4155551e381e9b9fd38d21f87e579f431 | [] | no_license | MTN-Business-App-Academy/apppulsechecklist | 48b4ddcd88e676cc15884a7487bb819ff1bf39ef | b08c1529291668c5fd6d5a143f33955ca458436e | refs/heads/master | 2022-12-04T17:59:39.518857 | 2020-08-06T07:00:24 | 2020-08-06T07:00:24 | 287,057,924 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,402 | java | package co.za.mtn.pulsechecklist;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Space;
import android.widget.Toast;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
// Get relative layout
RelativeLayout relativeLayout = findViewById(R.id.relativeLayout);
// Get image view
ImageView imageView = findViewById(R.id.imageView);
// Click on relative layout
relativeLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(view.getContext(), "Pulse Checklist", Toast.LENGTH_SHORT).show();
}
});
// Long click for logo
imageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
mtnPop();
return false;
}
});
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
//Create an Intent that will start the GetStartedActivity.
Intent mainIntent = new Intent(SplashActivity.this, GetStartedActivity.class);
SplashActivity.this.startActivity(mainIntent);
// Kill activity
SplashActivity.this.finish();
}
}, 3000);
}
public void mtnPop() {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setTitle("About");
alertBuilder.setMessage("Go to https://www.mtn.co.za to learn more.");
alertBuilder.setPositiveButton("Later", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
});
alertBuilder.setCancelable(true);
alertBuilder.create().show();
}
} | [
"sneido.dumela@gmail.com"
] | sneido.dumela@gmail.com |
d0536e682b669f2d1a3833b6664f64a6e739338e | 45180676a3a73c94d1a6c08745a1e3a4e525ca0f | /src/Main.java | 1e95d5e8c872235cee6d2d996864319cb88983f0 | [] | no_license | OusmaneMballo/SingletonSynchronize | 4a4e8f0fb50777bae65f471121f7b4fed7302690 | 3ff458a12a6ac9c97e0690cc957f453541d24384 | refs/heads/master | 2023-08-16T07:48:17.951243 | 2021-10-13T19:02:38 | 2021-10-13T19:02:38 | 316,815,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 124 | java | public class Main {
public static void main(String args[]){
System.out.println("Bonjour Singleton !!");
}
}
| [
"ousmanemballo576@gmail.com"
] | ousmanemballo576@gmail.com |
9c3e5a02c52b1d4c5c14b6e25506fb4684d57032 | abf459cc402f12274df5bddd21c44f73f77dfafb | /src/main/java/InfoMail.java | 6664783ab85e701fc6c2d039111d18f6e7580cb1 | [] | no_license | OLDx21/SearchEng | 2104d67be8e3b9bb59fa2134e9c5e93b228e4b3e | 53383d68d2c9a4c88586c6c898dc589c74b7e409 | refs/heads/master | 2023-07-12T18:15:37.623247 | 2021-08-15T18:36:54 | 2021-08-15T18:36:54 | 367,978,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | public class InfoMail {
String Mail;
String Name;
String ItemName;
public InfoMail(String mail, String name, String itemName) {
Mail = mail;
Name = name;
ItemName = itemName;
}
public String getMail() {
return Mail;
}
public String getName() {
return Name;
}
public String getItemName() {
return ItemName;
}
}
| [
"71173909+OLDx21@users.noreply.github.com"
] | 71173909+OLDx21@users.noreply.github.com |
2c107cd29b873a4d30c98d1fa59b4290a69ff854 | 6e26eb3110fe0a9977092f737a2b0cfc282ab54d | /app/src/main/java/com/devahmed/techx/onlineshop/Screens/AdminDashboard/NotificationsControl/PushNotificationsFragment.java | 86805504f749bb2551452cfaebb5da91812bdb04 | [] | no_license | mohamedhossny4654/e-commerce-app | 1f80a4dbb76c234188d6d43381ae758fe6c0c84a | d043d638c93ff5f98df0a33dde43fdb053f78005 | refs/heads/master | 2023-02-22T14:54:05.889450 | 2021-01-24T14:34:49 | 2021-01-24T14:34:49 | 332,470,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,208 | java | package com.devahmed.techx.onlineshop.Screens.AdminDashboard.NotificationsControl;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.devahmed.techx.onlineshop.Models.Notification;
import com.devahmed.techx.onlineshop.Screens.AdminDashboard.NotificationsControl.UseCase.NotificationSenderUseCase;
public class PushNotificationsFragment extends Fragment implements NotificationsMvc.Listener, NotificationSenderUseCase.Listener {
NotificationsMvcImp mvcImp;
NotificationSenderUseCase notificationSenderUseCase;
boolean withPhoto = false;
@Override
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mvcImp = new NotificationsMvcImp(getLayoutInflater() , null);
notificationSenderUseCase = new NotificationSenderUseCase(requireActivity());
return mvcImp.getRootView();
}
@Override
public void onSendNotificationBtnClicked() {
Toast.makeText(requireActivity(), "Sent", Toast.LENGTH_SHORT).show();
if(!withPhoto){
Notification notification = new Notification();
notification.setTitle(mvcImp.getTitle());
notification.setBody(mvcImp.getBody());
notificationSenderUseCase.senNotificationWithBody(notification);
mvcImp.clear();
}
}
@Override
public void onNotificationImageClicked() {
}
@Override
public void onSwitchModeChange(boolean isChecked) {
withPhoto = isChecked;
}
@Override
public void onNotificationAddedSuccessfully() {
}
@Override
public void onNotificationFailedToAdd() {
}
@Override
public void onInputError(String message) {
}
@Override
public void onStart() {
super.onStart();
mvcImp.registerListener(this);
notificationSenderUseCase.registerListener(this);
}
@Override
public void onStop() {
super.onStop();
mvcImp.unregisterListener(this);
notificationSenderUseCase.unregisterListener(this);
}
}
| [
"mohamedhossny465@gmail.com"
] | mohamedhossny465@gmail.com |
e4e55c4919fe6d6fa24776938d4fec8d428f14b0 | c65b631c96b52546474753d9965f74e6bbd35a26 | /REST/src/main/java/com/tsystems/javaschool/evgenydubovitsky/cargomanager/dao/CheckpointDAO.java | 1374f2b7a557124b102775af3fba76809b5e4896 | [] | no_license | edubovit/CargoManager | 2c2e553b0952303d8a19db8c9c56bb800d3dde52 | 6c1295360e99b9c42116b2c314dedfea4ca530b0 | refs/heads/master | 2021-08-22T22:06:39.830445 | 2017-12-01T09:59:15 | 2017-12-01T09:59:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 208 | java | package com.tsystems.javaschool.evgenydubovitsky.cargomanager.dao;
import com.tsystems.javaschool.evgenydubovitsky.cargomanager.entity.Checkpoint;
public interface CheckpointDAO extends DAO<Checkpoint> {
}
| [
"EvgenyDubovitsky@gmail.com"
] | EvgenyDubovitsky@gmail.com |
85286787fc5a2b492d0842a8cfe0645bd952d40b | a15d4565864d8cecf88f4a9a92139c9c41578c8f | /modules/remoting/org.jowidgets.cap.remoting.client/src/main/java/org/jowidgets/cap/remoting/client/InvocationCallback.java | bc9b35cf046cca696c698ce4640d68b8398ae6e2 | [] | no_license | jo-source/jo-client-platform | f4800d121df6b982639390f3507da237fc5426c1 | 2f346b26fa956c6d6612fef2d0ef3eedbb390d7a | refs/heads/master | 2021-01-23T10:03:16.067646 | 2019-04-29T11:43:04 | 2019-04-29T11:43:04 | 39,776,103 | 2 | 3 | null | 2016-08-24T13:53:07 | 2015-07-27T13:33:59 | Java | UTF-8 | Java | false | false | 3,588 | java | /*
* Copyright (c) 2011, grossmann
* 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 jo-widgets.org 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 jo-widgets.org 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 org.jowidgets.cap.remoting.client;
import java.io.InputStream;
import java.util.ArrayList;
import org.jowidgets.cap.common.api.execution.IExecutionCallback;
import org.jowidgets.cap.common.api.execution.IExecutionCallbackListener;
import org.jowidgets.cap.common.api.execution.IResultCallback;
import org.jowidgets.invocation.service.common.api.ICancelListener;
import org.jowidgets.invocation.service.common.api.IInvocationCallback;
import org.jowidgets.util.io.IoUtils;
final class InvocationCallback<RESULT_TYPE> implements IInvocationCallback<RESULT_TYPE> {
private final IResultCallback<RESULT_TYPE> resultCallback;
private final IExecutionCallback executionCallback;
private final ArrayList<InputStream> inputStreams;
InvocationCallback(
final IResultCallback<RESULT_TYPE> resultCallback,
final IExecutionCallback executionCallback,
final ArrayList<InputStream> inputStreams) {
this.resultCallback = resultCallback;
this.executionCallback = executionCallback;
this.inputStreams = inputStreams;
}
@Override
public void addCancelListener(final ICancelListener cancelListener) {
if (executionCallback != null) {
executionCallback.addExecutionCallbackListener(new IExecutionCallbackListener() {
@Override
public void canceled() {
cancelListener.canceled();
}
});
}
}
@Override
public void finished(final RESULT_TYPE result) {
for (final InputStream inputStream : inputStreams) {
IoUtils.tryCloseSilent(inputStream);
}
if (resultCallback != null) {
resultCallback.finished(result);
}
if (executionCallback != null) {
executionCallback.finshed();
}
}
@Override
public void exeption(final Throwable exception) {
for (final InputStream inputStream : inputStreams) {
IoUtils.tryCloseSilent(inputStream);
}
if (resultCallback != null) {
resultCallback.exception(exception);
}
if (executionCallback != null) {
executionCallback.finshed();
}
}
}
| [
"herr.grossmann@gmx.de"
] | herr.grossmann@gmx.de |
eeb86d69b0116b6916abe38bef900a9613c46a96 | 61972a38e4d68da533cff38597aad2fa16f0e17d | /JuHeVideo/src/com/xyh/video/download/CheckedListener.java | b496afbba5f6a26dfa2ef48d9d4939a2668d6f1a | [] | no_license | jingyangwang/Video-watch-download | e58a78662793a92dee3ff34935488278a46f0c11 | 77714aa3522f62d41283ba9c61ea4b74cafad57c | refs/heads/master | 2020-12-30T14:13:14.969341 | 2017-05-15T03:36:17 | 2017-05-15T03:36:17 | 91,291,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 133 | java | package com.xyh.video.download;
public interface CheckedListener {
public abstract void onCheckedChange(boolean checked, int id);
} | [
"jingyangwang123@163.com"
] | jingyangwang123@163.com |
50e2c15955dd9af7b25a657d01f8ad44b8f07280 | 753aadc7a5c88a0caa5edb91d9b1c7f11a3b07c5 | /src/main/java/com/hxh/chat/entity/UserMessage.java | 5f532334ff6f409717b25dbeeb65d9e9b53f0c7f | [] | no_license | HXINGHAI/chatIM | 795c322959bb656981dba8a1ade4ac677e9473b1 | 3a5ca920d1c0635d26efc6084e557ac404780965 | refs/heads/master | 2020-07-22T15:40:38.492917 | 2019-09-09T07:20:20 | 2019-09-09T07:20:20 | 207,248,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package com.hxh.chat.entity;
import lombok.Data;
/**
* @Author: H_xinghai
* @Date: 2019/9/6 16:31
* @Description:
*/
@Data
public class UserMessage {
private String userId;
private String userName;
private String toUserId;
private String toUserName;
private String contextType;
private String context;
public UserMessage(String userName, String contextType) {
this.userName = userName;
this.contextType = contextType;
}
@Override
public String toString() {
return "UserMessage{" +
"userId='" + userId + '\'' +
", userName='" + userName + '\'' +
", toUserId='" + toUserId + '\'' +
", toUserName='" + toUserName + '\'' +
", contextType='" + contextType + '\'' +
", context='" + context + '\'' +
'}';
}
}
| [
"houxinghai@sinochem.com"
] | houxinghai@sinochem.com |
1a156ee26a71784fdfe5eb43deb71bfea4423a7b | cd0dce4a30de489c310245c4b3108c42d1c289a9 | /app/src/main/java/com/aivo/hyperion/aivo/models/actions/MagnetGroupMove.java | 664b5c2688bba2935a35e6b1951aec4b6a67bf02 | [] | no_license | corppu/aivo | b58a08340a02e7b84beb0e4e0c5901bb2e546eb1 | 23f633807a0f51b62fbc87e7d2b7b20c2498f478 | refs/heads/master | 2021-03-27T10:36:09.686463 | 2016-07-17T09:27:05 | 2016-07-17T09:27:05 | 44,610,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,183 | java | package com.aivo.hyperion.aivo.models.actions;
import android.graphics.PointF;
import com.aivo.hyperion.aivo.models.MagnetGroup;
import com.aivo.hyperion.aivo.models.ModelListener;
import com.aivo.hyperion.aivo.models.ModelMediator;
/**
* Created by MicroLoota on 11.2.2016.
*/
public class MagnetGroupMove extends Action {
private MagnetGroup magnetGroup;
private PointF pointOld;
private PointF pointNew;
public MagnetGroupMove(ModelMediator mediator, MagnetGroup magnetGroup, PointF newPoint) {
setMediator(mediator);
this.magnetGroup = magnetGroup;
this.pointOld = new PointF(magnetGroup.getPoint().x, magnetGroup.getPoint().y);
this.pointNew = new PointF(newPoint.x, newPoint.y);
}
@Override
void execute() {
magnetGroup.getPoint().set(pointNew);
for (ModelListener listener : mediator.getListeners()) {
listener.onMagnetGroupChange(magnetGroup);
}
}
@Override
void undo() {
magnetGroup.getPoint().set(pointOld);
for (ModelListener listener : mediator.getListeners()) {
listener.onMagnetGroupChange(magnetGroup);
}
}
}
| [
"tupelibox@gmail.com"
] | tupelibox@gmail.com |
2b11e7aec31f58b077994db3b045eef0d9ac4425 | 849f7e35792e5794877d573be4c449d8298d880b | /src/controller/GerenciaPessoaController.java | 91676530329c5ac4d65c66841ff7763a8cabc9b2 | [] | no_license | ludamasceno/Controle_Chaves_Central | 57772d8d9a3389f9174a2e54bbb4fd86aff58eaa | 7e0362aebcd4a0f7654dd6d4afe841a648b77cf3 | refs/heads/master | 2022-12-07T05:56:38.833130 | 2020-09-12T15:28:32 | 2020-09-12T15:28:32 | 294,970,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,369 | 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 controller;
import com.jfoenix.controls.JFXTabPane;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.net.URL;
import java.util.Optional;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.Image;
import javafx.scene.input.KeyCode;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
import model.Pessoa;
import model.ValidaCPF;
import model.TextFieldFormatter;
/**
*
* @author Luciano
*/
public class GerenciaPessoaController extends MainController {
private int id;
private String nome;
private String CPF;
private String telefone;
private String empresa;
private String EditExlui;
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
private final int width = gd.getDisplayMode().getWidth();
private final int height = gd.getDisplayMode().getHeight();
MainController mc = new MainController();
@FXML
private Button btnConfirmar;
@FXML
private TextField txtnovoNome;
@FXML
private TextField txtnovoCPF;
@FXML
private TableView<Pessoa> tbBuscaPessoa;
@FXML
private TableColumn<Pessoa, Integer> tbPessoaID;
@FXML
private TableColumn<Pessoa, String> tbPessoaNome;
@FXML
private TableColumn<Pessoa, String> tbPessoaCPF;
@FXML
private TableColumn<Pessoa, String> tbPessoaEmpresa;
@FXML
private TableColumn<Pessoa, String> tbPessoaTel;
@FXML
private Button btnCadastrar;
@FXML
private TextField txtEditEmpresa;
@FXML
private TextField txtEditCPF;
@FXML
private TextField txtID;
@FXML
private Button btnEditar;
@FXML
private TextField txtBuscaPessoa;
@FXML
private TextField txtEditTel;
@FXML
private TextField txtEditNome;
@FXML
private Button btnCancelar;
@FXML
private TextField txtnovaEmpresa;
@FXML
private TextField txtnovoTel;
@FXML
private Button btnExcluir;
@FXML
private JFXTabPane tbPane;
@FXML
void Cancelar(ActionEvent event) {
navegacao("navegar");
}
@FXML
void Confirmar(ActionEvent event) {
if ("editar".equals(EditExlui)) {
EditExlui();
} else {
EditExlui();
}
navegacao("navegar");
txtEditNome.setText("");
txtEditNome.setText("");
txtEditTel.setText("");
txtEditEmpresa.setText("");
txtBuscaPessoa.setText("");
}
@FXML
void Exclluir(ActionEvent event) {
navegacao("excluir");
}
@FXML
void Editar(ActionEvent event) {
navegacao("editar");
}
@FXML
void CadastrarPessoa(ActionEvent event) {
ValidaCPF validacpf = new ValidaCPF();
Pessoa p = new Pessoa();
boolean statusCPF;
try {
statusCPF = validacpf.validaCPF(txtnovoCPF.getText());
if (statusCPF == true) {
CadastarPessoaMtd();
iniTable();
txtnovoNome.setText("");
txtnovoCPF.setText("");
txtnovoTel.setText("");
txtnovaEmpresa.setText("");
} else {
alert("Cadastro - CPF", "CPF inválido!", Alert.AlertType.ERROR);
}
} catch (Exception ex) {
alert("Cadastro de pessoa", "Há dado(s) em branco!", Alert.AlertType.INFORMATION);
}
}
@FXML
private void selectLinha(MouseEvent e) {
id = tbBuscaPessoa.getSelectionModel().getSelectedItem().getId();
nome = tbBuscaPessoa.getSelectionModel().getSelectedItem().getNome();
CPF = tbBuscaPessoa.getSelectionModel().getSelectedItem().getCPF();
telefone = tbBuscaPessoa.getSelectionModel().getSelectedItem().getTelefone();
empresa = tbBuscaPessoa.getSelectionModel().getSelectedItem().getEmpresa();
txtID.setText(String.valueOf(id));
txtEditNome.setText(nome);
txtEditCPF.setText(CPF);
txtEditTel.setText(telefone);
txtEditEmpresa.setText(empresa);
}
@FXML
private void maskCPF_Novo() {
TextFieldFormatter tff = new TextFieldFormatter();
tff.setMask("###.###.###-##");
tff.setCaracteresValidos("0123456789");
tff.setTf(txtnovoCPF);
tff.formatter();
}
@FXML
private void maskCPF_Edit() {
TextFieldFormatter tff = new TextFieldFormatter();
tff.setMask("###.###.###-##");
tff.setCaracteresValidos("0123456789");
tff.setTf(txtEditCPF);
tff.formatter();
}
@FXML
private void maskTel_Novo() {
TextFieldFormatter tff = new TextFieldFormatter();
tff.setMask(("(##)#####-####"));
tff.setCaracteresValidos("0123456789");
tff.setTf(txtnovoTel);
tff.formatter();
}
@FXML
private void maskTel_Edit() {
TextFieldFormatter tff = new TextFieldFormatter();
tff.setMask(("(##)#####-####"));
tff.setCaracteresValidos("0123456789");
tff.setTf(txtEditTel);
tff.formatter();
}
@FXML
private void cmdEnterPessoa(javafx.scene.input.KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
BuscaPessoatbl();
}
}
@FXML
private void cmdPessoaNull() {
BuscaPessoatbl();
}
public void initialize(URL url, ResourceBundle rb) {
iniTable();
navegacao("navegar");
}
private void CadastarPessoaMtd() {
String cpf = txtnovoCPF.getText();
String Nome = txtnovoNome.getText().toUpperCase();
String Telefone = txtnovoTel.getText();
String Empresa = txtnovaEmpresa.getText().toUpperCase();
Pessoa p = new Pessoa(Nome, cpf, Telefone, Empresa);
p.InserePessoa();
}
private void iniTable() {
tbPessoaID.setCellValueFactory(new PropertyValueFactory("id"));
tbPessoaNome.setCellValueFactory(new PropertyValueFactory("nome"));
tbPessoaCPF.setCellValueFactory(new PropertyValueFactory("CPF"));
tbPessoaTel.setCellValueFactory(new PropertyValueFactory("telefone"));
tbPessoaEmpresa.setCellValueFactory(new PropertyValueFactory("empresa"));
tbBuscaPessoa.setItems(atualizaTabela());
}
public ObservableList<Pessoa> atualizaTabela() {
Pessoa p = new Pessoa();
return FXCollections.observableArrayList(p.allPessoa());
}
public void BuscaPessoatbl() {
tbPessoaID.setCellValueFactory(new PropertyValueFactory("id"));
tbPessoaNome.setCellValueFactory(new PropertyValueFactory("nome"));
tbPessoaCPF.setCellValueFactory(new PropertyValueFactory("CPF"));
tbPessoaTel.setCellValueFactory(new PropertyValueFactory("Telefone"));
tbPessoaEmpresa.setCellValueFactory(new PropertyValueFactory("Empresa"));
tbBuscaPessoa.setItems(buscaPessoa());
}
public ObservableList<Pessoa> buscaPessoa() {
Pessoa p = new Pessoa();
String where = txtBuscaPessoa.getText();
p.setWhere(where);
p.BuscaPessoa();
return FXCollections.observableArrayList(p.BuscaPessoa());
}
private void EditExlui() {
int ID = Integer.parseInt(txtID.getText());
String Nome = txtEditNome.getText().toUpperCase();
String cpf = txtEditCPF.getText();
String tel = txtEditTel.getText();
String EMpresa = txtEditEmpresa.getText().toUpperCase();
switch (EditExlui) {
case "editar": {
ValidaCPF validaCPF = new ValidaCPF();
if (validaCPF.validaCPF(cpf) == true) {
Pessoa p = new Pessoa(Nome, cpf, tel, EMpresa);
p.setId(ID);
p.AlteraPessoa();
iniTable();
}
}
break;
case "excluir": {
Pessoa p = new Pessoa();
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(this.getClass().getResource("/image/Circle.png").toString()));
alert.setTitle("Exclusão de dados");
alert.setHeaderText("Você irá excluir:"
+ "\nPessoa: " + Nome
+ "\nCPF: " + cpf
+ "\nTelefone: " + tel
+ "\nEmpresa/dpto: " + EMpresa);
alert.setContentText("A exclusão não poderá ser desfeita!\nDeseja continuar?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
p.setId(ID);
p.excluir();
iniTable();
} else {
alert("Exclusão de dados", "Exclusão cancelada!", Alert.AlertType.INFORMATION);
}
}
break;
}
}
private void navegacao(String tipo) {
switch (tipo) {
case "editar": {
btnExcluir.setDisable(true);
btnEditar.setDisable(true);
btnConfirmar.setDisable(false);
btnCancelar.setDisable(false);
tbBuscaPessoa.setDisable(true);
txtEditNome.setDisable(false);
txtEditCPF.setDisable(false);
txtEditTel.setDisable(false);
txtEditEmpresa.setDisable(false);
EditExlui = "editar";
}
break;
case "excluir": {
btnEditar.setDisable(true);
btnExcluir.setDisable(true);
btnConfirmar.setDisable(false);
btnCancelar.setDisable(false);
txtEditNome.setDisable(true);
txtEditCPF.setDisable(true);
txtEditTel.setDisable(true);
txtEditEmpresa.setDisable(true);
tbBuscaPessoa.setDisable(true);
EditExlui = "excluir";
}
break;
case "navegar": {
tbBuscaPessoa.setDisable(false);
btnConfirmar.setDisable(true);
btnCancelar.setDisable(true);
btnExcluir.setDisable(false);
btnEditar.setDisable(false);
txtEditNome.setDisable(true);
txtEditCPF.setDisable(true);
txtEditTel.setDisable(true);
txtEditEmpresa.setDisable(true);
txtID.setText("");
txtEditNome.setText("");
txtEditCPF.setText("");
txtEditTel.setText("");
txtEditEmpresa.setText("");
}
break;
}
}
private void alert(String title, String tentext, Alert.AlertType type) {
Alert alert = new Alert(type);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(this.getClass().getResource("/image/Circle.png").toString()));
alert.setTitle(title);
alert.setContentText(tentext);
alert.setHeaderText(null);
alert.setWidth(5);
alert.setX(width / 2 - 150);
alert.setY(height / 2 - 150);
alert.showAndWait();
}
}
| [
"Luciano@192.168.0.241"
] | Luciano@192.168.0.241 |
7c8ad6e250c83b002d0c232bb5eb2369ab13ef63 | 17c6abf6fdee8d97788b26a5836271e5cae44416 | /src/main/java/com/illo/blm/config/ElasticsearchConfiguration.java | 70ed67ebd924b16fe8371329f016a3105f2129b2 | [] | no_license | mossrasmuss/blm | 3f9ec311d8a806867817fcfbc19aba91485ebeea | 36b5ccf2660d2ef3f97608b397045b486ee21e94 | refs/heads/main | 2023-01-23T02:11:47.633605 | 2020-11-22T12:51:59 | 2020-11-22T12:51:59 | 315,036,692 | 0 | 0 | null | 2020-11-22T17:07:40 | 2020-11-22T12:51:39 | Java | UTF-8 | Java | false | false | 3,655 | java | package com.illo.blm.config;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.github.vanroy.springdata.jest.JestElasticsearchTemplate;
import com.github.vanroy.springdata.jest.mapper.DefaultJestResultsMapper;
import io.searchbox.client.JestClient;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.EntityMapper;
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
import org.springframework.data.mapping.MappingException;
@Configuration
@EnableConfigurationProperties(ElasticsearchProperties.class)
public class ElasticsearchConfiguration {
private ObjectMapper mapper;
public ElasticsearchConfiguration(ObjectMapper mapper) {
this.mapper = mapper;
}
@Bean
public EntityMapper getEntityMapper() {
return new CustomEntityMapper(mapper);
}
@Bean
@Primary
public ElasticsearchOperations elasticsearchTemplate(
JestClient jestClient,
ElasticsearchConverter elasticsearchConverter,
SimpleElasticsearchMappingContext mappingContext,
EntityMapper entityMapper
) {
return new JestElasticsearchTemplate(
jestClient,
elasticsearchConverter,
new DefaultJestResultsMapper(mappingContext, entityMapper)
);
}
public class CustomEntityMapper implements EntityMapper {
private ObjectMapper objectMapper;
public CustomEntityMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
objectMapper.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, true);
objectMapper.configure(SerializationFeature.INDENT_OUTPUT, false);
objectMapper.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, true);
}
@Override
public String mapToString(Object object) throws IOException {
return objectMapper.writeValueAsString(object);
}
@Override
public <T> T mapToObject(String source, Class<T> clazz) throws IOException {
return objectMapper.readValue(source, clazz);
}
@Override
public Map<String, Object> mapObject(Object source) {
try {
return objectMapper.readValue(mapToString(source), HashMap.class);
} catch (IOException e) {
throw new MappingException(e.getMessage(), e);
}
}
@Override
public <T> T readObject(Map<String, Object> source, Class<T> targetType) {
try {
return mapToObject(mapToString(source), targetType);
} catch (IOException e) {
throw new MappingException(e.getMessage(), e);
}
}
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
31677c02335772002fce0dbe5d1b3f80f4593eb2 | bac9f0a2368e373a1b45932d2a38577ca68de1a8 | /src/main/java/com/gtafe/model/User.java | 302a1341dd30b9d7be9bd3c4e86c10924ff4c0da | [] | no_license | li5220008/spring-mvc | f42ad047459b523c8328a3c6489f7b3764b20d73 | ec2bd12bb9b657bed8fd1b4cafa197037dcb2303 | refs/heads/master | 2020-05-21T00:56:16.704658 | 2015-03-26T09:59:45 | 2015-03-26T09:59:45 | 18,002,025 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,895 | java | package com.gtafe.model;
import java.util.Date;
import java.util.List;
public class User {
private int id;
private String username;
private String password;
private String nickname;
private int userAge;
private String userAddress;
private Date birthday;
private String email;
List<Object> obj;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUserAge() {
return userAge;
}
public void setUserAge(int userAge) {
this.userAge = userAge;
}
public String getUserAddress() {
return userAddress;
}
public void setUserAddress(String userAddress) {
this.userAddress = userAddress;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", username='" + username + '\'' +
", password='" + password + '\'' +
", nickname='" + nickname + '\'' +
", userAge=" + userAge +
", userAddress='" + userAddress + '\'' +
", birthday=" + birthday +
", email='" + email + '\'' +
'}';
}
}
| [
"li5220008@163.com"
] | li5220008@163.com |
79e444ccbc1e28cbafe8f2646c9c7be56910284c | 71bd32e77a2a8fc7253d580c6774d4396dd92b15 | /src/main/java/com/mitocode/javaweb/java_intro/ejercicio07_interfaces/CuentaEmpresa.java | dd1419e8b121adb28c33b51abc4739a91e74e7a9 | [] | no_license | mitocode-javaweb/java-intro | b8fd76ce1543a185b7a49344e1a641689383626b | ed4c1a1af417741690df3581d78e87089a1cbb03 | refs/heads/main | 2023-01-08T13:23:29.710609 | 2020-11-05T02:32:50 | 2020-11-05T02:32:50 | 310,168,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,427 | java | package com.mitocode.javaweb.java_intro.ejercicio07_interfaces;
public class CuentaEmpresa extends Cuenta implements OperacionBancaria {
double limitePrestamo;
private static double COMISIION_PRESTAMO = 10.0;
public CuentaEmpresa(String numeroCuenta, String nombreTitular) {
super(numeroCuenta, nombreTitular);
this.limitePrestamo = 0;
}
public CuentaEmpresa(String numeroCuenta, String nombreTitular, double limitePrestamo) {
super(numeroCuenta, nombreTitular);
this.limitePrestamo = limitePrestamo;
}
public CuentaEmpresa(String numeroCuenta, String nombreTitular, double depositoInicial, double limitePrestamo) {
super(numeroCuenta, nombreTitular);
deposito(depositoInicial);
this.limitePrestamo = limitePrestamo;
}
public void prestamo(double monto) {
if (monto > limitePrestamo) {
System.out.println("Supera limite de prestamo");
} else {
deposito(monto - COMISIION_PRESTAMO);
}
}
@Override
public String toString() {
return "CuentaEmpresa [limitePrestamo=" + limitePrestamo + ", numeroCuenta=" + numeroCuenta + ", nombreTitular="
+ nombreTitular + ", getSaldo()=" + getSaldo() + "]";
}
@Override
public void deposito(double monto) {
this.saldo += monto;
}
@Override
public void retiro(double monto) {
if (this.saldo >= monto + COMISION_RETIRO) {
this.saldo -= (monto + COMISION_RETIRO);
} else {
System.out.println("Saldo insuficiente!");
}
}
}
| [
"djrequejo@gmail.com"
] | djrequejo@gmail.com |
6dffaeff6370a4afa170ff2845141447fe16cae7 | 5422e94671d00e8dc0f4e54c4c35c1be05ca3502 | /ImplementingEcommerceCart/src/main/java/com/lenovo/implementingecommercecart/config/WebSecurityConfig.java | b41022b3b5f8a22cc1aced59b8531ce955e306e5 | [] | no_license | deb264/MyPro | 98c056a1401b39dfe6bca007a76fcb3db4cbc241 | a258a8dcf23d03bd2c509759b7d57770cef66aa8 | refs/heads/master | 2020-04-18T11:10:07.659292 | 2019-01-25T05:40:13 | 2019-01-25T05:40:13 | 167,490,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,484 | java | package com.lenovo.implementingecommercecart.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import com.lenovo.implementingecommercecart.authentication.MyDBAuthenticationService;
@Configuration
// @EnableWebSecurity = @EnableWebMVCSecurity + Extra features
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
MyDBAuthenticationService myDBAauthenticationService;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// For User in database.
auth.userDetailsService(myDBAauthenticationService);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
// The pages requires login as EMPLOYEE or MANAGER.
// If no login, it will redirect to /login page.
http.authorizeRequests().antMatchers("/orderList","/order", "/accountInfo")//
.access("hasAnyRole('ROLE_EMPLOYEE', 'ROLE_MANAGER')");
// For MANAGER only.
http.authorizeRequests().antMatchers("/product").access("hasRole('ROLE_MANAGER')");
// When the user has logged in as XX.
// But access a page that requires role YY,
// AccessDeniedException will throw.
http.authorizeRequests().and().exceptionHandling().accessDeniedPage("/403");
// Config for Login Form
http.authorizeRequests().and().formLogin()//
// Submit URL of login page.
.loginProcessingUrl("/j_spring_security_check") // Submit URL
.loginPage("/login")//
.defaultSuccessUrl("/accountInfo")//
.failureUrl("/login?error=true")//
.usernameParameter("userName")//
.passwordParameter("password")
// Config for Logout Page
// (Go to home page).
.and().logout().logoutUrl("/logout").logoutSuccessUrl("/");
}
} | [
"BIKYPC@BIKY"
] | BIKYPC@BIKY |
651221df5c12baf7caed26e0852440f053ee8d80 | 120c4dc96a71ea30f7b848c4c65f0f8f595cc3c6 | /soap-sample/src/main/java/net/webservicex/GeoIPServiceSoap.java | bc25f57ad5471e490938461159b06634b6a01e42 | [
"Apache-2.0"
] | permissive | EVorobyev/java_pft | b6fda1f9137fb966c572788e380640d3e48ab597 | e3f1a84449d7cc8acdc716b14fa7f62ba0c3f93e | refs/heads/master | 2020-12-02T09:10:08.015181 | 2017-10-15T11:57:00 | 2017-10-15T11:57:00 | 96,707,895 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,955 | java | package net.webservicex;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
/**
* This class was generated by Apache CXF 3.2.0
* 2017-09-27T16:04:23.376+03:00
* Generated source version: 3.2.0
*
*/
@WebService(targetNamespace = "http://www.webservicex.net/", name = "GeoIPServiceSoap")
@XmlSeeAlso({ObjectFactory.class})
public interface GeoIPServiceSoap {
/**
* GeoIPService - GetGeoIP enables you to easily look up countries by IP addresses
*/
@WebMethod(operationName = "GetGeoIP", action = "http://www.webservicex.net/GetGeoIP")
@RequestWrapper(localName = "GetGeoIP", targetNamespace = "http://www.webservicex.net/", className = "net.webservicex.GetGeoIP")
@ResponseWrapper(localName = "GetGeoIPResponse", targetNamespace = "http://www.webservicex.net/", className = "net.webservicex.GetGeoIPResponse")
@WebResult(name = "GetGeoIPResult", targetNamespace = "http://www.webservicex.net/")
public net.webservicex.GeoIP getGeoIP(
@WebParam(name = "IPAddress", targetNamespace = "http://www.webservicex.net/")
java.lang.String ipAddress
);
/**
* GeoIPService - GetGeoIPContext enables you to easily look up countries by Context
*/
@WebMethod(operationName = "GetGeoIPContext", action = "http://www.webservicex.net/GetGeoIPContext")
@RequestWrapper(localName = "GetGeoIPContext", targetNamespace = "http://www.webservicex.net/", className = "net.webservicex.GetGeoIPContext")
@ResponseWrapper(localName = "GetGeoIPContextResponse", targetNamespace = "http://www.webservicex.net/", className = "net.webservicex.GetGeoIPContextResponse")
@WebResult(name = "GetGeoIPContextResult", targetNamespace = "http://www.webservicex.net/")
public net.webservicex.GeoIP getGeoIPContext();
}
| [
"e.vorobiev@list.ru"
] | e.vorobiev@list.ru |
47713cce4b176a26e34ec018de5006da99dfb842 | 31adbf5cfaa10712eb64a36247bb64f7ca7c2eca | /src/main/java/cpen221/mp2/models/ProximityGrid.java | ec97e21f2c6a057bafb78cb38f128966c083e0d3 | [] | no_license | amber1bhatt/Graphs-and-Games | 1e4520aaf460b8ad4f95bb587318117a0a2babde | 9420eb546d8d80ca7f433ff364e2917689a9d44a | refs/heads/main | 2023-02-12T19:12:29.506159 | 2021-01-11T00:07:19 | 2021-01-11T00:07:19 | 328,495,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,514 | java | package cpen221.mp2.models;
import cpen221.mp2.util.Util;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**
* An instance maintains Planets in a 2D rectangle and can return the closest Planet
* to a given Point. It maintains an internal set of rectangles containing Planets
* based on their coordinates.
*/
public class ProximityGrid implements Iterable<Planet> {
/* The dimensions of an individual rectangle. */
private static final int RECT_WIDTH = 64, RECT_HEIGHT = 64;
/* a 2D array(list) representing rectangles that contain a list of Planets.
* [0][0] is the bottom-left rectangle. rs will always have at least one
* rectangle, and will always be rectangular (i.e. not ragged). */
private ArrayList<ArrayList<List<Planet>>> rectangles;
/* The minimum x- and y-values of this PlanetProximitySet. */
private int x, y;
/**
* Create a ProximityMap spanning the axis-aligned rectangle
* with bottom-left coordinates (x, y) and the given dimensions.
*
* @param x the bottom-left x coordinate for the grid.
* @param y the bottom-left y coordinate for the grid.
* @param width the width of the grid.
* @param height the height of the grid.
*/
public ProximityGrid(int x, int y, int width, int height) {
this.x = x;
this.y = y;
int w = width / RECT_WIDTH + 1;
int h = height / RECT_HEIGHT + 1;
rectangles = new ArrayList<>(h);
for (int i = 0; i < h; ++i) {
rectangles.add(new ArrayList<>(h));
for (int j = 0; j < w; ++j) {
rectangles.get(i).add(new LinkedList<Planet>());
}
}
}
/**
* Return the Planet in planets closest to (x, y) or null if planets is null/empty.
*
* @return the Planet in planets closest to (x, y) or null if planets is null/empty.
*/
private static Planet closestOfList(List<Planet> planets, Point2D p) {
if (planets.isEmpty()) {
return null;
}
Planet closest = planets.get(0);
double dist = Double.MAX_VALUE;
for (Planet pl : planets) {
if (pl != null) {
double nDist = Util.distance(pl.x(), pl.y(), p.getX(), p.getY());
if (dist > nDist) {
dist = nDist;
closest = pl;
}
}
}
return closest;
}
/**
* Add Planet pl to this ProximityGrid.
*
* @param pl is within the bounds of this ProximityGrid.
*/
public void addPlanet(Planet pl) {
int ri = (pl.y() - y) / RECT_HEIGHT;
int rj = (pl.x() - x) / RECT_WIDTH;
rectangles.get(ri).get(rj).add(pl);
}
/**
* Returns the planet closest to p.<br /><br />
* <p><strong>requires clause:</strong> the ProximityGrid is not empty.</p>
*
* @return the planet closest to p.
*/
public Planet closestPlanet(Point2D p) {
int ri = (int) (p.getY() - y) / RECT_HEIGHT;
int rj = (int) (p.getX() - x) / RECT_WIDTH;
if (ri >= rows()) {
ri = rows() - 1;
} else if (ri < 0) {
ri = 0;
}
if (rj >= cols()) {
rj = cols() - 1;
} else if (rj < 0) {
rj = 0;
}
Planet pl = closestOfList(rectangles.get(ri).get(rj), p);
int imin = ri - 1 >= 0 ? ri - 1 : 0;
int imax = ri + 1 < rows() ? ri + 1 : rows() - 1;
int jmin = rj - 1 >= 0 ? rj - 1 : 0;
int jmax = rj + 1 < cols() ? rj + 1 : cols() - 1;
do {
List<Planet> ns = new LinkedList<Planet>();
ns.add(pl);
for (int i = imin; i <= imax; ++i) {
ns.add(closestOfList(rectangles.get(i).get(jmin), p));
ns.add(closestOfList(rectangles.get(i).get(jmax), p));
}
for (int j = jmin + 1; j < jmax; ++j) {
ns.add(closestOfList(rectangles.get(imin).get(j), p));
ns.add(closestOfList(rectangles.get(imax).get(j), p));
}
pl = closestOfList(ns, p);
imin = imin - 1 >= 0 ? imin - 1 : imin;
imax = imax + 1 < rows() ? imax + 1 : imax;
jmin = jmin - 1 >= 0 ? jmin - 1 : jmin;
jmax = jmax + 1 < cols() ? jmax + 1 : jmax;
} while (pl == null);
return pl;
}
/**
* Return the number of rows in this grid.
*
* @return the number of rows in this grid.
*/
private int rows() {
return rectangles.size();
}
/**
* Return the number of columns in this grid.
*
* @return the number of columns in this grid.
*/
private int cols() {
return rectangles.get(0).size();
}
@Override
public Iterator<Planet> iterator() {
return new MapIterator();
}
/**
* An instance enumerates all Planets in this PlanetProximityGrid.
*/
private class MapIterator implements Iterator<Planet> {
/* The current index whose Planets are being iterated. */
private int ri, rj;
/* The current iterator getting Planets. */
private Iterator<Planet> iter;
/**
* Constructor: a MapIterator starting at rs[0][0].
*/
public MapIterator() {
ri = 0;
rj = 0;
iter = rectangles.get(0).get(0).iterator();
ensureTotalEnumeration();
}
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public Planet next() {
Planet n = iter.next();
ensureTotalEnumeration();
return n;
}
/**
* Iff iter still has more elements, do nothing. Otherwise, cycle to
* the next List's iterator until all Planets have been enumerated.
*/
private void ensureTotalEnumeration() {
while (!iter.hasNext() && ri < rectangles.size()) {
++rj;
if (rj < cols()) {
iter = rectangles.get(ri).get(rj).iterator();
} else {
++ri;
if (ri < rows()) {
rj = 0;
iter = rectangles.get(ri).get(rj).iterator();
}
}
}
}
}
} | [
"amber.bhatt@ubcorbit.com"
] | amber.bhatt@ubcorbit.com |
12f10e5016fbd185d8ecf308d0ae2d17fdaf9ad2 | a9568df0dae26394529d693fbb7960c56b91db8b | /src/main/java/com/saddam/form/HomeController.java | 61bf827ff15eb08e4504b551e29d76cab996bd11 | [] | no_license | saddambgh/SpringFormTags | ccb1e63163288fa4822b76fe5ab48ab2d0620d72 | 995d59b7f15d22834f6f5dd58e21e7fe839668ca | refs/heads/master | 2021-07-23T06:15:09.722337 | 2017-11-02T18:04:08 | 2017-11-02T18:04:08 | 107,325,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | package com.saddam.form;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Handles requests for the application home page.
*/
@Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "home";
}
}
| [
"Sdm@@@123"
] | Sdm@@@123 |
462055d52d72212b2ddec8be9bca8c93f3a10390 | 871f7ba790d262493c05934a72f7a22fb0c316fc | /mybatis/src/main/java/com/cjhb/mybatis/plugins/MySqlPaginationPlugin.java | 3002230991cbdd04e6d0e0803305266ed3724d7b | [] | no_license | zhangbo6248/PMS | f3bf31439fa72dad9095cc6ffe3f8586e8cd200a | ae0536a62ce28bc114ebe12d4a2b0196d6a167fa | refs/heads/master | 2021-06-04T09:30:46.074785 | 2016-07-28T07:04:13 | 2016-07-28T07:04:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,419 | java | package com.cjhb.mybatis.plugins;
import org.mybatis.generator.api.CommentGenerator;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.*;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
import java.util.List;
/**
* <p>@title: 自定义 MBG(mybatis-generator) 适配器类</p>
* <p>@Description:
* Plugin能够用来在MyBatis Generator生成Java和XML文件过程中修改或者添加内容;
* Plugin必须实现org.mybatis.generator.api.Plugin接口,在这个接口中提供了非常多的方法,
* 所以,很自然,MBG提供了一个适配器org.mybatis.generator.api.PluginAdapter,
* 一般情况下只需要继承这个适配器即可;
* MBG已经提供了一些内置的Plugin(这些Plugin是我们学习插件的非常好的示例),
* 这些插件都在org.mybatis.generator.plugins包中;要能够写自己的插件,
* 最重要的是了解插件的执行过程(生命周期)。</p>
* @author: edgar
* @email: edgar_zhang2014@163.com
* @date: 2016-7-21 10:11:50
* @see org.mybatis.generator.api.PluginAdapter
*/
public class MySqlPaginationPlugin extends PluginAdapter {
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
// add field, getter, setter for limit clause
addLimit(topLevelClass, introspectedTable, "limitOffset");
addLimit(topLevelClass, introspectedTable, "limit");
return super.modelExampleClassGenerated(topLevelClass,
introspectedTable);
}
@Override
public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(
XmlElement element, IntrospectedTable introspectedTable) {
// XmlElement isParameterPresenteElemen = (XmlElement) element
// .getElements().get(element.getElements().size() - 1);
XmlElement isNotNullElement = new XmlElement("if"); //$NON-NLS-1$
isNotNullElement.addAttribute(new Attribute("test", "limitOffset != null and limitOffset>=0")); //$NON-NLS-1$ //$NON-NLS-2$
// isNotNullElement.addAttribute(new Attribute("compareValue", "0")); //$NON-NLS-1$ //$NON-NLS-2$
isNotNullElement.addElement(new TextElement(
"limit #{limitOffset}, #{limit}"));
// isParameterPresenteElemen.addElement(isNotNullElement);
element.addElement(isNotNullElement);
return super.sqlMapUpdateByExampleWithoutBLOBsElementGenerated(element,
introspectedTable);
}
private void addLimit(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable, String name) {
CommentGenerator commentGenerator = context.getCommentGenerator();
Field field = new Field();
field.setVisibility(JavaVisibility.PROTECTED);
// field.setType(FullyQualifiedJavaType.getIntInstance());
field.setType(PrimitiveTypeWrapper.getIntegerInstance());
field.setName(name);
// field.setInitializationString("-1");
commentGenerator.addFieldComment(field, introspectedTable);
topLevelClass.addField(field);
char c = name.charAt(0);
String camel = Character.toUpperCase(c) + name.substring(1);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setName("set" + camel);
method.addParameter(new Parameter(PrimitiveTypeWrapper.getIntegerInstance(), name));
method.addBodyLine("this." + name + "=" + name + ";");
commentGenerator.addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(PrimitiveTypeWrapper.getIntegerInstance());
method.setName("get" + camel);
method.addBodyLine("return " + name + ";");
commentGenerator.addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
}
/**
* This plugin is always valid - no properties are required
*/
public boolean validate(List<String> warnings) {
return true;
}
}
| [
"edgar_zhang2014@163.com"
] | edgar_zhang2014@163.com |
b248c329b55e29e6497678d3129feb6a97611fe2 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Honor5C-7.0/src/main/java/java/util/concurrent/ThreadLocalRandom.java | 5b8f28297dd7b6ae3a34d129cf4041f58c168c03 | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,540 | java | package java.util.concurrent;
import android.icu.util.AnnualTimeZoneRule;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.ObjectOutputStream.PutField;
import java.io.ObjectStreamField;
import java.util.Random;
import java.util.Spliterator.OfDouble;
import java.util.Spliterator.OfInt;
import java.util.Spliterator.OfLong;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.DoubleConsumer;
import java.util.function.IntConsumer;
import java.util.function.LongConsumer;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.StreamSupport;
import sun.misc.Unsafe;
public class ThreadLocalRandom extends Random {
static final String BAD_BOUND = "bound must be positive";
static final String BAD_RANGE = "bound must be greater than origin";
static final String BAD_SIZE = "size must be non-negative";
private static final double DOUBLE_UNIT = 1.1102230246251565E-16d;
private static final float FLOAT_UNIT = 5.9604645E-8f;
private static final long GAMMA = -7046029254386353131L;
private static final long PROBE = 0;
private static final int PROBE_INCREMENT = -1640531527;
private static final long SECONDARY = 0;
private static final long SEED = 0;
private static final long SEEDER_INCREMENT = -4942790177534073029L;
private static final Unsafe U = null;
static final ThreadLocalRandom instance = null;
private static final ThreadLocal<Double> nextLocalGaussian = null;
private static final AtomicInteger probeGenerator = null;
private static final AtomicLong seeder = null;
private static final ObjectStreamField[] serialPersistentFields = null;
private static final long serialVersionUID = -5851777807851030925L;
boolean initialized;
private static final class RandomDoublesSpliterator implements OfDouble {
final double bound;
final long fence;
long index;
final double origin;
RandomDoublesSpliterator(long index, long fence, double origin, double bound) {
this.index = index;
this.fence = fence;
this.origin = origin;
this.bound = bound;
}
public RandomDoublesSpliterator trySplit() {
long i = this.index;
long m = (this.fence + i) >>> 1;
if (m <= i) {
return null;
}
this.index = m;
return new RandomDoublesSpliterator(i, m, this.origin, this.bound);
}
public long estimateSize() {
return this.fence - this.index;
}
public int characteristics() {
return 17728;
}
public boolean tryAdvance(DoubleConsumer consumer) {
if (consumer == null) {
throw new NullPointerException();
}
long i = this.index;
if (i >= this.fence) {
return false;
}
consumer.accept(ThreadLocalRandom.current().internalNextDouble(this.origin, this.bound));
this.index = 1 + i;
return true;
}
public void forEachRemaining(DoubleConsumer consumer) {
if (consumer == null) {
throw new NullPointerException();
}
long i = this.index;
long f = this.fence;
if (i < f) {
this.index = f;
double o = this.origin;
double b = this.bound;
ThreadLocalRandom rng = ThreadLocalRandom.current();
do {
consumer.accept(rng.internalNextDouble(o, b));
i++;
} while (i < f);
}
}
}
private static final class RandomIntsSpliterator implements OfInt {
final int bound;
final long fence;
long index;
final int origin;
RandomIntsSpliterator(long index, long fence, int origin, int bound) {
this.index = index;
this.fence = fence;
this.origin = origin;
this.bound = bound;
}
public RandomIntsSpliterator trySplit() {
long i = this.index;
long m = (this.fence + i) >>> 1;
if (m <= i) {
return null;
}
this.index = m;
return new RandomIntsSpliterator(i, m, this.origin, this.bound);
}
public long estimateSize() {
return this.fence - this.index;
}
public int characteristics() {
return 17728;
}
public boolean tryAdvance(IntConsumer consumer) {
if (consumer == null) {
throw new NullPointerException();
}
long i = this.index;
if (i >= this.fence) {
return false;
}
consumer.accept(ThreadLocalRandom.current().internalNextInt(this.origin, this.bound));
this.index = 1 + i;
return true;
}
public void forEachRemaining(IntConsumer consumer) {
if (consumer == null) {
throw new NullPointerException();
}
long i = this.index;
long f = this.fence;
if (i < f) {
this.index = f;
int o = this.origin;
int b = this.bound;
ThreadLocalRandom rng = ThreadLocalRandom.current();
do {
consumer.accept(rng.internalNextInt(o, b));
i++;
} while (i < f);
}
}
}
private static final class RandomLongsSpliterator implements OfLong {
final long bound;
final long fence;
long index;
final long origin;
RandomLongsSpliterator(long index, long fence, long origin, long bound) {
this.index = index;
this.fence = fence;
this.origin = origin;
this.bound = bound;
}
public RandomLongsSpliterator trySplit() {
long i = this.index;
long m = (this.fence + i) >>> 1;
if (m <= i) {
return null;
}
this.index = m;
return new RandomLongsSpliterator(i, m, this.origin, this.bound);
}
public long estimateSize() {
return this.fence - this.index;
}
public int characteristics() {
return 17728;
}
public boolean tryAdvance(LongConsumer consumer) {
if (consumer == null) {
throw new NullPointerException();
}
long i = this.index;
if (i >= this.fence) {
return false;
}
consumer.accept(ThreadLocalRandom.current().internalNextLong(this.origin, this.bound));
this.index = 1 + i;
return true;
}
public void forEachRemaining(LongConsumer consumer) {
if (consumer == null) {
throw new NullPointerException();
}
long i = this.index;
long f = this.fence;
if (i < f) {
this.index = f;
long o = this.origin;
long b = this.bound;
ThreadLocalRandom rng = ThreadLocalRandom.current();
do {
consumer.accept(rng.internalNextLong(o, b));
i++;
} while (i < f);
}
}
}
static {
/* JADX: method processing error */
/*
Error: jadx.core.utils.exceptions.DecodeException: Load method exception in method: java.util.concurrent.ThreadLocalRandom.<clinit>():void
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:113)
at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:256)
at jadx.core.ProcessClass.process(ProcessClass.java:34)
at jadx.core.ProcessClass.processDependencies(ProcessClass.java:59)
at jadx.core.ProcessClass.process(ProcessClass.java:42)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:281)
at jadx.api.JavaClass.decompile(JavaClass.java:59)
at jadx.api.JadxDecompiler$1.run(JadxDecompiler.java:161)
Caused by: jadx.core.utils.exceptions.DecodeException: in method: java.util.concurrent.ThreadLocalRandom.<clinit>():void
at jadx.core.dex.instructions.InsnDecoder.decodeInsns(InsnDecoder.java:46)
at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:98)
... 7 more
Caused by: java.lang.IllegalArgumentException: bogus opcode: 00e9
at com.android.dx.io.OpcodeInfo.get(OpcodeInfo.java:1197)
at com.android.dx.io.OpcodeInfo.getFormat(OpcodeInfo.java:1212)
at com.android.dx.io.instructions.DecodedInstruction.decode(DecodedInstruction.java:72)
at jadx.core.dex.instructions.InsnDecoder.decodeInsns(InsnDecoder.java:43)
... 8 more
*/
/*
// Can't load method instructions.
*/
throw new UnsupportedOperationException("Method not decompiled: java.util.concurrent.ThreadLocalRandom.<clinit>():void");
}
private static long mix64(long z) {
z = ((z >>> 33) ^ z) * -49064778989728563L;
z = ((z >>> 33) ^ z) * -4265267296055464877L;
return (z >>> 33) ^ z;
}
private static int mix32(long z) {
z = ((z >>> 33) ^ z) * -49064778989728563L;
return (int) ((((z >>> 33) ^ z) * -4265267296055464877L) >>> 32);
}
private ThreadLocalRandom() {
this.initialized = true;
}
static final void localInit() {
int p = probeGenerator.addAndGet(PROBE_INCREMENT);
int probe = p == 0 ? 1 : p;
long seed = mix64(seeder.getAndAdd(SEEDER_INCREMENT));
Thread t = Thread.currentThread();
U.putLong(t, SEED, seed);
U.putInt(t, PROBE, probe);
}
public static ThreadLocalRandom current() {
if (U.getInt(Thread.currentThread(), PROBE) == 0) {
localInit();
}
return instance;
}
public void setSeed(long seed) {
if (this.initialized) {
throw new UnsupportedOperationException();
}
}
final long nextSeed() {
Unsafe unsafe = U;
Thread t = Thread.currentThread();
long r = U.getLong(t, SEED) + GAMMA;
unsafe.putLong(t, SEED, r);
return r;
}
protected int next(int bits) {
return (int) (mix64(nextSeed()) >>> (64 - bits));
}
final long internalNextLong(long origin, long bound) {
long r = mix64(nextSeed());
if (origin >= bound) {
return r;
}
long n = bound - origin;
long m = n - 1;
if ((n & m) == SEED) {
return (r & m) + origin;
}
if (n > SEED) {
long u = r >>> 1;
while (true) {
r = u % n;
if ((u + m) - r >= SEED) {
return r + origin;
}
u = mix64(nextSeed()) >>> 1;
}
} else {
while (true) {
if (r >= origin && r < bound) {
return r;
}
r = mix64(nextSeed());
}
}
}
final int internalNextInt(int origin, int bound) {
int r = mix32(nextSeed());
if (origin >= bound) {
return r;
}
int n = bound - origin;
int m = n - 1;
if ((n & m) == 0) {
return (r & m) + origin;
}
if (n > 0) {
int u = r >>> 1;
while (true) {
r = u % n;
if ((u + m) - r >= 0) {
return r + origin;
}
u = mix32(nextSeed()) >>> 1;
}
} else {
while (true) {
if (r >= origin && r < bound) {
return r;
}
r = mix32(nextSeed());
}
}
}
final double internalNextDouble(double origin, double bound) {
double r = ((double) (nextLong() >>> 11)) * DOUBLE_UNIT;
if (origin >= bound) {
return r;
}
r = ((bound - origin) * r) + origin;
if (r >= bound) {
return Double.longBitsToDouble(Double.doubleToLongBits(bound) - 1);
}
return r;
}
public int nextInt() {
return mix32(nextSeed());
}
public int nextInt(int bound) {
if (bound <= 0) {
throw new IllegalArgumentException(BAD_BOUND);
}
int r = mix32(nextSeed());
int m = bound - 1;
if ((bound & m) == 0) {
return r & m;
}
int u = r >>> 1;
while (true) {
r = u % bound;
if ((u + m) - r >= 0) {
return r;
}
u = mix32(nextSeed()) >>> 1;
}
}
public int nextInt(int origin, int bound) {
if (origin < bound) {
return internalNextInt(origin, bound);
}
throw new IllegalArgumentException(BAD_RANGE);
}
public long nextLong() {
return mix64(nextSeed());
}
public long nextLong(long bound) {
if (bound <= SEED) {
throw new IllegalArgumentException(BAD_BOUND);
}
long r = mix64(nextSeed());
long m = bound - 1;
if ((bound & m) == SEED) {
return r & m;
}
long u = r >>> 1;
while (true) {
r = u % bound;
if ((u + m) - r >= SEED) {
return r;
}
u = mix64(nextSeed()) >>> 1;
}
}
public long nextLong(long origin, long bound) {
if (origin < bound) {
return internalNextLong(origin, bound);
}
throw new IllegalArgumentException(BAD_RANGE);
}
public double nextDouble() {
return ((double) (mix64(nextSeed()) >>> 11)) * DOUBLE_UNIT;
}
public double nextDouble(double bound) {
if ((bound > 0.0d ? 1 : null) == null) {
throw new IllegalArgumentException(BAD_BOUND);
}
double result = (((double) (mix64(nextSeed()) >>> 11)) * DOUBLE_UNIT) * bound;
if (result < bound) {
return result;
}
return Double.longBitsToDouble(Double.doubleToLongBits(bound) - 1);
}
public double nextDouble(double origin, double bound) {
if ((origin < bound ? 1 : null) != null) {
return internalNextDouble(origin, bound);
}
throw new IllegalArgumentException(BAD_RANGE);
}
public boolean nextBoolean() {
return mix32(nextSeed()) < 0;
}
public float nextFloat() {
return ((float) (mix32(nextSeed()) >>> 8)) * FLOAT_UNIT;
}
public double nextGaussian() {
Double d = (Double) nextLocalGaussian.get();
if (d != null) {
nextLocalGaussian.set(null);
return d.doubleValue();
}
while (true) {
double v1 = (nextDouble() * 2.0d) - 1.0d;
double v2 = (nextDouble() * 2.0d) - 1.0d;
double s = (v1 * v1) + (v2 * v2);
if (s < 1.0d && s != 0.0d) {
double multiplier = StrictMath.sqrt((StrictMath.log(s) * -2.0d) / s);
nextLocalGaussian.set(new Double(v2 * multiplier));
return v1 * multiplier;
}
}
}
public IntStream ints(long streamSize) {
if (streamSize >= SEED) {
return StreamSupport.intStream(new RandomIntsSpliterator(SEED, streamSize, AnnualTimeZoneRule.MAX_YEAR, 0), false);
}
throw new IllegalArgumentException(BAD_SIZE);
}
public IntStream ints() {
return StreamSupport.intStream(new RandomIntsSpliterator(SEED, Long.MAX_VALUE, AnnualTimeZoneRule.MAX_YEAR, 0), false);
}
public IntStream ints(long streamSize, int randomNumberOrigin, int randomNumberBound) {
if (streamSize < SEED) {
throw new IllegalArgumentException(BAD_SIZE);
} else if (randomNumberOrigin < randomNumberBound) {
return StreamSupport.intStream(new RandomIntsSpliterator(SEED, streamSize, randomNumberOrigin, randomNumberBound), false);
} else {
throw new IllegalArgumentException(BAD_RANGE);
}
}
public IntStream ints(int randomNumberOrigin, int randomNumberBound) {
if (randomNumberOrigin < randomNumberBound) {
return StreamSupport.intStream(new RandomIntsSpliterator(SEED, Long.MAX_VALUE, randomNumberOrigin, randomNumberBound), false);
}
throw new IllegalArgumentException(BAD_RANGE);
}
public LongStream longs(long streamSize) {
if (streamSize >= SEED) {
return StreamSupport.longStream(new RandomLongsSpliterator(SEED, streamSize, Long.MAX_VALUE, SEED), false);
}
throw new IllegalArgumentException(BAD_SIZE);
}
public LongStream longs() {
return StreamSupport.longStream(new RandomLongsSpliterator(SEED, Long.MAX_VALUE, Long.MAX_VALUE, SEED), false);
}
public LongStream longs(long streamSize, long randomNumberOrigin, long randomNumberBound) {
if (streamSize < SEED) {
throw new IllegalArgumentException(BAD_SIZE);
} else if (randomNumberOrigin < randomNumberBound) {
return StreamSupport.longStream(new RandomLongsSpliterator(SEED, streamSize, randomNumberOrigin, randomNumberBound), false);
} else {
throw new IllegalArgumentException(BAD_RANGE);
}
}
public LongStream longs(long randomNumberOrigin, long randomNumberBound) {
if (randomNumberOrigin < randomNumberBound) {
return StreamSupport.longStream(new RandomLongsSpliterator(SEED, Long.MAX_VALUE, randomNumberOrigin, randomNumberBound), false);
}
throw new IllegalArgumentException(BAD_RANGE);
}
public DoubleStream doubles(long streamSize) {
if (streamSize >= SEED) {
return StreamSupport.doubleStream(new RandomDoublesSpliterator(SEED, streamSize, Double.MAX_VALUE, 0.0d), false);
}
throw new IllegalArgumentException(BAD_SIZE);
}
public DoubleStream doubles() {
return StreamSupport.doubleStream(new RandomDoublesSpliterator(SEED, Long.MAX_VALUE, Double.MAX_VALUE, 0.0d), false);
}
public DoubleStream doubles(long streamSize, double randomNumberOrigin, double randomNumberBound) {
if (streamSize < SEED) {
throw new IllegalArgumentException(BAD_SIZE);
}
if ((randomNumberOrigin < randomNumberBound ? 1 : null) != null) {
return StreamSupport.doubleStream(new RandomDoublesSpliterator(SEED, streamSize, randomNumberOrigin, randomNumberBound), false);
}
throw new IllegalArgumentException(BAD_RANGE);
}
public DoubleStream doubles(double randomNumberOrigin, double randomNumberBound) {
boolean z;
if (randomNumberOrigin < randomNumberBound) {
z = true;
} else {
z = false;
}
if (z) {
return StreamSupport.doubleStream(new RandomDoublesSpliterator(SEED, Long.MAX_VALUE, randomNumberOrigin, randomNumberBound), false);
}
throw new IllegalArgumentException(BAD_RANGE);
}
static final int getProbe() {
return U.getInt(Thread.currentThread(), PROBE);
}
static final int advanceProbe(int probe) {
probe ^= probe << 13;
probe ^= probe >>> 17;
probe ^= probe << 5;
U.putInt(Thread.currentThread(), PROBE, probe);
return probe;
}
static final int nextSecondarySeed() {
Thread t = Thread.currentThread();
int r = U.getInt(t, SECONDARY);
if (r != 0) {
r ^= r << 13;
r ^= r >>> 17;
r ^= r << 5;
} else {
r = mix32(seeder.getAndAdd(SEEDER_INCREMENT));
if (r == 0) {
r = 1;
}
}
U.putInt(t, SECONDARY, r);
return r;
}
private void writeObject(ObjectOutputStream s) throws IOException {
PutField fields = s.putFields();
fields.put("rnd", U.getLong(Thread.currentThread(), SEED));
fields.put("initialized", true);
s.writeFields();
}
private Object readResolve() {
return current();
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
12e127382f0109e946f0af71914f9c9fc51448cd | 30db2dded7529ab68aa4203df4ed1812a068d2cc | /src/ui/Scores.java | b9042078f80a223631b05b29cfd694847420e185 | [] | no_license | matiasimc/zatacka-distribuido | 589540a32688f1e187070315c851252bac2efd1a | 97c611ec41e2e69d34df916d0ba6e6fef90f0597 | refs/heads/master | 2021-03-19T14:31:02.842605 | 2016-11-17T08:43:37 | 2016-11-17T08:43:37 | 72,035,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,727 | java | package ui;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.rmi.RemoteException;
import java.util.ArrayList;
import client.ClientGame;
import game.iPlayer;
public class Scores extends Canvas {
public int height;
public final int width = 200;
private ClientGame cGame;
private Image img;
private Graphics buffer;
public Scores(int height, ClientGame cGame) {
this.height = height;
this.cGame = cGame;
this.setSize(width, height);
}
public void update(Graphics graphics) {
paint(graphics);
}
public void paint(Graphics graphics) {
this.img = createImage(this.width, this.height);
this.buffer = this.img.getGraphics();
this.buffer.setColor(Color.black);
this.buffer.fillRect(0, 0, this.width, this.height);
// dibujar elementos del juego
try {
showScores(this.cGame.gamePlayers());
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
graphics.drawImage(img, 0, 0, null);
}
private void showScores(ArrayList<iPlayer> players) throws RemoteException{
if (this.buffer == null) this.buffer = this.img.getGraphics();
buffer.setColor(Color.WHITE);
buffer.setFont(new Font("Impact", Font.PLAIN, 20));
buffer.drawString("Puntajes:" , 10 , 100);
int offset = 50;
for (iPlayer p: players){
String toDraw = "Player "+p.getId();
if (cGame.player.getId() == p.getId()) toDraw = toDraw+" (you)";
toDraw = toDraw + ": "+p.getScore();
buffer.setColor(p.getColor());
buffer.drawString(toDraw, 10, 100+offset);
offset += 50;
}
buffer.setColor(Color.WHITE);
}
}
| [
"matias.imc@gmail.com"
] | matias.imc@gmail.com |
8cb0fee5acb5407e50edeff7e7f65ebd21b44a96 | 3455150c84123764f2cce90972da74d0eec01293 | /Blood_BankManagementSystem/src/test/java/com/app/ApplicationTests.java | 979ff3c597a9ffc131788d673900d717d3bd9120 | [] | no_license | eewsagar/RestFullService | ad1eebd222679e7782efd450404d09b5c689169f | 0df85e16c2ad154908dcbfd08f1d5ff5205ce01c | refs/heads/main | 2023-04-12T09:27:51.002375 | 2021-04-14T12:36:27 | 2021-04-14T12:36:27 | 347,958,578 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.app;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import com.app.Controller.HomePageController;
@SpringBootTest
class ApplicationTests {
@Autowired
private HomePageController controller;
@Test
void contextLoads() {
System.out.println("in test");
assertNotNull(controller);
}
}
| [
"eew.sagar@gmail.com"
] | eew.sagar@gmail.com |
79f210802977cdd1f17a6e9ece141fe228d787bf | 0f4e421c9f7ae69c4a604555cce41573aaa3934f | /week05/1.Monday/problem02/VATTaxCalculator.java | 659dafead85162adb868a4ab16a0cf0dc064ffc3 | [] | no_license | hristokirilov7/Programming101-Java | f24f8e218489a982bba3dec09a54b6e309bc7d51 | 0a5e88d0d5c5e6ab85fcb6c1f15d707c148379e0 | refs/heads/master | 2021-01-10T10:07:31.499068 | 2016-01-18T18:51:09 | 2016-01-18T18:51:09 | 46,992,838 | 0 | 1 | null | 2016-01-18T18:51:09 | 2015-11-27T17:45:01 | Java | UTF-8 | Java | false | false | 972 | java | package problem02;
import java.io.FileNotFoundException;
import java.util.HashMap;
public class VATTaxCalculator {
private HashMap<Integer,CountryVatTax> VATTaxes;
private CountryVatTax defaultVATTax;
public VATTaxCalculator(HashMap<Integer,CountryVatTax> VATTaxes, CountryVatTax defaultVATTax) {
this.VATTaxes = new HashMap<>();
this.VATTaxes.putAll(VATTaxes);
defaultVATTax = new CountryVatTax(defaultVATTax);
}
public VATTaxCalculator(HashMap<Integer,CountryVatTax> VATTaxes) {
this (VATTaxes, null);
}
public Double CalculateTax(double price, int countryId) throws FileNotFoundException {
if (VATTaxes.containsKey(countryId))
{
return price * VATTaxes.get(countryId).getVATTax();
}
return CalculateTax(price);
}
public Double CalculateTax(double price) throws FileNotFoundException {
if (defaultVATTax != null)
{
return price * defaultVATTax.getVATTax();
}
throw new FileNotFoundException("Not supported country.");
}
}
| [
"hristokirilov7@gmail.com"
] | hristokirilov7@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.