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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
331428e26243209d4b2f1a1bd6410f030146aa3f | 06d21291bec1e2b58e761a058cc074c4f67c992e | /src/main/java/net/dcatcher/enderius/common/items/ItemEnderSlime.java | 191700f5273353061526b56d06be294bd9bf35ec | [] | no_license | DCatcherMc/ModJam4 | b906226f8cae2e35aaf6e900e4bd67fee75c14f5 | 2f1ad1b9911716bad97e42fbdcff3dcef0b49add | refs/heads/master | 2020-05-18T08:19:39.585476 | 2014-05-18T18:54:31 | 2014-05-18T18:54:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,055 | java | package net.dcatcher.enderius.common.items;
import net.dcatcher.enderius.Enderius;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
* Copyright: DCatcher
*/
public class ItemEnderSlime extends Item {
NBTTagCompound data;
int id;
public ItemEnderSlime(){
super();
setUnlocalizedName("enderSlime");
setCreativeTab(Enderius.danTab);
}
@Override
public void registerIcons(IIconRegister par1IconRegister) {
this.itemIcon = par1IconRegister.registerIcon("enderius:enderslime");
}
public void setData(NBTTagCompound nbt,int id){
this.data = nbt;
this.id = id;
}
public NBTTagCompound getData(){
return data;
}
public void storeNBT(ItemStack stack, Entity entity){
NBTTagCompound entityData = entity.getEntityData();
}
public int getID(){
return id;
}
}
| [
"daniel.catchpole@live.com"
] | daniel.catchpole@live.com |
baea8912475097ca38bb2bd7233cc4201e2d066b | e7b9397719ca401e8792d38b77c1fdff520de8b2 | /lab02-partes/src/prodPlan/ParteEspecifica.java | c09f6fca3d774c6a10d23d86f31dc6b2b9a042c2 | [] | no_license | sabrina-beck/mc302 | 7319322a58ab97628d62cbb1a1b4a5269860612b | ee2d60ad7912ad7277d5d6a8525ab7639f5f9050 | refs/heads/master | 2021-03-22T04:03:24.691157 | 2015-06-13T14:10:31 | 2015-06-13T14:10:31 | 32,121,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,315 | java | package prodPlan;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ParteEspecifica extends Parte {
private Map<String, Caracteristica> caracteristicas;
public ParteEspecifica(int codigo, String nome, String descricao,
float valor) {
super(codigo, nome, descricao, valor);
this.caracteristicas = new HashMap<>();
}
public void agregaCaracteristica(String nome, String conteudo) throws IllegalArgumentException {
if(nome == null || conteudo == null || this.caracteristicas.containsKey(nome)) {
throw new IllegalArgumentException();
}
this.caracteristicas.put(nome, new Caracteristica(nome, conteudo));
}
public String caracteristica(String nome) {
if(!this.caracteristicas.containsKey(nome))
return null;
return this.caracteristicas.get(nome).conteudo;
}
public List<Caracteristica> listaDeCaracteristicas() {
return (List<Caracteristica>) this.caracteristicas.values();
}
@Override
public Object accept(ProdPlanVisitor visitor) {
return visitor.visit(this);
}
@Override
public float calculaValor() {
return this.valor;
}
@Override
public String toString() {
String str = super.asString();
for(Caracteristica caracteristica : this.caracteristicas.values()) {
str += "\n.." + caracteristica;
}
return str;
}
}
| [
"sabrinabeck.96@gmail.com"
] | sabrinabeck.96@gmail.com |
81d508e62777e28fe781050c2e2e9154aff0537b | b924911beaa07c475eb38a1e18186f01c38be7fb | /src/silberchatz/cap4/ipc2/Channel.java | b50d9eeccd00917e281964fe4343548d3eea972e | [] | no_license | ricdtaveira/Silbershatz | 3f80374429a58d107e0a831906b0c64431c123b0 | b2a97615c98e4a611ff459d2fc6973e94be69f48 | refs/heads/master | 2021-05-16T04:10:26.021176 | 2017-10-05T12:49:18 | 2017-10-05T12:49:18 | 105,823,363 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 626 | java | package silberchatz.cap4.ipc2;
/**
* An interface for a message passing scheme.
*
* Figure 4.13
*
* @author Gagne, Galvin, Silberschatz
* Operating System Concepts with Java - Sixth Edition
* Copyright John Wiley & Sons - 2003.
*/
public interface Channel
{
/**
* Send a message to the channel.
* It is possible that this method may or may not block.
*/
public abstract void send(Object message);
/**
* Receive a message from the channel
* It is possible that this method may or may not block.
*/
public abstract Object receive();
}
| [
"ricdtaveira@gmail.com"
] | ricdtaveira@gmail.com |
78e767417d63b7fc2205fb9754e1f3ec7267f477 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_14bd825ee9babb62e7ff1bcab69f2bc5349809bd/Node/11_14bd825ee9babb62e7ff1bcab69f2bc5349809bd_Node_s.java | 4d2490089cb3de9ead9eb6448450fccd955ad0a7 | [] | 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 | 3,938 | java | /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is part of dcm4che, an implementation of DICOM(TM) in
* Java(TM), hosted at https://github.com/dcm4che.
*
* The Initial Developer of the Original Code is
* Agfa Healthcare.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* See @authors listed below
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
package org.dcm4che.jdbc.prefs.entity;
import java.util.Collection;
import java.util.HashSet;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
/**
* @author Michael Backhaus <michael.backhaus@agfa.com>
*/
@NamedQueries({
@NamedQuery(name = "Node.getChildren", query = "SELECT n from Node n LEFT JOIN FETCH n.attributes where n.parentNode = ?1"),
@NamedQuery(name = "Node.getRootNode", query = "SELECT n from Node n where n.name = 'rootNode'") })
@Entity
@Table(name = "node")
public class Node {
public static final String GET_CHILDREN = "Node.getChildren";
public static final String GET_ROOT_NODE = "Node.getRootNode";
@Id
@GeneratedValue
private int pk;
@Basic(optional = false)
@Index(name = "node_name_idx")
private String name;
@ManyToOne
@JoinColumn(name = "parent_pk")
@OnDelete(action = OnDeleteAction.CASCADE)
private Node parentNode;
@OneToMany(mappedBy = "node")
@OnDelete(action = OnDeleteAction.CASCADE)
private Collection<Attribute> attributes = new HashSet<Attribute>();
public int getPk() {
return pk;
}
public void setPk(int pk) {
this.pk = pk;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Node getParentNode() {
return parentNode;
}
public void setParentNode(Node parent) {
this.parentNode = parent;
}
public Collection<Attribute> getAttributes() {
return attributes;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
d8aa5b102a7e10d015b315f32f000a9294e43045 | 6a2f63d971fd5ce988c10cdc2401aae3ba5e0fee | /net/minecraft/network/play/server/S19PacketEntityStatus.java | 491622b623c57fe54b4ea290be59a3fce6c75ea7 | [
"MIT"
] | permissive | MikeWuang/hawk-client | 22d0d723b70826f74d91f0928384513a419592c1 | 7f62687c62709c595e2945d71678984ba1b832ea | refs/heads/main | 2023-04-05T19:50:35.459096 | 2021-04-28T00:52:19 | 2021-04-28T00:52:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,403 | java | package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.entity.Entity;
import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.world.World;
public class S19PacketEntityStatus implements Packet {
private int field_149164_a;
private static final String __OBFID = "CL_00001299";
private byte field_149163_b;
public void writePacketData(PacketBuffer var1) throws IOException {
var1.writeInt(this.field_149164_a);
var1.writeByte(this.field_149163_b);
}
public S19PacketEntityStatus(Entity var1, byte var2) {
this.field_149164_a = var1.getEntityId();
this.field_149163_b = var2;
}
public void readPacketData(PacketBuffer var1) throws IOException {
this.field_149164_a = var1.readInt();
this.field_149163_b = var1.readByte();
}
public S19PacketEntityStatus() {
}
public Entity func_149161_a(World var1) {
return var1.getEntityByID(this.field_149164_a);
}
public void func_180736_a(INetHandlerPlayClient var1) {
var1.handleEntityStatus(this);
}
public void processPacket(INetHandler var1) {
this.func_180736_a((INetHandlerPlayClient)var1);
}
public byte func_149160_c() {
return this.field_149163_b;
}
}
| [
"omadude420@gmail.com"
] | omadude420@gmail.com |
c7fbc3b4fd85479a0ac7076cb6d084950544a3ab | 3952d2c7fb51301b08374428447fa32cd7ad8b2a | /spring-cloud-product/product-client/src/main/java/com/geny/product/client/ProductClient.java | 0018327f256c3e051b46ac88770dc4659dd49e04 | [] | no_license | shmilyah/spring-cloud-sell | c76aabcf0180d8030840d67e8a7d35f04a87184b | 9b0c1963608aced440e50f4c3315bb3f5f7d86e9 | refs/heads/master | 2020-03-22T07:56:36.933422 | 2018-07-07T06:15:09 | 2018-07-07T06:15:09 | 139,734,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package com.geny.product.client;
import com.geny.product.common.DecreaseStockInput;
import com.geny.product.common.ProductInfoOutput;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* @author shmilyahu
* @date 2018/6/16 14:19
*/
@FeignClient("spring-cloud-product")
public interface ProductClient {
@PostMapping("/product/listForOrder")
List<ProductInfoOutput> listForOrder(@RequestBody List<String> productIdList);
@PostMapping("/product/decreaseStock")
void decreaseStock(@RequestBody List<DecreaseStockInput> decreaseStockInputList);
}
| [
"hubo89@126.com"
] | hubo89@126.com |
e73bb314ac01e27849db0d40e3e0ab534a75c1bf | 17c30fed606a8b1c8f07f3befbef6ccc78288299 | /P9_8_0_0/src/main/java/com/huawei/android/pushselfshow/richpush/tools/c.java | 6eb8dd396f38f2b667a60b929505dd28e3218c32 | [] | no_license | EggUncle/HwFrameWorkSource | 4e67f1b832a2f68f5eaae065c90215777b8633a7 | 162e751d0952ca13548f700aad987852b969a4ad | refs/heads/master | 2020-04-06T14:29:22.781911 | 2018-11-09T05:05:03 | 2018-11-09T05:05:03 | 157,543,151 | 1 | 0 | null | 2018-11-14T12:08:01 | 2018-11-14T12:08:01 | null | UTF-8 | Java | false | false | 5,693 | java | package com.huawei.android.pushselfshow.richpush.tools;
import android.content.Context;
import com.huawei.android.pushselfshow.utils.a;
import java.io.File;
import java.io.FileOutputStream;
public class c {
private String a;
private Context b;
public c(Context context, String str) {
this.a = str;
this.b = context;
}
private String b() {
return "<!DOCTYPE html>\t\t<html>\t\t <head>\t\t <meta charset=\"utf-8\">\t\t <title></title>\t\t <style type=\"text/css\">\t\t\t\t html { height:100%;}\t\t\t\t body { height:100%; text-align:center;}\t \t .centerDiv { display:inline-block; zoom:1; *display:inline; vertical-align:top; text-align:left; width:200px; padding:10px;margin-top:100px;}\t\t\t .hiddenDiv { height:100%; overflow:hidden; display:inline-block; width:1px; overflow:hidden; margin-left:-1px; zoom:1; *display:inline; *margin-top:-1px; _margin-top:0; vertical-align:middle;}\t\t \t</style> \t </head>\t\t <body>\t\t\t<div id =\"container\" class=\"centerDiv\">";
}
private String c() {
return "\t\t</div> \t\t<div class=\"hiddenDiv\"></div>\t </body> </html>";
}
public String a() {
Throwable -l_7_R;
Object -l_10_R;
FileOutputStream -l_1_R = null;
if (this.b != null) {
Object -l_2_R = b() + this.a + c();
Object -l_3_R = this.b.getFilesDir().getPath() + File.separator + "PushService" + File.separator + "richpush";
Object -l_4_R = "error.html";
Object -l_5_R = new File(-l_3_R);
File -l_6_R = new File(-l_3_R + File.separator + -l_4_R);
try {
if (!-l_5_R.exists()) {
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "Create the path:" + -l_3_R);
if (!-l_5_R.mkdirs()) {
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "!path.mkdirs()");
if (-l_1_R != null) {
try {
-l_1_R.close();
} catch (Throwable -l_8_R) {
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "stream.close() error ", -l_8_R);
}
}
return null;
}
}
if (-l_6_R.exists()) {
a.a(-l_6_R);
}
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "Create the file:" + -l_4_R);
if (-l_6_R.createNewFile()) {
FileOutputStream -l_1_R2 = new FileOutputStream(-l_6_R);
try {
-l_1_R2.write(-l_2_R.getBytes("UTF-8"));
if (-l_1_R2 != null) {
try {
-l_1_R2.close();
} catch (Throwable -l_7_R2) {
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "stream.close() error ", -l_7_R2);
}
}
return -l_6_R.getAbsolutePath();
} catch (Exception e) {
-l_7_R2 = e;
-l_1_R = -l_1_R2;
try {
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "Create html error ", -l_7_R2);
if (-l_1_R != null) {
try {
-l_1_R.close();
} catch (Throwable -l_9_R) {
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "stream.close() error ", -l_9_R);
}
}
return null;
} catch (Throwable th) {
-l_10_R = th;
if (-l_1_R != null) {
try {
-l_1_R.close();
} catch (Throwable -l_11_R) {
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "stream.close() error ", -l_11_R);
}
}
throw -l_10_R;
}
} catch (Throwable th2) {
-l_10_R = th2;
-l_1_R = -l_1_R2;
if (-l_1_R != null) {
-l_1_R.close();
}
throw -l_10_R;
}
}
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "!file.createNewFile()");
if (-l_1_R != null) {
try {
-l_1_R.close();
} catch (Throwable -l_8_R2) {
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "stream.close() error ", -l_8_R2);
}
}
return null;
} catch (Exception e2) {
-l_7_R2 = e2;
com.huawei.android.pushagent.a.a.c.a("PushSelfShowLog", "Create html error ", -l_7_R2);
if (-l_1_R != null) {
-l_1_R.close();
}
return null;
}
}
com.huawei.android.pushagent.a.a.c.d("PushSelfShowLog", "CreateHtmlFile fail ,context is null");
return null;
}
}
| [
"lygforbs0@mail.com"
] | lygforbs0@mail.com |
dfd285ac6f8c40db476ce269f45dfaf46350f4aa | b238bfa66d8b0c376da38fae6c486ac43c248b22 | /app/src/main/java/com/xj/makemoney/view/TabLayout.java | 16728ff6b0cbf72ea4cbe8577d3c285f032144c7 | [] | no_license | android-xujie/makemoney | 19d2d3ea62d7f3899cf6aa654335a2ef49172322 | 90ce504b23fd097554d1686f78d5d940be7183fd | refs/heads/master | 2020-03-17T20:39:43.673996 | 2018-05-18T08:36:24 | 2018-05-18T08:36:24 | 133,922,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,970 | java | package com.xj.makemoney.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.xj.makemoney.R;
import java.util.ArrayList;
import java.util.List;
/**
* Created by e on 2016/12/30.
*/
public class TabLayout extends LinearLayout implements View.OnClickListener {
private List<TabItem> items = new ArrayList<>();
private FragmentManager manager;
private List<Fragment> fragments;
private int currentTab;
private int textSelectColor;
private int textUnSelectColor;
public TabLayout(Context context) {
super(context, null);
}
public TabLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.TabLayout, defStyleAttr, 0);
textSelectColor = a.getColor(R.styleable.TabLayout_textSelectColor, 0);
textUnSelectColor = a.getColor(R.styleable.TabLayout_textUnSelectColor, 0);
}
public void addTab(String title, int selectedIcon, int unSelectedIcon, int position) {
TabItem item = new TabItem(title, selectedIcon, unSelectedIcon);
ViewGroup child = (ViewGroup) getChildAt(position);
child.setTag(item);
child.setOnClickListener(this);
item.iv = (ImageView) child.getChildAt(0);
item.tv = (TextView) child.getChildAt(1);
item.iv.setImageResource(unSelectedIcon);
item.tv.setTextColor(textUnSelectColor);
item.tv.setText(title);
items.add(item);
}
public void setTabData(FragmentManager manager, int containerViewId, List<Fragment> fragments) {
this.manager = manager;
this.fragments = fragments;
FragmentTransaction transaction = manager.beginTransaction();
for (Fragment fragment : fragments) {
if (fragment != null)
transaction.add(containerViewId, fragment).hide(fragment);
}
transaction.commit();
setCurrentTab(0);
}
public void setCurrentTab(int currentTab) {
if (fragments.get(currentTab) != null) {
manager.beginTransaction().hide(fragments.get(this.currentTab)).show(fragments.get(currentTab)).commit();
TabItem item = items.get(this.currentTab);
item.iv.setImageResource(item.unSelectedIcon);
item.tv.setTextColor(textUnSelectColor);
this.currentTab = currentTab;
item = items.get(this.currentTab);
item.iv.setImageResource(item.selectedIcon);
item.tv.setTextColor(textSelectColor);
}
}
public void setOnTabSelectListener(OnTabSelectListener listener) {
this.listener = listener;
}
public static class TabItem {
public String title;
public int selectedIcon;
public int unSelectedIcon;
public ImageView iv;
public TextView tv;
public TabItem(String title, int selectedIcon, int unSelectedIcon) {
this.title = title;
this.selectedIcon = selectedIcon;
this.unSelectedIcon = unSelectedIcon;
}
}
@Override
public void onClick(View v) {
TabItem item = (TabItem) v.getTag();
int position = items.indexOf(item);
setCurrentTab(position);
if (listener != null)
listener.onTabSelect(position);
}
private OnTabSelectListener listener;
public interface OnTabSelectListener {
void onTabSelect(int position);
}
}
| [
"jxu@iyunwen.com"
] | jxu@iyunwen.com |
16f9cf59ea0bb2cb9f9e5123b969d053b0c4a9b9 | b8a7766456a760c3afb039a7a5c2e65e792a6a89 | /ASE/SourceCode/GroceryPedia/src/com/example/grocerypedia/ParseXML.java | 234b7fcdef8c287508e3f183b4d0b11e949011c2 | [] | no_license | jagadishtirumalasetty/Projects | 5a8fa4b003d55f1aafeca2c2f6bba5b5fd04e91f | fbc1a8030f69c05c773f2847ae66fd87adb2ba3b | refs/heads/master | 2020-05-16T09:05:44.334874 | 2014-10-27T20:34:37 | 2014-10-27T20:34:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,776 | java | package com.example.grocerypedia;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;
public class ParseXML {
private String storeName;
private String streetAddress;
private String city;
private String state;
private String storeId;
private String urlString;
private ArrayList<StoreAndLocation> list;
private XmlPullParserFactory xmlFactoryObject;
public volatile boolean isParsed = true;
public ArrayList<StoreAndLocation> getList() {
return list;
}
public ParseXML(String url){
this.urlString = url;
}
public String getStoreName() {
return storeName;
}
public String getStreetAddress() {
return streetAddress;
}
public String getCity() {
return city;
}
public String getState() {
return state;
}
public String getStoreId() {
return storeId;
}
public void getXML(){
Thread thread = new Thread(new Runnable(){
@Override
public void run() {
try {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection)
url.openConnection();
conn.setReadTimeout(10000); /* milliseconds */
conn.setConnectTimeout(15000); /* milliseconds */
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.connect();
InputStream stream = conn.getInputStream();
xmlFactoryObject = XmlPullParserFactory.newInstance();
XmlPullParser myparser = xmlFactoryObject.newPullParser();
myparser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES
, false);
myparser.setInput(stream, null);
parseXMLAndStoreIt(myparser);
stream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
});
thread.start();
}
public void parseXMLAndStoreIt(XmlPullParser myParser) {
StoreAndLocation store = null;
int event;
try {
event = myParser.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
String name=myParser.getName();
switch (event){
case XmlPullParser.START_DOCUMENT:
list= new ArrayList<StoreAndLocation>();
case XmlPullParser.START_TAG:
name= myParser.getName();
if(name == "Store"){
store = new StoreAndLocation();
}else if(store != null){
if(name == "Storename"){
store.eStoreName = myParser.nextText();
}else if(name == "Address"){
store.eAddress = myParser.nextText();
}else if(name == "City"){
store.eCity = myParser.nextText();
}else if(name == "State"){
store.eState = myParser.nextText();
}else if(name == "StoreId"){
store.eStoreId = myParser.nextText();
}
}
case XmlPullParser.END_TAG:
name = myParser.getName();
if(name.equalsIgnoreCase("Store") && store != null){
list.add(store);
}
}
event = myParser.next();
}
isParsed = false;
} catch (Exception e) {
e.printStackTrace();
}
}
class StoreAndLocation {
String eStoreName;
String eAddress;
String eCity;
String eState;
String eStoreId;
}
}
| [
"jagadish071@gmail.com"
] | jagadish071@gmail.com |
e6d7e212f3455eac6b16eec246e355d0a90b5ff3 | 0a751a4951fc773fb57b6d5cafc4a024a79c480e | /src/main/java/org/flyak/api/dto/TokenResponse.java | 04d9b9f4deec381ab85861f4edb57d44b1600f03 | [
"MIT"
] | permissive | nzvirtual/org.flyak.api | 76cf30e39171853bc7f5f4abbca701f81e6f69eb | 2ffa51cc63be8222a9c0d50fe6d1a59b4262cba3 | refs/heads/master | 2022-11-06T15:41:40.782138 | 2020-04-26T06:34:30 | 2020-04-26T06:34:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package org.flyak.api.dto;
public class TokenResponse {
private String token;
private String type = "Bearer";
private String username;
public TokenResponse(String token, String type, String username) {
this.token = token;
this.type = type;
this.username = username;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
| [
"daniel@hawton.org"
] | daniel@hawton.org |
5c1fc546feee8a88594ae8634ec3369e18901c31 | dc2a27f72932ac5229e6331ee1a6393cdcf7d52d | /src/main/java/org/jfrog/buildinfo/utils/Utils.java | 2a008c276b4233814df74846817630765e0a1c50 | [
"Apache-2.0"
] | permissive | yahavi/artifactory-maven-plugin-old | ce9c5cf8c30d4a1527489aff988bad82cb233803 | 8aaa19b5742151783fe1f6774c092282c4e94006 | refs/heads/master | 2022-12-12T23:12:17.600912 | 2020-09-10T15:50:56 | 2020-09-10T15:50:56 | 288,466,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,178 | java | package org.jfrog.buildinfo.utils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.Maven;
import org.apache.maven.plugin.logging.Log;
import org.jfrog.build.api.BaseBuildFileBean;
import org.jfrog.build.api.util.FileChecksumCalculator;
import org.jfrog.buildinfo.ArtifactoryMojo;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Stream;
/**
* @author yahavi
*/
public class Utils {
/**
* Set md5 and sha1 for the input file.
*
* @param file - The file to calculate the checksums
* @param buildFile - Dependency or Artifact
* @param logger - The logger
*/
public static void setChecksums(File file, BaseBuildFileBean buildFile, Log logger) {
if (!isFile(file)) {
return;
}
try {
Map<String, String> checksumsMap = FileChecksumCalculator.calculateChecksums(file, "md5", "sha1");
buildFile.setMd5(checksumsMap.get("md5"));
buildFile.setSha1(checksumsMap.get("sha1"));
} catch (NoSuchAlgorithmException | IOException e) {
logger.error("Could not set checksum values on '" + buildFile.getLocalPath() + "': " + e.getMessage(), e);
}
}
/**
* Get running Maven version.
*
* @param currentClass - The caller class
* @return the Maven version
*/
@SuppressWarnings("rawtypes")
public static String getMavenVersion(Class currentClass) {
// Get Maven version from this class
Properties mavenVersionProperties = new Properties();
try (InputStream inputStream = currentClass.getClassLoader().getResourceAsStream("org/apache/maven/messages/build.properties")) {
if (inputStream != null) {
mavenVersionProperties.load(inputStream);
}
} catch (IOException e) {
throw new RuntimeException("Error while extracting Maven version properties from: org/apache/maven/messages/build.properties", e);
}
// Get Maven version from Maven core class
if (mavenVersionProperties.isEmpty()) {
try (InputStream inputStream = Maven.class.getClassLoader().getResourceAsStream("META-INF/maven/org.apache.maven/maven-core/pom.properties")) {
if (inputStream != null) {
mavenVersionProperties.load(inputStream);
}
} catch (IOException e) {
throw new RuntimeException("Error while extracting Maven version properties from: META-INF/maven/org.apache.maven/maven-core/pom.properties", e);
}
}
if (mavenVersionProperties.isEmpty()) {
throw new RuntimeException("Could not extract Maven version: unable to find resources 'org/apache/maven/messages/build.properties' or 'META-INF/maven/org.apache.maven/maven-core/pom.properties'");
}
String version = mavenVersionProperties.getProperty("version");
if (StringUtils.isBlank(version)) {
throw new RuntimeException("Could not extract Maven version: no version property found in the resource 'org/apache/maven/messages/build.properties' or or 'META-INF/maven/org.apache.maven/maven-core/pom.properties'");
}
return version;
}
/**
* Get the Artifactory Maven plugin version.
*
* @return the plugin's version
*/
public static String getPluginVersion() {
try (InputStream inputStream = ArtifactoryMojo.class.getClassLoader().getResourceAsStream("META-INF/maven/org.jfrog.buildinfo/artifactory-maven-plugin/plugin-help.xml")) {
if (inputStream != null) {
try (Stream<String> lines = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)).lines()) {
String version = lines.filter(line -> line.contains("<version>")).findFirst().orElse("");
return StringUtils.substringBetween(version, "<version>", "</version>");
}
}
} catch (IOException e) {
// Ignore
}
return null;
}
/**
* Get the artifact name in form of 'artifactId-version-classifier.extension' or 'artifactId-version.extension'
*
* @param artifactId - The artifact ID
* @param version - The artifact version
* @param classifier - The classifier
* @param fileExtension - The extension of the file
* @return the artifact name
*/
public static String getArtifactName(String artifactId, String version, String classifier, String fileExtension) {
String name = artifactId + "-" + version;
if (StringUtils.isNotBlank(classifier)) {
name += "-" + classifier;
}
return name + "." + fileExtension;
}
/**
* Get the layout path in artifactory to deploy.
*
* @param groupId - The group ID
* @param artifactId - The artifact ID
* @param version - The version
* @param classifier - The classifier
* @param fileExtension - The extension of the file
* @return deployment path
*/
public static String getDeploymentPath(String groupId, String artifactId, String version, String classifier, String fileExtension) {
return String.join("/", groupId.replace(".", "/"), artifactId, version, getArtifactName(artifactId, version, classifier, fileExtension));
}
/**
* Get extension of the input file.
*
* @param file - The file
* @return extension of the input file
*/
public static String getFileExtension(File file) {
if (file == null) {
return StringUtils.EMPTY;
}
return FilenameUtils.getExtension(file.getName());
}
/**
* Return true if the input File is actually a file.
*
* @param file - The file to check
* @return true if the input File is actually a file
*/
public static boolean isFile(File file) {
return file != null && file.isFile();
}
}
| [
"yahavi@jfrog.com"
] | yahavi@jfrog.com |
5dbcf0cdfc6a88c1c74db6112af42daeecf2fd47 | dc583989d45fcee44b4e78a3a660ffa5fec7823d | /src/main/java/com/ln/film/exception/ServiceException.java | 79a87c684b6ae316b980c4fa9ad07e1d53527335 | [] | no_license | a18811758128/film | b493b698949f981c1bc01878b61db0320f0ddf67 | 0b572a057119cf887b6455eee1277cbd57230dae | refs/heads/master | 2022-12-27T05:06:54.720285 | 2020-07-17T08:02:55 | 2020-07-17T08:02:55 | 86,956,486 | 0 | 0 | null | 2022-12-16T01:54:32 | 2017-04-02T02:11:10 | JavaScript | UTF-8 | Java | false | false | 3,314 | java | package com.ln.film.exception;
/**
* Generic service exception
*
*/
public class ServiceException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Constructs a new runtime exception with {@code null} as its
* detail message. The cause is not initialized, and may subsequently be
* initialized by a call to {@link #initCause}.
*/
public ServiceException() {
super();
}
/**
* Constructs a new runtime exception with the specified detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public ServiceException(String message) {
super(message);
}
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new runtime exception with the specified cause and a
* detail message of <tt>(cause==null ? null : cause.toString())</tt>
* (which typically contains the class and detail message of
* <tt>cause</tt>). This constructor is useful for runtime exceptions
* that are little more than wrappers for other throwables.
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public ServiceException(Throwable cause) {
super(cause);
}
/**
* Constructs a new runtime exception with the specified detail
* message, cause, suppression enabled or disabled, and writable
* stack trace enabled or disabled.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @param enableSuppression whether or not suppression is enabled
* or disabled
* @param writableStackTrace whether or not the stack trace should
* be writable
* @since 1.7
*/
protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"18811758128@163.com"
] | 18811758128@163.com |
ab9733c7cdead74614ec04354f9e6371aac06676 | 42866e55dbb6d9d795ee16aa36369ba13ceba9f8 | /src/main/java/com/test/gogo/configuration/ConfigBean.java | c70dbcb514787ccc4c7b48b8706a8b7de34fbb45 | [] | no_license | 648539234/happy | 6a5911885ec09f1410a641e5da3979f83633d995 | 134208779a34d343d6dd8bdcd50ed615c86c0787 | refs/heads/master | 2022-09-01T11:18:46.037149 | 2020-06-02T01:46:23 | 2020-06-02T01:46:23 | 267,475,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.test.gogo.configuration;
import com.test.gogo.Proxy.Demo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Auther: WuYuXiang
* @Date: 2020/1/10
* @Description: com.test.gogo.configuration
* @version: 1.0
*/
@Configuration
public class ConfigBean {
ConfigBean(){
System.out.println("你吗炸了");
}
@Bean(initMethod = "init",destroyMethod = "destroy")
public Demo getBean(Another demo){
String go = "fuck";
return new Demo(go);
}
}
| [
"648539234@qq.com"
] | 648539234@qq.com |
f9178d1c867129c0a6a6e7a3cb448f55db9fcd1d | 098da9f9a5e01e3cc61f527941c615c25bcc476b | /src/main/java/com/core/impl/Inter1.java | 3c5156fea34d954617a0368a735287553307c1ae | [] | no_license | ganamadu/CoreEx | c6bf6c003fb2ce41285569413c936a5f29223134 | e73b450548b9492036bba4ae291b1001bf36db2b | refs/heads/master | 2023-04-28T05:29:48.484282 | 2021-05-13T16:42:47 | 2021-05-13T16:42:47 | 357,593,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package com.core.impl;
public interface Inter1 {
public void show();
public default void message() {
System.out.println("Inter2 method");
}
}
| [
"ganapathi.madu@gmail.com"
] | ganapathi.madu@gmail.com |
a3d96962fc2b3bfff612a221b8246d14e42b32b6 | d579b25070df5010c6f04c26928354cbc2f067ef | /benchmarks/generation/sling_4982/qpid-6687/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java | ab2a5195cf5d9be50ef212d20695d25b219c572e | [] | no_license | Spirals-Team/itzal-experiments | b9714f7a340ef9a2e4e748b5b723789592ea1cd5 | 87be2e8c554462ef38e7574dbdd5b28dadb52421 | refs/heads/master | 2022-04-07T22:45:06.765973 | 2020-03-03T06:18:03 | 2020-03-03T06:18:03 | 113,832,374 | 0 | 0 | null | 2020-03-03T06:18:05 | 2017-12-11T08:26:25 | null | UTF-8 | Java | false | false | 8,489 | 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.qpid.server.exchange;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.qpid.server.binding.BindingImpl;
import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.filter.MessageFilter;
import org.apache.qpid.server.message.AMQMessageHeader;
/**
* Defines binding and matching based on a set of headers.
*/
class HeadersBinding
{
private static final Logger _logger = LoggerFactory.getLogger(HeadersBinding.class);
private final Map<String,Object> _mappings;
private final BindingImpl _binding;
private final Set<String> required = new HashSet<String>();
private final Map<String,Object> matches = new HashMap<String,Object>();
private boolean matchAny;
private FilterManager _filter;
/**
* Creates a header binding for a set of mappings. Those mappings whose value is
* null or the empty string are assumed only to be required headers, with
* no constraint on the value. Those with a non-null value are assumed to
* define a required match of value.
*
* @param binding the binding to create a header binding using
*/
public HeadersBinding(BindingImpl binding)
{
_binding = binding;
if(_binding !=null)
{
Map<String, Object> arguments = _binding.getArguments();
_mappings = arguments == null ? Collections.<String,Object>emptyMap() : arguments;
initMappings();
}
else
{
_mappings = null;
}
}
private void initMappings()
{
if(FilterSupport.argumentsContainFilter(_mappings))
{
try
{
_filter = FilterSupport.createMessageFilter(_mappings,_binding.getAMQQueue());
}
catch (AMQInvalidArgumentException e)
{
_logger.warn("Invalid filter in binding queue '"+_binding.getAMQQueue().getName()
+"' to exchange '"+_binding.getExchange().getName()
+"' with arguments: " + _binding.getArguments());
_filter = new FilterManager();
_filter.add("x-exclude-all",new MessageFilter()
{
@Override
public String getName()
{
return "";
}
@Override
public boolean startAtTail()
{
return false;
}
@Override
public boolean matches(Filterable message)
{
return false;
}
});
}
}
for(Map.Entry<String, Object> entry : _mappings.entrySet())
{
String propertyName = entry.getKey();
Object value = entry.getValue();
if (isSpecial(propertyName))
{
processSpecial(propertyName, value);
}
else if (value == null || value.equals(""))
{
required.add(propertyName);
}
else
{
matches.put(propertyName,value);
}
}
}
public BindingImpl getBinding()
{
return _binding;
}
/**
* Checks whether the supplied headers match the requirements of this binding
* @param headers the headers to check
* @return true if the headers define any required keys and match any required
* values
*/
public boolean matches(AMQMessageHeader headers)
{
if(headers == null)
{
return required.isEmpty() && matches.isEmpty();
}
else
{
return matchAny ? or(headers) : and(headers);
}
}
public boolean matches(Filterable message)
{
return matches(message.getMessageHeader()) && (_filter == null || _filter.allAllow(message));
}
private boolean and(AMQMessageHeader headers)
{
if(headers.containsHeaders(required))
{
for(Map.Entry<String, Object> e : matches.entrySet())
{
if(!e.getValue().equals(headers.getHeader(e.getKey())))
{
return false;
}
}
return true;
}
else
{
return false;
}
}
private boolean or(final AMQMessageHeader headers)
{
if(required.isEmpty())
{
return matches.isEmpty() || passesMatchesOr(headers);
}
else
{
if(!passesRequiredOr(headers))
{
return !matches.isEmpty() && passesMatchesOr(headers);
}
else
{
return true;
}
}
}
private boolean passesMatchesOr(AMQMessageHeader headers)
{
for(Map.Entry<String,Object> entry : matches.entrySet())
{
if(headers.containsHeader(entry.getKey())
&& ((entry.getValue() == null && headers.getHeader(entry.getKey()) == null)
|| (entry.getValue().equals(headers.getHeader(entry.getKey())))))
{
return true;
}
}
return false;
}
private boolean passesRequiredOr(AMQMessageHeader headers)
{
for(String name : required)
{
if(headers.containsHeader(name))
{
return true;
}
}
return false;
}
private void processSpecial(String key, Object value)
{
if("X-match".equalsIgnoreCase(key))
{
matchAny = isAny(value);
}
else
{
_logger.warn("Ignoring special header: " + key);
}
}
private boolean isAny(Object value)
{
if(value instanceof String)
{
if("any".equalsIgnoreCase((String) value))
{
return true;
}
if("all".equalsIgnoreCase((String) value))
{
return false;
}
}
_logger.warn("Ignoring unrecognised match type: " + value);
return false;//default to all
}
static boolean isSpecial(Object key)
{
return key instanceof String && isSpecial((String) key);
}
static boolean isSpecial(String key)
{
return key.startsWith("X-") || key.startsWith("x-");
}
@Override
public boolean equals(final Object o)
{
if (this == o)
{
return true;
}
if (o == null)
{
return false;
}
if (!(o instanceof HeadersBinding))
{
return false;
}
final HeadersBinding hb = (HeadersBinding) o;
if(_binding == null)
{
if(hb.getBinding() != null)
{
return false;
}
}
else if (!_binding.equals(hb.getBinding()))
{
return false;
}
return true;
}
@Override
public int hashCode()
{
return _binding == null ? 0 : _binding.hashCode();
}
}
| [
"martin.monperrus@gnieh.org"
] | martin.monperrus@gnieh.org |
3fabfb2222233b5e7b6efdfe96250041475f9b5e | 7475ac6b7bcdfd0a86648ba1bd2f34f1d3d7ff09 | /esshop/src/main/java/com/shopping/core/constant/Globals.java | a0b91844bbbfaa0ea2b6e1b0f5291279d13d41f0 | [] | no_license | K-Darker/esshop | 736073adfdf828bfe069257ffaddac8cec0b1b7f | 9cc1a11e13d265e6b78ec836232f726a41c21b7d | refs/heads/master | 2021-09-08T05:04:41.067994 | 2018-03-07T09:47:16 | 2018-03-07T09:47:40 | 123,759,831 | 6 | 6 | null | null | null | null | UTF-8 | Java | false | false | 2,248 | java | package com.shopping.core.constant;
public class Globals
{
public static final String DEFAULT_SYSTEM_TITLE = "shoppingV2.0";
public static final boolean SSO_SIGN = true;
public static final int DEFAULT_SHOP_VERSION = 20171018;
public static final String DEFAULT_SHOP_OUT_VERSION = "V4.0";
public static final String DEFAULT_WBESITE_NAME = "shopping";
public static final String DEFAULT_CLOSE_REASON = "系统维护中......";
public static final String DEFAULT_THEME = "default";
public static final String DERAULT_USER_TEMPLATE = "user_templates";
public static final String UPLOAD_FILE_PATH = "upload";
public static final String DEFAULT_SYSTEM_LANGUAGE = "zh_cn";
public static final String DEFAULT_SYSTEM_PAGE_ROOT = "WEB-INF/templates/";
public static final String SYSTEM_MANAGE_PAGE_PATH = "WEB-INF/templates/zh_cn/system/";
public static final String SYSTEM_FORNT_PAGE_PATH = "WEB-INF/templates/zh_cn/shop/";
public static final String SYSTEM_DATA_BACKUP_PATH = "data";
public static final Boolean SYSTEM_UPDATE = Boolean.valueOf(true);
public static final boolean SAVE_LOG = false;
public static final String SECURITY_CODE_TYPE = "normal";
public static final boolean STORE_ALLOW = true;
public static final boolean EAMIL_ENABLE = true;
public static final String DEFAULT_IMAGESAVETYPE = "sidImg";
public static final int DEFAULT_IMAGE_SIZE = 1024;
public static final String DEFAULT_IMAGE_SUFFIX = "gif|jpg|jpeg|bmp|png|tbi";
public static final int DEFAULT_IMAGE_SMALL_WIDTH = 160;
public static final int DEFAULT_IMAGE_SMALL_HEIGH = 160;
public static final int DEFAULT_IMAGE_MIDDLE_WIDTH = 300;
public static final int DEFAULT_IMAGE_MIDDLE_HEIGH = 300;
public static final int DEFAULT_IMAGE_BIG_WIDTH = 1024;
public static final int DEFAULT_IMAGE_BIG_HEIGH = 1024;
public static final int DEFAULT_COMPLAINT_TIME = 30;
public static final String DEFAULT_TABLE_SUFFIX = "shopping_";
public static final String THIRD_ACCOUNT_LOGIN = "shopping_thid_login_";
public static final String DEFAULT_SMS_URL = "http://service.winic.org/sys_port/gateway/";
public static final String DEFAULT_BIND_DOMAIN_CODE = "126A11D4BB76663E85078487393AB64897B9DCE99C5934CD589CFE4E769668CB";
} | [
"614720519@qq.com"
] | 614720519@qq.com |
b27a4fc3bd8e778259effcf933219ccf5f1fc2d2 | c6f7fdb2cc85bd454e065962c1ab648bbd3b240e | /javatraining/src/com/training/java/enums/EError.java | d94696f6bc370f113673e3652a2c1455a3144f9b | [] | no_license | osmanyaycioglu/in20210823 | ee14d7a38a72f9790d88d49467fe1930473e8f18 | fc37f05a401630684511fb696f27fa453f5acc46 | refs/heads/master | 2023-07-13T20:40:17.847403 | 2021-08-27T13:37:55 | 2021-08-27T13:37:55 | 399,081,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,738 | java | package com.training.java.enums;
import com.training.java.calculator.IOperation;
public enum EError implements IOperation {
ERROR_PARAMETER(300, "Paramter hatası oluştu", ECategory.INPUT) {
@Override
public int execute(final int val1Param,
final int val2Param) {
return val1Param + val2Param;
}
},
ERROR_SYSTEM(500, "Sistem error oluştu", ECategory.SYSTEM) {
@Override
public int execute(final int val1Param,
final int val2Param) {
return super.execute(val1Param,
val2Param);
}
};
private final int cause;
private final String message;
private final ECategory category;
private EError(final int cause,
final String message,
final ECategory category) {
this.cause = cause;
this.message = message;
this.category = category;
}
public int getCause() {
return this.cause;
}
public String getMessage() {
return this.message;
}
public ECategory getCategory() {
return this.category;
}
public static EError getError(final int cause) {
EError[] valuesLoc = EError.values();
for (EError eErrorLoc : valuesLoc) {
int ordinalLoc = eErrorLoc.ordinal();
String nameLoc = eErrorLoc.name();
if (eErrorLoc.getCause() == cause) {
return eErrorLoc;
}
}
return null;
}
@Override
public int execute(final int val1Param,
final int val2Param) {
throw new IllegalStateException();
}
}
| [
"osman@osman123.com"
] | osman@osman123.com |
c7374df59395e62369ec75fa14027cfc51dc2020 | 438b24ae5819217642299bf76a25cbfcef0b5d9d | /src/linearlist/SingleLinkedList.java | cc30daf53e6903e330d6c4c7eac55f3e8069f62e | [] | no_license | 714763127/arithmetic | 7d04d986613c5e9aa0a163d7f81699d9eb759c62 | 00072ff72ecea266890f07c2698774bf9b7480d0 | refs/heads/master | 2020-07-06T03:09:02.578077 | 2019-08-20T13:36:21 | 2019-08-20T13:36:21 | 202,869,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,746 | java | package linearlist;
import sun.util.resources.cldr.en.CalendarData_en_US_POSIX;
/*
* 单链表
* */
public class SingleLinkedList<T> {
//定义一个内部Node,代表链表节点
private class Node {
private T data;//保存数据
private Node next;//指向下一个节点的引用
public Node() {
}
public Node(T data, Node next) {
this.data = data;
this.next = next;
}
}
private Node header;//头结点
private Node tail;//保存伟结点
private int size;//保存已含有的节点数据
public SingleLinkedList() {
header = null;
tail = null;
}
public SingleLinkedList(T element) {
header = new Node(element, null);
tail = header;
size++;
}
//返回链表长度
public int length() {
return size;
}
//获取指定索引处的元素
public T get(int index) {
return this.getNodeByIndex(index).data;
}
//获取指定位置的节点
private Node getNodeByIndex(int index) {
if (index < 0 || index > size - 1) {
throw new IndexOutOfBoundsException("索引超出线性表范围");
}
Node current = header;//从头开始遍历
int i = 0;
while (true) {
if (i == index) {
return current;
}
current = header.next;
i++;
}
}
//按值查找所在位置
public int locate(T element) {
Node current = header;
for (int i = 0; i < size && current != null; i++, current = current.next) {
if (current.data.equals(element)) {
return i;
}
}
return -1;
}
//指定位置插入元素
public void insert(T element, int index) {
if (index < 0 || index > size) {
throw new IndexOutOfBoundsException("索引超出线性表范围");
}
//如果是空链表
if (header == null) {
add(element);
} else {
//当index为0,即在链表头处插入
if (index == 0) {
addAtHead(element);
} else {
Node prev = getNodeByIndex(index - 1);//获取前一个结点
//让prev的next指向新节点,新节点的next指向原来prev的下一个节点
prev.next = new Node(element, prev.next);
size++;
}
}
}
//在尾部插入元素
public void add(T element) {
//如果链表是空的
if (header == null) {
header = new Node(element, null);
//只有一个节点,header,tail都应指向该节点
tail = header;
} else {
Node newNoed = new Node(element, null);
tail.next = newNoed;
tail = newNoed;
}
size++;
}
//头部插入
public void addAtHead(T element) {
//创建新的节点,让新的节点的next指向header
//并以新的节点为新的header
Node newNode = new Node(element, null);
newNode.next = header;
header = newNode;
//若插入前是空表
if (tail == null) {
tail = header;
}
size++;
}
//删除指定索引处的元素
public T delete(int index) {
if (index < 0 || index > size - 1) {
throw new IndexOutOfBoundsException("索引超出线性表范围");
}
Node del = null;
//若要删除的是头节点
if (index == 0) {
del = header;
header = header.next;
} else {
Node prev = getNodeByIndex(index - 1);//获取待删除节点前的结点
del = prev.next;//获取待删除节点
prev.next = del.next;
del.next = null;//将被删除的next引用置 为空
}
size--;
return del.data;
}
//删除最后一个元素
public T remove() {
return delete(size - 1);
}
//判断线性表是否为空
public boolean isEmpty() {
return size == 0;
}
//清空线性表
public void clear() {
header = null;
tail = null;
size = 0;
}
public String toString() {
if (isEmpty()) {
return "[]";
} else {
StringBuilder sb = new StringBuilder("[");
for (Node current = header; current != null; current = current.next) {
sb.append(current.data.toString() + ",");
}
int len = sb.length();
return sb.delete(len - 2, len).append("]").toString();
}
}
}
| [
"714763127@qq.com"
] | 714763127@qq.com |
6b131141d90ceb0130c649d73a73fef422a38cd9 | 175971c05663467070b1764c5755e6ff12748d6e | /app/src/main/java/id/dev/birifqa/edcgold/fragment_admin/FragmentAdminWithdraw.java | 3b5d93a9cad5eb28bbbff3a577a0b980985b3e22 | [] | no_license | AdikNKL17/EDCGold | de7a72257aadb76835a7e0fe6b4e806eb21cef93 | cbadfde440566b38b409e1ec576e6df2014c8296 | refs/heads/master | 2020-08-05T22:26:58.438015 | 2019-12-10T03:35:22 | 2019-12-10T03:35:22 | 212,734,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,518 | java | package id.dev.birifqa.edcgold.fragment_admin;
import android.app.AlertDialog;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import dmax.dialog.SpotsDialog;
import id.dev.birifqa.edcgold.R;
import id.dev.birifqa.edcgold.adapter.AdminWithdrawAdapter;
import id.dev.birifqa.edcgold.model.admin.AdminWithdrawModel;
import okhttp3.ResponseBody;
import retrofit2.Callback;
/**
* A simple {@link Fragment} subclass.
*/
public class FragmentAdminWithdraw extends Fragment {
private View view;
private RecyclerView recyclerView;
private AdminWithdrawAdapter withdrawAdapter;
private ArrayList<AdminWithdrawModel> withdrawModels;
private Callback<ResponseBody> cBack;
private AlertDialog dialog;
public FragmentAdminWithdraw() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_admin_withdraw, container, false);
findViewById();
onAction();
return view;
}
private void findViewById(){
dialog = new SpotsDialog.Builder().setContext(getActivity()).build();
recyclerView = view.findViewById(R.id.rv_withdraw);
}
private void onAction(){
withdrawModels = new ArrayList<>();
withdrawAdapter = new AdminWithdrawAdapter(getActivity(), withdrawModels);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), RecyclerView.VERTICAL, false));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(withdrawAdapter);
getData();
}
private void getData(){
withdrawModels.clear();
AdminWithdrawModel withdrawModel1 = new AdminWithdrawModel();
withdrawModel1.setNama_user("Habib A.M");
withdrawModel1.setId_user("ID. 52802000611111");
withdrawModel1.setStatus_proses("Belum di proses");
withdrawModel1.setTgl_withdraw("11-10-2019");
withdrawModels.add(withdrawModel1);
AdminWithdrawModel withdrawModel2 = new AdminWithdrawModel();
withdrawModel2.setNama_user("Ujang S.");
withdrawModel2.setId_user("ID. 206503444405");
withdrawModel2.setStatus_proses("Belum di proses");
withdrawModel2.setTgl_withdraw("05-10-2019");
withdrawModels.add(withdrawModel2);
AdminWithdrawModel withdrawModel3 = new AdminWithdrawModel();
withdrawModel3.setNama_user("Nadia H");
withdrawModel3.setId_user("ID. 5800048450311");
withdrawModel3.setStatus_proses("Berhasil di proses ");
withdrawModel3.setTgl_withdraw("15-09-2019");
withdrawModels.add(withdrawModel3);
AdminWithdrawModel withdrawModel4 = new AdminWithdrawModel();
withdrawModel4.setNama_user("Rani H. A");
withdrawModel4.setId_user("ID. 1220364544044");
withdrawModel4.setStatus_proses("Berhasil di proses ");
withdrawModel4.setTgl_withdraw("08-09-2019");
withdrawModels.add(withdrawModel4);
withdrawAdapter.notifyDataSetChanged();
}
}
| [
"rifqi.dmw@gmail.com"
] | rifqi.dmw@gmail.com |
9c62ed1b0ce1c69cb83a7c7a54c78afb47cabe3d | 1bea62b4579f1b1de3482cc0326f683cc1436458 | /standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/client/builder/SQLPrimaryKeyBuilder.java | 40f74bd6d0132e1573c44d1685a9ee1643085b8a | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"Python-2.0",
"BSD-2-Clause"
] | permissive | apache/hive | f23dd565389b2c7988d0bbc665315234e54ed62c | c93276ab1771cbab7da93049daba48cc5213192e | refs/heads/master | 2023-09-04T10:37:39.942068 | 2023-09-03T11:20:28 | 2023-09-03T11:20:28 | 206,444 | 5,152 | 4,688 | Apache-2.0 | 2023-09-14T19:36:42 | 2009-05-21T02:31:01 | Java | UTF-8 | Java | false | false | 1,904 | 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.hive.metastore.client.builder;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey;
import java.util.ArrayList;
import java.util.List;
/**
* Builder for {@link SQLPrimaryKey}. Only requires what {@link ConstraintBuilder} requires.
*/
public class SQLPrimaryKeyBuilder extends ConstraintBuilder<SQLPrimaryKeyBuilder> {
public SQLPrimaryKeyBuilder() {
super.setChild(this);
}
// Just to translate
public SQLPrimaryKeyBuilder setPrimaryKeyName(String name) {
return setConstraintName(name);
}
public List<SQLPrimaryKey> build(Configuration conf) throws MetaException {
checkBuildable("primary_key", conf);
List<SQLPrimaryKey> pk = new ArrayList<>(columns.size());
for (String colName : columns) {
SQLPrimaryKey keyCol = new SQLPrimaryKey(dbName, tableName, colName, getNextSeq(),
constraintName, enable, validate, rely);
keyCol.setCatName(catName);
pk.add(keyCol);
}
return pk;
}
}
| [
"gates@hortonworks.com"
] | gates@hortonworks.com |
03cb1529a823dbd705a9754beed4715b9a9899e0 | 4032dd31b580a2da86cd8687ec3cc60443f7049b | /core/src/main/java/com/rpc/core/AbstractServer.java | 2bd1ef36db018d20f0b543f018973aeeda98451e | [] | no_license | 877867559/myrpc | f2d0581d7f4e2818c1335732ca4e535404f5c2e0 | 36243cbcd2fdb164284f524aba3e5dffbe543e9c | refs/heads/master | 2020-12-01T09:12:42.359042 | 2020-01-02T11:40:44 | 2020-01-02T11:40:44 | 230,598,483 | 0 | 0 | null | 2020-10-13T18:30:08 | 2019-12-28T11:05:13 | Java | UTF-8 | Java | false | false | 5,810 | java | package com.rpc.core;
import com.rpc.common.util.Lists;
import com.rpc.common.util.Maps;
import com.rpc.common.util.StringUtils;
import com.rpc.core.model.ServiceMetadata;
import com.rpc.core.model.ServiceWrapper;
import com.rpc.registry.zookeeper.ZookeeperRegistryService;
import org.rpc.registry.RegisterMeta;
import org.rpc.registry.RegistryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
import static com.rpc.common.util.Preconditions.checkArgument;
import static com.rpc.common.util.Preconditions.checkNotNull;
public abstract class AbstractServer implements Server{
private static Logger logger = LoggerFactory.getLogger(AbstractServer.class);
//注册中心
private final RegistryService registryService = new ZookeeperRegistryService();
//本地注册服务
private final ConcurrentMap<String, ServiceWrapper> serviceProviders = Maps.newConcurrentHashMap();
@Override
public void connectToRegistryServer(String connectString) {
registryService.connectToRegistryServer(connectString);
}
/**
* 本地查找服务
* @param serviceMetadata
* @return
*/
@Override
public ServiceWrapper lookupService(ServiceMetadata serviceMetadata) {
return serviceProviders.get(serviceMetadata.metadata());
}
@Override
public void publish(ServiceWrapper serviceWrapper) {
ServiceMetadata metadata = serviceWrapper.getMetadata();
RegisterMeta meta = new RegisterMeta();
meta.setPort(bindPort());
meta.setGroup(metadata.getGroup());
meta.setVersion(metadata.getVersion());
meta.setServiceProviderName(metadata.getServiceProviderName());
registryService.register(meta);
}
public abstract int bindPort();
@Override
public void unpublish(ServiceWrapper serviceWrapper) {
ServiceMetadata metadata = serviceWrapper.getMetadata();
RegisterMeta meta = new RegisterMeta();
meta.setPort(bindPort());
meta.setGroup(metadata.getGroup());
meta.setVersion(metadata.getVersion());
meta.setServiceProviderName(metadata.getServiceProviderName());
registryService.unregister(meta);
}
@Override
public ServiceRegistry serviceRegistry() {
return new DefaultServiceRegistry();
}
ServiceWrapper registerService(
String group,
String version,
String providerName,
Object serviceProvider,
Map<String, List<Class<?>[]>> methodsParameterTypes) {
ServiceWrapper wrapper = new ServiceWrapper(group, version, providerName, serviceProvider, methodsParameterTypes);
serviceProviders.put(wrapper.getMetadata().metadata(), wrapper);
return wrapper;
}
class DefaultServiceRegistry implements ServiceRegistry {
private Object serviceProvider; // 服务对象
private int weight; // 权重
private Executor executor; // 该服务私有的线程池
@Override
public ServiceRegistry provider(Object serviceProvider) {
this.serviceProvider = serviceProvider;
return this;
}
@Override
public ServiceRegistry weight(int weight) {
this.weight = weight;
return this;
}
@Override
public ServiceRegistry executor(Executor executor) {
this.executor = executor;
return this;
}
@Override
public ServiceWrapper register() {
ServiceProvider annotation = null;
String providerName = null;
Map<String, List<Class<?>[]>> methodsParameterTypes = Maps.newHashMap();
for (Class<?> cls = serviceProvider.getClass(); cls != Object.class; cls = cls.getSuperclass()) {
Class<?>[] interfaces = cls.getInterfaces();
if (interfaces != null) {
for (Class<?> providerInterface : interfaces) {
annotation = providerInterface.getAnnotation(ServiceProvider.class);
if (annotation == null) {
continue;
}
providerName = annotation.value();
providerName = StringUtils.isNotBlank(providerName) ? providerName : providerInterface.getSimpleName();
for (Method method : providerInterface.getMethods()) {
String methodName = method.getName();
List<Class<?>[]> list = methodsParameterTypes.get(methodName);
if (list == null) {
list = Lists.newArrayList();
methodsParameterTypes.put(methodName, list);
}
list.add(method.getParameterTypes());
}
break;
}
}
if (annotation != null) {
break;
}
}
checkArgument(annotation != null, serviceProvider.getClass() + " is not a ServiceProvider");
String group = annotation.group();
String version = annotation.version();
checkNotNull(group, "group");
return registerService(
group,
version,
providerName,
serviceProvider,
methodsParameterTypes
);
}
}
}
| [
"877867559@qq.com"
] | 877867559@qq.com |
e3332827f44df810f3c8494cc0fa1bd549976d51 | c8bfca8c8549403a7261b0a41a9dce56fd18d125 | /app/src/androidTest/java/com/example/myungger/myapplication/ExampleInstrumentedTest.java | 25a470993e8384cb98506350cff6ee6726d7c195 | [] | no_license | 16301155/MyApplication | 8f75302ea4ecfa98182d30f4c57271404c2547c3 | 73b0b3d3209e84632493e90376c30a627f3dadc0 | refs/heads/master | 2020-03-31T08:55:02.341593 | 2019-01-02T01:18:58 | 2019-01-02T01:18:58 | 152,077,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.example.myungger.myapplication;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.myungger.myapplication", appContext.getPackageName());
}
}
| [
"37803218+16301155@users.noreply.github.com"
] | 37803218+16301155@users.noreply.github.com |
76e064e36eeddd82b62b4010c008f64a5cd99699 | 8a03e7c73bf54d7c096e5f3c32396ac982bbe1ae | /TestPrj/src/Ex쪽지시험연습02.java | a8a5c05e3381b5f11bf17ea2eef34a6f91f63886 | [] | no_license | mu9800mu12/poly | 03fc947af42e25bc6fb4fde2c949473299897f4c | 2d201260e0e747b32bb5db5b3425e8d3d025eb18 | refs/heads/main | 2023-04-22T02:42:42.549600 | 2021-05-13T11:23:08 | 2021-05-13T11:23:08 | 346,210,813 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 260 | java |
public class Ex쪽지시험연습02 {
public static void main(String[] args) {
int a;
for (a = 1; a < 11; a++) {
if (a % 3 == 0) {
System.out.println("[3의배수]" + a);
} else {
System.out.println(a);
}
}
}
}
| [
"mu9800mu12@naver.com"
] | mu9800mu12@naver.com |
f76b889d85cefbc0c026a46530ba1540ddde9f3b | 172afe5bebebb9baf2ac9b97b38bdb0efc186299 | /Copy of FinalFrontendProjectcopy/src/main/java/com/finproject/FinalFrontendProject/controller/UserContrller.java | 32b9f9ea153d3dd3df22c0a609d0e76c007cf769 | [] | no_license | vishnupriyabalu/E-commerce | fa83f942c9e3702eeee4fb1806c3b893448a3ce5 | 7105a90ad22f6a4c7289eb5679694e44b40616dc | refs/heads/master | 2021-01-22T12:24:48.381733 | 2017-07-07T09:21:59 | 2017-07-07T09:21:59 | 92,722,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,499 | java | package com.finproject.FinalFrontendProject.controller;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpSession;
import javax.websocket.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.finproj.Finprojbackend.dao.ProductDAO;
import com.finproj.Finprojbackend.dao.UserDAO;
import com.finproj.Finprojbackend.model.Product;
import com.finproj.Finprojbackend.model.Supplier;
import com.finproj.Finprojbackend.model.User;
@Controller
public class UserContrller
{
@Autowired
ProductDAO productDAO;
@Autowired
UserDAO userDAO;
@RequestMapping("/loginsuccess")
public String loginSuccess(HttpSession session,Model m)
{
String page=null;
System.out.println("----it is in User controller Login Success module----");
boolean LoggedIn=true;
//retrieving username
String username=SecurityContextHolder.getContext().getAuthentication().getName();
session.setAttribute("username", username);
session.setAttribute("LoggedIn", LoggedIn);
//retrieving the role
Collection<GrantedAuthority> authorities=(Collection<GrantedAuthority>)SecurityContextHolder.getContext().getAuthentication().getAuthorities();
for(GrantedAuthority role:authorities)
{
System.out.println("RoleName:"+role.getAuthority()+"username:"+username);
if(role.getAuthority().equals("ROLE_ADMIN"))
{
page="Adminhome";
}
else
{ System.out.println("----Login Successfull----");
List<Product> list=productDAO.getProductDetails();
m.addAttribute("prodlist",list);
page="Userhome";
}
}
return page;
}
@RequestMapping(value="/InsertUser",method=RequestMethod.POST)
public String insertUser(@ModelAttribute("user") User user,Model m)
{ System.out.println("---User Insertion Processing---");
userDAO.insertUpdateUser(user);
List<User> userlist=userDAO.getUserDetails();
m.addAttribute("userlist",userlist);
System.out.println("---User Inserted---");
return "Userhome";
}
}
| [
"visnupriyabalu@gmail.com"
] | visnupriyabalu@gmail.com |
8b3a12dbff9fe81b6ab5ebf0314b93753e7a912e | 86eabd80314398424c2ff34f95db033c64b6622a | /latte_core/src/main/java/com/diabin/latte/net/callback/IRequest.java | 226af5f37d0a47269db9f29603e78feac67054ee | [] | no_license | dekaer/FectEC | 6c29f7270bc59b559d027141027acce98b78cd4a | acf6c5f3194ce340e8ba0f733008dace962f9080 | refs/heads/master | 2020-05-04T17:34:07.650005 | 2019-04-05T05:41:57 | 2019-04-05T05:41:57 | 179,316,410 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 123 | java | package com.diabin.latte.net.callback;
public interface IRequest {
void onRequestStart();
void onRequestEnd();
}
| [
"962707557@qq.com"
] | 962707557@qq.com |
d0c9efa5383b217030278267c157eac4e89a38e2 | 62b162a1d7367e475aacb5cc5bcbedb13f7c6508 | /PMIS_Report/src/com/tetrapak/test/CIPReportAnalyserDemo.java | 7990de45d240d347fc87dd63f01ce586f2d7fb9c | [] | no_license | frankshou1988/Work | 1f66e4871661cca473c9ab628449cd8a50064afb | 4309ab9ae474c6cd8f4217827e26e3479a0d8611 | refs/heads/master | 2021-01-17T17:05:46.667235 | 2013-09-04T14:41:12 | 2013-09-04T14:41:12 | 12,592,530 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package com.tetrapak.test;
import com.tetrapak.config.PMISConfigLoader;
import com.tetrapak.util.cip.TPM6CIPReportAnalyser;
public class CIPReportAnalyserDemo {
public static void main(String[] args) throws Exception {
PMISConfigLoader.loadConfig();
TPM6CIPReportAnalyser.cipReportAnalyse();
}
}
| [
"frankshou1988@126.com"
] | frankshou1988@126.com |
704b3a5b6ebc30d524370a29b64e91832c9eaa64 | 4b6e2153e029c775a327cc4a428dfca7b365a2f5 | /src/main/java/edu/university/program/config/WebConfig.java | 007e999aebff43a0ad36cef150e279b707225af4 | [
"Apache-2.0"
] | permissive | RomanSulymka/Register_of_Graduates | 352e0b95d8a3bc26e7e02ca7b143429372b4545c | 0a9441c3b4cc35d0ca9b2f7e2937f4d3f0364bd9 | refs/heads/master | 2023-02-26T13:34:08.724790 | 2021-02-03T10:14:28 | 2021-02-03T10:14:28 | 313,997,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,046 | java | package edu.university.program.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.nio.file.Path;
import java.nio.file.Paths;
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Value("${upload.path}")
private String uploadPath;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
exposeDirectory(uploadPath, registry);
}
private void exposeDirectory(String dirName, ResourceHandlerRegistry registry) {
Path uploadDir = Paths.get(dirName);
String uploadPath = uploadDir.toFile().getAbsolutePath();
if (dirName.startsWith("../")) dirName = dirName.replace("../", "");
registry.addResourceHandler("/" + dirName + "/**").addResourceLocations("file:/"+ uploadPath + "/");
}
} | [
"roma.sulimak@gmail.com"
] | roma.sulimak@gmail.com |
615a24fa15905af1d4390a630bae873a939b905f | 5a02c74a94c969f943567354545d72ea81982aae | /mavenproject9/src/main/java/com/pokedex/ec/dao/EvolveDAO.java | 67aa6c2935b891c03793cc8baf584a71a5c5af4b | [] | no_license | IvanMCabral/PokedexWebEclipse | 6798296d5c1271cf2dcf13aa81e306d1c5f623e6 | b3ab57ecbc53990c92705b753d81b568f5a53b61 | refs/heads/master | 2023-07-04T14:42:10.724744 | 2021-08-12T14:24:54 | 2021-08-12T14:24:54 | 395,179,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,829 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.pokedex.ec.dao;
import com.pokedex.ec.entity.Evolve;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
/**
*
* @author
*/
public class EvolveDAO {
private String message = "";
public String addEvoTable(Connection con, Evolve ev) {
PreparedStatement pst = null;
String sql = "INSERT INTO EVO ( IDPOKEMON, LEVEL, EVOLVESTO) VALUES( ?, ?, ?)";
String sql2 = "UPDATE POKEMON SET EVOLUTION = 1 WHERE IDPOKEMON = ?";
try {
pst = con.prepareStatement(sql);
pst.setInt(1, ev.getPoke());
pst.setInt(2, ev.getEvolveAt());
pst.setInt(3, ev.getEvolvesTo());
pst.execute();
pst.close();
con.commit();
//update evolution pokemon table
pst = con.prepareStatement(sql2);
pst.setInt(1, ev.getPoke());
pst.execute();
pst.close();
con.commit();
message = "Insert OK";
} catch (SQLException e) {
message = "Error \n " + e.getMessage();
}
return message;
}
public int lastPoke(Connection con) {
int id = 0;
PreparedStatement pst = null;
ResultSet result = null;
String sql = "SELECT MAX(IDPOKEMON) FROM POKEMON ";
try {
pst = con.prepareStatement(sql);
result = pst.executeQuery();
if (result.next()) {
id = result.getInt("MAX(IDPOKEMON)");
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, e);
}
return id;
}
public List listEvos(Connection con, int id) {
int id2 = 0;
List lista = new ArrayList<>();
String sql = "SELECT EVOLVESTO FROM EVO WHERE IDPOKEMON = (?)";
String sql1 = "SELECT LEVEL FROM EVO WHERE IDPOKEMON =(?)";
String sql2 = "SELECT NAME FROM POKEMON WHERE IDPOKEMON =(?)";
PreparedStatement st = null;
ResultSet rs = null;
try {
//Search items Pokemon Choosen
st = con.prepareStatement(sql);
st.setInt(1, id);
rs = st.executeQuery();
if (rs.next()) {
id2 = rs.getInt("EVOLVESTO");
}
if (id2 > 0) {
} else {
id = id2;
}
//Search level evolution
while (id > 0) {
String m = "";
st = con.prepareStatement(sql1);
st.setInt(1, id);
rs = st.executeQuery();
if (rs.next()) {
m = rs.getString("LEVEL");
}
st = con.prepareStatement(sql);
st.setInt(1, id);
rs = st.executeQuery();
if (rs.next()) {
id = rs.getInt("EVOLVESTO");
} else {
id = 0;
}
//search name pokemon for the list
st = con.prepareStatement(sql2);
st.setInt(1, id);
rs = st.executeQuery();
while (rs.next()) {
String n = rs.getString("NAME");
lista.add("Evolves at " + m + " To: " + n);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "ERROR LIST");
}
return lista;
}
}
| [
"icabral@certant.com"
] | icabral@certant.com |
f21d88f79f0564db4b04530c420cd5b0fd4ebbcd | 30debfb588d3df553019a29d761f53698564e8c8 | /modules/dfp_axis/src/main/java/com/google/api/ads/dfp/axis/v201702/ListStringCreativeTemplateVariableVariableChoice.java | 0ec55c1908f634758f7ea62c7734590eb47ea101 | [
"Apache-2.0"
] | permissive | jinhyeong/googleads-java-lib | 8f7a5b9cad5189e45b5ddcdc215bbb4776b614f9 | 872c39ba20f30f7e52d3d4c789a1c5cbefaf80fc | refs/heads/master | 2021-01-19T09:35:38.933267 | 2017-04-03T14:12:43 | 2017-04-03T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,844 | java | // Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* ListStringCreativeTemplateVariableVariableChoice.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.dfp.axis.v201702;
/**
* Stores variable choices that users can select from
*/
public class ListStringCreativeTemplateVariableVariableChoice implements java.io.Serializable {
/* Label that users can select from. This is displayed to users
* when creating a
* {@link TemplateCreative}. This attribute is intended
* to be more descriptive than
* {@link #value}. This attribute is required and has
* a maximum length of 255 characters. */
private java.lang.String label;
/* Value that users can select from. When creating a {@link TemplateCreative},
* the value in
* {@link StringCreativeTemplateVariableValue} should
* match this value, if you intend to
* select this value. This attribute is required and
* has a maximum length of 255
* characters. */
private java.lang.String value;
public ListStringCreativeTemplateVariableVariableChoice() {
}
public ListStringCreativeTemplateVariableVariableChoice(
java.lang.String label,
java.lang.String value) {
this.label = label;
this.value = value;
}
/**
* Gets the label value for this ListStringCreativeTemplateVariableVariableChoice.
*
* @return label * Label that users can select from. This is displayed to users
* when creating a
* {@link TemplateCreative}. This attribute is intended
* to be more descriptive than
* {@link #value}. This attribute is required and has
* a maximum length of 255 characters.
*/
public java.lang.String getLabel() {
return label;
}
/**
* Sets the label value for this ListStringCreativeTemplateVariableVariableChoice.
*
* @param label * Label that users can select from. This is displayed to users
* when creating a
* {@link TemplateCreative}. This attribute is intended
* to be more descriptive than
* {@link #value}. This attribute is required and has
* a maximum length of 255 characters.
*/
public void setLabel(java.lang.String label) {
this.label = label;
}
/**
* Gets the value value for this ListStringCreativeTemplateVariableVariableChoice.
*
* @return value * Value that users can select from. When creating a {@link TemplateCreative},
* the value in
* {@link StringCreativeTemplateVariableValue} should
* match this value, if you intend to
* select this value. This attribute is required and
* has a maximum length of 255
* characters.
*/
public java.lang.String getValue() {
return value;
}
/**
* Sets the value value for this ListStringCreativeTemplateVariableVariableChoice.
*
* @param value * Value that users can select from. When creating a {@link TemplateCreative},
* the value in
* {@link StringCreativeTemplateVariableValue} should
* match this value, if you intend to
* select this value. This attribute is required and
* has a maximum length of 255
* characters.
*/
public void setValue(java.lang.String value) {
this.value = value;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof ListStringCreativeTemplateVariableVariableChoice)) return false;
ListStringCreativeTemplateVariableVariableChoice other = (ListStringCreativeTemplateVariableVariableChoice) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.label==null && other.getLabel()==null) ||
(this.label!=null &&
this.label.equals(other.getLabel()))) &&
((this.value==null && other.getValue()==null) ||
(this.value!=null &&
this.value.equals(other.getValue())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getLabel() != null) {
_hashCode += getLabel().hashCode();
}
if (getValue() != null) {
_hashCode += getValue().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(ListStringCreativeTemplateVariableVariableChoice.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201702", "ListStringCreativeTemplateVariable.VariableChoice"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("label");
elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201702", "label"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("value");
elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201702", "value"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"api.cseeley@gmail.com"
] | api.cseeley@gmail.com |
e114997e03f88337a09077a8c49df8e2b2514076 | 0f1a76d28b14ddadd0833c542a58d4a63d59f05b | /java/src/com/android/inputmethod/voice/VoiceInput.java | 1d8179a3576b2554799f1e7c7efb04c911825635 | [
"Apache-2.0"
] | permissive | abaumer/androidKeyboard | 7c7c914d93ff0430de0404d01c948a86b0927ca0 | 6742217e4b82ba33fa73fe7d82207fcacb0ec19b | refs/heads/master | 2020-05-30T16:58:04.440717 | 2013-11-20T22:01:24 | 2013-11-20T22:01:24 | 13,850,018 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 25,221 | java | /*
* Copyright (C) 2009 Google Inc.
*
* 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.android.inputmethod.voice;
import org.pocketworkstation.pckeyboard.EditingUtil;
import org.pocketworkstation.pckeyboard.R;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Parcelable;
import android.speech.RecognitionListener;
import android.speech.SpeechRecognizer;
import android.speech.RecognizerIntent;
import android.util.Log;
import android.view.inputmethod.InputConnection;
import android.view.View;
import android.view.View.OnClickListener;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
* Speech recognition input, including both user interface and a background
* process to stream audio to the network recognizer. This class supplies a
* View (getView()), which it updates as recognition occurs. The user of this
* class is responsible for making the view visible to the user, as well as
* handling various events returned through UiListener.
*/
public class VoiceInput implements OnClickListener {
private static final String TAG = "VoiceInput";
private static final String EXTRA_RECOGNITION_CONTEXT =
"android.speech.extras.RECOGNITION_CONTEXT";
private static final String EXTRA_CALLING_PACKAGE = "calling_package";
private static final String EXTRA_ALTERNATES = "android.speech.extra.ALTERNATES";
private static final int MAX_ALT_LIST_LENGTH = 6;
private static final String DEFAULT_RECOMMENDED_PACKAGES =
"com.android.mms " +
"com.google.android.gm " +
"com.google.android.talk " +
"com.google.android.apps.googlevoice " +
"com.android.email " +
"com.android.browser ";
// WARNING! Before enabling this, fix the problem with calling getExtractedText() in
// landscape view. It causes Extracted text updates to be rejected due to a token mismatch
public static boolean ENABLE_WORD_CORRECTIONS = true;
// Dummy word suggestion which means "delete current word"
public static final String DELETE_SYMBOL = " \u00D7 "; // times symbol
private Whitelist mRecommendedList;
private Whitelist mBlacklist;
private VoiceInputLogger mLogger;
// Names of a few extras defined in VoiceSearch's RecognitionController
// Note, the version of voicesearch that shipped in Froyo returns the raw
// RecognitionClientAlternates protocol buffer under the key "alternates",
// so a VS market update must be installed on Froyo devices in order to see
// alternatives.
private static final String ALTERNATES_BUNDLE = "alternates_bundle";
// This is copied from the VoiceSearch app.
private static final class AlternatesBundleKeys {
public static final String ALTERNATES = "alternates";
public static final String CONFIDENCE = "confidence";
public static final String LENGTH = "length";
public static final String MAX_SPAN_LENGTH = "max_span_length";
public static final String SPANS = "spans";
public static final String SPAN_KEY_DELIMITER = ":";
public static final String START = "start";
public static final String TEXT = "text";
}
// Names of a few intent extras defined in VoiceSearch's RecognitionService.
// These let us tweak the endpointer parameters.
private static final String EXTRA_SPEECH_MINIMUM_LENGTH_MILLIS =
"android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS";
private static final String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS =
"android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS";
private static final String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS =
"android.speech.extras.SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS";
// The usual endpointer default value for input complete silence length is 0.5 seconds,
// but that's used for things like voice search. For dictation-like voice input like this,
// we go with a more liberal value of 1 second. This value will only be used if a value
// is not provided from Gservices.
private static final String INPUT_COMPLETE_SILENCE_LENGTH_DEFAULT_VALUE_MILLIS = "1000";
// Used to record part of that state for logging purposes.
public static final int DEFAULT = 0;
public static final int LISTENING = 1;
public static final int WORKING = 2;
public static final int ERROR = 3;
private int mAfterVoiceInputDeleteCount = 0;
private int mAfterVoiceInputInsertCount = 0;
private int mAfterVoiceInputInsertPunctuationCount = 0;
private int mAfterVoiceInputCursorPos = 0;
private int mAfterVoiceInputSelectionSpan = 0;
private int mState = DEFAULT;
private final static int MSG_CLOSE_ERROR_DIALOG = 1;
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
if (msg.what == MSG_CLOSE_ERROR_DIALOG) {
mState = DEFAULT;
mRecognitionView.finish();
mUiListener.onCancelVoice();
}
}
};
/**
* Events relating to the recognition UI. You must implement these.
*/
public interface UiListener {
/**
* @param recognitionResults a set of transcripts for what the user
* spoke, sorted by likelihood.
*/
public void onVoiceResults(
List<String> recognitionResults,
Map<String, List<CharSequence>> alternatives);
/**
* Called when the user cancels speech recognition.
*/
public void onCancelVoice();
}
private SpeechRecognizer mSpeechRecognizer;
private RecognitionListener mRecognitionListener;
private RecognitionView mRecognitionView;
private UiListener mUiListener;
private Context mContext;
/**
* @param context the service or activity in which we're running.
* @param uiHandler object to receive events from VoiceInput.
*/
public VoiceInput(Context context, UiListener uiHandler) {
mLogger = VoiceInputLogger.getLogger(context);
mRecognitionListener = new ImeRecognitionListener();
mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(context);
mSpeechRecognizer.setRecognitionListener(mRecognitionListener);
mUiListener = uiHandler;
mContext = context;
newView();
String recommendedPackages = SettingsUtil.getSettingsString(
context.getContentResolver(),
SettingsUtil.LATIN_IME_VOICE_INPUT_RECOMMENDED_PACKAGES,
DEFAULT_RECOMMENDED_PACKAGES);
mRecommendedList = new Whitelist();
for (String recommendedPackage : recommendedPackages.split("\\s+")) {
mRecommendedList.addApp(recommendedPackage);
}
mBlacklist = new Whitelist();
mBlacklist.addApp("com.android.setupwizard");
}
public void setCursorPos(int pos) {
mAfterVoiceInputCursorPos = pos;
}
public int getCursorPos() {
return mAfterVoiceInputCursorPos;
}
public void setSelectionSpan(int span) {
mAfterVoiceInputSelectionSpan = span;
}
public int getSelectionSpan() {
return mAfterVoiceInputSelectionSpan;
}
public void incrementTextModificationDeleteCount(int count){
mAfterVoiceInputDeleteCount += count;
// Send up intents for other text modification types
if (mAfterVoiceInputInsertCount > 0) {
logTextModifiedByTypingInsertion(mAfterVoiceInputInsertCount);
mAfterVoiceInputInsertCount = 0;
}
if (mAfterVoiceInputInsertPunctuationCount > 0) {
logTextModifiedByTypingInsertionPunctuation(mAfterVoiceInputInsertPunctuationCount);
mAfterVoiceInputInsertPunctuationCount = 0;
}
}
public void incrementTextModificationInsertCount(int count){
mAfterVoiceInputInsertCount += count;
if (mAfterVoiceInputSelectionSpan > 0) {
// If text was highlighted before inserting the char, count this as
// a delete.
mAfterVoiceInputDeleteCount += mAfterVoiceInputSelectionSpan;
}
// Send up intents for other text modification types
if (mAfterVoiceInputDeleteCount > 0) {
logTextModifiedByTypingDeletion(mAfterVoiceInputDeleteCount);
mAfterVoiceInputDeleteCount = 0;
}
if (mAfterVoiceInputInsertPunctuationCount > 0) {
logTextModifiedByTypingInsertionPunctuation(mAfterVoiceInputInsertPunctuationCount);
mAfterVoiceInputInsertPunctuationCount = 0;
}
}
public void incrementTextModificationInsertPunctuationCount(int count){
mAfterVoiceInputInsertPunctuationCount += 1;
if (mAfterVoiceInputSelectionSpan > 0) {
// If text was highlighted before inserting the char, count this as
// a delete.
mAfterVoiceInputDeleteCount += mAfterVoiceInputSelectionSpan;
}
// Send up intents for aggregated non-punctuation insertions
if (mAfterVoiceInputDeleteCount > 0) {
logTextModifiedByTypingDeletion(mAfterVoiceInputDeleteCount);
mAfterVoiceInputDeleteCount = 0;
}
if (mAfterVoiceInputInsertCount > 0) {
logTextModifiedByTypingInsertion(mAfterVoiceInputInsertCount);
mAfterVoiceInputInsertCount = 0;
}
}
public void flushAllTextModificationCounters() {
if (mAfterVoiceInputInsertCount > 0) {
logTextModifiedByTypingInsertion(mAfterVoiceInputInsertCount);
mAfterVoiceInputInsertCount = 0;
}
if (mAfterVoiceInputDeleteCount > 0) {
logTextModifiedByTypingDeletion(mAfterVoiceInputDeleteCount);
mAfterVoiceInputDeleteCount = 0;
}
if (mAfterVoiceInputInsertPunctuationCount > 0) {
logTextModifiedByTypingInsertionPunctuation(mAfterVoiceInputInsertPunctuationCount);
mAfterVoiceInputInsertPunctuationCount = 0;
}
}
/**
* The configuration of the IME changed and may have caused the views to be layed out
* again. Restore the state of the recognition view.
*/
public void onConfigurationChanged() {
mRecognitionView.restoreState();
}
/**
* @return true if field is blacklisted for voice
*/
public boolean isBlacklistedField(FieldContext context) {
return mBlacklist.matches(context);
}
/**
* Used to decide whether to show voice input hints for this field, etc.
*
* @return true if field is recommended for voice
*/
public boolean isRecommendedField(FieldContext context) {
return mRecommendedList.matches(context);
}
/**
* Start listening for speech from the user. This will grab the microphone
* and start updating the view provided by getView(). It is the caller's
* responsibility to ensure that the view is visible to the user at this stage.
*
* @param context the same FieldContext supplied to voiceIsEnabled()
* @param swipe whether this voice input was started by swipe, for logging purposes
*/
public void startListening(FieldContext context, boolean swipe) {
mState = DEFAULT;
Locale locale = Locale.getDefault();
String localeString = locale.getLanguage() + "-" + locale.getCountry();
mLogger.start(localeString, swipe);
mState = LISTENING;
mRecognitionView.showInitializing();
startListeningAfterInitialization(context);
}
/**
* Called only when the recognition manager's initialization completed
*
* @param context context with which {@link #startListening(FieldContext, boolean)} was executed
*/
private void startListeningAfterInitialization(FieldContext context) {
Intent intent = makeIntent();
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "");
intent.putExtra(EXTRA_RECOGNITION_CONTEXT, context.getBundle());
intent.putExtra(EXTRA_CALLING_PACKAGE, "VoiceIME");
intent.putExtra(EXTRA_ALTERNATES, true);
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,
SettingsUtil.getSettingsInt(
mContext.getContentResolver(),
SettingsUtil.LATIN_IME_MAX_VOICE_RESULTS,
1));
// Get endpointer params from Gservices.
// TODO: Consider caching these values for improved performance on slower devices.
final ContentResolver cr = mContext.getContentResolver();
putEndpointerExtra(
cr,
intent,
SettingsUtil.LATIN_IME_SPEECH_MINIMUM_LENGTH_MILLIS,
EXTRA_SPEECH_MINIMUM_LENGTH_MILLIS,
null /* rely on endpointer default */);
putEndpointerExtra(
cr,
intent,
SettingsUtil.LATIN_IME_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS,
EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS,
INPUT_COMPLETE_SILENCE_LENGTH_DEFAULT_VALUE_MILLIS
/* our default value is different from the endpointer's */);
putEndpointerExtra(
cr,
intent,
SettingsUtil.
LATIN_IME_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS,
EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS,
null /* rely on endpointer default */);
mSpeechRecognizer.startListening(intent);
}
/**
* Gets the value of the provided Gservices key, attempts to parse it into a long,
* and if successful, puts the long value as an extra in the provided intent.
*/
private void putEndpointerExtra(ContentResolver cr, Intent i,
String gservicesKey, String intentExtraKey, String defaultValue) {
long l = -1;
String s = SettingsUtil.getSettingsString(cr, gservicesKey, defaultValue);
if (s != null) {
try {
l = Long.valueOf(s);
} catch (NumberFormatException e) {
Log.e(TAG, "could not parse value for " + gservicesKey + ": " + s);
}
}
if (l != -1) i.putExtra(intentExtraKey, l);
}
public void destroy() {
mSpeechRecognizer.destroy();
}
/**
* Creates a new instance of the view that is returned by {@link #getView()}
* Clients should use this when a previously returned view is stuck in a
* layout that is being thrown away and a new one is need to show to the
* user.
*/
public void newView() {
mRecognitionView = new RecognitionView(mContext, this);
}
/**
* @return a view that shows the recognition flow--e.g., "Speak now" and
* "working" dialogs.
*/
public View getView() {
return mRecognitionView.getView();
}
/**
* Handle the cancel button.
*/
public void onClick(View view) {
switch(view.getId()) {
case R.id.button:
cancel();
break;
}
}
public void logTextModifiedByTypingInsertion(int length) {
mLogger.textModifiedByTypingInsertion(length);
}
public void logTextModifiedByTypingInsertionPunctuation(int length) {
mLogger.textModifiedByTypingInsertionPunctuation(length);
}
public void logTextModifiedByTypingDeletion(int length) {
mLogger.textModifiedByTypingDeletion(length);
}
public void logTextModifiedByChooseSuggestion(String suggestion, int index,
String wordSeparators, InputConnection ic) {
EditingUtil.Range range = new EditingUtil.Range();
String wordToBeReplaced = EditingUtil.getWordAtCursor(ic, wordSeparators, range);
// If we enable phrase-based alternatives, only send up the first word
// in suggestion and wordToBeReplaced.
mLogger.textModifiedByChooseSuggestion(suggestion.length(), wordToBeReplaced.length(),
index, wordToBeReplaced, suggestion);
}
public void logKeyboardWarningDialogShown() {
mLogger.keyboardWarningDialogShown();
}
public void logKeyboardWarningDialogDismissed() {
mLogger.keyboardWarningDialogDismissed();
}
public void logKeyboardWarningDialogOk() {
mLogger.keyboardWarningDialogOk();
}
public void logKeyboardWarningDialogCancel() {
mLogger.keyboardWarningDialogCancel();
}
public void logSwipeHintDisplayed() {
mLogger.swipeHintDisplayed();
}
public void logPunctuationHintDisplayed() {
mLogger.punctuationHintDisplayed();
}
public void logVoiceInputDelivered(int length) {
mLogger.voiceInputDelivered(length);
}
public void logInputEnded() {
mLogger.inputEnded();
}
public void flushLogs() {
mLogger.flush();
}
private static Intent makeIntent() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
// On Cupcake, use VoiceIMEHelper since VoiceSearch doesn't support.
// On Donut, always use VoiceSearch, since VoiceIMEHelper and
// VoiceSearch may conflict.
if (Build.VERSION.RELEASE.equals("1.5")) {
intent = intent.setClassName(
"com.google.android.voiceservice",
"com.google.android.voiceservice.IMERecognitionService");
} else {
intent = intent.setClassName(
"com.google.android.voicesearch",
"com.google.android.voicesearch.RecognitionService");
}
return intent;
}
/**
* Cancel in-progress speech recognition.
*/
public void cancel() {
switch (mState) {
case LISTENING:
mLogger.cancelDuringListening();
break;
case WORKING:
mLogger.cancelDuringWorking();
break;
case ERROR:
mLogger.cancelDuringError();
break;
}
mState = DEFAULT;
// Remove all pending tasks (e.g., timers to cancel voice input)
mHandler.removeMessages(MSG_CLOSE_ERROR_DIALOG);
mSpeechRecognizer.cancel();
mUiListener.onCancelVoice();
mRecognitionView.finish();
}
private int getErrorStringId(int errorType, boolean endpointed) {
switch (errorType) {
// We use CLIENT_ERROR to signify that voice search is not available on the device.
case SpeechRecognizer.ERROR_CLIENT:
return R.string.voice_not_installed;
case SpeechRecognizer.ERROR_NETWORK:
return R.string.voice_network_error;
case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
return endpointed ?
R.string.voice_network_error : R.string.voice_too_much_speech;
case SpeechRecognizer.ERROR_AUDIO:
return R.string.voice_audio_error;
case SpeechRecognizer.ERROR_SERVER:
return R.string.voice_server_error;
case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
return R.string.voice_speech_timeout;
case SpeechRecognizer.ERROR_NO_MATCH:
return R.string.voice_no_match;
default: return R.string.voice_error;
}
}
private void onError(int errorType, boolean endpointed) {
Log.i(TAG, "error " + errorType);
mLogger.error(errorType);
onError(mContext.getString(getErrorStringId(errorType, endpointed)));
}
private void onError(String error) {
mState = ERROR;
mRecognitionView.showError(error);
// Wait a couple seconds and then automatically dismiss message.
mHandler.sendMessageDelayed(Message.obtain(mHandler, MSG_CLOSE_ERROR_DIALOG), 2000);
}
private class ImeRecognitionListener implements RecognitionListener {
// Waveform data
final ByteArrayOutputStream mWaveBuffer = new ByteArrayOutputStream();
int mSpeechStart;
private boolean mEndpointed = false;
public void onReadyForSpeech(Bundle noiseParams) {
mRecognitionView.showListening();
}
public void onBeginningOfSpeech() {
mEndpointed = false;
mSpeechStart = mWaveBuffer.size();
}
public void onRmsChanged(float rmsdB) {
mRecognitionView.updateVoiceMeter(rmsdB);
}
public void onBufferReceived(byte[] buf) {
try {
mWaveBuffer.write(buf);
} catch (IOException e) {}
}
public void onEndOfSpeech() {
mEndpointed = true;
mState = WORKING;
mRecognitionView.showWorking(mWaveBuffer, mSpeechStart, mWaveBuffer.size());
}
public void onError(int errorType) {
mState = ERROR;
VoiceInput.this.onError(errorType, mEndpointed);
}
public void onResults(Bundle resultsBundle) {
List<String> results = resultsBundle
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
// VS Market update is needed for IME froyo clients to access the alternatesBundle
// TODO: verify this.
Bundle alternatesBundle = resultsBundle.getBundle(ALTERNATES_BUNDLE);
mState = DEFAULT;
final Map<String, List<CharSequence>> alternatives =
new HashMap<String, List<CharSequence>>();
if (ENABLE_WORD_CORRECTIONS && alternatesBundle != null && results.size() > 0) {
// Use the top recognition result to map each alternative's start:length to a word.
String[] words = results.get(0).split(" ");
Bundle spansBundle = alternatesBundle.getBundle(AlternatesBundleKeys.SPANS);
for (String key : spansBundle.keySet()) {
// Get the word for which these alternates correspond to.
Bundle spanBundle = spansBundle.getBundle(key);
int start = spanBundle.getInt(AlternatesBundleKeys.START);
int length = spanBundle.getInt(AlternatesBundleKeys.LENGTH);
// Only keep single-word based alternatives.
if (length == 1 && start < words.length) {
// Get the alternatives associated with the span.
// If a word appears twice in a recognition result,
// concatenate the alternatives for the word.
List<CharSequence> altList = alternatives.get(words[start]);
if (altList == null) {
altList = new ArrayList<CharSequence>();
alternatives.put(words[start], altList);
}
Parcelable[] alternatesArr = spanBundle
.getParcelableArray(AlternatesBundleKeys.ALTERNATES);
for (int j = 0; j < alternatesArr.length &&
altList.size() < MAX_ALT_LIST_LENGTH; j++) {
Bundle alternateBundle = (Bundle) alternatesArr[j];
String alternate = alternateBundle.getString(AlternatesBundleKeys.TEXT);
// Don't allow duplicates in the alternates list.
if (!altList.contains(alternate)) {
altList.add(alternate);
}
}
}
}
}
if (results.size() > 5) {
results = results.subList(0, 5);
}
mUiListener.onVoiceResults(results, alternatives);
mRecognitionView.finish();
}
public void onPartialResults(final Bundle partialResults) {
// currently - do nothing
}
public void onEvent(int eventType, Bundle params) {
// do nothing - reserved for events that might be added in the future
}
}
}
| [
"austin@austinbaum.com"
] | austin@austinbaum.com |
a35e8fdef71c0e34f756423b38f6a7d0a74fbef0 | def7b5719e8f1363f8bcdcdb95a1abc7e276488e | /src/main/java/com/qttd/model/response/ReviewResponseModel.java | e56b5ff6d88896c5fcf59a3ddefae0da1d11c73e | [] | no_license | thaithong12/HotelManagementSystem | 931efd5d9f3cdd4ca89e13bbba0a651acc2df179 | 0eb84d59ece0343d64f130adbb6cbe6fd75cef74 | refs/heads/master | 2023-01-24T01:58:51.113091 | 2020-12-13T14:39:03 | 2020-12-13T14:39:03 | 307,446,247 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package com.qttd.model.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReviewResponseModel {
private long id;
private String accountName;
private int rate;
private String content;
}
| [
"nguyenthaithong98@gmail.com"
] | nguyenthaithong98@gmail.com |
e6d7d96a00ef5ac345b89ec59ee8e8753c6fba8c | b2be37ccb1a88ad6677bc0a6820f09f9e664240b | /src/main/java/br/com/zallpy/technicalevaluation/service/ProjectService.java | 15a0891da3a3bb555cb345206361a9703b6097a2 | [] | no_license | JonRen61/zallpy-technical-evaluation | ddde976e4891a86bed73b74d91278ef429dcc69e | 8c45483cba7029fb3112c42ae0605a8bee540afb | refs/heads/master | 2023-02-17T07:09:23.366406 | 2021-01-18T13:56:33 | 2021-01-18T13:56:33 | 328,074,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 947 | java | package br.com.zallpy.technicalevaluation.service;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.zallpy.technicalevaluation.dto.ProjectDTO;
import br.com.zallpy.technicalevaluation.repository.ProjectRepository;
@Service
public class ProjectService {
@Autowired
private ProjectRepository projectRepository;
public List<ProjectDTO> listByUserId(int userId) {
return projectRepository.findByUserId(userId).orElse(Collections.emptyList()).stream().map(ProjectDTO::new).collect(Collectors.toList());
}
public void update(ProjectDTO projectDTO) {
projectRepository.save(projectDTO.getProject());
}
public ProjectDTO findById(int projectId) {
return new ProjectDTO(projectRepository.findById(projectId).orElse(null));
}
}
| [
"jonathanmaraujo@gmail.com"
] | jonathanmaraujo@gmail.com |
bc5067225317891eacb8ac2a90046a86764284ee | 352bb50b26238eeb42966620fa0265d3aafd2576 | /src/main/java/com/team2/router/controller/ProdDescPageController.java | 9eb09cadf7c40e6bf6af5179978194d68d7a28c0 | [] | no_license | LovenishSinghPanwar1997/ecommerce-router | f5847642a62b9e8fd1786a8c6d9d1b73fb8f37d3 | aa0cb2177661f0427ba89cdbdc1aaef2eb2f22ed | refs/heads/master | 2020-12-28T05:02:42.679090 | 2020-02-04T11:26:25 | 2020-02-04T11:26:25 | 238,189,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package com.team2.router.controller;
import com.team2.router.base.BaseResponse;
import com.team2.router.dto.responseDTO.ProdDescPageDTO;
import com.team2.router.service.ProdDescPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/product/description")
@CrossOrigin(origins = {"*"})
public class ProdDescPageController {
@Autowired
private ProdDescPageService prodDescPageService;
@GetMapping("/{productId}")
public BaseResponse<ProdDescPageDTO> getProductById(@PathVariable("productId") String productId)
{
return new BaseResponse<>(prodDescPageService.getProductById(productId));
}
}
| [
"singhlovenish1997@gmail.com"
] | singhlovenish1997@gmail.com |
b09eae7edfe3c9a7edd043850cabc6adc9fd7161 | 0eeb6a3c2030c4164ce1d18fd0a1698f2b669367 | /src/main/java/bizseer/demik/letcode/easy/RemoveColumnCreateOrder944.java | 0f891aa40b9ad5f68edf600563ec2fdb493b72cb | [] | no_license | AthyLau/letcode | cbe5295144c1f7cf533576eb658bdb0e167e02da | b1209691ddd6f31091875ce550e7c4732ae7f4bb | refs/heads/master | 2021-06-19T20:48:08.059869 | 2019-11-21T02:16:22 | 2019-11-21T02:16:22 | 203,784,741 | 0 | 0 | null | 2019-11-21T02:16:25 | 2019-08-22T11:52:14 | Java | UTF-8 | Java | false | false | 2,310 | java | package bizseer.demik.letcode.easy;
/**
* Function:
* 给定由 N 个小写字母字符串组成的数组 A,其中每个字符串长度相等。
* <p>
* 删除 操作的定义是:选出一组要删掉的列,删去 A 中对应列中的所有字符,形式上,第 n 列为 [A[0][n], A[1][n], ..., A[A.length-1][n]])。
* <p>
* 比如,有 A = ["abcdef", "uvwxyz"],
* <p>
* <p>
* <p>
* 要删掉的列为 {0, 2, 3},删除后 A 为["bef", "vyz"], A 的列分别为["b","v"], ["e","y"], ["f","z"]。
* <p>
* <p>
* <p>
* 你需要选出一组要删掉的列 D,对 A 执行删除操作,使 A 中剩余的每一列都是 非降序 排列的,然后请你返回 D.length 的最小可能值。
* <p>
*
* <p>
* 示例 1:
* <p>
* 输入:["cba", "daf", "ghi"]
* 输出:1
* 解释:
* 当选择 D = {1},删除后 A 的列为:["c","d","g"] 和 ["a","f","i"],均为非降序排列。
* 若选择 D = {},那么 A 的列 ["b","a","h"] 就不是非降序排列了。
* 示例 2:
* <p>
* 输入:["a", "b"]
* 输出:0
* 解释:D = {}
* 示例 3:
* <p>
* 输入:["zyx", "wvu", "tsr"]
* 输出:3
* 解释:D = {0, 1, 2}
*
* <p>
* 提示:
* <p>
* 1 <= A.length <= 100
* 1 <= A[i].length <= 1000
* <p>
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/delete-columns-to-make-sorted
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*
* @author liubing
* Date: 2019/9/10 1:31 PM
* @since JDK 1.8
*/
public class RemoveColumnCreateOrder944 {
public static void main(String args[]){
System.out.println(minDeletionSize(new String[]{"cba", "daf", "ghi"}));
}
public static int minDeletionSize(String[] A) {
int ret = 0;
if (A == null || A.length == 0) {
return ret;
}else {
char c;
for(int i = 0; i < A[0].length(); i++){
c = 'a'-1;
for (String s : A) {
if (s.charAt(i) < c) {
ret++;
break;
}else {
c = s.charAt(i);
}
}
}
}
return ret;
}
}
| [
"1015141113@qq.com"
] | 1015141113@qq.com |
1ed052424862d355a5a6ac5ecdfe5f582a611973 | 5334ccd599ffbfa9f2f7cf3b99db94e1764023f4 | /msc-common/src/test/java/collection/StreamTest.java | 04d61dc2418dd842054a488e031ebbf887d86375 | [] | no_license | wenton1993/msc | 1b98997095426efbc0aa5d18022f4d492dcb340a | 26436465b232587d69b4c5e5d024aeb4a5fcab99 | refs/heads/master | 2023-04-09T07:34:04.652180 | 2021-04-21T08:56:49 | 2021-04-21T08:56:49 | 176,239,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,157 | java | package collection;
import com.wt.myspringcloud.common.pojo.entity.WtUser;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author 文通
* @since 2019/5/31
*/
public class StreamTest {
public static void main(String[] args) {
List<WtUser> userList = new ArrayList<>();
for (int i = 0; i < 3; i++) {
WtUser user = new WtUser();
user.setId(Integer.valueOf(i).longValue());
user.setName("demo" + i);
user.setAge(i);
userList.add(user);
}
WtUser user = new WtUser();
user.setId(4L);
user.setName("user4");
user.setAge(2);
userList.add(user);
Optional<WtUser> max = userList.stream().max(Comparator.comparingInt(WtUser::getAge));
System.out.println("max: " + max.get());
Optional<Integer> reduce = userList.stream().map(WtUser::getAge).reduce(Integer::sum);
System.out.println("reduce: " + reduce.get());
Map<Integer, List<WtUser>> collect = userList.stream().collect(Collectors.groupingBy(WtUser::getAge));
System.out.println("collect: " + collect);
}
}
| [
"340192693@qq.com"
] | 340192693@qq.com |
791f31e81264dcf78f0ae5140b4271009c56f72b | 6d51441e226fee6eb44ba87dd20e3e4534ac46d5 | /src/main/java/com/ruoyi/project/monitor/server/domain/Cpu.java | 432b4cde13a7604375e86b92efcd4d47d80b56b0 | [
"MIT"
] | permissive | guoop/ZKHR_ST | 799f9431f02ba782d949cafc2a4bd403e1521de2 | d5b62203103f0f4b04f8c28beb826f36ff64fd02 | refs/heads/master | 2022-09-10T07:33:37.437557 | 2019-09-24T05:13:48 | 2019-09-24T05:13:48 | 210,486,314 | 0 | 0 | MIT | 2022-09-01T23:13:27 | 2019-09-24T01:39:00 | JavaScript | UTF-8 | Java | false | false | 1,681 | java | package com.ruoyi.project.monitor.server.domain;
import com.ruoyi.common.utils.Arith;
/**
* CPU相关信息
*
* @author admin
*/
public class Cpu
{
/**
* 核心数
*/
private int cpuNum;
/**
* CPU总的使用率
*/
private double total;
/**
* CPU系统使用率
*/
private double sys;
/**
* CPU用户使用率
*/
private double used;
/**
* CPU当前等待率
*/
private double wait;
/**
* CPU当前空闲率
*/
private double free;
public int getCpuNum()
{
return cpuNum;
}
public void setCpuNum(int cpuNum)
{
this.cpuNum = cpuNum;
}
public double getTotal()
{
return Arith.round(Arith.mul(total, 100), 2);
}
public void setTotal(double total)
{
this.total = total;
}
public double getSys()
{
return Arith.round(Arith.mul(sys / total, 100), 2);
}
public void setSys(double sys)
{
this.sys = sys;
}
public double getUsed()
{
return Arith.round(Arith.mul(used / total, 100), 2);
}
public void setUsed(double used)
{
this.used = used;
}
public double getWait()
{
return Arith.round(Arith.mul(wait / total, 100), 2);
}
public void setWait(double wait)
{
this.wait = wait;
}
public double getFree()
{
return Arith.round(Arith.mul(free / total, 100), 2);
}
public void setFree(double free)
{
this.free = free;
}
}
| [
"744964089@qq.com"
] | 744964089@qq.com |
4b003c986dabe3163c3bfdc523a6eb5ece2672d2 | bc2f8ba78e82111e436ee313799d32ba2bd895ae | /src/day06nestedifternaryswitchstringmethods/SwitchStatement01NameOftheDays.java | 498de98ac40c80b8cc845e6e1f31806d9fa9f3e4 | [] | no_license | Slymn2736/winterjava | 50f76f0b211426722be4ac4164b0b8e8df5eae8d | 273c8b4bdb726aea158c742f998f568293d29552 | refs/heads/main | 2023-03-30T17:19:02.546466 | 2021-04-04T20:27:54 | 2021-04-04T20:27:54 | 343,984,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,576 | java | package day06nestedifternaryswitchstringmethods;
import java.util.Scanner;
public class SwitchStatement01NameOftheDays {
/*
Ask user to enter the number of a day then your program will type the name of the day
Sunday = 1, Monday = 2, ... Saturday = 7
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Please enter number of a day");
int d =scan.nextInt();
//1. Way:by using if-esle-if
/*
* if(d==1) { System.out.println("Sunday"); }else if(d==2) {
* System.out.println("Monday"); }else if(d==3) { System.out.println("Tuesday");
* }else if(d==4) { System.out.println("Wednesday"); }else if(d==5) {
* System.out.println("Thursday"); }else if(d==6) {
* System.out.println("Friday"); }else if(d==7) {
* System.out.println("Saturday"); }else {
* System.out.println("Enter a valid day number"); }
*/
//2. Way by using Switch Statement
// in switch statement, long, double, float, boolean cannot be used
// in switch statement String, char, int, byte short can be used
switch(d) {
case 1:
System.out.println("Sunday");
break;
case 2:
System.out.println("Monday");
break;
case 3:
System.out.println("Tuesday");
break;
case 4:
System.out.println("Wednesday");
break;
case 5:
System.out.println("Thursday");
break;
case 6:
System.out.println("Friday");
break;
case 7:
System.out.println("Saturday");
break;
default:
System.out.println("Enter a valid day number");
}
scan.close();
}
}
| [
"gul.szf@gmail.com"
] | gul.szf@gmail.com |
2da80be2537e709ae26e53e101295ff68ad60afa | e4f1e03f32c31fa0f950081ff41153ac8d8eb9de | /app/src/androidTest/java/com/madfish/james/findyourvision/ExampleInstrumentedTest.java | a35645ecaaa83e00bb2e3af8870a295d85e1c30a | [] | no_license | MadfishDT/cameraSiftAndroid | 7e849a0accf90ddd7789b9d7626e33ba3274287d | 0ae9e91b2e31c5d232d0a800d900ef63d6f5ca18 | refs/heads/master | 2021-01-11T15:28:11.154978 | 2017-02-01T13:44:13 | 2017-02-01T13:44:13 | 80,352,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.madfish.james.findyourvision;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.madfish.james.findyourvision", appContext.getPackageName());
}
}
| [
"home"
] | home |
f7141484fd298a478d22397fb03b3e129b15dae1 | e7fefc77843284e86020e4e11fc34d7bc1c3541d | /utils/src/main/java/com/sir/app/utils/CacheUtils.java | 08a828ebbd8af99043606b17ea6d9ff8260335cd | [
"Apache-2.0"
] | permissive | nansir/MyUtils | 191a555e207a6fbf91440a48063799cd6fe977d0 | bfff7226857c4580f923a565b51bbab971a9ef0b | refs/heads/master | 2021-01-15T18:21:42.299367 | 2018-05-17T01:51:24 | 2018-05-17T01:51:24 | 99,780,288 | 9 | 3 | null | null | null | null | UTF-8 | Java | false | false | 28,476 | java | /**
* Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.sir.app.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
/**
* 缓存普通的字符串、JsonObject、JsonArray、Bitmap、Drawable、序列化的java对象,和 byte数据
* Created by zhuyinan on 2017/3/25.
* Contact by 445181052@qq.com
*/
public class CacheUtils {
private CacheUtils() {
throw new UnsupportedOperationException("cannot be instantiated");
}
public static final int TIME_HOUR = 60 * 60;
public static final int TIME_DAY = TIME_HOUR * 24;
private static final int MAX_SIZE = 1000 * 1000 * 50; // 50 mb
private static final int MAX_COUNT = Integer.MAX_VALUE; // 不限制存放数据的数量
private static Map<String, CacheUtils> mInstanceMap = new HashMap<String, CacheUtils>();
private ACacheManager mCache;
public static CacheUtils getInstance(Context ctx) {
return getInstance(ctx, "CacheUtils");
}
public static CacheUtils getInstance(Context ctx, String cacheName) {
File f = new File(ctx.getCacheDir(), cacheName);
return getInstance(f, MAX_SIZE, MAX_COUNT);
}
public static CacheUtils getInstance(File cacheDir) {
return getInstance(cacheDir, MAX_SIZE, MAX_COUNT);
}
public static CacheUtils getInstance(Context ctx, long max_size, int max_count) {
File f = new File(ctx.getCacheDir(), "CacheUtils");
return getInstance(f, max_size, max_count);
}
public static CacheUtils getInstance(File cacheDir, long max_size, int max_count) {
CacheUtils manager = mInstanceMap.get(cacheDir.getAbsoluteFile() + myPid());
if (manager == null) {
manager = new CacheUtils(cacheDir, max_size, max_count);
mInstanceMap.put(cacheDir.getAbsolutePath() + myPid(), manager);
}
return manager;
}
private static String myPid() {
return "_" + android.os.Process.myPid();
}
private CacheUtils(File cacheDir, long max_size, int max_count) {
if (!cacheDir.exists() && !cacheDir.mkdirs()) {
throw new RuntimeException("can't make dirs in "
+ cacheDir.getAbsolutePath());
}
mCache = new ACacheManager(cacheDir, max_size, max_count);
}
/**
* Provides a means to save a cached file before the data are available.
* Since writing about the file is complete, and its close method is called,
* its contents will be registered in the cache. Example of use:
*
* CacheUtils cache = new CacheUtils(this) try { OutputStream stream =
* cache.put("myFileName") stream.write("some bytes".getBytes()); // now
* update cache! stream.close(); } catch(FileNotFoundException e){
* e.printStackTrace() }
*/
class xFileOutputStream extends FileOutputStream {
File file;
public xFileOutputStream(File file) throws FileNotFoundException {
super(file);
this.file = file;
}
public void close() throws IOException {
super.close();
mCache.put(file);
}
}
// =======================================
// ============ String数据 读写 ==============
// =======================================
/**
* 保存 String数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的String数据
*/
public void put(String key, String value) {
File file = mCache.newFile(key);
BufferedWriter out = null;
try {
out = new BufferedWriter(new FileWriter(file), 1024);
out.write(value);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
mCache.put(file);
}
}
/**
* 保存 String数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的String数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, String value, int saveTime) {
put(key, Utils.newStringWithDateInfo(saveTime, value));
}
/**
* 读取 String数据
*
* @param key
* @return String 数据
*/
public String getAsString(String key) {
File file = mCache.get(key);
if (!file.exists())
return null;
boolean removeFile = false;
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(file));
String readString = "";
String currentLine;
while ((currentLine = in.readLine()) != null) {
readString += currentLine;
}
if (!Utils.isDue(readString)) {
return Utils.clearDateInfo(readString);
} else {
removeFile = true;
return null;
}
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (removeFile)
remove(key);
}
}
// =======================================
// ============= JSONObject 数据 读写 ==============
// =======================================
/**
* 保存 JSONObject数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的JSON数据
*/
public void put(String key, JSONObject value) {
put(key, value.toString());
}
/**
* 保存 JSONObject数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的JSONObject数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, JSONObject value, int saveTime) {
put(key, value.toString(), saveTime);
}
/**
* 读取JSONObject数据
*
* @param key
* @return JSONObject数据
*/
public JSONObject getAsJSONObject(String key) {
String JSONString = getAsString(key);
try {
JSONObject obj = new JSONObject(JSONString);
return obj;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
// =======================================
// ============ JSONArray 数据 读写 =============
// =======================================
/**
* 保存 JSONArray数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的JSONArray数据
*/
public void put(String key, JSONArray value) {
put(key, value.toString());
}
/**
* 保存 JSONArray数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的JSONArray数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, JSONArray value, int saveTime) {
put(key, value.toString(), saveTime);
}
/**
* 读取JSONArray数据
*
* @param key
* @return JSONArray数据
*/
public JSONArray getAsJSONArray(String key) {
String JSONString = getAsString(key);
try {
JSONArray obj = new JSONArray(JSONString);
return obj;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
// =======================================
// ============== byte 数据 读写 =============
// =======================================
/**
* 保存 byte数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的数据
*/
public void put(String key, byte[] value) {
File file = mCache.newFile(key);
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
out.write(value);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
mCache.put(file);
}
}
/**
* Cache for a stream
*
* @param key
* the file name.
* @return OutputStream stream for writing data.
* @throws FileNotFoundException
* if the file can not be created.
*/
public OutputStream put(String key) throws FileNotFoundException {
return new xFileOutputStream(mCache.newFile(key));
}
/**
*
* @param key
* the file name.
* @return (InputStream or null) stream previously saved in cache.
* @throws FileNotFoundException
* if the file can not be opened
*/
public InputStream get(String key) throws FileNotFoundException {
File file = mCache.get(key);
if (!file.exists())
return null;
return new FileInputStream(file);
}
/**
* 保存 byte数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, byte[] value, int saveTime) {
put(key, Utils.newByteArrayWithDateInfo(saveTime, value));
}
/**
* 获取 byte 数据
*
* @param key
* @return byte 数据
*/
public byte[] getAsBinary(String key) {
RandomAccessFile RAFile = null;
boolean removeFile = false;
try {
File file = mCache.get(key);
if (!file.exists())
return null;
RAFile = new RandomAccessFile(file, "r");
byte[] byteArray = new byte[(int) RAFile.length()];
RAFile.read(byteArray);
if (!Utils.isDue(byteArray)) {
return Utils.clearDateInfo(byteArray);
} else {
removeFile = true;
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (RAFile != null) {
try {
RAFile.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (removeFile)
remove(key);
}
}
// =======================================
// ============= 序列化 数据 读写 ===============
// =======================================
/**
* 保存 Serializable数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的value
*/
public void put(String key, Serializable value) {
put(key, value, -1);
}
/**
* 保存 Serializable数据到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的value
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, Serializable value, int saveTime) {
ByteArrayOutputStream baos = null;
ObjectOutputStream oos = null;
try {
baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos);
oos.writeObject(value);
byte[] data = baos.toByteArray();
if (saveTime != -1) {
put(key, data, saveTime);
} else {
put(key, data);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
oos.close();
} catch (IOException e) {
}
}
}
/**
* 读取 Serializable数据
*
* @param key
* @return Serializable 数据
*/
public Object getAsObject(String key) {
byte[] data = getAsBinary(key);
if (data != null) {
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
try {
bais = new ByteArrayInputStream(data);
ois = new ObjectInputStream(bais);
Object reObject = ois.readObject();
return reObject;
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
try {
if (bais != null)
bais.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
if (ois != null)
ois.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
// =======================================
// ============== bitmap 数据 读写 =============
// =======================================
/**
* 保存 bitmap 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的bitmap数据
*/
public void put(String key, Bitmap value) {
put(key, Utils.Bitmap2Bytes(value));
}
/**
* 保存 bitmap 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的 bitmap 数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, Bitmap value, int saveTime) {
put(key, Utils.Bitmap2Bytes(value), saveTime);
}
/**
* 读取 bitmap 数据
*
* @param key
* @return bitmap 数据
*/
public Bitmap getAsBitmap(String key) {
if (getAsBinary(key) == null) {
return null;
}
return Utils.Bytes2Bimap(getAsBinary(key));
}
// =======================================
// ============= drawable 数据 读写 =============
// =======================================
/**
* 保存 drawable 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的drawable数据
*/
public void put(String key, Drawable value) {
put(key, Utils.drawable2Bitmap(value));
}
/**
* 保存 drawable 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的 drawable 数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, Drawable value, int saveTime) {
put(key, Utils.drawable2Bitmap(value), saveTime);
}
/**
* 读取 Drawable 数据
*
* @param key
* @return Drawable 数据
*/
public Drawable getAsDrawable(String key) {
if (getAsBinary(key) == null) {
return null;
}
return Utils.bitmap2Drawable(Utils.Bytes2Bimap(getAsBinary(key)));
}
/**
* 获取缓存文件
*
* @param key
* @return value 缓存的文件
*/
public File file(String key) {
File f = mCache.newFile(key);
if (f.exists())
return f;
return null;
}
/**
* 移除某个key
*
* @param key
* @return 是否移除成功
*/
public boolean remove(String key) {
return mCache.remove(key);
}
/**
* 清除所有数据
*/
public void clear() {
mCache.clear();
}
/**
* @title 缓存管理器
* @author 杨福海(michael) www.yangfuhai.com
* @version 1.0
*/
public class ACacheManager {
private final AtomicLong cacheSize;
private final AtomicInteger cacheCount;
private final long sizeLimit;
private final int countLimit;
private final Map<File, Long> lastUsageDates = Collections
.synchronizedMap(new HashMap<File, Long>());
protected File cacheDir;
private ACacheManager(File cacheDir, long sizeLimit, int countLimit) {
this.cacheDir = cacheDir;
this.sizeLimit = sizeLimit;
this.countLimit = countLimit;
cacheSize = new AtomicLong();
cacheCount = new AtomicInteger();
calculateCacheSizeAndCacheCount();
}
/**
* 计算 cacheSize和cacheCount
*/
private void calculateCacheSizeAndCacheCount() {
new Thread(new Runnable() {
@Override
public void run() {
int size = 0;
int count = 0;
File[] cachedFiles = cacheDir.listFiles();
if (cachedFiles != null) {
for (File cachedFile : cachedFiles) {
size += calculateSize(cachedFile);
count += 1;
lastUsageDates.put(cachedFile,
cachedFile.lastModified());
}
cacheSize.set(size);
cacheCount.set(count);
}
}
}).start();
}
private void put(File file) {
int curCacheCount = cacheCount.get();
while (curCacheCount + 1 > countLimit) {
long freedSize = removeNext();
cacheSize.addAndGet(-freedSize);
curCacheCount = cacheCount.addAndGet(-1);
}
cacheCount.addAndGet(1);
long valueSize = calculateSize(file);
long curCacheSize = cacheSize.get();
while (curCacheSize + valueSize > sizeLimit) {
long freedSize = removeNext();
curCacheSize = cacheSize.addAndGet(-freedSize);
}
cacheSize.addAndGet(valueSize);
Long currentTime = System.currentTimeMillis();
file.setLastModified(currentTime);
lastUsageDates.put(file, currentTime);
}
private File get(String key) {
File file = newFile(key);
Long currentTime = System.currentTimeMillis();
file.setLastModified(currentTime);
lastUsageDates.put(file, currentTime);
return file;
}
private File newFile(String key) {
return new File(cacheDir, key.hashCode() + "");
}
private boolean remove(String key) {
File image = get(key);
return image.delete();
}
private void clear() {
lastUsageDates.clear();
cacheSize.set(0);
File[] files = cacheDir.listFiles();
if (files != null) {
for (File f : files) {
f.delete();
}
}
}
/**
* 移除旧的文件
*
* @return
*/
private long removeNext() {
if (lastUsageDates.isEmpty()) {
return 0;
}
Long oldestUsage = null;
File mostLongUsedFile = null;
Set<Entry<File, Long>> entries = lastUsageDates.entrySet();
synchronized (lastUsageDates) {
for (Entry<File, Long> entry : entries) {
if (mostLongUsedFile == null) {
mostLongUsedFile = entry.getKey();
oldestUsage = entry.getValue();
} else {
Long lastValueUsage = entry.getValue();
if (lastValueUsage < oldestUsage) {
oldestUsage = lastValueUsage;
mostLongUsedFile = entry.getKey();
}
}
}
}
long fileSize = calculateSize(mostLongUsedFile);
if (mostLongUsedFile.delete()) {
lastUsageDates.remove(mostLongUsedFile);
}
return fileSize;
}
private long calculateSize(File file) {
return file.length();
}
}
/**
* @title 时间计算工具类
* @author 杨福海(michael) www.yangfuhai.com
* @version 1.0
*/
private static class Utils {
/**
* 判断缓存的String数据是否到期
*
* @param str
* @return true:到期了 false:还没有到期
*/
private static boolean isDue(String str) {
return isDue(str.getBytes());
}
/**
* 判断缓存的byte数据是否到期
*
* @param data
* @return true:到期了 false:还没有到期
*/
private static boolean isDue(byte[] data) {
String[] strs = getDateInfoFromDate(data);
if (strs != null && strs.length == 2) {
String saveTimeStr = strs[0];
while (saveTimeStr.startsWith("0")) {
saveTimeStr = saveTimeStr
.substring(1, saveTimeStr.length());
}
long saveTime = Long.valueOf(saveTimeStr);
long deleteAfter = Long.valueOf(strs[1]);
if (System.currentTimeMillis() > saveTime + deleteAfter * 1000) {
return true;
}
}
return false;
}
private static String newStringWithDateInfo(int second, String strInfo) {
return createDateInfo(second) + strInfo;
}
private static byte[] newByteArrayWithDateInfo(int second, byte[] data2) {
byte[] data1 = createDateInfo(second).getBytes();
byte[] retdata = new byte[data1.length + data2.length];
System.arraycopy(data1, 0, retdata, 0, data1.length);
System.arraycopy(data2, 0, retdata, data1.length, data2.length);
return retdata;
}
private static String clearDateInfo(String strInfo) {
if (strInfo != null && hasDateInfo(strInfo.getBytes())) {
strInfo = strInfo.substring(strInfo.indexOf(mSeparator) + 1,
strInfo.length());
}
return strInfo;
}
private static byte[] clearDateInfo(byte[] data) {
if (hasDateInfo(data)) {
return copyOfRange(data, indexOf(data, mSeparator) + 1,
data.length);
}
return data;
}
private static boolean hasDateInfo(byte[] data) {
return data != null && data.length > 15 && data[13] == '-'
&& indexOf(data, mSeparator) > 14;
}
private static String[] getDateInfoFromDate(byte[] data) {
if (hasDateInfo(data)) {
String saveDate = new String(copyOfRange(data, 0, 13));
String deleteAfter = new String(copyOfRange(data, 14,
indexOf(data, mSeparator)));
return new String[]{saveDate, deleteAfter};
}
return null;
}
private static int indexOf(byte[] data, char c) {
for (int i = 0; i < data.length; i++) {
if (data[i] == c) {
return i;
}
}
return -1;
}
private static byte[] copyOfRange(byte[] original, int from, int to) {
int newLength = to - from;
if (newLength < 0)
throw new IllegalArgumentException(from + " > " + to);
byte[] copy = new byte[newLength];
System.arraycopy(original, from, copy, 0,
Math.min(original.length - from, newLength));
return copy;
}
private static final char mSeparator = ' ';
private static String createDateInfo(int second) {
String currentTime = System.currentTimeMillis() + "";
while (currentTime.length() < 13) {
currentTime = "0" + currentTime;
}
return currentTime + "-" + second + mSeparator;
}
/*
* Bitmap → byte[]
*/
private static byte[] Bitmap2Bytes(Bitmap bm) {
if (bm == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
return baos.toByteArray();
}
/*
* byte[] → Bitmap
*/
private static Bitmap Bytes2Bimap(byte[] b) {
if (b.length == 0) {
return null;
}
return BitmapFactory.decodeByteArray(b, 0, b.length);
}
/*
* Drawable → Bitmap
*/
private static Bitmap drawable2Bitmap(Drawable drawable) {
if (drawable == null) {
return null;
}
// 取 drawable 的长宽
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
// 取 drawable 的颜色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;
// 建立对应 bitmap
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
// 建立对应 bitmap 的画布
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
// 把 drawable 内容画到画布中
drawable.draw(canvas);
return bitmap;
}
/*
* Bitmap → Drawable
*/
@SuppressWarnings("deprecation")
private static Drawable bitmap2Drawable(Bitmap bm) {
if (bm == null) {
return null;
}
BitmapDrawable bd = new BitmapDrawable(bm);
bd.setTargetDensity(bm.getDensity());
return new BitmapDrawable(bm);
}
}
}
| [
"445181052@qq.com"
] | 445181052@qq.com |
c891ac9543e39df2cde6a93dc2d448ae928eb7aa | bafd02252af46dca288f70a53f70cd3f662fff46 | /modules/app-layer/src/main/java/edu/emory/bmi/niffler/csv/core/CsvReader.java | 55d07c0db6771fb0bae0a3dd64928c4b4738ca7b | [
"BSD-3-Clause"
] | permissive | Bhavyashu/Niffler | ef4a4484a7b325f51be83c65b1413294f1da4f3c | a659b43563f7b9fef35afb636d608d01e9e19382 | refs/heads/master | 2023-07-24T00:43:00.621181 | 2021-09-08T03:48:15 | 2021-09-08T03:48:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,766 | java | package edu.emory.bmi.niffler.csv.core;
import com.opencsv.bean.ColumnPositionMappingStrategy;
import com.opencsv.bean.CsvToBean;
import com.opencsv.bean.CsvToBeanBuilder;
import com.opencsv.exceptions.CsvValidationException;
import edu.emory.bmi.niffler.csv.scanner_util.FilterCsvBean;
import edu.emory.bmi.niffler.csv.scanner_util.IntermediaryCsvBean;
import edu.emory.bmi.niffler.util.NifflerConstants;
import edu.emory.bmi.niffler.csv.scanner_util.ScannerUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
/**
* Read CSV files
*/
public class CsvReader {
private static Logger logger = LogManager.getLogger(CsvReader.class.getName());
/**
* Reads the files in the intermediary csv folder
* @throws IOException if the execution failed
*/
public static void readIntermediaryCSVFolder() throws IOException {
File folder = new File(NifflerConstants.INTERMEDIARY_DIRECTORY);
File subset = new File(NifflerConstants.SUBSET_SCANNERS);
int index = 1;
List<String> fileNames = new ArrayList<>();
File[] listOfFiles = folder.listFiles();
try {
String subsetStr = subset.toString();
Path subsetPath = Paths.get(subsetStr);
List<AbstractCsvBean> subsetout = convertToBean(subsetPath, FilterCsvBean.class);
Map<String, String> scannersSubsetMap = new HashMap<>();
for (AbstractCsvBean fbean: subsetout) {
scannersSubsetMap.put(fbean.getScanner(), fbean.getDetails());
}
for (File file: listOfFiles) {
String fileStr = file.toString();
fileNames.add(fileStr);
}
Collections.sort(fileNames);
for (String fileStr: fileNames) {
try {
Path path = Paths.get(fileStr);
List<AbstractCsvBean> out = convertToBean(path, IntermediaryCsvBean.class);
ScannerUtil.getFinalCsvString(index, out, fileStr, scannersSubsetMap);
index++;
} catch (NullPointerException e) {
logger.error(fileStr + ": Incorrect CSV format: " + e);
} catch (RuntimeException e) {
logger.error(fileStr + ": Unsupported file format: " + e);
}
}
} catch (URISyntaxException e) {
logger.error("URI Syntax Exception Occurred: " + e);
} catch (CsvValidationException e) {
logger.error("CSV Validation Exception Occurred: " + e);
} catch (Exception e) {
logger.error("Exception Occurred: " + e);
}
}
/**
* Convert the text into a bean
* @param path the path to read the csv file
* @param clazz the bean class
* @return the list of csv beans
* @throws Exception if bean reading failed
*/
public static List<AbstractCsvBean> convertToBean(Path path, Class clazz) throws Exception {
CsvTransfer csvTransfer = new CsvTransfer();
ColumnPositionMappingStrategy ms = new ColumnPositionMappingStrategy();
ms.setType(clazz);
Reader reader = Files.newBufferedReader(path);
CsvToBean cb = new CsvToBeanBuilder(reader)
.withSkipLines(1)
.withType(clazz)
.withMappingStrategy(ms)
.build();
csvTransfer.setCsvList(cb.parse());
reader.close();
return csvTransfer.getCsvList();
}
}
| [
"kk.pradeeban@gmail.com"
] | kk.pradeeban@gmail.com |
bc8a6a939c1851b9d133b471e94cc0743bdd3352 | 4ce22e53f5d87c740765a64ac64d2d644269b7fc | /src/main/java/org/choice/jaxen/expr/iter/IterableAxis.java | 9ae84c55d2d25f35b0440f1708c0e839937f767c | [] | no_license | posTeamBOH/ConfigureNavigation | 317bb9a817f83c5423bc6f83faaf510fe7020275 | 878cd807edaca99ccbe97afed34cb7ac3da32bca | refs/heads/master | 2021-08-31T03:51:10.458414 | 2017-12-20T08:41:33 | 2017-12-20T08:41:33 | 114,353,161 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,788 | java | /*
$Id: IterableAxis.java 1128 2006-02-05 21:49:04Z elharo $
Copyright 2003 The Werken Company. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Jaxen Project nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.choice.jaxen.expr.iter;
import java.io.Serializable;
import java.util.Iterator;
import org.choice.jaxen.ContextSupport;
import org.choice.jaxen.UnsupportedAxisException;
/**
* Provide access to the XPath axes.
*
* @author Bob McWhirter
* @author James Strachan
* @author Stephen Colebourne
*/
public abstract class IterableAxis implements Serializable {
/** The axis type */
private int value;
/**
* Constructor.
*
* @param axisValue
*/
public IterableAxis(int axisValue) {
this.value = axisValue;
}
/**
* Gets the axis value.
*
* @return the axis value
*/
public int value() {
return this.value;
}
/**
* Gets the iterator for a specific XPath axis.
*
* @param contextNode the current context node to work from
* @param support the additional context information
* @return an iterator for the axis
* @throws org.choice.jaxen.UnsupportedAxisException
*/
public abstract Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException;
/**
* Gets the iterator for a specific XPath axis that supports named access.
*
* @param contextNode the current context node to work from
* @param support the additional context information
* @param localName the local name of the nodes to return
* @param namespacePrefix the prefix of the namespace of the nodes to return
* @param namespaceURI the URI of the namespace of the nodes to return
*/
public Iterator namedAccessIterator(
Object contextNode,
ContextSupport support,
String localName,
String namespacePrefix,
String namespaceURI)
throws UnsupportedAxisException {
throw new UnsupportedOperationException("Named access unsupported");
}
/**
* Does this axis support named access?
*
* @param support the additional context information
* @return true if named access supported. If not iterator() will be used
*/
public boolean supportsNamedAccess(ContextSupport support) {
return false;
}
}
| [
"1626118748@qq.com"
] | 1626118748@qq.com |
8aa2828ffbfeb066432023c9e0af9a6e7c39e423 | 9411bc7bf514a0e92c397d77bdeec0605c6a0e3a | /app/src/androidTest/java/com/android/amrta/cameramod/ExampleInstrumentedTest.java | 232a07060986b6de60d08a770738dbf703151892 | [] | no_license | fruqi/android_camera | ef9ef434f8dd39be0ece1ce74938d8007b26c4e5 | b0d7f622333454d1e291b03a275597f637f53603 | refs/heads/master | 2021-08-24T01:09:37.364388 | 2017-12-07T11:21:02 | 2017-12-07T11:21:02 | 113,441,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.android.amrta.cameramod;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.android.amrta.cameramod", appContext.getPackageName());
}
}
| [
"amrta.faruqi@gmail.com"
] | amrta.faruqi@gmail.com |
6500dab29808b92c1b9a5f74b910efa85c7fb1ea | 1910b58202c547d81c7b8a58fe6d8f2464961dbd | /sample-project/MyProgram.java | ebd26e04e1f8d95014ab238a20c48f985e8604ca | [] | no_license | BrianHGrant/java-practice-1 | 11664bc9f1cccf2d2f566fb480f15f169d5fbe9c | 4f68e34e71277d6e11d8e39c715bfb0ad4ca1c5f | refs/heads/master | 2021-01-13T16:00:28.794387 | 2016-12-18T01:45:05 | 2016-12-18T01:45:05 | 76,756,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 75 | java | public class MyProgram {
public static void main(String[] args) {
}
}
| [
"bhgrant8@gmail.com"
] | bhgrant8@gmail.com |
a4bad953c531b2838de7b8c5cd9aee9ead7ad1e0 | 0d356d80d68fa0cb874dd99f6e51b32557c2c274 | /src/main/java/com/br/discovery/web/rest/vm/package-info.java | a7dfc799ebe6ac392e2008d53716553ab21b06e0 | [] | no_license | gustavocaraciolo/jhipsterDonaJuri | 951ebaf4282d8ba8ec62c21640bea0b6cc8c635a | 0d77e7a6a969d59b083a9451455c869fbc934a8b | refs/heads/master | 2021-08-16T20:31:45.067549 | 2017-11-20T09:34:57 | 2017-11-20T09:34:57 | 111,157,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 98 | java | /**
* View Models used by Spring MVC REST controllers.
*/
package com.br.discovery.web.rest.vm;
| [
"gustavocaraciolo@gmail.com"
] | gustavocaraciolo@gmail.com |
e6abf17332c91c060d206121ca690db8c91c975d | 519b53b6252afe41b81c93fef2c22480cbfb1123 | /Heap/KthLargestElementinAnArray.java | 460db32435007eb4f058ffaa18d23271dcb7cd59 | [] | no_license | AtefeMsb/LeetCode | 66a489363a010beb80624e5d01331dc52c7ac2a9 | 95a686c028784c265d2dfde623cc58fb93a71c92 | refs/heads/master | 2022-07-11T09:44:04.816623 | 2022-06-08T19:35:20 | 2022-06-08T19:35:20 | 211,967,972 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package Heap;
/**
Logic:
Why use MIN HEAP:
while constructing the minheap we keep the size under k, each time throwing out the SMALLEST item
or the ROOT of the heap, at the end there will be a heap with the kth largest element at its root
*/
class Solution {
public int findKthLargest(int[] nums, int k) {
PriorityQueue<Integer> minHeap = new PriorityQueue<>();
for (int num : nums) {
minHeap.add(num);
if (minHeap.size() > k) {
minHeap.remove();
}
}
return minHeap.remove();
}
} | [
"atefe.mosayebi@gmail.com"
] | atefe.mosayebi@gmail.com |
f18e3d07af6dfa16cc3da1a88d6f318e1536e5ec | 238e7526d01507e59919bd747c046b0bfe54769e | /src/com/bootcamp/util/DatabaseHelper.java | aa0c21d43c025e8e3baeea0ee8994656b488433d | [] | no_license | edangerfield/AndroidBootcamp3 | 0374a75c2b933edb1f186fb40c2fc0f408dcf05c | 6463b152d131d02aea3d64db02c6bb0eb648ef15 | refs/heads/master | 2021-01-23T02:35:24.135176 | 2013-02-18T20:48:26 | 2013-02-18T20:48:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,151 | java | package com.bootcamp.util;
import java.io.IOException;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String TABLE_ZIPCODE = "zipcodes";
public static final String TABLE_XREF = "xrefziploc";
public static final String TABLE_LOC = "locations";
//The Android's default system path of your application database.
private static String DB_PATH = "";
private static String DB_NAME = "assign3.db";
private SQLiteDatabase myDataBase;
private final Context myContext;
/**
* Constructor
* Takes and keeps a reference of the passed context in order to access to the application assets and resources.
* @param context
*/
public DatabaseHelper(Context context) {
super(context, DB_NAME, null, 1);
DB_PATH = "/data/data/" + context.getPackageName() + "/databases/";
this.myContext = context;
}
public SQLiteDatabase getMyDataBase() {
return myDataBase;
}
/**
* Creates a empty database on the system and rewrites it with your own database.
* */
public void createDataBase() throws IOException{
boolean dbExist = checkDataBase();
if(dbExist){
//do nothing - database already exist
}else{
//By calling this method and empty database will be created into the default system path
//of your application. we are going to be able to overwrite that database with our database.
this.getReadableDatabase();
//load the database
DatabaseLoader loader = new DatabaseLoader(myContext, DB_NAME, DB_PATH);
loader.execute(new String[] {});
}
}
/**
* Check if the database already exist to avoid re-copying the file each time you open the application.
* @return true if it exists, false if it doesn't
*/
private boolean checkDataBase(){
SQLiteDatabase checkDB = null;
try{
String myPath = DB_PATH + DB_NAME;
checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.NO_LOCALIZED_COLLATORS);
}catch(SQLiteException e){
//database does't exist yet.
}
if(checkDB != null){
checkDB.close();
}
return checkDB != null ? true : false;
}
/**
* Copies your database from your local assets-folder to the just created empty database in the
* system folder, from where it can be accessed and handled.
* This is done by transfering bytestream.
* */
// private void copyDataBase() throws IOException{
//
// //Open your local db as the input stream
// InputStream myInput = myContext.getAssets().open(DB_NAME);
//
// // Path to the just created empty db
// String outFileName = DB_PATH + DB_NAME;
//
// //Open the empty db as the output stream
// OutputStream myOutput = new FileOutputStream(outFileName);
//
// //transfer bytes from the inputfile to the outputfile
// byte[] buffer = new byte[1024];
// int length;
// while ((length = myInput.read(buffer))>0){
// myOutput.write(buffer, 0, length);
// }
//
// //Close the streams
// myOutput.flush();
// myOutput.close();
// myInput.close();
//
// }
public void openDataBase() throws SQLException{
//Open the database
String myPath = DB_PATH + DB_NAME;
myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.NO_LOCALIZED_COLLATORS);
}
@Override
public synchronized void close() {
if(myDataBase != null)
myDataBase.close();
super.close();
}
@Override
public void onCreate(SQLiteDatabase db) {
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
} | [
"tdangerfield@hp-tdangerfield.(none)"
] | tdangerfield@hp-tdangerfield.(none) |
0252f7dd739ecf05559a032beea98466f115abf3 | cfc9a2401252b04bb838d89235b6a56475e6866f | /app/src/main/java/test/cn/example/com/androidskill/model/YangzijiangBus.java | c9fb8019ca61ecd4362d80b791083c89631b375d | [] | no_license | imxugan/AndroidSkill | 29b95d662c2138e46cb624173a80d97071d05b25 | e51b10036b276cc6ea6454824aad54b58eea7afc | refs/heads/master | 2020-12-30T11:33:23.374863 | 2019-12-06T03:15:43 | 2019-12-06T03:15:43 | 91,571,237 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package test.cn.example.com.androidskill.model;
import test.cn.example.com.androidskill.inter.ProductBusInter;
import test.cn.example.com.util.LogUtil;
/**
* 扬子江客车
* Created by xgxg on 2017/7/17.
*/
public class YangzijiangBus implements ProductBusInter {
@Override
public void productName() {
LogUtil.e("扬子江客车");
}
}
| [
"xugan@xywy.com"
] | xugan@xywy.com |
2bc5ca2078a8fa100dadec0dccf1cb651a1e2381 | 565e413b478e2a6d5af477ccb33440950b7f1c28 | /killerGameProgramming/java/Particles3D/Particles3D.java | 054631f453f17a447dafe9d71afe0ec6f1ad309e | [] | no_license | alexanderlafleur/jamessandpit-alpha | 16b9e109429a06a7d3a01ce5a759c6c10e2bbc83 | a88083eb8f6c2e31f4316647fa88750605d98411 | refs/heads/master | 2020-05-17T04:47:34.255948 | 2011-02-17T12:11:37 | 2011-02-17T12:11:37 | 35,087,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,430 | java | package Particles3D;
// Particles3D.java
// Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th
/* Three different implementations of Particle systems:
* points in a PointArray
* lines in a LineArray
* quads in a QuadArray
Geometrries are stored using BY_REFERENCE, and updated with
a GeometryUpdater subclass.
The QuadArray example illustrates how to apply a single texture
to each of the quads, and how to blend texture and colour.
*/
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JFrame;
public class Particles3D extends JFrame {
private static final int FOUNTAIN_CHOICE = 1;
private static final int NUM_PARTICLES = 3000;
/**
*
*/
private static final long serialVersionUID = -5718522886296524936L;
public static void main(String[] args) {
new Particles3D(args);
}
// -----------------------------------------
public Particles3D(String args[]) {
super("Particles3D");
int numParticles = NUM_PARTICLES;
int fountainChoice = FOUNTAIN_CHOICE;
if (args.length > 0) {
try {
numParticles = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
System.out.println("Illegal number of particles");
}
if (numParticles < 0) {
System.out.println("Number of particles must be positive");
numParticles = NUM_PARTICLES;
}
}
if (args.length > 1) {
try {
fountainChoice = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
System.out.println("Illegal fountain choice");
}
if (fountainChoice < 1 || fountainChoice > 3) {
System.out.println("Fountain choices are 1-3");
fountainChoice = FOUNTAIN_CHOICE;
}
}
System.out.println("numParticles: " + numParticles + "; fountainChoice: " + fountainChoice);
Container c = getContentPane();
c.setLayout(new BorderLayout());
WrapParticles3D w3d = new WrapParticles3D(numParticles, fountainChoice);
c.add(w3d, BorderLayout.CENTER);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setResizable(false); // fixed size display
setVisible(true);
} // end of Particles3D()
} // end of Particles3D class
| [
"jamesdunwoody@3296596c-6e27-0410-9dff-dffed65e58c7"
] | jamesdunwoody@3296596c-6e27-0410-9dff-dffed65e58c7 |
1f1fbc4606a287e2b5f6a25d29620a89641148de | df3722bd42325a32f284ba69073225167237ba91 | /visualEditor/src/main/java/ar/gob/anses/prissa/mi/asistente_reglas/entity/ValorParametro.java | 2c6c2a853ceb82e62a0ad02b912a7c82b6979558 | [] | no_license | avantgardelabs/ansesarg | f1b886d19ef593db9ce57713c3e8b2c21884b774 | 3a3252006e5cb38bb51c20534638e7cd54a30f54 | refs/heads/master | 2021-03-22T04:42:29.843042 | 2012-05-17T19:24:24 | 2012-05-17T19:24:24 | 4,325,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,250 | java | package ar.gob.anses.prissa.mi.asistente_reglas.entity;
import java.io.Serializable;
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 org.jboss.seam.annotations.Name;
import ar.gob.anses.prissa.mi.asistente_reglas.entity.modelosemantico.Atributo;
import ar.gob.anses.prissa.mi.asistente_reglas.entity.modelosemantico.Entidad;
import ar.gob.anses.prissa.mi.asistente_reglas.entity.modelosemantico.IDependeable;
@SuppressWarnings("serial")
@Entity
@Name("valorParametro")
public class ValorParametro implements IDependeable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private long id;
private String valor;
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
private Parametro parametro;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getValor() {
return valor;
}
public void setValor(String valor) {
this.valor = valor;
}
public Parametro getParametro() {
return parametro;
}
public void setParametro(Parametro parametro) {
this.parametro = parametro;
}
}
| [
"leonardo.leenen@agtech.com.ar"
] | leonardo.leenen@agtech.com.ar |
591dbb46e658a69fea25c2055f6dd6fbdb9e79be | 97ba7740011419c59dfd5dba88ffa834e7cb9ad2 | /app/src/main/java/com/devotted/utils/swipeUtils/ViewBinderHelper.java | 7bece427ad160ec1239c20343592acb9d3be29ad | [] | no_license | Sudheerbolla/Dev | d72fa7271b4f679d4ebb307ccf5c171103689639 | 58aa4a7a933d0c3084c8085ef9f337e59a1f7338 | refs/heads/master | 2021-07-17T04:00:55.134594 | 2018-09-05T08:28:52 | 2018-09-05T08:28:52 | 134,759,453 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,753 | java | package com.devotted.utils.swipeUtils;
import android.os.Bundle;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* Sudheer Bolla
*/
public class ViewBinderHelper {
private static final String BUNDLE_MAP_KEY = "ViewBinderHelper_Bundle_Map_Key";
private final Object stateChangeLock = new Object();
private Map<String, Integer> mapStates = Collections.synchronizedMap(new HashMap<String, Integer>());
private Map<String, CustomSwipeView> mapLayouts = Collections.synchronizedMap(new HashMap<String, CustomSwipeView>());
private Set<String> lockedSwipeSet = Collections.synchronizedSet(new HashSet<String>());
private volatile boolean openOnlyOne = false;
public void bind(final CustomSwipeView swipeLayout, final String id) {
if (swipeLayout.shouldRequestLayout()) {
swipeLayout.requestLayout();
}
mapLayouts.values().remove(swipeLayout);
mapLayouts.put(id, swipeLayout);
swipeLayout.abort();
swipeLayout.setDragStateChangeListener(new CustomSwipeView.DragStateChangeListener() {
@Override
public void onDragStateChanged(int state) {
mapStates.put(id, state);
if (openOnlyOne) {
closeOthers(id, swipeLayout);
}
}
});
if (!mapStates.containsKey(id)) {
mapStates.put(id, CustomSwipeView.STATE_CLOSE);
swipeLayout.close(false);
}
// not the first time, then close or open depends on the current state.
else {
int state = mapStates.get(id);
if (state == CustomSwipeView.STATE_CLOSE || state == CustomSwipeView.STATE_CLOSING ||
state == CustomSwipeView.STATE_DRAGGING) {
swipeLayout.close(false);
} else {
swipeLayout.open(false);
}
}
swipeLayout.setLockDrag(lockedSwipeSet.contains(id));
}
public void saveStates(Bundle outState) {
if (outState == null)
return;
Bundle statesBundle = new Bundle();
for (Map.Entry<String, Integer> entry : mapStates.entrySet()) {
statesBundle.putInt(entry.getKey(), entry.getValue());
}
outState.putBundle(BUNDLE_MAP_KEY, statesBundle);
}
@SuppressWarnings({"unchecked", "ConstantConditions"})
public void restoreStates(Bundle inState) {
if (inState == null)
return;
if (inState.containsKey(BUNDLE_MAP_KEY)) {
HashMap<String, Integer> restoredMap = new HashMap<>();
Bundle statesBundle = inState.getBundle(BUNDLE_MAP_KEY);
Set<String> keySet = statesBundle.keySet();
if (keySet != null) {
for (String key : keySet) {
restoredMap.put(key, statesBundle.getInt(key));
}
}
mapStates = restoredMap;
}
}
public void lockSwipe(String... id) {
setLockSwipe(true, id);
}
public void unlockSwipe(String... id) {
setLockSwipe(false, id);
}
public void setOpenOnlyOne(boolean openOnlyOne) {
this.openOnlyOne = openOnlyOne;
}
public void openLayout(final String id) {
synchronized (stateChangeLock) {
mapStates.put(id, CustomSwipeView.STATE_OPEN);
if (mapLayouts.containsKey(id)) {
final CustomSwipeView layout = mapLayouts.get(id);
layout.open(true);
} else if (openOnlyOne) {
closeOthers(id, mapLayouts.get(id));
}
}
}
public void closeLayout(final String id) {
synchronized (stateChangeLock) {
mapStates.put(id, CustomSwipeView.STATE_CLOSE);
if (mapLayouts.containsKey(id)) {
final CustomSwipeView layout = mapLayouts.get(id);
layout.close(true);
}
}
}
private void closeOthers(String id, CustomSwipeView swipeLayout) {
synchronized (stateChangeLock) {
// close other rows if openOnlyOne is true.
if (getOpenCount() > 1) {
for (Map.Entry<String, Integer> entry : mapStates.entrySet()) {
if (!entry.getKey().equals(id)) {
entry.setValue(CustomSwipeView.STATE_CLOSE);
}
}
for (CustomSwipeView layout : mapLayouts.values()) {
if (layout != swipeLayout) {
layout.close(true);
}
}
}
}
}
public void closeAll() {
synchronized (stateChangeLock) {
for (CustomSwipeView layout : mapLayouts.values()) {
if (layout.isOpened())
layout.close(true);
}
}
}
private void setLockSwipe(boolean lock, String... id) {
if (id == null || id.length == 0)
return;
if (lock)
lockedSwipeSet.addAll(Arrays.asList(id));
else
lockedSwipeSet.removeAll(Arrays.asList(id));
for (String s : id) {
CustomSwipeView layout = mapLayouts.get(s);
if (layout != null) {
layout.setLockDrag(lock);
}
}
}
private int getOpenCount() {
int total = 0;
for (int state : mapStates.values()) {
if (state == CustomSwipeView.STATE_OPEN || state == CustomSwipeView.STATE_OPENING) {
total++;
}
}
return total;
}
}
| [
"nagasudheerbolla@gmail.com"
] | nagasudheerbolla@gmail.com |
8a9e144d708cff3a7e2d3d7f78a363b407f3371c | 40d844c1c780cf3618979626282cf59be833907f | /src/testcases/CWE191_Integer_Underflow/s04/CWE191_Integer_Underflow__int_getQueryString_Servlet_postdec_31.java | 03b9b29b1c6906a1809556a5677a3733536a56ea | [] | no_license | rubengomez97/juliet | f9566de7be198921113658f904b521b6bca4d262 | 13debb7a1cc801977b9371b8cc1a313cd1de3a0e | refs/heads/master | 2023-06-02T00:37:24.532638 | 2021-06-23T17:22:22 | 2021-06-23T17:22:22 | 379,676,259 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,688 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__int_getQueryString_Servlet_postdec_31.java
Label Definition File: CWE191_Integer_Underflow__int.label.xml
Template File: sources-sinks-31.tmpl.java
*/
/*
* @description
* CWE: 191 Integer Underflow
* BadSource: getQueryString_Servlet Parse id param out of the URL query string (without using getParameter())
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: decrement
* GoodSink: Ensure there will not be an underflow before decrementing data
* BadSink : Decrement data, which can cause an Underflow
* Flow Variant: 31 Data flow: make a copy of data within the same method
*
* */
package testcases.CWE191_Integer_Underflow.s04;
import testcasesupport.*;
import javax.servlet.http.*;
import java.util.StringTokenizer;
import java.util.logging.Level;
public class CWE191_Integer_Underflow__int_getQueryString_Servlet_postdec_31 extends AbstractTestCaseServlet
{
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int dataCopy;
{
int data;
data = Integer.MIN_VALUE; /* initialize data in case id is not in query string */
/* POTENTIAL FLAW: Parse id param out of the URL querystring (without using getParam) */
{
StringTokenizer tokenizer = new StringTokenizer(request.getQueryString(), "&");
while (tokenizer.hasMoreTokens())
{
String token = tokenizer.nextToken(); /* a token will be like "id=33" */
if(token.startsWith("id=")) /* check if we have the "id" parameter" */
{
try
{
data = Integer.parseInt(token.substring(3)); /* set data to the int 33 */
}
catch(NumberFormatException exceptNumberFormat)
{
IO.logger.log(Level.WARNING, "Number format exception reading id from query string", exceptNumberFormat);
}
break; /* exit while loop */
}
}
}
dataCopy = data;
}
{
int data = dataCopy;
/* POTENTIAL FLAW: if data == Integer.MIN_VALUE, this will overflow */
data--;
int result = (int)(data);
IO.writeLine("result: " + result);
}
}
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
goodG2B(request, response);
goodB2G(request, response);
}
/* goodG2B() - use goodsource and badsink */
private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int dataCopy;
{
int data;
/* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */
data = 2;
dataCopy = data;
}
{
int data = dataCopy;
/* POTENTIAL FLAW: if data == Integer.MIN_VALUE, this will overflow */
data--;
int result = (int)(data);
IO.writeLine("result: " + result);
}
}
/* goodB2G() - use badsource and goodsink */
private void goodB2G(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int dataCopy;
{
int data;
data = Integer.MIN_VALUE; /* initialize data in case id is not in query string */
/* POTENTIAL FLAW: Parse id param out of the URL querystring (without using getParam) */
{
StringTokenizer tokenizer = new StringTokenizer(request.getQueryString(), "&");
while (tokenizer.hasMoreTokens())
{
String token = tokenizer.nextToken(); /* a token will be like "id=33" */
if(token.startsWith("id=")) /* check if we have the "id" parameter" */
{
try
{
data = Integer.parseInt(token.substring(3)); /* set data to the int 33 */
}
catch(NumberFormatException exceptNumberFormat)
{
IO.logger.log(Level.WARNING, "Number format exception reading id from query string", exceptNumberFormat);
}
break; /* exit while loop */
}
}
}
dataCopy = data;
}
{
int data = dataCopy;
/* FIX: Add a check to prevent an underflow from occurring */
if (data > Integer.MIN_VALUE)
{
data--;
int result = (int)(data);
IO.writeLine("result: " + result);
}
else
{
IO.writeLine("data value is too small to decrement.");
}
}
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"you@example.com"
] | you@example.com |
41d31c97e633739e19c0f2378e29feaaad0d1b2d | c9838494d3b0b4a5cb537ab4a1dcff61cd063529 | /ItemSearch/app/src/main/java/com/example/administrator/itemsearch/Take.java | b752e657d310f5d8e203a5f8ee84284020df594f | [] | no_license | Jimmy9876/ItemSearch | dafed8e25a7053a5b3f702955b17b92ed0625d29 | 830be9ab0b29c5dcba83889dbe8b5d7df92fce59 | refs/heads/master | 2021-01-12T08:34:24.974910 | 2016-12-16T02:56:13 | 2016-12-16T02:56:13 | 76,615,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,957 | java | package com.example.administrator.itemsearch;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.MarshalBase64;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
/**
* Created by Administrator on 2016/11/11.
*/
public class Take extends Activity {
private EditText editText12;
private EditText editText22;
private Button button6;
private Button button7;
private ProgressBar progressBar3;
private String rs;
private static final String namespace = "http://nupt/";
//查询相关参数
//private static final String serviceUrl = "http://202.119.234.4/IoTPlatform/platformws?wsdl";
private static final String serviceUrl = "http://192.168.1.167:8080/LOGIN?wsdl";
//定义一个Handler用来更新页面:
private Handler handler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case 0x001:
Toast.makeText(Take.this, "减少成功!", Toast.LENGTH_SHORT).show();
break;
case 0x002:
Toast.makeText(Take.this, "减少失败", Toast.LENGTH_SHORT).show();
break;
}
}
};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.take);
editText12=(EditText)findViewById(R.id.edt3);
editText22=(EditText)findViewById(R.id.edt4);
button6=(Button)findViewById(R.id.btn6);
button7=(Button)findViewById(R.id.btn7);
progressBar3=(ProgressBar)findViewById(R.id.progress_bar3);
progressBar3.setVisibility(View.GONE);
button6.setOnClickListener(new OnButtonClick6());
button7.setOnClickListener(new OnButtonClick7());
}
public class OnButtonClick6 implements View.OnClickListener {
@Override
public void onClick(View arg0)
{
String str1=editText12.getText().toString();
String str2=editText22.getText().toString();
if(str1.equalsIgnoreCase(""))
{
Toast.makeText(Take.this,"请输入商品名",Toast.LENGTH_SHORT).show();
}
if(str2.equalsIgnoreCase(""))
{
Toast.makeText(Take.this,"请输入减少数量",Toast.LENGTH_SHORT).show();
}
if (progressBar3.getVisibility()==View.GONE)
{
progressBar3.setVisibility(View.VISIBLE);
}
new Thread()
{
@Override
public void run() {
try {
getPermission("name","psword");
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}
}
public void getPermission(String arg0,String arg1) throws Exception {
String methodName = "decreasegoods";
SoapObject request = new SoapObject(namespace, methodName);
request.addProperty("arg0", editText12.getText().toString());
request.addProperty("arg1",editText22.getText().toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
//envelope.dotNet=true;
(new MarshalBase64()).register(envelope);
envelope.encodingStyle = "UTF-8";
HttpTransportSE ht = new HttpTransportSE(serviceUrl);
ht.debug = true;
try {
ht.call(null, envelope);
} catch (Exception e) {
e.printStackTrace();
}
SoapObject object = (SoapObject) envelope.bodyIn;
if (envelope.bodyIn != null) {
rs = object.getProperty(0).toString();
}
if (rs.equals("update ok"))
{
handler.sendEmptyMessage(0x001);
progressBar3.setVisibility(View.GONE);
}
else
{
handler.sendEmptyMessage(0x002);
}
}
public class OnButtonClick7 implements View.OnClickListener {
@Override
public void onClick(View arg0) {
Intent bkintent=new Intent(Take.this,Function.class);
startActivity(bkintent);
}
}
}
| [
"aimpeter@163.com"
] | aimpeter@163.com |
bcca3b96b239fd13c189972301f4702f1a9cce32 | 13663c831903d536ef2e2627f3b8b617982f31a7 | /src/main/java/com/fisc/decletatfinanciertableau/security/jwt/JWTFilter.java | 819861ea5c7ca092944d7421797084f38bb83c26 | [] | no_license | sandalothier/jhipster-decletatfinancierTableau | d9767c33cf7a8a43f5d3ebac033ed9207fac2760 | 1b06360df19e3361521d56e247faaeef60a3d40b | refs/heads/master | 2022-12-23T16:11:43.313471 | 2019-12-19T11:43:58 | 2019-12-19T11:43:58 | 229,042,890 | 0 | 0 | null | 2022-12-16T04:42:29 | 2019-12-19T11:43:50 | Java | UTF-8 | Java | false | false | 1,859 | java | package com.fisc.decletatfinanciertableau.security.jwt;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.GenericFilterBean;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* Filters incoming requests and installs a Spring Security principal if a header corresponding to a valid user is
* found.
*/
public class JWTFilter extends GenericFilterBean {
public static final String AUTHORIZATION_HEADER = "Authorization";
private TokenProvider tokenProvider;
public JWTFilter(TokenProvider tokenProvider) {
this.tokenProvider = tokenProvider;
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String jwt = resolveToken(httpServletRequest);
if (StringUtils.hasText(jwt) && this.tokenProvider.validateToken(jwt)) {
Authentication authentication = this.tokenProvider.getAuthentication(jwt);
SecurityContextHolder.getContext().setAuthentication(authentication);
}
filterChain.doFilter(servletRequest, servletResponse);
}
private String resolveToken(HttpServletRequest request){
String bearerToken = request.getHeader(AUTHORIZATION_HEADER);
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) {
return bearerToken.substring(7);
}
return null;
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
b67590e3596c1c42f15e85a3555550fa169ad079 | a18d9447e94a08f22098e00558f2bc1c1ebf839a | /src/main/java/com/sopiyan/uptd/controller/api/UserController.java | 7e4467979eba1db8f2bb79841ceb0d97c9785275 | [] | no_license | tarasare/uptd-litbang | 9340730e5f74647175a53b42d18aeff3897b00f3 | 93c5f8535b5f516c734bbc471f80224abb32644e | refs/heads/master | 2021-01-19T06:50:10.155727 | 2017-04-07T05:13:35 | 2017-04-07T05:13:35 | 87,504,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,760 | java | package com.sopiyan.uptd.controller.api;
import com.sopiyan.uptd.entities.dto.UserDto;
import com.sopiyan.uptd.entities.entity.User;
import com.sopiyan.uptd.services.impl.CurrentUser;
import com.sopiyan.uptd.services.service.UserService;
import com.sopiyan.uptd.utils.enumeration.Role;
import com.sopiyan.uptd.utils.helper.UserHelper;
import com.sopiyan.uptd.utils.validator.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by Sopiyan on 17/02/2017.
*/
@RestController
public class UserController {
@Autowired
private UserService userService;
@Autowired
private UserValidator userValidator;
@InitBinder("userDto")
public void initBinder(WebDataBinder binder){
binder.addValidators(userValidator);
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
df.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(df, false));
}
@RequestMapping(value = "/api/logged", method = RequestMethod.GET)
public ResponseEntity cekSession(){
return new ResponseEntity<>(HttpStatus.OK);
}
@RequestMapping(value = "/public/user/{id}", method = RequestMethod.GET)
public ResponseEntity<UserDto> lihatUserBerdasarkanid(@PathVariable(value = "id")String id)throws Exception{
User user = userService.cariBerdasarkanID(id);
if(user != null){
return new ResponseEntity<UserDto>(UserHelper.convertFromUser(user), HttpStatus.OK);
}else {
return new ResponseEntity<UserDto>(HttpStatus.NO_CONTENT);
}
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
public ResponseEntity<UserDto> login(Authentication authentication){
try{
User user = ((CurrentUser)authentication.getPrincipal()).getUser();
return new ResponseEntity(UserHelper.convertFromUser(user),HttpStatus.OK);
}catch (Exception ex){
return new ResponseEntity<UserDto>(HttpStatus.NOT_FOUND);
}
}
@RequestMapping(value = "/daftar", method = RequestMethod.POST)
public ResponseEntity<UserDto> daftarUserBaru(@Valid @RequestBody UserDto userDto){
try{
User user = new User();
user.setAlamat(userDto.getAlamat());
user.setGender(userDto.getGender());
user.setEmail(userDto.getEmail());
user.setNamaLengkap(userDto.getNamaLengkap());
user.setNoTelp(userDto.getNoTelp());
user.setPassword(new BCryptPasswordEncoder().encode(userDto.getPassword()));
user.setRole(Role.ROLE_DEFAULT);
user.setTglJoin(new Date());
user.setPhoto(userDto.getPhoto() != null?userDto.getPhoto():"/assets/img/user.jpg");
user = userService.simpan(user);
return new ResponseEntity<UserDto>(UserHelper.convertFromUser(user), HttpStatus.CREATED);
}catch (Exception e){
e.printStackTrace();
return new ResponseEntity<UserDto>(HttpStatus.BAD_REQUEST);
}
}
@RequestMapping(value = "/public/user", method = RequestMethod.GET)
public ResponseEntity<Page<UserDto>> tampilkanUser(@RequestParam(name = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(name = "size", required = false, defaultValue = "20") Integer size,
@RequestParam(name = "cari", required = false) String cari
){
if(page < 0){
page = 0;
}
try{
Page<User> pageUser;
if(cari != null){
pageUser = userService.tampilkanBerdasarkanNamaLengkap(cari, new PageRequest(page, size));
return new ResponseEntity<Page<UserDto>>(UserHelper.convertFromPageUser(pageUser), HttpStatus.OK);
}else {
pageUser = userService.tampilkanSemua(new PageRequest(page, size));
return new ResponseEntity<Page<UserDto>>(UserHelper.convertFromPageUser(pageUser), HttpStatus.OK);
}
}catch (Exception es){
es.printStackTrace();
return new ResponseEntity<Page<UserDto>>(HttpStatus.BAD_REQUEST);
}
}
@PreAuthorize("hasRole('ADMIN')")
@RequestMapping(value = "/dashboard/user/{id}", method = RequestMethod.GET)
public ResponseEntity gantiRoleUser(@PathVariable(value = "id")String idUser,@RequestParam(value = "status", required = true,defaultValue = "ROLE_DEFAULT")Role role){
try {
User user = userService.cariBerdasarkanID(idUser);
if(user != null){
user.setRole(role);
user = userService.perbarui(user);
return new ResponseEntity(HttpStatus.OK);
}else {
return new ResponseEntity(HttpStatus.BAD_REQUEST);
}
}catch (Exception e){
e.printStackTrace();
return new ResponseEntity(HttpStatus.BAD_REQUEST);
}
}
}
| [
"sundayjune66@gmail.com"
] | sundayjune66@gmail.com |
11deaba846463ce7504c21c0b2a7870166b4ec1e | 919b04899c776496e8d292077a5a16eeecfaba55 | /app/src/main/java/com/example/varsh/projecttwo/MainActivity.java | 51b8c4f8cce18cb011176cf03f99b5c385e71a07 | [] | no_license | varshajayaraman/car_gallery | 9a75b26f2ccd170960072a0a6c26482402efc797 | 0b01a05d7b332ff7710bafc9c53b0e950d676723 | refs/heads/master | 2020-04-01T16:56:51.998263 | 2018-10-17T06:21:42 | 2018-10-17T06:21:42 | 153,401,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,258 | java | package com.example.varsh.projecttwo;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
final static int clickedItemId = 0;
static LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>(); //Hashmap with R.drawable resources as keys and official website as values
static String[] carNamesArray = { //Array of Car names for Text view in grid items
"ASTONMARTIN", "FERRARI",
"JAGUAR", "LAMBHORGINI",
"LANDROVER", "MASERATI",
"PORSCHE", "SPIDER"
};
int[] mThumbIdsFlowers = new int[] {R.drawable.astonmartin, R.drawable.ferrari,
R.drawable.jaguar, R.drawable.lambhorgini, R.drawable.landrover,
R.drawable.maserati, R.drawable.porsche, R.drawable.spider};
GridView gridview;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
hashMap.put(Integer.toString(R.drawable.astonmartin), "https://global.astonmartin.com/en-us/" );
hashMap.put(Integer.toString(R.drawable.ferrari), "https://www.ferrari.com/en-US" );
hashMap.put(Integer.toString(R.drawable.jaguar), "https://www.jaguarusa.com/index.html" );
hashMap.put(Integer.toString(R.drawable.lambhorgini), "https://www.lamborghini.com/en-en" );
hashMap.put(Integer.toString(R.drawable.landrover), "https://www.landroverusa.com/index.html" );
hashMap.put(Integer.toString(R.drawable.maserati), "https://www.maseratiusa.com/maserati/us/en" );
hashMap.put(Integer.toString(R.drawable.porsche), "https://www.porsche.com/usa/" );
hashMap.put(Integer.toString(R.drawable.spider), "https://www.fiatusa.com/spider.html" );
gridview = (GridView) findViewById(R.id.gridview);
final ImageAdapter imageAdapterObject = new ImageAdapter(this, hashMap, carNamesArray);
gridview.setAdapter(imageAdapterObject);
registerForContextMenu(gridview);
gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) { //Short Click Listener
Log.i("MainActivity", "shortclick"+id);
function1((int)id);
}
});
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,ContextMenu.ContextMenuInfo menuInfo) { //Creating a context menu on long click
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.context_menu, menu);
Log.i("MainActivity", "Number of files present currently in Cache: "+this.fileList().length);
}
@Override
public boolean onContextItemSelected(MenuItem item) { //Passes function call based on item chosen in the context menu
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
int index = (int)info.id;
// Log.i("MainActivity", "insideonCreateContextMenu "+R.drawable.astonmartin+" "+index);
if(item.getItemId()==R.id.contextMenuItem1){function1(index);}
else if(item.getItemId()==R.id.contextMenuItem2){function2(hashMap.get(Integer.toString(index)));}
else {function3(index);}
return true;
}
public void function1(int id){ //Intent to display a bigger picture in new Activity
// Toast.makeText(this, "function 1 called", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MainActivity.this, PictureZoom.class);
intent.putExtra("imageID", (int)id);
startActivity(intent);
//finish();
}
public void function2(String url){ //Intent to open the official website
// Log.i("MainActivity", "urlpassed"+url);
Intent openWebsite = new Intent(Intent.ACTION_VIEW);
openWebsite.setData(Uri.parse(url));
startActivity(openWebsite);
// @Override
}
public void function3(int id){ //Intent to open a list view containing 3 dealers for the selected car model
if (id==R.drawable.astonmartin){ Log.i("MainActivity", "Yup"+id);}
// Log.i("MainActivity", "tolistview");
Intent showList = new Intent(MainActivity.this, ListViewActivity.class);
showList.putExtra("imageID", (int)id);
startActivity(showList);
}
}
| [
"varsha.jayaraman15@gmail.com"
] | varsha.jayaraman15@gmail.com |
21b22d351e6757ba9bed7329b9ca73d4c09275c7 | eaaa025bd448bd8a17dac5b18e94e0a752be64ab | /Core Java/src/com/CollectionFramework/q2.java | 2adede31ab3f020fb4dabe4c42672910c151ac70 | [] | no_license | Deeptansu-Patro123/CORE-JAVA | 19a21019f46ba3d8a7e9221014d823cea841f095 | 38b2cc67eb51049b7b253c6a73d5072fead51f5e | refs/heads/master | 2022-12-22T00:53:39.249714 | 2020-04-19T18:19:21 | 2020-04-19T18:19:21 | 241,529,884 | 0 | 0 | null | 2022-12-10T06:00:42 | 2020-02-19T04:09:16 | Java | UTF-8 | Java | false | false | 862 | java | package com.CollectionFramework;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
public class q2 {
public static void main(String[] args) {
testHashSet();
System.out.println("--------------------");
testLinkedHashSet();
}
private static void testHashSet() {
Set<String> hset = new HashSet<String>();
hset.add("ABC");
hset.add("XYZ");
hset.add("PQR");
Iterator<String> itr = hset.iterator();
while(itr.hasNext()) {
String name = itr.next();
System.out.println(name);
}
}
private static void testLinkedHashSet() {
LinkedHashSet<String> hset = new LinkedHashSet<String>();
hset.add("ABC");
hset.add("XYZ");
hset.add("PQR");
Iterator<String> itr = hset.iterator();
while(itr.hasNext()) {
String name = itr.next();
System.out.println(name);
}
}
}
| [
"deeptansu99@gmail.com"
] | deeptansu99@gmail.com |
29fcb1edeabe50550cb2528c7967a728b20fff2b | 354a42bb859776022ceee5269b9346401f20f8c2 | /src/main/java/bshutt/coplan/custom_codecs/UserCodecProvider.java | c21ddfff4b508ce6e9bf50b06cce967a21e16892 | [] | no_license | cpe305/fall2016-project-bradyshutt | dcd7c169c15344f2fbca15e1ab91ed8cf1cfc9ba | 54e8874d38c9510e49cf24a8b3ccd2c515aa65df | refs/heads/master | 2021-01-10T22:46:10.900279 | 2016-12-10T06:43:32 | 2016-12-10T06:43:32 | 70,359,459 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | //package bshutt.coplan.custom_codecs;
//
//import bshutt.coplan.models.User;
//import org.bson.codecs.Codec;
//import org.bson.codecs.configuration.CodecProvider;
//import org.bson.codecs.configuration.CodecRegistry;
//
//public class UserCodecProvider implements CodecProvider {
//
// @Override
// @SuppressWarnings("unchecked")
// public <T> Codec<T> getData(Class<T> clazz, CodecRegistry registry) {
// if (clazz == User.class) {
// return (Codec<T>) new UserCodec(registry);
// }
// return null;
// }
//}
| [
"bradyshutt@gmail.com"
] | bradyshutt@gmail.com |
e85d1a0dcdc384f6a445f0ef07b9e1d1f5477d84 | 2a7bb6c7881ff014c649c4422d5670cc17266ea0 | /PubMedIDtoGate/src/main/java/ubic/pubmedgate/interactions/focusedAnalysis/GetBAMSDepth.java | 7781876612e4ef35b6d1810ef7dbcec8239d4101 | [] | no_license | leonfrench/public | aa66757bd738d70407c6d0d5615cd43c6b47bb71 | ee70d6065dac8e5365dfa5036711502ca1a297e9 | refs/heads/master | 2021-01-13T02:15:21.313129 | 2015-09-03T17:28:40 | 2015-09-03T17:28:40 | 4,865,994 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,854 | java | /*
* The WhiteText project
*
* Copyright (c) 2012 University of British Columbia
*
* 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 ubic.pubmedgate.interactions.focusedAnalysis;
import java.util.Set;
import ubic.BAMSandAllen.ABAMSDataMatrix;
import ubic.BAMSandAllen.AnalyzeBAMSandAllenGenes.Direction;
import ubic.BAMSandAllen.BAMSDataLoaders.BAMSDataLoader;
import ubic.BAMSandAllen.adjacency.IdentityAdjacency;
import ubic.basecode.dataStructure.matrix.DoubleMatrix;
import ubic.pubmedgate.interactions.NormalizePairs;
public class GetBAMSDepth {
public static void main( String args[] ) throws Exception {
BAMSDataLoader bamsLoader = new BAMSDataLoader();
Set<String> BAMSRegions = bamsLoader.getRegions();
String test = BAMSRegions.iterator().next();
System.out.println( test );
System.out.println( bamsLoader.getParent( test ) );
System.out.println( bamsLoader.getParents( test ) );
// only use connected regions!!
Direction direction = Direction.ANYDIRECTION;
DoubleMatrix<String, String> BAMSconnectionMatrix = NormalizePairs.getBAMSConnectionMatrix( true, direction );
ABAMSDataMatrix BAMSMatrix = new ABAMSDataMatrix( BAMSconnectionMatrix, "BAMSconnectionMatrix",
new IdentityAdjacency( BAMSconnectionMatrix ) );
BAMSMatrix = BAMSMatrix.removeZeroColumns();
BAMSMatrix = BAMSMatrix.removeZeroRows();
System.out.println( "Size:" + BAMSMatrix.getRowNames().size() );
int totalDepth = 0;
for ( String region : BAMSMatrix.getRowNames() ) {
totalDepth += bamsLoader.getParents( region ).size();
}
// is not based on connections! don't use
System.out.println( "Average depth:" + ( totalDepth / ( double ) BAMSMatrix.getRowNames().size() ) );
// StructureCatalogLoader dong = new StructureCatalogLoader();
// Set<String> dongRegions = dong.getRegions();
//
// for ( String dongRegion : dongRegions ) {
// for ( String bams : BAMSRegions ) {
// if ( dongRegion.toLowerCase().trim().equals( bams.toLowerCase().trim() ) ) {
// if ( dong.getBAMSMappedRegions( dongRegion ) == null ) {
// System.out.println( bams );
// }
// }
// }
// }
}
}
| [
"leonfrench@gmail.com"
] | leonfrench@gmail.com |
c2855e3ac75c433487890c992d37a529545cda81 | df769e67ad76165d02aeaa9b16c618dc2a662b92 | /src/main/java/com/example/carros/api/IndexController.java | 4a6e237d3ac134b079a9e2dc3349861316492ada | [] | no_license | jonatasprates/api_carros | d1b33e4a5573cbb18d85e400731e79bad08404a7 | 9da777cdbcee04afd129879deefe168ac5e8c67a | refs/heads/master | 2023-05-08T11:50:03.756226 | 2021-05-25T20:01:35 | 2021-05-25T20:01:35 | 364,734,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.example.carros.api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/")
public class IndexController {
@GetMapping
public String get() {
return "get spring boot";
}
}
| [
"jonatasluisprates@gmail.com"
] | jonatasluisprates@gmail.com |
5218bdeb10bff3c489d4fa8b57dd03344316cfdb | 10ff49068d75f1f6fd0f0db6f988cf0fed2b061f | /app/src/main/java/edu/upv/cdm/contactos_navigation/ui/editarContacto/EditarContactoViewModel.java | 400fe2df27066779345a2460cb87a4a928cc9052 | [] | no_license | JosePabloMaciasUPV/java_android_jetpack2 | 754773df5069128168905661fa60d80a71dc81ff | 0ea6ae598eb7817d9d558b8e5c5cb5e42fc5e293 | refs/heads/main | 2023-06-19T17:54:33.258407 | 2021-07-20T03:09:14 | 2021-07-20T03:09:14 | 387,656,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | package edu.upv.cdm.contactos_navigation.ui.editarContacto;
import android.util.Log;
import androidx.lifecycle.ViewModel;
import edu.upv.cdm.contactos_navigation.db.AppDb;
import edu.upv.cdm.contactos_navigation.models.Contacto;
import static android.content.ContentValues.TAG;
public class EditarContactoViewModel extends ViewModel {
private AppDb appDb=AppDb.getInstance();
private Contacto contacto;
private long id;
public Contacto getContacto() {
return contacto;
}
public void setContacto(Contacto contacto) {
this.contacto = contacto;
}
// TODO: Implement the ViewModel
public long getId() {
return id;
}
public final void setId(long id){
this.id=id;
}
private void obtenerContactoDesdeDb(){
setContacto(appDb.contactoDao().getByd(id));
//Log.d(TAG, "obtenerContactoDesdeDb: "+contacto.getNombre());
}
public void start(){
obtenerContactoDesdeDb();
}
} | [
"1530411@upv.edu.mx"
] | 1530411@upv.edu.mx |
ab9cb5cfceeaf596e096631165520a8014510d72 | fe2625e6b9a6b21f0c11a25c342f20f0dcdb6b9b | /src/main/Java/Beans/BankStatementSave.java | 5a86dc464263c466c9179d04b5a35216be575e47 | [] | no_license | wilfredkim/BankingSolution | 3e8db210d5e3dcc51b8df2a6ac32f8e5a3fcb497 | 4d4ad3541798e9f3268d0639073fe0a2621e44e2 | refs/heads/master | 2021-07-11T14:42:41.489744 | 2017-10-12T13:51:32 | 2017-10-12T13:51:32 | 106,698,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | package Beans;
import Interfaces.CustomerInterface;
import Pojo.Account;
import Pojo.Activity;
import com.google.gson.Gson;
import javax.ejb.EJB;
import javax.enterprise.inject.New;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
public class BankStatementSave {
public void saveList(ArrayList list){
//ArrayList<Activity> list = customerInterface.viewBankStatement(account);
try {
FileOutputStream fileOutputStream = new FileOutputStream("C:\\Users\\Administrator\\Documents\\Bankstatement.txt");
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(new Gson().toJson(list));
objectOutputStream.close();
fileOutputStream.close();
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
}
| [
"wilfredkim5@gmail.com"
] | wilfredkim5@gmail.com |
e4e2f680d0b301936df9968d9d612d12cf451264 | 0a532b9d7ebc356ab684a094b3cf840b6b6a17cd | /java-source/src/main/com/sun/org/apache/xpath/internal/operations/Or.java | 92716eee6977055c7465ba77169318e1630ba8ac | [
"Apache-2.0"
] | permissive | XWxiaowei/JavaCode | ac70d87cdb0dfc6b7468acf46c84565f9d198e74 | a7e7cd7a49c36db3ee479216728dd500eab9ebb2 | refs/heads/master | 2022-12-24T10:21:28.144227 | 2020-08-22T08:01:43 | 2020-08-22T08:01:43 | 98,070,624 | 10 | 4 | Apache-2.0 | 2022-12-16T04:23:38 | 2017-07-23T02:51:51 | Java | UTF-8 | Java | false | false | 2,360 | java | /*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* 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.
*/
/*
* $Id: Or.java,v 1.2.4.1 2005/09/14 21:31:41 jeffsuttor Exp $
*/
package com.sun.org.apache.xpath.internal.operations;
import com.sun.org.apache.xpath.internal.XPathContext;
import com.sun.org.apache.xpath.internal.objects.XBoolean;
import com.sun.org.apache.xpath.internal.objects.XObject;
/**
* The 'or' operation expression executer.
*/
public class Or extends Operation
{
static final long serialVersionUID = -644107191353853079L;
/**
* OR two expressions and return the boolean result. Override
* superclass method for optimization purposes.
*
* @param xctxt The runtime execution context.
*
* @return {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_TRUE} or
* {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_FALSE}.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
XObject expr1 = m_left.execute(xctxt);
if (!expr1.bool())
{
XObject expr2 = m_right.execute(xctxt);
return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
else
return XBoolean.S_TRUE;
}
/**
* Evaluate this operation directly to a boolean.
*
* @param xctxt The runtime execution context.
*
* @return The result of the operation as a boolean.
*
* @throws javax.xml.transform.TransformerException
*/
public boolean bool(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
return (m_left.bool(xctxt) || m_right.bool(xctxt));
}
}
| [
"2809641033@qq.com"
] | 2809641033@qq.com |
d3bed82f87a2cd6b3078114c707597aea43bd5bb | efd638c93ad741380ada689bd3c4dfb397cce8dd | /app/src/main/java/com/knwedu/ourschool/OfflineUpdater.java | d956a5f41c80822304954e7012160786373b6e2c | [] | no_license | raisahab-ritwik/MY_CPS | fa6d69bf99aa1f6976318f767aa5e8a0aff3b6cf | eeb74e5604498d4d309846e03304fb9f30700800 | refs/heads/master | 2020-03-12T06:56:59.658729 | 2018-04-21T17:33:32 | 2018-04-21T17:33:32 | 130,496,725 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 699 | java | package com.knwedu.ourschool;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;
/**
* Created by ddasgupta on 3/15/2016.
*/
public class OfflineUpdater extends Service {
static final String Tag="ServiceUpdater";
@Override
public void onCreate() {
super.onCreate();
Log.d(Tag, "Service Created");
}
@Override
public void onStart(Intent intent, int startId) {
Log.d(Tag,"Service Started");
super.onStart(intent, startId);
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
| [
"ritwikrai04@gmail.com"
] | ritwikrai04@gmail.com |
be63cf5669f28de464e4783a29836772c6696d63 | 86505462601eae6007bef6c9f0f4eeb9fcdd1e7b | /bin/platform/bootstrap/gensrc/de/hybris/platform/validation/model/constraints/TypeConstraintModel.java | 4c94109c0bb5682fb3d2926914792c72743c9b5f | [] | no_license | jp-developer0/hybrisTrail | 82165c5b91352332a3d471b3414faee47bdb6cee | a0208ffee7fee5b7f83dd982e372276492ae83d4 | refs/heads/master | 2020-12-03T19:53:58.652431 | 2020-01-02T18:02:34 | 2020-01-02T18:02:34 | 231,430,332 | 0 | 4 | null | 2020-08-05T22:46:23 | 2020-01-02T17:39:15 | null | UTF-8 | Java | false | false | 2,967 | java | /*
* ----------------------------------------------------------------
* --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! ---
* --- Generated at 2 ene. 2020 14:28:39 ---
* ----------------------------------------------------------------
*
* [y] hybris Platform
* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.validation.model.constraints;
import de.hybris.platform.core.model.ItemModel;
import de.hybris.platform.servicelayer.model.ItemModelContext;
import de.hybris.platform.validation.model.constraints.AbstractConstraintModel;
/**
* Generated model class for type TypeConstraint first defined at extension validation.
* <p>
* Type constraint definition.
*/
@SuppressWarnings("all")
public class TypeConstraintModel extends AbstractConstraintModel
{
/**<i>Generated model type code constant.</i>*/
public static final String _TYPECODE = "TypeConstraint";
/**
* <i>Generated constructor</i> - Default constructor for generic creation.
*/
public TypeConstraintModel()
{
super();
}
/**
* <i>Generated constructor</i> - Default constructor for creation with existing context
* @param ctx the model context to be injected, must not be null
*/
public TypeConstraintModel(final ItemModelContext ctx)
{
super(ctx);
}
/**
* <i>Generated constructor</i> - Constructor with all mandatory attributes.
* @deprecated since 4.1.1 Please use the default constructor without parameters
* @param _annotation initial attribute declared by type <code>AbstractConstraint</code> at extension <code>validation</code>
* @param _id initial attribute declared by type <code>AbstractConstraint</code> at extension <code>validation</code>
*/
@Deprecated(since = "4.1.1", forRemoval = true)
public TypeConstraintModel(final Class _annotation, final String _id)
{
super();
setAnnotation(_annotation);
setId(_id);
}
/**
* <i>Generated constructor</i> - for all mandatory and initial attributes.
* @deprecated since 4.1.1 Please use the default constructor without parameters
* @param _annotation initial attribute declared by type <code>AbstractConstraint</code> at extension <code>validation</code>
* @param _id initial attribute declared by type <code>AbstractConstraint</code> at extension <code>validation</code>
* @param _owner initial attribute declared by type <code>Item</code> at extension <code>core</code>
*/
@Deprecated(since = "4.1.1", forRemoval = true)
public TypeConstraintModel(final Class _annotation, final String _id, final ItemModel _owner)
{
super();
setAnnotation(_annotation);
setId(_id);
setOwner(_owner);
}
}
| [
"juan.gonzalez.working@gmail.com"
] | juan.gonzalez.working@gmail.com |
ae1bd4b6d01a9c6f30fd8c400eb6f1d884191a15 | ab24531d44b721b72e60a844f9966237ab21d1e6 | /modules/activiti-cxf/src/test/java/org/activiti/engine/impl/webservice/WebServiceMock.java | f363579f3f7eb44e8e6dee4154fa1e6e7d80096f | [] | no_license | MurugeshNag/Activiti_BPM | 74bc0aa003655411bdd9dd1bd76bb4dfc44d6dd5 | 2c015beeb25cc151c8fa69324f2b87fe2a422d6f | refs/heads/master | 2021-01-10T15:48:25.015658 | 2015-11-03T09:06:47 | 2015-11-03T09:06:47 | 45,453,996 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,019 | java | /* 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.activiti.engine.impl.webservice;
import java.util.Date;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
/**
* A simple WS for unit test purpose
*
* @author Esteban Robles Luna
*/
@WebService
public interface WebServiceMock {
/**
* Increase the counter in 1
*/
void inc();
/**
* Returns the current count
*
* @return the count
*/
@WebResult(name="count")
int getCount();
/**
* Resets the counter to 0
*/
void reset();
/**
* Sets the counter to value
*
* @param value the value of the new counter
*/
void setTo(@WebParam(name="value") int value);
/**
* Returns a formated string composed of prefix + current count + suffix
*
* @param prefix the prefix
* @param suffix the suffix
* @return the formated string
*/
@WebResult(name="prettyPrint")
String prettyPrintCount(@WebParam(name="prefix") String prefix, @WebParam(name="suffix") String suffix);
/**
* Sets the current data structure
*
* @param str
* the new string of data structure
* @param date
* the new date of data structure
*/
void setDataStructure(@WebParam(name = "eltStr") String str, @WebParam(name = "eltDate") Date date);
/**
* Returns the current data structure
*
* @return the current data structure
*/
@WebResult(name="currentStructure")
WebServiceDataStructure getDataStructure();
}
| [
"murugesan_nagendran@apple.com"
] | murugesan_nagendran@apple.com |
08ea69a35504448366763533fab33cc7bffbdfa2 | 29acc5b6a535dfbff7c625f5513871ba55554dd2 | /aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/InvalidParameterException.java | 820f2ce5485365e5b66d643e9f41912745c8ff8f | [
"JSON",
"Apache-2.0"
] | permissive | joecastro/aws-sdk-java | b2d25f6a503110d156853836b49390d2889c4177 | fdbff1d42a73081035fa7b0f172b9b5c30edf41f | refs/heads/master | 2021-01-21T16:52:46.982971 | 2016-01-11T22:55:28 | 2016-01-11T22:55:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,163 | java | /*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.logs.model;
import com.amazonaws.AmazonServiceException;
/**
* <p>
* Returned if a parameter of the request is incorrectly specified.
* </p>
*/
public class InvalidParameterException extends AmazonServiceException {
private static final long serialVersionUID = 1L;
/**
* Constructs a new InvalidParameterException with the specified error
* message.
*
* @param message
* Describes the error encountered.
*/
public InvalidParameterException(String message) {
super(message);
}
} | [
"aws@amazon.com"
] | aws@amazon.com |
58b89738a0a230103a9e42f3de4f46ef21b20b29 | f82f8ddbba4f6e8f8d2a7d1339966398913968bb | /Lecher/형남/java03/Exxx.java | 62a4cbc35a6941fd56023979c0dab6eaf4d3dc67 | [] | no_license | gunee7/workspace | 66dd0e0151f1f1e3d316c38976fadded6da70398 | c962907b6e0859062fc05078e9c9f43e6b62dcff | refs/heads/master | 2021-05-07T15:14:04.814560 | 2018-02-20T09:07:17 | 2018-02-20T09:07:17 | 114,836,940 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package java03;
import java.util.Scanner;
public class Exxx {
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
System.out.print("k의 값을 입력하세요. : ");
int k = keyboard.nextInt();
if(k==0){
System.out.println("A");
} else if(k>3) {
System.out.println("B");
} else {
System.out.println("C");
}
}
} | [
"gunee7@naver.com"
] | gunee7@naver.com |
0151636dc52a7993ad1160e70dc5c9f5bbcfd452 | 577a440eba2b458692aeb5df36140b136b020afb | /src/main/java/pl/basistam/wloczykij/json/validation/JsonValidation.java | 2db445f8f4d3f650427d6170ba7a935c304f6897 | [] | no_license | mbasista/wloczykij | ad0690f565c8665fbb80526a7247fee3b66e5953 | 54e1186d8157635b2fbb1fb46afa416a901452ae | refs/heads/master | 2020-04-16T11:34:30.706592 | 2019-01-13T18:46:02 | 2019-01-13T18:46:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package pl.basistam.wloczykij.json.validation;
public interface JsonValidation {
}
| [
"basistamarcin@gmail.com"
] | basistamarcin@gmail.com |
e1907705ac4dd12d4f8fa1fd797df44e2fb98292 | 60df4dcb2521634087e4d44799a505d6c8595097 | /Chapter14.website/src/problem1/PriorityQueue.java | 9799eaebac74e261f544d33c2c7608ee279481c7 | [] | no_license | clare103/Java | 75e92204536a44b245175c5d15f4d250c8320301 | d82f152d9037115f741e89f7830fc7bbecf130ec | refs/heads/master | 2021-01-10T13:43:03.783760 | 2015-10-28T18:59:54 | 2015-10-28T18:59:54 | 45,134,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,401 | java | package problem1;
import java.util.*;
public class PriorityQueue<T> {
public int priority;
public String input;
public ArrayList<String> data = new ArrayList();
public ArrayList<Integer> integer = new ArrayList();
PriorityQueue()
{
}
public void set_priority(int priority)
{
this.priority = priority;
}
public int get_priority()
{
return priority;
}
public void set_input(String input)
{
this.input = input;
}
public String get_input()
{
return input;
}
public void add(String input, int priority)
{
data.add(input);
integer.add(priority);
}
public void sort()
{
for(int i =0; i<integer.size(); i++)
{
for(int g =1; g <integer.size(); g++)
{
if(integer.get(i) > integer.get(g))
{
String temp;
temp = data.get(i);
data.set(i, data.get(g));
data.set(g, temp);
int temp1;
temp1 = integer.get(i);
integer.set(i, integer.get(g));
integer.set(g, temp1);
}
}
}
}
public void remove()
{
sort();
System.out.println(data.get(0));
data.remove(0);
integer.remove(0);
}
public void display()
{
add("x", 10);
add("y", 9);
add("z", 3);
add("w", 11);
remove();
remove();
remove();
remove();
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
PriorityQueue b = new PriorityQueue();
b.display();
}
}
| [
"clare103@mail.chapman.edu"
] | clare103@mail.chapman.edu |
cbc744ec6cb798523e2029612ab276ec42d4e0ce | b2413945b9cd2b9fec1b35ce806a25964da114df | /Java-76/Edureka/src/OverridingMembers.java | 9be4cdc71dda1a0cafd12fa4e11e8f97ea89421a | [] | no_license | Puja-Developer/Java-76 | b420efc2502bf51c6fd6fb48c964c686cafa47dc | 9a9c4eef311b6f5e350666a7291120df761cbd39 | refs/heads/main | 2023-02-16T17:08:53.870498 | 2021-01-17T16:44:54 | 2021-01-17T16:44:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | class A1{
int a=10,b=20;
void display() {
System.out.println("In class A1: "+a+" | "+b);
}
}
class B1 extends A1{
int a=11, b=22;
@Override
void display() {
System.out.println("In class B1: "+super.a+" | "+super.b+" | "+a+" | "+this.b);
super.display();
}
}
public class OverridingMembers {
public static void main(String[] args) {
B1 obj = new B1();
obj.display();
}
}
| [
"sunil.edureka@gmail.com"
] | sunil.edureka@gmail.com |
a352cbd448d944449551cecfc85aa1a3c13f9b60 | 152b07644c2f7c3ebcc3831998b05eb46786d6dc | /Accurate-Parent/Accurate-Web/src/main/java/com/jhg/marketing/web/util/note/SendMMS2.java | dd10e1db5a9fbc1d603e21767cdf4a2da241fa67 | [
"AFL-3.0"
] | permissive | gongboGit/JhgWechatDevolepment | e24fdf6656540b20c6d8d706478e51bd99309049 | 75565786e2cdde65fc0aeb3821d39554d2b94ed4 | refs/heads/master | 2022-12-15T12:28:42.533256 | 2019-11-26T05:28:47 | 2019-11-26T05:28:47 | 224,101,251 | 0 | 0 | AFL-3.0 | 2022-12-11T20:35:36 | 2019-11-26T04:20:16 | JavaScript | UTF-8 | Java | false | false | 5,300 | java |
package com.jhg.marketing.web.util.note;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CorpID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="Pwd" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="Mobile" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="Base64Content" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="Title" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="ExtCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="SendTime" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"corpID",
"pwd",
"mobile",
"base64Content",
"title",
"extCode",
"sendTime"
})
@XmlRootElement(name = "SendMMS2")
public class SendMMS2 {
@XmlElement(name = "CorpID")
protected String corpID;
@XmlElement(name = "Pwd")
protected String pwd;
@XmlElement(name = "Mobile")
protected String mobile;
@XmlElement(name = "Base64Content")
protected String base64Content;
@XmlElement(name = "Title")
protected String title;
@XmlElement(name = "ExtCode")
protected String extCode;
@XmlElement(name = "SendTime")
protected String sendTime;
/**
* Gets the value of the corpID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCorpID() {
return corpID;
}
/**
* Sets the value of the corpID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCorpID(String value) {
this.corpID = value;
}
/**
* Gets the value of the pwd property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPwd() {
return pwd;
}
/**
* Sets the value of the pwd property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPwd(String value) {
this.pwd = value;
}
/**
* Gets the value of the mobile property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMobile() {
return mobile;
}
/**
* Sets the value of the mobile property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMobile(String value) {
this.mobile = value;
}
/**
* Gets the value of the base64Content property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBase64Content() {
return base64Content;
}
/**
* Sets the value of the base64Content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBase64Content(String value) {
this.base64Content = value;
}
/**
* Gets the value of the title property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTitle() {
return title;
}
/**
* Sets the value of the title property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTitle(String value) {
this.title = value;
}
/**
* Gets the value of the extCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getExtCode() {
return extCode;
}
/**
* Sets the value of the extCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setExtCode(String value) {
this.extCode = value;
}
/**
* Gets the value of the sendTime property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSendTime() {
return sendTime;
}
/**
* Sets the value of the sendTime property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSendTime(String value) {
this.sendTime = value;
}
}
| [
"592792000@qq.com"
] | 592792000@qq.com |
f7dfa44c5fa56849adcaab2cfbc4dea38f11db1d | 4d27e3990f271c26f141ff85d71c04def42ec24a | /ecadmin-web/src/main/java/com/yinhai/shh/account/domain/AccountDomain.java | d98c757067cd7548664a62a2e82c9f58221a831e | [] | no_license | hegi2008/Ecadmin | 16bbadea0bb4a611c7296b5e8d773aa305063ad5 | 70830bc2a728ca07ef51492909c722cbd3fe2ac8 | refs/heads/master | 2022-11-25T09:35:59.225678 | 2018-09-20T08:40:46 | 2018-09-20T08:40:46 | 226,642,749 | 0 | 0 | null | 2022-11-16T05:42:12 | 2019-12-08T09:24:31 | CSS | UTF-8 | Java | false | false | 1,175 | java | package com.yinhai.shh.account.domain;
import java.io.Serializable;
import java.util.Date;
public class AccountDomain implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private String out_platform_id;
private String channel;
private String des;
private Date create_time;
private Date update_time;
public String getOut_platform_id() {
return out_platform_id;
}
public void setOut_platform_id(String out_platform_id) {
this.out_platform_id = out_platform_id;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Date getUpdate_time() {
return update_time;
}
public void setUpdate_time(Date update_time) {
this.update_time = update_time;
}
} | [
"804926181@qq.com"
] | 804926181@qq.com |
55ad7b41b64ec8fcae574755ea3ac186f1d2a148 | 526f20906ee0063766b683bf1ac398dc7187703c | /tij4exercises/innerclasses/innerclasses/exercises/exercise17.java | 660e44a549db0614a0c67d50a315ff328507b4e7 | [] | no_license | AlexLixin/study | 25625895cb779c080405c74fd686a5446cdfd368 | 78ff1a7144afd58bcdd65ef1906fe220abb332da | refs/heads/master | 2020-04-09T03:55:46.882618 | 2019-08-16T17:35:54 | 2019-08-16T17:35:54 | 160,003,198 | 2 | 3 | null | 2018-12-17T13:14:08 | 2018-12-02T01:29:53 | Java | UTF-8 | Java | false | false | 1,987 | java | /************************************************************************
* *
* DDDD SSSS AAA Daten- und Systemtechnik Aachen GmbH *
* D D SS A A Pascalstrasse 28 *
* D D SSS AAAAA 52076 Aachen-Oberforstbach, Germany *
* D D SS A A Telefon: +49 (0)2408 / 9492-0 *
* DDDD SSSS A A Telefax: +49 (0)2408 / 9492-92 *
* *
* *
* (c) Copyright by DSA - all rights reserved *
* *
************************************************************************
*
* Initial Creation:
* Author LXI
* Created on Dec 17, 2018
*
************************************************************************/
package innerclasses.exercises;
interface Game {
void play();
}
interface GameFactory {
Game getGame();
}
class CoinGame implements Game {
public static GameFactory factory = new GameFactory() {
@Override
public Game getGame() {
return new CoinGame();
}
};
@Override
public void play() {
System.out.println("play CoinGame");
}
}
class DiceGame implements Game {
public static GameFactory factory = new GameFactory() {
@Override
public Game getGame() {
return new DiceGame();
}
};
@Override
public void play() {
System.out.println("play DiceGame");
}
}
public class exercise17 {
public static Game getGame(GameFactory f) {
return f.getGame();
}
public static void main(String[] args) {
getGame(CoinGame.factory).play();
getGame(DiceGame.factory).play();
}
}
| [
"lixin1996919@126.com"
] | lixin1996919@126.com |
37bc24c213c97ee186f1aad91b9fb13fd9b161fe | fb0fe0dd4947b34b377f12b9f3de0681d4dd590f | /src/main/java/com/redhat/emergency/response/incident/finder/rest/IncidentEndpoint.java | bfb13fe19ba3d7afbfe3734b14d793ed1e5aefff | [] | no_license | btison/emergency-response-demo-incident-finder-service | ed64f11f7e07040c811e09f36f6ca8116fe7bad6 | c363664730a35b4fe08dccdbcb6997c2da091c87 | refs/heads/master | 2020-12-03T04:45:25.783839 | 2020-06-30T21:40:14 | 2020-06-30T21:49:51 | 231,207,622 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package com.redhat.emergency.response.incident.finder.rest;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.redhat.emergency.response.incident.finder.model.Incident;
import com.redhat.emergency.response.incident.finder.streams.InteractiveQueries;
@ApplicationScoped
@Path("/")
public class IncidentEndpoint {
@Inject
InteractiveQueries interactiveQueries;
@GET
@Path("/incident/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response getIncident(@PathParam("id") String id) {
Incident result = interactiveQueries.getIncident(id);
if (result == null) {
return Response.status(Response.Status.NOT_FOUND.getStatusCode()).build();
} else {
return Response.ok(result).build();
}
}
}
| [
"bernard.tison@gmail.com"
] | bernard.tison@gmail.com |
1f9c9a246a74e23c0de378073a9a59a183adbd2e | 8251c759d07630b68737606b755c8b7f20d8e659 | /src/com/ykse/jaxb/satellite/ftp/Response.java | fa1f4428005367e40eb56841e0574a62ed39e921 | [] | no_license | nixidexiangjiao/SatelliteDemoTwo | 615a928a2864682b34e1b8adcb4e1349476ca320 | 6393b60d034981808cab244623916b5ee246fdf9 | refs/heads/master | 2022-06-06T11:52:09.775731 | 2013-12-02T06:41:08 | 2013-12-02T06:41:08 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 6,109 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0-b52-fcs
// 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: 2013.05.21 at 10:37:50 ÉÏÎç CST
//
package com.ykse.jaxb.satellite.ftp;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for response element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="response">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{}asset_type"/>
* <element ref="{}source"/>
* <element ref="{}username"/>
* <element ref="{}password"/>
* <element ref="{}path"/>
* </sequence>
* <attribute name="status" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
* <attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"assetType",
"source",
"username",
"password",
"path"
})
@XmlRootElement(name = "response")
public class Response {
@XmlElement(name = "asset_type", required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String assetType;
@XmlElement(required = true)
protected String source;
@XmlElement(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String username;
@XmlElement(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String password;
@XmlElement(required = true)
protected String path;
@XmlAttribute(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String status;
@XmlAttribute(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String version;
/**
* Gets the value of the assetType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAssetType() {
return assetType;
}
/**
* Sets the value of the assetType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAssetType(String value) {
this.assetType = value;
}
/**
* Gets the value of the source property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSource() {
return source;
}
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSource(String value) {
this.source = value;
}
/**
* Gets the value of the username property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUsername() {
return username;
}
/**
* Sets the value of the username property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUsername(String value) {
this.username = value;
}
/**
* Gets the value of the password property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPassword() {
return password;
}
/**
* Sets the value of the password property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPassword(String value) {
this.password = value;
}
/**
* Gets the value of the path property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPath() {
return path;
}
/**
* Sets the value of the path property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPath(String value) {
this.path = value;
}
/**
* Gets the value of the status property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStatus() {
return status;
}
/**
* Sets the value of the status property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStatus(String value) {
this.status = value;
}
/**
* Gets the value of the version property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVersion() {
return version;
}
/**
* Sets the value of the version property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVersion(String value) {
this.version = value;
}
}
| [
"h198798337@126.com"
] | h198798337@126.com |
982b6e80285a519ca361ce854654cf92aef1d0c9 | 90940437225c702036a5548d8d12b20a4b650372 | /netty-study/src/main/java/com/lt/example/rxtx/RxtxClient.java | 239798ea8f16c08eb7601843a4dec907f325b1ec | [] | no_license | Lambdua/SpringBootAll | 1d23b10b8998e192297ad271f02f6c7f5dda22af | c28a6ff4ae99d0de505597002094ea09f12bbb1e | refs/heads/master | 2023-06-27T10:38:45.720565 | 2021-07-26T00:46:03 | 2021-07-26T00:46:03 | 279,198,543 | 0 | 0 | null | 2021-07-23T06:18:59 | 2020-07-13T03:17:59 | Java | UTF-8 | Java | false | false | 2,192 | java | /*
* Copyright 2013 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.lt.example.rxtx;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.oio.OioEventLoopGroup;
import io.netty.channel.rxtx.RxtxChannel;
import io.netty.channel.rxtx.RxtxDeviceAddress;
import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
/**
* Sends one message to a serial device
*/
public final class RxtxClient {
static final String PORT = System.getProperty("port", "/dev/ttyUSB0");
public static void main(String[] args) throws Exception {
EventLoopGroup group = new OioEventLoopGroup();
try {
Bootstrap b = new Bootstrap();
b.group(group)
.channel(RxtxChannel.class)
.handler(new ChannelInitializer<RxtxChannel>() {
@Override
public void initChannel(RxtxChannel ch) throws Exception {
ch.pipeline().addLast(
new LineBasedFrameDecoder(32768),
new StringEncoder(),
new StringDecoder(),
new RxtxClientHandler()
);
}
});
ChannelFuture f = b.connect(new RxtxDeviceAddress(PORT)).sync();
f.channel().closeFuture().sync();
} finally {
group.shutdownGracefully();
}
}
}
| [
"lt547670718@gmail.com"
] | lt547670718@gmail.com |
904992ecd2860b735665f149abfd5ba05c77f76f | aabb0c94c02de66d2d38f6b9feee9bf79cbdb3f7 | /app/src/main/java/com/jishang/bimeng/entity/yuezhan/wzf/CancelEntity.java | 2b5c7fd768c96416c272f40806805ff0f8bca120 | [] | no_license | zhaohuiyuliang/LE_BiMeng | e90fa88f937dd62e3c9584ff43d54f8e32f5eb30 | 1b24683427078dee1654f2521bd58cb90f946d61 | refs/heads/master | 2021-01-18T04:44:20.743052 | 2017-03-08T03:55:25 | 2017-03-08T03:55:25 | 84,274,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | package com.jishang.bimeng.entity.yuezhan.wzf;
public class CancelEntity {
private int status;
private String status_code;
private String data;
public CancelEntity() {
super();
}
public CancelEntity(int status, String status_code, String data) {
super();
this.status = status;
this.status_code = status_code;
this.data = data;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getStatus_code() {
return status_code;
}
public void setStatus_code(String status_code) {
this.status_code = status_code;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Override
public String toString() {
return "CancelEntity [status=" + status + ", status_code="
+ status_code + ", data=" + data + "]";
}
}
| [
"wwwduyang@sina.cn"
] | wwwduyang@sina.cn |
04a67a1e53c778759b2ba6cf72da2e5389935baf | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Mate20-9.0/src/main/java/vendor/huawei/hardware/hwstp/V1_0/IHwStp.java | ed0415aa1c34caf332d50fbe3b399690cf68c4a3 | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,347 | java | package vendor.huawei.hardware.hwstp.V1_0;
import android.hidl.base.V1_0.DebugInfo;
import android.hidl.base.V1_0.IBase;
import android.os.HidlSupport;
import android.os.HwBinder;
import android.os.HwBlob;
import android.os.HwParcel;
import android.os.IHwBinder;
import android.os.IHwInterface;
import android.os.RemoteException;
import com.android.server.display.HwUibcReceiver;
import com.android.server.rms.iaware.memory.utils.MemoryConstant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Objects;
public interface IHwStp extends IBase {
public static final String kInterfaceName = "vendor.huawei.hardware.hwstp@1.0::IHwStp";
public static final class Proxy implements IHwStp {
private IHwBinder mRemote;
public Proxy(IHwBinder remote) {
this.mRemote = (IHwBinder) Objects.requireNonNull(remote);
}
public IHwBinder asBinder() {
return this.mRemote;
}
public String toString() {
try {
return interfaceDescriptor() + "@Proxy";
} catch (RemoteException e) {
return "[class or subclass of vendor.huawei.hardware.hwstp@1.0::IHwStp]@Proxy";
}
}
public final boolean equals(Object other) {
return HidlSupport.interfacesEqual(this, other);
}
public final int hashCode() {
return asBinder().hashCode();
}
public int stpAddThreat(StpItem item, String in_buff) throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IHwStp.kInterfaceName);
item.writeToParcel(_hidl_request);
_hidl_request.writeString(in_buff);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(1, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
return _hidl_reply.readInt32();
} finally {
_hidl_reply.release();
}
}
public void stpGetStatus(boolean inDetail, boolean withHistory, stpGetStatusCallback _hidl_cb) throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IHwStp.kInterfaceName);
_hidl_request.writeBool(inDetail);
_hidl_request.writeBool(withHistory);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(2, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
_hidl_cb.onValues(_hidl_reply.readInt32(), _hidl_reply.readString());
} finally {
_hidl_reply.release();
}
}
public void stpGetStatusById(int id, boolean inDetail, boolean withHistory, stpGetStatusByIdCallback _hidl_cb) throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IHwStp.kInterfaceName);
_hidl_request.writeInt32(id);
_hidl_request.writeBool(inDetail);
_hidl_request.writeBool(withHistory);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(3, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
_hidl_cb.onValues(_hidl_reply.readInt32(), _hidl_reply.readString());
} finally {
_hidl_reply.release();
}
}
public void stpGetStatusByCategory(int category, boolean inDetail, boolean withHistory, stpGetStatusByCategoryCallback _hidl_cb) throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IHwStp.kInterfaceName);
_hidl_request.writeInt32(category);
_hidl_request.writeBool(inDetail);
_hidl_request.writeBool(withHistory);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(4, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
_hidl_cb.onValues(_hidl_reply.readInt32(), _hidl_reply.readString());
} finally {
_hidl_reply.release();
}
}
public ArrayList<String> interfaceChain() throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IBase.kInterfaceName);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(256067662, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
return _hidl_reply.readStringVector();
} finally {
_hidl_reply.release();
}
}
public String interfaceDescriptor() throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IBase.kInterfaceName);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(256136003, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
return _hidl_reply.readString();
} finally {
_hidl_reply.release();
}
}
public ArrayList<byte[]> getHashChain() throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IBase.kInterfaceName);
HwParcel _hidl_reply = new HwParcel();
try {
int _hidl_index_0 = 0;
this.mRemote.transact(256398152, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
ArrayList<byte[]> _hidl_out_hashchain = new ArrayList<>();
HwBlob _hidl_blob = _hidl_reply.readBuffer(16);
int _hidl_vec_size = _hidl_blob.getInt32(8);
HwBlob childBlob = _hidl_reply.readEmbeddedBuffer((long) (_hidl_vec_size * 32), _hidl_blob.handle(), 0, true);
_hidl_out_hashchain.clear();
while (true) {
int _hidl_index_02 = _hidl_index_0;
if (_hidl_index_02 >= _hidl_vec_size) {
return _hidl_out_hashchain;
}
byte[] _hidl_vec_element = new byte[32];
childBlob.copyToInt8Array((long) (_hidl_index_02 * 32), _hidl_vec_element, 32);
_hidl_out_hashchain.add(_hidl_vec_element);
_hidl_index_0 = _hidl_index_02 + 1;
}
} finally {
_hidl_reply.release();
}
}
public void setHALInstrumentation() throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IBase.kInterfaceName);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(256462420, _hidl_request, _hidl_reply, 1);
_hidl_request.releaseTemporaryStorage();
} finally {
_hidl_reply.release();
}
}
public boolean linkToDeath(IHwBinder.DeathRecipient recipient, long cookie) throws RemoteException {
return this.mRemote.linkToDeath(recipient, cookie);
}
public void ping() throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IBase.kInterfaceName);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(256921159, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
} finally {
_hidl_reply.release();
}
}
public DebugInfo getDebugInfo() throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IBase.kInterfaceName);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(257049926, _hidl_request, _hidl_reply, 0);
_hidl_reply.verifySuccess();
_hidl_request.releaseTemporaryStorage();
DebugInfo _hidl_out_info = new DebugInfo();
_hidl_out_info.readFromParcel(_hidl_reply);
return _hidl_out_info;
} finally {
_hidl_reply.release();
}
}
public void notifySyspropsChanged() throws RemoteException {
HwParcel _hidl_request = new HwParcel();
_hidl_request.writeInterfaceToken(IBase.kInterfaceName);
HwParcel _hidl_reply = new HwParcel();
try {
this.mRemote.transact(257120595, _hidl_request, _hidl_reply, 1);
_hidl_request.releaseTemporaryStorage();
} finally {
_hidl_reply.release();
}
}
public boolean unlinkToDeath(IHwBinder.DeathRecipient recipient) throws RemoteException {
return this.mRemote.unlinkToDeath(recipient);
}
}
public static abstract class Stub extends HwBinder implements IHwStp {
public IHwBinder asBinder() {
return this;
}
public final ArrayList<String> interfaceChain() {
return new ArrayList<>(Arrays.asList(new String[]{IHwStp.kInterfaceName, IBase.kInterfaceName}));
}
public final String interfaceDescriptor() {
return IHwStp.kInterfaceName;
}
public final ArrayList<byte[]> getHashChain() {
return new ArrayList<>(Arrays.asList(new byte[][]{new byte[]{HwUibcReceiver.CurrentPacket.INPUT_MASK, 13, -93, 63, 63, 45, 8, 8, 4, -116, -125, -41, 44, -124, 21, 88, -9, 107, -48, 1, -87, -94, 95, 123, 116, 94, -103, -43, 79, -41, 8, 69}, new byte[]{-67, -38, -74, 24, 77, 122, 52, 109, -90, -96, 125, -64, -126, -116, -15, -102, 105, 111, 76, -86, 54, 17, -59, 31, 46, 20, 86, 90, 20, -76, HwUibcReceiver.CurrentPacket.INPUT_MASK, -39}}));
}
public final void setHALInstrumentation() {
}
public final boolean linkToDeath(IHwBinder.DeathRecipient recipient, long cookie) {
return true;
}
public final void ping() {
}
public final DebugInfo getDebugInfo() {
DebugInfo info = new DebugInfo();
info.pid = HidlSupport.getPidIfSharable();
info.ptr = 0;
info.arch = 0;
return info;
}
public final void notifySyspropsChanged() {
HwBinder.enableInstrumentation();
}
public final boolean unlinkToDeath(IHwBinder.DeathRecipient recipient) {
return true;
}
public IHwInterface queryLocalInterface(String descriptor) {
if (IHwStp.kInterfaceName.equals(descriptor)) {
return this;
}
return null;
}
public void registerAsService(String serviceName) throws RemoteException {
registerService(serviceName);
}
public String toString() {
return interfaceDescriptor() + "@Stub";
}
public void onTransact(int _hidl_code, HwParcel _hidl_request, final HwParcel _hidl_reply, int _hidl_flags) throws RemoteException {
int _hidl_index_0 = 0;
boolean _hidl_is_oneway = true;
switch (_hidl_code) {
case 1:
if ((_hidl_flags & 1) == 0) {
_hidl_is_oneway = false;
}
if (_hidl_is_oneway) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IHwStp.kInterfaceName);
StpItem item = new StpItem();
item.readFromParcel(_hidl_request);
int _hidl_out_stpAddThreatRet = stpAddThreat(item, _hidl_request.readString());
_hidl_reply.writeStatus(0);
_hidl_reply.writeInt32(_hidl_out_stpAddThreatRet);
_hidl_reply.send();
return;
case 2:
if (_hidl_flags != false && true) {
_hidl_index_0 = 1;
}
if (_hidl_index_0 != 0) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IHwStp.kInterfaceName);
stpGetStatus(_hidl_request.readBool(), _hidl_request.readBool(), new stpGetStatusCallback() {
public void onValues(int stpGetStatusRet, String out_buff) {
_hidl_reply.writeStatus(0);
_hidl_reply.writeInt32(stpGetStatusRet);
_hidl_reply.writeString(out_buff);
_hidl_reply.send();
}
});
return;
case 3:
if (_hidl_flags != false && true) {
_hidl_index_0 = 1;
}
if (_hidl_index_0 != 0) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IHwStp.kInterfaceName);
stpGetStatusById(_hidl_request.readInt32(), _hidl_request.readBool(), _hidl_request.readBool(), new stpGetStatusByIdCallback() {
public void onValues(int stpGetStatusByIdRet, String out_buff) {
_hidl_reply.writeStatus(0);
_hidl_reply.writeInt32(stpGetStatusByIdRet);
_hidl_reply.writeString(out_buff);
_hidl_reply.send();
}
});
return;
case 4:
if ((_hidl_flags & 1) != 0) {
_hidl_index_0 = 1;
}
if (_hidl_index_0 != 0) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IHwStp.kInterfaceName);
stpGetStatusByCategory(_hidl_request.readInt32(), _hidl_request.readBool(), _hidl_request.readBool(), new stpGetStatusByCategoryCallback() {
public void onValues(int stpGetStatusByCategoryRet, String out_buff) {
_hidl_reply.writeStatus(0);
_hidl_reply.writeInt32(stpGetStatusByCategoryRet);
_hidl_reply.writeString(out_buff);
_hidl_reply.send();
}
});
return;
default:
switch (_hidl_code) {
case 256067662:
if ((_hidl_flags & 1) == 0) {
_hidl_is_oneway = false;
}
if (_hidl_is_oneway) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IBase.kInterfaceName);
ArrayList<String> _hidl_out_descriptors = interfaceChain();
_hidl_reply.writeStatus(0);
_hidl_reply.writeStringVector(_hidl_out_descriptors);
_hidl_reply.send();
return;
case 256131655:
if ((_hidl_flags & 1) == 0) {
_hidl_is_oneway = false;
}
if (_hidl_is_oneway) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IBase.kInterfaceName);
_hidl_reply.writeStatus(0);
_hidl_reply.send();
return;
case 256136003:
if ((_hidl_flags & 1) == 0) {
_hidl_is_oneway = false;
}
if (_hidl_is_oneway) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IBase.kInterfaceName);
String _hidl_out_descriptor = interfaceDescriptor();
_hidl_reply.writeStatus(0);
_hidl_reply.writeString(_hidl_out_descriptor);
_hidl_reply.send();
return;
case 256398152:
if ((_hidl_flags & 1) == 0) {
_hidl_is_oneway = false;
}
if (_hidl_is_oneway) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IBase.kInterfaceName);
ArrayList<byte[]> _hidl_out_hashchain = getHashChain();
_hidl_reply.writeStatus(0);
HwBlob _hidl_blob = new HwBlob(16);
int _hidl_vec_size = _hidl_out_hashchain.size();
_hidl_blob.putInt32(8, _hidl_vec_size);
_hidl_blob.putBool(12, false);
HwBlob childBlob = new HwBlob(_hidl_vec_size * 32);
while (_hidl_index_0 < _hidl_vec_size) {
childBlob.putInt8Array((long) (_hidl_index_0 * 32), _hidl_out_hashchain.get(_hidl_index_0));
_hidl_index_0++;
}
_hidl_blob.putBlob(0, childBlob);
_hidl_reply.writeBuffer(_hidl_blob);
_hidl_reply.send();
return;
case 256462420:
if ((_hidl_flags & 1) != 0) {
_hidl_index_0 = 1;
}
if (_hidl_index_0 != 1) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IBase.kInterfaceName);
setHALInstrumentation();
return;
case 256660548:
if ((_hidl_flags & 1) != 0) {
_hidl_index_0 = 1;
}
if (_hidl_index_0 != 0) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
return;
case 256921159:
if ((_hidl_flags & 1) == 0) {
_hidl_is_oneway = false;
}
if (_hidl_is_oneway) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IBase.kInterfaceName);
ping();
_hidl_reply.writeStatus(0);
_hidl_reply.send();
return;
case 257049926:
if ((_hidl_flags & 1) == 0) {
_hidl_is_oneway = false;
}
if (_hidl_is_oneway) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IBase.kInterfaceName);
DebugInfo _hidl_out_info = getDebugInfo();
_hidl_reply.writeStatus(0);
_hidl_out_info.writeToParcel(_hidl_reply);
_hidl_reply.send();
return;
case 257120595:
if ((_hidl_flags & 1) != 0) {
_hidl_index_0 = 1;
}
if (_hidl_index_0 != 1) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
_hidl_request.enforceInterface(IBase.kInterfaceName);
notifySyspropsChanged();
return;
case 257250372:
if ((_hidl_flags & 1) != 0) {
_hidl_index_0 = 1;
}
if (_hidl_index_0 != 0) {
_hidl_reply.writeStatus(Integer.MIN_VALUE);
_hidl_reply.send();
return;
}
return;
default:
return;
}
}
}
}
@FunctionalInterface
public interface stpGetStatusByCategoryCallback {
void onValues(int i, String str);
}
@FunctionalInterface
public interface stpGetStatusByIdCallback {
void onValues(int i, String str);
}
@FunctionalInterface
public interface stpGetStatusCallback {
void onValues(int i, String str);
}
IHwBinder asBinder();
DebugInfo getDebugInfo() throws RemoteException;
ArrayList<byte[]> getHashChain() throws RemoteException;
ArrayList<String> interfaceChain() throws RemoteException;
String interfaceDescriptor() throws RemoteException;
boolean linkToDeath(IHwBinder.DeathRecipient deathRecipient, long j) throws RemoteException;
void notifySyspropsChanged() throws RemoteException;
void ping() throws RemoteException;
void setHALInstrumentation() throws RemoteException;
int stpAddThreat(StpItem stpItem, String str) throws RemoteException;
void stpGetStatus(boolean z, boolean z2, stpGetStatusCallback stpgetstatuscallback) throws RemoteException;
void stpGetStatusByCategory(int i, boolean z, boolean z2, stpGetStatusByCategoryCallback stpgetstatusbycategorycallback) throws RemoteException;
void stpGetStatusById(int i, boolean z, boolean z2, stpGetStatusByIdCallback stpgetstatusbyidcallback) throws RemoteException;
boolean unlinkToDeath(IHwBinder.DeathRecipient deathRecipient) throws RemoteException;
static IHwStp asInterface(IHwBinder binder) {
if (binder == null) {
return null;
}
IHwInterface iface = binder.queryLocalInterface(kInterfaceName);
if (iface != null && (iface instanceof IHwStp)) {
return (IHwStp) iface;
}
IHwStp proxy = new Proxy(binder);
try {
Iterator<String> it = proxy.interfaceChain().iterator();
while (it.hasNext()) {
if (it.next().equals(kInterfaceName)) {
return proxy;
}
}
} catch (RemoteException e) {
}
return null;
}
static IHwStp castFrom(IHwInterface iface) {
if (iface == null) {
return null;
}
return asInterface(iface.asBinder());
}
static IHwStp getService(String serviceName, boolean retry) throws RemoteException {
return asInterface(HwBinder.getService(kInterfaceName, serviceName, retry));
}
static IHwStp getService(boolean retry) throws RemoteException {
return getService(MemoryConstant.MEM_SCENE_DEFAULT, retry);
}
static IHwStp getService(String serviceName) throws RemoteException {
return asInterface(HwBinder.getService(kInterfaceName, serviceName));
}
static IHwStp getService() throws RemoteException {
return getService(MemoryConstant.MEM_SCENE_DEFAULT);
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
b2929292c98f257cfc860578cb35a0e53b17b8b9 | 9623f83defac3911b4780bc408634c078da73387 | /powercraft/temp/src/minecraft/net/minecraft/src/EnumOptionsHelper.java | 21218d3e62bb0e439a14a48c13b2770d0b98b9df | [] | no_license | BlearStudio/powercraft-legacy | 42b839393223494748e8b5d05acdaf59f18bd6c6 | 014e9d4d71bd99823cf63d4fbdb65c1b83fde1f8 | refs/heads/master | 2021-01-21T21:18:55.774908 | 2015-04-06T20:45:25 | 2015-04-06T20:45:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,512 | java | package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import net.minecraft.src.EnumOptions;
@SideOnly(Side.CLIENT)
// $FF: synthetic class
class EnumOptionsHelper {
// $FF: synthetic field
static final int[] field_74414_a = new int[EnumOptions.values().length];
static {
try {
field_74414_a[EnumOptions.INVERT_MOUSE.ordinal()] = 1;
} catch (NoSuchFieldError var15) {
;
}
try {
field_74414_a[EnumOptions.VIEW_BOBBING.ordinal()] = 2;
} catch (NoSuchFieldError var14) {
;
}
try {
field_74414_a[EnumOptions.ANAGLYPH.ordinal()] = 3;
} catch (NoSuchFieldError var13) {
;
}
try {
field_74414_a[EnumOptions.ADVANCED_OPENGL.ordinal()] = 4;
} catch (NoSuchFieldError var12) {
;
}
try {
field_74414_a[EnumOptions.AMBIENT_OCCLUSION.ordinal()] = 5;
} catch (NoSuchFieldError var11) {
;
}
try {
field_74414_a[EnumOptions.RENDER_CLOUDS.ordinal()] = 6;
} catch (NoSuchFieldError var10) {
;
}
try {
field_74414_a[EnumOptions.CHAT_COLOR.ordinal()] = 7;
} catch (NoSuchFieldError var9) {
;
}
try {
field_74414_a[EnumOptions.CHAT_LINKS.ordinal()] = 8;
} catch (NoSuchFieldError var8) {
;
}
try {
field_74414_a[EnumOptions.CHAT_LINKS_PROMPT.ordinal()] = 9;
} catch (NoSuchFieldError var7) {
;
}
try {
field_74414_a[EnumOptions.USE_SERVER_TEXTURES.ordinal()] = 10;
} catch (NoSuchFieldError var6) {
;
}
try {
field_74414_a[EnumOptions.SNOOPER_ENABLED.ordinal()] = 11;
} catch (NoSuchFieldError var5) {
;
}
try {
field_74414_a[EnumOptions.USE_FULLSCREEN.ordinal()] = 12;
} catch (NoSuchFieldError var4) {
;
}
try {
field_74414_a[EnumOptions.ENABLE_VSYNC.ordinal()] = 13;
} catch (NoSuchFieldError var3) {
;
}
try {
field_74414_a[EnumOptions.SHOW_CAPE.ordinal()] = 14;
} catch (NoSuchFieldError var2) {
;
}
try {
field_74414_a[EnumOptions.TOUCHSCREEN.ordinal()] = 15;
} catch (NoSuchFieldError var1) {
;
}
}
}
| [
"nils.h.emmerich@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c"
] | nils.h.emmerich@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c |
15974aeed3b5cbe660580bfd9a17ac9677b5562c | 21268d1ca1660d6d6439a30c7b38a004b41c2ea0 | /src/semana02/teorico/UsoArrayList.java | 3ad97fd1527326dde2a3245604eccdd744fe0cc0 | [] | no_license | Middley/Contruccion_Software_One | 30ef1c5436ae7c983bdbd3fb55758b04c68e3638 | 346f0bee5add15ca2dfdf11d83474a6e238fac3b | refs/heads/master | 2020-12-31T11:19:28.717831 | 2020-03-06T14:24:10 | 2020-03-06T14:24:10 | 239,015,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package semana02.teorico;
import java.util.ArrayList;
/**
*
* @author DEYGLIS MIDDLEY
*/
public class UsoArrayList {
public static void main(String[] args) {
// palabras que terminar en y
ArrayList<String> misCadenas = new ArrayList<>();
misCadenas.add("Martha");
misCadenas.add("Pablo");
misCadenas.add("Middley");
misCadenas.add("kelly");
int contador = 0;
for (int i = 0; i < misCadenas.size(); i++) {
String cadenas = misCadenas.get(i);
System.out.println(cadenas);
if(cadenas.endsWith("y")){
contador++;
}
}
System.out.println(contador);
}
}
| [
"amiddley@gmail.com"
] | amiddley@gmail.com |
af84632197f7ac23026b031a7269aec1d97a1fbb | ac333595382b5e6636b74920356dc415e5786a0a | /RedditCloneMicroservice/src/test/java/com/rc/auth/RcAuthenticationApplicationTests.java | 57d708d228f1b84ddf5049c618dceeb805bc2f86 | [] | no_license | yagyesh03/RedditClone | 5d678a89970c133abd49b6b77dba1017b2220847 | 7ba6a46cc31cbad778577260aa1879fe8fdcb041 | refs/heads/master | 2022-12-12T01:22:16.081974 | 2020-09-13T09:00:08 | 2020-09-13T09:00:08 | 294,587,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | package com.rc.auth;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class RcAuthenticationApplicationTests {
@Test
void contextLoads() {
}
}
| [
"yagyesh03@gmail.com"
] | yagyesh03@gmail.com |
a99d09e2542391d0044b3091dcdad371a3e3b9d7 | bb448de9035032578768a9951ddd55f98ac3f5d9 | /task-server/src/main/java/com/fuli/task/server/TaskApplication.java | 6625708bbd761ad4ac5dfe8c7d4e38b6c45c9c32 | [] | no_license | zhangdongsheng1991/fuli-basic-platform1 | 61476969a74449f5f05452205044336844846cdd | ee7d7bdda01651a0ddb4507cd083e6af42266335 | refs/heads/master | 2022-06-22T12:56:38.025301 | 2020-01-13T10:14:53 | 2020-01-13T10:14:53 | 233,567,009 | 0 | 0 | null | 2022-06-17T02:51:13 | 2020-01-13T10:13:15 | Java | UTF-8 | Java | false | false | 1,096 | java | package com.fuli.task.server;
import com.fuli.logtrace.annotation.EnableLogTraceConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
/**
* 任务调度服务
* @Author create by XYJ
* @Date 2019/10/11 12:52
**/
@EnableLogTraceConfig //开启日志追踪
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class TaskApplication {
/**
* 开启 @LoadBalanced 与 Ribbon 的集成
* @return
*/
// @LoadBalanced
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(TaskApplication.class, args);
}
}
| [
"360940982@qq.com"
] | 360940982@qq.com |
d3a880d52b26ecb0fdad8518b90ddf2822024afd | ecb8b37613fb3c41bb58e90a23c5383a0444e490 | /clients-k8s/src/main/java/com/simplyti/service/clients/k8s/serviceaccounts/NamespacedServiceAccounts.java | cdb0a84ed874f607cadffdc976ab9be612789b8c | [] | no_license | simplyti/simple-server | 56d232ded25198a17c92c9b732b7a5986933aff8 | edb32f6db6d3bb38ce3400a904f8e942817d385b | refs/heads/master | 2022-12-22T10:38:54.273652 | 2022-04-10T19:31:25 | 2022-04-10T19:31:25 | 129,148,945 | 6 | 1 | null | 2022-12-12T21:44:11 | 2018-04-11T20:15:54 | Java | UTF-8 | Java | false | false | 414 | java | package com.simplyti.service.clients.k8s.serviceaccounts;
import com.simplyti.service.clients.k8s.common.NamespacedK8sApi;
import com.simplyti.service.clients.k8s.serviceaccounts.builder.ServiceAccountBuilder;
import com.simplyti.service.clients.k8s.serviceaccounts.domain.ServiceAccount;
public interface NamespacedServiceAccounts extends NamespacedK8sApi<ServiceAccount> {
ServiceAccountBuilder builder();
} | [
"pablo.taboas@bbva.com"
] | pablo.taboas@bbva.com |
cc3486c7c880704c07573541ac21199da1184795 | 82f8583efa79ec0b46824105f1752d83c000dc4a | /app/src/main/java/com/zx/agv/controller/viewModel/MainViewModel.java | 033969e65ef02523bdc6a6eda8b39140bd07e7d9 | [] | no_license | zhuxibrian/Controller | 32062108b962e8735f44067affe806f977ac75a2 | f2bab5950121d40f96d3a3f575467d86262cb509 | refs/heads/master | 2020-12-30T10:49:41.198767 | 2017-07-31T07:32:31 | 2017-07-31T07:32:31 | 94,677,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,183 | java | package com.zx.agv.controller.viewModel;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import com.zx.agv.controller.databinding.ActivityMainBinding;
import com.zx.agv.controller.databinding.ContentMainBinding;
import com.zx.agv.controller.domain.ControllerInfo;
import com.zx.agv.controller.domain.RequestEntity;
import com.zx.agv.controller.socket.Const;
import com.zx.agv.controller.socket.SocketThreadManager;
import static com.zx.agv.controller.util.ByteConvert.IntConvertByte;
import static com.zx.agv.controller.util.OXR.countOXR;
/**
* Created by zx on 2017/7/2.
*/
public class MainViewModel {
private ActivityMainBinding activityMainBinding;
private ContentMainBinding contentMainBinding;
private AppCompatActivity activity;
private ControllerInfo controllerInfo;
Handler handler = null;
public MainViewModel(AppCompatActivity activity, ActivityMainBinding activityMainBinding) {
this.activity = activity;
this.activityMainBinding = activityMainBinding;
this.contentMainBinding = activityMainBinding.contentMain;
init();
}
public void init() {
activity.setSupportActionBar(activityMainBinding.toolbar);
// activityMainBinding.fab.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();
// }
// });
controllerInfo = new ControllerInfo();
contentMainBinding.setViewModel(this);
// contentMainBinding.lineId.setText("1");
}
public void getControlInfo() {
controllerInfo.setAgvId(contentMainBinding.agvInfoPicker.getAGVIndex());
controllerInfo.setLineId(contentMainBinding.agvInfoPicker.getLineNoIndex());
controllerInfo.setSpeed(contentMainBinding.agvInfoPicker.getSpeedIndex());
}
public void setLineAndSpeed(byte byteLine, byte byteSpeed) {//字节是什么意思
int line = byteLine;
int speed = byteSpeed;
contentMainBinding.agvInfoPicker.setLineNoIndex(line);
contentMainBinding.agvInfoPicker.setSpeedIndex(speed);
}
public void onChangeInfoClicked(View v) {
getControlInfo();
Toast.makeText(activity, "更改状态", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.FALSE);
request.setByte(6,Const.FALSE);
request.setByte(7,IntConvertByte(controllerInfo.getSpeed()));
request.setByte(8,IntConvertByte(controllerInfo.getLineId()));
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
}
public void onShouDongQianYinClick(View v) {
getControlInfo();
if (contentMainBinding.shouDongQianYin.isChecked()) {
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.SDQY);
request.setByte(6,Const.TRUE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
Toast.makeText(activity, "向上 按键按下", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(activity, "向下 按键按下", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.SDQY);
request.setByte(6,Const.FALSE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
}
}
public void onQuDongTiShengClick(View v) {
getControlInfo();
if (contentMainBinding.quDongTiSheng.isChecked()) {
Toast.makeText(activity, "驱动提升 按键按下", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.QDTS);
request.setByte(6,Const.TRUE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
} else {
Toast.makeText(activity, "驱动下降 按键按下", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.QDTS);
request.setByte(6,Const.FALSE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
}
}
public void onFangXiangQieHuanClick(View v) {
getControlInfo();
if (contentMainBinding.fangXiangQieHuan.isChecked()) {
Toast.makeText(activity, "向前 按键按下", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.FXQH);
request.setByte(6,Const.FALSE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
// int curSpeed = controllerInfo.getSpeed();
// int curLine = controllerInfo.getLineId();
// if (curSpeed != 0) request.setByte(7, IntConvertByte(curSpeed));
// if (curLine != 0) request.setByte(8, IntConvertByte(curLine));
// request.setByte(10, countOXR(request.getBytes()));
// SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
} else {
Toast.makeText(activity, "向后 按键按下", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.FXQH);
request.setByte(6,Const.TRUE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
}
}
public void onStartClick(View v) {
getControlInfo();
Toast.makeText(activity, "开始 按键按下", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.START);
request.setByte(6,Const.FALSE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
}
public void onStopClick(View v) {
getControlInfo();
Toast.makeText(activity, "停止 按键按下", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.STOP);
request.setByte(6,Const.FALSE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
}
public void onResetClick(View v) {
getControlInfo();
Toast.makeText(activity, "复位 按键按下", Toast.LENGTH_SHORT).show();
RequestEntity request = new RequestEntity();
request.setByte(4, IntConvertByte(controllerInfo.getAgvId()));
request.setByte(5, Const.RESET);
request.setByte(6,Const.FALSE);
request.setByte(10, countOXR(request.getBytes()));
SocketThreadManager.sharedInstance().sendMsg(request.getBytes(), handler);
}
} | [
"zhuxibrian@icloud.com"
] | zhuxibrian@icloud.com |
8b908d85e3a70a97d71e520d13acec181316a9d1 | 16a2c77824604f1786c11cb1f349fa217fe04bda | /src/com/millennialmedia/intellibot/ide/inspections/readability/RobotKeywordDefinitionStartingWithGherkin.java | da74edd687ea33640447b42e50fdbce1cb7fbed8 | [
"MIT"
] | permissive | mtrubs/intellibot | 697c3bc7cb773c77c00ae46817dcb6b1be3ce8e3 | a0e24156fb6bc5302f9d15737f7ada5836780f7f | refs/heads/master | 2021-09-08T06:01:29.164911 | 2018-08-29T20:49:46 | 2018-08-29T20:49:46 | 14,752,051 | 21 | 19 | MIT | 2021-09-02T16:45:19 | 2013-11-27T16:14:11 | Java | UTF-8 | Java | false | false | 1,658 | java | package com.millennialmedia.intellibot.ide.inspections.readability;
import com.intellij.psi.PsiElement;
import com.millennialmedia.intellibot.RobotBundle;
import com.millennialmedia.intellibot.ide.inspections.SimpleRobotInspection;
import com.millennialmedia.intellibot.psi.RobotKeywordProvider;
import com.millennialmedia.intellibot.psi.RobotTokenTypes;
import com.millennialmedia.intellibot.psi.element.KeywordDefinition;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* @author mrubino
* @since 2014-06-07
*/
public class RobotKeywordDefinitionStartingWithGherkin extends SimpleRobotInspection {
@Nls
@NotNull
@Override
public String getDisplayName() {
return RobotBundle.message("INSP.NAME.define.keyword.gherkin.start");
}
@Override
public boolean skip(PsiElement element) {
return !(element instanceof KeywordDefinition) || valid(((KeywordDefinition) element).getPresentableText());
}
private boolean valid(String text) {
Collection<String> gherkin = RobotKeywordProvider.getInstance().getSyntaxOfType(RobotTokenTypes.GHERKIN);
int firstSpace = text.indexOf(" ");
String word;
if (firstSpace < 0) {
word = text;
} else {
word = text.substring(0, firstSpace);
}
return !gherkin.contains(word);
}
@Override
public String getMessage() {
return RobotBundle.message("INSP.define.keyword.gherkin.start");
}
@NotNull
@Override
protected String getGroupNameKey() {
return "INSP.GROUP.readability";
}
}
| [
"mrubino@millennialmedia.com"
] | mrubino@millennialmedia.com |
73547895dcb17792b4310b4f88e50c354ac01846 | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE470_Unsafe_Reflection/CWE470_Unsafe_Reflection__console_readLine_07.java | 766ebb12ea286a44d1c95dc903a55cd66b15b8f4 | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 6,135 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE470_Unsafe_Reflection__console_readLine_07.java
Label Definition File: CWE470_Unsafe_Reflection.label.xml
Template File: sources-sink-07.tmpl.java
*/
/*
* @description
* CWE: 470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')
* BadSource: console_readLine Read data from the console using readLine()
* GoodSource: Set data to a hardcoded class name
* BadSink: Instantiate class named in data
* Flow Variant: 07 Control flow: if(privateFive==5) and if(privateFive!=5)
*
* */
package testcases.CWE470_Unsafe_Reflection;
import testcasesupport.*;
import javax.servlet.http.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.logging.Level;
public class CWE470_Unsafe_Reflection__console_readLine_07 extends AbstractTestCase
{
/* The variable below is not declared "final", but is never assigned
* any other value so a tool should be able to identify that reads of
* this will always give its initialized value.
*/
private int privateFive = 5;
/* uses badsource and badsink */
public void bad() throws Throwable
{
String data;
if (privateFive == 5)
{
data = ""; /* Initialize data */
{
InputStreamReader readerInputStream = null;
BufferedReader readerBuffered = null;
/* read user input from console with readLine */
try
{
readerInputStream = new InputStreamReader(System.in, "UTF-8");
readerBuffered = new BufferedReader(readerInputStream);
/* POTENTIAL FLAW: Read data from the console using readLine */
data = readerBuffered.readLine();
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO);
}
finally
{
try
{
if (readerBuffered != null)
{
readerBuffered.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO);
}
try
{
if (readerInputStream != null)
{
readerInputStream.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO);
}
}
}
/* NOTE: Tools may report a flaw here because buffread and isr are not closed. Unfortunately, closing those will close System.in, which will cause any future attempts to read from the console to fail and throw an exception */
}
else
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = null;
}
/* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */
Class<?> tempClass = Class.forName(data);
Object tempClassObject = tempClass.newInstance();
IO.writeLine(tempClassObject.toString()); /* Use tempClassObject in some way */
}
/* goodG2B1() - use goodsource and badsink by changing privateFive==5 to privateFive!=5 */
private void goodG2B1() throws Throwable
{
String data;
if (privateFive != 5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = null;
}
else
{
/* FIX: Use a hardcoded class name */
data = "Testing.test";
}
/* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */
Class<?> tempClass = Class.forName(data);
Object tempClassObject = tempClass.newInstance();
IO.writeLine(tempClassObject.toString()); /* Use tempClassObject in some way */
}
/* goodG2B2() - use goodsource and badsink by reversing statements in if */
private void goodG2B2() throws Throwable
{
String data;
if (privateFive == 5)
{
/* FIX: Use a hardcoded class name */
data = "Testing.test";
}
else
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = null;
}
/* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */
Class<?> tempClass = Class.forName(data);
Object tempClassObject = tempClass.newInstance();
IO.writeLine(tempClassObject.toString()); /* Use tempClassObject in some way */
}
public void good() throws Throwable
{
goodG2B1();
goodG2B2();
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"bqcuong2212@gmail.com"
] | bqcuong2212@gmail.com |
51610ed189253fa54bdf44580195394bc56c1075 | 01b098e4495d49cd7be48609e70b5d87c78b7023 | /docker/LIME Testbench/LimeTB/source/limec/src/main/java/fi/hut/ics/lime/isl_c/frontend/DoxygenRunner.java | c15674435f0e5732f1357894ffd8ac2ea9b6b4b1 | [] | no_license | megamart2/integration | 0d4f184f5aed44a3d78678a9813479d62709e9bb | 7b6ee547f60493ab99f0e569f20c2024e6583041 | refs/heads/master | 2020-04-16T19:43:28.037748 | 2020-03-20T10:33:07 | 2020-03-20T10:33:07 | 165,871,359 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,676 | java | /**
* This class is responsible for running the third-party Doxygen tool so
* it generates XML representations of C source files. In other parts
* of the program, we read the XML, convert it into a representation of
* the program and then create aspect(s) from the representation.
*
* @author lharpf
*/
package fi.hut.ics.lime.isl_c.frontend;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import fi.hut.ics.lime.isl_c.Settings;
public class DoxygenRunner {
public DoxygenRunner() {
}
/**
* Runs the Doxygen document generator in the path indicated by the File
* pathToUse. When run, Doxygen generates XML files representing the
* structure of the C source files in the directory specified by
* pathToUse.
*
* @param pathToUse a directory indicating the path to run Doxygen in
*/
public void run(File pathToUse) throws IOException {
//System.out.print("Test1\n");
if (Settings.isVerbose()) {
System.out.print("Running doxygen on " + pathToUse.getAbsolutePath() +
" ... ");
}
//System.out.print("Test2\n");
if (!pathToUse.exists()) {
throw new IOException("ERROR: Directory " +
pathToUse.getAbsolutePath() +
" doesn't exist.");
} else if(!pathToUse.isDirectory()) {
throw new IOException("ERROR: " + pathToUse.getAbsolutePath() +
" is not a directory. Please give a " +
"directory name rather than a file name.");
}
//System.out.print("Test3\n");
Runtime rt = Runtime.getRuntime();
//System.out.print("Test4\n");
// Read the Doxygen config file from the JAR and output it to our
// temporary directory
BufferedInputStream bis = new BufferedInputStream(
getClass().getResourceAsStream("/fi/hut/ics/lime/isl_c/frontend/Doxyfile"));
//System.out.print("Test5\n");
File output = new File(pathToUse.getCanonicalPath() + File.separator +
"Doxyfile");
//System.out.print("Test6\n");
BufferedOutputStream bos = new BufferedOutputStream(
new FileOutputStream(output));
//System.out.print("Test7\n");
byte[] b = new byte[bis.available()];
bis.read(b);
bos.write(b, 0, b.length);
bis.close();
bos.close();
//System.out.print("Test8\n");
String[] appNameAndParam = new String[]{"doxygen", output.getCanonicalPath()};
Process doxygen = rt.exec(appNameAndParam, null, pathToUse);
//System.out.print("Test9\n");
try {
doxygen.waitFor();
} catch (InterruptedException ie) {
// do nothing
}
if (Settings.isVerbose()) {
System.out.println("Done.");
}
}
}
| [
"jesus.gorronogoitia@atos.net"
] | jesus.gorronogoitia@atos.net |
6ad76cb51664953fb12b7254f91712194f12e672 | 9e51a9315485cfbeb3ff57d7aa24497954a25cbf | /src/test/java/com/syntax/utils/CommonMethods.java | eaf0304a3205b40c75e53bc4b7153a8c1bebac81 | [] | no_license | hahmad2384/TestNGFramework | 540ce44c42d01d441c201632e69154f484cca27e | e3cb4edd97c733322246b1c8d33d692f58831257 | refs/heads/master | 2021-06-18T17:36:07.101410 | 2019-06-27T17:37:23 | 2019-06-27T17:37:23 | 194,137,905 | 0 | 0 | null | 2021-04-26T19:17:08 | 2019-06-27T17:36:24 | HTML | UTF-8 | Java | false | false | 6,443 | java | package com.syntax.utils;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchFrameException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
public class CommonMethods extends BaseClass{
/**
* @author Hussain This method will select a specified value from a drop down
* @param Select element, String text
*/
public static void selectValueFromDD(WebElement element, String text) {
Select select = new Select(element);
List<WebElement> options = select.getOptions();
boolean isSelected = false;
for (WebElement option : options) {
String optionText = option.getText();
if (optionText.equals(text)) {
select.selectByVisibleText(text);
System.out.println("Option with text "+text +" is selected");
isSelected = true;
break;
}
}
if(!isSelected) {
System.out.println("Option with text "+text +" is not avaialbe");
}
}
/**
* @author Hussain This method will select a specified value from a drop down by
* it's index
* @param Select element, int index
*/
public static void selectValueFromDD(WebElement element, int index) {
Select select = new Select(element);
List<WebElement> options = select.getOptions();
if (options.size() > index) {
select.selectByIndex(index);
} else {
System.out.println("Invalid index has been passed");
}
}
public static void deSelect(WebElement element, int index) {
Select multi = new Select(element);
List<WebElement> allOptions1 = multi.getOptions();
multi.deselectByIndex(2);
}
public static void sendText(WebElement element, String value) {
element.clear();
element.sendKeys(value);
}
/**
* Method will accept alert
*
* @throws NoAlertPresentException if alert is not present
*/
public static void selectRadio(WebElement element) {
if(element.isEnabled()) {
String text = element.getText();
element.click();
}
}
public static void selectCheckBox(WebElement element) {
if(element.isEnabled()) {
element.click();
}else {
System.out.println("element is not enable");
}
}
public static void selectList(WebElement element, String text) {
List<WebElement>listLocations = element.findElements(By.tagName("li"));
for (WebElement li : listLocations) {
String liText = li.getAttribute("innerHTML").trim();
if(liText.contains(text)) {
li.click();
break;
}
}
}
/**
* Method that will wait for element to be visible
*
* @param WebElement element, int time
*/
public static void waitForElementBeVisible(WebElement element, int time) {
WebDriverWait wait = new WebDriverWait(driver, time);
wait.until(ExpectedConditions.visibilityOf(element));
}
public static void waitForElementBeVisible(By locator, int time) {
WebDriverWait wait = new WebDriverWait(driver, time);
wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
}
public static void waitForElementBeClickable(WebElement element, int time) {
WebDriverWait wait = new WebDriverWait(driver, time);
wait.until(ExpectedConditions.elementToBeClickable(element));
}
public static void waitForElementBeClickable(By locator, int time) {
WebDriverWait wait = new WebDriverWait(driver, time);
wait.until(ExpectedConditions.elementToBeClickable(locator));
}
public static void acceptAlert() {
try {
Alert alert = driver.switchTo().alert();
alert.accept();
} catch (NoAlertPresentException e) {
System.out.println("Alert was not present");
}
}
/**
* Method will dismiss alert
*
* @throws NoAlertPresentException if alert is not present
*/
public static void dismissAlert() {
try {
Alert alert = driver.switchTo().alert();
alert.dismiss();
} catch (NoAlertPresentException e) {
System.out.println("Alert was not present");
}
}
/**
* Method will get text of an alert
* @throws NoAlertPresentException if alert is not present
* @return String text
*/
public static String getAlertText() {
try {
Alert alert = driver.switchTo().alert();
return alert.getText();
} catch (NoAlertPresentException e) {
System.out.println("Alert was not present");
return null;
}
}
/**
* Method will switch control to the specified frame
* @param frame id or frame name
*/
public static void switchToFrame(String idOrName) {
try {
driver.switchTo().frame(idOrName);
}catch(NoSuchFrameException e) {
System.out.println("Frame is not present");
}
}
/**
* Method will switch control to the specified frame
* @param frame element
*/
public static void switchToFrame(WebElement element) {
try {
driver.switchTo().frame(element);
}catch(NoSuchFrameException e) {
System.out.println("Frame is not present");
}
}
/**
* Method will switch control to the specified frame
* @param frame index
*/
public static void switchToFrame(int index) {
try {
driver.switchTo().frame(index);
}catch(NoSuchFrameException e) {
System.out.println("Frame is not present");
}
}
public static String takeScreenshot(String fileName) {
TakesScreenshot ts = (TakesScreenshot)driver;
File pic = ts.getScreenshotAs(OutputType.FILE);
String dest =System.getProperty("user.dir")+"/target/screenshots"+ fileName + ".png";
try {
FileUtils.copyFile(pic, new File(dest));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("Unable to take screenshot");
}
return dest;
}
public static void scrollDown(int pixels) {
JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript("window.scrollBy(0,"+pixels+")");
}
public static void scrollUp(int pixels) {
JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript("window.scrollBy(0,-"+pixels+")");
}
public static void jsClick(WebElement element) {
JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript("arguments[0].click();", element);
}
public static void click(WebElement element) {
element.click();
}
}
| [
"hahmad2384@gmail.com"
] | hahmad2384@gmail.com |
9ea67e62162ccb411aaace89f5f01b18a3648203 | a1c0c5ba5c8ef9f6958531a3e5e32fefc71c0358 | /src/array/KSelect.java | 46e56fae02fd573193f0a8a1a08eee3f2fbe804f | [
"MIT"
] | permissive | dingxwsimon/codingquestions | 0779e581af8621ca1727203adb2342bdf867c0df | d2d74354edbb7fd553889fddb00e8fe520e468e2 | refs/heads/master | 2021-06-26T21:00:09.982628 | 2017-01-14T21:43:13 | 2017-01-14T21:43:16 | 32,652,320 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,983 | java | package array;
import java.util.Random;
public class KSelect {
// nlogk
public static int select(int[] array, int i, int start, int end)
throws Exception {
if (array == null)
throw new Exception();
if (start == end)
return array[start];
int pIndex = random_partition(array, start, end);
int k = pIndex - start + 1;
if (i == k)
return array[pIndex];
else if (i < k)
return select(array, i, start, pIndex - 1);
else
return select(array, i - k, pIndex + 1, end);
}
// like the quick sort
public static int random_partition(int[] array, int start, int end) {
Random r = new Random();
int pIndex = start + r.nextInt(end - start);
int temp = array[end];
array[end] = array[pIndex];
array[pIndex] = temp;
return partition(array, start, end);
}
public static int partition(int[] array, int start, int end) {
int pivot = array[end];
int i = start;
for (int j = start; j < end; j++) {
if (array[j] <= pivot) {
int temp = array[i];
array[i] = array[j];
array[j] = temp;
i++;
}
}
int temp = array[i];
array[i] = array[end];
array[end] = temp;
return i;
}
public static int selectKth(int[] arr, int k) {
if (arr == null || arr.length <= k)
throw new Error();
int from = 0, to = arr.length - 1;
// if from == to we reached the kth element
while (from < to) {
int r = from, w = to;
int mid = arr[(r + w) / 2];
// stop if the reader and writer meets
while (r < w) {
if (arr[r] >= mid) { // put the large values at the end
int tmp = arr[w];
arr[w] = arr[r];
arr[r] = tmp;
w--;
} else { // the value is smaller than the pivot, skip
r++;
}
}
// if we stepped up (r++) we need to step one down
if (arr[r] > mid)
r--;
// the r pointer is on the end of the first k elements
if (k <= r) {
to = r;
} else {
from = r + 1;
}
}
return arr[k];
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] array = new int[]{10, 1, 2, 6, 4, 5, 3, 18};
try {
System.out.println(select(array, 3, 0, 6));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"dingxwsimon@gmail.com"
] | dingxwsimon@gmail.com |
2158fc70811990619827a1be49954003308d5bf6 | 2d24830daa1cb61b88930fb0f7647795138b68d6 | /src/main/java/com/yyd/semantic/db/service/music/SingerService.java | fc10cf1e57324134f82df1e97fcd1a5298eec440 | [] | no_license | celeryrobo/yyd-semantic | 43f5e8b7e8e7a3d3d8977795f4501d5c02b4b783 | 34dc670611510b020d7c732950c86ec927f43f8a | refs/heads/master | 2021-05-07T22:00:47.774741 | 2018-01-29T03:52:02 | 2018-01-29T03:52:02 | 109,075,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 273 | java | package com.yyd.semantic.db.service.music;
import java.util.List;
import com.yyd.semantic.db.bean.music.Singer;
public interface SingerService {
public Singer getById(Integer id);
public List<Integer> getIdsByName(String name);
public List<String> getAllNames();
}
| [
"799822792@163.com"
] | 799822792@163.com |
1b2f78f8eddee4e4a3fa377c240fdbfbfd85b22f | d9a3cc16e6fdaa8e6eb07352ba6ddd4898dcea7b | /YaSyncClient/src/mobitnt/net/YaSyncService.java | 0810b0b05b59f6ee795675b31946c9be9c9ed811 | [] | no_license | HamiguaLu/YaSync | d341bf391df7d33a7c90a2757f93aa1b4884c863 | 01fd05b894e59485384cce01a97ce4a82fa00a31 | refs/heads/master | 2021-01-13T01:57:55.233392 | 2015-04-28T15:17:09 | 2015-04-28T15:17:09 | 35,669,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,773 | java | package mobitnt.net;
import java.io.IOException;
import mobitnt.android.YaSync.YaSync;
import mobitnt.android.wrapper.SmsApi;
import mobitnt.util.EADefine;
import mobitnt.util.EAUtil;
import mobitnt.util.MobiTNTLog;
import android.annotation.SuppressLint;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.provider.CalendarContract;
import android.provider.ContactsContract;
import android.util.Log;
public class YaSyncService extends Service {
SrvSock m_SrvSock;
static YaSyncService myService = null;
public YaSyncService() {
Log.i("Service", "PE service started");
}
@Override
public IBinder onBind(Intent arg0) {
return mBinder;
}
@Override
public boolean onUnbind(Intent intent) {
super.onUnbind(intent);
MobiTNTLog.write("service onUnbind called");
return false;
}
public int onStartCommand(Intent intent, int flags, int startId) {
MobiTNTLog.write("service create called");
return START_STICKY;
}
private static BroadcastReceiver mBroadcastReceiver = new YaSyncReceiver();
private static Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
Log.i("PES", "---mHanlder----");
}
};
@SuppressLint("NewApi")
void InstallReceiver() {
IntentFilter filter = new IntentFilter();
filter.addAction(EADefine.INTENT_ACTION_PHONE_STATE);
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
registerReceiver(mBroadcastReceiver, filter);
SmsContentObserver smsChangeObserver = new SmsContentObserver(
EAUtil.GetEAContext(), mHandler);
getContentResolver().registerContentObserver(
Uri.parse("content://sms/"), true, smsChangeObserver);
ContactContentObserver contactChangeObserver = new ContactContentObserver(
EAUtil.GetEAContext(), mHandler);
getContentResolver().registerContentObserver(
ContactsContract.Contacts.CONTENT_URI, true,
contactChangeObserver);
if (android.os.Build.VERSION.SDK_INT > 14) {
CalendarContentObserver calendarChangeObserver = new CalendarContentObserver(
EAUtil.GetEAContext(), mHandler);
getContentResolver().registerContentObserver(
CalendarContract.Events.CONTENT_URI, true,
calendarChangeObserver);
}
}
@Override
public void onCreate() {
super.onCreate();
myService = this;
EAUtil.SetEAContext(this.getBaseContext());
MobiTNTLog.write("service create called");
InstallReceiver();
SmsApi.ReScheduleSms();
try {
m_SrvSock = new SrvSock();
m_SrvSock.htmlData = getResources().getAssets();
MobiTNTLog.write("Waiting for request...");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
MobiTNTLog.write("service create call failed:" + e.toString());
}
}
@Override
public void onDestroy() {
MobiTNTLog.write("service destroy called 1");
super.onDestroy();
Log.i("Service", "onDestroy");
MobiTNTLog.write("service destroy called");
}
private final iPESrvCtrl.Stub mBinder = new iPESrvCtrl.Stub() {
public int OP(int iOpCode) {
return 0;
}
};
static public void ShowInfoOnUI(String sInfo) {
if (myService != null) {
Intent intent = new Intent(YaSync.SHOW_SRV_INFO);
intent.putExtra("INFO", sInfo);
myService.sendBroadcast(intent);
}
}
}
| [
"hamigua@d59f0aba-a591-4168-a14a-4df7b8c41d6f"
] | hamigua@d59f0aba-a591-4168-a14a-4df7b8c41d6f |
24c11a239d8bc10765aad72ab235a9e54e3855d8 | 7246f4d2199303f985729c2f5dc6a5716b07a2ca | /app/src/main/java/will/tesler/drivethru/speech/SpeechService.java | 48ae69da56c93eec54a5357933eed5220dabd474 | [] | no_license | wtesler/DriveThru | 60769827a6c919a223b65868a26168ec278dfcce | 57a5c88a2d70398534dd9c913d004a063136880a | refs/heads/master | 2021-01-09T20:57:46.087338 | 2016-07-28T03:59:17 | 2016-07-28T03:59:17 | 64,007,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package will.tesler.drivethru.speech;
import retrofit.http.Body;
import retrofit.http.POST;
import rx.Observable;
import will.tesler.drivethru.speech.models.GcsSpeechRequest;
import will.tesler.drivethru.speech.models.SpeechResponse;
public interface SpeechService {
@POST("v1beta1/speech:syncrecognize")
Observable<SpeechResponse> getSpeechResults(@Body GcsSpeechRequest request);
}
| [
"willtesler@gmail.com"
] | willtesler@gmail.com |
203ff328523ba84e78ed7e068d6bb00d1840ba9f | 9d32980f5989cd4c55cea498af5d6a413e08b7a2 | /A92s_10_0_0/src/main/java/com/android/server/location/OppoLbsCustomize.java | e01de5c6b718aaf4b57e05abc5320bb23b9c4e55 | [] | no_license | liuhaosource/OppoFramework | e7cc3bcd16958f809eec624b9921043cde30c831 | ebe39acabf5eae49f5f991c5ce677d62b683f1b6 | refs/heads/master | 2023-06-03T23:06:17.572407 | 2020-11-30T08:40:07 | 2020-11-30T08:40:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,619 | java | package com.android.server.location;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.OppoMirrorProcess;
import android.os.SystemProperties;
import android.provider.Settings;
import android.util.Log;
import com.android.server.connectivity.networkrecovery.dnsresolve.StringUtils;
import com.android.server.location.interfaces.IPswLbsCustomize;
import java.text.SimpleDateFormat;
import java.util.Date;
public class OppoLbsCustomize implements IPswLbsCustomize {
private static final String CTS_VERSION_PROPERTIES = "persist.sys.cta";
public static final String GPS_OPCUSTOM_FEATURE = "persist.sys.gps_disable";
private static final int MAX_PID = 32768;
private static final String TAG = "OppoLbsCustomize";
private static OppoLbsCustomize mInstall = null;
private Context mContext = null;
private boolean mIsCtaVersion = false;
private boolean mIsDisableForSpec = false;
private PackageManager mPackageManager;
private OppoLbsCustomize(Context context) {
this.mContext = context;
this.mPackageManager = this.mContext.getPackageManager();
this.mIsDisableForSpec = SystemProperties.getInt(GPS_OPCUSTOM_FEATURE, 0) != 1 ? false : true;
if (this.mIsDisableForSpec) {
Settings.Secure.putInt(this.mContext.getContentResolver(), "location_mode", 0);
}
this.mIsCtaVersion = SystemProperties.getBoolean(CTS_VERSION_PROPERTIES, false);
}
public static OppoLbsCustomize getInstall(Context context) {
if (mInstall == null) {
mInstall = new OppoLbsCustomize(context);
}
return mInstall;
}
public boolean isForceGnssDisabled() {
return this.mIsDisableForSpec;
}
public void getAppInfoForTr(String methodName, String providerName, int pid, String packageName) {
if (this.mIsCtaVersion) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date currentTime = new Date(System.currentTimeMillis());
CharSequence appName = packageName;
try {
appName = this.mPackageManager.getApplicationLabel(this.mPackageManager.getApplicationInfo(packageName, 0));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (pid <= 0 || pid > MAX_PID) {
Log.e(TAG, "getAppInfoForTr: pid out of range, pid:" + String.valueOf(pid));
return;
}
String processName = StringUtils.EMPTY;
if (OppoMirrorProcess.getProcessNameByPid != null) {
processName = (String) OppoMirrorProcess.getProcessNameByPid.call(new Object[]{Integer.valueOf(pid)});
}
Log.d("ctaifs", simpleDateFormat.format(currentTime) + " <" + ((Object) appName) + ">[" + "location" + "][" + processName + "]:[" + methodName + "." + providerName + "]" + "location" + "[" + providerName + "." + providerName + "]");
}
}
public void setDebug(boolean isDebug) {
FastNetworkLocation.setDebug(isDebug);
OppoCoarseToFine.setDebug(isDebug);
OppoGnssDiagnosticTool.setDebug(isDebug);
OppoGnssDuration.setDebug(isDebug);
OppoGnssWhiteListProxy.setDebug(isDebug);
OppoLbsRomUpdateUtil.setDebug(isDebug);
OppoLocationBlacklistUtil.setDebug(isDebug);
OppoLocationStatistics.setDebug(isDebug);
OppoNetworkUtil.setDebug(isDebug);
OppoNlpProxy.setDebug(isDebug);
OppoSuplController.setDebug(isDebug);
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
cfebcebc444ffb2db420191a6bf060fd003c151f | 6e3e4e981998c0c3b9938b318bee95816296f749 | /src/main/java/com/karya/anak/bangsa/antco/Ant.java | 47b794a34c5a2d99786b32ba6a48f81f5b802e9c | [] | no_license | adibmuhamad/Ant-Colony | 15a6c76caf8f878f52dcd18bd9242ce8a9bb500b | 27c43fc72bd036c0e1242cd824bcaf3cbf06d179 | refs/heads/master | 2020-04-07T08:47:23.344150 | 2018-11-19T13:36:12 | 2018-11-19T13:36:12 | 158,227,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,076 | java | package com.karya.anak.bangsa.antco;
import java.util.concurrent.atomic.AtomicInteger;
class Ant {
private int path[];
private boolean visited[];
private AtomicInteger currentIndex;
Ant(int numCities, AtomicInteger currentIndex) {
this.path = new int[numCities];
this.visited = new boolean[numCities];
this.currentIndex = currentIndex;
}
void visitCity(int city) {
path[currentIndex.get() + 1] = city;
visited[city] = true;
}
int currentCity() {
return path[currentIndex.get()];
}
int[] getTour() {
return path;
}
boolean visited(int city) {
return visited[city];
}
double tourLength() {
double[][] graph = Main.getGraph();
double length = graph[path[graph.length - 1]][path[0]];
for (int i = 0; i < graph.length - 1; i++) {
length += graph[path[i]][path[i + 1]];
}
return length;
}
void clear() {
for (int i = 0; i < visited.length; i++)
visited[i] = false;
}
}
| [
"adibmuhamad48@gmail.com"
] | adibmuhamad48@gmail.com |
cd6f313d87efa5d0f19c3787041a40f0d9a666bc | 309b943da14d51e1e453f01ba87e28e1ed4d7ed3 | /src/tk/thewoosh/plugins/wac/checks/movement/Glide.java | 4a5e640c69cbb91b3c85beae6b3ffd2821776112 | [
"MIT"
] | permissive | CyberFlameGO/AntiCheat-2 | db2ca4cf0c96b89a1eb92c221d22d1bfba34580c | 89f77de805bddc774e0b445e9d5abdf4562620bf | refs/heads/master | 2023-03-18T21:57:29.244318 | 2020-06-02T12:02:19 | 2020-06-02T12:02:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package tk.thewoosh.plugins.wac.checks.movement;
import tk.thewoosh.plugins.wac.checks.CheckResult;
import tk.thewoosh.plugins.wac.checks.CheckType;
import tk.thewoosh.plugins.wac.checks.MoveCheck;
import tk.thewoosh.plugins.wac.util.Distance;
import tk.thewoosh.plugins.wac.util.MovementUtil;
import tk.thewoosh.plugins.wac.util.User;
public class Glide extends MoveCheck {
public static final CheckResult PASS = new CheckResult(false, CheckType.GLIDE, "");
public Glide() {
super(CheckType.GLIDE);
}
public CheckResult runCheck(User user, Distance distance) {
final double oldY = user.oldY;
// user.wasGoingUp = distance.getFrom().getY() > distance.getTo().getY();
user.oldY = distance.getYDifference();
if (distance.getFrom().getY() > distance.getTo().getY()) {
if (oldY >= distance.getYDifference() && oldY != 0 && !MovementUtil.shouldNotFlag(distance.getTo())) {
return new CheckResult(true, CheckType.GLIDE, "tried to glide; " + oldY + " <= " + user.oldY);
}
} else {
user.oldY = 0;
}
return PASS;
}
}
| [
"projectwoosh@hotmail.com"
] | projectwoosh@hotmail.com |
d6f3961d8676cc2e28106145a3af60c448736c91 | 56456387c8a2ff1062f34780b471712cc2a49b71 | /com/google/android/gms/internal/zzhf$2.java | 67206c39d277a43fe6a5ae8c337c79e0bda4d3d8 | [] | no_license | nendraharyo/presensimahasiswa-sourcecode | 55d4b8e9f6968eaf71a2ea002e0e7f08d16c5a50 | 890fc86782e9b2b4748bdb9f3db946bfb830b252 | refs/heads/master | 2020-05-21T11:21:55.143420 | 2019-05-10T19:03:56 | 2019-05-10T19:03:56 | 186,022,425 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,446 | java | package com.google.android.gms.internal;
import android.content.Context;
import java.util.Map;
class zzhf$2
implements zzdf
{
zzhf$2(zzhf paramzzhf) {}
public void zza(zzjp paramzzjp, Map paramMap)
{
Object localObject1 = this.zzJm;
for (;;)
{
Object localObject5;
boolean bool2;
synchronized (zzhf.zza((zzhf)localObject1))
{
localObject1 = this.zzJm;
localObject1 = zzhf.zzb((zzhf)localObject1);
boolean bool1 = ((zzjd)localObject1).isDone();
if (bool1) {
return;
}
localObject5 = new com/google/android/gms/internal/zzhi;
int i = -2;
((zzhi)localObject5).<init>(i, paramMap);
localObject1 = this.zzJm;
localObject1 = zzhf.zzc((zzhf)localObject1);
localObject6 = ((zzhi)localObject5).getRequestId();
bool2 = ((String)localObject1).equals(localObject6);
if (!bool2)
{
localObject1 = new java/lang/StringBuilder;
((StringBuilder)localObject1).<init>();
localObject5 = ((zzhi)localObject5).getRequestId();
localObject1 = ((StringBuilder)localObject1).append((String)localObject5);
localObject5 = " ==== ";
localObject1 = ((StringBuilder)localObject1).append((String)localObject5);
localObject5 = this.zzJm;
localObject5 = zzhf.zzc((zzhf)localObject5);
localObject1 = ((StringBuilder)localObject1).append((String)localObject5);
localObject1 = ((StringBuilder)localObject1).toString();
zzin.zzaK((String)localObject1);
}
}
Object localObject6 = ((zzhi)localObject5).getUrl();
Object localObject3;
if (localObject6 == null)
{
localObject3 = "URL missing in loadAdUrl GMSG.";
zzin.zzaK((String)localObject3);
}
else
{
localObject3 = "%40mediation_adapters%40";
bool2 = ((String)localObject6).contains((CharSequence)localObject3);
if (bool2)
{
Object localObject7 = paramzzjp.getContext();
localObject3 = "check_adapters";
localObject3 = paramMap.get(localObject3);
localObject3 = (String)localObject3;
Object localObject8 = this.zzJm;
localObject8 = zzhf.zzd((zzhf)localObject8);
localObject3 = zzil.zza((Context)localObject7, (String)localObject3, (String)localObject8);
localObject7 = "%40mediation_adapters%40";
localObject3 = ((String)localObject6).replaceAll((String)localObject7, (String)localObject3);
((zzhi)localObject5).setUrl((String)localObject3);
localObject6 = new java/lang/StringBuilder;
((StringBuilder)localObject6).<init>();
localObject7 = "Ad request URL modified to ";
localObject6 = ((StringBuilder)localObject6).append((String)localObject7);
localObject3 = ((StringBuilder)localObject6).append((String)localObject3);
localObject3 = ((StringBuilder)localObject3).toString();
zzin.v((String)localObject3);
}
localObject3 = this.zzJm;
localObject3 = zzhf.zzb((zzhf)localObject3);
((zzjd)localObject3).zzg(localObject5);
}
}
}
}
/* Location: C:\Users\haryo\Desktop\enjarify-master\presensi-enjarify.jar!\com\google\android\gms\internal\zzhf$2.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/ | [
"haryo.nendra@gmail.com"
] | haryo.nendra@gmail.com |
e4faea6c313b56d5c27987cbb65d98d53db1ca1b | 56656ce6a15700cdd0108d3e94016da24433538b | /src/main/java/org/pentaho/ui/xul/components/XulScale.java | 83fcb93329f62ac34ec98bb44f36cd7ed543495d | [] | no_license | tlw-ray/one-kettle | 6bc60574a936ee8e2b741fefe6060f8e40166637 | d2763edbdf1463d7a6e770f5182ea66525e1da61 | refs/heads/master | 2020-07-25T07:43:28.989714 | 2019-10-19T00:28:20 | 2019-10-19T00:28:20 | 208,218,415 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,324 | java | /*!
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software
* Foundation.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
* or from the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved.
*/
package org.pentaho.ui.xul.components;
import org.pentaho.ui.xul.XulComponent;
public interface XulScale extends XulComponent {
void setOrient(String orient);
String getOrient();
void setMin(int min);
int getMin();
void setMax(int max);
int getMax();
void setPageincrement(int increment);
int getPageincrement();
void setInc(int increment);
int getInc();
void setValue(int value);
int getValue();
void setDir(String direction);
String getDir();
}
| [
"tlw_ray@163.com"
] | tlw_ray@163.com |
3296c54ae4b5cd91012c1297c04c4cde72aedc10 | 704311f2839b39a22cda76a586ebe24465c127d2 | /app/src/main/java/joe/andenjoying/meteoradar/CurrentWeather.java | cffd7171b3d414ae8f2824112deafb906833bc3f | [] | no_license | elderj/MeteoRadar | a2a812d575a85b131f76364fad2cab66f5dbed10 | f055a2846aaf38ae803010d98671e8da22b6447d | refs/heads/master | 2018-10-14T16:52:17.029687 | 2018-08-18T01:32:10 | 2018-08-18T01:32:10 | 110,388,084 | 2 | 1 | null | 2018-07-12T00:38:30 | 2017-11-11T23:15:06 | Java | UTF-8 | Java | false | false | 6,790 | java | package joe.andenjoying.meteoradar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
/*
* CurrentWeather App.
* A basic weather application (WIP!!)
*
* * Created by jelder on 11/11/17.
*
*/
public class CurrentWeather extends Activity implements LocationListener {
Location location;
String appid = "b112d5780682a781f8b9e98755d188c6";
String units = "imperial";
//Default GPS Location is the Great Pyramids
double lat = 29.975939;
double lon = 31.130404;
private String cityId;
private TextView cityText;
private TextView tempText;
private TextView conditionText;
private TextView descriptionText;
private TextView humidityText;
private TextView windText;
private ImageView iconImage;
private EditText locationEditText;
LocationManager locationManager;
String provider;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.current_weather);
cityText = (TextView) findViewById(R.id.cityTextView);
tempText = (TextView) findViewById(R.id.tempTextView);
conditionText = (TextView) findViewById(R.id.conditionTextView);
descriptionText = (TextView) findViewById(R.id.descriptionTextView);
humidityText = (TextView) findViewById(R.id.humidityTextView);
windText = (TextView) findViewById(R.id.windTextView);
iconImage = (ImageView) findViewById(R.id.conditionIcon);
locationEditText = (EditText) findViewById(R.id.locationInput);
//Access fine location GPS Coords, if possible
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
provider = locationManager.getBestProvider(criteria, false);
if (provider != null && !provider.equals("")) {
location = locationManager.getLastKnownLocation(provider);
locationManager.requestLocationUpdates(provider, 120000, 10000, this);
if (location != null) {
onLocationChanged(location);
} else {
Toast.makeText(getBaseContext(), "Location can't be retrieved", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getBaseContext(), "No Provider Found", Toast.LENGTH_SHORT).show();
}
final String url = "http://api.openweathermap.org/data/2.5/weather?appid=" + appid + "&units=" + units + "&lat=" + lat + "&lon=" + lon;
final WeatherReportwithQuery wthr = new WeatherReportwithQuery(url);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
UpdateFields(wthr);
}
}, 3000);
findViewById(R.id.submitSearchButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String loc = String.valueOf(locationEditText.getText());
QueryLocation(loc);
}
});
findViewById(R.id.showHourlyButton).setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent hourlyWeatherIntent = new Intent(getApplicationContext(), HourlyWeather.class);
hourlyWeatherIntent.putExtra("url", "http://api.openweathermap.org/data/2.5/forecast?appid=" + appid+"&units=imperial");
hourlyWeatherIntent.putExtra("search", "&id="+cityId);
startActivity(hourlyWeatherIntent);
}
});
}
private void UpdateFields(WeatherReportwithQuery w) {
cityId=w.getId();
cityText.setText(w.getCity());
tempText.setText(w.getTemp());
conditionText.setText(w.getCondition());
descriptionText.setText(w.getDescription());
humidityText.setText(w.getHumidity());
windText.setText(w.getWind());
ChangeWeatherImage(w.getIcon_code());
}
void QueryLocation(String locationInput){
String queryURL;
//Determine locationFormat format
if (locationInput.matches("[0-9]+") && locationInput.length() > 4 && locationInput.length() < 6 ){
queryURL = "http://api.openweathermap.org/data/2.5/weather?appid=" + appid + "&units=" + units + "&zip=" + locationInput;
}
else{
queryURL = "http://api.openweathermap.org/data/2.5/weather?appid=" + appid + "&units=" + units + "&q=" + locationInput;
}
System.out.println(queryURL);
final WeatherReportwithQuery queryWeather = new WeatherReportwithQuery(queryURL);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
UpdateFields(queryWeather);
}
}, 3000);
}
private void ChangeWeatherImage(String iconcode){
String iconfilename="wthr"+iconcode;
int resId = getResources().getIdentifier(iconfilename, "drawable", getPackageName());
iconImage.setImageResource(resId);
}
@Override
public void onLocationChanged(Location location) {
Toast.makeText(getBaseContext(), "Location changed!! LAT:"+lat+" LON:"+lon, Toast.LENGTH_SHORT).show();
lat = location.getLatitude();
lon = location.getLongitude();
String currentURL = "http://api.openweathermap.org/data/2.5/weather?appid=" + appid + "&units=" + units + "&lat=" + lat + "&lon=" + lon;
final WeatherReportwithQuery currWeather = new WeatherReportwithQuery(currentURL);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
UpdateFields(currWeather);
}
}, 3000);
//Need to add this here to automatically update display upon loc change
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
} | [
"jelde010@odu.edu"
] | jelde010@odu.edu |
3c2a3755b3fcb812c5d6056eb2d0c1815d12d907 | 8b9190a8c5855d5753eb8ba7003e1db875f5d28f | /sources/com/facebook/react/common/ArrayUtils.java | 1e3e9682c0473404a6ab77d1aa4cb3300a854385 | [] | no_license | stevehav/iowa-caucus-app | 6aeb7de7487bd800f69cb0b51cc901f79bd4666b | e3c7eb39de0be6bbfa8b6b063aaa85dcbcee9044 | refs/heads/master | 2020-12-29T10:25:28.354117 | 2020-02-05T23:15:52 | 2020-02-05T23:15:52 | 238,565,283 | 21 | 3 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package com.facebook.react.common;
import java.util.Arrays;
import java.util.List;
public class ArrayUtils {
public static float[] copyArray(float[] fArr) {
if (fArr == null) {
return null;
}
return Arrays.copyOf(fArr, fArr.length);
}
public static int[] copyListToArray(List<Integer> list) {
int[] iArr = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
iArr[i] = list.get(i).intValue();
}
return iArr;
}
}
| [
"steve@havelka.co"
] | steve@havelka.co |
b6c9cd27bade912094fea3d3e49b7d222449c1ea | d95ee1910c33f4c8b2d067145a722facfe0a4b5a | /ListTest/app/src/main/java/com/aoslec/listtest/MainActivity.java | cb6738f2a3d96ca07e16190e0f8773fb0ab824a7 | [] | no_license | Hyoeun-Kwon/Android_lec | 287018c920699b0102064e7db23533bb4e4a1b37 | 75151401fc4121200f0f42a161f0095afc1075fb | refs/heads/master | 2023-06-04T02:51:12.949866 | 2021-06-30T05:15:57 | 2021-06-30T05:15:57 | 375,196,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | package com.aoslec.listtest;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Data 준비
//클라스, 변수명 = new 컨스트럭터()
ArrayList<String> arGeneral = new ArrayList<>();
//arraylist는 data추가를 add
arGeneral.add("김유신");
arGeneral.add("이순신");
arGeneral.add("강감찬");
arGeneral.add("을지문덕");
//data가 많아지면 알아서 뷰에 스크롤이 됨 !
//Adapter 준비
ArrayAdapter<String> Adapter;
//생성자임 어레이리스트를 눌러보면 기본 생성자 형태를 알 수 있다.
//context, layout, object(data)
Adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arGeneral);
//simplelayout은 하나씩 보이게 하는것 -> 나중엔 우리가 layout 만들어서 써야함
//Adapter와 View 연결
ListView list = findViewById(R.id.list);
list.setAdapter(Adapter);
}//onCreate
}//MainActivity | [
"81559760+Hyoeun-Kwon@users.noreply.github.com"
] | 81559760+Hyoeun-Kwon@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.