blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
f511eb7b3e4a99a1714cf8477565d06a6d3e4c27
5b9d5d66719352cabdd86dbdd73fe072ddb94ec7
/src/main/java/com/wangxhu/yixiaoyuan/dao/IOrdersDao.java
43812c953dcf12b43bf081ef68fe7296d55f9cea
[]
no_license
StormWangxhu/yixiaoyuan
925481e06798104a7c894bb14f58e6aeea55a79a
2a999e3d80c26c3ecd6e1f80b854fd922a9ae945
refs/heads/master
2020-05-16T11:43:43.093805
2019-04-30T06:56:28
2019-04-30T06:56:28
183,023,595
1
0
null
null
null
null
UTF-8
Java
false
false
965
java
package com.wangxhu.yixiaoyuan.dao; import com.wangxhu.yixiaoyuan.model.Orders; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; /** * @Author: StormWangxhu * @Time: 2019-04-29 13:36 * @Email: StormWangxhu@163.com * @Description: */ @Repository @Mapper public interface IOrdersDao { /** * 获取我的订单 * * @param uid * @return */ List<Orders> getMyOrders(@Param("uid") Integer uid); /** * 保存我的订单 * * @param orders */ void save(@Param("orders") Orders orders); /** * 查询订单 * * @param gid * @param uid * @return */ Orders queryOrders(@Param("gid") Integer gid, @Param("uid") Integer uid); /** * 更新订单状态 * * @param orders */ void updateStatus(@Param("orders") Orders orders); }
[ "StormWangxhu@163.com" ]
StormWangxhu@163.com
5dc45638fba400faf5f179fbdd1b9af035bc55b8
cd3f12fbb0f8d92d6165d128432cd5e1818cd65c
/app/src/androidTest/java/com/ust/sam/sphinx/ApplicationTest.java
283e787cfde8c9e984e0e9c728fa6442fe92a6a3
[]
no_license
MultimediaProjectGroup/Sphinx
316986172fd6b4f2a8fe98e753e79b56893b114b
196c8a35071a08f8aa596cfebed32a4dd163f539
refs/heads/master
2016-08-12T16:36:49.369039
2015-11-21T08:43:20
2015-11-21T08:43:20
46,070,501
0
0
null
null
null
null
UTF-8
Java
false
false
349
java
package com.ust.sam.sphinx; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "wangzhenyu1260@126.com" ]
wangzhenyu1260@126.com
e15ddc51b8d4b9c6a0df9dfe56d3a2bfee52dd8c
ab0e0ca4b5add88083d73ce0b0fc6feeb0d2a947
/src/Ligacao.java
853643aa7f8b051385dd002d93515660b204d117
[]
no_license
uniceub-ltp1-201702/prova-p1-ltp1-201702-arminrjr
8f0e7d87bb79160e70eed9a38b2e938bc3afbf6c
1d997b4c676febb4bc4b10f680c0fe39756c8893
refs/heads/master
2021-07-05T00:38:56.289792
2017-09-30T00:34:46
2017-09-30T00:34:46
105,322,776
0
0
null
null
null
null
UTF-8
Java
false
false
1,502
java
import java.time.LocalDateTime; public class Ligacao { //Atributos private int codigo; private String numeroD; private LocalDateTime linicio; private LocalDateTime lfinal; private String cidadeD; private String ufD; private Cliente cliente; public Ligacao(int codigo, String numeroD, LocalDateTime linicio, LocalDateTime lfinal, String cidadeD, String ufD, Cliente cliente) { super(); this.codigo = codigo; this.numeroD = numeroD; this.linicio = linicio; this.lfinal = lfinal; this.cidadeD = cidadeD; this.ufD = ufD; this.cliente = cliente; } public int getCodigo() { return codigo; } public void setCodigo(int codigo) { this.codigo = codigo; } public String getNumeroD() { return numeroD; } public void setNumeroD(String numeroD) { this.numeroD = numeroD; } public LocalDateTime getLinicio() { return linicio; } public void setLinicio(LocalDateTime linicio) { this.linicio = linicio; } public LocalDateTime getLfinal() { return lfinal; } public void setLfinal(LocalDateTime lfinal) { this.lfinal = lfinal; } public String getCidadeD() { return cidadeD; } public void setCidadeD(String cidadeD) { this.cidadeD = cidadeD; } public String getUfD() { return ufD; } public void setUfD(String ufD) { this.ufD = ufD; } public Cliente getCliente() { return cliente; } public void setCliente(Cliente cliente) { this.cliente = cliente; } }
[ "ra21386371@AN0700103077354.dinfor.uniceub" ]
ra21386371@AN0700103077354.dinfor.uniceub
489a15cc3708b49b4db01697929a3f77e3d73cdc
03e85786660885e3089a0c7c09e34c31c7f60d73
/app/src/main/java/jm/com/collection/socket/SocketConfig.java
b97099ce51adf2e5f8777f1ba560eed617be6fdd
[]
no_license
ashijiaming/JMCollectionApp
1685dbe6700f0fd41eea38ea962a96d40b177f09
bfe81a8346261a7d41bd8dc044066b7e98aed9f0
refs/heads/master
2021-06-28T08:42:03.382433
2020-01-03T04:28:05
2020-01-03T04:28:05
142,260,030
1
0
null
null
null
null
UTF-8
Java
false
false
227
java
package jm.com.collection.socket; public class SocketConfig { public static final String SOCKET_URL="ws://172.18.11.10:8886"; public static final String ACCOUNT="123"; public static final String PASSWORD="123"; }
[ "1019814623@qq.com" ]
1019814623@qq.com
7b3bd86f22c68f229e423ac03f5d61876da0ff1f
95c1ef3fabb66ade3d54a64c3cd5214a6ffcdf6f
/src/main/java/com/julopes/accessibleway/controller/UserController.java
14d7f0fadbfb19170ae191afcfa8c24c96f33c1c
[]
no_license
juliano-lopes/accessible-way
5d8238b8798ce5d4f89afb236a7ef5eb11972c1a
7d64baffa4f3452dc923ab3177d7bf070928cf5b
refs/heads/master
2020-04-12T21:46:32.972392
2018-12-31T17:21:15
2018-12-31T17:21:15
162,771,685
0
0
null
null
null
null
UTF-8
Java
false
false
4,654
java
package com.julopes.accessibleway.controller; import java.util.ArrayList; import java.util.List; import java.util.Optional; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.julopes.accessibleway.domain.Telephone; import com.julopes.accessibleway.domain.TelephoneType; import com.julopes.accessibleway.domain.User; import com.julopes.accessibleway.repository.TelephoneRepository; import com.julopes.accessibleway.repository.UserRepository; @Controller public class UserController { private UserRepository uRepo; private TelephoneRepository tRepo; @Autowired public UserController(UserRepository uRepo, TelephoneRepository tRepo) { this.uRepo = uRepo; this.tRepo = tRepo; } @RequestMapping(value = "/signup", method = RequestMethod.GET) public ModelAndView signupUser() { return new ModelAndView("/signup/signupUser").addObject("user", new User()); } @RequestMapping(value = "/save", method = RequestMethod.POST) public ModelAndView saveUser(@Valid User user, BindingResult bResult) { ModelAndView mv = new ModelAndView("/signup/signupUser"); List<String> msgErrors = new ArrayList<String>(); if (bResult.hasErrors()) { for (ObjectError error : bResult.getAllErrors()) { msgErrors.add(error.getDefaultMessage()); } } else { uRepo.save(user); } mv.addObject("user", user); mv.addObject("msgErrors", msgErrors); return mv; } @RequestMapping(value = "listUser", method = RequestMethod.GET) public ModelAndView listUser() { ModelAndView mv = new ModelAndView("listUser"); mv.addObject("users", uRepo.findAll()); return mv; } @RequestMapping(value = "/edite/{id}", method = RequestMethod.GET) public ModelAndView edite(@PathVariable("id") long id) { Optional<User> opUser = uRepo.findById(id); return new ModelAndView("/signup/signupUser").addObject("user", opUser.get()); } @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET) public String delete(@PathVariable("id") long id) { try { uRepo.delete(uRepo.findById(id).get()); return "redirect:/listUser"; } catch (Exception e) { return "redirect:/home"; } } @PostMapping("/search") @Query("select u from user u where u.name like %?1%") public ModelAndView searchUserByName(@RequestParam("nameUser") String nameUser) { return new ModelAndView("listUser").addObject("users", uRepo.findByName(nameUser)); } @GetMapping("/detail/{id}") public ModelAndView detail(@PathVariable("id") long id) { ModelAndView mv = new ModelAndView("userDetails"); mv.addObject("user", uRepo.findById(id).get()); mv.addObject("telephones", tRepo.findTelephoneByUserId(id)); mv.addObject("types", TelephoneType.values()); mv.addObject("tel", new Telephone()); return mv; } @PostMapping("/saveTelephone/{userId}") public ModelAndView saveNewTelephoneNumber(@PathVariable("userId") long userId, @Valid Telephone tel, BindingResult bResult) { ModelAndView mv = new ModelAndView("userDetails"); List<String> msgErrors = new ArrayList<String>(); if (bResult.hasErrors()) { for (ObjectError error : bResult.getAllErrors()) { msgErrors.add(error.getDefaultMessage()); } } else { tel.setUser(uRepo.findById(userId).get()); tRepo.save(tel); } mv.addObject("user", uRepo.findById(userId).get()); mv.addObject("telephones", tRepo.findTelephoneByUserId(userId)); mv.addObject("types", TelephoneType.values()); mv.addObject("tel", new Telephone()); mv.addObject("msgErrors", msgErrors); return mv; } @GetMapping("/deleteTelephone/{telephoneId}") public String deleteTelephone(@PathVariable("telephoneId") long telephoneId) { try { Telephone tel = tRepo.findById(telephoneId).get(); long userId = tel.getUser().getId(); tRepo.delete(tel); return "redirect:/detail/" + userId; } catch (Exception e) { return "redirect:/home"; } } }
[ "julopys@hotmail.com" ]
julopys@hotmail.com
2ae49f264eae3c2f4a95fe1fd6db20f610600e7b
3441de0b93c9bc4dc40e1a46abd7d36cafe51c2d
/passcloud-common/passcloud-common-core/src/main/java/com/passcloud/common/core/interceptor/CoreHttpRequestInterceptor.java
2496a0dd521008c44458946d51a1e3d777e5ca10
[]
no_license
XinxiJiang/passcloud-master
23baeb1c4360432585c07e49e7e2366dc2955398
212c2d7c2c173a788445c21de4775c4792a11242
refs/heads/master
2023-04-11T21:31:27.208057
2018-12-11T04:42:18
2018-12-11T04:44:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,427
java
package com.passcloud.common.core.interceptor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.support.HttpRequestWrapper; import org.springframework.util.StringUtils; import java.io.IOException; /** * The class Core http request interceptor. * * @author liyuzhang */ @Slf4j public class CoreHttpRequestInterceptor implements ClientHttpRequestInterceptor { /** * Intercept client http response. * * @param request the request * @param body the body * @param execution the execution * * @return the client http response * * @throws IOException the io exception */ @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { HttpRequestWrapper requestWrapper = new HttpRequestWrapper(request); String header = StringUtils.collectionToDelimitedString( CoreHeaderInterceptor.LABEL.get(), CoreHeaderInterceptor.HEADER_LABEL_SPLIT); log.info("header={} ", header); requestWrapper.getHeaders().add(CoreHeaderInterceptor.HEADER_LABEL, header); return execution.execute(requestWrapper, body); } }
[ "35205889+mliyz@users.noreply.github.com" ]
35205889+mliyz@users.noreply.github.com
48b951047497b1f2982edaca027f473df0028cb5
5340d192f331826a097c9d086b1a97b07f85781c
/src/com/ready2wear/views/AddItems.java
27a2f5dc22d62f6e44b38da156b445f5e3de6da5
[]
no_license
hilamark/ready2wear
86217afcdfe3987f5c0aec66bbc725a358ddef9b
b2b0989c0b9234870319b2567ea16802edf03a14
refs/heads/master
2021-01-23T09:53:28.561271
2015-08-11T15:58:30
2015-08-11T15:58:30
40,059,243
0
0
null
null
null
null
UTF-8
Java
false
false
10,791
java
package com.ready2wear.views; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import com.example.hellofacebook.R; import com.parse.ParseException; import com.parse.ParseFile; import com.parse.ParseObject; import com.parse.SaveCallback; import com.ready2wear.domain.Item; import com.ready2wear.domain.SessionData; import com.ready2wear.management.ItemsManagment; import com.ready2wear.utils.BitmapWorkerTask; import com.ready2wear.utils.DownloadImageTask; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.support.v4.app.FragmentActivity; import android.support.v4.widget.DrawerLayout; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.GridView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; public class AddItems extends FragmentActivity { public static final String ANDROID_RESOURCE = "android.resource://"; public static final String FORESLASH = "/"; private static int PICK_IMAGE_REQUEST = 1; private static final int CAMERA_REQUEST = 0; public static final String TAG = "AddItems"; private Button mCancel; private Button mDone; private GridView mGridView; private List<String> myItemsUrl = new ArrayList<String>(); private List<Bitmap> myItemsBitmap = new ArrayList<Bitmap>(); //private CustomList mAdapter; private CustomBitmapList mAdapter; private AddItemFragment mFragment; private Bitmap mLastAddedBitmap; private List<Bitmap> bitmaps = new ArrayList<Bitmap>(); private DrawerList myDrawers; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_items); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); /* DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ListView mDrawerList = (ListView) findViewById(R.id.left_drawer); myDrawers = new DrawerList(getResources(), mDrawerLayout, mDrawerList, AddItems.this, getFragmentManager(), false, this, getActionBar()); */ myDrawers = new DrawerList(getActionBar()); myDrawers.updateBaR(); // enable ActionBar app icon to behave as action to toggle nav drawer getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); mFragment = (AddItemFragment)getSupportFragmentManager().findFragmentById(R.id.addItem_edit); mCancel = (Button) findViewById(R.id.itemCancelButton); mCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { onCancelButtonClicked(); } }); mGridView = (GridView) findViewById(R.id.addItems); myItemsBitmap.add(BitmapFactory.decodeResource(getResources(), R.drawable.plus_sign)); //myItemsUrl.add("https://dov5cor25da49.cloudfront.net/products/2604/195x300shirt_guys_01.jpg"); //myItemsUrl.add("http://www.vectors4all.net/preview/plus-sign-clip-art.jpg"); //mAdapter = new CustomList(AddItems.this, (ArrayList<String>) myItemsUrl); mAdapter = new CustomBitmapList(AddItems.this, (ArrayList<Bitmap>) myItemsBitmap); mGridView.setAdapter(mAdapter); selectImage(); } private void onCancelButtonClicked() { Log.v(TAG, "Cancel button clicked"); setResult(RESULT_OK, null); finish(); } private void selectImagee() { final CharSequence[] items = { "Take Photo", "Choose from Library", "Cancel" }; AlertDialog.Builder builder = new AlertDialog.Builder(AddItems.this); builder.setTitle("Add Photo!"); builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (items[item].equals("Take Photo")) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, CAMERA_REQUEST); } else if (items[item].equals("Choose from Library")) { Intent intent = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); startActivityForResult( Intent.createChooser(intent, "Select File"), PICK_IMAGE_REQUEST); } else if (items[item].equals("Cancel")) { dialog.dismiss(); } } }); builder.show(); } private void selectImage() { selectImagee(); /* Intent intent = new Intent(); // Show only images, no videos or anything else intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); // Always show the chooser (if there are multiple options available) startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST); */ } public void refreshView(){ // if (mLastAddedBitmap == null) // return; Bitmap plus = myItemsBitmap.get(myItemsBitmap.size() - 1); myItemsBitmap.remove(myItemsBitmap.size() - 1); myItemsBitmap.add(mLastAddedBitmap); myItemsBitmap.add(plus); mAdapter.notifyDataSetChanged(); mGridView.setAdapter(mAdapter); /* InputStream in = null; try { in = new java.net.URL(myItemsUrl.get(myItemsUrl.size() - 1)).openStream(); Bitmap mIcon11 = BitmapFactory.decodeStream(in); //fragmentImage.setImageBitmap(mIcon11); mFragment = (AddItemFragment)getSupportFragmentManager().findFragmentById(R.id.addItem_edit); mFragment.updateView(mIcon11); } catch (Exception e) { } */ } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (!(resultCode == RESULT_OK)) return; if (requestCode == CAMERA_REQUEST) { mLastAddedBitmap = (Bitmap) data.getExtras().get("data"); bitmaps.add(mLastAddedBitmap); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); // mLastAddedBitmap.compress(Bitmap.CompressFormat.JPEG, 90, bytes); File destination = new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + ".jpg"); FileOutputStream fo; try { destination.createNewFile(); fo = new FileOutputStream(destination); fo.write(bytes.toByteArray()); fo.close(); } catch (Exception e) { e.printStackTrace(); } // Update image in fragment // mFragment = (AddItemFragment)getSupportFragmentManager().findFragmentById(R.id.addItem_edit); // mFragment.updateView(mLastAddedBitmap); // mFragment.updateVisibility(); } else if (requestCode == PICK_IMAGE_REQUEST && data != null && data.getData() != null) { Uri itemPicUri = data.getData(); try { //refreshView(); // Translate to bitmap Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), itemPicUri); mLastAddedBitmap = Bitmap.createScaledBitmap(bitmap, 120, 120, false); bitmaps.add(Bitmap.createScaledBitmap(bitmap, 750, 900, false)); // Update image in fragment // mFragment = (AddItemFragment)getSupportFragmentManager().findFragmentById(R.id.addItem_edit); // mFragment.updateView(bitmap); // mFragment.updateVisibility(); // Save to parse in the background // BitmapWorkerTask task = new BitmapWorkerTask(myItemsUrl, bitmap, AddItems.this); // task.execute(); } catch (IOException e) { e.printStackTrace(); } } refreshView(); mFragment.updateVisibility(); } public void saveItem(Item newItem){ // Add images to item newItem.setImages(bitmaps); // Add item to user SessionData.getInstance().getCurrentUser().addItem(newItem); // Save item to parse //ItemsManagment.saveItem(newItem); // Done Log.v(TAG, "items saved"); setResult(RESULT_OK, null); finish(); } public class CustomList extends ArrayAdapter<String>{ private Activity mContext; public CustomList(Activity context, ArrayList<String> imagesURL) { super(context, 0, imagesURL); mContext = context; } @Override public View getView(int position, View view, ViewGroup parent) { ImageView imageView; if (view == null) { imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(95, 95)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) view; } new DownloadImageTask(imageView).execute(myItemsUrl.get(position)); return imageView; } } public class CustomBitmapList extends ArrayAdapter<Bitmap>{ private Activity mContext; private List<Bitmap> mBitmaps; public CustomBitmapList(Activity context, ArrayList<Bitmap> images) { super(context, 0, images); mContext = context; mBitmaps = images; } @Override public View getView(int position, View view, ViewGroup parent) { ImageView imageView; if (view == null) { imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(150, 150)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) view; } imageView.setImageBitmap(mBitmaps.get(position)); // Check if last item (add item image) if (position == mBitmaps.size() - 1){ imageView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { selectImage(); } }); } return imageView; } } }
[ "hilaaa@hotmail.com" ]
hilaaa@hotmail.com
4a5d4dc210500c2d078779d3bcb38a30b93ecd4f
0d35ed03c9a42e33bd240523c4336750c140300c
/codeChallenge07/src/main/java/codeChallenge05/App.java
92e7459d4649df4874ccf4ae6793710f2b816b85
[]
no_license
ibrahim-alhamshari/data-structures-and-algorithms02
c15b2e0dd7947ff69e1dc3f2dccf14ac3ea96f8d
2e6eb755040811199016678094142d44c9c3d584
refs/heads/main
2023-08-22T21:51:35.013937
2021-10-25T21:26:33
2021-10-25T21:26:33
389,439,811
0
3
null
2021-10-10T16:03:33
2021-07-25T20:58:30
Java
UTF-8
Java
false
false
1,284
java
/* * This Java source file was generated by the Gradle 'init' task. */ package codeChallenge05; import java.awt.*; import java.util.ArrayList; import java.util.Arrays; public class App { public String getGreeting() { return "Hello world."; } public static void main(String[] args) throws Exception { System.out.println(new App().getGreeting()); LinkedList list = new LinkedList(); list.append(9); list.append(7); list.append(8); list.append(21); list.includes(8); list.append(4); list.append(100); list.insert(1); list.insert(1); list.insertBefore(7, 14); list.insertAfterValue(7,31); list.kthFromEnd(10); System.out.println(list.tostring()); list.delete(list.head.next.next.next.value); System.out.println(list.tostring()); //******************************************************************************************* LinkedList list1 =new LinkedList(); list1.append(2); list1.append(5); list1.append(8); LinkedList list2=new LinkedList(); list2.append(10); list2.append(20); list2.append(30); // LinkedList.zip_lists(list1,list2); } }
[ "ibrahimalhamshari742@gmail.com" ]
ibrahimalhamshari742@gmail.com
b1ed481af25c2b7447a9b6a24e7d488a333feb5f
459cbbff16d29dbc15d7482bd20f276f415bab30
/Sesion1/app/src/main/java/com/example/app1/MainActivity2.java
eafff8b0a608db55d7ed4f5ece317a6e85a3b9df
[]
no_license
seraf7/TallerAndroid
d6189dd1ba04bb07d7f16b2668def3e2f257f938
8201ed5e3dcea3bedc46391603589b6e18e0c692
refs/heads/main
2023-03-03T17:37:53.746909
2021-02-08T03:37:27
2021-02-08T03:37:27
310,796,135
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package com.example.app1; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Button; public class MainActivity2 extends AppCompatActivity implements View.OnClickListener{ TextView tvSaludo; Button btnSaludar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); tvSaludo = findViewById(R.id.tvSaludo); btnSaludar = findViewById(R.id.btnSaludo); tvSaludo.setOnClickListener(this); btnSaludar.setOnClickListener(this); } @Override public void onClick(View view) { switch(view.getId()){ case R.id.tvSaludo: tvSaludo.setText("Hola Mundo"); break; case R.id.btnSaludo: tvSaludo.setText("Hola Sera"); break; default: break; } } }
[ "zaske_4@hotmail.com" ]
zaske_4@hotmail.com
69eddbe1302998d9fc049a5959e2c54c3ab12e68
6c2234beab76da41a0228b3a14f06f24de3fa3d2
/src/AST/MainClass.java
6de7c65e3ff65e4c732744af6a7cf521dda67158
[]
no_license
lucaslima95/Compilador_Lucas_de_Souza_Lima
1024c617bb5ba179bfaa85f89bcd98a022b6f00b
ae3fbffd2bfa14c2476b2e83a5c7ba13beb66835
refs/heads/master
2021-08-22T23:36:08.370399
2017-12-01T17:49:33
2017-12-01T17:49:33
112,769,433
0
0
null
null
null
null
UTF-8
Java
false
false
753
java
package AST; import AST.ASTNode; import AST.Identifier; import AST.Statement; import AST.Visitor.SecVisitor; import AST.Visitor.Visitor; import Tables.Classes; import Tables.Methods; import java.util.Map; public class MainClass extends ASTNode { public Identifier i1; public Identifier i2; public Statement s; public MainClass(Identifier ai1, Identifier ai2, Statement as, int ln) { super(ln); this.i1 = ai1; this.i2 = ai2; this.s = as; } public void accept(Visitor v, Map mapa, int level, int nivel) { v.visit(this, mapa, level, nivel); } public void accept2(SecVisitor v, Map mapa, int nivel, Classes cl, Methods mt) { v.visit(this, mapa, nivel, cl, mt); } }
[ "lcssouzalima@gmail.com" ]
lcssouzalima@gmail.com
33bc21a33f9046bb29fe43a34a9a9d9b98f90aa4
a53dd0064788bf5189721c4a49947bfcad6798ca
/app/src/main/java/psi/tamu/controlyourbreath/orbotix/robot/widgets/NoSpheroConnectedView.java
9cdc142893f890d534e795ebdacc38002c281091
[]
no_license
rochoSC/BreathControl
fd2f0b2303afb002c4d12245357783ada54f52e9
7976ddfedde774b14d0a092e5deb2dd7f157aa3e
refs/heads/master
2020-05-19T09:30:29.752549
2019-02-21T18:10:41
2019-02-21T18:10:41
37,476,676
0
0
null
null
null
null
UTF-8
Java
false
false
3,206
java
package psi.tamu.controlyourbreath.orbotix.robot.widgets; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; import psi.tamu.controlyourbreath.R; public class NoSpheroConnectedView extends RelativeLayout { /** * Custom URL to for developer referral program */ private String mCustomURL = "http://store.gosphero.com"; /** * Connection or Setting Button */ private Button mConnectOrSettingsButton; /** * Notify the Activity of a click */ private OnConnectButtonClickListener mOnConnectButtonClickListener; public NoSpheroConnectedView(Context context, AttributeSet attrs) { super(context, attrs); setupView(context); } public NoSpheroConnectedView(Context context) { super(context); setupView(context); } /** * Call to set up the UI of the View * @param context passed from the constructor */ private void setupView(final Context context) { // Inflate the layout from XML LayoutInflater.from(context).inflate(R.layout.no_sphero_connected, this); // Set up button to open browser url Button getASpheroButton = (Button)this.findViewById(R.id.button_get_a_sphero); getASpheroButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Open the URL Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mCustomURL)); context.startActivity(browserIntent); } }); // Set up button to open browser url mConnectOrSettingsButton = (Button)this.findViewById(R.id.button_settings_or_connect); mConnectOrSettingsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Notify Activity the Connect Button was clicked if( mConnectOrSettingsButton.getText().equals("Connect") ) { if( mOnConnectButtonClickListener != null ) { mOnConnectButtonClickListener.onConnectClick(); } } else { if( mOnConnectButtonClickListener != null ) { mOnConnectButtonClickListener.onSettingsClick(); } } } }); } /** * Set the custom URL for developer referral program * @param url */ public void setCustomURL(String url) { mCustomURL = url; } /** * Getter for the customer URL * @return the current custom URL */ public String getCustomURL() { return mCustomURL; } /** * Switch to Settings button */ public void switchToSettingsButton() { mConnectOrSettingsButton.setText("Settings"); } /** * Switch to Settings button */ public void switchToConnectButton() { mConnectOrSettingsButton.setText("Connect"); } /** * Set the click listener * @param listener */ public void setOnConnectButtonClickListener(OnConnectButtonClickListener listener) { mOnConnectButtonClickListener = listener; } /** * A listener to be run when the connect button is clicked, so the activity can connect */ public interface OnConnectButtonClickListener { public void onConnectClick(); public void onSettingsClick(); } }
[ "roger.fesca@gmail.com" ]
roger.fesca@gmail.com
272c7da529898be7d224cd25b0bba9795c850b5d
e6871b601070669e22664485ad33ed289fab9629
/src/main/java/ch/pma/myapp/web/filter/CsrfCookieGeneratorFilter.java
523e68645bd95fe6b3b81702c4853c9aa33340f5
[]
no_license
pmyuser69/myapplication
3e008b8011f69f08155db2d317bffb111761357c
89148c184b2b449cdd68d26121f2e52a0babea24
refs/heads/master
2016-09-05T17:20:02.242642
2016-01-24T19:03:40
2016-01-24T19:03:40
42,522,424
0
0
null
null
null
null
UTF-8
Java
false
false
1,468
java
package ch.pma.myapp.web.filter; import org.springframework.security.web.csrf.CsrfToken; import org.springframework.web.filter.OncePerRequestFilter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Filter used to put the CSRF token generated by Spring Security in a cookie for use by AngularJS. */ public class CsrfCookieGeneratorFilter extends OncePerRequestFilter { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { // Spring put the CSRF token in session attribute "_csrf" CsrfToken csrfToken = (CsrfToken) request.getAttribute("_csrf"); // Send the cookie only if the token has changed String actualToken = request.getHeader("X-CSRF-TOKEN"); if (actualToken == null || !actualToken.equals(csrfToken.getToken())) { // Session cookie that will be used by AngularJS String pCookieName = "CSRF-TOKEN"; Cookie cookie = new Cookie(pCookieName, csrfToken.getToken()); cookie.setMaxAge(-1); cookie.setHttpOnly(false); cookie.setPath("/"); response.addCookie(cookie); } filterChain.doFilter(request, response); } }
[ "pmyuser69@yahoo.fr" ]
pmyuser69@yahoo.fr
d0b5b56b6bbe13c4ef0432205e52b50b1c8da5ad
fcf8139123133dec8cdd344d12e2dc778cd706fc
/src/com/avrgaming/civcraft/command/HereCommand.java
9f6f699efdfacab80b8296e30b2ef925952e1a2d
[]
no_license
YourCoal/phase3beta-check
ae689c17a0f5075b3b2e10eb2f8006b826b66135
470b858ded994cd6161dd51cc95c1629f087e503
refs/heads/master
2021-01-20T20:45:07.179785
2016-06-25T23:52:11
2016-06-25T23:52:11
61,965,954
0
0
null
null
null
null
UTF-8
Java
false
false
1,482
java
package com.civcraft.command; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.civcraft.main.CivGlobal; import com.civcraft.main.CivMessage; import com.civcraft.object.CultureChunk; import com.civcraft.object.TownChunk; import com.civcraft.util.ChunkCoord; import com.civcraft.util.CivColor; public class HereCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (sender instanceof Player) { Player player = (Player)sender; ChunkCoord coord = new ChunkCoord(player.getLocation()); CultureChunk cc = CivGlobal.getCultureChunk(coord); if (cc != null) { CivMessage.send(sender, CivColor.LightPurple+"You're currently inside the culture of Civ:"+ CivColor.Yellow+cc.getCiv().getName()+CivColor.LightPurple+" for town:"+CivColor.Yellow+cc.getTown().getName()); } TownChunk tc = CivGlobal.getTownChunk(coord); if (tc != null) { CivMessage.send(sender, CivColor.Green+"You're currently inside the town borders of "+CivColor.LightGreen+tc.getTown().getName()); if (tc.isOutpost()) { CivMessage.send(sender, CivColor.Yellow+"This chunk is an outpost."); } } if (cc == null && tc == null) { CivMessage.send(sender, CivColor.Yellow+"You stand in wilderness."); } } return false; } }
[ "yourcoal5446@gmail.com" ]
yourcoal5446@gmail.com
8c5e4f014f9cf0ec7388e955ec3e9bb2198fca01
097689cb15f57ed753422489c1129404769b863a
/SSH/SSH/JBOA/src/main/java/com/beerus/utils/Page.java
8a2007c21bcb374669bb4b3e8e00ccd593fc2487
[]
no_license
Beeru4/project
f247ae4a6669ba8b93965c0fa50d2cfe285e1918
cf12bce4d6d5750f8ff2f748182249724e287a76
refs/heads/master
2020-05-15T13:33:40.217444
2019-05-17T07:50:21
2019-05-17T07:50:21
182,304,194
0
0
null
null
null
null
UTF-8
Java
false
false
1,107
java
package com.beerus.utils; import java.util.List; /** * * @author J.z * 控制分页类 * @param <T> */ public class Page<T> { /** * 当前页码 */ private int currPageNo; /** * 总页数 */ private int totalPage; /** * 页数大小 */ private int pageSize; /** * 数据总行数 */ private int totalCount; /** * 数据集合 */ private List<T> pages; public int getCurrPageNo() { return currPageNo; } public void setCurrPageNo(int currPageNo) { this.currPageNo = currPageNo; } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public List<T> getPages() { return pages; } public void setPages(List<T> pages) { this.pages = pages; } }
[ "beeru4@163.com" ]
beeru4@163.com
9f6bc548eb65be6553fe8c4b20a6368637344a48
706594d2fb41d1d1725c3d38d6f2d756039478b9
/app/src/main/java/com/naver/maps/map/demo/java/overlay/InfoWindowActivity.java
7bcc57b9c809ed6eec01b53342cb7b8fbcb20658
[ "Apache-2.0" ]
permissive
wbh3110/android-map-sdk
6725329f5e98f9bb7e7d03b97ce0666d4c0c2a62
b2e3ea659143f4cbce09f1c112a05e6d5f891ec8
refs/heads/master
2023-02-03T05:10:59.363807
2020-12-18T07:47:10
2020-12-18T07:47:10
292,425,429
0
1
Apache-2.0
2020-12-18T07:47:11
2020-09-03T00:31:44
null
UTF-8
Java
false
false
4,198
java
/* * Copyright 2018-2020 NAVER Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.naver.maps.map.demo.java.overlay; import android.content.Context; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; import com.naver.maps.geometry.LatLng; import com.naver.maps.map.MapFragment; import com.naver.maps.map.NaverMap; import com.naver.maps.map.OnMapReadyCallback; import com.naver.maps.map.demo.R; import com.naver.maps.map.overlay.Align; import com.naver.maps.map.overlay.InfoWindow; import com.naver.maps.map.overlay.Marker; public class InfoWindowActivity extends AppCompatActivity implements OnMapReadyCallback { private static class InfoWindowAdapter extends InfoWindow.DefaultTextAdapter { private InfoWindowAdapter(@NonNull Context context) { super(context); } @NonNull @Override public CharSequence getText(@NonNull InfoWindow infoWindow) { if (infoWindow.getMarker() != null) { return getContext().getString(R.string.format_info_window_on_marker, infoWindow.getMarker().getTag()); } else { return getContext().getString(R.string.format_info_window_on_map, infoWindow.getPosition().latitude, infoWindow.getPosition().longitude); } } } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map_fragment); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); } MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); if (mapFragment == null) { mapFragment = MapFragment.newInstance(); getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); } mapFragment.getMapAsync(this); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); return true; } return super.onOptionsItemSelected(item); } @Override public void onMapReady(@NonNull NaverMap naverMap) { InfoWindow infoWindow = new InfoWindow(); infoWindow.setPosition(new LatLng(37.5666102, 126.9783881)); infoWindow.setAdapter(new InfoWindowAdapter(this)); infoWindow.setOnClickListener(overlay -> { infoWindow.close(); return true; }); infoWindow.open(naverMap); Marker marker1 = new Marker(); marker1.setPosition(new LatLng(37.57000, 126.97618)); marker1.setOnClickListener(overlay -> { infoWindow.open(marker1); return true; }); marker1.setTag("Marker 1"); marker1.setMap(naverMap); Marker marker2 = new Marker(); marker2.setPosition(new LatLng(37.56138, 126.97970)); marker2.setAngle(270f); marker2.setOnClickListener(overlay -> { infoWindow.open(marker2, Align.Left); return true; }); marker2.setTag("Marker 2"); marker2.setMap(naverMap); naverMap.setOnMapClickListener((point, coord) -> { infoWindow.setPosition(coord); infoWindow.open(naverMap); }); } }
[ "autoexec.bat@navercorp.com" ]
autoexec.bat@navercorp.com
8d72d2eec0e8e6b86ee8d99a56f425ea946dedeb
c956d2599f67aeaaf5f7bfa24dff23b6c0bd5081
/gws-fishjoy-biz/src/main/java/net/foreworld/fishjoy/model/Fish.java
6c1ef47e91c08443712a56c350f5434b813bbe81
[ "MIT" ]
permissive
3203317/g
3a707b5af4237b2c2ad9ea6aa591e6db632744f7
c59ba1a6c99f6dde7742b4b354cfb3064423a58a
refs/heads/master
2021-05-02T18:47:49.808198
2017-12-14T13:55:25
2017-12-14T13:55:25
69,540,973
0
0
null
null
null
null
UTF-8
Java
false
false
639
java
package net.foreworld.fishjoy.model; import java.io.Serializable; /** * * @author huangxin * */ public class Fish implements Serializable { private static final long serialVersionUID = -6594210220189780333L; private String id; private Integer fish_type; private Integer score; public String getId() { return id; } public void setId(String id) { this.id = id; } public Integer getFish_type() { return fish_type; } public void setFish_type(Integer fish_type) { this.fish_type = fish_type; } public Integer getScore() { return score; } public void setScore(Integer score) { this.score = score; } }
[ "3203317@qq.com" ]
3203317@qq.com
e69a463f690a527dcb2f54d8b6527547a6b50c13
aa0e4631b5cb242772c68b9f8f4f5416c4294ae0
/Exercise20.java
2a06e49f90fef32b3fac30f5680cd2372b0aaeed
[]
no_license
mladenkralev/ITTallents-Modul-2-2016
996daa3b20564ccd59c69fac63d072683cbe38c6
b54de2fd43bbb59a422623d89bd684ba5f4182d6
refs/heads/master
2020-04-14T13:44:47.806172
2016-06-30T11:46:53
2016-06-30T11:47:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package cycles; public class Exercise20 { public static void main(String[] args) { for (int i = 1; i < 11; i++) { System.out.println(); for (int j = 0; j < 10; j++) { if ((i + j) < 10) { System.out.print(i + j); } else { if ((i + j) >= 10) { System.out.print(((i + j) % 10)); } } } } } }
[ "mladenkralev@gmail.com" ]
mladenkralev@gmail.com
6a7b7d66b8dd3394f9fcbf2af0ad4f51a642019d
a769bfb01e35edc1357539904b7a61dee3a8e634
/FramegenCore/src/main/java/com/framegen/core/service/FramegenValidatorImpl.java
0d3d8cefa7379813f1f35e6267da5e9fdf6afccd
[ "MIT" ]
permissive
danielabar/framegen
97650079f2f506cdcafbfde462aa6f02d5ec7590
9d38ad3f5b730eb345b90d6b60bdccac1774e5b7
refs/heads/master
2021-01-21T11:45:04.118113
2016-03-13T12:48:22
2016-03-13T12:48:22
14,670,956
0
2
null
2016-03-13T12:48:24
2013-11-24T22:45:28
Java
UTF-8
Java
false
false
5,231
java
package com.framegen.core.service; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import com.framegen.api.settings.SettingsVO; import com.framegen.core.validation.IOptionValidator; import com.framegen.core.validation.IOptionValidatorFactory; import com.framegen.core.validation.OptionValidatorFactoryImpl; public class FramegenValidatorImpl implements IFramegenValidator { private IOptionValidatorFactory optionValidatorFactory; protected static final int MAX_PREFIX_LENGTH = 100; protected static final String PREFIX_LENGTH_EXCEEDED_MESSAGE_FORMAT = "Image prefix exceeds max length of %d by %d characters, please enter a shorter prefix"; public FramegenValidatorImpl() { super(); this.optionValidatorFactory = new OptionValidatorFactoryImpl(); } @Override public List<String> validate(SettingsVO settingsVO) { List<String> errorMessages = new ArrayList<String>(); if (settingsVO == null) { errorMessages.add("Settings must be specified"); return errorMessages; } validateProgramSettings(settingsVO, errorMessages); validateOptionSettings(settingsVO, errorMessages); return errorMessages; } protected void validateOptionSettings(SettingsVO settingsVO, List<String> errorMessages) { IOptionValidator optionValidator = optionValidatorFactory.getOptionValidator(settingsVO); List<String> optionErrorMessages = optionValidator.validate(settingsVO); if (CollectionUtils.isNotEmpty(optionErrorMessages)) { errorMessages.addAll(optionErrorMessages); } } protected void validateProgramSettings(SettingsVO settingsVO, List<String> errorMessges) { validateBaseImage(settingsVO, errorMessges); validateOverlayImage(settingsVO, errorMessges); validateOutputDirectory(settingsVO, errorMessges); validatePrefix(settingsVO, errorMessges); } protected void validatePrefix(SettingsVO settingsVO, List<String> errorMessages) { String prefix = settingsVO.getProgramSettings().getGeneratedImageNamePrefix(); if (StringUtils.isEmpty(prefix)) { errorMessages.add("Please specify a prefix for generated images"); } if (StringUtils.isNotEmpty(prefix) && prefix.length() > MAX_PREFIX_LENGTH) { errorMessages.add(String.format(PREFIX_LENGTH_EXCEEDED_MESSAGE_FORMAT, MAX_PREFIX_LENGTH, prefix.length()-MAX_PREFIX_LENGTH)); } } protected void validateOutputDirectory(SettingsVO settingsVO, List<String> errorMessages) { if (settingsVO.getProgramSettings().getOutputDir() == null) { errorMessages.add("Please specify an output directory for generated images"); } if (settingsVO.getProgramSettings().getOutputDir() != null && !isDirectoryAndExists(settingsVO.getProgramSettings().getOutputDir())) { errorMessages.add("Output directory does not refer to a directory or does not exist"); } } protected void validateBaseImage(SettingsVO settingsVO, List<String> errorMessages) { if (settingsVO.getProgramSettings().getBaseImage() == null) { errorMessages.add("Please specify a base image"); } if (settingsVO.getProgramSettings().getBaseImage() != null && !isFileAndExists(settingsVO.getProgramSettings().getBaseImage())) { errorMessages.add("Base image does not refer to a file or does not exist"); } if (settingsVO.getProgramSettings().getBaseImage() != null && isFileAndExists(settingsVO.getProgramSettings().getBaseImage())) { validateFileIsImage(settingsVO.getProgramSettings().getBaseImage(), errorMessages, "File specified for base image is not an image"); } } protected void validateFileIsImage(File file, List<String> errorMessages, String errorMessage) { try { String probeContentType = Files.probeContentType(file.toPath()); if (!StringUtils.contains(probeContentType, "image")) { errorMessages.add(errorMessage); } } catch (IOException e) { errorMessages.add(errorMessage); } } protected void validateOverlayImage(SettingsVO settingsVO, List<String> errorMessages) { if (settingsVO.getFrameOption().isRequiresOverlay()) { if (settingsVO.getProgramSettings().getOverlayImage() == null) { errorMessages.add("Please specify an overlay image"); } if (settingsVO.getProgramSettings().getOverlayImage() != null && !isFileAndExists(settingsVO.getProgramSettings().getOverlayImage())) { errorMessages.add("Overlay image does not refer to a file or does not exist"); } if (settingsVO.getProgramSettings().getOverlayImage() != null && isFileAndExists(settingsVO.getProgramSettings().getOverlayImage())) { validateFileIsImage(settingsVO.getProgramSettings().getOverlayImage(), errorMessages, "File specified for overlay image is not an image"); } } } boolean isFileAndExists(File file) { return file.exists() && file.isFile(); } boolean isDirectoryAndExists(File file) { return file.exists() && file.isDirectory(); } public IOptionValidatorFactory getOptionValidatorFactory() { return optionValidatorFactory; } public void setOptionValidatorFactory(IOptionValidatorFactory optionValidatorFactory) { this.optionValidatorFactory = optionValidatorFactory; } }
[ "baron.daniela@gmail.com" ]
baron.daniela@gmail.com
1d8703dedd87ede7632ba1cfc793bf41d7a5d94a
3cd69da4d40f2d97130b5bf15045ba09c219f1fa
/sources/kotlin/p022native/concurrent/ThreadLocal.java
4a473343064d96704410018d7063862465814fef
[]
no_license
TheWizard91/Album_base_source_from_JADX
946ea3a407b4815ac855ce4313b97bd42e8cab41
e1d228fc2ee550ac19eeac700254af8b0f96080a
refs/heads/master
2023-01-09T08:37:22.062350
2020-11-11T09:52:40
2020-11-11T09:52:40
311,927,971
0
0
null
null
null
null
UTF-8
Java
false
false
931
java
package kotlin.p022native.concurrent; import java.lang.annotation.ElementType; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import kotlin.Metadata; import kotlin.annotation.AnnotationRetention; import kotlin.annotation.AnnotationTarget; import kotlin.annotation.Retention; @Target({ElementType.TYPE}) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY, AnnotationTarget.CLASS}) @Metadata(mo33669bv = {1, 0, 3}, mo33670d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0000\b‡\"\u0018\u00002\u00020\u0001B\u0000¨\u0006\u0002"}, mo33671d2 = {"Lkotlin/native/concurrent/ThreadLocal;", "", "kotlin-stdlib"}, mo33672k = 1, mo33673mv = {1, 1, 16}) @Retention(AnnotationRetention.BINARY) @java.lang.annotation.Retention(RetentionPolicy.CLASS) /* renamed from: kotlin.native.concurrent.ThreadLocal */ /* compiled from: NativeAnnotationsH.kt */ @interface ThreadLocal { }
[ "agiapong@gmail.com" ]
agiapong@gmail.com
5c2ef3f8cc5e47ae9b970947074a2863b7a95944
782aa8f236401b3bbd6d1fb53e96cf00568fcf64
/deliveryCost/src/main/java/com/gmail/ynmatskevich/display/DisplayResult.java
7ed7df5b8b0d9013b1aef778b7597e6894e2c49a
[ "Apache-2.0" ]
permissive
YuryMatskevich/Drools
a3c668321c1e4b3221cfdb5d031a697c3cc1515f
bfe5719ec578dbbced112e85b99daf797dae515e
refs/heads/master
2020-04-18T00:16:13.375763
2019-01-22T21:41:55
2019-01-22T21:41:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.gmail.ynmatskevich.display; import com.gmail.ynmatskevich.calculate.Calculator; /** * This interface is intended to display result message */ public interface DisplayResult { /** * Display a result of calculation * * @param costCalculator an object inherited of {@link Calculator} */ void displayResult(Calculator costCalculator); }
[ "y.n.matskevich@gmail.com" ]
y.n.matskevich@gmail.com
74980c4342bd832923b2810595462ff7326ab7e3
df755f1ad9f30e2968faaf65d5f203ac9de8dcf1
/mftcc-platform-web-master/src/main/java/app/component/report/feign/MfReportCustomerFeign.java
ee3e83e771660cd4044bf55f243918029eb6f47e
[]
no_license
gaoqiang9399/eclipsetogit
afabf761f77fe542b3da1535b15d4005274b8db7
03e02ef683929ea408d883ea35cbccf07a4c43e6
refs/heads/master
2023-01-22T16:42:32.813383
2020-11-23T07:31:23
2020-11-23T07:31:23
315,209,391
0
0
null
null
null
null
UTF-8
Java
false
false
1,067
java
package app.component.report.feign; import java.util.List; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import app.base.ServiceException; import app.component.report.entity.MfCreditQueryRecordHis; import app.component.report.entity.MfReportCustomer; @FeignClient("mftcc-platform-factor") public interface MfReportCustomerFeign { @RequestMapping(value = "/mfReportCustomer/getCusList") public List<MfReportCustomer> getCusList(@RequestBody MfReportCustomer mfReportCustomer) throws ServiceException; /** * * 方法描述: 获得客户征信查询台账 * @param mfCreditQueryRecordHis * @return * @throws Exception * List<MfCreditQueryRecordHis> * @author 沈浩兵 * @date 2018-1-17 下午4:30:54 */ @RequestMapping(value = "/mfReportCustomer/getCreditQueryList") public List<MfCreditQueryRecordHis> getCreditQueryList(@RequestBody MfCreditQueryRecordHis mfCreditQueryRecordHis) throws Exception; }
[ "gaoqiang1@chenbingzhu.zgcGuaranty.net" ]
gaoqiang1@chenbingzhu.zgcGuaranty.net
1d78c86c343a8b103de83520867b518bdfc4b427
98431cb803c3cc86365a6de6d8118ad6751b4d4d
/src/main/java/com/channelsoft/usercenter/consumable/service/IConsumeService.java
e1af16ac7ffb84f718cb8783d973e53fae5d1a09
[]
no_license
popant/uc
b2f5fa90987169b0ac4b486fd4f266d7fd0d5023
c43ebf5091ef02822e0075eb0bb17a34213042a3
refs/heads/master
2021-01-10T06:18:25.011801
2016-02-03T10:17:58
2016-02-03T10:17:58
50,991,748
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package com.channelsoft.usercenter.consumable.service; import java.math.BigDecimal; import java.util.List; import com.channelsoft.usercenter.consumable.po.ConsumableOrder; import com.channelsoft.usercenter.consumable.po.ConsumableStatistic; public interface IConsumeService { public List<ConsumableStatistic> getConsumableStatics(int entId) throws Exception; public List<ConsumableOrder> getConsumableOrders(int entId) throws Exception; public BigDecimal getSumConsumableOrders(int entId) throws Exception; /** * 生成企业的初始化消费记录信息 * @param consumableStatics * @return * @throws Exception */ public Integer insertInitConsumableStatics(ConsumableStatistic consumableStatics) throws Exception; }
[ "anningkf@163.com" ]
anningkf@163.com
3bd79a2b6f93ce7f19bd2ce474bf19a70af49713
9cec6021c648d32d171be41621cb6407700bb514
/src/main/java/com/github/weaselworks/myo/driver/Pose.java
b443c9d0a022a6b869c3a505ea611f9cc29bd75a
[ "Apache-2.0" ]
permissive
WeaSeLworks/myo-java
b59e906062b49ea58ecc3febfc03dab8322a2279
271b10806a846927c546de4f52224ed4ff3e0b7f
refs/heads/master
2020-12-28T12:02:47.805219
2014-12-03T08:45:46
2014-12-03T08:45:46
25,943,332
1
0
null
null
null
null
UTF-8
Java
false
false
829
java
package com.github.weaselworks.myo.driver; /** * Created by paulwatson on 23/11/2014. */ public enum Pose { FIST("FIST"), SPREAD("SPREAD"), LEFT("LEFT"), RIGHT("RIGHT"), UNKNOWN("x"); private String poseName; Pose(String poseName){ this.poseName = poseName; } public static Pose fromString(String pose){ if (pose == null || pose.trim().length() ==0) return Pose.UNKNOWN; switch (pose){ case "FIST": return Pose.FIST; case "SPREAD": return Pose.SPREAD; case "LEFT": return Pose.LEFT; case "RIGHT": return Pose.RIGHT; default: return UNKNOWN; } } public String getName() { return poseName; } public boolean isKnownPose(){ return !this.equals(UNKNOWN); } }
[ "paul.watson@pdwtech.com" ]
paul.watson@pdwtech.com
5e575d8211277f70e4ef1ea69ea1b0c4e534f0b9
61856a7ebb4b29e702da665afe3148939a937978
/src/com/wh/Offer65.java
9aa4ca05dffede74bd1fe58f717d492fc33fc5d2
[]
no_license
BinaryZone/JianZhiOffer
242f0030215d9019e4f780ac0389a7f7a97c46b0
f2ae866b8d12873e2b192e3a59e90429893161c0
refs/heads/master
2020-06-23T12:39:19.542087
2019-08-23T06:55:34
2019-08-23T06:55:34
198,626,639
0
0
null
null
null
null
GB18030
Java
false
false
523
java
package com.wh; public class Offer65 { public int Add(int num1,int num2) { // 不考虑进位相加 int s1 = num1 ^ num2; // 进位 int s2 = (num1 & num2)<<1; int result = s1; while(s2 != 0) { result ^= s2; s2 = (s1 & s2)<<1; s1 = result; } return result; } // 代码优化 public int Add1(int num1,int num2) { while(num2 != 0) { int temp = num1 ^ num2; num2 = (num1 & num2)<<1; num1 = temp; } return num1; } }
[ "497044986@qq.com" ]
497044986@qq.com
e766fa914be03db5c50ad17bd8ec433f8381d446
3cb6a9fd60af8f647632c80d45711e5e974292fd
/app/src/main/java/com/ff161224/cc_commander/shareplatform/main/dataInfo/sampleInfo/edit/EditSampleInfoActivity.java
c41c373f31a7c47897f37801927d609ddda7948c
[]
no_license
4615/SAMP_SICT
e8a919eb0ee48f60cb128f58e70d3a873ade5490
f5ea56e6e7820c4c135824e48f7eca24eaebb31a
refs/heads/master
2023-03-17T10:44:46.847765
2019-03-17T10:07:23
2019-03-17T10:07:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,913
java
package com.ff161224.cc_commander.shareplatform.main.dataInfo.sampleInfo.edit; import android.content.DialogInterface; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.ff161224.cc_commander.shareplatform.R; import com.ff161224.cc_commander.shareplatform.main.dataInfo.sampleInfo.detail.SampleInfoActivity; import java.util.ArrayList; import java.util.HashMap; public class EditSampleInfoActivity extends AppCompatActivity { //定义空间变量 private EditText edit_sample_name_et; //样品分类名称 private EditText edit_sample_note_et; //备注 private TextView edit_sample_save_tv; //保存修改 private TextView edit_sample_cancel_tv; //取消返回 //定义其他变量 private Intent intent = null; private HashMap<String,Object> sampleInfoMap = new HashMap(); private String edit_sample_name_value = ""; private String edit_sample_note_value = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //去掉标题栏 getSupportActionBar().hide(); //加载布局文件 setContentView(R.layout.activity_edit_sample_info); //初始化控件变量 initWidget(); //接收样品分类数据 intent = getIntent(); sampleInfoMap = (HashMap<String, Object>) intent.getSerializableExtra("sampleInfoMap"); //为控件设置数据 setDataForWidget(); //为取消返回按钮设置点击监听器 setOnClickListenerForCancelTV(); //为保存修改按钮设置点击监听器 setOnCLickListenerForSaveTV(); } /** * 为回退键设置点击监听器 * @param keyCode * @param event * @return */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { new android.app.AlertDialog.Builder(EditSampleInfoActivity.this).setTitle("系统提示")//设置对话框标题 .setMessage("您确定要取消修改并返回吗?\n点击确定后您的修改将无法保存!")//设置显示的内容 .setPositiveButton("确定",new DialogInterface.OnClickListener() {//添加确定按钮 @Override public void onClick(DialogInterface dialog, int which) {//确定按钮的响应事件 // TODO Auto-generated method stub intent = new Intent(EditSampleInfoActivity.this, SampleInfoActivity.class); startActivity(intent); finish(); } }).setNegativeButton("返回",new DialogInterface.OnClickListener() {//添加返回按钮 @Override public void onClick(DialogInterface dialog, int which) {//响应事件 // TODO Auto-generated method stub Log.i("alertdialog"," 请保存数据!"); } }).show();//在按键响应事件中显示此对话框 return true; } return super.onKeyDown(keyCode, event); } /** * 初始化控件变量 */ private void initWidget() { edit_sample_name_et = (EditText) findViewById(R.id.edit_sample_name_et); //样品分类名称 edit_sample_note_et = (EditText) findViewById(R.id.edit_sample_note_et); //备注 edit_sample_save_tv = (TextView) findViewById(R.id.edit_sample_save_tv); //保存修改 edit_sample_cancel_tv = (TextView) findViewById(R.id.edit_sample_cancel_tv); //取消返回 } /** * 为控件设置数据 */ private void setDataForWidget() { edit_sample_name_et.setText(sampleInfoMap.get("sample_name").toString()); //样品分类名称 edit_sample_note_et.setText(sampleInfoMap.get("sample_note").toString()); //备注 } /** * 为取消返回按钮设置点击监听器 */ private void setOnClickListenerForCancelTV() { edit_sample_cancel_tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new android.app.AlertDialog.Builder(EditSampleInfoActivity.this).setTitle("系统提示")//设置对话框标题 .setMessage("您确定要取消修改并返回吗?\n点击确定后您的修改将无法保存!")//设置显示的内容 .setPositiveButton("确定",new DialogInterface.OnClickListener() {//添加确定按钮 @Override public void onClick(DialogInterface dialog, int which) {//确定按钮的响应事件 // TODO Auto-generated method stub intent = new Intent(EditSampleInfoActivity.this, SampleInfoActivity.class); startActivity(intent); finish(); } }).setNegativeButton("返回",new DialogInterface.OnClickListener() {//添加返回按钮 @Override public void onClick(DialogInterface dialog, int which) {//响应事件 // TODO Auto-generated method stub Log.i("alertdialog"," 请保存数据!"); } }).show();//在按键响应事件中显示此对话框 } }); } /** * 为保存修改按钮设置点击监听器 */ private void setOnCLickListenerForSaveTV() { edit_sample_save_tv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { edit_sample_name_value = edit_sample_name_et.getText().toString(); edit_sample_note_value = edit_sample_note_et.getText().toString(); sampleInfoMap.put("sample_name",edit_sample_name_value); sampleInfoMap.put("sample_note",edit_sample_note_value); Log.d("修改后的样品分类名称:",edit_sample_name_value); Log.d("修改后的样品分类备注:",edit_sample_note_value); Toast.makeText(EditSampleInfoActivity.this, "修改样品分类信息成功!", Toast.LENGTH_SHORT).show(); intent = new Intent(EditSampleInfoActivity.this,SampleInfoActivity.class); startActivity(intent); finish(); } }); } }
[ "704419968@qq.com" ]
704419968@qq.com
5af3c9abb59d6f7cd33979896b0b091ab8aa0856
d73d28438fc3abeda62c3efb0c540781712dc0b5
/app/src/main/java/com/example/notificationtesting/App.java
d94b1aa9cc972d91d0745a3a69c4f32caab89b89
[]
no_license
jhericadenise/NotificationTesting
d40f0ce755e0206cf947c0f77ae301be20c2c38c
6a3f55fc6c64c16606c0335437b21210bf067632
refs/heads/master
2023-01-19T13:03:04.754214
2020-11-14T15:20:46
2020-11-14T15:20:46
312,842,747
0
0
null
null
null
null
UTF-8
Java
false
false
1,310
java
package com.example.notificationtesting; import android.app.Application; import android.app.NotificationChannel; import android.app.NotificationManager; import android.os.Build; public class App extends Application { public static final String CHANNEL_1_ID = "Channel1"; public static final String CHANNEL_2_ID = "Channel2"; @Override public void onCreate() { super.onCreate(); createNotificationChannels(); } private void createNotificationChannels () { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel channel1 = new NotificationChannel( CHANNEL_1_ID, "Channel 1", NotificationManager.IMPORTANCE_HIGH ); channel1.setDescription("This is Channel 1"); NotificationChannel channel2 = new NotificationChannel( CHANNEL_2_ID, "Channel 2", NotificationManager.IMPORTANCE_LOW ); channel2.setDescription("This is Channel 2"); NotificationManager manager = getSystemService(NotificationManager.class); manager.createNotificationChannel(channel1); manager.createNotificationChannel(channel2); } } }
[ "jhericadenise.tiu@benilde.edu.ph" ]
jhericadenise.tiu@benilde.edu.ph
3ff30221df2eca47353d40416eb73c6d30b37ee3
3930992d8eb2263c5c98079ddf12dc56bfdb48d7
/app/src/main/java/com/screenplay/myscreenplay/Model/Item_AllScreen.java
b72336ebd5a3a00e55421f8bb4cf30f67cbf758b
[]
no_license
hayder-96/ScreenPlay
6db5b5fa691f9bc6418bef423afc9a0e5c22173e
ebf2bec66a1e3a36e063cd157086fbd1fd2cc5ab
refs/heads/master
2023-06-19T01:00:04.708087
2021-07-06T08:23:45
2021-07-06T08:23:45
383,394,611
0
0
null
null
null
null
UTF-8
Java
false
false
1,107
java
package com.screenplay.myscreenplay.Model; public class Item_AllScreen { private int id; private String Scene_location22; private String Scene_description22; private String Dialogue22; private String Number22; public Item_AllScreen() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getScene_location22() { return Scene_location22; } public void setScene_location22(String scene_location22) { Scene_location22 = scene_location22; } public String getScene_description22() { return Scene_description22; } public void setScene_description22(String scene_description22) { Scene_description22 = scene_description22; } public String getDialogue22() { return Dialogue22; } public void setDialogue22(String dialogue22) { Dialogue22 = dialogue22; } public String getNumber22() { return Number22; } public void setNumber22(String number22) { Number22 = number22; } }
[ "hxhwe1924@gmail.com" ]
hxhwe1924@gmail.com
89f1efbcf881f9710b957c279f19a04eccc80086
4c4077feb2e48c052874f5b3f360b26311aea271
/src_common/teamcerberus/cerberuscore/microblock/part/EnumPosition.java
6f88cd8303867bf09d1db58bc98149620565897f
[]
no_license
TeamCerberus/CerberusCore
2f7a8e2f299547429aea4f8191b1d5ce8b9c5ddf
254774a7e4861de68b4c774c53ef3a4e718b7fcc
refs/heads/master
2020-12-24T13:21:15.842775
2013-08-13T15:24:44
2013-08-13T15:24:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,464
java
package teamcerberus.cerberuscore.microblock.part; import static teamcerberus.cerberuscore.microblock.part.EnumAxisPosition.*; import static teamcerberus.cerberuscore.microblock.part.EnumPositionClass.*; public enum EnumPosition { Centre(EnumAxisPosition.Centre, EnumAxisPosition.Centre, EnumAxisPosition.Centre, EnumPositionClass.Centre), FaceNX(Negative, Span, Span, Face), FacePX(Positive, Span, Span, Face), FaceNY(Span, Negative, Span, Face), FacePY(Span, Positive, Span, Face), FaceNZ(Span, Span, Negative, Face), FacePZ(Span, Span, Positive, Face), EdgeNXNY(Negative, Negative, Span, Edge), EdgeNXPY(Negative, Positive, Span, Edge), EdgePXNY(Positive, Negative, Span, Edge), EdgePXPY(Positive, Positive, Span, Edge), EdgeNXNZ(Negative, Span, Negative, Edge), EdgeNXPZ(Negative, Span, Positive, Edge), EdgePXNZ(Positive, Span, Negative, Edge), EdgePXPZ(Positive, Span, Positive, Edge), EdgeNYNZ(Span, Negative, Negative, Edge), EdgeNYPZ(Span, Negative, Positive, Edge), EdgePYNZ(Span, Positive, Negative, Edge), EdgePYPZ(Span, Positive, Positive, Edge), CornerNXNYNZ(Negative, Negative, Negative, Corner), CornerNXNYPZ(Negative, Negative, Positive, Corner), CornerNXPYNZ(Negative, Positive, Negative, Corner), CornerNXPYPZ(Negative, Positive, Positive, Corner), CornerPXNYNZ(Positive, Negative, Negative, Corner), CornerPXNYPZ(Positive, Negative, Positive, Corner), CornerPXPYNZ(Positive, Positive, Negative, Corner), CornerPXPYPZ(Positive, Positive, Positive, Corner), PostX(Span, EnumAxisPosition.Centre, EnumAxisPosition.Centre, Post), PostY(EnumAxisPosition.Centre, Span, EnumAxisPosition.Centre, Post), PostZ(EnumAxisPosition.Centre, EnumAxisPosition.Centre, Span, Post); public static final int NY = 0; public static final int PY = 1; public static final int NZ = 2; public static final int PZ = 3; public static final int NX = 4; public static final int PX = 5; private EnumPosition(EnumAxisPosition x, EnumAxisPosition y, EnumAxisPosition z, EnumPositionClass clazz) { this.x = x; this.y = y; this.z = z; this.clazz = clazz; } public final EnumAxisPosition x, y, z; public final EnumPositionClass clazz; public static EnumPosition getCornerPosition(int x, int y, int z) { if(x < 0) if(y < 0) if(z < 0) return CornerNXNYNZ; else return CornerNXNYPZ; else if(z < 0) return CornerNXPYNZ; else return CornerNXPYPZ; else if(y < 0) if(z < 0) return CornerPXNYNZ; else return CornerPXNYPZ; else if(z < 0) return CornerPXPYNZ; else return CornerPXPYPZ; } private static EnumPosition edgePositionLookup[][] = { {null, null, EdgeNYNZ, EdgeNYPZ, EdgeNXNY, EdgePXNY}, {null, null, EdgePYNZ, EdgePYPZ, EdgeNXPY, EdgePXPY}, {EdgeNYNZ, EdgePYNZ, null, null, EdgeNXNZ, EdgePXNZ}, {EdgeNYPZ, EdgePYPZ, null, null, EdgeNXPZ, EdgePXPZ}, {EdgeNXNY, EdgeNXPY, EdgeNXNZ, EdgeNXPZ, null, null}, {EdgePXNY, EdgePXPY, EdgePXNZ, EdgePXPZ, null, null}, }; private static boolean edgeTouches(EnumPosition edge, int face) { switch(face) { case NX: return edge.x == EnumAxisPosition.Negative; case PX: return edge.x == EnumAxisPosition.Positive; case NY: return edge.y == EnumAxisPosition.Negative; case PY: return edge.y == EnumAxisPosition.Positive; case NZ: return edge.z == EnumAxisPosition.Negative; case PZ: return edge.z == EnumAxisPosition.Positive; } throw new IllegalArgumentException("Invalid face "+face); } static { for(int a = 0; a < 6; a++) for(int b = 0; b < 6; b++) assert(edgePositionLookup[a][b] == null || (edgeTouches(edgePositionLookup[a][b], a) && edgeTouches(edgePositionLookup[a][b], b))); } /** * Returns the edge microblock position that intersects both the given faces. * * @param side1 One of the faces. * @param side2 The other face. * @return The matching microblock position, or null for invalid face combinations (eg +Y and -Y) */ public static EnumPosition getEdgePosition(int side1, int side2) { if(side1 < 0 || side2 < 0 || side1 > 5 || side2 > 5) return null; return edgePositionLookup[side2][side1]; } public static EnumPosition getFacePosition(int side) { switch(side) { case NX: return FaceNX; case PX: return FacePX; case NY: return FaceNY; case PY: return FacePY; case NZ: return FaceNZ; case PZ: return FacePZ; default: throw new IllegalArgumentException("Invalid direction: "+side); } } }
[ "chandler2newman@hotmail.co.uk" ]
chandler2newman@hotmail.co.uk
1b7b768f979d05806ec438a1f55d10626c04f52a
74a3e9a609e200acdc0dea45e6c253a80455f2e9
/SCSP/src/servlet/Manager_servlet.java
4d15fd11c7293e36de9df0a2f1db510569203cab
[]
no_license
ISSMinions/shixun
4d494cafd7d76ec2e33b1701972385042ef7f73e
9d16eb532dfa9a61d52f4442110e188c7e6b0fb6
refs/heads/master
2021-01-01T11:55:10.022818
2017-07-20T09:06:37
2017-07-20T09:06:37
97,572,666
0
0
null
null
null
null
UTF-8
Java
false
false
1,722
java
package servlet; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import beans.question_imfor; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import service.service; public class Manager_servlet extends HttpServlet { /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json;charset=utf-8"); PrintWriter out =response.getWriter(); JSONArray array=new JSONArray(); String question_id=request.getParameter("questionID"); service service = new service(); List<question_imfor> list=service.count_option(question_id); for(int i=0;i<list.size();i++) { JSONObject object=new JSONObject(); object.put("name", list.get(i).answer_num); object.put("value", list.get(i).count_num); array.add(object); } /*JSONObject object=new JSONObject(); object.put("a", "a"); object.put("n", "1"); array.add(object); JSONObject object2=new JSONObject(); object2.put("a", "b"); object2.put("n", "2"); array.add(object2);*/ out.print(array); if (out!=null)out.close(); } }
[ "467435175@qq.com" ]
467435175@qq.com
972f8290cec307907dcc2dcb85eb11f127617147
a0e4f155a7b594f78a56958bca2cadedced8ffcd
/sdk/src/main/java/org/zstack/sdk/DeleteMediaResult.java
b56c351353842e629a7c37dbb62cc216772c9796
[ "Apache-2.0" ]
permissive
zhao-qc/zstack
e67533eabbbabd5ae9118d256f560107f9331be0
b38cd2324e272d736f291c836f01966f412653fa
refs/heads/master
2020-08-14T15:03:52.102504
2019-10-14T03:51:12
2019-10-14T03:51:12
215,187,833
3
0
Apache-2.0
2019-10-15T02:27:17
2019-10-15T02:27:16
null
UTF-8
Java
false
false
63
java
package org.zstack.sdk; public class DeleteMediaResult { }
[ "xin.zhang@mevoco.com" ]
xin.zhang@mevoco.com
a776c59d894c7c0806765f3ddd97e4282f4b533b
f742685d1c0d15666b0f242f2e0012d8af837d26
/src/main/java/com/smgk/news/bean/NewsExample.java
6b74349cb50d93a18719e9407f35dac5df45fb20
[]
no_license
smgk-seven/ssm-news
5a7d73b852ed0f24cf21e110e0d12e9c371cec7d
a27af3f1a4e7e7fa1479ab3fdf5a9aac8bef2e66
refs/heads/master
2020-04-16T18:31:23.121819
2019-01-21T13:56:54
2019-01-21T13:56:54
165,823,912
0
0
null
null
null
null
UTF-8
Java
false
false
26,373
java
package com.smgk.news.bean; import java.util.ArrayList; import java.util.Date; import java.util.List; public class NewsExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public NewsExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andNewsIdIsNull() { addCriterion("news_id is null"); return (Criteria) this; } public Criteria andNewsIdIsNotNull() { addCriterion("news_id is not null"); return (Criteria) this; } public Criteria andNewsIdEqualTo(Integer value) { addCriterion("news_id =", value, "newsId"); return (Criteria) this; } public Criteria andNewsIdNotEqualTo(Integer value) { addCriterion("news_id <>", value, "newsId"); return (Criteria) this; } public Criteria andNewsIdGreaterThan(Integer value) { addCriterion("news_id >", value, "newsId"); return (Criteria) this; } public Criteria andNewsIdGreaterThanOrEqualTo(Integer value) { addCriterion("news_id >=", value, "newsId"); return (Criteria) this; } public Criteria andNewsIdLessThan(Integer value) { addCriterion("news_id <", value, "newsId"); return (Criteria) this; } public Criteria andNewsIdLessThanOrEqualTo(Integer value) { addCriterion("news_id <=", value, "newsId"); return (Criteria) this; } public Criteria andNewsIdIn(List<Integer> values) { addCriterion("news_id in", values, "newsId"); return (Criteria) this; } public Criteria andNewsIdNotIn(List<Integer> values) { addCriterion("news_id not in", values, "newsId"); return (Criteria) this; } public Criteria andNewsIdBetween(Integer value1, Integer value2) { addCriterion("news_id between", value1, value2, "newsId"); return (Criteria) this; } public Criteria andNewsIdNotBetween(Integer value1, Integer value2) { addCriterion("news_id not between", value1, value2, "newsId"); return (Criteria) this; } public Criteria andNewsTitleIsNull() { addCriterion("news_title is null"); return (Criteria) this; } public Criteria andNewsTitleIsNotNull() { addCriterion("news_title is not null"); return (Criteria) this; } public Criteria andNewsTitleEqualTo(String value) { addCriterion("news_title =", value, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleNotEqualTo(String value) { addCriterion("news_title <>", value, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleGreaterThan(String value) { addCriterion("news_title >", value, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleGreaterThanOrEqualTo(String value) { addCriterion("news_title >=", value, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleLessThan(String value) { addCriterion("news_title <", value, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleLessThanOrEqualTo(String value) { addCriterion("news_title <=", value, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleLike(String value) { addCriterion("news_title like", value, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleNotLike(String value) { addCriterion("news_title not like", value, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleIn(List<String> values) { addCriterion("news_title in", values, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleNotIn(List<String> values) { addCriterion("news_title not in", values, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleBetween(String value1, String value2) { addCriterion("news_title between", value1, value2, "newsTitle"); return (Criteria) this; } public Criteria andNewsTitleNotBetween(String value1, String value2) { addCriterion("news_title not between", value1, value2, "newsTitle"); return (Criteria) this; } public Criteria andNewsContentIsNull() { addCriterion("news_content is null"); return (Criteria) this; } public Criteria andNewsContentIsNotNull() { addCriterion("news_content is not null"); return (Criteria) this; } public Criteria andNewsContentEqualTo(String value) { addCriterion("news_content =", value, "newsContent"); return (Criteria) this; } public Criteria andNewsContentNotEqualTo(String value) { addCriterion("news_content <>", value, "newsContent"); return (Criteria) this; } public Criteria andNewsContentGreaterThan(String value) { addCriterion("news_content >", value, "newsContent"); return (Criteria) this; } public Criteria andNewsContentGreaterThanOrEqualTo(String value) { addCriterion("news_content >=", value, "newsContent"); return (Criteria) this; } public Criteria andNewsContentLessThan(String value) { addCriterion("news_content <", value, "newsContent"); return (Criteria) this; } public Criteria andNewsContentLessThanOrEqualTo(String value) { addCriterion("news_content <=", value, "newsContent"); return (Criteria) this; } public Criteria andNewsContentLike(String value) { addCriterion("news_content like", value, "newsContent"); return (Criteria) this; } public Criteria andNewsContentNotLike(String value) { addCriterion("news_content not like", value, "newsContent"); return (Criteria) this; } public Criteria andNewsContentIn(List<String> values) { addCriterion("news_content in", values, "newsContent"); return (Criteria) this; } public Criteria andNewsContentNotIn(List<String> values) { addCriterion("news_content not in", values, "newsContent"); return (Criteria) this; } public Criteria andNewsContentBetween(String value1, String value2) { addCriterion("news_content between", value1, value2, "newsContent"); return (Criteria) this; } public Criteria andNewsContentNotBetween(String value1, String value2) { addCriterion("news_content not between", value1, value2, "newsContent"); return (Criteria) this; } public Criteria andNewsTimeIsNull() { addCriterion("news_time is null"); return (Criteria) this; } public Criteria andNewsTimeIsNotNull() { addCriterion("news_time is not null"); return (Criteria) this; } public Criteria andNewsTimeEqualTo(Date value) { addCriterion("news_time =", value, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeNotEqualTo(Date value) { addCriterion("news_time <>", value, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeGreaterThan(Date value) { addCriterion("news_time >", value, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeGreaterThanOrEqualTo(Date value) { addCriterion("news_time >=", value, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeLessThan(Date value) { addCriterion("news_time <", value, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeLessThanOrEqualTo(Date value) { addCriterion("news_time <=", value, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeIn(List<Date> values) { addCriterion("news_time in", values, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeNotIn(List<Date> values) { addCriterion("news_time not in", values, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeBetween(Date value1, Date value2) { addCriterion("news_time between", value1, value2, "newsTime"); return (Criteria) this; } public Criteria andNewsTimeNotBetween(Date value1, Date value2) { addCriterion("news_time not between", value1, value2, "newsTime"); return (Criteria) this; } public Criteria andNewsSummaryIsNull() { addCriterion("news_summary is null"); return (Criteria) this; } public Criteria andNewsSummaryIsNotNull() { addCriterion("news_summary is not null"); return (Criteria) this; } public Criteria andNewsSummaryEqualTo(String value) { addCriterion("news_summary =", value, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryNotEqualTo(String value) { addCriterion("news_summary <>", value, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryGreaterThan(String value) { addCriterion("news_summary >", value, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryGreaterThanOrEqualTo(String value) { addCriterion("news_summary >=", value, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryLessThan(String value) { addCriterion("news_summary <", value, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryLessThanOrEqualTo(String value) { addCriterion("news_summary <=", value, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryLike(String value) { addCriterion("news_summary like", value, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryNotLike(String value) { addCriterion("news_summary not like", value, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryIn(List<String> values) { addCriterion("news_summary in", values, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryNotIn(List<String> values) { addCriterion("news_summary not in", values, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryBetween(String value1, String value2) { addCriterion("news_summary between", value1, value2, "newsSummary"); return (Criteria) this; } public Criteria andNewsSummaryNotBetween(String value1, String value2) { addCriterion("news_summary not between", value1, value2, "newsSummary"); return (Criteria) this; } public Criteria andNewsTopImgIsNull() { addCriterion("news_top_img is null"); return (Criteria) this; } public Criteria andNewsTopImgIsNotNull() { addCriterion("news_top_img is not null"); return (Criteria) this; } public Criteria andNewsTopImgEqualTo(String value) { addCriterion("news_top_img =", value, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgNotEqualTo(String value) { addCriterion("news_top_img <>", value, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgGreaterThan(String value) { addCriterion("news_top_img >", value, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgGreaterThanOrEqualTo(String value) { addCriterion("news_top_img >=", value, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgLessThan(String value) { addCriterion("news_top_img <", value, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgLessThanOrEqualTo(String value) { addCriterion("news_top_img <=", value, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgLike(String value) { addCriterion("news_top_img like", value, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgNotLike(String value) { addCriterion("news_top_img not like", value, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgIn(List<String> values) { addCriterion("news_top_img in", values, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgNotIn(List<String> values) { addCriterion("news_top_img not in", values, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgBetween(String value1, String value2) { addCriterion("news_top_img between", value1, value2, "newsTopImg"); return (Criteria) this; } public Criteria andNewsTopImgNotBetween(String value1, String value2) { addCriterion("news_top_img not between", value1, value2, "newsTopImg"); return (Criteria) this; } public Criteria andNewsUserIsNull() { addCriterion("news_user is null"); return (Criteria) this; } public Criteria andNewsUserIsNotNull() { addCriterion("news_user is not null"); return (Criteria) this; } public Criteria andNewsUserEqualTo(Integer value) { addCriterion("news_user =", value, "newsUser"); return (Criteria) this; } public Criteria andNewsUserNotEqualTo(Integer value) { addCriterion("news_user <>", value, "newsUser"); return (Criteria) this; } public Criteria andNewsUserGreaterThan(Integer value) { addCriterion("news_user >", value, "newsUser"); return (Criteria) this; } public Criteria andNewsUserGreaterThanOrEqualTo(Integer value) { addCriterion("news_user >=", value, "newsUser"); return (Criteria) this; } public Criteria andNewsUserLessThan(Integer value) { addCriterion("news_user <", value, "newsUser"); return (Criteria) this; } public Criteria andNewsUserLessThanOrEqualTo(Integer value) { addCriterion("news_user <=", value, "newsUser"); return (Criteria) this; } public Criteria andNewsUserIn(List<Integer> values) { addCriterion("news_user in", values, "newsUser"); return (Criteria) this; } public Criteria andNewsUserNotIn(List<Integer> values) { addCriterion("news_user not in", values, "newsUser"); return (Criteria) this; } public Criteria andNewsUserBetween(Integer value1, Integer value2) { addCriterion("news_user between", value1, value2, "newsUser"); return (Criteria) this; } public Criteria andNewsUserNotBetween(Integer value1, Integer value2) { addCriterion("news_user not between", value1, value2, "newsUser"); return (Criteria) this; } public Criteria andNewsViewCountIsNull() { addCriterion("news_view_count is null"); return (Criteria) this; } public Criteria andNewsViewCountIsNotNull() { addCriterion("news_view_count is not null"); return (Criteria) this; } public Criteria andNewsViewCountEqualTo(Integer value) { addCriterion("news_view_count =", value, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountNotEqualTo(Integer value) { addCriterion("news_view_count <>", value, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountGreaterThan(Integer value) { addCriterion("news_view_count >", value, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountGreaterThanOrEqualTo(Integer value) { addCriterion("news_view_count >=", value, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountLessThan(Integer value) { addCriterion("news_view_count <", value, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountLessThanOrEqualTo(Integer value) { addCriterion("news_view_count <=", value, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountIn(List<Integer> values) { addCriterion("news_view_count in", values, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountNotIn(List<Integer> values) { addCriterion("news_view_count not in", values, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountBetween(Integer value1, Integer value2) { addCriterion("news_view_count between", value1, value2, "newsViewCount"); return (Criteria) this; } public Criteria andNewsViewCountNotBetween(Integer value1, Integer value2) { addCriterion("news_view_count not between", value1, value2, "newsViewCount"); return (Criteria) this; } public Criteria andNewsGenreIsNull() { addCriterion("news_genre is null"); return (Criteria) this; } public Criteria andNewsGenreIsNotNull() { addCriterion("news_genre is not null"); return (Criteria) this; } public Criteria andNewsGenreEqualTo(Integer value) { addCriterion("news_genre =", value, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreNotEqualTo(Integer value) { addCriterion("news_genre <>", value, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreGreaterThan(Integer value) { addCriterion("news_genre >", value, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreGreaterThanOrEqualTo(Integer value) { addCriterion("news_genre >=", value, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreLessThan(Integer value) { addCriterion("news_genre <", value, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreLessThanOrEqualTo(Integer value) { addCriterion("news_genre <=", value, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreIn(List<Integer> values) { addCriterion("news_genre in", values, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreNotIn(List<Integer> values) { addCriterion("news_genre not in", values, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreBetween(Integer value1, Integer value2) { addCriterion("news_genre between", value1, value2, "newsGenre"); return (Criteria) this; } public Criteria andNewsGenreNotBetween(Integer value1, Integer value2) { addCriterion("news_genre not between", value1, value2, "newsGenre"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "smgk@192.168.139.1" ]
smgk@192.168.139.1
417eef87a434605f6b63eaf4ae49a78200602c8f
b674ad4e08a9ac3dd39ef87fc6be5aff2738a55e
/InetnationalStudents/prototype/interstudents/rest/interstudents-rest-service/interstudents-service/src/main/java/kotov/interstudents/service/SpecialityService.java
623014bf8d1e63fccfd34f537728a93e8d30f3c1
[]
no_license
rokotov/inetnational-students
1e222e7800522110e12f021c30fc66b995600e02
d9c67ce3289fd72bfb7d22c8a2359e9d834a3759
refs/heads/master
2022-04-15T00:52:04.448768
2020-04-17T13:36:11
2020-04-17T13:36:11
256,508,833
0
0
null
null
null
null
UTF-8
Java
false
false
278
java
package kotov.interstudents.service; import kotov.interstudents.common.AbstractService; import kotov.interstudents.common.model.entity.Speciality; /** * Created by vkotov on 16.01.2015. */ public interface SpecialityService extends AbstractService<Speciality> { }
[ "vkotov@26ef6fd7-0f6f-4b14-8892-a5043de72c21" ]
vkotov@26ef6fd7-0f6f-4b14-8892-a5043de72c21
84ff016786d96f1076893ff9a778d59ad9595f66
80dd48bfb2c7e5552530ac0fe20f2d15a60a1c0b
/kostenstellen/view/visitor/AnythingReturnExceptionVisitor.java
c33a0036dd19f6069b25fa0fff5513660723a26a
[]
no_license
AlineLa/kostenstellen
7d8353d7c4f5241ec5239b878dac6637f65a5c74
128d8abb1648829f2588afb254f9f59e79bad697
refs/heads/master
2021-01-24T22:52:07.969724
2014-11-11T11:40:44
2014-11-11T11:40:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
830
java
package view.visitor; import view.*; public interface AnythingReturnExceptionVisitor<R, E extends view.UserException> extends AbstrakteKostenArtReturnExceptionVisitor<R, E> { public R handleTransaktion(TransaktionView transaktion) throws ModelException, E; public R handleErrorDisplay(ErrorDisplayView errorDisplay) throws ModelException, E; public R handleServer(ServerView server) throws ModelException, E; public R handleTransfer(TransferView transfer) throws ModelException, E; public R handleArtenManager(ArtenManagerView artenManager) throws ModelException, E; public R handleKonto(KontoView konto) throws ModelException, E; public R handleKontoFcd(KontoFcdView kontoFcd) throws ModelException, E; public R handleTransFacde(TransFacdeView transFacde) throws ModelException, E; }
[ "zappdidappdi+4@gmail.com" ]
zappdidappdi+4@gmail.com
345aeaed9f040f1f32b4bd9a83532b346a2afb8a
c885ef92397be9d54b87741f01557f61d3f794f3
/results/Chart-7/org.jfree.data.time.TimePeriodValues/BBC-F0-opt-100/tests/25/org/jfree/data/time/TimePeriodValues_ESTest_scaffolding.java
0051ed46e1c80d9a56c55ca22fbbc3955134adf7
[ "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
9,158
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Fri Oct 22 21:43:07 GMT 2021 */ package org.jfree.data.time; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class TimePeriodValues_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.jfree.data.time.TimePeriodValues"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { /*No java.lang.System property to set*/ } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(TimePeriodValues_ESTest_scaffolding.class.getClassLoader() , "org.jfree.data.general.SeriesChangeListener", "org.jfree.data.time.TimePeriodValue", "org.jfree.data.time.Year", "org.jfree.data.time.SerialDate", "org.jfree.data.general.Dataset", "org.jfree.data.time.Week", "org.jfree.data.time.Minute", "org.jfree.data.time.RegularTimePeriod", "org.jfree.data.time.TimePeriodFormatException", "org.jfree.data.time.Hour", "org.jfree.data.general.Series", "org.jfree.data.xy.XYDatasetTableModel", "org.jfree.data.general.DatasetChangeListener", "org.jfree.data.time.FixedMillisecond", "org.jfree.data.time.TimePeriodValues", "org.jfree.data.xy.XYDataItem", "org.jfree.data.time.SpreadsheetDate", "org.jfree.chart.util.ObjectUtilities", "org.jfree.data.time.Millisecond", "org.jfree.data.time.Second", "org.jfree.data.xy.TableXYDataset", "org.jfree.data.time.Day", "org.jfree.data.time.MonthConstants", "org.jfree.data.general.SeriesDataset", "org.jfree.data.xy.XYDataset", "org.jfree.data.general.SeriesChangeEvent", "org.jfree.data.general.SeriesException", "org.jfree.data.time.TimeSeriesDataItem", "org.jfree.data.time.Month", "org.jfree.data.general.DatasetChangeEvent", "org.jfree.data.time.TimePeriod" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(TimePeriodValues_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.jfree.data.general.Series", "org.jfree.data.time.TimePeriodValues", "org.jfree.data.time.RegularTimePeriod", "org.jfree.data.time.Second", "org.jfree.data.time.Day", "org.jfree.data.time.SerialDate", "org.jfree.data.time.SpreadsheetDate", "org.jfree.data.time.Quarter", "org.jfree.data.time.TimePeriodFormatException", "org.jfree.data.time.Millisecond", "org.jfree.data.time.Minute", "org.jfree.data.time.Hour", "org.jfree.data.time.Month", "org.jfree.data.time.Year", "org.jfree.data.time.FixedMillisecond", "org.jfree.data.xy.XYDataItem", "org.jfree.data.general.AbstractDataset", "org.jfree.data.general.AbstractSeriesDataset", "org.jfree.data.xy.AbstractXYDataset", "org.jfree.data.statistics.DefaultBoxAndWhiskerXYDataset", "org.jfree.data.general.DatasetGroup", "org.jfree.data.time.Week", "org.jfree.data.time.TimeSeriesDataItem", "org.jfree.data.xy.AbstractIntervalXYDataset", "org.jfree.data.time.TimeTableXYDataset", "org.jfree.data.DefaultKeyedValues2D", "org.jfree.data.time.TimePeriodAnchor", "org.jfree.data.xy.DefaultHighLowDataset", "org.jfree.data.time.DynamicTimeSeriesCollection", "org.jfree.data.general.SeriesChangeEvent", "org.jfree.chart.util.ObjectUtilities", "org.jfree.data.time.TimePeriodValue", "org.jfree.data.category.DefaultIntervalCategoryDataset", "org.jfree.data.DataUtilities", "org.jfree.data.resources.DataPackageResources", "org.jfree.data.xy.DefaultXYDataset", "org.jfree.data.time.TimeSeries", "org.jfree.data.xy.AbstractXYZDataset", "org.jfree.data.xy.DefaultXYZDataset", "org.jfree.data.xy.VectorSeriesCollection", "org.jfree.data.statistics.SimpleHistogramBin", "org.jfree.data.xy.XYSeriesCollection", "org.jfree.data.xy.IntervalXYDelegate", "org.jfree.data.xy.OHLCDataItem", "org.jfree.data.xy.DefaultOHLCDataset", "org.jfree.data.xy.DefaultTableXYDataset", "org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset", "org.jfree.data.KeyedObjects2D", "org.jfree.data.xy.MatrixSeriesCollection", "org.jfree.data.xy.XYDatasetTableModel", "org.jfree.data.statistics.SimpleHistogramDataset", "org.jfree.data.general.DatasetChangeEvent", "org.jfree.data.ComparableObjectSeries", "org.jfree.data.xy.XYIntervalSeries", "org.jfree.data.time.TimeSeriesCollection", "org.jfree.data.time.TimePeriodValuesCollection", "org.jfree.data.general.SubSeriesDataset", "org.jfree.data.xy.VectorSeries", "org.jfree.data.xy.DefaultWindDataset", "org.jfree.data.jdbc.JDBCXYDataset", "org.jfree.data.gantt.TaskSeriesCollection", "org.jfree.data.xy.XYSeries", "org.jfree.data.time.SimpleTimePeriod", "org.jfree.data.xy.DefaultIntervalXYDataset", "org.jfree.data.xy.YIntervalSeriesCollection", "org.jfree.data.statistics.HistogramDataset", "org.jfree.data.statistics.HistogramType", "org.jfree.data.xy.CategoryTableXYDataset", "org.jfree.data.xy.XYIntervalSeriesCollection", "org.jfree.data.xy.XIntervalSeriesCollection", "org.jfree.data.xy.XIntervalSeries", "org.jfree.data.general.CombinedDataset", "org.jfree.data.xy.MatrixSeries", "org.jfree.data.xy.XYBarDataset", "org.jfree.data.UnknownKeyException", "org.jfree.data.xy.YIntervalSeries", "org.jfree.data.ComparableObjectItem", "org.jfree.data.category.DefaultCategoryDataset", "org.jfree.data.general.DefaultKeyedValues2DDataset", "org.jfree.chart.util.TableOrder", "org.jfree.data.category.CategoryToPieDataset", "org.jfree.data.general.DefaultPieDataset", "org.jfree.data.jdbc.JDBCPieDataset", "org.jfree.data.DefaultKeyedValues", "org.jfree.data.general.WaferMapDataset", "org.jfree.data.general.DatasetUtilities", "org.jfree.data.general.CombinedDataset$DatasetInfo", "org.jfree.data.statistics.DefaultStatisticalCategoryDataset", "org.jfree.data.general.SeriesException", "org.jfree.data.statistics.BoxAndWhiskerItem", "org.jfree.data.Range", "org.jfree.data.jdbc.JDBCCategoryDataset", "org.jfree.data.statistics.DefaultMultiValueCategoryDataset", "org.jfree.data.general.DefaultKeyedValuesDataset", "org.jfree.data.gantt.Task", "org.jfree.data.xy.VectorDataItem", "org.jfree.data.xy.XYCoordinate", "org.jfree.data.xy.Vector", "org.jfree.data.time.DynamicTimeSeriesCollection$ValueSequence", "org.jfree.data.xy.WindDataItem" ); } }
[ "pderakhshanfar@serg2.ewi.tudelft.nl" ]
pderakhshanfar@serg2.ewi.tudelft.nl
3460f7fc5c5c61a21309bff9b4819e603339d009
806f76edfe3b16b437be3eb81639d1a7b1ced0de
/src/com/huawei/hwdatamigrate/p407a/ay.java
96e4eb32d271e74bd85b41e30bc1579f2be4f877
[]
no_license
magic-coder/huawei-wear-re
1bbcabc807e21b2fe8fe9aa9d6402431dfe3fb01
935ad32f5348c3d8c8d294ed55a5a2830987da73
refs/heads/master
2021-04-15T18:30:54.036851
2018-03-22T07:16:50
2018-03-22T07:16:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
297
java
package com.huawei.hwdatamigrate.p407a; /* compiled from: UserConfig */ public class ay { public int f17516a; public String f17517b; public int f17518c; public int f17519d; public int f17520e; public String f17521f; public String f17522g; public String f17523h; }
[ "lebedev1537@gmail.com" ]
lebedev1537@gmail.com
873a968f552bcbe97f1ca2be8b0f6f5e5551181f
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project34/src/test/java/org/gradle/test/performance34_4/Test34_345.java
7a6f374f7d6f193b585c03a4f3544fc78dd987ff
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
292
java
package org.gradle.test.performance34_4; import static org.junit.Assert.*; public class Test34_345 { private final Production34_345 production = new Production34_345("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
887207381963e0f687494e29f19f95390f113a6b
e48db2b264291090d9d5fe58ed4d4a7f2e3c7574
/predict/src/main/scala/com/idibon/ml/feature/word2vec/Word2VecBinReader.java
a253f5e1f3272f40d7d04ba7e78e2ee6a444b745
[ "Apache-2.0" ]
permissive
tubular/idiml
19b899f502155eb1bfc3f80a86c56758ca8b20a4
fbcf1775524de3ac7b594272c379fb336b7cda5e
refs/heads/master
2020-03-23T04:56:45.401043
2018-07-16T11:14:28
2018-07-16T11:14:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,867
java
package com.idibon.ml.feature.word2vec; import java.io.*; import java.net.URI; import java.util.*; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.zip.GZIPInputStream; /** * Class for reading word2vec gzipped binary vector files and outputting Java hashmaps */ public class Word2VecBinReader { private long words; private long size; /** * Converts an ASCII string long integer into a Java long integer * * @param dis DatatInputStream containing a long integer * @return the actual long integer */ public long readAsciiLong(DataInputStream dis) { String accum = ""; while(true){ try{ char c = (char) dis.readByte(); if (Character.isWhitespace(c)) { break; } accum += c; } catch (IOException e){ e.printStackTrace(); } } return Long.parseLong(accum); } /** * Parses a gzipped binary file output by the word2vec C implementation * * @param uri uri to gzipped bin file * @return Map of words to vectors */ public Map<String, float[]> parseBinFile(URI uri) { Map<String, float[]> vectors = new HashMap<>(); try (DataInputStream data = new DataInputStream( new GZIPInputStream(new FileInputStream(new File(uri)), 65536))) { words = readAsciiLong(data); size = readAsciiLong(data); if (size > Integer.MAX_VALUE) throw new IllegalArgumentException("Too many dimensions"); for (long b = 0; b < words; b++) { ByteArrayOutputStream wordBuffer = new ByteArrayOutputStream(); for (int c = data.readByte(); c != -1 && c != ' '; c = data.readByte()) wordBuffer.write(c); String word = new String(wordBuffer.toByteArray(), "UTF-8"); float[] vector = new float[(int) size]; /* the original implementation generally runs on little-endian * native architectures, and there is no accommodation for big- * endian in the file format, so just assume that an endian- * swap is necessary to get the float values into Java */ byte[] swap = new byte[4]; ByteBuffer endianConverter = ByteBuffer.wrap(swap).order(ByteOrder.LITTLE_ENDIAN); for (int i = 0; i < (int) size; i++) { data.readFully(swap); vector[i] = endianConverter.getFloat(); endianConverter.rewind(); } vectors.put(word.trim(), vector); } } catch (Exception e) { e.printStackTrace(); } return vectors; } }
[ "gary@idibon.com" ]
gary@idibon.com
a9785ca2afb17f25293c8f388e86dd62c770a06d
de3c2d89f623527b35cc5dd936773f32946025d2
/src/main/java/com/tencent/stat/C7608d.java
cada811d1ec09912b46bcdc09c1707c0404ed025
[]
no_license
ren19890419/lvxing
5f89f7b118df59fd1da06aaba43bd9b41b5da1e6
239875461cb39e58183ac54e93565ec5f7f28ddb
refs/heads/master
2023-04-15T08:56:25.048806
2020-06-05T10:46:05
2020-06-05T10:46:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
45,141
java
package com.tencent.stat; import android.content.Context; import android.os.Build.VERSION; import android.os.Handler; import android.os.HandlerThread; import android.provider.Settings.System; import androidx.core.app.NotificationCompat; import com.kwad.sdk.core.imageloader.core.download.BaseImageDownloader; import com.p522qq.p523e.comm.constants.Constants.KEYS; import com.tencent.mid.api.MidService; import com.tencent.mid.sotrage.StorageInterface; import com.tencent.mid.util.Util; import com.tencent.qqpim.discovery.internal.protocol.C7516p; import com.tencent.stat.common.C7597d; import com.tencent.stat.common.C7598e; import com.tencent.stat.common.C7600g; import com.tencent.stat.common.StatCommonHelper; import com.tencent.stat.common.StatConstants; import com.tencent.stat.common.StatLogger; import com.tencent.stat.event.Event; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.SocketTimeoutException; import java.net.URL; import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; import java.util.zip.GZIPOutputStream; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.protocol.HttpContext; import org.apache.http.util.EntityUtils; import org.json.JSONObject; /* renamed from: com.tencent.stat.d */ class C7608d { /* renamed from: d */ private static StatLogger f25700d = StatCommonHelper.getLogger(); /* renamed from: e */ private static C7608d f25701e = null; /* renamed from: f */ private static Context f25702f = null; /* renamed from: a */ DefaultHttpClient f25703a = null; /* renamed from: b */ Handler f25704b = null; /* renamed from: c */ StringBuilder f25705c = new StringBuilder(4096); /* renamed from: g */ private long f25706g = 0; private C7608d(Context context) { try { HandlerThread handlerThread = new HandlerThread("StatDispatcher"); handlerThread.start(); this.f25704b = new Handler(handlerThread.getLooper()); m32795a(context); this.f25706g = System.currentTimeMillis() / 1000; BasicHttpParams basicHttpParams = new BasicHttpParams(); HttpConnectionParams.setStaleCheckingEnabled(basicHttpParams, false); HttpConnectionParams.setConnectionTimeout(basicHttpParams, C7516p.f25219Cf); HttpConnectionParams.setSoTimeout(basicHttpParams, C7516p.f25219Cf); this.f25703a = new DefaultHttpClient(basicHttpParams); this.f25703a.setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy() { public long getKeepAliveDuration(HttpResponse httpResponse, HttpContext httpContext) { long keepAliveDuration = C7608d.super.getKeepAliveDuration(httpResponse, httpContext); if (keepAliveDuration == -1) { return 30000; } return keepAliveDuration; } }); } catch (Throwable th) { f25700d.mo37104e(th); } } /* renamed from: a */ static void m32795a(Context context) { if (context == null) { return; } if (context.getApplicationContext() != null) { f25702f = context.getApplicationContext(); } else { f25702f = context; } } /* renamed from: a */ static Context m32792a() { return f25702f; } /* renamed from: b */ static C7608d m32797b(Context context) { if (f25701e == null) { synchronized (C7608d.class) { if (f25701e == null) { f25701e = new C7608d(context); } } } return f25701e; } /* renamed from: a */ private void m32796a(JSONObject jSONObject) { String str = "ncts"; String str2 = "cfg"; try { String optString = jSONObject.optString("mid"); if (Util.isMidValid(optString)) { if (StatConfig.isDebugEnable()) { StatLogger statLogger = f25700d; StringBuilder sb = new StringBuilder(); sb.append("update mid:"); sb.append(optString); statLogger.mo37108i(sb.toString()); } Util.updateIfLocalInvalid(f25702f, optString); } if (!jSONObject.isNull(str2)) { StatConfig.m32591a(f25702f, jSONObject.getJSONObject(str2)); } if (!jSONObject.isNull(str)) { int i = jSONObject.getInt(str); int currentTimeMillis = (int) (((long) i) - (System.currentTimeMillis() / 1000)); if (StatConfig.isDebugEnable()) { StatLogger statLogger2 = f25700d; StringBuilder sb2 = new StringBuilder(); sb2.append("server time:"); sb2.append(i); sb2.append(", diff time:"); sb2.append(currentTimeMillis); statLogger2.mo37108i(sb2.toString()); } StatCommonHelper.updateCheckTime(f25702f); StatCommonHelper.writeDiffTimeFromServer(f25702f, currentTimeMillis); } } catch (Throwable th) { f25700d.mo37116w(th); } } /* access modifiers changed from: 0000 */ /* renamed from: a */ public void mo37132a(List<?> list, StatDispatchCallback statDispatchCallback) { Throwable th; List<?> list2 = list; String str = "gzip"; String str2 = "rc4"; String str3 = "["; String str4 = "UTF-8"; String str5 = "Content-Encoding"; if (list2 != null && !list.isEmpty()) { int size = list.size(); try { this.f25705c.delete(0, this.f25705c.length()); this.f25705c.append(str3); for (int i = 0; i < size; i++) { this.f25705c.append(list2.get(i).toString()); if (i != size - 1) { this.f25705c.append(StorageInterface.KEY_SPLITER); } } this.f25705c.append("]"); String sb = this.f25705c.toString(); int length = sb.length(); StringBuilder sb2 = new StringBuilder(); sb2.append(StatConfig.getStatReportUrl()); sb2.append("/?index="); sb2.append(this.f25706g); String sb3 = sb2.toString(); this.f25706g++; if (StatConfig.isDebugEnable()) { StatLogger statLogger = f25700d; StringBuilder sb4 = new StringBuilder(); sb4.append(str3); sb4.append(sb3); sb4.append("]Send request("); sb4.append(length); sb4.append("bytes), content:"); sb4.append(sb); statLogger.mo37108i(sb4.toString()); } HttpPost httpPost = new HttpPost(sb3); httpPost.addHeader("Accept-Encoding", str); httpPost.setHeader("Connection", "Keep-Alive"); httpPost.removeHeaders("Cache-Control"); HttpHost httpProxy = NetworkManager.getInstance(f25702f).getHttpProxy(); httpPost.addHeader(str5, str2); String str6 = "http.route.default-proxy"; String str7 = "X-Content-Encoding"; if (httpProxy == null) { this.f25703a.getParams().removeParameter(str6); } else { if (StatConfig.isDebugEnable()) { StatLogger statLogger2 = f25700d; StringBuilder sb5 = new StringBuilder(); sb5.append("proxy:"); sb5.append(httpProxy.toHostString()); statLogger2.mo37101d(sb5.toString()); } httpPost.addHeader(str7, str2); this.f25703a.getParams().setParameter(str6, httpProxy); httpPost.addHeader("X-Online-Host", StatConfig.f25366k); httpPost.addHeader("Accept", "*/*"); httpPost.addHeader("Content-Type", "json"); } ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(length); byte[] bytes = sb.getBytes(str4); int length2 = bytes.length; if (length > StatConfig.f25370o) { httpPost.removeHeaders(str5); StringBuilder sb6 = new StringBuilder(); sb6.append(str2); sb6.append(",gzip"); String sb7 = sb6.toString(); httpPost.addHeader(str5, sb7); if (httpProxy != null) { httpPost.removeHeaders(str7); httpPost.addHeader(str7, sb7); } byteArrayOutputStream.write(new byte[4]); GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream); gZIPOutputStream.write(bytes); gZIPOutputStream.close(); bytes = byteArrayOutputStream.toByteArray(); ByteBuffer.wrap(bytes, 0, 4).putInt(length2); if (StatConfig.isDebugEnable()) { StatLogger statLogger3 = f25700d; StringBuilder sb8 = new StringBuilder(); sb8.append("before Gzip:"); sb8.append(length2); sb8.append(" bytes, after Gzip:"); sb8.append(bytes.length); sb8.append(" bytes"); statLogger3.mo37101d(sb8.toString()); } } httpPost.setEntity(new ByteArrayEntity(C7598e.m32760a(bytes))); HttpResponse execute = this.f25703a.execute(httpPost); HttpEntity entity = execute.getEntity(); int statusCode = execute.getStatusLine().getStatusCode(); long contentLength = entity.getContentLength(); if (StatConfig.isDebugEnable()) { StatLogger statLogger4 = f25700d; StringBuilder sb9 = new StringBuilder(); sb9.append("http recv response status code:"); sb9.append(statusCode); sb9.append(", content length:"); sb9.append(contentLength); statLogger4.mo37108i(sb9.toString()); } int i2 = (contentLength > 0 ? 1 : (contentLength == 0 ? 0 : -1)); if (i2 == 0) { f25700d.mo37103e((Object) "Server response no data."); if (statDispatchCallback != null) { statDispatchCallback.onDispatchFailure(); } EntityUtils.toString(entity); return; } if (i2 > 0) { InputStream content = entity.getContent(); DataInputStream dataInputStream = new DataInputStream(content); byte[] bArr = new byte[((int) entity.getContentLength())]; dataInputStream.readFully(bArr); content.close(); dataInputStream.close(); Header firstHeader = execute.getFirstHeader(str5); if (firstHeader != null) { if (firstHeader.getValue().equalsIgnoreCase("gzip,rc4")) { bArr = C7598e.m32762b(StatCommonHelper.deocdeGZipContent(bArr)); } else if (firstHeader.getValue().equalsIgnoreCase("rc4,gzip")) { bArr = StatCommonHelper.deocdeGZipContent(C7598e.m32762b(bArr)); } else if (firstHeader.getValue().equalsIgnoreCase(str)) { bArr = StatCommonHelper.deocdeGZipContent(bArr); } else if (firstHeader.getValue().equalsIgnoreCase(str2)) { bArr = C7598e.m32762b(bArr); } } String str8 = new String(bArr, str4); if (StatConfig.isDebugEnable()) { StatLogger statLogger5 = f25700d; StringBuilder sb10 = new StringBuilder(); sb10.append("http get response data:"); sb10.append(str8); statLogger5.mo37108i(sb10.toString()); } JSONObject jSONObject = new JSONObject(str8); if (statusCode == 200) { m32796a(jSONObject); if (statDispatchCallback != null) { if (jSONObject.optInt(KEYS.RET) == 0) { statDispatchCallback.onDispatchSuccess(); } else { f25700d.error((Object) "response error data."); statDispatchCallback.onDispatchFailure(); } } } else { StatLogger statLogger6 = f25700d; StringBuilder sb11 = new StringBuilder(); sb11.append("Server response error code:"); sb11.append(statusCode); sb11.append(", error:"); sb11.append(new String(bArr, str4)); statLogger6.error((Object) sb11.toString()); if (statDispatchCallback != null) { statDispatchCallback.onDispatchFailure(); } } content.close(); } else { EntityUtils.toString(entity); } byteArrayOutputStream.close(); th = null; if (th != null) { f25700d.error(th); if (statDispatchCallback != null) { try { statDispatchCallback.onDispatchFailure(); } catch (Throwable th2) { f25700d.mo37104e(th2); } } if (th instanceof OutOfMemoryError) { this.f25705c = null; System.gc(); this.f25705c = new StringBuilder(2048); } else if (!(th instanceof UnknownHostException)) { boolean z = th instanceof SocketTimeoutException; } NetworkManager.getInstance(f25702f).onDispatchFailed(); } } catch (Throwable th3) { th = th3; } } } /* renamed from: c */ private long m32798c() { try { return System.currentTimeMillis() / 1000; } catch (Exception e) { e.printStackTrace(); return 0; } } /* access modifiers changed from: private */ /* renamed from: a */ public String m32793a(int i, String str) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("data", "null"); String str2 = NotificationCompat.CATEGORY_MESSAGE; StringBuilder sb = new StringBuilder(); sb.append("error:"); sb.append(str); jSONObject.put(str2, sb.toString()); jSONObject.put("code", String.valueOf(i)); return jSONObject.toString(); } catch (Throwable th) { f25700d.mo37104e(th); return "{\"code\":-1,\"msg\":\"调用失败\",\"data\":null}"; } } /* renamed from: a */ public String mo37125a(String str, String str2) throws IOException { String appKey = StatConfig.getAppKey(f25702f); String localMidOnly = MidService.getLocalMidOnly(f25702f); String curAppVersion = StatCommonHelper.getCurAppVersion(f25702f); String str3 = VERSION.RELEASE; String deviceModel = StatCommonHelper.getDeviceModel(f25702f); String linkedWay = StatCommonHelper.getLinkedWay(f25702f); StringBuilder sb = new StringBuilder(); sb.append(m32798c()); sb.append(""); String sb2 = sb.toString(); HashMap hashMap = new HashMap(); hashMap.put("UserName", "user"); hashMap.put("AppKey", appKey); hashMap.put("Mid", localMidOnly); hashMap.put("Content", str); hashMap.put("AppVersion", curAppVersion); hashMap.put("OSVersion", str3); hashMap.put("Model", deviceModel); hashMap.put("NetWork", linkedWay); hashMap.put("FileType", "img"); hashMap.put("TimeStamp", sb2); StringBuilder sb3 = new StringBuilder(); sb3.append(com.tencent.stat.common.Util.decode(StatConstants.FB_KEY)); StringBuilder sb4 = new StringBuilder(); sb4.append("AppKey="); sb4.append(appKey); sb3.append(sb4.toString()); StringBuilder sb5 = new StringBuilder(); sb5.append("AppVersion="); sb5.append(curAppVersion); sb3.append(sb5.toString()); StringBuilder sb6 = new StringBuilder(); sb6.append("Mid="); sb6.append(localMidOnly); sb3.append(sb6.toString()); StringBuilder sb7 = new StringBuilder(); sb7.append("Model="); sb7.append(deviceModel); sb3.append(sb7.toString()); StringBuilder sb8 = new StringBuilder(); sb8.append("NetWork="); sb8.append(linkedWay); sb3.append(sb8.toString()); StringBuilder sb9 = new StringBuilder(); sb9.append("OSVersion="); sb9.append(str3); sb3.append(sb9.toString()); StringBuilder sb10 = new StringBuilder(); sb10.append("TimeStamp="); sb10.append(sb2); sb3.append(sb10.toString()); hashMap.put("Sign", StatCommonHelper.md5sum(sb3.toString())); C7597d.m32759a(f25702f); StringBuilder sb11 = new StringBuilder(); sb11.append(f25702f.getFilesDir()); sb11.append("/feedback.log"); String sb12 = sb11.toString(); HashMap hashMap2 = new HashMap(); hashMap2.put("log", new File(sb12)); if (str2 != null && str2.trim().length() > 0) { StringBuilder sb13 = new StringBuilder(); sb13.append(f25702f.getFilesDir()); sb13.append("/feedback.png"); File file = new File(sb13.toString()); C7600g.m32773a(str2, file); hashMap2.put("screenshot", file); } return mo37126a((Map<String, String>) hashMap, (Map<String, File>) hashMap2); } /* renamed from: a */ public String mo37126a(Map<String, String> map, Map<String, File> map2) throws IOException { String str; String str2; String str3; String str4; String str5; String uuid = UUID.randomUUID().toString(); HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("http://mta.qq.com/mta/api/ctr_feedback/add_feedback").openConnection(); httpURLConnection.setReadTimeout(BaseImageDownloader.DEFAULT_HTTP_CONNECT_TIMEOUT); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); httpURLConnection.setUseCaches(false); httpURLConnection.setRequestMethod("POST"); httpURLConnection.setRequestProperty("connection", "keep-alive"); String str6 = "UTF-8"; httpURLConnection.setRequestProperty("Charsert", str6); StringBuilder sb = new StringBuilder(); sb.append("multipart/form-data"); sb.append(";boundary="); sb.append(uuid); httpURLConnection.setRequestProperty("Content-Type", sb.toString()); StringBuilder sb2 = new StringBuilder(); Iterator it = map.entrySet().iterator(); while (true) { str = "\""; str2 = "Content-Disposition: form-data; name=\""; str3 = "--"; str4 = "\r\n"; if (!it.hasNext()) { break; } Entry entry = (Entry) it.next(); sb2.append(str3); sb2.append(uuid); sb2.append(str4); StringBuilder sb3 = new StringBuilder(); sb3.append(str2); sb3.append((String) entry.getKey()); sb3.append(str); sb3.append(str4); sb2.append(sb3.toString()); StringBuilder sb4 = new StringBuilder(); sb4.append("Content-Type: text/plain; charset="); sb4.append(str6); sb4.append(str4); sb2.append(sb4.toString()); StringBuilder sb5 = new StringBuilder(); sb5.append("Content-Transfer-Encoding: 8bit"); sb5.append(str4); sb2.append(sb5.toString()); sb2.append(str4); sb2.append((String) entry.getValue()); sb2.append(str4); } DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream()); dataOutputStream.write(sb2.toString().getBytes()); if (map2 != null) { for (Entry entry2 : map2.entrySet()) { StringBuilder sb6 = new StringBuilder(); sb6.append(str3); sb6.append(uuid); sb6.append(str4); StringBuilder sb7 = new StringBuilder(); sb7.append(str2); sb7.append((String) entry2.getKey()); sb7.append("\"; filename=\""); sb7.append(((File) entry2.getValue()).getName()); sb7.append(str); sb7.append(str4); sb6.append(sb7.toString()); StringBuilder sb8 = new StringBuilder(); sb8.append("Content-Type: application/octet-stream; charset="); sb8.append(str6); sb8.append(str4); sb6.append(sb8.toString()); sb6.append(str4); dataOutputStream.write(sb6.toString().getBytes()); FileInputStream fileInputStream = new FileInputStream((File) entry2.getValue()); byte[] bArr = new byte[1024]; while (true) { int read = fileInputStream.read(bArr); if (read == -1) { break; } dataOutputStream.write(bArr, 0, read); } fileInputStream.close(); dataOutputStream.write(str4.getBytes()); } } StringBuilder sb9 = new StringBuilder(); sb9.append(str3); sb9.append(uuid); sb9.append(str3); sb9.append(str4); dataOutputStream.write(sb9.toString().getBytes()); dataOutputStream.flush(); StringBuilder sb10 = new StringBuilder(); if (httpURLConnection.getResponseCode() == 200) { InputStream inputStream = httpURLConnection.getInputStream(); while (true) { int read2 = inputStream.read(); if (read2 == -1) { break; } sb10.append((char) read2); } str5 = sb10.toString(); } else { StringBuilder sb11 = new StringBuilder(); sb11.append(""); sb11.append(httpURLConnection.getResponseCode()); str5 = m32793a(-1, sb11.toString()); } dataOutputStream.close(); httpURLConnection.disconnect(); return str5; } /* JADX INFO: finally extract failed */ /* access modifiers changed from: 0000 */ /* JADX WARNING: Removed duplicated region for block: B:56:0x01c3 A[Catch:{ all -> 0x0204 }] */ /* JADX WARNING: Removed duplicated region for block: B:57:0x01c6 A[Catch:{ all -> 0x0204 }] */ /* JADX WARNING: Removed duplicated region for block: B:65:0x01ea */ /* JADX WARNING: Removed duplicated region for block: B:67:0x01ef */ /* JADX WARNING: Removed duplicated region for block: B:79:? A[RETURN, SYNTHETIC] */ /* renamed from: a */ public void mo37131a(java.lang.String r13, java.util.Map<java.lang.String, java.lang.String> r14, com.tencent.stat.StatFBDispatchCallback r15) { /* r12 = this; java.lang.String r0 = "UTF-8" java.lang.String r1 = "Content-Encoding" java.lang.String r2 = "rc4" java.lang.String r3 = "" r4 = -1 org.apache.http.client.methods.HttpPost r5 = new org.apache.http.client.methods.HttpPost // Catch:{ all -> 0x01bd } r5.<init>(r13) // Catch:{ all -> 0x01bd } java.lang.String r13 = "Connection" java.lang.String r6 = "Keep-Alive" r5.setHeader(r13, r6) // Catch:{ all -> 0x01bd } java.lang.String r13 = "Cache-Control" r5.removeHeaders(r13) // Catch:{ all -> 0x01bd } android.content.Context r13 = f25702f // Catch:{ all -> 0x01bd } com.tencent.stat.NetworkManager r13 = com.tencent.stat.NetworkManager.getInstance(r13) // Catch:{ all -> 0x01bd } org.apache.http.HttpHost r13 = r13.getHttpProxy() // Catch:{ all -> 0x01bd } r5.addHeader(r1, r2) // Catch:{ all -> 0x01bd } java.lang.String r6 = "http.route.default-proxy" if (r13 != 0) goto L_0x0035 org.apache.http.impl.client.DefaultHttpClient r13 = r12.f25703a // Catch:{ all -> 0x01bd } org.apache.http.params.HttpParams r13 = r13.getParams() // Catch:{ all -> 0x01bd } r13.removeParameter(r6) // Catch:{ all -> 0x01bd } goto L_0x0073 L_0x0035: boolean r7 = com.tencent.stat.StatConfig.isDebugEnable() // Catch:{ all -> 0x01bd } if (r7 == 0) goto L_0x0055 com.tencent.stat.common.StatLogger r7 = f25700d // Catch:{ all -> 0x01bd } java.lang.StringBuilder r8 = new java.lang.StringBuilder // Catch:{ all -> 0x01bd } r8.<init>() // Catch:{ all -> 0x01bd } java.lang.String r9 = "proxy:" r8.append(r9) // Catch:{ all -> 0x01bd } java.lang.String r9 = r13.toHostString() // Catch:{ all -> 0x01bd } r8.append(r9) // Catch:{ all -> 0x01bd } java.lang.String r8 = r8.toString() // Catch:{ all -> 0x01bd } r7.mo37101d(r8) // Catch:{ all -> 0x01bd } L_0x0055: org.apache.http.impl.client.DefaultHttpClient r7 = r12.f25703a // Catch:{ all -> 0x01bd } org.apache.http.params.HttpParams r7 = r7.getParams() // Catch:{ all -> 0x01bd } r7.setParameter(r6, r13) // Catch:{ all -> 0x01bd } java.lang.String r13 = "X-Online-Host" java.lang.String r6 = "mta.qq.com:80" r5.addHeader(r13, r6) // Catch:{ all -> 0x01bd } java.lang.String r13 = "Accept" java.lang.String r6 = "*/*" r5.addHeader(r13, r6) // Catch:{ all -> 0x01bd } java.lang.String r13 = "Content-Type" java.lang.String r6 = "text/plain" r5.addHeader(r13, r6) // Catch:{ all -> 0x01bd } L_0x0073: java.util.ArrayList r13 = new java.util.ArrayList // Catch:{ all -> 0x01bd } r13.<init>() // Catch:{ all -> 0x01bd } java.util.Set r14 = r14.entrySet() // Catch:{ all -> 0x01bd } java.util.Iterator r14 = r14.iterator() // Catch:{ all -> 0x01bd } L_0x0080: boolean r6 = r14.hasNext() // Catch:{ all -> 0x01bd } if (r6 == 0) goto L_0x00a1 java.lang.Object r6 = r14.next() // Catch:{ all -> 0x01bd } java.util.Map$Entry r6 = (java.util.Map.Entry) r6 // Catch:{ all -> 0x01bd } org.apache.http.message.BasicNameValuePair r7 = new org.apache.http.message.BasicNameValuePair // Catch:{ all -> 0x01bd } java.lang.Object r8 = r6.getKey() // Catch:{ all -> 0x01bd } java.lang.String r8 = (java.lang.String) r8 // Catch:{ all -> 0x01bd } java.lang.Object r6 = r6.getValue() // Catch:{ all -> 0x01bd } java.lang.String r6 = (java.lang.String) r6 // Catch:{ all -> 0x01bd } r7.<init>(r8, r6) // Catch:{ all -> 0x01bd } r13.add(r7) // Catch:{ all -> 0x01bd } goto L_0x0080 L_0x00a1: org.apache.http.client.entity.UrlEncodedFormEntity r14 = new org.apache.http.client.entity.UrlEncodedFormEntity // Catch:{ all -> 0x01bd } r14.<init>(r13, r0) // Catch:{ all -> 0x01bd } r5.setEntity(r14) // Catch:{ all -> 0x01bd } org.apache.http.impl.client.DefaultHttpClient r13 = r12.f25703a // Catch:{ all -> 0x01bd } org.apache.http.HttpResponse r13 = r13.execute(r5) // Catch:{ all -> 0x01bd } org.apache.http.HttpEntity r14 = r13.getEntity() // Catch:{ all -> 0x01bd } org.apache.http.StatusLine r5 = r13.getStatusLine() // Catch:{ all -> 0x01bd } int r5 = r5.getStatusCode() // Catch:{ all -> 0x01bd } long r6 = r14.getContentLength() // Catch:{ all -> 0x01bd } boolean r8 = com.tencent.stat.StatConfig.isDebugEnable() // Catch:{ all -> 0x01bd } if (r8 == 0) goto L_0x00e3 com.tencent.stat.common.StatLogger r8 = f25700d // Catch:{ all -> 0x01bd } java.lang.StringBuilder r9 = new java.lang.StringBuilder // Catch:{ all -> 0x01bd } r9.<init>() // Catch:{ all -> 0x01bd } java.lang.String r10 = "http recv response status code:" r9.append(r10) // Catch:{ all -> 0x01bd } r9.append(r5) // Catch:{ all -> 0x01bd } java.lang.String r10 = ", content length:" r9.append(r10) // Catch:{ all -> 0x01bd } r9.append(r6) // Catch:{ all -> 0x01bd } java.lang.String r9 = r9.toString() // Catch:{ all -> 0x01bd } r8.mo37108i(r9) // Catch:{ all -> 0x01bd } L_0x00e3: r8 = 0 int r10 = (r6 > r8 ? 1 : (r6 == r8 ? 0 : -1)) if (r10 <= 0) goto L_0x01a1 java.io.InputStream r6 = r14.getContent() // Catch:{ all -> 0x01bd } java.io.DataInputStream r7 = new java.io.DataInputStream // Catch:{ all -> 0x01bd } r7.<init>(r6) // Catch:{ all -> 0x01bd } long r8 = r14.getContentLength() // Catch:{ all -> 0x01bd } int r14 = (int) r8 // Catch:{ all -> 0x01bd } byte[] r14 = new byte[r14] // Catch:{ all -> 0x01bd } r7.readFully(r14) // Catch:{ all -> 0x01bd } r6.close() // Catch:{ all -> 0x01bd } r7.close() // Catch:{ all -> 0x01bd } org.apache.http.Header r13 = r13.getFirstHeader(r1) // Catch:{ all -> 0x01bd } if (r13 == 0) goto L_0x0151 java.lang.String r1 = r13.getValue() // Catch:{ all -> 0x01bd } java.lang.String r6 = "gzip,rc4" boolean r1 = r1.equalsIgnoreCase(r6) // Catch:{ all -> 0x01bd } if (r1 == 0) goto L_0x011d byte[] r13 = com.tencent.stat.common.StatCommonHelper.deocdeGZipContent(r14) // Catch:{ all -> 0x01bd } byte[] r14 = com.tencent.stat.common.C7598e.m32762b(r13) // Catch:{ all -> 0x01bd } goto L_0x0151 L_0x011d: java.lang.String r1 = r13.getValue() // Catch:{ all -> 0x01bd } java.lang.String r6 = "rc4,gzip" boolean r1 = r1.equalsIgnoreCase(r6) // Catch:{ all -> 0x01bd } if (r1 == 0) goto L_0x0132 byte[] r13 = com.tencent.stat.common.C7598e.m32762b(r14) // Catch:{ all -> 0x01bd } byte[] r14 = com.tencent.stat.common.StatCommonHelper.deocdeGZipContent(r13) // Catch:{ all -> 0x01bd } goto L_0x0151 L_0x0132: java.lang.String r1 = r13.getValue() // Catch:{ all -> 0x01bd } java.lang.String r6 = "gzip" boolean r1 = r1.equalsIgnoreCase(r6) // Catch:{ all -> 0x01bd } if (r1 == 0) goto L_0x0143 byte[] r14 = com.tencent.stat.common.StatCommonHelper.deocdeGZipContent(r14) // Catch:{ all -> 0x01bd } goto L_0x0151 L_0x0143: java.lang.String r13 = r13.getValue() // Catch:{ all -> 0x01bd } boolean r13 = r13.equalsIgnoreCase(r2) // Catch:{ all -> 0x01bd } if (r13 == 0) goto L_0x0151 byte[] r14 = com.tencent.stat.common.C7598e.m32762b(r14) // Catch:{ all -> 0x01bd } L_0x0151: r13 = 200(0xc8, float:2.8E-43) if (r5 != r13) goto L_0x0177 java.lang.String r13 = new java.lang.String // Catch:{ all -> 0x01bd } r13.<init>(r14, r0) // Catch:{ all -> 0x01bd } boolean r14 = com.tencent.stat.StatConfig.isDebugEnable() // Catch:{ all -> 0x01b8 } if (r14 == 0) goto L_0x01b1 com.tencent.stat.common.StatLogger r14 = f25700d // Catch:{ all -> 0x01b8 } java.lang.StringBuilder r0 = new java.lang.StringBuilder // Catch:{ all -> 0x01b8 } r0.<init>() // Catch:{ all -> 0x01b8 } java.lang.String r1 = "http get response data:" r0.append(r1) // Catch:{ all -> 0x01b8 } r0.append(r13) // Catch:{ all -> 0x01b8 } java.lang.String r0 = r0.toString() // Catch:{ all -> 0x01b8 } r14.mo37108i(r0) // Catch:{ all -> 0x01b8 } goto L_0x01b1 L_0x0177: com.tencent.stat.common.StatLogger r13 = f25700d // Catch:{ all -> 0x01bd } java.lang.StringBuilder r14 = new java.lang.StringBuilder // Catch:{ all -> 0x01bd } r14.<init>() // Catch:{ all -> 0x01bd } java.lang.String r0 = "Server response error code:" r14.append(r0) // Catch:{ all -> 0x01bd } r14.append(r5) // Catch:{ all -> 0x01bd } java.lang.String r14 = r14.toString() // Catch:{ all -> 0x01bd } r13.error(r14) // Catch:{ all -> 0x01bd } java.lang.StringBuilder r13 = new java.lang.StringBuilder // Catch:{ all -> 0x01bd } r13.<init>() // Catch:{ all -> 0x01bd } r13.append(r3) // Catch:{ all -> 0x01bd } r13.append(r5) // Catch:{ all -> 0x01bd } java.lang.String r13 = r13.toString() // Catch:{ all -> 0x01bd } java.lang.String r13 = r12.m32793a(r4, r13) // Catch:{ all -> 0x01bd } goto L_0x01b1 L_0x01a1: com.tencent.stat.common.StatLogger r13 = f25700d // Catch:{ all -> 0x01bd } java.lang.String r0 = "Server response no data." r13.mo37103e(r0) // Catch:{ all -> 0x01bd } java.lang.String r13 = "no data" java.lang.String r13 = r12.m32793a(r4, r13) // Catch:{ all -> 0x01bd } org.apache.http.util.EntityUtils.toString(r14) // Catch:{ all -> 0x01b8 } L_0x01b1: if (r15 == 0) goto L_0x01b6 r15.onFBDispatch(r13) L_0x01b6: r13 = 0 goto L_0x01ed L_0x01b8: r14 = move-exception r11 = r14 r14 = r13 r13 = r11 goto L_0x01bf L_0x01bd: r13 = move-exception r14 = r3 L_0x01bf: boolean r0 = r13 instanceof java.lang.OutOfMemoryError // Catch:{ all -> 0x0204 } if (r0 == 0) goto L_0x01c6 java.lang.String r3 = "OOM" goto L_0x01d3 L_0x01c6: boolean r0 = r13 instanceof java.net.UnknownHostException // Catch:{ all -> 0x0204 } if (r0 == 0) goto L_0x01cd java.lang.String r3 = "UnknownHost" goto L_0x01d3 L_0x01cd: boolean r0 = r13 instanceof java.net.SocketTimeoutException // Catch:{ all -> 0x0204 } if (r0 == 0) goto L_0x01d3 java.lang.String r3 = "SocketTimeOut" L_0x01d3: java.lang.StringBuilder r0 = new java.lang.StringBuilder // Catch:{ all -> 0x0204 } r0.<init>() // Catch:{ all -> 0x0204 } r0.append(r3) // Catch:{ all -> 0x0204 } java.lang.String r1 = "exception happen" r0.append(r1) // Catch:{ all -> 0x0204 } java.lang.String r0 = r0.toString() // Catch:{ all -> 0x0204 } java.lang.String r14 = r12.m32793a(r4, r0) // Catch:{ all -> 0x0204 } if (r15 == 0) goto L_0x01ed r15.onFBDispatch(r14) L_0x01ed: if (r13 == 0) goto L_0x0203 com.tencent.stat.common.StatLogger r14 = f25700d r14.error(r13) boolean r14 = r13 instanceof java.lang.OutOfMemoryError if (r14 == 0) goto L_0x01fc java.lang.System.gc() goto L_0x0203 L_0x01fc: boolean r14 = r13 instanceof java.net.UnknownHostException if (r14 == 0) goto L_0x0201 goto L_0x0203 L_0x0201: boolean r13 = r13 instanceof java.net.SocketTimeoutException L_0x0203: return L_0x0204: r13 = move-exception if (r15 == 0) goto L_0x020a r15.onFBDispatch(r14) L_0x020a: throw r13 */ throw new UnsupportedOperationException("Method not decompiled: com.tencent.stat.C7608d.mo37131a(java.lang.String, java.util.Map, com.tencent.stat.StatFBDispatchCallback):void"); } /* access modifiers changed from: 0000 */ /* renamed from: a */ public void mo37127a(int i, int i2, StatFBDispatchCallback statFBDispatchCallback) { String appKey = StatConfig.getAppKey(f25702f); String localMidOnly = MidService.getLocalMidOnly(f25702f); StringBuilder sb = new StringBuilder(); sb.append(m32798c()); sb.append(""); String sb2 = sb.toString(); StringBuilder sb3 = new StringBuilder(); sb3.append(com.tencent.stat.common.Util.decode(StatConstants.FB_KEY)); StringBuilder sb4 = new StringBuilder(); sb4.append("AppKey="); sb4.append(appKey); sb3.append(sb4.toString()); StringBuilder sb5 = new StringBuilder(); sb5.append("Mid="); sb5.append(localMidOnly); sb3.append(sb5.toString()); StringBuilder sb6 = new StringBuilder(); sb6.append("TimeStamp="); sb6.append(sb2); sb3.append(sb6.toString()); String md5sum = StatCommonHelper.md5sum(sb3.toString()); HashMap hashMap = new HashMap(); hashMap.put("AppKey", appKey); hashMap.put("Limit", Integer.toString(i2)); hashMap.put("Mid", localMidOnly); hashMap.put("Offset", Integer.toString(i)); hashMap.put("TimeStamp", sb2); hashMap.put("Sign", md5sum); mo37131a("http://mta.qq.com/mta/api/ctr_feedback/get_feedback", (Map<String, String>) hashMap, statFBDispatchCallback); } /* access modifiers changed from: 0000 */ /* renamed from: a */ public void mo37130a(String str, String str2, StatFBDispatchCallback statFBDispatchCallback) { String appKey = StatConfig.getAppKey(f25702f); String localMidOnly = MidService.getLocalMidOnly(f25702f); StringBuilder sb = new StringBuilder(); sb.append(m32798c()); sb.append(""); String sb2 = sb.toString(); StringBuilder sb3 = new StringBuilder(); sb3.append(com.tencent.stat.common.Util.decode(StatConstants.FB_KEY)); StringBuilder sb4 = new StringBuilder(); sb4.append("AppKey="); sb4.append(appKey); sb3.append(sb4.toString()); StringBuilder sb5 = new StringBuilder(); sb5.append("FeedbackId="); sb5.append(str); sb3.append(sb5.toString()); StringBuilder sb6 = new StringBuilder(); sb6.append("Mid="); sb6.append(localMidOnly); sb3.append(sb6.toString()); StringBuilder sb7 = new StringBuilder(); sb7.append("TimeStamp="); sb7.append(sb2); sb3.append(sb7.toString()); String md5sum = StatCommonHelper.md5sum(sb3.toString()); HashMap hashMap = new HashMap(); hashMap.put("AppKey", appKey); hashMap.put("Mid", localMidOnly); hashMap.put("FeedbackId", str); hashMap.put("Content", str2); hashMap.put("TimeStamp", sb2); hashMap.put("Sign", md5sum); mo37131a("http://mta.qq.com/mta/api/ctr_feedback/reply_feedback", (Map<String, String>) hashMap, statFBDispatchCallback); } /* access modifiers changed from: 0000 */ /* renamed from: b */ public void mo37136b(final List<?> list, final StatDispatchCallback statDispatchCallback) { Handler handler = this.f25704b; if (handler != null) { handler.post(new Runnable() { public void run() { C7608d.this.mo37132a(list, statDispatchCallback); } }); } } /* access modifiers changed from: 0000 */ /* renamed from: b */ public void mo37133b() { System.putString(f25702f.getContentResolver(), "a", "b"); } /* access modifiers changed from: 0000 */ /* renamed from: a */ public void mo37128a(Event event, StatDispatchCallback statDispatchCallback) { mo37136b(Arrays.asList(new String[]{event.toJsonString()}), statDispatchCallback); } /* access modifiers changed from: 0000 */ /* renamed from: a */ public void mo37129a(String str, StatDispatchCallback statDispatchCallback) { mo37136b(Arrays.asList(new String[]{str}), statDispatchCallback); } /* access modifiers changed from: 0000 */ /* renamed from: b */ public void mo37135b(final String str, final String str2, final StatFBDispatchCallback statFBDispatchCallback) { Handler handler = this.f25704b; if (handler != null) { handler.post(new Runnable() { public void run() { StatFBDispatchCallback statFBDispatchCallback; String str = ""; try { str = C7608d.this.mo37125a(str, str2); statFBDispatchCallback = statFBDispatchCallback; if (statFBDispatchCallback == null) { return; } } catch (Exception e) { str = C7608d.this.m32793a(-1, "IOException happen"); e.printStackTrace(); statFBDispatchCallback = statFBDispatchCallback; if (statFBDispatchCallback == null) { return; } } catch (Throwable th) { StatFBDispatchCallback statFBDispatchCallback2 = statFBDispatchCallback; if (statFBDispatchCallback2 != null) { statFBDispatchCallback2.onFBDispatch(str); } throw th; } statFBDispatchCallback.onFBDispatch(str); } }); } } /* access modifiers changed from: 0000 */ /* renamed from: b */ public void mo37134b(final int i, final int i2, final StatFBDispatchCallback statFBDispatchCallback) { Handler handler = this.f25704b; if (handler != null) { handler.post(new Runnable() { public void run() { C7608d.this.mo37127a(i, i2, statFBDispatchCallback); } }); } } /* access modifiers changed from: 0000 */ /* renamed from: c */ public void mo37137c(final String str, final String str2, final StatFBDispatchCallback statFBDispatchCallback) { Handler handler = this.f25704b; if (handler != null) { handler.post(new Runnable() { public void run() { C7608d.this.mo37130a(str, str2, statFBDispatchCallback); } }); } } }
[ "593746220@qq.com" ]
593746220@qq.com
9b358dfefb39604b52a897c40228431866ad69ef
03f414b01f3654c7bcab2b16dcdb587376947e13
/src/com/apecat/shoppingadvisor/migrated/AmbientLightManager.java
c32e4028d11bdf8d34046408890ad8397b80da10
[]
no_license
nasirk49/ShoppingAdvisor
1664a287ff080e15128f3dc1d0a47b631a51eb25
d022389685344a69f38e8ea76d4ca1f5ec6137b3
refs/heads/master
2016-09-10T15:57:20.625091
2014-04-23T12:55:03
2014-04-23T12:55:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,976
java
package com.apecat.shoppingadvisor.migrated; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import com.google.zxing.client.android.camera.CameraManager; public final class AmbientLightManager implements SensorEventListener { private static final float TOO_DARK_LUX = 45.0f; private static final float BRIGHT_ENOUGH_LUX = 450.0f; private final Context context; private CameraManager cameraManager; private Sensor lightSensor; public AmbientLightManager(Context context) { this.context = context; } public void start(CameraManager cameraManager) { this.cameraManager = cameraManager; SensorManager sensorManager = (SensorManager) context .getSystemService(Context.SENSOR_SERVICE); lightSensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT); if (lightSensor != null) { sensorManager.registerListener(this, lightSensor, SensorManager.SENSOR_DELAY_NORMAL); } } public void stop() { if (lightSensor != null) { SensorManager sensorManager = (SensorManager) context .getSystemService(Context.SENSOR_SERVICE); sensorManager.unregisterListener(this); cameraManager = null; lightSensor = null; } } @Override public void onSensorChanged(SensorEvent sensorEvent) { float ambientLightLux = sensorEvent.values[0]; if (cameraManager != null) { if (ambientLightLux <= TOO_DARK_LUX) { cameraManager.setTorch(true); } else if (ambientLightLux >= BRIGHT_ENOUGH_LUX) { cameraManager.setTorch(false); } } } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { // do nothing } }
[ "nasir.kujrakovic@gmail.com" ]
nasir.kujrakovic@gmail.com
f99c8cbe43b61d9458916b8fb2f9ae089d6cc069
e2df03554a0bdcb32ce30b8c657375d9cb36a626
/arc-core/src/io/anuke/arc/input/InputEventQueue.java
559c335958132fe832f77442bfc959c1b809afb4
[]
no_license
todun/Arc-2
4dbd5b2efb616b13cfedebba875bb45b7715fad0
c7f3d8125c8d13c0a31c5f14fdabdb3d0efbd676
refs/heads/master
2020-09-21T10:07:44.440002
2019-11-26T04:48:28
2019-11-26T04:48:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,641
java
package io.anuke.arc.input; import io.anuke.arc.collection.IntArray; import io.anuke.arc.util.Time; /** * Queues events that are later passed to the wrapped {@link InputProcessor}. * @author Nathan Sweet */ public class InputEventQueue implements InputProcessor{ static private final int SKIP = -1; static private final int KEY_DOWN = 0; static private final int KEY_UP = 1; static private final int KEY_TYPED = 2; static private final int TOUCH_DOWN = 3; static private final int TOUCH_UP = 4; static private final int TOUCH_DRAGGED = 5; static private final int MOUSE_MOVED = 6; static private final int SCROLLED = 7; private final IntArray queue = new IntArray(); private final IntArray processingQueue = new IntArray(); private InputProcessor processor; private long currentEventTime; public InputEventQueue(){ } public InputEventQueue(InputProcessor processor){ this.processor = processor; } public InputProcessor getProcessor(){ return processor; } public void setProcessor(InputProcessor processor){ this.processor = processor; } public void drain(){ synchronized(this){ if(processor == null){ queue.clear(); return; } processingQueue.addAll(queue); queue.clear(); } int[] q = processingQueue.items; InputProcessor localProcessor = processor; for(int i = 0, n = processingQueue.size; i < n; ){ int type = q[i++]; currentEventTime = (long)q[i++] << 32 | q[i++] & 0xFFFFFFFFL; switch(type){ case SKIP: i += q[i]; break; case KEY_DOWN: localProcessor.keyDown(KeyCode.byOrdinal(q[i++])); break; case KEY_UP: localProcessor.keyUp(KeyCode.byOrdinal(q[i++])); break; case KEY_TYPED: localProcessor.keyTyped((char)q[i++]); break; case TOUCH_DOWN: localProcessor.touchDown(q[i++], q[i++], q[i++], KeyCode.byOrdinal(q[i++])); break; case TOUCH_UP: localProcessor.touchUp(q[i++], q[i++], q[i++], KeyCode.byOrdinal(q[i++])); break; case TOUCH_DRAGGED: localProcessor.touchDragged(q[i++], q[i++], q[i++]); break; case MOUSE_MOVED: localProcessor.mouseMoved(q[i++], q[i++]); break; case SCROLLED: localProcessor.scrolled(q[i++] / 256f, q[i++] / 256f); break; default: throw new RuntimeException(); } } processingQueue.clear(); } private synchronized int next(int nextType, int i){ int[] q = queue.items; for(int n = queue.size; i < n; ){ int type = q[i]; if(type == nextType) return i; i += 3; switch(type){ case SKIP: i += q[i]; break; case KEY_DOWN: i++; break; case KEY_UP: i++; break; case KEY_TYPED: i++; break; case TOUCH_DOWN: i += 4; break; case TOUCH_UP: i += 4; break; case TOUCH_DRAGGED: i += 3; break; case MOUSE_MOVED: i += 2; break; case SCROLLED: i += 2; break; default: throw new RuntimeException(); } } return -1; } private void queueTime(){ long time = Time.nanos(); queue.add((int)(time >> 32)); queue.add((int)time); } public synchronized boolean keyDown(KeyCode keycode){ queue.add(KEY_DOWN); queueTime(); queue.add(keycode.ordinal()); return false; } public synchronized boolean keyUp(KeyCode keycode){ queue.add(KEY_UP); queueTime(); queue.add(keycode.ordinal()); return false; } public synchronized boolean keyTyped(char character){ queue.add(KEY_TYPED); queueTime(); queue.add(character); return false; } public synchronized boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){ queue.add(TOUCH_DOWN); queueTime(); queue.add(screenX); queue.add(screenY); queue.add(pointer); queue.add(button.ordinal()); return false; } public synchronized boolean touchUp(int screenX, int screenY, int pointer, KeyCode button){ queue.add(TOUCH_UP); queueTime(); queue.add(screenX); queue.add(screenY); queue.add(pointer); queue.add(button.ordinal()); return false; } public synchronized boolean touchDragged(int screenX, int screenY, int pointer){ // Skip any queued touch dragged events for the same pointer. for(int i = next(TOUCH_DRAGGED, 0); i >= 0; i = next(TOUCH_DRAGGED, i + 6)){ if(queue.get(i + 5) == pointer){ queue.set(i, SKIP); queue.set(i + 3, 3); } } queue.add(TOUCH_DRAGGED); queueTime(); queue.add(screenX); queue.add(screenY); queue.add(pointer); return false; } public synchronized boolean mouseMoved(int screenX, int screenY){ // Skip any queued mouse moved events. for(int i = next(MOUSE_MOVED, 0); i >= 0; i = next(MOUSE_MOVED, i + 5)){ queue.set(i, SKIP); queue.set(i + 3, 2); } queue.add(MOUSE_MOVED); queueTime(); queue.add(screenX); queue.add(screenY); return false; } public synchronized boolean scrolled(float amountX, float amountY){ queue.add(SCROLLED); queueTime(); queue.add((int)(amountX * 256)); queue.add((int)(amountY * 256)); return false; } public long getCurrentEventTime(){ return currentEventTime; } }
[ "arnukren@gmail.com" ]
arnukren@gmail.com
6caca84179bb3e570125f6b65f9fcda86783a7dd
06524e70cf835526f93794b2c4d11cf78bc5d7d2
/AR projects/DroidAR/app/src/main/java/com/example/kirti_pc/droidar/commands/system/CameraSetARInputCommand.java
f49e3028013cef9a955b551bc161e65438847cf3
[]
no_license
KirtiVarinda/Projects
3dcb96e4e689ce61d515baa7eacc475094919063
4b01814ca04e5159cd82ea8a5136fb8ae9df122d
refs/heads/master
2021-01-22T04:22:52.149201
2017-02-10T07:57:53
2017-02-10T07:57:53
81,534,494
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.example.kirti_pc.droidar.commands.system; import gl.GLCamera; import commands.undoable.UndoableCommand; public class CameraSetARInputCommand extends UndoableCommand { private GLCamera myTargetCamera; private boolean valueToSet; private boolean backupValue; public CameraSetARInputCommand(GLCamera targetCamera, boolean valueToSet) { myTargetCamera = targetCamera; this.valueToSet = valueToSet; } @Override public boolean override_do() { backupValue = myTargetCamera.isSensorInputEnabled(); myTargetCamera.setSensorInputEnabled(valueToSet); myTargetCamera.resetBufferedAngle(); // TODO do this here? return true; } @Override public boolean override_undo() { myTargetCamera.setSensorInputEnabled(backupValue); return true; } }
[ "keeruvarinda@gmail.com" ]
keeruvarinda@gmail.com
0deb8e1dae0e3cc4a77c3570762e9b5cd7b8585e
bb00218751de6abc0ab9482c71d59856024bca34
/Java/Strings/StringTokens.java
b2056076e93f1453e5c9907cc370e12ceea728ef
[]
no_license
sapayth/HackerRank
dac45117b96c7c3c7066190c9ab3c15c67510022
f369368ec14150ee4a9b01dec95cd5fb0bb011b7
refs/heads/master
2021-01-22T09:47:46.849779
2017-09-17T17:18:41
2017-09-17T17:18:41
102,153,574
0
0
null
null
null
null
UTF-8
Java
false
false
646
java
/* * Sapayth Hossain */ package Java.Strings; import java.util.Scanner; /* * @author sapaythhossain */ public class StringTokens { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); // Write your code here. s = s.trim(); if (s.length() == 0) { System.out.println(0); } else { String[] tokens = s.split("[_@ !,?.']+"); System.out.println(tokens.length); for (String token : tokens) { System.out.println(token); } } scan.close(); } }
[ "safayet.qubee@gmail.com" ]
safayet.qubee@gmail.com
9a986e267bf28e6abb7fe10f5ea32a16e8c64882
e839bc772e34e696ca96b43125f892a5e9938574
/app/src/main/java/com/chhd/mobliebutler/adapter/AppAdapter.java
a2eba6cdeef1bc75ab1dbeae3223337044fb8633
[]
no_license
trenail/MoblieButler
5e74493fa8c98b4434fc28dfe9932b4e708b7242
38a8d904a101ef5ee2a8d02453828ddc24b82e14
refs/heads/master
2020-04-14T10:58:22.332604
2018-01-20T10:53:44
2018-01-20T10:53:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,432
java
package com.chhd.mobliebutler.adapter; import android.content.Context; import android.graphics.Color; import android.text.format.Formatter; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.baoyz.swipemenulistview.BaseSwipListAdapter; import com.chhd.mobliebutler.R; import com.chhd.mobliebutler.entity.App; import com.lidroid.xutils.ViewUtils; import com.lidroid.xutils.view.annotation.ViewInject; import java.util.List; import java.util.Random; /** * Created by CWQ on 2016/8/26. */ public class AppAdapter extends BaseSwipListAdapter { private Context context; private List<App> userApps; private Random random; public AppAdapter(Context context, List<App> userApps) { this.context = context; this.userApps = userApps; random = new Random(); } @Override public int getCount() { return userApps.size(); } @Override public App getItem(int position) { return userApps.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { convertView = View.inflate(context, R.layout.list_item_app_manager, null); viewHolder = new ViewHolder(convertView); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } App app = getItem(position); viewHolder.ivIcon.setImageDrawable(app.getIcon()); viewHolder.tvName.setText(app.getName()); viewHolder.tvRomSize.setText(Formatter.formatFileSize(context, app.getRomSize())); int red = 30 + random.nextInt(201); int green = 30 + random.nextInt(201); int blue = 30 + random.nextInt(201); viewHolder.view.setBackgroundColor(Color.rgb(red, green, blue)); return convertView; } static class ViewHolder { @ViewInject(R.id.iv_icon) ImageView ivIcon; @ViewInject(R.id.tv_name) TextView tvName; @ViewInject(R.id.tv_romSize) TextView tvRomSize; @ViewInject(R.id.view) View view; public ViewHolder(View view) { ViewUtils.inject(this, view); } } }
[ "conghuahuadan@163.com" ]
conghuahuadan@163.com
6367497e167a9d8692b8be4babcf216dcbc85560
e1a3105fa6f7eb2643192c392fae16b5df2984a4
/Day_0.java
4cb8e2abb509c2eda509ea350eebb6d621f75fac
[]
no_license
rushirg/Hackerrank-30-Days-of-Code-Challenges
0d2e3e3259be101221abc1ddae0f344edd151f8a
6e8f5c06653868f166326dfaf17ddbc1896a193a
refs/heads/master
2021-01-11T22:40:25.394339
2019-11-09T04:44:03
2019-11-09T04:44:03
79,011,064
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); // use the Scanner class to read from stdin String inputString = scan.nextLine(); // read a line of input and save it to a variable scan.close(); // close the scanner // Your first line of output goes here System.out.println("Hello, World."); System.out.println(inputString); // Write the second line of output } }
[ "rushi.rg@gmail.com" ]
rushi.rg@gmail.com
d284f8ba775c88905be481f1562967c9f5670b83
c674b01aeb1969c35abbafd7a890621a7d2a5a35
/src/Assignment4/one.java
ec11d6df792fa9454200897db25c9a950011443a
[]
no_license
Venkteshwar99/CoreJavaAssignments
e29be57f978902152394752556fdc3987ce662eb
23c2a5ea1d5b49e6efbfdbefb2c8cdc6d1abcf2f
refs/heads/master
2023-08-30T06:37:05.847451
2021-11-15T07:47:01
2021-11-15T07:47:01
423,212,717
0
0
null
2021-11-10T13:08:16
2021-10-31T17:18:38
Java
UTF-8
Java
false
false
417
java
package Assignment4; import java.io.*; import java.util.Scanner; public class one { // Arithmetic ecxeption handling with try catch public static void main(String[] args) { int a = 5; int b = 0; try { System.out.println(a / b); // throw Exception } catch (ArithmeticException e) { // Exception handler System.out.println( "Divided by zero operation cannot possible"); } } }
[ "venkateshagnihotri9926@gmail.com" ]
venkateshagnihotri9926@gmail.com
79563c900c7886b0d853caf595a4c9001385185b
1d6b9ad5c7abf6bf191555254c5da75b29fcc4cb
/Monitor.java
ed003c0775122890cb4056917c1c80adbd9cf5a2
[]
no_license
adiljay05/Student-Classroom-Simulator
7a852e66aa3c17a25c6b185c15b05a3c6cc8410e
833eefe8878c4ed513e7e3b1d34ad1c0a5e7821b
refs/heads/main
2023-06-03T20:26:45.006880
2021-06-20T07:30:10
2021-06-20T07:30:10
378,585,446
0
0
null
null
null
null
UTF-8
Java
false
false
1,130
java
package Assignment01; public class Monitor extends Thread { public Classroom[] classroom; Monitor(Classroom[] classroom) { this.classroom = classroom; } static int counter = 1; @Override public void run() { System.out.println(" ----------------------------- ("+counter+++") ---------------------------------"); for (Classroom c : classroom) { System.out.print(c.className); if (c.lecturer != null) System.out.print("\t\t" + c.lecturer); //if there is some lecturer, print his name else System.out.print("\t\tfalse"); //else print false for lecturer name on output System.out.print("\t\t" + c.inClass + "\t\t"); //inClass either true or false, just print it. if (c.lecturer != null) System.out.print(c.filled); //count of students in the class if (c.lecturer != null) System.out.print("\t\t\t" + c.filledVisitor); //count of visitors in class if (c.inClass && c.lecturer == null) System.out.print("No Professor Assigned to this class yet"); System.out.println(); } } }
[ "adiljay05@gmail.com" ]
adiljay05@gmail.com
29817363429bb15c2ac3619defafcaa4d910399f
4042c9a4f4ecac35905277d161041afe57d45a85
/app/src/main/java/com/snbc/updateinstall/MainActivity.java
ceec13e3e171a76b5c4d4d2330cd3321ad5705d5
[]
no_license
zzggxx/Updateinstall
366f36f8e6a8d96ad2e39cb3207f7b2a12e9c7b3
1e340492168a63812d0e3309e8aa84c26edaab73
refs/heads/master
2022-12-14T01:08:52.180257
2020-09-16T07:51:49
2020-09-16T07:51:49
294,330,477
0
0
null
null
null
null
UTF-8
Java
false
false
5,850
java
package com.snbc.updateinstall; import android.content.Context; import android.content.Intent; import android.content.pm.PackageInfo; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.util.Log; import android.view.View; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Timer; import java.util.TimerTask; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.FileProvider; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = MainActivity.class.getName(); private String mApkPath; // TODO: 2020/9/16 assets资产目录想存放com.magugi.enterprise.apk和app-release.apk文件 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 应用安装,注意都需要release版本. // mApkPath = getFilesDir().getAbsolutePath() + File.separator + "app-release.apk"; mApkPath = getFilesDir().getAbsolutePath() + File.separator + "com.magugi.enterprise.apk"; Log.i(TAG, "onCreate,mApkPath: " + mApkPath); if (!new File(mApkPath).exists()) { copyApk(); } findViewById(R.id.install_apk).setOnClickListener(this); List<PackageInfo> installedPackages = getPackageManager().getInstalledPackages(0); for (int i = 0; i < installedPackages.size(); i++) { if (installedPackages.get(i).packageName.equals("com.snbc.androidtest")) { Log.i(TAG, "onCreate: --" + installedPackages.get(i).packageName); } } } private void copyApk() { try { // InputStream open = getAssets().open("app-release.apk"); InputStream open = getAssets().open("com.magugi.enterprise.apk"); FileOutputStream outputStream = new FileOutputStream(new File(mApkPath)); byte[] buff = new byte[(int) (1024 * 0.5)]; int len = 0; while ((len = (open.read(buff))) != -1) { outputStream.write(buff, 0, len); } open.close(); outputStream.close(); } catch (IOException e) { e.printStackTrace(); } new Timer().schedule(new TimerTask() { @Override public void run() { } }, 1000); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.install_apk: // installApk7x(this,new File(mApkPath),"com.snbc.updateinstall.fileProvider"); // 7.0 // installApk7x(this,new File(mApkPath),"com.magugi.enterprise.fileProvider"); // 8.0 // installApk(mApkPath); Intent intent = new Intent(); // intent.setAction("com.snbc.androidtest.VoiceTestActivity"); // intent.addCategory("android.intent.category.DEFAULT"); intent.setAction("com.snbc.androidtest.MainActivity"); intent.addCategory("android.intent.category.DEFAULT"); startActivity(intent); break; } } /** * Android 7.x 安装APK,需要配置FileProvider * * @param context 上下文 * @param file 要安装的APK文件 * @param authority FileProvider配置的authority */ public void installApk7x(Context context, File file, String authority) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_INSTALL_PACKAGE); Uri uri = FileProvider.getUriForFile(context, authority, file); // 通过FileProvider获取Uri intent.setDataAndType(uri, "application/vnd.android.package-archive");// APK的MimeType intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 在新栈中启动 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // 授权读取URI权限 context.startActivity(intent); } private void installApk(String apkPath) { Intent intent = new Intent(Intent.ACTION_VIEW); // apk path File apkFile = new File(apkPath); // 兼容7.0 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); Uri contentUri = FileProvider.getUriForFile(this, "com.magugi.enterprise.fileProvider", apkFile); intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); // 兼容8.0(安装位置的apk权限) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { boolean hasInstallPermission = getPackageManager().canRequestPackageInstalls(); if (!hasInstallPermission) { startInstallPermissionSettingActivity(); return; } } } else { intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } if (getPackageManager().queryIntentActivities(intent, 0).size() > 0) { startActivity(intent); } } /** * 跳转到设置-允许安装未知来源-页面 */ @RequiresApi(api = Build.VERSION_CODES.O) private void startInstallPermissionSettingActivity() { //注意这个是8.0新API Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }
[ "zhougaoxiongcall@163.com" ]
zhougaoxiongcall@163.com
5f0a765059b92407b40b83b073c0c79d4b65c9c8
252100216ed64209cc8a853d9d97a8cc280a58e6
/src/javasource/communitycommons/actions/GenerateThumbnail.java
b2fc6db4dd1a687ade31c548573cab126339324c
[ "Apache-2.0" ]
permissive
deepanagaraj/UnitTesting
a0a24e7380582823312b96760ad818290682db6b
0dc5d2771773b20f60af3b0591c54ebac035ccbe
refs/heads/master
2020-12-25T19:58:37.857153
2014-08-28T12:25:41
2014-08-28T12:25:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,595
java
// This file was generated by Mendix Business Modeler. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments. package communitycommons.actions; import java.awt.image.BufferedImage; import java.io.InputStream; import javax.imageio.ImageIO; import com.mendix.core.Core; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.systemwideinterfaces.core.IMendixObject; import com.mendix.webui.CustomJavaAction; /** * Generates a thumbnail for a source object that preserves aspect ratio. Some borders might be clipped to achieve this. * * If the thumbnail is larger than the source image, the image will not be upscaled, but use transparent borders instead * * Note: requires cloud security to be disabled * (please file a support ticket if this is needed, we can change this but might loose backward compatibility with Mendix 3.x) */ public class GenerateThumbnail extends CustomJavaAction<Boolean> { private IMendixObject __sourceObj; private system.proxies.Image sourceObj; private Long thumbnailWidth; private Long thumbnailHeight; public GenerateThumbnail(IContext context, IMendixObject sourceObj, Long thumbnailWidth, Long thumbnailHeight) { super(context); this.__sourceObj = sourceObj; this.thumbnailWidth = thumbnailWidth; this.thumbnailHeight = thumbnailHeight; } @Override public Boolean executeAction() throws Exception { this.sourceObj = __sourceObj == null ? null : system.proxies.Image.initialize(getContext(), __sourceObj); // BEGIN USER CODE InputStream is = Core.getImage(getContext(), sourceObj.getMendixObject(), false); BufferedImage img = ImageIO.read(is); int tw = (int)(long)thumbnailWidth; int th = (int)(long)thumbnailHeight; int sx1, sx2, sy1, sy2, dx1, dx2, dy1, dy2; //Source is smaller than target image? Do not upscale, just center if (img.getWidth() < tw || img.getHeight() < th) { sx1 = 0; sy1 = 0; sx2 = img.getWidth(); sy2 = img.getHeight(); //draw in center dx1 = (tw - img.getWidth()) / 2; dx2 = dx1 + img.getWidth(); dy1 = (th - img.getHeight()) / 2; dy2 = dy1 + img.getHeight(); } else { double resizeFactor = Math.min(img.getWidth() / tw, img.getHeight() / th); sx1 = (int)((img.getWidth() - tw * resizeFactor) / 2); sx2 = (int)(sx1 + tw * resizeFactor); sy1 = (int)((img.getHeight() - th * resizeFactor) / 2); sy2 = (int)(sy1 + th * resizeFactor); dx1 = 0; dx2 = tw; dy1 = 0; dy2 = th; } BufferedImage dstImage = new BufferedImage(tw, th, BufferedImage.TYPE_INT_ARGB); dstImage.getGraphics().drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null); throw new IllegalStateException("It is not possible to write thumbnail contents yet in Mendix 5"); //MWE: there is no Core api to just write the thumbnail stream, so lets do thet ourselves... //TODO: //Core.storeImageThumbnailContent(dstImage); //ImageIO.write(dstImage, "png", Corenew File(thumbfile)); //return true; // END USER CODE } /** * Returns a string representation of this action */ @Override public String toString() { return "GenerateThumbnail"; } // BEGIN EXTRA CODE // END EXTRA CODE }
[ "mweststrate@gmail.com" ]
mweststrate@gmail.com
fb10e5af4e40597dae56de84dd204fab954dad90
e39e229364fca8ca5429496a13835cb3cf0fa681
/assignment2/ebean-backend/app/controllers/HomeController.java
67cc94e71dca7ea97fe3ef0b095efda2de76403b
[]
no_license
yanansun2020/s20-soc
ae5a4dbb971ca6a99a8777e2efe8762580c7b5aa
57f3442a8d7f790e0b71254daa5d3faa3b58eb80
refs/heads/master
2022-07-08T00:53:38.684104
2022-05-24T17:30:23
2022-05-24T17:30:23
241,718,333
0
0
null
2022-06-21T04:27:53
2020-02-19T20:26:57
Java
UTF-8
Java
false
false
5,123
java
package controllers; import com.fasterxml.jackson.databind.JsonNode; import models.Publication; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import play.libs.Json; import play.mvc.*; import service.ALtLot; import service.PubAuthorService; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * This controller contains an action to handle HTTP requests * to the application's home page. */ public class HomeController extends Controller { public Result index() { return ok(Json.toJson("Welcome to backend!")); } /** * 1.1 Given author name A, list all of her co-authors. * @param author * @return */ PubAuthorService pubAuthorService = new PubAuthorService(); public Result coAuthors(String author) { System.out.print("====req " + author); Set<String> result = pubAuthorService.getCoAuthors(author); return ok(Json.toJson(result)); } /** * 1.2 Given a paper name (i.e., title), list its publication metadata. * @return */ public Result publicationsByTitle(String title) { System.out.print("====req " + title); Publication publications= pubAuthorService.getPublications(title); if(publications == null){ return ok(Json.toJson(new Publication())); } return ok(Json.toJson(publications)); } /** * 1.3 Given a journal name and a year (volume) and an issue (number), * find out the metadata of all the papers published in the book (means the volume+number of the journal). * @param journal * @param volume * @param number * @return */ public Result getByVolumeAndNumber(String journal, String volume, String number) { List<Publication> publications= pubAuthorService.getByVolumeAndNumber(journal, volume, number); if(CollectionUtils.isEmpty(publications)){ return ok(Json.toJson(new ArrayList<>())); } return ok(Json.toJson(publications)); } /** * 1.4 Display all the article titles published in the area of SOC; * @return */ public Result getAllSOCArticleTitles() { List<String> publications= pubAuthorService.getAllSOCArticleTitles(); if(CollectionUtils.isEmpty(publications)){ return ok(Json.toJson(new ArrayList<>())); } return ok(Json.toJson(publications)); } /** * 1.5 Display the titles of the articles published by a researcher in a specific year; * TODO xquery * @param researcher * @param year * @return */ public Result getByResearcherAndYear(String researcher, String year) { List<String> publications= pubAuthorService.getByResearcherAndYear(researcher, year); if(CollectionUtils.isEmpty(publications)){ return ok(Json.toJson(new ArrayList<>())); } return ok(Json.toJson(publications)); } /** * 1.6 Display all the authors who have published more than 10 papers in the area of SOC to date * TODO xquery * @return */ public Result getAuthors() { List<String> publications= pubAuthorService.getAuthors(); if(CollectionUtils.isEmpty(publications)){ return ok(Json.toJson(new ArrayList<>())); } return ok(Json.toJson(publications)); } /** * 2.1 Given a researcher's name and a year, list all published papers' metadata; * @param researcher * @param year * @return */ public Result getPubByResearcherAndYear(String researcher, String year) { if(StringUtils.isEmpty(researcher) || StringUtils.isEmpty(year)){ return ok(Json.toJson(new ArrayList<>())); } List<Publication> publications= pubAuthorService.getPubByResearcherAndYear(researcher, year); if(CollectionUtils.isEmpty(publications)){ return ok(Json.toJson(new ArrayList<>())); } return ok(Json.toJson(publications)); } /** * 2.2 For the productive authors (e.g., published more than 10 papers) * in the area of SOC, list all of their co-authors; * @return */ public Result getCoAuthorsOfProductiveAuthors() { List<String> publications= pubAuthorService.getCoAuthorsOfProductiveAuthors(); if(CollectionUtils.isEmpty(publications)){ return ok(Json.toJson(new ArrayList<>())); } return ok(Json.toJson(publications)); } /** * 2.3 Given a conference name, and a range of years (between 2003-2019), mark the locations of where the conference was held in a map. * @param conferenceName * @param startYear * @param endYear * @return */ public Result getAltLot(String conferenceName, String startYear, String endYear) { List<ALtLot> publications= pubAuthorService.getAltLot(conferenceName, startYear, endYear); if(CollectionUtils.isEmpty(publications)){ return ok(Json.toJson(new ArrayList<>())); } return ok(Json.toJson(publications)); } }
[ "sunyanan1@xiaomi.com" ]
sunyanan1@xiaomi.com
46970c9a96c4546051a3140a9cd53b7db883b961
a5e6b8d3c7d8e57a52c3abe514f14ffa2c6465c4
/src/com/example/androidexamples/storage_and_theme/SaveAsFragment.java
6e7809c458312d6be68fd935eb8f92bf6a2c3b56
[ "Apache-2.0" ]
permissive
sidec15/AndroidExamples
3bbb0f9089b97cc10c90f89cccacb30f66011dfd
16ce6467b257cf9b71276d1021951527c24d9e54
refs/heads/master
2023-01-24T11:04:08.661339
2014-12-11T00:28:56
2014-12-11T00:28:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,856
java
/** * SaveAsFragment.java */ package com.example.androidexamples.storage_and_theme; import java.util.zip.Inflater; import com.example.androidexamples.R; import android.R.bool; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.Toast; /** * @author Simone * 09/feb/2013 */ public class SaveAsFragment extends DialogFragment implements OnClickListener { //ATTRIBUTES private String fileName; private String[] existingFiles; private SaveAsFragmentListener owner; private EditText editText_fileName; //METHODS /* (non-Javadoc) * @see android.support.v4.app.DialogFragment#onCreateDialog(android.os.Bundle) */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder=new AlertDialog.Builder(getActivity()); builder.setCancelable(true); LayoutInflater layoutInflater=(LayoutInflater) getActivity().getLayoutInflater(); View dialogContent=layoutInflater.inflate(R.layout.storage_and_theme_save_as_dialog, null); editText_fileName=(EditText) getActivity().findViewById(R.id.editText_dialog_save_as); builder.setTitle(R.string.saveAsFileDialogMessage); builder.setPositiveButton(R.string.save, this); builder.setNeutralButton(R.string.cancel, this); builder.setView(dialogContent); existingFiles=getActivity().fileList(); fileName=null; return builder.create(); } /* (non-Javadoc) * @see android.content.DialogInterface.OnClickListener#onClick(android.content.DialogInterface, int) */ @SuppressWarnings("static-access") @Override public void onClick(DialogInterface dialog, int which) { if(which==dialog.BUTTON_POSITIVE) { fileName=editText_fileName.getText().toString(); if(!fileName.endsWith(".txt")) fileName+=".txt"; //check if files already exist if(indexOf(existingFiles, fileName)>=0) {//file alredy exist --> ask for the overwriting AlertDialog.Builder builder=new AlertDialog.Builder(getActivity()); builder.setCancelable(true); builder.setTitle(R.string.warning); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setMessage(getString(R.string.FileOverwritingConfirmation)); builder.setPositiveButton(R.string.yes, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); owner.onSave(fileName); } }); builder.setNegativeButton(R.string.no, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); //Toast.makeText(getActivity(), R.string.SetDifferentFileName, Toast.LENGTH_LONG).show(); } }); // create alert dialog AlertDialog alertDialog = builder.create(); // show it alertDialog.show(); }else//file doesn't exist owner.onSave(fileName); }else//no file to save owner.onSave(null); } //INTERFACES @Override public void onAttach(android.app.Activity activity) { super.onAttach(activity); //check if the activity attached implements the requested interface try { owner=(SaveAsFragmentListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement " + SaveAsFragmentListener.class.getSimpleName()); } }; public interface SaveAsFragmentListener{ void onSave(String fileName); } private int indexOf(Object v[], Object o) { if(v==null || o==null) return -1; for(int i=0;i<v.length;i++) { if(v[i]!=null && v[i].equals(o)) return i; } return -1; } }
[ "simone.decristofaro85@gmail.com" ]
simone.decristofaro85@gmail.com
7d537c8715aab33585aa0d08875ca98fe2606008
c5083c141a74aa0512f7286acf4b7f795b191c98
/spring-roo/src/main/java/net/eyelock/sakila/services/CountryService.java
59c3732b7cf770e1050e5f2f6cd6746ab01793d7
[]
no_license
eyelock/sakila-samples
51288a53edfb067579848cf34358a96ac65b0d80
ac056ca93ef8e551fe68e623a884d2433a3488e6
refs/heads/master
2016-09-09T21:10:49.878985
2014-05-03T00:11:22
2014-05-03T00:11:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package net.eyelock.sakila.services; import org.springframework.roo.addon.layers.service.RooService; @RooService(domainTypes = { net.eyelock.sakila.domain.Country.class }) public interface CountryService { }
[ "dcollie@adobe.com" ]
dcollie@adobe.com
1adfcc360cb97dd913451a676d8deb3e8460bdac
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/3/3_ac3176fdadb984ecdfebbd831a9e1a153cf773cb/RiemannReporter/3_ac3176fdadb984ecdfebbd831a9e1a153cf773cb_RiemannReporter_s.java
87cfba32bad5992638ba71c7d141bee48ef1f5a6
[]
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
10,236
java
package com.yammer.metrics.reporting; import com.aphyr.riemann.client.*; import com.yammer.metrics.Metrics; import com.yammer.metrics.core.*; import com.yammer.metrics.stats.Snapshot; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.net.InetSocketAddress; import java.util.Map.Entry; import java.util.SortedMap; import java.util.concurrent.TimeUnit; public class RiemannReporter extends AbstractPollingReporter implements MetricProcessor<Long> { private static final Logger LOG = LoggerFactory.getLogger(RiemannReporter.class); protected final Clock clock; protected final MetricPredicate predicate; protected final RiemannClient riemann; protected final String prefix; protected final String separator; protected final VirtualMachineMetrics vm; public boolean printVMMetrics = true; protected final String localHost; public static class Config { public MetricsRegistry metricsRegistry = Metrics.defaultRegistry(); public MetricPredicate predicate = MetricPredicate.ALL; public boolean printVMMetrics = false; public String host = "localhost"; public int port = 5555; public long period = 60; public TimeUnit unit = TimeUnit.SECONDS; public String prefix = null; public String separator = " "; public final VirtualMachineMetrics vm = VirtualMachineMetrics.getInstance(); public Clock clock = Clock.defaultClock(); public String name = "riemann-reporter"; public String localHost = null; public Config() {} public Config metricsRegistry(MetricsRegistry r) { metricsRegistry = r; return this; } public Config predicate(MetricPredicate p) { predicate = p; return this; } public Config printVMMetrics(Boolean p) { printVMMetrics = p; return this; } public Config host(String h) { host = h; return this; } public Config port(int p) { port = p; return this; } public Config period(long p) { period = p; return this; } public Config unit(TimeUnit t) { unit = t; return this; } public Config prefix(String p) { prefix = p; return this; } public Config separator(String s) { separator = s; return this; } public Config clock(Clock c) { clock = c; return this; } public Config name (String n) { name = n; return this; } public Config localHost (String l) { localHost = l; return this; } } public static Config config() { return new Config(); } public static void enable(Config config) { try { final RiemannReporter reporter = new RiemannReporter(config); reporter.start(config.period, config.unit); } catch (Exception e) { LOG.error("Error creating/starting Riemann reporter: ", e); } } public RiemannReporter(Config c) throws IOException { super(c.metricsRegistry, c.name); this.riemann = new RiemannClient(new InetSocketAddress(c.host, c.port)); riemann.connect(); this.predicate = c.predicate; this.printVMMetrics = c.printVMMetrics; this.prefix = c.prefix; if (null != c.separator) // if (true) keep " " this.separator = c.separator; this.vm = c.vm; this.clock = c.clock; this.localHost = c.localHost; } @Override public void run() { try { final long epoch = clock.time() / 1000; if (this.printVMMetrics) { sendVMMetrics(epoch); } sendRegularMetrics(epoch); } catch (Exception e) { LOG.warn("Error writing to Riemann", e); } } protected void sendRegularMetrics(final Long epoch) { for (Entry<String,SortedMap<MetricName,Metric>> entry : getMetricsRegistry().groupedMetrics(predicate).entrySet()) { for (Entry<MetricName, Metric> subEntry : entry.getValue().entrySet()) { final Metric metric = subEntry.getValue(); if (metric != null) { try { metric.processWith(this, subEntry.getKey(), epoch); } catch (Exception ignored) { LOG.error("Error sending regular metric:", ignored); } } } } } private EventDSL newEvent() { EventDSL event = riemann.event(); if (localHost != null) { event.host(localHost); } return event; } // The service name for a given metric. public String service(MetricName name, String... rest) { final StringBuilder sb = new StringBuilder(); if (null != prefix) { sb.append(prefix).append(separator); } sb.append(name.getGroup()) .append(separator) .append(name.getType()) .append(separator); if (name.hasScope()) { sb.append(name.getScope()) .append(separator); } sb.append(name.getName()); for (String part : rest) { sb.append(separator); sb.append(part); } return sb.toString(); } public String service(String... parts) { final StringBuilder sb = new StringBuilder(); if (null != prefix) { sb.append(prefix).append(separator); } for (String p : parts) { sb.append(p).append(separator); } return sb.substring(0, sb.length() - separator.length()); } @Override public void processGauge(MetricName name, Gauge<?> gauge, Long epoch) { Object v = gauge.value(); EventDSL e = newEvent().service(service(name)).time(epoch); if (v instanceof Integer) { e.metric((Integer) v).send(); } else if (v instanceof Long) { e.metric((Long) v).send(); } else if (v instanceof Double) { e.metric((Double) v).send(); } else if (v instanceof Float) { e.metric((Float) v).send(); } else if (v instanceof Number) { e.metric(((Number) v).floatValue()).send(); } } @Override public void processCounter(MetricName name, Counter counter, Long epoch) { newEvent() .service(service(name)) .metric(counter.count()) .time(epoch) .send(); } @Override public void processMeter(MetricName name, Metered meter, Long epoch) { newEvent() .service(service(name)) .metric(meter.oneMinuteRate()) .time(epoch) .send(); } @Override public void processHistogram(MetricName name, Histogram histogram, Long epoch) throws IOException { final String service = service(name); sendSummary(name, histogram, epoch); sendSample(name, histogram, epoch); } @Override public void processTimer(MetricName name, Timer timer, Long epoch) { processMeter(name, timer, epoch); sendSummary(name, timer, epoch); sendSample(name, timer, epoch); } protected void sendVMMetrics(long epoch) { newEvent().time(epoch).service(service("jvm", "memory", "heap-usage")).metric(vm.heapUsage()).send(); newEvent().time(epoch).service(service("jvm", "memory", "non-heap-usage")).metric(vm.nonHeapUsage()).send(); for (Entry<String, Double> pool : vm.memoryPoolUsage().entrySet()) { newEvent().time(epoch).service(service("jvm", "memory", "pool-usage", pool.getKey())).metric(pool.getValue()).send(); } newEvent().time(epoch).service(service("jvm", "thread", "daemon-count")).metric(vm.daemonThreadCount()).send(); newEvent().time(epoch).service(service("jvm", "thread", "count")).metric(vm.threadCount()).send(); newEvent().time(epoch).service(service("jvm", "uptime")).metric(vm.uptime()).send(); newEvent().time(epoch).service(service("jvm", "fd-usage")).metric(vm.fileDescriptorUsage()).send(); for(Entry<Thread.State, Double> entry : vm.threadStatePercentages().entrySet()) { newEvent().time(epoch).service(service("jvm", "thread", "state", entry.getKey().toString().toLowerCase())).metric(entry.getValue()).send(); } for(Entry<String, VirtualMachineMetrics.GarbageCollectorStats> entry : vm.garbageCollectors().entrySet()) { newEvent().time(epoch).service(service("jvm", "gc", entry.getKey(), "time")).metric(entry.getValue().getTime(TimeUnit.MILLISECONDS)).send(); newEvent().time(epoch).service(service("jvm", "gc", entry.getKey(), "runs")).metric(entry.getValue().getRuns()).send(); } } public void sendSummary(MetricName name, Summarizable metric, Long epoch) { newEvent().time(epoch).service(service(name, "min")).metric(metric.min()).send(); newEvent().time(epoch).service(service(name, "max")).metric(metric.max()).send(); newEvent().time(epoch).service(service(name, "mean")).metric(metric.mean()).send(); newEvent().time(epoch).service(service(name, "stddev")).metric(metric.stdDev()).send(); } public void sendSample(MetricName name, Sampling metric, Long epoch) { final Snapshot s = metric.getSnapshot(); newEvent().time(epoch).service(service(name, ".5")).metric(s.getMedian()).send(); newEvent().time(epoch).service(service(name, ".75")).metric(s.get75thPercentile()).send(); newEvent().time(epoch).service(service(name, ".95")).metric(s.get95thPercentile()).send(); newEvent().time(epoch).service(service(name, ".98")).metric(s.get98thPercentile()).send(); newEvent().time(epoch).service(service(name, ".99")).metric(s.get99thPercentile()).send(); newEvent().time(epoch).service(service(name, ".999")).metric(s.get999thPercentile()).send(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
d95ba5f805e83fe7514249da539ef787b7aef9b1
4d23db22b5d9c5031cabb996a63ad61b8900e25b
/app/src/main/java/qin/xue/crawler/activity/ReceiverActivity.java
c57c2050ac217a078ab365198ae593055d037435
[]
no_license
xueqin123/TextCrawler
f3872d08973f38aa11fa65ffc4465afbe56a4a22
822adde4bcf97f885b20077617f142daf3a0046b
refs/heads/master
2020-03-16T00:27:48.309803
2018-05-07T06:34:44
2018-05-07T06:34:44
132,417,252
0
0
null
null
null
null
UTF-8
Java
false
false
1,852
java
package qin.xue.crawler.activity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.util.Log; import java.util.List; import qin.xue.crawler.library.LinkPreviewCallback; import qin.xue.crawler.library.SourceContent; import qin.xue.crawler.library.TextCrawler; /** * Created by qinxue on 2018/5/7. */ public class ReceiverActivity extends Activity { private static final String TAG = "ReceiverActivity"; private TextCrawler textCrawler; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); textCrawler = new TextCrawler(); textCrawler.makePreview(new LinkPreviewCallback() { @Override public void onPre() { } @Override public void onPos(SourceContent sourceContent, boolean isNull) { Log.i(TAG, "onPos() title: " + sourceContent.getTitle()); List<String> images = sourceContent.getImages(); Log.i(TAG, "onPos() images.size(): = " + images.size()); if (images != null && images.size() > 0) { Log.i(TAG, "onPos() image0: = " + images.get(0)); } Log.i(TAG, "onPos() description: = " + sourceContent.getDescription()); } }, getUri()); } public String getUri() { Intent intent = getIntent(); Bundle bundle = null; CharSequence result = ""; if (intent != null) { bundle = intent.getExtras(); } if (bundle != null) { result = intent.getExtras().getCharSequence(Intent.EXTRA_TEXT); } Log.i(TAG, "getUri() uri =" + result); return result.toString(); } }
[ "qinxue@rongcloud.cn" ]
qinxue@rongcloud.cn
5968767931925d7b1b605f6c85116c51ecc07eab
c3fcf5c121b5f18b39e7bdbdd2b5622cb55ddd0e
/src/Ex177.java
c8c716a9e1968e9b48feb51b888807ca05ed541c
[]
no_license
vadikne/extra266
3104f903948d8d634ecf8f97090b9a56e8d1ccf9
974e9651f9544ced0e58315caa92faf979b71132
refs/heads/master
2021-01-02T08:23:00.025825
2018-03-30T16:40:12
2018-03-30T16:40:12
98,998,061
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
/** * Created by owner on 23.01.2018. * 177. Дано натуральное число n. Выяснить, можно ли представить n * в виде произведения трех последовательных натуральных чисел. */ public class Ex177 { public static void main(String[] args) { int n=120; for (int i = n; i >3 ; i--) { if (n/i==(i-1)*(i-2)) System.out.println(n+" "+i+" "+(i-1)+" "+(i-2)); } } }
[ "vadikpass@gmail.com" ]
vadikpass@gmail.com
c414d9d5b023d9da69e2bbc926d6ed22a31f8bd2
e17ce26ed9c3d6dd9b56ab67ff315309a3cb60d2
/src/gameauthoring/components/level/AuthoringPlayScreen.java
8c7211ff69c848f435da8390deac300f5a3f1e5e
[ "MIT" ]
permissive
jacobow/GameAuthoringEnvironment
bc1957e5ead8c81ba16ebb8c4e54620bf005f331
d89aab5b0750adb0103903d8875a7d9d56a42b4c
refs/heads/master
2021-06-26T17:49:45.972638
2017-09-12T02:39:26
2017-09-12T02:39:26
103,212,698
0
0
null
null
null
null
UTF-8
Java
false
false
8,360
java
package gameauthoring.components.level; import java.util.HashSet; import java.util.Set; import configuration.MenuLanguage; import gameauthoring.AuthoringFactory; import gameauthoring.components.selectors.componentselectors.abilityselector.AbilitySelector; import gameengine.GameWorld; import gameengine.attributes.Path; import gameengine.attributes.Spacial; import gameengine.attributes.Zone; import gameengine.entities.EntityInterface; import gameengine.interfaces.ExternalEngineInterface; import gameengine.utilities.LiveObserver; import gameplayer.display.DisplayInterface; import gameplayer.display.gameplay.playscreen.PlayScreen; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.effect.DropShadow; import javafx.scene.image.ImageView; import javafx.scene.input.MouseButton; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Background; import javafx.scene.layout.BackgroundFill; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Line; import javafx.stage.Stage; /** * @author Walker Eacho */ public class AuthoringPlayScreen extends PlayScreen implements LiveObserver{ private boolean draggingActive; private double[] lastPoint; private Path currentPath; private Pane pathingPane; private EntityInterface mySelectedEntity; private SimpleBooleanProperty myEntityBoolean; private GameWorld myWorld; private Set<EntityInterface> oldEntities; private Set<EntityInterface> newEntities; public AuthoringPlayScreen(ExternalEngineInterface currentChoice, DisplayInterface display, double width, double height, GameWorld world) { super(currentChoice, display, width, height); oldEntities = new HashSet<EntityInterface>(); newEntities = new HashSet<EntityInterface>(); myWorld = world; myWorld.getEntities().registerObserver(this); getGamePane().setOnMouseReleased(r->engineMouseListener(r)); myEntityBoolean = new SimpleBooleanProperty(); getEngine().loadGameWorld(world); amend(); } public void amend(){ super.amend(); myWorld.getEntities().forEach(entity->{ if(oldEntities.contains(entity)) oldEntities.remove(entity); else newEntities.add(entity); }); newEntities.forEach(toAdd -> addPotentialPath(toAdd)); oldEntities = new HashSet<EntityInterface>(myWorld.getEntities()); newEntities.clear(); } protected void addPotentialPath(EntityInterface elementAdded) { try{ ImageView entityIView = getEntityInfoMap().get(elementAdded).getImageView(); entityIView.setOnMouseClicked(r->{ initializeGeneralListeners(elementAdded,entityIView); }); }catch(NullPointerException superNotInitialized){ ImageView entityIView = getEntityInfoMap().get(elementAdded).getImageView(); entityIView.setOnMouseClicked(r->{ initializeGeneralListeners(elementAdded,entityIView); }); } } private void engineMouseListener(MouseEvent r) { if(r.isShiftDown()) getEngine().setOnMouseAction(r); } private void initializeGeneralListeners(EntityInterface entity, ImageView entityIView){ mySelectedEntity = entity; getEngine().getWorld().getEntities().forEach(ent -> { if(ent.containsAttribute(Zone.class)){ DropShadow zoneShadow = new DropShadow(); zoneShadow.setColor(Color.BLUE); zoneShadow.setRadius(ent.getAttribute(Zone.class).getRadius()); zoneShadow.setSpread(1.0); getEntityInfoMap().get(ent).getImageView().setEffect(zoneShadow); }else getEntityInfoMap().get(ent).getImageView().setEffect(null); }); entityIView.setEffect(null); DropShadow ds= new DropShadow(); ds.setColor(Color.BLACK); if(entityIView.getBoundsInLocal().getHeight()>entityIView.getBoundsInLocal().getWidth()){ ds.setRadius(entityIView.getBoundsInLocal().getHeight()/2.0); }else{ ds.setRadius(entityIView.getBoundsInLocal().getWidth()/2.0); } entityIView.setEffect(ds); getGamePane().setOnMouseDragged(dr-> onIViewDragged(dr,entityIView,entity)); getGamePane().setOnMouseReleased(r-> updateBackend(r,entityIView,entity)); myEntityBoolean.set(!myEntityBoolean.get()); } private void onIViewDragged(MouseEvent dr, ImageView entityIView, EntityInterface selected) { if(entityIView.getLayoutX()-entityIView.getBoundsInLocal().getWidth() < dr.getX() && entityIView.getLayoutX()+entityIView.getBoundsInLocal().getWidth()> dr.getX() && entityIView.getLayoutY()-entityIView.getBoundsInLocal().getHeight() < dr.getY() && entityIView.getLayoutY()+entityIView.getBoundsInLocal().getHeight() > dr.getY()) { mySelectedEntity=selected; if(dr.isShortcutDown()){ double adjustedWidth = entityIView.getLayoutBounds().getWidth()/2.0; double adjustedHeight = entityIView.getLayoutBounds().getHeight()/2.0; entityIView.setRotate(-90+180/Math.PI*(Math.atan2( (dr.getX()-(entityIView.getLayoutX()+adjustedWidth)),((entityIView.getLayoutY()+adjustedHeight) - dr.getY())))); }else{ entityIView.relocate(dr.getX(), dr.getY()); } draggingActive=true; } } private void updateBackend(MouseEvent r, ImageView entityIView, EntityInterface entity) { if(draggingActive){ entity.getAttribute(Spacial.class).setOrientation(entityIView.getRotate()); entity.getAttribute(Spacial.class).setX(r.getX()); entity.getAttribute(Spacial.class).assignY(r.getY()); draggingActive=false; } } public void mouseRelease(MouseEvent m, EntityInterface user) { if(m.isShiftDown()) getEngine().setOnMouseAction(m,user); else if(m.isControlDown() && m.isControlDown()){ if(mySelectedEntity!=null){ myWorld.getEntities().remove(mySelectedEntity); myEntityBoolean.set(!myEntityBoolean.get()); } }else if(m.isAltDown()) { if(currentPath==null) setUpPaths(); else submitPath(); } } public void setUpPaths(){ if(mySelectedEntity!=null){ currentPath = new Path(); pathingPane = new Pane(); pathingPane.setMinWidth(getGamePane().getWidth()); pathingPane.setMinHeight(getGamePane().getHeight()); pathingPane.setPrefWidth(getGamePane().getWidth()); pathingPane.setPrefHeight(getGamePane().getHeight()); pathingPane.setOnMouseClicked(cl->addNewPoint(cl)); pathingPane.setBackground(new Background(new BackgroundFill(Color.rgb(0, 0, 255,.1), null, null))); getStacker().getChildren().add(pathingPane); } } public EntityInterface getSelectedEntity(){ return mySelectedEntity; } public BooleanProperty getEntityBoolean(){ return myEntityBoolean; } private void addNewPoint(MouseEvent clicked){ if(currentPath.retrievePath().size()>0){ Line line = new Line(); line.setStartX(lastPoint[0]); line.setStartY(lastPoint[1]); line.setEndX(clicked.getX()); line.setEndY(clicked.getY()); pathingPane.getChildren().add(line); } lastPoint= new double[]{clicked.getX(),clicked.getY()}; if(clicked.getButton()==MouseButton.SECONDARY){ Stage abStage = new Stage(); Group abGroup = new Group(); Scene abScene = new Scene (abGroup,200,400,Color.WHITE); VBox abFlower = new VBox(); abFlower.setSpacing(abScene.getHeight()/10); AbilitySelector abSelector = new AbilitySelector(mySelectedEntity, myWorld); abSelector.initialize(); abFlower.getChildren().add(AuthoringFactory.makeButton( MenuLanguage.getInstance().getValue("Submit"), b->{ if(abSelector.getAbilities().size()==1) currentPath.addPoint(new double[]{lastPoint[0],lastPoint[1]},abSelector.getAbilities().get(0)); abStage.close(); })); abFlower.getChildren().add(abSelector.getAbilitySection()); abGroup.getChildren().add(abFlower); abStage.setScene(abScene); abStage.showAndWait(); }else{ currentPath.addPoint(new double[]{lastPoint[0], lastPoint[1]}); } } public void submitPath(){ currentPath.setRepeating(true); if(mySelectedEntity.containsAttribute(Path.class)){ mySelectedEntity.getAttribute(Path.class).setPath(currentPath); }else{ mySelectedEntity.addAttribute(currentPath); } currentPath.setEntity(mySelectedEntity); getStacker().getChildren().remove(getStacker().getChildren().size()-1); getEngine().getPathingManager().updateTrackedPaths(); currentPath=null; pathingPane=null; } public void clearPath(){ currentPath.removeAllPoints(); } }
[ "jrw82@duke.edu" ]
jrw82@duke.edu
5b411ea3d8995889c027b54d4218dcdd15bfec07
1e17900597a3a7e8dbc207b3f451b5196de62b97
/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/stats/TimeSeriesMaxTest.java
3558834c19bb9dc60be04168ca35c1a63d0daf1b
[ "W3C", "Apache-2.0" ]
permissive
apache/jackrabbit
cf8e918166e6c84740ba3ae7fa68a590e410ee2b
a90a43501fc87e0b8ff6e38a70db8a17e4aeffb6
refs/heads/trunk
2023-08-24T02:53:24.324993
2023-08-08T04:10:21
2023-08-08T04:10:21
206,403
298
251
Apache-2.0
2023-08-22T21:58:06
2009-05-21T01:43:24
Java
UTF-8
Java
false
false
6,810
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jackrabbit.stats; import junit.framework.TestCase; public class TimeSeriesMaxTest extends TestCase { private TimeSeriesMax max; public void testMax() { max = new TimeSeriesMax(); // initial values assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // no changes in first second max.recordOneSecond(); assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // 2 seconds max.recordValue(42); max.recordOneSecond(); assertValues(max.getValuePerSecond(), 42); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // no changes in 3rd second max.recordOneSecond(); assertValues(max.getValuePerSecond(), 0, 42); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // 4th second max.recordValue(99); max.recordOneSecond(); assertValues(max.getValuePerSecond(), 99, 0, 42); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // one minute later for (int i = 0; i < 60; i++) { max.recordOneSecond(); } assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute(), 99); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // another minute later for (int i = 0; i < 60; i++) { max.recordOneSecond(); } assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute(), 0, 99); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // one hour for (int i = 0; i < 60 * 60; i++) { max.recordOneSecond(); } assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour(), 99); assertValues(max.getValuePerWeek()); // one week for (int i = 0; i < 7 * 24 * 60 * 60; i++) { max.recordOneSecond(); } assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek(), 99); } public void testMaxWithMissing() { for (long m : new long[]{-42, 42}) { max = new TimeSeriesMax(m); // initial values assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // no changes in first second max.recordOneSecond(); assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // 2 seconds max.recordValue(42); max.recordOneSecond(); assertValues(max.getValuePerSecond(), 42); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // no changes in 3rd second max.recordOneSecond(); assertValues(max.getValuePerSecond(), max.getMissingValue(), 42); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // 4th second max.recordValue(99); max.recordOneSecond(); assertValues(max.getValuePerSecond(), 99, max.getMissingValue(), 42); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // one minute later for (int i = 0; i < 60; i++) { max.recordOneSecond(); } assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute(), 99); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // another minute later for (int i = 0; i < 60; i++) { max.recordOneSecond(); } assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute(), max.getMissingValue(), 99); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek()); // one hour for (int i = 0; i < 60 * 60; i++) { max.recordOneSecond(); } assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour(), 99); assertValues(max.getValuePerWeek()); // one week for (int i = 0; i < 7 * 24 * 60 * 60; i++) { max.recordOneSecond(); } assertValues(max.getValuePerSecond()); assertValues(max.getValuePerMinute()); assertValues(max.getValuePerHour()); assertValues(max.getValuePerWeek(), 99); } } private void assertValues(long[] values, long... expected) { for (int i = 0; i < expected.length; i++) { assertEquals(expected[i], values[values.length - i - 1]); } for (int i = expected.length; i < values.length; i++) { assertEquals(max.getMissingValue(), values[values.length - i - 1]); } } }
[ "mduerig@apache.org" ]
mduerig@apache.org
9f289f92ac358cf47597cd9e6439a182dc11c1f3
e87b32f00161ff074e0b5f0a50ba76e5c5bd1e14
/src/uy/com/s4b/inside/core/ejbs/report/impl/difflib/DiffUtils.java
f787de6cddf5679f7392eb4fced116628d64f584
[]
no_license
arpela/InSide
a18bb29f3e05644c834621223c1df7fb427934fd
58d1701e982957338f61205b672a5651f0bae4df
refs/heads/master
2020-04-06T03:35:10.770719
2011-11-29T01:49:07
2011-11-29T01:49:07
2,351,966
2
1
null
null
null
null
UTF-8
Java
false
false
13,810
java
/* Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com) 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 uy.com.s4b.inside.core.ejbs.report.impl.difflib; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import uy.com.s4b.inside.core.ejbs.report.impl.difflib.utils.MyersDiff; /** * Implements the difference and patching engine * * @author <a href="dm.naumenko@gmail.com">Dmitry Naumenko</a> * @version 0.4.1 */ public class DiffUtils { private static DiffAlgorithm defaultDiffAlgorithm = new MyersDiff(); private static Pattern unifiedDiffChunkRe = Pattern.compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@$"); /** * Compute the difference between the original and revised texts with default diff algorithm * * @param original the original text * @param revised the revised text * @return the patch describing the difference between the original and revised texts */ public static Patch diff(List<?> original, List<?> revised) { return DiffUtils.diff(original, revised, defaultDiffAlgorithm); } /** * Compute the difference between the original and revised texts with given diff algorithm * * @param original the original text * @param revised the revised text * @param algorithm the given algorithm * @return the patch describing the difference between the original and revised texts */ public static Patch diff(List<?> original, List<?> revised, DiffAlgorithm algorithm) { return algorithm.diff(original, revised); } /** * Patch the original text with given patch * * @param original the original text * @param patch the given patch * @return the revised text * @throws PatchFailedException if can't apply patch */ public static List<?> patch(List<?> original, Patch patch) throws PatchFailedException { return patch.applyTo(original); } /** * Unpatch the revised text for a given patch * * @param revised the revised text * @param patch the given patch * @return the original text */ public static List<?> unpatch(List<?> revised, Patch patch) { return patch.restore(revised); } /** * Parse the given text in unified format and creates the list of deltas for it. * * @param diff the text in unified format * @return the patch with deltas. */ public static Patch parseUnifiedDiff(List<String> diff) { boolean inPrelude = true; List<Object[]> rawChunk = new ArrayList<Object[]>(); Patch patch = new Patch(); int old_ln = 0, new_ln = 0; String tag; String rest; for (String line : diff) { // Skip leading lines until after we've seen one starting with '+++' if (inPrelude) { if (line.startsWith("+++")) { inPrelude = false; } continue; } Matcher m = unifiedDiffChunkRe.matcher(line); if (m.find()) { // Process the lines in the previous chunk if (rawChunk.size() != 0) { List<String> oldChunkLines = new ArrayList<String>(); List<String> newChunkLines = new ArrayList<String>(); for (Object[] raw_line : rawChunk) { tag = (String) raw_line[0]; rest = (String) raw_line[1]; if (tag.equals(" ") || tag.equals("-")) { oldChunkLines.add(rest); } if (tag.equals(" ") || tag.equals("+")) { newChunkLines.add(rest); } } patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, oldChunkLines), new Chunk(new_ln - 1, newChunkLines))); rawChunk.clear(); } // Parse the @@ header old_ln = m.group(1) == null ? 1 : Integer.parseInt(m.group(1)); new_ln = m.group(3) == null ? 1 : Integer.parseInt(m.group(3)); if (old_ln == 0) { old_ln += 1; } if (new_ln == 0) { new_ln += 1; } } else { if (line.length() > 0) { tag = line.substring(0, 1); rest = line.substring(1); if (tag.equals(" ") || tag.equals("+") || tag.equals("-")) { rawChunk.add(new Object[]{tag, rest}); } } else { rawChunk.add(new Object[]{" ", ""}); } } } // Process the lines in the last chunk if (rawChunk.size() != 0) { List<String> oldChunkLines = new ArrayList<String>(); List<String> newChunkLines = new ArrayList<String>(); for (Object[] raw_line : rawChunk) { tag = (String) raw_line[0]; rest = (String) raw_line[1]; if (tag.equals(" ") || tag.equals("-")) { oldChunkLines.add(rest); } if (tag.equals(" ") || tag.equals("+")) { newChunkLines.add(rest); } } patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, oldChunkLines), new Chunk( new_ln - 1, newChunkLines))); rawChunk.clear(); } return patch; } /** * generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format text representing the Patch. * * @param original - Filename of the original (unrevised file) * @param revised - Filename of the revised file * @param originalLines - Lines of the original file * @param patch - Patch created by the diff() function * @param contextSize - number of lines of context output around each difference in the file. * @return List of strings representing the Unified Diff representation of the Patch argument. * @author Bill James (tankerbay@gmail.com) */ public static List<String> generateUnifiedDiff(String original, String revised, List<String> originalLines, Patch patch, int contextSize) { if (!patch.getDeltas().isEmpty()) { List<String> ret = new ArrayList<String>(); ret.add("--- " + original); ret.add("+++ " + revised); List<Delta> patchDeltas = new ArrayList<Delta>(patch.getDeltas()); // code outside the if block also works for single-delta issues. List<Delta> deltas = new ArrayList<Delta>(); // current list of Delta's to process Delta delta = patchDeltas.get(0); deltas.add(delta); // add the first Delta to the current set // if there's more than 1 Delta, we may need to output them together if (patchDeltas.size() > 1) { for (int i = 1; i < patchDeltas.size(); i++) { int position = delta.getOriginal().getPosition(); // store the current position of // the first Delta // Check if the next Delta is too close to the current position. // And if it is, add it to the current set Delta nextDelta = patchDeltas.get(i); if ((position + delta.getOriginal().size() + contextSize) >= (nextDelta.getOriginal().getPosition() - contextSize)) { deltas.add(nextDelta); } else { // if it isn't, output the current set, // then create a new set and add the current Delta to it. List<String> curBlock = processDeltas(originalLines, deltas, contextSize); ret.addAll(curBlock); deltas.clear(); deltas.add(nextDelta); } delta = nextDelta; } } // don't forget to process the last set of Deltas List<String> curBlock = processDeltas(originalLines, deltas, contextSize); ret.addAll(curBlock); return ret; } return new ArrayList<String>(); } /** * processDeltas takes a list of Deltas and outputs them together in a single block of Unified-Diff-format text. * * @param origLines - the lines of the original file * @param deltas - the Deltas to be output as a single block * @param contextSize - the number of lines of context to place around block * @return * @author Bill James (tankerbay@gmail.com) */ private static List<String> processDeltas(List<String> origLines, List<Delta> deltas, int contextSize) { List<String> buffer = new ArrayList<String>(); int origTotal = 0; // counter for total lines output from Original int revTotal = 0; // counter for total lines output from Original int line; Delta curDelta = deltas.get(0); // NOTE: +1 to overcome the 0-offset Position int origStart = curDelta.getOriginal().getPosition() + 1 - contextSize; if (origStart < 1) { origStart = 1; } int revStart = curDelta.getRevised().getPosition() + 1 - contextSize; if (revStart < 1) { revStart = 1; } // find the start of the wrapper context code int contextStart = curDelta.getOriginal().getPosition() - contextSize; if (contextStart < 0) { contextStart = 0; // clamp to the start of the file } // output the context before the first Delta for (line = contextStart; line < curDelta.getOriginal().getPosition(); line++) { // buffer.add(" " + origLines.get(line)); origTotal++; revTotal++; } // output the first Delta buffer.addAll(getDeltaText(curDelta)); origTotal += curDelta.getOriginal().getLines().size(); revTotal += curDelta.getRevised().getLines().size(); int deltaIndex = 1; while (deltaIndex < deltas.size()) { // for each of the other Deltas Delta nextDelta = deltas.get(deltaIndex); int intermediateStart = curDelta.getOriginal().getPosition() + curDelta.getOriginal().getLines().size(); for (line = intermediateStart; line < nextDelta.getOriginal().getPosition(); line++) { // output the code between the last Delta and this one buffer.add(" " + origLines.get(line)); origTotal++; revTotal++; } buffer.addAll(getDeltaText(nextDelta)); // output the Delta origTotal += nextDelta.getOriginal().getLines().size(); revTotal += nextDelta.getRevised().getLines().size(); curDelta = nextDelta; deltaIndex++; } // Now output the post-Delta context code, clamping the end of the file contextStart = curDelta.getOriginal().getPosition() + curDelta.getOriginal().getLines().size(); for (line = contextStart; (line < (contextStart + contextSize)) && (line < origLines.size()); line++) { buffer.add(" " + origLines.get(line)); origTotal++; revTotal++; } // Create and insert the block header, conforming to the Unified Diff standard StringBuffer header = new StringBuffer(); header.append("@@ -"); header.append(origStart); header.append(","); header.append(origTotal); header.append(" +"); header.append(revStart); header.append(","); header.append(revTotal); header.append(" @@"); buffer.add(0, header.toString()); return buffer; } /** * getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter * * @param delta - the Delta to output * @return list of String lines of code. * @author Bill James (tankerbay@gmail.com) */ private static List<String> getDeltaText(Delta delta) { List<String> buffer = new ArrayList<String>(); for (Object line : delta.getOriginal().getLines()) { buffer.add("-" + line); } for (Object line : delta.getRevised().getLines()) { buffer.add("+" + line); } return buffer; } }
[ "arpela@gmail.com" ]
arpela@gmail.com
3a96612ad900bdae8a2d737236efda5e5719e507
3ea987e46b3638ef046d9a9bb689ce057cead9e3
/wsWebClient/src/ua/nure/order/server/AddUser.java
18405abc7e223451dbcb69b8b3692a3628cc0685
[]
no_license
engsyst/ws
53a72398a3d80fa27b5ab81ec8b4a8e0b8d81c62
8751c41c58af27eaff6f08e6ec9b710f5e86d16c
refs/heads/master
2021-05-04T11:48:55.312645
2019-11-01T06:13:06
2019-11-01T06:13:06
51,517,739
1
1
null
null
null
null
UTF-8
Java
false
false
5,124
java
package ua.nure.order.server; import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.util.Map; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.annotation.WebInitParam; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import ua.nure.order.entity.user.User; import ua.nure.order.server.dao.DAOException; import ua.nure.order.server.dao.UserDAO; import ua.nure.order.shared.Hash; import ua.nure.order.shared.UserValidator; import ua.nure.order.shared.Util; /** * Add user into database. */ @WebServlet( urlPatterns = { "/adduser" }, initParams = { @WebInitParam(name = "loginPattern", value = "[a-zA-Z0-9\\-_.]{4,20}"), @WebInitParam(name = "passPattern", value = ""), @WebInitParam(name = "errLoginMsg", value = "Login must be more then 4 symbols"), @WebInitParam(name = "errPassMsg", value = "Pass must be more then 4 symbols"), }) public class AddUser extends HttpServlet { private static final long serialVersionUID = 1L; private static final Logger log = Logger.getLogger(AddUser.class); private UserDAO dao = null; private static UserValidator<User> validator = new UserValidator<>(); /** * @see HttpServlet#HttpServlet() */ public AddUser() { super(); } @Override public void init() { log.trace("Login init start"); ServletConfig cfg = getServletConfig(); dao = (UserDAO) getServletContext().getAttribute("UserDao"); String param = cfg.getInitParameter("loginPattern"); log.trace("loginPattern --> " + param); if (param != null) validator.loginPattern = param; param = cfg.getInitParameter("passPattern"); log.trace("passPattern --> " + param); if (param != null) validator.passPattern = param; param = cfg.getInitParameter("errLoginMsg"); log.trace("errLoginMsg --> " + param); if (param != null) validator.errLoginMsg = param; param = cfg.getInitParameter("errPassMsg"); log.trace("errPassMsg --> " + param); if (param != null) validator.errPassMsg = param; log.trace("Login init finish"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); log.trace("doPost start"); String name = Util.getOrElse(request.getParameter("login"), "").trim(); log.debug("name --> " + name); String login = Util.getOrElse(request.getParameter("login"), "").trim(); log.debug("login --> " + login); String pass = Util.getOrElse(request.getParameter("password"), ""); // TODO remove in PRODUCTION log.debug("password --> " + pass); String pass2 = request.getParameter("password2"); // TODO remove in PRODUCTION log.debug("password2 --> " + pass2); User user = new User(login, pass); user.setName(name); Map<String, String> errors = validator.validate(user); if (!errors.isEmpty()) { log.debug("Invalid user"); goBack(request, response, user, errors); return; } if (!pass.equals(pass2)) { log.debug("Passwords not equals"); errors.put("password2", "Пароли не совпадают"); goBack(request, response, user, errors); return; } try { user = dao.getUser(login); if (user != null) { log.debug("User already exist"); errors.put("login", "Такой пользователь уже существует"); goBack(request, response, user, errors); return; } user = new User(login, Hash.encode(pass), "client"); user.setName(name); log.debug("Try add User to db"); user.setId(dao.addUser(user)); log.debug("User added to db"); } catch (DAOException e) { log.debug("DAOException", e); errors.put("dao", "Ошибка при добавлении пользователя"); goBack(request, response, user, errors); return; } catch (NoSuchAlgorithmException e) { throw new ServletException(e.getMessage()); } session.removeAttribute("errors"); session.setAttribute("user", user); log.info("Registered new user --> " + user.getLogin()); log.debug("Set session attribute user --> " + user); log.debug("Redirect to --> list.jsp"); response.sendRedirect("list.jsp"); } private void goBack(HttpServletRequest request, HttpServletResponse response, User user, Map<String, String> errors) throws IOException { HttpSession session = request.getSession(); session.setAttribute("user", user); log.debug("Set user to the session"); session.setAttribute("errors", errors); log.debug("Redirect to --> register.jsp"); response.sendRedirect("register.jsp"); } }
[ "admin@engsyst" ]
admin@engsyst
9a2ecd3dd2ee2378f645e91982f28574302d5948
30b27d15ec3f0d6117d13526614419f0d0e76023
/app/src/main/java/com/neonatal/app/src/classes/PatientDatesEvents.java
082e6fdf8cf8cf4cdba3392620fcd27e93a06ebb
[]
no_license
SangTran01/softwareengineering
2b6ad9d0651cacd56c007be927908a20fae7458e
4f66a19fddf278ecc8b796234839d2ee0856616c
refs/heads/master
2022-12-24T16:28:30.684115
2020-09-29T23:07:05
2020-09-29T23:07:05
299,757,896
0
0
null
null
null
null
UTF-8
Java
false
false
919
java
package com.neonatal.app.src.classes; import com.neonatal.app.src.entity.DataEntry; public class PatientDatesEvents { private String eventDate; private String eventType; public DataEntry dataEntry; public boolean hasDate; private int eventId; public PatientDatesEvents(boolean hasDate, DataEntry dataEntry) { this.hasDate = hasDate; this.dataEntry = dataEntry; } public PatientDatesEvents(boolean hasDate, String eventDate, int eventId) { this.hasDate = hasDate; this.eventDate = eventDate; this.eventId = eventId; } public String getEventDate() { return eventDate; } public void setEventDate(String eventDate) { this.eventDate = eventDate; } public String getEventType() { return eventType; } public void setEventType(String eventType) { this.eventType = eventType; } }
[ "stran8089@gmail.com" ]
stran8089@gmail.com
2b18f9af5aebd4a1cf53330e7ddbbfa60bcd9f4d
d9d754337215de317a8f59080053af6d547bdfba
/jago_server/src/core/game/Referee.java
be84c87cf0dabfb121573e43e0f0d96830ef5ced
[]
no_license
wangmumuzl/jago
e51e8748b2a736fe28c7c49fb4f1ac2c59e14f60
11f895a961ef7336e6c2842652f3d0d801a2348b
refs/heads/master
2023-01-07T05:10:44.075090
2020-11-11T08:45:30
2020-11-11T08:45:30
311,910,002
0
0
null
null
null
null
GB18030
Java
false
false
2,205
java
package core.game; import core.board.Board; import core.player.Player; import core.player.SocketDelegate; import static core.board.PieceColor.*; public class Referee { private Board _board; private Player _black, _white; private String endReason; // 棋局结束的原因; F 正常结束;T 超时; // E 棋手内部错误;N 非法走步;M 超过最大步数 private int steps = 0; // 棋局下了多少步 public Referee(Player black, Player white) { _board = new Board(); _board.clear(); _black = black; _white = white; } // 轮到谁下棋 public Player whoseMove() { return _board.whoseMove() == WHITE ? _white : _black; } // 棋局是否结束 public boolean gameOver() { return _board.gameOver(); } // 处理异常 public void endingGame(String endReason, Player currPlayer, Move currMove) { _black.stopTimer(); _white.stopTimer(); if (currPlayer instanceof SocketDelegate) { ((SocketDelegate) currPlayer).sendMove(currMove); } this.endReason = endReason; recordGame(); } // 是否合法走步 public boolean legalMove(Move move) { // TODO Auto-generated method stub return _board.legalMove(move); } // 记录走步 public void recordMove(Move move) { // TODO Auto-generated method stub _board.makeMove(move); steps++; } // 为黑白双方生成棋局报告 public void recordGame() { GameResult result = new GameResult(_black.name(), _white.name(), getWinner(), steps, endReason); System.out.println(result.toString()); // 添加到黑棋和白棋的对局结果列表 _black.addGameResult(result); _white.addGameResult(result); } private String getWinner() { // 如果是超过最大步数而结束, if ("M".equalsIgnoreCase(endReason)) { return "NONE"; } // // 如果是超时负, // if ("T".equalsIgnoreCase(endReason)) { // //轮到下棋的那一方,判定为赢家。即,轮到白棋下,则白胜 // return _board.whoseMove() == WHITE ? _white.name() : _black.name(); // } //轮到下棋的那一方,判定为输家。即,轮到白棋下,则黑胜,否则,白胜 return _board.whoseMove() == WHITE ? _black.name() : _white.name(); } }
[ "1196259029@qq.com" ]
1196259029@qq.com
22dc8ae525197f1f28b543180341156aae66275d
f85515549aa17a4ae5adc4af0d6708d32a83b8ba
/design-pattern/src/main/java/creative/builder/pc/PCImpl.java
d368d6e4ff7a2503b5d41f3f809141183d738d86
[]
no_license
kangqing/boot-demos
8a052c3a77f6fac5c59fbcb4a27fa6cd3636a43d
9395756dbf4940ac668e155784ef5f426b801521
refs/heads/master
2023-08-10T09:02:24.855107
2023-08-06T13:15:28
2023-08-06T13:15:28
232,770,815
3
1
null
2023-01-07T09:49:36
2020-01-09T09:23:49
Java
UTF-8
Java
false
false
2,029
java
package creative.builder.pc; import creative.builder.aaa.Matter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; /** * @author kangqing * @since 2023/7/6 09:43 */ public class PCImpl implements IMenuSelector{ private List<IPCSelector> list = new ArrayList<>(); private BigDecimal price = BigDecimal.ZERO; private String type; //套餐类型 1, 2, 3 private PCImpl() {} /** * 初始化套餐 * @param type */ public PCImpl(String type) { this.type = type; } @Override public IMenuSelector appendKeyboard(IPCSelector ipcSelector) { list.add(ipcSelector); price = price.add(ipcSelector.price()); return this; } @Override public IMenuSelector appendMouse(IPCSelector ipcSelector) { list.add(ipcSelector); price = price.add(ipcSelector.price()); return this; } @Override public IMenuSelector appendSound(IPCSelector ipcSelector) { list.add(ipcSelector); price = price.add(ipcSelector.price()); return this; } @Override public IMenuSelector appendCamera(IPCSelector ipcSelector) { list.add(ipcSelector); price = price.add(ipcSelector.price()); return this; } @Override public String getDetail() { StringBuilder detail = new StringBuilder("\r\n--------------------" + "-----------------------------------\r\n" + "外设清单" + "\r\n" + "套餐选择:" + type + "\r\n" + "套餐价格:" + price.setScale(2, RoundingMode.HALF_UP) + " 元\r\n" + "外设清单:\r\n"); for (IPCSelector pc: list) { detail.append(pc.name()).append(":").append(pc.brand()).append( "、").append(pc.price()).append(" 元、介绍:").append(pc.desc()) .append("\r\n"); } return detail.toString(); } }
[ "kangqing.37@gmail.com" ]
kangqing.37@gmail.com
2e702cac7219b74bc68c722fdc62d1f9e751ec5a
d2094207d194ff151bbe2964f7b2acb0f0d7cff4
/data_platform/src/main/java/com/wlwx/back/system/SystemInit.java
78810377c340d96e8eb5b9da0d27cf6cf8296446
[]
no_license
nzb15555196162/data_platform
953bc4d853b60bc62d2e6e0a60bd5660d11b361e
25cedb9c981f72bc563e3cc68c13c34fe26ed820
refs/heads/master
2022-01-19T09:05:51.441598
2017-07-18T03:52:46
2017-07-18T03:52:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,757
java
package com.wlwx.back.system; import com.wlwx.application.SpringContextUtil; import com.wlwx.azkaban.AzkabanUtil; import com.wlwx.back.quartz.QuartzScheduling; import com.wlwx.back.task.ControlTask; import com.wlwx.back.task.ExportTask; import com.wlwx.back.task.ThreadPoolService; import com.wlwx.back.util.PlatformUtil; import com.wlwx.model.AzUserInfo; import com.wlwx.model.ModelInfo; import com.wlwx.model.TaskInfo; import com.wlwx.model.UserInfo; import com.wlwx.service.TaskService; import com.wlwx.service.UserService; import java.text.SimpleDateFormat; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.log4j.Logger; /** * 系统初始化类 * @author zjj * @date 2017年7月11日 下午4:54:05 */ public class SystemInit { public static final Logger LOGGER = Logger.getLogger(SystemInit.class); public static Map<String, Object> sessionMap = new ConcurrentHashMap<>(); public static ThreadPoolService taskService; /** * 开启任务线程 * @date 2017年7月11日 下午4:54:15 */ public static synchronized void start() { try { //初始化任务线程 taskService = new ThreadPoolService(Integer.parseInt(PlatformUtil.getProperties("taskThreadNum"))); //恢复未完成任务 resumeTasks(); //启动线程 taskService.start(); //启动定时删除历史数据任务 QuartzScheduling.delHistoryDataOnTime(); } catch (Exception e) { LOGGER.error("SystemInit start() error", e); } } /** * 关闭任务线程 * @date 2017年7月11日 下午4:54:27 */ public static synchronized void stop() { try { taskService.stop(true); } catch (Exception e) { LOGGER.error("SystemInit stop() error", e); } } /** * 恢复数据库中未完成的任务 * @authod zjj * @date 2017年7月13日 下午4:51:37 */ private static void resumeTasks(){ TaskService tService = (TaskService) SpringContextUtil.getBean("taskService"); UserService uService = (UserService) SpringContextUtil.getBean("userService"); List<TaskInfo> taskInfos = tService.getNotFinishTasks();//查找数据库未完成的任务 for (TaskInfo taskInfo : taskInfos) { UserInfo userInfo = uService.getById(taskInfo.getUser_id()); /** * 创建任务队列的任务信息 */ ExportTask exportTask = new ExportTask(); exportTask.setTask_id(taskInfo.getTask_id()); exportTask.setUser_id(taskInfo.getUser_id()); exportTask.setCreate_time(taskInfo.getCreate_time()); exportTask.setStart_time(taskInfo.getStart_time()); exportTask.setPriority(taskInfo.getPriority()); exportTask.setModel_id(taskInfo.getModel_id()); exportTask.setState(TaskInfo.NEW); exportTask.setTaskService(tService); exportTask.setExec_id(taskInfo.getExec_id()); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); Map<String, Object> taskParam = PlatformUtil.jsonToMap(taskInfo.getTask_param()); taskParam.put("user_id", userInfo.getUser_id()); taskParam.put("user_source", userInfo.getCustom_source()); taskParam.put("create_time", sdf.format(taskInfo.getCreate_time())); taskParam.put("useExecutor", AzkabanUtil.HADOOP03); taskParam.put("task_id", taskInfo.getTask_id()); exportTask.setTask_param(taskParam); AzUserInfo azUserInfo = uService.getAzUser(userInfo.getAz_user_id()); if (azUserInfo != null) { exportTask.setAzUserInfo(azUserInfo); ModelInfo modelInfo = tService.getModelById(taskInfo.getModel_id()); if (modelInfo != null) { exportTask.setModelInfo(modelInfo); ControlTask.startTask(exportTask); } } } } }
[ "zjj@SKY-20160920PPZ" ]
zjj@SKY-20160920PPZ
528f132c8f1a5b819b77b596fc87dd2d75d6a113
20828a901e85a3262fba540ea94ad856ee4eb28c
/src/main/java/com/edms/documentmodule/ArrayOfFiles.java
418a2fbd79f1cd2a1e5357f26a04d2b1c6e16392
[]
no_license
SilvereyeITSolutions/EDMS-Web-Service-Producing
223c84d6ce1acef483c0490d6a964c864046d773
e0d8632ea0b24a515b6c733d2303080410d6647f
refs/heads/master
2020-04-18T17:51:03.356911
2015-06-01T05:09:53
2015-06-01T05:09:53
28,077,371
0
0
null
null
null
null
UTF-8
Java
false
false
2,259
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2015.04.28 at 06:01:22 PM IST // package com.edms.documentmodule; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ArrayOfFiles complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ArrayOfFiles"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="FileList" type="{http://edms.com/documentModule}File" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ArrayOfFiles", propOrder = { "fileList" }) public class ArrayOfFiles { @XmlElement(name = "FileList", nillable = true) protected List<File> fileList; /** * Gets the value of the fileList property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the fileList property. * * <p> * For example, to add a new item, do as follows: * <pre> * getFileList().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link File } * * */ public List<File> getFileList() { if (fileList == null) { fileList = new ArrayList<File>(); } return this.fileList; } }
[ "Administrator@SITS-NODE2" ]
Administrator@SITS-NODE2
b243221284a2f05f62d4f5cb533cefef4c579cba
f09f202e721b483b5fd5e7b9d5d95aad8d764232
/src/td/tile/Tile.java
b0177988f74043976b5c80a74f5b633b0e8979eb
[]
no_license
zachgoldstein13/Insecticide
715179bb8ba9e7ec8af2ee44c8980e3bee103536
59e7fccc9cb505821474f8b7ef05f62017f2b94d
refs/heads/master
2020-09-09T11:00:13.950555
2017-06-19T14:26:16
2017-06-19T14:26:16
94,443,341
0
0
null
null
null
null
UTF-8
Java
false
false
1,871
java
package td.tile; import org.newdawn.slick.opengl.Texture; import static td.main.Window.*; /** * Created by andrew_sayegh on 5/31/17. */ public class Tile { private float x, y; private int width, height; private Texture texture; private TileType type; private boolean occupied; public Tile(float x, float y, int width, int height, TileType type) { this.x = x; this.y = y; this.width = width; this.height = height; this.type = type; this.texture = quickLoad(type.textureName); if (this.type.buildable) this.occupied = false; else this.occupied = true; } public void draw() { drawQuadTex(texture, x, y, width, height); } //int public int getX() { return (int) x; } public int getY() { return (int) y; } public int getxPlace() { return (int) x / TILE_SIZE; } public int getyPlace() { return (int) y / TILE_SIZE; } public int getWidth() { return width; } public int getHeight() { return height; } //void public void setX(float x) { this.x = x; } public void setY(float y) { this.y = y; } public void setWidth(int width) { this.width = width; } public void setHeight(int height) { this.height = height; } public void setTexture(Texture texture) { this.texture = texture; } public void setType(TileType type) { this.type = type; } public void setOccupied(boolean occupied) { this.occupied = occupied; } //other public Texture getTexture() { return texture; } public TileType getType() { return type; } public boolean isOccupied() { return occupied; } }
[ "oopneg@gmail.com" ]
oopneg@gmail.com
f21a70881f7b19a337dcf04556ad5b0740916025
b6a7eb7b85a09e5d8468e72a38fbc832bef3ad47
/app/src/main/java/com/x_mega/oculator/motion_picture/filter/BlurFilter.java
6f66a97d4791878d7875f3a84bfbba56a7c411af
[]
no_license
toomask/oculator
0704915bdfd71c8710d4ba2adabd11fc85270ada
569a6d76d1153876b58a8ac235625a8e879629e7
refs/heads/master
2021-01-13T01:36:52.725684
2014-11-04T07:20:12
2014-11-04T07:20:12
25,860,414
3
1
null
null
null
null
UTF-8
Java
false
false
1,937
java
package com.x_mega.oculator.motion_picture.filter; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import com.x_mega.oculator.motion_picture.BasicMotionPicture; import com.x_mega.oculator.motion_picture.MotionPicture; /** * Created by toomas on 8.10.2014. */ public class BlurFilter implements Filter { @Override public MotionPicture applyTo(MotionPicture motionPicture) { BasicMotionPicture newPicture = new BasicMotionPicture(); Bitmap lastFrame = motionPicture.getFrame(0); for (int i = 0; i < motionPicture.getFrameCount(); i++) { Bitmap newFrame = lastFrame.copy(Bitmap.Config.ARGB_8888, true); Canvas canvas = new Canvas(newFrame); Paint paint = new Paint(); paint.setAlpha(200); canvas.drawBitmap(motionPicture.getFrame(i), 0, 0, paint); newPicture.addFrame(newFrame); newPicture.setFrameDuration(i, motionPicture.getFrameDuration(i)); lastFrame = newFrame; } for (int i = 0; i < newPicture.getFrameCount(); i++) { Bitmap newFrame = lastFrame.copy(Bitmap.Config.ARGB_8888, true); Canvas canvas = new Canvas(newFrame); Paint paint = new Paint(); paint.setAlpha(200); canvas.drawBitmap(newPicture.getFrame(i), 0, 0, paint); newPicture.setFrame(i, newFrame); lastFrame = newFrame; } for (int i = 0; i < newPicture.getFrameCount(); i++) { Bitmap newFrame = lastFrame.copy(Bitmap.Config.ARGB_8888, true); Canvas canvas = new Canvas(newFrame); Paint paint = new Paint(); paint.setAlpha(200); canvas.drawBitmap(newPicture.getFrame(i), 0, 0, paint); newPicture.setFrame(i, newFrame); lastFrame = newFrame; } return newPicture; } }
[ "toomas@mooncascade.com" ]
toomas@mooncascade.com
ba83eac5bb1c5c65cab59bb9dd8821c969cad685
e304caceace68ca6589369e161e13507acb14efb
/app/src/main/java/com/collegedekho/app/entities/Feed.java
3e02a77d04611a26f6bd6dd68ec032b699f0ac93
[]
no_license
deepak-collegedekho/AndroidApp
c31ed6b2af0129ac92d18f1c02e21be921d6f39f
2c72bff02777bbf2862737946ab9d1cc640df8c7
refs/heads/master
2020-07-07T08:49:26.849849
2018-12-11T06:10:57
2018-12-11T06:10:57
203,305,498
0
0
null
null
null
null
UTF-8
Java
false
false
5,152
java
package com.collegedekho.app.entities; import android.os.Parcel; import android.os.Parcelable; /** * Created by harshvardhan on 15/11/16. */ public class Feed implements Parcelable { private String title = ""; //if this is not populated, nothing will open up, but just the app home page //if this is wrongly populated, there will be error 404 most probably private String resource_uri = ""; private String web_resource_uri = ""; private String icon = ""; private String image = ""; private String description = ""; private String feed_time = ""; //if this is not populated, nothing will open up, but just the app home page private String screen = ""; //this is required for stuff n ol private int id = 0; private String feed_background_color = ""; private String title_color = ""; private String time_color = ""; private String description_color = ""; private String result = ""; private int is_study_abroad = -1; public Feed(){ } public Feed(Parcel in) { title = in.readString(); resource_uri = in.readString(); web_resource_uri = in.readString(); id = in.readInt(); image = in.readString(); icon = in.readString(); screen = in.readString(); description = in.readString(); feed_time = in.readString(); feed_background_color = in.readString(); title_color = in.readString(); time_color = in.readString(); description_color = in.readString(); result = in.readString(); is_study_abroad = in.readInt(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeString(title); parcel.writeString(resource_uri); parcel.writeString(web_resource_uri); parcel.writeInt(id); parcel.writeString(image); parcel.writeString(icon); parcel.writeString(screen); parcel.writeString(description); parcel.writeString(feed_time); parcel.writeString(feed_background_color); parcel.writeString(title_color); parcel.writeString(time_color); parcel.writeString(description_color); parcel.writeString(result); parcel.writeInt(is_study_abroad); } public static final Creator<Feed> CREATOR = new Creator<Feed>() { @Override public Feed createFromParcel(Parcel in) { return new Feed(in); } @Override public Feed[] newArray(int size) { return new Feed[size]; } }; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getResource_uri() { return resource_uri; } public void setResource_uri(String resource_uri) { this.resource_uri = resource_uri; } public String getWeb_resource_uri() { return web_resource_uri; } public void setWeb_resource_uri(String web_resource_uri) { this.web_resource_uri = web_resource_uri; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getFeed_time() { return feed_time; } public void setFeed_time(String feed_time) { this.feed_time = feed_time; } public String getScreen() { return screen; } public void setScreen(String screen) { this.screen = screen; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFeed_background_color() { return feed_background_color; } public void setFeed_background_color(String feed_background_color) { this.feed_background_color = feed_background_color; } public String getTitle_color() { return title_color; } public void setTitle_color(String title_color) { this.title_color = title_color; } public String getTime_color() { return time_color; } public void setTime_color(String time_color) { this.time_color = time_color; } public String getDescription_color() { return description_color; } public void setDescription_color(String description_color) { this.description_color = description_color; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public boolean getIs_study_abroad() { return is_study_abroad == 1; } public void setIs_study_abroad(int is_study_abroad) { this.is_study_abroad = is_study_abroad; } }
[ "harsh.vardhan@girnarsoft.com" ]
harsh.vardhan@girnarsoft.com
fbf4d0750dd5a3d6b83beb93a467774b4c0c4d87
679847a965581810776852303f3355dceadea274
/APIMM/src/main/java/com/APIMM/mam/repository/NoLocationIssueRepository.java
26ab5fc9701e21ca09049c461b51919e49e0dde5
[]
no_license
chuongnguyen-karrostech/ADP-TC
22f134ea9883d29576d61c4c1fe49782de56bb7f
5e788974020b130df710772a698d6ac79b7ac353
refs/heads/master
2022-07-06T22:10:26.681613
2020-05-18T08:41:20
2020-05-18T08:41:20
232,721,120
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package com.APIMM.mam.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import com.APIMM.mam.model.NoLocationIssue; public interface NoLocationIssueRepository extends JpaRepository<NoLocationIssue, Integer>, JpaSpecificationExecutor<NoLocationIssue> { }
[ "59358337+chuongnguyen-karrostech@users.noreply.github.com" ]
59358337+chuongnguyen-karrostech@users.noreply.github.com
477bcf2aa0284f04e9831c5efb51e8da25f7321d
f8d9f87ccfdfa507d4fb279796e7103638560058
/core/src/fr/alex/games/items/ModifType.java
bca5babf97d0e474252b66523ebcf45beff0f0d8
[]
no_license
alexislargaiolli/chick-jones
2c86a3b153a9d2080a0419a1f483ee1469fda592
057dae6ec77ebf4d7f2fb403718c4f2f3c8cbd65
refs/heads/master
2021-01-20T02:56:48.401170
2015-01-22T17:00:40
2015-01-22T17:00:40
29,579,416
0
0
null
null
null
null
UTF-8
Java
false
false
76
java
package fr.alex.games.items; public enum ModifType { ADD, SUB, MUL, DIV }
[ "alexis.largaiolli@gmail.com" ]
alexis.largaiolli@gmail.com
3f86c2c5835a946e26f8b9847767b2450a46842d
2be2b480b32f4d32913aef73fd36f75ccfec84b8
/app/src/main/java/stws/chatstocker/ConstantsValues.java
b1e8e8acbcbd9caf115c33d9cd2819ee17abd155
[]
no_license
sachinverma310/ChatStocker
17055f4ad34757518bfce22c484bbb26ce1373fe
6cc11ea5272a8c9b7aa46622a9972b677f065a0b
refs/heads/master
2022-11-15T06:10:55.619144
2020-01-08T05:16:44
2020-01-08T05:16:44
279,263,377
0
0
null
null
null
null
UTF-8
Java
false
false
1,681
java
package stws.chatstocker; public interface ConstantsValues { int RC_SIGN_IN = 102; String KEY_VERIFICATION_ID="verification_id"; String KEY_OTP="otp"; String KEY_LOGIN_DATA="login_data"; String KEY_IS_LOGIN="is_login"; String KEYOTHER_UID="other_uid"; String KEY_FILE_URL="file_url"; String KEY_FILE_LIST="file_list"; String KEY_FILE="file"; String KEY_VIDEO_ID="video_id"; String KEY_PATH="path"; String KEY_USER_ID="user_id"; String BASE_FILE_URL="https://drive.google.com/file/d/"; String KEY_GRP_USER="grp_user"; String KEY_ADDED_GRP="group"; String KEY_GRP_IMAGE="grp_image"; String KEY_GRP_NAME="grp_name"; String KEY_LAST_MSG_TIME="last_msg_time"; String KEY_GRP_ID="grp_id"; String KEY_CREATED_BY="created_by"; String KEY_CREATED_AT="created_at"; String KEY_GROUP_DETAILS="group_details"; String KEY_GROUP_MESSAGES="group_messages"; String KEY_ID="id"; int KEY_EDIT_REQUEST_CODE=105; int KEY_FULL_SCREEN_REQUEST_CODE=108; String FCM_API="https://fcm.googleapis.com/fcm/send"; String SERVER_KEY="key=AAAA8uN4rmU:APA91bG2wAdP2mSKdZMv9YRjf2WXM3xKqJVZdrt0GeT82KUKxc6lsB2lcxM8OBvni78T6jaMNR7bAMu2Sp3FdkJTdn1PB5x2IoVomkemMOsjUFqcWIuE6AJU87m3XzgIIqzY1H-B2vj-"; String KEY_DEVICE_TOKEN="device_token"; String KEY_ISFROM_CHAT="is_from_chat"; String KEY_ISFROM_ACT="is_from_ACT"; String KEY_ISFROM_CURRENT="is_from_Current"; String KEY_POS="pos"; String KEY_URL_LIST="file_url_list"; String KEY_Noti_RADIO_ID="radiob_btn_id"; String KEY_NotI_SETTING="noti_setting"; String KEY_FROM="is_from"; String KEY_FRIEND="friend"; }
[ "devraj@stws.io" ]
devraj@stws.io
3f828b131f47fd0bf28a2fc3a3c276d23ce64085
d7c158add60b53e6d898d4e9f675af3a629adce1
/byebye-kzj-dao/src/main/java/com/cloudyoung/baic/model/UserTokenExample.java
69190e10f8512c105e45f7695f4956083c76db09
[]
no_license
KuangXiaoXinFei/byebye-kezhongjie
03e782c2801d1efc8de652873ca33c3caee5d488
e38a40dd779f759856339e83ca9d9db8352afe1f
refs/heads/master
2020-03-26T16:26:39.244097
2018-08-17T09:48:12
2018-08-17T09:48:12
145,102,113
0
0
null
null
null
null
UTF-8
Java
false
false
25,141
java
package com.cloudyoung.baic.model; import lombok.Data; import lombok.experimental.Accessors; import java.util.ArrayList; import java.util.Date; import java.util.List; @Data @Accessors(chain = true) public class UserTokenExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; private Integer limit; private Integer offset; public UserTokenExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } public void setLimit(Integer limit) { this.limit = limit; } public Integer getLimit() { return limit; } public void setOffset(Integer offset) { this.offset = offset; } public Integer getOffset() { return offset; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andUserIdIsNull() { addCriterion("user_id is null"); return (Criteria) this; } public Criteria andUserIdIsNotNull() { addCriterion("user_id is not null"); return (Criteria) this; } public Criteria andUserIdEqualTo(Integer value) { addCriterion("user_id =", value, "userId"); return (Criteria) this; } public Criteria andUserIdNotEqualTo(Integer value) { addCriterion("user_id <>", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThan(Integer value) { addCriterion("user_id >", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { addCriterion("user_id >=", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThan(Integer value) { addCriterion("user_id <", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThanOrEqualTo(Integer value) { addCriterion("user_id <=", value, "userId"); return (Criteria) this; } public Criteria andUserIdIn(List<Integer> values) { addCriterion("user_id in", values, "userId"); return (Criteria) this; } public Criteria andUserIdNotIn(List<Integer> values) { addCriterion("user_id not in", values, "userId"); return (Criteria) this; } public Criteria andUserIdBetween(Integer value1, Integer value2) { addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } public Criteria andUserIdNotBetween(Integer value1, Integer value2) { addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } public Criteria andTokenIsNull() { addCriterion("token is null"); return (Criteria) this; } public Criteria andTokenIsNotNull() { addCriterion("token is not null"); return (Criteria) this; } public Criteria andTokenEqualTo(String value) { addCriterion("token =", value, "token"); return (Criteria) this; } public Criteria andTokenNotEqualTo(String value) { addCriterion("token <>", value, "token"); return (Criteria) this; } public Criteria andTokenGreaterThan(String value) { addCriterion("token >", value, "token"); return (Criteria) this; } public Criteria andTokenGreaterThanOrEqualTo(String value) { addCriterion("token >=", value, "token"); return (Criteria) this; } public Criteria andTokenLessThan(String value) { addCriterion("token <", value, "token"); return (Criteria) this; } public Criteria andTokenLessThanOrEqualTo(String value) { addCriterion("token <=", value, "token"); return (Criteria) this; } public Criteria andTokenLike(String value) { addCriterion("token like", value, "token"); return (Criteria) this; } public Criteria andTokenNotLike(String value) { addCriterion("token not like", value, "token"); return (Criteria) this; } public Criteria andTokenIn(List<String> values) { addCriterion("token in", values, "token"); return (Criteria) this; } public Criteria andTokenNotIn(List<String> values) { addCriterion("token not in", values, "token"); return (Criteria) this; } public Criteria andTokenBetween(String value1, String value2) { addCriterion("token between", value1, value2, "token"); return (Criteria) this; } public Criteria andTokenNotBetween(String value1, String value2) { addCriterion("token not between", value1, value2, "token"); return (Criteria) this; } public Criteria andIpIsNull() { addCriterion("ip is null"); return (Criteria) this; } public Criteria andIpIsNotNull() { addCriterion("ip is not null"); return (Criteria) this; } public Criteria andIpEqualTo(String value) { addCriterion("ip =", value, "ip"); return (Criteria) this; } public Criteria andIpNotEqualTo(String value) { addCriterion("ip <>", value, "ip"); return (Criteria) this; } public Criteria andIpGreaterThan(String value) { addCriterion("ip >", value, "ip"); return (Criteria) this; } public Criteria andIpGreaterThanOrEqualTo(String value) { addCriterion("ip >=", value, "ip"); return (Criteria) this; } public Criteria andIpLessThan(String value) { addCriterion("ip <", value, "ip"); return (Criteria) this; } public Criteria andIpLessThanOrEqualTo(String value) { addCriterion("ip <=", value, "ip"); return (Criteria) this; } public Criteria andIpLike(String value) { addCriterion("ip like", value, "ip"); return (Criteria) this; } public Criteria andIpNotLike(String value) { addCriterion("ip not like", value, "ip"); return (Criteria) this; } public Criteria andIpIn(List<String> values) { addCriterion("ip in", values, "ip"); return (Criteria) this; } public Criteria andIpNotIn(List<String> values) { addCriterion("ip not in", values, "ip"); return (Criteria) this; } public Criteria andIpBetween(String value1, String value2) { addCriterion("ip between", value1, value2, "ip"); return (Criteria) this; } public Criteria andIpNotBetween(String value1, String value2) { addCriterion("ip not between", value1, value2, "ip"); return (Criteria) this; } public Criteria andPlatformIsNull() { addCriterion("platform is null"); return (Criteria) this; } public Criteria andPlatformIsNotNull() { addCriterion("platform is not null"); return (Criteria) this; } public Criteria andPlatformEqualTo(String value) { addCriterion("platform =", value, "platform"); return (Criteria) this; } public Criteria andPlatformNotEqualTo(String value) { addCriterion("platform <>", value, "platform"); return (Criteria) this; } public Criteria andPlatformGreaterThan(String value) { addCriterion("platform >", value, "platform"); return (Criteria) this; } public Criteria andPlatformGreaterThanOrEqualTo(String value) { addCriterion("platform >=", value, "platform"); return (Criteria) this; } public Criteria andPlatformLessThan(String value) { addCriterion("platform <", value, "platform"); return (Criteria) this; } public Criteria andPlatformLessThanOrEqualTo(String value) { addCriterion("platform <=", value, "platform"); return (Criteria) this; } public Criteria andPlatformLike(String value) { addCriterion("platform like", value, "platform"); return (Criteria) this; } public Criteria andPlatformNotLike(String value) { addCriterion("platform not like", value, "platform"); return (Criteria) this; } public Criteria andPlatformIn(List<String> values) { addCriterion("platform in", values, "platform"); return (Criteria) this; } public Criteria andPlatformNotIn(List<String> values) { addCriterion("platform not in", values, "platform"); return (Criteria) this; } public Criteria andPlatformBetween(String value1, String value2) { addCriterion("platform between", value1, value2, "platform"); return (Criteria) this; } public Criteria andPlatformNotBetween(String value1, String value2) { addCriterion("platform not between", value1, value2, "platform"); return (Criteria) this; } public Criteria andVersionIsNull() { addCriterion("version is null"); return (Criteria) this; } public Criteria andVersionIsNotNull() { addCriterion("version is not null"); return (Criteria) this; } public Criteria andVersionEqualTo(String value) { addCriterion("version =", value, "version"); return (Criteria) this; } public Criteria andVersionNotEqualTo(String value) { addCriterion("version <>", value, "version"); return (Criteria) this; } public Criteria andVersionGreaterThan(String value) { addCriterion("version >", value, "version"); return (Criteria) this; } public Criteria andVersionGreaterThanOrEqualTo(String value) { addCriterion("version >=", value, "version"); return (Criteria) this; } public Criteria andVersionLessThan(String value) { addCriterion("version <", value, "version"); return (Criteria) this; } public Criteria andVersionLessThanOrEqualTo(String value) { addCriterion("version <=", value, "version"); return (Criteria) this; } public Criteria andVersionLike(String value) { addCriterion("version like", value, "version"); return (Criteria) this; } public Criteria andVersionNotLike(String value) { addCriterion("version not like", value, "version"); return (Criteria) this; } public Criteria andVersionIn(List<String> values) { addCriterion("version in", values, "version"); return (Criteria) this; } public Criteria andVersionNotIn(List<String> values) { addCriterion("version not in", values, "version"); return (Criteria) this; } public Criteria andVersionBetween(String value1, String value2) { addCriterion("version between", value1, value2, "version"); return (Criteria) this; } public Criteria andVersionNotBetween(String value1, String value2) { addCriterion("version not between", value1, value2, "version"); return (Criteria) this; } public Criteria andExpireTimeIsNull() { addCriterion("expire_time is null"); return (Criteria) this; } public Criteria andExpireTimeIsNotNull() { addCriterion("expire_time is not null"); return (Criteria) this; } public Criteria andExpireTimeEqualTo(Date value) { addCriterion("expire_time =", value, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeNotEqualTo(Date value) { addCriterion("expire_time <>", value, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeGreaterThan(Date value) { addCriterion("expire_time >", value, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeGreaterThanOrEqualTo(Date value) { addCriterion("expire_time >=", value, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeLessThan(Date value) { addCriterion("expire_time <", value, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeLessThanOrEqualTo(Date value) { addCriterion("expire_time <=", value, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeIn(List<Date> values) { addCriterion("expire_time in", values, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeNotIn(List<Date> values) { addCriterion("expire_time not in", values, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeBetween(Date value1, Date value2) { addCriterion("expire_time between", value1, value2, "expireTime"); return (Criteria) this; } public Criteria andExpireTimeNotBetween(Date value1, Date value2) { addCriterion("expire_time not between", value1, value2, "expireTime"); return (Criteria) this; } public Criteria andIsActiveIsNull() { addCriterion("is_active is null"); return (Criteria) this; } public Criteria andIsActiveIsNotNull() { addCriterion("is_active is not null"); return (Criteria) this; } public Criteria andIsActiveEqualTo(Integer value) { addCriterion("is_active =", value, "isActive"); return (Criteria) this; } public Criteria andIsActiveNotEqualTo(Integer value) { addCriterion("is_active <>", value, "isActive"); return (Criteria) this; } public Criteria andIsActiveGreaterThan(Integer value) { addCriterion("is_active >", value, "isActive"); return (Criteria) this; } public Criteria andIsActiveGreaterThanOrEqualTo(Integer value) { addCriterion("is_active >=", value, "isActive"); return (Criteria) this; } public Criteria andIsActiveLessThan(Integer value) { addCriterion("is_active <", value, "isActive"); return (Criteria) this; } public Criteria andIsActiveLessThanOrEqualTo(Integer value) { addCriterion("is_active <=", value, "isActive"); return (Criteria) this; } public Criteria andIsActiveIn(List<Integer> values) { addCriterion("is_active in", values, "isActive"); return (Criteria) this; } public Criteria andIsActiveNotIn(List<Integer> values) { addCriterion("is_active not in", values, "isActive"); return (Criteria) this; } public Criteria andIsActiveBetween(Integer value1, Integer value2) { addCriterion("is_active between", value1, value2, "isActive"); return (Criteria) this; } public Criteria andIsActiveNotBetween(Integer value1, Integer value2) { addCriterion("is_active not between", value1, value2, "isActive"); return (Criteria) this; } public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; } public Criteria andCreateTimeIsNotNull() { addCriterion("create_time is not null"); return (Criteria) this; } public Criteria andCreateTimeEqualTo(Date value) { addCriterion("create_time =", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotEqualTo(Date value) { addCriterion("create_time <>", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeGreaterThan(Date value) { addCriterion("create_time >", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { addCriterion("create_time >=", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeLessThan(Date value) { addCriterion("create_time <", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeLessThanOrEqualTo(Date value) { addCriterion("create_time <=", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeIn(List<Date> values) { addCriterion("create_time in", values, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotIn(List<Date> values) { addCriterion("create_time not in", values, "createTime"); return (Criteria) this; } public Criteria andCreateTimeBetween(Date value1, Date value2) { addCriterion("create_time between", value1, value2, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotBetween(Date value1, Date value2) { addCriterion("create_time not between", value1, value2, "createTime"); return (Criteria) this; } public Criteria andUpdateTimeIsNull() { addCriterion("update_time is null"); return (Criteria) this; } public Criteria andUpdateTimeIsNotNull() { addCriterion("update_time is not null"); return (Criteria) this; } public Criteria andUpdateTimeEqualTo(Date value) { addCriterion("update_time =", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotEqualTo(Date value) { addCriterion("update_time <>", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeGreaterThan(Date value) { addCriterion("update_time >", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { addCriterion("update_time >=", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeLessThan(Date value) { addCriterion("update_time <", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { addCriterion("update_time <=", value, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeIn(List<Date> values) { addCriterion("update_time in", values, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotIn(List<Date> values) { addCriterion("update_time not in", values, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeBetween(Date value1, Date value2) { addCriterion("update_time between", value1, value2, "updateTime"); return (Criteria) this; } public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { addCriterion("update_time not between", value1, value2, "updateTime"); return (Criteria) this; } } /** */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "liujs@cloud-young.com" ]
liujs@cloud-young.com
1ac7741f52e3825af987b05f67cb5ee042e913ae
7120ed04f7d305641529ea82c8642438acec920c
/codeforces/1373/C.java
10279185860c0fe4277d2c6207555febfa8b6f8c
[]
no_license
aditya-786/coding-submissions
d1a886f837d25f25bfbabd911b3bc47eb9d5edf8
eb563f09ca79fdb6a8ffbb22038f5dc35d24b275
refs/heads/master
2023-06-27T13:07:39.322504
2021-07-24T18:46:57
2021-07-24T18:46:57
387,923,409
0
0
null
null
null
null
UTF-8
Java
false
false
7,890
java
import java.io.*; import java.util.*; /* author : Aditya Aggarwal ' The Dawn does not come twice to awaken the man ' ---->>> By my brother ( My Motivation ) Believe In yourself, Everything is possible. Never Give Up */ public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } static class Reader { final private int BUFFER_SIZE = 1 << 16; private final DataInputStream din; private final byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public Reader(String file_name) throws IOException { din = new DataInputStream(new FileInputStream(file_name)); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String readLine() throws IOException { byte[] buf = new byte[64]; // line length int cnt = 0, c; while ((c = read()) != -1) { if (c == '\n') break; buf[cnt++] = (byte) c; } return new String(buf, 0, cnt); } public int nextInt() throws IOException { int ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public long nextLong() throws IOException { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public double nextDouble() throws IOException { double ret = 0, div = 1; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (c == '.') { while ((c = read()) >= '0' && c <= '9') { ret += (c - '0') / (div *= 10); } } if (neg) return -ret; return ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } public void close() throws IOException { if (din == null) return; din.close(); } } static int MOD = (int) (1e9 + 7); static long powerLL(long x, long n) { long result = 1; while (n > 0) { if (n % 2 == 1) { result = result * x % MOD; } n = n / 2; x = x * x % MOD; } return result; } static long powerStrings(String sa, String sb) { long a = 0, b = 0; for (int i = 0; i < sa.length(); i++) { a = (a * 10 + (sa.charAt(i) - '0')) % MOD; } for (int i = 0; i < sb.length(); i++) { b = (b * 10 + (sb.charAt(i) - '0')) % (MOD - 1); } return powerLL(a, b); } static long gcd(long a, long b) { if (a==0) return b; else return gcd(b%a,a); } static long lcm(long a, long b) { return (a*b)/gcd(a,b); } static int lower_bound(List<Integer> list, int k) { int s = 0; int e = list.size(); while (s!=e) { int mid = (s+e)>>1; if (list.get(mid)<k) s = mid+1; else e = mid; } if (s == list.size()) return -1; return s; } static int upper_bound(List<Integer> list, int k) { int s = 0; int e = list.size(); while (s!=e) { int mid = (s+e)>>1; if (list.get(mid)<=k) s = mid+1; else e = mid; } if (s == list.size()) return -1; return s; } static void addEdge(ArrayList<ArrayList<Integer>>graph, int edge1, int edge2) { graph.get(edge1).add(edge2); graph.get(edge2).add(edge1); } static class Pair<X,Y> { public final X first; public final Y second; Pair(X first, Y second) { this.first = first; this.second = second; } public static <X,Y> Pair <X,Y> of (X a, Y b) { return new Pair<>(a,b); } public String toString() { return "("+first+","+second+")"; } } public static void main(String[] args) throws java.lang.Exception { try { FastReader fr = new FastReader(); //Reader fr = new Reader(); try (OutputStream out = new BufferedOutputStream(System.out)) { int testcases = fr.nextInt(); while (testcases -- > 0) { String s = fr.nextLine(); long res = 0L; int cur = 0; for (int i=0;i<s.length();i++) { res++; char c = s.charAt(i); if (c == '+') cur++; else cur--; if (cur<0) { res+=i+1; cur = 0; } } out.write((res+"\n").getBytes()); } } } catch(Exception e){} finally{} } } //(()) () (()((()()()())))
[ "adityaaggarwal7861@gmail.com" ]
adityaaggarwal7861@gmail.com
36b2666954115074ec7f233e842f1e154f079c81
330bdc824d27d7cb2638e9ecff2eb8561239c3c0
/sanfermin2.0/src/administratzailea/BotikaAldatu.java
e53e6f1287f3b33ea87fe5c12fb430f056e837e5
[]
no_license
unaiguenaga/sanfermin2.0
1f34a4e554afdc0a48eb26fa09c383ea6f2c8597
530e0d0d08a6442a2b793cd747cf6b248f66cc9e
refs/heads/master
2021-01-02T23:08:01.765601
2014-12-23T23:00:15
2014-12-23T23:00:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,974
java
package administratzailea; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import Logika.EntzierroKud; import Logika.GanadutegiKud; import Logika.TratamenduKud; public class BotikaAldatu extends JFrame { JLabel botika = new JLabel("Botika:"); JLabel kodeZaharra = new JLabel("Kode Zaharra:"); JLabel kodeBerria = new JLabel("Kode Berria:"); JLabel izenBerria = new JLabel("Izen Berria:"); JTextField kodeZaharraTestua = new JTextField(10); JTextField kodeBerriaTestua = new JTextField(10); JTextField izenBerriaTestua = new JTextField(10); JPanel behekoPanela = new JPanel(); JButton gorde = new JButton("Aldaketak gorde"); private GridBagLayout eskema; private Container edukiontzia; private GridBagConstraints mugak; private TratamenduKud tk = TratamenduKud.getInstantzia(); private Vector<String> vBotikak = tk.getIzenak(); JComboBox cbBotika = new JComboBox(vBotikak); public BotikaAldatu() { gridBagHasieratu(); } public static void main(String[] args) { BotikaAldatu hasiera = new BotikaAldatu(); hasiera.setTitle("Botiken datuak aldatu"); hasiera.setVisible(true); hasiera.setSize(400, 175); hasiera.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } private void gridBagHasieratu() { edukiontzia = getContentPane(); eskema = new GridBagLayout(); edukiontzia.setLayout(eskema); mugak = new GridBagConstraints(); gehituOsagaia(botika, 1, 1, 4, 1); mugak.insets = new Insets(3, 3, 3, 3); gehituOsagaia(kodeZaharra, 3, 1, 4, 1); mugak.insets = new Insets(3, 3, 3, 3); gehituOsagaia(kodeBerria, 6, 1, 4, 1); mugak.insets = new Insets(3, 3, 3, 3); gehituOsagaia(izenBerria, 9, 1, 4, 1); mugak.insets = new Insets(3, 3, 3, 3); gehituOsagaia(cbBotika, 1, 5, 5, 1); mugak.insets = new Insets(3, 3, 3, 3); gehituOsagaia(kodeZaharraTestua, 3, 5, 5, 1); mugak.insets = new Insets(3, 3, 3, 3); gehituOsagaia(kodeBerriaTestua, 6, 5, 5, 1); mugak.insets = new Insets(3, 3, 3, 3); gehituOsagaia(izenBerriaTestua, 9, 5, 5, 1); mugak.insets = new Insets(3, 3, 3, 3); behekoPanela.add(BorderLayout.SOUTH, gorde); gehituOsagaia(behekoPanela, 16, 3, 9, 1); gorde.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); } private void gehituOsagaia(Component osagaia, int errenkada, int zutabea, int zabalera, int altuera) { mugak.gridx = zutabea; mugak.gridy = errenkada; mugak.gridwidth = zabalera; mugak.gridheight = altuera; eskema.setConstraints(osagaia, mugak); edukiontzia.add(osagaia); } }
[ "uguenaga001@ikasle.ehu.es" ]
uguenaga001@ikasle.ehu.es
c3041ec68a9167c1829fb6f566301287a77ace8f
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/lucene-solr/2019/4/TimeRoutedAliasUpdateProcessorTest.java
c1d25a64589d4bbfeca64ba8de88df374ab5f00c
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
31,402
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.solr.update.processor; import java.io.IOException; import java.lang.invoke.MethodHandles; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import org.apache.lucene.util.LuceneTestCase; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CloudSolrClient; import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.client.solrj.request.ConfigSetAdminRequest; import org.apache.solr.client.solrj.response.FieldStatsInfo; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.client.solrj.response.UpdateResponse; import org.apache.solr.cloud.api.collections.RoutedAlias; import org.apache.solr.cloud.api.collections.TimeRoutedAlias; import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.util.ExecutorUtil; import org.apache.solr.core.CoreContainer; import org.apache.solr.core.CoreDescriptor; import org.apache.solr.update.UpdateCommand; import org.apache.solr.util.LogLevel; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static java.util.concurrent.TimeUnit.NANOSECONDS; @LuceneTestCase.BadApple(bugUrl = "https://issues.apache.org/jira/browse/SOLR-13059") public class TimeRoutedAliasUpdateProcessorTest extends RoutedAliasUpdateProcessorTest { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final String alias = "myalias"; private static final String alias2 = "myalias2"; private static final String timeField = "timestamp_dt"; private CloudSolrClient solrClient; private int lastDocId = 0; private int numDocsDeletedOrFailed = 0; @Before public void doBefore() throws Exception { configureCluster(4).configure(); solrClient = getCloudSolrClient(cluster); //log this to help debug potential causes of problems log.info("SolrClient: {}", solrClient); log.info("ClusterStateProvider {}",solrClient.getClusterStateProvider()); } @After public void doAfter() throws Exception { solrClient.close(); shutdownCluster(); } @Slow @Test @LogLevel("org.apache.solr.update.processor.TimeRoutedAlias=DEBUG;org.apache.solr.cloud=DEBUG") // commented out on: 17-Feb-2019 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 14-Oct-2018 public void test() throws Exception { String configName = getSaferTestName(); createConfigSet(configName); // Start with one collection manually created (and use higher numShards & replicas than we'll use for others) // This tests we may pre-create the collection and it's acceptable. final String col23rd = alias + "_2017-10-23"; CollectionAdminRequest.createCollection(col23rd, configName, 2, 2) .setMaxShardsPerNode(2) .withProperty(RoutedAlias.ROUTED_ALIAS_NAME_CORE_PROP, alias) .process(solrClient); cluster.waitForActiveCollection(col23rd, 2, 4); List<String> retrievedConfigSetNames = new ConfigSetAdminRequest.List().process(solrClient).getConfigSets(); List<String> expectedConfigSetNames = Arrays.asList("_default", configName); // config sets leak between tests so we can't be any more specific than this on the next 2 asserts assertTrue("We expect at least 2 configSets", retrievedConfigSetNames.size() >= expectedConfigSetNames.size()); assertTrue("ConfigNames should include :" + expectedConfigSetNames, retrievedConfigSetNames.containsAll(expectedConfigSetNames)); CollectionAdminRequest.createTimeRoutedAlias(alias, "2017-10-23T00:00:00Z", "+1DAY", getTimeField(), CollectionAdminRequest.createCollection("_unused_", configName, 1, 1) .setMaxShardsPerNode(2)) .process(solrClient); // now we index a document assertUpdateResponse(solrClient.add(alias, newDoc(Instant.parse("2017-10-23T00:00:00Z")))); solrClient.commit(alias); //assertDocRoutedToCol(lastDocId, col23rd); assertInvariants(col23rd); // a document that is too old testFailedDocument(Instant.parse("2017-10-01T00:00:00Z"), "couldn't be routed"); // a document which is too far into the future testFailedDocument(Instant.now().plus(30, ChronoUnit.MINUTES), "too far in the future"); // add another collection with the precise name we expect, but don't add to alias explicitly. When we add a document // destined for this collection, Solr will see it already exists and add it to the alias. final String col24th = alias + "_2017-10-24"; CollectionAdminRequest.createCollection(col24th, configName, 1, 1) // more shards and replicas now .withProperty(RoutedAlias.ROUTED_ALIAS_NAME_CORE_PROP, alias) .process(solrClient); // index 3 documents in a random fashion addDocsAndCommit(false, // send these to alias & collections newDoc(Instant.parse("2017-10-23T00:00:00Z")), newDoc(Instant.parse("2017-10-24T01:00:00Z")), newDoc(Instant.parse("2017-10-24T02:00:00Z")) ); assertInvariants(col24th, col23rd); // assert that the IncrementURP has updated all '0' to '1' final SolrDocumentList checkIncResults = solrClient.query(alias, params("q", "NOT " + getIntField() + ":1")).getResults(); assertEquals(checkIncResults.toString(), 0, checkIncResults.getNumFound()); //delete a random document id; ensure we don't find it int idToDelete = 1 + random().nextInt(lastDocId); if (idToDelete == 2 || idToDelete == 3) { // these didn't make it idToDelete = 4; } assertUpdateResponse(solrClient.deleteById(alias, Integer.toString(idToDelete))); assertUpdateResponse(solrClient.commit(alias)); numDocsDeletedOrFailed++; assertInvariants(col24th, col23rd); // delete the Oct23rd (save memory)... // make sure we track that we are effectively deleting docs there numDocsDeletedOrFailed += solrClient.query(col23rd, params("q", "*:*", "rows", "0")).getResults().getNumFound(); // remove from the alias CollectionAdminRequest.createAlias(alias, col24th).process(solrClient); // delete the collection CollectionAdminRequest.deleteCollection(col23rd).process(solrClient); // now we're going to add documents that will trigger more collections to be created // for 25th & 26th addDocsAndCommit(false, // send these to alias & collections newDoc(Instant.parse("2017-10-24T03:00:00Z")), newDoc(Instant.parse("2017-10-25T04:00:00Z")), newDoc(Instant.parse("2017-10-26T05:00:00Z")), newDoc(Instant.parse("2017-10-26T06:00:00Z")) ); assertInvariants(alias + "_2017-10-26", alias + "_2017-10-25", col24th); // update metadata to auto-delete oldest collections CollectionAdminRequest.setAliasProperty(alias) .addProperty(TimeRoutedAlias.ROUTER_AUTO_DELETE_AGE, "-1DAY") // thus usually keep 2 collections of a day size .process(solrClient); // add more docs, creating one new collection, but trigger ones prior to int numDocsToBeAutoDeleted = queryNumDocs(getTimeField() +":[* TO \"2017-10-26T00:00:00Z\"}"); addDocsAndCommit(true, // send these to alias only newDoc(Instant.parse("2017-10-26T07:00:00Z")), // existing newDoc(Instant.parse("2017-10-27T08:00:00Z")) // new ); numDocsDeletedOrFailed += numDocsToBeAutoDeleted; assertInvariants(alias + "_2017-10-27", alias + "_2017-10-26"); } /** * Test that the Update Processor Factory routes documents to leader shards and thus * avoids the possibility of introducing an extra hop to find the leader. * * @throws Exception when it blows up unexpectedly :) */ @Slow @Test @LogLevel("org.apache.solr.update.processor.TrackingUpdateProcessorFactory=DEBUG") public void testSliceRouting() throws Exception { String configName = getSaferTestName(); createConfigSet(configName); // each collection has 4 shards with 3 replicas for 12 possible destinations // 4 of which are leaders, and 8 of which should fail this test. final int numShards = 1 + random().nextInt(4); final int numReplicas = 1 + random().nextInt(3); CollectionAdminRequest.createTimeRoutedAlias(alias, "2017-10-23T00:00:00Z", "+1DAY", getTimeField(), CollectionAdminRequest.createCollection("_unused_", configName, numShards, numReplicas) .setMaxShardsPerNode(numReplicas)) .process(solrClient); // cause some collections to be created assertUpdateResponse(solrClient.add(alias, new SolrInputDocument("id","1","timestamp_dt", "2017-10-25T00:00:00Z"))); assertUpdateResponse(solrClient.commit(alias)); // wait for all the collections to exist... waitColAndAlias(alias, "_", "2017-10-23", numShards); waitColAndAlias(alias, "_", "2017-10-24", numShards); waitColAndAlias(alias, "_", "2017-10-25", numShards); // at this point we now have 3 collections with 4 shards each, and 3 replicas per shard for a total of // 36 total replicas, 1/3 of which are leaders. We will add 3 docs and each has a 33% chance of hitting a // leader randomly and not causing a failure if the code is broken, but as a whole this test will therefore only have // about a 3.6% false positive rate (0.33^3). If that's not good enough, add more docs or more replicas per shard :). final String trackGroupName = getTrackUpdatesGroupName(); final List<UpdateCommand> updateCommands; try { TrackingUpdateProcessorFactory.startRecording(trackGroupName); // cause some collections to be created ModifiableSolrParams params = params("post-processor", "tracking-" + trackGroupName); assertUpdateResponse(add(alias, Arrays.asList( sdoc("id", "2", "timestamp_dt", "2017-10-24T00:00:00Z"), sdoc("id", "3", "timestamp_dt", "2017-10-25T00:00:00Z"), sdoc("id", "4", "timestamp_dt", "2017-10-23T00:00:00Z")), params)); } finally { updateCommands = TrackingUpdateProcessorFactory.stopRecording(trackGroupName); } assertRouting(numShards, updateCommands); } @Test @Slow public void testPreemptiveCreation() throws Exception { String configName = getSaferTestName(); createConfigSet(configName); final int numShards = 1 ; final int numReplicas = 1 ; CollectionAdminRequest.createTimeRoutedAlias(alias, "2017-10-23T00:00:00Z", "+1DAY", getTimeField(), CollectionAdminRequest.createCollection("_unused_", configName, numShards, numReplicas) .setMaxShardsPerNode(numReplicas)).setPreemptiveCreateWindow("3HOUR") .process(solrClient); // needed to verify that preemptive creation in one alias doesn't inhibit preemptive creation in another CollectionAdminRequest.createTimeRoutedAlias(alias2, "2017-10-23T00:00:00Z", "+1DAY", getTimeField(), CollectionAdminRequest.createCollection("_unused_", configName, numShards, numReplicas) .setMaxShardsPerNode(numReplicas)).setPreemptiveCreateWindow("3HOUR") .process(solrClient); addOneDocSynchCreation(numShards, alias); addOneDocSynchCreation(numShards, alias2); List<String> cols; ModifiableSolrParams params = params(); // Using threads to ensure that two TRA's are simultaneously preemptively creating and don't // interfere with each other ExecutorService executorService = ExecutorUtil.newMDCAwareCachedThreadPool("TimeRoutedAliasProcessorTestx-testPreemptiveCreation"); Exception[] threadExceptions = new Exception[2]; boolean[] threadStarted = new boolean[2]; boolean[] threadFinished = new boolean[2]; try { CountDownLatch starter = new CountDownLatch(1); executorService.submit(() -> { threadStarted[0] = true; try { starter.await(); concurrentUpdates(params, alias); } catch (Exception e) { threadExceptions[0] = e; } threadFinished[0] = true; }); executorService.submit(() -> { threadStarted[1] = true; try { starter.await(); concurrentUpdates(params, alias2); } catch (Exception e) { threadExceptions[1] = e; } threadFinished[1] = true; }); starter.countDown(); } finally { ExecutorUtil.shutdownAndAwaitTermination(executorService); } // threads are known to be terminated by now, check for exceptions for (Exception threadException : threadExceptions) { if (threadException != null) { Thread.sleep(5000); // avoid spurious fails due to TRA thread not done yet //noinspection ThrowFromFinallyBlock throw threadException; } } // just for confidence that there's nothing dodgy about how the threads executed. assertTrue(threadStarted[0]); assertTrue(threadStarted[1]); assertTrue(threadFinished[0]); assertTrue(threadFinished[1]); // if one of these times out then the test has failed due to interference between aliases waitColAndAlias(alias, "_", "2017-10-26", numShards); waitColAndAlias(alias2, "_", "2017-10-26", numShards); // after this we can ignore alias2 checkPreemptiveCase1(alias); checkPreemptiveCase1(alias2); // Some designs contemplated with close hooks were not properly restricted to the core and would have // failed after other cores with other TRAs were stopped. Make sure that we don't fall into that trap in // the future. The basic problem with a close hook solution is that one either winds up putting the // executor on the TRAUP where it's duplicated/initiated for every request, or putting it at the class level // in which case the hook will remove it for all TRA's which can pass a single TRA test nicely but is not safe // where multiple TRA's might come and go. // // Start and stop some cores that have TRA's... 2x2 used to ensure every jetty gets at least one CollectionAdminRequest.createTimeRoutedAlias("foo", "2017-10-23T00:00:00Z", "+1DAY", getTimeField(), CollectionAdminRequest.createCollection("_unused_", configName, 2, 2) .setMaxShardsPerNode(numReplicas)).setPreemptiveCreateWindow("3HOUR") .process(solrClient); waitColAndAlias("foo", "_", "2017-10-23",2); waitCoreCount("foo_2017-10-23", 1); // prove this works, for confidence in deletion checking below. assertUpdateResponse(solrClient.add("foo", sdoc("id","1","timestamp_dt", "2017-10-23T00:00:00Z") // no extra collections should be created )); assertUpdateResponse(solrClient.commit("foo")); List<String> foo = solrClient.getClusterStateProvider().resolveAlias("foo"); CollectionAdminRequest.deleteAlias("foo").process(solrClient); for (String colName : foo) { CollectionAdminRequest.deleteCollection(colName).process(solrClient); waitCoreCount(colName, 0); } // if the design for terminating our executor is correct create/delete above will not cause failures below // continue testing... // now test with pre-create window longer than time slice, and forcing multiple creations. CollectionAdminRequest.setAliasProperty(alias) .addProperty(TimeRoutedAlias.ROUTER_PREEMPTIVE_CREATE_MATH, "3DAY").process(solrClient); assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "7", "timestamp_dt", "2017-10-25T23:01:00Z")), // should cause preemptive creation of 10-27 now params)); assertUpdateResponse(solrClient.commit(alias)); waitColAndAlias(alias, "_", "2017-10-27", numShards); cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assertEquals(5,cols.size()); // only one created in async case assertNumDocs("2017-10-23", 1, alias); assertNumDocs("2017-10-24", 1, alias); assertNumDocs("2017-10-25", 5, alias); assertNumDocs("2017-10-26", 0, alias); assertNumDocs("2017-10-27", 0, alias); assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "8", "timestamp_dt", "2017-10-25T23:01:00Z")), // should cause preemptive creation of 10-28 now params)); assertUpdateResponse(solrClient.commit(alias)); waitColAndAlias(alias, "_", "2017-10-27", numShards); waitColAndAlias(alias, "_", "2017-10-28", numShards); cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assertEquals(6,cols.size()); // Subsequent documents continue to create up to limit assertNumDocs("2017-10-23", 1, alias); assertNumDocs("2017-10-24", 1, alias); assertNumDocs("2017-10-25", 6, alias); assertNumDocs("2017-10-26", 0, alias); assertNumDocs("2017-10-27", 0, alias); assertNumDocs("2017-10-28", 0, alias); QueryResponse resp; resp = solrClient.query(alias, params( "q", "*:*", "rows", "10")); assertEquals(8, resp.getResults().getNumFound()); assertUpdateResponse(add(alias, Arrays.asList( sdoc("id", "9", "timestamp_dt", "2017-10-27T23:01:00Z"), // should cause preemptive creation // If these are not ignored properly this test will fail during cleanup with a message about router.name being // required. This happens because the test finishes while overseer threads are still trying to invoke maintain // after the @After method has deleted collections and emptied out the aliases.... this leaves the maintain // command cloning alias properties Aliases.EMPTY and thus not getting a value from router.name // (normally router.name == 'time') The check for non-blank router.name happens to be the first validation. // There is a small chance this could slip through without a fail occasionally, but it was 100% with just one // of these. sdoc("id", "10", "timestamp_dt", "2017-10-28T23:01:00Z"), // should be ignored due to in progress creation sdoc("id", "11", "timestamp_dt", "2017-10-28T23:02:00Z"), // should be ignored due to in progress creation sdoc("id", "12", "timestamp_dt", "2017-10-28T23:03:00Z")), // should be ignored due to in progress creation params)); assertUpdateResponse(solrClient.commit(alias)); waitColAndAlias(alias, "_", "2017-10-29", numShards); cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assertEquals(7,cols.size()); assertNumDocs("2017-10-23", 1, alias); assertNumDocs("2017-10-24", 1, alias); assertNumDocs("2017-10-25", 6, alias); assertNumDocs("2017-10-26", 0, alias); assertNumDocs("2017-10-27", 1, alias); assertNumDocs("2017-10-28", 3, alias); // should get through even though preemptive creation ignored it. assertNumDocs("2017-10-29", 0, alias); resp = solrClient.query(alias, params( "q", "*:*", "rows", "0")); assertEquals(12, resp.getResults().getNumFound()); // Sych creation with an interval longer than the time slice for the alias.. assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "13", "timestamp_dt", "2017-10-30T23:03:00Z")), // lucky? params)); assertUpdateResponse(solrClient.commit(alias)); waitColAndAlias(alias, "_", "2017-10-30", numShards); waitColAndAlias(alias, "_", "2017-10-31", numShards); // spooky! async case arising in middle of sync creation!! cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assertEquals(9,cols.size()); assertNumDocs("2017-10-23", 1, alias); assertNumDocs("2017-10-24", 1, alias); assertNumDocs("2017-10-25", 6, alias); assertNumDocs("2017-10-26", 0, alias); assertNumDocs("2017-10-27", 1, alias); assertNumDocs("2017-10-28", 3, alias); // should get through even though preemptive creation ignored it. assertNumDocs("2017-10-29", 0, alias); assertNumDocs("2017-10-30", 1, alias); assertNumDocs("2017-10-31", 0, alias); resp = solrClient.query(alias, params( "q", "*:*", "rows", "0")); assertEquals(13, resp.getResults().getNumFound()); assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "14", "timestamp_dt", "2017-10-31T23:01:00Z")), // should cause preemptive creation 11-01 params)); waitColAndAlias(alias, "_", "2017-11-01", numShards); assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "15", "timestamp_dt", "2017-10-31T23:01:00Z")), // should cause preemptive creation 11-02 params)); waitColAndAlias(alias, "_", "2017-11-02", numShards); assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "16", "timestamp_dt", "2017-10-31T23:01:00Z")), // should cause preemptive creation 11-03 params)); waitColAndAlias(alias, "_", "2017-11-03", numShards); assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "17", "timestamp_dt", "2017-10-31T23:01:00Z")), // should NOT cause preemptive creation 11-04 params)); cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assertTrue("Preemptive creation beyond ROUTER_PREEMPTIVE_CREATE_MATH setting of 3DAY!",!cols.contains("myalias_2017-11-04")); assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "18", "timestamp_dt", "2017-11-01T23:01:00Z")), // should cause preemptive creation 11-04 params)); waitColAndAlias(alias, "_", "2017-11-04",numShards); } // used to verify a core has been deleted (count = 0) private void waitCoreCount(String collection, int count) { long start = System.nanoTime(); CoreContainer coreContainer = cluster.getRandomJetty(random()).getCoreContainer(); int coreFooCount; do { coreFooCount = 0; List<CoreDescriptor> coreDescriptors = coreContainer.getCoreDescriptors(); for (CoreDescriptor coreDescriptor : coreDescriptors) { String collectionName = coreDescriptor.getCollectionName(); if (collection.equals(collectionName)) { coreFooCount ++; } } if (NANOSECONDS.toSeconds(System.nanoTime() - start) > 10) { fail("took over 10 seconds after collection creation to update aliases"); } else { try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); fail(e.getMessage()); } } } while(coreFooCount != count); } private void concurrentUpdates(ModifiableSolrParams params, String alias) throws SolrServerException, IOException { // In this method we intentionally rely on timing of a race condition but the gap in collection creation time vs // requesting the list of aliases and adding a single doc should be very large (1-2 seconds vs a few ms so we // should always win the race) This is necessary because we are testing that we can guard against specific race // conditions that happen while a collection is being created. To test this without timing sensitivity we would // need a means to pass a semaphore to the server that it can use to delay collection creation // // This method must NOT gain any Thread.sleep() statements, nor should it gain any long running operations assertUpdateResponse(add(alias, Arrays.asList( sdoc("id", "2", "timestamp_dt", "2017-10-24T00:00:00Z"), sdoc("id", "3", "timestamp_dt", "2017-10-25T00:00:00Z"), sdoc("id", "4", "timestamp_dt", "2017-10-23T00:00:00Z"), sdoc("id", "5", "timestamp_dt", "2017-10-25T23:00:00Z")), // should cause preemptive creation params)); assertUpdateResponse(solrClient.commit(alias)); List<String> colsT1; colsT1 = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assertEquals(3, colsT1.size()); assertTrue("Preemptive creation appears to not be asynchronous anymore", !colsT1.contains("myalias_2017-10-26")); assertNumDocs("2017-10-23", 1, alias); assertNumDocs("2017-10-24", 1, alias); assertNumDocs("2017-10-25", 3, alias); // Here we quickly add another doc in a separate request, before the collection creation has completed. // This has the potential to incorrectly cause preemptive collection creation to run twice and create a // second collection. RoutedAliasUpdateProcessor is meant to guard against this race condition. assertUpdateResponse(add(alias, Collections.singletonList( sdoc("id", "6", "timestamp_dt", "2017-10-25T23:01:00Z")), // might cause duplicate preemptive creation params)); assertUpdateResponse(solrClient.commit(alias)); } private void checkPreemptiveCase1(String alias) throws SolrServerException, IOException { List<String> cols; cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assertTrue("Preemptive creation happened twice and created a collection " + "further in the future than the configured time slice!",!cols.contains("myalias_2017-10-27")); assertEquals(4, cols.size()); assertNumDocs("2017-10-23", 1, alias); assertNumDocs("2017-10-24", 1, alias); assertNumDocs("2017-10-25", 4, alias); assertNumDocs("2017-10-26", 0, alias); } @SuppressWarnings("SameParameterValue") private void addOneDocSynchCreation(int numShards, String alias) throws SolrServerException, IOException, InterruptedException { // cause some collections to be created assertUpdateResponse(solrClient.add(alias, sdoc("id","1","timestamp_dt", "2017-10-25T00:00:00Z") )); assertUpdateResponse(solrClient.commit(alias)); // wait for all the collections to exist... waitColAndAlias(alias, "_", "2017-10-23", numShards); // This one should have already existed from the alias creation waitColAndAlias(alias, "_", "2017-10-24", numShards); // Create 1 waitColAndAlias(alias, "_", "2017-10-25", numShards); // Create 2nd synchronously (ensure this is not broken) // normal update, nothing special, no collection creation required. List<String> cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assertEquals(3,cols.size()); assertNumDocs("2017-10-23", 0, alias); assertNumDocs("2017-10-24", 0, alias); assertNumDocs("2017-10-25", 1, alias); } private void assertNumDocs(final String datePart, int expected, String alias) throws SolrServerException, IOException { QueryResponse resp = solrClient.query(alias + "_" + datePart, params( "q", "*:*", "rows", "10")); assertEquals(expected, resp.getResults().getNumFound()); } private void testFailedDocument(Instant timestamp, String errorMsg) throws SolrServerException, IOException { try { final UpdateResponse resp = solrClient.add(alias, newDoc(timestamp)); // if we have a TolerantUpdateProcessor then we see it there) final Object errors = resp.getResponseHeader().get("errors"); // Tolerant URP assertTrue(errors != null && errors.toString().contains(errorMsg)); } catch (SolrException e) { assertTrue(e.getMessage().contains(errorMsg)); } numDocsDeletedOrFailed++; } @Override public String getAlias() { return alias; } @Override public CloudSolrClient getSolrClient() { return solrClient; } private int queryNumDocs(String q) throws SolrServerException, IOException { return (int) solrClient.query(alias, params("q", q, "rows", "0")).getResults().getNumFound(); } private void assertInvariants(String... expectedColls) throws IOException, SolrServerException { final int expectNumFound = lastDocId - numDocsDeletedOrFailed; //lastDocId is effectively # generated docs final List<String> cols = new CollectionAdminRequest.ListAliases().process(solrClient).getAliasesAsLists().get(alias); assert !cols.isEmpty(); assertArrayEquals("expected reverse sorted", cols.stream().sorted(Collections.reverseOrder()).toArray(), cols.toArray()); int totalNumFound = 0; Instant colEndInstant = null; // exclusive end for (String col : cols) { // ASSUMPTION: reverse sorted order final Instant colStartInstant = TimeRoutedAlias.parseInstantFromCollectionName(alias, col); final QueryResponse colStatsResp = solrClient.query(col, params( "q", "*:*", "rows", "0", "stats", "true", "stats.field", getTimeField())); long numFound = colStatsResp.getResults().getNumFound(); if (numFound > 0) { totalNumFound += numFound; final FieldStatsInfo timestampStats = colStatsResp.getFieldStatsInfo().get(getTimeField()); assertTrue(colStartInstant.toEpochMilli() <= ((Date)timestampStats.getMin()).getTime()); if (colEndInstant != null) { assertTrue(colEndInstant.toEpochMilli() > ((Date)timestampStats.getMax()).getTime()); } } colEndInstant = colStartInstant; // next older segment will max out at our current start time } assertEquals(expectNumFound, totalNumFound); assertArrayEquals(expectedColls, cols.toArray()); } private SolrInputDocument newDoc(Instant timestamp) { return sdoc("id", Integer.toString(++lastDocId), getTimeField(), timestamp.toString(), getIntField(), "0"); // always 0 } private String getTimeField() { return timeField; } @Test public void testParse() { assertEquals(Instant.parse("2017-10-02T03:04:05Z"), TimeRoutedAlias.parseInstantFromCollectionName(alias, alias + "_2017-10-02_03_04_05")); assertEquals(Instant.parse("2017-10-02T03:04:00Z"), TimeRoutedAlias.parseInstantFromCollectionName(alias, alias + "_2017-10-02_03_04")); assertEquals(Instant.parse("2017-10-02T03:00:00Z"), TimeRoutedAlias.parseInstantFromCollectionName(alias, alias + "_2017-10-02_03")); assertEquals(Instant.parse("2017-10-02T00:00:00Z"), TimeRoutedAlias.parseInstantFromCollectionName(alias, alias + "_2017-10-02")); } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
987b2fbf0937ba4039e0b8287f01c222014a5f08
2527a1e4b30bee9caf7fc392d1015173706c1be1
/app/src/main/java/com/yunwei/frame/vendor/baiduTrack/BaiduTrackListener.java
67f2ad6fdb2e721bdd35d67000fb389b95092fe0
[ "Apache-2.0" ]
permissive
yibulaxi/BaseProject-1
72dc0cea30b51930994aea30e4341fa9de507fc2
58b3e866fdb8e7173063b8e0f7e494e00e211aca
refs/heads/master
2021-06-09T17:39:12.346946
2017-01-13T04:48:46
2017-01-13T04:48:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.yunwei.frame.vendor.baiduTrack; /** * @author hezhiWu * @version V1.0 * @Package com.yunwei.baidu * @Description:历史记录查询回调接口 * @date 2016/9/23 10:32 */ public interface BaiduTrackListener { void onQueryHistoryTrackSuccess(HistoryTrackData entity); void onQueryHistoryTrackFailure(String str); void onQueryDistanceCallback(String str); }
[ "wuhezhi@wayto.com.cn" ]
wuhezhi@wayto.com.cn
6f68f1473692b92cfacba6f1491800ac0d574f0a
031aaa6b974e5df5e0f7c75fd89efecce761fca8
/backend/src/main/java/org/idomine/domain/venda/model/Venda.java
e71d63fb62f14491706ea06336b10fdc9117a83e
[ "MIT" ]
permissive
nadeda/sisadmin-bi
2fbc1cfbaf0a2a3db9ff396f474bbfb8809085d9
415216327db4cd23ded0480d62a242509b18f780
refs/heads/master
2023-06-14T20:30:38.661796
2018-07-17T18:04:48
2018-07-17T18:04:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,205
java
package org.idomine.domain.venda.model; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.NotEmpty; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @Entity public class Venda { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private LocalDateTime cadastro; @ManyToOne private Cliente cliente; @JsonIgnoreProperties("venda") @Valid @NotEmpty @OneToMany(mappedBy = "venda", cascade = CascadeType.ALL, orphanRemoval = true) private List<Item> itens; @NotNull private BigDecimal frete; private BigDecimal total; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public LocalDateTime getCadastro() { return cadastro; } public void setCadastro(LocalDateTime cadastro) { this.cadastro = cadastro; } public Cliente getCliente() { return cliente; } public void setCliente(Cliente cliente) { this.cliente = cliente; } public List<Item> getItens() { return itens; } public void setItens(List<Item> itens) { this.itens = itens; } public BigDecimal getFrete() { return frete; } public void setFrete(BigDecimal frete) { this.frete = frete; } public BigDecimal getTotal() { return total; } public void setTotal(BigDecimal total) { this.total = total; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Venda other = (Venda) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
[ "integraldominio@gmail.com" ]
integraldominio@gmail.com
9a37c7f935d35bab544dbe8410fb590f550615bc
038183d508255cc492da7248876ac3a310ad29d1
/src/com/interstellarexploration/remoteobs/asputil/planexec/AcpControl.java
974aceff983e2cf6c6317a76037a29012500b160
[]
no_license
278261631/AcpPlanGenerator
7a336db4cdfb169e4d86b7265b8abe313f927811
65445497011b5221ba7211fd971f8a1e4dbfa8f1
refs/heads/master
2020-04-06T03:51:52.293609
2017-03-26T17:15:28
2017-03-26T17:15:28
83,146,182
0
0
null
null
null
null
UTF-8
Java
false
false
5,236
java
package com.interstellarexploration.remoteobs.asputil.planexec; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.URL; import java.net.URLConnection; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.apache.commons.codec.binary.Base64; public class AcpControl { public static String runPlan(String filePath,String url,String userName,String userPass) { PrintWriter out = null; BufferedReader in = null; String result = ""; try { System.out.println( getNowTimeString()+ "准备启动 "); // URL realUrl = new URL("http://192.168.1.130:81/ac/aacqplan.asp"); URL realUrl = new URL(url+"/ac/aacqplan.asp"); // 打开和URL之间的连接 URLConnection conn = realUrl.openConnection(); // 设置通用的请求属性 conn.setRequestProperty("accept", "*/*"); conn.setRequestProperty("connection", "Keep-Alive"); String input = userName + ":" + userPass; Base64 base64 = new Base64(); String encoding = base64.encodeToString(input.getBytes()); conn.setRequestProperty("Authorization", "Basic " + encoding); conn.setRequestProperty("connection", "Keep-Alive"); // conn.setRequestProperty("user-agent", // "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); // 发送POST请求必须设置如下两行 conn.setDoOutput(true); conn.setDoInput(true); // 获取URLConnection对象对应的输出流 out = new PrintWriter(conn.getOutputStream()); // 发送请求参数 // out.print("plan=C:\\Users\\Public\\Documents\\ACP Web Data\\Doc Root\\plans\\mayong\\test2.txt"); // out.print("plan=C:/Users/Public/Documents/ACP Web Data/Doc Root/plans/mayong/test2.txt"); out.print("plan="+filePath); // flush输出流的缓冲 out.flush(); // 定义BufferedReader输入流来读取URL的响应 in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String line; while ((line = in.readLine()) != null) { result += line; } } catch (Exception e) { System.out.println("发送 POST 请求出现异常!"+e); e.printStackTrace(); } //使用finally块来关闭输出流、输入流 finally{ try{ if(out!=null){ out.close(); } if(in!=null){ in.close(); } } catch(IOException ex){ ex.printStackTrace(); } } return result; } static SimpleDateFormat longDateFormatFile = new SimpleDateFormat("yyyy-MM-dd HH mm ss "); public static String getNowTimeString (){ return longDateFormatFile.format(new Date()) +" :\t\t"; } public static String stopRunPlan(String url,String userName,String userPass) { PrintWriter out = null; BufferedReader in = null; String result = ""; try { System.out.println( getNowTimeString()+ "尝试停止 "); // http://192.168.1.130:81/ac/astopscript.asp // URL realUrl = new URL("http://192.168.1.130:81/ac/astopscript.asp"); URL realUrl = new URL(url+"/ac/astopscript.asp"); // 打开和URL之间的连接 URLConnection conn = realUrl.openConnection(); // 设置通用的请求属性 conn.setRequestProperty("accept", "*/*"); conn.setRequestProperty("connection", "Keep-Alive"); // String input = "mayong" + ":" + "mayong"; String input = userName + ":" + userPass; Base64 base64 = new Base64(); String encoding = base64.encodeToString(input.getBytes()); conn.setRequestProperty("Authorization", "Basic " + encoding); conn.setRequestProperty("connection", "Keep-Alive"); // conn.setRequestProperty("user-agent", // "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); // 发送POST请求必须设置如下两行 conn.setDoOutput(true); conn.setDoInput(true); // 获取URLConnection对象对应的输出流 out = new PrintWriter(conn.getOutputStream()); // 发送请求参数 out.print("Command=StopScript"); // flush输出流的缓冲 out.flush(); // 定义BufferedReader输入流来读取URL的响应 in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String line; while ((line = in.readLine()) != null) { result += line; } } catch (Exception e) { System.out.println("发送 POST 请求出现异常!"+e); e.printStackTrace(); } //使用finally块来关闭输出流、输入流 finally{ try{ if(out!=null){ out.close(); } if(in!=null){ in.close(); } } catch(IOException ex){ ex.printStackTrace(); } } return result; } }
[ "mars.maya.g@gmail.com" ]
mars.maya.g@gmail.com
4dec732d3af16d2c19a848907a2d28b5710bd200
b6f6f5a55d2ab32805c46a001f8e1fbffab9c202
/src/main/java/mef/faulttree/Role.java
3bff87fd6a6bb4bc9418c7278b5ac551a2f3b2d6
[]
no_license
amjadKhalifah/ATCM
6e4a240aae9d5ef23e178f41dfb863cad9807bc2
08ffba62faed73068da8985c2bb0665e1d1f0395
refs/heads/develop
2021-06-21T08:02:53.638087
2021-02-02T09:06:10
2021-02-02T09:06:10
182,811,051
0
0
null
2021-02-02T09:06:10
2019-04-22T15:02:40
Java
UTF-8
Java
false
false
65
java
package mef.faulttree; public enum Role { PRIVATE, PUBLIC }
[ "simon.rehwald@tum.de" ]
simon.rehwald@tum.de
1fcda19d54dd623a11b64ab62a41f98d22329218
8898b20a6b1d034ef9226f47633cd99599b7e2a9
/swipeback/src/main/java/com/example/storm/swipeback/MainActivity.java
e36061ce53d4b21a717bb8374c5964b26df92522
[]
no_license
derevinskiy1/AndroidBasic
d3cb602683678a3893904b30acf5b88d737a19ad
0847e67d341482680732f3c48d74638b28a86341
refs/heads/master
2021-06-13T08:57:06.175353
2017-02-21T13:05:40
2017-02-21T13:05:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.example.storm.swipeback; import android.content.Intent; import android.os.Bundle; import android.view.View; public class MainActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected boolean isSupportSwipeBack() { return false; } public void nextPage(View v){ startActivity(new Intent(this,NextActivity.class)); } }
[ "zhiwenyan@Zhiwen-Yan-MacBook-Pro-2.local" ]
zhiwenyan@Zhiwen-Yan-MacBook-Pro-2.local
54b5a42c64e572440fd073373ff6ac9055a166af
7ede02ab2c7fab4ecb96791ee1764e0009db54b8
/src/main/java/com/revolut/Application.java
66b43f6f25dfce5d777d247713b8803862d9c1b2
[]
no_license
SergiyMishkovets/RevolutTest
945201bd4ab466964bcc71218d1c33f0de4487e3
c4d22967ae80f29d0649db07351b85f04ed9d117
refs/heads/master
2020-04-11T09:21:53.824757
2018-12-13T18:43:45
2018-12-13T18:43:45
161,675,136
0
0
null
null
null
null
UTF-8
Java
false
false
1,689
java
package com.revolut; import java.math.BigDecimal; import com.revolut.controller.PaymentController; import com.revolut.dao.PaymentDao; import com.revolut.entity.AccountEntity; import com.revolut.exception.AccountNotFoundException; import com.revolut.exception.InsufficientFundsException; import com.revolut.exception.MismatchedCurrencyException; import io.javalin.Javalin; import static com.revolut.entity.Currency.EUR; import static com.revolut.entity.Currency.USD; public class Application { private static final int WEB_PORT = 8080; private static final PaymentDao paymentDao = new PaymentDao(); public static void main(String... args) { initDb(); Javalin app = Javalin.create().start(WEB_PORT); app.post("/make-transfer", PaymentController.makeTransfer); app.get("/account/:id", PaymentController.getAccountDetails); app.exception(InsufficientFundsException.class, PaymentController.handleInsufficientFundsException); app.exception(AccountNotFoundException.class, PaymentController.handleAccountNotFoundException); app.exception(MismatchedCurrencyException.class, PaymentController.handleMismatchedCurrencyException); app.exception(Exception.class, PaymentController.handleException); } private static void initDb() { paymentDao.saveAccounts(new AccountEntity("11U", BigDecimal.valueOf(100), USD)); paymentDao.saveAccounts(new AccountEntity("22U", BigDecimal.valueOf(150), USD)); paymentDao.saveAccounts(new AccountEntity("11E", BigDecimal.valueOf(300), EUR)); paymentDao.saveAccounts(new AccountEntity("22E", BigDecimal.valueOf(200), EUR)); } }
[ "bonavik@gmail.com" ]
bonavik@gmail.com
3ebad28fa9a6bbea095aec59e37e6870c4ec1df4
642dcf23a9a524c984e77784bb168463f6aaf633
/webapi-spring/src/main/java/com/monitorz/webapi/data/City.java
0a9f7f62ad4dc991b1023eb5ca945a9434c4be62
[]
no_license
malengatiger/new-monitor-repo
8075b950b752c6c4a255b9009fd2a3f2ac4607c5
f709416132bc545ab9817fed2e0af39bf4afc448
refs/heads/master
2022-07-13T06:05:01.863463
2021-12-08T21:47:38
2021-12-08T21:47:38
195,287,781
3
0
null
2022-06-27T17:28:12
2019-07-04T18:41:49
Dart
UTF-8
Java
false
false
1,639
java
package com.monitorz.webapi.data; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.index.Indexed; import org.springframework.data.mongodb.core.mapping.Document; import lombok.Data; @Data @Document(collection = "cities") public class City { @Id private String id; private String cityId; String name, countryId, countryName, provinceName, created; Position position; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getCityId() { return cityId; } public void setCityId(String cityId) { this.cityId = cityId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCountryId() { return countryId; } public void setCountryId(String countryId) { this.countryId = countryId; } public String getCountryName() { return countryName; } public void setCountryName(String countryName) { this.countryName = countryName; } public String getProvinceName() { return provinceName; } public void setProvinceName(String provinceName) { this.provinceName = provinceName; } public String getCreated() { return created; } public void setCreated(String created) { this.created = created; } public Position getPosition() { return position; } public void setPosition(Position position) { this.position = position; } }
[ "malengatiger@gmail.com" ]
malengatiger@gmail.com
dadb90046b808c720cee0a3bd993cb4d9e711a9c
447e99dfb4c8d3c379dd077e7939be88eacc3585
/hbase-secondIndex/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScanner.java
cda54d6ea09d4952dbfa6f926de02da76589f025
[]
no_license
kixiong/hbase-0.94-SecondIndex
ff057f23d823080e5ce8241534f5db7345ad86c2
67aca4847d37c2236d825d5887b899e48f64eeb2
refs/heads/master
2021-01-25T07:55:36.983723
2017-01-14T15:35:53
2017-01-14T15:35:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,834
java
/** * Copyright 2011 The Apache Software Foundation * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hbase.regionserver; import java.io.IOException; import org.apache.hadoop.hbase.HRegionInfo; /** * RegionScanner describes iterators over rows in an HRegion. */ public interface RegionScanner extends InternalScanner { /** * @return The RegionInfo for this scanner. */ public HRegionInfo getRegionInfo(); /** * @return True if a filter indicates that this scanner will return no * further rows. */ public boolean isFilterDone(); /** * @return The Scanner's MVCC readPt see {@link MultiVersionConsistencyControl} */ public long getMvccReadPoint(); /** * Do a reseek to the required row. Should not be used to seek to a key which * may come before the current position. Always seeks to the beginning of a * row boundary. * * @throws IOException * @throws IllegalArgumentException * if row is null * */ public boolean reseek(byte[] row) throws IOException; }
[ "pengrongxin@odianyun.com" ]
pengrongxin@odianyun.com
28348df7abbeb5779d4d12719a8ee99217b18b1c
ba5874c92dd537ef2974a07e0d8771929860587f
/code-samples/common/src/main/java/utils/IOUtils.java
74458983afa6cbb13f541f10c4e3a951bdfc1010
[]
no_license
fatihalgan/Infinispan
927b517ede7e6826dcf7b7c90518e5b326fa0b3c
8ced205b02d7123ce54a592ed8108e6f4ac0fb4a
refs/heads/master
2021-01-16T23:19:32.815332
2016-06-01T19:57:51
2016-06-01T19:57:51
60,206,149
0
0
null
null
null
null
UTF-8
Java
false
false
696
java
package utils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class IOUtils { public static String readLine(String s) { System.out.print(s); String returnval = null; try { BufferedReader bufRead = new BufferedReader(new InputStreamReader(System.in)); returnval = bufRead.readLine(); } catch (IOException e) { throw new RuntimeException(e); } return returnval; } public static void dumpWelcomeMessage() { System.out.println("Ticket booking system"); System.out.println("====================="); System.out.println("Commands: book, pay, list"); } }
[ "fatih.algan@gmail.com" ]
fatih.algan@gmail.com
7497a359e176007c249fa6f06249f8a806996531
b3221f10465b97c7547ffce4bbaa8f4f9bb79062
/src/main/java/com/epam/task3/controller/NewsCategory.java
0ed7b7dd1da627c4da97e5ff1171fc72313b5feb
[]
no_license
Nick13Zen/TATJAVA01_2017_Task03_Nikita_Zenchyk
9200b28f9e253d6bc2cdb3f83a0d1446106ab1a1
a28dcf9bfd91f6b008fe3af3cdd072d8e10dd189
refs/heads/master
2021-01-09T06:17:08.071146
2017-02-17T08:21:14
2017-02-17T08:21:14
81,004,675
0
0
null
null
null
null
UTF-8
Java
false
false
107
java
package com.epam.task3.controller; /** * */ public enum NewsCategory { MOVIE, MUSIC, BOOK }
[ "Nick@Nicks-Mac.local" ]
Nick@Nicks-Mac.local
f80ce40d991c76ef95175c5d4d62ec2326474217
f037e32020feeeb07c1fc2f314d6a1aac3efdd63
/src/fr/uge/webservices/AppServiceLocator.java
df3781bd97ccf028ce368d712c03e18d89d1de0a
[]
no_license
BackEndUGEcars/UGERentService
31295d19b10dee5a0d794508b6c936913252932d
7679754d9f41bedd48925dbcbe9ec98480968fbd
refs/heads/main
2023-01-15T12:19:45.744912
2020-11-29T20:24:58
2020-11-29T20:24:58
317,036,794
0
0
null
null
null
null
UTF-8
Java
false
false
4,923
java
/** * AppServiceLocator.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package fr.uge.webservices; public class AppServiceLocator extends org.apache.axis.client.Service implements fr.uge.webservices.AppService { public AppServiceLocator() { } public AppServiceLocator(org.apache.axis.EngineConfiguration config) { super(config); } public AppServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException { super(wsdlLoc, sName); } // Use to get a proxy class for App private java.lang.String App_address = "http://localhost:8080/IfsCar/services/App"; public java.lang.String getAppAddress() { return App_address; } // The WSDD service name defaults to the port name. private java.lang.String AppWSDDServiceName = "App"; public java.lang.String getAppWSDDServiceName() { return AppWSDDServiceName; } public void setAppWSDDServiceName(java.lang.String name) { AppWSDDServiceName = name; } public fr.uge.webservices.App getApp() throws javax.xml.rpc.ServiceException { java.net.URL endpoint; try { endpoint = new java.net.URL(App_address); } catch (java.net.MalformedURLException e) { throw new javax.xml.rpc.ServiceException(e); } return getApp(endpoint); } public fr.uge.webservices.App getApp(java.net.URL portAddress) throws javax.xml.rpc.ServiceException { try { fr.uge.webservices.AppSoapBindingStub _stub = new fr.uge.webservices.AppSoapBindingStub(portAddress, this); _stub.setPortName(getAppWSDDServiceName()); return _stub; } catch (org.apache.axis.AxisFault e) { return null; } } public void setAppEndpointAddress(java.lang.String address) { App_address = address; } /** * For the given interface, get the stub implementation. * If this service has no port for the given interface, * then ServiceException is thrown. */ public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { try { if (fr.uge.webservices.App.class.isAssignableFrom(serviceEndpointInterface)) { fr.uge.webservices.AppSoapBindingStub _stub = new fr.uge.webservices.AppSoapBindingStub(new java.net.URL(App_address), this); _stub.setPortName(getAppWSDDServiceName()); return _stub; } } catch (java.lang.Throwable t) { throw new javax.xml.rpc.ServiceException(t); } throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName())); } /** * For the given interface, get the stub implementation. * If this service has no port for the given interface, * then ServiceException is thrown. */ public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException { if (portName == null) { return getPort(serviceEndpointInterface); } java.lang.String inputPortName = portName.getLocalPart(); if ("App".equals(inputPortName)) { return getApp(); } else { java.rmi.Remote _stub = getPort(serviceEndpointInterface); ((org.apache.axis.client.Stub) _stub).setPortName(portName); return _stub; } } public javax.xml.namespace.QName getServiceName() { return new javax.xml.namespace.QName("http://webservices.uge.fr", "AppService"); } private java.util.HashSet ports = null; public java.util.Iterator getPorts() { if (ports == null) { ports = new java.util.HashSet(); ports.add(new javax.xml.namespace.QName("http://webservices.uge.fr", "App")); } return ports.iterator(); } /** * Set the endpoint address for the specified port name. */ public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException { if ("App".equals(portName)) { setAppEndpointAddress(address); } else { // Unknown Port Name throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); } } /** * Set the endpoint address for the specified port name. */ public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException { setEndpointAddress(portName.getLocalPart(), address); } }
[ "louisbillaut2000@gmail.com" ]
louisbillaut2000@gmail.com
3565a0f5a2513d7b3c3fae1decb375580b7d07cd
12bf983cb74ec284b29dc7a530bdffcad0f09b63
/src/test/java/com/example/configurationproject/ConfigurationProjectApplicationTests.java
494c2adcaa71e5a0209b7c625c59c6cf8a70d7cd
[]
no_license
MithoonKumar/ConfigurationAnnotation-in-Spring-boot
117705914d3a78e5182a6743469415e92675135b
c4539919902e5f94ba0309d3b6cee45f0bb37ca5
refs/heads/master
2020-04-03T02:34:01.679320
2018-10-27T12:01:21
2018-10-27T12:01:21
154,959,782
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package com.example.configurationproject; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ConfigurationProjectApplicationTests { @Test public void contextLoads() { } }
[ "mithoonk@zeta.tech" ]
mithoonk@zeta.tech
c43f5246e20dae95f601cd3ffaf26acf4ac48d3f
66379c91df83cb3a7b3a4b1b7ec4f4eb9952b694
/MemberManager(0111~)/src/controller/UpdateMemberController.java
06fd087542ea3467027c33b7899c59a646501a6a
[]
no_license
BangHoJung/jsp
5d846fa026ddbc8935ae612f0f7dbc3887cbb0fb
b3489dd3aa5386bd92de5ea6b1ebae81be15254b
refs/heads/main
2023-02-10T16:44:31.128092
2021-01-15T18:30:24
2021-01-15T18:30:24
326,876,145
0
0
null
null
null
null
UTF-8
Java
false
false
1,227
java
package controller; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import exception.MemberException; import model.ModelAndView; import service.MemberService; import vo.MemberVO; public class UpdateMemberController implements Controller { @Override public ModelAndView execute(HttpServletRequest request, HttpServletResponse response) { String id = request.getParameter("id"); String pass = request.getParameter("pass"); String name = request.getParameter("name"); int age = Integer.parseInt(request.getParameter("age")); MemberVO vo = new MemberVO(id,pass,name,age,null); ModelAndView view = null; try { MemberService.getInstance().updateMemberVO(vo); HttpSession session = request.getSession(); session.setAttribute("name", vo.getName()); view = new ModelAndView(session.getAttribute("last").toString(), true); } catch (MemberException e) { try { response.getWriter().append("<script>alert('"+e.getMessage()+"');history.back();</script>"); } catch (IOException e1) { e1.printStackTrace(); } } return view; } }
[ "tkrltlrl@gmail.com" ]
tkrltlrl@gmail.com
d0a85ef64896676438354d7422197c01e8a3dd61
116db2407e86ff7c25ea3c335940c1f8208f24e4
/src/main/java/com/smarthost/booking/service/BookingService.java
11335e2181ab3753e75917b00bd269fcaa5bd18d
[]
no_license
JosephSan/booking
c4f5693e2942a9ff0eaaebc2da616ffeed97cd7a
2eb13f2ccfe48762cb2707f065321135138d33de
refs/heads/master
2020-03-27T09:05:00.228202
2018-08-27T14:53:00
2018-08-27T14:53:00
146,312,454
0
0
null
null
null
null
UTF-8
Java
false
false
4,803
java
package com.smarthost.booking.service; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.smarthost.booking.dao.ReservationsDao; import com.smarthost.booking.domain.BookingResultTO; import com.smarthost.booking.domain.BookingStatus; import com.smarthost.booking.domain.Customer; import com.smarthost.booking.domain.CustomerComparator; import com.smarthost.booking.exception.BadFormattedDataFileException; @Service public class BookingService { @Autowired private ReservationsDao reservationsDao; public List<Customer> book(Integer nbPremiumRooms, Integer nbEconomyRooms) throws BadFormattedDataFileException { List<Customer> customers = reservationsDao.getCustomers(); Map<Boolean, List<Customer>> partitionedCustomers = upgradeCustomers(nbPremiumRooms, nbEconomyRooms, customers); bookEconomyRooms(partitionedCustomers.get(Boolean.FALSE), nbEconomyRooms); bookPremiumRooms(partitionedCustomers.get(Boolean.TRUE), nbPremiumRooms); return customers; } public BookingResultTO getBookedRoomsAndProfit(List<Customer> customers) { BookingResultTO bookingSummary = new BookingResultTO(); for (Customer customer : customers) { if (customer.getBookingStatus().equals(BookingStatus.ECONOMY)) { bookingSummary.setNbBookedEconomy(bookingSummary.getNbBookedEconomy() + 1); bookingSummary .setTotalProfitEconomy(bookingSummary.getTotalProfitEconomy() + customer.getExpectedPrice()); } if (customer.getBookingStatus().equals(BookingStatus.PREMIUM)) { bookingSummary.setNbBookedPremium(bookingSummary.getNbBookedPremium() + 1); bookingSummary .setTotalProfitPremium(bookingSummary.getTotalProfitPremium() + customer.getExpectedPrice()); } } return bookingSummary; } /** * If possible, upgrade highest paying economy customers. * * @param nbPremiumRooms * @param nbEconomyRooms * @param customers * @return Map key = TRUE : List of premium customers (including upgraded * customers), key = FALSE : List of economy customers */ private Map<Boolean, List<Customer>> upgradeCustomers(Integer nbPremiumRooms, Integer nbEconomyRooms, List<Customer> customers) { Integer nbCustomersToUpgrade = nbCustomersToUpgrade(customers, nbPremiumRooms, nbEconomyRooms); Collections.sort(customers, new CustomerComparator()); Map<Boolean, List<Customer>> partitionedCustomers = customers.stream() .collect(Collectors.partitioningBy(c -> c.isPremium())); while (nbCustomersToUpgrade > 0 && partitionedCustomers.get(Boolean.FALSE).size() > 0) { partitionedCustomers.get(Boolean.TRUE).add(partitionedCustomers.get(Boolean.FALSE).remove(0)); nbCustomersToUpgrade--; } return partitionedCustomers; } private Integer nbCustomersToUpgrade(List<Customer> customers, Integer nbPremiumRooms, Integer nbEconomyRooms) { Map<Boolean, List<Customer>> partitionedCustomers = customers.stream() .collect(Collectors.partitioningBy(c -> c.isPremium())); if (partitionedCustomers.get(Boolean.FALSE).size() <= nbEconomyRooms) { // all economy customers are assigned an economy room return 0; } return Math.max(0, nbPremiumRooms - partitionedCustomers.get(Boolean.TRUE).size()); } /** * Assign premium rooms to highest paying customers not already booked. This * could result in an upgrade if there are less customers paying more than 100€ * than premium rooms. Higher paying customers will be upgraded first. * * @param customers */ protected void bookPremiumRooms(List<Customer> customers, Integer nbAvailablePremiumRooms) { Collections.sort(customers, new CustomerComparator()); Integer nbBookedRooms = 0; for (Customer customer : customers) { if (nbBookedRooms.equals(nbAvailablePremiumRooms)) { break; } if (customer.getBookingStatus().equals(BookingStatus.NOT_BOOKED)) { customer.setBookingStatus(BookingStatus.PREMIUM); nbBookedRooms++; } } } /** * Book economy rooms. No customer willing to pay more than 100€ will be * assigned an economy room. Highest paying (not premium) customers will be * booked first. * * @param customers * @param nbAvailableEconomyRooms */ protected void bookEconomyRooms(List<Customer> customers, Integer nbAvailableEconomyRooms) { Collections.sort(customers, new CustomerComparator()); Integer nbBookedRooms = 0; for (Customer customer : customers) { if (nbBookedRooms.equals(nbAvailableEconomyRooms)) { break; } if (customer.getBookingStatus().equals(BookingStatus.NOT_BOOKED) && !customer.isPremium()) { customer.setBookingStatus(BookingStatus.ECONOMY); nbBookedRooms++; } } } }
[ "40736048+JosephSan@users.noreply.github.com" ]
40736048+JosephSan@users.noreply.github.com
fd6b853428171991de5962f63b58c29d109236fc
91d280521dfc59d58832d160487b125ee833f351
/src/com/scf/news/servlet/SelectDocument.java
78442bcc1be13e229f2790cb3547d90a0ab9c876
[]
no_license
schumali/SCF
346192925ce34de2c133b54684b8a84acbaa55f8
5b8e86b80c9dafadb924a4444c3cf8ef0386ecde
refs/heads/master
2020-05-25T19:36:48.757826
2019-05-22T04:00:03
2019-05-22T04:00:03
187,955,308
0
0
null
null
null
null
UTF-8
Java
false
false
1,500
java
package com.scf.news.servlet; import java.io.IOException; import java.sql.SQLException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.BeanListHandler; import com.scf.login.servlet.utils.C3P0Util; import com.scf.news.bean.Document; /** * Servlet implementation class SelectDocument */ public class SelectDocument extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("documentser1111"); QueryRunner runner = new QueryRunner(C3P0Util.getDataSource()); String sql ="select * from document"; try { List<Document> list = runner.query(sql, new BeanListHandler<>(Document.class)); HttpSession session = request.getSession(); session.setAttribute("document", list); //重定向跳转到Tuser.jsp response.sendRedirect("TDocument.jsp"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
[ "39515468+schumali@users.noreply.github.com" ]
39515468+schumali@users.noreply.github.com
dc33fe0dcf0632e89c58bc14360c5aaee829fb11
6ac87aa59388223cb7a0679fca54b5f2249c1a4e
/src/test/java/ch/bfh/uniboard/tests/UniBoardClientTest.java
8219f115d97c74fc48966d06d0f0802967529da3
[]
no_license
EVGStudents/UniBoardInspector
e5682527aae8f6234e321c0a89389da34c116999
3334b1e43a259b61232112b1691a3cc8403c0570
refs/heads/master
2016-09-11T04:28:14.429587
2015-01-16T09:23:06
2015-01-16T09:23:06
26,851,973
0
0
null
null
null
null
UTF-8
Java
false
false
2,226
java
/* * Copyright (c) 2013 Berner Fachhochschule, Switzerland. * Bern University of Applied Sciences, Engineering and Information Technology, * Research Institute for Security in the Information Society, E-Voting Group, * Biel, Switzerland. * * Project UniVote. * * Distributable under GPL license. * See terms of license at gnu.org. */ package ch.bfh.uniboard.tests; import ch.bfh.uniboard.client.QueryBuilder; import ch.bfh.uniboard.client.UniBoardClient; import ch.bfh.uniboard.data.PostDTO; import ch.bfh.uniboard.data.PostData; import ch.bfh.uniboard.data.QueryDTO; import ch.bfh.uniboard.service.SearchService; import java.util.Date; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.XMLGregorianCalendar; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import org.junit.Before; import org.junit.Test; /** * * @author Priya Bianchetti &lt;bianp2@bfh.ch&gt; */ public class UniBoardClientTest { private static final Logger logger = Logger.getLogger(QueryBuilderTest.class.getName()); private QueryBuilder queryBuilder; private XMLGregorianCalendar dateFrom; private XMLGregorianCalendar dateTo; @Before public void init() { queryBuilder = new QueryBuilder(); Date date1 = new Date(2014, 1, 15); Date date2 = new Date(2015, 1, 1); try{ dateFrom = SearchService.convertToXMLGregorianCalendar(date1); dateTo = SearchService.convertToXMLGregorianCalendar(date2); }catch(DatatypeConfigurationException exception){ logger.log(Level.SEVERE, exception.getMessage()); } } @Test public void testgetTop50MostRecentPosts() { List<PostData> posts=UniBoardClient.getTop50MostRecentPosts(); assertNotNull(posts); } @Test public void testBuidQuery(){ QueryDTO query = queryBuilder.buildQuery(); List<PostDTO> posts=UniBoardClient.sendQuery(query); assertNotNull(posts); assertNull(UniBoardClient.sendQuery(null)); } }
[ "bianchetti.priya@gmail.com" ]
bianchetti.priya@gmail.com
ac6bb0588ad4addaa338482c33018f3d13beeeeb
a53301edc92f10ff10a428ae65a3efda4db45bbb
/src/test/java/org/d2ab/collection/ints/CollectionIntListTest.java
1f531cf2e202e89f13e310dc6f06b68fe00b21fa
[ "Apache-2.0" ]
permissive
dsaborg/sequence
b4a55f3c2b0a871471acea62f842f3018fcdcfc0
b88248bfc5848dfaba6b17f83f82af96b0c1c6c8
refs/heads/master
2021-06-18T23:03:30.243596
2017-04-29T16:39:26
2017-04-29T17:36:24
48,278,618
0
1
null
null
null
null
UTF-8
Java
false
false
12,762
java
/* * Copyright 2016 Daniel Skogquist Åborg * * 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.d2ab.collection.ints; import org.d2ab.collection.Lists; import org.d2ab.iterator.ints.IntIterator; import org.junit.Test; import java.util.NoSuchElementException; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import static org.d2ab.test.IsIntIterableContainingInOrder.containsInts; import static org.d2ab.test.Tests.expecting; import static org.d2ab.test.Tests.twice; import static org.hamcrest.Matchers.*; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertThat; public class CollectionIntListTest { private final IntList empty = CollectionIntList.from(IntList.create()); private final IntList list = CollectionIntList.from(IntList.create(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); @Test public void subList() { IntList subList = list.subList(2, 8); twice(() -> assertThat(subList, containsInts(3, 4, 5, 1, 2, 3))); assertThat(subList.removeIntAt(1), is(4)); twice(() -> assertThat(subList, containsInts(3, 5, 1, 2, 3))); assertThat(subList.removeInt(5), is(true)); twice(() -> assertThat(subList, containsInts(3, 1, 2, 3))); IntIterator subListIterator = subList.iterator(); assertThat(subListIterator.hasNext(), is(true)); assertThat(subListIterator.nextInt(), is(3)); subListIterator.remove(); twice(() -> assertThat(subList, containsInts(1, 2, 3))); subList.removeIntsIf(x -> x % 2 == 0); twice(() -> assertThat(subList, containsInts(1, 3))); subList.clear(); twice(() -> assertThat(subList, is(emptyIterable()))); } @Test public void size() { assertThat(empty.size(), is(0)); assertThat(list.size(), is(10)); } @Test public void isEmpty() { assertThat(empty.isEmpty(), is(true)); assertThat(list.isEmpty(), is(false)); } @Test public void containsInt() { assertThat(empty.containsInt(2), is(false)); for (int i = 1; i < 5; i++) assertThat(list.containsInt(i), is(true)); assertThat(list.containsInt(17), is(false)); } @Test public void iterator() { assertThat(empty, is(emptyIterable())); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void iteratorRemove() { IntIterator iterator = list.iterator(); iterator.nextInt(); iterator.nextInt(); iterator.remove(); iterator.nextInt(); iterator.remove(); assertThat(list, containsInts(1, 4, 5, 1, 2, 3, 4, 5)); } @Test public void toIntArray() { assertArrayEquals(new int[0], empty.toIntArray()); assertArrayEquals(new int[]{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}, list.toIntArray()); } @Test public void addInt() { assertThat(empty.addInt(1), is(true)); assertThat(empty, containsInts(1)); assertThat(list.addInt(6), is(true)); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6)); } @Test public void removeInt() { assertThat(empty.removeInt(17), is(false)); assertThat(list.removeInt(2), is(true)); assertThat(list, containsInts(1, 3, 4, 5, 1, 2, 3, 4, 5)); assertThat(list.removeInt(17), is(false)); assertThat(list, containsInts(1, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void containsAllInts() { assertThat(empty.containsAllInts(IntList.create(2, 3)), is(false)); assertThat(list.containsAllInts(IntList.create(2, 3)), is(true)); assertThat(list.containsAllInts(IntList.create(2, 17)), is(false)); } @Test public void addAllIntsVarargs() { assertThat(empty.addAllInts(), is(false)); assertThat(empty, is(emptyIterable())); assertThat(empty.addAllInts(1, 2), is(true)); assertThat(empty, containsInts(1, 2)); assertThat(list.addAllInts(6, 7, 8), is(true)); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8)); } @Test public void addAllIntsIntList() { assertThat(empty.addAllInts(IntList.create()), is(false)); assertThat(empty, is(emptyIterable())); assertThat(empty.addAllInts(IntList.create(1, 2)), is(true)); assertThat(empty, containsInts(1, 2)); assertThat(list.addAllInts(IntList.create(6, 7, 8)), is(true)); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8)); } @Test public void addAllIntsAt() { assertThat(empty.addAllIntsAt(0, IntList.create()), is(false)); assertThat(empty, is(emptyIterable())); expecting(UnsupportedOperationException.class, () -> empty.addAllIntsAt(0, IntList.create(1, 2))); assertThat(empty, is(emptyIterable())); expecting(UnsupportedOperationException.class, () -> list.addAllIntsAt(2, IntList.create(17, 18, 19))); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void removeAllInts() { assertThat(empty.removeAllInts(IntList.create(1, 2)), is(false)); assertThat(empty, is(emptyIterable())); assertThat(list.removeAllInts(IntList.create(1, 2, 5)), is(true)); assertThat(list, containsInts(3, 4, 3, 4)); } @Test public void retainAllInts() { assertThat(empty.retainAllInts(IntList.create(1, 2)), is(false)); assertThat(empty, is(emptyIterable())); assertThat(list.retainAllInts(IntList.create(1, 2, 3)), is(true)); assertThat(list, containsInts(1, 2, 3, 1, 2, 3)); } @Test public void replaceAllInts() { empty.replaceAllInts(x -> x + 1); assertThat(empty, is(emptyIterable())); expecting(UnsupportedOperationException.class, () -> list.replaceAllInts(x -> x + 1)); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void sortInts() { expecting(UnsupportedOperationException.class, empty::sortInts); assertThat(empty, is(emptyIterable())); expecting(UnsupportedOperationException.class, list::sortInts); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void clear() { empty.clear(); assertThat(empty, is(emptyIterable())); list.clear(); assertThat(list, is(emptyIterable())); } @Test public void testEquals() { assertThat(empty.equals(Lists.of()), is(true)); assertThat(empty.equals(Lists.of(1, 2)), is(false)); assertThat(list.equals(Lists.of(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)), is(true)); assertThat(list.equals(Lists.of(5, 4, 3, 2, 1, 5, 4, 3, 2, 1)), is(false)); } @Test public void testHashCode() { assertThat(empty.hashCode(), is(Lists.of().hashCode())); assertThat(list.hashCode(), is(Lists.of(1, 2, 3, 4, 5, 1, 2, 3, 4, 5).hashCode())); } @Test public void testToString() { assertThat(empty.toString(), is("[]")); assertThat(list.toString(), is("[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]")); } @Test public void get() { assertThat(list.getInt(0), is(1)); assertThat(list.getInt(2), is(3)); assertThat(list.getInt(4), is(5)); assertThat(list.getInt(5), is(1)); assertThat(list.getInt(7), is(3)); assertThat(list.getInt(9), is(5)); } @Test public void setInt() { expecting(UnsupportedOperationException.class, () -> list.setInt(2, 17)); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void addIntAt() { expecting(UnsupportedOperationException.class, () -> list.addIntAt(0, 17)); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void indexOfInt() { assertThat(empty.indexOfInt(17), is(-1)); assertThat(list.indexOfInt(1), is(0)); assertThat(list.indexOfInt(3), is(2)); assertThat(list.indexOfInt(5), is(4)); } @Test public void lastIndexOfInt() { assertThat(empty.lastIndexOfInt(17), is(-1)); assertThat(list.lastIndexOfInt(1), is(5)); assertThat(list.lastIndexOfInt(3), is(7)); assertThat(list.lastIndexOfInt(5), is(9)); } @Test public void listIteratorEmpty() { IntListIterator emptyIterator = empty.listIterator(); assertThat(emptyIterator.hasNext(), is(false)); expecting(NoSuchElementException.class, emptyIterator::nextInt); expecting(UnsupportedOperationException.class, emptyIterator::hasPrevious); expecting(UnsupportedOperationException.class, emptyIterator::previousInt); assertThat(emptyIterator.nextIndex(), is(0)); assertThat(emptyIterator.previousIndex(), is(-1)); expecting(UnsupportedOperationException.class, () -> emptyIterator.add(17)); assertThat(emptyIterator.hasNext(), is(false)); assertThat(emptyIterator.nextIndex(), is(0)); assertThat(emptyIterator.previousIndex(), is(-1)); assertThat(empty, is(emptyIterable())); } @Test public void listIteratorAtEnd() { IntListIterator listIterator = list.listIterator(10); assertThat(listIterator.hasNext(), is(false)); expecting(NoSuchElementException.class, listIterator::nextInt); } @Test public void listIteratorAfterEnd() { expecting(IndexOutOfBoundsException.class, () -> list.listIterator(11)); } @Test public void iteratorRemoveAll() { IntIterator iterator = list.iterator(); int i = 0; while (iterator.hasNext()) { assertThat(iterator.nextInt(), is(i % 5 + 1)); iterator.remove(); i++; } assertThat(i, is(10)); expecting(NoSuchElementException.class, iterator::nextInt); assertThat(list, is(emptyIterable())); } @Test public void listIterator() { IntListIterator listIterator = list.listIterator(); assertThat(listIterator.hasNext(), is(true)); assertThat(listIterator.nextIndex(), is(0)); assertThat(listIterator.previousIndex(), is(-1)); assertThat(listIterator.nextInt(), is(1)); assertThat(listIterator.hasNext(), is(true)); assertThat(listIterator.nextIndex(), is(1)); assertThat(listIterator.previousIndex(), is(0)); assertThat(listIterator.nextInt(), is(2)); expecting(UnsupportedOperationException.class, () -> listIterator.add(17)); assertThat(listIterator.hasNext(), is(true)); assertThat(listIterator.nextIndex(), is(2)); assertThat(listIterator.previousIndex(), is(1)); assertThat(listIterator.nextInt(), is(3)); expecting(UnsupportedOperationException.class, () -> listIterator.set(17)); assertThat(listIterator.hasNext(), is(true)); assertThat(listIterator.nextIndex(), is(3)); assertThat(listIterator.previousIndex(), is(2)); assertThat(listIterator.nextInt(), is(4)); assertThat(list, containsInts(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void exhaustiveListIterator() { IntListIterator listIterator = list.listIterator(); AtomicInteger i = new AtomicInteger(0); twice(() -> { while (listIterator.hasNext()) { assertThat(listIterator.nextInt(), is(i.get() % 5 + 1)); assertThat(listIterator.nextIndex(), is(i.get() + 1)); assertThat(listIterator.previousIndex(), is(i.get())); i.incrementAndGet(); } assertThat(i.get(), is(10)); }); } @Test public void listIteratorRemoveAll() { IntIterator iterator = list.iterator(); int i = 0; while (iterator.hasNext()) { assertThat(iterator.nextInt(), is(i % 5 + 1)); iterator.remove(); i++; } assertThat(i, is(10)); assertThat(list, is(emptyIterable())); } @Test public void listIteratorRemove() { IntListIterator listIterator = list.listIterator(); int i = 0; while (listIterator.hasNext()) { assertThat(listIterator.nextInt(), is(i % 5 + 1)); assertThat(listIterator.nextIndex(), is(1)); assertThat(listIterator.previousIndex(), is(0)); listIterator.remove(); assertThat(listIterator.nextIndex(), is(0)); assertThat(listIterator.previousIndex(), is(-1)); i++; } assertThat(i, is(10)); assertThat(list, is(emptyIterable())); } @Test public void stream() { assertThat(empty.stream().collect(Collectors.toList()), is(emptyIterable())); assertThat(list.stream().collect(Collectors.toList()), contains(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void parallelStream() { assertThat(empty.parallelStream().collect(Collectors.toList()), is(emptyIterable())); assertThat(list.parallelStream().collect(Collectors.toList()), contains(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)); } @Test public void removeIntsIf() { empty.removeIntsIf(x -> x == 1); assertThat(empty, is(emptyIterable())); list.removeIntsIf(x -> x == 1); assertThat(list, containsInts(2, 3, 4, 5, 2, 3, 4, 5)); } @Test public void forEachInt() { empty.forEachInt(x -> { throw new IllegalStateException("Should not get called"); }); AtomicInteger i = new AtomicInteger(0); list.forEachInt(x -> assertThat(x, is(i.getAndIncrement() % 5 + 1))); assertThat(i.get(), is(10)); } }
[ "daniel.aborg@purplescout.se" ]
daniel.aborg@purplescout.se
c5da396476a7f3739a28474123cf171554a2fa58
0ff3d8cf05334af38ea491730b7783c98e194af3
/app/src/androidTest/java/xyz/vinayak/maps/ExampleInstrumentedTest.java
61a50b04f8b66096fbcdcebe53b8ab4d86a45f3e
[]
no_license
chrisndirangu54/movementPathTrackerAndroid
1c89cec714e485d03a43d815faef03e3b0b01b17
c0ed0ed9a2732c07ba587553098dc53e1fad4fc2
refs/heads/master
2021-09-18T07:54:16.185631
2018-07-11T13:51:11
2018-07-11T13:51:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
package xyz.vinayak.maps; 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("xyz.vinayak.maps", appContext.getPackageName()); } }
[ "v27u27@gmail.com" ]
v27u27@gmail.com
5527fc2a756a9ef113ddea54fe7876f35147ade3
b8919ee9c3afda95f5384d7deedfc4513b8341b8
/thingifier/src/test/java/uk/co/compendiumdev/casestudy/todomanager/unit/BasicTodoManagerTest.java
e27114bc50972ef01a4a5674ddea8c8b8d64ba66
[ "MIT" ]
permissive
eviltester/thingifier
74d61c3972180f682cb72028dad536090d225f51
8b23e485f83beb4f40bde3666b6eb88e813a3a86
refs/heads/master
2023-06-10T09:22:43.547029
2021-09-01T22:59:09
2021-09-01T22:59:09
140,860,992
20
15
null
2023-06-03T04:12:34
2018-07-13T15:02:41
Java
UTF-8
Java
false
false
5,701
java
package uk.co.compendiumdev.casestudy.todomanager.unit; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import uk.co.compendiumdev.casestudy.todomanager.TodoManagerModel; import uk.co.compendiumdev.thingifier.core.domain.instances.EntityInstanceCollection; import uk.co.compendiumdev.thingifier.Thingifier; import uk.co.compendiumdev.thingifier.core.domain.instances.EntityInstance; import java.util.Collection; public class BasicTodoManagerTest { private Thingifier todoManager; @BeforeEach public void createDefinitions(){ todoManager = TodoManagerModel.definedAsThingifier(); } @Test public void todoModelDefinitionCheck(){ EntityInstanceCollection todo = todoManager.getThingInstancesNamed("todo"); Assertions.assertTrue(todo.definition().hasFieldNameDefined("title")); Assertions.assertTrue(todo.definition().hasFieldNameDefined("description")); Assertions.assertTrue(todo.definition().hasFieldNameDefined("doneStatus")); Assertions.assertEquals("false", todo.definition(). getField("doneStatus"). getDefaultValue().asString()); } @Test public void relationshipDefinitionCheck(){ EntityInstanceCollection todo = todoManager.getThingInstancesNamed("todo"); EntityInstanceCollection project = todoManager.getThingInstancesNamed("project"); EntityInstance paperwork = todo.createManagedInstance().setValue("title", "scan paperwork"); EntityInstance filework = todo.createManagedInstance().setValue("title", "file paperwork"); EntityInstance officeWork = project.createManagedInstance().setValue("title", "Office Work"); officeWork.getRelationships().connect("tasks", paperwork); officeWork.getRelationships().connect("tasks", filework); Collection<EntityInstance> relatedItems = officeWork.getRelationships().getConnectedItems("tasks"); Assertions.assertTrue(relatedItems.contains(paperwork)); Assertions.assertTrue(relatedItems.contains(filework)); relatedItems = officeWork.getRelationships().getConnectedItems("tasks"); Assertions.assertTrue(relatedItems.contains(paperwork)); Assertions.assertTrue(relatedItems.contains(filework)); todoManager.deleteThing(paperwork); relatedItems = officeWork.getRelationships().getConnectedItems("tasks"); Assertions.assertFalse(relatedItems.contains(paperwork)); Assertions.assertTrue(relatedItems.contains(filework)); } @Test public void createAndAmendSomeTodos(){ EntityInstanceCollection todos = todoManager.getThingInstancesNamed("todo"); EntityInstance tidy = todos.createManagedInstance(). setValue("title", "Tidy up my room"). setValue("description", "I need to tidy up my room because it is a mess"); EntityInstance paperwork = todos.createManagedInstance(). setValue("title","Do Paperwork"). setValue("description", "Scan everything in, upload to document management system and file paperwork"); Assertions.assertEquals("false", paperwork.getFieldValue("doneStatus").asString()); System.out.println(todoManager.toString()); tidy.setValue("doneStatus", "true"); Assertions.assertEquals("true", tidy.getFieldValue("doneStatus").asString()); System.out.println(todoManager.toString()); } @Test public void createAndDeleteTodos(){ EntityInstanceCollection todos = todoManager.getThingInstancesNamed("todo"); int originalTodosCount = todos.countInstances(); EntityInstance tidy = todos.createManagedInstance(). setValue("title","Delete this todo"). setValue("description", "I need to be deleted"); EntityInstance foundit = todos.findInstanceByGUID(tidy.getGUID()); Assertions.assertEquals("Delete this todo", foundit.getFieldValue("title").asString()); todoManager.deleteThing(foundit); Assertions.assertEquals(originalTodosCount, todos.countInstances()); foundit = todos.findInstanceByGUID(tidy.getGUID()); Assertions.assertNull(foundit); try{ todoManager.deleteThing(foundit); Assertions.fail("Item already deleted, exception should have been thrown"); }catch(Exception e){ } } @Test public void createAmendAndDeleteATodoWithAGivenGUID(){ EntityInstanceCollection todos = todoManager.getThingInstancesNamed("todo"); int originalTodosCount = todos.countInstances(); String guid="1234-12334-1234-1234"; EntityInstance tidy = new EntityInstance(todos.definition()); tidy.overrideValue("guid", guid); tidy.addIdsToInstance(); tidy.setValue("title", "Delete this todo"). setValue("description", "I need to be deleted"); todos.addInstance(tidy); EntityInstance foundit = todos.findInstanceByGUID(guid); Assertions.assertEquals("Delete this todo", foundit.getFieldValue("title").asString()); todoManager.deleteThing(foundit); Assertions.assertEquals(originalTodosCount, todos.countInstances()); foundit = todos.findInstanceByGUID(guid); Assertions.assertNull(foundit); try{ todoManager.deleteThing(foundit); Assertions.fail("Item already deleted, exception should have been thrown"); }catch(Exception e){ } } }
[ "alan@compendiumdev.co.uk" ]
alan@compendiumdev.co.uk
de0c1ae101490391c17b3cc9f377fc23e8d3f416
7c55403d26dc2bbbfc42278c62561b19a39e6ab4
/app/src/main/java/com/okhttp/MyApplication.java
a6702b260be122f1109127d72494c5aa46bb4895
[]
no_license
QIANJINLEI/Demo_2017_02_09
40be3de7c48be1f56483567c7fad923e21d7bb8a
5c81a3609252b4700d6e8dcb9f068320a38e7764
refs/heads/master
2021-01-22T07:23:25.394360
2017-02-15T10:42:25
2017-02-15T10:42:25
81,814,016
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
package com.okhttp; import android.app.Application; /** * Created by wb-qjl256634 on 2017/2/10. */ public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); /* AlibcTradeSDK.asyncInit(this, new AlibcTradeInitCallback() { @Override public void onSuccess() { //初始化成功,设置相关的全局配置参数 Log.e("qqq","onSuccess??"); // ... } @Override public void onFailure(int code, String msg) { //初始化失败,可以根据code和msg判断失败原因,详情参见错误说明 Log.e("qqq","onFailure??"+"code"+code+"+msg"+msg); } });*/ } }
[ "18914010426@163.com" ]
18914010426@163.com
dcf4d86fdca4106a90ebdd5ba4223cafaaa41af5
4e86f374d0521605a0a3595dbcd9fb224de5fe50
/src/main/java/com/company/project/mapper/AccountMapper.java
477ffc015727e5b5f6486632343aa13fd19d027e
[]
no_license
PiotrJuchimowicz/TasksWeb
82e153d5b7a0854524f801560432f04a92a555a4
365ba7fddbb146294cf968418beb310c10bef2a3
refs/heads/master
2020-04-15T08:07:49.412686
2019-01-16T23:03:52
2019-01-16T23:03:52
164,518,851
2
0
null
null
null
null
UTF-8
Java
false
false
2,179
java
package com.company.project.mapper; import com.company.project.dto.AccountDto; import com.company.project.exception.MapperException; import com.company.project.model.AccountEntity; import org.springframework.stereotype.Component; @Component public class AccountMapper implements AbstractMapper<AccountEntity, AccountDto> { @Override public void fromDtoToExistingEntity(AccountDto dto, AccountEntity entity) { if (dto == null || entity == null) { throw new MapperException("Unable to map from AccountDto to existing AccountEntity"); } String email = dto.getEmail(); if (email != null) entity.setEmail(email); Boolean isActive = dto.getIsActive(); if (isActive != null) entity.setActive(isActive); String password = dto.getPassword(); if (password != null) { int passwordHash = password.hashCode(); entity.setPassword(String.valueOf(passwordHash)); } } @Override public AccountEntity fromDtoToNewEntity(AccountDto dto) { if (dto == null) { throw new MapperException("Unable to map from AccountDto to new AccountEntity"); } AccountEntity entity = new AccountEntity(); entity.setEmail(dto.getEmail()); String password = dto.getPassword(); int passwordHash = password.hashCode(); entity.setPassword(String.valueOf(passwordHash)); entity.setPassword(String.valueOf(password)); entity.setActive(dto.getIsActive()); return entity; } @Override public AccountDto fromEntityToNewDto(AccountEntity accountEntity) { if (accountEntity == null) { throw new MapperException("Unable to map from AccountEntity to AccountDto"); } AccountDto dto = new AccountDto(); dto.setId(accountEntity.getId()); dto.setEmail(accountEntity.getEmail()); dto.setIsActive(accountEntity.isActive()); dto.setPassword(accountEntity.getPassword()); dto.setUserId(accountEntity.getUser().getId()); return dto; } }
[ "piotrjuchimowicz@gmail.com" ]
piotrjuchimowicz@gmail.com
7e6681bd80985ea1675385beaccd2ca59d5e399e
068dceeb8094c72abfefaf08a9eef3b8a3c4624c
/ibgewrapper/src/main/java/br/com/matheus/kafkaline/ibgewrapper/gateway/json/EstadoList.java
43a62a4bb1299edfcb3b6e39c7feb7a8c523b4af
[]
no_license
armelin2001/primeiroProjetoKafka
7ba5c3d5dad56dabe10153ed9a2464f2a964634a
26f1a0246dc9749bb7cea1d27a9af74b5b387dd6
refs/heads/master
2022-06-29T08:48:08.904285
2020-04-29T19:07:57
2020-04-29T19:07:57
259,420,927
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
package br.com.matheus.kafkaline.ibgewrapper.gateway.json; import java.util.List; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor @Builder public class EstadoList { private List<EstadoJson> list; }
[ "55255174+armelin2001@users.noreply.github.com" ]
55255174+armelin2001@users.noreply.github.com
7703c4a87416ba769d46b0ceaec77a8c2200be0a
89c8baf1a1082c4b3499c2a87b2dd36871ba4353
/Circuitor/src/KUU/FrameWorkComponent/ExecuteComponent/SubOperateComponent/ExeIndiCateLabel.java
db9de91ac2379771bb7e2ab54e33a4a978689e04
[]
no_license
Gamu2059/Circuitor
105fedc31acaf158dad43daf7627c3e02dd401e4
3fcf4b0f1be5c22b4ff62b3c7c371a2b10190567
refs/heads/master
2021-07-11T00:53:45.584874
2017-10-05T03:35:12
2017-10-05T03:35:12
96,035,425
0
0
null
null
null
null
UTF-8
Java
false
false
5,001
java
package KUU.FrameWorkComponent.ExecuteComponent.SubOperateComponent; import Master.BorderMaster.BorderMaster; import javax.swing.*; import java.math.BigDecimal; /** * 電圧計や電流計の実際値を表示するための機能を備えたクラス。 */ public class ExeIndiCateLabel extends JLabel { /** * 表示する値の単位。 */ private String unit; public ExeIndiCateLabel(String unit) { super(); setOpaque(true); setBorder(BorderMaster.getRegularBorder()); setHorizontalAlignment(RIGHT); this.unit = unit + "]"; } public String getUnit() { return unit; } /** * 実行の最初に呼び出される。 * 値は何も表示しない。 */ public void initFormattedValue() { setText("----- [ " + unit); } /** * 値を最大3桁までの整数とdigit桁までの少数で構成するように調整して文字列で返す。 * ただし、Infinityの場合は"±Infinity"、Not a Numberの場合は"Not a Number"とする。 */ public static StringBuffer getFormattedValue(double value, int digit) { if (value == Double.NaN) { return new StringBuffer("Not a Number [ "); } else if (value == Double.POSITIVE_INFINITY) { return new StringBuffer("Infinity [ "); } else if (value == Double.NEGATIVE_INFINITY) { return new StringBuffer("-Infinity [ "); } else { if (Math.abs(value) == 0) { return new StringBuffer("0 [ "); } else { return getInternalFormattedValue(value, digit); } } } /** * 値を最大3桁までの整数とdigit桁までの少数で構成するように調整して文字列で返す本体処理。 */ private static StringBuffer getInternalFormattedValue(double value, int digit) { int decimalPoint = 0; /* 値を整数部分1桁で表す時の指数表記を求める */ if (Math.abs(value) > 1) { while (Math.abs(value / Math.pow(10, ++decimalPoint + 1)) >= 1) ; decimalPoint -= decimalPoint % 3; } else if (Math.abs(value) < 1) { while (Math.abs(value / Math.pow(10, --decimalPoint)) < 1) ; decimalPoint = decimalPoint - decimalPoint % 3 - (decimalPoint % 3 == 0 ? 0 : 3); } value /= Math.pow(10, decimalPoint); BigDecimal bigDecimal = new BigDecimal(Double.toString(value)); bigDecimal = bigDecimal.setScale(digit, BigDecimal.ROUND_HALF_UP); StringBuffer stringBuffer = new StringBuffer(bigDecimal.toString()); /* 単位の接辞を追加する */ if (decimalPoint < -24) { stringBuffer.append(" [?"); } else if (decimalPoint >= -24 && decimalPoint < -21) { stringBuffer.append(" [y"); } else if (decimalPoint >= -21 && decimalPoint < -18) { stringBuffer.append(" [z"); } else if (decimalPoint >= -18 && decimalPoint < -15) { stringBuffer.append(" [a"); } else if (decimalPoint >= -15 && decimalPoint < -12) { stringBuffer.append(" [f"); } else if (decimalPoint >= -12 && decimalPoint < -9) { stringBuffer.append(" [p"); } else if (decimalPoint >= -9 && decimalPoint < -6) { stringBuffer.append(" [n"); } else if (decimalPoint >= -6 && decimalPoint < -3) { stringBuffer.append(" [u"); } else if (decimalPoint >= -3 && decimalPoint < 0) { stringBuffer.append(" [m"); } else if (decimalPoint >= 0 && decimalPoint < 3) { stringBuffer.append(" [ "); } else if (decimalPoint >= 3 && decimalPoint < 6) { stringBuffer.append(" [k"); } else if (decimalPoint >= 6 && decimalPoint < 9) { stringBuffer.append(" [M"); } else if (decimalPoint >= 9 && decimalPoint < 12) { stringBuffer.append(" [G"); } else if (decimalPoint >= 12 && decimalPoint < 15) { stringBuffer.append(" [T"); } else if (decimalPoint >= 15 && decimalPoint < 18) { stringBuffer.append(" [T"); } else if (decimalPoint >= 18 && decimalPoint < 21) { stringBuffer.append(" [T"); } else if (decimalPoint >= 21 && decimalPoint < 24) { stringBuffer.append(" [T"); } else if (decimalPoint >= 24 && decimalPoint < 27) { stringBuffer.append(" [T"); } else if (decimalPoint >= 27) { stringBuffer.append(" [!"); } return stringBuffer; } /** * 値を調整してラベルに表示するようにする。 */ public void setFormattedValue(double value) { setText(getFormattedValue(value,3).append(unit).toString()); } }
[ "yamagami0711syo@gmail.com" ]
yamagami0711syo@gmail.com
8808a8667554f7264ca7f116c53165f385809363
38ea9c5de18ead5f70a585a3f7224a54c899ccfd
/pet-clinic-data/src/main/java/guru/springframework/sfgpetclinic/model/Vet.java
fe146c14d720f44bfab399c7e4b5c483a935fe90
[]
no_license
Humberto-Nava-Lara/sfg-pet-clinic
ad4441cb6faea92018d449cec516dc4346535257
5bad6eb3a67acf3b1c14373560d8cee83e7dd1be
refs/heads/master
2020-06-06T20:21:37.316682
2019-11-15T03:58:25
2019-11-15T03:58:25
192,844,045
0
0
null
null
null
null
UTF-8
Java
false
false
522
java
package guru.springframework.sfgpetclinic.model; import lombok.*; import javax.persistence.*; import java.util.HashSet; import java.util.Set; @Setter @Getter @NoArgsConstructor @AllArgsConstructor @Builder @Entity @Table(name = "vets") public class Vet extends Person { @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "vet_specialities", joinColumns = @JoinColumn(name = "vet_id"), inverseJoinColumns = @JoinColumn(name = "speciality_id")) private Set<Speciality> specialities = new HashSet<>(); }
[ "codycinder@hotmail.com" ]
codycinder@hotmail.com
0213f6435d5e29621d6c2374dadb76d3bb2bb907
551ab9e3201ff691176287ce99f40bab00c9a7a2
/android/support/v4/print/PrintHelperKitkat.java
cbe01cb5e7d2a97ed19513e5bffeab78b7eb76d4
[]
no_license
caesar-tirta/mu-TunaikuTest
aea4d7486eafef0768a8503637b7f178df8ba2d3
4c8576368701fc7db64699a2624f6503fbb71706
refs/heads/master
2021-01-19T12:12:19.482462
2017-04-12T08:22:30
2017-04-12T08:22:30
88,026,698
0
0
null
null
null
null
UTF-8
Java
false
false
23,025
java
package android.support.v4.print; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import android.graphics.Canvas; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.pdf.PdfDocument.Page; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.CancellationSignal; import android.os.CancellationSignal.OnCancelListener; import android.os.ParcelFileDescriptor; import android.print.PageRange; import android.print.PrintAttributes; import android.print.PrintAttributes.Margins; import android.print.PrintAttributes.MediaSize; import android.print.PrintDocumentAdapter; import android.print.PrintDocumentAdapter.LayoutResultCallback; import android.print.PrintDocumentAdapter.WriteResultCallback; import android.print.PrintDocumentInfo; import android.print.PrintDocumentInfo.Builder; import android.print.PrintManager; import android.print.pdf.PrintedPdfDocument; import android.util.Log; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; class PrintHelperKitkat { public static final int COLOR_MODE_COLOR = 2; public static final int COLOR_MODE_MONOCHROME = 1; private static final String LOG_TAG = "PrintHelperKitkat"; private static final int MAX_PRINT_SIZE = 3500; public static final int ORIENTATION_LANDSCAPE = 1; public static final int ORIENTATION_PORTRAIT = 2; public static final int SCALE_MODE_FILL = 2; public static final int SCALE_MODE_FIT = 1; int mColorMode; final Context mContext; Options mDecodeOptions; protected boolean mIsMinMarginsHandlingCorrect; private final Object mLock; int mOrientation; protected boolean mPrintActivityRespectsOrientation; int mScaleMode; /* renamed from: android.support.v4.print.PrintHelperKitkat.1 */ class C00911 extends PrintDocumentAdapter { private PrintAttributes mAttributes; final /* synthetic */ Bitmap val$bitmap; final /* synthetic */ OnPrintFinishCallback val$callback; final /* synthetic */ int val$fittingMode; final /* synthetic */ String val$jobName; C00911(String str, int i, Bitmap bitmap, OnPrintFinishCallback onPrintFinishCallback) { this.val$jobName = str; this.val$fittingMode = i; this.val$bitmap = bitmap; this.val$callback = onPrintFinishCallback; } public void onLayout(PrintAttributes oldPrintAttributes, PrintAttributes newPrintAttributes, CancellationSignal cancellationSignal, LayoutResultCallback layoutResultCallback, Bundle bundle) { boolean changed = true; this.mAttributes = newPrintAttributes; PrintDocumentInfo info = new Builder(this.val$jobName).setContentType(PrintHelperKitkat.SCALE_MODE_FIT).setPageCount(PrintHelperKitkat.SCALE_MODE_FIT).build(); if (newPrintAttributes.equals(oldPrintAttributes)) { changed = false; } layoutResultCallback.onLayoutFinished(info, changed); } public void onWrite(PageRange[] pageRanges, ParcelFileDescriptor fileDescriptor, CancellationSignal cancellationSignal, WriteResultCallback writeResultCallback) { PrintHelperKitkat.this.writeBitmap(this.mAttributes, this.val$fittingMode, this.val$bitmap, fileDescriptor, cancellationSignal, writeResultCallback); } public void onFinish() { if (this.val$callback != null) { this.val$callback.onFinish(); } } } /* renamed from: android.support.v4.print.PrintHelperKitkat.2 */ class C00922 extends AsyncTask<Void, Void, Throwable> { final /* synthetic */ PrintAttributes val$attributes; final /* synthetic */ Bitmap val$bitmap; final /* synthetic */ CancellationSignal val$cancellationSignal; final /* synthetic */ ParcelFileDescriptor val$fileDescriptor; final /* synthetic */ int val$fittingMode; final /* synthetic */ PrintAttributes val$pdfAttributes; final /* synthetic */ WriteResultCallback val$writeResultCallback; C00922(CancellationSignal cancellationSignal, PrintAttributes printAttributes, Bitmap bitmap, PrintAttributes printAttributes2, int i, ParcelFileDescriptor parcelFileDescriptor, WriteResultCallback writeResultCallback) { this.val$cancellationSignal = cancellationSignal; this.val$pdfAttributes = printAttributes; this.val$bitmap = bitmap; this.val$attributes = printAttributes2; this.val$fittingMode = i; this.val$fileDescriptor = parcelFileDescriptor; this.val$writeResultCallback = writeResultCallback; } protected Throwable doInBackground(Void... params) { Throwable th = null; PrintedPdfDocument pdfDocument; Bitmap maybeGrayscale; try { if (!this.val$cancellationSignal.isCanceled()) { pdfDocument = new PrintedPdfDocument(PrintHelperKitkat.this.mContext, this.val$pdfAttributes); maybeGrayscale = PrintHelperKitkat.this.convertBitmapForColorMode(this.val$bitmap, this.val$pdfAttributes.getColorMode()); if (!this.val$cancellationSignal.isCanceled()) { RectF contentRect; Page page = pdfDocument.startPage(PrintHelperKitkat.SCALE_MODE_FIT); if (PrintHelperKitkat.this.mIsMinMarginsHandlingCorrect) { contentRect = new RectF(page.getInfo().getContentRect()); } else { PrintedPdfDocument dummyDocument = new PrintedPdfDocument(PrintHelperKitkat.this.mContext, this.val$attributes); Page dummyPage = dummyDocument.startPage(PrintHelperKitkat.SCALE_MODE_FIT); contentRect = new RectF(dummyPage.getInfo().getContentRect()); dummyDocument.finishPage(dummyPage); dummyDocument.close(); } Matrix matrix = PrintHelperKitkat.this.getMatrix(maybeGrayscale.getWidth(), maybeGrayscale.getHeight(), contentRect, this.val$fittingMode); if (!PrintHelperKitkat.this.mIsMinMarginsHandlingCorrect) { matrix.postTranslate(contentRect.left, contentRect.top); page.getCanvas().clipRect(contentRect); } page.getCanvas().drawBitmap(maybeGrayscale, matrix, null); pdfDocument.finishPage(page); if (this.val$cancellationSignal.isCanceled()) { pdfDocument.close(); if (this.val$fileDescriptor != null) { try { this.val$fileDescriptor.close(); } catch (IOException e) { } } if (maybeGrayscale != this.val$bitmap) { maybeGrayscale.recycle(); } } else { pdfDocument.writeTo(new FileOutputStream(this.val$fileDescriptor.getFileDescriptor())); pdfDocument.close(); if (this.val$fileDescriptor != null) { try { this.val$fileDescriptor.close(); } catch (IOException e2) { } } if (maybeGrayscale != this.val$bitmap) { maybeGrayscale.recycle(); } } } } } catch (Throwable th2) { th = th2; } return th; } protected void onPostExecute(Throwable throwable) { if (this.val$cancellationSignal.isCanceled()) { this.val$writeResultCallback.onWriteCancelled(); } else if (throwable == null) { WriteResultCallback writeResultCallback = this.val$writeResultCallback; PageRange[] pageRangeArr = new PageRange[PrintHelperKitkat.SCALE_MODE_FIT]; pageRangeArr[0] = PageRange.ALL_PAGES; writeResultCallback.onWriteFinished(pageRangeArr); } else { Log.e(PrintHelperKitkat.LOG_TAG, "Error writing printed content", throwable); this.val$writeResultCallback.onWriteFailed(null); } } } /* renamed from: android.support.v4.print.PrintHelperKitkat.3 */ class C00953 extends PrintDocumentAdapter { private PrintAttributes mAttributes; Bitmap mBitmap; AsyncTask<Uri, Boolean, Bitmap> mLoadBitmap; final /* synthetic */ OnPrintFinishCallback val$callback; final /* synthetic */ int val$fittingMode; final /* synthetic */ Uri val$imageFile; final /* synthetic */ String val$jobName; /* renamed from: android.support.v4.print.PrintHelperKitkat.3.1 */ class C00941 extends AsyncTask<Uri, Boolean, Bitmap> { final /* synthetic */ CancellationSignal val$cancellationSignal; final /* synthetic */ LayoutResultCallback val$layoutResultCallback; final /* synthetic */ PrintAttributes val$newPrintAttributes; final /* synthetic */ PrintAttributes val$oldPrintAttributes; /* renamed from: android.support.v4.print.PrintHelperKitkat.3.1.1 */ class C00931 implements OnCancelListener { C00931() { } public void onCancel() { C00953.this.cancelLoad(); C00941.this.cancel(false); } } C00941(CancellationSignal cancellationSignal, PrintAttributes printAttributes, PrintAttributes printAttributes2, LayoutResultCallback layoutResultCallback) { this.val$cancellationSignal = cancellationSignal; this.val$newPrintAttributes = printAttributes; this.val$oldPrintAttributes = printAttributes2; this.val$layoutResultCallback = layoutResultCallback; } protected void onPreExecute() { this.val$cancellationSignal.setOnCancelListener(new C00931()); } protected Bitmap doInBackground(Uri... uris) { try { return PrintHelperKitkat.this.loadConstrainedBitmap(C00953.this.val$imageFile, PrintHelperKitkat.MAX_PRINT_SIZE); } catch (FileNotFoundException e) { return null; } } protected void onPostExecute(Bitmap bitmap) { super.onPostExecute(bitmap); if (bitmap != null && (!PrintHelperKitkat.this.mPrintActivityRespectsOrientation || PrintHelperKitkat.this.mOrientation == 0)) { MediaSize mediaSize; synchronized (this) { mediaSize = C00953.this.mAttributes.getMediaSize(); } if (!(mediaSize == null || mediaSize.isPortrait() == PrintHelperKitkat.isPortrait(bitmap))) { Matrix rotation = new Matrix(); rotation.postRotate(90.0f); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), rotation, true); } } C00953.this.mBitmap = bitmap; if (bitmap != null) { boolean changed; PrintDocumentInfo info = new Builder(C00953.this.val$jobName).setContentType(PrintHelperKitkat.SCALE_MODE_FIT).setPageCount(PrintHelperKitkat.SCALE_MODE_FIT).build(); if (this.val$newPrintAttributes.equals(this.val$oldPrintAttributes)) { changed = false; } else { changed = true; } this.val$layoutResultCallback.onLayoutFinished(info, changed); } else { this.val$layoutResultCallback.onLayoutFailed(null); } C00953.this.mLoadBitmap = null; } protected void onCancelled(Bitmap result) { this.val$layoutResultCallback.onLayoutCancelled(); C00953.this.mLoadBitmap = null; } } C00953(String str, Uri uri, OnPrintFinishCallback onPrintFinishCallback, int i) { this.val$jobName = str; this.val$imageFile = uri; this.val$callback = onPrintFinishCallback; this.val$fittingMode = i; this.mBitmap = null; } public void onLayout(PrintAttributes oldPrintAttributes, PrintAttributes newPrintAttributes, CancellationSignal cancellationSignal, LayoutResultCallback layoutResultCallback, Bundle bundle) { boolean changed = true; synchronized (this) { this.mAttributes = newPrintAttributes; } if (cancellationSignal.isCanceled()) { layoutResultCallback.onLayoutCancelled(); } else if (this.mBitmap != null) { PrintDocumentInfo info = new Builder(this.val$jobName).setContentType(PrintHelperKitkat.SCALE_MODE_FIT).setPageCount(PrintHelperKitkat.SCALE_MODE_FIT).build(); if (newPrintAttributes.equals(oldPrintAttributes)) { changed = false; } layoutResultCallback.onLayoutFinished(info, changed); } else { this.mLoadBitmap = new C00941(cancellationSignal, newPrintAttributes, oldPrintAttributes, layoutResultCallback).execute(new Uri[0]); } } private void cancelLoad() { synchronized (PrintHelperKitkat.this.mLock) { if (PrintHelperKitkat.this.mDecodeOptions != null) { PrintHelperKitkat.this.mDecodeOptions.requestCancelDecode(); PrintHelperKitkat.this.mDecodeOptions = null; } } } public void onFinish() { super.onFinish(); cancelLoad(); if (this.mLoadBitmap != null) { this.mLoadBitmap.cancel(true); } if (this.val$callback != null) { this.val$callback.onFinish(); } if (this.mBitmap != null) { this.mBitmap.recycle(); this.mBitmap = null; } } public void onWrite(PageRange[] pageRanges, ParcelFileDescriptor fileDescriptor, CancellationSignal cancellationSignal, WriteResultCallback writeResultCallback) { PrintHelperKitkat.this.writeBitmap(this.mAttributes, this.val$fittingMode, this.mBitmap, fileDescriptor, cancellationSignal, writeResultCallback); } } public interface OnPrintFinishCallback { void onFinish(); } PrintHelperKitkat(Context context) { this.mDecodeOptions = null; this.mLock = new Object(); this.mScaleMode = SCALE_MODE_FILL; this.mColorMode = SCALE_MODE_FILL; this.mPrintActivityRespectsOrientation = true; this.mIsMinMarginsHandlingCorrect = true; this.mContext = context; } public void setScaleMode(int scaleMode) { this.mScaleMode = scaleMode; } public int getScaleMode() { return this.mScaleMode; } public void setColorMode(int colorMode) { this.mColorMode = colorMode; } public void setOrientation(int orientation) { this.mOrientation = orientation; } public int getOrientation() { if (this.mOrientation == 0) { return SCALE_MODE_FIT; } return this.mOrientation; } public int getColorMode() { return this.mColorMode; } private static boolean isPortrait(Bitmap bitmap) { if (bitmap.getWidth() <= bitmap.getHeight()) { return true; } return false; } protected PrintAttributes.Builder copyAttributes(PrintAttributes other) { PrintAttributes.Builder b = new PrintAttributes.Builder().setMediaSize(other.getMediaSize()).setResolution(other.getResolution()).setMinMargins(other.getMinMargins()); if (other.getColorMode() != 0) { b.setColorMode(other.getColorMode()); } return b; } public void printBitmap(String jobName, Bitmap bitmap, OnPrintFinishCallback callback) { if (bitmap != null) { MediaSize mediaSize; int fittingMode = this.mScaleMode; PrintManager printManager = (PrintManager) this.mContext.getSystemService("print"); if (isPortrait(bitmap)) { mediaSize = MediaSize.UNKNOWN_PORTRAIT; } else { mediaSize = MediaSize.UNKNOWN_LANDSCAPE; } printManager.print(jobName, new C00911(jobName, fittingMode, bitmap, callback), new PrintAttributes.Builder().setMediaSize(mediaSize).setColorMode(this.mColorMode).build()); } } private Matrix getMatrix(int imageWidth, int imageHeight, RectF content, int fittingMode) { Matrix matrix = new Matrix(); float scale = content.width() / ((float) imageWidth); if (fittingMode == SCALE_MODE_FILL) { scale = Math.max(scale, content.height() / ((float) imageHeight)); } else { scale = Math.min(scale, content.height() / ((float) imageHeight)); } matrix.postScale(scale, scale); matrix.postTranslate((content.width() - (((float) imageWidth) * scale)) / 2.0f, (content.height() - (((float) imageHeight) * scale)) / 2.0f); return matrix; } private void writeBitmap(PrintAttributes attributes, int fittingMode, Bitmap bitmap, ParcelFileDescriptor fileDescriptor, CancellationSignal cancellationSignal, WriteResultCallback writeResultCallback) { PrintAttributes pdfAttributes; if (this.mIsMinMarginsHandlingCorrect) { pdfAttributes = attributes; } else { pdfAttributes = copyAttributes(attributes).setMinMargins(new Margins(0, 0, 0, 0)).build(); } new C00922(cancellationSignal, pdfAttributes, bitmap, attributes, fittingMode, fileDescriptor, writeResultCallback).execute(new Void[0]); } public void printBitmap(String jobName, Uri imageFile, OnPrintFinishCallback callback) throws FileNotFoundException { PrintDocumentAdapter printDocumentAdapter = new C00953(jobName, imageFile, callback, this.mScaleMode); PrintManager printManager = (PrintManager) this.mContext.getSystemService("print"); PrintAttributes.Builder builder = new PrintAttributes.Builder(); builder.setColorMode(this.mColorMode); if (this.mOrientation == SCALE_MODE_FIT || this.mOrientation == 0) { builder.setMediaSize(MediaSize.UNKNOWN_LANDSCAPE); } else if (this.mOrientation == SCALE_MODE_FILL) { builder.setMediaSize(MediaSize.UNKNOWN_PORTRAIT); } printManager.print(jobName, printDocumentAdapter, builder.build()); } private Bitmap loadConstrainedBitmap(Uri uri, int maxSideLength) throws FileNotFoundException { Bitmap bitmap = null; if (maxSideLength <= 0 || uri == null || this.mContext == null) { throw new IllegalArgumentException("bad argument to getScaledBitmap"); } Options opt = new Options(); opt.inJustDecodeBounds = true; loadBitmap(uri, opt); int w = opt.outWidth; int h = opt.outHeight; if (w > 0 && h > 0) { int imageSide = Math.max(w, h); int sampleSize = SCALE_MODE_FIT; while (imageSide > maxSideLength) { imageSide >>>= SCALE_MODE_FIT; sampleSize <<= SCALE_MODE_FIT; } if (sampleSize > 0 && Math.min(w, h) / sampleSize > 0) { Options decodeOptions; synchronized (this.mLock) { this.mDecodeOptions = new Options(); this.mDecodeOptions.inMutable = true; this.mDecodeOptions.inSampleSize = sampleSize; decodeOptions = this.mDecodeOptions; } try { bitmap = loadBitmap(uri, decodeOptions); synchronized (this.mLock) { this.mDecodeOptions = null; } } catch (Throwable th) { synchronized (this.mLock) { } this.mDecodeOptions = null; } } } return bitmap; } private Bitmap loadBitmap(Uri uri, Options o) throws FileNotFoundException { if (uri == null || this.mContext == null) { throw new IllegalArgumentException("bad argument to loadBitmap"); } InputStream is = null; try { is = this.mContext.getContentResolver().openInputStream(uri); Bitmap decodeStream = BitmapFactory.decodeStream(is, null, o); if (is != null) { try { is.close(); } catch (IOException t) { Log.w(LOG_TAG, "close fail ", t); } } return decodeStream; } catch (Throwable th) { if (is != null) { try { is.close(); } catch (IOException t2) { Log.w(LOG_TAG, "close fail ", t2); } } } } private Bitmap convertBitmapForColorMode(Bitmap original, int colorMode) { if (colorMode != SCALE_MODE_FIT) { return original; } Bitmap grayscale = Bitmap.createBitmap(original.getWidth(), original.getHeight(), Config.ARGB_8888); Canvas c = new Canvas(grayscale); Paint p = new Paint(); ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0.0f); p.setColorFilter(new ColorMatrixColorFilter(cm)); c.drawBitmap(original, 0.0f, 0.0f, p); c.setBitmap(null); return grayscale; } }
[ "caesar.tirta@amarbank.co.id" ]
caesar.tirta@amarbank.co.id
b75b118a8884583c86916340a95d066ab1394d79
708ec06f9bee542795dd0d9bd0bb531c4bf93d7b
/app/src/main/java/com/example/android/bakeit/Adapters/StepsAdapter.java
7966d16a1885e7b90f118ca3f47079bfd6a6be38
[]
no_license
DeFBeD/BakeIt
ccc8d883c0beebc51cfee108f645780e20472b8e
aa9c4098abce493331da920d43c054354be8b86b
refs/heads/master
2020-03-22T16:20:24.353423
2018-07-09T15:42:52
2018-07-09T15:42:52
140,308,438
0
0
null
null
null
null
UTF-8
Java
false
false
2,993
java
package com.example.android.bakeit.Adapters; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.android.bakeit.Model.BakingInstructions; import com.example.android.bakeit.R; import java.util.ArrayList; public class StepsAdapter extends RecyclerView.Adapter<StepsAdapter.StepsViewHolder> { private ArrayList<BakingInstructions> mBakingInstructions; private LayoutInflater mInflater; private Context mContext; private sCardClickListener sCardClickListener; public StepsAdapter(Context context) { this.mContext = context; this.mInflater = LayoutInflater.from(context); this.mBakingInstructions = new ArrayList<>(); } public void setTreatsInstructions(ArrayList<BakingInstructions> bakingInstructions) { this.mBakingInstructions.clear(); this.mBakingInstructions.addAll(bakingInstructions); // The adapter needs to know that the data has changed. If we don't call this, app will crash. notifyDataSetChanged(); } @Override public StepsAdapter.StepsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View sView = mInflater.inflate(R.layout.steps_cards, parent, false); final StepsViewHolder sViewHolder = new StepsViewHolder(sView); return sViewHolder; } @Override public void onBindViewHolder(StepsAdapter.StepsViewHolder holder, int position) { BakingInstructions bakingInstructions = mBakingInstructions.get(position); int id = bakingInstructions.getId(); String newId = String.valueOf(id); holder.stepName.setText("Step: " + newId); holder.stepShortDescription.setText(bakingInstructions.getShortDescription()); } @Override public int getItemCount() { return (mBakingInstructions == null) ? 0 : mBakingInstructions.size(); } public class StepsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { TextView stepName; TextView stepShortDescription; public StepsViewHolder(View itemView) { super(itemView); stepName = itemView.findViewById(R.id.step_number); stepShortDescription = itemView.findViewById(R.id.step_short_description); itemView.setOnClickListener(this); } @Override public void onClick(View v) { sCardClickListener.onCardClicked(v, getAdapterPosition()); } } /** * Interface for when recipe in recycler view is clicked */ public interface sCardClickListener { void onCardClicked(View view, int position); } /** * Custom click sCardClickListener */ public void setOnItemClickListener(StepsAdapter.sCardClickListener listener) { this.sCardClickListener = listener; } }
[ "jburgos7705@gmail.com" ]
jburgos7705@gmail.com
e06eebad81ac97d1aafdbfaf355ff396fb25dc96
66ff7c6e8525a0a72b49226cd53bd650bf06ba08
/2.JavaCore/src/com/javarush/task/task13/task1317/Solution.java
aa8d98c6407b08c11d985fcbc44c6c00a15bfa07
[]
no_license
vcvitaly/JavaRushTasks
c6baf8711a404c61047f0b51cad625cb19035a2f
6c456ddcebc50ff3e1eb2924a854bd21d7c54d24
refs/heads/master
2020-03-15T19:57:53.729311
2019-10-24T06:09:17
2019-10-24T06:09:46
132,321,528
1
2
null
null
null
null
UTF-8
Java
false
false
705
java
package com.javarush.task.task13.task1317; /* Погода */ public class Solution { public static void main(String[] args) { System.out.println(new Today(WeatherType.CLOUDY)); System.out.println(new Today(WeatherType.FOGGY)); System.out.println(new Today(WeatherType.FROZEN)); } static class Today implements Weather { private String type; Today(String type) { this.type = type; } @Override public String getWeatherType() { return this.type; } @Override public String toString() { return String.format("%s for today", this.getWeatherType()); } } }
[ "vcvitaly@yahoo.com" ]
vcvitaly@yahoo.com