blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
32e8a55182c8ed0112b4d3720a5ceb3026536dbf
4785888ed6b44037bfbf2571db133e1315bb6d35
/over2cloud/src/com/Over2Cloud/procegure/ProcegureCall/NativeUpdatequery.java
4583acd91ff736944712f3f804fd0667ae949ab2
[]
no_license
Barcode36/Med_Care
10048f8ea97f9996b90131292390021066cfc4db
e96b046c08a6f0bb1873f0b680bc858e40ac1d3e
refs/heads/master
2021-06-01T15:03:42.622244
2016-09-03T09:46:37
2016-09-03T09:46:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,413
java
package com.Over2Cloud.procegure.ProcegureCall; import java.util.Map; import org.apache.struts2.interceptor.SessionAware; import com.Over2Cloud.annotation.NamedQueries; import com.Over2Cloud.annotation.NamedQuery; @NamedQueries( { // select query @NamedQuery( name= "leadbasicdetails", query="select * from leadbasicdetails"), @NamedQuery( name= "leadaddressingdetails", query="select * from leadaddressingdetails"), @NamedQuery( name= "leadcustomdetails", query="select * from leadcustomdetails"), @NamedQuery( name= "selectAlltab", query="select * from allcommontabtable"), @NamedQuery( name= "contactconf", query="select * from contactconf"), @NamedQuery( name= "oppcontaactconfi", query="select * from oppcontaactconfi"), @NamedQuery( name= "opportunityconf", query="select * from opportunityconf"), @NamedQuery( name= "organizconf", query="select * from organizconf"), @NamedQuery( name= "productconf", query="select * from productconf"), @NamedQuery( name= "departconf", query="select * from departconf"), // query where clause use only W inn select Query for make diffirent!! @NamedQuery( name= "selecttabelforConfig", query="select * from allcommontabtable where id= :id"), @NamedQuery( name= "leadbasicdetailsw", query="select * from leadbasicdetails where id= :id") } ) public class NativeUpdatequery{ }
6709835147ebf3cd952a15bdb5f51df21b7d8c2a
275cb4a760cd47fce99ffb1fae79bb6ca6cb93e1
/src/main/java/br/infnet/sysAvaliacao/repository/CursoRepository.java
7334d43e4c574bfba74408e4eaa255eb164d9c05
[]
no_license
antoniovilmar/sysAvaliacao
e4fc19b797ff49bb0c36801b90cc35e339152cff
6c7ba1ff31d5e1f479ff132d37133bd2a99de9fa
refs/heads/master
2021-01-23T15:42:51.122722
2015-11-01T13:05:55
2015-11-01T13:05:55
38,935,508
0
0
null
null
null
null
UTF-8
Java
false
false
154
java
package br.infnet.sysAvaliacao.repository; import br.infnet.sysAvaliacao.model.Curso; public class CursoRepository extends DAO<Long, Curso> { }
dfd9251170ff345a0b924159ce92472a5b1cc1d3
6252fe10335c8d40dc997b1954ffd485549d3243
/folder1/folder2/DealershipType.java
9b1b28c4f93024480c9a81a93c8a0b417ca25c8a
[]
no_license
odike/lottery-simulator
e6f152a21903e7eefd09518fecfbb3d95294ffa7
7a534376fdbadcbb1fcf8e6fb00854c324bc3f25
refs/heads/master
2020-03-30T21:44:09.384565
2018-11-04T22:50:14
2018-11-04T22:50:14
151,640,192
0
0
null
null
null
null
UTF-8
Java
false
false
92
java
package folder1.folder2; public enum DealershipType{CHEVROLET,PONTIAC,BUICK,CADILLAC,SATURN}
b40eec95e9e3839fcb69d95856724fcf5936ae01
78cca97e0aa73aa147c88500cc4f8c440e3c2d2b
/chain/ConsoleLogger.java
fc7746e020007f75a1401b5463de6aea9112e2ab
[]
no_license
sparrowljq/designmode
8d8f0187cbe76f19105536f3144a9f13857597b0
bf13b8c78c8e547da3040e9cb34d001d13701ec2
refs/heads/main
2023-02-13T12:30:36.902815
2021-01-09T09:57:02
2021-01-09T09:57:02
328,123,436
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.lzu.edu.cn.designmode.chain; public class ConsoleLogger extends AbstractLogger{ public ConsoleLogger(int level) { this.level=level; } @Override protected void write(String message) { System.out.println("控制台输出:"+message); } }
[ "459049715" ]
459049715
b66c76bf10a9f2aae2f01eccce8a76c155e34e39
9623f83defac3911b4780bc408634c078da73387
/powercraft_146_modloader/src/minecraft/powercraft/management/PC_TileEntity.java
5e9b3d2a6e571620eb1e55563b6a9e443c81a630
[]
no_license
BlearStudio/powercraft-legacy
42b839393223494748e8b5d05acdaf59f18bd6c6
014e9d4d71bd99823cf63d4fbdb65c1b83fde1f8
refs/heads/master
2021-01-21T21:18:55.774908
2015-04-06T20:45:25
2015-04-06T20:45:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,934
java
package powercraft.management; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import net.minecraft.src.CrashReportCategory; import net.minecraft.src.EntityPlayer; import net.minecraft.src.ItemStack; import net.minecraft.src.Packet; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraft.src.World; public abstract class PC_TileEntity extends TileEntity { @Override public Packet getDescriptionPacket() { Object[] o = getData(); if (o == null) { return null; } ByteArrayOutputStream data = new ByteArrayOutputStream(); ObjectOutputStream sendData; try { sendData = new ObjectOutputStream(data); sendData.writeInt(PC_PacketHandler.PACKETTILEENTITY); sendData.writeInt(xCoord); sendData.writeInt(yCoord); sendData.writeInt(zCoord); sendData.writeObject(o); sendData.writeInt(PC_PacketHandler.PACKETTILEENTITY); } catch (IOException e) { e.printStackTrace(); } return new Packet250CustomPayload("PowerCraft", data.toByteArray()); } public PC_VecI getCoord() { return new PC_VecI(xCoord, yCoord, zCoord); } public void setData(Object[] o) { } public Object[] getData() { return null; } public void create(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { } public boolean canUpdate() { return false; } @Override public void func_85027_a(CrashReportCategory par1CrashReportCategory) { getBlockType(); super.func_85027_a(par1CrashReportCategory); } }
[ "[email protected]@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c" ]
[email protected]@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c
8980f3d3b90964cd95a575759233266e6498f84b
1572f27a7087746cad0f5d6e3258a23c1e177108
/Labs/ShoppingCart.java
7575528554ed9cc0f713d2a346663dd3a8bca891
[]
no_license
BrianOrozco29/CS113
123aa748ac20c56f02e5511120cd8a6f76718fb5
06396e8b0039f3861b1371553f5fa86c6a6bacaf
refs/heads/master
2020-03-17T02:45:03.604533
2018-05-13T04:05:18
2018-05-13T04:05:18
133,203,819
0
0
null
null
null
null
UTF-8
Java
false
false
2,142
java
package labs; //*************************************************************** //ShoppingCart.java // //Represents a shopping cart as an array of items //*************************************************************** import java.text.NumberFormat; public class ShoppingCart { private int itemCount; // total number of items in the cart private double totalPrice; // total price of items in the cart private int capacity; // current cart capacity private Item[] cart; //problem 1a // --------------------------------------------------------- // Creates an empty shopping cart with a capacity of 5 items. // --------------------------------------------------------- public ShoppingCart() { capacity = 5; itemCount = 0; totalPrice = 0.0; cart = new Item[capacity]; // problem 1a } // ----------------------------------------------------- // Adds an item to the shopping cart. // ----------------------------------------------------- public void addToCart(String itemName, double price, int quantity) { cart[itemCount] = new Item(itemName, price, quantity); totalPrice += price; itemCount += quantity; } public double getTotalPrice(){ return totalPrice; } // ----------------------------------------------------- // Returns the contents of the cart together with // summary information. // ----------------------------------------------------- public String toString() { NumberFormat fmt = NumberFormat.getCurrencyInstance(); String contents = "\nShopping Cart\n"; contents += "\nItem\t\tUnit Price\tQuantity\tTotal\n"; for (int i = 0; i < itemCount; i++) contents += cart[i].toString() + "\n"; contents += "\nTotal Price: " + fmt.format(totalPrice); contents += "\n"; return contents; } // ----------------------------------------------------- // Increases the capacity of the shopping cart by 3 // ----------------------------------------------------- private void increaseSize() { capacity += 3; Item[] temp = new Item[capacity]; for(int i = 0; i<cart.length; i++){ temp[i] = cart[i]; } cart = temp; } }
fb9647c886848204458f00d0e5a9818555171c3a
d8ec0f725150d24b598b6406d2c57ca640905fca
/classgenerator/src/main/java/info/kimjihyok/pokemonworldchampionship/toothpick/generated/pokemonversion/PokemonVersion14.java
9f5b0394e1f22295419ed4e68edb97689ffdcb88
[]
no_license
wotomas/PokemonWorldChampionship
b968d1fce117aba38d2311a6599501e54475eb59
4476fffd477b061d724317aaeb07c04762379991
refs/heads/master
2020-11-29T11:59:39.599484
2017-03-16T08:32:06
2017-03-16T08:32:06
84,800,186
1
0
null
null
null
null
UTF-8
Java
false
false
25,823
java
package info.kimjihyok.pokemonworldchampionship.toothpick.generated.pokemonversion; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer1; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer10; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer100; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer101; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer102; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer103; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer104; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer105; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer106; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer107; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer108; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer109; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer11; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer110; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer111; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer112; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer113; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer114; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer115; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer116; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer117; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer118; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer119; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer12; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer120; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer121; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer122; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer123; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer124; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer125; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer126; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer127; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer128; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer129; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer13; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer130; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer131; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer132; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer133; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer134; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer135; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer136; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer137; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer138; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer139; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer14; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer140; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer141; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer142; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer143; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer144; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer145; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer146; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer147; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer148; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer149; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer15; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer150; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer151; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer152; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer153; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer154; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer155; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer156; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer157; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer158; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer159; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer16; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer160; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer161; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer162; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer163; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer164; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer165; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer166; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer167; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer168; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer169; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer17; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer170; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer171; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer172; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer173; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer174; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer175; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer176; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer177; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer178; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer179; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer18; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer180; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer181; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer182; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer183; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer184; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer185; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer186; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer187; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer188; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer189; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer19; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer190; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer191; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer192; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer193; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer194; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer195; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer196; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer197; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer198; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer199; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer2; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer20; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer200; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer21; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer22; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer23; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer24; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer25; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer26; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer27; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer28; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer29; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer3; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer30; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer31; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer32; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer33; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer34; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer35; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer36; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer37; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer38; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer39; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer4; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer40; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer41; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer42; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer43; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer44; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer45; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer46; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer47; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer48; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer49; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer5; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer50; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer51; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer52; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer53; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer54; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer55; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer56; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer57; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer58; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer59; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer6; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer60; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer61; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer62; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer63; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer64; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer65; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer66; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer67; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer68; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer69; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer7; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer70; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer71; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer72; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer73; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer74; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer75; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer76; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer77; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer78; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer79; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer8; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer80; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer81; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer82; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer83; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer84; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer85; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer86; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer87; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer88; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer89; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer9; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer90; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer91; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer92; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer93; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer94; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer95; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer96; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer97; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer98; import info.kimjihyok.pokemonworldchampionship.toothpick.generated.trainer.Trainer99; import javax.inject.Inject; public class PokemonVersion14 { @Inject public Trainer1 trainer1; @Inject public Trainer2 trainer2; @Inject public Trainer3 trainer3; @Inject public Trainer4 trainer4; @Inject public Trainer5 trainer5; @Inject public Trainer6 trainer6; @Inject public Trainer7 trainer7; @Inject public Trainer8 trainer8; @Inject public Trainer9 trainer9; @Inject public Trainer10 trainer10; @Inject public Trainer11 trainer11; @Inject public Trainer12 trainer12; @Inject public Trainer13 trainer13; @Inject public Trainer14 trainer14; @Inject public Trainer15 trainer15; @Inject public Trainer16 trainer16; @Inject public Trainer17 trainer17; @Inject public Trainer18 trainer18; @Inject public Trainer19 trainer19; @Inject public Trainer20 trainer20; @Inject public Trainer21 trainer21; @Inject public Trainer22 trainer22; @Inject public Trainer23 trainer23; @Inject public Trainer24 trainer24; @Inject public Trainer25 trainer25; @Inject public Trainer26 trainer26; @Inject public Trainer27 trainer27; @Inject public Trainer28 trainer28; @Inject public Trainer29 trainer29; @Inject public Trainer30 trainer30; @Inject public Trainer31 trainer31; @Inject public Trainer32 trainer32; @Inject public Trainer33 trainer33; @Inject public Trainer34 trainer34; @Inject public Trainer35 trainer35; @Inject public Trainer36 trainer36; @Inject public Trainer37 trainer37; @Inject public Trainer38 trainer38; @Inject public Trainer39 trainer39; @Inject public Trainer40 trainer40; @Inject public Trainer41 trainer41; @Inject public Trainer42 trainer42; @Inject public Trainer43 trainer43; @Inject public Trainer44 trainer44; @Inject public Trainer45 trainer45; @Inject public Trainer46 trainer46; @Inject public Trainer47 trainer47; @Inject public Trainer48 trainer48; @Inject public Trainer49 trainer49; @Inject public Trainer50 trainer50; @Inject public Trainer51 trainer51; @Inject public Trainer52 trainer52; @Inject public Trainer53 trainer53; @Inject public Trainer54 trainer54; @Inject public Trainer55 trainer55; @Inject public Trainer56 trainer56; @Inject public Trainer57 trainer57; @Inject public Trainer58 trainer58; @Inject public Trainer59 trainer59; @Inject public Trainer60 trainer60; @Inject public Trainer61 trainer61; @Inject public Trainer62 trainer62; @Inject public Trainer63 trainer63; @Inject public Trainer64 trainer64; @Inject public Trainer65 trainer65; @Inject public Trainer66 trainer66; @Inject public Trainer67 trainer67; @Inject public Trainer68 trainer68; @Inject public Trainer69 trainer69; @Inject public Trainer70 trainer70; @Inject public Trainer71 trainer71; @Inject public Trainer72 trainer72; @Inject public Trainer73 trainer73; @Inject public Trainer74 trainer74; @Inject public Trainer75 trainer75; @Inject public Trainer76 trainer76; @Inject public Trainer77 trainer77; @Inject public Trainer78 trainer78; @Inject public Trainer79 trainer79; @Inject public Trainer80 trainer80; @Inject public Trainer81 trainer81; @Inject public Trainer82 trainer82; @Inject public Trainer83 trainer83; @Inject public Trainer84 trainer84; @Inject public Trainer85 trainer85; @Inject public Trainer86 trainer86; @Inject public Trainer87 trainer87; @Inject public Trainer88 trainer88; @Inject public Trainer89 trainer89; @Inject public Trainer90 trainer90; @Inject public Trainer91 trainer91; @Inject public Trainer92 trainer92; @Inject public Trainer93 trainer93; @Inject public Trainer94 trainer94; @Inject public Trainer95 trainer95; @Inject public Trainer96 trainer96; @Inject public Trainer97 trainer97; @Inject public Trainer98 trainer98; @Inject public Trainer99 trainer99; @Inject public Trainer100 trainer100; @Inject public Trainer101 trainer101; @Inject public Trainer102 trainer102; @Inject public Trainer103 trainer103; @Inject public Trainer104 trainer104; @Inject public Trainer105 trainer105; @Inject public Trainer106 trainer106; @Inject public Trainer107 trainer107; @Inject public Trainer108 trainer108; @Inject public Trainer109 trainer109; @Inject public Trainer110 trainer110; @Inject public Trainer111 trainer111; @Inject public Trainer112 trainer112; @Inject public Trainer113 trainer113; @Inject public Trainer114 trainer114; @Inject public Trainer115 trainer115; @Inject public Trainer116 trainer116; @Inject public Trainer117 trainer117; @Inject public Trainer118 trainer118; @Inject public Trainer119 trainer119; @Inject public Trainer120 trainer120; @Inject public Trainer121 trainer121; @Inject public Trainer122 trainer122; @Inject public Trainer123 trainer123; @Inject public Trainer124 trainer124; @Inject public Trainer125 trainer125; @Inject public Trainer126 trainer126; @Inject public Trainer127 trainer127; @Inject public Trainer128 trainer128; @Inject public Trainer129 trainer129; @Inject public Trainer130 trainer130; @Inject public Trainer131 trainer131; @Inject public Trainer132 trainer132; @Inject public Trainer133 trainer133; @Inject public Trainer134 trainer134; @Inject public Trainer135 trainer135; @Inject public Trainer136 trainer136; @Inject public Trainer137 trainer137; @Inject public Trainer138 trainer138; @Inject public Trainer139 trainer139; @Inject public Trainer140 trainer140; @Inject public Trainer141 trainer141; @Inject public Trainer142 trainer142; @Inject public Trainer143 trainer143; @Inject public Trainer144 trainer144; @Inject public Trainer145 trainer145; @Inject public Trainer146 trainer146; @Inject public Trainer147 trainer147; @Inject public Trainer148 trainer148; @Inject public Trainer149 trainer149; @Inject public Trainer150 trainer150; @Inject public Trainer151 trainer151; @Inject public Trainer152 trainer152; @Inject public Trainer153 trainer153; @Inject public Trainer154 trainer154; @Inject public Trainer155 trainer155; @Inject public Trainer156 trainer156; @Inject public Trainer157 trainer157; @Inject public Trainer158 trainer158; @Inject public Trainer159 trainer159; @Inject public Trainer160 trainer160; @Inject public Trainer161 trainer161; @Inject public Trainer162 trainer162; @Inject public Trainer163 trainer163; @Inject public Trainer164 trainer164; @Inject public Trainer165 trainer165; @Inject public Trainer166 trainer166; @Inject public Trainer167 trainer167; @Inject public Trainer168 trainer168; @Inject public Trainer169 trainer169; @Inject public Trainer170 trainer170; @Inject public Trainer171 trainer171; @Inject public Trainer172 trainer172; @Inject public Trainer173 trainer173; @Inject public Trainer174 trainer174; @Inject public Trainer175 trainer175; @Inject public Trainer176 trainer176; @Inject public Trainer177 trainer177; @Inject public Trainer178 trainer178; @Inject public Trainer179 trainer179; @Inject public Trainer180 trainer180; @Inject public Trainer181 trainer181; @Inject public Trainer182 trainer182; @Inject public Trainer183 trainer183; @Inject public Trainer184 trainer184; @Inject public Trainer185 trainer185; @Inject public Trainer186 trainer186; @Inject public Trainer187 trainer187; @Inject public Trainer188 trainer188; @Inject public Trainer189 trainer189; @Inject public Trainer190 trainer190; @Inject public Trainer191 trainer191; @Inject public Trainer192 trainer192; @Inject public Trainer193 trainer193; @Inject public Trainer194 trainer194; @Inject public Trainer195 trainer195; @Inject public Trainer196 trainer196; @Inject public Trainer197 trainer197; @Inject public Trainer198 trainer198; @Inject public Trainer199 trainer199; @Inject public Trainer200 trainer200; }
6acd1305e1e640922d5816494506edaa7cfb252b
919c7d657dc016c5948593f7e84ce039e5c0e713
/Live@500px/app/src/main/java/com/tophymastery/live500px/view/CustomViewTemplate.java
0b639d66a3c7c2d9bfe2133d786cf47f2989ce8b
[]
no_license
tophymastery/android_udemy
764a45b6c70327ffb2635e171190f0ee0ce087af
98cd6dc93121aece0403a9d77fccb957c59959e4
refs/heads/master
2021-01-10T01:55:51.292389
2016-02-14T14:49:10
2016-02-14T14:49:10
51,628,030
0
0
null
null
null
null
UTF-8
Java
false
false
2,342
java
package com.tophymastery.live500px.view; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Canvas; import android.os.Bundle; import android.os.Parcelable; import android.util.AttributeSet; import android.view.View; import com.inthecheesefactory.thecheeselibrary.view.state.BundleSavedState; /** * Created by nuuneoi on 11/16/2014. */ public class CustomViewTemplate extends View { public CustomViewTemplate(Context context) { super(context); init(); } public CustomViewTemplate(Context context, AttributeSet attrs) { super(context, attrs); init(); initWithAttrs(attrs, 0, 0); } public CustomViewTemplate(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); initWithAttrs(attrs, defStyleAttr, 0); } @TargetApi(21) public CustomViewTemplate(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); initWithAttrs(attrs, defStyleAttr, defStyleRes); } private void init() { setSaveEnabled(true); } private void initWithAttrs(AttributeSet attrs, int defStyleAttr, int defStyleRes) { /* TypedArray a = getContext().getTheme().obtainStyledAttributes( attrs, R.styleable.StyleableName, defStyleAttr, defStyleRes); try { } finally { a.recycle(); } */ } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); } @Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); BundleSavedState savedState = new BundleSavedState(superState); // Save Instance State(s) here to the 'savedState.getBundle()' // for example, // savedState.getBundle().putString("key", value); return savedState; } @Override protected void onRestoreInstanceState(Parcelable state) { BundleSavedState ss = (BundleSavedState) state; super.onRestoreInstanceState(ss.getSuperState()); Bundle bundle = ss.getBundle(); // Restore State from bundle here } }
ba9d1be0685207855f8ae77e09429d7ed5553e59
d39fa406c8ce637fc4c6a4cb499d1b04d42b7378
/src/main/java/com/chaoxing/filemanagement/common/shiro/MyRealm.java
1389bf6206c3e24b911292e6cf564ece90bfda94
[]
no_license
lwgboy/filemanagement
95636eaa5eba2eb6f4ba55b987211415e66704a7
cb8cb06ddc6f78d923461ff5eca2769fb7f001ff
refs/heads/master
2021-05-18T19:36:33.387434
2019-10-30T09:00:43
2019-10-30T09:00:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,949
java
package com.chaoxing.filemanagement.common.shiro; import com.chaoxing.filemanagement.service.UserService; import com.chaoxing.filemanagement.util.JWTUtil; import com.chaoxing.filemanagement.vo.UserVO; import org.apache.shiro.authc.*; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.HashSet; import java.util.Set; @Service public class MyRealm extends AuthorizingRealm { private UserService userService; @Autowired public void setUserService(UserService userService) { this.userService = userService; } /** * 大坑!,必须重写此方法,不然Shiro会报错 */ @Override public boolean supports(AuthenticationToken token) { return token instanceof JWTToken; } /** * 只有当需要检测用户权限的时候才会调用此方法,例如checkRole,checkPermission之类的 Authorization 授权 */ @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { Integer userId = JWTUtil.getUserId(principals.toString()); SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); UserVO user = userService.selectUserVO(userId); //simpleAuthorizationInfo.addRole(user.getPermission()); System.out.println("permission:"+user.getPermission()); Set<String> permission = new HashSet<>(Arrays.asList(user.getPermission().split(";"))); simpleAuthorizationInfo.addStringPermissions(permission); return simpleAuthorizationInfo; } /** * 默认使用此方法进行用户名正确与否验证,错误抛出异常即可。 Authentication 认证方式 */ @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException { String token = (String) auth.getCredentials(); // 解密获得username,用于和数据库进行对比 String username = JWTUtil.getUsername(token); Integer userId = JWTUtil.getUserId(token); System.out.println("userId"+userId); System.out.println("userName"+username); if (username == null) { throw new AuthenticationException("token invalid"); } UserVO userBean = userService.selectUserVO(userId); if (userBean == null) { throw new AuthenticationException("User didn't existed!"); } if (! JWTUtil.verify(token,userBean.getPassword())) { throw new AuthenticationException("Username or password error"); } return new SimpleAuthenticationInfo(token, token, "my_realm"); } }
c8ca0a2b749cdb786286683515fa2c1846a4a936
b7aa376dfafc8137b2cbdd50c6b5f1124af1fb6e
/src/main/java/pay/travel/testtask/controllers/MainController.java
326a387fe99cb7efb4c13b143995303ba01ab863
[]
no_license
ArseniyJ4J/notebook
29cbdeddef7dba7e19abf71e0b32ffa0fb693f68
63a0db23be1827425408b1837447a0bc2821974e
refs/heads/master
2021-04-30T02:47:57.885750
2018-02-20T07:19:09
2018-02-20T07:19:09
121,507,289
0
0
null
null
null
null
UTF-8
Java
false
false
2,240
java
package pay.travel.testtask.controllers; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Modality; import javafx.stage.Stage; import pay.travel.testtask.interfaces.impls.NoteBook; import pay.travel.testtask.objects.Note; import java.io.IOException; public class MainController { private NoteBook noteBook = new NoteBook(); @FXML public Button btnFirstAddNote; @FXML public TableView tableNoteBook; @FXML public TableColumn<Note, String> columnDateCreation; @FXML public TableColumn<Note, String> columnNote; private Parent fxmlAdd; private FXMLLoader fxmlLoader = new FXMLLoader(); private AddNodeController addNodeController; private Stage addNoteStage; public void addNote(ActionEvent actionEvent) { if (addNoteStage == null) { addNodeController.setNoteBook(noteBook); addNoteStage = new Stage(); addNoteStage.setTitle("Add Node"); addNoteStage.setMinHeight(200); addNoteStage.setMinWidth(400); addNoteStage.setResizable(false); addNoteStage.setScene(new Scene(fxmlAdd)); addNoteStage.initModality(Modality.WINDOW_MODAL); addNoteStage.initOwner(((Node) actionEvent.getSource()).getScene().getWindow()); } addNoteStage.showAndWait(); } @FXML private void initialize() { this.columnNote.setCellValueFactory(new PropertyValueFactory<Note, String>("description")); this.columnDateCreation.setCellValueFactory(new PropertyValueFactory<Note, String>("creationDate")); tableNoteBook.setItems(noteBook.getNoteList()); try { fxmlLoader.setLocation(getClass().getResource("/fxml/addNote.fxml")); fxmlAdd = fxmlLoader.load(); addNodeController = fxmlLoader.getController(); } catch (IOException e) { e.printStackTrace(); } } }
1f5ce51ef9f2319b27b61754b46658b7882d8f5b
de9b24ab31943fd03c7a186398bd7355931117cd
/CSE564_HATEOAS_ASUAppealingClient/src/main/java/com/asu/appealing/representations/AppealRepresentation.java
b1ab88a167f5cac52a031722059d1cb14dc084e6
[]
no_license
rajeshsurana/HATEOAS-RESTful-Service
744aae38efed6ace6a3c5b3d14664328d6102eb7
10d205b7545c5c544c54f1b6c7452d8bb7540e04
refs/heads/master
2016-09-13T05:55:43.956111
2016-05-01T22:55:44
2016-05-01T22:55:49
57,853,752
0
0
null
null
null
null
UTF-8
Java
false
false
6,412
java
package com.asu.appealing.representations; import com.asu.appealing.activities.InvalidAppealException; import com.asu.appealing.activities.UriExchange; import com.asu.appealing.model.Appeal; import com.asu.appealing.model.AppealStatus; import java.io.ByteArrayInputStream; import java.io.StringWriter; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @XmlRootElement(name = "appeal", namespace = Representation.ASU_NAMESPACE) public class AppealRepresentation extends Representation { private static final Logger LOG = LoggerFactory.getLogger(AppealRepresentation.class); @XmlElement(name = "studentId", namespace = Representation.ASU_NAMESPACE) private int studentId; @XmlElement(name = "assignmentId", namespace = Representation.ASU_NAMESPACE) private int assignmentId; @XmlElement(name = "description", namespace = Representation.ASU_NAMESPACE) private String description; @XmlElement(name = "status", namespace = Representation.ASU_NAMESPACE) private AppealStatus status; /** * For JAXB :-( */ AppealRepresentation() { LOG.info("Executing AppealRepresentation constructor"); } public static AppealRepresentation fromXmlString(String xmlRepresentation) { LOG.info("Creating an Appeal object from the XML = {}", xmlRepresentation); AppealRepresentation appealRepresentation = null; try { JAXBContext context = JAXBContext.newInstance(AppealRepresentation.class); Unmarshaller unmarshaller = context.createUnmarshaller(); appealRepresentation = (AppealRepresentation) unmarshaller.unmarshal(new ByteArrayInputStream(xmlRepresentation.getBytes())); } catch (Exception e) { throw new InvalidAppealException(e); } LOG.debug("Generated the object {}", appealRepresentation); return appealRepresentation; } public static AppealRepresentation createResponseAppealRepresentation(Appeal appeal, AsuUri appealUri) { LOG.info("Creating a Response Appeal for appeal = {} and appeal URI", appeal.toString(), appealUri.toString()); AppealRepresentation appealRepresentation = null; if(appeal.getStatus() == AppealStatus.DRAFT) { LOG.debug("The appeal status is {}", AppealStatus.DRAFT); appealRepresentation = new AppealRepresentation(appeal, new Link(RELATIONS_URI + "cancel", appealUri), new Link(RELATIONS_URI + "update", appealUri), new Link(RELATIONS_URI + "submit", appealUri), new Link(Representation.SELF_REL_VALUE, appealUri)); } else if(appeal.getStatus() == AppealStatus.SUBMITTED) { LOG.debug("The appeal status is {}", AppealStatus.SUBMITTED); appealRepresentation = new AppealRepresentation(appeal, new Link(RELATIONS_URI + "followup", appealUri), new Link(Representation.SELF_REL_VALUE, appealUri)); } else if(appeal.getStatus() == AppealStatus.APPROVED) { LOG.debug("The appeal status is {}", AppealStatus.APPROVED); appealRepresentation = new AppealRepresentation(appeal, new Link(Representation.SELF_REL_VALUE, appealUri), new Link(RELATIONS_URI + "gradedItem", UriExchange.gradedItemForAppeal(appealUri))); } else if(appeal.getStatus() == AppealStatus.REJECTED) { LOG.debug("The appeal status is {}", AppealStatus.REJECTED); appealRepresentation = new AppealRepresentation(appeal, new Link(Representation.SELF_REL_VALUE, appealUri), new Link(RELATIONS_URI + "gradedItem", UriExchange.gradedItemForAppeal(appealUri))); } else { LOG.debug("The appeal status is in an unknown status"); throw new RuntimeException("Unknown Appeal Status"); } LOG.debug("The appeal representation created for the Create Response Appeal Representation is {}", appealRepresentation); return appealRepresentation; } public AppealRepresentation(Appeal appeal, Link... links) { LOG.info("Creating an Appeal Representation for appeal = {} and links = {}", appeal.toString(), links.toString()); try { this.studentId = appeal.getStudentId(); this.assignmentId = appeal.getAssignmentId(); this.description = appeal.getDescription(); this.status = appeal.getStatus(); this.links = java.util.Arrays.asList(links); } catch (Exception ex) { throw new InvalidAppealException(ex); } LOG.debug("Created the AppealRepresentation {}", this); } @Override public String toString() { try { JAXBContext context = JAXBContext.newInstance(AppealRepresentation.class); Marshaller marshaller = context.createMarshaller(); StringWriter stringWriter = new StringWriter(); marshaller.marshal(this, stringWriter); return stringWriter.toString(); } catch (Exception e) { throw new RuntimeException(e); } } public Appeal getAppeal() { if (studentId == 0 || assignmentId == 0 || description == null) { throw new InvalidAppealException(); } return new Appeal(studentId, assignmentId, description, status); } public Link getCancelLink() { return getLinkByName(RELATIONS_URI + "cancel"); } public Link getUpdateLink() { return getLinkByName(RELATIONS_URI + "update"); } public Link getSubmitLink() { return getLinkByName(RELATIONS_URI + "submit"); } public Link getFollowupLink() { return getLinkByName(RELATIONS_URI + "followup"); } public Link getGradedItemLink() { return getLinkByName(RELATIONS_URI + "gradedItem"); } public Link getSelfLink() { return getLinkByName("self"); } public AppealStatus getStatus() { return status; } }
349dd8771469dfc2da6744c735412573cc1fd6a4
f4ba4773b334a1075c23083f8e02ff0c092f275d
/src/OfficeHours/NestedIf_Practice.java
51512f27aee743b0220baf95e8eddd329cd46fde
[]
no_license
mekhpule/Spring2020B18
26a411818a53b4a05293e941769aa50bbb426d39
3f5da7b797649256d0dad27bf51f15827bac810a
refs/heads/master
2022-06-27T00:06:57.488921
2020-05-11T16:55:00
2020-05-11T16:55:00
262,423,815
0
0
null
null
null
null
UTF-8
Java
false
false
890
java
package OfficeHours; public class NestedIf_Practice { public static void main(String[] args) { byte weekDays = 8; boolean validNumber = weekDays > 0 && weekDays < 8; String result = ""; result = "Sunday"; if (validNumber) { if (weekDays == 1) { result = "Monday"; } else if (weekDays == 2) { result = "Tuesday"; } else if (weekDays == 3) { result = "Wednesday"; } else if (weekDays == 4) { result = "Thursday"; } else if (weekDays == 5) { result = "Friday"; } else if (weekDays == 6) { result = "Saturday"; } else if (weekDays == 7) { result = "Sunday"; } } else { result = "Invalid"; } } }
c6539c78e39f7763940c62bb50c1c8d38df32850
1e5b1ad3e1b651c3b7a2ef5a4a59241655aabe74
/domain-api/src/main/java/com/dmt/train/routing/RoutesParser.java
c860a8df6835f2b27136ffc054be8562eaf65a5c
[ "Apache-2.0" ]
permissive
diegomtassis/train-routing-problem
941c1ad9173453b84b46f3b5aa60d087835c56ae
d4f60498b984821a40014892b97d0afe40fdf929
refs/heads/master
2020-04-05T22:48:56.934908
2015-08-15T17:15:52
2015-08-15T17:15:52
40,770,085
0
0
null
null
null
null
UTF-8
Java
false
false
379
java
package com.dmt.train.routing; import java.io.InputStream; import java.util.Collection; /** * Parser for routes. * * @author diegomtassis * */ public interface RoutesParser extends DomainService { /** * Parses a file containing a graph of routes. * * @param inputStream * @return collections of routes */ Collection<Route> parse(InputStream inputStream); }
961be35ef1bb1bd1e1a37f712650fd176089eef1
0e8820e905bc4bc78d3b599243543669087f98f1
/src/main/java/com/bep/ProcessRunner.java
d5caf434ced3b43d97e1ee8eac9708b3409cd05d
[]
no_license
StephenFerrari14/slack-bolt-event-processor
00381345e294e4738c58bf5d1550a91fcbfd785b
ef1ff8032647393b2df625bc00d751c4e0198f8a
refs/heads/main
2022-12-29T13:22:56.345567
2020-10-13T02:10:55
2020-10-13T02:10:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,338
java
package com.bep; import com.slack.api.app_backend.events.payload.EventsApiPayload; import com.slack.api.bolt.context.builtin.EventContext; import com.slack.api.methods.SlackApiException; import com.slack.api.model.event.MessageEvent; import java.io.IOException; import java.util.ArrayList; import java.util.regex.Matcher; public class ProcessRunner implements Runnable { private ArrayList<EventProcess> _processes; private EventsApiPayload<MessageEvent> _payload; private EventContext _context; public ProcessRunner(ArrayList<EventProcess> processes, EventsApiPayload<MessageEvent> payload, EventContext context) { _processes = processes; _payload = payload; _context = context; } @Override public void run() { for (EventProcess process : _processes) { Matcher m = process.getPattern().matcher(_payload.getEvent().getText()); // Still kind of want to pass the matches results to the handler boolean matched = m.matches(); if (matched) { System.out.println("Regex matched"); try { process.runHandler(_payload, _context); } catch (IOException | SlackApiException e) { e.printStackTrace(); } } } } }
edbf22b5a6c36c9b567a5fd515bc5fc9b711b34f
d682f4383050ff7dfc0b45a17eb48d7e92791e75
/cli/admin/src/main/java/io/pravega/cli/admin/password/PasswordFileEntryParser.java
e926a90a7f342e32df358646a94b979b1749ff8c
[ "Apache-2.0" ]
permissive
pravega/pravega
be854c25c7345321055371e448970351a4cbaca9
e877b434909ed0f0eac496f288b0f5abfc0cd515
refs/heads/master
2023-09-02T02:02:37.243931
2023-09-01T04:54:04
2023-09-01T04:54:04
63,096,822
2,042
495
Apache-2.0
2023-09-14T21:46:00
2016-07-11T19:41:03
Java
UTF-8
Java
false
false
2,333
java
/** * Copyright Pravega Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.pravega.cli.admin.password; import lombok.NonNull; public class PasswordFileEntryParser { /** * Parses the specified credentials and ACL entry into an array containing a maximum of three elements. * * @param entry the credentials and ACL entry to be parsed * @return an array containing the parsed elements, typically a username, plaintext or hashed password and an ACL. */ public static String[] parse(@NonNull String entry) { return parse(entry, true); } /** * Parses the specified credentials and ACL entry into an array containing a maximum of three elements. * * @param entry the credentials and ACL entry to be parsed * @param validateHasThreeElements whether to validate that the entry has exactly three elements. If this flag is * true, and the entry does not contain three elements, this method will throw an * an IllegalArgumentException. * @return an array containing the parsed elements, typically a username, plaintext or hashed password and an ACL. */ public static String[] parse(@NonNull String entry, boolean validateHasThreeElements) { // A sample object value comprises of "userName:password:acl". We don't want the splits at the // access control entries (like "prn::/scope:testScope") in the ACL, so we restrict the splits to 3. String[] result = entry.split(":", 3); if (validateHasThreeElements && result.length != 3) { throw new IllegalArgumentException( "Entry does not contain exactly three elements of the form username:pwd:acl"); } return result; } }
496d3876fed950df9f067354033d58471667df95
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/transform/DescribeProvisioningParametersRequestMarshaller.java
5ac68abd08e55fe60232915955808f3cc9ea7764
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
4,272
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.servicecatalog.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.servicecatalog.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * DescribeProvisioningParametersRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class DescribeProvisioningParametersRequestMarshaller { private static final MarshallingInfo<String> ACCEPTLANGUAGE_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("AcceptLanguage").build(); private static final MarshallingInfo<String> PRODUCTID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("ProductId").build(); private static final MarshallingInfo<String> PRODUCTNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ProductName").build(); private static final MarshallingInfo<String> PROVISIONINGARTIFACTID_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ProvisioningArtifactId").build(); private static final MarshallingInfo<String> PROVISIONINGARTIFACTNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ProvisioningArtifactName").build(); private static final MarshallingInfo<String> PATHID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("PathId").build(); private static final MarshallingInfo<String> PATHNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("PathName").build(); private static final DescribeProvisioningParametersRequestMarshaller instance = new DescribeProvisioningParametersRequestMarshaller(); public static DescribeProvisioningParametersRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(DescribeProvisioningParametersRequest describeProvisioningParametersRequest, ProtocolMarshaller protocolMarshaller) { if (describeProvisioningParametersRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeProvisioningParametersRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING); protocolMarshaller.marshall(describeProvisioningParametersRequest.getProductId(), PRODUCTID_BINDING); protocolMarshaller.marshall(describeProvisioningParametersRequest.getProductName(), PRODUCTNAME_BINDING); protocolMarshaller.marshall(describeProvisioningParametersRequest.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING); protocolMarshaller.marshall(describeProvisioningParametersRequest.getProvisioningArtifactName(), PROVISIONINGARTIFACTNAME_BINDING); protocolMarshaller.marshall(describeProvisioningParametersRequest.getPathId(), PATHID_BINDING); protocolMarshaller.marshall(describeProvisioningParametersRequest.getPathName(), PATHNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
7c481591f07663787cf22eb420ae8bf3da170a62
795103e73e7c992294aaa01fb355045d25590bf9
/order-fulfillment-service/src/main/java/com/springbootplayground/order/fulfillment/service/order/OrderFulfillmentProcessor.java
9d56b8944f4cbab97bb453fe18880fafdf0abc1e
[]
no_license
ZanderAdam/SpringBootPlayground
ea648504dfc55d74e26aeb49bfdc7986b6d5627a
352044e1e8880356177269ebd1237a21c7716631
refs/heads/master
2023-02-05T14:46:36.840005
2020-12-28T23:19:16
2020-12-28T23:29:48
316,627,162
0
0
null
null
null
null
UTF-8
Java
false
false
1,763
java
package com.springbootplayground.order.fulfillment.service.order; import software.amazon.kinesis.exceptions.InvalidStateException; import software.amazon.kinesis.exceptions.ShutdownException; import software.amazon.kinesis.lifecycle.events.InitializationInput; import software.amazon.kinesis.lifecycle.events.LeaseLostInput; import software.amazon.kinesis.lifecycle.events.ProcessRecordsInput; import software.amazon.kinesis.lifecycle.events.ShardEndedInput; import software.amazon.kinesis.lifecycle.events.ShutdownRequestedInput; import software.amazon.kinesis.processor.ShardRecordProcessor; import java.nio.charset.StandardCharsets; public class OrderFulfillmentProcessor implements ShardRecordProcessor { @Override public void initialize(InitializationInput initializationInput) { } @Override public void processRecords(ProcessRecordsInput processRecordsInput) { System.out.println(" GOT DATA "); processRecordsInput.records() .forEach(record -> System.out.println( StandardCharsets.UTF_8.decode(record.data()).toString() )); } @Override public void leaseLost(LeaseLostInput leaseLostInput) { } @Override public void shardEnded(ShardEndedInput shardEndedInput) { try { shardEndedInput.checkpointer().checkpoint(); } catch (ShutdownException | InvalidStateException e) { // // Swallow the exception // e.printStackTrace(); } } @Override public void shutdownRequested(ShutdownRequestedInput shutdownRequestedInput) { try { shutdownRequestedInput.checkpointer().checkpoint(); } catch (ShutdownException | InvalidStateException e) { // // Swallow the exception // e.printStackTrace(); } } }
3319024a20b7d18387451dd988517aeeb626015a
1ac8c2601efaf741390eef1868de1e6470b8abd1
/springweb/src/main/java/app/TestEntity.java
e06074ca9f996cadb72028ccadb812aa25186390
[]
no_license
denismironchuk/springTemplate
c8b4ae97a09005495daee604a0c373067c9dd92b
1cfb9bb0a41e7d8199c298cfa5eadb8978349b44
refs/heads/master
2022-12-21T23:58:38.206004
2020-01-07T11:58:28
2020-01-07T11:58:28
232,314,318
0
0
null
2022-12-15T23:35:36
2020-01-07T11:54:25
Java
UTF-8
Java
false
false
832
java
package app; import javax.persistence.*; @Entity @Table(name = "test_table") public class TestEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Long id; @Column(name = "message") private String message; public TestEntity() { } public TestEntity(String message) { this.message = message; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } @Override public String toString() { return "TestEntity{" + "id=" + id + ", message='" + message + '\'' + '}'; } }
fb43da4c7c99a79dff204641d3e00ea0930f3aa8
6a95484a8989e92db07325c7acd77868cb0ac3bc
/modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201502/cm/BiddingErrors.java
323dd9b71a56beb03495488127aeceeaf89b6550
[ "Apache-2.0" ]
permissive
popovsh6/googleads-java-lib
776687dd86db0ce785b9d56555fe83571db9570a
d3cabb6fb0621c2920e3725a95622ea934117daf
refs/heads/master
2020-04-05T23:21:57.987610
2015-03-12T19:59:29
2015-03-12T19:59:29
33,672,406
1
0
null
2015-04-09T14:06:00
2015-04-09T14:06:00
null
UTF-8
Java
false
false
4,340
java
/** * BiddingErrors.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter. */ package com.google.api.ads.adwords.axis.v201502.cm; /** * Represents error codes for bidding strategy entities. */ public class BiddingErrors extends com.google.api.ads.adwords.axis.v201502.cm.ApiError implements java.io.Serializable { /* The error reason represented by an enum. */ private com.google.api.ads.adwords.axis.v201502.cm.BiddingErrorsReason reason; public BiddingErrors() { } public BiddingErrors( java.lang.String fieldPath, java.lang.String trigger, java.lang.String errorString, java.lang.String apiErrorType, com.google.api.ads.adwords.axis.v201502.cm.BiddingErrorsReason reason) { super( fieldPath, trigger, errorString, apiErrorType); this.reason = reason; } /** * Gets the reason value for this BiddingErrors. * * @return reason * The error reason represented by an enum. */ public com.google.api.ads.adwords.axis.v201502.cm.BiddingErrorsReason getReason() { return reason; } /** * Sets the reason value for this BiddingErrors. * * @param reason * The error reason represented by an enum. */ public void setReason(com.google.api.ads.adwords.axis.v201502.cm.BiddingErrorsReason reason) { this.reason = reason; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof BiddingErrors)) return false; BiddingErrors other = (BiddingErrors) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = super.equals(obj) && ((this.reason==null && other.getReason()==null) || (this.reason!=null && this.reason.equals(other.getReason()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = super.hashCode(); if (getReason() != null) { _hashCode += getReason().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(BiddingErrors.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201502", "BiddingErrors")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("reason"); elemField.setXmlName(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201502", "reason")); elemField.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201502", "BiddingErrors.Reason")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
8120432cb38e2e39aa44bdbfa4c63f96b4afd11d
a8854b24bb5e75296166ee5c2abde6de362235b8
/src/yaweb/Response.java
75f4d9fed2af084120c8378e153da66002b89693
[]
no_license
GyoungYY/YG-web
0aeb00824fe85307c74e5ca34b1d6259f9ed43a7
90143c7c64d76d770b9f346971c3e26b81e5118a
refs/heads/master
2021-05-29T19:25:23.254930
2015-07-30T14:08:05
2015-07-30T14:08:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
package yaweb; public interface Response { public static final int STATUS_200=200; public static final int STATUS_404=404; public static final int STATUS_503=503; public void setStatus(int status); public void addHeader(String key, String value); public void addBody(byte[] body); public void send(); }
205c2550826109598692c149ab3542781772f949
bdfb08279ada8df731c117d709697973a8ffc514
/src/main/java/rsubd/entity/EmployeeStage.java
f0cb45cd5f8c8ed767e848c2048cced3064c5da6
[]
no_license
potapovnik/rsubd_back
a3a79c49ae263bc827e4ae301cef1d6d33b3fd3a
57aac89f9faeff0d1523006c160219937d9ab1af
refs/heads/master
2023-01-27T19:18:53.421562
2020-12-12T10:22:51
2020-12-12T10:22:51
320,802,818
0
0
null
null
null
null
UTF-8
Java
false
false
167
java
package rsubd.entity; import lombok.Data; @Data public class EmployeeStage { private long id; private Integer employee_id; private Integer stage_id; }
22443881e567c3ec57f8d1a5821d98283199013c
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/energyexpertalgorithm-20230615/src/main/java/com/aliyun/energyexpertalgorithm20230615/models/QueryEnergyStorageStrategyResponse.java
94af1251fc5fc8f4ba6eb92df1bebec22f4679ac
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
1,495
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.energyexpertalgorithm20230615.models; import com.aliyun.tea.*; public class QueryEnergyStorageStrategyResponse extends TeaModel { @NameInMap("headers") @Validation(required = true) public java.util.Map<String, String> headers; @NameInMap("statusCode") @Validation(required = true) public Integer statusCode; @NameInMap("body") @Validation(required = true) public QueryEnergyStorageStrategyResponseBody body; public static QueryEnergyStorageStrategyResponse build(java.util.Map<String, ?> map) throws Exception { QueryEnergyStorageStrategyResponse self = new QueryEnergyStorageStrategyResponse(); return TeaModel.build(map, self); } public QueryEnergyStorageStrategyResponse setHeaders(java.util.Map<String, String> headers) { this.headers = headers; return this; } public java.util.Map<String, String> getHeaders() { return this.headers; } public QueryEnergyStorageStrategyResponse setStatusCode(Integer statusCode) { this.statusCode = statusCode; return this; } public Integer getStatusCode() { return this.statusCode; } public QueryEnergyStorageStrategyResponse setBody(QueryEnergyStorageStrategyResponseBody body) { this.body = body; return this; } public QueryEnergyStorageStrategyResponseBody getBody() { return this.body; } }
1d6faba8383996d8c57c911d17dbbacdb47355ef
bb27aa6ff04477529c9e902600df3d1c87597e09
/src/edu/uama/adsi/sgi/entidades/Producto.java
c4e19e9af90e2fcf147b223d7995d49e7eabff14
[]
no_license
victorcpkc/sgi-headless
3daab1a3004304ba174d6477978f5fbb6c762e6d
6b5c242837b4aa88b6dab76f36fbb69588aa28b3
refs/heads/master
2020-04-15T00:51:11.280780
2014-12-05T06:54:04
2014-12-05T06:54:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,704
java
package edu.uama.adsi.sgi.entidades; import java.io.Serializable; import java.util.Date; import java.util.List; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.DiscriminatorColumn; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * Clase entidad de productos. * Es la super clase que contiene un registro de la tabla producto; no se * permite crear instancias de esta clase, solo de las clases hijas. * Es una calse * @see Articulo * @see Libro * @see Curso * @see Taller * @see Software * @see Examen * @author Víctor M. Campuzano Pineda, e-mail: [email protected] */ @Entity @Table(name = "producto") @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name="discriminador_producto") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Producto.findAll", query = "SELECT p FROM Producto p"), @NamedQuery(name = "Producto.findByIdproducto", query = "SELECT p FROM Producto p WHERE p.idproducto = :idproducto"), @NamedQuery(name = "Producto.findByTituloProducto", query = "SELECT p FROM Producto p WHERE p.tituloProducto = :tituloProducto"), @NamedQuery(name = "Producto.findByFechaProducto", query = "SELECT p FROM Producto p WHERE p.fechaProducto = :fechaProducto"), @NamedQuery(name = "Producto.findByDetalleProducto", query = "SELECT p FROM Producto p WHERE p.detalleProducto = :detalleProducto")}) public abstract class Producto implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "idproducto") private Integer idproducto; @Basic(optional = false) @Column(name = "titulo_producto") private String tituloProducto; @Basic(optional = false) @Column(name = "fecha_producto") @Temporal(TemporalType.DATE) private Date fechaProducto; @Column(name = "detalle_producto") private Short detalleProducto; @Lob @Column(name = "notas_producto") private String notasProducto; @OneToMany(cascade = CascadeType.ALL, mappedBy = "productoComprobante") private List<Comprobante> comprobanteList; @JoinColumn(name = "tipo_producto_producto", referencedColumnName = "idtipo_producto") @ManyToOne(optional = false) private TipoProducto tipoProductoProducto; @JoinColumn(name = "profesor_producto", referencedColumnName = "idprofesor") @ManyToOne(optional = false) private Profesor profesorProducto; public Producto() { } public Producto(Integer idproducto) { this.idproducto = idproducto; } public Producto(Integer idproducto, String tituloProducto, Date fechaProducto) { this.idproducto = idproducto; this.tituloProducto = tituloProducto; this.fechaProducto = fechaProducto; } public Integer getIdproducto() { return idproducto; } public void setIdproducto(Integer idproducto) { this.idproducto = idproducto; } public String getTituloProducto() { return tituloProducto; } public void setTituloProducto(String tituloProducto) { this.tituloProducto = tituloProducto; } public Date getFechaProducto() { return fechaProducto; } public void setFechaProducto(Date fechaProducto) { this.fechaProducto = fechaProducto; } public Short getDetalleProducto() { return detalleProducto; } public void setDetalleProducto(Short detalleProducto) { this.detalleProducto = detalleProducto; } public String getNotasProducto() { return notasProducto; } public void setNotasProducto(String notasProducto) { this.notasProducto = notasProducto; } @XmlTransient public List<Comprobante> getComprobanteList() { return comprobanteList; } public void setComprobanteList(List<Comprobante> comprobanteList) { this.comprobanteList = comprobanteList; } public TipoProducto getTipoProductoProducto() { return tipoProductoProducto; } public void setTipoProductoProducto(TipoProducto tipoProductoProducto) { this.tipoProductoProducto = tipoProductoProducto; } public Profesor getProfesorProducto() { return profesorProducto; } public void setProfesorProducto(Profesor profesorProducto) { this.profesorProducto = profesorProducto; } @Override public int hashCode() { int hash = 0; hash += (idproducto != null ? idproducto.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof Producto)) { return false; } Producto other = (Producto) object; return (this.idproducto != null || other.idproducto == null) && (this.idproducto == null || this.idproducto.equals(other.idproducto)); } @Override public String toString() { return "edu.uama.adsi.sgi.entidades.Producto[ idproducto=" + idproducto + " ]"; } }
[ "MCT@Francisco" ]
MCT@Francisco
4e82ef218de5baa8317df6a8da83047828ba1de9
55c463c17a5557bba1010f1c84de4156c5400e67
/src/main/java/com/springstart/Audi.java
50ba77baf2d65503f1b2d9a7329c93967394cf8f
[]
no_license
YunusSarpdag/SpringGiris
db5e6909a7a97a6b4ce37d8050cb2a7ed800bb17
129c5c0a88fae58d630ca7e208a8ca205af8fb87
refs/heads/master
2023-04-30T00:07:24.906447
2021-04-28T22:51:32
2021-04-28T22:51:32
358,735,139
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package com.springstart; public class Audi { private Oil oil; private String name; private String type; public Audi(Oil oil) { this.oil = oil; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Audi(String name, String type) { this.name = name; this.type = type; } public void hareketeGec(){ oil.depo(); System.out.println(getName() + " Araba harekete geçti , type " + getType()); } }
de28bb435bbbafca541475286f77470204d8a755
710d610a32a878aa5399b02734bb9d70634e7455
/src/main/java/frc/robot/Subsystem/PIDsubsystems/DriveBasePID.java
b4135edd0f03e6141072a40629c411f87e47d23c
[]
no_license
sweesal/5839_RCCC2019_Command
8b715a26c15ef54f1e94f034835af3666f25baf5
929f3e42958933d03904433e1140bb122bd66398
refs/heads/master
2021-06-15T10:16:30.212931
2021-05-21T12:03:50
2021-05-21T12:03:50
199,261,518
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package frc.robot.Subsystem.PIDsubsystems; import edu.wpi.first.wpilibj.command.PIDSubsystem; public class DriveBasePID extends PIDSubsystem { /** * Add your docs here. */ public DriveBasePID() { // Intert a subsystem name and PID values here super("DriveBasePID", 0, 0, 0); } @Override public void initDefaultCommand() { } @Override protected double returnPIDInput() { return 0.0; } @Override protected void usePIDOutput(double output) { } }
715bf6be8ed41fdac09a043bdc350a57e4a5de6c
9767214aa720f8d56b62cf8af658b5316b5c221f
/src/Stemmer.java
4aac45b72502ff27fc87996b54989eeeca9e316d
[]
no_license
Shreya46/SearchEngine
1003786f87383e750e0f2a6d0d420452e96f5270
afffdd68133115e3cc8c5ecc263435cdb3404136
refs/heads/master
2022-09-05T20:11:34.037473
2020-05-28T19:01:36
2020-05-28T19:01:36
228,156,994
0
0
null
null
null
null
UTF-8
Java
false
false
8,359
java
public class Stemmer { private char[] b; private int i, /* offset into b */ i_end, /* offset to end of stemmed word */ j, k; private static final int INC = 50; /* unit of size whereby b is increased */ public Stemmer() { b = new char[INC]; i = 0; i_end = 0; } public void add(char ch) { if (i == b.length) { char[] new_b = new char[i + INC]; for (int c = 0; c < i; c++) new_b[c] = b[c]; b = new_b; } b[i++] = ch; } public void add(char[] w, int wLen) { if (i + wLen >= b.length) { char[] new_b = new char[i + wLen + INC]; for (int c = 0; c < i; c++) new_b[c] = b[c]; b = new_b; } for (int c = 0; c < wLen; c++) b[i++] = w[c]; } public String toString() {return new String(b, 0, i_end);} public int getResultLength() {return i_end;} public char[] getResultBuffer() {return b;} private final boolean cons(int i) { switch (b[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': return false; case 'y': return (i == 0) ? true : !cons(i - 1); default: return true; } } /* m() measures the number of consonant sequences between 0 and j. if c is a consonant sequence and v a vowel sequence, and <..> indicates arbitrary presence, <c><v> gives 0 <c>vc<v> gives 1 <c>vcvc<v> gives 2 <c>vcvcvc<v> gives 3 .... */ private final int m() { int n = 0; int i = 0; while (true) { if (i > j) return n; if (!cons(i)) break; i++; } i++; while (true) { while (true) { if (i > j) return n; if (cons(i)) break; i++; } i++; n++; while (true) { if (i > j) return n; if (!cons(i)) break; i++; } i++; } } private final boolean vowelinstem() { int i; for (i = 0; i <= j; i++) if (!cons(i)) return true; return false; } private final boolean doublec(int j) { if (j < 1) return false; if (b[j] != b[j - 1]) return false; return cons(j); } /* cvc(i) is true <=> i-2,i-1,i has the form consonant - vowel - consonant and also if the second c is not w,x or y. this is used when trying to restore an e at the end of a short word. e.g. cav(e), lov(e), hop(e), crim(e), but snow, box, tray. */ private final boolean cvc(int i) { if (i < 2 || !cons(i) || cons(i - 1) || !cons(i - 2)) return false; { int ch = b[i]; if (ch == 'w' || ch == 'x' || ch == 'y') return false; } return true; } private final boolean ends(String s) { int l = s.length(); int o = k - l + 1; if (o < 0) return false; for (int i = 0; i < l; i++) if (b[o + i] != s.charAt(i)) return false; j = k - l; return true; } private final void setto(String s) { int l = s.length(); int o = j + 1; for (int i = 0; i < l; i++) b[o + i] = s.charAt(i); k = j + l; } private final void r(String s) {if (m() > 0) setto(s);} /* step1() gets rid of plurals and -ed or -ing. e.g. caresses -> caress ponies -> poni ties -> ti caress -> caress cats -> cat feed -> feed agreed -> agree disabled -> disable matting -> mat mating -> mate meeting -> meet milling -> mill messing -> mess meetings -> meet */ private final void step1() { if (b[k] == 's') { if (ends("sses")) k -= 2; else if (ends("ies")) setto("i"); else if (b[k - 1] != 's') k--; } if (ends("eed")) {if (m() > 0) k--;} else if ((ends("ed") || ends("ing")) && vowelinstem()) { k = j; if (ends("at")) setto("ate"); else if (ends("bl")) setto("ble"); else if (ends("iz")) setto("ize"); else if (doublec(k)) { k--; { int ch = b[k]; if (ch == 'l' || ch == 's' || ch == 'z') k++; } } else if (m() == 1 && cvc(k)) setto("e"); } } /* step2() turns terminal y to i when there is another vowel in the stem. */ private final void step2() {if (ends("y") && vowelinstem()) b[k] = 'i';} /* step3() maps double suffices to single ones. so -ization ( = -ize plus -ation) maps to -ize etc. note that the string before the suffix must give m() > 0. */ private final void step3() { if (k == 0) return; /* For Bug 1 */ switch (b[k - 1]) { case 'a': if (ends("ational")) { r("ate"); break; } if (ends("tional")) { r("tion"); break; } break; case 'c': if (ends("enci")) { r("ence"); break; } if (ends("anci")) { r("ance"); break; } break; case 'e': if (ends("izer")) { r("ize"); break; } break; case 'l': if (ends("bli")) { r("ble"); break; } if (ends("alli")) { r("al"); break; } if (ends("entli")) { r("ent"); break; } if (ends("eli")) { r("e"); break; } if (ends("ousli")) { r("ous"); break; } break; case 'o': if (ends("ization")) { r("ize"); break; } if (ends("ation")) { r("ate"); break; } if (ends("ator")) { r("ate"); break; } break; case 's': if (ends("alism")) { r("al"); break; } if (ends("iveness")) { r("ive"); break; } if (ends("fulness")) { r("ful"); break; } if (ends("ousness")) { r("ous"); break; } break; case 't': if (ends("aliti")) { r("al"); break; } if (ends("iviti")) { r("ive"); break; } if (ends("biliti")) { r("ble"); break; } break; case 'g': if (ends("logi")) { r("log"); break; } } } /* step4() deals with -ic-, -full, -ness etc. similar strategy to step3. */ private final void step4() { switch (b[k]) { case 'e': if (ends("icate")) { r("ic"); break; } if (ends("ative")) { r(""); break; } if (ends("alize")) { r("al"); break; } break; case 'i': if (ends("iciti")) { r("ic"); break; } break; case 'l': if (ends("ical")) { r("ic"); break; } if (ends("ful")) { r(""); break; } break; case 's': if (ends("ness")) { r(""); break; } break; } } /* step5() takes off -ant, -ence etc., in context <c>vcvc<v>. */ private final void step5() { if (k == 0) return; /* for Bug 1 */ switch (b[k - 1]) { case 'a': if (ends("al")) break; return; case 'c': if (ends("ance")) break; if (ends("ence")) break; return; case 'e': if (ends("er")) break; return; case 'i': if (ends("ic")) break; return; case 'l': if (ends("able")) break; if (ends("ible")) break; return; case 'n': if (ends("ant")) break; if (ends("ement")) break; if (ends("ment")) break; /* element etc. not stripped before the m */ if (ends("ent")) break; return; case 'o': if (ends("ion") && j >= 0 && (b[j] == 's' || b[j] == 't')) break; /* j >= 0 fixes Bug 2 */ if (ends("ou")) break; return; /* takes care of -ous */ case 's': if (ends("ism")) break; return; case 't': if (ends("ate")) break; if (ends("iti")) break; return; case 'u': if (ends("ous")) break; return; case 'v': if (ends("ive")) break; return; case 'z': if (ends("ize")) break; return; default: return; } if (m() > 1) k = j; } /* step6() removes a final -e if m() > 1. */ private final void step6() { j = k; if (b[k] == 'e') { int a = m(); if (a > 1 || a == 1 && !cvc(k - 1)) k--; } if (b[k] == 'l' && doublec(k) && m() > 1) k--; } public void stem() { k = i - 1; if (k > 1) { step1(); step2(); step3(); step4(); step5(); step6(); } i_end = k + 1; i = 0; } public static String getStem(String ip) { char[] w = new char[501]; Stemmer s = new Stemmer(); w = ip.toCharArray(); for (int c = 0; c < ip.length(); c++) s.add(w[c]); s.stem(); String u; return s.toString(); } }
6c74ba527728d67a14330f8f0738997e3cc32c65
76cd9c5a65bcc30dfb913e149a76bec870952e91
/src/org/itver/evalpro/dao/CarreraDAO.java
186c47c5aa37951b1c1aacc883bf854f808a71c5
[]
no_license
GPS-A-D-2105/API-PERSISTENCIA
fe16df84af6deb3cc24c7f3118dcf6b1589798a2
7a941becbb0b5ee142d3c48fd397b605d4632e7b
refs/heads/master
2021-01-10T17:33:21.427307
2015-12-08T07:23:58
2015-12-08T07:23:58
44,888,139
0
1
null
null
null
null
UTF-8
Java
false
false
891
java
/* * Copyright (C) 2015 vrebo * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.itver.evalpro.dao; import org.itver.evalpro.dto.Carrera; /** * * @author vrebo */ public interface CarreraDAO extends DataAccessObject<Carrera, Integer>{ }
[ "vrebo@vrebo-PC" ]
vrebo@vrebo-PC
10be5ea1fcddad1c54428b41267102dc6dd3258f
55ead599f3e5ccbd1d6110a9162ad8e05aa2a155
/Lavasa/src/com/ma/activities/ReviewData.java
26e04275d24a4b6c7d033c9a1a3ab757365bc734
[]
no_license
PawanRajpal/TestAndroid
0f8d4f7228d4fb233d1eccb31abe5abf09c5c5f0
2a9808bb817e074292a353cd8e28791f410143fe
refs/heads/master
2016-09-06T07:22:06.209361
2014-07-08T09:44:10
2014-07-08T09:44:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package com.ma.activities; public interface ReviewData { public void saveReviewData(String title, String desc, float rating); }
963bb0002a7837e19d3874fab0f12e38b4ac7db7
784017131b5eadffd3bec254f9304225e648d3a3
/app/src/main/java/android/support/p001v4/view/LayoutInflaterCompat.java
f9f7995c900b99c70c4c152f0ecbb186465f58d6
[]
no_license
Nienter/kdshif
e6126b3316f4b6e15a7dc6a67253f5729515fb4c
4d65454bb331e4439ed948891aa0173655d66934
refs/heads/master
2022-12-03T19:57:04.981078
2020-08-06T11:28:14
2020-08-06T11:28:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,747
java
package android.support.p001v4.view; import android.os.Build; import android.view.LayoutInflater; /* renamed from: android.support.v4.view.LayoutInflaterCompat */ public final class LayoutInflaterCompat { static final LayoutInflaterCompatImpl IMPL; /* renamed from: android.support.v4.view.LayoutInflaterCompat$LayoutInflaterCompatImpl */ interface LayoutInflaterCompatImpl { LayoutInflaterFactory getFactory(LayoutInflater layoutInflater); void setFactory(LayoutInflater layoutInflater, LayoutInflaterFactory layoutInflaterFactory); } /* renamed from: android.support.v4.view.LayoutInflaterCompat$LayoutInflaterCompatImplBase */ static class LayoutInflaterCompatImplBase implements LayoutInflaterCompatImpl { LayoutInflaterCompatImplBase() { } public void setFactory(LayoutInflater layoutInflater, LayoutInflaterFactory layoutInflaterFactory) { LayoutInflaterCompatBase.setFactory(layoutInflater, layoutInflaterFactory); } public LayoutInflaterFactory getFactory(LayoutInflater layoutInflater) { return LayoutInflaterCompatBase.getFactory(layoutInflater); } } /* renamed from: android.support.v4.view.LayoutInflaterCompat$LayoutInflaterCompatImplV11 */ static class LayoutInflaterCompatImplV11 extends LayoutInflaterCompatImplBase { LayoutInflaterCompatImplV11() { } public void setFactory(LayoutInflater layoutInflater, LayoutInflaterFactory layoutInflaterFactory) { LayoutInflaterCompatHC.setFactory(layoutInflater, layoutInflaterFactory); } } /* renamed from: android.support.v4.view.LayoutInflaterCompat$LayoutInflaterCompatImplV21 */ static class LayoutInflaterCompatImplV21 extends LayoutInflaterCompatImplV11 { LayoutInflaterCompatImplV21() { } public void setFactory(LayoutInflater layoutInflater, LayoutInflaterFactory layoutInflaterFactory) { LayoutInflaterCompatLollipop.setFactory(layoutInflater, layoutInflaterFactory); } } static { int i = Build.VERSION.SDK_INT; if (i >= 21) { IMPL = new LayoutInflaterCompatImplV21(); } else if (i >= 11) { IMPL = new LayoutInflaterCompatImplV11(); } else { IMPL = new LayoutInflaterCompatImplBase(); } } private LayoutInflaterCompat() { } public static void setFactory(LayoutInflater layoutInflater, LayoutInflaterFactory layoutInflaterFactory) { IMPL.setFactory(layoutInflater, layoutInflaterFactory); } public static LayoutInflaterFactory getFactory(LayoutInflater layoutInflater) { return IMPL.getFactory(layoutInflater); } }
089aa5fab16513a3b6e931e3571cbdc1844c1d5d
5e5e09aec0cd7dd38ca008a221693bab6752963c
/src/main/java/com/cfl/service/BookTypeService.java
1db596d698d90b2cc5ad6ee71223282aa56fe85d
[]
no_license
NDCFL/book
d27c4922017864187c8bc56e418d73ef89cf4a32
4340069000ba3172afd27a9223f9d6b28d04b0c2
refs/heads/master
2021-01-25T13:24:00.577368
2018-03-09T06:15:11
2018-03-09T06:15:11
123,564,512
0
0
null
null
null
null
UTF-8
Java
false
false
213
java
package com.cfl.service; import com.cfl.vo.BookTypeVo; import com.cfl.vo.Select2Vo; import java.util.List; public interface BookTypeService extends BaseService<BookTypeVo>{ List<Select2Vo> getBookType(); }
29e0e2ed775a78e8b7078e940975b6aa84c950c0
da1a7422ffe3505c7de9fdf2a4faff5e32580ca4
/app/src/main/java/com/zmy/diamond/MainActivity.java
3666668c41f175ea1dfdb897e06862397af83958
[]
no_license
zmyqucai8/diamond
a43d5ad2cbc1d88dcffefe94983c253655ba63fc
48027aebc686a82ada02486d12e6117a607dec29
refs/heads/master
2020-03-29T21:36:20.910224
2018-09-26T06:34:01
2018-09-26T06:34:01
150,376,424
1
0
null
null
null
null
UTF-8
Java
false
false
6,320
java
package com.zmy.diamond; import android.content.Context; import android.content.Intent; import android.os.Handler; import android.support.v4.app.Fragment; import android.view.View; import com.blankj.utilcode.util.ActivityUtils; import com.blankj.utilcode.util.ToastUtils; import com.flyco.tablayout.CommonTabLayout; import com.flyco.tablayout.listener.CustomTabEntity; import com.flyco.tablayout.listener.OnTabSelectListener; import com.zmy.diamond.base.BaseApp; import com.zmy.diamond.base.MyBaseActivity; import com.zmy.diamond.fragment.HomeFragment; import com.zmy.diamond.fragment.MarketingFragment; import com.zmy.diamond.fragment.MeFragment; import com.zmy.diamond.fragment.TradingFragment; import com.zmy.diamond.utli.ApiUtlis; import com.zmy.diamond.utli.AppConstant; import com.zmy.diamond.utli.MyUtlis; import com.zmy.diamond.utli.UpdateAppUtlis; import java.util.ArrayList; import butterknife.BindView; /** * 主界面 */ public class MainActivity extends MyBaseActivity implements OnTabSelectListener { private String[] mTitles = {"首页", "营销", "交易", "我的"}; private int[] mIconUnselectIds = { R.mipmap.tab_home_unselect, R.mipmap.tab_yx_unselect, R.mipmap.tab_jy_unselect, R.mipmap.tab_contact_unselect}; private int[] mIconSelectIds = { R.mipmap.tab_home_select, R.mipmap.tab_yx_select, R.mipmap.tab_jy_select, R.mipmap.tab_contact_select}; private ArrayList<CustomTabEntity> mTabEntities = new ArrayList<>(); ArrayList<Fragment> fragments; MeFragment meFragment; // InfoFragment infoFragment; @BindView(R.id.tablayout) CommonTabLayout tablayout; @BindView(R.id.view_bg) public View view_bg; private void initTab() { HomeFragment homeFragment; homeFragment = new HomeFragment(); MarketingFragment marketingFragment = new MarketingFragment(); TradingFragment tradingFragment = new TradingFragment(); // infoFragment = new InfoFragment(); meFragment = new MeFragment(); fragments = new ArrayList<>(); fragments.add(homeFragment); fragments.add(marketingFragment); fragments.add(tradingFragment); // fragments.add(infoFragment); fragments.add(meFragment); for (int i = 0; i < mTitles.length; i++) { mTabEntities.add(new TabEntity(mTitles[i], mIconSelectIds[i], mIconUnselectIds[i])); } tablayout.setTabData(mTabEntities, this, R.id.framelayout, fragments); // tablayout.showMsg(0, 99); tablayout.showDot(1); tablayout.setOnTabSelectListener(this); } @Override public void initUI() { setContentView(R.layout.activity_main); super.initUI(); initTab(); if (AppConstant.LOG) new Handler().postDelayed(new Runnable() { @Override public void run() { ToastUtils.showShort("登录成功 userId=" + MyUtlis.getLoginUserId()); } }, 200); } @Override public void initData() { ApiUtlis.getSystemTime(this, MyUtlis.getToken()); UpdateAppUtlis.checkAppUpdate(this); if (AppConstant.isExperienceMode) { BaseApp.getInstance().startUseTiming(); } } @Override public void addListeners() { //Test start // TestUtlis.test(); if (AppConstant.DEBUG) { // ApiUtlis.getMapKey(this, MyUtlis.getToken(), AppConstant.MAP_KEY_TYPE_GAODE); // ApiUtlis.getMapKey(this, MyUtlis.getToken(), AppConstant.MAP_KEY_TYPE_BAIDU); } } @Override protected void onDestroy() { super.onDestroy(); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); } @Override protected void onStart() { super.onStart(); } @Override protected void onStop() { super.onStop(); } public static void start(Context context) { Intent intent = new Intent(context, MainActivity.class); ActivityUtils.startActivity(intent, R.anim.a5, R.anim.a3); } @Override public void onBackPressed() { // super.onBackPressed(); int currentTab = tablayout.getCurrentTab(); if (currentTab == 0) { //首页并且菜单显示的话,按返回键,先隐藏菜单,不显示的话,直接返回桌面 HomeFragment homeFragment = (HomeFragment) fragments.get(0); if (homeFragment.isShowPlatformMenu) { homeFragment.hidePlatformMenu(true); return; } } else if (currentTab == 1) { MarketingFragment marketingFragment = (MarketingFragment) fragments.get(1); if (marketingFragment.mAdapter.isShowMore && null != marketingFragment.mAdapter.moreView) { marketingFragment.mAdapter.moreView.dismiss(); return; } } else if (currentTab == 2) { //交易页面 并且more显示的话,按返回键,先隐藏more,不显示的话,直接返回桌面 TradingFragment tradingFragment = (TradingFragment) fragments.get(2); if (tradingFragment.isShowMore && null != tradingFragment.moreView) { tradingFragment.moreView.dismiss(); return; } } ActivityUtils.startHomeActivity(); } @Override public void onTabSelect(int position) { //tab切换, 如果是我的页面判断后更新签到状态 if (position == fragments.size() - 1 && null != meFragment) { meFragment.updateSignState(); } //更新状态栏 // if (position == 3) { //咨询页面不要状态栏 // mImmersionBar.transparentStatusBar().removeSupportAllView().init(); // statusBarView.setVisibility(View.GONE); // } else { // mImmersionBar.statusBarView(findViewById(R.id.statusBarView)).init(); // statusBarView.setVisibility(View.VISIBLE); // statusBarView.setBackgroundResource(R.color.color_logo); // } // KeyboardUtils.hideSoftInput(this); } @Override public void onTabReselect(int position) { } }
cc5332224a2852462652a1dcd530f2f240b73bc7
311f1237e7498e7d1d195af5f4bcd49165afa63a
/sourcedata/camel-camel-1.6.0/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java
bd17101e3505e1ffc7265dbc142e9e5544dbd896
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unknown" ]
permissive
DXYyang/SDP
86ee0e9fb7032a0638b8bd825bcf7585bccc8021
6ad0daf242d4062888ceca6d4a1bd4c41fd99b63
refs/heads/master
2023-01-11T02:29:36.328694
2019-11-02T09:38:34
2019-11-02T09:38:34
219,128,146
10
1
Apache-2.0
2023-01-02T21:53:42
2019-11-02T08:54:26
Java
UTF-8
Java
false
false
4,807
java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.spring; import org.apache.camel.Endpoint; import org.apache.camel.EndpointInject; import org.apache.camel.PollingConsumer; import org.apache.camel.Producer; import org.apache.camel.ProducerTemplate; /** * @version $Revision$ */ public class InjectedBean { @EndpointInject(uri = "direct:fieldInjectedEndpoint") private Endpoint fieldInjectedEndpoint; private Endpoint propertyInjectedEndpoint; @EndpointInject(uri = "direct:fieldInjectedProducer") private Producer fieldInjectedProducer; private Producer propertyInjectedProducer; @EndpointInject(uri = "direct:fieldInjectedCamelTemplate") private ProducerTemplate fieldInjectedCamelTemplate; private ProducerTemplate propertyInjectedCamelTemplate; @EndpointInject private ProducerTemplate injectByFieldName; private ProducerTemplate injectByPropertyName; @EndpointInject(uri = "direct:fieldInjectedEndpoint") private PollingConsumer fieldInjectedPollingConsumer; private PollingConsumer propertyInjectedPollingConsumer; // Endpoint //----------------------------------------------------------------------- public Endpoint getFieldInjectedEndpoint() { return fieldInjectedEndpoint; } public Endpoint getPropertyInjectedEndpoint() { return propertyInjectedEndpoint; } @EndpointInject(name = "namedEndpoint1") public void setPropertyInjectedEndpoint(Endpoint propertyInjectedEndpoint) { this.propertyInjectedEndpoint = propertyInjectedEndpoint; } // Producer //----------------------------------------------------------------------- public Producer getFieldInjectedProducer() { return fieldInjectedProducer; } public Producer getPropertyInjectedProducer() { return propertyInjectedProducer; } @EndpointInject(uri = "direct:propertyInjectedProducer") public void setPropertyInjectedProducer(Producer propertyInjectedProducer) { this.propertyInjectedProducer = propertyInjectedProducer; } // CamelTemplate //----------------------------------------------------------------------- public ProducerTemplate getFieldInjectedCamelTemplate() { return fieldInjectedCamelTemplate; } public ProducerTemplate getPropertyInjectedCamelTemplate() { return propertyInjectedCamelTemplate; } @EndpointInject(uri = "direct:propertyInjectedCamelTemplate") public void setPropertyInjectedCamelTemplate(ProducerTemplate propertyInjectedCamelTemplate) { this.propertyInjectedCamelTemplate = propertyInjectedCamelTemplate; } // ProducerTemplate //------------------------------------------------------------------------- public ProducerTemplate getInjectByFieldName() { return injectByFieldName; } public void setInjectByFieldName(ProducerTemplate injectByFieldName) { this.injectByFieldName = injectByFieldName; } public ProducerTemplate getInjectByPropertyName() { return injectByPropertyName; } @EndpointInject public void setInjectByPropertyName(ProducerTemplate injectByPropertyName) { this.injectByPropertyName = injectByPropertyName; } // PollingConsumer //------------------------------------------------------------------------- public PollingConsumer getFieldInjectedPollingConsumer() { return fieldInjectedPollingConsumer; } public void setFieldInjectedPollingConsumer(PollingConsumer fieldInjectedPollingConsumer) { this.fieldInjectedPollingConsumer = fieldInjectedPollingConsumer; } public PollingConsumer getPropertyInjectedPollingConsumer() { return propertyInjectedPollingConsumer; } @EndpointInject(uri = "direct:propertyInjectedPollingConsumer") public void setPropertyInjectedPollingConsumer(PollingConsumer propertyInjectedPollingConsumer) { this.propertyInjectedPollingConsumer = propertyInjectedPollingConsumer; } }
6399b1f63c3963c711660861beb19f65b009dfde
0f07cda603087468e85281844fc8e2b2d3ff6ff6
/main/java/com/example/login_application/MainActivity.java
30ca64cbc0fdb99f99656c18c8f41d7bce77c036
[]
no_license
SabrinaHoiya/simple_login_interface-
34e72f49ec4659097a525e80145432ff1cef5cc6
76bf803caf174498ed6fad03a69a9b3275a41ee1
refs/heads/main
2023-04-04T02:45:09.578658
2021-04-06T21:08:01
2021-04-06T21:08:01
355,321,792
1
0
null
null
null
null
UTF-8
Java
false
false
3,924
java
package com.example.login_application; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.util.Patterns; import com.google.android.material.textfield.TextInputLayout; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import android.widget.EditText; import android.os.Bundle; public class MainActivity extends AppCompatActivity { EditText name, email, phone, password; Button register; TextView login; boolean isNameValid, isEmailValid, isPhoneValid, isPasswordValid; TextInputLayout nameError, emailError, phoneError, passError; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name = (EditText) findViewById(R.id.name); email = (EditText) findViewById(R.id.email); phone = (EditText) findViewById(R.id.phone); password = (EditText) findViewById(R.id.password); login = (TextView) findViewById(R.id.login); register = (Button) findViewById(R.id.register); nameError = (TextInputLayout) findViewById(R.id.nameError); emailError = (TextInputLayout) findViewById(R.id.emailError); phoneError = (TextInputLayout) findViewById(R.id.phoneError); passError = (TextInputLayout) findViewById(R.id.passError); register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SetValidation(); } }); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // redirect to LoginActivity Intent intent = new Intent(getApplicationContext(), activity_login.class); startActivity(intent); } }); } public void SetValidation() { // Check for a valid name. if (name.getText().toString().isEmpty()) { nameError.setError(getResources().getString(R.string.name_error)); isNameValid = false; } else { isNameValid = true; nameError.setErrorEnabled(false); } // Check for a valid email address. if (email.getText().toString().isEmpty()) { emailError.setError(getResources().getString(R.string.email_error)); isEmailValid = false; } else if (!Patterns.EMAIL_ADDRESS.matcher(email.getText().toString()).matches()) { emailError.setError(getResources().getString(R.string.error_invalid_email)); isEmailValid = false; } else { isEmailValid = true; emailError.setErrorEnabled(false); } // Check for a valid phone number. if (phone.getText().toString().isEmpty()) { phoneError.setError(getResources().getString(R.string.phone_error)); isPhoneValid = false; } else { isPhoneValid = true; phoneError.setErrorEnabled(false); } // Check for a valid password. if (password.getText().toString().isEmpty()) { passError.setError(getResources().getString(R.string.password_error)); isPasswordValid = false; } else if (password.getText().length() < 6) { passError.setError(getResources().getString(R.string.error_invalid_password)); isPasswordValid = false; } else { isPasswordValid = true; passError.setErrorEnabled(false); } if (isNameValid && isEmailValid && isPhoneValid && isPasswordValid) { Toast.makeText(getApplicationContext(), "Successfully", Toast.LENGTH_SHORT).show(); } } }
e79d6ea6462e8324b92f848c2e0a44ca0e8292ba
f3f16c4216203384dc152198a8a15a22ee500972
/app/src/main/java/com/example/john/simulatesms/adapter/ConversationAdapter.java
c770426faa8eb33d1f06d1591468347c1acbaa1a
[ "Apache-2.0" ]
permissive
lupingli/SimulateSMS
830c66be11481beff6126ea534caff9e3f42230c
2f435813a1bf66b119e51bbf64eb55eaee59a185
refs/heads/master
2021-06-13T20:16:22.054031
2017-04-16T06:05:47
2017-04-16T06:05:47
74,212,436
1
0
null
null
null
null
UTF-8
Java
false
false
5,940
java
package com.example.john.simulatesms.adapter; import android.content.Context; import android.database.Cursor; import android.graphics.Color; import android.support.v4.widget.CursorAdapter; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.style.ForegroundColorSpan; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; import com.example.john.simulatesms.R; import com.example.john.simulatesms.entity.Conversation; import com.example.john.simulatesms.util.StringUtil; import java.util.ArrayList; import java.util.List; /** * Created by John on 2016/11/23. * 数据库发生变化,该adapter所绑定的视图也会立即发生变化 * 控制数据显示 */ public class ConversationAdapter extends CursorAdapter { /** * 是否显示选择菜单 */ private boolean isShowSelected; /** * 记录选中的会话 */ private List<String> selectedConversation = new ArrayList<>(); private MyViewHolder myViewHolder; public boolean isShowSelected() { return isShowSelected; } public void setShowSelected(boolean showSelected) { isShowSelected = showSelected; } public ConversationAdapter(Context context, Cursor c, int flags) { super(context, c, flags); } /** * listView的条目视图 * * @param context * @param cursor * @param parent * @return */ @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View view = View.inflate(context, R.layout.layout_item_conversation, null); return view; } /** * listView中条目所显示的类容 * * @param view * @param context * @param cursor */ @Override public void bindView(View view, Context context, Cursor cursor) { myViewHolder = getViewHolder(view); final Conversation conversation = Conversation.createFromCursor(cursor); SpannableStringBuilder ssb = new SpannableStringBuilder(); String numberStr = conversation.getName() != null ? conversation.getName() : conversation.getAddress(); String countStr = conversation.getMsg_count(); if (numberStr != null && countStr != null) { SpannableString ss = new SpannableString(countStr); ss.setSpan(new ForegroundColorSpan(Color.GREEN), 0, countStr.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ssb.append(numberStr).append("(").append(ss).append(")"); myViewHolder.tvPhoneNumber.setText(ssb); } myViewHolder.tvNewMsg.setText(conversation.getSnippet()); myViewHolder.tvDate.setText(conversation.getDate()); myViewHolder.ivAvatar.setImageBitmap(conversation.getAvatar()); if (isShowSelected) { myViewHolder.cb.setVisibility(View.VISIBLE); if (selectedConversation.contains(conversation.getThread_id())) { myViewHolder.cb.setChecked(true); } else { myViewHolder.cb.setChecked(false); } } else { myViewHolder.cb.setVisibility(View.GONE); } } /** * 得到viewHolder * * @param view * @return */ private MyViewHolder getViewHolder(View view) { MyViewHolder myViewHolder = (MyViewHolder) view.getTag(); if (myViewHolder == null) { myViewHolder = new MyViewHolder(view); view.setTag(myViewHolder); } return myViewHolder; } /** * 管理视图中控件 */ class MyViewHolder { private ImageView ivAvatar; private TextView tvDate; private TextView tvPhoneNumber; private TextView tvNewMsg; private CheckBox cb; public MyViewHolder(View view) { ivAvatar = (ImageView) view.findViewById(R.id.iv_avatar); tvDate = (TextView) view.findViewById(R.id.tv_date); tvNewMsg = (TextView) view.findViewById(R.id.tv_new_msg); tvPhoneNumber = (TextView) view.findViewById(R.id.tv_phone_number); cb = (CheckBox) view.findViewById(R.id.cb); } } /** * 用集合去记录选择的条目 * * @param position */ public void getSingleConversation(int position) { Cursor cursor = (Cursor) getItem(position); Conversation conversation = Conversation.createFromCursor(cursor); String thread_id = conversation.getThread_id(); if (selectedConversation.contains(thread_id)) { selectedConversation.remove(thread_id); } else { selectedConversation.add(thread_id); } notifyDataSetChanged(); } /** * 得到条目 * * @param pos * @return */ public Conversation getConversation(int pos) { return Conversation.createFromCursor((Cursor) getItem(pos)); } /** * 选择所有的条目 */ public void selectedAllConversation() { Cursor cursor = getCursor(); cursor.moveToPosition(-1); while (cursor.moveToNext()) { Conversation conversation = Conversation.createFromCursor(cursor); if (!selectedConversation.contains(conversation.getThread_id())) { selectedConversation.add(conversation.getThread_id()); } } notifyDataSetChanged(); } /** * 取消所有选择的条目 */ public void canceleddAllConversation() { selectedConversation.clear(); } public List<String> getSelectedConversation() { return selectedConversation; } public void setSelectedConversation(List<String> selectedConversation) { this.selectedConversation = selectedConversation; } }
323e97cb6995a0290f85561ef1301262b28b1437
309d2c195f1013b8b0e899c7c3faa6e548ec1a1b
/TID/src/tvtropes_data_mining/ColeccionSeries.java
ce854fb5df5ca468cecf6c101dac50337274b144
[]
no_license
JoseHdez2/ProyectoTID
d5c616f78b032c2d4cbf0170d25a9ee7a554450b
cf8eda948c27d5e3b4ceb5469d0715e8cce22862
refs/heads/master
2021-01-15T19:39:56.895814
2015-05-26T19:23:52
2015-05-26T19:23:52
32,983,042
0
0
null
null
null
null
UTF-8
Java
false
false
6,538
java
package tvtropes_data_mining; import java.util.ArrayList; import java.util.Collections; import useful.file.DirectoryFileLister; import useful.file.StringToFile; /* * La clase más importante del programa. * Contiene todas las estructuras de datos necesarias, * y la función más importante, que resulta ser el constructor. */ public class ColeccionSeries { // Vector con las series, cada una con sus tropes. ArrayList<Serie> series = new ArrayList<Serie>(); // Vector con los géneros, cada uno con sus tropes. ArrayList<Genero> generos = new ArrayList<Genero>(); // Hash con cada trope asignado al género al que pertenece. // Le das el nombre de un trope y te devuelve su género. ListaMaestraTropes listaMaestra = new ListaMaestraTropes(); /** * Esta es la función más importante. Es como el verdadero main del programa. * * @param dirCarpetaTropes Path absoluto de la carpeta con los HTML de las series. * @param dirCarpetaGeneros Path absoluto de la carpeta con los HTML de los generos. * @param dirArchivoWeka Path absoluto de la carpeta donde se creará el archivo Weka. */ ColeccionSeries(String dirCarpetaTropes, String dirCarpetaGeneros, String dirArchivoWeka){ // 1er paso: Rellenar el array de series. rellenarArraySeries(dirCarpetaTropes); // 2do paso: Agregar los tropes a la lista maestra. listaMaestra.agregarTropes(series); // 3er paso: Rellenar el array de generos. rellenarArrayGeneros(dirCarpetaGeneros); // 4to paso: Agregar los generos a la lista maestra. listaMaestra.agregarGeneros(generos); // 5to paso: Calcular los porcentajes de generos por cada serie. calcularConteoGeneros(); // 6to paso: Generar archivo Weka generarArchivoWeka(dirArchivoWeka); } /** * 1er paso: Rellenar el array de series */ void rellenarArraySeries(String dirCarpetaTropes){ // Obtenemos la lista de archivos en el directorio: ArrayList<String> nombresArchivos = DirectoryFileLister.listFilesForFolderPath(dirCarpetaTropes, ".html"); // Ordenamos los archivos alfabeticamente. Collections.sort(nombresArchivos); // Por cada archivo, crear una serie y agregarla: for (String nombreArchivo : nombresArchivos){ //Convertimos el filepath relativo de cada serie en un filepath absoluto. String direccionSerie = dirCarpetaTropes + nombreArchivo; // Agregamos al vector de series una nueva serie. // El parametro del constructor es el filepath absoluto. series.add(new Serie(direccionSerie)); } } // String que representa al género desconocido. // Esto es para contar también los tropes cuyo género no conocemos. final String GENERO_DESCONOCIDO = "Desconocido"; /** * 3er paso: Rellenar el array de generos * * Este método es simétrico al del 1er paso. */ void rellenarArrayGeneros(String dirCarpetaGeneros){ // Obtenemos la lista de archivos en el directorio: ArrayList<String> nombresArchivos = DirectoryFileLister.listFilesForFolderPath(dirCarpetaGeneros, ".html"); // Ordenamos los archivos alfabéticamente. Collections.sort(nombresArchivos); // Por cada archivo, crear un género y agregarlo: for (String nombreArchivo : nombresArchivos){ // Convertimos el filepath relativo de cada género en un filepath absoluto. String direccionSerie = dirCarpetaGeneros + nombreArchivo; // Agregamos al vector de géneros un nuevo género. // El parametro del constructor es el filepath absoluto. generos.add(new Genero(direccionSerie)); } } /** * 5to paso: calcular el numero de tropes de cada genero por serie */ void calcularConteoGeneros(){ // Por cada serie... for (Serie s : series){ // Primero, inicializamos a 0 para cada género: // Por cada género... for (Genero g : generos){ // Colocamos el nombre de cada género, asociado a 0 (el conteo). s.conteoGeneros.put(g.name, 0); } // Inicializamos a 0 también el contador de tropes con género "desconocido" s.conteoGeneros.put(GENERO_DESCONOCIDO, 0); // Por cada uno de los tropes de la serie... for (String t : s.tropes){ // Obtener el género al que pertenece el trope. String generoDelTrope = listaMaestra.hashMaestro.get(t); // Si el trope no tiene género, contarlo como "desconocido" if ( generoDelTrope == "" || generoDelTrope == null){ generoDelTrope = GENERO_DESCONOCIDO; } // Pero si sí tiene, añadir uno al conteo del género correspondiente. else { int conteo = s.conteoGeneros.get(generoDelTrope); s.conteoGeneros.put(generoDelTrope, conteo + 1); } } } } /** * 6to paso: generar archivo Weka */ void generarArchivoWeka(String dirArchivoWeka){ // String que será el contenido del archivo. String wekaContent = ""; // Colocamos lo que viene a ser el "título" del archivo Weka. wekaContent = wekaContent.concat("@RELATION series"); // Pasamos a escribir los atributos que tendrá cada caso: // El nombre de cada serie será un atributo. wekaContent = wekaContent.concat("\n@ATTRIBUTE nombreSerie"); // El número de tropes de cada serie será un atributo. wekaContent = wekaContent.concat("\n@ATTRIBUTE numeroTropes"); // El género desconocido (su porcentaje en la serie) será un atributo. wekaContent = wekaContent.concat("\n@ATTRIBUTE " + GENERO_DESCONOCIDO); // Cada género (su porcentaje en la serie) será un atributo. for (Genero g : generos){ wekaContent = wekaContent.concat("\n@ATTRIBUTE " + g.name); } // Declaramos que empezaremos a introducir la población de datos. wekaContent = wekaContent.concat("\n@DATA"); // Por cada serie... for (Serie s : series){ // Abrimos una nueva línea. wekaContent = wekaContent.concat("\n"); // Apuntamos el nombre de la serie. wekaContent = wekaContent.concat(s.name + ","); // Apuntamos su número de tropes. wekaContent = wekaContent.concat(s.tropes.size() + ","); // Apuntamos el conteo del género desconocido. wekaContent = wekaContent.concat(s.conteoGeneros.get(GENERO_DESCONOCIDO) + ","); // Por cada género, apuntamos su conteo: for (Genero g : generos){ // Apuntamos el conteo del género. wekaContent = wekaContent.concat(s.conteoGeneros.get(g.name) + ","); } // Quitamos la ultima coma de la línea, que sobra. wekaContent = wekaContent.substring(0, wekaContent.length()-1); } StringToFile.stringToFile(dirArchivoWeka, wekaContent); } }
acb2032f8ed1a09b1381d321f2d59537d63273a1
2deb745472433557c1535e25c8a7f036851e431c
/src/main/java/com/pkch/todolist/api/todo/TodoRepository.java
11abf77321ac6eef6f1d650bf8ed1f7a17e8a872
[]
no_license
pkch93/To-Do-List-Restful-API-server
7f7f2d717bf1d534d67062785d537788cc47273b
a67ebfd102310faa90814afcb9098a2b367450af
refs/heads/master
2020-04-14T12:06:30.989308
2019-01-13T05:58:21
2019-01-13T05:58:21
163,830,786
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
package com.pkch.todolist.api.todo; import org.springframework.data.jpa.repository.JpaRepository; public interface TodoRepository extends JpaRepository<Todo, Long> { }
1f1941eecc2935a5d3a410445e3cb0bd4512ef60
148e123ea3af0c50c451c95aff3c6bc5b1d3644b
/src/it/mytutor/domain/jackson/PlanningDeserializer.java
05e31b27a36a68b3631d9023469a15898595c6cd
[]
no_license
Alemato/Web-Avanzato
dc2948fc26aa9ab83319f8f21b429ae356d39e43
28b17d9b1bf0f7aa8f48b6aa2163b74de10b3f1a
refs/heads/master
2023-08-27T22:49:26.163667
2021-11-02T19:46:03
2021-11-02T19:46:03
423,977,517
0
0
null
null
null
null
UTF-8
Java
false
false
2,539
java
package it.mytutor.domain.jackson; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import it.mytutor.domain.Lesson; import it.mytutor.domain.Planning; import it.mytutor.domain.Subject; import java.io.IOException; import java.sql.Date; public class PlanningDeserializer extends StdDeserializer<Planning> { public PlanningDeserializer(){ this(null); } public PlanningDeserializer(Class<?> vc) {super(vc); } @Override public Planning deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { JsonNode node = jsonParser.getCodec().readTree(jsonParser); Planning planning = new Planning(); if (node.get("idPlanning") != null) { planning.setIdPlanning(node.get("idPlanning").asInt()); } Date date = new Date(node.get("date").asLong()); planning.setDate(date); String oraInizio = node.get("startTime").asText().substring(0, 5) + ":00"; planning.setStartTime(java.sql.Time.valueOf(oraInizio)); String oraFine = node.get("endTime").asText().substring(0, 5) + ":00"; planning.setEndTime(java.sql.Time.valueOf(oraFine)); planning.setAvailable(node.get("available").asBoolean()); planning.setRepeatPlanning(node.get("repeatPlanning").asBoolean()); Lesson lesson = new Lesson(); if (node.findPath("lesson").findPath("idLesson") != null){ lesson.setIdLesson(node.findPath("lesson").findPath("idLesson").asInt()); } lesson.setName(node.findPath("lesson").findPath("name").asText()); lesson.setPrice(node.findPath("lesson").findPath("price").asDouble()); lesson.setDescription(node.findPath("lesson").findPath("description").asText()); Date pDate = new Date(node.findPath("lesson").findPath("publicationDate").asLong()); lesson.setPublicationDate(pDate); Subject subject = new Subject(); subject.setMacroSubject(node.findPath("lesson").findPath("subject").findPath("macroSubject").asText()); subject.setMicroSubject(node.findPath("lesson").findPath("subject").findPath("microSubject").asText()); lesson.setSubject(subject); planning.setLesson(lesson); return planning; } }
11e6faf517976358c2279bdf29363105e3f640ae
a2b1fee6b03bc58b730badc2302dfca359175fd8
/kerby/kerby-lib/src/test/java/pt/ulisboa/tecnico/sdis/kerby/it/RequestTicketIT.java
5a67e5997954bff5fa807c9e04ac05ea4db4be0e
[ "MIT" ]
permissive
neroz7/DS-Kerby-Quorum
1d79385a65aa5cdfba3c7012f75d1f1eb753003c
e1a69527f0e165a0a47a4af819e5a3917dfe6b2b
refs/heads/master
2023-06-03T23:25:17.608533
2021-06-22T02:17:15
2021-06-22T02:17:15
377,259,131
0
0
null
null
null
null
UTF-8
Java
false
false
8,680
java
package pt.ulisboa.tecnico.sdis.kerby.it; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.spec.InvalidKeySpecException; import org.junit.Test; import pt.ulisboa.tecnico.sdis.kerby.BadTicketRequest_Exception; import pt.ulisboa.tecnico.sdis.kerby.CipheredView; import pt.ulisboa.tecnico.sdis.kerby.SecurityHelper; import pt.ulisboa.tecnico.sdis.kerby.SessionKey; import pt.ulisboa.tecnico.sdis.kerby.SessionKeyAndTicketView; import pt.ulisboa.tecnico.sdis.kerby.SessionKeyView; import pt.ulisboa.tecnico.sdis.kerby.Ticket; import pt.ulisboa.tecnico.sdis.kerby.TicketView; /** * Test suite */ public class RequestTicketIT extends BaseIT { private static SecureRandom randomGenerator = new SecureRandom(); private static final String VALID_CLIENT_NAME = "[email protected]"; private static final String VALID_CLIENT_PASSWORD = "tzpxRB7"; private static final String VALID_SERVER_NAME = "[email protected]"; private static final String VALID_SERVER_PASSWORD = "yRTg3mgJK"; private static final int VALID_DURATION = 30; // Valid Request Tests ------------------------------------------------------------- @Test public void testValidRequest() throws Exception { final Key clientKey = getKey(VALID_CLIENT_PASSWORD); final Key serverKey = getKey(VALID_SERVER_PASSWORD); long nounce = randomGenerator.nextLong(); SessionKeyAndTicketView result = client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce, VALID_DURATION); CipheredView cipheredSessionKey = result.getSessionKey(); CipheredView cipheredTicket = result.getTicket(); SessionKey sessionKey = new SessionKey(cipheredSessionKey, clientKey); Ticket ticket = new Ticket(cipheredTicket, serverKey); long timeDiff = ticket.getTime2().getTime() - ticket.getTime1().getTime(); assertEquals(nounce, sessionKey.getNounce()); assertNotNull(sessionKey.getKeyXY()); assertEquals(VALID_CLIENT_NAME, ticket.getX()); assertEquals(VALID_SERVER_NAME, ticket.getY()); assertEquals((long) VALID_DURATION * 1000, timeDiff); assertNotNull(ticket.getKeyXY()); assertEquals(sessionKey.getKeyXY(), ticket.getKeyXY()); /* System.out.println(ticket.toString()); System.out.println(sessionKey.toString()); */ } @Test public void testValidDoubleRequest() throws Exception { final Key clientKey = getKey(VALID_CLIENT_PASSWORD); final Key serverKey = getKey(VALID_SERVER_PASSWORD); long nounce1 = randomGenerator.nextLong(); long nounce2 = randomGenerator.nextLong(); SessionKeyAndTicketView result1 = client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce1, VALID_DURATION); SessionKeyAndTicketView result2 = client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce2, VALID_DURATION); CipheredView cipheredSessionKey1 = result1.getSessionKey(); CipheredView cipheredSessionKey2 = result2.getSessionKey(); CipheredView cipheredTicket1 = result1.getTicket(); CipheredView cipheredTicket2 = result2.getTicket(); SessionKey sessionKey1 = new SessionKey(cipheredSessionKey1, clientKey); SessionKey sessionKey2 = new SessionKey(cipheredSessionKey2, clientKey); Ticket ticket1 = new Ticket(cipheredTicket1, serverKey); Ticket ticket2 = new Ticket(cipheredTicket2, serverKey); long timeDiff1 = ticket1.getTime2().getTime() - ticket1.getTime1().getTime(); long timeDiff2 = ticket2.getTime2().getTime() - ticket2.getTime1().getTime(); assertEquals(nounce1, sessionKey1.getNounce()); assertEquals(nounce2, sessionKey2.getNounce()); assertNotNull(sessionKey1.getKeyXY()); assertNotNull(sessionKey2.getKeyXY()); assertEquals(VALID_CLIENT_NAME, ticket1.getX()); assertEquals(VALID_CLIENT_NAME, ticket2.getX()); assertEquals(VALID_SERVER_NAME, ticket1.getY()); assertEquals(VALID_SERVER_NAME, ticket2.getY()); assertEquals((long) VALID_DURATION * 1000, timeDiff1); assertEquals((long) VALID_DURATION * 1000, timeDiff2); assertNotNull(ticket1.getKeyXY()); assertNotNull(ticket2.getKeyXY()); assertEquals(sessionKey1.getKeyXY(), ticket1.getKeyXY()); assertEquals(sessionKey2.getKeyXY(), ticket2.getKeyXY()); assertNotEquals(sessionKey1.getKeyXY(), sessionKey2.getKeyXY()); } // Invalid Client Tests ------------------------------------------------------------- @Test(expected = BadTicketRequest_Exception.class) public void testNullClient() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(null, VALID_SERVER_NAME, nounce, VALID_DURATION); } @Test(expected = BadTicketRequest_Exception.class) public void testEmptyClient() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket("", VALID_SERVER_NAME, nounce, VALID_DURATION); } @Test(expected = BadTicketRequest_Exception.class) public void testWhitespaceClient() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(" ", VALID_SERVER_NAME, nounce, VALID_DURATION); } @Test(expected = BadTicketRequest_Exception.class) public void testInvalidClient() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket("invalidKerbyClient", VALID_SERVER_NAME, nounce, VALID_DURATION); } // Invalid Server Tests ------------------------------------------------------------- @Test(expected = BadTicketRequest_Exception.class) public void testNullServer() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, null, nounce, VALID_DURATION); } @Test(expected = BadTicketRequest_Exception.class) public void testEmptyServer() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, "", nounce, VALID_DURATION); } @Test(expected = BadTicketRequest_Exception.class) public void testWhitespaceServer() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, " ", nounce, VALID_DURATION); } @Test(expected = BadTicketRequest_Exception.class) public void testInvalidServer() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, "invalidKerbyServer", nounce, VALID_DURATION); } // Invalid Nounce Tests ------------------------------------------------------------- @Test(expected = BadTicketRequest_Exception.class) public void testRepeatedNounce() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce, VALID_DURATION); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce, VALID_DURATION); } @Test(expected = BadTicketRequest_Exception.class) public void testIntervalRepeatedNounce() throws Exception { long nounce1 = randomGenerator.nextLong(); long nounce2 = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce1, VALID_DURATION); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce2, VALID_DURATION); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce1, VALID_DURATION); } // Duration Tests ------------------------------------------------------------- @Test public void testMinDuration() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce, 10); } @Test public void testMaxDuration() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce, 300); } @Test(expected = BadTicketRequest_Exception.class) public void testLowerDuration() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce, 9); } @Test(expected = BadTicketRequest_Exception.class) public void testHigherDuration() throws Exception { long nounce = randomGenerator.nextLong(); client.requestTicket(VALID_CLIENT_NAME, VALID_SERVER_NAME, nounce, 301); } // Test Helpers ------------------------------------------------------------- private Key getKey(String password) throws NoSuchAlgorithmException, InvalidKeySpecException { return SecurityHelper.generateKeyFromPassword(password); } }
dc4aa099b759d82239da1a5a1630e57f61b19835
4686dd88101fa2c7bf401f1338114fcf2f3fc28e
/client/rest-high-level/src/test/java/org/elasticsearch/client/ccr/PutFollowResponseTests.java
00bcf535f08af722be36e1111fa80930ff917a20
[ "Apache-2.0", "LicenseRef-scancode-elastic-license-2018" ]
permissive
strapdata/elassandra
55f25be97533435d7d3ebaf9fa70d985020163e2
b90667791768188a98641be0f758ff7cd9f411f0
refs/heads/v6.8.4-strapdata
2023-08-27T18:06:35.023045
2022-01-03T14:21:32
2022-01-03T14:21:32
41,209,174
1,199
203
Apache-2.0
2022-12-08T00:38:37
2015-08-22T13:52:08
Java
UTF-8
Java
false
false
2,112
java
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.client.ccr; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.ESTestCase; import java.io.IOException; import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; public class PutFollowResponseTests extends ESTestCase { public void testFromXContent() throws IOException { xContentTester(this::createParser, this::createTestInstance, PutFollowResponseTests::toXContent, PutFollowResponse::fromXContent) .supportsUnknownFields(true) .test(); } private PutFollowResponse createTestInstance() { return new PutFollowResponse(randomBoolean(), randomBoolean(), randomBoolean()); } public static void toXContent(PutFollowResponse response, XContentBuilder builder) throws IOException { builder.startObject(); { builder.field(PutFollowResponse.FOLLOW_INDEX_CREATED.getPreferredName(), response.isFollowIndexCreated()); builder.field(PutFollowResponse.FOLLOW_INDEX_SHARDS_ACKED.getPreferredName(), response.isFollowIndexShardsAcked()); builder.field(PutFollowResponse.INDEX_FOLLOWING_STARTED.getPreferredName(), response.isIndexFollowingStarted()); } builder.endObject(); } }
80b462fba6ad40d6f1244419dda6e2404feec7c5
99e0f8b9cdfca53b40d2fca8b5bf9ff020b42d80
/src/main/java/pl/com/bottega/lms/model/Address.java
9b16e18aa44b73a85ca7daf71c77e0eb9c9358ac
[]
no_license
krolmarcin/lms
fe2acf10269df3165c95cf6142e6298e9442ba95
f64400e6372652f40eda8218a622d05800494ec4
refs/heads/master
2021-07-17T11:18:50.974667
2017-10-24T17:41:48
2017-10-24T17:41:48
86,345,236
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
package pl.com.bottega.lms.model; import javax.persistence.Column; import javax.persistence.Embeddable; @Embeddable public class Address { private String street; private String city; @Column(length = 6) private String postalCode; public Address() { } public Address(String street, String city, String postalCode) { this.street = street; this.city = city; this.postalCode = postalCode; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getPostalCode() { return postalCode; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } }
1e891ee1aa0e918ca6479db922b83afde7d938f5
51552465f145a99aeb7bacfd7801e42ed670762a
/SecureHadoop/src/examples/EncryptedTeraSortBaseline.java
8657a561b959065b3b09a863897b872a2d1675fd
[]
no_license
ug93tad/secureHadoop
1a455f04c953213cb1000f988557de79e655eea9
f49cc02b66284bab1f1b16e5d88130a86dadfe77
refs/heads/master
2016-09-05T16:47:29.130318
2014-05-28T02:50:36
2014-05-28T02:50:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,038
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package examples; import java.io.DataInputStream; import java.io.IOException; import java.io.PrintStream; import java.net.URI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configurable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Cluster; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.JobContext; import org.apache.hadoop.mapreduce.MRJobConfig; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Partitioner; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.Mapper.Context; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import crypto.Rand; import tds1.encryptor.BaselineSortEncryptor; import tds1.io.TeraEncryptedInputFormat; import tds1.io.TeraOutputFormat; /** * Same as Tersort, but only uses simplePartitioner */ public class EncryptedTeraSortBaseline extends Configured implements Tool { private static final Log LOG = LogFactory.getLog(EncryptedTeraSortBaseline.class); static String SIMPLE_PARTITIONER = "mapreduce.terasort.simplepartitioner"; static String OUTPUT_REPLICATION = "mapreduce.terasort.output.replication"; /** * A partitioner that splits text keys into roughly equal partitions * in a global sorted order. */ static class TotalOrderPartitioner extends Partitioner<Text,Text> implements Configurable { private TrieNode trie; private Text[] splitPoints; private Configuration conf; /** * A generic trie node */ static abstract class TrieNode { private int level; TrieNode(int level) { this.level = level; } abstract int findPartition(Text key); abstract void print(PrintStream strm) throws IOException; int getLevel() { return level; } } /** * An inner trie node that contains 256 children based on the next * character. */ static class InnerTrieNode extends TrieNode { private TrieNode[] child = new TrieNode[256]; InnerTrieNode(int level) { super(level); } int findPartition(Text key) { int level = getLevel(); if (key.getLength() <= level) { return child[0].findPartition(key); } return child[key.getBytes()[level] & 0xff].findPartition(key); } void setChild(int idx, TrieNode child) { this.child[idx] = child; } void print(PrintStream strm) throws IOException { for(int ch=0; ch < 256; ++ch) { for(int i = 0; i < 2*getLevel(); ++i) { strm.print(' '); } strm.print(ch); strm.println(" ->"); if (child[ch] != null) { child[ch].print(strm); } } } } /** * A leaf trie node that does string compares to figure out where the given * key belongs between lower..upper. */ static class LeafTrieNode extends TrieNode { int lower; int upper; Text[] splitPoints; LeafTrieNode(int level, Text[] splitPoints, int lower, int upper) { super(level); this.splitPoints = splitPoints; this.lower = lower; this.upper = upper; } int findPartition(Text key) { for(int i=lower; i<upper; ++i) { if (splitPoints[i].compareTo(key) > 0) { return i; } } return upper; } void print(PrintStream strm) throws IOException { for(int i = 0; i < 2*getLevel(); ++i) { strm.print(' '); } strm.print(lower); strm.print(", "); strm.println(upper); } } /** * Read the cut points from the given sequence file. * @param fs the file system * @param p the path to read * @param job the job config * @return the strings to split the partitions on * @throws IOException */ private static Text[] readPartitions(FileSystem fs, Path p, Configuration conf) throws IOException { int reduces = conf.getInt(MRJobConfig.NUM_REDUCES, 1); Text[] result = new Text[reduces - 1]; DataInputStream reader = fs.open(p); for(int i=0; i < reduces - 1; ++i) { result[i] = new Text(); result[i].readFields(reader); } reader.close(); return result; } /** * Given a sorted set of cut points, build a trie that will find the correct * partition quickly. * @param splits the list of cut points * @param lower the lower bound of partitions 0..numPartitions-1 * @param upper the upper bound of partitions 0..numPartitions-1 * @param prefix the prefix that we have already checked against * @param maxDepth the maximum depth we will build a trie for * @return the trie node that will divide the splits correctly */ private static TrieNode buildTrie(Text[] splits, int lower, int upper, Text prefix, int maxDepth) { int depth = prefix.getLength(); if (depth >= maxDepth || lower == upper) { return new LeafTrieNode(depth, splits, lower, upper); } InnerTrieNode result = new InnerTrieNode(depth); Text trial = new Text(prefix); // append an extra byte on to the prefix trial.append(new byte[1], 0, 1); int currentBound = lower; for(int ch = 0; ch < 255; ++ch) { trial.getBytes()[depth] = (byte) (ch + 1); lower = currentBound; while (currentBound < upper) { if (splits[currentBound].compareTo(trial) >= 0) { break; } currentBound += 1; } trial.getBytes()[depth] = (byte) ch; result.child[ch] = buildTrie(splits, lower, currentBound, trial, maxDepth); } // pick up the rest trial.getBytes()[depth] = (byte) 255; result.child[255] = buildTrie(splits, currentBound, upper, trial, maxDepth); return result; } public void setConf(Configuration conf) { try { FileSystem fs = FileSystem.getLocal(conf); this.conf = conf; Path partFile = new Path(TeraEncryptedInputFormat.PARTITION_FILENAME); splitPoints = readPartitions(fs, partFile, conf); trie = buildTrie(splitPoints, 0, splitPoints.length, new Text(), 2); } catch (IOException ie) { throw new IllegalArgumentException("can't read paritions file", ie); } } public Configuration getConf() { return conf; } public TotalOrderPartitioner() { } public int getPartition(Text key, Text value, int numPartitions) { return trie.findPartition(key); } } /** * A total order partitioner that assigns keys based on their first * PREFIX_LENGTH bytes, assuming a flat distribution. */ public static class SimplePartitioner extends Partitioner<Text, Text> implements Configurable { int prefixesPerReduce; private static final int PREFIX_LENGTH = 3; private Configuration conf = null; public void setConf(Configuration conf) { this.conf = conf; prefixesPerReduce = (int) Math.ceil((1 << (8 * PREFIX_LENGTH)) / (float) conf.getInt(MRJobConfig.NUM_REDUCES, 1)); } public Configuration getConf() { return conf; } @Override public int getPartition(Text key, Text value, int numPartitions) { byte[] bytes = key.getBytes(); int len = Math.min(PREFIX_LENGTH, key.getLength()); int prefix = 0; for(int i=0; i < len; ++i) { prefix = (prefix << 8) | (0xff & bytes[i]); } return prefix / prefixesPerReduce; } } public static boolean getUseSimplePartitioner(JobContext job) { return job.getConfiguration().getBoolean(SIMPLE_PARTITIONER, false); } public static void setUseSimplePartitioner(Job job, boolean value) { job.getConfiguration().setBoolean(SIMPLE_PARTITIONER, value); } public static int getOutputReplication(JobContext job) { return job.getConfiguration().getInt(OUTPUT_REPLICATION, 1); } public static void setOutputReplication(Job job, int value) { job.getConfiguration().setInt(OUTPUT_REPLICATION, value); } public int run(String[] args) throws Exception { LOG.info("starting"); Job job = Job.getInstance(new Cluster(getConf()), getConf()); Path inputDir = new Path(args[0]); Path outputDir = new Path(args[1]); FileInputFormat.setInputPaths(job, inputDir); FileOutputFormat.setOutputPath(job, outputDir); job.setJobName("TeraSort"); job.setJarByClass(EncryptedTeraSortBaseline.class); job.setMapperClass(SortMapper.class); job.setReducerClass(SortReducer.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(Text.class); job.setOutputKeyClass(BytesWritable.class); job.setOutputValueClass(BytesWritable.class); job.setInputFormatClass(SequenceFileInputFormat.class); job.setOutputFormatClass(SequenceFileOutputFormat.class); job.setPartitionerClass(SimplePartitioner.class); job.getConfiguration().setInt("dfs.replication", getOutputReplication(job)); TeraOutputFormat.setFinalSync(job, true); int ret = job.waitForCompletion(true) ? 0 : 1; LOG.info("done"); return ret; } /** * @param args */ public static void main(String[] args) throws Exception { int res = ToolRunner.run(new Configuration(), new EncryptedTeraSortBaseline(), args); System.exit(res); } /** * Reading from the encrypted file, decrypt and oput <key,val> in text */ static class SortMapper extends Mapper<BytesWritable, BytesWritable, Text, Text> { Rand crypto; @Override public void setup(Context context) { Configuration conf = context.getConfiguration(); crypto = new Rand(); crypto.init(conf.get("key")); } @Override public void map(BytesWritable key, BytesWritable value, Context context) throws IOException, InterruptedException { byte[] pt = crypto.decrypt_word_cbc(value.copyBytes(), key.copyBytes()); byte[] k = new byte[BaselineSortEncryptor.KEY_LENGTH]; byte[] v = new byte[BaselineSortEncryptor.VALUE_LENGTH]; System.arraycopy(pt, 0, k, 0, BaselineSortEncryptor.KEY_LENGTH); System.arraycopy(pt, BaselineSortEncryptor.KEY_LENGTH, v, 0, BaselineSortEncryptor.VALUE_LENGTH); context.write(new Text(k), new Text(v)); } } /** * Encrypt the sorted result */ static class SortReducer extends Reducer<Text, Text, BytesWritable, BytesWritable> { Rand crypto; static final int AES_BLOCK_SIZE = 16; @Override public void setup(Context context) { Configuration conf = context.getConfiguration(); crypto = new Rand(); crypto.init(conf.get("key")); } //similar to BaselineSortEncryptor @Override public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { for (Text value : values) { byte[] randomIV = crypto.randomBytes(AES_BLOCK_SIZE); byte[] pt = new byte[BaselineSortEncryptor.KEY_LENGTH + BaselineSortEncryptor.VALUE_LENGTH]; System.arraycopy(key.copyBytes(), 0, pt, 0, BaselineSortEncryptor.KEY_LENGTH); System.arraycopy(value.copyBytes(), 0, pt, BaselineSortEncryptor.KEY_LENGTH, BaselineSortEncryptor.VALUE_LENGTH); // byte[] ct = crypto.encrypt_word_rnd(value.toString(), // randomIV); byte[] ct = crypto.encrypt_word_cbc(pt, randomIV); context.write(new BytesWritable(randomIV), new BytesWritable(ct)); } } } }
6187bff40bfbeff0f6c7e9580cdc7815d9deb8ff
7adc8a0a46340f94cec9dce1a2042c25bf7ebac0
/backend/suyang_project_server/o2o-massage/o2o-mgt-web/src/main/java/com/o2o/nm/sys/entity/SysRole.java
fac18c84b03d3d153a31ba39cd956bbfc46d43d5
[]
no_license
sonia630/suyang_project
23b651b4259a0359bde20fd082410b8a09235466
0701c1706cf7d45274758053bba3bb8d64bc9205
refs/heads/master
2021-04-12T10:34:54.413844
2018-07-25T01:35:47
2018-07-25T01:35:47
126,292,773
1
1
null
null
null
null
UTF-8
Java
false
false
1,333
java
package com.o2o.nm.sys.entity; import com.alibaba.fastjson.annotation.JSONField; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.enums.FieldStrategy; import com.baomidou.mybatisplus.enums.IdType; import com.google.common.collect.Lists; import com.o2o.nm.entity.BasicEntity; import lombok.Getter; import lombok.Setter; import lombok.ToString; import java.util.List; /** * <p> * 角色表 * </p> * * @author warning5 * @since 2018-02-24 */ @Getter @Setter @ToString public class SysRole extends BasicEntity<String> implements TreeNode<String, SysRole> { /** * 父编号 */ @TableField(value = "parent_id", strategy = FieldStrategy.IGNORED) protected String parentId; @TableId(value = "id", type = IdType.INPUT) protected String id; @TableField(exist = false) @JSONField(serialize = false) protected List<SysRole> children = Lists.newArrayList(); @TableField(exist = false) @JSONField(serialize = false) protected SysRole parent; private String name; private String description; /** * 角色or分类 */ private int type; /** * 备注信息 */ private String remarks; @TableField(exist = false) private String pname; }
a1938989721e0fc5defa55d8332728bc68882130
1c212d7cdd870e14cc1e2c16fe8983899d54e36e
/src/Musicas.java
43c53cab2274009b5b26103313ce436383831bf6
[]
no_license
tpfrois/music-box
7efeeb012e8453bf4e31d5708c0a58e78c7a8f48
47cba388a68f78198e62b3c57854af20ded80f87
refs/heads/main
2023-01-19T12:21:34.014202
2020-11-23T23:08:16
2020-11-23T23:08:16
314,330,478
0
0
null
null
null
null
UTF-8
Java
false
false
3,327
java
import java.io.IOException; import java.util.*; import javax.xml.bind.JAXBException; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "musicas") @XmlAccessorType (XmlAccessType.FIELD) public class Musicas { @XmlElement(name = "musica") public List<Musica> musicas = new ArrayList<>(); public List<Musica> getMusicas() { return musicas; } public void setMusicas(List<Musica> musicas) { this.musicas = musicas; } public void cadastrar() throws JAXBException { Scanner S = new Scanner(System.in); String nome, artista, album, genero; int minutos, segundos; System.out.println("\nCadastro de Músicas\n"); System.out.print("Nome: "); nome = S.nextLine(); System.out.print("Artista: "); artista = S.nextLine(); System.out.print("Álbum: "); album = S.nextLine(); System.out.print("Gênero: "); genero = S.nextLine(); System.out.println("DURAÇÃO"); System.out.print("Minutos: "); minutos = S.nextInt(); System.out.print("Segundos: "); segundos = S.nextInt(); Musica music = new Musica(nome, artista, album, genero, minutos, segundos); int ultimoID = this.getMusicas().size(); music.setId(ultimoID + 1); this.getMusicas().add(music); this.ordenar(); XML.salvar(this); System.out.print("\nMúsica cadastrada!\nPressione uma tecla para continuar..."); S.nextLine(); } private void ordenar() { // Ordena por nome depois por artista Collections.sort(this.getMusicas(), (A, B) -> { String nome1 = A.getNome().toLowerCase(); String nome2 = B.getNome().toLowerCase(); int sComp = nome1.compareTo(nome2); if(sComp != 0){ return sComp; } String artista1 = A.getArtista().toLowerCase(); String artista2 = B.getArtista().toLowerCase(); return artista1.compareTo(artista2); }); } public void listar(){ Scanner S = new Scanner(System.in); System.out.println("\nMÚSICAS CADASTRADAS"); if(this.getMusicas().size() == 0){ System.out.println("Não existem músicas cadastradas!"); } else { for(Musica M: this.getMusicas()){ System.out.printf("\nNome: %1$s\t- Artista: %2$s\t- Album: %3$s\t- Duracao: %4$s\t- Genero: %5$s", M.getNome(), M.getArtista(), M.getAlbum(), M.getDuracao(), M.getGenero()); } } System.out.print("\n\nPressione uma tecla para continuar..."); S.nextLine(); } public Musica buscar(String nome, String artista){ Musica mus = new Musica(); String nomeLimpo = nome.toLowerCase(); String artistaLimpo = artista.toLowerCase(); for(Musica m : this.getMusicas()){ if(nomeLimpo.equals(m.getNome().toLowerCase()) && artistaLimpo.equals(m.getArtista().toLowerCase())){ mus = m; break; } } return mus; } }
b7f4537273af3784013907d1b207bcbabaf0c5c1
93a501a1564a89db2985410b0893f839c47b971e
/src/twg2/ast/interm/classes/ClassSigSimple.java
99e8919e8a2cb49b2256508ef2e82134a1045dc5
[ "MIT" ]
permissive
TeamworkGuy2/JParseCode
abdd6da2b1efd31089492903d2e418a929f58984
16de37b3016a35668bb4f43a48342b05eb311a4b
refs/heads/master
2021-09-13T02:43:42.742063
2021-08-21T18:14:59
2021-08-21T18:14:59
49,784,617
3
0
null
null
null
null
UTF-8
Java
false
false
3,118
java
package twg2.ast.interm.classes; import java.io.IOException; import java.util.List; import lombok.Getter; import twg2.annotations.Immutable; import twg2.ast.interm.annotation.AnnotationSig; import twg2.ast.interm.type.TypeSig; import twg2.ast.interm.type.TypeSig.TypeSigSimple; import twg2.io.json.stringify.JsonStringify; import twg2.parser.codeParser.Keyword; import twg2.parser.codeParser.tools.NameUtil; import twg2.parser.output.WriteSettings; @Immutable public class ClassSigSimple implements ClassSig { private final @Getter List<String> fullName; /** This type's generic type parameters, if any */ private final @Getter List<TypeSig.TypeSigSimple> params; /** The block's access (i.e. 'public', 'private', etc.) */ private final @Getter Keyword accessModifier; /** The block's annotations */ private final @Getter List<AnnotationSig> annotations; /** The block's type (i.e. 'interface', 'class', 'enum', etc.) */ private final @Getter String declarationType; private final @Getter List<String> extendImplementSimpleNames; private final @Getter List<String> comments; public ClassSigSimple(List<String> fullName, List<? extends TypeSigSimple> params, Keyword accessModifier, List<? extends AnnotationSig> annotations, List<String> comments, String declarationType, List<String> extendImplementSimpleNames) { @SuppressWarnings("unchecked") var paramsCast = (List<TypeSigSimple>)params; @SuppressWarnings("unchecked") var annotationsCast = (List<AnnotationSig>)annotations; this.fullName = fullName; this.params = paramsCast; this.accessModifier = accessModifier; this.annotations = annotationsCast; this.comments = comments; this.declarationType = declarationType; this.extendImplementSimpleNames = extendImplementSimpleNames; } @Override public String getSimpleName() { return fullName.get(fullName.size() - 1); } public boolean isGeneric() { return params.size() > 0; } @Override public void toJson(Appendable dst, WriteSettings st) throws IOException { var json = JsonStringify.inst; dst.append("{ "); json.toProp("access", accessModifier.toSrc(), dst); json.comma(dst).toProp("name", (st.fullClassName ? NameUtil.joinFqName(fullName) : fullName.get(fullName.size() - 1)), dst); if(declarationType != null) { json.comma(dst).toProp("declarationType", declarationType, dst); } if(params != null && params.size() > 0) { json.comma(dst).propName("genericParameters", dst) .toArrayConsume(params, dst, (p) -> p.toJson(dst, st)); } if(extendImplementSimpleNames.size() > 0) { json.comma(dst).propName("extendImplementClassNames", dst) .toStringArray(extendImplementSimpleNames, dst); } if(annotations.size() > 0) { json.comma(dst).propName("annotations", dst) .toArrayConsume(annotations, dst, (a) -> a.toJson(dst, st)); } if(comments.size() > 0) { json.comma(dst).propName("comments", dst) .toStringArray(comments, dst); } dst.append(" }"); } @Override public String toString() { return accessModifier.toSrc() + " " + declarationType + " " + NameUtil.joinFqName(fullName); } }
3814454a8a5a89dfad346c4cd4c4520a298494ae
cc32ba33b00790ba5e574c763eee3804e040daa7
/studentadminsystem/src/main/java/edu/njfu/sas/util/DbcpUtil.java
84c5510d31eaec13c9ae684b5e6d6f2208f4490f
[]
no_license
liangweitongshuai/warehouse2
823a0b9d887d5f947fdbd3da53924fe1a883e975
e6ef2c7753e281ffb731b96329bafdbac5427c56
refs/heads/master
2023-02-12T15:39:51.792112
2021-01-10T06:55:08
2021-01-10T06:55:08
328,310,349
0
0
null
null
null
null
UTF-8
Java
false
false
891
java
package edu.njfu.sas.util; import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.BasicDataSourceFactory; import javax.sql.DataSource; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class DbcpUtil { private static DataSource ds=null; /** * 静态代码块,属于类,不属于对象,用于初始化对象 */ static { Properties ps = new Properties(); InputStream in = new DbcpUtil().getClass().getClassLoader().getResourceAsStream("dbcpconfig.properties"); try { ps.load(in); ds= BasicDataSourceFactory.createDataSource(ps); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } public static DataSource getDataSource(){ return ds; } }
457ba78ce83f236ea1eb40967e585cf36111963d
54e28d1cd97020c9a98d727f5cc38867a48cffb9
/HelloWebService/src/com/zensar/services/FileDownloadService.java
d8d862d26708f85ea2ceae50b7f98302d8d6f165
[]
no_license
mandarw21/RESTful_WebService
569c796765ff62073e195430a002cccbb1125776
1fbb333f4f53f7b5f1896b4c7c0d6f294976859c
refs/heads/master
2020-06-25T01:59:09.361043
2019-07-28T01:17:55
2019-07-28T01:17:55
199,163,522
0
0
null
null
null
null
UTF-8
Java
false
false
1,085
java
package com.zensar.services; import java.io.File; import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; @Path("/files") public class FileDownloadService { private static final String FILE_PATH = "d:/hello.txt"; private static final String IMAGE_PATH = "d:/image.png"; @GET @Path("/txt") @Produces("text/plain") public Response getFile() { File file = new File(FILE_PATH); ResponseBuilder responseBuilder = Response.ok(file); responseBuilder.header("Content-Disposition", "attachment;filename=hello_.txt"); return responseBuilder.build(); } @GET @Path("/images") @Produces("image/png") public Response getImage() { File file = new File(IMAGE_PATH); ResponseBuilder responseBuilder = Response.ok(file); //responseBuilder.header("Content-Disposition", "attachment;filename=image.png"); return responseBuilder.build(); } }
8a1de6be4d835888f349752ac99a16f57da4c746
4a5cb7fc40a408afdc64b11c714b5e8939203380
/app/src/androidTest/java/com/softxpliot/demob/beepme/ApplicationTest.java
507056f33e450892de1f09a6673b46e8613411d9
[]
no_license
demobee/BeepMe
55efb503f956cd8bb173b9b79af3e9d6060cb454
a71937f15222495952c2b704ca372445d85047c9
refs/heads/master
2021-01-19T22:10:22.951011
2014-08-26T00:50:58
2014-08-26T00:50:58
23,240,521
3
3
null
null
null
null
UTF-8
Java
false
false
358
java
package com.softxpliot.demob.beepme; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
521e08bf1101c433e23f289c1e7b86a2f09a5a7d
cec811acb62929712a0a8c71ca2b628c334c7826
/ProjectE-commerce/app/src/main/java/com/example/mostafa/projecte_commerce/shopingcart.java
ec2eedce659ff96ea79d9b1a90759cd2abd2ec1d
[]
no_license
mostafamahmoudfarag/E-commerce-android-
607ee98c7b6a6756c5c39b8dc14a60a6689b84e9
0051b8e686a9bcb3b8bc25571e882dd0666b228b
refs/heads/master
2020-12-09T09:50:45.511880
2020-01-11T17:12:46
2020-01-11T17:12:46
233,267,584
0
0
null
null
null
null
UTF-8
Java
false
false
3,246
java
package com.example.mostafa.projecte_commerce; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; public class shopingcart extends AppCompatActivity { Customers c; EditText total,quantity,pdname1,pdname2; ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_shopingcart); c=new Customers(getApplicationContext()); listView=(ListView)findViewById(R.id.listproduct); Button submit=(Button)findViewById(R.id.submit); quantity=(EditText)findViewById(R.id.quantitynum); pdname1=(EditText)findViewById(R.id.deletename); pdname2=(EditText)findViewById(R.id.nameofupdatedelemment); Button delete=(Button)findViewById(R.id.btndelete); Button update=(Button)findViewById(R.id.btnupdate); total=(EditText)findViewById(R.id.toalmoney); total.setText(c.totalmoney()); showdata(); delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String a=pdname1.getText().toString(); int s= c.deleteproduct(a); if(s>0) { Toast.makeText(getApplicationContext(), "deleted", Toast.LENGTH_SHORT).show(); total.setText(c.totalmoney()); } else Toast.makeText(getApplicationContext(),"not deleted",Toast.LENGTH_SHORT).show(); showdata(); } }); update.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String a=pdname2.getText().toString(); String b=quantity.getText().toString(); if(c.updateorder(a,b)==true) { showdata(); total.setText(c.totalmoney()); } else Toast.makeText(getApplicationContext(),"there is no update",Toast.LENGTH_SHORT).show(); } }); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // c.clearallfromdatabase(); Intent i=new Intent(getApplicationContext(),Last.class); String s= (String) getIntent().getExtras().get("get_id2"); i.putExtra("get_id3",s); startActivity(i); } }); } public void showdata() { ArrayList<String>arr=c.returnsavingorder(); ArrayAdapter arrayAdapter=new ArrayAdapter(getApplicationContext(), android.R.layout.simple_list_item_1,arr); listView.setAdapter(arrayAdapter); } }
[ "mostafamahmoudfarag" ]
mostafamahmoudfarag
5abc3ed021268005bc74ec2abc865944c3f309e3
61b73c9affb174838aca6a53b722c11823e4e0b7
/src/main/scala/com/muming/chapter05/Test.java
89643a83d7e12522929b137e8e82e1536f9ec862
[ "Apache-2.0" ]
permissive
Mintonmu/ScalaDemo
5732b0d977afa7c64a100d8b0930fa34e8e2f6ac
7cace7389aba0974894946bdb5484915722f62a5
refs/heads/master
2023-01-29T06:25:13.744188
2020-12-08T01:33:58
2020-12-08T01:33:58
164,616,659
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.muming.chapter05; import java.math.BigDecimal; public class Test { @org.junit.Test public void test() { Double a = new Double(0.5); BigDecimal c = new BigDecimal(0.5); System.out.println(a + "\n" + c); } }
ec3030c247d475b16a7ff8b767b1317080f63d70
c9523b4741df1b6292430700d5fcf4a8a53401de
/lamp-authority/lamp-authority-biz/src/main/java/com/tangyh/lamp/authority/service/auth/ApplicationService.java
1a25773f03b563bbb17f99f8ecb61f9957c30a63
[ "Apache-2.0" ]
permissive
constantine008/zuihou-admin-cloud
c66c1a1c581764ab36630cee89fdb27a258d1c16
64a4bdb92efdd67c8e51e25fdcbcaf3d58499820
refs/heads/master
2023-04-22T09:42:18.840152
2021-04-24T08:52:24
2021-04-24T08:52:24
298,507,347
0
0
Apache-2.0
2021-04-24T08:52:24
2020-09-25T07:59:03
null
UTF-8
Java
false
false
570
java
package com.tangyh.lamp.authority.service.auth; import com.tangyh.lamp.authority.entity.auth.Application; import com.tangyh.basic.base.service.SuperCacheService; /** * <p> * 业务接口 * 应用 * </p> * * @author zuihou * @date 2019-12-15 */ public interface ApplicationService extends SuperCacheService<Application> { /** * 根据 clientId 和 clientSecret 查询 * * @param clientId 客户端id * @param clientSecret 客户端密钥 * @return 应用 */ Application getByClient(String clientId, String clientSecret); }
e6187b83d5762bd6e867c8c8d3a020b3f2b8e736
9b081463156e26dd3d542b24bc50e9ca210278dd
/eth-reference-tests/src/test/java/tech/pegasys/artemis/reference/phase0/ssz_static/attestation.java
d1da54134663e80dc73b7ad5fc0b46193c93d8a9
[ "Apache-2.0" ]
permissive
Jonathon55/artemis
276bbd53894824958a71845e2a74b7e6c650bc1b
3d6f3025d491e521deec50af401433a57abdaa36
refs/heads/master
2020-08-07T02:36:29.853928
2019-10-05T04:05:39
2019-10-05T04:05:39
213,263,543
1
0
Apache-2.0
2019-10-07T00:09:20
2019-10-07T00:09:19
null
UTF-8
Java
false
false
2,343
java
/* * Copyright 2019 ConsenSys AG. * * 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 tech.pegasys.artemis.reference.phase0.ssz_static; import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.errorprone.annotations.MustBeClosed; import java.nio.file.Path; import java.nio.file.Paths; import java.util.stream.Stream; import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.junit.BouncyCastleExtension; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import tech.pegasys.artemis.datastructures.operations.Attestation; import tech.pegasys.artemis.reference.TestSuite; @ExtendWith(BouncyCastleExtension.class) public class attestation extends TestSuite { @ParameterizedTest( name = "{index}. ssz_static/Attestation deserializedAttestation={0}, root={1}, signingRoot={2}") @MethodSource({ "processMinimal", "processMainnet", }) void processSSZStaticAttestation( Attestation deserializedAttestation, Bytes32 root, Bytes32 signingRoot) throws Exception { assertEquals(deserializedAttestation.hash_tree_root(), root); assertEquals(deserializedAttestation.signing_root("signature"), signingRoot); } @MustBeClosed static Stream<Arguments> processMinimal() throws Exception { return process("minimal"); } @MustBeClosed static Stream<Arguments> processMainnet() throws Exception { return process("mainnet"); } @MustBeClosed static Stream<Arguments> process(String config) throws Exception { Path configPath = Paths.get(config); Path path = Paths.get(config, "phase0", "ssz_static", "Attestation"); return sszStaticSetup(path, configPath, Attestation.class); } }
0465d54c427168644246037ae7fe07bf69797035
1bb74f028d2d9894a9d9be6ece123d0147dcb0a2
/master-prj/src/main/java/project1/master_prj/App.java
46e10e3ada2d61dd5ea85feaa7205c6132109ff9
[]
no_license
krenel/Maven-test-project
1338efecfc5860044996a69e8e5bca8f7caba41f
b80dbdff877c730c452ef160f84fe430e57f0798
refs/heads/master
2021-01-19T23:53:59.667621
2017-04-22T06:53:47
2017-04-22T06:53:47
89,051,211
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package project1.master_prj; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
d27f48026969cd627aed5b3897d38beab554e768
363c936f4a89b7d3f5f4fb588e8ca20c527f6022
/AL-Game/data/scripts/system/handlers/quest/altgard/_2020KeepingtheBlackClawTribeinCheck.java
072be0e34407c47380aded4970109627ee1bd851
[]
no_license
G-Robson26/AionServer-4.9F
d628ccb4307aa0589a70b293b311422019088858
3376c78b8d90bd4d859a7cfc25c5edc775e51cbf
refs/heads/master
2023-09-04T00:46:47.954822
2017-08-09T13:23:03
2017-08-09T13:23:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,849
java
/** * This file is part of Aion-Lightning <aion-lightning.org>. * * Aion-Lightning is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Aion-Lightning is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Aion-Lightning. * If not, see <http://www.gnu.org/licenses/>. */ package quest.altgard; import com.aionemu.gameserver.model.gameobjects.Npc; import com.aionemu.gameserver.model.gameobjects.player.Player; import com.aionemu.gameserver.network.aion.serverpackets.SM_DIALOG_WINDOW; import com.aionemu.gameserver.questEngine.handlers.QuestHandler; import com.aionemu.gameserver.questEngine.model.QuestEnv; import com.aionemu.gameserver.questEngine.model.QuestState; import com.aionemu.gameserver.questEngine.model.QuestStatus; import com.aionemu.gameserver.services.QuestService; import com.aionemu.gameserver.utils.PacketSendUtility; /** * @author Mr. Poke */ public class _2020KeepingtheBlackClawTribeinCheck extends QuestHandler { private final static int questId = 2020; public _2020KeepingtheBlackClawTribeinCheck() { super(questId); } @Override public void register() { qe.registerOnEnterZoneMissionEnd(questId); qe.registerOnLevelUp(questId); qe.registerQuestNpc(203665).addOnTalkEvent(questId); qe.registerQuestNpc(203668).addOnTalkEvent(questId); qe.registerQuestNpc(210562).addOnKillEvent(questId); qe.registerQuestNpc(216914).addOnKillEvent(questId); } @Override public boolean onDialogEvent(QuestEnv env) { final Player player = env.getPlayer(); final QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null) { return false; } final int var = qs.getQuestVarById(0); int targetId = 0; if (env.getVisibleObject() instanceof Npc) { targetId = ((Npc) env.getVisibleObject()).getNpcId(); } if (qs.getStatus() == QuestStatus.START) { switch (targetId) { case 203665: switch (env.getDialog()) { case QUEST_SELECT: if (var == 0) { return sendQuestDialog(env, 1011); } break; case SETPRO1: return defaultCloseDialog(env, 0, 1); // 1 default: break; } break; case 203668: switch (env.getDialog()) { case QUEST_SELECT: if (var == 1) { return sendQuestDialog(env, 1352); } else if (var == 5) { return sendQuestDialog(env, 1693); } else if (var == 6) { return sendQuestDialog(env, 2034); } break; case SETPRO2: case SETPRO3: if (var == 1 || var == 5) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } case CHECK_USER_HAS_QUEST_ITEM: if (var == 6) { if (QuestService.collectItemCheck(env, true)) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return sendQuestDialog(env, 5); } else { return sendQuestDialog(env, 2120); } } default: break; } } } else if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 203668) { return sendQuestEndDialog(env); } } return false; } @Override public boolean onKillEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null || qs.getStatus() != QuestStatus.START) { return false; } int var = qs.getQuestVarById(0); int targetId = 0; if (env.getVisibleObject() instanceof Npc) { targetId = ((Npc) env.getVisibleObject()).getNpcId(); } if ((targetId == 210562 || targetId == 216914) && var >= 2 && var < 5) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); return true; } return false; } @Override public boolean onZoneMissionEndEvent(QuestEnv env) { return defaultOnZoneMissionEndEvent(env); } @Override public boolean onLvlUpEvent(QuestEnv env) { return defaultOnLvlUpEvent(env, 2200, true); } }
[ "falke34@a70f7278-c47d-401d-a0e4-c9401b7f63ed" ]
falke34@a70f7278-c47d-401d-a0e4-c9401b7f63ed
a3f58c5cd4b117e5d0221b2417bac56286acf479
1fa1b6879a627217c400c4cc9e7fb5dfcc5fab60
/Assignments/src/Animals.java
bc15977ae254af10d1528ceeec6d323d7d11c867
[]
no_license
mujibsardar/java_tutoring
a87c9bf2045f9328eef1d3ac505b55bae6fa57a3
4ddbd7a096b89c2928b34adb606dc103a1dfe1ad
refs/heads/master
2020-04-02T02:54:48.119733
2018-10-23T23:42:07
2018-10-23T23:42:07
153,935,368
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
public class Animals { public static void main(String[] args) { String[] animals= new String[5]; animals[0]="Jiraffe"; animals[1]="Elephant"; animals[2]="Dog"; animals[3]="Cat"; animals[4]="Cow"; System.out.println("The animals are:"); System.out.println(animals[0]); System.out.println(animals[1]); System.out.println(animals[2]); System.out.println(animals[3]); System.out.println(animals[4]); } }
9411718dc3c66d9fef9e40ad00dfb576c322f3e1
133eb98c11817d1c864c6b89b35bcab90982f468
/MyProjectSpringBoot/src/main/java/com/cg/MyProjectSpringBoot/MyProjectSpringBootApplication.java
e2f40e13e8848a88ff9545aa7edc644b327c35df
[]
no_license
skbez1996/SpringBoot
b4be1169590debb3616aa1d1d8f7b414d8e381cc
0e58da4215235edc27e6e2ff7bdc9131fd830faf
refs/heads/master
2020-05-27T08:49:55.582226
2019-05-25T10:56:35
2019-05-25T10:56:35
188,553,817
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.cg.MyProjectSpringBoot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @ComponentScan("com.cg.MyProjectSpringBoot") public class MyProjectSpringBootApplication { public static void main(String[] args) { SpringApplication.run(MyProjectSpringBootApplication.class, args); System.out.println("hi.............."); } }
45343d39f5e342bd77a4622097b6f9f9b36bf5e8
c697b14836a01be88e6bbf43ac648be83426ade0
/Algorithms/1001-2000/1424. Diagonal Traverse II/Solution.java
0a188118da085f06a1e75efccbeda5d84676477c
[]
no_license
jianyimiku/My-LeetCode-Solution
8b916d7ebbb89606597ec0657f16a8a9e88895b4
48058eaeec89dc3402b8a0bbc8396910116cdf7e
refs/heads/master
2023-07-17T17:50:11.718015
2021-09-05T06:27:06
2021-09-05T06:27:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,072
java
class Solution { public int[] findDiagonalOrder(List<List<Integer>> nums) { PriorityQueue<int[]> priorityQueue = new PriorityQueue<int[]>(new Comparator<int[]>() { public int compare(int[] position1, int[] position2) { int sum1 = position1[0] + position1[1], sum2 = position2[0] + position2[1]; if (sum1 != sum2) return sum1 - sum2; else return position2[0] - position1[0]; } }); int rows = nums.size(); for (int i = 0; i < rows; i++) { int columns = nums.get(i).size(); for (int j = 0; j < columns; j++) priorityQueue.offer(new int[]{i, j}); } int size = priorityQueue.size(); int[] orderArray = new int[size]; for (int i = 0; i < size; i++) { int[] position = priorityQueue.poll(); int row = position[0], column = position[1]; orderArray[i] = nums.get(row).get(column); } return orderArray; } }
7a570f8d9df8718e0cc8b3bae36762cd5b91986c
df552a57d06b5911e268ea5cc962575cd7f9b2e8
/level08/lesson03/task06/Solution.java
aa9eee84a98c7f205e18a6209277c61db6583e26
[]
no_license
zakharowow/JR
9a1a96df9039f082bee252445ace5e1088723659
408543d54687d054c47f182be3a21f2f6125a827
refs/heads/master
2021-01-20T22:14:51.780553
2017-08-29T20:31:08
2017-08-29T21:07:42
101,800,577
0
0
null
null
null
null
UTF-8
Java
false
false
1,411
java
package com.javarush.test.level08.lesson03.task06; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /* Коллекция HashMap из Object Есть коллекция HashMap<String, Object>, туда занесли 10 различных пар объектов. Вывести содержимое коллекции на экран, каждый элемент с новой строки. Пример вывода (тут показана только одна строка): Sim - 5 */ public class Solution { public static void main(String[] args) throws Exception { HashMap<String, Object> map = new HashMap<String, Object>(); map.put("Sim", 5); map.put("Tom", 5.5); map.put("Arbus", false); map.put("Baby", null); map.put("Cat", "Cat"); map.put("Eat", new Long(56)); map.put("Food", new Character('3')); map.put("Gevey", '6'); map.put("Hugs", 111111111111L); map.put("Comp", (double)123); Iterator<Map.Entry<String, Object>> iterator = map.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry<String, Object> pair = iterator.next(); String key = pair.getKey(); Object value = pair.getValue(); System.out.println(key + " - " + value); } //напишите тут ваш код } }
f87893e48e4219aaa53a0ebfcff60921e132e0e8
b111b77f2729c030ce78096ea2273691b9b63749
/db-example-large-multi-project/project24/src/main/java/org/gradle/test/performance/mediumjavamultiproject/project24/p120/Production2415.java
71092a1349db836a3c6e910b55d95279bfe54cdd
[]
no_license
WeilerWebServices/Gradle
a1a55bdb0dd39240787adf9241289e52f593ccc1
6ab6192439f891256a10d9b60f3073cab110b2be
refs/heads/master
2023-01-19T16:48:09.415529
2020-11-28T13:28:40
2020-11-28T13:28:40
256,249,773
1
0
null
null
null
null
UTF-8
Java
false
false
1,896
java
package org.gradle.test.performance.mediumjavamultiproject.project24.p120; public class Production2415 { private String property0; public String getProperty0() { return property0; } public void setProperty0(String value) { property0 = value; } private String property1; public String getProperty1() { return property1; } public void setProperty1(String value) { property1 = value; } private String property2; public String getProperty2() { return property2; } public void setProperty2(String value) { property2 = value; } private String property3; public String getProperty3() { return property3; } public void setProperty3(String value) { property3 = value; } private String property4; public String getProperty4() { return property4; } public void setProperty4(String value) { property4 = value; } private String property5; public String getProperty5() { return property5; } public void setProperty5(String value) { property5 = value; } private String property6; public String getProperty6() { return property6; } public void setProperty6(String value) { property6 = value; } private String property7; public String getProperty7() { return property7; } public void setProperty7(String value) { property7 = value; } private String property8; public String getProperty8() { return property8; } public void setProperty8(String value) { property8 = value; } private String property9; public String getProperty9() { return property9; } public void setProperty9(String value) { property9 = value; } }
ce520b5bd574cb3d3176554a9f463e4f2290048b
47cb86e9a3a4de35660633b05666bf65ca4b2bb1
/Pertemuan11/Teori/CRUD_MVC/src/mvc/DAOInterface/IMahasiswa.java
eb3bce7ddb2fdf79353d78a4cf2b66f18a405419
[]
no_license
arifanf/PBO4417
ad1dda59207c966319428b488b1179f27f119d94
fd161230e7ba689c6078722b2e644530b7493d43
refs/heads/main
2023-05-15T15:00:25.665773
2021-06-13T15:00:12
2021-06-13T15:00:12
344,039,271
0
1
null
null
null
null
UTF-8
Java
false
false
511
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package mvc.DAOInterface; import java.util.List; import mvc.Model.*; /** * * @author ASUS */ public interface IMahasiswa { public void insert(Mahasiswa b); public void update(Mahasiswa b); public void delete(int id); public List<Mahasiswa> getAll(); public List<Mahasiswa> getCariNama(String nama); }
fdc7b43087b208fab6ccba89d0dad1eff64750b4
97c44ed6dc4468d9536f5efafaf605ae336092e1
/app/global/Global.java
abd9fdde856d7d8c466c52a60d2bf4ea41311052
[ "Apache-2.0" ]
permissive
luciojp/si1-lab03
d4ace64c9925976bb6948b3d0402d9963e9d183b
b44b01598fe6982c02c529d25696203f8330726c
refs/heads/master
2021-01-10T07:40:59.076602
2015-11-06T01:56:48
2015-11-06T01:56:48
45,651,919
0
0
null
null
null
null
UTF-8
Java
false
false
4,638
java
package global; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import models.Anunciante; import models.Anuncio; import models.Contato; import models.EstiloQueGosta; import models.EstiloQueNaoGosta; import models.Instrumento; import models.DAO.GenericDAO; import play.Application; import play.GlobalSettings; import play.Logger; import play.db.jpa.JPA; public class Global extends GlobalSettings { private static GenericDAO dao = new GenericDAO(); public void onStart(Application app) { Logger.info("Aplicação inicializada..."); JPA.withTransaction(new play.libs.F.Callback0() { @SuppressWarnings("resource") @Override public void invoke() throws Throwable { /* * Cadastrar estilos no Bando de Dados */ Scanner in; in = new Scanner(new FileReader(new File("app/estilos.dat") .getCanonicalPath())); while (in.hasNextLine()) { String nomeEstilo = in.nextLine(); dao.persist(new EstiloQueGosta(nomeEstilo)); dao.persist(new EstiloQueNaoGosta(nomeEstilo)); } dao.flush(); /* * Cadastrar instrumentos no Bandode Dados */ in = new Scanner(new FileReader( new File("app/instrumentos.dat").getCanonicalPath())); while (in.hasNextLine()) { String nomeInstrumentos = in.nextLine(); dao.persist(new Instrumento(nomeInstrumentos)); } dao.flush(); /* * Teste */ for (int i = 0; i < 10; i++) { Anuncio anuncio = new Anuncio(); Anunciante anunciante = new Anunciante(); Contato contatos = new Contato(); List<Instrumento> instrumentos = new ArrayList<>(); List<EstiloQueGosta> gosta = new ArrayList<>(); List<EstiloQueNaoGosta> naoGosta = new ArrayList<>(); if (i % 2 == 0) { anuncio.setTitulo("Quero tocar ocasionalmente"); anuncio.setDescricao("Procuro eventos para tocar ocasionalmente.Procuro eventos para tocar ocasionalmente.Procuro eventos para tocar ocasionalmente.Procuro eventos para tocar ocasionalmente.Procuro eventos para tocar ocasionalmente."); anuncio.setPalavraChave("javaIsLife"); anunciante.setCidade("João Pessoa"); anunciante.setBairro("Altiplano"); anunciante.setOndeTocar("Em Banda"); instrumentos.add(new Instrumento("Violino")); instrumentos.add(new Instrumento("Violoncelo")); anunciante.setListInstrumentos(instrumentos); gosta.add(new EstiloQueGosta("Erudito")); gosta.add(new EstiloQueGosta("Instrumental")); gosta.add(new EstiloQueGosta("MPB")); anunciante.setListEstilos(gosta); naoGosta.add(new EstiloQueNaoGosta("Funk")); naoGosta.add(new EstiloQueNaoGosta("Funk Carioca")); anunciante.setListEstilosQueNaoGosta(naoGosta); contatos.setEmail("[email protected]"); contatos.setFacebook("http://www.facebook.com.br/celloandviolin"); contatos.setTelefone("(83)99123-4567"); dao.persist(contatos); dao.flush(); anunciante.setContato(contatos); dao.persist(anunciante); dao.flush(); anuncio.setAnunciante(anunciante); dao.persist(anuncio); dao.flush(); } else { anuncio.setTitulo("Procuro banda de MPB/Clássico"); anuncio.setDescricao("Procuro uma banda que seja voltada para o estilo MPB/Clássico, tenho disponibilidade todos os finais de semana. Para enventos durante a semana, combinar antecipadamente."); anuncio.setPalavraChave("PythonNaoEhTaoLegal"); anunciante.setCidade("João Pessoa"); anunciante.setBairro("Torre"); anunciante.setOndeTocar("Ocasionalmente"); instrumentos.add(new Instrumento("Clarinete")); instrumentos.add(new Instrumento("Banjo")); anunciante.setListInstrumentos(instrumentos); gosta.add(new EstiloQueGosta("Jazz")); gosta.add(new EstiloQueGosta("Instrumental")); anunciante.setListEstilos(gosta); naoGosta.add(new EstiloQueNaoGosta("Funk")); naoGosta.add(new EstiloQueNaoGosta("Folk")); anunciante.setListEstilosQueNaoGosta(naoGosta); contatos.setEmail("[email protected]"); contatos.setFacebook("http://www.facebook.com.br/seiLaJovem"); contatos.setTelefone("(83)99876-5432"); dao.persist(contatos); dao.flush(); anunciante.setContato(contatos); dao.persist(anunciante); dao.flush(); anuncio.setAnunciante(anunciante); dao.persist(anuncio); dao.flush(); } } } }); } public void onStop(Application app) { Logger.info("Aplicação desligada..."); } }
eab704a61636a20ace0e02c56c0024dad845fb04
d86434c92629782cc9821c3b4837144e3bdf46d2
/hazelcast-jet-core/src/main/java/com/hazelcast/jet/Util.java
c3a3101193e68cd31306fbe93adbb2462003d8d7
[ "Apache-2.0" ]
permissive
wildnez/hazelcast-jet
6dd9a984dd99f3aad2aad8a716821691ccb0077a
500ed385bf80de9d9ed52b597a13d0a58ab81c88
refs/heads/master
2021-01-19T15:25:41.519874
2017-04-13T11:20:44
2017-04-13T11:20:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,054
java
/* * Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.jet; import java.util.AbstractMap.SimpleImmutableEntry; import java.util.Map.Entry; /** * Miscellaneous utility methods useful in DAG building logic. */ public final class Util { private Util() { } /** * Returns a {@code Map.Entry} with the given key and value. */ public static <K, V> Entry<K, V> entry(K k, V v) { return new SimpleImmutableEntry<>(k, v); } }
2e17bd8e7cff904e83e957c67ef2ae6b5f25e6db
af27191e73c1dbc9b19f78e1360385bb77a5b3b3
/app/src/main/java/com/example/safwat/twitterapp/Fragment/FollowerFragment.java
29d6a05c27b4e7e769dbc658aab3f9801224e7fd
[]
no_license
SafwatNassif/Twitter-App
8a43d58ca287787c46ebb73c58d727d7bfe54a3d
740d7d2da914546f2b86eb752a306637f513fc8d
refs/heads/master
2020-03-07T19:24:20.779070
2018-04-06T23:02:26
2018-04-06T23:02:26
127,669,412
0
0
null
null
null
null
UTF-8
Java
false
false
3,566
java
package com.example.safwat.twitterapp.Fragment; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.example.safwat.twitterapp.Adapter.FollowersAdapter; import com.example.safwat.twitterapp.Model.TwitterFollower; import com.example.safwat.twitterapp.Presenter.FollowerPresenterFragment; import com.example.safwat.twitterapp.View.FollowerActivityViewInterface; import com.example.safwat.twitterapp.PresenterInterface.FollowerPresenterFragmentInterface; import com.example.safwat.twitterapp.R; import com.example.safwat.twitterapp.View.FollowersViewInterface; import com.twitter.sdk.android.core.models.User; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ public class FollowerFragment extends Fragment implements FollowersViewInterface, SwipeRefreshLayout.OnRefreshListener, Runnable { private FollowerPresenterFragmentInterface followerPresenterFragmentInterface; private RecyclerView recyclerView; private FollowersAdapter adapter; private SwipeRefreshLayout refreshLayout; public FollowerFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View RootView = inflater.inflate(R.layout.fragment_follower, container, false); recyclerView =(RecyclerView) RootView.findViewById(R.id.follower_list); refreshLayout =(SwipeRefreshLayout) RootView.findViewById(R.id.refresh_follower); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext()); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setVisibility(View.GONE); refreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorAccent)); refreshLayout.setOnRefreshListener(this); followerPresenterFragmentInterface = new FollowerPresenterFragment(this); onRefresh(); return RootView; } // after fetch follower we need to show them in list // so, i create adapter and pass data to it @Override public void OnFetchFollowers(List<TwitterFollower> followers) { ArrayList<TwitterFollower> arrayList = new ArrayList<>(followers); adapter = new FollowersAdapter(getContext(),R.layout.follower_item,arrayList); refreshLayout.setRefreshing(false); recyclerView.setAdapter(adapter); // we need notify adapter to change in case there is any data change adapter.notifyDataSetChanged(); recyclerView.setVisibility(View.VISIBLE); } // in case there is no follower @Override public void onEmptyFollowers() { Toast.makeText(getContext(), getContext().getResources().getString(R.string.no_follower) , Toast.LENGTH_SHORT).show(); } // refresh method using to update twitter follower data if any change happen @Override public void onRefresh() { refreshLayout.setRefreshing(true); new Handler().postDelayed(this,1000); } @Override public void run() { followerPresenterFragmentInterface.getFollowers(); } }
9786e61138ad03899496f5abf451d4296d9fb747
bdaec2080187a972f9ff5f7d8e3aae4486fb8a5f
/src/PalaDog/Bear.java
487ae7f6fe72245b0b69a824fde3f09ebc14e557
[]
no_license
dlfl1506/PalaDogProJect
0c59a579db219a5e5a01030e61ae1a0e8124ec5d
00e032e09d584627cd13697d405a2c46e4231d2d
refs/heads/master
2023-02-26T18:11:24.000061
2021-02-02T00:50:08
2021-02-02T00:50:08
321,894,894
1
0
null
null
null
null
UHC
Java
false
false
3,060
java
package PalaDog; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JLabel; import DarkDog.DarkDog; import DarkDog.Zombie; import Main.GamePanel; import lombok.Data; @Data public class Bear extends JLabel { public ImageIcon bearIcon, bear_attackicon; public Bear bear = this; public GamePanel gamepanel; public int x = 0; public int y = 220; public int z = 30; public int hp = 50; public int attack = 10; public final static String TAG = "Bear:"; public boolean isMoving = true; public Bear() { bearIcon = new ImageIcon("images/bear_walk.gif"); bear_attackicon = new ImageIcon("images/bear_attack.gif"); setIcon(bearIcon); setSize(120, 120); setLocation(x, y); MoveLight(); } public void MoveLight() { new Thread(new Runnable() { @Override public void run() { while (true) { try { Thread.sleep(1); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } while (isMoving) { bear.x += 10; setLocation(x, y); try { Thread.sleep(200); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }).start(); } public static void Bear_attack(ArrayList<Bear> bear, ArrayList<Zombie> zombie, DarkDog darkdog) { new Thread(new Runnable() { @Override public void run() { while (true) { try { Thread.sleep(1); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { for (int i = 0; i < bear.size(); i++) { for (int j = 0; j < zombie.size(); j++) { try { if (bear.get(i).x >= zombie.get(j).x - 100) { System.out.println("false실행"); bear.get(i).isMoving = false; bear.get(i).setIcon(bear.get(i).bear_attackicon); Thread.sleep(500); try { zombie.get(j).hp = zombie.get(j).hp - bear.get(i).attack; } catch (Exception e) { // TODO: handle exception } } } catch (Exception e) { // TODO: handle exception } } } for (int i = 0; i < bear.size(); i++) { for (int j = 0; j < zombie.size(); j++) { if (bear.get(i).x >= darkdog.getX() - 100 && darkdog.getX() <= bear.get(i).x +100) { System.out.println("다크독공격실행"); bear.get(i).isMoving = false; bear.get(i).setIcon(bear.get(i).bear_attackicon); Thread.sleep(500); darkdog.hp = darkdog.hp - bear.get(i).attack; } else { try { bear.get(i).isMoving = true; bear.get(i).setIcon(bear.get(i).bearIcon); Thread.sleep(100); } catch (Exception e) { // TODO: handle exception } } } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }).start(); } }
164fa58ac44d9cd8968993b723e1d921e67c7975
05f8f42eaa3aeedb42aea8e495ddd35d8e4785e6
/src/main/java/com/foodiechef/api/service/dto/CusineCriteria.java
e6e7cb8224d9b794e04f025fce28675cffeed7cf
[]
no_license
bhargav224/foodie_chef
a37fbb7628cb1003f31a60795049e32f541eaa26
74653d7e0696a11599312db01ade36ae843e2cf5
refs/heads/master
2020-05-25T11:10:10.249129
2019-05-21T06:26:43
2019-05-21T06:26:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,519
java
package com.foodiechef.api.service.dto; import java.io.Serializable; import java.util.Objects; import io.github.jhipster.service.filter.BooleanFilter; import io.github.jhipster.service.filter.DoubleFilter; import io.github.jhipster.service.filter.Filter; import io.github.jhipster.service.filter.FloatFilter; import io.github.jhipster.service.filter.IntegerFilter; import io.github.jhipster.service.filter.LongFilter; import io.github.jhipster.service.filter.StringFilter; /** * Criteria class for the Cusine entity. This class is used in CusineResource to * receive all the possible filtering options from the Http GET request parameters. * For example the following could be a valid requests: * <code> /cusines?id.greaterThan=5&amp;attr1.contains=something&amp;attr2.specified=false</code> * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use * fix type specific filters. */ public class CusineCriteria implements Serializable { private static final long serialVersionUID = 1L; private LongFilter id; private BooleanFilter active; private StringFilter description; private StringFilter name; private LongFilter recipeId; private LongFilter menuItemId; public LongFilter getId() { return id; } public void setId(LongFilter id) { this.id = id; } public BooleanFilter getActive() { return active; } public void setActive(BooleanFilter active) { this.active = active; } public StringFilter getDescription() { return description; } public void setDescription(StringFilter description) { this.description = description; } public StringFilter getName() { return name; } public void setName(StringFilter name) { this.name = name; } public LongFilter getRecipeId() { return recipeId; } public void setRecipeId(LongFilter recipeId) { this.recipeId = recipeId; } public LongFilter getMenuItemId() { return menuItemId; } public void setMenuItemId(LongFilter menuItemId) { this.menuItemId = menuItemId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final CusineCriteria that = (CusineCriteria) o; return Objects.equals(id, that.id) && Objects.equals(active, that.active) && Objects.equals(description, that.description) && Objects.equals(name, that.name) && Objects.equals(recipeId, that.recipeId) && Objects.equals(menuItemId, that.menuItemId); } @Override public int hashCode() { return Objects.hash( id, active, description, name, recipeId, menuItemId ); } @Override public String toString() { return "CusineCriteria{" + (id != null ? "id=" + id + ", " : "") + (active != null ? "active=" + active + ", " : "") + (description != null ? "description=" + description + ", " : "") + (name != null ? "name=" + name + ", " : "") + (recipeId != null ? "recipeId=" + recipeId + ", " : "") + (menuItemId != null ? "menuItemId=" + menuItemId + ", " : "") + "}"; } }
91e9b7e0692e40f981f1ad48edfc16616aec6f27
f47330aaf4fec44fe0ab355930eb141fb432ffe7
/src/main/java/ai/labs/eddi/modules/nlp/expressions/value/AllValue.java
9d1b61fd915f66b2a398b9003c1d7c2c2dee914b
[ "Apache-2.0" ]
permissive
labsai/EDDI
2451c4601383a37b60808380d47ea84d2232f55d
11c82e33f3fabf2655f2c94b4ffd18bae1ff550d
refs/heads/main
2023-09-04T06:27:13.968221
2023-08-16T14:33:33
2023-08-16T14:33:33
70,809,374
257
102
null
2023-05-02T16:52:33
2016-10-13T13:29:22
Java
UTF-8
Java
false
false
249
java
package ai.labs.eddi.modules.nlp.expressions.value; import ai.labs.eddi.modules.nlp.expressions.Expression; /** * @author ginccc */ public class AllValue extends Expression { public AllValue() { this.expressionName = "all"; } }
4c1c6d6592f53e3e857485d85d9f3b3fb58bac06
a0584bbe4a6f7ba10a3dea52dc6bae130093b063
/testme/HW01/src/ee/ttu/algoritmid/tsp/Main.java
1e24936d36dcb16f8b55c4590fa81850e470121b
[]
no_license
PraiseTheSun-MySunBro/test4
2c7aa420fa8949a6093abf1884fab9f61f66beda
a83610acf3f5e2a6a6e7bdacfd34128ce800367f
refs/heads/master
2020-03-19T01:54:35.842834
2018-05-31T15:44:42
2018-05-31T15:44:42
135,581,666
0
0
null
null
null
null
UTF-8
Java
false
false
239
java
package ee.ttu.algoritmid.tsp; public class Main { public static void main(String[] args) throws Exception { TSP tsp = new TSP(); System.out.println(tsp.depthFirst(MatrixLoader.loadFile("asymmetric.in", 15))); } }
8e59b7a3614fd2ed2e24a763d989ac839c7fa59c
dcd1eaaa1753da09de44f86a93575fa45b6f6273
/src/main/java/roc/tarek/mobileappws/ui/model/response/UserRest.java
0cdab8e8365b7ae4110e2c5ceefcad7cc511a182
[]
no_license
TarekROCs/mobile-app-ws
435efdf2327aed1b08cab26b4e0409a8bc878f30
20f27b77009f44d120202e1d998d0e5f1f8b3a2b
refs/heads/master
2022-11-20T10:06:43.400618
2020-07-14T14:44:52
2020-07-14T14:44:52
275,560,457
0
0
null
null
null
null
UTF-8
Java
false
false
1,028
java
package roc.tarek.mobileappws.ui.model.response; import java.util.List; public class UserRest { private String userId; private String firstName; private String lastName; private String email; private List<AddressRest> addresses; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public List<AddressRest> getAddresses() { return addresses; } public void setAddresses(List<AddressRest> addresses) { this.addresses = addresses; } }
6dd9c0fc027921b68bbc5a63337d882e3615550d
7341c05fcc031b1a36b3d5b49ad2b7fff465060d
/src/main/java/com/dsm/ims/domains/service/JwtService.java
d46f2a36975cc5f4a5b7b8a21daaae506326017b
[ "MIT" ]
permissive
DSM-IMS/White
4257fd57492204685dd1e6d5dd58c780ce07f88c
b58dc505d1ff309f5a84497e862e68f33552d05f
refs/heads/master
2022-11-26T06:22:30.200970
2020-08-10T00:16:10
2020-08-10T00:16:10
284,575,851
0
0
null
null
null
null
UTF-8
Java
false
false
2,837
java
package com.dsm.ims.domains.service; import com.dsm.ims.utils.exception.TokenExpirationException; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.stereotype.Service; import javax.crypto.spec.SecretKeySpec; import javax.xml.bind.DatatypeConverter; import java.security.Key; import java.util.Date; @Service public class JwtService { private static final String SECURE_KEY = "dhwlddjgmanf"; private static final byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(SECURE_KEY); private static final SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; private static final Key KEY = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName()); public String createAccessToken(String userId){ return Jwts.builder() .setHeaderParam("typ", "JWT") .setSubject("access token") .claim("id", userId) .setExpiration(new Date(System.currentTimeMillis() + (1000 * 60 * 30))) // 30분 .signWith(signatureAlgorithm, KEY) .compact(); } public String createRefreshToken(String userId) { return Jwts.builder() .setHeaderParam("typ", "JWT") .setSubject("reflash token") .claim("id", userId) .setExpiration(new Date(System.currentTimeMillis() + (1000 * 60 * 60 * 24 * 7))) // 2주 .signWith(signatureAlgorithm, KEY) .compact(); } public Date getExpiration(String token) { return Jwts.parser() .setSigningKey(KEY) .parseClaimsJws(token) .getBody() .getExpiration(); } public boolean isValid(String token) { try { Jws<Claims> jws = Jwts.parser() .setSigningKey(KEY) .parseClaimsJws(token); return true; } catch(Exception e) { throw new TokenExpirationException(); } } public boolean isTimeOut(String token) { try { Date now = new Date(); Date expiration = Jwts.parser() .setSigningKey(KEY) .parseClaimsJws(token) .getBody() .getExpiration(); if(expiration.after(now)) return true; return false; } catch(Exception e) { return false; } } public void killToken(String token) { Jwts.parser() .setSigningKey(KEY) .parseClaimsJws(token) .getBody() .getExpiration() .setTime(0); } }
acced9835c53dcf7d7d6ffa3dfdb4906be40c8c5
7a45a7fcad8d560bc4fa8444d7264ce5d96a334c
/albedo-boot-data/albedo-boot-data-mybatis/albedo-boot-data-mybatis-domain/src/main/java/com/albedo/java/modules/sys/domain/Dict.java
0e27fa799f3eca6b0d26130a616c566546fc307a
[ "Apache-2.0" ]
permissive
hfye/albedo-boot-freemaker
bc838e32563c97ce21a5a20693076690000debf9
9ff25f16427a836817c408e2eb2cf896970618fe
refs/heads/master
2020-03-15T20:52:52.031487
2018-02-26T03:24:07
2018-02-26T03:24:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,928
java
package com.albedo.java.modules.sys.domain; import com.albedo.java.common.domain.base.TreeEntity; import com.albedo.java.util.PublicUtil; import com.albedo.java.util.annotation.DictType; import com.albedo.java.util.annotation.SearchField; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; import org.springframework.data.annotation.Transient; import org.springframework.data.mybatis.annotations.Column; import org.springframework.data.mybatis.annotations.Entity; import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlAttribute; /** * Copyright 2013 albedo All right reserved Author lijie Created on 2013-10-23 * 下午1:55:43 */ @Entity(table = "sys_dict_t") @Data @AllArgsConstructor @ToString @NoArgsConstructor public class Dict extends TreeEntity<Dict> { /** * 叶子节点 */ public static final String FLAG_LEAF = "0"; /** * 非叶子节点 */ public static final String FLAG_UNLEAF = "1"; public static final String F_CODE = "code"; public static final String F_VAL = "val"; private static final long serialVersionUID = 1L; /*** 编码 */ @SearchField @Column(name = "code_") private String code; /*** 字典值 */ @Column(name = "val_") private String val; /*** 资源文件key */ @Column(name = "show_name") private String showName; /*** key */ @Column(name = "key_") private String key; @NotNull @Column(name = "is_show") @DictType(name = "sys_yes_no") private Integer isShow = 1; @Transient private String parentCode; public Dict(String id) { this.id = id; } public String getShowName() { return showName; } public void setShowName(String showName) { this.showName = showName; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } @XmlAttribute public String getVal() { return val; } public void setVal(String val) { this.val = val; } public Integer getIsShow() { return isShow; } public void setIsShow(Integer isShow) { this.isShow = isShow; } @XmlAttribute public String getDescription() { return super.getDescription(); } public void setDescription(String description) { super.setDescription(description); } @XmlAttribute public String getName() { return super.getName(); } public void setName(String name) { super.setName(name); } public String getParentCode() { if (PublicUtil.isEmpty(parentCode) && parent != null) { parentCode = parent.getCode(); } return parentCode; } public void setParentCode(String parentCode) { this.parentCode = parentCode; } }
e28ec76364a3fd6fe40deffef5f2f110b3605b6e
dfb153aa744466a1fe5ba2202ba38b2d61e1347f
/app/src/main/java/com/matajarbybaqalath/recyclerviewbounceswipe/MainActivity.java
ab354f5e91e51166451959a69ef6534b9252533c
[]
no_license
kariot/RecyclerView-Bouncing-Swipe
4c6756711f570df982be1728a986569ac7464d9d
7d17a7deb4f98c7f1391077a77e49c3b07cb2bae
refs/heads/master
2022-11-20T11:05:17.227625
2020-07-17T11:41:06
2020-07-17T11:41:06
280,407,579
2
0
null
null
null
null
UTF-8
Java
false
false
2,418
java
package com.matajarbybaqalath.recyclerviewbounceswipe; import android.content.DialogInterface; import android.os.Bundle; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private RecyclerView recyclerMain; private AdapterMain adapterMain; private ArrayList<String> data = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initViews(); initRecycler(); } //sets properties for recyclerview private void initRecycler() { for (int i = 0; i < 20; i++) { //adds data for data list data.add("item " + 1); } adapterMain = new AdapterMain(data); recyclerMain.setAdapter(adapterMain); //sets recyclerview itemtouch helper new ItemTouchHelper(new RecyclerItemTouchHelper(getApplicationContext(), new RecyclerItemTouchHelper.ItemSwipe() { @Override public void onSwipeLeft(RecyclerView.ViewHolder viewHolder, int position) { //left swipe callback deleteItem(viewHolder); } @Override public void onSwipeRight(RecyclerView.ViewHolder viewHolder, int position) { //right swipe call back deleteItem(viewHolder); } }, 0, ItemTouchHelper.RIGHT | ItemTouchHelper.LEFT)).attachToRecyclerView(recyclerMain); } //to show dialog and delete item private void deleteItem(final RecyclerView.ViewHolder viewHolder) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setTitle("Delete Item?"); builder.setMessage("Are you sure to delete the item?"); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { adapterMain.removeItem(viewHolder.getAdapterPosition()); } }); builder.setNegativeButton("Cancel", null); builder.show(); } private void initViews() { recyclerMain = findViewById(R.id.recyclerMain); } }
0c0eda1d8912824805c375bca674678b8887c4ab
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdasApi21/applicationModule/src/test/java/applicationModulepackageJava1/Foo530Test.java
91c2b74b2d80f961a2df0b56cba4605cb9981388
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package applicationModulepackageJava1; import org.junit.Test; public class Foo530Test { @Test public void testFoo0() { new Foo530().foo0(); } @Test public void testFoo1() { new Foo530().foo1(); } @Test public void testFoo2() { new Foo530().foo2(); } @Test public void testFoo3() { new Foo530().foo3(); } @Test public void testFoo4() { new Foo530().foo4(); } @Test public void testFoo5() { new Foo530().foo5(); } }
4e5920a7c836567bead0ce43597c521b11c9df93
33103daaf5baf08ebff508eb2e12565931e3bcdf
/java/sample/spring/src/main/java/org/coder/gear/sample/spring/domain/entity/AbstractEntity.java
85ad3d8d21267723c53ba6c1e20858764a8cb65d
[]
no_license
nysd-backup/backup
be8052e826ce263f1f70ac3e5fe4050684aab2f2
f94b52555fdb0d1e2e62ea972b259e6fa7f15770
refs/heads/master
2020-04-09T12:45:32.496982
2014-06-11T14:01:07
2014-06-11T14:01:07
2,390,262
0
0
null
null
null
null
UTF-8
Java
false
false
475
java
/** * */ package org.coder.gear.sample.spring.domain.entity; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; /** * ドメイン層のエンティティの規定 . * * @author yoshida-n * */ public abstract class AbstractEntity { /** * @see java.lang.Object#toString() */ @Override public String toString(){ return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE); } }
9ce7d1c79c47ba112fad894c4724cd0b7d43e609
3a70de17cc8890e3b7555f190ccbf469db72627e
/leriando/src/main/java/com/estdois/leriando/controller/ComentarioController.java
c57038c7ba826940767443a8369b09627824ff63
[]
no_license
joaopfds/Leriando
fd6b1af9a8c019e7ce3c3c72d2be909c500ddf33
f950f59e6dbfb0d259f0e044040d1f0b967ab294
refs/heads/master
2023-04-15T22:41:11.585114
2021-04-05T23:22:47
2021-04-05T23:22:47
354,439,494
0
0
null
2021-04-05T23:22:48
2021-04-04T02:34:16
Java
UTF-8
Java
false
false
1,369
java
package com.estdois.leriando.controller; import com.estdois.leriando.entity.Comentario; import com.estdois.leriando.persistence.ComentarioRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class ComentarioController { @Autowired ComentarioRepository comentarioRepository; @RequestMapping("/coment") public String listarComentarios(Model model){ model.addAttribute("comentarios", comentarioRepository.findAll()); return "listaDeComentarios"; } @RequestMapping("/coment/add") public String addComentario(Model model){ model.addAttribute("comentario", new Comentario()); return "comentForm"; } @RequestMapping("/coment/process") public String processFrom(@Validated Comentario comentario, BindingResult result){ if (result.hasErrors()){ return "comentForm"; } if (comentario.getText() != ""){ comentarioRepository.save(comentario); return "redirect:/coment"; }else{ return "comentForm"; } } }
9efd76033bba92d80acfdb68f2fd5fdef803d17f
75288993ea274fb47f911b0aecb846bac3be3ed3
/src/main/java/factorypattern/method/BYDFactory.java
475a9f11c623b0a27c6308cccc0c23ff12d6a039
[]
no_license
mtswz-s/Design-pattern
09bd825bdc5719ff4f13e24e13fab3711de1c3d3
08a95b6231a6e867c6771863a75072e87b5c4327
refs/heads/master
2023-05-24T03:38:54.490110
2021-06-08T12:07:23
2021-06-08T12:07:23
374,993,803
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
package factorypattern.method; /** * @Author 麦田守望者 * @Date 2020/8/14 14:56 * @Version 1.0 */ public class BYDFactory implements CarFactory { @Override public Car creatCar() { return new BYD(); } }
4ec7a1d252148b682347614eafc67737d518714e
a21b11f300623376c701886bbd0f5d6ca3461052
/app/src/main/java/com/levqo/githubparsing/api/Service.java
b97dcf883d3e32d6954795bec0f998e23cf275c7
[]
no_license
LevQo/ParsingRepositories
2986d9fa001cca2351d943ccc684ea4d15124ea9
11abc3041d34b267ba3ae77f7e7d8afa3be59002
refs/heads/master
2020-03-31T18:20:52.444398
2018-10-12T19:12:36
2018-10-12T19:12:36
152,455,420
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package com.levqo.githubparsing.api; import com.levqo.githubparsing.model.Item; import java.util.List; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; /** * Created by user on 10.10.2018. */ public interface Service { @GET("/repositories") Call<List<Item>> getItem(@Query("since") int page); }
68426f017327470b3768bbcb75871308fe31725b
0e0dae718251c31cbe9181ccabf01d2b791bc2c2
/SCT2/tags/M_SCT_15/test-plugins/org.yakindu.sct.generator.core.test/src/org/yakindu/sct/generator/core/extensions/TypeAnalyzerExtensionsTest.java
dc799c8ecb1a3b8b2c85a8f18c64035723f43c0a
[]
no_license
huybuidac20593/yakindu
377fb9100d7db6f4bb33a3caa78776c4a4b03773
304fb02b9c166f340f521f5e4c41d970268f28e9
refs/heads/master
2021-05-29T14:46:43.225721
2015-05-28T11:54:07
2015-05-28T11:54:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,830
java
package org.yakindu.sct.generator.core.extensions; import static org.yakindu.sct.model.stext.test.util.StextTestFactory.*; import static org.junit.Assert.*; import org.eclipse.xtend.XtendFacade; import org.eclipse.xtend.expression.ExecutionContext; import org.eclipse.xtend.expression.ExecutionContextImpl; import org.eclipse.xtend.expression.TypeSystemImpl; import org.eclipse.xtend.typesystem.emf.EmfMetaModel; import org.junit.Test; import org.yakindu.base.base.BasePackage; import org.yakindu.base.types.Type; import org.yakindu.base.types.TypesPackage; import org.yakindu.sct.model.sgraph.SGraphPackage; import org.yakindu.sct.model.stext.stext.StextPackage; public class TypeAnalyzerExtensionsTest { private Object call(String methodName, Object... params) { TypeSystemImpl ts = new TypeSystemImpl(); ts.registerMetaModel(new EmfMetaModel(BasePackage.eINSTANCE)); ts.registerMetaModel(new EmfMetaModel(TypesPackage.eINSTANCE)); ts.registerMetaModel(new EmfMetaModel(SGraphPackage.eINSTANCE)); ts.registerMetaModel(new EmfMetaModel(StextPackage.eINSTANCE)); ExecutionContext ctx = new ExecutionContextImpl(ts); XtendFacade facade = XtendFacade .create(ctx, "org::yakindu::sct::generator::core::extensions::TypeAnalyzerExtensions"); Object result = facade.call(methodName, params); return result; } @Test public void testIsVoid() { Object result = call("isVoid", new Object[] { null }); assertEquals(Boolean.TRUE, result); Type type = _createType(null); result = call("isVoid", type); assertEquals(Boolean.TRUE, result); type.setName("void"); result = call("isVoid", type); assertEquals(Boolean.TRUE, result); type.setName("String"); result = call("isVoid", type); assertEquals(Boolean.FALSE, result); } }
1cbead5aaf48f7f47ff8744b4173e907d543a95d
73736c7ed32fad12dd23bdbe1ae498684929c10c
/RNNav0412/android/app/src/main/java/com/rnnav0412/MainActivity.java
04886fca0936015e51c848dd170b472f0a67883d
[]
no_license
zybug/React-Native-Demo
45f3a76c16762220c1066889353d97e09d133e19
a841a3c5b103f730f02a772e3ba03e841fa6d39f
refs/heads/master
2020-12-24T20:24:21.515153
2016-04-17T02:17:13
2016-04-17T02:17:13
56,414,786
0
0
null
null
null
null
UTF-8
Java
false
false
1,032
java
package com.rnnav0412; import com.facebook.react.ReactActivity; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import java.util.Arrays; import java.util.List; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "RNNav0412"; } /** * Returns whether dev mode should be enabled. * This enables e.g. the dev menu. */ @Override protected boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } /** * A list of packages used by the app. If the app uses additional views * or modules besides the default ones, add more packages here. */ @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage() ); } }
dee823d9a44b3df7e86281401af34993da975ffb
a12407032284238a299430cc2ed5326600b63652
/cachewebviewlib/src/main/java/ren/yale/android/cachewebviewlib/WebViewCacheInterceptor.java
174384e661cefc6d26911aa524aeeeba24348538
[ "MIT" ]
permissive
paperscz/CacheWebView
fd52882a54b240c075739b9da4d6b696d157ec80
8c7961fbce84a265b506bea8a92f11abb91a022e
refs/heads/master
2020-04-13T21:34:42.548628
2018-12-27T09:41:39
2018-12-27T09:41:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,277
java
package ren.yale.android.cachewebviewlib; import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.text.TextUtils; import android.webkit.WebResourceRequest; import android.webkit.WebResourceResponse; import android.webkit.WebView; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.X509TrustManager; import okhttp3.Cache; import okhttp3.CacheControl; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import ren.yale.android.cachewebviewlib.config.CacheExtensionConfig; import ren.yale.android.cachewebviewlib.utils.FileUtil; import ren.yale.android.cachewebviewlib.utils.MimeTypeMapUtils; import ren.yale.android.cachewebviewlib.utils.NetUtils; import ren.yale.android.cachewebviewlib.utils.OKHttpFile; /** * Created by yale on 2018/7/13. */ public class WebViewCacheInterceptor implements WebViewRequestInterceptor { private File mCacheFile; private long mCacheSize; private long mConnectTimeout; private long mReadTimeout ; private CacheExtensionConfig mCacheExtensionConfig; private Context mContext; private boolean mDebug; private CacheType mCacheType; private String mAssetsDir = null; private boolean mTrustAllHostname=false; private SSLSocketFactory mSSLSocketFactory =null; private X509TrustManager mX509TrustManager = null; private ResourceInterceptor mResourceInterceptor; private boolean mIsSuffixMod=false; //============== private OkHttpClient mHttpClient = null; private String mOrigin = ""; private String mReferer=""; private String mUserAgent=""; public static final String KEY_CACHE="WebResourceInterceptor-Key-Cache"; public WebViewCacheInterceptor(Builder builder){ this.mCacheExtensionConfig = builder.mCacheExtensionConfig; this.mCacheFile = builder.mCacheFile; this.mCacheSize = builder.mCacheSize; this.mCacheType = builder.mCacheType; this.mConnectTimeout = builder.mConnectTimeout; this.mReadTimeout = builder.mReadTimeout; this.mContext = builder.mContext; this.mDebug = builder.mDebug; this.mAssetsDir = builder.mAssetsDir; this.mX509TrustManager = builder.mX509TrustManager; this.mSSLSocketFactory = builder.mSSLSocketFactory; this.mTrustAllHostname = builder.mTrustAllHostname; this.mResourceInterceptor = builder.mResourceInterceptor; this.mIsSuffixMod = builder.mIsSuffixMod; initHttpClient(); if (isEnableAssets()){ initAssetsLoader(); } } private boolean isEnableAssets(){ return mAssetsDir != null; } private void initAssetsLoader(){ AssetsLoader.getInstance().init(mContext).setDir(mAssetsDir).isAssetsSuffixMod(mIsSuffixMod); } private void initHttpClient(){ final Cache cache = new Cache(mCacheFile,mCacheSize); OkHttpClient.Builder builder = new OkHttpClient.Builder() .cache(cache) .connectTimeout(mConnectTimeout, TimeUnit.SECONDS) .readTimeout(mReadTimeout, TimeUnit.SECONDS) .addNetworkInterceptor(new HttpCacheInterceptor()); if (mTrustAllHostname){ builder.hostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }); } if(mSSLSocketFactory!=null&&mX509TrustManager!=null){ builder.sslSocketFactory(mSSLSocketFactory,mX509TrustManager); } mHttpClient = builder.build(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public WebResourceResponse interceptRequest( WebResourceRequest request) { return interceptRequest(request.getUrl().toString(),request.getRequestHeaders()); } private Map<String, String> buildHeaders(){ Map<String, String> headers = new HashMap<String, String>(); if (!TextUtils.isEmpty(mOrigin)){ headers.put("Origin",mOrigin); } if (!TextUtils.isEmpty(mReferer)){ headers.put("Referer",mReferer); } if (!TextUtils.isEmpty(mUserAgent)){ headers.put("User-Agent",mUserAgent); } return headers; } @Override public WebResourceResponse interceptRequest(String url) { return interceptRequest(url,buildHeaders()); } private boolean checkUrl(String url){ if (TextUtils.isEmpty(url)) { return false; } if (!url.startsWith("http")) { return false; } if (mResourceInterceptor!=null&&!mResourceInterceptor.interceptor(url)){ return false; } String extension = MimeTypeMapUtils.getFileExtensionFromUrl(url); if (TextUtils.isEmpty(extension)) { return false; } if (mCacheExtensionConfig.isMedia(extension)) { return false; } if (!mCacheExtensionConfig.canCache(extension)) { return false; } return true; } @Override public void loadUrl(WebView webView, String url) { if (!url.startsWith("http")){ return; } webView.loadUrl(url); mReferer = webView.getUrl(); mOrigin = NetUtils.getOriginUrl(mReferer); mUserAgent = webView.getSettings().getUserAgentString(); } @Override public void loadUrl(String url, String userAgent) { if (!url.startsWith("http")){ return; } mReferer = url; mOrigin = NetUtils.getOriginUrl(mReferer); mUserAgent = userAgent; } @Override public void loadUrl(String url, Map<String, String> additionalHttpHeaders, String userAgent) { if (!url.startsWith("http")){ return; } mReferer = url; mOrigin = NetUtils.getOriginUrl(mReferer); mUserAgent = userAgent; } @Override public void loadUrl(WebView webView, String url, Map<String, String> additionalHttpHeaders) { if (!url.startsWith("http")){ return; } webView.loadUrl(url,additionalHttpHeaders); mReferer = webView.getUrl(); mOrigin = NetUtils.getOriginUrl(mReferer); mUserAgent = webView.getSettings().getUserAgentString(); } @Override public void clearCache() { FileUtil.deleteDirs(mCacheFile.getAbsolutePath(),false); AssetsLoader.getInstance().clear(); } @Override public void enableForce(boolean force) { if (force){ mCacheType = CacheType.FORCE; }else{ mCacheType = CacheType.NORMAL; } } @Override public InputStream getCacheFile(String url) { return OKHttpFile.getCacheFile(mCacheFile,url); } @Override public void initAssetsData() { AssetsLoader.getInstance().initData(); } @Override public File getCachePath() { return mCacheFile; } public void addHeader(Request.Builder reqBuilder,Map<String, String> headers){ if (headers==null){ return; } for (Map.Entry<String,String> entry:headers.entrySet()){ reqBuilder.addHeader(entry.getKey(),entry.getValue()); } } private WebResourceResponse interceptRequest(String url, Map<String, String> headers){ if(mCacheType==CacheType.NORMAL){ return null; } if (!checkUrl(url)){ return null; } if(isEnableAssets()){ InputStream inputStream = AssetsLoader.getInstance().getResByUrl(url); if (inputStream!=null){ CacheWebViewLog.d(String.format("from assets: %s",url),mDebug); String mimeType = MimeTypeMapUtils.getMimeTypeFromUrl(url); WebResourceResponse webResourceResponse = new WebResourceResponse(mimeType,"",inputStream); return webResourceResponse; } } try { Request.Builder reqBuilder = new Request.Builder() .url(url); String extension = MimeTypeMapUtils.getFileExtensionFromUrl(url); if (mCacheExtensionConfig.isHtml(extension)){ headers.put(KEY_CACHE,mCacheType.ordinal()+""); } addHeader(reqBuilder,headers); if (!NetUtils.isConnected(mContext)) { reqBuilder.cacheControl(CacheControl.FORCE_CACHE); } Request request = reqBuilder.build(); Response response = mHttpClient.newCall(request).execute(); Response cacheRes = response.cacheResponse(); if (cacheRes!=null){ CacheWebViewLog.d(String.format("from cache: %s",url),mDebug); }else{ CacheWebViewLog.d(String.format("from server: %s",url),mDebug); } String mimeType = MimeTypeMapUtils.getMimeTypeFromUrl(url); WebResourceResponse webResourceResponse = new WebResourceResponse(mimeType,"",response.body().byteStream()); if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){ String message = response.message(); if(TextUtils.isEmpty(message)){ message = "OK"; } try{ webResourceResponse.setStatusCodeAndReasonPhrase(response.code(),message); }catch (Exception e){ return null; } webResourceResponse.setResponseHeaders(NetUtils.multimapToSingle(response.headers().toMultimap())); } return webResourceResponse; } catch (IOException e) { e.printStackTrace(); } return null; } public static class Builder { private File mCacheFile; private long mCacheSize = 100 * 1024 * 1024; private long mConnectTimeout = 20; private long mReadTimeout = 20; private CacheExtensionConfig mCacheExtensionConfig; private Context mContext; private boolean mDebug = true; private CacheType mCacheType = CacheType.FORCE; private boolean mTrustAllHostname=false; private SSLSocketFactory mSSLSocketFactory =null; private X509TrustManager mX509TrustManager = null; private ResourceInterceptor mResourceInterceptor; private String mAssetsDir=null; private boolean mIsSuffixMod=false; public Builder(Context context){ mContext = context; mCacheFile = new File(context.getCacheDir().toString(),"CacheWebViewCache"); mCacheExtensionConfig = new CacheExtensionConfig(); } public void setResourceInterceptor(ResourceInterceptor resourceInterceptor){ mResourceInterceptor = resourceInterceptor; } public Builder setTrustAllHostname(){ mTrustAllHostname = true; return this; } public Builder setSSLSocketFactory( SSLSocketFactory sslSocketFactory, X509TrustManager trustManager){ if (sslSocketFactory!=null&&trustManager!=null){ mSSLSocketFactory = sslSocketFactory; mX509TrustManager = trustManager; } return this; } public Builder setCachePath(File file){ if (file!=null){ mCacheFile = file; } return this; } public Builder setCacheSize(long cacheSize){ if (cacheSize>1024){ mCacheSize = cacheSize; } return this; } public Builder setReadTimeoutSecond(long time){ if (time>=0){ mReadTimeout = time; } return this; } public Builder setConnectTimeoutSecond(long time){ if (time>=0){ mConnectTimeout = time; } return this; } public Builder setCacheExtensionConfig(CacheExtensionConfig config){ if (config!=null){ mCacheExtensionConfig = config; } return this; } public Builder setDebug(boolean debug){ mDebug =debug; return this; } public Builder setCacheType(CacheType cacheType){ mCacheType = cacheType; return this; } public Builder isAssetsSuffixMod(boolean suffixMod){ this.mIsSuffixMod = suffixMod; return this; } public Builder setAssetsDir(String dir){ if (dir != null){ mAssetsDir = dir; } return this; } public WebViewRequestInterceptor build(){ return new WebViewCacheInterceptor(this); } } }
e65b16c226ee2b8a7507630c86c27551780fcf1c
263c6b33a8c2effda80cf54e5579985511c12e08
/example/src/main/java/com/svenjacobs/dagger/example/user/UserFragment.java
8af4a072352651fa044921ae2517f65c9b6d81ee
[ "Apache-2.0" ]
permissive
takn/dagger2-android-template
3bdb05af586459b7747908e9bc174bf90d0e289c
07070fdecb86e9e4660f0546233a0da5b740c049
refs/heads/master
2020-12-24T21:54:53.417604
2015-07-24T09:10:00
2015-07-24T09:10:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,872
java
package com.svenjacobs.dagger.example.user; import android.app.Activity; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.svenjacobs.dagger.example.R; import com.svenjacobs.dagger.example.inject.InjectableFragment; import com.svenjacobs.dagger.example.inject.components.FragmentComponent; import javax.inject.Inject; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import static com.google.common.base.Preconditions.checkNotNull; public class UserFragment extends InjectableFragment { public interface Listener { void onUserLogout(); } private static final String BUNDLE_USER_NAME = "USER_NAME"; @Inject UserColorProvider mUserColorProvider; @Bind(R.id.user_greeting) TextView mUserGreeting; @Inject UserGreetingService mUserGreetingService; private Listener mListener; private String mUserName; @Override public void onAttach(final Activity activity) { super.onAttach(activity); mListener = (Listener) activity; } @Override public void onComponentCreated(@NonNull final FragmentComponent component) { super.onComponentCreated(component); component.inject(this); } @Override public void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); mUserName = getArguments().getString(BUNDLE_USER_NAME); } @Nullable @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_user, container, false); ButterKnife.bind(this, view); return view; } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.unbind(this); } @Override public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mUserGreeting.setText(mUserGreetingService.getUserGreeting(mUserName)); mUserGreeting.setTextColor(mUserColorProvider.getUserColor(mUserName)); } @OnClick(R.id.logout_button) void onLogoutButtonClick() { mListener.onUserLogout(); } public static UserFragment newInstance(@NonNull final String userName) { checkNotNull(userName); final Bundle arguments = new Bundle(); arguments.putString(BUNDLE_USER_NAME, userName); final UserFragment fragment = new UserFragment(); fragment.setArguments(arguments); return fragment; } }
f9bf7671e975dd5cc9a44c2ab20a3e7d72b964d3
29174ff6132800ee543667eaafafd106ed419c53
/src/main/java/cc/dmji/api/repository/IndexRecommendRepository.java
7264833830ba4b744a41f3239fc8df7ece5b3615
[]
no_license
PlentyMore/danmakuji-api
5d0a4d753a81a20025ca9dcd778a3921e619f54c
8bb1c495689967e3696c961e0c9b77ac4eb95e58
refs/heads/master
2020-04-26T16:34:29.470378
2018-10-08T09:01:00
2018-10-08T09:07:26
133,293,568
0
0
null
2018-05-14T02:16:53
2018-05-14T02:16:53
null
UTF-8
Java
false
false
480
java
package cc.dmji.api.repository; import cc.dmji.api.entity.IndexRecommend; import cc.dmji.api.enums.Status; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; public interface IndexRecommendRepository extends JpaRepository<IndexRecommend, Long> { Page<IndexRecommend> findByShowIndexEqualsAndRecommendStatusEquals(boolean showIndex, Status status, Pageable pageable); }
56d6d6cc013e2be7585185d96a5234c261e18288
99d079e4222eb66c5c43307bfa7eedd42377873f
/core/src/com/atikin/mariobros/Sprites/Mario.java
34da2895d6b452dad6c647773454a348d46c40ab
[]
no_license
NickKlementiev/APS
90149238956fb96fe630fab8d9fc9eb9ecd4a524
d3c6f61f65b514aa1ea91d55491bac572e08d3a3
refs/heads/master
2021-10-23T19:40:36.234242
2021-10-11T21:12:57
2021-10-11T21:12:57
246,682,205
1
0
null
2020-03-13T23:28:25
2020-03-11T21:20:23
Java
UTF-8
Java
false
false
12,409
java
package com.atikin.mariobros.Sprites; import com.atikin.mariobros.MarioBros; import com.atikin.mariobros.Screens.PlayScreen; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Sound; import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.*; import com.badlogic.gdx.utils.Array; public class Mario extends Sprite { public enum State { FALLING, JUMPING, STANDING, RUNNING, GROWING, DEAD }; public State currentState; public State previousState; public World world; public Body b2body; private TextureRegion marioStand; private Animation<TextureRegion> marioRun; private TextureRegion marioJump; private TextureRegion bigMarioStand; private TextureRegion bigMarioJump; private TextureRegion marioDead; private Animation<TextureRegion> bigMarioRun; private Animation<TextureRegion> growMario; private float stateTimer; private boolean runningRight; private boolean marioIsBig; private boolean runGrowAnimation; private boolean timeToDefineBigMario; private boolean timeToRedefineMario; private boolean marioIsDead; public Mario(PlayScreen screen) { // Especificar sprite padrão para o Mario inicial super(screen.getAtlas().findRegion("little_mario")); // Inicializar valores padrão this.world = screen.getWorld(); currentState = State.STANDING; previousState = State.STANDING; stateTimer = 0; runningRight = true; // Configuração da animação do personagem Array<TextureRegion> frames = new Array<TextureRegion>(); // Do arquivo de animação do personagem, usar apenas as quatro primeiras frames.add(new TextureRegion(screen.getAtlas().findRegion("little_mario"), 0, 0, 17, 21)); frames.add(new TextureRegion(screen.getAtlas().findRegion("little_mario"), 18, 0, 17, 22)); marioRun = new Animation<TextureRegion>(0.3f, frames); // Limpar o array para usá-lo com outras figuras frames.clear(); frames.add(new TextureRegion(screen.getAtlas().findRegion("big_mario"), 0, 0, 28, 34)); frames.add(new TextureRegion(screen.getAtlas().findRegion("big_mario"), 29, 0, 28, 34)); bigMarioRun = new Animation<TextureRegion>(0.3f, frames); frames.clear(); // Aquisição dos frames de animação do crescimento do personagem frames.add(new TextureRegion(screen.getAtlas().findRegion("little_mario"), 0, 0, 19, 23)); growMario = new Animation<TextureRegion>(0.2f, frames); frames.clear(); // "Animação" do pulo do personagem marioJump = new TextureRegion(screen.getAtlas().findRegion("little_mario"), 18, 0, 17, 21); bigMarioJump = new TextureRegion(screen.getAtlas().findRegion("big_mario"), 29, 0, 28, 34); // Especificar e associar resolução de sprite padrão marioStand = new TextureRegion(screen.getAtlas().findRegion("little_mario"), 0, 0, 17, 21); bigMarioStand = new TextureRegion(screen.getAtlas().findRegion("big_mario"), 0, 0, 28, 34); // "Animação" da morte do personagem marioDead = new TextureRegion(screen.getAtlas().findRegion("little_mario"), 37, 0, 17, 21); // Definição do personagem defineMario(); // Local e configurações iniciais do personagem setBounds(0, 0, 17 / MarioBros.PPM, 20 / MarioBros.PPM); setRegion(marioStand); } public void update(float dt) { if (marioIsBig) setPosition(b2body.getPosition().x - getWidth() / 2, b2body.getPosition().y - getHeight() / 2 - 6 / MarioBros.PPM); else setPosition(b2body.getPosition().x - getWidth() / 2, b2body.getPosition().y - getHeight() / 2 + 0.025f); setRegion(getFrame(dt)); if (timeToDefineBigMario) defineBigMario(); if (timeToRedefineMario) redefineMario(); if (((currentState == State.FALLING || currentState == State.JUMPING) && getY() < -1f)) dead(); } public boolean isBig() { return marioIsBig; } public void dead() { currentState = State.DEAD; MarioBros.manager.get("audio/music/mario_music.ogg", Music.class).stop(); MarioBros.manager.get("audio/sounds/mariodie.wav", Sound.class).play(); marioIsDead = true; Filter filter = new Filter(); filter.maskBits = MarioBros.NOTHING_BIT; for (Fixture fixture : b2body.getFixtureList()) fixture.setFilterData(filter); b2body.applyLinearImpulse(new Vector2(0, 4f), b2body.getWorldCenter(), true); } public void hit(Enemy enemy) { if (enemy instanceof Turtle && ((Turtle) enemy).getCurrentState() == Turtle.State.STANDING_SHELL) { ((Turtle) enemy).kick(this.getX() <= enemy.getX() ? Turtle.KICK_RIGHT_SPEED : Turtle.KICK_LEFT_SPEED); } else { if (marioIsBig) { marioIsBig = false; timeToRedefineMario = true; setBounds(getX(), getY(), getWidth() / 1.5f, getHeight() / 1.5f); MarioBros.manager.get("audio/sounds/powerdown.wav", Sound.class).play(); } else { MarioBros.manager.get("audio/music/mario_music.ogg", Music.class).stop(); MarioBros.manager.get("audio/sounds/mariodie.wav", Sound.class).play(); marioIsDead = true; Filter filter = new Filter(); filter.maskBits = MarioBros.NOTHING_BIT; for (Fixture fixture : b2body.getFixtureList()) fixture.setFilterData(filter); b2body.applyLinearImpulse(new Vector2(0, 4f), b2body.getWorldCenter(), true); } } } // Configuração dos frames e das animações do personagem public TextureRegion getFrame(float dt) { currentState = getState(); TextureRegion region; switch (currentState) { case DEAD: region = marioDead; break; case GROWING: region = growMario.getKeyFrame(stateTimer); if (growMario.isAnimationFinished(stateTimer)) runGrowAnimation = false; break; case JUMPING: region = marioIsBig ? bigMarioJump : marioJump; break; case RUNNING: region = marioIsBig ? bigMarioRun.getKeyFrame(stateTimer, true) : marioRun.getKeyFrame(stateTimer, true); break; case FALLING: case STANDING: default: region = marioIsBig ? bigMarioStand : marioStand; break; } // Orientação do personagem (olhando para a esquerda ou para a direita) if ((b2body.getLinearVelocity().x < 0 || !runningRight) && !region.isFlipX()) { region.flip(true, false); runningRight = false; } else if ((b2body.getLinearVelocity().x > 0 || runningRight) && region.isFlipX()) { region.flip(true, false); runningRight = true; } stateTimer = currentState == previousState ? stateTimer + dt : 0; previousState = currentState; return region; } // Descobrir o estado atual do personagem public State getState() { if (marioIsDead) return State.DEAD; else if (runGrowAnimation) return State.GROWING; else if (b2body.getLinearVelocity().y > 0 || (b2body.getLinearVelocity().y < 0 && previousState == State.JUMPING)) { return State.JUMPING; } else if (b2body.getLinearVelocity().y < 0) { return State.FALLING; } else if (b2body.getLinearVelocity().x != 0) { return State.RUNNING; } else { return State.STANDING; } } public void grow() { if (!marioIsBig) { runGrowAnimation = true; marioIsBig = true; timeToDefineBigMario = true; setBounds(getX(), getY(), getWidth() * 1.5f, getHeight() * 1.5f); MarioBros.manager.get("audio/sounds/powerup.wav", Sound.class).play(); } } public boolean isDead() { return marioIsDead; } public float getStateTimer() { return stateTimer; } public void redefineMario() { Vector2 position = b2body.getPosition(); world.destroyBody(b2body); BodyDef bdef = new BodyDef(); bdef.position.set(position); bdef.type = BodyDef.BodyType.DynamicBody; b2body = world.createBody(bdef); FixtureDef fdef = new FixtureDef(); CircleShape shape = new CircleShape(); shape.setRadius(6 / MarioBros.PPM); fdef.filter.categoryBits = MarioBros.MARIO_BIT; fdef.filter.maskBits = MarioBros.GROUND_BIT | MarioBros.COIN_BIT | MarioBros.BRICK_BIT | MarioBros.ENEMY_BIT | MarioBros.OBJECT_BIT | MarioBros.ENEMY_HEAD_BIT | MarioBros.ITEM_BIT; fdef.shape = shape; b2body.createFixture(fdef).setUserData(this); EdgeShape head = new EdgeShape(); head.set(new Vector2(-2 / MarioBros.PPM, 10 / MarioBros.PPM), new Vector2(2 / MarioBros.PPM, 10 / MarioBros.PPM)); fdef.filter.categoryBits = MarioBros.MARIO_HEAD_BIT; fdef.shape = head; fdef.isSensor = true; b2body.createFixture(fdef).setUserData(this); timeToRedefineMario = false; } public void defineBigMario() { Vector2 currentPosition = b2body.getPosition(); world.destroyBody(b2body); BodyDef bdef = new BodyDef(); bdef.position.set(currentPosition.add(0, 10 / MarioBros.PPM)); bdef.type = BodyDef.BodyType.DynamicBody; b2body = world.createBody(bdef); FixtureDef fdef = new FixtureDef(); CircleShape shape = new CircleShape(); shape.setRadius(6 / MarioBros.PPM); fdef.filter.categoryBits = MarioBros.MARIO_BIT; fdef.filter.maskBits = MarioBros.GROUND_BIT | MarioBros.COIN_BIT | MarioBros.BRICK_BIT | MarioBros.ENEMY_BIT | MarioBros.OBJECT_BIT | MarioBros.ENEMY_HEAD_BIT | MarioBros.ITEM_BIT; fdef.shape = shape; b2body.createFixture(fdef).setUserData(this); shape.setPosition(new Vector2(0, -14 / MarioBros.PPM)); b2body.createFixture(fdef).setUserData(this); EdgeShape head = new EdgeShape(); head.set(new Vector2(-2 / MarioBros.PPM, 6 / MarioBros.PPM), new Vector2(2 / MarioBros.PPM, 6 / MarioBros.PPM)); fdef.filter.categoryBits = MarioBros.MARIO_HEAD_BIT; fdef.shape = head; fdef.isSensor = true; b2body.createFixture(fdef).setUserData(this); timeToDefineBigMario = false; } public void defineMario() { // Definição básica de objeto "corpo" e de suas dimensões BodyDef bdef = new BodyDef(); bdef.position.set(32 / MarioBros.PPM, 32 / MarioBros.PPM); bdef.type = BodyDef.BodyType.DynamicBody; b2body = world.createBody(bdef); FixtureDef fdef = new FixtureDef(); CircleShape shape = new CircleShape(); shape.setRadius(6 / MarioBros.PPM); fdef.filter.categoryBits = MarioBros.MARIO_BIT; fdef.filter.maskBits = MarioBros.GROUND_BIT | MarioBros.COIN_BIT | MarioBros.BRICK_BIT | MarioBros.ENEMY_BIT | MarioBros.OBJECT_BIT | MarioBros.ENEMY_HEAD_BIT | MarioBros.ITEM_BIT; fdef.shape = shape; b2body.createFixture(fdef).setUserData(this); EdgeShape head = new EdgeShape(); head.set(new Vector2(-2 / MarioBros.PPM, 8 / MarioBros.PPM), new Vector2(2 / MarioBros.PPM, 8 / MarioBros.PPM)); fdef.filter.categoryBits = MarioBros.MARIO_HEAD_BIT; fdef.shape = head; fdef.isSensor = true; b2body.createFixture(fdef).setUserData(this); } }
05c84458185815e127b0dc16bf9b2dc402367146
07618aac73b0376b4e7be5c8d2a66279fbcebb61
/calculator-service/src/main/java/de/viadee/camunda/connected/calculator/controller/SyncCalculatorController.java
8461dc65c8e5a4996e1ceeddd794b6b66efa0d83
[]
no_license
viadee/camunda-integration
05700b031f111f59b0cdf6f826e2e13b7f1dc660
ae7d89ba82c2b05c2e961e5933639755272a445c
refs/heads/master
2022-11-03T21:11:43.087369
2021-04-26T12:41:21
2021-04-26T12:41:21
235,975,824
0
0
null
2022-10-10T15:36:06
2020-01-24T09:44:37
Java
UTF-8
Java
false
false
932
java
package de.viadee.camunda.connected.calculator.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import de.viadee.camunda.connected.calculator.model.CalculateModel; import de.viadee.camunda.connected.calculator.service.CalculatorService; @RestController @RequestMapping("/sync") public class SyncCalculatorController { @Autowired private CalculatorService service; @PostMapping("/calc") public ResponseEntity<Number> calculate(@RequestBody final CalculateModel model) { return ResponseEntity.ok(this.service.calculate(model.getNum1(), model.getNum2(), model.getOperator())); } }
1b77413370ca2fdae6eba0116fbff2d3d989bf3e
326e04f93f37573dd15dec8eb26374212826842a
/service-hi/src/main/java/com/leon/servicehi/ServiceHiApplication.java
abdf5ab05cbaf618b1db168d4d4034240ad0213e
[]
no_license
leon0832/springcloudleon
aad793b8e7f5e5f13acec77cc25b3a62488f982e
b184eef28ac5e13d2dc7e7e14354ea4caace5762
refs/heads/master
2021-10-09T00:00:05.202097
2018-12-19T02:35:20
2018-12-19T02:35:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
906
java
package com.leon.servicehi; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @EnableEurekaClient @RestController public class ServiceHiApplication { public static void main(String[] args) { SpringApplication.run(ServiceHiApplication.class, args); } @Value("${server.port}") String port; @RequestMapping("/hi") public String home(@RequestParam String name) { return "hi " + name + ",i am from port:" + port; } @RequestMapping("/hi2") public String testFunc(){ return port; } }
69099eda5463b710ea98ad28b00840665ccf8f14
3d03d1a6d9a4b0669e5045e33461c0048dba867a
/testing/Test technical skills.java
8bcb7d0b029354aba9f633e106a8515f3f54891c
[]
no_license
grozavu-andrei/Proiect-IP-Modulul1
13998c45c08819b775c896d68db8617589f546a2
5f4a4efea4d0bf39315ce8e2836f9bab7a2a41fc
refs/heads/master
2021-01-19T07:46:26.462688
2017-06-06T21:38:57
2017-06-06T21:38:57
87,571,120
0
1
null
null
null
null
UTF-8
Java
false
false
3,256
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author Relu */ public class MainTest { @Test public void testValueTechnicalSkillGeneral() throws Exception { String skill = "I am a Java and C# developer"; String cautare = "general"; int expResult = 37; Main main = new Main(); int result = main.technicalSkillsVallue(skill, cautare); assertEquals(expResult, result); } @Test public void testValueTechnicalSkillWeb() throws Exception { String skill = "I am a Java and C# developer"; String cautare = "web"; int expResult = 10; Main main = new Main(); int result = main.technicalSkillsVallue(skill, cautare); assertEquals(expResult, result); } @Test public void testValueTechnicalSkillOop() throws Exception { String skill = "I am a Java and C# developer"; String cautare = "oop"; int expResult = 36; Main main = new Main(); int result = main.technicalSkillsVallue(skill, cautare); result = Main.technicalSkillsVallue(skill, cautare); assertEquals(expResult, result); } @Test public void testValueTechnicalSkillEmpty() throws Exception { String skill = ""; String cautare = "general"; int expResult = 0; Main main = new Main(); int result = main.technicalSkillsVallue(skill, cautare); result = Main.technicalSkillsVallue(skill, cautare); assertEquals(expResult, result); } public void testValueTechnicalSkillCamelCase() throws Exception { String skill = "I aM a JaVa aNd C# dEvElOpEr!"; String cautare = "general"; int expResult = 37; Main main = new Main(); int result = main.technicalSkillsVallue(skill, cautare); result = Main.technicalSkillsVallue(skill, cautare); assertEquals(expResult, result); } public void testValueTechnicalSkillComa() throws Exception { String skill = "I am a Java, C# developer!"; String cautare = "general"; int expResult = 37; Main main = new Main(); int result = main.technicalSkillsVallue(skill, cautare); result = Main.technicalSkillsVallue(skill, cautare); assertEquals(expResult, result); } public void testValueTechnicalSkillNoSpace() throws Exception { String skill = "I am a JavaC# developer!"; String cautare = "general"; int expResult = 37; Main main = new Main(); int result = main.technicalSkillsVallue(skill, cautare); result = Main.technicalSkillsVallue(skill, cautare); assertEquals(expResult, result); } @Test public void testMain() throws Exception { Main.main(null); assertEquals(0, 0); } }
4e5172a99e1f85a62ef142f2e09e216c35fb7bf7
a8f2bb0badbb223456a87347fcb80abeb3007034
/src/main/java/com/authmodule/commons/service/UserService.java
cbb37688d19c7652cb36286483700960a3638a76
[]
no_license
nishad5089/auth-module
53eb23a0aadf69bfc1ff3ce40f8d1474d61e8292
4846cb02ff0a4b4ff45af944eba012302e2e54fd
refs/heads/master
2023-03-08T17:01:02.190743
2021-02-17T09:43:22
2021-02-17T09:43:22
339,662,731
0
0
null
null
null
null
UTF-8
Java
false
false
153
java
package com.authmodule.commons.service; import com.authmodule.commons.model.Users; public interface UserService { Users createUser(Users users); }
36739c590cc3082ce70e10c1911e46a2dc1e0d1f
6c5a0622d0b45d71b2cb039bb4262972835e0799
/src/com/homeworks/aca_book/nested/sports/Football.java
593db2e08bc97423339db7fb8e89703bff2ed54e
[]
no_license
SilviaAbrahamyan/Aca
cc3e59cd98afc04927df821bb21ed3e1f248bd23
f9f07b6052f454e7fa4a484a156c647964ea475d
refs/heads/master
2020-04-16T10:03:33.177456
2019-01-13T09:40:16
2019-01-13T09:40:16
165,488,224
0
0
null
null
null
null
UTF-8
Java
false
false
159
java
package com.homeworks.aca_book.nested.sports; /** * Created by home on 10/18/2018. */ public class Football { public static final int TEAM_SIZE = 11; }
9a79a70581831461c629db58bccb9625830a46da
84ec3daf72e244e1e93e4d5e4536444e2197dbd3
/src/main/java/com/crud/tasks/service/MailCreatorService.java
450c8744e0df2dc15ff6b9de724d51c36eb5055d
[]
no_license
MichalPolinkiewicz/tasksApp
81152713b7dd9289dd025247a14542973f46ad5e
4693b8bada818c35a213ba4c9a337a1633370b58
refs/heads/master
2021-08-22T23:53:26.203835
2017-12-01T19:28:07
2017-12-01T19:28:07
104,095,104
0
0
null
null
null
null
UTF-8
Java
false
false
1,665
java
package com.crud.tasks.service; import com.crud.tasks.config.AdminConfig; import com.crud.tasks.info.CompanyInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.thymeleaf.TemplateEngine; import org.thymeleaf.context.Context; /** * Created by Lenovo on 24.11.2017. */ @Service public class MailCreatorService { @Autowired @Qualifier("templateEngine") private TemplateEngine templateEngine; @Autowired private AdminConfig adminConfig; @Autowired private CompanyInfo companyInfo; public String buildTrelloCardEmail (String message){ Context context = new Context(); context.setVariable("message", message); context.setVariable("tasks_url", "http://localhost:8888/tasks_crud/"); context.setVariable("button", "Visit website"); context.setVariable("admin_name", adminConfig.getAdminName()); context.setVariable("company", companyInfo.toString()); return templateEngine.process("D:\\tasks\\src\\main\\resources\\templates\\mail\\created_trello_card_mail.html" , context); } public String buildDailyEmail(String msg){ Context context = new Context(); context.setVariable("message", msg); context.setVariable("tasks_url", "http://localhost:8888/tasks_crud/"); context.setVariable("button", "Show tasks"); context.setVariable("company", companyInfo.toString()); return templateEngine.process("D:\\tasks\\src\\main\\resources\\templates\\mail\\daily_mail.html" , context); } }
83d9353a4b73e2d18800ae18c3196a2ef2f4a5da
1112e63bc9f9e571ed5fe862c8067100dad20fab
/app/src/main/java/com/example/webrtc/MainActivity.java
1ef0921ad9585b895ce46e875c2aec7a2d9a6c43
[]
no_license
q3500552/WebRtc
6fce6b0dac5c9cc0dd3694470c9a6d46c8583761
e498901dfaee1bc529475b9f6ecc899ffaef3b88
refs/heads/master
2022-10-14T04:23:12.418045
2020-06-10T17:24:45
2020-06-10T17:24:45
262,977,326
0
0
null
null
null
null
UTF-8
Java
false
false
1,353
java
package com.example.webrtc; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.net.URI; public class MainActivity extends AppCompatActivity { private TextView textView; private Button button; private EditText editText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // webSocketClient = new JWebSocketClient(URI.create("ws://192.168.0.5:9001")); // try { // webSocketClient.connectBlocking(); // } catch (InterruptedException e) { // e.printStackTrace(); // } textView = findViewById(R.id.textView); button = findViewById(R.id.button); editText = findViewById(R.id.editText); } public void connect(View view){ String username = editText.getText()+""; Log.e("send", username); Intent intent=new Intent(MainActivity.this,WebRtcActivity.class); Bundle bundle = new Bundle(); bundle.putString("username", username); intent.putExtras(bundle); startActivity(intent); } }
1decf2e18ae31b87b0f65eb41652bb076827a2e5
e2fb15ceb51b1294d3d0f691b018f3db267eb8d4
/src/com/qedge/testcase1.java
d50828befdb7f22b7d48b178e149cebaddf4b018
[]
no_license
7799sridhar/seleniumDEC
12f044bbd4efa0153738f473c00fa57fdf7c6ee6
7b34c9c7af18b0d737a8ea2e93d8d5960a0d1811
refs/heads/master
2020-12-04T23:14:01.692624
2020-01-06T10:09:34
2020-01-06T10:09:34
231,931,554
0
0
null
null
null
null
UTF-8
Java
false
false
171
java
package com.qedge; public class testcase1 { public static void main(String[] args) { System.out.println("Hello sridhar console message"); } }
ec34d11ab1bcd7c73f1690d5d01dcc1a8c5388d0
29e6f769e937401e20fbc1f8a7b71dd9f2584339
/spring-annotation/src/main/java/com/hfm/aware/MyAware.java
daf3644f35f603b7b258438013fea81db4ed0e1d
[]
no_license
hfming/java_ee
0dc57d080a43386d4fcaea3de5f770b4b7791cc6
e18957c9a69705f2a1f81bd004577dfaafdacd7e
refs/heads/master
2023-08-31T05:38:21.817110
2021-10-24T13:56:15
2021-10-24T13:56:15
312,496,780
0
0
null
null
null
null
UTF-8
Java
false
false
922
java
package com.hfm.aware; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanNameAware; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; /** * @author [email protected] * @version 1.01 2021-10-15 21:52 * @Description 自动装配 * @date 2021/10/15 */ @Component public class MyAware implements ApplicationContextAware, BeanNameAware { private ApplicationContext applicationContext; @Override public void setBeanName(String s) { // 当前 Bean 的名称 System.out.println(s); } @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { // IOC 容器 System.out.println(applicationContext); this.applicationContext = applicationContext; } }
3bdeca08aa0b1aef5f3ad35c04e47a9177740b82
20a44e7824972e77cdf6558a0f5ada2e10317847
/spring_ioc/src/main/java/com/imooc/ioc/demo1/UserServiceImpl.java
0053ee5da7ad80970e257fe338366914e519d08c
[]
no_license
Zouyikang1995/imoocProject
872d7b31322b6563747b10345ef10d2cecd60bfe
8da762597c608ab977dbd4f8b0618e90c9e816c8
refs/heads/master
2022-12-10T13:37:03.504365
2020-08-27T15:04:48
2020-08-27T15:04:48
289,034,922
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package com.imooc.ioc.demo1; public class UserServiceImpl implements UserService { //添加属性 private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public void sayHello() { System.out.println("Hello Spring" + name); } }
4ebaed0f38480f4206579179f223fab17ad37c12
022980735384919a0e9084f57ea2f495b10c0d12
/src/liferay-plugins-sdk-5.2.3/portlets/digitalsignature-portlet/docroot/WEB-INF/src/com/nss/portlet/digitalsignature/model/impl/CertificateModelImpl.java
ee90619bfbcd861de1f47a323d16b5109f5cb57e
[ "MIT" ]
permissive
thaond/nsscttdt
474d8e359f899d4ea6f48dd46ccd19bbcf34b73a
ae7dacc924efe578ce655ddfc455d10c953abbac
refs/heads/master
2021-01-10T03:00:24.086974
2011-02-19T09:18:34
2011-02-19T09:18:34
50,081,202
0
0
null
null
null
null
UTF-8
Java
false
false
6,706
java
/** * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.nss.portlet.digitalsignature.model.impl; import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler; import com.liferay.portal.kernel.util.GetterUtil; import com.liferay.portal.kernel.util.HtmlUtil; import com.liferay.portal.model.impl.BaseModelImpl; import com.liferay.portlet.expando.model.ExpandoBridge; import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl; import com.nss.portlet.digitalsignature.model.Certificate; import com.nss.portlet.digitalsignature.model.CertificateSoap; import java.io.Serializable; import java.lang.reflect.Proxy; import java.sql.Types; import java.util.ArrayList; import java.util.List; /** * <a href="CertificateModelImpl.java.html"><b><i>View Source</i></b></a> * * @author canhminh * */ public class CertificateModelImpl extends BaseModelImpl<Certificate> { public static final String TABLE_NAME = "nss_certificate"; public static final Object[][] TABLE_COLUMNS = { { "userId", new Integer(Types.BIGINT) }, { "x509Certificate", new Integer(Types.CLOB) } }; public static final String TABLE_SQL_CREATE = "create table nss_certificate (userId LONG not null primary key,x509Certificate TEXT null)"; public static final String TABLE_SQL_DROP = "drop table nss_certificate"; public static final String DATA_SOURCE = "liferayDataSource"; public static final String SESSION_FACTORY = "liferaySessionFactory"; public static final String TX_MANAGER = "liferayTransactionManager"; public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( "value.object.entity.cache.enabled.com.nss.portlet.digitalsignature.model.Certificate"), true); public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( "value.object.finder.cache.enabled.com.nss.portlet.digitalsignature.model.Certificate"), true); public static Certificate toModel(CertificateSoap soapModel) { Certificate model = new CertificateImpl(); model.setUserId(soapModel.getUserId()); model.setX509Certificate(soapModel.getX509Certificate()); return model; } public static List<Certificate> toModels(CertificateSoap[] soapModels) { List<Certificate> models = new ArrayList<Certificate>(soapModels.length); for (CertificateSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get( "lock.expiration.time.com.nss.portlet.digitalsignature.model.Certificate")); public CertificateModelImpl() { } public long getPrimaryKey() { return _userId; } public void setPrimaryKey(long pk) { setUserId(pk); } public Serializable getPrimaryKeyObj() { return new Long(_userId); } public long getUserId() { return _userId; } public void setUserId(long userId) { _userId = userId; } public String getX509Certificate() { return GetterUtil.getString(_x509Certificate); } public void setX509Certificate(String x509Certificate) { _x509Certificate = x509Certificate; } public Certificate toEscapedModel() { if (isEscapedModel()) { return (Certificate)this; } else { Certificate model = new CertificateImpl(); model.setNew(isNew()); model.setEscapedModel(true); model.setUserId(getUserId()); model.setX509Certificate(HtmlUtil.escape(getX509Certificate())); model = (Certificate)Proxy.newProxyInstance(Certificate.class.getClassLoader(), new Class[] { Certificate.class }, new ReadOnlyBeanHandler(model)); return model; } } public ExpandoBridge getExpandoBridge() { if (_expandoBridge == null) { _expandoBridge = new ExpandoBridgeImpl(Certificate.class.getName(), getPrimaryKey()); } return _expandoBridge; } public Object clone() { CertificateImpl clone = new CertificateImpl(); clone.setUserId(getUserId()); clone.setX509Certificate(getX509Certificate()); return clone; } public int compareTo(Certificate certificate) { long pk = certificate.getPrimaryKey(); if (getPrimaryKey() < pk) { return -1; } else if (getPrimaryKey() > pk) { return 1; } else { return 0; } } public boolean equals(Object obj) { if (obj == null) { return false; } Certificate certificate = null; try { certificate = (Certificate)obj; } catch (ClassCastException cce) { return false; } long pk = certificate.getPrimaryKey(); if (getPrimaryKey() == pk) { return true; } else { return false; } } public int hashCode() { return (int)getPrimaryKey(); } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{userId="); sb.append(getUserId()); sb.append(", x509Certificate="); sb.append(getX509Certificate()); sb.append("}"); return sb.toString(); } public String toXmlString() { StringBuilder sb = new StringBuilder(); sb.append("<model><model-name>"); sb.append("com.nss.portlet.digitalsignature.model.Certificate"); sb.append("</model-name>"); sb.append( "<column><column-name>userId</column-name><column-value><![CDATA["); sb.append(getUserId()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>x509Certificate</column-name><column-value><![CDATA["); sb.append(getX509Certificate()); sb.append("]]></column-value></column>"); sb.append("</model>"); return sb.toString(); } private long _userId; private String _x509Certificate; private transient ExpandoBridge _expandoBridge; }
[ "nguyentanmo@843501e3-6f96-e689-5e61-164601347e4e" ]
nguyentanmo@843501e3-6f96-e689-5e61-164601347e4e
ca75867fc9928cca815a37c48fac32efa5e21566
be92a66aa138eaac8a683515fa4e60edc8e0263e
/src/MainFrame.java
975878f65b0564c982bbbd1dd8f61d7afdddd06d
[]
no_license
106021152/20180612
b48586ff7d04c688a2585f0219fdb231e7a1d405
75f07c54d3e4d17c3d788dbaa0b3f4f6066e0b7f
refs/heads/master
2020-03-19T23:43:43.302808
2018-06-12T03:57:45
2018-06-12T03:57:45
137,017,242
0
0
null
null
null
null
UTF-8
Java
false
false
2,148
java
import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class MainFrame extends JFrame { private JButton jbtnchange = new JButton("轉換"); // private JButton jbtnchange2 = new JButton(); private JTextField jtf = new JTextField(); // private JTextField jtf2 = new JTextField(); private JLabel jlb = new JLabel(); // private JLabel jlb2 = new JLabel(); private JButton jbtnexit = new JButton("Exit"); public MainFrame(){ this.init(); } public void init(){ // this.add(jlb2); // this.add(jtf2); // this.add(jbtnchange2); // jtf2.setBounds(0,190,200,200); // jbtnchange2.setBounds(200,190,200,200); // jlb2.setBounds(400,190,200,200); this.add(jbtnexit); this.add(jtf); this.add(jbtnchange); this.add(jlb); this.setLayout(null); jbtnexit.setBounds(400,190,200,200); jtf.setBounds(0,-10,200,200); jbtnchange.setBounds(200,-10,200,200); jlb.setBounds(400,-10,200,200); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setBounds(80,60,600,400); jbtnexit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { System.exit(0); } }); jbtnchange.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { try { Float v1 = Float.parseFloat(jtf.getText()); Float v2 = v1*0.6214f; jlb.setText(Float.toString(v2)+"英里"); }catch (NumberFormatException e1){ JOptionPane.showMessageDialog(MainFrame.this,"Error"); }catch (IndexOutOfBoundsException e2){ JOptionPane.showMessageDialog(MainFrame.this,"錯誤"); }catch (Exception e3){ JOptionPane.showMessageDialog(MainFrame.this,"Yo"); } } }); } }
fa9ce4d687594f0113219a2190a93daa1790ade4
b15e1c8853ca002a37729f00b84cda33d0cb9dc3
/spring-richclient-sandbox/src/main/java/org/springframework/richclient/beans/AbstractNestedMemberPropertyAccessor.java
40ea9e034446f3551e5838baf001713a6a673e95
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
danilovalente/spring-richclient
1c1a6d8c5c1b807489a35861c6972a7b9ed8b02a
8a6540f1a1a25e2baa8f4f52b1a5e91988e07d50
refs/heads/master
2022-12-23T05:03:54.745051
2020-02-04T20:29:15
2020-02-04T20:29:15
9,326,865
2
2
Apache-2.0
2022-12-16T15:23:31
2013-04-09T17:15:25
Java
UTF-8
Java
false
false
6,174
java
/* * Copyright 2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package org.springframework.richclient.beans; import org.springframework.beans.NullValueInNestedPathException; import org.springframework.beans.PropertyAccessor; import org.springframework.util.CachingMapDecorator; /** * This implementation extends {@link AbstractMemberPropertyAccessor} with the * functionality of nested property handling. * * @author Arne Limburg * */ public abstract class AbstractNestedMemberPropertyAccessor extends AbstractMemberPropertyAccessor { private AbstractNestedMemberPropertyAccessor parentPropertyAccessor; private String basePropertyName; private final ChildPropertyAccessorCache childPropertyAccessors = new ChildPropertyAccessorCache(); private final boolean strictNullHandlingEnabled; protected AbstractNestedMemberPropertyAccessor(Class targetClass, boolean fieldAccessEnabled, boolean strictNullHandlingEnabled) { super(targetClass, fieldAccessEnabled); this.strictNullHandlingEnabled = strictNullHandlingEnabled; } public AbstractNestedMemberPropertyAccessor(AbstractNestedMemberPropertyAccessor parent, String baseProperty) { super(parent.getPropertyType(baseProperty), parent.isFieldAccessEnabled()); parentPropertyAccessor = parent; basePropertyName = baseProperty; strictNullHandlingEnabled = parent.strictNullHandlingEnabled; } public boolean isStrictNullHandlingEnabled() { return strictNullHandlingEnabled; } protected AbstractNestedMemberPropertyAccessor getParentPropertyAccessor() { return parentPropertyAccessor; } protected String getBasePropertyName() { return basePropertyName; } public Object getTarget() { if (parentPropertyAccessor != null && basePropertyName != null) { return parentPropertyAccessor.getPropertyValue(basePropertyName); } else { return null; } } public Class getTargetClass() { if (parentPropertyAccessor != null) { return parentPropertyAccessor.getPropertyType(basePropertyName); } else { return super.getTargetClass(); } } public boolean isReadableProperty(String propertyPath) { if (PropertyAccessorUtils.isNestedProperty(propertyPath)) { String baseProperty = getBasePropertyName(propertyPath); String childPropertyPath = getChildPropertyPath(propertyPath); if (!super.isReadableProperty(baseProperty)) { return false; } else { return ((PropertyAccessor) childPropertyAccessors.get(baseProperty)) .isReadableProperty(childPropertyPath); } } else { return super.isReadableProperty(propertyPath); } } public boolean isWritableProperty(String propertyPath) { if (PropertyAccessorUtils.isNestedProperty(propertyPath)) { String baseProperty = getBasePropertyName(propertyPath); String childPropertyPath = getChildPropertyPath(propertyPath); return super.isReadableProperty(baseProperty) && ((PropertyAccessor) childPropertyAccessors.get(baseProperty)) .isWritableProperty(childPropertyPath); } else { return super.isWritableProperty(propertyPath); } } public Class getPropertyType(String propertyPath) { if (PropertyAccessorUtils.isNestedProperty(propertyPath)) { String baseProperty = getBasePropertyName(propertyPath); String childPropertyPath = getChildPropertyPath(propertyPath); return ((PropertyAccessor) childPropertyAccessors.get(baseProperty)).getPropertyType(childPropertyPath); } else { return super.getPropertyType(propertyPath); } } public Object getPropertyValue(String propertyPath) { if (PropertyAccessorUtils.isNestedProperty(propertyPath)) { String baseProperty = getBasePropertyName(propertyPath); String childPropertyPath = getChildPropertyPath(propertyPath); return ((PropertyAccessor) childPropertyAccessors.get(baseProperty)).getPropertyValue(childPropertyPath); } else if (isStrictNullHandlingEnabled() && getTarget() == null) { throw new NullValueInNestedPathException(getTargetClass(), propertyPath); } else { return super.getPropertyValue(propertyPath); } } public void setPropertyValue(String propertyPath, Object value) { if (PropertyAccessorUtils.isNestedProperty(propertyPath)) { String baseProperty = getBasePropertyName(propertyPath); String childPropertyPath = getChildPropertyPath(propertyPath); ((PropertyAccessor) childPropertyAccessors.get(baseProperty)).setPropertyValue(childPropertyPath, value); } else if (isStrictNullHandlingEnabled() && getTarget() == null) { throw new NullValueInNestedPathException(getTargetClass(), propertyPath); } else { super.setPropertyValue(propertyPath, value); } } protected String getBasePropertyName(String propertyPath) { int index = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(propertyPath); return index == -1 ? propertyPath : propertyPath.substring(0, index); } protected String getChildPropertyPath(String propertyPath) { int index = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(propertyPath); if (index == -1) { return ""; } return propertyPath.substring(index + 1); } protected PropertyAccessor getChildPropertyAccessor(String propertyName) { return (PropertyAccessor) childPropertyAccessors.get(propertyName); } protected abstract AbstractNestedMemberPropertyAccessor createChildPropertyAccessor(String propertyName); protected void clearChildPropertyAccessorCache() { childPropertyAccessors.clear(); } private class ChildPropertyAccessorCache extends CachingMapDecorator { protected Object create(Object propertyName) { return createChildPropertyAccessor((String) propertyName); } } }
ca6f6f69b262bf2b1494ef79531275c43005a21a
501b03ee2137724824398c2fe85b9601b1cf1839
/src/main/java/com/andreenko/dao/DealDAO.java
d4ca9f8cd185653cbb8c627054341e2ab481c8eb
[]
no_license
poslannikdn/JavaRush
3c77de5238a8c5cd2d9d921801e30a41ca129cf7
e68e041ccba82a6e82b0b4997c26c1f04025f378
refs/heads/master
2021-03-08T19:35:44.845764
2016-05-20T20:52:03
2016-05-20T20:52:03
59,062,262
0
0
null
null
null
null
UTF-8
Java
false
false
551
java
package com.andreenko.dao; import com.andreenko.model.Deal; import java.util.List; /** * Created by jj on 16.05.2016. */ public interface DealDAO { void addDeal(Deal deal); void updateDeal(Deal deal); Deal getDeal(int id); void deleteDeal(int id); List<Deal> getDeals(); List<Deal> getDeals(int page); void addDefaultRecord(); List<Deal> getDoneDeals(int page); List<Deal> getNotDoneDeals(int page); List<Deal> getDealForId(int i); Integer getCount(); int getNotCount(); int getDoneCount(); }
b0f580c9e3412009a13eca0698a01782a686042e
9942fc333e8029ca1cca320fe5e0546674b6c9f7
/311261967/practica4/CDGraph.java
85f9deb5830547117ff04f533ce4b5e8a0c89bf2
[ "MIT" ]
permissive
chrigarc/cd2019-1
71d82aec54b14e2dd0804caf144bea1a7c9480e9
7f7377a84b56fd32b866932d91fe2b963a49fb76
refs/heads/master
2021-07-17T17:24:33.305638
2018-12-05T16:08:34
2018-12-05T16:08:34
144,762,976
4
51
MIT
2018-12-07T15:08:31
2018-08-14T19:21:15
Java
UTF-8
Java
false
false
6,941
java
import org.graphstream.graph.Graph; import org.graphstream.graph.implementations.SingleGraph; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import org.graphstream.graph.Node; import java.util.concurrent.ConcurrentLinkedDeque; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JComponent; import java.awt.Dimension; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import org.graphstream.ui.view.Viewer; import org.graphstream.ui.view.View; public class CDGraph extends Thread{ private Graph graph; private Set<CDNode> nodes; private ConcurrentLinkedDeque<String[]> list; private boolean active; private JFrame frame; private String source; private String destination; private CDNode comp; public CDGraph(Graph g){ this.graph = g; this.nodes = new HashSet<CDNode>(); list = new ConcurrentLinkedDeque<String[]>(); this.active = true; } public void setSource(String source){ this.source = source; } public void setDestination(String destination){ this.destination = destination; } public void run(){ graph.display(); for( Node i : graph.getEachNode() ){ i.addAttribute("ui.label", i.getId()); CDNode cdn = null; cdn = new CDNode(this, i, CDNode.Type.SOURCE); if(i.getId().equals(source)){ }else if(i.getId().equals(destination)){ cdn = new CDNode(this, i, CDNode.Type.DESTINATION); comp = cdn; }else{ cdn = new CDNode(this, i); } new Thread(cdn).start(); nodes.add(cdn); } this.createFrame(); while(active || !list.isEmpty()){ while(!list.isEmpty()){ String[] tmp = list.poll(); graph.getNode(tmp[0]).setAttribute("ui.class", tmp[1]); } sleep(100); } } public void addChangeColor(String nodeId, String color){ list.add(new String[]{nodeId, color}); } private void createFrame(){ frame = new JFrame("Práctica 4"); frame.setSize(800, 800); frame.setLocationRelativeTo(null); // centramos la ventana en la pantalla javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); JPanel jPanel1 = new JPanel(); jPanel1.setLayout(null); frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 517, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 342, Short.MAX_VALUE) ); jScrollPane1.setViewportView(jPanel1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(frame.getContentPane()); frame.getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) ); frame.pack(); JButton button = new JButton("Detener"); button.setSize(800, 30); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ stopAction(); } }); jPanel1.add(button); Iterator<CDNode> iterator = nodes.iterator(); int y = 30; while(iterator.hasNext()){ JComponent component = iterator.next(); component.setSize(760, 30); component.setLocation(30, y); y+=35; jPanel1.add(component); } frame.setVisible(true); } private void sleep(int ms){ try{ Thread.sleep(ms); }catch(Exception ex){ } } public void stopAll(){ Iterator<CDNode> iterator = nodes.iterator(); while(iterator.hasNext()){ iterator.next().stop(); } active = false; while(this.isAlive()){ System.out.println("Finalizando cambios en la grafica espere..."); sleep(1000); } renderComputacionesEquivalentes(); } private void stopAction(){ this.stopAll(); } /** * Termina el metedo para localizar todas las computaciones equivalentes * Las computaciones equivalentes que tienen que encontrar de ley son [A, B, E, F, D] y [A, E, B, F, D] */ private void renderComputacionesEquivalentes(){ Graph equivalentes = new SingleGraph("Equivalentes"); LinkedList<Message> logrados = comp.getLogrados(); LinkedList<Message> equiv = new LinkedList<Message>(); for(Message mensaje: logrados){ Set<String> recorrido = new HashSet<String>(mensaje.getRecorrido()); for(Message comparar: logrados){ Set<String> recorridoComparar = new HashSet<String>(comparar.getRecorrido()); if(!recorrido.equals(recorridoComparar) && !equiv.contains(mensaje)) equiv.add(mensaje); } } if(equivalentes != null){ int noComp = 0; int indN = 0; for(Message mensaje: equiv){ Node anterior = null; Node actual = null; for(String str: mensaje.getRecorrido()){ this.graph.getNode(str).addAttribute("ui.class", "equivalente"); actual = equivalentes.addNode(noComp + " " + indN + " " + str); actual.addAttribute("ui.label",actual.getId()); if(anterior != null){ equivalentes.addEdge(anterior.getId() + " " + actual.getId() + " " + noComp, anterior.getId(), actual.getId()); } anterior = actual; ++indN; } noComp++; } equivalentes.display(); equivalentes.addAttribute("ui.stylesheet", "node { fill-color: pink; }"); this.graph.addAttribute("ui.stylesheet", "node.equivalente { fill-color: green; }"); } } }
22419803a865c686838ee57b7336fc92ea0c694a
c38b4a165e9d2d2099a4e0be252316f75ddfe242
/src/main/java/com/bootcamp/TP/rest/controllers/FournisseurRessource.java
f509455832b4c6ac4f1abff0599e1275060b0746
[]
no_license
kikigith/gestionProjetRest
247a77294a5c43e86f97c1049b323f6d750d52ce
06e8d73e6d1ea7ece50049fc5968ee2e3f259305
refs/heads/master
2021-07-20T05:56:46.714698
2017-10-28T14:05:20
2017-10-28T14:05:20
107,785,023
0
0
null
null
null
null
UTF-8
Java
false
false
4,933
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.bootcamp.TP.rest.controllers; import com.bootcamp.TP.entities.Fournisseur; import com.bootcamp.TP.repositories.FournisseurRepository; import io.swagger.annotations.ApiOperation; import java.sql.SQLException; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** * * @author ARESKO */ @Path("/fournisseurs") public class FournisseurRessource { FournisseurRepository fournisseurRepository = new FournisseurRepository("TPPU-DERBY"); @GET @Path("/") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @ApiOperation( value = "voir une donnée spéciique", notes = "mettre un commentaire", response = Fournisseur.class, responseContainer = "List" ) public Response getFournisseurs() throws SQLException { List<Fournisseur> fournisseurs = fournisseurRepository.findAll(); //access par le concept CORS return Response.status(200).entity(fournisseurs).header("Access-Control-Allow-Origin", "*").build(); } @GET @Path("/{fournisseurId}") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getFournisseurById(@PathParam("fournisseurId") int id) throws SQLException { Fournisseur fournisseur = fournisseurRepository.findByPropertyUnique("id", id); if (fournisseur != null) { return Response.status(200).entity(fournisseur).build(); } else { return Response.status(404).entity("Aucun fournisseur ne porte comme id : "+id).build(); } } @POST //ne marche pas @Path("/create") @Consumes({MediaType.APPLICATION_JSON}) public Response addFournisseur(Fournisseur fournisseur) { String output = " Nouveau fournisseur créé : \n"; try { fournisseurRepository.create(fournisseur); return Response.status(200).entity(output + fournisseur.getId() + "\n"+ fournisseur.getNom()).build(); } catch (SQLException ex) { return Response.status(404).entity("Erreur: Fournisseur non créé").build(); } } @PUT //ne marche pas @Path("/update") @Consumes({MediaType.APPLICATION_JSON}) public Response updateFournisseur(Fournisseur fournisseur) { String output = " Mise à jour de Fournisseur effectuée avec succès pour : "; try { fournisseurRepository.update(fournisseur); return Response.status(200).entity(output + fournisseur.getId() + "\n"+ fournisseur.getNom()).build(); } catch (SQLException ex) { return Response.status(404).entity("Erreur: Fournisseur non mis à jour").build(); } } @PUT //ne marche pas @Path("/update/{fournisseurId}") @Consumes({MediaType.APPLICATION_JSON}) public Response updateFournisseurById(Fournisseur fournisseur) { String output = " Mise à jour de Fournisseur effectuée avec succès pour : "; try { fournisseurRepository.update(fournisseur); return Response.status(200).entity(output + fournisseur.getId() + "\n"+ fournisseur.getNom()).build(); } catch (SQLException ex) { return Response.status(404).entity("Erreur: Fournisseur non mis à jour").build(); } } @DELETE //ne marche pas @Path("/delete") @Consumes({MediaType.APPLICATION_JSON}) public Response deleteFournisseur(Fournisseur fournisseur) { String output = " Suppression de Fournisseur effectuée avec succès pour : "; try { fournisseurRepository.delete(fournisseur); return Response.status(200).entity(output + fournisseur.getId() + "\n"+ fournisseur.getNom()).build(); } catch (SQLException ex) { return Response.status(404).entity("Erreur: Fournisseur non supprimé").build(); } } @POST @Path("/{fournisseurId}") @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response updateFournisseurById(@PathParam("fournisseurId") int id) throws SQLException { Fournisseur fournisseur = fournisseurRepository.findByPropertyUnique("id", id); if (fournisseur != null) { return Response.status(200).entity(fournisseur).build(); } else { return Response.status(404).entity(fournisseur).build(); } } }
2c077c3a5e8bc65203fb5f1c5a879af538af2f2a
4e75533a7223dd19d65d48cf7cbc9a617bc32d57
/src/Selenium/firstSelenium.java
388237c7b1babad99f2baafdbb0631f041941dae
[]
no_license
luckyleo1204/mypracticecode
9141783d8712f42fd57f9cfd2fab6de578ac794a
30522f5a74e2dbf03b281a4107effb7fb4fab41b
refs/heads/master
2020-05-04T13:52:12.427103
2019-04-06T23:02:44
2019-04-06T23:02:44
179,176,947
1
0
null
null
null
null
WINDOWS-1252
Java
false
false
2,375
java
package Selenium; import java.util.ArrayList; import java.util.List; import junit.framework.Assert; import org.apache.xalan.xsltc.compiler.sym; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.Select; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterTest; import org.testng.annotations.Test; public class firstSelenium { WebDriver driver; @Test(enabled=false) public void Test() { driver=utility.getBrowser(driver,"Chrome","http://www.facebook.com"); System.out.println(driver.getTitle()); Assert.assertEquals("Facebook – log in or sign up", driver.getTitle()); } @Test(enabled=false) public void validateRadiobutton() { WebElement male=driver.findElement(By.xpath("//label[contains(text(),'Male')]")); System.out.println(male.isDisplayed()); System.out.println(male.isEnabled()); System.out.println(male.isSelected()); male.click(); System.out.println(male.isSelected()); System.out.println(male.isEnabled()); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Test(enabled=false) public void ValidateDropDown() throws InterruptedException { WebElement day=driver.findElement(By.id("day")); Select s=new Select(day); s.selectByValue("12"); WebElement month=driver.findElement(By.id("month")); Select s1=new Select(month); s1.selectByIndex(4); WebElement year=driver.findElement(By.id("year")); Select s2=new Select(year); s2.selectByVisibleText("1978"); Thread.sleep(1000); driver.close(); } @Test(priority=1) public void BootStrapDropDown(){ driver=utility.getBrowser(driver, "chrome", "http://seleniumpractise.blogspot.in/2016/08/bootstrap-dropdown-example-for-selenium.html"); driver.findElement(By.xpath("//button[@type='button']")).click(); List<WebElement> al=driver.findElements(By.xpath("//ul[@class='dropdown-menu']")); for(WebElement i:al) { System.out.println(i.getText()); if(i.getAttribute("innerHTML").contains("JavaScript")) { i.click(); break; } } } }
5ccc8b9f158931bee04c03d57ed3511ca2df8f29
3ac6868f955e5535d1c62d8f04a1aa79775b91a7
/src/main/java/com/magneto/mutants/exceptions/handlers/RestExceptionHandler.java
24dcb5365f9635f8c1c35da45507330bc3c18c84
[]
no_license
samyskanazawa/magneto
28ba8a85882d034a0eddf94c284d22ab0f04163c
7ef2be46fc68937c8fad38fdbaa8c193627f683f
refs/heads/main
2023-03-14T18:31:26.487548
2021-03-26T22:06:37
2021-03-26T22:06:37
327,786,070
1
0
null
2021-03-26T22:06:37
2021-01-08T03:13:42
Java
UTF-8
Java
false
false
1,290
java
package com.magneto.mutants.exceptions.handlers; import static org.springframework.http.HttpStatus.BAD_REQUEST; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import com.magneto.mutants.exceptions.ErrorMessage; /** * @author samys * */ @EnableWebMvc @ControllerAdvice public class RestExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(IllegalArgumentException.class) protected ResponseEntity<ErrorMessage> handleIllegalArgumentException( IllegalArgumentException ex) { return buildResponseEntity(BAD_REQUEST, ex); } /** * @param httpStatus * @param ex * @return */ private ResponseEntity<ErrorMessage> buildResponseEntity(HttpStatus httpStatus, Exception ex) { ErrorMessage errorMessage = new ErrorMessage(httpStatus, ex); return new ResponseEntity<>(errorMessage, errorMessage.getStatus()); } }
76a9918c7893667e0c63f22d989f53b2e0d63ca0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/14/14_ee12fee4d11b94d9bc4d75370b7120c53f7f4912/ChangeTracker/14_ee12fee4d11b94d9bc4d75370b7120c53f7f4912_ChangeTracker_s.java
9d23daa518e7c079b6cce2be0ac444a4310ec182
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
9,975
java
package com.couchbase.cblite.testapp.tests; import java.io.IOException; import java.net.URL; import java.util.HashMap; import java.util.Map; import junit.framework.Assert; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.HttpParams; import org.apache.http.protocol.HttpContext; import android.os.AsyncTask; import android.util.Log; import com.couchbase.cblite.replicator.changetracker.CBLChangeTracker; import com.couchbase.cblite.replicator.changetracker.CBLChangeTracker.TDChangeTrackerMode; import com.couchbase.cblite.replicator.changetracker.CBLChangeTrackerClient; public class ChangeTracker extends CBLiteTestCase { public static final String TAG = "ChangeTracker"; public void testChangeTracker() throws Throwable { URL testURL = getReplicationURL(); CBLChangeTrackerClient client = new CBLChangeTrackerClient() { @Override public void changeTrackerStopped(CBLChangeTracker tracker) { Log.v(TAG, "See change tracker stopped"); } @Override public void changeTrackerReceivedChange(Map<String, Object> change) { Object seq = change.get("seq"); Log.v(TAG, "See change " + seq.toString()); } @Override public HttpClient getHttpClient() { return new DefaultHttpClient(); } }; final CBLChangeTracker changeTracker = new CBLChangeTracker(testURL, TDChangeTrackerMode.OneShot, 0, client, null); runTestOnUiThread(new Runnable() { @Override public void run() { changeTracker.start(); } }); while(changeTracker.isRunning()) { Thread.sleep(1000); } } public void testChangeTrackerLongPoll() throws Throwable { URL testURL = getReplicationURL(); CBLChangeTrackerClient client = new CBLChangeTrackerClient() { @Override public void changeTrackerStopped(CBLChangeTracker tracker) { Log.v(TAG, "See change tracker stopped"); } @Override public void changeTrackerReceivedChange(Map<String, Object> change) { Object seq = change.get("seq"); Log.v(TAG, "See change " + seq.toString()); } @Override public HttpClient getHttpClient() { return new DefaultHttpClient(); } }; final CBLChangeTracker changeTracker = new CBLChangeTracker(testURL, TDChangeTrackerMode.LongPoll, 0, client, null); runTestOnUiThread(new Runnable() { @Override public void run() { changeTracker.start(); } }); Thread.sleep(10*1000); } public void testChangeTrackerContinuous() throws Throwable { URL testURL = getReplicationURL(); CBLChangeTrackerClient client = new CBLChangeTrackerClient() { @Override public void changeTrackerStopped(CBLChangeTracker tracker) { Log.v(TAG, "See change tracker stopped"); } @Override public void changeTrackerReceivedChange(Map<String, Object> change) { Object seq = change.get("seq"); Log.v(TAG, "See change " + seq.toString()); } @Override public HttpClient getHttpClient() { return new DefaultHttpClient(); } }; final CBLChangeTracker changeTracker = new CBLChangeTracker(testURL, TDChangeTrackerMode.Continuous, 0, client, null); runTestOnUiThread(new Runnable() { @Override public void run() { changeTracker.start(); } }); Thread.sleep(10*1000); } public void testChangeTrackerWithFilterURL() throws Throwable { URL testURL = getReplicationURL(); CBLChangeTracker changeTracker = new CBLChangeTracker(testURL, TDChangeTrackerMode.Continuous, 0, null, null); // set filter changeTracker.setFilterName("filter"); // build filter map Map<String,Object> filterMap = new HashMap<String,Object>(); filterMap.put("param", "value"); // set filter map changeTracker.setFilterParams(filterMap); Assert.assertEquals("_changes?feed=continuous&heartbeat=300000&since=0&filter=filter&param=value", changeTracker.getChangesFeedPath()); } public void testChangeTrackerBackoff() throws Throwable { URL testURL = getReplicationURL(); final MockHttpClient mockHttpClient = new MockHttpClient(); CBLChangeTrackerClient client = new CBLChangeTrackerClient() { @Override public void changeTrackerStopped(CBLChangeTracker tracker) { Log.v(TAG, "changeTrackerStopped"); } @Override public void changeTrackerReceivedChange(Map<String, Object> change) { Object seq = change.get("seq"); Log.v(TAG, "changeTrackerReceivedChange: " + seq.toString()); } @Override public org.apache.http.client.HttpClient getHttpClient() { return mockHttpClient; } }; final CBLChangeTracker changeTracker = new CBLChangeTracker(testURL, CBLChangeTracker.TDChangeTrackerMode.Continuous, 0, client, null); AsyncTask task = new AsyncTask<Object, Object, Object>() { @Override protected Object doInBackground(Object... aParams) { changeTracker.start(); return null; } }; task.execute(); try { // expected behavior: // when: // mockHttpClient throws IOExceptions -> it should start high and then back off and numTimesExecute should be low for (int i=0; i<30; i++) { int numTimesExectutedAfter10seconds = 0; try { Thread.sleep(1000); // take a snapshot of num times the http client was called after 10 seconds if (i == 10) { numTimesExectutedAfter10seconds = mockHttpClient.getNumTimesExecuteCalled(); } // take another snapshot after 20 seconds have passed if (i == 20) { // by now it should have backed off, so the delta between 10s and 20s should be small int delta = mockHttpClient.getNumTimesExecuteCalled() - numTimesExectutedAfter10seconds; Assert.assertTrue(delta < 25); } } catch (InterruptedException e) { e.printStackTrace(); } } } finally { changeTracker.stop(); } } } class MockHttpClient implements org.apache.http.client.HttpClient { private int numTimesExecuteCalled = 0; public int getNumTimesExecuteCalled() { return numTimesExecuteCalled; } @Override public HttpParams getParams() { return null; } @Override public ClientConnectionManager getConnectionManager() { return null; } @Override public HttpResponse execute(HttpUriRequest httpUriRequest) throws IOException, ClientProtocolException { numTimesExecuteCalled++; throw new IOException("Test IOException"); } @Override public HttpResponse execute(HttpUriRequest httpUriRequest, HttpContext httpContext) throws IOException, ClientProtocolException { numTimesExecuteCalled++; throw new IOException("Test IOException"); } @Override public HttpResponse execute(HttpHost httpHost, HttpRequest httpRequest) throws IOException, ClientProtocolException { numTimesExecuteCalled++; throw new IOException("Test IOException"); } @Override public HttpResponse execute(HttpHost httpHost, HttpRequest httpRequest, HttpContext httpContext) throws IOException, ClientProtocolException { numTimesExecuteCalled++; throw new IOException("Test IOException"); } @Override public <T> T execute(HttpUriRequest httpUriRequest, ResponseHandler<? extends T> responseHandler) throws IOException, ClientProtocolException { throw new IOException("<T> Test IOException"); } @Override public <T> T execute(HttpUriRequest httpUriRequest, ResponseHandler<? extends T> responseHandler, HttpContext httpContext) throws IOException, ClientProtocolException { throw new IOException("<T> Test IOException"); } @Override public <T> T execute(HttpHost httpHost, HttpRequest httpRequest, ResponseHandler<? extends T> responseHandler) throws IOException, ClientProtocolException { throw new IOException("<T> Test IOException"); } @Override public <T> T execute(HttpHost httpHost, HttpRequest httpRequest, ResponseHandler<? extends T> responseHandler, HttpContext httpContext) throws IOException, ClientProtocolException { throw new IOException("<T> Test IOException"); } }