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
96492195cac1678a893778336d2d2b30ac156e1e
6a172bca530f9a221d09529486a2cba5c91b33f7
/app/src/main/java/com/soaringnova/novascenic/utils/StringUtils.java
1efccdbf7715628d6ece8e85b5f1d7e8405288aa
[]
no_license
jjzhang166/ARNavigation
787864ebd11f05bbbb8b0631f18a10e904dede26
3c9d0d9803c51d27d0bcfe66a458b00de8456ecf
refs/heads/master
2023-04-22T21:19:39.845173
2017-01-24T10:09:34
2017-01-24T10:09:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,884
java
package com.soaringnova.novascenic.utils; /** * <pre> * author: Blankj * blog : http://blankj.com * time : 2016/8/16 * desc : 字符串相关工具类 * </pre> */ public class StringUtils { private StringUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } /** * 判断字符串是否为null或长度为0 * * @param s 待校验字符串 * @return {@code true}: 空<br> {@code false}: 不为空 */ public static boolean isEmpty(CharSequence s) { return s == null || s.length() == 0; } /** * 判断字符串是否为null或全为空格 * * @param s 待校验字符串 * @return {@code true}: null或全空格<br> {@code false}: 不为null且不全空格 */ public static boolean isSpace(String s) { return (s == null || s.trim().length() == 0); } /** * 判断两字符串是否相等 * * @param a 待校验字符串a * @param b 待校验字符串b * @return {@code true}: 相等<br>{@code false}: 不相等 */ public static boolean equals(CharSequence a, CharSequence b) { if (a == b) return true; int length; if (a != null && b != null && (length = a.length()) == b.length()) { if (a instanceof String && b instanceof String) { return a.equals(b); } else { for (int i = 0; i < length; i++) { if (a.charAt(i) != b.charAt(i)) return false; } return true; } } return false; } /** * 判断两字符串忽略大小写是否相等 * * @param a 待校验字符串a * @param b 待校验字符串b * @return {@code true}: 相等<br>{@code false}: 不相等 */ public static boolean equalsIgnoreCase(String a, String b) { return (a == b) || (b != null) && (a.length() == b.length()) && a.regionMatches(true, 0, b, 0, b.length()); } /** * null转为长度为0的字符串 * * @param s 待转字符串 * @return s为null转为长度为0字符串,否则不改变 */ public static String null2Length0(String s) { return s == null ? "" : s; } /** * 返回字符串长度 * * @param s 字符串 * @return null返回0,其他返回自身长度 */ public static int length(CharSequence s) { return s == null ? 0 : s.length(); } /** * 首字母大写 * * @param s 待转字符串 * @return 首字母大写字符串 */ public static String upperFirstLetter(String s) { if (isEmpty(s) || !Character.isLowerCase(s.charAt(0))) return s; return String.valueOf((char) (s.charAt(0) - 32)) + s.substring(1); } /** * 首字母小写 * * @param s 待转字符串 * @return 首字母小写字符串 */ public static String lowerFirstLetter(String s) { if (isEmpty(s) || !Character.isUpperCase(s.charAt(0))) return s; return String.valueOf((char) (s.charAt(0) + 32)) + s.substring(1); } /** * 反转字符串 * * @param s 待反转字符串 * @return 反转字符串 */ public static String reverse(String s) { int len = length(s); if (len <= 1) return s; int mid = len >> 1; char[] chars = s.toCharArray(); char c; for (int i = 0; i < mid; ++i) { c = chars[i]; chars[i] = chars[len - i - 1]; chars[len - i - 1] = c; } return new String(chars); } /** * 转化为半角字符 * * @param s 待转字符串 * @return 半角字符串 */ public static String toDBC(String s) { if (isEmpty(s)) return s; char[] chars = s.toCharArray(); for (int i = 0, len = chars.length; i < len; i++) { if (chars[i] == 12288) { chars[i] = ' '; } else if (65281 <= chars[i] && chars[i] <= 65374) { chars[i] = (char) (chars[i] - 65248); } else { chars[i] = chars[i]; } } return new String(chars); } /** * 转化为全角字符 * * @param s 待转字符串 * @return 全角字符串 */ public static String toSBC(String s) { if (isEmpty(s)) return s; char[] chars = s.toCharArray(); for (int i = 0, len = chars.length; i < len; i++) { if (chars[i] == ' ') { chars[i] = (char) 12288; } else if (33 <= chars[i] && chars[i] <= 126) { chars[i] = (char) (chars[i] + 65248); } else { chars[i] = chars[i]; } } return new String(chars); } }
[ "nebxyang@163.com" ]
nebxyang@163.com
939028edad59252d14b907d088e98fb180a01b04
f135015fbb69b7d476756c5f75d2105b7895805f
/IndonesiaBible/src/hendy/indonesiabible/SatuTesalonikaFragment.java
0da2ca089dd9789e70638c6006db1a3a1fc4abec
[]
no_license
hendynugraha87/Restaurant
2daa438e38b52e111dfc0e060eab13385c1998fe
d6862a5ad2cbee693d5946252f83f94e97c1d164
refs/heads/master
2020-12-25T18:31:59.431270
2014-01-08T03:01:32
2014-01-08T03:01:32
15,723,000
2
0
null
null
null
null
UTF-8
Java
false
false
2,288
java
package hendy.indonesiabible; import java.util.ArrayList; import android.app.AlertDialog; import android.app.Fragment; import android.content.DialogInterface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.AdapterView.OnItemClickListener; public class SatuTesalonikaFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.indonesia_bible_fragment, container, false); return v; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ArrayList<String> strings = new ArrayList<String>(); for (int i = 0; i < 5; i++) { strings.add("1 Tesalonika " + (i + 1)); } ListView lv = (ListView)getActivity().findViewById(R.id.list_bible); lv.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, strings)); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { switch (pos) { case 0: MessageIndoBible("1 Tesalonika No." + (pos + 1), "Injil 1 Tesalonika"); break; case 1: MessageIndoBible("1 Tesalonika No." + (pos + 1), "Injil 1 Tesalonika"); break; case 2: MessageIndoBible("1 Tesalonika No." + (pos + 1), "Injil 1 Tesalonika"); break; case 3: MessageIndoBible("1 Tesalonika No." + (pos + 1), "Injil 1 Tesalonika"); break; case 4: MessageIndoBible("1 Tesalonika No." + (pos + 1), "Injil 1 Tesalonika"); break; default: break; } } }); } private void MessageIndoBible(String title, String message){ AlertDialog.Builder alert = new AlertDialog.Builder(getActivity(), AlertDialog.THEME_HOLO_DARK); alert.setTitle(title) .setIcon(R.drawable.ic_launcher) .setMessage(message) .setNeutralButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).show(); } }
[ "hendy.nugraha87@yahoo.co.id" ]
hendy.nugraha87@yahoo.co.id
2c260b2475e532255fd030f595dd6f732ba9e645
73ed391ca3c0d35b0aa20cd5d77a8c43ec8b0773
/src/main/java/net/mcreator/buffesworld/item/Citrine_armourArmorItem.java
5f4251312552f76ccaddd1a969050b316946174d
[]
no_license
Buffesworld/mod_source
714c8a679bce540248afd3459f4dd1a600184dd8
7a00ebcb785d7743632582cd9a2eb3ab538ad906
refs/heads/master
2023-06-07T07:27:06.874967
2021-07-09T21:18:00
2021-07-09T21:18:00
384,164,911
0
0
null
null
null
null
UTF-8
Java
false
false
4,131
java
package net.mcreator.buffesworld.item; import net.minecraftforge.registries.ObjectHolder; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.Dist; import net.minecraft.util.ResourceLocation; import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemGroup; import net.minecraft.item.Item; import net.minecraft.item.IArmorMaterial; import net.minecraft.item.ArmorItem; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.entity.Entity; import net.mcreator.buffesworld.BuffesWorldModElements; @BuffesWorldModElements.ModElement.Tag public class Citrine_armourArmorItem extends BuffesWorldModElements.ModElement { @ObjectHolder("buffes_world:citrine_armour_armor_helmet") public static final Item helmet = null; @ObjectHolder("buffes_world:citrine_armour_armor_chestplate") public static final Item body = null; @ObjectHolder("buffes_world:citrine_armour_armor_leggings") public static final Item legs = null; @ObjectHolder("buffes_world:citrine_armour_armor_boots") public static final Item boots = null; public Citrine_armourArmorItem(BuffesWorldModElements instance) { super(instance, 45); } @Override public void initElements() { IArmorMaterial armormaterial = new IArmorMaterial() { @Override public int getDurability(EquipmentSlotType slot) { return new int[]{13, 15, 16, 11}[slot.getIndex()] * 15; } @Override public int getDamageReductionAmount(EquipmentSlotType slot) { return new int[]{2, 6, 5, 2}[slot.getIndex()]; } @Override public int getEnchantability() { return 9; } @Override public net.minecraft.util.SoundEvent getSoundEvent() { return (net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("")); } @Override public Ingredient getRepairMaterial() { return Ingredient.fromStacks(new ItemStack(CitrineItem.block, (int) (1))); } @OnlyIn(Dist.CLIENT) @Override public String getName() { return "citrine_armour_armor"; } @Override public float getToughness() { return 0f; } @Override public float getKnockbackResistance() { return 0f; } }; elements.items.add(() -> new ArmorItem(armormaterial, EquipmentSlotType.HEAD, new Item.Properties().group(ItemGroup.COMBAT)) { @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) { return "buffes_world:textures/models/armor/citrine_armour_layer_" + (slot == EquipmentSlotType.LEGS ? "2" : "1") + ".png"; } }.setRegistryName("citrine_armour_armor_helmet")); elements.items.add(() -> new ArmorItem(armormaterial, EquipmentSlotType.CHEST, new Item.Properties().group(ItemGroup.COMBAT)) { @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) { return "buffes_world:textures/models/armor/citrine_armour_layer_" + (slot == EquipmentSlotType.LEGS ? "2" : "1") + ".png"; } }.setRegistryName("citrine_armour_armor_chestplate")); elements.items.add(() -> new ArmorItem(armormaterial, EquipmentSlotType.LEGS, new Item.Properties().group(ItemGroup.COMBAT)) { @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) { return "buffes_world:textures/models/armor/citrine_armour_layer_" + (slot == EquipmentSlotType.LEGS ? "2" : "1") + ".png"; } }.setRegistryName("citrine_armour_armor_leggings")); elements.items.add(() -> new ArmorItem(armormaterial, EquipmentSlotType.FEET, new Item.Properties().group(ItemGroup.COMBAT)) { @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) { return "buffes_world:textures/models/armor/citrine_armour_layer_" + (slot == EquipmentSlotType.LEGS ? "2" : "1") + ".png"; } }.setRegistryName("citrine_armour_armor_boots")); } }
[ "alex.jones@jellybaby.com" ]
alex.jones@jellybaby.com
6a8461354b57cae2639c79ca506d76e7904262a9
80c64d3aadff0448746f776b2f8f18cbaa3b859a
/NoobCraft/src/net/minecraft/client/model/ModelLeashKnot.java
cfe51df6319b959477609d380ea71f7eb75553f1
[]
no_license
lee0xp/noobcraft
0df52908026a7a20d482b64669c6ac5401a30458
1b5074a8811e4b6236b8b1a4df2498e15c8f12a0
refs/heads/master
2021-01-23T12:20:47.369896
2015-05-04T13:23:34
2015-05-04T13:23:34
35,021,763
2
2
null
null
null
null
UTF-8
Java
false
false
1,906
java
package net.minecraft.client.model; import net.minecraft.entity.Entity; public class ModelLeashKnot extends ModelBase { public ModelRenderer field_110723_a; private static final String __OBFID = "CL_00000843"; public ModelLeashKnot() { this(0, 0, 32, 32); } public ModelLeashKnot(int p_i46365_1_, int p_i46365_2_, int p_i46365_3_, int p_i46365_4_) { this.textureWidth = p_i46365_3_; this.textureHeight = p_i46365_4_; this.field_110723_a = new ModelRenderer(this, p_i46365_1_, p_i46365_2_); this.field_110723_a.addBox(-3.0F, -6.0F, -3.0F, 6, 8, 6, 0.0F); this.field_110723_a.setRotationPoint(0.0F, 0.0F, 0.0F); } /** * Sets the models various rotation angles then renders the model. */ public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) { this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_); this.field_110723_a.render(p_78088_7_); } /** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_); this.field_110723_a.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); this.field_110723_a.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); } }
[ "lee@lee0xp.de" ]
lee@lee0xp.de
aa97c43371d9a41e07fa0b9c7fc50a1365ba094b
6ebfbfe2422637dc29317197f8b93ef27445d185
/src/main/java/vn/luvina/startup/strategy/sort/SortUserByEmailStrategy.java
c638ba6e365d64630faf0c594326e7e40866c68d
[]
no_license
huucanh2011/startup-spring-boot-api
4c4cc74f208996c1a42c7a4c19e06672bae1146b
f4b923a68538f3360597638cb5eb84101691ea9c
refs/heads/master
2023-07-07T23:59:07.543621
2021-08-08T06:54:11
2021-08-08T06:54:11
370,014,232
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package vn.luvina.startup.strategy.sort; import org.springframework.data.domain.Sort; import vn.luvina.startup.enums.UserSortType; public class SortUserByEmailStrategy implements SortUserStrategy { @Override public Sort getSort() { return Sort.by(UserSortType.email.toString()); } }
[ "huucanh20111998@gmail.com" ]
huucanh20111998@gmail.com
db99375ebb6a833801202fb20b1c0cfb05de5f84
3f480d487f5e88acf6b64e1e424f64e2b0705d53
/net/minecraft/client/LoadingScreenRenderer.java
b8182b283439181670d31a9ea504b85d07f089d1
[]
no_license
a3535ed54a5ee6917a46cfa6c3f12679/bde748d8_obsifight_client_2016
2aecdb987054e44db89d6a7c101ace1bb047f003
cc65846780c262dc8568f1d18a14aac282439c66
refs/heads/master
2021-04-30T11:46:25.656946
2018-02-12T15:10:50
2018-02-12T15:10:50
121,261,090
0
0
null
null
null
null
UTF-8
Java
false
false
6,755
java
package net.minecraft.client; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.shader.Framebuffer; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MinecraftError; import org.lwjgl.opengl.GL11; public class LoadingScreenRenderer implements IProgressUpdate { private String field_73727_a = ""; private Minecraft mc; private String currentlyDisplayedText = ""; private long field_73723_d = Minecraft.getSystemTime(); private boolean field_73724_e; private ScaledResolution field_146587_f; private Framebuffer field_146588_g; private static final String __OBFID = "CL_00000655"; public LoadingScreenRenderer(Minecraft p_i1017_1_) { this.mc = p_i1017_1_; this.field_146587_f = new ScaledResolution(p_i1017_1_, p_i1017_1_.displayWidth, p_i1017_1_.displayHeight); this.field_146588_g = new Framebuffer(p_i1017_1_.displayWidth, p_i1017_1_.displayHeight, false); this.field_146588_g.setFramebufferFilter(9728); } public void resetProgressAndMessage(String p_73721_1_) { this.field_73724_e = false; this.func_73722_d(p_73721_1_); } public void displayProgressMessage(String p_73720_1_) { this.field_73724_e = true; this.func_73722_d(p_73720_1_); } public void func_73722_d(String p_73722_1_) { this.currentlyDisplayedText = p_73722_1_; if(!this.mc.running) { if(!this.field_73724_e) { throw new MinecraftError(); } } else { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); if(OpenGlHelper.isFramebufferEnabled()) { int var2 = this.field_146587_f.getScaleFactor(); GL11.glOrtho(0.0D, (double)(this.field_146587_f.getScaledWidth() * var2), (double)(this.field_146587_f.getScaledHeight() * var2), 0.0D, 100.0D, 300.0D); } else { ScaledResolution var3 = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); GL11.glOrtho(0.0D, var3.getScaledWidth_double(), var3.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); } GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -200.0F); } } public void resetProgresAndWorkingMessage(String p_73719_1_) { if(!this.mc.running) { if(!this.field_73724_e) { throw new MinecraftError(); } } else { this.field_73723_d = 0L; this.field_73727_a = p_73719_1_; this.setLoadingProgress(-1); this.field_73723_d = 0L; } } public void setLoadingProgress(int p_73718_1_) { if(!this.mc.running) { if(!this.field_73724_e) { throw new MinecraftError(); } } else { long var2 = Minecraft.getSystemTime(); if(var2 - this.field_73723_d >= 100L) { this.field_73723_d = var2; ScaledResolution var4 = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); int var5 = var4.getScaleFactor(); int var6 = var4.getScaledWidth(); int var7 = var4.getScaledHeight(); if(OpenGlHelper.isFramebufferEnabled()) { this.field_146588_g.framebufferClear(); } else { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); } this.field_146588_g.bindFramebuffer(false); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, var4.getScaledWidth_double(), var4.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -200.0F); if(!OpenGlHelper.isFramebufferEnabled()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); } Tessellator var8 = Tessellator.instance; this.mc.getTextureManager().bindTexture(Gui.optionsBackground); float var9 = 32.0F; var8.startDrawingQuads(); var8.setColorOpaque_I(4210752); var8.addVertexWithUV(0.0D, (double)var7, 0.0D, 0.0D, (double)((float)var7 / var9)); var8.addVertexWithUV((double)var6, (double)var7, 0.0D, (double)((float)var6 / var9), (double)((float)var7 / var9)); var8.addVertexWithUV((double)var6, 0.0D, 0.0D, (double)((float)var6 / var9), 0.0D); var8.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); var8.draw(); if(p_73718_1_ >= 0) { byte var10 = 100; byte var11 = 2; int var12 = var6 / 2 - var10 / 2; int var13 = var7 / 2 + 16; GL11.glDisable(GL11.GL_TEXTURE_2D); var8.startDrawingQuads(); var8.setColorOpaque_I(8421504); var8.addVertex((double)var12, (double)var13, 0.0D); var8.addVertex((double)var12, (double)(var13 + var11), 0.0D); var8.addVertex((double)(var12 + var10), (double)(var13 + var11), 0.0D); var8.addVertex((double)(var12 + var10), (double)var13, 0.0D); var8.setColorOpaque_I(8454016); var8.addVertex((double)var12, (double)var13, 0.0D); var8.addVertex((double)var12, (double)(var13 + var11), 0.0D); var8.addVertex((double)(var12 + p_73718_1_), (double)(var13 + var11), 0.0D); var8.addVertex((double)(var12 + p_73718_1_), (double)var13, 0.0D); var8.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); this.mc.fontRenderer.drawStringWithShadow(this.currentlyDisplayedText, (var6 - this.mc.fontRenderer.getStringWidth(this.currentlyDisplayedText)) / 2, var7 / 2 - 4 - 16, 16777215); this.mc.fontRenderer.drawStringWithShadow(this.field_73727_a, (var6 - this.mc.fontRenderer.getStringWidth(this.field_73727_a)) / 2, var7 / 2 - 4 + 8, 16777215); this.field_146588_g.unbindFramebuffer(); if(OpenGlHelper.isFramebufferEnabled()) { this.field_146588_g.framebufferRender(var6 * var5, var7 * var5); } this.mc.func_147120_f(); try { Thread.yield(); } catch (Exception var14) { ; } } } } public void func_146586_a() {} }
[ "unknowlk@tuta.io" ]
unknowlk@tuta.io
5e5237c535baf8c90757f527d9324ccb1ebe0b2b
95aec106d6c01bfb2ad0354ac63af0c5ef3c2be3
/components/timesheets/src/test/java/test/pivotal/pal/tracker/timesheets/TimeEntryDataGatewayTest.java
485a573322dc8b040b852976136cd13ece39450f
[]
no_license
gasperlf/spring-one-platform2018
949795987de484ca0f35e128496fa74ceba4f72c
ad1377b3a2db9401f71e1f187145f4f7dd079122
refs/heads/master
2020-03-29T14:32:52.409506
2018-09-23T20:29:37
2018-09-23T20:29:37
150,022,742
1
0
null
null
null
null
UTF-8
Java
false
false
2,059
java
package test.pivotal.pal.tracker.timesheets; import io.pivotal.pal.tracker.timesheets.data.TimeEntryDataGateway; import io.pivotal.pal.tracker.timesheets.data.TimeEntryFields; import io.pivotal.pal.tracker.timesheets.data.TimeEntryRecord; import org.junit.Test; import java.time.LocalDate; import java.util.List; import static io.pivotal.pal.tracker.timesheets.data.TimeEntryFields.timeEntryFieldsBuilder; import static org.assertj.core.api.Assertions.assertThat; public class TimeEntryDataGatewayTest { private TimeEntryDataGateway gateway = new TimeEntryDataGateway(); @Test public void testCreate() { TimeEntryFields fields = timeEntryFieldsBuilder() .projectId(22L) .userId(12L) .date(LocalDate.parse("2016-02-28")) .hours(8) .build(); TimeEntryRecord created = gateway.create(fields); assertThat(created.id).isNotNull(); assertThat(created.projectId).isEqualTo(22L); assertThat(created.userId).isEqualTo(12L); assertThat(created.date).isEqualTo(LocalDate.parse("2016-02-28")); assertThat(created.hours).isEqualTo(8); TimeEntryRecord found = gateway.find(created.id); assertThat(found.projectId).isEqualTo(22L); assertThat(found.userId).isEqualTo(12L); assertThat(found.date).isEqualTo(LocalDate.parse("2016-02-28")); assertThat(found.hours).isEqualTo(8); } @Test public void testFindAllByUserId() { TimeEntryRecord created = gateway.create(timeEntryFieldsBuilder() .projectId(22L) .userId(12L) .date(LocalDate.parse("2016-02-28")) .hours(8) .build()); gateway.create(timeEntryFieldsBuilder() .projectId(999L) .userId(999L) .date(LocalDate.parse("2016-02-28")) .hours(8) .build()); List<TimeEntryRecord> result = gateway.findAllByUserId(12L); assertThat(result).containsExactlyInAnyOrder(created); } }
[ "esuez@pivotal.io" ]
esuez@pivotal.io
57f14ad22da6fe4f8891a031cc1b40a4c9d5dd2e
f570108cb787f278b58fb090791047192c72ae34
/app/src/main/java/com/wensoft/ojeku/CustomLibrary/NonScrollGridView.java
4d2147e822482de5f7daaaaebe1bda45361da891
[]
no_license
pahlevikun/ojekita
e36111a0ff2feb4ec0ea8afe6e4214471eabc5a3
01b31ad0755ae0457cc4021351ca865121143f13
refs/heads/master
2021-03-27T11:33:53.047332
2017-04-19T14:06:23
2017-04-19T14:06:23
85,324,196
0
0
null
null
null
null
UTF-8
Java
false
false
1,266
java
package com.wensoft.ojeku.customlibrary; /** * Created by farhan on 4/2/17. */ import android.content.Context; import android.util.AttributeSet; import android.widget.GridView; public class NonScrollGridView extends GridView { public NonScrollGridView(Context context) { super(context); } public NonScrollGridView(Context context, AttributeSet attrs) { super(context, attrs); } public NonScrollGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int heightSpec; if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { // The great Android "hackatlon", the love, the magic. // The two leftmost bits in the height measure spec have // a special meaning, hence we can't use them to describe height. heightSpec = MeasureSpec.makeMeasureSpec( Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); } else { // Any other height should be respected as is. heightSpec = heightMeasureSpec; } super.onMeasure(widthMeasureSpec, heightSpec); } }
[ "pahlevi.kun@gmail.com" ]
pahlevi.kun@gmail.com
5d8b264802d4c38403f531c22dab463a4f63f70e
d0a17c5890e1f5ee2a90c0fb42210fb5346bb246
/spring-boot-gs-complete/src/test/java/com/hank/sample/spring/boot/controller/HelloControllerIT.java
f514545edd51774048beb6f2bc9252547b945f18
[]
no_license
HankLeo/spring-boot-samples
612664d4f4c2c01d1fed8c5331eebb32431dd7bc
15dd237020c3067981630a834b483176b79a3d7b
refs/heads/master
2021-10-10T05:40:37.334675
2019-01-07T07:27:18
2019-01-07T07:27:18
111,773,194
0
0
null
null
null
null
UTF-8
Java
false
false
1,244
java
package com.hank.sample.spring.boot.controller; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; import java.net.URL; /** * Created by Hank on 12/4/2017. */ @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class HelloControllerIT { private static String expectedResponse = "Hello Spring Boot!"; @LocalServerPort private int port; private URL base; private TestRestTemplate template; @Before public void setUp() throws Exception{ this.base = new URL("http://localhost:" + port + "/"); } @Test public void getHello() throws Exception { ResponseEntity<String> response = template.getForEntity(base.toString(), String.class); assertThat(response.getBody(), equalTo(expectedResponse)); } }
[ "hao.liu@hpe.com" ]
hao.liu@hpe.com
60364d2a8405ae69fec61ab89c05f9395ff52475
2861f8ba349aef17dc7de10156ef50cbb2c3674b
/gen/java/ABS/Absyn/EQualVar.java
daa1f7975cbbedeec30e193470f1e6e9dd7a9f4b
[]
no_license
CrispOSS/abs-frontend
fbef4c8133e7179d7fa2fb6930d05398c860dede
4bb6195c008a17f88252fc1315cc4e30ff250043
refs/heads/master
2021-01-19T15:01:55.218754
2015-05-27T10:06:29
2015-05-27T10:06:29
24,635,701
0
0
null
null
null
null
UTF-8
Java
false
false
704
java
package ABS.Absyn; // Java Package generated by the BNF Converter. public class EQualVar extends PureExp { public final TType ttype_; public final String lident_; public EQualVar(TType p1, String p2) { ttype_ = p1; lident_ = p2; } public <R,A> R accept(ABS.Absyn.PureExp.Visitor<R,A> v, A arg) { return v.visit(this, arg); } public boolean equals(Object o) { if (this == o) return true; if (o instanceof ABS.Absyn.EQualVar) { ABS.Absyn.EQualVar x = (ABS.Absyn.EQualVar)o; return this.ttype_.equals(x.ttype_) && this.lident_.equals(x.lident_); } return false; } public int hashCode() { return 37*(this.ttype_.hashCode())+this.lident_.hashCode(); } }
[ "bezirg@gmail.com" ]
bezirg@gmail.com
ac523453ac89a7a97dd8fbede4afbd57fab17da3
a5c4b16a3f4d989bcc29661842c249348536927f
/app/src/main/java/com/ort/daitp5/fragentmostrar.java
96179b2f08f748673889b1b7017774d8acc9e6e3
[]
no_license
Ivan-Barcia2021/tpdai-
345c351922b2c218c5f52cf531fde5453ba286b6
051e2f61beaf7964316cf6687019402482af2b20
refs/heads/master
2023-07-14T12:03:12.378774
2021-08-28T21:27:13
2021-08-28T21:27:13
398,667,791
0
0
null
null
null
null
UTF-8
Java
false
false
807
java
package com.ort.daitp5; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.fragment.app.Fragment; public class fragentmostrar extends Fragment { TextView textomostrar; public View onCreateView(LayoutInflater inflador, ViewGroup grupo, Bundle paquete){ View vistadevolver; vistadevolver=inflador.inflate (R.layout.mostrar, grupo, false); textomostrar=vistadevolver.findViewById (R.id.ciudadelegida); activityprincipal miactivity; miactivity= (activityprincipal) getActivity(); String nombreamostrar; nombreamostrar=miactivity.verciudad (); textomostrar.setText (nombreamostrar); return vistadevolver; } }
[ "45148013@est.ort.edu.ar" ]
45148013@est.ort.edu.ar
b75252ed39692fc58489e7c8429b4105befa6dad
8fb90c289711f8ca55ff91f79fa5b3f37b13432c
/health_dao/src/main/java/pdsu/dao/UserServiceDao.java
4c1544d97d8c8f4d4be3abd7c19f27a258032f4b
[]
no_license
18803836269/health
55c3f3e7c35595c26a43ac8f369207bdd055aa44
f77f6247bd38e6e7d0213fde0288df56ee6264e8
refs/heads/master
2022-12-21T22:11:46.055730
2019-07-06T13:58:38
2019-07-06T13:58:38
195,538,661
0
0
null
null
null
null
UTF-8
Java
false
false
55
java
package pdsu.dao; public interface UserServiceDao { }
[ "1169341131@qq.com" ]
1169341131@qq.com
b9f73857f4b4084ef87c7026d9d84a037d9561ae
0b0bf99226776fc2ab3e481db2058666a55d9a89
/src/locale/de.java
d9f67e747aa0057016c9d19d29e7f58d51846bfd
[]
no_license
xboxxxxd/factorio-mod-buider
2a346dd625ec31d5876f47efae87e475baf9adc8
967161a636c745b10a90f9bd5b2e48eea6fabf72
refs/heads/master
2021-01-01T05:06:17.174087
2015-06-07T11:55:20
2015-06-07T11:55:20
56,170,724
0
0
null
null
null
null
UTF-8
Java
false
false
43
java
package locale; public class de { }
[ "johnhawhamburg@gmail.com" ]
johnhawhamburg@gmail.com
f1d7abc2c71d060e1fd264104df5c41f87cc11e2
a2188e295eea25ab083805896cf9cfce9351a539
/model/FHIRSubstanceStatus.java
57706ca36b444c2f1e56dcf68d580dc543edcbeb
[]
no_license
tkalatz/hl7_FHIR_entity_objects
f10f2b4cdeead51251c74a5aa0de408c8ec5931f
d9fd5b699be03fad71e6cf376620351f23f1025c
refs/heads/main
2023-02-23T06:30:37.743094
2021-01-10T18:03:23
2021-01-10T18:03:23
320,611,784
0
0
null
null
null
null
UTF-8
Java
false
false
1,861
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.12.11 at 03:47:56 PM EET // package org.hl7.fhir; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; /** * If the element is present, it must have either a @value, an @id, or extensions * * <p>Java class for FHIRSubstanceStatus complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="FHIRSubstanceStatus"> * &lt;complexContent> * &lt;extension base="{http://hl7.org/fhir}Element"> * &lt;attribute name="value" type="{http://hl7.org/fhir}FHIRSubstanceStatus-list" /> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "FHIRSubstanceStatus") public class FHIRSubstanceStatus extends Element { @XmlAttribute(name = "value") protected FHIRSubstanceStatusList value; /** * Gets the value of the value property. * * @return * possible object is * {@link FHIRSubstanceStatusList } * */ public FHIRSubstanceStatusList getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link FHIRSubstanceStatusList } * */ public void setValue(FHIRSubstanceStatusList value) { this.value = value; } }
[ "tkalatz@gmail.com" ]
tkalatz@gmail.com
92312d3be28bcf736ad268dae6202a077a1deb8e
93f24b6e219d22b2f7753d72fb5a5875e54cfd07
/InsightData/src/com/insight/normalize/NormalizationException.java
36ce67d21859b079974665d2e6d548d4f50c0b8a
[]
no_license
vaswarup/CSV-Processing
8e2041d24652c73d54772a9528c63970b797325b
0d3ff0205e27a6db479313fb18a6f106d221909b
refs/heads/master
2021-01-10T02:07:46.239658
2015-10-27T15:13:49
2015-10-27T15:13:49
45,013,658
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.insight.normalize; import com.insight.app.CoreEngineException; /** * This captures all exceptions in the normalizers. * */ public class NormalizationException extends CoreEngineException { private static final long serialVersionUID = 2L; public NormalizationException(String message) { super(message); } public NormalizationException(Exception e) { super(e); } }
[ "vaswarup@hotmail.com" ]
vaswarup@hotmail.com
f4ddf3bb2964b3f73826185106da86b747383ae3
26c70912994fb341390db2e762b4705f23c89b6d
/T-Manager/src/test/java/cpt202/groupwork/UserTest.java
f6d0a1d35846f3b6ff792ee28491e5d8bcdca774
[]
no_license
T-manager/T-Manager
8407862cd4ea57c723f1e84cc6a038d5f46f523a
d6aee3eb1b6a1c67791c3d7c8125f1222741ef7d
refs/heads/main
2023-06-18T07:58:41.733682
2021-07-03T10:31:52
2021-07-03T10:31:52
347,839,069
2
3
null
null
null
null
UTF-8
Java
false
false
16,150
java
package cpt202.groupwork; /** * @description: * @author: cpt202group2 * @create: **/ import com.jayway.jsonpath.JsonPath; import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.RequestBuilder; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.context.WebApplicationContext; import static org.hamcrest.Matchers.equalTo; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @SpringBootTest @Transactional public class UserTest { @Autowired private WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup(){ mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); } @Test public void testUserController() throws Exception { //GET auth/check mockMvc.perform( MockMvcRequestBuilders.get("/auth/check") .param("username", "0") ).andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.message").value("Fail")); // .andExpect(content().string( // equalTo("{\"status\":200,\"message\":\"Fail\",\"data\":2002}") // )); mockMvc .perform( MockMvcRequestBuilders.get("/auth/check") .param("username", "test") ).andExpect(MockMvcResultMatchers.status().isOk()) .andExpect( content() .string( equalTo( "{\"status\":200,\"message\":\"Success\",\"data\":2000}"))); String content = "{\"userName\":\"test\", \"userEmail\" : \"xianghao.niu18@student.xjtlu.edu.cn\"}"; //POST auth check String result = mockMvc.perform(MockMvcRequestBuilders.post("/auth/check") .content(content).contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(content().string( equalTo("{\"status\":200,\"message\":\"Success\",\"data\":2000}"))) .andReturn().getResponse().getContentAsString(); System.out.println(result); // POST:/auth/register result = mockMvc .perform( MockMvcRequestBuilders.post("/auth/register") .content( "{\n" + " \"userName\":\"email\",\n" + " \"userPassword\": \"admin\",\n" + " \"userEmail\":\"kaiwen.li18@student.xjtlu.edu.cn\"\n" + " \n" + "}").contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect( content().string(equalTo("{\"status\":200,\"message\":\"Success\",\"data\":1000}"))) .andReturn() .getResponse() .getContentAsString(); System.out.println(result); // POST:/auth/login result = mockMvc .perform( MockMvcRequestBuilders.post("/auth/login") .content( "{\n" + " \"userName\":\"email\",\n" + " \"userPassword\": \"admin\",\n" + " \"userEmail\":\"kaiwen.li18@student.xjtlu.edu.cn\"\n" + " \n" + "}").contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) // .andExpect( // content().string(equalTo("{\"status\":200,\"message\":\"Success\",\"data\":1000}"))) .andReturn() .getResponse() .getContentAsString(); System.out.println(result); String token = JsonPath.parse(result).read("$.data"); System.out.println(token); //get token test result=mockMvc.perform( MockMvcRequestBuilders.get("/user/get/email") .param("token", token) ).andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.message").value("Success")) .andReturn() .getResponse() .getContentAsString(); System.out.println(result); // put result = mockMvc .perform( MockMvcRequestBuilders.put("/user/edit/email") .param("token", token) .content( "{\n" + " \"userName\":\"email\",\n" + " \"userPassword\": \"admin2\",\n" + " \"userEmail\":\"kaiwen.li18@student.xjtlu.edu.cn\"\n" + " \n" + "}").contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.message").value("Success")) .andReturn() .getResponse() .getContentAsString(); System.out.println(result); //delete result=mockMvc.perform( MockMvcRequestBuilders.delete("/user/delete/email") .param("token", token) ).andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.message").value("Success")) .andReturn() .getResponse() .getContentAsString(); System.out.println(result); } public void postControllerTest(String url,String req,String resp,String token) throws Exception { mockMvc .perform( MockMvcRequestBuilders .post(url) .param("token", token) .content(req) .contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(content().string(equalTo(resp))); } public void deleteControllerTest(String url,String req,String resp,String token) throws Exception { mockMvc .perform( MockMvcRequestBuilders .delete(url) .param("token", token) .content(req) .contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(content().string(equalTo(resp))); } public void putControllerTest(String url,String req,String resp,String token) throws Exception { mockMvc .perform( MockMvcRequestBuilders .put(url) .param("token", token) .content(req) .contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(content().string(equalTo(resp))); } public void getControllerTest(String url,String resp,String token) throws Exception { mockMvc .perform( MockMvcRequestBuilders .get(url) .param("token", token) .contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(content().string(equalTo(resp))); } public String getToken(String req) throws Exception { String result=mockMvc .perform( MockMvcRequestBuilders .post("/auth/login") .content(req) .contentType(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.message").value("Success")) .andReturn() .getResponse() .getContentAsString(); String token = JsonPath.parse(result).read("$.data"); return token; } @Test public void postCheckUser() throws Exception { //normal case String url="/auth/check"; String req = "{\n" + " \"userName\": \"test22\",\n" + " \"userEmail\": \"kaiwen.li18@student.xjtlu.edu.cn\"\n" + "}"; String resp = "{\" status\":0,\"message\":\"Success\",\"data\":[]}".replaceAll(" ","");; postControllerTest(url, req, resp,""); //not match url="/auth/check"; req = "{\n" + " \"userName\": \"test22\",\n" + " \"userEmail\": \"kaiwen.li18@student.xjtlu.edu.cnn\"\n" + "}"; resp = "{ \"status\": 31, \"message\": \"".replaceAll(" ", "") + "Email not match\"" + ", \"data\": null }".replaceAll(" ", ""); ; postControllerTest(url, req, resp,""); } @Test public void getCheckName() throws Exception { //normal case String url="/auth/checkname/test"; String resp = "{ \"status\": 321, \"message\": " .replaceAll(" ", "") + "\"User already exists\"" + ", \"data\": null }" .replaceAll(" ", ""); ; getControllerTest(url, resp,""); //not found url="/auth/checkname/tes"; resp = "{ \"status\": 0, \"message\": \"Success\", \"data\": [] }".replaceAll(" ", ""); getControllerTest(url, resp,""); } @Test public void getCheckEmail() throws Exception { //normal case String url="/auth/checkemail/kaiwen.li18@student.xjtlu.edu.cn"; String resp = "{ \"status\": 321, \"message\": \"".replaceAll(" ", "") + "User already exists" + "\", \"data\": null }".replaceAll(" ", ""); ; getControllerTest(url, resp,""); //not found url="/auth/checkemail/test@test.test"; resp = "{ \"status\": 0, \"message\": \"Success\", \"data\": [] }".replaceAll(" ", ""); getControllerTest(url, resp,""); } @Test public void putEditPassword() throws Exception { //normal case String url="/auth/edit/test"; String req = "{\n" + " \"userName\": \"test\",\n" + " \"userPassword\": \"test\"\n" + "}"; String resp = "{ \"status\": 0, \"message\": \"Success\", \"data\": { \"userName\": \"test\", \"userEmail\": \"xianghao.niu18@student.xjtlu.edu.cn\", \"userRole\": \"USER\", \"userAvatar\": \"default.jpg\" }} ".replaceAll(" ", ""); putControllerTest(url, req, resp,""); //user not exists url="/auth/edit/tes"; req = "{\n" + " \"userName\": \"tes\",\n" + " \"userPassword\": \"test\"\n" + "}"; resp = "{ \"status\": 301, \"message\": " .replaceAll(" ", "") + "\"User not found" + "\", \"data\": null }".replaceAll(" ", ""); ; putControllerTest(url, req, resp,""); } @Test public void postLogin() throws Exception { //normal case String url="/auth/login"; String req = "{\n" + " \"userName\": \"test\",\n" + " \"userPassword\": \"test\"\n" + "}"; String resp =""; getToken(req); //not match url="/auth/login"; req = "{\n" + " \"userName\": \"test\",\n" + " \"userPassword\": \"test2\"\n" + "}"; resp = "{ \"status\": 31, \"message\": \"".replaceAll(" ", "") + "Wrong password" + "\", \"data\": null }".replaceAll(" ", ""); ; postControllerTest(url, req, resp,""); //user not exists url="/auth/login"; req = "{\n" + " \"userName\": \"tes\",\n" + " \"userPassword\": \"test\"\n" + "}"; resp = "{ \"status\": 301,\"message\": " .replaceAll(" ", "") + "\"User not found\"," + " \"data\": null}".replaceAll(" ", ""); ; postControllerTest(url, req, resp,""); } @Test public void postRegister() throws Exception { //normal case String url="/auth/register"; String req = "{\n" + " \"userName\": \"test2\",\n" + " \"userPassword\": \"test\",\n" + " \"userEmail\": \"kaiwen.li18@student.xjtlu.edu.cn\"\n" + "}"; String resp = "{ \"status\": 0, \"message\": \"Success\", \"data\": [] }".replaceAll(" ", ""); postControllerTest(url, req, resp,""); //user already exists url="/auth/register"; req = "{\n" + " \"userName\": \"test22\",\n" + " \"userPassword\": \"test\",\n" + " \"userEmail\": \"kaiwen.li18@student.xjtlu.edu.cn\"\n" + "}"; resp = "{ \"status\": 321, \"message\": \"" .replaceAll(" ", "") + "User already exists" + "\", \"data\": null }".replaceAll(" ", ""); ; postControllerTest(url, req, resp,""); } @Test public void getUser() throws Exception { // //get token // String req = "{\n" + " \"userName\": \"test\",\n" + " \"userPassword\": \"test\"\n" + "}"; // String token=getToken(req); //normal case String url="/user/get/test"; String resp = "{ \"status\": 0, \"message\": \"Success\", \"data\": { \"userName\": \"test\", \"userEmail\": \"xianghao.niu18@student.xjtlu.edu.cn\", \"userRole\": \"USER\", \"userAvatar\": \"default.jpg\" } }" .replaceAll(" ", ""); ; getControllerTest(url, resp,""); //user not exists url="/user/get/tes"; resp = "{ \"status\": 301, \"message\": \"" .replaceAll(" ", "") + "User not found" + "\", \"data\": null }".replaceAll(" ", ""); getControllerTest(url, resp,""); } @Test public void putEditUser() throws Exception { // //get token // String req = "{\n" + " \"userName\": \"test\",\n" + " \"userPassword\": \"test\"\n" + "}"; // String token=getToken(req); //normal case String url="/user/edit/test"; String req = "{\n" + " \"userName\": \"test0\",\n" + " \"userEmail\": \"kaiwen.li18@student.xjtlu.edu.cn\",\n" + " \"userAvatar\": \"default.jpg\"\n" + "}"; String resp = "{ \"status\": 0, \"message\": \"Success\", \"data\": { \"userName\": \"test0\", \"userEmail\": \"kaiwen.li18@student.xjtlu.edu.cn\", \"userRole\": \"USER\", \"userAvatar\": \"default.jpg\" } }" .replaceAll(" ", ""); putControllerTest(url, req, resp,""); //user not exists url="/user/edit/tes"; req = "{\n" + " \"userName\": \"test0\",\n" + " \"userEmail\": \"kaiwen.li18@student.xjtlu.edu.cn\",\n" + " \"userAvatar\": \"default.jpg\"\n" + "}"; resp = "{ \"status\": 301, \"message\": " .replaceAll(" ", "") + "\"User not found" + "\", \"data\": null }".replaceAll(" ", ""); ; putControllerTest(url, req, resp,""); } @Test public void deleteUser() throws Exception { // //get token // String req = "{\n" + " \"userName\": \"test\",\n" + " \"userPassword\": \"test\"\n" + "}"; // String token=getToken(req); //normal case String url="/user/delete/test22"; String req = ""; String resp = "{ \"status\": 0, \"message\": \"Success\", \"data\": { \"userName\": \"test22\", \"userEmail\": \"kaiwen.li18@student.xjtlu.edu.cn\", \"userRole\": \"USER\", \"userAvatar\": \"default.jpg\" } }" .replaceAll(" ", ""); deleteControllerTest(url, req, resp,""); //user not exists url="/user/delete/tes"; req = ""; resp = "{ \"status\": 301, \"message\": " .replaceAll(" ", "") + "\"User not found" + "\", \"data\": null }".replaceAll(" ", ""); ; deleteControllerTest(url, req, resp,""); } }
[ "zhonghao.wang18@student.xjtlu.edu.cn" ]
zhonghao.wang18@student.xjtlu.edu.cn
8278b3591bd9e1af8cd588c571bcb43a170d1e08
848cf0c48c27097f06d560fddd4c5ff00dff3a61
/java/limax/src/limax/node/js/modules/Edb.java
4285b44882d002a552656ab0543c84927163c254
[ "MIT" ]
permissive
k896152374/limax_5.16
7e76d1ff3c0f5640cfa109a18490e17d60f04655
cb243c50bbce5720da733ba913a271a5452fec04
refs/heads/main
2023-07-09T10:06:55.557947
2021-08-20T08:19:26
2021-08-20T08:19:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,175
java
package limax.node.js.modules; import java.nio.file.Paths; import java.util.Arrays; import java.util.concurrent.atomic.AtomicInteger; import limax.edb.DataBase; import limax.edb.Environment; import limax.edb.QueryData; import limax.node.js.Buffer; import limax.node.js.EventLoop; import limax.node.js.EventLoop.Callback; import limax.node.js.EventLoop.EventObject; import limax.node.js.Module; public final class Edb implements Module { private final EventLoop eventLoop; public Edb(EventLoop eventLoop) { this.eventLoop = eventLoop; } public class Instance { private final DataBase edb; private final EventObject evo; private volatile Runnable destroycb; private final AtomicInteger running = new AtomicInteger(0); Instance(String path) throws Exception { this.edb = new DataBase(new Environment(), Paths.get(path)); this.evo = eventLoop.createEventObject(); } public void destroy(Object callback) { if (destroycb != null) return; destroycb = () -> eventLoop.execute(callback, r -> { evo.queue(); edb.close(); }); if (running.get() == 0) destroycb.run(); } private boolean enter(Object callback) { if (destroycb != null) { eventLoop.createCallback(callback).call(new Exception("Instance destroyed")); return false; } running.incrementAndGet(); return true; } private void leave() { if (running.decrementAndGet() == 0 && destroycb != null) destroycb.run(); } public void addTable(Object[] tables, Object callback) { if (enter(callback)) eventLoop.execute(callback, r -> { try { edb.addTable(Arrays.stream(tables).toArray(String[]::new)); } finally { leave(); } }); } public void removeTable(Object[] tables, Object callback) { if (enter(callback)) eventLoop.execute(callback, r -> { try { edb.removeTable(Arrays.stream(tables).toArray(String[]::new)); } finally { leave(); } }); } public void insert(String table, Buffer key, Buffer value, Object callback) { if (enter(callback)) eventLoop.execute(callback, r -> { try { r.add(edb.insert(table, key.toByteArray(), value.toByteArray())); } finally { leave(); } }); } public void replace(String table, Buffer key, Buffer value, Object callback) { if (enter(callback)) eventLoop.execute(callback, r -> { try { edb.replace(table, key.toByteArray(), value.toByteArray()); } finally { leave(); } }); } public void remove(String table, Buffer key, Object callback) { if (enter(callback)) eventLoop.execute(callback, r -> { try { edb.remove(table, key.toByteArray()); } finally { leave(); } }); } public void find(String table, Buffer key, Object callback) { if (enter(callback)) eventLoop.execute(callback, r -> { try { byte[] data = edb.find(table, key.toByteArray()); r.add(data != null ? new Buffer(data) : null); } finally { leave(); } }); } public void exist(String table, Buffer key, Object callback) { if (enter(callback)) eventLoop.execute(callback, r -> { try { r.add(edb.exist(table, key.toByteArray())); } finally { leave(); } }); } public void walk(String table, Buffer key, Object callback) { if (enter(callback)) { Callback cb = eventLoop.createCallback(callback); eventLoop.execute(() -> { try { QueryData query = new QueryData() { @Override public boolean update(byte[] key, byte[] value) { cb.call(null, new Buffer(key), new Buffer(value)); return true; } }; if (key == null) edb.walk(table, query); else edb.walk(table, key.toByteArray(), query); } catch (Exception e) { cb.call(e); } finally { leave(); } }); } } } public Instance createEdb(String path) throws Exception { return new Instance(path); } }
[ "tongrui.zhang@kingsgroupgames.com" ]
tongrui.zhang@kingsgroupgames.com
037d5bb4ef4d33be4993c3c5df13260f74532625
0a0a9c47ef80a470d8619a5c872b71c09668036e
/bridge/GenericRemote.java
7bca4488b54263e1754d3dfab89a89264f89d621
[]
no_license
dkkwon/java-design-patten
54b7da2072454358cc68ebc5521ce596fec48c0f
d84aba34a94fd298de3b31e6c05586d33c39d998
refs/heads/master
2022-12-13T02:59:41.659053
2020-08-30T10:44:29
2020-08-30T10:44:29
287,648,810
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package bridge; public class GenericRemote extends RemoteControl { public GenericRemote(TVFactory tvFactory) { super(tvFactory); } public void nextChannel() { int channel = this.getChannel(); this.setChannel(channel+1); } public void prevChannel() { int channel = this.getChannel(); this.setChannel(channel-1); } }
[ "daeken.kwon@gmail.com" ]
daeken.kwon@gmail.com
91bfe630d6b68022550a337a086afbf03fb99fd1
724c5eda96935c04e35b00f60f31fd21f06d4750
/src/ru/progwards/java1_2/lessons/abstractnum/Pyramid.java
5a54b6c38509f123c5d7891809c45d6e41dae286
[]
no_license
Borislove/java1
4678befb4d61edc1cff1c107f0116639c10d0eeb
1731926600af4f771ab9a323f105d7cda951c4c7
refs/heads/master
2022-02-28T03:22:37.223989
2022-02-14T02:23:56
2022-02-14T02:23:56
226,931,612
3
1
null
2020-10-20T11:39:21
2019-12-09T17:42:34
Java
UTF-8
Java
false
false
620
java
package ru.progwards.java1_2.lessons.abstractnum; public class Pyramid extends Figure3D { public Pyramid(Number segment) { super(segment); } /*6 Реализовать класс Pyramid, переопределяющий метод public Number volume(), который будет возвращать объем пирамиды, с основанием квадрат, и высотой равной стороне квадрата по формуле Segment*Segment*Segment/3;*/ @Override public Number volume() { return ((segment.mul(segment.mul(segment)))); } }
[ "abirme@yandex.ru" ]
abirme@yandex.ru
e35feaf6955e3281d7d1811f5703afd063146d41
67814fc11bee26a3b1db9bb3529f14ce4d4f09cc
/DataBase_Connection.java
b50445f3bb65f762e6ff7c290839823a31963ad8
[]
no_license
bygong/DS
6f5dcaef1f28b14df779bb6184e49c7f6b82c5bb
93aff281075fd1553562cb7f36bdf62fb5c76242
refs/heads/master
2021-03-13T00:06:30.934170
2017-05-31T23:00:17
2017-05-31T23:00:17
91,466,289
0
0
null
null
null
null
UTF-8
Java
false
false
9,510
java
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; public class DataBase_Connection { //JDBC driver name & database url static final String Driver = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://mpcs53001.cs.uchicago.edu/xhyDB"; //DB credentials static final String user = "xhy"; static final String password = "maipohfa"; //database table names static final String Continent = "continent_exchange"; //continent look-up table private String Stock_name; //exchange look-up table private String Stock_price; //stock price look-up table private String Stock_qty; //stock qty look-up table private String Stock_qty_log; //log qty of trading private String tmp_qty; //temporary table to save qty //constructor public DataBase_Connection(String exchange_name) { Stock_name = exchange_name + "_name"; Stock_price = exchange_name + "_price"; Stock_qty = exchange_name + "_qty"; Stock_qty_log = Stock_qty + "_log"; tmp_qty = Stock_qty + "_record"; } //Return continent where the exchange is located in //If continent is not found, return null public String QueryContinet(String exchange) { String continent = null; try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Query Statement stmt = conn.createStatement(); String sql; sql = "SELECT continent FROM " + Continent + " WHERE exchange=\'" + exchange + "\'"; ResultSet rs = stmt.executeQuery(sql); //Extract data while (rs.next()) { //Retrieve by column name continent = rs.getString("continent"); } //Clean-up rs.close(); stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } return continent; } //Query stock id in the exchange //If the stock is in the exchange, return stock_id //If exchange is not found, return -1 public int QueryStockID(String stock) { int stock_id = -1; try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Query Statement stmt = conn.createStatement(); String sql; sql = "SELECT * FROM " + Stock_name + " WHERE stock_name=\'" + stock + "\'"; ResultSet rs = stmt.executeQuery(sql); //Extract data while (rs.next()) { //Retrieve by column name stock_id = rs.getInt("id"); } //Clean-up rs.close(); stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } return stock_id; } //Return the stock price at timer = t with stock_id //If price is not found, return default value -1 public float QueryPrice(int t, int stock_id) { float price = -1; try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Query Statement stmt = conn.createStatement(); String sql; sql = "SELECT * FROM " + Stock_price + " WHERE timer=" + t; ResultSet rs = stmt.executeQuery(sql); //Extract data while (rs.next()) { //Retrieve by column index int index = stock_id + 1; //timer is the first element price = rs.getFloat(index); } //Clean-up rs.close(); stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } return price; } //Return the stock quantity at timer = t with stock_id //If quantity is not found, return default value -1 public int QueryQty(int t, int stock_id) { int qty = -1; try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Query Statement stmt = conn.createStatement(); String sql; sql = "SELECT * FROM " + Stock_qty + " WHERE timer=" + t; ResultSet rs = stmt.executeQuery(sql); //Extract data while (rs.next()) { //Retrieve by column index int index = stock_id + 1; //timer is the first element qty = rs.getInt(index); } //Clean-up rs.close(); stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } return qty; } //Return stock prices at timer = t public ArrayList<Float> QueryPriceAll(int t) { ArrayList<Float> tmp = new ArrayList<>(); int index = 2; try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Query Statement stmt = conn.createStatement(); String sql; sql = "SELECT * FROM " + Stock_price + " WHERE timer=" + t; ResultSet rs = stmt.executeQuery(sql); //Extract data float price = 0; while (rs.next()) { //Retrieve by column index while(index > 0) { try { price = rs.getFloat(index); }catch (Exception e) { break; } tmp.add(price); index++; } } //Clean-up rs.close(); stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } return tmp; } //Return stock quantities at timer = t public ArrayList<Integer> QueryQuantityAll(int t) { ArrayList<Integer> tmp = new ArrayList<>(); int index = 2; try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Query Statement stmt = conn.createStatement(); String sql; sql = "SELECT * FROM " + Stock_qty + " WHERE timer=" + t; ResultSet rs = stmt.executeQuery(sql); //Extract data int qty = 0; while (rs.next()) { //Retrieve by column index while(index > 0) { try { qty = rs.getInt(index); }catch (Exception e) { break; } tmp.add(qty); index++; } } //Clean-up rs.close(); stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } return tmp; } //Update qty of one stock or all of the stock quantities at timer = t to Stock_qty_log table //If update all the stock quantities, set all = true //If success, return true; otherwise, return false public boolean updateQty(int stock_id, ArrayList<Integer> tmp, int t, boolean all) { int size = tmp.size(); try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Update Statement stmt = conn.createStatement(); String sql; //update all if (all) { for (int i=0; i<size; i++) { //stock_id starts from 1 int id = i +1; sql = "UPDATE " + Stock_qty_log + " SET " + "C" + id + "=" + tmp.get(i) + " WHERE timer = " + t; stmt.execute(sql); } } //update only one stock else { sql = "UPDATE " + tmp_qty + " SET " + "C" + stock_id + "=" + tmp.get(stock_id -1); stmt.execute(sql); } //Clean-up stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); return false; } return true; } //update to tmp_qty table //if update whole tmp_qty, set all = true //if update only one stock, set all = false public boolean to_tmpQty(int stock_id, ArrayList<Integer> tmp, boolean all) { int size = tmp.size(); try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Update Statement stmt = conn.createStatement(); String sql; //update all if (all) { for (int i=0; i<size; i++) { //stock_id starts from 1 int id = i +1; sql = "UPDATE " + tmp_qty + " SET " + "C" + id + "=" + tmp.get(i); stmt.execute(sql); } } //update only one stock else { sql = "UPDATE " + tmp_qty + " SET " + "C" + stock_id + "=" + tmp.get(stock_id -1); stmt.execute(sql); } //Clean-up stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); return false; } return true; } //extract all of the stock quantities from tmp_qty //used when first time launch or after exchange recovers from crash public ArrayList<Integer> from_tmpQty() { ArrayList<Integer> tmp = new ArrayList<>(); int index = 2; try { //Register JDBC driver Class.forName(Driver); //Open a connection Connection conn = DriverManager.getConnection(DB_URL, user, password); //Query Statement stmt = conn.createStatement(); String sql; sql = "SELECT * FROM " + tmp_qty; ResultSet rs = stmt.executeQuery(sql); //Extract data int qty = 0; while (rs.next()) { //Retrieve by column index while(index > 0) { try { qty = rs.getInt(index); }catch (Exception e) { break; } tmp.add(qty); index++; } } //Clean-up rs.close(); stmt.close(); conn.close(); }catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } return tmp; } }
[ "gongbenyan@gmail.com" ]
gongbenyan@gmail.com
3778f8de9fae9014f196a918dcb7c87dd5cfb490
ab453f728d94bc482f3c0a9ab8b1b2675f682807
/app/src/main/java/ru/startandroid/weath/geocoder/Geocoder.java
afa92f6fe359e48207c92b38c86da2800ae6ac10
[]
no_license
DenisShevtsov/Weather
861e2c739e5d933a1924fce86518306a953b998d
8b7a88b52fcd85554d8658eaceb349340d3d5f74
refs/heads/master
2020-04-25T09:50:01.633480
2019-03-09T16:44:22
2019-03-09T16:44:22
172,688,021
1
0
null
null
null
null
UTF-8
Java
false
false
398
java
package ru.startandroid.weath.geocoder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Geocoder { @SerializedName("response") @Expose private Response response; public Response getResponse() { return response; } public void setResponse(Response response) { this.response = response; } }
[ "bagudila220@gmail.com" ]
bagudila220@gmail.com
ce2079b3f3c278f2f4110e1e7169167093aaa4a4
ae32545aba56756b3c629003ce2c2f3670758efc
/src/java/by/phone/station/command/admin/GetAbonentsCommand.java
226fa20efa74339e81164377fbfea85fed98e033
[]
no_license
nikitosko/Phone-Station
1008b426726dd299cf2a57d9eb6d5e811fb0d0d1
7d4044d0c3659fa16607543a692da7d78b14844d
refs/heads/master
2021-01-13T11:41:56.700651
2016-12-26T23:57:18
2016-12-26T23:57:18
77,412,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,325
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package by.phone.station.command.admin; import by.phone.station.command.ActionCommand; import by.phone.station.dao.AbonentDAO; import by.phone.station.dao.pool.ConnectionPool; import by.phone.station.model.Abonent; import by.phone.station.resource.ConfigurationManager; import java.sql.Connection; import java.sql.SQLException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.http.HttpServletRequest; /** * * @author user */ public class GetAbonentsCommand implements ActionCommand { @Override public String execute(HttpServletRequest request) { String page= null; List<Abonent> abonents = null; try { Connection conn = ConnectionPool.getConnection(); AbonentDAO abonentDao = new AbonentDAO(conn); abonents = abonentDao.findAll(); request.setAttribute("abonents", abonents); page = ConfigurationManager.getProperty("path.page.admin.abonents"); ConnectionPool.closeConnection(conn); } catch (SQLException ex) { Logger.getLogger(GetAbonentsCommand.class.getName()).log(Level.SEVERE, null, ex); } return page; } }
[ "konkov480@gmail.com" ]
konkov480@gmail.com
3e24333a38a47ed04c1d12a0c2ba97ef414712dd
e614fe365d778e158d5c7adfb12679d6a793c3cf
/app/src/main/java/com/padacn/xmgoing/util/EvenPayPriceUtil.java
c1c02e69253818ced931000f4f3580acebac78fa
[]
no_license
liuwenjun1361678/panda
b598b4e57fd2fe630f785b9332b2d3513c9ce89e
e53caffafbfb75635ca656a1438ac0de3111a394
refs/heads/master
2020-03-27T04:41:28.600547
2018-08-24T08:39:52
2018-08-24T08:39:52
145,960,959
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package com.padacn.xmgoing.util; /** * Created by Administrator on 2018/5/18 0018. */ public class EvenPayPriceUtil { private String price; public EvenPayPriceUtil(String price) { this.price = price; } public String getPriceString() { return this.price; } }
[ "460094791@qq.com" ]
460094791@qq.com
772e910ac8268589003c647db224a33f1bb99dd1
067c67621b836f5466a1155f6731d2a3d8a71f33
/app/src/main/java/com/khizarms/diygarage/view/ActionRecyclerAdapter.java
d47ba1de9a1398d38326b44d2f8dc795a627553d
[ "Apache-2.0" ]
permissive
khizar-saleem/diy-garage
61baed5624e25b4c17bbd69a804aaa3f121a92bf
987af62390f076a8cc19fa2a95fc1f264d43d4fa
refs/heads/master
2020-08-03T21:20:02.288561
2020-01-16T21:12:53
2020-01-16T21:12:53
211,888,597
0
0
null
null
null
null
UTF-8
Java
false
false
3,054
java
/* Copyright 2019 Khizar Saleem 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.khizarms.diygarage.view; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.khizarms.diygarage.R; import com.khizarms.diygarage.model.entity.Action; import com.khizarms.diygarage.view.ActionRecyclerAdapter.ActionHolder; import java.util.List; /** * Subclass of {@link RecyclerView.Adapter} that displays {@link Action} values. */ public class ActionRecyclerAdapter extends RecyclerView.Adapter<ActionHolder> { private final Context context; private final List<Action> actions; private final OnClickListener listener; /** * Instantiates a new Action recycler adapter. * * @param context the context * @param listener the listener * @param actions the actions */ public ActionRecyclerAdapter(Context context, View.OnClickListener listener, List<Action> actions) { this.context = context; this.actions = actions; this.listener = listener; } @NonNull @Override public ActionHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.action_list_content, parent, false); return new ActionHolder(view); } @Override public void onBindViewHolder(@NonNull ActionHolder holder, int position) { holder.bind(actions.get(position)); } @Override public int getItemCount() { return actions.size(); } /** * The type Action holder. */ class ActionHolder extends RecyclerView.ViewHolder { private final View view; private final TextView serviceType; private final TextView actionSummary; private final TextView actionDescription; private ActionHolder(View view) { super(view); this.view = view; view.setOnClickListener(listener); view.setTag(null); serviceType = view.findViewById(R.id.service_type); actionSummary = view.findViewById(R.id.action_summary); actionDescription = view.findViewById(R.id.action_description); } private void bind(Action action) { view.setTag(action); serviceType.setText(action.getServiceType().toString()); actionSummary.setText(action.getSummary()); actionDescription.setText(action.getDescription()); } } }
[ "saleemkhizar@outlook.com" ]
saleemkhizar@outlook.com
ec74500f91307e90e283e4fdacdae0ec12696b47
7fdc7740a7b4958e26f4bdd0c67e2f33c9d032ab
/SpringBoot/learn-spring-boot/learn-spring-boot-chapter2/src/main/java/com/learn/springboot/chapter2/LearnSpringBootChapter2Application.java
ef85c9694192b23878ca9892867c74c207f02ff1
[]
no_license
lysjava1992/javabase
9290464826d89c0415bb7c6084aa649de1496741
9d403aae8f20643fe1bf370cabcdd93164ea604b
refs/heads/master
2023-06-22T02:25:21.573301
2021-12-12T03:35:36
2021-12-12T03:35:36
216,582,761
0
0
null
null
null
null
UTF-8
Java
false
false
381
java
package com.learn.springboot.chapter2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * @author admin */ @SpringBootApplication public class LearnSpringBootChapter2Application { public static void main(String[] args) { SpringApplication.run(LearnSpringBootChapter2Application.class, args); } }
[ "763644568@qq.com" ]
763644568@qq.com
478b005cd770d829d1043bc015a4df47f9b8d8cf
477846d0f7d9710ff73736fd998d2dcd2d854fcb
/app/src/main/java/com/example/projetoapollo/LoginPublico_Activity.java
dad221d3c650e8c6cf89b61a002fe39cc48d418b
[]
no_license
vittormessias/ProjetoApollo
241b8ddb092bf3f01f7ab3175a0d257ceda3b4d2
25771fbf9548802d122159c287fd09339ecd987e
refs/heads/master
2023-01-24T10:38:01.768571
2020-12-02T22:43:24
2020-12-02T22:43:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,829
java
package com.example.projetoapollo; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class LoginPublico_Activity extends AppCompatActivity { //criar variaveis que irão representar os componentes do xml Button btnEntrar, btnCadastro, btnPublico, btnArtista; EditText txtEmail, txtSenha; TextView txtRecuperacao; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //está chamada de metódo que faz referência ao layout setContentView(R.layout.login_publico_layout); //apresentar os componentes do xml para o java btnEntrar = findViewById(R.id.btnEntrar); btnCadastro = findViewById(R.id.btnCadastro); btnPublico = findViewById(R.id.btnPublico); btnArtista = findViewById(R.id.btnArtista); txtEmail = findViewById(R.id.txtEmail); txtSenha = findViewById(R.id.txtSenha); txtRecuperacao = findViewById(R.id.txtRecuperacao); } // metódo de abrir janela public void abrirJanelaArtista(View view) { Intent abrirJanelaArtista = new Intent(getApplicationContext(), LoginArtista_Activity.class); startActivity(abrirJanelaArtista); } public void abrirJanelaPublico(View view) { Intent abrirJanelaPublico = new Intent(getApplicationContext(), CadPerfilPublico_Activity.class); startActivity(abrirJanelaPublico); } public void abrirJanelaPerfilPublico(View view) { Intent abrirJanelaPerfilPublico = new Intent(getApplicationContext(), HomePublico_Activity.class); startActivity(abrirJanelaPerfilPublico); } }
[ "vitor.vianasoaresmessias@yahoo.com.br" ]
vitor.vianasoaresmessias@yahoo.com.br
1b30f204266a1cb85a9a0c76b525ca7b9aece123
0813e18eb6b6cd5de9898c33788b9ab7e93727c6
/uva/chapter_5/java/343/src/Main.java
00d8d7f07c6d848db41671c9c7eaa36aac4693be
[ "MIT" ]
permissive
metaflow/contests
a769e97337363743a1ec89c292d27939781491d3
5e9ffcb72c3e7da54b5e0818b1afa59f5778ffa2
refs/heads/master
2021-07-13T00:09:23.470950
2021-06-28T10:54:47
2021-06-28T10:54:47
19,686,394
1
0
null
null
null
null
UTF-8
Java
false
false
1,517
java
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { new Main().run(); } private void run() { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String a = scanner.next(); String b = scanner.next(); Map<BigInteger, Integer> m = new HashMap<BigInteger, Integer>(); for (int x = 2; x <= 36; x++) { try { BigInteger i = new BigInteger(a, x); if (m.containsKey(i)) continue; m.put(i, x); } catch (NumberFormatException ignored) { continue; } } boolean ok = false; for (int y = 2; y <= 36; y++) { try { BigInteger i = new BigInteger(b, y); if (m.containsKey(i)) { ok = true; System.out.println(String.format("%s (base %d) = %s (base %d)", a, m.get(i), b, y)); break; } } catch (NumberFormatException ignored) { continue; } } if (!ok) { System.out.println(String.format("%s is not equal to %s in any base 2..36", a, b)); } } } }
[ "metaflow@yandex-team.ru" ]
metaflow@yandex-team.ru
c2892b9c13e3ce325748db133bde8bc361082047
ecda57b54384ec14ce0dc8c8ce815738951902e5
/app/build/generated/source/r/debug/android/support/mediacompat/R.java
6a1c411081ff4d60e4e21f2ac041498ac8d91a9b
[]
no_license
Navissos/PRMSMobileApp
f0f220fe33deb0d62c09c43537dd8b5dffe8e9ba
740676044106b0f8547bb00dc19ac193de5ef765
refs/heads/master
2020-03-28T02:41:14.524653
2018-09-07T21:24:52
2018-09-07T21:24:53
147,589,724
1
0
null
null
null
null
UTF-8
Java
false
false
9,751
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.mediacompat; public final class R { public static final class attr { public static final int font = 0x7f030093; public static final int fontProviderAuthority = 0x7f030095; public static final int fontProviderCerts = 0x7f030096; public static final int fontProviderFetchStrategy = 0x7f030097; public static final int fontProviderFetchTimeout = 0x7f030098; public static final int fontProviderPackage = 0x7f030099; public static final int fontProviderQuery = 0x7f03009a; public static final int fontStyle = 0x7f03009b; public static final int fontWeight = 0x7f03009c; } public static final class bool { public static final int abc_action_bar_embed_tabs = 0x7f040000; } public static final class color { public static final int notification_action_color_filter = 0x7f05004a; public static final int notification_icon_bg_color = 0x7f05004b; public static final int notification_material_background_media_default_color = 0x7f05004c; public static final int primary_text_default_material_dark = 0x7f050052; public static final int ripple_material_light = 0x7f050057; public static final int secondary_text_default_material_dark = 0x7f050058; public static final int secondary_text_default_material_light = 0x7f050059; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f060050; public static final int compat_button_inset_vertical_material = 0x7f060051; public static final int compat_button_padding_horizontal_material = 0x7f060052; public static final int compat_button_padding_vertical_material = 0x7f060053; public static final int compat_control_corner_material = 0x7f060054; public static final int notification_action_icon_size = 0x7f060065; public static final int notification_action_text_size = 0x7f060066; public static final int notification_big_circle_margin = 0x7f060067; public static final int notification_content_margin_start = 0x7f060068; public static final int notification_large_icon_height = 0x7f060069; public static final int notification_large_icon_width = 0x7f06006a; public static final int notification_main_column_padding_top = 0x7f06006b; public static final int notification_media_narrow_margin = 0x7f06006c; public static final int notification_right_icon_size = 0x7f06006d; public static final int notification_right_side_padding_top = 0x7f06006e; public static final int notification_small_icon_background_padding = 0x7f06006f; public static final int notification_small_icon_size_as_large = 0x7f060070; public static final int notification_subtext_size = 0x7f060071; public static final int notification_top_pad = 0x7f060072; public static final int notification_top_pad_large_text = 0x7f060073; } public static final class drawable { public static final int notification_action_background = 0x7f070079; public static final int notification_bg = 0x7f07007a; public static final int notification_bg_low = 0x7f07007b; public static final int notification_bg_low_normal = 0x7f07007c; public static final int notification_bg_low_pressed = 0x7f07007d; public static final int notification_bg_normal = 0x7f07007e; public static final int notification_bg_normal_pressed = 0x7f07007f; public static final int notification_icon_background = 0x7f070080; public static final int notification_template_icon_bg = 0x7f070081; public static final int notification_template_icon_low_bg = 0x7f070082; public static final int notification_tile_bg = 0x7f070083; public static final int notify_panel_notification_icon_bg = 0x7f070084; } public static final class id { public static final int action0 = 0x7f080007; public static final int action_container = 0x7f08000f; public static final int action_divider = 0x7f080011; public static final int action_image = 0x7f080012; public static final int action_text = 0x7f080018; public static final int actions = 0x7f080019; public static final int async = 0x7f080021; public static final int blocking = 0x7f080024; public static final int cancel_action = 0x7f080035; public static final int chronometer = 0x7f080041; public static final int end_padder = 0x7f080060; public static final int forever = 0x7f08006b; public static final int icon = 0x7f080076; public static final int icon_group = 0x7f080077; public static final int info = 0x7f08007b; public static final int italic = 0x7f08007d; public static final int line1 = 0x7f080080; public static final int line3 = 0x7f080081; public static final int media_actions = 0x7f08008b; public static final int normal = 0x7f08009c; public static final int notification_background = 0x7f08009d; public static final int notification_main_column = 0x7f08009e; public static final int notification_main_column_container = 0x7f08009f; public static final int right_icon = 0x7f0800bc; public static final int right_side = 0x7f0800bd; public static final int status_bar_latest_event_content = 0x7f0800e8; public static final int tag_transition_group = 0x7f0800f0; public static final int text = 0x7f0800f1; public static final int text2 = 0x7f0800f2; public static final int time = 0x7f0800fb; public static final int title = 0x7f0800fd; } public static final class integer { public static final int cancel_button_image_alpha = 0x7f090002; public static final int status_bar_notification_info_maxnum = 0x7f090004; } public static final class layout { public static final int notification_action = 0x7f0a002f; public static final int notification_action_tombstone = 0x7f0a0030; public static final int notification_media_action = 0x7f0a0031; public static final int notification_media_cancel_action = 0x7f0a0032; public static final int notification_template_big_media = 0x7f0a0033; public static final int notification_template_big_media_custom = 0x7f0a0034; public static final int notification_template_big_media_narrow = 0x7f0a0035; public static final int notification_template_big_media_narrow_custom = 0x7f0a0036; public static final int notification_template_custom_big = 0x7f0a0037; public static final int notification_template_icon_group = 0x7f0a0038; public static final int notification_template_lines_media = 0x7f0a0039; public static final int notification_template_media = 0x7f0a003a; public static final int notification_template_media_custom = 0x7f0a003b; public static final int notification_template_part_chronometer = 0x7f0a003c; public static final int notification_template_part_time = 0x7f0a003d; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0d002e; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0e00ef; public static final int TextAppearance_Compat_Notification_Info = 0x7f0e00f0; public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0e00f1; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e00f2; public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0e00f3; public static final int TextAppearance_Compat_Notification_Media = 0x7f0e00f4; public static final int TextAppearance_Compat_Notification_Time = 0x7f0e00f5; public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0e00f6; public static final int TextAppearance_Compat_Notification_Title = 0x7f0e00f7; public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0e00f8; public static final int Widget_Compat_NotificationActionContainer = 0x7f0e0164; public static final int Widget_Compat_NotificationActionText = 0x7f0e0165; } public static final class styleable { public static final int[] FontFamily = { 0x7f030095, 0x7f030096, 0x7f030097, 0x7f030098, 0x7f030099, 0x7f03009a }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x7f030093, 0x7f03009b, 0x7f03009c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_font = 3; public static final int FontFamilyFont_fontStyle = 4; public static final int FontFamilyFont_fontWeight = 5; } }
[ "stefandragic@Stefans-MacBook-Pro.local" ]
stefandragic@Stefans-MacBook-Pro.local
18e42812fd5df23667a3c814cc6cbea93786a1a0
e21086258a2ec71d7a0e695f1813eb9094d047de
/src/main/java/ru/vaszol/exam/web/forms/ManagerTestForm.java
b5ae7a76c3d158a59787101c774740de2b74dc60
[]
no_license
vaszol/ExamForPDD
3b1b3c3010a5c0b4ffccb540603195f9c994598c
dc6086ae44cd5c80e8e00192c905f11c0bc6b1aa
refs/heads/master
2021-01-10T02:08:57.274740
2015-10-07T20:32:02
2015-10-07T20:32:02
43,801,904
0
0
null
null
null
null
UTF-8
Java
false
false
859
java
package ru.vaszol.exam.web.forms; import java.util.Collection; public class ManagerTestForm { private Collection sessions; //набор сессий private Collection bilets; //набор билетов private Collection results; //набор результатов private Collection otvets; //набор ответов public Collection getSessions() { return sessions; } public void setSessions(Collection sessions) { this.sessions = sessions; } public Collection getBilets() { return bilets; } public void setBilets(Collection bilets) { this.bilets = bilets; } public Collection getResults() { return results; } public void setResults(Collection results) { this.results = results; } public Collection getOtvets() { return otvets; } public void setOtvets(Collection otvets) { this.otvets = otvets; } }
[ "vaszol@mail.ru" ]
vaszol@mail.ru
933a10a83dd453e9e48699bac452101751b47ea7
45cf31ab56cc361bec17e1331718f09c7f4f7a81
/empushy/src/test/java/eu/aempathy/empushy/ExampleUnitTest.java
1b0e407a21c92742dad7b3421d46d70d78fee50c
[]
no_license
kieranfraser/empushy
51685aca4d0ad98ba81832d0e5897d3780aa1cc4
01fea27e377aa5c7134afdf4c507d479ac3d3119
refs/heads/master
2020-03-27T16:21:01.652935
2019-01-08T19:04:00
2019-01-08T19:04:00
146,776,020
1
0
null
null
null
null
UTF-8
Java
false
false
397
java
package eu.aempathy.empushy; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "kfraser@tcd.ie" ]
kfraser@tcd.ie
22f197fb7eb1b6a69ea63d80b53e06cb92c2529e
2bc2eadc9b0f70d6d1286ef474902466988a880f
/tags/mule-2.0.0-RC1/examples/loanbroker/bpm/src/main/java/org/mule/examples/loanbroker/bpm/LoanBrokerApp.java
73a171f6d278448cfc0734e195b45f27c3375a37
[]
no_license
OrgSmells/codehaus-mule-git
085434a4b7781a5def2b9b4e37396081eaeba394
f8584627c7acb13efdf3276396015439ea6a0721
refs/heads/master
2022-12-24T07:33:30.190368
2020-02-27T19:10:29
2020-02-27T19:10:29
243,593,543
0
0
null
2022-12-15T23:30:00
2020-02-27T18:56:48
null
UTF-8
Java
false
false
1,212
java
/* * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.examples.loanbroker.bpm; import org.mule.examples.loanbroker.AbstractLoanBrokerApp; import org.mule.providers.jdbc.util.MuleDerbyUtils; import org.mule.umo.UMOException; /** * Executes the LoanBroker BPM example. */ public class LoanBrokerApp extends AbstractLoanBrokerApp { public LoanBrokerApp(String config) throws Exception { super(config); } public static void main(String[] args) throws Exception { LoanBrokerApp loanBrokerApp = new LoanBrokerApp("loan-broker-bpm-mule-config.xml"); loanBrokerApp.run(false); } protected void init() throws Exception { // before initialisation occurs, the database must be cleaned and a new one created MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name"); super.init(); } }
[ "tcarlson@bf997673-6b11-0410-b953-e057580c5b09" ]
tcarlson@bf997673-6b11-0410-b953-e057580c5b09
9542158d12aa22b98ea2d5d576b5c6ea57911588
0db12fdc312f55668533d8dd454b1557d38c3b14
/DesignPattern/src/com/jayfulmath/designpattern/flyweight/ConcreateWebSite.java
0418ea09fecc95cc56bdc885b347d8e6861a3c37
[]
no_license
demanluandyuki/Examples
e85a3ddda13060022d51f7942107e68f6e11fe1b
cdbe323a0110bd6cb90233f06f21f875dfe1cc9e
refs/heads/master
2021-01-17T07:01:52.588720
2016-05-11T08:52:20
2016-05-11T08:52:20
26,155,948
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.jayfulmath.designpattern.flyweight; public class ConcreateWebSite extends WebSite { String name; public ConcreateWebSite(String name) { super(); this.name = name; } @Override public void Use(User user) { System.out.println("WebSite :"+name+"\t User:"+user.name); } }
[ "deman_lu@htc.com" ]
deman_lu@htc.com
ef1d351d5329f53d2df54852266e90ea0dae29a8
2cfd92b533f72834d71958a7be638e2077bddbee
/core-api/src/main/java/com/inovvet/core/entity/cliente/Telefone.java
423e5558d1dee7c745b382fbb9997cb91a05b92c
[]
no_license
DiegoDamascenoPego/inovvet-core
beb40da86b5a1335693758e6535c5d6eacf485de
d29f77fc9c5714687361a0b77b751b8a28e4be90
refs/heads/main
2023-04-28T15:09:36.950554
2021-05-22T20:10:49
2021-05-22T20:10:49
369,875,191
0
0
null
null
null
null
UTF-8
Java
false
false
1,095
java
package com.inovvet.core.entity.cliente; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.Table; import com.inovvet.app.entity.SimpleEntity; import com.inovvet.core.enumerator.EnumTipoTelefone; import lombok.Getter; import lombok.Setter; @Getter @Setter @Table(name = "cliente_telefone") @Entity public class Telefone extends SimpleEntity { @Enumerated(EnumType.ORDINAL) private EnumTipoTelefone tipo; private String numero; private String observacao; @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((numero == null) ? 0 : numero.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof Telefone)) return false; Telefone other = (Telefone) obj; if (numero == null) { if (other.numero != null) return false; } else if (!numero.equals(other.numero)) return false; return true; } }
[ "diegodamascenopego@hotmail.com" ]
diegodamascenopego@hotmail.com
e68f03e745966fd7864b731886fddae44054e7ff
40cebab6dbf0ed783be03454ffbd53536eca3536
/src/ve/org/bcv/dao/impl/BaseDaoImpl.java
3100921d9aee560e2a0063ea97a4169ba311963d
[]
no_license
saymonset/ENCSTAMEDIC
5ce1a54f334bb6da93a6322d397af0c1b9a34354
48e7a53359308df83d06646fde7d1b5cc3929538
refs/heads/master
2021-01-20T01:34:33.555999
2017-04-25T00:32:51
2017-04-25T00:32:51
89,299,568
0
0
null
null
null
null
UTF-8
Java
false
false
1,234
java
/** * */ package ve.org.bcv.dao.impl; import java.io.Serializable; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import ve.org.bcv.dao.local.EntityRepository; /** * @author Ing Simon Alberto Rodriguez Pacheco * 17/06/2016 14:45:06 * 2016 * mail : oraclefedora@gmail.com */ public abstract class BaseDaoImpl<E, PK extends Serializable> implements EntityRepository <E, PK> { @PersistenceContext(unitName = "primary") protected EntityManager em; public abstract Class<E> getEntityClass(); public E save(E entity) { em.persist(entity); return entity; } public E update(E build) { try { build=em.merge(build); } catch (Exception e) { e.printStackTrace(); } return build; } public void remove(E entity) { em.remove(entity); } public void refresh(E entity) { } public void flush() { } public E findByPK(PK primaryKey) { return em.find(getEntityClass(), primaryKey); } public List<E> findAll() { return em.createQuery("Select t from " + getEntityClass().getSimpleName() + " t").getResultList(); } }
[ "saymon_set@hotmail.com" ]
saymon_set@hotmail.com
14c31b164e5810bdeebd73dbe5e2bbbd544ee7ab
0f523d8eb9b2a2cd818d585c68246f7110117fc0
/src/com/vis/test/DCTServiceImplTest.java
5bdf6de6715b28b288b001619dbf6d0929fde6fb
[]
no_license
visrahane/Multimedia_JPEG_Compression
ed6055b402a39c39cf9767822dc018c5ecf53775
626a3bdfe888af4a99df66b64a2e6940b78ffde0
refs/heads/master
2021-07-17T19:36:50.641043
2017-10-25T00:41:17
2017-10-25T00:41:17
105,844,138
0
0
null
null
null
null
UTF-8
Java
false
false
6,905
java
/** * */ package com.vis.test; import org.junit.Assert; import org.junit.Test; import com.vis.models.InputModel; import com.vis.services.DCTServiceImpl; import com.vis.services.DWTServiceImpl; /** * @author Vis * */ public class DCTServiceImplTest { @Test public void testEncode() { DCTServiceImpl dctService = new DCTServiceImpl(); float[][][][] expectedBlock = new float[][][][]{ { { { 139f, 144f, 149f, 153f, 155f, 155f, 155f, 155f }, { 144f, 151f, 153f, 156f, 159f, 156f, 156f, 156f }, { 150f, 155f, 160f, 163f, 158f, 156f, 156f, 156f }, { 159f, 161f, 162f, 160f, 160f, 159f, 159f, 159f }, { 159f, 160f, 161f, 162f, 162f, 155f, 155f, 155f }, { 161f, 161f, 161f, 161f, 160f, 157f, 157f, 157f }, { 162f, 162f, 161f, 163f, 162f, 157f, 157f, 157f }, { 162f, 162f, 161f, 161f, 163f, 158f, 158f, 158f } } }, { { { 139f, 144f, 149f, 153f, 155f, 155f, 155f, 155f }, { 144f, 151f, 153f, 156f, 159f, 156f, 156f, 156f }, { 150f, 155f, 160f, 163f, 158f, 156f, 156f, 156f }, { 159f, 161f, 162f, 160f, 160f, 159f, 159f, 159f }, { 159f, 160f, 161f, 162f, 162f, 155f, 155f, 155f }, { 161f, 161f, 161f, 161f, 160f, 157f, 157f, 157f }, { 162f, 162f, 161f, 163f, 162f, 157f, 157f, 157f }, { 162f, 162f, 161f, 161f, 163f, 158f, 158f, 158f } } }, { { { 139f, 144f, 149f, 153f, 155f, 155f, 155f, 155f }, { 144f, 151f, 153f, 156f, 159f, 156f, 156f, 156f }, { 150f, 155f, 160f, 163f, 158f, 156f, 156f, 156f }, { 159f, 161f, 162f, 160f, 160f, 159f, 159f, 159f }, { 159f, 160f, 161f, 162f, 162f, 155f, 155f, 155f }, { 161f, 161f, 161f, 161f, 160f, 157f, 157f, 157f }, { 162f, 162f, 161f, 163f, 162f, 157f, 157f, 157f }, { 162f, 162f, 161f, 161f, 163f, 158f, 158f, 158f } } } }; float[][][][] colorBlock = new float[3][1][8][8]; copyArray(expectedBlock, colorBlock); colorBlock = dctService.encodeBlock(colorBlock); colorBlock = dctService.decodeBlock(colorBlock); roundValuesToTest(colorBlock); Assert.assertArrayEquals(expectedBlock, colorBlock); } private void roundValuesToTest(float[][][][] colorBlock) { for (int i = 0; i < colorBlock.length; i++) { for (int j = 0; j < colorBlock[0].length; j++) { for (int x = 0; x < colorBlock[0][0].length; x++) { for (int y = 0; y < colorBlock[0][0][0].length; y++) { colorBlock[i][j][x][y] = Math.round(colorBlock[i][j][x][y]); } } } } } private void copyArray(float[][][][] copyOf, float[][][][] copyInto) { for (int i = 0; i < copyOf.length; i++) { for (int j = 0; j < copyOf[0].length; j++) { for (int x = 0; x < copyOf[0][0].length; x++) { for (int y = 0; y < copyOf[0][0][0].length; y++) { copyInto[i][j][x][y] = copyOf[i][j][x][y]; } } } } } private byte[][][][] getByteArray(float[][][][] colorBlock) { byte[][][][] input = new byte[3][1][8][8]; for (int c = 0; c < 3; c++) { for (int i = 0; i < 1; i++) { for (int j = 0; j < 8; j++) { for (int k = 0; k < 8; k++) { input[c][i][j][k] = (byte) colorBlock[c][i][j][k]; } } } } return input; } private InputModel prepareInputModel() { InputModel inputModel = new InputModel(); inputModel.setFileName("R:/Study/Masters/Fall 2017/CSCI-576 Multimedia/HW-2/test images/rgb images/Lenna.rgb"); inputModel.setNoOfCoefficient(16384); return inputModel; } @Test public void testUpdateCoefficient_shouldReturnValidBlock() { float[][][][] colorBlock = new float[][][][] { { { { 139f, 144f, 149f, 153f, 155f, 155f, 155f, 155f }, { 144f, 151f, 153f, 156f, 159f, 156f, 156f, 156f }, { 150f, 155f, 160f, 163f, 158f, 156f, 156f, 156f }, { 159f, 161f, 162f, 160f, 160f, 159f, 159f, 159f }, { 159f, 160f, 161f, 162f, 162f, 155f, 155f, 155f }, { 161f, 161f, 161f, 161f, 160f, 157f, 157f, 157f }, { 162f, 162f, 161f, 163f, 162f, 157f, 157f, 157f }, { 162f, 162f, 161f, 161f, 163f, 158f, 158f, 158f } } }, { { { 139f, 144f, 149f, 153f, 155f, 155f, 155f, 155f }, { 144f, 151f, 153f, 156f, 159f, 156f, 156f, 156f }, { 150f, 155f, 160f, 163f, 158f, 156f, 156f, 156f }, { 159f, 161f, 162f, 160f, 160f, 159f, 159f, 159f }, { 159f, 160f, 161f, 162f, 162f, 155f, 155f, 155f }, { 161f, 161f, 161f, 161f, 160f, 157f, 157f, 157f }, { 162f, 162f, 161f, 163f, 162f, 157f, 157f, 157f }, { 162f, 162f, 161f, 161f, 163f, 158f, 158f, 158f } } }, { { { 139f, 144f, 149f, 153f, 155f, 155f, 155f, 155f }, { 144f, 151f, 153f, 156f, 159f, 156f, 156f, 156f }, { 150f, 155f, 160f, 163f, 158f, 156f, 156f, 156f }, { 159f, 161f, 162f, 160f, 160f, 159f, 159f, 159f }, { 159f, 160f, 161f, 162f, 162f, 155f, 155f, 155f }, { 161f, 161f, 161f, 161f, 160f, 157f, 157f, 157f }, { 162f, 162f, 161f, 163f, 162f, 157f, 157f, 157f }, { 162f, 162f, 161f, 161f, 163f, 158f, 158f, 158f } } } }; DCTServiceImpl dctService = new DCTServiceImpl(); colorBlock = dctService.getCoefficientsInZigZagOrder(colorBlock, 1); float[][][][] expectedBlock = { { { { 139f, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 } } }, { { { 139f, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 } } }, { { { 139f, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 } } } }; Assert.assertArrayEquals(expectedBlock, colorBlock); } @Test public void testDecodeOnRows_shouldReturnValidBlockAfter1stIteration() { DWTServiceImpl dwtService = new DWTServiceImpl(); float[][][] colorBlock = new float[][][] { { { 3f, 4.5f, 6f, 7.5f }, { 6.0f, 7.0f, 4f, 1.5f }, { -2f, -2.5f, -3.0f, -3.5f }, { 2.0f, 5f, 2f, .5f } }, { { 3f, 4.5f, 6f, 7.5f }, { 6.0f, 7.0f, 4f, 1.5f }, { -2f, -2.5f, -3.0f, -3.5f }, { 2.0f, 5f, 2f, .5f } }, { { 3f, 4.5f, 6f, 7.5f }, { 6.0f, 7.0f, 4f, 1.5f }, { -2f, -2.5f, -3.0f, -3.5f }, { 2.0f, 5f, 2f, .5f } } }; float expectedBlock[][][] = new float[][][] { { { 1, 2, 3, 4 }, { 5, 7, 9, 11 }, { 8, 12, 6, 2 }, { 4, 2, 2, 1 } }, { { 1, 2, 3, 4 }, { 5, 7, 9, 11 }, { 8, 12, 6, 2 }, { 4, 2, 2, 1 } }, { { 1, 2, 3, 4 }, { 5, 7, 9, 11 }, { 8, 12, 6, 2 }, { 4, 2, 2, 1 } } }; float[][][] processedBlock = dwtService.decodeOnRows(colorBlock, 4); Assert.assertArrayEquals(expectedBlock, processedBlock); } }
[ "rahane@usc.edu" ]
rahane@usc.edu
14562c562ae0b04c78b0fa175bc36073f501209a
3af95c7e3825c931cc435c2b8b6ecebc310c6a72
/src/Node/Node.java
6c599a87b1933d3f0e66db4b8a056888c0d2d3f8
[]
no_license
GLAU-TND/assignment-1-JayantDwivedi
4c8c7f9f5de4a4abb24e8f43e25f1ba530325346
18f2f3ad4dd66adfd2d59043d3f50ba186e0e265
refs/heads/master
2021-01-05T22:40:28.645941
2020-02-24T14:30:34
2020-02-24T14:30:34
241,157,131
0
1
null
2020-02-24T14:30:35
2020-02-17T16:39:57
null
UTF-8
Java
false
false
471
java
package Node; public class Node<T> { private T data; private Node<T> next; public T getData() { return data; } public void setData(T data) { this.data = data; } public Node<T> getNext() { return next; } public void setNext(Node<T> next) { this.next = next; } @Override public String toString() { return "Node{" + "data=" + data + '}'; } }
[ "jayantdwivedi19@gmail.com" ]
jayantdwivedi19@gmail.com
8f5f7c9954be93c10ecfc1d8e204b4392cc2aafe
b18b0a33a4864e0569794f6c9b9167cf7472bc03
/Sistema_Academico/.svn/pristine/8f/8f5f7c9954be93c10ecfc1d8e204b4392cc2aafe.svn-base
bd7234ef0ba730e9e0958e48c259143dcf1991d7
[]
no_license
lafch/genetico2
90d1290e7140e6fe5a1aa004bd21ac393e74261e
df823a89e226cf14278cfd4149d0c86144bac4ec
refs/heads/master
2021-05-04T11:35:49.795568
2018-01-02T23:13:43
2018-01-02T23:13:43
46,440,591
0
0
null
null
null
null
UTF-8
Java
false
false
1,337
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package net.uch.cursoLibre.hibernateSpringDao; import java.util.List; import net.uch.mapping.ClMedioPublicidad; import net.uch.mapping.ClMedioPublicidadDet; /** * * @author richard */ public interface HSMedioPublicidadCLDAO { public List<ClMedioPublicidad> listarMedioPublicidad(); public List<ClMedioPublicidad> listarMedioPublicidadDet(String tipo); public List<ClMedioPublicidadDet> listarMediopublicidadDeta_x_med(int med_id); public List<ClMedioPublicidadDet> listarMediopublicidadDeta(); public void modificarMedioPublicidad(ClMedioPublicidad medio); public void agregarMedioPublicidad(ClMedioPublicidad medio); public List<ClMedioPublicidad> listarMedioPublicidad(String med_descrpcion); public ClMedioPublicidad seleccionarMedioPublicidad(int med_id); public ClMedioPublicidadDet seleccionarMedioPublicidadDetalle(int meddet_id); public void agregarMedioPublicidadDet(ClMedioPublicidadDet detalle); public void modificarMedioPublicidadDet(ClMedioPublicidadDet detalle); public void eliminarMedioPublicidadDet(int medDet_id); public void guardarMedioPublicidadDet(ClMedioPublicidadDet detalle); public void modificarMedioPublicidadsql(ClMedioPublicidad medio); }
[ "albeflores@gmail.com" ]
albeflores@gmail.com
f77d4a2dcc10fc0621c0aa8ddd6b8fd2e6729edf
784777b0d72f05b126d6eee98ab6741f0e8531bf
/1Bi-2Bi/java-poo/exemplo-factory/src/veiculo/luxo/CambioAutomatico.java
b9fd7aa5a3c46cf64c6e1f6742f2daf07132ede5
[]
no_license
g-oak/CTD
910d34c330871170df606ac1600f1623ccebda7a
772e2597e2a046bb9bfba96952f88d79b04f405f
refs/heads/main
2023-09-03T16:05:46.498940
2021-11-19T23:10:24
2021-11-19T23:10:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package veiculo.luxo; import veiculo.SistemaCambio; public class CambioAutomatico implements SistemaCambio { @Override public void trocarMarcha() { System.out.println("CAMBIO AUTOMATICO"); } }
[ "arthurlacerda206@gmail.com" ]
arthurlacerda206@gmail.com
2f9b549e68e4fd2facec9a4796afc74e11e856df
7210922a3b6b85f2050ab4dfc421fcdee644c751
/mobile/dorm/src/com/dorm/activity/activity_choise.java
365daba9b5f3eace55525794b93413e047ec573f
[]
no_license
xymmk/room
43595f8cef75b3c7c3b225a01f542dceaa4d583c
c5062b58f09a550ab6a81ef849167e039dc4a8f8
refs/heads/master
2020-03-23T14:56:05.142592
2018-07-20T12:26:13
2018-07-20T12:26:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,354
java
package com.dorm.activity; import com.dorm.R; import android.app.Activity; import android.app.ActivityManager; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class activity_choise extends Activity{ private View activity_index,activity_login,activity_register; private Button choiseLogin,choiseRegister,studentLogin,workerLogin,loginBack,studentRegister,workerRegister,registerBack ,choiseExit; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater =getLayoutInflater(); activity_index=inflater.inflate(R.layout.activity_index,null); activity_login=inflater.inflate(R.layout.activity_choiselogin,null); activity_register=inflater.inflate(R.layout.activtiy_choiseregister,null); setContentView(activity_index); choiseLogin=(Button)findViewById(R.id.choiseLogin); choiseRegister=(Button)findViewById(R.id.choiseRegister); choiseExit=(Button)findViewById(R.id.choiseExit); choiseExit.setOnClickListener(new choiseExitListener()); choiseLogin.setOnClickListener(new choiseLoginListener()); choiseRegister.setOnClickListener(new choiseRegisterListener()); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } private class choiseLoginListener implements OnClickListener{ @Override public void onClick(View arg0) { choiseLogin(); } } private class choiseExitListener implements OnClickListener{ @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); android.os.Process.killProcess(android.os.Process.myPid()); } } private class choiseRegisterListener implements OnClickListener{ @Override public void onClick(View v) { // TODO Auto-generated method stub choiseRegister(); } } protected void choiseLogin(){ setContentView(activity_login); studentLogin=(Button)findViewById(R.id.studentLogin); workerLogin=(Button)findViewById(R.id.workerLogin); loginBack=(Button) findViewById(R.id.loginBack); loginBack.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub setContentView(activity_index); }}); workerLogin.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub Intent activity_workerLogin=new Intent(activity_choise.this,activity_workerLogin.class); startActivity(activity_workerLogin); }}); studentLogin.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub Intent activity_studentLogin=new Intent(activity_choise.this,activity_studentLogin.class); startActivity(activity_studentLogin); } } ); } protected void choiseRegister(){ setContentView(activity_register); studentRegister=(Button)findViewById(R.id.studentRegister); workerRegister=(Button)findViewById(R.id.workerRegister); registerBack=(Button)findViewById(R.id.registerBack); studentRegister.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub Intent activity_studentRegister=new Intent(activity_choise.this,activity_studentRegister.class); startActivity(activity_studentRegister); }}); workerRegister.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub Intent activity_workerRegister=new Intent(activity_choise.this,activity_workerRegister.class); startActivity(activity_workerRegister); }}); registerBack.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub setContentView(activity_index); }}); } }
[ "727830143@qq.com" ]
727830143@qq.com
ee2485a754b54ccb605865e9a18cb7ef15ab125d
f5d5b368c1ae220b59cfb26bc26526b494c54d0e
/gameandroiddemo/src/com/me/flappybird/Flappybird.java
85d2d97b1efc73c46514b75ab44cf5813edad4c2
[]
no_license
kishordgupta/2012_bkup
3778c26082697b1cf223e27822d8efe90b35fc76
53ef4014fb3e11158c3f9242cb1f829e02e3ef69
refs/heads/master
2021-01-10T08:25:57.122415
2020-10-16T12:06:52
2020-10-16T12:06:52
47,512,520
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package com.me.flappybird; import java.util.HashMap; import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.math.Vector2; public class Flappybird extends Game { public static final Vector2 VIEWPORT = new Vector2(320, 480); public AssetManager manager = new AssetManager(); public static HashMap<String, Sound> Sounds = new HashMap<String, Sound>(); @Override public void create() { Sounds.put(config.SoundsHit, Gdx.audio.newSound(Gdx.files.internal("data/sounds/sfx_hit.mp3"))); Sounds.put(config.SoundsScore, Gdx.audio.newSound(Gdx.files.internal("data/sounds/sfx_point.mp3"))); Sounds.put(config.SoundsJump, Gdx.audio.newSound(Gdx.files.internal("data/sounds/sfx_wing.mp3"))); setScreen(new Screenplay(this)); } @Override public void dispose() { for (String key : Sounds.keySet()) { Sounds.get(key).dispose(); } manager.dispose(); super.dispose(); } @Override public void resize(int width, int height) { // TODO Auto-generated method stub super.resize(width, height); } }
[ "kdgupta87@gmail.com" ]
kdgupta87@gmail.com
8ae8af54b7be24cc6821145cc62369eb281a81b2
677db1fa4434e8ee928dac8a077a6e7a2fc8267c
/src/test/java/com/qveo/qveoweb/QveowebApplicationTests.java
c94696949db10208cdaa38da23f353a8554f4f43
[]
no_license
Qveo/QVeoWeb
ed4e314812307408fab3fef4fb778288649a8c67
619060a7838fe6b045fe02f056335d5afac69f8e
refs/heads/master
2022-10-05T08:21:10.722482
2020-04-01T17:53:21
2020-04-01T17:53:21
250,360,602
1
1
null
2020-06-11T09:18:05
2020-03-26T20:07:23
Java
UTF-8
Java
false
false
209
java
package com.qveo.qveoweb; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class QveowebApplicationTests { @Test void contextLoads() { } }
[ "martamoralesfeito@gmail.com" ]
martamoralesfeito@gmail.com
4a647db5c273698d24d8938c0b400c8fbdf7dc6a
4ef2dca701dffbd41e93ce0a13d0c26bce4d27e3
/src/MakeChange.java
22982bebb471279534e9d9a111ec15846b1035dc
[]
no_license
eiknujedoc/MakeChangeProject
036465a87c3dc5ab322cda47000853e16567fb2d
2509a268594ffb7e63b78f4eabe16583c73ec1f0
refs/heads/master
2020-09-12T17:23:21.379780
2019-11-18T22:03:34
2019-11-18T22:03:34
222,492,976
0
0
null
null
null
null
UTF-8
Java
false
false
1,076
java
import java.util.Scanner; public class MakeChange { public static void main(String[] args) { Scanner kb = new Scanner(System.in); System.out.println("Enter Amount Due:_"); double balance = kb.nextDouble(); System.out.println("Enter Amount Tendered:_"); double payment = kb.nextDouble(); double changeDue = balance - payment; if (changeDue <= 0) { System.out.println("Change due: "); System.out.printf("%.2f", changeDue); makeChange(changeDue); } else System.out.println("Error"); } private static double makeChange(double changeDue) { double[] currency = { 100, 50, 20, 10, 5, 1, .25, .1, .05, .010 }; System.out.println(); System.out.println(); changeDue = (changeDue * -1); do { for (int i = 0; i < currency.length; i++) { do { if (((changeDue + .001) >= currency[i])) { System.out.printf("%.2f\n", currency[i]); changeDue = (changeDue) - currency[i]; // System.out.println(changeDue); } } while (changeDue > currency[i]); } return changeDue; } while (changeDue >= 0.0); } }
[ "code.junkie@comcast.net" ]
code.junkie@comcast.net
5b7a99baee00cd86c1b85fd36fa5cb4355f1674a
7b25f787a55f45bdbfb958f305968fa529c68f9b
/src/Array_Question/Solution053_1.java
291c885ca43ff9a5a2eb845a1e809c40be721900
[]
no_license
Zchhh73/Alg_Offer_ByJava
a575cb1612595afa901cd183bf23b3c4bf55dcbd
ff914c8e64054f87101bae6b2b59507f9390603d
refs/heads/master
2021-01-02T16:58:53.326066
2020-03-15T06:32:50
2020-03-15T06:33:12
239,710,835
7
0
null
null
null
null
UTF-8
Java
false
false
1,132
java
package Array_Question; public class Solution053_1 { public int GetNumberOfK(int[] array, int k) { int index = BinarySearch(array, k); if (index < 0) return 0; int count = 1; for(int i = index+1;i<array.length && array[i]==k;i++) count++; for(int i = index-1;i>=0 && array[i]==k;i--) count++; return count; } public static int BinarySearch(int[] array, int target) { if (array == null || array.length <= 0) return -1; if (array.length == 1 && array[0] == target) return 0; int left = 0; int right = array.length - 1; while (left < right) { int mid = left + ((right - left) >> 1); if (target == array[mid]) return mid; if (array[mid] < target) { left = mid + 1; } else { right = mid - 1; } } return -1; } public static void main(String[] args) { int[] arr = {1,2,2,3,3,3,3,4,5}; Solution053_1 solution053 = new Solution053_1(); System.out.println(solution053.GetNumberOfK(arr,3)); } }
[ "13671292697@163.com" ]
13671292697@163.com
0d3afc6fb0a854f19507fcf438185e33802a1436
977aa40d59885c75774bcd2e53e16cbf3c0c389c
/app/src/main/java/com/summertaker/akb48guide/util/ProportionalImageView.java
b3c73ece73b5295dfff1af21347f3979e8aa3744
[]
no_license
summertaker/akb48guide
d093aa8a57dd2bc9cfb2ddeb1a07625885f9c617
d8dae936a445d7c0571eae0a94e7f421c23c30e8
refs/heads/master
2020-04-06T03:45:16.734306
2017-03-06T08:29:12
2017-03-06T08:29:12
64,519,260
1
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
package com.summertaker.akb48guide.util; import android.content.Context; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.widget.ImageView; public class ProportionalImageView extends ImageView { public ProportionalImageView(Context context) { super(context); } public ProportionalImageView(Context context, AttributeSet attrs) { super(context, attrs); } public ProportionalImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { Drawable d = getDrawable(); if (d != null) { int width = MeasureSpec.getSize(widthMeasureSpec); int diw = d.getIntrinsicWidth(); if (diw > 0) { int height = width * d.getIntrinsicHeight() / diw; setMeasuredDimension(width, height); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } }
[ "Summer Taker" ]
Summer Taker
b6f3310dc2378f822fc0d54cf482fc7cfea433d8
9f5085479e58adcfac1aa0901fae51b3e0438a07
/app/src/main/java/com/colinknecht/tasktimer/AppDialog.java
d13369bd32351897c353c89ebd81fc2af3231a31
[]
no_license
ColinKnecht/TaskTimer
d3f5733da697c69c54d998bc17bbfa0ba1b3aadf
67789bffb911f25370d1d8bf11e86d4bdff5d48c
refs/heads/master
2021-06-22T21:31:35.343005
2017-08-28T17:50:27
2017-08-28T17:50:27
98,446,286
0
0
null
null
null
null
UTF-8
Java
false
false
4,354
java
package com.colinknecht.tasktimer; import android.app.Dialog; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatDialogFragment; import android.util.Log; /** * Created by colinknecht on 8/18/17. * */ public class AppDialog extends AppCompatDialogFragment { private static final String TAG = "AppDialog"; public static final String DIALOG_ID = "id"; public static final String DIALOG_MESSAGE = "message"; public static final String DIALOG_POSITIVE_RID = "positive_rid"; public static final String DIALOG_NEGATIVE_RID = "negative_rid"; /** * the dialogs callback interface to notify of user selected results (deletion confirmed, etc.) */ interface DialogEvents { void onPositiveDialogResult(int dialogId, Bundle args); void onNegativeDialogResult (int dialogId, Bundle args); void onDialogCancelled(int dialogId); } private DialogEvents mDialogEvents; @Override public void onAttach(Context context) { Log.d(TAG, "onAttach: starts, activity is " + context.toString()); super.onAttach(context); // Activities containting this fragment must implement its callbacks if(!(context instanceof DialogEvents)) { throw new ClassCastException(context.toString() + " must implement AppDialog.DialogEvent interface"); } mDialogEvents = (DialogEvents) context; } @Override public void onDetach() { Log.d(TAG, "onDetach: starts"); super.onDetach(); // Reset the active callbacks interface, because we dont have an activity any longer mDialogEvents = null; } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Log.d(TAG, "onCreateDialog: starts"); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); final Bundle arguments = getArguments(); final int dialogId; String messageString; int positiveStringId; int negativeStringId; if (arguments != null) { dialogId = arguments.getInt(DIALOG_ID); messageString = arguments.getString(DIALOG_MESSAGE); positiveStringId = arguments.getInt(DIALOG_POSITIVE_RID); if (dialogId == 0 || messageString == null) { throw new IllegalArgumentException("DIALOG_ID and/or DIALOG_MESSAGE not present in the bundle"); } if (positiveStringId == 0) { positiveStringId = R.string.ok; } negativeStringId = arguments.getInt(DIALOG_NEGATIVE_RID); if (negativeStringId == 0) { negativeStringId = R.string.cancel; } } else { throw new IllegalArgumentException("Must pass DIALOG_ID and DIALOG_MESSAGE in the bundle"); } builder.setMessage(messageString) .setPositiveButton(positiveStringId, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // callback the positive reult method if (mDialogEvents != null) { mDialogEvents.onPositiveDialogResult(dialogId, arguments); } } }) .setNegativeButton(negativeStringId, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // callback negative result method if (mDialogEvents != null) { mDialogEvents.onNegativeDialogResult(dialogId, arguments); } } }); return builder.create(); } @Override public void onCancel(DialogInterface dialog) { Log.d(TAG, "onCancel: called"); if (mDialogEvents != null){ int dialogId = getArguments().getInt(DIALOG_ID); mDialogEvents.onDialogCancelled(dialogId); } } }
[ "cknecht87@gmail.com" ]
cknecht87@gmail.com
2c12d2e376cc2374f621ea4c853ef094047810dd
7ab398058a931ade5be64e474643127e1c5f72fe
/精灵之泉/src/main/java/com/sxbwstxpay/util/StringUtil.java
c13c5d29f6a6f5c2237ab03b7dd417d40f8fe8e6
[]
no_license
liuzgAs/JingLingZhiQuan
a7e4cadaddd5f799ea347729c771d1c9be6492b0
89d365cf1f2b653c3f3e9630e0d140d230ba0f6f
refs/heads/master
2020-03-11T01:05:53.682687
2019-04-19T11:38:56
2019-04-19T11:38:56
129,681,484
0
0
null
null
null
null
UTF-8
Java
false
false
4,704
java
package com.sxbwstxpay.util; import android.text.TextUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by zjb on 2016/4/6. */ public class StringUtil { /** * 验证手机格式 */ public static boolean isMobileNO(String mobiles) { /* 移动:134、135、136、137、138、139、150、151、157(TD)、158、159、187、188 联通:130、131、132、152、155、156、185、186 电信:133、153、180、189、(1349卫通) 总结起来就是第一位必定为1,第二位必定为3或5或8,其他位置的可以为0-9 */ String telRegex = "[1][0123456789]\\d{9}";//"[1]"代表第1位为数字1,"[358]"代表第二位可以为3、5、8中的一个,"\\d{9}"代表后面是可以是0~9的数字,有9位。 if (TextUtils.isEmpty(mobiles)) { return false; } else { return mobiles.matches(telRegex); } } /** * 密码必须大于6位,且由字母及数字组合 * * @param password * @return */ public static boolean isPassword(String password) { String pass = "^(?=.*?[a-zA-Z])(?=.*?[0-9])[a-zA-Z0-9]{6,}$"; if (TextUtils.isEmpty(password)) { return false; } else { return password.matches(pass); } } /** * 验证邮箱 * * @param email * @return */ public static boolean checkEmail(String email) { boolean flag = false; try { String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; Pattern regex = Pattern.compile(check); Matcher matcher = regex.matcher(email); flag = matcher.matches(); } catch (Exception e) { flag = false; } return flag; } /** * 验证合法字符 * * @return */ public static boolean checkCharacter(String character) { boolean flag = false; try { String check = "[a-zA-Z0-9_]{4,16}"; Pattern regex = Pattern.compile(check); Matcher matcher = regex.matcher(character); flag = matcher.matches(); } catch (Exception e) { flag = false; } return flag; } public static boolean isCarID(String carId) { String telRegex = "[\\u4e00-\\u9fa5|WJ]{1}[A-Z0-9]{6}"; if (TextUtils.isEmpty(carId)) { return false; } else { return carId.matches(telRegex); } } private static Pattern p = Pattern.compile("[\u4e00-\u9fa5]*"); /** * 验证姓名 */ public static boolean checkChineseName(String name) { boolean flag = false; try { Matcher matcher = p.matcher(name); flag = matcher.matches(); if (name.length() < 2 || name.length() > 15) { flag = false; } } catch (Exception e) { flag = false; } return flag; } /** * 提取出城市或者县 * * @param city * @param district * @return */ public static String extractLocation(final String city, final String district) { return district.contains("县") ? district.substring(0, district.length() - 1) : city.substring(0, city.length() - 1); } private static Pattern pattern = Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$"); // 判断小数点后2位的数字的正则表达式 //金额验证 public static boolean isAmount(String str) { Matcher match = pattern.matcher(str); if (match.matches() == false) { return false; } else { return true; } } /** * des: 秒数转换时分秒 * author: ZhangJieBo * date: 2017/9/26 0026 下午 8:08 */ public static String TimeFormat(int progress) { int hour = progress / 3600; int min = progress % 3600 / 60; int sec = progress % 60; //设置整数的输出格式: %02d d代表int 2代码位数 0代表位数不够时前面补0 String time = String.format("%02d", hour) + ":" + String.format("%02d", min) + ":" + String.format("%02d", sec); return time; } /** * des: 隐藏电话号码 * author: ZhangJieBo * date: 2017/10/19 0019 下午 2:05 */ public static String hidePhone(String phone) { String substring01 = phone.substring(0, 3); String substring02 = phone.substring(7, phone.length()); return substring01 + "****" + substring02; } }
[ "530092772@qq.com" ]
530092772@qq.com
773a00e876d23f2473bfc2a25e0a59ce13440514
5aa039cec6ee2303b39968b13b302e3051c95584
/src/lesson16/CloneTest3.java
6a257c5de22336265a1492966db2e00e5065ab93
[]
no_license
JavaZhikun/JavaSE
56940e248c773f05cea07ac3f4915998c8598213
613f12ffc868452dc022010f245386c24ee4f62d
refs/heads/master
2020-05-17T16:02:31.583721
2014-11-11T09:03:51
2014-11-11T09:03:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,419
java
package lesson16; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; public class CloneTest3 { public static void main(String[] args) throws Exception { Teacher3 t = new Teacher3(); t.setAge(40); t.setName("teacher zhang"); Student3 s1 = new Student3(); s1.setAge(20); s1.setName("zhangsan"); s1.setTeacher(t); Student3 s2 = (Student3)s1.deepCopy(); System.out.println(s2.getAge()); System.out.println(s2.getName()); System.out.println("-------------------------"); System.out.println(s2.getTeacher().getAge()); System.out.println(s2.getTeacher().getName()); s2.getTeacher().setAge(50); s2.getTeacher().setName("Teacher Li"); System.out.println(s1.getTeacher().getAge()); System.out.println(s1.getTeacher().getName()); } } class Teacher3 implements Serializable { private int age; private String name; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } } class Student3 implements Serializable { private int age; private String name; private Teacher3 teacher; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Teacher3 getTeacher() { return teacher; } public void setTeacher(Teacher3 teacher) { this.teacher = teacher; } public Object deepCopy() throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(this); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis); return ois.readObject(); } }
[ "972663246@qq.com" ]
972663246@qq.com
2649f65de9dcd33096f85fce95a458d0609f3eca
841d33f62317d71c518593f4489561de56e71bf1
/Assignment_2/src/datamanager/dto/DToTest.java
4567b8b8ca694f220bacf4cef0c18d456de3925b
[]
no_license
angieboks/PaF-Assignment-2
50a3926d83acbcac457bc6b29f340d5e1aa148e0
d5a36822de629a678e013d02c2326b4760e98592
refs/heads/master
2021-01-20T10:38:32.847749
2014-12-27T22:58:55
2014-12-27T22:58:55
null
0
0
null
null
null
null
IBM852
Java
false
false
24,197
java
package datamanager.dto; import java.io.File; import java.util.ArrayList; import domain.*; public class DToTest { public static void main(String[] args) { DTOFacade facade = new DTOFacade(); //Patterns //Creational - scopeClass Pattern factoryMethod = new Pattern("Factory", true, "The factory class will deal with the problem of creating object without specifiying the exact class"); //Structural - scopeClass Pattern adapterClass = new Pattern("Adapter(class)", true, "This pattern uses multiple polymophic interfaces to implementing or inheriting both the interface that is expected and the interface that is pre-existing"); //Behavioral - scopeClass Pattern interpreter = new Pattern("Interpreter", true, "This pattern specifies how to evaluate sentences in a language"); Pattern templateMethod = new Pattern("TemplateMethod", true, "This pattern defines the program skeleton of an algorithm in a method"); //Creational - scopeObject Pattern abstractFactory = new Pattern("AbstractFactory", true, "This pattern provides a way to encapsulate a group of individual factories that have a common theme without specifiying their concrete classes"); Pattern builder = new Pattern("Builder", true, "This intention of this patern is to find a solution to the telescoping constructor anti-pattern"); Pattern prototype = new Pattern("Prototype", true, "This pattern is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects"); Pattern singleton = new Pattern("Singleton", true, "This pattern restricts the instantiation of a class to one object"); //Structual - scopeObject Pattern adapterObject = new Pattern("Adapter(object)", true, "This pattern constains an instance of the class it wraps, the adapter makes class to the instance of the wrapped object"); Pattern bridge = new Pattern("Bridge", true, "This pattern is eant to decouple an abstraction from its implementation so that the two can vary independently"); Pattern composite = new Pattern("Composite", true, "This pattern describes that a group of objects is to be treated in the same way as a single intance of an object"); Pattern decorator = new Pattern("Decorator" , true, "This pattern allows behavior to be added to an individual object, either statically or dunamically, without affecting the behavior of other objects from the same class"); Pattern fašade = new Pattern("Facade", true, "The facade class wich you use in this pattern provides a simplified interface to a larger body of code (package)"); Pattern flyweight = new Pattern("Flyweight", true, "This pattern has an object that minimizes memory use by sharing as much data as possible with other similar objects"); Pattern proxy = new Pattern("Proxy", true, "This pattern has a class functioning as an interface to something else"); //Behavioral - scopeObject Pattern chain = new Pattern("Chain of Responsibility", true, " This pattern constists of a source of command objects and a series of processing objects"); Pattern command = new Pattern("Command", true, "This pattern has an object that is used to represent and encapsulate all the information needed to call a method at a later time"); Pattern iterator = new Pattern("Iterator", true, "This pattern is used to traverse a container and acces the container's elements"); Pattern mediator = new Pattern("Mediator", true, "This pattern defines an object that encapsulates how a set of objects interact"); Pattern memento = new Pattern("Memento", true, "This pattern provides the ability to restore an oject to its previous state"); Pattern observer = new Pattern("Observer", true, "This pattern has an object called the subject, ti maintains a list of its dependents, called observerrs, and notifies them automatically of any state changes, usually by calling one of their methods" ); Pattern state = new Pattern("State", true, "This pattern is used to encapsulate varying behaviour for the same routine based on an object's state object"); Pattern strategy = new Pattern("Strategy", true, "This pattern enables an algorithm's behavior t be selected at runtime"); Pattern visitor = new Pattern("Visitor", true,"This pattern is a way of separating an algorithm from an objects structure on which it operates"); //Diagram File factoryMethod_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Factorymethod.xml"); factoryMethod.setDiagram(factoryMethod_File); File adapterClass_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Adapter(class).xml"); adapterClass.setDiagram(adapterClass_File); File interpreter_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Interpreter.xml"); interpreter.setDiagram(interpreter_File); File templateMethod_File = new File("C:\\apache-tomcat-8.0.15\\bin\\TemplateMethod.xml"); templateMethod.setDiagram(templateMethod_File); File abstractFactory_File = new File("C:\\apache-tomcat-8.0.15\\bin\\AbstractFactory.xml"); abstractFactory.setDiagram(abstractFactory_File); File builder_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Builder.xml"); builder.setDiagram(builder_File); File prototype_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Prototype.xml"); prototype.setDiagram(prototype_File); File singleton_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Singleton.xml"); singleton.setDiagram(singleton_File); File adapterObject_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Adapter(object).xml"); adapterObject.setDiagram(adapterObject_File); File bridge_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Bridge.xml"); bridge.setDiagram(bridge_File); File composite_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Composite.xml"); composite.setDiagram(composite_File); File decorator_file = new File("C:\\apache-tomcat-8.0.15\\bin\\Decorator.xml"); decorator.setDiagram(decorator_file); File fašade_file = new File("C:\\apache-tomcat-8.0.15\\bin\\Fašade.xml"); fašade.setDiagram(fašade_file); File flyweight_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Flyweight.xml"); flyweight.setDiagram(flyweight_File); File proxy_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Proxy.xml"); proxy.setDiagram(proxy_File); File chain_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Chain.xml"); chain.setDiagram(chain_File); File command_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Command.xml"); command.setDiagram(command_File); File iterator_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Iterator.xml"); iterator.setDiagram(iterator_File); File mediator_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Mediator.xml"); mediator.setDiagram(mediator_File); File memento_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Memento.xml"); memento.setDiagram(memento_File); File observer_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Observer.xml"); observer.setDiagram(observer_File); File state_File = new File("C:\\apache-tomcat-8.0.15\\bin\\State.xml"); state.setDiagram(state_File); File strategy_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Strategy.xml"); strategy.setDiagram(strategy_File); File visitor_File = new File("C:\\apache-tomcat-8.0.15\\bin\\Visitor.xml"); visitor.setDiagram(visitor_File); //AKA factoryMethod.setAka("FM"); adapterClass.setAka("AC"); interpreter.setAka("IP"); templateMethod.setAka("TM"); abstractFactory.setAka("AF"); builder.setAka("BU"); prototype.setAka("Proto"); singleton.setAka("Single"); adapterObject.setAka("AO"); bridge.setAka("BR"); composite.setAka("CO"); decorator.setAka("DE"); fašade.setAka("Faš"); flyweight.setAka("Fly"); proxy.setAka("Prox"); chain.setAka("Chain"); command.setAka("CO"); iterator.setAka("IT"); mediator.setAka("MED"); memento.setAka("MEM"); observer.setAka("OB"); state.setAka("ST"); strategy.setAka("STRAT"); visitor.setAka("VIS"); //Pros factoryMethod.setPros("Pro1"); adapterClass.setPros("Pro1"); interpreter.setPros("Pro1"); templateMethod.setPros("Pro1"); abstractFactory.setPros("Pro1"); builder.setPros("Pro1"); prototype.setPros("Pro1"); singleton.setPros("Pro1"); adapterObject.setPros("Pro1"); bridge.setPros("Pro1"); composite.setPros("Pro1"); decorator.setPros("Pro1"); fašade.setPros("Pro1"); flyweight.setPros("Pro1"); proxy.setPros("Pro1"); chain.setPros("Pro1"); command.setPros("Pro1"); iterator.setPros("Pro1"); mediator.setPros("Pro1"); memento.setPros("Pro1"); observer.setPros("Pro1"); state.setPros("Pro1"); strategy.setPros("Pro1"); visitor.setPros("Pro1"); //Cons factoryMethod.addCon("Con1"); adapterClass.addCon("Con1"); interpreter.addCon("Con1"); templateMethod.addCon("Con1"); abstractFactory.addCon("Con1"); builder.addCon("Con1"); prototype.addCon("Con1"); singleton.addCon("Con1"); adapterObject.addCon("Con1"); bridge.addCon("Con1"); composite.addCon("Con1"); decorator.addCon("Con1"); fašade.addCon("Con1"); flyweight.addCon("Con1"); proxy.addCon("Con1"); chain.addCon("Con1"); command.addCon("Con1"); iterator.addCon("Con1"); mediator.addCon("Con1"); memento.addCon("Con1"); observer.addCon("Con1"); state.addCon("Con1"); strategy.addCon("Con1"); visitor.addCon("Con1"); //Category //Purpose Purpose creational = new Purpose("Creational"); Purpose structural = new Purpose("Structural"); Purpose behavioral = new Purpose("Behavioral"); //Scope Scope scopeClass = new Scope("Class"); Scope scopeObject = new Scope("Object"); factoryMethod.addCategory(scopeClass); factoryMethod.addCategory(creational); adapterClass.addCategory(structural); adapterClass.addCategory(scopeClass); interpreter.addCategory(scopeClass); interpreter.addCategory(behavioral); templateMethod.addCategory(scopeClass); templateMethod.addCategory(behavioral); abstractFactory.addCategory(scopeObject); abstractFactory.addCategory(creational); builder.addCategory(scopeObject); builder.addCategory(creational); prototype.addCategory(scopeObject); prototype.addCategory(creational); singleton.addCategory(scopeObject); singleton.addCategory(creational); adapterObject.addCategory(scopeObject); adapterObject.addCategory(structural); bridge.addCategory(scopeObject); bridge.addCategory(structural); composite.addCategory(scopeObject); composite.addCategory(structural); decorator.addCategory(scopeObject); decorator.addCategory(structural); fašade.addCategory(scopeObject); fašade.addCategory(structural); flyweight.addCategory(scopeObject); flyweight.addCategory(structural); proxy.addCategory(scopeObject); proxy.addCategory(structural); chain.addCategory(scopeObject); chain.addCategory(behavioral); command.addCategory(scopeObject); command.addCategory(behavioral); iterator.addCategory(scopeObject); iterator.addCategory(behavioral); mediator.addCategory(scopeObject); mediator.addCategory(behavioral); memento.addCategory(scopeObject); memento.addCategory(behavioral); observer.addCategory(scopeObject); observer.addCategory(behavioral); state.addCategory(scopeObject); state.addCategory(behavioral); strategy.addCategory(scopeObject); strategy.addCategory(behavioral); visitor.addCategory(scopeObject); visitor.addCategory(behavioral); //Participants // ----------------- moet nog--------------------------------------------------------------------------- //Forces Force factoryMethod_Force = new Force("Force test"); Force adapterClass_Force = new Force("Force test"); Force interpreter_Force = new Force("Force test"); Force templateMethod_Force = new Force("Force test"); Force abstractFactory_Force = new Force("Force test"); Force builder_Force = new Force("Force test"); Force prototype_Force = new Force("Force test"); Force singleton_Force = new Force("Force test"); Force adapterObject_Force = new Force("Force test"); Force bridge_Force = new Force("Force test"); Force composite_Force = new Force("Force test"); Force decorator_Force = new Force("Force test"); Force fašade_Force = new Force("Force test"); Force flyweight_Force = new Force("Force test"); Force proxy_Force = new Force("Force test"); Force chain_Force = new Force("Force test"); Force command_Force = new Force("Force test"); Force iterator_Force = new Force("Force test"); Force mediator_Force = new Force("Force test"); Force memento_Force = new Force("Force test"); Force observer_Force = new Force("Force test"); Force state_Force = new Force("Force test"); Force strategy_Force = new Force("Force test"); Force visitor_Force = new Force("Force test"); //Problem Problem factoryMethod_Problem = new Problem("Problem test"); Problem adapterClass_Problem = new Problem("Problem test"); Problem interpreter_Problem = new Problem("Problem test"); Problem templateMethod_Problem = new Problem("Problem test"); Problem abstractFactory_Problem = new Problem("Problem test"); Problem builder_Problem = new Problem("Problem test"); Problem prototype_Problem = new Problem("Problem test"); Problem singleton_Problem = new Problem("Problem test"); Problem adapterObject_Problem = new Problem("Problem test"); Problem bridge_Problem = new Problem("Problem test"); Problem composite_Problem = new Problem("Problem test"); Problem decorator_Problem = new Problem("Problem test"); Problem fašade_Problem = new Problem("Problem test"); Problem flyweight_Problem = new Problem("Problem test"); Problem proxy_Problem = new Problem("Problem test"); Problem chain_Problem = new Problem("Problem test"); Problem command_Problem = new Problem("Problem test"); Problem iterator_Problem = new Problem("Problem test"); Problem mediator_Problem = new Problem("Problem test"); Problem memento_Problem = new Problem("Problem test"); Problem observer_Problem = new Problem("Problem test"); Problem state_Problem = new Problem("Problem test"); Problem strategy_Problem = new Problem("Problem test"); Problem visitor_Problem = new Problem("Problem test"); factoryMethod_Problem.addSolution(factoryMethod); adapterClass_Problem.addSolution(adapterClass); interpreter_Problem.addSolution(interpreter); templateMethod_Problem.addSolution(templateMethod); abstractFactory_Problem.addSolution(abstractFactory); builder_Problem.addSolution(builder); prototype_Problem.addSolution(prototype); singleton_Problem.addSolution(singleton); adapterObject_Problem.addSolution(adapterObject); bridge_Problem.addSolution(bridge); composite_Problem.addSolution(composite); decorator_Problem.addSolution(decorator); fašade_Problem.addSolution(fašade); flyweight_Problem.addSolution(flyweight); proxy_Problem.addSolution(proxy); chain_Problem.addSolution(chain); command_Problem.addSolution(command); iterator_Problem.addSolution(iterator); mediator_Problem.addSolution(mediator); memento_Problem.addSolution(memento); observer_Problem.addSolution(observer); state_Problem.addSolution(state); strategy_Problem.addSolution(strategy); visitor_Problem.addSolution(visitor); factoryMethod_Problem.addForce(factoryMethod_Force); adapterClass_Problem.addForce(adapterClass_Force); interpreter_Problem.addForce(interpreter_Force); templateMethod_Problem.addForce(templateMethod_Force) ; abstractFactory_Problem.addForce(abstractFactory_Force); builder_Problem.addForce(builder_Force); prototype_Problem.addForce(prototype_Force) ; singleton_Problem.addForce(singleton_Force) ; adapterObject_Problem.addForce(adapterObject_Force) ; bridge_Problem.addForce(bridge_Force) ; composite_Problem.addForce(composite_Force) ; decorator_Problem.addForce(decorator_Force) ; fašade_Problem.addForce(fašade_Force) ; flyweight_Problem.addForce(flyweight_Force) ; proxy_Problem.addForce(proxy_Force) ; chain_Problem.addForce(chain_Force) ; command_Problem.addForce(command_Force) ; iterator_Problem.addForce(iterator_Force) ; mediator_Problem.addForce(mediator_Force) ; memento_Problem.addForce(memento_Force) ; observer_Problem.addForce(observer_Force) ; state_Problem.addForce(state_Force) ; strategy_Problem.addForce(strategy_Force) ; visitor_Problem.addForce(visitor_Force) ; //Context Context factoryMethod_Context = new Context("description" , "example"); Context adapterClass_Context = new Context("description" , "example"); Context interpreter_Context = new Context("description" , "example"); Context templateMethod_Context = new Context("description" , "example"); Context abstractFactory_Context = new Context("description" , "example"); Context builder_Context = new Context("description" , "example"); Context prototype_Context = new Context("description" , "example"); Context singleton_Context = new Context("description" , "example"); Context adapterObject_Context = new Context("description" , "example"); Context bridge_Context = new Context("description" , "example"); Context composite_Context = new Context("description" , "example"); Context decorator_Context = new Context("description" , "example"); Context fašade_Context = new Context("description" , "example"); Context flyweight_Context = new Context("description" , "example"); Context proxy_Context = new Context("description" , "example"); Context chain_Context = new Context("description" , "example"); Context command_Context = new Context("description" , "example"); Context iterator_Context = new Context("description" , "example"); Context mediator_Context = new Context("description" , "example"); Context memento_Context = new Context("description" , "example"); Context observer_Context = new Context("description" , "example"); Context state_Context = new Context("description" , "example"); Context strategy_Context = new Context("description" , "example"); Context visitor_Context = new Context("description" , "example"); builder.addContext(builder_Context); prototype.addContext(prototype_Context); singleton.addContext(singleton_Context); adapterObject.addContext(adapterObject_Context); bridge.addContext(bridge_Context); composite.addContext(composite_Context); decorator.addContext(decorator_Context); fašade.addContext(fašade_Context); flyweight.addContext(flyweight_Context); proxy.addContext(proxy_Context); chain.addContext(chain_Context); command.addContext(command_Context); iterator.addContext(iterator_Context); mediator.addContext(mediator_Context); memento.addContext(memento_Context); observer.addContext(observer_Context); state.addContext(state_Context); strategy.addContext(strategy_Context); visitor.addContext(visitor_Context); ArrayList<Pattern> patterns = new ArrayList<Pattern>(); patterns.add(factoryMethod); patterns.add(adapterClass); patterns.add(interpreter); patterns.add(templateMethod); patterns.add(abstractFactory); patterns.add(builder); patterns.add(prototype); patterns.add(singleton); patterns.add(adapterObject); patterns.add(bridge); patterns.add(composite); patterns.add(decorator); patterns.add(fašade); patterns.add(flyweight); patterns.add(proxy); patterns.add(chain); patterns.add(command); patterns.add(iterator); patterns.add(mediator); patterns.add(memento); patterns.add(observer); patterns.add(state); patterns.add(strategy); patterns.add(visitor); ArrayList<Context> allContexts = new ArrayList<Context>(); allContexts.add(factoryMethod_Context); allContexts.add(adapterClass_Context); allContexts.add(interpreter_Context); allContexts.add(templateMethod_Context); allContexts.add(abstractFactory_Context); allContexts.add(builder_Context); allContexts.add(prototype_Context); allContexts.add(singleton_Context); allContexts.add(adapterObject_Context); allContexts.add(bridge_Context); allContexts.add(composite_Context); allContexts.add(decorator_Context); allContexts.add(fašade_Context); allContexts.add(flyweight_Context); allContexts.add(proxy_Context); allContexts.add(chain_Context); allContexts.add(command_Context); allContexts.add(iterator_Context); allContexts.add(mediator_Context); allContexts.add(memento_Context); allContexts.add(observer_Context); allContexts.add(state_Context); allContexts.add(strategy_Context); allContexts.add(visitor_Context); ArrayList<Category> categories = new ArrayList<Category>(); categories.add(scopeObject); categories.add(scopeClass); categories.add(behavioral); categories.add(creational); categories.add(structural); facade.writeAllPatternNames(patterns); facade.writeAllContexts(allContexts); facade.writeAllCategories(categories); String path = null; File file = null; for(int i = 0; i < patterns.size(); i++){ facade.createDocument(); Pattern patternTemp = patterns.get(i); path = patternTemp.getDiagram().getPath(); Object obj = (Object) patternTemp; facade.writeDocument(obj, "pattern"); ArrayList<Category> categoryTemp = new ArrayList<Category>(); categoryTemp = patternTemp.getCategories(); for(int j = 0; j < categoryTemp.size(); j++){ obj = (Object) categoryTemp.get(j); if(categoryTemp.get(j).getClass().getName() == "domain.Scope"){ facade.writeDocument(obj, "scope"); } else{ facade.writeDocument(obj, "purpose"); } } ArrayList<Context> contextTemp = new ArrayList<Context>(); contextTemp = patternTemp.getContexts(); for(int k = 0; k < contextTemp.size(); k++){ obj = (Object) contextTemp.get(k); facade.writeDocument(obj, "context"); } ArrayList<Participant> participantTemp = new ArrayList<Participant>(); participantTemp = patternTemp.getParticipants(); for(int l = 0; l< participantTemp.size(); l++){ obj = (Object) participantTemp.get(l); facade.writeDocument(obj, "participant"); } ArrayList<Problem> allProblems = new ArrayList<Problem>(); ArrayList<Solution> solutionTemp = new ArrayList<Solution>(); allProblems = Problem.getAllProblems(); for(int m = 0; m < allProblems.size(); m++){ Problem problemTemp = allProblems.get(m); solutionTemp = problemTemp.getSolutions(); for(int n = 0; n < solutionTemp.size(); n++){ if(solutionTemp.get(n) == patternTemp){ obj = (Object) problemTemp; facade.writeDocument(obj, "problem"); ArrayList<Force> forceTemp = new ArrayList<Force>(); forceTemp = problemTemp.getForces(); for(int o = 0; o < forceTemp.size(); o++){ obj = (Object) forceTemp.get(o); facade.writeDocument(obj, "force"); } } } } file = new File(path); facade.finishDocument(file); } } }
[ "ffw8e@hotmail.com" ]
ffw8e@hotmail.com
afff5b33bb9b71ef18692eb944f0fabed3fbbc91
44e536bb6266fa3f9e22aba8630d812f56872afc
/crs-hsys-client-core/src/main/java/io/crs/hsys/client/core/filter/roomtype/RoomTypeFilterPresenter.java
030518c41063501b823c7014ed7aed3eae96a1ef
[]
no_license
LetsCloud/crs-hsys
b4c1aa83dbbe5c998b49e4a740bd24cf68732132
4fed6d998703ba0a88abf0e4f638f724937e2744
refs/heads/master
2022-12-25T22:43:03.360324
2020-03-21T22:55:52
2020-03-21T22:55:52
153,274,374
0
1
null
2022-12-16T15:02:48
2018-10-16T11:29:24
Java
UTF-8
Java
false
false
1,572
java
/** * */ package io.crs.hsys.client.core.filter.roomtype; import java.util.logging.Logger; import javax.inject.Inject; import com.google.web.bindery.event.shared.EventBus; import com.gwtplatform.mvp.client.HasUiHandlers; import io.crs.hsys.shared.cnst.InventoryType; import io.crs.hsys.client.core.datasource.HotelDataSource2; import io.crs.hsys.client.core.filter.AbstractFilterUiHandlers; import io.crs.hsys.client.core.filter.hotelchild.AbstractHotelChildFilterPresenter; import io.crs.hsys.client.core.security.CurrentUser; /** * @author robi * */ public class RoomTypeFilterPresenter extends AbstractHotelChildFilterPresenter<RoomTypeFilterPresenter.MyView> { private static Logger logger = Logger.getLogger(RoomTypeFilterPresenter.class.getName()); public interface MyView extends AbstractHotelChildFilterPresenter.MyView, HasUiHandlers<AbstractFilterUiHandlers> { InventoryType getSelectedInventoryType(); } @Inject RoomTypeFilterPresenter(EventBus eventBus, MyView view, CurrentUser currentUser, HotelDataSource2 hotelDataSource) { super(eventBus, view, currentUser, hotelDataSource); logger.info("RoomTypeFilterPresenter()"); getView().setUiHandlers(this); } @Override public void onReveal() { super.onReveal(); logger.info("RoomTypeFilterPresenter().onReveal()"); } public Boolean isOnlyActive() { return getView().isOnlyActive(); } public InventoryType getSelectedInventoryType() { return getView().getSelectedInventoryType(); } @Override public void filterChange() { // TODO Auto-generated method stub } }
[ "csernikr@gmail.com" ]
csernikr@gmail.com
77d2e4b7f5799a999d82cee62bccb78e35d94c49
d7d97913ba4ffd375192b20edcb03ca8917aa9a2
/postroom-core/src/main/java/com/lunatech/postroom/TransformedMapping.java
bd3028de3e0362d3271249f55d57f53d0ba7cc7a
[ "Apache-2.0" ]
permissive
lunatech-labs/lunatech-postroom
ca2174448f2355e7ccea513e90930d02af793652
76b75ea8e8639b4e4b7d189bf3f9c9440e519855
refs/heads/main
2023-02-10T14:08:22.502489
2021-01-11T13:49:18
2021-01-11T13:49:18
320,372,978
3
0
null
2021-01-08T14:10:45
2020-12-10T19:42:28
Java
UTF-8
Java
false
false
2,093
java
package com.lunatech.postroom; import io.vavr.control.Either; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; public class TransformedMapping<T, U> implements Mapping<U> { private final Mapping<T> original; private final Function<T, ValidationResult<U>> map; private final Function<U, T> contramap; private final List<Constraint<U>> constraints; TransformedMapping(Mapping<T> original, Function<T, ValidationResult<U>> map, Function<U, T> contramap, List<Constraint<U>> constraints) { this.original = original; this.map = map; this.contramap = contramap; this.constraints = constraints; } @Override public Either<List<FormError>, U> bind(Map<String, String> data) { return original.bind(data).flatMap(t -> map.apply(t).fold( errors -> Either.left(errors.stream().map(error -> new FormError(key(), error)).collect(Collectors.toList())), boundValue -> Constraints.applyConstraints(constraints, boundValue) .mapLeft(errors -> errors.stream().map(error -> new FormError(key(), error)).collect( Collectors.toList())))); } @Override public Map<String, String> unbind(U value) { return original.unbind(contramap.apply(value)); } @Override public String key() { return original.key(); } @Override public Mapping<U> withPrefix(String prefix) { return new TransformedMapping<>(original.withPrefix(prefix), map, contramap, constraints); } @Override public Mapping<U> verifying(Collection<Constraint<U>> constraints) { List<Constraint<U>> allConstraints = new ArrayList<>(this.constraints.size() + constraints.size()); allConstraints.addAll(this.constraints); allConstraints.addAll(constraints); return new TransformedMapping<>(original, map, contramap, allConstraints); } }
[ "erik@eamelink.net" ]
erik@eamelink.net
136299c6eb8dcfaa9f1098e4b8294f1f4c597414
dc27750dc7c74a6438f72066c0742fb9b8b1b1f6
/rober-runtime/src/main/java/group/rober/runtime/lang/RoberException.java
31ee0db9e808720bc8fe4b314a27ee3c8dbb8916
[]
no_license
nic-luo/rober-cabin-module
c6c6b2b70c25e89c8a4e340bfd98acb04c409f77
94bd0cd4a041ddfb6df25bc97938b599934fab52
refs/heads/master
2020-03-18T06:19:56.601744
2018-05-23T02:18:40
2018-05-23T02:18:42
134,389,224
0
1
null
null
null
null
UTF-8
Java
false
false
1,813
java
package group.rober.runtime.lang; import java.text.MessageFormat; /** * 定义格式化之后的RuntimeException * * @author tisir<yangsong158@qq.com> * @date 2017年2月18日 */ public class RoberException extends RuntimeException { private static final long serialVersionUID = -2049467256019982005L; private String code = "0"; public RoberException() { } public String getCode() { return code; } public void setCode(String code) { this.code = code; } /** * @param message */ public RoberException(String message) { super(message); } /** * * @param messageFormat * @param objects */ public RoberException(String messageFormat, Object ...objects) { this(MessageFormat.format(messageFormat, objects)); } /** * * @param messageFormat * @param objects */ public RoberException(Throwable cause, String messageFormat, Object ...objects) { this(MessageFormat.format(messageFormat, objects),cause); } /** * @param cause * @param message */ public RoberException(Throwable cause, String message) { super(message, cause); } /** * @param cause */ public RoberException(Throwable cause) { super(cause); } /** * @param message * @param cause */ public RoberException(String message, Throwable cause) { super(message, cause); } /** * @param message * @param cause * @param enableSuppression * @param writableStackTrace */ public RoberException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } }
[ "xmluo@amarsoft.com" ]
xmluo@amarsoft.com
8ffe9dfee131655a4ce24cef41904bd680414e38
3b21b7014df2de3717eb5e6f5eba8c4b9600b6b6
/app/src/main/java/com/example/chukc/pullzoomview/PullToZoomRecyclerActivity.java
2cb4fd15785eb65184d68ffae723d112cf738ee5
[]
no_license
34sir/PullZoomView
ec3b5448b3758703eb1fe1416489d50b8a2fb1e8
f77101582c4f2697619202eb34d1bae6f2231aae
refs/heads/master
2016-09-12T22:49:05.428660
2016-05-11T05:28:09
2016-05-11T05:28:09
58,516,618
0
0
null
null
null
null
UTF-8
Java
false
false
6,399
java
package com.example.chukc.pullzoomview; import android.content.Context; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.DisplayMetrics; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.TextView; /** * Created by manishdeora on 13/05/15. */ public class PullToZoomRecyclerActivity extends ActionBarActivity { private PullToZoomRecyclerViewEx listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pull_to_zoom_recycler_view); listView = (PullToZoomRecyclerViewEx) findViewById(R.id.recyclerview); final RecyclerViewHeaderAdapter mAdapter = new RecyclerAdapterCustom(this); final GridLayoutManager manager = new GridLayoutManager(this, 2); manager.setOrientation(GridLayoutManager.VERTICAL); manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { return mAdapter.getItemViewType(position) == RecyclerViewHeaderAdapter.INT_TYPE_HEADER ? 2 : 1; } }); listView.setAdapterAndLayoutManager(mAdapter, manager); DisplayMetrics localDisplayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics); int mScreenHeight = localDisplayMetrics.heightPixels; int mScreenWidth = localDisplayMetrics.widthPixels; AbsListView.LayoutParams localObject = new AbsListView.LayoutParams(mScreenWidth, (int) (9.0F * (mScreenWidth / 16.0F))); listView.setHeaderLayoutParams(localObject); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.list_view, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { finish(); return true; } else if (id == R.id.action_normal) { listView.setParallax(false); return true; } else if (id == R.id.action_parallax) { listView.setParallax(true); return true; } else if (id == R.id.action_show_head) { listView.setHideHeader(false); return true; } else if (id == R.id.action_hide_head) { listView.setHideHeader(true); return true; } else if (id == R.id.action_disable_zoom) { listView.setZoomEnabled(false); return true; } else if (id == R.id.action_enable_zoom) { listView.setZoomEnabled(true); return true; } return super.onOptionsItemSelected(item); } public class RecyclerAdapterCustom extends RecyclerViewHeaderAdapter<ViewHolderRecyclerPullToZoom> { final String[] adapterData = new String[]{"Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "DDMS", "Android Studio", "Fragment", "Loader", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "DDMS", "Android Studio", "Fragment", "Loader", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "DDMS", "Android Studio", "Fragment", "Loader", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "DDMS", "Android Studio", "Fragment", "Loader", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "DDMS", "Android Studio", "Fragment", "Loader", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient", "Activity", "Service", "Content Provider", "Intent", "BroadcastReceiver", "ADT", "Sqlite3", "HttpClient"}; public RecyclerAdapterCustom(Context context) { super(context); } @Override public int getCount() { return adapterData.length; } @Override public ViewHolderRecyclerPullToZoom onCreateContentView(ViewGroup parent, int viewType) { return new ViewHolderRecyclerPullToZoom(new TextView(getContext())); } @Override public void onBindView(ViewHolderRecyclerPullToZoom view, int position) { view.mtextview.setText(adapterData[position]); // final StaggeredGridLayoutManager.LayoutParams lp = // (StaggeredGridLayoutManager.LayoutParams) view.mtextview.getLayoutParams(); //// // lp.span = span; // lp.height = size; // itemView.setLayoutParams(lp); } } public static class ViewHolderRecyclerPullToZoom extends RecyclerView.ViewHolder { TextView mtextview; public ViewHolderRecyclerPullToZoom(View itemView) { super(itemView); mtextview = (TextView) itemView; } } }
[ "ckc34520@126.com" ]
ckc34520@126.com
790e2a1746d1e7b037999e3f3055689997bedc9f
780a2ec747300e97b1556b5ca9540c90dbc12242
/MCP/temp/src/minecraft/net/minecraft/src/CallableType2.java
4e5499ff887c6e33d0d6b4ecf487d6e403625173
[]
no_license
CatRabbit499/MCTC
76015d6f9e3f43e8b3f71fe8951b35ab38f86828
fe3d0c8525f44ef1b8aac8ffd0a45feacb8f9f59
refs/heads/master
2021-01-17T18:03:40.825771
2012-10-07T17:58:17
2012-10-07T17:58:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
567
java
package net.minecraft.src; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; import java.util.concurrent.Callable; import net.minecraft.client.Minecraft; @SideOnly(Side.CLIENT) public class CallableType2 implements Callable { // $FF: synthetic field final Minecraft field_74503_a; public CallableType2(Minecraft p_i3007_1_) { this.field_74503_a = p_i3007_1_; } public String func_74502_a() { return "Client"; } // $FF: synthetic method public Object call() { return this.func_74502_a(); } }
[ "Toxicgaming@outlook.com" ]
Toxicgaming@outlook.com
ff57c3018c85b3a6203aa8661f6fe1bd811bd38e
c8e934b6f99222a10e067a3fab34f39f10f8ea7e
/com/google/gson/internal/bind/DateTypeAdapter.java
32f3ce1335cd8ee03f883ff0890c084c3e8a50a4
[]
no_license
ZPERO/Secret-Dungeon-Finder-Tool
19efef8ebe044d48215cdaeaac6384cf44ee35b9
c3c97e320a81b9073dbb5b99f200e99d8f4b26cc
refs/heads/master
2020-12-19T08:54:26.313637
2020-01-22T23:00:08
2020-01-22T23:00:08
235,683,952
0
0
null
null
null
null
UTF-8
Java
false
false
4,284
java
package com.google.gson.internal.bind; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.internal.JavaVersion; import com.google.gson.internal.PreJava9DateFormatProvider; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; public final class DateTypeAdapter extends TypeAdapter<Date> { public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { public TypeAdapter create(Gson paramAnonymousGson, TypeToken paramAnonymousTypeToken) { if (paramAnonymousTypeToken.getRawType() == Date.class) { return new DateTypeAdapter(); } return null; } }; private final List<DateFormat> dateFormats = new ArrayList(); public DateTypeAdapter() { dateFormats.add(DateFormat.getDateTimeInstance(2, 2, Locale.US)); if (!Locale.getDefault().equals(Locale.US)) { dateFormats.add(DateFormat.getDateTimeInstance(2, 2)); } if (JavaVersion.isJava9OrLater()) { dateFormats.add(PreJava9DateFormatProvider.getUSDateTimeFormat(2, 2)); } } /* Error */ private Date deserializeToDate(String paramString) { // Byte code: // 0: aload_0 // 1: monitorenter // 2: aload_0 // 3: getfield 26 com/google/gson/internal/bind/DateTypeAdapter:dateFormats Ljava/util/List; // 6: invokeinterface 75 1 0 // 11: astore_2 // 12: aload_2 // 13: invokeinterface 80 1 0 // 18: ifeq +23 -> 41 // 21: aload_2 // 22: invokeinterface 84 1 0 // 27: checkcast 34 java/text/DateFormat // 30: astore_3 // 31: aload_3 // 32: aload_1 // 33: invokevirtual 87 java/text/DateFormat:parse (Ljava/lang/String;)Ljava/util/Date; // 36: astore_3 // 37: aload_0 // 38: monitorexit // 39: aload_3 // 40: areturn // 41: aload_1 // 42: new 89 java/text/ParsePosition // 45: dup // 46: iconst_0 // 47: invokespecial 92 java/text/ParsePosition:<init> (I)V // 50: invokestatic 97 com/google/gson/internal/bind/util/ISO8601Utils:parse (Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/util/Date; // 53: astore_2 // 54: aload_0 // 55: monitorexit // 56: aload_2 // 57: areturn // 58: astore_2 // 59: new 99 com/google/gson/JsonSyntaxException // 62: dup // 63: aload_1 // 64: aload_2 // 65: invokespecial 102 com/google/gson/JsonSyntaxException:<init> (Ljava/lang/String;Ljava/lang/Throwable;)V // 68: athrow // 69: astore_1 // 70: aload_0 // 71: monitorexit // 72: aload_1 // 73: athrow // 74: astore_3 // 75: goto -63 -> 12 // Local variable table: // start length slot name signature // 0 78 0 this DateTypeAdapter // 0 78 1 paramString String // 11 46 2 localObject1 Object // 58 7 2 localParseException1 java.text.ParseException // 30 10 3 localObject2 Object // 74 1 3 localParseException2 java.text.ParseException // Exception table: // from to target type // 41 54 58 java/text/ParseException // 2 12 69 java/lang/Throwable // 12 31 69 java/lang/Throwable // 31 37 69 java/lang/Throwable // 41 54 69 java/lang/Throwable // 59 69 69 java/lang/Throwable // 31 37 74 java/text/ParseException } public Date read(JsonReader paramJsonReader) throws IOException { if (paramJsonReader.peek() == JsonToken.NULL) { paramJsonReader.nextNull(); return null; } return deserializeToDate(paramJsonReader.nextString()); } public void write(JsonWriter paramJsonWriter, Date paramDate) throws IOException { if (paramDate == null) {} try { paramJsonWriter.nullValue(); return; } catch (Throwable paramJsonWriter) { throw paramJsonWriter; } paramJsonWriter.value(((DateFormat)dateFormats.get(0)).format(paramDate)); } }
[ "el.luisito217@gmail.com" ]
el.luisito217@gmail.com
c727cd4995e64f00bb023579366ab3b06e9d0450
59d21766b47292fcfe2ad7a36f976ed0d515a98c
/app/src/main/java/chainn/com/wifidetector/wifi/model/SortBy.java
58766dce97b9d8f9f41a7e66919e62e3216ef600
[]
no_license
KristenXu/WiFiDetector
bfbf013c09080318d911a1147fd71c85f8b36550
62a9878a7751917d883ece5bcc84f0f7cb737c5b
refs/heads/master
2021-01-11T00:15:19.007567
2016-10-16T13:01:33
2016-10-16T13:01:33
70,552,515
2
0
null
null
null
null
UTF-8
Java
false
false
2,440
java
package chainn.com.wifidetector.wifi.model; /** * Created by xuchen on 16/10/12. */ import android.support.annotation.NonNull; import org.apache.commons.lang3.builder.CompareToBuilder; import java.util.Comparator; public enum SortBy { STRENGTH(new StrengthComparator()), SSID(new SSIDComparator()), CHANNEL(new ChannelComparator()); private final Comparator<WiFiDetail> comparator; SortBy(@NonNull Comparator<WiFiDetail> comparator) { this.comparator = comparator; } public static SortBy find(int index) { if (index < 0 || index >= values().length) { return STRENGTH; } return values()[index]; } Comparator<WiFiDetail> comparator() { return comparator; } static class StrengthComparator implements Comparator<WiFiDetail> { @Override public int compare(WiFiDetail lhs, WiFiDetail rhs) { return new CompareToBuilder() .append(rhs.getWiFiSignal().getLevel(), lhs.getWiFiSignal().getLevel()) .append(lhs.getSSID().toUpperCase(), rhs.getSSID().toUpperCase()) .append(lhs.getBSSID().toUpperCase(), rhs.getBSSID().toUpperCase()) .toComparison(); } } static class SSIDComparator implements Comparator<WiFiDetail> { @Override public int compare(WiFiDetail lhs, WiFiDetail rhs) { return new CompareToBuilder() .append(lhs.getSSID().toUpperCase(), rhs.getSSID().toUpperCase()) .append(rhs.getWiFiSignal().getLevel(), lhs.getWiFiSignal().getLevel()) .append(lhs.getBSSID().toUpperCase(), rhs.getBSSID().toUpperCase()) .toComparison(); } } static class ChannelComparator implements Comparator<WiFiDetail> { @Override public int compare(WiFiDetail lhs, WiFiDetail rhs) { return new CompareToBuilder() .append(lhs.getWiFiSignal().getPrimaryWiFiChannel().getChannel(), rhs.getWiFiSignal().getPrimaryWiFiChannel().getChannel()) .append(rhs.getWiFiSignal().getLevel(), lhs.getWiFiSignal().getLevel()) .append(lhs.getSSID().toUpperCase(), rhs.getSSID().toUpperCase()) .append(lhs.getBSSID().toUpperCase(), rhs.getBSSID().toUpperCase()) .toComparison(); } } }
[ "xuchen@hecaila.net" ]
xuchen@hecaila.net
80210078f8dae6fb689b0e79fa793c2a3b230e48
1d5f0f3007066d20a184267fbf318e6c118cda31
/src/main/java/exception/EmptyFileException.java
326bd2d58a5c399e6f6e136e99469b684b8fad1b
[]
no_license
dremlin2215/by.study.abliznets.multithreading
ef666b377b9217ef53615a7403657a2bfd4462a7
e894139d366a332ca2104e74037559f6c27b4268
refs/heads/master
2021-12-29T22:47:52.110012
2019-07-01T20:53:10
2019-07-01T20:53:10
194,741,442
0
0
null
2021-12-14T21:26:42
2019-07-01T20:52:42
Java
UTF-8
Java
false
false
1,119
java
package exception; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class EmptyFileException extends Exception { private static final Logger LOGGER = LogManager.getLogger(EmptyFileException.class); private static final long serialVersionUID = 3456L; public EmptyFileException(String message) { super(message); LOGGER.warn("EmptyFileException \n"); } public EmptyFileException() { super(); LOGGER.warn("EmptyFileException \n"); } public EmptyFileException(String message, Throwable cause) { super(message, cause); LOGGER.warn("EmptyFileException \n"); } public EmptyFileException(Throwable cause) { super(cause); LOGGER.warn("EmptyFileException \n"); } protected EmptyFileException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); LOGGER.warn("EmptyFileException \n"); } }
[ "as.bliznets@gmail.com" ]
as.bliznets@gmail.com
9f9e07e62e9742dfc7a45ea46428066dd359d900
2d6e924382c68512fdd364338a526499947df10b
/SpringBoot-upload/src/main/resources/templates/File/SystemController.java
6a184e2960019ddbbe293a712577ea17b525e62b
[]
no_license
kangjiwei/springBoot-utils
1fcb0de6d27d65def18bf4553fa98ca17425bed7
9bc8f88fc54db768f68290041c879ebe4f66b757
refs/heads/master
2023-06-14T20:29:50.091322
2021-07-15T03:27:42
2021-07-15T03:27:42
320,294,914
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package com.upload.Controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * Created by rongrong on 2019/12/17. */ @Controller public class SystemController { @RequestMapping("/index") public String index(){ return "/index.html"; } }
[ "3322699919@qq.com" ]
3322699919@qq.com
5ae2f3d6ec12c2a986fd3f02da741be454416e16
1d8db59860ba015e6bb33f3c9c429e458af159ad
/src/jpatest/entity/Employeur.java
8bd615a7beabc5c6b1114524fcea840519aeee89
[]
no_license
ellawy633/Forum
0c15b6dc058d9a47a76cdfe11132e5653eca0cbf
d9149ab2bae656d5d8e6ce6d3a47b605774a001c
refs/heads/master
2021-01-18T18:12:56.463857
2016-09-20T11:56:36
2016-09-20T11:56:36
68,706,776
0
0
null
null
null
null
UTF-8
Java
false
false
1,565
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 jpatest.entity; import java.io.Serializable; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; /** * * @author admin */ @Entity public class Employeur implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Embedded private Adresse adresse; public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Employeur)) { return false; } Employeur other = (Employeur) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "jpatest.entity.Employeur[ id=" + id + " ]"; } }
[ "abd.alay@hotmail.com" ]
abd.alay@hotmail.com
31f1cb431af2dfd285bc0557ec19ec7ec1fc046c
c7d8ba2ab53ef2fdeee0e94cf60d8b2bdfee423a
/Android/app/src/main/java/com/example/android/newapp/OnboardingFragment.java
0af203a43f84dc771ee3c02c83daf1b602290e11
[]
no_license
dclyc/SkyAce
0dff62d374adb7b0d4bce53546bfdc19cfbb0ab5
8f867fc8d1611f5cea126a76f31db9379813d8fe
refs/heads/master
2021-01-10T11:54:03.399979
2015-11-27T08:33:11
2015-11-27T08:33:11
43,292,337
0
0
null
null
null
null
UTF-8
Java
false
false
8,716
java
package com.example.android.newapp; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import com.example.android.newapp.model.Session; import com.example.android.newapp.requests.RegisterUserRequest; import com.wefika.flowlayout.FlowLayout; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import retrofit.Callback; import retrofit.RetrofitError; import retrofit.client.Response; /** * Created by admin on 9/10/15. */ public class OnboardingFragment extends Fragment { Context context; @Override public void onAttach(Context context) { super.onAttach(context); this.context = context; } String[] items; String fb_user_id; List<String> selectedInterests = new ArrayList<String>(); List<String> tags = new ArrayList<String>(); boolean[] selectedBool; FlowLayout llTags; ArrayList<String> selectedItems; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_onborading, null); items = context.getResources().getStringArray(R.array.country_list); Button btnSubmitOnboard = (Button) view.findViewById(R.id.btn_submit_onboard); final EditText etName = (EditText) view.findViewById(R.id.etName); final Spinner spCountry = (Spinner) view.findViewById(R.id.spCountry); final Button btnNewInterest = (Button) view.findViewById(R.id.btnNewInterest); llTags = (FlowLayout) view.findViewById(R.id.llTags); Bundle bundle = getArguments(); if(bundle != null){ fb_user_id = bundle.getString("fbUserId"); String name = bundle.getString("name"); if(name != null){ etName.setText(name); } MainActivity.progressBar.setVisibility(View.VISIBLE); MainActivity.progressBar.setIndeterminate(true); RESTAdapter.getService().checkUserExists(fb_user_id, new Callback<String>() { @Override public void success(String s, Response response) { //Got an access token , so need to redirect to Main Pager if(!s.equals("NOT_A_USER")){ getFragmentManager().beginTransaction().replace(R.id.content_frame, new MainViewPagerFragment()).commit(); Session.setAccessToken(s); } RESTAdapter.getService().getTags(new Callback<String[]>() { @Override public void success(final String[] strings, Response response) { btnNewInterest.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showInputDialog(strings); } }); tags.addAll(Arrays.asList(strings)); } @Override public void failure(RetrofitError error) { } }); MainActivity.progressBar.setIndeterminate(false); MainActivity.progressBar.setVisibility(View.GONE); } @Override public void failure(RetrofitError error) { MainActivity.progressBar.setIndeterminate(false); MainActivity.progressBar.setVisibility(View.GONE); } }); } //If not, is onboarding case MainActivity.actionBar.removeAllTabs(); spCountry.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, items)); btnSubmitOnboard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RegisterUserRequest registerUserRequest = new RegisterUserRequest(); registerUserRequest.country = items[spCountry.getSelectedItemPosition()]; registerUserRequest.username = etName.getText().toString(); registerUserRequest.interests = selectedInterests.toArray(new String[selectedInterests.size()]); registerUserRequest.userid = fb_user_id; RESTAdapter.getService().onboardUser(Session.getAccessToken(), registerUserRequest, new Callback<String>() { @Override public void success(String response, Response response2) { Session.setAccessToken(response); getFragmentManager().beginTransaction().replace(R.id.content_frame, new MainViewPagerFragment()).commit(); } @Override public void failure(RetrofitError error) { } }); } }); spCountry.setSelection(189); return view; } public void showInputDialog(final String[] tags) { selectedInterests.clear(); AlertDialog dialog; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("Select Interests"); if(selectedBool == null) { selectedBool = new boolean[tags.length]; for(int i = 0; i < selectedBool.length ; i++) { selectedBool[i] = false; } selectedItems = new ArrayList<String>(); } builder.setMultiChoiceItems(tags, selectedBool, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) { if (isChecked) { // If the user checked the item, add it to the selected items selectedItems.add(tags[indexSelected]); } else if (selectedItems.contains(tags[indexSelected])) { // Else, if the item is already in the array, remove it selectedItems.remove(tags[indexSelected]); } selectedBool[indexSelected] = isChecked; } }) // Set the action buttons .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { selectedInterests.addAll(selectedItems); reloadInterests(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Your code when user clicked on Cancel } }); dialog = builder.create();//AlertDialog dialog; create like this outside onClick dialog.show(); } public void reloadInterests() { if(getActivity() != null) { llTags.removeAllViews(); String[] interests = selectedInterests.toArray(new String[]{}); for(int i = 0; i < interests.length;i++) { String interest = interests[i]; final TextView tv = new TextView(getActivity()); FlowLayout.LayoutParams params= new FlowLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(4, 8 , 4, 8); tv.setLayoutParams(params); tv.setText(interest); tv.setClickable(true); llTags.addView(tv); } } } }
[ "twentyeightbytes@gmail.com" ]
twentyeightbytes@gmail.com
e34fe73f1544ab25efb06c668b2f805d66e8b4f7
cc5a7d0bfe6519e2d462de1ac9ef793fb610f2a7
/api1/src/main/java/com/heb/pm/batchUpload/ebmBda/EbmBdaCandidateWorkRequestCreator.java
d767fa8797c3a24dde99bdb2f5a84cdc9da90db5
[]
no_license
manosbatsis/SAVEFILECOMPANY
d21535a46aebedf2a425fa231c678658d4b017a4
c33d41cf13dd2ff5bb3a882f6aecc89b24a206be
refs/heads/master
2023-03-21T04:46:23.286060
2019-10-10T10:38:02
2019-10-10T10:38:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,317
java
/* * EbmBdaCandidateWorkRequestCreator * * Copyright (c) 2019 HEB * All rights reserved. * * This software is the confidential and proprietary information * of HEB. */ package com.heb.pm.batchUpload.ebmBda; import com.heb.pm.batchUpload.parser.CandidateWorkRequestCreator; import com.heb.pm.batchUpload.parser.ProductAttribute; import com.heb.pm.batchUpload.parser.WorkRequestCreatorUtils; import com.heb.pm.entity.*; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; /** * The class create the candidate request for ebmBda file. * datas have been validate then insert to candidate work request table. * * @author vn70529 * @since 2.33.0 */ @Service public class EbmBdaCandidateWorkRequestCreator extends CandidateWorkRequestCreator { private static final String SINGLE_SPACE = " "; private static final String STRING_EMPTY = "EMPTY"; @Autowired private EbmBdaValidator ebmBdaValidator; @Override public CandidateWorkRequest createRequest(List<String> cellValues, List<ProductAttribute> productAttributes, long transactionId, String userId) { EbmBdaBatchUpload ebmBdaBatchUpload = this.createEbmBdaBatchUpload(cellValues); this.ebmBdaValidator.validateRow(ebmBdaBatchUpload); CandidateWorkRequest candidateWorkRequest = WorkRequestCreatorUtils.getEmptyWorkRequest(null, null, userId, transactionId, CandidateWorkRequest.SRC_SYSTEM_ID_DEFAULT, getBatchStatus(ebmBdaBatchUpload).getName()); if (!ebmBdaBatchUpload.hasErrors()) { setDataToCandidateClassCommodity(candidateWorkRequest, ebmBdaBatchUpload); } setDataToCandidateStatus(candidateWorkRequest, ebmBdaBatchUpload); return candidateWorkRequest; } /** * set data to CandidateClassCommodity * * @param candidateWorkRequest the CandidateWorkRequest * @param ebmBdaBatchUpload the EbmBdaBatchUpload */ public void setDataToCandidateClassCommodity(CandidateWorkRequest candidateWorkRequest, EbmBdaBatchUpload ebmBdaBatchUpload) { CandidateClassCommodity candidateClassCommodity = new CandidateClassCommodity(); CandidateClassCommodityKey candidateClassCommodityKey = new CandidateClassCommodityKey(); candidateClassCommodityKey.setClassCode(Integer.valueOf(ebmBdaBatchUpload.getClassCode())); candidateClassCommodityKey.setCommodityCode(Integer.valueOf(ebmBdaBatchUpload.getCommodityCode())); candidateClassCommodity.setKey(candidateClassCommodityKey); candidateClassCommodity.setEbmId(this.getEbmBdaId(ebmBdaBatchUpload.getEbmId())); candidateClassCommodity.setBdaId(this.getEbmBdaId(ebmBdaBatchUpload.getBdaId())); candidateClassCommodity.setCreateDate(LocalDateTime.now()); candidateClassCommodity.setCreateUserId(candidateWorkRequest.getUserId()); candidateClassCommodity.setLastUpdateDate(LocalDateTime.now()); candidateClassCommodity.setLastUpdateUserId(candidateWorkRequest.getUserId()); candidateClassCommodity.setCandidateWorkRequest(candidateWorkRequest); candidateWorkRequest.setCandidateClassCommodities(new ArrayList<CandidateClassCommodity>()); candidateWorkRequest.getCandidateClassCommodities().add(candidateClassCommodity); } /** * get value for edm, bda. * * @param value the value of ebm, bda. * @return the id of ebm, bda */ public String getEbmBdaId(String value) { //If value is null or empty then return null. if (StringUtils.trimToEmpty(value).equals(StringUtils.EMPTY)) return null; //If value is 'empty' or 'EMPTY' then return blank. if (StringUtils.trimToEmpty(value).toUpperCase().equals(STRING_EMPTY)) return SINGLE_SPACE; // If value is not null, not empty and not 'empty' then return value. return value.trim(); } /** * set Data To CandidateStatus. * * @param candidateWorkRequest the CandidateWorkRequest * @param ebmBdaBatchUpload the EbmBdaBatchUpload */ public void setDataToCandidateStatus(CandidateWorkRequest candidateWorkRequest, EbmBdaBatchUpload ebmBdaBatchUpload) { String errorMessage = ebmBdaBatchUpload.hasErrors() ? ebmBdaBatchUpload.getErrors().get(0) : StringUtils.EMPTY; candidateWorkRequest.setCandidateStatuses(new ArrayList<CandidateStatus>()); CandidateStatusKey key = new CandidateStatusKey(); key.setStatus(this.getBatchStatus(ebmBdaBatchUpload).getName()); key.setLastUpdateDate(LocalDateTime.now()); CandidateStatus candidateStatus = new CandidateStatus(); candidateStatus.setKey(key); candidateStatus.setUpdateUserId(candidateWorkRequest.getUserId()); candidateStatus.setStatusChangeReason(CandidateStatus.STAT_CHG_RSN_ID_WRKG); candidateStatus.setCommentText(errorMessage); candidateStatus.setCandidateWorkRequest(candidateWorkRequest); candidateWorkRequest.getCandidateStatuses().add(candidateStatus); } /** * Create data for EbmBdaBatchUpload. * * @param cellValues the cell value. * @return the EbmBdaBatchUpload */ private EbmBdaBatchUpload createEbmBdaBatchUpload(List<String> cellValues) { EbmBdaBatchUpload eBMBDABatchUpload = new EbmBdaBatchUpload(); String value; for (int j = 0; j < cellValues.size(); j++) { value = cellValues.get(j); switch (j) { case EbmBdaBatchUpload.COL_POS_CLASS_CODE: eBMBDABatchUpload.setClassCode(value); break; case EbmBdaBatchUpload.COL_POS_COMMODITY_CODE: eBMBDABatchUpload.setCommodityCode(value); break; case EbmBdaBatchUpload.COL_POS_EBM_CODE: eBMBDABatchUpload.setEbmId(value); break; case EbmBdaBatchUpload.COL_POS_BDA_CODE: eBMBDABatchUpload.setBdaId(value); break; } } return eBMBDABatchUpload; } }
[ "tran.than@heb.com" ]
tran.than@heb.com
559d06e167c2d6a834a79b05e2c311c2f93826df
075be37e2b581c5934dff3f08509f86c48a6cb47
/ho_series_root/ho_SpringIntegrationTestsTDD/src/test/java/com/example/EchoIT.java
95421e2fb0c6500a7baa72a065ecfbbdde177c18
[]
no_license
sajal-chakraborty/different_poc
13a6bd17cf681c7aa00b915cb08f2f56845c3268
bc998cbc3274c33d9fe638608f83d709febee48b
refs/heads/master
2021-01-22T05:20:45.887133
2017-02-11T17:01:01
2017-02-11T17:14:30
81,653,351
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package com.example; import org.junit.Test; import static com.jayway.restassured.RestAssured.*; import static com.jayway.restassured.matcher.RestAssuredMatchers.*; import static org.hamcrest.Matchers.*; public class EchoIT { @Test public void firstEchoTest() { get("/echo/hello").then().assertThat().body("message", equalTo("hello")); } }
[ "sajal.chakraborty@gmail.com" ]
sajal.chakraborty@gmail.com
5e9f0aec4c866c98199fe25409699880f81af871
2e981c2c539efb176cef0b2dee5b6f06b099bf9d
/RHoffman_SharingIsCaring/src/Friend.java
3b4ac0b740e647335292cab4c86a04b99764f9fa
[]
no_license
ryan2445/Java_Projects
1d28d6877e734ee42ce13615d0e6219576b26aae
eef3a4fa202c8560d5a0bdd647a49310474afa56
refs/heads/master
2020-03-29T11:00:14.389445
2018-09-26T19:11:35
2018-09-26T19:11:35
149,829,316
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
import java.util.*; public class Friend { private String name; private Homework homework; private Lunch lunch; public Friend(String name, Homework homework, Lunch lunch){ this.name = name; this.homework = homework; this.lunch = lunch; } public String getName(){ return name; } public Homework getHomework(){ return homework; } public Lunch getLunch(){ return lunch; } public void setName(String nameUpdate){ name = nameUpdate; } public void setHomework(Homework homeworkUpdate){ homework = homeworkUpdate; } public void setLunch(Lunch lunchUpdate){ lunch = lunchUpdate; } public String toString(){ return "Name: "+name+"\n"+homework+lunch+"\n"; } }
[ "Ryan@207.197.59.141" ]
Ryan@207.197.59.141
97258cb10a24596c22980b4a83cd471ec5673be2
a62710e645d9a2c668c90223548050d8a6e8917d
/IncidentInformationApplicationServer/src/sad/group3/service/MessageService.java
b517c3c4108b1c445569b12219c44a9b683d324c
[]
no_license
JPye/IncInfoSystemServer
a3bd9b75691a372eec1c5dda7f1e5060ed5066a8
bdcf05746a66308e100e2758010af98d8a2d587f
refs/heads/master
2020-08-26T10:45:11.603396
2013-05-19T00:52:57
2013-05-19T00:52:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,544
java
package sad.group3.service; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import com.google.gson.Gson; import sad.group3.domain.Incident; import sad.group3.domain.Message; import sad.group3.utils.DES; import sad.group3.utils.SqlHelper; public class MessageService { public static List<Message> getRelatedMsgs(String incID){ List<Message> messages=new ArrayList<Message>(); String sql = "select msg_num,to_char(msg_date,'MM-dd-YYYY HH24:MI:SS') as msgdate,o.o_id,o_firstname||' '||o_lastname as fullname from message msg, officer_involve_in oin,officer o where msg.officer_inv_num=oin.officer_inv_num and oin.o_id=o.o_id and inc_id=? order by msg_date"; ResultSet rs = null; try { rs = SqlHelper.executeNormalQuery(sql, new String[] { incID }); while (rs.next()) { Message message = new Message(); message.setMsgNum(rs.getInt("msg_num")+""); message.setMsgDate(rs.getString("msgdate")); message.setMsgOfficerID(rs.getString("o_id")); message.setMsgOfficerName(rs.getString("fullname")); messages.add(message); } } catch (Exception e) { e.printStackTrace(); } return messages; } public static Message searchMessageDetail(String msgNum) { String sql = "select oin.inc_id,msg_num,to_char(msg_date,'MM-dd-YYYY HH24:MI:SS') as msgdate,o.o_id,o_firstname||' '||o_lastname as fullname,msg_content from message msg, officer_involve_in oin,officer o where msg.officer_inv_num=oin.officer_inv_num and oin.o_id=o.o_id and msg_num=?"; ResultSet rs = null; Message message = null; try { rs = SqlHelper.executeNormalQuery(sql, new String[] { msgNum }); if (rs.next()) { message = new Message(); message.setIncID(rs.getString("inc_id")); message.setMsgNum(rs.getInt("msg_num")+""); message.setMsgDate(rs.getString("msgdate")); message.setMsgOfficerID(rs.getString("o_id")); message.setMsgOfficerName(rs.getString("fullname")); message.setMsgContent(rs.getString("msg_content")); } } catch (Exception e) { e.printStackTrace(); } finally { SqlHelper.close(rs, SqlHelper.getPs(), SqlHelper.getCt()); } return message; } public static String addNewMessage(Message messageSearch) { String sql = "insert into message values(message_seq.nextval,?,sysdate,?)"; String result="Add New Message Fail!"; try { boolean flag=SqlHelper.executeUpdate(sql, new String[]{messageSearch.getOfficerInvNum(),messageSearch.getMsgContent()}); if(flag==true){ Incident incident=IncidentService.searchIncidentDetail(messageSearch.getIncID()); Gson gson=new Gson(); result=gson.toJson(incident); } } catch (Exception e) { e.printStackTrace(); } finally { SqlHelper.close(SqlHelper.getRs(), SqlHelper.getPs(), SqlHelper.getCt()); } return result; } public static void main(String[] args) throws Exception { // List<Message> messages=MessageService.getRelatedMsgs("2012002112"); // System.out.println(messages.size()); // Message message=new Message(); // message.setOfficerInvNum("28"); // message.setMsgContent("Add Msg 1"); // System.out.println(MessageService.addNewMessage(message)); Message message=new Message(); message.setMsgNum("11"); Gson gson =new Gson(); System.out.println(gson.toJson(message)); System.out.println(DES.encryptDES(gson.toJson(message),DES.KEY)); System.out.println(DES.decryptDES("QWNwyBwRJ2c=", DES.KEY)); Message msg=MessageService.searchMessageDetail(message.getMsgNum()); System.out.println(msg.getMsgContent()); } }
[ "yepan1989@gmail.com" ]
yepan1989@gmail.com
6d3dc72d11de52c353835828f25d09d10c8394e1
1469654ddbb2b485b6e69f81e27f9de205a72b4a
/Urna/src/Inicial/CadastrarFederal.java
7a3461ca0669f88be914565fe14a683fd3dae8e1
[ "MIT" ]
permissive
lucaseop/Urna-Eletronica
c0a5c17f5468a30dcc33a92c3aaac5f05e399504
a70c0f40126fa9c5f9b46c3b854ff0fac03066dd
refs/heads/main
2023-09-01T12:27:19.782449
2021-11-02T22:49:04
2021-11-02T22:49:04
424,014,329
0
0
null
null
null
null
UTF-8
Java
false
false
2,066
java
package Inicial; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import Candidatos.Candidato; import Candidatos.DeputadoFederal; public class CadastrarFederal extends JFrame{ JButton cad; JTextField caixaNome, caixaPartido, caixaNumero; JLabel nome, partido, numero; JButton cadastrar; DeputadoFederal f; List<Candidato> listacandidatos = new ArrayList<Candidato>(); public CadastrarFederal(List<Candidato>federal){ super("Cadastrar Deputado Federal"); listacandidatos = federal; Container telafed = getContentPane(); Manipulador objeto = new Manipulador(); telafed.setLayout(null); setSize(300,250); setLocationRelativeTo(null); setVisible(true); caixaNome = new JTextField(); caixaNome.setText(""); caixaNome.setBounds(80, 10, 120, 30); telafed.add(caixaNome); caixaPartido = new JTextField(); caixaPartido.setText(""); caixaPartido.setBounds(80, 50, 50, 30); telafed.add(caixaPartido); caixaNumero = new JTextField(); caixaNumero.setText(""); caixaNumero.setBounds(80, 90, 40, 30); telafed.add(caixaNumero); nome = new JLabel("Nome"); nome.setBounds(20, 10, 50, 30); telafed.add(nome); partido = new JLabel("Partido"); partido.setBounds(20, 50, 50, 30); telafed.add(partido); numero = new JLabel("Numero"); numero.setBounds(20, 90, 50, 30); telafed.add(numero); cadastrar = new JButton(); cadastrar.setText("CADASTRAR"); cadastrar.addActionListener(objeto); cadastrar.setBounds(80, 140, 120, 40); telafed.add(cadastrar); } public class Manipulador implements ActionListener{ public void actionPerformed(ActionEvent evento){ if(evento.getSource() == cadastrar){ f = new DeputadoFederal(caixaNome.getText(), caixaPartido.getText(), Integer.parseInt(caixaNumero.getText())); listacandidatos.add(f); dispose(); } } } }
[ "lucas.eop@gmail.com" ]
lucas.eop@gmail.com
555d72d0184b1dbea541e1b557b12e27cc401088
0e1aed2fe29c0b3b742e2a313d10f4105017d2e6
/flights-wsclient/src/main/java/ru/eu/flights/callback/WsResultListener.java
02398451b1542f5f8fd28b827d921e2909a040ae
[]
no_license
eUdaloff/study-ws-mvn
df30d8be9efee9895831644c4bfe403b49586446
c03dcc049714f82963d625e3e14b77fb1349947d
refs/heads/master
2020-05-25T14:58:45.270448
2016-10-11T15:50:48
2016-10-11T15:50:48
69,677,418
0
0
null
null
null
null
UTF-8
Java
false
false
125
java
package ru.eu.flights.callback; public interface WsResultListener { void notify(Object o, ListenerType listenerType); }
[ "Udalov.EV@banktver.ru" ]
Udalov.EV@banktver.ru
6931ba39c687547a8099121772ea30ab1c1362b6
4eecf8fe956a6bd4cb429cf09382cc89a914d605
/app/src/main/java/com/lqr/wechat/nimsdk/utils/StorageType.java
e0a253d691e5256add2ebfec2b2e304efc202d3c
[]
no_license
MiloMallo/HeartFollow-master
3be6c5c0c9b63b42a27e5e52f8f751020fa15c26
32b4d8d9fa1e01887154b7cca4a6e904bd055967
refs/heads/master
2021-06-20T19:04:22.679551
2017-08-12T04:28:42
2017-08-12T04:28:42
91,869,054
3
0
null
null
null
null
UTF-8
Java
false
false
1,535
java
package com.lqr.wechat.nimsdk.utils; public enum StorageType { TYPE_LOG(DirectoryName.LOG_DIRECTORY_NAME), TYPE_TEMP(DirectoryName.TEMP_DIRECTORY_NAME), TYPE_FILE(DirectoryName.FILE_DIRECTORY_NAME), TYPE_AUDIO(DirectoryName.AUDIO_DIRECTORY_NAME), TYPE_IMAGE(DirectoryName.IMAGE_DIRECTORY_NAME), TYPE_VIDEO(DirectoryName.VIDEO_DIRECTORY_NAME), TYPE_THUMB_IMAGE(DirectoryName.THUMB_DIRECTORY_NAME), TYPE_THUMB_VIDEO(DirectoryName.THUMB_DIRECTORY_NAME), ; private DirectoryName storageDirectoryName; private long storageMinSize; public String getStoragePath() { return storageDirectoryName.getPath(); } public long getStorageMinSize() { return storageMinSize; } StorageType(DirectoryName dirName) { this(dirName, StorageUtils.THRESHOLD_MIN_SPCAE); } StorageType(DirectoryName dirName, long storageMinSize) { this.storageDirectoryName = dirName; this.storageMinSize = storageMinSize; } enum DirectoryName { AUDIO_DIRECTORY_NAME("audio/"), DATA_DIRECTORY_NAME("data/"), FILE_DIRECTORY_NAME("file/"), LOG_DIRECTORY_NAME("log/"), TEMP_DIRECTORY_NAME("temp/"), IMAGE_DIRECTORY_NAME("image/"), THUMB_DIRECTORY_NAME("thumb/"), VIDEO_DIRECTORY_NAME("video/"), ; private String path; public String getPath() { return path; } private DirectoryName(String path) { this.path = path; } } }
[ "1229555035@qq.com" ]
1229555035@qq.com
556f64cffbe7a13352edb5e182dac2d07669505f
3cbca51c24702ad9e7ead6d23a3c4919611f3a64
/_GH_TestAmazonLoginPage/src/com/amazon/Pages/BrowserType.java
d23ffb547b4c03749362c4c2ab5a285351283a76
[]
no_license
hvt65git/RepositoryTestAmazonLoginPage
2d48a26d5e2138be1249c1eeb4a06a682252e33f
38a2ba5e7da353fc36b97438a3b399efa33edc3f
refs/heads/master
2020-06-23T08:58:41.403394
2016-11-24T09:32:16
2016-11-24T09:32:16
74,657,927
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
package com.amazon.Pages; //An enum declared outside a class must NOT be marked static, final , abstract, protected , or private public enum BrowserType { FIREFOX("firefox"), IE("ie"), CHROME("chrome"), HTMLUNIT("html unit driver"); private final String label; private BrowserType(String label) { this.label = label; System.out.println("BrowserType enum private constructor executed..."); } public String getLabel() { return this.label; } }
[ "hvtodd@yahoo.com" ]
hvtodd@yahoo.com
9ba444c2e446a15832eebd93dfec3d63ada1d064
945ac4b0644c4584c42fcbc018354d76b2b3933a
/src/strategy/interfaces/FirstBehaviorSecondImp.java
6085c9cb87b3693bbab1d9952048d467f90638af
[]
no_license
sumaikun/DessignPatterns
4e8207ab319df6d78ab81bd2b75beb642efef445
32b051aa23462130c9ccbed25848fde929f2788d
refs/heads/master
2020-06-21T09:26:33.264070
2019-07-17T14:39:44
2019-07-17T14:39:44
197,406,929
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package strategy.interfaces; /** * * @author jvega */ public class FirstBehaviorSecondImp implements FirstBehavior{ @Override public void execute_first_behavior() { System.out.println("Executing second implementation"); } }
[ "jvega@cobiscorp.int" ]
jvega@cobiscorp.int
49bf3737c406738a38c4247388213693a8c5bf6b
821eea25624740a008311eed3f962f1488684a5a
/src/main/java/Reciate/LC112.java
ab77c1bd3e9e39f08e5b97fe8823689b51657986
[]
no_license
cchaoqun/Chaoqun_LeetCode
0c45598a0ba89cae9c53725b7b70adf767b226f1
5b2bf42bca66e46e4751455b81b17198b447bb39
refs/heads/master
2023-06-30T20:53:49.779110
2021-08-02T12:45:16
2021-08-02T12:45:16
367,815,848
0
0
null
null
null
null
UTF-8
Java
false
false
3,562
java
package Reciate; import java.util.LinkedList; import java.util.Queue; /* * @Description: 112. 路径总和 给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这条路径上所有节点值相加等于目标和。 说明:叶子节点是指没有子节点的节点。 * 示例: 给定如下二叉树,以及目标和 sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ \ 7 2 1 返回 true, 因为存在目标和为 22 的根节点到叶子节点的路径 5->4->11->2。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/path-sum 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 * @param null * @return * @author Chaoqun * @creed: Talk is cheap,show me the code * @date 2021/1/10 20:37 */ public class LC112 { //递归 // public boolean hasPathSum(TreeNode root, int sum) { // return pathSum(root,sum,0); // } // // public boolean pathSum(TreeNode root, int target, int sum){ // if(root!=null){ // //判断路径和==target 并且当前结点为叶子结点 // if(sum+root.val == target && root.left==null && root.right==null){ // return true; // }else{ // //sum加上当前结点的值 // sum += root.val; // //在左子节点递归 // //在右子节点递归 // return pathSum(root.left,target,sum) || pathSum(root.right,target,sum); // } // } // return false; // } //递归简洁 // public boolean hasPathSum(TreeNode root, int sum){ // if(root==null){ // return false; // } // if(root.left==null && root.right==null){ // return root.val == sum; // } // return hasPathSum(root.left,sum-root.val) || hasPathSum(root.right,sum-root.val); // // } //BFS public boolean hasPathSum(TreeNode root, int sum){ if(root==null){ return false; } //创建两个队列 //结点队列 Queue<TreeNode> node = new LinkedList<>(); //根结点到当前结点路径和的队列 Queue<Integer> pathSum = new LinkedList<>(); //入队 node.offer(root); pathSum.offer(root.val); while(!node.isEmpty()){ //出队 TreeNode tempNode = node.poll(); int tempSum = pathSum.poll(); //当前为叶子结点 if(tempNode.left==null && tempNode.right==null){ //根结点到当前叶子结点的路径和==目标值 if(tempSum == sum){ return true; } continue; } //当前不是叶子结点 if(tempNode.left!=null){ node.offer(tempNode.left); pathSum.offer(tempSum+tempNode.left.val); } if(tempNode.right!=null){ node.offer(tempNode.right); pathSum.offer(tempSum+tempNode.right.val); } } return false; } } //Definition for a binary tree node. class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() {} TreeNode(int val) { this.val = val; } TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left = left; this.right = right; } }
[ "chengchaoqun@hotmail.com" ]
chengchaoqun@hotmail.com
0d01578d09ff1eb960c90a8a95d237b341b89b7b
63a35acbe3097bbf0eae8231a515eab0dbd48dea
/app/src/androidTest/java/com/hubufan/permission/helper/ExampleInstrumentedTest.java
765baae43ede3f38be42239806a11ff537fbf086
[]
no_license
HuBuFan/UrPermissionHelper
7c6c6bc19c51e74235cf45a467dfe3ef4f1182d2
add32710f027a52993f15cabac8c1bdb17a4d049
refs/heads/master
2021-04-04T07:37:12.947060
2020-04-16T09:23:13
2020-04-16T09:23:13
249,324,637
1
0
null
null
null
null
UTF-8
Java
false
false
774
java
package com.hubufan.permission.helper; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext(); assertEquals("com.hubufan.permission.helper", appContext.getPackageName()); } }
[ "15879167154@163.com" ]
15879167154@163.com
87092bb18026a7310ed8c6cbf521b4c417bc587b
1eab3d310841b7c21fa2bad8fd574cfadd9409c2
/src/test/java/kr/or/ddit/user/controller/UserControllerTest.java
fc482c24645091b157df880031453c82a0a1a8e0
[]
no_license
ghogho67/spring
41b901246af70114947ac8c2b1e7764f84c21fa5
427c0dd0c8d04d9a36873da6ab9360966535e9cc
refs/heads/master
2022-12-08T00:21:52.948535
2019-07-08T01:36:39
2019-07-08T01:36:39
192,683,560
0
0
null
null
null
null
UTF-8
Java
false
false
8,204
java
package kr.or.ddit.user.controller; import static org.junit.Assert.assertEquals; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.fileUpload; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import java.io.File; import java.io.FileInputStream; import java.util.List; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockMultipartFile; import org.springframework.test.web.servlet.MvcResult; import org.springframework.web.servlet.ModelAndView; import kr.or.ddit.page.model.PageVo; import kr.or.ddit.testenv.ControllerEnv; import kr.or.ddit.user.model.UserVo; public class UserControllerTest extends ControllerEnv { private static final Logger logger = LoggerFactory.getLogger(UserControllerTest.class); /** * Method : userListTest * 작성자 : PC21 * 변경이력 : * Method 설명 : 사용자 전체 리스트 테스트 * @throws Exception */ @Test public void userListTest() throws Exception { /***Given***/ /***When***/ MvcResult mvcResult = mockMvc.perform(get("/user/list")).andReturn(); ModelAndView mav = mvcResult.getModelAndView(); /***Then***/ assertEquals("user/userList", mav.getViewName()); assertEquals(109, ((List<UserVo>)mav.getModelMap().get("userList")).size()); } /** * Method : userPagingListTset * 작성자 : PC21 * 변경이력 : * Method 설명 :사용자 페이징 리스트 테스트 * 파라미터를 보냈을때 제대로 처리되는지 확인해보는테스트 * @throws Exception */ @Test public void userPagingListTset() throws Exception { /***Given***/ /***When***/ MvcResult mvcResult = mockMvc.perform(get("/user/pagingList").param("page", "2").param("pageSize", "10")).andReturn(); ModelAndView mav = mvcResult.getModelAndView(); String viewName = mav.getViewName(); List<UserVo> userList = (List<UserVo>) mav.getModelMap().get("userList"); int paginationSize = (Integer)mav.getModelMap().get("paginationSize"); PageVo pageVo = (PageVo) mav.getModelMap().get("pageVo"); /***Then***/ assertEquals("tiles.userPagingList", viewName); assertEquals(10, userList.size()); assertEquals(11, paginationSize); assertEquals(2, pageVo.getPage()); assertEquals(10, pageVo.getPageSize()); //hashcode pageVo1 과 pageVo2 같은경우는 서로 다른 객체이기때문에 테스트가 통과하지 못한다. 그래서 pageVo에 hashcode를 만든다. //hashcode 를 만들어도 디폴트 처리때문에 getPage(), getPageSize()을 적용 시켜줘야한다. pageVo 참고 //PageVo equals, hashCode메소드를 구현해서 비교한다. } /** * Method : userPagingListTset * 작성자 : PC21 * 변경이력 : * Method 설명 :사용자 페이징 리스트 테스트 * 파라미터 없이 호출할때 테스트 * @throws Exception */ @Test public void userPagingListWithOutTset() throws Exception { /***Given***/ /***When***/ MvcResult mvcResult = mockMvc.perform(get("/user/pagingList")).andReturn(); ModelAndView mav = mvcResult.getModelAndView(); String viewName = mav.getViewName(); List<UserVo> userList = (List<UserVo>) mav.getModelMap().get("userList"); int paginationSize = (Integer)mav.getModelMap().get("paginationSize"); PageVo pageVo = (PageVo) mav.getModelMap().get("pageVo"); /***Then***/ assertEquals("tiles.userPagingList", viewName); assertEquals(10, userList.size()); assertEquals(11, paginationSize); assertEquals(1, pageVo.getPage()); assertEquals(10, pageVo.getPageSize()); } @Test public void userTest() throws Exception { /***Given***/ /***When***/ MvcResult mvcResult = mockMvc.perform(get("/user/user").param("userId", "brown")).andReturn(); ModelAndView mav = mvcResult.getModelAndView(); String viewName = mav.getViewName(); UserVo userVo = (UserVo) mav.getModelMap().get("userVo"); /***Then***/ assertEquals("user/user", viewName); assertEquals("곰", userVo.getAlias()); } /** * Method : userForm * 작성자 : PC21 * 변경이력 : * Method 설명 : 사용자 입력 화면 요청 * @throws Exception */ @Test public void userFormGetTest() throws Exception{ MvcResult mvcResult = mockMvc.perform(get("user/form")).andReturn(); } /** * Method : userFormPostSuccessTest * 작성자 : PC21 * 변경이력 : * @throws Exception * Method 설명 : 사용자 등록테스트(Success 시나리오) */ @Test public void userFormPostSuccessTest() throws Exception{ /***Given***/ File f = new File("src/test/resources/kr/or/ddit/testenv/main02.jpg"); MockMultipartFile file = new MockMultipartFile("profile", f.getName(), "", new FileInputStream(f)); /***When***/ mockMvc.perform(fileUpload("/user/form").file(file) .param("userId", "userTest") .param("name", "대덕인") .param("alias", "대덕") .param("addr1", "대전광역시 중구 중앙로76") .param("addr2", "영민빌딩 2층 204호") .param("zipcd", "12345") .param("birth", "2019-05-03") .param("pass", "userTest1234")) .andExpect(view().name("redirect:/user/pagingList")); } /** * Method : userFormPostSuccessTest * 작성자 : PC21 * 변경이력 : * @throws Exception * Method 설명 : 사용자 등록테스트(Fail 시나리오) */ @Test public void userFormPostFailTest() throws Exception{ /***Given***/ File f = new File("src/test/resources/kr/or/ddit/testenv/main02.jpg"); MockMultipartFile file = new MockMultipartFile("profile", f.getName(), "", new FileInputStream(f)); /***When***/ mockMvc.perform(fileUpload("/user/form").file(file) .param("userId", "sujitasan") //이미 존재하는 아이디 .param("name", "대덕인") .param("alias", "대덕") .param("addr1", "대전광역시 중구 중앙로76") .param("addr2", "영민빌딩 2층 204호") .param("zipcd", "12345") .param("birth", "2019-05-03") .param("pass", "userTest1234")) .andExpect(view().name("user/userForm")); } /** * Method : profileTest * 작성자 : PC21 * 변경이력 : * Method 설명 : 사용자 사진 응답 생성 테스트 * @throws Exception */ @Test public void profileTest() throws Exception { mockMvc.perform(get("/user/profile").param("userId", "brown")) // .andExpect(status().is(200)) .andExpect(status().isOk()); } /** * Method : userModifyGetTest * 작성자 : PC21 * 변경이력 : * Method 설명 :사용자 수정화면 요청 테스트 * @throws Exception */ @Test public void userModifyGetTest() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/user/modify").param("userId", "brown")).andReturn(); ModelAndView mav = mvcResult.getModelAndView(); String viewName = mav.getViewName(); UserVo userVo = (UserVo) mav.getModelMap().get("userVo"); assertEquals("곰", userVo.getAlias()); assertEquals("user/userModify", viewName); } /** * Method : userModifyPostTest * 작성자 : PC21 * 변경이력 : * Method 설명 ::사용자 수정Post 테스트 * @throws Exception */ @Test public void userModifyPostTest() throws Exception { /***Given***/ File f = new File("src/test/resources/kr/or/ddit/testenv/main02.jpg"); MockMultipartFile file = new MockMultipartFile("profile", f.getName(), "", new FileInputStream(f)); /***When***/ mockMvc.perform(fileUpload("/user/modify").file(file) .param("userId", "sujitasan") .param("name", "수지님") .param("alias", "水地打山") .param("addr1", "대전광역시 중구 중앙로76") .param("addr2", "영민빌딩 2층 204호") .param("zipcd", "12345") .param("birth", "2019-05-03") .param("pass", "userTest1234")) .andExpect(view().name("redirect:/user/user")); } }
[ "ghogho67@gmail.com" ]
ghogho67@gmail.com
c6209ec857ec72cbeaa3abc71db048d7114a05ba
eb5c9bf5379051660b495a43b3ce6a0e98641199
/src/java/com/marklogic/recordloader/http/HttpModuleContentFactory.java
0f7f257fb97e54911418f710816169b5a83d890a
[ "Apache-2.0" ]
permissive
MarkLogic-Attic/recordloader
78f0faf151f61fc221b00dd2c6b686d80976e4b2
c36f9bbab8ed91ac8cb61f8a01e94141e4d62d25
refs/heads/master
2022-12-28T21:36:54.836506
2020-10-13T18:29:19
2020-10-13T18:29:19
599,874
0
3
NOASSERTION
2020-10-13T18:29:20
2010-04-07T23:16:02
Java
UTF-8
Java
false
false
5,544
java
/** * Copyright (c) 2008-2010 Mark Logic Corporation. 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. * * The use of the Apache License does not indicate that this project is * affiliated with the Apache Software Foundation. */ package com.marklogic.recordloader.http; import java.net.Authenticator; import java.net.MalformedURLException; import java.net.PasswordAuthentication; import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import com.marklogic.ps.SimpleLogger; import com.marklogic.recordloader.Configuration; import com.marklogic.recordloader.ContentFactory; import com.marklogic.recordloader.ContentInterface; import com.marklogic.recordloader.LoaderException; /** * @author Michael Blakeley, Mark Logic Corporation * */ public class HttpModuleContentFactory implements ContentFactory { protected Configuration configuration; protected List<String> collections; protected SimpleLogger logger; protected String[] executeRoles; protected String[] insertRoles; protected String[] readRoles; protected String[] updateRoles; protected String[] collectionsArray; protected String language; protected String namespace; protected String[] placeKeys; protected URL connectionUrl; protected boolean authorityIsInitialized; /** * @throws LoaderException */ protected void initOptions() throws LoaderException { executeRoles = configuration.getExecuteRoles(); insertRoles = configuration.getInsertRoles(); readRoles = configuration.getReadRoles(); updateRoles = configuration.getUpdateRoles(); collectionsArray = configuration.getBaseCollections(); language = configuration.getLanguage(); namespace = configuration.getOutputNamespace(); // NB - it is up to the module to get forests from forest names placeKeys = configuration.getOutputForests(); } /* * (non-Javadoc) * * @see * com.marklogic.recordloader.xcc.XccAbstractContentFactory#newContent(java * .lang.String) */ @SuppressWarnings("unused") public ContentInterface newContent(String _uri) throws LoaderException { // TODO add isSkipExistingUntilFirstMiss return new HttpModuleContent(connectionUrl, _uri, executeRoles, insertRoles, readRoles, updateRoles, collectionsArray, language, namespace, configuration.isSkipExisting(), configuration.isErrorExisting(), placeKeys, configuration .getDecoder()); } /* * (non-Javadoc) * * @see * com.marklogic.recordloader.ContentFactory#setFileBasename(java.lang.String * ) */ public void setFileBasename(String _name) throws LoaderException { // ensure that doc options exist initOptions(); collections = new ArrayList<String>(Arrays.asList(configuration .getBaseCollections())); collections.add(_name); // update content options with the latest collections collectionsArray = collections.toArray(new String[0]); } /* * (non-Javadoc) * * @see com.marklogic.recordloader.ContentFactory#getVersionString() */ public String getVersionString() { return "n/a"; } /* * (non-Javadoc) * * @see * com.marklogic.recordloader.ContentFactory#setProperties(java.util.Properties * ) */ public void setConfiguration(Configuration _configuration) throws LoaderException { configuration = _configuration; logger = configuration.getLogger(); initOptions(); } /** * @param _uri * @throws LoaderException */ public void setConnectionUri(URI _uri) throws LoaderException { // this is sort of redundant, but the Loader doesn't know which // round-robin index to use. if (null == connectionUrl || !authorityIsInitialized) { try { final String[] auth = _uri.toURL().getAuthority().split( "@")[0].split(":"); Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(auth[0], auth[1].toCharArray()); } }); authorityIsInitialized = true; } catch (MalformedURLException e) { throw new LoaderException(e); } } try { connectionUrl = _uri.toURL(); } catch (MalformedURLException e) { throw new LoaderException(_uri.toString(), e); } } /* * (non-Javadoc) * * @see com.marklogic.recordloader.ContentInterface#close() */ public void close() { // nothing to do } }
[ "mike@marklogic.com" ]
mike@marklogic.com
02fcd982714d70c7bcaeddff7dadb06a7bf8280a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/12/12_df6f922045385da3c8bd7d4bde400e0658d977f5/BaseOverthereConnection/12_df6f922045385da3c8bd7d4bde400e0658d977f5_BaseOverthereConnection_t.java
e381c800869c86959d2063c46cede7a840c6bd74
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
15,843
java
/** * Copyright (c) 2008, 2012, XebiaLabs B.V., All rights reserved. * * * Overthere is licensed under the terms of the GPLv2 * <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most XebiaLabs Libraries. * There are special exceptions to the terms and conditions of the GPLv2 as it is applied to * this software, see the FLOSS License Exception * <http://github.com/xebialabs/overthere/blob/master/LICENSE>. * * This program is free software; you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Foundation; version 2 * of the License. * * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth * Floor, Boston, MA 02110-1301 USA */ package com.xebialabs.overthere.spi; import java.io.InputStream; import java.io.InputStreamReader; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; import java.util.concurrent.CountDownLatch; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.xebialabs.overthere.*; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.common.io.Closeables.closeQuietly; import static com.xebialabs.overthere.ConnectionOptions.*; import static com.xebialabs.overthere.util.ConsoleOverthereExecutionOutputHandler.syserrHandler; import static com.xebialabs.overthere.util.ConsoleOverthereExecutionOutputHandler.sysoutHandler; import static com.xebialabs.overthere.util.OverthereProcessOutputHandlerWrapper.wrapStderr; import static com.xebialabs.overthere.util.OverthereProcessOutputHandlerWrapper.wrapStdout; /** * A connection on a host (local or remote) on which to manipulate files and execute commands. * * All methods in this interface may throw a {@link com.xebialabs.overthere.RuntimeIOException} if an error occurs. * Checked {@link java.io.IOException IOExceptions} are never thrown. */ public abstract class BaseOverthereConnection implements OverthereConnection { protected final String protocol; protected final ConnectionOptions options; protected final AddressPortMapper mapper; protected final OperatingSystemFamily os; protected final int connectionTimeoutMillis; protected final String temporaryDirectoryPath; protected final boolean deleteTemporaryDirectoryOnDisconnect; protected final int temporaryFileCreationRetries; protected final boolean canStartProcess; protected OverthereFile connectionTemporaryDirectory; protected OverthereFile workingDirectory; protected Random random = new Random(); protected BaseOverthereConnection(final String protocol, final ConnectionOptions options, final AddressPortMapper mapper, final boolean canStartProcess) { this.protocol = checkNotNull(protocol, "Cannot create OverthereConnection with null protocol"); this.options = checkNotNull(options, "Cannot create OverthereConnection with null options"); this.mapper = checkNotNull(mapper, "Cannot create OverthereConnection with null addres-port mapper"); this.os = options.getEnum(OPERATING_SYSTEM, OperatingSystemFamily.class); this.connectionTimeoutMillis = options.getInteger(CONNECTION_TIMEOUT_MILLIS, DEFAULT_CONNECTION_TIMEOUT_MILLIS); this.temporaryDirectoryPath = options.get(TEMPORARY_DIRECTORY_PATH, os.getDefaultTemporaryDirectoryPath()); this.deleteTemporaryDirectoryOnDisconnect = options.getBoolean(TEMPORARY_DIRECTORY_DELETE_ON_DISCONNECT, DEFAULT_TEMPORARY_DIRECTORY_DELETE_ON_DISCONNECT); this.temporaryFileCreationRetries = options.getInteger(TEMPORARY_FILE_CREATION_RETRIES, DEFAULT_TEMPORARY_FILE_CREATION_RETRIES); this.canStartProcess = canStartProcess; } /** * Return the OS family of the host. * * @return the OS family */ @Override public OperatingSystemFamily getHostOperatingSystem() { return os; } /** * Closes the connection. Depending on the {@link ConnectionOptions#TEMPORARY_DIRECTORY_DELETE_ON_DISCONNECT} * connection option, deletes all temporary files that have been created on the host. */ @Override public final void close() { if (deleteTemporaryDirectoryOnDisconnect) { deleteConnectionTemporaryDirectory(); } doClose(); closeQuietly(mapper); logger.info("Disconnected from {}", this); } /** * To be overridden by a base class to implement connection specific disconnection logic. */ protected abstract void doClose(); /** * Creates a reference to a temporary file on the host. This file has a unique name and will be automatically * removed when this connection is closed. <b>N.B.:</b> The file is not actually created until a put method is * invoked. * * @param name * the name of the temporary file. May be <code>null</code>. * @return a reference to the temporary file on the host */ @Override public final OverthereFile getTempFile(String name) { if (isNullOrEmpty(name)) { name = "tmp"; } for (int i = 0; i <= temporaryFileCreationRetries; i++) { String infix = Long.toString(Math.abs(random.nextLong())); OverthereFile f = getFileForTempFile(getConnectionTemporaryDirectory(), infix); if (!f.exists()) { logger.trace("Creating holder directory [{}] for temporary file with name [{}]", f, name); f.mkdir(); OverthereFile t = f.getFile(name); logger.debug("Created temporary file [{}]", t); return t; } } throw new RuntimeIOException("Cannot generate a unique temporary file name on " + this); } /** * Creates a reference to a temporary file on the host. This file has a unique name and will be automatically * removed when this connection is closed. <b>N.B.:</b> The file is not actually created until a put method is * invoked. * * @param prefix * the prefix string to be used in generating the file's name; must be at least three characters long * @param suffix * the suffix string to be used in generating the file's name; may be <code>null</code>, in which case * the suffix ".tmp" will be used * @return a reference to the temporary file on the host */ @Override public final OverthereFile getTempFile(String prefix, String suffix) throws RuntimeIOException { if (prefix == null) throw new NullPointerException("prefix is null"); if (suffix == null) { suffix = ".tmp"; } return getTempFile(prefix + suffix); } private OverthereFile getConnectionTemporaryDirectory() throws RuntimeIOException { if (connectionTemporaryDirectory == null) { connectionTemporaryDirectory = createConnectionTemporaryDirectory(); } return connectionTemporaryDirectory; } private OverthereFile createConnectionTemporaryDirectory() { OverthereFile temporaryDirectory = getFile(temporaryDirectoryPath); DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmssSSS"); String prefix = "overthere-" + dateFormat.format(new Date()); String infix = ""; String suffix = ".tmp"; for (int i = 0; i < temporaryFileCreationRetries; i++) { OverthereFile tempDir = getFileForTempFile(temporaryDirectory, prefix + infix + suffix); if (!tempDir.exists()) { tempDir.mkdir(); logger.info("Created connection temporary directory {}", tempDir); return tempDir; } infix = "-" + Long.toString(Math.abs(random.nextLong())); } throw new RuntimeIOException("Cannot create connection temporary directory on " + this); } private void deleteConnectionTemporaryDirectory() { if (connectionTemporaryDirectory != null) { try { logger.info("Deleting connection temporary directory {}", connectionTemporaryDirectory); connectionTemporaryDirectory.deleteRecursively(); } catch (RuntimeException exc) { logger.warn("Got exception while deleting connection temporary directory {}. Ignoring it.", connectionTemporaryDirectory, exc); } } } /** * Invoked by {@link #getTempFile(String)} and {@link #createConnectionTemporaryDirectory()} to create an * {@link OverthereFile} object for a file or directory in the system or connection temporary directory. * * @param parent * parent of the file to create * @param name * name of the file to create. * @return the created file object */ protected abstract OverthereFile getFileForTempFile(OverthereFile parent, String name); /** * Returns the working directory. * * @return the working directory, may be <code>null</code>. */ @Override public OverthereFile getWorkingDirectory() { return workingDirectory; } /** * Returns the connection options used to construct this connection. * @return the connection options. */ public ConnectionOptions getOptions() { return options; } /** * Sets the working directory in which commands are executed. If set to <code>null</code>, the working directory * that is used depends on the connection implementation. * * @param workingDirectory * the working directory, may be <code>null</code>. */ @Override public void setWorkingDirectory(OverthereFile workingDirectory) { this.workingDirectory = workingDirectory; } @Override public final int execute(final CmdLine commandLine) { return execute(sysoutHandler(), syserrHandler(), commandLine); } @Override public int execute(final OverthereExecutionOutputHandler stdoutHandler, final OverthereExecutionOutputHandler stderrHandler, final CmdLine commandLine) { final OverthereProcess process = startProcess(commandLine); Thread stdoutReaderThread = null; Thread stderrReaderThread = null; final CountDownLatch latch = new CountDownLatch(2); try { stdoutReaderThread = getThread("stdout", commandLine.toString(), stdoutHandler, process.getStdout(), latch); stdoutReaderThread.start(); stderrReaderThread = getThread("stderr", commandLine.toString(), stderrHandler, process.getStderr(), latch); stderrReaderThread.start(); try { latch.await(); return process.waitFor(); } catch (InterruptedException exc) { Thread.currentThread().interrupt(); logger.info("Execution interrupted, destroying the process."); process.destroy(); throw new RuntimeIOException("Execution interrupted", exc); } } finally { quietlyJoinThread(stdoutReaderThread); quietlyJoinThread(stderrReaderThread); } } private void quietlyJoinThread(final Thread thread) { if (thread != null) { try { // interrupt the thread in case it is stuck waiting for output that will never come thread.interrupt(); thread.join(); } catch (InterruptedException ignored) { Thread.currentThread().interrupt(); } } } private Thread getThread(final String streamName, final String commandLine, final OverthereExecutionOutputHandler outputHandler, final InputStream stream, final CountDownLatch latch) { return new Thread(streamName + " reader thread for command " + commandLine + " on " + this) { @Override public void run() { StringBuilder lineBuffer = new StringBuilder(); InputStreamReader stdoutReader = new InputStreamReader(stream); latch.countDown(); try { int cInt = stdoutReader.read(); while (cInt > -1) { char c = (char) cInt; outputHandler.handleChar(c); if (c != '\r' && c != '\n') { lineBuffer.append(c); } if (c == '\n') { outputHandler.handleLine(lineBuffer.toString()); lineBuffer.setLength(0); } cInt = stdoutReader.read(); } } catch (Exception exc) { logger.error("An exception occured while reading from " + streamName, exc); } finally { closeQuietly(stdoutReader); if (lineBuffer.length() > 0) { outputHandler.handleLine(lineBuffer.toString()); } } } }; } /** * Executes a command with its arguments. * * @param handler * the handler that will be invoked when the executed command generated output. * @param commandLine * the command line to execute. * @return the exit value of the executed command. Usually 0 on successful execution. * @deprecated use {@link BaseOverthereConnection#execute(com.xebialabs.overthere.OverthereExecutionOutputHandler, com.xebialabs.overthere.OverthereExecutionOutputHandler, com.xebialabs.overthere.CmdLine)} */ @Override public final int execute(final OverthereProcessOutputHandler handler, final CmdLine commandLine) { return execute(wrapStdout(handler), wrapStderr(handler), commandLine); } /** * Starts a command with its argument and returns control to the caller. * * @param commandLine * the command line to execute. * @return an object representing the executing command or <tt>null</tt> if this is not supported by the host * connection. */ @Override public OverthereProcess startProcess(CmdLine commandLine) { throw new UnsupportedOperationException("Cannot start a process on " + this); } /** * Checks whether a process can be started on this connection. * * @return <code>true</code> if a process can be started on this connection, <code>false</code> otherwise */ @Override public final boolean canStartProcess() { return canStartProcess; } /** * Subclasses MUST implement toString properly. */ @Override public abstract String toString(); private static Logger logger = LoggerFactory.getLogger(BaseOverthereConnection.class); }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
61f99640236f489f0c450c2340430afbc34b0887
4d161a4ffb1dd12ddd850bf5e3bbd70a886be83e
/Debug/src/com/itheima/DebugTest02.java
415e789eee803264b74860b4f79062b9d8158bb5
[]
no_license
wantairanwtr/heima
d70c13db762dfe4ad687ae4967a4c8906786f45d
6367467f5a8e9afbf7d2c4bb4c089aa0c036d4dd
refs/heads/master
2023-09-01T15:16:39.892679
2021-10-22T05:41:03
2021-10-22T05:41:03
406,267,497
0
0
null
null
null
null
UTF-8
Java
false
false
546
java
package com.itheima; import java.util.Scanner; public class DebugTest02 { public static void main(String[] args) { Scanner in=new Scanner(System.in); System.out.println("输入第一个整数"); int a=in.nextInt(); System.out.println("输入第二个数"); int b=in.nextInt(); int max=getMax(a,b); System.out.println("较大的值是"+max); } public static int getMax(int a,int b){ if(a>b){ return a; }else{ return b; } } }
[ "email" ]
email
9d272104064a0146539d6b2c9c6dd31c2b156ec5
2bc2eadc9b0f70d6d1286ef474902466988a880f
/tags/mule-2.0.0/core/src/main/java/org/mule/transformer/compression/GZipUncompressTransformer.java
7b7029ec13de827e43e56f91b9d020a5db9dd416
[]
no_license
OrgSmells/codehaus-mule-git
085434a4b7781a5def2b9b4e37396081eaeba394
f8584627c7acb13efdf3276396015439ea6a0721
refs/heads/master
2022-12-24T07:33:30.190368
2020-02-27T19:10:29
2020-02-27T19:10:29
243,593,543
0
0
null
2022-12-15T23:30:00
2020-02-27T18:56:48
null
UTF-8
Java
false
false
1,901
java
/* * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.compression; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.MessageFactory; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import org.apache.commons.lang.SerializationUtils; /** * <code>GZipCompressTransformer</code> TODO */ public class GZipUncompressTransformer extends GZipCompressTransformer { public GZipUncompressTransformer() { super(); } // @Override public Object doTransform(Object src, String encoding) throws TransformerException { byte[] buffer = null; try { byte[] input = null; if (src instanceof InputStream) { InputStream inputStream = (InputStream)src; try { input = IOUtils.toByteArray(inputStream); } finally { inputStream.close(); } } else { input = (byte[])src; } buffer = getStrategy().uncompressByteArray(input); } catch (IOException e) { throw new TransformerException( MessageFactory.createStaticMessage("Failed to uncompress message."), this, e); } if (!getReturnClass().equals(byte[].class)) { return SerializationUtils.deserialize(buffer); } return buffer; } }
[ "dirk.olmes@bf997673-6b11-0410-b953-e057580c5b09" ]
dirk.olmes@bf997673-6b11-0410-b953-e057580c5b09
f7935e8751ffa388f83ddbd18f4a18ea4484e720
819234c6f19e758a10c97491efaf5580a6474ce6
/android/src/main/java/com/pouchen/react/webview/ReactWebViewManager.java
528dfcd1f0a53706301467a55b51f18f50a6a3a3
[]
no_license
randy-yang/react-native-custom-webview
be9bf79de5d9c9c68347090000154b2c13c94f35
bb22b01837c4a21425d230cc5b807bbea53f3377
refs/heads/master
2020-08-17T16:42:09.086913
2019-10-18T11:46:10
2019-10-18T11:46:10
215,688,486
0
0
null
null
null
null
UTF-8
Java
false
false
23,056
java
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ package com.pouchen.react.webview; import javax.annotation.Nullable; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import java.util.Locale; import java.util.Map; import android.content.ActivityNotFoundException; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Picture; import android.net.Uri; import android.os.Build; import android.text.TextUtils; import android.util.Log; import android.view.ViewGroup.LayoutParams; import android.webkit.ConsoleMessage; import android.webkit.GeolocationPermissions; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; import android.webkit.JavascriptInterface; import android.webkit.ValueCallback; import android.webkit.WebSettings; import android.webkit.CookieManager; import android.webkit.HttpAuthHandler; import com.facebook.common.logging.FLog; import com.facebook.react.common.ReactConstants; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.LifecycleEventListener; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.ReadableMapKeySetIterator; import com.facebook.react.bridge.WritableMap; import com.facebook.react.common.MapBuilder; import com.facebook.react.common.build.ReactBuildConfig; import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.events.ContentSizeChangeEvent; import com.facebook.react.uimanager.events.Event; import com.facebook.react.uimanager.events.EventDispatcher; import com.pouchen.react.webview.events.TopLoadingErrorEvent; import com.pouchen.react.webview.events.TopLoadingFinishEvent; import com.pouchen.react.webview.events.TopLoadingStartEvent; import com.pouchen.react.webview.events.TopMessageEvent; import org.json.JSONObject; import org.json.JSONException; /** * Manages instances of {@link WebView} * * Can accept following commands: * - GO_BACK * - GO_FORWARD * - RELOAD * * {@link WebView} instances could emit following direct events: * - topLoadingFinish * - topLoadingStart * - topLoadingError * * Each event will carry the following properties: * - target - view's react tag * - url - url set for the webview * - loading - whether webview is in a loading state * - title - title of the current page * - canGoBack - boolean, whether there is anything on a history stack to go back * - canGoForward - boolean, whether it is possible to request GO_FORWARD command */ @ReactModule(name = ReactWebViewManager.REACT_CLASS) public class ReactWebViewManager extends SimpleViewManager<WebView> { protected static final String REACT_CLASS = "PCCWebView"; protected static final String HTML_ENCODING = "UTF-8"; protected static final String HTML_MIME_TYPE = "text/html"; protected static final String BRIDGE_NAME = "__REACT_WEB_VIEW_BRIDGE"; protected static final String HTTP_METHOD_POST = "POST"; public static final int COMMAND_GO_BACK = 1; public static final int COMMAND_GO_FORWARD = 2; public static final int COMMAND_RELOAD = 3; public static final int COMMAND_STOP_LOADING = 4; public static final int COMMAND_POST_MESSAGE = 5; public static final int COMMAND_INJECT_JAVASCRIPT = 6; // Use `webView.loadUrl("about:blank")` to reliably reset the view // state and release page resources (including any running JavaScript). protected static final String BLANK_URL = "about:blank"; protected WebViewConfig mWebViewConfig; protected @Nullable WebView.PictureListener mPictureListener; protected static String username; protected static String password; protected static class ReactWebViewClient extends WebViewClient { protected boolean mLastLoadFailed = false; protected @Nullable ReadableArray mUrlPrefixesForDefaultIntent; @Override public void onPageFinished(WebView webView, String url) { super.onPageFinished(webView, url); if (!mLastLoadFailed) { ReactWebView reactWebView = (ReactWebView) webView; reactWebView.callInjectedJavaScript(); reactWebView.linkBridge(); emitFinishEvent(webView, url); } } @Override public void onPageStarted(WebView webView, String url, Bitmap favicon) { super.onPageStarted(webView, url, favicon); mLastLoadFailed = false; dispatchEvent( webView, new TopLoadingStartEvent( webView.getId(), createWebViewEvent(webView, url))); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { boolean useDefaultIntent = false; if (mUrlPrefixesForDefaultIntent != null && mUrlPrefixesForDefaultIntent.size() > 0) { ArrayList<Object> urlPrefixesForDefaultIntent = mUrlPrefixesForDefaultIntent.toArrayList(); for (Object urlPrefix : urlPrefixesForDefaultIntent) { if (url.startsWith((String) urlPrefix)) { useDefaultIntent = true; break; } } } if (!useDefaultIntent && (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("file://") || url.equals("about:blank"))) { return false; } else { try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); view.getContext().startActivity(intent); } catch (ActivityNotFoundException e) { FLog.w(ReactConstants.TAG, "activity not found to handle uri scheme for: " + url, e); } return true; } } @Override public void onReceivedError( WebView webView, int errorCode, String description, String failingUrl) { super.onReceivedError(webView, errorCode, description, failingUrl); mLastLoadFailed = true; // In case of an error JS side expect to get a finish event first, and then get an error event // Android WebView does it in the opposite way, so we need to simulate that behavior emitFinishEvent(webView, failingUrl); WritableMap eventData = createWebViewEvent(webView, failingUrl); eventData.putDouble("code", errorCode); eventData.putString("description", description); dispatchEvent( webView, new TopLoadingErrorEvent(webView.getId(), eventData)); } protected void emitFinishEvent(WebView webView, String url) { dispatchEvent( webView, new TopLoadingFinishEvent( webView.getId(), createWebViewEvent(webView, url))); } protected WritableMap createWebViewEvent(WebView webView, String url) { WritableMap event = Arguments.createMap(); event.putDouble("target", webView.getId()); // Don't use webView.getUrl() here, the URL isn't updated to the new value yet in callbacks // like onPageFinished event.putString("url", url); event.putBoolean("loading", !mLastLoadFailed && webView.getProgress() != 100); event.putString("title", webView.getTitle()); event.putBoolean("canGoBack", webView.canGoBack()); event.putBoolean("canGoForward", webView.canGoForward()); return event; } public void setUrlPrefixesForDefaultIntent(ReadableArray specialUrls) { mUrlPrefixesForDefaultIntent = specialUrls; } @Override public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { // super.onReceivedHttpAuthRequest(view, handler, host, realm); if (username != null) { handler.proceed(username, password); } } } /** * Subclass of {@link WebView} that implements {@link LifecycleEventListener} interface in order * to call {@link WebView#destroy} on activty destroy event and also to clear the client */ protected static class ReactWebView extends WebView implements LifecycleEventListener { protected @Nullable String injectedJS; protected boolean messagingEnabled = false; protected @Nullable ReactWebViewClient mReactWebViewClient; protected class ReactWebViewBridge { ReactWebView mContext; ReactWebViewBridge(ReactWebView c) { mContext = c; } @JavascriptInterface public void postMessage(String message) { mContext.onMessage(message); } } /** * WebView must be created with an context of the current activity * * Activity Context is required for creation of dialogs internally by WebView * Reactive Native needed for access to ReactNative internal system functionality * */ public ReactWebView(ThemedReactContext reactContext) { super(reactContext); } @Override public void onHostResume() { // do nothing } @Override public void onHostPause() { // do nothing } @Override public void onHostDestroy() { cleanupCallbacksAndDestroy(); } @Override public void setWebViewClient(WebViewClient client) { if (client == null) { // super.setWebViewClient(null); // 用 new WebViewClient() 取代 null // 設成 null 的話,有時候會跳出 new browser,對公發機來說會造成安全問題 super.setWebViewClient(new WebViewClient()); mReactWebViewClient = null; } else { super.setWebViewClient(client); mReactWebViewClient = (ReactWebViewClient)client; } } public @Nullable ReactWebViewClient getReactWebViewClient() { return mReactWebViewClient; } public void setInjectedJavaScript(@Nullable String js) { injectedJS = js; } protected ReactWebViewBridge createReactWebViewBridge(ReactWebView webView) { return new ReactWebViewBridge(webView); } public void setMessagingEnabled(boolean enabled) { if (messagingEnabled == enabled) { return; } messagingEnabled = enabled; if (enabled) { addJavascriptInterface(createReactWebViewBridge(this), BRIDGE_NAME); linkBridge(); } else { removeJavascriptInterface(BRIDGE_NAME); } } public void callInjectedJavaScript() { if (getSettings().getJavaScriptEnabled() && injectedJS != null && !TextUtils.isEmpty(injectedJS)) { loadUrl("javascript:(function() {\n" + injectedJS + ";\n})();"); } } public void linkBridge() { if (messagingEnabled) { if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // See isNative in lodash String testPostMessageNative = "String(window.postMessage) === String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage')"; evaluateJavascript(testPostMessageNative, new ValueCallback<String>() { @Override public void onReceiveValue(String value) { if (value.equals("true")) { FLog.w(ReactConstants.TAG, "Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined"); } } }); } loadUrl("javascript:(" + "window.originalPostMessage = window.postMessage," + "window.postMessage = function(data) {" + BRIDGE_NAME + ".postMessage(String(data));" + "}" + ")"); } } public void onMessage(String message) { dispatchEvent(this, new TopMessageEvent(this.getId(), message)); } protected void cleanupCallbacksAndDestroy() { setWebViewClient(null); destroy(); } } public ReactWebViewManager() { mWebViewConfig = new WebViewConfig() { public void configWebView(WebView webView) { } }; } public ReactWebViewManager(WebViewConfig webViewConfig) { mWebViewConfig = webViewConfig; } @Override public String getName() { return REACT_CLASS; } protected ReactWebView createReactWebViewInstance(ThemedReactContext reactContext) { return new ReactWebView(reactContext); } @Override protected WebView createViewInstance(ThemedReactContext reactContext) { ReactWebView webView = createReactWebViewInstance(reactContext); webView.setWebChromeClient(new WebChromeClient() { @Override public boolean onConsoleMessage(ConsoleMessage message) { if (ReactBuildConfig.DEBUG) { return super.onConsoleMessage(message); } // Ignore console logs in non debug builds. return true; } @Override public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { callback.invoke(origin, true, false); } }); reactContext.addLifecycleEventListener(webView); mWebViewConfig.configWebView(webView); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setDisplayZoomControls(false); webView.getSettings().setDomStorageEnabled(true); // Fixes broken full-screen modals/galleries due to body height being 0. webView.setLayoutParams( new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WebView.setWebContentsDebuggingEnabled(true); } return webView; } @ReactProp(name = "javaScriptEnabled") public void setJavaScriptEnabled(WebView view, boolean enabled) { view.getSettings().setJavaScriptEnabled(enabled); } @ReactProp(name = "thirdPartyCookiesEnabled") public void setThirdPartyCookiesEnabled(WebView view, boolean enabled) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().setAcceptThirdPartyCookies(view, enabled); } } @ReactProp(name = "scalesPageToFit") public void setScalesPageToFit(WebView view, boolean enabled) { view.getSettings().setUseWideViewPort(!enabled); } @ReactProp(name = "domStorageEnabled") public void setDomStorageEnabled(WebView view, boolean enabled) { view.getSettings().setDomStorageEnabled(enabled); } @ReactProp(name = "userAgent") public void setUserAgent(WebView view, @Nullable String userAgent) { if (userAgent != null) { // TODO(8496850): Fix incorrect behavior when property is unset (uA == null) view.getSettings().setUserAgentString(userAgent); } } @ReactProp(name = "mediaPlaybackRequiresUserAction") public void setMediaPlaybackRequiresUserAction(WebView view, boolean requires) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { view.getSettings().setMediaPlaybackRequiresUserGesture(requires); } } @ReactProp(name = "allowUniversalAccessFromFileURLs") public void setAllowUniversalAccessFromFileURLs(WebView view, boolean allow) { view.getSettings().setAllowUniversalAccessFromFileURLs(allow); } @ReactProp(name = "saveFormDataDisabled") public void setSaveFormDataDisabled(WebView view, boolean disable) { view.getSettings().setSaveFormData(!disable); } @ReactProp(name = "injectedJavaScript") public void setInjectedJavaScript(WebView view, @Nullable String injectedJavaScript) { ((ReactWebView) view).setInjectedJavaScript(injectedJavaScript); } @ReactProp(name = "messagingEnabled") public void setMessagingEnabled(WebView view, boolean enabled) { ((ReactWebView) view).setMessagingEnabled(enabled); } @ReactProp(name = "source") public void setSource(WebView view, @Nullable ReadableMap source) { if (source != null) { if (source.hasKey("html")) { String html = source.getString("html"); if (source.hasKey("baseUrl")) { view.loadDataWithBaseURL( source.getString("baseUrl"), html, HTML_MIME_TYPE, HTML_ENCODING, null); } else { view.loadData(html, HTML_MIME_TYPE, HTML_ENCODING); } return; } if (source.hasKey("uri")) { String url = source.getString("uri"); String previousUrl = view.getUrl(); if (previousUrl != null && previousUrl.equals(url)) { return; } if (source.hasKey("method")) { String method = source.getString("method"); if (method.equals(HTTP_METHOD_POST)) { byte[] postData = null; if (source.hasKey("body")) { String body = source.getString("body"); try { postData = body.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { postData = body.getBytes(); } } if (postData == null) { postData = new byte[0]; } view.postUrl(url, postData); return; } } HashMap<String, String> headerMap = new HashMap<>(); if (source.hasKey("headers")) { ReadableMap headers = source.getMap("headers"); ReadableMapKeySetIterator iter = headers.keySetIterator(); while (iter.hasNextKey()) { String key = iter.nextKey(); if ("user-agent".equals(key.toLowerCase(Locale.ENGLISH))) { if (view.getSettings() != null) { view.getSettings().setUserAgentString(headers.getString(key)); } } else { headerMap.put(key, headers.getString(key)); } } } if (source.hasKey("username")) { username = source.getString("username"); password = source.getString("password"); } view.loadUrl(url, headerMap); return; } } view.loadUrl(BLANK_URL); } @ReactProp(name = "onContentSizeChange") public void setOnContentSizeChange(WebView view, boolean sendContentSizeChangeEvents) { if (sendContentSizeChangeEvents) { view.setPictureListener(getPictureListener()); } else { view.setPictureListener(null); } } @ReactProp(name = "mixedContentMode") public void setMixedContentMode(WebView view, @Nullable String mixedContentMode) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (mixedContentMode == null || "never".equals(mixedContentMode)) { view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW); } else if ("always".equals(mixedContentMode)) { view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } else if ("compatibility".equals(mixedContentMode)) { view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE); } } } @ReactProp(name = "urlPrefixesForDefaultIntent") public void setUrlPrefixesForDefaultIntent( WebView view, @Nullable ReadableArray urlPrefixesForDefaultIntent) { ReactWebViewClient client = ((ReactWebView) view).getReactWebViewClient(); if (client != null && urlPrefixesForDefaultIntent != null) { client.setUrlPrefixesForDefaultIntent(urlPrefixesForDefaultIntent); } } @Override protected void addEventEmitters(ThemedReactContext reactContext, WebView view) { // Do not register default touch emitter and let WebView implementation handle touches view.setWebViewClient(new ReactWebViewClient()); } @Override public @Nullable Map<String, Integer> getCommandsMap() { return MapBuilder.of( "goBack", COMMAND_GO_BACK, "goForward", COMMAND_GO_FORWARD, "reload", COMMAND_RELOAD, "stopLoading", COMMAND_STOP_LOADING, "postMessage", COMMAND_POST_MESSAGE, "injectJavaScript", COMMAND_INJECT_JAVASCRIPT ); } @Override public void receiveCommand(WebView root, int commandId, @Nullable ReadableArray args) { switch (commandId) { case COMMAND_GO_BACK: root.goBack(); break; case COMMAND_GO_FORWARD: root.goForward(); break; case COMMAND_RELOAD: root.reload(); break; case COMMAND_STOP_LOADING: root.stopLoading(); break; case COMMAND_POST_MESSAGE: try { JSONObject eventInitDict = new JSONObject(); eventInitDict.put("data", args.getString(0)); root.loadUrl("javascript:(function () {" + "var event;" + "var data = " + eventInitDict.toString() + ";" + "try {" + "event = new MessageEvent('message', data);" + "} catch (e) {" + "event = document.createEvent('MessageEvent');" + "event.initMessageEvent('message', true, true, data.data, data.origin, data.lastEventId, data.source);" + "}" + "document.dispatchEvent(event);" + "})();"); } catch (JSONException e) { throw new RuntimeException(e); } break; case COMMAND_INJECT_JAVASCRIPT: root.loadUrl("javascript:" + args.getString(0)); break; } } @Override public void onDropViewInstance(WebView webView) { super.onDropViewInstance(webView); ((ThemedReactContext) webView.getContext()).removeLifecycleEventListener((ReactWebView) webView); ((ReactWebView) webView).cleanupCallbacksAndDestroy(); } protected WebView.PictureListener getPictureListener() { if (mPictureListener == null) { mPictureListener = new WebView.PictureListener() { @Override public void onNewPicture(WebView webView, Picture picture) { dispatchEvent( webView, new ContentSizeChangeEvent( webView.getId(), webView.getWidth(), webView.getContentHeight())); } }; } return mPictureListener; } protected static void dispatchEvent(WebView webView, Event event) { ReactContext reactContext = (ReactContext) webView.getContext(); EventDispatcher eventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher(); eventDispatcher.dispatchEvent(event); } }
[ "randyy1988@gmail.com" ]
randyy1988@gmail.com
ace5a36d56f58606992cad5353ed3622da5b3e75
0f2d15e30082f1f45c51fdadc3911472223e70e0
/src/3.7/plugins/com.perforce.team.core/p4java/src/main/java/com/perforce/p4java/impl/mapbased/server/cmd/CommitDelegator.java
e0651238110cebfc185588ce33563dd7e8fea9e3
[ "BSD-2-Clause" ]
permissive
eclipseguru/p4eclipse
a28de6bd211df3009d58f3d381867d574ee63c7a
7f91b7daccb2a15e752290c1f3399cc4b6f4fa54
refs/heads/master
2022-09-04T05:50:25.271301
2022-09-01T12:47:06
2022-09-01T12:47:06
136,226,938
2
1
BSD-2-Clause
2022-09-01T19:42:29
2018-06-05T19:45:54
Java
UTF-8
Java
false
false
7,426
java
package com.perforce.p4java.impl.mapbased.server.cmd; import com.perforce.p4java.Log; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.graph.CommitAction; import com.perforce.p4java.graph.ICommit; import com.perforce.p4java.graph.IGraphObject; import com.perforce.p4java.impl.generic.graph.Commit; import com.perforce.p4java.impl.generic.graph.GraphObject; import com.perforce.p4java.impl.mapbased.server.Parameters; import com.perforce.p4java.option.server.GraphCommitLogOptions; import com.perforce.p4java.server.CmdSpec; import com.perforce.p4java.server.IOptionsServer; import com.perforce.p4java.server.delegator.ICommitDelegator; import java.io.InputStream; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import static com.perforce.p4java.common.base.P4JavaExceptions.throwRequestExceptionIfConditionFails; import static com.perforce.p4java.common.base.P4ResultMapUtils.parseCode0ErrorString; import static com.perforce.p4java.common.base.P4ResultMapUtils.parseDataList; import static com.perforce.p4java.common.base.P4ResultMapUtils.parseLong; import static com.perforce.p4java.common.base.P4ResultMapUtils.parseString; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.ACTION; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.AUTHOR; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.AUTHOR_EMAIL; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.COMMIT; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.COMMITTER; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.COMMITTER_DATE; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.COMMITTER_EMAIL; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.DATE; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.GRAPH_DESC; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.PARENT; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.SHA; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.TREE; import static com.perforce.p4java.impl.mapbased.rpc.func.RpcFunctionMapKey.TYPE; import static com.perforce.p4java.server.CmdSpec.GRAPH; import static java.util.Objects.nonNull; import static org.apache.commons.lang3.StringUtils.isBlank; public class CommitDelegator extends BaseDelegator implements ICommitDelegator { /** * Instantiates a new graph commit delegator. * * @param server the server */ public CommitDelegator(final IOptionsServer server) { super(server); } @Override public ICommit getCommitObject(String sha) throws P4JavaException { List<Map<String, Object>> resultMaps = execMapCmdList( GRAPH, Parameters.processParameters( null, null, new String[]{"cat-file", "commit", sha}, server), null); List<ICommit> commits = parseCommitList(resultMaps); // should only return a single result if(commits != null && !commits.isEmpty()) { return commits.get(0); } return null; } @Override public ICommit getCommitObject(String sha, String repo) throws P4JavaException { List<Map<String, Object>> resultMaps = execMapCmdList( GRAPH, Parameters.processParameters( null, null, new String[]{"cat-file", "-n", repo, "commit", sha}, server), null); List<ICommit> commits = parseCommitList(resultMaps); // should only return a single result if(commits != null && !commits.isEmpty()) { return commits.get(0); } return null; } @Override public InputStream getBlobObject(String repo, String sha) throws P4JavaException { InputStream inputStream = execStreamCmd( GRAPH, Parameters.processParameters( null, null, new String[]{"cat-file", "-n", repo, "blob", sha}, server) ); return inputStream; } @Override public IGraphObject getGraphObject(String sha) throws P4JavaException { List<Map<String, Object>> resultMaps = execMapCmdList( CmdSpec.GRAPH, Parameters.processParameters( null, null, new String[]{"cat-file", "-t", sha}, server), null); if (!nonNull(resultMaps)) { return null; } String rsha = null; String type = null; for (Map<String, Object> map : resultMaps) { if (nonNull(map)) { // Check for errors ResultMapParser.handleErrorStr(map); String errStr = ResultMapParser.getErrorStr(map); throwRequestExceptionIfConditionFails(isBlank(errStr), parseCode0ErrorString(map), errStr); try { if (map.containsKey(SHA)) { rsha = parseString(map, SHA); } if (map.containsKey(TYPE)) { type = parseString(map, TYPE); } } catch (Throwable thr) { Log.exception(thr); } } } return new GraphObject(rsha, type); } /** * Returns a List<IGraphCommitLog> encapsulating a commit logs which holds the * data retrieved as part of the 'p4 graph log -n command' * * @param options Various options supported by the command * @return List<IGraphCommitLog> * @throws P4JavaException */ @Override public List<ICommit> getGraphCommitLogList(GraphCommitLogOptions options) throws P4JavaException { List<Map<String, Object>> resultMaps = execMapCmdList( GRAPH, Parameters.processParameters(options, server), null); if (!nonNull(resultMaps)) { return null; } return parseCommitList(resultMaps); } private List<ICommit> parseCommitList(List<Map<String, Object>> resultMaps) throws P4JavaException { List<ICommit> list = new ArrayList<>(); if (!nonNull(resultMaps)) { return null; } for (Map<String, Object> map : resultMaps) { String commit = null; String tree = null; CommitAction action = CommitAction.UNKNOWN; List<String> parent = new ArrayList<>(); String author = null; String authorEmail = null; Date date = null; String committer = null; String committerEmail = null; Date committerDate = null; String description = null; if (!nonNull(map) || map.isEmpty()) { return null; } // Check for errors ResultMapParser.handleErrorStr(map); try { if (map.containsKey(COMMIT)) { commit = parseString(map, COMMIT); } if (map.containsKey(TREE)) { tree = parseString(map, TREE); } if (map.containsKey(ACTION)) { action = CommitAction.parse(parseString(map, ACTION)); } parent = parseDataList(map, PARENT); if (map.containsKey(AUTHOR)) { author = parseString(map, AUTHOR); } if (map.containsKey(AUTHOR_EMAIL)) { authorEmail = parseString(map, AUTHOR_EMAIL); } if (map.containsKey(DATE)) { date = new Date(parseLong(map, DATE) * 1000); } if (map.containsKey(COMMITTER)) { committer = parseString(map, COMMITTER); } if (map.containsKey(COMMITTER_EMAIL)) { committerEmail = parseString(map, COMMITTER_EMAIL); } if (map.containsKey(COMMITTER_DATE)) { committerDate = new Date(parseLong(map, COMMITTER_DATE) * 1000); } if (map.containsKey(GRAPH_DESC)) { description = parseString(map, GRAPH_DESC); } } catch (Throwable thr) { Log.exception(thr); } Commit entry = new Commit(commit, tree, action, parent, author, authorEmail, date, committer, committerEmail, committerDate, description); list.add(entry); } return list; } }
[ "gunnar@wagenknecht.org" ]
gunnar@wagenknecht.org
630401c8251c94b7c0c6dd44892c9e78ea8312b5
07dbf225cb4e938ce770f10e1798607737f1307d
/src/main/java/com/leetcode/design/DesignPhoneDirectory_Leetcode379.java
9163c3e719735d14b40b932dd6f3ccd1e7dd1ee8
[]
no_license
lhcxx/leetcode
df176cbcd613ac2da96ab151a8ace7fce1399e99
69ce326efee0dd609adc77ffe9e446d892bc079b
refs/heads/master
2021-06-08T22:51:32.327590
2020-10-15T08:09:26
2020-10-15T08:09:26
142,803,659
0
1
null
null
null
null
UTF-8
Java
false
false
725
java
package com.leetcode.design; import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; /** * Created by lhcxx on 18/10/26. */ public class DesignPhoneDirectory_Leetcode379 { private HashSet<Integer> used = new HashSet<>(); private Queue<Integer> queue = new LinkedList<>(); int max; public DesignPhoneDirectory_Leetcode379(int n) { max = n; for (int i = 0; i < n; i++) queue.offer(i); } public int get() { Integer res = queue.poll(); if (res == null) return -1; used.add(res); return res; } public boolean check(int n) { if (n >= max || n < 0) return false; return !used.contains(n); } public void release(int n) { if (used.remove(n)) queue.offer(n); } }
[ "huichun.lu@intel.com" ]
huichun.lu@intel.com
25ff2247b1d809c40c823bb17303af5bb28b1add
5324fc7508141d85a4ade65b0552ab58aaeedb33
/candies.java
a38b10df77bf0fd281adba296859aafd0c101fd3
[]
no_license
NandaBalakrishnan/Sample_Programming
5b130c64676225e53a634ef3f5d9426e8aab869a
d2ab4494d9e9e4f96e3bd8086909708bc6490316
refs/heads/master
2021-06-02T17:38:23.224511
2016-09-27T06:24:41
2016-09-27T06:24:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
968
java
import java.util.*; public class candies { public static void main(String ar[])throws Exception { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int res; int rat[]=new rat[n]; for(int i=0;i<n;i++) rat[i]=sc.nextInt(); res=candies.candy(rat); System.out.println("minimum number of candies is:"+res); } public int candy(int[] ratings) { if (ratings == null || ratings.length == 0) { return 0; } int[] candies = new int[ratings.length]; candies[0] = 1; //from let to right for (int i = 1; i < ratings.length; i++) { if (ratings[i] > ratings[i - 1]) { candies[i] = candies[i - 1] + 1; } else { // if not ascending, assign 1 candies[i] = 1; } } int result = candies[ratings.length - 1]; //from right to left for (int i = ratings.length - 2; i >= 0; i--) { int cur = 1; if (ratings[i] > ratings[i + 1]) { cur = candies[i + 1] + 1; } result += Math.max(cur, candies[i]); candies[i] = cur; } return result; } }
[ "nandathoomathy@gmail.com" ]
nandathoomathy@gmail.com
472f5c1e1f58dbc8d55a26107e015ae49b4f8f7e
a2753b177335ca9ee647cd862c9d21b824e0f4c6
/src/main/java/edu/arizona/biosemantics/etcsite/client/content/settings/SettingsView.java
a64d997d056c180ea53b5f0f370c3f297ee37438
[]
no_license
rodenhausen/otoLiteFromEtcIntegration
d6d339cbca23512a453d7128e1375914e8177e5b
9b33cd4bd1667e2657d931591ba2866bf97d3d63
refs/heads/master
2016-09-05T15:48:19.048749
2014-08-20T02:23:07
2014-08-20T02:23:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,488
java
package edu.arizona.biosemantics.etcsite.client.content.settings; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.uibinder.client.UiTemplate; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.PasswordTextBox; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.Widget; import edu.arizona.biosemantics.etcsite.shared.db.User; public class SettingsView extends Composite implements ISettingsView { private static SettingsViewUiBinder uiBinder = GWT.create(SettingsViewUiBinder.class); @UiTemplate("SettingsView.ui.xml") interface SettingsViewUiBinder extends UiBinder<Widget, SettingsView> {} @UiField Button submitButton; @UiField TextBox firstNameBox; @UiField TextBox lastNameBox; @UiField TextBox emailBox; @UiField TextBox affiliationBox; @UiField TextBox bioportalUserIdBox; @UiField TextBox bioportalAPIKeyBox; @UiField PasswordTextBox oldPasswordBox; @UiField PasswordTextBox newPasswordBox; @UiField PasswordTextBox confirmNewPasswordBox; @UiField Label idLabel; @UiField Label errorLabel; private Presenter presenter; private final int FIELD_WIDTH = 180; private User user; public SettingsView() { initWidget(uiBinder.createAndBindUi(this)); firstNameBox.setPixelSize(FIELD_WIDTH, 14); lastNameBox.setPixelSize(FIELD_WIDTH, 14); emailBox.setPixelSize(FIELD_WIDTH, 14); affiliationBox.setPixelSize(FIELD_WIDTH, 14); bioportalUserIdBox.setPixelSize(FIELD_WIDTH, 14); bioportalAPIKeyBox.setPixelSize(FIELD_WIDTH, 14); oldPasswordBox.setPixelSize(FIELD_WIDTH, 14); newPasswordBox.setPixelSize(FIELD_WIDTH, 14); confirmNewPasswordBox.setPixelSize(FIELD_WIDTH, 14); } @UiHandler("submitButton") void onClick(ClickEvent e) { presenter.onSubmit(); } @Override public void setPresenter(Presenter presenter) { this.presenter = presenter; } @Override public void setData(User user){ firstNameBox.setText(user.getFirstName()); lastNameBox.setText(user.getLastName()); idLabel.setText(user.getOpenIdProviderId()); emailBox.setText(user.getEmail()); affiliationBox.setText(user.getAffiliation()); bioportalUserIdBox.setText(user.getBioportalUserId()); bioportalAPIKeyBox.setText(user.getBioportalAPIKey()); oldPasswordBox.setText(""); newPasswordBox.setText(""); confirmNewPasswordBox.setText(""); firstNameBox.setEnabled(true); lastNameBox.setEnabled(true); emailBox.setEnabled(true); affiliationBox.setEnabled(true); bioportalUserIdBox.setEnabled(true); bioportalAPIKeyBox.setEnabled(true); oldPasswordBox.setEnabled(true); newPasswordBox.setEnabled(true); confirmNewPasswordBox.setEnabled(true); this.user = user; if (!user.getOpenIdProvider().equals("none")){ firstNameBox.setEnabled(false); lastNameBox.setEnabled(false); oldPasswordBox.setText(user.getPassword()); oldPasswordBox.setEnabled(false); newPasswordBox.setEnabled(false); confirmNewPasswordBox.setEnabled(false); } } @Override public void setErrorMessage(String str){ errorLabel.setText(str); } @Override public void clearPasswords() { oldPasswordBox.setText(""); newPasswordBox.setText(""); confirmNewPasswordBox.setText(""); } @Override public String getFirstName() { return firstNameBox.getText(); } @Override public String getLastName() { return lastNameBox.getText(); } @Override public String getOpenIdProviderId(){ return idLabel.getText(); } @Override public String getEmail() { return emailBox.getText(); } @Override public String getAffiliation() { return affiliationBox.getText(); } @Override public String getBioportalUserId() { return bioportalUserIdBox.getText(); } @Override public String getBioportalAPIKey() { return bioportalAPIKeyBox.getText(); } @Override public String getOldPassword() { return oldPasswordBox.getText(); } @Override public String getNewPassword() { return newPasswordBox.getText(); } @Override public String getConfirmNewPassword() { return confirmNewPasswordBox.getText(); } @Override public String getOpenIdProvider() { return user.getOpenIdProvider(); } }
[ "thomas.rodenhausen@gmail.com" ]
thomas.rodenhausen@gmail.com
dc54d816d0e6dc8a1d7d6da8f8f50c8a0658b324
35c8958052c2f15a3ac99d59198cb007195eb407
/Patients/PatientsList.java
fc1f8c9ff20ad718f5c53e351f773c25008cea7a
[]
no_license
ahmed14642/dataStructures
d174aa4cf52e41dc6d36c9cdcca36073d121e2c3
6655cc50f3cfc1b0bfe84f3ac4633b19e104ebfa
refs/heads/master
2020-03-29T00:17:17.020287
2018-09-18T18:29:12
2018-09-18T18:29:12
149,332,939
0
0
null
null
null
null
UTF-8
Java
false
false
4,015
java
PATIENTS LIST CLASS /** * Created by ahmedayaz on 3/26/17. */ public class PatientsList implements ListInterface { LLPatientNode Head; LLPatientNode Tail; LLPatientNode Location; LLPatientNode previous; boolean moreValues; public int size; public boolean found; @Override public boolean find(Patients target) { //when location pointer returns null it sets moreValues to false ending the while loop Location = Head; found = false; moreValues=true; while (Head != null && !found && moreValues) { if (Location.getPatient().equals(target)) { found = true; } else { previous = Location; Location = Location.getLlPatientNode(); if (Location == null) { moreValues = false; } found = false; } } return found; } @Override public int size() { return size; } @Override public void add(Patients element) { //checks if head is null if yes sets the element to head //if not checks if tail is null if yes points the head to the element and sets the tail to the element //if not sets the tail to point to the element and sets the tail to the element LLPatientNode llPatientNode = new LLPatientNode(element); if (Head == null) { Head = llPatientNode; Location=Head; } else if (Tail == null) { Head.setLink(llPatientNode); Tail = llPatientNode; Location=Tail; } else { Tail.setLink(llPatientNode); Tail = llPatientNode; Location=Tail; } size++; } @Override public boolean remove(Patients element) { boolean removeSuccessful = false; //finds the element if yes checks if element equals head in that case sets the head to the node after that //else it gets the previous that was set from find method and points to the link of the location if (find(element)) { if (element.equals(Head.getPatient())) { Head = Head.getLlPatientNode(); removeSuccessful = true; size--; } else { previous.setLink(Location.getLlPatientNode()); removeSuccessful = true; size--; } } return removeSuccessful; } @Override public Patients get(Patients element) { if (find(element)) { return Location.getPatient(); } else { return null; } } @Override public void reset() { Head = null; Tail = null; Location = null; previous = null; size = 0; } @Override public Patients getNext(int i) { //in order to make sure it gets the first element from the list when executed first we can enter zero to set the //location to zero and return the first element if(i==0){ Location=Head; return Head.getPatient();} else{ if (Location != null) { if (Location.getPatient().equals(Tail.getPatient())) { Location=Head; return Head.getPatient(); } else { Patients patients=Location.getLlPatientNode().getPatient(); Location=Location.getLlPatientNode(); return patients; } } else { return null; } } } @Override public String toString() { Location = Head; String n = null; moreValues=true; while (Head != null && moreValues) { n = Location.getPatient().toString() + n; Location = Location.getLlPatientNode(); if (Location == null) { moreValues=false; } } return n; } }
[ "ahmedayaz@Ahmeds-MacBook-Pro.local" ]
ahmedayaz@Ahmeds-MacBook-Pro.local
4b77a841a5617a8f0ce312a77cb0f34e952f9e25
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-f7341.java
15cd6027cab78f0ca356c31427a32dfe93861416
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 3309871541974
[ "jenkins@khan.paloaltonetworks.local" ]
jenkins@khan.paloaltonetworks.local
aa14245510638bb73ae3caecf11f743911faa423
3057d9d2c523367a3a1b6b9dc61e33c76241eb44
/src/main/java/com/jadenx/kxuserdetailsservice/model/ProfileDTO.java
f38ea80beb0bb3100bdaa1fc219a3691353efb82
[ "Apache-2.0" ]
permissive
JadenX-GmbH/kx-user-details-service-public
9891bac6666d522e5639b5bc04bf148ae71031c2
352931dd4fec3f5fc88d17009dc063fd15c0b831
refs/heads/main
2023-08-08T04:13:31.384798
2021-09-24T15:07:28
2021-09-24T15:07:28
397,199,087
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.jadenx.kxuserdetailsservice.model; import lombok.Getter; import lombok.Setter; import lombok.ToString; import java.time.OffsetDateTime; import java.util.Set; import java.util.UUID; @Getter @Setter @ToString public class ProfileDTO { private Long id; private UUID uid; private String identifier; private Type type; private String publicAddress; private String tagLine; private String description; private String userPhoto; private String backgroundPhoto; private Boolean isActive; private Set<ExtendedSkillsetDTO> userSkillsets; private DetailsDTO details; private Set<AddressDTO> userAddresses; private OffsetDateTime dateCreated; private OffsetDateTime lastUpdated; }
[ "jacek.janczura@jadenx.com" ]
jacek.janczura@jadenx.com
792e30633864997e94ebbe0887f427753b5e6c2f
7d0d14e916ecf494f477ecdbe569047806c40e82
/src/com/ziplly/app/shared/GetAccountNotificationAction.java
625f140f04e85d75d6577c9e0862f48f4f293cf1
[]
no_license
susnata1981/Ziplly
df856b2989e5e23c039acdab8a6ab452efab3ffc
ef2bd05a09b4a835e58fe3feb89171e4901c2ef3
refs/heads/master
2020-12-30T18:38:29.206233
2014-04-07T13:03:55
2014-04-07T13:03:55
13,184,086
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package com.ziplly.app.shared; import net.customware.gwt.dispatch.shared.Action; public class GetAccountNotificationAction implements Action<GetAccountNotificationResult> { public GetAccountNotificationAction() { } }
[ "susnata@gmail.com" ]
susnata@gmail.com
0e3022df3b44d8e2cde3da5d58f00e1e6438d13e
8a5fbc77540b4deaa23bde97bbaa0dd1c20d5e95
/ncTask0/src/ru/skillbench/tasks/basics/math/ArrayVectorImpl.java
6af20c820ce20e835e6037c5b11b48f783249035
[]
no_license
voidmirror/ncTasksSkillBench
db436fb9b54d057fa30e6ad1480d15105d329911
7964897993d7820adff7e10b7168846578e13d9b
refs/heads/master
2023-02-21T06:22:08.945701
2021-01-23T14:27:22
2021-01-23T14:27:22
299,830,387
0
0
null
null
null
null
UTF-8
Java
false
false
2,807
java
package ru.skillbench.tasks.basics.math; import java.util.Arrays; public class ArrayVectorImpl implements ArrayVector{ private double[] arr; public ArrayVectorImpl() { arr = new double[0]; //TODO: не надо нулл } public ArrayVectorImpl(double[] a) { set(a); } @Override public void set(double... elements) { arr = new double[elements.length]; System.arraycopy(elements, 0, arr, 0, elements.length); } @Override public double[] get() { //TODO: это в clone() // double[] arrCopy = arr.clone(); return arr; } @Override public ArrayVector clone() { return new ArrayVectorImpl(arr.clone()); } @Override public int getSize() { return arr.length; } @Override public void set(int index, double value) { if (index >= arr.length) { double[] arrCopy = new double[index]; Arrays.copyOf(arr, arrCopy.length); arr = arrCopy; arr[index] = value; } else if (index > 0) { arr[index] = value; } } @Override public double get(int index) throws ArrayIndexOutOfBoundsException { return arr[index]; } @Override public double getMax() { double max; try { max = arr[0]; for (double v : arr) { max = Math.max(max, v); } } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Array has no elements"); return 0; } return max; } @Override public double getMin() { double min; try { min = arr[0]; for (double v : arr) { min = Math.min(min, v); } } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Array has no elements"); return 0; } return min; } @Override public void sortAscending() { Arrays.sort(arr); } @Override public void mult(double factor) { for (int i = 0; i < arr.length; i++) { arr[i] *= factor; } } @Override public ArrayVector sum(ArrayVector anotherVector) { for (int i = 0; i < Math.min(arr.length, anotherVector.get().length); i++) { arr[i] += anotherVector.get()[i]; } return this; } @Override public double scalarMult(ArrayVector anotherVector) { double mult = 0; for (int i = 0; i < Math.min(arr.length, anotherVector.get().length); i++) { mult += arr[i]*anotherVector.get()[i]; } return mult; } @Override public double getNorm() { return Math.sqrt(scalarMult(this)); } }
[ "49756045+voidmirror@users.noreply.github.com" ]
49756045+voidmirror@users.noreply.github.com
c34f373e2d46501fc545f78338b7547882e9fc56
ff428c76c659e65f31d405fdb5d4ceac99443129
/CarRental/src/main/java/com/carrental/dto/VehicleFilterDto.java
f0d26373fb9f63704d37256ed55bc3023bdce89e
[]
no_license
kubabar1/CarRental
6e105644ca0e376853847be76ad4e1766bf941e8
355dcbe9adccf775b4c4f90c8b4d2e66f911cc5a
refs/heads/master
2023-08-18T14:47:43.921920
2021-01-16T00:07:56
2021-01-16T00:07:56
142,590,041
26
18
null
2022-12-16T00:35:36
2018-07-27T14:51:36
Java
UTF-8
Java
false
false
3,878
java
package com.carrental.dto; import java.io.Serializable; import java.math.BigDecimal; public class VehicleFilterDto implements Serializable { private String brand; private String model; private String city; private String bodytype; private BigDecimal priceFrom; private BigDecimal priceTo; private Integer placesNumberFrom; private Integer placesNumberTo; private Integer doorsNumberFrom; private Integer doorsNumberTo; private Integer productionYearFrom; private Integer productionYearTo; private String color; public VehicleFilterDto() { super(); } public VehicleFilterDto(String brand, String model, String city, String bodytype, BigDecimal priceFrom, BigDecimal priceTo, Integer placesNumberFrom, Integer placesNumberTo, Integer doorsNumberFrom, Integer doorsNumberTo, Integer productionYearFrom, Integer productionYearTo, String color) { super(); this.brand = brand; this.model = model; this.city = city; this.bodytype = bodytype; this.priceFrom = priceFrom; this.priceTo = priceTo; this.placesNumberFrom = placesNumberFrom; this.placesNumberTo = placesNumberTo; this.doorsNumberFrom = doorsNumberFrom; this.doorsNumberTo = doorsNumberTo; this.productionYearFrom = productionYearFrom; this.productionYearTo = productionYearTo; this.color = color; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getBodytype() { return bodytype; } public void setBodytype(String bodytype) { this.bodytype = bodytype; } public BigDecimal getPriceFrom() { return priceFrom; } public void setPriceFrom(BigDecimal priceFrom) { this.priceFrom = priceFrom; } public BigDecimal getPriceTo() { return priceTo; } public void setPriceTo(BigDecimal priceTo) { this.priceTo = priceTo; } public Integer getPlacesNumberFrom() { return placesNumberFrom; } public void setPlacesNumberFrom(Integer placesNumberFrom) { this.placesNumberFrom = placesNumberFrom; } public Integer getPlacesNumberTo() { return placesNumberTo; } public void setPlacesNumberTo(Integer placesNumberTo) { this.placesNumberTo = placesNumberTo; } public Integer getDoorsNumberFrom() { return doorsNumberFrom; } public void setDoorsNumberFrom(Integer doorsNumberFrom) { this.doorsNumberFrom = doorsNumberFrom; } public Integer getDoorsNumberTo() { return doorsNumberTo; } public void setDoorsNumberTo(Integer doorsNumberTo) { this.doorsNumberTo = doorsNumberTo; } public Integer getProductionYearFrom() { return productionYearFrom; } public void setProductionYearFrom(Integer productionYearFrom) { this.productionYearFrom = productionYearFrom; } public Integer getProductionYearTo() { return productionYearTo; } public void setProductionYearTo(Integer productionYearTo) { this.productionYearTo = productionYearTo; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } @Override public String toString() { return "CarFilterWrapper [brand=" + brand + ", model=" + model + ", city=" + city + ", bodytype=" + bodytype + ", priceFrom=" + priceFrom + ", priceTo=" + priceTo + ", placesNumberFrom=" + placesNumberFrom + ", placesNumberTo=" + placesNumberTo + ", doorsNumberFrom=" + doorsNumberFrom + ", doorsNumberTo=" + doorsNumberTo + ", productionYearFrom=" + productionYearFrom + ", productionYearTo=" + productionYearTo + ", color=" + color + "]"; } }
[ "kubabar1@interia.pl" ]
kubabar1@interia.pl
380032afe2b3fa2c06bd2525fd93f2136a6f67b4
51756211f9cb621838e967924ff72a179e14a0c2
/practice4/src/ua/nure/skrypnyk/practice4/Demo.java
baf7299a230327da470e20b8d10fdf10d55eca01
[]
no_license
MaksSkrj/epam
7ddc387c62ca8fb0990482e4be0aab6e227d6d8e
e25c310d222e7ec35a1c9c6e5bd287f2609e9975
refs/heads/master
2020-03-19T03:52:31.058669
2018-06-08T12:54:38
2018-06-08T12:54:38
135,770,637
0
0
null
null
null
null
UTF-8
Java
false
false
1,337
java
package ua.nure.skrypnyk.practice4; import java.io.ByteArrayInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; public class Demo { private static final InputStream STD_IN = System.in; private static final String ENCODING = "Cp1251"; public static void main(String[] args) throws IOException{ System.out.println("=========================== PART1"); Part1.main(args); System.out.println("=========================== PART2"); Part2.main(args); System.out.println("=========================== PART3"); // set the mock input System.setIn(new ByteArrayInputStream( "char^String^int^double^stop".replace("^", System.lineSeparator()).getBytes(ENCODING))); Part3.main(args); // restore the standard input System.setIn(STD_IN); System.out.println("=========================== PART4"); Part4.main(args); System.out.println("=========================== PART5"); // set the mock input System.setIn(new ByteArrayInputStream( "table ru^table en^apple ru^stop".replace("^", System.lineSeparator()).getBytes(ENCODING))); Part5.main(args); // restore the standard input System.setIn(STD_IN); } }
[ "melkiy230898gutter" ]
melkiy230898gutter
226c4cdfe9e507381a57d12e952026e9105de948
0ac0e35d117d15425161a539720f0f3c7fed5239
/WeatherApp/app/src/main/java/macbeth/weatherapp/WeatherDataWind.java
bf51d8129f62774e3670ce398db68253df054b2e
[ "MIT" ]
permissive
kairuflayark/CS246
4ffc7dbc5c711546b1b4017263bcbd6d65f7685d
475f6b28a18cd25dda593dbc9c3c9e335532a793
refs/heads/master
2020-03-18T15:29:12.935863
2018-05-25T18:14:55
2018-05-25T18:14:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package macbeth.weatherapp; /** * Weather data - wind component based on JSON: * https://openweathermap.org/current */ public class WeatherDataWind { private float speed; private float deg; public float getSpeed() { return speed; } public float getDeg() { return deg; } }
[ "macbethc@byui.edu" ]
macbethc@byui.edu
90f2874cf09f9327898b312d49c3d161595db190
7209ad8300f5b3911f56bb928c4da90e338d72f4
/cool-meeting/src/com/zrgj/DAL/DAOImpl/MemberRowMapper.java
2033e5a2ffe0378f05eb9bbd95eb59b6229ff3f1
[]
no_license
bobli1128/CoolMeeting
a13b92e8eed840b0a67aad39b4bc913ab2069fd5
13e3e53afe8ffd6bc84ac5ab170c14467673bf5f
refs/heads/master
2020-04-16T09:17:16.415240
2019-01-20T11:18:44
2019-01-20T11:18:44
165,458,263
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
package com.zrgj.DAL.DAOImpl; import java.sql.ResultSet; import com.zrgj.POJO.Member; import com.zrgj.POJO.Role; import com.zrgj.jdbc.Util.RowMapper; public class MemberRowMapper implements RowMapper<Member> { @Override public Member rowMapper(ResultSet rs) throws Exception { Member t=new Member(); t.setId(rs.getInt(1)); t.setRole_id(rs.getInt(2)); t.setMeeting_id(rs.getInt(3)); return t; } }
[ "lixb0851@gmail.com" ]
lixb0851@gmail.com
972e982507e3bb58384b8c389a22bb68439bd2fd
f3d5b7bd6326082f0ce0bc58a6eb52e1cd44417e
/designpattern/src/main/java/tw/com/voodoo0406/practice/designpattern/simplefactory/Main.java
cad03c4ab76255c0e1fc5f554e366ad538abcabd
[]
no_license
voodoo0406/Practice
c9a6af7b295525ad2809738fcf1da3c948eb39ca
184b8838a4fcaf4c66b01a5abdaa3a75adf0508a
refs/heads/master
2021-01-08T13:53:37.468882
2020-03-10T13:14:42
2020-03-10T13:14:42
242,045,804
0
0
null
null
null
null
UTF-8
Java
false
false
1,290
java
package tw.com.voodoo0406.practice.designpattern.simplefactory; /** * Simple Factory principle: * In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the * problem of creating objects without having to specify the exact class of the object that will be created. This is done by * creating objects by calling a factory method—either specified in an interface and implemented by child classes, or * implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor. * * Drawback: * If we want to add new factory, it needs to update the using method. In this example it's the Main class. It violates the * open-closed principle. */ public class Main { public static void main(String[] args) { KFC kfc = new KFC(); IFood food = kfc.getFood(KFC.FOOD_HAMBURGER); if (food != null) { food.eat(); } else { System.out.println("No this food"); } food = kfc.getFood(KFC.FOOD_FIREDCHICKEN); if (food != null) { food.eat(); } else { System.out.println("No this food"); } food = kfc.getFood("Pizza"); if (food != null) { food.eat(); } else { System.out.println("No this food"); } } }
[ "voodoo0406@gmail.com" ]
voodoo0406@gmail.com
f67e67e475ea26209764c117e92872a0f868dbcd
e30c683b4a1d8a23b6e6ea89a10ac68ec6dcf57e
/QuanLyTiemChupHinh/src/GUI/frmQuanLyChuongTrinhUuDai.java
3ccf3b823f64d0c2cf9c2cc12b748f2fca6132e5
[]
no_license
txbac98/QuanLyChupHinh
1af053ab7862fa9baac00636c331db20c1479d33
23c588c15e54497d8fbf9514ab3d579c2a713453
refs/heads/master
2020-10-01T22:29:39.188743
2020-01-11T10:05:32
2020-01-11T10:05:32
227,636,759
0
0
null
null
null
null
UTF-8
Java
false
false
28,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 GUI; import BUS.ChuongTrinhUuDaiBUS; import BUS.DateBUS; import BUS.KhachHangBUS; import DTO.ChuongTrinhUuDaiDTO; import DTO.ThongBaoDTO; import java.awt.Color; import java.util.ArrayList; import java.util.Vector; import javax.swing.table.DefaultTableModel; /** * * @author 16520 */ public class frmQuanLyChuongTrinhUuDai extends javax.swing.JInternalFrame { /** * Creates new form frmQuanLyChuongTrinhUuDai */ public frmQuanLyChuongTrinhUuDai() { initComponents(); } public void Show(){ this.setVisible(true); LoadDanhSachCTUD(); tfMaNV.setText(quanlytiemchuphinh.QuanLyTiemChupHinh.taiKhoanDangNhap.MANV); XoaThongBao(); OffAllBtns(); } private void OffAllBtns(){ btnThem.setEnabled(false); btnSua.setEnabled(false); btnXoa.setEnabled(false); } private void XoaThongBao(){ lbThongBao.setText(""); } private void ShowThongBao(ThongBaoDTO thongBao){ lbThongBao.setText(thongBao.ChuThich); if (thongBao.ThanhCong){ lbThongBao.setForeground(Color.GREEN); } else{ lbThongBao.setForeground(Color.RED); } } public void LoadDanhSachCTUD(){ ArrayList<ChuongTrinhUuDaiDTO> listCTUD = ChuongTrinhUuDaiBUS.LayDanhSachCTUD(); ShowData(listCTUD); } private void ShowData(ArrayList<ChuongTrinhUuDaiDTO> listCTUD){ tableCTUD.clearSelection(); //Xoa du lieu table String header[] = {"Mã CTUD", "Mã NV", "Tên CTUD", "Ngày BD", "Ngày KT", "Nội dung", "GTUD"}; DefaultTableModel tblModel = new DefaultTableModel(header, 0); tblModel.setRowCount(0); if (listCTUD != null) { // Trong khi chưa hết dữ liệu for (int i=0; i< listCTUD.size(); i++){ Vector data = new Vector(); data.add(listCTUD.get(i).MACTUD); data.add(listCTUD.get(i).MANV); data.add(listCTUD.get(i).TENCTUD); data.add(listCTUD.get(i).NGAYBATDAU); data.add(listCTUD.get(i).NGAYKETTHUC); data.add(listCTUD.get(i).NOIDUNG); data.add(listCTUD.get(i).GIATRIUUDAI); // Thêm một dòng vào table model tblModel.addRow(data); } } tableCTUD.setModel(tblModel); // Thêm dữ liệu vào table } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel2 = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); cbDangApDung = new javax.swing.JCheckBox(); dcTraCuuBD = new com.toedter.calendar.JDateChooser(); dcTraCuuKT = new com.toedter.calendar.JDateChooser(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); btnTraCuu = new javax.swing.JButton(); btnTraCuu1 = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); tableCTUD = new javax.swing.JTable(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); tfMaCTUD = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); tfMaNV = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); taNoiDung = new javax.swing.JTextArea(); jLabel6 = new javax.swing.JLabel(); tfGiaTriUuDai = new javax.swing.JTextField(); btnXoa = new javax.swing.JButton(); btnSua = new javax.swing.JButton(); btnThem = new javax.swing.JButton(); dcNgayBatDau = new com.toedter.calendar.JDateChooser(); dcNgayKetThuc = new com.toedter.calendar.JDateChooser(); lbThongBao = new javax.swing.JLabel(); tfTenCTUD = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); btnThemMoi = new javax.swing.JButton(); setPreferredSize(new java.awt.Dimension(900, 600)); jLabel8.setText("Tra cứu:"); cbDangApDung.setText("Đang áp dụng"); cbDangApDung.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbDangApDungActionPerformed(evt); } }); dcTraCuuBD.setDateFormatString("dd/MM/yyyy"); dcTraCuuKT.setDateFormatString("dd/MM/yyyy"); jLabel9.setText("Từ ngày"); jLabel10.setText("Đến ngày"); btnTraCuu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/iconfinder_Search_27877.png"))); // NOI18N btnTraCuu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnTraCuuActionPerformed(evt); } }); btnTraCuu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/iconfinder_Escape_Search_27877.png"))); // NOI18N btnTraCuu1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnTraCuu1ActionPerformed(evt); } }); tableCTUD.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); tableCTUD.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { tableCTUDMouseClicked(evt); } }); jScrollPane2.setViewportView(tableCTUD); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane2) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8) .addComponent(cbDangApDung)) .addGap(67, 67, 67) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel9) .addComponent(dcTraCuuBD, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(38, 38, 38) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel10) .addComponent(dcTraCuuKT, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnTraCuu1, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnTraCuu, javax.swing.GroupLayout.Alignment.TRAILING)) .addContainerGap()))) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(btnTraCuu1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnTraCuu)) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(jLabel10) .addComponent(jLabel9)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(dcTraCuuBD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbDangApDung))) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(24, 24, 24) .addComponent(dcTraCuuKT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE) .addContainerGap()) ); jPanel1.setBackground(new java.awt.Color(0, 204, 204)); jLabel1.setText("Mã chương trình ưu đãi:"); tfMaCTUD.setEditable(false); tfMaCTUD.setBackground(new java.awt.Color(204, 204, 204)); jLabel2.setText("Mã nhân viên:"); tfMaNV.setEditable(false); tfMaNV.setBackground(new java.awt.Color(204, 204, 204)); jLabel3.setText("Ngày bắt đầu:"); jLabel4.setText(" Ngày kết thúc:"); jLabel5.setText("Nội dung:"); taNoiDung.setColumns(20); taNoiDung.setRows(5); jScrollPane1.setViewportView(taNoiDung); jLabel6.setText("Giá trị ưu đãi"); btnXoa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/iconfinder_Delete_27842.png"))); // NOI18N btnXoa.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnXoaActionPerformed(evt); } }); btnSua.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/iconfinder_Edit_27845.png"))); // NOI18N btnSua.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSuaActionPerformed(evt); } }); btnThem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/iconfinder_Check_27837.png"))); // NOI18N btnThem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnThemActionPerformed(evt); } }); dcNgayBatDau.setDateFormatString("dd/MM/yyyy"); dcNgayKetThuc.setDateFormatString("dd/MM/yyyy"); lbThongBao.setText("Thông báo"); jLabel7.setText("Tên CTUD:"); btnThemMoi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RES/iconfinder_Add_27831.png"))); // NOI18N btnThemMoi.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnThemMoiActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(tfGiaTriUuDai, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tfMaNV, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tfMaCTUD, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tfTenCTUD, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(29, 29, 29) .addComponent(btnThem) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnSua) .addGap(27, 27, 27) .addComponent(btnXoa) .addGap(10, 10, 10)) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbThongBao, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel1) .addGap(59, 59, 59) .addComponent(btnThemMoi)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(dcNgayBatDau, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(dcNgayKetThuc, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))))))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnXoa, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(btnThemMoi, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(4, 4, 4) .addComponent(tfMaCTUD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tfMaNV, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(12, 12, 12) .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tfTenCTUD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(dcNgayBatDau, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(dcNgayKetThuc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tfGiaTriUuDai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lbThongBao) .addGap(19, 19, 19) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnSua, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnThem, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void tableCTUDMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableCTUDMouseClicked // TODO add your handling code here: DefaultTableModel model = (DefaultTableModel)tableCTUD.getModel(); // get the selected row index int selectedRowIndex = tableCTUD.getSelectedRow(); // set the selected row data into jtextfields tfMaCTUD.setText(model.getValueAt(selectedRowIndex, 0).toString()); tfMaNV.setText(model.getValueAt(selectedRowIndex, 1).toString()); tfTenCTUD.setText(model.getValueAt(selectedRowIndex, 2).toString()); dcNgayBatDau.setDate(DateBUS.GetDate(model.getValueAt(selectedRowIndex, 3).toString())); dcNgayKetThuc.setDate(DateBUS.GetDate(model.getValueAt(selectedRowIndex, 4).toString())); taNoiDung.setText(model.getValueAt(selectedRowIndex, 5).toString()); tfGiaTriUuDai.setText(model.getValueAt(selectedRowIndex, 6).toString()); SetEnableBtnThem(false); }//GEN-LAST:event_tableCTUDMouseClicked private void btnThemMoiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThemMoiActionPerformed // TODO add your handling code here: XoaDuLieuNhap(); tfMaNV.setText(quanlytiemchuphinh.QuanLyTiemChupHinh.taiKhoanDangNhap.MANV); tfMaCTUD.setText(ChuongTrinhUuDaiBUS.LayMaCTUDMoi()); //Lay MaCTUD, MaNV SetEnableBtnThem(true); }//GEN-LAST:event_btnThemMoiActionPerformed private void btnThemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThemActionPerformed // TODO add your handling code here: ChuongTrinhUuDaiDTO ctud = new ChuongTrinhUuDaiDTO( tfMaCTUD.getText(), tfMaNV.getText(), tfTenCTUD.getText(), DateBUS.GetDateString(dcNgayBatDau), DateBUS.GetDateString(dcNgayKetThuc), taNoiDung.getText(), tfGiaTriUuDai.getText()); ThongBaoDTO thongBao = ChuongTrinhUuDaiBUS.ThemCTUD(ctud); LoadDanhSachCTUD(); ShowThongBao(thongBao); if (thongBao.ThanhCong){ btnThem.setEnabled(false); } }//GEN-LAST:event_btnThemActionPerformed private void btnSuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuaActionPerformed // TODO add your handling code here: ChuongTrinhUuDaiDTO ctud = new ChuongTrinhUuDaiDTO( tfMaCTUD.getText(), tfMaNV.getText(), tfTenCTUD.getText(), DateBUS.GetDateString(dcNgayBatDau), DateBUS.GetDateString(dcNgayKetThuc), taNoiDung.getText(), tfGiaTriUuDai.getText()); ThongBaoDTO thongBao = ChuongTrinhUuDaiBUS.SuaCTUD(ctud); LoadDanhSachCTUD(); ShowThongBao(thongBao); }//GEN-LAST:event_btnSuaActionPerformed private void btnXoaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnXoaActionPerformed // TODO add your handling code here: ChuongTrinhUuDaiDTO ctud = new ChuongTrinhUuDaiDTO( tfMaCTUD.getText(), tfMaNV.getText(), tfTenCTUD.getText(), DateBUS.GetDateString(dcNgayBatDau), DateBUS.GetDateString(dcNgayKetThuc), taNoiDung.getText(), tfGiaTriUuDai.getText()); ThongBaoDTO thongBao = ChuongTrinhUuDaiBUS.XoaCTUD(ctud); LoadDanhSachCTUD(); ShowThongBao(thongBao); }//GEN-LAST:event_btnXoaActionPerformed private void cbDangApDungActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbDangApDungActionPerformed // TODO add your handling code here: if (cbDangApDung.isSelected()){ dcTraCuuBD.setDate(DateBUS.GetToDay()); dcTraCuuKT.setDate(DateBUS.GetToDay()); ArrayList<ChuongTrinhUuDaiDTO> listCTUDDangApDung = ChuongTrinhUuDaiBUS.LayDanhSachCTUDTheoThoiGian(dcTraCuuBD.getDate(), dcTraCuuKT.getDate()); ShowData(listCTUDDangApDung); } else { dcTraCuuBD.setDate(null); dcTraCuuKT.setDate(null); LoadDanhSachCTUD(); } }//GEN-LAST:event_cbDangApDungActionPerformed private void btnTraCuuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTraCuuActionPerformed // TODO add your handling code here: cbDangApDung.setSelected(false); if (dcTraCuuBD.getDate()== null || dcTraCuuKT.getDate() == null) return; ArrayList<ChuongTrinhUuDaiDTO> listCTUDTheoNgay = ChuongTrinhUuDaiBUS.LayDanhSachCTUDTheoThoiGian(dcTraCuuBD.getDate(), dcTraCuuKT.getDate()); ShowData(listCTUDTheoNgay); }//GEN-LAST:event_btnTraCuuActionPerformed private void btnTraCuu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTraCuu1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnTraCuu1ActionPerformed private void SetEnableBtnThem(Boolean isThem){ btnThem.setEnabled(isThem); btnSua.setEnabled(!isThem); btnXoa.setEnabled(!isThem); } private void XoaDuLieuNhap(){ tfMaCTUD.setText(""); tfMaNV.setText(""); tfTenCTUD.setText(""); dcNgayBatDau.setDate(DateBUS.GetToDay()); dcNgayKetThuc.setDate(DateBUS.GetToDay()); taNoiDung.setText(""); tfGiaTriUuDai.setText(""); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnSua; private javax.swing.JButton btnThem; private javax.swing.JButton btnThemMoi; private javax.swing.JButton btnTraCuu; private javax.swing.JButton btnTraCuu1; private javax.swing.JButton btnXoa; private javax.swing.JCheckBox cbDangApDung; private com.toedter.calendar.JDateChooser dcNgayBatDau; private com.toedter.calendar.JDateChooser dcNgayKetThuc; private com.toedter.calendar.JDateChooser dcTraCuuBD; private com.toedter.calendar.JDateChooser dcTraCuuKT; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JLabel lbThongBao; private javax.swing.JTextArea taNoiDung; private javax.swing.JTable tableCTUD; private javax.swing.JTextField tfGiaTriUuDai; private javax.swing.JTextField tfMaCTUD; private javax.swing.JTextField tfMaNV; private javax.swing.JTextField tfTenCTUD; // End of variables declaration//GEN-END:variables }
[ "txbac196@gmail.com" ]
txbac196@gmail.com
42086aa5446f8dfe3d3537490d4d3e3569f91707
46d16cdb13db0dc99c72e74d6a2bdbf379b5917f
/core-ejb/src/test/java/br/com/skull/core/junit/listener/EnterpriseRunnerContainerListener.java
3b729c32d00cd41c523381ae69f83ce6d1c5dff0
[]
no_license
carlosfeitosa/controleFinanceiroMaven
6d827e049ed08dfff1437675d781562db8124338
42e28a47fbf47797a30117b2d02c36083011629f
refs/heads/master
2021-08-07T08:57:34.869168
2019-01-02T03:20:10
2019-01-02T03:20:10
143,487,914
0
0
null
null
null
null
UTF-8
Java
false
false
536
java
package br.com.skull.core.junit.listener; import br.com.skull.core.junit.runner.EnterpriseRunner; import org.junit.runner.Result; import org.junit.runner.notification.RunListener; /** * Listener para iniciar e encerrar o container de testes. * * @author Carlos Feitosa (carlos.feitosa.nt@gmail.com) */ public class EnterpriseRunnerContainerListener extends RunListener { @Override public void testRunFinished(Result result) throws Exception { super.testRunFinished(result); EnterpriseRunner.closeContainer(); } }
[ "fumato@gmail.com" ]
fumato@gmail.com
1810af752c5f58ecb3eb19d3e9e3940145156f44
a3f0078ad11a1bd1b68647246eeb8902293783eb
/ethereumj-core/src/main/java/org/ethereum/di/components/EthereumComponent.java
e239d5d5625d0c51279f2af7c9fb6c4da3a73f07
[ "MIT" ]
permissive
kitsilanosoftware/ethereumj-android
2000030102f490eed904899684a7f390886ff2d9
7f23cbad640fd08e4a5cc9d0e6da41d47c27e2be
refs/heads/android-test-poc9-rlpx
2021-01-15T15:25:53.509873
2015-06-07T06:00:51
2015-06-07T06:00:51
36,923,726
2
2
null
2015-06-05T09:19:03
2015-06-05T09:19:02
null
UTF-8
Java
false
false
462
java
package org.ethereum.di.components; import org.ethereum.di.modules.EthereumModule; import org.ethereum.facade.Ethereum; import org.ethereum.listener.EthereumListener; import javax.inject.Singleton; import dagger.Component; import org.ethereum.net.server.ChannelManager; @Singleton @Component(modules = EthereumModule.class) public interface EthereumComponent { Ethereum ethereum(); EthereumListener listener(); ChannelManager channelManager(); }
[ "adrian.tiberius@gmail.com" ]
adrian.tiberius@gmail.com
54fac059eac6b06ef65c44ba5e800bff20942062
6d715af15ad3aad6dd70a90e289741f2e92e8f86
/Hash Table/Word.java
20792cea80b74dabc9a25799b8d678d049ab046f
[]
no_license
jpn5089/Java
7f8b11ea8ee0f49bbd5e001ba5941d34b2c2c907
c3140bbe34f4264b3e9bbb206650843397976b14
refs/heads/master
2021-01-17T17:39:16.006245
2017-02-24T06:38:40
2017-02-24T06:38:40
83,010,058
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
import java.util.LinkedList; class Word implements Comparable<Word> { public String word = ""; public LinkedList<Integer> lineNumber = new LinkedList<Integer>(); //create linkedlist for line numbers public Word() { } public Word(String s, Integer line) { //constructor that takes a string and a line number integer and adds that line number to the linkedlist word = s; lineNumber.add(line); } public boolean equals(Object el) { return word.equals(((Word)el).word); } public int compareTo(Word el) { return word.compareTo(el.word); } public String toString() { return word + " occurs on lines " + lineNumber.toString() + " "; } }
[ "jp19nicola@gmail.com" ]
jp19nicola@gmail.com
bf55c2e0ae497d1991caff6840d7a746c5d83d50
010e638512f942cc9d1f49b5f4986d4ae64245ce
/src/main/java/com/lakala/appcomponent/bsdiff/DiffUtils.java
22dffe4ad61a969fd15a33de78d7a64d23ff559c
[]
no_license
dingqiqi/BsDiffManager
502af00d1b8c1ca25d9c01dc4ac925def5d6397a
1690eac3e4a77dd9666a5efb7f965388ec3a02e0
refs/heads/master
2020-04-08T18:16:56.581042
2018-11-29T03:24:47
2018-11-29T03:24:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
package com.lakala.appcomponent.bsdiff; /** * 差分工具类 */ public class DiffUtils { public static DiffUtils getInstance() { return DiffInstance.mInstance; } private static class DiffInstance { private static final DiffUtils mInstance = new DiffUtils(); } static { System.loadLibrary("ApkPatchDiffUtils"); } /** * native方法 比较路径为oldPath的apk与newPath的apk之间差异,并生成patch包,存储于patchPath * <p> * 返回:0,说明操作成功 * * @param oldApkPath 示例:/sdcard/old.apk * @param newApkPath 示例:/sdcard/new.apk * @param patchPath 示例:/sdcard/xx.patch * @return */ public native int genDiff(String oldApkPath, String newApkPath, String patchPath); }
[ "dingqiqi8@qq.com" ]
dingqiqi8@qq.com
b59894de3987db1a5cb3efda5667833863763d8e
2edc6ca3b1b63fc937ce9ce296f1f9f4dba0ee32
/src/main/java/com/macrosoftas/archijee/service/GenreServiceHelper.java
aae6d0027a7db1bd85cfff0352d03d046bc8e5e6
[]
no_license
rawiartimi/formation_sonar
2d47f94a968cd33f10db435083b896768ebb5596
c6dd652d417e01f202e08b9c2fd8ad3dd8740d77
refs/heads/master
2020-08-26T16:44:16.874497
2019-10-24T11:16:55
2019-10-24T11:16:55
217,077,367
0
0
null
null
null
null
UTF-8
Java
false
false
1,200
java
package com.macrosoftas.archijee.service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.macrosoftas.archijee.model.Genre; import com.macrosoftas.archijee.repository.GenreRepository; @Service public class GenreServiceHelper { @Autowired private GenreRepository repository; private static HashMap<String, Genre> ALL_GENRES = new HashMap<String,Genre>(){{ put("ROM", new Genre("ROM", "Roman")); put("POE", new Genre("POE", "Poésie")); put("THE", new Genre("THE", "Théatre")); put("NOU", new Genre("NOU", "nouvelle")); put("AUT", new Genre("AUT", "autobigraphie")); }}; public List<Genre> findAll() { return new ArrayList<Genre>(ALL_GENRES.values()); } public static Genre findOne(String genreCode) { Genre genre = new Genre(); Genre oldGenre = ALL_GENRES.get(genreCode); genre.setCode(oldGenre.getCode()); genre.setDescription(oldGenre.getDescription()); return genre; } public Genre getByCode(String code) { return repository.findByCode(code); } }
[ "rawia.rtimi@sofrecom.com" ]
rawia.rtimi@sofrecom.com
e1061c1fc9876f8cf7acd90b9645928254e9d6e6
9ffdedb9148aac228c1104664943761f52a5d258
/src/main/java/me/magicall/mark/Named.java
2e909e26e90d6b3a543e41327b0177a5023ce8eb
[ "Apache-2.0" ]
permissive
magical-l/magicall-util
2d7f358a2f92dbaea9a54e3604ac05efb5519852
f23fddce8d360be4ad74e9341e05446d73216abd
refs/heads/master
2021-01-10T07:43:59.930572
2015-11-17T02:17:07
2015-11-17T02:17:08
46,316,391
0
0
null
null
null
null
UTF-8
Java
false
false
95
java
package me.magicall.mark; @FunctionalInterface public interface Named { String getName(); }
[ "lwj621@163.com" ]
lwj621@163.com
c13416926a7dcee18d6cf9f2646c62fec80cfed3
6c3e19fa579e82dda55436a5a713ca205b284cda
/hqjcloud-provider-api/hqjcloud-provider-common-api/src/main/java/com/hqjcloud/provider/service/FileService.java
9fa90a14964b7ff44fcfd94ef31508d024e2d8e5
[]
no_license
UndoRealx/hqj
687c9933767dd121b7a1b8287a26a9b518ce3540
707991057f1829ec82a72bc2f85c9e0ecafd103b
refs/heads/master
2022-12-22T16:12:56.382435
2019-11-21T01:58:54
2019-11-21T01:58:54
219,651,824
0
0
null
2022-12-10T05:45:20
2019-11-05T03:42:51
JavaScript
UTF-8
Java
false
false
348
java
package com.hqjcloud.provider.service; /** * @ProjectName: hqjcloud * @Package: com.hqjcloud.provider.service * @ClassName: FileService * @Description: * @Author: lic * @CreateDate: 2019/9/11 17:46 * @UpdateUser: 更新者 * @UpdateDate: 2019/9/11 17:46 * @UpdateRemark: 更新说明 * @Version: 1.0 */ public interface FileService { }
[ "597153059@qq.com" ]
597153059@qq.com
c9db8a54856d49767fe3243c24d9f950c5bcd6fc
4c41bebd04a6e82f9226071f03ac30f022f36565
/java/club/finderella/finderella/POJO/PokeWrapper.java
f913110c45274e1c939dd97767117d9cc661516d
[]
no_license
pushkarmoi/finderella2015
01cb2377471b4711f22108c2202a82aab530467c
3923fb0b8bc0c3cc80dc9cea78d97f48ffdb0542
refs/heads/master
2020-03-06T23:27:56.294291
2018-03-28T12:37:08
2018-03-28T12:37:08
127,132,318
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package club.finderella.finderella.POJO; public class PokeWrapper { public int account_id; public PokeWrapper() { account_id = 0; } public PokeWrapper(int account_id) { this.account_id = account_id; } }
[ "pushkar.moi@gmail.com" ]
pushkar.moi@gmail.com
c57516567fe857904e4e30063e21d4533bc7336f
60d83aaa20e4ce4569675753586c1684d12213c3
/gravitee-gateway-handlers/gravitee-gateway-handlers-api/src/main/java/io/gravitee/gateway/handlers/api/http/client/spring/HttpClientConfigurationImportSelector.java
5d24311758d2c8ccfff10927fae8ced189052b29
[ "Apache-2.0" ]
permissive
Tifancy/gravitee-gateway
04ec7ed95763f445a5e14a6eec35d147ec89bf82
b769afbc5ac9f53c40816c53cfcf59eed3d5d63d
refs/heads/master
2021-05-06T12:58:39.289701
2017-11-29T08:04:32
2017-11-29T08:04:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,312
java
/** * Copyright (C) 2015 The Gravitee team (http://gravitee.io) * * 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 io.gravitee.gateway.handlers.api.http.client.spring; import io.gravitee.gateway.api.http.client.HttpClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.DeferredImportSelector; import org.springframework.core.io.support.SpringFactoriesLoader; import org.springframework.core.type.AnnotationMetadata; import org.springframework.util.Assert; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; /** * @author David BRASSELY (david at gravitee.io) * @author GraviteeSource Team */ public class HttpClientConfigurationImportSelector implements DeferredImportSelector { private final Logger LOGGER = LoggerFactory.getLogger(HttpClientConfigurationImportSelector.class); @Override public String[] selectImports(AnnotationMetadata importingClassMetadata) { LOGGER.debug("Looking for an HTTP Client implementation"); List<String> configurations = getCandidateConfigurations(); if (configurations.isEmpty()) { LOGGER.error("No HTTP client implementation can be found !"); throw new IllegalStateException("No HTTP client implementation can be found !"); } LOGGER.debug("\tFound {} {} implementation(s)", configurations.size(), HttpClient.class.getSimpleName()); configurations = removeDuplicates(configurations); return configurations.toArray(new String[configurations.size()]); } /** * Return the HTTP client class names that should be considered. By default * this method will load candidates using {@link SpringFactoriesLoader} with * {@link #getSpringFactoriesLoaderFactoryClass()}. * attributes} * @return a list of candidate configurations */ protected List<String> getCandidateConfigurations() { List<String> configurations = SpringFactoriesLoader.loadFactoryNames( getSpringFactoriesLoaderFactoryClass(), this.getClass().getClassLoader()); Assert.notEmpty(configurations, "No HTTP client classes found in META-INF/spring.factories. If you" + "are using a custom packaging, make sure that file is correct."); return configurations; } /** * Return the class used by {@link org.springframework.core.io.support.SpringFactoriesLoader} to * load configuration candidates. * @return the factory class */ protected Class<?> getSpringFactoriesLoaderFactoryClass() { return HttpClient.class; } protected final <T> List<T> removeDuplicates(List<T> list) { return new ArrayList<>(new LinkedHashSet<>(list)); } }
[ "brasseld@gmail.com" ]
brasseld@gmail.com