blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
6f1b1935fcf53f36b03d6a3c9dfe6741716164f7
e967caefefe73e4348b6da0bf97bdfcd1a95f18d
/src/belajarDesignPattern/BuilderPattern/Meal.java
2eb8917f28d611e356f79c10e90f8d20e197c423
[]
no_license
riskiabidin/DesignPattern
9c0d711a70161403e0da8a423442c43dbabde188
8fe172abdb58751d5771d56415ae7b5295f4e5a4
refs/heads/master
2022-09-30T11:30:32.351249
2020-06-04T04:47:25
2020-06-04T04:47:25
268,009,016
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
package belajarDesignPattern.BuilderPattern; import java.util.ArrayList; import java.util.List; public class Meal { private List<Item> items=new ArrayList<Item>(); public void add(Item item) { items.add(item); } public float getCost() { float cost=0.0f; for(Item item:items) { cost+=item.price(); } return cost; } public void showItems() { for(Item item:items) { System.out.println("item:"+item.name()); System.out.println("Packing:"+item.packing().pack()); System.out.println("Price:"+item.price()); System.out.println("-----------"); } } }
[ "riskiaktor@gmail.com" ]
riskiaktor@gmail.com
f47dc6a7fc4994d9367cb78cfd0505bc2743a115
7b0521dfb4ec76ee1632b614f32ee532f4626ea2
/src/main/java/alcoholmod/Mathioks/Final/Summons/Entity/SummonEnderShinobiEntity.java
913f4dffc4e757466bc5501f6418c6bcdc683156
[]
no_license
M9wo/NarutoUnderworld
6c5be180ab3a00b4664fd74f6305e7a1b50fe9fc
948065d8d43b0020443c0020775991b91f01dd50
refs/heads/master
2023-06-29T09:27:24.629868
2021-07-27T03:18:08
2021-07-27T03:18:08
389,832,397
0
0
null
null
null
null
UTF-8
Java
false
false
22,621
java
package alcoholmod.Mathioks.Final.Summons.Entity; import alcoholmod.Mathioks.AlcoholMod; import alcoholmod.Mathioks.ExtendedPlayer; import alcoholmod.Mathioks.ExtraFunctions.SyncChakraExperienceMessage; import alcoholmod.Mathioks.PacketDispatcher; import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.network.simpleimpl.IMessage; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIFollowOwner; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; import net.minecraft.util.DamageSource; import net.minecraft.util.IChatComponent; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; public class SummonEnderShinobiEntity extends EntityTameable { public int deathTicks; private static boolean[] carriableBlocks = new boolean[256]; private int teleportDelay; private int stareTimer; private Entity lastEntityToAttack; private boolean isAggressive; public SummonEnderShinobiEntity(World par1World) { super(par1World); this.tasks.addTask(4, (EntityAIBase)new EntityAIAttackOnCollide((EntityCreature)this, 1.0D, true)); this.tasks.addTask(5, (EntityAIBase)new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); this.tasks.addTask(7, (EntityAIBase)new EntityAIWander((EntityCreature)this, 1.0D)); this.tasks.addTask(8, (EntityAIBase)new EntityAIWatchClosest((EntityLiving)this, EntityPlayer.class, 8.0F)); this.tasks.addTask(9, (EntityAIBase)new EntityAILookIdle((EntityLiving)this)); this.targetTasks.addTask(1, (EntityAIBase)new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(2, (EntityAIBase)new EntityAIOwnerHurtTarget(this)); this.targetTasks.addTask(3, (EntityAIBase)new EntityAIHurtByTarget((EntityCreature)this, true)); this.tasks.addTask(10, (EntityAIBase)new EntityAISwimming((EntityLiving)this)); setSize(0.6F, 2.9F); } protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D); getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.4D); } protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(18, new Byte((byte)0)); } public void onLivingUpdate() { if (isWet()) attackEntityFrom(DamageSource.drown, 1.0F); if (this.lastEntityToAttack != this.entityToAttack) { IAttributeInstance iattributeinstance = getEntityAttribute(SharedMonsterAttributes.movementSpeed); if (this.entityToAttack != null); } this.lastEntityToAttack = this.entityToAttack; for (int k = 0; k < 2; k++) this.worldObj.spawnParticle("portal", this.posX + (this.rand.nextDouble() - 0.5D) * this.width, this.posY + this.rand.nextDouble() * this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D); if (this.worldObj.isDaytime() && !this.worldObj.isRemote) { float f = getBrightness(1.0F); if (f > 0.5F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { this.entityToAttack = null; setScreaming(false); this.isAggressive = false; teleportRandomly(); } } if (isWet() || isBurning()) { this.entityToAttack = null; setScreaming(false); this.isAggressive = false; teleportRandomly(); } if (isScreaming() && !this.isAggressive && this.rand.nextInt(100) == 0) setScreaming(false); this.isJumping = false; if (this.entityToAttack != null) faceEntity(this.entityToAttack, 100.0F, 100.0F); if (!this.worldObj.isRemote && isEntityAlive()) if (this.entityToAttack != null) { if (this.entityToAttack.getDistanceSqToEntity((Entity)this) < 16.0D) teleportRandomly(); if (this.entityToAttack != null) { this.teleportDelay = 0; } else if (this.entityToAttack.getDistanceSqToEntity((Entity)this) > 256.0D && this.teleportDelay++ >= 30 && teleportToEntity(this.entityToAttack)) { this.teleportDelay = 0; } } else { setScreaming(false); this.teleportDelay = 0; } super.onLivingUpdate(); } public void onKillEntity(EntityLivingBase p_70074_1_) { super.onKillEntity(p_70074_1_); if (getOwner() != null && getOwner() instanceof EntityPlayer && !(p_70074_1_ instanceof net.minecraft.entity.passive.EntityAnimal) && !(p_70074_1_ instanceof net.minecraft.entity.passive.EntityWaterMob)) { EntityPlayer owner = (EntityPlayer)getOwner(); ExtendedPlayer props = ExtendedPlayer.get(owner); props.setChakraExperience(props.getChakraExperience() + 1); PacketDispatcher.sendTo((IMessage)new SyncChakraExperienceMessage(owner), (EntityPlayerMP)owner); } } protected void dropRareDrop(int p_70600_1_) { entityDropItem(new ItemStack(AlcoholMod.SummonEnderShinobi, 1, 1), 0.0F); } protected boolean teleportRandomly() { double d0 = this.posX + (this.rand.nextDouble() - 0.5D) * 64.0D; double d1 = this.posY + (this.rand.nextInt(64) - 32); double d2 = this.posZ + (this.rand.nextDouble() - 0.5D) * 64.0D; return teleportTo(d0, d1, d2); } public boolean isScreaming() { return (this.dataWatcher.getWatchableObjectByte(18) > 0); } public void setScreaming(boolean p_70819_1_) { this.dataWatcher.updateObject(18, Byte.valueOf((byte)(p_70819_1_ ? 1 : 0))); } protected boolean teleportToEntity(Entity p_70816_1_) { Vec3 vec3 = Vec3.createVectorHelper(this.posX - p_70816_1_.posX, this.boundingBox.minY + (this.height / 2.0F) - p_70816_1_.posY + p_70816_1_.getEyeHeight(), this.posZ - p_70816_1_.posZ); vec3 = vec3.normalize(); double d0 = 16.0D; double d1 = this.posX + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3.xCoord * d0; double d2 = this.posY + (this.rand.nextInt(16) - 8) - vec3.yCoord * d0; double d3 = this.posZ + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3.zCoord * d0; return teleportTo(d1, d2, d3); } protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) { EnderTeleportEvent event = new EnderTeleportEvent((EntityLivingBase)this, p_70825_1_, p_70825_3_, p_70825_5_, 0.0F); if (MinecraftForge.EVENT_BUS.post((Event)event)) return false; double d3 = this.posX; double d4 = this.posY; double d5 = this.posZ; this.posX = event.targetX; this.posY = event.targetY; this.posZ = event.targetZ; boolean flag = false; int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY); int k = MathHelper.floor_double(this.posZ); if (this.worldObj.blockExists(i, j, k)) { boolean flag1 = false; while (!flag1 && j > 0) { Block block = this.worldObj.getBlock(i, j - 1, k); if (block.getMaterial().blocksMovement()) { flag1 = true; continue; } this.posY--; j--; } if (flag1) { setPosition(this.posX, this.posY, this.posZ); if (this.worldObj.getCollidingBoundingBoxes((Entity)this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox)) flag = true; } } if (!flag) { setPosition(d3, d4, d5); return false; } short short1 = 128; for (int l = 0; l < short1; l++) { double d6 = l / (short1 - 1.0D); float f = (this.rand.nextFloat() - 0.5F) * 0.2F; float f1 = (this.rand.nextFloat() - 0.5F) * 0.2F; float f2 = (this.rand.nextFloat() - 0.5F) * 0.2F; double d7 = d3 + (this.posX - d3) * d6 + (this.rand.nextDouble() - 0.5D) * this.width * 2.0D; double d8 = d4 + (this.posY - d4) * d6 + this.rand.nextDouble() * this.height; double d9 = d5 + (this.posZ - d5) * d6 + (this.rand.nextDouble() - 0.5D) * this.width * 2.0D; this.worldObj.spawnParticle("portal", d7, d8, d9, f, f1, f2); } this.worldObj.playSoundEffect(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F); playSound("mob.endermen.portal", 1.0F, 1.0F); return true; } protected String getLivingSound() { return isScreaming() ? "mob.endermen.scream" : "mob.endermen.idle"; } protected String getHurtSound() { return "mob.endermen.hit"; } protected String getDeathSound() { return "mob.endermen.death"; } public boolean attackEntityAsMob(Entity par1Entity) { int i = 7; return (getOwner() != null) ? par1Entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)getOwner()), i) : par1Entity.attackEntityFrom(DamageSource.causeMobDamage((EntityLivingBase)this), i); } protected boolean isAIEnabled() { return true; } public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { if (isEntityInvulnerable()) return false; setScreaming(true); if (p_70097_1_ instanceof net.minecraft.util.EntityDamageSource && p_70097_1_.getEntity() instanceof EntityPlayer) this.isAggressive = true; if (p_70097_1_ instanceof net.minecraft.util.EntityDamageSourceIndirect) { this.isAggressive = false; for (int i = 0; i < 64; i++) { if (teleportRandomly()) return true; } return super.attackEntityFrom(p_70097_1_, p_70097_2_); } return super.attackEntityFrom(p_70097_1_, p_70097_2_); } public void onUpdate() { EntityPlayer entityPlayer = (EntityPlayer)getOwner(); if (this.ticksExisted >= 6000 && !this.worldObj.isRemote) { if (getOwner() != null) { Random rand = new Random(); int randomNumber = rand.nextInt(3); if (randomNumber == 1) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : My time is up, see yah")); if (randomNumber == 2) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : I gotta bro, *Fistbump*")); if (randomNumber == 3) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : My time is over, don't worry, I'll beam myself up!")); if (randomNumber == 0) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : Listen up " + getOwner().getCommandSenderName() + " My time is up, good luck and see ya later!")); } setDead(); } if (getOwner() != null) { if (getAttackTarget() != null && (this.ticksExisted == 500 || this.ticksExisted == 1500 || this.ticksExisted == 2500 || this.ticksExisted == 3500 || this.ticksExisted == 4500 || this.ticksExisted == 5500)) { Random rand = new Random(); int randomNumber = rand.nextInt(3); if (randomNumber == 0) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : DIE " + getAttackTarget().getCommandSenderName() + "!!")); if (randomNumber == 1) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : I'll haunt your dreams " + getAttackTarget().getCommandSenderName() + "!!")); if (randomNumber == 2) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : Come here " + getAttackTarget().getCommandSenderName() + "!!")); if (randomNumber == 3) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : heh heh, " + getAttackTarget().getCommandSenderName() + ", Let's finish this HAHAHA!")); } if (this.ticksExisted == 20 && !this.worldObj.isRemote) { Random rand = new Random(); int randomNumber = rand.nextInt(3); if (randomNumber == 1) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : Why did you summon me " + getOwner().getCommandSenderName())); if (randomNumber == 2) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : What will we do this time friend?")); if (randomNumber == 3) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : Need some a hand bro?")); if (randomNumber == 0) { entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : Different time, different place.")); entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("But you still need Slendobis help!")); entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("It's good to see ya buddy!")); } } } super.onUpdate(); } public void setAttackTarget(EntityLivingBase p_70624_1_) { super.setAttackTarget(p_70624_1_); if (p_70624_1_ == null) { setAngry(false); } else if (!isTamed()) { setAngry(true); } } public void setAngry(boolean p_70916_1_) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); if (p_70916_1_) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 0x2))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & 0xFFFFFFFD))); } } public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.UNDEAD; } protected boolean canDespawn() { return false; } public EntityAgeable createChild(EntityAgeable entityageable) { return null; } protected void onDeathUpdate() { this.deathTicks++; if (getOwner() != null && !this.worldObj.isRemote) { EntityPlayer entityPlayer = (EntityPlayer)getOwner(); Random rand = new Random(); int randomNumber = rand.nextInt(3); if (randomNumber == 1) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : aaargh DAMNIT! I'll leave it to you " + getOwner().getCommandSenderName())); if (randomNumber == 2) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : AAaaAAaaAAARGH")); if (randomNumber == 3) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : I'm down for the count bro, good luck!")); if (randomNumber == 0) entityPlayer.addChatComponentMessage((IChatComponent)new ChatComponentText("Slendobi : I gave it all I got, but this is it, see you later friend!")); } if (this.deathTicks >= 0 && this.deathTicks <= 1) { double d2 = this.rand.nextGaussian() * 0.02D; double d0 = this.rand.nextGaussian() * 0.02D; double d1 = this.rand.nextGaussian() * 0.02D; this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); this.worldObj.spawnParticle("explode", this.posX + (this.rand.nextFloat() * this.width * 2.0F) - this.width, this.posY + 1.0D + (this.rand.nextFloat() * this.height), this.posZ + (this.rand.nextFloat() * this.width * 2.0F) - this.width, d2, d0, d1); } if (this.deathTicks == 1 && !this.worldObj.isRemote) setDead(); } public boolean canAttackClass(Class par1Class) { return true; } protected boolean isValidLightLevel() { int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.boundingBox.minY); int k = MathHelper.floor_double(this.posZ); if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, i, j, k) > this.rand.nextInt(32)) return false; int l = this.worldObj.getBlockLightValue(i, j, k); if (this.worldObj.isThundering()) { int i1 = this.worldObj.skylightSubtracted; this.worldObj.skylightSubtracted = 10; l = this.worldObj.getBlockLightValue(i, j, k); this.worldObj.skylightSubtracted = i1; } return (l <= this.rand.nextInt(8)); } public boolean getCanSpawnHere() { return (this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && isValidLightLevel() && super.getCanSpawnHere()); } }
[ "mrkrank2023@gmail.com" ]
mrkrank2023@gmail.com
3631aa5d1e64a81837b578ee1c6c01faba12a29e
eb7deb6fc59054bab1aab380c958a1673e5d290c
/src/main/java/seng302/controllers/spellingtutor/SpellingTutorPopUpController.java
f6d53d4ad8ab9447dc31012333522f20dd6b5dd0
[ "MIT" ]
permissive
South-Paw/Xinity
d8696b4068b3a6a9897c63bc5ff5476445e6a6dc
14a40e08156024470e9bc6e3af4b7e1959ad01b7
refs/heads/master
2020-07-12T10:18:32.938048
2017-01-19T06:08:09
2017-01-19T06:08:09
73,911,047
2
1
null
null
null
null
UTF-8
Java
false
false
2,953
java
package seng302.controllers.spellingtutor; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.CheckBox; import javafx.scene.control.TextField; import org.controlsfx.control.CheckComboBox; import seng302.command.Command; import seng302.command.tutor.ChordSpellingTutor; import seng302.controllers.commontutor.TutorPopUpController; import seng302.util.enumerator.ChordQuality; import java.util.ArrayList; import java.util.List; /** * Controller class for the spelling tutor pop up. */ public class SpellingTutorPopUpController extends TutorPopUpController { private static SpellingTutorPopUpController spellingTutorPopUpController; @FXML private TextField numberOfQuestionsField; @FXML private CheckComboBox chordConstraintDropDown; @FXML private CheckBox noEnharmonicsCheckBox; @FXML private CheckBox randomNotesCheckBox; /** * Constructor for class. */ public SpellingTutorPopUpController() { spellingTutorPopUpController = this; } /** * Used to get the instance of the Tutor Pop Up Controller. * * @return The Tutor Pop Up Controller. */ public static SpellingTutorPopUpController getInstance() { return spellingTutorPopUpController; } /** * Initialise function for when this scene is loaded. */ @SuppressWarnings("Unused") public void initialize() { // Adds all the chord types to the drop down and checks them all ObservableList<String> constraints = FXCollections.observableArrayList(); for (ChordQuality quality: ChordQuality.values()) { String qualityString = quality.getChordQualities().get(0); if (!qualityString.equalsIgnoreCase("unknown")) { constraints.addAll(qualityString); } } chordConstraintDropDown.getItems().addAll(constraints); for (Integer index = 0; index < constraints.size(); index++) { chordConstraintDropDown.getCheckModel().checkIndices(index); } } /** * Handles the start test button being pressed. */ protected void startTestButtonHandler() { List<String> arguments = new ArrayList<>(); List<String> constraintList = chordConstraintDropDown.getCheckModel().getCheckedItems(); arguments.add("x" + numberOfQuestionsField.getText()); for (String constraint: constraintList) { arguments.add(constraint); } if (noEnharmonicsCheckBox.isSelected()) { arguments.add("noEnharmonic"); } if (randomNotesCheckBox.isSelected()) { arguments.add("randomNotes"); } Command spellingTutor = new ChordSpellingTutor(arguments); Boolean validTestValue = isNumberOfTestsValid(numberOfQuestionsField); startTestThroughDsl(spellingTutor, validTestValue); } }
[ "alex@netspeed.net.nz" ]
alex@netspeed.net.nz
ca71776cb434fd2cca3ea3957cb0523733e07d86
c0463b289fecb907c2554daab819ef4b4fac8546
/app/src/androidTest/java/com/androidexample/ExampleInstrumentedTest.java
0fd0d55a9d840f6ee95d722c8fdbf61edbafb39f
[]
no_license
haticenurokur/androidExample
d7547910d3348e1a6d7a7852c3a3e44b0b24aedb
4d37d6e488f3e382dd61222db754e0107e0e3652
refs/heads/master
2020-06-04T16:39:26.788377
2019-06-15T21:55:37
2019-06-15T21:55:37
192,107,413
0
0
null
null
null
null
UTF-8
Java
false
false
720
java
package com.androidexample; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.androidexample", appContext.getPackageName()); } }
[ "haticenurokur@gmail.com" ]
haticenurokur@gmail.com
4d711675ccfa51150d69bb9deb32aaf39398861a
9eb0a9eb31cfddb0934afe5530d67e2555a6532d
/src/com/qianhe/service/ClassifyService.java
1849051575f42863b15829d91bf681d26fd84640
[]
no_license
noeditornocodenosql/qzh
474436f7fb07a4e3cae9ce7b6d1b6c9a8feb8f3e
e257c76c29ca2e24e8eb6269df3c4e75da832a3b
refs/heads/master
2020-03-15T19:37:12.414132
2018-07-28T15:09:27
2018-07-28T15:09:27
132,313,133
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
package com.qianhe.service; import java.util.List; import com.qianhe.model.Classify; public interface ClassifyService { public Classify findClassifyById(Integer id); public List<Classify> findAllClassify(Integer type); public void saveClassify(Classify classify); public void updateClassify(Classify classify); public void deleteClassify(Integer id); }
[ "Administrator@192.168.0.108" ]
Administrator@192.168.0.108
33c65a92a67080ef551ab950f2f41e11e3a3b2f5
742e79d3c308ae83aa6e776bfc5462e09e996558
/Automobile Stock Managment Console Applicaton/Controller/BaseInterface/StockAndOrderHistoryViewer.java
d9ab922692ddec76d97fd4f0a7a96b9c2240d133
[]
no_license
arun1810/Zoho-Incubation-Codes
2dc646df7f8d4df2fe595251873092c7b2fc54a3
14d5fa31356e3b710d67479790aa495013047603
refs/heads/main
2023-07-07T07:42:13.713247
2021-08-11T09:00:05
2021-08-11T09:00:05
387,793,788
0
0
null
null
null
null
UTF-8
Java
false
false
918
java
package Controller.BaseInterface; import java.util.List; import CustomExceptions.DataNotFoundException; import POJO.OrderHistory; import POJO.Stock; import Utilities.SortUtil; import Utilities.SortUtil.SortOrder; public interface StockAndOrderHistoryViewer { public List<OrderHistory> getAllOrderHistory(); public List<OrderHistory> sortOrderHistoryByTotalPrice(SortOrder order); public List<OrderHistory> filterOrderHistoryByStockID(String filter); public OrderHistory getOrderHistorybyID(String orderHistoryID) throws DataNotFoundException; public List<Stock> getAllStock(); public Stock getStockByID(String stockID) throws DataNotFoundException; public List<Stock> sortStockbyPrice(SortUtil.SortOrder sortOrder); public List<Stock> sortStockbyCount(SortUtil.SortOrder sortOrder); public List<Stock> filterStockByName(String filter); public void clearAllFilter(); }
[ "arun1810@users.noreply.github.com" ]
arun1810@users.noreply.github.com
aa536d21f8b0700a34e14eaf79d1ae78efa3f47a
afff6a780dbebb9a47abde1f9ae751fba1e15a7f
/Assignment 2/Assignment2/src/WQUPC/WQUPCTest.java
97fa96e65600240809c87a10867eb0aa899c89d8
[]
no_license
yashkhopkar/Program-Structures-And-Algorithms
082f9afa60e4e3106c680583e6e0484dd505eec1
3935cb5aca1c5172711a538f891fa33fa762a98f
refs/heads/master
2020-03-22T12:20:49.440242
2018-09-29T22:49:08
2018-09-29T22:49:08
140,034,469
0
0
null
null
null
null
UTF-8
Java
false
false
2,161
java
package WQUPC; import static org.junit.Assert.*; import org.junit.Test; public class WQUPCTest { /** */ @Test public void testFind0() { WQUPC h = new WQUPC(10); assertEquals(0, h.find(0)); } /** */ @Test public void testFind1() { WQUPC h = new WQUPC(10); h.union(0,1); assertEquals(0, h.find(0)); assertEquals(0, h.find(1)); } /** */ @Test public void testFind2() { WQUPC h = new WQUPC(10); h.union(0,1); assertEquals(0, h.find(0)); assertEquals(0, h.find(1)); h.union(2,1); assertEquals(0, h.find(0)); assertEquals(0, h.find(1)); assertEquals(0, h.find(2)); } /** */ @Test public void testFind3() { WQUPC h = new WQUPC(10); h.union(0,1); h.union(0,2); h.union(3,4); h.union(3,5); assertEquals(0, h.find(0)); assertEquals(0, h.find(1)); assertEquals(0, h.find(2)); assertEquals(3, h.find(3)); assertEquals(3, h.find(4)); assertEquals(3, h.find(5)); h.union(0,3); assertEquals(0, h.find(0)); assertEquals(0, h.find(1)); assertEquals(0, h.find(2)); assertEquals(0, h.find(3)); assertEquals(0, h.find(4)); assertEquals(0, h.find(5)); } /** */ @Test public void testFind4() { WQUPC h = new WQUPC(10); h.union(0,1); h.union(1,2); h.union(3,4); h.union(3,5); assertEquals(0, h.find(0)); assertEquals(0, h.find(1)); assertEquals(0, h.find(2)); assertEquals(3, h.find(3)); assertEquals(3, h.find(4)); assertEquals(3, h.find(5)); h.union(0,3); assertEquals(0, h.find(0)); assertEquals(0, h.find(1)); assertEquals(0, h.find(2)); assertEquals(0, h.find(3)); assertEquals(0, h.find(4)); assertEquals(0, h.find(5)); } /** */ @Test public void testConnected01() { WQUPC h = new WQUPC(10); assertFalse(h.connected(0,1)); } }
[ "khopkar.y@husky.neu.edu" ]
khopkar.y@husky.neu.edu
f4c8d539e125e7439b1f9a53e5419c49342663be
702ed60e5ac14d344644e36feff57060110f780d
/src/Main.java
62e7c3c4b880393f5f413dc9a420982e1e7f79dc
[]
no_license
Zearpex/SEW3
b0056bbdd9f65105a774917f0fca738e2c961ddc
25ae9fdb7bfd88f9045232139b05fb729bc76924
refs/heads/master
2021-03-24T12:29:55.757349
2017-09-25T09:40:31
2017-09-25T09:40:31
104,727,375
0
0
null
null
null
null
UTF-8
Java
false
false
187
java
/** * Created by 5063 on 25.09.2017. */ public class Main { public static void main(String[] args){ System.out.println("Hello from the htl"); return "haha"; } }
[ "felix.kurz@sdsystems.at" ]
felix.kurz@sdsystems.at
8bf53e6fd538ea09d25c4736299bbce83e2df18e
ceabd99652df1e87ce56840b3a514190aa002d0a
/src/main/java/net/billforward/model/usage/UsageState.java
47f8ea74e34d55925b9919affe4aed0d28827898
[]
no_license
billforward/bf-java
d777666582c6b28f11af4f33753c37c92a966183
522fde77e47e79bdac41d76ee6725021fca5210b
refs/heads/master
2021-01-21T04:54:08.394332
2016-04-06T11:23:13
2016-04-06T11:23:13
23,771,428
0
0
null
2015-02-06T15:46:30
2014-09-07T21:24:41
Java
UTF-8
Java
false
false
84
java
package net.billforward.model.usage; public enum UsageState { Active, Historic }
[ "ian.saunders@c4nsult.com" ]
ian.saunders@c4nsult.com
015b983b437386525b95c6295a6c5ebb8c783f32
98930b5356abef64642a55435219a1aa15097997
/app/src/main/java/enrique/pichangatpa/SettingsActivity.java
da26d50f39a20ca358218db5b631e96eb5d8ab51
[]
no_license
enriquesoto/CapstoneProjectTPAndroidPinPong
2d736110f91f2f763059a015158ef52e22eddb98
aa2a8ed2b7ffcc8c9b27ebd81f07938b00090c87
refs/heads/master
2021-01-18T21:31:51.402068
2014-09-08T21:07:45
2014-09-08T21:07:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,621
java
package enrique.pichangatpa; import android.content.Intent; import android.content.pm.ActivityInfo; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.Spinner; import android.widget.Toast; import enrique.pichangatpa.R; public class SettingsActivity extends ActionBarActivity { private Spinner mSpinnerCountry; private Spinner mSpinnerOpponent; private Button mbttnSubmit; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_settings); mSpinnerCountry = (Spinner) findViewById(R.id.mSpinnerCountry); mSpinnerOpponent = (Spinner) findViewById(R.id.mSpinnerOpponent); mbttnSubmit = (Button) findViewById(R.id.btnSubmit); /*Toast.makeText(SettingsActivity.this, "OnClickListener : " + "\nSpinner 1 : " + String.valueOf(mSpinnerCountry.getSelectedItem()), Toast.LENGTH_SHORT ).show();*/ mbttnSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent returnIntent = new Intent(); int selectedCountryIndex = mSpinnerCountry.getSelectedItemPosition(); int selectedOpponentIndex = mSpinnerOpponent.getSelectedItemPosition(); returnIntent.putExtra("mCountryTeam",selectedCountryIndex); returnIntent.putExtra("mOpponentTeam",selectedOpponentIndex); setResult(RESULT_OK,returnIntent); finish(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.settings, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "e.sotomendoza@gmail.com" ]
e.sotomendoza@gmail.com
ab8f52d550257f5226a40e2da17bd03eba24e02b
caf5ab8817d9fcf85483e4ae233ce18e218ca03e
/app/src/main/java/me/fmy/galaxy_a7/models/Constants.java
f139c74447c7c55df010cda2dc91318c03f0ea62
[]
no_license
famepram/galaxyA7
e85b3b07675164ad9bf40ea30604895269a27e70
5c3b153db4d371b98eadbae22c9d9d2bac61a741
refs/heads/master
2021-07-15T00:15:30.497832
2017-10-19T04:09:28
2017-10-19T04:09:28
107,496,954
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
package me.fmy.galaxy_a7.models; /** * Created by Femmy on 7/24/2016. */ public class Constants { public int DATABASE_VERSION = 1; public String DATABASE_NAME = "galaxyA7"; public String TABLE_USER = "user"; }
[ "femmy.pramana@gmail.com" ]
femmy.pramana@gmail.com
d8f7816422b0be825ea29cc378302e0a7c3acc24
208ba847cec642cdf7b77cff26bdc4f30a97e795
/aj/ab/src/main/java/org.wp.ab/ui/media/MediaImageLoader.java
8727e4b96edab6b071224a41e67331ae5876c739
[]
no_license
kageiit/perf-android-large
ec7c291de9cde2f813ed6573f706a8593be7ac88
2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8
refs/heads/master
2021-01-12T14:00:19.468063
2016-09-27T13:10:42
2016-09-27T13:10:42
69,685,305
0
0
null
2016-09-30T16:59:49
2016-09-30T16:59:48
null
UTF-8
Java
false
false
1,558
java
package org.wp.ab.ui.media; import android.content.Context; import com.android.volley.RequestQueue; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.Volley; import org.wp.ab.WordPress; import org.wp.ab.models.Blog; import org.wp.ab.util.AppLog; import org.wp.ab.util.VolleyUtils; /** * provides the ImageLoader and backing RequestQueue for media image requests - necessary because * images in protected blogs need to be authenticated, which requires a separate RequestQueue */ class MediaImageLoader { private MediaImageLoader() { throw new AssertionError(); } static ImageLoader getInstance() { return getInstance(WordPress.getCurrentBlog()); } static ImageLoader getInstance(Blog blog) { if (blog != null && VolleyUtils.isCustomHTTPClientStackNeeded(blog)) { // use ImageLoader with authenticating request queue for protected blogs AppLog.d(AppLog.T.MEDIA, "using custom imageLoader"); Context context = WordPress.getContext(); RequestQueue authRequestQueue = Volley.newRequestQueue(context, VolleyUtils.getHTTPClientStack(context, blog)); ImageLoader imageLoader = new ImageLoader(authRequestQueue, WordPress.getBitmapCache()); imageLoader.setBatchedResponseDelay(0); return imageLoader; } else { // use default ImageLoader for all others AppLog.d(AppLog.T.MEDIA, "using default imageLoader"); return WordPress.imageLoader; } } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
549449b633129229cbef79e6cf0bc7cb78473322
c40b235589793ea971d44a75efad4a60ed318a6a
/src/vista/iconos/icon.java
1956d832b54e52a3578364cc390ceb1277d30ce1
[]
no_license
miguelarriba/DBCase
8604c5240b2e063454058c50d204594515c752a7
a6a756dc03fb231515169a73ec171794141830c6
refs/heads/master
2020-04-07T00:17:21.063137
2019-10-07T16:04:05
2019-10-07T16:04:05
157,897,503
0
1
null
2020-02-06T14:52:11
2018-11-16T17:02:49
Java
UTF-8
Java
false
false
1,093
java
package vista.iconos; import javax.swing.Icon; public abstract class icon implements Icon{ private int size; private boolean pintarMas; private boolean selected; private final int DEFAULTSIZE = 60; private final int MINISIZE = 30; private final int PERSPECTIVESIZE = 50; protected double offset = .1; public icon() { super(); pintarMas = true; size = DEFAULTSIZE; } public icon(String tipo) { super(); switch(tipo) { case "mini": size = MINISIZE;pintarMas = false;break; case "perspective": size = PERSPECTIVESIZE;pintarMas = false;break; default: size = DEFAULTSIZE;pintarMas = true; } } public icon(String string, boolean selected) { this(string); this.selected = selected; } public void setSelected(boolean selected) { this.selected = selected; } protected boolean isSelected() { return selected; } protected boolean pintarMas() { return pintarMas; } @Override public int getIconWidth() { return size; } @Override public int getIconHeight() { return size == PERSPECTIVESIZE ? size :size/2; } }
[ "marriba@ucm.es" ]
marriba@ucm.es
7e2d995d465725c088bfe5cd028e4e72eb106211
e38d327138aa3ce48280fc60e2c5761f52654774
/app/src/main/java/com/vic/lab4/MainActivity.java
cc1c1b2a40643711546a4c72a79ef1fac8fc190f
[]
no_license
bpan2/MAP524_Lab4
aac347693bd175a0d2bcf74248612703f3c880bf
303c4de7f8f01cb5b3d8c1d02640a5449f779a8e
refs/heads/master
2020-05-18T17:11:24.736638
2015-04-09T05:00:50
2015-04-09T05:00:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,592
java
package com.vic.lab4; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends ActionBarActivity { boolean swap = false; FragmentOne fragOne = null; FragmentTwo fragTwo = null; Button btn; FragmentManager fm = getFragmentManager(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fragOne = new FragmentOne(); fragTwo = new FragmentTwo(); FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.fragView, fragOne, "Fragment1"); ft.addToBackStack("f1"); ft.add(R.id.fragView, fragTwo, "Fragment2"); ft.addToBackStack("f2"); ft.commit(); btn = (Button) findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { swap = swap == false ? true : false; if(fragOne != null){ fragOne.updateImageView(swap); } if(fragTwo != null){ fragTwo.updateImageView(swap); } } }); } }
[ "bpan2@myseneca.ca" ]
bpan2@myseneca.ca
9ad6058f9dadc9002dd2d25fe6465169565922a4
3d5717774fc11f14861f7545046dffcfe85afde1
/app/src/main/java/com/example/processcommunicate/skin/SkinManager.java
cb225a0f2053664fccad05224e5cb650a3ba58aa
[]
no_license
whoami-I/process
9c5bc10c7b2000ff44034504e2a59f2967e07f9b
b3dafd3f430bb3bee5c1cd1c70152170bed57328
refs/heads/master
2020-05-20T13:34:13.795863
2019-06-06T10:14:00
2019-06-06T10:14:00
185,601,242
0
0
null
null
null
null
UTF-8
Java
false
false
3,495
java
package com.example.processcommunicate.skin; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.text.TextUtils; import android.view.LayoutInflater; import com.example.processcommunicate.skin.config.SkinPreUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; public class SkinManager { private static SkinManager skinManager = new SkinManager(); private Context context; private Map<Activity, List<SkinView>> map = new HashMap<>(); private SkinResource mSkinResource; private SkinManager() { } public void init(Context context) { this.context = context.getApplicationContext(); //如果存在已经换肤的情况,那么就要先初始化mSkinResource变量 String skinPath = getSkinPath(); if (!TextUtils.isEmpty(skinPath)) { mSkinResource = new SkinResource(context, skinPath); } } public static SkinManager getInstance() { return skinManager; } public void loadSkin(String path) { if (TextUtils.isEmpty(path)) { throw new RuntimeException("Skin path can not be null"); } if (mSkinResource == null) { mSkinResource = new SkinResource(context, path); } else { String resourcePath = mSkinResource.getResourcePath(); if (!path.equals(resourcePath)) { mSkinResource = new SkinResource(context, path); } } Set<Activity> activities = map.keySet(); for (Activity activity : activities) { List<SkinView> skinViews = map.get(activity); for (SkinView skinView : skinViews) { skinView.skin(); } } //保存换肤路径 saveSkinPath(path); } public void restoreDefaultSkin() { String skinPath = getSkinPath(); if (TextUtils.isEmpty(skinPath)) return; skinPath = context.getPackageResourcePath(); mSkinResource = new SkinResource(context, skinPath); Set<Activity> activities = map.keySet(); for (Activity activity : activities) { List<SkinView> skinViews = map.get(activity); for (SkinView skinView : skinViews) { skinView.skin(); } } //清除皮肤 clearSkinPath(); } public void saveSkinPath(String path) { SkinPreUtils.getInstance(context).saveSkinPath(path); } public void clearSkinPath() { SkinPreUtils.getInstance(context).clearSkinPath(); } public String getSkinPath() { return SkinPreUtils.getInstance(context).getSkinPath(); } private void checkNotNull(String path) { } public SkinResource getSkinResource() { return mSkinResource; } public void register(Activity activity, SkinView skinView) { List<SkinView> skinViews = map.get(activity); if (skinViews == null) { skinViews = new ArrayList<>(); } skinViews.add(skinView); map.put(activity, skinViews); } public void unRegister(Activity activity) { map.remove(activity); } public void checkSkin(SkinView skinView) { String skinPath = getSkinPath(); if (!TextUtils.isEmpty(skinPath)) { skinView.skin(); } } }
[ "1874785601@qq.com" ]
1874785601@qq.com
2b45bc1331d14eec1a60295727fa8a3f54199d9a
538010f74485a8611d1368efc5ef442b2b3f3b16
/코드업/코드업 1085.java
599e3e3c8d0dc7f0fb9dd8cfc5327c7989240b94
[]
no_license
dddoseung/1Day1Commit
d52a25fc22afeb6383c4046ccf95ccc42a56ef7f
30e2170af287945cdea8624b89595daff08eb0bc
refs/heads/main
2023-03-03T14:21:29.643162
2021-02-19T12:52:23
2021-02-19T12:52:23
311,055,573
1
0
null
null
null
null
UTF-8
Java
false
false
486
java
import java.util.*; import java.text.DecimalFormat; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); double num=1; while(sc.hasNext()){ num*=sc.nextInt(); } num=num/(8*Math.pow(2,10)*Math.pow(2,10)); //DecimalFormat form=new DecimalFormat("0.0"); 소수점 첫째자리까지 System.out.format("%.1f MB",num); } }
[ "noreply@github.com" ]
noreply@github.com
25ec05c1aa35f8e9e057a27e849f5f21c3c97838
ab3a1a82fda5166daf4062b6d19e27ce31dc4548
/src/main/java/thread/DangerousThread.java
76523aa62346a7d93f863a791b07f53b74ac1ddf
[]
no_license
rafadelnero/javachallengers
8d532abbf44629e91335c03428a762f174a34cf5
a271fa8386fed7b6080a770eb3c7628d3d721a16
refs/heads/master
2022-12-25T05:52:26.644435
2022-12-17T16:28:55
2022-12-17T16:28:55
202,078,407
70
15
null
2022-12-17T16:21:49
2019-08-13T06:23:46
Java
UTF-8
Java
false
false
439
java
package thread; public class DangerousThread { public static void main(String... doYourBest) throws InterruptedException { Thread heisenberg = new Heisenberg(); heisenberg.start(); heisenberg.join(); heisenberg.start(); heisenberg.join(); } static class Heisenberg extends Thread { public void run() { System.out.println("I am the danger!"); } } }
[ "rafacdelnero@gmail.com" ]
rafacdelnero@gmail.com
b81d3ba01486620cb5a1d2d2080c9709ff5d4ed8
e15c58da1d0ded24b9defab70d3a23dfe6149729
/api/src/test/java/com/naverlabs/chatbot/service/web/ChatbotResourceTest.java
4c284bb1ec461ac7abd0478505ab4f7aeb1bdfc3
[]
no_license
stunstunstun/chatbot
cdcb23ed62a1a882dabe22fc92e346f0db55809b
4719c2aae0c932c24bd19acaa3fe20848c987eb3
refs/heads/master
2021-01-19T19:52:18.849504
2017-08-30T04:54:32
2017-08-30T04:54:32
101,212,645
2
0
null
2017-08-26T07:20:51
2017-08-23T18:29:41
Java
UTF-8
Java
false
false
1,313
java
package com.naverlabs.chatbot.service.web; import com.fasterxml.jackson.databind.ObjectMapper; import com.naverlabs.chatbot.domain.Chatbot; import com.naverlabs.chatbot.v1.web.ChatbotResource; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.json.JacksonTester; import org.springframework.core.io.ClassPathResource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import java.io.IOException; import static org.assertj.core.api.Assertions.assertThat; /** * @author minhyeok */ @RunWith(SpringRunner.class) @Transactional @SpringBootTest public class ChatbotResourceTest { private JacksonTester<ChatbotResource> jacksonTester; private ChatbotResource resource; @Before public void setup() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); JacksonTester.initFields(this, objectMapper); resource = jacksonTester.readObject(new ClassPathResource("chatbot_resource.json")); } @Test public void entityIsMutable() { Chatbot entity = resource.getEntity(); assertThat(entity).isEqualTo(resource.getEntity()); } }
[ "wjdsupj@gmail.com" ]
wjdsupj@gmail.com
44ef7989ee1bcfde2644ed5c17ea58021a0eae0c
8a539448c904b8bc07e8881ca820e5baa9cc0ae0
/src/main/java/com/virtru/saas/framework/sqs/AwsSqsProvider.java
8979d4af170a54f551398fc06d9e9abd3f3c022b
[]
no_license
mkhader12/saasgateway2
db7df5b1ed463baf114f7c7f47a54a13d500382c
2787b2d511920e6ebed775f251c16b7086d236a0
refs/heads/master
2020-03-11T20:00:31.355535
2018-04-19T14:17:37
2018-04-19T14:17:37
130,224,353
1
2
null
null
null
null
UTF-8
Java
false
false
2,560
java
package com.virtru.saas.framework.sqs; import com.amazon.sqs.javamessaging.AmazonSQSMessagingClientWrapper; import com.amazon.sqs.javamessaging.ProviderConfiguration; import com.amazon.sqs.javamessaging.SQSConnection; import com.amazon.sqs.javamessaging.SQSConnectionFactory; import com.amazonaws.services.sqs.AmazonSQSClientBuilder; import com.amazonaws.services.sqs.model.CreateQueueRequest; import com.amazonaws.services.sqs.model.CreateQueueResult; import com.amazonaws.services.sqs.model.DeleteMessageRequest; import com.amazonaws.services.sqs.model.GetQueueUrlResult; import com.amazonaws.services.sqs.model.ReceiveMessageRequest; import com.amazonaws.services.sqs.model.ReceiveMessageResult; import com.amazonaws.services.sqs.model.SendMessageRequest; import com.amazonaws.services.sqs.model.SendMessageResult; import javax.jms.JMSException; public class AwsSqsProvider implements QueueProvider { private static AmazonSQSMessagingClientWrapper client; public AwsSqsProvider(int numberOfMessagesToPrefetch) throws JMSException { // Create a new connection factory with all defaults (credentials and region) set automatically SQSConnectionFactory connectionFactory = new SQSConnectionFactory( new ProviderConfiguration().withNumberOfMessagesToPrefetch(numberOfMessagesToPrefetch), AmazonSQSClientBuilder.defaultClient() ); // Create the connection. SQSConnection connection = connectionFactory.createConnection(); // Get the wrapped client client = connection.getWrappedAmazonSQSClient(); } @Override public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSException { client.deleteMessage(deleteMessageRequest); } @Override public SendMessageResult sendMessage(SendMessageRequest sendMessageRequest) throws JMSException { return client.sendMessage(sendMessageRequest); } @Override public boolean queueExists(String queueName) throws JMSException { return client.queueExists(queueName); } @Override public GetQueueUrlResult getQueueUrl(String queueName) throws JMSException { return client.getQueueUrl(queueName); } @Override public CreateQueueResult createQueue(CreateQueueRequest createQueueRequest) { return null; } @Override public ReceiveMessageResult receiveMessage(ReceiveMessageRequest receiveMessageRequest) throws JMSException { return client.receiveMessage(receiveMessageRequest); } }
[ "mkhader@virtru.com" ]
mkhader@virtru.com
9343679e9ed666afa0edb26e60c4647c55089fc1
5217d79af2ca6232edec96a2d8ffe371935e93df
/chorus-selftest/src/test/features/org/chorusbdd/chorus/selftest/processhandler/nonjava/TestNonJavaProcesses.java
7dc8a552b50c6575fd3e5ba4b43eaef1d14a4ed8
[ "MIT" ]
permissive
deepakcdo/Chorus
f263c201a9220ef760826f8f55fe53e36b57491c
c22362a71db7afc22b75cbc9e443ae39018b0995
refs/heads/master
2021-01-17T06:06:25.342740
2014-07-09T20:41:00
2014-07-09T20:41:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,591
java
/** * Copyright (C) 2000-2013 The Software Conservancy and Original Authors. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Nothing in this notice shall be deemed to grant any rights to trademarks, * copyrights, patents, trade secrets or any other intellectual property of the * licensor or any contributor except as expressly stated herein. No patent * license is granted separate from the Software, for code that you delete from * the Software, or for combinations of the Software with other software or * hardware. */ package org.chorusbdd.chorus.selftest.processhandler.nonjava; import org.chorusbdd.chorus.selftest.AbstractInterpreterTest; import org.chorusbdd.chorus.selftest.DefaultTestProperties; /** * Created with IntelliJ IDEA. * User: nick * Date: 25/06/12 * Time: 22:14 */ public class TestNonJavaProcesses extends AbstractInterpreterTest { final String featurePath = "src/test/features/org/chorusbdd/chorus/selftest/processhandler/nonjava/startnonjava.feature"; final int expectedExitCode = 0; //success protected int getExpectedExitCode() { return expectedExitCode; } protected String getFeaturePath() { return featurePath; } /** * A test can override this method to modify the sys properties being used from the default set */ protected void doUpdateTestProperties(DefaultTestProperties sysProps) { sysProps.setProperty("chorusExecutionListener", PropertyWritingExecutionListener.class.getName()); } }
[ "nick@objectdefinitions.com" ]
nick@objectdefinitions.com
de445e280c0675d722df1f9034837d9f735f6940
31f609157ae46137cf96ce49e217ce7ae0008b1e
/bin/ext-accelerator/acceleratorfacades/src/de/hybris/platform/acceleratorfacades/product/converters/populator/ProductVolumePricesPopulator.java
2e23837875a7f09f87a60c6aaacc089ae98b0ac0
[]
no_license
natakolesnikova/hybrisCustomization
91d56e964f96373781f91f4e2e7ca417297e1aad
b6f18503d406b65924c21eb6a414eb70d16d878c
refs/heads/master
2020-05-23T07:16:39.311703
2019-05-15T15:08:38
2019-05-15T15:08:38
186,672,599
1
0
null
null
null
null
UTF-8
Java
false
false
5,052
java
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.platform.acceleratorfacades.product.converters.populator; import de.hybris.platform.commercefacades.product.PriceDataFactory; import de.hybris.platform.commercefacades.product.converters.populator.AbstractProductPopulator; import de.hybris.platform.commercefacades.product.data.PriceData; import de.hybris.platform.commercefacades.product.data.PriceDataType; import de.hybris.platform.commercefacades.product.data.ProductData; import de.hybris.platform.commerceservices.util.AbstractComparator; import de.hybris.platform.core.model.product.ProductModel; import de.hybris.platform.europe1.jalo.PriceRow; import de.hybris.platform.jalo.order.price.PriceInformation; import de.hybris.platform.product.PriceService; import de.hybris.platform.servicelayer.dto.converter.ConversionException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Required; /** * Populator for product volume prices. */ public class ProductVolumePricesPopulator<SOURCE extends ProductModel, TARGET extends ProductData> extends AbstractProductPopulator<SOURCE, TARGET> { private PriceService priceService; private PriceDataFactory priceDataFactory; protected PriceService getPriceService() { return priceService; } @Required public void setPriceService(final PriceService priceService) { this.priceService = priceService; } protected PriceDataFactory getPriceDataFactory() { return priceDataFactory; } @Required public void setPriceDataFactory(final PriceDataFactory priceDataFactory) { this.priceDataFactory = priceDataFactory; } @Override public void populate(final SOURCE productModel, final TARGET productData) throws ConversionException { if (productData != null) { final List<PriceInformation> pricesInfos = getPriceService().getPriceInformationsForProduct(productModel); if (pricesInfos == null || pricesInfos.size() < 2) { productData.setVolumePrices(Collections.<PriceData> emptyList()); } else { final List<PriceData> volPrices = createPrices(productModel, pricesInfos); // Sort the list into quantity order Collections.sort(volPrices, VolumePriceComparator.INSTANCE); // Set the max quantities for (int i = 0; i < volPrices.size() - 1; i++) { volPrices.get(i).setMaxQuantity(Long.valueOf(volPrices.get(i + 1).getMinQuantity().longValue() - 1)); } productData.setVolumePrices(volPrices); } } } protected List<PriceData> createPrices(final SOURCE productModel, final List<PriceInformation> pricesInfos) { final List<PriceData> volPrices = new ArrayList<PriceData>(); final PriceDataType priceType = getPriceType(productModel);//not necessary for (final PriceInformation priceInfo : pricesInfos) { final Long minQuantity = getMinQuantity(priceInfo); if (minQuantity != null) { final PriceData volPrice = createPriceData(priceType, priceInfo); if (volPrice != null) { volPrice.setMinQuantity(minQuantity); volPrices.add(volPrice); } } } return volPrices; } protected PriceDataType getPriceType(final ProductModel productModel) { if (CollectionUtils.isEmpty(productModel.getVariants())) { return PriceDataType.BUY; } else { return PriceDataType.FROM; } } protected Long getMinQuantity(final PriceInformation priceInfo) { final Map qualifiers = priceInfo.getQualifiers(); final Object minQtdObj = qualifiers.get(PriceRow.MINQTD); if (minQtdObj instanceof Long) { return (Long) minQtdObj; } return null; } protected PriceData createPriceData(final PriceDataType priceType, final PriceInformation priceInfo) { return getPriceDataFactory().create(priceType, BigDecimal.valueOf(priceInfo.getPriceValue().getValue()), priceInfo.getPriceValue().getCurrencyIso()); } public static class VolumePriceComparator extends AbstractComparator<PriceData> { public static final VolumePriceComparator INSTANCE = new VolumePriceComparator(); @Override protected int compareInstances(final PriceData price1, final PriceData price2) { if (price1 == null || price1.getMinQuantity() == null) { return BEFORE; } if (price2 == null || price2.getMinQuantity() == null) { return AFTER; } return compareValues(price1.getMinQuantity().longValue(), price2.getMinQuantity().longValue()); } } }
[ "nataliia@spadoom.com" ]
nataliia@spadoom.com
8826e1d19c5ef5c98a00f51843c985220a9d830e
f428f600c682396db98127c7ea647b865a57b041
/app/src/androidTest/java/com/example/spinnervolition/ExampleInstrumentedTest.java
d824d90d1e7c56ed95fcc0c94489bb94a3bd0075
[]
no_license
AscEmon/SpinnerVolition
1190dd65e93d44955a74933ede996ab51d042014
79a1939e284d601623abd590811ef2e9803a7079
refs/heads/master
2023-02-26T09:08:53.432873
2021-01-21T17:06:25
2021-01-21T17:06:25
328,210,023
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.example.spinnervolition; 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.example.spinnervolition", appContext.getPackageName()); } }
[ "sayedemon53@gmail.com" ]
sayedemon53@gmail.com
30fc3f233913496fdfb64075afb15f0dfc231c2a
9971d019c5a4ecd0892cb9e035c5f5d77af25f92
/src/ru/job4j/array/AlgoArray.java
eff7d09c59f35f46c0a3084cbfce94289e65d2cc
[]
no_license
Zhaava/job4j_elementary
ce5460a97e10e49d82ab93fa033fc8e4d9492bbd
18c26c033806f30a61eabb7720b518dfcb25b5e2
refs/heads/master
2023-05-28T04:23:18.138892
2021-06-22T11:33:56
2021-06-22T11:33:56
298,788,560
0
0
null
2020-09-26T10:17:24
2020-09-26T10:17:23
null
UTF-8
Java
false
false
879
java
package ru.job4j.array; public class AlgoArray { public static void main(String[] args) { int[] array = new int[] {5, 3, 2, 1, 4}; int temp = array[0]; /* переменная для временного хранения значение ячейки с индексом 0. */ array[0] = array[3]; /* записываем в ячейку с индексом 0 значение ячейки с индексом 3. */ array[3] = temp; /* записываем в ячейку с индексом 3 значение временной переменной. */ temp = array[1]; array[1] = array[2]; array[2] = temp; temp = array[3]; array[3] = array[4]; array[4] = temp; for (int index = 0; index < array.length; index++) { System.out.println(array[index]); } } }
[ "zhavoronkov52@gmail.com" ]
zhavoronkov52@gmail.com
c668c74a6fd1de0aea98781e0b31fb88f90d81bd
b2bac83818f1e3a97d33988423a8b737627b3be9
/hibernate/src/extend/teacher.java
9d44e1b60b506bb9741132d10471861e3edad2a2
[]
no_license
pupilBin/learn
8177fe0cfa060955c3ff88ac63a57f2cfc14e1ad
132fb53adc3d4f0501e86a8cd466221c9e06876c
refs/heads/master
2020-12-07T07:43:28.630882
2017-07-14T14:49:28
2017-07-14T14:49:28
53,180,867
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package extend; /** * Created by pupil on 2016/6/20. */ public class teacher extends person { private int salary; public int getSalary() { return salary; } public void setSalary(int salary) { this.salary = salary; } }
[ "pupil240343458@gmail.com" ]
pupil240343458@gmail.com
db0faf2fb373497243aadbc86e1a67b569188922
b8a3722927230fec536bf9e3b1c65331e1aa8c7c
/src/main/java/com/harry/tomcat/ex01/Request.java
6854137debfff9e8e32e8e7553fad12008f9141a
[]
no_license
buffon/TomcatShoot
7a9535bf4694e73629402a7874d3304cb547d490
fc1451c61686aca2e665e13182c140cd5b4869da
refs/heads/master
2016-09-06T05:35:01.930234
2015-01-12T04:24:20
2015-01-12T04:24:20
27,675,082
1
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package com.harry.tomcat.ex01; import java.io.InputStream; import java.io.IOException; public class Request { private InputStream input; private String uri; public Request(InputStream input) { this.input = input; } public void parse() { // Read a set of characters from the socket StringBuffer request = new StringBuffer(2048); int i; byte[] buffer = new byte[2048]; try { i = input.read(buffer); } catch (IOException e) { e.printStackTrace(); i = -1; } for (int j=0; j<i; j++) { request.append((char) buffer[j]); } System.out.print(request.toString()); uri = parseUri(request.toString()); } private String parseUri(String requestString) { int index1, index2; index1 = requestString.indexOf(' '); if (index1 != -1) { index2 = requestString.indexOf(' ', index1 + 1); if (index2 > index1) return requestString.substring(index1 + 1, index2); } return null; } public String getUri() { return uri; } }
[ "569637989@qq.com" ]
569637989@qq.com
80d827cba9c12e300c15eb85cd7eab04c88c3369
7859fb2a0d2d8b324b3b78ace92803cd0eba3f5b
/src/main/java/ar/edu/um/programacion2/config/WebConfigurer.java
5f0c34af8654ed6e3e252f5899a94e3ab5eeaffc
[]
no_license
francomanuel/programacion2-tp
a9fc1c73e56c904398d95951f6b336f5e054edfd
ce30a3763a3a8f85c839e2626b62ec3b975df314
refs/heads/master
2022-12-09T07:58:57.167364
2020-09-01T22:44:41
2020-09-01T22:44:41
292,095,741
0
0
null
null
null
null
UTF-8
Java
false
false
5,478
java
package ar.edu.um.programacion2.config; import io.github.jhipster.config.JHipsterConstants; import io.github.jhipster.config.JHipsterProperties; import io.github.jhipster.config.h2.H2ConfigurationHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.web.server.*; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.core.env.Profiles; import org.springframework.http.MediaType; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; import javax.servlet.*; import java.io.File; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.util.*; import static java.net.URLDecoder.decode; /** * Configuration of web application with Servlet 3.0 APIs. */ @Configuration public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); private final Environment env; private final JHipsterProperties jHipsterProperties; public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) { this.env = env; this.jHipsterProperties = jHipsterProperties; } @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); } if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) { initH2Console(servletContext); } log.info("Web application fully configured"); } /** * Customize the Servlet engine: Mime types, the document root, the cache. */ @Override public void customize(WebServerFactory server) { setMimeMappings(server); // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets. setLocationForStaticAssets(server); } private void setMimeMappings(WebServerFactory server) { if (server instanceof ConfigurableServletWebServerFactory) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711 mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase()); // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64 mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=" + StandardCharsets.UTF_8.name().toLowerCase()); ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server; servletWebServer.setMimeMappings(mappings); } } private void setLocationForStaticAssets(WebServerFactory server) { if (server instanceof ConfigurableServletWebServerFactory) { ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server; File root; String prefixPath = resolvePathPrefix(); root = new File(prefixPath + "target/classes/static/"); if (root.exists() && root.isDirectory()) { servletWebServer.setDocumentRoot(root); } } } /** * Resolve path prefix to static resources. */ private String resolvePathPrefix() { String fullExecutablePath; try { fullExecutablePath = decode(this.getClass().getResource("").getPath(), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { /* try without decoding if this ever happens */ fullExecutablePath = this.getClass().getResource("").getPath(); } String rootPath = Paths.get(".").toUri().normalize().getPath(); String extractedPath = fullExecutablePath.replace(rootPath, ""); int extractionEndIndex = extractedPath.indexOf("target/"); if (extractionEndIndex <= 0) { return ""; } return extractedPath.substring(0, extractionEndIndex); } @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/api/**", config); source.registerCorsConfiguration("/management/**", config); source.registerCorsConfiguration("/v2/api-docs", config); } return new CorsFilter(source); } /** * Initializes H2 console. */ private void initH2Console(ServletContext servletContext) { log.debug("Initialize H2 console"); H2ConfigurationHelper.initH2Console(servletContext); } }
[ "frma98@gmail.com" ]
frma98@gmail.com
f21842427f6622d9325dfa4fc0cb42cb72f8a132
5bb4a4b0364ec05ffb422d8b2e76374e81c8c979
/sdk/eventgrid/mgmt-v2020_04_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2020_04_01_preview/DeliveryWithResourceIdentity.java
bd825a8f530c728e05ea687e320bc3b426367d54
[ "MIT", "LicenseRef-scancode-generic-cla", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
FabianMeiswinkel/azure-sdk-for-java
bd14579af2f7bc63e5c27c319e2653db990056f1
41d99a9945a527b6d3cc7e1366e1d9696941dbe3
refs/heads/main
2023-08-04T20:38:27.012783
2020-07-15T21:56:57
2020-07-15T21:56:57
251,590,939
3
1
MIT
2023-09-02T00:50:23
2020-03-31T12:05:12
Java
UTF-8
Java
false
false
2,465
java
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.eventgrid.v2020_04_01_preview; import com.fasterxml.jackson.annotation.JsonProperty; /** * Information about the delivery for an event subscription with resource * identity. */ public class DeliveryWithResourceIdentity { /** * The identity to use when delivering events. */ @JsonProperty(value = "identity") private EventSubscriptionIdentity identity; /** * Information about the destination where events have to be delivered for * the event subscription. * Uses Azure Event Grid's identity to acquire the authentication tokens * being used during delivery / dead-lettering. */ @JsonProperty(value = "destination") private EventSubscriptionDestination destination; /** * Get the identity to use when delivering events. * * @return the identity value */ public EventSubscriptionIdentity identity() { return this.identity; } /** * Set the identity to use when delivering events. * * @param identity the identity value to set * @return the DeliveryWithResourceIdentity object itself. */ public DeliveryWithResourceIdentity withIdentity(EventSubscriptionIdentity identity) { this.identity = identity; return this; } /** * Get information about the destination where events have to be delivered for the event subscription. Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. * * @return the destination value */ public EventSubscriptionDestination destination() { return this.destination; } /** * Set information about the destination where events have to be delivered for the event subscription. Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. * * @param destination the destination value to set * @return the DeliveryWithResourceIdentity object itself. */ public DeliveryWithResourceIdentity withDestination(EventSubscriptionDestination destination) { this.destination = destination; return this; } }
[ "noreply@github.com" ]
noreply@github.com
a9c253fc5e056c904726cf6ff48e94ae004463f3
2702ff64b7bbe69279c54f505712ce7bcc65022e
/src/Exercicio3b/Funcionario.java
b0cd1c4cb2baf07625246dac0fdce553883250f1
[]
no_license
matheushenrycb/DispositivosMoveis
0cab9c86bb2d2c03fe33aaacb8db81a745ce5e20
e1f0850431c26bcaaf5dd5ffb0f9f1c9c2e95f8c
refs/heads/master
2021-04-27T21:15:22.417381
2018-02-22T17:22:47
2018-02-22T17:22:47
122,396,974
0
0
null
null
null
null
UTF-8
Java
false
false
1,408
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 Exercicio3b; /** * * @author Matheus HEnry */ public class Funcionario extends Principal { int matricula; double salario1; double salario2; public Funcionario(int matricula,double salario1, double salario2) { this.matricula= matricula; this.salario1 = salario1; this.salario2= salario2; } public int getMatricula() { return matricula; } public void setMatricula(int matricula) { this.matricula = matricula; } public double getSalario1() { return salario1*0.40; } public void setSalario1(double salario1) { this.salario1 = salario1; } public double getSalario2() { return salario2*0.60; } public void setSalario2(double salario2) { this.salario2 = salario2; } public void getparcelaUm() { System.out.println("-------------------------------------------------"); System.out.println("Primeira parcela do Salario: " + this.getSalario1()); } public void getparcelaDois() { System.out.println("Segunda parcela do Salario: " + this.getSalario2()); } }
[ "Matheus HEnry@MatheusHEnry-PC" ]
Matheus HEnry@MatheusHEnry-PC
c4a450fd65b924fa352c06d6ab7cbd6a225b52db
ce67b727842fab338c594cebf5b943352e42bb17
/jdbc/src/main/java/com/jdbc/StudentDao/StudentDaoImpl.java
d45e856509a614e0a2a6b62f4d6e87ccc7103a7e
[]
no_license
Smart110/mytest
c70d39b517236a4037e832f71da1781933470676
a1a1a6a2ff09ceed4b1d7ec423e6f0e44e0b72c7
refs/heads/master
2021-05-06T22:38:24.196632
2017-12-03T13:07:40
2017-12-03T13:07:40
112,921,088
0
0
null
null
null
null
UTF-8
Java
false
false
1,656
java
package com.jdbc.StudentDao; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; import com.jdbc.jdbc.Student; @Repository public class StudentDaoImpl implements StudentDao { @Autowired private JdbcTemplate jdbcTemplate; //增加 @Override public int add(Student student) { return jdbcTemplate.update("insert into student(name, age) values(?, ?)", student.getName(),student.getAge()); } @Override public int update(Student student) { return jdbcTemplate.update("UPDATE student SET name=? ,age=? WHERE id=?", student.getName(),student.getAge(),student.getId()); } @Override public int delete(int id) { return jdbcTemplate.update("DELETE from TABLE account where id=?",id); } @Override public Student findStudentById(int id) { List<Student> list = jdbcTemplate.query("select * from student where id = ?", new Object[]{id}, new BeanPropertyRowMapper(Student.class)); if(list!=null && list.size()>0){ Student student = list.get(0); return student; }else{ return null; } } @Override public List<Student> findStudentList() { List<Student> list = jdbcTemplate.query("select * from student", new Object[]{}, new BeanPropertyRowMapper(Student.class)); if(list!=null && list.size()>0){ return list; }else{ return null; } } }
[ "15600050637@163.com" ]
15600050637@163.com
52202305cc4658e186476e3bc18efd4bb1b315ba
2f3bb917adcc081c8ef2f7370787ef83431183c5
/src/main/java/com/igomall/entity/Admin.java
ec350fd4624a739963dfd827d06ba947f95ae53e
[]
no_license
heyewei/shopec-b2b2c
bc7aad32fc632ab20c3ed1f6a875e533d482dfa3
a03fd48250aad4315a6ff687b6d01c7e12d0f93e
refs/heads/master
2023-02-24T13:12:37.985421
2021-01-27T07:24:25
2021-01-27T07:24:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,090
java
package com.igomall.entity; import java.util.HashSet; import java.util.Set; import javax.persistence.Entity; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Transient; import javax.validation.constraints.NotEmpty; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang.StringUtils; import com.baomidou.mybatisplus.annotation.TableField; /** * Entity - 管理员 * */ @Entity public class Admin extends User { private static final long serialVersionUID = -4000007477538426L; /** * 用户名 */ @NotEmpty(groups = Save.class) private String username; /** * 密码 */ @NotEmpty(groups = Save.class) @TableField(exist = false) private String password; /** * 加密密码 */ private String encodedPassword; /** * E-mail */ @NotEmpty private String email; /** * 手机 */ @NotEmpty private String mobile; /** * 姓名 */ private String name; /** * 部门 */ private String department; /** * 角色 */ @TableField(exist=false) private Set<Role> roles = new HashSet<>(); /** * 获取用户名 * * @return 用户名 */ public String getUsername() { return username; } /** * 设置用户名 * * @param username * 用户名 */ public void setUsername(String username) { this.username = username; } /** * 获取密码 * * @return 密码 */ public String getPassword() { return password; } /** * 设置密码 * * @param password * 密码 */ public void setPassword(String password) { this.password = password; if (password != null) { setEncodedPassword(DigestUtils.md5Hex(password)); } } /** * 获取加密密码 * * @return 加密密码 */ public String getEncodedPassword() { return encodedPassword; } /** * 设置加密密码 * * @param encodedPassword * 加密密码 */ public void setEncodedPassword(String encodedPassword) { this.encodedPassword = encodedPassword; } /** * 获取E-mail * * @return E-mail */ public String getEmail() { return email; } /** * 设置E-mail * * @param email * E-mail */ public void setEmail(String email) { this.email = email; } /** * 获取手机 * * @return 手机 */ public String getMobile() { return mobile; } /** * 设置手机 * * @param mobile * 手机 */ public void setMobile(String mobile) { this.mobile = mobile; } /** * 获取姓名 * * @return 姓名 */ public String getName() { return name; } /** * 设置姓名 * * @param name * 姓名 */ public void setName(String name) { this.name = name; } /** * 获取部门 * * @return 部门 */ public String getDepartment() { return department; } /** * 设置部门 * * @param department * 部门 */ public void setDepartment(String department) { this.department = department; } /** * 获取角色 * * @return 角色 */ public Set<Role> getRoles() { return roles; } /** * 设置角色 * * @param roles * 角色 */ public void setRoles(Set<Role> roles) { this.roles = roles; } @Override @Transient public String getDisplayName() { return getUsername(); } @Override @Transient public Object getPrincipal() { return getUsername(); } @Override @Transient public Object getCredentials() { return getPassword(); } @Override @Transient public boolean isValidCredentials(Object credentials) { return credentials != null && StringUtils.equals(DigestUtils.md5Hex(credentials instanceof char[] ? String.valueOf((char[]) credentials) : String.valueOf(credentials)), getEncodedPassword()); } /** * 持久化前处理 */ @PrePersist public void prePersist() { setUsername(StringUtils.lowerCase(getUsername())); setEmail(StringUtils.lowerCase(getEmail())); } /** * 更新前处理 */ @PreUpdate public void preUpdate() { setEmail(StringUtils.lowerCase(getEmail())); } }
[ "1169794338@qq.com" ]
1169794338@qq.com
cef23af2baee0b6de5b619ab850babad33437447
ea26cbed5987b284b15a919c42b6d4dd04145809
/src/main/java/com/oop/mail/MailController.java
d97573121fd101b53eaced7bcea84e9e356eff9c
[]
no_license
petrostrak/airSense
94578697e6d23c39116969ffb6e99bd5a6038f31
4cca6719f2dc78c6f1ff06ba4b6f984930e333d5
refs/heads/master
2022-11-19T05:51:15.095382
2020-07-21T06:44:34
2020-07-21T06:44:34
269,696,214
0
0
null
null
null
null
UTF-8
Java
false
false
1,121
java
package com.oop.mail; import com.oop.entities.SensorLocation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; /** * * @author orestis */ @RestController public class MailController { @Autowired private MailService emailService; @RequestMapping(value = "/sendmail", method = RequestMethod.GET) public String sendMail() { // String from = "orestis.raspberry@gmail.com"; String subject = "Dickpics from your awesome springboot app"; String toAddresses = "orestispanago@gmail.com"; String body = "<html> <body><h1>Rendered HTML, plain text is for boootsam </h1> </body></html>"; emailService.sendMail(subject, toAddresses, body); return "mail sent"; } } // TODO check here for html paths: // https://stackoverflow.com/questions/37163553/sending-html-with-message-in-email-using-file-path
[ "pit.trak@gmail.com" ]
pit.trak@gmail.com
c86475448aaf7872564d12f3f8dc6c6fa2c49df8
45141bec96cd635707213dba449867a36d6da3b4
/Lab2/src/main/java/com/naofi/controllers/ManagerController.java
c59cfaffc289486fe445335d9e469f82e75ae492
[]
no_license
kubayof/databases
fbac65db9885337ea1067078e95a2905cbad63e9
ef28e552a5e38f78e239405c456c8f2710857bf0
refs/heads/master
2023-02-08T03:50:25.569543
2020-12-29T14:22:24
2020-12-29T14:22:24
291,979,282
0
0
null
null
null
null
UTF-8
Java
false
false
2,822
java
package com.naofi.controllers; import com.naofi.model.dao.interfaces.ManagerDAO; import com.naofi.model.entity.Manager; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; @Controller @RequestMapping("/managers") public class ManagerController { private final ManagerDAO dao; public ManagerController(ManagerDAO dao) { this.dao = dao; } @GetMapping("/id") @ResponseBody public Manager getById(@RequestParam Integer id) { Manager manager = dao.getById(id); if (manager == null) { throw new NullPointerException(); } return manager; } @GetMapping("/first_name") public String getByFirstName(@RequestParam("first_name") String firstName, Model model) { model.addAttribute("items", dao.getByFirstName(firstName)); return "list_info"; } @GetMapping("/last_name") public String getByLastName(@RequestParam("last_name") String lastName, Model model) { model.addAttribute("items", dao.getByLastName(lastName)); return "list_info"; } @GetMapping("/get_by") public String getBy(Manager manager, Model model) { model.addAttribute("items", dao.getBy(manager)); return "list_info"; } @GetMapping("/project_id") @ResponseBody public Manager getByProjectId(@RequestParam("project_id") Integer projectId) { Manager manager = dao.getByProjectId(projectId); if (manager == null) { throw new NullPointerException(); } return manager; } @GetMapping("/programmer_id") @ResponseBody public Manager getByProgrammerId(@RequestParam("programmer_id") Integer programmerId) { Manager manager = dao.getByProgrammerId(programmerId); if (manager == null) { throw new NullPointerException(); } return manager; } @PostMapping("/new") @ResponseBody public String createNew(Manager manager) { if (dao.save(manager) > 0) { return "Successfully inserted"; } else { return "Error while insert attempt"; } } @PostMapping("/update") @ResponseBody public String update(Manager manager) { if (dao.update(manager) > 0) { return "Updated successfully"; } else { return "Error while updating"; } } @PostMapping("/delete") @ResponseBody public String delete(@RequestParam("id") Integer id) { if (dao.deleteById(id) > 0) { return "Successfully deleted"; } else { return "Error during delete attempt"; } } }
[ "kubyof82@gmail.com" ]
kubyof82@gmail.com
fde7b8a40d76dd294f8f72f5e407832d7ffff197
530fe1b3a654543334d5a9afbb2ea46b8544d6b0
/week-03/Day-03/src/Workshop10.java
62ae68137f775f44a244005451bb7f5ca56377c6
[]
no_license
greenfox-zerda-raptors/PappBeata
d58ea959f8588172df5ae9994a552a6af5bb7283
3a67b8eedeb7e1b0ff723429ea4faa5350fa8d80
refs/heads/master
2021-01-12T18:19:16.649526
2017-05-06T07:55:19
2017-05-06T07:55:19
71,363,242
0
1
null
null
null
null
UTF-8
Java
false
false
857
java
import java.util.Arrays; public class Workshop10{ public static void main(String[] args) { // Task 1: Create an array (jagged) which can contain the different shades of specified colors // in colors[0] store the shades of green: "lime", "forest green", "olive", "pale green", "spring green" // in colors[1] store the shades of red: "orange red", "red", "tomato" // in colors[2] store the shades of pink: "orchid", "violet", "pink", "hot pink" String colors[][]={{"lime", "forest green", "olive", "pale green", "spring green"}, {"orange red", "red", "tomato"}, {"orchid", "violet", "pink", "hot pink"}}; // Task 2: Print the values of the array to the console int i; for (i=0; i<3; i++) { System.out.print(Arrays.toString(colors[i]) + "\n"); } } }
[ "pappbeata@gmail.com" ]
pappbeata@gmail.com
72b4be0b85b42e90a0e9f1acdb88507cf5ee79c7
3b1e641f51d9cb0c39804dd35e693f0586b7316b
/src/com/configuration/YamlConfiguration.java
809a0f02597c424001956d5b4ab3f6172f69dc32
[]
no_license
mohanr/Code-Generator
61dfd4ea1c6a59f14480e11eda9ffc172549142d
016dbd742b36bdf05c44772b096d76758c9c6887
refs/heads/master
2021-01-19T04:51:55.020174
2019-12-18T09:39:35
2019-12-18T09:39:35
61,132,831
0
0
null
null
null
null
UTF-8
Java
false
false
2,034
java
package com.configuration; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * Created by Mohan Radhakrishnan on 7/11/2016. */ public class YamlConfiguration { Yaml yaml = new Yaml(); Map<String, ArrayList> config; static TransformerRuleConfiguration rules; public static final String CONFIG_FILE = "D:\\IdeaProjects\\Antlr\\config.yml"; private YamlConfiguration(){ } public static TransformerRuleConfiguration getDefaultTransformerRuleConfiguration(){ Constructor constructor = new Constructor(TransformerRuleConfiguration.class); TypeDescription ruleDescription = new TypeDescription(TransformerRuleConfiguration.class); constructor.addTypeDescription( ruleDescription ); loadImports( ruleDescription ); loadOutputLocation( ruleDescription ); loadClassIdentifier(ruleDescription); Yaml yaml = new Yaml(constructor); try { rules = (TransformerRuleConfiguration) yaml.loadAs(new FileReader(CONFIG_FILE), TransformerRuleConfiguration.class); }catch( final FileNotFoundException fnfex ){ throw new Error(fnfex); } return rules; } private static void loadOutputLocation( TypeDescription ruleDescription ) { ruleDescription.putListPropertyType("outputDir", String.class); } private static void loadImports( TypeDescription ruleDescription ){ ruleDescription.putListPropertyType("oldImports", String.class); ruleDescription.putListPropertyType("newImports", String.class); } private static void loadClassIdentifier( TypeDescription ruleDescription ){ ruleDescription.putListPropertyType("classIdentifier ", String.class); } }
[ "476458@CTS.COM" ]
476458@CTS.COM
6da794cd6607e05a8238ca00b3d812c61aa50d36
0943ac0ad90002e3ae5207a94f9973a84077dda3
/app/src/main/java/com/hesham/fibonacci/fibonaccinumbers/GeneralDialogFragment.java
6dc9e422e4133c8565b01de97be3117a6829b837
[]
no_license
heshamfas/FibonacciNumbers
816a0052fa65c7f490b0b3293a32d0b572423daf
2695a55e54b081d7168ab777861ba347bfd2fb17
refs/heads/master
2021-01-02T08:34:14.159262
2014-09-07T19:59:56
2014-09-07T19:59:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
941
java
package com.hesham.fibonacci.fibonaccinumbers; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.Context; import android.os.Bundle; import android.view.View; /** * Created by Hesham on 8/11/2014. */ public class GeneralDialogFragment extends DialogFragment{ public GeneralDialogFragment() { } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Bundle bundle = this.getArguments(); String title = bundle.getString("title"); String message = bundle.getString("message"); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); alertDialogBuilder.setTitle(title); alertDialogBuilder.setMessage(message); //null should be your on click listener alertDialogBuilder.setPositiveButton("OK", null); return alertDialogBuilder.create(); } }
[ "HeshamFas@live.com" ]
HeshamFas@live.com
2bae16e3a285e4b5541f8094cda1fb6203e75cf2
4a14000f60919ca75d7a3200116f5b181f298806
/src/com/test/unit9/VerifierTest.java
d877e8d363a9aa067e17b39ef93913ce96ee1c56
[]
no_license
Gitrenzhijiang/JavaCoreDemo
5b0f19fea5116e1186c16bdab11c5f2aab4af5df
36bf1e9d41e977c941ee7d23a239ab71ffb3f94e
refs/heads/master
2020-04-23T15:32:55.923512
2019-02-18T11:13:05
2019-02-18T11:13:05
171,269,498
0
0
null
null
null
null
UTF-8
Java
false
false
1,235
java
package com.test.unit9; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.nio.file.Paths; /** * Java SecurityManager 测试实例 * @author REN * */ public class VerifierTest { public static void main(String[] args) throws Exception { System.setProperty("java.security.policy", "MyApp.policy"); SecurityManager sm = new SecurityManager(); System.setSecurityManager(sm); // 安装安全管理器 System.out.println(sm); File file = Paths.get("D://a/123.txt").toFile(); try ( PrintWriter pw = new PrintWriter( new OutputStreamWriter( new FileOutputStream(file, true))); ){ pw.append("hello,world"); } } static int fun() { int m = 1; int n; m = 1; n = 2; // 在n=2,的字节码变成m=2; int r = m + n; return r; } }
[ "781386910@qq.com" ]
781386910@qq.com
78413e49964574f31ad4077dabbfd81297995b72
22f580c6ab811ce7d093a3668b4ff1b08dc72d04
/CucumberTest/src/test/java/CucumberTest/CucumberTest/Test1.java
5726a25995f4edc92732003c6b2367abf0df74ca
[]
no_license
snehasishdu/MyWork
34ed0558cd12c55b038f88df5ed373c7be9d6e13
5ffa5017146dae9fe9886a5979b12ff4c1bb968f
refs/heads/master
2021-01-19T15:55:43.072840
2018-01-16T04:56:57
2018-01-16T04:56:57
100,981,040
0
0
null
2018-01-18T05:27:11
2017-08-21T18:31:12
HTML
UTF-8
Java
false
false
294
java
package CucumberTest.CucumberTest; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; import org.testng.annotations.Test; public class Test1 { @Test public void method1() { System.out.println("Hello World !!"); } }
[ "snehasishdu@gmail.com" ]
snehasishdu@gmail.com
cf1d4049197759a12add8762486d70713f6d201e
cf0b2e2fcd3838e470cb4c205dda8cc05ac11628
/hotils-inject/src/main/java/org/hotilsframework/inject/annotation/Inject.java
af51933cb27f2a0a61061c4c8f7aa4574924e21f
[]
no_license
hireny/hotils
b216b2991c7f3ad6447dbcc8433a9a771e8be1e3
0b59a3853d5e636a4a499cca8e7799d540ece62b
refs/heads/master
2021-09-10T02:05:54.275527
2021-08-26T14:44:08
2021-08-26T14:44:08
225,169,822
0
0
null
2020-10-13T20:59:23
2019-12-01T13:54:30
Java
UTF-8
Java
false
false
423
java
package org.hotilsframework.inject.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Inject注解,相当于Spring的@Autowired * @author hireny * @className Inject * @create 2020-04-01 20:15 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Inject { }
[ "910502500@qq.com" ]
910502500@qq.com
59dab06b4eab5e6e19e5c3d3b26604b4ed06e7bc
65bddbf6c9ecacafdea1ae6699887dcb02946cf3
/RetailMeNotM/src/test/java/com/retailmenot/tests/VerifyNumberofItem_Test.java
0e2d3c591e9ced05da33317cbf6d9bc6773bca36
[]
no_license
singh234/TestSWPrj
895da7346ba9ec04cf192aa57c094b1eccb17130
51c08853f510047d3035c7108e890599e994b904
refs/heads/master
2021-01-17T15:06:51.214498
2016-09-22T04:23:56
2016-09-22T04:23:56
68,880,102
0
0
null
2016-09-22T04:43:09
2016-09-22T03:14:18
Java
UTF-8
Java
false
false
2,556
java
package com.retailmenot.tests; import java.io.IOException; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Parameters; import org.testng.annotations.Test; import com.retailmenot.pages.DealsPage; import com.retailmenot.pages.HomePage; import com.retailmenot.util.Utility; import jxl.read.biff.BiffException; public class VerifyNumberofItem_Test { WebDriver driver; HomePage homePage; DealsPage dealsPage; Logger logger; @Parameters({"url","browserType"}) @BeforeClass public void launchBrowser(String url,String browserType){ if(browserType.equals("FF")) { driver = new FirefoxDriver(); System.out.println("New Branch to practice Github"); } else if(browserType.equals("IE")){ System.setProperty("webdriver.ie.driver", "IEDriverServer.exe"); driver = new InternetExplorerDriver(); } else{ System.setProperty("webdriver.chrome.driver", "chromedriver.exe"); driver = new ChromeDriver(); } driver.get(url); logger=Logger.getLogger("VerifyNumberofItem_Test"); PropertyConfigurator.configure("Log4j.properties"); logger.info("Browser Launched Successfully"); } @DataProvider(name="DP") public String[][] feedDP() throws BiffException, IOException{ String data[][] = Utility.readExcel("VerifyDealsInput.xls", "sanity"); return data; } @Parameters({"pageTitle"}) @Test public void verifyDealPageTitle(String pageTitle){ homePage = new HomePage(driver); dealsPage = homePage.browsetoDealPage(); boolean actualTitle = dealsPage.verifydealsPage(pageTitle); Assert.assertTrue(actualTitle); logger.info("Verify Deals Page Title is Passed"); } //@Parameters({"productCategory","dealsCount"}) @Test(dependsOnMethods={"verifyDealPageTitle"},dataProvider="DP") public void verifyDealsCount(String productCategory,String dealsCount ){ int actualCount = dealsPage.verifyDealsCount(productCategory); logger.info("Actual count of the products"+actualCount); int expectedCount = Integer.parseInt(dealsCount); Assert.assertEquals(actualCount, expectedCount); } }
[ "singh.234@gmail.com" ]
singh.234@gmail.com
db163c4b1d8d381d73da7e1383e473fbeb2d24a4
8419df2ca4066a676d88f9760c6b4b5108729118
/CafeteriaBlackWhiteDecorator/src/main/java/br/edu/ifes/poo2/cafeteriablackwhitedecorator/cdp/CremeDeLaranja.java
351f987acb738f9dc61903f8cb379851cd465f91
[]
no_license
phoenixproject/poo2dp
0ef3c013c221babef7a335a70509098b5efd1dcc
cb96338f1e17355fd1ecc5c72558bf56d371d4f6
refs/heads/master
2021-01-10T06:18:08.518065
2015-11-24T17:37:50
2015-11-24T17:37:50
46,763,514
1
0
null
null
null
null
UTF-8
Java
false
false
513
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 br.edu.ifes.poo2.cafeteriablackwhitedecorator.cdp; /** * * @author 20101bsi0453 */ public class CremeDeLaranja extends AbstractComplemento { public CremeDeLaranja(Cafe cafe) { super(cafe); } @Override public Double getPreco(){ return cafeDecorado.getPreco() + 1.50; } }
[ "phoenixproject.erp@gmail.com" ]
phoenixproject.erp@gmail.com
8f1aaf38fc066277248cc2ada1c29529c1b545fc
4fe45f0a4dd70b9f32c7a080d13725f56722e045
/pelit/kuutiopeli/src/cubegame/multiplayer/ClientWritingThread.java
abd22d523555714624b4161d9747a6cdd195bedb
[]
no_license
fergusq/vanhat-ohjelmani
b1233f2672591b5c95314482f6562a3f11cef55f
2b990a0e2aa92528fa89a048f102732b23ad8466
refs/heads/master
2021-01-01T20:41:42.293896
2015-04-12T13:53:23
2015-04-12T13:53:23
33,550,141
0
0
null
null
null
null
UTF-8
Java
false
false
570
java
package cubegame.multiplayer; public class ClientWritingThread extends Thread { private NetClientHandler netHandler; public ClientWritingThread(NetClientHandler netClientHandler) { this.netHandler = netClientHandler; } @Override public void run() { synchronized (netHandler.threadSyncObject) { netHandler.writeThreads++; } try{ for(; netHandler.isRunning && !netHandler.isTerminating; netHandler.writePacket()) { } try { sleep(1L); }catch (InterruptedException ex){;} } finally{ netHandler.writeThreads--; } } }
[ "iikka@kaivos.org" ]
iikka@kaivos.org
1448bb5e9788cd985aba65d7ebf5974cff92704e
48fbe64d3170950ba60b73615b01b06dde09fb89
/src/main/java/com/yura/repair/command/admin/AdminAllReviewsCommand.java
7c2245ea55612c6bbbf0fb9381f85736dd4190e5
[]
no_license
Gtm417/guitar-repair-service-servlet
4e5ca1ad04db34fa3b08ef6f6384576aa227a855
da6a9a847ec88b2298017ece6f8254445a2cfb7b
refs/heads/master
2022-04-06T14:45:13.014624
2020-02-21T07:48:55
2020-02-21T07:48:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,270
java
package com.yura.repair.command.admin; import com.yura.repair.command.Command; import com.yura.repair.dto.ReviewDto; import com.yura.repair.service.ReviewService; import com.yura.repair.util.PaginationUtility; import javax.servlet.http.HttpServletRequest; import java.util.List; import static com.yura.repair.constant.PageConstant.ADMIN_REVIEWS_PAGE; public class AdminAllReviewsCommand implements Command { private static final String ADMIN_REVIEWS_COMMAND = "/admin/reviews"; private final ReviewService reviewService; private final PaginationUtility pagination; public AdminAllReviewsCommand(ReviewService reviewService, PaginationUtility pagination) { this.reviewService = reviewService; this.pagination = pagination; } @Override public String execute(HttpServletRequest request) { int currentPage = pagination.getCurrentPage(request); int recordsPerPage = pagination.getRecordsPerPage(request); List<ReviewDto> reviews = reviewService.findAll(pagination.getOffset(currentPage, recordsPerPage), recordsPerPage); pagination.paginate(currentPage, recordsPerPage, reviewService.numberOfEntries(), reviews, ADMIN_REVIEWS_COMMAND, request); return ADMIN_REVIEWS_PAGE; } }
[ "yuriy.petrashenko7@gmail.com" ]
yuriy.petrashenko7@gmail.com
7b684b35c0039c8c9795eaed8ea2383e4eb6d6a9
6a8a8984959b30cea3dbc5168f89fae68bda62cb
/PrintDuplicatesCollections.java
40d89ad9285ef8570bd2966f152587919978d0d7
[]
no_license
TestLeaf-Arun/week3.day2
aec5b5cc9e46a26ff58b0d1ae2cb0ffebbefe6dd
d0c3183c02bcf3b49f32aa1929927529f1fa78c1
refs/heads/main
2023-07-12T09:28:12.831790
2021-08-27T03:52:23
2021-08-27T03:52:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package week3.day2; import java.util.LinkedHashSet; import java.util.Set; public class PrintDuplicatesCollections { public static void main(String[] args) { int[] arr = {14,12,13,11,15,14,18,16,17,19,18,17,20}; Set<Integer> num = new LinkedHashSet<Integer>(); for (Integer eachData : arr) { if (!num.add(eachData)) { System.out.println(eachData); } } } }
[ "noreply@github.com" ]
noreply@github.com
ad24106b08d38b6c607866c3a2442a64ea46c483
8b736128fdb1dcb5a7b90250db12ae1c3e9e91bf
/shade-processor/src/test/java/io/t28/shade/test/ConverterClassMetadataAssert.java
532277001a4c0f8de34e552dc3687af883f25662
[ "Apache-2.0" ]
permissive
t28hub/shade
dd731a37048d7a8b084acc7e570d0c5aa7e038f0
baaf694fef85a51c1b77e36dc77b120f495dcc2c
refs/heads/master
2021-01-11T12:04:26.812152
2016-12-26T14:51:17
2016-12-26T14:51:17
69,031,608
32
6
null
2016-12-26T14:51:18
2016-09-23T14:18:53
Java
UTF-8
Java
false
false
2,611
java
/* * Copyright (c) 2016 Tatsuya Maki * * 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.t28.shade.test; import com.squareup.javapoet.TypeName; import org.assertj.core.api.AbstractAssert; import javax.annotation.Nonnull; import javax.annotation.Nullable; import io.t28.shade.processor.metadata.ConverterClassMetadata; import static org.assertj.core.api.Assertions.assertThat; public class ConverterClassMetadataAssert extends AbstractAssert<ConverterClassMetadataAssert, ConverterClassMetadata> { public ConverterClassMetadataAssert(@Nullable ConverterClassMetadata actual) { super(actual, ConverterClassMetadataAssert.class); } @Nonnull public ConverterClassMetadataAssert isDefault() { isNotNull(); final boolean actual = this.actual.isDefault(); assertThat(actual) .overridingErrorMessage("Expected converter to be default, but was non-default") .isTrue(); return this; } @Nonnull public ConverterClassMetadataAssert isNotDefault() { isNotNull(); final boolean actual = this.actual.isDefault(); assertThat(actual) .overridingErrorMessage("Expected converter to be non-default, but was default") .isFalse(); return this; } @Nonnull public ConverterClassMetadataAssert isSupportedType(@Nonnull TypeName expected) { isNotNull(); final TypeName actual = this.actual.getSupportedType(); assertThat(actual) .overridingErrorMessage("Expected supportedType to be <%s>, but was <%s>", expected, actual) .isEqualTo(expected); return this; } @Nonnull public ConverterClassMetadataAssert isConvertedType(@Nonnull TypeName expected) { isNotNull(); final TypeName actual = this.actual.getConvertedType(); assertThat(actual) .overridingErrorMessage("Expected convertedType to be <%s>, but was <%s>", expected, actual) .isEqualTo(expected); return this; } }
[ "noreply@github.com" ]
noreply@github.com
8c59a204d3eea3fa3170be868ec47916a38899ab
16850d0bfd3b9ec27a4127d50c4aec8da840f583
/app/src/main/java/com/newland/homecontrol/activity/StudyActivity.java
f8ff029add446386e457d2f74f5fd0cef54c4d0e
[]
no_license
Steven-Lion/HOMEControl2_init
cbccaac319974e7c27b3e7487bf2759ee0c0b554
ca40bd991ce8feffcb40d2f15efe75760723a4d5
refs/heads/master
2020-03-16T22:47:27.203109
2018-05-12T10:28:42
2018-05-12T10:28:42
133,052,589
0
0
null
null
null
null
UTF-8
Java
false
false
5,083
java
package com.newland.homecontrol.activity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.newland.homecontrol.bean.Global; import com.newland.homecontrol.R; import com.newland.homecontrol.utils.SharedPreferencesUtils; import com.nlecloud.nlecloudlibrary.api.ApiResponse; import com.nlecloud.nlecloudlibrary.core.ActionCallbackListener; import com.nlecloud.nlecloudlibrary.core.AppAction; import com.nlecloud.nlecloudlibrary.core.AppActionImpl; /** * 书房 */ public class StudyActivity extends Activity { private TextView tvTitle; private LinearLayout llbottomBackGround;//下部分背景 需要设置透明度 private RelativeLayout rlBackGround;//背景图片 private ImageView ivCurtain; private CheckBox cbStudy; private AppAction mAppAction; private SharedPreferencesUtils spUtils; private boolean isSave=false;//是否要保存灯的状态到SP中 @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_study); //初始化视图 initView(); //初始化监听 initCheckListenser(); } private void initView() { tvTitle = (TextView) findViewById(R.id.tvTitle); llbottomBackGround = (LinearLayout) findViewById(R.id.llbottomBackGround); rlBackGround = (RelativeLayout) findViewById(R.id.rlBackGround); cbStudy = (CheckBox) findViewById(R.id.cbStudy); llbottomBackGround.getBackground().setAlpha(220); tvTitle.setText("书房灯控"); mAppAction = new AppActionImpl(this); // 设置服务器地址 spUtils = SharedPreferencesUtils.getInstant(this); cbStudy.setChecked(spUtils.getStudy());//设置灯控开关初始状态 setLightBackground(spUtils.getStudy(),false);//设置书房灯的初始状态 if (spUtils.getISAutomatic()) {//是自动模式 隐藏下方按钮 llbottomBackGround.setVisibility(View.INVISIBLE); } else { llbottomBackGround.setVisibility(View.VISIBLE); } } /** * 开关灯状态监听 */ private void initCheckListenser() { //窗帘开关监听 cbStudy.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { if (spUtils.getIsSimulation()) { //如果是模拟,开关灯直接切换图片 setLightBackground(isChecked,true); } else { //如果不是模拟,去获取云平台上灯的开关状态 operateLight(isChecked); } } }); } /** * 模拟的时候设置灯的灯的状态(直接切换图片) */ private void setLightBackground(boolean check,boolean isSave) { if(isSave){ //存储当前卧室灯的开关状态 spUtils.setStudy(cbStudy.isChecked()); } if (check) { rlBackGround.setBackgroundResource(R.mipmap.pic_study); } else { rlBackGround.setBackgroundResource(R.mipmap.pic_study_close); } } /** * 通知设备开关 * * @param isChecked */ private void operateLight(final boolean isChecked) { mAppAction.onOff(Global.LIGHT_STUDY, isChecked, new ActionCallbackListener<ApiResponse<String>>() { @Override public void onSuccess(ApiResponse<String> data) { setLightBackground(isChecked,true);//进行开关灯图片替换 } @Override public void onFailure(String errorEven, String message) { Toast.makeText(StudyActivity.this, message, Toast.LENGTH_SHORT).show(); } }); } @Override protected void onDestroy() { //卧室界面activity结束时 发送广播 进行通知各卧室界面现在是处于哪个状态 Intent intent = new Intent("com.nangch.broadcasereceiver.MYRECEIVER"); intent.putExtra("check", "check"); //向广播接收器传递数据 sendBroadcast(intent);//发送check消息 通知灯光控制界面 改变灯光展示图片 super.onDestroy(); } /** * 点击事件 * @param view */ public void MyClick(View view) { switch (view.getId()) { case R.id.ivBack://返回 finish(); break; } } }
[ "823961237@qq.com" ]
823961237@qq.com
31d5e5ed1fceb42500a18c4f203c30efe6eb2178
39ef3a7cc8c37214ea5167822365ec8daec0e702
/projecteuler/12-highly-divisible-triangular-number/Solution.java
2b883d5ac3d787b1efbf527bdb2e79b605f5c18a
[]
no_license
neppramod/problems_practice
75449062037282d65896d296f0e1832482869832
764d2e4470d87c66cd1223387b49d3df610bb2a1
refs/heads/master
2022-08-18T19:54:16.370710
2022-08-16T02:54:45
2022-08-16T02:54:45
59,494,037
2
0
null
2021-01-03T18:07:56
2016-05-23T15:26:56
Java
UTF-8
Java
false
false
1,825
java
import java.util.*; // Use arithmetic series summation public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = triangleNumberWithOverFiveHundredDivisors(); System.out.println(num); //System.out.println(divisors(28)); /* Lot of calculation 2162160 - 320 10767120 - 320 13857480 - 320 17907120 - 480 20991960 - 320 22582560 - 384 27561600 - 384 29610360 - 320 30728880 - 360 31240560 - 320 34283340 - 324 37191000 - 384 39209940 - 384 43809480 - 384 45158256 - 320 48024900 - 405 48565440 - 448 53411280 - 320 54752880 - 320 59192640 - 448 60769800 - 432 60935280 - 320 64292130 - 320 64701000 - 384 65431080 - 384 69390090 - 384 73150560 - 384 73926720 - 336 75897360 - 360 76576500 - 576 576 12375 */ } static int triangleNumberWithOverFiveHundredDivisors() { for (int i = 1; i <= 50000; i++) { int cur = i * (i + 1) / 2; int divisors = divisors(cur); if (divisors > 300) { System.out.println(cur + " - " + divisors); } if (divisors > 500) { System.out.println(divisors); return i; } } return 0; } static int divisors(int number) { int count = 0; for (int i = 1; i <= number; i++) { if (number % i == 0) { count++; } } return count; } }
[ "neppramod@gmail.com" ]
neppramod@gmail.com
ee965043a54a60580720db94317319c497fdd022
46203451280bd1477e5c033da5790a503efcead7
/src/main/java/subtask/SubTask.java
d4339cdad79046d7475ec7fe6941c5074e7d702b
[]
no_license
prakharrke/dailytasks_backend
0f68eda7dd63c8474b0b1e0c55d0392d1684ab7e
dca2b0ad3dd99f32e4eefeb84b8fc15fbea8d120
refs/heads/master
2022-06-23T16:46:20.893594
2019-06-13T05:26:41
2019-06-13T05:26:41
191,695,820
0
0
null
2022-05-20T21:00:34
2019-06-13T05:23:14
Java
UTF-8
Java
false
false
1,443
java
package subtask; import java.sql.SQLException; import model.DBCommunication; public class SubTask { String taskID; String subTaskID; String description; String timeSheet; char special; char approved = 'n'; char reviewed = 'n'; public String getTaskID() { return taskID; } public SubTask setTaskID(String taskID) { this.taskID = taskID; return this; } public String getSubTaskID() { return subTaskID; } public SubTask setSubTaskID(String subTaskID) { this.subTaskID = subTaskID; return this; } public String getDescription() { return description; } public SubTask setDescription(String description) { this.description = description; return this; } public String getTimeSheet() { return timeSheet; } public SubTask setTimeSheet(String timeSheet) { this.timeSheet = timeSheet; return this; } public char getSpecial() { return special; } public SubTask setSpecial(char special) { this.special = special; return this; } public char getApproved() { return approved; } public SubTask setApproved(char approved) { this.approved = approved; return this; } public char getReviewed() { return reviewed; } public SubTask setReviewed(char reviewed) { this.reviewed = reviewed; return this; } public void insertSubTask() throws ClassNotFoundException, SQLException { DBCommunication dbCommunication = new DBCommunication(); dbCommunication.insertSubTask(this); } }
[ "Prakhar.Dixit@1eq.com" ]
Prakhar.Dixit@1eq.com
1e8ce981c024a11988ee6e89ec2221b77322316a
4e41d8251e19228e8758f80448a0219988fd0c50
/src/TestaArraysObjetos.java
ca884d649b81c25239aaad363f994a19af5144b6
[]
no_license
JAlvesBruno/OrientacaoObjetos
bfeda220c697c7bceae6290ffa4efebce3ec88af
18cd6a15122e55d31c9abc82b4537cb915cf71f7
refs/heads/master
2020-03-25T22:17:12.512324
2018-08-09T23:40:26
2018-08-09T23:40:26
144,214,334
0
0
null
null
null
null
UTF-8
Java
false
false
789
java
public class TestaArraysObjetos { public static void main(String[] args) { Carro[] carros = new Carro[5]; Carro carro1 = new Carro("verde","HB20",120); // carro1.setCor("verde"); // carro1.setModelo("HB20"); // carro1.setVelocidadeMaxima(120); Carro carro2 = new Carro("branco", "BMW", 320); // carro2.setCor("branco"); // carro2.setModelo("BMW"); // carro2.setVelocidadeMaxima(320); carros[0] = carro1; carros[1] = carro2; carros[0].setCor("Preto"); System.out.println("Carro1: " + carros[0].getCor()); System.out.println("Carro2: " + carros[1].getCor()); for(Carro carro: carros) { System.out.println("Carro: " + carro.getModelo()); } } }
[ "bruno.ja@puccampinas.edu.br" ]
bruno.ja@puccampinas.edu.br
ca6821a1c7fc67e8d841cd4358f3f5c444842273
e048cb9cd0a7d49bb284dcc3d9a0871713127c48
/leasing-company-parent/leasing-company-service/src/main/java/com/cloudkeeper/leasing/company/repository/AttendanceRepository.java
cb28675eb899e0de952e14535c5686ddb46a327a
[]
no_license
lzj1995822/GuSuCommunityApi
65b97a0c9f8bdeb608f887970f4d2e99d2306785
51348b26b9b0c0017dca807847695b3740aaf2e8
refs/heads/master
2020-04-23T19:18:18.348991
2019-04-28T02:56:21
2019-04-28T02:56:21
171,398,689
1
0
null
null
null
null
UTF-8
Java
false
false
253
java
package com.cloudkeeper.leasing.company.repository; import com.cloudkeeper.leasing.base.repository.BaseRepository; import com.cloudkeeper.leasing.company.domain.Attendance; public interface AttendanceRepository extends BaseRepository<Attendance> { }
[ "243485908@qq.com" ]
243485908@qq.com
0d49e82fdb2b201f81a3869d172e4dec7d87a598
7a3c0a90c4f8039837de7c07c687150b5b8bc647
/src/main/java/com/ldh/permission/core/service/impl/AdminResourceServiceImpl.java
98ae321a527aafc88993ac8e7478e02a14e18474
[]
no_license
coder-ldh/permission
b3c84a9c1834ccf6a00d75ce3ac9b937ffd7397d
426a7ecbf90860a8d350c196c41a5be7898bd96b
refs/heads/master
2020-04-11T15:31:42.531787
2019-01-04T01:49:59
2019-01-04T01:49:59
161,894,332
0
0
null
null
null
null
UTF-8
Java
false
false
563
java
package com.ldh.permission.core.service.impl; import com.ldh.permission.core.model.AdminResource; import com.ldh.permission.core.mapper.AdminResourceMapper; import com.ldh.permission.core.service.AdminResourceService; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** * <p> * 用户资源表 服务实现类 * </p> * * @author ldh * @since 2018-12-17 */ @Service public class AdminResourceServiceImpl extends ServiceImpl<AdminResourceMapper, AdminResource> implements AdminResourceService { }
[ "ldh@awallet.com" ]
ldh@awallet.com
7a9239e845c90489ff7daa80d0475b60fd380fd8
fea07f0dd2555f7b51e3cdd15e96812820499aea
/hedera-node/src/test/java/com/hedera/test/factories/accounts/MockFCMapFactory.java
0998e9636a9ef4f0c616de1580894e99c0911b27
[ "Apache-2.0" ]
permissive
Vinci-zZ/hedera-services
e663c3dc1aae8742d92b0031727861c5fb323c97
afa3afb5041a908a783fc0b91c61facc532a7463
refs/heads/master
2023-02-28T03:44:11.524812
2021-02-06T06:26:00
2021-02-06T06:26:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,295
java
package com.hedera.test.factories.accounts; /*- * ‌ * Hedera Services Node * ​ * Copyright (C) 2018 - 2020 Hedera Hashgraph, LLC * ​ * 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. * ‍ */ import com.hedera.services.state.merkle.MerkleEntityId; import com.hedera.services.state.merkle.MerkleAccount; import com.swirlds.fcmap.FCMap; import static com.hedera.test.utils.IdUtils.asContract; import static org.mockito.BDDMockito.*; import static com.hedera.test.utils.IdUtils.asAccount; import static com.hedera.test.factories.accounts.MerkleAccountFactory.newAccount; import static com.hedera.test.factories.txns.SignedTxnFactory.*; public class MockFCMapFactory { public static final long NODE_BALANCE = 1_000_000_000L; public static final long GENESIS_BALANCE = 50_000_000_000_000L; private final FCMap mock = mock(FCMap.class); private MockFCMapFactory() {} public static MockFCMapFactory newAccounts() { return new MockFCMapFactory(); } public static MockFCMapFactory newAccountsWithDefaults() throws Exception { return newAccounts() .withAccount(DEFAULT_NODE_ID, newAccount().balance(NODE_BALANCE).get()) .withAccount(DEFAULT_PAYER_ID, newAccount().balance(GENESIS_BALANCE).accountKeys(DEFAULT_PAYER_KT).get()); } public MockFCMapFactory withAccount(String id, MerkleAccount meta) { MerkleEntityId account = MerkleEntityId.fromAccountId(asAccount(id)); given(mock.get(account)).willReturn(meta); return this; } public MockFCMapFactory withContract(String id, MerkleAccount meta) { MerkleEntityId contract = MerkleEntityId.fromContractId(asContract(id)); given(mock.get(contract)).willReturn(meta); return this; } public FCMap<MerkleEntityId, MerkleAccount> get() { return (FCMap<MerkleEntityId, MerkleAccount>)mock; } }
[ "michael.tinker@hedera.com" ]
michael.tinker@hedera.com
f2c69ea255914348c257f3fc464f2c7a4a7c9629
cc637e2f7ad19ceb7e23390c4fb2a04e2141aa5d
/acore/src/main/java/com/yl/core/utils/ImageManager.java
83ba51dd8933e97bfd9853ee76004e47f9ab32cb
[]
no_license
Redoteam/MVPEasyArms
a246890fc7e33d3868283c491e091029e1e8d723
89026d295ae1d486bf81800a43e79b185f6d87b6
refs/heads/master
2020-04-09T22:17:17.066717
2018-12-07T03:57:20
2018-12-07T03:57:20
160,624,426
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package com.yl.core.utils; import android.content.Context; import android.widget.ImageView; import com.yl.core.R; import com.yl.core.delegate.AppDelegate; import com.yl.core.factory.SingletonImageLoader; import com.yl.core.http.imageloader.ImageConfig; import com.yl.core.http.imageloader.ImageLoader; /** * Created by 寻水的鱼 on 2018/8/13. */ public class ImageManager { /** * 加载图片 * * @param context * @param config * @param <T> */ public static <T extends ImageConfig> void loadImage(Context context, T config) { ImageLoader imageLoader = SingletonImageLoader.getInstance().getImageLoader(); imageLoader.loadImage(context, config); } /** * 停止加载或清理缓存 * * @param context * @param config * @param <T> */ public static <T extends ImageConfig> void clear(Context context, T config) { ImageLoader imageLoader = SingletonImageLoader.getInstance().getImageLoader(); imageLoader.clear(context, config); } }
[ "18672989951@163.com" ]
18672989951@163.com
324062de7589452802949cfe56cab85bbc7b8301
11431aa193e9026d84bcd0b5e8af1ce817f8dc0c
/PizzaProj/src/main/java/db2/juhh/PizzaProj/model/PizzaDetalhe.java
411ccfdb48e98bf6ad265c85b642b74b4b373414
[]
no_license
leoljunior/db2
4f23894980fa160d4682875dd00abd47b6e3071d
6dba5e0b00afa125f6e427c0e882876822f3adef
refs/heads/master
2023-06-05T09:16:10.701716
2021-06-28T15:00:10
2021-06-28T15:00:10
380,547,894
0
0
null
null
null
null
UTF-8
Java
false
false
1,091
java
package db2.juhh.PizzaProj.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity @Table(name = "pizzadetalhe") public class PizzaDetalhe implements Serializable { @Temporal(TemporalType.DATE) private Date data; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int numPedido; private int quantidade; private float preco; public Date getData() { return data; } public void setData(Date data) { this.data = data; } public int getNumPedido() { return numPedido; } public void setNumPedido(int numPedido) { this.numPedido = numPedido; } public int getQuantidade() { return quantidade; } public void setQuantidade(int quantidade) { this.quantidade = quantidade; } public float getPreco() { return preco; } public void setPreco(float preco) { this.preco = preco; } }
[ "juhhinx@gmail.com" ]
juhhinx@gmail.com
4c6010e91efed5e8e8bdafb057126f0716157561
9fed869617e20d51db1f18b76530c8113d79740f
/src/main/java/com/revature/services/EmployeeService.java
9ef6e03b086ec47b77dbf5c355f8aad3d6423bca
[]
no_license
210614-JavaFS/project0-btoledo2
4668f48552e4d288a5ff27782ffc25530a9abcb2
220dfeed5f3dcdcb3d855edc0a51810041a4b16f
refs/heads/master
2023-06-16T13:32:37.305900
2021-07-14T05:34:21
2021-07-14T05:34:21
381,057,827
0
0
null
2021-07-14T05:30:47
2021-06-28T14:21:23
Java
UTF-8
Java
false
false
1,138
java
package com.revature.services; import java.util.List; import com.revature.models.Employee; import com.revature.repos.EmployeeDAO; import com.revature.repos.EmployeeImpl; public class EmployeeService { private static EmployeeDAO employeeDao = new EmployeeImpl(); public List<Employee> getAllEmployees(){ return employeeDao.findAll(); } public Employee getEmployee(int id) { return employeeDao.findEmployee(id); } public boolean showAccountBalance() { return employeeDao.showAccountBalance(); } public boolean showPersonalInfo() { return employeeDao.showPersonalInfo(); } public boolean customerAccountStatus() { return employeeDao.showAccountInfo(); } public boolean approveSaving(int id) { return employeeDao.approveSavingAccount(id); } public boolean approveChecking(int id) { return employeeDao.approveCheckingAccount(id); } public boolean denySaving(int id) { return employeeDao.denySavingAccount(id); } public boolean denyChecking(int id) { return employeeDao.denyCheckingAccount(id); } public boolean delete(int id){ return employeeDao.removeUSer(id); } }
[ "billytoledo1234@gmail.com" ]
billytoledo1234@gmail.com
013e61a23a29857a3d5eaf021a17c131044aa0b6
6757aa38d6eafd1707376e0afa4de6ab86d9e9af
/app/src/main/java/com/andrewnwalker/mousetimes_california/CountUpTimer.java
274f497a40df19b7270bedb4b9a9cd6236ea0163
[]
no_license
Andrew-Walker/Mouse-Times-California---Android
2b557d72e4110c2d1f8804fccdab018efb45ee21
9e0c03b4161dd12911150bef91c1a40f139daa1d
refs/heads/master
2020-09-20T19:46:28.717803
2016-04-03T01:01:00
2016-04-03T01:01:00
65,948,453
0
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
package com.andrewnwalker.mousetimes_california; import android.os.Handler; import android.os.Message; import android.os.SystemClock; /** * Created by Andrew Walker on 13/02/2016. */ public abstract class CountUpTimer { abstract public void onTick(long elapsedTime); private static final int MSG = 1; private final long interval; private long base; public CountUpTimer(long interval) { this.interval = interval; } public void start() { base = SystemClock.elapsedRealtime(); handler.sendMessage(handler.obtainMessage(MSG)); } public void stop() { handler.removeMessages(MSG); } private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { synchronized (CountUpTimer.this) { long elapsedTime = SystemClock.elapsedRealtime() - base; onTick(elapsedTime); sendMessageDelayed(obtainMessage(MSG), interval); } } }; }
[ "andreww500@live.com" ]
andreww500@live.com
36b39bf7999dfcbb14c5e1d86dd6879b6b6844e0
63fbb8a46bd293e153d22b1f37acd0ac9b3c3491
/Samples/app/src/main/java/samples/linhtruong/com/app/memoryleak/LeakCase2.java
7e2effb30a9857d5192adc839600f61ff6848945
[]
no_license
trithucbkpro/Samples
2800e71ef29088aa486ca046f22e16b42700ad72
89af0f28504a192cdacdca578fcda9f221227e69
refs/heads/master
2021-01-19T22:41:30.950666
2019-09-19T14:54:23
2019-09-19T14:54:23
88,845,710
0
0
null
2017-04-20T09:21:23
2017-04-20T09:21:23
null
UTF-8
Java
false
false
1,771
java
package samples.linhtruong.com.app.memoryleak; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import samples.linhtruong.com.app.R; import samples.linhtruong.com.base.BaseActivity; /** * Anonymous inner classes: i.e callback * * @author linhtruong * @date 2/20/17 - 14:28. * @organization VED */ public class LeakCase2 extends BaseActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); doTaskLeak(); doTask(); } /** * This is memory leak. * Since {@link LSingleton} is singleton, it will in the memory for the lifetime of the application. * The {@link LCallback} object is passed to this singleton and stored in mCallbackQueue variable. * So there is a reference to {@link LCallback} object from a static object in memory. * So the parent class of {@link LCallback} object wont be cleared if needed. */ private void doTaskLeak() { LSingleton.getInstance().doTask(new LCallback() { @Override public void onStart() { } @Override public void onCompleted() { } }); } /** * Avoid passing anonymous inner class object to static/singleton classes * which keep strong reference to it. * The solution is make it {@link java.lang.ref.WeakReference} */ private void doTask() { LSingleton.getInstance().doTask(new LCallback() { @Override public void onStart() { } @Override public void onCompleted() { } }); } }
[ "Linh@Truong.local" ]
Linh@Truong.local
1a9d91bf9e9c840f4aeb8c91507d0ba4dc4b0646
539b6808826b0af0e3ae0d3828961bc4cb7605ba
/Link_prediction/src/utils/interest.java
425172119914bd0ea997ab20debac487cb990d8e
[]
no_license
souravrevo/Link_prediction
3e436026f1a52c19a15d11cc7266f033b567d2b8
552b25b2bd89756cded3bec82cde749093ce07a0
refs/heads/master
2016-09-06T11:19:26.912941
2014-05-21T01:55:40
2014-05-21T01:55:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,809
java
package utils; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.sql.PreparedStatement; //Calculate interest_count column of auth_all_info table public class interest { public static void main(String []args){ String name = ""; String interest = ""; String interest_db = ""; String auth_id = ""; try{ //open connection and get matrix dimenxions String url = "jdbc:mysql://localhost/crawler"; Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = DriverManager.getConnection(url, "root", "root"); Statement stmt = con.createStatement(); Statement stmt1 = con.createStatement(); ResultSet rs = stmt .executeQuery("select * from auth_all_info"); ResultSet rs1 = null; PreparedStatement stmtp = null; while (rs.next()){ name = rs.getString(1); auth_id = rs.getString(2); interest = rs.getString(3).toLowerCase(); interest_db = " "+interest+" "; interest_db = interest_db.replace(" ", "%"); rs1 = stmt1 .executeQuery("select count(*) from paper_all_info where auth_id=\'"+auth_id+"\' and paper like \'"+interest_db+"\'"); while (rs1.next()){ stmtp = con.prepareStatement("UPDATE auth_all_info SET interest_count=? WHERE auth_id=\'"+auth_id+"\' and auth_interest=\'"+interest+"\'"); stmtp.setString(1,rs1.getString(1)); System.out.println(rs1.getString(1)); int ii = stmtp.executeUpdate(); } } rs.close(); rs1.close(); stmtp.close(); stmt.close(); stmt1.close(); con.close(); }catch (Exception e) { System.out.println("Exception caught"+e); } } }
[ "sourav.revo@gmail.com" ]
sourav.revo@gmail.com
0ec1e1c1e842346ecd7ce3e8d0510f00c876d0c9
39f6016314a0dd0a4f765030e0111c8dc56a6087
/xiaoming-security-core/src/main/java/com/xiaoming/core/validate/code/ValidateCodeException.java
73c68cb5c0bf2d9de2c22eea23eef7ef6bcbd477
[]
no_license
TPxiaoming/spring-security
088aee722cef04ef441318ff6acc4abe494f01a7
84b0b7bb3d93fc03edcd7b7959376b9407a2b368
refs/heads/master
2020-05-09T14:10:26.609236
2019-06-13T09:31:01
2019-06-13T09:31:01
181,182,789
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package com.xiaoming.core.validate.code; import org.springframework.security.core.AuthenticationException; /** * 验证码异常 * AuthenticationException 抽象异常, 身份认证异常的基类 * @Author: xiaoming * @Date: 16:02 2019/5/27 */ public class ValidateCodeException extends AuthenticationException { private static final long serialVersionUID = 1850122820931656032L; public ValidateCodeException(String msg) { super(msg); } }
[ "3093403587@qq.com" ]
3093403587@qq.com
b435b82fb43c05a4691fccb9c0f49035540bf905
69ac3fb006e10da40d17eaef5564080b20458267
/Mtravelplan_final/src/com/travel/plan/tripboard/vote/dao/TripVoteService.java
2d55cb60c9b351d9babbcc5fe8a299e73c576403
[]
no_license
skathal124/travel_helper
e46f42b7b3af192b8d1968a022e1fcc2e9c4fd6a
afb00141bb02a0588c2e849a77832311d3318087
refs/heads/master
2020-03-31T19:53:42.219577
2018-10-11T04:40:58
2018-10-11T04:40:58
152,516,730
0
0
null
2018-10-11T04:40:59
2018-10-11T02:08:25
JavaScript
UTF-8
Java
false
false
670
java
package com.travel.plan.tripboard.vote.dao; import java.util.List; import com.travel.plan.tripboard.help.PollBean; import com.travel.plan.tripboard.model.TripPoll; import com.travel.plan.tripboard.model.TripPollSub; import com.travel.plan.tripboard.model.TripVoter; public interface TripVoteService { void makePoll(PollBean pbean); List<TripPoll> getPollAllList(TripPoll poll); TripPoll getPoll(TripPoll poll); List<TripPollSub> getPollSubList(TripPoll poll); void polling(TripVoter voter); List<TripPoll> getMyPollList(TripPoll poll); void deleteTrip_Voter(int tpseq); void deleteTrip_PollSub(int tpseq); void deleteTrip_Poll(int tpseq); }
[ "skathal124@naver.com" ]
skathal124@naver.com
ed2f8c4c8a983461208e173f2ca13673bb151d26
692e68c46eeb49c63523bb5198cb66386a5e5b4d
/app/src/main/java/com/example/primetech/contactproviderwithcursoradapter/MainActivity.java
329cff9ed5d9ff06c4443da06e78d81e1057aa9f
[]
no_license
fardin95/ContactProviderWithCursorAdapter
b07eb123f2275dcf35e037d91503192c20c8e2d7
8afabbae586e04f36f09bb3871857bf533e36ca0
refs/heads/master
2021-01-19T00:58:13.198752
2016-07-19T11:23:55
2016-07-19T11:23:55
63,677,384
0
0
null
null
null
null
UTF-8
Java
false
false
1,911
java
package com.example.primetech.contactproviderwithcursoradapter; import android.content.ContentResolver; import android.database.Cursor; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.ListView; public class MainActivity extends AppCompatActivity { private android.widget.ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.listView = (ListView) findViewById(R.id.listView); ContentResolver contentResolver = getContentResolver(); // Contact data String columsToExtract[] = new String[]{ ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.PHOTO_THUMBNAIL_URI }; String whereClause = "((" + ContactsContract.Contacts.DISPLAY_NAME + " NOTNULL) AND (" + ContactsContract.Contacts.DISPLAY_NAME + " != '' ) AND (" + ContactsContract.Contacts.STARRED + "== 1))"; // sort by incresing id String sortOrder = ContactsContract.Contacts._ID + " ASC"; // query contats contentProvider Cursor cursor = contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); if (cursor!=null){ int i = 0; cursor.moveToFirst(); for ( i=0; i<cursor.getCount(); i++){ String string = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); Log.e("nAME", string); cursor.moveToNext(); } } ContactInfoListAdapter contactInfoListAdapter = new ContactInfoListAdapter(this, R.layout.list_item, cursor, 1); listView.setAdapter(contactInfoListAdapter); } }
[ "out.sider.otto@gmail.com" ]
out.sider.otto@gmail.com
efac8b145513f277244c81c6cd8c5a56a017fc9c
eac648c76b9e7d9fcb6f8fb7d6717374c9914047
/Core/src/CoreClass.java
a28714d9d2d7eec210c922a7625596a979f93881
[]
no_license
KagamiMi/TPDiA2
fbddf3149e551a86814def9c3f9032cd178e611a
5ec5f681eb2eb1a092c4d93a0c313fd972d040c8
refs/heads/master
2020-03-21T21:34:05.819912
2018-07-22T18:00:44
2018-07-22T18:00:44
139,070,672
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
2,292
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.Date; public class CoreClass { static int portNumber = 7; public static void main(String args[]) throws ClassNotFoundException { try { ServerSocket ss = new ServerSocket(portNumber,10); System.out.println("created socket server "); while (true) { Socket cs = ss.accept(); System.out.println("Connected to new client"); ObjectInputStream is = new ObjectInputStream(cs.getInputStream()); new SocketHandler(is).start(); System.out.println("New thread running!"); } // za pomocą JPQL // mamy interwał czasowy t // tank measures zawiera "prawidłowe wartości" // obliczamy wartość końcową po interwale i porównujemy z wartością końcową z tank measures // dla każdego z tanków osobno! // // dla danego tanka w danej chwili czasu startowej, to samo będzie dla końcowego tylko z inną datą // double startFuelVolume = em.createQuery("SELECT t.fuelVolume from TankMeasures t WHERE t.tankId=:tankId AND t.date=:date").setParameter("tankId",tankId).setParameter("date",date).getSingleResult(); // // musimy uzwględnić sprzedaż (sales) w tym okresie czasu. // status - 1 odłożony, 0 podniesiony // literCounter - bieżący licznik transkacji (status 0) // totalCounter - końcowy licznik transakcji (status 1) // podczas 0 musimy zwracać uwagę na poprzedni stan aby odjąć dobrą wartość: literCounter - poprzedni_literCounter z pomiaru (może być ze statusu 1 gdy to pierwszy raz w serii), // podczas 1 jesli mamy totalCounter to odejmujemy ostatni literCounter ze statusem 0 // dopiero tą wartość możemy odjąć od wartości startowej // // przy dostawach paliwa podobny problem - po pierwsze w jakiej jednostce jest szybkośc tankowania?! // musimy sami na podstawie szybkości obliczyć czy paliwo zostało już wpompowane i ile i czy jest jeszcze co pompować } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "kagamimiyuki@gmail.com" ]
kagamimiyuki@gmail.com
94c9dd33ace703c06c56040af4b42c65b860f1a7
e306ba2d2ff8ca1945291f011bef28deba026b80
/zhouchao/Exercise0425/src/cn/hfxt/entity/ZC.java
277712e09e86fa1920b4a1738c5e04cd54aef77e
[]
no_license
SunYongLi12/SunYL
e7a80d0e79c1d57d7a36ae54b90ae9b79faaba7f
634e88975c3d03d084a5d7b2a8c31238fcf563f5
refs/heads/master
2023-04-14T11:39:19.355638
2021-04-28T04:35:03
2021-04-28T04:35:03
362,008,601
0
0
null
null
null
null
UTF-8
Java
false
false
278
java
package cn.hfxt.entity; public class ZC { private int id; private String rank; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getRank() { return rank; } public void setRank(String rank) { this.rank = rank; } }
[ "goodMorning_pro@at.bdqn.com" ]
goodMorning_pro@at.bdqn.com
22d0151b123306f5e60fd181b940e806211b16f5
857a460a6c8335e099a83d2e7b671618a71b0464
/src/main/java/com/lb/game/controller/DigitalGamePlayController.java
89b1aa9c97ca68a46818803eba96b11f01274540
[]
no_license
zxcv1122BB/lb_n
bce2e7c456f4628d615b707f4931bc12c5feff52
9a0a3eb156bb94d66c9176de1e5d506fabecc50e
refs/heads/master
2022-07-10T01:18:47.642054
2019-08-26T14:55:01
2019-08-26T14:55:01
203,388,208
1
1
null
2022-06-29T17:35:23
2019-08-20T14:01:58
JavaScript
UTF-8
Java
false
false
4,821
java
package com.lb.game.controller; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import com.lb.game.service.impl.GameTypeServiceImpl; import com.lb.sys.dao.DigitalGamePlayMapper; import com.lb.sys.tools.BaseController; import com.lb.sys.tools.PageUtils; import com.lb.sys.tools.ResponseUtils; import com.lb.sys.tools.StringUtil; @Controller @RestController @RequestMapping("/game") public class DigitalGamePlayController { @Autowired DigitalGamePlayMapper digital; @Autowired GameTypeServiceImpl gameType; @RequestMapping(method = RequestMethod.POST, value = "/getGameInfo") public ModelAndView getGameInfo(HttpServletRequest request) { // 获取参数 Map<String, Object> map = BaseController.jsonToMap(request); Integer id = map.containsKey("id")?Integer.valueOf(map.get("id").toString()) : null; Integer act_id = map.containsKey("act_id")?Integer.valueOf(map.get("act_id").toString()) : null; try { if(map.get("openno")!=null&&!"".equals(map.get("openno"))) { map.put("openno", map.get("openno").toString().trim().replace("-", "")); } // 调用查询方法 List<Map<String, Object>> all = new ArrayList<>(); if(!StringUtil.isBlank(map.get("pageIndex")) && !StringUtil.isBlank(map.get("pageNum")) && !StringUtil.isBlank(map.get("pageSize"))) { // 当前页 Integer pageIndex = Integer.valueOf(map.get("pageIndex").toString()) ; // 每一页数据条数 Integer pageNum = Integer.valueOf(map.get("pageNum").toString()); if (act_id==1) { all = digital.qryGameType(); }else if (act_id==2) { all = digital.qryGameGroup(id); } else if (act_id==3) { all = digital.qryGamePlayed(id); } PageUtils<Map<String, Object>> pageInfo = new PageUtils<>(pageIndex,pageNum,all); return ResponseUtils.jsonView(200, "获取数据成功",pageInfo); }else { if (act_id==1) { all = digital.qryGameType(); }else if (act_id==2) { all = digital.qryGameGroup(id); } else if (act_id==3) { all = digital.qryGamePlayed(id); } return ResponseUtils.jsonView(200, "获取数据成功",all); } } catch (Exception e) { e.printStackTrace(); return ResponseUtils.jsonView(201, "访问出现错误,请稍后再试",null) ; } } @RequestMapping(method = RequestMethod.POST, value = "/updateGameInfo") public ModelAndView updateGameInfo(HttpServletRequest request) { Map<String, Object> paramMap = BaseController.jsonToMap(request);//this.jsonToMap(request); int act_id = Integer.valueOf(paramMap.get("act_id").toString()); int id = Integer.valueOf(paramMap.get("id").toString()); if(paramMap.containsKey("status")) { paramMap.put("status",String.valueOf(paramMap.get("status").toString())); } //System.err.println("[参数]:"+paramMap.entrySet()); //Integer id = paramMap.containsKey("id")?Integer.valueOf(paramMap.get("id").toString()):null; try { int all = 0; if(act_id==0) { //all = digital.qryGameKind(id); }else if (act_id==1) { boolean batchCanada28Issue = false; if(41!=id) { /*基础配置数据,修改导致坍塌性Bug。故只开放 id=41,加拿大28的起始期数据修改权限。 */ paramMap.remove("current_issue"); paramMap.remove("start_time"); paramMap.remove("end_time"); all = digital.updateGameType(paramMap); }else { List<Map<String, Object>> qryGameType = digital.qryGameType(); boolean isUpdateIssue = !StringUtil.isBlank(paramMap.get("current_issue")) && StringUtil.isBlank(paramMap.get("start_time")) && !StringUtil.isBlank(paramMap.get("end_time")); if(isUpdateIssue)//需要重新生成 batchCanada28Issue = gameType.batchCanada28Issue(qryGameType,paramMap); if(batchCanada28Issue || !isUpdateIssue)//更新成功或者不需要更新 all = digital.updateGameType(paramMap); } }else if (act_id==2) { all = digital.updateGameGroup(paramMap); } else if (act_id==3) { if("0".equals(paramMap.get("status")+"")) { paramMap.put("status",2); } all = digital.updateGamePlayed(paramMap); } return ResponseUtils.jsonView( all == 1 ? 200 : 133, all == 1 ? "更新成功":"更新失败"); } catch (Exception e) { e.printStackTrace(); return ResponseUtils.jsonView(201, "更新失败,请稍后再试",e.getMessage()) ; } } }
[ "licaiyou@followme.com" ]
licaiyou@followme.com
871d60ed2074fe208e933f51fea37e7ff61352c8
fe6ecbf29b0130662ae415d3b66af97af7094a70
/Code/Work/FF/Decomp/C_100472_akr.java
abc9b1393c1687fb7d97d9895742f17792dd2aa3
[]
no_license
joshuacoles/MineCraft-Patch-On-Launch-Client-old
272db752d5bc94b02bb14c012276c92047b0b0c4
28055c66ecf3d3236155521e988acc3b7f0b08e6
refs/heads/master
2016-09-05T21:03:36.361801
2012-11-17T07:42:26
2012-11-17T07:42:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,627
java
import java.util.Random; public class C_100472_akr extends C_100200_aiq { protected C_100472_akr(int var1) { super(var1, C_100664_afg.field_109027_q); this.field_106165_cl = 104; this.func_106008_a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); } public int func_106013_d() { return -1; } public boolean func_105994_c() { return false; } public boolean func_105977_b() { return false; } public void func_106007_a(C_100837_xo var1, int var2, int var3, int var4) { int var5 = var1.func_109357_g(var2, var3, var4) & 7; switch(var5) { case 1: default: this.func_106008_a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); break; case 2: this.func_106008_a(0.25F, 0.25F, 0.5F, 0.75F, 0.75F, 1.0F); break; case 3: this.func_106008_a(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 0.5F); break; case 4: this.func_106008_a(0.5F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F); break; case 5: this.func_106008_a(0.0F, 0.25F, 0.25F, 0.5F, 0.75F, 0.75F); } } public C_100412_amr func_106021_e(C_100873_xe var1, int var2, int var3, int var4) { this.func_106007_a(var1, var2, var3, var4); return super.func_106021_e(var1, var2, var3, var4); } public void func_106047_a(C_100873_xe var1, int var2, int var3, int var4, C_100595_ln var5) { int var6 = C_100650_jv.func_108910_c((double)(var5.field_103236_z * 4.0F / 360.0F) + 2.5D) & 3; var1.func_109488_c(var2, var3, var4, var6); } public C_100398_amm func_106326_a(C_100873_xe var1) { return new C_100415_amk(); } public int func_105979_a(C_100873_xe var1, int var2, int var3, int var4) { return C_100992_tt.field_110951_bQ.field_110891_cf; } public int func_106019_h(C_100873_xe var1, int var2, int var3, int var4) { C_100398_amm var5 = var1.func_109353_p(var2, var3, var4); return var5 != null && var5 instanceof C_100415_amk?((C_100415_amk)var5).func_102965_a():super.func_106019_h(var1, var2, var3, var4); } public int func_106004_b(int var1) { return var1; } public void func_105998_a(C_100873_xe var1, int var2, int var3, int var4, int var5, float var6, int var7) {} public void func_106060_a(C_100873_xe var1, int var2, int var3, int var4, int var5, C_101095_qg var6) { if(var6.field_103869_cf.field_111597_d) { var5 |= 8; var1.func_109488_c(var2, var3, var4, var5); } super.func_106060_a(var1, var2, var3, var4, var5, var6); } public void func_106041_a(C_100873_xe var1, int var2, int var3, int var4, int var5, int var6) { if(!var1.field_109557_J) { if((var6 & 8) == 0) { this.func_106042_a(var1, var2, var3, var4, new C_100994_tv(C_100992_tt.field_110951_bQ.field_110891_cf, 1, this.func_106019_h(var1, var2, var3, var4))); } super.func_106041_a(var1, var2, var3, var4, var5, var6); } } public int func_106043_a(int var1, Random var2, int var3) { return C_100992_tt.field_110951_bQ.field_110891_cf; } public void func_106348_a(C_100873_xe var1, int var2, int var3, int var4, C_100415_amk var5) { if(var5.func_102965_a() == 1 && var3 >= 2) { int var6 = C_100451_alf.field_106141_bf.field_106162_cm; int var7; C_100579_pa var8; int var9; for(var7 = -2; var7 <= 0; ++var7) { if(var1.func_109349_a(var2, var3 - 1, var4 + var7) == var6 && var1.func_109349_a(var2, var3 - 1, var4 + var7 + 1) == var6 && var1.func_109349_a(var2, var3 - 2, var4 + var7 + 1) == var6 && var1.func_109349_a(var2, var3 - 1, var4 + var7 + 2) == var6 && this.func_106349_d(var1, var2, var3, var4 + var7, 1) && this.func_106349_d(var1, var2, var3, var4 + var7 + 1, 1) && this.func_106349_d(var1, var2, var3, var4 + var7 + 2, 1)) { var1.func_109441_d(var2, var3, var4 + var7, 8); var1.func_109441_d(var2, var3, var4 + var7 + 1, 8); var1.func_109441_d(var2, var3, var4 + var7 + 2, 8); var1.func_109378_b(var2, var3, var4 + var7, 0); var1.func_109378_b(var2, var3, var4 + var7 + 1, 0); var1.func_109378_b(var2, var3, var4 + var7 + 2, 0); var1.func_109378_b(var2, var3 - 1, var4 + var7, 0); var1.func_109378_b(var2, var3 - 1, var4 + var7 + 1, 0); var1.func_109378_b(var2, var3 - 1, var4 + var7 + 2, 0); var1.func_109378_b(var2, var3 - 2, var4 + var7 + 1, 0); if(!var1.field_109557_J) { var8 = new C_100579_pa(var1); var8.func_103055_b((double)var2 + 0.5D, (double)var3 - 1.45D, (double)(var4 + var7) + 1.5D, 90.0F, 0.0F); var8.field_103469_aw = 90.0F; var8.func_103697_m(); var1.func_109513_d(var8); } for(var9 = 0; var9 < 120; ++var9) { var1.func_109428_a("snowballpoof", (double)var2 + var1.field_109577_u.nextDouble(), (double)(var3 - 2) + var1.field_109577_u.nextDouble() * 3.9D, (double)(var4 + var7 + 1) + var1.field_109577_u.nextDouble(), 0.0D, 0.0D, 0.0D); } var1.func_109409_f(var2, var3, var4 + var7, 0); var1.func_109409_f(var2, var3, var4 + var7 + 1, 0); var1.func_109409_f(var2, var3, var4 + var7 + 2, 0); var1.func_109409_f(var2, var3 - 1, var4 + var7, 0); var1.func_109409_f(var2, var3 - 1, var4 + var7 + 1, 0); var1.func_109409_f(var2, var3 - 1, var4 + var7 + 2, 0); var1.func_109409_f(var2, var3 - 2, var4 + var7 + 1, 0); return; } } for(var7 = -2; var7 <= 0; ++var7) { if(var1.func_109349_a(var2 + var7, var3 - 1, var4) == var6 && var1.func_109349_a(var2 + var7 + 1, var3 - 1, var4) == var6 && var1.func_109349_a(var2 + var7 + 1, var3 - 2, var4) == var6 && var1.func_109349_a(var2 + var7 + 2, var3 - 1, var4) == var6 && this.func_106349_d(var1, var2 + var7, var3, var4, 1) && this.func_106349_d(var1, var2 + var7 + 1, var3, var4, 1) && this.func_106349_d(var1, var2 + var7 + 2, var3, var4, 1)) { var1.func_109441_d(var2 + var7, var3, var4, 8); var1.func_109441_d(var2 + var7 + 1, var3, var4, 8); var1.func_109441_d(var2 + var7 + 2, var3, var4, 8); var1.func_109378_b(var2 + var7, var3, var4, 0); var1.func_109378_b(var2 + var7 + 1, var3, var4, 0); var1.func_109378_b(var2 + var7 + 2, var3, var4, 0); var1.func_109378_b(var2 + var7, var3 - 1, var4, 0); var1.func_109378_b(var2 + var7 + 1, var3 - 1, var4, 0); var1.func_109378_b(var2 + var7 + 2, var3 - 1, var4, 0); var1.func_109378_b(var2 + var7 + 1, var3 - 2, var4, 0); if(!var1.field_109557_J) { var8 = new C_100579_pa(var1); var8.func_103055_b((double)(var2 + var7) + 1.5D, (double)var3 - 1.45D, (double)var4 + 0.5D, 0.0F, 0.0F); var8.func_103697_m(); var1.func_109513_d(var8); } for(var9 = 0; var9 < 120; ++var9) { var1.func_109428_a("snowballpoof", (double)(var2 + var7 + 1) + var1.field_109577_u.nextDouble(), (double)(var3 - 2) + var1.field_109577_u.nextDouble() * 3.9D, (double)var4 + var1.field_109577_u.nextDouble(), 0.0D, 0.0D, 0.0D); } var1.func_109409_f(var2 + var7, var3, var4, 0); var1.func_109409_f(var2 + var7 + 1, var3, var4, 0); var1.func_109409_f(var2 + var7 + 2, var3, var4, 0); var1.func_109409_f(var2 + var7, var3 - 1, var4, 0); var1.func_109409_f(var2 + var7 + 1, var3 - 1, var4, 0); var1.func_109409_f(var2 + var7 + 2, var3 - 1, var4, 0); var1.func_109409_f(var2 + var7 + 1, var3 - 2, var4, 0); return; } } } } private boolean func_106349_d(C_100873_xe var1, int var2, int var3, int var4, int var5) { if(var1.func_109349_a(var2, var3, var4) != this.field_106162_cm) { return false; } else { C_100398_amm var6 = var1.func_109353_p(var2, var3, var4); return var6 != null && var6 instanceof C_100415_amk?((C_100415_amk)var6).func_102965_a() == var5:false; } } }
[ "josh@coles.to" ]
josh@coles.to
a5f5f7cb2d6280c82aa7090e7f7c87b8975fac06
a3841d9f3d125bfc4fb14b56438f9ffa7b270b1c
/src/test/java/com/hillel/lecture_4/Method.java
b0710f2c836c9e9bb2c4871129ac36269d673a34
[]
no_license
Dmitriy2509/home-work-task
346fa43941f0795d54adbeb46918b79d0f946862
00f8e4b631534fd9020c5735bb2209221ab2955e
refs/heads/master
2020-08-28T21:16:11.279256
2019-12-08T09:46:57
2019-12-08T09:46:57
217,823,419
0
0
null
2019-10-27T08:06:45
2019-10-27T08:06:45
null
UTF-8
Java
false
false
1,357
java
package com.hillel.lecture_4; public class Method { public static void main(String[] args) { /* double result = 25d+273.16; System.out.println("Celsius to Kelvin: "+ result);*/ celsiusToKelvin(10d); //metersToKilometers (); double kilometers = metersToKilometers(500d); distanceCompare(kilometers); if (kilometers>0.7){ System.out.println("Correct distance!"); }else if(kilometers<0.5){ System.out.println("Excellent distance!"); } else{ System.out.println("Bad distance!"); } System.out.println(kilometers); } public static void celsiusToKelvin(double celsius) { double result = celsius + 273.16; System.out.println("Celsius to Kelvin: "+ result); } public static double metersToKilometers (double meters){ double result = meters/1000d; System.out.println("Meters to kilometers: "+ result); return result; } public static String distanceCompare(double kilometers){ String message; if (kilometers>0.7){ message ="Correct distance!"; }else if(kilometers<0.5){ message="Excellent distance!"; } else{ message="Bad distance!"; } return message; } }
[ "sakovetsdmytryi@gmail.com" ]
sakovetsdmytryi@gmail.com
a81115beaa5950525dd4014d2f279d4d25111f6c
43d8520aecdad8ee7e4b1ac6b4e18bdf871de774
/src/com/comment/model/CommentDAO.java
322597e58d34901ca02f4ab7abc16cc15dea2d9f
[]
no_license
a5372268/MoviesHit
16f2862a40b1debc0ba4ae4def5ed56e98bbd1a6
26f20fe75510b2ecd80b3660b91801146f496a22
refs/heads/main
2023-05-25T04:47:08.688855
2021-06-11T11:38:33
2021-06-11T11:38:33
375,986,887
0
0
null
null
null
null
BIG5
Java
false
false
17,002
java
package com.comment.model; import java.sql.*; import java.util.*; import javax.naming.*; import javax.sql.DataSource; import com.movie.model.MovieVO; import jdbc.util.CompositeQuery.jdbcUtil_CompositeQuery_Comment; public class CommentDAO implements CommentDAO_interface{ private static DataSource ds = null; static { try { Context ctx = new InitialContext(); ds = (DataSource) ctx.lookup("java:comp/env/jdbc/CEA103G3"); } catch (NamingException e) { e.printStackTrace(); } } private static final String INSERT_STMT = "insert into COMMENT (MEMBER_NO,MOVIE_NO,CONTENT,STATUS) values (?, ?, ?, ?)"; private static final String UPDATE_STMT = "update COMMENT set CONTENT=?, MOVIE_NO=?, MODIFY_DT=default where COMMENT_NO = ?"; private static final String UPDATE_COMMENTSTATUS_OFF_STMT = "update COMMENT set STATUS=1 where COMMENT_NO = ?"; private static final String UPDATE_COMMENTSTATUS_ON_STMT = "update COMMENT set STATUS=0 where COMMENT_NO = ?"; private static final String DELETE_REPORTCOMMENTS = "delete from REPORT_COMMENT where COMMENT_NO = ?"; private static final String DELETE_COMMENT = "delete from COMMENT where COMMENT_NO = ?"; private static final String GET_ONE_STMT = "select * from COMMENT where COMMENT_NO = ?"; private static final String GET_ALL_STMT = "select * from COMMENT order by COMMENT_NO"; private static final String GET_MOVIE_COMMENT_STMT = "select * from COMMENT where MOVIE_NO = ? and STATUS = 0 order by CRT_DT desc"; // private static final String GET_MEMBER_COMMENT_STMT = // "select * from COMMENT where MEMBER_NO = ?"; private static final String GET_MOVIE_COMMENT_BY_MEM = "select * from COMMENT where MEMBER_NO = ?"; private static final String UPDATE_BY_COMMENTNO_STMT = "update COMMENT set CONTENT=? where COMMENT_NO = ?"; @Override public void insert(CommentVO commentVO) { Connection con = null; PreparedStatement pstmt = null; try { con = ds.getConnection(); pstmt = con.prepareStatement(INSERT_STMT); pstmt.setInt(1, commentVO.getMemberno()); pstmt.setInt(2, commentVO.getMovieno()); pstmt.setString(3, commentVO.getContent()); pstmt.setString(4, commentVO.getStatus()); pstmt.executeUpdate(); // Handle any SQL errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } } @Override public void update(CommentVO commentVO) { Connection con = null; PreparedStatement pstmt = null; try { con = ds.getConnection(); pstmt = con.prepareStatement(UPDATE_STMT); pstmt.setString(1, commentVO.getContent()); pstmt.setInt(2, commentVO.getMovieno()); pstmt.setInt(3, commentVO.getCommentno()); pstmt.executeUpdate(); // Handle any driver errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } } @Override public void updateCommentStatusOff(CommentVO commentVO , Connection con) { PreparedStatement pstmt = null; try { pstmt = con.prepareStatement(UPDATE_COMMENTSTATUS_OFF_STMT); pstmt.setDouble(1, commentVO.getCommentno()); pstmt.executeUpdate(); // System.out.println("11"); // Handle any driver errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } } } @Override public void updateCommentStatusOn(CommentVO commentVO , Connection con) { PreparedStatement pstmt = null; try { pstmt = con.prepareStatement(UPDATE_COMMENTSTATUS_ON_STMT); pstmt.setDouble(1, commentVO.getCommentno()); pstmt.executeUpdate(); // System.out.println("11"); // Handle any driver errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } } } // @Override // public void delete(Integer commentno) { // // Connection con = null; // PreparedStatement pstmt = null; // // try { // // con = ds.getConnection(); // pstmt = con.prepareStatement(DELETE_STMT); // // pstmt.setInt(1, commentno); // // pstmt.executeUpdate(); // // // Handle any driver errors // } catch (SQLException se) { // throw new RuntimeException("A database error occured. " // + se.getMessage()); // // Clean up JDBC resources // } finally { // if (pstmt != null) { // try { // pstmt.close(); // } catch (SQLException se) { // se.printStackTrace(System.err); // } // } // if (con != null) { // try { // con.close(); // } catch (Exception e) { // e.printStackTrace(System.err); // } // } // } // // } @Override public void delete(Integer commentno) { int updateCount_ReportComments = 0; Connection con = null; PreparedStatement pstmt = null; try { con = ds.getConnection(); // 1●設定於 pstm.executeUpdate()之前 con.setAutoCommit(false); // 先刪除檢舉評論 pstmt = con.prepareStatement(DELETE_REPORTCOMMENTS); pstmt.setInt(1, commentno); updateCount_ReportComments = pstmt.executeUpdate(); // 再刪除評論 pstmt = con.prepareStatement(DELETE_COMMENT); pstmt.setInt(1, commentno); pstmt.executeUpdate(); // 2●設定於 pstm.executeUpdate()之後 con.commit(); con.setAutoCommit(true); System.out.println("刪除評論編號" + commentno + "時,共有檢舉評論" + updateCount_ReportComments + "則同時被刪除"); // Handle any SQL errors } catch (SQLException se) { if (con != null) { try { // 3●設定於當有exception發生時之catch區塊內 con.rollback(); } catch (SQLException excep) { throw new RuntimeException("rollback error occured. " + excep.getMessage()); } } throw new RuntimeException("A database error occured. " + se.getMessage()); } finally { if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } } @Override public CommentVO findByPrimaryKey(Integer commentno) { CommentVO commentVO = null; Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; try { con = ds.getConnection(); pstmt = con.prepareStatement(GET_ONE_STMT); pstmt.setInt(1, commentno); rs = pstmt.executeQuery(); while (rs.next()) { // commentVo 也稱為 Domain objects commentVO = new CommentVO(); commentVO.setCommentno(rs.getInt("COMMENT_NO")); commentVO.setMemberno(rs.getInt("MEMBER_NO")); commentVO.setMovieno(rs.getInt("MOVIE_NO")); commentVO.setContent(rs.getString("CONTENT")); commentVO.setCreatdate(rs.getTimestamp("CRT_DT")); commentVO.setModifydate(rs.getTimestamp("MODIFY_DT")); commentVO.setStatus(rs.getString("STATUS")); } // Handle any driver errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (rs != null) { try { rs.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } return commentVO; } // @Override // public List<CommentVO> findByMemberNo(Integer memberno) { // List<CommentVO> list = new ArrayList<CommentVO>(); // CommentVO commentVO = null; // // Connection con = null; // PreparedStatement pstmt = null; // ResultSet rs = null; // // try { // // con = ds.getConnection(); // pstmt = con.prepareStatement(GET_MEMBER_COMMENT_STMT); // // pstmt.setInt(1, memberno); // // rs = pstmt.executeQuery(); // // while (rs.next()) { // // commentVo 也稱為 Domain objects // commentVO = new CommentVO(); // commentVO.setCommentno(rs.getInt("COMMENT_NO")); // commentVO.setMemberno(rs.getInt("MEMBER_NO")); // commentVO.setMovieno(rs.getInt("MOVIE_NO")); // commentVO.setContent(rs.getString("CONTENT")); // commentVO.setCreatdate(rs.getTimestamp("CRT_DT")); // commentVO.setModifydate(rs.getTimestamp("MODIFY_DT")); // commentVO.setStatus(rs.getString("STATUS")); // list.add(commentVO); // } // // // Handle any driver errors // } catch (SQLException se) { // throw new RuntimeException("A database error occured. " // + se.getMessage()); // // Clean up JDBC resources // } finally { // if (rs != null) { // try { // rs.close(); // } catch (SQLException se) { // se.printStackTrace(System.err); // } // } // if (pstmt != null) { // try { // pstmt.close(); // } catch (SQLException se) { // se.printStackTrace(System.err); // } // } // if (con != null) { // try { // con.close(); // } catch (Exception e) { // e.printStackTrace(System.err); // } // } // } // return list; // } @Override public List<CommentVO> getAll() { List<CommentVO> list = new ArrayList<CommentVO>(); CommentVO commentVO = null; Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; try { con = ds.getConnection(); pstmt = con.prepareStatement(GET_ALL_STMT); rs = pstmt.executeQuery(); while (rs.next()) { // commentVO 也稱為 Domain objects commentVO = new CommentVO(); commentVO.setCommentno(rs.getInt("COMMENT_NO")); commentVO.setMemberno(rs.getInt("MEMBER_NO")); commentVO.setMovieno(rs.getInt("MOVIE_NO")); commentVO.setContent(rs.getString("CONTENT")); commentVO.setCreatdate(rs.getTimestamp("CRT_DT")); commentVO.setModifydate(rs.getTimestamp("MODIFY_DT")); commentVO.setStatus(rs.getString("STATUS")); list.add(commentVO); // Store the row in the list } // Handle any driver errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (rs != null) { try { rs.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } return list; } @Override public List<CommentVO> getAll(Map<String, String[]> map) { List<CommentVO> list = new ArrayList<CommentVO>(); CommentVO commentVO = null; Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; try { con = ds.getConnection(); String finalSQL = "select * from COMMENT " + jdbcUtil_CompositeQuery_Comment.get_WhereCondition(map) + "order by COMMENT_NO desc"; pstmt = con.prepareStatement(finalSQL); System.out.println("●●finalSQL(by DAO) = "+finalSQL); rs = pstmt.executeQuery(); while (rs.next()) { commentVO = new CommentVO(); commentVO.setCommentno(rs.getInt("COMMENT_NO")); commentVO.setMemberno(rs.getInt("MEMBER_NO")); commentVO.setMovieno(rs.getInt("MOVIE_NO")); commentVO.setContent(rs.getString("CONTENT")); commentVO.setCreatdate(rs.getTimestamp("CRT_DT")); commentVO.setModifydate(rs.getTimestamp("MODIFY_DT")); commentVO.setStatus(rs.getString("STATUS")); list.add(commentVO); // Store the row in the List } // Handle any SQL errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); } finally { if (rs != null) { try { rs.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } return list; } @Override public List<CommentVO> findByMovieNo(Integer movieno) { List<CommentVO> list = new ArrayList<CommentVO>(); CommentVO commentVO = null; Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; try { con = ds.getConnection(); pstmt = con.prepareStatement(GET_MOVIE_COMMENT_STMT); pstmt.setInt(1, movieno); rs = pstmt.executeQuery(); while (rs.next()) { // commentVo 也稱為 Domain objects commentVO = new CommentVO(); commentVO.setCommentno(rs.getInt("COMMENT_NO")); commentVO.setMemberno(rs.getInt("MEMBER_NO")); commentVO.setMovieno(rs.getInt("MOVIE_NO")); commentVO.setContent(rs.getString("CONTENT")); commentVO.setCreatdate(rs.getTimestamp("CRT_DT")); commentVO.setModifydate(rs.getTimestamp("MODIFY_DT")); commentVO.setStatus(rs.getString("STATUS")); list.add(commentVO); } // Handle any driver errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (rs != null) { try { rs.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } return list; } @Override public List<CommentVO> findByMemberNo(Integer memberno) { List<CommentVO> list = new ArrayList<CommentVO>(); CommentVO commentVO = null; Connection con = null; PreparedStatement pstmt = null; ResultSet rs = null; try { con = ds.getConnection(); pstmt = con.prepareStatement(GET_MOVIE_COMMENT_BY_MEM); pstmt.setInt(1, memberno); rs = pstmt.executeQuery(); while (rs.next()) { // commentVo 也稱為 Domain objects commentVO = new CommentVO(); commentVO.setCommentno(rs.getInt("COMMENT_NO")); commentVO.setMemberno(rs.getInt("MEMBER_NO")); commentVO.setMovieno(rs.getInt("MOVIE_NO")); commentVO.setContent(rs.getString("CONTENT")); commentVO.setCreatdate(rs.getTimestamp("CRT_DT")); commentVO.setModifydate(rs.getTimestamp("MODIFY_DT")); commentVO.setStatus(rs.getString("STATUS")); list.add(commentVO); } // Handle any driver errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (rs != null) { try { rs.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } return list; } @Override public void update_bycommentno(CommentVO commentVO) { Connection con = null; PreparedStatement pstmt = null; try { con = ds.getConnection(); pstmt = con.prepareStatement(UPDATE_BY_COMMENTNO_STMT); pstmt.setString(1, commentVO.getContent()); pstmt.setInt(2, commentVO.getCommentno()); pstmt.executeUpdate(); // Handle any driver errors } catch (SQLException se) { throw new RuntimeException("A database error occured. " + se.getMessage()); // Clean up JDBC resources } finally { if (pstmt != null) { try { pstmt.close(); } catch (SQLException se) { se.printStackTrace(System.err); } } if (con != null) { try { con.close(); } catch (Exception e) { e.printStackTrace(System.err); } } } } }
[ "a5372268@gmail.com" ]
a5372268@gmail.com
dc12ae9c10472fefe2270298b1646d8b90a2221d
d2045b375576f99415c1ee3298dec7d1330711aa
/meuprograma.java
612dd5e41015f417e90c9eaa1464751c00e098a9
[]
no_license
Alexandresteves/Java-projects
75f5e0754db202c1ebb4a890319e703d0aab5511
76158ae39acf4c2605595b167419abb5d803bee1
refs/heads/master
2021-04-15T16:33:10.144950
2018-03-25T23:22:13
2018-03-25T23:22:13
126,748,597
0
0
null
null
null
null
ISO-8859-1
Java
false
false
115
java
public class Meuprograma { public static void main(String[] args) { System.out.println("Aplicação Java"); } }
[ "alexandre_ae@hotmail.com" ]
alexandre_ae@hotmail.com
4e3ec35ea4fd4650cee60ee51e794822de363214
2905ab13085cf90fa3ff02eabb635ffb80421121
/ivanhoe/src/edu/virginia/speclab/ivanhoe/shared/message/DeleteDocumentMsg.java
e7b6a485985c03f238ec0e43fcf2e6bd7d3b37ce
[]
no_license
waynegraham/ivanhoe
8474eccd2eb05e30d16eef9ad4425e71fca65b12
dfe05439f7e75298a4b38313d5fe904998dbda42
refs/heads/master
2020-05-31T00:45:22.000842
2010-03-23T15:28:59
2010-03-23T15:28:59
32,215,670
0
0
null
null
null
null
UTF-8
Java
false
false
781
java
/* * Created on Mar 22, 2004 * * To change the template for this generated file go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ package edu.virginia.speclab.ivanhoe.shared.message; import edu.virginia.speclab.ivanhoe.shared.data.DocumentInfo; /** * @author lfoster * * To change the template for this generated type comment go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ public class DeleteDocumentMsg extends Message { private DocumentInfo docInfo; public DeleteDocumentMsg(DocumentInfo delDocInfo) { super(MessageType.DELETE_DOCUMENT); this.docInfo = delDocInfo; } public DocumentInfo getInfo() { return this.docInfo; } }
[ "nicklaiacona@c161d011-2726-0410-8d5a-8f576c7000fa" ]
nicklaiacona@c161d011-2726-0410-8d5a-8f576c7000fa
b7aa8d6e188213be481718594362d5a472dc1b61
b146af64dd81bc05ed8b9a4db18dd51a965ae0b5
/src/rs/ac/bg/etf/pp1/ast/AstLetop.java
54fae17ffc7c0fb0c8c0f1c5cc83fad2bddb452c
[ "MIT" ]
permissive
Edvvin/MicroJavaCompiler
07cf9b6dab83dabfe654762a5448db82cbef1e86
5ff2ee830c8214b9f54494f16fdcd19344f5135d
refs/heads/master
2023-06-08T07:49:02.599846
2021-06-16T14:57:37
2021-06-16T14:57:37
343,233,059
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
// generated with ast extension for cup // version 0.8 // 16/5/2021 15:11:18 package rs.ac.bg.etf.pp1.ast; public class AstLetop extends Relop { public AstLetop () { } public void accept(Visitor visitor) { visitor.visit(this); } public void childrenAccept(Visitor visitor) { } public void traverseTopDown(Visitor visitor) { accept(visitor); } public void traverseBottomUp(Visitor visitor) { accept(visitor); } public String toString(String tab) { StringBuffer buffer=new StringBuffer(); buffer.append(tab); buffer.append("AstLetop(\n"); buffer.append(tab); buffer.append(") [AstLetop]"); return buffer.toString(); } }
[ "edvvin@mail.com" ]
edvvin@mail.com
ce2e677fb9df5c0ff521b3c9752780f7b3968e46
4946183930dd93dfa6d25f8d561b43aab823545c
/test/src/Singleton.java
ea5d1657e9cbc322b801758092b7211cb47a52d2
[]
no_license
chen-t7/code
f82d02b5ee2b5fbf7d691fd329ed5569bb0cb642
ce9a9ac2c5da170e8f33997814958b3f1706886d
refs/heads/master
2022-12-26T21:57:34.316622
2020-09-07T09:05:49
2020-09-07T09:05:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
//class Singleton { // private static Singleton instance=new Singleton(); // private Singleton(){} // public static Singleton getInstance(){ // return instance; // } //} class Singleton{ private static volatile Singleton instance=null; private Singleton(){} public static Singleton getInstance(){ if(instance==null){ synchronized (Singleton.class){ if(instance==null){ instance=new Singleton(); } } } return instance; } }
[ "2274828126@qq.com" ]
2274828126@qq.com
477c1fa840b110e6a117d4c738f6ce0711b07028
199e420db803921633fe31f0aa9aeb0b5881b4a8
/app/src/main/java/com/example/movies_and_actors/adapters/AdapterSearch.java
8e35d0ed2a22b85f9697c7ca3f7fdfb20409a59a
[]
no_license
adrijanasavic/Movies_and_Actors
6d26b98d7e439c474f49437e36b7d98c4c529f0f
cfdb729d07d25a5041d81c43f6ff774f0669e211
refs/heads/master
2022-10-20T19:25:19.386002
2020-06-10T15:12:13
2020-06-10T15:12:13
270,801,180
0
0
null
null
null
null
UTF-8
Java
false
false
3,543
java
package com.example.movies_and_actors.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.example.movies_and_actors.R; import com.example.movies_and_actors.models.ResultsMovieItem; import java.util.List; import static com.example.movies_and_actors.net.MyServiceContract.IMAGEBASEURL; public class AdapterSearch extends RecyclerView.Adapter<AdapterSearch.MyViewHolder>{ private Context context; private List<ResultsMovieItem> searchItems; private OnItemClickListener listener; public String firstFour(String godina) { if (godina.length() > 4) { return godina.substring(0, 4); } else { return null; } } public AdapterSearch(Context context, List<ResultsMovieItem> searchItems, OnItemClickListener listener) { this.context = context; this.searchItems = searchItems; this.listener = listener; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.recycler_prikaz, parent, false); return new MyViewHolder(view, listener); } @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { holder.imeFilma.setText(searchItems.get(position).getTitle()); try { holder.godinaFilma.setText(firstFour(searchItems.get(position).getReleaseDate())); } catch (NullPointerException e) { e.printStackTrace(); } // Picasso.with(context).load(searchItems.get(position).getPosterPath()).into(holder.slikaGlumca); Glide.with(holder.itemView) .load(IMAGEBASEURL + searchItems.get(position).getPosterPath()) .into(holder.slikaGlumca); } @Override public int getItemCount() { return searchItems.size(); } public ResultsMovieItem get(int position) { return searchItems.get(position); } public static class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView imeFilma, godinaFilma; private ImageView slikaGlumca; private long lastClickTime = System.currentTimeMillis(); private static final long CLICK_TIME_INTERVAL = 1000; private OnItemClickListener vhListener; MyViewHolder(@NonNull View itemView, OnItemClickListener vhListener) { super(itemView); itemView.setClickable(true); itemView.setOnClickListener(this); slikaGlumca = itemView.findViewById(R.id.slikaGlumca); imeFilma = itemView.findViewById( R.id.imeGlumca); godinaFilma = itemView.findViewById((R.id.godinaFilma)); this.vhListener = vhListener; } @Override public void onClick(View v) { long now = System.currentTimeMillis(); if (now - lastClickTime < CLICK_TIME_INTERVAL){ return; } lastClickTime = now; vhListener.onSearchMovieClick(getAdapterPosition()); } } public interface OnItemClickListener { void onSearchMovieClick(int position); } }
[ "adrijana.jovicic@gmail.com" ]
adrijana.jovicic@gmail.com
836db588d3ebbda95ec018e41034285b240c046e
e4d9c628519e51a49f822c06112604c0829ef5ae
/Backend/src/main/java/com/pokemon/pokemon/controller/interfaces/ITrainerController.java
f533346473506519765cc85d973916ef8c156c89
[]
no_license
juliagarlor/PokeTeam
fdb9b8da52558903146b703ed49085ce954f0ab4
40059e7c9e290cb8d68a0b8a91a0d9f2774aad0e
refs/heads/master
2023-05-12T06:45:52.519920
2021-06-06T16:46:17
2021-06-06T16:46:17
350,309,188
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package com.pokemon.pokemon.controller.interfaces; import com.pokemon.pokemon.utils.dtos.*; import org.springframework.web.bind.annotation.*; import java.util.*; public interface ITrainerController { List<Object> getNamesAndIds(); List<TrainerDTO> getTrainers(); TrainerDTO createTrainer(TrainerDTO trainerDTO); void removeTrainer(Long id); }
[ "julia.garcia.lorente@gmail.com" ]
julia.garcia.lorente@gmail.com
cfd152655fdd852784983ef925814f4e28238ad4
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/Transcript.java
3bded6d7e5fd7f59f8c4200b91a851ef81caf4e7
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
11,144
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.transcribe.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Identifies the location of a transcription. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/transcribe-2017-10-26/Transcript" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Transcript implements Serializable, Cloneable, StructuredPojo { /** * <p> * The S3 object location of the transcript. * </p> * <p> * Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> field * when you created the job, this is the URI of that bucket. If you chose to store the transcript in Amazon * Transcribe, this is a shareable URL that provides secure access to that location. * </p> */ private String transcriptFileUri; /** * <p> * The S3 object location of the redacted transcript. * </p> * <p> * Use this URI to access the redacted transcript. If you specified an S3 bucket in the * <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose to * store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that location. * </p> */ private String redactedTranscriptFileUri; /** * <p> * The S3 object location of the transcript. * </p> * <p> * Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> field * when you created the job, this is the URI of that bucket. If you chose to store the transcript in Amazon * Transcribe, this is a shareable URL that provides secure access to that location. * </p> * * @param transcriptFileUri * The S3 object location of the transcript.</p> * <p> * Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> * field when you created the job, this is the URI of that bucket. If you chose to store the transcript in * Amazon Transcribe, this is a shareable URL that provides secure access to that location. */ public void setTranscriptFileUri(String transcriptFileUri) { this.transcriptFileUri = transcriptFileUri; } /** * <p> * The S3 object location of the transcript. * </p> * <p> * Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> field * when you created the job, this is the URI of that bucket. If you chose to store the transcript in Amazon * Transcribe, this is a shareable URL that provides secure access to that location. * </p> * * @return The S3 object location of the transcript.</p> * <p> * Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> * field when you created the job, this is the URI of that bucket. If you chose to store the transcript in * Amazon Transcribe, this is a shareable URL that provides secure access to that location. */ public String getTranscriptFileUri() { return this.transcriptFileUri; } /** * <p> * The S3 object location of the transcript. * </p> * <p> * Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> field * when you created the job, this is the URI of that bucket. If you chose to store the transcript in Amazon * Transcribe, this is a shareable URL that provides secure access to that location. * </p> * * @param transcriptFileUri * The S3 object location of the transcript.</p> * <p> * Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> * field when you created the job, this is the URI of that bucket. If you chose to store the transcript in * Amazon Transcribe, this is a shareable URL that provides secure access to that location. * @return Returns a reference to this object so that method calls can be chained together. */ public Transcript withTranscriptFileUri(String transcriptFileUri) { setTranscriptFileUri(transcriptFileUri); return this; } /** * <p> * The S3 object location of the redacted transcript. * </p> * <p> * Use this URI to access the redacted transcript. If you specified an S3 bucket in the * <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose to * store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that location. * </p> * * @param redactedTranscriptFileUri * The S3 object location of the redacted transcript.</p> * <p> * Use this URI to access the redacted transcript. If you specified an S3 bucket in the * <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose * to store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that * location. */ public void setRedactedTranscriptFileUri(String redactedTranscriptFileUri) { this.redactedTranscriptFileUri = redactedTranscriptFileUri; } /** * <p> * The S3 object location of the redacted transcript. * </p> * <p> * Use this URI to access the redacted transcript. If you specified an S3 bucket in the * <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose to * store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that location. * </p> * * @return The S3 object location of the redacted transcript.</p> * <p> * Use this URI to access the redacted transcript. If you specified an S3 bucket in the * <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you * chose to store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access * to that location. */ public String getRedactedTranscriptFileUri() { return this.redactedTranscriptFileUri; } /** * <p> * The S3 object location of the redacted transcript. * </p> * <p> * Use this URI to access the redacted transcript. If you specified an S3 bucket in the * <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose to * store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that location. * </p> * * @param redactedTranscriptFileUri * The S3 object location of the redacted transcript.</p> * <p> * Use this URI to access the redacted transcript. If you specified an S3 bucket in the * <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose * to store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that * location. * @return Returns a reference to this object so that method calls can be chained together. */ public Transcript withRedactedTranscriptFileUri(String redactedTranscriptFileUri) { setRedactedTranscriptFileUri(redactedTranscriptFileUri); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getTranscriptFileUri() != null) sb.append("TranscriptFileUri: ").append(getTranscriptFileUri()).append(","); if (getRedactedTranscriptFileUri() != null) sb.append("RedactedTranscriptFileUri: ").append(getRedactedTranscriptFileUri()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Transcript == false) return false; Transcript other = (Transcript) obj; if (other.getTranscriptFileUri() == null ^ this.getTranscriptFileUri() == null) return false; if (other.getTranscriptFileUri() != null && other.getTranscriptFileUri().equals(this.getTranscriptFileUri()) == false) return false; if (other.getRedactedTranscriptFileUri() == null ^ this.getRedactedTranscriptFileUri() == null) return false; if (other.getRedactedTranscriptFileUri() != null && other.getRedactedTranscriptFileUri().equals(this.getRedactedTranscriptFileUri()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTranscriptFileUri() == null) ? 0 : getTranscriptFileUri().hashCode()); hashCode = prime * hashCode + ((getRedactedTranscriptFileUri() == null) ? 0 : getRedactedTranscriptFileUri().hashCode()); return hashCode; } @Override public Transcript clone() { try { return (Transcript) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.transcribe.model.transform.TranscriptMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
04174ab64cfe9c7c40de3ee2179c44c9794f2296
24d8cf871b092b2d60fc85d5320e1bc761a7cbe2
/DrJava/rev4989-5058/base-trunk-4989/src/edu/rice/cs/drjava/model/debug/DebugEventNotifier.java
ba8294b324138206e2f6f161d2febc545f535c13
[]
no_license
joliebig/featurehouse_fstmerge_examples
af1b963537839d13e834f829cf51f8ad5e6ffe76
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
refs/heads/master
2016-09-05T10:24:50.974902
2013-03-28T16:28:47
2013-03-28T16:28:47
9,080,611
3
2
null
null
null
null
UTF-8
Java
false
false
4,801
java
package edu.rice.cs.drjava.model.debug; import edu.rice.cs.drjava.model.EventNotifier; import edu.rice.cs.drjava.model.OpenDefinitionsDocument; import java.awt.EventQueue; public class DebugEventNotifier extends EventNotifier<DebugListener> implements DebugListener { public void debuggerStarted() { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).debuggerStarted(); } } finally { _lock.endRead(); } } public void debuggerShutdown() { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).debuggerShutdown(); } } finally { _lock.endRead(); } } public void threadLocationUpdated(OpenDefinitionsDocument doc, int lineNumber, boolean shouldHighlight) { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).threadLocationUpdated(doc, lineNumber, shouldHighlight); } } finally { _lock.endRead(); } } public void regionAdded(Breakpoint bp) { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).regionAdded(bp); } } finally { _lock.endRead(); } } public void breakpointReached(Breakpoint bp) { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).breakpointReached(bp); } } finally { _lock.endRead(); } } public void regionChanged(Breakpoint bp) { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).regionChanged(bp); } } finally { _lock.endRead(); } } public void watchSet(DebugWatchData w) { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).watchSet(w); } } finally { _lock.endRead(); } } public void watchRemoved(DebugWatchData w) { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).watchRemoved(w); } } finally { _lock.endRead(); } } public void regionRemoved(Breakpoint bp) { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) _listeners.get(i).regionRemoved(bp); } finally { _lock.endRead(); } } public void stepRequested() { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) _listeners.get(i).stepRequested(); } finally { _lock.endRead(); } } public void currThreadSuspended() { _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) _listeners.get(i).currThreadSuspended(); } finally { _lock.endRead(); } } public void currThreadResumed() { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) _listeners.get(i).currThreadResumed(); } finally { _lock.endRead(); } } public void threadStarted() { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) _listeners.get(i).threadStarted(); } finally { _lock.endRead(); } } public void currThreadDied() { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) _listeners.get(i).currThreadDied(); } finally { _lock.endRead(); } } public void nonCurrThreadDied() { assert EventQueue.isDispatchThread(); _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) _listeners.get(i).nonCurrThreadDied(); } finally { _lock.endRead(); } } public void currThreadSet(DebugThreadData thread) { _lock.startRead(); try { int size = _listeners.size(); for (int i = 0; i < size; i++) { _listeners.get(i).currThreadSet(thread); } } finally { _lock.endRead(); } } }
[ "joliebig@fim.uni-passau.de" ]
joliebig@fim.uni-passau.de
dba9ee1476a32bebd821b0c15003236eeab674cf
43b978c8caaa77de9dd2afd134a790af84b51481
/CSC 151/Lab 5 Assignments/StudentOrderingNumbers.java
eee81e97be3d0c3e0f20763edb4d263295d4f1eb
[]
no_license
cmhansen125/Java-Classes
9b79e212e0d480bfe8fc9d61e4ec9d4a6ae92b7e
f651a1106c1557ab6f53935a563868c878b4b7eb
refs/heads/master
2021-02-11T13:49:27.840178
2020-03-02T23:47:49
2020-03-02T23:47:49
244,496,966
1
0
null
null
null
null
UTF-8
Java
false
false
1,820
java
import javax.swing.*; public class StudentOrderingNumbers { public static void main(String[] args) { WidgetView wv = new WidgetView(); // Finally, a program that does something. This program asks the user // for 3 numbers and figures out the largest, middle and smallest. // JLabels are similar to JTextFields, but JTextFields can be modified by // the user. JLabels can't JLabel jlInstructions = new JLabel("Enter 3 numbers and I'll order them"); JTextField num1 = new JTextField(5); JTextField num2 = new JTextField(5); JTextField num3 = new JTextField(5); // add the initial widgets wv.add(jlInstructions); wv.add(num1); wv.add(num2); wv.add(num3); JButton execute = new JButton("Push me after entering the numbers"); wv.addAndWait(execute); // When addAndWait returns, the user has pushed the execute JButton. // Hopefully the user has entered three valid numbers. // read the (String) contents of the JTextFields, and convert them to int int n1 = Integer.parseInt(num1.getText()); int n2 = Integer.parseInt(num2.getText()); int n3 = Integer.parseInt(num3.getText()); int hi = n1; hi = Math.max(hi, n2); hi = Math.max(hi, n3); int lo = n1; lo = Math.min(lo, n2); lo = Math.min(lo, n3); int mid = n1 + n2 + n3 - hi - lo; JLabel hiLabel = new JLabel("highest " + hi); JLabel midLabel = new JLabel("middle " + mid); JLabel loLabel = new JLabel("lowest " + lo); // update the gui with our results wv.add(hiLabel); wv.add(midLabel); wv.add(loLabel); } }
[ "noreply@github.com" ]
noreply@github.com
2865885b1cd6d8c68877f0c21ae74c7bd5205d3e
2ddbe278a618adf859430ee875888aaec971d73b
/factory/src/FactoeyMethod/Apple.java
2f9ae75c6925f73b54feabdf674c466be6f0f585
[]
no_license
tanzikun/IdeaProjects
6733695e46bf80c692069a1b02853d981c4ae65b
8ff788b242e565d3cff0ae97515e64cb3478a7db
refs/heads/master
2022-12-02T06:20:50.124198
2019-08-06T14:39:54
2019-08-06T14:39:54
200,869,608
0
0
null
2022-11-16T12:22:43
2019-08-06T14:38:20
Java
UTF-8
Java
false
false
167
java
package FactoeyMethod; public class Apple implements Fruit { /** * 采集 */ public void get(){ System.out.println("采集苹果"); } }
[ "574836588@qq.com" ]
574836588@qq.com
35698160e29652501fef334dbd7f4b08f1be6295
7c7c660e45be16b60f74d5cc5daa3f7c71fe45d4
/ecolls-j/src/main/java/xyz/cofe/collection/UnionMap.java
de0b4865ef02c6f6acbfd00a85a86efc46fc74e3
[ "MIT" ]
permissive
gochaorg/cofe.xyz-next
9f160e6726d5af9d6efd5eda8b86b381c9d62824
02cb327222d113fd53e773bd61c3a0aeef24b9b2
refs/heads/master
2022-11-27T05:52:42.549697
2022-10-15T22:13:51
2022-10-15T22:13:51
200,032,063
0
0
MIT
2022-11-15T23:42:12
2019-08-01T10:45:09
Java
UTF-8
Java
false
false
9,113
java
/* * The MIT License * * Copyright 2014 Kamnev Georgiy (nt.gocha@gmail.com). * * Данная лицензия разрешает, безвозмездно, лицам, получившим копию данного программного * обеспечения и сопутствующей документации (в дальнейшем именуемыми "Программное Обеспечение"), * использовать Программное Обеспечение без ограничений, включая неограниченное право на * использование, копирование, изменение, объединение, публикацию, распространение, сублицензирование * и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется * данное Программное Обеспечение, при соблюдении следующих условий: * * Вышеупомянутый копирайт и данные условия должны быть включены во все копии * или значимые части данного Программного Обеспечения. * * ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ ЛЮБОГО ВИДА ГАРАНТИЙ, * ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, * СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И НЕНАРУШЕНИЯ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ * ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ * ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ * ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ * ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. */ package xyz.cofe.collection; import xyz.cofe.iter.ArrayIterable; import java.util.Collection; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; /** * Карта для записи в несколько других карт и чтение из указанной * @author gocha */ public class UnionMap<K,V> implements Map<K, V>{ //<editor-fold defaultstate="collapsed" desc="log Функции"> private static void logFine(String message,Object ... args){ Logger.getLogger(UnionMap.class.getName()).log(Level.FINE, message, args); } private static void logFiner(String message,Object ... args){ Logger.getLogger(UnionMap.class.getName()).log(Level.FINER, message, args); } private static void logInfo(String message,Object ... args){ Logger.getLogger(UnionMap.class.getName()).log(Level.INFO, message, args); } private static void logWarning(String message,Object ... args){ Logger.getLogger(UnionMap.class.getName()).log(Level.WARNING, message, args); } private static void logSevere(String message,Object ... args){ Logger.getLogger(UnionMap.class.getName()).log(Level.SEVERE, message, args); } private static void logException(Throwable ex){ Logger.getLogger(UnionMap.class.getName()).log(Level.SEVERE, null, ex); } //</editor-fold> protected Map<K,V> readMap = null; protected Iterable<Map> writeMaps = null; /** * Возвращает карту из которой произодит чтение * @return карта для чтения */ public Map<K, V> getReadMap() { return readMap; } /** * Указывает карту из которой произодит чтение * @param readMap карта для чтения */ public void setReadMap(Map<K, V> readMap) { this.readMap = readMap; } /** * Возвращает карты в которые производит запись * @return карты для записи */ public Iterable<Map> getWriteMaps() { return writeMaps; } /** * Указывет карты в которые производит запись * @param writeMaps карты для записи */ public void setWriteMaps(Iterable<Map> writeMaps) { this.writeMaps = writeMaps; } /** * Указывет карты в которые производит запись * @param maps карты для записи */ public void setWriteMaps(Map ... maps){ this.writeMaps = new ArrayIterable<>(maps); } /** * Возвращает размер карты * @return размер карты */ @Override public int size() { if( readMap==null )return 0; return readMap.size(); } /** * Проверяет что карта пустая * @return true - нет элементов */ @Override public boolean isEmpty() { if( readMap==null )return true; return readMap.isEmpty(); } /** * Проверяет наличие ключа в карте * @param key ключ * @return true - есть в карте */ @Override public boolean containsKey(Object key) { if( readMap==null )return false; return readMap.containsKey(key); } /** * ПРоверяет наличие значения в карте * @param value значение * @return true - есть значение */ @Override public boolean containsValue(Object value) { if( readMap==null )return false; return readMap.containsValue(value); } /** * Возвращает значение по ключу * @param key ключ * @return значение */ @Override public V get(Object key) { if( readMap==null )return null; return readMap.get(key); } /** * Устанавливает ключ/значение * @param key ключ * @param value значние * @return предыдущее (последнее) значение */ @Override public V put(K key, V value) { V r = null; if( writeMaps!=null ){ for( Map<K,V> m : writeMaps ){ if( m!=null ){ r = m.put(key, value); } } } return r; } /** * Удаляет ключ/значение * @param key ключ * @return предыдущее значение */ @Override public V remove(Object key) { V r = null; if( writeMaps!=null ){ for( Map<K,V> m : writeMaps ){ if( m!=null ){ r = m.remove(key); } } } return r; } /** * Добавляет значения * @param ms значения */ @Override public void putAll(Map<? extends K, ? extends V> ms) { if( writeMaps!=null ){ for( Map<K,V> m : writeMaps ){ if( m!=null ){ m.putAll(ms); } } } } /** * Удялет все значения */ @Override public void clear() { if( writeMaps!=null ){ for( Map<K,V> m : writeMaps ){ if( m!=null ){ m.clear(); } } } } /** * Возвращает все ключи карты * @return ключи */ @Override public Set<K> keySet() { if( readMap==null )return new HashSet<K>(); return readMap.keySet(); } /** * Возвращает значения карты * @return значения */ @Override public Collection<V> values() { if( readMap==null )return new HashSet<V>(); return readMap.values(); } /** * Возвращает пары ключ/значние * @return пары ключ/значние */ @Override public Set<Entry<K, V>> entrySet() { if( readMap==null )return new HashSet<Entry<K, V>>(); return readMap.entrySet(); } }
[ "nt.gocha@gmail.com" ]
nt.gocha@gmail.com
833de32db82c5cd5597885efd81dbaeb94c21423
f2f0e98d242baf79fda5778328ae40a583582bdb
/400_xowa/src/gplx/xowa/xtns/mapSources/Map_math.java
85712a45c127a30e125172c7e67a7684d5434d31
[]
no_license
ATCARES/xowa
0ca09f7aa08f400713f9d298bc9843b96e000a0c
5957bd0cb0de1dbfafae1aef9055846713a5e521
refs/heads/master
2021-01-15T14:41:57.565426
2014-04-14T03:28:27
2014-04-14T03:28:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,151
java
/* XOWA: the XOWA Offline Wiki Application Copyright (C) 2012 gnosygnu@gmail.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package gplx.xowa.xtns.mapSources; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import org.junit.*; class Map_math {// REF.MW:MapSources_math.php private int word_idx_nsew; private double[] rv = new double[4]; private byte dir_id; private int prec; private int step; public double Dec() {return dec;} private double dec; public int Error() {return error;} private int error; public double Coord_dec() {return coord_dec;} private double coord_dec; public double Coord_deg() {return coord_deg;} private double coord_deg; public double Coord_min() {return coord_min;} private double coord_min; public double Coord_sec() {return coord_sec;} private double coord_sec; public byte[] Coord_dir_ns() {return coord_dir_ns;} private byte[] coord_dir_ns; public byte[] Coord_dir_ew() {return coord_dir_ew;} private byte[] coord_dir_ew; public boolean Ctor(byte[] input, int prec, byte[] dir, int until_step) { try { New_coord(input, dir, prec); if (until_step > 1 && error == 0) Set_coord(); } catch (Exception e) { Err_.Noop(e); error = -128; } return error == 0; } public void Fail(Xop_ctx ctx, byte[] src, Xot_invk self, ByteAryBfr bfr, byte[] pfunc_name) { byte[] self_src = ByteAry_.Mid(src, self.Src_bgn(), self.Src_end()); if (error != -1) // -1 indicates empty coord; don't log, b/c it.v: often omits; it.v:Sami; DATE:2014-03-02 ctx.App().Usr_dlg().Warn_many("", "", "mapSources failed: page=~{0} src=~{1} err=~{2}", String_.new_utf8_(ctx.Page().Ttl().Full_db()), String_.new_utf8_(self_src), error); bfr.Add(pfunc_name).Add(Bry_failed); return; } private static final byte[] Bry_failed = ByteAry_.new_ascii_(" failed."); private void New_coord(byte[] input, byte[] dir, int prec) { // REF.MW:newCoord this.error = 0; this.word_idx_nsew = -1; coord_dec = coord_deg = coord_min = coord_sec = 0; rv[0] = rv[1] = rv[2] = 0; rv[3] = 1; this.dir_id = Parse_dir(dir); this.prec = Parse_precision(prec); this.dec = 0; this.step = 0; Parse_input(input); } private void Set_coord() { // REF.MW:setCoord if (step > 1) return; if (prec < 9) dec = Math_.Round(dec, prec); int sign = dec < 0 ? -1 : 1; double angle = Math_.Abs_double(dec); double deg = Math_.Floor(angle); double min = (angle - deg) * 60; double sec = prec > 0 ? Math_.Round((min - Math_.Floor(min)) * 60, prec - 4) : Math_.Round((min - Math_.Floor(min)) * 60, 0) ; min = Math_.Floor(min); if (sec >= 60) { sec -= 60; min++; } if (prec < 3 && sec >= 30) min++; if (prec < 3) sec = 0; if (min >= 60) { min -= 60; deg++; } if (prec < 1 && min >= 30) { deg++; } if (prec < 1) min = 0; coord_dec = Math_.Round(dec, prec); coord_deg = deg * sign; coord_min = min; coord_sec = sec; if (sign > 0) { coord_dir_ns = Compass_N; coord_dir_ew = Compass_E; } else { coord_dir_ns = Compass_S; coord_dir_ew = Compass_W; } step = 2; } private static final byte[] Bry_deg = ByteAry_.new_utf8_("°"), Bry_quot = ByteAry_.new_ascii_("&quot;"); public byte[] Get_dms(byte[] plus, byte[] minus) { // REF.MW: getDMSString if (step < 2) Set_coord(); double deg = coord_deg; if ( dec < 0 && (ByteAry_.Len_gt_0(plus) || ByteAry_.Len_gt_0(minus))) { deg = Math_.Abs_double(deg); } tmp_bfr.Add_double(deg).Add(Bry_deg); if (prec > 0) tmp_bfr.Add_byte_space().Add_double(coord_min).Add_byte(Byte_ascii.Apos); if (prec > 2) tmp_bfr.Add_byte_space().Add_double(coord_sec).Add(Bry_quot); byte[] letter = null; if (dir_id == Dir_lat_id) letter = coord_dir_ns; if (dir_id == Dir_long_id) letter = coord_dir_ew; if (dec > 0 && ByteAry_.Len_gt_0(plus)) letter = plus; if (dec < 0 && ByteAry_.Len_gt_0(minus)) letter = minus; if (letter != null) tmp_bfr.Add_byte_space().Add(letter); return tmp_bfr.XtoAryAndClear(); } private void Parse_input(byte[] src) { // REF.MW: toDec src = Parse_input_normalize(tmp_bfr, src); if (src == null) {error = -1; return;} int src_len = src.length; int word_idx = -1, word_bgn = 0, words_len = 0; int i = 0; while (true) { boolean is_last = i == src_len; byte b = is_last ? Byte_ascii.Space : src[i]; switch (b) { case Byte_ascii.Space: Parse_input_word(rv, src, ++word_idx, word_bgn, i); ++words_len; i = Byte_ary_finder.Find_fwd_while_space_or_tab(src, i, src_len); word_bgn = i; break; } if (is_last) break; i++; } if (word_idx_nsew != -1 && word_idx_nsew != words_len - 1) {error = -10; return;} if (words_len < 1 || words_len > 4) {error = -2; return;} if (rv[0] >= 0) dec = (rv[0] + rv[1] / 60 + rv[2] / 3600 ) * rv[3]; else dec = (rv[0] - rv[1] / 60 - rv[2] / 3600 ) * rv[3]; this.step = 1; } private boolean Parse_input_word_is_compass(byte v) { switch (v) { case Byte_ascii.Ltr_N: case Byte_ascii.Ltr_E: case Byte_ascii.Ltr_S: case Byte_ascii.Ltr_W: return true; default: return false; } } private void Parse_input_word(double[] rv, byte[] input, int word_idx, int word_bgn, int word_end) { if (word_idx >= Input_units_len) return; byte unit_dlm = Input_units[word_idx]; int pos = Byte_ary_finder.Find_fwd(input, unit_dlm, word_bgn, word_end); if (pos != ByteAry_.NotFound) // remove dlms from end of bry; EX: "123'" -> "123" word_end = pos; if (!Parse_input_word_is_compass(input[word_bgn])) { // if ( is_numeric( $v ) ) { double word_val = ByteAry_.XtoDoubleByPosOr(input, word_bgn, word_end, Double_.NaN); if (word_val != Double_.NaN) { if (word_idx > 2) {error = -4; return;} switch (word_idx) { case 0: if (word_val <= -180 || word_val > 180) {error = -5; return;} rv[0] = word_val; break; case 1: if (word_val < 0 || word_val >= 60) {error = -6; return;} if (rv[0] != (int)(rv[0])) {error = -7; return;} rv[1] = word_val; break; case 2: if (word_val < 0 || word_val >= 60) {error = -8; return;} if (rv[1] != (int)(rv[1])) {error = -9; return;} rv[2] = word_val; break; } } else {error = -3; return;} } else { // 'NSEW' word_idx_nsew = word_idx; byte word_byte = input[word_bgn]; if (rv[0] < 0) {error = -11; return;} if (word_end - word_bgn != 1) {error = -3; return;} switch (dir_id) { case Dir_long_id: if (word_byte == Byte_ascii.Ltr_N || word_byte == Byte_ascii.Ltr_S) {error = -12; return;} break; case Dir_lat_id: if (word_byte == Byte_ascii.Ltr_E || word_byte == Byte_ascii.Ltr_W) {error = -12; return;} break; case Dir_unknown_id: if (word_byte == Byte_ascii.Ltr_N || word_byte == Byte_ascii.Ltr_S) this.dir_id = Dir_lat_id; else this.dir_id = Dir_long_id; break; } if (this.dir_id == Dir_lat_id) { double rv_0 = rv[0]; if (rv_0 < -90 || rv_0 > 90) {error = -13; return;} } if (word_byte == Byte_ascii.Ltr_S || word_byte == Byte_ascii.Ltr_W) rv[3] = -1; } } private static byte Parse_dir(byte[] dir) { if (ByteAry_.Len_eq_0(dir)) return Dir_unknown_id; Object dir_obj = Dir_trie.MatchAtCur(dir, 0, dir.length); return dir_obj == null ? Dir_unknown_id : ((ByteVal)dir_obj).Val(); } private static int Parse_precision(int val) { // REF.MW: MapSourcesMath.php|newCoord if (val > -1 && val < 10) return val; else if (val == -1) return 9; else return 4; } private ByteAryBfr tmp_bfr = ByteAryBfr.reset_(32); private static byte[] Parse_input_normalize(ByteAryBfr bfr, byte[] input) { int input_end = input.length; if (input_end == 0) return null; int i = 0; while (i < input_end) { byte b = input[i]; Object o = Input_trie.Match(b, input, i, input_end); if (o == null) { bfr.Add_byte(b); ++i; } else { byte tid = ((ByteVal)o).Val(); switch (tid) { case Input_tid_apos: bfr.Add_byte(Byte_ascii.Apos).Add_byte_space(); break; // EX: "'" -> "' " case Input_tid_quote: bfr.Add_byte(Byte_ascii.Quote).Add_byte_space(); break; // EX: '"' -> '" ' case Input_tid_dash: bfr.Add_byte(Byte_ascii.Dash); break; case Input_tid_space: bfr.Add_byte_space(); break; case Input_tid_degree: bfr.Add_byte(Byte_ascii.Slash); bfr.Add_byte_space(); break; // EX: "°" -> "° " case Input_tid_compass: bfr.Add_byte_space(); bfr.Add_byte(Byte_ascii.Case_upper(b)); break; // NOTE: always single-char ASCII; EX: N,E,S,W,n,e,s,w } i = Input_trie.Match_pos(); } } return bfr.XtoAryAndClearAndTrim(); } private static final byte Dir_unknown_id = 0, Dir_lat_id = 1, Dir_long_id = 2; public static final byte[] Dir_lat_bry = ByteAry_.new_ascii_("lat"), Dir_long_bry = ByteAry_.new_ascii_("long"); private static final ByteTrieMgr_slim Dir_trie = ByteTrieMgr_slim.ci_() .Add_bry_bval(Dir_lat_bry , Dir_lat_id) .Add_bry_bval(Dir_long_bry , Dir_long_id) ; private static final byte[] Compass_N = new byte[] {Byte_ascii.Ltr_N} , Compass_E = new byte[] {Byte_ascii.Ltr_E} , Compass_S = new byte[] {Byte_ascii.Ltr_S} , Compass_W = new byte[] {Byte_ascii.Ltr_W} ; private static final byte Input_tid_apos = 1, Input_tid_quote = 2, Input_tid_dash = 3, Input_tid_space = 4, Input_tid_degree = 5, Input_tid_compass = 6; private static final byte Input_byte_degree = Byte_ascii.Slash; // NOTE: ugly cheat to avoid using multi-byte char; note that all "/" are swapped out to " ", so any remaining "/" was added by the normalizer; EX: "123° 4/5" -> "123/ 4 5" private static final byte[] Input_units = new byte[] {Input_byte_degree, Byte_ascii.Apos, Byte_ascii.Quote, Byte_ascii.Space}; private static final int Input_units_len = Input_units.length; private static final byte[] Input_bry_degree = ByteAry_.new_utf8_("°"); private static final ByteTrieMgr_slim Input_trie = ByteTrieMgr_slim.cs_() .Add_str_byte("'" , Input_tid_apos) // NOTE: must add ' so that "'" -> "' " .Add_str_byte("‘" , Input_tid_apos) .Add_str_byte("’" , Input_tid_apos) .Add_str_byte("′" , Input_tid_apos) .Add_str_byte("\"" , Input_tid_quote) // NOTE: must add " so that '"' -> '" ' .Add_str_byte("''" , Input_tid_quote) .Add_str_byte("“" , Input_tid_quote) .Add_str_byte("”" , Input_tid_quote) .Add_str_byte("″" , Input_tid_quote) .Add_str_byte("-" , Input_tid_dash) .Add_str_byte("−" , Input_tid_dash) .Add_str_byte(" " , Input_tid_space) .Add_str_byte("_" , Input_tid_space) .Add_str_byte("/" , Input_tid_space) .Add_str_byte("\t" , Input_tid_space) .Add_str_byte("\n" , Input_tid_space) .Add_str_byte("\r" , Input_tid_space) .Add_bry_bval(Input_bry_degree , Input_tid_degree) .Add_str_byte("N" , Input_tid_compass) .Add_str_byte("S" , Input_tid_compass) .Add_str_byte("E" , Input_tid_compass) .Add_str_byte("W" , Input_tid_compass) .Add_str_byte("n" , Input_tid_compass) .Add_str_byte("s" , Input_tid_compass) .Add_str_byte("e" , Input_tid_compass) .Add_str_byte("w" , Input_tid_compass) ; public static final Map_math _ = new Map_math(); }
[ "gnosygnu@gmail.com" ]
gnosygnu@gmail.com
70d81e89195ec6ad5edcfc1e919f18146de18f59
7dff6c11ca1d7b5fadf3eaff1ae865805ef5a14d
/Flyweight/app/src/main/java/demo/dhcc/com/flyweight/simple2/ConcreteFlyweight.java
7d35f10892420a229d41f8355e786adc4ba444c3
[]
no_license
heyangJob/Design-Pattern
85a1fc0ff7058db875ceaf065e1b803ed6227a1c
a7849247139a2a00103333d56de76783ab1fabbb
refs/heads/master
2020-03-23T12:01:08.143480
2018-08-22T09:21:50
2018-08-22T09:21:50
141,531,909
4
0
null
null
null
null
UTF-8
Java
false
false
589
java
package demo.dhcc.com.flyweight.simple2; /** * 享元角色的实现类 * * @author 512573717@qq.com * @created 2018/8/6 下午3:50. */ public class ConcreteFlyweight implements Flyweight { private String intrinsicState = null; public ConcreteFlyweight(String intrinsicState) { this.intrinsicState = intrinsicState; } @Override public void operation(String state) { // 内部状态 System.out.println("Intrinsic State = " + this.intrinsicState); // 外部状态 System.out.println("Extrinsic State = " + state); } }
[ "512573717@qq.com" ]
512573717@qq.com
a0d8e0d3706162aad9ec319bc4516970aa55d674
a3742532e43ebf8ae09c2036dc817759fad5a6b4
/src/main/java/tests/maptests/primitive/HftcUpdateableMapTest.java
3b0071ddc6a9921141239bc8d726696b85e231a5
[]
no_license
zhudebin/maptest
2b98a50cdd21481b235f66a3d44294ea87efb2ea
5588e9c4e398cd1ae56cc326842bfd2b0e4e2b34
refs/heads/master
2021-01-17T05:50:47.743692
2016-06-03T06:36:48
2016-06-03T06:36:48
60,315,088
0
0
null
null
null
null
UTF-8
Java
false
false
814
java
package tests.maptests.primitive; import net.openhft.koloboke.collect.map.hash.HashIntIntMap; import net.openhft.koloboke.collect.map.hash.HashIntIntMaps; /** * Koloboke HashIntIntMaps.newImmutableMap test */ public class HftcUpdateableMapTest extends AbstractPrimPrimMapTest { private HashIntIntMap m_map; @Override public void setup(final int[] keys, float fillFactor) { super.setup( keys, fillFactor ); final HashIntIntMap map = HashIntIntMaps.newMutableMap(keys.length); for (int key : keys) map.put(key, key); m_map = HashIntIntMaps.newUpdatableMap( map ); } @Override public int runRandomTest() { int res = 0; for ( int i = 0; i < m_keys.length; ++i ) res = res ^ m_map.get( m_keys[ i ] ); return res; } }
[ "zdb_hn@163.com" ]
zdb_hn@163.com
96c89bb5c88cb32c9d296d8e603773942e192603
665110e99befea67ea7dcdd6939e313cff471654
/src/main/java/net/smert/frameworkgl/opengl/renderer/RendererGL3.java
1ffb76cfa1f212a3ac0cbb2829f33a4977abe0b5
[ "Apache-2.0" ]
permissive
kovertopz/Framework-GL
187cd6771c5ed0192da3564a22c6281956bb2ce2
1504f4746c80bf0667f62ecea2569f8d37a46184
refs/heads/master
2021-06-07T08:22:46.693230
2017-07-08T09:10:17
2017-07-08T09:10:17
24,876,706
10
1
null
null
null
null
UTF-8
Java
false
false
8,754
java
/** * Copyright 2012 Jason Sorensen (sorensenj@smert.net) * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package net.smert.frameworkgl.opengl.renderer; import java.util.List; import net.smert.frameworkgl.Fw; import net.smert.frameworkgl.gameobjects.GameObject; import net.smert.frameworkgl.math.Transform4f; import net.smert.frameworkgl.math.Vector2f; import net.smert.frameworkgl.math.Vector3f; import net.smert.frameworkgl.opengl.GL; import net.smert.frameworkgl.opengl.camera.Camera; import net.smert.frameworkgl.opengl.renderable.AbstractRenderable; import net.smert.frameworkgl.opengl.renderable.Renderable; import net.smert.frameworkgl.opengl.renderable.gl3.DynamicVertexArrayObjectInterleavedGL3Renderable; import net.smert.frameworkgl.opengl.renderable.gl3.DynamicVertexArrayObjectNonInterleavedGL3Renderable; import net.smert.frameworkgl.opengl.renderable.gl3.VertexArrayObjectInterleavedGL3Renderable; import net.smert.frameworkgl.opengl.renderable.gl3.VertexArrayObjectNonInterleavedGL3Renderable; import net.smert.frameworkgl.opengl.shader.AbstractShader; import net.smert.frameworkgl.utils.Color; /** * * @author Jason Sorensen <sorensenj@smert.net> */ public class RendererGL3 extends AbstractRendererGL { public RendererGL3() { super(); } public AbstractRenderable createArrayRenderable() { return GL.rf3.createArrayRenderable(); } public AbstractRenderable createDisplayListRenderable() { return GL.rf3.createDisplayListRenderable(); } public DynamicVertexArrayObjectInterleavedGL3Renderable createDynamicInterleavedRenderable() { return GL.rf3.createDynamicInterleavedRenderable(); } public DynamicVertexArrayObjectNonInterleavedGL3Renderable createDynamicNonInterleavedRenderable() { return GL.rf3.createDynamicNonInterleavedRenderable(); } public AbstractRenderable createImmediateModeRenderable() { return GL.rf3.createImmediateModeRenderable(); } public VertexArrayObjectInterleavedGL3Renderable createInterleavedRenderable() { return GL.rf3.createInterleavedRenderable(); } public VertexArrayObjectNonInterleavedGL3Renderable createNonInterleavedRenderable() { return GL.rf3.createNonInterleavedRenderable(); } public void destroy() { } public void init() { } @Override public void color(float r, float g, float b, float a) { GL.o2.vertexAttrib(GL.defaultAttribLocations.getIndex("color"), r, g, b, a); } @Override public void disableTexture2D() { } @Override public void disableTexture3D() { } @Override public void disableTextureCubeMap() { } @Override public void enableTexture2D() { } @Override public void enableTexture3D() { } @Override public void enableTextureCubeMap() { } @Override public void popMatrix() { GL.matrixHelper.setModeModel(); GL.matrixHelper.pop(); } @Override public void pushMatrix() { GL.matrixHelper.setModeModel(); GL.matrixHelper.push(); } @Override public void render(AbstractRenderable renderable) { Renderable.shaderBindState.sendUniformMatrices(); renderable.render(); } @Override public void render(AbstractRenderable renderable, float x, float y, float z) { pushMatrix(); translate(x, y, z); render(renderable); popMatrix(); } @Override public void render(AbstractRenderable renderable, Transform4f transform) { pushMatrix(); GL.matrixHelper.load(transform); render(renderable); popMatrix(); } @Override public void render(AbstractRenderable renderable, Vector3f position) { pushMatrix(); translate(position); render(renderable); popMatrix(); } @Override public void render(GameObject gameObject) { pushMatrix(); GL.matrixHelper.load(gameObject.getWorldTransform()); Renderable.shaderBindState.sendUniformsOncePerGameObject(gameObject); render(gameObject.getRenderable()); popMatrix(); } @Override public void render(List<GameObject> gameObjects) { for (GameObject gameObject : gameObjects) { render(gameObject); } } @Override public void renderBlend(GameObject gameObject) { if (gameObject.getRenderableState().isOpaque()) { return; } GL.o1.enableBlending(); render(gameObject); GL.o1.disableBlending(); } @Override public void renderBlend(List<GameObject> gameObjects) { GL.o1.enableBlending(); for (GameObject gameObject : gameObjects) { if (gameObject.getRenderableState().isOpaque()) { continue; } render(gameObject); } GL.o1.disableBlending(); } @Override public void renderOpaque(GameObject gameObject) { if (!gameObject.getRenderableState().isOpaque()) { return; } render(gameObject); } @Override public void renderOpaque(List<GameObject> gameObjects) { for (GameObject gameObject : gameObjects) { if (!gameObject.getRenderableState().isOpaque()) { continue; } render(gameObject); } } @Override public void scale(float x, float y, float z) { GL.matrixHelper.setModeModel(); GL.matrixHelper.scale(x, y, z); } @Override public void scale(Vector3f scaling) { GL.matrixHelper.setModeModel(); GL.matrixHelper.scale(scaling.getX(), scaling.getY(), scaling.getZ()); } @Override public void set2DMode() { GL.matrixHelper.setModeProjection(); GL.matrixHelper.setOrthogonal(0f, Fw.config.getCurrentWidth(), 0f, Fw.config.getCurrentHeight(), -1f, 1f); GL.matrixHelper.setModeView(); GL.matrixHelper.loadIdentity(); GL.matrixHelper.setModeModel(); GL.matrixHelper.loadIdentity(); } @Override public void set2DMode(int width, int height) { GL.matrixHelper.setModeProjection(); GL.matrixHelper.setOrthogonal(0f, width, 0f, height, -1f, 1f); GL.matrixHelper.setModeView(); GL.matrixHelper.loadIdentity(); GL.matrixHelper.setModeModel(); GL.matrixHelper.loadIdentity(); } @Override public void setCamera(Camera camera) { camera.update(); GL.matrixHelper.setModeProjection(); GL.matrixHelper.load(camera.getProjectionMatrix()); GL.matrixHelper.setModeView(); GL.matrixHelper.load(camera.getViewMatrix()); GL.matrixHelper.setModeModel(); GL.matrixHelper.loadIdentity(); } @Override public void switchShader(AbstractShader shader) { Renderable.shaderBindState.switchShader(shader); } @Override public void translate(float x, float y, float z) { GL.matrixHelper.setModeModel(); GL.matrixHelper.translate(x, y, z); } @Override public void translate(Vector3f position) { GL.matrixHelper.setModeModel(); GL.matrixHelper.translate(position.getX(), position.getY(), position.getZ()); } @Override public void unbindShader() { Renderable.shaderBindState.unbindShader(); } @Override public void colorText(Color color) { color(color.getR(), color.getG(), color.getB(), color.getA()); } @Override public AbstractRenderable createGlyphRenderable() { return createInterleavedRenderable(); } @Override public float getTextDefaultX() { return textDefaultX; } @Override public float getTextDefaultY() { return textDefaultY; } @Override public Vector2f getTextPosition() { return textPosition; } @Override public void renderGlyph(AbstractRenderable renderable) { render(renderable); } @Override public void scaleText(float x, float y) { scale(x, y, 1f); } @Override public void translateText(float x, float y) { translate(x, y, 0f); } }
[ "git@smert.net" ]
git@smert.net
eda5eb3b022aaca023a5c27f40149b54efed37b3
866e04d6eccb39f21f83e8e7399b128931090b91
/lunch/src/main/java/com/example/recipe/lunch/LunchRecipeApplication.java
43e6028e1768f42d6b03e630e02800696b0d8b68
[]
no_license
chathuran/lunch-app
1fa169cd5cced7c2f847086026de79c161979587
b33dec876a91cd1af84c60a326ea34c553153428
refs/heads/master
2022-12-19T12:26:12.147965
2020-09-28T15:17:43
2020-09-28T15:17:43
298,964,269
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package com.example.recipe.lunch; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class LunchRecipeApplication { public static void main(String[] args) { SpringApplication.run(LunchRecipeApplication.class, args); } }
[ "071@erangaDC" ]
071@erangaDC
1eb15406f7d64a2c6e802d1ba5db455e21488087
9452e1992b36fac0414de9856cefa67f95e984de
/sacamos-server/src/main/java/main.java
997199a0eb926073cc52daf40233e3ce71a64e0d
[]
no_license
randyquaye/randyquaye
81a899c0735b82f63b3d9f91694116f8fa2dfd85
258be6d776d5bc3a1d76028daecd2b4cd59b0a1b
refs/heads/main
2023-05-18T11:33:15.485728
2021-06-09T22:05:07
2021-06-09T22:05:07
352,344,688
0
0
null
null
null
null
UTF-8
Java
false
false
9,198
java
import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.storage.Blob; import com.google.cloud.storage.Bucket; import com.google.firebase.FirebaseApp; import com.google.firebase.FirebaseOptions; import com.google.firebase.cloud.StorageClient; import com.google.firebase.database.*; import java.io.*; import java.util.ArrayList; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import static org.apache.http.protocol.HTTP.UTF_8; public class main { public static void main(String[] args) { try { FileInputStream serviceAccount; serviceAccount = new FileInputStream("C:\\Users\\Randy Quaye\\IdeaProjects\\sacamos-server\\src\\serviceAccountKey.json"); FirebaseOptions options = new FirebaseOptions.Builder() .setCredentials(GoogleCredentials.fromStream(serviceAccount)) .setDatabaseUrl("https://finalyear-7d906.firebaseio.com") .setStorageBucket("finalyear-7d906.appspot.com") .build(); FirebaseApp.initializeApp(options); } catch (IOException ex) { Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex); System.exit(1); } // As an admin, the app has access to read and write all data, regardless of Security Rules DatabaseReference database = FirebaseDatabase.getInstance().getReference(); //Start Listeners cableListener(database); bundleListener(database); Scanner scanner = new Scanner(System.in); while (!scanner.nextLine().equals("Quit")) {} } /**************CABLE PROCESSING*******************/ public static void cableListener(DatabaseReference database){ DatabaseReference cablesRef = database.child("Cyl_cables"); // Attach a listener to read and process the data at our cables reference cablesRef.orderByChild("status").equalTo(1).addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot snapshot, String previousChildName) { CylindricalCable c = snapshot.child("cable_spec").getValue(CylindricalCable.class); System.out.println(c.getName()); c.setID(snapshot.getKey()); writeCableSpecFile(c); cablesRef.child(c.getID()).child("status").setValueAsync(buildCable(c.getID())); } @Override public void onChildChanged(DataSnapshot snapshot, String previousChildName) { } @Override public void onChildRemoved(DataSnapshot snapshot) { } @Override public void onChildMoved(DataSnapshot snapshot, String previousChildName) { } @Override public void onCancelled(DatabaseError error) { } }); } public static void writeCableSpecFile(CylindricalCable c) { //TODO : Sort out the params and remove default zeros from Ao and Bo String spec_data = "# MOD_cable_lib_dir \r\n" + "../MOD/CABLE/\r\n" + "Cylindrical\r\n" + "1 #number of conductors \r\n" + "3 #number of parameters \r\n" + String.valueOf(c.getC_Radius()) + " # parameter 1: conductor radius\r\n" + String.valueOf(c.getD_Radius()) + " # parameter 2: dielectric radius\r\n" + String.valueOf(c.getC_conductivity()) + " # parameter 3: conductivity\r\n" + "1 \t\t\t# number of frequency dependent parameters\r\n" + "# Dielectric relative permittivity model follows\r\n" + String.valueOf(c.getNormalisation()) + " # w normalisation constant\r\n" + 0 + " # a order, a coefficients follow below\r\n" + String.valueOf(c.getAc()) + "\r\n" + 0 + " # b order, b coefficients follow below\r\n" + String.valueOf(c.getBc()); //Create file; String file_path = "C:/Users/Randy Quaye/Documents/SACAMOS/MOD/CABLE/"; String file = file_path + c.getID() + ".cable_spec"; try { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.write(spec_data); writer.close(); } catch (IOException e) { e.printStackTrace(); } } public static int buildCable(String filename) { String filepath = "\""+"C:\\Users\\Randy Quaye\\Documents\\SACAMOS\\MOD\\CABLE\\"+ filename + "\""; String cmd1 = "cd C:/Users/Randy Quaye/Documents/SACAMOS/BIN"; String cmd2 = "cable_model_builder.exe "+filepath; ProcessBuilder builder = new ProcessBuilder( "cmd.exe", "/c", cmd1 + "&& "+cmd2); builder.redirectErrorStream(true); Process p = null; try { p = builder.start(); BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream())); String line,strLine=""; while ((line = r.readLine()) != null) strLine = line; if(strLine.equals("cable_model_builder:Finished_Correctly")){ //Write cable status to 4 return 4; } else{ return -1;} } catch (IOException e) { e.printStackTrace(); return -1; } } /**************BUNDLE PROCESSING*******************/ public static void bundleListener(DatabaseReference database){ DatabaseReference bundleRef = database.child("Bundles"); bundleRef.orderByChild("status").equalTo(1).addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot snapshot, String previousChildName) { Bundle b = snapshot.child("bundle_spec").getValue(Bundle.class); System.out.println(b.getBundleName()); b.setBundleID(snapshot.getKey()); writeBundleSpecFile(b); bundleRef.child(b.getBundleID()).child("status").setValueAsync(buildBundle(b.getBundleID())); } @Override public void onChildChanged(DataSnapshot snapshot, String previousChildName) { } @Override public void onChildRemoved(DataSnapshot snapshot) { } @Override public void onChildMoved(DataSnapshot snapshot, String previousChildName) { } @Override public void onCancelled(DatabaseError error) { } }); } public static void writeBundleSpecFile(Bundle b){ String data = "#MOD_cable_lib_dir\r\n" + "../MOD/CABLE/\r\n" + "#MOD_cable_lib_dir\r\n" + "../MOD/BUNDLE/\r\n" + b.getNumber_of_params() +" #Number of cables in bundle, cable list follows\r\n"; ArrayList<BundleComponent> bC = b.getComponents(); for(int i = 0;i<b.getNumber_of_params();i++){ data = data + bC.get(i).getCableID()+"\r\n" + bC.get(i).getX_param()+"\t"+ bC.get(i).getY_param()+"\t"+ bC.get(i).getRot_param()+"\r\n"; } data = data +"no_ground_plane\r\n"+ "no_laplace"; //Create file; String file_path = "C:/Users/Randy Quaye/Documents/SACAMOS/MOD/BUNDLE/"; String file = file_path + b.getBundleID() + ".bundle_spec"; try { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.write(data); writer.close(); } catch (IOException e) { e.printStackTrace(); } } public static int buildBundle(String filename) { String filepath = "\""+"C:\\Users\\Randy Quaye\\Documents\\SACAMOS\\MOD\\BUNDLE\\"+ filename + "\""; String cmd1 = "cd C:/Users/Randy Quaye/Documents/SACAMOS/BIN"; String cmd2 = "cable_bundle_model_builder.exe "+filepath; ProcessBuilder builder = new ProcessBuilder( "cmd.exe", "/c", cmd1 + "&& "+cmd2); builder.redirectErrorStream(true); Process p = null; try { p = builder.start(); BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream())); String line,strLine=""; while ((line = r.readLine()) != null) strLine = line; if(strLine.equals("cable_bundle_model_builder:Finished_Correctly")){ //Write cable status to 4 return 4; } else{ return -1;} } catch (IOException e) { e.printStackTrace(); return -1; } } }
[ "randyquaye@Randys-MacBook-Pro.local" ]
randyquaye@Randys-MacBook-Pro.local
2ea3c39a66aca59c33ab7b72916de543d8092451
5bab3f49607b66c77457a49c9d395628d4f45ca3
/jibx/examples/codegen/gen/src/org/opentravel/ota/CancelInfoRSType.java
8ccd16a16351397f0369d53d58324d47dc80d576
[]
no_license
zwijze/journallines
8ee37a559b1c1fe2070fa14b56e3957396a83a5e
973ab3228740b7e810af5f746da7abf556abaaaa
refs/heads/master
2020-04-06T07:53:20.251060
2016-08-29T19:38:29
2016-08-29T19:38:29
65,633,068
0
0
null
null
null
null
UTF-8
Java
false
false
2,643
java
package org.opentravel.ota; import java.util.ArrayList; import java.util.List; /** * May contain rules associated with canceling a reservation as well as the supplier's cancellation number. * * Schema fragment(s) for this class: * <pre> * &lt;xs:complexType xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="CancelInfoRSType"> * &lt;xs:sequence> * &lt;xs:element name="CancelRules" minOccurs="0"> * &lt;!-- Reference to inner class CancelRules --> * &lt;/xs:element> * &lt;xs:element type="ns:UniqueID_Type" name="UniqueID" minOccurs="0"/> * &lt;/xs:sequence> * &lt;/xs:complexType> * </pre> */ public class CancelInfoRSType { private CancelRules cancelRules; private UniqueIDType uniqueID; /** * Get the 'CancelRules' element value. * * @return value */ public CancelRules getCancelRules() { return cancelRules; } /** * Set the 'CancelRules' element value. * * @param cancelRules */ public void setCancelRules(CancelRules cancelRules) { this.cancelRules = cancelRules; } /** * Get the 'UniqueID' element value. Contains the supplier's cancellation number. * * @return value */ public UniqueIDType getUniqueID() { return uniqueID; } /** * Set the 'UniqueID' element value. Contains the supplier's cancellation number. * * @param uniqueID */ public void setUniqueID(UniqueIDType uniqueID) { this.uniqueID = uniqueID; } /** * Schema fragment(s) for this class: * <pre> * &lt;xs:element xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="CancelRules" minOccurs="0"> * &lt;xs:complexType> * &lt;xs:sequence> * &lt;xs:element type="ns:CancelRuleType" name="CancelRule" maxOccurs="unbounded"/> * &lt;/xs:sequence> * &lt;/xs:complexType> * &lt;/xs:element> * </pre> */ public static class CancelRules { private List<CancelRuleType> cancelRuleList = new ArrayList<CancelRuleType>(); /** * Get the list of 'CancelRule' element items. * * @return list */ public List<CancelRuleType> getCancelRuleList() { return cancelRuleList; } /** * Set the list of 'CancelRule' element items. * * @param list */ public void setCancelRuleList(List<CancelRuleType> list) { cancelRuleList = list; } } }
[ "frank.zwijze@gmail.com" ]
frank.zwijze@gmail.com
975f723bdbe59b219bad977a917e465fe6333281
7216e4d3e4522b9fe0148fc4c1560e4e79286357
/idp-authn-impl-socialuser/src/test/java/fi/okm/mpass/idp/authn/impl/ExtractSocialPrincipalsFromSubjectTest.java
0f850c4bab07ff2420a756ab4303f2986b3591d7
[ "MIT" ]
permissive
haltu/eca-auth-proxy
a374c1ec530e36b924a46278959e4313ee65f3c3
31cdcd36b419d5067fe265399b2680e38bdb527a
refs/heads/master
2021-01-17T05:20:06.028510
2015-12-14T14:57:36
2015-12-14T14:57:36
48,229,777
0
1
null
null
null
null
UTF-8
Java
false
false
5,426
java
/* * The MIT License * Copyright (c) 2015 CSC - IT Center for Science, http://www.csc.fi * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package fi.okm.mpass.idp.authn.impl; import org.testng.Assert; import net.shibboleth.idp.authn.AuthnEventIds; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import net.shibboleth.idp.authn.context.AuthenticationContext; import net.shibboleth.idp.authn.context.ExternalAuthenticationContext; import net.shibboleth.idp.authn.impl.PopulateAuthenticationContextTest; import javax.security.auth.Subject; import org.springframework.webflow.execution.Event; import net.shibboleth.idp.profile.ActionTestingSupport; import net.shibboleth.utilities.java.support.component.ComponentInitializationException; import org.springframework.mock.web.MockHttpServletRequest; import fi.okm.mpass.idp.authn.context.SocialUserContext; import fi.okm.mpass.idp.authn.principal.SocialUserPrincipal; import fi.okm.mpass.idp.authn.principal.SocialUserPrincipal.Types; /** {@link ExtractSocialPrincipalsFromSubject} unit test. */ public class ExtractSocialPrincipalsFromSubjectTest extends PopulateAuthenticationContextTest { private ExtractSocialPrincipalsFromSubject action; @BeforeMethod public void setUp() throws Exception { super.setUp(); action = new ExtractSocialPrincipalsFromSubject(); } @Test public void testNoServlet() throws Exception { action.initialize(); final Event event = action.execute(src); ActionTestingSupport.assertEvent(event, AuthnEventIds.NO_CREDENTIALS); } @Test public void testIdentity() throws Exception { Subject subject = new Subject(); SocialUserPrincipal socialUserPrincipalProviderId = new SocialUserPrincipal( Types.providerId, "providerId"); subject.getPrincipals().add(socialUserPrincipalProviderId); SocialUserPrincipal socialUserPrincipalDisplayName = new SocialUserPrincipal( Types.displayName, "displayName"); subject.getPrincipals().add(socialUserPrincipalDisplayName); SocialUserPrincipal socialUserPrincipalEmail = new SocialUserPrincipal( Types.email, "email"); subject.getPrincipals().add(socialUserPrincipalEmail); SocialUserPrincipal socialUserPrincipalFirstName = new SocialUserPrincipal( Types.firstName, "firstName"); subject.getPrincipals().add(socialUserPrincipalFirstName); SocialUserPrincipal socialUserPrincipalLastName = new SocialUserPrincipal( Types.lastName, "lastName"); subject.getPrincipals().add(socialUserPrincipalLastName); SocialUserPrincipal socialUserPrincipalUserId = new SocialUserPrincipal( Types.userId, "userId"); subject.getPrincipals().add(socialUserPrincipalUserId); SocialUserPrincipal socialUserPrincipalUS = new SocialUserPrincipal( "unsupported", "unsupported"); subject.getPrincipals().add(socialUserPrincipalUS); SocialUserContext suCtx = initContexts(subject); Assert.assertNotNull(suCtx); Assert.assertEquals(suCtx.getProviderId(), "providerId"); Assert.assertEquals(suCtx.getDisplayName(), "displayName"); Assert.assertEquals(suCtx.getEmail(), "email"); Assert.assertEquals(suCtx.getFirstName(), "firstName"); Assert.assertEquals(suCtx.getLastName(), "lastName"); Assert.assertEquals(suCtx.getUserId(), "userId"); } private SocialUserContext initContexts(Subject subject) throws ComponentInitializationException { MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest(); action.setHttpServletRequest(mockHttpServletRequest); action.initialize(); final AuthenticationContext ac = prc.getSubcontext( AuthenticationContext.class, false); ExternalAuthenticationContext externalAuthenticationContext = new ExternalAuthenticationContext(); externalAuthenticationContext.setSubject(subject); ac.addSubcontext(externalAuthenticationContext); final Event event = action.execute(src); ActionTestingSupport.assertProceedEvent(event); return (SocialUserContext) ac.getSubcontext(SocialUserContext.class, false); } }
[ "janne.lauros@gmail.com" ]
janne.lauros@gmail.com
79f84cd14810ca1173599262e6307d953331daf5
9f3ef32725b29ce770af806f0c8312af0fa51b27
/src/main/java/com/gy/yb/Observer.java
bb5b1d9aaa8b82079be1f17d35660496108e5977
[]
no_license
SeekingPlumBlossoms/observer
8457a86d2b0f2ba776c9f55db4226783fb0032d1
b5827cb49e575cc65489a8860029367f058d040c
refs/heads/master
2020-03-25T04:33:00.845147
2018-08-04T01:20:33
2018-08-04T01:20:33
143,400,693
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
package com.gy.yb; public interface Observer { public void update(WeatherSubject weatherSubject); }
[ "17611281125@163.com" ]
17611281125@163.com
5075447ab477c5d1a867cc92dca7563b01083c6b
11833e305deb826dca0c55ca9a0e731fee8f76f7
/src/com/appbegin/MainService.java
1bf90dbf1d731927d0682470804d5fe4950dee3a
[]
no_license
RAGHAVNAIDU/MYTELE
f211c05c24e81785eac74d70e48422384f31f8fd
c0b422e76a303438be1487fbfeb3d6e2979092fa
refs/heads/master
2016-09-06T05:12:33.468393
2012-07-03T05:25:25
2012-07-03T05:25:25
38,572,696
0
0
null
null
null
null
UTF-8
Java
false
false
17,260
java
package com.appbegin; import java.io.IOException; import com.ibm.mqtt.IMqttClient; import com.ibm.mqtt.MqttClient; import com.ibm.mqtt.MqttException; import com.ibm.mqtt.MqttPersistence; import com.ibm.mqtt.MqttPersistenceException; import com.ibm.mqtt.MqttSimpleCallback; import android.app.AlarmManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.IBinder; import android.util.Log; /* * PushService that does all of the work. * Most of the logic is borrowed from KeepAliveService. * http://code.google.com/p/android-random/source/browse/trunk/TestKeepAlive/src/org/devtcg/demo/keepalive/KeepAliveService.java?r=219 */ public class MainService extends Service { // this is the log tag public static final String TAG = "MainPushService"; // the IP address, where your MQTT broker is running. private static final String MQTT_HOST = "push.appbegin.com"; // the port at which the broker is running. private static int MQTT_BROKER_PORT_NUM = 1883; // Let's not use the MQTT persistence. private static MqttPersistence MQTT_PERSISTENCE = null; // We don't need to remember any state between the connections, so we use a clean start. private static boolean MQTT_CLEAN_START = true; // Let's set the internal keep alive for MQTT to 15 mins. I haven't tested this value much. It could probably be increased. private static short MQTT_KEEP_ALIVE = 60 * 15; // Set quality of services to 0 (at most once delivery), since we don't want push notifications // arrive more than once. However, this means that some messages might get lost (delivery is not guaranteed) private static int[] MQTT_QUALITIES_OF_SERVICE = { 0 } ; private static int MQTT_QUALITY_OF_SERVICE = 0; // The broker should not retain any messages. private static boolean MQTT_RETAINED_PUBLISH = false; // MQTT client ID, which is given the broker. In this example, I also use this for the topic header. // You can use this to run push notifications for multiple apps with one MQTT broker. public static String MQTT_CLIENT_ID = "appbegin"; // These are the actions for the service (name are descriptive enough) private static final String ACTION_START = MQTT_CLIENT_ID + ".START"; private static final String ACTION_STOP = MQTT_CLIENT_ID + ".STOP"; private static final String ACTION_KEEPALIVE = MQTT_CLIENT_ID + ".KEEP_ALIVE"; private static final String ACTION_RECONNECT = MQTT_CLIENT_ID + ".RECONNECT"; // Connection log for the push service. Good for debugging. private ConnectionLog mLog; // Connectivity manager to determining, when the phone loses connection private ConnectivityManager mConnMan; // Notification manager to displaying arrived push notifications private NotificationManager mNotifMan; // Whether or not the service has been started. private boolean mStarted; // This the application level keep-alive interval, that is used by the AlarmManager // to keep the connection active, even when the device goes to sleep. private static final long KEEP_ALIVE_INTERVAL = 1000 * 60 * 28; // Retry intervals, when the connection is lost. private static final long INITIAL_RETRY_INTERVAL = 1000 * 10; private static final long MAXIMUM_RETRY_INTERVAL = 1000 * 60 * 30; // Preferences instance private SharedPreferences mPrefs; // We store in the preferences, whether or not the service has been started public static final String PREF_STARTED = "isStarted"; // We also store the deviceID (target) public static final String PREF_DEVICE_ID = "deviceID"; // We store the last retry interval public static final String PREF_RETRY = "retryInterval"; // Notification title public static String NOTIF_TITLE = "Appbegin Push Demo"; // Notification id private static final int NOTIF_CONNECTED = 0; // This is the instance of an MQTT connection. private MQTTConnection mConnection; private long mStartTime; public static String deviceID ; public static void setDeviceID(String id) { deviceID = id; } // Static method to start the service public static void actionStart(Context ctx) { Intent i = new Intent(ctx, MainService.class); i.setAction(ACTION_START); ctx.startService(i); } // Static method to stop the service public static void actionStop(Context ctx) { Intent i = new Intent(ctx, MainService.class); i.setAction(ACTION_STOP); ctx.startService(i); } // Static method to send a keep alive message public static void actionPing(Context ctx) { Intent i = new Intent(ctx, MainService.class); i.setAction(ACTION_KEEPALIVE); ctx.startService(i); } @Override public void onCreate() { super.onCreate(); log("Creating service"); mStartTime = System.currentTimeMillis(); try { mLog = new ConnectionLog(); Log.i(TAG, "Opened log at " + mLog.getPath()); } catch (IOException e) { Log.e(TAG, "Failed to open log", e); } // Get instances of preferences, connectivity manager and notification manager mPrefs = getSharedPreferences(TAG, MODE_PRIVATE); mConnMan = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE); mNotifMan = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); /* If our process was reaped by the system for any reason we need * to restore our state with merely a call to onCreate. We record * the last "started" value and restore it here if necessary. */ handleCrashedService(); } // This method does any necessary clean-up need in case the server has been destroyed by the system // and then restarted private void handleCrashedService() { if (wasStarted() == true) { log("Handling crashed service..."); // stop the keep alives stopKeepAlives(); // Do a clean start start(); } } @Override public void onDestroy() { log("Service destroyed (started=" + mStarted + ")"); // Stop the services, if it has been started if (mStarted == true) { stop(); } try { if (mLog != null) mLog.close(); } catch (IOException e) {} } @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); log("Service started with intent=" + intent); // Do an appropriate action based on the intent. if (intent.getAction().equals(ACTION_STOP) == true) { stop(); stopSelf(); } else if (intent.getAction().equals(ACTION_START) == true) { start(); } else if (intent.getAction().equals(ACTION_KEEPALIVE) == true) { keepAlive(); } else if (intent.getAction().equals(ACTION_RECONNECT) == true) { if (isNetworkAvailable()) { reconnectIfNecessary(); } } } @Override public IBinder onBind(Intent intent) { return null; } // log helper function private void log(String message) { log(message, null); } private void log(String message, Throwable e) { if (e != null) { Log.e(TAG, message, e); } else { Log.i(TAG, message); } if (mLog != null) { try { mLog.println(message); } catch (IOException ex) {} } } // Reads whether or not the service has been started from the preferences private boolean wasStarted() { return mPrefs.getBoolean(PREF_STARTED, false); } // Sets whether or not the services has been started in the preferences. private void setStarted(boolean started) { mPrefs.edit().putBoolean(PREF_STARTED, started).commit(); mStarted = started; } private synchronized void start() { log("Starting service..."); // Do nothing, if the service is already running. if (mStarted == true) { Log.w(TAG, "Attempt to start connection that is already active"); return; } // Establish an MQTT connection connect(); // Register a connectivity listener registerReceiver(mConnectivityChanged, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); } private synchronized void stop() { // Do nothing, if the service is not running. if (mStarted == false) { Log.w(TAG, "Attempt to stop connection not active."); return; } // Save stopped state in the preferences setStarted(false); // Remove the connectivity receiver unregisterReceiver(mConnectivityChanged); // Any existing reconnect timers should be removed, since we explicitly stopping the service. cancelReconnect(); // Destroy the MQTT connection if there is one if (mConnection != null) { mConnection.disconnect(); mConnection = null; } } // private synchronized void connect() { log("Connecting..."); // fetch the device ID from the preferences. //String deviceID = mPrefs.getString(PREF_DEVICE_ID, null); // Create a new connection only if the device id is not NULL if (deviceID == null) { log("Device ID not found."); } else { try { mConnection = new MQTTConnection(MQTT_HOST, deviceID); } catch (MqttException e) { // Schedule a reconnect, if we failed to connect log("MqttException: " + (e.getMessage() != null ? e.getMessage() : "NULL")); if (isNetworkAvailable()) { scheduleReconnect(mStartTime); } } setStarted(true); } } private synchronized void keepAlive() { try { // Send a keep alive, if there is a connection. if (mStarted == true && mConnection != null) { mConnection.sendKeepAlive(); } } catch (MqttException e) { log("MqttException: " + (e.getMessage() != null? e.getMessage(): "NULL"), e); mConnection.disconnect(); mConnection = null; cancelReconnect(); } } // Schedule application level keep-alives using the AlarmManager private void startKeepAlives() { Intent i = new Intent(); i.setClass(this, MainService.class); i.setAction(ACTION_KEEPALIVE); PendingIntent pi = PendingIntent.getService(this, 0, i, 0); AlarmManager alarmMgr = (AlarmManager)getSystemService(ALARM_SERVICE); alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + KEEP_ALIVE_INTERVAL, KEEP_ALIVE_INTERVAL, pi); } // Remove all scheduled keep alives private void stopKeepAlives() { Intent i = new Intent(); i.setClass(this, MainService.class); i.setAction(ACTION_KEEPALIVE); PendingIntent pi = PendingIntent.getService(this, 0, i, 0); AlarmManager alarmMgr = (AlarmManager)getSystemService(ALARM_SERVICE); alarmMgr.cancel(pi); } // We schedule a reconnect based on the starttime of the service public void scheduleReconnect(long startTime) { // the last keep-alive interval long interval = mPrefs.getLong(PREF_RETRY, INITIAL_RETRY_INTERVAL); // Calculate the elapsed time since the start long now = System.currentTimeMillis(); long elapsed = now - startTime; // Set an appropriate interval based on the elapsed time since start if (elapsed < interval) { interval = Math.min(interval * 4, MAXIMUM_RETRY_INTERVAL); } else { interval = INITIAL_RETRY_INTERVAL; } log("Rescheduling connection in " + interval + "ms."); // Save the new internval mPrefs.edit().putLong(PREF_RETRY, interval).commit(); // Schedule a reconnect using the alarm manager. Intent i = new Intent(); i.setClass(this, MainService.class); i.setAction(ACTION_RECONNECT); PendingIntent pi = PendingIntent.getService(this, 0, i, 0); AlarmManager alarmMgr = (AlarmManager)getSystemService(ALARM_SERVICE); alarmMgr.set(AlarmManager.RTC_WAKEUP, now + interval, pi); } // Remove the scheduled reconnect public void cancelReconnect() { Intent i = new Intent(); i.setClass(this, MainService.class); i.setAction(ACTION_RECONNECT); PendingIntent pi = PendingIntent.getService(this, 0, i, 0); AlarmManager alarmMgr = (AlarmManager)getSystemService(ALARM_SERVICE); alarmMgr.cancel(pi); } private synchronized void reconnectIfNecessary() { if (mStarted == true && mConnection == null) { log("Reconnecting..."); connect(); } } // This receiver listeners for network changes and updates the MQTT connection // accordingly private BroadcastReceiver mConnectivityChanged = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // Get network info NetworkInfo info = (NetworkInfo)intent.getParcelableExtra (ConnectivityManager.EXTRA_NETWORK_INFO); // Is there connectivity? boolean hasConnectivity = (info != null && info.isConnected()) ? true : false; log("Connectivity changed: connected=" + hasConnectivity); if (hasConnectivity) { reconnectIfNecessary(); } else if (mConnection != null) { // if there no connectivity, make sure MQTT connection is destroyed mConnection.disconnect(); cancelReconnect(); mConnection = null; } } }; // Display the topbar notification private void showNotification(String text) { Notification n = new Notification(); n.flags |= Notification.FLAG_SHOW_LIGHTS; n.flags |= Notification.FLAG_AUTO_CANCEL; n.defaults = Notification.DEFAULT_ALL; n.icon = com.appbegin.R.drawable.icon; n.when = System.currentTimeMillis(); // Simply open the parent activity PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); // Change the name of the notification here n.setLatestEventInfo(this, NOTIF_TITLE, text, pi); mNotifMan.notify(NOTIF_CONNECTED, n); } // Check if we are online private boolean isNetworkAvailable() { NetworkInfo info = mConnMan.getActiveNetworkInfo(); if (info == null) { return false; } return info.isConnected(); } // This inner class is a wrapper on top of MQTT client. private class MQTTConnection implements MqttSimpleCallback { IMqttClient mqttClient = null; // Creates a new connection given the broker address and initial topic public MQTTConnection(String brokerHostName, String initTopic) throws MqttException { // Create connection spec String mqttConnSpec = "tcp://" + brokerHostName + "@" + MQTT_BROKER_PORT_NUM; // Create the client and connect mqttClient = MqttClient.createMqttClient(mqttConnSpec, MQTT_PERSISTENCE); String clientID = MQTT_CLIENT_ID + "/" + mPrefs.getString(PREF_DEVICE_ID, ""); mqttClient.connect(clientID, MQTT_CLEAN_START, MQTT_KEEP_ALIVE); // register this client app has being able to receive messages mqttClient.registerSimpleHandler(this); // Subscribe to an initial topic, which is combination of client ID and device ID. initTopic = MQTT_CLIENT_ID + "/" + initTopic; subscribeToTopic(initTopic); log("Connection established to " + brokerHostName + " on topic " + initTopic); // Save start time mStartTime = System.currentTimeMillis(); // Star the keep-alives startKeepAlives(); } // Disconnect public void disconnect() { try { stopKeepAlives(); mqttClient.disconnect(); } catch (MqttPersistenceException e) { log("MqttException" + (e.getMessage() != null? e.getMessage():" NULL"), e); } } /* * Send a request to the message broker to be sent messages published with * the specified topic name. Wildcards are allowed. */ private void subscribeToTopic(String topicName) throws MqttException { if ((mqttClient == null) || (mqttClient.isConnected() == false)) { // quick sanity check - don't try and subscribe if we don't have // a connection log("Connection error" + "No connection"); } else { String[] topics = { topicName }; mqttClient.subscribe(topics, MQTT_QUALITIES_OF_SERVICE); } } /* * Sends a message to the message broker, requesting that it be published * to the specified topic. */ private void publishToTopic(String topicName, String message) throws MqttException { if ((mqttClient == null) || (mqttClient.isConnected() == false)) { // quick sanity check - don't try and publish if we don't have // a connection log("No connection to public to"); } else { mqttClient.publish(topicName, message.getBytes(), MQTT_QUALITY_OF_SERVICE, MQTT_RETAINED_PUBLISH); } } /* * Called if the application loses it's connection to the message broker. */ public void connectionLost() throws Exception { log("Loss of connection" + "connection downed"); stopKeepAlives(); // null itself mConnection = null; if (isNetworkAvailable() == true) { reconnectIfNecessary(); } } /* * Called when we receive a message from the message broker. */ public void publishArrived(String topicName, byte[] payload, int qos, boolean retained) { // Show a notification String s = new String(payload); showNotification(s); log("Got message: " + s); } public void sendKeepAlive() throws MqttException { log("Sending keep alive"); // publish to a keep-alive topic publishToTopic(MQTT_CLIENT_ID + "/keepalive", mPrefs.getString(PREF_DEVICE_ID, "")); } } }
[ "cnxiaoma@gmail.com" ]
cnxiaoma@gmail.com
5facd01330232c9652f77e30664e02204ea84c95
65572044f62b9d8d08c8d19fca13b9b728d23862
/coisini-ms/coisini-admin-server/src/main/java/com/coisini/admin/entity/SysRole.java
1c3a77808267cfb1850df1efcdbf515d89a3373d
[]
no_license
Maggieq8324/coisini-cloud
76a75fb93f3889f536d3fa12cc39166025b37429
1fbf59597428d4acda740883fd3366704b516235
refs/heads/main
2023-06-20T16:05:48.856207
2021-07-23T07:05:14
2021-07-23T07:05:14
388,693,926
3
1
null
null
null
null
UTF-8
Java
false
false
503
java
package com.coisini.admin.entity; public class SysRole extends BaseModel { private String name; private String remark; private Byte delFlag; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public Byte getDelFlag() { return delFlag; } public void setDelFlag(Byte delFlag) { this.delFlag = delFlag; } }
[ "maggieq8324@gmail.com" ]
maggieq8324@gmail.com
49054fc1e6444977c225869fc526fade88a74044
02ec61624a19f1582e2ca1b4fb9d25e2b19e843f
/android/app/src/main/java/com/tevinjeffrey/njitct/utils/AndroidMainThread.java
07efabe4de10a8a0a75e0e4a7ec6c220d6e7c288
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
tevjef/NJIT-Course-Tracker
0c45a5b95f2d06e2b6ab92844c84784774b3b639
549e299ac10bb6fd504bfd2554c2506a12c57d3c
refs/heads/master
2021-01-10T03:00:14.363189
2016-02-03T08:57:33
2016-02-03T08:57:33
50,632,308
6
0
null
null
null
null
UTF-8
Java
false
false
244
java
package com.tevinjeffrey.njitct.utils; import java.lang.annotation.Retention; import javax.inject.Qualifier; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Qualifier @Retention(RUNTIME) public @interface AndroidMainThread { }
[ "mastermindtj94@gmail.com" ]
mastermindtj94@gmail.com
f13a8531f399af51f015e1496a7a39ecb716d637
66b167fac9fe9648efc460640d4b0c9e27ebc017
/src/BusinessLayer/Tiles/Player/Ability/MageAbility.java
be1bb971dea3b34f1b0dad8fac6995e445a4cbc5
[]
no_license
hk772/OOP3_Dungeons_and_Dragons
ea7d2388686332838dc469d4027441952bb8300e
7138cb512cd081b052a4074879ada4a8eacf558e
refs/heads/master
2023-08-09T07:07:49.486129
2021-08-10T12:11:08
2021-08-10T12:11:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
package BusinessLayer.Tiles.Player.Ability; public class MageAbility extends AbilityIMP { private int cost; public MageAbility(String name, String poolName, int pool, int cost) { super(name, poolName, pool); this.cost = cost; } @Override public boolean isAvailable() { return amount >= cost; } @Override public void onTick() { throw new IllegalArgumentException("cant use"); } @Override public void use() { super.use(); amount -= cost; } }
[ "hagaik@post.bgu.ac.il" ]
hagaik@post.bgu.ac.il
f4856326f77d6521af5bb00a72f3cf44a999c2a4
1e348c4af6e0de749edb97c255f72903b5c412cf
/TpJavaJpa/Tp/TpJavaClient/src/main/java/fr/nguigou971/App.java
9ebf0a2888a1caff86389e8ea634914725158ce5
[]
no_license
nico-83190/TpJavaNicolasGuigou
d76563de2d6011c9a15ea090b97e7b80989055b1
b662a3142c7a90ee903a2745c8b070693d6a68f0
refs/heads/master
2022-06-30T15:52:03.720582
2019-05-27T08:35:40
2019-05-27T08:35:40
188,802,992
0
0
null
2022-06-21T01:10:44
2019-05-27T08:27:51
Java
UTF-8
Java
false
false
176
java
package fr.nguigou971; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
[ "noreply@github.com" ]
noreply@github.com
61dbc5f1c4683ed6ad2faae8438527ca56253fa8
3ee9187e459512f33ff1c4231e9edfb321380d08
/src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/RemoveTileEntityFromChunkEffect.java
cc118789df8e64b3807ea415793000e80c329b5a
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
SpongePowered/Sponge
37ef5f6c77cdbbdb007d6e68f4c5a1be0e56441e
5d39e239d8de5e746efdb82725854ee1f57a34a5
refs/heads/api-10
2023-08-17T05:53:40.685621
2023-06-17T21:01:13
2023-06-17T21:01:13
33,791,453
171
97
MIT
2023-09-12T11:49:33
2015-04-11T20:38:48
Java
UTF-8
Java
false
false
2,578
java
/* * This file is part of Sponge, licensed under the MIT License (MIT). * * Copyright (c) SpongePowered <https://www.spongepowered.org> * Copyright (c) contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.spongepowered.common.event.tracking.context.transaction.effect; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.common.event.tracking.context.transaction.pipeline.BlockPipeline; import org.spongepowered.common.event.tracking.context.transaction.pipeline.PipelineCursor; import org.spongepowered.common.world.SpongeBlockChangeFlag; public final class RemoveTileEntityFromChunkEffect implements ProcessingSideEffect { private static final class Holder { static final RemoveTileEntityFromChunkEffect INSTANCE = new RemoveTileEntityFromChunkEffect(); } public static RemoveTileEntityFromChunkEffect getInstance() { return RemoveTileEntityFromChunkEffect.Holder.INSTANCE; } RemoveTileEntityFromChunkEffect() {} @Override public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState, final BlockState newState, final SpongeBlockChangeFlag flag, final int limit ) { final BlockEntity tileEntity = oldState.tileEntity; if (tileEntity == null) { return EffectResult.NULL_RETURN; } pipeline.getAffectedChunk().removeBlockEntity(oldState.pos); return EffectResult.NULL_RETURN; } }
[ "gabizou@me.com" ]
gabizou@me.com
54d8fd2fb4c94cad6069804c5d429fefd29cdcce
fdb7108ae59488c98373c5b15f2b7127cf94f2bf
/src/Uebung/Calendar/Main.java
f9d6b6ab4b8d8f358d56e105aa6edda35f05ab7c
[]
no_license
stqrsky/HandelBBQ
7ad86fa07f5dee5f5b2ce214f5c868e86ede8284
803cf19da2addca7ad2b5eb8433189cd984b9487
refs/heads/master
2020-09-12T18:35:49.845562
2019-11-18T18:07:56
2019-11-18T18:07:56
222,512,320
2
0
null
null
null
null
UTF-8
Java
false
false
594
java
package Uebung.Calendar; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static void main(String[] args) { GregorianCalendar cal = new GregorianCalendar(); System.out.println(cal.get(Calendar.HOUR)); cal.set(Calendar.HOUR,129); System.out.println(cal.get(Calendar.MINUTE)); System.out.println(cal.get(Calendar.HOUR)); System.out.println(cal.get(Calendar.YEAR)); System.out.println(cal.get(Calendar.HOUR_OF_DAY)); System.out.println(cal.isLeapYear(cal.get(Calendar.YEAR))); } }
[ "noreply@github.com" ]
noreply@github.com
d0031958994f0c808cab10fe5e27530a91d5de76
61dea18460df6f2bc1fe19af8bfa6e0809406885
/ecmoban/src/main/java/com/ecjia/view/adapter/DataBindingAdapter.java
1e1eaff9d779f3bfec13591f934059bac174fd52
[]
no_license
hackerlc/SJQ_ECSHOP_MJ_NEW
a006261856124671bceaf92d1f65d4905dc35078
2c8ac3f2464c4536c079ac067ec761adcd9c267e
refs/heads/master
2021-08-31T11:01:29.247522
2017-12-21T03:55:09
2017-12-21T03:55:09
114,960,406
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
package com.ecjia.view.adapter; import android.databinding.BindingAdapter; import android.widget.ImageView; import com.ecjia.util.ImageLoaderForLV; /** * SJQ_ECSHOP_MJ_NEW * Created by YichenZ on 2017/2/22 13:32. */ public class DataBindingAdapter { @BindingAdapter("android:src") public static void setImageUrl(ImageView view, String url){ ImageLoaderForLV.getInstance(view.getContext()).setImageRes(view, url); } }
[ "812405389@qq.com" ]
812405389@qq.com
deab7b06caaf45c6d77b57dd3a9bf69559496e60
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/javax_crypto_CipherInputStream_notify.java
f351c064b66ea6d98fb7d9ba27422a795b116f6a
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
165
java
class javax_crypto_CipherInputStream_notify{ public static void function() {javax.crypto.CipherInputStream obj = new javax.crypto.CipherInputStream();obj.notify();}}
[ "peter2008.ok@163.com" ]
peter2008.ok@163.com
a171abad5bdaf7027b677b7f1f0813db3450003f
42b1be27b8a196865620c3a84592f62fc5661fe1
/cloud-provider-payment-8001/src/main/java/cn/zzf/spring/cloud/payment/mapper/PaymentMapper.java
c1032f2d31645e568725a130c73ba5fd98960d10
[]
no_license
ZGAOF/spring-cloud-2020
d6e4b1d96e1c51ac3ed5a47e4f7b04690bc8968f
b5588c65ee444043e7200efb4bb9384b1e5f7eac
refs/heads/master
2023-01-11T09:50:21.413305
2020-11-18T04:15:33
2020-11-18T04:15:33
313,794,524
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
package cn.zzf.spring.cloud.payment.mapper; import cn.zzf.spring.cloud.entity.Payment; import org.apache.ibatis.annotations.Mapper; @Mapper public interface PaymentMapper { int create(Payment payment); Payment selectPaymentById(Long id); }
[ "1520061084@qq.com" ]
1520061084@qq.com
524faebb173e39c8c07fb42007ff5655e806c916
9b9c3236cc1d970ba92e4a2a49f77efcea3a7ea5
/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java
55ad11451bf2356d015dbc384494c77d085a61e3
[]
no_license
BETAJIb/ikol
73018f8b7c3e1262266b6f7d0a7f6bbdf284621d
f3709ea10be2d155b0bf1dee487f53c723f570cf
refs/heads/master
2021-01-05T10:37:17.831153
2019-12-24T22:23:02
2019-12-24T22:23:02
240,993,482
0
0
null
null
null
null
UTF-8
Java
false
false
6,058
java
/* * This file is part of the L2J Mobius project. * * 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, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package quests.Q00365_DevilsLegacy; import java.util.HashMap; import java.util.Map; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.QuestState; /** * Devil's Legacy (365) * @author Adry_85 */ public class Q00365_DevilsLegacy extends Quest { // NPCs private static final int COLLOB = 30092; private static final int RANDOLF = 30095; // Item private static final int PIRATES_TREASURE_CHEST = 5873; // Rewards private static final int ENCHANT_WEAPON_C = 951; private static final int ENCHANT_ARMOR_C = 952; private static final int ENCHANT_WEAPON_D = 955; private static final int ENCHANT_ARMOR_D = 956; private static final int THREAD = 1868; private static final int ANIMAL_BONE = 1872; private static final int COKES = 1879; private static final int STEEL = 1880; private static final int COARSE_BONE_POWDER = 1881; private static final int LEATHER = 1882; private static final int CORD = 1884; // Misc private static final int MIN_LEVEL = 39; // Skill private static SkillHolder POISON = new SkillHolder(4035, 2); // Mobs private static final Map<Integer, Double> MOBS = new HashMap<>(); static { MOBS.put(20836, 0.47); // pirates_zombie MOBS.put(20845, 0.40); // pirates_zombie_captain MOBS.put(21629, 0.40); // pirates_zombie_captain_1 MOBS.put(21630, 0.40); // pirates_zombie_captain_2 } public Q00365_DevilsLegacy() { super(365); addStartNpc(RANDOLF); addTalkId(RANDOLF, COLLOB); addKillId(MOBS.keySet()); registerQuestItems(PIRATES_TREASURE_CHEST); } @Override public String onAdvEvent(String event, Npc npc, PlayerInstance player) { final QuestState qs = getQuestState(player, false); String htmltext = null; if (qs == null) { return htmltext; } switch (event) { case "30095-02.htm": { qs.startQuest(); qs.setMemoState(1); htmltext = event; break; } case "30095-05.html": { qs.exitQuest(true, true); htmltext = event; break; } case "30095-06.html": { htmltext = event; break; } case "REWARD": { if (!qs.isMemoState(1)) { htmltext = "30092-04.html"; } else if (!hasQuestItems(player, PIRATES_TREASURE_CHEST)) { htmltext = "30092-02.html"; } else if (player.getAdena() < 600) { htmltext = "30092-03.html"; } else { final int itemId; final int chance; if (getRandom(100) < 80) { chance = getRandom(100); if (chance < 1) { itemId = ENCHANT_WEAPON_D; } else if (chance < 4) { itemId = ENCHANT_ARMOR_D; } else if (chance < 36) { itemId = THREAD; } else if (chance < 68) { itemId = CORD; } else { itemId = ANIMAL_BONE; } htmltext = "30092-05.html"; } else { chance = getRandom(1000); if (chance < 10) { itemId = ENCHANT_WEAPON_C; } else if (chance < 40) { itemId = ENCHANT_ARMOR_C; } else if (chance < 60) { itemId = ENCHANT_WEAPON_D; } else if (chance < 260) { itemId = ENCHANT_ARMOR_D; } else if (chance < 445) { itemId = COKES; } else if (chance < 630) { itemId = STEEL; } else if (chance < 815) { itemId = LEATHER; } else { itemId = COARSE_BONE_POWDER; } npc.setTarget(player); npc.doCast(POISON.getSkill()); npc.setCurrentMp(npc.getMaxMp()); qs.setMemoState(2); htmltext = "30092-06.html"; } takeItems(player, PIRATES_TREASURE_CHEST, 1); takeItems(player, Inventory.ADENA_ID, 600); rewardItems(player, itemId, 1); } break; } } return htmltext; } @Override public String onKill(Npc npc, PlayerInstance player, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc); if (qs != null) { giveItemRandomly(qs.getPlayer(), npc, PIRATES_TREASURE_CHEST, 1, 0, MOBS.get(npc.getId()), true); } return super.onKill(npc, player, isSummon); } @Override public String onTalk(Npc npc, PlayerInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); switch (npc.getId()) { case RANDOLF: { if (qs.isCreated()) { htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30095-01.htm" : "30095-03.html"); } else if (qs.isStarted()) { if (hasQuestItems(player, PIRATES_TREASURE_CHEST)) { final long chestCount = getQuestItemsCount(player, PIRATES_TREASURE_CHEST); giveAdena(player, (chestCount * 400) + 19800, true); takeItems(player, PIRATES_TREASURE_CHEST, -1); htmltext = "30095-04.html"; } else { htmltext = "30095-07.html"; } } break; } case COLLOB: { if (qs.isStarted()) { htmltext = (qs.isMemoState(1) ? "30092-01.html" : "30092-07.html"); } break; } } return htmltext; } }
[ "mobius@cyber-wizard.com" ]
mobius@cyber-wizard.com
e80c276c25c136fde3c3880191ef7b5b1f8eee0a
f538a4f3bcf7a2c9c93c155141777065157947c8
/spliffy-server/src/main/java/org/spliffy/server/web/sharing/SharesFolder.java
57e33554d00f1516b5e6ba4911325e6f1eeb69a1
[]
no_license
nabilshams/spliffy
d638ce63f1610d455087dcbe0e5f22e9a08c3192
3ad26f0f9e9c9fe68d30303a2f8c818c00a97af3
refs/heads/master
2021-01-17T22:18:30.396874
2012-04-27T12:11:06
2012-04-27T12:11:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,376
java
package org.spliffy.server.web.sharing; import com.bradmcevoy.http.CollectionResource; import com.bradmcevoy.http.Resource; import com.bradmcevoy.http.exceptions.BadRequestException; import com.bradmcevoy.http.exceptions.NotAuthorizedException; import com.ettrema.http.acl.Principal; import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; import org.spliffy.server.db.BaseEntity; import org.spliffy.server.db.Link; import org.spliffy.server.db.SessionManager; import org.spliffy.server.db.User; import org.spliffy.server.web.AbstractResource; import org.spliffy.server.web.Services; import org.spliffy.server.web.SpliffyCollectionResource; /** * * @author brad */ public class SharesFolder extends AbstractResource implements CollectionResource{ private final String name; private final SpliffyCollectionResource parent; public SharesFolder(String name, SpliffyCollectionResource parent) { super(parent.getServices()); this.name = name; this.parent = parent; } @Override public boolean isDir() { return false; } @Override public SpliffyCollectionResource getParent() { return parent; } @Override public BaseEntity getOwner() { return null; } @Override public void addPrivs(List<Priviledge> list, User user) { } @Override public String getName() { return name; } @Override public Date getModifiedDate() { return null; } @Override public Date getCreateDate() { return null; } @Override public Resource child(String childName) throws NotAuthorizedException, BadRequestException { UUID id; try { id = UUID.fromString(childName); } catch (Exception e) { return null; // not a UUID } Link link = Link.get(id, SessionManager.session()); if( link == null) { return null; } return new ShareResource(link, parent); } @Override public List<? extends Resource> getChildren() throws NotAuthorizedException, BadRequestException { throw new UnsupportedOperationException("Not supported yet."); } @Override public Map<Principal, List<Priviledge>> getAccessControlList() { return null; } }
[ "brad@mcevoysoftware.co.nz" ]
brad@mcevoysoftware.co.nz
30333302a2e99e12ee212fea827f4e5ffdb66ffd
9f8e15acd808f605db4da6d9c316fea8a8ddc1d4
/Servlets and Jsp/Lab 3 - forward/src/main/java/iti/gov/hadeer/SendRedirect.java
5345212e133f2d6aadc52e2a2c2b6b7f885b719b
[]
no_license
hadeerelnaggar/ITI-Web-Javaee-Labs
f73ba5023ec35d60af49caa61986984a64e5e058
750b24ff35b620b17b572d78d1bcd16d1dbdb8a5
refs/heads/master
2023-04-14T04:41:23.378794
2021-05-10T14:03:55
2021-05-10T14:03:55
366,055,531
0
0
null
null
null
null
UTF-8
Java
false
false
1,542
java
package iti.gov.hadeer; import jakarta.servlet.*; import java.io.*; import jakarta.servlet.http.*; import java.util.*; import java.sql.*; import java.sql.Connection; import java.sql.SQLException; import javax.naming.*; import javax.sql.*; import javax.sql.DataSource; public class SendRedirect extends HttpServlet{ public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException { PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<body>"); RequestDispatcher rd = request.getRequestDispatcher("login"); rd.include(request, response); } public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ PrintWriter out = response.getWriter(); String userName = request.getParameter("userName"); String password = request.getParameter("password"); if(!userName.equals("") && !password.equals("")){ System.out.println("not null"); //response.sendRedirect("welcome?userName=" + userName + "&password=" + password); RequestDispatcher rd = request.getRequestDispatcher("welcome"); request.setAttribute("userName",userName); request.setAttribute("password",password); rd.forward(request, response); } else { System.out.println("null"); out.println("<html>"); out.println("<body>"); out.println("<h3 style=\"color: red\">Login Failed, please try again</h3>"); RequestDispatcher rd = request.getRequestDispatcher("login"); rd.include(request, response); } } }
[ "hadeerelnaggar@hotmail.com" ]
hadeerelnaggar@hotmail.com
60ed6412241139ef8f597159cd66b1efe778ec9f
d9ea42be39a8078db52e09274d8013998011d8e1
/xc-auth/xc-auth-api/src/main/java/com/chenyu/cloud/auth/dto/UserPasswordDto.java
519b888917687583c225a1bd9b72a76f06e41244
[]
no_license
cyuaa/xc-cloud
3cb9ab0576c8db2372dc96b0348a16c2a7c24321
511a7e090bd501ebac7b197b71f8110f44d97c04
refs/heads/master
2023-04-20T05:22:44.480231
2021-05-13T09:13:31
2021-05-13T09:13:31
357,454,955
0
0
null
null
null
null
UTF-8
Java
false
false
722
java
package com.chenyu.cloud.auth.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; import javax.validation.constraints.NotEmpty; /** * 修改用户名密码参数 * Created by JackyChen on 2021/4/28. */ @Getter @Setter public class UserPasswordDto { @ApiModelProperty(value = "用户名", required = true) @NotEmpty(message = "用户名不能为空") private String username; @ApiModelProperty(value = "旧密码", required = true) @NotEmpty(message = "旧密码不能为空") private String oldPassword; @ApiModelProperty(value = "新密码", required = true) @NotEmpty(message = "新密码不能为空") private String newPassword; }
[ "275518941@qq.com" ]
275518941@qq.com