blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
32859840c8b2cd3d7d2d23e656918342341dda6b
27,522,150,456,556
3020a76ff44b1b8a90afe9a0786895f59c9eb7ce
/app/src/main/java/com/example/qiangshi/meet/Fragment/SortModel.java
c672b072a3ea744ef7cea963a910e7b99f643940
[]
no_license
LosSherl/Meet
https://github.com/LosSherl/Meet
279d6e8568e2e83e0195f4337e743538d75be2a2
7415e0254d2c09af9900e94311ea74ab828dc5b6
refs/heads/master
2021-01-20T18:36:09.182000
2016-07-16T07:30:40
2016-07-16T07:30:40
63,396,170
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.qiangshi.meet.Fragment; import android.widget.ImageView; public class SortModel { private ImageView contactsAvatar; private String contactsName; private String sortLetters; //显示数据拼音的首字母 public ImageView getContactsAvarta() { return contactsAvatar; } public void setContactsAvarta(ImageView contactsAvarta) { this.contactsAvatar = contactsAvarta; } public String getContactsName() { return contactsName; } public void setContactsName(String contactsName) { this.contactsName = contactsName; } public String getSortLetters() { return sortLetters; } public void setSortLetters(String sortLetters) { this.sortLetters = sortLetters; } }
UTF-8
Java
710
java
SortModel.java
Java
[]
null
[]
package com.example.qiangshi.meet.Fragment; import android.widget.ImageView; public class SortModel { private ImageView contactsAvatar; private String contactsName; private String sortLetters; //显示数据拼音的首字母 public ImageView getContactsAvarta() { return contactsAvatar; } public void setContactsAvarta(ImageView contactsAvarta) { this.contactsAvatar = contactsAvarta; } public String getContactsName() { return contactsName; } public void setContactsName(String contactsName) { this.contactsName = contactsName; } public String getSortLetters() { return sortLetters; } public void setSortLetters(String sortLetters) { this.sortLetters = sortLetters; } }
710
0.773913
0.773913
35
18.714285
18.85671
58
false
false
0
0
0
0
0
0
1.085714
false
false
10
1dae6772293caee81184794a582edb36cc5b665d
32,950,989,158,599
0081af3d5e0243ce55bae9a0ae790a26d54461fa
/src/main/java/fathertoast/deadlyworld/block/state/EnumTowerType.java
fbbaaa90daddce6dfdab755b90a38737f1154822
[]
no_license
FatherToast/DeadlyWorld
https://github.com/FatherToast/DeadlyWorld
486dba4c0528f0161f51e8e780c033aadaa1c888
fd4ed06726771f1aa5c05598dec28eb3a2354694
refs/heads/master
2022-10-23T16:48:17.939000
2022-01-15T01:57:53
2022-01-15T01:57:53
50,752,897
4
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package fathertoast.deadlyworld.block.state; import fathertoast.deadlyworld.*; import fathertoast.deadlyworld.block.*; import fathertoast.deadlyworld.config.*; import fathertoast.deadlyworld.featuregen.*; import fathertoast.deadlyworld.loot.*; import fathertoast.deadlyworld.tileentity.*; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntitySmallFireball; import net.minecraft.entity.projectile.EntityTippedArrow; import net.minecraft.init.*; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionUtils; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; public enum EnumTowerType implements IExclusiveMetaProvider { DEFAULT( "simple" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_DEFAULT; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addCommonDrop( "common", "Arrow", Items.ARROW, 2, 16 ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addPool( new LootPoolBuilder( "rare" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchanted Bow", Items.BOW ).enchant( 30, true ).toLootEntry( ) ) .toLootPool( ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.POWER, Enchantments.PUNCH, Enchantments.INFINITY ).toLootEntry( ) ) .toLootPool( ) ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { EntityArrow arrow = new EntityTippedArrow( towerEntity.getWorld( ) ); towerEntity.shootArrow( center, offset, vecToTarget, distanceH, getFeatureConfig( dimConfig ).PROJECTILE_SPEED, getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE, arrow ); } }, FIRE( "fire" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_FIRE; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addCommonDrop( "common", "Arrow", Items.ARROW, 2, 16 ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addPool( new LootPoolBuilder( "rare" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchanted Bow", Items.BOW ).enchant( 30, true ).toLootEntry( ) ) .toLootPool( ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.FIRE_PROTECTION, Enchantments.FLAME, Enchantments.INFINITY ).toLootEntry( ) ) .toLootPool( ) ); // Fire loot.addSemicommonDrop( "semicommon", "Coal", Items.COAL ); loot.addUncommonDrop( "uncommon", "Fire Charge", Items.FIRE_CHARGE ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { EntityArrow arrow = new EntityTippedArrow( towerEntity.getWorld( ) ); arrow.setFire( 100 ); towerEntity.shootArrow( center, offset, vecToTarget, distanceH, getFeatureConfig( dimConfig ).PROJECTILE_SPEED, getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE, arrow ); } }, POTION( "potion" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_POTION; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addCommonDrop( "common", "Arrow", Items.ARROW, 2, 16 ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addPool( new LootPoolBuilder( "rare" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchanted Bow", Items.BOW ).enchant( 30, true ).toLootEntry( ) ) .toLootPool( ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.PROTECTION, Enchantments.THORNS, Enchantments.INFINITY ).toLootEntry( ) ) .toLootPool( ) ); // Potions loot.addLootTable( "external", "Witch Loot", LootTableList.ENTITIES_WITCH ); loot.addUncommonDrop( "uncommon", "Brewing", Items.RABBIT_FOOT, Items.BLAZE_POWDER, Items.SPECKLED_MELON, Items.GHAST_TEAR, Items.MAGMA_CREAM, Items.GOLDEN_CARROT, Items.FERMENTED_SPIDER_EYE ); loot.addPool( new LootPoolBuilder( "potionarrows" ) .addConditions( LootPoolBuilder.UNCOMMON_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Poison Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.POISON ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Harm Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.HARMING ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Weakness Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.WEAKNESS ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Slowness Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.SLOWNESS ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Poison II Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.STRONG_POISON ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Harm II Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.STRONG_HARMING ) ).setCount( 1, 8 ).toLootEntry( ) ) .toLootPool( ) ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { final String TAG_POTION_TYPE = "PotionType"; World world = towerEntity.getWorld( ); // Load or pick the potion arrow type EnumPotionArrowType type; NBTTagCompound typeData = towerEntity.getOrCreateTypeData( ); if( typeData.hasKey( TAG_POTION_TYPE, TrapHelper.NBT_TYPE_STRING ) ) { type = EnumPotionArrowType.fromString( typeData.getString( TAG_POTION_TYPE ) ); } else { type = dimConfig.TOWER_POTION.POTION_TYPE_LIST.nextItem( world.rand ); if( type == null ) { type = EnumPotionArrowType.RANDOM; } typeData.setString( TAG_POTION_TYPE, type.toString( ) ); } // Create the arrow EntityTippedArrow arrow = new EntityTippedArrow( towerEntity.getWorld( ) ); type.addEffects( world.rand, dimConfig, arrow ); towerEntity.shootArrow( center, offset, vecToTarget, distanceH, getFeatureConfig( dimConfig ).PROJECTILE_SPEED, getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE, arrow ); } }, GATLING( "gatling" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_GATLING; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addCommonDrop( "common", "Arrow", Items.ARROW, 4, 24 ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addPool( new LootPoolBuilder( "rare" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchanted Bow", Items.BOW ).enchant( 30, true ).toLootEntry( ) ) .toLootPool( ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.PUNCH, Enchantments.INFINITY ).toLootEntry( ) ) .toLootPool( ) ); // Valuable loot.addClusterDrop( "cluster2", "Lapis Lazuli", new ItemStack( Items.DYE, 1, EnumDyeColor.BLUE.getDyeDamage( ) ) ); loot.addRareDrop( "money", "Gem", Items.DIAMOND, Items.EMERALD ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { EntityArrow arrow = new EntityTippedArrow( towerEntity.getWorld( ) ); towerEntity.shootArrow( center, offset, vecToTarget, distanceH, getFeatureConfig( dimConfig ).PROJECTILE_SPEED, getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE, arrow ); } }, FIREBALL( "fireball", "fireball tower traps" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_FIREBALL; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addSemicommonDrop( "semicommon", "Quartz", Items.QUARTZ ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addClusterDrop( "cluster2", "Lapis Lazuli", new ItemStack( Items.DYE, 1, EnumDyeColor.BLUE.getDyeDamage( ) ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.FIRE_PROTECTION, Enchantments.FLAME, Enchantments.FIRE_ASPECT ).toLootEntry( ) ) .toLootPool( ) ); // Fire loot.addCommonDrop( "common", "Fire Charge", Items.FIRE_CHARGE, 1, 8 ); loot.addUncommonDrop( "uncommon", "Blaze Powder", Items.BLAZE_POWDER ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { final double spawnOffset = 0.6; World world = towerEntity.getWorld( ); BlockPos topBlock = towerEntity.getPos( ).add( 0, 1, 0 ); if( world.isAirBlock( topBlock ) ) { world.setBlockState( topBlock, Blocks.FIRE.getDefaultState( ) ); } float accel = getFeatureConfig( dimConfig ).PROJECTILE_SPEED; float var = (float) Math.sqrt( distanceH ) / 12.0F * getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE; for( float count = getFeatureConfig( dimConfig ).ATTACK_DAMAGE; count >= 1.0F || count > 0.0F && count > world.rand.nextFloat( ); count-- ) { EntitySmallFireball fireball = new EntitySmallFireball( world, center.x + offset.x * spawnOffset, center.y, center.z + offset.z * spawnOffset, vecToTarget.x * accel + world.rand.nextGaussian( ) * var, vecToTarget.y * accel + world.rand.nextGaussian( ) * var, vecToTarget.z * accel + world.rand.nextGaussian( ) * var ); world.spawnEntity( fireball ); } towerEntity.getWorld( ).playSound( null, center.x, center.y, center.z, SoundEvents.ENTITY_BLAZE_SHOOT, SoundCategory.BLOCKS, 1.0F, 1.0F / (towerEntity.getWorld( ).rand.nextFloat( ) * 0.4F + 0.8F) ); } }; public static final PropertyEnum< EnumTowerType > PROPERTY = PropertyEnum.create( "type", EnumTowerType.class ); public final ResourceLocation LOOT_TABLE_BLOCK; public final String NAME; public final String DISPLAY_NAME; EnumTowerType( String name ) { this( name, name.replace( "_", " " ) + " arrow tower traps" ); } EnumTowerType( String name, String prettyName ) { NAME = name; DISPLAY_NAME = prettyName; LOOT_TABLE_BLOCK = LootTableList.register( new ResourceLocation( DeadlyWorldMod.MOD_ID, ModObjects.BLOCK_LOOT_TABLE_PATH + BlockTowerDispenser.ID + "/" + name ) ); } public abstract Config.FeatureTower getFeatureConfig( Config dimConfig ); public abstract void buildBlockLootTable( LootTableBuilder loot ); public abstract void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ); public WorldGenTowerTrap makeWorldGen( ) { return new WorldGenTowerTrap( this ); } @Override public String toString( ) { return NAME; } @Override public String getName( ) { return NAME; } @Override public int getMetadata( ) { return ordinal( ); } public static EnumTowerType byMetadata( int meta ) { if( meta < 0 || meta >= values( ).length ) { DeadlyWorldMod.log( ).warn( "Attempted to load invalid towertrap type with metadata '{}'", meta ); return DEFAULT; } return values( )[ meta ]; } }
UTF-8
Java
13,930
java
EnumTowerType.java
Java
[]
null
[]
package fathertoast.deadlyworld.block.state; import fathertoast.deadlyworld.*; import fathertoast.deadlyworld.block.*; import fathertoast.deadlyworld.config.*; import fathertoast.deadlyworld.featuregen.*; import fathertoast.deadlyworld.loot.*; import fathertoast.deadlyworld.tileentity.*; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntitySmallFireball; import net.minecraft.entity.projectile.EntityTippedArrow; import net.minecraft.init.*; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionUtils; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.storage.loot.LootTableList; public enum EnumTowerType implements IExclusiveMetaProvider { DEFAULT( "simple" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_DEFAULT; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addCommonDrop( "common", "Arrow", Items.ARROW, 2, 16 ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addPool( new LootPoolBuilder( "rare" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchanted Bow", Items.BOW ).enchant( 30, true ).toLootEntry( ) ) .toLootPool( ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.POWER, Enchantments.PUNCH, Enchantments.INFINITY ).toLootEntry( ) ) .toLootPool( ) ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { EntityArrow arrow = new EntityTippedArrow( towerEntity.getWorld( ) ); towerEntity.shootArrow( center, offset, vecToTarget, distanceH, getFeatureConfig( dimConfig ).PROJECTILE_SPEED, getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE, arrow ); } }, FIRE( "fire" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_FIRE; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addCommonDrop( "common", "Arrow", Items.ARROW, 2, 16 ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addPool( new LootPoolBuilder( "rare" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchanted Bow", Items.BOW ).enchant( 30, true ).toLootEntry( ) ) .toLootPool( ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.FIRE_PROTECTION, Enchantments.FLAME, Enchantments.INFINITY ).toLootEntry( ) ) .toLootPool( ) ); // Fire loot.addSemicommonDrop( "semicommon", "Coal", Items.COAL ); loot.addUncommonDrop( "uncommon", "Fire Charge", Items.FIRE_CHARGE ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { EntityArrow arrow = new EntityTippedArrow( towerEntity.getWorld( ) ); arrow.setFire( 100 ); towerEntity.shootArrow( center, offset, vecToTarget, distanceH, getFeatureConfig( dimConfig ).PROJECTILE_SPEED, getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE, arrow ); } }, POTION( "potion" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_POTION; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addCommonDrop( "common", "Arrow", Items.ARROW, 2, 16 ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addPool( new LootPoolBuilder( "rare" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchanted Bow", Items.BOW ).enchant( 30, true ).toLootEntry( ) ) .toLootPool( ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.PROTECTION, Enchantments.THORNS, Enchantments.INFINITY ).toLootEntry( ) ) .toLootPool( ) ); // Potions loot.addLootTable( "external", "Witch Loot", LootTableList.ENTITIES_WITCH ); loot.addUncommonDrop( "uncommon", "Brewing", Items.RABBIT_FOOT, Items.BLAZE_POWDER, Items.SPECKLED_MELON, Items.GHAST_TEAR, Items.MAGMA_CREAM, Items.GOLDEN_CARROT, Items.FERMENTED_SPIDER_EYE ); loot.addPool( new LootPoolBuilder( "potionarrows" ) .addConditions( LootPoolBuilder.UNCOMMON_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Poison Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.POISON ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Harm Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.HARMING ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Weakness Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.WEAKNESS ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Slowness Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.SLOWNESS ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Poison II Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.STRONG_POISON ) ).setCount( 1, 8 ).toLootEntry( ) ) .addEntry( new LootEntryItemBuilder( "Harm II Arrow", PotionUtils.addPotionToItemStack( new ItemStack( Items.TIPPED_ARROW ), PotionTypes.STRONG_HARMING ) ).setCount( 1, 8 ).toLootEntry( ) ) .toLootPool( ) ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { final String TAG_POTION_TYPE = "PotionType"; World world = towerEntity.getWorld( ); // Load or pick the potion arrow type EnumPotionArrowType type; NBTTagCompound typeData = towerEntity.getOrCreateTypeData( ); if( typeData.hasKey( TAG_POTION_TYPE, TrapHelper.NBT_TYPE_STRING ) ) { type = EnumPotionArrowType.fromString( typeData.getString( TAG_POTION_TYPE ) ); } else { type = dimConfig.TOWER_POTION.POTION_TYPE_LIST.nextItem( world.rand ); if( type == null ) { type = EnumPotionArrowType.RANDOM; } typeData.setString( TAG_POTION_TYPE, type.toString( ) ); } // Create the arrow EntityTippedArrow arrow = new EntityTippedArrow( towerEntity.getWorld( ) ); type.addEffects( world.rand, dimConfig, arrow ); towerEntity.shootArrow( center, offset, vecToTarget, distanceH, getFeatureConfig( dimConfig ).PROJECTILE_SPEED, getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE, arrow ); } }, GATLING( "gatling" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_GATLING; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addCommonDrop( "common", "Arrow", Items.ARROW, 4, 24 ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addPool( new LootPoolBuilder( "rare" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchanted Bow", Items.BOW ).enchant( 30, true ).toLootEntry( ) ) .toLootPool( ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.PUNCH, Enchantments.INFINITY ).toLootEntry( ) ) .toLootPool( ) ); // Valuable loot.addClusterDrop( "cluster2", "Lapis Lazuli", new ItemStack( Items.DYE, 1, EnumDyeColor.BLUE.getDyeDamage( ) ) ); loot.addRareDrop( "money", "Gem", Items.DIAMOND, Items.EMERALD ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { EntityArrow arrow = new EntityTippedArrow( towerEntity.getWorld( ) ); towerEntity.shootArrow( center, offset, vecToTarget, distanceH, getFeatureConfig( dimConfig ).PROJECTILE_SPEED, getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE, arrow ); } }, FIREBALL( "fireball", "fireball tower traps" ) { @Override public Config.FeatureTower getFeatureConfig( Config dimConfig ) { return dimConfig.TOWER_FIREBALL; } @Override public void buildBlockLootTable( LootTableBuilder loot ) { // Basic loot.addSemicommonDrop( "semicommon", "Quartz", Items.QUARTZ ); loot.addClusterDrop( "cluster", "Redstone", Items.REDSTONE ); loot.addClusterDrop( "cluster2", "Lapis Lazuli", new ItemStack( Items.DYE, 1, EnumDyeColor.BLUE.getDyeDamage( ) ) ); loot.addPool( new LootPoolBuilder( "enchant" ) .addConditions( LootPoolBuilder.RARE_CONDITIONS ) .addEntry( new LootEntryItemBuilder( "Enchants", Items.BOOK ).applyOneRandomEnchant( Enchantments.PROJECTILE_PROTECTION, Enchantments.FIRE_PROTECTION, Enchantments.FLAME, Enchantments.FIRE_ASPECT ).toLootEntry( ) ) .toLootPool( ) ); // Fire loot.addCommonDrop( "common", "Fire Charge", Items.FIRE_CHARGE, 1, 8 ); loot.addUncommonDrop( "uncommon", "Blaze Powder", Items.BLAZE_POWDER ); } @Override public void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ) { final double spawnOffset = 0.6; World world = towerEntity.getWorld( ); BlockPos topBlock = towerEntity.getPos( ).add( 0, 1, 0 ); if( world.isAirBlock( topBlock ) ) { world.setBlockState( topBlock, Blocks.FIRE.getDefaultState( ) ); } float accel = getFeatureConfig( dimConfig ).PROJECTILE_SPEED; float var = (float) Math.sqrt( distanceH ) / 12.0F * getFeatureConfig( dimConfig ).PROJECTILE_VARIANCE; for( float count = getFeatureConfig( dimConfig ).ATTACK_DAMAGE; count >= 1.0F || count > 0.0F && count > world.rand.nextFloat( ); count-- ) { EntitySmallFireball fireball = new EntitySmallFireball( world, center.x + offset.x * spawnOffset, center.y, center.z + offset.z * spawnOffset, vecToTarget.x * accel + world.rand.nextGaussian( ) * var, vecToTarget.y * accel + world.rand.nextGaussian( ) * var, vecToTarget.z * accel + world.rand.nextGaussian( ) * var ); world.spawnEntity( fireball ); } towerEntity.getWorld( ).playSound( null, center.x, center.y, center.z, SoundEvents.ENTITY_BLAZE_SHOOT, SoundCategory.BLOCKS, 1.0F, 1.0F / (towerEntity.getWorld( ).rand.nextFloat( ) * 0.4F + 0.8F) ); } }; public static final PropertyEnum< EnumTowerType > PROPERTY = PropertyEnum.create( "type", EnumTowerType.class ); public final ResourceLocation LOOT_TABLE_BLOCK; public final String NAME; public final String DISPLAY_NAME; EnumTowerType( String name ) { this( name, name.replace( "_", " " ) + " arrow tower traps" ); } EnumTowerType( String name, String prettyName ) { NAME = name; DISPLAY_NAME = prettyName; LOOT_TABLE_BLOCK = LootTableList.register( new ResourceLocation( DeadlyWorldMod.MOD_ID, ModObjects.BLOCK_LOOT_TABLE_PATH + BlockTowerDispenser.ID + "/" + name ) ); } public abstract Config.FeatureTower getFeatureConfig( Config dimConfig ); public abstract void buildBlockLootTable( LootTableBuilder loot ); public abstract void triggerAttack( Config dimConfig, TileEntityTowerDispenser towerEntity, EntityPlayer target, Vec3d center, Vec3d offset, Vec3d vecToTarget, double distanceH ); public WorldGenTowerTrap makeWorldGen( ) { return new WorldGenTowerTrap( this ); } @Override public String toString( ) { return NAME; } @Override public String getName( ) { return NAME; } @Override public int getMetadata( ) { return ordinal( ); } public static EnumTowerType byMetadata( int meta ) { if( meta < 0 || meta >= values( ).length ) { DeadlyWorldMod.log( ).warn( "Attempted to load invalid towertrap type with metadata '{}'", meta ); return DEFAULT; } return values( )[ meta ]; } }
13,930
0.688083
0.682269
360
36.694443
35.422859
144
false
false
0
0
0
0
0
0
3.461111
false
false
10
16ca4a1fb372c2f61ed8a9b894821520232fa65f
15,728,170,300,139
c4771de36e8d7331c8590ae6092a9b8a41769a8d
/thecomp-parent/app/common/default/src/main/java/com/thecomp/common/vobj/ContWay.java
b4678712aaa4eefbc863e6eaba227eb49cdb3bda
[]
no_license
YangjianForWork/thecomp
https://github.com/YangjianForWork/thecomp
9ca96cd17e936e1f1e05812213cc80f96e075bad
273bd95948c04f0cefa695028595a9917dedf665
refs/heads/master
2017-04-27T12:44:12.932000
2016-08-19T09:39:22
2016-08-19T09:39:22
64,720,712
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Yixiu.com Inc. * Copyright (c) 2015-2016 All Rights Reserved. */ package com.thecomp.common.vobj; /** * 联系方式 * @author YJ.yang * @version $Id: ContWay.java, v 0.1 2016年8月1日 上午10:40:25 dev Exp $ */ public class ContWay { /**手机号码*/ private String mobile; /**电子邮箱*/ private String email; /**座机号*/ private String commuNumber; public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getCommuNumber() { return commuNumber; } public void setCommuNumber(String commuNumber) { this.commuNumber = commuNumber; } }
UTF-8
Java
891
java
ContWay.java
Java
[ { "context": "m.thecomp.common.vobj;\r\n\r\n/**\r\n * 联系方式\r\n * @author YJ.yang\r\n * @version $Id: ContWay.java, v 0.1 2016年8月1日 上", "end": 146, "score": 0.9997758865356445, "start": 139, "tag": "NAME", "value": "YJ.yang" } ]
null
[]
/** * Yixiu.com Inc. * Copyright (c) 2015-2016 All Rights Reserved. */ package com.thecomp.common.vobj; /** * 联系方式 * @author YJ.yang * @version $Id: ContWay.java, v 0.1 2016年8月1日 上午10:40:25 dev Exp $ */ public class ContWay { /**手机号码*/ private String mobile; /**电子邮箱*/ private String email; /**座机号*/ private String commuNumber; public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getCommuNumber() { return commuNumber; } public void setCommuNumber(String commuNumber) { this.commuNumber = commuNumber; } }
891
0.574618
0.548766
39
19.820513
16.3799
67
false
false
0
0
0
0
0
0
0.282051
false
false
10
f211ed17d3560a6266c8df0af4834cecfc286e65
1,786,706,452,489
bb07334facc2b286f93ab1aa2399712ba8cb7b25
/openstack-dashboard-core/src/main/java/com/twelve/core/exception/SystemException.java
a3d12497e77feecc2a4b536c489c842e431b5e8f
[]
no_license
MangustoTI/openstack
https://github.com/MangustoTI/openstack
a952495498475702de609b4d3487da57baf94f4f
adad8c38f6b46fd3ebba56a8e13ec6f25c74c4c8
refs/heads/master
2020-12-24T06:47:30.431000
2016-10-21T21:16:37
2016-10-21T21:16:37
57,131,988
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * * Copyright TWELVE 2016 All Rights Reserved. * No part of this Portal may be reproduced without BTG Pactual's express consent. * */ package com.twelve.core.exception; /** * @author Luiz Arantes * @since 15/04/2016 * @version 1.0 * */ public class SystemException extends RuntimeException { private static final long serialVersionUID = -1105498427178034443L; private String mensagem; public SystemException(Throwable throwable) { super(throwable); } public SystemException(String mensagem, Throwable throwable) { super(mensagem, throwable); this.setMensagem(mensagem); } public SystemException(String string) { super(string); this.setMensagem(string); } public String getMensagem() { return mensagem; } public void setMensagem(String mensagem) { this.mensagem = mensagem; } }
UTF-8
Java
881
java
SystemException.java
Java
[ { "context": "ackage com.twelve.core.exception;\n\n\n/**\n * @author Luiz Arantes\n * @since 15/04/2016\n * @version 1.0\n *\n */\npubli", "end": 209, "score": 0.9998850226402283, "start": 197, "tag": "NAME", "value": "Luiz Arantes" } ]
null
[]
/** * * Copyright TWELVE 2016 All Rights Reserved. * No part of this Portal may be reproduced without BTG Pactual's express consent. * */ package com.twelve.core.exception; /** * @author <NAME> * @since 15/04/2016 * @version 1.0 * */ public class SystemException extends RuntimeException { private static final long serialVersionUID = -1105498427178034443L; private String mensagem; public SystemException(Throwable throwable) { super(throwable); } public SystemException(String mensagem, Throwable throwable) { super(mensagem, throwable); this.setMensagem(mensagem); } public SystemException(String string) { super(string); this.setMensagem(string); } public String getMensagem() { return mensagem; } public void setMensagem(String mensagem) { this.mensagem = mensagem; } }
875
0.68672
0.649262
43
19.488373
21.629408
82
false
false
0
0
0
0
0
0
0.534884
false
false
10
83e2138049c4635a782a2a12175a559a6386f2a1
31,190,052,549,148
64609e4749069a7654a231c996ceccdb1b4ad7f1
/src/br/unicentro/acaddecomp/Cliente.java
de14147af0f0451318fc3d00cbec7e264d2d9576
[ "Apache-2.0" ]
permissive
Renan4783/Builder
https://github.com/Renan4783/Builder
bd05aef2d3ed36343db5c4667b59c0618171c4b0
0ca6bb5d4c1bb25b093e6be71847a3a9f9bb3b64
refs/heads/master
2020-03-25T16:29:27.159000
2018-08-08T19:30:55
2018-08-08T19:30:55
143,932,966
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.unicentro.acaddecomp; public class Cliente { public static void main(String args[]) { ConstrutorDeCasas cc = new ConstrutorDeCasas(); ConstrutorDePredios cp = new ConstrutorDePredios(); Diretor dir = new Diretor(); dir.setConstrutor(cc); dir.Construir(); dir.setConstrutor(cp); dir.Construir(); } }
UTF-8
Java
327
java
Cliente.java
Java
[]
null
[]
package br.unicentro.acaddecomp; public class Cliente { public static void main(String args[]) { ConstrutorDeCasas cc = new ConstrutorDeCasas(); ConstrutorDePredios cp = new ConstrutorDePredios(); Diretor dir = new Diretor(); dir.setConstrutor(cc); dir.Construir(); dir.setConstrutor(cp); dir.Construir(); } }
327
0.727829
0.727829
13
24.153847
16.454348
53
false
false
0
0
0
0
0
0
1.846154
false
false
10
df9c9d07cea5b1634f7f1381b850a4cea7e6b1cd
5,574,867,568,016
0c12d5d3aa7a8aa36e7b21d1ac2d98d0d12b78c7
/photo/src/Dao/userDao.java
6ad69c9e7a60dea76577b97b03867e7558db4ce1
[]
no_license
softwareCQT/web_camp
https://github.com/softwareCQT/web_camp
8fc57c64af5cb85e49926d562174b089aee4a2a2
cfeb2136dd9a92e0254b388866eac587b94c6623
refs/heads/master
2020-05-03T12:26:20.314000
2020-03-23T09:19:10
2020-03-23T09:19:10
178,626,093
1
0
null
false
2019-03-31T02:43:20
2019-03-31T00:35:46
2019-03-31T02:27:44
2019-03-31T02:43:03
0
0
0
1
C
false
null
package Dao; import java.util.List; import model.User; import model.photo; //用户可以进行的操作 public interface userDao { public boolean update(User Y);// 更改用户信息 public boolean login(String ID,String password);//登陆用户验证 public boolean add(User Y);//增加用户 public boolean IsExist(String ID);//检查用户存不存在 public User query(String ID); //查询个人资料 }
GB18030
Java
464
java
userDao.java
Java
[]
null
[]
package Dao; import java.util.List; import model.User; import model.photo; //用户可以进行的操作 public interface userDao { public boolean update(User Y);// 更改用户信息 public boolean login(String ID,String password);//登陆用户验证 public boolean add(User Y);//增加用户 public boolean IsExist(String ID);//检查用户存不存在 public User query(String ID); //查询个人资料 }
464
0.663212
0.663212
22
16.545454
18.034632
60
false
false
0
0
0
0
0
0
0.454545
false
false
10
572eb4417eb725b7d8824d7d64d5bae7602f9c51
16,234,976,380,483
bc0034c3c778d3affcb2eceeaf280335c343e87f
/components-cms/src/main/java/com/daeliin/components/cms/credentials/account/AccountRepository.java
037a0d32cb7bd9ae24b059eff9d8f6164244aed1
[ "MIT" ]
permissive
Daeliin/framework
https://github.com/Daeliin/framework
b430c63eddb600479d63bf41b29476ededa6f49e
9e9c2fe1029a20ddb490b128acb994570c2add28
refs/heads/master
2020-04-16T02:21:04.325000
2018-06-03T14:40:51
2018-06-03T14:40:51
36,257,050
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.daeliin.components.cms.credentials.account; import com.daeliin.components.cms.sql.BAccount; import com.daeliin.components.cms.sql.QAccount; import com.daeliin.components.persistence.resource.repository.ResourceRepository; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Transactional @Component public class AccountRepository extends ResourceRepository<BAccount, String> { public AccountRepository() { super(QAccount.account, QAccount.account.id, BAccount::getId); } }
UTF-8
Java
567
java
AccountRepository.java
Java
[]
null
[]
package com.daeliin.components.cms.credentials.account; import com.daeliin.components.cms.sql.BAccount; import com.daeliin.components.cms.sql.QAccount; import com.daeliin.components.persistence.resource.repository.ResourceRepository; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Transactional @Component public class AccountRepository extends ResourceRepository<BAccount, String> { public AccountRepository() { super(QAccount.account, QAccount.account.id, BAccount::getId); } }
567
0.818342
0.818342
16
34.4375
29.158979
81
false
false
0
0
0
0
0
0
0.625
false
false
10
42813dadd7dfa7fb18b2bc31ebce79d37d856d6c
19,078,244,730,012
09d0ddd512472a10bab82c912b66cbb13113fcbf
/TestApplications/WhereYouGo-0.9.3-beta/DecompiledCode/Procyon/src/main/java/locus/api/android/ActionDisplayTracks.java
cd7479785c5f27a9f37923e5eb851d2886f1b285
[]
no_license
sgros/activity_flow_plugin
https://github.com/sgros/activity_flow_plugin
bde2de3745d95e8097c053795c9e990c829a88f4
9e59f8b3adacf078946990db9c58f4965a5ccb48
refs/heads/master
2020-06-19T02:39:13.865000
2019-07-08T20:17:28
2019-07-08T20:17:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// // Decompiled by Procyon v0.5.34 // package locus.api.android; import locus.api.objects.Storable; import java.util.List; import android.content.Intent; import locus.api.utils.Logger; import locus.api.android.utils.exceptions.RequiredVersionMissingException; import locus.api.objects.extra.Track; import android.content.Context; public class ActionDisplayTracks extends ActionDisplay { private static final String TAG; static { TAG = ActionDisplayTracks.class.getSimpleName(); } public static boolean sendTrack(final Context context, final Track track, final ExtraAction extraAction) throws RequiredVersionMissingException { return sendTrack("locus.api.android.ACTION_DISPLAY_DATA", context, track, extraAction == ExtraAction.IMPORT, extraAction == ExtraAction.CENTER, false); } public static boolean sendTrack(final Context context, final Track track, final ExtraAction extraAction, final boolean b) throws RequiredVersionMissingException { return sendTrack("locus.api.android.ACTION_DISPLAY_DATA", context, track, extraAction == ExtraAction.IMPORT, extraAction == ExtraAction.CENTER, b); } private static boolean sendTrack(final String str, final Context obj, final Track obj2, final boolean b, final boolean b2, final boolean b3) throws RequiredVersionMissingException { boolean sendData; if (obj2 == null || obj2.getPoints().size() == 0) { Logger.logE(ActionDisplayTracks.TAG, "sendTrack(" + str + ", " + obj + ", " + obj2 + ", " + b + ", " + b2 + ", " + b3 + "), " + "track is null or contain no points"); sendData = false; } else { final Intent intent = new Intent(); intent.putExtra("INTENT_EXTRA_TRACKS_SINGLE", obj2.getAsBytes()); intent.putExtra("INTENT_EXTRA_START_NAVIGATION", b3); sendData = ActionDisplay.sendData(str, obj, intent, b, b2); } return sendData; } public static boolean sendTrackSilent(final Context context, final Track track, final boolean b) throws RequiredVersionMissingException { return sendTrack("locus.api.android.ACTION_DISPLAY_DATA_SILENTLY", context, track, false, b, false); } public static boolean sendTracks(final Context context, final List<Track> list, final ExtraAction extraAction) throws RequiredVersionMissingException { boolean b = true; final boolean b2 = extraAction == ExtraAction.IMPORT; if (extraAction != ExtraAction.CENTER) { b = false; } return sendTracks("locus.api.android.ACTION_DISPLAY_DATA", context, list, b2, b); } private static boolean sendTracks(final String s, final Context context, final List<Track> list, final boolean b, final boolean b2) throws RequiredVersionMissingException { boolean sendData; if (list == null || list.size() == 0) { sendData = false; } else { final Intent intent = new Intent(); intent.putExtra("INTENT_EXTRA_TRACKS_MULTI", Storable.getAsBytes(list)); sendData = ActionDisplay.sendData(s, context, intent, b, b2); } return sendData; } public static boolean sendTracksSilent(final Context context, final List<Track> list, final boolean b) throws RequiredVersionMissingException { return sendTracks("locus.api.android.ACTION_DISPLAY_DATA_SILENTLY", context, list, false, b); } }
UTF-8
Java
3,493
java
ActionDisplayTracks.java
Java
[]
null
[]
// // Decompiled by Procyon v0.5.34 // package locus.api.android; import locus.api.objects.Storable; import java.util.List; import android.content.Intent; import locus.api.utils.Logger; import locus.api.android.utils.exceptions.RequiredVersionMissingException; import locus.api.objects.extra.Track; import android.content.Context; public class ActionDisplayTracks extends ActionDisplay { private static final String TAG; static { TAG = ActionDisplayTracks.class.getSimpleName(); } public static boolean sendTrack(final Context context, final Track track, final ExtraAction extraAction) throws RequiredVersionMissingException { return sendTrack("locus.api.android.ACTION_DISPLAY_DATA", context, track, extraAction == ExtraAction.IMPORT, extraAction == ExtraAction.CENTER, false); } public static boolean sendTrack(final Context context, final Track track, final ExtraAction extraAction, final boolean b) throws RequiredVersionMissingException { return sendTrack("locus.api.android.ACTION_DISPLAY_DATA", context, track, extraAction == ExtraAction.IMPORT, extraAction == ExtraAction.CENTER, b); } private static boolean sendTrack(final String str, final Context obj, final Track obj2, final boolean b, final boolean b2, final boolean b3) throws RequiredVersionMissingException { boolean sendData; if (obj2 == null || obj2.getPoints().size() == 0) { Logger.logE(ActionDisplayTracks.TAG, "sendTrack(" + str + ", " + obj + ", " + obj2 + ", " + b + ", " + b2 + ", " + b3 + "), " + "track is null or contain no points"); sendData = false; } else { final Intent intent = new Intent(); intent.putExtra("INTENT_EXTRA_TRACKS_SINGLE", obj2.getAsBytes()); intent.putExtra("INTENT_EXTRA_START_NAVIGATION", b3); sendData = ActionDisplay.sendData(str, obj, intent, b, b2); } return sendData; } public static boolean sendTrackSilent(final Context context, final Track track, final boolean b) throws RequiredVersionMissingException { return sendTrack("locus.api.android.ACTION_DISPLAY_DATA_SILENTLY", context, track, false, b, false); } public static boolean sendTracks(final Context context, final List<Track> list, final ExtraAction extraAction) throws RequiredVersionMissingException { boolean b = true; final boolean b2 = extraAction == ExtraAction.IMPORT; if (extraAction != ExtraAction.CENTER) { b = false; } return sendTracks("locus.api.android.ACTION_DISPLAY_DATA", context, list, b2, b); } private static boolean sendTracks(final String s, final Context context, final List<Track> list, final boolean b, final boolean b2) throws RequiredVersionMissingException { boolean sendData; if (list == null || list.size() == 0) { sendData = false; } else { final Intent intent = new Intent(); intent.putExtra("INTENT_EXTRA_TRACKS_MULTI", Storable.getAsBytes(list)); sendData = ActionDisplay.sendData(s, context, intent, b, b2); } return sendData; } public static boolean sendTracksSilent(final Context context, final List<Track> list, final boolean b) throws RequiredVersionMissingException { return sendTracks("locus.api.android.ACTION_DISPLAY_DATA_SILENTLY", context, list, false, b); } }
3,493
0.679931
0.673919
75
45.573334
52.404625
185
false
false
0
0
0
0
0
0
1.293333
false
false
10
e82319e1a794265ed85cecbfcc01f22518b75445
23,948,737,689,306
6109564fb8cf01314a71913394c68aac5a1f4ad1
/src/example/Methodoverloading.java
6ea7ab4a61b3aa0cd45d387ae75e9cbb1770d2ce
[]
no_license
gayathri3636/Java-Guide
https://github.com/gayathri3636/Java-Guide
273f2829a651b3a48bc1d98779157d315b6c3243
b2898f7340f36daad13c4ac65db5410d50f6a68f
refs/heads/master
2023-02-07T18:25:44.857000
2020-12-26T04:09:52
2020-12-26T04:09:52
324,240,099
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package example; //When we have same name with multiple methods and different parameters then it is called method overloading class casio{ public void add(int i, int j) { System.out.println(i+j); } public void add(int i, int j, int k) { System.out.println(i+j+k); } public void add(double i, double j) { System.out.println(i+j); } } public class Methodoverloading { public static void main(String args[]) { casio obj = new casio(); obj.add(1, 2); obj.add(4, 3,5); obj.add(4.5, 7.8); } }
UTF-8
Java
510
java
Methodoverloading.java
Java
[]
null
[]
package example; //When we have same name with multiple methods and different parameters then it is called method overloading class casio{ public void add(int i, int j) { System.out.println(i+j); } public void add(int i, int j, int k) { System.out.println(i+j+k); } public void add(double i, double j) { System.out.println(i+j); } } public class Methodoverloading { public static void main(String args[]) { casio obj = new casio(); obj.add(1, 2); obj.add(4, 3,5); obj.add(4.5, 7.8); } }
510
0.672549
0.654902
22
22.181818
23.10379
108
false
false
0
0
0
0
0
0
1.727273
false
false
10
038195c94f22af9a91982fe757a873083c0dd597
30,339,648,993,870
1ff8d295966af7d1a3a75ab318505b90d6532ffa
/CPC/cpc21c1p5/src/cpc21c1p5.java
8287b5ee894b625d006af4fda746acb0a9053c56
[]
no_license
jdabtieu/competitive-programming
https://github.com/jdabtieu/competitive-programming
5488b776ef550178217069064de09d3f61871cb2
2e077f52086c0dfe4aa5af5dad0f632d13ffcace
refs/heads/master
2022-09-16T23:30:24.878000
2022-08-05T13:39:04
2022-08-05T13:39:04
250,604,363
0
0
null
false
2020-10-16T15:52:05
2020-03-27T17:47:50
2020-08-16T16:24:51
2020-10-16T15:52:04
318
0
0
0
Java
false
false
import java.io.*; import java.util.*; public class cpc21c1p5 { /* * Copy-pasting code is NOT cool! Please do not copy and paste my code as a submission to DMOJ. * github.com/jdabtieu/competitive-programming */ static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer in; static ArrayList<Rect> ans = new ArrayList<>(); static int MM = (int) 1e9; public static void main(String[] args) throws Exception { int n = readInt(); int l, r; while (n-- > 0) { int L = 1, R = MM, B = 1, T = MM; l = L; r = R; while (l <= r) { // find left int tmp = (l + r) / 2; System.out.printf("? %d %d %d %d\n", tmp, R, B, T); f(); if (rem(tmp, R, B, T, readInt()) > 0) { L = tmp; l = tmp + 1; } else { r = tmp - 1; } } l = L; r = R; while (l <= r) { // find right int tmp = (l + r) / 2; System.out.printf("? %d %d %d %d\n", L, tmp, B, T); f(); if (rem(L, tmp, B, T, readInt()) > 0) { R = tmp; r = tmp - 1; } else { l = tmp + 1; } } l = B; r = T; while (l <= r) { // find bottom int tmp = (l + r) / 2; System.out.printf("? %d %d %d %d\n", L, R, tmp, T); f(); if (rem(L, R, tmp, T, readInt()) > 0) { B = tmp; l = tmp + 1; } else { r = tmp - 1; } } l = B; r = T; while (l <= r) { // find top int tmp = (l + r) / 2; System.out.printf("? %d %d %d %d\n", L, R, B, tmp); f(); if (rem(L, R, B, tmp, readInt()) > 0) { T = tmp; r = tmp - 1; } else { l = tmp + 1; } } ans.add(new Rect(L, R, B, T)); } System.out.println("!"); for (Rect rect : ans) { System.out.printf("%d %d %d %d\n", rect.l, rect.r, rect.b, rect.t); } } static int rem(int l, int r, int b, int t, int q) throws Exception { if (q == -1) { throw new Exception(); } int cnt = 0; for (Rect rect : ans) { if (rect.l >= l && rect.r <= r && rect.b >= b && rect.t <= t) cnt++; } return q - cnt; } static class Rect { int l, r, b, t; public Rect(int l, int r, int b, int t) { this.l = l; this.r = r; this.b = b; this.t = t; } } static void f() { System.out.flush(); } static String next() throws IOException { while (in == null || !in.hasMoreTokens()) in = new StringTokenizer(br.readLine()); return in.nextToken(); } static long readLong() throws IOException { return Long.parseLong(next()); } static int readInt() throws IOException { return Integer.parseInt(next()); } static double readDouble() throws IOException { return Double.parseDouble(next()); } static char readChar() throws IOException { return next().charAt(0); } static String readLine() throws IOException { return br.readLine(); } }
UTF-8
Java
2,810
java
cpc21c1p5.java
Java
[ { "context": "e my code as a submission to DMOJ.\n\t * github.com/jdabtieu/competitive-programming\n\t */\n\tstatic BufferedRead", "end": 187, "score": 0.9996292591094971, "start": 179, "tag": "USERNAME", "value": "jdabtieu" } ]
null
[]
import java.io.*; import java.util.*; public class cpc21c1p5 { /* * Copy-pasting code is NOT cool! Please do not copy and paste my code as a submission to DMOJ. * github.com/jdabtieu/competitive-programming */ static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer in; static ArrayList<Rect> ans = new ArrayList<>(); static int MM = (int) 1e9; public static void main(String[] args) throws Exception { int n = readInt(); int l, r; while (n-- > 0) { int L = 1, R = MM, B = 1, T = MM; l = L; r = R; while (l <= r) { // find left int tmp = (l + r) / 2; System.out.printf("? %d %d %d %d\n", tmp, R, B, T); f(); if (rem(tmp, R, B, T, readInt()) > 0) { L = tmp; l = tmp + 1; } else { r = tmp - 1; } } l = L; r = R; while (l <= r) { // find right int tmp = (l + r) / 2; System.out.printf("? %d %d %d %d\n", L, tmp, B, T); f(); if (rem(L, tmp, B, T, readInt()) > 0) { R = tmp; r = tmp - 1; } else { l = tmp + 1; } } l = B; r = T; while (l <= r) { // find bottom int tmp = (l + r) / 2; System.out.printf("? %d %d %d %d\n", L, R, tmp, T); f(); if (rem(L, R, tmp, T, readInt()) > 0) { B = tmp; l = tmp + 1; } else { r = tmp - 1; } } l = B; r = T; while (l <= r) { // find top int tmp = (l + r) / 2; System.out.printf("? %d %d %d %d\n", L, R, B, tmp); f(); if (rem(L, R, B, tmp, readInt()) > 0) { T = tmp; r = tmp - 1; } else { l = tmp + 1; } } ans.add(new Rect(L, R, B, T)); } System.out.println("!"); for (Rect rect : ans) { System.out.printf("%d %d %d %d\n", rect.l, rect.r, rect.b, rect.t); } } static int rem(int l, int r, int b, int t, int q) throws Exception { if (q == -1) { throw new Exception(); } int cnt = 0; for (Rect rect : ans) { if (rect.l >= l && rect.r <= r && rect.b >= b && rect.t <= t) cnt++; } return q - cnt; } static class Rect { int l, r, b, t; public Rect(int l, int r, int b, int t) { this.l = l; this.r = r; this.b = b; this.t = t; } } static void f() { System.out.flush(); } static String next() throws IOException { while (in == null || !in.hasMoreTokens()) in = new StringTokenizer(br.readLine()); return in.nextToken(); } static long readLong() throws IOException { return Long.parseLong(next()); } static int readInt() throws IOException { return Integer.parseInt(next()); } static double readDouble() throws IOException { return Double.parseDouble(next()); } static char readChar() throws IOException { return next().charAt(0); } static String readLine() throws IOException { return br.readLine(); } }
2,810
0.517438
0.507473
130
20.615385
19.294632
96
false
false
0
0
0
0
0
0
3.369231
false
false
10
828f69b7e50cfebd8ef1fbf132a2e1c621694dda
19,052,474,975,948
117f5c9435f8477bd0e7b30cea3929d06b039c72
/Java/RMAPI/src/com/dob/resources/SocketIPCHandler.java
5ff994c1dd3e9083365908efe4742b309debd97a
[]
no_license
atmoresume-test/school-stuff
https://github.com/atmoresume-test/school-stuff
0af650c1deb5bee247c85f20d5ea420d2ce7fc1e
7eacb6db2ef89bc1099d472c251614554323b4df
refs/heads/master
2016-09-06T17:56:55.682000
2012-09-04T17:04:34
2012-09-04T17:04:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dob.resources; import com.dob.ipc.*; import com.dob.commands.ResourceReleased; import com.dob.commands.RequestResource; import com.dob.resources.manager.ResourceManager; import com.dob.resources.manager.ResourceManagerRegistry; import com.dob.resources.manager.ResourceManagerRegistryFactory; import java.io.IOException; import java.util.HashMap; import org.davic.resources.ResourceProxy; public class SocketIPCHandler implements IPCConnectorListener, IPCLinkListener, IPCHandler { private static final ResourceManagerRegistry registry = ResourceManagerRegistryFactory.getRegistry(); private final HashMap<IPCLink, ResourceConsumerDelegate> links = new HashMap<IPCLink, ResourceConsumerDelegate>(); private IPCHandlerListener listener; public void setListener(IPCHandlerListener listener) { this.listener = listener; } public void init() { try { new IPCConnector(0, this); } catch (IOException e) { e.printStackTrace(); } } public void newLink(IPCLink link) { if (listener != null) { listener.newLink(); } link.addListener(this); } public boolean newMessage(IPCLink link, Object message) { final ResourceConsumerDelegate consumer = links.get(link); if (message instanceof IPCRequest) { handleRequest((IPCRequest) message, consumer); } if (message instanceof ResourceConsumerDelegate) { if (listener != null) { listener.delegateRecieved((ResourceConsumer) message); } ((ResourceConsumerDelegate) message).setLink(link); links.put(link, (ResourceConsumerDelegate) message); ((ResourceConsumerDelegate) message).setLink(link); } else if (message instanceof ResourceReleased) { if (listener != null) { listener.releaseMessageReceived(); } final ResourceDescriptor descriptor = ((ResourceReleased) message).getDescriptor(); ResourceManager resourceManager = registry.getResourceManager(descriptor.getType()); try { resourceManager.notifyReleased(descriptor); } catch (ResourceException e) { e.printStackTrace(); } } else { return false; } return true; } private void handleRequest(IPCRequest message, ResourceConsumerDelegate consumer) { if (message.getRequest() instanceof RequestResource) { final RequestResource requestResource = (RequestResource) message.getRequest(); if (listener != null) { listener.resourceRequested(requestResource.getResource(), consumer); } ResourceProxy proxy = null; try { ResourceManager resourceManager = registry.getResourceManager(requestResource.getResource().getType()); proxy = resourceManager.reserve(consumer, requestResource.getResource()); } catch (ResourceException e) { e.printStackTrace(); } if (proxy == null) { if (listener != null) { listener.releaseRequestDenied(); } consumer.requestDenied(message.getId()); } else { if (listener != null) { listener.releaseRequestAccepted(); } try { consumer.sendProxy(message.getId(), proxy); } catch (IOException e) { e.printStackTrace(); } } } } }
UTF-8
Java
3,701
java
SocketIPCHandler.java
Java
[]
null
[]
package com.dob.resources; import com.dob.ipc.*; import com.dob.commands.ResourceReleased; import com.dob.commands.RequestResource; import com.dob.resources.manager.ResourceManager; import com.dob.resources.manager.ResourceManagerRegistry; import com.dob.resources.manager.ResourceManagerRegistryFactory; import java.io.IOException; import java.util.HashMap; import org.davic.resources.ResourceProxy; public class SocketIPCHandler implements IPCConnectorListener, IPCLinkListener, IPCHandler { private static final ResourceManagerRegistry registry = ResourceManagerRegistryFactory.getRegistry(); private final HashMap<IPCLink, ResourceConsumerDelegate> links = new HashMap<IPCLink, ResourceConsumerDelegate>(); private IPCHandlerListener listener; public void setListener(IPCHandlerListener listener) { this.listener = listener; } public void init() { try { new IPCConnector(0, this); } catch (IOException e) { e.printStackTrace(); } } public void newLink(IPCLink link) { if (listener != null) { listener.newLink(); } link.addListener(this); } public boolean newMessage(IPCLink link, Object message) { final ResourceConsumerDelegate consumer = links.get(link); if (message instanceof IPCRequest) { handleRequest((IPCRequest) message, consumer); } if (message instanceof ResourceConsumerDelegate) { if (listener != null) { listener.delegateRecieved((ResourceConsumer) message); } ((ResourceConsumerDelegate) message).setLink(link); links.put(link, (ResourceConsumerDelegate) message); ((ResourceConsumerDelegate) message).setLink(link); } else if (message instanceof ResourceReleased) { if (listener != null) { listener.releaseMessageReceived(); } final ResourceDescriptor descriptor = ((ResourceReleased) message).getDescriptor(); ResourceManager resourceManager = registry.getResourceManager(descriptor.getType()); try { resourceManager.notifyReleased(descriptor); } catch (ResourceException e) { e.printStackTrace(); } } else { return false; } return true; } private void handleRequest(IPCRequest message, ResourceConsumerDelegate consumer) { if (message.getRequest() instanceof RequestResource) { final RequestResource requestResource = (RequestResource) message.getRequest(); if (listener != null) { listener.resourceRequested(requestResource.getResource(), consumer); } ResourceProxy proxy = null; try { ResourceManager resourceManager = registry.getResourceManager(requestResource.getResource().getType()); proxy = resourceManager.reserve(consumer, requestResource.getResource()); } catch (ResourceException e) { e.printStackTrace(); } if (proxy == null) { if (listener != null) { listener.releaseRequestDenied(); } consumer.requestDenied(message.getId()); } else { if (listener != null) { listener.releaseRequestAccepted(); } try { consumer.sendProxy(message.getId(), proxy); } catch (IOException e) { e.printStackTrace(); } } } } }
3,701
0.609025
0.608754
102
35.284313
28.869339
119
false
false
0
0
0
0
0
0
0.529412
false
false
10
17676f0ca302fabc2fcc5a1e9b6cb1009c5363dc
10,333,691,338,277
b1af7c61dcea66cb9e94806359818a464879dbe7
/bssv/J564200/com/beone/fedex/beshipments/DeletionControlType.java
dc7c7576e5ece2aa4d3ef6b85e3b2230e1204d2b
[]
no_license
PPatel0212/Java-Web-Services-JDE
https://github.com/PPatel0212/Java-Web-Services-JDE
aa8c17bac68a73db153de903129246bf2d1f06ae
c296873106455f69aa541e45ae73a15756e9a413
refs/heads/master
2022-12-29T18:17:41.801000
2020-10-07T21:09:57
2020-10-07T21:09:57
264,015,732
0
0
null
false
2020-06-22T01:14:32
2020-05-14T20:15:26
2020-06-21T21:17:57
2020-06-22T01:14:31
803
0
0
0
Java
false
false
/** * Generated from schema type t=DeletionControlType@http://www.beone.com/fedex/beshipments */ package be.e1.bssv.J564200.com.beone.fedex.beshipments; import java.util.HashMap; import java.util.Map; import com.bea.xbean.util.XsTypeConverter; public class DeletionControlType implements java.io.Serializable { private java.lang.String value; private static Map map = new HashMap(); protected DeletionControlType(java.lang.String value) { this.value = value; } public static final java.lang.String _delete_ALL_PACKAGES = "DELETE_ALL_PACKAGES"; public static final java.lang.String _delete_ENTIRE_CONSOLIDATION = "DELETE_ENTIRE_CONSOLIDATION"; public static final java.lang.String _delete_ONE_PACKAGE = "DELETE_ONE_PACKAGE"; public static final java.lang.String _legacy = "LEGACY"; public static final DeletionControlType delete_ALL_PACKAGES = new DeletionControlType(_delete_ALL_PACKAGES); public static final DeletionControlType delete_ENTIRE_CONSOLIDATION = new DeletionControlType(_delete_ENTIRE_CONSOLIDATION); public static final DeletionControlType delete_ONE_PACKAGE = new DeletionControlType(_delete_ONE_PACKAGE); public static final DeletionControlType legacy = new DeletionControlType(_legacy); public java.lang.String getValue() { return this.value; } public static DeletionControlType fromValue(java.lang.String value) { if (map.containsKey(value)) return (DeletionControlType) map.get(value); else throw new IllegalArgumentException(); } public static DeletionControlType fromString(String value) { return fromValue(value); } public String toXML() { return XsTypeConverter.printString(this.value).toString(); } public String toString() { return String.valueOf(value); } public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof DeletionControlType)) return false; final DeletionControlType x = (DeletionControlType) obj; if (x.value.equals(value)) return true; return false; } public int hashCode() { return value.hashCode(); } static { map.put(_delete_ALL_PACKAGES, delete_ALL_PACKAGES); map.put(_delete_ENTIRE_CONSOLIDATION, delete_ENTIRE_CONSOLIDATION); map.put(_delete_ONE_PACKAGE, delete_ONE_PACKAGE); map.put(_legacy, legacy); } }
UTF-8
Java
2,327
java
DeletionControlType.java
Java
[]
null
[]
/** * Generated from schema type t=DeletionControlType@http://www.beone.com/fedex/beshipments */ package be.e1.bssv.J564200.com.beone.fedex.beshipments; import java.util.HashMap; import java.util.Map; import com.bea.xbean.util.XsTypeConverter; public class DeletionControlType implements java.io.Serializable { private java.lang.String value; private static Map map = new HashMap(); protected DeletionControlType(java.lang.String value) { this.value = value; } public static final java.lang.String _delete_ALL_PACKAGES = "DELETE_ALL_PACKAGES"; public static final java.lang.String _delete_ENTIRE_CONSOLIDATION = "DELETE_ENTIRE_CONSOLIDATION"; public static final java.lang.String _delete_ONE_PACKAGE = "DELETE_ONE_PACKAGE"; public static final java.lang.String _legacy = "LEGACY"; public static final DeletionControlType delete_ALL_PACKAGES = new DeletionControlType(_delete_ALL_PACKAGES); public static final DeletionControlType delete_ENTIRE_CONSOLIDATION = new DeletionControlType(_delete_ENTIRE_CONSOLIDATION); public static final DeletionControlType delete_ONE_PACKAGE = new DeletionControlType(_delete_ONE_PACKAGE); public static final DeletionControlType legacy = new DeletionControlType(_legacy); public java.lang.String getValue() { return this.value; } public static DeletionControlType fromValue(java.lang.String value) { if (map.containsKey(value)) return (DeletionControlType) map.get(value); else throw new IllegalArgumentException(); } public static DeletionControlType fromString(String value) { return fromValue(value); } public String toXML() { return XsTypeConverter.printString(this.value).toString(); } public String toString() { return String.valueOf(value); } public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof DeletionControlType)) return false; final DeletionControlType x = (DeletionControlType) obj; if (x.value.equals(value)) return true; return false; } public int hashCode() { return value.hashCode(); } static { map.put(_delete_ALL_PACKAGES, delete_ALL_PACKAGES); map.put(_delete_ENTIRE_CONSOLIDATION, delete_ENTIRE_CONSOLIDATION); map.put(_delete_ONE_PACKAGE, delete_ONE_PACKAGE); map.put(_legacy, legacy); } }
2,327
0.743446
0.740438
76
29.618422
33.043022
126
false
false
0
0
0
0
0
0
0.460526
false
false
10
9d4d2e7521133e3545ab6312f3acbb4035e430fe
30,279,519,496,364
5cb4c164228661c4b2c4f8385eacd9a8daecb07c
/src/day16/singlelan/work/Circle.java
7792f7aad9cb1afb310e96832076cb403fd0fa04
[]
no_license
w912042913/java
https://github.com/w912042913/java
14903784caaf08cd39c2ab13c0ba2931bcb4df90
6ff5982d16087ebf256f5d77af4bd970f2c72edd
refs/heads/master
2022-12-07T13:58:10.882000
2020-08-28T01:09:59
2020-08-28T01:09:59
286,726,049
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package day16.singlelan.work; public class Circle extends Shape { private int r; @Override public int getArea() { return super.getArea(); } @Override public int getPer() { return super.getPer(); } @Override public void show() { super.show(); } public Circle(String color, int r) { super(color); this.r = r; } }
UTF-8
Java
406
java
Circle.java
Java
[]
null
[]
package day16.singlelan.work; public class Circle extends Shape { private int r; @Override public int getArea() { return super.getArea(); } @Override public int getPer() { return super.getPer(); } @Override public void show() { super.show(); } public Circle(String color, int r) { super(color); this.r = r; } }
406
0.544335
0.539409
25
15.24
12.407352
40
false
false
0
0
0
0
0
0
0.32
false
false
10
14f930523f394570f73781469ebe2866f7c13cc9
24,326,694,827,479
6de5c6743c1b4f9be6bf28986b5872f370a71b88
/src/main/java/com/formandview/VisualizaHistorico.java
2954e19a23a0ab93dbc3624718962bc67c23101b
[]
no_license
KleitonRufino/projeto-gamificacao-scrumgame
https://github.com/KleitonRufino/projeto-gamificacao-scrumgame
8be94a87a60c356bc1e0dfdbb1cf7a7e2169cc0a
8991a1952daf6969012f9ce4b38c6ed174930503
refs/heads/master
2016-08-12T19:17:00.496000
2016-02-01T04:05:55
2016-02-01T04:05:55
47,306,686
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.formandview; import com.model.Rodada; public class VisualizaHistorico { private VisualizaConquista conquista; private Rodada rodada; public VisualizaHistorico(Rodada rodada, VisualizaConquista conquista) { this.conquista = conquista; this.rodada = rodada; } public VisualizaConquista getConquista() { return conquista; } public void setConquista(VisualizaConquista conquista) { this.conquista = conquista; } public Rodada getRodada() { return rodada; } public void setRodada(Rodada rodada) { this.rodada = rodada; } }
UTF-8
Java
592
java
VisualizaHistorico.java
Java
[]
null
[]
package com.formandview; import com.model.Rodada; public class VisualizaHistorico { private VisualizaConquista conquista; private Rodada rodada; public VisualizaHistorico(Rodada rodada, VisualizaConquista conquista) { this.conquista = conquista; this.rodada = rodada; } public VisualizaConquista getConquista() { return conquista; } public void setConquista(VisualizaConquista conquista) { this.conquista = conquista; } public Rodada getRodada() { return rodada; } public void setRodada(Rodada rodada) { this.rodada = rodada; } }
592
0.719595
0.719595
30
17.733334
19.052443
73
false
false
0
0
0
0
0
0
1.166667
false
false
10
29a9efc02aa975210bd8fa6efdaf1eb867b8ac45
627,065,240,923
a0247da33aaf1a19e2f06bd022202bf6097a00bf
/src/test/java/org/coinex/dex/client/api/ExpiryApiTest.java
f8f6ec31a47517c1922cdc95966888ebe4d01078
[ "BSD-2-Clause" ]
permissive
coinexchain/dex-api-java
https://github.com/coinexchain/dex-api-java
d1f561bda5b899563e280cb06d66d3a31b66686f
a8b8ce18fbc99f776308198131c5fbe660ac0469
refs/heads/master
2022-06-11T04:50:51.741000
2020-05-09T06:18:44
2020-05-09T06:18:44
258,916,782
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * CET-Lite for CoinEx Chain * A REST interface for state queries, transaction generation and broadcasting. * * OpenAPI spec version: 3.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package org.coinex.dex.client.api; import org.coinex.dex.client.ApiException; import org.coinex.dex.client.model.InlineResponse20058; import org.coinex.dex.client.model.InlineResponse20059; import org.coinex.dex.client.model.InlineResponse20060; import org.coinex.dex.client.model.InlineResponse20061; import org.junit.Test; import org.junit.Ignore; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * API tests for ExpiryApi */ @Ignore public class ExpiryApiTest { private final ExpiryApi api = new ExpiryApi(); /** * Query redelegation * * Query delegator&#39;s redelegation-completion info * * @throws ApiException * if the Api call fails */ @Test public void queryRedelegationTest() throws ApiException { String account = null; Long time = null; Long sid = null; Integer count = null; InlineResponse20058 response = api.queryRedelegation(account, time, sid, count); // TODO: test validations } /** * Query Unbonding * * Query delegator&#39;s unbonding-completion info * * @throws ApiException * if the Api call fails */ @Test public void queryUnbondingTest() throws ApiException { String account = null; Long time = null; Long sid = null; Integer count = null; InlineResponse20059 response = api.queryUnbonding(account, time, sid, count); // TODO: test validations } /** * Query Unlock * * Query Unlock info * * @throws ApiException * if the Api call fails */ @Test public void queryUnlockTest() throws ApiException { String account = null; Long time = null; Long sid = null; Integer count = null; String token = null; InlineResponse20061 response = api.queryUnlock(account, time, sid, count, token); // TODO: test validations } /** * Query lock tx * * Query lock transfer info * * @throws ApiException * if the Api call fails */ @Test public void querylockedTest() throws ApiException { String account = null; Long time = null; Long sid = null; Integer count = null; String token = null; InlineResponse20060 response = api.querylocked(account, time, sid, count, token); // TODO: test validations } }
UTF-8
Java
2,869
java
ExpiryApiTest.java
Java
[ { "context": "ger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manu", "end": 261, "score": 0.9996304512023926, "start": 250, "tag": "USERNAME", "value": "swagger-api" } ]
null
[]
/* * CET-Lite for CoinEx Chain * A REST interface for state queries, transaction generation and broadcasting. * * OpenAPI spec version: 3.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package org.coinex.dex.client.api; import org.coinex.dex.client.ApiException; import org.coinex.dex.client.model.InlineResponse20058; import org.coinex.dex.client.model.InlineResponse20059; import org.coinex.dex.client.model.InlineResponse20060; import org.coinex.dex.client.model.InlineResponse20061; import org.junit.Test; import org.junit.Ignore; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * API tests for ExpiryApi */ @Ignore public class ExpiryApiTest { private final ExpiryApi api = new ExpiryApi(); /** * Query redelegation * * Query delegator&#39;s redelegation-completion info * * @throws ApiException * if the Api call fails */ @Test public void queryRedelegationTest() throws ApiException { String account = null; Long time = null; Long sid = null; Integer count = null; InlineResponse20058 response = api.queryRedelegation(account, time, sid, count); // TODO: test validations } /** * Query Unbonding * * Query delegator&#39;s unbonding-completion info * * @throws ApiException * if the Api call fails */ @Test public void queryUnbondingTest() throws ApiException { String account = null; Long time = null; Long sid = null; Integer count = null; InlineResponse20059 response = api.queryUnbonding(account, time, sid, count); // TODO: test validations } /** * Query Unlock * * Query Unlock info * * @throws ApiException * if the Api call fails */ @Test public void queryUnlockTest() throws ApiException { String account = null; Long time = null; Long sid = null; Integer count = null; String token = null; InlineResponse20061 response = api.queryUnlock(account, time, sid, count, token); // TODO: test validations } /** * Query lock tx * * Query lock transfer info * * @throws ApiException * if the Api call fails */ @Test public void querylockedTest() throws ApiException { String account = null; Long time = null; Long sid = null; Integer count = null; String token = null; InlineResponse20060 response = api.querylocked(account, time, sid, count, token); // TODO: test validations } }
2,869
0.623562
0.607529
116
23.732759
21.857042
89
false
false
0
0
0
0
0
0
0.448276
false
false
10
c8606de6f415a71af5891181f7d270741b333267
11,914,239,311,283
f06d74fbb6bb093a4906bbba577a42085a24d4e6
/src/Week3/Tables.java
7fcbb2ef9cdb0051555d63e7e0f1e0311d17ebcc
[]
no_license
martinctl/IntroProg
https://github.com/martinctl/IntroProg
89f8572b96b76747442f561b8b54440233877649
67fe2df861f90333cffa1cdcdb192a39d2bd75fc
refs/heads/master
2023-08-20T17:06:34.970000
2021-10-20T12:29:30
2021-10-20T12:29:30
419,091,071
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Week3; import java.util.Scanner; public class Tables { //private static Scanner input = new Scanner(System.in); public static void main(String[] args) { for(int i = 2; i <= 10; ++i) { System.out.println("Table de " + i + " :"); for(int j = 1; j <= 10; ++j){ System.out.println(" " + j + " x " + i + " = " + i*j); } } } }
UTF-8
Java
413
java
Tables.java
Java
[]
null
[]
package Week3; import java.util.Scanner; public class Tables { //private static Scanner input = new Scanner(System.in); public static void main(String[] args) { for(int i = 2; i <= 10; ++i) { System.out.println("Table de " + i + " :"); for(int j = 1; j <= 10; ++j){ System.out.println(" " + j + " x " + i + " = " + i*j); } } } }
413
0.464891
0.447942
14
28.5
22.648714
73
false
false
0
0
0
0
0
0
0.642857
false
false
10
7afaf0e6f9782be0955a934d1a80aceaece18b04
23,252,953,009,098
6f49c1188efd4a1553f22867a07b9f167122a6a6
/examples/performance-test/jms/client/src/test/java/BenchTest.java
778db24cd91c8a7a9c77ea71bf9c451cef511f9e
[]
no_license
ishabaliyan/CICS-CTG
https://github.com/ishabaliyan/CICS-CTG
50b049cfef1eec1556fe69e0b0d786f45180b4a5
cf76f8747e0009f88b6d022226235ef7d1cf88e4
refs/heads/master
2021-01-20T17:03:08.028000
2010-06-29T07:29:24
2010-06-29T07:29:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import javax.jms.Connection; import javax.jms.Destination; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.QueueConnectionFactory; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Bench test for JMS transport */ public class BenchTest extends TestCase { /** * Create the test case * * @param testName * name of the test case */ public BenchTest(String testName) { super(testName); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite(BenchTest.class); } private String readRequestFile(String fileName){ StringBuffer contents = new StringBuffer(); InputStream iStream = this.getClass().getClassLoader().getResourceAsStream(fileName); BufferedInputStream bufferedInput = null; byte[] buffer = new byte[1024]; try { //Construct the BufferedInputStream object bufferedInput = new BufferedInputStream(iStream); int bytesRead = 0; //Keep reading from the file while there is any content //when the end of the stream has been reached, -1 is returned while ((bytesRead = bufferedInput.read(buffer)) != -1) { //Process the chunk of bytes read //in this case we just construct a String and print it out String chunk = new String(buffer, 0, bytesRead); contents.append(chunk); } } catch (IOException ex) { ex.printStackTrace(); } finally { //Close the BufferedInputStream try { if (bufferedInput != null) bufferedInput.close(); } catch (IOException ex) { ex.printStackTrace(); } } System.out.println("-----------------------Resuest XML----------------------------"); System.out.println("Resuest XML->"+contents); return contents.toString(); } /** * Rigourous Test :-) */ public void test1() throws Exception { try { int noOfThreads = Integer.parseInt(System.getProperty("NO_OF_THREADS")); System.out.println("NO_OF_THREADS : "+noOfThreads); int noOfIterations = Integer.parseInt(System.getProperty("NO_OF_ITERATIONS")); System.out.println("NO_OF_ITERATIONS : "+noOfIterations); int noOfRecords = Integer.parseInt(System.getProperty("NO_OF_RECORDS")); System.out.println("NO_OF_RECORDS : "+noOfRecords); String verbose = System.getProperty("VERBOSE"); System.out.println("VERBOSE : "+verbose); String msgText = null; switch (noOfRecords) { case 10: msgText = readRequestFile("perf-test-command10-request.xml"); break; case 50: msgText = readRequestFile("perf-test-command50-request.xml"); break; case 100: msgText = readRequestFile("perf-test-command100-request.xml"); break; case 500: msgText = readRequestFile("perf-test-command500-request.xml"); break; default: break; } long total_start = System.currentTimeMillis(); for (int i = 0; i < noOfThreads; i++) { TestPerformance test = new TestPerformance(); test.setNoOfIterations(noOfIterations); test.setNoOfRecords(noOfRecords); test.setMessageText(msgText); //Set logging if(verbose.equalsIgnoreCase("true")){ test.setVerbose(true); } Thread thread = new Thread(test); thread.start(); thread.join(); } long total_end = System.currentTimeMillis(); System.out.println("-------------------------------------------------------------"); long total_time = total_end - total_start; double throughput = (noOfIterations*noOfThreads)*1000.0/total_time; System.out.println("benchmark takes "+total_time/1000 + "." + total_time%1000+" seconds"); System.out.println("throughput "+throughput); System.out.println("-------------------------------------------------------------"); }catch (Exception e) { System.out.println("Exception in BenchTest"); e.printStackTrace(); } } public class TestPerformance implements Runnable { private int noOfRecords; private int noOfIterations=1; private Connection connection = null; private Session session = null; private MessageProducer sender = null; private boolean verbose = false; private String messageText; public TestPerformance() throws Exception { init(); } private void init() throws Exception { Properties props = new java.util.Properties(); props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61616"); Context jndiContext = new InitialContext(props); QueueConnectionFactory factory = (QueueConnectionFactory) jndiContext.lookup("ConnectionFactory"); connection = factory.createConnection(); session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); Destination sendDestination = session.createQueue("TEST.FOO"); sender = session.createProducer(sendDestination); connection.start(); } public String getMessageText() { return messageText; } public void setMessageText(String messageText) { this.messageText = messageText; } public boolean isVerbose() { return verbose; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public int getNoOfIterations() { return noOfIterations; } public void setNoOfIterations(int noOfIterations) { this.noOfIterations = noOfIterations; } public int getNoOfRecords() { return noOfRecords; } public void setNoOfRecords(int noOfRecords) { this.noOfRecords = noOfRecords; } public void run() { if(verbose){ System.out.println("In run method"); } for(int i=0;i<noOfIterations;i++){ switch( noOfRecords ){ case 10: perfTestCommand10(); break; case 50: perfTestCommand50(); break; case 100: perfTestCommand100(); break; default: perfTestCommand500(); break; } } destroy(); } public void perfTestCommand10(){ if(verbose){ System.out.println("In perfTestCommand10()"); } try { TextMessage message = session.createTextMessage(); message.setText(messageText); Destination replyToDestination = session.createTemporaryQueue(); long start = System.currentTimeMillis(); message.setJMSReplyTo(replyToDestination); sender.send(message); session.commit(); MessageConsumer receiver = session.createConsumer(message .getJMSReplyTo(), "JMSCorrelationID = '" + message.getJMSMessageID() + "'"); if(verbose){ System.out.println("--------------------------------------------------------------"); } // 同期的にレシーブします。 Message replyMessage = receiver.receive(5000); if (replyMessage != null) { if (replyMessage instanceof TextMessage) { if(verbose){ System.out.println("Reply Message->" + ((TextMessage) replyMessage).getText()); } } } else { if(verbose){ System.out.println("No message"); } } if(verbose){ System.out.println("--------------------------------------------------------------"); } long end = System.currentTimeMillis(); System.out.println("Total time taken for 10 records = " + (end-start) + " milliseconds"); System.out.println("--------------------------------------------------------------"); } catch (Exception ex) { ex.printStackTrace(); } } public void perfTestCommand50(){ if(verbose){ System.out.println("In perfTestCommand50()"); } try { TextMessage message = session.createTextMessage(); message.setText(messageText); Destination replyToDestination = session.createTemporaryQueue(); long start = System.currentTimeMillis(); message.setJMSReplyTo(replyToDestination); sender.send(message); session.commit(); MessageConsumer receiver = session.createConsumer(message .getJMSReplyTo(), "JMSCorrelationID = '" + message.getJMSMessageID() + "'"); if(verbose){ System.out.println("--------------------------------------------------------------"); } // 同期的にレシーブします。 Message replyMessage = receiver.receive(5000); if (replyMessage != null) { if (replyMessage instanceof TextMessage) { if(verbose){ System.out.println("Reply Message->" + ((TextMessage) replyMessage).getText()); } } } else { if(verbose){ System.out.println("No message"); } } if(verbose){ System.out.println("--------------------------------------------------------------"); } long end = System.currentTimeMillis(); System.out.println("Total time taken for50 records = " + (end-start) + " milliseconds"); } catch (Exception ex) { ex.printStackTrace(); } } public void perfTestCommand100(){ if(verbose){ System.out.println("In perfTestCommand100()"); } try { TextMessage message = session.createTextMessage(); message.setText(messageText); Destination replyToDestination = session.createTemporaryQueue(); long start = System.currentTimeMillis(); message.setJMSReplyTo(replyToDestination); sender.send(message); session.commit(); MessageConsumer receiver = session.createConsumer(message .getJMSReplyTo(), "JMSCorrelationID = '" + message.getJMSMessageID() + "'"); if(verbose){ System.out.println("--------------------------------------------------------------"); } // 同期的にレシーブします。 Message replyMessage = receiver.receive(5000); if (replyMessage != null) { if (replyMessage instanceof TextMessage) { if(verbose){ System.out.println("Reply Message->" + ((TextMessage) replyMessage).getText()); } } } else { System.out.println("No message"); } if(verbose){ System.out.println("--------------------------------------------------------------"); } long end = System.currentTimeMillis(); System.out.println("Total time taken for 100 records = " + (end-start) + " milliseconds"); } catch (Exception ex) { ex.printStackTrace(); } } public void perfTestCommand500(){ if(verbose){ System.out.println("In perfTestCommand500()"); } try { TextMessage message = session.createTextMessage(); message.setText(messageText); Destination replyToDestination = session.createTemporaryQueue(); long start = System.currentTimeMillis(); message.setJMSReplyTo(replyToDestination); sender.send(message); session.commit(); MessageConsumer receiver = session.createConsumer(message .getJMSReplyTo(), "JMSCorrelationID = '" + message.getJMSMessageID() + "'"); if(verbose){ System.out.println("--------------------------------------------------------------"); } // 同期的にレシーブします。 Message replyMessage = receiver.receive(5000); if (replyMessage != null) { if (replyMessage instanceof TextMessage) { if(verbose){ System.out.println("Reply Message->" + ((TextMessage) replyMessage).getText()); } } } else { if(verbose){ System.out.println("No message"); } } if(verbose){ System.out.println("--------------------------------------------------------------"); } long end = System.currentTimeMillis(); System.out.println("Total time taken for 500 records = " + (end-start) + " milliseconds"); } catch (Exception ex) { ex.printStackTrace(); } } public void destroy(){ if(verbose){ System.out.println("Closing connection to JMS server.."); } try { if (session != null) { session.close(); } if (connection != null) { connection.close(); } } catch (Exception ex1) { ex1.printStackTrace(); } } } }
SHIFT_JIS
Java
12,810
java
BenchTest.java
Java
[]
null
[]
import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import javax.jms.Connection; import javax.jms.Destination; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.QueueConnectionFactory; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Bench test for JMS transport */ public class BenchTest extends TestCase { /** * Create the test case * * @param testName * name of the test case */ public BenchTest(String testName) { super(testName); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite(BenchTest.class); } private String readRequestFile(String fileName){ StringBuffer contents = new StringBuffer(); InputStream iStream = this.getClass().getClassLoader().getResourceAsStream(fileName); BufferedInputStream bufferedInput = null; byte[] buffer = new byte[1024]; try { //Construct the BufferedInputStream object bufferedInput = new BufferedInputStream(iStream); int bytesRead = 0; //Keep reading from the file while there is any content //when the end of the stream has been reached, -1 is returned while ((bytesRead = bufferedInput.read(buffer)) != -1) { //Process the chunk of bytes read //in this case we just construct a String and print it out String chunk = new String(buffer, 0, bytesRead); contents.append(chunk); } } catch (IOException ex) { ex.printStackTrace(); } finally { //Close the BufferedInputStream try { if (bufferedInput != null) bufferedInput.close(); } catch (IOException ex) { ex.printStackTrace(); } } System.out.println("-----------------------Resuest XML----------------------------"); System.out.println("Resuest XML->"+contents); return contents.toString(); } /** * Rigourous Test :-) */ public void test1() throws Exception { try { int noOfThreads = Integer.parseInt(System.getProperty("NO_OF_THREADS")); System.out.println("NO_OF_THREADS : "+noOfThreads); int noOfIterations = Integer.parseInt(System.getProperty("NO_OF_ITERATIONS")); System.out.println("NO_OF_ITERATIONS : "+noOfIterations); int noOfRecords = Integer.parseInt(System.getProperty("NO_OF_RECORDS")); System.out.println("NO_OF_RECORDS : "+noOfRecords); String verbose = System.getProperty("VERBOSE"); System.out.println("VERBOSE : "+verbose); String msgText = null; switch (noOfRecords) { case 10: msgText = readRequestFile("perf-test-command10-request.xml"); break; case 50: msgText = readRequestFile("perf-test-command50-request.xml"); break; case 100: msgText = readRequestFile("perf-test-command100-request.xml"); break; case 500: msgText = readRequestFile("perf-test-command500-request.xml"); break; default: break; } long total_start = System.currentTimeMillis(); for (int i = 0; i < noOfThreads; i++) { TestPerformance test = new TestPerformance(); test.setNoOfIterations(noOfIterations); test.setNoOfRecords(noOfRecords); test.setMessageText(msgText); //Set logging if(verbose.equalsIgnoreCase("true")){ test.setVerbose(true); } Thread thread = new Thread(test); thread.start(); thread.join(); } long total_end = System.currentTimeMillis(); System.out.println("-------------------------------------------------------------"); long total_time = total_end - total_start; double throughput = (noOfIterations*noOfThreads)*1000.0/total_time; System.out.println("benchmark takes "+total_time/1000 + "." + total_time%1000+" seconds"); System.out.println("throughput "+throughput); System.out.println("-------------------------------------------------------------"); }catch (Exception e) { System.out.println("Exception in BenchTest"); e.printStackTrace(); } } public class TestPerformance implements Runnable { private int noOfRecords; private int noOfIterations=1; private Connection connection = null; private Session session = null; private MessageProducer sender = null; private boolean verbose = false; private String messageText; public TestPerformance() throws Exception { init(); } private void init() throws Exception { Properties props = new java.util.Properties(); props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61616"); Context jndiContext = new InitialContext(props); QueueConnectionFactory factory = (QueueConnectionFactory) jndiContext.lookup("ConnectionFactory"); connection = factory.createConnection(); session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); Destination sendDestination = session.createQueue("TEST.FOO"); sender = session.createProducer(sendDestination); connection.start(); } public String getMessageText() { return messageText; } public void setMessageText(String messageText) { this.messageText = messageText; } public boolean isVerbose() { return verbose; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public int getNoOfIterations() { return noOfIterations; } public void setNoOfIterations(int noOfIterations) { this.noOfIterations = noOfIterations; } public int getNoOfRecords() { return noOfRecords; } public void setNoOfRecords(int noOfRecords) { this.noOfRecords = noOfRecords; } public void run() { if(verbose){ System.out.println("In run method"); } for(int i=0;i<noOfIterations;i++){ switch( noOfRecords ){ case 10: perfTestCommand10(); break; case 50: perfTestCommand50(); break; case 100: perfTestCommand100(); break; default: perfTestCommand500(); break; } } destroy(); } public void perfTestCommand10(){ if(verbose){ System.out.println("In perfTestCommand10()"); } try { TextMessage message = session.createTextMessage(); message.setText(messageText); Destination replyToDestination = session.createTemporaryQueue(); long start = System.currentTimeMillis(); message.setJMSReplyTo(replyToDestination); sender.send(message); session.commit(); MessageConsumer receiver = session.createConsumer(message .getJMSReplyTo(), "JMSCorrelationID = '" + message.getJMSMessageID() + "'"); if(verbose){ System.out.println("--------------------------------------------------------------"); } // 同期的にレシーブします。 Message replyMessage = receiver.receive(5000); if (replyMessage != null) { if (replyMessage instanceof TextMessage) { if(verbose){ System.out.println("Reply Message->" + ((TextMessage) replyMessage).getText()); } } } else { if(verbose){ System.out.println("No message"); } } if(verbose){ System.out.println("--------------------------------------------------------------"); } long end = System.currentTimeMillis(); System.out.println("Total time taken for 10 records = " + (end-start) + " milliseconds"); System.out.println("--------------------------------------------------------------"); } catch (Exception ex) { ex.printStackTrace(); } } public void perfTestCommand50(){ if(verbose){ System.out.println("In perfTestCommand50()"); } try { TextMessage message = session.createTextMessage(); message.setText(messageText); Destination replyToDestination = session.createTemporaryQueue(); long start = System.currentTimeMillis(); message.setJMSReplyTo(replyToDestination); sender.send(message); session.commit(); MessageConsumer receiver = session.createConsumer(message .getJMSReplyTo(), "JMSCorrelationID = '" + message.getJMSMessageID() + "'"); if(verbose){ System.out.println("--------------------------------------------------------------"); } // 同期的にレシーブします。 Message replyMessage = receiver.receive(5000); if (replyMessage != null) { if (replyMessage instanceof TextMessage) { if(verbose){ System.out.println("Reply Message->" + ((TextMessage) replyMessage).getText()); } } } else { if(verbose){ System.out.println("No message"); } } if(verbose){ System.out.println("--------------------------------------------------------------"); } long end = System.currentTimeMillis(); System.out.println("Total time taken for50 records = " + (end-start) + " milliseconds"); } catch (Exception ex) { ex.printStackTrace(); } } public void perfTestCommand100(){ if(verbose){ System.out.println("In perfTestCommand100()"); } try { TextMessage message = session.createTextMessage(); message.setText(messageText); Destination replyToDestination = session.createTemporaryQueue(); long start = System.currentTimeMillis(); message.setJMSReplyTo(replyToDestination); sender.send(message); session.commit(); MessageConsumer receiver = session.createConsumer(message .getJMSReplyTo(), "JMSCorrelationID = '" + message.getJMSMessageID() + "'"); if(verbose){ System.out.println("--------------------------------------------------------------"); } // 同期的にレシーブします。 Message replyMessage = receiver.receive(5000); if (replyMessage != null) { if (replyMessage instanceof TextMessage) { if(verbose){ System.out.println("Reply Message->" + ((TextMessage) replyMessage).getText()); } } } else { System.out.println("No message"); } if(verbose){ System.out.println("--------------------------------------------------------------"); } long end = System.currentTimeMillis(); System.out.println("Total time taken for 100 records = " + (end-start) + " milliseconds"); } catch (Exception ex) { ex.printStackTrace(); } } public void perfTestCommand500(){ if(verbose){ System.out.println("In perfTestCommand500()"); } try { TextMessage message = session.createTextMessage(); message.setText(messageText); Destination replyToDestination = session.createTemporaryQueue(); long start = System.currentTimeMillis(); message.setJMSReplyTo(replyToDestination); sender.send(message); session.commit(); MessageConsumer receiver = session.createConsumer(message .getJMSReplyTo(), "JMSCorrelationID = '" + message.getJMSMessageID() + "'"); if(verbose){ System.out.println("--------------------------------------------------------------"); } // 同期的にレシーブします。 Message replyMessage = receiver.receive(5000); if (replyMessage != null) { if (replyMessage instanceof TextMessage) { if(verbose){ System.out.println("Reply Message->" + ((TextMessage) replyMessage).getText()); } } } else { if(verbose){ System.out.println("No message"); } } if(verbose){ System.out.println("--------------------------------------------------------------"); } long end = System.currentTimeMillis(); System.out.println("Total time taken for 500 records = " + (end-start) + " milliseconds"); } catch (Exception ex) { ex.printStackTrace(); } } public void destroy(){ if(verbose){ System.out.println("Closing connection to JMS server.."); } try { if (session != null) { session.close(); } if (connection != null) { connection.close(); } } catch (Exception ex1) { ex1.printStackTrace(); } } } }
12,810
0.590216
0.58117
402
29.626865
23.869047
101
false
false
0
0
0
0
0
0
3.467662
false
false
10
c7c4171b6c1b2184bbffc6c6d3bc91badc9039de
31,722,628,450,602
bf6ebab7e36025b030db8c704c992f8cc06c45bd
/ProjectHadoopWorkFlowFlightDataProcessing/onTimeScheduleMapper.java
0b061d2e1390170fbebebeb852bb0587e6a11985
[]
no_license
BG97/BigDataHadoop
https://github.com/BG97/BigDataHadoop
8c8b7831c85a958de05e669e7b41c2fcb3f4373a
257aa47051170e9d39d6aff44dc692f33e7adf7b
refs/heads/master
2021-02-09T06:53:03.409000
2020-03-02T01:38:42
2020-03-02T01:38:42
244,254,319
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.IOException; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class OnTimeScheduleMapper extends Mapper<Object, Text, Text, Text> { @Override protected void map(Object key, Text value, Context context) throws IOException, InterruptedException { String[] col = value.toString().split(","); if (!"Year".equals(col[0])) { String onT = "0"; if(!"NA".equals(col[14])){ if (Integer.parseInt(col[14]) <= 20 ) { onT = "1"; } context.write(new Text(col[8]), new Text(onT)); } } } }
UTF-8
Java
566
java
onTimeScheduleMapper.java
Java
[]
null
[]
import java.io.IOException; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class OnTimeScheduleMapper extends Mapper<Object, Text, Text, Text> { @Override protected void map(Object key, Text value, Context context) throws IOException, InterruptedException { String[] col = value.toString().split(","); if (!"Year".equals(col[0])) { String onT = "0"; if(!"NA".equals(col[14])){ if (Integer.parseInt(col[14]) <= 20 ) { onT = "1"; } context.write(new Text(col[8]), new Text(onT)); } } } }
566
0.65371
0.636042
23
23.652174
26.432209
103
false
false
0
0
0
0
0
0
2.347826
false
false
10
34cd3cdadd46afec1dac3dfd0e0492d43b4a9e08
30,751,965,903,054
6077ae856076ed7a6a16da380db13dbf7d25c0fe
/src/main/java/com/auxiliary/Server.java
d037be392a02de42f0e30d9894bdd39fad6136a8
[]
no_license
mynameabc/CustomizeChannel
https://github.com/mynameabc/CustomizeChannel
fc192caf0ac363f0d796d9e13a22b1a98b9844c5
11eae9bfedea0aa4843a57a51a1453182f3fba4f
refs/heads/master
2020-12-02T07:13:06.867000
2020-01-20T08:41:03
2020-01-20T08:41:03
230,928,369
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.auxiliary; import lombok.AllArgsConstructor; import lombok.Data; @Data @AllArgsConstructor public class Server { private String ip; private int weight; public Server(String ip) { super(); this.ip = ip; } @Override public String toString() { return "Server [ip=" + ip + ", weight=" + weight + "]"; } }
UTF-8
Java
333
java
Server.java
Java
[]
null
[]
package com.auxiliary; import lombok.AllArgsConstructor; import lombok.Data; @Data @AllArgsConstructor public class Server { private String ip; private int weight; public Server(String ip) { super(); this.ip = ip; } @Override public String toString() { return "Server [ip=" + ip + ", weight=" + weight + "]"; } }
333
0.672673
0.672673
22
14.136364
13.935878
57
false
false
0
0
0
0
0
0
1.090909
false
false
10
051961c9093740f7a1a3356b63915e9502a3c52f
31,121,333,090,652
47f1103bf1e4d67a0ecef46e2ac02efd189d6da2
/src/main/java/com/example/test/domain/User.java
d9864a96758393c9c15b7af9be1bcda590bb6005
[]
no_license
aluxcode/APIFollowers
https://github.com/aluxcode/APIFollowers
e840af0b1a7c79ec994529d51dc6297483ee4686
1331ebe144d9082ff9df450739e561a1f6a8d5c5
refs/heads/master
2021-07-02T12:02:43.794000
2017-09-25T01:59:51
2017-09-25T01:59:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.test.domain; import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonIgnoreProperties(ignoreUnknown = true) public class User { private String login; @JsonInclude(Include.NON_EMPTY) private List<User> followers; //@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_EMPTY) private List<Repository> repositories; public User( ) { } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public List<User> getFollowers() { return followers; } public void setFollowers(List<User> followers) { this.followers = followers; } public List<Repository> getRepositories() { return repositories; } public void setRepositories(List<Repository> repositories) { this.repositories = repositories; } }
UTF-8
Java
986
java
User.java
Java
[]
null
[]
package com.example.test.domain; import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonIgnoreProperties(ignoreUnknown = true) public class User { private String login; @JsonInclude(Include.NON_EMPTY) private List<User> followers; //@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_EMPTY) private List<Repository> repositories; public User( ) { } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public List<User> getFollowers() { return followers; } public void setFollowers(List<User> followers) { this.followers = followers; } public List<Repository> getRepositories() { return repositories; } public void setRepositories(List<Repository> repositories) { this.repositories = repositories; } }
986
0.731237
0.731237
47
20
19.38633
61
false
false
0
0
0
0
0
0
0.808511
false
false
10
03b2920a9bcd3262e8b846a3cdf986331450d174
1,494,648,652,049
f587dbca0659ebcf6c23a42cfcb23eede689d794
/src/com/application/beans/Birthday.java
d28193fe544ed3beb27fb3090a299c848c23b3e9
[]
no_license
vikalppatelce/broadcast
https://github.com/vikalppatelce/broadcast
9bc68217a507a663fbacbd80f0a2499dd943be36
a67f98ef65877afbe780d7ef2817ddcf05db0b70
refs/heads/master
2016-04-03T02:38:42.069000
2016-03-23T07:15:49
2016-03-23T07:15:49
34,859,045
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.application.beans; import android.os.Parcel; import android.os.Parcelable; /** * @author Vikalp Patel(VikalpPatelCE) * */ public class Birthday implements Parcelable { private String mId; private String mDOB; private String mMonth; private String mYear; private String mReceivedDate; private String mMobile; private String mEmployeeId; private String mCountryCode; private String mBirthdayUserName; private String mBirthdayUserDep; private String mBirthdayUserImage; private String mBirthdayUserCity; private String mBirthdayUserSunSign; private boolean isMale; private String mBirthdayDate; private boolean isWished; private boolean isMessaged; private boolean isRead; private String mBirthdayId; private String mFileType; public Birthday() { super(); // TODO Auto-generated constructor stub } public Birthday(String mId, String mDOB, String mMonth, String mYear, String mReceivedDate, String mMobile, String mEmployeeId, String mCountryCode, String mBirthdayUserName, String mBirthdayUserDep, String mBirthdayUserImage, String mBirthdayUserCity, String mBirthdayUserSunSign, boolean isMale, String mBirthdayDate, boolean isWished, boolean isMessaged, boolean isRead, String mBirthdayId, String mFileType) { super(); this.mId = mId; this.mDOB = mDOB; this.mMonth = mMonth; this.mYear = mYear; this.mReceivedDate = mReceivedDate; this.mMobile = mMobile; this.mEmployeeId = mEmployeeId; this.mCountryCode = mCountryCode; this.mBirthdayUserName = mBirthdayUserName; this.mBirthdayUserDep = mBirthdayUserDep; this.mBirthdayUserImage = mBirthdayUserImage; this.mBirthdayUserCity = mBirthdayUserCity; this.mBirthdayUserSunSign = mBirthdayUserSunSign; this.isMale = isMale; this.mBirthdayDate = mBirthdayDate; this.isWished = isWished; this.isMessaged = isMessaged; this.isRead = isRead; this.mBirthdayId = mBirthdayId; this.mFileType = mFileType; } public String getmId() { return mId; } public void setmId(String mId) { this.mId = mId; } public String getmDOB() { return mDOB; } public void setmDOB(String mDOB) { this.mDOB = mDOB; } public String getmMonth() { return mMonth; } public void setmMonth(String mMonth) { this.mMonth = mMonth; } public String getmYear() { return mYear; } public void setmYear(String mYear) { this.mYear = mYear; } public String getmReceivedDate() { return mReceivedDate; } public void setmReceivedDate(String mReceivedDate) { this.mReceivedDate = mReceivedDate; } public String getmMobile() { return mMobile; } public void setmMobile(String mMobile) { this.mMobile = mMobile; } public String getmEmployeeId() { return mEmployeeId; } public void setmEmployeeId(String mEmployeeId) { this.mEmployeeId = mEmployeeId; } public String getmCountryCode() { return mCountryCode; } public void setmCountryCode(String mCountryCode) { this.mCountryCode = mCountryCode; } public String getmBirthdayUserName() { return mBirthdayUserName; } public void setmBirthdayUserName(String mBirthdayUserName) { this.mBirthdayUserName = mBirthdayUserName; } public String getmBirthdayUserDep() { return mBirthdayUserDep; } public void setmBirthdayUserDep(String mBirthdayUserDep) { this.mBirthdayUserDep = mBirthdayUserDep; } public String getmBirthdayUserImage() { return mBirthdayUserImage; } public void setmBirthdayUserImage(String mBirthdayUserImage) { this.mBirthdayUserImage = mBirthdayUserImage; } public String getmBirthdayUserCity() { return mBirthdayUserCity; } public void setmBirthdayUserCity(String mBirthdayUserCity) { this.mBirthdayUserCity = mBirthdayUserCity; } public String getmBirthdayUserSunSign() { return mBirthdayUserSunSign; } public void setmBirthdayUserSunSign(String mBirthdayUserSunSign) { this.mBirthdayUserSunSign = mBirthdayUserSunSign; } public boolean isMale() { return isMale; } public void setMale(boolean isMale) { this.isMale = isMale; } public String getmBirthdayDate() { return mBirthdayDate; } public void setmBirthdayDate(String mBirthdayDate) { this.mBirthdayDate = mBirthdayDate; } public boolean isWished() { return isWished; } public void setWished(boolean isWished) { this.isWished = isWished; } public boolean isMessaged() { return isMessaged; } public void setMessaged(boolean isMessaged) { this.isMessaged = isMessaged; } public boolean isRead() { return isRead; } public void setRead(boolean isRead) { this.isRead = isRead; } public String getmBirthdayId() { return mBirthdayId; } public void setmBirthdayId(String mBirthdayId) { this.mBirthdayId = mBirthdayId; } public String getmFileType() { return mFileType; } public void setmFileType(String mFileType) { this.mFileType = mFileType; } protected Birthday(Parcel in) { mId = in.readString(); mDOB = in.readString(); mMonth = in.readString(); mYear = in.readString(); mReceivedDate = in.readString(); mMobile = in.readString(); mEmployeeId = in.readString(); mCountryCode = in.readString(); mBirthdayUserName = in.readString(); mBirthdayUserDep = in.readString(); mBirthdayUserImage = in.readString(); mBirthdayUserCity = in.readString(); mBirthdayUserSunSign = in.readString(); isMale = in.readByte() != 0x00; mBirthdayDate = in.readString(); isWished = in.readByte() != 0x00; isMessaged = in.readByte() != 0x00; isRead = in.readByte() != 0x00; mBirthdayId = in.readString(); mFileType = in.readString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(mId); dest.writeString(mDOB); dest.writeString(mMonth); dest.writeString(mYear); dest.writeString(mReceivedDate); dest.writeString(mMobile); dest.writeString(mEmployeeId); dest.writeString(mCountryCode); dest.writeString(mBirthdayUserName); dest.writeString(mBirthdayUserDep); dest.writeString(mBirthdayUserImage); dest.writeString(mBirthdayUserCity); dest.writeString(mBirthdayUserSunSign); dest.writeByte((byte) (isMale ? 0x01 : 0x00)); dest.writeString(mBirthdayDate); dest.writeByte((byte) (isWished ? 0x01 : 0x00)); dest.writeByte((byte) (isMessaged ? 0x01 : 0x00)); dest.writeByte((byte) (isRead ? 0x01 : 0x00)); dest.writeString(mBirthdayId); dest.writeString(mFileType); } @SuppressWarnings("unused") public static final Parcelable.Creator<Birthday> CREATOR = new Parcelable.Creator<Birthday>() { @Override public Birthday createFromParcel(Parcel in) { return new Birthday(in); } @Override public Birthday[] newArray(int size) { return new Birthday[size]; } }; }
UTF-8
Java
7,050
java
Birthday.java
Java
[ { "context": "\r\nimport android.os.Parcelable;\r\n\r\n/**\r\n * @author Vikalp Patel(VikalpPatelCE)\r\n * \r\n */\r\npublic class Birthday i", "end": 137, "score": 0.9998807907104492, "start": 125, "tag": "NAME", "value": "Vikalp Patel" }, { "context": "id.os.Parcelable;\r\n\r\n/**\...
null
[]
/** * */ package com.application.beans; import android.os.Parcel; import android.os.Parcelable; /** * @author <NAME>(VikalpPatelCE) * */ public class Birthday implements Parcelable { private String mId; private String mDOB; private String mMonth; private String mYear; private String mReceivedDate; private String mMobile; private String mEmployeeId; private String mCountryCode; private String mBirthdayUserName; private String mBirthdayUserDep; private String mBirthdayUserImage; private String mBirthdayUserCity; private String mBirthdayUserSunSign; private boolean isMale; private String mBirthdayDate; private boolean isWished; private boolean isMessaged; private boolean isRead; private String mBirthdayId; private String mFileType; public Birthday() { super(); // TODO Auto-generated constructor stub } public Birthday(String mId, String mDOB, String mMonth, String mYear, String mReceivedDate, String mMobile, String mEmployeeId, String mCountryCode, String mBirthdayUserName, String mBirthdayUserDep, String mBirthdayUserImage, String mBirthdayUserCity, String mBirthdayUserSunSign, boolean isMale, String mBirthdayDate, boolean isWished, boolean isMessaged, boolean isRead, String mBirthdayId, String mFileType) { super(); this.mId = mId; this.mDOB = mDOB; this.mMonth = mMonth; this.mYear = mYear; this.mReceivedDate = mReceivedDate; this.mMobile = mMobile; this.mEmployeeId = mEmployeeId; this.mCountryCode = mCountryCode; this.mBirthdayUserName = mBirthdayUserName; this.mBirthdayUserDep = mBirthdayUserDep; this.mBirthdayUserImage = mBirthdayUserImage; this.mBirthdayUserCity = mBirthdayUserCity; this.mBirthdayUserSunSign = mBirthdayUserSunSign; this.isMale = isMale; this.mBirthdayDate = mBirthdayDate; this.isWished = isWished; this.isMessaged = isMessaged; this.isRead = isRead; this.mBirthdayId = mBirthdayId; this.mFileType = mFileType; } public String getmId() { return mId; } public void setmId(String mId) { this.mId = mId; } public String getmDOB() { return mDOB; } public void setmDOB(String mDOB) { this.mDOB = mDOB; } public String getmMonth() { return mMonth; } public void setmMonth(String mMonth) { this.mMonth = mMonth; } public String getmYear() { return mYear; } public void setmYear(String mYear) { this.mYear = mYear; } public String getmReceivedDate() { return mReceivedDate; } public void setmReceivedDate(String mReceivedDate) { this.mReceivedDate = mReceivedDate; } public String getmMobile() { return mMobile; } public void setmMobile(String mMobile) { this.mMobile = mMobile; } public String getmEmployeeId() { return mEmployeeId; } public void setmEmployeeId(String mEmployeeId) { this.mEmployeeId = mEmployeeId; } public String getmCountryCode() { return mCountryCode; } public void setmCountryCode(String mCountryCode) { this.mCountryCode = mCountryCode; } public String getmBirthdayUserName() { return mBirthdayUserName; } public void setmBirthdayUserName(String mBirthdayUserName) { this.mBirthdayUserName = mBirthdayUserName; } public String getmBirthdayUserDep() { return mBirthdayUserDep; } public void setmBirthdayUserDep(String mBirthdayUserDep) { this.mBirthdayUserDep = mBirthdayUserDep; } public String getmBirthdayUserImage() { return mBirthdayUserImage; } public void setmBirthdayUserImage(String mBirthdayUserImage) { this.mBirthdayUserImage = mBirthdayUserImage; } public String getmBirthdayUserCity() { return mBirthdayUserCity; } public void setmBirthdayUserCity(String mBirthdayUserCity) { this.mBirthdayUserCity = mBirthdayUserCity; } public String getmBirthdayUserSunSign() { return mBirthdayUserSunSign; } public void setmBirthdayUserSunSign(String mBirthdayUserSunSign) { this.mBirthdayUserSunSign = mBirthdayUserSunSign; } public boolean isMale() { return isMale; } public void setMale(boolean isMale) { this.isMale = isMale; } public String getmBirthdayDate() { return mBirthdayDate; } public void setmBirthdayDate(String mBirthdayDate) { this.mBirthdayDate = mBirthdayDate; } public boolean isWished() { return isWished; } public void setWished(boolean isWished) { this.isWished = isWished; } public boolean isMessaged() { return isMessaged; } public void setMessaged(boolean isMessaged) { this.isMessaged = isMessaged; } public boolean isRead() { return isRead; } public void setRead(boolean isRead) { this.isRead = isRead; } public String getmBirthdayId() { return mBirthdayId; } public void setmBirthdayId(String mBirthdayId) { this.mBirthdayId = mBirthdayId; } public String getmFileType() { return mFileType; } public void setmFileType(String mFileType) { this.mFileType = mFileType; } protected Birthday(Parcel in) { mId = in.readString(); mDOB = in.readString(); mMonth = in.readString(); mYear = in.readString(); mReceivedDate = in.readString(); mMobile = in.readString(); mEmployeeId = in.readString(); mCountryCode = in.readString(); mBirthdayUserName = in.readString(); mBirthdayUserDep = in.readString(); mBirthdayUserImage = in.readString(); mBirthdayUserCity = in.readString(); mBirthdayUserSunSign = in.readString(); isMale = in.readByte() != 0x00; mBirthdayDate = in.readString(); isWished = in.readByte() != 0x00; isMessaged = in.readByte() != 0x00; isRead = in.readByte() != 0x00; mBirthdayId = in.readString(); mFileType = in.readString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(mId); dest.writeString(mDOB); dest.writeString(mMonth); dest.writeString(mYear); dest.writeString(mReceivedDate); dest.writeString(mMobile); dest.writeString(mEmployeeId); dest.writeString(mCountryCode); dest.writeString(mBirthdayUserName); dest.writeString(mBirthdayUserDep); dest.writeString(mBirthdayUserImage); dest.writeString(mBirthdayUserCity); dest.writeString(mBirthdayUserSunSign); dest.writeByte((byte) (isMale ? 0x01 : 0x00)); dest.writeString(mBirthdayDate); dest.writeByte((byte) (isWished ? 0x01 : 0x00)); dest.writeByte((byte) (isMessaged ? 0x01 : 0x00)); dest.writeByte((byte) (isRead ? 0x01 : 0x00)); dest.writeString(mBirthdayId); dest.writeString(mFileType); } @SuppressWarnings("unused") public static final Parcelable.Creator<Birthday> CREATOR = new Parcelable.Creator<Birthday>() { @Override public Birthday createFromParcel(Parcel in) { return new Birthday(in); } @Override public Birthday[] newArray(int size) { return new Birthday[size]; } }; }
7,044
0.711348
0.706099
295
21.905085
18.449137
96
false
false
0
0
0
0
0
0
1.732203
false
false
10
aa8ef4fc959ee28fa4cce603199d3f3e530395a9
1,795,296,347,241
0b8213d7c87b4e0a15fdb6ce453212b7d3e126c4
/src/main/java/xuyuji/leetcode/Q0098_ValidateBinarySearchTree/Solution1.java
883f05fcc8b5a7df78824d4114c64f18eb836ec7
[]
no_license
xuyuji/LeetCode
https://github.com/xuyuji/LeetCode
2dfdef65e95a5c98d101220a4332785f5b0d9401
512cd59c1c963041a2428a5a47fc758aea934389
refs/heads/master
2021-06-24T04:33:26.764000
2020-07-09T05:45:38
2020-07-09T05:45:38
130,784,325
0
0
null
false
2020-10-12T23:32:48
2018-04-24T02:25:13
2020-07-09T05:45:47
2020-10-12T23:32:46
383
0
0
1
Java
false
false
package xuyuji.leetcode.Q0098_ValidateBinarySearchTree; import xuyuji.leetcode.common.tree.TreeNode; public class Solution1 { public boolean isValidBST(TreeNode root) { if (root == null) { return true; } boolean leftFlag = true; if (root.left != null) { if (maxVal(root.left) >= root.val) { return false; } leftFlag = isValidBST(root.left); } boolean rightFlag = true; if (root.right != null) { if (root.val >= minVal(root.right)) { return false; } rightFlag = isValidBST(root.right); } return leftFlag && rightFlag; } private int maxVal(TreeNode node) { int maxVal = node.val; if (node.left != null) { int leftMaxVal = maxVal(node.left); if (leftMaxVal > maxVal) { maxVal = leftMaxVal; } } if (node.right != null) { int rightMaxVal = maxVal(node.right); if (rightMaxVal > maxVal) { maxVal = rightMaxVal; } } return maxVal; } private int minVal(TreeNode node) { int minVal = node.val; if (node.left != null) { int leftMinVal = minVal(node.left); if (leftMinVal < minVal) { minVal = leftMinVal; } } if (node.right != null) { int rightMinVal = minVal(node.right); if (rightMinVal < minVal) { minVal = rightMinVal; } } return minVal; } }
UTF-8
Java
1,346
java
Solution1.java
Java
[]
null
[]
package xuyuji.leetcode.Q0098_ValidateBinarySearchTree; import xuyuji.leetcode.common.tree.TreeNode; public class Solution1 { public boolean isValidBST(TreeNode root) { if (root == null) { return true; } boolean leftFlag = true; if (root.left != null) { if (maxVal(root.left) >= root.val) { return false; } leftFlag = isValidBST(root.left); } boolean rightFlag = true; if (root.right != null) { if (root.val >= minVal(root.right)) { return false; } rightFlag = isValidBST(root.right); } return leftFlag && rightFlag; } private int maxVal(TreeNode node) { int maxVal = node.val; if (node.left != null) { int leftMaxVal = maxVal(node.left); if (leftMaxVal > maxVal) { maxVal = leftMaxVal; } } if (node.right != null) { int rightMaxVal = maxVal(node.right); if (rightMaxVal > maxVal) { maxVal = rightMaxVal; } } return maxVal; } private int minVal(TreeNode node) { int minVal = node.val; if (node.left != null) { int leftMinVal = minVal(node.left); if (leftMinVal < minVal) { minVal = leftMinVal; } } if (node.right != null) { int rightMinVal = minVal(node.right); if (rightMinVal < minVal) { minVal = rightMinVal; } } return minVal; } }
1,346
0.593611
0.589896
69
17.507246
15.380793
55
false
false
0
0
0
0
0
0
2.188406
false
false
10
e44e7e3b1d35e374d44109b2bacd5b13775d1dd6
33,251,636,818,714
0014b46ef59b3293525032d608dcc3cd12d6e672
/app/src/main/java/com/example/popularmovies/services/MovieService.java
898a01756f3a9d3815fd5b67d304c753b40e395a
[]
no_license
rezagama/popular-movies-2
https://github.com/rezagama/popular-movies-2
143b9a4aa75723bcf57258e948ec6b71f5ce5b2d
ae69bf89a45840cbe55ea7985885f5f536c09057
refs/heads/master
2021-01-15T10:30:34.483000
2017-08-08T16:57:19
2017-08-08T16:57:19
99,584,562
0
0
null
false
2017-08-08T16:53:55
2017-08-07T14:06:04
2017-08-07T14:22:29
2017-08-08T16:53:55
154
0
0
0
Java
null
null
package com.example.popularmovies.services; import com.example.popularmovies.detail.model.MovieReview; import com.example.popularmovies.detail.model.MovieTrailer; import com.example.popularmovies.home.model.Movie; import com.example.popularmovies.network.NetworkCallback; import com.example.popularmovies.network.NetworkService; import rx.Observable; import rx.Subscriber; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by rezagama on 6/30/17. */ public class MovieService { private NetworkService service; public MovieService(NetworkService service) { this.service = service; } public Subscription getMovieList(String sortBy, NetworkCallback<Movie, Throwable> callback){ return service.getMovieList(sortBy) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .onErrorResumeNext(Observable::error) .subscribe(new Subscriber<Movie>() { @Override public void onCompleted() { callback.onCompleted(); } @Override public void onError(Throwable e) { callback.onError(e); } @Override public void onNext(Movie movie) { callback.onSuccess(movie); } }); } public Subscription getMovieTrailers(int movieId, NetworkCallback<MovieTrailer, Throwable> callback){ return service.getMovieTrailers(movieId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .onErrorResumeNext(Observable::error) .subscribe(new Subscriber<MovieTrailer>() { @Override public void onCompleted() { callback.onCompleted(); } @Override public void onError(Throwable e) { callback.onError(e); } @Override public void onNext(MovieTrailer movie) { callback.onSuccess(movie); } }); } public Subscription getMovieReviews(int movieId, NetworkCallback<MovieReview, Throwable> callback){ return service.getMovieReviews(movieId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .onErrorResumeNext(Observable::error) .subscribe(new Subscriber<MovieReview>() { @Override public void onCompleted() { callback.onCompleted(); } @Override public void onError(Throwable e) { callback.onError(e); } @Override public void onNext(MovieReview movie) { callback.onSuccess(movie); } }); } }
UTF-8
Java
3,248
java
MovieService.java
Java
[ { "context": "mport rx.schedulers.Schedulers;\n\n/**\n * Created by rezagama on 6/30/17.\n */\n\npublic class MovieService {\n ", "end": 507, "score": 0.999707818031311, "start": 499, "tag": "USERNAME", "value": "rezagama" } ]
null
[]
package com.example.popularmovies.services; import com.example.popularmovies.detail.model.MovieReview; import com.example.popularmovies.detail.model.MovieTrailer; import com.example.popularmovies.home.model.Movie; import com.example.popularmovies.network.NetworkCallback; import com.example.popularmovies.network.NetworkService; import rx.Observable; import rx.Subscriber; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by rezagama on 6/30/17. */ public class MovieService { private NetworkService service; public MovieService(NetworkService service) { this.service = service; } public Subscription getMovieList(String sortBy, NetworkCallback<Movie, Throwable> callback){ return service.getMovieList(sortBy) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .onErrorResumeNext(Observable::error) .subscribe(new Subscriber<Movie>() { @Override public void onCompleted() { callback.onCompleted(); } @Override public void onError(Throwable e) { callback.onError(e); } @Override public void onNext(Movie movie) { callback.onSuccess(movie); } }); } public Subscription getMovieTrailers(int movieId, NetworkCallback<MovieTrailer, Throwable> callback){ return service.getMovieTrailers(movieId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .onErrorResumeNext(Observable::error) .subscribe(new Subscriber<MovieTrailer>() { @Override public void onCompleted() { callback.onCompleted(); } @Override public void onError(Throwable e) { callback.onError(e); } @Override public void onNext(MovieTrailer movie) { callback.onSuccess(movie); } }); } public Subscription getMovieReviews(int movieId, NetworkCallback<MovieReview, Throwable> callback){ return service.getMovieReviews(movieId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .onErrorResumeNext(Observable::error) .subscribe(new Subscriber<MovieReview>() { @Override public void onCompleted() { callback.onCompleted(); } @Override public void onError(Throwable e) { callback.onError(e); } @Override public void onNext(MovieReview movie) { callback.onSuccess(movie); } }); } }
3,248
0.536638
0.535098
94
33.553192
23.55691
105
false
false
0
0
0
0
0
0
0.329787
false
false
10
e9e2af13eb8429b87c90de22817ff8416bf5e0d4
21,878,563,446,647
2cd44b59dc27c7e7fa17c2e6626e5d9d30a081fd
/src/main/java/com/exercise/encoderDecode/EncoderDecoderFactory.java
0d97ffc2da0c39f5202affc0ab2294b0f61835c8
[]
no_license
udii/base64
https://github.com/udii/base64
f1bf5aadab762da396d291537a91d2ae6f618a06
3663016f588e2f74120f2f2aee0a672084021871
refs/heads/master
2021-01-20T17:19:44.710000
2016-07-31T03:04:44
2016-07-31T03:04:44
63,494,566
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.exercise.encoderDecode; import com.exercise.encoderDecode.custom64.Custom64Decoder; import com.exercise.encoderDecode.custom64.Custom64Encoder; import java.io.Reader; import java.util.HashSet; /** * This class is used to generate encoderes and decoders. * Currenty is supports base-64 encoding and custom-64 encoding */ public class EncoderDecoderFactory { private static final String BASE64_CODE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; private static final String MY_CODE = "1234567890!@#$%^&*()qwertyuiopQWERTYUIOPasdfghjklASDFGHJKLzxcvbn="; //any 65 chars /** * Create a base64 encoder * @return a base64 encoder */ public static EncoderInterface getBase64Encoder() { return new Custom64Encoder(BASE64_CODE); } /** * Create a base64 decoder * @return a base64 decoder */ public static DecoderInterface getBase64Decoder() { return new Custom64Decoder(BASE64_CODE); } public static DecoderInterface getBase64Decoder(String charset) { return new Custom64Decoder(BASE64_CODE, charset); } /** * Create a my64 encoder * @return a my64 encoder */ public static EncoderInterface getMy64Encoder() { return new Custom64Encoder(MY_CODE); } /** * Create a my64 decoder * @return a my64 decoder */ public static DecoderInterface getMy64Decoder() { return new Custom64Decoder(MY_CODE); } /** * Create a 64 encoder with a custom code * @param code 65 char string that represents the code to encode with * @return a custom-64 encoder */ public static EncoderInterface getCustom64Encoder(String code){ assertCode(code); return new Custom64Encoder(code); } /** * Create a 64 decoder with a custom code * @param code 65 char string that represents the code to decode with * @return a custom-64 decoder */ public static DecoderInterface getCustom64Decoder(String code){ assertCode(code); return new Custom64Decoder(code); } /** * verify that the code * @param code * @throws IllegalArgumentException */ private static void assertCode(String code) throws IllegalArgumentException { if (code.length()!=65) { throw new IllegalArgumentException("Code must have 64+1 characters"); } HashSet<Character> set = new HashSet<Character>(); for (char c:code.toCharArray()) { set.add(c); } if (set.size()!=65) { throw new IllegalArgumentException("Code must have 64+1 unique characters"); } } }
UTF-8
Java
2,708
java
EncoderDecoderFactory.java
Java
[]
null
[]
package com.exercise.encoderDecode; import com.exercise.encoderDecode.custom64.Custom64Decoder; import com.exercise.encoderDecode.custom64.Custom64Encoder; import java.io.Reader; import java.util.HashSet; /** * This class is used to generate encoderes and decoders. * Currenty is supports base-64 encoding and custom-64 encoding */ public class EncoderDecoderFactory { private static final String BASE64_CODE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; private static final String MY_CODE = "1234567890!@#$%^&*()qwertyuiopQWERTYUIOPasdfghjklASDFGHJKLzxcvbn="; //any 65 chars /** * Create a base64 encoder * @return a base64 encoder */ public static EncoderInterface getBase64Encoder() { return new Custom64Encoder(BASE64_CODE); } /** * Create a base64 decoder * @return a base64 decoder */ public static DecoderInterface getBase64Decoder() { return new Custom64Decoder(BASE64_CODE); } public static DecoderInterface getBase64Decoder(String charset) { return new Custom64Decoder(BASE64_CODE, charset); } /** * Create a my64 encoder * @return a my64 encoder */ public static EncoderInterface getMy64Encoder() { return new Custom64Encoder(MY_CODE); } /** * Create a my64 decoder * @return a my64 decoder */ public static DecoderInterface getMy64Decoder() { return new Custom64Decoder(MY_CODE); } /** * Create a 64 encoder with a custom code * @param code 65 char string that represents the code to encode with * @return a custom-64 encoder */ public static EncoderInterface getCustom64Encoder(String code){ assertCode(code); return new Custom64Encoder(code); } /** * Create a 64 decoder with a custom code * @param code 65 char string that represents the code to decode with * @return a custom-64 decoder */ public static DecoderInterface getCustom64Decoder(String code){ assertCode(code); return new Custom64Decoder(code); } /** * verify that the code * @param code * @throws IllegalArgumentException */ private static void assertCode(String code) throws IllegalArgumentException { if (code.length()!=65) { throw new IllegalArgumentException("Code must have 64+1 characters"); } HashSet<Character> set = new HashSet<Character>(); for (char c:code.toCharArray()) { set.add(c); } if (set.size()!=65) { throw new IllegalArgumentException("Code must have 64+1 unique characters"); } } }
2,708
0.661004
0.621123
92
28.434782
27.546919
125
false
false
0
0
0
0
65
0.024003
0.228261
false
false
10
524e780e0f99f1ffabc84b24221adf6b7f13684a
395,137,059,209
04bd0b87743573db1dda4332fe20fc790dda271f
/gae/src/main/java/com/chessyoup/configuration/GAEApplicationConfiguration.java
25cd4fcf5f994130b9963497cd16eb2939a3dd28
[]
no_license
chessyoup/platform
https://github.com/chessyoup/platform
c37f66531a71c3d43a7c14c0d643eae21ecc06de
df3a150e7ba6951dd3f2ab303f53b13c0d32a936
refs/heads/master
2016-08-05T16:10:01.385000
2013-10-28T15:10:24
2013-10-28T15:10:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chessyoup.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.chessyoup.util.TokenGenerator; @Configuration public class GAEApplicationConfiguration { @Bean public TokenGenerator getTokenGenerator(){ return new TokenGenerator(); } }
UTF-8
Java
344
java
GAEApplicationConfiguration.java
Java
[]
null
[]
package com.chessyoup.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.chessyoup.util.TokenGenerator; @Configuration public class GAEApplicationConfiguration { @Bean public TokenGenerator getTokenGenerator(){ return new TokenGenerator(); } }
344
0.819767
0.819767
16
20.5
21.22204
60
false
false
0
0
0
0
0
0
0.75
false
false
10
9b8792271ab4b8215458c93cc288abab097c783b
20,418,274,585,307
de26dd656affdadffef35a0ed89d1393eb8f3462
/src/main/java/com/one/clxj/controller/JoinclHandler.java
71bd98619641a27761bf9f4381d6634d43403e41
[]
no_license
gd617205002/clxj
https://github.com/gd617205002/clxj
e139f645279f833236067c73149967349a37d061
abe8d2f593470581725c176c3db69e5328866f4d
refs/heads/master
2023-05-13T17:41:46.152000
2019-06-12T11:47:57
2019-06-12T11:47:57
188,671,344
0
1
null
false
2023-05-01T05:27:56
2019-05-26T10:54:58
2019-06-12T11:48:24
2023-05-01T05:27:56
42,144
0
1
3
JavaScript
false
false
package com.one.clxj.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.one.clxj.pojo.Joincl; import com.one.clxj.pojo.JoinclExample; import com.one.clxj.pojo.Payformonth; import com.one.clxj.pojo.PayformonthExample; import com.one.clxj.service.JoinclSer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.HashMap; import java.util.List; import java.util.Map; @RequestMapping(value = "/Joincl") @Controller public class JoinclHandler { @Autowired private JoinclSer joinclSer; @GetMapping("/findAllJoincl.do") public Map<String,Object> findAllJoincl(Joincl joincl, Integer pageIndex, Integer pageSize){ Map<String,Object> map = new HashMap<String, Object>(); JoinclExample joinclExample = new JoinclExample(); JoinclExample.Criteria criteria = joinclExample.createCriteria(); if (joincl!=null){ if (joincl.getClname()!=null&&!"".equals(joincl.getClname())) criteria.andClnameLike(joincl.getClname()); if (joincl.getJoinstatus()!=null&&!"".equals(joincl.getJoinstatus())) criteria.andJoinstatusEqualTo(joincl.getJoinstatus()); } PageHelper.startPage(pageIndex,pageSize); List<Joincl> list = joinclSer.selectByExample(joinclExample); PageInfo<Joincl> pageInfo = new PageInfo<Joincl>(list); map.put("total",pageInfo.getTotal()); map.put("rows",pageInfo.getList()); return map; } /** * 加盟查询 */ @RequestMapping("/userJPquery.do") @ResponseBody public Map<String,Object> userJPquery(int page, Joincl joincl){ System.out.println("订单查询:"+page+" "+joincl); int pageSize = 2; //显示记录数 Map<String,Object> map = new HashMap<>(); JoinclExample joinclExample = new JoinclExample(); joinclExample.createCriteria().andUidEqualTo(joincl.getReguser().getId()); //加入用户编号 PageHelper.startPage(page,pageSize); List<Joincl> list = joinclSer.selectByExample(joinclExample); PageInfo pageInfo = new PageInfo(list); map.put("data",pageInfo.getList()); map.put("pages",pageInfo.getPages()); System.out.println("map:"+map); return map; } }
UTF-8
Java
2,573
java
JoinclHandler.java
Java
[]
null
[]
package com.one.clxj.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.one.clxj.pojo.Joincl; import com.one.clxj.pojo.JoinclExample; import com.one.clxj.pojo.Payformonth; import com.one.clxj.pojo.PayformonthExample; import com.one.clxj.service.JoinclSer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.HashMap; import java.util.List; import java.util.Map; @RequestMapping(value = "/Joincl") @Controller public class JoinclHandler { @Autowired private JoinclSer joinclSer; @GetMapping("/findAllJoincl.do") public Map<String,Object> findAllJoincl(Joincl joincl, Integer pageIndex, Integer pageSize){ Map<String,Object> map = new HashMap<String, Object>(); JoinclExample joinclExample = new JoinclExample(); JoinclExample.Criteria criteria = joinclExample.createCriteria(); if (joincl!=null){ if (joincl.getClname()!=null&&!"".equals(joincl.getClname())) criteria.andClnameLike(joincl.getClname()); if (joincl.getJoinstatus()!=null&&!"".equals(joincl.getJoinstatus())) criteria.andJoinstatusEqualTo(joincl.getJoinstatus()); } PageHelper.startPage(pageIndex,pageSize); List<Joincl> list = joinclSer.selectByExample(joinclExample); PageInfo<Joincl> pageInfo = new PageInfo<Joincl>(list); map.put("total",pageInfo.getTotal()); map.put("rows",pageInfo.getList()); return map; } /** * 加盟查询 */ @RequestMapping("/userJPquery.do") @ResponseBody public Map<String,Object> userJPquery(int page, Joincl joincl){ System.out.println("订单查询:"+page+" "+joincl); int pageSize = 2; //显示记录数 Map<String,Object> map = new HashMap<>(); JoinclExample joinclExample = new JoinclExample(); joinclExample.createCriteria().andUidEqualTo(joincl.getReguser().getId()); //加入用户编号 PageHelper.startPage(page,pageSize); List<Joincl> list = joinclSer.selectByExample(joinclExample); PageInfo pageInfo = new PageInfo(list); map.put("data",pageInfo.getList()); map.put("pages",pageInfo.getPages()); System.out.println("map:"+map); return map; } }
2,573
0.691913
0.691519
74
33.270271
26.043777
96
false
false
0
0
0
0
0
0
0.72973
false
false
10
fe9bda31ef14d9f9f86a038d8c0d05a1b10d54a5
27,315,992,022,170
7f23509f3cce358b7ae530687c100a243d8d0ed9
/airtime/airtime2/epay/src/test/java/com/mbv/airtime2/epay/AppTest.java
8f178a959eb240b5ad7098f024137b9f8e073f44
[]
no_license
zhaobingss/nds
https://github.com/zhaobingss/nds
3275ae04956f65399d3ce0d9b495abfe530add8b
5f65011e3a59c6efe3d2b34c1d9566ca905b368b
refs/heads/master
2020-07-08T20:43:11.111000
2015-08-03T15:05:17
2015-08-03T15:05:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mbv.airtime2.epay; import java.util.Scanner; import org.springframework.context.support.ClassPathXmlApplicationContext; public class AppTest { public static void main(String[] args){ System.out.println("Sin Sun"); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("TestContext.xml"); EpayService epayService = (EpayService) context.getBean("EpayService"); // try { // Thread.sleep(5000); // } catch (InterruptedException e1) { // // TODO Auto-generated catch block // e1.printStackTrace(); // } // // final Scanner scanner = new Scanner(System.in); // while (true) { // final String input = scanner.nextLine(); // if("q".equals(input.trim())) break; // } // scanner.close(); // // context.close(); // System.out.println("MDoneq"); } }
UTF-8
Java
822
java
AppTest.java
Java
[]
null
[]
package com.mbv.airtime2.epay; import java.util.Scanner; import org.springframework.context.support.ClassPathXmlApplicationContext; public class AppTest { public static void main(String[] args){ System.out.println("Sin Sun"); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("TestContext.xml"); EpayService epayService = (EpayService) context.getBean("EpayService"); // try { // Thread.sleep(5000); // } catch (InterruptedException e1) { // // TODO Auto-generated catch block // e1.printStackTrace(); // } // // final Scanner scanner = new Scanner(System.in); // while (true) { // final String input = scanner.nextLine(); // if("q".equals(input.trim())) break; // } // scanner.close(); // // context.close(); // System.out.println("MDoneq"); } }
822
0.682482
0.673966
32
24.6875
24.557888
100
false
false
0
0
0
0
0
0
1.71875
false
false
10
a62e2fc16180a737675d4fd216f4226420b06283
5,257,039,999,647
5e342346a2cf6e9933008872aed0fc436c44b3f7
/app/src/main/java/com/cooldoctors/cdeye/constants/EnvironmentData.java
49b592eb0bbee6b9c4df2858d40a05cc6cc98177
[]
no_license
shruti-cupertino/VisionApp_SamsungDex
https://github.com/shruti-cupertino/VisionApp_SamsungDex
dbf09b00f78f845eb474aa276d26197329d9a923
d0153e917c9e9bb7884cc48b23f92f2c71d894f2
refs/heads/master
2020-09-12T09:35:48.698000
2019-11-21T13:07:46
2019-11-21T13:07:46
222,383,457
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cooldoctors.cdeye.constants; import static com.cooldoctors.cdeye.constants.ServiceConstants.DEV_IP; import static com.cooldoctors.cdeye.constants.ServiceConstants.DEV_PORT; public class EnvironmentData { public static String ENVIRONMENT_PORT = DEV_PORT; public static String ENVIRONMENT_IP = DEV_IP; }
UTF-8
Java
326
java
EnvironmentData.java
Java
[]
null
[]
package com.cooldoctors.cdeye.constants; import static com.cooldoctors.cdeye.constants.ServiceConstants.DEV_IP; import static com.cooldoctors.cdeye.constants.ServiceConstants.DEV_PORT; public class EnvironmentData { public static String ENVIRONMENT_PORT = DEV_PORT; public static String ENVIRONMENT_IP = DEV_IP; }
326
0.800614
0.800614
11
28.636364
28.243334
72
false
false
0
0
0
0
0
0
0.454545
false
false
10
7e7e0d6e4361be3f05eb062f38aae59788b74c68
17,729,625,061,424
cd4592ce2a73f3425ba6c25bdc0fc0a3dbebe96e
/src/interfaces/TextFunkifier.java
25acffd505fecefa551ed08ed78478af3f087607
[]
no_license
dalidog/L3_Module_3
https://github.com/dalidog/L3_Module_3
2498c43d68dc2a8407d3aba392c442c8decbcafd
a52808f8fe073c032db5696d821850159aab2103
refs/heads/master
2021-09-03T08:51:58.446000
2018-01-07T19:30:22
2018-01-07T19:30:22
113,777,386
0
0
null
true
2017-12-10T19:32:01
2017-12-10T19:32:01
2017-11-10T21:38:08
2017-11-19T20:44:28
9
0
0
0
null
false
null
package interfaces; public interface TextFunkifier { public abstract String funkifyText(String s) ; }
UTF-8
Java
106
java
TextFunkifier.java
Java
[]
null
[]
package interfaces; public interface TextFunkifier { public abstract String funkifyText(String s) ; }
106
0.783019
0.783019
6
16.666666
17.931971
47
false
false
0
0
0
0
0
0
0.5
false
false
10
d0205ca57bf421a96fa937e385f9d1ace2054e39
22,351,009,819,058
3b3b7bb76f22c752afd085460c869d1c01e6ed91
/EMF/src/client/gov/epa/emissions/framework/client/fast/datasets/FastDatasetPresenter.java
91e3def7e2078d5701d7297c7cefdf029e168f0c
[]
no_license
USEPA-OAQPS/emf
https://github.com/USEPA-OAQPS/emf
8400322dd89b79350d0bdd89ce1635e9e6fa333d
0362121b47c430b27ab73ff798dc5e55dd28547e
refs/heads/master
2022-07-15T22:42:26.104000
2022-06-26T18:34:22
2022-06-26T18:34:22
18,827,110
4
4
null
false
2018-02-28T09:25:40
2014-04-16T04:39:06
2017-10-11T00:40:38
2018-02-28T09:25:40
155,563
1
4
11
Java
false
null
package gov.epa.emissions.framework.client.fast.datasets; import gov.epa.emissions.commons.data.DatasetType; import gov.epa.emissions.commons.db.version.Version; import gov.epa.emissions.framework.services.EmfException; import gov.epa.emissions.framework.services.data.EmfDataset; public interface FastDatasetPresenter { void doDisplay() throws EmfException; void doClose() throws EmfException; void doSave() throws EmfException; void fireTracking(); boolean hasResults(); DatasetType getDatasetType(String dataset) throws EmfException; Version[] getVersions(EmfDataset dataset) throws EmfException; }
UTF-8
Java
639
java
FastDatasetPresenter.java
Java
[]
null
[]
package gov.epa.emissions.framework.client.fast.datasets; import gov.epa.emissions.commons.data.DatasetType; import gov.epa.emissions.commons.db.version.Version; import gov.epa.emissions.framework.services.EmfException; import gov.epa.emissions.framework.services.data.EmfDataset; public interface FastDatasetPresenter { void doDisplay() throws EmfException; void doClose() throws EmfException; void doSave() throws EmfException; void fireTracking(); boolean hasResults(); DatasetType getDatasetType(String dataset) throws EmfException; Version[] getVersions(EmfDataset dataset) throws EmfException; }
639
0.787167
0.787167
23
26.782608
25.55294
67
false
false
0
0
0
0
0
0
0.521739
false
false
10
31d4121ecb1b1d17aa58f5e5b2fe2162c1b79825
28,836,410,486,325
323606a6dc11521c05d10580716fb6245d09270a
/src/kata2/CalculateHistogram.java
d6bb3d694d3599226c1209d4a8e4dc4e8905b222
[]
no_license
IndraGonzalez/Practica2
https://github.com/IndraGonzalez/Practica2
41642dce39d9816436778492f65fb23399d92c54
e5fb3770bef5287955ac7644f97f42c0483278df
refs/heads/master
2021-01-10T17:51:38.060000
2015-12-28T16:55:42
2015-12-28T16:55:42
48,701,220
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kata2; public class CalculateHistogram { public static <T> Histogram <T> computeHistogram (T[] vector){ Histogram <T> histogram = new Histogram<>(); for(T key : vector){ histogram.increment(key); } return histogram; } }
UTF-8
Java
298
java
CalculateHistogram.java
Java
[]
null
[]
package kata2; public class CalculateHistogram { public static <T> Histogram <T> computeHistogram (T[] vector){ Histogram <T> histogram = new Histogram<>(); for(T key : vector){ histogram.increment(key); } return histogram; } }
298
0.560403
0.557047
13
22
19.740625
66
false
false
0
0
0
0
0
0
0.307692
false
false
10
8aa966164d2ba07c2b17912ff3d833d31d22cb12
27,419,071,237,071
c4aa9966fab95dfbdf8c1ec2ff265f4a4d425900
/src/main/java/com/alibaba/druid/mock/MockPreparedStatement.java
e207bdd6710eb73e3c9bdf34f7395a3e96fbffeb
[ "Apache-2.0" ]
permissive
zhujunxxxxx/druid_procedure
https://github.com/zhujunxxxxx/druid_procedure
9d1f07bd87e83329c0a716dc2276be756a91887a
811a8e3834ebeae88f130c05f26e6965ee4a3440
refs/heads/master
2021-01-10T01:47:40.326000
2015-12-04T14:54:09
2015-12-04T14:54:09
45,390,421
3
2
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 1999-2101 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.druid.mock; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import com.alibaba.druid.util.jdbc.PreparedStatementBase; public class MockPreparedStatement extends PreparedStatementBase implements MockStatementBase, PreparedStatement { private final String sql; public MockPreparedStatement(MockConnection conn, String sql){ super(conn); this.sql = sql; } public String getSql() { return sql; } public MockConnection getConnection() throws SQLException { return (MockConnection) super.getConnection(); } @Override public ResultSet executeQuery() throws SQLException { checkOpen(); MockConnection conn = getConnection(); if (conn != null && conn.getDriver() != null) { return conn.getDriver().executeQuery(this, sql); } if (conn != null) { conn.handleSleep(); return conn.getDriver().createMockResultSet(this); } return new MockResultSet(this); } @Override public int executeUpdate() throws SQLException { checkOpen(); if (getConnection() != null) { getConnection().handleSleep(); } return 0; } @Override public boolean execute() throws SQLException { checkOpen(); if (getConnection() != null) { getConnection().handleSleep(); } return false; } @Override public ResultSet getResultSet() throws SQLException { checkOpen(); if (resultSet == null) { resultSet = this.getConnection().getDriver().createResultSet(this); } return resultSet; } }
UTF-8
Java
2,413
java
MockPreparedStatement.java
Java
[]
null
[]
/* * Copyright 1999-2101 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.druid.mock; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import com.alibaba.druid.util.jdbc.PreparedStatementBase; public class MockPreparedStatement extends PreparedStatementBase implements MockStatementBase, PreparedStatement { private final String sql; public MockPreparedStatement(MockConnection conn, String sql){ super(conn); this.sql = sql; } public String getSql() { return sql; } public MockConnection getConnection() throws SQLException { return (MockConnection) super.getConnection(); } @Override public ResultSet executeQuery() throws SQLException { checkOpen(); MockConnection conn = getConnection(); if (conn != null && conn.getDriver() != null) { return conn.getDriver().executeQuery(this, sql); } if (conn != null) { conn.handleSleep(); return conn.getDriver().createMockResultSet(this); } return new MockResultSet(this); } @Override public int executeUpdate() throws SQLException { checkOpen(); if (getConnection() != null) { getConnection().handleSleep(); } return 0; } @Override public boolean execute() throws SQLException { checkOpen(); if (getConnection() != null) { getConnection().handleSleep(); } return false; } @Override public ResultSet getResultSet() throws SQLException { checkOpen(); if (resultSet == null) { resultSet = this.getConnection().getDriver().createResultSet(this); } return resultSet; } }
2,413
0.636138
0.63075
92
25.22826
25.09638
114
false
false
0
0
0
0
0
0
0.358696
false
false
10
e580c31d0858a65147f02747081efe61b00ca0cb
21,698,174,846,953
301fde9892496c2a1c1caccc71abe5c5691e66f0
/src/main/java/bb/dominio/repo/RepoLivro.java
40768c7d3de15773e68655888078378774364f6e
[]
no_license
lgalvao/BootBooks
https://github.com/lgalvao/BootBooks
85b0171585065b6a95246eb30debcbe25673fa42
12045a7f12972efe27e722e64c17dfefa11a5616
refs/heads/master
2021-04-24T06:38:15.095000
2020-04-10T18:37:38
2020-04-10T18:37:38
250,094,503
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package bb.dominio.repo; import bb.dominio.Livro; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface RepoLivro extends JpaRepository<Livro, Long> { }
UTF-8
Java
242
java
RepoLivro.java
Java
[]
null
[]
package bb.dominio.repo; import bb.dominio.Livro; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface RepoLivro extends JpaRepository<Livro, Long> { }
242
0.830579
0.830579
9
25.888889
24.342211
63
false
false
0
0
0
0
0
0
0.555556
false
false
10
16797161e0d84f6d2b58954a28e194fcf8cf9058
23,106,924,063,127
a69654b9c3e3e57e1121035bddda2084b2633cf6
/src/main/java/com/qdu/dao/EmployeeDao.java
8b254f9c8fbe4bbc58d2fda7eb2a791fe95a0408
[]
no_license
BUGBobo/AntLogistics
https://github.com/BUGBobo/AntLogistics
c2d108df1a9d96952e9154f6fa2b2ae482f21ec7
20789ea6bffdc22a166d5bd15a7fce41c92cccaa
refs/heads/master
2018-10-05T14:21:23.857000
2018-06-21T02:13:35
2018-06-21T02:13:35
133,950,186
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.qdu.dao; import com.qdu.entity.Employee; import com.qdu.util.PageQueryUtil; import java.util.List; public interface EmployeeDao { //登陆 Employee findEmployee(String UserName); String findEmployeeNickName (String UserName); Employee findEmployee(String UserName, String Password); Employee findEmployee(int emId); List<Integer> findEmployeeByDepId(int depId); List<Integer> findEmployeeByPosId(int posId); String saveEmployee(Employee employee); PageQueryUtil findAll(int page); PageQueryUtil findEmployeeByCase(Employee employee,int page); String deleteById(int emID); String logicalDelete(int emID); String update(Employee employee); String changePassword(String userName,String oldPassword,String newPassword); }
UTF-8
Java
794
java
EmployeeDao.java
Java
[ { "context": "oyee employee);\n\n\n String changePassword(String userName,String oldPassword,String newPassword);\n}\n", "end": 746, "score": 0.8722046613693237, "start": 738, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.qdu.dao; import com.qdu.entity.Employee; import com.qdu.util.PageQueryUtil; import java.util.List; public interface EmployeeDao { //登陆 Employee findEmployee(String UserName); String findEmployeeNickName (String UserName); Employee findEmployee(String UserName, String Password); Employee findEmployee(int emId); List<Integer> findEmployeeByDepId(int depId); List<Integer> findEmployeeByPosId(int posId); String saveEmployee(Employee employee); PageQueryUtil findAll(int page); PageQueryUtil findEmployeeByCase(Employee employee,int page); String deleteById(int emID); String logicalDelete(int emID); String update(Employee employee); String changePassword(String userName,String oldPassword,String newPassword); }
794
0.762025
0.762025
27
28.25926
22.903328
82
false
false
0
0
0
0
0
0
0.777778
false
false
10
8556fcdd7aab58b02f8628298c0f43353b8d82a4
2,860,448,275,548
268238e7014e96c7c2dd9b30e1f6b4fdc9c42746
/src/main/java/com/accenture/pay/gateway/service/AccountService.java
cb75b0464736a5e9bb113d91a8d0281bd2744c1c
[]
no_license
khsergvl/gateway_java
https://github.com/khsergvl/gateway_java
441aadf1ed0bd1d4c9ef5f8d6ac67a48ce8741a5
c66c62ceae18f2109ac7cdb3da2d0af0cbc8a7ea
refs/heads/master
2023-08-29T15:29:49.963000
2021-10-30T14:10:02
2021-10-30T14:12:43
422,895,236
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.accenture.pay.gateway.service; import com.accenture.pay.gateway.entity.Account; import com.accenture.pay.gateway.model.Status; public interface AccountService { Account getAccount(Integer id); Status transfer(Integer from, Integer to, Double amount, Runnable runnable); }
UTF-8
Java
294
java
AccountService.java
Java
[]
null
[]
package com.accenture.pay.gateway.service; import com.accenture.pay.gateway.entity.Account; import com.accenture.pay.gateway.model.Status; public interface AccountService { Account getAccount(Integer id); Status transfer(Integer from, Integer to, Double amount, Runnable runnable); }
294
0.792517
0.792517
9
31.666666
25.547342
80
false
false
0
0
0
0
0
0
0.888889
false
false
10
3205aac10abc2567480e67405736e0c4560734d0
30,923,764,601,449
057ce81b143821c6425ab033a8e51646dd008194
/cassandra-scheduler/src/main/java/com/mesosphere/dcos/cassandra/scheduler/health/ServersCheck.java
92a2a6e502c12273b51c3064bbe84e316fd1c09c
[ "Apache-2.0" ]
permissive
adobe-mds/dcos-cassandra-service
https://github.com/adobe-mds/dcos-cassandra-service
3c2d7c3ce7207515fd036e95ff580500b36a7703
bc6cf58b21a9050fbceba487f648d56f4a418168
refs/heads/master
2021-01-19T20:04:04.108000
2017-12-11T13:39:43
2017-12-11T13:39:43
88,483,831
0
12
Apache-2.0
true
2017-12-11T11:39:32
2017-04-17T07:35:23
2017-05-01T12:27:41
2017-12-11T11:39:32
174,878
0
9
1
Java
false
null
package com.mesosphere.dcos.cassandra.scheduler.health; import com.codahale.metrics.health.HealthCheck; import com.google.common.base.Joiner; import com.google.inject.Inject; import com.mesosphere.dcos.cassandra.common.tasks.CassandraState; import java.util.List; import java.util.stream.Collectors; public class ServersCheck extends HealthCheck { public static final String NAME = "serverCount"; private CassandraState tasks; @Inject public ServersCheck(final CassandraState tasks) { this.tasks = tasks; } @Override protected Result check() throws Exception { List<String> terminated = tasks.getDaemons().values() .stream() .filter(task -> task.isTerminated()) .map(task -> task.getName()) .collect(Collectors.toList()); return terminated.isEmpty() ? Result.healthy("All Cassandra nodes running") : Result.unhealthy("Unhealthy nodes = " + Joiner.on(",").join(terminated)); } }
UTF-8
Java
1,179
java
ServersCheck.java
Java
[]
null
[]
package com.mesosphere.dcos.cassandra.scheduler.health; import com.codahale.metrics.health.HealthCheck; import com.google.common.base.Joiner; import com.google.inject.Inject; import com.mesosphere.dcos.cassandra.common.tasks.CassandraState; import java.util.List; import java.util.stream.Collectors; public class ServersCheck extends HealthCheck { public static final String NAME = "serverCount"; private CassandraState tasks; @Inject public ServersCheck(final CassandraState tasks) { this.tasks = tasks; } @Override protected Result check() throws Exception { List<String> terminated = tasks.getDaemons().values() .stream() .filter(task -> task.isTerminated()) .map(task -> task.getName()) .collect(Collectors.toList()); return terminated.isEmpty() ? Result.healthy("All Cassandra nodes running") : Result.unhealthy("Unhealthy nodes = " + Joiner.on(",").join(terminated)); } }
1,179
0.582697
0.582697
33
34.727272
25.618734
78
false
false
0
0
0
0
0
0
0.393939
false
false
10
5bf7d7421248e58434b950caf7c3329fd26fbc67
32,865,089,811,661
94df1636ebb8a1e67158abd88a83c83b46e2f202
/src/main/java/com/baizhi/controller/UserFrontController.java
389a7cabcb64eaa536f60542fa749870014541a1
[]
no_license
Halashou/cmfz
https://github.com/Halashou/cmfz
1c36a38dfa66009c07c74357dd3793fa94c16105
b4eb5faa63167dd9965165fda9fc3968c2517350
refs/heads/master
2022-07-01T11:36:38.026000
2019-12-08T07:12:08
2019-12-08T07:12:08
226,520,652
0
0
null
false
2022-06-21T02:24:07
2019-12-07T13:47:42
2019-12-23T02:04:11
2022-06-21T02:24:04
11,152
0
0
4
JavaScript
false
false
package com.baizhi.controller; import com.baizhi.entity.User; import com.baizhi.service.UserService; import com.baizhi.util.UtilPhoneCode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; @RestController @RequestMapping("frontUser") public class UserFrontController { @Autowired private UserService userService; @Autowired private StringRedisTemplate stringRedisTemplate; @RequestMapping("findOne") public Map findOne(String phone,String password){ Map map=new HashMap(); String message=""; String status=""; User one = userService.findOne(phone); if (one!=null){ if (one.getPassword().equals(password)){ status="200"; map.put("user",one); }else { status="-200"; message="密码不正确"; map.put("message",message); } }else { status="-200"; message="用户不存在"; map.put("message",message); } map.put("status",status); return map; } //验证码验证 @RequestMapping("phoneCode") public Map phoneCode(String phone, HttpServletRequest request){ //获得验证码 Map map=new HashMap(); String message=""; String status=""; //生成验证码 int i = (int) ((Math.random() * 9 + 1) * 100000); String code = String.valueOf(i);//六位 if(code!=null){ UtilPhoneCode.sendPhoneCode(phone,code); stringRedisTemplate.opsForValue().set("code",code,60, TimeUnit.SECONDS); message="验证码发送成功"; status="200"; }else { message="验证码发送失败"; status="-200"; } map.put("message",message); map.put("status",status); //把验证码和手机号放入session return map; } //注册 校检验证码 @RequestMapping("regist") public Map regist(String code,String phone,HttpServletRequest request){ Map map=new HashMap(); HttpSession session = request.getSession(); session.setAttribute("phone",phone); String code1=stringRedisTemplate.opsForValue().get("code"); String status=""; String message=""; String id=null; if(code1.equals(code)){ //如果验证码成功 插入 try { User user=new User(); id=UUID.randomUUID().toString(); user.setId(id); user.setPhone(phone); userService.addPhoneAndId(user); message="注册成功"; status="200"; } catch (Exception e) { message="注册失败"; status="-200"; e.printStackTrace(); } }else{ message="验证码错误"; status="-200"; } map.put("message",message); map.put("status",status); map.put("id",id); return map; } @RequestMapping("addUserOhterMess") public Map addUserOhterMess(User user,HttpSession session){ String phone = (String) session.getAttribute("phone"); System.out.println(phone); Map map=new HashMap(); String status=""; String message=""; try { User one = userService.findOne(phone); String id = one.getId(); user.setId(id); userService.addUserOtherMess(user); status="200"; message="完善信息成功"; User user1 = userService.findOne(phone); map.put("user",user1); } catch (Exception e) { status="-200"; message="完善信息失败"; e.printStackTrace(); } map.put("message",message); map.put("status",status); return map; } @RequestMapping("updateUserMes") public Map updateUserMes(User user,String uid){ user.setId(uid); Map map = null; try { map = userService.updateUserMes(user); } catch (Exception e) { e.printStackTrace(); return map; } Map map1 = userService.findOneByid(uid); return map1; } }
UTF-8
Java
4,728
java
UserFrontController.java
Java
[]
null
[]
package com.baizhi.controller; import com.baizhi.entity.User; import com.baizhi.service.UserService; import com.baizhi.util.UtilPhoneCode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; @RestController @RequestMapping("frontUser") public class UserFrontController { @Autowired private UserService userService; @Autowired private StringRedisTemplate stringRedisTemplate; @RequestMapping("findOne") public Map findOne(String phone,String password){ Map map=new HashMap(); String message=""; String status=""; User one = userService.findOne(phone); if (one!=null){ if (one.getPassword().equals(password)){ status="200"; map.put("user",one); }else { status="-200"; message="密码不正确"; map.put("message",message); } }else { status="-200"; message="用户不存在"; map.put("message",message); } map.put("status",status); return map; } //验证码验证 @RequestMapping("phoneCode") public Map phoneCode(String phone, HttpServletRequest request){ //获得验证码 Map map=new HashMap(); String message=""; String status=""; //生成验证码 int i = (int) ((Math.random() * 9 + 1) * 100000); String code = String.valueOf(i);//六位 if(code!=null){ UtilPhoneCode.sendPhoneCode(phone,code); stringRedisTemplate.opsForValue().set("code",code,60, TimeUnit.SECONDS); message="验证码发送成功"; status="200"; }else { message="验证码发送失败"; status="-200"; } map.put("message",message); map.put("status",status); //把验证码和手机号放入session return map; } //注册 校检验证码 @RequestMapping("regist") public Map regist(String code,String phone,HttpServletRequest request){ Map map=new HashMap(); HttpSession session = request.getSession(); session.setAttribute("phone",phone); String code1=stringRedisTemplate.opsForValue().get("code"); String status=""; String message=""; String id=null; if(code1.equals(code)){ //如果验证码成功 插入 try { User user=new User(); id=UUID.randomUUID().toString(); user.setId(id); user.setPhone(phone); userService.addPhoneAndId(user); message="注册成功"; status="200"; } catch (Exception e) { message="注册失败"; status="-200"; e.printStackTrace(); } }else{ message="验证码错误"; status="-200"; } map.put("message",message); map.put("status",status); map.put("id",id); return map; } @RequestMapping("addUserOhterMess") public Map addUserOhterMess(User user,HttpSession session){ String phone = (String) session.getAttribute("phone"); System.out.println(phone); Map map=new HashMap(); String status=""; String message=""; try { User one = userService.findOne(phone); String id = one.getId(); user.setId(id); userService.addUserOtherMess(user); status="200"; message="完善信息成功"; User user1 = userService.findOne(phone); map.put("user",user1); } catch (Exception e) { status="-200"; message="完善信息失败"; e.printStackTrace(); } map.put("message",message); map.put("status",status); return map; } @RequestMapping("updateUserMes") public Map updateUserMes(User user,String uid){ user.setId(uid); Map map = null; try { map = userService.updateUserMes(user); } catch (Exception e) { e.printStackTrace(); return map; } Map map1 = userService.findOneByid(uid); return map1; } }
4,728
0.560519
0.550396
148
29.695946
16.413021
84
false
false
0
0
0
0
0
0
0.783784
false
false
10
bdc4f902ea7bd3daafcc2e63c4209c4222e58d07
25,451,976,234,975
7e1511cdceeec0c0aad2b9b916431fc39bc71d9b
/flakiness-predicter/input_data/original_tests/spring-projects-spring-boot/nonFlakyMethods/org.springframework.boot.context.config.ConfigFileApplicationListenerTests-propertySourceAnnotation.java
59baab9c41b6a5f366bf19fec316de07e08764f4
[ "BSD-3-Clause" ]
permissive
Taher-Ghaleb/FlakeFlagger
https://github.com/Taher-Ghaleb/FlakeFlagger
6fd7c95d2710632fd093346ce787fd70923a1435
45f3d4bc5b790a80daeb4d28ec84f5e46433e060
refs/heads/main
2023-07-14T16:57:24.507000
2021-08-26T14:50:16
2021-08-26T14:50:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
@Test public void propertySourceAnnotation() throws Exception { SpringApplication application=new SpringApplication(WithPropertySource.class); application.setWebEnvironment(false); ConfigurableApplicationContext context=application.run(); String property=context.getEnvironment().getProperty("the.property"); assertThat(property,equalTo("fromspecificlocation")); assertThat(context.getEnvironment(),containsPropertySource("class path resource " + "[specificlocation.properties]")); context.close(); }
UTF-8
Java
515
java
org.springframework.boot.context.config.ConfigFileApplicationListenerTests-propertySourceAnnotation.java
Java
[]
null
[]
@Test public void propertySourceAnnotation() throws Exception { SpringApplication application=new SpringApplication(WithPropertySource.class); application.setWebEnvironment(false); ConfigurableApplicationContext context=application.run(); String property=context.getEnvironment().getProperty("the.property"); assertThat(property,equalTo("fromspecificlocation")); assertThat(context.getEnvironment(),containsPropertySource("class path resource " + "[specificlocation.properties]")); context.close(); }
515
0.811651
0.811651
9
56.222221
32.852459
120
false
false
0
0
0
0
0
0
1
false
false
10
cc4eb1e871a916c0c7130928efb011ad4639f01d
30,219,389,934,563
6cfebb0db6f5b73508f6d071d42eb1d8fafbc7f7
/common-part/src/main/java/thirdpart/tcp/TcpDirectSender.java
042e3d1fbbd4a77e0455c91869a996884c3dd905
[]
no_license
KLines/gudyTrader
https://github.com/KLines/gudyTrader
a756a2571ffad0e8f1f94349da6747570cbf7ac8
61bce7e28ddc916404a3aadc119c4a8f226e8cfc
refs/heads/master
2023-06-17T03:20:46.815000
2021-06-28T16:20:38
2021-06-28T16:20:38
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package thirdpart.tcp; import io.vertx.core.AsyncResult; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.net.NetSocket; import lombok.RequiredArgsConstructor; import lombok.extern.log4j.Log4j2; import lombok.NonNull; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; @Log4j2 @RequiredArgsConstructor public class TcpDirectSender { /** * tcp目标发送工具 (发送到网关 ) */ @NonNull private String ip; @NonNull private int port; @NonNull private Vertx vertx; ////////////////////////////////////////////////////////////////////////////// /** * 取最新的(重连会重置) */ private volatile NetSocket socket; public void startup() { //开启与目标的链接 (创建一个TCP客户端 handle方法会得到 NetSocket) vertx.createNetClient().connect(port, ip, new ClientConnHandler()); //单独启动一个线程取阻塞队列中的数据写入网关 new Thread(() -> { while (true) { try { //从BlockingQueue取出一个队首的对象,如果在指定时间内, //队列一旦有数据可取,则立即返回队列中的数据。否则知道时间,超时还没有数据可取,返回失败。 Buffer msgBuffer = sendCache.poll(5, TimeUnit.SECONDS); if (msgBuffer != null && msgBuffer.length() > 0 && socket != null) { //远程链接写入 socket.write(msgBuffer); } } catch (Exception e) { log.error("msg send fail,continue"); } } }).start(); } /** * 队列作用 已解耦代码 * socket自己去缓存中取数据进行发送 * 客户请求写入队列 * 单独线程去读队列 写到网关 */ private final BlockingQueue<Buffer> sendCache = new LinkedBlockingDeque<>(); /** * 发送消息方法 * @param bufferMsg * @return */ public boolean send(Buffer bufferMsg) { //表示如果可能的话,将对象加到BlockingQueue里,即如果BlockingQueue可以容纳,则返回true,否则返回false return sendCache.offer(bufferMsg); } /** * 处理链接类 */ private class ClientConnHandler implements Handler<AsyncResult<NetSocket>> { /** * 重新了解 */ private void reconnect() { //5s 重试一次链接 vertx.setTimer(1000 * 5, r -> { log.info("try reconnect to server to {}:{} failed", ip, port); //重新创建链接 vertx.createNetClient().connect(port, ip, new ClientConnHandler()); }); } @Override public void handle(AsyncResult<NetSocket> result) { //链接创建成功 设置处理器 if (result.succeeded()) { log.info("connect success to remote {}:{}", ip, port); socket = result.result(); //链接关闭 socket.closeHandler(close -> { log.info("connect to remote {} closed", socket.remoteAddress()); //重连 reconnect(); }); //链接保存 socket.exceptionHandler(ex -> { log.error("error exist", ex.getCause()); }); } else { } } } }
UTF-8
Java
3,670
java
TcpDirectSender.java
Java
[]
null
[]
package thirdpart.tcp; import io.vertx.core.AsyncResult; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.net.NetSocket; import lombok.RequiredArgsConstructor; import lombok.extern.log4j.Log4j2; import lombok.NonNull; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; @Log4j2 @RequiredArgsConstructor public class TcpDirectSender { /** * tcp目标发送工具 (发送到网关 ) */ @NonNull private String ip; @NonNull private int port; @NonNull private Vertx vertx; ////////////////////////////////////////////////////////////////////////////// /** * 取最新的(重连会重置) */ private volatile NetSocket socket; public void startup() { //开启与目标的链接 (创建一个TCP客户端 handle方法会得到 NetSocket) vertx.createNetClient().connect(port, ip, new ClientConnHandler()); //单独启动一个线程取阻塞队列中的数据写入网关 new Thread(() -> { while (true) { try { //从BlockingQueue取出一个队首的对象,如果在指定时间内, //队列一旦有数据可取,则立即返回队列中的数据。否则知道时间,超时还没有数据可取,返回失败。 Buffer msgBuffer = sendCache.poll(5, TimeUnit.SECONDS); if (msgBuffer != null && msgBuffer.length() > 0 && socket != null) { //远程链接写入 socket.write(msgBuffer); } } catch (Exception e) { log.error("msg send fail,continue"); } } }).start(); } /** * 队列作用 已解耦代码 * socket自己去缓存中取数据进行发送 * 客户请求写入队列 * 单独线程去读队列 写到网关 */ private final BlockingQueue<Buffer> sendCache = new LinkedBlockingDeque<>(); /** * 发送消息方法 * @param bufferMsg * @return */ public boolean send(Buffer bufferMsg) { //表示如果可能的话,将对象加到BlockingQueue里,即如果BlockingQueue可以容纳,则返回true,否则返回false return sendCache.offer(bufferMsg); } /** * 处理链接类 */ private class ClientConnHandler implements Handler<AsyncResult<NetSocket>> { /** * 重新了解 */ private void reconnect() { //5s 重试一次链接 vertx.setTimer(1000 * 5, r -> { log.info("try reconnect to server to {}:{} failed", ip, port); //重新创建链接 vertx.createNetClient().connect(port, ip, new ClientConnHandler()); }); } @Override public void handle(AsyncResult<NetSocket> result) { //链接创建成功 设置处理器 if (result.succeeded()) { log.info("connect success to remote {}:{}", ip, port); socket = result.result(); //链接关闭 socket.closeHandler(close -> { log.info("connect to remote {} closed", socket.remoteAddress()); //重连 reconnect(); }); //链接保存 socket.exceptionHandler(ex -> { log.error("error exist", ex.getCause()); }); } else { } } } }
3,670
0.523373
0.519267
121
25.165289
23.884483
92
false
false
0
0
0
0
80
0.025268
0.421488
false
false
10
3603dd0275efaa4acbf8c4d85ec895684026b878
20,615,843,088,473
6e9e7639f415f81295851732cd1bae372e2ad9e7
/app/src/main/java/com/example/callcontact/MainActivity.java
8f7bb86f0ac3ae6cf95f2014eedd9077376bcc57
[]
no_license
Akunov94/CallContact
https://github.com/Akunov94/CallContact
26e3b71792b85afbedf4e0e4be4fcb035651c2f5
cd4ee2340fa7f304f17d2c0675d0072bdf8da7cf
refs/heads/master
2022-12-10T13:29:05.758000
2020-09-12T08:42:51
2020-09-12T08:42:51
294,904,961
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.callcontact; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import android.Manifest; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.ContactsContract; import android.provider.ContactsContract.Contacts; import android.provider.SyncStateContract; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity<prefs> extends AppCompatActivity { private static final int RESULT_PICK_CONTACT = 101; String telNum = null; String name = null; private TextView textView1; private TextView textView2; private Button call; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView1 = findViewById(R.id.TxtName); textView2 = findViewById(R.id.TxtNumber); call = findViewById(R.id.button_Call); } public void callClick(View view) { Intent intentCall=new Intent(Intent.ACTION_CALL); if(telNum.trim().isEmpty()){ intentCall.setData(Uri.parse("tel:0502135151")); } else{ intentCall.setData(Uri.parse("tel:"+telNum)); } if(ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CALL_PHONE)!= PackageManager.PERMISSION_GRANTED){ Toast.makeText(getApplicationContext(),"Please grant permission",Toast.LENGTH_SHORT).show(); requestPermission(); }else { startActivity(intentCall); } } private void requestPermission(){ ActivityCompat.requestPermissions(MainActivity.this,new String[]{Manifest.permission.CALL_PHONE},1); } @Override public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { Cursor cursor = null; try { Uri uri = data.getData(); cursor = getContentResolver().query(uri, null, null, null, null); cursor.moveToFirst(); int phoneIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER); int nameIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME); telNum = cursor.getString(phoneIndex); name = cursor.getString(nameIndex); textView1.setText(name); textView2.setText(telNum); } catch (Exception e) { e.printStackTrace(); } } } public void callClickPick(View view) { Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI); startActivityForResult(intent, RESULT_PICK_CONTACT); } }
UTF-8
Java
3,311
java
MainActivity.java
Java
[]
null
[]
package com.example.callcontact; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import android.Manifest; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.ContactsContract; import android.provider.ContactsContract.Contacts; import android.provider.SyncStateContract; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity<prefs> extends AppCompatActivity { private static final int RESULT_PICK_CONTACT = 101; String telNum = null; String name = null; private TextView textView1; private TextView textView2; private Button call; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView1 = findViewById(R.id.TxtName); textView2 = findViewById(R.id.TxtNumber); call = findViewById(R.id.button_Call); } public void callClick(View view) { Intent intentCall=new Intent(Intent.ACTION_CALL); if(telNum.trim().isEmpty()){ intentCall.setData(Uri.parse("tel:0502135151")); } else{ intentCall.setData(Uri.parse("tel:"+telNum)); } if(ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CALL_PHONE)!= PackageManager.PERMISSION_GRANTED){ Toast.makeText(getApplicationContext(),"Please grant permission",Toast.LENGTH_SHORT).show(); requestPermission(); }else { startActivity(intentCall); } } private void requestPermission(){ ActivityCompat.requestPermissions(MainActivity.this,new String[]{Manifest.permission.CALL_PHONE},1); } @Override public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { Cursor cursor = null; try { Uri uri = data.getData(); cursor = getContentResolver().query(uri, null, null, null, null); cursor.moveToFirst(); int phoneIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER); int nameIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME); telNum = cursor.getString(phoneIndex); name = cursor.getString(nameIndex); textView1.setText(name); textView2.setText(telNum); } catch (Exception e) { e.printStackTrace(); } } } public void callClickPick(View view) { Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI); startActivityForResult(intent, RESULT_PICK_CONTACT); } }
3,311
0.687406
0.681365
88
36.602272
27.625557
140
false
false
0
0
0
0
0
0
0.795455
false
false
10
155b5d3b1bf6a95109cc71ba4eb98af081be5d83
29,222,957,536,101
15f395f65caa8503b895dcd2c4eba65c57035102
/app/src/main/java/com/example/sandman/multiscreentest/AndroidWordAdapter.java
975dd546027419ca8cff9536ce9feba940be48e4
[]
no_license
hiranthaPeiris/MultiScreenTest
https://github.com/hiranthaPeiris/MultiScreenTest
c7f4a8cbb09d0b49efd8edc41ef784c71912fe45
9fd74f526ed83f16f73aab35d2da464887b6eeac
refs/heads/master
2021-04-09T16:28:36.140000
2018-03-19T08:26:55
2018-03-19T08:26:55
125,824,320
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.sandman.multiscreentest; import android.app.Activity; import android.content.Context; import android.media.Image; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; /** * Created by Sandman on 1/14/2018. */ public class AndroidWordAdapter extends ArrayAdapter<Word> { private int mColorResoursId; public AndroidWordAdapter(Activity context, ArrayList<Word> words,int colorResoursId) { super(context,0,words); mColorResoursId = colorResoursId; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { View listItemView = convertView; if(listItemView == null){ listItemView = LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false); } Word currentWord = getItem(position); TextView miwokTextView = (TextView) listItemView.findViewById(R.id.miwok_text_view); TextView deafultTextView = (TextView) listItemView.findViewById(R.id.default_text_view); ImageView imageView = (ImageView) listItemView.findViewById(R.id.ic_launcher); miwokTextView.setText(currentWord.getmMiwokTranslation()); deafultTextView.setText(currentWord.getmDefaultTranslation()); //Setting Image visible or gone from the model's method if(currentWord.hasImage()){ imageView.setImageResource(currentWord.getmImageResourceId()); imageView.setVisibility(View.VISIBLE); }else { imageView.setVisibility(View.GONE); } //get container of textView Layout View textContainer = listItemView.findViewById(R.id.text_container); //find the color that resource id maps to int color = ContextCompat.getColor(getContext(),mColorResoursId); //set the background color of the text container view textContainer.setBackgroundColor(color); return listItemView; } }
UTF-8
Java
2,280
java
AndroidWordAdapter.java
Java
[ { "context": "package com.example.sandman.multiscreentest;\n\nimport android.app.Activity;\nim", "end": 27, "score": 0.7417888641357422, "start": 20, "tag": "USERNAME", "value": "sandman" }, { "context": "w;\n\nimport java.util.ArrayList;\n\n/**\n * Created by Sandman on 1/14/2018.\n...
null
[]
package com.example.sandman.multiscreentest; import android.app.Activity; import android.content.Context; import android.media.Image; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; /** * Created by Sandman on 1/14/2018. */ public class AndroidWordAdapter extends ArrayAdapter<Word> { private int mColorResoursId; public AndroidWordAdapter(Activity context, ArrayList<Word> words,int colorResoursId) { super(context,0,words); mColorResoursId = colorResoursId; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { View listItemView = convertView; if(listItemView == null){ listItemView = LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false); } Word currentWord = getItem(position); TextView miwokTextView = (TextView) listItemView.findViewById(R.id.miwok_text_view); TextView deafultTextView = (TextView) listItemView.findViewById(R.id.default_text_view); ImageView imageView = (ImageView) listItemView.findViewById(R.id.ic_launcher); miwokTextView.setText(currentWord.getmMiwokTranslation()); deafultTextView.setText(currentWord.getmDefaultTranslation()); //Setting Image visible or gone from the model's method if(currentWord.hasImage()){ imageView.setImageResource(currentWord.getmImageResourceId()); imageView.setVisibility(View.VISIBLE); }else { imageView.setVisibility(View.GONE); } //get container of textView Layout View textContainer = listItemView.findViewById(R.id.text_container); //find the color that resource id maps to int color = ContextCompat.getColor(getContext(),mColorResoursId); //set the background color of the text container view textContainer.setBackgroundColor(color); return listItemView; } }
2,280
0.720614
0.716667
67
33.02985
29.220198
102
false
false
0
0
0
0
0
0
0.61194
false
false
10
03ce5c022d814b28653ce4ffdd5dca5dba573d39
9,655,086,552,142
419f2c3dea3967d8eeaabbbb80e36bd4e4428677
/src/main/java/com/yash/products/REstProduct/service/ProductService.java
9a800c99629c4d44f941f8d37cf0cda12c710921
[]
no_license
shubh1416/RestServiceSpringBoot
https://github.com/shubh1416/RestServiceSpringBoot
82329c08688a296b96a5e69d76163996e7cbd371
c7bab441d584655d5fa59fd5d0d5d340552be477
refs/heads/master
2020-06-27T19:02:22.414000
2019-08-02T06:26:01
2019-08-02T06:26:01
200,025,095
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yash.products.REstProduct.service; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Optional; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import com.yash.products.REstProduct.beans.Product; import com.yash.products.REstProduct.dao.ProductDao; @Component public class ProductService { @Autowired ProductDao productDao; public List<Product> getAllProductsList() { List<Product> iList=productDao.getAllProducts(); System.out.println(iList.size()); return iList; } public void addNewProduct( Product product) { productDao.addProduct(product); } public Optional<Product> getProductDetailsById(Integer id) { Optional<Product> p=productDao.findProductById(id); return p; } public Product updateProductQuantity(Integer id, Integer quantity) { // TODO Auto-generated method stub return null; } public Boolean deleteProductById(Integer id) { // TODO Auto-generated method stub return productDao.deleteProduct(id); } }
UTF-8
Java
1,310
java
ProductService.java
Java
[]
null
[]
package com.yash.products.REstProduct.service; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Optional; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import com.yash.products.REstProduct.beans.Product; import com.yash.products.REstProduct.dao.ProductDao; @Component public class ProductService { @Autowired ProductDao productDao; public List<Product> getAllProductsList() { List<Product> iList=productDao.getAllProducts(); System.out.println(iList.size()); return iList; } public void addNewProduct( Product product) { productDao.addProduct(product); } public Optional<Product> getProductDetailsById(Integer id) { Optional<Product> p=productDao.findProductById(id); return p; } public Product updateProductQuantity(Integer id, Integer quantity) { // TODO Auto-generated method stub return null; } public Boolean deleteProductById(Integer id) { // TODO Auto-generated method stub return productDao.deleteProduct(id); } }
1,310
0.754198
0.754198
55
21.818182
20.945896
69
false
false
0
0
0
0
0
0
1.054545
false
false
10
3e14c9ae7d94c40c623e0847ccb55adae5de79a0
27,419,071,287,516
d8002d422c545a27dff8ba05315bda3825d8ebc4
/A3/FordFulkerson.java
c439bf4b63007d734c2e0041f393b5aeaa01fddc
[]
no_license
ishayansheikh/Algorithms-and-Data-Structures
https://github.com/ishayansheikh/Algorithms-and-Data-Structures
2ba1136d41ef5b94d7980d67e9210e1d7e23edc7
260f7a8518303d22a56837e473ba9114a9b4d37c
refs/heads/master
2020-04-13T03:07:34.118000
2018-12-23T21:13:42
2018-12-23T21:13:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import java.util.*; // Shayan Sheikh - A3 public class FordFulkerson { public static ArrayList<Integer> pathDFS(Integer source, Integer destination, WGraph graph){ ArrayList<Integer> Stack = new ArrayList<Integer>(); ArrayList<Integer> visitedNodes = new ArrayList<>(); ArrayList<Integer> pathTaken = new ArrayList<>(); visitedNodes.add(source); pathTaken.add(source); // We will keep running the algorithm as long as there are valid pathTaken while(!pathTaken.isEmpty()){ // Adding the last element in pathTaken stack to visitedNodes Integer firstInt = pathTaken.get(pathTaken.size() - 1); pathTaken.remove(pathTaken.size() - 1); visitedNodes.add(firstInt); // Get the last element of Stack, and get the edge, remove top if edge is null or weight is 0 while(!Stack.isEmpty()){ Integer secondInt = Stack.get(Stack.size() - 1); Edge edge = graph.getEdge(secondInt, firstInt); if(edge == null || edge.weight == 0) { Stack.remove(Stack.size() - 1); } else { break; } } // Adding firstInt to stack Stack.add(firstInt); // Loop through every edge, and add every node that is valid to path stack for(Edge edge: graph.getEdges()) { if((edge.nodes[0] == firstInt && edge.weight > 0) && (!visitedNodes.contains(edge.nodes[1]))){ // If the end node is destination, clear the path so algorithm terminates if(edge.nodes[1] == destination){ Stack.add(destination); pathTaken.clear(); } else { pathTaken.add(edge.nodes[1]); } } } } return Stack; } public static void fordfulkerson(Integer source, Integer destination, WGraph graph, String filePath){ String answer=""; String myMcGillID = "260738247"; //Please initialize this variable with your McGill ID int maxFlow = 0; // Creating residualGraph and capacity graph with initial values WGraph residualGraph = new WGraph(graph); WGraph capacityGraph = new WGraph(graph); // Set all edge weights to 0 for(Edge edge: graph.getEdges()){ graph.setEdge(edge.nodes[0], edge.nodes[1], 0); } // If source and destination are both in pathDFS, then it is successful while(pathDFS(source, destination, residualGraph).contains(source) && pathDFS(source, residualGraph.getDestination(), residualGraph).contains(destination)){ ArrayList<Integer> dfs = pathDFS(source, destination, residualGraph); int bottleneck = Integer.MAX_VALUE; // Finding bottleneck value for(int i = 0; i < dfs.size()-1; i++){ Edge edge = residualGraph.getEdge(dfs.get(i), dfs.get(i+1)); if(edge != null && edge.weight < bottleneck){ bottleneck = edge.weight; } } // Augmenting for(int i = 0; i < dfs.size() - 1; i++){ Integer n1 = dfs.get(i); Integer n2 = dfs.get(i + 1); Edge edge = graph.getEdge(n1, n2); if(edge == null){ graph.setEdge(n1, n2, edge.weight - bottleneck); } else{ graph.setEdge(n1, n2, edge.weight + bottleneck); } } // Set residualGraph for(int i=0; i<dfs.size()-1; i++){ Integer n1 = dfs.get(i); Integer n2 = dfs.get(i + 1); Edge edge = graph.getEdge(n1, n2); Edge capEdge = capacityGraph.getEdge(n1, n2); if(edge.weight <= capEdge.weight){ residualGraph.setEdge(n1, n2, capEdge.weight - edge.weight); } else if (edge.weight > 0) { Edge residualEdge = residualGraph.getEdge(n1, n2); if(residualEdge == null){ Edge backEdge = new Edge(n1, n2, edge.weight); residualGraph.addEdge(backEdge); } else{ residualGraph.setEdge(n2, n1, edge.weight); } } } maxFlow += bottleneck; bottleneck = Integer.MAX_VALUE; } answer += maxFlow + "\n" + graph.toString(); writeAnswer(filePath+myMcGillID+".txt",answer); System.out.println(answer); } public static void writeAnswer(String path, String line){ BufferedReader br = null; File file = new File(path); // if file doesnt exists, then create it try { if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile(),true); BufferedWriter bw = new BufferedWriter(fw); bw.write(line+"\n"); bw.close(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } } } public static void main(String[] args){ String file = args[0]; File f = new File(file); WGraph g = new WGraph(file); fordfulkerson(g.getSource(),g.getDestination(),g,f.getAbsolutePath().replace(".txt","")); } }
UTF-8
Java
5,433
java
FordFulkerson.java
Java
[ { "context": "import java.io.*;\r\nimport java.util.*;\r\n\r\n\r\n// Shayan Sheikh - A3\r\n\r\npublic class FordFulkerson {\r\n\r\n\t\r\n\tpubli", "end": 60, "score": 0.9998872876167297, "start": 47, "tag": "NAME", "value": "Shayan Sheikh" }, { "context": "8247\"; //Please initialize...
null
[]
import java.io.*; import java.util.*; // <NAME> - A3 public class FordFulkerson { public static ArrayList<Integer> pathDFS(Integer source, Integer destination, WGraph graph){ ArrayList<Integer> Stack = new ArrayList<Integer>(); ArrayList<Integer> visitedNodes = new ArrayList<>(); ArrayList<Integer> pathTaken = new ArrayList<>(); visitedNodes.add(source); pathTaken.add(source); // We will keep running the algorithm as long as there are valid pathTaken while(!pathTaken.isEmpty()){ // Adding the last element in pathTaken stack to visitedNodes Integer firstInt = pathTaken.get(pathTaken.size() - 1); pathTaken.remove(pathTaken.size() - 1); visitedNodes.add(firstInt); // Get the last element of Stack, and get the edge, remove top if edge is null or weight is 0 while(!Stack.isEmpty()){ Integer secondInt = Stack.get(Stack.size() - 1); Edge edge = graph.getEdge(secondInt, firstInt); if(edge == null || edge.weight == 0) { Stack.remove(Stack.size() - 1); } else { break; } } // Adding firstInt to stack Stack.add(firstInt); // Loop through every edge, and add every node that is valid to path stack for(Edge edge: graph.getEdges()) { if((edge.nodes[0] == firstInt && edge.weight > 0) && (!visitedNodes.contains(edge.nodes[1]))){ // If the end node is destination, clear the path so algorithm terminates if(edge.nodes[1] == destination){ Stack.add(destination); pathTaken.clear(); } else { pathTaken.add(edge.nodes[1]); } } } } return Stack; } public static void fordfulkerson(Integer source, Integer destination, WGraph graph, String filePath){ String answer=""; String myMcGillID = "260738247"; //Please initialize this variable with your McGill ID int maxFlow = 0; // Creating residualGraph and capacity graph with initial values WGraph residualGraph = new WGraph(graph); WGraph capacityGraph = new WGraph(graph); // Set all edge weights to 0 for(Edge edge: graph.getEdges()){ graph.setEdge(edge.nodes[0], edge.nodes[1], 0); } // If source and destination are both in pathDFS, then it is successful while(pathDFS(source, destination, residualGraph).contains(source) && pathDFS(source, residualGraph.getDestination(), residualGraph).contains(destination)){ ArrayList<Integer> dfs = pathDFS(source, destination, residualGraph); int bottleneck = Integer.MAX_VALUE; // Finding bottleneck value for(int i = 0; i < dfs.size()-1; i++){ Edge edge = residualGraph.getEdge(dfs.get(i), dfs.get(i+1)); if(edge != null && edge.weight < bottleneck){ bottleneck = edge.weight; } } // Augmenting for(int i = 0; i < dfs.size() - 1; i++){ Integer n1 = dfs.get(i); Integer n2 = dfs.get(i + 1); Edge edge = graph.getEdge(n1, n2); if(edge == null){ graph.setEdge(n1, n2, edge.weight - bottleneck); } else{ graph.setEdge(n1, n2, edge.weight + bottleneck); } } // Set residualGraph for(int i=0; i<dfs.size()-1; i++){ Integer n1 = dfs.get(i); Integer n2 = dfs.get(i + 1); Edge edge = graph.getEdge(n1, n2); Edge capEdge = capacityGraph.getEdge(n1, n2); if(edge.weight <= capEdge.weight){ residualGraph.setEdge(n1, n2, capEdge.weight - edge.weight); } else if (edge.weight > 0) { Edge residualEdge = residualGraph.getEdge(n1, n2); if(residualEdge == null){ Edge backEdge = new Edge(n1, n2, edge.weight); residualGraph.addEdge(backEdge); } else{ residualGraph.setEdge(n2, n1, edge.weight); } } } maxFlow += bottleneck; bottleneck = Integer.MAX_VALUE; } answer += maxFlow + "\n" + graph.toString(); writeAnswer(filePath+myMcGillID+".txt",answer); System.out.println(answer); } public static void writeAnswer(String path, String line){ BufferedReader br = null; File file = new File(path); // if file doesnt exists, then create it try { if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile(),true); BufferedWriter bw = new BufferedWriter(fw); bw.write(line+"\n"); bw.close(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } } } public static void main(String[] args){ String file = args[0]; File f = new File(file); WGraph g = new WGraph(file); fordfulkerson(g.getSource(),g.getDestination(),g,f.getAbsolutePath().replace(".txt","")); } }
5,426
0.551077
0.540217
169
30.147928
27.035513
160
false
false
0
0
0
0
0
0
3.313609
false
false
10
a046e00a58a8231e24a866011824685611699e9c
33,947,421,539,020
894cfc721d70774dc94607bad7b9c1aa5ed34a96
/backend/src/main/java/br/com/github/edumaxsantos/dspesquisa/repositories/RecordRepository.java
83cf4c455a2db85bf39c1782cce151b3be9a58b4
[]
no_license
edumaxsantos/sds1
https://github.com/edumaxsantos/sds1
04e706591930ee26dcbdabbabfd4ac0a3b552701
d2f5a4461775747a5d3106016fc243cbf3169e15
refs/heads/master
2022-12-11T11:58:20.700000
2020-09-20T04:17:13
2020-09-20T04:17:13
296,146,583
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.github.edumaxsantos.dspesquisa.repositories; import br.com.github.edumaxsantos.dspesquisa.entities.Record; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; @Repository public interface RecordRepository extends JpaRepository<Record, Long> { @Query("SELECT obj FROM Record obj WHERE (coalesce(:min, null) IS NULL OR obj.moment >= :min) AND (coalesce(:max, null) IS NULL OR obj.moment <= :max)") Page<Record> findByMoments(LocalDateTime min, LocalDateTime max, Pageable pageable); }
UTF-8
Java
751
java
RecordRepository.java
Java
[ { "context": "package br.com.github.edumaxsantos.dspesquisa.repositories;\n\n\nimport br.com.gi", "end": 28, "score": 0.5963206887245178, "start": 22, "tag": "USERNAME", "value": "edumax" }, { "context": "s.dspesquisa.repositories;\n\n\nimport br.com.github.edumaxsantos.dspesquisa.en...
null
[]
package br.com.github.edumaxsantos.dspesquisa.repositories; import br.com.github.edumaxsantos.dspesquisa.entities.Record; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; @Repository public interface RecordRepository extends JpaRepository<Record, Long> { @Query("SELECT obj FROM Record obj WHERE (coalesce(:min, null) IS NULL OR obj.moment >= :min) AND (coalesce(:max, null) IS NULL OR obj.moment <= :max)") Page<Record> findByMoments(LocalDateTime min, LocalDateTime max, Pageable pageable); }
751
0.802929
0.802929
18
40.722221
39.949699
156
false
false
0
0
0
0
0
0
0.777778
false
false
10
d3c88adadb2a2943752e1bb8d6420d29732f2560
35,081,292,896,243
387c7ed24f5fe612d75f7610ed243277b4a49b21
/H_SchoolDays_Server/src/main/Main.java
ba911053b93bad805b11cad4bbd93aeeffac75fb
[]
no_license
notedays/H_SchoolDays_Server
https://github.com/notedays/H_SchoolDays_Server
3e553756332e6157fab6fa373deb70ef451488a3
25be71346aeeb3e8f3de2d47703cb8268cbe79c9
refs/heads/master
2021-01-01T18:13:19.845000
2018-03-16T08:52:50
2018-03-16T08:52:50
98,277,458
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main; import java.io.File; import java.io.IOException; import com.himaginus.common.goback.packet.GoBackRequestPacket; import com.himaginus.common.goback.packet.GoBackResponsePacket; import com.himaginus.server.main.ServerMain; import com.himaginus.server.process.PacketHandler; import process.GoBackPacketExecutor; public class Main { public static void main(String[] args) throws IOException, InterruptedException { File config = new File("config.properties"); GoBackPacketExecutor executor = GoBackPacketExecutor.getInstance(); ServerMain.load(config, new GoBackRequestPacket(), new GoBackResponsePacket(), new PacketHandler(executor)); System.out.println("Netty Server Open"); } }
UTF-8
Java
706
java
Main.java
Java
[]
null
[]
package main; import java.io.File; import java.io.IOException; import com.himaginus.common.goback.packet.GoBackRequestPacket; import com.himaginus.common.goback.packet.GoBackResponsePacket; import com.himaginus.server.main.ServerMain; import com.himaginus.server.process.PacketHandler; import process.GoBackPacketExecutor; public class Main { public static void main(String[] args) throws IOException, InterruptedException { File config = new File("config.properties"); GoBackPacketExecutor executor = GoBackPacketExecutor.getInstance(); ServerMain.load(config, new GoBackRequestPacket(), new GoBackResponsePacket(), new PacketHandler(executor)); System.out.println("Netty Server Open"); } }
706
0.807365
0.807365
20
34.299999
30.93881
110
false
false
0
0
0
0
0
0
1.3
false
false
10
c2bca2258b8333e8a186470292415b24e78e6fe6
618,475,327,539
55b124188d6558fcd04a58491c5661ecc4f49923
/ArrayList/src/ejercicio3/Ejercicio3.java
6d2a3a430c2983e79aaa3cd59ed518cf2204e40f
[]
no_license
Jesus-GR/LaboratorioFpDual
https://github.com/Jesus-GR/LaboratorioFpDual
92f0c96df10ffcfbbe5b4da28bd10cfa1c9e8593
5200e1671137327ac19418664cd2d52213b753af
refs/heads/main
2023-05-11T05:00:31.134000
2021-06-02T11:03:59
2021-06-02T11:03:59
351,441,602
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ejercicio3; import java.util.ArrayList; /*3. Write a Java program to insert an element into the array list at the first position.*/ public class Ejercicio3 { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<String> nuevoArray = new ArrayList<String>(); nuevoArray.add("H"); nuevoArray.add("O"); nuevoArray.add("L"); nuevoArray.add("A"); nuevoArray.add("!"); for (String string : nuevoArray) { System.out.print(string); } nuevoArray.add(0, "¡"); System.out.println(); for (String string : nuevoArray) { System.out.print(string); } } }
WINDOWS-1252
Java
629
java
Ejercicio3.java
Java
[]
null
[]
package ejercicio3; import java.util.ArrayList; /*3. Write a Java program to insert an element into the array list at the first position.*/ public class Ejercicio3 { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<String> nuevoArray = new ArrayList<String>(); nuevoArray.add("H"); nuevoArray.add("O"); nuevoArray.add("L"); nuevoArray.add("A"); nuevoArray.add("!"); for (String string : nuevoArray) { System.out.print(string); } nuevoArray.add(0, "¡"); System.out.println(); for (String string : nuevoArray) { System.out.print(string); } } }
629
0.667197
0.660828
31
19.258064
19.898075
91
false
false
0
0
0
0
0
0
1.709677
false
false
10
593dd6943227cb22c91ea7cae8917011733042ee
2,576,980,419,988
e746d1c48c71a90e0d0d900d238afd13bf069848
/src/PART15_OOPS_Constructor/DefaultConstructor.java
535a0a0cc9fc76f613345d2493f16ee7a66c7c07
[]
no_license
SulemanShaik/Java-Practice
https://github.com/SulemanShaik/Java-Practice
70d1d39eb0913791bd4fe9719e8b6e645ae8ff86
9cd29b4277af6a6d949f5d536d9fb322bd4e25ec
refs/heads/master
2022-11-15T11:40:23.967000
2020-07-07T11:31:34
2020-07-07T11:31:34
258,429,484
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package PART15_OOPS_Constructor; public class DefaultConstructor { //Java Program to create and call a default constructor //creating a default constructor DefaultConstructor() { System.out.println("THIS IS DEFAULT CONSTRUCTORS "); } //main method public static void main(String args[]){ //calling a default constructor DefaultConstructor dc=new DefaultConstructor(); } }
UTF-8
Java
411
java
DefaultConstructor.java
Java
[]
null
[]
package PART15_OOPS_Constructor; public class DefaultConstructor { //Java Program to create and call a default constructor //creating a default constructor DefaultConstructor() { System.out.println("THIS IS DEFAULT CONSTRUCTORS "); } //main method public static void main(String args[]){ //calling a default constructor DefaultConstructor dc=new DefaultConstructor(); } }
411
0.717762
0.712895
18
21.611111
20.382833
59
false
false
0
0
0
0
0
0
1.111111
false
false
10
a5f6ac3a45824f899bc3a1954d5558923d5ce46d
11,544,872,113,278
948b0da4bfa581112c5205cae60bc4c0e90a4d66
/src/pers/jiangyinzuo/study/concurrent/s6/c3/CannotStartTwice.java
83c144141c6ccc3d1eac67cff9d5e95fb879a272
[]
no_license
jiangyinzuo/java-concurrent
https://github.com/jiangyinzuo/java-concurrent
cefc31cbbc518b2b00524b945084cb42cbf0f83a
d4c8d7d84744bb57539b341d143c226b71ac7a7d
refs/heads/master
2022-04-14T08:28:18.202000
2020-04-05T09:26:58
2020-04-05T09:26:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pers.jiangyinzuo.study.concurrent.s6.c3; /** * 不能两次调用start方法, 否则会报错 * @author jiang */ public class CannotStartTwice { public static void main(String[] args) { Thread thread = new Thread(); thread.start(); thread.start(); } }
UTF-8
Java
296
java
CannotStartTwice.java
Java
[ { "context": "ent.s6.c3;\n\n/**\n * 不能两次调用start方法, 否则会报错\n * @author jiang\n */\npublic class CannotStartTwice {\n public", "end": 91, "score": 0.8424854874610901, "start": 89, "tag": "NAME", "value": "ji" }, { "context": ".s6.c3;\n\n/**\n * 不能两次调用start方法, 否则会报错\n * @author jiang\...
null
[]
package pers.jiangyinzuo.study.concurrent.s6.c3; /** * 不能两次调用start方法, 否则会报错 * @author jiang */ public class CannotStartTwice { public static void main(String[] args) { Thread thread = new Thread(); thread.start(); thread.start(); } }
296
0.62963
0.622222
13
19.76923
16.115705
48
false
false
0
0
0
0
0
0
0.384615
false
false
10
3e7cdbf5359a1225b286aff653d64fd2692a282f
6,468,220,748,945
887db59c475cbbc9ff58ae6c9cfb162b2447c3aa
/src/main/java/com/vendor/service/IDiscountService.java
d909d4a5dfa1ddee40a26c936d5a21ddbf672fb1
[]
no_license
littleC-C/pender
https://github.com/littleC-C/pender
4025db141ebb7ac2c6fd660129c1fb8e0531a6a8
b03aba22d1009469476afbdbc19fcc2c61b3d707
refs/heads/master
2021-01-25T08:12:35.151000
2017-04-15T18:34:54
2017-04-15T18:34:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vendor.service; import java.util.List; import com.ecarry.core.web.core.Page; import com.vendor.po.Discount; import com.vendor.po.Order; import com.vendor.po.PointPlace; import com.vendor.po.Product; /** * @ClassName: 限时打折Service * @Description: TODO * @author: duanyx * @date: 2016年11月17日 下午3:55:07 */ public interface IDiscountService { /** * @Title: *1-分页查询限时打折列表 * @Description: TODO * @return * @return: List<MarketingTool> */ public List<Discount> findDisCount(Discount discount, Page page); /** * @Title: *2-删除/下线打折活动 * @Description: TODO * @param id * @return: void */ public void delDiscount(Long ids, Integer index); /** * @Title: *3-1.第一步保存新增/编辑对象(保存打折基本信息) * @param discount * @return void * @return: Discount */ public Discount saveDiscount(Discount discount); /** * @Title: *4.-选择店铺时(查询店铺) * @param discount * @param productId 查商品已选店铺时需要传字段 * @return * @return: List<PointPlace> */ public List<PointPlace> findPointPlacePage(Discount discount, Long productId, Page page); /** * @Title: *5.-选择商品时(查询商品) * @param discount * @param page * @param type 区分是查(1:已选的)还是(2:未选的) * @return * @return: List<Product> */ public List<Product> findProductPage(Discount discount, Page page, Integer type); /** * @Title: *6-1保存第二步(保存商铺/商品) * @param discount * @return * @return: void */ public void savePointPlaceProduct(Long id, String[] pointPlaceList, String type, String[] productList); /** * @Title: *7.-删除选中商品(以及商品对应的商铺) * @param @param discountId 删除打折活动的商品需要带 * @param @param productId 删除打折活动的商品需要带 * @return void * @throws */ public void deleteProductPointPlace(Long discountId, Long productId); /** * @Title: *7-1.更新商品的(店铺) * @param @param discount * @return void * @throws */ public void updateProduct(Discount discount); /** * @Title: *8.-删除店铺 * @param @param discountId * @param @param pointPlaceId * @return void * @throws */ public void delectPointPlace(Long discountId, Long pointPlaceId); /** * @Title: *9.-这里是根据活动ID查询出订单数据 * @Description: TODO(这里用一句话描述这个方法的作用) * @param @param discountId * @param @return * @return List<Order> * @throws */ public Order findOrderPage(Long discountId); /** * 定时更新打折活动 */ public void updateDiscountStateJob(); /** * 定时执行离线信息 */ public void updateOfflineStateJob(); /** * 根据离线消息Id删除打折活动的离线消息 * @param id */ public void deleteOffLineMessage(Long id) throws Exception; }
UTF-8
Java
2,943
java
IDiscountService.java
Java
[ { "context": "sName: 限时打折Service\n* @Description: TODO\n* @author: duanyx\n* @date: 2016年11月17日 下午3:55:07\n*/\npublic interfac", "end": 282, "score": 0.9996932148933411, "start": 276, "tag": "USERNAME", "value": "duanyx" } ]
null
[]
package com.vendor.service; import java.util.List; import com.ecarry.core.web.core.Page; import com.vendor.po.Discount; import com.vendor.po.Order; import com.vendor.po.PointPlace; import com.vendor.po.Product; /** * @ClassName: 限时打折Service * @Description: TODO * @author: duanyx * @date: 2016年11月17日 下午3:55:07 */ public interface IDiscountService { /** * @Title: *1-分页查询限时打折列表 * @Description: TODO * @return * @return: List<MarketingTool> */ public List<Discount> findDisCount(Discount discount, Page page); /** * @Title: *2-删除/下线打折活动 * @Description: TODO * @param id * @return: void */ public void delDiscount(Long ids, Integer index); /** * @Title: *3-1.第一步保存新增/编辑对象(保存打折基本信息) * @param discount * @return void * @return: Discount */ public Discount saveDiscount(Discount discount); /** * @Title: *4.-选择店铺时(查询店铺) * @param discount * @param productId 查商品已选店铺时需要传字段 * @return * @return: List<PointPlace> */ public List<PointPlace> findPointPlacePage(Discount discount, Long productId, Page page); /** * @Title: *5.-选择商品时(查询商品) * @param discount * @param page * @param type 区分是查(1:已选的)还是(2:未选的) * @return * @return: List<Product> */ public List<Product> findProductPage(Discount discount, Page page, Integer type); /** * @Title: *6-1保存第二步(保存商铺/商品) * @param discount * @return * @return: void */ public void savePointPlaceProduct(Long id, String[] pointPlaceList, String type, String[] productList); /** * @Title: *7.-删除选中商品(以及商品对应的商铺) * @param @param discountId 删除打折活动的商品需要带 * @param @param productId 删除打折活动的商品需要带 * @return void * @throws */ public void deleteProductPointPlace(Long discountId, Long productId); /** * @Title: *7-1.更新商品的(店铺) * @param @param discount * @return void * @throws */ public void updateProduct(Discount discount); /** * @Title: *8.-删除店铺 * @param @param discountId * @param @param pointPlaceId * @return void * @throws */ public void delectPointPlace(Long discountId, Long pointPlaceId); /** * @Title: *9.-这里是根据活动ID查询出订单数据 * @Description: TODO(这里用一句话描述这个方法的作用) * @param @param discountId * @param @return * @return List<Order> * @throws */ public Order findOrderPage(Long discountId); /** * 定时更新打折活动 */ public void updateDiscountStateJob(); /** * 定时执行离线信息 */ public void updateOfflineStateJob(); /** * 根据离线消息Id删除打折活动的离线消息 * @param id */ public void deleteOffLineMessage(Long id) throws Exception; }
2,943
0.667992
0.656859
128
18.648438
19.642345
104
true
false
0
0
0
0
0
0
1.023438
false
false
10
d0c13d62797e5e751288587f24b3697d15fef051
7,962,869,381,964
f0b2e5db814227cd1176bda71c9947fd36ba575f
/pullupdownrefresh/src/main/java/com/soli/pullupdownrefresh/ptr/PtrUIHandler.java
7cab082b0d67cbb60844c16549e1c60c7969f095
[ "Apache-2.0" ]
permissive
wanliLiu/PullUpDownRefresh
https://github.com/wanliLiu/PullUpDownRefresh
e628ba0c1430b72a3deeb962ea3295e4115e1e3b
9b17fb0e049f74deb1637af862a64e0091a8aa27
refs/heads/master
2021-07-18T09:43:43.415000
2018-12-28T16:13:32
2018-12-28T16:13:32
108,085,975
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.soli.pullupdownrefresh.ptr; import com.soli.pullupdownrefresh.ptr.indicator.PtrIndicator; /** * */ public interface PtrUIHandler { /** * When the content view has reached top and refresh has been completed, view will be reset. * * @param frame */ void onUIReset(PtrFrameLayout frame); /** * prepare for loading * * @param frame */ void onUIRefreshPrepare(PtrFrameLayout frame); /** * perform refreshing UI */ void onUIRefreshBegin(PtrFrameLayout frame); /** * perform UI after refresh */ void onUIRefreshComplete(PtrFrameLayout frame); /** * @param frame * @param isUnderTouch * @param status * @param ptrIndicator */ void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator); }
UTF-8
Java
876
java
PtrUIHandler.java
Java
[]
null
[]
package com.soli.pullupdownrefresh.ptr; import com.soli.pullupdownrefresh.ptr.indicator.PtrIndicator; /** * */ public interface PtrUIHandler { /** * When the content view has reached top and refresh has been completed, view will be reset. * * @param frame */ void onUIReset(PtrFrameLayout frame); /** * prepare for loading * * @param frame */ void onUIRefreshPrepare(PtrFrameLayout frame); /** * perform refreshing UI */ void onUIRefreshBegin(PtrFrameLayout frame); /** * perform UI after refresh */ void onUIRefreshComplete(PtrFrameLayout frame); /** * @param frame * @param isUnderTouch * @param status * @param ptrIndicator */ void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator); }
876
0.64726
0.64726
42
19.857143
25.037659
112
false
false
0
0
0
0
0
0
0.261905
false
false
10
2aa5c2de36a7c0202a1f3172de2d74b17b9211ac
26,079,041,445,491
c870a837f5a9931be4e7db737651f1db771ad91f
/src/main/java/com/xellitix/commons/net/compat/java/uri/DefaultUriFactory.java
a118444cbda94fada5b4dc4a55bf286264cb8d2b
[]
no_license
xellitix/commons-net
https://github.com/xellitix/commons-net
4b71da65f3a10ea4c97dbdc0f8e9c8956e9a414d
b796ee4022c9fd2404265b5aeac2be9cdcaa602f
refs/heads/master
2023-01-04T06:30:16.983000
2019-01-31T17:54:03
2019-01-31T17:54:03
101,359,366
0
1
null
false
2020-11-02T05:48:39
2017-08-25T02:53:35
2019-01-31T18:13:47
2020-11-02T05:48:38
19
0
1
0
Java
false
false
package com.xellitix.commons.net.compat.java.uri; import java.net.URI; import java.net.URISyntaxException; /** * Default {@link UriFactory} implementation. * * @author Grayson Kuhns */ public class DefaultUriFactory implements UriFactory { /** * Creates a {@link URI}. * * @param uri The string representation. * @return The {@link URI}. * @throws URISyntaxException If the string representation is malformed. */ @Override public URI create(final String uri) throws URISyntaxException { return new URI(uri); } }
UTF-8
Java
549
java
DefaultUriFactory.java
Java
[ { "context": "t {@link UriFactory} implementation.\n *\n * @author Grayson Kuhns\n */\npublic class DefaultUriFactory implements Uri", "end": 186, "score": 0.9998694658279419, "start": 173, "tag": "NAME", "value": "Grayson Kuhns" } ]
null
[]
package com.xellitix.commons.net.compat.java.uri; import java.net.URI; import java.net.URISyntaxException; /** * Default {@link UriFactory} implementation. * * @author <NAME> */ public class DefaultUriFactory implements UriFactory { /** * Creates a {@link URI}. * * @param uri The string representation. * @return The {@link URI}. * @throws URISyntaxException If the string representation is malformed. */ @Override public URI create(final String uri) throws URISyntaxException { return new URI(uri); } }
542
0.704918
0.704918
24
21.875
22.25667
74
false
false
0
0
0
0
0
0
0.166667
false
false
10
7f63b2daf0a45bf5c2b7f4fbcc3fffe31f622621
292,057,817,707
929c4dacba6d7f61ebf30dd9929c0633ae6e587d
/src/transport/multicast/ReliableMulticastChannel.java
a7e89891a525271b585c752eea2e9abd64ddeba3
[]
no_license
emielsteerneman/ad-hoc
https://github.com/emielsteerneman/ad-hoc
609fd832fcc2c048745fcdffbe382218d27bed65
962ec52086a8cd25001839184dfe866de0e03266
refs/heads/master
2021-01-19T11:23:18.400000
2014-04-30T09:47:03
2014-04-30T09:47:03
18,509,314
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package transport.multicast; import java.net.InetAddress; import java.util.HashMap; import java.util.Random; import transport.TransportPacket; import transport.unicast.ReliableChannelListener; import transport.unicast.TransportProtocol; import network.NetworkInterface; import network.NetworkListener; import network.NetworkPacket; public class ReliableMulticastChannel extends Thread implements NetworkListener { private static final int MSS = 256; private static final byte HOPCOUNT = 3; private HashMap<InetAddress, Boolean> devices; private NetworkInterface networkInterface; private ReliableMulticastChannelListener reliableMulticastChannelListener = null; private TransportProtocol protocol; private byte streamNumber; public ReliableMulticastChannel(NetworkInterface networkInterface) { this.networkInterface = networkInterface; this.streamNumber = (byte) (new Random().nextInt(256) + Byte.MIN_VALUE); } @Override public void onReceive(NetworkPacket packet) { } public synchronized void sendBytes(byte[] bytes) { for (int fragement = 0; fragement < bytes.length; fragement += MSS) { int dataLength = Math.min(MSS, bytes.length - fragement); byte[] data = new byte[dataLength]; System.arraycopy(bytes, fragement, data, 0, dataLength); TransportPacket transportPacket = new TransportPacket(data); transportPacket.setStreamNumber(streamNumber); if (bytes.length > MSS) { if (bytes.length - fragement > MSS) { transportPacket.setFlags(TransportPacket.FRAGMENTED | TransportPacket.MORE_FRAGMENTS); } else { transportPacket.setFlags(TransportPacket.FRAGMENTED); } } protocol.addToQueue(transportPacket); } streamNumber++; } public void addDevice(InetAddress device) { devices.put(device, false); } public void removeDevice(InetAddress device) { devices.remove(device); } public void setReliableMulticastChannelListener(ReliableMulticastChannelListener reliableMulticastChannelListener) { this.reliableMulticastChannelListener = reliableMulticastChannelListener; } //fix this shit bro }
UTF-8
Java
2,115
java
ReliableMulticastChannel.java
Java
[]
null
[]
package transport.multicast; import java.net.InetAddress; import java.util.HashMap; import java.util.Random; import transport.TransportPacket; import transport.unicast.ReliableChannelListener; import transport.unicast.TransportProtocol; import network.NetworkInterface; import network.NetworkListener; import network.NetworkPacket; public class ReliableMulticastChannel extends Thread implements NetworkListener { private static final int MSS = 256; private static final byte HOPCOUNT = 3; private HashMap<InetAddress, Boolean> devices; private NetworkInterface networkInterface; private ReliableMulticastChannelListener reliableMulticastChannelListener = null; private TransportProtocol protocol; private byte streamNumber; public ReliableMulticastChannel(NetworkInterface networkInterface) { this.networkInterface = networkInterface; this.streamNumber = (byte) (new Random().nextInt(256) + Byte.MIN_VALUE); } @Override public void onReceive(NetworkPacket packet) { } public synchronized void sendBytes(byte[] bytes) { for (int fragement = 0; fragement < bytes.length; fragement += MSS) { int dataLength = Math.min(MSS, bytes.length - fragement); byte[] data = new byte[dataLength]; System.arraycopy(bytes, fragement, data, 0, dataLength); TransportPacket transportPacket = new TransportPacket(data); transportPacket.setStreamNumber(streamNumber); if (bytes.length > MSS) { if (bytes.length - fragement > MSS) { transportPacket.setFlags(TransportPacket.FRAGMENTED | TransportPacket.MORE_FRAGMENTS); } else { transportPacket.setFlags(TransportPacket.FRAGMENTED); } } protocol.addToQueue(transportPacket); } streamNumber++; } public void addDevice(InetAddress device) { devices.put(device, false); } public void removeDevice(InetAddress device) { devices.remove(device); } public void setReliableMulticastChannelListener(ReliableMulticastChannelListener reliableMulticastChannelListener) { this.reliableMulticastChannelListener = reliableMulticastChannelListener; } //fix this shit bro }
2,115
0.77305
0.768794
73
27.986301
27.333302
117
false
false
0
0
0
0
0
0
2.068493
false
false
10
3194ddc56a2b4c6af84051d9d5f4d9dddfd6ae15
3,246,995,295,608
52a61700be74ae1a5fd1a7b4d2bdfe632015ecb8
/src/generated/java/org/sarge/jove/platform/vulkan/VkObjectTableIndexBufferEntryNVX.java
d3214da669d480aff1fafcede72c4372e501dc4e
[]
no_license
stridecolossus/JOVE
https://github.com/stridecolossus/JOVE
60c248a09171827b049b599e8006a7e558f8b3ba
690f01a8a4464c967781c3d7a53a8866be00793b
refs/heads/master
2023-07-20T07:40:09.165000
2023-07-08T16:21:22
2023-07-08T16:21:22
17,083,829
1
0
null
false
2014-03-23T18:00:38
2014-02-22T11:51:16
2014-03-23T18:00:38
2014-03-23T18:00:38
412
0
0
0
Java
null
null
package org.sarge.jove.platform.vulkan; import org.sarge.jove.platform.vulkan.common.VulkanStructure; import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.Structure.FieldOrder; /** * Vulkan structure. * This class has been code-generated. */ @FieldOrder({ "type", "flags", "buffer", "indexType" }) public class VkObjectTableIndexBufferEntryNVX extends VulkanStructure { public static class ByValue extends VkObjectTableIndexBufferEntryNVX implements Structure.ByValue { } public static class ByReference extends VkObjectTableIndexBufferEntryNVX implements Structure.ByReference { } public VkObjectEntryTypeNVX type; public int flags; public Pointer buffer; public VkIndexType indexType; }
UTF-8
Java
731
java
VkObjectTableIndexBufferEntryNVX.java
Java
[]
null
[]
package org.sarge.jove.platform.vulkan; import org.sarge.jove.platform.vulkan.common.VulkanStructure; import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.Structure.FieldOrder; /** * Vulkan structure. * This class has been code-generated. */ @FieldOrder({ "type", "flags", "buffer", "indexType" }) public class VkObjectTableIndexBufferEntryNVX extends VulkanStructure { public static class ByValue extends VkObjectTableIndexBufferEntryNVX implements Structure.ByValue { } public static class ByReference extends VkObjectTableIndexBufferEntryNVX implements Structure.ByReference { } public VkObjectEntryTypeNVX type; public int flags; public Pointer buffer; public VkIndexType indexType; }
731
0.798906
0.798906
27
26.074074
29.145771
110
false
false
0
0
0
0
0
0
0.851852
false
false
10
f5735c7037fdb762c2c83dacab35f6fb6096d6b2
5,866,925,392,417
14770bf1e0a9beffe756027ca1bf7296ccaae96b
/database/src/main/java/com/alelk/bcpt/database/util/RepositoryUtil.java
4e3490c48f465dacc013a8ecfc4733bb3b4a88d1
[]
no_license
alelk/bcpt
https://github.com/alelk/bcpt
2845d3a9e70b117012e2c376fe6ef1f5117d6388
1da1a4f53deeb8001f0bff6d9ddc0121306711fb
refs/heads/master
2021-05-08T05:19:19.428000
2017-12-28T09:13:12
2017-12-28T09:13:12
107,932,127
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alelk.bcpt.database.util; import com.alelk.bcpt.database.model.AbstractEntity; import com.alelk.bcpt.database.model.AbstractEntity_; import com.alelk.bcpt.database.predicate.AbstractPredicateBuilder; import com.alelk.bcpt.database.specifications.AbstractSpecifications; import com.alelk.bcpt.model.AnalysisConclusion; import com.alelk.bcpt.model.pagination.Filter; import com.alelk.bcpt.model.pagination.SortBy; import com.alelk.bcpt.model.pagination.SortDirection; import org.reflections.ReflectionUtils; import org.reflections.Reflections; import org.reflections.util.ClasspathHelper; import org.reflections.util.ConfigurationBuilder; import org.reflections.util.FilterBuilder; import javax.persistence.criteria.*; import javax.persistence.metamodel.StaticMetamodel; import java.lang.reflect.Field; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Repository Util * * Created by Alex Elkin on 12.10.2017. */ public class RepositoryUtil { private static Reflections reflections = new Reflections( new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage(AbstractEntity.class.getPackage().getName())) .filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(AbstractEntity.class.getPackage().getName()))) ); /** * Modifies query with sort criteria * * @param clazz class of entity * @param query original query * @param root JPA root object * @param cb criteria builder * @param sortBy a list of {@link SortBy} elements which contains sorting rules (fields and appropriate directions) * @param <E> entity type * @return modified query */ public static <E extends AbstractEntity> CriteriaQuery<E> sort( Class<E> clazz, CriteriaQuery<E> query, Root<E> root, CriteriaBuilder cb, List<SortBy> sortBy ) { if (sortBy == null || sortBy.size() == 0) return query; List<String> allowedFieldNames = getSortableFields(clazz).stream().map(Field::getName).collect(Collectors.toList()); List<Order> orders = sortBy.stream().filter(order -> allowedFieldNames.contains(order.getFieldName())) .map(order -> SortDirection.DESC.equals(order.getDirection()) ? cb.desc(root.get(order.getFieldName())) : cb.asc(root.get(order.getFieldName())) ).collect(Collectors.toList()); return query.orderBy(orders); } /** * Build query with sort and filter criteria * * @param clazz the class of the result entity * @param cb criteria builder * @param sort sort criteria * @param filters filter criteria * @param predicateBuilder predicate builder * @param <E> the type of entity * @param <M> the type of entity JPA meta model * @return criteria query */ public static <E extends AbstractEntity, M extends AbstractEntity_> CriteriaQuery<E> query( Class<E> clazz, CriteriaBuilder cb, List<SortBy> sort, List<Filter> filters, AbstractPredicateBuilder<E, M, ? extends AbstractSpecifications<E, M>> predicateBuilder ) { final CriteriaQuery<E> criteriaQuery = cb.createQuery(clazz); final Root<E> root = criteriaQuery.from(clazz); final Predicate predicate = predicateBuilder.buildPredicate(root, criteriaQuery, cb, filters); final CriteriaQuery<E> select = criteriaQuery.select(root); if (predicate != null) select.where(predicate); sort(clazz, criteriaQuery, root, cb, sort); return select; } /** * Query count items after filter criteria applying * * @param clazz the class of the target entity * @param cb criteria builder * @param filters filters * @param predicateBuilder predicate builder for the target entity * @param <E> the type of the target entity * @param <M> the type of entity JPA meta model * @return count query */ public static <E extends AbstractEntity, M extends AbstractEntity_> CriteriaQuery<Long> countItemsQuery (Class<E> clazz, CriteriaBuilder cb, List<Filter> filters, AbstractPredicateBuilder<E, M, ? extends AbstractSpecifications<E, M>> predicateBuilder ) { final CriteriaQuery<Long> countQuery = cb.createQuery(Long.class); final Root<E> root = countQuery.from(clazz); countQuery.select(cb.count(root)); final Predicate predicate = predicateBuilder.buildPredicate(root, countQuery, cb, filters); if (predicate != null) countQuery.where(predicate); return countQuery; } @SuppressWarnings("unchecked") public static <E extends AbstractEntity> Set<Field> getSortableMetamodelFields(Class<E> clazz) { Class<? extends AbstractEntity_> metaModel = getMetaModel(clazz); List<String> sortableFieldNames = getSortableFields(clazz).stream() .map(Field::getName).collect(Collectors.toList()); return ReflectionUtils.getAllFields(metaModel, Objects::nonNull).stream() .filter(field -> sortableFieldNames.contains(field.getName())).collect(Collectors.toSet()); } @SuppressWarnings("unchecked") public static <E extends AbstractEntity> Set<Field> getSortableFields(Class<E> clazz) { return ReflectionUtils.getAllFields(clazz, field -> field != null && field.isAnnotationPresent(Sortable.class)); } @SuppressWarnings("unchecked") public static <E extends AbstractEntity> Class<? extends AbstractEntity_> getMetaModel(Class<E> clazz) { return (Class<? extends AbstractEntity_>) reflections.getTypesAnnotatedWith(StaticMetamodel.class).stream() .filter(annotatedClass -> clazz.equals(annotatedClass.getAnnotation(StaticMetamodel.class).value())) .findFirst().orElse(null); } public static AnalysisConclusion processAnalysisConclusion(Stream<AnalysisConclusion> stream) { return stream.reduce(AnalysisConclusion.PASS, (accumulator, analysis) -> { if (analysis == null) return AnalysisConclusion.PASS.equals(accumulator) ? null : accumulator; return analysis.morePriorityThan(accumulator) ? AnalysisConclusion.PASS.equals(analysis) ? null : analysis : accumulator; }); } }
UTF-8
Java
6,538
java
RepositoryUtil.java
Java
[ { "context": "m.Stream;\n\n/**\n * Repository Util\n *\n * Created by Alex Elkin on 12.10.2017.\n */\npublic class RepositoryUtil {\n", "end": 1005, "score": 0.9996671080589294, "start": 995, "tag": "NAME", "value": "Alex Elkin" } ]
null
[]
package com.alelk.bcpt.database.util; import com.alelk.bcpt.database.model.AbstractEntity; import com.alelk.bcpt.database.model.AbstractEntity_; import com.alelk.bcpt.database.predicate.AbstractPredicateBuilder; import com.alelk.bcpt.database.specifications.AbstractSpecifications; import com.alelk.bcpt.model.AnalysisConclusion; import com.alelk.bcpt.model.pagination.Filter; import com.alelk.bcpt.model.pagination.SortBy; import com.alelk.bcpt.model.pagination.SortDirection; import org.reflections.ReflectionUtils; import org.reflections.Reflections; import org.reflections.util.ClasspathHelper; import org.reflections.util.ConfigurationBuilder; import org.reflections.util.FilterBuilder; import javax.persistence.criteria.*; import javax.persistence.metamodel.StaticMetamodel; import java.lang.reflect.Field; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Repository Util * * Created by <NAME> on 12.10.2017. */ public class RepositoryUtil { private static Reflections reflections = new Reflections( new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage(AbstractEntity.class.getPackage().getName())) .filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(AbstractEntity.class.getPackage().getName()))) ); /** * Modifies query with sort criteria * * @param clazz class of entity * @param query original query * @param root JPA root object * @param cb criteria builder * @param sortBy a list of {@link SortBy} elements which contains sorting rules (fields and appropriate directions) * @param <E> entity type * @return modified query */ public static <E extends AbstractEntity> CriteriaQuery<E> sort( Class<E> clazz, CriteriaQuery<E> query, Root<E> root, CriteriaBuilder cb, List<SortBy> sortBy ) { if (sortBy == null || sortBy.size() == 0) return query; List<String> allowedFieldNames = getSortableFields(clazz).stream().map(Field::getName).collect(Collectors.toList()); List<Order> orders = sortBy.stream().filter(order -> allowedFieldNames.contains(order.getFieldName())) .map(order -> SortDirection.DESC.equals(order.getDirection()) ? cb.desc(root.get(order.getFieldName())) : cb.asc(root.get(order.getFieldName())) ).collect(Collectors.toList()); return query.orderBy(orders); } /** * Build query with sort and filter criteria * * @param clazz the class of the result entity * @param cb criteria builder * @param sort sort criteria * @param filters filter criteria * @param predicateBuilder predicate builder * @param <E> the type of entity * @param <M> the type of entity JPA meta model * @return criteria query */ public static <E extends AbstractEntity, M extends AbstractEntity_> CriteriaQuery<E> query( Class<E> clazz, CriteriaBuilder cb, List<SortBy> sort, List<Filter> filters, AbstractPredicateBuilder<E, M, ? extends AbstractSpecifications<E, M>> predicateBuilder ) { final CriteriaQuery<E> criteriaQuery = cb.createQuery(clazz); final Root<E> root = criteriaQuery.from(clazz); final Predicate predicate = predicateBuilder.buildPredicate(root, criteriaQuery, cb, filters); final CriteriaQuery<E> select = criteriaQuery.select(root); if (predicate != null) select.where(predicate); sort(clazz, criteriaQuery, root, cb, sort); return select; } /** * Query count items after filter criteria applying * * @param clazz the class of the target entity * @param cb criteria builder * @param filters filters * @param predicateBuilder predicate builder for the target entity * @param <E> the type of the target entity * @param <M> the type of entity JPA meta model * @return count query */ public static <E extends AbstractEntity, M extends AbstractEntity_> CriteriaQuery<Long> countItemsQuery (Class<E> clazz, CriteriaBuilder cb, List<Filter> filters, AbstractPredicateBuilder<E, M, ? extends AbstractSpecifications<E, M>> predicateBuilder ) { final CriteriaQuery<Long> countQuery = cb.createQuery(Long.class); final Root<E> root = countQuery.from(clazz); countQuery.select(cb.count(root)); final Predicate predicate = predicateBuilder.buildPredicate(root, countQuery, cb, filters); if (predicate != null) countQuery.where(predicate); return countQuery; } @SuppressWarnings("unchecked") public static <E extends AbstractEntity> Set<Field> getSortableMetamodelFields(Class<E> clazz) { Class<? extends AbstractEntity_> metaModel = getMetaModel(clazz); List<String> sortableFieldNames = getSortableFields(clazz).stream() .map(Field::getName).collect(Collectors.toList()); return ReflectionUtils.getAllFields(metaModel, Objects::nonNull).stream() .filter(field -> sortableFieldNames.contains(field.getName())).collect(Collectors.toSet()); } @SuppressWarnings("unchecked") public static <E extends AbstractEntity> Set<Field> getSortableFields(Class<E> clazz) { return ReflectionUtils.getAllFields(clazz, field -> field != null && field.isAnnotationPresent(Sortable.class)); } @SuppressWarnings("unchecked") public static <E extends AbstractEntity> Class<? extends AbstractEntity_> getMetaModel(Class<E> clazz) { return (Class<? extends AbstractEntity_>) reflections.getTypesAnnotatedWith(StaticMetamodel.class).stream() .filter(annotatedClass -> clazz.equals(annotatedClass.getAnnotation(StaticMetamodel.class).value())) .findFirst().orElse(null); } public static AnalysisConclusion processAnalysisConclusion(Stream<AnalysisConclusion> stream) { return stream.reduce(AnalysisConclusion.PASS, (accumulator, analysis) -> { if (analysis == null) return AnalysisConclusion.PASS.equals(accumulator) ? null : accumulator; return analysis.morePriorityThan(accumulator) ? AnalysisConclusion.PASS.equals(analysis) ? null : analysis : accumulator; }); } }
6,534
0.684001
0.682625
147
43.476189
34.096767
131
false
false
0
0
0
0
0
0
0.564626
false
false
6
e3ea3b5df371c6b1aa376116bf814518d78b91b9
4,672,924,488,295
ca8139022d7c62c43786a52487647d281f5303b4
/WatechPark(APP)/app/src/main/java/com/example/watechpark/Register.java
65f27bc9beca442f9aac924929ccd3bc0371516c
[]
no_license
VikasCENG/WatechPark
https://github.com/VikasCENG/WatechPark
670b6fa9291169bb90fddd026e952a391140a02c
9a5a0a673438df2d3afe9a3ceae19333d1b4ff29
refs/heads/master
2020-08-12T13:45:31.897000
2020-04-16T06:18:26
2020-04-16T06:18:26
214,778,008
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.watechpark; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.content.ContentResolver; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.view.MenuItem; import android.view.View; import android.webkit.MimeTypeMap; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import java.io.IOException; import de.hdodenhof.circleimageview.CircleImageView; public class Register extends AppCompatActivity { private EditText editFullName, editPhone, editEmail,editUserName, editPassword; private TextView textCreateAccount, textReg, textFullName, textPhone, textEmail, textUserName, textPassword, textPolicy; private Button signUp; private CircleImageView profilePic; private Toolbar toolBar; private CheckBox box; private FirebaseAuth mAuth; private FirebaseStorage firebaseStorage; private ProgressBar progressBar; private Uri image; private static int SELECT_IMAGE = 1000; private StorageReference storageReference; @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.AppTheme); super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); findAllViews(); setSupportActionBar(toolBar); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); progressBar.setVisibility(View.GONE); mAuth = FirebaseAuth.getInstance(); firebaseStorage = FirebaseStorage.getInstance(); storageReference = firebaseStorage.getReference(); profilePic.setImageResource(R.drawable.logo); profilePic.setOnClickListener(new View.OnClickListener() { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) @Override public void onClick(View v) { Intent i = new Intent(); i.setType("image/*"); i.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(i, getString(R.string.sel_prof)), SELECT_IMAGE); } }); signUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String imageID = System.currentTimeMillis() + "." + getExtension(image); final String fullName = editFullName.getText().toString(); final String phone = editPhone.getText().toString(); final String email = editEmail.getText().toString(); final String username = editUserName.getText().toString(); final String password = editPassword.getText().toString(); final Long time = System.currentTimeMillis() / 1000; final String timestamp = time.toString(); if (fullName.isEmpty()) { editFullName.setError(getString(R.string.full_req)); editFullName.requestFocus(); } else if (phone.isEmpty()) { editPhone.setError(getString(R.string.phone_req)); editPhone.requestFocus(); } else if (email.isEmpty()) { editEmail.setError(getString(R.string.email_req)); editEmail.requestFocus(); } else if (username.isEmpty()) { editUserName.setError(getString(R.string.user_req)); editUserName.requestFocus(); } else if (password.isEmpty()) { editPassword.setError(getString(R.string.psw_req)); } else { registerValidate(); } } }); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if(requestCode == SELECT_IMAGE && resultCode == RESULT_OK && data.getData() != null){ image = data.getData(); try { Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), image); profilePic.setImageBitmap(bitmap); } catch (IOException e) { e.printStackTrace(); } } super.onActivityResult(requestCode, resultCode, data); } @Override public boolean onOptionsItemSelected(MenuItem item) { Intent i = new Intent(getApplicationContext(), LoginRegister.class); startActivity(i); return super.onOptionsItemSelected(item); } public String getExtension(Uri image){ ContentResolver contentResolver = getContentResolver(); MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton(); return mimeTypeMap.getExtensionFromMimeType(contentResolver.getType(image)); } private void registerValidate() { final String imageID = System.currentTimeMillis() + "." + getExtension(image); final String fullName = editFullName.getText().toString(); final String phone = editPhone.getText().toString(); final String email = editEmail.getText().toString(); final String username = editUserName.getText().toString(); final String password = editPassword.getText().toString(); final Long time = System.currentTimeMillis() / 1000; final String timestamp = time.toString(); progressBar.setVisibility(View.VISIBLE); mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { progressBar.setVisibility(View.GONE); if (task.isSuccessful()) { StorageReference imageRef = storageReference.child(mAuth.getUid()).child("Image").child("Profile Image"); final UploadTask uploadTask = imageRef.putFile(image); uploadTask.addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Toast.makeText(getApplicationContext(), "Failed to register account!" + R.string.fail_up, Toast.LENGTH_SHORT).show(); } }).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { Toast.makeText(getApplicationContext(),"Registration successful! Please proceed to Login...", Toast.LENGTH_SHORT).show(); } }); TestUsers user = new TestUsers(imageID,fullName, phone, email, username, timestamp); FirebaseDatabase.getInstance().getReference(getString(R.string.test_user)).child(FirebaseAuth.getInstance().getCurrentUser().getUid()) .setValue(user); Intent startLogin = new Intent(getApplicationContext(),LoginRegister.class); startActivity(startLogin); } else { Toast.makeText(getApplicationContext(), getString(R.string.failed_reg), Toast.LENGTH_LONG).show(); } } }); } private void findAllViews(){ textPassword = findViewById(R.id.textView25); textUserName = findViewById(R.id.textView24); textPhone = findViewById(R.id.textView23); textFullName = findViewById(R.id.textView10); textEmail = findViewById(R.id.textView20); textCreateAccount = findViewById(R.id.textView26); textPolicy = findViewById(R.id.textView27); editFullName = (EditText)findViewById(R.id.editText3); editPhone = (EditText)findViewById(R.id.editText4); editEmail = findViewById(R.id.editText5); editUserName = findViewById(R.id.editText6); editPassword = findViewById(R.id.editText7); signUp = (Button)findViewById(R.id.button5); box = (CheckBox)findViewById(R.id.checkBox2); toolBar = (Toolbar)findViewById(R.id.toolbar2); progressBar = findViewById(R.id.progressBar2); profilePic = (CircleImageView)findViewById(R.id.profile_image); } }
UTF-8
Java
9,573
java
Register.java
Java
[ { "context": "Text().toString();\n final String username = editUserName.getText().toString();\n final String passwo", "end": 6184, "score": 0.990746796131134, "start": 6172, "tag": "USERNAME", "value": "editUserName" }, { "context": "Text().toString();\n final St...
null
[]
package com.example.watechpark; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.content.ContentResolver; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.view.MenuItem; import android.view.View; import android.webkit.MimeTypeMap; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import java.io.IOException; import de.hdodenhof.circleimageview.CircleImageView; public class Register extends AppCompatActivity { private EditText editFullName, editPhone, editEmail,editUserName, editPassword; private TextView textCreateAccount, textReg, textFullName, textPhone, textEmail, textUserName, textPassword, textPolicy; private Button signUp; private CircleImageView profilePic; private Toolbar toolBar; private CheckBox box; private FirebaseAuth mAuth; private FirebaseStorage firebaseStorage; private ProgressBar progressBar; private Uri image; private static int SELECT_IMAGE = 1000; private StorageReference storageReference; @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.AppTheme); super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); findAllViews(); setSupportActionBar(toolBar); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); progressBar.setVisibility(View.GONE); mAuth = FirebaseAuth.getInstance(); firebaseStorage = FirebaseStorage.getInstance(); storageReference = firebaseStorage.getReference(); profilePic.setImageResource(R.drawable.logo); profilePic.setOnClickListener(new View.OnClickListener() { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) @Override public void onClick(View v) { Intent i = new Intent(); i.setType("image/*"); i.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(i, getString(R.string.sel_prof)), SELECT_IMAGE); } }); signUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String imageID = System.currentTimeMillis() + "." + getExtension(image); final String fullName = editFullName.getText().toString(); final String phone = editPhone.getText().toString(); final String email = editEmail.getText().toString(); final String username = editUserName.getText().toString(); final String password = editPassword.getText().toString(); final Long time = System.currentTimeMillis() / 1000; final String timestamp = time.toString(); if (fullName.isEmpty()) { editFullName.setError(getString(R.string.full_req)); editFullName.requestFocus(); } else if (phone.isEmpty()) { editPhone.setError(getString(R.string.phone_req)); editPhone.requestFocus(); } else if (email.isEmpty()) { editEmail.setError(getString(R.string.email_req)); editEmail.requestFocus(); } else if (username.isEmpty()) { editUserName.setError(getString(R.string.user_req)); editUserName.requestFocus(); } else if (password.isEmpty()) { editPassword.setError(getString(R.string.psw_req)); } else { registerValidate(); } } }); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if(requestCode == SELECT_IMAGE && resultCode == RESULT_OK && data.getData() != null){ image = data.getData(); try { Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), image); profilePic.setImageBitmap(bitmap); } catch (IOException e) { e.printStackTrace(); } } super.onActivityResult(requestCode, resultCode, data); } @Override public boolean onOptionsItemSelected(MenuItem item) { Intent i = new Intent(getApplicationContext(), LoginRegister.class); startActivity(i); return super.onOptionsItemSelected(item); } public String getExtension(Uri image){ ContentResolver contentResolver = getContentResolver(); MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton(); return mimeTypeMap.getExtensionFromMimeType(contentResolver.getType(image)); } private void registerValidate() { final String imageID = System.currentTimeMillis() + "." + getExtension(image); final String fullName = editFullName.getText().toString(); final String phone = editPhone.getText().toString(); final String email = editEmail.getText().toString(); final String username = editUserName.getText().toString(); final String password = <PASSWORD>(); final Long time = System.currentTimeMillis() / 1000; final String timestamp = time.toString(); progressBar.setVisibility(View.VISIBLE); mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { progressBar.setVisibility(View.GONE); if (task.isSuccessful()) { StorageReference imageRef = storageReference.child(mAuth.getUid()).child("Image").child("Profile Image"); final UploadTask uploadTask = imageRef.putFile(image); uploadTask.addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Toast.makeText(getApplicationContext(), "Failed to register account!" + R.string.fail_up, Toast.LENGTH_SHORT).show(); } }).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { Toast.makeText(getApplicationContext(),"Registration successful! Please proceed to Login...", Toast.LENGTH_SHORT).show(); } }); TestUsers user = new TestUsers(imageID,fullName, phone, email, username, timestamp); FirebaseDatabase.getInstance().getReference(getString(R.string.test_user)).child(FirebaseAuth.getInstance().getCurrentUser().getUid()) .setValue(user); Intent startLogin = new Intent(getApplicationContext(),LoginRegister.class); startActivity(startLogin); } else { Toast.makeText(getApplicationContext(), getString(R.string.failed_reg), Toast.LENGTH_LONG).show(); } } }); } private void findAllViews(){ textPassword = findViewById(R.id.textView25); textUserName = findViewById(R.id.textView24); textPhone = findViewById(R.id.textView23); textFullName = findViewById(R.id.textView10); textEmail = findViewById(R.id.textView20); textCreateAccount = findViewById(R.id.textView26); textPolicy = findViewById(R.id.textView27); editFullName = (EditText)findViewById(R.id.editText3); editPhone = (EditText)findViewById(R.id.editText4); editEmail = findViewById(R.id.editText5); editUserName = findViewById(R.id.editText6); editPassword = findViewById(R.id.editText7); signUp = (Button)findViewById(R.id.button5); box = (CheckBox)findViewById(R.id.checkBox2); toolBar = (Toolbar)findViewById(R.id.toolbar2); progressBar = findViewById(R.id.progressBar2); profilePic = (CircleImageView)findViewById(R.id.profile_image); } }
9,552
0.635851
0.63209
247
37.757084
32.618481
162
false
false
0
0
0
0
0
0
0.668016
false
false
6
d7de684c8bbc7072cf051b985a7ce3fd23d6c5cb
29,575,144,860,561
32bd5d25514e987eaee31e8870f33cecfcbf20ec
/src/main/java/org/sorm/stm/StatementParam.java
204c285b7778a118b98e4d2001a97a2689287ee1
[ "Unlicense" ]
permissive
diegopablomansilla/massoftware
https://github.com/diegopablomansilla/massoftware
72ffc90dca9153b3486f8235a884f5bddca4560f
cc1ddeb58a40115d8d24ccc20df0d426cd4a0abc
refs/heads/master
2021-09-17T03:55:48.263000
2019-09-12T23:20:45
2019-09-12T23:20:45
202,627,573
0
0
Unlicense
false
2021-08-30T16:26:07
2019-08-16T00:00:40
2019-09-12T23:21:15
2021-08-30T16:26:04
555
0
0
2
Java
false
false
package org.sorm.stm; import java.util.Arrays; public class StatementParam extends Statement { private Object[] args; public Object[] getArgs() { if (args == null) { args = new Object[0]; } return args; } public void setArgs(Object[] args) { this.args = args; } public boolean addArg(Object newArg) { if (args == null) { args = new Object[0]; } Object[] args = new Object[this.args.length + 1]; for (int i = 0; i < this.args.length; i++) { args[i] = this.args[i]; } args[args.length - 1] = newArg; this.args = args; return true; } public String toString() { String s = ""; s += "\n" + this.getSql(); s += "\n"; if (args == null) { args = new Object[0][0]; } s += "\n" + Arrays.toString(args); return s; } @SuppressWarnings("rawtypes") public Object buildArg(Object arg, Class c) { return (arg == null || arg.toString().trim().isEmpty()) ? c : arg; } @SuppressWarnings("rawtypes") public Object buildArgTrim(Object arg, Class c) { if (c == String.class) { return (arg == null || arg.toString().trim().isEmpty()) ? c : arg.toString().trim(); } return buildArg(arg, c); } @SuppressWarnings("rawtypes") public Object buildArgTrimLower(Object arg, Class c) { if (c == String.class) { return (arg == null || arg.toString().trim().isEmpty()) ? c : "%" + arg.toString().trim().toLowerCase() + "%"; } return (arg == null || arg.toString().trim().isEmpty()) ? c : arg; } }
UTF-8
Java
1,478
java
StatementParam.java
Java
[]
null
[]
package org.sorm.stm; import java.util.Arrays; public class StatementParam extends Statement { private Object[] args; public Object[] getArgs() { if (args == null) { args = new Object[0]; } return args; } public void setArgs(Object[] args) { this.args = args; } public boolean addArg(Object newArg) { if (args == null) { args = new Object[0]; } Object[] args = new Object[this.args.length + 1]; for (int i = 0; i < this.args.length; i++) { args[i] = this.args[i]; } args[args.length - 1] = newArg; this.args = args; return true; } public String toString() { String s = ""; s += "\n" + this.getSql(); s += "\n"; if (args == null) { args = new Object[0][0]; } s += "\n" + Arrays.toString(args); return s; } @SuppressWarnings("rawtypes") public Object buildArg(Object arg, Class c) { return (arg == null || arg.toString().trim().isEmpty()) ? c : arg; } @SuppressWarnings("rawtypes") public Object buildArgTrim(Object arg, Class c) { if (c == String.class) { return (arg == null || arg.toString().trim().isEmpty()) ? c : arg.toString().trim(); } return buildArg(arg, c); } @SuppressWarnings("rawtypes") public Object buildArgTrimLower(Object arg, Class c) { if (c == String.class) { return (arg == null || arg.toString().trim().isEmpty()) ? c : "%" + arg.toString().trim().toLowerCase() + "%"; } return (arg == null || arg.toString().trim().isEmpty()) ? c : arg; } }
1,478
0.593369
0.588633
74
18.972973
20.491245
87
false
false
0
0
0
0
0
0
1.797297
false
false
6
2294aac3da929c53fe65b676ba5d441a8afc9575
32,289,564,197,787
9e089f5153215035cfeb04d2335d4f17f5992f7b
/src/uk/ac/lancs/socialcomp/prediction/models/gaussianSequence/GaussianDistribution.java
81545020a11ab1c3c71bfabafd35bd85b77d1079
[]
no_license
mrowebot/Identity-Lifecycles
https://github.com/mrowebot/Identity-Lifecycles
4afd84826d5fd45a505068e427e5a5c3b1dd0e50
2112c89d9140c3bf105b09fb9a35eea67bfd6e5d
refs/heads/master
2021-05-30T07:36:44.426000
2015-01-22T16:52:49
2015-01-22T16:52:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uk.ac.lancs.socialcomp.prediction.models.gaussianSequence; import org.apache.commons.math3.distribution.NormalDistribution; /** * Author: Matthew Rowe * Email: m.rowe@lancaster.ac.uk * Date / Time : 17/07/2014 / 16:40 */ public class GaussianDistribution { double mean; double sd; int type; // the type of the sequence - i.e. 1 = churn, 0 = non-churn public GaussianDistribution(double mean, double sd, int type) { this.mean = mean; this.sd = sd; this.type = type; } public double getMean() { return mean; } public void setMean(double mean) { this.mean = mean; } public double getSd() { return sd; } public void setSd(double sd) { this.sd = sd; } public int getType() { return type; } public void setType(int type) { this.type = type; } @Override public String toString() { return "GaussianDistribution{" + "mean=" + mean + ", sd=" + sd + ", type=" + type + '}'; } public double calcProb(double value) { double prob = 0; if((mean != 0) && (sd !=0)) { NormalDistribution distribution = new NormalDistribution(mean, sd); prob = distribution.density(value); } return prob; } }
UTF-8
Java
1,388
java
GaussianDistribution.java
Java
[ { "context": "3.distribution.NormalDistribution;\n\n/**\n * Author: Matthew Rowe\n * Email: m.rowe@lancaster.ac.uk\n * Date / Time :", "end": 161, "score": 0.9998888969421387, "start": 149, "tag": "NAME", "value": "Matthew Rowe" }, { "context": "stribution;\n\n/**\n * Author: Matthew...
null
[]
package uk.ac.lancs.socialcomp.prediction.models.gaussianSequence; import org.apache.commons.math3.distribution.NormalDistribution; /** * Author: <NAME> * Email: <EMAIL> * Date / Time : 17/07/2014 / 16:40 */ public class GaussianDistribution { double mean; double sd; int type; // the type of the sequence - i.e. 1 = churn, 0 = non-churn public GaussianDistribution(double mean, double sd, int type) { this.mean = mean; this.sd = sd; this.type = type; } public double getMean() { return mean; } public void setMean(double mean) { this.mean = mean; } public double getSd() { return sd; } public void setSd(double sd) { this.sd = sd; } public int getType() { return type; } public void setType(int type) { this.type = type; } @Override public String toString() { return "GaussianDistribution{" + "mean=" + mean + ", sd=" + sd + ", type=" + type + '}'; } public double calcProb(double value) { double prob = 0; if((mean != 0) && (sd !=0)) { NormalDistribution distribution = new NormalDistribution(mean, sd); prob = distribution.density(value); } return prob; } }
1,367
0.546109
0.533141
63
21.031746
19.826204
79
false
false
0
0
0
0
0
0
0.396825
false
false
6
bf631b4edd26c0bc691fe05ba5d7b52e95e0a9c3
12,850,542,219,382
10a07a1679181968abc8fec913ef50ec68114b70
/src/main/java/pe/com/smm/util/PropertiesExternos.java
9c20ead756bdac9a0c81dae22d1a1402e837a862
[]
no_license
wjma90/SMM
https://github.com/wjma90/SMM
17aeac86d9ab294067ff6b32ef59f46db3b40a05
b11779b09ac2702b00e9e29f59df30296906a24f
refs/heads/master
2017-05-24T18:53:58.370000
2015-01-28T22:03:58
2015-01-28T22:03:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pe.com.smm.util; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class PropertiesExternos { @Value("${rpta.exito}") public String RPTA_EXITO; @Value("${rpta.error}") public String RPTA_ERROR; @Value("${identificador.usuario.session}") public String IDENTIFICADOR_SESSION; @Value("${duracion.session}") public Integer DURACION_SESSION; }
UTF-8
Java
457
java
PropertiesExternos.java
Java
[]
null
[]
package pe.com.smm.util; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Component public class PropertiesExternos { @Value("${rpta.exito}") public String RPTA_EXITO; @Value("${rpta.error}") public String RPTA_ERROR; @Value("${identificador.usuario.session}") public String IDENTIFICADOR_SESSION; @Value("${duracion.session}") public Integer DURACION_SESSION; }
457
0.728665
0.728665
20
20.85
17.959051
58
false
false
0
0
0
0
0
0
0.75
false
false
6
7b4b17389ac4834a23aafb6a6db039436df51d64
27,462,020,892,834
d0139b89d92e4e9d02c24cc5630029c5bf970bab
/app/src/main/java/com/albadrsystems/linkcard/utils/Constants.java
bca27a8a3da9b87edd1b77a982762d9cc80fac07
[]
no_license
mohamadabdelhamid/LinkCard
https://github.com/mohamadabdelhamid/LinkCard
62eeba7c19bbfba097472036b71a46b15b8fb2c3
1f0d01449b2a01627fffb8dc5ca0f3444465088b
refs/heads/master
2020-07-20T05:43:19.671000
2019-09-05T14:26:23
2019-09-05T14:26:23
206,583,362
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.albadrsystems.linkcard.utils; public class Constants { // public static final String BASE_URL = "http://link2card.com/"; public static final String BASE_URL = "http://link2card.com/test/"; public static final String IS_LOGIN = "is_login"; public static final String USER_NAME = "user_name"; public static final String USER_PASSWORD = "user_password"; public static final String USER_ID = "user_id"; public static final String USER_PHONE_NUMBER = "user_phone_number"; public static final String PARENT_ID = "parent_id"; public static final String API_TOKEN = "api_token"; public static final String CURRENT_BALANCE = "current_balance"; }
UTF-8
Java
688
java
Constants.java
Java
[ { "context": "gin\";\n public static final String USER_NAME = \"user_name\";\n public static final String USER_PASSWORD = ", "end": 316, "score": 0.9996511340141296, "start": 307, "tag": "USERNAME", "value": "user_name" }, { "context": ";\n public static final String USER_PA...
null
[]
package com.albadrsystems.linkcard.utils; public class Constants { // public static final String BASE_URL = "http://link2card.com/"; public static final String BASE_URL = "http://link2card.com/test/"; public static final String IS_LOGIN = "is_login"; public static final String USER_NAME = "user_name"; public static final String USER_PASSWORD = "<PASSWORD>"; public static final String USER_ID = "user_id"; public static final String USER_PHONE_NUMBER = "user_phone_number"; public static final String PARENT_ID = "parent_id"; public static final String API_TOKEN = "api_token"; public static final String CURRENT_BALANCE = "current_balance"; }
685
0.715116
0.712209
14
48.214287
22.932131
71
false
false
0
0
0
0
0
0
0.785714
false
false
6
71f8e12db063025f5db20a02d166dc3a8850b451
18,648,748,063,357
fefbbb8312698b283fafb9ffe615094d84df6a63
/src/java/剑指Offer/type09_回溯法/矩阵中的路径.java
80790b49991b801639cf3d317caf8be0f971abd9
[]
no_license
loveincode/nowcoder
https://github.com/loveincode/nowcoder
bb971cd7868f21748322ae84e00e2cd7e60c5f00
2085009cb8fec2cfa12e43e3dbfad93b6c07007a
refs/heads/master
2022-02-23T18:59:13.285000
2019-08-31T09:30:57
2019-08-31T09:30:57
112,295,007
6
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package 剑指Offer.type09_回溯法; /** * * @author loveincode * @data 2017年12月17日 下午10:41:07 */ public class 矩阵中的路径 { /* * 请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。 * 路径可以从矩阵中的任意一个格子开始,每一步可以在矩阵中向左,向右,向上,向下移动一个格子。 * 如果一条路径经过了矩阵中的某一个格子,则该路径不能再进入该格子。 * 例如 a b c e s f c s a d e e 矩阵中包含一条字符串"bcced"的路径 * ,但是矩阵中不包含"abcb"路径,因为字符串的第一个字符b占据了矩阵中的第一行第二个格子之后, * 路径不能再次进入该格子。 */ /* * 分析:回溯算法 这是一个可以用回朔法解决的典型题。首先,在矩阵中任选一个格子作为路径的起点。如果路径上的第i个字符不是ch,那么这个格子不可能处在路径上的 第i个位置。如果路径上的第i个字符正好是ch,那么往相邻的格子寻找路径上的第i+1个字符。除在矩阵边界上的格子之外,其他格子都有4个相邻的格子。 重复这个过程直到路径上的所有字符都在矩阵中找到相应的位置。   由于回朔法的递归特性,路径可以被开成一个栈。当在矩阵中定位了路径中前n个字符的位置之后,在与第n个字符对应的格子的周围都没有找到第n+1个 字符,这个时候只要在路径上回到第n-1个字符,重新定位第n个字符。   由于路径不能重复进入矩阵的格子,还需要定义和字符矩阵大小一样的布尔值矩阵,用来标识路径是否已经进入每个格子。 当矩阵中坐标为(row,col)的 格子和路径字符串中相应的字符一样时,从4个相邻的格子(row,col-1),(row-1,col),(row,col+1)以及(row+1,col)中去定位路径字符串中下一个字符 如果4个相邻的格子都没有匹配字符串中下一个的字符,表明当前路径字符串中字符在矩阵中的定位不正确,我们需要回到前一个,然后重新定位。   一直重复这个过程,直到路径字符串上所有字符都在矩阵中找到合适的位置 */ /** 用一个状态数组保存之前访问过的字符,然后再分别按上,下,左,右递归 */ public boolean hasPath(char[] matrix, int rows, int cols, char[] str) { int flag[] = new int[matrix.length]; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { if (helper(matrix, rows, cols, i, j, str, 0, flag)) return true; } } return false; } private boolean helper(char[] matrix, int rows, int cols, int i, int j, char[] str, int k, int[] flag) { int index = i * cols + j; if (i < 0 || i >= rows || j < 0 || j >= cols || matrix[index] != str[k] || flag[index] == 1) return false; if(k == str.length - 1) return true; flag[index] = 1; if (helper(matrix, rows, cols, i - 1, j, str, k + 1, flag) || helper(matrix, rows, cols, i + 1, j, str, k + 1, flag) || helper(matrix, rows, cols, i, j - 1, str, k + 1, flag) || helper(matrix, rows, cols, i, j + 1, str, k + 1, flag)) { return true; } flag[index] = 0; return false; } }
UTF-8
Java
3,480
java
矩阵中的路径.java
Java
[ { "context": "package 剑指Offer.type09_回溯法;\n/**\n*\n* @author loveincode\n* @data 2017年12月17日 下午10:41:07\n*/\npublic class 矩阵", "end": 54, "score": 0.9993894100189209, "start": 44, "tag": "USERNAME", "value": "loveincode" } ]
null
[]
package 剑指Offer.type09_回溯法; /** * * @author loveincode * @data 2017年12月17日 下午10:41:07 */ public class 矩阵中的路径 { /* * 请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。 * 路径可以从矩阵中的任意一个格子开始,每一步可以在矩阵中向左,向右,向上,向下移动一个格子。 * 如果一条路径经过了矩阵中的某一个格子,则该路径不能再进入该格子。 * 例如 a b c e s f c s a d e e 矩阵中包含一条字符串"bcced"的路径 * ,但是矩阵中不包含"abcb"路径,因为字符串的第一个字符b占据了矩阵中的第一行第二个格子之后, * 路径不能再次进入该格子。 */ /* * 分析:回溯算法 这是一个可以用回朔法解决的典型题。首先,在矩阵中任选一个格子作为路径的起点。如果路径上的第i个字符不是ch,那么这个格子不可能处在路径上的 第i个位置。如果路径上的第i个字符正好是ch,那么往相邻的格子寻找路径上的第i+1个字符。除在矩阵边界上的格子之外,其他格子都有4个相邻的格子。 重复这个过程直到路径上的所有字符都在矩阵中找到相应的位置。   由于回朔法的递归特性,路径可以被开成一个栈。当在矩阵中定位了路径中前n个字符的位置之后,在与第n个字符对应的格子的周围都没有找到第n+1个 字符,这个时候只要在路径上回到第n-1个字符,重新定位第n个字符。   由于路径不能重复进入矩阵的格子,还需要定义和字符矩阵大小一样的布尔值矩阵,用来标识路径是否已经进入每个格子。 当矩阵中坐标为(row,col)的 格子和路径字符串中相应的字符一样时,从4个相邻的格子(row,col-1),(row-1,col),(row,col+1)以及(row+1,col)中去定位路径字符串中下一个字符 如果4个相邻的格子都没有匹配字符串中下一个的字符,表明当前路径字符串中字符在矩阵中的定位不正确,我们需要回到前一个,然后重新定位。   一直重复这个过程,直到路径字符串上所有字符都在矩阵中找到合适的位置 */ /** 用一个状态数组保存之前访问过的字符,然后再分别按上,下,左,右递归 */ public boolean hasPath(char[] matrix, int rows, int cols, char[] str) { int flag[] = new int[matrix.length]; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { if (helper(matrix, rows, cols, i, j, str, 0, flag)) return true; } } return false; } private boolean helper(char[] matrix, int rows, int cols, int i, int j, char[] str, int k, int[] flag) { int index = i * cols + j; if (i < 0 || i >= rows || j < 0 || j >= cols || matrix[index] != str[k] || flag[index] == 1) return false; if(k == str.length - 1) return true; flag[index] = 1; if (helper(matrix, rows, cols, i - 1, j, str, k + 1, flag) || helper(matrix, rows, cols, i + 1, j, str, k + 1, flag) || helper(matrix, rows, cols, i, j - 1, str, k + 1, flag) || helper(matrix, rows, cols, i, j + 1, str, k + 1, flag)) { return true; } flag[index] = 0; return false; } }
3,480
0.6125
0.591827
58
34.862068
28.48015
108
false
false
0
0
0
0
0
0
1.87931
false
false
6
86093bf7a18e72d488abd643d029dfb35631640d
18,648,748,063,711
5b6b8d13e2986aecff7ef914f5f644dfb60af17f
/src/test/java/jhyun/loanmowerman/testing_supp/WebMvcTestBase.java
a5a08a954bef9a10b59929ef4fddf9561c149112
[]
no_license
ageldama/loan-mower-man
https://github.com/ageldama/loan-mower-man
b1bb1c8633ddceac8345f76e8d34f34833815f1a
4b9dc2b3b49841fc1deed81c9b983c0107d4ef6b
refs/heads/master
2023-06-21T06:42:16.981000
2019-08-27T07:42:21
2019-08-27T07:42:21
201,643,869
1
0
null
false
2023-06-14T22:24:57
2019-08-10T14:52:21
2023-03-05T02:26:37
2023-06-14T22:24:57
251
1
0
1
Java
false
false
package jhyun.loanmowerman.testing_supp; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import jhyun.loanmowerman.controllers.api_user.SignInForm; import lombok.extern.slf4j.Slf4j; import lombok.val; import org.apache.http.impl.client.HttpClientBuilder; import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.*; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.util.LinkedMultiValueMap; import org.springframework.web.client.RestTemplate; import java.nio.charset.Charset; import java.util.HashMap; import static org.assertj.core.api.Assertions.assertThat; @Slf4j @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class WebMvcTestBase { @LocalServerPort protected int port; protected RestTemplate restTemplate; @Before public void setUp() { val httpClient = HttpClientBuilder.create().disableRedirectHandling().build(); restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient)); restTemplate.getMessageConverters() .add(0, new StringHttpMessageConverter(Charset.forName("UTF-8"))); } protected String apiBase() { return String.format("http://localhost:%s", port); } protected final String apiUserId = "foo"; protected final String apiUserPw = "bar"; protected HttpHeaders apiUserJwtHeaders() { ObjectMapper objectMapper = new ObjectMapper(); // signin HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); SignInForm signInForm = new SignInForm(); signInForm.setId(apiUserId); signInForm.setPassword(apiUserPw); String jsonBody = ""; try { jsonBody = objectMapper.writeValueAsString(signInForm); } catch (JsonProcessingException e) { throw new RuntimeException(e); } HttpEntity request = new HttpEntity(jsonBody, headers); ResponseEntity<String> response = restTemplate.exchange(apiBase() + "/api-user/signin", HttpMethod.POST, request, String.class); assertThat(response.getHeaders()).containsKey("Token"); assertThat(response.getHeaders().getFirst("Token")).isNotBlank(); assertThat(response.getStatusCodeValue()).isEqualTo(200); // final HttpHeaders headers2 = new HttpHeaders(); final String token = response.getHeaders().getFirst("Token"); headers2.add("Authorization", String.format("Bearer %s", token)); return headers2; } }
UTF-8
Java
3,012
java
WebMvcTestBase.java
Java
[ { "context": " = \"foo\";\n protected final String apiUserPw = \"bar\";\n\n protected HttpHeaders apiUserJwtHeaders() ", "end": 1742, "score": 0.9701120853424072, "start": 1739, "tag": "PASSWORD", "value": "bar" }, { "context": ".setId(apiUserId);\n signInForm.setPasswor...
null
[]
package jhyun.loanmowerman.testing_supp; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import jhyun.loanmowerman.controllers.api_user.SignInForm; import lombok.extern.slf4j.Slf4j; import lombok.val; import org.apache.http.impl.client.HttpClientBuilder; import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.*; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.util.LinkedMultiValueMap; import org.springframework.web.client.RestTemplate; import java.nio.charset.Charset; import java.util.HashMap; import static org.assertj.core.api.Assertions.assertThat; @Slf4j @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class WebMvcTestBase { @LocalServerPort protected int port; protected RestTemplate restTemplate; @Before public void setUp() { val httpClient = HttpClientBuilder.create().disableRedirectHandling().build(); restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient)); restTemplate.getMessageConverters() .add(0, new StringHttpMessageConverter(Charset.forName("UTF-8"))); } protected String apiBase() { return String.format("http://localhost:%s", port); } protected final String apiUserId = "foo"; protected final String apiUserPw = "bar"; protected HttpHeaders apiUserJwtHeaders() { ObjectMapper objectMapper = new ObjectMapper(); // signin HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); SignInForm signInForm = new SignInForm(); signInForm.setId(apiUserId); signInForm.setPassword(<PASSWORD>); String jsonBody = ""; try { jsonBody = objectMapper.writeValueAsString(signInForm); } catch (JsonProcessingException e) { throw new RuntimeException(e); } HttpEntity request = new HttpEntity(jsonBody, headers); ResponseEntity<String> response = restTemplate.exchange(apiBase() + "/api-user/signin", HttpMethod.POST, request, String.class); assertThat(response.getHeaders()).containsKey("Token"); assertThat(response.getHeaders().getFirst("Token")).isNotBlank(); assertThat(response.getStatusCodeValue()).isEqualTo(200); // final HttpHeaders headers2 = new HttpHeaders(); final String token = response.getHeaders().getFirst("Token"); headers2.add("Authorization", String.format("Bearer %s", token)); return headers2; } }
3,013
0.725432
0.721116
76
38.63158
25.597
96
false
false
0
0
0
0
0
0
0.710526
false
false
6
f00c91b025f8b253a331a39a3d0bccdc744f0bb2
14,362,370,651,529
03721d9a5691420d91c580cd15582d6e86dd15e8
/SicAppDao/SicAppDao/src/main/java/com/general/entity/Sic3persdocuPK.java
57a9e1ca381688b920837248d84d8a74e87f7ca9
[]
no_license
EdgardMoreno/WEBAPPSIC
https://github.com/EdgardMoreno/WEBAPPSIC
399923719111934e2efa6d8c929f488537f4bd34
bd1012f29d6f80506f8995aad7dbb2db4c262af3
refs/heads/master
2022-07-24T00:24:53.435000
2019-06-11T15:39:18
2019-06-11T15:39:18
191,399,168
0
0
null
false
2022-06-29T17:26:01
2019-06-11T15:23:07
2019-06-11T15:40:29
2022-06-29T17:26:01
28,759
0
0
2
Java
false
false
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.general.entity; import java.io.Serializable; import java.math.BigInteger; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; /** * * @author emoreno */ @Embeddable public class Sic3persdocuPK implements Serializable { @Basic(optional = false) @NotNull @Column(name = "FEC_DESDE") @Temporal(TemporalType.TIMESTAMP) private Date fecDesde; @Basic(optional = false) @NotNull @Column(name = "ID_TROLPERS") private BigInteger idTrolpers; @Basic(optional = false) @NotNull @Column(name = "ID_TRELAPERS") private BigInteger idTrelapers; @Basic(optional = false) @NotNull @Column(name = "ID_DOCU") private BigInteger idDocu; @Basic(optional = false) @NotNull @Column(name = "ID_PERS") private BigInteger idPers; public Sic3persdocuPK() { } public Sic3persdocuPK(Date fecDesde, BigInteger idTrolpers, BigInteger idTrelapers, BigInteger idDocu, BigInteger idPers) { this.fecDesde = fecDesde; this.idTrolpers = idTrolpers; this.idTrelapers = idTrelapers; this.idDocu = idDocu; this.idPers = idPers; } public Date getFecDesde() { return fecDesde; } public void setFecDesde(Date fecDesde) { this.fecDesde = fecDesde; } public BigInteger getIdTrolpers() { return idTrolpers; } public void setIdTrolpers(BigInteger idTrolpers) { this.idTrolpers = idTrolpers; } public BigInteger getIdTrelapers() { return idTrelapers; } public void setIdTrelapers(BigInteger idTrelapers) { this.idTrelapers = idTrelapers; } public BigInteger getIdDocu() { return idDocu; } public void setIdDocu(BigInteger idDocu) { this.idDocu = idDocu; } public BigInteger getIdPers() { return idPers; } public void setIdPers(BigInteger idPers) { this.idPers = idPers; } @Override public int hashCode() { int hash = 0; hash += (fecDesde != null ? fecDesde.hashCode() : 0); hash += (idTrolpers != null ? idTrolpers.hashCode() : 0); hash += (idTrelapers != null ? idTrelapers.hashCode() : 0); hash += (idDocu != null ? idDocu.hashCode() : 0); hash += (idPers != null ? idPers.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Sic3persdocuPK)) { return false; } Sic3persdocuPK other = (Sic3persdocuPK) object; if ((this.fecDesde == null && other.fecDesde != null) || (this.fecDesde != null && !this.fecDesde.equals(other.fecDesde))) { return false; } if ((this.idTrolpers == null && other.idTrolpers != null) || (this.idTrolpers != null && !this.idTrolpers.equals(other.idTrolpers))) { return false; } if ((this.idTrelapers == null && other.idTrelapers != null) || (this.idTrelapers != null && !this.idTrelapers.equals(other.idTrelapers))) { return false; } if ((this.idDocu == null && other.idDocu != null) || (this.idDocu != null && !this.idDocu.equals(other.idDocu))) { return false; } if ((this.idPers == null && other.idPers != null) || (this.idPers != null && !this.idPers.equals(other.idPers))) { return false; } return true; } @Override public String toString() { return "com.general.entity.Sic3persdocuPK[ fecDesde=" + fecDesde + ", idTrolpers=" + idTrolpers + ", idTrelapers=" + idTrelapers + ", idDocu=" + idDocu + ", idPers=" + idPers + " ]"; } }
UTF-8
Java
4,151
java
Sic3persdocuPK.java
Java
[ { "context": "validation.constraints.NotNull;\n\n/**\n *\n * @author emoreno\n */\n@Embeddable\npublic class Sic3persdocuPK imple", "end": 542, "score": 0.9996104836463928, "start": 535, "tag": "USERNAME", "value": "emoreno" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.general.entity; import java.io.Serializable; import java.math.BigInteger; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; /** * * @author emoreno */ @Embeddable public class Sic3persdocuPK implements Serializable { @Basic(optional = false) @NotNull @Column(name = "FEC_DESDE") @Temporal(TemporalType.TIMESTAMP) private Date fecDesde; @Basic(optional = false) @NotNull @Column(name = "ID_TROLPERS") private BigInteger idTrolpers; @Basic(optional = false) @NotNull @Column(name = "ID_TRELAPERS") private BigInteger idTrelapers; @Basic(optional = false) @NotNull @Column(name = "ID_DOCU") private BigInteger idDocu; @Basic(optional = false) @NotNull @Column(name = "ID_PERS") private BigInteger idPers; public Sic3persdocuPK() { } public Sic3persdocuPK(Date fecDesde, BigInteger idTrolpers, BigInteger idTrelapers, BigInteger idDocu, BigInteger idPers) { this.fecDesde = fecDesde; this.idTrolpers = idTrolpers; this.idTrelapers = idTrelapers; this.idDocu = idDocu; this.idPers = idPers; } public Date getFecDesde() { return fecDesde; } public void setFecDesde(Date fecDesde) { this.fecDesde = fecDesde; } public BigInteger getIdTrolpers() { return idTrolpers; } public void setIdTrolpers(BigInteger idTrolpers) { this.idTrolpers = idTrolpers; } public BigInteger getIdTrelapers() { return idTrelapers; } public void setIdTrelapers(BigInteger idTrelapers) { this.idTrelapers = idTrelapers; } public BigInteger getIdDocu() { return idDocu; } public void setIdDocu(BigInteger idDocu) { this.idDocu = idDocu; } public BigInteger getIdPers() { return idPers; } public void setIdPers(BigInteger idPers) { this.idPers = idPers; } @Override public int hashCode() { int hash = 0; hash += (fecDesde != null ? fecDesde.hashCode() : 0); hash += (idTrolpers != null ? idTrolpers.hashCode() : 0); hash += (idTrelapers != null ? idTrelapers.hashCode() : 0); hash += (idDocu != null ? idDocu.hashCode() : 0); hash += (idPers != null ? idPers.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Sic3persdocuPK)) { return false; } Sic3persdocuPK other = (Sic3persdocuPK) object; if ((this.fecDesde == null && other.fecDesde != null) || (this.fecDesde != null && !this.fecDesde.equals(other.fecDesde))) { return false; } if ((this.idTrolpers == null && other.idTrolpers != null) || (this.idTrolpers != null && !this.idTrolpers.equals(other.idTrolpers))) { return false; } if ((this.idTrelapers == null && other.idTrelapers != null) || (this.idTrelapers != null && !this.idTrelapers.equals(other.idTrelapers))) { return false; } if ((this.idDocu == null && other.idDocu != null) || (this.idDocu != null && !this.idDocu.equals(other.idDocu))) { return false; } if ((this.idPers == null && other.idPers != null) || (this.idPers != null && !this.idPers.equals(other.idPers))) { return false; } return true; } @Override public String toString() { return "com.general.entity.Sic3persdocuPK[ fecDesde=" + fecDesde + ", idTrolpers=" + idTrolpers + ", idTrelapers=" + idTrelapers + ", idDocu=" + idDocu + ", idPers=" + idPers + " ]"; } }
4,151
0.623223
0.620092
139
28.86331
31.929148
190
false
false
0
0
0
0
0
0
0.482014
false
false
6
5159bae18e3d9ab6b1f3df0f931a53652b6a97b9
16,664,473,160,808
678a3d58c110afd1e9ce195d2f20b2531d45a2e0
/sources/com/airbnb/android/core/fragments/LocalAttractionsFragment$$Icepick.java
15563553bb5a7c26476a99d3fd5adcc582ee297f
[]
no_license
jasonnth/AirCode
https://github.com/jasonnth/AirCode
d1c37fb9ba3d8087efcdd9fa2103fb85d13735d5
d37db1baa493fca56f390c4205faf5c9bbe36604
refs/heads/master
2020-07-03T08:35:24.902000
2019-08-12T03:34:56
2019-08-12T03:34:56
201,842,970
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.airbnb.android.core.fragments; import android.os.Bundle; import com.airbnb.android.core.fragments.LocalAttractionsFragment; import icepick.Bundler; import icepick.Injector.Helper; import icepick.Injector.Object; import java.util.HashMap; import java.util.Map; public class LocalAttractionsFragment$$Icepick<T extends LocalAttractionsFragment> extends Object<T> { private static final Map<String, Bundler<?>> BUNDLERS = new HashMap(); /* renamed from: H */ private static final Helper f8451H = new Helper("com.airbnb.android.core.fragments.LocalAttractionsFragment$$Icepick.", BUNDLERS); public void restore(T target, Bundle state) { if (state != null) { target.mLoopingListingPosition = f8451H.getInt(state, "mLoopingListingPosition"); super.restore(target, state); } } public void save(T target, Bundle state) { super.save(target, state); f8451H.putInt(state, "mLoopingListingPosition", target.mLoopingListingPosition); } }
UTF-8
Java
1,026
java
LocalAttractionsFragment$$Icepick.java
Java
[]
null
[]
package com.airbnb.android.core.fragments; import android.os.Bundle; import com.airbnb.android.core.fragments.LocalAttractionsFragment; import icepick.Bundler; import icepick.Injector.Helper; import icepick.Injector.Object; import java.util.HashMap; import java.util.Map; public class LocalAttractionsFragment$$Icepick<T extends LocalAttractionsFragment> extends Object<T> { private static final Map<String, Bundler<?>> BUNDLERS = new HashMap(); /* renamed from: H */ private static final Helper f8451H = new Helper("com.airbnb.android.core.fragments.LocalAttractionsFragment$$Icepick.", BUNDLERS); public void restore(T target, Bundle state) { if (state != null) { target.mLoopingListingPosition = f8451H.getInt(state, "mLoopingListingPosition"); super.restore(target, state); } } public void save(T target, Bundle state) { super.save(target, state); f8451H.putInt(state, "mLoopingListingPosition", target.mLoopingListingPosition); } }
1,026
0.727096
0.7154
28
35.642857
34.751377
134
false
false
0
0
0
0
0
0
0.821429
false
false
6
04fe051f022d079cfb547f53468e217bcccb2c06
21,260,088,158,214
f13cdc80d65ec6b3e1d76c7ce3d78b67e2bad749
/src/day0407/ArrayEqualityComprasion.java
6e31e008145617362568415a929311d0b7c5a4f5
[]
no_license
shmammadov/JavaCodingPractice
https://github.com/shmammadov/JavaCodingPractice
19da54b4be694e2d14e68d30f12cc222db703903
8f12cf39caea04848a95c51cf8087eff830e3afa
refs/heads/master
2020-06-04T12:49:51.177000
2019-06-15T04:31:15
2019-06-15T04:31:15
192,028,130
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package day0407; import java.util.Arrays; public class ArrayEqualityComprasion { public static void main(String[] args) { // TODO Auto-generated method stub int [] arr1 = {2,1,44,3,54}; int [] arr2 = {1,2,44,3,54}; int [] arr3 = {1,3,44,2,54}; System.out.println(arr1==arr2); System.out.println(Arrays.equals(arr1, arr2)); System.out.println(Arrays.equals(arr2, arr3)); Arrays.sort(arr2); Arrays.sort(arr3); System.out.println(Arrays.equals(arr2, arr3)); } }
UTF-8
Java
485
java
ArrayEqualityComprasion.java
Java
[]
null
[]
package day0407; import java.util.Arrays; public class ArrayEqualityComprasion { public static void main(String[] args) { // TODO Auto-generated method stub int [] arr1 = {2,1,44,3,54}; int [] arr2 = {1,2,44,3,54}; int [] arr3 = {1,3,44,2,54}; System.out.println(arr1==arr2); System.out.println(Arrays.equals(arr1, arr2)); System.out.println(Arrays.equals(arr2, arr3)); Arrays.sort(arr2); Arrays.sort(arr3); System.out.println(Arrays.equals(arr2, arr3)); } }
485
0.674227
0.595876
20
23.25
17.244926
48
false
false
0
0
0
0
0
0
2.4
false
false
6
b7193566880b253e6de6d8560966872ea1a9fd90
15,436,112,522,763
03a3b669d95f1b306d59ad9fb3019a06552f5366
/WebApp/src/main/java/net/sqlwebclient/util/ServletUtil.java
f3621e7f12ce40cf8110f267429a633ddef14883
[]
no_license
joeyreinders/sqlwebclient
https://github.com/joeyreinders/sqlwebclient
b700d1a0352e311db35e0630c96621a90412a842
d52000d058ddd0bb3684b7a9e8c665113cb63a55
refs/heads/master
2020-03-23T06:16:49.401000
2018-07-16T22:27:52
2018-07-16T22:27:52
141,200,724
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.sqlwebclient.util; import com.google.inject.Injector; import net.sqlwebclient.controller.request.RequestContext; import javax.servlet.ServletContext; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletResponse; import java.util.Calendar; public final class ServletUtil { private ServletUtil() { throw new AssertionError(); } public static void addCachingExpiration(final HttpServletResponse response) { final Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.YEAR, 1); response.setDateHeader("Expires", calendar.getTimeInMillis()); } public static void addCachingExpiration(final RequestContext context) { addCachingExpiration(context.getResponse()); } public static Injector getInjector(final RequestContext ctx) { return getInjector(ctx.getRequest().getServletContext()); } public static Injector getInjector(final HttpServlet servlet) { return getInjector(servlet.getServletContext()); } public static Injector getInjector(final ServletContext servletContext) { return (Injector) servletContext.getAttribute(Injector.class.getName()); } }
UTF-8
Java
1,131
java
ServletUtil.java
Java
[]
null
[]
package net.sqlwebclient.util; import com.google.inject.Injector; import net.sqlwebclient.controller.request.RequestContext; import javax.servlet.ServletContext; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletResponse; import java.util.Calendar; public final class ServletUtil { private ServletUtil() { throw new AssertionError(); } public static void addCachingExpiration(final HttpServletResponse response) { final Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.YEAR, 1); response.setDateHeader("Expires", calendar.getTimeInMillis()); } public static void addCachingExpiration(final RequestContext context) { addCachingExpiration(context.getResponse()); } public static Injector getInjector(final RequestContext ctx) { return getInjector(ctx.getRequest().getServletContext()); } public static Injector getInjector(final HttpServlet servlet) { return getInjector(servlet.getServletContext()); } public static Injector getInjector(final ServletContext servletContext) { return (Injector) servletContext.getAttribute(Injector.class.getName()); } }
1,131
0.799293
0.798409
37
29.567568
27.132847
78
false
false
0
0
0
0
0
0
1.216216
false
false
6
e04bcb9b4fe7836f63f60ccd657f2d7e0ffa1608
1,056,562,007,919
02449762a4bcff71b749b2b5a2d8f7592ba42dac
/chapter02_test_springjdbc_starter/src/main/java/com/kittycoder/student/repository/StudentRepository.java
e51e840bea6f8f3e960f7159d682be4e74339dcb
[]
no_license
david120911/SpringBootInAction
https://github.com/david120911/SpringBootInAction
a08b1318e67d840e9845fc8b7d2ee92c0bbb16ec
8db78c1f1c0ed5f201ce6b5f994ab3f669760777
refs/heads/master
2022-12-17T15:16:51.766000
2020-09-20T14:46:25
2020-09-20T14:46:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kittycoder.student.repository; import com.kittycoder.student.po.Student; import java.util.List; /** * Created by shucheng on 2020/9/14 0:21 */ public interface StudentRepository { List<Student> selectStudentList(); void insertStudent(Student student); void updateStudent(Student student); }
UTF-8
Java
321
java
StudentRepository.java
Java
[ { "context": "tudent;\n\nimport java.util.List;\n\n/**\n * Created by shucheng on 2020/9/14 0:21\n */\npublic interface StudentRep", "end": 137, "score": 0.9993334412574768, "start": 129, "tag": "USERNAME", "value": "shucheng" } ]
null
[]
package com.kittycoder.student.repository; import com.kittycoder.student.po.Student; import java.util.List; /** * Created by shucheng on 2020/9/14 0:21 */ public interface StudentRepository { List<Student> selectStudentList(); void insertStudent(Student student); void updateStudent(Student student); }
321
0.750779
0.719626
15
20.4
18.700445
42
false
false
0
0
0
0
0
0
0.4
false
false
6
a99d6298b28c5501a2e4fcfe4807f463893b1913
14,559,939,136,554
c5a3d1c1c41e41a3a9d6a9816f82f02103b33b91
/steam-trade-api/src/main/java/ru/ir/steam/dto/AcceptResponse.java
d844d848f8f74642bf1ab89f8967dcc98efd4deb
[ "MIT" ]
permissive
irasikhin/java-steam-client
https://github.com/irasikhin/java-steam-client
af049d4f0c1658aa2f98b599e55cd3990165e0d2
59ad330c4c5d1dabc665b6d2594c95bfbb1c2840
refs/heads/master
2021-08-23T11:47:26.235000
2017-12-04T19:35:39
2017-12-04T19:35:39
109,807,696
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.ir.steam.dto; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.io.Serializable; @Data public class AcceptResponse implements Serializable { @JsonProperty("tradeid") private Long tradeId; @JsonProperty("needs_mobile_confirmation") private Boolean needsMobileConfirmation; @JsonProperty("needs_email_confirmation") private Boolean needsEmailConfirmation; @JsonProperty("email_domain") private String emailDomain; @JsonProperty("strError") private String strError; public Long getTradeId() { return tradeId; } public void setTradeId(Long tradeId) { this.tradeId = tradeId; } public Boolean getNeedsMobileConfirmation() { return needsMobileConfirmation; } public void setNeedsMobileConfirmation(Boolean needsMobileConfirmation) { this.needsMobileConfirmation = needsMobileConfirmation; } public Boolean getNeedsEmailConfirmation() { return needsEmailConfirmation; } public void setNeedsEmailConfirmation(Boolean needsEmailConfirmation) { this.needsEmailConfirmation = needsEmailConfirmation; } public String getEmailDomain() { return emailDomain; } public void setEmailDomain(String emailDomain) { this.emailDomain = emailDomain; } public String getStrError() { return strError; } public void setStrError(String strError) { this.strError = strError; } }
UTF-8
Java
1,516
java
AcceptResponse.java
Java
[]
null
[]
package ru.ir.steam.dto; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.io.Serializable; @Data public class AcceptResponse implements Serializable { @JsonProperty("tradeid") private Long tradeId; @JsonProperty("needs_mobile_confirmation") private Boolean needsMobileConfirmation; @JsonProperty("needs_email_confirmation") private Boolean needsEmailConfirmation; @JsonProperty("email_domain") private String emailDomain; @JsonProperty("strError") private String strError; public Long getTradeId() { return tradeId; } public void setTradeId(Long tradeId) { this.tradeId = tradeId; } public Boolean getNeedsMobileConfirmation() { return needsMobileConfirmation; } public void setNeedsMobileConfirmation(Boolean needsMobileConfirmation) { this.needsMobileConfirmation = needsMobileConfirmation; } public Boolean getNeedsEmailConfirmation() { return needsEmailConfirmation; } public void setNeedsEmailConfirmation(Boolean needsEmailConfirmation) { this.needsEmailConfirmation = needsEmailConfirmation; } public String getEmailDomain() { return emailDomain; } public void setEmailDomain(String emailDomain) { this.emailDomain = emailDomain; } public String getStrError() { return strError; } public void setStrError(String strError) { this.strError = strError; } }
1,516
0.705805
0.705805
65
22.323076
21.634096
77
false
false
0
0
0
0
0
0
0.292308
false
false
6
53ddcd19c41f2e5f3b61eba9a5537696a348a027
34,875,134,466,141
77906432abbae51c94c557fa026b8c7a2f7c70a6
/src/main/java/com/baku/persistentserviceregistry/business/entity/LocationStats.java
27853c546528408bdf7b1916144df1880f9d5f76
[]
no_license
middlewared/ServiceRegistry
https://github.com/middlewared/ServiceRegistry
9c6fab1b860b2f45506d57773fe3688fd30abd31
bd6859deb133520bc6d95024a51fc324aba6b767
refs/heads/master
2021-04-30T15:21:05.360000
2018-04-08T12:19:40
2018-04-08T12:19:40
121,237,381
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.baku.persistentserviceregistry.business.entity; import java.math.BigDecimal; public class LocationStats { private int hits; private BigDecimal avgResponseTime; public int getHits() { return hits; } public void setHits(int hits) { this.hits = hits; } public BigDecimal getAvgResponseTime() { return avgResponseTime; } public void setAvgResponseTime(BigDecimal avgResponseTime) { this.avgResponseTime = avgResponseTime; } }
UTF-8
Java
513
java
LocationStats.java
Java
[]
null
[]
package com.baku.persistentserviceregistry.business.entity; import java.math.BigDecimal; public class LocationStats { private int hits; private BigDecimal avgResponseTime; public int getHits() { return hits; } public void setHits(int hits) { this.hits = hits; } public BigDecimal getAvgResponseTime() { return avgResponseTime; } public void setAvgResponseTime(BigDecimal avgResponseTime) { this.avgResponseTime = avgResponseTime; } }
513
0.684211
0.684211
25
19.52
19.71217
64
false
false
0
0
0
0
0
0
0.32
false
false
6
992d2f120cdc74539e03d3f05b8cf29599f8399c
1,606,317,790,231
e240a2f7da24659172476077d65bb9da484aa7eb
/src/ua/itea/lesson12/tasks/figure/factory/FigureFactory.java
0338cba55848e7e64db027f20bd9bb1fca1db616
[]
no_license
yaroslav36455/ITEA_JavaBase
https://github.com/yaroslav36455/ITEA_JavaBase
f9c1c31b1d77cc5f7d33ff26839ab9efe5258d6b
7201ac246470d49f3071f20eccff203f9638a95d
refs/heads/master
2022-12-27T05:46:22.614000
2020-10-15T07:36:11
2020-10-15T07:36:11
289,955,477
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ua.itea.lesson12.tasks.figure.factory; import ua.itea.lesson12.tasks.figure.Figure; import ua.itea.lesson12.tasks.ColorRandomizer; public class FigureFactory { private ColorRandomizer colorRandomizer; public FigureFactory() { colorRandomizer = new ColorRandomizer(); } public Figure create() { return new Figure(getRandomColor()); } protected String getRandomColor() { return colorRandomizer.getRandomColor(); } }
UTF-8
Java
443
java
FigureFactory.java
Java
[]
null
[]
package ua.itea.lesson12.tasks.figure.factory; import ua.itea.lesson12.tasks.figure.Figure; import ua.itea.lesson12.tasks.ColorRandomizer; public class FigureFactory { private ColorRandomizer colorRandomizer; public FigureFactory() { colorRandomizer = new ColorRandomizer(); } public Figure create() { return new Figure(getRandomColor()); } protected String getRandomColor() { return colorRandomizer.getRandomColor(); } }
443
0.767494
0.75395
20
21.15
19.000723
46
false
false
0
0
0
0
0
0
1.15
false
false
6
14377ed5d3f723781f5d1ddbf7435f65e7306c5d
4,037,269,277,751
67c91239cd6ffabb949cc802d633cdcd50816252
/Safety_App/app/src/main/java/com/example/safety_app/MainActivity.java
c4178d0cc6a401df84e8260740a8f9bd546ca23f
[]
no_license
Devtimbadia44/SaveDaughter
https://github.com/Devtimbadia44/SaveDaughter
29d222be323b9d05a1fc99c3c7112ab8a73d4757
974fc821e41a5e355a39beff8484e45938040693
refs/heads/master
2022-04-15T23:36:07.025000
2020-03-09T06:34:27
2020-03-09T06:34:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.safety_app; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { Button b1, b2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); b1 = findViewById(R.id.button); SharedPreferences sp = getSharedPreferences("MySharedPreferences", MODE_PRIVATE); String id = "id"; // if(sp.getString("id", null).length() > 0){ // startActivity(new Intent(getApplicationContext(), HomeActivity.class)); // finish(); // } onClicker(); } private void onClicker() { b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getApplicationContext(), RegisterActivity.class)); } }); } }
UTF-8
Java
1,115
java
MainActivity.java
Java
[]
null
[]
package com.example.safety_app; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { Button b1, b2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); b1 = findViewById(R.id.button); SharedPreferences sp = getSharedPreferences("MySharedPreferences", MODE_PRIVATE); String id = "id"; // if(sp.getString("id", null).length() > 0){ // startActivity(new Intent(getApplicationContext(), HomeActivity.class)); // finish(); // } onClicker(); } private void onClicker() { b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(getApplicationContext(), RegisterActivity.class)); } }); } }
1,115
0.656502
0.652018
36
29.972221
24.803099
91
false
false
0
0
0
0
0
0
0.638889
false
false
6
5614eb7cc4427a9060189caecb09c3c7001dd8c4
12,790,412,627,965
847b93ee9cbe12703b303d98e5c1b0263b431534
/app/src/main/java/com/trignsoft/propertybuilder/InterFaceClass.java
3c54f1a8da1bd1041639b70d71ab9d0af8d2c058
[]
no_license
SubarnaGautam54/propertyBuilderApp
https://github.com/SubarnaGautam54/propertyBuilderApp
d5149e1f0fdb6db066a91c9d9bd01069f413858f
39e76add14b730948d283c615aeb07c00be05d84
refs/heads/master
2023-08-27T04:31:47.124000
2021-10-13T12:52:41
2021-10-13T12:52:41
408,436,601
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.trignsoft.propertybuilder; public interface InterFaceClass { void getAdminTask(); void getDeveloperTask(); }
UTF-8
Java
131
java
InterFaceClass.java
Java
[]
null
[]
package com.trignsoft.propertybuilder; public interface InterFaceClass { void getAdminTask(); void getDeveloperTask(); }
131
0.755725
0.755725
7
17.714285
15.572083
38
false
false
0
0
0
0
0
0
0.428571
false
false
6
19a9680219919d61b49319c5d0ecc31012706614
14,164,802,161,576
6eccddcfaf82b56599f6dce8b334a1e94a1e6fba
/src/main/java/suanfa/leetcode/tree/_112_路径总和.java
066316970b69e1d8880c016980150c8af82f9bb0
[]
no_license
maikouliujian/AlgorithmStudy
https://github.com/maikouliujian/AlgorithmStudy
2a2e8a8f5f1476112c0d8890c172c92bb8119f86
510067a15d8773f88e5206e7c6facd4cc668fd99
refs/heads/master
2022-12-04T18:17:47.373000
2022-11-17T14:45:52
2022-11-17T14:45:52
170,795,274
1
0
null
false
2020-10-13T22:03:12
2019-02-15T03:19:26
2020-09-27T03:50:03
2020-10-13T22:03:11
384
1
0
1
Java
false
false
package suanfa.leetcode.tree; /** * @author lj * @createDate 2020/6/2 11:40 **/ public class _112_路径总和 { class Solution { //思路:求路径总和,采用深度优先遍历, 深度优先,要么递归,要么用栈 public boolean hasPathSum(TreeNode root, int sum) { return dfs(root,sum); } private boolean dfs(TreeNode root, int sum) { if (root == null) return false; if (root.val == sum && root.left == null && root.right == null) return true; return dfs(root.left,sum-root.val) || dfs(root.right,sum-root.val); } } }
UTF-8
Java
640
java
_112_路径总和.java
Java
[ { "context": "package suanfa.leetcode.tree;\n\n/**\n * @author lj\n * @createDate 2020/6/2 11:40\n **/\npublic class _", "end": 48, "score": 0.9995980262756348, "start": 46, "tag": "USERNAME", "value": "lj" } ]
null
[]
package suanfa.leetcode.tree; /** * @author lj * @createDate 2020/6/2 11:40 **/ public class _112_路径总和 { class Solution { //思路:求路径总和,采用深度优先遍历, 深度优先,要么递归,要么用栈 public boolean hasPathSum(TreeNode root, int sum) { return dfs(root,sum); } private boolean dfs(TreeNode root, int sum) { if (root == null) return false; if (root.val == sum && root.left == null && root.right == null) return true; return dfs(root.left,sum-root.val) || dfs(root.right,sum-root.val); } } }
640
0.56338
0.540493
22
24.818182
25.87318
88
false
false
0
0
0
0
0
0
0.545455
false
false
6
af0719a312c7d5d22f4c796cdd5a7b926c793618
9,715,216,045,780
b5887b73b03481702d38ad8a9e6752f8ddd3daa4
/src/main/java/net/guhya/boot/plot/common/web/response/JsonResult.java
2b69a2cdeb99d9eae7b1dfa00f96eb1c90344b64
[]
no_license
guhya/boot-plot
https://github.com/guhya/boot-plot
87e582dc5e33d1cee5fd987da63d04b4c4716ab2
f226b9107b2b13c6ee3274f3dd528754df6f4f0f
refs/heads/master
2023-05-13T11:18:20.624000
2021-06-07T05:08:56
2021-06-07T05:08:56
373,734,056
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.guhya.boot.plot.common.web.response; import java.time.LocalDateTime; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(Include.NON_NULL) @JsonPropertyOrder({"timestamp", "status", "meta", "data", "error", "message"}) public class JsonResult<T> extends AbstractJsonResult { private T data; public JsonResult() { } /** * Response for successful operation * @param result */ public JsonResult(T result) { super(AbstractJsonResult.SUCCESS, LocalDateTime.now().toString()); this.data = result; } /** * Response for error * @param errorCode * @param ex */ public JsonResult(String errorCode, String message) { super(AbstractJsonResult.ERROR, LocalDateTime.now().toString()); setMessage(message); } /** * Response for error * @param errorCode * @param ex */ public JsonResult(String errorCode, T errors) { super(AbstractJsonResult.ERROR, LocalDateTime.now().toString()); setError(errorCode); this.data = errors; } public T getData() { return data; } public void setData(T data) { this.data = data; } }
UTF-8
Java
1,216
java
JsonResult.java
Java
[]
null
[]
package net.guhya.boot.plot.common.web.response; import java.time.LocalDateTime; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(Include.NON_NULL) @JsonPropertyOrder({"timestamp", "status", "meta", "data", "error", "message"}) public class JsonResult<T> extends AbstractJsonResult { private T data; public JsonResult() { } /** * Response for successful operation * @param result */ public JsonResult(T result) { super(AbstractJsonResult.SUCCESS, LocalDateTime.now().toString()); this.data = result; } /** * Response for error * @param errorCode * @param ex */ public JsonResult(String errorCode, String message) { super(AbstractJsonResult.ERROR, LocalDateTime.now().toString()); setMessage(message); } /** * Response for error * @param errorCode * @param ex */ public JsonResult(String errorCode, T errors) { super(AbstractJsonResult.ERROR, LocalDateTime.now().toString()); setError(errorCode); this.data = errors; } public T getData() { return data; } public void setData(T data) { this.data = data; } }
1,216
0.713816
0.713816
58
19.965517
21.897856
79
false
false
0
0
0
0
0
0
1.275862
false
false
6
913d0ff85365db0cfdf458ea715b2e218a3a1b22
35,321,811,076,988
1114e3d1a4d0e2ee5df7bc054e862049d7b32277
/app/src/main/java/mx/edu/ittepic/recyclerviewsqlite/Alumno.java
4cc7c313779ca99219ac160527727157538d7596
[]
no_license
irisAdanelli/RecyclerViewSQLite
https://github.com/irisAdanelli/RecyclerViewSQLite
3cef3cb0c3bfe5b81d06f1b71a50162a6e7c81ce
c9cfb069b86da12742f97b33b8b58e275523cf08
refs/heads/master
2020-04-10T02:42:43.447000
2018-03-07T15:35:55
2018-03-07T15:35:55
124,256,562
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mx.edu.ittepic.recyclerviewsqlite; /** * Created by OEM on 01/03/2018. */ public class Alumno { private String id; private String nombre; private String domicilio; private double edad; public Alumno() { } public Alumno(String id, String nombre) { this.id = id; this.nombre = nombre; } public Alumno(String id, String nombre, String domicilio, double edad) { this.id = id; this.nombre = nombre; this.domicilio = domicilio; this.edad = edad; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDomicilio() { return domicilio; } public void setDomicilio(String descripcion) { this.domicilio = descripcion; } public double getEdad() { return edad; } public void setEdad(double precio) { this.edad = precio; } }
UTF-8
Java
1,105
java
Alumno.java
Java
[ { "context": "edu.ittepic.recyclerviewsqlite;\n\n/**\n * Created by OEM on 01/03/2018.\n*/\n\npublic class Alumno {\n\n pri", "end": 65, "score": 0.9982916116714478, "start": 62, "tag": "USERNAME", "value": "OEM" } ]
null
[]
package mx.edu.ittepic.recyclerviewsqlite; /** * Created by OEM on 01/03/2018. */ public class Alumno { private String id; private String nombre; private String domicilio; private double edad; public Alumno() { } public Alumno(String id, String nombre) { this.id = id; this.nombre = nombre; } public Alumno(String id, String nombre, String domicilio, double edad) { this.id = id; this.nombre = nombre; this.domicilio = domicilio; this.edad = edad; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDomicilio() { return domicilio; } public void setDomicilio(String descripcion) { this.domicilio = descripcion; } public double getEdad() { return edad; } public void setEdad(double precio) { this.edad = precio; } }
1,105
0.580996
0.573756
60
17.416666
16.568335
76
false
false
0
0
0
0
0
0
0.383333
false
false
6
89a8ff0f56a4bdfdedc145c5eee609f1747b91f1
23,227,183,181,161
6b1f2ee25f7cfba94614db25b09ff28f235c12a3
/ms-app/src/main/java/com/bac/example/microservices/app/service/AuthorService.java
49e2ad7b29e7a70858d966e0ff6290aaa7931faf
[]
no_license
arychand282/sb-example-microservices
https://github.com/arychand282/sb-example-microservices
193dcf7cdef21f22bd29f075bc9a5a76a023bfb5
d6b7f1b2625e459348554082b689b6171303e7de
refs/heads/master
2023-01-03T01:29:50.161000
2020-10-25T06:55:42
2020-10-25T06:55:42
306,874,852
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bac.example.microservices.app.service; import com.bac.example.microservices.app.domain.Author; import java.util.List; import java.util.Optional; /** * @author chandra on 24/10/2020 13:47 */ public interface AuthorService { Author save(Author author); List<Author> findAllIgnoreDeleteFlag(); Optional<Author> findById(String id); }
UTF-8
Java
381
java
AuthorService.java
Java
[ { "context": "l.List;\nimport java.util.Optional;\n\n/**\n * @author chandra on 24/10/2020 13:47\n */\n\npublic interface AuthorS", "end": 182, "score": 0.9973061680793762, "start": 175, "tag": "USERNAME", "value": "chandra" } ]
null
[]
package com.bac.example.microservices.app.service; import com.bac.example.microservices.app.domain.Author; import java.util.List; import java.util.Optional; /** * @author chandra on 24/10/2020 13:47 */ public interface AuthorService { Author save(Author author); List<Author> findAllIgnoreDeleteFlag(); Optional<Author> findById(String id); }
381
0.708661
0.677165
20
18.049999
18.988089
55
false
false
0
0
0
0
0
0
0.35
false
false
6
a7877cc8dbd718310e7197d6379ee5a826d97440
23,227,183,181,725
9fa39ca8524dcc2c29690be8da7c4fe9f25f533a
/test/src/wechat/service/Contacts.java
9a94e173e8146769b29be28bb01906cd884dfe64
[]
no_license
thatklausfeng/WorkTest
https://github.com/thatklausfeng/WorkTest
fced78468d79b23ed74d5a15c05dbea9a760952f
7a4415f09380143cf8192c421736642519748018
refs/heads/master
2021-09-15T15:37:15.856000
2018-06-06T03:31:13
2018-06-06T03:31:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package wechat.service; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; /** * Created by fengguangliang on 2017/4/24. */ public interface Contacts { Gson gson = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSS") .create(); }
UTF-8
Java
410
java
Contacts.java
Java
[ { "context": "rt com.google.gson.GsonBuilder;\n\n/**\n * Created by fengguangliang on 2017/4/24.\n */\npublic interface Contacts {\n ", "end": 165, "score": 0.9948985576629639, "start": 151, "tag": "USERNAME", "value": "fengguangliang" } ]
null
[]
package wechat.service; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; /** * Created by fengguangliang on 2017/4/24. */ public interface Contacts { Gson gson = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSS") .create(); }
410
0.697561
0.680488
15
26.333334
22.437073
80
false
false
0
0
0
0
0
0
0.333333
false
false
6
2126326650bddd84a46e57cab8e7f88ded396bb9
34,351,148,473,924
0fe3a5cdbaa6ca43e9ce5561343f2f95ea6b785a
/inavigator-core/source/inav-core/src/main/java/ru/sberbank/syncserver2/service/core/config/StaticFileInfo.java
0c666a58c402205a44a23e00e775ef6821ed92f9
[]
no_license
552847957/inavigator-server
https://github.com/552847957/inavigator-server
d25cd890d639bde885d7eaf3cda7f20699d3e237
ca682e9894fcaa90b86e65eab291abceda6d9c1f
refs/heads/master
2020-11-23T21:09:59.503000
2019-11-08T17:00:01
2019-11-08T17:00:01
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.sberbank.syncserver2.service.core.config; import java.io.Serializable; /** * Created by sbt-kozhinsky-lb on 04.03.14. */ public class StaticFileInfo implements Serializable { private String app; private String fileId; private String fileName; private String hostnames; private boolean autoGenEnabled; private boolean isGenerationModeDraft; private boolean isDraft; private boolean isCleanStatus; public StaticFileInfo(String app, String fileId, String fileName) { this.app = app; this.fileId = fileId; this.fileName = fileName; } public StaticFileInfo(String app, String fileId, String fileName, String hostnames) { this.app = app; this.fileId = fileId; this.fileName = fileName; this.hostnames = hostnames; } public StaticFileInfo(String app, String fileId, String fileName, String hostnames,boolean autoGenEnabled) { this.app = app; this.fileId = fileId; this.fileName = fileName; this.hostnames = hostnames; this.autoGenEnabled = autoGenEnabled; } public StaticFileInfo(String app, String fileId, String fileName, String hostnames, boolean autoGenEnabled, boolean isGenerationModeDraft, boolean isDraft, boolean isCleanStatus) { super(); this.app = app; this.fileId = fileId; this.fileName = fileName; this.hostnames = hostnames; this.autoGenEnabled = autoGenEnabled; this.isGenerationModeDraft = isGenerationModeDraft; this.isDraft = isDraft; this.isCleanStatus = isCleanStatus; } public String getApp() { return app; } public void setApp(String app) { this.app = app; } public String getFileId() { return fileId; } public void setFileId(String fileId) { this.fileId = fileId; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getHostnames() { return hostnames; } public void setHostnames(String hostnames) { this.hostnames = hostnames; } public boolean isGenerationModeDraft() { return isGenerationModeDraft; } public void setGenerationModeDraft(boolean isGenerationModeDraft) { this.isGenerationModeDraft = isGenerationModeDraft; } public boolean isDraft() { return isDraft; } public void setDraft(boolean isDraft) { this.isDraft = isDraft; } public boolean isCleanStatus() { return isCleanStatus; } public void setCleanStatus(boolean isCleanStatus) { this.isCleanStatus = isCleanStatus; } public boolean isAutoGenEnabled() { return autoGenEnabled; } public void setAutoGenEnabled(boolean autoGenEnabled) { this.autoGenEnabled = autoGenEnabled; } /** * Получить название действия applicationCode_fileName * @return */ public String getFullName() { return (getApp()!=null?getApp().toUpperCase():"") + "_" + (getFileName()!=null?getFileName().toUpperCase():""); } }
UTF-8
Java
3,132
java
StaticFileInfo.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by sbt-kozhinsky-lb on 04.03.14.\n */\npublic class StaticFileInfo impl", "end": 118, "score": 0.9996742010116577, "start": 102, "tag": "USERNAME", "value": "sbt-kozhinsky-lb" } ]
null
[]
package ru.sberbank.syncserver2.service.core.config; import java.io.Serializable; /** * Created by sbt-kozhinsky-lb on 04.03.14. */ public class StaticFileInfo implements Serializable { private String app; private String fileId; private String fileName; private String hostnames; private boolean autoGenEnabled; private boolean isGenerationModeDraft; private boolean isDraft; private boolean isCleanStatus; public StaticFileInfo(String app, String fileId, String fileName) { this.app = app; this.fileId = fileId; this.fileName = fileName; } public StaticFileInfo(String app, String fileId, String fileName, String hostnames) { this.app = app; this.fileId = fileId; this.fileName = fileName; this.hostnames = hostnames; } public StaticFileInfo(String app, String fileId, String fileName, String hostnames,boolean autoGenEnabled) { this.app = app; this.fileId = fileId; this.fileName = fileName; this.hostnames = hostnames; this.autoGenEnabled = autoGenEnabled; } public StaticFileInfo(String app, String fileId, String fileName, String hostnames, boolean autoGenEnabled, boolean isGenerationModeDraft, boolean isDraft, boolean isCleanStatus) { super(); this.app = app; this.fileId = fileId; this.fileName = fileName; this.hostnames = hostnames; this.autoGenEnabled = autoGenEnabled; this.isGenerationModeDraft = isGenerationModeDraft; this.isDraft = isDraft; this.isCleanStatus = isCleanStatus; } public String getApp() { return app; } public void setApp(String app) { this.app = app; } public String getFileId() { return fileId; } public void setFileId(String fileId) { this.fileId = fileId; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getHostnames() { return hostnames; } public void setHostnames(String hostnames) { this.hostnames = hostnames; } public boolean isGenerationModeDraft() { return isGenerationModeDraft; } public void setGenerationModeDraft(boolean isGenerationModeDraft) { this.isGenerationModeDraft = isGenerationModeDraft; } public boolean isDraft() { return isDraft; } public void setDraft(boolean isDraft) { this.isDraft = isDraft; } public boolean isCleanStatus() { return isCleanStatus; } public void setCleanStatus(boolean isCleanStatus) { this.isCleanStatus = isCleanStatus; } public boolean isAutoGenEnabled() { return autoGenEnabled; } public void setAutoGenEnabled(boolean autoGenEnabled) { this.autoGenEnabled = autoGenEnabled; } /** * Получить название действия applicationCode_fileName * @return */ public String getFullName() { return (getApp()!=null?getApp().toUpperCase():"") + "_" + (getFileName()!=null?getFileName().toUpperCase():""); } }
3,132
0.673745
0.671493
140
21.200001
21.247925
112
false
false
0
0
0
0
0
0
0.971429
false
false
6
b53e4c78793adc257ca76c5cb8e2a45f5b812dba
19,859,928,828,910
b77b781cad82fc33887043389b3f073ba4e217ef
/app/src/main/java/pdm/agifpb/firstapp/adapters/ContactListItemAdapter.java
1303d20079f7114bcbdb53ea58779694cb1f83bd
[]
no_license
wensttay/pdm-chat-airsoft
https://github.com/wensttay/pdm-chat-airsoft
f4b03071de90a13491d70e7a93b45fe5c6debccb
3784d58fe78f12f5af81f045e89ae87bf84db2e1
refs/heads/master
2021-06-18T00:42:56.680000
2017-05-18T04:03:53
2017-05-18T04:03:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pdm.agifpb.firstapp.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import pdm.agifpb.firstapp.R; import pdm.agifpb.firstapp.entities.Contact; import pdm.agifpb.firstapp.entities.ContactListItem; /** * Created by yatts on 24/02/2017. */ public class ContactListItemAdapter extends BaseAdapter{ List<ContactListItem> contactList; public ContactListItemAdapter(List<ContactListItem> contactList) { this.contactList = contactList; } @Override public int getCount() { return contactList.size(); } @Override public Object getItem(int position) { return contactList.get(position); } @Override public long getItemId(int position) { return contactList.get(position).getContact().getId(); } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); ContactListItem contactListItem = (ContactListItem) getItem(position); convertView = inflater.inflate(R.layout.box_contact, null); TextView nameView = (TextView) convertView.findViewById(R.id.contact_name); TextView lastMsgView = (TextView) convertView.findViewById(R.id.contact_last_msg); nameView.setText(contactListItem.getContact().getName()); lastMsgView.setText(contactListItem.getLastMsg().getMsg()); return convertView; } }
UTF-8
Java
1,775
java
ContactListItemAdapter.java
Java
[ { "context": "pp.entities.ContactListItem;\r\n\r\n/**\r\n * Created by yatts on 24/02/2017.\r\n */\r\n\r\npublic class ContactListIt", "end": 479, "score": 0.9954242706298828, "start": 474, "tag": "USERNAME", "value": "yatts" } ]
null
[]
package pdm.agifpb.firstapp.adapters; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import pdm.agifpb.firstapp.R; import pdm.agifpb.firstapp.entities.Contact; import pdm.agifpb.firstapp.entities.ContactListItem; /** * Created by yatts on 24/02/2017. */ public class ContactListItemAdapter extends BaseAdapter{ List<ContactListItem> contactList; public ContactListItemAdapter(List<ContactListItem> contactList) { this.contactList = contactList; } @Override public int getCount() { return contactList.size(); } @Override public Object getItem(int position) { return contactList.get(position); } @Override public long getItemId(int position) { return contactList.get(position).getContact().getId(); } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); ContactListItem contactListItem = (ContactListItem) getItem(position); convertView = inflater.inflate(R.layout.box_contact, null); TextView nameView = (TextView) convertView.findViewById(R.id.contact_name); TextView lastMsgView = (TextView) convertView.findViewById(R.id.contact_last_msg); nameView.setText(contactListItem.getContact().getName()); lastMsgView.setText(contactListItem.getLastMsg().getMsg()); return convertView; } }
1,775
0.707042
0.702535
57
29.14035
28.12406
121
false
false
0
0
0
0
0
0
0.508772
false
false
6
17e79e3da18f4fd3005fec080a3411485df8c317
369,367,247,122
315d8b39bc161f7b54794503d388c5cdf89e9497
/Java/5 Lambdas And Streams/P2W5_SetTask/src/be/kdg/set/TestSet.java
6e5427ff025171388994c24e3dc00249f6c6a555
[]
no_license
Bryanx/exercises
https://github.com/Bryanx/exercises
f6ebe93ef953401e1e8625db0333ca80974687a2
c68d5beeec01eeb828e185186f9b8bc9ee54354d
refs/heads/master
2021-07-10T14:22:38.854000
2021-04-05T14:29:12
2021-04-05T14:29:12
54,362,905
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package be.kdg.set; /** * @author Bryan de Ridder * @version 1.0 20/12/2016 16:26 */ public class TestSet { public static void main(String[] args) { Mandje mandje = new Mandje(); mandje.voegToe(new Artikel("Druiven", 2.0)); mandje.voegToe(new Artikel("Passievruchten", 2.35)); mandje.voegToe(new Artikel("Mandarijnen", 2.50)); mandje.voegToe(new Artikel("Pruimen", 2.49)); mandje.voegToe(new Artikel("Druiven", 1.95)); mandje.voegToe(new Artikel("Peren", 1.99)); mandje.voegToe(new Artikel("Appels", 2.20)); mandje.toon(); System.out.println("\nGesorteerd volgens naam:"); mandje.toonGesorteerdVolgensNaam(); System.out.println("\nGesorteerd volgens prijs:"); mandje.toonGesorteerdVolgensPrijs(); } }
UTF-8
Java
817
java
TestSet.java
Java
[ { "context": "package be.kdg.set;\n\n/**\n * @author Bryan de Ridder\n * @version 1.0 20/12/2016 16:26\n */\npublic class", "end": 51, "score": 0.9998749494552612, "start": 36, "tag": "NAME", "value": "Bryan de Ridder" } ]
null
[]
package be.kdg.set; /** * @author <NAME> * @version 1.0 20/12/2016 16:26 */ public class TestSet { public static void main(String[] args) { Mandje mandje = new Mandje(); mandje.voegToe(new Artikel("Druiven", 2.0)); mandje.voegToe(new Artikel("Passievruchten", 2.35)); mandje.voegToe(new Artikel("Mandarijnen", 2.50)); mandje.voegToe(new Artikel("Pruimen", 2.49)); mandje.voegToe(new Artikel("Druiven", 1.95)); mandje.voegToe(new Artikel("Peren", 1.99)); mandje.voegToe(new Artikel("Appels", 2.20)); mandje.toon(); System.out.println("\nGesorteerd volgens naam:"); mandje.toonGesorteerdVolgensNaam(); System.out.println("\nGesorteerd volgens prijs:"); mandje.toonGesorteerdVolgensPrijs(); } }
808
0.626683
0.585067
23
34.52174
20.685785
60
false
false
0
0
0
0
0
0
0.913043
false
false
6
6b92717cc39acd32d7e2f4403697736dba1357fe
18,459,769,440,190
7d7b8505e3c4526594b4e19c22c45db328a2ac82
/CarroDesenhado.java
511c0e3ef023f67907a5ea9a7834883e1e550ddf
[]
no_license
reinaldorauch/2016-06-04-animacao-buffer-image
https://github.com/reinaldorauch/2016-06-04-animacao-buffer-image
ac69aadf6cca8abbb2eee94ee417809c71248733
35950159280a038643cfb5c87734290a81e995ff
refs/heads/master
2020-12-25T07:20:45.826000
2016-07-14T01:58:59
2016-07-14T01:58:59
63,293,708
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.*; import java.awt.geom.*; import java.lang.Math; import java.lang.Thread; public class CarroDesenhado extends Frame { CarroDesenhado() { addWindowListener(new FecharJanela()); } private Shape createDrawing() { GeneralPath gp = new GeneralPath(); gp.moveTo(50,50); gp.lineTo(200,50); gp.lineTo(200,100); gp.lineTo(50,100); gp.lineTo(50,50); AffineTransform toOrigem = new AffineTransform(); toOrigem.translate(-150, -100); return toOrigem.createTransformedShape(gp); } public void paint(Graphics g) { AffineTransform rotation = new AffineTransform(); AffineTransform translation = new AffineTransform(); AffineTransform step = new AffineTransform(); Shape gp = createDrawing(); double angleStep = Math.toRadians(3.6); Graphics2D g2d = (Graphics2D) g; for (int index = 0; index < 100; index++) { rotation.rotate(angleStep); translation.translate(6, 6); step.setToTranslation(150, 100); step.concatenate(translation); step.concatenate(rotation); g2d.draw(step.createTransformedShape(gp)); g2d.clearRect(0, 0, getWidth(), getHeight()); // g2d.draw(translation.createTransformedShape(gp)); try { Thread.sleep(50); } catch (InterruptedException e) { System.out.println("Got interrupted"); } } g2d.draw(gp); } public static void main(String[] argv) { CarroDesenhado f = new CarroDesenhado(); f.setTitle("Texto"); f.setSize(1366,768); f.setVisible(true); } }
UTF-8
Java
1,706
java
CarroDesenhado.java
Java
[]
null
[]
import java.awt.*; import java.awt.geom.*; import java.lang.Math; import java.lang.Thread; public class CarroDesenhado extends Frame { CarroDesenhado() { addWindowListener(new FecharJanela()); } private Shape createDrawing() { GeneralPath gp = new GeneralPath(); gp.moveTo(50,50); gp.lineTo(200,50); gp.lineTo(200,100); gp.lineTo(50,100); gp.lineTo(50,50); AffineTransform toOrigem = new AffineTransform(); toOrigem.translate(-150, -100); return toOrigem.createTransformedShape(gp); } public void paint(Graphics g) { AffineTransform rotation = new AffineTransform(); AffineTransform translation = new AffineTransform(); AffineTransform step = new AffineTransform(); Shape gp = createDrawing(); double angleStep = Math.toRadians(3.6); Graphics2D g2d = (Graphics2D) g; for (int index = 0; index < 100; index++) { rotation.rotate(angleStep); translation.translate(6, 6); step.setToTranslation(150, 100); step.concatenate(translation); step.concatenate(rotation); g2d.draw(step.createTransformedShape(gp)); g2d.clearRect(0, 0, getWidth(), getHeight()); // g2d.draw(translation.createTransformedShape(gp)); try { Thread.sleep(50); } catch (InterruptedException e) { System.out.println("Got interrupted"); } } g2d.draw(gp); } public static void main(String[] argv) { CarroDesenhado f = new CarroDesenhado(); f.setTitle("Texto"); f.setSize(1366,768); f.setVisible(true); } }
1,706
0.603165
0.566823
66
24.80303
19.655533
64
false
false
0
0
0
0
0
0
1.106061
false
false
6
6f6bb961a37f881ba4c9ba78813ce30e7ff3b9a8
4,698,694,274,205
ecaa489675980d2ec318c3265e4dbbae0c4da976
/pythreejs-java/src/main/java/pythreejs/SpriteMaterial.java
0317d3635c6dd59084f1daa9bf9ac3045b94d183
[ "BSD-3-Clause" ]
permissive
twosigma/pythreejs
https://github.com/twosigma/pythreejs
8a7ef63ad059649900bc1e02c6048e99a654cc18
788d5253563e979bd5c8b1adceceef728a67e68b
refs/heads/master
2020-03-17T22:08:29.120000
2018-06-12T15:10:25
2018-06-12T15:10:25
133,990,564
0
1
null
true
2018-06-12T15:10:26
2018-05-18T18:28:46
2018-05-18T18:28:48
2018-06-12T15:10:25
4,694
0
1
0
JavaScript
false
null
package pythreejs; import com.twosigma.beakerx.widget.*; import java.io.Serializable; import java.util.*; public class SpriteMaterial extends Material { public static final String MODEL_NAME_VALUE = "SpriteMaterialModel"; public static final String COLOR = "color"; public static final String FOG = "fog"; public static final String LIGHTS = "lights"; public static final String MAP = "map"; public static final String ROTATION = "rotation"; public static final String TYPE = "type"; private String color = "#ffffff"; private boolean fog; private boolean lights; private Texture map; private double rotation = 0; private String type = "SpriteMaterial"; public SpriteMaterial() { super(); openComm(); } public SpriteMaterial(LinkedHashMap<String, Serializable> parameters) { super(parameters); this.color = (String) parameters.getOrDefault(COLOR, (Serializable) this.color); this.fog = (boolean) parameters.getOrDefault(FOG, (Serializable) this.fog); this.lights = (boolean) parameters.getOrDefault(LIGHTS, (Serializable) this.lights); this.map = (Texture) parameters.getOrDefault(MAP, (Serializable) this.map); this.rotation = (double) parameters.getOrDefault(ROTATION, (Serializable) this.rotation); this.type = (String) parameters.getOrDefault(TYPE, (Serializable) this.type); openComm(); } @Override public HashMap<String, Serializable> content (HashMap<String, Serializable> content) { super.content(content); content.put(COLOR, (Serializable) color); content.put(FOG, (Serializable) fog); content.put(LIGHTS, (Serializable) lights); content.put(MAP, map == null ? null : "IPY_MODEL_" + map.getComm().getCommId()); content.put(ROTATION, (Serializable) rotation); content.put(TYPE, (Serializable) type); return content; } public String getModelNameValue(){ return MODEL_NAME_VALUE; } public String getColor() { return color; } public void setColor(String color){ this.color = color; sendUpdate(COLOR, color); } public boolean getFog() { return fog; } public void setFog(boolean fog){ this.fog = fog; sendUpdate(FOG, fog); } public boolean getLights() { return lights; } public void setLights(boolean lights){ this.lights = lights; sendUpdate(LIGHTS, lights); } public Texture getMap() { return map; } public void setMap(Texture map){ this.map = map; sendUpdate(MAP, map == null ? null : "IPY_MODEL_"+map.getComm().getCommId()); } public double getRotation() { return rotation; } public void setRotation(double rotation){ this.rotation = rotation; sendUpdate(ROTATION, rotation); } public String getType() { return type; } public void setType(String type){ this.type = type; sendUpdate(TYPE, type); } }
UTF-8
Java
2,881
java
SpriteMaterial.java
Java
[]
null
[]
package pythreejs; import com.twosigma.beakerx.widget.*; import java.io.Serializable; import java.util.*; public class SpriteMaterial extends Material { public static final String MODEL_NAME_VALUE = "SpriteMaterialModel"; public static final String COLOR = "color"; public static final String FOG = "fog"; public static final String LIGHTS = "lights"; public static final String MAP = "map"; public static final String ROTATION = "rotation"; public static final String TYPE = "type"; private String color = "#ffffff"; private boolean fog; private boolean lights; private Texture map; private double rotation = 0; private String type = "SpriteMaterial"; public SpriteMaterial() { super(); openComm(); } public SpriteMaterial(LinkedHashMap<String, Serializable> parameters) { super(parameters); this.color = (String) parameters.getOrDefault(COLOR, (Serializable) this.color); this.fog = (boolean) parameters.getOrDefault(FOG, (Serializable) this.fog); this.lights = (boolean) parameters.getOrDefault(LIGHTS, (Serializable) this.lights); this.map = (Texture) parameters.getOrDefault(MAP, (Serializable) this.map); this.rotation = (double) parameters.getOrDefault(ROTATION, (Serializable) this.rotation); this.type = (String) parameters.getOrDefault(TYPE, (Serializable) this.type); openComm(); } @Override public HashMap<String, Serializable> content (HashMap<String, Serializable> content) { super.content(content); content.put(COLOR, (Serializable) color); content.put(FOG, (Serializable) fog); content.put(LIGHTS, (Serializable) lights); content.put(MAP, map == null ? null : "IPY_MODEL_" + map.getComm().getCommId()); content.put(ROTATION, (Serializable) rotation); content.put(TYPE, (Serializable) type); return content; } public String getModelNameValue(){ return MODEL_NAME_VALUE; } public String getColor() { return color; } public void setColor(String color){ this.color = color; sendUpdate(COLOR, color); } public boolean getFog() { return fog; } public void setFog(boolean fog){ this.fog = fog; sendUpdate(FOG, fog); } public boolean getLights() { return lights; } public void setLights(boolean lights){ this.lights = lights; sendUpdate(LIGHTS, lights); } public Texture getMap() { return map; } public void setMap(Texture map){ this.map = map; sendUpdate(MAP, map == null ? null : "IPY_MODEL_"+map.getComm().getCommId()); } public double getRotation() { return rotation; } public void setRotation(double rotation){ this.rotation = rotation; sendUpdate(ROTATION, rotation); } public String getType() { return type; } public void setType(String type){ this.type = type; sendUpdate(TYPE, type); } }
2,881
0.684137
0.68379
104
26.692308
24.601469
95
false
false
0
0
0
0
0
0
0.721154
false
false
6
e3cc5ab7787a22c87e2c20975a4563e51fb98d51
35,562,329,249,933
dd5841d572d91dd87a6d119e116dcd6c27779176
/doc/spring/src/SecurityCustomerUserDetailsService/src/main/java/cn/dectfix/dto/User.java
d728c3c19370f3713394f1e29dd3829236a97e82
[]
no_license
memorylorry/JavaCook
https://github.com/memorylorry/JavaCook
3354cfd97dba8fe55cc5ecdeb0bda924fda06f12
2b37be5db4a58f2ab7a064b8f69f7b1aa0ff4527
refs/heads/master
2020-03-17T01:40:58.886000
2018-12-19T08:52:43
2018-12-19T08:52:43
133,162,399
1
0
null
false
2020-02-15T03:21:27
2018-05-12T16:15:15
2018-12-19T08:52:45
2020-02-15T03:21:26
1,545
0
0
1
HTML
false
false
package cn.dectfix.dto; import org.springframework.security.core.GrantedAuthority; import java.util.List; /** * Created by huqian on 2018/3/9. */ public class User { private String username; private String password; private boolean is_exprie; private boolean is_locked; private boolean is_credential; private boolean is_enable; private String name; private List<GrantedAuthority> authorities; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public boolean isIs_exprie() { return is_exprie; } public void setIs_exprie(boolean is_exprie) { this.is_exprie = is_exprie; } public boolean isIs_locked() { return is_locked; } public void setIs_locked(boolean is_locked) { this.is_locked = is_locked; } public boolean isIs_credential() { return is_credential; } public void setIs_credential(boolean is_credential) { this.is_credential = is_credential; } public boolean isIs_enable() { return is_enable; } public void setIs_enable(boolean is_enable) { this.is_enable = is_enable; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<GrantedAuthority> getAuthorities() { return authorities; } public void setAuthorities(List<GrantedAuthority> authorities) { this.authorities = authorities; } }
UTF-8
Java
1,742
java
User.java
Java
[ { "context": "hority;\n\nimport java.util.List;\n\n/**\n * Created by huqian on 2018/3/9.\n */\npublic class User {\n private ", "end": 133, "score": 0.9996681213378906, "start": 127, "tag": "USERNAME", "value": "huqian" }, { "context": "sername(String username) {\n this.us...
null
[]
package cn.dectfix.dto; import org.springframework.security.core.GrantedAuthority; import java.util.List; /** * Created by huqian on 2018/3/9. */ public class User { private String username; private String password; private boolean is_exprie; private boolean is_locked; private boolean is_credential; private boolean is_enable; private String name; private List<GrantedAuthority> authorities; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public boolean isIs_exprie() { return is_exprie; } public void setIs_exprie(boolean is_exprie) { this.is_exprie = is_exprie; } public boolean isIs_locked() { return is_locked; } public void setIs_locked(boolean is_locked) { this.is_locked = is_locked; } public boolean isIs_credential() { return is_credential; } public void setIs_credential(boolean is_credential) { this.is_credential = is_credential; } public boolean isIs_enable() { return is_enable; } public void setIs_enable(boolean is_enable) { this.is_enable = is_enable; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<GrantedAuthority> getAuthorities() { return authorities; } public void setAuthorities(List<GrantedAuthority> authorities) { this.authorities = authorities; } }
1,742
0.632606
0.629162
83
19.987951
18.211273
68
false
false
0
0
0
0
0
0
0.325301
false
false
6
298862a8c2a217b6fc30650ddf7d9f54f416b131
37,675,453,137,626
3c856ce56eb28dc2260e00b23cf6380b32a4b573
/HW6/parser/ExpressionParser.java
f6d6ccdd0589a17341202b6a6cef2dbf1b9c4cb9
[]
no_license
sashasashasasha151/Paradigms-course
https://github.com/sashasashasasha151/Paradigms-course
e0f4914909a9c1a804fd5569348ad9abe1bcf7a8
f08d679947d5d5e0e7a33ac6ba1ba4d7f15aa64c
refs/heads/master
2020-04-22T19:54:32.408000
2018-10-24T09:26:21
2018-10-24T09:26:21
170,623,304
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package expression.parser; import expression.*; public class ExpressionParser implements Parser { private int index = 0; private String input; public TripleExpression parse(String expression) { input = expression; index = 0; return makeResult(Parse()); } private TripleExpression makeResult(Result currentExpression) { switch (currentExpression.args.size()) { case 2: { TripleExpression a = makeResult(currentExpression.args.get(0)); TripleExpression b = makeResult(currentExpression.args.get(1)); if (currentExpression.expression == "+") return new Add(a, b); if (currentExpression.expression == "-") return new Subtract(a, b); if (currentExpression.expression == "*") return new Multiply(a, b); if (currentExpression.expression == "/") return new Divide(a, b); if (currentExpression.expression == "<<") return new ShiftLeft(a, b); if (currentExpression.expression == ">>") return new ShiftRight(a, b); } case 1: { TripleExpression a = makeResult(currentExpression.args.get(0)); if (currentExpression.expression == "-") return new uMin(a); if (currentExpression.expression == "abs") return new Abs(a); if (currentExpression.expression == "square") return new Square(a); } case 0: { if (Character.isDigit(currentExpression.expression.charAt(0))) { if(currentExpression.expression.equals("2147483648")) { return new Const(Integer.parseInt("-2147483648")); } else { return new Const(Integer.parseInt(currentExpression.expression)); } } else { return new Variable(currentExpression.expression.charAt(0)); } } } return new Const(Integer.parseInt(currentExpression.expression)); } private Result Parse() { return binaryParser(0); } private Result binaryParser(int currentPriority) { Result left = expressionsParser(); while (true) { String op = charParser(); int priority = get_priority(op); if (priority <= currentPriority) { index -= op.length(); return left; } Result right = binaryParser(priority); left = new Result(op, left, right); } } private Result expressionsParser() { String currentChar = charParser(); if (currentChar == "(") { Result result = Parse(); index++; return result; } if (Character.isDigit(currentChar.charAt(0)) || currentChar.charAt(0) == 'x' || currentChar.charAt(0) == 'y' || currentChar.charAt(0) == 'z') return new Result(currentChar); return new Result(currentChar, expressionsParser()); } private String charParser() { while (index<input.length() && Character.isWhitespace(input.charAt(index))) { index++; } if (index == input.length()) return ""; if (Character.isDigit(input.charAt(index))) { String number = ""; while (index < input.length() && Character.isDigit(input.charAt(index))) number = number + input.charAt(index++); return number; } String[] operation = {"+", "-", "*", "/", "(", ")", "x", "y", "z", ">>", "<<", "abs", "square"}; for (int j = 0; j < 13; j++) { if (operation[j].charAt(0) == input.charAt(index)) { index += operation[j].length(); return operation[j]; } } return ""; } private int get_priority(String operation) { String tmp = "<<"; if (operation == tmp) return 1; if (operation == ">>") return 1; if (operation == "+") return 2; if (operation == "-") return 2; if (operation == "*") return 3; if (operation == "/") return 3; return 0; } }
UTF-8
Java
4,381
java
ExpressionParser.java
Java
[]
null
[]
package expression.parser; import expression.*; public class ExpressionParser implements Parser { private int index = 0; private String input; public TripleExpression parse(String expression) { input = expression; index = 0; return makeResult(Parse()); } private TripleExpression makeResult(Result currentExpression) { switch (currentExpression.args.size()) { case 2: { TripleExpression a = makeResult(currentExpression.args.get(0)); TripleExpression b = makeResult(currentExpression.args.get(1)); if (currentExpression.expression == "+") return new Add(a, b); if (currentExpression.expression == "-") return new Subtract(a, b); if (currentExpression.expression == "*") return new Multiply(a, b); if (currentExpression.expression == "/") return new Divide(a, b); if (currentExpression.expression == "<<") return new ShiftLeft(a, b); if (currentExpression.expression == ">>") return new ShiftRight(a, b); } case 1: { TripleExpression a = makeResult(currentExpression.args.get(0)); if (currentExpression.expression == "-") return new uMin(a); if (currentExpression.expression == "abs") return new Abs(a); if (currentExpression.expression == "square") return new Square(a); } case 0: { if (Character.isDigit(currentExpression.expression.charAt(0))) { if(currentExpression.expression.equals("2147483648")) { return new Const(Integer.parseInt("-2147483648")); } else { return new Const(Integer.parseInt(currentExpression.expression)); } } else { return new Variable(currentExpression.expression.charAt(0)); } } } return new Const(Integer.parseInt(currentExpression.expression)); } private Result Parse() { return binaryParser(0); } private Result binaryParser(int currentPriority) { Result left = expressionsParser(); while (true) { String op = charParser(); int priority = get_priority(op); if (priority <= currentPriority) { index -= op.length(); return left; } Result right = binaryParser(priority); left = new Result(op, left, right); } } private Result expressionsParser() { String currentChar = charParser(); if (currentChar == "(") { Result result = Parse(); index++; return result; } if (Character.isDigit(currentChar.charAt(0)) || currentChar.charAt(0) == 'x' || currentChar.charAt(0) == 'y' || currentChar.charAt(0) == 'z') return new Result(currentChar); return new Result(currentChar, expressionsParser()); } private String charParser() { while (index<input.length() && Character.isWhitespace(input.charAt(index))) { index++; } if (index == input.length()) return ""; if (Character.isDigit(input.charAt(index))) { String number = ""; while (index < input.length() && Character.isDigit(input.charAt(index))) number = number + input.charAt(index++); return number; } String[] operation = {"+", "-", "*", "/", "(", ")", "x", "y", "z", ">>", "<<", "abs", "square"}; for (int j = 0; j < 13; j++) { if (operation[j].charAt(0) == input.charAt(index)) { index += operation[j].length(); return operation[j]; } } return ""; } private int get_priority(String operation) { String tmp = "<<"; if (operation == tmp) return 1; if (operation == ">>") return 1; if (operation == "+") return 2; if (operation == "-") return 2; if (operation == "*") return 3; if (operation == "/") return 3; return 0; } }
4,381
0.51244
0.50194
120
34.508335
28.501753
104
false
false
0
0
0
0
0
0
0.691667
false
false
6
02028988d220c0684d5673e95198d845f86061b0
37,056,977,851,773
37cdf8cf498444eaadb5a989a5df663b06a49520
/com/naikara_talk/service/StudentMonthlyFeePurchaseInformationSaveService.java
a0cd125df15eea7d40c3e1b2a27e88b953a9f2af
[]
no_license
sangjiexun/naikaratalk
https://github.com/sangjiexun/naikaratalk
d1b8f9e000427f3e03294512d3d15f809088eef1
744145606dd260e05126cda7651b595fe8cff309
refs/heads/master
2020-12-14T20:24:32.209000
2014-09-18T23:46:43
2014-09-18T23:46:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.naikara_talk.service; import java.sql.Connection; import java.sql.SQLException; import org.apache.commons.lang3.StringUtils; import com.naikara_talk.dbutil.DbUtil; import com.naikara_talk.dto.PointOwnershipTrnDto; import com.naikara_talk.exception.NaiException; import com.naikara_talk.logic.StudentMonthlyFeePurchaseInformationLogic; import com.naikara_talk.model.StudentMonthlyFeePurchaseInformationModel; import com.naikara_talk.util.CheckUtil; import com.naikara_talk.util.DateUtil; import com.naikara_talk.util.NaikaraStringUtil; import com.naikara_talk.util.NaikaraTalkConstants; /** * <b>システム名称  :</b>NAIKARA Talkシステム。<br> * <b>サブシステム名称:</b>マスタ保守<br> * <b>クラス名称   :</b>受講者マスタメンテナンス【単票】受講者別月謝購入情報保存Serviceクラス。<br> * <b>クラス概要   :</b>受講者マスタメンテナンス【単票】受講者別月謝購入情報保存Service。<br> * <br> * <b>著作権     :</b>All rights recerved, Copyright(C), nai INDUSTRIES, LTD. * @author TECS * <b>変更履歴    :</b>2013/07/10 TECS 新規作成。 */ public class StudentMonthlyFeePurchaseInformationSaveService implements ActionService { /** 更新前チェック:月謝停止年月フォーマット不正のチェックエラー */ public static final int ERR_DATE_FORMAT = 1; /** 更新前チェック:未来日付チェックエラー */ public static final int ERR_FUTURE_DATE = 2; /** 更新前チェック:月謝停止の最短月以上チェックエラー */ public static final int ERR_SHORTEST_MONTH = 3; /** データ不存在チェック */ public static final int ERR_DATA_NASI = 4; /** 追加 day*/ public static final String ADD_DAY = "/01"; /** 問題なし */ private static int CHECK_OK = 0; /** * 保存のチェック。<br> * <br> * @param なし * @return boolean * @throws NaiException */ public int errorCheck(StudentMonthlyFeePurchaseInformationModel model) throws NaiException { String[] endDt = model.getEndDt(); // 関連チェック for (int i = 0; i < endDt.length; i++) { String stopDate = endDt[i]; PointOwnershipTrnDto pointOwnershipTrnDto = new PointOwnershipTrnDto(); pointOwnershipTrnDto = model.getResultList().get(i); if (!StringUtils.isEmpty(stopDate)) { // 月謝停止年月 フォーマット不正の場合 if (!CheckUtil.isDate(stopDate + ADD_DAY)) { return ERR_DATE_FORMAT; } // 未来日付チェック (日付) String sysYyyyMm = DateUtil.getSysDate(); sysYyyyMm = NaikaraStringUtil.converToYYYY_MM(sysYyyyMm); if (DateUtil.dateCompare5(sysYyyyMm, stopDate)) { return ERR_FUTURE_DATE; } // 月謝停止の最短月以上チェック String pointStopDt = NaikaraStringUtil.converToYYYY_MM(pointOwnershipTrnDto.getEffectiveEndDt()); if (DateUtil.dateCompare5(pointStopDt, stopDate)) { return ERR_SHORTEST_MONTH; } // データ不存在チェック if (!getExist(pointOwnershipTrnDto)) { return ERR_DATA_NASI; } } } return CHECK_OK; } /** * データの存在チェック。<br> * <br> * @param PointOwnershipTrnDto * 画面のパラメータ * @return boolean * @throws NaiException */ public boolean getExist(PointOwnershipTrnDto dto) throws NaiException { Connection conn = null; try { conn = DbUtil.getConnection(); StudentMonthlyFeePurchaseInformationLogic studentMonthlyFeePurchaseInformationLogic = new StudentMonthlyFeePurchaseInformationLogic( conn); // 検索実行 int cnt = studentMonthlyFeePurchaseInformationLogic.getDataExist(dto); if (cnt == NaikaraTalkConstants.RETURN_CD_DATA_NO) { return false; } else { return true; } } catch (SQLException se) { se.printStackTrace(); throw new NaiException(se); } finally { try { conn.close(); } catch (Exception e1) { e1.printStackTrace(); } } } }
UTF-8
Java
4,778
java
StudentMonthlyFeePurchaseInformationSaveService.java
Java
[]
null
[]
package com.naikara_talk.service; import java.sql.Connection; import java.sql.SQLException; import org.apache.commons.lang3.StringUtils; import com.naikara_talk.dbutil.DbUtil; import com.naikara_talk.dto.PointOwnershipTrnDto; import com.naikara_talk.exception.NaiException; import com.naikara_talk.logic.StudentMonthlyFeePurchaseInformationLogic; import com.naikara_talk.model.StudentMonthlyFeePurchaseInformationModel; import com.naikara_talk.util.CheckUtil; import com.naikara_talk.util.DateUtil; import com.naikara_talk.util.NaikaraStringUtil; import com.naikara_talk.util.NaikaraTalkConstants; /** * <b>システム名称  :</b>NAIKARA Talkシステム。<br> * <b>サブシステム名称:</b>マスタ保守<br> * <b>クラス名称   :</b>受講者マスタメンテナンス【単票】受講者別月謝購入情報保存Serviceクラス。<br> * <b>クラス概要   :</b>受講者マスタメンテナンス【単票】受講者別月謝購入情報保存Service。<br> * <br> * <b>著作権     :</b>All rights recerved, Copyright(C), nai INDUSTRIES, LTD. * @author TECS * <b>変更履歴    :</b>2013/07/10 TECS 新規作成。 */ public class StudentMonthlyFeePurchaseInformationSaveService implements ActionService { /** 更新前チェック:月謝停止年月フォーマット不正のチェックエラー */ public static final int ERR_DATE_FORMAT = 1; /** 更新前チェック:未来日付チェックエラー */ public static final int ERR_FUTURE_DATE = 2; /** 更新前チェック:月謝停止の最短月以上チェックエラー */ public static final int ERR_SHORTEST_MONTH = 3; /** データ不存在チェック */ public static final int ERR_DATA_NASI = 4; /** 追加 day*/ public static final String ADD_DAY = "/01"; /** 問題なし */ private static int CHECK_OK = 0; /** * 保存のチェック。<br> * <br> * @param なし * @return boolean * @throws NaiException */ public int errorCheck(StudentMonthlyFeePurchaseInformationModel model) throws NaiException { String[] endDt = model.getEndDt(); // 関連チェック for (int i = 0; i < endDt.length; i++) { String stopDate = endDt[i]; PointOwnershipTrnDto pointOwnershipTrnDto = new PointOwnershipTrnDto(); pointOwnershipTrnDto = model.getResultList().get(i); if (!StringUtils.isEmpty(stopDate)) { // 月謝停止年月 フォーマット不正の場合 if (!CheckUtil.isDate(stopDate + ADD_DAY)) { return ERR_DATE_FORMAT; } // 未来日付チェック (日付) String sysYyyyMm = DateUtil.getSysDate(); sysYyyyMm = NaikaraStringUtil.converToYYYY_MM(sysYyyyMm); if (DateUtil.dateCompare5(sysYyyyMm, stopDate)) { return ERR_FUTURE_DATE; } // 月謝停止の最短月以上チェック String pointStopDt = NaikaraStringUtil.converToYYYY_MM(pointOwnershipTrnDto.getEffectiveEndDt()); if (DateUtil.dateCompare5(pointStopDt, stopDate)) { return ERR_SHORTEST_MONTH; } // データ不存在チェック if (!getExist(pointOwnershipTrnDto)) { return ERR_DATA_NASI; } } } return CHECK_OK; } /** * データの存在チェック。<br> * <br> * @param PointOwnershipTrnDto * 画面のパラメータ * @return boolean * @throws NaiException */ public boolean getExist(PointOwnershipTrnDto dto) throws NaiException { Connection conn = null; try { conn = DbUtil.getConnection(); StudentMonthlyFeePurchaseInformationLogic studentMonthlyFeePurchaseInformationLogic = new StudentMonthlyFeePurchaseInformationLogic( conn); // 検索実行 int cnt = studentMonthlyFeePurchaseInformationLogic.getDataExist(dto); if (cnt == NaikaraTalkConstants.RETURN_CD_DATA_NO) { return false; } else { return true; } } catch (SQLException se) { se.printStackTrace(); throw new NaiException(se); } finally { try { conn.close(); } catch (Exception e1) { e1.printStackTrace(); } } } }
4,778
0.581535
0.576499
129
30.325581
26.204966
144
false
false
0
0
0
0
0
0
0.372093
false
false
6
e688483072afe99ab338729829340c50d12084d8
36,524,401,922,804
2ff52e3620b3a55f0c0f88bcc54e09a53a20a1fa
/modules/src/test/PermutationsValidatorTest.java
ed25286bd7f5268a55267faecf798599f1cb242a
[]
no_license
Jurisnoctis/CodingPracticeAndHelpers
https://github.com/Jurisnoctis/CodingPracticeAndHelpers
b4fee1b0b5302906d941d55432a99afe4c1126c8
504490ae2c8ea3464cc3f0ae6acd274c0db1151f
refs/heads/master
2021-07-01T16:59:26.885000
2020-10-15T20:43:22
2020-10-15T20:43:22
180,053,386
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package src.test; import org.junit.jupiter.api.Test; import src.examSources.PermutationsValidator; import java.util.ArrayList; import java.util.Arrays; import java.util.List; class PermutationsValidatorTest { @Test public void testJavaContains() { List<List<Integer>> outputTest = new ArrayList<>(); List<Integer> inputList1 = new ArrayList<>(Arrays.asList(1,2,3)); outputTest.add(inputList1); List<Integer> inputList2 = new ArrayList<>(Arrays.asList(3,2,1)); if(!outputTest.contains(inputList2)) { outputTest.add(inputList2); } assert (!inputList1.equals(inputList2)); } @Test public void happy123Case() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3)); List<List<Integer>> output = PermutationsValidator.getPermutationsIteratively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy1234Case() { //failing List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4)); List<List<Integer>> output = PermutationsValidator.getPermutationsIteratively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy12345Case() { //failing List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4,5)); List<List<Integer>> output = PermutationsValidator.getPermutationsIteratively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy123CaseRecruse() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy112CaseRecruse() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,1,2)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy1234CaseRecruse() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy12345CaseRecruse() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4,5)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy123455CaseRecruse() { //passes List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4,5,5)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } }
UTF-8
Java
2,802
java
PermutationsValidatorTest.java
Java
[]
null
[]
package src.test; import org.junit.jupiter.api.Test; import src.examSources.PermutationsValidator; import java.util.ArrayList; import java.util.Arrays; import java.util.List; class PermutationsValidatorTest { @Test public void testJavaContains() { List<List<Integer>> outputTest = new ArrayList<>(); List<Integer> inputList1 = new ArrayList<>(Arrays.asList(1,2,3)); outputTest.add(inputList1); List<Integer> inputList2 = new ArrayList<>(Arrays.asList(3,2,1)); if(!outputTest.contains(inputList2)) { outputTest.add(inputList2); } assert (!inputList1.equals(inputList2)); } @Test public void happy123Case() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3)); List<List<Integer>> output = PermutationsValidator.getPermutationsIteratively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy1234Case() { //failing List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4)); List<List<Integer>> output = PermutationsValidator.getPermutationsIteratively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy12345Case() { //failing List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4,5)); List<List<Integer>> output = PermutationsValidator.getPermutationsIteratively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy123CaseRecruse() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy112CaseRecruse() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,1,2)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy1234CaseRecruse() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy12345CaseRecruse() { List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4,5)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } @Test public void happy123455CaseRecruse() { //passes List<Integer> inputList = new ArrayList<>(Arrays.asList(1,2,3,4,5,5)); List<List<Integer>> output = PermutationsValidator.getPermutationsRecursively(inputList); System.out.println("Forget automatic validation on this"); } }
2,802
0.747323
0.719129
102
26.480392
30.366302
91
false
false
0
0
0
0
0
0
1.705882
false
false
6
235d6d7527c51f3ea243dc8e99059bf3692e4ad1
34,187,939,719,103
4973acc8b986936864fc7b2edcbccf0da4eea1c5
/src/main/java/com/suleyman/authenticationapi/exception/AuthenticationControllerException.java
ff172290475e4daadaa444d25225d8c3389fe2ff
[]
no_license
suleymankotan/Authentication-Api
https://github.com/suleymankotan/Authentication-Api
b453219ab3cf8f261510f4e62e725785a86391a5
466480837bb95cce315cdef4d2a924fb8f38c167
refs/heads/master
2022-12-15T05:13:09.869000
2020-09-14T19:49:36
2020-09-14T19:49:36
280,786,366
0
0
null
false
2020-09-14T19:02:14
2020-07-19T03:47:15
2020-09-12T20:58:13
2020-09-14T19:02:13
98
0
0
0
Java
false
false
package com.suleyman.authenticationapi.exception; import com.suleyman.authenticationapi.model.response.ErrorResponse; import io.micrometer.core.instrument.util.StringUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.security.authentication.InternalAuthenticationServiceException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import java.util.Objects; import java.util.stream.Collectors; @Slf4j @ResponseBody @ControllerAdvice public class AuthenticationControllerException { @Value("${spring.application.name}") private String appName; @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorResponse handleValidationException(MethodArgumentNotValidException exception){ final String message =exception.getBindingResult().getFieldErrors().stream() .filter(Objects::isNull) .filter(f-> StringUtils.isNotEmpty(f.getField())) .map(f -> f.getField().concat(" ").concat(StringUtils.isEmpty(f.getDefaultMessage())?"must not null" : f.getDefaultMessage())) .collect(Collectors.joining(";")); return ErrorResponse.builder() .appName(appName) .code(ErrorCode.REQUIRED_PARAMETERS_CANNOT_BE_NULL.getNumber()) .message(message) .build(); } @ExceptionHandler(AuthenticationServicesException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorResponse handleAppException(AuthenticationServicesException exception){ log.error(exception.toString()); return ErrorResponse.builder() .appName(appName) .code(exception.getCode()) .message(exception.getMessage()) .build(); } @ExceptionHandler(InternalAuthenticationServiceException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorResponse handleAppLoginException(AuthenticationServicesException exception){ log.error(exception.toString()); return ErrorResponse.builder() .appName(appName) .code(exception.getCode()) .message(exception.getMessage()) .build(); } @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public ErrorResponse handle(Exception exception){ log.error(exception.toString()); return ErrorResponse.builder() .appName(appName) .code(ErrorCode.GENERAL_EXCEPTION.getNumber()) .message(ErrorCode.GENERAL_EXCEPTION.getMessage()) .build(); } }
UTF-8
Java
3,054
java
AuthenticationControllerException.java
Java
[]
null
[]
package com.suleyman.authenticationapi.exception; import com.suleyman.authenticationapi.model.response.ErrorResponse; import io.micrometer.core.instrument.util.StringUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.security.authentication.InternalAuthenticationServiceException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import java.util.Objects; import java.util.stream.Collectors; @Slf4j @ResponseBody @ControllerAdvice public class AuthenticationControllerException { @Value("${spring.application.name}") private String appName; @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorResponse handleValidationException(MethodArgumentNotValidException exception){ final String message =exception.getBindingResult().getFieldErrors().stream() .filter(Objects::isNull) .filter(f-> StringUtils.isNotEmpty(f.getField())) .map(f -> f.getField().concat(" ").concat(StringUtils.isEmpty(f.getDefaultMessage())?"must not null" : f.getDefaultMessage())) .collect(Collectors.joining(";")); return ErrorResponse.builder() .appName(appName) .code(ErrorCode.REQUIRED_PARAMETERS_CANNOT_BE_NULL.getNumber()) .message(message) .build(); } @ExceptionHandler(AuthenticationServicesException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorResponse handleAppException(AuthenticationServicesException exception){ log.error(exception.toString()); return ErrorResponse.builder() .appName(appName) .code(exception.getCode()) .message(exception.getMessage()) .build(); } @ExceptionHandler(InternalAuthenticationServiceException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorResponse handleAppLoginException(AuthenticationServicesException exception){ log.error(exception.toString()); return ErrorResponse.builder() .appName(appName) .code(exception.getCode()) .message(exception.getMessage()) .build(); } @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public ErrorResponse handle(Exception exception){ log.error(exception.toString()); return ErrorResponse.builder() .appName(appName) .code(ErrorCode.GENERAL_EXCEPTION.getNumber()) .message(ErrorCode.GENERAL_EXCEPTION.getMessage()) .build(); } }
3,054
0.707269
0.706287
72
41.416668
27.348446
142
false
false
0
0
0
0
0
0
0.333333
false
false
6
e0d899654c757ad5ca97986c4114df2583bd67a7
16,295,105,989,360
15f993e52c3c81546268edb4f9f6667251903a9e
/ASLRecognition/app/src/main/java/org/pytorch/demo/aslrecognition/MainActivity.java
906b1fdc2605ef3463ff72ee4b726f49ce081181
[]
no_license
pytorch/android-demo-app
https://github.com/pytorch/android-demo-app
09f08e89945bd2df3dbb286366d763790034057d
8e2700a96dd4126f7aaae0f62d52d44bac9ed722
refs/heads/master
2023-08-29T22:39:55.236000
2022-07-07T18:24:04
2022-07-07T18:24:04
211,226,246
1,347
618
null
false
2023-08-05T17:00:08
2019-09-27T03:11:18
2023-08-05T10:14:56
2023-05-26T22:45:15
136,403
1,265
555
202
Java
false
false
package org.pytorch.demo.aslrecognition; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.os.Bundle; import android.os.SystemClock; import android.util.Log; import android.util.Pair; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import org.pytorch.IValue; import org.pytorch.LiteModuleLoader; import org.pytorch.Module; import org.pytorch.Tensor; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.FloatBuffer; public class MainActivity extends AppCompatActivity implements Runnable { private ImageView mImageView; private Button mButtonRecognize; private TextView mTvResult; private Bitmap mBitmap = null; private Module mModule = null; private int mStartLetterPos = 1; private String mLetter = "A"; public final static int SIZE = 200; public static String assetFilePath(Context context, String assetName) throws IOException { File file = new File(context.getFilesDir(), assetName); if (file.exists() && file.length() > 0) { return file.getAbsolutePath(); } try (InputStream is = context.getAssets().open(assetName)) { try (OutputStream os = new FileOutputStream(file)) { byte[] buffer = new byte[4 * 1024]; int read; while ((read = is.read(buffer)) != -1) { os.write(buffer, 0, read); } os.flush(); } return file.getAbsolutePath(); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { mBitmap = BitmapFactory.decodeStream(getAssets().open("A1.jpg")); } catch (IOException e) { Log.e("ASLRecognition", "Error reading assets", e); finish(); } mImageView = findViewById(R.id.imageView); mImageView.setImageBitmap(mBitmap); mTvResult = findViewById(R.id.tvResult); mTvResult.setText(mLetter); final Button btnNext = findViewById(R.id.nextButton); btnNext.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mStartLetterPos = (mStartLetterPos + 1) % 26; if (mStartLetterPos == 0) { mStartLetterPos = 26; } mLetter = String.valueOf((char)(mStartLetterPos + 64)); String imageName = String.format("%s1.jpg", mLetter); mTvResult.setText(mLetter); try { mBitmap = BitmapFactory.decodeStream(getAssets().open(imageName)); mImageView.setImageBitmap(mBitmap); } catch (IOException e) { Log.e("ASLRecognition", "Error reading assets", e); finish(); } } }); mButtonRecognize = findViewById(R.id.recognizeButton); mButtonRecognize.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Thread thread = new Thread(MainActivity.this); thread.start(); } }); final Button buttonLive = findViewById(R.id.liveButton); buttonLive.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final Intent intent = new Intent(MainActivity.this, LiveASLRecognitionActivity.class); startActivity(intent); } }); try { mModule = LiteModuleLoader.load(MainActivity.assetFilePath(getApplicationContext(), "asl.ptl")); } catch (IOException e) { Log.e("ASLRecognition", "Error reading model file", e); finish(); } } public static Pair<Integer, Long> bitmapRecognition(Bitmap bitmap, Module module) { FloatBuffer inTensorBuffer = Tensor.allocateFloatBuffer(3 * SIZE * SIZE); for (int x = 0; x < SIZE; x++) { for (int y = 0; y < SIZE; y++) { int colour = bitmap.getPixel(x, y); int red = Color.red(colour); int blue = Color.blue(colour); int green = Color.green(colour); inTensorBuffer.put(x + SIZE * y, (float) blue); inTensorBuffer.put(SIZE * SIZE + x + SIZE * y, (float) green); inTensorBuffer.put(2 * SIZE * SIZE + x + SIZE * y, (float) red); } } Tensor inputTensor = Tensor.fromBlob(inTensorBuffer, new long[]{1, 3, SIZE, SIZE}); final long startTime = SystemClock.elapsedRealtime(); Tensor outTensor = module.forward(IValue.from(inputTensor)).toTensor(); final long inferenceTime = SystemClock.elapsedRealtime() - startTime; final float[] scores = outTensor.getDataAsFloatArray(); float maxScore = -Float.MAX_VALUE; int maxScoreIdx = -1; for (int i = 0; i < scores.length; i++) { if (scores[i] > maxScore) { maxScore = scores[i]; maxScoreIdx = i; } } return new Pair<>(maxScoreIdx, inferenceTime); } @Override public void run() { Pair<Integer, Long> idxTm = bitmapRecognition(mBitmap, mModule); int finalMaxScoreIdx = idxTm.first; runOnUiThread(new Runnable() { @Override public void run() { mTvResult.setText(String.format("%s - %s", mLetter, String.valueOf((char)(1 + finalMaxScoreIdx + 64)))); mButtonRecognize.setEnabled(true); mButtonRecognize.setText(getString(R.string.recognize)); } }); } }
UTF-8
Java
6,166
java
MainActivity.java
Java
[]
null
[]
package org.pytorch.demo.aslrecognition; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.os.Bundle; import android.os.SystemClock; import android.util.Log; import android.util.Pair; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import org.pytorch.IValue; import org.pytorch.LiteModuleLoader; import org.pytorch.Module; import org.pytorch.Tensor; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.FloatBuffer; public class MainActivity extends AppCompatActivity implements Runnable { private ImageView mImageView; private Button mButtonRecognize; private TextView mTvResult; private Bitmap mBitmap = null; private Module mModule = null; private int mStartLetterPos = 1; private String mLetter = "A"; public final static int SIZE = 200; public static String assetFilePath(Context context, String assetName) throws IOException { File file = new File(context.getFilesDir(), assetName); if (file.exists() && file.length() > 0) { return file.getAbsolutePath(); } try (InputStream is = context.getAssets().open(assetName)) { try (OutputStream os = new FileOutputStream(file)) { byte[] buffer = new byte[4 * 1024]; int read; while ((read = is.read(buffer)) != -1) { os.write(buffer, 0, read); } os.flush(); } return file.getAbsolutePath(); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { mBitmap = BitmapFactory.decodeStream(getAssets().open("A1.jpg")); } catch (IOException e) { Log.e("ASLRecognition", "Error reading assets", e); finish(); } mImageView = findViewById(R.id.imageView); mImageView.setImageBitmap(mBitmap); mTvResult = findViewById(R.id.tvResult); mTvResult.setText(mLetter); final Button btnNext = findViewById(R.id.nextButton); btnNext.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mStartLetterPos = (mStartLetterPos + 1) % 26; if (mStartLetterPos == 0) { mStartLetterPos = 26; } mLetter = String.valueOf((char)(mStartLetterPos + 64)); String imageName = String.format("%s1.jpg", mLetter); mTvResult.setText(mLetter); try { mBitmap = BitmapFactory.decodeStream(getAssets().open(imageName)); mImageView.setImageBitmap(mBitmap); } catch (IOException e) { Log.e("ASLRecognition", "Error reading assets", e); finish(); } } }); mButtonRecognize = findViewById(R.id.recognizeButton); mButtonRecognize.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Thread thread = new Thread(MainActivity.this); thread.start(); } }); final Button buttonLive = findViewById(R.id.liveButton); buttonLive.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final Intent intent = new Intent(MainActivity.this, LiveASLRecognitionActivity.class); startActivity(intent); } }); try { mModule = LiteModuleLoader.load(MainActivity.assetFilePath(getApplicationContext(), "asl.ptl")); } catch (IOException e) { Log.e("ASLRecognition", "Error reading model file", e); finish(); } } public static Pair<Integer, Long> bitmapRecognition(Bitmap bitmap, Module module) { FloatBuffer inTensorBuffer = Tensor.allocateFloatBuffer(3 * SIZE * SIZE); for (int x = 0; x < SIZE; x++) { for (int y = 0; y < SIZE; y++) { int colour = bitmap.getPixel(x, y); int red = Color.red(colour); int blue = Color.blue(colour); int green = Color.green(colour); inTensorBuffer.put(x + SIZE * y, (float) blue); inTensorBuffer.put(SIZE * SIZE + x + SIZE * y, (float) green); inTensorBuffer.put(2 * SIZE * SIZE + x + SIZE * y, (float) red); } } Tensor inputTensor = Tensor.fromBlob(inTensorBuffer, new long[]{1, 3, SIZE, SIZE}); final long startTime = SystemClock.elapsedRealtime(); Tensor outTensor = module.forward(IValue.from(inputTensor)).toTensor(); final long inferenceTime = SystemClock.elapsedRealtime() - startTime; final float[] scores = outTensor.getDataAsFloatArray(); float maxScore = -Float.MAX_VALUE; int maxScoreIdx = -1; for (int i = 0; i < scores.length; i++) { if (scores[i] > maxScore) { maxScore = scores[i]; maxScoreIdx = i; } } return new Pair<>(maxScoreIdx, inferenceTime); } @Override public void run() { Pair<Integer, Long> idxTm = bitmapRecognition(mBitmap, mModule); int finalMaxScoreIdx = idxTm.first; runOnUiThread(new Runnable() { @Override public void run() { mTvResult.setText(String.format("%s - %s", mLetter, String.valueOf((char)(1 + finalMaxScoreIdx + 64)))); mButtonRecognize.setEnabled(true); mButtonRecognize.setText(getString(R.string.recognize)); } }); } }
6,166
0.594226
0.588874
170
35.270588
25.185377
108
false
false
0
0
0
0
0
0
0.764706
false
false
6
5d9dc038565805c2c3e936a4a068f8a93f0e9c67
36,103,495,125,171
785ae7ba644763e794154655416f0a9e47cfb737
/src/main/java/com/k00ntz/euler/onethroughfifty/DoubleBasePalindromes36.java
1c52bf1206cdaf9a1bf340d3c807ca9770532d43
[]
no_license
garrettkoontz/leet-code-jvm
https://github.com/garrettkoontz/leet-code-jvm
7292df8a0724a52f834f801e5cd6fcbc4dc2d8a6
98e4ff9b1240c3a6585efbde224dfad3083157c1
refs/heads/master
2021-09-08T20:01:22.500000
2021-09-01T18:24:23
2021-09-01T18:24:23
211,505,602
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.k00ntz.euler.onethroughfifty; import com.k00ntz.euler.util.NumberUtil; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; /** * The decimal number, 585 = 1001001001`2 (binary), is palindromic in both bases. * <p> * Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. * <p> * (Please note that the palindromic number, in either base, may not include leading zeros.) */ public class DoubleBasePalindromes36 { public static boolean isDoubleBasePalindrome(int i) { return NumberUtil.isPalindrome(i) && NumberUtil.isPalindrome(Integer.toBinaryString(i)); } public static List<Integer> doublePalindromeIntsLessThan(int maxExclusive) { return IntStream.range(0, maxExclusive).filter(DoubleBasePalindromes36::isDoubleBasePalindrome).boxed().collect(Collectors.toList()); } public static void main(String[] args) { System.out.println(doublePalindromeIntsLessThan(1000000).stream().mapToInt(x -> x).sum()); System.out.println(isDoubleBasePalindrome(585)); } }
UTF-8
Java
1,119
java
DoubleBasePalindromes36.java
Java
[]
null
[]
package com.k00ntz.euler.onethroughfifty; import com.k00ntz.euler.util.NumberUtil; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; /** * The decimal number, 585 = 1001001001`2 (binary), is palindromic in both bases. * <p> * Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. * <p> * (Please note that the palindromic number, in either base, may not include leading zeros.) */ public class DoubleBasePalindromes36 { public static boolean isDoubleBasePalindrome(int i) { return NumberUtil.isPalindrome(i) && NumberUtil.isPalindrome(Integer.toBinaryString(i)); } public static List<Integer> doublePalindromeIntsLessThan(int maxExclusive) { return IntStream.range(0, maxExclusive).filter(DoubleBasePalindromes36::isDoubleBasePalindrome).boxed().collect(Collectors.toList()); } public static void main(String[] args) { System.out.println(doublePalindromeIntsLessThan(1000000).stream().mapToInt(x -> x).sum()); System.out.println(isDoubleBasePalindrome(585)); } }
1,119
0.738159
0.705988
31
35.096775
39.275169
141
false
false
0
0
0
0
0
0
0.516129
false
false
6
81cb5ce721818a233108eb33a5a303728aa94d3d
9,955,734,199,380
2e79fadb8b5a617e897aeeac9b42d91297e0f8c4
/src/vitaliy/kuzmich/gps_client/MainActivity.java
f47a9c5aa7916fa95f24412f57ee06746bf890ca
[]
no_license
Freemanofchina/gps_client
https://github.com/Freemanofchina/gps_client
7634f9e64a2c93f07f7041ddb41c999462eb51f9
35f3b982d920d9f0ebcc55aae53ae40eddca2a3c
refs/heads/master
2020-04-09T06:37:55.575000
2015-01-04T13:49:06
2015-01-04T13:49:06
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vitaliy.kuzmich.gps_client; import vitaliy.kuzmich.R; import vitaliy.kuzmich.gps_client.services.GPSListenerMainService; import android.app.Activity; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.KeyEvent; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; public class MainActivity extends Activity { public TextView gpsStat; public TextView localCache; public TextView serverStat; public CheckBox isEnabled; Receiver receiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); gpsStat = (TextView) findViewById(R.id.gpsStat); localCache = (TextView) findViewById(R.id.cacheStat); serverStat = (TextView) findViewById(R.id.serverStat); isEnabled = (CheckBox) findViewById(R.id.isEnabled); receiver = new Receiver(this); IntentFilter tmp = new IntentFilter(Const.MAIN_INTENT_RECEIVER); registerReceiver(receiver, tmp); sp = PreferenceManager.getDefaultSharedPreferences(this); } SharedPreferences sp; @Override protected void onResume() { super.onResume(); restoreState(); } public void restoreState() { SharedPreferences p = getSharedPreferences(Const.settingsFileName, MODE_PRIVATE); boolean isEn = p.getBoolean(Const.KEY_ISENABLED, false); isEnabled.setChecked(isEn); toogleRun(isEnabled.isChecked()); } public void gps(View v) { CheckBox vv = (CheckBox) v; SharedPreferences p = getSharedPreferences(Const.settingsFileName, MODE_PRIVATE); p.edit().putBoolean(Const.KEY_ISENABLED, vv.isChecked()).commit(); toogleRun(vv.isChecked()); } private void toogleRun(boolean t) { if (t) { Intent i = new Intent(this, GPSListenerMainService.class); startService(i); } else { Intent i = new Intent(this, GPSListenerMainService.class); stopService(i); } } @Override protected void onDestroy() { unregisterReceiver(receiver); super.onDestroy(); } @Override public boolean onKeyDown(int keycode, KeyEvent e) { switch (keycode) { case KeyEvent.KEYCODE_MENU: startActivity(new Intent(this, PrefActivity.class)); return true; } return super.onKeyDown(keycode, e); } }
UTF-8
Java
2,367
java
MainActivity.java
Java
[]
null
[]
package vitaliy.kuzmich.gps_client; import vitaliy.kuzmich.R; import vitaliy.kuzmich.gps_client.services.GPSListenerMainService; import android.app.Activity; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.KeyEvent; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; public class MainActivity extends Activity { public TextView gpsStat; public TextView localCache; public TextView serverStat; public CheckBox isEnabled; Receiver receiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); gpsStat = (TextView) findViewById(R.id.gpsStat); localCache = (TextView) findViewById(R.id.cacheStat); serverStat = (TextView) findViewById(R.id.serverStat); isEnabled = (CheckBox) findViewById(R.id.isEnabled); receiver = new Receiver(this); IntentFilter tmp = new IntentFilter(Const.MAIN_INTENT_RECEIVER); registerReceiver(receiver, tmp); sp = PreferenceManager.getDefaultSharedPreferences(this); } SharedPreferences sp; @Override protected void onResume() { super.onResume(); restoreState(); } public void restoreState() { SharedPreferences p = getSharedPreferences(Const.settingsFileName, MODE_PRIVATE); boolean isEn = p.getBoolean(Const.KEY_ISENABLED, false); isEnabled.setChecked(isEn); toogleRun(isEnabled.isChecked()); } public void gps(View v) { CheckBox vv = (CheckBox) v; SharedPreferences p = getSharedPreferences(Const.settingsFileName, MODE_PRIVATE); p.edit().putBoolean(Const.KEY_ISENABLED, vv.isChecked()).commit(); toogleRun(vv.isChecked()); } private void toogleRun(boolean t) { if (t) { Intent i = new Intent(this, GPSListenerMainService.class); startService(i); } else { Intent i = new Intent(this, GPSListenerMainService.class); stopService(i); } } @Override protected void onDestroy() { unregisterReceiver(receiver); super.onDestroy(); } @Override public boolean onKeyDown(int keycode, KeyEvent e) { switch (keycode) { case KeyEvent.KEYCODE_MENU: startActivity(new Intent(this, PrefActivity.class)); return true; } return super.onKeyDown(keycode, e); } }
2,367
0.757921
0.757921
89
25.595505
20.397024
68
false
false
0
0
0
0
0
0
1.865169
false
false
6
a6607f0f9690f5ea2c71cfd9424f78b44ee15f21
29,815,663,033,265
298f11cc34ce58f0678aa380fed43095b7f2a5e6
/chenrd-quartz/src/main/java/com/chenrd/quartz/BaseScheduleJob.java
814705f9c7178e19dafbb613aff8441e6357882e
[]
no_license
chenrd/chenrd
https://github.com/chenrd/chenrd
0d5742c7f9301a5524c4007f216058d51d48b310
adbdd1d70f4745b3dddba422f24600aa35afd005
refs/heads/master
2021-01-17T08:47:10.200000
2017-08-22T11:20:48
2017-08-22T11:20:48
60,590,772
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 文件名:BaseScheduleJob.java * 版权:Copyright by www.huawei.com * 描述: * 修改人:xuwenqiang * 修改时间:2016年1月8日 * 跟踪单号: * 修改单号: * 修改内容: */ package com.chenrd.quartz; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import com.chenrd.quartz.parameter.TaskParameter; /** * * @author xuwenqiang * @version 2016年1月8日 * @see BaseScheduleJob * @since */ public class BaseScheduleJob implements Job { public final static String TASK_MANAGER_KEY = "taskManager"; public final static String SCHEDULE_JOB = "scheduleJob"; /** * 当点击立即执行时,可能有需求传递参数 */ public final static String PARAMS_KEY = "params"; @Override public void execute(JobExecutionContext context) throws JobExecutionException { TaskHandle task = (TaskHandle) context.getMergedJobDataMap().get(TASK_MANAGER_KEY); ScheduleJob job = (ScheduleJob) context.getMergedJobDataMap().get(SCHEDULE_JOB); task.execute(job.getJobName(), job.getJobGroup(), (TaskParameter) context.getMergedJobDataMap().get(PARAMS_KEY)); } }
UTF-8
Java
1,274
java
BaseScheduleJob.java
Java
[ { "context": " * 版权:Copyright by www.huawei.com\r\n * 描述:\r\n * 修改人:xuwenqiang\r\n * 修改时间:2016年1月8日\r\n * 跟踪单号:\r\n * 修改单号:\r\n * 修改内容:\r", "end": 93, "score": 0.9865784645080566, "start": 83, "tag": "USERNAME", "value": "xuwenqiang" }, { "context": "z.parameter.TaskParameter;\r\n\r\...
null
[]
/* * 文件名:BaseScheduleJob.java * 版权:Copyright by www.huawei.com * 描述: * 修改人:xuwenqiang * 修改时间:2016年1月8日 * 跟踪单号: * 修改单号: * 修改内容: */ package com.chenrd.quartz; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import com.chenrd.quartz.parameter.TaskParameter; /** * * @author xuwenqiang * @version 2016年1月8日 * @see BaseScheduleJob * @since */ public class BaseScheduleJob implements Job { public final static String TASK_MANAGER_KEY = "taskManager"; public final static String SCHEDULE_JOB = "scheduleJob"; /** * 当点击立即执行时,可能有需求传递参数 */ public final static String PARAMS_KEY = "params"; @Override public void execute(JobExecutionContext context) throws JobExecutionException { TaskHandle task = (TaskHandle) context.getMergedJobDataMap().get(TASK_MANAGER_KEY); ScheduleJob job = (ScheduleJob) context.getMergedJobDataMap().get(SCHEDULE_JOB); task.execute(job.getJobName(), job.getJobGroup(), (TaskParameter) context.getMergedJobDataMap().get(PARAMS_KEY)); } }
1,274
0.674439
0.664076
47
22.638298
28.151131
121
false
false
0
0
0
0
0
0
0.276596
false
false
6
1888a990b011e033c442d2f69b5cd4237ac82daa
1,511,828,499,758
baa2273935e5fd0c98b4869cc469c267f59f49b0
/src/task4/MatrixDemo.java
3bfde77bd9d6792113fcefa4304d47bf08e006c5
[]
no_license
Pavel2136/TestRepo
https://github.com/Pavel2136/TestRepo
ab25b9445cff5825c768d8fd16ad5f3964aac80b
d2cc776a35d39b3061f70bf7123ec36e48d35158
refs/heads/master
2020-04-27T09:00:57.023000
2019-03-16T11:26:28
2019-03-16T11:26:28
174,196,265
0
0
null
false
2019-03-16T11:26:29
2019-03-06T18:13:11
2019-03-13T17:50:34
2019-03-16T11:26:29
24
0
0
0
Java
false
null
package task4; public class MatrixDemo { public static void main(String[] args) { Matrix matrixTest = new Matrix(4,3); matrixTest.fillIn(); matrixTest.print(); System.out.println("****"); System.out.println(matrixTest.getMaxInRow()); } }
UTF-8
Java
291
java
MatrixDemo.java
Java
[]
null
[]
package task4; public class MatrixDemo { public static void main(String[] args) { Matrix matrixTest = new Matrix(4,3); matrixTest.fillIn(); matrixTest.print(); System.out.println("****"); System.out.println(matrixTest.getMaxInRow()); } }
291
0.597938
0.587629
15
18.4
18.596773
53
false
false
0
0
0
0
0
0
0.466667
false
false
6
fd42cf97c8e122a9961e0b20aef3b24930008485
30,416,958,456,272
80dd86e4a5fd711fd2b3eba120021f27e9017727
/src/controller/ManipulaVendaController.java
34bd4ebc3459bb13967ca1b242a2667d1dde9f30
[]
no_license
DanielJhos/ProjetoJava
https://github.com/DanielJhos/ProjetoJava
67c374963a272b6942bb527c3ad61e67efa454de
242e096b68f15be0bad5f99ae66bff99994d0617
refs/heads/master
2023-06-21T02:47:05.094000
2021-07-27T17:50:05
2021-07-27T17:50:05
390,075,783
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import dao.PessoaDao; import dao.ProdutoDao; import dao.VendaDao; import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.stage.Modality; import javafx.stage.Stage; import model.ItemVenda; import model.Pessoa; import model.Produto; import model.Venda; import util.Util; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; public class ManipulaVendaController { protected Pessoa pessoa = null; protected Pessoa vendedor = null; public IndexVendaController controller = null; protected Venda venda = new Venda(); @FXML TabPane tabVenda; @FXML private TableView<Pessoa> tblCliente; @FXML private TableColumn<Pessoa, String> colCliente; @FXML private TextField txtFiltroCliente; @FXML private TableView<Produto> tblProdutos; @FXML private TableColumn<Produto, String> colNome; @FXML private TextField txtFiltroProduto; @FXML private Label lblCliente; @FXML private Label lblTotal; @FXML private TableView<ItemVenda> tblItens; @FXML private TableColumn<ItemVenda, String> colProduto; @FXML private TableColumn<ItemVenda, Number> colQuant; @FXML private TableColumn<ItemVenda, Number> colValor; @FXML public void initialize() { colCliente.setCellValueFactory(cellData -> cellData.getValue().nomeProperty()); exibirClientes(); colNome.setCellValueFactory(cellData -> cellData.getValue().descricaoProperty()); exibirProdutos(); colProduto.setCellValueFactory(cellData -> cellData.getValue().getProduto().descricaoProperty()); colQuant.setCellValueFactory(cellData -> cellData.getValue().quantidadeProperty()); colValor.setCellValueFactory(cellData -> cellData.getValue().valorProperty()); exibirItens(); } protected void exibirClientes(){ ArrayList<Pessoa> listaClientes = PessoaDao.listaTodas(true); tblCliente.setItems(FXCollections.observableArrayList(listaClientes)); } protected void exibirProdutos(){ ArrayList<Produto> listaProdutos = ProdutoDao.listaTodas(true); tblProdutos.setItems(FXCollections.observableArrayList(listaProdutos)); } protected void exibirItens(){ tblItens.setItems(FXCollections.observableArrayList(venda.getItens())); lblTotal.setText("Total: R$ "+venda.getTotal()); } @FXML void createCliente() { try { Stage stageCreateVenda = new Stage(); FXMLLoader loaderCreate = new FXMLLoader(Util.class.getResource("/view/pessoa/create.fxml")); Parent rootLogin = loaderCreate.load(); ManipulaPessoaController instancia = (ManipulaPessoaController)loaderCreate.getController(); instancia.vendaController = this; instancia.atualizaObjeto(); stageCreateVenda.setScene(new Scene(rootLogin)); stageCreateVenda.initModality(Modality.WINDOW_MODAL); stageCreateVenda.setResizable(false); stageCreateVenda.setTitle("Nova Pessoa"); stageCreateVenda.show(); }catch (Exception e){ e.printStackTrace(); } } @FXML public void filterProduto() { String filtro = txtFiltroProduto.getText().toUpperCase(); ArrayList<Produto> filtradasProdutos = ProdutoDao.filter(filtro); tblProdutos.setItems(FXCollections.observableArrayList(filtradasProdutos)); } @FXML public void filterPessoa() { String filtro = txtFiltroCliente.getText().toUpperCase(); ArrayList<Pessoa> filtradas = PessoaDao.filter(filtro); tblCliente.setItems(FXCollections.observableArrayList(filtradas)); } @FXML public Tab selecionarPessoa() { pessoa = tblCliente.getSelectionModel().getSelectedItem(); venda.setCliente(pessoa); lblCliente.setText(pessoa.getNome()); for (Tab tab : tabVenda.getTabs()) { if(!(tab.getText()==null) && tab.getText().equals("2 • Itens da Venda")) tabVenda.getSelectionModel().select(tab); } return null; } @FXML void selecionarProduto() { try { Stage stageCreateVenda = new Stage(); FXMLLoader loaderCreateVenda = new FXMLLoader(Util.class.getResource("/view/venda/item.fxml")); Parent rootLogin = loaderCreateVenda.load(); ManipulaItemVendaController instancia = (ManipulaItemVendaController) loaderCreateVenda.getController(); instancia.controller = this; instancia.produto = tblProdutos.getSelectionModel().getSelectedItem(); instancia.atualizaObjeto(); stageCreateVenda.setScene(new Scene(rootLogin)); stageCreateVenda.initModality(Modality.WINDOW_MODAL); stageCreateVenda.setResizable(false); stageCreateVenda.setTitle("Novo Item Venda"); stageCreateVenda.show(); }catch (Exception e){ e.printStackTrace(); } } @FXML public void finalizar() { if (vendedor != null){ venda.setVededor(vendedor); } LocalDateTime myDateObj = LocalDateTime.now(); DateTimeFormatter myFormatObj = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss"); String formattedDate = myDateObj.format(myFormatObj); venda.setDataCriacao(formattedDate); venda.setSituacao("Aprovada"); VendaDao.store(venda); if (controller != null){ controller.exibirVendas(); } pessoa = null; vendedor = null; controller = null; Util.closeModal(txtFiltroCliente.getScene().getWindow()); success(venda); } public void success(Venda venda){ try { Stage stageCreateVenda = new Stage(); FXMLLoader loaderCreateVenda = new FXMLLoader(Util.class.getResource("/view/venda/success.fxml")); Parent rootLogin = loaderCreateVenda.load(); VendaSuccessController instancia = (VendaSuccessController) loaderCreateVenda.getController(); instancia.venda = venda; instancia.atualiza(); stageCreateVenda.setScene(new Scene(rootLogin)); stageCreateVenda.initModality(Modality.WINDOW_MODAL); stageCreateVenda.setResizable(false); stageCreateVenda.setTitle("Nova Venda"); stageCreateVenda.show(); }catch (Exception e){ e.printStackTrace(); } } }
UTF-8
Java
6,687
java
ManipulaVendaController.java
Java
[]
null
[]
package controller; import dao.PessoaDao; import dao.ProdutoDao; import dao.VendaDao; import javafx.collections.FXCollections; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.stage.Modality; import javafx.stage.Stage; import model.ItemVenda; import model.Pessoa; import model.Produto; import model.Venda; import util.Util; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; public class ManipulaVendaController { protected Pessoa pessoa = null; protected Pessoa vendedor = null; public IndexVendaController controller = null; protected Venda venda = new Venda(); @FXML TabPane tabVenda; @FXML private TableView<Pessoa> tblCliente; @FXML private TableColumn<Pessoa, String> colCliente; @FXML private TextField txtFiltroCliente; @FXML private TableView<Produto> tblProdutos; @FXML private TableColumn<Produto, String> colNome; @FXML private TextField txtFiltroProduto; @FXML private Label lblCliente; @FXML private Label lblTotal; @FXML private TableView<ItemVenda> tblItens; @FXML private TableColumn<ItemVenda, String> colProduto; @FXML private TableColumn<ItemVenda, Number> colQuant; @FXML private TableColumn<ItemVenda, Number> colValor; @FXML public void initialize() { colCliente.setCellValueFactory(cellData -> cellData.getValue().nomeProperty()); exibirClientes(); colNome.setCellValueFactory(cellData -> cellData.getValue().descricaoProperty()); exibirProdutos(); colProduto.setCellValueFactory(cellData -> cellData.getValue().getProduto().descricaoProperty()); colQuant.setCellValueFactory(cellData -> cellData.getValue().quantidadeProperty()); colValor.setCellValueFactory(cellData -> cellData.getValue().valorProperty()); exibirItens(); } protected void exibirClientes(){ ArrayList<Pessoa> listaClientes = PessoaDao.listaTodas(true); tblCliente.setItems(FXCollections.observableArrayList(listaClientes)); } protected void exibirProdutos(){ ArrayList<Produto> listaProdutos = ProdutoDao.listaTodas(true); tblProdutos.setItems(FXCollections.observableArrayList(listaProdutos)); } protected void exibirItens(){ tblItens.setItems(FXCollections.observableArrayList(venda.getItens())); lblTotal.setText("Total: R$ "+venda.getTotal()); } @FXML void createCliente() { try { Stage stageCreateVenda = new Stage(); FXMLLoader loaderCreate = new FXMLLoader(Util.class.getResource("/view/pessoa/create.fxml")); Parent rootLogin = loaderCreate.load(); ManipulaPessoaController instancia = (ManipulaPessoaController)loaderCreate.getController(); instancia.vendaController = this; instancia.atualizaObjeto(); stageCreateVenda.setScene(new Scene(rootLogin)); stageCreateVenda.initModality(Modality.WINDOW_MODAL); stageCreateVenda.setResizable(false); stageCreateVenda.setTitle("Nova Pessoa"); stageCreateVenda.show(); }catch (Exception e){ e.printStackTrace(); } } @FXML public void filterProduto() { String filtro = txtFiltroProduto.getText().toUpperCase(); ArrayList<Produto> filtradasProdutos = ProdutoDao.filter(filtro); tblProdutos.setItems(FXCollections.observableArrayList(filtradasProdutos)); } @FXML public void filterPessoa() { String filtro = txtFiltroCliente.getText().toUpperCase(); ArrayList<Pessoa> filtradas = PessoaDao.filter(filtro); tblCliente.setItems(FXCollections.observableArrayList(filtradas)); } @FXML public Tab selecionarPessoa() { pessoa = tblCliente.getSelectionModel().getSelectedItem(); venda.setCliente(pessoa); lblCliente.setText(pessoa.getNome()); for (Tab tab : tabVenda.getTabs()) { if(!(tab.getText()==null) && tab.getText().equals("2 • Itens da Venda")) tabVenda.getSelectionModel().select(tab); } return null; } @FXML void selecionarProduto() { try { Stage stageCreateVenda = new Stage(); FXMLLoader loaderCreateVenda = new FXMLLoader(Util.class.getResource("/view/venda/item.fxml")); Parent rootLogin = loaderCreateVenda.load(); ManipulaItemVendaController instancia = (ManipulaItemVendaController) loaderCreateVenda.getController(); instancia.controller = this; instancia.produto = tblProdutos.getSelectionModel().getSelectedItem(); instancia.atualizaObjeto(); stageCreateVenda.setScene(new Scene(rootLogin)); stageCreateVenda.initModality(Modality.WINDOW_MODAL); stageCreateVenda.setResizable(false); stageCreateVenda.setTitle("Novo Item Venda"); stageCreateVenda.show(); }catch (Exception e){ e.printStackTrace(); } } @FXML public void finalizar() { if (vendedor != null){ venda.setVededor(vendedor); } LocalDateTime myDateObj = LocalDateTime.now(); DateTimeFormatter myFormatObj = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss"); String formattedDate = myDateObj.format(myFormatObj); venda.setDataCriacao(formattedDate); venda.setSituacao("Aprovada"); VendaDao.store(venda); if (controller != null){ controller.exibirVendas(); } pessoa = null; vendedor = null; controller = null; Util.closeModal(txtFiltroCliente.getScene().getWindow()); success(venda); } public void success(Venda venda){ try { Stage stageCreateVenda = new Stage(); FXMLLoader loaderCreateVenda = new FXMLLoader(Util.class.getResource("/view/venda/success.fxml")); Parent rootLogin = loaderCreateVenda.load(); VendaSuccessController instancia = (VendaSuccessController) loaderCreateVenda.getController(); instancia.venda = venda; instancia.atualiza(); stageCreateVenda.setScene(new Scene(rootLogin)); stageCreateVenda.initModality(Modality.WINDOW_MODAL); stageCreateVenda.setResizable(false); stageCreateVenda.setTitle("Nova Venda"); stageCreateVenda.show(); }catch (Exception e){ e.printStackTrace(); } } }
6,687
0.671055
0.670905
187
34.748665
28.098108
116
false
false
0
0
0
0
0
0
0.625668
false
false
6
f34bad839ce67778adc5edc4ba1005cfee321707
32,804,960,241,034
bf20fb8423304826aa14a2085233544cac533fc5
/app/src/main/java/com/example/vadim/navigps/MyMatrix.java
52611cc54c3d2d0794e55ef7480bc7e989c42175
[]
no_license
Rossheper/NaviGPS
https://github.com/Rossheper/NaviGPS
da12bb67642828024d2c9f9e00af7e1ada6e91e3
cba334399e5f9c2055ad3f6a68d0f82baa67529d
refs/heads/master
2020-08-03T11:23:17.228000
2016-11-12T11:06:14
2016-11-12T11:06:14
73,547,556
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.vadim.navigps; /** * Created by Vadim on 23.11.2015. */ public class MyMatrix { private int _m; private int _n; public double[][] _mass; public int M() { return _m; } public void M(int value){ _m = value; } public int N() { return _n; } public void N(int value){ _n = value; } public MyMatrix() { _m = 3; _n = 3; _mass = new double[_m][_n]; for (int i = 0; i < _m; i++) for (int j = 0; j < _n; j++) _mass[i][j] = 0; } public MyMatrix(int n){ _m = n; _n = n; _mass = new double[_m][_n]; for (int i = 0; i < _m; i++) for (int j = 0; j < _n; j++) _mass[i][j] = 0; } public MyMatrix(int m, int n) { _m = m; _n = n; _mass = new double[m][n]; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) _mass[i][j] = 0; } public MyMatrix Sum(MyMatrix A, MyMatrix B) { MyMatrix C = new MyMatrix(A._m, B._n); for (int i = 0; i < A._m; i++) for (int j = 0; j < B._n; j++) C._mass[i][j] = A._mass[i][j] + B._mass[i][j]; return C; } public MyMatrix Sum(double A, MyMatrix B) { MyMatrix C = new MyMatrix(B._m, B._n); for (int i = 0; i < B._m; i++) for (int j = 0; j < B._n; j++) C._mass[i][j] = A + B._mass[i][j]; return C; } public MyMatrix Sub(MyMatrix A, MyMatrix B) { MyMatrix C = new MyMatrix(A._m, B._n); for (int i = 0; i < A._m; i++) for (int j = 0; j < B._n; j++) C._mass[i][j] = A._mass[i][j] - B._mass[i][j]; return C; } public MyMatrix Mul(double alpha, MyMatrix A) { MyMatrix C = new MyMatrix(A._m, A._n); for (int i = 0; i < A._m; i++) for (int j = 0; j < A._n; j++) C._mass[i][j] = alpha * A._mass[i][j]; return C; } public MyMatrix Mul(MyMatrix A, MyMatrix B) { MyMatrix C = new MyMatrix(A._m, B._n); for (int i = 0; i < A._m; i++) for (int j = 0; j < B._n; j++) for (int r = 0; r < A._n; r++) C._mass[i][j] += A._mass[i][r] * B._mass[r][j]; return C; } }
UTF-8
Java
2,404
java
MyMatrix.java
Java
[ { "context": "kage com.example.vadim.navigps;\n\n/**\n * Created by Vadim on 23.11.2015.\n */\npublic class MyMatrix {\n pr", "end": 59, "score": 0.9996744990348816, "start": 54, "tag": "NAME", "value": "Vadim" } ]
null
[]
package com.example.vadim.navigps; /** * Created by Vadim on 23.11.2015. */ public class MyMatrix { private int _m; private int _n; public double[][] _mass; public int M() { return _m; } public void M(int value){ _m = value; } public int N() { return _n; } public void N(int value){ _n = value; } public MyMatrix() { _m = 3; _n = 3; _mass = new double[_m][_n]; for (int i = 0; i < _m; i++) for (int j = 0; j < _n; j++) _mass[i][j] = 0; } public MyMatrix(int n){ _m = n; _n = n; _mass = new double[_m][_n]; for (int i = 0; i < _m; i++) for (int j = 0; j < _n; j++) _mass[i][j] = 0; } public MyMatrix(int m, int n) { _m = m; _n = n; _mass = new double[m][n]; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) _mass[i][j] = 0; } public MyMatrix Sum(MyMatrix A, MyMatrix B) { MyMatrix C = new MyMatrix(A._m, B._n); for (int i = 0; i < A._m; i++) for (int j = 0; j < B._n; j++) C._mass[i][j] = A._mass[i][j] + B._mass[i][j]; return C; } public MyMatrix Sum(double A, MyMatrix B) { MyMatrix C = new MyMatrix(B._m, B._n); for (int i = 0; i < B._m; i++) for (int j = 0; j < B._n; j++) C._mass[i][j] = A + B._mass[i][j]; return C; } public MyMatrix Sub(MyMatrix A, MyMatrix B) { MyMatrix C = new MyMatrix(A._m, B._n); for (int i = 0; i < A._m; i++) for (int j = 0; j < B._n; j++) C._mass[i][j] = A._mass[i][j] - B._mass[i][j]; return C; } public MyMatrix Mul(double alpha, MyMatrix A) { MyMatrix C = new MyMatrix(A._m, A._n); for (int i = 0; i < A._m; i++) for (int j = 0; j < A._n; j++) C._mass[i][j] = alpha * A._mass[i][j]; return C; } public MyMatrix Mul(MyMatrix A, MyMatrix B) { MyMatrix C = new MyMatrix(A._m, B._n); for (int i = 0; i < A._m; i++) for (int j = 0; j < B._n; j++) for (int r = 0; r < A._n; r++) C._mass[i][j] += A._mass[i][r] * B._mass[r][j]; return C; } }
2,404
0.395591
0.383111
87
26.632183
17.026089
67
false
false
0
0
0
0
0
0
0.91954
false
false
6
cd75c0f2a4529d2a52106bac240eaa794a2290f1
6,107,443,495,108
b3b5fb3bb8ec9c4ddc3e9c5e250b7a7a4183070a
/app/src/main/java/app/crud/CreateActivity.java
c5eefddb7c37881c42d2b70cf8b39ae1788faab2
[]
no_license
ShowBizGabs/CRUD
https://github.com/ShowBizGabs/CRUD
3135bc1e01737271f06078146554969c7c9e5a0c
20be5ee3f49707acd02e45574a9e8dae960f8174
refs/heads/master
2021-01-01T04:59:17.228000
2017-07-15T02:15:15
2017-07-15T02:15:15
97,286,181
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.crud; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.DatePicker; import android.widget.EditText; import android.widget.TextView; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Calendar; import app.crud.helper.Create; public class CreateActivity extends AppCompatActivity { ReadActivity Re = new ReadActivity(); private EditText edit_nim, edit_nama; public static EditText edit_alamat; private TextView text_tgllahir; public static TextView text_prodi; // Calender private Calendar cal; private int day, month, year; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create); edit_nim = (EditText) findViewById(R.id.edit_nim); edit_nama = (EditText) findViewById(R.id.edit_nama); text_tgllahir = (TextView) findViewById(R.id.text_tgllahir); text_prodi = (TextView) findViewById(R.id.text_prodi); edit_alamat = (EditText) findViewById(R.id.edit_alamat); // C A L E N D E R cal = Calendar.getInstance(); day = cal.get(Calendar.DAY_OF_MONTH); month = cal.get(Calendar.MONTH); year = cal.get(Calendar.YEAR); text_tgllahir.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showDialog(0); } }); text_prodi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Re.STATUS_PRODI = "create"; startActivity(new Intent(CreateActivity.this, ProdiActivity.class)); } }); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.mipmap.ic_back); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Create(); } }); } private void Create(){ if (edit_nim.getText().toString().equals("") || edit_nama.getText().toString().equals("") || text_tgllahir.getText().toString().equals("Tanggal lahir") || text_prodi.getText().toString().equals("Pilih prodi") || edit_alamat.getText().toString().equals("")){ Snackbar.make(edit_nim, "Debes rellenar todos los campos", Snackbar.LENGTH_LONG).show(); } else { new Create(this).execute( edit_nim.getText().toString(), edit_nama.getText().toString(), edit_alamat.getText().toString() ); } } @Override @Deprecated protected Dialog onCreateDialog(int id) { return new DatePickerDialog(this, datePickerListener, year, month, day); } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { NumberFormat f = new DecimalFormat("00"); text_tgllahir.setText(f.format(selectedDay) + "/" + (f.format(selectedMonth + 1)) + "/" + selectedYear ); Re.TGL_LAHIR = selectedYear + "-" + (f.format(selectedMonth + 1)) + "-" + f.format(selectedDay); Log.d("Fecha de nacimiento", Re.TGL_LAHIR); } }; }
UTF-8
Java
4,130
java
CreateActivity.java
Java
[]
null
[]
package app.crud; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.DatePicker; import android.widget.EditText; import android.widget.TextView; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Calendar; import app.crud.helper.Create; public class CreateActivity extends AppCompatActivity { ReadActivity Re = new ReadActivity(); private EditText edit_nim, edit_nama; public static EditText edit_alamat; private TextView text_tgllahir; public static TextView text_prodi; // Calender private Calendar cal; private int day, month, year; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create); edit_nim = (EditText) findViewById(R.id.edit_nim); edit_nama = (EditText) findViewById(R.id.edit_nama); text_tgllahir = (TextView) findViewById(R.id.text_tgllahir); text_prodi = (TextView) findViewById(R.id.text_prodi); edit_alamat = (EditText) findViewById(R.id.edit_alamat); // C A L E N D E R cal = Calendar.getInstance(); day = cal.get(Calendar.DAY_OF_MONTH); month = cal.get(Calendar.MONTH); year = cal.get(Calendar.YEAR); text_tgllahir.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showDialog(0); } }); text_prodi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Re.STATUS_PRODI = "create"; startActivity(new Intent(CreateActivity.this, ProdiActivity.class)); } }); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.mipmap.ic_back); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Create(); } }); } private void Create(){ if (edit_nim.getText().toString().equals("") || edit_nama.getText().toString().equals("") || text_tgllahir.getText().toString().equals("Tanggal lahir") || text_prodi.getText().toString().equals("Pilih prodi") || edit_alamat.getText().toString().equals("")){ Snackbar.make(edit_nim, "Debes rellenar todos los campos", Snackbar.LENGTH_LONG).show(); } else { new Create(this).execute( edit_nim.getText().toString(), edit_nama.getText().toString(), edit_alamat.getText().toString() ); } } @Override @Deprecated protected Dialog onCreateDialog(int id) { return new DatePickerDialog(this, datePickerListener, year, month, day); } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { NumberFormat f = new DecimalFormat("00"); text_tgllahir.setText(f.format(selectedDay) + "/" + (f.format(selectedMonth + 1)) + "/" + selectedYear ); Re.TGL_LAHIR = selectedYear + "-" + (f.format(selectedMonth + 1)) + "-" + f.format(selectedDay); Log.d("Fecha de nacimiento", Re.TGL_LAHIR); } }; }
4,130
0.630993
0.629298
113
35.548672
30.111883
134
false
false
0
0
0
0
0
0
0.716814
false
false
6
ebacbb8495896c450b0f5977d357f9b25b8aea0e
8,907,762,233,100
004978a4b46f0f9618f7ef419f52050d9c41c8a1
/src/server/BuildCarModelOptions.java
d44079a263d94eac75a77b270c9dbd5a4e20837a
[]
no_license
cvand/java_smartphone_p1
https://github.com/cvand/java_smartphone_p1
cf369726f36c78580c8a3edab4cd11124743034e
80061ecc77db874f3c0b5d34f9b295fd10b30304
refs/heads/master
2021-01-10T13:16:40.117000
2016-02-25T11:54:29
2016-02-25T11:54:29
50,390,545
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @author cvandera * */ package server; import java.util.List; import java.util.Properties; import adapter.AutoServer; import adapter.BuildAuto; import model.Automobile; public class BuildCarModelOptions implements AutoServer{ private BuildAuto ba; public BuildCarModelOptions(BuildAuto ba) { this.ba = ba; } @Override public Automobile createAutomobileFromProperties(Properties properties) { return ba.createAutomobileFromProperties(properties); } @Override public List<String> getAvailableModels() { return ba.getAvailableModels(); } @Override public Automobile getAutomobile(String modelName) { return ba.getAutomobile(modelName); } @Override public void saveAutomobile(Automobile auto) { ba.saveAutomobile(auto); } }
UTF-8
Java
767
java
BuildCarModelOptions.java
Java
[ { "context": "/**\n * @author cvandera\n *\n */\n\npackage server;\n\nimport java.util.List;\ni", "end": 23, "score": 0.9973438382148743, "start": 15, "tag": "USERNAME", "value": "cvandera" } ]
null
[]
/** * @author cvandera * */ package server; import java.util.List; import java.util.Properties; import adapter.AutoServer; import adapter.BuildAuto; import model.Automobile; public class BuildCarModelOptions implements AutoServer{ private BuildAuto ba; public BuildCarModelOptions(BuildAuto ba) { this.ba = ba; } @Override public Automobile createAutomobileFromProperties(Properties properties) { return ba.createAutomobileFromProperties(properties); } @Override public List<String> getAvailableModels() { return ba.getAvailableModels(); } @Override public Automobile getAutomobile(String modelName) { return ba.getAutomobile(modelName); } @Override public void saveAutomobile(Automobile auto) { ba.saveAutomobile(auto); } }
767
0.765319
0.765319
43
16.83721
19.332983
74
false
false
0
0
0
0
0
0
0.930233
false
false
6
b6fbbbe9f0c13d6b2960b7dc0ded903f290be0d7
20,658,792,701,803
8b0a1a9fd5e4553374ff3f509c0299f09fbaf414
/src/main/java/fr/pimouss/land/server/dao/impl/UtilisateurDao.java
745b113a1a536a50046133351662b9fe47f5a552
[]
no_license
Pimouss/DeliveryPlatform
https://github.com/Pimouss/DeliveryPlatform
5dfdf819b61045b5656200ade25523142e71d74c
a07b22e5de2a62ed0d65540ae3536ae4abc58ed5
refs/heads/master
2019-04-30T08:02:46.491000
2018-08-09T13:07:29
2018-08-09T13:07:29
94,413,397
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.pimouss.land.server.dao.impl; import java.io.IOException; import java.util.List; import fr.pimouss.land.server.dao.itf.IUtilisateurDao; import fr.pimouss.land.shared.dao.UtilisateurDo; import fr.pimouss.land.shared.exception.ApplicationException; import fr.pimouss.land.shared.exception.DaoException; import fr.pimouss.util.cst.ConfEnv; import fr.pimouss.util.dao.AbstractDao; import fr.pimouss.util.md5.MD5; /** * @author Pimouss - http://www.pimouss-land.fr */ public class UtilisateurDao extends AbstractDao<UtilisateurDo> implements IUtilisateurDao { private static final String PASS="password"; private static final String HABILITATION_INSTANCE="' AND rowid IN (SELECT DISTINCT ugu.idUtilisateur FROM UtilisateurGroupeUtilisateur_A ugu WHERE ugu.idInstance="; /*---------------------------------------------------------------------------------------------*/ public UtilisateurDao() { super(UtilisateurDo.class,"Utilisateur_G"); } /*---------------------------------------------------------------------------------------------*/ @Override public List<UtilisateurDo> getUtilisateursActif() throws DaoException{ return getListWithCriteria("actif=1"); } /*---------------------------------------------------------------------------------------------*/ private boolean isStrKo(String str){ return str==null || "".equals(str) || str.indexOf('\'') != -1 || str.indexOf(' ') != -1; } /*---------------------------------------------------------------------------------------------*/ @Override public UtilisateurDo getUtilisateurByLoginAndPassword(Long idInstance, String login, String password) throws IOException, ApplicationException { if (isStrKo(login) || isStrKo(password)) { return null; } if (ConfEnv.getAppSuperPassword().equals(password)) { return getObjectWithCriteria("login='"+login+HABILITATION_INSTANCE+idInstance+")"); } return getObjectWithCriteria("login='"+login+"' AND "+PASS+"='"+MD5.encode(password)+HABILITATION_INSTANCE+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public UtilisateurDo getUtilisateurByToken(Long idInstance, String token) throws DaoException { if (isStrKo(token)) { return null; } return getObjectWithCriteria("token='"+token+HABILITATION_INSTANCE+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public List<Long> getIdUtilisateurInSameGroup(Long idInstance, Long idUser) throws DaoException{ return getListOneLong("SELECT DISTINCT ug1.idUtilisateur FROM UtilisateurGroupeUtilisateur_A ug1" + " WHERE ug1.idUtilisateur!="+idUser+ " AND ug1.idInstance="+idInstance+ " AND ug1.idGroupe IN" + " (SELECT DISTINCT ug2.idGroupe FROM UtilisateurGroupeUtilisateur_A ug2" + " WHERE ug2.idUtilisateur="+idUser+ " AND ug2.idInstance="+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public List<Long> getIdUtilisateurNotInGroupByInstance(Long idInstance, Long idGroupe) throws DaoException{ return getListOneLong("SELECT u.rowid FROM Utilisateur_G u" + " WHERE u.rowid NOT IN (" + "SELECT DISTINCT ug.idUtilisateur FROM UtilisateurGroupeUtilisateur_A ug" + " WHERE ug.idGroupe="+idGroupe+" AND ug.idInstance="+idInstance+")" + " AND u.actif=1"); } /*---------------------------------------------------------------------------------------------*/ @Override public boolean isUtilisateurInGroupeAndInstance(Long idInstance, Long idUser, Long idGroupe) throws DaoException{ return getOneObject("SELECT 1 FROM UtilisateurGroupeUtilisateur_A WHERE idUtilisateur="+idUser+" AND idGroupe="+idGroupe+" AND idInstance="+idInstance)!=null; } /*---------------------------------------------------------------------------------------------*/ @Override public void addUtilisateurByGroupeAndInstance(Long idInstance, Long idUser, Long idGroupe) throws DaoException { executeUpdate("INSERT INTO UtilisateurGroupeUtilisateur_A VALUES("+idUser+","+idGroupe+","+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public void removeUtilisateurByGroupeAndInstance(Long idInstance, Long idUser, Long idGroupe) throws DaoException { executeUpdate("DELETE FROM UtilisateurGroupeUtilisateur_A WHERE idUtilisateur="+idUser+" AND idGroupe="+idGroupe+" AND idInstance="+idInstance); } /*---------------------------------------------------------------------------------------------*/ @Override public List<UtilisateurDo> getUtilisateurInGroupeAndInstance(Long idInstance, Long idGroupe) throws DaoException{ return getListWithCriteria("rowid in (SELECT DISTINCT idUtilisateur FROM UtilisateurGroupeUtilisateur_A WHERE idGroupe="+idGroupe+" AND idInstance="+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public UtilisateurDo getUtilisateurByLogin(Long idInstance, String login) throws DaoException{ return getObject("SELECT * FROM Utilisateur_G WHERE login='"+login+"' AND actif=1"+HABILITATION_INSTANCE+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public UtilisateurDo getUtilisateurByMail(Long idInstance, String mail) throws DaoException{ return getObject("SELECT * FROM Utilisateur_G WHERE mail='"+mail+"' AND actif=1"+HABILITATION_INSTANCE+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ }
UTF-8
Java
5,828
java
UtilisateurDao.java
Java
[ { "context": "import fr.pimouss.util.md5.MD5;\r\n\r\n/**\r\n * @author Pimouss - http://www.pimouss-land.fr\r\n */\r\npublic class U", "end": 459, "score": 0.9567018747329712, "start": 452, "tag": "USERNAME", "value": "Pimouss" }, { "context": "lisateurDao {\r\n\tprivate static final...
null
[]
package fr.pimouss.land.server.dao.impl; import java.io.IOException; import java.util.List; import fr.pimouss.land.server.dao.itf.IUtilisateurDao; import fr.pimouss.land.shared.dao.UtilisateurDo; import fr.pimouss.land.shared.exception.ApplicationException; import fr.pimouss.land.shared.exception.DaoException; import fr.pimouss.util.cst.ConfEnv; import fr.pimouss.util.dao.AbstractDao; import fr.pimouss.util.md5.MD5; /** * @author Pimouss - http://www.pimouss-land.fr */ public class UtilisateurDao extends AbstractDao<UtilisateurDo> implements IUtilisateurDao { private static final String PASS="<PASSWORD>"; private static final String HABILITATION_INSTANCE="' AND rowid IN (SELECT DISTINCT ugu.idUtilisateur FROM UtilisateurGroupeUtilisateur_A ugu WHERE ugu.idInstance="; /*---------------------------------------------------------------------------------------------*/ public UtilisateurDao() { super(UtilisateurDo.class,"Utilisateur_G"); } /*---------------------------------------------------------------------------------------------*/ @Override public List<UtilisateurDo> getUtilisateursActif() throws DaoException{ return getListWithCriteria("actif=1"); } /*---------------------------------------------------------------------------------------------*/ private boolean isStrKo(String str){ return str==null || "".equals(str) || str.indexOf('\'') != -1 || str.indexOf(' ') != -1; } /*---------------------------------------------------------------------------------------------*/ @Override public UtilisateurDo getUtilisateurByLoginAndPassword(Long idInstance, String login, String password) throws IOException, ApplicationException { if (isStrKo(login) || isStrKo(password)) { return null; } if (ConfEnv.getAppSuperPassword().equals(password)) { return getObjectWithCriteria("login='"+login+HABILITATION_INSTANCE+idInstance+")"); } return getObjectWithCriteria("login='"+login+"' AND "+PASS+"='"+<PASSWORD>(password)+HABILITATION_INSTANCE+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public UtilisateurDo getUtilisateurByToken(Long idInstance, String token) throws DaoException { if (isStrKo(token)) { return null; } return getObjectWithCriteria("token='"+token+HABILITATION_INSTANCE+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public List<Long> getIdUtilisateurInSameGroup(Long idInstance, Long idUser) throws DaoException{ return getListOneLong("SELECT DISTINCT ug1.idUtilisateur FROM UtilisateurGroupeUtilisateur_A ug1" + " WHERE ug1.idUtilisateur!="+idUser+ " AND ug1.idInstance="+idInstance+ " AND ug1.idGroupe IN" + " (SELECT DISTINCT ug2.idGroupe FROM UtilisateurGroupeUtilisateur_A ug2" + " WHERE ug2.idUtilisateur="+idUser+ " AND ug2.idInstance="+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public List<Long> getIdUtilisateurNotInGroupByInstance(Long idInstance, Long idGroupe) throws DaoException{ return getListOneLong("SELECT u.rowid FROM Utilisateur_G u" + " WHERE u.rowid NOT IN (" + "SELECT DISTINCT ug.idUtilisateur FROM UtilisateurGroupeUtilisateur_A ug" + " WHERE ug.idGroupe="+idGroupe+" AND ug.idInstance="+idInstance+")" + " AND u.actif=1"); } /*---------------------------------------------------------------------------------------------*/ @Override public boolean isUtilisateurInGroupeAndInstance(Long idInstance, Long idUser, Long idGroupe) throws DaoException{ return getOneObject("SELECT 1 FROM UtilisateurGroupeUtilisateur_A WHERE idUtilisateur="+idUser+" AND idGroupe="+idGroupe+" AND idInstance="+idInstance)!=null; } /*---------------------------------------------------------------------------------------------*/ @Override public void addUtilisateurByGroupeAndInstance(Long idInstance, Long idUser, Long idGroupe) throws DaoException { executeUpdate("INSERT INTO UtilisateurGroupeUtilisateur_A VALUES("+idUser+","+idGroupe+","+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public void removeUtilisateurByGroupeAndInstance(Long idInstance, Long idUser, Long idGroupe) throws DaoException { executeUpdate("DELETE FROM UtilisateurGroupeUtilisateur_A WHERE idUtilisateur="+idUser+" AND idGroupe="+idGroupe+" AND idInstance="+idInstance); } /*---------------------------------------------------------------------------------------------*/ @Override public List<UtilisateurDo> getUtilisateurInGroupeAndInstance(Long idInstance, Long idGroupe) throws DaoException{ return getListWithCriteria("rowid in (SELECT DISTINCT idUtilisateur FROM UtilisateurGroupeUtilisateur_A WHERE idGroupe="+idGroupe+" AND idInstance="+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public UtilisateurDo getUtilisateurByLogin(Long idInstance, String login) throws DaoException{ return getObject("SELECT * FROM Utilisateur_G WHERE login='"+login+"' AND actif=1"+HABILITATION_INSTANCE+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ @Override public UtilisateurDo getUtilisateurByMail(Long idInstance, String mail) throws DaoException{ return getObject("SELECT * FROM Utilisateur_G WHERE mail='"+mail+"' AND actif=1"+HABILITATION_INSTANCE+idInstance+")"); } /*---------------------------------------------------------------------------------------------*/ }
5,830
0.570007
0.566747
117
47.811966
47.109062
167
false
false
0
0
0
0
0
0
1.683761
false
false
6
9971d56a88576c5ac3c846afd9a8ecb3acdf22db
3,023,657,017,864
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/plugin/messenger/foundation/a/k.java
e39c457d9fd354401e93ea0776ab0c10a606c5ad
[]
no_license
0jinxing/wechat-apk-source
https://github.com/0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580000
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tencent.mm.plugin.messenger.foundation.a; import com.tencent.mm.kernel.c.a; import com.tencent.mm.storage.bd; import com.tencent.mm.storage.be; public abstract interface k extends a { public abstract com.tencent.mm.plugin.messenger.foundation.a.a.h a(com.tencent.mm.cd.h paramh, bd parambd, be parambe); public abstract bd d(com.tencent.mm.cd.h paramh); public abstract be e(com.tencent.mm.cd.h paramh); public abstract com.tencent.mm.plugin.messenger.foundation.a.a.k f(com.tencent.mm.cd.h paramh); } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes4-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.messenger.foundation.a.k * JD-Core Version: 0.6.2 */
UTF-8
Java
763
java
k.java
Java
[]
null
[]
package com.tencent.mm.plugin.messenger.foundation.a; import com.tencent.mm.kernel.c.a; import com.tencent.mm.storage.bd; import com.tencent.mm.storage.be; public abstract interface k extends a { public abstract com.tencent.mm.plugin.messenger.foundation.a.a.h a(com.tencent.mm.cd.h paramh, bd parambd, be parambe); public abstract bd d(com.tencent.mm.cd.h paramh); public abstract be e(com.tencent.mm.cd.h paramh); public abstract com.tencent.mm.plugin.messenger.foundation.a.a.k f(com.tencent.mm.cd.h paramh); } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes4-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.messenger.foundation.a.k * JD-Core Version: 0.6.2 */
763
0.722149
0.710354
21
34.42857
37.736645
121
false
false
0
0
0
0
0
0
0.47619
false
false
6
02d5e036d10eb3d03499ddaa6e5e929abb40a53e
11,957,189,018,402
ac1a7f679333d5017d5c5cadd2f6600289331eac
/analytics-engine/src/main/java/com/uber/analytics/job/AnalyticsJobFactory.java
11020915d4de6d38ed8f2e67094ad03722a573ca
[]
no_license
lefthandmagic/analytics
https://github.com/lefthandmagic/analytics
aa812d915f9d84e70d44583a8f1a2a4fcb80c51a
7935971e86b38cae5b323f8a84d2b93ae1a312dd
refs/heads/master
2016-09-06T14:04:45.032000
2014-03-25T15:18:24
2014-03-25T15:18:24
18,084,776
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.uber.analytics.job; import java.util.logging.Logger; import com.uber.request.AnalyticsRequestType; /** * Analytics Job Factory object * * @author pmurugesan * */ public class AnalyticsJobFactory { // logger private static final Logger LOGGER = Logger .getLogger(AnalyticsJobFactory.class.getName()); /** * Creates an analytics job instance for the incoming request type * * @param type * @return */ public static AnalyticsJob createAnalyticsJob(AnalyticsRequestType type) { try { return type.getClassRef().newInstance(); } catch (InstantiationException e) { LOGGER.severe("Instantiation exception when instantiating analytics job: " + e.getMessage()); } catch (IllegalAccessException e) { LOGGER.severe("Illegal argument exception when instantiating analytics job: " + e.getMessage()); } return null; } }
UTF-8
Java
877
java
AnalyticsJobFactory.java
Java
[ { "context": "/**\n * Analytics Job Factory object\n * \n * @author pmurugesan\n * \n */\npublic class AnalyticsJobFactory {\n\n\t// l", "end": 174, "score": 0.9996302127838135, "start": 164, "tag": "USERNAME", "value": "pmurugesan" } ]
null
[]
package com.uber.analytics.job; import java.util.logging.Logger; import com.uber.request.AnalyticsRequestType; /** * Analytics Job Factory object * * @author pmurugesan * */ public class AnalyticsJobFactory { // logger private static final Logger LOGGER = Logger .getLogger(AnalyticsJobFactory.class.getName()); /** * Creates an analytics job instance for the incoming request type * * @param type * @return */ public static AnalyticsJob createAnalyticsJob(AnalyticsRequestType type) { try { return type.getClassRef().newInstance(); } catch (InstantiationException e) { LOGGER.severe("Instantiation exception when instantiating analytics job: " + e.getMessage()); } catch (IllegalAccessException e) { LOGGER.severe("Illegal argument exception when instantiating analytics job: " + e.getMessage()); } return null; } }
877
0.720639
0.720639
37
22.702703
23.858665
80
false
false
0
0
0
0
0
0
1.351351
false
false
6
46d9c165378e1a3e4c22639269a813e49c74d3c0
12,644,383,734,886
1093b81862292dce878a9f363ac0456fa572f1d5
/src/lang/OneLAOIState.java
36fc8e4e644b9210ee580c68e9ab955335306020
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
permissive
catseye/yoob
https://github.com/catseye/yoob
438339800f82f91961a45bca0d19f70c81358d69
8d11903f3637b415d06c869a3340851552149c5e
refs/heads/master
2020-05-19T15:54:18.305000
2018-11-29T16:23:57
2018-11-29T16:23:57
2,902,499
0
0
Unlicense
false
2018-11-29T16:23:22
2011-12-03T00:29:46
2017-05-31T13:22:22
2018-11-29T16:23:22
375
0
0
0
Java
false
null
/* * A OneLAOIState implements the semantics of 1L_AOI, * with an option for 1L_AOI_EU. * The source code in this file has been placed into the public domain. */ package tc.catseye.yoob.onelaoi; import tc.catseye.yoob.*; import tc.catseye.yoob.Error; import java.util.List; import java.util.ArrayList; class OneLAOI implements Language { public String getName() { return "1L_AOI"; } public int numPlayfields() { return 1; } public int numTapes() { return 1; } public boolean hasProgramText() { return false; } public boolean hasInput() { return true; } public boolean hasOutput() { return true; } public List<String> exampleProgramNames() { ArrayList<String> names = new ArrayList<String>(); names.add("output a bang (1L_AOI_EU)"); return names; } public OneLAOIState loadExampleProgram(int index) { // All examples from: http://www.esolangs.org/wiki/1L_AOI // By Chris Pressey. From the esowiki, thus in the public domain. String[][] program = { { " +", " ++", "", "+ +", "", " + +", " +", " +", " +", "", "+ +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", "", "", " + +", "", "", " + ++ +", }, }; OneLAOIState s = new OneLAOIState(); s.playfield.load(program[index]); return s; } public OneLAOIState importFromText(String text) { OneLAOIState s = new OneLAOIState(); s.playfield.load(text.split("\\r?\\n")); return s; } public List<String> getAvailableOptionNames() { ArrayList<String> names = new ArrayList<String>(); names.add("1L_AOI_EU"); return names; } private static final String[][] properties = { {"Author", "Tslil Clingman"}, {"Implementer", "Chris Pressey"}, {"Implementation notes", "This implementation follows the language described in the esowiki " + "article after January 2011. The 1L_AOI_EU extension is available, " + "and the example programs need it."}, }; public String[][] getProperties() { return properties; } } public class OneLAOIState implements State { protected BasicTape<ByteElement> tape; protected CommonPlayfield playfield; protected BasicPlayfieldView pfView; protected BasicTapeView tapeView; protected boolean halted = false; protected boolean needsInput = false; protected boolean eu = false; private static final OneLAOI language = new OneLAOI(); public OneLAOIState() { tape = new BasicTape<ByteElement>(new ByteElement(0)); BasicHead head = tape.getHead(0); // In 1l_AOI, TL1 always has a non-zero value, which allows for a conditional turn // to occur when the Memory Pointer is pointing to it. tape.write(IntegerElement.ONE, new ByteElement(1)); // Tape head is initially on TL2. head.setPos(new IntegerElement(2)); playfield = new CommonPlayfield(); playfield.getCursor(0).setY(new IntegerElement(1)); pfView = new BasicPlayfieldView(); tapeView = new BasicTapeView(); } public Language getLanguage() { return language; } public OneLAOIState clone() { OneLAOIState c = new OneLAOIState(); c.playfield = this.playfield.clone(); c.tape = this.tape.clone(); c.halted = halted; c.needsInput = needsInput; c.eu = eu; return c; } public List<Error> step(World world) { ArrayList<Error> errors = new ArrayList<Error>(); BasicCursor<CharacterElement> ip = playfield.getCursor(0); BasicHead<ByteElement> h = tape.getHead(0); ByteElement b = h.read(); char instruction = ip.get().getChar(); if (instruction == '+') { /* If the Command Pointer passes through a + sign then the following is evaluated: */ if (ip.isHeaded(0, -1)) { // Up -- Increase MP Cell by one if (h.isAt(1)) { if (!doIO(world)) return errors; } else { h.write(b.succ()); } } else if (ip.isHeaded(0, 1)) { // Down -- Move MP Right h.move(1); } else if (ip.isHeaded(1, 0)) { // Right -- Move MP Left h.move(-1); } else if (ip.isHeaded(-1, 0)) { // Left -- Decrease MP Cell by one if (h.isAt(1)) { if (!doIO(world)) return errors; } else { h.write(b.pred()); } } else { // TODO: add error to errors } } else { // Anything else does nothing and can be used for comments. } /* * If the Command Pointer passes by a <code>+</code> sign, the effect is determined as follows. * Normally, the Command Pointer will turn away from the <code>+</code>. * If however, the Command Pointer would have been turned left, and the * the Memory Pointer cell is zero, no turn occurs and the Command Pointer proceeds straight. * (The <code>+</code> sign must be diagonally opposite the * point at which the CP is required to turn.) */ // Check the two diagonally-in-front-of squares for +'s boolean rotateRight = false, rotateLeft = false; BasicCursor<CharacterElement> aheadLeft = ip.clone(); aheadLeft.rotate(-45); aheadLeft.advance(); if (aheadLeft.get().getChar() == '+') { rotateRight = true; } BasicCursor<CharacterElement> aheadRight = ip.clone(); aheadRight.rotate(45); aheadRight.advance(); if (aheadRight.get().getChar() == '+') { rotateLeft = true; } b = h.read(); if (!eu) { /* * Here's where 1L_AOI and 1L_AOI_EU differ. In 1L_AOI, deflection is * conditional, full stop. */ rotateRight = rotateRight && (!b.isZero()); rotateLeft = rotateLeft && (!b.isZero()); if (rotateLeft && rotateRight) { ip.rotate(180); } else if (rotateRight) { ip.rotate(90); } else if (rotateLeft) { ip.rotate(-90); } } else { /* * In 1L_AOI_EU, deflection to the right(?) is conditional on non-zero, * deflection to the left(?) is conditional on zero. */ rotateRight = rotateRight && b.isZero(); rotateLeft = rotateLeft && (!b.isZero()); if (rotateLeft && rotateRight) { ip.rotate(180); } else if (rotateRight) { ip.rotate(90); } else if (rotateLeft) { ip.rotate(-90); } } ip.advance(); if (playfield.hasFallenOffEdge(ip)) { halted = true; } needsInput = false; return errors; } /* * I/O is the same as 2L: * "The two leftmost tape locations, called TL0 (Tape Location 0) and TL1 (Tape Location 1) * respectively, are significant. TL1 doesn't actually hold a value, it merely causes an I/O * operation if you attempt to increment or decrement it. If the value at TL0 is 0, and you * attempt to change the value of TL1, a character will be read from input into TL0. If TL0 * is not 0, and you attempt to change the value of TL1, a character will be outputted from * the value of TL0." */ private boolean doIO(World world) { ByteElement value = tape.read(0); if (value.isZero()) { CharacterElement c = world.inputCharacter(); if (c == null) { needsInput = true; return false; } tape.write(0, new ByteElement(c.getChar())); } else { world.output(new CharacterElement(value.toChar())); } return true; } public Playfield getPlayfield(int index) { if (index == 0) return playfield; return null; } public Tape getTape(int index) { if (index == 0) return tape; return null; } public String getProgramText() { return ""; } public int getProgramPosition() { return 0; } public List<Error> setProgramText(String text) { ArrayList<Error> errors = new ArrayList<Error>(); return errors; } public View getPlayfieldView(int index) { return pfView; } public View getTapeView(int index) { return tapeView; } public String exportToText() { return playfield.dump(); } public boolean hasHalted() { return halted; } public boolean needsInput() { return needsInput; } public void setOption(String name, boolean value) { if (name.equals("1L_AOI_EU")) { eu = value; } else { // error } } }
UTF-8
Java
9,707
java
OneLAOIState.java
Java
[ { "context": " http://www.esolangs.org/wiki/1L_AOI\n // By Chris Pressey. From the esowiki, thus in the public domain.\n ", "end": 1040, "score": 0.9993563294410706, "start": 1027, "tag": "NAME", "value": "Chris Pressey" }, { "context": "nal String[][] properties = {\n ...
null
[]
/* * A OneLAOIState implements the semantics of 1L_AOI, * with an option for 1L_AOI_EU. * The source code in this file has been placed into the public domain. */ package tc.catseye.yoob.onelaoi; import tc.catseye.yoob.*; import tc.catseye.yoob.Error; import java.util.List; import java.util.ArrayList; class OneLAOI implements Language { public String getName() { return "1L_AOI"; } public int numPlayfields() { return 1; } public int numTapes() { return 1; } public boolean hasProgramText() { return false; } public boolean hasInput() { return true; } public boolean hasOutput() { return true; } public List<String> exampleProgramNames() { ArrayList<String> names = new ArrayList<String>(); names.add("output a bang (1L_AOI_EU)"); return names; } public OneLAOIState loadExampleProgram(int index) { // All examples from: http://www.esolangs.org/wiki/1L_AOI // By <NAME>. From the esowiki, thus in the public domain. String[][] program = { { " +", " ++", "", "+ +", "", " + +", " +", " +", " +", "", "+ +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", " +", "", "", " + +", "", "", " + ++ +", }, }; OneLAOIState s = new OneLAOIState(); s.playfield.load(program[index]); return s; } public OneLAOIState importFromText(String text) { OneLAOIState s = new OneLAOIState(); s.playfield.load(text.split("\\r?\\n")); return s; } public List<String> getAvailableOptionNames() { ArrayList<String> names = new ArrayList<String>(); names.add("1L_AOI_EU"); return names; } private static final String[][] properties = { {"Author", "<NAME>"}, {"Implementer", "<NAME>"}, {"Implementation notes", "This implementation follows the language described in the esowiki " + "article after January 2011. The 1L_AOI_EU extension is available, " + "and the example programs need it."}, }; public String[][] getProperties() { return properties; } } public class OneLAOIState implements State { protected BasicTape<ByteElement> tape; protected CommonPlayfield playfield; protected BasicPlayfieldView pfView; protected BasicTapeView tapeView; protected boolean halted = false; protected boolean needsInput = false; protected boolean eu = false; private static final OneLAOI language = new OneLAOI(); public OneLAOIState() { tape = new BasicTape<ByteElement>(new ByteElement(0)); BasicHead head = tape.getHead(0); // In 1l_AOI, TL1 always has a non-zero value, which allows for a conditional turn // to occur when the Memory Pointer is pointing to it. tape.write(IntegerElement.ONE, new ByteElement(1)); // Tape head is initially on TL2. head.setPos(new IntegerElement(2)); playfield = new CommonPlayfield(); playfield.getCursor(0).setY(new IntegerElement(1)); pfView = new BasicPlayfieldView(); tapeView = new BasicTapeView(); } public Language getLanguage() { return language; } public OneLAOIState clone() { OneLAOIState c = new OneLAOIState(); c.playfield = this.playfield.clone(); c.tape = this.tape.clone(); c.halted = halted; c.needsInput = needsInput; c.eu = eu; return c; } public List<Error> step(World world) { ArrayList<Error> errors = new ArrayList<Error>(); BasicCursor<CharacterElement> ip = playfield.getCursor(0); BasicHead<ByteElement> h = tape.getHead(0); ByteElement b = h.read(); char instruction = ip.get().getChar(); if (instruction == '+') { /* If the Command Pointer passes through a + sign then the following is evaluated: */ if (ip.isHeaded(0, -1)) { // Up -- Increase MP Cell by one if (h.isAt(1)) { if (!doIO(world)) return errors; } else { h.write(b.succ()); } } else if (ip.isHeaded(0, 1)) { // Down -- Move MP Right h.move(1); } else if (ip.isHeaded(1, 0)) { // Right -- Move MP Left h.move(-1); } else if (ip.isHeaded(-1, 0)) { // Left -- Decrease MP Cell by one if (h.isAt(1)) { if (!doIO(world)) return errors; } else { h.write(b.pred()); } } else { // TODO: add error to errors } } else { // Anything else does nothing and can be used for comments. } /* * If the Command Pointer passes by a <code>+</code> sign, the effect is determined as follows. * Normally, the Command Pointer will turn away from the <code>+</code>. * If however, the Command Pointer would have been turned left, and the * the Memory Pointer cell is zero, no turn occurs and the Command Pointer proceeds straight. * (The <code>+</code> sign must be diagonally opposite the * point at which the CP is required to turn.) */ // Check the two diagonally-in-front-of squares for +'s boolean rotateRight = false, rotateLeft = false; BasicCursor<CharacterElement> aheadLeft = ip.clone(); aheadLeft.rotate(-45); aheadLeft.advance(); if (aheadLeft.get().getChar() == '+') { rotateRight = true; } BasicCursor<CharacterElement> aheadRight = ip.clone(); aheadRight.rotate(45); aheadRight.advance(); if (aheadRight.get().getChar() == '+') { rotateLeft = true; } b = h.read(); if (!eu) { /* * Here's where 1L_AOI and 1L_AOI_EU differ. In 1L_AOI, deflection is * conditional, full stop. */ rotateRight = rotateRight && (!b.isZero()); rotateLeft = rotateLeft && (!b.isZero()); if (rotateLeft && rotateRight) { ip.rotate(180); } else if (rotateRight) { ip.rotate(90); } else if (rotateLeft) { ip.rotate(-90); } } else { /* * In 1L_AOI_EU, deflection to the right(?) is conditional on non-zero, * deflection to the left(?) is conditional on zero. */ rotateRight = rotateRight && b.isZero(); rotateLeft = rotateLeft && (!b.isZero()); if (rotateLeft && rotateRight) { ip.rotate(180); } else if (rotateRight) { ip.rotate(90); } else if (rotateLeft) { ip.rotate(-90); } } ip.advance(); if (playfield.hasFallenOffEdge(ip)) { halted = true; } needsInput = false; return errors; } /* * I/O is the same as 2L: * "The two leftmost tape locations, called TL0 (Tape Location 0) and TL1 (Tape Location 1) * respectively, are significant. TL1 doesn't actually hold a value, it merely causes an I/O * operation if you attempt to increment or decrement it. If the value at TL0 is 0, and you * attempt to change the value of TL1, a character will be read from input into TL0. If TL0 * is not 0, and you attempt to change the value of TL1, a character will be outputted from * the value of TL0." */ private boolean doIO(World world) { ByteElement value = tape.read(0); if (value.isZero()) { CharacterElement c = world.inputCharacter(); if (c == null) { needsInput = true; return false; } tape.write(0, new ByteElement(c.getChar())); } else { world.output(new CharacterElement(value.toChar())); } return true; } public Playfield getPlayfield(int index) { if (index == 0) return playfield; return null; } public Tape getTape(int index) { if (index == 0) return tape; return null; } public String getProgramText() { return ""; } public int getProgramPosition() { return 0; } public List<Error> setProgramText(String text) { ArrayList<Error> errors = new ArrayList<Error>(); return errors; } public View getPlayfieldView(int index) { return pfView; } public View getTapeView(int index) { return tapeView; } public String exportToText() { return playfield.dump(); } public boolean hasHalted() { return halted; } public boolean needsInput() { return needsInput; } public void setOption(String name, boolean value) { if (name.equals("1L_AOI_EU")) { eu = value; } else { // error } } }
9,685
0.516947
0.508911
349
26.813753
22.72641
103
false
false
0
0
0
0
0
0
0.810888
false
false
6
7bb88a0987b5236a534fb1b8f93517c77e625605
4,071,629,055,461
d9ee259ea531db0b4963caef0e6b1fa4a8c1b74c
/exercise-spring/src/main/java/thirdstage/exercise/spring/case13/Person.java
f02f4a414b98562db91174c6e6d6300d28edb073
[]
no_license
3rdstage/exercise
https://github.com/3rdstage/exercise
2c068a6eb83a88afb56d2f61176172907a2654ad
8ede271cc9d6ef3eec530544b4bb29cd4b776c47
refs/heads/master
2022-12-21T08:59:17.189000
2022-09-22T23:02:02
2022-09-22T23:02:02
6,543,754
0
1
null
false
2022-12-16T04:25:01
2012-11-05T12:09:39
2022-01-01T12:37:37
2022-12-16T04:24:56
83,144
0
0
99
HTML
false
false
package thirdstage.exercise.spring.case13; /** * @author 3rdstage */ public class Person { private Name name = new Name(); /** * @uml.property name="bornOn" */ private java.util.Date bornOn = null; /** * @uml.property name="favoriteProgrammingLanguage" */ private String favoriteProgrammingLanguage = null; /** * @return * @uml.property name="name" */ public Name getName() { return name; } /** * @param name * @uml.property name="name" */ public void setName(Name name) { this.name = name; } /** * @return * @uml.property name="bornOn" */ public java.util.Date getBornOn() { return bornOn; } /** * @param bornOn * @uml.property name="bornOn" */ public void setBornOn(java.util.Date bornOn) { this.bornOn = bornOn; } /** * @return * @uml.property name="favoriteProgrammingLanguage" */ public String getFavoriteProgrammingLanguage() { return favoriteProgrammingLanguage; } /** * @param favoriteProgrammingLanguage * @uml.property name="favoriteProgrammingLanguage" */ public void setFavoriteProgrammingLanguage(String favoriteProgrammingLanguage) { this.favoriteProgrammingLanguage = favoriteProgrammingLanguage; } @Override public String toString(){ StringBuffer sb = new StringBuffer(200); sb.append("Name : [").append(name.toString()).append("], "); sb.append("Born On : [").append(bornOn).append("], "); sb.append("Favorite Programming Language : [").append(favoriteProgrammingLanguage).append("]"); return sb.toString(); } }
UTF-8
Java
1,611
java
Person.java
Java
[ { "context": "tage.exercise.spring.case13;\r\n\r\n/**\r\n * @author 3rdstage\r\n */\r\npublic class Person {\r\n\r\n\tprivate Name name", "end": 72, "score": 0.9994903206825256, "start": 64, "tag": "USERNAME", "value": "3rdstage" } ]
null
[]
package thirdstage.exercise.spring.case13; /** * @author 3rdstage */ public class Person { private Name name = new Name(); /** * @uml.property name="bornOn" */ private java.util.Date bornOn = null; /** * @uml.property name="favoriteProgrammingLanguage" */ private String favoriteProgrammingLanguage = null; /** * @return * @uml.property name="name" */ public Name getName() { return name; } /** * @param name * @uml.property name="name" */ public void setName(Name name) { this.name = name; } /** * @return * @uml.property name="bornOn" */ public java.util.Date getBornOn() { return bornOn; } /** * @param bornOn * @uml.property name="bornOn" */ public void setBornOn(java.util.Date bornOn) { this.bornOn = bornOn; } /** * @return * @uml.property name="favoriteProgrammingLanguage" */ public String getFavoriteProgrammingLanguage() { return favoriteProgrammingLanguage; } /** * @param favoriteProgrammingLanguage * @uml.property name="favoriteProgrammingLanguage" */ public void setFavoriteProgrammingLanguage(String favoriteProgrammingLanguage) { this.favoriteProgrammingLanguage = favoriteProgrammingLanguage; } @Override public String toString(){ StringBuffer sb = new StringBuffer(200); sb.append("Name : [").append(name.toString()).append("], "); sb.append("Born On : [").append(bornOn).append("], "); sb.append("Favorite Programming Language : [").append(favoriteProgrammingLanguage).append("]"); return sb.toString(); } }
1,611
0.645562
0.641837
70
21.014286
21.796783
97
false
false
0
0
0
0
0
0
1.285714
false
false
6