blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
313
d9de43e1a3a02f14855f7b3dd83184b659a55114
9101b80af387d6b984522e224c5bc952c0116d7c
/app/src/main/java/com/example/motorcycleapp/RSA.java
5236a3644442badfbc29452d917221d103cca6a7
[]
no_license
KristiAlvarez08/ThesisMobileApp
45a669bd346dd9837dfe957347454feb54a08ab4
d3cc8054e52a793d790215fe3de64519a08293e4
refs/heads/master
2022-12-10T19:25:22.479931
2020-07-16T11:27:48
2020-07-16T11:27:48
280,121,404
0
0
null
null
null
null
UTF-8
Java
false
false
4,532
java
package com.example.motorcycleapp; import java.math.BigInteger; import java.security.SecureRandom; import java.util.Arrays; public class RSA { private BigInteger n, d, e; private int bitlen = 1024; public RSA(BigInteger newn, BigInteger newe) { n = newn; e = newe; } /** Create an instance that can both encrypt and decrypt. */ public RSA(int bits) { bitlen = bits; int p_1 = 163; int q_1 = 139; System.out.println("\n++++++++++++++ RSA ++++++++++++++"); SecureRandom r = new SecureRandom(); // BigInteger p = new BigInteger(bitlen / 2, 100, r); BigInteger p = BigInteger.valueOf(p_1); System.out.print("p: " + p); // BigInteger q = new BigInteger(bitlen / 2, 100, r); BigInteger q = BigInteger.valueOf(q_1); System.out.print(", q: " + q); n = p.multiply(q); System.out.print(", n: " + n); BigInteger m = (p.subtract(BigInteger.ONE)).multiply(q .subtract(BigInteger.ONE)); e = new BigInteger("79"); while (m.gcd(e).intValue() > 1) { e = e.add(new BigInteger("2")); } System.out.print(", e: " + e); d = e.modInverse(m); System.out.println(", d: " + d); } /** Encrypt the given plaintext message. */ public synchronized String encrypt(String message) { return (new BigInteger(message.getBytes())).modPow(e, n).toString(); } /** Encrypt the given plaintext message. */ public synchronized BigInteger encrypt(BigInteger message) { return message.modPow(e, n); } /** Decrypt the given ciphertext message. */ public synchronized String decrypt(String message) { return new String((new BigInteger(message)).modPow(d, n).toByteArray()); } /** Decrypt the given ciphertext message. */ public synchronized BigInteger decrypt(BigInteger message) { return message.modPow(d, n); } /** Generate a new public and private key set. */ public synchronized void generateKeys() { SecureRandom r = new SecureRandom(); BigInteger p = new BigInteger(bitlen / 2, 100, r); BigInteger q = new BigInteger(bitlen / 2, 100, r); n = p.multiply(q); BigInteger m = (p.subtract(BigInteger.ONE)).multiply(q .subtract(BigInteger.ONE)); e = new BigInteger("3"); while (m.gcd(e).intValue() > 1) { e = e.add(new BigInteger("2")); } d = e.modInverse(m); } /** Return the modulus. */ public synchronized BigInteger getN() { return n; } /** Return the public key. */ public synchronized BigInteger getE() { return e; } //====================== M A I N public static String[] Send(String text) { RSA rsa = new RSA(1048); //LENGTH OF ARRAY = 32 String[] encrypted_aes = text.split(""); int length = encrypted_aes.length; // System.out.println("AES LENGTH:"+ encrypted_aes.length); //32 BigInteger plaintext1; BigInteger ciphertext1; String toString1; String[] convert = new String[length]; // System.out.println("CONVERT LENGTH:"+ convert.length); //31 UKoyySbf int count=0,l=0; for (int i = length ; i > 0; i--) { //l=length-i; //System.out.println("length:"+ l); plaintext1 = new BigInteger(encrypted_aes[length - i].getBytes()); ciphertext1 = (rsa.encrypt(plaintext1)); toString1 = ciphertext1.toString(); convert[length - i] = toString1 + ","; } // for (int i = length - 1; i > 0; i--) { // // plaintext1 = new BigInteger(encrypted_aes[length - i].getBytes()); // ciphertext1 = (rsa.encrypt(plaintext1)); // toString1 = ciphertext1.toString(); // convert[(length - i) - 1] = toString1 + ","; // // count++; // l=length-1; // System.out.println("length:"+ l); // // } // if(count==31) { // System.out.println("nakasud ko"); // plaintext1 = new BigInteger(encrypted_aes[0].getBytes()); // ciphertext1 = (rsa.encrypt(plaintext1)); // toString1 = ciphertext1.toString(); // convert[0] = toString1 + ","; // } System.out.println("CipherText [ RSA Cipher ]: " + Arrays.toString(convert)); return convert; } }
d99e27b2e399e86acd5b0020a270bc9a75ab43f5
6fbcccec9b6abd465ed8d56bfe06618f6be9c4f4
/trinity-scaffolder-java-core/src/test/java/com/oregor/trinity/scaffolder/java/core/ProjectDescriptionTest.java
1fedccbdaf5ccd271fbc458b91eb899d211c37e2
[ "Apache-2.0" ]
permissive
oregor-projects/trinity-scaffolder-java
cab8b7a42a2a12fb9f8fb09ad2c9bd6fcd911106
ddbcdb64faf2de46f20876aa74ed3f59a3601078
refs/heads/master
2021-06-10T08:13:28.865010
2019-12-14T10:41:44
2019-12-14T10:41:44
180,868,899
3
0
Apache-2.0
2021-04-26T18:59:21
2019-04-11T20:02:59
Java
UTF-8
Java
false
false
4,256
java
/*- * ==========================LICENSE_START================================= * Trinity Scaffolder for Java Applications * ======================================================================== * Copyright (C) 2019 Christos Tsakostas, OREGOR LTD * ======================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ===========================LICENSE_END================================== */ package com.oregor.trinity.scaffolder.java.core; import static org.assertj.core.api.Assertions.assertThat; import com.oregor.trinity.scaffolder.java.AbstractEqualityTest; import java.time.LocalDateTime; import java.util.LinkedHashSet; import org.junit.Test; /** @author Christos Tsakostas */ public class ProjectDescriptionTest extends AbstractEqualityTest<ProjectDescription> { @Test public void shouldInstantiate() { ProjectDescription projectDescription = createObject1(); assertThat(projectDescription.getContext()).isEqualTo("context"); assertThat(projectDescription.getGroupId()).isEqualTo("com.company.project"); assertThat(projectDescription.getArtifactId()).isEqualTo("artifactId"); assertThat(projectDescription.getModulePrefix()).isEqualTo("prefix-"); assertThat(projectDescription.getVersion()).isEqualTo("0.0.1-SNAPSHOT"); assertThat(projectDescription.getName()).isEqualTo("Project Name"); assertThat(projectDescription.getDescription()).isEqualTo("Project Description"); assertThat(projectDescription.getUrl()).isEqualTo("https://www.company-project.com"); assertThat(projectDescription.getInceptionYear()) .isEqualTo(String.valueOf(LocalDateTime.now().getYear())); assertThat(projectDescription.getOrganizationName()).isEqualTo("Your Company Name"); assertThat(projectDescription.getOrganizationUrl()).isEqualTo("https://www.company.com"); assertThat(projectDescription.getLicenseName()).isEqualTo("apache_v2"); assertThat(projectDescription.getLicenseUrl()).isEqualTo("https://www.license-url.com"); assertThat(projectDescription.getScmConnection()).isEqualTo(""); assertThat(projectDescription.getScmDeveloperConnection()).isEqualTo(""); assertThat(projectDescription.getScmUrl()).isEqualTo(""); assertThat(projectDescription.getDistributionProfile()).isEqualTo(""); assertThat(projectDescription.getExtraModules().size()).isEqualTo(0); } @Override public ProjectDescription createObject1() { return new ProjectDescription( "project", "context", "com.company.project", "artifactId", "prefix", "0.0.1-SNAPSHOT", "Project Name", "Project Description", "https://www.company-project.com", String.valueOf(LocalDateTime.now().getYear()), "Your Company Name", "https://www.company.com", "apache_v2", "https://www.license-url.com", "", "", "", "", new LinkedHashSet<>(), new LinkedHashSet<>(), AppConfigLocationType.INSIDE); } @Override public ProjectDescription createObject2() { return new ProjectDescription( "someOtherProject", "someOtherContext", "com.company.project", "artifactId", "prefix", "0.0.1-SNAPSHOT", "Project Name", "Project Description", "https://www.company-project.com", String.valueOf(LocalDateTime.now().getYear()), "Your Company Name", "https://www.company.com", "apache_v2", "https://www.license-url.com", "", "", "", "", new LinkedHashSet<>(), new LinkedHashSet<>(), AppConfigLocationType.INSIDE); } }
b58b1eaccf39c9a112a2b73c495f82f199cc365b
071ae6642bfc8ebc8215ee534241c61bfcd46722
/src/shapes/Circle.java
e380d65714cc25f93d723b338f8e317b41d4b590
[]
no_license
megansimmons/codeup-java-exercises
cd791d2817ec5eaed73c33714b43ed56e4f19efa
8bc05160c5059ec10ce00646a7d3a55ab5bacbda
refs/heads/master
2020-04-29T19:35:10.966532
2019-04-01T19:14:21
2019-04-01T19:14:21
176,360,055
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package shapes; public class Circle { private double radius; public Circle(double radius){ this.radius = radius; } public double getArea(){ return Math.PI*Math.pow(radius, 2); } public double getCircumference(){ return 2*Math.PI*radius; } }
640c6457527810ab4b5d1f63e02031c6bcb556cb
0f77c5ec508d6e8b558f726980067d1058e350d7
/1_39_120042/com/ankamagames/wakfu/common/game/item/action/ItemActionConstants.java
4a18e2208fddac0b4da5d62e18a82b261e8e1ad3
[]
no_license
nightwolf93/Wakxy-Core-Decompiled
aa589ebb92197bf48e6576026648956f93b8bf7f
2967f8f8fba89018f63b36e3978fc62908aa4d4d
refs/heads/master
2016-09-05T11:07:45.145928
2014-12-30T16:21:30
2014-12-30T16:21:30
29,250,176
5
5
null
2015-01-14T15:17:02
2015-01-14T15:17:02
null
UTF-8
Java
false
false
7,703
java
package com.ankamagames.wakfu.common.game.item.action; import com.ankamagames.framework.external.*; public enum ItemActionConstants implements ExportableEnum, Parameterized { DISASSEMBLE_ITEM(1, (ParameterListSet)ItemActionParameters.ITEM_DISASSEMBLE, "Detruit un item pour r\u00e9cup\u00e9rer des poudres", false), SEED_ACTION(2, (ParameterListSet)ItemActionParameters.SEED_ACTION, "Permet la plantation d'un item", false), PLAY_SCRIPT(3, (ParameterListSet)ItemActionParameters.PLAY_LUA, "Permet de jouer un Script", false), DEPLOY_ELEMENT(5, (ParameterListSet)ItemActionParameters.DEPLOY_ELEMENT, "Permet de d\u00e9ployer un \u00e9l\u00e9ment interactif", false), SPAWN_MONSTER(6, (ParameterListSet)ItemActionParameters.SPAWN_MONSTER, "Permet de spawn un monstre \u00e0 cot\u00e9 du joueur", false), START_SCENARIO(7, (ParameterListSet)ItemActionParameters.START_SCENARIO, "Permet de lancer un sc\u00e9nario sur un joueur", false), GIVE_KAMAS(8, (ParameterListSet)ItemActionParameters.GIVE_KAMAS, "Donne des kamas au joueur", false), TELEPORT(9, (ParameterListSet)ItemActionParameters.TELEPORT, "T\u00e9l\u00e9porte un joueur", false), GIVE_TITLE(10, (ParameterListSet)ItemActionParameters.GIVE_TITLE, "Donne un titre \u00e0 un joueur", false), OPEN_BACKGROUND_DISPLAY(11, (ParameterListSet)ItemActionParameters.OPEN_BACKGROUND_DISPLAY, "Ouvre une interface background", false), OPEN_PASSPORT(12, (ParameterListSet)ItemActionParameters.OPEN_PASSPORT, "Affiche le passeport", false), LEARN_EMOTE(13, (ParameterListSet)ItemActionParameters.LEARN_EMOTE, "Apprend une Emote", false), ADD_WORLD_POSITION_MARKER(15, (ParameterListSet)ItemActionParameters.ADD_WORLD_POSITION_MARKER, "Ajoute une boussole", false), REDUCE_DEAD_STATE(16, (ParameterListSet)ItemActionParameters.REDUCE_DEAD_STATE, "r\u00e9duit de 1 les Malus de mort", false), PLAY_EMOTE(17, (ParameterListSet)ItemActionParameters.PLAY_EMOTE, "Joue une emote", false), ACTIVATE_ACHIEVEMENT(18, (ParameterListSet)ItemActionParameters.ACTIVATE_ACHIEVEMENT_LIST, "Active un exploit", false), FOLLOW_ACHIEVEMENT(19, (ParameterListSet)ItemActionParameters.FOLLOW_ACHIEVEMENT_LIST, "Suit un exploit", false), MERGE_ITEMS(20, (ParameterListSet)ItemActionParameters.MERGE_ITEMS_LIST, "Fusionne des items", false), LEARN_DIMENSIONAL_BAG_VIEW(21, (ParameterListSet)ItemActionParameters.LEARN_DIMENSIONAL_BAG_VIEW, "Apprend une custom de Havre-Sac", false), GIVE_LEVELS_TO_ALL_SPELL_BRANCH(22, (ParameterListSet)ItemActionParameters.GIVE_LEVELS_TO_ALL_SPELL_BRANCH, "Ajoute X niveaux \u00e0 tous les sorts \u00e9l\u00e9mentaires", false), GIVE_XP(23, (ParameterListSet)ItemActionParameters.GIVE_XP, "Donne de l'xp au joueur", false), RESET_ACHIEVEMENT(24, (ParameterListSet)ItemActionParameters.RESET_ACHIEVEMENT, "R\u00e9initialise un achievement", false), GIVE_LEVELS_TO_SPELL_BRANCH(25, (ParameterListSet)ItemActionParameters.GIVE_LEVELS_TO_SPELL_BRANCH, "Ajoute X niveaux aux sorts d'une branche \u00e9l\u00e9mentaire", false), SPLIT_ITEM_SET(26, (ParameterListSet)ItemActionParameters.SPLIT_ITEM_SET, "S\u00e9pare un objet \u00e9l\u00e9ments d'une panoplie", true), GIVE_APTITUDE_LEVELS(27, (ParameterListSet)ItemActionParameters.GIVE_APTITUDE_LEVELS, "Donne des niveaux \u00e0 une aptitude pr\u00e9cise", false), GIVE_RANDOM_ITEM_IN_LIST(28, (ParameterListSet)ItemActionParameters.GIVE_RANDOM_ITEM_IN_LIST, "Donne un item dans la liste", false), SPELL_RESTAT(29, (ParameterListSet)ItemActionParameters.SPELL_RESTAT, "R\u00e9initialise les sorts \u00e9l\u00e9mentaires", false), APTITUDE_RESTAT(30, (ParameterListSet)ItemActionParameters.APTITUDE_RESTAT, "R\u00e9initialise les aptitudes", false), TP_TO_RESPAWN_POINT(31, (ParameterListSet)ItemActionParameters.TP_TO_RESPAWN_POINT, "Retour au point de respawn", false), CONSUME_KROSMOZ_FIGURE(32, (ParameterListSet)ItemActionParameters.CONSUME_KROSMOZ_FIGURE, "Consomme une figurine Krosmaster", false), ACTIVATE_RESTAT(33, (ParameterListSet)ItemActionParameters.ACTIVATE_RESTAT, "Active un restat", false), SEARCH_TREASURE(34, (ParameterListSet)ItemActionParameters.SEARCH_TREASURE, "Active la recherche de tr\u00e9sor", false), REMOVE_LAST_GEM(35, (ParameterListSet)ItemActionParameters.REMOVE_LAST_GEM, "Retire la derniere gemme d'un item", false), GIVE_ITEMS(36, (ParameterListSet)ItemActionParameters.GIVE_ITEMS, "Donne des items", false), CHANGE_NATION(37, (ParameterListSet)ItemActionParameters.CHANGE_NATION, "Change de nation", false), KILL_MONSTERS_IN_RADIUS(38, (ParameterListSet)ItemActionParameters.KILL_MONSTERS_IN_RADIUS, "Tue les monstres dans un rayon", false), COMPANION_ACTIVATION(39, (ParameterListSet)ItemActionParameters.COMPANION_ACTIVATION, "Active un compagnon", false), CHANGE_GEM_TYPE(40, (ParameterListSet)ItemActionParameters.CHANGE_GEM, "Change le type de la gemme", false), EXTENDS_RENT_DURATION(41, (ParameterListSet)ItemActionParameters.EXTENDS_RENT_DURATION, "Allonge la dur\u00e9e de location d'un item", false), ALL_SPELL_RESTAT(42, (ParameterListSet)ItemActionParameters.ALL_SPELL_RESTAT, "Reinitialise les sorts \u00e9l\u00e9mentaires et les sorts passifs", false), RECUSTOM(43, (ParameterListSet)ItemActionParameters.RECUSTOM, "Lance la recustom d'un personnage", false), COMMON_APTITUDE_RESTAT_ACTION(44, (ParameterListSet)ItemActionParameters.COMMON_APTITUDE_RESTAT, "Reinitialise les aptitudes de carac", false), INSTANCE_SPEAKER(45, (ParameterListSet)ItemActionParameters.INSTANCE_SPEAKER, "Diffuse un message aux joueurs pr\u00e9sents dans l'instance", false), PET_XP(46, (ParameterListSet)ItemActionParameters.PET_XP, "Rajoute des niveaux aux pets", false), PET_HP(47, (ParameterListSet)ItemActionParameters.PET_HP, "Heal un pet", false), LEARN_COSTUME(48, (ParameterListSet)ItemActionParameters.LEARN_COSTUME, "Apprend cet objet en tant que costume", false), LEARN_PET_EQUIPMENT(49, (ParameterListSet)ItemActionParameters.LEARN_COSTUME, "Apprend cet objet en tant qu'equipement de familier", false), REROLL_ELEMENTS(50, (ParameterListSet)ItemActionParameters.REROLL_ELEMENTS, "Roll de nouveaux \u00e9l\u00e9ments (effets \u00e0 \u00e9l\u00e9ts variables) pour cet item", false); private final byte m_id; private final String m_label; private final ParameterListSet m_parameter; private final boolean m_canBeUsedDuringOccupation; private ItemActionConstants(final int id, final ParameterListSet parameterListSet, final String label, final boolean canBeUsedDuringOccupation) { this.m_id = (byte)id; this.m_label = label; this.m_parameter = parameterListSet; this.m_canBeUsedDuringOccupation = canBeUsedDuringOccupation; } @Override public String getEnumId() { return String.valueOf(this.m_id); } @Override public String getEnumLabel() { return this.m_label; } public boolean canBeUsedDuringOccupation() { return this.m_canBeUsedDuringOccupation; } public static ItemActionConstants getFromId(final int action_id) { for (final ItemActionConstants constants : values()) { if (constants.m_id == action_id) { return constants; } } return null; } @Override public ParameterListSet getParametersListSet() { return this.m_parameter; } @Override public String getEnumComment() { return null; } public byte getId() { return this.m_id; } }
9ff3071f236f9848d5ff79b5594de6f3a84c583f
9f39703139d19a92efcbe03dfbd04b3b8eb4ff2c
/src/main/java/openmods/calc/types/multi/UnitType.java
24cd5c08cff24baa1f063517ed9f00729a3757d6
[ "MIT" ]
permissive
TheSilkMiner/OpenModsLib
5353c81d2f3ce2e8f8d807a1cf622a1725034649
e6b35cdb2b226a22dbe8ac25db2fc426a10e0814
refs/heads/master
2021-01-16T07:07:22.503936
2017-03-05T11:28:20
2017-03-05T11:28:20
55,899,894
0
0
null
2016-04-10T13:16:38
2016-04-10T13:16:37
null
UTF-8
Java
false
false
204
java
package openmods.calc.types.multi; public class UnitType { public static final UnitType INSTANCE = new UnitType(); private UnitType() {} @Override public String toString() { return "<null>"; } }
b327459ee048aac9584381c3a182bb3ae9aef3d2
bb7a6d281d5deedd2b53c8071e72010009df9647
/src/test/java/com/github/freva/asciitable/LineUtilsTest.java
7536fd2f1339aec444daca8288eab0d076794c33
[ "MIT" ]
permissive
alex-sky-cloud/ascii-table
f5e552712d877c7a5b75f06ba3cd0b80651323e5
d3a360c57e7b8faa05156ef82e3d39d715f4b300
refs/heads/master
2023-04-21T00:45:35.862870
2021-05-16T19:33:03
2021-05-16T19:33:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
package com.github.freva.asciitable; import org.junit.Test; import java.util.Arrays; import java.util.stream.Collectors; import static org.junit.Assert.assertEquals; public class LineUtilsTest { @Test public void linesIteratorTest() { assertEquals(Arrays.asList("", "", "Some text", "", "more text", "text", "end"), LineUtils.lines("\n\nSome text\r\n\rmore text\rtext\nend").collect(Collectors.toList())); } }
b915b136a07aa1196d85ce7db73f1040e2d4f1e3
ec5867275239b46de811fba74fddfeb648f9d825
/CSIS 1410/LabSerialization/src/labSerialization/LabSerialization.java
39d257882aa9a8cb87ce8ec181c1b628d752988f
[]
no_license
Nakagochi/Nakagochi
b6dce16c40643c61224b90be856a305e1ff1c296
564313779e65e9e5bf2dbbf4c85dd52c1307dea4
refs/heads/master
2023-03-20T03:09:03.124797
2020-10-03T22:45:48
2020-10-03T22:45:48
220,139,326
0
0
null
2020-05-12T05:30:32
2019-11-07T03:00:59
HTML
UTF-8
Java
false
false
2,065
java
package labSerialization; import java.awt.Color; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class LabSerialization { static String filename = "Demo.ser"; public static void main(String[] args) { ListVsSetDemo2 demo = new ListVsSetDemo2( new ColoredSquare(4, Color.RED), new ColoredSquare(6, Color.BLUE), new ColoredSquare(4, Color.RED), new ColoredSquare(8, Color.YELLOW), new ColoredSquare(14, Color.RED), new ColoredSquare(16, Color.BLUE), new ColoredSquare(14, Color.RED), new ColoredSquare(18, Color.YELLOW)); testDemo(demo); serialize(demo,filename); ListVsSetDemo2 demo2 = deSerialize(filename); testDemo(demo2); }; private static void testDemo(ListVsSetDemo2 demo) { System.out.println("List:"); System.out.println(demo.getListElements()); System.out.println("Set:"); System.out.println(demo.getSetElements()); } private static void serialize(ListVsSetDemo2 demo, String filename) { try(ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File(filename)))){ out.writeObject(demo); } catch (FileNotFoundException e) { System.out.println("file not found"); } catch (IOException e) { System.out.println("IO error"); } } private static ListVsSetDemo2 deSerialize( String filename) { try(ObjectInputStream in = new ObjectInputStream(new FileInputStream(new File(filename)))){ return(ListVsSetDemo2) in.readObject(); } catch (FileNotFoundException e) { System.out.println("file not found"); } catch (IOException e) { System.out.println("IO error"); } catch (ClassNotFoundException e) { System.out.println("Class not found"); } return null; } }
2e48de09b466b9b0ae4b3671895c57c70f1d9308
ddd65133250b25b6551bb2d0a9d014954248deb6
/sources/com/mysql/jdbc/ServerAffinityStrategy.java
c934f805cf5f335f36c843f260bc7fead12d3b2d
[]
no_license
TouailabIlyass/android_gststck
c00cf495997224dd7ea5f1b91c95c7c75df855c2
38a57cd36047eeab4ecd2661ae8616a7660089b6
refs/heads/master
2020-04-05T04:04:45.237337
2018-11-07T11:39:18
2018-11-07T11:39:18
156,537,016
0
0
null
null
null
null
UTF-8
Java
false
false
1,819
java
package com.mysql.jdbc; import java.sql.SQLException; import java.util.List; import java.util.Map; import java.util.Properties; public class ServerAffinityStrategy extends RandomBalanceStrategy { public static final String AFFINITY_ORDER = "serverAffinityOrder"; public String[] affinityOrderedServers = null; public void init(Connection conn, Properties props) throws SQLException { super.init(conn, props); String hosts = props.getProperty(AFFINITY_ORDER); if (!StringUtils.isNullOrEmpty(hosts)) { this.affinityOrderedServers = hosts.split(","); } } public ConnectionImpl pickConnection(LoadBalancedConnectionProxy proxy, List<String> configuredHosts, Map<String, ConnectionImpl> liveConnections, long[] responseTimes, int numRetries) throws SQLException { if (this.affinityOrderedServers == null) { return super.pickConnection(proxy, configuredHosts, liveConnections, responseTimes, numRetries); } Map<String, Long> blackList = proxy.getGlobalBlacklist(); for (String host : this.affinityOrderedServers) { if (configuredHosts.contains(host) && !blackList.containsKey(host)) { ConnectionImpl conn = (ConnectionImpl) liveConnections.get(host); if (conn != null) { return conn; } try { return proxy.createConnectionForHost(host); } catch (SQLException sqlEx) { if (proxy.shouldExceptionTriggerConnectionSwitch(sqlEx)) { proxy.addToGlobalBlacklist(host); } } } } return super.pickConnection(proxy, configuredHosts, liveConnections, responseTimes, numRetries); } }
fe31e353b9e04cec8bda1a101462894a4124ddcc
4763d100cfbdd6ef98e1279993062f58bb0bbc00
/src/example/newproject/FIREWALLWEAK.java
f7f1ce2be72a8e121676668e09cd4fd5c67eb0eb
[]
no_license
msoni1369/Educative-Android-App
24b1804bddd0f36a9105edad5cef7617d22795db
2d5fc2a19a0e8ff4eb1bcec93902c798b5ca0855
refs/heads/master
2021-05-23T13:31:46.266535
2020-04-05T19:30:50
2020-04-05T19:30:50
253,311,969
0
0
null
null
null
null
UTF-8
Java
false
false
1,558
java
package example.newproject; import android.support.v7.app.ActionBarActivity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; public class FIREWALLWEAK extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_firewallweak); TextView tv=(TextView)findViewById(R.id.textView10); } public void ultrasurf(View v) { String url= "ultrasurf.us"; Intent i= new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } public void tor(View v) { String url= "https://www.torproject.org"; Intent i= new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.firewallweak, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
ad4d7b32ffa8015f8c61480fd606e843f673b791
4163be8ee9cba0ad3d5684db5664bd8bb5b542ea
/src/main/java/net/jolikit/bwd/impl/utils/cursor/AbstractBwdCursorManager.java
b0d8b7fbd4f53d81e78df090b1242422e2bb61f2
[ "Apache-2.0" ]
permissive
jeffhain/jolikit
a7efef3b04d50d29a91526c6e726abeabdd52304
3e8dc5a3660de9c74bd8873cd5509926320c5056
refs/heads/master
2023-08-16T09:38:53.797560
2021-11-05T20:50:45
2021-11-05T20:50:45
183,952,453
5
1
null
null
null
null
UTF-8
Java
false
false
4,424
java
/* * Copyright 2019 Jeff Hain * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jolikit.bwd.impl.utils.cursor; import java.util.ArrayList; import net.jolikit.bwd.api.BwdCursors; import net.jolikit.bwd.api.InterfaceBwdCursorManager; import net.jolikit.lang.Dbg; import net.jolikit.lang.LangUtils; /** * Abstract class for simple implementations. */ public abstract class AbstractBwdCursorManager implements InterfaceBwdCursorManager { //-------------------------------------------------------------------------- // CONFIGURATION //-------------------------------------------------------------------------- private static final boolean DEBUG = false; //-------------------------------------------------------------------------- // PRIVATE CLASSES //-------------------------------------------------------------------------- /** * Must not use cursor as key: we want each key to be specific * to an add action. */ private static class MyKey { private final int cursor; private MyKey(int cursor) { this.cursor = cursor; } } //-------------------------------------------------------------------------- // FIELDS //-------------------------------------------------------------------------- private final ArrayList<MyKey> keysList = new ArrayList<MyKey>(); /** * Can be null. */ private final Object component; //-------------------------------------------------------------------------- // PUBLIC METHODS //-------------------------------------------------------------------------- /** * Creates a cursor manager that calls setCursor(component,cursor) * with the specified component, on each cursor add or removal. * * @param component Component where to set current added cursor. * Can be null, for libraries that don't use such a component. */ public AbstractBwdCursorManager(Object component) { this.component = component; } @Override public int getCurrentAddedCursor() { final int size = this.keysList.size(); if (size == 0) { return this.getDefaultCursor(); } else { return this.keysList.get(size-1).cursor; } } @Override public Object addCursorAndGetAddKey(int cursor) { final MyKey key = new MyKey(cursor); this.keysList.add(key); final int newCursor = this.getCurrentAddedCursor(); if (DEBUG) { Dbg.log("addCursor(" + cursor + ") : newCursor = " + BwdCursors.toString(newCursor)); } this.setCursor(this.component, newCursor); return key; } @Override public void removeCursorForAddKey(Object key) { LangUtils.requireNonNull(key); // Early type check in case the specified key would have fancy equals. if ((!(key instanceof MyKey)) || (!this.keysList.remove(key))) { throw new IllegalArgumentException("key unknown: " + key); } final int newCursor = this.getCurrentAddedCursor(); if (DEBUG) { Dbg.log("removeCursorForKey(...) : newCursor = " + BwdCursors.toString(newCursor)); } this.setCursor(this.component, newCursor); } //-------------------------------------------------------------------------- // PROTECTED METHODS //-------------------------------------------------------------------------- /** * This default implementation returns BwdCursors.ARROW. * Override if the backing library uses a different one. * * @return The cursor used when no cursor has been added. */ protected int getDefaultCursor() { return BwdCursors.ARROW; } protected abstract void setCursor(Object component, int cursor); }
4a3b607205f375ab9da15ab3f6038d0cc087f017
b17fc9e282f3ae10579e4456d9ca2774f4b14780
/thinking-in-java4/src/main/java/cn/tim/thinking/clazz14/RTTI.java
7671319834431498b2bb6ee6aaa78b5b59d24e4b
[]
no_license
luolibing/coding-life
8c351e306111b217585c4fbaab34c10e42012b23
06318973d4c0bbbfc0225c4a5bc5d4a2ddf2c6ff
refs/heads/master
2022-12-27T02:26:49.599091
2021-12-22T04:01:00
2021-12-22T04:01:00
94,624,544
1
1
null
2022-12-16T06:49:34
2017-06-17T13:11:35
Java
UTF-8
Java
false
false
13,501
java
package cn.tim.thinking.clazz14; import org.junit.Test; import java.lang.reflect.Field; import java.util.*; /** * Created by LuoLiBing on 16/9/23. * 运行时类型信息可以使你可以在程序运行时发现和使用类型信息 * 它使你从只能在编译器执行面向对象的操作的禁锢中解脱出来 * 运行时识别对象和类信息的两种方式: * 1 传统的RTTI,它假设我们在编译时已经知道了所有的类型 * 2 反射机制,允许我们在运行时发现和使用类信息 * */ public class RTTI { abstract class Shape { protected int flag; public void draw() { // 自动调用this.toString()方法 System.out.println(this + ".draw()"); } public void sign() { flag = 1; } // 覆写了父类的toString()方法,将其改为抽象方法 public String toString() { return flag + ""; } } class Circle extends Shape { @Override public String toString() { return "Circle " + super.toString(); } } class Square extends Shape { @Override public String toString() { return "Square " + super.toString(); } } class Triangle extends Shape { @Override public String toString() { return "Triangle " + super.toString(); } } class Rhomboid extends Shape { @Override public String toString() { return "Rhomboid " + super.toString(); } } @Test public void test1() { List<Shape> shapeList = Arrays.asList(new Circle(), new Square(), new Triangle()); // 实际上ArrayList里面是使用了Object[]存储elements,都会当做Object,当从list中取出元素时,会根据泛型对其进行强转. (E) elementData[index] // 在Java中,所有的类型转换都是在运行时进行正确性检查,这就是RTTI,在运行时识别一个对象的类型. // RTTI (run-time type Identification)运行时类型识别 shapeList.get(1); for(Shape shape : shapeList) { if(shape instanceof Circle) { shape.sign(); } shape.draw(); } System.out.println(); Shape rhomboid = new Rhomboid(); rhomboid.draw(); if(rhomboid instanceof Rhomboid) { ((Rhomboid) rhomboid).draw(); } if(rhomboid instanceof Circle) { ((Circle) rhomboid).draw(); } } /** * RTTI工作是由成为Class对象的特殊对象完成的,它包含与类相关的信息. * 每个类都有一个Class对象,编写一个新类编译就会产生一个Class文件.然后当需要使用这个类时,使用JVM类加载器进行加载过程最终产生Class对象 * * 类加载器 * 类加载器子系统包含一条类加载器链,但只有一个原生类加载器,它是JVM实现的一部分. 原生类加载器加载的是所谓的可信类,包括java API类. * 所有类都是在对其第一次使用时,动态加载到JVM中的.当程序窗机看第一个对类的静态成员的引用时,就会加载这个类.这证明构造函数也是类的静态方法. * * 使用类加载器加载类时,会同时加载这个类中所引用的其他类 * */ @Test public void test2() { System.out.println("inside main"); // 构造函数加载 new Candy(); System.out.println("After creating Candy"); try { // 使用Class.forName()加载,内部类加载方式 RTTI$Gum Class.forName("cn.tim.thinking.clazz14.RTTI$Gum"); } catch (ClassNotFoundException e) { System.out.println("could't find gum"); } System.out.println("After Class.forName(Gum)"); new Cookie(); System.out.println("After"); } static class Candy extends Gum { static { System.out.println("Loading Candy"); } } static class Gum { static { System.out.println("Loading Gum"); } } static class Cookie { static { System.out.println("Loading Cookie"); } } interface HasBatteries {} interface Waterproof {} interface Shoots extends Spoot {} interface Spoot {} class Toy { Toy() {} Toy(int i) {} } class FancyToy extends Toy implements HasBatteries, Waterproof, Shoots { // FancyToy() {super(1);} } public void printInfo(Class clazz) { System.out.println("className: " + clazz.getName() + " is interface? [" + clazz.isInterface() + "]"); System.out.println("Simple name: " + clazz.getSimpleName()); System.out.println("Canonical name: " + clazz.getCanonicalName()); } @Test public void test3() { Class c = null; try { c = Class.forName("cn.tim.thinking.clazz14.RTTI$FancyToy"); } catch (ClassNotFoundException e) { System.out.println("can't find FancyToy"); System.exit(1); } printInfo(c); System.out.println(); // 打印接口 for(Class face : c.getInterfaces()) { printInfo(face); System.out.println(); } // 初始化 Class up = c.getSuperclass(); Object obj = null; try { // 使用newInstance()方法需要有一个无参构造函数 obj = up.newInstance(); } catch (InstantiationException e) { System.out.println("can not instantiate"); System.exit(1); } catch (IllegalAccessException e) { System.out.println("can not access"); System.exit(1); } printInfo(obj.getClass()); } public static void main(String[] args) { String basePackage = "cn.tim.thinking.clazz14.RTTI$"; List<Shape> shapes = new ArrayList<>(); for(String arg : args) { try { Class<?> clazz = Class.forName(basePackage + arg); shapes.add((Shape) clazz.newInstance()); } catch (Exception e) { e.printStackTrace(); } } } @Test public void test4() { System.out.println("class:"); printExtendInfo(ArrayList.class); System.out.println(); System.out.println("interface:"); printInterfaceInfo(ArrayList.class); System.out.println(); System.out.println("detail: "); printClassDetail(ArrayList.class); } public void printExtendInfo(Class clazz) { System.out.println(clazz.getName()); Class superclass = clazz.getSuperclass(); if(superclass != null) { printExtendInfo(superclass); } } public void printInterfaceInfo(Class clazz) { Class[] interfaces = clazz.getInterfaces(); for(Class in : interfaces) { if(in.getInterfaces() != null) { System.out.println(in.getName()); if(in.getSuperclass() != null) { printExtendInfo(in.getSuperclass()); } } } } public void printClassDetail(Class clazz) { Field[] fields = clazz.getDeclaredFields(); for(Field field : fields) { System.out.println(field.getType().getName() + " :" + field.getName()); } } @Test public void test5() { char[] chars = new char[5]; int[] ints = new int[] {2}; List<String> list = new ArrayList<>(); System.out.println(chars.getClass()); // 判断是否是一个基本类型使用isPrimitive()方法 isArray()是否是一个数组,isEnum枚举, chars不是一个对象类型,也不是一个基本类型,是一个数组 System.out.println(chars.getClass().isPrimitive()); System.out.println(chars.getClass().isArray()); System.out.println(list.getClass().isPrimitive()); } /** * 类字面常量: 使用类字面常量更安全,因为编译时就已经受到检查,因此更高效. 使用类字面常量不会自动初始化该class对象. * 类加载过程: * 1 加载,由类加载器执行的.查找字节码文件,并且从这些字节码中创建一个Class对象 * 2 链接,验证类中的字节码,为静态域分配存储空间,如果必需的话,将解析这个类创建的对其他类的所有引用 * 3 初始化.如果该类有超类,先对其进行初始化,执行静态初始化器和静态快 */ @Test public void test6() throws ClassNotFoundException { Class<FancyToy> fancyToyClass = FancyToy.class; ClassLoader classLoader = fancyToyClass.getClassLoader(); classLoader.loadClass(FancyToy.class.getName()); Class<Integer> type = Integer.TYPE; // Class.getPrimitiveClass("int") } static class Initable { final static int staticFinal = 47; final static int staticFinal2 = rand.nextInt(100); static { System.out.println("Init Initable"); } } static class Initable2 { static int staticNonFinal = 147; static { System.out.println("init Initable2"); } } static class Initable3 { static int staticNonFinal = 74; static { System.out.println("init Initable3"); } } static Random rand = new Random(47); /** * 初始化有效地实现了尽可能的惰性 * 1 仅使用.class类字面常量来获得对类的引用不会引发初始化, 但是使用Class.forName()立即就进行了初始化 * 2 如果一个static final值是"编译期常量",那么这个值不需要进行初始化就可以被读取.而同样是final static Initable.staticFinal2并不是编译期常量,所以不会引发加载 * 3 如果一个static域不是final的,那么在对它访问时,总是要求在它被读取之前,要先进行链接(为这个域分配存储空间)和初始化(初始化该存储空间),所以会要求加载 */ @Test public void test7() { // 类字面常量并不会导致类被加载 Class<Initable> initable = Initable.class; System.out.println("After creating Initable ref"); // final static常量 例如final static int i = 10;并不会导致类被加载 System.out.println(Initable.staticFinal); // final static常量,但是调用了random.next()方法,类被加载 System.out.println(Initable.staticFinal2); // 而使用非final型的static int i = 147;却会导致类被加载 System.out.println(Initable2.staticNonFinal); try { // class.forName()会触发类加载 Class<?> initable3 = Class.forName("cn.tim.thinking.clazz14.RTTI$Initable3"); } catch (ClassNotFoundException e) { e.printStackTrace(); } System.out.println("After creating Initable3 ref"); System.out.println(Initable3.staticNonFinal); } @Test public void test8() { Class integerClass = int.class; // 泛型 Class<Integer> integerClass1 = int.class; // error Number class并不是Integer class的父类, Class<Number> integerClass2 = int.class; Class<?> integerClass2 = int.class; // Class<?>优于平凡的Class,即使它们是等价的. 使用class可能要等到运行时才能发现错误,而使用泛型会在编译器发现错误的存在 // 使用通配符与extends关键字相结合,创建一个范围. Class<? extends Number> bounded = int.class; bounded = double.class; } static class CountedInteger { private static long counter; private final long id = counter ++; public String toString() { return Long.toString(id); } } public class FilledList<T> { private Class<T> type; public FilledList(Class<T> type) { this.type = type; } public List<T> create(int nElements) { List<T> list = new ArrayList<>(); for(int i = 0; i < nElements; i++) { try { // Class<T>加了泛型,使用newInstance时不需要进行强转 list.add(type.newInstance()); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } } return list; } } @Test public void test9() { FilledList<CountedInteger> filled = new FilledList<>(CountedInteger.class); List<CountedInteger> list = filled.create(10); list.forEach(System.out::println); } @Test public void test10() throws IllegalAccessException, InstantiationException { Class<FancyToy> ftClass = FancyToy.class; FancyToy fancyToy = ftClass.newInstance(); Class<? super FancyToy> up = ftClass.getSuperclass(); // getSuperclass只会返回? super class泛型,返回某个类的超类 Class<Toy> superclass = ftClass.getSuperclass(); // 由于不知道up的具体类型,所以newInstance的时候会返回Object类型 Object o = up.newInstance(); String[] array = new String[] {,}; System.out.println(array.length); } @Test public void test11() { } }
054fcfd4cb31de65eaf98c45ef5495029e7baae2
cc4914a6c1573f0acad58e500ef942ef397a2b83
/src/test/java/org/jhipster/web/rest/UserJWTControllerIntTest.java
751d748d02e7c51b1b12becfbf40ce59d83c6eeb
[]
no_license
hlaingwintunn/jhipster_demo
ec7ebf9980eed63c0c34d00e71d4b4b3f0651c24
657ea929618218cd9dc3e013b7d4536917e474df
refs/heads/master
2021-04-15T07:59:21.412729
2018-03-26T16:06:37
2018-03-26T16:06:37
126,855,388
0
0
null
null
null
null
UTF-8
Java
false
false
4,832
java
package org.jhipster.web.rest; import org.jhipster.JhipsterDemoApp; import org.jhipster.domain.User; import org.jhipster.repository.UserRepository; import org.jhipster.security.jwt.TokenProvider; import org.jhipster.web.rest.vm.LoginVM; import org.jhipster.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.isEmptyString; import static org.hamcrest.Matchers.not; /** * Test class for the UserJWTController REST controller. * * @see UserJWTController */ @RunWith(SpringRunner.class) @SpringBootTest(classes = JhipsterDemoApp.class) public class UserJWTControllerIntTest { @Autowired private TokenProvider tokenProvider; @Autowired private AuthenticationManager authenticationManager; @Autowired private UserRepository userRepository; @Autowired private PasswordEncoder passwordEncoder; @Autowired private ExceptionTranslator exceptionTranslator; private MockMvc mockMvc; @Before public void setup() { UserJWTController userJWTController = new UserJWTController(tokenProvider, authenticationManager); this.mockMvc = MockMvcBuilders.standaloneSetup(userJWTController) .setControllerAdvice(exceptionTranslator) .build(); } @Test @Transactional public void testAuthorize() throws Exception { User user = new User(); user.setLogin("user-jwt-controller"); user.setEmail("[email protected]"); user.setActivated(true); user.setPassword(passwordEncoder.encode("test")); userRepository.saveAndFlush(user); LoginVM login = new LoginVM(); login.setUsername("user-jwt-controller"); login.setPassword("test"); mockMvc.perform(post("/api/authenticate") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(login))) .andExpect(status().isOk()) .andExpect(jsonPath("$.id_token").isString()) .andExpect(jsonPath("$.id_token").isNotEmpty()) .andExpect(header().string("Authorization", not(nullValue()))) .andExpect(header().string("Authorization", not(isEmptyString()))); } @Test @Transactional public void testAuthorizeWithRememberMe() throws Exception { User user = new User(); user.setLogin("user-jwt-controller-remember-me"); user.setEmail("[email protected]"); user.setActivated(true); user.setPassword(passwordEncoder.encode("test")); userRepository.saveAndFlush(user); LoginVM login = new LoginVM(); login.setUsername("user-jwt-controller-remember-me"); login.setPassword("test"); login.setRememberMe(true); mockMvc.perform(post("/api/authenticate") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(login))) .andExpect(status().isOk()) .andExpect(jsonPath("$.id_token").isString()) .andExpect(jsonPath("$.id_token").isNotEmpty()) .andExpect(header().string("Authorization", not(nullValue()))) .andExpect(header().string("Authorization", not(isEmptyString()))); } @Test @Transactional public void testAuthorizeFails() throws Exception { LoginVM login = new LoginVM(); login.setUsername("wrong-user"); login.setPassword("wrong password"); mockMvc.perform(post("/api/authenticate") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(login))) .andExpect(status().isUnauthorized()) .andExpect(jsonPath("$.id_token").doesNotExist()) .andExpect(header().doesNotExist("Authorization")); } }
fac6e867aea2856c4f5634074917b986c99b9742
44e77f57274361ed8745bd4720111371e81876d5
/app/src/main/java/com/bahri/whatsappclone/common/Common.java
a9a8019d80c6ded730d9245df2587d548a679a82
[]
no_license
Ahed-bahri/WhatsApp-Clone
1a23e13d45a665e5939f5ff8d278f196b107e7fd
75f531488292da61a69fcf3b9c5b3d53627bcb96
refs/heads/main
2023-03-05T04:20:34.185473
2021-02-16T12:49:06
2021-02-16T12:49:06
339,369,072
0
0
null
null
null
null
UTF-8
Java
false
false
137
java
package com.bahri.whatsappclone.common; import android.graphics.Bitmap; public class Common { public static Bitmap IMAGE_BITMAP; }
8f197f9622b2b3e8cd4726365fff2187a0254356
25d458b24f54dce1bf65a5097a6ee8fa5d7ac522
/src/main/java/xyz/corman/velt/ContextCreation.java
76c7a45fdb0459586efb85bb43c08f68cb9d23ad
[ "Apache-2.0" ]
permissive
KikoPT1234/Velt
317abca9ac325e29fafa19984774554343986c87
6ac52cc3c02d7057868a2089c241ad4cd2dfa161
refs/heads/main
2023-03-31T02:44:20.137409
2021-04-04T11:33:06
2021-04-04T11:35:39
350,025,635
0
0
Apache-2.0
2021-03-21T14:39:58
2021-03-21T14:39:57
null
UTF-8
Java
false
false
3,406
java
package xyz.corman.velt; import java.util.HashMap; import java.util.List; import java.util.Map; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.EnvironmentAccess; import org.graalvm.polyglot.HostAccess; public class ContextCreation { public static void graalJSRequire(String moduleFolder, Map<String, String> options) { // Enable CommonJS experimental support. //options.put("js.commonjs-require", "true"); // (optional) folder where the Npm modules to be loaded are located. //options.put("js.commonjs-require-cwd", moduleFolder); // (optional) initialization script to pre-define globals. //options.put("js.commonjs-global-properties", "globals"); // (optional) Java jars as a comma separated list. //options.put("jvm.classpath", classpath.stream().collect(Collectors.joining(","))); // (optional) Node.js built-in replacements as a comma separated list. /*options.put( "js.commonjs-core-modules-replacements", "timers:core/intervals,fs:core/filesystem,events:core/emitter,path:core/paths,domain:core/domains,os:core/osmod,punycode:core/punycodes," + "tty:core/ttymod,assert:core/assertions,buffer:core/buffers,util:core/utils,querystring:core/querystrings," + "string_decoder:core/string_decode,url:core/urls,console:core/consolemod,http:core/httpmod,https:core/httpsmod," + "stream:core/streams,zlib:browserify-zlib,process:core/process" );*/ /*options.put( "js.commonjs-core-modules-replacements", "timers:lib/timers,fs:lib/fs,events:lib/events,path:lib/path,domain:lib/domain,os:lib/os,punycode:lib/punycode,tty:lib/tty,assert:lib/assert," + "buffer:lib/buffer,util:lib/util,querystring:lib/querystring,string_decoder:lib/string_decoder,url:lib/url,console:lib/console,http:lib/http," + "https:lib/https,stream:lib/stream,zlib:lib/zlib,process:lib/process" );*/ } public static Context createSecureContext(Map<String, String> options) { HostAccess hostAccess = HostAccess.newBuilder(HostAccess.NONE) .targetTypeMapping(Double.class, Float.class, null, x -> x.floatValue()) .build(); Context context = Context.newBuilder("js") .allowExperimentalOptions(false) .allowIO(false) .allowCreateProcess(false) .allowCreateThread(false) .allowHostClassLookup(c -> { return false; }) .allowNativeAccess(false) .allowEnvironmentAccess(EnvironmentAccess.NONE) .options(options) .build(); return context; } public static Context createContext(Map<String, String> options) { HostAccess hostAccess = HostAccess.newBuilder(HostAccess.ALL) .targetTypeMapping(Double.class, Float.class, null, x -> x.floatValue()) .build(); Context context = Context.newBuilder("js") .allowExperimentalOptions(true) .allowIO(true) .allowHostAccess(hostAccess) .allowHostClassLookup(c -> true) .allowNativeAccess(true) .allowCreateThread(true) .allowCreateProcess(true) .options(options) .build(); return context; } public static Context createContext() { return createContext(new HashMap<String, String>()); } public static Context createContext(String moduleFolder, List<String> classpath) { Map<String, String> options = new HashMap<String, String>(); graalJSRequire(moduleFolder, options); return createContext(options); } }
8be408ae9283e4dbd7ff6b923d6918638abb2070
c9497fc0fd48ef307d14ed47c63447ddd520645f
/LuxorMC Core/src/main/java/com/faithfulmc/hardcorefactions/events/tracker/CitadelTracker.java
5f082d4669ca61054c8869d7ec9394b33cda56b1
[ "Apache-2.0" ]
permissive
Tominous/Faithfulmc
7fe0325f3a8437855cb231bf3f88e2bb98656abe
c057628cdbf770e2892b5bf0cdfccdcb54bc8bfa
refs/heads/master
2020-12-10T14:25:07.320691
2020-01-13T14:47:15
2020-01-13T14:47:15
233,617,706
2
0
Apache-2.0
2020-01-13T14:42:51
2020-01-13T14:42:51
null
UTF-8
Java
false
false
4,648
java
package com.faithfulmc.hardcorefactions.events.tracker; import com.faithfulmc.hardcorefactions.ConfigurationService; import com.faithfulmc.hardcorefactions.HCF; import com.faithfulmc.hardcorefactions.events.CaptureZone; import com.faithfulmc.hardcorefactions.events.EventTimer; import com.faithfulmc.hardcorefactions.events.EventType; import com.faithfulmc.hardcorefactions.events.faction.EventFaction; import com.faithfulmc.hardcorefactions.events.faction.KothFaction; import com.faithfulmc.hardcorefactions.util.DateTimeFormats; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.entity.Player; import java.util.concurrent.TimeUnit; public class CitadelTracker implements EventTracker { private static final long MINIMUM_CONTROL_TIME_ANNOUNCE = TimeUnit.MINUTES.toMillis(1); public static long DEFAULT_CAP_MILLIS = TimeUnit.MINUTES.toMillis(30L); private final HCF plugin; public CitadelTracker(HCF plugin) { this.plugin = plugin; } public static String PREFIX = EventType.CITADEL.getPrefix(); public EventType getEventType() { return EventType.KOTH; } public void tick(EventTimer eventTimer, EventFaction eventFaction) { CaptureZone captureZone = ((KothFaction) eventFaction).getCaptureZone(); if (captureZone == null) { return; } if (captureZone.getCappingPlayer() != null && (captureZone.getCuboid() == null || !captureZone.getCuboid().contains(captureZone.getCappingPlayer()) || captureZone.getCappingPlayer().isDead() || !captureZone.getCappingPlayer().isValid())) { captureZone.setCappingPlayer(null); } long remainingMillis = captureZone.getRemainingCaptureMillis(); if (remainingMillis <= 0L) { this.plugin.getTimerManager().eventTimer.finishEvent(captureZone.getCappingPlayer()); eventTimer.clearCooldown(); return; } if (remainingMillis == captureZone.getDefaultCaptureMillis()) { return; } int remainingSeconds = (int) (remainingMillis / 1000L); if ((remainingSeconds > 0) && (remainingSeconds % 60 == 0)) { Bukkit.broadcastMessage(PREFIX + "Someone is controlling " + ChatColor.LIGHT_PURPLE + captureZone.getDisplayName() + ConfigurationService.YELLOW + ". " + (ConfigurationService.LUXOR ? ChatColor.WHITE : ConfigurationService.RED) + '(' + DateTimeFormats.KOTH_FORMAT.format(remainingMillis) + ')'); } } public void onContest(EventFaction eventFaction, EventTimer eventTimer) { Bukkit.broadcastMessage(PREFIX + ChatColor.LIGHT_PURPLE + eventFaction.getName() + ConfigurationService.YELLOW + " can now be contested. " + (ConfigurationService.LUXOR ? ChatColor.WHITE : ConfigurationService.RED) + '(' + DateTimeFormats.KOTH_FORMAT.format(eventTimer.getRemaining()) + ')'); } public boolean onControlTake(Player player, CaptureZone captureZone) { if (player.getGameMode() == GameMode.CREATIVE || player.getAllowFlight() || player.isFlying() || player.isDead() || (!ConfigurationService.KIT_MAP && plugin.getTimerManager().pvpProtectionTimer.getRemaining(player) > 0)) { return false; } if (this.plugin.getFactionManager().getPlayerFaction(player.getUniqueId()) == null) { player.sendMessage(PREFIX + "You must be in a faction to capture for Citadel."); return false; } player.sendMessage(PREFIX + "You are now in control of " + ChatColor.LIGHT_PURPLE + captureZone.getDisplayName() + ConfigurationService.YELLOW + '.'); return true; } public boolean onControlLoss(Player player, CaptureZone captureZone, EventFaction eventFaction) { player.sendMessage(PREFIX + "You are no longer in control of " + ChatColor.LIGHT_PURPLE + captureZone.getDisplayName() + ConfigurationService.YELLOW + '.'); long remainingMillis = captureZone.getRemainingCaptureMillis(); if ((remainingMillis > 0L) && (captureZone.getDefaultCaptureMillis() - remainingMillis > MINIMUM_CONTROL_TIME_ANNOUNCE)) { Bukkit.broadcastMessage(PREFIX + ChatColor.LIGHT_PURPLE + player.getName() + ConfigurationService.YELLOW + " has lost control of " + ChatColor.LIGHT_PURPLE + captureZone.getDisplayName() + ConfigurationService.YELLOW + '.' + (ConfigurationService.LUXOR ? ChatColor.WHITE : ConfigurationService.RED) + " (" + DateTimeFormats.KOTH_FORMAT.format(captureZone.getRemainingCaptureMillis()) + ')'); } return true; } public void stopTiming() { } }
f718cdce2e0a8663794aa722c53e369d4c3ced43
b7187442178ae1bcacabf2fea4e7a7a167e1ebb7
/testApp/obj/Debug/android/src/mono/com/google/android/material/bottomnavigation/BottomNavigationView_OnNavigationItemReselectedListenerImplementor.java
127ddda961edf4ddaa43503c8a820e44698de5b6
[]
no_license
abhash003/abhash
84265f5e6fd4052d7ccd85862196a5574d02dd27
f752edd3801d18444a14ab3a7972dcd81cfb0f60
refs/heads/main
2023-08-25T19:04:15.497537
2023-08-24T14:31:22
2023-08-24T14:31:22
109,165,231
0
0
null
null
null
null
UTF-8
Java
false
false
1,831
java
package mono.com.google.android.material.bottomnavigation; public class BottomNavigationView_OnNavigationItemReselectedListenerImplementor extends java.lang.Object implements mono.android.IGCUserPeer, com.google.android.material.bottomnavigation.BottomNavigationView.OnNavigationItemReselectedListener { /** @hide */ public static final String __md_methods; static { __md_methods = "n_onNavigationItemReselected:(Landroid/view/MenuItem;)V:GetOnNavigationItemReselected_Landroid_view_MenuItem_Handler:Google.Android.Material.BottomNavigation.BottomNavigationView/IOnNavigationItemReselectedListenerInvoker, Xamarin.Google.Android.Material\n" + ""; mono.android.Runtime.register ("Google.Android.Material.BottomNavigation.BottomNavigationView+IOnNavigationItemReselectedListenerImplementor, Xamarin.Google.Android.Material", BottomNavigationView_OnNavigationItemReselectedListenerImplementor.class, __md_methods); } public BottomNavigationView_OnNavigationItemReselectedListenerImplementor () { super (); if (getClass () == BottomNavigationView_OnNavigationItemReselectedListenerImplementor.class) { mono.android.TypeManager.Activate ("Google.Android.Material.BottomNavigation.BottomNavigationView+IOnNavigationItemReselectedListenerImplementor, Xamarin.Google.Android.Material", "", this, new java.lang.Object[] { }); } } public void onNavigationItemReselected (android.view.MenuItem p0) { n_onNavigationItemReselected (p0); } private native void n_onNavigationItemReselected (android.view.MenuItem p0); private java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
dae9baef8e06fd225ad86575a9c72fe1834babf2
3f0672b82ba5b2ea756240038a792feac061588a
/src/main/java/gradingTools/comp110f14/assignment6testcases/PromptAgain.java
b9ad5bfbc5a1823bd8c1322c7b73515d24ce66c7
[]
no_license
Kirny/Grader
28bc357415779dd8de6be45d523b091fa216eaff
207458b0bdf06156d02a66eaa864663c3cbac822
refs/heads/master
2021-01-17T16:25:40.981476
2015-11-08T17:10:33
2015-11-08T17:10:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,314
java
package gradingTools.comp110f14.assignment6testcases; import java.util.regex.Pattern; import framework.execution.RunningProject; import framework.grading.testing.BasicTestCase; import framework.grading.testing.NotAutomatableException; import framework.grading.testing.NotGradableException; import framework.grading.testing.TestCaseResult; import framework.project.Project; import gradingTools.utils.RunningProjectUtils; public class PromptAgain extends BasicTestCase{ public PromptAgain() { //mandatory super call to create instance of BasicTestCase w/ message super("Prompt Again Test Case"); } @Override public TestCaseResult test(Project project, boolean autoGrade) throws NotAutomatableException, NotGradableException { //pattern searching for Pattern again = Pattern.compile(".*order|print|finish.*"); //invoke instance of assignment five input string w/ timeout RunningProject againInfo = RunningProjectUtils.runProject(project, 10, "order\n5"); //grab everything after input up to point waiting for input String outagainInfo= againInfo.await(); //If dont ask for another message - fail w/ message if(!again.matcher(outagainInfo).find()){ return fail("Failed to ask again"); } //asks for another message return pass(); } }
e81be598f72131a75820cf6969ce3ebcd82fb792
9ceee4399e9463402e3d2d9fa7eec761561bfb10
/src/main/java/com/jlq/service/CommentService.java
7eb96e83bce7fe746ab8de564ae127e5c7acd80d
[]
no_license
krionjiang/blog_study
2d94592b042c1eccd9e3f4f7330e0bf9a7d1f36c
f86bbf1b02aff09f3b3a1c5fd23af77cac338f38
refs/heads/main
2023-02-01T00:59:05.124571
2020-11-29T06:12:23
2020-11-29T06:12:23
315,493,407
0
0
null
null
null
null
UTF-8
Java
false
false
2,564
java
package com.jlq.service; import com.jlq.mapper.TbCommentMapper; import com.jlq.pojo.TbComment; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * @author :jlq * @date :Created in 2020/11/28 15:01 */ @Service public class CommentService { @Autowired private TbCommentMapper tbCommentMapper; //存放迭代找出的所有子代的集合 private List<TbComment> tempReplys = new ArrayList<>(); public List<TbComment> findByBlogID (Long id){ List<TbComment> list = tbCommentMapper.findByBlogIdAndParentCommentNull(id); return eachTbComment(list); } /** * 循环每个顶级的评论节点 * * @param comments * @return */ private List<TbComment> eachTbComment(List<TbComment> comments) { List<TbComment> commentsView = new ArrayList<>(); for (TbComment comment : comments) { TbComment c = new TbComment(); BeanUtils.copyProperties(comment, c); commentsView.add(c); } //合并评论的各层子代到第一级子代集合中 combineChildren(commentsView); return commentsView; } /** * @param comments root根节点,blog不为空的对象集合 * @return */ private void combineChildren(List<TbComment> comments) { for (TbComment comment : comments) { List<TbComment> replys1 = comment.getReplyComments(); for (TbComment reply1 : replys1) { //循环迭代,找出子代,存放在tempReplys中 recursively(reply1); } //修改顶级节点的reply集合为迭代处理后的集合 comment.setReplyComments(tempReplys); //清除临时存放区 tempReplys = new ArrayList<>(); } } /** * 递归迭代,剥洋葱 * * @param comment 被迭代的对象 * @return */ private void recursively(TbComment comment) { tempReplys.add(comment);//顶节点添加到临时存放集合 if (comment.getReplyComments().size() > 0) { List<TbComment> replys = comment.getReplyComments(); for (TbComment reply : replys) { tempReplys.add(reply); if (reply.getReplyComments().size() > 0) { recursively(reply); } } } } }
3c15a166b1238c75291b8d072a3a8534375ca528
bac1c61389112f186b924be2e986bb7cf71488af
/taotao-manager/taotao-manager-web/src/main/java/com/taotao/manager/controller/TbItemController.java
ba2c0792f8cd68bf2b5c7c2c1e9c69453fb69114
[]
no_license
yemingshang/Taotao-Shopping
98ab954758d350cd2aba31d6aad87d724be43803
c4533ce615b3acc5d5b9dd99a8f04e6fcddc5db3
refs/heads/master
2020-04-08T15:24:09.985214
2018-11-28T09:38:52
2018-11-28T09:38:52
159,474,610
0
0
null
null
null
null
UTF-8
Java
false
false
1,333
java
package com.taotao.manager.controller; import com.alibaba.dubbo.config.annotation.Reference; import com.taotao.common.pojo.E3Result; import com.taotao.common.pojo.EasyUIDataGridResult; import com.taotao.manager.model.TbItem; import com.taotao.manager.service.TbItemService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * @author zjs * @date 18-11-28 上午8:52 */ @Controller @RequestMapping("/item") public class TbItemController { @Reference private TbItemService tbItemService; @GetMapping("/{itemId}") @ResponseBody public TbItem getItemById(@PathVariable Long itemId) { return tbItemService.getItemById(itemId); } @GetMapping("/list") @ResponseBody public EasyUIDataGridResult getItemList(Integer page, Integer rows) { EasyUIDataGridResult result = tbItemService.getItemList(page, rows); return result; } @RequestMapping("/save") @ResponseBody public E3Result saveItem(TbItem item, String desc) { E3Result result = tbItemService.addItem(item, desc); return result; } }
2161a8160391ccfe5eee28391a199073cb21ba61
6a3d333edcf4973bcee046d6138aae9fdd074909
/src/main/java/com/frame/xwz/source/auto/MyService.java
b4d6b63815d8e85280e1a98c89de02a274616dff
[]
no_license
xwzl/Frame
d0826088b9662d3a1a6da66696ba91e608cd6a6c
4ddb202271be0a4ef5b3f7f42d4739d2973f7cc2
refs/heads/master
2020-05-09T23:59:56.213371
2019-04-17T15:51:50
2019-04-17T15:51:50
181,518,122
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package com.frame.xwz.source.auto; import java.lang.annotation.*; /** * @author xuweizhi * @date 2019/04/14 0:30 */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @MyComponent public @interface MyService { String alias() default ""; }
8a436d68a9f2613eaf1ae5e2a1a6567482d1f88d
2858aa56b68b558348591d6ba65ae3b1fb4d70ad
/app/src/main/java/yogoup/coverflow/DemoData.java
ba9a9cdd12e6ba47bc66d27225c30a81a299ed75
[]
no_license
androidneha/CoverFlow
d4962e33fa4f83ce58cb7799717838f40904018a
bb589764f51c2c3f67f744f4bb210b49076a1baa
refs/heads/master
2021-01-19T11:45:54.631279
2017-02-17T06:40:01
2017-02-17T06:40:01
82,263,434
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
package yogoup.coverflow; /** * Created by yuweichen on 16/5/3. */ public class DemoData { public static int[] covers = {R.mipmap.ic_cover_1,R.mipmap.ic_cover_2,R.mipmap.ic_cover_3,R.mipmap.ic_cover_4, R.mipmap.ic_cover_5,R.mipmap.ic_cover_6,R.mipmap.ic_cover_7,R.mipmap.ic_cover_8}; }
3cac82e94cb044c7231a36e9d69a9b6aa937e432
ef14efa9ffb8ba7192f1e6850c22ea41ea46fa81
/src/main/java/com/dragovorn/dotaapi/match/DotaMatchReduced.java
64fd5d5ce47372586294fb4e20dec172a623ad8f
[ "MIT" ]
permissive
Dragovorn/dota-api
4eb424f45fb70f1c6edaf9d899dcd36791d43643
9754a2fbdd71ebf94275a2a57e26ea2c0d8966a7
refs/heads/master
2023-05-04T17:27:07.215061
2017-11-24T01:05:38
2017-11-24T01:05:38
63,204,190
1
0
null
2021-04-29T22:00:36
2016-07-13T01:29:15
Java
UTF-8
Java
false
false
3,885
java
package com.dragovorn.dotaapi.match; import com.dragovorn.dotaapi.match.lobby.GameMode; import com.dragovorn.dotaapi.match.lobby.LobbyType; import com.dragovorn.dotaapi.match.player.DotaPlayerReduced; import com.dragovorn.dotaapi.match.player.IPlayer; import com.dragovorn.dotaapi.match.team.DotaTeamReduced; import com.dragovorn.dotaapi.match.team.ITeam; import com.dragovorn.dotaapi.match.team.Side; import com.google.common.collect.ImmutableList; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.Date; public class DotaMatchReduced implements IMatch { private JSONObject object; private ImmutableList<IPlayer> players; private LobbyType type; private ITeam radiant; private ITeam dire; private Date startTime; private long sequenceId; private long matchId; public DotaMatchReduced(JSONObject object) { this.object = object; this.startTime = new Date(object.getLong("start_time")); this.sequenceId = object.getLong("match_seq_num"); this.matchId = object.getLong("match_id"); this.type = LobbyType.fromId(object.getInt("lobby_type")); ImmutableList.Builder<IPlayer> builder = new ImmutableList.Builder<>(); ArrayList<IPlayer> players = new ArrayList<>(); JSONArray array = object.getJSONArray("players"); for (int x = 0; x < 5; x++) { JSONObject obj = array.getJSONObject(x); DotaPlayerReduced player = new DotaPlayerReduced(obj); builder.add(player); players.add(player); } this.radiant = new DotaTeamReduced(Side.RADIANT, players); players.clear(); for (int x = 5; x < 10; x++) { JSONObject obj = array.getJSONObject(x); DotaPlayerReduced player = new DotaPlayerReduced(obj); builder.add(player); players.add(player); } this.dire = new DotaTeamReduced(Side.DIRE, players); this.players = builder.build(); } @Override public boolean didRadiantWin() { throw new UnsupportedOperationException(); } @Override public int getDuration() { throw new UnsupportedOperationException(); } @Override public int getCluster() { throw new UnsupportedOperationException(); } @Override public int getNegativeVotes() { throw new UnsupportedOperationException(); } @Override public int getPositiveVotes() { throw new UnsupportedOperationException(); } @Override public int getEngine() { throw new UnsupportedOperationException(); } @Override public int getLeagueId() { throw new UnsupportedOperationException(); } @Override public int getFirstBlood() { throw new UnsupportedOperationException(); } @Override public long getMatchId() { return this.matchId; } @Override public long getSequenceId() { return this.sequenceId; } @Override public Date getStartTime() { return this.startTime; } @Override public ITeam getRadiant() { return this.radiant; } @Override public ITeam getDire() { return this.dire; } @Override public ITeam getWinner() { throw new UnsupportedOperationException(); } @Override public ITeam getLoser() { throw new UnsupportedOperationException(); } @Override public GameMode getGameMode() { throw new UnsupportedOperationException(); } @Override public LobbyType getLobbyType() { return this.type; } @Override public ImmutableList<IPlayer> getPlayers() { return this.players; } @Override public JSONObject getJSONObject() { return this.object; } }
823a2aed974fe48ef9de6c7f06becadd12a19d89
92f9c9a8e27274916634850693a7c7e41787dfa9
/src/main/java/eu/dreamix/four_for_belot/domain/enumeration/RatingScore.java
311ef291fda2c03b07ca9c8e444b03522a94d595
[ "MIT" ]
permissive
martinely95/44belot
589a66928fb40ae81e2a85f0bd7f561ceaeab916
67f83f730036e11f2299955a993e399f3e3505ba
refs/heads/master
2021-08-30T10:17:54.941108
2017-12-17T12:21:58
2017-12-17T13:05:15
114,474,043
0
0
null
null
null
null
UTF-8
Java
false
false
160
java
package eu.dreamix.four_for_belot.domain.enumeration; /** * The RatingScore enumeration. */ public enum RatingScore { BAD, MODERATE, GOOD, EXPERT, GOD }
e69d5a7fbd8c4d7a98fa48aa7cd34931f5ebce56
1ea89d32efa4c871432630af45d285945c85e5f5
/trunk/src/main/java/com/xyz/reccommendation/jaccard/JaccardMRStage4.java
06784f284db043d2a2c4d75316dc1f7c1a84ad35
[]
no_license
ashwal2001/hadoop
cf9056a537ee3206134c7c61ae66133bfcaf117b
976bbf9ba65f375c8568750a785dfb578beb537f
refs/heads/master
2016-09-10T12:24:45.384562
2013-05-14T05:47:15
2013-05-14T05:47:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,594
java
package com.xyz.reccommendation.jaccard; import java.io.IOException; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.KeyValueTextInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.util.GenericOptionsParser; import org.bson.BasicBSONObject; import com.mongodb.hadoop.MongoOutputFormat; import com.mongodb.hadoop.io.BSONWritable; import com.mongodb.hadoop.util.MongoConfigUtil; import com.xyz.reccommendation.jaccard.key.CompositeKeyComparator; import com.xyz.reccommendation.jaccard.key.CompositeKeyGroupingComparator; import com.xyz.reccommendation.jaccard.key.CompositeKeyPartitioner; import com.xyz.reccommendation.jaccard.key.TextDoublePair; public class JaccardMRStage4 { /** * Map to collect pairs */ public static class JaccardMap extends Mapper<Text, Text, TextDoublePair, Text> { /** * @param ikey * Dummy parameter required by Hadoop for the map operation, * but it does nothing. * @param ival * Text used to read in necessary data, in this case each * line of the text will be a list of CPairs * @param output * OutputCollector that collects the output of the map * operation, in this case a (Text, IntWritable) pair * representing ( * @param reporter * Used by Hadoop, but we do not use it */ public void map(Text ikey, Text ival, Context context) throws IOException, InterruptedException { String[] tokenVal = ival.toString().split("\\,+"); String[] tokenKey = ikey.toString().split("\\|+"); TextDoublePair okey = new TextDoublePair(); okey.set(tokenKey[0], Double.parseDouble(tokenVal[0])); Text value = new Text(ikey); log.debug(okey+" "+value); context.write(okey, value); } } /** * Reduce class that does the final normalization. Takes in data of the form * (xi xj (sum of counts)) Outputs the similarity between xi and xj as (the * number of y values xi and xj are associated with)/(the sum of the counts) */ public static class JaccardReduce extends Reducer<TextDoublePair, Text, Text, BSONWritable> { /** * @param ikey * The xi xj pair for which we are calculating the similarity * @param vlist * The list of ((xi,xj),sum of counts) pairs * @param output * OutputCollector that collects a (Text, FloatWritable) * pair. where the Text is the (xi,xj) pair and the * FloatWritable is their similarity * @param reporter * Used by Hadoop, but we do not use it */ public void reduce(TextDoublePair ikey, Iterable<Text> vlist, Context context) throws IOException, InterruptedException { int count = 0; while (vlist.iterator().hasNext() && count < 20) { Text val = vlist.iterator().next(); String[] token = val.toString().split("\\|+"); BasicBSONObject outputObj = new BasicBSONObject(); outputObj.put("countJaccard", ikey.getSecond().get()); outputObj.put("p1", ikey.getFirst().toString()); outputObj.put("p2", token[1]); Text id = new Text(val.toString().trim()); log.debug(id+" "+ikey.getSecond().get()+" "+ikey.getFirst().toString()+" "+token[1]); context.write(id, new BSONWritable(outputObj));// 7294, 50000, // jul 2013 count++; } } } private static final Log log = LogFactory.getLog(JaccardMRStage4.class); public static void main(String[] args) throws Exception { // Job configuration final Configuration conf = new Configuration(); String envt = null; if (args.length > 0) { envt = args[0]; } else { envt = "dev"; } log.debug("Envt: " + envt); Properties prop = new Properties(); try { // load a properties file from class path, inside static method prop.load(JaccardMRStage4.class.getClassLoader() .getResourceAsStream("config-" + envt + ".properties")); } catch (IOException ex) { ex.printStackTrace(); System.exit(1); } log.debug("Conf: " + conf); MongoConfigUtil.setOutputURI( conf, "mongodb://" + prop.getProperty("mongodb.ip") + "/" + prop.getProperty("mongodb.dbname") + ".out_stat_jaccard"); args = new GenericOptionsParser(conf, args).getRemainingArgs(); final Job job = new Job(conf, "Map-Reduce for Jaccard 4"); job.setJarByClass(JaccardMRStage4.class); job.setMapOutputKeyClass(TextDoublePair.class); job.setMapOutputValueClass(Text.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(BSONWritable.class); job.setMapperClass(JaccardMap.class); job.setReducerClass(JaccardReduce.class); job.setPartitionerClass(CompositeKeyPartitioner.class); job.setGroupingComparatorClass(CompositeKeyGroupingComparator.class); job.setSortComparatorClass(CompositeKeyComparator.class); job.setInputFormatClass(KeyValueTextInputFormat.class); job.setOutputFormatClass(MongoOutputFormat.class); // HDFS input and output directory FileInputFormat.setInputPaths(job, new Path("intermediate2")); // Run map-reduce job System.exit(job.waitForCompletion(true) ? 0 : 1); } }
14cd6082a07cdda8f8770077ffa9f7d3a7a79ab1
f1e4ef8a17b421cfe02a56793a224ffd5c96d73a
/src/thread/community/TestThreadPool.java
501f4796190694bb15e17e4df426a25fa66a5547
[]
no_license
a13483685/javaStudy
4a929bcdf5b58875fd0d1e3315b43795e03baf53
0f436912b74154310d45998431a320059f0ca4fd
refs/heads/master
2021-08-16T01:06:41.030383
2018-11-06T14:22:32
2018-11-06T14:22:32
140,133,378
0
0
null
null
null
null
UTF-8
Java
false
false
2,488
java
package thread.community; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; /* * 一、线程池:提供了一个线程队列,队列中保存着所有等待状态的线程。避免了创建与销毁额外开销,提高了响应的速度。 * * 二、线程池的体系结构: * java.util.concurrent.Executor : 负责线程的使用与调度的根接口 * |--**ExecutorService 子接口: 线程池的主要接口 * |--ThreadPoolExecutor 线程池的实现类 * |--ScheduledExecutorService 子接口:负责线程的调度 * |--ScheduledThreadPoolExecutor :继承 ThreadPoolExecutor, 实现 ScheduledExecutorService * * 三、工具类 : Executors * ExecutorService newFixedThreadPool() : 创建固定大小的线程池 * ExecutorService newCachedThreadPool() : 缓存线程池,线程池的数量不固定,可以根据需求自动的更改数量。 * ExecutorService newSingleThreadExecutor() : 创建单个线程池。线程池中只有一个线程 * * ScheduledExecutorService newScheduledThreadPool() : 创建固定大小的线程,可以延迟或定时的执行任务。 */ public class TestThreadPool { public static void main(String[] args) throws Exception { //1. 创建线程池 ExecutorService pool = Executors.newFixedThreadPool(5); List<Future<Integer>> list = new ArrayList<>(); for (int i = 0; i < 10; i++) { Future<Integer> future = pool.submit(new Callable<Integer>(){ @Override public Integer call() throws Exception { int sum = 0; for (int i = 0; i <= 100; i++) { sum += i; } return sum; } }); list.add(future); } pool.shutdown(); for (Future<Integer> future : list) { System.out.println(future.get()); } /*ThreadPoolDemo tpd = new ThreadPoolDemo(); //2. 为线程池中的线程分配任务 for (int i = 0; i < 10; i++) { pool.submit(tpd); } //3. 关闭线程池 pool.shutdown();*/ } // new Thread(tpd).start(); // new Thread(tpd).start(); } class ThreadPoolDemo implements Runnable{ private int i = 0; @Override public void run() { while(i <= 100){ System.out.println(Thread.currentThread().getName() + " : " + i++); } } }
f090337fa9c7622c2ea72c76c8169b6a3cd00a1c
2d1b3ebd29348f6b192855dce85f49e4f10a466c
/src/Pojazd.java
e69ee2bdae926b8071bf85e8599408dae9be5d97
[]
no_license
nauczkiJava/lekcja6
c871aad10511334c9e41fc49011704296643582d
e3406422db2f2e918faf6b320256f99dd3461ffa
refs/heads/master
2020-05-31T08:51:09.840810
2019-06-05T13:50:58
2019-06-05T13:50:58
190,198,342
0
0
null
null
null
null
UTF-8
Java
false
false
2,409
java
abstract class Pojazd { protected String marka; protected String model; protected String numerRejestracyjny; protected String kolor; protected double cena; protected double spalanieNa100Km; protected String silnik; protected double stanZbiornika; protected double stanLicznika; protected final double pojemnoscBaku = 60; public Pojazd(String marka, String model, String numerRejestracyjny, String kolor, double cena, double spalanieNa100Km, String silnik, double stanZbiornika, double stanLicznika) { this.marka = marka; this.model = model; this.numerRejestracyjny = numerRejestracyjny; this.kolor = kolor; this.cena = cena; this.spalanieNa100Km = spalanieNa100Km; this.silnik = silnik; this.stanZbiornika = pojemnoscBaku > stanZbiornika ? stanZbiornika : pojemnoscBaku; this.stanLicznika = stanLicznika; } String info() { return "Marka: " + marka + "\nModel: " + model + "\nNumer rejestracyjny: " + numerRejestracyjny + "\nKolor: " + kolor + "\nCena: " + cena + "\nSpalanie: " + spalanieNa100Km + "\nSilnik: " + silnik + "\nStan zbiornika: " + stanZbiornika + "\nStan licznika: " + stanLicznika; } abstract String typPojazdu(); void jedz(int km) { if (stanZbiornika < (km * (spalanieNa100Km / 100))) { double przejechane = km * (spalanieNa100Km / 100); stanZbiornika = 0; System.out.println("Przejechałeś " + przejechane + "km i skończyło ci się paliwo."); stanLicznika += przejechane; } else { stanLicznika += km; stanZbiornika -= km * (spalanieNa100Km / 100); System.out.println("Przejechałeś " + km + "km."); } } void tankuj(int iloscZatankowanego){ double miejsce = pojemnoscBaku - stanZbiornika; if (iloscZatankowanego > miejsce) { stanZbiornika += miejsce; System.out.println("Za mała pojemność baku.\nZatankowano tylko " + miejsce + "l paliwa."); } else { stanZbiornika += iloscZatankowanego; System.out.println("Zatankowano "+ iloscZatankowanego +"l paliwa."); } } double ilePaliwa(){ return stanZbiornika; } }
821d52f65d58cd6326247f343b69e276808977e9
e63d0f45e8442577ba686f17ab615719930ea824
/src/main/java/org/craftercms/core/exception/PathNotFoundException.java
204306bfc78385e175b08ed81419d3029149a9e0
[]
no_license
roger-diaz/core
1c8fa76941a121b0904b634a1c60d2097f31a664
8a6e2921a52d90904efc8c86c1b740ea7af9a4ac
refs/heads/master
2021-01-18T10:11:00.211084
2013-08-22T19:05:23
2013-08-22T19:05:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,372
java
/* * Copyright (C) 2007-2013 Crafter Software Corporation. * * 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.craftercms.core.exception; /** * Thrown to indicate that a resource in a content store couldn't be reached (its path was not found). * * @author Sumer Jabri * @author Alfonso Vásquez */ public class PathNotFoundException extends CrafterException { private static final long serialVersionUID = 7672434363103060508L; public PathNotFoundException() { } public PathNotFoundException(String message, Throwable cause) { super(message, cause); } public PathNotFoundException(String message) { super(message); } public PathNotFoundException(Throwable cause) { super(cause); } }
1015121137d23bbc8d4ecf1847981a200daaacd4
3e976f0800682995a894bc3c2de68273e3688119
/core/src/io/github/teamfractal/animation/IAnimationFinish.java
06a384e03daa5aa45f7e74b8920520b2cef4fdba
[]
no_license
SEPR-TopRight/Roboticon-Quest
ac2d5a6a1b77065de39b0b5a1489d6a3262cbad4
5cea3ffe45fb7adf49161e831854d2c75d44d839
refs/heads/master
2020-05-23T10:22:44.829838
2017-02-21T05:19:11
2017-02-21T05:19:11
80,429,286
3
1
null
2017-02-20T17:32:33
2017-01-30T14:37:32
Java
UTF-8
Java
false
false
107
java
package io.github.teamfractal.animation; public interface IAnimationFinish { void OnAnimationFinish(); }
1292b13a494058f0accf3a79e1384321f343728b
ebbdc380c836715b604e6dc5e02283eccb4e9b02
/src/main/java/ir/shayandaneshvar/controller/Triple.java
22df48528cd367f3c5ee2a4538bdd7dff5b10cfd
[ "MIT" ]
permissive
shayandaneshvar/Quoridors
7d917ddda7b6e7a3691a111df4ff855c206ad048
a2dbab247a56ce824a94098f9ca8c7e67a818737
refs/heads/master
2020-06-20T15:59:44.906384
2019-07-24T11:34:11
2019-07-24T11:34:11
197,170,396
2
0
null
null
null
null
UTF-8
Java
false
false
1,015
java
package ir.shayandaneshvar.controller; import java.io.Serializable; import java.util.Objects; public class Triple<K, V, T> implements Serializable { private K first; private V second; private T third; public Triple(K first, V second, T third) { this.first = first; this.second = second; this.third = third; } public K getFirst() { return first; } public V getSecond() { return second; } public T getThird() { return third; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; Triple<?, ?, ?> triple = (Triple<?, ?, ?>) obj; return Objects.equals(first, triple.first) && Objects.equals(second, triple.second) && Objects.equals(third, triple.third); } @Override public int hashCode() { return Objects.hash(first, second, third); } }
533e68ab2317fba6a85bc9dd26b318dfc1e82e4c
563d456f315d9058ab4d9e756b8e7d4ef59ac71f
/SeminarManagement-Maven-ejb/src/main/java/otros/PlanesEstudioLocal.java
675c7accd2e4be414a5e627134e31e2c361e1487
[]
no_license
JanoSoto/seminarmanagementplus_QA
e8da79677fb78ccbf9405356339f8c35d54ebe60
2bbbdf48c56333c04793d5d99f9995147ed55abe
refs/heads/master
2021-01-19T22:09:01.682168
2017-04-19T15:44:37
2017-04-19T15:44:37
88,761,056
0
0
null
2017-04-19T15:44:38
2017-04-19T15:30:02
Java
UTF-8
Java
false
false
424
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 otros; import entities.PlanEstudio; import java.util.List; import javax.ejb.Local; /** * * @author ariel-linux */ @Local public interface PlanesEstudioLocal { public List<PlanEstudio> findPlanByIdCarrera(long idCarrera); }
[ "giovanni@air-de-giovanni" ]
giovanni@air-de-giovanni
79279c0c0dc58f4f665d018c58b09ee03017e726
b9498630f91351adbc6ee13a63a1c64ad1a02a4d
/src/main/java/com/chinatelecom/xjdh/utils/PinyinComparator.java
6674da3cc6a5bbdba46d793d2538ed6121c7b68d
[]
no_license
wuyue0829/xjdh-android-lasternew
9ed364280ef499668f1f0a35959c093f50635cab
d35295abed48955dbd18c38fd086dfcc32ecafb3
refs/heads/master
2020-06-05T18:44:06.949222
2019-11-05T08:29:37
2019-11-05T08:29:37
192,513,424
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
package com.chinatelecom.xjdh.utils; import java.util.Comparator; public class PinyinComparator implements Comparator<SortModel> { public int compare(SortModel o1, SortModel o2) { if (o1.getLetters().equals("@") || o2.getLetters().equals("#")) { return 1; } else if (o1.getLetters().equals("#") || o2.getLetters().equals("@")) { return -1; } else { return o1.getLetters().compareTo(o2.getLetters()); } } }
5474400b31d5736fa2d8721920d0d6a25501e4ab
b7b81d35f9abbf6b6a37cfc89a164939a3901bba
/REA.edit/src/rea/provider/ResourceItemProvider.java
4489c68c2b1a98569caf10f6b3cbc6b9d31c6f41
[]
no_license
AnisBoubaker/REA
a37d252892fef31cc6b260f1b1c5fbe0f8f311dc
2dacd86b152d769d3ed4dfacdc84578ebaeb548b
refs/heads/master
2020-05-20T10:09:29.717351
2019-05-08T03:22:59
2019-05-08T03:22:59
185,519,535
0
0
null
null
null
null
UTF-8
Java
false
false
4,765
java
/** */ package rea.provider; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; import rea.Resource; import rea.reaFactory; import rea.reaPackage; /** * This is the item provider adapter for a {@link rea.Resource} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class ResourceItemProvider extends ValuableItemProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ResourceItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addClaimsPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Claims feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addClaimsPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Resource_claims_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Resource_claims_feature", "_UI_Resource_type"), reaPackage.Literals.RESOURCE__CLAIMS, true, false, true, null, null, null)); } /** * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(reaPackage.Literals.RESOURCE__PROPERTIES); } return childrenFeatures; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EStructuralFeature getChildFeature(Object object, Object child) { // Check the type of the specified child object and return the proper feature to use for // adding (see {@link AddCommand}) it as a child. return super.getChildFeature(object, child); } /** * This returns Resource.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/Resource")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((Resource)object).getName(); return label == null || label.length() == 0 ? getString("_UI_Resource_type") : getString("_UI_Resource_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Resource.class)) { case reaPackage.RESOURCE__PROPERTIES: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (reaPackage.Literals.RESOURCE__PROPERTIES, reaFactory.eINSTANCE.createProperty())); } }
4fee12562e30d4ce531b903a3496b8ff55e1a0e2
a76e53784fbc8bfea753c9a0c5abb9baa3befb8a
/app/src/main/java/com/randomACUstudents/adventuregame/Table.java
8377d855c4dab5c6ce0615fa703a6df46b9e48cf
[]
no_license
pbb16a/AdventureGame
09e73110b1f4bfb46d961446c29b1b04ca8308ac
178e81ea3939c545f6fce3b14550ff46a6a72681
refs/heads/master
2020-09-26T05:57:22.893466
2019-12-13T16:14:40
2019-12-13T16:14:40
226,182,297
0
0
null
2019-12-13T00:38:35
2019-12-05T20:20:38
Java
UTF-8
Java
false
false
5,416
java
package com.randomACUstudents.adventuregame; import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.view.View; import android.widget.Button; import android.widget.TextView; public class Table extends AppCompatActivity { private TextView textView; private TextView buttonText1; private TextView buttonText2; private TextView buttonText3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_table); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); if(Dining.book && Dining.glasses){ startActivity(new Intent(Table.this, Dining.class)); } //get textviews textView = findViewById(R.id.textView3); buttonText1 = findViewById(R.id.button_1); buttonText2 = findViewById(R.id.button_2); buttonText3 = findViewById(R.id.button_3); //get buttons final Button button1 = findViewById(R.id.button_1); final Button button2 = findViewById(R.id.button_2); final Button button3 = findViewById(R.id.button_3); textView.setText(R.string.check_table); button3.setVisibility(View.VISIBLE); buttonText1.setText(R.string.goblet); buttonText2.setText(R.string.glasses); buttonText3.setText(R.string.book); //goblet button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //after you hit continue.. textView.setText(R.string.af_goblet); buttonText1.setText(R.string.drink); buttonText2.setText(R.string.put_back); button3.setVisibility(View.GONE); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //after you hit continue.. textView.setText(R.string.af_drink); buttonText1.setText(R.string.table); button2.setVisibility(View.GONE); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Dining.goblet = true; startActivity(new Intent(Table.this, Table.class)); } }); } }); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent(Table.this, Table.class)); } }); } }); //glasses button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { textView.setText(R.string.af_glasses); buttonText1.setText(R.string.put_on); buttonText2.setText(R.string.put_back); button3.setVisibility(View.GONE); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { textView.setText(R.string.w_glasses); buttonText1.setText(R.string.go_door); button2.setVisibility(View.GONE); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Dining.glasses = true; startActivity(new Intent(Table.this, Kitchen.class)); } }); } }); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent(Table.this, Table.class)); } }); } }); button3.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //after you hit continue.. textView.setText(R.string.af_book); buttonText1.setText(R.string.hold_on); buttonText2.setText(R.string.put_back); button3.setVisibility(View.GONE); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Dining.book = true; startActivity(new Intent(Table.this, Table.class)); } }); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent(Table.this, Table.class)); } }); } }); // FloatingActionButton fab = findViewById(R.id.fab); // fab.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) // .setAction("Action", null).show(); // } // }); } }
0bcc02cbbcd3acfbff077f004957ae9beb058c9c
e68a7e1cd6b8916f42e5b311f1685de8e8a7942a
/CompositePattern/src/com/es2/composite/SubMenu.java
c84ab4b2c85ce07189dc30eb1b5fa6c87f3eeba9
[]
no_license
diogofalken/ES2
3ae9cdc8fe8c9160f1bd15d4f6f84cac6e643205
96870cfca23dd356ec0f25f58df11f72f1af551f
refs/heads/master
2021-01-08T18:06:56.879336
2020-04-18T20:51:56
2020-04-18T20:51:56
242,103,330
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package com.es2.composite; import java.util.ArrayList; public class SubMenu extends Menu { private ArrayList<Menu> menu = new ArrayList<>(); public void addChild(Menu child) { if(!this.menu.contains(child)) { this.menu.add(child); } } public void removeChild(Menu child) { if(this.menu.contains(child)) { this.menu.remove(child); } } @Override public void showOptions() { System.out.println(this.label); for(Menu cur : this.menu) { cur.showOptions(); } } }
45580f52aa6fa95d32a78116fbff54a4af8e7db2
66c2e6078f50f89399ecb6e30a9c8047ca63973e
/WindDemo/src/main/java/com/wind/bdc/elasticsearchdemo/config/RedisConfig.java
bedc5c0b4a1dde80b49c5cfc9128d4a80e1e98d3
[]
no_license
Ivan-blade/ElasticSearchDemo
a5c3f99902c100caa105e627ba44619c1a9e0706
d321f73199b1ebeb7536325d1882a41096ca0839
refs/heads/master
2023-07-09T23:03:40.064008
2021-08-15T15:11:59
2021-08-15T15:11:59
396,390,166
0
0
null
null
null
null
UTF-8
Java
false
false
1,391
java
package com.wind.bdc.elasticsearchdemo.config; import com.alibaba.fastjson.support.spring.FastJsonRedisSerializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.StringRedisSerializer; /** * @author hylu.Ivan * @date 2021/7/30 下午1:52 * @description */ @Configuration public class RedisConfig { @Bean public RedisTemplate<Object, Object> redisTemplate( RedisConnectionFactory redisConnectionFactory) { RedisTemplate<Object, Object> template = new RedisTemplate<>(); //使用fastjson序列化 FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); // value值的序列化采用fastJsonRedisSerializer template.setValueSerializer(fastJsonRedisSerializer); template.setHashValueSerializer(fastJsonRedisSerializer); // key的序列化采用StringRedisSerializer template.setKeySerializer(new StringRedisSerializer()); template.setHashKeySerializer(new StringRedisSerializer()); template.setConnectionFactory(redisConnectionFactory); return template; } }
207ff49dd95f379028691960b4b087d7785f6f86
24d8cf871b092b2d60fc85d5320e1bc761a7cbe2
/GenealogyJ/rev5531-5561/right-trunk-5561/genj/src/launcher/launcher/ipc/CallHandler.java
702a82db6ee72bae2150c99b911d5948e312b5c0
[]
no_license
joliebig/featurehouse_fstmerge_examples
af1b963537839d13e834f829cf51f8ad5e6ffe76
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
refs/heads/master
2016-09-05T10:24:50.974902
2013-03-28T16:28:47
2013-03-28T16:28:47
9,080,611
3
2
null
null
null
null
UTF-8
Java
false
false
102
java
package launcher.ipc; public interface CallHandler { public String handleCall(String msg); }
9f9736ed413885b11c8ec8e0a7586c457e2a8e62
201a99786b59b81401beca3f0b5c2aba2a999e3e
/sif3demo/src/persist/service/DBService.java
c33addee8e7cb8b735bef5075a3ce37a751577a7
[ "Apache-2.0" ]
permissive
dan-whitehouse/SIF3Training-US
8ae769bba3608cc45ece2c12729e329a82d014f1
7a5fc5d90ab41785232332a4f17f5eca9abb5214
refs/heads/master
2021-05-28T09:18:18.086869
2014-11-07T19:46:24
2014-11-07T19:46:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,814
java
/* * DBService.java * Created: 04/02/2014 * * Copyright 2014 Systemic Pty Ltd * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. * See the License for the specific language governing permissions and limitations under the License. */ package persist.service; import org.apache.log4j.Logger; import sif3.common.exception.PersistenceException; import persist.common.BasicTransaction; import persist.common.HibernateUtil; import persist.dao.BaseDAO; /** * @author Joerg Huber * */ public abstract class DBService { protected final Logger logger = Logger.getLogger(getClass()); public abstract BaseDAO getDAO(); public DBService() { } public BasicTransaction startTransaction() { BasicTransaction tx = new BasicTransaction(); tx.startTransaction(); return tx; } /* Convenience method to 'hide' hibernate as the underlying Data Access Engine */ public void loadSubObject(Object proxy) { HibernateUtil.loadSubObject(proxy); } /* * This method takes the given exception and simply re-throws it if it is a IllegalArgumentException, PersistenceException. * Any other exception is mapped to a persistence exception since this service mainly deals with DB operations. * The given errorMsg is added to the IllegalArgumentException or PersistenceException if addErrorMsgToStandardEx is * true. If the exception is any other type then the error message is added regardless addErrorMsgToStandardEx parameter. * The errorMsg is logged if logError is set to true. */ protected void exceptionMapper(Exception ex, String errorMsg, boolean logError, boolean addErrorMsgToStandardEx) throws IllegalArgumentException, PersistenceException { if (logError) { logger.error(errorMsg, ex); } if (ex instanceof IllegalArgumentException) { if (addErrorMsgToStandardEx) { throw new IllegalArgumentException(errorMsg, ex); } throw (IllegalArgumentException)ex; } if (ex instanceof PersistenceException) { if (addErrorMsgToStandardEx) { throw new PersistenceException(errorMsg, ex); } throw (PersistenceException)ex; } // If we get here the ex is of any other type throw new PersistenceException(errorMsg, ex); } protected void rollback(BasicTransaction tx) { if (tx != null) { tx.rollback(); } } }
82f0a5e711dfe19ff2587f35b8f94eb3a0b26417
fa02eaa873d5f3c3dcbfe7599e91dde86bd77358
/thinkjoy-upms/thinkjoy-upms-dao/src/main/java/com/thinkjoy/upms/dao/model/UpmsSystemExample.java
22ee6f507e3d2ebf89d3b57dd4d6dd862f47d358
[ "MIT" ]
permissive
josephfourier/admin
27942c8a1be8ac460201117b69d7df67ee3a887a
1bcebbbedece08847ea83ed4910b50d964aec01c
refs/heads/master
2021-04-06T06:34:21.841180
2018-03-10T07:07:33
2018-03-10T07:07:33
124,630,923
0
0
null
null
null
null
UTF-8
Java
false
false
29,419
java
package com.thinkjoy.upms.dao.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; public class UpmsSystemExample implements Serializable { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; private static final long serialVersionUID = 1L; public UpmsSystemExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria implements Serializable { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andSystemIdIsNull() { addCriterion("system_id is null"); return (Criteria) this; } public Criteria andSystemIdIsNotNull() { addCriterion("system_id is not null"); return (Criteria) this; } public Criteria andSystemIdEqualTo(Integer value) { addCriterion("system_id =", value, "systemId"); return (Criteria) this; } public Criteria andSystemIdNotEqualTo(Integer value) { addCriterion("system_id <>", value, "systemId"); return (Criteria) this; } public Criteria andSystemIdGreaterThan(Integer value) { addCriterion("system_id >", value, "systemId"); return (Criteria) this; } public Criteria andSystemIdGreaterThanOrEqualTo(Integer value) { addCriterion("system_id >=", value, "systemId"); return (Criteria) this; } public Criteria andSystemIdLessThan(Integer value) { addCriterion("system_id <", value, "systemId"); return (Criteria) this; } public Criteria andSystemIdLessThanOrEqualTo(Integer value) { addCriterion("system_id <=", value, "systemId"); return (Criteria) this; } public Criteria andSystemIdIn(List<Integer> values) { addCriterion("system_id in", values, "systemId"); return (Criteria) this; } public Criteria andSystemIdNotIn(List<Integer> values) { addCriterion("system_id not in", values, "systemId"); return (Criteria) this; } public Criteria andSystemIdBetween(Integer value1, Integer value2) { addCriterion("system_id between", value1, value2, "systemId"); return (Criteria) this; } public Criteria andSystemIdNotBetween(Integer value1, Integer value2) { addCriterion("system_id not between", value1, value2, "systemId"); return (Criteria) this; } public Criteria andIconIsNull() { addCriterion("icon is null"); return (Criteria) this; } public Criteria andIconIsNotNull() { addCriterion("icon is not null"); return (Criteria) this; } public Criteria andIconEqualTo(String value) { addCriterion("icon =", value, "icon"); return (Criteria) this; } public Criteria andIconNotEqualTo(String value) { addCriterion("icon <>", value, "icon"); return (Criteria) this; } public Criteria andIconGreaterThan(String value) { addCriterion("icon >", value, "icon"); return (Criteria) this; } public Criteria andIconGreaterThanOrEqualTo(String value) { addCriterion("icon >=", value, "icon"); return (Criteria) this; } public Criteria andIconLessThan(String value) { addCriterion("icon <", value, "icon"); return (Criteria) this; } public Criteria andIconLessThanOrEqualTo(String value) { addCriterion("icon <=", value, "icon"); return (Criteria) this; } public Criteria andIconLike(String value) { addCriterion("icon like", value, "icon"); return (Criteria) this; } public Criteria andIconNotLike(String value) { addCriterion("icon not like", value, "icon"); return (Criteria) this; } public Criteria andIconIn(List<String> values) { addCriterion("icon in", values, "icon"); return (Criteria) this; } public Criteria andIconNotIn(List<String> values) { addCriterion("icon not in", values, "icon"); return (Criteria) this; } public Criteria andIconBetween(String value1, String value2) { addCriterion("icon between", value1, value2, "icon"); return (Criteria) this; } public Criteria andIconNotBetween(String value1, String value2) { addCriterion("icon not between", value1, value2, "icon"); return (Criteria) this; } public Criteria andBannerIsNull() { addCriterion("banner is null"); return (Criteria) this; } public Criteria andBannerIsNotNull() { addCriterion("banner is not null"); return (Criteria) this; } public Criteria andBannerEqualTo(String value) { addCriterion("banner =", value, "banner"); return (Criteria) this; } public Criteria andBannerNotEqualTo(String value) { addCriterion("banner <>", value, "banner"); return (Criteria) this; } public Criteria andBannerGreaterThan(String value) { addCriterion("banner >", value, "banner"); return (Criteria) this; } public Criteria andBannerGreaterThanOrEqualTo(String value) { addCriterion("banner >=", value, "banner"); return (Criteria) this; } public Criteria andBannerLessThan(String value) { addCriterion("banner <", value, "banner"); return (Criteria) this; } public Criteria andBannerLessThanOrEqualTo(String value) { addCriterion("banner <=", value, "banner"); return (Criteria) this; } public Criteria andBannerLike(String value) { addCriterion("banner like", value, "banner"); return (Criteria) this; } public Criteria andBannerNotLike(String value) { addCriterion("banner not like", value, "banner"); return (Criteria) this; } public Criteria andBannerIn(List<String> values) { addCriterion("banner in", values, "banner"); return (Criteria) this; } public Criteria andBannerNotIn(List<String> values) { addCriterion("banner not in", values, "banner"); return (Criteria) this; } public Criteria andBannerBetween(String value1, String value2) { addCriterion("banner between", value1, value2, "banner"); return (Criteria) this; } public Criteria andBannerNotBetween(String value1, String value2) { addCriterion("banner not between", value1, value2, "banner"); return (Criteria) this; } public Criteria andThemeIsNull() { addCriterion("theme is null"); return (Criteria) this; } public Criteria andThemeIsNotNull() { addCriterion("theme is not null"); return (Criteria) this; } public Criteria andThemeEqualTo(String value) { addCriterion("theme =", value, "theme"); return (Criteria) this; } public Criteria andThemeNotEqualTo(String value) { addCriterion("theme <>", value, "theme"); return (Criteria) this; } public Criteria andThemeGreaterThan(String value) { addCriterion("theme >", value, "theme"); return (Criteria) this; } public Criteria andThemeGreaterThanOrEqualTo(String value) { addCriterion("theme >=", value, "theme"); return (Criteria) this; } public Criteria andThemeLessThan(String value) { addCriterion("theme <", value, "theme"); return (Criteria) this; } public Criteria andThemeLessThanOrEqualTo(String value) { addCriterion("theme <=", value, "theme"); return (Criteria) this; } public Criteria andThemeLike(String value) { addCriterion("theme like", value, "theme"); return (Criteria) this; } public Criteria andThemeNotLike(String value) { addCriterion("theme not like", value, "theme"); return (Criteria) this; } public Criteria andThemeIn(List<String> values) { addCriterion("theme in", values, "theme"); return (Criteria) this; } public Criteria andThemeNotIn(List<String> values) { addCriterion("theme not in", values, "theme"); return (Criteria) this; } public Criteria andThemeBetween(String value1, String value2) { addCriterion("theme between", value1, value2, "theme"); return (Criteria) this; } public Criteria andThemeNotBetween(String value1, String value2) { addCriterion("theme not between", value1, value2, "theme"); return (Criteria) this; } public Criteria andBasepathIsNull() { addCriterion("basepath is null"); return (Criteria) this; } public Criteria andBasepathIsNotNull() { addCriterion("basepath is not null"); return (Criteria) this; } public Criteria andBasepathEqualTo(String value) { addCriterion("basepath =", value, "basepath"); return (Criteria) this; } public Criteria andBasepathNotEqualTo(String value) { addCriterion("basepath <>", value, "basepath"); return (Criteria) this; } public Criteria andBasepathGreaterThan(String value) { addCriterion("basepath >", value, "basepath"); return (Criteria) this; } public Criteria andBasepathGreaterThanOrEqualTo(String value) { addCriterion("basepath >=", value, "basepath"); return (Criteria) this; } public Criteria andBasepathLessThan(String value) { addCriterion("basepath <", value, "basepath"); return (Criteria) this; } public Criteria andBasepathLessThanOrEqualTo(String value) { addCriterion("basepath <=", value, "basepath"); return (Criteria) this; } public Criteria andBasepathLike(String value) { addCriterion("basepath like", value, "basepath"); return (Criteria) this; } public Criteria andBasepathNotLike(String value) { addCriterion("basepath not like", value, "basepath"); return (Criteria) this; } public Criteria andBasepathIn(List<String> values) { addCriterion("basepath in", values, "basepath"); return (Criteria) this; } public Criteria andBasepathNotIn(List<String> values) { addCriterion("basepath not in", values, "basepath"); return (Criteria) this; } public Criteria andBasepathBetween(String value1, String value2) { addCriterion("basepath between", value1, value2, "basepath"); return (Criteria) this; } public Criteria andBasepathNotBetween(String value1, String value2) { addCriterion("basepath not between", value1, value2, "basepath"); return (Criteria) this; } public Criteria andStatusIsNull() { addCriterion("status is null"); return (Criteria) this; } public Criteria andStatusIsNotNull() { addCriterion("status is not null"); return (Criteria) this; } public Criteria andStatusEqualTo(Byte value) { addCriterion("status =", value, "status"); return (Criteria) this; } public Criteria andStatusNotEqualTo(Byte value) { addCriterion("status <>", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThan(Byte value) { addCriterion("status >", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThanOrEqualTo(Byte value) { addCriterion("status >=", value, "status"); return (Criteria) this; } public Criteria andStatusLessThan(Byte value) { addCriterion("status <", value, "status"); return (Criteria) this; } public Criteria andStatusLessThanOrEqualTo(Byte value) { addCriterion("status <=", value, "status"); return (Criteria) this; } public Criteria andStatusIn(List<Byte> values) { addCriterion("status in", values, "status"); return (Criteria) this; } public Criteria andStatusNotIn(List<Byte> values) { addCriterion("status not in", values, "status"); return (Criteria) this; } public Criteria andStatusBetween(Byte value1, Byte value2) { addCriterion("status between", value1, value2, "status"); return (Criteria) this; } public Criteria andStatusNotBetween(Byte value1, Byte value2) { addCriterion("status not between", value1, value2, "status"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andTitleIsNull() { addCriterion("title is null"); return (Criteria) this; } public Criteria andTitleIsNotNull() { addCriterion("title is not null"); return (Criteria) this; } public Criteria andTitleEqualTo(String value) { addCriterion("title =", value, "title"); return (Criteria) this; } public Criteria andTitleNotEqualTo(String value) { addCriterion("title <>", value, "title"); return (Criteria) this; } public Criteria andTitleGreaterThan(String value) { addCriterion("title >", value, "title"); return (Criteria) this; } public Criteria andTitleGreaterThanOrEqualTo(String value) { addCriterion("title >=", value, "title"); return (Criteria) this; } public Criteria andTitleLessThan(String value) { addCriterion("title <", value, "title"); return (Criteria) this; } public Criteria andTitleLessThanOrEqualTo(String value) { addCriterion("title <=", value, "title"); return (Criteria) this; } public Criteria andTitleLike(String value) { addCriterion("title like", value, "title"); return (Criteria) this; } public Criteria andTitleNotLike(String value) { addCriterion("title not like", value, "title"); return (Criteria) this; } public Criteria andTitleIn(List<String> values) { addCriterion("title in", values, "title"); return (Criteria) this; } public Criteria andTitleNotIn(List<String> values) { addCriterion("title not in", values, "title"); return (Criteria) this; } public Criteria andTitleBetween(String value1, String value2) { addCriterion("title between", value1, value2, "title"); return (Criteria) this; } public Criteria andTitleNotBetween(String value1, String value2) { addCriterion("title not between", value1, value2, "title"); return (Criteria) this; } public Criteria andDescriptionIsNull() { addCriterion("description is null"); return (Criteria) this; } public Criteria andDescriptionIsNotNull() { addCriterion("description is not null"); return (Criteria) this; } public Criteria andDescriptionEqualTo(String value) { addCriterion("description =", value, "description"); return (Criteria) this; } public Criteria andDescriptionNotEqualTo(String value) { addCriterion("description <>", value, "description"); return (Criteria) this; } public Criteria andDescriptionGreaterThan(String value) { addCriterion("description >", value, "description"); return (Criteria) this; } public Criteria andDescriptionGreaterThanOrEqualTo(String value) { addCriterion("description >=", value, "description"); return (Criteria) this; } public Criteria andDescriptionLessThan(String value) { addCriterion("description <", value, "description"); return (Criteria) this; } public Criteria andDescriptionLessThanOrEqualTo(String value) { addCriterion("description <=", value, "description"); return (Criteria) this; } public Criteria andDescriptionLike(String value) { addCriterion("description like", value, "description"); return (Criteria) this; } public Criteria andDescriptionNotLike(String value) { addCriterion("description not like", value, "description"); return (Criteria) this; } public Criteria andDescriptionIn(List<String> values) { addCriterion("description in", values, "description"); return (Criteria) this; } public Criteria andDescriptionNotIn(List<String> values) { addCriterion("description not in", values, "description"); return (Criteria) this; } public Criteria andDescriptionBetween(String value1, String value2) { addCriterion("description between", value1, value2, "description"); return (Criteria) this; } public Criteria andDescriptionNotBetween(String value1, String value2) { addCriterion("description not between", value1, value2, "description"); return (Criteria) this; } public Criteria andCtimeIsNull() { addCriterion("ctime is null"); return (Criteria) this; } public Criteria andCtimeIsNotNull() { addCriterion("ctime is not null"); return (Criteria) this; } public Criteria andCtimeEqualTo(Long value) { addCriterion("ctime =", value, "ctime"); return (Criteria) this; } public Criteria andCtimeNotEqualTo(Long value) { addCriterion("ctime <>", value, "ctime"); return (Criteria) this; } public Criteria andCtimeGreaterThan(Long value) { addCriterion("ctime >", value, "ctime"); return (Criteria) this; } public Criteria andCtimeGreaterThanOrEqualTo(Long value) { addCriterion("ctime >=", value, "ctime"); return (Criteria) this; } public Criteria andCtimeLessThan(Long value) { addCriterion("ctime <", value, "ctime"); return (Criteria) this; } public Criteria andCtimeLessThanOrEqualTo(Long value) { addCriterion("ctime <=", value, "ctime"); return (Criteria) this; } public Criteria andCtimeIn(List<Long> values) { addCriterion("ctime in", values, "ctime"); return (Criteria) this; } public Criteria andCtimeNotIn(List<Long> values) { addCriterion("ctime not in", values, "ctime"); return (Criteria) this; } public Criteria andCtimeBetween(Long value1, Long value2) { addCriterion("ctime between", value1, value2, "ctime"); return (Criteria) this; } public Criteria andCtimeNotBetween(Long value1, Long value2) { addCriterion("ctime not between", value1, value2, "ctime"); return (Criteria) this; } public Criteria andOrdersIsNull() { addCriterion("orders is null"); return (Criteria) this; } public Criteria andOrdersIsNotNull() { addCriterion("orders is not null"); return (Criteria) this; } public Criteria andOrdersEqualTo(Long value) { addCriterion("orders =", value, "orders"); return (Criteria) this; } public Criteria andOrdersNotEqualTo(Long value) { addCriterion("orders <>", value, "orders"); return (Criteria) this; } public Criteria andOrdersGreaterThan(Long value) { addCriterion("orders >", value, "orders"); return (Criteria) this; } public Criteria andOrdersGreaterThanOrEqualTo(Long value) { addCriterion("orders >=", value, "orders"); return (Criteria) this; } public Criteria andOrdersLessThan(Long value) { addCriterion("orders <", value, "orders"); return (Criteria) this; } public Criteria andOrdersLessThanOrEqualTo(Long value) { addCriterion("orders <=", value, "orders"); return (Criteria) this; } public Criteria andOrdersIn(List<Long> values) { addCriterion("orders in", values, "orders"); return (Criteria) this; } public Criteria andOrdersNotIn(List<Long> values) { addCriterion("orders not in", values, "orders"); return (Criteria) this; } public Criteria andOrdersBetween(Long value1, Long value2) { addCriterion("orders between", value1, value2, "orders"); return (Criteria) this; } public Criteria andOrdersNotBetween(Long value1, Long value2) { addCriterion("orders not between", value1, value2, "orders"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria implements Serializable { protected Criteria() { super(); } } public static class Criterion implements Serializable { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
cc1f3434e56a60b39306aa1c5caeb819f8696770
29f31368f33306c4b675b3f656b7900f87de1838
/Framework/src/framework/core/camera/FirstPersonCamera.java
d1549efa794c0f1f33fbb2e31fb64a26ed0347b2
[]
no_license
yan-braslavsky/Virtual-City
328247c5c38171a83da5ae62ea11268915a2877c
b506c24f3fc3d567f81bb0292fa0f5cd9d088e0e
refs/heads/master
2022-04-30T08:22:23.932685
2014-08-28T18:33:04
2014-08-28T18:33:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,477
java
package framework.core.camera; import framework.core.architecture.Program; import framework.core.input.keyboard.KeyboardInputProcessor; import framework.core.input.keyboard.KeyboardKeyListener; import framework.core.input.keyboard.KeyboardKeys; import framework.core.input.mouse.MouseInputProcessor; import framework.core.input.mouse.MouseInputProcessorListener; import org.lwjgl.opengl.Display; import org.lwjgl.util.Point; /** * Created with IntelliJ IDEA. * User: Yan * Date: 05/09/13 * Time: 19:51 * To change this template use File | Settings | File Templates. */ public class FirstPersonCamera extends Camera3D { public static final float DEFAULT_MOVEMENT_SPEED = 5f; public static final float ROTATION_SPEED = 2.5f; private boolean mMovingBackwards; private boolean mMovingForward; private boolean mRotateRight; private boolean mRotateLeft; private boolean mElevate; private boolean mLower; private boolean mYawEnabled; private boolean mPitchEnabled; private long mLastUpdateTime; private float mMovementSpeed = DEFAULT_MOVEMENT_SPEED; public FirstPersonCamera(int x, int y, int z) { super(x, y, z); KeyboardInputProcessor.addKeyboardKeyListener(new KeyboardKeyListener() { @Override public void onKeyPressed(KeyboardKeys key) { switch (key) { case W: mMovingForward = true; break; case S: mMovingBackwards = true; break; case A: mRotateLeft = true; break; case D: mRotateRight = true; break; case Q: mPitchEnabled = true; break; case E: mYawEnabled = true; break; } } @Override public void onKeyReleased(KeyboardKeys key) { switch (key) { case W: mMovingForward = false; break; case S: mMovingBackwards = false; break; case A: mRotateLeft = false; break; case D: mRotateRight = false; break; case Q: mPitchEnabled = false; break; case E: mYawEnabled = false; break; } } }); MouseInputProcessor.setMouseInputProcessorListener(new MouseInputProcessorListener() { @Override public void onMouseButtonDown(MouseInputProcessor.MouseButton mouseButton, Point point) { if (mouseButton == MouseInputProcessor.MouseButton.LEFT_BUTTON) { mElevate = true; } else if (mouseButton == MouseInputProcessor.MouseButton.RIGHT_BUTTON) { mLower = true; } } @Override public void onMouseButtonUp(MouseInputProcessor.MouseButton mouseButton, Point point) { if (mouseButton == MouseInputProcessor.MouseButton.LEFT_BUTTON) { mElevate = false; } else if (mouseButton == MouseInputProcessor.MouseButton.RIGHT_BUTTON) { mLower = false; } } @Override public void onMousePositionChange(int dx, int dy, int newX, int newY) { log("Mouse position X := " + newX + " Display Max := " + Display.getWidth()); if (dx != 0) { int direction = (dx > 0) ? 1 : -1; yaw(direction * ROTATION_SPEED); } if (dy != 0) { int direction = (dy < 0) ? 1 : -1; pitch(direction * ROTATION_SPEED); } } }); } private void listenForMovementChange(long deltaTime) { float movementSpeed = mMovementSpeed * deltaTime / 1000; float rotationSpeed = ROTATION_SPEED * deltaTime / 1000; if (mMovingForward) { walkForward(movementSpeed); } else if (mMovingBackwards) { walkBackwards(movementSpeed); } if (mElevate) { elevate(movementSpeed); } else if (mLower) { lower(movementSpeed); } if (mRotateRight) { strafeRight(movementSpeed); } else if (mRotateLeft) { strafeLeft(movementSpeed); } if (mYawEnabled) { yaw(rotationSpeed); } else if (mPitchEnabled) { pitch(rotationSpeed); } } @Override public void lookThrough() { long deltaTime = Program.getTime() - mLastUpdateTime; mLastUpdateTime = Program.getTime(); listenForMovementChange(deltaTime); super.lookThrough(); } public float getMovementSpeed() { return mMovementSpeed; } public void setMovementSpeed(float movementSpeed) { mMovementSpeed = movementSpeed; } }
4b3762b33529df8a936a00662b07f886bf9b04f4
bcbc09ff4d5b84e97fb64f0e61d32d8159ea82c4
/src/GameObject/MapPackage/ObstaclesObjects/Obstacles.java
424a53e576de881eb70adf77fc11914d9f1c5cfe
[]
no_license
okeremd/battlecity-cs319
59903422d84529d288c497c1f7deca6be2c2117c
1608b088fe97a698bd56d602b87b6895c195c7e7
refs/heads/master
2021-05-14T23:40:01.618637
2017-12-15T21:13:00
2017-12-15T21:13:00
104,594,624
1
0
null
2017-12-15T21:13:01
2017-09-23T19:46:54
null
UTF-8
Java
false
false
782
java
package GameObject.MapPackage.ObstaclesObjects; import GameObject.GameObject; /** * Created by kaan on 10/28/2017. */ public abstract class Obstacles extends GameObject { //Variables // 0 = Ground, 1 = GameObject.GameObject.MapPackage.ObstaclesObjects.Brick, 2 = GameObject.GameObject.MapPackage.ObstaclesObjects.Bush, 3 = GameObject.GameObject.MapPackage.ObstaclesObjects.IronWall, 4 = GameObject.MapPackage.ObstaclesObjects.Water, 5 = Mini GameObject.GameObject.MapPackage.ObstaclesObjects.Brick, 6 = Small GameObject.GameObject.MapPackage.ObstaclesObjects.Brick private int typeId; //Methods //Setters and Getters public int getTypeId() { return typeId; } public void setTypeId(int typeId) { this.typeId = typeId; } }
d93201aafdda4f5a8e9474bbd143fa197c87cd00
138486f6d98a9cbf88d417b0642f99ec91eb2d9b
/src/BQN/types/mut/Local.java
81b290afb309b39d06b63fb126a37ceb180b4d1d
[ "MIT" ]
permissive
dzaima/BQN
28eb5f1b2fee61d950001b646478a43cca4246af
ba14bcf1e1d0f90fe90906a6dd7b921460f070f6
refs/heads/master
2023-06-07T17:31:22.248471
2023-05-28T22:02:24
2023-05-28T22:02:24
274,010,055
25
6
MIT
2022-06-11T12:32:14
2020-06-22T01:08:10
Java
UTF-8
Java
false
false
1,358
java
package BQN.types.mut; import BQN.Scope; import BQN.errors.ValueError; import BQN.types.*; public class Local extends Settable { public final int depth, index; public Local(int depth, int index) { this.depth = depth; this.index = index; } public Value get(Scope sc) { Value got = sc.getL(depth, index); if (got == null) throw new ValueError("Getting value of non-existing variable \""+name(sc)+"\""); return got; } public void set(Value x, boolean update, Scope sc, Callable blame) { sc = sc.owner(depth); if (update ^ sc.vars[index]!=null) { if (update) { throw new ValueError("no variable \""+name(sc)+"\" to update", blame); } else { if (sc.parent!=null | sc.vars[0]!=Scope.REPL_MARK) throw redefine(name(sc), blame); // allow top-level redeclarations } } sc.vars[index] = x; } public boolean seth(Value x, Scope sc) { sc.owner(depth).vars[index] = x; return true; } public static ValueError redefine(String name, Tokenable blame) { return new ValueError("Cannot redefine \""+name+"\"", blame); } @Override public String name(Scope sc) { return sc.owner(depth).varNames[index]; } @Override protected boolean hasName() { return true; } public String toString() { return "loc("+depth+","+index+")"; } }
55b846038648be3e632c1c4312069d7fea4321d9
e0f583d286706699da99bc631a31e3f4f2078965
/solutions/0165. Compare Version Numbers/0165.java
5e9082a297e315cbe7377e957eef72d53dbc3d18
[]
no_license
T353007/LeetCode-1
4f002d1885358e8beec0c3d59a1549c4c9f0e06d
026713cb8fa25f52851e1432cd71a5518504e3e0
refs/heads/main
2023-02-15T17:03:49.726291
2021-01-12T10:12:25
2021-01-12T10:12:25
328,920,320
0
0
null
2021-01-12T08:29:55
2021-01-12T08:29:55
null
UTF-8
Java
false
false
568
java
class Solution { public int compareVersion(String version1, String version2) { final String[] levels1 = version1.split("\\."); final String[] levels2 = version2.split("\\."); final int length = Math.max(levels1.length, levels2.length); for (int i = 0; i < length; ++i) { final Integer v1 = i < levels1.length ? Integer.parseInt(levels1[i]) : 0; final Integer v2 = i < levels2.length ? Integer.parseInt(levels2[i]) : 0; final int compare = v1.compareTo(v2); if (compare != 0) return compare; } return 0; } }
efd7ac90e980dd6416233250cd21a5108e5a0869
50945d3aebac92909e2ab2949474b5d8a094a47c
/activemq/activemq-sender/src/main/java/com/rd/activemq/sender/ActivemqSenderApplication.java
4dbb0f91129b1cd96d1e375dfdf36a1f9cccddda
[]
no_license
greenYears/mq-demo
8d10e80d8a409eb5abaa463584db0800a6bcdab0
e5a9d5082a5843bfd2bd8f816ebcb86aaf3508d4
refs/heads/master
2020-11-30T00:08:25.721359
2017-07-05T06:47:14
2017-07-05T06:48:21
96,190,211
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
package com.rd.activemq.sender; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @ComponentScan(basePackages = {"com.rd.support.activemq", "com.rd.activemq.sender.topicmode"}) public class ActivemqSenderApplication { public static void main(String[] args) { SpringApplication.run(ActivemqSenderApplication.class, args); } }
0eecec8b57def9381332855cfe10a8564bbce803
85eba1d69af471276022f05d944cfc83437ad28e
/src/main/java/embedded/com/android/dx/dex/code/form/Form21c.java
b3139281c3a080ba30f58864f4644fc4700d1633
[]
no_license
jsdelivrbot/RHazOS-Android
a64f23c0e09ff5af2827477398427d7c197e3101
1a1b10ce611025743429b109f9eda59f9b53abf1
refs/heads/master
2020-04-10T02:01:41.439048
2018-12-07T15:11:51
2018-12-07T15:11:51
160,732,341
1
0
null
2018-12-06T21:09:42
2018-12-06T21:09:41
null
UTF-8
Java
false
false
2,773
java
package embedded.com.android.dx.dex.code.form; import embedded.com.android.dx.dex.code.*; import embedded.com.android.dx.dex.code.CstInsn; import embedded.com.android.dx.rop.code.*; import embedded.com.android.dx.rop.cst.*; import java.util.*; import embedded.com.android.dx.util.*; public final class Form21c extends InsnFormat { public static final InsnFormat THE_ONE; @Override public String insnArgString(final DalvInsn insn) { final RegisterSpecList regs = insn.getRegisters(); return regs.get(0).regString() + ", " + insn.cstString(); } @Override public String insnCommentString(final DalvInsn insn, final boolean noteIndices) { if (noteIndices) { return insn.cstComment(); } return ""; } @Override public int codeSize() { return 2; } @Override public boolean isCompatible(final DalvInsn insn) { if (!(insn instanceof CstInsn)) { return false; } final RegisterSpecList regs = insn.getRegisters(); RegisterSpec reg = null; switch (regs.size()) { case 1: { reg = regs.get(0); break; } case 2: { reg = regs.get(0); if (reg.getReg() != regs.get(1).getReg()) { return false; } break; } default: { return false; } } if (!InsnFormat.unsignedFitsInByte(reg.getReg())) { return false; } final CstInsn ci = (CstInsn)insn; final int cpi = ci.getIndex(); final Constant cst = ci.getConstant(); return InsnFormat.unsignedFitsInShort(cpi) && (cst instanceof CstType || cst instanceof CstFieldRef || cst instanceof CstString); } @Override public BitSet compatibleRegs(final DalvInsn insn) { final RegisterSpecList regs = insn.getRegisters(); final int sz = regs.size(); final BitSet bits = new BitSet(sz); final boolean compat = InsnFormat.unsignedFitsInByte(regs.get(0).getReg()); if (sz == 1) { bits.set(0, compat); } else if (regs.get(0).getReg() == regs.get(1).getReg()) { bits.set(0, compat); bits.set(1, compat); } return bits; } @Override public void writeTo(final AnnotatedOutput out, final DalvInsn insn) { final RegisterSpecList regs = insn.getRegisters(); final int cpi = ((CstInsn)insn).getIndex(); InsnFormat.write(out, InsnFormat.opcodeUnit(insn, regs.get(0).getReg()), (short)cpi); } static { THE_ONE = new Form21c(); } }
012b455265e53e1016cf261c5895bf5927d2b043
e02651324560f600d09c9574ac83bc129b44ad88
/src/Coordinate.java
a66e2a3e17cf86582e1aab5cce7dd9a283845415
[]
no_license
ErkamDogan/pacmanGame
b1f5c81bb660d44c51caf78a1695af8b69fd76d3
de70c039aa198da7f510fe3aadb0d9a31bf819e3
refs/heads/master
2022-12-25T05:18:46.386918
2020-10-02T12:03:53
2020-10-02T12:03:53
300,596,624
2
0
null
null
null
null
UTF-8
Java
false
false
1,424
java
import javafx.scene.Node; public class Coordinate { private int x; private int y; private int type; private Node holdedObject; /** * type attributes * 0 -- Empty * 1 -- Box * 2 -- Point * 3 -- Pacman */ public Coordinate(int x, int y){ this.x = x; this.y = y; this.type = 0; } public void setHoldedObject(Node holdedObject) { this.holdedObject = holdedObject; } public Node getHoldedObject(){ if (holdedObject == null) { } return holdedObject; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public boolean isEmpty() { return type == 0; } public boolean isBox() { return type == 1; } public boolean isPoint() { return type == 2; } public boolean isPacman() { return type == 3; } public void makeEmpty() { type = 0; } public void makeBox() { type = 1; } public void makePoint() { type = 2; } public void makePacman() { type = 3; } public String toString() { return "[" + x + ", " + y + "] = " + (isEmpty()?"Empty":( (isBox()?"Box":(isPoint()?"Point":"Pacman")))); } }
dc408a6a08215d49c22616d2529da3e26bc98824
58bbccb21d8bf946a229d1ff8d2ef1c196b54a44
/src/main/java/org/muzir/book/solution/Polymorphism/PolyConstructors.java
279a4f60b4d5947953b89adda61868fad9c31603
[]
no_license
muzir/ThinkingInJavaSolution
6549a4b97c1c775e3466c236d8f30bcc5d54dff1
269f8c7eb32928a364743b1ac15f185bdd5a97ba
refs/heads/master
2021-06-26T22:10:52.505912
2016-12-13T04:30:12
2016-12-13T04:30:12
23,292,544
0
1
null
2020-10-13T02:53:50
2014-08-24T20:53:57
Java
UTF-8
Java
false
false
882
java
//: polymorphism/PolyConstructors.java // Constructors and polymorphism // don't produce what you might expect. package org.muzir.book.solution.Polymorphism; import org.muzir.book.solution.Commons.CommonBase; class Glyph extends CommonBase { void draw() { print("Glyph.draw()"); } Glyph() { print("Glyph() before draw()"); draw(); print("Glyph() after draw()"); } } class RoundGlyph extends Glyph { private int radius = 1; RoundGlyph(int r) { radius = r; print("RoundGlyph.RoundGlyph(), radius = " + radius); } void draw() { print("RoundGlyph.draw(), radius = " + radius); } } public class PolyConstructors { public static void main(String[] args) { new RoundGlyph(5); } } /* * Output: Glyph() before draw() RoundGlyph.draw(), radius = 0 Glyph() after * draw() RoundGlyph.RoundGlyph(), radius = 5 */// :~
2fb15d7b55e1e09d596061a2566f6baad3ba9f0d
2285672a94d0dedf50a9b47864007bd12143bfef
/src/main/java/ru/job4j/collection/exam/Email.java
be58ce15fb98684005935022899f49dd69fcec54
[]
no_license
Xazeq/job4j_design
c66826202c5319057dd6fa71d6d9cfc45be17a10
5a7bbfa9c154468ce76f525ad5d04c3be1d2c874
refs/heads/master
2023-07-13T16:30:17.503703
2021-09-08T08:09:36
2021-09-08T08:09:36
365,142,631
0
0
null
null
null
null
UTF-8
Java
false
false
1,147
java
package ru.job4j.collection.exam; import java.util.*; public class Email { public static Map<String, Set<String>> merge(Map<String, Set<String>> source) { Map<String, Set<String>> result = new HashMap<>(); for (Map.Entry<String, Set<String>> sourceEntry : source.entrySet()) { if (result.isEmpty()) { result.put(sourceEntry.getKey(), sourceEntry.getValue()); continue; } Set<String> set = new HashSet<>(); String key = sourceEntry.getKey(); for (Map.Entry<String, Set<String>> resultEntry : result.entrySet()) { if (!Collections.disjoint(sourceEntry.getValue(), resultEntry.getValue())) { result.get(resultEntry.getKey()).addAll(sourceEntry.getValue()); key = resultEntry.getKey(); break; } else { set.addAll(sourceEntry.getValue()); } } if (set.size() == sourceEntry.getValue().size()) { result.put(key, set); } } return result; } }
86dd660d8cfed1461969885093c716e4948f4831
0c005172fb4fcf7c730f14849528ad5cece14bfa
/src/com/test/net/UDPServer.java
7a9ec5434902fbc59325214e28975c39b91dd1c0
[ "MIT" ]
permissive
tangxinghua/TestProject
9b2c7956ec6ab8dbe3e18a5db585a194ee515cb5
ff1912634e78d69c0fac201eb1e42e51d1eeaac3
refs/heads/master
2021-07-16T10:20:36.187050
2017-10-24T08:28:45
2017-10-24T08:28:45
107,568,826
0
0
null
null
null
null
UTF-8
Java
false
false
1,596
java
/** * @Title: UDPServer.java * @Package com.test.net * @Description: TODO * @author tangxinghua [email protected] * @version V1.0 */ package com.test.net; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; /** * @ClassName: UDPServer * @Description: TODO */ public class UDPServer { /** * @Description: TODO * @param args */ public static void main(String[] args) throws Exception { /* * 接收客户端发送的数据 */ // 1.创建服务器端DatagramSocket,指定端口 DatagramSocket socket = new DatagramSocket(8800); //2.创建数据报,用于接收客户端发送的数据 byte[] data = new byte[1024];//创建字节数组,指定接收的数据包的大小 DatagramPacket packet = new DatagramPacket(data, data.length); //3.接收客户端发送的数据 System.out.println("***服务器端已经启动,等待客户端发送数据***"); socket.receive(packet);//此方法在接收到数据报之前会一阻塞 //4.读取数据 String info = new String(data, 0, packet.getLength()); System.out.println("我是服务器,客户端说:" + info); /* * 客户端响应数据 */ //1.定义客户端的地址,端口号、数据 InetAddress address = packet.getAddress(); int port = packet.getPort(); byte[] data2 = "欢迎您!".getBytes(); //2.创建数据报,包含响应的数据信息 DatagramPacket packet2 = new DatagramPacket(data2, data2.length, address, port); //3.响应客户端 socket.send(packet2); //4.关闭资源信息 socket.close(); } }
a1505256b15190a71a5f3a137655d67ec4cc7c43
dbfe2dfcbc82eb308026ecf0b1ca6032bc9ce724
/pdf-service/src/main/java/com/redhat/model/PdfFile.java
8be01b020edcdee4234c5629f4688e9e9b571a88
[]
no_license
mikeintoch/insurance-demo
f445b9f8879ba755fe38f4cb0b35018d1e43c754
f6a1be28525db0e744816f77d59154576228ef16
refs/heads/master
2021-04-26T07:07:51.489122
2017-10-14T00:12:33
2017-10-14T00:12:33
106,882,484
1
0
null
null
null
null
UTF-8
Java
false
false
334
java
package com.redhat.model; public class PdfFile { private String nombre; private String datos; public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDatos() { return datos; } public void setDatos(String datos) { this.datos = datos; } }
aecf7f66077523cd05b69bb4e741a2c0520b8101
bacfbdbb357625f5b4ef791d3c972e16a5f31831
/app/src/main/java/alexis/com/arqui/MainActivity.java
66e98123d24d96428d788c585da2c5d9255403b5
[]
no_license
AlexisGonzalezEsquivel/easy-couchbase
d46b965a35e67561fe2b1776b18c2246f520e569
4be8c28a209f7ab5a08c421c178d0e9438780a9a
refs/heads/master
2021-01-20T14:23:46.250225
2017-05-08T09:33:53
2017-05-08T09:33:53
90,604,134
0
0
null
null
null
null
UTF-8
Java
false
false
3,507
java
package alexis.com.arqui; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.couchbase.lite.CouchbaseLiteException; import com.couchbase.lite.util.ArrayUtils; import java.io.IOException; import java.util.ArrayList; import java.util.List; import alexis.com.easy_couchbase.CRUD; public class MainActivity extends AppCompatActivity { CRUD crud; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button buttonCreateStudent = (Button) findViewById(R.id.buttonCreateStudent); buttonCreateStudent.setOnClickListener(new OnClickListenerCreateStudent()); crud = new CRUD(getApplicationContext()); try { readRecords(); } catch (CouchbaseLiteException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void readRecords() throws CouchbaseLiteException, IOException, ClassNotFoundException { LinearLayout linearLayoutRecords = (LinearLayout) findViewById(R.id.linearLayoutRecords); linearLayoutRecords.removeAllViews(); List<Object> students = crud.list("Student",Student.class); Log.d("ALEXIS",students.size()+""); /*se encima con el botón*/ students.add(0,new Student("","")); if (students.size() > 0) { for (Object obj : students) { Student s = (Student) obj; Log.d("ALEXIS",s.toString()); String id = s.getId(); String studentFirstname = s.getName(); String studentEmail = s.getEmail(); String textViewContents = studentFirstname + " - " + studentEmail; TextView textViewStudentItem= new TextView(this); textViewStudentItem.setPadding(0, 10, 0, 10); textViewStudentItem.setText(textViewContents); textViewStudentItem.setTag(id); linearLayoutRecords.addView(textViewStudentItem); textViewStudentItem.setOnLongClickListener( new OnLongClickListenerStudentRecord( getApplicationContext())); } } else { TextView locationItem = new TextView(this); locationItem.setPadding(8, 8, 8, 8); linearLayoutRecords.addView(locationItem); } } }
b718e437bb23e78afa6a9432ce6a7a22924d5b87
bd62d63a7a10308c09ee82d32c306af47942b624
/TinyWorld4Android/src/com/example/screens/gui/Stack.java
e91988da40c8d0ca3d49a6e6c3ab143d4d29ab64
[]
no_license
razvangoga/zihack-v3-tinyworld4android
cbccb1f2b45db2f25316a0cdbef6c68c4a50b05e
885fdb6a369aea9f967bc267d9a30ac5d67be90b
refs/heads/master
2020-11-25T14:25:56.422774
2013-11-09T11:09:08
2013-11-09T11:09:08
228,714,907
0
0
null
null
null
null
UTF-8
Java
false
false
1,964
java
package com.example.screens.gui; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import com.example.res.ResLoader; public class Stack { private int itemtype; private int num; public Stack(int itemtype, int num) { this.itemtype = itemtype; this.num = num; } public int getMaxStackable() { switch (itemtype) { case ResLoader.TILE_GRASS: return 50; case ResLoader.TILE_SAND: return 99; case ResLoader.TILE_TOWER: return 99; case ResLoader.GUI_WOODITEM: return 99; case ResLoader.GUI_FABRICITEM: return 1; case ResLoader.GUI_BASEICON: return 1; default: return 1000; } } public int tryAddStack(Stack s) { if (s == null) { return 0; } if (itemtype != s.getType()) { return s.getNumber(); } int takenAway = pushItems(s.getNumber()); s.popItems(s.getNumber() - takenAway); return takenAway; } public boolean isFilled() { return num == getMaxStackable(); } public int pushItems(int number) { while (number > 0 && num < getMaxStackable()) { num++; number--; } return number; } public int popItems(int number) { int prenum = num; num = Math.max(0, num - number); return number - prenum; } public int getType() { return itemtype; } public int getNumber() { return num; } public void renderIcon(Canvas g, int x, int y) { g.drawBitmap(ResLoader.get(itemtype), x, y, new Paint(Paint.FILTER_BITMAP_FLAG)); } public void renderNumber(Canvas g, int x, int y) { int color = Color.BLACK; if (getType() == ResLoader.GUI_WOODITEM || getType() == ResLoader.GUI_FABRICITEM || getType() == ResLoader.GUI_BASEICON || getType() == ResLoader.TILE_TOWER) { color = Color.WHITE; Paint paint = new Paint(); paint.setColor(color); g.drawText(Integer.toString(num), x + 1, y + 12, paint); } } }
f95c388fc1443e1a2677b5a7983d4eea1b10201e
a1b38d9e08988bc91a1fb075062a253477a4085a
/src/com/wfs4j/lru/LRUCache.java
19d9264461e0a6473d7e376e648ea7e1e7997bef
[]
no_license
donnie4w/wfs4j
bd2558556095f89f591937f370753d89c154f382
8bc19aeb233a8cd291899d5a51543ce4893530a3
refs/heads/master
2021-01-20T03:46:29.609946
2017-08-04T04:21:49
2017-08-04T04:21:49
89,581,690
1
2
null
null
null
null
UTF-8
Java
false
false
567
java
package com.wfs4j.lru; import java.util.LinkedHashMap; import java.util.Map; /** * ClassName: LRUCache.java <br/> * date: 2017年5月18日 下午12:12:17 <br/> * * @author dong * @version * @since JDK 1.7 * @classDesc 类描述: */ public class LRUCache<K, V> extends LinkedHashMap<K, V> { private static final long serialVersionUID = 1L; private int cacheSize; public LRUCache(int cacheSize) { super(16, 0.75f, true); this.cacheSize = cacheSize; } protected boolean removeEldestEntry(Map.Entry<K, V> eldest) { return size() >= cacheSize; } }
d532ccc97d8fda66ec69b8260912d030ab230e40
ade2ff0d2ae1cdde8c9073e47bb9f2f6e421225b
/core/src/se/snrn/brytoutbox/ui/BricksLeftUi.java
caae25d8c5eeeec5ec7f197e7b69323d97ec7979
[]
no_license
snrn-Pontus/brytutbox
e23a035a42062ac6701590114a6a4e57e7b0f282
112db3c025c2119ac3648b7c75a3895f97b819c7
refs/heads/master
2021-01-19T10:00:38.474213
2017-08-09T05:40:37
2017-08-09T05:40:37
87,810,764
0
0
null
null
null
null
UTF-8
Java
false
false
795
java
package se.snrn.brytoutbox.ui; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; import se.snrn.brytoutbox.GameState; import se.snrn.brytoutbox.Renderable; import se.snrn.brytoutbox.Updateable; public class BricksLeftUi implements Updateable, Renderable{ private GameState gameState; private int x; private int y; private BitmapFont bitmapFont; public BricksLeftUi(GameState gameState, int x, int y) { this.gameState = gameState; this.x = x; this.y = y; bitmapFont = new BitmapFont(); } @Override public void update(float delta) { } @Override public void render(Batch batch) { bitmapFont.draw(batch, "Bricks Left: "+gameState.getBricksLeft(),x,y); } }
5eb879c87f87ea068fd1311ae992a8fe22554e4e
6b49394c0c01b72796d0b44f5f0d3bcab01714b1
/src/member/controller/MemberController.java
f04c8361076b9e04aedc70b7026bf41eda63dc29
[]
no_license
darkskyaa/-Gym
b32a6ab5707bc36f515290deeab99bb93e3ea9c3
ff38a2346b7fadc2927785ed3b20f8ddfd61c622
refs/heads/master
2020-03-10T17:15:50.354333
2018-05-06T09:53:09
2018-05-06T09:53:09
129,495,843
0
0
null
null
null
null
UTF-8
Java
false
false
2,524
java
package member.controller; import static util.Constant.BIRTH_DATE_FORMAT; import java.util.Date; import member.enums.MemberStatus; import member.pojo.MemberBean; import member.service.MemberService; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.ui.ModelMap; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.InitBinder; 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; /** * The controller of Member subsystem * @date 2018-04-14 * @category Member * @author William */ @RestController @RequestMapping("member") public class MemberController { private static Logger logger = Logger.getLogger(MemberController.class); @Autowired private MemberService memberService; /** * The web api for getting a member information * @param id : member id * @return pojo object of member */ @GetMapping("findMemberById") public MemberBean findMemberById(Integer id) { if (id == null) { return null; } return memberService.selectById(id); } /** * The we api for register a member * @param member : new member information * @return result map for register */ @PostMapping("register") public ModelMap register(@RequestBody MemberBean member) { member.setPoint(0); MemberStatus status = memberService.register(member); ModelMap resultMap = new ModelMap(); resultMap.put("code", status.getCode()); resultMap.put("msg", status); return resultMap; } /** * The web api for member login * @param member : login member information * @return information without password for logged in member */ @PostMapping("login") public MemberBean login(@RequestBody MemberBean member) { return memberService.login(member.getAccount(), member.getPassword()); } /** * The bind method for type "String" and "Date" * @param binder */ @InitBinder void dataBinderInit(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringTrimmerEditor(false)); binder.registerCustomEditor(Date.class, new CustomDateEditor(BIRTH_DATE_FORMAT, true)); } }
2b95594448b3e054221d442cc1e51e35cfb82601
6067bbdf15ca9dadd175ce2920a5d0b97549b696
/proyectoBase/src/main/java/com/usa/demo/controller.java
62bb23c1b693e118425799dcf55b0bc5d69ec65f
[]
no_license
penadaniel/TicRetos
8fa937a0515d33645ea4a9ff7f2c8b12475a01fa
25237a82e4da0252360360921253d33e8967c2cb
refs/heads/master
2023-09-04T00:24:34.775080
2021-11-02T22:06:28
2021-11-02T22:06:28
423,646,397
0
0
null
null
null
null
UTF-8
Java
false
false
597
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.usa.demo; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * * @author USER */ @RestController @RequestMapping("/api/Game") public class controller { @GetMapping("/holaMundo") public String saludad(){ return "Hola Mundo Tutoria"; } }
a5e3d640d338346a7e20447c7f5cdd7efa11709b
9098a5ea9d2334c9796391d8be49f1320adcb58c
/src/com/mobin/thread/Example/BigFileDownloader.java
46cdeaac744b472b120701d836fecc50b84ff44e
[]
no_license
shanyao19940801/Thread
8ef174e3dad1fd3aeb4f5cb9fa4bf5e92d73bc40
0ce69d8f24973f349610162a667ea4d9571ca055
refs/heads/master
2021-01-20T00:04:53.415809
2018-03-09T02:00:28
2018-03-09T02:00:28
89,074,912
0
0
null
2017-04-22T14:16:54
2017-04-22T14:16:54
null
UTF-8
Java
false
false
5,069
java
package com.mobin.thread.Example; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.Properties; import java.util.concurrent.atomic.AtomicBoolean; /** * Created by Mobin on 2017/8/5. * 《Java多线程编程实战指南(核心篇)》Demo */ public class BigFileDownloader { protected final URL requestURL; protected final long fileSize; protected final Storage storage;//负责已经下载数据的存储 protected final AtomicBoolean taskCanceled = new AtomicBoolean(false); private static final Logger log = LoggerFactory.getLogger(BigFileDownloader.class); public static synchronized void initLog4j(){ String log4jFile = System.getProperty("log4j"); InputStream in = null; if (log4jFile !=null){ try { in = new FileInputStream(log4jFile); } catch (FileNotFoundException e) { e.printStackTrace(); } } if (in == null) { in = BigFileDownloader.class.getResourceAsStream("/log4j.properties"); } Properties properties = new Properties(); try { properties.load(in); } catch (IOException e) { e.printStackTrace(); } System.out.println("日志配置加载完成"); } public BigFileDownloader(String strURL) throws Exception { requestURL = new URL(strURL); fileSize = retiveFileSize(requestURL); log.info("file total size: %s", fileSize); //String fileName = strURL.substring(strURL.lastIndexOf("/") + 1); String fileName = "Adobe+Reader+XI@636_94248.exe"; storage = new Storage(fileSize, fileName); } public void download(int taskCount, long reportInterval) throws InterruptedException { long chunkSizePerThread = fileSize / taskCount; long lowerBound = 0; //下载数据段的起始字节 long upperBound = 0;//下载数据段的结束字节 DownloadTask dt; //创建多个线程下载 for (int i = (taskCount -1); i >= 0; i --){ lowerBound = i * chunkSizePerThread; if (i == taskCount -1) { upperBound = fileSize; } else { upperBound = lowerBound + chunkSizePerThread -1; } //创建下载任务 dt = new DownloadTask(lowerBound, upperBound, requestURL,storage, taskCanceled); dispatchWork(dt, i); } //定时报告下载进度 reportProgress(reportInterval); storage.close(); } private void reportProgress(long reportInterval) throws InterruptedException { float lastComplection; int complection = 0; while (!taskCanceled.get()){ lastComplection = complection; complection = (int)(storage.getTotalWrites() * 100 /fileSize); if (complection == 100) { break; } else if (complection - lastComplection >= 1){ log.info("Complection:%s%%", complection); if (complection > 90) { reportInterval = 1000; } } Thread.sleep(reportInterval); } log.info("Complection:%s%%",complection); } private void dispatchWork(final DownloadTask dt, int workerIndex) { //创建下载线程 Thread wordThread = new Thread(new Runnable() { @Override public void run() { try{ dt.run(); }catch (Exception e){ e.printStackTrace(); //取消整个文件的下载 cancelDownload(); } } }); wordThread.setName("downloader-" +workerIndex ); wordThread.start(); } private void cancelDownload() { if (taskCanceled.compareAndSet(false, true)) { storage.close(); } } private static long retiveFileSize(URL requestURL) throws Exception { long size = -1; HttpURLConnection conn = null; try { conn = (HttpURLConnection) requestURL.openConnection(); conn.setRequestMethod("HEAD"); conn.setRequestProperty("Connection", "keep-alive"); conn.connect(); int statusCode = conn.getResponseCode(); if (HttpURLConnection.HTTP_OK != statusCode){ throw new Exception("Server exception,status code:"+ statusCode); } //文件大小 String c1 = conn.getHeaderField("Content-Length"); size = Long.valueOf(c1); } catch (IOException e) { e.printStackTrace(); }finally { if (null != conn){ conn.disconnect(); } } return size; } }
12c3f69a45a030974de239337fd4d612f354355d
180e78725121de49801e34de358c32cf7148b0a2
/dataset/protocol1/spoon/learning/4442/CtExecutableReference.java
6e45fdcf3cfd1663b7b6ae4602a8cd9eb33208d6
[]
no_license
ASSERT-KTH/synthetic-checkstyle-error-dataset
40e8d1e0a7ebe7f7711def96a390891a6922f7bd
40c057e1669584bfc6fecf789b5b2854660222f3
refs/heads/master
2023-03-18T12:50:55.410343
2019-01-25T09:54:39
2019-01-25T09:54:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,114
java
/** * Copyright (C) 2006-2018 INRIA and contributors * Spoon - http://spoon.gforge.inria.fr/ * * This software is governed by the CeCILL-C License under French law and * abiding by the rules of distribution of free software. You can use, modify * and/or redistribute the software under the terms of the CeCILL-C license as * circulated by CEA, CNRS and INRIA at http://www.cecill.info. * * 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 CeCILL-C License for more details. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ package spoon.reflect.reference; import spoon.reflect.annotations.PropertyGetter; import spoon. reflect.annotations.PropertySetter; import spoon.reflect.declaration.CtExecutable; import spoon.reflect.path.CtRole; import spoon.support.DerivedProperty; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.List; /** * This interface defines a reference to a * {@link spoon.reflect.declaration.CtExecutable}. It can be a * {@link spoon.reflect.declaration.CtMethod} or a * {@link spoon.reflect.declaration.CtConstructor}. */ public interface CtExecutableReference<T> extends CtReference, CtActualTypeContainer { String CONSTRUCTOR_NAME = "<init>"; String LAMBDA_NAME_PREFIX = "lambda$"; String UNKNOWN_TYPE = "<unknown>"; /** * Tells if this is a reference to a constructor. */ boolean isConstructor(); /** * Gets the runtime method that corresponds to an executable reference if * any. * * @return the method (null if not found) */ Method getActualMethod(); /** * Gets the runtime constructor that corresponds to an executable reference * if any. * * @return the constructor (null if not found) */ Constructor<?> getActualConstructor(); @Override @DerivedProperty CtExecutable<T> getDeclaration(); /** * Returns a subtype {@link CtExecutable} that corresponds to the reference * even if its declaring type isn't in the Spoon source path (in this case, * the Spoon elements are built with runtime reflection). * * @return the executable declaration that corresponds to the reference. */ @DerivedProperty CtExecutable<T> getExecutableDeclaration(); /** * Gets the reference to the type that declares this executable. */ @PropertyGetter(role = CtRole.DECLARING_TYPE) CtTypeReference<?> getDeclaringType(); /** * For methods, gets the return type of the executable (may be null in noclasspath mode). * For constructors, gets the constructor class (which is also the return type of the contructor calls). */ @PropertyGetter(role = CtRole.TYPE) CtTypeReference<T> getType(); /** * Gets parameters of the executable. */ @PropertyGetter(role = CtRole.ARGUMENT_TYPE) List<CtTypeReference<?>> getParameters(); /** * Sets parameters of the executable. */ @PropertySetter(role = CtRole.ARGUMENT_TYPE) <C extends CtExecutableReference<T>> C setParameters(List<CtTypeReference<?>> parameters); /** * Returns <code>true</code> if this executable overrides the given * executable. */ boolean isOverriding(CtExecutableReference<?> executable); /** * Returns the method overridden by this one, if exists (null otherwise). * The returned method is searched in the superclass hierarchy * (and not in the super-interfaces). * The returned method can be an abstract method from an abstract class, a super implementation, or even a method from Object. */ @DerivedProperty CtExecutableReference<?> getOverridingExecutable(); /** * Gets an overriding executable for this executable from a given subtype, * if exists. * * @param <S> * subtype of T * @param subType * starting bottom type to find an overriding executable * (subtypes are not tested) * @return the first found (most concrete) executable that overrides this * executable (null if none found) */ <S extends T> CtExecutableReference<S> getOverridingExecutable(CtTypeReference<?> subType); /** * Tells if the referenced executable is static. */ @PropertyGetter(role = CtRole.IS_STATIC) boolean isStatic(); /** * Sets the declaring type. */ @PropertySetter(role = CtRole.DECLARING_TYPE) <C extends CtExecutableReference<T>> C setDeclaringType(CtTypeReference<?> declaringType); /** * Sets this executable reference to be static or not. */ @PropertySetter(role = CtRole.IS_STATIC) <C extends CtExecutableReference<T>> C setStatic(boolean b); /** * Sets the type of the variable. */ @PropertySetter(role = CtRole.TYPE) <C extends CtExecutableReference<T>> C setType(CtTypeReference<T> type); /** * Tells if the referenced executable is final. */ boolean isFinal(); /** * Gets the signature of this method or constructor, as explained in {@link spoon.reflect.declaration.CtMethod#getSignature()}. */ String getSignature(); @Override CtExecutableReference<T> clone(); }
55a590dba797931987660fce035e65178f60be2b
e9f1077d58ed8511562253ce4c50f18b36832a4e
/src/main/java/com/renewal/weatherservicev2/service/raw_data/living_and_health/specific/UvIdxService.java
96df4f78f4d0a6a8b7c3af67213b8549f7153db9
[]
no_license
joypto/springboot-weather-app-renewal
8c270eebde0512032dd0adb24e9d955e8202c986
c666019fbd8a8a737758d7ca727865392e495c40
refs/heads/main
2023-08-22T23:27:36.843770
2021-11-06T13:46:31
2021-11-06T13:46:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,659
java
package com.renewal.weatherservicev2.service.raw_data.living_and_health.specific; import com.renewal.weatherservicev2.domain.entity.common.BigRegion; import com.renewal.weatherservicev2.domain.entity.external.living_and_health.UvIdx; import com.renewal.weatherservicev2.domain.vo.openapi.abstr.OpenApiRequestInterface; import com.renewal.weatherservicev2.domain.vo.openapi.request.living_and_health.UVIdxReq; import com.renewal.weatherservicev2.domain.vo.openapi.response.living_and_health.LivingAndHealthRes; import com.renewal.weatherservicev2.repository.living_and_health.UvIdxRepository; import com.renewal.weatherservicev2.service.connection.LivingAndHealthConnectionService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @Slf4j @Service @RequiredArgsConstructor public class UvIdxService { private final UvIdxRepository uvIdxRepository; private final LivingAndHealthConnectionService connectionService; public void callAndSaveData(String date, BigRegion bigRegion) { UvIdx uvIdx = callData(date, bigRegion.getAdmCode()); uvIdx.joinRegion(bigRegion); saveData(uvIdx); } public UvIdx callData(String date, String admCode) { OpenApiRequestInterface request = UVIdxReq.builder() .admCode(admCode) .date(date) .build(); LivingAndHealthRes response = connectionService.connectAndGetParsedResponse(request); UvIdx data = new UvIdx(); return data.from(response); } private void saveData(UvIdx uvIdx) { uvIdxRepository.save(uvIdx); } }
5b081cb5ceabfae8e6d621509ad9fcb217d60ac1
761f511f784fb6b7fee1fc47792f2a65d13a0099
/MaiCRM/src/br/edu/facear/service/service_Cliente.java
fa5f037a4679ad22a72ca0d124f9d61517aab106
[]
no_license
sant0sl/MyCRM
835891d33de2ab4558daddb148d133e6f3b16a90
b40ac7840a29bc8703abdee47f344e88bcec111a
refs/heads/master
2021-06-25T14:25:15.282547
2017-09-13T00:11:44
2017-09-13T00:11:44
102,992,610
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
package br.edu.facear.service; import java.sql.SQLException; import java.util.List; import br.edu.facear.dao.ClienteDAO; import br.edu.facear.model.Cliente; public class service_Cliente { private ClienteDAO cDao; public service_Cliente() { cDao = new ClienteDAO(); } public void cadastrarCliente(Cliente c) throws SQLException{ if(c!=null) { cDao.Create(c); } } public void alterarCliente(Cliente c) throws SQLException{ if(c!=null) { cDao.Update(c); } } public List<Cliente> listarCliente() throws SQLException{ return cDao.Read(); } public Cliente ConsultaPorID(Integer id) throws SQLException{ return cDao.ByID(id); } }
[ "sant0@LeonardoSantos" ]
sant0@LeonardoSantos
d49380e8f9487818361ba7ff6f794321d2b60603
35dec69e77693824489eb65e105548795482d60b
/src/uk/ac/bbk/dcs/l4all/beans/LearnDirectCourse.java
8f0595f4e995cc224f171d6370dd438e1515f21c
[]
no_license
vanch3d/l4all-v4
5598416b8324cee332eeca36f729e0737d511a4a
f3a601ca279cf01dbe10fa3cb097643afe43959f
refs/heads/master
2021-05-14T20:16:24.859641
2017-12-07T16:27:43
2017-12-07T16:27:43
113,472,843
0
0
null
null
null
null
UTF-8
Java
false
false
6,916
java
/* * Copyright (C) 2005 Birkbeck College University of London * * 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 2 * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package uk.ac.bbk.dcs.l4all.beans; /** * @author George Papamarkos * * Course.java * uk.ac.bbk.dcs.l4all.beans */ public class LearnDirectCourse { private String courseCode = ""; private String title = "" ; private String noRating = "" ; private String date = ""; private String context = ""; private String type = ""; private String language =""; private String creator = ""; private String URL = ""; private String description = ""; private String publisher = ""; private String averageRating = ""; private String contributor = ""; private String metaDate = ""; private String subject = ""; private String entity = ""; // extra for LearnDirect private String provAddress1 ; private String provAddress2 ; private String provAddress3 ; private String provAddress4 ; private String provPostCode ; private String venueAddress1 ; private String venueAddress2 ; private String venueAddress3 ; private String venueAddress4 ; private String venuePostCode ; private String courseContact ; private String contactTelNo ; private String entry; private String qualificationTitle ; private String duration ; private String cost ; public String toXML() { String res = null; res = ("<course learn_direct='1'>"); res += ("<course_id>" + getCourseCode() + "</course_id>"); res += ("<course_title><![CDATA[" + getTitle() + "]]></course_title>"); res += ("<course_description><![CDATA[" + getDescription() + "]]></course_description>"); res += ("<course_URL><![CDATA[" + getURL()+ "]]></course_URL>"); res += ("<course_level><![CDATA[" + getQualificationTitle()+ "]]></course_level>"); res += ("</course>"); return res; } public String getCost() { return cost; } public void setCost(String cost) { this.cost = cost; } public String getContactTelNo() { return contactTelNo; } public void setContactTelNo(String contactTelNo) { this.contactTelNo = contactTelNo; } public String getCourseContact() { return courseContact; } public void setCourseContact(String courseContact) { this.courseContact = courseContact; } public String getDuration() { return duration; } public void setDuration(String duration) { this.duration = duration; } public String getEntry() { return entry; } public void setEntry(String entry) { this.entry = entry; } public String getProvAddress1() { return provAddress1; } public void setProvAddress1(String provAddress1) { this.provAddress1 = provAddress1; } public String getProvAddress2() { return provAddress2; } public void setProvAddress2(String provAddress2) { this.provAddress2 = provAddress2; } public String getProvAddress3() { return provAddress3; } public void setProvAddress3(String provAddress3) { this.provAddress3 = provAddress3; } public String getProvAddress4() { return provAddress4; } public void setProvAddress4(String provAddress4) { this.provAddress4 = provAddress4; } public String getProvPostCode() { return provPostCode; } public void setProvPostCode(String provPostCode) { this.provPostCode = provPostCode; } public String getQualificationTitle() { return qualificationTitle; } public void setQualificationTitle(String qualificationTitle) { this.qualificationTitle = qualificationTitle; } public String getVenueAddress1() { return venueAddress1; } public void setVenueAddress1(String venueAddress1) { this.venueAddress1 = venueAddress1; } public String getVenueAddress2() { return venueAddress2; } public void setVenueAddress2(String venueAddress2) { this.venueAddress2 = venueAddress2; } public String getVenueAddress3() { return venueAddress3; } public void setVenueAddress3(String venueAddress3) { this.venueAddress3 = venueAddress3; } public String getVenueAddress4() { return venueAddress4; } public void setVenueAddress4(String venueAddress4) { this.venueAddress4 = venueAddress4; } public String getVenuePostCode() { return venuePostCode; } public void setVenuePostCode(String venuePostCode) { this.venuePostCode = venuePostCode; } public String getAverageRating() { return averageRating; } public void setAverageRating(String averageRating) { this.averageRating = averageRating; } public String getContext() { return context; } public void setContext(String context) { this.context = context; } public String getContributor() { return contributor; } public void setContributor(String contributor) { this.contributor = contributor; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getEntity() { return entity; } public void setEntity(String entity) { this.entity = entity; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getMetaDate() { return metaDate; } public void setMetaDate(String metaDate) { this.metaDate = metaDate; } public String getNoRating() { return noRating; } public void setNoRating(String noRating) { this.noRating = noRating; } public String getPublisher() { return publisher; } public void setPublisher(String publisher) { this.publisher = publisher; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getURI() { return URL; } public String getCourseCode() { return courseCode; } public void setCourseCode(String courseCode) { this.courseCode = courseCode; } public String getURL() { return URL; } public void setURL(String url) { URL = url; } }
19962ae28e2cf1b83cac7d707ff76ba4bf90bcdc
6e8669465541b05111bd77e5b6e4d7ecb339b016
/src/main/java/com/java/lhb/inherit/Son.java
bc385c5dbb7e8a928ff390a1f7ce7e0c33ae3f6e
[]
no_license
harryper/java-study
caf9f5d2a004329dbbe97ab2ff93f677c743e096
72b47d80d68212c45db71120e83096a0875f9652
refs/heads/master
2023-04-28T16:54:14.592106
2021-05-20T07:29:46
2021-05-20T07:29:46
288,411,052
0
0
null
null
null
null
UTF-8
Java
false
false
438
java
package com.java.lhb.inherit; /** * @author harryper * @date 2021/5/7 */ class Father { public Father() { this.out(); } public void out() { System.out.println("Father"); } } public class Son extends Father { public Son() { super(); } @Override public void out() { System.out.println("Son"); } public static void main(String[] args) { new Son(); } }
25173032fbb7b7cc12173f9bee9529e311e9b986
9383963b71f18f901e83eb3ff19231aec455c5a7
/src/main/java/com/sur_wis/wine_shop/model/entity/Accessory.java
be40827657e43ca5380516b5a2823b86184062db
[]
no_license
Verson9/java-wine
2f45e994b388751ea17462274267936233f62a42
5f467035ae2fff05dcbd59a12782e0b2472d0a55
refs/heads/master
2022-11-19T12:35:43.837919
2020-07-25T13:12:41
2020-07-25T13:12:41
277,191,263
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package com.sur_wis.wine_shop.model.entity; import lombok.*; import javax.persistence.*; //@AllArgsConstructor //@NoArgsConstructor //@ToString //@Setter //@Getter @Entity(name = "accessories") public class Accessory { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(nullable = false, name = "id") Long id; @Column(nullable = false, name = "name") String name; @Column(nullable = false, name = "description") String description; @Column(nullable = false, name = "type") String type; @Column(nullable = false, name = "price") int price; public Accessory() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getType() { return type; } public void setType(String type) { this.type = type; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } }
8ee6e06ce189c80d25988d2e87bb442cb1cea1fa
96e1b8da3055f11dee3b907f903d5862cc6c33f5
/app/src/main/java/iori/hdoctor/util/ResourceUtil.java
ed2114e7492efc14c65772cb69636a3ccdb9a0d7
[]
no_license
hongery16888/hospital_doctor
a11bea14fdd496b9a4ecc9c558eb03c153d74105
480c69bb859346746c973b6e21584b48cb97a58b
refs/heads/master
2021-01-01T05:38:31.110851
2015-09-17T15:15:45
2015-09-17T15:15:45
38,822,266
0
0
null
null
null
null
UTF-8
Java
false
false
1,440
java
package iori.hdoctor.util; import android.content.Context; import java.io.InputStream; import java.lang.reflect.Field; import iori.hdoctor.R; public class ResourceUtil { /** * 获取Drawable ID * @param name * @return */ public static int getDrawable(String name){ int res=-1; try { Field f=R.drawable.class.getDeclaredField(name); res=f.getInt(null); } catch (Exception e) { } return res; } /** * 获取Raw ID * @param name * @return */ public static int getRaw(String name){ int res=-1; try { Field f=R.raw.class.getDeclaredField(name); res=f.getInt(null); } catch (Exception e) { e.printStackTrace(); } return res; } /** * 获取Raw内容 * @param context * @param rawName * @return */ public static String getRawContext(Context context,String rawName) { try { InputStream inputStream = context.getResources().openRawResource( ResourceUtil.getRaw(rawName)); byte[] reader = new byte[inputStream.available()]; while (inputStream.read(reader) != -1) { } String fileContext = new String(reader); return fileContext; } catch (Exception e) { return "-1"; } } }
71d798f957903647a4ba5d23eb6b51a715189eac
96bd210c2ca349d2d2bdb6fcbd909780d81d8285
/src/main/java/com/scs/zhihu/api/service/impl/ColumnsServiceImpl.java
ac1488b88fa80f168ba5bcedde1ba2f8ca9c7c94
[]
no_license
WHL1998w/zhihu-api
d4780d9389670d335faa1ee635323cb1f12ae785
6d6580e2c69e4ac2de346cea895518148d3d4216
refs/heads/master
2022-07-05T20:17:23.970923
2020-01-21T14:33:46
2020-01-21T14:33:46
234,344,571
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
package com.scs.zhihu.api.service.impl; import com.scs.zhihu.api.entity.Columns; import com.scs.zhihu.api.mapper.ColumnsMapper; import com.scs.zhihu.api.service.ColumnsService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * @ClassName ColumnsServiceImpl * @Description TODO * @Author wanghuanle * @Date 2020/1/21 **/ @Service public class ColumnsServiceImpl implements ColumnsService { @Resource private ColumnsMapper columnsMapper; @Override public List<Map> selectAll() { return columnsMapper.selectAll(); } @Override public List<Columns> selectRecent() { return columnsMapper.selectRecent(); } }
41033aa53b5afad6082888351303b60d9c8bc5ae
2ce96a02088baf213b6a4e87438967a2da04bfed
/WearHelper/wear/src/main/java/com/tdt/project/wearhelper/BatteryStatusService.java
cfbbf2e7dfbac07cdc70afb06075f9b9f84911f2
[]
no_license
JamesHuynIT/DoAn1
8950db9765fb90ab2deff2979cda75c648a45779
1d7b65e4a57052f2c1146b4be433bc1d62fc655d
refs/heads/master
2021-01-01T05:22:32.047280
2016-05-21T00:54:40
2016-05-21T00:54:40
56,674,741
0
0
null
null
null
null
UTF-8
Java
false
false
5,812
java
package com.tdt.project.wearhelper; import android.app.IntentService; import android.app.Notification; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationManagerCompat; import android.util.Log; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.wearable.DataItemBuffer; import com.google.android.gms.wearable.DataMap; import com.google.android.gms.wearable.PutDataMapRequest; import com.google.android.gms.wearable.Wearable; import java.util.concurrent.TimeUnit; public class BatteryStatusService extends IntentService implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { public static final String GET_PHONE_STATUS = "action_get_status"; public static final String FAIL_GET_PHONE_STATUS = "action_fail_get_status"; private static final String TAG = "PHONE_STATUS"; private static final String PHONE_STATUS = "phone_status"; private static final String PATH_STATUS = "/PhoneStatus"; // Timeout for making a connection to GoogleApiClient (in milliseconds). private static final long CONNECTION_TIME_OUT_MS = 100; int notificationId = 1; private GoogleApiClient mGoogleApiClient; public BatteryStatusService() { super(BatteryStatusService.class.getSimpleName()); } @Override public void onCreate() { super.onCreate(); mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Wearable.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); } @Override protected void onHandleIntent(Intent intent) { mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); Intent broadcastIntentConnnect = new Intent(); if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "BatteryStatusService.onHandleIntent"); } if (mGoogleApiClient.isConnected()) { // Set the alarm off by default. boolean phoneStatus = false; if (intent.getAction().equals(GET_PHONE_STATUS)) { broadcastIntentConnnect.setAction(BatteryStatusService.GET_PHONE_STATUS); // Get current state of the alarm. DataItemBuffer result = Wearable.DataApi.getDataItems(mGoogleApiClient).await(); try { if (result.getStatus().isSuccess()) { if (result.getCount() == 4) { phoneStatus = DataMap.fromByteArray(result.get(3).getData()) .getBoolean(PHONE_STATUS, false); broadcastIntentConnnect.putExtra("phoneStatus", true); sendBroadcast(broadcastIntentConnnect); } else { Log.e(TAG, "Unexpected number of DataItems found.\n" + "\tExpected: 1\n" + "\tActual: " + result.getCount()); } } else if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "onHandleIntent: failed to get current alarm state"); } } finally { result.release(); } // Toggle alarm. phoneStatus = !phoneStatus; } // Use alarmOn boolean to update the DataItem - phone will respond accordingly // when it receives the change. PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(PATH_STATUS); putDataMapRequest.getDataMap().putBoolean(PHONE_STATUS, phoneStatus); putDataMapRequest.setUrgent(); Wearable.DataApi.putDataItem(mGoogleApiClient, putDataMapRequest.asPutDataRequest()) .await(); } else { broadcastIntentConnnect.setAction(BatteryStatusService.FAIL_GET_PHONE_STATUS); sendBroadcast(broadcastIntentConnnect); Log.e(TAG, "Failed to get battery status - Client disconnected from Google Play " + "Services"); } mGoogleApiClient.disconnect(); } @Override public void onConnected(Bundle bundle) { } @Override public void onConnectionSuspended(int i) { Notification notification = new NotificationCompat.Builder(getApplication()) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle("Smart Helper") .setContentText("CONNECT LOST") .extend(new NotificationCompat.WearableExtender().setHintShowBackgroundOnly(true)) .build(); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplication()); notificationManager.notify(notificationId, notification); notificationId += 1; } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { Notification notification = new NotificationCompat.Builder(getApplication()) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle("Smart Helper") .setContentText("CAN'T CONNECT") .extend(new NotificationCompat.WearableExtender().setHintShowBackgroundOnly(true)) .build(); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplication()); notificationManager.notify(notificationId, notification); notificationId += 1; } }
db1a8b2fedc8b5d996e999a685ea04a1ec12ca30
9e453904742c5122a5afd2fb6eac1ccd64c8540a
/Obligatorio/src/uy/ort/ob2018_1/Sistema.java
b4f20ac1480392447c7019b5c325529df12bb395
[]
no_license
YessyAlvarez/Algoritmos2
1084c6c89a6da393c0f9c2e0a97380f6de8f1b75
d21eed3851786210d12ff99091cd9565e4981087
refs/heads/master
2020-03-11T10:05:11.785869
2018-04-24T15:22:36
2018-04-24T15:22:36
129,931,831
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
2,268
java
package uy.ort.ob2018_1; import uy.ort.ob2018_1.Retorno.Resultado; public class Sistema implements ISistema { private Lista ListaABC; private Lista RankinPalabras; private int maxCPalabras; public Retorno inicializarSistema (int maxPalabras) { Retorno retorno = new Retorno(); maxCPalabras = maxPalabras; if(maxCPalabras>=0){ ListaABC = new Lista(); RankinPalabras = new Lista(); /** * Las otras estructuras de tipo Arbol ?? */ retorno.resultado = Resultado.OK; }else if(maxCPalabras<1){ destruirSistema(); retorno.resultado = Resultado.ERROR_1; }else{ retorno.resultado = Resultado.NO_IMPLEMENTADA; } return retorno; } public Retorno destruirSistema() { Retorno retorno = new Retorno(); ListaABC = null; RankinPalabras = null; maxCPalabras = 0; retorno.resultado = Resultado.OK; return retorno; } public Retorno analizarTexto(String texto) { Retorno retorno = new Retorno(); //Verifico que el sistema exista if(this.ListaABC==null) { retorno.resultado = Resultado.NO_IMPLEMENTADA; } else if(texto.length()==0) { //Verifico que el texto no sea vacio retorno.resultado = Resultado.ERROR_1; } else { int insertarOK = 0; //Convierto el texto en minuscula texto = texto.toLowerCase(); //Parseo el texto String [] palabras = texto.split("[:.,()?¿!¡ ]"); int palabrasProcesar = palabras.length; for(int i=0; i<palabrasProcesar; i++) { insertarOK += ListaABC.insertarElemento(palabras[i]); } if(insertarOK>0) { retorno.resultado =Resultado.ERROR_2; //No se pudo insertar } else { retorno.resultado =Resultado.OK; } } return retorno; } public Retorno rankingPalabras(int n) { // ToDo: Implementar aqui el metodo return new Retorno(Resultado.NO_IMPLEMENTADA); } public Retorno aparicionesPalabra(String palabra) { // ToDo: Implementar aqui el metodo return new Retorno(Resultado.NO_IMPLEMENTADA); } public Retorno todasPalabras() { // ToDo: Implementar aqui el metodo return new Retorno(Resultado.NO_IMPLEMENTADA); } }
ed134f1597b9df5dac6dd9052ce7f4243e805dc3
68ab52f45505af4cf04c0f4112b12a24b085267e
/app/src/main/java/com/example/sub4movieandtv/Model/TVRespon.java
437308eec0e86aef3b6bc43ae36174ea1b5e0d59
[]
no_license
Sukriadi/SUB3MovieAndTV
eff0dadeb0715573f6246f7225acba8ff657a894
3700686a3225bc6c64b1bc690a98f0e74ee84f6b
refs/heads/master
2020-08-16T08:23:31.017120
2019-10-16T07:01:09
2019-10-16T07:01:09
215,479,409
0
1
null
2019-10-29T06:20:43
2019-10-16T07:01:12
Java
UTF-8
Java
false
false
315
java
package com.example.sub4movieandtv.Model; import com.example.sub4movieandtv.TV; import java.util.List; public class TVRespon { private List<TV> results; public List<TV> getResults() { return results; } public void setResults(List<TV> results) { this.results = results; } }
ba71c24253925b116c51bd9ed0115c7ba605b453
5ceb61e17f347ea565e7f9fd58c402e0c4654e64
/app/src/main/java/com/tourwith/koing/CardSlider/ViewUpdater.java
3010692e50ee69d49447ad65474f42041a7a3065
[]
no_license
Lahavas/Koing_Android
053881802de58167d2ae2b11284791ccbede8e1f
8e0af40b83ded8e1eb3439a45fe07c95b7386493
refs/heads/master
2021-09-24T21:56:45.455927
2018-10-15T11:02:36
2018-10-15T11:02:36
106,386,035
3
3
null
2018-02-21T09:12:28
2017-10-10T07:54:40
Java
UTF-8
Java
false
false
545
java
package com.tourwith.koing.CardSlider; import android.support.annotation.Nullable; import android.view.View; /** * Card transformer interface for {@link CardSliderLayoutManager}. */ public abstract class ViewUpdater { protected final CardSliderLayoutManager lm; public ViewUpdater(CardSliderLayoutManager lm) { this.lm = lm; } public void onLayoutManagerInitialized() {} abstract public int getActiveCardPosition(); abstract @Nullable public View getTopView(); abstract public void updateView(); }
5e63d62a68553a903e806b4ddf53718120f2b625
3fbb8ec7036908a06c4c5322cec28df73c4001cc
/src/main/java/challenges/BinarySearch.java
4a51f80fce404b90b2c353513479c56e8a0c2443
[ "MIT" ]
permissive
JessZuchowski/data_structures_algorithms
0faad143c8d2fa305842744120d6fbadb2829bbb
c8db10a50a782f44756b47e6d8a79063957a8494
refs/heads/master
2020-05-14T12:02:27.232711
2019-04-25T04:29:02
2019-04-25T04:29:02
181,787,013
0
0
MIT
2019-06-06T16:40:21
2019-04-17T00:22:22
Java
UTF-8
Java
false
false
1,209
java
package challenges; public class BinarySearch { public static void main (String[] arg){ //tests System.out.println(binarySearch(new int[] {2, 4, 6, 8, 10}, 7)); binarySearch(new int[] {2, 4, 6, 8, 10}, 7); System.out.println(binarySearch(new int[] {2, 4, 6, 5, 8, 10}, 4)); binarySearch(new int[] {2, 4, 6, 5, 8, 10}, 4); System.out.println(binarySearch(new int[] {2, 4, 6, 5, 8, 10}, 10)); binarySearch(new int[] {2, 4, 6, 5, 8, 10}, 10); } public static int binarySearch(int[] array, int target) { int left = 0; int right = array.length; if (array.length == 0) { return -1; } while (left != right) { int mid = ((left + right) / 2); if (array[mid] == target) { return mid; } else if (array[mid] < target) { left = (int) Math.ceil((float) (left + right) / 2); } if (array[mid] > target) { right = (int) Math.floor((float) (left + right) / 2); } if (array[left] == target) { return left; } } return -1; } }
1172f55ec1f8008c71b2e785bb0827014bf191ed
08f01d27cd085538ecff44e3ea666567ea6c6fa4
/Tema ObjectContainer/src/SortByName.java
8e5d8fd59ac05c0b31ec33ce268b0bf995812b2b
[]
no_license
popaserban53/Teme-Java
1ce20b77d79be852865be8f97a52882466b71ccc
10d496417f310e764140395433e7110f83f4fe90
refs/heads/master
2020-04-06T19:32:08.606698
2018-12-06T18:30:12
2018-12-06T18:30:12
157,740,404
0
1
null
null
null
null
UTF-8
Java
false
false
205
java
import java.util.Comparator; public class SortByName implements Comparator<Person> { @Override public int compare(Person a, Person b) { return a.getName().compareTo(b.getName()); } }
cd77af932b12bcfe85a46c27e51a9d1fbc5d842c
ebd97859d72e81f24914afbc3e0dca82cdb1ff73
/gmall-gateway/src/main/java/com/qinshi/gmall/gateway/config/JwtProperties.java
b36bc06b1eb14a78aac635b4652364a5c5b98cd2
[]
no_license
dageerplus/gmall-2021
5d7c4d4f31218f6f6de1db2b5c4539ef30fd4d4d
389b254c4c2a97c5e098527ae132d96cc0bb5edd
refs/heads/master
2023-03-08T01:48:20.248586
2021-02-05T02:46:42
2021-02-05T02:46:42
334,803,962
0
0
null
null
null
null
UTF-8
Java
false
false
632
java
package com.qinshi.gmall.gateway.config; import com.qinshi.core.utils.RsaUtils; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import javax.annotation.PostConstruct; import java.security.PublicKey; @ConfigurationProperties(prefix = "jwt.token") @Data public class JwtProperties { private String pubKeyPath; private String cookieName; private PublicKey publicKey; @PostConstruct public void init() { try { publicKey = RsaUtils.getPublicKey(pubKeyPath); } catch (Exception e) { e.printStackTrace(); } } }
032a324f924f424250e27a3c240ffa19c6a39e02
602f6f274fe6d1d0827a324ada0438bc0210bc39
/spring-framework/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java
74664a9cca0d77036251d9ce96760fb381ffd9b3
[ "Apache-2.0" ]
permissive
1091643978/spring
c5db27b126261adf256415a0c56c4e7fbea3546e
c832371e96dffe8af4e3dafe9455a409bfefbb1b
refs/heads/master
2020-08-27T04:26:22.672721
2019-10-31T05:31:59
2019-10-31T05:31:59
217,243,879
0
0
Apache-2.0
2019-10-24T07:58:34
2019-10-24T07:58:31
null
UTF-8
Java
false
false
5,642
java
/* * Copyright 2002-2012 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.web.filter; import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import org.springframework.http.HttpInputMessage; import org.springframework.http.MediaType; import org.springframework.http.converter.FormHttpMessageConverter; import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter; import org.springframework.http.server.ServletServerHttpRequest; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; /** * {@link javax.servlet.Filter} that makes form encoded data available through * the {@code ServletRequest.getParameter*()} family of methods during HTTP PUT * or PATCH requests. * * <p>The Servlet spec requires form data to be available for HTTP POST but * not for HTTP PUT or PATCH requests. This filter intercepts HTTP PUT and PATCH * requests where content type is {@code 'application/x-www-form-urlencoded'}, * reads form encoded content from the body of the request, and wraps the ServletRequest * in order to make the form data available as request parameters just like * it is for HTTP POST requests. * * @author Rossen Stoyanchev * @since 3.1 */ public class HttpPutFormContentFilter extends OncePerRequestFilter { private final FormHttpMessageConverter formConverter = new AllEncompassingFormHttpMessageConverter(); /** * The default character set to use for reading form data. */ public void setCharset(Charset charset) { this.formConverter.setCharset(charset); } @Override protected void doFilterInternal(final HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { if (("PUT".equals(request.getMethod()) || "PATCH".equals(request.getMethod())) && isFormContentType(request)) { HttpInputMessage inputMessage = new ServletServerHttpRequest(request) { @Override public InputStream getBody() throws IOException { return request.getInputStream(); } }; MultiValueMap<String, String> formParameters = formConverter.read(null, inputMessage); HttpServletRequest wrapper = new HttpPutFormContentRequestWrapper(request, formParameters); filterChain.doFilter(wrapper, response); } else { filterChain.doFilter(request, response); } } private boolean isFormContentType(HttpServletRequest request) { String contentType = request.getContentType(); if (contentType != null) { try { MediaType mediaType = MediaType.parseMediaType(contentType); return (MediaType.APPLICATION_FORM_URLENCODED.includes(mediaType)); } catch (IllegalArgumentException ex) { return false; } } else { return false; } } private static class HttpPutFormContentRequestWrapper extends HttpServletRequestWrapper { private MultiValueMap<String, String> formParameters; public HttpPutFormContentRequestWrapper(HttpServletRequest request, MultiValueMap<String, String> parameters) { super(request); this.formParameters = (parameters != null) ? parameters : new LinkedMultiValueMap<String, String>(); } @Override public String getParameter(String name) { String queryStringValue = super.getParameter(name); String formValue = this.formParameters.getFirst(name); return (queryStringValue != null) ? queryStringValue : formValue; } @Override public Map<String, String[]> getParameterMap() { Map<String, String[]> result = new LinkedHashMap<String, String[]>(); Enumeration<String> names = this.getParameterNames(); while (names.hasMoreElements()) { String name = names.nextElement(); result.put(name, this.getParameterValues(name)); } return result; } @Override public Enumeration<String> getParameterNames() { Set<String> names = new LinkedHashSet<String>(); names.addAll(Collections.list(super.getParameterNames())); names.addAll(this.formParameters.keySet()); return Collections.enumeration(names); } @Override public String[] getParameterValues(String name) { String[] queryStringValues = super.getParameterValues(name); List<String> formValues = this.formParameters.get(name); if (formValues == null) { return queryStringValues; } else if (queryStringValues == null) { return formValues.toArray(new String[formValues.size()]); } else { List<String> result = new ArrayList<String>(); result.addAll(Arrays.asList(queryStringValues)); result.addAll(formValues); return result.toArray(new String[result.size()]); } } } }
d6d7e5215cb0f4b334de38024d16c663a8d83041
bb7698f407e2d1ef029d72d021325a9093447b77
/Back/domain/model/src/main/java/co/com/sofka/model/consulta/entity/usuario/Usuario.java
2f8321d1d8fac94804b5ceadfe48304322d18ca6
[]
no_license
juank9225/AtencionPokemonBackend
948580ff5a803655322e0c56da65eda6b8b8bc12
8e7c94cc30683fce14daee5e60aadda495895776
refs/heads/main
2023-06-20T22:31:30.335847
2021-08-02T23:37:16
2021-08-02T23:37:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,220
java
package co.com.sofka.model.consulta.entity.usuario; import co.com.sofka.model.consulta.values.valueobjectuser.*; import lombok.Builder; import lombok.Data; @Data @Builder(toBuilder = true) public class Usuario { private String id; private Identificacion identificacion; private Nombre nombre; private Apellido apellido; private Telefono telefono; private Profesion profesion; private Correo correo; public Usuario() { } public Usuario(String id,Identificacion identificacion,Nombre nombre, Apellido apellido, Telefono telefono, Profesion profesion, Correo correo) { this.id = id; this.identificacion = identificacion; this.nombre = nombre; this.apellido = apellido; this.telefono = telefono; this.profesion = profesion; this.correo = correo; } public Usuario(Nombre nombre, Apellido apellido, Telefono telefono, Profesion profesion, Correo correo) { this.nombre = nombre; this.apellido = apellido; this.telefono = telefono; this.profesion = profesion; this.correo = correo; } public String getId() { return id; } public void setId(String id) { this.id = id; } public Identificacion getIdentificacion() { return identificacion; } public void setIdentificacion(Identificacion identificacion) { this.identificacion = identificacion; } public Nombre getNombre() { return nombre; } public void setNombre(Nombre nombre) { this.nombre = nombre; } public Apellido getApellido() { return apellido; } public void setApellido(Apellido apellido) { this.apellido = apellido; } public Telefono getTelefono() { return telefono; } public void setTelefono(Telefono telefono) { this.telefono = telefono; } public Profesion getProfesion() { return profesion; } public void setProfesion(Profesion profesion) { this.profesion = profesion; } public Correo getCorreo() { return correo; } public void setCorreo(Correo correo) { this.correo = correo; } }
bc9f3affaba7f270ae608bffacf58f459bc6ee27
666a8c16ba6a82cfcbfe41286577cc1b5b17da34
/src/main/java/com/augustsextus/gunmod/GunModClient.java
234b4d61c0f86cabf4a3bab1f41f47fff9e36390
[ "CC0-1.0" ]
permissive
PerryThe-Platypus/Gun-mod
789e08ec30dae73bd480190e3195ab4b329ba0ce
06acb41755c84270cdbb5301c53c5ac35d68ceaa
refs/heads/main
2023-07-24T02:21:27.979250
2021-09-02T06:38:29
2021-09-02T06:38:29
401,966,800
0
0
CC0-1.0
2021-09-02T06:31:32
2021-09-01T07:12:18
Java
UTF-8
Java
false
false
4,105
java
package com.augustsextus.gunmod; import com.augustsextus.gunmod.items.Gun; import com.augustsextus.gunmod.mixin.TickMixin; import com.augustsextus.gunmod.registry.EntityRegistry; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.entity.FlyingItemEntityRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.util.Identifier; import net.minecraft.util.math.Vec3d; import net.minecraft.util.registry.Registry; import java.util.UUID; public class GunModClient implements ClientModInitializer { public static final Identifier PacketID = new Identifier(GunMod.MOD_ID, "spawn_packet");//identifier //some zoom variables private static Boolean currentlyZoomed; private static Boolean originalSmoothCameraEnabled; private static final MinecraftClient mc = MinecraftClient.getInstance(); public static double zoomLevel = 0; @Override public void onInitializeClient() { //Entity packet / render EntityRendererRegistry.INSTANCE.register(EntityRegistry.BulletEntityType, (dispatcher, context) -> new FlyingItemEntityRenderer(dispatcher, context.getItemRenderer())); receiveEntityPacket(); currentlyZoomed = false; originalSmoothCameraEnabled = false; } public void receiveEntityPacket() { ClientSidePacketRegistry.INSTANCE.register(PacketID, (ctx, byteBuf) -> { EntityType<?> et = Registry.ENTITY_TYPE.get(byteBuf.readVarInt()); UUID uuid = byteBuf.readUuid(); int entityId = byteBuf.readVarInt(); Vec3d pos = EntitySpawnPacket.PacketBufUtil.readVec3d(byteBuf); float pitch = EntitySpawnPacket.PacketBufUtil.readAngle(byteBuf); float yaw = EntitySpawnPacket.PacketBufUtil.readAngle(byteBuf); ctx.getTaskQueue().execute(() -> { if (MinecraftClient.getInstance().world == null) throw new IllegalStateException("Tried to spawn entity in a null world!"); Entity e = et.create(MinecraftClient.getInstance().world); if (e == null) throw new IllegalStateException("Failed to create instance of entity \"" + Registry.ENTITY_TYPE.getId(et) + "\"!"); e.updateTrackedPosition(pos); e.setPos(pos.x, pos.y, pos.z); e.pitch = pitch; e.yaw = yaw; e.setEntityId(entityId); e.setUuid(uuid); MinecraftClient.getInstance().world.addEntity(entityId, e); }); }); } //some more zoom stuff public static Boolean isZooming() { return Gun.getIsScoping(); } public static void manageSmoothCamera() { if (zoomStarting()) { zoomStarted(); enableSmoothCamera(); } if (zoomStopping()) { zoomStopped(); resetSmoothCamera(); } } private static Boolean isSmoothCamera() { return mc.options.smoothCameraEnabled; } private static void enableSmoothCamera() { mc.options.smoothCameraEnabled = true; } private static void disableSmoothCamera() { mc.options.smoothCameraEnabled = false; } private static boolean zoomStarting() { return isZooming() && !currentlyZoomed; } private static boolean zoomStopping() { return !isZooming() && currentlyZoomed; } private static void zoomStarted() { originalSmoothCameraEnabled = isSmoothCamera(); currentlyZoomed = true; } private static void zoomStopped() { currentlyZoomed = false; } private static void resetSmoothCamera() { if (originalSmoothCameraEnabled) { enableSmoothCamera(); } else { disableSmoothCamera(); } } }
d9ab524a1a80c8c7c68ed8fc23b6e4e7dc08aa3c
8f59976fbb890043823a57ec53ddeeaaff233313
/src/java/grafociclotour/modelo/GrafoAbstract.java
a4b8bd161bd1dabb3b1899aae1e409d68bf0dee0
[]
no_license
santbetv/GrafoCicloTour_Java_EE_Grafo_Algoritmo_de_Dijkstra
d76b7444f92ce8623a83b47480e44e0a6198a04c
016acf31e9ff5cd309671df0b3fa6289d8005cbd
refs/heads/master
2023-01-12T04:40:25.099241
2018-10-21T03:28:21
2018-10-21T03:28:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,285
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 grafociclotour.modelo; import grafociclotour.excepciones.GrafoExcepcion; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * Clase que ayuda en la herencia de datos obteniendo de esta todos los verices * y aristas * * @author Carlos loaiza * @author Santiago Betancur * @Version V.8 */ public abstract class GrafoAbstract implements Serializable { /** * Atributos principales que crear una lista de verices y aristas */ private List<Vertice> vertices; private List<Arista> aristas; public GrafoAbstract() { vertices = new ArrayList<>(); aristas = new ArrayList<>(); } public List<Vertice> getVertices() { return vertices; } public void setVertices(List<Vertice> vertices) { this.vertices = vertices; } public List<Arista> getAristas() { return aristas; } public void setAristas(List<Arista> aristas) { this.aristas = aristas; } public void adicionarVertice(Vertice vertice) { vertices.add(vertice); } public void adicionarArista(Arista arista) { aristas.add(arista); } public void removerArista(int origen, int destino) { List<Arista> tem = new ArrayList<>(); for (Arista ar : aristas) { if (!(ar.getOrigen() == origen && ar.getDestino() == destino)) { tem.add(ar); } } aristas = tem; } public abstract void verificarArista(int origen, int destino) throws GrafoExcepcion; public Vertice obtenerVerticexCodigo(int codigo) { for (Vertice vert : vertices) { if (vert.getCodigo() == codigo) { return vert; } } return null; } public void eliminarAristas() { aristas.clear(); } public Vertice obtenerVerticexNombre(String nombre) { for (Vertice vert : vertices) { if (vert.getDato().getNombre().compareTo(nombre) == 0) { return vert; } } return null; } }
47cfbcc23778ecad2af91f1f8bf105bb82dad785
6125ffe2cb03d150f5b876df4916b8bc4f5df204
/weather-app-android/Weatherify/app/src/main/java/com/appolica/weatherify/android/ui/activity/settings/WindSwitchAdapterListener.java
03c656d7630f5ee742f2b9a12792a652b8c0d8fd
[]
no_license
rokn/MiscProgramming
fab619225123f84e978c2a5b628e32f722b00574
d34d3328d807963b035a3b5b1e912b09b4345548
refs/heads/master
2021-01-01T06:01:19.951804
2018-10-08T08:28:58
2018-10-08T08:28:58
97,329,706
0
0
null
null
null
null
UTF-8
Java
false
false
1,593
java
package com.appolica.weatherify.android.ui.activity.settings; import android.content.Context; import com.appolica.weatherify.android.preferences.units.SpeedUnit; import java.util.Arrays; /** * Created by Bogomil Kolarov on 03.11.16. * Copyright © 2016 Appolica. All rights reserved. */ public class WindSwitchAdapterListener extends BaseToggleSwitchAdapterListener<SpeedUnit> implements BaseToggleSwitchAdapterListener.OnAdaptedToggleSwitchListener<SpeedUnit> { private Context context; private OnWindSwitchListener switchListener; public WindSwitchAdapterListener(Context context) { super(Arrays.asList(SpeedUnit.values())); this.context = context; setToggleListener(this); } public WindSwitchAdapterListener(Context context, OnWindSwitchListener switchListener) { this(context); this.switchListener = switchListener; } @Override public String getLabelForToggleType(SpeedUnit speedUnit, int position) { return context.getString(speedUnit.getUnitResourceId()); } @Override public void onToggleSelected(SpeedUnit windUnit) { if (switchListener != null) { switchListener.onWindUnitSelected(windUnit); } } @Override public void onToggleDeselected(SpeedUnit windUnit) { // do nothing } public void setSwitchListener(OnWindSwitchListener switchListener) { this.switchListener = switchListener; } public interface OnWindSwitchListener { void onWindUnitSelected(SpeedUnit windUnit); } }
e4f9b19336f8b341075bc57f922e14cb8baccfde
12ffabfded16148972f00085004250e3c00d74e3
/decoding.java
9e71cf1ada986c56cdd885ca57ab243f023d9cdc
[]
no_license
KundellaRamana/LZW
f4b2aa954ae763c36c6885076e21188c7abc0ac2
0e83075f8d587664bf9c6c735516405572b5f80b
refs/heads/master
2021-01-11T11:19:30.545050
2017-01-11T06:55:41
2017-01-11T06:55:41
78,611,428
0
0
null
null
null
null
UTF-8
Java
false
false
2,741
java
import java.util.*; import java.io.*; public class HelloWorld { public static void main(String []args) throws Exception{ int HVALUE = 27,l=0,m=0,z=0,g=0,i=0,j=0,k,c=0,p=2,alt=0; String st; // File file = new File("D:\\testing2.txt"); // file.createNewFile(); BufferedReader br; BufferedWriter writer; br = new BufferedReader(new FileReader("D:\\testing.txt")); writer = new BufferedWriter(new FileWriter("D:\\testing2.txt")); while ((st = br.readLine()) != null) { System.out.println(st); word[] w = new word[20]; k=j+1; for(j=0;j<20;j+=(p-1)) { w[j] = new word(); //reading values to objects of word. w[j].s = st.substring(j,j+2); } p=2; do { for(j=2;j<20;j+=(p-1)) { for(i=0;i<j;i++) // checks for repetition in the assigned dictionary { if((w[i].s).equals(w[j].s)) // condition succeeds if repetition occurs { w[j].s = st.substring(j+g,j+(p+1+g)); // assigns new value for repetition w[j].value = HVALUE; m = j+1; l=j+p+g; for(z=(j+1);z<20;z++) { w[z].s=st.substring(l,l+2); // assigns new value to the right of repetition l++; } g++; } } } p++; }while(p<5); for(j=0;j<20;j++) { System.out.println(""); System.out.print(w[j].s); System.out.print(" "); w[j].value=HVALUE; // assigns numerical value to objects System.out.println(w[j].value); writer.write(w[j].s+" "+w[j].value); writer.newLine(); HVALUE++; } writer.write(w[0].s.substring(0,1)); for(i=0;i<20;i++) { writer.write(w[i].s.substring(1,w[i].s.length())); System.out.print(w[i].s.substring(1,w[i].s.length())); alt++; if(alt==2) { alt = 0; } } } writer.close(); } } class word{ String s = new String(); int value; }
09d35a8c4c876dc7b357f06b29377469f7978091
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Chart/4/org/jfree/data/category/DefaultCategoryDataset_addValue_235.java
b7238a7136516cae04a0cc447cf4173b180b5679
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
795
java
org jfree data categori implement link categori dataset categorydataset default categori dataset defaultcategorydataset abstract dataset abstractdataset add tabl param param row kei rowkei row kei param column kei columnkei column kei getvalu compar compar add addvalu compar row kei rowkei compar column kei columnkei add addvalu doubl row kei rowkei column kei columnkei
13d270f24f7ab22b49655d8696932fa78e8af154
ca0fabe6f1f48281951796e715329d9e87c0ff8c
/com.icteam.loyalty.common/src/com/icteam/loyalty/common/model/Operator.java
a5827617b392dd3c692d1f0c335541bf769f9e68
[]
no_license
Danipiario/com.icteam.loyalty
11ed58d3764798528c6949f51c3babaea087438f
f2bb4fb0e01552b336bcf860dd111862d8727316
refs/heads/master
2020-04-12T06:43:13.519169
2016-10-01T19:52:05
2016-10-01T19:52:05
60,277,192
0
0
null
null
null
null
UTF-8
Java
false
false
2,803
java
package com.icteam.loyalty.common.model; import static com.querydsl.core.types.PathMetadataFactory.forVariable; import java.sql.Types; import javax.annotation.Generated; import com.querydsl.core.types.Path; import com.querydsl.core.types.PathMetadata; import com.querydsl.core.types.dsl.NumberPath; import com.querydsl.core.types.dsl.StringPath; import com.querydsl.sql.ColumnMetadata; /** * Operator is a Querydsl query type for Operator */ @Generated("com.querydsl.sql.codegen.MetaDataSerializer") public class Operator extends com.querydsl.sql.RelationalPathBase<Operator> { private static final long serialVersionUID = 731329174; public static final Operator operator = new Operator("OPERATOR"); public final NumberPath<Byte> changePassword = createNumber("changePassword", Byte.class); public final StringPath groups = createString("groups"); public final StringPath language = createString("language"); public final StringPath login = createString("login"); public final StringPath name = createString("name"); public final StringPath password = createString("password"); public final StringPath status = createString("status"); public final StringPath surname = createString("surname"); public final com.querydsl.sql.PrimaryKey<Operator> operatorPk = createPrimaryKey(login); public Operator(String variable) { super(Operator.class, forVariable(variable), "LOYALTY", "OPERATOR"); addMetadata(); } public Operator(String variable, String schema, String table) { super(Operator.class, forVariable(variable), schema, table); addMetadata(); } public Operator(Path<? extends Operator> path) { super(path.getType(), path.getMetadata(), "LOYALTY", "OPERATOR"); addMetadata(); } public Operator(PathMetadata metadata) { super(Operator.class, metadata, "LOYALTY", "OPERATOR"); addMetadata(); } public void addMetadata() { addMetadata(changePassword, ColumnMetadata.named("CHANGE_PASSWORD").withIndex(5).ofType(Types.DECIMAL).withSize(1).notNull()); addMetadata(groups, ColumnMetadata.named("GROUPS").withIndex(6).ofType(Types.VARCHAR).withSize(2000)); addMetadata(language, ColumnMetadata.named("LANGUAGE").withIndex(8).ofType(Types.VARCHAR).withSize(50).notNull()); addMetadata(login, ColumnMetadata.named("LOGIN").withIndex(1).ofType(Types.VARCHAR).withSize(50).notNull()); addMetadata(name, ColumnMetadata.named("NAME").withIndex(2).ofType(Types.VARCHAR).withSize(50).notNull()); addMetadata(password, ColumnMetadata.named("PASSWORD").withIndex(4).ofType(Types.VARCHAR).withSize(50).notNull()); addMetadata(status, ColumnMetadata.named("STATUS").withIndex(7).ofType(Types.VARCHAR).withSize(50)); addMetadata(surname, ColumnMetadata.named("SURNAME").withIndex(3).ofType(Types.VARCHAR).withSize(50).notNull()); } }
786823920510334c0948150f6d0ed9c3fcdacbd1
65d927b9641e3269a6af2c64267a05064c8a6fef
/PizzeriaAdmin/src/fi/omapizzeria/sivusto/bean/Pizza.java
19e81b9d75bd5a646d4c60a80c0d6fc25581b9f7
[]
no_license
redohke/puna
27254411fad7a107bebe4606a9ba01c3d0e23c05
05725b28023191ff5902f06373168fd18383aa3e
refs/heads/master
2021-01-01T19:51:31.517561
2015-01-28T08:38:33
2015-01-28T08:38:33
24,315,849
0
2
null
2014-12-01T12:48:17
2014-09-22T05:47:48
Java
ISO-8859-1
Java
false
false
1,077
java
package fi.omapizzeria.sivusto.bean; import java.util.List; /** * Tämä luokka sisältää Pizza olion tietosisällön. * * @author Aleksi, Joona * */ /** * Pizza.java on Tuote -luokan aliluokka. */ public class Pizza extends Tuote { /** * Juoma.java on Tuote -luokan aliluokka */ private List<Tayte> taytteet; public Pizza(int id, String nimi, double hinta) { super(); this.id = id; this.nimi = nimi; this.hinta = hinta; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNimi() { return nimi; } public void setNimi(String nimi) { this.nimi = nimi; } public double getHinta() { return hinta; } public void setHinta(double hinta) { this.hinta = hinta; } public List<Tayte> getTaytteet() { return taytteet; } public void setTaytteet(List<Tayte> taytteet) { this.taytteet = taytteet; } @Override public String toString() { return id + nimi + hinta + taytteet; } }
d4ab3b1ea6dbf81d2d696a5a093f43aae1618ec8
9cd0ee3863fd6b93d359f34c04ae7fb3c35e5228
/src/main/java/com/anggaari/errorhandling/simpleerror/Main.java
d285fa70fcc2553a3824f4584e8b9faa77f38d78
[]
no_license
anggadarkprince/java-retrofit2
91ceb8ff8f4545cbb8b0c9ac875298ad8db163c1
b7fd33013409cf2d80fb4fef21a0bdc27ba549f0
refs/heads/main
2023-07-01T08:44:45.647767
2021-08-06T07:41:37
2021-08-06T07:41:37
389,013,974
0
0
null
null
null
null
UTF-8
Java
false
false
1,583
java
package com.anggaari.errorhandling.simpleerror; import com.anggaari.basic.sustainableclient.ServiceGenerator; import com.anggaari.request.synchasync.TaskService; import com.anggaari.request.synchasync.Todo; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class Main { public static void main(String[] args) { // { // statusCode: 409, // message: "Email address already registered" // } TaskService taskService = ServiceGenerator.createService(TaskService.class); Todo todo = new Todo(1, 1, "Buy a cup of coffee", false); Call<Todo> call = taskService.createTodo(todo); call.enqueue(new Callback<Todo>() { @Override public void onResponse(Call<Todo> call, Response<Todo> response) { if (response.isSuccessful()) { // use response data and do some fancy stuff :) Todo todo = response.body(); System.out.println(todo.title); } else { // parse the response body … APIError error = ErrorUtils.parseError(response); // … and use it to show error information // … or just log the issue like we’re doing :) System.out.println(error.message()); } } @Override public void onFailure(Call<Todo> call, Throwable t) { System.out.println(t.getMessage()); } }); } }
fdd656d2eb8014b0566ddae5a3fee99993e9e798
cad4f947dbb6f1ef7f6d531aaf725ec4b8c7986e
/arcusApp/app/src/main/java/arcus/app/subsystems/history/controllers/HistoryCardController.java
d977aec9a69763aacb3a872a55aa9f7fb996c01d
[ "Apache-2.0" ]
permissive
pupper68k/arcusandroid
324e3abbd2f3e789431c7dcac1d495c262702179
50e0a6d71609bf404353da80d8e620584cc818d3
refs/heads/master
2020-07-28T17:23:04.035283
2019-02-28T17:52:25
2019-02-28T17:52:25
209,477,977
0
0
Apache-2.0
2019-09-19T06:24:01
2019-09-19T06:24:00
null
UTF-8
Java
false
false
3,155
java
/* * Copyright 2019 Arcus Project. * * 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 arcus.app.subsystems.history.controllers; import android.content.Context; import android.support.annotation.NonNull; import com.dexafree.materialList.events.BusProvider; import arcus.cornea.SessionController; import arcus.cornea.dto.HistoryLogEntries; import arcus.cornea.utils.Listeners; import com.iris.client.event.Listener; import com.iris.client.model.PlaceModel; import arcus.app.common.cards.SimpleDividerCard; import arcus.app.common.controller.AbstractCardController; import arcus.app.common.utils.GlobalSetting; import arcus.app.subsystems.history.cards.HistoryCard; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HistoryCardController extends AbstractCardController<SimpleDividerCard> { private final static Logger logger = LoggerFactory.getLogger(HistoryCardController.class); private HistoryLogEntries historyLogEntries; private Callback callback; public interface Callback { void updateHistory(); } public HistoryCardController (Context context, Callback callback) { super(context); this.callback = callback; setCurrentCard(new HistoryCard(getContext(), historyLogEntries)); } @NonNull @Override public SimpleDividerCard getCard() { return getCurrentCard(); } public void updateHistoryLogEntries() { PlaceModel placeModel = SessionController.instance().getPlace(); if (placeModel == null) { return; } HistoryLogEntries .forDashboard(placeModel, GlobalSetting.HISTORY_LOG_ENTRIES_DASH, null) .onSuccess(Listeners.runOnUiThread(new Listener<HistoryLogEntries>() { @Override public void onEvent(HistoryLogEntries entries) { historyLogEntries = entries; fireHistoryLogEntryChangedEvent(); } })) .onFailure(Listeners.runOnUiThread(new Listener<Throwable>() { @Override public void onEvent(Throwable throwable) { historyLogEntries = HistoryLogEntries.empty(); fireHistoryLogEntryChangedEvent(); } })); } private void fireHistoryLogEntryChangedEvent() { logger.debug("Loaded [{}] entries.", historyLogEntries.getEntries().size()); ((HistoryCard)getCurrentCard()).setEntries(historyLogEntries); BusProvider.dataSetChanged(); if(callback != null) { callback.updateHistory(); } } }
3fcc6cc240f5172f32418d92837bb1c11a171777
80bdcfb44ccee219ac85bd4027c256082f3bbcd9
/Baskel/src/GestionCategories/ShowCategoryController.java
42ba3c2e1114c8cfa6df0d811a546a102e1ab315
[]
no_license
01Skymoon01/Baskel_PIDev
dd1c7f39737635e59e56a0014988d11524521664
a3cfeb5182f0aa939b605cd1192f41ed63e01219
refs/heads/master
2022-10-19T02:49:42.342385
2020-06-10T03:23:44
2020-06-10T03:23:44
270,865,694
0
0
null
null
null
null
UTF-8
Java
false
false
6,966
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 GestionCategories; import Entite.Categories; import Entite.Produits; import ServiceProduits.ServiceProduits; import java.io.IOException; import java.net.URL; import java.sql.SQLException; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import javafx.collections.transformation.SortedList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; 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.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.stage.Stage; /** * * @author Ery's Desktop */ public class ShowCategoryController implements Initializable { @FXML private TableView <Categories> tableCategorie; @FXML private TableColumn <Categories,Integer> ref_c; @FXML private TableColumn <Categories,String> libelle; @FXML private TextField textUpdate; ObservableList<Categories> arr ; @FXML private AnchorPane rootPane; @FXML private Button btnOverview; @FXML private Button btnOrders; @FXML private Button btnCustomers; @FXML private Button btnCustomers1; @FXML private Button btnMenus; @FXML private Button btnPackages; @FXML private Button btnCat; @FXML private Button btnSettings; @FXML private Button btnSignout; @FXML private Pane pnlCustomer; @FXML private Pane pnlOrders; @FXML private Pane pnlMenus; @FXML private Pane showcatpanel; @FXML private Button btnRemove; @FXML private Button updateBtn; @FXML private Button btnAddCat; @FXML public void AddCategory(ActionEvent event) throws IOException { //System.out.println("You clicked me!"); Parent home_page_parent = FXMLLoader.load(getClass().getResource("addCategory.fxml")); Scene home_page_scene = new Scene(home_page_parent); Stage app_stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); app_stage.setScene(home_page_scene); app_stage.show(); } public void ShowCat() { ServiceProduits sp = new ServiceProduits(); try { arr = sp.ShowCategories(); } catch (SQLException ex) { Logger.getLogger(ShowCategoryController.class.getName()).log(Level.SEVERE, null, ex); } ref_c.setCellValueFactory(new PropertyValueFactory<>("ref_c")); libelle.setCellValueFactory(new PropertyValueFactory<>("libelle")); tableCategorie.setItems(arr); } @FXML private void removeCat(ActionEvent event) { ServiceProduits sp = new ServiceProduits(); sp.supprimerProduit2(tableCategorie.getSelectionModel().getSelectedItem().getRef_c()); sp.SupprimerCategorie(tableCategorie.getSelectionModel().getSelectedItem().getRef_c()); tableCategorie.getItems().clear(); try { tableCategorie.setItems(sp.ShowCategories()); } catch (SQLException ex) { Logger.getLogger(ShowCategoryController.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("deleted"); } @Override public void initialize(URL location, ResourceBundle resources) { ServiceProduits sp = new ServiceProduits(); try { arr = sp.ShowCategories(); } catch (SQLException ex) { Logger.getLogger(ShowCategoryController.class.getName()).log(Level.SEVERE, null, ex); } ref_c.setCellValueFactory(new PropertyValueFactory<>("ref_c")); libelle.setCellValueFactory(new PropertyValueFactory<>("libelle")); tableCategorie.setItems(arr); FilteredList<Categories> filteredData = new FilteredList<>(arr, b -> true); textUpdate.textProperty().addListener((observable, oldValue, newValue)->{ filteredData.setPredicate(p->{ if (newValue == null || newValue.isEmpty()) { return true; } String lowerCaseFilter = newValue.toLowerCase(); if (p.getLibelle().toLowerCase().contains(lowerCaseFilter) ) { return true; } else if (String.valueOf(p.getRef_c()).contains(lowerCaseFilter)){ System.out.println(p.getRef_c()); return true; } else return false; }); }); SortedList<Categories> sortedData = new SortedList<>(filteredData); sortedData.comparatorProperty().bind(tableCategorie.comparatorProperty()); tableCategorie.setItems(sortedData); } @FXML private void updateCat(ActionEvent event) { ServiceProduits sp = new ServiceProduits(); Categories cr= tableCategorie.getSelectionModel().getSelectedItem(); //String libelleText=cr.getLibelle(); //TextField textUpdate; //textUpdate.setText(libelleText); if (textUpdate.getText() != null) { sp.modifierContrat(textUpdate.getText(),cr.getRef_c()); } tableCategorie.getItems().clear(); try { tableCategorie.setItems(sp.ShowCategories()); } catch (SQLException ex) { Logger.getLogger(ShowCategoryController.class.getName()).log(Level.SEVERE, null, ex); } } @FXML private void ShowProd(ActionEvent event) { FXMLLoader loader = new FXMLLoader (getClass() .getResource("../GestionProduits/showProduct.fxml")); try { Parent root = loader.load(); loader.getController(); textUpdate.getScene().setRoot(root); } catch (IOException ex) { System.out.println(ex.getMessage()); } } }
b326645affb56ae92ab731d69bedddb2ef32deda
954bd8c43237b879fdd659a0f4c207a6ec0da7ea
/java.labs/jdnc-trunk/src/ovisvana/demo/SimpleTreeModel.java
3646c5acfca83e66308b77eb4d3b9b2f54f451f0
[]
no_license
bothmagic/marxenter-labs
5e85921ae5b964b9cd58c98602a0faf85be4264e
cf1040e4de8cf4fd13b95470d6846196e1c73ff4
refs/heads/master
2021-01-10T14:15:31.594790
2013-12-20T11:22:53
2013-12-20T11:22:53
46,557,821
2
0
null
null
null
null
UTF-8
Java
false
false
18,111
java
package demo; import com.exalto.TreeTableModel; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Element; /* For creating a TreeModel */ import javax.swing.tree.*; import javax.swing.event.*; import java.util.*; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import com.exalto.ExaltoXmlNode; //import parser.SimplelangParser; //import parser.SimpleNode; /* This adapter converts the current Document (a DOM) into // a JTree model. */ public class SimpleTreeModel extends DefaultTreeModel implements XmlTreeModel { static protected String[] cNames = {"Name", "Text", "book", "note", "pen", "paper", "pad", "clip", "marker", "sketch", "post", "label", "scissor", "eraser", "sharpener"}; /* static protected String[] cNames = null; */ /* Types of the columns. */ static protected Class[] cTypes = {TreeTableModel.class, String.class}; /* An array of names for DOM node-types // (Array indexes = nodeType() values.) */ int depth = 0; final int MAPCOLNUM = 1; Hashtable nodeMapTbl = new Hashtable(); ArrayList nodeList = new ArrayList(); Vector nodeMapVec = new Vector(); int currRow = 0; int maxCol = 0; int rowId = 0; ArrayList parentList = new ArrayList(); ExaltoXmlNode top = null; boolean isRootVisible; HashMap rowMapper = new HashMap(); HashMap columnMapping = null; Element root; Document document; public SimpleTreeModel(ExaltoXmlNode rootNode, org.w3c.dom.Document doc, boolean isRootVisible) { super(rootNode); this.isRootVisible = isRootVisible; root = doc.getDocumentElement(); this.document = (org.w3c.dom.Document) doc; if(isRootVisible) top = createTreeNode(document); else top = createTreeNode(root); buildColumnMapping(top, 0, "main"); Iterator iter = nodeMapTbl.keySet().iterator(); int x = 0; int y = 0; while(iter.hasNext()) { StringBuffer sbuf = new StringBuffer(); ExaltoXmlNode aptr = (ExaltoXmlNode) iter.next(); String rc = (String) nodeMapTbl.get(aptr); int n = parentList.size(); parentList.add(aptr); String [] rowCol = rc.split(","); int nrow = Integer.parseInt(rowCol[0]); ArrayList nlist = (ArrayList) rowMapper.get(new Integer(nrow)); if(nlist != null) { sbuf.append((String) nlist.get(0)); sbuf.append("|"); sbuf.append(rc); sbuf.append(","); sbuf.append(y++); nlist.set(0, sbuf.toString()); rowMapper.put(new Integer(nrow), nlist); } else { nlist = new ArrayList(); sbuf.append(rc); sbuf.append(","); sbuf.append(y++); nlist.add(sbuf.toString()); rowMapper.put(new Integer(nrow), nlist); StringBuffer strBuf = new StringBuffer(); strBuf.append(rc); strBuf.append(","); strBuf.append(x++); nodeList.add(strBuf.toString()); } } System.out.println(" rowMapper = " + rowMapper); for(int r=0;r<parentList.size();r++) System.out.println(" parentList[" + r + "]=" + parentList.get(r)); } /* Basic TreeModel operations */ public Object getRoot() { return top; } public boolean isLeaf(Object aNode) { /* Determines whether the icon shows up to the left. // Return true for any node with no children */ ExaltoXmlNode viewNode = (ExaltoXmlNode) aNode; if(viewNode.getChildCount() > 0) return false; return true; } public int getColumnCount() { return maxCol; } public String getColumnName(int ci) { /* if(cNames == null) { cNames = new String[maxCol]; } return cNames[0]; */ // return cNames[ci]; return null; } /** * Returns the value to be displayed for node <code>node</code>, * at column number <code>column</code>. */ public Object getValueAt(Object node, int column) { return null; } /** * getValueAt overloaded method * Takes 3 params * @node * @row * @col */ public Object getValueAt(Object node, int row, int column) { String nodeLabel = ""; /* String rc = (String) nodeList.get(row); System.out.println("In GVA 3 arg "); */ ArrayList nlist = (ArrayList) rowMapper.get(new Integer(row)); String rowcol = (String) nlist.get(0); String [][] parts = null; StringTokenizer stok2 = new StringTokenizer(rowcol, "|"); int num = stok2.countTokens(); parts = new String[num][3]; int ct=0; while(stok2.hasMoreTokens()) { String rwc = stok2.nextToken(); StringTokenizer stok3 = new StringTokenizer(rwc, ","); parts[ct][0] = stok3.nextToken(); parts[ct][1] = stok3.nextToken(); parts[ct++][2] = stok3.nextToken(); } /* System.out.println("input rw = " + row); // System.out.println("input col = " + column); */ for(int t=0;t<ct;t++) { Arrays.sort(parts, new GridHelper.ColumnComparator()); /* System.out.println(" parts[t][0] = " + parts[t][0]); // System.out.println(" parts[t][1] = " + parts[t][1]); // System.out.println(" parts[t][2] = " + parts[t][2]); */ int rw = Integer.parseInt(parts[t][0]); int col = Integer.parseInt(parts[t][1]); int px = Integer.parseInt(parts[t][2]); /* System.out.println("in gva3 rw = " + rw); // System.out.println("in gva3 col = " + col); */ ExaltoXmlNode viewerNode = ((ExaltoXmlNode) parentList.get(px)); if(row == rw) { if(column == col) { /* System.out.println(" gva3 row = " + row); // System.out.println(" gva3 col = " + col); // System.out.println("in gva3 nodetype = " + viewerNode.getNodeType()); */ if(viewerNode.getNodeType() == 2) { StringBuffer sbuf = new StringBuffer(); Node domNode = viewerNode.getXmlNode(); sbuf.append(domNode.getNodeName()); sbuf.append("="); sbuf.append(domNode.getNodeValue()); nodeLabel = sbuf.toString(); } else if(viewerNode.getNodeType() == 3 || viewerNode.getNodeType() == 8) { Node domNode = viewerNode.getXmlNode(); nodeLabel = domNode.getNodeValue(); } else if(viewerNode.getNodeType() == 1) nodeLabel = viewerNode.toString(); else if(viewerNode.getNodeType() == 9) { nodeLabel = viewerNode.toString(); } /* System.out.println("In rowcol eq returning " + nodeLabel); */ return nodeLabel; } else { /* System.out.println("In rowcol else "); */ nodeLabel = ""; } } else { /* System.out.println("in gva ret string "); */ nodeLabel = ""; } } /* end for(t<ct); */ /* System.out.println("in gva3 nodeLabel = " + nodeLabel); */ return nodeLabel; } /** * Indicates whether the the value for node <code>node</code>, * at column number <code>column</code> is editable. */ public boolean isCellEditable(Object node, int row, int column) { ExaltoXmlNode xmlNode = null; if(node instanceof ExaltoXmlNode) { xmlNode = (ExaltoXmlNode) node; /* if(xmlNode.getNodeType() != ELEMENT_TYPE && xmlNode.getNodeType() != DOCUMENT_TYPE) */ return true; } return false; } /** * Indicates whether the the value for node <code>node</code>, * at column number <code>column</code> is editable. */ //CAUTION public boolean isCellEditable(Object node, int column) { return false; } /** * Sets the value for node <code>node</code>, * at column number <code>column</code>. */ public void setValueAt(Object aValue, Object node, int column) { } public int getChildCount(Object parent) { ExaltoXmlNode node = (ExaltoXmlNode) parent; return node.getChildCount(); } public int getElementChildCount(Object parent) { ExaltoXmlNode node = (ExaltoXmlNode) parent; org.w3c.dom.Node domNode = node.getXmlNode(); org.w3c.dom.NodeList nlist = domNode.getChildNodes(); int count = 0; for(int k=0;k<nlist.getLength();k++) { if( nlist.item(k).getNodeType() == Node.ELEMENT_NODE) count++; } return count; } public Object getChild(Object parent, int index) { ExaltoXmlNode node = (ExaltoXmlNode) parent; return node.getChildAt(index); } public int getIndexOfChild(Object parent, Object child) { ExaltoXmlNode node = (ExaltoXmlNode) parent; return node.getIndex((ExaltoXmlNode) child); } public void valueForPathChanged(TreePath path, Object newValue) { /* Null. We won't be making changes in the GUI // If we did, we would ensure the new value was really new, // adjust the model, and then fire a TreeNodesChanged event. */ } /* * Use these methods to add and remove event listeners. * (Needed to satisfy TreeModel interface, but not used.) */ private Vector listenerList = new Vector(); public void addTreeModelListener(TreeModelListener listener) { if ( listener != null && ! listenerList.contains( listener ) ) { listenerList.addElement( listener ); } } public void removeTreeModelListener(TreeModelListener listener) { if ( listener != null ) { listenerList.removeElement( listener ); } } /* Note: Since XML works with 1.1, this example uses Vector. // If coding for 1.2 or later, though, I'd use this instead: // private List listenerList = new LinkedList(); // The operations on the List are then add(), remove() and // iteration, via: // Iterator it = listenerList.iterator(); // while ( it.hasNext() ) { // TreeModelListener listener = (TreeModelListener) it.next(); // ... // } */ /* * Invoke these methods to inform listeners of changes. * (Not needed for this example.) * Methods taken from TreeModelSupport class described at * http://java.sun.com/products/jfc/tsc/articles/jtree/index.html * That architecture (produced by Tom Santos and Steve Wilson) * is more elegant. I just hacked 'em in here so they are * immediately at hand. */ public void fireTreeNodesChanged( TreeModelEvent e ) { Enumeration listeners = listenerList.elements(); while ( listeners.hasMoreElements() ) { TreeModelListener listener = (TreeModelListener) listeners.nextElement(); listener.treeNodesChanged( e ); } } public void fireTreeNodesInserted( TreeModelEvent e ) { Enumeration listeners = listenerList.elements(); while ( listeners.hasMoreElements() ) { TreeModelListener listener = (TreeModelListener) listeners.nextElement(); listener.treeNodesInserted( e ); } } public void fireTreeNodesRemoved( TreeModelEvent e ) { Enumeration listeners = listenerList.elements(); while ( listeners.hasMoreElements() ) { TreeModelListener listener = (TreeModelListener) listeners.nextElement(); listener.treeNodesRemoved( e ); } } public void fireTreeStructureChanged(TreeModelEvent e ) { Enumeration listeners = listenerList.elements(); while ( listeners.hasMoreElements() ) { TreeModelListener listener = (TreeModelListener) listeners.nextElement(); listener.treeStructureChanged( e ); } } public class ColumnComparator implements Comparator { public int compare(Object o1, Object o2) { String [] str1 = (String []) o1; String [] str2 = (String []) o2; int result = 0; /* Sort on first element of each array (last name) */ if ((result = str1[1].compareTo(str2[1])) == 0) { return result; } return result; } } public ArrayList getColumnMappingList() { return nodeList; } public ArrayList getParentList() { return parentList; } public void setColumnMapping(Hashtable nodeMapping) { this.nodeMapTbl = nodeMapping; } public Hashtable getColumnMapping() { return nodeMapTbl; } public void setMaxCol(int mcol) { maxCol = mcol; } public void setNodeList(ArrayList nlist) { nodeList = nlist; } public void setParentList(ArrayList plist) { parentList = plist; } private void buildColumnMapping(ExaltoXmlNode root, int currCol, String src) { nodeMapTbl.put(root, currRow + "," + currCol); SelectiveBreadthFirstEnumeration benumer = new SelectiveBreadthFirstEnumeration(root); while (benumer.hasMoreElements()) { ExaltoXmlNode inode = (ExaltoXmlNode) benumer.nextElement(); if(inode.getNodeType() == Node.ELEMENT_NODE || inode.getNodeType() == Node.DOCUMENT_NODE) { currCol = 0; nodeMapTbl.put(inode, currRow + "," + currCol); Node xmlNode = inode.getXmlNode(); int h = 0; if(inode.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap nmp = xmlNode.getAttributes(); for(;h<nmp.getLength();h++) { Node attr = nmp.item(h); ExaltoXmlNode anode = new ExaltoXmlNode(attr); nodeMapTbl.put(anode, currRow + "," + (currCol+h+1)); } } if(currCol+h+1 > maxCol) maxCol = currCol+h+1; /* OV commented 12/1/2006 2 lines // ExaltoXmlNode txtNode = new ExaltoXmlNode(xmlNode.getFirstChild()); // nodeMapTbl.put(txtNode, currRow + "," + (currCol+h+1)); */ /* OV 26/01/07 if(xmlNode.hasChildNodes()) { NodeList textChilds = xmlNode.getChildNodes(); int w=0; for(int u=0;u<textChilds.getLength();u++) { Node tc = textChilds.item(u); if(tc.getNodeType() == 3) { ExaltoXmlNode txtNode = new ExaltoXmlNode(tc); nodeMapTbl.put(txtNode, currRow + "," + (currCol +h+u+1)); if(currCol+h+u+1 > maxCol) maxCol = currCol+h+u+1; w++; } } } */ currRow++; if(benumer.dequeued) { currCol++; if(currCol > maxCol) maxCol = currCol; } /* System.out.println("for currRow " + currRow); System.out.println("for currCol " + currCol); */ } } } protected ExaltoXmlNode createTreeNode(Node root) { if (!canDisplayNode(root)) return null; ExaltoXmlNode treeNode = new ExaltoXmlNode(root); NodeList list = root.getChildNodes(); for (int k=0; k<list.getLength(); k++) { Node nd = list.item(k); //OV 26/01/07 // if(nd.getNodeType() != 3) { ExaltoXmlNode child = createTreeNode(nd); if (child != null) treeNode.add(child); // } } return treeNode; } protected boolean canDisplayNode(Node node) { switch (node.getNodeType()) { case Node.ELEMENT_NODE: return true; case Node.TEXT_NODE: String text = node.getNodeValue().trim(); return !(text.equals("") || text.equals("\n") || text.equals("\r\n")); case Node.DOCUMENT_NODE: return true; } return false; } public HashMap getRowMapper() { return rowMapper; } public void setRowMapper(HashMap rowMapper) { this.rowMapper = rowMapper; } public Class getColumnClass(int ci) { if(ci == 0) return TreeTableModel.class; return String.class; } public Document getDocument() { return document; } public boolean getRootVisible() { return isRootVisible; } }
[ "markus.taubert@c8aec436-628a-29fb-4c76-4f2700b0ca23" ]
markus.taubert@c8aec436-628a-29fb-4c76-4f2700b0ca23
9845729400c3793f9eda23e0dd94ac5f0774117c
1da8731ee655b548c9fd84010189a279b1e595fe
/app/src/main/java/ch/chupa/sacchetti/myfragmentapp/Controllers/Activities/DetailActivity.java
b26e73a7851bba07b7e9da7751f964a6bc1ab29a
[]
no_license
et-psi/OpenClassRoomsMyFragmentApp
d8a76eb350dc70727cf14925d56965602ad361de
ad3d4a554d0405111972c02f271e8c32efa3baff
refs/heads/master
2021-01-25T13:41:57.448986
2018-03-03T15:21:43
2018-03-03T15:21:43
123,607,522
0
0
null
null
null
null
UTF-8
Java
false
false
2,098
java
package ch.chupa.sacchetti.myfragmentapp.Controllers.Activities; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import ch.chupa.sacchetti.myfragmentapp.Controllers.Fragments.DetailFragment; import ch.chupa.sacchetti.myfragmentapp.R; public class DetailActivity extends AppCompatActivity { public static final String EXTRA_BUTTON_TAG = "ch.chupa.sacchetti.myfragmentapp.Controllers.Activities.DetailActivity.EXTRA_BUTTON_TAG"; private DetailFragment detailFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); // 2 - Configure and show home fragment this.configureAndShowDetailFragment(); } @Override public void onResume() { super.onResume(); // 3 - Call update method here because we are sure that DetailFragment is visible this.updateDetailFragmentTextViewWithIntentTag(); } // -------------- // UPDATE UI // -------------- // 2 - Update DetailFragment with tag passed from Intent private void updateDetailFragmentTextViewWithIntentTag(){ // Get button's tag from intent int buttonTag = getIntent().getIntExtra(EXTRA_BUTTON_TAG, 0); // Update DetailFragment's TextView detailFragment.updateTextView(buttonTag); } // -------------- // FRAGMENTS // -------------- private void configureAndShowDetailFragment(){ // A - Get FragmentManager (Support) and Try to find existing instance of fragment in FrameLayout container detailFragment = (DetailFragment) getSupportFragmentManager().findFragmentById(R.id.frame_layout_detail); if (detailFragment == null) { // B - Create new main fragment detailFragment = new DetailFragment(); // C - Add it to FrameLayout container getSupportFragmentManager().beginTransaction() .add(R.id.frame_layout_detail, detailFragment) .commit(); } } }
8d3448d6b3892415191327da99c0790da3faaef2
5cd1e352400af63dc8d069a69e4d2ac2c4c4872b
/app/src/main/java/com/example/chatappfcm/Activities/Models/Chat.java
867add74994ea60e7a139e97d05b7bfbc7314529
[]
no_license
arslankhalidjanjua/FcmChatAppArslan
fbf461da6205f20c968899c675105da12ebb430d
58593a9d467f9cb1efedcc32bce0e57f5ed200f6
refs/heads/master
2022-12-24T16:14:09.775936
2020-09-25T14:49:37
2020-09-25T14:49:37
298,558,545
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package com.example.chatappfcm.Activities.Models; public class Chat { public String sender; public String reciever; public String message; public Chat() { } public Chat(String sender, String reciever, String message) { this.sender = sender; this.reciever = reciever; this.message = message; } public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public String getReciever() { return reciever; } public void setReciever(String reciever) { this.reciever = reciever; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
78843f8eef7bcb874d82ed974c92eb0290a0bf31
a2e2619c8f3575e5924caa8a2152fe412ced2ebe
/src/main/java/net/crtrpt/c2jvm/Main.java
f0d9767bbc41eaad7b2a2b81195ad215750901a9
[]
no_license
whisper-language/whisper-jvm
58643846984056cda2ac43587c7925caad9aba95
7d2223dfe5df7265799bb6bbe966847417526231
refs/heads/main
2023-05-25T09:38:58.201611
2021-06-02T12:52:41
2021-06-02T12:52:41
368,229,571
3
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package net.crtrpt.c2jvm; import net.crtrpt.gen.TLLexer; import net.crtrpt.gen.TLParser; import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.tree.ParseTree; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] argv) throws IOException { TLLexer lexer = new TLLexer(CharStreams.fromFileName("src/main/resources/test1.pg")); TLParser parser = new TLParser(new CommonTokenStream(lexer)); parser.setBuildParseTree(true); ParseTree tree = parser.parse(); EvalVisitor visitor = new EvalVisitor(); FileInputStream fileInputStream = new FileInputStream("src/main/resources/WhisperClass.class"); ClassReader reader = new ClassReader(fileInputStream); ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS); ClassVisitor cv = new ClassVisitorImpl(writer, visitor, tree); reader.accept(cv, ClassReader.EXPAND_FRAMES); // 获取修改后的 class 文件对应的字节数组 byte[] code = writer.toByteArray(); try { // 将二进制流写到本地磁盘上 FileOutputStream fos = new FileOutputStream("./target/classes/net/WhisperClassIns.class"); fos.write(code); fos.close(); } catch (IOException e) { e.printStackTrace(); } } }
db87023ac2792984852891d1fc4f89d229524e6b
1326913183ba62c5b9564305dbbb5373c5f288fc
/src/com/hankcs/nlp/dependence/CoNll/CoNLLLoader.java
a56cdf890d788b215af5dc411feb15d7c3f4e78b
[ "Apache-2.0" ]
permissive
binzhihao/DeepHanLP
22c5e145570a5fa1968010d551497d48a8d4f97d
b4e16b27679e016490802a5a363fc9afcd24a677
refs/heads/master
2020-03-17T13:52:40.732464
2018-05-16T11:58:43
2018-05-16T11:58:43
133,648,332
0
0
null
null
null
null
UTF-8
Java
false
false
921
java
package com.hankcs.nlp.dependence.CoNll; import com.hankcs.nlp.dependence.io.IOUtil; import java.util.LinkedList; /** * CoNLL是NLP领域著名的评测每年举办NLP领域的赛事。这部分移植用来做一些基准测试。2018.03.01 * CoNLL格式依存语料加载 * * @author hankcs */ public class CoNLLLoader { public static LinkedList<CoNLLSentence> loadSentenceList(String path) { LinkedList<CoNLLSentence> result = new LinkedList<CoNLLSentence>(); LinkedList<CoNllLine> lineList = new LinkedList<CoNllLine>(); for (String line : IOUtil.readLineListWithLessMemory(path)) { if (line.trim().length() == 0) { result.add(new CoNLLSentence(lineList)); lineList = new LinkedList<CoNllLine>(); continue; } lineList.add(new CoNllLine(line.split("\t"))); } return result; } }
dce6314478860f479288ecf3e8bdbfb041df843e
73776c497c7aa03d30e9a9850aebfe6c62893370
/app/src/main/java/com/example/firebasemashaallah/TanamanViewHolder.java
416c4e674b2681d1b8c48b016adc60527164fb7f
[]
no_license
navalinovian/FirebaseMashaAllah
ddb06739f9bf946c276c5f591ba25db74c6985cf
0b51777f011caf3e4caf8a0036676247d8a8f824
refs/heads/master
2020-09-29T20:56:43.626328
2019-12-10T14:28:37
2019-12-10T14:28:37
227,121,180
0
0
null
null
null
null
UTF-8
Java
false
false
979
java
package com.example.firebasemashaallah; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; public class TanamanViewHolder extends RecyclerView.ViewHolder { public TextView tvNama; public TextView tvDeskripsi; public TextView tvWaktu; public ImageView ivGambar; public TanamanViewHolder(@NonNull View itemView) { super(itemView); tvNama = itemView.findViewById(R.id.tv_nama); tvDeskripsi = itemView.findViewById(R.id.tv_deskripsi); tvWaktu = itemView.findViewById(R.id.tv_waktu); ivGambar = itemView.findViewById(R.id.iv_gambar); } public void bindToTanaman(Tanaman tanaman){ tvNama.setText(tanaman.nama); tvDeskripsi.setText(tanaman.deskripsi); tvWaktu.setText(String.valueOf(tanaman.waktu)); // ivGambar.setImageResource(tanaman.gambar); } }
1fe8b72fca5689d48dbfb8a81c1b8faa5d58f45f
d550ee10b64e6502d97a919e46ee5bf367a0940a
/src/java_collections/collections/ArrayListExample2.java
e05d2a78e5e57bb3ef17a2acb16ade1a440b763f
[]
no_license
smaltamash/java-learning-core
93101ffc00c817c12dfbdeda7f679f20742b2a50
37dedeb8d8db74cb271e71d0ee5ed1360b53bbf7
refs/heads/master
2020-04-05T15:18:57.670672
2018-11-10T09:15:11
2018-11-10T09:15:11
156,962,178
3
0
null
null
null
null
UTF-8
Java
false
false
404
java
package java_collections.collections; import java.util.ArrayList; import java.util.Iterator; public class ArrayListExample2 { public static void main(String[] args) { ArrayList<String> list=new ArrayList<String>(); list.add("Ranjana"); list.add("Vineeta"); list.add("Saniya"); list.add("Anjli"); Iterator itr=list.iterator(); for(String obj:list) { System.out.println(obj); } } }
c8981919beabd513a6e28f7ae33c0ba6110c77aa
52280cf6517f27bde1ad70037bc20f9aaa01d6c5
/src/com/google/zxing/common/CharacterSetECI.java
2ee496bc0cf59fb56accfaeb29ebafd51a79bf64
[]
no_license
xiangyong/JDMall
7730ae3395a44d03387f4d4075a1b2c8870c23be
5ce5a7870e87a67cad500903bc169cd266b5a2e9
refs/heads/master
2021-01-16T18:13:41.254336
2014-02-26T09:59:08
2014-02-26T09:59:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,832
java
package com.google.zxing.common; import com.google.zxing.FormatException; import java.util.HashMap; import java.util.Map; public enum CharacterSetECI { private static final Map<String, CharacterSetECI> NAME_TO_ECI; private static final Map<Integer, CharacterSetECI> VALUE_TO_ECI; private final String[] otherEncodingNames; private final int[] values; static { ISO8859_10 = new CharacterSetECI("ISO8859_10", 10, 12, new String[] { "ISO-8859-10" }); ISO8859_11 = new CharacterSetECI("ISO8859_11", 11, 13, new String[] { "ISO-8859-11" }); ISO8859_13 = new CharacterSetECI("ISO8859_13", 12, 15, new String[] { "ISO-8859-13" }); ISO8859_14 = new CharacterSetECI("ISO8859_14", 13, 16, new String[] { "ISO-8859-14" }); ISO8859_15 = new CharacterSetECI("ISO8859_15", 14, 17, new String[] { "ISO-8859-15" }); ISO8859_16 = new CharacterSetECI("ISO8859_16", 15, 18, new String[] { "ISO-8859-16" }); SJIS = new CharacterSetECI("SJIS", 16, 20, new String[] { "Shift_JIS" }); Cp1250 = new CharacterSetECI("Cp1250", 17, 21, new String[] { "windows-1250" }); Cp1251 = new CharacterSetECI("Cp1251", 18, 22, new String[] { "windows-1251" }); Cp1252 = new CharacterSetECI("Cp1252", 19, 23, new String[] { "windows-1252" }); Cp1256 = new CharacterSetECI("Cp1256", 20, 24, new String[] { "windows-1256" }); UnicodeBigUnmarked = new CharacterSetECI("UnicodeBigUnmarked", 21, 25, new String[] { "UTF-16BE", "UnicodeBig" }); UTF8 = new CharacterSetECI("UTF8", 22, 26, new String[] { "UTF-8" }); ASCII = new CharacterSetECI("ASCII", 23, new int[] { 27, 170 }, new String[] { "US-ASCII" }); Big5 = new CharacterSetECI("Big5", 24, 28); GB18030 = new CharacterSetECI("GB18030", 25, 29, new String[] { "GB2312", "EUC_CN", "GBK" }); EUC_KR = new CharacterSetECI("EUC_KR", 26, 30, new String[] { "EUC-KR" }); CharacterSetECI[] arrayOfCharacterSetECI1 = new CharacterSetECI[27]; arrayOfCharacterSetECI1[0] = Cp437; arrayOfCharacterSetECI1[1] = ISO8859_1; arrayOfCharacterSetECI1[2] = ISO8859_2; arrayOfCharacterSetECI1[3] = ISO8859_3; arrayOfCharacterSetECI1[4] = ISO8859_4; arrayOfCharacterSetECI1[5] = ISO8859_5; arrayOfCharacterSetECI1[6] = ISO8859_6; arrayOfCharacterSetECI1[7] = ISO8859_7; arrayOfCharacterSetECI1[8] = ISO8859_8; arrayOfCharacterSetECI1[9] = ISO8859_9; arrayOfCharacterSetECI1[10] = ISO8859_10; arrayOfCharacterSetECI1[11] = ISO8859_11; arrayOfCharacterSetECI1[12] = ISO8859_13; arrayOfCharacterSetECI1[13] = ISO8859_14; arrayOfCharacterSetECI1[14] = ISO8859_15; arrayOfCharacterSetECI1[15] = ISO8859_16; arrayOfCharacterSetECI1[16] = SJIS; arrayOfCharacterSetECI1[17] = Cp1250; arrayOfCharacterSetECI1[18] = Cp1251; arrayOfCharacterSetECI1[19] = Cp1252; arrayOfCharacterSetECI1[20] = Cp1256; arrayOfCharacterSetECI1[21] = UnicodeBigUnmarked; arrayOfCharacterSetECI1[22] = UTF8; arrayOfCharacterSetECI1[23] = ASCII; arrayOfCharacterSetECI1[24] = Big5; arrayOfCharacterSetECI1[25] = GB18030; arrayOfCharacterSetECI1[26] = EUC_KR; $VALUES = arrayOfCharacterSetECI1; VALUE_TO_ECI = new HashMap(); NAME_TO_ECI = new HashMap(); for (CharacterSetECI localCharacterSetECI : values()) { for (int i2 : localCharacterSetECI.values) { VALUE_TO_ECI.put(Integer.valueOf(i2), localCharacterSetECI); } NAME_TO_ECI.put(localCharacterSetECI.name(), localCharacterSetECI); for (String str : localCharacterSetECI.otherEncodingNames) { NAME_TO_ECI.put(str, localCharacterSetECI); } } } private CharacterSetECI(int paramInt) { this(new int[] { paramInt }, new String[0]); } private CharacterSetECI(int paramInt, String... paramVarArgs) { this.values = new int[] { paramInt }; this.otherEncodingNames = paramVarArgs; } private CharacterSetECI(int[] paramArrayOfInt, String... paramVarArgs) { this.values = paramArrayOfInt; this.otherEncodingNames = paramVarArgs; } public static CharacterSetECI getCharacterSetECIByName(String paramString) { return (CharacterSetECI)NAME_TO_ECI.get(paramString); } public static CharacterSetECI getCharacterSetECIByValue(int paramInt) throws FormatException { if ((paramInt < 0) || (paramInt >= 900)) { throw FormatException.getFormatInstance(); } return (CharacterSetECI)VALUE_TO_ECI.get(Integer.valueOf(paramInt)); } public int getValue() { return this.values[0]; } } /* Location: C:\Users\yepeng\Documents\classes-dex2jar.jar * Qualified Name: com.google.zxing.common.CharacterSetECI * JD-Core Version: 0.7.0.1 */
fb282c9b08610cc711e50a3d6c7baf91bccebf9f
2bcac77e28f4a86c1fceef1994cd799f13d98b62
/src/main/java/com/manhnv/model/dto/BaseDTO.java
213e04ff624e13c238e86f9e0d072eb3aa08ba83
[]
no_license
nvmanh/bookshop
d25d20b4f9d2b50b08aa3c62d47f0707eba3d82f
322594a9d882cfd22a8c4e199df80c94bee0bebe
refs/heads/master
2021-03-06T04:42:06.383448
2020-05-05T07:32:59
2020-05-05T07:32:59
246,179,535
0
1
null
null
null
null
UTF-8
Java
false
false
302
java
package com.manhnv.model.dto; import java.io.Serializable; import com.google.gson.Gson; public class BaseDTO implements Serializable { /** * */ private static final long serialVersionUID = -4016309799865982114L; @Override public String toString() { return new Gson().toJson(this); } }
f9995feaee47e8db488cfa5e4bb7ed71bd3c8659
40f0321ee37528aeb2c452c2caf03b2e95a26543
/src/main/java/eu/learnpad/monitoring/glimpse/services/ServiceLocator.java
bf012f752d8da5563d134d79c50c2f82c84c5b0e
[]
no_license
tomjorquera/lp-monitoring
513a330c4e71d2eb5b3ad3e923ae8e5ed693c42f
ae38a1677add3c74fa7baf515785498f699dfe16
refs/heads/master
2021-01-22T21:41:16.943243
2015-07-16T13:10:04
2015-07-16T13:21:47
39,186,884
0
0
null
2015-07-16T08:54:26
2015-07-16T08:54:26
null
UTF-8
Java
false
false
987
java
package eu.learnpad.monitoring.glimpse.services; import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPMessage; /** * @author Antonello Calabr&ograve; * @version 3.3 * */ public abstract class ServiceLocator extends Thread { protected abstract SOAPConnection createConnectionToService(); protected abstract String readSoapRequest(String SoapRequestXMLFilePath); protected abstract SOAPMessage messageCreation(String soapMessageStringFile); protected abstract SOAPMessage messageSendingAndGetResponse(SOAPConnection soapConnection, SOAPMessage soapMessage, String serviceWsdl); public abstract String getMachineIPLocally(String serviceName, String serviceType, String serviceRole); //check if the mapping between service and machine has been already done public abstract String getMachineIPQueryingDSB(String serviceName, String serviceType, String serviceRole); //if local check fails, this method will starts a procedure to query the dsb to get machine name }
511651d7e64b62745d256c10518423ee5222f8e4
3036fcc6108eab765b8f195430ca3b93165404b6
/1/Separate.java
28ae0bdb7bbfcf18fcd36f590d0b5952f2cb225b
[]
no_license
koorochka/java-courses
f76db2dda3f49f9ff12188ed381c20e722096f8c
017c1dce3e5549d59bd32f1187d03d6ade25947d
refs/heads/master
2021-05-04T11:37:25.518756
2016-08-30T18:29:07
2016-08-30T18:29:07
55,257,021
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
public class Separate{ public static void main(String[] args) { System.out.println("Test Separate function on my computer throw java"); float result = 0; float first = Float.valueOf(args[0]); float second = Float.valueOf(args[1]); result = first / second; System.out.println("Result: " + first + " / " + second + " = " + result); } }
[ "Артём Курочка" ]
Артём Курочка
e0f2271d584165d8d67d537bc84dab7d5526da8d
55a019582188c62ed5b8b64f4ba5b7c11145f574
/TestLeaning1/src/Test/Test.java
32d1d7f488c375fba468fd5c5ceb618cb5db1a8a
[]
no_license
UKCHIRU/git-test1
91f39b72e817970a0301962bfddb3ce350e2427f
84f883dd75ffbb698f99dbe8f7f7338d998eade2
refs/heads/master
2021-05-13T23:22:08.921404
2018-01-14T21:25:41
2018-01-14T21:25:41
116,511,781
0
0
null
null
null
null
UTF-8
Java
false
false
264
java
package Test; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(System.getProperty("user.name")); System.out.println("success"); System.out.println("success1"); syso; } }
c9ffede6dcece191c6c4f02845d8079768858b42
7b0cb1c8ae4d9b10925a9aa2b875bd76d3538958
/src/javakisoensyu04/Student.java
48da09a98fa0b4d393b76c528949cd69de2bcbb9
[]
no_license
yh01/kadai
ff23e49964d73f61a6395d4021ccf88f7432777f
c05f75b4ab4cdd5a8ccad720ac5a44c1dbff9d0d
refs/heads/master
2021-01-10T01:15:15.872357
2016-01-27T15:24:43
2016-01-27T15:24:43
50,290,401
0
0
null
null
null
null
UTF-8
Java
false
false
904
java
package javakisoensyu04; public class Student { String name; private int kokugo,sansu; public Student(String name){ this.name = name; System.out.println("氏名:" + this.name); } public Student(String name,int kokugo,int sansu){ this.name = name; this.kokugo = kokugo; this.sansu = sansu; System.out.println("氏名:" + this.name + "\n国語:" + this.kokugo + "\n算数:" + this.sansu); } public String getName(){ return this.name; } public int getKokugo(){ return this.kokugo; } public int getSansu(){ return this.sansu; } public void setName(String n){ this.name = n; System.out.println("名前:" + this.name); } public void setKokugo(int k){ this.kokugo = k; System.out.println("国語:" + this.kokugo); } public void setSansu(int s){ this.sansu = s; System.out.println("算数:" + this.sansu); } }
[ "ホシ@yuki" ]
ホシ@yuki
1879d9e501ff83ca839873e732207f76e7512fdf
60a890fe6145eccefafe1947a04f131a04ab352c
/src/main/java/io/safemapper/configuration/MappingConfiguration.java
b045875b295e251620bdebf4fa19162fd1f00a7c
[]
no_license
Pinkikvk/safemapper
5fdac7649302bfaa66bc38498e1830f5255b31dc
bc1bd297165d0264d522c761b96901e5f9b33c02
refs/heads/master
2023-06-01T13:15:27.830442
2021-06-16T19:44:06
2021-06-16T19:44:06
332,877,096
0
0
null
null
null
null
UTF-8
Java
false
false
3,664
java
package io.safemapper.configuration; import io.safemapper.configuration.builder.MapperBuilder; import io.safemapper.configuration.field.BasicFieldMappingConfiguration; import io.safemapper.configuration.field.ConvertFieldMappingConfiguration; import io.safemapper.configuration.field.FieldMappingConfiguration; import io.safemapper.configuration.field.IgnoreFieldMappingConfiguration; import io.safemapper.configuration.utils.SetterDetector; import io.safemapper.exception.MapperException; import io.safemapper.mapper.Mapper; import io.safemapper.model.Getter; import io.safemapper.model.Setter; import java.util.LinkedList; import java.util.List; import java.util.function.BiConsumer; import java.util.function.Function; public class MappingConfiguration<TSource, TTarget> { private final Class<TSource> sourceClass; private final Class<TTarget> targetClass; private final List<FieldMappingConfiguration<TSource, TTarget>> fieldMappingConfigurations = new LinkedList<>(); private final SetterDetector<TTarget> setterDetector; private boolean areMissingFieldsAllowed = false; private MappingConfiguration(Class<TSource> sourceClass, Class<TTarget> targetClass) { this.sourceClass = sourceClass; this.targetClass = targetClass; this.setterDetector = new SetterDetector<>(targetClass); } public static <TSource,TTarget> MappingConfiguration<TSource,TTarget> create(Class<TSource> sourceClass, Class<TTarget> destinationClass) { return new MappingConfiguration<>(sourceClass, destinationClass); } public Mapper<TSource, TTarget> build() { var mapperBuilder = MapperBuilder.of(this); return mapperBuilder.build(); } public <W> MappingConfiguration<TSource, TTarget> ignore(Setter<TTarget,W> setter) { var fieldMappingConfiguration = new IgnoreFieldMappingConfiguration<TSource, TTarget>(setter); addMappingConfiguration(fieldMappingConfiguration); return this; } public <W> MappingConfiguration<TSource, TTarget> addMapping(Setter<TTarget,W> setter, Getter<TSource,W> getter) { var fieldMappingConfiguration = new BasicFieldMappingConfiguration<>(setter, getter); addMappingConfiguration(fieldMappingConfiguration); return this; } public <W,X> MappingConfiguration<TSource, TTarget> addMapping(Setter<TTarget,W> setter, Getter<TSource,X> getter, Function<X,W> converter) { var fieldMappingConfiguration = new ConvertFieldMappingConfiguration<>(setter, getter, converter); addMappingConfiguration(fieldMappingConfiguration); return this; } public List<FieldMappingConfiguration<TSource, TTarget>> getFieldMappingConfigurations() { return fieldMappingConfigurations; } public Class<TSource> getSourceClass() { return this.sourceClass; } public Class<TTarget> getTargetClass() { return this.targetClass; } public MappingConfiguration<TSource, TTarget> missingFieldsAllowed() { this.areMissingFieldsAllowed = true; return this; } public boolean areMissingFieldsAllowed() { return this.areMissingFieldsAllowed; } private void addMappingConfiguration(FieldMappingConfiguration<TSource, TTarget> fieldMappingConfiguration) { var setterLambda = fieldMappingConfiguration.getSetter(); setterDetector.findSetterMethod(setterLambda).orElseThrow(() -> new MapperException(String.format("Provided setter lambda not recognized as %s method", targetClass.getSimpleName())) ); fieldMappingConfigurations.add(fieldMappingConfiguration); } }
8643af7d460b51420cea94a1c1fde231d4df9f67
e5f52b57e14844b47a039521acdc88afbb012efe
/SpringPRJ/src/poly/service/INoticeService.java
7214dda511d2cc38cdae5d8005e23dfa2050077c
[]
no_license
lsb180126/project2
1f197ff637f73a450cf1d9c7ac078582542f67da
8ea7f25dc54fe19a65525943fd8a8ef6d5e92855
refs/heads/master
2022-11-17T06:47:40.616874
2019-09-16T04:03:45
2019-09-16T04:03:45
194,187,554
0
0
null
2022-11-16T04:55:46
2019-06-28T01:44:33
HTML
UTF-8
Java
false
false
121
java
package poly.service; import java.util.List; import poly.dto.NoticeDTO; public interface INoticeService { }
[ "data8311-19@DESKTOP-JP980KF" ]
data8311-19@DESKTOP-JP980KF
2802105a7b966373fef879677c9875d3ebbd6440
9f30fbae8035c2fc1cb681855db1bc32964ffbd4
/Java/zhaojunzhao/Task3/src/main/java/com/mutesaid/service/WorkService.java
98164eddd7f80f845afb529071ec8014ce9f8408
[]
no_license
IT-xzy/Task
f2d309cbea962bec628df7be967ac335fd358b15
4f72d55b8c9247064b7c15db172fd68415492c48
refs/heads/master
2022-12-23T04:53:59.410971
2019-06-20T21:14:15
2019-06-20T21:14:15
126,955,174
18
395
null
2022-12-16T12:17:21
2018-03-27T08:34:32
null
UTF-8
Java
false
false
1,157
java
package com.mutesaid.service; import com.mutesaid.pojo.Work; import org.springframework.stereotype.Service; import java.util.List; @Service public interface WorkService { /** * 根据提供的参数查找作品 * @param name 作品标 * @param status 作品向下架状态1/0 * @return 作品列表 */ List<Work> getWorkList(String name, Boolean status); /** * 查询指定作品 * @param workId 作品id * @return 作品 */ Work getWork(Long workId); /** * 删除指定作品 * @param workId 作品id */ void deleteWork(Long workId); /** * 改变作品状态 * @param workId 作品id */ void updateStatus(Long workId); /** * 新增作品 * @param name 作品标题 * @param workListId 作品集id * @param intro 作品简介 * @param thum 缩略图路径 * @param video 视频连接 * @param picture 图片路径 * @param article 文章 */ void insert(String name, Long workListId, String intro, String thum, String video, String picture, String article); }
7822bfe05b620bf4b5e59bcbbb4e9a9db4261546
b2bad3b752ba8d03848ceec5c7244cf73c2e8e05
/src/kr/pe/kingori/sample/signup/MainActivity.java
df2edf3f9c2b7633f52f1df64c10acc170a7da73
[]
no_license
zzazang/signup_sample_fragment
16280b99516fda423e448e713c6789e081760a3e
e769a863a0cabe06b1f152ad6ec54a96f93a958b
refs/heads/master
2020-12-25T10:41:20.091434
2012-05-16T08:27:30
2012-05-16T08:27:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,870
java
package kr.pe.kingori.sample.signup; import java.util.HashMap; import java.util.Map; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.EditText; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; public class MainActivity extends FragmentActivity { static String DATA_FRAGMENT_TAG = "data"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); if (savedInstanceState == null) { // Do first time initialization -- add initial fragment. Fragment userDataFragment; { userDataFragment = new UserDataFragment(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(userDataFragment, DATA_FRAGMENT_TAG); ft.commit(); } Fragment newFragment = new SignupStep1Fragment(); getSupportFragmentManager().beginTransaction().add(R.id.singup_main, newFragment).commit(); } } public void gotoNext(int currentStep) { switch (currentStep) { case 1: showNextFragment(new SignupStep2Fragment()); break; case 2: showNextFragment(new SignupStep3Fragment()); break; case 3: complete(); break; } } private void showNextFragment(SingupFragment nextFragment) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.singup_main, nextFragment); ft.setTransition(FragmentTransaction.TRANSIT_ENTER_MASK); ft.addToBackStack(null); ft.commit(); } private void complete() { startActivity(new Intent(getApplicationContext(), ResultActivity.class).putExtra("data", ((UserDataFragment) getSupportFragmentManager().findFragmentByTag(DATA_FRAGMENT_TAG)).getUserData())); finish(); Log.d("test", "finish"); } /** * 가입 정보를 담은 fragment. activity lifecycle과 무관하게 유지되어야 함. * * @author kingori * */ public static class UserDataFragment extends Fragment { private Map<String, String> userData = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); userData = new HashMap<String, String>(); } public void setValue(String key, String value) { userData.put(key, value); } public HashMap<String, String> getUserData() { return new HashMap<String, String>(userData); } } /** * 첫 단계 * * @author kingori * */ public static class SignupStep1Fragment extends SingupFragment implements OnClickListener { EditText etName; EditText etSex; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.signup_step_1, container, false); root.findViewById(R.id.btn_next).setOnClickListener(this); etName = (EditText) root.findViewById(R.id.et_name); etSex = (EditText) root.findViewById(R.id.et_sex); etSex.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { next(); return true; } return false; } }); return root; } @Override public void onResume() { super.onResume(); etName.requestFocus(); showKeyboard(getActivity()); } @Override protected void saveData() { userFragment.setValue("name", etName.getText().toString()); userFragment.setValue("sex", etSex.getText().toString()); } @Override public void onClick(View v) { next(); } @Override void loadData() { etName.setText(userFragment.userData.get("name")); etSex.setText(userFragment.userData.get("sex")); } @Override int getCurrentStep() { return 1; } } /** * 둘째 단계 * * @author kingori * */ public static class SignupStep2Fragment extends SingupFragment implements OnClickListener { EditText etHobby; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.signup_step_2, container, false); root.findViewById(R.id.btn_next).setOnClickListener(this); etHobby = (EditText) root.findViewById(R.id.et_hobby); etHobby.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { next(); return true; } return false; } }); return root; } @Override void loadData() { etHobby.setText(userFragment.userData.get("hobby")); } @Override public void onResume() { super.onResume(); etHobby.requestFocus(); showKeyboard(getActivity()); } @Override protected void saveData() { userFragment.setValue("hobby", etHobby.getText().toString()); } @Override public void onClick(View v) { next(); } @Override int getCurrentStep() { return 2; } } /** * 셋째(마지막) 단계 * * @author kingori * */ public static class SignupStep3Fragment extends SingupFragment implements OnClickListener { EditText etAddr; EditText etTel; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.signup_step_3, container, false); root.findViewById(R.id.btn_next).setOnClickListener(this); etAddr = (EditText) root.findViewById(R.id.et_addr); etTel = (EditText) root.findViewById(R.id.et_tel); etTel.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { next(); return true; } return false; } }); return root; } @Override void loadData() { etAddr.setText(userFragment.userData.get("addr")); etTel.setText(userFragment.userData.get("tel")); } @Override public void onResume() { super.onResume(); etAddr.requestFocus(); showKeyboard(getActivity()); } @Override protected void saveData() { userFragment.setValue("addr", etAddr.getText().toString()); userFragment.setValue("tel", etTel.getText().toString()); } @Override public void onClick(View v) { next(); } @Override int getCurrentStep() { return 3; } } /** * 가입화면 base class * * @author kingori * */ public static abstract class SingupFragment extends Fragment { UserDataFragment userFragment; /** * 사용자 정보에 접근할 수 있도록 userFragment 설정. userFragment는 activity가 create된 후에 * 접근 가능하므로 onActivityCreate 에서 작업함. */ @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FragmentManager fm = getFragmentManager(); userFragment = (UserDataFragment) fm.findFragmentByTag(DATA_FRAGMENT_TAG); loadData(); } /** * 입력 중간에 백 누를 경우에도 값을 저장해야 함. 다만 activity 종료로 detach 되는 경우는 제외. */ @Override public void onDetach() { if (!getActivity().isFinishing()) { Log.d("test", "detach"); saveData(); } userFragment = null; super.onDetach(); } /** * 기존 데이터 불러오기 */ abstract void loadData(); /** * 입력한 데이터 저장 */ abstract void saveData(); /** * 현재 단계 알아내기 * * @return */ abstract int getCurrentStep(); /** * 다음 화면으로 진행하기 */ protected void next() { // 다음 화면으로 가기 전에 일단 저장 saveData(); ((MainActivity) getActivity()).gotoNext(getCurrentStep()); } } /** * 소프트키보드 표출 : 근데 잘 안됨... * * @param ctx * @param view */ public static void showKeyboard(Activity act) { act.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); // try { // InputMethodManager mgr = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); // mgr.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); // } catch (Throwable e) { // Log.w("sample", e); // } } }