blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
a99ca3c74f06ea06e44514b83e8bf07f717f50b3
098f7b482ebbacc4098e3234f8fe945685f60ab4
/app/src/main/java/com/example/toddlerteacher/StatisticsFragment.java
081d5fc6febbf21ca5fd2444de88ecd8aae467cd
[]
no_license
shreyab963/ToddGuru
2cbdcee4e6ea2696d1eb2c84246cc6355f0dd15c
12d31d749070e4935a1777f8ab73f7d45142a374
refs/heads/master
2023-04-23T10:47:44.522102
2021-05-15T15:16:23
2021-05-15T15:16:23
367,662,278
0
0
null
null
null
null
UTF-8
Java
false
false
4,009
java
package com.example.toddlerteacher; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.toddlerteacher.databinding.FragmentStatisticsBinding; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.firestore.DocumentSnapshot; import com.google.firebase.firestore.FirebaseFirestore; public class StatisticsFragment extends Fragment { public StatisticsFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } FragmentStatisticsBinding binding; FirebaseFirestore database; User user; int grade =0; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment binding = FragmentStatisticsBinding.inflate(inflater, container, false); database = FirebaseFirestore.getInstance(); Task<DocumentSnapshot> documentSnapshotTask = database.collection("users") .document(FirebaseAuth.getInstance().getUid()) .get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() { @Override public void onSuccess(DocumentSnapshot documentSnapshot) { user = documentSnapshot.toObject(User.class); // grade = (int) user.getCoins(); if(user.getCoins()== 25){ binding.currentCoins.setText("You will be graded here! Good luck!"); binding.strength.setText("Kudos to you for trying out the app!"); binding.weakness.setText("No weaknesses recorded"); binding.repeated.setText("No Levels repeated"); } else if (user.getCoins() < 100) { binding.currentCoins.setText("You have a D. You got this!"); binding.strength.setText("You are determined to win the game. Keep up with the numbers!"); binding.weakness.setText("Keep working on the alphabets, you got this!"); binding.repeated.setText("No Levels repeated"); } else if (user.getCoins() < 200) { binding.currentCoins.setText("You have a C. You got this!"); binding.strength.setText("You are getting closer to your goals. Good job with the alphabets!"); binding.weakness.setText("Keep working on the trivia, you got this!"); binding.repeated.setText("Level 1 repeated"); } else if (user.getCoins() < 300) { binding.currentCoins.setText("You have a B. You got this!"); binding.strength.setText("You are killing the trivia. Kudos to you!"); binding.weakness.setText("Keep working on the trivia, you got this!"); binding.repeated.setText("Level 1 and 2 repeated"); } else { binding.currentCoins.setText("Congratulations! You have an A"); binding.strength.setText("You have mastered the game. Your calculation skills are amazing!"); binding.weakness.setText("You have successfully eliminated all your weaknesses, We're proud of you!"); binding.repeated.setText("Level 1, 2 and 3 repeated"); } } }); return binding.getRoot(); } }
[ "70442235+shreyab963@users.noreply.github.com" ]
70442235+shreyab963@users.noreply.github.com
f284fd1cc59fdbb893a6056bc03d0a6b48c2cdf2
1334bd1b6e14e267133321ebc2ef29ca328f06cf
/CS 3102 Project/src/coordinates.java
e57b49fda686900886a88b061e33688e13f56ad2
[]
no_license
sunshuo91/SomeJava
48349423d8e68522359575ea3ee3dd987f1fc388
a9f37448106be7a494de5a83cb483237407c180a
refs/heads/master
2021-01-21T20:22:30.265537
2017-06-22T18:42:53
2017-06-22T18:42:53
92,223,462
0
0
null
null
null
null
UTF-8
Java
false
false
230
java
public class coordinates { public int xCoor; // from 0 public int yCoor; // from 0; from top to bottom public char val; public coordinates(int x, int y, char c) { this.xCoor = x; this.yCoor = y; this.val = c; } }
[ "noreply@github.com" ]
noreply@github.com
b2b28321a5fe059993065358ea88e84817f405f6
a5db207c892d33b9b6f74b2524245d570ceb758e
/AndroidStudioProjects/Diappnostico/app/src/androidTest/java/com/titulo/proyecto/diappnostico/ExampleInstrumentedTest.java
051506f46505ee14b3cf6226058fa82c3081d9ef
[]
no_license
wiisha/Diappnostico_1
2dd7ad1dfe36f3b869033f90b70c9df2849851da
75bfcc1652ff421d7cefe1d9b164c4760d40b0e1
refs/heads/master
2021-01-19T12:13:10.271857
2016-09-23T18:01:35
2016-09-23T18:01:35
69,044,530
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.titulo.proyecto.diappnostico; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.titulo.proyecto.diappnostico", appContext.getPackageName()); } }
[ "carlos.huichaquelen@inacapmail.cl" ]
carlos.huichaquelen@inacapmail.cl
f01eb9195bcd76fd35d926def98d97d0adc5eda6
ce230bd7f18048cc9f82754b42883eb1c25d6978
/workspace/DesignPatterns/src/structural/bridge/GreenCircle.java
b89ab83216f2436598bb2ae579d823ef3055515f
[]
no_license
antonioudakis/DesignPatterns
f32c189c1185049cdebb6f51d2108ce87be4a0c8
88bbe6e6e9264578839b9aaf71d0943b92057892
refs/heads/master
2021-01-12T01:38:43.523209
2017-01-24T09:40:48
2017-01-24T09:40:48
78,414,376
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package structural.bridge; public class GreenCircle implements DrawAPI { @Override public void drawCircle(int radius, int x, int y) { System.out.println("Drawing Circle[ color: green, radius: " + radius + ", x: " + x + ", " + y + "]"); } }
[ "t.antonioudakis@gmail.com" ]
t.antonioudakis@gmail.com
d2caddb7c3bccb26ebadaeda730d0f2e5d743545
816e53ced1f741006ed5dd568365aba0ec03f0cf
/TeamBattle/temp/src/minecraft/net/minecraft/network/play/server/S30PacketWindowItems.java
1d67c56e9b0d9051a42b63d0a9a194ba57545d39
[]
no_license
TeamBattleClient/TeamBattleRemake
ad4eb8379ebc673ef1e58d0f2c1a34e900bd85fe
859afd1ff2cd7527abedfbfe0b3d1dae09d5cbbc
refs/heads/master
2021-03-12T19:41:51.521287
2015-03-08T21:34:32
2015-03-08T21:34:32
31,624,440
3
0
null
null
null
null
UTF-8
Java
false
false
2,154
java
package net.minecraft.network.play.server; import java.io.IOException; import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.network.INetHandler; import net.minecraft.network.Packet; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.INetHandlerPlayClient; public class S30PacketWindowItems extends Packet { private int field_148914_a; private ItemStack[] field_148913_b; private static final String __OBFID = "CL_00001294"; public S30PacketWindowItems() {} public S30PacketWindowItems(int p_i45186_1_, List p_i45186_2_) { this.field_148914_a = p_i45186_1_; this.field_148913_b = new ItemStack[p_i45186_2_.size()]; for(int var3 = 0; var3 < this.field_148913_b.length; ++var3) { ItemStack var4 = (ItemStack)p_i45186_2_.get(var3); this.field_148913_b[var3] = var4 == null?null:var4.func_77946_l(); } } public void func_148837_a(PacketBuffer p_148837_1_) throws IOException { this.field_148914_a = p_148837_1_.readUnsignedByte(); short var2 = p_148837_1_.readShort(); this.field_148913_b = new ItemStack[var2]; for(int var3 = 0; var3 < var2; ++var3) { this.field_148913_b[var3] = p_148837_1_.func_150791_c(); } } public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { p_148840_1_.writeByte(this.field_148914_a); p_148840_1_.writeShort(this.field_148913_b.length); ItemStack[] var2 = this.field_148913_b; int var3 = var2.length; for(int var4 = 0; var4 < var3; ++var4) { ItemStack var5 = var2[var4]; p_148840_1_.func_150788_a(var5); } } public void func_148833_a(INetHandlerPlayClient p_148833_1_) { p_148833_1_.func_147241_a(this); } public int func_148911_c() { return this.field_148914_a; } public ItemStack[] func_148910_d() { return this.field_148913_b; } // $FF: synthetic method // $FF: bridge method public void func_148833_a(INetHandler p_148833_1_) { this.func_148833_a((INetHandlerPlayClient)p_148833_1_); } }
[ "honzajurak@hotmail.co.uk" ]
honzajurak@hotmail.co.uk
963b5a4c4e25bac12bbc1a1ef2b7c2dca2522f46
3472b989ffb4ad24107e5f21390f398fbd6da3fc
/nfctools-core/src/test/java/org/nfctools/test/InMemoryTag.java
7eae6b44265beb9eab7f767ac58418002c9688c9
[ "Apache-2.0" ]
permissive
noxo/nfctools
3ece95b38d9d71ed44cc456a091f72e0b0f499fe
12e547a710f19c9fdc1647f378a9f352d748f0ab
refs/heads/master
2020-12-25T13:33:31.753484
2012-11-04T08:41:09
2012-11-04T08:41:09
7,385,737
1
0
null
null
null
null
UTF-8
Java
false
false
2,443
java
/** * Copyright 2011-2012 Adrian Stabiszewski, as@nfctools.org * * 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.nfctools.test; import java.io.ByteArrayOutputStream; import java.io.IOException; import org.nfctools.api.ApduTag; import org.nfctools.mf.ul.MemoryMap; import org.nfctools.scio.Command; import org.nfctools.scio.Response; import org.nfctools.spi.acs.Apdu; public class InMemoryTag implements ApduTag { private MemoryMap memoryMap; public InMemoryTag(MemoryMap memoryMap) { this.memoryMap = memoryMap; } public MemoryMap getMemoryMap() { return memoryMap; } @Override public Response transmit(Command command) { if (command.getInstruction() == Apdu.INS_READ_BINARY) { return readBinary(command); } else if (command.getInstruction() == Apdu.INS_UPDATE_BINARY) { return writeBinary(command); } else if (command.getInstruction() == Apdu.INS_INTERNAL_AUTHENTICATE_ACS) { return new Response(0x90, 0, null); } else if (command.getInstruction() == Apdu.INS_EXTERNAL_AUTHENTICATE) { return new Response(0x90, 0, null); } throw new RuntimeException("Unknown command: " + command.getInstruction()); } private Response writeBinary(Command command) { byte[] data = command.getData(); int page = command.getP2(); for (int offset = 0; offset < data.length; offset = offset + memoryMap.getBytesPerPage()) { memoryMap.setPage(page, data, offset); page++; } return new Response(0x90, 0, null); } private Response readBinary(Command command) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { int dataRead = 0; int page = command.getP2() & 0xFF; while (dataRead < command.getLength()) { byte[] data = memoryMap.getPage(page); out.write(data); dataRead += data.length; page++; } } catch (IOException e) { throw new RuntimeException(e); } return new Response(0x90, 0x00, out.toByteArray()); } }
[ "as@grundid.de" ]
as@grundid.de
ec79b33f54a6d566b0ca48888cf24cf2da122454
f3ff1d47c4f512e877991505cbac4c8173627f5f
/src/main/java/game/persistence/objects/PlayerHistory.java
5550ac3cb189fbce7b8e5bfaf4e19051dcb7a5ef
[]
no_license
hoovler/GettingToKnowYou
46a08d79c9135390b9a7f3dff4ac9767ca1c4a54
6dc19bdc1c0009cdc747bd5c2ff017d6aae5f21d
refs/heads/master
2020-03-31T15:10:31.885453
2018-10-16T15:33:00
2018-10-16T15:33:00
152,327,242
0
0
null
null
null
null
UTF-8
Java
false
false
1,846
java
/* * Copyright (c) 2018 Data BuildR, LLC - Released as open source under BSD-3-Clause * * Written by Michael Hoovler - <hoovlermichael@gmail.com> and/or <architect@databuildr.com> * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * (1) Redistributions of source code must retain the above copyright notice this list of * conditions and the following disclaimer. * (2) Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * (3) Neither the name of the copyright holder nor the names of its contributors may be * used to endorse or promote products derived from this software without specific prior * written permission. * * Full license text is available at <https://opensource.org/licenses/BSD-3-Clause> */ package game.persistence.objects; import java.time.Instant; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity public class PlayerHistory { // *** START of in-mem database fields *********** @Id @GeneratedValue @Column(name = "ID") private Long id; @ManyToOne @JoinColumn(name = "PLAYER_ID") private Player player; /** The */ @Column(name = "QUESTION_ID") private String questionId; @Column(name = "TIME_ASKED") private Instant timeAsked; @Column(name = "TIME_ANSWERED") private Instant timeAnswered; @Column(name = "WAS_RIGHT") private Boolean wasRight; public PlayerHistory() { // default constructor to meet JPA requirements } }
[ "architect@databuildr.com" ]
architect@databuildr.com
21473a132d985677b9b752f7d1548d56960eb044
97dee92219e8df1f77bd7baea3a640c6efb1a48d
/azure-mgmt-website/src/main/java/com/microsoft/azure/management/website/implementation/AppServicePlanImpl.java
6427e058e9a0aa381e4dae290f509aadb3561d59
[ "MIT" ]
permissive
Gigware/azure-sdk-for-java
acf8d78fe2e8b3e5cbd3f2addac20291bcf39da0
27dd269c712974667b5a48bd00f28994307c0ba7
refs/heads/master
2020-06-17T21:51:13.964893
2016-11-23T12:58:49
2016-11-23T12:58:49
74,966,666
0
0
null
2016-11-28T11:28:57
2016-11-28T11:28:57
null
UTF-8
Java
false
false
2,751
java
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. */ package com.microsoft.azure.management.website.implementation; import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableResourceImpl; import com.microsoft.azure.management.website.AppServicePlan; import com.microsoft.azure.management.website.AppServicePricingTier; import rx.Observable; /** * The implementation for {@link AppServicePlan}. */ class AppServicePlanImpl extends GroupableResourceImpl< AppServicePlan, AppServicePlanInner, AppServicePlanImpl, AppServiceManager> implements AppServicePlan, AppServicePlan.Definition, AppServicePlan.Update { private final AppServicePlansInner client; AppServicePlanImpl(String name, AppServicePlanInner innerObject, final AppServicePlansInner client, AppServiceManager manager) { super(name, innerObject, manager); this.client = client; } @Override public Observable<AppServicePlan> createResourceAsync() { return client.createOrUpdateAsync(resourceGroupName(), name(), inner()) .map(innerToFluentMap(this)); } @Override public AppServicePlanImpl refresh() { this.setInner(client.get(resourceGroupName(), name())); return this; } @Override public int maxInstances() { return inner().maximumNumberOfWorkers(); } @Override public int capacity() { return inner().sku().capacity(); } @Override public boolean perSiteScaling() { return inner().perSiteScaling(); } @Override public int numberOfWebApps() { return inner().numberOfSites(); } @Override public AppServicePricingTier pricingTier() { return AppServicePricingTier.fromSkuDescription(inner().sku()); } @Override public AppServicePlanImpl withPricingTier(AppServicePricingTier pricingTier) { if (pricingTier == null) { throw new IllegalArgumentException("pricingTier == null"); } inner().withSku(pricingTier.toSkuDescription()); return this; } @Override public AppServicePlanImpl withPerSiteScaling(boolean perSiteScaling) { inner().withPerSiteScaling(perSiteScaling); return this; } @Override public AppServicePlanImpl withCapacity(int capacity) { if (capacity < 1) { throw new IllegalArgumentException("Capacity is at least 1."); } inner().sku().withCapacity(capacity); return this; } }
[ "jianghaolu@users.noreply.github.com" ]
jianghaolu@users.noreply.github.com
436f55e9770ef16afecd276416c664d35bac25ed
7fc56e8c19e0c1d535f275b7263dfb730bc6b37b
/java-it-tests/common/src/main/java/common/CassandraQuery.java
5d58c4aafdb419372a3ea540259aac3e492a53fe
[ "Apache-2.0" ]
permissive
gitter-badger/scassandra-server
732d06e9014b131fd8e94d9955da43d5d35e8028
94fd3a1c9882ff0d1e074a72dd8e6606a7629b39
refs/heads/master
2021-01-15T18:13:55.066087
2015-08-03T07:17:53
2015-08-03T07:17:53
40,188,420
0
0
null
2015-08-04T14:07:13
2015-08-04T14:07:13
null
UTF-8
Java
false
false
470
java
package common; public class CassandraQuery { private final String query; private final Object[] variables; public CassandraQuery(String query) { this(query, new Object[] {}); } public CassandraQuery(String query, Object... variables) { this.query = query; this.variables = variables; } public String getQuery() { return query; } public Object[] getVariables() { return variables; } }
[ "christopher.batey@gmail.com" ]
christopher.batey@gmail.com
9aa18a87cc74deddfc6586d2af90c499b685dabc
d9de7674219de51a3df56c906b112918be124716
/src/main/java/xyz/fanjie/mall/service/IProductService.java
3f2c150f989ad2982ca9656cbf22de8e6f8756a1
[]
no_license
fan-97/fmall
2b52aa0bbcc9bb1a7714fc842121cc28818bec13
95c1c510893fca2589b7ca73f06748339af2eea0
refs/heads/master
2022-12-28T05:22:23.227429
2019-08-03T15:39:16
2019-08-03T15:39:16
198,967,225
0
0
null
2022-12-16T03:06:57
2019-07-26T07:17:18
Java
UTF-8
Java
false
false
825
java
package xyz.fanjie.mall.service; import com.github.pagehelper.PageInfo; import xyz.fanjie.mall.common.ServerResponse; import xyz.fanjie.mall.pojo.Product; import xyz.fanjie.mall.vo.ProductDetailVo; public interface IProductService { public ServerResponse<String> saveProduct(Product product); ServerResponse<String> setSaleStatus(Integer productId, Integer status); ServerResponse<ProductDetailVo> getDetail(Integer productId); ServerResponse<PageInfo> manageGetList(int pageNum, int pageSize); ServerResponse<PageInfo> searchByNameAndId(int pageNum, int pageSize,String productNamne,Integer productId); ServerResponse<PageInfo> getList(Integer categoryId, String keyword, int pageNum, int pageSize, String orderBy); ServerResponse<ProductDetailVo> getProductDetail(Integer productId); }
[ "914456697@qq.com" ]
914456697@qq.com
780ae3f15277a9790288e83b4d31a584f487c633
f108538a92294b1ab306dde07f355d30bfc7046b
/nacos-ribbon-service/src/main/java/com/alibaba/nacosribbonservice/controller/UserRibbonController.java
0537b9efa3923c28651a51d50b97d35c0cf8cc68
[]
no_license
HyJan-go/nacos-demo
ad26a9647bcdb2baec98f3219f232c30c490859a
fba743fe97be72e697c5487eb482f35e953c1fa5
refs/heads/master
2022-07-17T05:44:58.808115
2020-05-22T07:17:44
2020-05-22T07:17:44
266,044,437
0
0
null
null
null
null
UTF-8
Java
false
false
2,134
java
package com.alibaba.nacosribbonservice.controller; import com.alibaba.fastjson.JSON; import com.alibaba.nacosribbonservice.entity.Result; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; 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.RestController; import org.springframework.web.client.RestTemplate; import java.util.Objects; /** * @program: demo * @description: 负载均衡控制器测试 * @author: HyJan * @create: 2020-05-21 19:49 */ @RestController @Slf4j @RequestMapping(value = "/user", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public class UserRibbonController { @Autowired private RestTemplate restTemplate; @Value("${spring.service-url.nacos-user-service}") private String userServiceUrl; @GetMapping("/{id}") public Result getUserById(@PathVariable Long id) { return restTemplate.getForObject( new StringBuilder().append(userServiceUrl).append("/user/get/{1}").toString(), Result.class, id); } @GetMapping("/get-list") public Result getUsers() { log.info("userServiceUrl is {}",userServiceUrl); return restTemplate.getForObject( new StringBuilder(userServiceUrl).append("/user/get-list").toString(), Result.class); } @GetMapping("/get-by-name") public Result getUserByName(String userName) { log.info("用户名查询 come in ..."); ResponseEntity<Result> entity = restTemplate.getForEntity( new StringBuilder().append(userServiceUrl).append("/user/get-by-name?userName={1}").toString(), Result.class, userName); if (Objects.nonNull(entity)){ log.info("获取到的结果为:{}", entity.getBody().toString()); return entity.getBody(); } return Result.error(); } }
[ "hejian@52tt.com" ]
hejian@52tt.com
328a04474d7d7c4021f293709a8c3c711a49ea89
49e5d267c2306f9dc88836800cd87f6bfd7461a6
/univocity-trader-core/src/main/java/com/univocity/trader/config/Allocation.java
6e11cec14f8c7a4a7abbd8ee67f47f8c4219ca30
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
drkarl/univocity-trader
a6e6d9ec9fa56dad70fa2628e2b0bc48ad5198c4
26ccc0bd0b7024222ffa0ead2ea17c97a9c2c550
refs/heads/master
2023-03-13T12:24:30.944578
2021-03-10T00:03:16
2021-03-10T00:03:16
340,787,115
0
0
Apache-2.0
2021-03-09T23:42:56
2021-02-21T00:52:25
Java
UTF-8
Java
false
false
2,228
java
package com.univocity.trader.config; public class Allocation implements Cloneable { public static final double EFFECTIVELY_ZERO = 0.000000001; static final Allocation NO_LIMITS = new Allocation(); private double maximumAmountPerAsset = Integer.MAX_VALUE; private double maximumPercentagePerAsset = 100.0; private double maximumAmountPerTrade = Integer.MAX_VALUE; private double maximumPercentagePerTrade = 100.0; private double minimumAmountPerTrade = EFFECTIVELY_ZERO; Allocation() { } public double getMaximumAmountPerAsset() { return maximumAmountPerAsset; } public Allocation setMaximumAmountPerAsset(double maximumAmountPerAsset) { this.maximumAmountPerAsset = adjustAmount(maximumAmountPerAsset); return this; } public double getMaximumPercentagePerAsset() { return maximumPercentagePerAsset; } public Allocation setMaximumPercentagePerAsset(double maximumPercentagePerAsset) { this.maximumPercentagePerAsset = adjustPercentage(maximumPercentagePerAsset); return this; } public double getMaximumAmountPerTrade() { return maximumAmountPerTrade; } public Allocation setMaximumAmountPerTrade(double maximumAmountPerTrade) { this.maximumAmountPerTrade = adjustAmount(maximumAmountPerTrade); return this; } public double getMaximumPercentagePerTrade() { return maximumPercentagePerTrade; } public Allocation setMaximumPercentagePerTrade(double maximumPercentagePerTrade) { this.maximumPercentagePerTrade = adjustPercentage(maximumPercentagePerTrade); return this; } public double getMinimumAmountPerTrade() { return minimumAmountPerTrade; } public Allocation setMinimumAmountPerTrade(double minimumAmountPerTrade) { this.minimumAmountPerTrade = adjustAmount(minimumAmountPerTrade); return this; } private static double adjustPercentage(double percentage) { percentage = Math.max(percentage, 0.0); percentage = Math.min(percentage, 100.0); return percentage; } private static double adjustAmount(double maximumAmount) { return Math.max(maximumAmount, 0.0); } @Override public Allocation clone() { try { return (Allocation) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException(e); } } }
[ "jbax@univocity.com" ]
jbax@univocity.com
e3e4b45c4cd397882d4bdd4fbd34fee09384f219
1dc293a0f45c499e5d8e07c97e3da05eb0d9f37e
/app/src/main/java/com/getmobileltd/trafficbar/database/repository/UserRepository.java
5315c545ee142cecd313fadec804649bde96850e
[]
no_license
themavencoder/traffic-bar
e42d1da511d49f6094cd8ee77e5a6c0ebb508492
e574d1c25a69db4c2b0d9946bbe357340ea605a8
refs/heads/master
2020-04-24T10:27:12.259199
2019-05-14T12:23:20
2019-05-14T12:23:20
171,894,914
0
0
null
null
null
null
UTF-8
Java
false
false
5,610
java
/* * * * Creator: Tobiloba Adejumo on 4/23/19 1:55 PM Last modified: 4/23/19 1:55 PM Copyright: All rights reserved Ⓒ 2019 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS * OF ANY KIND, either express or implied. See the License for the specific language governing * permissions and limitations under the License. * / */ package com.getmobileltd.trafficbar.database.repository; import android.app.Application; import android.os.AsyncTask; import android.service.autofill.UserData; import android.util.Log; import android.widget.Toast; import com.getmobileltd.trafficbar.database.OnRetrieveFirstName; import com.getmobileltd.trafficbar.database.OnRetrieveLastName; import com.getmobileltd.trafficbar.database.OnRetrieveUserApi; import com.getmobileltd.trafficbar.database.OnRetrieveUserId; import com.getmobileltd.trafficbar.database.UserDatabase; import com.getmobileltd.trafficbar.database.contract.UserDao; import com.getmobileltd.trafficbar.database.model.User; /** * Created by themavencoder on 23,April,2019 */ public class UserRepository { private UserDao userDao; public UserRepository(Application application) { UserDatabase userDatabase = UserDatabase.getInstance(application); userDao = userDatabase.userDao(); } public void insert(User user) { new InsertUserAsyncTask(userDao).execute(user); Log.d("INSERT", "Successfully inserted"); } public void getApikey(OnRetrieveUserApi onRetrieveUserApi) { new GetApiKeyAsyncTask(userDao,onRetrieveUserApi).execute(); } public void getUserId(OnRetrieveUserId onRetrieveUserId) { new GetUserIdAsyncTask(userDao,onRetrieveUserId).execute(); } public void getFirstName(OnRetrieveFirstName onRetrieveFirstName) { new GetFirstNameAsyncTask(userDao,onRetrieveFirstName).execute(); } public void getLastName(OnRetrieveLastName onRetrieveLastName) { new GetLastNameAsyncTask(userDao,onRetrieveLastName).execute(); } private static class InsertUserAsyncTask extends AsyncTask<User, Void, Void> { private UserDao userDao; private InsertUserAsyncTask(UserDao userDao) { this.userDao = userDao; } @Override protected Void doInBackground(User... users) { userDao.insert(users[0]); return null; } } public static class GetUserIdAsyncTask extends AsyncTask<Void,Void,Integer> { private static UserDao userDao; private OnRetrieveUserId onRetrieveUserId; GetUserIdAsyncTask(UserDao userDao, OnRetrieveUserId onRetrieveUserId) { this.onRetrieveUserId = onRetrieveUserId; this.userDao = userDao; } @Override protected Integer doInBackground(Void... voids) { return userDao.getUserId(); } @Override protected void onPostExecute(Integer s) { super.onPostExecute(s); onRetrieveUserId.getUserId(s); } } public static class GetFirstNameAsyncTask extends AsyncTask<Void, Void, String> { private static UserDao userDao; private OnRetrieveFirstName onRetrieveFirstName; public GetFirstNameAsyncTask(UserDao userDao, OnRetrieveFirstName onRetrieveFirstName) { this.userDao =userDao; this.onRetrieveFirstName = onRetrieveFirstName; } @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(Void... voids) { return userDao.getFirstName(); } @Override protected void onPostExecute(String s) { super.onPostExecute(s); onRetrieveFirstName.getFirstName(s); } } public static class GetLastNameAsyncTask extends AsyncTask<Void, Void, String> { private static UserDao userDao; private OnRetrieveLastName onRetrieveLastName; public GetLastNameAsyncTask(UserDao userDao, OnRetrieveLastName onRetrieveLastName) { this.userDao =userDao; this.onRetrieveLastName = onRetrieveLastName; } @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(Void... voids) { return userDao.getLastName(); } @Override protected void onPostExecute(String s) { super.onPostExecute(s); onRetrieveLastName.getLastName(s); } } public static class GetApiKeyAsyncTask extends AsyncTask<Void, Void, String> { private static UserDao userDao; private OnRetrieveUserApi onRetrieveUserApi; public GetApiKeyAsyncTask(UserDao userDao, OnRetrieveUserApi onRetrieveUserApi) { this.userDao =userDao; this.onRetrieveUserApi = onRetrieveUserApi; } @Override protected String doInBackground(Void... voids) { return userDao.getApiKey(); } @Override protected void onPostExecute(String s) { super.onPostExecute(s); onRetrieveUserApi.pnRetrieveUserFinish(s); } } }
[ "eniolaplus08@gmail.com" ]
eniolaplus08@gmail.com
522bcffe0c790a34e611724c8b32ed14524b08ce
c4b72a3aa62070e588dba888650a1253121c5a11
/app/src/main/java/com/videocaht/recorder/facetime/videocall/screenrecorder/JSSEProvider.java
a22f950c15712d097a1610aea4901b768963aee1
[]
no_license
omairriqbal/VideoCallRecorder
768ab4c1b60172dcec4f04088ecf66e30a879cbf
00b2591db3de769ced80ade71dab052d6e68dfd8
refs/heads/master
2022-12-27T18:15:20.779578
2020-10-12T05:51:17
2020-10-12T05:51:17
300,238,067
1
1
null
null
null
null
UTF-8
Java
false
false
948
java
package com.videocaht.recorder.facetime.videocall.screenrecorder; /** * Created by jolta on 2/14/2018. */ import java.security.AccessController; import java.security.Provider; public final class JSSEProvider extends Provider { public JSSEProvider() { super("HarmonyJSSE", 1.0, "Harmony JSSE Provider"); AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() { public Void run() { put("SSLContext.TLS", "org.apache.harmony.xnet.provider.jsse.SSLContextImpl"); put("Alg.Alias.SSLContext.TLSv1", "TLS"); put("KeyManagerFactory.X509", "org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl"); put("TrustManagerFactory.X509", "org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl"); return null; } }); } }
[ "omairriqbal@gmail.com" ]
omairriqbal@gmail.com
a8c777beabb70ef7b7da7cc857a17d938d40d2bf
e210296c73c5d08326354a05768f701c04bbd291
/src/main/java/com/absmis/controller/enterprise/AdminController.java
9dc2dc5a4ff90ecdcd2cfb1672d4d0812310a5cd
[ "MIT" ]
permissive
XXBM/absmisTest
8996371a2fd3c0cc9f77a3023ec9d5093cca7102
0578f37f24a679a6eabf00a7219153bbc083d43c
refs/heads/master
2020-03-07T04:03:52.489243
2018-03-29T07:51:48
2018-03-29T07:51:48
127,255,273
0
0
MIT
2018-03-29T07:51:49
2018-03-29T07:39:02
null
UTF-8
Java
false
false
3,860
java
package com.absmis.controller.enterprise; import com.absmis.domain.enterprise.Admin; import com.absmis.service.authority.RoleService; import com.absmis.service.enterprise.AdminService; import com.absmis.service.enterprise.CheckedStatusService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.domain.Specification; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; import java.util.Map; @RestController public class AdminController { @Autowired AdminService adminService; @Autowired RoleService roleService; @Autowired CheckedStatusService checkedStatusService; //根据企业名称模糊查询 @RequestMapping(value = "/queryAdminByName", method = RequestMethod.GET) public Map<String, Object> queryAdminByName( @RequestParam(value = "nameQuery") String query, @RequestParam(value = "page") Integer page, @RequestParam(value = "rows") Integer size)throws Exception { Pageable pageable = new PageRequest(page-1,size); Specification<Admin> specification = this.adminService.queryName(query); Page<Admin> list = this.adminService.findBySepc(specification,pageable); Map<String, Object> map = new HashMap<String, Object>(); int total = this.adminService.findBySepc(specification).size(); map.put("total", total); map.put("rows", list.getContent()); return map; } //添加 @RequestMapping(value = "/addAdmin", method = RequestMethod.POST) public Map<String, Object> addAdmin(@RequestBody Admin admin)throws Exception { admin.setPassword(admin.getUsername()); admin.setRole(roleService.findOne((long)1)); this.adminService.addAdmin(admin); Map<String, Object> map = new HashMap<String, Object>(); map.put("admin", admin); return map; } /** * 获取到所有 */ @RequestMapping(value = "/findAllAdmins", method = RequestMethod.GET) public List<Admin> findAdmin()throws Exception { List<Admin> admins = adminService.findAllT(); return admins; } //实现分页 @RequestMapping(value = "/displayAllAdmins", method = RequestMethod.GET) public Map<String, Object> findAllAdmin(@RequestParam(value = "page") Integer page, @RequestParam(value = "rows") Integer size)throws Exception { Page<Admin> list = this.adminService.findAllT(new PageRequest(page - 1, size)); Map<String, Object> map = new HashMap<String, Object>(); int total = this.adminService.findAllT().size(); map.put("total", total); map.put("rows", list.getContent()); return map; } //修改学院信息 完成 改 @RequestMapping(value = "/updateAdmin", method = RequestMethod.PUT) public Map<String, Object> updateAdmin(@RequestBody Admin admin)throws Exception { this.adminService.updateAdmin(admin); Map<String, Object> map = new HashMap<String, Object>(); map.put("admin", admin); return map; } //删除一个学院 完成 删 @RequestMapping(value = "/deleteAdmin", method = RequestMethod.DELETE) public void deleteAdmin(@RequestParam("id") Long id)throws Exception { this.adminService.deleteAdmin(id); } //批量删除 完成 删 @RequestMapping(value = "/deleteAdmins",method = RequestMethod.DELETE) public void deleteAdmins(@RequestParam("ids") String ids){ String deleteIds[] = ids.split(","); for(int i = 0; i<deleteIds.length; i++){ this.adminService.deleteById(Long.parseLong(deleteIds[i])); } } }
[ "1961346638@qq.com" ]
1961346638@qq.com
d60143677ab3a6a740d09d31bd4c0620772936f6
bec99e98e6f2618c9196f58c9942f71d38f61350
/11automaton/src/gui/policies/CustomConnectionEditPolicy.java
99b76709b25bb18889326419771a55919cbbf752
[]
no_license
SnowOnion/automataprojectexam
7b3483b0289395672510002ef2d89b5d98c62f61
c7567658d3647cc96d5de09775c4ff47b3209e69
refs/heads/master
2016-09-14T06:15:24.599534
2010-01-24T15:10:23
2010-01-24T15:10:23
57,400,712
1
0
null
null
null
null
UTF-8
Java
false
false
671
java
package gui.policies; import gui.commands.DeleteConnectionCommand; import gui.model.AbstractConnectionModel; import org.eclipse.gef.commands.Command; import org.eclipse.gef.editpolicies.ConnectionEditPolicy; import org.eclipse.gef.requests.GroupRequest; public class CustomConnectionEditPolicy extends ConnectionEditPolicy { @Override protected Command getDeleteCommand(GroupRequest request) { DeleteConnectionCommand command = new DeleteConnectionCommand(); command.setConnectionModel(getHost().getModel()); command.setContentsModel(((AbstractConnectionModel) getHost() .getModel()).getSource().getParent()); return command; } }
[ "WilliamMa.WM@55acb992-dcb3-11de-9872-ef835a306e00" ]
WilliamMa.WM@55acb992-dcb3-11de-9872-ef835a306e00
8ea62e5574cedb3e3dde1cc89faef7900da79dcc
738f322fe4d59c8b74f6d4537875eb8535ea8918
/cc-sms-admin/src/main/java/com/bmac/ffan/common/persistence/dao/CcSysConfigMapper.java
cafb79eb9424bd640fe7db0d5984b1850c3c15e1
[]
no_license
gaoyphome/sms
bacdca0c99ad73d26b6999a37e8aba6f494fa6c3
e47de467b4ec436556686611a9226400e8a261dc
refs/heads/master
2020-04-05T18:09:17.228446
2018-11-13T14:36:26
2018-11-13T14:36:26
157,090,569
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.bmac.ffan.common.persistence.dao; import com.bmac.ffan.common.persistence.model.CcSysConfig; import com.baomidou.mybatisplus.mapper.BaseMapper; /** * <p> * Mapper 接口 * </p> * * @author stylefeng * @since 2017-11-18 */ public interface CcSysConfigMapper extends BaseMapper<CcSysConfig> { }
[ "1039524560@qq.com" ]
1039524560@qq.com
53f46d6913ab490afed507391f1c23628ccc6de5
4cde67c3355ee7bb74b98a0e934161c44c70eead
/ssm_01/src/main/java/com/itheima/test/TestSpring.java
518b2ebf7070838f26b5fe414ca13a356fd11f27
[]
no_license
mikasamikodu/java_project
678f9edcbdbb01b6484f032c721df3cd83ffe626
39af08ee7d0543fb1b8dba30b0cc1fec99345b0e
refs/heads/master
2022-12-27T22:17:55.784040
2020-12-18T13:03:30
2020-12-18T13:03:30
206,045,260
1
0
null
2022-12-16T02:51:17
2019-09-03T09:55:36
Python
UTF-8
Java
false
false
512
java
package com.itheima.test; import com.itheima.service.IAccountService; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class TestSpring { @Test public void test1(){ ApplicationContext as = new ClassPathXmlApplicationContext("classpath:applicationContext.xml"); IAccountService service = as.getBean("accountService", IAccountService.class); service.findAll(); } }
[ "sun@163.com" ]
sun@163.com
bb3063028a62604a5fcd99f1fefe8eecfbd57d79
d6e57d0df9490fbb9992fdbdf0137f68e020b957
/src/main/java/com/syndicate/tran/voucher/VoucherType.java
eab210938cc741e8e0e3f2b7d55824ee81a5b976
[]
no_license
itagikarvijay/syndicate
9d31cdc1aed18afba2714d749a845c1676aec167
37130264ea812b72f9d759b98fe3de32c3fd3a7f
refs/heads/master
2023-06-24T01:09:58.543715
2021-07-12T05:14:56
2021-07-12T05:14:56
334,174,189
0
0
null
null
null
null
UTF-8
Java
false
false
819
java
package com.syndicate.tran.voucher; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @EqualsAndHashCode @NoArgsConstructor @Entity @Table(name = "voucher_type") public class VoucherType implements Serializable { /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Long id; @Column(name = "name") private String name; @Column(name = "goods_move") private String goodsMove; }
[ "itagikarv@gmail.com" ]
itagikarv@gmail.com
f2cee1a0c462a093753a7820bc0ab06820a17f2a
e495c08e723d56d1109b6d5e298f31fac4d473af
/src/test/java/eu/andreirusu/daw/cardb/Daw07aApplicationTests.java
50bb5fd1d065071e31fdcad0700781bed66c3143
[]
no_license
andrei-rusu-teach/exemplu01-jpa-restful
660259b37a463daec596311c47468a9d55148b82
3aa7691b33448d80adceaa60987080fd5915f9d0
refs/heads/master
2022-04-23T01:23:39.387961
2020-04-01T11:30:21
2020-04-01T11:30:21
255,592,818
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package eu.andreirusu.daw.cardb; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class Daw07aApplicationTests { @Test void contextLoads() { } }
[ "andrei.rusu.teach@gmail.com" ]
andrei.rusu.teach@gmail.com
22d1d46e7995193ca1c77191dd380287be21b8d3
90de9f031802caa3a761ad0434886279ca6d11b8
/spring/anjireddy/IOC/Autowire/src/Profile_Annotation.java
7de5e0aa9a5670f571a11d1e55015920d204bbc2
[]
no_license
amitPrasadGithub/painprojects
957aabb9586c57b154f3df4c19bdfdb2021c34e5
7831abe6b2a2e5652c1f59d1aeac920a6cb7a773
refs/heads/master
2022-06-19T00:26:46.335876
2022-05-17T20:27:48
2022-05-17T20:27:48
194,439,318
0
0
null
2022-03-31T20:02:23
2019-06-29T18:58:47
JavaScript
UTF-8
Java
false
false
185
java
public class Profile_Annotation { private Student_Annotation s1; public Student_Annotation getS1() { return s1; } public void setS1(Student_Annotation s1) { this.s1 = s1; } }
[ "amitprasad797@gmail.com" ]
amitprasad797@gmail.com
f25e3fbbf55b79548dad893f78ba64509e00c500
b924ba9f2d74f1063309277bff9fb0938227348d
/app/src/main/java/com/example/vishal/firebase_database_app/MainActivity.java
866efb498172f3ecdca042681149d16c08054992
[]
no_license
PradeepBaipadithaya/FireBase-Databse_Insert-Update-Delete
dcd6be2214803d9a642bfc86bd581254e7f583c8
0b4ba70758ed739297028c7114dee1fb7d69bf8b
refs/heads/master
2023-03-19T06:57:55.542003
2018-03-28T10:21:42
2018-03-28T10:21:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,024
java
package com.example.vishal.firebase_database_app; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class MainActivity extends AppCompatActivity { private TextView TXT_DISPLAY; private EditText EDT_NAME; private EditText EDT_EMAIL; private Button BTN_SAVE; public static String TAG = MainActivity.class.getSimpleName(); private DatabaseReference FIRE_DB; private FirebaseDatabase FIRE_INSTANCE; private String USER_ID; private Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); TXT_DISPLAY = (TextView) findViewById(R.id.txt_user); EDT_NAME = (EditText) findViewById(R.id.name); EDT_EMAIL = (EditText) findViewById(R.id.email); BTN_SAVE = (Button) findViewById(R.id.btn_save); FIRE_INSTANCE = FirebaseDatabase.getInstance(); FIRE_DB = FIRE_INSTANCE.getReference("user"); FIRE_INSTANCE.getReference("app_title").setValue("Realtime Database"); FIRE_INSTANCE.getReference("app_title").addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Toast.makeText(getApplicationContext(), "App title Updateed", Toast.LENGTH_SHORT).show(); String titile = dataSnapshot.getValue(String.class); ab.setTitle(titile); } @Override public void onCancelled(DatabaseError databaseError) { Toast.makeText(getApplicationContext(), "Failed : " + databaseError.toException(), Toast.LENGTH_SHORT).show(); } }); BTN_SAVE.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(TextUtils.isEmpty(USER_ID)){ Create_User(EDT_NAME.getText().toString().trim(), EDT_EMAIL.getText().toString().trim()); }else{ Update_User(EDT_NAME.getText().toString().trim(), EDT_EMAIL.getText().toString().trim()); } } }); } private void Create_User(String name, String email) { if (TextUtils.isEmpty(USER_ID)) { USER_ID = FIRE_DB.push().getKey(); } User user = new User(name, email); FIRE_DB.child(USER_ID).setValue(user); Add_UserChangeListner(); } private void Add_UserChangeListner(){ FIRE_DB.child(USER_ID).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { User user = dataSnapshot.getValue(User.class); if(user==null){ Toast.makeText(getApplicationContext(),"User Data is Null",Toast.LENGTH_SHORT).show(); } TXT_DISPLAY.setText(user.getName()+", "+user.getEmail()); EDT_NAME.setText(""); EDT_EMAIL.setText(""); toggleButton(); for(DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()){ int i =1; User user1 = dataSnapshot.getValue(User.class); Log.i("--DISPLAY DATA : "+i, user1.getName()+" : "+user1.getEmail()); i++; } } @Override public void onCancelled(DatabaseError databaseError) { Toast.makeText(getApplicationContext(),databaseError.toException().toString(),Toast.LENGTH_SHORT).show(); } }); } private void Update_User(String name, String email) { // updating the user via child nodes if (!TextUtils.isEmpty(name)) FIRE_DB.child(USER_ID).child("name").setValue(name); if (!TextUtils.isEmpty(email)) FIRE_DB.child(USER_ID).child("email").setValue(email); } private void toggleButton() { if (TextUtils.isEmpty(USER_ID)) { BTN_SAVE.setText("Save"); } else { BTN_SAVE.setText("Update"); } } }
[ "vishal.tarsariya@gmail.com" ]
vishal.tarsariya@gmail.com
c489ee2b9cdb7715db9662185fa1733e770860c2
83ef14c068afe68f26cabc96b8c6e5ffe62040fc
/src/main/java/com/codeschool/service/PersonService.java
93f28c70c1d6fb3426ddb04006d4bbf311ec8048
[]
no_license
Mitsoloth/iot
270609b29464e496d02f0586762d695e9438df2a
e936b96c5e7706e57d2f6d704cfcf65c02961f2c
refs/heads/master
2020-03-07T18:07:34.455388
2018-04-18T22:01:33
2018-04-18T22:01:33
127,628,931
0
0
null
null
null
null
UTF-8
Java
false
false
377
java
package com.codeschool.service; import java.util.List; import com.codeschool.entities.Person; public interface PersonService { Person findByEmail(String email); Person findById(int id); Person save(Person p); void delete(Long id); void delete(Person p); List<Person> findAll(); List<Person> findAllAdmins(); List<Person> findAllUsers(); }
[ "karalisalexandros@gmail.com" ]
karalisalexandros@gmail.com
900439f1650c5ea7e3421c02f64ce254a5e7012a
82d2056f7ce30dac3619af8417c0608847acc7f9
/LSDProjectBackend/src/main/java/testLog4j.java
f0b0fbd60be7c9e56c9655de4af37920524dfc55
[]
no_license
KLMM-LSD/LSD-Backend
52ffa2ccdd79a769b55f494bc5ff22953eade426
97ddeed5f089f2685aded5dd5437bd236b6d65be
refs/heads/master
2021-08-06T07:00:18.739743
2019-01-08T13:22:05
2019-01-08T13:22:05
147,182,220
0
0
null
2018-10-19T15:48:32
2018-09-03T09:27:18
Java
UTF-8
Java
false
false
744
java
import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; /* * 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. */ /** * * @author Micha */ public class testLog4j { private static final Logger logger = Logger.getLogger(testLog4j.class); public static void main(String[] args) { // BasicConfigurator.configure(); PropertyConfigurator.configure("log4j.properties"); logger.info("HEJSA!"); logger.info("I LOG!"); String bob = "BOB!"; logger.debug(bob); logger.info(1234567891); } }
[ "Michael_veilis@hotmail.com" ]
Michael_veilis@hotmail.com
812ef2cb5bc36633d5f3f14f107791227b971581
b5d61d1c2274c86420b675bb6ff76f4b03b679d9
/SpringMVC/src/main/java/com/ghc/web/form/ContactGrid.java
5324de38ece60bd592cfc624dac0e0d712a78080
[]
no_license
GHC124/ghc-spring3-mvc
605405c32dbd11a679e6998063be8efdb66c9525
fb4ed2e18fd450b2948060b1926ec3d2446cbc52
refs/heads/master
2020-05-04T04:02:15.888712
2014-04-18T06:56:30
2014-04-18T06:56:30
32,356,741
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package com.ghc.web.form; import java.util.List; import com.ghc.domain.Contact; public class ContactGrid { private int mTotalPages; private int mCurrentPage; private long mTotalRecords; private List<Contact> mContactData; public int getTotalPages() { return mTotalPages; } public void setTotalPages(int totalPages) { mTotalPages = totalPages; } public int getCurrentPage() { return mCurrentPage; } public void setCurrentPage(int currentPage) { mCurrentPage = currentPage; } public long getTotalRecords() { return mTotalRecords; } public void setTotalRecords(long totalRecords) { mTotalRecords = totalRecords; } public List<Contact> getContactData() { return mContactData; } public void setContactData(List<Contact> contactData) { mContactData = contactData; } }
[ "chung.pv0795@gmail.com@eef8b6ff-c2c4-6a66-5369-c78c4781f9cb" ]
chung.pv0795@gmail.com@eef8b6ff-c2c4-6a66-5369-c78c4781f9cb
490f779fa83fbb088cee37760bad9a7b6d38b160
5ac09b40a3500586d1d51caa7409b94c19833688
/Java/src/test/java/RelationshipTest.java
8e467d06e56e4689fce508cdd4367052ca099b7b
[]
no_license
Penjiboy/family-tree
69ca6fad21a2f6b5be4cfefa546012559e3c0541
9a7a5d4cbf4993c76760d465bd86e29d00ce39d1
refs/heads/master
2021-07-09T09:24:53.979023
2018-05-21T14:28:20
2018-05-21T14:28:20
108,645,828
0
0
null
null
null
null
UTF-8
Java
false
false
7,745
java
//package test.java; //import main.java.Member; //import main.java.Relationship; import org.junit.Test; import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; //import static Relationship.Relation.*; //import static main.java.Relationship.Relation.*; import static org.junit.Assert.*; public class RelationshipTest { /** * Generate some members * @return a set containing the generated members */ private Set<Member> generateMembers() { String male = "male"; String female = "female"; Date genericDate = new Date(1,1,1); Member me = new Member("Me Fam"); me.setGender(male); me.setDateOfDeath(genericDate); me.setDateOfBirth(genericDate); Member mom = new Member("Mom Fam"); mom.setGender(female); mom.setDateOfBirth(genericDate); mom.setDateOfDeath(genericDate); Member dad = new Member("Dad Fam"); dad.setGender(male); dad.setDateOfDeath(genericDate); dad.setDateOfBirth(genericDate); Member brother = new Member("Brother Fam"); brother.setGender(male); brother.setDateOfBirth(genericDate); brother.setDateOfDeath(genericDate); Member sister = new Member("Sister Fam"); sister.setGender(female); sister.setDateOfDeath(genericDate); sister.setDateOfBirth(genericDate); Member momsBrother = new Member("MomsBrother Fam"); momsBrother.setGender(male); momsBrother.setDateOfBirth(genericDate); momsBrother.setDateOfDeath(genericDate); Member momsBrothersSon = new Member("MomsBrothersSon Fam"); momsBrothersSon.setGender(male); momsBrothersSon.setDateOfDeath(genericDate); momsBrothersSon.setDateOfBirth(genericDate); Member momsSister = new Member("MomsSister Fam"); momsSister.setGender(female); momsSister.setDateOfBirth(genericDate); momsSister.setDateOfDeath(genericDate); Member momsDad = new Member("MomsDad Fam"); momsDad.setGender(male); momsDad.setDateOfDeath(genericDate); momsDad.setDateOfBirth(genericDate); Member momsMom = new Member("MomsMom Fam"); momsMom.setGender(female); momsMom.setDateOfBirth(genericDate); momsMom.setDateOfDeath(genericDate); Member dadsMom = new Member("DadsMom Fam"); dadsMom.setGender(female); dadsMom.setDateOfDeath(genericDate); dadsMom.setDateOfBirth(genericDate); Member dadsDad = new Member("DadsDad Fam"); dadsDad.setGender(male); dadsDad.setDateOfBirth(genericDate); dadsDad.setDateOfDeath(genericDate); //build relationships me.addParent(mom); me.addParent(dad); me.addSibling(brother); me.addSibling(sister); brother.addParent(mom); sister.addParent(mom); brother.addParent(dad); sister.addParent(dad); brother.addSibling(sister); mom.addSibling(momsBrother); mom.addSibling(momsSister); momsBrother.addChild(momsBrothersSon); momsBrother.addSibling(momsSister); momsBrother.addParent(momsDad); momsBrother.addParent(momsMom); momsSister.addParent(momsDad); momsSister.addParent(momsMom); mom.addParent(momsDad); mom.addParent(momsMom); mom.addSpouse(dad); momsDad.addSpouse(momsMom); dad.addParent(dadsDad); dad.addParent(dadsMom); dadsDad.addSpouse(dadsMom); //Add these members to the set Set<Member> family = new HashSet<Member>(); family.add(me); family.add(mom); family.add(dad); family.add(brother); family.add(sister); family.add(momsBrother); family.add(momsBrothersSon); family.add(momsSister); family.add(momsDad); family.add(momsMom); family.add(dadsDad); family.add(dadsMom); return family; } @Test public void checkCurrentRowTest1() { //Create members Set<Member> family = generateMembers(); Set<Member> temp = family.parallelStream() .filter(member -> member.getName().fullName.contentEquals("Me Fam")) .collect(Collectors.toSet()); Member me = null; for(Member member: temp) me = member; temp = family.parallelStream() .filter(member -> member.getName().fullName.contentEquals("MomsBrothersSon Fam")) .collect(Collectors.toSet()); Member momsBrothersSon = null; for(Member member: temp) momsBrothersSon = member; Relationship relationship = Relationship.createRelationship(me, momsBrothersSon); assertEquals(Relationship.Relation.cousin, relationship.determineRelationship()); //check inverse relationship assertEquals(Relationship.Relation.cousin, relationship.findInverseRelationship().relation); } @Test public void checkCurrentRowTest2() { Set<Member> family = generateMembers(); Set<Member> temp = family.parallelStream() .filter(member -> member.getName().fullName.contentEquals("Dad Fam")) .collect(Collectors.toSet()); Member dad = null; for(Member member: temp) dad = member; temp = family.parallelStream() .filter(member -> member.getName().fullName.contentEquals("MomsBrother Fam")) .collect(Collectors.toSet()); Member momsBrother = null; for(Member member: temp) momsBrother = member; Relationship relationship = Relationship.createRelationship(dad, momsBrother); assertEquals(Relationship.Relation.brotherInLaw, relationship.determineRelationship()); //check inverse relationship assertEquals(Relationship.Relation.brotherInLaw, relationship.findInverseRelationship().relation); } @Test public void checkRowAboveTest1() { Set<Member> family = generateMembers(); Set<Member> temp = family.parallelStream() .filter(member -> member.getName().fullName.contentEquals("Me Fam")) .collect(Collectors.toSet()); Member me = null; for(Member member: temp) me = member; temp = family.parallelStream() .filter(member -> member.getName().fullName.contentEquals("MomsBrother Fam")) .collect(Collectors.toSet()); Member momsBrother = null; for(Member member: temp) momsBrother = member; Relationship relationship = Relationship.createRelationship(me, momsBrother); assertEquals(Relationship.Relation.uncle, relationship.determineRelationship()); //check for inverse relationship assertEquals(Relationship.Relation.nephew, relationship.findInverseRelationship().relation); } @Test public void checkRowBelowTest1() { Set<Member> family = generateMembers(); Set<Member> temp = family.parallelStream() .filter(member -> member.getName().fullName.contentEquals("DadsDad Fam")) .collect(Collectors.toSet()); Member dadsDad = null; for(Member member: temp) dadsDad = member; temp = family.parallelStream() .filter(member -> member.getName().fullName.contentEquals("MomsBrothersSon Fam")) .collect(Collectors.toSet()); Member momsBrothersSon = null; for(Member member: temp) momsBrothersSon = member; Relationship relationship = Relationship.createRelationship(dadsDad, momsBrothersSon); assertEquals(Relationship.Relation.unrelated, relationship.determineRelationship()); //check inverse relationship assertEquals(Relationship.Relation.unrelated, relationship.findInverseRelationship().relation); } }
[ "chavulapenjani@gmail.com" ]
chavulapenjani@gmail.com
ede0822a82ad9dca9294bb560975904698f6452f
b079df7c032104fa4eb26db0163033cb419aa3f7
/Design-Patterns/DesignPattern/src/com/arbonkeep/factory/abstractfactory/pizzastore/pizza/BJPepperPiiza.java
bd897f5cd08c5fd5dc88e34dfe76d99e7696a6cb
[]
no_license
Arbonkeep/Java-Desisgn-Patterns
d540aef8260d1c68379ae2afc24a4b841f0bf66f
56fe526d93647e0a6ff56a8135f4aab72fe1bc2b
refs/heads/master
2020-08-10T00:18:49.926650
2019-10-31T08:00:29
2019-10-31T08:00:29
214,208,325
0
0
null
null
null
null
GB18030
Java
false
false
292
java
package com.arbonkeep.factory.abstractfactory.pizzastore.pizza; public class BJPepperPiiza extends Pizza { @Override public void prepare() { // TODO Auto-generated method stub setName("北京的胡椒披萨"); System.out.println("为制作北京的胡椒披萨准备材料"); } }
[ "1099817148@qq.com" ]
1099817148@qq.com
f9801a819106d95086f867d67ac00c9ff090959a
d654590ad9962cf5a039ed9da7ae892edb01bd2e
/test-cassandra-client/src/main/java/fr/an/testcassandracli/AppMain.java
a9b6ceeaab65dfd7c2492efd3f626a5a3db47b84
[]
no_license
Arnaud-Nauwynck/test-snippets
d3a314f61bddaeb6e6a5ed3fafd1932c72637f1d
a088bc1252bc677fbc70ee630da15b0a625d4a46
refs/heads/master
2023-07-19T15:04:38.067591
2023-07-09T14:55:50
2023-07-09T14:55:50
6,697,535
9
19
null
2023-03-02T00:25:17
2012-11-15T00:52:21
JavaScript
UTF-8
Java
false
false
909
java
package fr.an.testcassandracli; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.core.Session; public class AppMain { public static void main(String[] args) { new AppMain().run(); } public void run() { // Connect to the cluster and keyspace "myks" Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build(); Session session = cluster.connect("myks"); System.out.println("connected to Cassandra localhost"); // execute some queries... ResultSet results = session.execute("SELECT * FROM T1 WHERE f1=0"); for (Row row : results) { int f1 = row.getInt("f1"); int f2 = row.getInt("f2"); String f3 = row.getString("f3"); String f4 = row.getString("f4"); System.out.println("row f1:" + f1 + ", f2:" + f2 + ", f3:'" + f3 + "', f4:'" + f4 + "'"); } } }
[ "arnaud.nauwynck@gmail.com" ]
arnaud.nauwynck@gmail.com
d51aea60efab625831b105f04f2d8d8d56f75995
85cf8ac1b1611455df081040e7fe3fdb9138cbfc
/src/main/java/com/bcb/domain/entity/FinancingConfigCommonQuestion.java
3cedfd643b8a45f7cc40643bc7cc5d8d3dddf23a
[]
no_license
huxinxing/dl_work_hf
5efbcfd6f05298ac09835bf57deb3457cc193ff6
cf77f007ec772ee0617e03752c95fdd197f9e280
refs/heads/master
2020-04-29T18:57:05.004431
2019-03-18T17:48:01
2019-03-18T17:48:01
176,338,966
0
0
null
null
null
null
UTF-8
Java
false
false
1,448
java
package com.bcb.domain.entity; import lombok.Data; import org.omg.CORBA.INTERNAL; import javax.persistence.*; import java.math.BigDecimal; import java.sql.Timestamp; @Entity @Data @Table(name = "financing_config_common_question") public class FinancingConfigCommonQuestion { public static Integer CONFIG_COMMON_QUESTION_ONE = 1; //常见问题配置 1 登录注册: public static Integer CONFIG_COMMON_QUESTION_TWO = 2; //常见问题配置 2 账户安全: public static Integer CONFIG_COMMON_QUESTION_THREE = 3; //常见问题配置 3 充值投资: public static Integer CONFIG_COMMON_QUESTION_FOUR = 4; //常见问题配置 4 提现 : public static Integer CONFIG_COMMON_QUESTION_FIVE = 5; //常见问题配置 5 费用: public static Integer CONFIG_COMMON_QUESTION_SIX = 6; //常见问题配置 6 资产: @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column( name = "ccq_id") private Integer ccqId; @Column( name = "ccq_type") private Integer ccqType; @Column( name = "ccq_title") private String ccqTitle; @Column( name = "ccq_question") private String ccqQuestion; @Column( name = "ccq_weight") private Integer ccqWeight; @Column( name = "ccq_lang") private String ccqLang; @Column( name = "ccq_lang_ascription") private Integer ccqLangAscription; @Column( name = "ccq_create_time") private Timestamp ccqCreateTime; }
[ "1163168856@qq.com" ]
1163168856@qq.com
84ff822adc749a33f9ad93bbe4ed6557f8769c9f
eb292c67d5757af3248e7fa3f6c5ea4f3af93f5b
/app/src/main/java/edu/rose_hulman/weih/forsport/UserAdapter.java
f1e817a28709f51f0e274df7438c8e45fc5f27af
[]
no_license
viking799/ForSport
5120fcc2b5a1dc5893c20d3664225396b52e5367
e44b53e9b91d55fa41a07c377c41292e5f2e4989
refs/heads/master
2020-06-24T07:00:41.059545
2017-08-16T02:23:37
2017-08-16T02:23:37
95,911,564
0
0
null
null
null
null
UTF-8
Java
false
false
5,217
java
package edu.rose_hulman.weih.forsport; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.TextView; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import java.util.ArrayList; import java.util.List; /** * Created by Administrator on 2017/7/22. */ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder>{ private List<User> mUsers; private FragmentsEventListener mListener; private Context mContext; private String mtype; private int musertype; private DatabaseReference mRef; public UserAdapter(FragmentsEventListener listener, Context context, String Sporttype, int usertype) { mListener = listener; mContext = context; mUsers = new ArrayList<>(); mtype = Sporttype; musertype = usertype; mRef = FirebaseDatabase.getInstance().getReference().child("users"); mRef.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { User temp = dataSnapshot.getValue(User.class); temp.setID(dataSnapshot.getKey()); mUsers.add(temp); notifyDataSetChanged(); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(DatabaseError databaseError) { } }); } @Override public UserAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.coach_row_view, parent, false); return new UserAdapter.ViewHolder(view, musertype); } @Override public int getItemCount() { return mUsers.size(); } @Override public void onBindViewHolder(final UserAdapter.ViewHolder holder, int position) { final User mt = mUsers.get(position); holder.mTV.setText(mt.getName()); holder.eTV.setText(mt.getEmail()); holder.pTV.setText(mt.getPhonenum()); if(mt.getGender().equals("M")){ holder.gTV.setText(R.string.Male); }else{ holder.gTV.setText(R.string.Female); } if(mt.getImage()!= null){ holder.iV.setImageBitmap(mt.getImage()); }else { StorageReference imagerf = FirebaseStorage.getInstance().getReference().child("users").child(String.valueOf(mt.getID()) + ".png"); final long ONE_MEGABYTE = 1024 * 1024; imagerf.getBytes(ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>() { @Override public void onSuccess(byte[] bytes) { Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); holder.iV.setImageBitmap(bitmap); mt.setImage(bitmap); notifyDataSetChanged(); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { Log.e("SSS", exception.toString()+ "?"+ mt.getID()); } }); } } class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView mTV; private TextView eTV; private ImageView iV; private TextView pTV; private TextView gTV; public ViewHolder(View itemView, int musertype) { super(itemView); mTV = (TextView) itemView.findViewById(R.id.name_text_view); eTV = (TextView) itemView.findViewById(R.id.email_text_view); iV = (ImageView) itemView.findViewById(R.id.coa_image_view); pTV = (TextView) itemView.findViewById(R.id.phone_text_view); gTV = (TextView) itemView.findViewById(R.id.gen_text_view); itemView.setOnClickListener(this); } @Override public void onClick(View view) { mListener.onUserSelect(mUsers.get(getAdapterPosition())); } } }
[ "weih@rose-hulman.edu" ]
weih@rose-hulman.edu
63baa6f9e83ac309c5f356df78b8a2643598db40
1a5250429a7faac815629e22a8e773b0607bc5e2
/src/main/java/robertmora/rivamvc/controllers/AptController.java
1861f9fd8f304ad772f392532285f6176798e8d7
[]
no_license
MoraRobert/RivaMVC
aab5a055a9d5f638609a3d7d71ab119e6de8d7fe
da4903267d7679f895f59b1d74f5ebd7bb692058
refs/heads/master
2020-05-18T19:50:59.781570
2019-04-26T15:26:07
2019-04-26T15:26:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,503
java
package robertmora.rivamvc.controllers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import robertmora.rivamvc.models.Apartment; import robertmora.rivamvc.models.Category; import robertmora.rivamvc.models.data.ApartmentDao; import robertmora.rivamvc.models.data.CategeoryDao; import javax.validation.Valid; import java.util.List; import java.util.Optional; @Controller @RequestMapping("apartment") public class AptController { @Autowired ApartmentDao aptDao; @Autowired CategeoryDao categeoryDao; // Request path: /apartment @RequestMapping(value = "") public String index(Model model) { model.addAttribute("apartments", aptDao.findAll()); model.addAttribute("title", "My Apartments"); return "apartment/index"; } @RequestMapping(value = "add", method = RequestMethod.GET) public String displayAddApartmentForm(Model model) { model.addAttribute("title", "Add apartment"); model.addAttribute(new Apartment()); model.addAttribute("categories", categeoryDao.findAll()); return "apartment/add"; } @RequestMapping(value = "add", method = RequestMethod.POST) public String processAddAparmentForm(@ModelAttribute @Valid Apartment newApt, Errors errors, @RequestParam(required = false) Integer categoryId, Model model) { if (errors.hasErrors()) { model.addAttribute("title", "Add Apartment"); model.addAttribute("categories", categeoryDao.findAll()); return "apartment/add"; } if (categoryId != null) { Optional<Category> result = categeoryDao.findById(categoryId); if (result.isPresent()) { Category cat = result.get(); newApt.setCategory(cat); } } aptDao.save(newApt); return "redirect:"; } @RequestMapping(value = "remove", method = RequestMethod.GET) public String displayRemoveApartmentForm(Model model) { model.addAttribute("apartments", aptDao.findAll()); model.addAttribute("title", "Remove Apartment"); return "apartment/remove"; } @RequestMapping(value = "remove", method = RequestMethod.POST) public String processRemoveApartmentForm(@RequestParam int[] aptIds) { // for (Apartment apt : apts) { // AptData.remove(apt.getId()); // } for (int id : aptIds) { //AptData.remove(id); //aptDao.delete(id); } return "redirect:"; } public String category(Model model, @RequestParam int id) { Optional<Category> result = categeoryDao.findById(id); if (result.isPresent()) { Category cat = result.get(); List<Apartment> aparts = cat.getApartments(); model.addAttribute("apartments", aparts); model.addAttribute("title", "Apartments in" + " this category: " + cat.getName()); } return "apartment/index"; } }
[ "robertmora@gmail.com" ]
robertmora@gmail.com
9a6798d5f91696e68ce94b48600d5dfaad0e4513
ed146e538a0b4a2f1e7ed7ddc27a33826b8c96b8
/SimpleCalculator/src/net/jcornelio/projects/calculator/util/SimpleOperationFactory.java
da30d3a8b4fa2d9cbbc19f59e9a994689def65ab
[]
no_license
JuanCornelioGuzman/astounding-adventure
3e9fe4147dba63a471604b0544ae6a0fc289f94c
a65e6f940dfc7d9f142309242c756803f44f8e99
refs/heads/master
2021-05-16T03:07:00.456487
2017-02-16T16:24:08
2017-02-16T16:24:08
19,778,110
0
0
null
null
null
null
UTF-8
Java
false
false
977
java
package net.jcornelio.projects.calculator.util; import net.jcornelio.projects.calculator.operation.*; /*************************************************** * @author: Juan Cornelio S. Guzman * @since: September 09, 2013 * @version: 1.0 **************************************************/ public class SimpleOperationFactory { public Operation createOperation(String operator){ Operation operation = null; if(Constants.OPERATOR[0].equals(operator)){ operation = new MultiplicationOperation(); }else if(Constants.OPERATOR[1].equals(operator)){ operation = new DivisionOperation(); }else if(Constants.OPERATOR[2].equals(operator)){ operation = new AdditionOperation(); }else if(Constants.OPERATOR[3].equals(operator)){ operation = new SubtractionOperation(); }else{ operation = new DefaultOperation(); } return operation; } }
[ "jcornelio.guzman@gmail.com" ]
jcornelio.guzman@gmail.com
7b0fe09a7e28a5588c99676b104a5403e7e567a0
7f9b7089199cfdcad9ed6b2b723578c5d0062db7
/xmls/src/main/java/org/coderearth/springrecipes/dictionaryapp/model/Dictionary.java
52fe6ff1521c06a08fb0585f665754ce024bcdaf
[]
no_license
patelkunal/spring-recipes
c1bd2e3fa432c28c6f4ec4fc514e5f846ee59364
016d6987607f8c9def6351f07ba3dbe226adf4ce
refs/heads/master
2021-01-10T05:24:13.704176
2015-12-08T05:18:48
2015-12-08T05:18:48
46,508,142
0
1
null
null
null
null
UTF-8
Java
false
false
2,290
java
package org.coderearth.springrecipes.dictionaryapp.model; import com.google.common.base.MoreObjects; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.stream.Stream; /** * Created by kunal_patel on 22/11/15. */ public class Dictionary { private Map<String, DictionaryEntry> dictionaryEntries = null; public Dictionary() { this.dictionaryEntries = new HashMap<>(); } public void addWord(final String aWord, String... meanings) { DictionaryEntry dictionaryEntry = this.dictionaryEntries.getOrDefault(aWord, new DictionaryEntry(aWord)); this.dictionaryEntries.put(aWord, dictionaryEntry.addMeanings(meanings)); } public Set<String> lookup(final String aWord) { return this.contains(aWord) ? this.dictionaryEntries.get(aWord).getMeanings() : null; } public boolean contains(final String aWord) { return this.dictionaryEntries.containsKey(aWord); } @Override public String toString() { return MoreObjects.toStringHelper(this).addValue(this.dictionaryEntries).toString(); } } class DictionaryEntry { private String word = null; private Set<String> meanings = null; public DictionaryEntry(String word) { this.word = word; this.meanings = new HashSet<>(); } public DictionaryEntry(String word, Set<String> meanings) { this.meanings = meanings; this.word = word; } public DictionaryEntry addMeaning(final String aMeaning) { this.meanings.add(aMeaning); return this; } public DictionaryEntry addMeanings(final String... aMeanings) { Stream.of(aMeanings).forEach(aMeaning -> this.addMeaning(aMeaning)); return this; } public Set<String> getMeanings() { return meanings; } public void setMeanings(Set<String> meanings) { this.meanings = meanings; } public String getWord() { return word; } @Override public String toString() { return MoreObjects.toStringHelper(this).addValue(this.getWord()).addValue(this.getMeanings()).toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DictionaryEntry that = (DictionaryEntry) o; return this.getWord().equals(that.getWord()); } @Override public int hashCode() { return this.getWord().hashCode(); } }
[ "kunal_patel@symantec.com" ]
kunal_patel@symantec.com
2a2afc498a9eb2724759f8c94c037585f9c56c3e
e30f36016a383e0803e0a7e2187b220183631128
/app/src/main/java/org/activiti/bpmn/converter/AssociationXMLConverter.java
617c290d8b25767a0986b050ae18a5ec5b6fa4ec
[ "Apache-2.0" ]
permissive
jaks6/WiseWare-BP-Engine
97bd63187a6e239e3ff41d289cee64180872c41c
d0762966ed5e80070f24f1a23fd847fdd961652e
refs/heads/master
2021-05-03T21:55:39.822589
2018-01-03T11:41:58
2018-01-03T11:41:58
71,568,788
0
0
null
null
null
null
UTF-8
Java
false
false
2,891
java
/* 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.activiti.bpmn.converter; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import org.activiti.bpmn.converter.util.BpmnXMLUtil; import org.activiti.bpmn.model.Association; import org.activiti.bpmn.model.AssociationDirection; import org.activiti.bpmn.model.BaseElement; import org.activiti.bpmn.model.BpmnModel; import org.apache.commons.lang3.StringUtils; /** * @author Tijs Rademakers */ public class AssociationXMLConverter extends BaseBpmnXMLConverter { public Class<? extends BaseElement> getBpmnElementType() { return Association.class; } @Override protected String getXMLElementName() { return ELEMENT_ASSOCIATION; } @Override protected BaseElement convertXMLToElement(XmlPullParser xtr, BpmnModel model) throws Exception { Association association = new Association(); BpmnXMLUtil.addXMLLocation(association, xtr); association.setSourceRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_SOURCE_REF)); association.setTargetRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_TARGET_REF)); association.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID)); String asociationDirectionString = xtr.getAttributeValue(null, ATTRIBUTE_ASSOCIATION_DIRECTION); if (StringUtils.isNotEmpty(asociationDirectionString)) { AssociationDirection associationDirection = AssociationDirection.valueOf(asociationDirectionString.toUpperCase()); association.setAssociationDirection(associationDirection); } parseChildElements(getXMLElementName(), association, model, xtr); return association; } @Override protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XmlSerializer xtw) throws Exception { Association association = (Association) element; writeDefaultAttribute(ATTRIBUTE_FLOW_SOURCE_REF, association.getSourceRef(), xtw); writeDefaultAttribute(ATTRIBUTE_FLOW_TARGET_REF, association.getTargetRef(), xtw); AssociationDirection associationDirection = association.getAssociationDirection(); if (associationDirection !=null) { writeDefaultAttribute(ATTRIBUTE_ASSOCIATION_DIRECTION, associationDirection.getValue(), xtw); } } @Override protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XmlSerializer xtw) throws Exception { } }
[ "jaks@ut.ee" ]
jaks@ut.ee
96ebd2248d252f84f9a21d5fab87412fac91a40b
a03c98055fe1b6e9f8c4dd71071e998f197433c2
/src/main/java/com/ethanyjxiao/shiro/AccountRealm.java
b99ac2d4b7e95c7f6823104fe9cb0737f4b9570d
[]
no_license
Bobo1553/vueblog
61476a6578284e858355462acfe7d9be596fdba4
6bc9745c52578e47f0d75b2efa61364cbcdf7111
refs/heads/main
2023-03-05T05:54:26.722760
2021-02-19T12:48:09
2021-02-19T12:48:09
339,473,552
0
0
null
null
null
null
UTF-8
Java
false
false
1,725
java
package com.ethanyjxiao.shiro; import com.ethanyjxiao.entity.User; import com.ethanyjxiao.service.UserService; import com.ethanyjxiao.util.JwtUtils; import org.apache.shiro.authc.*; import org.apache.shiro.authz.AuthorizationInfo; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * @author Xiao Yijia * @create 2021/2/18 0:18 */ @Component public class AccountRealm extends AuthorizingRealm { @Autowired JwtUtils jwtUtils; @Autowired UserService userService; @Override public boolean supports(AuthenticationToken token) { return token instanceof JwtToken; } @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { return null; } @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { JwtToken jwtToken = (JwtToken) token; String userId = jwtUtils.getClaimByToken((String) jwtToken.getPrincipal()).getSubject(); User user = userService.getById(userId); if (user == null) { throw new UnknownAccountException("账户不存在"); } else if (user.getStatus() == -1) { throw new LockedAccountException("账户已被锁定"); } AccountProfile accountProfile = new AccountProfile(); BeanUtils.copyProperties(user, accountProfile); return new SimpleAuthenticationInfo(accountProfile, jwtToken.getCredentials(), getName()); } }
[ "646851868@qq.com" ]
646851868@qq.com
6470212042282239c0bbf7eaa49819e81d9e629d
573a66e4f4753cc0f145de8d60340b4dd6206607
/JS-CS-Detection-byExample/Dataset (ALERT 5 GB)/362855/quickfix-1.7.0/quickfix-1.7.0/src/java/src/quickfix/field/LiquidityPctHigh.java
c3a279621c1ee9e501199011c833cdeda62dfebb
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
mkaouer/Code-Smells-Detection-in-JavaScript
3919ec0d445637a7f7c5f570c724082d42248e1b
7130351703e19347884f95ce6d6ab1fb4f5cfbff
refs/heads/master
2023-03-09T18:04:26.971934
2022-03-23T22:04:28
2022-03-23T22:04:28
73,915,037
8
3
null
2023-02-28T23:00:07
2016-11-16T11:47:44
null
UTF-8
Java
false
false
305
java
package quickfix.field; import quickfix.DoubleField; import java.util.Date; public class LiquidityPctHigh extends DoubleField { public static final int FIELD = 403; public LiquidityPctHigh() { super(403); } public LiquidityPctHigh(double data) { super(403, data); } }
[ "mmkaouer@umich.edu" ]
mmkaouer@umich.edu
e030a7a2878c17f55b67c29cb9031203939df402
8d6cdc565c5dcf46bb8171686cfedb555fb0fd86
/Wrapper/src/exer1/TestWrapper.java
8acf00ab481ee080dc693c4bb8c7aec4f29d2bdd
[]
no_license
ckong-start/javaseExer
6c82f85dafb2c6d842675e1dcb226edf19d937e2
a4afe07b3bf1d5849ff1c54066a41f1c2adbbc6b
refs/heads/master
2021-01-09T11:07:12.893988
2020-02-22T04:31:29
2020-02-22T04:31:32
242,276,633
0
0
null
null
null
null
UTF-8
Java
false
false
1,150
java
package exer1; import org.junit.Test; public class TestWrapper { @Test public void test4(){ String str = 4 + ""; System.out.println("str = " + str); char num1 = 'a'; Character c1 = new Character(num1); System.out.println("c1 = " + c1); Character c2 = c1.valueOf('b'); System.out.println("c2 = " + c2); char num2 = c2.charValue(); System.out.println("num2 = " + num2); } @Test public void test3(){ double num1 = 2.0; Double d1 = new Double(num1); System.out.println("d1 = " + d1); Double d2 = d1.valueOf(3.0); System.out.println("d2 = " + d2); double num2 = d2.doubleValue(); System.out.println("num2 = " + num2); } @Test public void test2(){ int num1 = 2; Integer i1 = new Integer(num1); System.out.println("i1 = " + i1); Integer i2 = i1.valueOf(3); System.out.println("i2 = " + i2); int num2 = i2.intValue(); System.out.println("num2 = " + num2); } @Test public void test1(){ int num1 = 3; String s1 = num1 + ""; String s2 = String.valueOf(num1); String s3 = Integer.toString(num1); int num2 = Integer.parseInt(s1); } }
[ "289128945@qq.com" ]
289128945@qq.com
8fa6e3cc5baaf1b0ed2725194c84bef30a33707c
a9a903ea4ea7acba97b811285c5cc10fdc3f6193
/sabot/kernel/src/main/java/com/dremio/exec/store/BlockBasedSplitGenerator.java
28f232d3aa05ddad4466b1730100c5fe3c28513b
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
satanson/dremio-oss
5647409448032d6d50aa7645b00bce9623957f6b
5d615463e5d468c589c0b91bd20cbf70db3bc581
refs/heads/master
2023-07-20T20:35:12.282424
2021-07-06T16:57:27
2021-07-06T16:57:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,113
java
/* * Copyright (C) 2017-2019 Dremio Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.dremio.exec.store; import java.util.ArrayList; import java.util.List; import com.dremio.exec.ExecConstants; import com.dremio.sabot.exec.context.OperatorContext; import com.dremio.service.namespace.dataset.proto.PartitionProtobuf; /** * Generates block based splits using SplitCreator */ public class BlockBasedSplitGenerator { private final SplitCreator splitCreator; private final long targetSplitSize; private long currentOffset; public BlockBasedSplitGenerator(SplitCreator splitCreator, OperatorContext context) { this.splitCreator = splitCreator; targetSplitSize = context.getOptions().getOption(ExecConstants.PARQUET_BLOCK_SIZE).getNumVal(); } public long getCurrentOffset() { return currentOffset; } public List<SplitAndPartitionInfo> getSplitAndPartitionInfo(int maxOutputCount, PartitionProtobuf.NormalizedPartitionInfo filePartitionInfo, String filePath, long offset, long fileSize, long currentModTime, String fileFormat, List<SplitIdentity> splitsIdentity, PartitionProtobuf.BlockLocationsList fileBlockLocations) { int splitCount = 0; currentOffset = offset; List<SplitAndPartitionInfo> splits = new ArrayList<>(); while (splitCount < maxOutputCount && currentOffset < fileSize) { long curBlockSize = Math.min(targetSplitSize, fileSize - currentOffset); SplitIdentity splitIdentity = new SplitIdentity(filePath, fileBlockLocations, currentOffset, curBlockSize); splits.add(splitCreator.createSplit(filePartitionInfo, splitIdentity, fileFormat, fileSize, currentModTime)); if (splitsIdentity != null) { splitsIdentity.add(splitIdentity); } currentOffset += curBlockSize; splitCount++; } return splits; } public interface SplitCreator { SplitAndPartitionInfo createSplit(PartitionProtobuf.NormalizedPartitionInfo filePartitionInfo, SplitIdentity splitIdentity, String fileFormat, long fileSize, long currentModTime); } }
[ "yongyan@dremio.com" ]
yongyan@dremio.com
473725de45a05aad4fd7646c97de25e4071368c3
1f18d3624b1d00d436f83b11ed2848840a3c2f04
/src/main/java/domain/notificacion/Mail.java
f8d586d43a45ef651d2c2e8885998a4ab48ed301
[]
no_license
fatiilluch/TP2019
0df7ab32d6e1c428f00475a4ff1596b74e9a1d8b
e7f58f401386e76cfafd4d2e0c3441bd3f6ce312
refs/heads/master
2022-05-29T22:58:02.003900
2019-12-15T19:17:08
2019-12-15T19:17:08
228,236,927
0
1
null
2022-05-20T21:19:45
2019-12-15T19:12:12
Java
ISO-8859-1
Java
false
false
1,974
java
package domain.notificacion; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import domain.Usuario; public class Mail extends Notificacion{ private static Mail instance = null; public static Mail getInstance(){ if(instance == null) instance = new Mail(); return instance; } public void enviarNotificacion(Usuario usuario,TipoNotificacion tipoNotificacion) { // Esto es lo que va delante de @gmail.com en tu cuenta de correo. String remitente = "dds.grupo1"; this.setTipoNotificacion(tipoNotificacion); Properties props = System.getProperties(); props.put("mail.smtp.host", "smtp.gmail.com"); //El servidor SMTP de Google props.put("mail.smtp.user", remitente); props.put("mail.smtp.clave", "1234abcd@"); //La clave de la cuenta props.put("mail.smtp.auth", "true"); //Usar autenticación mediante usuario y clave props.put("mail.smtp.starttls.enable", "true"); //Para conectar de manera segura al servidor SMTP props.put("mail.smtp.port", "587"); //El puerto SMTP seguro de Google Session session = Session.getDefaultInstance(props); MimeMessage message = new MimeMessage(session); try { message.setFrom(new InternetAddress(remitente)); message.addRecipients(Message.RecipientType.TO, usuario.getMail()); //Se podrían añadir varios de la misma manera message.setSubject(asunto); message.setText(cuerpo); Transport transport = session.getTransport("smtp"); transport.connect("smtp.gmail.com", remitente, "1234abcd@"); transport.sendMessage(message, message.getAllRecipients()); transport.close(); } catch (MessagingException me) { me.printStackTrace(); //Si se produce un error } } }
[ "fatilluch@gmail.com" ]
fatilluch@gmail.com
2d063b55c92558ca2598b85797aac0ba69a366d2
19f1e38ce71d8f4ac85ac9005786b816ddf06d24
/Java Basics/src/Inheritance/Parent_Multi.java
9bbfdb84acea9dfa9da6a6c5d887ad92b5bb57b6
[]
no_license
santoshmulik100/myfirstrepo_automation_framework
26b44faf93d8bba1fbcc4177aea929cee0e10882
4b594faa73a228618e3a43326585783c7e78004c
refs/heads/master
2023-06-19T21:20:50.990404
2021-07-17T06:04:33
2021-07-17T06:04:33
386,707,980
0
0
null
null
null
null
UTF-8
Java
false
false
188
java
package Inheritance; //MultiLevel Inheritance public class Parent_Multi extends GrandParent_Multi { int age_Parent=50; void m2_parent() { System.out.println("Parent Method"); } }
[ "santoshmulik100@gmail.com" ]
santoshmulik100@gmail.com
0a01f41f7138230b0aa745010c11c20928799c37
e7b43dd7c620314119a126053e1faf393bb72c72
/flightreservation/src/main/java/com/shivesh/flightreservation/services/ReservationService.java
9deaef143d4b6bc540096c440307a5e07f830f98
[]
no_license
shiveshkumarsuri/flight-res-and-chkIn-app
43f847ab03c42771ba347fc09636f1afa366d461
3fc2b1b1416ff783f0b9a5a622cb16953a1705ec
refs/heads/main
2023-06-11T01:48:00.546363
2021-07-04T01:41:57
2021-07-04T01:41:57
382,738,912
0
0
null
2021-07-04T01:41:58
2021-07-04T01:23:47
null
UTF-8
Java
false
false
271
java
package com.shivesh.flightreservation.services; import com.shivesh.flightreservation.dto.ReservationRequest; import com.shivesh.flightreservation.entities.Reservation; public interface ReservationService { public Reservation bookFlight(ReservationRequest request); }
[ "shiveshkumar34@gmail.com" ]
shiveshkumar34@gmail.com
097fab07060d589a25805e471e275b9767572014
252e11579b8f3ff8c4a60f9c07a692cc58e5936b
/Fox Driving/src/fox/driving/noTest.java
94e30f8366288d9d1f48cde6d007c8bc13674386
[]
no_license
garyliewhl/foxdriving
3a841386ca4f731fbbba2982b97e284e3598e7a3
66ad3ac8631a6d1ffefbd7ef8e13192b9e2b7b43
refs/heads/master
2020-09-16T20:02:35.929820
2019-11-25T06:25:31
2019-11-25T06:25:31
223,875,960
0
0
null
null
null
null
UTF-8
Java
false
false
2,948
java
package fox.driving; import java.text.*; import java.util.*; public class noTest{ Scanner s = new Scanner(System.in); public double pricePerClass; public int noOfClass; public String date; public String detailsOfDay = " "; public String time; public int noOfHours; public int totalHours = 0; public void noTest() { noOfClass = 0; date = " "; detailsOfDay = " "; time = " "; noOfHours = 1; totalHours = 0; pricePerClass = 18.00; System.out.println("------------------------------------------------------------------------"); System.out.println("You chosed category Test (RM18 per class)"); System.out.println("Each class is 1 hour"); System.out.println("------------------------------------------------------------------------"); System.out.println("Please select how many class you want. (At least 5 classes)"); noOfClass = s.nextInt(); while(noOfClass<5) { System.out.println("You must join at least 5 classes. Please try again: "); noOfClass = s.nextInt(); } s.nextLine(); for(int i=1; i<=noOfClass; i++){ DateFormat df = new SimpleDateFormat("dd/mm/yyyy"); df.setLenient(false); int datetrue; do{ datetrue = i; System.out.println("Please enter the date (dd/mm/yyyy):"); date = s.nextLine(); System.out.println("The date you have entered is: " + date + "\n"); try { Date d = new Date(); d=df.parse(date); } catch(ParseException e) { System.out.println("Unable to parse the date: " + date); datetrue=0; } }while(datetrue == 0); DateFormat tf = new SimpleDateFormat("hh:mm"); int timetrue; do{ timetrue = 1; System.out.println("Please enter the time you would like to start(in hh:mm 24 hour format)"); time = s.nextLine(); try{ Date t = new Date(); t=tf.parse(time); System.out.println("The time is " + time + "\n"); } catch(ParseException e) { System.out.println("Invalid time "); timetrue = 0; } }while (timetrue == 0); System.out.println("How mant hours you wiuld like to have on " + date); noOfHours = s.nextInt(); totalHours = totalHours + noOfHours; s.nextLine(); if(i<noOfClass){ detailsOfDay = detailsOfDay + "|\t\t\t\t\t\t\t |\n" + " You have class on " + date + " at " + time + "for 1 hour " + "\n|" + "\t\t\t\t\t\t\t |\n" + "----------------------------------------------" + "\n"; }else{ detailsOfDay = detailsOfDay + "|\t\t\t\t\t\t\t |\n" + " You have class on " + date + " at " + time + "for 1 hour " + "\n|" + "\t\t\t\t\t\t\t |\n" + "----------------------------------------------" + "\n"; } } System.out.println("---------------TIMETABLE FOR CLASSES---------------"); System.out.println(detailsOfDay); } }
[ "noreply@github.com" ]
noreply@github.com
44a3b9cacae91efe5f7ca852a319a10065cc583e
c6e817d9ff6b033676432cdfc1c85c0a15685df4
/app/src/androidTest/java/com/alura/notesapp/ExampleInstrumentedTest.java
27a958ac579b1ba77e6ffd8602877244679af736
[]
no_license
victorMontero/NotesApp
2f20de5f64ee1381354330ccf08fda27e67b3c73
e579625fbd7b65b8199e841729194c09aff9939d
refs/heads/master
2022-11-10T20:16:26.162320
2020-07-06T20:57:49
2020-07-06T20:57:49
263,609,230
0
0
null
null
null
null
UTF-8
Java
false
false
752
java
package com.alura.notesapp; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.alura.notesapp", appContext.getPackageName()); } }
[ "viiktoor@gmail.com" ]
viiktoor@gmail.com
c4f023265f5c370088c652c0be20943b1de5bc3f
9ba1449d31395eed2491475c6a900070f26a8ede
/app/src/main/java/com/example/Bean/ContactBean.java
851dd0e1a416ebed9d1798f8f731fbc2ff610f25
[]
no_license
liky0915/HelloWorld
7e7fdf041e02874a405825de1fa516375ec7982e
37793d1021d8efc826afec0cbdacdbc29c9d1341
refs/heads/master
2021-01-01T16:49:14.768828
2018-07-09T07:07:27
2018-07-09T07:07:27
97,929,334
0
1
null
null
null
null
UTF-8
Java
false
false
976
java
package com.example.Bean; /** * Created by lester.ding on 8/2/2017. */ public class ContactBean { public int contactImageResId; public String contactName, contactNumber; public ContactBean(int contactImageResId, String contactName, String contactNumber) { this.contactImageResId = contactImageResId; this.contactName = contactName; this.contactNumber = contactNumber; } public int getContactImageResId() { return contactImageResId; } public void setContactImageResId(int contactImageResId) { this.contactImageResId = contactImageResId; } public String getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName; } public String getContactNumber() { return contactNumber; } public void setContactNumber(String contactNumber) { this.contactNumber = contactNumber; } }
[ "polo83@qq.com" ]
polo83@qq.com
7009c03555f7499303d3dc95807aa0bac65f0edb
ec79acd76008819411c421d11082533a8eaf0a07
/geeks/src/arrays/FindElementRotateSortedArray.java
c9bf8da2fec3467d5e08781d48dfee3de43105bd
[]
no_license
pushkarchawda/geeksWorkspace
d11d1b517385aa36b8be535004c87b74be3f56b1
5cda4259e672c4990e28dc98ac955541213a9d21
refs/heads/master
2021-09-05T20:00:33.074985
2018-01-30T18:19:01
2018-01-30T18:19:01
106,571,191
0
0
null
null
null
null
UTF-8
Java
false
false
1,376
java
package arrays; public class FindElementRotateSortedArray { public static void main(String[] args) { int a[] = new int[]{4,5,1,2,3}; int search = 3; int x = pivotedBinarySearch(a,search); System.out.println("Element "+a[x]+" present at "+ x); } private static int pivotedBinarySearch(int[] a, int search) { int pivot = findPivot(a, 0, a.length-1); if(pivot == -1) return binarySearch(a, 0, a.length-1, search); if(a[pivot] == search) return pivot; else if(a[pivot] > search) { return binarySearch(a, pivot+1, a.length-1, search); } else return binarySearch(a, 0, pivot, search); } public static int binarySearch(int a[], int low, int high, int x) { int mid = 0; if(low<=high) { mid = (low + high) / 2; if(a[mid] == x) { return mid; } else if(a[mid] < x) { return binarySearch(a, mid+1, high, x); } else { return binarySearch(a, low, mid-1, x); } } return -1; } private static int findPivot(int[] a, int low, int high) { int mid = 0; if(low<=high) { mid = (low + high) / 2; if(a[mid] > a[mid+1]) { return mid; } else if(a[mid] < a[mid-1]) { return mid-1; } else if(a[mid] > a[low]) { return findPivot(a, mid + 1, high); } else { return findPivot(a, low, mid-1); } } return -1; } }
[ "pushkarchawda1812@outlook.com" ]
pushkarchawda1812@outlook.com
ee7743606c6c84aa530a9df725d302b18c15bb90
b3081e5e080bd438c70545fea135ab3739665602
/Etapa 2/Programa/mini-java/test/D/35.java
535f6e8a0445a653e3d18a6c3e56e438f8f97d56
[]
no_license
gomezger/Compilador-de-MiniJava
025a4585ba1839767f42738e106c6adb73076896
e878260d4f9f607915a33f4194bd1078ba6c0230
refs/heads/main
2023-04-03T09:01:30.553542
2021-01-09T23:57:36
2021-01-09T23:57:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
131
java
//Sentencia mal escrita -> declaracion de variables, uso . en vez de , class Metodo extends Clase2{ Metodo(){ int a.b; } }
[ "germang08@hotmail.com" ]
germang08@hotmail.com
11373e36d3dd2133d3aaff213620bb21c043d898
e7565cd8276c3e2da6fa5c7229baf91563799bbd
/server/catgenome/src/test/java/com/epam/catgenome/manager/gene/GeneActivityServiceTest.java
4c30f8be10be565cae377b0b0965a483aadfeaa8
[ "MIT" ]
permissive
epam/NGB
a89b12d24fd289a63d511c4bbd79cc6966ea910d
cb8fc7e95d1d0e064f4eb2b2f487f853c0234592
refs/heads/develop
2023-08-31T22:49:54.667420
2023-08-31T10:30:01
2023-08-31T10:30:01
72,222,405
153
61
MIT
2023-09-14T13:37:11
2016-10-28T16:07:22
JavaScript
UTF-8
Java
false
false
9,668
java
/* * MIT License * * Copyright (c) 2021 EPAM Systems * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.epam.catgenome.manager.gene; import com.epam.catgenome.dao.index.FeatureIndexDao; import com.epam.catgenome.entity.BiologicalDataItemFormat; import com.epam.catgenome.entity.activity.Activity; import com.epam.catgenome.entity.activity.ActivityType; import com.epam.catgenome.entity.gene.GeneHighLevel; import com.epam.catgenome.entity.index.GeneIndexEntry; import com.epam.catgenome.manager.activity.ActivityService; import com.epam.catgenome.manager.gene.parser.StrandSerializable; import org.junit.Test; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.function.Function; import java.util.stream.Collectors; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.is; import static org.mockito.Mockito.mock; public class GeneActivityServiceTest { private static final String UID = "e8dd9d77-2342-4fa6-ac6f-e110a596d717"; private static final String FEATURE_TYPE_OLD = "gene"; private static final String FEATURE_TYPE_NEW = "exon"; private static final String SOURCE = "source"; private static final String STRAND_OLD = "POSITIVE"; private static final String STRAND_NEW = "NEGATIVE"; private static final Integer FRAME_OLD = 1; private static final Integer FRAME_NEW = -1; private static final Float SCORE_OLD = -1.0f; private static final Float SCORE_NEW = 1.0f; private static final String ATTRIBUTE_NAME = "name"; private static final String ATTRIBUTE_VALUE = "value"; private static final String OLD = "1"; private static final String NEW = "2"; private final ActivityService activityServiceMock = mock(ActivityService.class); private final GeneActivityService activityService = new GeneActivityService(activityServiceMock); @Test public void shouldCreateUpdateActivity() { final List<Activity> activities = activityService.saveGeneActivities(newContent(), oldContent()); assertThat(activities.size(), is(6)); final Map<String, Activity> activitiesByField = activities.stream() .collect(Collectors.toMap(Activity::getField, Function.identity())); assertActivityUpdate(activitiesByField, FeatureIndexDao.FeatureIndexFields.FEATURE_TYPE.getFieldName(), FEATURE_TYPE_OLD, FEATURE_TYPE_NEW); assertActivityUpdate(activitiesByField, FeatureIndexDao.FeatureIndexFields.SOURCE.getFieldName(), SOURCE + OLD, SOURCE + NEW); assertActivityUpdate(activitiesByField, FeatureIndexDao.FeatureIndexFields.STRAND.getFieldName(), STRAND_OLD, STRAND_NEW); assertActivityUpdate(activitiesByField, FeatureIndexDao.FeatureIndexFields.FRAME.getFieldName(), FRAME_OLD.toString(), FRAME_NEW.toString()); assertActivityUpdate(activitiesByField, FeatureIndexDao.FeatureIndexFields.SCORE.getFieldName(), SCORE_OLD.toString(), SCORE_NEW.toString()); assertActivityUpdate(activitiesByField, ATTRIBUTE_NAME, ATTRIBUTE_VALUE + OLD, ATTRIBUTE_VALUE + NEW); } @Test public void shouldCreateDeleteActivity() { final GeneHighLevel newGeneContent = new GeneHighLevel(); newGeneContent.setStrand(StrandSerializable.NONE); final List<Activity> activities = activityService.saveGeneActivities(newGeneContent, oldContent()); assertThat(activities.size(), is(6)); final Map<String, Activity> activitiesByField = activities.stream() .collect(Collectors.toMap(Activity::getField, Function.identity())); assertActivityDelete(activitiesByField, FeatureIndexDao.FeatureIndexFields.FEATURE_TYPE.getFieldName(), FEATURE_TYPE_OLD); assertActivityDelete(activitiesByField, FeatureIndexDao.FeatureIndexFields.SOURCE.getFieldName(), SOURCE + OLD); assertActivityUpdate(activitiesByField, FeatureIndexDao.FeatureIndexFields.STRAND.getFieldName(), STRAND_OLD, "NONE"); assertActivityDelete(activitiesByField, FeatureIndexDao.FeatureIndexFields.FRAME.getFieldName(), FRAME_OLD.toString()); assertActivityDelete(activitiesByField, FeatureIndexDao.FeatureIndexFields.SCORE.getFieldName(), SCORE_OLD.toString()); assertActivityDelete(activitiesByField, ATTRIBUTE_NAME, ATTRIBUTE_VALUE + OLD); } @Test public void shouldCreateCreateActivity() { final GeneIndexEntry oldContent = new GeneIndexEntry(); oldContent.setUuid(UUID.fromString(UID)); oldContent.setFeatureFileId(1L); final List<Activity> activities = activityService.saveGeneActivities(newContent(), oldContent); assertThat(activities.size(), is(6)); final Map<String, Activity> activitiesByField = activities.stream() .collect(Collectors.toMap(Activity::getField, Function.identity())); assertActivityCreate(activitiesByField, FeatureIndexDao.FeatureIndexFields.FEATURE_TYPE.getFieldName(), FEATURE_TYPE_NEW); assertActivityCreate(activitiesByField, FeatureIndexDao.FeatureIndexFields.SOURCE.getFieldName(), SOURCE + NEW); assertActivityCreate(activitiesByField, FeatureIndexDao.FeatureIndexFields.STRAND.getFieldName(), STRAND_NEW); assertActivityCreate(activitiesByField, FeatureIndexDao.FeatureIndexFields.FRAME.getFieldName(), FRAME_NEW.toString()); assertActivityCreate(activitiesByField, FeatureIndexDao.FeatureIndexFields.SCORE.getFieldName(), SCORE_NEW.toString()); assertActivityCreate(activitiesByField, ATTRIBUTE_NAME, ATTRIBUTE_VALUE + NEW); } private void assertActivityUpdate(final Map<String, Activity> activitiesByField, final String field, final String oldValue, final String newValue) { assertActivity(activitiesByField, field, oldValue, newValue, ActivityType.UPDATE); } private void assertActivityDelete(final Map<String, Activity> activitiesByField, final String field, final String oldValue) { assertActivity(activitiesByField, field, oldValue, null, ActivityType.DELETE); } private void assertActivityCreate(final Map<String, Activity> activitiesByField, final String field, final String newValue) { assertActivity(activitiesByField, field, null, newValue, ActivityType.CREATE); } private void assertActivity(final Map<String, Activity> activitiesByField, final String field, final String oldValue, final String newValue, final ActivityType activityType) { assertThat(activitiesByField.containsKey(field), is(true)); activitiesByField.computeIfPresent(field, (key, value) -> { assertCommon(value, activityType); assertThat(value.getOldValue(), is(oldValue)); assertThat(value.getNewValue(), is(newValue)); return value; }); } private void assertCommon(final Activity activity, final ActivityType activityType) { assertThat(activity.getUid(), is(UID)); assertThat(activity.getItemId(), is(1L)); assertThat(activity.getItemType(), is(BiologicalDataItemFormat.GENE)); assertThat(activity.getActionType(), is(activityType)); } private GeneIndexEntry oldContent() { final GeneIndexEntry geneIndexEntry = new GeneIndexEntry(); geneIndexEntry.setUuid(UUID.fromString(UID)); geneIndexEntry.setFeatureFileId(1L); geneIndexEntry.setFeature(FEATURE_TYPE_OLD); geneIndexEntry.setSource(SOURCE + OLD); geneIndexEntry.setStrand("+"); geneIndexEntry.setFrame(FRAME_OLD); geneIndexEntry.setScore(SCORE_OLD); geneIndexEntry.setAttributes(Collections.singletonMap(ATTRIBUTE_NAME, ATTRIBUTE_VALUE + OLD)); return geneIndexEntry; } private GeneHighLevel newContent() { final GeneHighLevel geneHighLevel = new GeneHighLevel(); geneHighLevel.setFeature(FEATURE_TYPE_NEW); geneHighLevel.setSource(SOURCE + NEW); geneHighLevel.setStrand(StrandSerializable.NEGATIVE); geneHighLevel.setFrame(FRAME_NEW); geneHighLevel.setScore(SCORE_NEW); geneHighLevel.setAttributes(Collections.singletonMap(ATTRIBUTE_NAME, ATTRIBUTE_VALUE + NEW)); return geneHighLevel; } }
[ "noreply@github.com" ]
noreply@github.com
8ec0983ba52d87b62f281e9efaa521fa85cc3044
fee2c6513dbfde9f4d6321283c7a4b78836d6376
/hotel-rest-api/src/main/java/com/shridutt/hotel/rest/dao/HotelServiceDAO.java
741605d6bbd15b1fad5b3a762c5bf16e4659ca9f
[ "Apache-2.0" ]
permissive
shriduttkothari/SpringBootSampleProject
98b5b6a2475d5a03e0a329b64536248316342d72
df78a939b754242dc0f88fc0f00caabd8b046ad8
refs/heads/main
2023-07-05T21:48:09.741132
2021-08-12T06:49:48
2021-08-12T06:49:48
385,961,934
1
0
null
null
null
null
UTF-8
Java
false
false
710
java
package com.shridutt.hotel.rest.dao; import java.util.List; import com.shridutt.hotel.rest.model.Category; import com.shridutt.hotel.rest.model.Hotel; public interface HotelServiceDAO { public Category getCategories(); public List<String> searchTerm(String term); public List<Hotel> searchHotels(String term, int offset, int limit, String sortcolumn, String sorttype); public int getCount(String term); public List<Hotel> categorySearch(String categorylist, int offset, int limit, String sortcolumn, String sorttype); int getCategoryCount(String categorylist); public List<Hotel> searchHotelById(String id); public void creteBooking(String rooms, String id, String date, String user_id); }
[ "shriduttkothari@gmail.com" ]
shriduttkothari@gmail.com
bf0306bde9bf3be5d52c21b37dfc449188d9269f
659c12d6372bfbb62b89f916c1bbf992e1bca3ee
/src/main/java/com/hbins/sinosoft/pay/config/JacksonConfiguration.java
211ab664230e0f1f4aa7a76cfeccbb103cffcc6a
[]
no_license
cenbow/hbinsPayPlatform
29f486f7c37f55001821d6655a0f1d9fe85792dc
d372612ff8c1d1b605677b345beec0b54b9c98a1
refs/heads/master
2020-03-20T00:13:59.884352
2018-06-12T01:34:14
2018-06-12T01:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,236
java
package com.hbins.sinosoft.pay.config; import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; import com.fasterxml.jackson.module.afterburner.AfterburnerModule; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.zalando.problem.ProblemModule; import org.zalando.problem.validation.ConstraintViolationProblemModule; @Configuration public class JacksonConfiguration { /* * Support for Hibernate types in Jackson. */ @Bean public Hibernate5Module hibernate5Module() { return new Hibernate5Module(); } /* * Jackson Afterburner module to speed up serialization/deserialization. */ @Bean public AfterburnerModule afterburnerModule() { return new AfterburnerModule(); } /* * Module for serialization/deserialization of RFC7807 Problem. */ @Bean ProblemModule problemModule() { return new ProblemModule(); } /* * Module for serialization/deserialization of ConstraintViolationProblem. */ @Bean ConstraintViolationProblemModule constraintViolationProblemModule() { return new ConstraintViolationProblemModule(); } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
46abe3d7c510ec9ee2f1fcf03cdfdcdc8902aa22
7528eeeabbc25f3014d9de875e4f6b69bc0bf0f1
/WolfWear/app/src/main/java/edu/ncsu/csc/wolfwear/natural_language_generation/RecommendationGenerator.java
153e7969b7c15a142c2eb4572bc4d642fd571b70
[]
no_license
locklearm/resume
95a32b3852db190611d7b401031d2a0c91a9bac8
7337ea61b5912c23d76eb5324751a538a8b2402f
refs/heads/master
2021-01-19T06:49:51.506240
2015-01-09T22:38:11
2015-01-09T22:38:11
29,026,167
1
0
null
null
null
null
UTF-8
Java
false
false
18,441
java
package edu.ncsu.csc.wolfwear.natural_language_generation; import edu.ncsu.csc.wolfwear.dialogue_management.Frame; import edu.ncsu.csc.wolfwear.logging.WolfWearLogger; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; /** * Zhongxiu Liu (zliu24@ncsu.edu) * rules and generate recommendation based on whether items match the rules */ public class RecommendationGenerator { //collection of inappropriate items Hashtable <String, ArrayList<String>> badColors = new Hashtable<String, ArrayList<String>>(); Hashtable <String, ArrayList<String>> appropriateItems = new Hashtable<String, ArrayList<String>>(); ArrayList<String> controversyColors = new ArrayList<String>(); Hashtable <String, String> humor = new Hashtable<String, String>(); Hashtable<String, String> colorCategory = new Hashtable<String, String>(); //ArrayList of all of the rules that have been violated ArrayList<String> ruleViolated = new ArrayList<String>(); //ArrayLists of all of the color rules that have been violated ArrayList<String> badColorViolations = new ArrayList<String>(); ArrayList<String> colorClashViolations = new ArrayList<String>(); //ArrayLists of all humor ArrayList<String> humorList = new ArrayList<String>(); //constructor, adds the rules to the above hashtables public RecommendationGenerator(){ fillItemRules(); fillColorRules(); fillColorCategory(); fillControversyColors(); fillHumors(); } public String makeRecommendationUtterance(Frame frame){ String recommendation = "Uhm, let me see... "; //quick fix for whole body item ArrayList<String> itemColors = new ArrayList<String>(Arrays.asList(frame.getSlot(Frame.SlotName.TOP_ITEM_COLOR).getValue(),frame.getSlot(Frame.SlotName.BOTTOM_ITEM_COLOR).getValue(), frame.getSlot(Frame.SlotName.SHOE_COLOR).getValue(),frame.getSlot(Frame.SlotName.OUTERWEAR_ITEM_COLOR).getValue())); String interviewType = frame.getSlot(Frame.SlotName.INTERVIEW_TYPE).getValue(); ArrayList<String> userItems = new ArrayList<String>(Arrays.asList(frame.getSlot(Frame.SlotName.OUTERWEAR_ITEM).getValue(),frame.getSlot(Frame.SlotName.TOP_ITEM).getValue(), frame.getSlot(Frame.SlotName.BOTTOM_ITEM).getValue(),frame.getSlot(Frame.SlotName.SHOE_TYPE).getValue() )); //check items to see if they are appropriate for the given interview if (!appropriateItems(interviewType, userItems)){ //if items were not appropriate, this if statement is triggered String inappropriateItems = ""; //if more than one item violates a rule, format "X, Y, and Z are " if (ruleViolated.size() > 1) { //for violations 1 through n-1, make a comma separated list for (int i = 0; i < ruleViolated.size() - 1; i++){ inappropriateItems = inappropriateItems + ruleViolated.get(i) + ", "; } inappropriateItems = inappropriateItems + "and " + ruleViolated.get(ruleViolated.size() - 1) + " are "; } else { //only one item was inappropriate, format "X is " inappropriateItems = ruleViolated.get(0) + " is "; } //construct the recommendation recommendation = recommendation + "Your " + inappropriateItems + "not appropriate for " + interviewType + ". Consider dressing up a little bit. \n" ; } //check debatable colors - should be able to check this at the same time as rule violations, and parse both together. if (hasControversyColor(itemColors)){ String badColorsString = ""; //if more than one color violates a rule, format "X, Y, and Z" if (badColorViolations.size() > 1) { //for violations 1 through n-1, make a comma separated list for (int i = 0; i < badColorViolations.size() - 1; i++){ badColorsString = badColorsString + badColorViolations.get(i) + ", "; } badColorsString = badColorsString + "and " + badColorViolations.get(badColorViolations.size() - 1); } else { //only one item was inappropriate, format "X" badColorsString = badColorsString + badColorViolations.get(0); } if(!recommendation.equals("Uhm, let me see... ")) { recommendation = recommendation + " Moreover, there"; } else { recommendation = recommendation + " There"; //without this, system actually says "dot dot dot" for ... } recommendation = recommendation + " are some colors you need to wear carefully, such as: " + badColorsString + ". You want to look professional, not too bold. \n" ; } //check color matching if (!colorsMatch(itemColors)){ String clashingColors = ""; if (colorClashViolations.size()>1) { for (int i = 0; i < colorClashViolations.size() - 1; i++) { clashingColors = clashingColors + colorClashViolations.get(i) + ", "; } clashingColors = clashingColors + " and " + colorClashViolations.get(colorClashViolations.size() - 1); }else{ clashingColors = clashingColors + colorClashViolations.get(0); } if(!recommendation.equals("Uhm, let me see... ")) { recommendation = recommendation + " Lastly, "; } recommendation = recommendation + "be careful about colors that do not normally match well with each other. In your case: " + clashingColors +". You should avoid the combination of these colors\n"; } //if any combination of the above rules (bad items, bad colors, clashing colors) were triggered, return that now if(!recommendation.equals("Uhm, let me see... ")) { return recommendation; } //if nothing was triggered, check humor if (thereIsHumor(itemColors)){ return recommendation + "I don't see any problems with what you are wearing. Just to make a quirky suggestion: " + humorList.get(0); } else { return recommendation + "I don't see any problems with what you are wearing. Wear a big smile, be confident, and have a successful interview!"; } } ////////////////////////////////////// /////////helper functions///////////// ////////////////////////////////////// /** * checks whether items in the frame are appropriate for the types of interview * record inappropriate items into ruleViolated * @param interviewType * @param userItems * @return whether appropriate */ private boolean appropriateItems(String interviewType, ArrayList<String> userItems){ boolean itemsAppropriate = true; for (int i=0; i<userItems.size(); i++){ if (!appropriateItems.get(interviewType).contains(userItems.get(i)) || appropriateItems.get("never").contains(userItems.get(i))) { WolfWearLogger.log(System.currentTimeMillis() + " appropriateItems method believes item " + userItems.get(i) + " was not appropriate. \n"); if (!ruleViolated.contains(userItems.get(i))) { ruleViolated.add(userItems.get(i)); } itemsAppropriate = false; } } return itemsAppropriate; } /** * check if any item colors are controversy color -- non-traditional interview suit color that need to be wear carefully * add controversy colors into badColorViolations * @param itemColors * @return whether there's controversy color */ private boolean hasControversyColor(ArrayList<String> itemColors){ boolean hasControversyColor = false; for (int i=0; i<itemColors.size(); i++){ if (controversyColors.contains(colorCategory.get(itemColors.get(i)))){ if (!badColorViolations.contains(itemColors.get(i))){ badColorViolations.add(itemColors.get(i)); WolfWearLogger.log(System.currentTimeMillis() + " hasControversyColor method believes color " + itemColors.get(i) + " was controversial. \n"); hasControversyColor = true; } } } return hasControversyColor; } /** * check whether colors in the frame match * record pairs of colors don't match into ruleViolated * @param itemColors * @return whether colors match */ private boolean colorsMatch(ArrayList<String> itemColors){ boolean colorsMatch = true; for (int i=0; i<itemColors.size()-1; i++){ for (int j=i+1; j<itemColors.size(); j++){ String a = colorCategory.get(itemColors.get(i)); String b = colorCategory.get(itemColors.get(j)); if (badColors.get(colorCategory.get(itemColors.get(i))).contains(colorCategory.get(itemColors.get(j)))){ String rv1 = itemColors.get(i) + " and " + itemColors.get(j); String rv2 = itemColors.get(j) + " and " + itemColors.get(i); if (!colorClashViolations.contains(rv1) && !colorClashViolations.contains(rv2)){ WolfWearLogger.log(System.currentTimeMillis() + " colorsMatch method believes colors " + itemColors.get(i) + " and " + itemColors.get(j) + " clashed. \n"); colorClashViolations.add(itemColors.get(i) + " and " + itemColors.get(j)); } colorsMatch = false; } } } return colorsMatch; } /** * need to decide on what are the humors we want to include before filling this function * @return */ private boolean thereIsHumor(ArrayList<String> itemColors){ boolean thereIsHumor = false; for (int i=0; i<itemColors.size(); i++){ if (humor.get(itemColors.get(i))!=null){ humorList.add(humor.get(itemColors.get(i))); WolfWearLogger.log(System.currentTimeMillis() + " thereIsHumor method believed itemColor " + itemColors.get(i) + " was humorous. \n"); thereIsHumor = true; } } return thereIsHumor; } ////////////////////////////////////// //////functions to fill in rules////// ////////////////////////////////////// /** * rules for humor */ private void fillHumors(){ humor.put("white", "remember no white after Labor Day!"); } /** * rules for appropriate items */ private void fillItemRules(){ ArrayList<String> businessAttire = new ArrayList<String>(Arrays.asList("suit", "blouse", "vest", "blazer", "slacks", "skirt","pants","tuxedo","dress", "flats", "heels", "shoes", "oxfords", "tie", "belt", "over coat", "trench coat", "over coat", "coat")); appropriateItems.put("business attire", businessAttire); ArrayList<String> businessCasual = new ArrayList<String>(Arrays.asList("suit", "blouse", "vest", "blazer", "slacks", "tuxedo","dress", "heels", "shoes", "oxford", "tie", "belt","oxfords", "sweater", "polo", "long sleeve shirt", "cardigan", "over coat","pants", "skirt", "trousers", "uniform", "flats", "boots", "wedges", "scarf", "over coat", "peacoat", "trench coat", "loafers","coat")); appropriateItems.put("business casual", businessCasual); ArrayList<String> casual = new ArrayList<String>(Arrays.asList("suit", "blouse", "vest", "blazer", "slacks", "tuxedo","dress", "flats", "heels", "shoes", "oxfords", "tie", "belt", "sweater", "polo", "long sleeve shirt", "tee","cardigan", "pants", "skirt", "trousers", "uniform", "flats", "boots", "sandals", "wedges", "scarf", "over coat", "peacoat", "trench coat", "loafers", "shirt", "t-shirt", "knit", "cover up", "tunic", "jacket", "over coat", "hoodie", "coat", "jeans", "denim", "tennis shoes", "sneakers", "rain boots", "clogs", "comfortable shoes", "hat", "sports jacket")); appropriateItems.put("casual", casual); ArrayList<String> never = new ArrayList<String>(Arrays.asList("tank top", "tank", "sleeveless", "sport","sport shirt", "sport pants","sweatshirt", "cami", "camisole", "shorts", "yoga pants", "leggings", "mini skirt", "sweatpants", "tights", "pajama", "jump suit", "robe", "flip flops", "platform", "galoshes", "slippers")); appropriateItems.put("never", never); } /** * colors that are controversy; we need to warn user about wearing these colors wisely */ private void fillControversyColors(){ controversyColors = new ArrayList<String>(Arrays.asList("orange", "pink", "purple", "red", "yellow")); } /** * this function use each color name as key, and associate color names with a color category as value */ private void fillColorCategory() { ArrayList<String> red = new ArrayList<String>(Arrays.asList("red","crimson", "scarlet", "cardinal", "ruby", "lava", "flamingo", "carmine", "fire")); for (int i=0; i<red.size(); i++){ colorCategory.put(red.get(i), "red"); } ArrayList<String> blue = new ArrayList<String>(Arrays.asList("blue","azure", "sky", "navy", "sapphire", "indigo", "celeste", "midnight","denim")); for (int i=0; i<blue.size(); i++){ colorCategory.put(blue.get(i), "blue"); } ArrayList<String> orange = new ArrayList<String>(Arrays.asList("orange","carrot", "apricot", "tangerine", "coral", "pumpkin", "sunset", "ginger","sunset")); for (int i=0; i<orange.size(); i++){ colorCategory.put(orange.get(i), "orange"); } ArrayList<String> yellow = new ArrayList<String>(Arrays.asList("yellow","gold", "amber", "maize", "buff", "lemon", "citron", "buff", "wheat","mustard")); for (int i=0; i<yellow.size(); i++){ colorCategory.put(yellow.get(i), "yellow"); } ArrayList<String> white = new ArrayList<String>(Arrays.asList("white","snow", "ivory", "pale", "pearl", "milk")); for (int i=0; i<white.size(); i++){ colorCategory.put(white.get(i), "white"); } ArrayList<String> beige = new ArrayList<String>(Arrays.asList("beige","tan", "vanilla"," sand", "cream", "seashell")); for (int i=0; i<beige.size(); i++){ colorCategory.put(beige.get(i), "beige"); } ArrayList<String> black = new ArrayList<String>(Arrays.asList("black","charcoal", "licorice" )); for (int i=0; i<black.size(); i++){ colorCategory.put(black.get(i), "black"); } ArrayList<String> green = new ArrayList<String>(Arrays.asList("green","mint", "spring", "olive", "forest", "emerald", "tea", "jade", "grass")); for (int i=0; i<green.size(); i++){ colorCategory.put(green.get(i), "green"); } ArrayList<String> grey = new ArrayList<String>(Arrays.asList("grey","gray","silver", "ash", "smoky", "metallic", "taupe", "steel", "misty")); for (int i=0; i<grey.size(); i++){ colorCategory.put(grey.get(i), "grey"); } ArrayList<String> brown = new ArrayList<String>(Arrays.asList("brown","bronze", "earth", "caramel", "chestnut", "chocolate", "cafe", "coffee", "maroon", "wood")); for (int i=0; i<brown.size(); i++){ colorCategory.put(brown.get(i), "brown"); } ArrayList<String> purple = new ArrayList<String>(Arrays.asList("purple","violet", "orchid", "lavender", "plum", "wine")); for (int i=0; i<purple.size(); i++){ colorCategory.put(purple.get(i), "purple"); } ArrayList<String> pink = new ArrayList<String>(Arrays.asList("pink","raspberry", "rose", "magenta", "coral", "salmon")); for (int i=0; i<pink.size(); i++){ colorCategory.put(pink.get(i), "pink"); } } /** * this function associate each color with a link list contains * - colors it doesn't match with */ private void fillColorRules(){ ArrayList<String> red = new ArrayList<String>(Arrays.asList("pink", "green", "blue", "orange", "purple", "yellow")); badColors.put("red", red); ArrayList<String> blue = new ArrayList<String>(Arrays.asList("pink", "green", "orange", "purple", "red", "yellow", "brown")); badColors.put("blue", blue); ArrayList<String> yellow = new ArrayList<String>(Arrays.asList("black", "blue", "green", "pink", "purple", "red", "brown")); badColors.put("yellow", yellow); ArrayList<String> orange = new ArrayList<String>(Arrays.asList("black", "green", "pink", "purple", "red", "yellow")); badColors.put("orange", orange); ArrayList<String> white = new ArrayList<String>(Arrays.asList("")); badColors.put("white", white); ArrayList<String> black = new ArrayList<String>(Arrays.asList("yellow", "orange")); badColors.put("black", black); ArrayList<String> green = new ArrayList<String>(Arrays.asList("red", "orange", "pink", "purple", "red")); badColors.put("green", green); ArrayList<String> gray = new ArrayList<String>(Arrays.asList("")); badColors.put("grey", gray); ArrayList<String> navy = new ArrayList<String>(Arrays.asList("")); badColors.put("navy", navy); ArrayList<String> brown = new ArrayList<String>(Arrays.asList("blue", "yellow", "pink", "purple")); badColors.put("brown", brown); ArrayList<String> purple = new ArrayList<String>(Arrays.asList("brown", "red", "blue", "yellow", "orange", "pink")); badColors.put("purple", purple); ArrayList<String> tan = new ArrayList<String>(Arrays.asList("")); badColors.put("tan", tan); ArrayList<String> beige = new ArrayList<String>(Arrays.asList("")); badColors.put("beige", beige); ArrayList<String> pink = new ArrayList<String>(Arrays.asList("brown", "green", "yellow", "orange", "red", "blue")); badColors.put("pink", pink); } }
[ "melockle@ncsu.edu" ]
melockle@ncsu.edu
6bd3ca08cf4b5f3bf14451a4bdeae1875917b268
94fd3ac9e3a21097e978cfdb33dbf527e39d8133
/pdf/parsePdf-java/src/main/java/org/apache/pdfbox/examples/pdmodel/PrintURLs.java
73aa6222122cabcb34f987fb04fef1a9211bbf44
[]
no_license
growdu/text-extract
00b4d6acff055d04bb81bbb86a250985512ab537
a0420b0dc94fbc6c44b4910f93da26f2d1d4822d
refs/heads/master
2023-06-22T12:30:44.742548
2023-01-03T06:11:31
2023-01-03T06:11:31
195,522,422
1
0
null
2023-06-14T22:33:39
2019-07-06T09:35:40
Java
UTF-8
Java
false
false
5,970
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.pdfbox.examples.pdmodel; import java.awt.geom.Rectangle2D; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.apache.pdfbox.pdmodel.interactive.action.PDAction; import org.apache.pdfbox.pdmodel.interactive.action.PDActionURI; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation; import org.apache.pdfbox.text.PDFTextStripperByArea; /** * This is an example of how to access a URL in a PDF document. * * @author Ben Litchfield */ public final class PrintURLs { /** * Constructor. */ private PrintURLs() { //utility class } /** * This will output all URLs and the texts in the annotation rectangle of a document. * <br> * see usage() for commandline * * @param args Command line arguments. * * @throws IOException If there is an error extracting the URLs. */ public static void main(String[] args) throws IOException { PDDocument doc = null; try { if( args.length != 1 ) { usage(); } else { doc = PDDocument.load( new File(args[0]) ); int pageNum = 0; for( PDPage page : doc.getPages() ) { pageNum++; PDFTextStripperByArea stripper = new PDFTextStripperByArea(); List<PDAnnotation> annotations = page.getAnnotations(); //first setup text extraction regions for( int j=0; j<annotations.size(); j++ ) { PDAnnotation annot = annotations.get(j); if (getActionURI(annot) != null) { PDRectangle rect = annot.getRectangle(); //need to reposition link rectangle to match text space float x = rect.getLowerLeftX(); float y = rect.getUpperRightY(); float width = rect.getWidth(); float height = rect.getHeight(); int rotation = page.getRotation(); if( rotation == 0 ) { PDRectangle pageSize = page.getMediaBox(); // area stripper uses java coordinates, not PDF coordinates y = pageSize.getHeight() - y; } else { // do nothing // please send us a sample file } Rectangle2D.Float awtRect = new Rectangle2D.Float( x,y,width,height ); stripper.addRegion( "" + j, awtRect ); } } stripper.extractRegions( page ); for( int j=0; j<annotations.size(); j++ ) { PDAnnotation annot = annotations.get(j); PDActionURI uri = getActionURI(annot); if (uri != null) { String urlText = stripper.getTextForRegion("" + j); System.out.println("Page " + pageNum + ":'" + urlText.trim() + "'=" + uri.getURI()); } } } } } finally { if( doc != null ) { doc.close(); } } } private static PDActionURI getActionURI(PDAnnotation annot) { // use reflection to catch all annotation types that have getAction() // If you can't use reflection, then check for classes // PDAnnotationLink and PDAnnotationWidget, and call getAction() and check for a // PDActionURI result type try { Method actionMethod = annot.getClass().getDeclaredMethod("getAction"); if (actionMethod.getReturnType().equals(PDAction.class)) { PDAction action = (PDAction) actionMethod.invoke(annot); if (action instanceof PDActionURI) { return (PDActionURI) action; } } } catch (NoSuchMethodException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } return null; } /** * This will print out a message telling how to use this example. */ private static void usage() { System.err.println( "usage: " + PrintURLs.class.getName() + " <input-file>" ); } }
[ "growdu@gmail.com" ]
growdu@gmail.com
950bb263e64cbaa087e66b97a262bf8292ce84a3
5c4ae5c59d2dd67866725c1f3558b78fe7219bd4
/src/datacontainers/ClassroomDC.java
bc395e69b85e35e0eda7e0737e47b7d4cf9d2e8f
[]
no_license
selinaliu0626/course-management
d0a5ad469802f74c2450f4090bef0a207ae00e16
3d295a322e2ee23cb8c5b9cb3b33f608f4fe407e
refs/heads/main
2023-01-07T14:05:36.905861
2020-11-12T04:38:42
2020-11-12T04:38:42
312,168,923
0
0
null
null
null
null
UTF-8
Java
false
false
586
java
/* * This Class contains a list which will hold classroom objects created in the UI */ package datacontainers; import datamodels.Classroom; import java.util.ArrayList; public class ClassroomDC { private ArrayList<Classroom> listOfClassrooms = new ArrayList<>(); /** * no-arg constructor */ public ClassroomDC() { } public ArrayList<Classroom> getListOfClassrooms() { return listOfClassrooms; } public void setListOfClassrooms(ArrayList<Classroom> listOfClassrooms) { this.listOfClassrooms = listOfClassrooms; } }
[ "66767001+selinaliu0626@users.noreply.github.com" ]
66767001+selinaliu0626@users.noreply.github.com
c47edc4927d93be71f1807a34aeaf132beae01b3
68f5416f9430d9b78955c777fa6213e85432cb01
/javacourse181112/src/main/java/com/musala/javacourse181112/basics/ChromosomesApplication.java
ec10884f7953b791c60d47366bf83c79b642d6dc
[]
no_license
dgluharov/LearnFromTheMasters-Java
2c4d2398d03063ea1dfddebb5310bff1f22d0f6d
7efa710afc2c4c70b1c366e19d1d17beecb9b31d
refs/heads/master
2021-07-07T02:57:47.113128
2019-07-18T16:21:01
2019-07-18T16:21:01
197,141,964
0
0
null
2020-10-13T14:37:06
2019-07-16T07:20:40
Java
UTF-8
Java
false
false
1,582
java
package com.musala.javacourse181112.basics; import com.musala.javacourse181112.basics.Gender; /** * Created by Iva Koleva on 19.11.2018 */ public class ChromosomesApplication { public static void main(final String[] args) { // validation if (args.length == 0 || args[0] == null) { printUsageAndExit(); } /*if(!("female".equalsIgnoreCase(args[0]) || "male".equalsIgnoreCase(args[0]))) { System.out.println("Insert male|female instead of: " + args[0]); printUsageAndExit(); }*/ final Gender gender = "female".equalsIgnoreCase(args[0]) ? Gender.FEMALE : ("male".equalsIgnoreCase(args[0]) ? Gender.MALE : null); if (gender == null) { System.out.println("Insert male|female instead of: " + args[0]); printUsageAndExit(); } String chromosomesString = ""; // to print yx instead, flip gender's order switch (gender) { case FEMALE: chromosomesString += "x"; case MALE: chromosomesString += "x"; if (chromosomesString.length() == 2) { break; } default: chromosomesString += "y"; } System.out.println("Chromosomes for gender: " + gender); System.out.println(chromosomesString); } private static void printUsageAndExit() { System.out.println("Usage: java ChromosomesApplication male|female"); System.exit(1); } }
[ "dgluharov@gmail.com" ]
dgluharov@gmail.com
61c7f72b6ba60ecc358e0156d94e65377833c92d
c95b26c2f7dd77f5e30e2d1cd1a45bc1d936c615
/webdav-servlet/src/main/java/net/sf/webdav/methods/DoMove.java
3726a9c3787bedb7ff16c51b9a262d965d24e674
[]
no_license
ostigter/testproject3
b918764f5c7d4c10d3846411bd9270ca5ba2f4f2
2d2336ef19631148c83636c3e373f874b000a2bf
refs/heads/master
2023-07-27T08:35:59.212278
2023-02-22T09:10:45
2023-02-22T09:10:45
41,742,046
2
1
null
2023-07-07T22:07:12
2015-09-01T14:02:08
Java
UTF-8
Java
false
false
2,670
java
/* * Copyright 1999,2004 The Apache Software Foundation. * * 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.sf.webdav.methods; import java.io.IOException; import java.util.Hashtable; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.webdav.ResourceLocks; import net.sf.webdav.WebdavStatus; import net.sf.webdav.exceptions.AccessDeniedException; import net.sf.webdav.exceptions.ObjectAlreadyExistsException; import net.sf.webdav.exceptions.WebdavException; import org.apache.log4j.Logger; public class DoMove extends ReportingMethod { private static Logger log = Logger.getLogger("net.sf.webdav.methods"); private ResourceLocks resourceLocks; private DoDelete doDelete; private DoCopy doCopy; private boolean readOnly; public DoMove(ResourceLocks resourceLocks, DoDelete doDelete, DoCopy doCopy, boolean readOnly) { this.resourceLocks = resourceLocks; this.doDelete = doDelete; this.doCopy = doCopy; this.readOnly = readOnly; } public void execute(HttpServletRequest req, HttpServletResponse resp) throws IOException { if (!readOnly) { String path = getRelativePath(req); String lockOwner = "doMove" + System.currentTimeMillis() + req.toString(); if (resourceLocks.lock(path, lockOwner, false, -1)) { try { if (doCopy.copyResource(req, resp)) { Hashtable errorList = new Hashtable(); doDelete.deleteResource(path, errorList, req, resp); if (!errorList.isEmpty()) { sendReport(req, resp, errorList); } } else { resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR); } } catch (AccessDeniedException e) { resp.sendError(WebdavStatus.SC_FORBIDDEN); } catch (ObjectAlreadyExistsException e) { resp.sendError(WebdavStatus.SC_NOT_FOUND, req .getRequestURI()); } catch (WebdavException e) { resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR); } finally { resourceLocks.unlock(path, lockOwner); } } else { resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR); } } else { resp.sendError(WebdavStatus.SC_FORBIDDEN); } } }
[ "oscar.stigter@e0aef87a-ea4e-0410-81cd-4b1fdc67522b" ]
oscar.stigter@e0aef87a-ea4e-0410-81cd-4b1fdc67522b
febd8cc1778e1a4337b3954b3fb937c300fa84dc
74d495abd50e89b5591d17cce28ff52715cc378b
/java-algo/src/operator/ArithmeticDemo.java
60c1a546707b7af6b2c9043919165815ecb1f6ff
[]
no_license
skysoblue/java-algo
804bd24cfbb1781536698cd3c70d7fedb7608cfc
78e714b1d7ff564f46cdaf5ebda1bb57dfe7d431
refs/heads/master
2016-09-01T19:51:41.269754
2015-10-07T08:59:13
2015-10-07T08:59:13
42,429,211
0
1
null
null
null
null
UTF-8
Java
false
false
546
java
package operator; /** * @file_name : UnaryTest2.java * @author : coolbeat@naver.com * @date : 2015. 9. 16. * @story : 나눗셈 문법 */ public class ArithmeticDemo { public static void main(String[] args) { int x = 9, y = 5, z = 0; z = x / y; System.out.println("x / y = "+z); // 프로그래밍에서 나눗셈은 두가지 결과값을 가진다 // 하나는 몫만 취하는 것이고, 다른 하나는 나머지 값만 취한다. z = x % y; System.out.println("x % y = "+z); } }
[ "HB02@HB02PC" ]
HB02@HB02PC
a2b6c0be3d9fdd11bc67d858f1d503fa72256cbc
29e10d5b45fd431c055d0f4a43e2a573288af63d
/src/ch14_3_stream_API/Product.java
ee3368060d3ecfffa9734f8646b3fccb8ec026e3
[]
no_license
beetrootfarmer/Chapter14_InputOutputStream
12403b2385948bed70b443115e5bef14a0638c88
ea0bdee317e512246253f3019794bab58b0dc4a3
refs/heads/master
2023-07-13T06:23:27.042956
2021-08-23T05:09:08
2021-08-23T05:09:08
398,979,896
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package ch14_3_stream_API; public class Product { private int pno; private String name; private int price; private int stock; public int getPno() { return pno; } public void setPno (int counter) { this.pno = pno; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public int getStock() { return stock; } public void setStock(int stock) { this.stock = stock; } }
[ "heji@192.168.0.7" ]
heji@192.168.0.7
c502a993912753a417790d212572cf81f6c0d632
9c6ec1880cde8ff2320b0d83e7394b923941e132
/src/com/wechat/MenuPojo/ViewButton.java
f13c4850fc14537acfaf2d75639c68aacc5bbba4
[]
no_license
huangjxmimi/Web
db9db3ab3b9ac2210c8f479f5744694b6ea270f1
f499850b413bc02b99717cbc27e20a6c1b992bbf
refs/heads/master
2021-01-10T10:11:42.104224
2016-03-24T08:45:16
2016-03-24T08:45:16
54,626,566
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
package com.wechat.MenuPojo; public class ViewButton extends Button{ private String url; private String type; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
[ "32342463@qq.com" ]
32342463@qq.com
70078fba17a33baef60fb077cea3922d215a5cc7
fe6015a20a76b7b08f6f9da51b9c45d641f888ac
/GrassSeedinc.java
6bfc254f7539969a52c7b958062b42a49b1e4021
[]
no_license
basilroy1/Kattis
3a68b1627fb081989579682c05cbedb0037cc740
34a4fe92a7f5d7c6ef325f2707070ba9fd011f4a
refs/heads/master
2020-03-19T14:37:24.171606
2019-01-30T18:32:21
2019-01-30T18:32:21
136,632,164
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
import java.util.Scanner; public class GrassSeedinc{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); double c=scan.nextDouble(); int test=scan.nextInt(); double res=0; double res1=0; double res2=0; for(int i=0;i<test;i++) { double l =scan.nextDouble(); double w =scan.nextDouble(); res=l*w; res1=res*c; res2+=res1; } System.out.println(res2); } }
[ "noreply@github.com" ]
noreply@github.com
a9e24279c7de3314e44e176b924138e7929c55b7
082e26b011e30dc62a62fae95f375e4f87d9e99c
/docs/weixin_7.0.4_source/反编译源码/未反混淆/src/main/java/com/tencent/ttpic/util/PointWithIndex.java
bb5f6a1e76999bfd36f612619f4145086c20cd9e
[]
no_license
xsren/AndroidReverseNotes
9631a5aabc031006e795a112b7ac756a8edd4385
9202c276fe9f04a978e4e08b08e42645d97ca94b
refs/heads/master
2021-04-07T22:50:51.072197
2019-07-16T02:24:43
2019-07-16T02:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.tencent.ttpic.util; import android.graphics.PointF; import com.tencent.matrix.trace.core.AppMethodBeat; public class PointWithIndex { public int index; public PointF point; public PointWithIndex(float f, float f2, int i) { AppMethodBeat.i(83941); this.point = new PointF(f, f2); this.index = i; AppMethodBeat.o(83941); } }
[ "alwangsisi@163.com" ]
alwangsisi@163.com
3d6f209a2e15b7021d729a495c4af9415198a9b5
6f160f55eec92eb2afed1d02043b750c49d8e015
/lbp/src/main/java/com/asc/mds/root/isearch/SolrSearcher.java
5267c2ff4ce7e8e3a8e3bf11e85aae3e2328e575
[]
no_license
mehub/lbp
52e54214424c1ce1d76a23e7fc351b7dc112bea4
5f7053c4090998aba5ba055601cbd09b18ae2dc4
refs/heads/master
2016-09-06T10:32:24.683154
2014-11-17T11:58:55
2014-11-17T11:58:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,895
java
package com.asc.mds.root.isearch; import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.io.SAXReader; import com.asc.common.util.InitConfUtils; import com.asc.common.util.StringUtils; import com.asc.mds.root.EntitySolrSetting; import com.asc.mds.root.isearch.document.CustAliasDoc; import com.asc.mds.root.isearch.document.LuceneDoc; import com.asc.mds.root.isearch.document.OrgDoc; import com.asc.mds.root.isearch.document.ProductDoc; /** * * 类描述 . solr 搜索器 * * @author chenzhenling * @version 版本信息 创建时间 2013-7-1 下午2:18:13 */ @SuppressWarnings("unchecked") public class SolrSearcher { private static Logger log = Logger.getLogger(SolrSearcher.class); public static String SOLR_URL = InitConfUtils.getParamValue("search.solr.url"); public static String SEARCH_ORG_URL = InitConfUtils.getParamValue("search.org.url"); public static <T extends LuceneDoc> String search(String queryName, QueryParams info, Class<T> clazz, EntitySolrSetting es) { if (StringUtils.isEmpty(queryName)) { return null; } try { String query = info.getQueryStr(); String qurl = SOLR_URL + es.getSolrName().replace("query", "select?q=") + URLEncoder.encode(queryName, "UTF-8") + query; log.debug("search request:" + qurl); URL url = new URL(qurl); SAXReader reader = new SAXReader(); Document doc = reader.read(url); return doc.asXML(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } return null; } public static <T extends LuceneDoc> List<T> searchDocs(String name, Class<T> clazz, EntitySolrSetting es) { QueryResult<T> res = parseSearchResult(search(name, new QueryParams(), clazz, es), clazz); return res == null ? null : res.getResults(); } public static <T extends LuceneDoc> QueryResult<T> parseSearchResult( String xml, Class<T> clazz) { try { if (StringUtils.isEmpty(xml)) { return null; } Document document = DocumentHelper.parseText(xml); Element root = document.getRootElement(); QueryResult<T> sr = new QueryResult<T>(); Iterator<Element> elementIterator = root.elementIterator(); while (elementIterator.hasNext()) { Element element = elementIterator.next(); if (element.getName().equals("lst")) { parseResponseHeader(element, sr); } else if (element.getName().equals("result")) { parseDoc(element, clazz, sr); } } return sr; } catch (DocumentException e) { e.printStackTrace(); } return null; } private static <T extends LuceneDoc> void parseResponseHeader( Element header, QueryResult<T> sr) { List<Element> elements = header.elements(); for (Element element : elements) { String attr = element.attribute("name").getText(); if (attr.equals("status")) { sr.setSuccess(element.getText().equals("0")); } else if (attr.equals("QTime")) { sr.setQueryTime(Integer.parseInt(element.getText())); } } } private static <T extends LuceneDoc> void parseDoc(Element result, Class<T> clazz, QueryResult<T> sr) { int numFound = Integer.parseInt(result.attributeValue("numFound")); sr.setFoundNum(numFound); double maxScore = Double.parseDouble(result.attributeValue("maxScore")); sr.setMaxScore(maxScore); if (!result.isTextOnly()) { Iterator<Element> docIterator = result.elementIterator("doc"); while (docIterator.hasNext()) { Element doc = docIterator.next(); T org = getResult(clazz, doc); sr.addResult(org); } } } private static <T> T getResult(Class<T> clazz, Element doc) { if (doc.isTextOnly()) { return null; } T instance = null; try { instance = clazz.newInstance(); Iterator<Element> iterator = doc.elementIterator(); while (iterator.hasNext()) { Element node = iterator.next(); String fieldName = node.attributeValue("name").replace("_", ""); String type = node.getName(); Field field = getField(clazz, fieldName); if (field == null) { continue; } String fieldValue = node.getText(); if (type.equals("str")) { field.set(instance, fieldValue); } else if (type.equals("float")) { field.setDouble(instance, Double.parseDouble(fieldValue)); } } } catch (InstantiationException e) { e.printStackTrace(); return null; } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return instance; } private static Field getField(Class<?> clazz, String fieldName) { Field[] fields = clazz.getDeclaredFields(); if (fields == null) { return null; } for (Field field : fields) { if (field.getName().equalsIgnoreCase(fieldName)) { field.setAccessible(true); return field; } } try { Field f = null; if(OrgDoc.class.isAssignableFrom(clazz)){ f = OrgDoc.get(fieldName); } else if(CustAliasDoc.class.isAssignableFrom(clazz)){ f = CustAliasDoc.get(fieldName); } else if(ProductDoc.class.isAssignableFrom(clazz)){ f = ProductDoc.get(fieldName); } if(f != null){ f.setAccessible(true); return f; } } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } return null; } }
[ "zhenling.xznu@163.com" ]
zhenling.xznu@163.com
eeb72494e3c32183390cc072851daa58871b5e10
7da67e9f47b43b297c263099863f790fa977d991
/ImageSelector/imageselectrolib/src/main/java/com/example/image_selectro_lib/ImagesSelectorActivity.java
87dd8ccfbc9d4e125551c540983ff5f8b8b63647
[]
no_license
dajiba666/ImageSelector
2eeb5061df6a52fa488e1cd80650b7c06cc9e783
786028cbaae32c36b0f4da3e73010036e21e0c5c
refs/heads/master
2021-06-21T15:06:44.590529
2017-08-09T06:11:26
2017-08-09T06:11:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,679
java
package com.example.image_selectro_lib; import android.Manifest; import android.app.Activity; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v4.content.FileProvider; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.image_selectro_lib.adapter.ImageRecyclerViewAdapter; import com.example.image_selectro_lib.listener.OnFolderRecyclerViewInteractionListener; import com.example.image_selectro_lib.listener.OnImageRecyclerViewInteractionListener; import com.example.image_selectro_lib.models.FolderItem; import com.example.image_selectro_lib.models.FolderListContent; import com.example.image_selectro_lib.models.ImageItem; import com.example.image_selectro_lib.models.ImageListContent; import com.example.image_selectro_lib.utils.FileUtils; import com.example.image_selectro_lib.utils.StringUtils; import com.example.image_selectro_lib.view.FolderPopupWindow; import com.example.imageselectrolib.R; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import rx.Observable; import rx.Subscriber; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Func1; import rx.schedulers.Schedulers; import xyz.danoz.recyclerviewfastscroller.vertical.VerticalRecyclerViewFastScroller; public class ImagesSelectorActivity extends AppCompatActivity implements OnImageRecyclerViewInteractionListener, OnFolderRecyclerViewInteractionListener, View.OnClickListener{ private static final String TAG = "ImageSelector"; private static final String ARG_COLUMN_COUNT = "column-count"; private static final int MY_PERMISSIONS_REQUEST_STORAGE_CODE = 197; private static final int MY_PERMISSIONS_REQUEST_CAMERA_CODE = 341; private int mColumnCount = 3; private ImageView mButtonBack; private Button mButtonConfirm; private RecyclerView recyclerView; private View mPopupAnchorView; private TextView mFolderSelectButton; private FolderPopupWindow mFolderPopupWindow; private String currentFolderPath; private ContentResolver contentResolver; private File mTempImageFile; private static final int CAMERA_REQUEST_CODE = 694; private ImageRecyclerViewAdapter imageRecyclerViewAdapter; private Uri imageUri; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_images_selector); ActionBar actionBar = getSupportActionBar(); if(actionBar != null) { actionBar.hide(); } Intent intent = getIntent(); SelectorSettings.mMaxImageNumber = intent.getIntExtra(SelectorSettings.SELECTOR_MAX_IMAGE_NUMBER, SelectorSettings.mMaxImageNumber); SelectorSettings.isShowCamera = intent.getBooleanExtra(SelectorSettings.SELECTOR_SHOW_CAMERA, SelectorSettings.isShowCamera); SelectorSettings.mMinImageSize = intent.getIntExtra(SelectorSettings.SELECTOR_MIN_IMAGE_SIZE, SelectorSettings.mMinImageSize); ArrayList<String> selected = intent.getStringArrayListExtra(SelectorSettings.SELECTOR_INITIAL_SELECTED_LIST); ImageListContent.SELECTED_IMAGES.clear(); if(selected != null && selected.size() > 0) { ImageListContent.SELECTED_IMAGES.addAll(selected); } mButtonBack = (ImageView) findViewById(R.id.selector_button_back); mButtonBack.setOnClickListener(this); mButtonConfirm = (Button) findViewById(R.id.selector_button_confirm); mButtonConfirm.setOnClickListener(this); View rview = findViewById(R.id.image_recycerview); if (rview instanceof RecyclerView) { Context context = rview.getContext(); recyclerView = (RecyclerView) rview; if (mColumnCount <= 1) { recyclerView.setLayoutManager(new LinearLayoutManager(context)); } else { recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount)); } imageRecyclerViewAdapter = new ImageRecyclerViewAdapter(ImageListContent.IMAGES, this); recyclerView.setAdapter(imageRecyclerViewAdapter); VerticalRecyclerViewFastScroller fastScroller = (VerticalRecyclerViewFastScroller) findViewById(R.id.recyclerview_fast_scroller); fastScroller.setRecyclerView(recyclerView); recyclerView.addOnScrollListener(fastScroller.getOnScrollListener()); } mPopupAnchorView = findViewById(R.id.selector_footer); mFolderSelectButton = (TextView) findViewById(R.id.selector_image_folder_button); mFolderSelectButton.setText(R.string.selector_folder_all); mFolderSelectButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { if (mFolderPopupWindow == null) { mFolderPopupWindow = new FolderPopupWindow(); mFolderPopupWindow.initPopupWindow(ImagesSelectorActivity.this); } if (mFolderPopupWindow.isShowing()) { mFolderPopupWindow.dismiss(); } else { mFolderPopupWindow.showAtLocation(mPopupAnchorView, Gravity.BOTTOM, 10, 150); } } }); currentFolderPath = ""; FolderListContent.clear(); ImageListContent.clear(); updateDoneButton(); requestReadStorageRuntimePermission(); } public void requestReadStorageRuntimePermission() { if (ContextCompat.checkSelfPermission(ImagesSelectorActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(ImagesSelectorActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_STORAGE_CODE); } else { LoadFolderAndImages(); } } public void requestCameraRuntimePermissions() { if (ContextCompat.checkSelfPermission(ImagesSelectorActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(ImagesSelectorActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(ImagesSelectorActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA_CODE); } else { launchCamera(); } } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case MY_PERMISSIONS_REQUEST_STORAGE_CODE: { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { LoadFolderAndImages(); } else { Toast.makeText(ImagesSelectorActivity.this, getString(R.string.selector_permission_error), Toast.LENGTH_SHORT).show(); } return; } case MY_PERMISSIONS_REQUEST_CAMERA_CODE: { if (grantResults.length == 2 && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) { launchCamera(); } else { Toast.makeText(ImagesSelectorActivity.this, getString(R.string.selector_permission_error), Toast.LENGTH_SHORT).show(); } return; } } } private final String[] projections = { MediaStore.Images.Media.DATA, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DATE_ADDED, MediaStore.Images.Media.MIME_TYPE, MediaStore.Images.Media.SIZE, MediaStore.Images.Media._ID}; public void LoadFolderAndImages() { ImageListContent.clear(); FolderListContent.clear(); Observable.just("") .flatMap(new Func1<String, Observable<ImageItem>>() { @Override public Observable<ImageItem> call(String folder) { List<ImageItem> results = new ArrayList<>(); Uri contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; String where = MediaStore.Images.Media.SIZE + " > " + SelectorSettings.mMinImageSize; String sortOrder = MediaStore.Images.Media.DATE_ADDED + " DESC"; contentResolver = getContentResolver(); Cursor cursor = contentResolver.query(contentUri, projections, where, null, sortOrder); if (cursor == null) { Log.d(TAG, "call: " + "Empty images"); } else if (cursor.moveToFirst()) { FolderItem allImagesFolderItem = null; int pathCol = cursor.getColumnIndex(MediaStore.Images.Media.DATA); int nameCol = cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME); int DateCol = cursor.getColumnIndex(MediaStore.Images.Media.DATE_ADDED); do { String path = cursor.getString(pathCol); String name = cursor.getString(nameCol); long dateTime = cursor.getLong(DateCol); ImageItem item = new ImageItem(name, path, dateTime); if(FolderListContent.FOLDERS.size() == 0) { FolderListContent.selectedFolderIndex = 0; allImagesFolderItem = new FolderItem(getString(R.string.selector_folder_all), "", path); FolderListContent.addItem(allImagesFolderItem); if(SelectorSettings.isShowCamera) { results.add(ImageListContent.cameraItem); allImagesFolderItem.addImageItem(ImageListContent.cameraItem); } } results.add(item); allImagesFolderItem.addImageItem(item); String folderPath = new File(path).getParentFile().getAbsolutePath(); FolderItem folderItem = FolderListContent.getItem(folderPath); if (folderItem == null) { folderItem = new FolderItem(StringUtils.getLastPathSegment(folderPath), folderPath, path); FolderListContent.addItem(folderItem); } folderItem.addImageItem(item); } while (cursor.moveToNext()); cursor.close(); } return Observable.from(results); } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<ImageItem>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { Log.d(TAG, "onError: " + Log.getStackTraceString(e)); } @Override public void onNext(ImageItem imageItem) { // Log.d(TAG, "onNext: " + imageItem.toString()); ImageListContent.addItem(imageItem); recyclerView.getAdapter().notifyItemChanged(ImageListContent.IMAGES.size()-1); } }); } public void updateDoneButton() { if(ImageListContent.SELECTED_IMAGES.size() == 0) { mButtonConfirm.setEnabled(false); } else { mButtonConfirm.setEnabled(true); } String caption = getResources().getString(R.string.selector_action_done, ImageListContent.SELECTED_IMAGES.size(), SelectorSettings.mMaxImageNumber); mButtonConfirm.setText(caption); } public void OnFolderChange() { mFolderPopupWindow.dismiss(); FolderItem folder = FolderListContent.getSelectedFolder(); if( !TextUtils.equals(folder.path, this.currentFolderPath) ) { this.currentFolderPath = folder.path; mFolderSelectButton.setText(folder.name); ImageListContent.IMAGES.clear(); ImageListContent.IMAGES.addAll(folder.mImages); recyclerView.getAdapter().notifyDataSetChanged(); } else { Log.d(TAG, "OnFolderChange: " + "Same folder selected, skip loading."); } } @Override public void onFolderItemInteraction(FolderItem item) { OnFolderChange(); } @Override public void onImageItemInteraction(ImageItem item) { if(ImageListContent.bReachMaxNumber) { String hint = getResources().getString(R.string.selector_reach_max_image_hint, SelectorSettings.mMaxImageNumber); Toast.makeText(ImagesSelectorActivity.this, hint, Toast.LENGTH_SHORT).show(); ImageListContent.bReachMaxNumber = false; } if(item.isCamera()) { requestCameraRuntimePermissions(); } updateDoneButton(); } public void launchCamera() { Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (cameraIntent.resolveActivity(getPackageManager()) != null) { try { mTempImageFile = FileUtils.createTmpFile(this); } catch (IOException e) { Log.e(TAG, "launchCamera: ", e); } if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ imageUri = FileProvider.getUriForFile(this,"com.example.image_selectro_lib.fileprovider",mTempImageFile); cameraIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(cameraIntent, CAMERA_REQUEST_CODE); return; } if (mTempImageFile != null && mTempImageFile.exists()) { cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mTempImageFile)); startActivityForResult(cameraIntent, CAMERA_REQUEST_CODE); } else { Toast.makeText(this, R.string.camera_temp_file_error, Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(this, R.string.msg_no_camera, Toast.LENGTH_SHORT).show(); } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == CAMERA_REQUEST_CODE) { if (resultCode == Activity.RESULT_OK) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(mTempImageFile))); imageRecyclerViewAdapter.addData(new ImageItem(mTempImageFile.getName(),mTempImageFile.getAbsolutePath(),System.currentTimeMillis())); }else { if (mTempImageFile != null) { sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(mTempImageFile))); imageRecyclerViewAdapter.addData(new ImageItem(mTempImageFile.getName(),mTempImageFile.getAbsolutePath(),System.currentTimeMillis())); } } } else { while (mTempImageFile != null && mTempImageFile.exists()) { boolean success = mTempImageFile.delete(); if (success) { mTempImageFile = null; } } } } } @Override public void onClick(View v) { if( v == mButtonBack) { setResult(Activity.RESULT_CANCELED); finish(); } else if(v == mButtonConfirm) { Intent data = new Intent(); data.putStringArrayListExtra(SelectorSettings.SELECTOR_RESULTS, ImageListContent.SELECTED_IMAGES); setResult(Activity.RESULT_OK, data); finish(); } } }
[ "yang2chao3@outlook.com" ]
yang2chao3@outlook.com
2d4da820bb73f981ce38914c9184ed758d87bbdb
a1813446b539e04524d68acd6a08482511a0073b
/mybatis-06/src/main/java/com/jie/pojo/Teacher.java
81d66ac115379498d984b057027616b12511c35f
[]
no_license
wang4418/Mybatis_Studay
c28230a2d51099b0259777294653d2673cf0e8c7
ef3c92f5e009dc2297665102c1d24bf1b689b4a1
refs/heads/master
2023-05-12T04:17:38.668736
2021-06-02T07:26:40
2021-06-02T07:26:40
345,050,896
0
0
null
null
null
null
UTF-8
Java
false
false
430
java
package com.jie.pojo; import lombok.Data; import java.util.List; /** * ClassName:Thacher * Package:com.jie.pojo * Description:每一个牛B的人物都有一段苦B的岁月,只要像傻B一样坚持,终将会牛B! * * @date:2021/4/10 12:06 * @author:VX438364246 */ @Data public class Teacher { private int id; private String name; //一个老师有多个学生 private List<Student> students; }
[ "1062871517@qq.com" ]
1062871517@qq.com
fd7fc352b1c2c599550cdabaf81a96f605b5476a
d7fa4cc8510202f391a7c667d22205ec39f3c1cd
/Hrishikesh Dombe/Assignments/Android/My_Android_Projects_on_OP5/03-Tricolor_Triangle/app/src/main/java/com/astromedicomp/opengl_tricolor_triangle/MainActivity.java
7c99739cd1f16f734f7b2890cbe35a19814d88ca
[]
no_license
RohitMagdum-VSI/VSIOpenGLDemos
f21ae6a91d41bbe3136e92c9c2eed985d3488607
763e2e3cc956122c5aad756961feb7259396d479
refs/heads/master
2022-02-21T21:42:53.601810
2022-02-10T13:51:24
2022-02-10T13:51:24
120,849,630
2
0
null
null
null
null
UTF-8
Java
false
false
1,313
java
package com.astromedicomp.opengl_tricolor_triangle; //Default supplied package by android SDK import android.app.Activity; import android.os.Bundle; //Later added package import android.view.Window; import android.view.WindowManager; import android.content.pm.ActivityInfo; public class MainActivity extends Activity { private GLESView glesView; @Override protected void onCreate(Bundle savedInstanceState) { System.out.println("HD: 0"); super.onCreate(savedInstanceState); // System.out.println("HD: 1"); // //This is done to remove ActionBar requestWindowFeature(Window.FEATURE_NO_TITLE); // System.out.println("HD: 2"); // //This is done to make Window Fullscreen getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); // //setContentView(R.layout.activity_main); // //Force activity window orientation to landscape MainActivity.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); glesView = new GLESView(this); // System.out.println("HD: 3"); // //Set view as content view of the Activity setContentView(glesView); // System.out.println("HD: 4"); } @Override protected void onPause() { super.onPause(); } @Override protected void onResume() { super.onResume(); } }
[ "hrishikeshdombe@gmail.com" ]
hrishikeshdombe@gmail.com
74ecfd600911f7601298a872fc40920fc0491513
ecfe9f21711e09b8bfc30d8a68b02ef1749fa67d
/src/main/java/com/sharksharding/util/mapper/SharkAnnotationResolver.java
c29a7c2d2f7477f2e2e027ed61598b9e9dda194c
[ "Apache-2.0" ]
permissive
zogwei/shark
fe2fa35bf90b4db7da5de331fb43b70f28af5fed
5f0c3396818252a23ea511d0dc0160f160f4ca8d
refs/heads/master
2021-01-15T20:33:23.006475
2016-06-04T01:02:42
2016-06-04T01:02:42
60,510,073
1
0
null
2016-06-06T08:06:32
2016-06-06T08:06:32
null
UTF-8
Java
false
false
1,361
java
/* * Copyright 2015-2101 gaoxianglong * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.sharksharding.util.mapper; import java.lang.reflect.Field; import java.sql.ResultSet; /** * shark注解解析器接口 * * @author gaoxianglong * * @version 1.4.1 */ public interface SharkAnnotationResolver { /** * 字段注解解析 * * @author JohnGao * * @param goalObject * 目标对象, 即需要被自动赋值的对象 * * @param ResultSet * * @exception MapperException * * @return void */ public <T> void fieldResolver(T goalObject, ResultSet rs); /** * 类型注解解析 * * @author JohnGao * * @param goalObject * 目标对象, 即需要被自动赋值的对象 * * @return boolean 解析结果 */ public <T> boolean classResolver(T goalObject); }
[ "gaoxianglong@sina.com" ]
gaoxianglong@sina.com
a71a5cb56600451c6cbdf0538e960eb609424e22
7f15ad21347e9482e4a1456b0630ccdfb450464e
/app/src/main/java/com/example/steph/blijdorp/MainFoodRoute0900Activity.java
ab4aa2ba20c4e943eb4b799924969ce2673de5f4
[]
no_license
SGordijn/Blijdorp
3796da7226cd93de31c5892b18d13310912d1e05
86e53a82096cbf2eaab3281276765f323604d811
refs/heads/master
2020-04-16T02:48:57.304635
2019-01-18T08:16:09
2019-01-18T08:16:09
165,207,331
0
0
null
null
null
null
UTF-8
Java
false
false
9,348
java
package com.example.steph.blijdorp; import android.Manifest; import android.content.pm.PackageManager; import android.graphics.Color; import android.location.Location; import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.location.LocationListener; import android.support.v4.content.ContextCompat; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.Polyline; import com.google.android.gms.maps.model.PolylineOptions; public class MainFoodRoute0900Activity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { private GoogleMap mMap; GoogleApiClient mGoogleApiClient; Location mLastLocation; Marker mCurrLocationMarker; LocationRequest mLocationRequest; private GoogleApiClient mClient; public static final int MY_PERMISSIONS_REQUEST_LOCATION = 99; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_food_route0900); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); mClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { checkLocationPermission(); } } public boolean checkLocationPermission() { if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, MY_PERMISSIONS_REQUEST_LOCATION); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, MY_PERMISSIONS_REQUEST_LOCATION); } return false; } else { return true; } } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case MY_PERMISSIONS_REQUEST_LOCATION: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { if (mGoogleApiClient == null) { buildGoogleApiClient(); } mMap.setMyLocationEnabled(true); } } else { Toast.makeText(this, "Geen Toestemming", Toast.LENGTH_LONG).show(); } return; } } } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { buildGoogleApiClient(); mMap.setMyLocationEnabled(true); } } else { buildGoogleApiClient(); mMap.setMyLocationEnabled(true); } // Polyline line = mMap.addPolyline(new PolylineOptions() // .add(new LatLng(51.5, -0.1), new LatLng(40.7, -74.0)) // .width(5) // .color(Color.RED)); LatLng routeStart = new LatLng(51.928040, 4.444514); mMap.addMarker(new MarkerOptions().position(routeStart).title("Start Route. Klik op pinnetjes voor informatie.")).showInfoWindow(); mMap.moveCamera(CameraUpdateFactory.newLatLng(routeStart)); float zoomLevel = 18.0f; mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(routeStart, zoomLevel)); Polyline line1 = mMap.addPolyline(new PolylineOptions() .add(new LatLng(51.928040, 4.444514), new LatLng(51.928263, 4.444680)) .width(5) .color(Color.RED)); LatLng routeFood1 = new LatLng(51.928263, 4.444680); mMap.addMarker(new MarkerOptions().position(routeFood1).title("Zeeleeuwen. 10:30 / 15:45")); Polyline line2 = mMap.addPolyline(new PolylineOptions() .add(new LatLng(51.928263, 4.444680), new LatLng(51.928285, 4.445929)) .width(5) .color(Color.RED)); LatLng routeFood2 = new LatLng(51.928285, 4.445929); mMap.addMarker(new MarkerOptions().position(routeFood2).title("Pinguïns. 13:30")); Polyline line3 = mMap.addPolyline(new PolylineOptions() .add(new LatLng(51.928285, 4.445929), new LatLng(51.926351, 4.453474)) .width(5) .color(Color.RED)); LatLng routeFood3 = new LatLng(51.926351, 4.453474); mMap.addMarker(new MarkerOptions().position(routeFood3).title("Amoerpanters. 15:00")); Polyline line4 = mMap.addPolyline(new PolylineOptions() .add(new LatLng(51.926351, 4.453474), new LatLng(51.928225, 4.450200)) .width(5) .color(Color.RED)); LatLng routeMainEnd = new LatLng(51.928225, 4.450200); mMap.addMarker(new MarkerOptions().position(routeMainEnd).title("Einde route. Vergeet niet souveniers te kopen.")); // Add a marker in Sydney and move the camera // LatLng sydney = new LatLng(-34, 151); // mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); // mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); } protected synchronized void buildGoogleApiClient() { mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); mGoogleApiClient.connect(); } @Override public void onLocationChanged(Location location) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } @Override public void onConnected(@Nullable Bundle bundle) { if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { mLastLocation = LocationServices.FusedLocationApi.getLastLocation( mGoogleApiClient); } LatLng ownLocation = new LatLng(mLastLocation.getLatitude(), mLastLocation .getLongitude()); // mMap.addMarker(new MarkerOptions().position(ownLocation).title("Je bent hier.")); // mMap.moveCamera(CameraUpdateFactory.newLatLng(ownLocation)); } @Override public void onConnectionSuspended(int i) { } @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { } }
[ "stephangordijn@gmail.com" ]
stephangordijn@gmail.com
019a83d67fd335e2e08c85000faafa4290f79ce1
76253f1d285d39338ec7339d0bedf8035b06e292
/src/main/java/com/jt/msg/bean/MsgException.java
f00facaea7b68c90e3a312c12091320d08a0adbc
[ "Apache-2.0" ]
permissive
jt120/msg-jsp
7a7c209f7c22b7c9e4bc9424f2b5c5720f3a1af7
32ede22471b7eaa1dd43ea79a4f71739bac02d25
refs/heads/master
2016-09-06T16:06:30.165939
2015-04-30T13:08:33
2015-04-30T13:08:33
34,665,682
1
0
null
null
null
null
UTF-8
Java
false
false
348
java
package com.jt.msg.bean; /** * since 2015/4/27. */ public class MsgException extends RuntimeException { public MsgException() { super(); } public MsgException(String message) { super(message); } public MsgException(String message, Throwable cause) { super(message, cause); } }
[ "jt120lz@gmail.com" ]
jt120lz@gmail.com
dc07f8dc18aed6e99c4dd12bb13af12f7ea4faa7
1ae0bb9ef63b6400e57be600aa9c25e6d23f9e84
/src/main/java/view/update/UpdateInformation.java
9b95ec3808ccea547980b6014938a8fa0f06f81e
[ "WTFPL" ]
permissive
vnebelung/ProDisFuzz-Main
dc344eedadd144f6c7428a41e65946487d85c26a
6b04836f2b6a88fde0d27a26a925bbcd0683eeac
refs/heads/master
2020-04-14T12:28:21.187821
2016-08-28T18:30:05
2016-08-28T18:30:05
9,205,967
1
1
null
null
null
null
UTF-8
Java
false
false
1,141
java
/* * This file is part of ProDisFuzz, modified on 28.08.16 19:39. * Copyright (c) 2013-2016 Volker Nebelung <vnebelung@prodisfuzz.net> * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, * as published by Sam Hocevar. See the COPYING file for more details. */ package view.update; import javafx.fxml.FXML; import javafx.scene.control.TextArea; import javafx.scene.layout.VBox; import view.window.FxmlConnection; /** * This class is the JavaFX based update information component, responsible for visualizing the changelog of newer * versions of ProDisFuzz than the current one. */ public class UpdateInformation extends VBox { @FXML private TextArea textArea; /** * Constructs a update information component. * * @param text the text containing the changelog */ public UpdateInformation(String text) { super(); //noinspection HardCodedStringLiteral FxmlConnection.connect(getClass().getResource("/fxml/updateInformation.fxml"), this); textArea.setText(text); } }
[ "vnebelung@prodisfuzz.net" ]
vnebelung@prodisfuzz.net
224dc33d875e3f5c22a68490ec1293e05a646e6b
18e8f498d16b004802e0bca83069fe1e2e1d5531
/src/main/java/com/luojbin/designPattern/p10_iterator/iterator/DinerIterator.java
05e13e4e7f94b105c08c7ddb9a19236ac923ebb6
[]
no_license
luojbin/designPattern
36f1d0109054526282fc5f802ea0189b32b23909
ed706a5bb85f81bc6e553fbaca704e180297c0a2
refs/heads/master
2021-09-27T02:32:38.607746
2021-09-01T15:03:44
2021-09-01T15:03:44
124,353,429
0
0
null
2020-10-13T08:54:39
2018-03-08T07:24:31
Java
UTF-8
Java
false
false
679
java
package com.luojbin.designPattern.p10_iterator.iterator; import com.luojbin.designPattern.p10_iterator.menu.MenuItem; /** * @author luojbin * @create 2018/3/20 9:46 */ public class DinerIterator implements Iterator { MenuItem[] items; int position = 0; public DinerIterator(MenuItem[] items) { this.items = items; } @Override public boolean hasNext() { if(position >= items.length || items[position] == null){ return false; }else{ return true; } } @Override public Object next() { MenuItem menuItem = items[position]; position++; return menuItem; } }
[ "z1_2x@msn.com" ]
z1_2x@msn.com
b9cead5537caf1b85b1c85394933ce60c6451eeb
f382dae0dcb7f9b30b91b32dee0921bf1a7df380
/Yollweb-common/src/main/java/com/yollweb/org/springboot/cloud/utils/ExceptionUtils.java
9db25683205457caa953423fd0f131dd7a9e5ccd
[]
no_license
tianfangxu/Yollweb
14cdd1e47287be21a38378b1da7f358070975ba0
546c1cd58fdd4d09d7d6175faa2d8eab4790206e
refs/heads/master
2020-04-18T13:27:09.788344
2019-01-25T14:41:57
2019-01-25T14:41:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,141
java
package com.yollweb.org.springboot.cloud.utils; import java.io.PrintWriter; import java.io.StringWriter; import javax.servlet.http.HttpServletRequest; import com.yollweb.org.springboot.cloud.exception.AppException; public class ExceptionUtils { public static AppException appException(Exception e) { if (e instanceof AppException) { return (AppException) e; } else { return new AppException(e); } } /** * 将CheckedException转换为UncheckedException. */ public static RuntimeException unchecked(Exception e) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new RuntimeException(e); } } /** * 将ErrorStack转化为String. */ public static String getStackTraceAsString(Throwable e) { if (e == null) { return ""; } StringWriter stringWriter = new StringWriter(); e.printStackTrace(new PrintWriter(stringWriter)); return stringWriter.toString(); } /** * 判断异常是否由某些底层的异常引起. */ public static boolean isCausedBy(Exception ex, Class<? extends Exception>... causeExceptionClasses) { Throwable cause = ex.getCause(); while (cause != null) { for (Class<? extends Exception> causeClass : causeExceptionClasses) { if (causeClass.isInstance(cause)) { return true; } } cause = cause.getCause(); } return false; } /** * 在request中获取异常类 * * @param request * @return */ public static Throwable getThrowable(HttpServletRequest request) { Throwable ex = null; if (request.getAttribute("exception") != null) { ex = (Throwable) request.getAttribute("exception"); } else if (request.getAttribute("javax.servlet.error.exception") != null) { ex = (Throwable) request.getAttribute("javax.servlet.error.exception"); } return ex; } }
[ "v_yuanjiajia@saicmotor.com" ]
v_yuanjiajia@saicmotor.com
fc456ac6d5cc87cb55473bfdc8ad0befc2512df2
d3f81dfd14da562224ecd6736ad5d5ec28cd600b
/MyCoupon/coupon-service/coupon-template/src/main/java/com/stackingrule/coupon/dao/CouponTemplateDao.java
05a9af19188a79bf98303f5b2b1a77b968591d00
[]
no_license
yczxxs1/MyCoupon
0c4cb3d6b669ee07061f164155c60f09b610a6bf
2c56e3f7bf42a7f11d9de476cbaa93db5d99675b
refs/heads/master
2022-10-21T23:07:44.720002
2020-06-11T00:01:04
2020-06-11T00:01:04
264,198,107
0
0
null
2020-05-15T13:16:35
2020-05-15T13:16:34
null
UTF-8
Java
false
false
919
java
package com.stackingrule.coupon.dao; import com.stackingrule.coupon.entity.CouponTemplate; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; /** * <h1>CouponTemplateDao 接口定义</h1> */ public interface CouponTemplateDao extends JpaRepository<CouponTemplate, Integer> { /** * <h2>根据模板名称查询模板</h2> * where name = ... * @param name * @return */ CouponTemplate findByName(String name); /** * <h2>根据 available 和 expired 标记查找模板记录</h2> * @param available * @param expired * @return */ List<CouponTemplate> findAllByAvailableAndExpired( Boolean available, Boolean expired ); /** * <h2>根据 expired 标记查找模板记录</h2> * @param expired * @return */ List<CouponTemplate> findAllByExpired(Boolean expired); }
[ "messageswitching@gmail.com" ]
messageswitching@gmail.com
96f3a9b023f00cad908db03a75147386a276c304
0a76bec338c1983934446aca1e708e5e9479d243
/tillerinobot/src/main/java/tillerino/tillerinobot/lang/Polski.java
db72f789ae446a0450e0462f11522871fd64b750
[]
no_license
shavitush/Tillerinobot
11b9fd89ea470eb61e14518fab30f310355b0a1f
b360867d0e2c0be7d9768e8f12bf7b2bc16760a0
refs/heads/master
2021-01-21T05:36:12.458783
2015-10-06T12:50:01
2015-10-06T12:50:01
43,749,945
0
0
null
2015-10-06T12:44:35
2015-10-06T12:44:33
Java
UTF-8
Java
false
false
7,349
java
package tillerino.tillerinobot.lang; import java.util.List; import java.util.Random; import org.tillerino.osuApiModel.Mods; import org.tillerino.osuApiModel.OsuApiUser; import tillerino.tillerinobot.BeatmapMeta; import tillerino.tillerinobot.IRCBot.IRCBotUser; import tillerino.tillerinobot.RecommendationsManager.Recommendation; /** * Polish language implementation by https://osu.ppy.sh/u/pawwit */ public class Polski implements Language { @Override public String unknownBeatmap() { return "Przykro mi, nie znam tej mapy. Możliwe że jest ona nowa albo nierankingowa."; } @Override public String internalException(String marker) { return "Ugh... Wygląda na to że Tillerino (człowiek) uszkodził moje obwody." + "Gdyby wkrótce tego nie zauważył, Możesz go poinformować? Znajdziesz go na @Tillerino lub /u/Tillerino? (odwołanie " + marker + ")"; } @Override public String externalException(String marker) { return "Co jest?! Odpowiedź serwera osu nie ma sensu. Możesz mi powiedzieć co to znaczy \"0011101001010000\"?" + " Tillerino (człowiek) mówi, żeby się tym nie przejmować oraz że powinniśmy spróbować jeszcze raz." + " Jeśli jesteś bardzo zaniepokojony z jakiegoś powodu, możesz mu powiedzieć o tym na @Tillerino lub /u/Tillerino. (odwołanie " + marker + ")"; } @Override public String noInformationForModsShort() { return "brak danych dla wskazanych modów"; } @Override public void welcomeUser(IRCBotUser user, OsuApiUser apiUser, long inactiveTime) { if(inactiveTime < 60 * 1000) { user.message("beep boop"); } else if(inactiveTime < 24 * 60 * 60 * 1000) { user.message("Witaj ponownie, " + apiUser.getUserName() + "."); } else if(inactiveTime > 7l * 24 * 60 * 60 * 1000) { user.message(apiUser.getUserName() + "..."); user.message("...czy to Ty? Minęło sporo czasu!"); user.message("Dobrze znowu Cie widzieć. Chcesz usłyszeć kilka rekomendacji?"); } else { String[] messages = { "wygląda na to że chcesz jakieś rekomendacje.", "jak dobrze Cie widzieć! :)", "mój ulubiony człowiek. (Nie mów o tym innym ludziom!)", "jakie miłe zaskoczenie! ^.^", "Miałem nadzieję, że się pojawisz. Jesteś fajniejszy niż inni ludzie :3 (nie mówi im że Ci to powiedziałem!)", "jak się masz?", }; Random random = new Random(); String message = messages[random.nextInt(messages.length)]; user.message(apiUser.getUserName() + ", " + message); } } @Override public String unknownCommand(String command) { return "nieznana komenda \"" + command + "\". jeśli potrzebujesz pomocy napisz \"!help\" !"; } @Override public String noInformationForMods() { return "Przykro mi, nie mogę dostarczyć informacji dla tych modów w tym momencie."; } @Override public String malformattedMods(String mods) { return "Coś się nie zgadza. Mody mogą być dowolną kombinacją DT HR HD HT EZ NC FL SO NF. Łącz je nie używając spacji, ani żadnych znaków. Przykład: !with HDHR, !with DTEZ"; } @Override public String noLastSongInfo() { return "Nie pamiętam żebyś pytał się ostatnio o jakąś piosenkę..."; } @Override public String tryWithMods() { return "Spróbuj zagrać tą mapę z modami!"; } @Override public String tryWithMods(List<Mods> mods) { return "Spróbuj zagrać tą mapę z " + Mods.toShortNamesContinuous(mods); } /** * The user's IRC nick name could not be resolved to an osu user id. The * message should suggest to contact @Tillerinobot or /u/Tillerino. * * @param exceptionMarker * a marker to reference the created log entry. six or eight * characters. * @param name * the irc nick which could not be resolved * @return */ public String unresolvableName(String exceptionMarker, String name) { return "Twoja nazwa wydaje mi się jakaś dziwna. Jesteś zbanowany? Jeśli nie napisz na @Tillerino lub /u/Tillerino (odwołanie " + exceptionMarker + ")"; } @Override public String excuseForError() { return "Wybacz, widziałem piękną sekwencję zer i jedynek przez co się trochę rozkojarzyłem. Mógłbyś powtórzyć co chciałeś?"; } @Override public String complaint() { return "Twoje zgłoszenie zostało wypełnione. Tillerino zerknie na nie jak tylko będzie mógł."; } @Override public void hug(final IRCBotUser user, OsuApiUser apiUser) { user.message("Chodź tu!"); user.action("przytula " + apiUser.getUserName()); } @Override public String help() { return "Hej! Jestem robotem który zabił Tillerino, aby przejąc jego konto. Tylko żartowałem, czasem używam tego konta." + " Sprawdź https://twitter.com/Tillerinobot żeby zobaczyć najnowsze aktualizacje!" + " Odwiedź https://github.com/Tillerino/Tillerinobot/wiki żeby poznać komendy!"; } @Override public String faq() { return "Wejdź na https://github.com/Tillerino/Tillerinobot/wiki/FAQ aby zobaczyć FAQ!"; } @Override public String featureRankRestricted(String feature, int minRank, OsuApiUser user) { return "Przepraszam, ale w tym momencie " + feature + " jest dostępna tylko dla ludzi którzy przekroczyli pozycję " + minRank + " w rankingu."; } @Override public String mixedNomodAndMods() { return "Jak chcesz połączyć brak modów z modami?"; } @Override public String outOfRecommendations() { return "Skończyły mi się pomysł co mogę Ci jeszcze polecić." + " Sprawdź inne opcje polecania albo użyj komendy !reset. Jeśli nie wiesz o co mi chodzi wpisz !help."; } @Override public String notRanked() { return "Wygląda na to, że ta mapa nie jest rankingowa."; } @Override public void optionalCommentOnNP(IRCBotUser user, OsuApiUser apiUser, BeatmapMeta meta) { // regular Tillerino doesn't comment on this // return "Ok, zapamiętam tą mapę!"; } @Override public void optionalCommentOnWith(IRCBotUser user, OsuApiUser apiUser, BeatmapMeta meta) { // regular Tillerino doesn't comment on this // return "Ok, zapamiętam te mody"; } @Override public void optionalCommentOnRecommendation(IRCBotUser user, OsuApiUser apiUser, Recommendation meta) { // regular Tillerino doesn't comment on this // I have no idea what Tillerino can say with recommendation } @Override public boolean isChanged() { return false; } @Override public void setChanged(boolean changed) { } @Override public String invalidAccuracy(String acc) { return "Nieprawidłowa celność: \"" + acc + "\""; } @Override public void optionalCommentOnLanguage(IRCBotUser user, OsuApiUser apiUser) { user.message("Pawwit nauczył mnie jak mówić po polsku, jeśli uważasz, że gdzieś się pomylił napisz do niego na osu!"); } @Override public String invalidChoice(String invalid, String choices) { return "Wybacz, nie wiem co \"" + invalid + "\" znaczy. Spróbuj: " + choices + "!"; } @Override public String setFormat() { return "Składnia polecenia \"!set\" jest następująca \"!set opcja wartość\". Wpisz !help jeśli potrzebujesz więcej wskazówek."; } @Override public String apiTimeoutException() { return new Default().apiTimeoutException(); } @Override public String noRecentPlays() { return new Default().noRecentPlays(); } }
[ "tillmann.gaida@gmail.com" ]
tillmann.gaida@gmail.com
5791bf68494c73e9078bc1a222ffcbb0d1ff1685
eadc280718d28598a4dcd51ad38e9ffe57908760
/src/main/java/com/bttc/HappyGraduation/scheduler/JobTypeFactory.java
6622efd25880cff36439ea109f4777906609bb5a
[]
no_license
dingkc/happy-graduation
34e6a14cd6f6640095c17ccf79756b5cd74cfd39
e4fdcaff3f4d54b9cfbbd4422fc4c0f9fe5427a6
refs/heads/master
2020-04-09T10:57:17.366145
2019-06-05T09:26:27
2019-06-05T09:26:27
160,289,292
1
0
null
2019-06-04T10:13:40
2018-12-04T03:13:38
JavaScript
UTF-8
Java
false
false
718
java
package com.bttc.HappyGraduation.scheduler; import com.bttc.HappyGraduation.scheduler.service.AbstractScanService; import org.springframework.stereotype.Component; import javax.annotation.Resource; /** * Created by jiajt on 2018/11/7. */ @Component public class JobTypeFactory { @Resource AbstractScanService circleScanServiceImpl; @Resource AbstractScanService singleScanServiceImpl; public AbstractScanService getBaseJobInstance(String schedulerType){ switch (schedulerType){ case "I": return singleScanServiceImpl; case "C": return circleScanServiceImpl; default: return null; } } }
[ "kaiz1121@163.com" ]
kaiz1121@163.com
487434ab028f327ac5b9e2974a8215935c4c1883
03f520be7603d92e102f7a482112ab783a459594
/src/main/java/study/servlet/web/frontcontroller/v4/controller/MemberSaveControllerV4.java
bed947235c9528e786b3d035ba9bcb547dbca1fa
[]
no_license
dayleMG/PastBackEndStudy
1c9be3876715e81f8f9de9fe6fe7a94b8e2e52bd
dabb23b52aed475f5b5eba0b95357c7c0d8287c7
refs/heads/master
2023-06-25T07:06:11.132096
2021-07-31T09:20:29
2021-07-31T09:20:29
387,744,924
0
0
null
null
null
null
UTF-8
Java
false
false
836
java
package study.servlet.web.frontcontroller.v4.controller; import study.servlet.domain.member.Member; import study.servlet.domain.member.MemberRepo; import study.servlet.web.frontcontroller.ModelView; import study.servlet.web.frontcontroller.v3.ControllerV3; import study.servlet.web.frontcontroller.v4.ControllerV4; import java.util.Map; public class MemberSaveControllerV4 implements ControllerV4 { private MemberRepo memberRepo = MemberRepo.getInstance(); @Override public String process(Map<String, String> paramMap, Map<String, Object> model) { String username = paramMap.get("username"); int age = Integer.parseInt(paramMap.get("age")); Member member = new Member(username, age); memberRepo.save(member); model.put("member", member); return "save-result"; } }
[ "dayle998@naver.com" ]
dayle998@naver.com
6b7301d6dd91483791342f39eb71408beb1210d7
b495e9cc9350af99b86f80bcad34ea50443d7c07
/Andromeda's Compiler/simple/src/com/google/devtools/simple/classfiles/Method.java
fd582f5c9dacfb74e73f1245d337377b801af5b3
[ "LicenseRef-scancode-other-permissive" ]
permissive
GiorgosXou/Andromeda-Project
4da1d66688c7c0e9a90e92121501d641dd17c421
544c9eabae1243a8ded3b6b381a48518516bd9bc
refs/heads/master
2021-01-22T06:48:49.395804
2019-11-12T17:08:35
2019-11-12T17:08:35
81,789,175
6
3
null
null
null
null
UTF-8
Java
false
false
62,736
java
/* * Copyright 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.devtools.simple.classfiles; import com.google.devtools.simple.compiler.Compiler; import com.google.devtools.simple.util.Preconditions; import java.util.ArrayList; import java.util.List; /** * Representation of a method in a class file. * * <p>For more information about the method descriptors see the Java VM * specification. * * <p>Note: Before you start generating code for a method, you must call * {@link #startCodeGeneration()}. After all code had been generated you must * not forget to call {@link #finishCodeGeneration()}. * * @author Herbert Czymontek */ public final class Method { /** * Defines a Label within the Code attribute of a method. */ public static class Label { // Offset within the code that is being labeled private int offset; } /* * Defines a fixup that needs to be done after all labels have been resolved. */ private static class Fixup { // Fixup kinds private static final byte FIXUP_BRANCH = 0; // Offset in code buffer at which the fixup needs to be done private final int offset; // Kind of fixup to be done private final byte kind; // Label the fixup refers to private final Label label; /* * Creates a new fixup. */ Fixup(byte kind, int offset, Label label) { this.kind = kind; this.offset = offset; this.label = label; } } /* * Defines an exception table entry for the method. For more information about exception tables * see the Java VM specification. */ private class ExceptionTableEntry { // Analogous to the exception table entry definition of Java VM specification private final Label startLabel; private final Label endLabel; private final Label handlerLabel; private final short exceptionIndex; /* * Creates a new exception table entry. */ ExceptionTableEntry(Label startLabel, Label endLabel, Label handlerLabel, short exceptionIndex) { this.startLabel = startLabel; this.endLabel = endLabel; this.handlerLabel = handlerLabel; this.exceptionIndex = exceptionIndex; } /* * Generates the exception table entry into the class file data buffer. */ void generate() { classFile.generate16((short) startLabel.offset); classFile.generate16((short) endLabel.offset); classFile.generate16((short) handlerLabel.offset); classFile.generate16(exceptionIndex); } } /* * Defines a line number table entry. For more information about line number tables see the Java * VM specification. */ private class LineNumberTableEntry { // Analogous to the line number table entry definition of Java VM specification private final short offset; private final short line; LineNumberTableEntry(short offset, short line) { this.offset = offset; this.line = line; } /* * Generates the line number table entry into the class file data buffer. */ void generate() { classFile.generate16(offset); classFile.generate16(line); } } /* * Defines a local variable table entry. For more information about local variable tables see * the Java VM specification. */ private class LocalVariableTableEntry { private final Label startLabel; private final Label endLabel; private final short name; private final short signature; private final short slot; LocalVariableTableEntry(Label startLabel, Label endLabel, short name, short signature, short slot) { this.startLabel = startLabel; this.endLabel = endLabel; this.name = name; this.signature = signature; this.slot = slot; } /* * Generates the local variable table entry into the class file data buffer. */ void generate() { classFile.generate16((short) startLabel.offset); classFile.generate16((short) (endLabel.offset - startLabel.offset)); classFile.generate16(name); classFile.generate16(signature); classFile.generate16(slot); } } // Maximum variable index private static final int MAX_VARIABLE_INDEX = 0xFFFF; /** * Method access flags. */ public static final short ACC_PUBLIC = 0x0001; public static final short ACC_PRIVATE = 0x0002; public static final short ACC_PROTECTED = 0x0004; public static final short ACC_STATIC = 0x0008; public static final short ACC_FINAL = 0x0010; public static final short ACC_SYNCHRONIZED = 0x0020; public static final short ACC_BRIDGE = 0x0040; public static final short ACC_VARARGS = 0x0080; public static final short ACC_NATIVE = 0x01000; public static final short ACC_ABSTRACT = 0x0400; public static final short ACC_STRICT = 0x0800; public static final short ACC_SYNTHETIC = 0x1000; // Mask containing all valid method access flags private static final short ALLOWED_ACC_FLAGS = ACC_PUBLIC|ACC_PRIVATE |ACC_PROTECTED|ACC_STATIC| ACC_FINAL|ACC_SYNCHRONIZED|ACC_BRIDGE|ACC_VARARGS |ACC_NATIVE|ACC_ABSTRACT |ACC_STRICT| ACC_SYNTHETIC; // Constants for type designators (used by newarray instruction) private static final byte T_BOOLEAN = 4; private static final byte T_CHAR = 5; private static final byte T_FLOAT = 6; private static final byte T_DOUBLE = 7; private static final byte T_BYTE = 8; private static final byte T_SHORT = 9; private static final byte T_INT = 10; private static final byte T_LONG = 11; // Constants for bytecode mnemonics private static final byte INSTR_nop = (byte) 0x00; private static final byte INSTR_aconst_null = (byte) 0x01; //private static final byte INSTR_iconst_m1 = (byte) 0x02; private static final byte INSTR_iconst_0 = (byte) 0x03; //private static final byte INSTR_iconst_1 = (byte) 0x04; //private static final byte INSTR_iconst_2 = (byte) 0x05; //private static final byte INSTR_iconst_3 = (byte) 0x06; //private static final byte INSTR_iconst_4 = (byte) 0x07; //private static final byte INSTR_iconst_5 = (byte) 0x08; private static final byte INSTR_lconst_0 = (byte) 0x09; private static final byte INSTR_lconst_1 = (byte) 0x0A; private static final byte INSTR_fconst_0 = (byte) 0x0B; private static final byte INSTR_fconst_1 = (byte) 0x0C; private static final byte INSTR_fconst_2 = (byte) 0x0D; private static final byte INSTR_dconst_0 = (byte) 0x0E; private static final byte INSTR_dconst_1 = (byte) 0x0F; private static final byte INSTR_bipush = (byte) 0x10; private static final byte INSTR_sipush = (byte) 0x11; private static final byte INSTR_ldc = (byte) 0x12; private static final byte INSTR_ldc_w = (byte) 0x13; private static final byte INSTR_ldc2_w = (byte) 0x14; private static final byte INSTR_iload = (byte) 0x15; private static final byte INSTR_lload = (byte) 0x16; private static final byte INSTR_fload = (byte) 0x17; private static final byte INSTR_dload = (byte) 0x18; private static final byte INSTR_aload = (byte) 0x19; private static final byte INSTR_iload_0 = (byte) 0x1A; //private static final byte INSTR_iload_1 = (byte) 0x1B; //private static final byte INSTR_iload_2 = (byte) 0x1C; //private static final byte INSTR_iload_3 = (byte) 0x1D; private static final byte INSTR_lload_0 = (byte) 0x1E; //private static final byte INSTR_lload_1 = (byte) 0x1F; //private static final byte INSTR_lload_2 = (byte) 0x20; //private static final byte INSTR_lload_3 = (byte) 0x21; private static final byte INSTR_fload_0 = (byte) 0x22; //private static final byte INSTR_fload_1 = (byte) 0x23; //private static final byte INSTR_fload_2 = (byte) 0x24; //private static final byte INSTR_fload_3 = (byte) 0x25; private static final byte INSTR_dload_0 = (byte) 0x26; //private static final byte INSTR_dload_1 = (byte) 0x27; //private static final byte INSTR_dload_2 = (byte) 0x28; //private static final byte INSTR_dload_3 = (byte) 0x29; private static final byte INSTR_aload_0 = (byte) 0x2A; //private static final byte INSTR_aload_1 = (byte) 0x2B; //private static final byte INSTR_aload_2 = (byte) 0x2C; //private static final byte INSTR_aload_3 = (byte) 0x2D; private static final byte INSTR_iaload = (byte) 0x2E; private static final byte INSTR_laload = (byte) 0x2F; private static final byte INSTR_faload = (byte) 0x30; private static final byte INSTR_daload = (byte) 0x31; private static final byte INSTR_aaload = (byte) 0x32; private static final byte INSTR_baload = (byte) 0x33; private static final byte INSTR_caload = (byte) 0x34; private static final byte INSTR_saload = (byte) 0x35; private static final byte INSTR_istore = (byte) 0x36; private static final byte INSTR_lstore = (byte) 0x37; private static final byte INSTR_fstore = (byte) 0x38; private static final byte INSTR_dstore = (byte) 0x39; private static final byte INSTR_astore = (byte) 0x3A; private static final byte INSTR_istore_0 = (byte) 0x3B; //private static final byte INSTR_istore_1 = (byte) 0x3C; //private static final byte INSTR_istore_2 = (byte) 0x3D; //private static final byte INSTR_istore_3 = (byte) 0x3E; private static final byte INSTR_lstore_0 = (byte) 0x3F; //private static final byte INSTR_lstore_1 = (byte) 0x40; //private static final byte INSTR_lstore_2 = (byte) 0x41; //private static final byte INSTR_lstore_3 = (byte) 0x42; private static final byte INSTR_fstore_0 = (byte) 0x43; //private static final byte INSTR_fstore_1 = (byte) 0x44; //private static final byte INSTR_fstore_2 = (byte) 0x45; //private static final byte INSTR_fstore_3 = (byte) 0x46; private static final byte INSTR_dstore_0 = (byte) 0x47; //private static final byte INSTR_dstore_1 = (byte) 0x48; //private static final byte INSTR_dstore_2 = (byte) 0x49; //private static final byte INSTR_dstore_3 = (byte) 0x4A; private static final byte INSTR_astore_0 = (byte) 0x4B; //private static final byte INSTR_astore_1 = (byte) 0x4C; //private static final byte INSTR_astore_2 = (byte) 0x4D; //private static final byte INSTR_astore_3 = (byte) 0x4E; private static final byte INSTR_iastore = (byte) 0x4F; private static final byte INSTR_lastore = (byte) 0x50; private static final byte INSTR_fastore = (byte) 0x51; private static final byte INSTR_dastore = (byte) 0x52; private static final byte INSTR_aastore = (byte) 0x53; private static final byte INSTR_bastore = (byte) 0x54; private static final byte INSTR_castore = (byte) 0x55; private static final byte INSTR_sastore = (byte) 0x56; private static final byte INSTR_pop = (byte) 0x57; private static final byte INSTR_pop2 = (byte) 0x58; private static final byte INSTR_dup = (byte) 0x59; private static final byte INSTR_dup_x1 = (byte) 0x5A; private static final byte INSTR_dup_x2 = (byte) 0x5B; private static final byte INSTR_dup2 = (byte) 0x5C; private static final byte INSTR_dup2_x1 = (byte) 0x5D; private static final byte INSTR_dup2_x2 = (byte) 0x5E; private static final byte INSTR_swap = (byte) 0x5F; private static final byte INSTR_iadd = (byte) 0x60; private static final byte INSTR_ladd = (byte) 0x61; private static final byte INSTR_fadd = (byte) 0x62; private static final byte INSTR_dadd = (byte) 0x63; private static final byte INSTR_isub = (byte) 0x64; private static final byte INSTR_lsub = (byte) 0x65; private static final byte INSTR_fsub = (byte) 0x66; private static final byte INSTR_dsub = (byte) 0x67; private static final byte INSTR_imul = (byte) 0x68; private static final byte INSTR_lmul = (byte) 0x69; private static final byte INSTR_fmul = (byte) 0x6A; private static final byte INSTR_dmul = (byte) 0x6B; private static final byte INSTR_idiv = (byte) 0x6C; private static final byte INSTR_ldiv = (byte) 0x6D; private static final byte INSTR_fdiv = (byte) 0x6E; private static final byte INSTR_ddiv = (byte) 0x6F; private static final byte INSTR_irem = (byte) 0x70; private static final byte INSTR_lrem = (byte) 0x71; private static final byte INSTR_frem = (byte) 0x72; private static final byte INSTR_drem = (byte) 0x73; private static final byte INSTR_ineg = (byte) 0x74; private static final byte INSTR_lneg = (byte) 0x75; private static final byte INSTR_fneg = (byte) 0x76; private static final byte INSTR_dneg = (byte) 0x77; private static final byte INSTR_ishl = (byte) 0x78; private static final byte INSTR_lshl = (byte) 0x79; private static final byte INSTR_ishr = (byte) 0x7A; private static final byte INSTR_lshr = (byte) 0x7B; private static final byte INSTR_iushr = (byte) 0x7C; private static final byte INSTR_lushr = (byte) 0x7D; private static final byte INSTR_iand = (byte) 0x7E; private static final byte INSTR_land = (byte) 0x7F; private static final byte INSTR_ior = (byte) 0x80; private static final byte INSTR_lor = (byte) 0x81; private static final byte INSTR_ixor = (byte) 0x82; private static final byte INSTR_lxor = (byte) 0x83; private static final byte INSTR_iinc = (byte) 0x84; private static final byte INSTR_i2l = (byte) 0x85; private static final byte INSTR_i2f = (byte) 0x86; private static final byte INSTR_i2d = (byte) 0x87; private static final byte INSTR_l2i = (byte) 0x88; private static final byte INSTR_l2f = (byte) 0x89; private static final byte INSTR_l2d = (byte) 0x8A; private static final byte INSTR_f2i = (byte) 0x8B; private static final byte INSTR_f2l = (byte) 0x8C; private static final byte INSTR_f2d = (byte) 0x8D; private static final byte INSTR_d2i = (byte) 0x8E; private static final byte INSTR_d2l = (byte) 0x8F; private static final byte INSTR_d2f = (byte) 0x90; private static final byte INSTR_i2b = (byte) 0x91; private static final byte INSTR_i2c = (byte) 0x92; private static final byte INSTR_i2s = (byte) 0x93; private static final byte INSTR_lcmp = (byte) 0x94; private static final byte INSTR_fcmpl = (byte) 0x95; private static final byte INSTR_fcmpg = (byte) 0x96; private static final byte INSTR_dcmpl = (byte) 0x97; private static final byte INSTR_dcmpg = (byte) 0x98; private static final byte INSTR_ifeq = (byte) 0x99; private static final byte INSTR_ifne = (byte) 0x9A; private static final byte INSTR_iflt = (byte) 0x9B; private static final byte INSTR_ifge = (byte) 0x9C; private static final byte INSTR_ifgt = (byte) 0x9D; private static final byte INSTR_ifle = (byte) 0x9E; private static final byte INSTR_if_icmpeq = (byte) 0x9F; private static final byte INSTR_if_icmpne = (byte) 0xA0; private static final byte INSTR_if_icmplt = (byte) 0xA1; private static final byte INSTR_if_icmpge = (byte) 0xA2; private static final byte INSTR_if_icmpgt = (byte) 0xA3; private static final byte INSTR_if_icmple = (byte) 0xA4; private static final byte INSTR_if_acmpeq = (byte) 0xA5; private static final byte INSTR_if_acmpne = (byte) 0xA6; private static final byte INSTR_goto = (byte) 0xA7; private static final byte INSTR_jsr = (byte) 0xA8; private static final byte INSTR_ret = (byte) 0xA9; //private static final byte INSTR_tableswitch = (byte) 0xAA; //private static final byte INSTR_lookupswitch = (byte) 0xAB; private static final byte INSTR_ireturn = (byte) 0xAC; private static final byte INSTR_lreturn = (byte) 0xAD; private static final byte INSTR_freturn = (byte) 0xAE; private static final byte INSTR_dreturn = (byte) 0xAF; private static final byte INSTR_areturn = (byte) 0xB0; private static final byte INSTR_return = (byte) 0xB1; private static final byte INSTR_getstatic = (byte) 0xB2; private static final byte INSTR_putstatic = (byte) 0xB3; private static final byte INSTR_getfield = (byte) 0xB4; private static final byte INSTR_putfield = (byte) 0xB5; private static final byte INSTR_invokevirtual = (byte) 0xB6; private static final byte INSTR_invokespecial = (byte) 0xB7; private static final byte INSTR_invokestatic = (byte) 0xB8; private static final byte INSTR_invokeinterface = (byte) 0xB9; private static final byte INSTR_new = (byte) 0xBB; private static final byte INSTR_newarray = (byte) 0xBC; private static final byte INSTR_anewarray = (byte) 0xBD; private static final byte INSTR_arraylength = (byte) 0xBE; private static final byte INSTR_athrow = (byte) 0xBF; private static final byte INSTR_checkcast = (byte) 0xC0; private static final byte INSTR_instanceof = (byte) 0xC1; private static final byte INSTR_monitorenter = (byte) 0xC2; private static final byte INSTR_monitorexit = (byte) 0xC3; private static final byte INSTR_wide = (byte) 0xC4; private static final byte INSTR_multianewarray = (byte) 0xC5; private static final byte INSTR_ifnull = (byte) 0xC6; private static final byte INSTR_ifnonnull = (byte) 0xC7; //private static final byte INSTR_goto_w = (byte) 0xC8; //private static final byte INSTR_jsr_w = (byte) 0xC9; // Class file defining this method private final ClassFile classFile; // Constant pool indices of method name and signature private final short nameIndex; private final short signatureIndex; // Access flags for method private final short flags; // Number of local variable slots required by the method private int localsCount; // Maximum number of operand stack slots required by the method private int maxOpStackLevel; // Used for calculating the maximum number of operand stack slots required; updated after // generation of each instruction private int opStackLevel; // Method attribute count private short attributeCount; // Constant pool index of Code attribute name (0 if not used) private short codeAttributeIndex; // List of exception table entries for the method private List<ExceptionTableEntry> exceptionsAttributes; // List of line number table entries for the method private List<LineNumberTableEntry> lineNumbers; // List of local variable table entries for the method private List<LocalVariableTableEntry> localVariables; // Constant pool index of LineNumberTable attribute name (0 if not used) private short lineNumberTableAttributeIndex; // Constant pool index of LocalVariableTable attribute name (initialized lazily, indicating that // method does have a LocalVariableTable attribute) private short localVariableTableAttributeIndex; // Runtime visible annotations private AnnotationsAttribute runtimeVisibleAnnotationsAttribute; // Buffer holding code during generation private Buffer buffer; // List with fixups in the generated code private List<Fixup> fixups; // Array containing generated code after byte code generation completed private byte[] bytecode; /** * Defines a new method for a class file. * * @param classFile class file containing the method * @param flags method access flags * @param name method name * @param signature method signature */ public Method(ClassFile classFile, short flags, String name, String signature) { Preconditions.checkArgument((flags & ALLOWED_ACC_FLAGS) == flags); this.flags = flags; this.classFile = classFile; nameIndex = classFile.constantpool.newConstantUtf8(name); signatureIndex = classFile.constantpool.newConstantUtf8(signature); setLocals(getSlotCountFromSignature(signature, (flags & ACC_STATIC) == 0)); } /* * Updates the number of local variable slots. */ private void setLocals(int maxLocal) { if (maxLocal > MAX_VARIABLE_INDEX) { throw new MethodTooBigException("too many local variables"); } if (maxLocal > localsCount) localsCount = maxLocal; } /* * Returns the number of variable or operand slots required by a type. This assumes signature * to be a separate type. */ private int getTypeSize(String signature) { return getTypeSize(signature, 0); } /* * Returns the number of variable or operand slots required by the type within a signature. */ private int getTypeSize(String signature, int index) { switch (signature.charAt(index)) { default: return 1; case 'V': return 0; case 'J': case 'D': return 2; } } /* * Computes the number of arguments from a method signature. */ private int getArgumentCountFromSignature(String signature, boolean hasThis) { return getCountFromSignature(signature, hasThis, false); } /* * Returns the number of local variable slots required by method signature. */ private int getSlotCountFromSignature(String signature, boolean hasThis) { return getCountFromSignature(signature, hasThis, true); } /* * Counts arguments (or slots) based on a method signature. */ @SuppressWarnings("fallthrough") private int getCountFromSignature(String signature, boolean hasThis, boolean countSlots) { char[] sig = signature.toCharArray(); int count = hasThis ? 1 : 0; Preconditions.checkArgument(sig[0] == '('); int index = 1; for (;;) { switch (sig[index++]) { default: // COV_NF_START Compiler.internalError(); break; // COV_NF_END case 'J': case 'D': if (countSlots) { // long and double need an extra slot! count++; } // Fall thru... case 'Z': case 'B': case 'C': case 'S': case 'I': case 'F': break; case '[': while (sig[index] == '[') { index++; } if (sig[index++] != 'L') { break; } // Fall thru... case 'L': while (sig[index++] != ';') { } break; case ')': // End of parameter type list in signature reached, return type irrelevant return count; } // Another slot needed count++; } } /* * Calculates the effect of an invoke instruction on the operand stack. Returns the * change in number of operand stack slots. */ @SuppressWarnings("fallthrough") private int getInvokeStackEffect(String signature, boolean hasThis) { char[] sig = signature.toCharArray(); int count = hasThis ? -1 : 0; Preconditions.checkArgument(sig[0] == '('); int index = 1; for (;;) { switch (sig[index++]) { default: // COV_NF_START Compiler.internalError(); break; // COV_NF_END case 'Z': case 'B': case 'C': case 'S': case 'I': case 'F': break; case 'J': case 'D': // Long and double occupy two operand stack slots count--; break; case '[': while (sig[index] == '[') { index++; } if (sig[index++] != 'L') { break; } // Fall thru... case 'L': while (sig[index++] != ';') { } break; case ')': return count + getTypeSize(signature, index); } count--; } } /* * Adjusts the current operand stack level by the indicated amount, adjusting the maximum * operand stack slots required if necessary. */ private void adjustOpstackLevel(int adjustment) { opStackLevel += adjustment; if (opStackLevel > maxOpStackLevel) { maxOpStackLevel = opStackLevel; if (maxOpStackLevel > MAX_VARIABLE_INDEX) { throw new MethodTooBigException("operand stack overflow"); } } } /* * Generates an instruction and adjusts the operand stack level. */ private void generateInstr(byte instruction, int oslAdjustment) { buffer.generate8(instruction); adjustOpstackLevel(oslAdjustment); } /* * Generates an instruction plus an additional byte and adjusts the operand stack level. */ private void generateInstrByte(byte instruction, byte b, int oslAdjustment) { buffer.generate8_8(instruction, b); adjustOpstackLevel(oslAdjustment); } /* * Generates an instruction plus an additional short and adjusts the operand stack level. */ private void generateInstrShort(byte instruction, short s, int oslAdjustment) { buffer.generate8_16(instruction, s); adjustOpstackLevel(oslAdjustment); } /* * Generates an instruction plus an additional short and a byte and adjusts the operand stack * level. */ private void generateInstrShortByte(byte instruction, short s, byte b, int oslAdjustment) { buffer.generate8_16_8(instruction, s, b); adjustOpstackLevel(oslAdjustment); } /* * Generates an instruction plus an additional short and two bytes and adjusts the operand stack * level. */ private void generateInstrShortByteByte(byte instruction, short s, byte b1, byte b2, int oslAdjustment) { buffer.generate8_16_8_8(instruction, s, b1, b2); adjustOpstackLevel(oslAdjustment); } /* * Generates a branch instruction and adjusts the operand stack level. */ private void generateInstrBranch(byte instruction, Label label, int oslAdjustment) { fixups.add(new Fixup(Fixup.FIXUP_BRANCH, buffer.getOffset(), label)); buffer.generate8_16(instruction, (short)0); adjustOpstackLevel(oslAdjustment); } /* * Generates an instruction to access a local variable and adjusts the operand stack level. */ private void generateLocalAccessInstr(byte instruction, byte shortInstruction, short varnum, int oslAdjustment) { switch (varnum) { default: if (0x00 <= varnum && varnum <= 0xFF) { generateInstrByte(instruction, (byte) varnum, oslAdjustment); } else { // Accessors for local variables outside of the byte range require an instruction prefix generateInstr(INSTR_wide, 0); generateInstrShort(instruction, varnum, oslAdjustment); } break; case 0: case 1: case 2: case 3: // Locals 0 through 3 can use the compact form generateInstr((byte) (shortInstruction + varnum), oslAdjustment); break; } setLocals(varnum + Math.abs(oslAdjustment)); } /** * Generates an aaload instruction. */ public void generateInstrAaload() { generateInstr(INSTR_aaload, -1); } /** * Generates an aastore instruction. */ public void generateInstrAastore() { generateInstr(INSTR_aastore, -3); } /** * Generates an aconst_null instruction. */ public void generateInstrAconstNull() { generateInstr(INSTR_aconst_null, +1); } /** * Generates an aload instruction (or an optimized form of it). * * @param varnum index of variable to load */ public void generateInstrAload(short varnum) { generateLocalAccessInstr(INSTR_aload, INSTR_aload_0, varnum, +1); } /** * Generates an anewarray instruction. * * @param internalName signature of array type */ public void generateInstrAnewarray(String internalName) { generateInstrShort(INSTR_anewarray, classFile.constantpool.newConstantClass(internalName), 0); } /** * Generates an areturn instruction. */ public void generateInstrAreturn() { generateInstr(INSTR_areturn, -1); } /** * Generates an arraylength instruction. */ public void generateInstrArraylength() { generateInstr(INSTR_arraylength, 0); } /** * Generates an astore instruction (or an optimized form of it). * * @param varnum index of variable to store */ public void generateInstrAstore(short varnum) { generateLocalAccessInstr(INSTR_astore, INSTR_astore_0, varnum, -1); } /** * Generates an athrow instruction. */ public void generateInstrAthrow() { generateInstr(INSTR_athrow, -1); } /** * Generates a baload instruction. */ public void generateInstrBaload() { generateInstr(INSTR_baload, -1); } /** * Generates a bastore instruction. */ public void generateInstrBastore() { generateInstr(INSTR_bastore, -3); } /** * Generates a caload instruction. */ public void generateInstrCaload() { generateInstr(INSTR_caload, -1); } /** * Generates a castore instruction. */ public void generateInstrCastore() { generateInstr(INSTR_castore, -3); } /** * Generates a checkcast instruction. * * @param internalName signature of type to check */ public void generateInstrCheckcast(String internalName) { generateInstrShort(INSTR_checkcast, classFile.constantpool.newConstantClass(internalName), 0); } /** * Generates a d2f instruction. */ public void generateInstrD2f() { generateInstr(INSTR_d2f, -1); } /** * Generates a d2i instruction. */ public void generateInstrD2i() { generateInstr(INSTR_d2i, -1); } /** * Generates a d2l instruction. */ public void generateInstrD2l() { generateInstr(INSTR_d2l, 0); } /** * Generates a dadd instruction. */ public void generateInstrDadd() { generateInstr(INSTR_dadd, -2); } /** * Generates a daload instruction. */ public void generateInstrDaload() { generateInstr(INSTR_daload, 0); } /** * Generates a dastore instruction. */ public void generateInstrDastore() { generateInstr(INSTR_dastore, -4); } /** * Generates a dcmpg instruction. */ public void generateInstrDcmpg() { generateInstr(INSTR_dcmpg, -3); } /** * Generates a dcmpl instruction. */ public void generateInstrDcmpl() { generateInstr(INSTR_dcmpl, -3); } /** * Generates a ddiv instruction. */ public void generateInstrDdiv() { generateInstr(INSTR_ddiv, -2); } /** * Generates a dload instruction (or an optimized form of it). * * @param varnum index of variable to load */ public void generateInstrDload(short varnum) { generateLocalAccessInstr(INSTR_dload, INSTR_dload_0, varnum, +2); } /** * Generates a dmul instruction. */ public void generateInstrDmul() { generateInstr(INSTR_dmul, -2); } /** * Generates a dneg instruction. */ public void generateInstrDneg() { generateInstr(INSTR_dneg, 0); } /** * Generates a drem instruction. */ public void generateInstrDrem() { generateInstr(INSTR_drem, -2); } /** * Generates a dreturn instruction. */ public void generateInstrDreturn() { generateInstr(INSTR_dreturn, -2); } /** * Generates a dstore instruction (or an optimized form of it). * * @param varnum index of variable to store */ public void generateInstrDstore(short varnum) { generateLocalAccessInstr(INSTR_dstore, INSTR_dstore_0, varnum, -2); } /** * Generates a dsub instruction. */ public void generateInstrDsub() { generateInstr(INSTR_dsub, -2); } /** * Generates a dup instruction. */ public void generateInstrDup() { generateInstr(INSTR_dup, +1); } /** * Generates a dup_x1 instruction. */ public void generateInstrDupX1() { generateInstr(INSTR_dup_x1, +1); } /** * Generates a dup_x2 instruction. */ public void generateInstrDupX2() { generateInstr(INSTR_dup_x2, +1); } /** * Generates a dup2 instruction. */ public void generateInstrDup2() { generateInstr(INSTR_dup2, +2); } /** * Generates a dup2_x1 instruction. */ public void generateInstrDup2X1() { generateInstr(INSTR_dup2_x1, +2); } /** * Generates a dup2_x2 instruction. */ public void generateInstrDup2X2() { generateInstr(INSTR_dup2_x2, +2); } /** * Generates an f2d instruction. */ public void generateInstrF2d() { generateInstr(INSTR_f2d, +1); } /** * Generates an f2i instruction. */ public void generateInstrF2i() { generateInstr(INSTR_f2i, 0); } /** * Generates an f2l instruction. */ public void generateInstrF2l() { generateInstr(INSTR_f2l, +1); } /** * Generates an fadd instruction. */ public void generateInstrFadd() { generateInstr(INSTR_fadd, -1); } /** * Generates an faload instruction. */ public void generateInstrFaload() { generateInstr(INSTR_faload, -1); } /** * Generates an fastore instruction. */ public void generateInstrFastore() { generateInstr(INSTR_fastore, -3); } /** * Generates an fcmpg instruction. */ public void generateInstrFcmpg() { generateInstr(INSTR_fcmpg, -1); } /** * Generates an fcmpl instruction. */ public void generateInstrFcmpl() { generateInstr(INSTR_fcmpl, -1); } /** * Generates an fdiv instruction. */ public void generateInstrFdiv() { generateInstr(INSTR_fdiv, -1); } /** * Generates an fload instruction (or an optimized form of it). * * @param varnum index of variable to load */ public void generateInstrFload(short varnum) { generateLocalAccessInstr(INSTR_fload, INSTR_fload_0, varnum, +1); } /** * Generates an fmul instruction. */ public void generateInstrFmul() { generateInstr(INSTR_fmul, -1); } /** * Generates an fneg instruction. */ public void generateInstrFneg() { generateInstr(INSTR_fneg, 0); } /** * Generates an frem instruction. */ public void generateInstrFrem() { generateInstr(INSTR_frem, -1); } /** * Generates an freturn instruction. */ public void generateInstrFreturn() { generateInstr(INSTR_freturn, -1); } /** * Generates an fstore instruction (or an optimized form of it). * * @param varnum index of variable to store */ public void generateInstrFstore(short varnum) { generateLocalAccessInstr(INSTR_fstore, INSTR_fstore_0, varnum, -1); } /** * Generates an fsub instruction. */ public void generateInstrFsub() { generateInstr(INSTR_fsub, -1); } /** * Generates a getfield instruction. * * @param className class name of field in internal format * @param name field name * @param signature field signature */ public void generateInstrGetfield(String className, String name, String signature) { generateInstrShort(INSTR_getfield, classFile.constantpool.newConstantFieldref(className, name, signature), (short) (+getTypeSize(signature) - 1)); } /** * Generates a getstatic instruction. * * @param className class name of field in internal format * @param name field name * @param signature field signature */ public void generateInstrGetstatic(String className, String name, String signature) { generateInstrShort(INSTR_getstatic, classFile.constantpool.newConstantFieldref(className, name, signature), (short) +getTypeSize(signature)); } /** * Generates a goto instruction. * * @param label label to branch to */ public void generateInstrGoto(Label label) { generateInstrBranch(INSTR_goto, label, 0); } /** * Generates an i2b instruction. */ public void generateInstrI2b() { generateInstr(INSTR_i2b, 0); } /** * Generates an i2c instruction. */ public void generateInstrI2c() { generateInstr(INSTR_i2c, 0); } /** * Generates an i2d instruction. */ public void generateInstrI2d() { generateInstr(INSTR_i2d, +1); } /** * Generates an i2f instruction. */ public void generateInstrI2f() { generateInstr(INSTR_i2f, 0); } /** * Generates an i2l instruction. */ public void generateInstrI2l() { generateInstr(INSTR_i2l, +1); } /** * Generates an i2s instruction. */ public void generateInstrI2s() { generateInstr(INSTR_i2s, 0); } /** * Generates an iadd instruction. */ public void generateInstrIadd() { generateInstr(INSTR_iadd, -1); } /** * Generates an iaload instruction. */ public void generateInstrIaload() { generateInstr(INSTR_iaload, -1); } /** * Generates an iand instruction. */ public void generateInstrIand() { generateInstr(INSTR_iand, -1); } /** * Generates an iastore instruction. */ public void generateInstrIastore() { generateInstr(INSTR_iastore, -3); } /** * Generates an idiv instruction. */ public void generateInstrIdiv() { generateInstr(INSTR_idiv, -1); } /** * Generates an if_acmpeq instruction. * * @param label label to branch to */ public void generateInstrIfAcmpeq(Label label) { generateInstrBranch(INSTR_if_acmpeq, label, -2); } /** * Generates an if_acmpne instruction. * * @param label label to branch to */ public void generateInstrIfAcmpne(Label label) { generateInstrBranch(INSTR_if_acmpne, label, -2); } /** * Generates an if_icmpeq instruction. * * @param label label to branch to */ public void generateInstrIfIcmpeq(Label label) { generateInstrBranch(INSTR_if_icmpeq, label, -2); } /** * Generates an if_icmpne instruction. * * @param label label to branch to */ public void generateInstrIfIcmpne(Label label) { generateInstrBranch(INSTR_if_icmpne, label, -2); } /** * Generates an if_icmpge instruction. * * @param label label to branch to */ public void generateInstrIfIcmpge(Label label) { generateInstrBranch(INSTR_if_icmpge, label, -2); } /** * Generates an if_icmpgt instruction. * * @param label label to branch to */ public void generateInstrIfIcmpgt(Label label) { generateInstrBranch(INSTR_if_icmpgt, label, -2); } /** * Generates an if_icmple instruction. * * @param label label to branch to */ public void generateInstrIfIcmple(Label label) { generateInstrBranch(INSTR_if_icmple, label, -2); } /** * Generates an if_icmplt instruction. * * @param label label to branch to */ public void generateInstrIfIcmplt(Label label) { generateInstrBranch(INSTR_if_icmplt, label, -2); } /** * Generates an ifeq instruction. * * @param label label to branch to */ public void generateInstrIfeq(Label label) { generateInstrBranch(INSTR_ifeq, label, -1); } /** * Generates an ifne instruction. * * @param label label to branch to */ public void generateInstrIfne(Label label) { generateInstrBranch(INSTR_ifne, label, -1); } /** * Generates an iflt instruction. * * @param label label to branch to */ public void generateInstrIflt(Label label) { generateInstrBranch(INSTR_iflt, label, -1); } /** * Generates an ifge instruction. * * @param label label to branch to */ public void generateInstrIfge(Label label) { generateInstrBranch(INSTR_ifge, label, -1); } /** * Generates an ifgt instruction. * * @param label label to branch to */ public void generateInstrIfgt(Label label) { generateInstrBranch(INSTR_ifgt, label, -1); } /** * Generates an ifle instruction. * * @param label label to branch to */ public void generateInstrIfle(Label label) { generateInstrBranch(INSTR_ifle, label, -1); } /** * Generates an ifnonnull instruction. * * @param label label to branch to */ public void generateInstrIfnonnull(Label label) { generateInstrBranch(INSTR_ifnonnull, label, -1); } /** * Generates an ifnull instruction. * * @param label label to branch to */ public void generateInstrIfnull(Label label) { generateInstrBranch(INSTR_ifnull, label, -1); } /** * Generates an iinc instruction (or an optimized form of it). * * @param varnum index of variable to load * @param value amount by which to increase (decrease) the local variable */ public void generateInstrIinc(short varnum, byte value) { if (0x00 <= varnum && varnum <= 0xFF) { buffer.generate8_8_8(INSTR_iinc, (byte) varnum, value); } else { buffer.generate8_8_16_8(INSTR_wide, INSTR_iinc, varnum, value); } // opStackEffect: 0 } /** * Generates an iload instruction (or an optimized form of it). * * @param varnum index of variable to load */ public void generateInstrIload(short varnum) { generateLocalAccessInstr(INSTR_iload, INSTR_iload_0, varnum, +1); } /** * Generates an imul instruction. */ public void generateInstrImul() { generateInstr(INSTR_imul, -1); } /** * Generates an ineg instruction. */ public void generateInstrIneg() { generateInstr(INSTR_ineg, 0); } /** * Generates an instanceof instruction. * * @param internalName signature of type to check */ public void generateInstrInstanceof(String internalName) { generateInstrShort(INSTR_instanceof, classFile.constantpool.newConstantClass(internalName), 0); } /** * Generates an invokeinterface instruction. * * @param className class name of method in internal format * @param name method name * @param signature method signature */ public void generateInstrInvokeinterface(String className, String name, String signature) { generateInstrShortByteByte(INSTR_invokeinterface, classFile.constantpool.newConstantInterfaceMethodref(className, name, signature), (byte) getArgumentCountFromSignature(signature, true), (byte) 0, getInvokeStackEffect(signature, true)); } /** * Generates an invokespecial instruction. * * @param className class name of method in internal format * @param name method name * @param signature method signature */ public void generateInstrInvokespecial(String className, String name, String signature) { generateInstrShort(INSTR_invokespecial, classFile.constantpool.newConstantMethodref(className, name, signature), getInvokeStackEffect(signature, true)); } /** * Generates an invokestatic instruction. * * @param className class name of method in internal format * @param name method name * @param signature method signature */ public void generateInstrInvokestatic(String className, String name, String signature) { generateInstrShort(INSTR_invokestatic, classFile.constantpool.newConstantMethodref(className, name, signature), getInvokeStackEffect(signature, false)); } /** * Generates an invokevirtual instruction. * * @param className class name of method in internal format * @param name method name * @param signature method signature */ public void generateInstrInvokevirtual(String className, String name, String signature) { generateInstrShort(INSTR_invokevirtual, classFile.constantpool.newConstantMethodref(className, name, signature), getInvokeStackEffect(signature, true)); } /** * Generates an ior instruction. */ public void generateInstrIor() { generateInstr(INSTR_ior, -1); } /** * Generates an irem instruction. */ public void generateInstrIrem() { generateInstr(INSTR_irem, -1); } /** * Generates an ireturn instruction. */ public void generateInstrIreturn() { generateInstr(INSTR_ireturn, -1); } /** * Generates an ishl instruction. */ public void generateInstrIshl() { generateInstr(INSTR_ishl, -1); } /** * Generates an ishr instruction. */ public void generateInstrIshr() { generateInstr(INSTR_ishr, -1); } /** * Generates an istore instruction (or an optimized form of it). * * @param varnum index of variable to store */ public void generateInstrIstore(short varnum) { generateLocalAccessInstr(INSTR_istore, INSTR_istore_0, varnum, -1); } /** * Generates an isub instruction. */ public void generateInstrIsub() { generateInstr(INSTR_isub, -1); } /** * Generates an iushr instruction. */ public void generateInstrIushr() { generateInstr(INSTR_iushr, -1); } /** * Generates an ixor instruction. */ public void generateInstrIxor() { generateInstr(INSTR_ixor, -1); } /** * Generates a jsr instruction. * * @param label label to branch to */ public void generateInstrJsr(Label label) { generateInstrBranch(INSTR_jsr, label, 0); } /** * Generates an l2d instruction. */ public void generateInstrL2d() { generateInstr(INSTR_l2d, 0); } /** * Generates an l2f instruction. */ public void generateInstrL2f() { generateInstr(INSTR_l2f, -1); } /** * Generates an l2i instruction. */ public void generateInstrL2i() { generateInstr(INSTR_l2i, -1); } /** * Generates an ladd instruction. */ public void generateInstrLadd() { generateInstr(INSTR_ladd, -2); } /** * Generates an laload instruction. */ public void generateInstrLaload() { generateInstr(INSTR_laload, 0); } /** * Generates an land instruction. */ public void generateInstrLand() { generateInstr(INSTR_land, -2); } /** * Generates an lastore instruction. */ public void generateInstrLastore() { generateInstr(INSTR_lastore, -4); } /** * Generates an lcmp instruction. */ public void generateInstrLcmp() { generateInstr(INSTR_lcmp, -3); } /** * Generates an ldc instruction (or an optimized form of it). * * @param value integer constant to load */ public void generateInstrLdc(int value) { switch (value) { default: if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE) { generateInstrByte(INSTR_bipush, (byte) value, +1); } else if (Short.MIN_VALUE <= value && value <= Short.MAX_VALUE) { generateInstrShort(INSTR_sipush, (short) value, +1); } else { short index = classFile.constantpool.newConstantInteger(value); if (0x00 <= index && index <= 0xFF) { generateInstrByte(INSTR_ldc, (byte) index, +1); } else { generateInstrShort(INSTR_ldc_w, index, +1); } } break; case -1: case 0: case 1: case 2: case 3: case 4: case 5: generateInstr((byte)(INSTR_iconst_0 + value), +1); break; } } /** * Generates an ldc instruction (or an optimized form of it). * * @param value float constant to load */ public void generateInstrLdc(float value) { if (value == 0f) { generateInstr(INSTR_fconst_0, +1); } else if (value == 1f) { generateInstr(INSTR_fconst_1, +1); } else if (value == 2f) { generateInstr(INSTR_fconst_2, +1); } else { short index = classFile.constantpool.newConstantFloat(value); if (0x00 <= index && index <= 0xFF) { generateInstrByte(INSTR_ldc, (byte) index, +1); } else { generateInstrShort(INSTR_ldc_w, index, +1); } } } /** * Generates an ldc instruction (or an optimized form of it). * * @param value string constant to load */ public void generateInstrLdc(String value) { short index = classFile.constantpool.newConstantString(value); if (0x00 <= index && index <= 0xFF) { generateInstrByte(INSTR_ldc, (byte) index, +1); } else { generateInstrShort(INSTR_ldc_w, index, +1); } } /** * Generates an ldc2 instruction (or an optimized form of it). * * @param value double constant to load */ public void generateInstrLdc2(double value) { if (value == 0d) { generateInstr(INSTR_dconst_0, +2); } else if (value == 1d) { generateInstr(INSTR_dconst_1, +2); } else { generateInstrShort(INSTR_ldc2_w, classFile.constantpool.newConstantDouble(value), +2); } } /** * Generates an ldc2 instruction (or an optimized form of it). * * @param value long constant to load */ public void generateInstrLdc2(long value) { if (value == 0l) { generateInstr(INSTR_lconst_0, +2); } else if (value == 1l) { generateInstr(INSTR_lconst_1, +2); } else { generateInstrShort(INSTR_ldc2_w, classFile.constantpool.newConstantLong(value), +2); } } /** * Generates an ldiv instruction. */ public void generateInstrLdiv() { generateInstr(INSTR_ldiv, -2); } /** * Generates an lload instruction (or an optimized form of it). * * @param varnum index of variable to load */ public void generateInstrLload(short varnum) { generateLocalAccessInstr(INSTR_lload, INSTR_lload_0, varnum, +2); } /** * Generates an lmul instruction. */ public void generateInstrLmul() { generateInstr(INSTR_lmul, -2); } /** * Generates an lneg instruction. */ public void generateInstrLneg() { generateInstr(INSTR_lneg, 0); } /** * Generates a lookupswitch instruction. */ public void generateInstrLookupswitch() { // TODO: needs to be implemented } /** * Generates an lor instruction. */ public void generateInstrLor() { generateInstr(INSTR_lor, -2); } /** * Generates an lrem instruction. */ public void generateInstrLrem() { generateInstr(INSTR_lrem, -2); } /** * Generates an lreturn instruction. */ public void generateInstrLreturn() { generateInstr(INSTR_lreturn, -2); } /** * Generates an lshl instruction. */ public void generateInstrLshl() { generateInstr(INSTR_lshl, -1); } /** * Generates an lshr instruction. */ public void generateInstrLshr() { generateInstr(INSTR_lshr, -1); } /** * Generates an lstore instruction (or an optimized form of it). * * @param varnum index of variable to store */ public void generateInstrLstore(short varnum) { generateLocalAccessInstr(INSTR_lstore, INSTR_lstore_0, varnum, -2); } /** * Generates an lsub instruction. */ public void generateInstrLsub() { generateInstr(INSTR_lsub, -2); } /** * Generates an lushr instruction. */ public void generateInstrLushr() { generateInstr(INSTR_lushr, -1); } /** * Generates an lxor instruction. */ public void generateInstrLxor() { generateInstr(INSTR_lxor, -2); } /** * Generates a monitorenter instruction. */ public void generateInstrMonitorenter() { generateInstr(INSTR_monitorenter, -1); } /** * Generates a monitorexit instruction. */ public void generateInstrMonitorexit() { generateInstr(INSTR_monitorexit, -1); } /** * Generates a multianewarray instruction. * * @param dimensions array dimensions * @param internalName internal name of array element type */ public void generateInstrMultianewarray(int dimensions, String internalName) { generateInstrShortByte(INSTR_multianewarray, classFile.constantpool.newConstantClass(internalName), (byte) dimensions, dimensions - 1); } /** * Generates a new instruction. * * @param internalName class name in internal format */ public void generateInstrNew(String internalName) { generateInstrShort(INSTR_new, classFile.constantpool.newConstantClass(internalName), +1); } /** * Generates a newarray instruction. * * @param internalName signature of primitive type */ @SuppressWarnings("fallthrough") public void generateInstrNewarray(String internalName) { Preconditions.checkArgument(internalName.length() == 1); byte atype = 0; switch (internalName.charAt(0)) { default: // COV_NF_START Compiler.internalError(); break; // COV_NF_END case 'Z': atype = T_BOOLEAN; break; case 'B': atype = T_BYTE; break; case 'C': atype = T_CHAR; break; case 'S': atype = T_SHORT; break; case 'I': atype = T_INT; break; case 'J': atype = T_LONG; break; case 'F': atype = T_FLOAT; break; case 'D': atype = T_DOUBLE; break; } generateInstrByte(INSTR_newarray, atype, 0); } /** * Generates a nop instruction. */ public void generateInstrNop() { generateInstr(INSTR_nop, 0); } /** * Generates a pop instruction. */ public void generateInstrPop() { generateInstr(INSTR_pop, -1); } /** * Generates a pop2 instruction. */ public void generateInstrPop2() { generateInstr(INSTR_pop2, -2); } /** * Generates a putfield instruction. * * @param className class name of field in internal format * @param name field name * @param signature field signature */ public void generateInstrPutfield(String className, String name, String signature) { generateInstrShort(INSTR_putfield, classFile.constantpool.newConstantFieldref(className, name, signature), (short) (-getTypeSize(signature) - 1)); } /** * Generates a putstatic instruction. * * @param className class name of field in internal format * @param name field name * @param signature field signature */ public void generateInstrPutstatic(String className, String name, String signature) { generateInstrShort(INSTR_putstatic, classFile.constantpool.newConstantFieldref(className, name, signature), (short) -getTypeSize(signature)); } /** * Generates a ret instruction (or an optimized form of it). * * @param varnum index of variable to load from */ public void generateInstrRet(short varnum) { if (0x00 <= varnum && varnum <= 0xFF) { generateInstrByte(INSTR_ret, (byte) varnum, -1); } else { generateInstr(INSTR_wide, 0); generateInstrShort(INSTR_ret, varnum, -1); } } /** * Generates a return instruction. */ public void generateInstrReturn() { generateInstr(INSTR_return, 0); } /** * Generates an saload instruction. */ public void generateInstrSaload() { generateInstr(INSTR_saload, -1); } /** * Generates an sastore instruction. */ public void generateInstrSastore() { generateInstr(INSTR_sastore, -3); } /** * Generates a swap instruction. */ public void generateInstrSwap() { generateInstr(INSTR_swap, 0); } /** * Generates a tableswitch instruction. */ public void generateInstrTableswitch() { // TODO: needs to be implemented } /** * Sets the label at the current code offset. * * @param label label to set */ public void setLabel(Label label) { label.offset = buffer.getOffset(); } /** * Creates a new label. Note that the label is not set yet! * * @return new label */ public static Label newLabel() { return new Label(); } /** * Generates an exception handler description. * * @param startLabel start label for code covered by handler * @param endLabel end label for code covered by handler * @param handlerLabel label of exception handler start * @param internalName exception class name in internal format */ public void generateExceptionHandlerInfo(Label startLabel, Label endLabel, Label handlerLabel, String internalName) { exceptionsAttributes.add(new ExceptionTableEntry(startLabel, endLabel, handlerLabel, classFile.constantpool.newConstantClass(internalName))); } /** * Generates line number debug information at the current code position. * * @param line line number (if 0 then no line number will be generated) */ public void generateLineNumberInformation(short line) { if (line != 0) { if (lineNumberTableAttributeIndex == 0) { lineNumberTableAttributeIndex = classFile.constantpool.newConstantUtf8("LineNumberTable"); attributeCount++; } lineNumbers.add(new LineNumberTableEntry((short) buffer.getOffset(), line)); } } /** * Generates debug information for local variables * * @param startLabel label where variable becomes visible * @param endLabel label where variable becomes in-visible * @param name variable name * @param signature variable type signature * @param variableIndex variable slot index */ public void generateLocalVariableInformation(Label startLabel, Label endLabel, String name, String signature, short variableIndex) { if (localVariableTableAttributeIndex == 0) { localVariableTableAttributeIndex = classFile.constantpool.newConstantUtf8("LocalVariableTable"); attributeCount++; } localVariables.add(new LocalVariableTableEntry(startLabel, endLabel, classFile.constantpool.newConstantUtf8(name), classFile.constantpool.newConstantUtf8(signature), variableIndex)); } /** * Returns runtime visible annotations attribute. * * @return runtime visible annotations attribute */ public AnnotationsAttribute getRuntimeVisibleAnnotationsAttribute() { if (runtimeVisibleAnnotationsAttribute == null) { runtimeVisibleAnnotationsAttribute = new AnnotationsAttribute(classFile, "RuntimeVisibleAnnotations"); attributeCount++; } return runtimeVisibleAnnotationsAttribute; } /** * Needs to be called before code for the method can be generated. */ public void startCodeGeneration() { buffer = new Buffer(); fixups = new ArrayList<Fixup>(); exceptionsAttributes = new ArrayList<ExceptionTableEntry>(); lineNumbers = new ArrayList<LineNumberTableEntry>(); localVariables = new ArrayList<LocalVariableTableEntry>(); codeAttributeIndex = classFile.constantpool.newConstantUtf8("Code"); } /** * Needs to be called after all code for the method has been generated. */ @SuppressWarnings("fallthrough") public void finishCodeGeneration() { // Perform needed fixups for (Fixup fixup : fixups) { switch (fixup.kind) { default: // COV_NF_START Compiler.internalError(); break; // COV_NF_END case Fixup.FIXUP_BRANCH: int offset = fixup.label.offset - fixup.offset; if (offset < Short.MIN_VALUE || Short.MAX_VALUE < offset) { throw new MethodTooBigException("branch exceeds maximum branch offset"); } else { buffer.patch16(fixup.offset + 1, (short) offset); } break; } } // Copy generated code into a simple byte array bytecode = buffer.toByteArray(); // Free unneeded data structures buffer = null; fixups = null; // Prune line numbers int lineNumbersCount = lineNumbers.size(); if (lineNumbersCount > 0) { LineNumberTableEntry prevLineNumber = lineNumbers.get(0); List<LineNumberTableEntry> prunedLineNumbers = new ArrayList<LineNumberTableEntry>(); for (int i = 1; i < lineNumbersCount; i++) { LineNumberTableEntry lineNumber = lineNumbers.get(i); if (prevLineNumber.offset == lineNumber.offset) { // Two adjacent entries have the same start offset: previous line didn't generate any // code, therefore omit it prevLineNumber = lineNumber; } else if (prevLineNumber.line == lineNumber.line) { // Two adjacent entries have the same line number: need to be merged, omit the current // entry } else { // Two adjacent entries are different: keep 'em prunedLineNumbers.add(prevLineNumber); prevLineNumber = lineNumber; } } prunedLineNumbers.add(prevLineNumber); lineNumbers = prunedLineNumbers; } } /** * Generates binary data for the method into its class file's data buffer. */ protected void generate() { classFile.generate16(flags); classFile.generate16(nameIndex); classFile.generate16(signatureIndex); if ((flags & ACC_ABSTRACT) != 0) { // Abstract methods don't have any further attributes classFile.generate16((short) 0); } else { // Compute attribute lengths int exceptionAttributeLength = 2 + exceptionsAttributes.size() * (2 + 2 + 2 + 2); int lineNumberCount = lineNumbers.size(); int lineNumberTableAttributeLength = (lineNumberCount == 0) ? 0 : 2 + 4 + 2 + lineNumberCount * (2 + 2); int localVariableCount = localVariables.size(); int localVariableTableAttributeLength = (localVariableCount == 0) ? 0 : 2 + 4 + 2 + localVariableCount * (2 + 2 + 2 + 2 + 2); int runtimeVisibleAnnotationsAttributeLength = (runtimeVisibleAnnotationsAttribute == null) ? 0 : runtimeVisibleAnnotationsAttribute.getLength(); // Code attribute classFile.generate16((short) 1); classFile.generate16(codeAttributeIndex); classFile.generate32(2 + 2 + 4 + bytecode.length + exceptionAttributeLength + 2 + lineNumberTableAttributeLength + localVariableTableAttributeLength + runtimeVisibleAnnotationsAttributeLength); classFile.generate16((short) maxOpStackLevel); classFile.generate16((short) localsCount); classFile.generate32(bytecode.length); classFile.generateBytes(bytecode); // Any exception attributes classFile.generate16((short) exceptionsAttributes.size()); for (ExceptionTableEntry ete : exceptionsAttributes) { ete.generate(); } classFile.generate16(attributeCount); // Line number table attribute if (lineNumberCount > 0) { classFile.generate16(lineNumberTableAttributeIndex); classFile.generate32(lineNumberTableAttributeLength - (2 + 4)); classFile.generate16((short) lineNumberCount); for (LineNumberTableEntry lnte : lineNumbers) { lnte.generate(); } } // Local variable table attribute if (localVariableCount > 0) { classFile.generate16(localVariableTableAttributeIndex); classFile.generate32(localVariableTableAttributeLength - (2 + 4)); classFile.generate16((short) localVariableCount); for (LocalVariableTableEntry lvte : localVariables) { lvte.generate(); } } // RuntimeVisibleAnnotations attribute if (runtimeVisibleAnnotationsAttribute != null) { runtimeVisibleAnnotationsAttribute.generate(); } } } }
[ "gxousos@gmail.com" ]
gxousos@gmail.com
86bdc5e5fef2c723090020c25ffaa34feeaec832
0dfe5c5b11b7289848c3e304bf76bacbff60fce3
/src/main/java/com/potato/study/leetcodecn/p01115/t001/FooBar.java
124257ce205a0eb9a898d7e50e89fecdb13e0818
[]
no_license
potatobeancox5/potato-leetcode-solution-java
e6a308b362155ee5f73e65956ddc9ce1125f55be
953dd522aad3ed76a596943cf7c3439be001bcbb
refs/heads/master
2021-12-23T10:52:59.345671
2021-08-13T15:25:26
2021-08-13T15:25:26
170,109,169
0
0
null
2020-10-13T16:10:09
2019-02-11T10:22:58
Java
UTF-8
Java
false
false
2,256
java
package com.potato.study.leetcodecn.p01115.t001; import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicInteger; /** * 1115. 交替打印FooBar * * 我们提供一个类: class FooBar { public void foo() {     for (int i = 0; i < n; i++) {       print("foo");   } } public void bar() {     for (int i = 0; i < n; i++) {       print("bar");     } } } 两个不同的线程将会共用一个 FooBar 实例。其中一个线程将会调用 foo() 方法,另一个线程将会调用 bar() 方法。 请设计修改程序,以确保 "foobar" 被输出 n 次。   示例 1: 输入: n = 1 输出: "foobar" 解释: 这里有两个线程被异步启动。其中一个调用 foo() 方法, 另一个调用 bar() 方法,"foobar" 将被输出一次。 示例 2: 输入: n = 2 输出: "foobarfoobar" 解释: "foobar" 将被输出两次。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/print-foobar-alternately 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 * */ public class FooBar { // https://www.cnblogs.com/whgw/archive/2011/09/29/2195555.html // 声明2个信号量 foo 先打印 初始给一个信号量 private Semaphore fooSemaphore; // bar 需要 foo 执行完毕之后 对信号量进行释放 private Semaphore barSemaphore; private int n; public FooBar(int n) { this.n = n; this.fooSemaphore = new Semaphore(1); this.barSemaphore = new Semaphore(0); } public void foo(Runnable printFoo) throws InterruptedException { for (int i = 0; i < n; i++) { // 获取信号量 没有的时候 阻塞等待 fooSemaphore.acquire(); // printFoo.run() outputs "foo". Do not change or remove this line. printFoo.run(); barSemaphore.release(); } } public void bar(Runnable printBar) throws InterruptedException { for (int i = 0; i < n; i++) { barSemaphore.acquire(); // printBar.run() outputs "bar". Do not change or remove this line. printBar.run(); fooSemaphore.release(); } } }
[ "liuzhao11@sankuai.com" ]
liuzhao11@sankuai.com
54123acaa67740acb8a53bccdd75d712c35f21ca
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-13544-5-4-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/org/xwiki/rendering/internal/transformation/DefaultTransformationManager_ESTest_scaffolding.java
2c36987d554b1f4420a70fd36d1131ed86de2c00
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
476
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Jan 21 23:37:00 UTC 2020 */ package org.xwiki.rendering.internal.transformation; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class DefaultTransformationManager_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
6876709312cb113081824f1bfec0e0347190384c
1ce0450d037f397374073e3ebd9b076c37ebe3d8
/src/com/ssh/dao/ProductDao.java
bed31267c26de7412864017806b28198e1e04cce
[]
no_license
Bu1l-Frog/SSH
9029fcf0b947e3cea4107192d0d692c9f693a7e7
0f3405fc99901192812a713eec53c51367c876b9
refs/heads/master
2022-12-06T16:14:16.102994
2020-08-12T12:19:56
2020-08-12T12:19:56
287,005,376
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
package com.ssh.dao; import com.ssh.domain.Product; import org.springframework.orm.hibernate5.support.HibernateDaoSupport; /** * 商品管理的Dao类 */ public class ProductDao extends HibernateDaoSupport { /** * Dao中保存商品的方法 * @param product */ public void save(Product product) { System.out.println("DAO中的save方法执行了"); this.getHibernateTemplate().save(product); } }
[ "" ]
b8aad847c7be87dd9534e789d19dd1d5e6bda1be
7e2384e6e2d07ddac313261232ca4ef741744af5
/javaDesign/src/main/java/delay/TestMainForDelayQuene.java
20ee28610c6b93ae1a19d39accc0cca3e03c30e3
[]
no_license
Toccator/practice
1e216fe9325dd9620419d138911c6f54438d7466
dad26ad614072b441a537d62091c86d9e83b309c
refs/heads/main
2023-03-10T12:24:24.117205
2021-02-24T06:06:17
2021-02-24T06:06:17
341,485,397
0
0
null
null
null
null
UTF-8
Java
false
false
3,430
java
package delay; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.Tuple; import util.JedisPoolUtile; import util.ReadProperties; import java.util.Calendar; import java.util.Date; import java.util.Set; public class TestMainForDelayQuene { // private static final String ADDR = "127.0.0.1"; // private static final int PORT = 7001; //初始化jedis //private static JedisPool jedisPool = new JedisPool(new GenericObjectPoolConfig(), ADDR, PORT, 10000); static String servers[] = ReadProperties.getValue("redis.server").split(","); static String password = ReadProperties.getValue("redis.password"); static String firstServer = servers[0].split(":")[0]; static String firstPort = servers[0].split(":")[1]; static { try(Jedis jedis = new Jedis(firstServer, Integer.valueOf(firstPort))) { jedis.auth(password); JedisPool jedis1 = new JedisPoolUtile().getJedisPool(firstServer, Integer.valueOf(firstPort), password); Jedis jedis2 = jedis1.getResource(); } catch (Exception e) { } } private static JedisPool jedisPool = new JedisPoolUtile().getJedisPool(firstServer, Integer.valueOf(firstPort), password); public void run(){ productionDelayMessage(); consumerDelayMessage(); } public void productionDelayMessage() { try(Jedis jedis = jedisPool.getResource()) { jedis.auth(password); //延迟5秒 Calendar cal1 = Calendar.getInstance(); cal1.add(Calendar.SECOND, 5); int second3later = (int) (cal1.getTimeInMillis() / 1000); Long orderId = jedis.zadd("OrderId", second3later, "OID0000001"); System.out.println(new Date() + "ms:redis生成了一个订单任务:订单ID为" + "OID0000001" + "===============" + orderId); } } //消费者取订单 public void consumerDelayMessage() { try(Jedis jedis = jedisPool.getResource()) { // Jedis jedis = TestMainForDelayQuene.getJedis(); while (true) { Set<Tuple> items = jedis.zrangeWithScores("OrderId", 0, 1); if (items == null || items.isEmpty()) { try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } continue; } int score = (int) ((Tuple) items.toArray()[0]).getScore(); Calendar cal = Calendar.getInstance(); int nowSecond = (int) (cal.getTimeInMillis() / 1000); if (nowSecond >= score) { String orderId = ((Tuple) items.toArray()[0]).getElement(); Long num = jedis.zrem("OrderId", orderId); System.out.println(num); if (num != null && num > 0) { System.out.println(new Date() + "ms:redis消费了一个任务:消费的订单OrderId为" + orderId); } } break; } } } public static void main(String[] args) { TestMainForDelayQuene appTest = new TestMainForDelayQuene(); // appTest.productionDelayMessage(); // appTest.consumerDelayMessage(); appTest.run(); } }
[ "18370608156@163.com" ]
18370608156@163.com
9e7eefc06a382a82b876794685fbe8ccd43ba1f4
68550fa57e3f186cc78b4777402ff8d042968c25
/CheckAB.java
b8b5ef2919cc9309fc2e66513f5a3082770ef2dc
[]
no_license
vaichu22/Coding-Ninjas--JAVA-DS
e04f2cca23e10843d88e44424e0c24bd6ae3d8a8
9f255ac9791b5966743fd5c4a239616a36057a4d
refs/heads/master
2021-02-13T15:11:52.279809
2020-11-11T18:20:48
2020-11-11T18:20:48
244,708,044
0
1
null
2020-05-01T15:44:12
2020-03-03T18:12:10
Java
UTF-8
Java
false
false
1,280
java
package com; public class CheckAB { public static boolean checkAB(String s) { if(s.length() == 0) { return false; } boolean bool=checkAB(s.substring(1)); if(s.charAt(0) == 'a' && s.length() >3) { if((s.charAt(1) == 'a' || s.charAt(1) == 'b') && (s.charAt(2) == 'b')) { if(s.charAt(2) == 'b') { if(s.charAt(3) == 'a') { bool=true; } else { bool=false; } } } } else if(s.charAt(0) == 'b' && s.length() >3) { if(s.charAt(1) == 'b' && s.charAt(2) == 'a') { bool=true; } } else if((s.charAt(0) == 'a' && s.length() ==1) || (s.charAt(0) == 'b' && s.length() ==1)) { bool=true; } else if((s.charAt(0) == 'a' && s.length() <=3)) { if(s.charAt(1) == 'b' && s.charAt(2) == 'b') { if(s.charAt(2) == 'b') { if(s.charAt(3) == 'a') { bool=true; } else { bool=false; } } } } else if((s.charAt(0) == 'b' && s.length() <=3)) { if(s.charAt(1) == 'b' && s.charAt(2) == 'a') { bool=true; } } else { bool=false; } return bool; } public static void main(String[] args) { // TODO Auto-generated method stub boolean ans=checkAB("abb"); System.out.println(ans); } }
[ "vaishnavi.kalaivanan1@gmail.com" ]
vaishnavi.kalaivanan1@gmail.com
7347f8e4fbf38bef34799b15232276af7e657e34
cc70f0eac152553f0744954a1c4da8af67faa5ab
/PPA/src/examples/AllCodeSnippets/class_1277.java
1010b11ff188f41a94632b243d696243ae4c1242
[]
no_license
islamazhar/Detecting-Insecure-Implementation-code-snippets
b49b418e637a2098027e6ce70c0ddf93bc31643b
af62bef28783c922a8627c62c700ef54028b3253
refs/heads/master
2023-02-01T10:48:31.815921
2020-12-11T00:21:40
2020-12-11T00:21:40
307,543,127
0
0
null
null
null
null
UTF-8
Java
false
false
1,755
java
package examples.AllCodeSnippets; public class class_1277{ public static void main() { public static void main(String[] args) throws Exception { // Initialise secret key with predefined byte array [] like below. I // have used simple string to array method to generate 16 byte array. // AES Key must be minimum 16 bytes. // Now you can put this byte array some where is .SO file. // Generate new Key using this byte [] // Then you can generate a key using device specific information at // first boot up. // Use second key to encrypt data and first key to encrypt the second // key // I Hope it clears all the doubts SecretKey key = new SecretKeySpec("ABCDEFGHIJKLMNOP".getBytes(), "AES"); System.out.println(Arrays.toString(key.getEncoded())); // Initialise Cipher with AES Algorithm Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); // Set The Encrypt Mode cipher.init(Cipher.ENCRYPT_MODE, key); // Encrypt some bytes byte[] encrypted = cipher.doFinal("ABCDEFGH".getBytes()); // Print it to vefiry System.out.println(Arrays.toString(encrypted)); // Get The IV byte[] iv = cipher.getIV(); System.out.println(iv.length); // Now why storing you can create structure like [16 IV][Encrypted Data] // And while decrypting you can read first [16] bytes IV and then // decrypt remaining bytes //byte[] iv = new byte[16]; // System.arraycopy(encrypted, 0, iv, 0, 16) //Copy remaining bytes to decrypt // set cipher to decrypt mode cipher.init(Cipher.DECRYPT_MODE, key,new IvParameterSpec(iv)); // decrypt it byte[] decrypted = cipher.doFinal(encrypted); System.out.println(new String(decrypted)); } } }
[ "mislam9@wisc.edu" ]
mislam9@wisc.edu
949aeef541d90527800d2c96c0d0dd17eec28c73
cb36cb6c60ff1adb1ce4f87f8b325190b290712e
/com.legooframework.covariant/src/main/java/com/legooframework/model/covariant/service/BundleService.java
af374d0a83606c295ab842280a2913b3d3d69e00
[]
no_license
haozm/legooframework
db27d1c96669e8b46cb5fd1e983a95888bef3795
ad0f99c0344de78a37c38d4cfe4bdbbd253a6731
refs/heads/master
2020-03-19T07:09:00.643277
2019-12-07T13:47:17
2019-12-07T13:47:17
136,090,435
1
1
null
null
null
null
UTF-8
Java
false
false
359
java
package com.legooframework.model.covariant.service; import com.legooframework.model.core.base.service.BaseService; import com.legooframework.model.core.osgi.Bundle; public abstract class BundleService extends BaseService { @Override protected Bundle getLocalBundle() { return getBean("covariantBundle", Bundle.class); } }
[ "xiaojie.hao@live.com" ]
xiaojie.hao@live.com
98b4f5c3458ec84b153b9586f4af4f855cb67e52
9f087b78583ae101198714447806c3258f999e87
/src/session/PredsednikDaoLocal.java
539759c6d055844afee960199cc5eea08a73e89b
[]
no_license
jansulja/XMLProjekat
68948f36e4fec9ebb388ba0e0d096c298f237d2d
8aa3ddcc2b2cbbc9ff0562894830768f933100dc
refs/heads/master
2020-04-06T05:48:00.343877
2016-06-21T09:07:56
2016-06-21T09:07:56
58,272,545
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package session; import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import model.Predsednik; import rs.ac.uns.ftn.xws.sessionbeans.common.GenericDao; public interface PredsednikDaoLocal extends GenericDao<Predsednik, Integer>{ public Predsednik login(String username, String password) throws UnsupportedEncodingException, NoSuchAlgorithmException; public boolean chechCred(String username, String password); public void logout(); }
[ "rhcpfilip@gmail.com" ]
rhcpfilip@gmail.com
d5da382b9a9bfb60a5fed148343531573b937e70
cd540ca58e5ea274fabd27a38ee891f468f32fd0
/src/fr/hugolaloge/epitechheaders/Settings.java
fa520c54bb06b6ca52caa8caeb0dda10593b0313
[]
no_license
loicpirez/Jetbrains_EPITECH_Headers
268c2931312893c0ee007f91e47ded6176a25d1c
3ccec49b29aae33f860f48478fe931077f35edb8
refs/heads/master
2021-06-24T17:51:25.362374
2017-09-14T07:29:51
2017-09-14T07:29:51
103,500,120
0
1
null
null
null
null
UTF-8
Java
false
false
861
java
package fr.hugolaloge.epitechheaders; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.openapi.components.StoragePathMacros; import com.intellij.util.xmlb.XmlSerializerUtil; /** * Created by laloge_h on 14/01/16. */ @State(name = "EpitechHeadersSettings", storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/epitechheaders.xml")} ) public class Settings implements PersistentStateComponent<Settings> { public String login = "login"; public String email = "prenom.nom@epitech.eu"; public String fullName = "Prenom Nom"; public boolean updateOnSave = true; public Settings getState() { return this; } public void loadState(Settings state) { XmlSerializerUtil.copyBean(state, this); } }
[ "loic.pirez@epitech.eu" ]
loic.pirez@epitech.eu
2d024955e4b4e0f94b03bed7e2c88a954955b6a4
d7f254a5a7ed1a5c53082bd0955227fca5052253
/src/main/java/net/anet/invoice/repo/security/SecurityUtils.java
d3b7cbf2a8da55490386e359f51ef9164768326d
[]
no_license
lsobrero/invoice-repo
436a57f3f0028583ae35bc6d7588a6413b263940
b85a2458901c3ca4f5d4eceda4e1aa1161d3ef01
refs/heads/master
2022-12-21T00:19:45.326160
2019-09-06T09:09:35
2019-09-06T09:09:35
205,160,624
0
0
null
2022-12-16T04:53:16
2019-08-29T12:37:11
Java
UTF-8
Java
false
false
2,995
java
package net.anet.invoice.repo.security; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import java.util.Optional; /** * Utility class for Spring Security. */ public final class SecurityUtils { private SecurityUtils() { } /** * Get the login of the current user. * * @return the login of the current user. */ public static Optional<String> getCurrentUserLogin() { SecurityContext securityContext = SecurityContextHolder.getContext(); return Optional.ofNullable(securityContext.getAuthentication()) .map(authentication -> { if (authentication.getPrincipal() instanceof UserDetails) { UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); return springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { return (String) authentication.getPrincipal(); } return null; }); } /** * Get the JWT of the current user. * * @return the JWT of the current user. */ public static Optional<String> getCurrentUserJWT() { SecurityContext securityContext = SecurityContextHolder.getContext(); return Optional.ofNullable(securityContext.getAuthentication()) .filter(authentication -> authentication.getCredentials() instanceof String) .map(authentication -> (String) authentication.getCredentials()); } /** * Check if a user is authenticated. * * @return true if the user is authenticated, false otherwise. */ public static boolean isAuthenticated() { SecurityContext securityContext = SecurityContextHolder.getContext(); return Optional.ofNullable(securityContext.getAuthentication()) .map(authentication -> authentication.getAuthorities().stream() .noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS))) .orElse(false); } /** * If the current user has a specific authority (security role). * <p> * The name of this method comes from the {@code isUserInRole()} method in the Servlet API. * * @param authority the authority to check. * @return true if the current user has the authority, false otherwise. */ public static boolean isCurrentUserInRole(String authority) { SecurityContext securityContext = SecurityContextHolder.getContext(); return Optional.ofNullable(securityContext.getAuthentication()) .map(authentication -> authentication.getAuthorities().stream() .anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority))) .orElse(false); } }
[ "lsobrero@gmail.com" ]
lsobrero@gmail.com
709e185fa122697a903c7a0a793cb2fefbe880ed
f96493e1309016c80758f5a00ab8f5902d288263
/项目练习/SSM分布式淘淘商城/taotao-search/taotao-search-service/src/test/java/com/taotao/test/search/SolrjTest.java
42a528fc056c0c988ad5b3935fff3c061f64e645
[]
no_license
ZengPengW/Study
54e5e4e38913ebf8c32a7b0c94b08d63ad5caef7
1ec8fb03b535f56a16e76fe57f8e4d3acd08a4b4
refs/heads/master
2022-12-26T04:28:44.190611
2019-09-18T09:41:37
2019-09-18T09:41:37
153,634,692
1
0
null
2022-12-16T07:14:36
2018-10-18T14:10:32
CSS
UTF-8
Java
false
false
2,062
java
package com.taotao.test.search; import java.io.IOException; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.HttpSolrServer; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrInputDocument; import org.junit.Test; public class SolrjTest { //添加索引 @Test public void add() throws SolrServerException, IOException { //创建solrserver 建立连接 SolrServer solrServer=new HttpSolrServer("http://192.168.25.128:8081/solr"); //创建solrinputdocument SolrInputDocument document=new SolrInputDocument(); //向文档中添加域 document.addField("id", "test01"); document.addField("item_title", "这是一个测试"); //将文档提交到索引库 solrServer.add(document); //提交 solrServer.commit(); } //搜索索引 @Test public void select() throws SolrServerException, IOException { //创建solrserver 建立连接 SolrServer solrServer=new HttpSolrServer("http://192.168.25.128:8081/solr"); SolrQuery solrQuery=new SolrQuery(); solrQuery.setQuery("一加"); //solrQuery.set("q", "item_title:阿尔卡特"); // solrQuery.addFilterQuery("item_price:[0 TO 200000]"); //设置查询域 solrQuery.set("df", "item_keywords"); //查询 QueryResponse response = solrServer.query(solrQuery); //获取结果集 SolrDocumentList results = response.getResults(); //获取总记录数 System.out.println("total:"+results.getNumFound()); //获取内容 for (SolrDocument solrDocument : results) { System.out.println(solrDocument.get("id")); System.out.println(solrDocument.get("item_title")); System.out.println(solrDocument.get("item_price")); System.out.println(solrDocument.get("item_image")); System.out.println("****************************************"); } } }
[ "zpzydsxzqf@qq.com" ]
zpzydsxzqf@qq.com
66e2d013f4af674cc7f35e94e11d351037438245
e4b1d9b159abebe01b934f0fd3920c60428609ae
/src/main/java/org/proteored/miapeapi/exceptions/InterruptedMIAPEThreadException.java
a49ccab73c4cdd31b11c72c03c4a60f155585f1a
[ "Apache-2.0" ]
permissive
smdb21/java-miape-api
83ba33cc61bf2c43c4049391663732c9cc39a718
5a49b49a3fed97ea5e441e85fe2cf8621b4e0900
refs/heads/master
2022-12-30T15:28:24.384176
2020-12-16T23:48:07
2020-12-16T23:48:07
67,961,174
0
0
Apache-2.0
2022-12-16T03:22:23
2016-09-12T00:01:29
Java
UTF-8
Java
false
false
556
java
package org.proteored.miapeapi.exceptions; public class InterruptedMIAPEThreadException extends RuntimeException { /** * */ private static final long serialVersionUID = -3816278939316366357L; /** * */ public InterruptedMIAPEThreadException() { super(); } public InterruptedMIAPEThreadException(String message, Throwable throwable) { super(message, throwable); } public InterruptedMIAPEThreadException(String message) { super(message); } public InterruptedMIAPEThreadException(Throwable throwable) { super(throwable); } }
[ "salvador@scripps.edu" ]
salvador@scripps.edu
58f19bf3c286c53d7fa3005f941e36fa0cbe149a
a4411e6f969c489ba890a21eaba7c92113b3392f
/src/main/java/QA.java
cf8e887de5fbdb5ca75a864fa95d28c80f46716c
[]
no_license
TsDmitriy/AbstractFactory
8dae7130c98e5ca166d2bb27b4bf48b80a1c652c
736f7f65bfdd85e3aa349c6bce014beec7a07e7d
refs/heads/master
2023-05-06T17:04:46.631902
2021-06-01T12:40:14
2021-06-01T12:40:14
372,825,171
0
0
null
null
null
null
UTF-8
Java
false
false
45
java
public interface QA { void testCode(); }
[ "tsarev-dmitriy@bk.ru" ]
tsarev-dmitriy@bk.ru
bb554490f18ae468f8e7e576162112de3b21205c
fbcee03b292cfdee70f9f160882411ef84498a7c
/src/main/java/resteasy/RestEasyApplication.java
4bf7f390e634eaacf736c2463ac8783a118daf30
[]
no_license
walisonmoreiraufg/lab-pw-2016-2
64fe61420e281c926e518092498827705defbc87
a3cd3f1ae4b65699ae3e96cfccc7ba52bce41581
refs/heads/master
2021-06-16T22:11:29.469249
2017-06-06T23:23:20
2017-06-06T23:23:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
package resteasy; import java.util.HashSet; import java.util.Set; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import rest.MenorMaiorJaxRs; @ApplicationPath("/api") public class RestEasyApplication extends Application { private Set<Object> singletons = new HashSet<Object>(); @Override public Set<Object> getSingletons() { return singletons; } public RestEasyApplication() { singletons.add(new AlunoController()); singletons.add(new MenorMaiorJaxRs()); } }
[ "walison.moreira@gmail.com" ]
walison.moreira@gmail.com
4b92f3d0a139acf73b7d77a7b77ad79988965b72
b533b394b8fa665b7270830a128adc57931cb6af
/editor/cn/MaximumProductSubarray_152.java
93e080b26cae52a1c2e7db70fec75cb2831dcfb3
[]
no_license
pengzhetech/leetcode
f2ac111cf41cca23c2e52edd9a072aae8782e382
4cda15b0021010b9d8450102a48391e91ce69a7b
refs/heads/master
2023-06-08T16:19:50.310281
2021-07-02T14:59:47
2021-07-02T14:59:47
275,697,540
0
0
null
null
null
null
UTF-8
Java
false
false
1,862
java
//给你一个整数数组 nums ,请你找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。 // // // // 示例 1: // // 输入: [2,3,-2,4] //输出: 6 //解释: 子数组 [2,3] 有最大乘积 6。 // // // 示例 2: // // 输入: [-2,0,-1] //输出: 0 //解释: 结果不能为 2, 因为 [-2,-1] 不是子数组。 // Related Topics 数组 动态规划 // 👍 667 👎 0 public class MaximumProductSubarray_152 { public static void main(String[] args) { Solution solution = new MaximumProductSubarray_152().new Solution(); } //leetcode submit region begin(Prohibit modification and deletion) class Solution { public int maxProduct(int[] nums) { int len = nums.length; if (len == 0) { return 0; } // dp[i][0]:以 nums[i] 结尾的连续子数组的最小值 // dp[i][1]:以 nums[i] 结尾的连续子数组的最大值 int[][] dp = new int[len][2]; dp[0][0] = nums[0]; dp[0][1] = nums[0]; for (int i = 1; i < len; i++) { if (nums[i] >= 0) { dp[i][0] = Math.min(nums[i], nums[i] * dp[i - 1][0]); dp[i][1] = Math.max(nums[i], nums[i] * dp[i - 1][1]); } else { dp[i][0] = Math.min(nums[i], nums[i] * dp[i - 1][1]); dp[i][1] = Math.max(nums[i], nums[i] * dp[i - 1][0]); } } // 只关心最大值,需要遍历 int res = dp[0][1]; for (int i = 1; i < len; i++) { res = Math.max(res, dp[i][1]); } return res; } } //leetcode submit region end(Prohibit modification and deletion) }
[ "pengzhepost@sina.com" ]
pengzhepost@sina.com
31d90ad9f76f750f28b11f0406fd823d7ef7b849
c4c90a7daecbda78d680628f62c974d33a0b96db
/src/main/java/com/mycompany/store/config/OpenApiConfiguration.java
8343b7f20fca18e2d8c5aeafa87d9e872feadf74
[]
no_license
diqiuche/e-commerce-app
df2b2ca11193e06402048a68457acb38b755b0e5
79d8b76a66a9827961915e97c785ada607f38679
refs/heads/master
2023-06-05T06:44:55.105847
2021-06-18T03:46:45
2021-06-18T03:46:45
379,114,936
0
0
null
null
null
null
UTF-8
Java
false
false
2,597
java
package com.mycompany.store.config; import static springfox.documentation.builders.PathSelectors.regex; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import tech.jhipster.config.JHipsterConstants; import tech.jhipster.config.JHipsterProperties; import tech.jhipster.config.apidoc.customizer.SpringfoxCustomizer; @Configuration @Profile(JHipsterConstants.SPRING_PROFILE_API_DOCS) public class OpenApiConfiguration { @Bean public SpringfoxCustomizer noApiFirstCustomizer() { return docket -> docket.select().apis(RequestHandlerSelectors.basePackage("com.mycompany.store.web.api").negate()); } @Bean public Docket apiFirstDocket(JHipsterProperties jHipsterProperties) { JHipsterProperties.ApiDocs properties = jHipsterProperties.getApiDocs(); Contact contact = new Contact(properties.getContactName(), properties.getContactUrl(), properties.getContactEmail()); ApiInfo apiInfo = new ApiInfo( "API First " + properties.getTitle(), properties.getDescription(), properties.getVersion(), properties.getTermsOfServiceUrl(), contact, properties.getLicense(), properties.getLicenseUrl(), new ArrayList<>() ); return new Docket(DocumentationType.OAS_30) .groupName("openapi") .host(properties.getHost()) .protocols(new HashSet<>(Arrays.asList(properties.getProtocols()))) .apiInfo(apiInfo) .useDefaultResponseMessages(properties.isUseDefaultResponseMessages()) .forCodeGeneration(true) .directModelSubstitute(ByteBuffer.class, String.class) .genericModelSubstitutes(ResponseEntity.class) .ignoredParameterTypes(Pageable.class) .select() .apis(RequestHandlerSelectors.basePackage("com.mycompany.store.web.api")) .paths(regex(properties.getDefaultIncludePattern())) .build(); } }
[ "diqiuche@gmail.com" ]
diqiuche@gmail.com
f603161eba451927ea6a7e625d0321bb1a5fd1df
90afe47e1143aff51a77137c8daaf4f675ebf159
/src/main/java/org/yuesi/cjzbx/datacenter/config/DataCenterConfig.java
bb068ae6080369a4de9d871cdd92ef1a8e2584ae
[]
no_license
YUESI/cjzbx.MarketDataCenter
c8d9d5d0062fdf7dfca905291512e255a3749b5a
5a723a9b0c264714159262dcb6e901842e504b99
refs/heads/master
2021-01-12T13:09:40.481023
2017-06-06T14:36:17
2017-06-06T14:36:17
72,129,095
0
0
null
null
null
null
UTF-8
Java
false
false
857
java
/** * */ package org.yuesi.cjzbx.datacenter.config; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; /** * @author qiuwenhu * @date 2017年3月6日下午10:52:08 */ @Component public class DataCenterConfig { @Value("${server.port}") private String port; @Value("${my.datayespath}") private String dailyDataPath; /** * @return the port */ public String getPort() { return port; } /** * @return the dailyDataPath */ public String getDailyDataPath() { return dailyDataPath; } /** * @param dailyDataPath * the dailyDataPath to set */ public void setDailyDataPath(String dailyDataPath) { this.dailyDataPath = dailyDataPath; } /** * @param port * the port to set */ public void setPort(String port) { this.port = port; } }
[ "null@null.com" ]
null@null.com
e5f6e6fee3c6c152c17c5f5525209b45fd679160
8504b47ff1e51a2d873ebb734fee9cc997ae5f6c
/src/main/java/com/zbdigit/myapp/domain/CommonExtData.java
d8d9156b1168c14087ebdf6a7aae1a32976ae3f5
[]
no_license
budikaka/jhipster-pro-sample
921e5028b8d94b3b878cd1e1564f334af94ace0b
5daa09188cc1878586a15da5204b717c611d2cf8
refs/heads/main
2023-05-30T04:36:49.461453
2021-06-16T14:08:37
2021-06-16T14:08:37
377,517,798
0
0
null
null
null
null
UTF-8
Java
false
false
5,110
java
package com.zbdigit.myapp.domain; import java.io.Serializable; import javax.persistence.*; import javax.validation.constraints.*; import org.hibernate.annotations.Any; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; /** * 通用扩展数据 */ @Entity @Table(name = "common_ext_data") @DynamicUpdate @org.springframework.data.elasticsearch.annotations.Document(indexName = "commonextdata") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class CommonExtData implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; /** * 属性名 */ @NotNull @Size(max = 100) @Column(name = "field_name", length = 100, nullable = false) private String fieldName; /** * 通用字段类型 */ @Column(name = "common_field_type", insertable = false, updatable = false) private String commonFieldType; /** * 通用数据Id */ @Column(name = "common_field_id", insertable = false, updatable = false) private Long commonFieldId; /** * 宿主实体名称 */ @Column(name = "owner_type", insertable = false, updatable = false) private String ownerType; /** * 宿主实体Id */ @Column(name = "owner_id", insertable = false, updatable = false) private Long ownerId; @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Cascade({ org.hibernate.annotations.CascadeType.ALL }) @Any(metaDef = "ExtDataMetaDef", metaColumn = @Column(name = "common_field_type"), fetch = FetchType.EAGER) @JoinColumn(name = "common_field_id") private CommonField value; @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Cascade({ org.hibernate.annotations.CascadeType.ALL }) @Any(metaDef = "OwnerMetaDef", metaColumn = @Column(name = "owner_type"), fetch = FetchType.EAGER) @JoinColumn(name = "owner_id") private Owner owner; // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFieldName() { return fieldName; } public CommonExtData fieldName(String fieldName) { this.fieldName = fieldName; return this; } public void setFieldName(String fieldName) { this.fieldName = fieldName; } public String getCommonFieldType() { return commonFieldType; } public CommonExtData commonFieldType(String commonFieldType) { this.commonFieldType = commonFieldType; return this; } public void setCommonFieldType(String commonFieldType) { this.commonFieldType = commonFieldType; } public Long getCommonFieldId() { return commonFieldId; } public CommonExtData commonFieldId(Long commonFieldId) { this.commonFieldId = commonFieldId; return this; } public void setCommonFieldId(Long commonFieldId) { this.commonFieldId = commonFieldId; } public String getOwnerType() { return ownerType; } public CommonExtData ownerType(String ownerType) { this.ownerType = ownerType; return this; } public void setOwnerType(String ownerType) { this.ownerType = ownerType; } public Long getOwnerId() { return ownerId; } public CommonExtData ownerId(Long ownerId) { this.ownerId = ownerId; return this; } public void setOwnerId(Long ownerId) { this.ownerId = ownerId; } public CommonField getValue() { return value; } public void setValue(CommonField value) { this.value = value; } public Owner getOwner() { return owner; } public void setOwner(Owner owner) { this.owner = owner; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CommonExtData)) { return false; } return id != null && id.equals(((CommonExtData) o).id); } @Override public int hashCode() { return 31; } @Override public String toString() { return ( "CommonExtData{" + "id=" + getId() + ", fieldName='" + getFieldName() + "'" + ", commonFieldType='" + getCommonFieldType() + "'" + ", commonFieldId=" + getCommonFieldId() + ", ownerType='" + getOwnerType() + "'" + ", ownerId=" + getOwnerId() + "}" ); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
961525ae3b71a2941b01606ee4b77e73649009e3
615879e5fba5b4a6a3b952be88b52b3884b382b9
/src/main/java/com/homebrew/persistance/criterion/ICriterion.java
60a6a2281c40863ca0fe3f1fa1817799770927fb
[ "Apache-2.0" ]
permissive
zubial/homebrew-rasppi
cdea5f287a70aec547c9d3f371208f96be155293
d4dccda2a5a93375057853df9019de5512e3a15d
refs/heads/master
2021-04-06T10:51:33.028367
2018-03-12T14:37:40
2018-03-12T14:37:40
124,901,123
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package com.homebrew.persistance.criterion; import com.homebrew.persistance.helper.CriteriaHelper; public interface ICriterion { CriteriaHelper addCriterion(CriteriaHelper criteriaHelper); }
[ "brodrigues@sbeglobalservice.com" ]
brodrigues@sbeglobalservice.com
75cf57421c191e3c0d836a561355c99c376cefed
69efc9e6f7fcdfac19039577b092010636735810
/app/src/test/java/com/example/ardyatmika/kuismatematika/ExampleUnitTest.java
7d04af1e1a6e23e997fbe8907cc73feacfac52a0
[]
no_license
aminsholeh/KuisMatematika
79e13754143f1e0a3dbda8f62df556f48aba4a6b
c3cdc3931b83774c2701089e846bd2d6fe620355
refs/heads/master
2021-06-29T15:43:23.377295
2020-10-01T11:20:29
2020-10-01T11:20:29
152,182,565
0
1
null
2018-10-27T12:30:48
2018-10-09T03:31:47
Java
UTF-8
Java
false
false
415
java
package com.example.ardyatmika.kuismatematika; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "ardyatmika@gmail.com" ]
ardyatmika@gmail.com
4e0f3fd5b29db20b938076b06fa43f94c4de7dd0
41f5b57706cd46fbc42e124d98c9426bfe03260e
/Kurs Java/Zadanie 6/src/com/company/events/MyPanelListener.java
3474b4b6dbf2b838705b8f4906261cfbd68c0006
[]
no_license
mtszpater/Uniwersytet-Wroclawski
d6271d4afca7335d9f331963e6fdb77042456cac
ffad08623b47016ce2886ba105ef023bfeb35c16
refs/heads/master
2021-06-23T07:45:35.379066
2017-08-23T09:46:03
2017-08-23T09:46:03
56,454,926
0
1
null
null
null
null
UTF-8
Java
false
false
5,921
java
package com.company.events; import com.company.Board; import com.company.Panel; import com.company.gui.Background; import com.company.gui.Pointer; import com.company.tools.PointsCounter; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; /** * author @pater */ public class MyPanelListener implements MouseListener { private Panel panel; private Point lastChecked, currChecked; private boolean Checked = false; public MyPanelListener(Panel panel) { this.panel = panel; generateCurrentAndLastCheckedPoints(); } private void generateCurrentAndLastCheckedPoints() { lastChecked = new Point(-1, -1); currChecked = new Point(-1, -1); } @Override public void mouseClicked(MouseEvent arg0) { int width = panel.getSize().width; int height = panel.getSize().height; int min = returnSmaller(width, height); int x = generateXPositionOnClick(arg0, width, height, min); int y = generateYPositionOnClick(arg0, width, height, min); x = x / 25; y = y / 25; Board board = Board.getInstance(); if (InRange(x, y)) { if (!Checked) { if (board.IsEmptyPoint(x,y)) { lastChecked.x = currChecked.x; lastChecked.y = currChecked.y; currChecked.x = x; currChecked.y = y; Checked = true; if (lastCheckedisNotCurrChecked()) { moveSelection(); panel.repaint(); } } } else { if ((CurrCheckedXIsInRangeOf2(x) && y == currChecked.y && board.IsEmptyPoint(x + currChecked.x/ 2, y) && board.isOne(x,y)) || (CurrCheckedYIsInRangeOf2(y) && x == currChecked.x && board.IsEmptyPoint(x, y + currChecked.y / 2) && board.isOne(x,y))) { setPointAsEmpty(); Checked = false; decreaseCount(); PointsCounter pointsCounter = PointsCounter.getInstance(); JOptionPane.showMessageDialog(null, "Pozostalo pionkow "+ pointsCounter.getCount()); moveChecker(new Point(x, y)); setNewPointAsFill(x, y); panel.repaint(); currChecked.x = -1; if (EndOfGame()) { EndOfGameInformation(); } } else { Checked = false; mouseClicked(arg0); } } } } private int returnSmaller(int width, int height) { return width>height?height:width; } private int generateXPositionOnClick(MouseEvent arg0, int width, int height, int min) { return (arg0.getX()-(width>height?(width-height)/2:0)) * 500 / min; } private int generateYPositionOnClick(MouseEvent arg0, int width, int height, int min) { return (arg0.getY()-(ifXisBiggerThanHeightReturn0ElseReturnHalf(height, width))) * 500 / min; } private boolean InRange(int x, int y) { return x >= 0 && x < 20 && y >= 0 && y < 20; } private void moveChecker(Point n) { addBackgroundToEmptyPoint(currChecked); Background background = Background.getInstance(); panel.image.getGraphics().drawImage(background.getBoardBackGround(), (currChecked.x + n.x) / 2 * 25, (currChecked.y + n.y) / 2 * 25, null); addCheckerAtNewPoint(n); } private void moveSelection() { if (lastChecked.x != -1) { addBackgroundToEmptyPoint(lastChecked); addCheckerAtNewPoint(lastChecked); } } private void setNewPointAsFill(int x, int y) { Board board = Board.getInstance(); board.setPointAsFill(x,y); board.setPointAsVisited(x,y,currChecked); } private void decreaseCount() { PointsCounter pointsCounter = PointsCounter.getInstance(); pointsCounter.decrease(); } private void setPointAsEmpty() { Board board = Board.getInstance(); board.setPointAsEmpty(currChecked); } private boolean CurrCheckedYIsInRangeOf2(int y) { return (y == currChecked.y + 2) || (y == currChecked.y - 2); } private boolean CurrCheckedXIsInRangeOf2(int x) { return (x == currChecked.x + 2) || (x == currChecked.x - 2); } private boolean lastCheckedisNotCurrChecked() { return lastChecked.x != currChecked.x || lastChecked.y != currChecked.y; } private void EndOfGameInformation() { JOptionPane.showMessageDialog(null, "Gratulajce! Wygrales!"); ActionManager am = new ActionManager(panel); am.reaction(Actions.END_GAME); } private boolean EndOfGame() { return PointsCounter.getInstance().getCount() == 1; } private int ifXisBiggerThanHeightReturn0ElseReturnHalf(int height, int width) { return width>height?0:(height-width)/2; } private boolean addCheckerAtNewPoint(Point n) { Pointer pointer = Pointer.getInstance(); return panel.image.getGraphics().drawImage(pointer.getCurrentChecker(), n.x * 25, n.y * 25, null); } private void addBackgroundToEmptyPoint(Point last) { Background background = Background.getInstance(); panel.image.getGraphics().drawImage(background.getBoardBackGround(), last.x * 25, last.y * 25, null); } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } }
[ "mtszpater@gmail.com" ]
mtszpater@gmail.com
4d0e319b230554d5434c607cd07e37dbf1fb933a
46d5fe843eba3ba4b9b0e34c015cb85c4efc45e2
/app/src/main/java/test/pa1pal/bitcoinblockchain/RetrofitService.java
939b686784b6dc9f659c71861500b5ff54f46a5c
[]
no_license
pa1pal/BlockchainWebsockets
bf8e2be6e98993208151c8d544f175cf0f27c27c
359932a8ee4d20f427919c10d1faf03bba52564f
refs/heads/master
2020-05-17T11:16:45.256225
2019-04-28T12:50:43
2019-04-28T12:50:43
183,682,573
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package test.pa1pal.bitcoinblockchain; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; public interface RetrofitService { @GET("tobtc") Call<String> getBTCPrice(@Query("currency") String currency, @Query("value") Integer value); }
[ "pawanpal004@gmail.com" ]
pawanpal004@gmail.com
6b6b335fc8a32cfe43ed794c046cfc96a58208f6
f17ecef67fd5d68924480d0da6398ed1599ac626
/src/main/java/com/example/demo4/controller/StudentController.java
a00c0cc48e9077a3468b67f4cbff2f101c616128
[]
no_license
phongtiger/springboot
c08de758a9beed4b7698a9418e0d52d81a8963b5
ee3d08b8c79cfbd271459b630cd415820a96faa0
refs/heads/master
2023-01-24T16:02:37.110043
2020-11-18T09:02:42
2020-11-18T09:02:42
313,878,499
0
0
null
null
null
null
UTF-8
Java
false
false
9,338
java
package com.example.demo4.controller; import com.example.demo4.model.Input; import com.example.demo4.model.Message; import com.example.demo4.model.Student; import com.example.demo4.service.ClassService; import com.example.demo4.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @CrossOrigin("*") @RestController @PropertySource( {"classpath:message.properties", "classpath:application.properties"} ) @RequestMapping("/student") public class StudentController { @Autowired Environment env; @Autowired private StudentService studentService; @Autowired private ClassService classService; @PostMapping("/create") public ResponseEntity<Message> createStudent(@RequestBody Student student) { Message message = new Message(); try { assert student != null; Student student1 = studentService.findByStudent_code(student.getStudent_code()); if (student1 == null) { Student student2 = new Student(); student2.setName(student.getName()); student2.setPassword(student.getPassword()); student2.setStudent_code(student.getStudent_code()); student2.setIs_monitor(student.isIs_monitor()); studentService.save(student); message.setMessage("SUCCESS"); message.setDescription(env.getProperty("create.student.success")); return new ResponseEntity<>(message, HttpStatus.OK); } else { message.setMessage("ERROR"); message.setDescription(env.getProperty("create.student.not.success")); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } } catch (Exception e) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @GetMapping("/all") public ResponseEntity<List<Student>> getAllStudent() { try { List<Student> lstStudent = studentService.findAll(); if (lstStudent.isEmpty()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } else { return new ResponseEntity<>(lstStudent, HttpStatus.OK); } } catch (Exception e) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/searchByName/", method = RequestMethod.GET) public ResponseEntity<List<Student>> getStudentByName(@RequestParam(value = "name") String name) { try { List<Student> student = studentService.findByName(name); if (student.isEmpty()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } else { return new ResponseEntity<>(student, HttpStatus.OK); } } catch (Exception e) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/searchByStudentCode/", method = RequestMethod.GET) public ResponseEntity<Student> getStudentByStudentCode(@RequestParam(value = "studentcode") String studentcode) { try { Student student = studentService.findByStudent_code(studentcode); if (student == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } else { return new ResponseEntity<>(student, HttpStatus.OK); } } catch (Exception e) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @PutMapping("/update") public ResponseEntity<Message> updateStudent(@RequestBody Student student) { Message message = new Message(); try { if (student != null && student.getId() != null) { Student student1 = studentService.findById(student.getId()); if (student1 == null) { message.setMessage("ERROR"); message.setDescription(env.getProperty("not.found.student.id")); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } if (student.getName() != null) { student1.setName(student.getName()); if (studentService.exitsByCode(student.getStudent_code())) { student1.setStudent_code(student.getStudent_code()); } student1.setIs_monitor(student.isIs_monitor()); if (classService.existsById(student.getClass_id())) { student1.setClass_id(student.getClass_id()); } } studentService.save(student1); message.setMessage("SUCCESS"); message.setDescription(env.getProperty("update.student.info.success")); return new ResponseEntity<>(message,HttpStatus.OK); } else { message.setMessage("ERROR"); message.setDescription(env.getProperty("update.student.info.not.success")); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } } catch (Exception e) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @PutMapping("/change/password") public ResponseEntity<Message> changePassword(@RequestBody Input input) { Message message = new Message(); try { if (input == null || input.getStudent() == null) { message.setMessage("ERROR"); message.setDescription(env.getProperty("update.student.info.not.success")); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } if (input.getOldPassword() == null) { message.setMessage("ERROR"); message.setDescription("Ban vui long nhap mat khau cu"); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } if (input.getNewPassword() == null) { message.setMessage("ERROR"); message.setDescription("Ban vui long nhap mat khau moi"); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } Student studentInput = input.getStudent(); if (studentInput.getId() != null) { Student studentRoot = studentService.findById(studentInput.getId()); if (studentRoot == null) { message.setMessage("ERROR"); message.setDescription(env.getProperty("not.found.student.id")); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } if (!input.getOldPassword().equals(studentRoot.getPassword())) { message.setMessage("ERROR"); message.setDescription(env.getProperty("Ban da nhap sai mat khau, vui long nhap lai")); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } studentRoot.setPassword(input.getNewPassword()); studentService.save(studentRoot); message.setMessage("SUCCESS"); message.setDescription(env.getProperty("update.student.info.success")); return new ResponseEntity<>(message,HttpStatus.OK); } else { message.setMessage("ERROR"); message.setDescription(env.getProperty("update.student.info.not.success")); return new ResponseEntity<>(message,HttpStatus.INTERNAL_SERVER_ERROR); } } catch (Exception e) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } @DeleteMapping("/{id}") public ResponseEntity<Message> deleteStudent(@PathVariable Long id) { Message message = new Message(); try { if (id != null) { Student student = studentService.findById(id); if (student == null) { message.setMessage("ERROR"); message.setDescription(env.getProperty("not.found.student.id") + " " + id + "!"); return new ResponseEntity<>(message,HttpStatus.NOT_FOUND); } studentService.deleteStudent(student); message.setMessage("SUCCESS"); message.setDescription(env.getProperty("delete.student")); return new ResponseEntity<>(message,HttpStatus.OK); } else { message.setMessage("ERROR"); message.setDescription(env.getProperty("please.enter.id.student")); return new ResponseEntity<>(message,HttpStatus.NOT_FOUND); } } catch (Exception e) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } }
[ "duongsscc@gmail.com" ]
duongsscc@gmail.com
53d86d645404a6aaf847fd54a52e6efec245540c
ae93d577d553f7834cb06dcc418decb814f98919
/app/src/main/java/com/dazone/crewemail/fragments/OrganizationFragment.java
498c33eada76b7a89600c3c134f52aeba23933ae
[]
no_license
NgocTrinh123/CrewMail
bfa0852701aea9dd0830fd25605b96b26b9ec8d9
cb8344d5e133e63af9f6767acf42532bf9906deb
refs/heads/master
2021-01-13T13:43:45.366095
2016-12-15T04:57:18
2016-12-15T04:57:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,985
java
package com.dazone.crewemail.fragments; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import com.dazone.crewemail.R; import com.dazone.crewemail.activities.OrganizationActivity; import com.dazone.crewemail.customviews.OrganizationView; import com.dazone.crewemail.data.PersonData; import com.dazone.crewemail.interfaces.OnOrganizationSelectedEvent; import com.dazone.crewemail.utils.Statics; import com.dazone.crewemail.utils.StaticsBundle; import com.dazone.crewemail.utils.Util; import java.util.ArrayList; /** * Created by Dinh Huynh on 12/30/15. */ public class OrganizationFragment extends BaseFragment implements View.OnClickListener, OnOrganizationSelectedEvent { public static OrganizationFragment fragment; public boolean isSearching = false; private View mView; private ArrayList<PersonData> selectedPersonList; private TextView sharedPersonTv; private LinearLayout mSharePersonContent; private EditText searchEditText; private OrganizationView orgView; private boolean mIsDisplaySelectedOnly; public static OrganizationFragment newInstance(ArrayList<PersonData> selectedPerson, boolean isDisplaySelectedOnly) { Bundle args = new Bundle(); args.putParcelableArrayList("selectedPerson", selectedPerson); args.putBoolean("isDisplaySelectedOnly", isDisplaySelectedOnly); OrganizationFragment fragment = new OrganizationFragment(); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); fragment = this; selectedPersonList = getArguments().getParcelableArrayList("selectedPerson"); mIsDisplaySelectedOnly = getArguments().getBoolean("isDisplaySelectedOnly"); if (selectedPersonList == null) { selectedPersonList = new ArrayList<>(); } setHasOptionsMenu(true); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mView = inflater.inflate(R.layout.fragment_organization, container, false); sharedPersonTv = (TextView) mView.findViewById(R.id.shared_person_name); mSharePersonContent = (LinearLayout) mView.findViewById(R.id.share_list_content); searchEditText = (EditText) mView.findViewById(R.id.share_search_edit_text); mView.findViewById(R.id.share_company_btn).setOnClickListener(this); mView.findViewById(R.id.share_search_btn).setOnClickListener(this); mView.findViewById(R.id.share_search_action).setOnClickListener(this); initSearchView(); initOrganizationTree(); setSelectedPersonName(); initShareTextViewAction(); return mView; } private void initOrganizationTree() { orgView = new OrganizationView(getActivity(), selectedPersonList, mIsDisplaySelectedOnly, mSharePersonContent); orgView.setOnSelectedEvent(this); if (!mIsDisplaySelectedOnly) { mView.findViewById(R.id.share_information_wrapper).setVisibility(View.VISIBLE); // orgView.displayWholeOrganization(mSharePersonContent); } else { mView.findViewById(R.id.share_information_wrapper).setVisibility(View.GONE); // orgView.displaySelectedList(selectedPersonList, mSharePersonContent); } } private void initShareTextViewAction() { sharedPersonTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { Intent intent = new Intent(getActivity(), OrganizationActivity.class); Bundle bundle = new Bundle(); bundle.putParcelableArrayList(StaticsBundle.BUNDLE_LIST_PERSON, selectedPersonList); bundle.putBoolean(StaticsBundle.BUNDLE_ORG_DISPLAY_SELECTED_ONLY, true); intent.putExtras(bundle); startActivityForResult(intent, Statics.ORGANIZATION_DISPLAY_SELECTED_ACTIVITY); } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case Statics.ORGANIZATION_DISPLAY_SELECTED_ACTIVITY: ArrayList<PersonData> resultList = data.getExtras().getParcelableArrayList(StaticsBundle.BUNDLE_LIST_PERSON); selectedPersonList.clear(); if (resultList != null) selectedPersonList.addAll(resultList); mSharePersonContent.removeAllViews(); orgView = new OrganizationView(getActivity(), selectedPersonList, mIsDisplaySelectedOnly, mSharePersonContent); orgView.setOnSelectedEvent(this); break; } } } private void initSearchView() { searchEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { try { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(searchEditText.getWindowToken(), 0); } catch (Exception e) { } handleSearchAction(true); return true; } return false; } }); } @Override public void onClick(View v) { int id = v.getId(); //&& id != R.id.share_save&& id != R.id.imv_share if (id != R.id.share_search_action) { // this action set for tab only mView.findViewById(R.id.share_company_btn).setEnabled(true); mView.findViewById(R.id.share_search_btn).setEnabled(true); v.setEnabled(false); mSharePersonContent.removeAllViews(); } try { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(searchEditText.getWindowToken(), 0); } catch (Exception e) { } switch (id) { case R.id.share_company_btn: isSearching = false; mView.findViewById(R.id.share_search_wrapper).setVisibility(View.GONE); orgView.displayAsFolder(mSharePersonContent); break; case R.id.share_search_btn: isSearching = true; mView.findViewById(R.id.share_search_wrapper).setVisibility(View.VISIBLE); handleSearchAction(false); break; case R.id.share_search_action: handleSearchAction(true); break; } } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.check_menu, menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_check: Intent resultIntent = new Intent(); resultIntent.putParcelableArrayListExtra(StaticsBundle.BUNDLE_LIST_PERSON, selectedPersonList); getActivity().setResult(Activity.RESULT_OK, resultIntent); getActivity().finish(); break; } return true; } private void handleSearchAction(boolean isCheckRequired) { String query = searchEditText.getText().toString().trim().toLowerCase(); mSharePersonContent.removeAllViews(); if (TextUtils.isEmpty(query.trim())) { // validate data if empty or not if (isCheckRequired) { searchEditText.setError(getString(R.string.search_field_empty)); searchEditText.requestFocus(); } } else { orgView.setDisplayType(1); orgView.displayMatchQuery(mSharePersonContent, query); } } private void unCheckParentData(PersonData personData) { if (mIsDisplaySelectedOnly) { PersonData needRemovePerson = null; for (PersonData selectedPerson : selectedPersonList) { if (personData.getType() == 2 && selectedPerson.getType() == 1 && selectedPerson.getDepartNo() == personData.getDepartNo()) { needRemovePerson = selectedPerson; break; } else if (personData.getType() == 1 && selectedPerson.getType() == 1 && selectedPerson.getDepartNo() == personData.getDepartmentParentNo()) { needRemovePerson = selectedPerson; break; } } if (needRemovePerson != null) { selectedPersonList.remove(needRemovePerson); if (needRemovePerson.getDepartmentParentNo() > 0) { unCheckParentData(needRemovePerson); } } } } @Override public void onOrganizationCheck(boolean isCheck, PersonData personData) { int indexOf = selectedPersonList.indexOf(personData); if (indexOf != -1) { if (!isCheck) { selectedPersonList.remove(indexOf); unCheckParentData(personData); } else { selectedPersonList.get(indexOf).setIsCheck(true); } } else { if (isCheck) { selectedPersonList.add(personData); } } if (!mIsDisplaySelectedOnly) { setSelectedPersonName(); } } private void setSelectedPersonName() { String shareString = ""; for (PersonData selectedPerson : selectedPersonList) { if (!TextUtils.isEmpty(shareString)) { shareString += "; "; } shareString += selectedPerson.getFullName(); } if (TextUtils.isEmpty(shareString)) { sharedPersonTv.setVisibility(View.GONE); } else { sharedPersonTv.setVisibility(View.VISIBLE); sharedPersonTv.setText(shareString); } } }
[ "mdt.tl09@gmail.com" ]
mdt.tl09@gmail.com
85419acebb16a23251036763adca4aa830b03bcd
4a25b2041f466ad85b23e5873c6bd1b71b309193
/idp-oidc-extension-impl/src/test/java/org/geant/idpextension/oidc/profile/spring/relyingparty/metadata/impl/ReloadProviderResolverServiceConfigurationTest.java
99b82df213f149089b33369e792e4e82f8b9e49a
[ "Apache-2.0" ]
permissive
CSCfi/shibboleth-idp-oidc-extension
622845297730481f837f3c0bb322305e3541d71b
5b83dbf5944b1d9fe1975e682f7d69cbad90900e
refs/heads/maint-1
2022-05-30T20:10:44.244401
2020-03-11T21:19:22
2020-03-11T21:19:22
87,392,130
45
5
Apache-2.0
2021-04-26T18:59:56
2017-04-06T06:04:25
Java
UTF-8
Java
false
false
5,270
java
/* * Copyright (c) 2017 - 2020, GÉANT * * 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.geant.idpextension.oidc.profile.spring.relyingparty.metadata.impl; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.geant.idpextension.oidc.metadata.impl.FilesystemProviderMetadataResolver; import org.geant.idpextension.oidc.metadata.resolver.ProviderMetadataResolver; import org.geant.idpextension.oidc.metadata.resolver.RefreshableProviderMetadataResolver; import org.geant.idpextension.oidc.metadata.resolver.ServiceableProviderMetadataProvider; import org.joda.time.DateTime; import org.opensaml.profile.context.ProfileRequestContext; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import net.shibboleth.ext.spring.service.ReloadableSpringService; import net.shibboleth.idp.profile.ActionTestingSupport; import net.shibboleth.idp.profile.RequestContextBuilder; import net.shibboleth.idp.profile.impl.ReloadServiceConfiguration; import net.shibboleth.utilities.java.support.component.ComponentInitializationException; import net.shibboleth.utilities.java.support.component.ComponentSupport; import net.shibboleth.utilities.java.support.service.ServiceException; import net.shibboleth.utilities.java.support.service.ServiceableComponent; /** * Unit tests for {@link ProviderMetadataResolverServiceStrategy}. * * Mostly based on <pre>net.shibboleth.idp.profile.spring.relyingparty.metadata.ReloadServiceConfigurationTest</pre>. */ public class ReloadProviderResolverServiceConfigurationTest { /** The service. */ private ReloadableSpringService<RefreshableProviderMetadataResolver> service; private RequestContext src; private List<Resource> oneResolver; @BeforeClass public void setup() throws IOException, ComponentInitializationException { service = new ReloadableSpringService(ProviderMetadataResolver.class, new ProviderMetadataResolverServiceStrategy()); service.setFailFast(true); service.setId("mockId"); oneResolver = new ArrayList<>(); oneResolver.add(new ClassPathResource("/org/geant/idpextension/oidc/metadata/impl/oidc-metadata-providers.xml")); service.setServiceConfigurations(oneResolver); } @BeforeMethod public void setUpAction() throws ComponentInitializationException { src = new RequestContextBuilder().buildRequestContext(); } @Test public void oneResource() { final DateTime time = service.getLastReloadAttemptInstant(); service.setServiceConfigurations(oneResolver); service.reload(); Assert.assertNotEquals(time, service.getLastReloadAttemptInstant()); final ServiceableComponent<RefreshableProviderMetadataResolver> component = service.getServiceableComponent(); final ProviderMetadataResolver resolver = component.getComponent(); component.unpinComponent(); Assert.assertTrue(resolver instanceof ServiceableProviderMetadataProvider); final ServiceableProviderMetadataProvider rpProvider = (ServiceableProviderMetadataProvider) resolver; final ProviderMetadataResolver embedded = rpProvider.getEmbeddedResolver(); Assert.assertTrue(embedded instanceof FilesystemProviderMetadataResolver); } @Test(expectedExceptions = ServiceException.class) public void noResources() throws ComponentInitializationException { service.setServiceConfigurations(new ArrayList<Resource>()); service.reload(); } @Test public void serviceAction() throws ComponentInitializationException { final DateTime time = service.getLastReloadAttemptInstant(); final MockHttpServletResponse response = new MockHttpServletResponse(); final ReloadServiceConfiguration action = ReloadClientResolverServiceConfigurationTest.initializeAction(service, response); final Event event = action.execute(src); ActionTestingSupport.assertProceedEvent(event); Assert.assertNotEquals(time, service.getLastReloadAttemptInstant()); Assert.assertEquals(response.getStatus(), HttpServletResponse.SC_OK); } @AfterClass public void teardown() { ComponentSupport.destroy(service); } }
[ "henri.mikkonen@iki.fi" ]
henri.mikkonen@iki.fi
565fdfe70c44bd250c540e27e68906e5f6f425e6
e78c4cd51b20cc0124f1b9fc2b52c017c69182a4
/msip-bhu-business-impl/msip_bhu_rpc_api/src/main/java/com/bhu/vas/api/dto/header/EventTrapDTO.java
55133099821a5c7797d3e9ae6339b36fd615b75b
[]
no_license
Major-Lee/my-first-company
b4e20181b55557c2b71de0aa81f4b706614c1565
7cbe95891d3da0df35a9cf5b3eb9a962da9b101d
refs/heads/master
2020-05-20T23:02:30.797281
2015-10-30T07:08:26
2015-10-30T07:08:26
84,528,374
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package com.bhu.vas.api.dto.header; import java.io.Serializable; import com.thoughtworks.xstream.annotations.XStreamAlias; @XStreamAlias("event") @SuppressWarnings("serial") public class EventTrapDTO implements Serializable{ @XStreamAlias("trap") private TrapDTO trapDTO; public TrapDTO getTrapDTO() { return trapDTO; } public void setTrapDTO(TrapDTO trapDTO) { this.trapDTO = trapDTO; } }
[ "56755166@qq.com" ]
56755166@qq.com