blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1493edb2997b197ad2378a2b577ab10ea579e825 | 42b334f4174322089ea0d9b009eac2a49b0f56f4 | /native-script/search/platforms/android/app/src/main/java/com/tns/gen/java/lang/Object_view_24_32_TouchListenerImpl.java | 8812ba1b48c819f513b38e7cb5072aea2f07ebf0 | [
"Apache-2.0"
] | permissive | gabirSanchezPerez/portafolioNextU | bd2854519323e87c8ba8303434b14feaf8ecedbc | 6364029271202c1cbacb227227d618a268d80889 | refs/heads/master | 2023-01-11T20:31:29.702292 | 2020-09-14T16:43:11 | 2020-09-14T16:43:11 | 98,830,810 | 1 | 0 | null | 2023-01-07T21:20:25 | 2017-07-30T23:31:46 | JavaScript | UTF-8 | Java | false | false | 901 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
* This class was automatically generated by the
* static binding generator from the resources it found.
* Please do not modify by hand.
*/
package com.tns.gen.java.lang;
public class Object_view_24_32_TouchListenerImpl extends java.lang.Object implements com.tns.NativeScriptHashCodeProvider, android.view.View.OnTouchListener {
public Object_view_24_32_TouchListenerImpl(){
super();
com.tns.Runtime.initInstance(this);
}
public boolean onTouch(android.view.View param_0, android.view.MotionEvent param_1) {
java.lang.Object[] args = new java.lang.Object[2];
args[0] = param_0;
args[1] = param_1;
return (boolean)com.tns.Runtime.callJSMethod(this, "onTouch", boolean.class, args);
}
public boolean equals__super(java.lang.Object other) {
return super.equals(other);
}
public int hashCode__super() {
return super.hashCode();
}
}
| [
"orgsoluciones@gmail.com"
] | orgsoluciones@gmail.com |
f6d848f7c017ec5115f74126e2ee0fd6dccc5836 | bfc2e69b66d73ab5e02d34b9ae41fd1891568384 | /app/src/main/java/com/fengniao/fnbluetooth/bluetooth/utils/AsciiToStr.java | da30ba4b45fdaf9ac7ff95bdd25831b3ae68a936 | [] | no_license | saki1010/fnble | 332fa78f994f5c41f474963046329dcf712f3523 | 5240f68a3f660b7c4edcd4f12e28dbb3486050ea | refs/heads/master | 2020-07-03T11:06:21.902692 | 2019-08-13T02:31:05 | 2019-08-13T02:31:05 | 201,887,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,072 | java | package com.fengniao.fnbluetooth.bluetooth.utils;
/**
* Created by kim on 09/03/2018.
*/
public class AsciiToStr {
public static String asciiToString(String value)
{
StringBuffer sbu = new StringBuffer();
String[] chars = value.split(" ");
for (int i = 0; i < chars.length; i++) {
sbu.append((char) Integer.parseInt(chars[i],16));
}
return sbu.toString();
}
public static String stringToAscii(String value)
{
byte[] b= value.getBytes();
StringBuffer sb = new StringBuffer();
for(int i=0;i<b.length;i++){
sb.append(Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
}
public static String asciiToString2Nums(String value)
{
StringBuffer sbu = new StringBuffer();
String[] chars = value.split(" ");
for (int i = 0; i < chars.length; i=i+2) {
sbu.append((char) Integer.parseInt(value.substring(i,i+2),16));
}
return sbu.toString();
}
}
| [
"274110133@qq.com"
] | 274110133@qq.com |
e772a4837caa6c94b33662f3396260a8a09560be | 39bbbd6dec129cb98e295b1fa99203811cfdeaa7 | /plugins/kotlin/code-insight/inspections-shared/tests/k1/test/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SharedK1InspectionTestGenerated.java | ef1290f516b61eaf48cb8db5a7dbf70246d2f200 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | EsolMio/intellij-community | 7b9b808c914c683a1aa90ea10691700761e50157 | 4eb05cb6127f4dd6cbc09814b76b80eced9e4262 | refs/heads/master | 2022-08-21T05:39:13.256969 | 2022-08-11T11:53:18 | 2022-08-14T13:20:04 | 169,598,741 | 0 | 0 | Apache-2.0 | 2019-02-07T16:00:25 | 2019-02-07T16:00:25 | null | UTF-8 | Java | false | false | 1,768 | java | // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.codeInsight.intentions.shared;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.idea.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.idea.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.jetbrains.kotlin.idea.test.TestRoot;
import org.junit.runner.RunWith;
/**
* This class is generated by {@link org.jetbrains.kotlin.testGenerator.generator.TestGenerator}.
* DO NOT MODIFY MANUALLY.
*/
@SuppressWarnings("all")
@TestRoot("code-insight/inspections-shared/tests/k1")
@TestDataPath("$CONTENT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../testData/inspections")
public abstract class SharedK1InspectionTestGenerated extends AbstractSharedK1InspectionTest {
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../testData/inspections/dataClassPrivateConstructor")
public abstract static class DataClassPrivateConstructor extends AbstractSharedK1InspectionTest {
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../testData/inspections/dataClassPrivateConstructor/inspectionData")
public static class InspectionData extends AbstractSharedK1InspectionTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("inspections.test")
public void testInspections_test() throws Exception {
runTest("../testData/inspections/dataClassPrivateConstructor/inspectionData/inspections.test");
}
}
}
}
| [
"intellij-monorepo-bot-no-reply@jetbrains.com"
] | intellij-monorepo-bot-no-reply@jetbrains.com |
8ed07af292e7e0abc39c224f7b1f5839c7acc2f3 | dca17ea5409f53b6d23ee813d4cfee0942475337 | /core/src/com/mweis/pathfinder/game/world/DungeonFactoryOld.java | 94be0d014194f1df1b4adc93cc1c4338247e54b3 | [] | no_license | matthewweis/Pathfinder | 33bac0759abebebd10dece7607a02699864c6883 | f8ef113bfbf2ebd1b6b9422a21678654af4c5064 | refs/heads/master | 2022-02-01T13:00:39.100511 | 2017-03-23T23:52:39 | 2017-03-23T23:52:39 | 76,744,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,245 | java | package com.mweis.pathfinder.game.world;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Random;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
/*
* http://www.gamasutra.com/blogs/AAdonaac/20150903/252889/Procedural_Dungeon_Generation_Algorithm.php
* https://www.reddit.com/r/gamedev/comments/1dlwc4/procedural_dungeon_generation_algorithm_explained/
* http://tinykeep.com/dungen/
*/
class DungeonFactoryOld {
public static void generateDungeon(int cells, float radius) {
for (Vector2 v : getRandomPointsInCircle(cells, radius)) {
System.out.println(v.toString());
}
}
public static Vector2[] getRandomPointsInCircle(int numPoints, float radius) {
Random random = new Random();
Vector2[] points = new Vector2[numPoints];
for (int i=0; i < numPoints; i++) {
float t = (float) (2 * Math.PI * random.nextFloat());
float u = (float) (random.nextFloat() + random.nextFloat());
float r = u > 1.0f ? 2.0f - u : u;
points[i] = new Vector2(radius*r*(float)Math.cos(t), radius*r*(float)Math.sin(t));
}
return points;
}
/*
* min is min width/height a rectangle can be
* max is max width/height a rectangle can be
*/
public static Rectangle[] makeRectanglesAroundPoints(Vector2[] points, float min, float max) {
Random random = new Random();
Rectangle[] rectangles = new Rectangle[points.length];
for (int i=0; i < points.length; i++) {
float r1 = random.nextFloat();//(float) Math.sqrt(1 - random.nextFloat());
float r2 = random.nextFloat();//(float) Math.sqrt(random.nextFloat());
float width = min + r1 * (max - min);
float height = min + r2 * (max - min);
// apply no required room ratio at this point in time
rectangles[i] = new Rectangle(points[i].x - width/2, points[i].y - height/2, width, height);
}
return rectangles;
}
/*
* runtime will be horrible, but this only needs to be run once per level gen
*/
public static boolean steerAwayOverlappingRectangles(Rectangle[] r) {
Arrays.sort(r, new Comparator<Rectangle>() {
/*
* Sort rectangles w.r.t their Y (low to high) so they never need to go down.
*/
@Override
public int compare(Rectangle r1, Rectangle r2) {
if (r1.getY() < r2.getY()) {
return 1;
} else if (r1.getY() > r2.getY()) {
return -1;
} else {
return 0;
}
}
});
boolean overlap = false;
// while (overlap) {
// overlap = false;
for (int i=0; i < r.length; i++) {
for (int j=0; j < r.length; j++) { // could reduce range of j
if (i == j) continue;
if (r[i].overlaps(r[j])) {
overlap = true;
// float left = r[i].x + r[i].width - r[j].x;
float right = r[j].x + r[j].width - r[i].x;
float up = r[i].y + r[i].height - r[j].y;
// float down = r[j].y + r[j].height - r[i].y;
// move my minimum amount (which also maximized overlap!)
// float min = Math.min(left, Math.min(right, Math.min(up, down)));
// float min = Math.min(left, Math.min(right, up));
float min = Math.min(right, up);
// if (left == min) {
// r[j].setX(r[i].x - r[j].width);
/*} else */if (right == min) {
r[j].setX(r[i].x + r[i].width);
} else if (up == min) {
r[j].setY(r[i].y + r[i].height);
// } else if (down == min) {
// r[j].setY(r[i].y - r[j].height);
} else { // FOR TESTING ONLY
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
// }
return overlap;
}
/*
* http://fisherevans.com/blog/post/dungeon-generation
*/
public static boolean seperateRooms(Rectangle[] rooms) {
float padding = 0.0f;
float dx, dxa, dxb, dy, dya, dyb; // delta values of overlap
boolean overlap = true;
// while (overlap) {
overlap = false;
for (int i=0; i < rooms.length; i++) {
Rectangle a = rooms[i];
for (int j=i+1; j < rooms.length; j++) { // ! if problem check iter vals of j
Rectangle b = rooms[j];
// Rectangle b_padded = new Rectangle(b);
// b_padded.set(b.x+padding, b.y+padding, b.width-(2*padding), b.height-(2*padding));
if (a.overlaps(b)) {
System.out.println(a + " overlaps " + b);
// overlap = true;
// find 2 smallest deltas required to stop the overlap
dx = Math.min((a.x+a.width)-b.x+padding, a.x-(b.x+b.width)-padding);
dy = Math.min(a.y-(b.y+b.height)+padding, (a.y+a.height)-b.y-padding);
// only keep the smallest delta
if (Math.abs(dx) < Math.abs(dy)) {
dy = 0;
} else {
dx = 0;
}
// create a delta for each rect as half of the whole delta
dxa = -dx/2;
dxb = dx+dxa;
dya = -dy/2;
dyb = dy+dya;
// shift both rectangles
a.setPosition(a.x+dxa, a.y+dya);
b.setPosition(b.x+dxb, b.y+dyb);
if (Math.max(Math.abs(dx), Math.abs(dy)) > 1E-3){
overlap = true;
}
// overlap = true;
// System.out.println(Math.max(Math.abs(dx), Math.abs(dy)));
// System.out.println(b.toString());
}
}
}
// }
return overlap;
}
private DungeonFactoryOld() { }; // factories need no instantiation
}
| [
"matthewweiscaps@gmail.com"
] | matthewweiscaps@gmail.com |
d8d0ebdbd3032943de38a98117d403d9a4955130 | a006be286d4482aecf4021f62edd8dd9bb600040 | /src/main/java/com/alipay/api/response/KoubeiAdvertDeliveryDiscountBatchqueryResponse.java | 7bd6fb09947c38e1868f7224710d01fec150f7cc | [] | no_license | zero-java/alipay-sdk | 16e520fbd69974f7a7491919909b24be9278f1b1 | aac34d987a424497d8e8b1fd67b19546a6742132 | refs/heads/master | 2021-07-19T12:34:20.765988 | 2017-12-13T07:43:24 | 2017-12-13T07:43:24 | 96,759,166 | 0 | 0 | null | 2017-07-25T02:02:45 | 2017-07-10T09:20:13 | Java | UTF-8 | Java | false | false | 857 | java | package com.alipay.api.response;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.AdvertDiscount;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: koubei.advert.delivery.discount.batchquery response.
*
* @author auto create
* @since 1.0, 2017-01-06 11:34:09
*/
public class KoubeiAdvertDeliveryDiscountBatchqueryResponse extends AlipayResponse {
private static final long serialVersionUID = 8793626734928177422L;
/**
* 广告投放出去的商品信息
*/
@ApiListField("discounts")
@ApiField("advert_discount")
private List<AdvertDiscount> discounts;
public void setDiscounts(List<AdvertDiscount> discounts) {
this.discounts = discounts;
}
public List<AdvertDiscount> getDiscounts( ) {
return this.discounts;
}
}
| [
"443683059a"
] | 443683059a |
bf618896e444c82f074e93d01c674db300abfe79 | 13ccdfa593a4decdf50949496f1bea8097c05f92 | /src/main/java/com/sktelecom/swingmsa/mcatalog/context/base/application/ShareRestController.java | c2030f7d47acadda12b1c4cb926b9e97a0049155 | [] | no_license | silverte/share | 82db70da2571ed14005ca5c14b8dbc7cb5829585 | db9dee1ccb2d2416afeb5be57eea6175eb4d14b3 | refs/heads/master | 2023-03-15T22:06:00.471875 | 2021-03-09T13:38:16 | 2021-03-09T13:38:16 | 346,018,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,081 | java | package com.sktelecom.swingmsa.mcatalog.context.base.application;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sktelecom.swingmsa.mcatalog.context.base.enums.EnumValue;
import com.sktelecom.swingmsa.mcatalog.context.base.exception.BizException;
import com.sktelecom.swingmsa.mcatalog.context.mapper.EnumMapper;
@RestController
@RequestMapping("/api/v1")
public class ShareRestController {
@Autowired
private EnumMapper enumMapper;
@PostMapping("/enumListAll")
public Map<String, Object> getAllEnums(@RequestBody Map<String, Object> params) {
Map<String, Object> result = new HashMap<>();
Map<String, String> message = new HashMap<>();
try {
Map<String, List<EnumValue>> enumList = enumMapper.getAllEnum();
result.put("output1", enumList);
message.put("code", "0");
message.put("message", "정상 처리되었습니다.");
result.put("error", message);
} catch(Exception e) {
throw new BizException(e);
}
return result;
}
@PostMapping("/enumList")
@SuppressWarnings("unchecked")
public Map<String, Object> getEnum(@RequestBody Map<String, Object> params) {
Map<String, Object> result = new HashMap<>();
Map<String, String> message = new HashMap<>();
try {
Map<String, Object> input1 = (Map<String, Object>) params.get("input1");
String colNm = input1.get("colNm").toString();
Map<String, List<EnumValue>> enumList = enumMapper.getEnum(colNm);
result.put("output1", enumList);
message.put("code", "0");
message.put("message", "정상 처리되었습니다.");
result.put("error", message);
} catch(Exception e) {
throw new BizException(e);
}
return result;
}
}
| [
"silverte@sk.com"
] | silverte@sk.com |
19f16aa8c4e8f8c56424f11343b9845eab02daf2 | 6d3feeb6916fd2a3ead25fdd413e48c744bcb4b3 | /Bogart_Garrett_hw2/Communicator (java)/message/RaceMessage.java | 91f8703cf975fb18d1aab201d65a83c76149fa39 | [] | no_license | Garrett-Bogart/Object-Oriented | ead38acf7c560fbec8127d5e0be3b88d1e4acde1 | 7085d46033cd719ff84a5f380ee7ca5255f4adb9 | refs/heads/master | 2020-03-27T20:07:05.788883 | 2018-12-06T17:39:17 | 2018-12-06T17:39:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,676 | java | package message;
import java.net.InetAddress;
import athlete.Athlete;
import athlete.AthleteTracker;
import athlete.Race;
import behaviors.AthleteEvents;
import behaviors.AthleteNone;
import behaviors.ClientEvents;
import behaviors.ClientNone;
import behaviors.NotifyAll;
import behaviors.NotifyEvents;
import behaviors.RaceChange;
import behaviors.RaceEvents;
import communicator.RaceTracker;
public class RaceMessage extends Message {
public RaceMessage()
{
this.raceEvents = new RaceChange();
this.notifyEvents = new NotifyAll();
this.athleteEvents = new AthleteNone();
this.clientEvents = new ClientNone();
}
public void execute(String message, Race race, AthleteTracker athleteTracker, Athlete athlete, InetAddress ip, int port) throws Exception
{
raceEvents.raceExecute(race, message);
athleteEvents.athleteExecute(athleteTracker, athlete, ip, port);
clientEvents.clientExecute(athleteTracker, message, ip, port);//may need to add client to observer list in athletes
notifyEvents.notifyExecute(message, race, ip, port,athlete, athleteTracker);
}
public RaceEvents getRaceEvents() {return raceEvents;}
public NotifyEvents getNotifyEvents() {return notifyEvents;}
public AthleteEvents getAthleteEvents() {return athleteEvents;}
public ClientEvents getClientEvents() {return clientEvents;}
public void setNotifyEvents(NotifyEvents event) {this.notifyEvents = event;}
public void setAthleteEvents(AthleteEvents event) {this.athleteEvents = event;}
public void setClientEvents(ClientEvents event){this.clientEvents = event;}
public void setRaceEvent(RaceEvents event) {raceEvents = event;}
}
| [
"bogartgarrett@gmail.com"
] | bogartgarrett@gmail.com |
d6e8cdac1569977e12fab1c9245fcc41ef66834f | b76dc0b673a104a8f4c5dec219755083aeeba8eb | /src/assignment_two/ASTFunctionCall.java | aa4fd4fa945a0290adc30633b7fb1121bcbd0994 | [] | no_license | CONeill91/Compilers_CA4003 | ea51e6e86979c4b5af0e5608a264934e4a629294 | d080eb4d159e543f86ac645c7f3b636b17bac420 | refs/heads/master | 2016-09-01T03:55:33.193332 | 2016-01-25T13:46:47 | 2016-01-25T13:46:47 | 50,353,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 693 | java | package assignment_two;
/* Generated By:JJTree: Do not edit this line. ASTFunctionCall.java Version 6.0 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
public
class ASTFunctionCall extends SimpleNode {
public ASTFunctionCall(int id) {
super(id);
}
public ASTFunctionCall(BasicLParser p, int id) {
super(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(BasicLParserVisitor visitor, Object data) {
return
visitor.visit(this, data);
}
}
/* JavaCC - OriginalChecksum=e743c8d3c8138e08bcbc5fb7077f9e04 (do not edit this line) */
| [
"conor.oneill63@mail.dcu.ie"
] | conor.oneill63@mail.dcu.ie |
3e94b79219034c4acfc2553211d8274e31991f3c | a36e95ec2e110536434750d897cd76e0d6a1f90f | /fkbookapp/src/main/java/com/example/fkbookapp/mapper/BookMapper.java | a3105ccb105aef1b0d6bb5de3beeea7bbbbe406a | [] | no_license | jinhm007/fkbookapp | f700266765bd3c8796ceda3e462e39e5c8e2472f | 3b3cf3c649ecab755aab2873fa5671530295cd37 | refs/heads/master | 2020-04-10T12:29:16.368050 | 2018-12-09T10:02:25 | 2018-12-09T10:02:25 | 161,024,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.example.fkbookapp.mapper;
import com.example.fkbookapp.model.Book;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface BookMapper {
List<Book> findAll();
int addBookInfo(Book user);
int delBookInfo(int id);
int updateBookInfo(Book user);
}
| [
"jinhongmei@lxwdeMacBook-Pro.local"
] | jinhongmei@lxwdeMacBook-Pro.local |
78a38de43c06ffd1eee2cb305acaf81d0b95a99d | d56601361edb5361ee8741fc11a889c73aca9721 | /app/src/main/java/com/hrptech/expensemanager/db/LockDB.java | 82788f5ab09dde3a75e849aee5ae55d102150451 | [
"Apache-2.0"
] | permissive | farazkhokhar1981/expensemanager | 9c1e374c663879d1e7cd69006d6dbdc4d461e5cd | e57f75951f5c700c4c101f5d5c0dcd8753ffc95c | refs/heads/main | 2023-04-03T00:22:15.139247 | 2021-04-06T09:31:50 | 2021-04-06T09:31:50 | 337,370,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,929 | java | package com.hrptech.expensemanager.db;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.widget.Toast;
import com.hrptech.expensemanager.beans.LockBeans;
import com.hrptech.expensemanager.utility.Utilities;
public class LockDB {
DataBaseManager managerDB = null;
private SQLiteDatabase mydb;
Activity myActivity;
public LockDB(Activity myActivity){
managerDB = new DataBaseManager(myActivity);
mydb = managerDB.getDatabaseInit();
this.myActivity = myActivity;
createTable();
}
public void createTable() {
try {
mydb = managerDB.getDatabaseInit();
mydb.execSQL("CREATE TABLE IF NOT EXISTS " + Utilities.lock_tbl + " ("+Utilities.lock_password+" text,"+Utilities.lock_question+" text" +
","+Utilities.lock_answer+" text,"+Utilities.lock_password_hint+" text,"+Utilities.lock_contact+" text)");
mydb.close();
} catch (Exception e) {
Toast.makeText(myActivity, "Error in creating table", Toast.LENGTH_LONG);
}
}
public void UpdatePassword(String password) {
try {
mydb = managerDB.getDatabaseInit();
mydb.execSQL("UPDATE " + Utilities.lock_tbl + " set "+Utilities.lock_password+"='"+password+"'");
mydb.close();
} catch (Exception e) {
Toast.makeText(myActivity, "Error in inserting into table", Toast.LENGTH_LONG);
}
}
public int InsertRecord(String password, String question, String answer, String passwordHint, String lockContact) {
try {
mydb = managerDB.getDatabaseInit();
mydb.execSQL("INSERT INTO " + Utilities.lock_tbl + "("+Utilities.lock_password+","+Utilities.lock_question+","+Utilities.lock_answer+","+Utilities.lock_password_hint+","+Utilities.lock_contact+")VALUES('"+password+"'," +
"'"+question+"','"+answer+"','"+passwordHint+"','"+lockContact+"')");
mydb.close();
return 1;
} catch (Exception e) {
Toast.makeText(myActivity, "Error in inserting into table", Toast.LENGTH_LONG);
}
return 0;
}
public void DeleteRecord() {
try {
mydb = managerDB.getDatabaseInit();
mydb.execSQL("DELETE FROM " + Utilities.lock_tbl);
mydb.close();
} catch (Exception e) {
Toast.makeText(myActivity, "Error in inserting into table", Toast.LENGTH_LONG);
}
}
public LockBeans getLock(){
LockBeans bean=null;
try {
mydb = managerDB.getDatabaseInit();
Cursor allrows = mydb.rawQuery("SELECT * FROM " + Utilities.lock_tbl, null);
if (allrows.moveToNext()) {
bean=new LockBeans();
String password=allrows.getString(allrows.getColumnIndex(Utilities.lock_password));
String question=allrows.getString(allrows.getColumnIndex(Utilities.lock_question));
String answer=allrows.getString(allrows.getColumnIndex(Utilities.lock_answer));
String passwordHint=allrows.getString(allrows.getColumnIndex(Utilities.lock_password_hint));
String contact=allrows.getString(allrows.getColumnIndex(Utilities.lock_contact));
bean.setLock_password(password);
bean.setLock_question(question);
bean.setLock_password_hint(passwordHint);
bean.setLock_contact(contact);
}
mydb.close();
} catch (Exception e) {
e.printStackTrace();
}
return bean;
}
public LockBeans loginAuthentication(String password){
LockBeans bean=null;
try {
mydb = managerDB.getDatabaseInit();
Cursor allrows = mydb.rawQuery("SELECT * FROM " + Utilities.lock_tbl+" where "+Utilities.lock_password+"='"+password+"'", null);
if (allrows.moveToNext()) {
bean=new LockBeans();
String passwords=allrows.getString(allrows.getColumnIndex(Utilities.lock_password));
String question=allrows.getString(allrows.getColumnIndex(Utilities.lock_question));
String answer=allrows.getString(allrows.getColumnIndex(Utilities.lock_answer));
String passwordHint=allrows.getString(allrows.getColumnIndex(Utilities.lock_password_hint));
String contact=allrows.getString(allrows.getColumnIndex(Utilities.lock_contact));
bean.setLock_password(passwords);
bean.setLock_question(question);
bean.setLock_password_hint(passwordHint);
bean.setLock_contact(contact);
}
mydb.close();
} catch (Exception e) {
e.printStackTrace();
}
return bean;
}
}
| [
"75515965+farazkhokhar1981@users.noreply.github.com"
] | 75515965+farazkhokhar1981@users.noreply.github.com |
be916725f7144a2f6a709e8cc9e87e04cbec736d | 49e0a10fa526b3488914ded350cd3b16cd97a414 | /src/main/java/x/org/objectweb/asm/tree/FrameNode.java | 82e576c0c13a2595ec8bf2cdbd8197f47e78e3ec | [] | no_license | kovacsi/bind_asm_all_5_1 | e50a7cd09889fad6a77ec007fd5ff14428ba3905 | 90b63b73b2b6246c1485b6f345d9d42957dc46d5 | refs/heads/master | 2020-12-24T20:52:12.866091 | 2016-06-01T15:33:24 | 2016-06-01T15:33:24 | 59,653,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,411 | java | package x.org.objectweb.asm.tree;
import com.intel.moe.natj.general.Pointer;
import com.intel.moe.natj.general.ann.Owned;
import com.intel.moe.natj.general.ann.RegisterOnStartup;
import com.intel.moe.natj.objc.ObjCRuntime;
import com.intel.moe.natj.objc.ann.ObjCClassName;
import com.intel.moe.natj.objc.ann.Selector;
import ios.NSObject;
@ObjCClassName("JBFrameNode")
@RegisterOnStartup
@com.intel.moe.natj.general.ann.Runtime(ObjCRuntime.class)
public class FrameNode extends NSObject {
public org.objectweb.asm.tree.FrameNode original;
protected FrameNode(Pointer peer) {
super(peer);
}
@Owned
@Selector("alloc")
public static native FrameNode alloc();
@Selector("valueWithInt:withInt:withObject:withInt:withObject:")
public FrameNode valueWithIntwithIntwithObjectwithIntwithObject(int arg0, int arg1, Object[] arg2, int arg3, Object[] arg4) {
FrameNode self = (FrameNode) FrameNode.alloc().init();
self.original = new org.objectweb.asm.tree.FrameNode(arg0, arg1, arg2, arg3, arg4);
return self;
}
@Selector("getType")
public int getType() {
return original.getType();
}
@Selector("acceptWithMethodVisitor:")
public void acceptWithMethodVisitor(Object arg0) {
original.accept((org.objectweb.asm.MethodVisitor) arg0);
}
@Selector("cloneWithMap:")
public Object cloneWithMap(java.util.Map arg0) {
return original.clone(arg0);
}
}
| [
"istvan.kovacs@mattakis.com"
] | istvan.kovacs@mattakis.com |
b851521fd7eb783712fa2450a45df1d35c00fd49 | 2b72e34b3c2322154f0c9e04f40bc05b5a54711b | /src/main/java/com/wc/user/bean/Community.java | a1cbbf33c3a9047fe21e6474b737e63b92116908 | [] | no_license | wch888/wc-service | e50b1c996e7a3ab073d3f6a49f650b8aab26b8dc | dce803a0bd1c23380fea813f77738c36930c448a | refs/heads/master | 2020-04-06T06:55:31.508781 | 2016-08-30T13:29:07 | 2016-08-30T13:29:07 | 63,469,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,471 | java | package com.wc.user.bean;
import java.util.Date;
public class Community {
private Long id;
private String name;
private Long cityId;
private Date createTime;
private Long provinceId;
private Long areaId;
private Long communityId;
private String phone;
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Long getCommunityId() {
return communityId;
}
public void setCommunityId(Long communityId) {
this.communityId = communityId;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Long getCityId() {
return cityId;
}
public void setCityId(Long cityId) {
this.cityId = cityId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public Long getAreaId() {
return areaId;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
} | [
"flamezyg@qq.com"
] | flamezyg@qq.com |
1cdf5040bff7236193c597c14f0e694a23876e7e | 84bd8e03b6db4c0e5ae76680f0ee1199b6da847e | /AddressBook/model/Address.java | 5a6a34bdf93828cc42db843a2a6010e034847a99 | [] | no_license | sibani97/addressbook | 1bd13557b95931952d90b322f365acb06552b7e1 | be31e3643c1813f1701a457df7c7e6132b549e83 | refs/heads/master | 2020-04-28T05:06:19.306510 | 2019-03-11T13:51:30 | 2019-03-11T13:51:30 | 175,007,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.bridgelabz.AddressBook.model;
public class Address {
String city;
String state;
long zip;
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public long getZip() {
return zip;
}
public void setZip(long zip) {
this.zip = zip;
}
}
| [
"sibani.iem19@gmail.com"
] | sibani.iem19@gmail.com |
a71041c523f475c4f7368b84cadf37cc9afa661b | 6b4e7c0079f6e5656a30eca7957ce846268301f8 | /myjson/src/main/java/com/uniquedu/myjson/Clazz.java | 47e220a29f2f270ba7659a924d33cf0223a30bfd | [] | no_license | zhonghangIT/MyXML | 1318fd479030f7e4e1b56e4f9961bea812fac097 | f33736a8d549cf8b384b3c61dec66c9c5455cc59 | refs/heads/master | 2021-01-10T01:44:14.139700 | 2016-03-22T21:31:37 | 2016-03-22T21:31:37 | 54,392,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,146 | java | package com.uniquedu.myjson;
import java.util.List;
/**
* Created by ZhongHang on 2016/3/23.
*/
public class Clazz {
private String clazzName;
private String clazzNum;
private Teacher teacher;
public Clazz() {
}
public Clazz(String clazzName, String clazzNum, Teacher teacher, List<Student> students) {
this.clazzName = clazzName;
this.clazzNum = clazzNum;
this.teacher = teacher;
this.students = students;
}
public String getClazzName() {
return clazzName;
}
public void setClazzName(String clazzName) {
this.clazzName = clazzName;
}
public String getClazzNum() {
return clazzNum;
}
public void setClazzNum(String clazzNum) {
this.clazzNum = clazzNum;
}
public Teacher getTeacher() {
return teacher;
}
public void setTeacher(Teacher teacher) {
this.teacher = teacher;
}
public List<Student> getStudents() {
return students;
}
public void setStudents(List<Student> students) {
this.students = students;
}
private List<Student> students;
}
| [
"zhonghangIT@163.com"
] | zhonghangIT@163.com |
6612faca01c8d032edadbed90e2cd9c4c127daff | 97fca30f194bcff627e87cd235494f37e89d3051 | /src/net/swordwind/android/graphic/colorart/package-info.java | 85895f70e92f373d2cbbffbdfa010ad1e9f7b1be | [] | no_license | redzealot2008/SwordSDK | 5912b06f1a2be77e54f9d5418ba2810c8f13d4a8 | 5eeb261e1af432cdb20d4bff07e1ed6c1d75a3b3 | refs/heads/master | 2020-05-18T17:07:07.362582 | 2014-03-21T08:04:12 | 2014-03-21T08:04:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 102 | java | /**
*
*/
/**
* @author Administrator
*
*/
package net.swordwind.android.graphic.colorart; | [
"redzealot2010@163.com"
] | redzealot2010@163.com |
b9a1f9ef70bc140be9cba37ef9d1b2fdb804e824 | 065ce6d325826c74f24e6236725b26e40c7de150 | /src/test/java/jmq/Test.java | a799e3c2f4ef3ac1e225c0420f6f6c1b75d8227b | [] | no_license | softliumin/Hubble | 0f6d09aba78a294b744edb803e3d016c2b1f67d5 | 7a8dd422d90649858ef0780fe7148b42d2fe01e8 | refs/heads/master | 2020-12-31T04:29:16.569526 | 2016-01-23T12:44:11 | 2016-01-23T12:44:11 | 48,107,074 | 0 | 0 | null | 2016-01-23T12:44:11 | 2015-12-16T11:43:16 | Java | UTF-8 | Java | false | false | 1,347 | java | package jmq;
import org.junit.Before;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;
import redis.clients.jedis.Transaction;
import java.io.IOException;
import java.util.List;
/**
* Created by liumin3 on 2016/1/12.
*/
public class Test
{
@Before
public void setUp() throws IOException
{
Jedis jedis = new Jedis("www.demo.cc");
jedis.auth("liumin110");
jedis.flushAll();
jedis.disconnect();
}
@org.junit.Test
public void test1()
{
Jedis jedis = new Jedis("www.demo.cc");
jedis.auth("liumin110");
jedis.set("11","11");
jedis.disconnect();
}
@org.junit.Test
public void test2()
{
Jedis jedis = new Jedis("www.demo.cc");
jedis.auth("liumin110");
Transaction tx = jedis.multi();
for (int x=0;x<100;x++)
{
tx.set(x+"",x+"");
}
tx.exec();
jedis.disconnect();
}
@org.junit.Test
public void test3()
{
Jedis jedis = new Jedis("www.demo.cc");
jedis.auth("liumin110");
Pipeline pipeline = jedis.pipelined();
for (int x=0;x<100;x++)
{
pipeline.set(x+"",x+"");
}
List<Object> results = pipeline.syncAndReturnAll();
jedis.disconnect();
}
}
| [
"softliumin@gmail.com"
] | softliumin@gmail.com |
661fab144514cff1b3be0fe28a2af45d08b3f2f1 | 1285ee838dcc642055171c5facacd617532326c1 | /BridgelabzProgramms/src/org/bridgelabz/algorithms/BinaryConversion.java | b852c00cc891d3b60f80516f8b1a77bab7ca2939 | [] | no_license | chandrakishore314/Algorithms | 89d9b4ff596881f277fcbd75f76af4efd7cde9fb | 52334c62c3f7572f2d609de8fe80cb60c053cb23 | refs/heads/master | 2023-04-04T03:47:47.121427 | 2021-03-29T09:04:16 | 2021-03-29T09:04:16 | 197,759,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package org.bridgelabz.algorithms;
import org.bridgelabz.programms.utility.InputScanner;
import org.bridgelabz.programms.utility.Utility;
/**
* @author Chandra Kishore
**/
public class BinaryConversion {
public static void main(String[] args) {
System.out.println("Enter number");
int num = InputScanner.getInt();
int[] binaryArray = Utility.toBinary(num);
System.out.println("binary num as");
for (int j = 7; j >= 0; j--) {
System.out.print(binaryArray[j]);
}
System.out.println("\n\nnumber after swap" + Utility.swap(binaryArray));
}
}
| [
"chandrakishore314@gmail.com"
] | chandrakishore314@gmail.com |
a7ec12bc8a26eb9917c2c61e7c12c96a01bc6e0f | 077093ef19054bdefa69e28fc606cfb4aabc2beb | /weixin/src/main/java/com/b505/weixin/pojo/CommonButton.java | 19e794d250293e335dd1088f4822af5dec7c904b | [] | no_license | shanhelin/allweb | beaf149bf6869cb2773f533ce4f9f0eaf53e30c3 | 64f1042de716bb7cb6c2dae82d457f5f3e0e2be5 | refs/heads/master | 2022-02-18T12:13:57.692027 | 2020-02-21T04:40:49 | 2020-02-21T04:40:49 | 226,646,372 | 6 | 0 | null | 2022-02-01T01:00:34 | 2019-12-08T09:56:56 | Java | UTF-8 | Java | false | false | 1,276 | java | package com.b505.weixin.pojo;
/**
* <p>B505信息科学研究所</p>
* @Description 普通按钮设置
* @Creat date 2018-7-20 8:35
* @author yulin
*/
public class CommonButton extends Button
{
private String type;
private String key;
private String url;
//media_id类型和view_limited类型必须 调用新增永久素材接口返回的合法media_id
private String media_id;
//miniprogram类型必须 小程序的appid(仅认证公众号可配置)
private String appid ;
private String pagepath;
public String getPagepath()
{
return pagepath;
}
public void setPagepath(String pagepath)
{
this.pagepath = pagepath;
}
public String getMedia_id()
{
return media_id;
}
public void setMedia_id(String media_id)
{
this.media_id = media_id;
}
public String getAppid()
{
return appid;
}
public void setAppid(String appid)
{
this.appid = appid;
}
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;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
| [
"2376539013@qq.com"
] | 2376539013@qq.com |
200e799205f3e31d837b1fc0db184df0bc5a8334 | 80c78fdd48da8dc93272055dd23987a2f7dcddd1 | /src/main/java/com/capgemini/coins/Coins.java | bf6102c77df35789dca6ae5d851cfaaf465b8668 | [] | no_license | tom7c3/javaExercises | c56ca8a68bd5220d35f70af53912155a0ca8eb28 | 0850d19b620ee27cc7ee15f4079ed90a46695b04 | refs/heads/master | 2021-01-20T10:42:19.573317 | 2015-05-15T06:31:10 | 2015-05-15T06:31:10 | 35,266,605 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,659 | java | package com.capgemini.coins;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
/**
* Created by ldrygala on 2015-02-06.
* <p/>
* Consider N coins aligned in a row. Each coin is showing either heads or tails. The adjacency of these coins is the number of adjacent pairs of coins with the same side facing up.
* <p/>
* It must return the maximum possible adjacency that can be obtained by reversing exactly one coin (that is, one of the coins must be reversed). Consecutive elements of array A represent consecutive coins in the row. Array A contains only 0s and/or 1s: 0 represents a coin with heads facing up; 1 represents a coin with tails facing up. For example, given array A consisting of six numbers, such that:
* <p/>
* A[0] = 1
* A[1] = 1
* A[2] = 0
* A[3] = 1
* A[4] = 0
* A[5] = 0
* <p/>
* the function should return 4. The initial adjacency is 2, as there are two pairs of adjacent coins with the same side facing up, namely (0, 1) and (4, 5). After reversing the coin represented by A[2], the adjacency equals 4, as there are four pairs of adjacent coins with the same side facing up, namely: (0, 1), (1, 2), (2, 3) and (4, 5), and it is not possible to obtain a higher adjacency. The same adjacency can be obtained by reversing the coin represented by A[3].
*/
public class Coins
{
public static int solution(List<Integer> coins)
{
int amount = 0;
for ( int i = 1; i < coins.size(); ++i )
{
if ( coins.get(i) == coins.get(i - 1) )
{
++amount;
}
}
return amount;
}
public static int findSolution(List<Integer> list )
{
int max = 0;
int value = 0;
for ( int i = 0; i < list.size(); ++i )
{
if ( list.get(i) == 0 )
list.set(i, 1);
else if ( list.get(i) == 1)
list.set(i, 0);
else
return -1;
value = solution(list);
if ( value > max )
max = value;
// for ( int j = 0; j < list.size(); ++j )
// {
// System.out.print( list.get(j) );
// }
//
// System.out.print( " : " + value + '\n' );
if ( list.get(i) == 0 )
list.set(i, 1);
else if ( list.get(i) == 1 )
list.set(i, 0);
else
return -1;
}
return max;
}
public static void main(String[] args)
{
List<Integer> list = new ArrayList<Integer>(Arrays.asList(1,1,0,1,0,0));
System.out.println( findSolution(list) );
}
@Test
public void shouldReturn0()
{
assertEquals(0, findSolution( new ArrayList<Integer>(Arrays.asList(1)) ));
assertEquals(0, findSolution( new ArrayList<Integer>(Arrays.asList(1,1)) ));
}
@Test
public void shouldReturn1()
{
assertEquals(1, findSolution( new ArrayList<Integer>(Arrays.asList(1,1,1)) ));
}
@Test
public void shouldReturn3()
{
assertEquals(3, findSolution( new ArrayList<Integer>(Arrays.asList(1,0,0,1,0)) ));
}
@Test
public void shouldReturn4()
{
assertEquals(4, findSolution( new ArrayList<Integer>(Arrays.asList(1,1,0,1,0,0)) ));
assertEquals(4, findSolution( new ArrayList<Integer>(Arrays.asList(0,0,0,0,0,0)) ));
assertEquals(4, findSolution( new ArrayList<Integer>(Arrays.asList(1,1,1,1,1,1)) ));
}
@Test
public void shouldReturnMinus1()
{
assertEquals(-1, findSolution( new ArrayList<Integer>(Arrays.asList(1,5,1)) ));
assertEquals(-1, findSolution( new ArrayList<Integer>(Arrays.asList(1,0,-1)) ));
}
}
| [
"tom7c3@gmail.com"
] | tom7c3@gmail.com |
f73cabc8b4bed2528cac23bd32c6d6c30d71adec | e4cb3550fd596516339c82cebfc06c0d95273bf6 | /SourceCode/src/DAO/CommBD.java | 5cbc7b1f0d8501b135f7a2eae7a8f464f555da0c | [] | no_license | MateusJFabricio/CIHM | 0d404caa24e1e7477391dce33d6a40e9f5104535 | d4912ec59baedac05e7b99c7597cbfc12827edab | refs/heads/master | 2020-03-27T05:39:41.531021 | 2018-12-03T10:28:19 | 2018-12-03T10:28:19 | 146,037,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,005 | java | package DAO;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class CommBD {
private Connection conexaoBD;
public java.sql.Statement getStatement() {
String URL = "jdbc:sqlite:ClaraMaq_PRD.db";
java.sql.Statement statement = null;
conexaoBD = null;
try {
conexaoBD = DriverManager.getConnection(URL);
statement = conexaoBD.createStatement();
} catch (SQLException e) {
JOptionPane.showMessageDialog(null,"Nao foi possivel estabelecer conexao com o banco de dados. A aplicacao sera encerrada. Motivo: " + e.getMessage());
System.exit(0);
}
return statement;
}
public void desconectar()
{
try
{
conexaoBD.close();
}
catch(SQLException fecha)
{
JOptionPane.showMessageDialog(null, "Houve um problema com o banco de dados. Problema: " + fecha.getMessage());
System.exit(0);
}
}
}
| [
"fabriciomateus05@gmail.com"
] | fabriciomateus05@gmail.com |
36e0122cd9e5926480e749301817cbe3da33f961 | 9353b3d684a288e68370919a63a35dba2f17b549 | /src/com/gservicedemo/android/app/activity/GAddressActivity.java | adeaf975a7886c0d3113f0890ef019116cb99f66 | [] | no_license | ajohnpraveen/virumaandiApp | f3cf8114238f3db08a8728486a716a1890e77e70 | 8c7101f7f09c2447f901d6b2aba892243ad59d37 | refs/heads/master | 2020-05-17T23:29:00.381493 | 2013-09-14T11:28:28 | 2013-09-14T11:28:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,796 | java | package com.gservicedemo.android.app.activity;
import java.io.IOException;
import org.apache.http.client.methods.HttpGet;
import com.gservicedemo.android.app.justUtils.JsonParser;
import com.gservicedemo.android.app.justUtils.RequestHelper;
import com.gservicedemo.android.app.justUtils.Utils;
import android.app.Activity;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class GAddressActivity extends Activity {
private static final String TAG ="GAddressActivity";
TextView contentTv;
EditText postalEdit;
Button magicBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_gservice);
contentTv = (TextView) findViewById(R.id.fullscreen_content);
contentTv.setMovementMethod(new ScrollingMovementMethod());
postalEdit = (EditText) findViewById(R.id.address_editText);
magicBtn = (Button) findViewById(R.id.magic_button);
magicBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(!TextUtils.isEmpty(postalEdit.getText())) {
GServiceTask task = new GServiceTask();
task.execute(postalEdit.getText().toString());
} else {
Toast.makeText(GAddressActivity.this, R.string.no_postal_code, Toast.LENGTH_LONG).show();
}
}
});
super.onCreate(savedInstanceState);
}
private class GServiceTask extends AsyncTask<String, Integer, String> {
@Override
protected void onPreExecute() {
contentTv.setText(getString(R.string.loading));
super.onPreExecute();
}
@Override
protected String doInBackground(String... params) {
String postal = params[0];
HttpGet get = new HttpGet(Utils.GEO_CODE_URL + "address=" + postal +"&sensor=true");
try {
String latitude = JsonParser.parseGeoCode(RequestHelper.executeRequest(get));
HttpGet getAddress = new HttpGet(Utils.GEO_CODE_URL + "latlng=" + latitude +"&sensor=true");
return JsonParser.parseReverseGeoCode(RequestHelper.executeRequest(getAddress));
} catch (IOException e) {
Log.e(TAG, Log.getStackTraceString(e));
} catch (Exception e) {
Log.e(TAG, "DAMOOOOOO, cant handle it anymore", e);
}
return null;
}
@Override
protected void onPostExecute(String result) {
if(!TextUtils.isEmpty(result)) {
contentTv.setText(Html.fromHtml(result));
} else {
contentTv.setText(getString(R.string.smthng_wrong));
}
super.onPostExecute(result);
}
}
}
| [
"john@theteamie.com"
] | john@theteamie.com |
4fdbfe7c890f348897aa834f99bc517f016a5949 | d1a935f35dc057400d40083d3e755733cb72842f | /editorconfig-eclipse-plugin/src/main/java/com/ncjones/editorconfig/eclipse/EditorConfigEditorActivationHandler.java | e5489856660b8fdf12191a0858277524b59d739b | [
"Apache-2.0"
] | permissive | hyness/editorconfig-eclipse | e62d162ef5fb77f2efbafa1accd06fb289e7a4ba | af40bdf89f28d16be13340e50b38ef0b94025749 | refs/heads/master | 2021-01-17T22:00:31.186363 | 2015-07-18T11:50:43 | 2015-07-18T11:50:43 | 40,137,777 | 0 | 0 | null | 2015-08-03T17:15:47 | 2015-08-03T17:15:47 | null | UTF-8 | Java | false | false | 4,319 | java | /*
* Copyright 2015 Nathan Jones
*
* This file is part of "EditorConfig Eclipse".
*
* 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.ncjones.editorconfig.eclipse;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import com.ncjones.editorconfig.core.ConfigProperty;
import com.ncjones.editorconfig.core.ConfigPropertyVisitor;
import com.ncjones.editorconfig.core.EditorConfigService;
import com.ncjones.editorconfig.core.EditorFileConfig;
import com.ncjones.editorconfig.core.EndOfLineOption;
import com.ncjones.editorconfig.core.IndentStyleOption;
public class EditorConfigEditorActivationHandler implements EditorActivationHandler, ConfigPropertyVisitor {
private final EditorConfigService editorConfigService;
public EditorConfigEditorActivationHandler(final EditorConfigService editorConfigService) {
this.editorConfigService = editorConfigService;
}
@Override
public void editorActivated(final IFile editorFile) {
final EditorFileConfig fileEditorConfig = getEditorFileConfig(editorFile);
System.out.println("Editor activated: " + fileEditorConfig);
for (final ConfigProperty<?> configProperty : fileEditorConfig.getConfigProperties()) {
configProperty.accept(this);
}
}
private EditorFileConfig getEditorFileConfig(final IFile file) {
final String path = file.getLocation().toString();
return editorConfigService.getEditorConfig(path);
}
private void setPreference(final String prefsNodeName, final String key, final String value) {
System.out.println(String.format("Setting preference: %s/%s=%s", prefsNodeName, key, value));
final IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(prefsNodeName);
prefs.put(key, value);
}
@Override
public void visitIndentStyle(final ConfigProperty<IndentStyleOption> property) {
final Boolean spacesForTabs = property.getValue().equals(IndentStyleOption.SPACE);
setPreference("org.eclipse.ui.editors", "spacesForTabs", spacesForTabs.toString());
setPreference("org.eclipse.jdt.core", "org.eclipse.jdt.core.formatter.tabulation.char", spacesForTabs ? "space" : "tab");
setPreference("org.eclipse.wst.xml.core", "indentationChar", spacesForTabs ? "space" : "tab");
setPreference("org.eclipse.ant.ui", "formatter_tab_char", Boolean.toString(!spacesForTabs));
}
@Override
public void visitIndentSize(final ConfigProperty<Integer> property) {
final String indentSizeString = property.getValue().toString();
setPreference("org.eclipse.ui.editors", "tabWidth", indentSizeString);
setPreference("org.eclipse.jdt.core", "org.eclipse.jdt.core.formatter.tabulation.size", indentSizeString);
setPreference("org.eclipse.wst.xml.core", "indentationSize", indentSizeString);
setPreference("org.eclipse.ant.ui", "formatter_tab_size", indentSizeString);
}
@Override
public void visitTabWidth(final ConfigProperty<Integer> property) {
}
@Override
public void visitEndOfLine(final ConfigProperty<EndOfLineOption> property) {
setPreference("org.eclipse.core.runtime", "line.separator", property.getValue().getEndOfLineString());
}
@Override
public void visitCharset(final ConfigProperty<String> property) {
setPreference("org.eclipse.core.resources", "encoding", property.getValue().toUpperCase());
}
@Override
public void visitTrimTrailingWhitespace(final ConfigProperty<Boolean> property) {
setPreference("org.eclipse.jdt.ui", "sp_cleanup.remove_trailing_whitespaces", property.getValue().toString());
}
@Override
public void visitInsertFinalNewLine(final ConfigProperty<Boolean> property) {
setPreference("org.eclipse.jdt.core", "org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing",
property.getValue().toString());
}
}
| [
"nathan@ncjones.com"
] | nathan@ncjones.com |
1635157ea03bf9d873ac298a5d85e5d08df372dc | 620a9fce7c6539b24f762dcfa29b91d7249871fe | /sgkim94/src/main/java/com/example/sgkim94/item05/NotificationFactory.java | acef779e524aae1792e8fde0156753e1cccf6f73 | [] | no_license | dolly0920/Effective_Java_Study | 75ae9b547b7fcb1454f5a52aa6d94d8e2d78fbd2 | 276e68bf445f22a4da11ebcbd11b4b4f8f6e9478 | refs/heads/master | 2023-04-07T00:20:51.940192 | 2021-05-01T12:27:55 | 2021-05-01T12:27:55 | 326,302,616 | 16 | 2 | null | 2021-05-01T12:27:56 | 2021-01-03T01:11:40 | Java | UTF-8 | Java | false | false | 564 | java | package com.example.sgkim94.item05;
public class NotificationFactory {
public Notification getNotification(String type) {
if ("SMS".equals(type)) {
return new SMSNotification();
}
if ("Print".equals(type)) {
return new PrintNotification();
}
if ("Security".equals(type)) {
return new SecurityNotification();
}
if ("Timeout".equals(type)) {
return new TimeoutNotification();
}
throw new IllegalArgumentException("Wrong Type!");
}
}
| [
"tkdrn8578@naver.com"
] | tkdrn8578@naver.com |
2e1d4201a84359075934ef45a5c79b84f06f61c5 | 3c735adf66347a1b3512cfb822fbe55bdb090e20 | /src/main/java/myhashmap/practise3.java | 2ecf62728b6361377533dcfcadcd30949d8e69cc | [] | no_license | ywang83/Cindy-Wang | dc1bc14e3b26d7b8b68a459e19773e0a174737e1 | 59d343b16a978aa09661ac61911b83484cf4adc5 | refs/heads/master | 2021-01-21T22:19:47.772609 | 2017-12-07T05:28:19 | 2017-12-07T05:28:19 | 102,150,749 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,158 | java | package myhashmap;
import java.util.*;
public class practise3 {
// http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/Map.java
// https://docs.oracle.com/javase/8/docs/api/java/util/Map.html
public static void main(final String[] args) throws InterruptedException {
MyHashMap<String, Integer> fix = new MyHashMap<>();
Iterator it = Arrays.asList("hello", "world", "what", "up").iterator();
fix.put("hello", 1);
Set<Map.Entry<String, Integer>> aSet = fix.entrySet();
System.out.println(aSet);
System.out.println(fix.get("hello"));
HashMap<String, Integer> fixture = new HashMap<>();
practise3 object = new practise3();
object.put("hello", 1);
Set<Map.Entry<String, Integer>> mySet = fix.entrySet();
System.out.println(mySet);
System.out.println(fixture.get("hello"));
}
public Object put(final String key, final Integer value) {
// TODO follow basic approach of remove below (this will be similar)
Map<String, Integer> aMap = new HashMap<>();
aMap.put(key,value);
Set entries = aMap.entrySet();
List<Map.Entry<String, Integer>> list = new LinkedList<>();
list.addAll(entries);
if (entries != null) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
Object newValue = entry.getValue();
return newValue;
}
}
return null;
}
}
// public V put(final K key, final V value) {
// // TODO follow basic approach of remove below (this will be similar)
// Map<K, V> aMap = new HashMap<>();
// aMap.put(key,value);
// Set entries = aMap.entrySet();
// List<Map.Entry<K,V>> list = new LinkedList<>();
// list.addAll(entries);
// table.add(list);
// if (entries != null) {
// Iterator iterator = list.iterator();
// while (iterator.hasNext()) {
// Map.Entry entry = (Map.Entry) iterator.next();
// Object newValue = entry.getValue();
// return (V) newValue;
// }
// }
// return null;
// }
// public V put(final K key, final V value) {
// // TODO follow basic approach of remove below (this will be similar)
// final int index = calculateIndex(key);
// final Iterator<Map.Entry<K, V>> iter = table.get(index).iterator();
// while (iter.hasNext()) {
// final Map.Entry<K, V> entry = iter.next();
// if (entry.getKey().equals(key)) {
//// V oldVal = entry.getValue();
// V oldVal = entry.getValue();
// entry.setValue(value);
// return oldVal;
// }
// }
// return null;
// }
// public V put(final K key, final V value) {
// // TODO follow basic approach of remove below (this will be similar)
// final int index = calculateIndex(key);
// for (Map.Entry<K, V> entry : table.get(index)) {
// if (entry.getKey().equals(key)) {
// V oldVal = entry.getValue();
// entry.setValue(value);
// return oldVal;
// }
// }
// table.get(index).add(new Map.Entry<>(key, value));
// return null;
// }
// public void putAll(final Map<? extends K, ? extends V> m) {
// // TODO add each entry in m's entrySet
// Set<? extends Map.Entry<? extends K, ? extends V>> mySet = m.entrySet();
// List<Map.Entry<K, V>> list = new LinkedList<>();
//// list.addAll((Collection<? extends Entry<K, V>>) mySet);
// Iterator it = mySet.iterator();
// while (it.hasNext()) {
// Map.Entry entry = (Map.Entry) it.next();
//// list.add((Entry<K, V>) it.next());
// table.add(list.add((entry));
// }
//// for( Entry<? extends K, ? extends V> entries:m.entrySet()){
//// list.add((Entry<K, V>) entries);
//// }
//// table.add(list);
// } | [
"ywang83@luc.edu"
] | ywang83@luc.edu |
401af042db16e7201829b270fed97fb2dd485fc7 | ea50141963a5d2f4c98fc1b716004b79a0188808 | /SpeedConverter/src/SpeedConverter.java | eec176f7eb4f665641cba6bd5e6a51f3908a0913 | [] | no_license | seeck3/Java_Practice_101 | 90388bce4d653fb1b4bcce8fb9d3359c3b1af68c | 20a39c93381f26fe36ac15514790775e1cc94075 | refs/heads/main | 2023-02-23T05:02:37.840405 | 2021-01-29T04:03:48 | 2021-01-29T04:03:48 | 331,823,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | public class SpeedConverter {
public static long toMilesPerHour(double kilometersPerHour) {
long milesPerHour = Math.round(kilometersPerHour / 1.609);
if (kilometersPerHour < 0) {
return -1;
}
return milesPerHour;
}
public static void printConversion(double kilometersPerHour) {
if (kilometersPerHour < 0) {
System.out.println("invalid value");
} else {
long milesPerHour = toMilesPerHour(kilometersPerHour);
System.out.println(kilometersPerHour + " km/h = " + milesPerHour + " mi/h");
System.out.println("km/h === mile/h");
}
}
}
| [
"marco.dseo@gmail.com"
] | marco.dseo@gmail.com |
3b06aa3fbcb140c95e87aca5c0e4d75a59e0ef10 | 0d8fb28f70cdcf26f8320bda8997863f09fdc115 | /app/src/main/java/number/NumberGameView.java | f45c961cac90c7556e04ecfffe34a3072e38f7c8 | [] | no_license | KikurageChan/GameCalc | 866f71cabd591c45cd5b6131336d6f01a0657bed | 8143fb039ed59f24709c262857664678a352788b | refs/heads/master | 2021-01-01T05:09:16.785996 | 2017-04-23T15:01:10 | 2017-04-23T15:01:10 | 56,422,286 | 0 | 0 | null | 2016-04-17T08:37:37 | 2016-04-17T06:24:14 | Java | UTF-8 | Java | false | false | 830 | java | package number;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import myGameUtil.MySurface;
/**
* Created by kikuragetyann on 16/02/12.
*/
public class NumberGameView extends MySurface {
private NumberGameEngine numberGameEngine;
public NumberGameView(Context context) {
super(context);
}
public NumberGameView(Context context, AttributeSet attr) {
super(context, attr);
}
@Override
public void drawFirst(Paint paint, Canvas canvas) {
numberGameEngine = new NumberGameEngine(getResources(),getContext());
numberGameEngine.drawFirst(paint, canvas);
}
@Override
public void drawGame(Paint paint, Canvas canvas) {
numberGameEngine.drawGame(paint,canvas);
}
}
| [
"cihi14057@g.nihon-u.ac.jp"
] | cihi14057@g.nihon-u.ac.jp |
f43172bce0f5469043abafc18972df84524efd01 | fd9efe57c1652247924a1e077a269836427ef32e | /1.10_numberFormat/Main.java | 28efed9220812f37430f7a14134fefedbddc6c49 | [] | no_license | pree208/core-java | 59d3a02dd8aea585370d69a6592f235130ea0915 | 881ed9cf56e9527e32ffc8087888156d77eab094 | refs/heads/main | 2023-07-11T01:01:19.575453 | 2021-08-19T06:26:55 | 2021-08-19T06:26:55 | 393,410,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | import java.text.NumberFormat;
/**
* Main
*/
public class Main {
public static void main(String[] args) {// numberformat is abstract class
// NumberFormat currency = NumberFormat.getCurrencyInstance();
// String result = currency.format(1234567.891);
// System.out.println(result);
String result = NumberFormat.getPercentInstance().format(0.1);// method chaining
System.out.println(result);
}
} | [
"preethiashok208@gmail.com"
] | preethiashok208@gmail.com |
0de5024f813d636ff235ac0482fbb6dc30da74a0 | a8b59baff71bdc651e44c38c542100c377432eb8 | /AdminService/src/main/java/com/nagarro/adminService/controller/AdminServiceController.java | 5cb99056c05597535c303958a8e4115799e14918 | [] | no_license | Vinay4055/AdminService | d50be5ce2797e769923c15587ccd8bf808925322 | f2b02f394ca93a5109d841edceac053e1df8f5c9 | refs/heads/master | 2023-03-16T00:12:08.069114 | 2021-02-28T09:22:03 | 2021-02-28T09:22:03 | 341,155,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | package com.nagarro.adminService.controller;
import javax.validation.Valid;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.nagarro.adminService.model.ServiceRequest;
@RestController
@RequestMapping("/admin")
public class AdminServiceController {
@PostMapping("/")
public void receiveRequest(@RequestBody @Valid ServiceRequest serviceRequest, BindingResult bindingResult) {
System.out.println(serviceRequest);
}
}
| [
"vkvinay180@gmail.com"
] | vkvinay180@gmail.com |
e27575cda8ad36310b65cadf1685128828819d7e | 4f17eba08a9cf6ddde67ab54b2baaa0cd5e3421c | /src/main/java/io/miguelo/agenda/config/DefaultProfileUtil.java | 0e8574d966d398c6f994f6274134cc3afe76e008 | [] | no_license | miguelOchoaGallegos/agenda-virtual | 568f8728960ff7a1d76d15ffd047ab80c89b7a2a | 6b212df712c7ac9ad1d914cf6bb17b2aa4803673 | refs/heads/master | 2020-03-29T10:44:48.710092 | 2018-09-21T21:37:41 | 2018-09-21T21:37:41 | 149,820,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,712 | java | package io.miguelo.agenda.config;
import io.github.jhipster.config.JHipsterConstants;
import org.springframework.boot.SpringApplication;
import org.springframework.core.env.Environment;
import java.util.*;
/**
* Utility class to load a Spring profile to be used as default
* when there is no <code>spring.profiles.active</code> set in the environment or as command line argument.
* If the value is not available in <code>application.yml</code> then <code>dev</code> profile will be used as default.
*/
public final class DefaultProfileUtil {
private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default";
private DefaultProfileUtil() {
}
/**
* Set a default to use when no profile is configured.
*
* @param app the Spring application
*/
public static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
/*
* The default profile to use when no other profiles are defined
* This cannot be set in the <code>application.yml</code> file.
* See https://github.com/spring-projects/spring-boot/issues/1219
*/
defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
app.setDefaultProperties(defProperties);
}
/**
* Get the profiles that are applied else get default profiles.
*
* @param env spring environment
* @return profiles
*/
public static String[] getActiveProfiles(Environment env) {
String[] profiles = env.getActiveProfiles();
if (profiles.length == 0) {
return env.getDefaultProfiles();
}
return profiles;
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
5ab8c5f2591c2759866ada6f8038f752f4acd26c | f8964e74485e4c00d66e7a9a71e6b6c1174aaed2 | /src/com/sales/service/business/impl/SysOperationServiceImpl.java | 4843a886c254c7eb62f79c97d546ec5849583819 | [] | no_license | tigergithub01/sales | d3bc639e999e8165ea7e4d8ed2e86a1761e282b2 | 2299a9e1eaafa2966fbb4dd66a1736082700c904 | refs/heads/master | 2020-04-17T17:03:23.103166 | 2016-11-25T09:41:21 | 2016-11-25T09:41:21 | 66,929,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,354 | java | package com.sales.service.business.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.sales.dao.business.SysOperationMapper;
import com.sales.model.business.SysOperation;
import com.sales.service.business.SysOperationService;
import com.sales.util.pager.helper.PageInfo;
import com.sales.util.pager.helper.PaginatedListHelper;
@Service("sysOperationService")
public class SysOperationServiceImpl implements SysOperationService {
@Resource
private SysOperationMapper sysOperationMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return sysOperationMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SysOperation record) {
return sysOperationMapper.insert(record);
}
@Override
public int insertSelective(SysOperation record) {
return sysOperationMapper.insertSelective(record);
}
@Override
public SysOperation selectByPrimaryKey(Long id) {
return sysOperationMapper.selectByPrimaryKey(id);
}
@Override
public SysOperation selectBySelective(SysOperation record) {
List<SysOperation> selectList = this.selectList(record);
if(selectList!=null && !(selectList.isEmpty())){
return selectList.get(0);
}else{
return null;
}
}
@Override
public int updateByPrimaryKeySelective(SysOperation record) {
return sysOperationMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SysOperation record) {
return sysOperationMapper.updateByPrimaryKey(record);
}
@Override
public List<SysOperation> selectList(
SysOperation record) {
PageInfo pageInfo = new PageInfo();
pageInfo.setPageNumber(1);
pageInfo.setPageSize(Integer.MAX_VALUE);
return this.selectList(record, pageInfo).getList();
}
@Override
public PaginatedListHelper selectList(
SysOperation record,PageInfo pageInfo) {
if(record==null){
record = new SysOperation();
}
List<SysOperation> list = sysOperationMapper.selectList(record,pageInfo);
PaginatedListHelper helper = new PaginatedListHelper();
// helper.setPageNumber(pageInfo.getPageNumber());
// helper.setPageSize(pageInfo.getPageSize());
helper.setList(list);
helper.setFullListSize(pageInfo.getTotalCount());
return helper;
}
}
| [
"43375138@qq.com"
] | 43375138@qq.com |
73cb13ac5d3b9cc3ffb994a75fc8735f6172dc90 | 673fb3f2b02e436f9512004ca595268f91c815a3 | /src/main/java/br/gov/ma/tce/reunire/model/vo/d/RelatorioD008VO.java | 07f763dba5836eafe28e19567b20a04383b75de7 | [] | no_license | psinalberth/reunire | 84c55583dd712eb1f575f67ed104b43afb22037d | 6624792e4e3dba3859fc551e73d17c283581a0ca | refs/heads/master | 2022-10-03T21:10:44.538159 | 2021-05-07T11:43:04 | 2021-05-07T11:43:04 | 125,836,991 | 1 | 0 | null | 2022-09-22T17:51:24 | 2018-03-19T09:56:53 | Java | UTF-8 | Java | false | false | 2,022 | java | package br.gov.ma.tce.reunire.model.vo.d;
import java.math.BigDecimal;
import br.gov.ma.tce.reunire.model.vo.generic.DemonstrativoVO;
public class RelatorioD008VO extends DemonstrativoVO {
private String funcaoGoverno;
private String subfuncaoGoverno;
private String programa;
private String acao;
private String nomeFuncao;
private String nomeSubFuncao;
private String nomePrograma;
private String nomeAcao;
private BigDecimal valorOrdinario;
private BigDecimal valorVinculado;
public String getFuncaoGoverno() {
return funcaoGoverno;
}
public void setFuncaoGoverno(String funcaoGoverno) {
this.funcaoGoverno = funcaoGoverno;
}
public String getSubfuncaoGoverno() {
return subfuncaoGoverno;
}
public void setSubfuncaoGoverno(String subfuncaoGoverno) {
this.subfuncaoGoverno = subfuncaoGoverno;
}
public String getPrograma() {
return programa;
}
public void setPrograma(String programa) {
this.programa = programa;
}
public String getAcao() {
return acao;
}
public void setAcao(String acao) {
this.acao = acao;
}
public String getNomeFuncao() {
return nomeFuncao;
}
public void setNomeFuncao(String nomeFuncao) {
this.nomeFuncao = nomeFuncao;
}
public String getNomeSubFuncao() {
return nomeSubFuncao;
}
public void setNomeSubFuncao(String nomeSubFuncao) {
this.nomeSubFuncao = nomeSubFuncao;
}
public String getNomePrograma() {
return nomePrograma;
}
public void setNomePrograma(String nomePrograma) {
this.nomePrograma = nomePrograma;
}
public String getNomeAcao() {
return nomeAcao;
}
public void setNomeAcao(String nomeAcao) {
this.nomeAcao = nomeAcao;
}
public BigDecimal getValorOrdinario() {
return valorOrdinario;
}
public void setValorOrdinario(BigDecimal valorOrdinario) {
this.valorOrdinario = valorOrdinario;
}
public BigDecimal getValorVinculado() {
return valorVinculado;
}
public void setValorVinculado(BigDecimal valorVinculado) {
this.valorVinculado = valorVinculado;
}
} | [
"inalberth07@gmail.com"
] | inalberth07@gmail.com |
974f769b8368aaab1b66ff99216e06a54811d847 | 8079ed2116153797ebefd4f6f375b7e3d2e98b1f | /Software to introduce the kinds into programing/HieloFino/src/ast/MenorIgual.java | ee6f0308f25a939ce1fddce901e3c535e39b4577 | [] | no_license | djbu/kidscoding | c4d7b9c8e4a3e1d5d388b5b1c6fbc8985f9b0317 | 2b3640187e4038ab884e12b8e9256f8fe4612e97 | refs/heads/master | 2020-05-20T09:52:23.760274 | 2014-05-11T02:30:52 | 2014-05-11T02:30:52 | 19,654,298 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,423 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ast;
import ast.visitador.Visitador;
import java.io.PrintStream;
import tabla.TablaSimbolos;
import util.Utilidades;
/**
*
* @author Administrador
*/
public class MenorIgual extends ExpresionBinaria{
private boolean valor;
public boolean isValor() {
return valor;
}
public void setValor(boolean valor) {
this.valor = valor;
}
public MenorIgual(Expresion expr1, Expresion expr2, int linea, int columna) {
super(expr1, expr2, linea, columna);
}
@Override
public void dump(PrintStream out, int n) {
dumpLineaColumna(out, n);
out.println("_menor_igual");
if(getTipoExpr()!=null) out.println(Utilidades.pad(n+2)+"tipo_expr: "+getTipoExpr());
getExpr1().dump(out, n+2);
getExpr2().dump(out, n+2);
}
public void aceptar(Visitador visit, Object... params) {
visit.visitar(this, params);
}
public void checkSemantica(TablaSimbolos tabla) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
/*
* 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.
*/
| [
"danieljosebecerra@gmail.com"
] | danieljosebecerra@gmail.com |
24c80a42a3a42884fba91042222d3fc0d5b9a7c6 | 62a384759efa9b32011d8464f36c41aac7572dbd | /app/src/main/java/com/zv/geochat/notification/NotificationDecorator.java | f8e626e67bb1a97ead04a0c39488d42843866d42 | [] | no_license | zvbox/android-geochat | 695f50fdadaf91062c341f5f257ebbed73e6360b | dfa20e8d4c31f1ed1f53131d47a2185215e06d0e | refs/heads/master | 2023-02-21T15:05:07.387180 | 2021-01-26T00:40:11 | 2021-01-26T00:40:11 | 69,801,406 | 6 | 27 | null | 2023-02-15T00:06:27 | 2016-10-02T14:23:51 | Java | UTF-8 | Java | false | false | 3,589 | java | package com.zv.geochat.notification;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.util.Log;
import com.zv.geochat.ChatActivity;
import com.zv.geochat.R;
public class NotificationDecorator {
private static final String TAG = "NotificationDecorator";
private final Context context;
private final NotificationManager notificationMgr;
private final MessageNotifierConfig messageNotifierConfig;
public NotificationDecorator(Context context, NotificationManager notificationManager) {
this.context = context;
this.notificationMgr = notificationManager;
this.messageNotifierConfig = new MessageNotifierConfig(context);
}
public void displaySimpleNotification(String title, String contentText) {
if (messageNotifierConfig.isPlaySound()) {
Intent intent = new Intent(context, ChatActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
// notification message
try {
Notification noti = new Notification.Builder(context)
.setSmallIcon(R.drawable.ic_message)
.setContentTitle(title)
.setContentText(contentText)
.setContentIntent(contentIntent)
.setAutoCancel(true)
.setSound(messageNotifierConfig.getSoundUri())
.setVibrate(messageNotifierConfig.getVibratePattern())
.setLights(Color.BLUE, 1000, 1000)
.build();
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationMgr.notify(0, noti);
} catch (IllegalArgumentException e) {
Log.e(TAG, e.getMessage());
}
}
}
public void displayExpandableNotification(String title, String contentText) {
if (messageNotifierConfig.isPlaySound()) {
Intent intent = new Intent(context, ChatActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
// notification message
try {
Notification noti = new Notification.Builder(context)
.setSmallIcon(R.drawable.ic_message)
.setContentTitle(title)
.setContentText(contentText)
.setContentIntent(contentIntent)
.setAutoCancel(true)
.setSound(messageNotifierConfig.getSoundUri())
.setVibrate(messageNotifierConfig.getVibratePattern())
.setLights(Color.BLUE, 1000, 1000)
.setStyle(new Notification.BigTextStyle().bigText(contentText))
.build();
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationMgr.notify(0, noti);
} catch (IllegalArgumentException e) {
Log.e(TAG, e.getMessage());
}
}
}
}
| [
"zv@zv.com"
] | zv@zv.com |
b6ded28e7166fd756473ede7a4471f73a87201b1 | 6abddd10c7f11fd504b406721b86b06a0486756a | /ejercicio1-ejb/src/main/java/utils/IVisitor.java | d319a0104f22b07e1d4ccb0b24c2bfee79f11fc5 | [
"Apache-2.0"
] | permissive | sergio11/twitter_sentiment_analysis | d66284679335744049b2482d29f9aa636ac955c6 | 9d8c53f09fe5abfb9b7f50e47a6cc664b753b398 | refs/heads/master | 2023-06-02T22:57:28.197237 | 2023-05-14T14:24:33 | 2023-05-14T14:24:33 | 70,391,680 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 271 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package utils;
/**
*
* @author sergio
*/
public interface IVisitor {}
| [
"sss4esob@gmail.com"
] | sss4esob@gmail.com |
83fec2588367ae4a168a532e4e76cf272d4989a2 | e7f361b3c8202f12bd8340bf1d88beb008936224 | /app/src/main/java/info/vnk/billex/activity/HomeActivity.java | 4e3b28e9493d911c5fd67fd386865905f96de486 | [] | no_license | anasnasim/ae3enau3jkad635723pothan | ac891506ff9daa0462c633059e88e95ebdd8b569 | 08c078564c213bc5bc9ee25f8cdabcb6f3b40c53 | refs/heads/master | 2021-09-28T12:56:28.603607 | 2017-04-21T20:24:07 | 2017-04-21T20:24:07 | 270,920,036 | 1 | 0 | null | 2020-06-09T06:21:32 | 2020-06-09T06:21:31 | null | UTF-8 | Java | false | false | 352 | java | package info.vnk.billex.activity;
import android.os.Bundle;
import info.vnk.billex.R;
import info.vnk.billex.base.BaseActivity;
public class HomeActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
}
}
| [
"visak.kumar@msisoft.in"
] | visak.kumar@msisoft.in |
f04abb9376197c0ffaf4a1dca0db4249f4cbd6ea | 4800db70dd126582c5ea4e1a1322232c3d6e9a22 | /src/main/java/com/tedu/cloud_note_1/service/DeleteBookServiceImpl.java | a96c2bd4bb043bc7418773440c718519c39a4280 | [] | no_license | BitterGeng/BitterGeng | 2d9cbe3088f997e9dc4cd690b3a79ddab15f4686 | 986e3b173475587b14efe0b0122c3a4ac576cb07 | refs/heads/master | 2021-01-23T10:07:42.060893 | 2017-06-07T08:16:34 | 2017-06-07T08:16:34 | 93,040,182 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 967 | java | package com.tedu.cloud_note_1.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tedu.cloud_note_1.controller.AddBookNoteController;
import com.tedu.cloud_note_1.dao.DeleteBookDao;
import com.tedu.cloud_note_1.util.NoteResult;
@Service
public class DeleteBookServiceImpl implements DeleteBookService{
private static Logger logger = LoggerFactory.getLogger(DeleteBookServiceImpl.class);
@Autowired
DeleteBookDao deleteBookDao;
public NoteResult<Object> deleteBookService(String bookId) {
int row=deleteBookDao.deleteBookDao(bookId);
NoteResult<Object> res = new NoteResult<Object>();
if(row == 1){
res.setStatus(0);
res.setMsg("删除成功");
logger.info("删除笔记本成功");
}else{
res.setStatus(1);
res.setMsg("删除失败");
logger.warn("删除笔记本失败");
}
return res;
}
}
| [
"839407658@@qq.com"
] | 839407658@@qq.com |
92a1a14c44d5c0a2f5ffd18f26d1565c8a6f6b65 | d5ec2ef40e3a907b00e0a4581af2b1a91511ebc8 | /src/main/java/com/springmvc/utils/GeneratorSqlmap.java | 693a36ddcf30f67d015b55c0c9d3dec900f9a054 | [] | no_license | zhipenghuang/hzp-test | 32bc65776bd9111ddb9503a58192062bedb44c1c | f20ea27b6095a42053d7bda2ed97a08c16936cb3 | refs/heads/master | 2021-09-12T17:32:42.428141 | 2018-04-19T08:22:24 | 2018-04-19T08:22:24 | 92,804,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | package com.springmvc.utils;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;
public class GeneratorSqlmap {
public static void main(String[] args) throws Exception {
List<String> warnings = new ArrayList<>();
boolean overwrite = true;
// InputStream inputStream = GeneratorSqlmap.class.getResourceAsStream("/generatorConfig.xml");
String path = GeneratorSqlmap.class.getClass().getResource("/").getPath();
File configFile = new File(path+"generatorConfig.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
System.out.println("恭喜,使用MyBatis_Generator生成model、Mapper、Mapper.xml成功。");
}
}
| [
"815152937@qq.com"
] | 815152937@qq.com |
788d0871a1b592827a3773633734b0c02e95fab8 | ce2a835e56105557dd12935df31f54e6ed11b85d | /src/main/java/challenges/section10/Generics.java | d926e0441eb4fe0044bfde647435f57df11d4c50 | [] | no_license | Draxawox/QAA_Exercises | 8cb4fd57d44b2b8e06a8e805a4ea80c36c3b1947 | ef34fba293d3eed6dcc0bff380ad6dadd2e5831d | refs/heads/main | 2023-08-05T14:03:47.704034 | 2021-09-30T15:08:21 | 2021-09-30T15:08:21 | 403,548,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,027 | java | package challenges.section10;
import java.util.ArrayList;
import java.util.Collections;
public class Generics {
public static void main(String[] args) {
}
}
class League<T extends Team> {
private String leagueName;
private ArrayList<T> league;
public League(String leagueName) {
this.leagueName = leagueName;
this.league = new ArrayList<>();
}
public String getLeagueName() {
return leagueName;
}
public boolean addTeam(T team) {
if (league.contains(team)) {
System.out.println(team + " is already in the league");
return false;
} else {
league.add(team);
System.out.println(team + " was added too the league");
return true;
}
}
public void showTable() {
Collections.sort(league);
for (Team team: league) {
System.out.println((league.indexOf(team) + 1) + " " + team.getTeamName() + " points: " + team.getPoints());
}
}
}
class Team<T extends Player> implements Comparable<Team<T>> {
private String teamName;
private int played;
private int won;
private int lost;
private int tied;
private int points;
private ArrayList<T> team;
public Team(String teamName) {
this.teamName = teamName;
this.team = new ArrayList<>();
this.played = 0;
this.won = 0;
this.lost = 0;
this.tied = 0;
this.points = 0;
}
public String getTeamName() {
return teamName;
}
public int numPlayers() {
return this.team.size();
}
public int getPoints() {
return points;
}
public void matchResult(Team opponent, int ourScore, int theirScore) {
if (ourScore > theirScore) {
played++;
won++;
points += 3;
} else if (ourScore == theirScore) {
tied++;
played++;
points++;
} else {
lost++;
played++;
}
}
public boolean addPlayer(T player) {
if (team.contains(player)) {
System.out.println(player.getName() + " is already in this team");
return false;
} else {
team.add(player);
System.out.println(player.getName() + " picked for team " + this.teamName);
return true;
}
}
@Override
public int compareTo(Team<T> team) {
return Integer.compare(team.points, this.points);
}
}
class Player {
private String name;
public Player(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
class FootballPlayer extends Player {
public FootballPlayer(String name) {
super(name);
}
}
class BaseballPlayer extends Player {
public BaseballPlayer(String name) {
super(name);
}
}
class BasketBallPlayer extends Player {
public BasketBallPlayer(String name) {
super(name);
}
}
| [
"kalix321@gmail.com"
] | kalix321@gmail.com |
76834ea19e85a3e454664842dcfc0cdc5ac0bad2 | 88362be14e8de6a28cf22106fb3ce0220c06f774 | /app/src/main/java/yhh/bj4/memoryloggerdemo/MyApplication.java | 70f8352bdc3bdce9b6013dfe053522a9d6171c0b | [] | no_license | s011208/MemoryLoggerDemo | 9501ab8fb497e6710a97ac26048f01362b9d4b13 | 28cc6ce7ea3d25281f3ce496c78c7ab8a29f05b5 | refs/heads/master | 2021-01-20T18:20:37.249444 | 2016-08-12T09:50:19 | 2016-08-12T09:50:19 | 65,531,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package yhh.bj4.memoryloggerdemo;
import android.app.Application;
import yhh.bj4.memorylogger.LogHelper;
/**
* Created by yenhsunhuang on 2016/8/12.
*/
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
LogHelper.getInstance(this);
}
}
| [
"s011208@gmail.com"
] | s011208@gmail.com |
4cfe70e191749623da0aab1ffdfc4578ae82a76d | ced651c6b57024540890387fe4597c5c807eb867 | /Ineffable-Engine/core/src/com/hakavo/game/ai/pathfinding/ClosestHeuristic.java | 5880beaec8d7de61d8de8ca7a96ae5d7c19ded08 | [
"Apache-2.0"
] | permissive | hakavogames/Ineffable-Engine | 41462687cab1e932151c37e2c979f356646f16c9 | 3a6e09b697f168380ba72967eb95740623007613 | refs/heads/master | 2020-04-02T04:52:10.797289 | 2019-04-06T07:30:23 | 2019-04-06T07:30:23 | 154,040,076 | 2 | 0 | Apache-2.0 | 2018-11-01T10:13:09 | 2018-10-21T18:35:03 | Java | UTF-8 | Java | false | false | 505 | java | package com.hakavo.game.ai.pathfinding;
/**
* A heuristic that uses the tile that is closest to the target
* as the next best tile.
*
* @author Kevin Glass
*/
public class ClosestHeuristic implements AStarHeuristic {
/**
* @see AStarHeuristic#getCost(TileBasedMap, Mover, int, int, int, int)
*/
public float getCost(TileBasedMap map, int x, int y, int tx, int ty) {
float dx = tx - x;
float dy = ty - y;
float result = (float) (Math.sqrt((dx*dx)+(dy*dy)));
return result;
}
} | [
"hakavogames@gmail.com"
] | hakavogames@gmail.com |
2a332d31a1bddcdbb7ec6b40ff6b66ce06f18db5 | d0475cdbc0c78c65d1a1d21eca6e096d35eca9c8 | /src/tk/coursesplus/development/devsync/CoursesPlusDevSync.java | 914b6811ba773a89472f6884516c6a610596c8ba | [
"MIT"
] | permissive | CoursesPlus/CoursesPlusDevSync | 853b41294f2414558f64f914538885a21734ca01 | 5169fd8cdb6a6411ff81b736931a72c7192aea1d | refs/heads/master | 2021-01-19T08:27:43.560880 | 2016-01-24T23:55:13 | 2016-01-24T23:55:13 | 35,517,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,588 | java | package tk.coursesplus.development.devsync;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.StandardWatchEventKinds;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.text.DefaultCaret;
@SuppressWarnings("serial")
public class CoursesPlusDevSync extends JFrame implements ActionListener {
public static final String VERSION = "0.2";
JLabel title = new JLabel("Courses+ Dev Sync", JLabel.CENTER);
JLabel instructions = new JLabel("<html><center>This program syncs the different folders in the Courses+ directory with each other. This is required for cross-browser development.</center></html>", JLabel.CENTER);
JButton startBtn = new JButton("Start!");
JButton clearBrowserSupportBtn = new JButton("Clear destination dirs");
JButton forceSyncBtn = new JButton("Force sync");
public static JTextArea log = new JTextArea();
public static WatchService watcher;
public static Path sourceCodePath;
JScrollPane scroll;
SyncThread thread;
File fileThing;
public static String[] folders = { "chosen", "css", "etc", "fonts", "images", "js", "scss_gen" };
public static String[] browsersupportfolders = { "Chrome", "CoursesPlus.safariextension", "Firefox" };
public CoursesPlusDevSync() {
super("Courses+ Dev Sync v" + VERSION);
setBounds(100,100,600,600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(3, 1));
// Panel elements
JPanel top = new JPanel();
top.setLayout(new GridLayout(2, 1));
Font f = new Font("IDONOTEXISTHAHAHAHAHAHAHAH", Font.PLAIN, 48); // use the default font
title.setFont(f);
top.add(title);
top.add(instructions);
add(top);
JPanel middle = new JPanel();
middle.setLayout(new GridLayout(2, 1));
startBtn.setFont(new Font("IDONOTEXISTHAHAHAHAHAHAHAH", Font.PLAIN, 24));
startBtn.addActionListener(this);
middle.add(startBtn);
JPanel buttonTwo = new JPanel();
buttonTwo.setLayout(new GridLayout(1, 2));
clearBrowserSupportBtn.setFont(new Font("IDONOTEXISTHAHAHAHAHAHAHAH", Font.PLAIN, 16));
clearBrowserSupportBtn.addActionListener(this);
buttonTwo.add(clearBrowserSupportBtn);
forceSyncBtn.setFont(new Font("IDONOTEXISTHAHAHAHAHAHAHAH", Font.PLAIN, 16));
forceSyncBtn.addActionListener(this);
buttonTwo.add(forceSyncBtn);
middle.add(buttonTwo);
middle.setBorder(new TitledBorder(new EtchedBorder (), "Controls"));
add(middle);
log.setFont(new Font("Monaco", Font.PLAIN, 12));
log.setEditable(false);
DefaultCaret caret = (DefaultCaret) log.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
scroll = new JScrollPane(log);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroll.setBorder(new TitledBorder(new EtchedBorder (), "Log"));
add(scroll);
// End panel elements
setVisible(true);
addLogEntry("Courses+ Dev Sync version " + VERSION + " ready!");
String osname = System.getProperty("os.name");
addLogEntry("Checking OS - it is " + osname + "...");
if (!osname.startsWith("Mac OS X")) {
addLogEntry("Unsupported OS - " + osname + "!");
JOptionPane.showMessageDialog(null, "Your operating system, " + osname + ", is not currently supported by this tool.\nCurrently, it's only been tested in Mac OS X.\nBad things probably will happen in other operating systems.", "Unsupported operating system", JOptionPane.WARNING_MESSAGE);
}
String pathPlace = System.getProperty("user.home") + "/Documents/Git/CoursesPlus/CoursesPlus/";
fileThing = new File(pathPlace);
sourceCodePath = fileThing.toPath();
addLogEntry("Found user's home directory: " + System.getProperty("user.home"));
addLogEntry("Found source code directory: " + sourceCodePath.toString());
}
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if (source == startBtn)
{
if (startBtn.getText() == "Stop!") {
// We should stop it!
addLogEntry("Stopping watcher...");
thread.stop();
startBtn.setText("Start!");
return;
}
addLogEntry("Starting watcher...");
try {
if (!fileThing.isDirectory() || !fileThing.exists()) {
addLogEntry("[ERROR] Source code directory is not a directory or doesn't exist!");
return;
}
watcher = FileSystems.getDefault().newWatchService();
sourceCodePath.register(watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
thread = new SyncThread();
thread.start();
startBtn.setText("Stop!");
} catch (IOException e) {
addLogEntry("[ERROR] IOException during setup!");
e.printStackTrace();
}
}
if (source == clearBrowserSupportBtn) {
if (JOptionPane.showConfirmDialog (null, "This will clear the browsersupport directories. You'll have to resync the folders to get the extensions to work in browsers again.", "Are you sure?", JOptionPane.YES_OPTION) == JOptionPane.OK_OPTION) {
addLogEntry("Clearing browsersupport folders...");
for (String browsersupportfolder : browsersupportfolders) {
for (String folder : folders) {
File deleteThis = new File(sourceCodePath.toString() + "/browsersupport/" + browsersupportfolder + "/" + folder);
addLogEntry("Deleting " + deleteThis.getPath() + "...");
if (!deleteThis.exists() || !deleteThis.isDirectory()) {
addLogEntry("[WARN] " + folder + " does not exist or is not a directory, skipping...");
continue;
}
purgeDirectory(deleteThis);
deleteThis.delete();
}
}
}
}
if (source == forceSyncBtn) {
addLogEntry("Forcing sync...");
syncFolders();
}
}
void purgeDirectory(File dir) {
for (File file: dir.listFiles()) {
if (file.isDirectory()) purgeDirectory(file);
file.delete();
}
}
public static void addLogEntry(String str) {
log.append("[LOG] " + str + "\n");
System.out.println("[LOG] " + str);
}
public static void main(String[] args) {
new CoursesPlusDevSync();
}
public static void syncFolders() {
try {
for (String browsersupportfolder : browsersupportfolders) {
String browserSupportPath = "browsersupport/" + browsersupportfolder;
for (String folder : folders) {
Process p = Runtime.getRuntime().exec("rsync -vur " + sourceCodePath.toString() + "/" + folder + " " + CoursesPlusDevSync.sourceCodePath.toString() + "/" + browserSupportPath );
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
// read the output from the command
String s;
while ((s = stdInput.readLine()) != null) {
addLogEntry("[PROCESS] " + s);
}
}
}
} catch (IOException x) {
addLogEntry("[ERROR] Process IOException! :(");
}
}
}
class SyncThread extends Thread {
public void run()
{
while (true) {
// wait for key to be signaled
WatchKey key;
key = CoursesPlusDevSync.watcher.poll();
if (key == null) {
continue;
}
for (WatchEvent<?> event: key.pollEvents()) {
WatchEvent.Kind<?> kind = event.kind();
// This key is registered only
// for ENTRY_CREATE events,
// but an OVERFLOW event can
// occur regardless if events
// are lost or discarded.
if (kind == StandardWatchEventKinds.OVERFLOW) {
CoursesPlusDevSync.addLogEntry("Nope, overflow.");
continue;
}
// The filename is the
// context of the event.
@SuppressWarnings("unchecked")
WatchEvent<Path> ev = (WatchEvent<Path>)event;
Path filename = ev.context();
// Resolve the filename against the directory.
Path child = CoursesPlusDevSync.sourceCodePath.resolve(filename);
CoursesPlusDevSync.addLogEntry("File " + filename + " has changed!");
// run rsync and friends
CoursesPlusDevSync.syncFolders();
}
// Reset the key -- this step is critical if you want to
// receive further watch events. If the key is no longer valid,
// the directory is inaccessible so exit the loop.
boolean valid = key.reset();
if (!valid) {
break;
}
try {
SyncThread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
} | [
"alex_studer@outlook.com"
] | alex_studer@outlook.com |
e51582985b8fb292b3bc17fa1f86e65080ef98e6 | a8da3febf805f9f5d727854d5c471666768416e3 | /src/main/java/cn/net/mine/project/dao/jdbc/impl/ProjectDaoJdbcImpl.java | 60f260b65446c05249fb0ad28e31fb193b1839f0 | [] | no_license | 9251209/zpsEvaluateWeb | 27d9872027a1ba4e8dba59f669625aca23b8b08f | b35e6526022ca80c0f8d5dd994fba27d01063f51 | refs/heads/master | 2020-04-03T19:05:05.132150 | 2018-11-26T02:11:14 | 2018-11-26T02:11:14 | 155,509,322 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,902 | java | package cn.net.mine.project.dao.jdbc.impl;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import cn.net.mine.project.dao.ProjectDao;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Repository;
import cn.net.mine.common.SuperJdbcTemplate;
@Repository
public class ProjectDaoJdbcImpl extends SuperJdbcTemplate implements ProjectDao {
@Override
public List<Map<String, Object>> selectGetProjectList(String prono, String proname, String type, String userno, String totalInvestmentAmount, String coveredArea, String purpose, String brief, String leader, String address, String consCompany, String buildCompany, String superCompany, String designCompany, String prospectCompany) {
StringBuffer sql = new StringBuffer();
sql.append("SELECT * from project u where 1=1 ");
if (prono != null && !prono.equals("")) {
sql.append(" and u.prono LIKE '%").append(prono).append("%'");
}
if (type != null && !type.equals("")) {
sql.append(" and u.type LIKE '%").append(type).append("%'");
}
if (userno != null && !userno.equals("")) {
sql.append(" and u.userno = '").append(userno).append("'");
}
if (totalInvestmentAmount != null && !totalInvestmentAmount.equals("")) {
sql.append(" and u.totalInvestmentAmount LIKE '%").append(totalInvestmentAmount).append("%'");
}
if (coveredArea != null && !coveredArea.equals("")) {
sql.append(" and u.coveredArea LIKE '%").append(coveredArea).append("%'");
}
if (purpose != null && !purpose.equals("")) {
sql.append(" and u.purpose LIKE '%").append(purpose).append("%'");
}
if (brief != null && !brief.equals("")) {
sql.append(" and u.brief LIKE '%").append(brief).append("%'");
}
if (leader != null && !leader.equals("")) {
sql.append(" and u.leader LIKE '%").append(leader).append("%'");
}
if (address != null && !address.equals("")) {
sql.append(" and u.address LIKE '%").append(address).append("%'");
}
if (consCompany != null && !consCompany.equals("")) {
sql.append(" and u.consCompany LIKE '%").append(consCompany).append("%'");
}
if (buildCompany != null && !buildCompany.equals("")) {
sql.append(" and u.buildCompany LIKE '%").append(buildCompany).append("%'");
}
if (superCompany != null && !superCompany.equals("")) {
sql.append(" and u.superCompany LIKE '%").append(superCompany).append("%'");
}
if (designCompany != null && !designCompany.equals("")) {
sql.append(" and u.designCompany LIKE '%").append(designCompany).append("%'");
}
if (prospectCompany != null && !prospectCompany.equals("")) {
sql.append(" and u.prospectCompany LIKE '%").append(prospectCompany).append("%'");
}
if (proname != null && !proname.equals("")) {
sql.append(" and u.proname LIKE '%").append(proname).append("%'");
}
return jdbcTemplateCsms.queryForList(sql.toString());
}
@Override
public Object projectAdd(String prono, String proname, String type, String userno, String totalInvestmentAmount,
String coveredArea, String purpose, String brief, String leader, String address, String consCompany, String buildCompany, String superCompany, String designCompany, String prospectCompany, String[] projectImage, String leaderPhone) {
StringBuffer sql = new StringBuffer();
UUID uuid= UUID.randomUUID();
String str = uuid.toString();
// Date date = new Date();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String format = sdf.format(date);
sql.append("INSERT INTO project( id,prono, proname, type, userno, totalInvestmentAmount,coveredArea, " +
" purpose, brief, leader, address, consCompany, buildCompany, superCompany, designCompany , prospectCompany ,projectImage, leaderPhone )");
sql.append(" VALUES(");
sql.append("'").append(str).append("',");
sql.append("'").append(prono).append("',");
sql.append("'").append(proname).append("',");
sql.append("'").append(type).append("',");
sql.append("'").append(userno).append("',");
sql.append("'").append(totalInvestmentAmount).append("',");
sql.append("'").append(coveredArea).append("',");
sql.append("'").append(purpose).append("',");
sql.append("'").append(brief).append("',");
sql.append("'").append(leader).append("',");
sql.append("'").append(address).append("',");
sql.append("'").append(consCompany).append("',");
sql.append("'").append(buildCompany).append("',");
sql.append("'").append(superCompany).append("',");
sql.append("'").append(designCompany).append("',");
sql.append("'").append(prospectCompany).append("',");
sql.append("'").append(Arrays.toString(projectImage)).append("',");
sql.append("'").append(leaderPhone).append("'");
sql.append(")");
int a=jdbcTemplateCsms.update(sql.toString());
if(a>0){
return str;
}
return null;
}
@Override
public Object projectUpdate(String id, String prono, String proname, String type, String userno, String totalInvestmentAmount,
String coveredArea, String purpose, String brief, String leader, String address, String consCompany, String buildCompany, String superCompany, String designCompany, String prospectCompany, String[] projectImage, String leaderPhone) {
// Date date = new Date();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:SS");
// String format = sdf.format(date);
StringBuffer sql = new StringBuffer();
sql.append("UPDATE project SET ");
if (prono != null && !prono.equals(""))
sql.append(" prono = '").append(prono).append("',");
if (type != null && !type.equals(""))
sql.append(" type = '").append(type).append("',");
if (userno != null && !userno.equals(""))
sql.append(" userno = '").append(userno).append("',");
if (totalInvestmentAmount != null && !totalInvestmentAmount.equals(""))
sql.append(" totalInvestmentAmount = '").append(totalInvestmentAmount).append("',");
if (coveredArea != null && !coveredArea.equals(""))
sql.append(" coveredArea = '").append(coveredArea).append("',");
if (purpose != null && !purpose.equals(""))
sql.append(" purpose = '").append(purpose).append("',");
if (brief != null && !brief.equals(""))
sql.append(" brief = '").append(brief).append("',");
if (leader != null && !leader.equals(""))
sql.append(" leader = '").append(leader).append("',");
if (address != null && !address.equals(""))
sql.append(" address = '").append(address).append("',");
if (consCompany != null && !consCompany.equals(""))
sql.append(" consCompany = '").append(consCompany).append("',");
if (buildCompany != null && !buildCompany.equals(""))
sql.append(" buildCompany = '").append(buildCompany).append("',");
if (superCompany != null && !superCompany.equals(""))
sql.append(" superCompany = '").append(superCompany).append("',");
if (designCompany != null && !designCompany.equals(""))
sql.append(" designCompany = '").append(designCompany).append("',");
if (prospectCompany != null && !prospectCompany.equals(""))
sql.append(" prospectCompany = '").append(prospectCompany).append("',");
if (proname != null && !proname.equals(""))
sql.append(" proname = '").append(proname).append("',");
if (projectImage != null && !projectImage.equals(""))
sql.append(" projectImage = '").append(Arrays.toString(projectImage)).append("',");
if (leaderPhone != null && !leaderPhone.equals(""))
sql.append(" leaderPhone = '").append(leaderPhone).append("',");
sql.append(" id = '").append(id).append("'");
sql.append(" WHERE ID = '").append(id).append("'");
return jdbcTemplateCsms.update(sql.toString());
}
@Override
public Object projectDel(String id) {
StringBuffer sql = new StringBuffer();
sql.append("DELETE FROM project WHERE ID = '").append(id).append("'");
return jdbcTemplateCsms.update(sql.toString());
}
@Override
public int findBtName(String prono) {
StringBuffer sql = new StringBuffer();
sql.append("select count(id) from project where prono ='");
sql.append(prono).append("'");
List<Integer> list = jdbcTemplateCsms.queryForList(sql.toString(), Integer.class);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(0);
}
return 0;
}
@Override
public int findBtName(String prono, String id) {
StringBuffer sql = new StringBuffer();
sql.append("select count(id) from project where prono ='");
sql.append(prono).append("' AND id !='").append(id).append("'");
List<Integer> list = jdbcTemplateCsms.queryForList(sql.toString(), Integer.class);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(0);
}
return 0;
}
@Override
public List<Map<String, Object>> selectProjectList(Integer pageNo, Integer pagesize, String prono, String proname, String type, String userno, String totalInvestmentAmount,
String coveredArea, String purpose, String brief, String leader, String address, String consCompany, String buildCompany, String superCompany, String designCompany, String prospectCompany) {
// TODO Auto-generated method stub
StringBuffer sql = new StringBuffer();
sql.append("SELECT * from project u where 1=1 ");
if (prono != null && !prono.equals("")) {
sql.append(" and u.prono LIKE '%").append(prono).append("%'");
}
if (type != null && !type.equals("")) {
sql.append(" and u.type LIKE '%").append(type).append("%'");
}
if (userno != null && !userno.equals("")) {
sql.append(" and u.userno LIKE '%").append(userno).append("%'");
}
if (totalInvestmentAmount != null && !totalInvestmentAmount.equals("")) {
sql.append(" and u.totalInvestmentAmount LIKE '%").append(totalInvestmentAmount).append("%'");
}
if (coveredArea != null && !coveredArea.equals("")) {
sql.append(" and u.coveredArea LIKE '%").append(coveredArea).append("%'");
}
if (purpose != null && !purpose.equals("")) {
sql.append(" and u.purpose LIKE '%").append(purpose).append("%'");
}
if (brief != null && !brief.equals("")) {
sql.append(" and u.brief LIKE '%").append(brief).append("%'");
}
if (leader != null && !leader.equals("")) {
sql.append(" and u.leader LIKE '%").append(leader).append("%'");
}
if (address != null && !address.equals("")) {
sql.append(" and u.address LIKE '%").append(address).append("%'");
}
if (consCompany != null && !consCompany.equals("")) {
sql.append(" and u.consCompany LIKE '%").append(consCompany).append("%'");
}
if (buildCompany != null && !buildCompany.equals("")) {
sql.append(" and u.buildCompany LIKE '%").append(buildCompany).append("%'");
}
if (superCompany != null && !superCompany.equals("")) {
sql.append(" and u.superCompany LIKE '%").append(superCompany).append("%'");
}
if (designCompany != null && !designCompany.equals("")) {
sql.append(" and u.designCompany LIKE '%").append(designCompany).append("%'");
}
if (prospectCompany != null && !prospectCompany.equals("")) {
sql.append(" and u.prospectCompany LIKE '%").append(prospectCompany).append("%'");
}
if (proname != null && !proname.equals("")) {
sql.append(" and u.proname LIKE '%").append(proname).append("%'");
}
sql.append(" limit " + (pageNo - 1) * pagesize + " , " + pagesize + " ");
return jdbcTemplateCsms.queryForList(sql.toString());
}
@Override
public Integer count(String prono, String proname, String type, String userno, String totalInvestmentAmount,
String coveredArea, String purpose, String brief, String leader, String address, String consCompany, String buildCompany, String superCompany, String designCompany, String prospectCompany) {
// TODO Auto-generated method stub
StringBuffer sql = new StringBuffer();
sql.append("SELECT * from project u where 1=1 ");
if (prono != null && !prono.equals("")) {
sql.append(" and u.prono LIKE '%").append(prono).append("%'");
}
if (type != null && !type.equals("")) {
sql.append(" and u.type LIKE '%").append(type).append("%'");
}
if (userno != null && !userno.equals("")) {
sql.append(" and u.userno LIKE '%").append(userno).append("%'");
}
if (totalInvestmentAmount != null && !totalInvestmentAmount.equals("")) {
sql.append(" and u.totalInvestmentAmount LIKE '%").append(totalInvestmentAmount).append("%'");
}
if (coveredArea != null && !coveredArea.equals("")) {
sql.append(" and u.coveredArea LIKE '%").append(coveredArea).append("%'");
}
if (purpose != null && !purpose.equals("")) {
sql.append(" and u.purpose LIKE '%").append(purpose).append("%'");
}
if (brief != null && !brief.equals("")) {
sql.append(" and u.brief LIKE '%").append(brief).append("%'");
}
if (leader != null && !leader.equals("")) {
sql.append(" and u.leader LIKE '%").append(leader).append("%'");
}
if (address != null && !address.equals("")) {
sql.append(" and u.address LIKE '%").append(address).append("%'");
}
if (consCompany != null && !consCompany.equals("")) {
sql.append(" and u.consCompany LIKE '%").append(consCompany).append("%'");
}
if (buildCompany != null && !buildCompany.equals("")) {
sql.append(" and u.buildCompany LIKE '%").append(buildCompany).append("%'");
}
if (superCompany != null && !superCompany.equals("")) {
sql.append(" and u.superCompany LIKE '%").append(superCompany).append("%'");
}
if (designCompany != null && !designCompany.equals("")) {
sql.append(" and u.designCompany LIKE '%").append(designCompany).append("%'");
}
if (prospectCompany != null && !prospectCompany.equals("")) {
sql.append(" and u.prospectCompany LIKE '%").append(prospectCompany).append("%'");
}
if (proname != null && !proname.equals("")) {
sql.append(" and u.proname LIKE '%").append(proname).append("%'");
}
return jdbcTemplateCsms.queryForList(sql.toString()).size();
}
@Override
public List<Map<String, Object>> selectProject(String id) {
// TODO Auto-generated method stub
StringBuffer sql = new StringBuffer();
sql.append("SELECT * from project u where 1=1 ");
sql.append(" and u.id = '").append(id).append("'");
return jdbcTemplateCsms.queryForList(sql.toString());
}
}
| [
"9251209@qq.cpm"
] | 9251209@qq.cpm |
f7bcda1908c1e407a5e2b1b7dce3d7cfe4aa02d1 | 2df1e1fb0a76de18aeddb8597525ddb8e24d27d4 | /mideaText/src/HeiMa/methodDemo.java | a28f06f32502973df221751502fd0988f7d8e1b5 | [] | no_license | gentlevampire/BasicCode | 01cddefab7dfd7ca119597d59ddfbfb69bbc4824 | 3affae3276a8db9ab0527723c89ea21273a26ae9 | refs/heads/master | 2023-07-17T10:50:25.877728 | 2021-08-31T04:33:02 | 2021-08-31T04:33:02 | 401,572,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,469 | java | package HeiMa;
//import java.util.Scanner;
//public class methodDemo {
// public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
// int number = sc.nextInt();
// method(number);
// }
// public static void method (int num){
// if (num%2 == 0 ){
// System.out.println("偶数");
// } else{
// System.out.println("奇数");
// }
// }
//}
//==================================================================
//public class methodDemo{
// public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
// int first = sc.nextInt();
// Scanner sc2 = new Scanner(System.in);
// int second = sc2.nextInt();
// maxmin(first,second);
// }
// public static void maxmin(int a,int b){
// if (a>b){
// System.out.println("max:"+a);
// }else{
// System.out.println("max:"+b);
// }
// }
//}
//=========带返回值方法定义和调用(掌握)============================================================
public class methodDemo{
public static void main(String[] args) {
int a=method(11);
System.out.println(a);
}
public static int method(int num){
if (num%2 == 0 ){
System.out.println("偶数");
return 0;
} else{
System.out.println("奇数");
return 1;
}
}
}
| [
"2824947115@qq.com"
] | 2824947115@qq.com |
46dfb888fbaae4b2406ab6af7180c5cb6e83113e | 605d4a73d63c659662590b385111278534ddd13e | /project_ltm/android/app/src/debug/java/com/project_ltm/ReactNativeFlipper.java | f5fd05eb4154ab0bfe2510cd74b8427f96cba082 | [] | no_license | vuongmt2000/project_LTM | 2bfacf580cbc6b58265e2f631adc19ed922bc8f2 | 52472f2197b2e280a5e9a6fab086b20bc2959aab | refs/heads/master | 2023-05-11T15:52:43.266399 | 2021-05-28T13:00:32 | 2021-05-28T13:00:32 | 371,699,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,266 | java | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.project_ltm;
import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(
new NetworkingModule.CustomClientBuilder() {
@Override
public void apply(OkHttpClient.Builder builder) {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
}
});
client.addPlugin(networkFlipperPlugin);
client.start();
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
// Hence we run if after all native modules have been initialized
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext == null) {
reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceManager.ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(ReactContext reactContext) {
reactInstanceManager.removeReactInstanceEventListener(this);
reactContext.runOnNativeModulesQueueThread(
new Runnable() {
@Override
public void run() {
client.addPlugin(new FrescoFlipperPlugin());
}
});
}
});
} else {
client.addPlugin(new FrescoFlipperPlugin());
}
}
}
}
| [
"vuongmt2000117@gmail.com"
] | vuongmt2000117@gmail.com |
709261120393b316811087e33907c06f944eb8cd | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/SeverityUpdate.java | c75810ae28874c9e6221e02ca50f59b408b4fc4a | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 20,026 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.securityhub.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Updates to the severity information for a finding.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/securityhub-2018-10-26/SeverityUpdate" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SeverityUpdate implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The normalized severity for the finding. This attribute is to be deprecated in favor of <code>Label</code>.
* </p>
* <p>
* If you provide <code>Normalized</code> and do not provide <code>Label</code>, <code>Label</code> is set
* automatically as follows.
* </p>
* <ul>
* <li>
* <p>
* 0 - <code>INFORMATIONAL</code>
* </p>
* </li>
* <li>
* <p>
* 1–39 - <code>LOW</code>
* </p>
* </li>
* <li>
* <p>
* 40–69 - <code>MEDIUM</code>
* </p>
* </li>
* <li>
* <p>
* 70–89 - <code>HIGH</code>
* </p>
* </li>
* <li>
* <p>
* 90–100 - <code>CRITICAL</code>
* </p>
* </li>
* </ul>
*/
private Integer normalized;
/**
* <p>
* The native severity as defined by the AWS service or integrated partner product that generated the finding.
* </p>
*/
private Double product;
/**
* <p>
* The severity value of the finding. The allowed values are the following.
* </p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* </ul>
*/
private String label;
/**
* <p>
* The normalized severity for the finding. This attribute is to be deprecated in favor of <code>Label</code>.
* </p>
* <p>
* If you provide <code>Normalized</code> and do not provide <code>Label</code>, <code>Label</code> is set
* automatically as follows.
* </p>
* <ul>
* <li>
* <p>
* 0 - <code>INFORMATIONAL</code>
* </p>
* </li>
* <li>
* <p>
* 1–39 - <code>LOW</code>
* </p>
* </li>
* <li>
* <p>
* 40–69 - <code>MEDIUM</code>
* </p>
* </li>
* <li>
* <p>
* 70–89 - <code>HIGH</code>
* </p>
* </li>
* <li>
* <p>
* 90–100 - <code>CRITICAL</code>
* </p>
* </li>
* </ul>
*
* @param normalized
* The normalized severity for the finding. This attribute is to be deprecated in favor of <code>Label</code>
* .</p>
* <p>
* If you provide <code>Normalized</code> and do not provide <code>Label</code>, <code>Label</code> is set
* automatically as follows.
* </p>
* <ul>
* <li>
* <p>
* 0 - <code>INFORMATIONAL</code>
* </p>
* </li>
* <li>
* <p>
* 1–39 - <code>LOW</code>
* </p>
* </li>
* <li>
* <p>
* 40–69 - <code>MEDIUM</code>
* </p>
* </li>
* <li>
* <p>
* 70–89 - <code>HIGH</code>
* </p>
* </li>
* <li>
* <p>
* 90–100 - <code>CRITICAL</code>
* </p>
* </li>
*/
public void setNormalized(Integer normalized) {
this.normalized = normalized;
}
/**
* <p>
* The normalized severity for the finding. This attribute is to be deprecated in favor of <code>Label</code>.
* </p>
* <p>
* If you provide <code>Normalized</code> and do not provide <code>Label</code>, <code>Label</code> is set
* automatically as follows.
* </p>
* <ul>
* <li>
* <p>
* 0 - <code>INFORMATIONAL</code>
* </p>
* </li>
* <li>
* <p>
* 1–39 - <code>LOW</code>
* </p>
* </li>
* <li>
* <p>
* 40–69 - <code>MEDIUM</code>
* </p>
* </li>
* <li>
* <p>
* 70–89 - <code>HIGH</code>
* </p>
* </li>
* <li>
* <p>
* 90–100 - <code>CRITICAL</code>
* </p>
* </li>
* </ul>
*
* @return The normalized severity for the finding. This attribute is to be deprecated in favor of
* <code>Label</code>.</p>
* <p>
* If you provide <code>Normalized</code> and do not provide <code>Label</code>, <code>Label</code> is set
* automatically as follows.
* </p>
* <ul>
* <li>
* <p>
* 0 - <code>INFORMATIONAL</code>
* </p>
* </li>
* <li>
* <p>
* 1–39 - <code>LOW</code>
* </p>
* </li>
* <li>
* <p>
* 40–69 - <code>MEDIUM</code>
* </p>
* </li>
* <li>
* <p>
* 70–89 - <code>HIGH</code>
* </p>
* </li>
* <li>
* <p>
* 90–100 - <code>CRITICAL</code>
* </p>
* </li>
*/
public Integer getNormalized() {
return this.normalized;
}
/**
* <p>
* The normalized severity for the finding. This attribute is to be deprecated in favor of <code>Label</code>.
* </p>
* <p>
* If you provide <code>Normalized</code> and do not provide <code>Label</code>, <code>Label</code> is set
* automatically as follows.
* </p>
* <ul>
* <li>
* <p>
* 0 - <code>INFORMATIONAL</code>
* </p>
* </li>
* <li>
* <p>
* 1–39 - <code>LOW</code>
* </p>
* </li>
* <li>
* <p>
* 40–69 - <code>MEDIUM</code>
* </p>
* </li>
* <li>
* <p>
* 70–89 - <code>HIGH</code>
* </p>
* </li>
* <li>
* <p>
* 90–100 - <code>CRITICAL</code>
* </p>
* </li>
* </ul>
*
* @param normalized
* The normalized severity for the finding. This attribute is to be deprecated in favor of <code>Label</code>
* .</p>
* <p>
* If you provide <code>Normalized</code> and do not provide <code>Label</code>, <code>Label</code> is set
* automatically as follows.
* </p>
* <ul>
* <li>
* <p>
* 0 - <code>INFORMATIONAL</code>
* </p>
* </li>
* <li>
* <p>
* 1–39 - <code>LOW</code>
* </p>
* </li>
* <li>
* <p>
* 40–69 - <code>MEDIUM</code>
* </p>
* </li>
* <li>
* <p>
* 70–89 - <code>HIGH</code>
* </p>
* </li>
* <li>
* <p>
* 90–100 - <code>CRITICAL</code>
* </p>
* </li>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SeverityUpdate withNormalized(Integer normalized) {
setNormalized(normalized);
return this;
}
/**
* <p>
* The native severity as defined by the AWS service or integrated partner product that generated the finding.
* </p>
*
* @param product
* The native severity as defined by the AWS service or integrated partner product that generated the
* finding.
*/
public void setProduct(Double product) {
this.product = product;
}
/**
* <p>
* The native severity as defined by the AWS service or integrated partner product that generated the finding.
* </p>
*
* @return The native severity as defined by the AWS service or integrated partner product that generated the
* finding.
*/
public Double getProduct() {
return this.product;
}
/**
* <p>
* The native severity as defined by the AWS service or integrated partner product that generated the finding.
* </p>
*
* @param product
* The native severity as defined by the AWS service or integrated partner product that generated the
* finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SeverityUpdate withProduct(Double product) {
setProduct(product);
return this;
}
/**
* <p>
* The severity value of the finding. The allowed values are the following.
* </p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* </ul>
*
* @param label
* The severity value of the finding. The allowed values are the following.</p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* @see SeverityLabel
*/
public void setLabel(String label) {
this.label = label;
}
/**
* <p>
* The severity value of the finding. The allowed values are the following.
* </p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* </ul>
*
* @return The severity value of the finding. The allowed values are the following.</p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* @see SeverityLabel
*/
public String getLabel() {
return this.label;
}
/**
* <p>
* The severity value of the finding. The allowed values are the following.
* </p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* </ul>
*
* @param label
* The severity value of the finding. The allowed values are the following.</p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* @return Returns a reference to this object so that method calls can be chained together.
* @see SeverityLabel
*/
public SeverityUpdate withLabel(String label) {
setLabel(label);
return this;
}
/**
* <p>
* The severity value of the finding. The allowed values are the following.
* </p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* </ul>
*
* @param label
* The severity value of the finding. The allowed values are the following.</p>
* <ul>
* <li>
* <p>
* <code>INFORMATIONAL</code> - No issue was found.
* </p>
* </li>
* <li>
* <p>
* <code>LOW</code> - The issue does not require action on its own.
* </p>
* </li>
* <li>
* <p>
* <code>MEDIUM</code> - The issue must be addressed but not urgently.
* </p>
* </li>
* <li>
* <p>
* <code>HIGH</code> - The issue must be addressed as a priority.
* </p>
* </li>
* <li>
* <p>
* <code>CRITICAL</code> - The issue must be remediated immediately to avoid it escalating.
* </p>
* </li>
* @return Returns a reference to this object so that method calls can be chained together.
* @see SeverityLabel
*/
public SeverityUpdate withLabel(SeverityLabel label) {
this.label = label.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getNormalized() != null)
sb.append("Normalized: ").append(getNormalized()).append(",");
if (getProduct() != null)
sb.append("Product: ").append(getProduct()).append(",");
if (getLabel() != null)
sb.append("Label: ").append(getLabel());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SeverityUpdate == false)
return false;
SeverityUpdate other = (SeverityUpdate) obj;
if (other.getNormalized() == null ^ this.getNormalized() == null)
return false;
if (other.getNormalized() != null && other.getNormalized().equals(this.getNormalized()) == false)
return false;
if (other.getProduct() == null ^ this.getProduct() == null)
return false;
if (other.getProduct() != null && other.getProduct().equals(this.getProduct()) == false)
return false;
if (other.getLabel() == null ^ this.getLabel() == null)
return false;
if (other.getLabel() != null && other.getLabel().equals(this.getLabel()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getNormalized() == null) ? 0 : getNormalized().hashCode());
hashCode = prime * hashCode + ((getProduct() == null) ? 0 : getProduct().hashCode());
hashCode = prime * hashCode + ((getLabel() == null) ? 0 : getLabel().hashCode());
return hashCode;
}
@Override
public SeverityUpdate clone() {
try {
return (SeverityUpdate) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.securityhub.model.transform.SeverityUpdateMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
17a5c1253953a7a87d19619a072a54a0fc2ae9bd | 3ab91edbf69c79e7da396dc669fcece87d854d91 | /String/StringComparePerformance.java | 34d19e36f00399d7fe4f3c7b4dd4f821e3024bcf | [] | no_license | houjunchao/JavaSource | e5208e135b4806e901bea7fe9dd0f9ee85ecb947 | 37f443867b32bc2e5314e7a34f46ae38f594ac3c | refs/heads/master | 2020-08-24T07:22:48.673875 | 2019-11-08T06:05:55 | 2019-11-08T06:05:55 | 216,783,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 861 | java | /**以下实例演示了通过两种方式创建字符串,并测试其性能
*/
public class StringComparePerformance{
public static void main(String[] args){
long startTime = System.currentTimeMillis();
for(int i=0;i<50000;i++){
String s1 = "hello";
String s2 = "hello";
}
long endTime = System.currentTimeMillis();
System.out.println("通过 String 关键词创建字符串"
+ " : "+ (endTime - startTime)
+ " 毫秒" );
long startTime1 = System.currentTimeMillis();
for(int i=0;i<50000;i++){
String s3 = new String("hello");
String s4 = new String("hello");
}
long endTime1 = System.currentTimeMillis();
System.out.println("通过 String 对象创建字符串"
+ " : " + (endTime1 - startTime1)
+ " 毫秒");
}
}
| [
"junchaohou9@gmail.com"
] | junchaohou9@gmail.com |
0311cc9bb93467dcd491696ac5367050b9c9af0d | 67d5f04e9cf01001e172fa3bb81aa45321329203 | /src/test/java/io/github/jhipster/application/web/rest/UserResourceIntTest.java | 665ffc21775d1acd0d7579ed43a282d75dab57cf | [] | no_license | jianglin1008/uaaServer | cd1a85f9e9ae564b2353c39490f82f52cd1328d3 | f9ce1113ef83db5d8fb83e9779d80514e0142b30 | refs/heads/master | 2021-08-14T09:53:09.138846 | 2017-11-15T09:04:46 | 2017-11-15T09:04:46 | 110,809,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,766 | java | package io.github.jhipster.application.web.rest;
import io.github.jhipster.application.UaaServerApp;
import io.github.jhipster.application.domain.Authority;
import io.github.jhipster.application.domain.User;
import io.github.jhipster.application.repository.UserRepository;
import io.github.jhipster.application.security.AuthoritiesConstants;
import io.github.jhipster.application.service.MailService;
import io.github.jhipster.application.service.UserService;
import io.github.jhipster.application.service.dto.UserDTO;
import io.github.jhipster.application.service.mapper.UserMapper;
import io.github.jhipster.application.web.rest.errors.ExceptionTranslator;
import io.github.jhipster.application.web.rest.vm.ManagedUserVM;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the UserResource REST controller.
*
* @see UserResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = UaaServerApp.class)
public class UserResourceIntTest {
private static final Long DEFAULT_ID = 1L;
private static final String DEFAULT_LOGIN = "johndoe";
private static final String UPDATED_LOGIN = "jhipster";
private static final String DEFAULT_PASSWORD = "passjohndoe";
private static final String UPDATED_PASSWORD = "passjhipster";
private static final String DEFAULT_EMAIL = "johndoe@localhost";
private static final String UPDATED_EMAIL = "jhipster@localhost";
private static final String DEFAULT_FIRSTNAME = "john";
private static final String UPDATED_FIRSTNAME = "jhipsterFirstName";
private static final String DEFAULT_LASTNAME = "doe";
private static final String UPDATED_LASTNAME = "jhipsterLastName";
private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50";
private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40";
private static final String DEFAULT_LANGKEY = "en";
private static final String UPDATED_LANGKEY = "fr";
@Autowired
private UserRepository userRepository;
@Autowired
private MailService mailService;
@Autowired
private UserService userService;
@Autowired
private UserMapper userMapper;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
private MockMvc restUserMockMvc;
private User user;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
UserResource userResource = new UserResource(userRepository, userService, mailService);
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter)
.build();
}
/**
* Create a User.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which has a required relationship to the User entity.
*/
public static User createEntity(EntityManager em) {
User user = new User();
user.setLogin(DEFAULT_LOGIN + RandomStringUtils.randomAlphabetic(5));
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL);
user.setFirstName(DEFAULT_FIRSTNAME);
user.setLastName(DEFAULT_LASTNAME);
user.setImageUrl(DEFAULT_IMAGEURL);
user.setLangKey(DEFAULT_LANGKEY);
return user;
}
@Before
public void initTest() {
user = createEntity(em);
user.setLogin(DEFAULT_LOGIN);
user.setEmail(DEFAULT_EMAIL);
}
@Test
@Transactional
public void createUser() throws Exception {
int databaseSizeBeforeCreate = userRepository.findAll().size();
// Create the User
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.USER);
ManagedUserVM managedUserVM = new ManagedUserVM(
null,
DEFAULT_LOGIN,
DEFAULT_PASSWORD,
DEFAULT_FIRSTNAME,
DEFAULT_LASTNAME,
DEFAULT_EMAIL,
true,
DEFAULT_IMAGEURL,
DEFAULT_LANGKEY,
null,
null,
null,
null,
authorities);
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isCreated());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate + 1);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
}
@Test
@Transactional
public void createUserWithExistingId() throws Exception {
int databaseSizeBeforeCreate = userRepository.findAll().size();
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.USER);
ManagedUserVM managedUserVM = new ManagedUserVM(
1L,
DEFAULT_LOGIN,
DEFAULT_PASSWORD,
DEFAULT_FIRSTNAME,
DEFAULT_LASTNAME,
DEFAULT_EMAIL,
true,
DEFAULT_IMAGEURL,
DEFAULT_LANGKEY,
null,
null,
null,
null,
authorities);
// An entity with an existing ID cannot be created, so this API call must fail
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void createUserWithExistingLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.USER);
ManagedUserVM managedUserVM = new ManagedUserVM(
null,
DEFAULT_LOGIN, // this login should already be used
DEFAULT_PASSWORD,
DEFAULT_FIRSTNAME,
DEFAULT_LASTNAME,
"anothermail@localhost",
true,
DEFAULT_IMAGEURL,
DEFAULT_LANGKEY,
null,
null,
null,
null,
authorities);
// Create the User
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void createUserWithExistingEmail() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.USER);
ManagedUserVM managedUserVM = new ManagedUserVM(
null,
"anotherlogin",
DEFAULT_PASSWORD,
DEFAULT_FIRSTNAME,
DEFAULT_LASTNAME,
DEFAULT_EMAIL, // this email should already be used
true,
DEFAULT_IMAGEURL,
DEFAULT_LANGKEY,
null,
null,
null,
null,
authorities);
// Create the User
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void getAllUsers() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
// Get all the users
restUserMockMvc.perform(get("/api/users?sort=id,desc")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN)))
.andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME)))
.andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME)))
.andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL)))
.andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL)))
.andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY)));
}
@Test
@Transactional
public void getUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
// Get the user
restUserMockMvc.perform(get("/api/users/{login}", user.getLogin()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.login").value(user.getLogin()))
.andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME))
.andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME))
.andExpect(jsonPath("$.email").value(DEFAULT_EMAIL))
.andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL))
.andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY));
}
@Test
@Transactional
public void getNonExistingUser() throws Exception {
restUserMockMvc.perform(get("/api/users/unknown"))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeUpdate = userRepository.findAll().size();
// Update the user
User updatedUser = userRepository.findOne(user.getId());
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.USER);
ManagedUserVM managedUserVM = new ManagedUserVM(
updatedUser.getId(),
updatedUser.getLogin(),
UPDATED_PASSWORD,
UPDATED_FIRSTNAME,
UPDATED_LASTNAME,
UPDATED_EMAIL,
updatedUser.getActivated(),
UPDATED_IMAGEURL,
UPDATED_LANGKEY,
updatedUser.getCreatedBy(),
updatedUser.getCreatedDate(),
updatedUser.getLastModifiedBy(),
updatedUser.getLastModifiedDate(),
authorities);
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isOk());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeUpdate);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY);
}
@Test
@Transactional
public void updateUserLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeUpdate = userRepository.findAll().size();
// Update the user
User updatedUser = userRepository.findOne(user.getId());
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.USER);
ManagedUserVM managedUserVM = new ManagedUserVM(
updatedUser.getId(),
UPDATED_LOGIN,
UPDATED_PASSWORD,
UPDATED_FIRSTNAME,
UPDATED_LASTNAME,
UPDATED_EMAIL,
updatedUser.getActivated(),
UPDATED_IMAGEURL,
UPDATED_LANGKEY,
updatedUser.getCreatedBy(),
updatedUser.getCreatedDate(),
updatedUser.getLastModifiedBy(),
updatedUser.getLastModifiedDate(),
authorities);
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isOk());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeUpdate);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN);
assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY);
}
@Test
@Transactional
public void updateUserExistingEmail() throws Exception {
// Initialize the database with 2 users
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("jhipster");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
anotherUser.setEmail("jhipster@localhost");
anotherUser.setFirstName("java");
anotherUser.setLastName("hipster");
anotherUser.setImageUrl("");
anotherUser.setLangKey("en");
userRepository.saveAndFlush(anotherUser);
// Update the user
User updatedUser = userRepository.findOne(user.getId());
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.USER);
ManagedUserVM managedUserVM = new ManagedUserVM(
updatedUser.getId(),
updatedUser.getLogin(),
updatedUser.getPassword(),
updatedUser.getFirstName(),
updatedUser.getLastName(),
"jhipster@localhost", // this email should already be used by anotherUser
updatedUser.getActivated(),
updatedUser.getImageUrl(),
updatedUser.getLangKey(),
updatedUser.getCreatedBy(),
updatedUser.getCreatedDate(),
updatedUser.getLastModifiedBy(),
updatedUser.getLastModifiedDate(),
authorities);
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void updateUserExistingLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("jhipster");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
anotherUser.setEmail("jhipster@localhost");
anotherUser.setFirstName("java");
anotherUser.setLastName("hipster");
anotherUser.setImageUrl("");
anotherUser.setLangKey("en");
userRepository.saveAndFlush(anotherUser);
// Update the user
User updatedUser = userRepository.findOne(user.getId());
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.USER);
ManagedUserVM managedUserVM = new ManagedUserVM(
updatedUser.getId(),
"jhipster", // this login should already be used by anotherUser
updatedUser.getPassword(),
updatedUser.getFirstName(),
updatedUser.getLastName(),
updatedUser.getEmail(),
updatedUser.getActivated(),
updatedUser.getImageUrl(),
updatedUser.getLangKey(),
updatedUser.getCreatedBy(),
updatedUser.getCreatedDate(),
updatedUser.getLastModifiedBy(),
updatedUser.getLastModifiedDate(),
authorities);
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void deleteUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeDelete = userRepository.findAll().size();
// Delete the user
restUserMockMvc.perform(delete("/api/users/{login}", user.getLogin())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate the database is empty
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void getAllAuthorities() throws Exception {
restUserMockMvc.perform(get("/api/users/authorities")
.accept(TestUtil.APPLICATION_JSON_UTF8)
.contentType(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$").value(containsInAnyOrder(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)));
}
@Test
@Transactional
public void testUserEquals() throws Exception {
TestUtil.equalsVerifier(User.class);
User user1 = new User();
user1.setId(1L);
User user2 = new User();
user2.setId(user1.getId());
assertThat(user1).isEqualTo(user2);
user2.setId(2L);
assertThat(user1).isNotEqualTo(user2);
user1.setId(null);
assertThat(user1).isNotEqualTo(user2);
}
@Test
public void testUserFromId() {
assertThat(userMapper.userFromId(DEFAULT_ID).getId()).isEqualTo(DEFAULT_ID);
assertThat(userMapper.userFromId(null)).isNull();
}
@Test
public void testUserDTOtoUser() {
UserDTO userDTO = new UserDTO(
DEFAULT_ID,
DEFAULT_LOGIN,
DEFAULT_FIRSTNAME,
DEFAULT_LASTNAME,
DEFAULT_EMAIL,
true,
DEFAULT_IMAGEURL,
DEFAULT_LANGKEY,
DEFAULT_LOGIN,
null,
DEFAULT_LOGIN,
null,
Stream.of(AuthoritiesConstants.USER).collect(Collectors.toSet()));
User user = userMapper.userDTOToUser(userDTO);
assertThat(user.getId()).isEqualTo(DEFAULT_ID);
assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(user.getActivated()).isEqualTo(true);
assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
assertThat(user.getCreatedBy()).isNull();
assertThat(user.getCreatedDate()).isNotNull();
assertThat(user.getLastModifiedBy()).isNull();
assertThat(user.getLastModifiedDate()).isNotNull();
assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER);
}
@Test
public void testUserToUserDTO() {
user.setId(DEFAULT_ID);
user.setCreatedBy(DEFAULT_LOGIN);
user.setCreatedDate(Instant.now());
user.setLastModifiedBy(DEFAULT_LOGIN);
user.setLastModifiedDate(Instant.now());
Set<Authority> authorities = new HashSet<>();
Authority authority = new Authority();
authority.setName(AuthoritiesConstants.USER);
authorities.add(authority);
user.setAuthorities(authorities);
UserDTO userDTO = userMapper.userToUserDTO(user);
assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID);
assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(userDTO.isActivated()).isEqualTo(true);
assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate());
assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate());
assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER);
assertThat(userDTO.toString()).isNotNull();
}
@Test
public void testAuthorityEquals() throws Exception {
Authority authorityA = new Authority();
assertThat(authorityA).isEqualTo(authorityA);
assertThat(authorityA).isNotEqualTo(null);
assertThat(authorityA).isNotEqualTo(new Object());
assertThat(authorityA.hashCode()).isEqualTo(0);
assertThat(authorityA.toString()).isNotNull();
Authority authorityB = new Authority();
assertThat(authorityA).isEqualTo(authorityB);
authorityB.setName(AuthoritiesConstants.ADMIN);
assertThat(authorityA).isNotEqualTo(authorityB);
authorityA.setName(AuthoritiesConstants.USER);
assertThat(authorityA).isNotEqualTo(authorityB);
authorityB.setName(AuthoritiesConstants.USER);
assertThat(authorityA).isEqualTo(authorityB);
assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode());
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
2cd1f21a0c533b729c9dbafe6049a2148d18603d | d4215204ab399cbe91d422b74252b4b269da0d91 | /src/test/java/com/nowcoder/community/community/CommunityApplicationTests.java | b58d8b7fbec8442ea8d45c589e6578e4469f2802 | [] | no_license | linghaowind/test | 1c53c9206bb73b1908d8a3f66df99fa4ceb3ce15 | e5afad2c99a8355957ee70e943bd1cd9be02b7a3 | refs/heads/master | 2023-04-02T15:28:01.828705 | 2021-03-28T09:54:45 | 2021-03-28T09:54:45 | 352,287,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,299 | java | package com.nowcoder.community.community;
import com.nowcoder.community.community.dao.AlphaDao;
import com.nowcoder.community.community.service.AlphaService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import java.text.SimpleDateFormat;
@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = CommunityApplication.class) //将该类作为配置类
public class CommunityApplicationTests implements ApplicationContextAware {
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Test
public void testApplicationContext(){
System.out.println(applicationContext);
AlphaDao alphaDao1 =applicationContext.getBean(AlphaDao.class);
System.out.println(alphaDao1.Select());
AlphaDao alphaDao =applicationContext.getBean("alphaHibernate",AlphaDao.class);
System.out.println(alphaDao.Select());
}
@Test
public void testBeanManager(){
AlphaService alphaService = applicationContext.getBean(AlphaService.class);
System.out.println(alphaService);
}
@Test
public void testBeanConfig(){
SimpleDateFormat simpleDateFormat = applicationContext.getBean(SimpleDateFormat.class);
System.out.println(simpleDateFormat);
}
@Autowired
@Qualifier("alphaHibernate")
private AlphaDao alphaDao;
@Autowired
private SimpleDateFormat simpleDateFormat;
@Test
public void testDI(){
System.out.println(alphaDao);
System.out.println("时间是:"+simpleDateFormat);
}
}
| [
"1468727950@qq.com"
] | 1468727950@qq.com |
0164c2bd1675d747d874d1d9445b779a9349d388 | 377405a1eafa3aa5252c48527158a69ee177752f | /src/com/biznessapps/common/activities/CommonShareableTabFragmentActivity.java | 1e95eda15a9a8b64e4cd5e164895ceb28858f989 | [] | no_license | apptology/AltFuelFinder | 39c15448857b6472ee72c607649ae4de949beb0a | 5851be78af47d1d6fcf07f9a4ad7f9a5c4675197 | refs/heads/master | 2016-08-12T04:00:46.440301 | 2015-10-25T18:25:16 | 2015-10-25T18:25:16 | 44,921,258 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.biznessapps.common.activities;
import android.content.Intent;
import com.biznessapps.common.social.SocialNetworkManager;
// Referenced classes of package com.biznessapps.common.activities:
// CommonTabFragmentActivity
public abstract class CommonShareableTabFragmentActivity extends CommonTabFragmentActivity
{
public CommonShareableTabFragmentActivity()
{
}
protected void onActivityResult(int i, int j, Intent intent)
{
super.onActivityResult(i, j, intent);
SocialNetworkManager.getInstance(this).onActivityResult(i, j, intent);
}
protected void onPause()
{
super.onPause();
SocialNetworkManager.getInstance(this).onPause(this);
}
protected void onResume()
{
SocialNetworkManager.getInstance(this).onResume(this);
super.onResume();
}
}
| [
"rich.foreman@apptology.com"
] | rich.foreman@apptology.com |
642e88adfcad7350ba22450fbbf1b97fd673bd17 | ac82c09fd704b2288cef8342bde6d66f200eeb0d | /projects/OG-Core/src/main/java/com/opengamma/core/position/impl/RemotePositionSource.java | 381db88e9977b505461fde743e66c20634db1131 | [
"Apache-2.0"
] | permissive | cobaltblueocean/OG-Platform | 88f1a6a94f76d7f589fb8fbacb3f26502835d7bb | 9b78891139503d8c6aecdeadc4d583b23a0cc0f2 | refs/heads/master | 2021-08-26T00:44:27.315546 | 2018-02-23T20:12:08 | 2018-02-23T20:12:08 | 241,467,299 | 0 | 2 | Apache-2.0 | 2021-08-02T17:20:41 | 2020-02-18T21:05:35 | Java | UTF-8 | Java | false | false | 3,797 | java | /**
* Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.core.position.impl;
import java.net.URI;
import com.opengamma.core.change.BasicChangeManager;
import com.opengamma.core.change.ChangeManager;
import com.opengamma.core.position.Portfolio;
import com.opengamma.core.position.PortfolioNode;
import com.opengamma.core.position.Position;
import com.opengamma.core.position.PositionSource;
import com.opengamma.core.position.Trade;
import com.opengamma.id.ObjectId;
import com.opengamma.id.UniqueId;
import com.opengamma.id.VersionCorrection;
import com.opengamma.util.ArgumentChecker;
import com.opengamma.util.rest.AbstractRemoteClient;
/**
* Provides remote access to an {@link PositionSource}.
*/
public class RemotePositionSource extends AbstractRemoteClient implements PositionSource {
/**
* The change manager.
*/
private final ChangeManager _changeManager;
/**
* Creates an instance.
*
* @param baseUri the base target URI for all RESTful web services, not null
*/
public RemotePositionSource(final URI baseUri) {
this(baseUri, new BasicChangeManager());
}
/**
* Creates an instance.
*
* @param baseUri the base target URI for all RESTful web services, not null
* @param changeManager the change manager, not null
*/
public RemotePositionSource(final URI baseUri, final ChangeManager changeManager) {
super(baseUri);
ArgumentChecker.notNull(changeManager, "changeManager");
_changeManager = changeManager;
}
//-------------------------------------------------------------------------
@Override
public Portfolio getPortfolio(final UniqueId uniqueId, final VersionCorrection versionCorrection) {
ArgumentChecker.notNull(uniqueId, "uniqueId");
ArgumentChecker.notNull(versionCorrection, "versionCorrection");
URI uri = DataPositionSourceResource.uriGetPortfolio(getBaseUri(), uniqueId);
return accessRemote(uri).get(Portfolio.class);
}
@Override
public Portfolio getPortfolio(final ObjectId objectId, final VersionCorrection versionCorrection) {
ArgumentChecker.notNull(objectId, "objectId");
ArgumentChecker.notNull(versionCorrection, "versionCorrection");
URI uri = DataPositionSourceResource.uriGetPortfolio(getBaseUri(), objectId, versionCorrection);
return accessRemote(uri).get(Portfolio.class);
}
@Override
public PortfolioNode getPortfolioNode(final UniqueId uniqueId, final VersionCorrection versionCorrection) {
ArgumentChecker.notNull(uniqueId, "uniqueId");
ArgumentChecker.notNull(versionCorrection, "versionCorrection");
URI uri = DataPositionSourceResource.uriGetNode(getBaseUri(), uniqueId);
return accessRemote(uri).get(PortfolioNode.class);
}
@Override
public Position getPosition(UniqueId uniqueId) {
ArgumentChecker.notNull(uniqueId, "uniqueId");
URI uri = DataPositionSourceResource.uriGetPosition(getBaseUri(), uniqueId);
return accessRemote(uri).get(Position.class);
}
@Override
public Position getPosition(final ObjectId objectId, final VersionCorrection versionCorrection) {
ArgumentChecker.notNull(objectId, "objectId");
ArgumentChecker.notNull(versionCorrection, "versionCorrection");
URI uri = DataPositionSourceResource.uriGetPosition(getBaseUri(), objectId, versionCorrection);
return accessRemote(uri).get(Position.class);
}
@Override
public Trade getTrade(UniqueId uniqueId) {
ArgumentChecker.notNull(uniqueId, "uniqueId");
URI uri = DataPositionSourceResource.uriGetTrade(getBaseUri(), uniqueId);
return accessRemote(uri).get(Trade.class);
}
@Override
public ChangeManager changeManager() {
return _changeManager;
}
}
| [
"cobaltblue.ocean@gmail.com"
] | cobaltblue.ocean@gmail.com |
ca0a5a6d01b46c64607269543eb252961e3edb85 | 157cc1b35bbee95f890260c3bfe1d3b924cb9b0d | /src/Services/ServiceNiveau.java | 6148b0006b581a8a6125529cfacfd92064921b06 | [] | no_license | Samous-X/PiDev | 052508523b88a273aab737c1a08490ea3087bf61 | dfdf40ce0b4d980fcb42f062a5758424f2864c21 | refs/heads/master | 2020-12-29T16:02:53.138361 | 2020-02-20T05:17:32 | 2020-02-20T05:17:32 | 238,661,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 268 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Services;
/**
*
* @author chadi
*/
public class ServiceNiveau {
}
| [
"49171544+chadiznina@users.noreply.github.com"
] | 49171544+chadiznina@users.noreply.github.com |
fe1c4184d56539c6046cde18c2139fc51d8f816b | acf5d4defdf8d4559a7fbc13e53a5f5f5222480e | /Taoism/src/com/df/action/reply/StudentReplyAction.java | c38da40afa7a1257ec4a6e35285d35c5fca7e084 | [] | no_license | wing1993/MyRepository | e66f8c28c93619dfca0d46690c087487f915b5aa | 89404f7fc421467580f5fae858d82848676d2b14 | refs/heads/master | 2020-05-21T20:40:02.195821 | 2017-04-27T05:29:12 | 2017-04-27T05:29:12 | 64,289,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | package com.df.action.reply;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.RequestAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.df.dao.pojo.Question;
import com.df.dao.pojo.StudentReply;
import com.df.dao.pojo.User;
import com.df.service.iservice.IReplyService;
import com.opensymphony.xwork2.ModelDriven;
@Controller("studentReplyAction")
@Scope("prototype")
public class StudentReplyAction implements Serializable, ModelDriven<StudentReply>,RequestAware{
private static final long serialVersionUID = 1L;
@Autowired
@Qualifier("ReplyService")
private IReplyService<Object> studentReplyService;
private StudentReply studentReply ;
private Map<String, Object> requestMap;
private Question question = (Question) ServletActionContext.getRequest()
.getSession().getAttribute("fromActions");
public String save() {
return studentReplyService.save(studentReply,question);
}
public String delete() {
return studentReplyService.delete(studentReply,question);
}
@Override
public StudentReply getModel() {
studentReply = new StudentReply();
return studentReply;
}
@Override
public void setRequest(Map<String, Object> arg0) {
requestMap = arg0;
}
}
| [
"625176360@qq.com"
] | 625176360@qq.com |
cf89fbfa0611e5304e60089ae8b0cabf09f0cfab | ae243759e444183e9cbf91280cb58f65da272dd4 | /app/src/main/java/com/example/hyg/amap2/TestActivity.java | 40ad825c1cb7f4c2172024f7bc52b0d483192c55 | [] | no_license | zhaochun/smart_drive_app | f0fb80ab1b868b19fd54fe81493f2de7a902e9e4 | 713600c9312d68dff3e5e4d272def70707e4b984 | refs/heads/master | 2021-01-12T08:04:56.910085 | 2016-12-22T06:50:41 | 2016-12-22T06:50:41 | 77,118,285 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,867 | java | package com.example.hyg.amap2;
/**
* Created by hyg on 2016/12/16.
*/
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.util.Log;
import android.widget.EditText;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import static android.content.ContentValues.TAG;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.graphics.BitmapFactory;
import android.util.Pair;
import android.view.animation.LinearInterpolator;
import android.widget.Toast;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.AMap;
import com.amap.api.maps.AMapOptions;
import com.amap.api.maps.LocationSource;
import com.amap.api.maps.MapView;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.LatLngBounds;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.maps.model.Poi;
import com.amap.api.maps.overlay.PoiOverlay;
import com.amap.api.services.core.LatLonPoint;
import com.amap.api.services.core.PoiItem;
import com.amap.api.services.core.SuggestionCity;
import com.amap.api.services.help.Inputtips;
import com.amap.api.services.help.InputtipsQuery;
import com.amap.api.services.help.Tip;
import com.amap.api.services.poisearch.PoiResult;
import com.amap.api.services.poisearch.PoiSearch;
import com.amap.api.services.route.BusRouteResult;
import com.amap.api.services.route.DriveRouteResult;
import com.amap.api.services.route.RideRouteResult;
import com.amap.api.services.route.RouteSearch;
import com.amap.api.services.route.WalkRouteResult;
import java.util.List;
import static android.content.ContentValues.TAG;
/**
* Created by hyg on 2016/12/9.
*/
public class TestActivity extends Activity implements LocationSource, AMapLocationListener,RouteSearch.OnRouteSearchListener,
PoiSearch.OnPoiSearchListener,
Inputtips.InputtipsListener{
private MapView mapView;
private AMap amap;
private UiSettings uiSettings;
private LocationSource.OnLocationChangedListener mListener;
private AMapLocationClient mLocationClient;
private AMapLocationClientOption mLocationOption;
private EditText et1;
// LatLonPoint start;
boolean hasLocation ;
Context context1;
Context context2;
Integer ZoomLevel = 14;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//设置对应的布局文件
setContentView(R.layout.activity_location);
mapView = (MapView) findViewById(R.id.map1);
mapView.onCreate(savedInstanceState);
et1 = (EditText)findViewById(R.id.et1) ;
context1 = this;
init();
baseSetting();
//setMarker();
//searchFor();
}
PoiSearch.Query query;
private void searchFor() {
String st = et1.toString();
PoiSearch.Query query = new PoiSearch.Query(st,"","021");
//keyWord表示搜索字符串,
//第二个参数表示POI搜索类型,二者选填其一,
//POI搜索类型共分为以下20种:汽车服务|汽车销售|
//汽车维修|摩托车服务|餐饮服务|购物服务|生活服务|体育休闲服务|医疗保健服务|
//住宿服务|风景名胜|商务住宅|政府机构及社会团体|科教文化服务|交通设施服务|
//金融保险服务|公司企业|道路附属设施|地名地址信息|公共设施
//cityCode表示POI搜索区域,可以是城市编码也可以是城市名称,也可以传空字符串,空字符串代表全国在全国范围内进行搜索
query.setPageSize(10);// 设置每页最多返回多少条poiitem
query.setPageNum(1);//设置查询页码
PoiSearch poiSearch = new PoiSearch(this, query);
poiSearch.setOnPoiSearchListener(this);
poiSearch.searchPOIAsyn();
InputtipsQuery inputQuery = new InputtipsQuery(st,"021");
inputQuery.setCityLimit(true);
Inputtips inputtips= new Inputtips(TestActivity.this,inputQuery);
inputtips.setInputtipsListener(this);
inputtips.requestInputtipsAsyn();
}
private void init() {
hasLocation =true;
if (amap ==null){
amap = mapView.getMap();
}
uiSettings = amap.getUiSettings();
Log.e(TAG, "uiSettings: "+uiSettings );
}
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
super.onSaveInstanceState(outState, outPersistentState);
mapView.onSaveInstanceState(outState);
}
private void baseSetting() {
context2= this; //为什么this都不一样呢??
amap.setMapType(AMap.MAP_TYPE_NORMAL); //设置地图模式
amap.setTrafficEnabled(true); //设置交通情况
uiSettings.setCompassEnabled(true); //设置指南针显示
uiSettings.setLogoPosition(AMapOptions.LOGO_POSITION_BOTTOM_CENTER); //设置高德地图的图标
uiSettings.setScaleControlsEnabled(true); //设置比例尺显示
amap.setLocationSource(this);// 设置定位监听
uiSettings.setMyLocationButtonEnabled(true); // 是否显示默认的定位按钮
amap.setMyLocationEnabled(true);// 是否可触发定位并显示定位层
//设置routeSearch对象和其数据回调监听
RouteSearch routeSearch = new RouteSearch(context1);
routeSearch.setRouteSearchListener(this); //这边这个listener是需要添加接口OnRouteSearchListener ,然后才能通过this来获得
}
@Override
protected void onResume() {
super.onResume();
mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
mapView.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
}
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if (mListener != null && aMapLocation != null) {
//进入后的情况
mListener.onLocationChanged(aMapLocation);
if (aMapLocation!=null &&aMapLocation.getErrorCode()==0){
// amap.moveCamera(CameraUpdateFactory.zoomTo(ZoomLevel));
}else{
//amap.moveCamera(CameraUpdateFactory.zoomTo(15));
}
}else {
String errText = "定位失败,"+aMapLocation.getErrorCode()+":"+aMapLocation.getErrorInfo();
Log.e("AmapErr",errText);
}
}
@Override
public void activate(OnLocationChangedListener listener) {
mListener = listener;
if (mLocationClient ==null){
mLocationClient = new AMapLocationClient(this);
mLocationOption = new AMapLocationClientOption();
//设置定位监听
mLocationClient.setLocationListener(this);
//设置为高精度定位模式
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//设置定位参数
mLocationClient.setLocationOption(mLocationOption);
mLocationClient.startLocation();
}
}
@Override
public void deactivate() {
mListener = null;
if (mLocationClient!=null){
mLocationClient.stopLocation();
mLocationClient.onDestroy();
}
mLocationClient = null;
}
@Override
public void onBusRouteSearched(BusRouteResult busRouteResult, int i) {
}
@Override
public void onDriveRouteSearched(DriveRouteResult driveRouteResult, int i) {
}
@Override
public void onWalkRouteSearched(WalkRouteResult walkRouteResult, int i) {
}
@Override
public void onRideRouteSearched(RideRouteResult rideRouteResult, int i) {
}
List<Marker> markers = new ArrayList<>();
List<PoiItem> poiItems = new ArrayList<>();
@Override
public void onPoiSearched(PoiResult result, int rCode) {
PoiResult poiResult;
if (rCode ==1000){
if (result !=null &&result.getQuery()!=null){
if (result.getQuery().equals(query)){
//取得搜索到的poiitems有多少页
List<SuggestionCity> suggestionCities = result.getSearchSuggestionCitys();
if (poiItems!=null &&poiItems.size()>0){
amap.clear();
PoiOverlay poiOverlay = new PoiOverlay(amap,poiItems);
poiOverlay.removeFromMap();
poiOverlay.addToMap();
poiOverlay.zoomToSpan();
}else if (suggestionCities!=null &&suggestionCities.size()>0){
//showSuggestCity(suggestionCities); 这里是个新的方法,专门用来显示提示的城市信息的
}else {
Log.e("SuggestionCity", "onPoiSearched: "+suggestionCities );
}
}
}
}else {
Log.e("SearchForErr", "AnyErr " );
}
}
@Override
public void onPoiItemSearched(PoiItem poiItem, int rCode) {
if (rCode==1000){
if (poiItem !=null){
PoiItem mPoi;
mPoi =poiItem;
}
}
}
@Override
public void onGetInputtips(List<Tip> list, int rCode) {
if (rCode ==1000){
List<HashMap<String,String>> listString = new ArrayList<HashMap<String, String>>();
for (int i=0;i<list.size();i++){
HashMap<String,String > map = new HashMap<String,String>();
map.put("name",list.get(i).getName());
map.put("address",list.get(i).getDistrict());
listString.add(map);
}
SimpleAdapter adapter = new SimpleAdapter(getApplicationContext(),listString,R.layout.item_layout,
new String[] {"name","address"},new int[]{R.id.et1,R.id.et2});
}
}
}
| [
"253766273@qq.com"
] | 253766273@qq.com |
4857fe91337fa505b67c233a81aa26656ffb65e8 | 7fafc5887d42e75bbf8661b371b26b245fcc11b3 | /A2/Question6/PiggyBankTextLoader.java | 184403f6f85895ba5d6c1e22583e58dc3cdc73ca | [] | no_license | davidcui5/CSCI5308 | 47d1847e7ee44d554150ec0224b03e8d69f9070b | 28011ea94dadb06c73e09f57d8508cf1af1f81f6 | refs/heads/master | 2020-03-19T02:20:57.836987 | 2018-07-27T01:33:34 | 2018-07-27T01:33:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | import java.io.FileReader;
import java.util.Scanner;
public class PiggyBankTextLoader
{
//load PiggyBank from file, returns it, returns null if something is wrong.
public static PiggyBank load(String fileName)
{
try
{
PiggyBank bank = new PiggyBank();
Scanner in = new Scanner(new FileReader(fileName));
bank.setNumPennies(Integer.parseInt(in.next()));
bank.setNumDimes(Integer.parseInt(in.next()));
bank.setNumNickels(Integer.parseInt(in.next()));
bank.setNumQuarters(Integer.parseInt(in.next()));
return bank;
}
catch (Exception e)
{
System.out.println("I am a bad programmer that hid an exception.");
return null;
}
}
}
| [
"yq506499@dal.ca"
] | yq506499@dal.ca |
0b9f1d3e04fd95bcba19fb8fb92c92488a2bbd64 | 7e6d1a542a4ae60e40d7c8a1585f33a981e60777 | /src/android/Rkatime.java | 6cb0e438fa5c3e3cbfaa58a5fa0cb9935d49353d | [
"Apache-2.0"
] | permissive | rupendraa/cordova-plugin-rkatime | 43466888bb9a0881b9140bb791af243857b6399d | 324851c2e8b98c9d4f95cfe4fe39a7dda93da39e | refs/heads/master | 2020-03-24T17:50:24.544610 | 2018-08-06T07:13:46 | 2018-08-06T07:13:46 | 142,873,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,379 | 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.cordova.rkatime;
import java.util.TimeZone;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaInterface;
import android.os.Bundle;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.util.Log;
import android.provider.Settings;
public class Rkatime extends CordovaPlugin {
public static final String TAG = "Rkatime";
/**
* Constructor.
*/
// public Rkatime() {
// Log.i("Rkatime", "called Rkatime ");
// }
/**
* Sets the context of the Command. This can then be used to do things like
* get file paths associated with the Activity.
*
* @param cordova The context of the main Activity.
* @param webView The CordovaWebView Cordova is running in.
*/
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
Log.i("Rkatime", "called initialize ");
super.initialize(cordova, webView);
}
/**
* Executes the request and returns PluginResult.
*
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param callbackContext The callback id used when calling back into JavaScript.
* @return True if the action was valid, false if not.
*/
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
// if (action.equals("getOtherInfo")) {
// JSONObject r = new JSONObject();
// r.put("is_time_automatic_enabled", this.isTimeAutomaticEnabled() );
// callbackContext.success(r);
// }
// else {
// return false;
// }
// return true;
Log.i("Rkatime", "called getOtherInfo ");
if(action.equals("getOtherInfo")) {
Log.i("Rkatime", "call isTimeAutomaticEnabled ");
JSONObject r = new JSONObject();
r.put("is_time_automatic_enabled", isTimeAutomaticEnabled() );
callbackContext.success(r);
//callbackContext.success( isTimeAutomaticEnabled() ? 1 : 0);
}else{
return false;
}
return true;
}
//--------------------------------------------------------------------------
// LOCAL METHODS
//--------------------------------------------------------------------------
/**
* Function to check if the device is manufactured by Amazon
*
* @return
*/
private boolean isTimeAutomaticEnabled() {
Log.i("Rkatime", "called isTimeAutomaticEnabled ");
// throws Exception
//logDebug("call isTimeAutomaticEnabled function");
boolean result;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
Log.i("Rkatime", "called isTimeAutomaticEnabled 1");
result = Settings.System.getInt(this.cordova.getActivity().getContentResolver(), Settings.Global.AUTO_TIME, 0) == 1;
}else{
Log.i("Rkatime", "called isTimeAutomaticEnabled 2");
result = Settings.Global.getInt(this.cordova.getActivity().getContentResolver(), Settings.Global.AUTO_TIME, 0) == 1;
}
Log.i("Rkatime", "called isTimeAutomaticEnabled 3");
return result;
}
}
| [
"39113656+rupendraa@users.noreply.github.com"
] | 39113656+rupendraa@users.noreply.github.com |
8c526516cf94312467475620ae3f7e2ed9349e1e | 14bdac6d8b737ce4d8f0680336fbbbf6b1d764a0 | /src/main/java/th/go/rd/bankaccount/data/BankAccountRepository.java | e8fcf9f1b8666fe9049fc22abff766b8b8650a1e | [] | no_license | yesitis2019/atm-api | e14ed6d5fa904208fae39a028a765c5bbea5f5b3 | 07d292f5b794cb82b18dd6974566b6d3abe2c82d | refs/heads/master | 2022-12-07T05:37:27.842871 | 2020-08-28T04:45:20 | 2020-08-28T04:45:20 | 290,951,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package th.go.rd.bankaccount.data;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import th.go.rd.bankaccount.model.BankAccount;
import java.util.List;
@Repository
public interface BankAccountRepository extends
JpaRepository<BankAccount,Integer> {
List<BankAccount> findByCustomerId(int customerId);
}
| [
"yesitis2019@gmail.com"
] | yesitis2019@gmail.com |
4d4488e06cbfb0fa73cdb588b734aa757a23d7c7 | c7028b8825e6de4d4b88c739471598ebecd8e00c | /src/DP/maximumSubarrayII.java | 65019e4ccfa73418c6c45b503b73c817af54da57 | [] | no_license | sams2000/leetcode | 45585a09aa2f9adf1c3cacf3669ac7f3bb2bc03b | af20414ec925f46b8f2e393e9e9708a0bd6dd588 | refs/heads/master | 2021-01-10T03:57:22.523486 | 2016-11-10T21:20:56 | 2016-11-10T21:20:56 | 51,965,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,121 | java | package DP;
import java.util.ArrayList;
public class maximumSubarrayII {
public int maxTwoSubArrays(ArrayList<Integer> nums) {
if (nums==null||nums.size()==0){
return 0;
}
int len=nums.size();
int[] left=new int[len];
int[] right=new int[len];
left[0]=nums.get(0);
right[len-1]=nums.get(len-1);
for(int i=1;i<len;i++){
left[i]=Math.max(nums.get(i),left[i-1]+nums.get(i));
}
int curMax=left[0];
for(int i=1;i<len;i++){
int temp=Math.max(left[i],curMax);
left[i]=temp;
curMax=temp;
}
for(int i=len-2;i>=0;i--){
right[i]=Math.max(nums.get(i),right[i+1]+nums.get(i));
}
curMax=right[len-1];
for(int i=len-2;i>=0;i--){
int temp=Math.max(curMax,right[i]);
curMax=temp;
right[i]=curMax;
}
int max=Integer.MIN_VALUE;
for(int i=0;i<len-1;i++){
max=Math.max(left[i]+right[i+1],max);
}
return max;
}
}
| [
"bzhou@walmartlabs.com"
] | bzhou@walmartlabs.com |
33f704a5c90e2a53cf06c5a16b28e57dacad98bf | 3957bce76d98141735829fadfa960af5cbd45907 | /shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/test/java/org/apache/shardingsphere/sharding/strategy/algorithm/sharding/CustomDateTimeShardingAlgorithmTest.java | ca30bb2b8bb0594859d1c30c3901a4b37e76a4bd | [
"Apache-2.0"
] | permissive | SONGFEIXIANG-bit/shardingsphere | 8565d8ffb860c1a787fa6b245379afb411ac1e70 | 8c79331f53a6f380450e91bc91acf01bd0fe5b08 | refs/heads/master | 2022-10-20T10:59:21.772394 | 2020-06-13T11:59:43 | 2020-06-13T11:59:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,664 | 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.shardingsphere.sharding.strategy.algorithm.sharding;
import com.google.common.collect.Lists;
import com.google.common.collect.Range;
import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.strategy.route.standard.StandardShardingStrategy;
import org.apache.shardingsphere.sharding.strategy.route.value.ListRouteValue;
import org.apache.shardingsphere.sharding.strategy.route.value.RangeRouteValue;
import org.apache.shardingsphere.sharding.strategy.route.value.RouteValue;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.junit.Before;
import org.junit.Test;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
* datetime sharding algorithm test.
*/
public class CustomDateTimeShardingAlgorithmTest {
private final List<String> availableTablesForMonthStrategy = new ArrayList<>();
private final List<String> availableTablesForQuarterStrategy = new ArrayList<>();
private StandardShardingStrategy shardingStrategyByMonth;
private StandardShardingStrategy shardingStrategyByQuarter;
@Before
public void setup() {
initShardStrategyByMonth();
initShardStrategyByQuarter();
}
@Test
public void assertPreciseDoShardingByQuarter() {
List<RouteValue> shardingValues = Lists.newArrayList(new ListRouteValue<>("create_time", "t_order",
Lists.newArrayList("2020-01-01 00:00:01", "2020-01-01 00:00:02", "2020-04-15 10:59:08")));
Collection<String> actual = shardingStrategyByQuarter.doSharding(availableTablesForQuarterStrategy, shardingValues, new ConfigurationProperties(new Properties()));
assertThat(actual.size(), is(2));
assertTrue(actual.contains("t_order_202001"));
assertTrue(actual.contains("t_order_202002"));
}
@Test
public void assertRangeDoShardingByQuarter() {
Range<String> rangeValue = Range.closed("2019-10-15 10:59:08", "2020-04-08 10:59:08");
List<RouteValue> shardingValues = Lists.newArrayList(new RangeRouteValue<>("create_time", "t_order", rangeValue));
Collection<String> actual = shardingStrategyByQuarter.doSharding(availableTablesForQuarterStrategy, shardingValues, new ConfigurationProperties(new Properties()));
assertThat(actual.size(), is(3));
}
@Test
public void assertPreciseDoShardingByMonth() {
List<RouteValue> shardingValues = Lists.newArrayList(new ListRouteValue<>("create_time", "t_order",
Lists.newArrayList("2020-01-01 00:00:01", "2020-01-01 00:00:02", "2020-04-15 10:59:08")));
Collection<String> actual = shardingStrategyByMonth.doSharding(availableTablesForMonthStrategy, shardingValues, new ConfigurationProperties(new Properties()));
assertThat(actual.size(), is(2));
assertTrue(actual.contains("t_order_202001"));
assertTrue(actual.contains("t_order_202004"));
}
@Test
public void assertRangeDoShardingByMonth() {
Range<String> rangeValue = Range.closed("2019-10-15 10:59:08", "2020-04-08 10:59:08");
List<RouteValue> shardingValues = Lists.newArrayList(new RangeRouteValue<>("create_time", "t_order", rangeValue));
Collection<String> actual = shardingStrategyByMonth.doSharding(availableTablesForMonthStrategy, shardingValues, new ConfigurationProperties(new Properties()));
assertThat(actual.size(), is(7));
}
@Test
public void assertLowerHalfRangeDoSharding() {
Range<String> rangeValue = Range.atLeast("2018-10-15 10:59:08");
List<RouteValue> shardingValues = Lists.newArrayList(new RangeRouteValue<>("create_time", "t_order", rangeValue));
Collection<String> actual = shardingStrategyByQuarter.doSharding(availableTablesForQuarterStrategy, shardingValues, new ConfigurationProperties(new Properties()));
assertThat(actual.size(), is(9));
}
@Test
public void assertUpperHalfRangeDoSharding() {
Range<String> rangeValue = Range.atMost("2019-09-01 00:00:00");
List<RouteValue> shardingValues = Lists.newArrayList(new RangeRouteValue<>("create_time", "t_order", rangeValue));
Collection<String> actual = shardingStrategyByQuarter.doSharding(availableTablesForQuarterStrategy, shardingValues, new ConfigurationProperties(new Properties()));
assertThat(actual.size(), is(15));
}
@Test
public void assertFormat() {
String inputFormat = "yyyy-MM-dd HH:mm:ss.SSS";
String tableFormatByQuarter = "yyyyQQ";
String tableFormatByMonth = "yyyyMM";
String value = "2020-10-11 00:00:00.000000";
LocalDateTime localDateTime = LocalDateTime.parse(value.substring(0, inputFormat.length()), DateTimeFormatter.ofPattern(inputFormat));
String tableNameShardedByQuarter = localDateTime.format(DateTimeFormatter.ofPattern(tableFormatByQuarter));
String tableNameShardedByMonth = localDateTime.format(DateTimeFormatter.ofPattern(tableFormatByMonth));
assertEquals("202004", tableNameShardedByQuarter);
assertEquals("202010", tableNameShardedByMonth);
}
private void initShardStrategyByQuarter() {
CustomDateTimeShardingAlgorithm shardingAlgorithm = new CustomDateTimeShardingAlgorithm();
shardingAlgorithm.getProps().setProperty("datetime.format", "yyyy-MM-dd HH:mm:ss");
shardingAlgorithm.getProps().setProperty("table.suffix.format", "yyyyQQ");
shardingAlgorithm.getProps().setProperty("datetime.lower", "2016-01-01 00:00:00.000");
shardingAlgorithm.getProps().setProperty("datetime.upper", "2021-12-31 00:00:00.000");
shardingAlgorithm.getProps().setProperty("datetime.step.unit", "Months");
shardingAlgorithm.getProps().setProperty("datetime.step.amount", "3");
shardingAlgorithm.init();
StandardShardingStrategyConfiguration shardingStrategyConfig = new StandardShardingStrategyConfiguration("create_time", shardingAlgorithm);
this.shardingStrategyByQuarter = new StandardShardingStrategy(shardingStrategyConfig);
for (int i = 2016; i <= 2020; i++) {
for (int j = 1; j <= 4; j++) {
availableTablesForQuarterStrategy.add(String.format("t_order_%04d%02d", i, j));
}
}
}
private void initShardStrategyByMonth() {
CustomDateTimeShardingAlgorithm shardingAlgorithm = new CustomDateTimeShardingAlgorithm();
shardingAlgorithm.getProps().setProperty("datetime.format", "yyyy-MM-dd HH:mm:ss");
shardingAlgorithm.getProps().setProperty("table.suffix.format", "yyyyMM");
shardingAlgorithm.getProps().setProperty("datetime.lower", "2016-01-01 00:00:00.000");
shardingAlgorithm.getProps().setProperty("datetime.upper", "2021-12-31 00:00:00.000");
shardingAlgorithm.getProps().setProperty("datetime.step.unit", "Months");
shardingAlgorithm.getProps().setProperty("datetime.step.amount", "1");
shardingAlgorithm.init();
StandardShardingStrategyConfiguration shardingStrategyConfig = new StandardShardingStrategyConfiguration("create_time", shardingAlgorithm);
this.shardingStrategyByMonth = new StandardShardingStrategy(shardingStrategyConfig);
for (int i = 2016; i <= 2020; i++) {
for (int j = 1; j <= 12; j++) {
availableTablesForMonthStrategy.add(String.format("t_order_%04d%02d", i, j));
}
}
}
}
| [
"noreply@github.com"
] | SONGFEIXIANG-bit.noreply@github.com |
6190fe485df835d8be638e94c9ac4beba40d4461 | 824f9c6797d8fd24a50f84c5fc6a1fe3c449fff6 | /library/src/main/java/com/huxley/wiitools/commAdapter/adapter/CommonAdapter.java | abb229c6b6ef07791ea60a91292bfd301645b2ed | [] | no_license | wii-huxley/WiiTools | 97408044824f06d07e4881d8fb62d6a51cff6b7f | 41405e195590e0077b31d185e3e9c0f200df0c1d | refs/heads/master | 2021-01-20T02:53:50.065156 | 2018-02-05T14:28:01 | 2018-02-05T14:28:01 | 88,808,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package com.huxley.wiitools.commAdapter.adapter;
import android.content.Context;
import com.huxley.wiitools.commAdapter.adapter.base.ItemViewDelegate;
import java.util.List;
public abstract class CommonAdapter<T> extends MultiItemTypeAdapter<T> {
public CommonAdapter(Context context, final int layoutId, List<T> datas) {
super(context, datas);
addItemViewDelegate(new ItemViewDelegate<T>() {
@Override
public int getItemViewLayoutId() {
return layoutId;
}
@Override
public boolean isForViewType(T item, int position) {
return true;
}
@Override
public void convert(ViewHolder holder, T t, int position) {
CommonAdapter.this.convert(holder, t, position);
}
});
}
protected abstract void convert(ViewHolder viewHolder, T item, int position);
}
| [
"huangweiiyii@gmail.com"
] | huangweiiyii@gmail.com |
5e010028abe5471f7172f3b5fd551e607a124dfe | c73e8c297b319a7caa478c5ee94216293db638ad | /ray/rage/asset/animation/AnimationLoader.java | d87d8870a90a10d8c5f16d06c84da3a96e7cbaa8 | [] | no_license | AaronHartigan/LuigiKart | c1c81a2a6e9004918aff685d8c4ff4b991ef78ab | a489be0f63fb78425892c5878255534e7a1e3ffa | refs/heads/master | 2020-05-03T12:37:28.403446 | 2019-06-12T19:51:29 | 2019-06-12T19:51:29 | 178,631,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java | /**
* Copyright (C) 2017 Luis Gutierrez <lg24834@gmail.com>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ray.rage.asset.animation;
import ray.rage.asset.AssetLoader;
import ray.rage.asset.animation.Animation;
/**
* A <i>animation loader</i> is an {@link AssetLoader asset-loader} that can load
* {@link Animation animations}. A separate implementation of this interface is
* expected for every different raw data format supported by the framework.
*
* @author Luis Gutierrez
*
*/
public interface AnimationLoader extends AssetLoader<Animation> {
}
| [
"hartiganaaron@gmail.com"
] | hartiganaaron@gmail.com |
d9c78b5980d082379a18e99dc8422da60610665f | 02a99b04db1b65c4c784aca95a3e545d6f7e2743 | /src/main/java/com/free/fasttools/service/httpTool/service/HttpService.java | 594c075e796f5b8021ecd33bb160e86cde21658c | [] | no_license | weiboyaya/fastTools | 8c1c621d1ed9fb32905c83c0082f4b0c749a6c09 | ad857785849c63e0142d0fb05089af4dbb131110 | refs/heads/master | 2020-04-05T19:47:45.493005 | 2019-01-11T06:08:23 | 2019-01-11T06:08:23 | 157,150,509 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package com.free.fasttools.service.httpTool.service;
import com.alibaba.fastjson.JSONObject;
import com.free.fasttools.dto.httpTool.HttpToolDTO;
import com.free.fasttools.utils.expection.FastException;
/**
* @Auther: zhengwei
* @Date: 2018/12/3 16:58
* @Description: http服务接口
*/
public interface HttpService {
/**
* 获取http请求结果
* @param dto
* @param method
* @return
* @throws FastException
*/
public JSONObject getHttpResult(HttpToolDTO dto,String method);
}
| [
"759047731@qq.com"
] | 759047731@qq.com |
97272e26ad7f023e931441d2002b2a31302edc00 | 808e5798d873449c3456013f4c5f1d7e9d2c5df3 | /src/main/java/com/node/repository/NodeRepository.java | c5210e85dd99b102559767ad6455b04fe4db88f4 | [] | no_license | cunhazera/node | 9380f119dac27116adc4dffa0d762d741e1065ce | 5c2af930fda7cf8d05d122415a9c3d5a11698066 | refs/heads/master | 2020-04-02T20:30:28.599451 | 2019-10-24T03:54:24 | 2019-10-24T03:54:24 | 154,771,143 | 0 | 0 | null | 2019-10-24T03:54:25 | 2018-10-26T03:19:09 | Java | UTF-8 | Java | false | false | 385 | java | package com.node.repository;
import com.node.entity.Node;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface NodeRepository extends JpaRepository<Node, Integer> {
List<Node> findByParentId(Integer id);
}
| [
"cunha.gabriel919@gmail.com"
] | cunha.gabriel919@gmail.com |
e4380bc120d11c3ded8fff38b608f34fd84b8957 | cdc9a334996b0c933269b7aa8b39357c97176ca5 | /java/common-extra/src/main/java/com/suneee/platform/model/system/GlobalType.java | 817281551de9d29b8d6f12f1038944ff455055f2 | [] | no_license | lmr1109665009/oa | 857c2729398f08f2094f47824f383cfa4d808ae6 | 21cf4bac10ab72520a1f0dfdd965b9378081823c | refs/heads/master | 2020-05-16T10:39:51.316044 | 2019-04-23T10:13:26 | 2019-04-23T10:13:26 | 182,986,352 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 8,889 | java | package com.suneee.platform.model.system;
import com.suneee.core.model.BaseModel;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* 对象功能:总分类表 Model对象
* 开发公司:广州宏天软件有限公司
* 开发人员:ljf
* 创建时间:2011-11-23 11:07:26
*/
@SuppressWarnings("serial")
public class GlobalType extends BaseModel {
/**
* 流程分类
*/
public static final String CAT_FLOW="FLOW_TYPE";
/**
* 表单类型
*/
public static final String CAT_FORM="FORM_TYPE";
/**
* 文件类型
*/
public static final String CAT_FILE = "FILE_TYPE";
/**
* 附件类型
*/
public static final String CAT_ATTACH = "ATTACH_TYPE";
/**
* 字典类型(数据字典)
*/
public final static String CAT_DIC="DIC";//与数据库表SYS_TYPE_KEY的字段TYPEKEY对应
/**t
* 分类类型--附件文件格式
*/
public static final String CAT_FILE_FORMAT = "FILEFORMAT";
/**
* 分类类型--报表
*/
public static final String CAT_REPORT="REPORT_TYPE";
/**
* 分类类型--数据字典
*/
public static final String NODE_KEY_DIC="DIC";
/**
* 分类类型--首页栏目
*/
public static final String Mobile_SCENE="MOBILE_TYPE";
/**
* 场景类型--手机
*/
public static final String CAT_INDEX_COLUMN="INDEX_COLUMN_TYPE";
/**
* 分类类型--知识库分类
*/
public static final String CAT_KNOWLEDGE="KNOWLEDGE_TYPE";
/**
* 分类类型--自定义表分类
*/
public static final String CAT_FORM_TABLE = "FORM_TABLE_TYPE";
/**
* 分类类型--地区分类
*/
public static final String CAT_REGION = "REGION_TYPE";
/**
* 分类类型--默认分类
*/
public static final String CAT_DEFAULT = "DEFAULT_TYPE";
/**
* 默认分类名称
*/
public static final String TYPE_NAME_DEFAULT = "其他";
/**
* 流程分类根节点的名称
*/
public static final String TYPE_NAME_BPM="流程分类";
/**
* 数据字典在sys_gl_type 中的类型名称
*/
public final static String TYPE_NAME_DIC="数据字典";
/**
* 树型数据 type=1
*/
public final static Integer DATA_TYPE_TREE=1;
/**
* 平铺数据 type=0
*/
public final static Integer DATA_TYPE_FLAT=0;
/**
* 根结点的父ID
*/
public final static long ROOT_PID=-1;//重要
/**
* 根结点的ID
*/
public final static long ROOT_ID=0;
/**
* 根结点的深度
*/
public final static long ROOT_DEPTH=0;
/**
* 是否父类
*/
public final static String IS_PARENT_N="false";
public final static String IS_PARENT_Y="true";
/**
* 是否叶子(0否,1是)
*/
public final static int IS_LEAF_N=0;
public final static int IS_LEAF_Y=1;
/**
* 自编码生成方式(0 手工录入,1自动生成)
*/
public final static String NODE_CODE_TYPE_AUTO_N="0";
public final static String NODE_CODE_TYPE_AUTO_Y="1";
//分类ID
protected Long typeId=0L;
// 名称
protected String typeName;
// 节点路径
protected String nodePath;
// 层次
protected Integer depth;
// 父节点
protected Long parentId;
//父节点名称
protected String parentName;
// 节点的分类Key
protected String nodeKey;
// 节点分类的Key,如产品分类Key为PT
protected String catKey;
// 序号
protected Long sn;
// 所属用户
protected Long userId=0L;
// depId
protected Long depId=0L;
// 类型(0平铺,1树形)
protected Integer type=0;
//是否找开
protected String open="true";
// 是否父类,主要用于树的展示时用
protected String isParent;
// 是否叶子结点(0否,1是),主要用于数据库保存
protected Integer isLeaf;
//区分字典项和字典分类0:字典,1:字典分类
protected int isType;
//子节点的个数
protected int childNodes=0;
// 节点的自编码
protected String nodeCode;
// 节点的自编码生成方式
protected Short nodeCodeType=0;
/**
* 企业编码
*/
protected String enterpriseCode;
public Integer getIsLeaf() {
return isLeaf;
}
public void setIsLeaf(Integer isLeaf) {
this.isLeaf = isLeaf;
}
public String getIsParent() {
return this.childNodes>0?"true":"false";
}
public void setIsParent(String isParent) {
this.isParent = isParent;
}
public String getOpen() {
return open;
}
public void setOpen(String open) {
this.open = open;
}
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
/**
* 返回 typeId
* @return
*/
public Long getTypeId() {
return typeId;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
/**
* 返回 名称
* @return
*/
public String getTypeName() {
return typeName;
}
public void setNodePath(String nodePath) {
this.nodePath = nodePath;
}
/**
* 返回 nodePath
* @return
*/
public String getNodePath() {
return this.nodePath;
}
public void setDepth(Integer depth) {
this.depth = depth;
}
/**
* 返回 层次
* @return
*/
public Integer getDepth() {
int i=this.nodePath.split("\\.").length-1;
return i;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
/**
* 返回 父节点
* @return
*/
public Long getParentId() {
return parentId;
}
public String getParentName() { return parentName; }
public void setParentName(String parentName) { this.parentName = parentName; }
public void setNodeKey(String nodeKey) {
this.nodeKey = nodeKey;
}
/**
* 返回 节点的分类Key
* @return
*/
public String getNodeKey() {
return nodeKey;
}
public void setCatKey(String catKey) {
this.catKey = catKey;
}
/**
* 返回 节点分类的Key,如产品分类Key为PT
* @return
*/
public String getCatKey() {
return catKey;
}
public void setSn(Long sn) {
this.sn = sn;
}
/**
* 返回 序号
* @return
*/
public Long getSn() {
return sn;
}
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* 返回 所属用户
* @return
*/
public Long getUserId() {
return userId;
}
public void setDepId(Long depId) {
this.depId = depId;
}
/**
* 返回 depId
* @return
*/
public Long getDepId() {
return this.depId;
}
public void setType(Integer type) {
this.type = type;
}
/**
* 返回 类型(0平铺,1树形)
* @return
*/
public Integer getType() {
return type;
}
public int getChildNodes() {
return childNodes;
}
public void setChildNodes(int childNodes) {
this.childNodes = childNodes;
}
public String getNodeCode() {
return nodeCode;
}
public void setNodeCode(String nodeCode) {
this.nodeCode = nodeCode;
}
public Short getNodeCodeType() {
return nodeCodeType;
}
public void setNodeCodeType(Short nodeCodeType) {
this.nodeCodeType = nodeCodeType;
}
public String getEnterpriseCode() {
return enterpriseCode;
}
public void setEnterpriseCode(String enterpriseCode) {
this.enterpriseCode = enterpriseCode;
}
public int getIsType() { return isType; }
public void setIsType(int isType) { this.isType = isType; }
/**
* @see Object#equals(Object)
*/
public boolean equals(Object object) {
if (!(object instanceof GlobalType)) {
return false;
}
GlobalType rhs = (GlobalType) object;
return new EqualsBuilder()
.append(this.typeId, rhs.typeId)
.append(this.typeName, rhs.typeName)
.append(this.nodePath, rhs.nodePath)
.append(this.depth, rhs.depth)
.append(this.parentId, rhs.parentId)
.append(this.nodeKey, rhs.nodeKey)
.append(this.catKey, rhs.catKey)
.append(this.sn, rhs.sn)
.append(this.userId, rhs.userId)
.append(this.depId, rhs.depId)
.append(this.type, rhs.type)
.append(this.nodeCode, rhs.nodeCode)
.append(this.nodeCodeType, rhs.nodeCodeType)
.isEquals();
}
/**
* @see Object#hashCode()
*/
public int hashCode() {
return new HashCodeBuilder(-82280557, -700257973)
.append(this.typeId)
.append(this.typeName)
.append(this.nodePath)
.append(this.depth)
.append(this.parentId)
.append(this.nodeKey)
.append(this.catKey)
.append(this.sn)
.append(this.userId)
.append(this.depId)
.append(this.type)
.append(this.nodeCode)
.append(this.nodeCodeType)
.append(this.enterpriseCode)
.toHashCode();
}
/**
* @see Object#toString()
*/
public String toString() {
return new ToStringBuilder(this)
.append("typeId", this.typeId)
.append("typeName", this.typeName)
.append("nodePath", this.nodePath)
.append("depth", this.depth)
.append("parentId", this.parentId)
.append("nodeKey", this.nodeKey)
.append("catKey", this.catKey)
.append("sn", this.sn)
.append("userId", this.userId)
.append("depId", this.depId)
.append("type", this.type)
.append("nodeCode", this.nodeCode)
.append("nodeCodeType", this.nodeCodeType)
.append("enterpriseCode", this.enterpriseCode)
.toString();
}
} | [
"lmr1109665009@163.com"
] | lmr1109665009@163.com |
9791420c595e11ba12f6b0aba10081e3bf045bd2 | 1ed2344017080650e3a08852ba3c695af1e2f6ad | /src/hopshackle/simulation/Dice.java | a2e78d568b5e80df42a55bf3ff02191010e3a042 | [] | no_license | hopshackle/Simulation | 562fa30e85bd30ee652c0f00f4abee3a6dccedcc | 559d250adaff8897ab81ffa76f375380f43d20f1 | refs/heads/master | 2021-01-23T19:44:31.652527 | 2020-07-05T20:29:44 | 2020-07-05T20:29:44 | 29,821,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,692 | java | package hopshackle.simulation;
import java.util.Random;
public final class Dice {
static int lastRoll;
static int nextRoll;
private static Random rnd = new Random();
public static void setSeed(long seed) {
rnd = new Random(seed);
}
public static int roll (int n, int max) {
int total = 0;
if (nextRoll > 0 && nextRoll < max * n) {
total = nextRoll;
nextRoll = 0;
} else
for (int i=0; i<n; i++) total+=rnd.nextInt(max)+1;
lastRoll = total;
return total;
}
public static int lastRoll() {
return lastRoll;
}
public static void setNextRoll(int n) {
nextRoll = n;
}
public static int bestOf(int diceType, int diceNumber, int takeHighest) {
int[] allDice = new int[diceNumber];
for (int n = 0; n<diceNumber; n++)
allDice[n] = Dice.roll(1, diceType);
int[] finalDice = new int[takeHighest];
for (int n = 0; n < takeHighest; n++) {
int currentHigh = 0;
int index = 0;
for (int m = 0; m < diceNumber; m++) {
if (allDice[m] > currentHigh) {
currentHigh = allDice[m];
index = m;
}
}
finalDice[n] = allDice[index];
allDice[index] = 0;
}
int retValue = 0;
for (int n : finalDice)
retValue+=n;
return retValue;
}
public static int stressDieResult() {
int result = Dice.roll(1, 10) - 1;
int multiplier = 1;
while (result == 1) {
multiplier++;
result = Dice.roll(1, 10);
}
return result * multiplier;
}
public static int getBotchResult(int botchDice) {
int botches = 0;
for (int i = 0; i < botchDice; i++) {
if (Dice.roll(1, 10) == 10)
botches++;
}
return botches;
}
}
| [
"james@janigo.co.uk"
] | james@janigo.co.uk |
088a29672efca90d8ef81eafd75656c07150b600 | 8f4a16dc6e3714260f51fb61d0098da01ea3af2c | /src/com/viptrip/pay/abc/vo/QueryResImmediate.java | dd34ff2b0813df37fbcb4a78a6f2ea7d10cefccc | [] | no_license | bournecao24/wetripT | 4ce5fc3daf5cf452f1a3d97a91922fc8159b8a79 | fadf580a729b170721522c6a7f037073b04c388e | refs/heads/master | 2021-09-10T05:24:54.961044 | 2018-03-21T02:48:01 | 2018-03-21T02:48:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,143 | java | package com.viptrip.pay.abc.vo;
public class QueryResImmediate extends QueryResObj{
private String OrderAmount;
private String OrderDesc;
private String OrderURL;
private String PaymentLinkType;
private String AcctNo;
private String CommodityType;
private String ReceiverAddress;
private String BuyIP;
private String iRspRef;
private String ReceiveAccount;
private String ReceiveAccName;
private String MerchantRemarks;
public String getOrderDesc() {
return OrderDesc;
}
public String getOrderAmount() {
return OrderAmount;
}
public void setOrderAmount(String orderAmount) {
OrderAmount = orderAmount;
}
public void setOrderDesc(String orderDesc) {
OrderDesc = orderDesc;
}
public String getOrderURL() {
return OrderURL;
}
public void setOrderURL(String orderURL) {
OrderURL = orderURL;
}
public String getPaymentLinkType() {
return PaymentLinkType;
}
public void setPaymentLinkType(String paymentLinkType) {
PaymentLinkType = paymentLinkType;
}
public String getAcctNo() {
return AcctNo;
}
public void setAcctNo(String acctNo) {
AcctNo = acctNo;
}
public String getCommodityType() {
return CommodityType;
}
public void setCommodityType(String commodityType) {
CommodityType = commodityType;
}
public String getReceiverAddress() {
return ReceiverAddress;
}
public void setReceiverAddress(String receiverAddress) {
ReceiverAddress = receiverAddress;
}
public String getBuyIP() {
return BuyIP;
}
public void setBuyIP(String buyIP) {
BuyIP = buyIP;
}
public String getiRspRef() {
return iRspRef;
}
public void setiRspRef(String iRspRef) {
this.iRspRef = iRspRef;
}
public String getReceiveAccount() {
return ReceiveAccount;
}
public void setReceiveAccount(String receiveAccount) {
ReceiveAccount = receiveAccount;
}
public String getReceiveAccName() {
return ReceiveAccName;
}
public void setReceiveAccName(String receiveAccName) {
ReceiveAccName = receiveAccName;
}
public String getMerchantRemarks() {
return MerchantRemarks;
}
public void setMerchantRemarks(String merchantRemarks) {
MerchantRemarks = merchantRemarks;
}
}
| [
"zhenlongla0824@163.com"
] | zhenlongla0824@163.com |
662fc4e6a1f4f4dba7eb5e1724148f540c78fd5a | 85fe85bb6d271e39a336c7475e2b27632474f3f6 | /src/main/java/com/se/tss/forum/Models/Message.java | fda1334883a941d26bcd3c4eb03967a81959d38d | [] | no_license | Donzh31/teachsysTeam3 | 20e1bb6ee917ea330d85b793ebd5457f3a01e46f | 0e472c5f88c9c83d95bd9b0b9ba0b5d5e53aa289 | refs/heads/master | 2020-03-16T21:49:11.330399 | 2018-06-25T18:09:46 | 2018-06-25T18:09:46 | 133,015,760 | 0 | 0 | null | 2018-05-11T08:57:50 | 2018-05-11T08:57:49 | null | UTF-8 | Java | false | false | 1,458 | java | package com.se.tss.forum.Models;
import java.sql.Timestamp;
public class Message {
private Integer mid;
private Integer sender_id;
private String sender_name;
private Integer receiver_id;
private String receiver_name;
private String message;
private Timestamp sendTime;
public Message() {
}
public Integer getMid() {
return mid;
}
public void setMid(Integer mid) {
this.mid = mid;
}
public Integer getSender_id() {
return sender_id;
}
public void setSender_id(Integer sender_id) {
this.sender_id = sender_id;
}
public String getSender_name() {
return sender_name;
}
public void setSender_name(String sender_name) {
this.sender_name = sender_name;
}
public Integer getReceiver_id() {
return receiver_id;
}
public void setReceiver_id(Integer receiver_id) {
this.receiver_id = receiver_id;
}
public String getReceiver_name() {
return receiver_name;
}
public void setReceiver_name(String receiver_name) {
this.receiver_name = receiver_name;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Timestamp getSendTime() {
return sendTime;
}
public void setSendTime(Timestamp sendTime) {
this.sendTime = sendTime;
}
}
| [
"dzh0828@gmail.com"
] | dzh0828@gmail.com |
d0407c06431235503e20352bddbb8eba2747c08f | da5ce7545d453663373487bdf6d4d983dcffb3b4 | /springboot/springboot-jdbc/src/main/java/com/zhihao/miao/Application.java | 744aed8e5c85e01fb3f794420473c548e915f1d3 | [] | no_license | jorfeng/springboot-demos | 738a707c08fa8c392a534db20638b3aea08542ea | 84d7e45250f92ba6c81f3c626dd009dce9be3f42 | refs/heads/master | 2020-03-23T21:30:09.950893 | 2018-05-29T10:22:49 | 2018-05-29T10:22:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,658 | java | package com.zhihao.miao;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;
import java.sql.Connection;
@SpringBootApplication
public class Application {
@Autowired
private Environment environment;
@Bean
public DataSource dataSource(){
DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriverClassName(environment.getProperty("spring.datasource.driver-class-name"));
dataSource.setUrl(environment.getProperty("spring.datasource.url"));
dataSource.setUsername(environment.getProperty("spring.datasource.username"));
dataSource.setPassword(environment.getProperty("spring.datasource.password"));
return dataSource;
}
public static void main(String[] args) throws Exception{
ConfigurableApplicationContext context = SpringApplication.run(Application.class,args);
DataSource ds = context.getBean(DataSource.class);
System.out.println(ds.getClass().getName()); //默认的使用的是tomcat的数据源
Connection connection = ds.getConnection();
System.out.println(connection.getCatalog()); //test
System.out.println(context.getBean(JdbcTemplate.class));
connection.close();
}
}
| [
"zhihao.miao@ele.me"
] | zhihao.miao@ele.me |
eb301908e50169877f06ce087c5a40748535215e | bcfd29f3d710c30f9e0d5bf74a299ce2ad9a0aac | /src/control/acesso/ControlAcesso.java | defb516799cde89574dc5ec92677693e76f535ca | [] | no_license | Pedrinhown/CoffeHub-JUnit | c153c7bfb927d868dc0605512f594863ac580dd0 | b1c3ce05cce1dba1f345e95c535801f1e8dcb9ae | refs/heads/master | 2023-03-28T08:28:45.945719 | 2020-11-06T00:10:41 | 2020-11-06T00:10:41 | 307,848,087 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 710 | java | package control.acesso;
import dao.LoginDAO;
public class ControlAcesso {
public int CarregarLogin(int cod_pessoa, String senha_funcionario) throws Exception{
int retorno = 0;
try
{
if (cod_pessoa <= 0)
{
throw new Exception("Informe o código de acesso");
}
if (senha_funcionario.equals(""))
{
throw new Exception("Informe a senha de acesso");
}
retorno = new LoginDAO().CarregarLogin(cod_pessoa, senha_funcionario);
if (retorno == 1)
{
retorno = 1;
}
else
{
retorno = -1;
throw new Exception("Não foi possível efetuar o login");
}
}
catch (Exception e)
{
throw e;
}
return retorno;
}
}
| [
"2019100616@unibrasil.com.br"
] | 2019100616@unibrasil.com.br |
fd88c71c7211fa9605b21ae515f6c858f9486c3e | 6546da6e3d1f989dafaa89d48e1b2415e2f8e161 | /chapter05/src/main/java/com/learn/chapter05/domain/InnodbTrx.java | 09646d7f46a24b6ce501251868e68002dc8a8fce | [] | no_license | liman657/mybatislearn | 352bc6a39014e01666e55405f4d3514574a8d6df | 6f8611db472961855c4b16135b6e2a4c6703f78d | refs/heads/master | 2020-04-15T05:59:44.692481 | 2019-03-08T12:39:58 | 2019-03-08T12:39:58 | 164,444,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,972 | java | package com.learn.chapter05.domain;
import java.io.Serializable;
import java.util.Date;
public class InnodbTrx implements Serializable {
private String trxId;
private String trxState;
private Date trxStarted;
private String trxRequestedLockId;
private Date trxWaitStarted;
private Long trxWeight;
private Long trxMysqlThreadId;
private String trxQuery;
private String trxOperationState;
private Long trxTablesInUse;
private Long trxTablesLocked;
private Long trxLockStructs;
private Long trxLockMemoryBytes;
private Long trxRowsLocked;
private Long trxRowsModified;
private Long trxConcurrencyTickets;
private String trxIsolationLevel;
private Integer trxUniqueChecks;
private Integer trxForeignKeyChecks;
private String trxLastForeignKeyError;
private Integer trxAdaptiveHashLatched;
private Long trxAdaptiveHashTimeout;
private Integer trxIsReadOnly;
private Integer trxAutocommitNonLocking;
private static final long serialVersionUID = 1L;
public String getTrxId() {
return trxId;
}
public void setTrxId(String trxId) {
this.trxId = trxId == null ? null : trxId.trim();
}
public String getTrxState() {
return trxState;
}
public void setTrxState(String trxState) {
this.trxState = trxState == null ? null : trxState.trim();
}
public Date getTrxStarted() {
return trxStarted;
}
public void setTrxStarted(Date trxStarted) {
this.trxStarted = trxStarted;
}
public String getTrxRequestedLockId() {
return trxRequestedLockId;
}
public void setTrxRequestedLockId(String trxRequestedLockId) {
this.trxRequestedLockId = trxRequestedLockId == null ? null : trxRequestedLockId.trim();
}
public Date getTrxWaitStarted() {
return trxWaitStarted;
}
public void setTrxWaitStarted(Date trxWaitStarted) {
this.trxWaitStarted = trxWaitStarted;
}
public Long getTrxWeight() {
return trxWeight;
}
public void setTrxWeight(Long trxWeight) {
this.trxWeight = trxWeight;
}
public Long getTrxMysqlThreadId() {
return trxMysqlThreadId;
}
public void setTrxMysqlThreadId(Long trxMysqlThreadId) {
this.trxMysqlThreadId = trxMysqlThreadId;
}
public String getTrxQuery() {
return trxQuery;
}
public void setTrxQuery(String trxQuery) {
this.trxQuery = trxQuery == null ? null : trxQuery.trim();
}
public String getTrxOperationState() {
return trxOperationState;
}
public void setTrxOperationState(String trxOperationState) {
this.trxOperationState = trxOperationState == null ? null : trxOperationState.trim();
}
public Long getTrxTablesInUse() {
return trxTablesInUse;
}
public void setTrxTablesInUse(Long trxTablesInUse) {
this.trxTablesInUse = trxTablesInUse;
}
public Long getTrxTablesLocked() {
return trxTablesLocked;
}
public void setTrxTablesLocked(Long trxTablesLocked) {
this.trxTablesLocked = trxTablesLocked;
}
public Long getTrxLockStructs() {
return trxLockStructs;
}
public void setTrxLockStructs(Long trxLockStructs) {
this.trxLockStructs = trxLockStructs;
}
public Long getTrxLockMemoryBytes() {
return trxLockMemoryBytes;
}
public void setTrxLockMemoryBytes(Long trxLockMemoryBytes) {
this.trxLockMemoryBytes = trxLockMemoryBytes;
}
public Long getTrxRowsLocked() {
return trxRowsLocked;
}
public void setTrxRowsLocked(Long trxRowsLocked) {
this.trxRowsLocked = trxRowsLocked;
}
public Long getTrxRowsModified() {
return trxRowsModified;
}
public void setTrxRowsModified(Long trxRowsModified) {
this.trxRowsModified = trxRowsModified;
}
public Long getTrxConcurrencyTickets() {
return trxConcurrencyTickets;
}
public void setTrxConcurrencyTickets(Long trxConcurrencyTickets) {
this.trxConcurrencyTickets = trxConcurrencyTickets;
}
public String getTrxIsolationLevel() {
return trxIsolationLevel;
}
public void setTrxIsolationLevel(String trxIsolationLevel) {
this.trxIsolationLevel = trxIsolationLevel == null ? null : trxIsolationLevel.trim();
}
public Integer getTrxUniqueChecks() {
return trxUniqueChecks;
}
public void setTrxUniqueChecks(Integer trxUniqueChecks) {
this.trxUniqueChecks = trxUniqueChecks;
}
public Integer getTrxForeignKeyChecks() {
return trxForeignKeyChecks;
}
public void setTrxForeignKeyChecks(Integer trxForeignKeyChecks) {
this.trxForeignKeyChecks = trxForeignKeyChecks;
}
public String getTrxLastForeignKeyError() {
return trxLastForeignKeyError;
}
public void setTrxLastForeignKeyError(String trxLastForeignKeyError) {
this.trxLastForeignKeyError = trxLastForeignKeyError == null ? null : trxLastForeignKeyError.trim();
}
public Integer getTrxAdaptiveHashLatched() {
return trxAdaptiveHashLatched;
}
public void setTrxAdaptiveHashLatched(Integer trxAdaptiveHashLatched) {
this.trxAdaptiveHashLatched = trxAdaptiveHashLatched;
}
public Long getTrxAdaptiveHashTimeout() {
return trxAdaptiveHashTimeout;
}
public void setTrxAdaptiveHashTimeout(Long trxAdaptiveHashTimeout) {
this.trxAdaptiveHashTimeout = trxAdaptiveHashTimeout;
}
public Integer getTrxIsReadOnly() {
return trxIsReadOnly;
}
public void setTrxIsReadOnly(Integer trxIsReadOnly) {
this.trxIsReadOnly = trxIsReadOnly;
}
public Integer getTrxAutocommitNonLocking() {
return trxAutocommitNonLocking;
}
public void setTrxAutocommitNonLocking(Integer trxAutocommitNonLocking) {
this.trxAutocommitNonLocking = trxAutocommitNonLocking;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", trxId=").append(trxId);
sb.append(", trxState=").append(trxState);
sb.append(", trxStarted=").append(trxStarted);
sb.append(", trxRequestedLockId=").append(trxRequestedLockId);
sb.append(", trxWaitStarted=").append(trxWaitStarted);
sb.append(", trxWeight=").append(trxWeight);
sb.append(", trxMysqlThreadId=").append(trxMysqlThreadId);
sb.append(", trxQuery=").append(trxQuery);
sb.append(", trxOperationState=").append(trxOperationState);
sb.append(", trxTablesInUse=").append(trxTablesInUse);
sb.append(", trxTablesLocked=").append(trxTablesLocked);
sb.append(", trxLockStructs=").append(trxLockStructs);
sb.append(", trxLockMemoryBytes=").append(trxLockMemoryBytes);
sb.append(", trxRowsLocked=").append(trxRowsLocked);
sb.append(", trxRowsModified=").append(trxRowsModified);
sb.append(", trxConcurrencyTickets=").append(trxConcurrencyTickets);
sb.append(", trxIsolationLevel=").append(trxIsolationLevel);
sb.append(", trxUniqueChecks=").append(trxUniqueChecks);
sb.append(", trxForeignKeyChecks=").append(trxForeignKeyChecks);
sb.append(", trxLastForeignKeyError=").append(trxLastForeignKeyError);
sb.append(", trxAdaptiveHashLatched=").append(trxAdaptiveHashLatched);
sb.append(", trxAdaptiveHashTimeout=").append(trxAdaptiveHashTimeout);
sb.append(", trxIsReadOnly=").append(trxIsReadOnly);
sb.append(", trxAutocommitNonLocking=").append(trxAutocommitNonLocking);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | [
"657271181@qq.com"
] | 657271181@qq.com |
68d7a33ea98e6a64a7c1f6c30ed4e7851498be53 | d9d574b65727cb4d00790ba47dc8a142b0fb26e4 | /src/test/java/com/sample/app/tests/SystemOutErrClearLog.java | 1963392c2eff4ee6a417de3e02d3aed4a84b5559 | [] | no_license | harikrishna553/system-rules | ea0ba7e11190bd4172759ad812389cc1efadaa5d | 6a3a1fd10451bd03c8737fd3d18cfa25a3380364 | refs/heads/master | 2022-12-28T17:59:01.843271 | 2020-03-26T05:32:14 | 2020-03-26T05:32:14 | 250,169,486 | 1 | 0 | null | 2020-10-13T20:39:59 | 2020-03-26T05:29:30 | Java | UTF-8 | Java | false | false | 812 | java | package com.sample.app.tests;
import static org.junit.Assert.assertEquals;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.SystemErrRule;
import org.junit.contrib.java.lang.system.SystemOutRule;
public class SystemOutErrClearLog {
@Rule
public final SystemErrRule systemErrRule = new SystemErrRule().enableLog();
@Rule
public final SystemOutRule systemOutRule = new SystemOutRule().enableLog();
@Test
public void clearErrorLog() {
System.err.print("Hello World");
systemErrRule.clearLog();
System.err.print("ABCD");
assertEquals("ABCD", systemErrRule.getLog());
}
@Test
public void clearOutLog() {
System.out.print("Hello World");
systemOutRule.clearLog();
System.out.print("ABCD");
assertEquals("ABCD", systemOutRule.getLog());
}
}
| [
"you@example.com"
] | you@example.com |
3e752d9d6ac0cf8045a25371f5c54522e3734bd6 | 447520f40e82a060368a0802a391697bc00be96f | /apks/comparison_androart/de_number26_android/source/de/number26/machete/android/refactor/data/password/l.java | 32b84c4cbbee83fa5754e65ee085070d2716f745 | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 1,833 | java | package de.number26.machete.android.refactor.data.password;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
final class l
extends c
{
l(String paramString)
{
super(paramString);
}
public static final class a
extends TypeAdapter<t>
{
private final TypeAdapter<String> a;
private String b = null;
public a(Gson paramGson)
{
this.a = paramGson.getAdapter(String.class);
}
public t a(JsonReader paramJsonReader)
throws IOException
{
if (paramJsonReader.peek() == JsonToken.NULL)
{
paramJsonReader.nextNull();
return null;
}
paramJsonReader.beginObject();
String str1 = this.b;
while (paramJsonReader.hasNext())
{
String str2 = paramJsonReader.nextName();
if (paramJsonReader.peek() == JsonToken.NULL)
{
paramJsonReader.nextNull();
}
else
{
int i = -1;
if ((str2.hashCode() == -1821235109) && (str2.equals("newPassword"))) {
i = 0;
}
if (i != 0) {
paramJsonReader.skipValue();
} else {
str1 = (String)this.a.read(paramJsonReader);
}
}
}
paramJsonReader.endObject();
return new l(str1);
}
public void a(JsonWriter paramJsonWriter, t paramT)
throws IOException
{
if (paramT == null)
{
paramJsonWriter.nullValue();
return;
}
paramJsonWriter.beginObject();
paramJsonWriter.name("newPassword");
this.a.write(paramJsonWriter, paramT.a());
paramJsonWriter.endObject();
}
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
8c5195ad9478e2550332a265d5fa1130b7ad3dca | 8a78613828696416c82622e24ed21547502a68dd | /odin-cloud-advertise-service/src/main/java/com/pxene/odin/cloud/common/util/RedisHelper.java | 4caf21c0f40c651d2659180dead4722137e3f68d | [] | no_license | odindsp/odin-cloud-aggregator | 6cce58057b245064cab0495bef898ad599170fcf | 952b52ab0ef47a141950371c9383f5417bedc1f1 | refs/heads/master | 2021-09-08T10:55:33.140999 | 2018-03-09T10:41:47 | 2018-03-09T10:41:47 | 124,527,209 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,346 | java | package com.pxene.odin.cloud.common.util;
import java.util.List;
import java.util.Map;
import java.util.Set;
import redis.clients.jedis.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
/**
* redis工具类
* @author lizhuoling
*
*/
@Component
@Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class RedisHelper {
private JedisPool jedisPool;
@Autowired
private RedisHelper(Environment env){
RedisHelperConfig.init(env);
}
/**
* 获取前缀
* @param prefix
*/
public void select(String prefix) {
this.jedisPool = RedisHelperConfig.pools.get(prefix);
}
/**
* 从jedis连接池中获取jedis对象
* @return
*/
public Jedis getJedis() {
// 一个pool可分配jedis实例个数
return jedisPool.getResource();
}
/**
* 回收jedis
* @param jedis
*/
public void close(Jedis jedis) {
jedis.close();
}
/**
* 设置过期时间
* @param key
* @param seconds
*/
public void expire(String key, int seconds) {
if (seconds <= 0) {
return;
}
Jedis jedis = getJedis();
jedis.expire(key, seconds);
jedis.close();
}
/**
* 设置默认过期时间
* @param key
*/
public void expire(String key) {
expire(key, RedisHelperConfig.DEFAULT_EXPIRE);
}
/**
* 给redis数据库中名称为key的string赋值value
* @param key
* @param value String类型
*/
public void set(String key, String value) {
if (isBlank(key)) {
return;
}
Jedis jedis = getJedis();
jedis.set(key, value);
close(jedis);
}
/**
* 给redis数据库中名称为key的string复制value
* @param key
* @param value Object类型
*/
public void set(String key, Object value) {
if (isBlank(key)) {
return;
}
Jedis jedis = getJedis();
jedis.set(key.getBytes(), SerializeUtils.serialize(value));
}
/**
* 给redis数据库中名称为key的string复制value
* @param key
* @param value int类型
*/
public void set(String key, int value) {
if (isBlank(key)) {
return;
}
set(key, String.valueOf(value));
}
/**
* 给redis数据库中名称为key的string复制value
* @param key
* @param value long类型
*/
public void set(String key, long value) {
if (isBlank(key)) {
return;
}
set(key, String.valueOf(value));
}
/**
* 给redis数据库中名称为key的string复制value
* @param key
* @param value float类型
*/
public void set(String key, float value) {
if (isBlank(key)) {
return;
}
set(key, String.valueOf(value));
}
/**
* 给redis数据库中名称为key的string复制value
* @param key
* @param value double类型
*/
public void set(String key, double value) {
if (isBlank(key)) {
return;
}
set(key, String.valueOf(value));
}
/**
* 如果不存在名称为key的string,则向库中添加string,名称为key,值为value
* @param key
* @param value
*/
public boolean setnx(String key, int value) {
if (isBlank(key)) {
return false;
}
Jedis jedis = getJedis();
Long flag = jedis.setnx(key, String.valueOf(value));
close(jedis);
if (flag > 0) {
return true;
}
return false;
}
/**
* 获取名称为key的value
* @param key
* @return 返回float类型
*/
public Float getFolat(String key) {
if (isBlank(key)) {
return null;
}
return Float.valueOf(getStr(key));
}
/**
* 获取名称为key的value
* @param key
* @return 返回double类型
*/
public Double getDouble(String key) {
if (isBlank(key)) {
return null;
}
return Double.valueOf(getStr(key));
}
/**
* 获取名称为key的value
* @param key
* @return 返回Long类型
*/
public Long getLong(String key) {
if (isBlank(key)) {
return null;
}
return Long.valueOf(getStr(key));
}
/**
* 获取名称为key的value
* @param key
* @return 返回Integer类型
*/
public Integer getInt(String key) {
if (isBlank(key)) {
return null;
}
return Integer.valueOf(getStr(key));
}
/**
* 获取名称为key的string的value
* @param key
* @return
*/
public String getStr(String key) {
if (isBlank(key)) {
return null;
}
Jedis jedis = getJedis();
String value = jedis.get(key);
close(jedis);
return value;
}
/**
* 获取名称为key的value
* @param key
* @return 返回Object
*/
public Object getObj(String key) {
if (isBlank(key)) {
return null;
}
Jedis jedis = getJedis();
if (jedis.get(key.getBytes()) == null) {
return null;
}
byte[] bytes = jedis.get(key.getBytes());
Object obj = SerializeUtils.unserialize(bytes);
close(jedis);
return obj;
}
/**
* 获取keys
* @param pattern
* @return
*/
public String[] getKeys(String pattern) {
if (isBlank(pattern)) {
return null;
}
Jedis jedis = getJedis();
Set<String> keySet = jedis.keys(pattern);
String[] keys = new String[keySet.size()];
int index = 0;
for (String key : keySet) {
keys[index] = key;
index++;
}
close(jedis);
return keys;
}
/**
* 删除key
* @param key
*/
public void delete(String key) {
Jedis jedis = getJedis();
if (jedis.get(key) != null) {
jedis.del(key);
}
close(jedis);
}
/**
* 批量删除
* @param pattern
*/
public void deleteByPattern(String pattern) {
Jedis jedis = getJedis();
String[] keys = getKeys(pattern);
if (keys != null && keys.length != 0) {
if (keys.length == 1) {
// 如果只有一个key,删除第一个即可
jedis.del(keys[0]);
} else {
jedis.del(keys);
}
}
close(jedis);
}
/**
* 向名称为key的set中添加元素member
* @param key
* @param members
*/
public void sset(String key, String members) {
Jedis jedis = getJedis();
jedis.sadd(key, members);
close(jedis);
}
/**
* 返回名称为key的set的所有元素
* @param key
* @return
*/
public Set<String> sget(String key) {
Jedis jedis = getJedis();
close(jedis);
return jedis.smembers(key);
}
/**
* 测试member是否是名称为key的set的元素
* @param key
* @param member
* @return
*/
public boolean sismember(String key, String member) {
Jedis jedis = getJedis();
boolean sismember = jedis.sismember(key, member);
close(jedis);
return sismember;
}
/**
* 删除名称为key的set中的元素member
* @param key
* @param members
*/
public void sdelete(String key, String members) {
Jedis jedis = getJedis();
jedis.srem(key, members);
close(jedis);
}
/**
* 向名称为key的hash中添加元素
* @param key
* @param value
*/
public void hmset(String key, Map<String, String> value) {
Jedis jedis = getJedis();
jedis.hmset(key, value);
close(jedis);
}
/**
* 返回名称为key的hash中所有的键(field)及其对应的value
* @param key
* @return
*/
public Map<String, String> hgetAll(String key) {
if (isBlank(key)) {
return null;
}
Jedis jedis = getJedis();
Map<String, String> hgetAll = jedis.hgetAll(key);
close(jedis);
return hgetAll;
}
/**
* 返回名称为key的hash中field对应的value
* @param key
* @param field
* @return
*/
public String hget(String key, String field) {
if (isBlank(key)) {
return null;
}
Jedis jedis = getJedis();
String result = jedis.hget(key, field);
close(jedis);
return result;
}
/**
* 返回名称为key的hash中所有键
* @param key
* @return
*/
public Set<String> hkeys(String key) {
if (isBlank(key)) {
return null;
}
Jedis jedis = getJedis();
Set<String> hkeys = jedis.hkeys(key);
close(jedis);
return hkeys;
}
/**
* 删除一个key
* @param key
*/
public void hdelete (String key) {
Jedis jedis = getJedis();
if (jedis.hgetAll(key) != null) {
jedis.del(key);
}
close(jedis);
}
/**
* 判断是否为空
* @param key
* @return
*/
public boolean isBlank(String key) {
return key == null || "".equals(key.trim());
}
/**
* 确认一个key是否存在
* @param key
* @return
*/
public boolean isExists(String key) {
Jedis jedis = getJedis();
boolean isExists = jedis.exists(key);
close(jedis);
return isExists;
}
/**
* 向名称为key的set中添加元素member
* @param key
* @param values
*/
public void addKey(String key, List<String> values) {
if (values != null && !values.isEmpty()) {
Jedis jedis = getJedis();
for (String value : values) {
jedis.sadd(key, value);
}
close(jedis);
}
}
public void checkAndSetDeadLoop(String key, String value) {
if (isBlank(key)) {
return;
}
Jedis jedis = getJedis();
Transaction transaction = null;
List<Object> list = null;
while (true) {
jedis.watch(key);
// 开启事务
transaction = jedis.multi();
// 执行业务以及调用jedis提供的接口功能
transaction.set(key, value);
// 执行事务
list = transaction.exec();
if (list != null && !list.isEmpty() && list.get(0) != null && "OK".equalsIgnoreCase(list.get(0).toString())) {
break;
}
}
close(jedis);
}
public boolean checkAndSet(String key, String value) {
if (isBlank(key)) {
return false;
}
Jedis jedis = getJedis();
jedis.watch(key);
// 开启事务
Transaction transaction = jedis.multi();
// 执行业务以及调用jedis提供的接口功能
transaction.set(key, value);
// 执行事务
List<Object> list = transaction.exec();
close(jedis);
return checkIfAllOK(list);
}
/**
* 事务
* @param jedis
* @param key
* @param value
* @return
*/
public boolean doTransaction(Jedis jedis, String key, String value) {
Transaction transaction = jedis.multi();
transaction.set(key, value);
List<Object> list = transaction.exec();
close(jedis);
return checkIfAllOK(list);
}
/**
* 检查Redis中一个事务中的全部操作是否都成功
* @param list 事务操作的全部返回值
* @return
*/
public boolean checkIfAllOK(List<Object> list) {
if (list != null && !list.isEmpty()) {
for (Object object : list) {
if (!"OK".equalsIgnoreCase(object.toString())) {
return false;
}
}
return true;
} else {
return false;
}
}
/**
* 为哈希表 key 中的域 field 加上浮点数增量 increment
* @param key 键名
* @param field 域
* @param increment 增量值,可正可负
*/
public void hincrbyFloat(String key, String field, float increment) {
if (isBlank(key)) {
throw new IllegalArgumentException();
}
Jedis jedis = getJedis();
jedis.hincrByFloat(key, field, increment);
close(jedis);
}
/**
* 名称为key的string增加integer
* @param key
* @param increment
*/
public void incrybyInt(String key, int increment) {
if (isBlank(key)) {
throw new IllegalArgumentException();
}
Jedis jedis = getJedis();
jedis.incrBy(key, increment);
close(jedis);
}
public void incryByDouble(String key, double increment) {
if (isBlank(key)) {
throw new IllegalArgumentException();
}
Jedis jedis = getJedis();
jedis.incrByFloat(key, increment);
close(jedis);
}
}
| [
"lichunguang@pxene.com"
] | lichunguang@pxene.com |
1b7b9da0b9b4aac8fce6580b4775bb455e2bfd20 | 2577562b4f5c10206055686e7be67cf681962e6c | /ProjectCode/app/src/androidTest/java/com/example/khujo/ExampleInstrumentedTest.java | 7c3f0dc94da7e7ed3cc7b82ba120f034dea52895 | [] | no_license | nsuspring2019cse299sec4/Group-3 | bdbf55bb4c1de406522235a12f4d53b592f5ec94 | 37205ba0e3d361667cfbedf0dc3d1e0aa154ea77 | refs/heads/master | 2020-04-20T13:03:30.429147 | 2019-05-15T17:43:15 | 2019-05-15T17:43:15 | 168,858,875 | 0 | 1 | null | 2019-03-10T08:26:40 | 2019-02-02T17:41:08 | Java | UTF-8 | Java | false | false | 718 | java | package com.example.khujo;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.khujo", appContext.getPackageName());
}
}
| [
"mithi.shams@northsouth.edu"
] | mithi.shams@northsouth.edu |
4ad9a2493b6eb47c3c4cee9408960d0fd7458942 | 566fa2c521514a93a046313b367e53fece6232b8 | /src/main/java/com/cz/zfy/vhr/mapper/HrMapper.java | 607cb267b45a23d8142a270410ac48f22e5cee01 | [] | no_license | scool-js/vhr_serve | f7c92aaae1d9730ed375a504204701bf55f55027 | 8ac4b8e243dad9c5cd52091deeea6c390279df41 | refs/heads/master | 2022-12-01T05:26:29.315126 | 2020-08-16T16:01:28 | 2020-08-16T16:01:28 | 286,182,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 475 | java | package com.cz.zfy.vhr.mapper;
import com.cz.zfy.vhr.model.Hr;
import com.cz.zfy.vhr.model.Role;
import java.util.List;
public interface HrMapper {
int deleteByPrimaryKey(Integer id);
int insert(Hr record);
int insertSelective(Hr record);
Hr selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Hr record);
int updateByPrimaryKey(Hr record);
Hr loadUserByUsername(String username);
List<Role> getHrRolesById(Integer id);
} | [
"zhangfycz@126.com"
] | zhangfycz@126.com |
75dea3d85b7d06060fc24b71fd1ae559560a0967 | d139cc1a575d270101996d3cea0d94517523b6dc | /app/src/main/java/ru/ifmo/android_2016/lesson2/loadimagedemo/ProgressCallback.java | c771ac94bc50ffe0c42bbfd39fba6cd34978e87b | [] | no_license | IFMO-Android-2016/lesson2 | fd875ed82bb8d594e2acdbb0e4a21e82ba901a1a | a21073f1f0debbd7f5509d7e8ad400784c607431 | refs/heads/master | 2021-01-14T11:12:39.593851 | 2016-09-20T22:19:50 | 2016-09-20T22:19:50 | 68,730,366 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package ru.ifmo.android_2016.lesson2.loadimagedemo;
/**
* Callback интерфейс для получения уведомления о прогрессе.
*/
public interface ProgressCallback {
/**
* Вызывается при изменении значения прогресса.
* @param progress новое значение прогресса от 0 до 100.
*/
void onProgressChanged(int progress);
}
| [
"dmitry.trunin@corp.mail.ru"
] | dmitry.trunin@corp.mail.ru |
f1a7e95fddad529171b75ac672c6d4a5ebc91c8c | 10d0e040fcdf3c9a57a5f62e54ca7c17867429ba | /src/main/java/directions/VerticalMover.java | 2e22732dec81ba7ecfe55111626460eb0ccab5ea | [] | no_license | redaDebbache/mower | 97e09293eb2b86bcf3e40fda6a78b24f5d06263f | 90959719383ab28cde9f8a4dbd8677c3867478f8 | refs/heads/master | 2020-03-30T08:05:35.120479 | 2018-10-06T14:56:02 | 2018-10-06T14:56:02 | 150,988,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package directions;
import model.Mower;
import model.Position;
import static java.lang.Math.max;
import static java.lang.Math.min;
public class VerticalMover implements Mover {
@Override
public Position nextPosition(Mower mower) {
Position currentPosition = mower.getPosition();
Position maxEdgesToReachPosition = mower.getFarthestPosition();
Integer shiftingSign = mower.getShiftingSign();
return new Position(currentPosition.getX(), max(0, min(currentPosition.getY() + shiftingSign, maxEdgesToReachPosition.getY())));
}
}
| [
"ridha.debbache@gmail.com"
] | ridha.debbache@gmail.com |
93a4351143b08b1c2327679fbfd5447b4b138bd1 | 470cdaa4e96c85e817a0136e7a284bf61d47eb4c | /src/main/java/com/impacta/apirest/resources/LivrosResources.java | aa3a66ba642cd559ff30b9783f0a74e5d3996212 | [] | no_license | IsaacMelo/Api_RestFull | d4a50a198f4358cfb86a3a3d1f9b2459577063de | d5d1b3a13e1577223204ec2d55276b51c1bb84bd | refs/heads/master | 2021-01-12T11:14:50.617466 | 2016-11-04T20:20:47 | 2016-11-04T20:20:47 | 72,882,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,455 | java | package com.impacta.apirest.resources;
import java.net.URI;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import com.impacta.apirest.domain.Livro;
import com.impacta.apirest.services.LivrosServices;
import com.impacta.apirest.services.exceptions.LivroNaoEncontradoException;
@RestController
@RequestMapping("/livros")
public class LivrosResources {
@Autowired
private LivrosServices livrosServices;
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<List<Livro>> listar(){
return ResponseEntity.status(HttpStatus.OK).body(livrosServices.listar());
}
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Void> salvar(@RequestBody Livro livro){
livro = livrosServices.salvar(livro);
URI uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(livro.getId()).toUri();
return ResponseEntity.created(uri).build();
}
@RequestMapping(value = "/{id}" , method = RequestMethod.GET)
public ResponseEntity<?> buscar(@PathVariable("id") Long id){
Livro livro = null;
try{
livro = livrosServices.buscar(id);
}catch(LivroNaoEncontradoException e){
return ResponseEntity.notFound().build();
}
return ResponseEntity.status(HttpStatus.OK).body(livro);
}
@RequestMapping(value = "/{id}" , method = RequestMethod.DELETE)
public ResponseEntity<Void> deletar(@PathVariable("id") Long id){
try{
livrosServices.deletar(id);
}catch(LivroNaoEncontradoException e){
return ResponseEntity.notFound().build();
}
return ResponseEntity.noContent().build();
}
@RequestMapping(value = "/{id}" , method = RequestMethod.PUT)
public ResponseEntity<Void> atualizar(@RequestBody Livro livro, @PathVariable("id") Long id){
livro.setId(id);
try{
livrosServices.atualizar(livro);
}catch(LivroNaoEncontradoException e){
return ResponseEntity.notFound().build();
}
return ResponseEntity.noContent().build();
}
}
| [
"isaac.melo@voxage.com.br"
] | isaac.melo@voxage.com.br |
f965eaa3d06530dd86052eb11088d963ad5350ca | e724b5f9ccc6457c5235a26ab7979adc710fd30c | /Java/src/main/java/sample/util/StorageMock.java | 0e00635f868a0f51caf0e75412f944461eb661a5 | [] | no_license | LacunaSoftware/PkiExpressSamples | 9eea9f5b21ad6517de515ebf6e2bc1d0f330b63e | ca709c3c38c803ce8605b1527055bc883998668c | refs/heads/master | 2023-01-22T13:57:59.533443 | 2021-12-20T13:57:15 | 2021-12-20T13:57:15 | 108,450,588 | 2 | 2 | null | 2023-01-11T02:48:46 | 2017-10-26T18:31:42 | JavaScript | UTF-8 | Java | false | false | 1,961 | java | package sample.util;
import javax.servlet.http.HttpSession;
public class StorageMock {
/**
* Returns the verification code associated with the given document, or null if no verification
* code has been associated with it.
* @param session
* @param fileId
* @return
*/
public static String getVerificationCode(HttpSession session, String fileId) {
// >>>>> NOTICE <<<<<
// This should be implemented on your application as a SELECT on your "document table" by
// the ID of the document, returning the value of the verification code column.
return (String) session.getAttribute(String.format("Files/%s/Code", fileId));
}
/**
* Registers the verification code for a given document.
* @param session
* @param fileId
* @param code
*/
public static void setVerificationCode(HttpSession session, String fileId, String code) {
// >>>>> NOTICE <<<<<
// This should be implemented on your application as an UPDATE on your "document table"
// filling the verification code column, which should be an indexed column.
session.setAttribute(String.format("Files/%s/Code", fileId), code);
session.setAttribute(String.format("Codes/%s", code), fileId);
}
/**
* Returns the ID of the document associated with a given verification code, or null if no
* document matcher the given code.
* @param session
* @param code
* @return
*/
public static String lookupVerificationCode(HttpSession session, String code) {
if (code == null || code.length() == 0) {
return null;
}
// >>>>> NOTICE <<<<<
// This should be implemented on your application as a SELECT on your "document table" by
// the verification code column, which should be an indexed column.
return (String) session.getAttribute(String.format("Codes/%s", code));
}
} | [
"140083162@aluno.unb.br"
] | 140083162@aluno.unb.br |
3278b5e2f1a698d5d7ecc4f58f2cb6c470824376 | a7a11ac60e63f152c599580d1b02ae11234a2486 | /cmps115Project/RentsPlanet/src/main/java/com/dl/rentsplanet/House.java | d34a73d6a256ce41578032bc12215b39f0839517 | [] | no_license | luke-shepherd/RentsPlanet | a77ec84aecf545f42857dd4054af72b029e725f2 | cb9313ac84946ff430185bb2914a1d84ba00ef06 | refs/heads/master | 2021-08-11T23:42:38.227153 | 2016-11-29T18:49:56 | 2016-11-29T18:49:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package com.dl.rentsplanet;
/**
* Created by bicboi on 10/19/16.
*/
public class House {
private int id;
private String address;
private int rent;
private String landlord;
public House() {}
public House(String address, int rent, String landlord) {
this.address = address;
this.rent = rent;
this.landlord = landlord;
}
public String getLandlord() {
return landlord;
}
public void setLandlord(String landlord) {
this.landlord = landlord;
}
public int getRent() {
return rent;
}
public void setRent(int rent) {
this.rent = rent;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public RentEntryBean toRentEntryBean() {
RentEntryBean peb = new RentEntryBean();
peb.setAddress(address);
peb.setRent(Integer.toString(rent));
peb.setLandLord(landlord);
return peb;
}
}
| [
"lukeshep@gmail.com"
] | lukeshep@gmail.com |
006c4ef4f5650830fd938fec0c342b6e0b759bae | 6d6e32054b3d966a091f6651523267cc6a37aca1 | /src/main/java/com/qiang/modules/sys/service/impl/RegisterServiceImpl.java | db2bbc90304c35f6772312b95d48b820436fb014 | [] | no_license | yexi520/people-blog | e87fc48cf973a6cda3fee4018d7094efb4e4c762 | d70241fe1cc397b32aa0d5e5f225fdf8fe713ca1 | refs/heads/master | 2020-09-09T07:18:15.219035 | 2019-09-15T08:12:01 | 2019-09-15T08:12:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,370 | java | package com.qiang.modules.sys.service.impl;
import com.qiang.modules.sys.mapper.RegisterMapper;
import com.qiang.modules.sys.service.AsyncService;
import com.qiang.modules.sys.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* @Author: qiang
* @ProjectName: adminsystem
* @Package: com.qiang.modules.sys.service.impl
* @Description:
* @Date: 2019/8/9 0009 17:32
**/
@Service
public class RegisterServiceImpl implements RegisterService {
@Autowired
private RegisterMapper registerMapper;
@Autowired
private AsyncService asyncService;
@Transactional(propagation = Propagation.SUPPORTS)
@Override
public int findByPhone(String phone) {
int phoneNum = registerMapper.findByPhone(phone);
// 异步把数据库中的手机号存入缓存
asyncService.insUserPhone();
return phoneNum;
}
@Transactional(propagation = Propagation.SUPPORTS)
@Override
public int findByUsername(String username) {
int name = registerMapper.findByName(username);
// 异步把数据库中的用户名存入缓存
asyncService.insUserName();
return name;
}
}
| [
"1158821459@qq.com"
] | 1158821459@qq.com |
797d87d496facbfe3df501ef32107575f6378af3 | 10d4b67c941462b21e6227828ac440312bd403a3 | /src/main/java/com/isaque/peopleapi/controller/PhoneController.java | a110730452fc85da051586eb63777d9b9109aa92 | [] | no_license | isaquebrother90/API_REST_Cadastro_de_Pessoas | 0287dc1b7f9273439400d889d7fe0adb437734e7 | 433fc7e0a161f6e493ad016d3eaadf7a407bd168 | refs/heads/main | 2023-01-31T23:40:18.464302 | 2020-12-14T19:37:20 | 2020-12-14T19:37:20 | 321,452,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,699 | java | package com.isaque.peopleapi.controller;
import com.isaque.peopleapi.dto.request.PhoneRequestDto;
import com.isaque.peopleapi.dto.response.PhoneResponseDto;
import com.isaque.peopleapi.service.PhoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RestController()
@RequestMapping("api/v1/phones")
@Validated
public class PhoneController {
@Autowired
PhoneService service;
@GetMapping
public ResponseEntity<Page<PhoneResponseDto>> index(Pageable page) {
return ResponseEntity.ok(service.findAll(page));
}
@GetMapping("{id}")
public ResponseEntity<PhoneResponseDto> findById(@PathVariable Long id) {
return ResponseEntity.ok(service.findById(id));
}
@PostMapping
public ResponseEntity<PhoneResponseDto> store(@RequestBody @Valid PhoneRequestDto dto) {
PhoneResponseDto response = service.store(dto);
return ResponseEntity
.created(UtilController.generatedUri(response.getId()))
.body(response);
}
@PutMapping("{id}")
public ResponseEntity<PhoneResponseDto> store(@PathVariable Long id, @RequestBody @Valid PhoneRequestDto dto) {
return ResponseEntity.ok(service.update(id, dto));
}
@DeleteMapping("{id}")
public ResponseEntity<?> destroy(@PathVariable Long id) {
service.destroy(id);
return ResponseEntity.noContent().build();
}
} | [
"improgramcode@gmail.com"
] | improgramcode@gmail.com |
52f69debbac6fe20e8a674dc415a73b6e2492e02 | 02702a36a2a576c7afa394841ae31ec627b7ef23 | /modules/fixflow-expand/src/main/java/com/founder/fix/fixflow/expand/connector/Sybase/Sybase.java | da44c554f0f2fc31a4a76cd5d3a38b2c32d37440 | [
"Apache-2.0"
] | permissive | nkchenhao/fixflow | 965ad6488d8d1beba3111f2d6c4ea6fd8c47237f | e2d4045899baa7782dd9ce986a9c4594f0aeac26 | refs/heads/master | 2021-01-15T20:34:19.626689 | 2014-08-07T07:39:19 | 2014-08-07T07:39:19 | 41,476,251 | 1 | 0 | null | 2015-08-27T08:56:27 | 2015-08-27T08:56:26 | null | UTF-8 | Java | false | false | 990 | java | /**
* Copyright 1996-2013 Founder International Co.,Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author kenshin
*/package com.founder.fix.fixflow.expand.connector.Sybase;
import com.founder.fix.fixflow.core.runtime.ExecutionContext;
import com.founder.fix.fixflow.core.action.ConnectorHandler;
public class Sybase implements ConnectorHandler {
public void execute(ExecutionContext executionContext) throws Exception {
}
} | [
"kenshin.net@gmail.com"
] | kenshin.net@gmail.com |
70ed7b6b30c247ef2cbe099144f8fdedba9da74a | 7b44f3ffd0ed452c6d960f87323700a4a435077e | /src/main/java/com/tiviacz/travelersbackpack/api/fluids/effects/FluidEffect.java | a74fe02c7815fd03def834ff15a896306b3eac46 | [] | no_license | Featherstone9086/Travelers-Backpack | 04b7526ca43500ba463355a94cb2ed4b0307704a | 910aad7226ed22ce908284acf6ccb7df75d537a3 | refs/heads/master | 2023-04-13T14:36:58.589401 | 2021-04-25T12:24:25 | 2021-04-25T12:24:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,089 | java | package com.tiviacz.travelersbackpack.api.fluids.effects;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
public abstract class FluidEffect
{
public Fluid fluid;
public int effectID;
public int amountRequired;
public FluidEffect(FluidStack fluidStack, int amountRequired)
{
this(fluidStack.getFluid(), amountRequired);
}
public FluidEffect(Fluid fluid, int amountRequired)
{
this.fluid = fluid;
this.effectID = 0;
this.amountRequired = amountRequired;
if(fluid != null)
{
com.tiviacz.travelersbackpack.fluids.FluidEffectRegistry.registerFluidEffect(this);
}
}
public FluidEffect(String fluidName, int amountRequired)
{
Fluid fluid = FluidRegistry.getFluid(fluidName);
this.fluid = fluid;
this.effectID = 0;
this.amountRequired = amountRequired;
if(fluid != null)
{
com.tiviacz.travelersbackpack.fluids.FluidEffectRegistry.registerFluidEffect(this);
}
}
public void setEffectID(int id)
{
effectID = id;
}
public int getEffectID()
{
return effectID;
}
/**
* This method determines what will happen to the player (or world!) when drinking the
* corresponding fluid. For example set potion effects, set player on fire,
* heal, fill hunger, etc. You can use the world parameter to make
* conditions based on where the player is.
*
* @param world The World.
* @param entity The entity that will be affected.
*/
public abstract void affectDrinker(FluidStack stack, World world, Entity entity);
/**
* This method runs before hose is used.
*
* @param world The World.
* @param entity The entity that will be affected.
*/
public abstract boolean canExecuteEffect(FluidStack stack, World world, Entity entity);
} | [
"prusek.kamil@o2.pl"
] | prusek.kamil@o2.pl |
d29199429d3ee112d4bb4bbcb3b31a8beece85a6 | cd99433d952a4d3d33b31242053e4c34b054cc34 | /src/main/java/com/cg/healthyfy/services/DietServiceImpl.java | 32b87921b2d33f9907174ac8d21653082d77c200 | [] | no_license | Raghuveersingh-2097/sprint | c0e850b8a940d45ef7145b296157ecac73dfa4dc | c62e1b661ba1e37c28a1e4d94d782019141a403e | refs/heads/master | 2023-02-27T08:48:57.160969 | 2021-02-02T17:51:47 | 2021-02-02T17:51:47 | 335,375,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,991 | java | package com.cg.healthyfy.services;
import java.util.List;
import java.util.Scanner;
import javax.persistence.Query;
import com.cg.healthify.constants.DietPlanConstants;
import com.cg.healthyfy.daos.DietDAOImpl;
import com.cg.healthyfy.domain.DietPlanInfo;
import com.cg.healthyfy.domain.LoginInfo;
import com.cg.healthyfy.exception.NoRecordFoundException;
import com.cg.healthyfy.util.SameUtilContainer;
public class DietServiceImpl extends SameUtilContainer{
DietPlanInfo diet=new DietPlanInfo();
DietDAOImpl dietdao =new DietDAOImpl();
LoginInfo log=new LoginInfo();
Scanner sc=new Scanner(System.in);
public void addDiet() {
int io=0;
try {
System.out.println("Enter DietID: ");
diet.setId(sc.nextInt());
Query query=em.createQuery("from LoginInfo");
List<LoginInfo> loginm= query.getResultList();
for(LoginInfo i:loginm) {
if(i.getId()==diet.getId()) {
io++;
break;
}
}
Validate(io);
}
catch(NoRecordFoundException m) {
System.out.println(m);
}
if(io==1) {
System.out.println("Enter Slot: ");
diet.setSlots(sc.next());
System.out.println("Enter type of food you take: ");
diet.setTypeOfFood(sc.next());
if(diet.getTypeOfFood().equalsIgnoreCase("NONVEG")) {
diet.setProteinRatio(DietPlanConstants.non_veg_protien_ratio);
diet.setRatioOfFat(DietPlanConstants.nonVegFatRatio);
diet.setRatioOfcarbs(DietPlanConstants.nonVegCarbsRatio);
}
else {
diet.setProteinRatio(DietPlanConstants.veg_protien_ratio);
diet.setRatioOfFat(DietPlanConstants.vegFatRatio);
diet.setRatioOfcarbs(DietPlanConstants.vegFatRatio);
}
diet.setTotal(diet.getRatioOfcarbs()+diet.getRatioOfFat());
dietdao.save_diet_plan(diet, log);
}
}
public void updateDiet() {
int io=0;
try {
System.out.println("Please Confirm your ID to update diet plan ");
diet.setId(sc.nextInt());
Query query=em.createQuery("from LoginInfo");
List<LoginInfo> loginm= query.getResultList();
for(LoginInfo i:loginm) {
if(i.getId()==diet.getId() ) {
io++;
break;
}
}
Validate(io);
}
catch(NoRecordFoundException m) {
System.out.println(m);
}
if(io==1) {
System.out.println("New Slot: ");
diet.setSlots(sc.next());
System.out.println("New Food Type: ");
diet.setTypeOfFood(sc.next());
if(diet.getTypeOfFood().equalsIgnoreCase("NONVEG")) {
diet.setProteinRatio(DietPlanConstants.non_veg_protien_ratio);
diet.setRatioOfFat(DietPlanConstants.nonVegFatRatio);
diet.setRatioOfcarbs(DietPlanConstants.nonVegCarbsRatio);
}
else {
diet.setProteinRatio(DietPlanConstants.veg_protien_ratio);
diet.setRatioOfFat(DietPlanConstants.vegFatRatio);
diet.setRatioOfcarbs(DietPlanConstants.vegCarbsRatio);
}
diet.setTotal(diet.getRatioOfcarbs()+diet.getRatioOfFat());
dietdao.update_diet_plan(diet);
}
}
public void deleteDiet() {
int io=0;
try {
System.out.println("Please Confirm your Id to remove your Diet plan: ");
diet.setId(sc.nextInt());
Query query=em.createQuery("from LoginInfo");
List<LoginInfo> loginm= query.getResultList();
for(LoginInfo i:loginm) {
if(i.getId()==diet.getId()) {
io++;
break;
}
}
Validate(io);
}
catch(NoRecordFoundException m) {
System.out.println(m);
}
if(io==1) {
dietdao.remove_diet_plan(diet);
}
}
public void findDietData() {
int io=0;
try {
System.out.println("Please give your ID to get your diet details: ");
diet.setId(sc.nextInt());
Query query=em.createQuery("from LoginInfo");
List<LoginInfo> loginm= query.getResultList();
for(LoginInfo i:loginm) {
if(i.getId()==diet.getId()){
io++;
break;
}
}
Validate(io);
}
catch(NoRecordFoundException m) {
System.out.println(m);
}
if(io==1) {
dietdao.customer_diet_plan_data(diet);
}
}
static void Validate(int io)throws NoRecordFoundException{
if(io==0) {
throw new NoRecordFoundException("No Records Found");
}
}
}
| [
"raghuvversingh2097@gmail.com"
] | raghuvversingh2097@gmail.com |
3e1701dce0793c46d68a1d21f89073e046fad23a | 6f8a49119f09543ad48ab30b81d7c6a9da2b20eb | /ChatServer/ServerThread.java | c7a9cb97c3325a4041df5f6da6896002bc42ae62 | [] | no_license | reesdela/Projects | 8ace0ed8c09c769673af0bb0057b055ac2f56fc4 | ac6015f6bcb1155af3f0fc97231b3d15154b58d9 | refs/heads/master | 2023-07-15T09:03:35.689688 | 2018-08-16T23:04:37 | 2018-08-16T23:04:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,099 | java | import java.net.*;
import java.io.*;
public class ServerThread extends Thread
{
private Server server;
private Socket socket;
private InputStream in;
private OutputStream out;
private String word;
private String name;
private boolean first = false;
private DataInputStream ind;
private DataOutputStream outd;
public ServerThread(Server server1, Socket socket1)
{
server = server1;
socket = socket1;
}
public String getNames()
{
return name;
}
public void send(String message)
{
try
{
out = socket.getOutputStream();
outd = new DataOutputStream(out);
outd.writeUTF(message);
outd.flush();
}
catch(IOException e)
{
e.printStackTrace();
}
}
public void close() throws IOException
{
if(socket != null)
{
socket.close();
}
if(ind != null)
{
ind.close();
}
if(outd != null)
{
outd.close();
}
}
public void run()
{
try
{
in = socket.getInputStream();
ind = new DataInputStream(in);
word = ind.readUTF();
if(first != true)
{
for(int i = 0; i < word.length(); i++)
{
if(word.charAt(i) == ' ')
{
name = word.substring(0, i);
break;
}
}
first = true;
server.writeClient(word);
word = ind.readUTF();
}
while(!(word.equals("bye")))
{
System.out.println(word);
server.writeClient(word);
word = ind.readUTF();
}
System.out.println(word);
server.remove(this);
return;
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
| [
"noreply@github.com"
] | reesdela.noreply@github.com |
bbc2b36b2fe64e8d421de2f91be6c77339268ed5 | fb7a6070ba2252fe53355817606fadab5abe1f2b | /DesignPatterns/src/com/example/state/gumballstate/SoldState.java | 610b8dbc4f778ebc5c898f684b640166f61b7306 | [] | no_license | armandoh/java_samples | ea8cadf1b708be9a1d75f8f8aaf352e5e01507f9 | f2871b15c49847d3a5419d062ee71b0eee87fe3f | refs/heads/master | 2021-01-15T19:28:14.544935 | 2014-07-18T18:23:38 | 2014-07-17T22:23:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java | /*
* Using examples from Head First - Design Patterns
*/
package com.example.state.gumballstate;
/**
*
* @author Armando
*/
public class SoldState implements State {
private GumballMachine gumballMachine;
public SoldState(GumballMachine gumballMachine) {
this.gumballMachine = gumballMachine;
}
@Override
public void insertQuarter() {
System.out.println("Please wait, we're already giving you a gumball");
}
@Override
public void ejectQuarter() {
System.out.println("Sorry, you already turned the crank");
}
@Override
public void turnCrank() {
System.out.println("Turning twice doesn't get you another gumball!");
}
@Override
public void dispense() {
gumballMachine.releaseBall();
if (gumballMachine.getCount() > 0) {
gumballMachine.setState(gumballMachine.getNoQuarterState());
} else {
System.out.println("Oops, out of gumballs!");
gumballMachine.setState(gumballMachine.getSoldOutState());
}
}
public String toString() {
return "dispensing a gumball";
}
}
| [
"armando.hdz.b@gmail.com"
] | armando.hdz.b@gmail.com |
616dd70c4ff176d267277f897c818ae8de09e40e | 7e2db5393fe3da26c3fd1aec68226379940b3af5 | /src/main/java/rreeggkk/nuclearsciences/common/util/TimeConversion.java | dcd4da66be2e1010d59cfa521d341bcd5dad3023 | [
"MIT"
] | permissive | rreeggkk/NuclearSciences | 12d12668bfd2fec3b9a474f50f0c37fb951aa00a | e1666a861eb52688e468f26933818db94f1581ef | refs/heads/master | 2020-09-17T12:50:45.684330 | 2017-01-22T22:57:46 | 2017-01-22T22:57:46 | 66,086,763 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | package rreeggkk.nuclearsciences.common.util;
import org.apfloat.Apfloat;
import rreeggkk.nuclearsciences.common.Constants;
public final class TimeConversion {
public static Apfloat secToTick(Apfloat sec) {
return sec.precision(Constants.PRECISION).multiply(new Apfloat(Constants.TICKS_PER_SECOND, Constants.PRECISION));
}
public static Apfloat secToTick(double sec) {
return secToTick(new Apfloat(sec, Constants.PRECISION));
}
public static Apfloat minToTick(Apfloat min) {
return min.precision(Constants.PRECISION).multiply(new Apfloat(60*Constants.TICKS_PER_SECOND, Constants.PRECISION));
}
public static Apfloat minToTick(double min) {
return minToTick(new Apfloat(min, Constants.PRECISION));
}
public static Apfloat hourToTick(Apfloat hr) {
return hr.precision(Constants.PRECISION).multiply(new Apfloat(60*60*Constants.TICKS_PER_SECOND, Constants.PRECISION));
}
public static Apfloat hourToTick(double hr) {
return hourToTick(new Apfloat(hr, Constants.PRECISION));
}
public static Apfloat dayToTick(Apfloat day) {
return day.precision(Constants.PRECISION).multiply(new Apfloat(24*60*60*Constants.TICKS_PER_SECOND, Constants.PRECISION));
}
public static Apfloat dayToTick(double day) {
return dayToTick(new Apfloat(day, Constants.PRECISION));
}
public static Apfloat yearToTick(Apfloat years) {
return years.precision(Constants.PRECISION).multiply(new Apfloat(365.2425*24*60*60*Constants.TICKS_PER_SECOND, Constants.PRECISION));
}
public static Apfloat yearToTick(double years) {
return yearToTick(new Apfloat(years, Constants.PRECISION));
}
}
| [
"rreeggkk1@gmail.com"
] | rreeggkk1@gmail.com |
3b8fea003c720bb57cd95605a37660e8ab9b9be5 | ec61ac01721aaaa9a25398aed7f67692c25e9087 | /Android/TUIKit/TUIChat/tuichat/src/main/java/com/tencent/qcloud/tuikit/tuichat/ui/view/message/MaxWidthFrameLayout.java | 0857d0d0800f2dc242871b2eb0725a92942dab9e | [] | no_license | lisen87/TIMSDK | b5616ef724a1299e5aba488d1a904d9ec09f73bf | 15f98caf776b2e7bc123535d3774136cc32bd84a | refs/heads/master | 2023-03-16T07:22:06.419432 | 2022-08-26T10:03:03 | 2022-08-26T10:14:30 | 183,566,138 | 1 | 0 | null | 2019-04-26T05:56:27 | 2019-04-26T05:56:26 | null | UTF-8 | Java | false | false | 1,573 | java | package com.tencent.qcloud.tuikit.tuichat.ui.view.message;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tencent.qcloud.tuikit.tuichat.R;
public class MaxWidthFrameLayout extends FrameLayout {
int maxWidthPx;
public MaxWidthFrameLayout(@NonNull Context context) {
super(context);
}
public MaxWidthFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public MaxWidthFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attributeSet) {
TypedArray array = context.obtainStyledAttributes(attributeSet, R.styleable.max_width_style);
maxWidthPx = array.getDimensionPixelSize(R.styleable.max_width_style_maxWidth, 0);
array.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int measuredWidth = MeasureSpec.getSize(widthMeasureSpec);
if(maxWidthPx > 0 && maxWidthPx < measuredWidth) {
widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxWidthPx, MeasureSpec.AT_MOST);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
| [
"harperhpliu@tencent.com"
] | harperhpliu@tencent.com |
c7b71fbc7c838caf8481751988eb469b96686c1a | 2a720b11095d6d5343aee18b644aa6d20a538299 | /src/NameAscComparator.java | ea968557e31b7226942bb361450f61a4ca93d99d | [] | no_license | TwardowskaA/Zadanie14.2 | e33cc175a523b68eed085c63bf7814e04f63a19a | 6ba1e05608f01b812beb567c31ecbc25df6c4dd5 | refs/heads/master | 2020-03-26T20:33:41.085347 | 2018-08-19T19:41:26 | 2018-08-19T19:41:26 | 145,332,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | import java.util.Comparator;
public class NameAscComparator implements Comparator<User> {
@Override
public int compare(User o1, User o2) {
return o1.getFirstName().compareTo(o2.getFirstName());
}
}
| [
"twardowska123@gmail.com"
] | twardowska123@gmail.com |
31fe23b3fd5f6fb84ee2d11ddad402c65dec1da7 | 0d99dc277b469b474a238a9bd5c505c86cfdd80e | /src/java7/Chapter5/Mitarbeiter.java | 32da86ed3b9e3f85ad33b9df5e66e162ba7e62aa | [] | no_license | Borislove/Books | fa93d05274315b9440ae66c2c5a2109ef55f2a1e | 248c1b4ca743c860c34c3eed3543d116f0c2a308 | refs/heads/master | 2023-01-23T16:03:18.683669 | 2023-01-18T23:42:52 | 2023-01-18T23:42:52 | 254,092,418 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,178 | java | package java7.Chapter5;
class Mitarbeiter {
String m_name;
String m_vorname;
int m_gehalt;
Mitarbeiter(String name, String vorname, int gehalt) {
m_name = name;
m_vorname = vorname;
m_gehalt = gehalt;
}
void datenAusgeben() {
System.out.println("\n");
System.out.println(" Имя : " + m_name);
System.out.println(" Фамилия : " + m_vorname);
System.out.println(" Зарплата: " + m_gehalt + " евро");
}
void gehaltErhoehen(int erhoehung) {
m_gehalt += erhoehung;
}
}
// Производные классы. Класс стажера
class Lehrling extends Mitarbeiter {
int abgelegtePruefungen;
// Конструктор устанавливает количество пройденных испытаний равным 0
Lehrling(String name, String vorname, int gehalt) {
// Вызов конструктора базового класса
super(name, vorname, gehalt);
// Инициализация собственных полей
abgelegtePruefungen = 0;
}
}
class Angestellter extends Mitarbeiter {
int hierarchiestufe;
final int MAX_HIERARHIE = 5;
// Конструктор
Angestellter(String name, String vorname, int gehalt) {
// Вызов конструктора базового класса
super(name, vorname, gehalt);
// Инициализация собственных полей
hierarchiestufe = 0;
}
void befoerdern() {
// В случае возможности, повышение
if (hierarchiestufe < MAX_HIERARHIE)
hierarchiestufe++;
}
}
class Chef extends Mitarbeiter {
// Никаких расширений
// Конструктор Chef вызывает только конструктор базового класса
Chef(String name, String vorname, int gehalt) {
super(name, vorname, gehalt);
}
// Шеф получает зарплату больше
void gehaltErhoehen(int erhoehung) {
m_gehalt += 2 * erhoehung;
}
}
| [
"abirme@yandex.ru"
] | abirme@yandex.ru |
bac13afbe790fadbc524cf532627f56947d7bf05 | 60d3332deca72f4744db62baa694c97027a5242e | /taotao-manage/taotao-manage-service/src/main/java/com/taotao/manage/service/ItemParamItemService.java | 072795c7e954a0eca15965b2fa08042194c109fb | [] | no_license | farrellcloud/taotao-store | d91358e4a2c1b8f4360bfdd344b5640f617e0c9d | 8a00134eb1bfbf912864465ade5aebc6e49a8980 | refs/heads/master | 2020-03-07T14:58:35.760369 | 2018-10-21T14:14:54 | 2018-10-21T14:14:54 | 127,541,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 931 | java | package com.taotao.manage.service;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.abel533.entity.Example;
import com.taotao.manage.mapper.ItemParamItemMapper;
import com.taotao.manage.pojo.ItemParamItem;
@Service
public class ItemParamItemService extends BaseService<ItemParamItem>{
@Autowired
private ItemParamItemMapper itemParamItemMapper;
public Integer updateItemParamItem(Long itemId, String paramData) {
//更新数据
ItemParamItem itemParamItem = new ItemParamItem();
itemParamItem.setParamData(paramData);
itemParamItem.setUpdated(new Date());
//更新条件
Example example = new Example(ItemParamItem.class);
example.createCriteria().andEqualTo("itemId", itemId);
return this.itemParamItemMapper.updateByExampleSelective(itemParamItem, example);
}
}
| [
"952764934@qq.com"
] | 952764934@qq.com |
673e37e095d115070e961553e112484bfd6299ab | e4a0e93c77e5bf500240355ee0c8500fc9167f8c | /entity.configuration.shared/src/main/java/in/appops/platform/client/config/client_type/LabelFieldConfig.java | 5ad48bc439605265ffe85c74469ad39a6a88d0d6 | [] | no_license | aino-gautam/Deprecated_AppOps_Shared | 21a118c4183296af8fe46731e381e2e984e7c85a | 5df82296fdeb9e2beccbda5d6fe96737c1abaef8 | refs/heads/master | 2021-01-11T10:47:50.777155 | 2014-07-19T03:55:47 | 2014-07-19T03:55:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package in.appops.platform.client.config.client_type;
import in.appops.platform.core.entity.type.MetaType;
import in.appops.platform.server.entityconfiguration_type.basic.LabelFieldConfigType;
/**
* @author pallavi@ensarm.com
* @createdOn 1-Nov-2013
*/
@SuppressWarnings("serial")
public class LabelFieldConfig extends BaseFieldConfig {
public LabelFieldConfig() {
super.setType(new MetaType(LabelFieldConfig.class));
}
public String getDisplayTitle(){
return getPropertyByName(LabelFieldConfigType.LBLFD_TITLE);
}
public String getDisplayText(){
return getPropertyByName(LabelFieldConfigType.LBLFD_DISPLAYTXT);
}
public String isWordWrap(){
return getPropertyByName(LabelFieldConfigType.LBLFD_ISWORDWRAP);
}
}
| [
"pallavi@ensarm.com"
] | pallavi@ensarm.com |
3f6a0544d4f72c4bdd5de744f177fe76bad15fdd | 57ecf65f0c84ebcc77d37094e0cc4bf60f30d286 | /common-messaging-service/src/main/java/com/common/data/repository/OpenInterestRepository.java | b9bdfeeeee5eae8c60afe99a12a6272d6718bd79 | [] | no_license | brijeshbhomkar/stock-apps | a559334eefb9525ab486af6a5c8b1b192875184b | 80adbf807463549d0f9c8b01e185736a349c0831 | refs/heads/master | 2022-12-23T07:30:37.786332 | 2022-10-30T10:39:09 | 2022-10-30T10:39:09 | 161,975,402 | 0 | 1 | null | 2022-12-10T03:30:41 | 2018-12-16T06:46:31 | Java | UTF-8 | Java | false | false | 291 | java | package com.common.data.repository;
import com.common.data.model.OpenInterest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface OpenInterestRepository extends JpaRepository<OpenInterest, Long> {
}
| [
"brijesh.bhomkar@vertexinc.com"
] | brijesh.bhomkar@vertexinc.com |
068adfcf7c970fd6b651cdc3cbcae26f1499d9aa | 6e49e48eb366d7f691188572e3b77285172bf965 | /cs599-evaluation/src/main/java/sizesummary/SizeParserRunner.java | 84c239bcd5c253db4efd190cd507d08da8f9c096 | [
"Apache-2.0"
] | permissive | harshfatepuria/Evaluation-of-Content-Analysis-on-TREC-Polat-DD-Dataset | dde3707d13824e3450874b6f88754086f99061ba | 6204fb4028b47226bb1ae4fbfedd10a553a8e3dc | refs/heads/master | 2021-01-24T22:15:28.208486 | 2016-05-28T00:10:12 | 2016-05-28T00:10:12 | 56,191,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,025 | java | package sizesummary;
import java.io.File;
import java.io.PrintWriter;
import java.nio.file.Path;
import java.util.List;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.mime.MediaType;
import cbor.CborDocument;
import shared.AbstractParserRunner;
public class SizeParserRunner extends AbstractParserRunner {
public SizeParserRunner(String baseFolder, String resultFolder) throws Exception {
this(baseFolder, resultFolder, null);
}
public SizeParserRunner(String baseFolder, String resultFolder, String markerFile) throws Exception {
setBaseFolder(baseFolder);
setResultFolder(resultFolder);
setMarkerFile(markerFile);
}
@Override
protected File getResultFile(String relativePath) {
return super.getResultFile(relativePath, ".size");
}
@Override
protected boolean parse(Path path, String relativePath, File resultFile, CborDocument cborDoc) throws Exception {
Metadata metadata = new Metadata();
if (cborDoc == null) {
return false;
}
metadata.add("filePath", relativePath);
MediaType mediaType = cborDoc.getMediaType();
String type = mediaType == null ? "application/octet-stream" : mediaType.getType() + "/" + mediaType.getSubtype();
metadata.add("mediaType", type);
Integer size = cborDoc.getFileSize();
metadata.add("size", ""+ size);
String json = getGson().toJson(metadata);
resultFile.getParentFile().mkdirs();
try(PrintWriter out = new PrintWriter(resultFile)) {
out.print(json);
}
return true;
}
public static void main(String[] args) throws Exception {
System.out.println("Run SizeParserRunner");
String baseFolder = "D:\\cs599\\commoncrawl";
String resultFolder = "C:\\cs599\\a3\\size\\result";
String markerFile = "C:\\cs599\\a3\\size\\marker.txt";
SizeParserRunner runner = new SizeParserRunner(baseFolder, resultFolder, markerFile);
runner.setDocumentsInCborFormat(true);
List<String> successPath = runner.runParser();
System.out.println("No of files: " + successPath.size());
}
}
| [
"rwarut@gmail.com"
] | rwarut@gmail.com |
a20aba2c67d2258c5d982fbfdcf918de8b300283 | a912b0a8f87e9d053739f99ec230d0897efd69c3 | /app/src/main/java/com/moe/LiveVisualizer/WelcomeActivity.java | b61ee27eb1814a09cea56b5c7a7327843825c5ef | [] | no_license | DearZack/wallpaper | 8cfeff9d7d28b219411f692234f81caf2e942b79 | adef1c7c9dedaa3f4a5dcf162dcdc1311b9269bc | refs/heads/master | 2020-03-17T02:44:12.243399 | 2018-05-12T22:08:21 | 2018-05-12T22:08:21 | 133,203,057 | 1 | 0 | null | 2018-05-13T03:41:38 | 2018-05-13T03:41:37 | null | UTF-8 | Java | false | false | 4,013 | java | package com.moe.LiveVisualizer;
import android.app.Activity;
import android.os.Bundle;
import android.content.ComponentName;
import android.os.Build;
import android.app.WallpaperInfo;
import android.widget.Toast;
import android.content.Intent;
import android.app.WallpaperManager;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
public class WelcomeActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
init();
}
private void init()
{
ComponentName service=new ComponentName(this,LiveWallpaper.class);
if (Build.VERSION.SDK_INT<23||(checkSelfPermission("android.permission.RECORD_AUDIO") == PackageManager.PERMISSION_GRANTED &&checkSelfPermission("android.permission.READ_PHONE_STATE")==PackageManager.PERMISSION_GRANTED))
{
/*if ( Build.VERSION.SDK_INT > 18 && !notificationListenerEnable() )
{
gotoNotificationAccessSetting();
return;
}*/
if(getPackageManager().getComponentEnabledSetting(service)!=PackageManager.COMPONENT_ENABLED_STATE_ENABLED){
getPackageManager().setComponentEnabledSetting(service,PackageManager.COMPONENT_ENABLED_STATE_ENABLED,PackageManager.DONT_KILL_APP);
}
WallpaperInfo info=WallpaperManager.getInstance(this).getWallpaperInfo();
if ( info == null || !getPackageName().equals(((WallpaperManager)getSystemService(WALLPAPER_SERVICE)).getWallpaperInfo().getPackageName()) )
{
Toast.makeText(getApplicationContext(),"先激活动态壁纸才能继续使用",Toast.LENGTH_LONG).show();
try
{
Intent intent =new Intent(
WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
new ComponentName(this, LiveWallpaper.class));
startActivity(intent);
}
catch (Exception e1)
{
try
{
startActivity(new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER));
}
catch (Exception e)
{
AlertDialog dialog= new AlertDialog.Builder(this).setMessage("无法打开动态壁纸设置界面,你仍然可以通过设置来启用").create();
dialog.setOnDismissListener(new DialogInterface.OnDismissListener(){
@Override
public void onDismiss(DialogInterface p1)
{
// TODO: Implement this method
finish();
}
});
dialog.show();
}
}
finish();
}
else
{
ComponentName setting=new ComponentName(this,SettingActivity.class);
if(getPackageManager().getComponentEnabledSetting(setting)!=PackageManager.COMPONENT_ENABLED_STATE_ENABLED)
getPackageManager().setComponentEnabledSetting(setting,PackageManager.COMPONENT_ENABLED_STATE_ENABLED,PackageManager.DONT_KILL_APP);
}
startActivity(new Intent(this,SettingActivity.class));
finish();
getPackageManager().setComponentEnabledSetting(new ComponentName(this,WelcomeActivity.class),PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
}
else
{
if(getPackageManager().getComponentEnabledSetting(service)!=PackageManager.COMPONENT_ENABLED_STATE_DISABLED){
getPackageManager().setComponentEnabledSetting(service,PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
}
requestPermissions(new String[]{"android.permission.RECORD_AUDIO","android.permission.READ_PHONE_STATE"}, 432);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
{
// TODO: Implement this method
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if ( requestCode == 432 )
{
boolean flag=true;
for(int grant:grantResults){
if(grant==PackageManager.PERMISSION_DENIED)
flag=false;
break;
}
if(flag)
init();
else{
Toast.makeText(getApplicationContext(),"未给权限,已退出",Toast.LENGTH_LONG).show();
finish();
}
}
}
}
| [
"dorobonneko@gmail.com"
] | dorobonneko@gmail.com |
8832013027d0f189303c58613d85dd5656d48453 | b7cbdd0b655f5b3bea3b8f78adfbfd5d59655348 | /java/technica/com/greencity/fragments/VolunteerFragment.java | c81a8ac587f685d9e72b28d61bd7bec4eeab1e86 | [] | no_license | amansachdeva93/green-city | bb601f72a61d7fbcc1a96549421df38c277cfc93 | 9967cc3d400cdec1dbc49a07e22ba866aea869ed | refs/heads/master | 2021-04-12T06:44:53.814383 | 2017-06-22T11:02:22 | 2017-06-22T11:02:22 | 94,504,454 | 0 | 0 | null | 2017-06-16T04:15:52 | 2017-06-16T04:15:52 | null | UTF-8 | Java | false | false | 9,741 | java | package technica.com.greencity.fragments;
import android.app.AlarmManager;
import android.app.DatePickerDialog;
import android.app.Fragment;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.util.ArrayList;
import java.util.Calendar;
import technica.com.greencity.activities.Navigation;
import technica.com.greencity.R;
import technica.com.greencity.Utils;
import technica.com.greencity.receivers.VolunteerAlarmReceiver;
import static com.facebook.FacebookSdk.getApplicationContext;
import static technica.com.greencity.Utils.VOLUNTEER_SIGNUP_DONE;
/**
* Created by Amanpreet Singh on 4/23/2017.
*/
public class VolunteerFragment extends Fragment implements View.OnClickListener {
Button setDate, setTime, btnvolunteer;
private int mYear, mMonth, mDay, mHour, mMinute ,mAMPM;
TextView date_status, time_status;
final static int RQS_1 = 1;
boolean dateset , timeset;
String TAG="Volunteer";
TimePickerDialog timePickerDialog;
DatePickerDialog datePickerDialog;
Calendar cal = Calendar.getInstance();
public EditText name, number;
SharedPreferences sharedPreference;
SharedPreferences.Editor editor;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView =
inflater.inflate(R.layout.volunteer_fragment, container, false);
sharedPreference = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
editor = sharedPreference.edit();
initViews(rootView);
setListeners();
return rootView;
}
private void setListeners() {
setDate.setOnClickListener(this);
setTime.setOnClickListener(this);
btnvolunteer.setOnClickListener(this);
}
private void initViews(View rootView) {
name = (EditText)rootView. findViewById(R.id.edit_name);
number = (EditText)rootView. findViewById(R.id.edit_number);
setDate = (Button)rootView. findViewById(R.id.btnSetDate);
setTime = (Button)rootView. findViewById(R.id.btnSetTime);
btnvolunteer = (Button)rootView. findViewById(R.id.sumbit_volunteer);
date_status = (TextView) rootView.findViewById(R.id.txtDateStatus);
time_status = (TextView) rootView.findViewById(R.id.txtTimeStatus);
}
@Override
public void onClick(View view) {
int id = view.getId();
switch (id){
case R.id.btnSetDate:
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
datePickerDialog = new DatePickerDialog(getActivity(),
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
date_status.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
cal.set(Calendar.YEAR,year);
cal.set(Calendar.MONTH,monthOfYear);
cal.set(Calendar.DAY_OF_MONTH,dayOfMonth);
dateset=true;
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
break;
case R.id.btnSetTime:
final Calendar c1 = Calendar.getInstance();
mHour = c1.get(Calendar.HOUR_OF_DAY);
mHour = c1.get(Calendar.HOUR_OF_DAY);
mMinute = c1.get(Calendar.MINUTE);
mAMPM = c1.get(Calendar.AM_PM);
// Launch Time Picker Dialog
timePickerDialog = new TimePickerDialog(getActivity(),
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
time_status.setText(hourOfDay + ":" + minute);
cal.set(Calendar.HOUR_OF_DAY,hourOfDay);
cal.set(Calendar.MINUTE,minute);
cal.set(Calendar.SECOND,00);
timeset = true;
}
}, mHour, mMinute, false);
timePickerDialog.show();
break;
case R.id.sumbit_volunteer:
if(dateset&×et){ Calendar current = Calendar.getInstance();
if(cal.compareTo(current) <= 0){
//The set Date/Time already passed
Toast.makeText(getApplicationContext(),
"Invalid Date/Time",
Toast.LENGTH_LONG).show();
}else{
//process service
setAlarm(cal);
}
}
else{
Toast.makeText(getActivity(), "Please set date/time !", Toast.LENGTH_SHORT).show();
}
break;
default://nothing
}
}
private void setAlarm(Calendar targetCal){
Toast.makeText(getActivity(), "Alarm is set" + targetCal.getTime() , Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getActivity(), VolunteerAlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(getActivity(), RQS_1, intent, 0);
AlarmManager alarmManager = (AlarmManager)getActivity().getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent);
new ProcessSign().execute("https://wwwandroidcinemacom.000webhostapp.com/volunteer_signup.php");
}
ProgressDialog pDialog1;
ArrayList<NameValuePair> nameValuePairs;
class ProcessSign extends AsyncTask<String, String, String>
{
@Override
protected void onPreExecute() {
pDialog1=new ProgressDialog(getActivity());
pDialog1.setMessage("Saving Volunteer credentials...");
pDialog1.setIndeterminate(false);
pDialog1.setTitle("Please wait...");
pDialog1.getWindow().setGravity(Gravity.CENTER_VERTICAL);
pDialog1.setCancelable(false);
pDialog1.show();
nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("name", name.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("email", number.getText().toString()));
}
@Override
protected String doInBackground(String... params) {
try {
Log.e(TAG, "doInBackground: yea status true" );
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(params[0]);
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
String response = EntityUtils.toString(httpEntity);
Log.d("msg", "POST Response >>>" + response);
return response;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
pDialog1.dismiss();
// <br>Toast.makeText(getApplicationContext(),"result"+result,Toast.LENGTH_LONG).show();
Log.e(TAG, result);
editor.putString(Utils.VOUNTEER_NAME,name.getText().toString());
editor.putString(Utils.VOLUNTEER_MOBILE,number.getText().toString());
editor.putBoolean(VOLUNTEER_SIGNUP_DONE,true);
editor.commit();
new Utils().showToast(getActivity(),"Your request to become volunteer has been successful.");
startActivity(new Intent(getApplicationContext(),Navigation.class));
getActivity().finish();
}
}
}
| [
"noreply@github.com"
] | amansachdeva93.noreply@github.com |
6d0164f10a38bb37539e527d6a3b657f482cad2d | 70432da4dcbd2f61e0b8eea67ee441723a99d817 | /codegenerator/src/main/java/cn/cnicg/sdgenerator/support/maker/RepositoryStructure.java | a5d4656727f674ed6acc0870f6de489d483dcb13 | [] | no_license | karl-liang/workutil | 866be3ba7b906d1d9b5ab138cc9ab20539616be5 | a53885ffb6443aa997694a195a223662a30fe6be | refs/heads/master | 2020-03-25T23:02:33.579633 | 2018-08-14T08:16:37 | 2018-08-14T08:16:37 | 144,256,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,759 | java | package cn.cnicg.sdgenerator.support.maker;
import javax.persistence.EmbeddedId;
import javax.persistence.Id;
import cn.cnicg.sdgenerator.support.maker.builder.ObjectBuilder;
import cn.cnicg.sdgenerator.support.maker.builder.ObjectStructure;
import cn.cnicg.sdgenerator.support.maker.values.ObjectTypeValues;
import cn.cnicg.sdgenerator.support.maker.values.ScopeValues;
import cn.cnicg.sdgenerator.util.*;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Created by carlos on 08/04/17.
*/
public class RepositoryStructure {
private CustomResourceLoader loader;
private ObjectBuilder objectBuilder;
private Integer error = 0;
private final static Map<Class<?>, Class<?>> mapConvert = new HashMap<>();
static {
mapConvert.put(boolean.class, Boolean.class);
mapConvert.put(byte.class, Byte.class);
mapConvert.put(short.class, Short.class);
mapConvert.put(char.class, Character.class);
mapConvert.put(int.class, Integer.class);
mapConvert.put(long.class, Long.class);
mapConvert.put(float.class, Float.class);
mapConvert.put(double.class, Double.class);
}
public RepositoryStructure(String repositoryPackage, String entityName, String entityClass, String postfix, CustomResourceLoader loader, Set<String> additionalExtends) {
this.loader = loader;
String repositoryName = entityName + postfix;
Tuple<String, Boolean> entityId = getEntityId(entityClass);
if(entityId != null) {
ObjectStructure objectStructure = new ObjectStructure(repositoryPackage, ScopeValues.PUBLIC, ObjectTypeValues.INTERFACE, repositoryName)
.addImport(entityClass)
.addImport("org.springframework.data.jpa.repository.JpaRepository")
.addImport("org.springframework.data.jpa.repository.JpaSpecificationExecutor")
.addImport("org.springframework.stereotype.Repository")
.addImport(entityId.right() ? entityId.left() : "")
.addAnnotation("Repository")
.addExtend("JpaRepository", entityName, GeneratorUtils.getSimpleClassName(entityId.left()))
.addExtend("JpaSpecificationExecutor", entityName);
if (additionalExtends != null) {
for(String additionalExtend : additionalExtends) {
objectStructure.addImport(additionalExtend);
objectStructure.addExtend(GeneratorUtils.getSimpleClassName(additionalExtend), entityName);
}
}
this.objectBuilder = new ObjectBuilder(objectStructure);
}
}
@SuppressWarnings("unchecked")
private Tuple<String, Boolean> getEntityId(String entityClass){
try {
Class<?> entity;
if (loader == null) {
entity = Class.forName(entityClass);
} else {
entity = loader.getUrlClassLoader().loadClass(entityClass);
}
while (entity != null){
for (Field field : entity.getDeclaredFields()) {
if (field.isAnnotationPresent(Id.class) || field.isAnnotationPresent(EmbeddedId.class)) {
Class<?> dataType = field.getType();
if (field.getType().isPrimitive()) {
dataType = this.primitiveToObject(field.getType());
}
return new Tuple<>(dataType.getName(), this.isCustomType(dataType));
}
}
for (Method method : entity.getDeclaredMethods()) {
if (!method.getReturnType().equals(Void.TYPE) && (method.isAnnotationPresent(Id.class) || method.isAnnotationPresent(EmbeddedId.class))) {
Class<?> dataType = method.getReturnType();
if (method.getReturnType().isPrimitive()) {
dataType = this.primitiveToObject(method.getReturnType());
}
return new Tuple<>(dataType.getName(), this.isCustomType(dataType));
}
}
entity = entity.getSuperclass();
}
error = SDLogger.addError("Repository Error: Primary key not found in " + GeneratorUtils.getSimpleClassName(entityClass) + ".java");
return null;
} catch (GeneratorException ex) {
error = SDLogger.addError(ex.getMessage());
return null;
} catch (Exception e) {
error = SDLogger.addError("Repository Error: Failed to access entity " + GeneratorUtils.getSimpleClassName(entityClass) + ".java");
return null;
}
}
public Tuple<String, Integer> build(){
return new Tuple<>(objectBuilder == null ? null : objectBuilder.build(), error);
}
private boolean isCustomType(Class<?> clazz) {
return !clazz.isAssignableFrom(Boolean.class) &&
!clazz.isAssignableFrom(Byte.class) &&
!clazz.isAssignableFrom(String.class) &&
!clazz.isAssignableFrom(Integer.class) &&
!clazz.isAssignableFrom(Long.class) &&
!clazz.isAssignableFrom(Float.class) &&
!clazz.isAssignableFrom(Double.class);
}
private Class<?> primitiveToObject(Class<?> clazz) {
Class<?> convertResult = mapConvert.get(clazz);
if (convertResult == null) {
throw new GeneratorException("Type parameter '" + clazz.getName() + "' is incorrect");
}
return convertResult;
}
}
| [
"lianghong@cnicg.cn"
] | lianghong@cnicg.cn |
b0c54255284bf5c01e1552b21cf0a43492a8173f | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Chart/5/org/jfree/chart/renderer/xy/XYItemRenderer_setBaseCreateEntities_1668.java | 3e5477950f701c863c8d3d5bd3479a0d7486818c | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 2,245 | java |
org jfree chart render
interfac render visual represent singl item
link plot xyplot
support clone chart recommend render implement
link cloneabl code public cloneabl publicclon code interfac
item render xyitemrender legend item sourc legenditemsourc
set flag control chart entiti
gener data item drawn render
param creat flag
set base creat entiti setbasecreateent creat
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
89e2efa08ece572be934d467c26bb4da064f8f61 | f458afadb908010b6f4ef6dc5ada97e9fd2ab156 | /app/src/main/java/com/example/jun/myocr/WecomeActivity.java | 691a296e0894c36430a5f9395f22e22cbc71bb71 | [] | no_license | android-xiao-jun/Android-ocr- | 65911283bfae8e1f9bc71f0c121c703d957cba3a | b905e9539490e3efaff14c2a607e533f64cf6f31 | refs/heads/master | 2020-03-22T12:37:57.680219 | 2018-07-09T12:10:02 | 2018-07-09T12:10:02 | 140,051,988 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 817 | java | package com.example.jun.myocr;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class WecomeActivity extends AppCompatActivity {
public Handler handler = new Handler() {
public void handleMessage(Message msg) {
if (msg.what == 0) {
Intent intent = new Intent(getBaseContext(), MainActivity.class);
startActivity(intent);
finish();
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wecome);
Message msg = Message.obtain();
handler.sendEmptyMessageDelayed(0, 2000);
}
}
| [
"15940363542@163.com"
] | 15940363542@163.com |
a94b4154830df50a42a13ac13273b2b2629436e9 | 899d1c6b3f0739a57e2246973a915d955b71f014 | /FoodOrderingSystem/src/main/java/com/pennant/admin/OrderslistWnd.java | 7d6aef50d80bd15178bfa091d6443d19f42597f6 | [] | no_license | vijaya1618/Goldtest | f856c48ea94b01085cff4189914945d5d4c13cde | 27c45fe70f7629106ddde95634c2baf56f981933 | refs/heads/master | 2022-12-21T14:30:13.592185 | 2020-01-09T08:20:43 | 2020-01-09T08:20:43 | 232,750,478 | 0 | 0 | null | 2022-12-16T09:43:39 | 2020-01-09T07:38:13 | Java | UTF-8 | Java | false | false | 2,991 | java | package com.pennant.admin;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zul.Div;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Longbox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;
public class OrderslistWnd extends Div{
private static final long serialVersionUID = 1L;
protected OrdersDAO OrdersDAO;
protected List orders,orders1;
public List getOrders() {
return orders;
}
public void setOrders(List orders) {
this.orders = orders;
}
protected void render() {
Listbox lb = (Listbox)this.getFellow("orders");
lb.getItems().clear();
for (Iterator it = orders.iterator(); it.hasNext(); ) {
Orders r = (Orders) it.next();
Listitem lt = new Listitem();
lt.setValue(r);
lt.appendChild(new Listcell(String.valueOf(r. getOrderID())));
lt.appendChild(new Listcell(String.valueOf(r.getCustomerID())));
lt.appendChild(new Listcell((r.getRname())));
lt.appendChild(new Listcell((r.getStatus())));
lb.appendChild(lt);
}
lb = (Listbox)this.getFellow("orders1");
lb.getItems().clear();
for (Iterator it = orders1.iterator(); it.hasNext(); ) {
Orders r = (Orders) it.next();
Listitem lt = new Listitem();
lt.setValue(r);
lt.appendChild(new Listcell(String.valueOf(r. getOrderID())));
lt.appendChild(new Listcell(String.valueOf(r.getCustomerID())));
lt.appendChild(new Listcell((r.getRname())));
lt.appendChild(new Listcell((r.getStatus())));
lb.appendChild(lt);
}
}
public void onCreate() throws Exception {
// spring bean, ItemDAO
ApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext(
(ServletContext)getDesktop().getWebApp().getNativeContext());
OrdersDAO = (OrdersDAO)ctx.getBean("orderDAO");
orders = OrdersDAO.findItem();
orders1 = OrdersDAO.findItem1();
render();
}
public void onUpdate() throws Exception {
Listbox lb = (Listbox)this.getFellow("orders");
Listitem lt = lb.getSelectedItem();
if (lt == null)
return;
Orders r = (Orders)lt.getValue();
Map<String, Orders> params = new HashMap<String, Orders>();
params.put("Orders", r);
Window win = (Window)Executions.createComponents("orders.zul", null, params);
win.doModal();
win.setTitle(".");
win.setClosable(true);
if (win.getAttribute("OK") != null) { //stupid
orders = OrdersDAO.findItem();
render();
}
}
}
| [
"vijayalakshmi.b@PENNANT-VSP119.pennant.local"
] | vijayalakshmi.b@PENNANT-VSP119.pennant.local |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.