blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9b2530f7a915086bee3091c7046795dcabb5207f | 45fa4f3b3d858a15d253de29a1fb4970c869f209 | /src/main/java/com/tutorialspoint/beans/test/HelloWorldConfig.java | a7f99f47e64d8e14b352f40c95da0b35ae5b92a9 | [] | no_license | tonyzhao35/SpringStudy | c4f93defec6e9c03285e2b52a4f27f1cc7a0cc3f | eaab362b8e0bc967b938852c14441061534033c6 | refs/heads/master | 2022-12-23T05:48:27.449917 | 2020-02-26T10:31:32 | 2020-02-26T10:31:32 | 242,262,925 | 0 | 0 | null | 2022-12-15T23:36:20 | 2020-02-22T01:52:33 | Java | UTF-8 | Java | false | false | 416 | java | package com.tutorialspoint.beans.test;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
@Configuration
public class HelloWorldConfig {
@Bean(initMethod = "init",destroyMethod = "destroy")
@Scope("singleton")
public HelloConfig helloConfig() {
return new HelloConfig();
}
}
| [
"[email protected]"
] | |
d6b4ca6a053bb1df7a119aa6cef8dc3df629ffae | 82f1b12653311606fdff4ff398554f8c323aaabc | /call/src/observer/TestObserver.java | 561f6845142bf43e2df653c17c40cf0935fe6748 | [] | no_license | Tomxieke/anddroid_studio | 4d29954e92a858941e9ee1ef8afb79e110ad60c8 | 83376d9ea696b7f48ab98bcc8f842c8562a58d48 | refs/heads/master | 2021-01-10T15:13:23.272604 | 2015-12-08T00:45:38 | 2015-12-08T00:45:38 | 47,258,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package observer;
/**
* 单元测试 。首先配置Manifest
* <instrumentation android:targetPackage="com.example.call" android:name="android.test.InstrumentationTestRunner"></instrumentation>
* <uses-library android:name="android.test.runner"/>
* 让后在测试类中继承AndroidTestCase类
*
*/
import android.test.AndroidTestCase;
public class TestObserver extends AndroidTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
}
public void testObserver(){
ObserverOne one = new ObserverOne(); //实列化一个观察者
ObserverTwo two = new ObserverTwo();//实列化第二个观察者
ObserveredOne edOne = new ObserveredOne(); // 实列化被观察者
edOne.addObserver(one); // 被观察者添加观察者
edOne.addObserver(two);
edOne.creatMessage("谢谢大家的关注"); // 被观察者创建消息
edOne.notifyMessage(); //被观察者发送消息
}
}
| [
"[email protected]"
] | |
bc41e589ef0842a5579193c39ecc51bdeda3ec69 | 38f77ed8ad8c4db6751d075426647419ba2231c3 | /app/src/androidTest/java/com/example/nibesh/toolbardemo/ExampleInstrumentedTest.java | f7bb21f4da9f81387f9729fe5c1de55e565576b6 | [] | no_license | NibeshBiswas/ToolBarDemo | 9785031f732f0d4bfcf71d2c7b402acab9f3846f | 2f572f7a369ce31080c4fa5c50d3e8664637d176 | refs/heads/master | 2021-09-01T05:51:03.795551 | 2017-12-25T06:34:56 | 2017-12-25T06:34:56 | 115,312,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.example.nibesh.toolbardemo;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.nibesh.toolbardemo", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
a3c8e3e6bd089fe213ab843afe26123e1bae742c | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdas/applicationModule/src/test/java/applicationModulepackageJava16/Foo771Test.java | 741d73b04af009e4ad5c30bcd1c9cba2d29b4933 | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package applicationModulepackageJava16;
import org.junit.Test;
public class Foo771Test {
@Test
public void testFoo0() {
new Foo771().foo0();
}
@Test
public void testFoo1() {
new Foo771().foo1();
}
@Test
public void testFoo2() {
new Foo771().foo2();
}
@Test
public void testFoo3() {
new Foo771().foo3();
}
@Test
public void testFoo4() {
new Foo771().foo4();
}
@Test
public void testFoo5() {
new Foo771().foo5();
}
}
| [
"[email protected]"
] | |
aa95166833297055af2c02ce9f6105e2f3f19d81 | 6130ecfb9a16caa3006369f56f4d63d6f44c4226 | /Daily/Week2/MultiThreading/app/src/androidTest/java/com/example/angel/multi_threading/ExampleInstrumentedTest.java | 42114f22996c3a587b028e91e693370be8edf15a | [] | no_license | CaballepMobile/AndroidTraining | dc5c451afee2deee0b27c690dffac7d1189d4a45 | 132b2b55db3afd247a434d79096a3f7a889262ae | refs/heads/master | 2020-03-22T00:00:28.068812 | 2018-07-06T18:16:51 | 2018-07-06T18:16:51 | 139,218,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package com.example.angel.multi_threading;
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.angel.multi_threading", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
8bced8469f0e3966f4819fe3cdaca89f8dd7493c | 6bff745c1f9249d1876408bf34fe90305cb09272 | /app/src/test/java/com/dossmann/broadcast02/ExampleUnitTest.java | 2db064476a1cdcd7dbd83c1dc11750279a7802b9 | [] | no_license | brunoss0d/Broadcast02 | d2ffb3b5c42eb09fc91680f757fa8bc9d9ed8c88 | 4f407ce9bdac0e2e7231261aec5018721f37c446 | refs/heads/master | 2021-01-07T10:15:24.933373 | 2020-02-19T16:05:55 | 2020-02-19T16:05:55 | 241,659,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.dossmann.broadcast02;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
24ea422a25f3351a0346598eae53cc5ba844b0d1 | dfc0ef8c3017ebfe80fe8ee657b4f593330d3ef6 | /Reversed/framework/com/samsung/android/graphics/spr/document/attribute/SprAttributeStrokeLinecap.java | ab9abc4ecf4387ff3e7708b838ae2d7d79b9125f | [] | no_license | khomsn/SCoverRE | fe079b6006281112ee37b66c5d156bb959e15420 | 2374565740e4c7bfc653b3f05bd9be519e722e32 | refs/heads/master | 2020-04-13T15:36:19.925426 | 2017-06-01T07:31:37 | 2017-06-01T07:31:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,104 | java | package com.samsung.android.graphics.spr.document.attribute;
import com.samsung.android.graphics.spr.document.SprInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class SprAttributeStrokeLinecap extends SprAttributeBase {
public static byte STROKE_LINECAP_TYPE_BUTT = (byte) 1;
public static byte STROKE_LINECAP_TYPE_NONE = (byte) 0;
public static byte STROKE_LINECAP_TYPE_ROUND = (byte) 2;
public static byte STROKE_LINECAP_TYPE_SQUARE = (byte) 3;
public byte linecap = STROKE_LINECAP_TYPE_BUTT;
public SprAttributeStrokeLinecap() {
super((byte) 37);
}
public SprAttributeStrokeLinecap(SprInputStream sprInputStream) throws IOException {
super((byte) 37);
fromSPR(sprInputStream);
}
public void fromSPR(SprInputStream sprInputStream) throws IOException {
this.linecap = sprInputStream.readByte();
}
public int getSPRSize() {
return 1;
}
public void toSPR(DataOutputStream dataOutputStream) throws IOException {
dataOutputStream.writeByte(this.linecap);
}
}
| [
"[email protected]"
] | |
98efde1051672baf3f88c001d5452c0c58e1f7bc | b593dd5da79ec38e105f8bfef442c9a25c08c930 | /src/test/java/com/everis/springconfigserver/SpringConfigServerApplicationTests.java | 9a35e2c3def355c6deea72a5d4e45dfdaa7b281c | [] | no_license | Joselon1999/spring-config-server-aplication | 1f15ac4a0ddf50b10df957a367bbd3b87d48125b | adc718b57feb7352588b43e7e82f7452f716b485 | refs/heads/master | 2021-03-28T18:15:37.107812 | 2020-03-17T05:06:26 | 2020-03-17T05:06:26 | 247,883,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 242 | java | package com.everis.springconfigserver;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringConfigServerApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
a71fc44d703dd92d4cd9333dfb51ebb59f264156 | ddfb3a710952bf5260dfecaaea7d515526f92ebb | /build/tmp/expandedArchives/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-sources.jar_c582e790131b6dd3325b282fce9d2d3d/net/minecraftforge/client/event/GuiOpenEvent.java | 691ba8b8ac943626aacd8f6442ca402f0add082f | [
"Apache-2.0"
] | permissive | TheDarkRob/Sgeorsge | 88e7e39571127ff3b14125620a6594beba509bd9 | 307a675cd3af5905504e34717e4f853b2943ba7b | refs/heads/master | 2022-11-25T06:26:50.730098 | 2020-08-03T15:42:23 | 2020-08-03T15:42:23 | 284,748,579 | 0 | 0 | Apache-2.0 | 2020-08-03T16:19:36 | 2020-08-03T16:19:35 | null | UTF-8 | Java | false | false | 1,503 | java | /*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.event;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraft.client.gui.screen.Screen;
/**
* This event is called before any Gui will open.
* If you don't want this to happen, cancel the event.
* If you want to override this Gui, simply set the gui variable to your own Gui.
*
* @author jk-5
*/
@net.minecraftforge.eventbus.api.Cancelable
public class GuiOpenEvent extends net.minecraftforge.eventbus.api.Event
{
private Screen gui;
public GuiOpenEvent(Screen gui)
{
this.setGui(gui);
}
public Screen getGui()
{
return gui;
}
public void setGui(Screen gui)
{
this.gui = gui;
}
} | [
"[email protected]"
] | |
c4879695f42baa7f109256ea5b5d0e45321c27f9 | a77bb839788c0dde71cc933619718ed9be22e535 | /week03/day03/DiceSet/src/DiceSet.java | c89466ef1f6595f28c843ed4251e2b9939951717 | [] | no_license | green-fox-academy/adihipo | f2b6fc91dbf991359982e1c9a5715a5598206ee4 | 004b21588ab241e40b920179174b32ce2c426895 | refs/heads/master | 2020-03-24T23:57:48.911847 | 2018-11-29T15:32:24 | 2018-11-29T15:32:24 | 143,162,892 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | import java.util.Arrays;
public class DiceSet {
int[] dices = new int[6];
public int[] roll() {
for (int i = 0; i < dices.length; i++) {
dices[i] = (int) (Math.random() * 6) + 1;
}
return dices;
}
public int length() {
return dices.length;
}
public int[] getCurrent() {
for (int i = 0; i < dices.length; i++) {
System.out.print(dices[i] + " ");
if (i == dices.length - 1) {
System.out.println("");
}
}
return dices;
}
public int getCurrent(int i) {
return dices[i];
}
public void reroll() {
for (int i = 0; i < dices.length; i++) {
dices[i] = (int) (Math.random() * 6) + 1;
}
}
public void reroll(int k) {
dices[k] = (int) (Math.random() * 6) + 1;
}
} | [
"[email protected]"
] | |
fa1636e0327faaf3aad0b5b4189695dfa5ee0a13 | a53940c1db9c0e97603a640cb2cd639b3c1cfd1b | /vertx-platform/src/test/mod-test/mod-proxy-maven-server/Server.java | 0252aaba101b85465ec2f248ab08f54ed8c979c9 | [
"Apache-2.0"
] | permissive | dallaybatta/vert.x | a9c612e1c9bcbeebbe98d011845651a8600de1e4 | 7aab7b3e7f081caab15291d250212f38fdb7d3cd | refs/heads/master | 2020-04-05T23:39:28.848257 | 2013-02-19T17:38:41 | 2013-02-19T17:38:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | import org.vertx.java.core.Handler;
import org.vertx.java.core.http.HttpServerRequest;
import org.vertx.java.platform.Verticle;
import org.vertx.java.testframework.TestUtils;
import java.lang.String;
import java.lang.System;
public class Server extends Verticle {
public void start() {
final TestUtils tu = new TestUtils(vertx);
vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() {
public void handle(HttpServerRequest req) {
// It's being proxied so should be absolute url
tu.azzert(req.uri.equals("http://localhost:9192/maven2/io/vertx/mod-maven-test/1.0.0/mod-maven-test-1.0.0.zip"));
if (req.path.indexOf("..") != -1) {
req.response.statusCode = 403;
req.response.end();
} else {
//Clearly in a real server you would check the path for better security!!
req.response.sendFile("." + req.path);
}
}
}).listen(9193, "127.0.0.1");
System.out.println("repo proxy server listening on 127.0.0.1:91923");
}
}
| [
"[email protected]"
] | |
fa3e1a92779683897fe8b9c38509ec1ac5de5d68 | 5ffa77b01d6bde3732257449bb9e89b45325ff74 | /forex/src/main/java/com/cg/forex/exceptions/CurrencyDoesNotExistsException.java | ab974e43d83eb4b48fc88691c9897a9e43abc695 | [] | no_license | vijaychary8/ForexService | dfbe1f5e18211ac757457cc8d8dd48b8ce224d2c | c7e2d4c897c7c988c245d7f210ab984a5c72339e | refs/heads/main | 2023-04-03T07:44:16.942792 | 2021-04-12T15:58:50 | 2021-04-12T15:58:50 | 357,254,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.cg.forex.exceptions;
@SuppressWarnings("serial")
public class CurrencyDoesNotExistsException extends RuntimeException {
public CurrencyDoesNotExistsException(String errorMsg){
super(errorMsg);
}
}
| [
"[email protected]"
] | |
ed99bdd5a6112acf62f1a81ae5f27f8c7befc534 | d55c34d6e320bc6614ff4a4f8719d8e92ead7d77 | /SpringBoot-LostCity/LostCityAPI/src/main/java/com/happy/game/lostcity/common/SearchBean.java | 16d53e6ec4c10556a3aa6329fe31e39be5794e46 | [] | no_license | NowHappy/LostCityAPI | 411a80ed22e06d81619ea2ffa9ddaf5b74da717d | ef3be6f31305c585bae93be5dc22ec5307913332 | refs/heads/master | 2020-03-22T07:23:05.289233 | 2018-07-04T09:05:00 | 2018-07-04T09:05:00 | 139,696,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.happy.game.lostcity.common;
import lombok.Data;
@Data
public class SearchBean {
private String key;
private String operation;
private Object value;
public SearchBean(String key, String operation, Object value) {
this.key = key;
this.operation = operation;
this.value = value;
}
}
| [
"[email protected]"
] | |
ce5c363afcec0608ece812ecec0f4540f2078b58 | f119e4d785e227be42721f87fec9e0f3bcd77c63 | /src/dk/itu/mario/engine/Level.java | f1697b5e7ab038d26f78c0ff9efaf9023cbf87d9 | [] | no_license | andyfang101/Mario-Level-Generator | 79f5a9b8b561e8066726f6536f8f4e294dbf9bee | 3d59d50cd984b4ece868a83434ff80c498708194 | refs/heads/master | 2021-01-15T20:09:30.452471 | 2017-08-09T19:36:53 | 2017-08-09T19:36:53 | 99,846,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,135 | java | package dk.itu.mario.engine;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Arrays;
public class Level implements LevelInterface
{
protected static final byte BLOCK_EMPTY = (byte) (0 + 1 * 16);
protected static final byte BLOCK_POWERUP = (byte) (4 + 2 + 1 * 16);
protected static final byte BLOCK_COIN = (byte) (4 + 1 + 1 * 16);
protected static final byte GROUND = (byte) (1 + 9 * 16);
protected static final byte ROCK = (byte) (9 + 0 * 16);
protected static final byte WOOD = (byte) (12 + 0 * 16);
protected static final byte STEEL = (byte) (12 + 1 * 16);
protected static final byte LOG1 = (byte) (9 + 1 * 16);
protected static final byte LOG2 = (byte) (9 + 2 * 16);
protected static final byte LOG3 = (byte) (9 + 3 * 16);
protected static final byte COIN = (byte) (2 + 2 * 16);
protected static final byte TINYPIPE1 = (byte) (8 + 1 * 16);
protected static final byte TINYPIPE2 = (byte) (8 + 2 * 16);
protected static final byte TINYPIPE3 = (byte) (8 + 3 * 16);
protected static final byte LEFT_GRASS_EDGE = (byte) (0+9*16);
protected static final byte RIGHT_GRASS_EDGE = (byte) (2+9*16);
protected static final byte RIGHT_UP_GRASS_EDGE = (byte) (2+8*16);
protected static final byte LEFT_UP_GRASS_EDGE = (byte) (0+8*16);
protected static final byte LEFT_POCKET_GRASS = (byte) (3+9*16);
protected static final byte RIGHT_POCKET_GRASS = (byte) (3+8*16);
protected static final byte HILL_FILL = (byte) (5 + 9 * 16);
protected static final byte HILL_LEFT = (byte) (4 + 9 * 16);
protected static final byte HILL_RIGHT = (byte) (6 + 9 * 16);
protected static final byte HILL_TOP = (byte) (5 + 8 * 16);
protected static final byte HILL_TOP_LEFT = (byte) (4 + 8 * 16);
protected static final byte HILL_TOP_RIGHT = (byte) (6 + 8 * 16);
protected static final byte HILL_TOP_LEFT_IN = (byte) (4 + 11 * 16);
protected static final byte HILL_TOP_RIGHT_IN = (byte) (6 + 11 * 16);
protected static final byte TUBE_TOP_LEFT = (byte) (10 + 0 * 16);
protected static final byte TUBE_TOP_RIGHT = (byte) (11 + 0 * 16);
protected static final byte TUBE_SIDE_LEFT = (byte) (10 + 1 * 16);
protected static final byte TUBE_SIDE_RIGHT = (byte) (11 + 1 * 16);
//The level's width and height
protected int width;
protected int height;
//This map of WIDTH * HEIGHT that contains the level's design
private byte[][] map;
//This is a map of WIDTH * HEIGHT that contains the placement and type enemies
private SpriteTemplate[][] spriteTemplates;
//These are the place of the end of the level
protected int xExit;
protected int yExit;
//public ArrayList<Point>listaInicioFimTelas = new ArrayList<Point>();
public byte[][] data; //Estava sendo utilizada na outra arquitetura
public byte[][] observation; //Estava sendo utilizada na outra arquitetura
private static final int FILE_HEADER = 0x271c4178;
public static final String[] BIT_DESCRIPTIONS = {//
"BLOCK UPPER", //
"BLOCK ALL", //
"BLOCK LOWER", //
"SPECIAL", //
"BUMPABLE", //
"BREAKABLE", //
"PICKUPABLE", //
"ANIMATED",//
};
public Level(){
}
public Level(int width, int height)
{
this.width = width;
this.height = height;
xExit = 10;
yExit = 10;
map = new byte[width][height];
spriteTemplates = new SpriteTemplate[width][height];
}
/**
*Clone the level data so that we can load it when Mario dies
*/
public Level clone() throws CloneNotSupportedException {
Level clone=new Level(width, height);
clone.map = new byte[width][height];
clone.spriteTemplates = new SpriteTemplate[width][height];
clone.xExit = xExit;
clone.yExit = yExit;
for (int i = 0; i < map.length; i++)
for (int j = 0; j < map[i].length; j++) {
clone.map[i][j]= map[i][j];
if ( spriteTemplates[i][j]!=null){
clone.spriteTemplates[i][j] = (SpriteTemplate) spriteTemplates[i][j].clone();
}
else{
clone.spriteTemplates[i][j] =spriteTemplates[i][j];
}
}
return clone;
}
public void tick(){}
public byte getBlockCapped(int x, int y)
{
if (x < 0) x = 0;
if (y < 0) y = 0;
if (x >= width) x = width - 1;
if (y >= height) y = height - 1;
return map[x][y];
}
public byte getBlock(int x, int y)
{
if (x < 0) x = 0;
if (y < 0) return 0;
if (x >= width) x = width - 1;
if (y >= height) y = height - 1;
return map[x][y];
}
public void setBlock(int x, int y, byte b)
{
if (x < 0) return;
if (y < 0) return;
if (x >= width) return;
if (y >= height) return;
map[x][y] = b;
}
public boolean isBlocking(int x, int y, float xa, float ya)
{
byte block = getBlock(x, y);
boolean blocking = ((TILE_BEHAVIORS[block & 0xff]) & BIT_BLOCK_ALL) > 0;
blocking |= (ya > 0) && ((TILE_BEHAVIORS[block & 0xff]) & BIT_BLOCK_UPPER) > 0;
blocking |= (ya < 0) && ((TILE_BEHAVIORS[block & 0xff]) & BIT_BLOCK_LOWER) > 0;
return blocking;
}
public SpriteTemplate getSpriteTemplate(int x, int y)
{
if (x < 0) return null;
if (y < 0) return null;
if (x >= width) return null;
if (y >= height) return null;
return spriteTemplates[x][y];
}
public void setSpriteTemplate(int x, int y, SpriteTemplate spriteTemplate)
{
if (x < 0) return;
if (y < 0) return;
if (x >= width) return;
if (y >= height) return;
spriteTemplates[x][y] = spriteTemplate;
}
public void SetSpritesNotSpawned(){
for(int x = 0; x<width; x++){
for(int y=0; y<height; y++){
if(spriteTemplates[x][y]!=null){
spriteTemplates[x][y].hasSpawned = false;
}
}
}
}
public SpriteTemplate[][] getSpriteTemplate(){
return this.spriteTemplates;
}
public void resetSpriteTemplate(){
for (int i = 0; i < spriteTemplates.length; i++) {
for (int j = 0; j < spriteTemplates[i].length; j++) {
SpriteTemplate st = spriteTemplates[i][j];
if(st != null)
st.isDead = false;
}
}
}
public void print(byte[][] array){
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.print(array[i][j]);
}
System.out.println();
}
}
public void printMap(){
print(map);
}
public static Level load(DataInputStream dis) throws IOException
{
long header = dis.readLong();
if (header != Level.FILE_HEADER) throw new IOException("Bad level header");
@SuppressWarnings("unused")
int version = dis.read() & 0xff;
int width = dis.readShort() & 0xffff;
int height = dis.readShort() & 0xffff;
// System.out.println("width = " + width);
// System.out.println("height = " + height);
Level level = new Level(width, height);
level.xExit = dis.readInt();
level.yExit = dis.readInt();
level.map = new byte[width][height];
level.data = new byte[width][height];
for (int i = 0; i < width; i++)
{
dis.readFully(level.map[i]);
dis.readFully(level.data[i]);
}
// for (int i = 0; i < width; i++)
// {
// System.out.print("map " + i + " : ");
// for (int j = 0; j < height; j++)
// {
// System.out.print(level.map[i][j] + " ");
// }
// System.out.println();
// System.out.print("data " + i + " : ");
// for (int j = 0; j < height; j++)
// {
// System.out.print(level.data[i][j] + " ");
// }
// System.out.println();
// }
int tam = dis.readInt();
for (int i = 0; i < tam; i++)
{
int x = dis.readInt();
int y = dis.readInt();
int type = dis.readInt();
int winged = dis.readInt();
level.getSpriteTemplate()[x][y] = new SpriteTemplate(type, winged == 1 ? true : false);
//System.out.println("tam: " + x + ", " + y + ", " + type + ", " + winged);
}
return level;
}
public byte[][] getMap() {
return map;
}
public SpriteTemplate[][] getSpriteTemplates() {
return spriteTemplates;
}
public int getxExit() {
return xExit;
}
public int getyExit() {
return yExit;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public String getName() {
return "";
}
public int GetNumEnemies(){
int numEnemies = 0;
for (int i = 0; i < spriteTemplates.length; i++) {
for (int j = 0; j < spriteTemplates[i].length; j++) {
SpriteTemplate st = spriteTemplates[i][j];
if(st != null &&st.type>=0 && st.type<7){
numEnemies +=1;
}
}
}
return numEnemies;
}
public int GetNumGaps(){
int numGaps = 0;
for(int x = 0; x<getxExit(); x++){
if(getBlock(x,getHeight()-1)==0 && getBlock(x-1,getHeight()-1)!=0){
numGaps+=1;
}
}
return numGaps;
}
public double GetAverageGapLength(){
double avgGap = 0.0;
int numGaps = GetNumGaps();
int prevGapX = -1;
for(int x = 0; x<getxExit(); x++){
if(getBlock(x,getHeight()-1)==0 && getBlock(x-1,getHeight()-1)!=0){
prevGapX = x;
}
else if(getBlock(x,getHeight()-1)!=0 && getBlock(x-1,getHeight()-1)==0){
avgGap+=(x-prevGapX);
}
}
if(numGaps>0){
avgGap = avgGap/((double)numGaps);
}
return avgGap;
}
public int GetPowerups(){
int powerups =0;
for(int x = 0; x<getxExit(); x++){
for(int y = 0; y<getHeight(); y++){
if(getBlock(x,y)==BLOCK_POWERUP){
powerups+=1;
}
}
}
return powerups;
}
public int GetBlocks(){
int blocks =0;
for(int x = 0; x<getxExit(); x++){
for(int y = 0; y<getHeight(); y++){
if(getBlock(x,y)==BLOCK_EMPTY){
blocks+=1;
}
}
}
return blocks;
}
public int GetCoins(){
int coins =0;
for(int x = 0; x<getxExit(); x++){
for(int y = 0; y<getHeight(); y++){
if(getBlock(x,y)==BLOCK_COIN || getBlock(x,y)==COIN){
coins+=1;
}
}
}
return coins;
}
public int GetCannons(){
int cannons =0;
for(int x = 0; x<getxExit(); x++){
for(int y = 0; y<getHeight(); y++){
if(getBlock(x,y)==(14 + 0 * 16)){
cannons+=1;
}
}
}
return cannons;
}
public static boolean isSolid(byte b){
Integer[] solidBlocks = new Integer[29];
solidBlocks[0] = new Integer(BLOCK_EMPTY);
solidBlocks[1] = new Integer(BLOCK_POWERUP);
solidBlocks[2] = new Integer(BLOCK_COIN);
solidBlocks[3] = new Integer(GROUND);
solidBlocks[4] = new Integer(ROCK);
solidBlocks[21] = new Integer(WOOD);
solidBlocks[22] = new Integer(STEEL);
solidBlocks[23] = new Integer(LOG1);
solidBlocks[24] = new Integer(LOG2);
solidBlocks[25] = new Integer(LOG3);
solidBlocks[26] = new Integer(TINYPIPE1);
solidBlocks[27] = new Integer(TINYPIPE2);
solidBlocks[28] = new Integer(TINYPIPE3);
solidBlocks[5] = new Integer(HILL_TOP);
solidBlocks[6] = new Integer(HILL_TOP_LEFT);
solidBlocks[7] = new Integer(HILL_TOP_RIGHT);
solidBlocks[8] = new Integer(HILL_TOP_LEFT_IN);
solidBlocks[9] = new Integer(HILL_TOP_RIGHT_IN);
solidBlocks[10] = new Integer(TUBE_TOP_LEFT);
solidBlocks[11] = new Integer(TUBE_TOP_RIGHT);
solidBlocks[12] = new Integer(TUBE_SIDE_LEFT);
solidBlocks[13] = new Integer(TUBE_SIDE_RIGHT);
//solidBlocks[14] = -127;
solidBlocks[14] = new Integer(LEFT_GRASS_EDGE);
solidBlocks[15] = new Integer(RIGHT_GRASS_EDGE);
solidBlocks[16] = new Integer(LEFT_UP_GRASS_EDGE);
solidBlocks[17] = new Integer(RIGHT_UP_GRASS_EDGE);
solidBlocks[18] = new Integer(LEFT_POCKET_GRASS);
solidBlocks[19] = new Integer(RIGHT_POCKET_GRASS);
solidBlocks[20] = new Integer(-127);
Integer bInt = new Integer((int)b);
return Arrays.asList(solidBlocks).contains(bInt);//IntStream.of(solidBlocks).anyMatch(x -> x == (int)b);
}
public static boolean isPipeBottom(byte b){
return TUBE_SIDE_LEFT==(int)b || TUBE_SIDE_RIGHT==(int)b;
}
public static boolean isPipeTop(byte b){
return TUBE_TOP_LEFT==(int)b || TUBE_TOP_RIGHT==(int)b;
}
public static boolean isCoin(byte b){
return COIN==(int)b;
}
public static boolean isPowerup(byte b){
return BLOCK_POWERUP==(int) b;
}
public static boolean isBreakable(byte b){
return BLOCK_EMPTY==(int) b || BLOCK_COIN==(int) b;
}
public static boolean isCannon(byte b){
int bInt = (int) b;
return (14 + 0 * 16)==bInt || (14 + 1 * 16)==bInt || (14 + 2 * 16)==bInt;
}
}
| [
"[email protected]"
] | |
eb4d446d649dd86cfed5c1acbd9a95af81f8c9c5 | 388bfdafa342af71f41ef1f9e671ac45321da800 | /app/src/main/java/com/contoh/rachgunawan/RecyclerViewAdapter.java | 4c4b8de81f0d4b7a182850d8ca22b4691e31f6ee | [] | no_license | nawan44/Dicoding-Android-Pemula | e8d9b2abce4690633e57ba6c1691492525fe6e9f | 17c5a5465b1ea6bf86b40d17dd3d0cf3c37d99b5 | refs/heads/master | 2021-07-06T06:40:52.328769 | 2020-08-22T04:03:54 | 2020-08-22T04:03:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,136 | java | package com.contoh.rachgunawan;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.util.ArrayList;
//Class Adapter ini Digunakan Untuk Mengatur Bagaimana Data akan Ditampilkan
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder>{
private ArrayList<String> arrayList; //Digunakan untuk Judul
private ArrayList<Integer> produkList; //Digunakan untuk Image/Gambar
RecyclerViewAdapter(ArrayList<String> arrayList, ArrayList<Integer> produkList){
this.arrayList = arrayList;
this.produkList = produkList;
}
//ViewHolder Digunakan Untuk Menyimpan Referensi Dari View-View
class ViewHolder extends RecyclerView.ViewHolder{
private TextView JudulProduk, SubProduk;
private ImageView Produk;
private RelativeLayout ItemList;
private Context context;
ViewHolder(View itemView) {
super(itemView);
//Untuk Menghubungkan dan Mendapakan Context dari MainActivity
context = itemView.getContext();
//Menginisialisasi View-View untuk kita gunakan pada RecyclerView
JudulProduk = (TextView) itemView.findViewById(R.id.produktitle);
SubProduk = (TextView) itemView.findViewById(R.id.sub_produk);
Produk = (ImageView) itemView.findViewById(R.id.produk);
ItemList = (RelativeLayout) itemView.findViewById(R.id.item_list);
ItemList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
switch (getAdapterPosition()){
case 0 :
intent = new Intent(context, Produk0Activity.class);
break;
case 1 :
intent = new Intent(context, Produk1Activity.class);
break;
case 2 :
intent = new Intent(context, Produk2Activity.class);
break;
case 3 :
intent = new Intent(context, Produk3Activity.class);
break;
case 4 :
intent = new Intent(context, Produk4Activity.class);
break;
case 5 :
intent = new Intent(context, Produk5Activity.class);
break;
case 6 :
intent = new Intent(context, Produk6Activity.class);
break;
}
context.startActivity(intent);
}
});
}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//Membuat View untuk Menyiapkan dan Memasang Layout yang Akan digunakan pada RecyclerView
View V = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_design, parent, false);
ViewHolder VH = new ViewHolder(V);
return VH;
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
//Memasukan Nilai/Value Pada View-View Yang Telah Dibuat
final String Nama = arrayList.get(position);//Mengambil data sesuai dengan posisi yang telah ditentukan
holder.JudulProduk.setText(Nama);
holder.SubProduk.setText("Gambar Produk Ke: "+position);
holder.Produk.setImageResource(produkList.get(position)); // Mengambil gambar sesuai posisi yang telah ditentukan
}
@Override
public int getItemCount() {
//Menghitung Ukuran/Jumlah Data Yang Akan Ditampilkan Pada RecyclerView
return arrayList.size();
}
} | [
"[email protected]"
] | |
c6b31de64ab009f762f379a99cca628f14f3247b | 0e7e0cc485f3d18f08da511c191cba7f939c9a97 | /AndesComponenteFirmador/src/javax/mail/Service.java | c1df017fbbaa24f34e4733d195f3023c0c5528c2 | [] | no_license | arnaldo100493/AndesComponenteFirmador | 6e34a5633a82241e80832d7b9d915cd87be23dde | 75edb0d813b31719f64a246448dce3e6f997fbdb | refs/heads/master | 2020-12-06T08:08:55.565972 | 2020-02-05T06:46:52 | 2020-02-05T06:46:52 | 232,402,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,070 | 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 javax.mail;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Vector;
import javax.mail.event.ConnectionEvent;
import javax.mail.event.ConnectionListener;
import javax.mail.event.MailEvent;
/**
*
* @author abarrime
*/
public abstract class Service {
protected Session session;
protected URLName url = null;
protected boolean debug = false;
private boolean connected = false;
private final Vector connectionListeners = new Vector();
private EventQueue q;
private Object qLock;
public void connect() throws MessagingException {
connect(null, null, null);
}
public void connect(String host, String user, String password) throws MessagingException {
connect(host, -1, user, password);
}
public void connect(String user, String password) throws MessagingException {
connect(null, user, password);
}
public synchronized void connect(String host, int port, String user, String password) throws MessagingException {
if (isConnected()) {
throw new IllegalStateException("already connected");
}
boolean connected = false;
boolean save = false;
String protocol = null;
String file = null;
if (this.url != null) {
protocol = this.url.getProtocol();
if (host == null) {
host = this.url.getHost();
}
if (port == -1) {
port = this.url.getPort();
}
if (user == null) {
user = this.url.getUsername();
if (password == null) {
password = this.url.getPassword();
}
} else if (password == null && user.equals(this.url.getUsername())) {
password = this.url.getPassword();
}
file = this.url.getFile();
}
if (protocol != null) {
if (host == null) {
host = this.session.getProperty("mail." + protocol + ".host");
}
if (user == null) {
user = this.session.getProperty("mail." + protocol + ".user");
}
}
if (host == null) {
host = this.session.getProperty("mail.host");
}
if (user == null) {
user = this.session.getProperty("mail.user");
}
if (user == null) {
try {
user = System.getProperty("user.name");
} catch (SecurityException sex) {
}
}
if (password == null && this.url != null) {
setURLName(new URLName(protocol, host, port, file, user, null));
PasswordAuthentication pw = this.session.getPasswordAuthentication(getURLName());
if (pw != null) {
if (user == null) {
user = pw.getUserName();
password = pw.getPassword();
} else if (user.equals(pw.getUserName())) {
password = pw.getPassword();
}
} else {
save = true;
}
}
AuthenticationFailedException authEx = null;
try {
connected = protocolConnect(host, port, user, password);
} catch (AuthenticationFailedException ex) {
authEx = ex;
}
if (!connected) {
InetAddress inetAddress;
try {
inetAddress = InetAddress.getByName(host);
} catch (UnknownHostException e) {
inetAddress = null;
}
PasswordAuthentication pw = this.session.requestPasswordAuthentication(inetAddress, port, protocol, null, user);
if (pw != null) {
user = pw.getUserName();
password = pw.getPassword();
connected = protocolConnect(host, port, user, password);
}
}
if (!connected) {
if (authEx != null) {
throw authEx;
}
if (user == null) {
throw new AuthenticationFailedException("failed to connect, no user name specified?");
}
if (password == null) {
throw new AuthenticationFailedException("failed to connect, no password specified?");
}
throw new AuthenticationFailedException("failed to connect");
}
setURLName(new URLName(protocol, host, port, file, user, password));
if (save) {
this.session.setPasswordAuthentication(getURLName(), new PasswordAuthentication(user, password));
}
setConnected(true);
notifyConnectionListeners(1);
}
protected boolean protocolConnect(String host, int port, String user, String password) throws MessagingException {
return false;
}
public synchronized boolean isConnected() {
return this.connected;
}
protected synchronized void setConnected(boolean connected) {
this.connected = connected;
}
public synchronized void close() throws MessagingException {
setConnected(false);
notifyConnectionListeners(3);
}
public synchronized URLName getURLName() {
if (this.url != null && (this.url.getPassword() != null || this.url.getFile() != null)) {
return new URLName(this.url.getProtocol(), this.url.getHost(), this.url.getPort(), null, this.url.getUsername(), null);
}
return this.url;
}
protected synchronized void setURLName(URLName url) {
this.url = url;
}
public void addConnectionListener(ConnectionListener l) {
this.connectionListeners.addElement(l);
}
public void removeConnectionListener(ConnectionListener l) {
this.connectionListeners.removeElement(l);
}
protected void notifyConnectionListeners(int type) {
if (this.connectionListeners.size() > 0) {
ConnectionEvent e = new ConnectionEvent(this, type);
queueEvent((MailEvent) e, this.connectionListeners);
}
if (type == 3) {
terminateQueue();
}
}
public String toString() {
URLName url = getURLName();
if (url != null) {
return url.toString();
}
return super.toString();
}
protected Service(){
}
protected Service(Session session, URLName urlname) {
this.qLock = new Object();
this.session = session;
this.debug = session.getDebug();
this.url = urlname;
String protocol = null;
String host = null;
int port = -1;
String user = null;
String password = null;
String file = null;
if (this.url != null) {
protocol = this.url.getProtocol();
host = this.url.getHost();
port = this.url.getPort();
user = this.url.getUsername();
password = this.url.getPassword();
file = this.url.getFile();
}
if (protocol != null) {
if (host == null) {
host = session.getProperty("mail." + protocol + ".host");
}
if (user == null) {
user = session.getProperty("mail." + protocol + ".user");
}
}
if (host == null) {
host = session.getProperty("mail.host");
}
if (user == null) {
user = session.getProperty("mail.user");
}
if (user == null) {
try {
user = System.getProperty("user.name");
} catch (SecurityException sex) {
}
}
this.url = new URLName(protocol, host, port, file, user, password);
}
protected void queueEvent(MailEvent event, Vector vector) {
synchronized (this.qLock) {
if (this.q == null) {
this.q = new EventQueue();
}
}
Vector v = (Vector) vector.clone();
this.q.enqueue(event, v);
}
static class TerminatorEvent
extends MailEvent {
private static final long serialVersionUID = 5542172141759168416L;
TerminatorEvent() {
super(new Object());
}
public void dispatch(Object listener) {
Thread.currentThread().interrupt();
}
}
private void terminateQueue() {
synchronized (this.qLock) {
if (this.q != null) {
Vector dummyListeners = new Vector();
dummyListeners.setSize(1);
this.q.enqueue(new TerminatorEvent(), dummyListeners);
this.q = null;
}
}
}
@Override
protected void finalize() throws Throwable {
super.finalize();
terminateQueue();
}
}
| [
"[email protected]"
] | |
e1f4f575c24479350e1209907166dc244f6f8c19 | 01976e79c5879a0d611414eb221105f46e4955fd | /app/src/main/java/cn/rongcloud/rtc/util/PromptDialog.java | a990a09866acb2a48d66efcb2180b7242fea586d | [
"MIT"
] | permissive | fancyhugo/sealrtc-android | 876a604dd1b8df72d5b77902a47d6e84c3df8a6d | d84033d6b99806301aeeb77021e0b0a3219742b7 | refs/heads/master | 2020-05-07T17:22:15.048854 | 2020-03-09T12:02:45 | 2020-03-09T12:02:45 | 180,725,545 | 0 | 0 | null | 2019-04-11T06:07:08 | 2019-04-11T06:07:07 | null | UTF-8 | Java | false | false | 5,582 | java | package cn.rongcloud.rtc.util;
import android.app.AlertDialog;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.TextView;
import cn.rongcloud.rtc.R;
public class PromptDialog extends AlertDialog {
private Context mContext;
private OnPromptButtonClickedListener mPromptButtonClickedListener;
private String mTitle;
private String mPositiveButton;
private String mNegativeButton;
private String mMessage;
private int mLayoutResId;
private boolean disableCancel;
private int positiveTxtColor = 0;
private int negativeTxtColor = 0;
public static PromptDialog newInstance(final Context context, String title, String message) {
return new PromptDialog(context, title, message);
}
public static PromptDialog newInstance(final Context context, String message) {
return new PromptDialog(context, message);
}
public static PromptDialog newInstance(final Context context, String title, String message, String positiveButton) {
return new PromptDialog(context, title, message, positiveButton);
}
public static PromptDialog newInstance(final Context context, String title, String message, String positiveButton, String negativeButton) {
return new PromptDialog(context, title, message, positiveButton, negativeButton);
}
public PromptDialog(final Context context, String title, String message, String positiveButton, String negativeButton) {
this(context, title, message, positiveButton);
this.mNegativeButton = negativeButton;
}
public PromptDialog(final Context context, String title, String message, String positiveButton) {
this(context, title, message);
mPositiveButton = positiveButton;
}
public PromptDialog(final Context context, String title, String message) {
super(context);
mLayoutResId = R.layout.dialog_popup_prompt;
mContext = context;
mTitle = title;
mMessage = message;
}
public PromptDialog(final Context context, String message) {
this(context, "", message);
}
@Override
protected void onStart() {
super.onStart();
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View view = inflater.inflate(mLayoutResId, null);
TextView txtViewTitle = (TextView) view.findViewById(R.id.popup_dialog_title);
TextView txtViewMessage = (TextView) view.findViewById(R.id.popup_dialog_message);
TextView txtViewOK = (TextView) view.findViewById(R.id.popup_dialog_button_ok);
TextView txtViewCancel = (TextView) view.findViewById(R.id.popup_dialog_button_cancel);
if (disableCancel) txtViewCancel.setVisibility(View.GONE);
if (positiveTxtColor != 0) {
txtViewOK.setTextColor(positiveTxtColor);
}
if (negativeTxtColor != 0) {
txtViewCancel.setTextColor(negativeTxtColor);
}
txtViewOK.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mPromptButtonClickedListener != null) {
mPromptButtonClickedListener.onPositiveButtonClicked();
}
dismiss();
}
});
txtViewCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mPromptButtonClickedListener != null) {
mPromptButtonClickedListener.onNegativeButtonClicked();
}
dismiss();
}
});
if (!TextUtils.isEmpty(mTitle)) {
txtViewTitle.setText(mTitle);
txtViewTitle.setVisibility(View.VISIBLE);
}
if (!TextUtils.isEmpty(mPositiveButton)) {
txtViewOK.setText(mPositiveButton);
}
if (!TextUtils.isEmpty(mNegativeButton)) {
txtViewCancel.setText(mNegativeButton);
}
txtViewMessage.setText(mMessage);
setContentView(view);
WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.width = gePopupWidth();
layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
getWindow().setAttributes(layoutParams);
}
public void disableCancel() {
disableCancel = true;
}
public PromptDialog setPromptButtonClickedListener(OnPromptButtonClickedListener buttonClickedListener) {
this.mPromptButtonClickedListener = buttonClickedListener;
return this;
}
public PromptDialog setLayoutRes(int resId) {
this.mLayoutResId = resId;
return this;
}
public void setPositiveTextColor(int color) {
positiveTxtColor = color;
}
public void setNegativeTextColor(int color) {
negativeTxtColor = color;
}
public interface OnPromptButtonClickedListener {
void onPositiveButtonClicked();
void onNegativeButtonClicked();
}
private int gePopupWidth() {
int distanceToBorder = (int) mContext.getResources().getDimension(R.dimen.rtc_dimen_size_40);
return getScreenWidth() - 2 * (distanceToBorder);
}
private int getScreenWidth() {
return ((WindowManager) (mContext.getSystemService(Context.WINDOW_SERVICE))).getDefaultDisplay().getWidth();
}
}
| [
"[email protected]"
] | |
8d2df18b4b2f5da0fbc2681daceb401497506e4d | 2dd129ab6e56e7da850795b1952f9d276c5b613f | /app/src/main/java/com/example/himalaya/fragments/SubscriptionFragment.java | 2bbbd2c0062dbff28ae69602afd9ddcad2eb27ca | [] | no_license | FEJonesYang/Himalaya | e32fd7fba37d4ab0d587d3eaba480e2aec84127e | 0baf4208e121db6a1f48960ef65cce7b87ddd6d8 | refs/heads/main | 2023-01-14T04:16:52.086912 | 2020-11-20T04:12:12 | 2020-11-20T04:12:12 | 303,267,319 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | package com.example.himalaya.fragments;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.himalaya.R;
import com.example.himalaya.base.BaseFragment;
/**
* @author JonesYang
* @Data 2020-10-17
* @Function
*/
public class SubscriptionFragment extends BaseFragment {
@Override
protected View onSubViewLoaded(LayoutInflater layoutInflater, ViewGroup container) {
View view = layoutInflater.inflate(R.layout.fragment_subscription,container,false);
return view;
}
}
| [
"[email protected]"
] | |
de898e0cc553bd9de4b3f1121cd122dbe1244341 | cc15daf3f8cf962f06aaec2ceac18d56728fb5eb | /src/main/java/typeinfo/SomeMethods.java | 3df0b228c3a70e768b5a365ce45d8ec019377351 | [] | no_license | xiyan130227/ThinkInJava | 12582f512f22671d705631530daf83ba8e0650f4 | dc6b6b3bc9c7c3c8252ca006d6b15a7cd9aa1014 | refs/heads/master | 2021-09-14T18:37:01.438347 | 2018-05-17T09:57:30 | 2018-05-17T09:57:30 | 114,587,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20 | java | package typeinfo;
| [
"[email protected]"
] | |
dccb5d738212af0b8e59c8be47f2986b0315ab0f | ee5f1b8175c96ec6148eca059da2d7e524b90763 | /java/src/main/java/com/wkodate/atcoder/abc005/a/Main.java | 298dcc98d045508bf7d53a3882055ccdcee28362 | [] | no_license | wkodate/atcoder | 15e6e3aedcfa8ae0faf9534be87707cdb407faa5 | c10c421858b4169735ca4c50f6b7bc43ac0464b3 | refs/heads/master | 2022-04-26T20:53:54.737536 | 2022-04-04T13:17:21 | 2022-04-04T13:17:32 | 241,840,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package com.wkodate.atcoder.abc005.a;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
System.out.println(y / x);
}
}
| [
"[email protected]"
] | |
fbfdff907cadd1b76dadcb82537db919362eebfa | c7b6ebf8b062ced913962c83ab55b06aaba74361 | /src/main/java/cn/com/crazyit/foundation/pojo/SpPriTemplate.java | 2f90200fb1e849e6d69dccf68cbb4b6afb5aa443 | [] | no_license | CrazyApes/jumao | 72fff7e44773b44bdd933f9ca08f5582fb640fbb | 605baaea848848462ecc88db342814dc4615076b | refs/heads/master | 2021-01-20T08:27:28.954463 | 2017-08-24T14:49:55 | 2017-08-24T14:49:55 | 90,148,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | package cn.com.crazyit.foundation.pojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.*;
import java.awt.print.Book;
import java.util.HashSet;
import java.util.Set;
/**
* @author Zack
* Created on 2017/6/12.
*/
@Getter
@Setter
@ToString(callSuper = true)
@Entity
@Table(name = "SP_PRI_TEMPLATE")
public class SpPriTemplate extends AppPojo{
/**
* 价格模版名称
*/
@Column(length = 20, nullable = false, unique = true)
private String title;
/**
* 价格模版内产品集合
*/
@OneToMany(cascade= CascadeType.ALL,fetch=FetchType.LAZY)
@JoinColumn(name = "id")
private Set<Product> books = new HashSet();
/**
* 是否可编辑
* 1可编辑
* 0不可编辑
*/
@Column(nullable = false)
private Byte editable = 0;
}
| [
"[email protected]"
] | |
3d870837188439df743839308374975c74ec648a | ded566f7619cde933110f5677adee6ab0b29d1d3 | /src/main/java/com/honest/sdms/order/service/imp/OrderExpressServiceImp.java | 3a410a7d4f3b70c81d5e77d731d61c41962eda5c | [] | no_license | xynccz/sdms | 8d16cf5193efb20ef1a38d179bb386900484cd40 | a18b39cb93b53f073d8daf739ebb93f0aea15e9e | refs/heads/master | 2022-06-30T09:19:49.753021 | 2021-03-20T03:55:55 | 2021-03-20T03:55:55 | 172,083,710 | 0 | 0 | null | 2022-02-09T22:12:38 | 2019-02-22T14:52:20 | Java | UTF-8 | Java | false | false | 1,349 | java | package com.honest.sdms.order.service.imp;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.honest.sdms.Constants;
import com.honest.sdms.order.dao.OrderExpressMapper;
import com.honest.sdms.order.entity.OrderExpress;
import com.honest.sdms.order.service.IOrderExpressService;
import com.honest.sdms.system.dao.IBaseMapper;
import com.honest.sdms.system.service.imp.BaseServiceImp;
@Service
public class OrderExpressServiceImp extends BaseServiceImp<OrderExpress, Long> implements IOrderExpressService{
private OrderExpressMapper orderExpressMapper;
@Autowired
@Qualifier("orderExpressMapper")
@Override
public void setBaseDao(IBaseMapper<OrderExpress, Long> baseMapper) {
this.baseMapper = baseMapper;
orderExpressMapper = (OrderExpressMapper)baseMapper;
}
@Override
public List<OrderExpress> findOrderExpressByHeadIds(String[] headerIds) {
return orderExpressMapper.findOrderExpressByHeadIds(headerIds,Constants.getCurrentOrganizationId());
}
@Override
public void updateOrderExpressByHeadIds(Long expressCompanyId, String[] headerIds) {
orderExpressMapper.updateOrderExpressByHeadIds(expressCompanyId, headerIds,Constants.getCurrentOrganizationId());
}
}
| [
"[email protected]"
] | |
23bd9ff3f0db61721e216ec38d08adafde34beb4 | f8fcd67807a7a9712b30d0cb7a1b138f484eced8 | /GameObj.java | 083c4e45bfb88cbce118aae69951b348fbcc80a2 | [] | no_license | hcutler/Breakout | d003298703aaf35159c3efcc0ed7801886ec978d | a199c4c8e951e4f668d2c2433fc7eb2dbc5a8aae | refs/heads/master | 2020-05-19T16:30:10.117776 | 2014-04-30T20:38:12 | 2014-04-30T20:38:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,753 | java | /**
* CIS 120 HW10
* (c) University of Pennsylvania
* @version 2.0, Mar 2013
*/
import java.awt.Graphics;
/** An object in the game.
*
* Game objects exist in the game court. They have a position,
* velocity, size and bounds. Their velocity controls how they
* move; their position should always be within their bounds.
*/
public class GameObj {
/** Current position of the object (in terms of graphics coordinates)
*
* Coordinates are given by the upper-left hand corner of the object.
* This position should always be within bounds.
* 0 <= pos_x <= max_x
* 0 <= pos_y <= max_y
*/
public int pos_x;
public int pos_y;
/** Size of object, in pixels */
public int width;
public int height;
/** Velocity: number of pixels to move every time move() is called */
public int v_x;
public int v_y;
/** Upper bounds of the area in which the object can be positioned.
* Maximum permissible x, y positions for the upper-left
* hand corner of the object
*/
public int max_x;
public int max_y;
/**
* Constructor
*/
public GameObj(int v_x, int v_y, int pos_x, int pos_y,
int width, int height, int court_width, int court_height){
this.v_x = v_x;
this.v_y = v_y;
this.pos_x = pos_x;
this.pos_y = pos_y;
this.width = width;
this.height = height;
// take the width and height into account when setting the
// bounds for the upper left corner of the object.
this.max_x = court_width - width;
this.max_y = court_height - height;
}
/**
* Moves the object by its velocity. Ensures that the object does
* not go outside its bounds by clipping.
*/
public void move(){
pos_x += v_x;
pos_y += v_y;
clip();
}
/**
* Prevents the object from going outside of the bounds of the area
* designated for the object. (i.e. Object cannot go outside of the
* active area the user defines for it).
*/
public void clip(){
if (pos_x < 0) pos_x = 0;
else if (pos_x > max_x) pos_x = max_x;
if (pos_y < 0) pos_y = 0;
else if (pos_y > max_y) pos_y = max_y;
}
/**
* Determine whether this game object is currently intersecting
* another object.
*
* Intersection is determined by comparing bounding boxes. If the
* bounding boxes overlap, then an intersection is considered to occur.
*
* @param obj : other object
* @return whether this object intersects the other object.
*/
public boolean intersects(GameObj obj){
return (pos_x + width >= obj.pos_x
&& pos_y + height >= obj.pos_y
&& obj.pos_x + obj.width >= pos_x
&& obj.pos_y + obj.height >= pos_y);
}
/**
* Determine whether this game object will intersect another in the
* next time step, assuming that both objects continue with their
* current velocity.
*
* Intersection is determined by comparing bounding boxes. If the
* bounding boxes (for the next time step) overlap, then an
* intersection is considered to occur.
*
* @param obj : other object
* @return whether an intersection will occur.
*/
public boolean willIntersect(GameObj obj){
int next_x = pos_x + v_x;
int next_y = pos_y + v_y;
int next_obj_x = obj.pos_x + obj.v_x;
int next_obj_y = obj.pos_y + obj.v_y;
return (next_x + width >= next_obj_x
&& next_y + height >= next_obj_y
&& next_obj_x + obj.width >= next_x
&& next_obj_y + obj.height >= next_y);
}
/** Update the velocity of the object in response to hitting
* an obstacle in the given direction. If the direction is
* null, this method has no effect on the object. */
public void bounce(Direction d) {
if (d == null) return;
switch (d) {
case UP: v_y = Math.abs(v_y); break;
case DOWN: v_y = -Math.abs(v_y); break;
case LEFT: v_x = Math.abs(v_x); break;
case RIGHT: v_x = -Math.abs(v_x); break;
}
}
/** Determine whether the game object will hit a
* wall in the next time step. If so, return the direction
* of the wall in relation to this game object.
*
* @return direction of impending wall, null if all clear.
*/
public Direction hitWall() {
if (pos_x + v_x < 0)
return Direction.LEFT;
else if (pos_x + v_x > max_x)
return Direction.RIGHT;
if (pos_y + v_y < 0)
return Direction.UP;
else if (pos_y + v_y > max_y)
return Direction.DOWN;
else return null;
}
/** Determine whether the game object will hit another
* object in the next time step. If so, return the direction
* of the other object in relation to this game object.
*
* @return direction of impending object, null if all clear.
*/
public Direction hitObj(GameObj other) {
if (this.willIntersect(other)) {
double dx = other.pos_x + other.width /2 - (pos_x + width /2);
double dy = other.pos_y + other.height/2 - (pos_y + height/2);
double theta = Math.acos(dx / (Math.sqrt(dx * dx + dy *dy)));
double diagTheta = Math.atan2(height / 2, width / 2);
if (theta <= diagTheta ) {
return Direction.RIGHT;
} else if ( theta > diagTheta && theta <= Math.PI - diagTheta ) {
if ( dy > 0 ) {
// Coordinate system for GUIs is switched
return Direction.DOWN;
} else {
return Direction.UP;
}
} else {
return Direction.LEFT;
}
} else {
return null;
}
}
/**
* Default draw method that provides how the object should be drawn
* in the GUI. This method does not draw anything. Subclass should
* override this method based on how their object should appear.
*
* @param g
* The <code>Graphics</code> context used for drawing the object.
* Remember graphics contexts that we used in OCaml, it gives the
* context in which the object should be drawn (a canvas, a frame,
* etc.)
*/
public void draw(Graphics g) {
}
}
| [
"[email protected]"
] | |
750254f6d97c9584eb6583fee54d94696e1ee98c | ebdcaff90c72bf9bb7871574b25602ec22e45c35 | /modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201806/mcm/CustomerServiceInterfacegetServiceLinksResponse.java | 36696604569c81a56f193e0dc25071cb044759fd | [
"Apache-2.0"
] | permissive | ColleenKeegan/googleads-java-lib | 3c25ea93740b3abceb52bb0534aff66388d8abd1 | 3d38daadf66e5d9c3db220559f099fd5c5b19e70 | refs/heads/master | 2023-04-06T16:16:51.690975 | 2018-11-15T20:50:26 | 2018-11-15T20:50:26 | 158,986,306 | 1 | 0 | Apache-2.0 | 2023-04-04T01:42:56 | 2018-11-25T00:56:39 | Java | UTF-8 | Java | false | false | 2,574 | java | // Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.api.ads.adwords.jaxws.v201806.mcm;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for getServiceLinksResponse element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="getServiceLinksResponse">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="rval" type="{https://adwords.google.com/api/adwords/mcm/v201806}ServiceLink" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"rval"
})
@XmlRootElement(name = "getServiceLinksResponse")
public class CustomerServiceInterfacegetServiceLinksResponse {
protected List<ServiceLink> rval;
/**
* Gets the value of the rval property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the rval property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRval().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ServiceLink }
*
*
*/
public List<ServiceLink> getRval() {
if (rval == null) {
rval = new ArrayList<ServiceLink>();
}
return this.rval;
}
}
| [
"[email protected]"
] | |
03a9e332cc5bfd1a30bfed294df14d208cd34d4e | 39af503e70bb7f0d911005c0102718fe145992aa | /src/main/java/com/antogeo/entity/Result.java | d61de01a985ca404a51af84d90a167ca340475b4 | [] | no_license | antono124/egradebook_hibernate | bb8d61d2549fc8057deff4837f237311b0281b2e | 71c6bb2d1b89032020793e3312a2e28d106689ec | refs/heads/master | 2019-01-02T01:46:13.744370 | 2015-09-23T19:34:58 | 2015-09-23T19:34:58 | 42,778,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,408 | java | package com.antogeo.entity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "results")
public class Result {
private long resultId;
private int grade;
private Student student;
private Course course;
private Date creationDate;
public Result() {
}
public Result(Student student,
Course course) {
this.student = student;
this.course = course;
}
@Id
@GeneratedValue
@Column(name="result_id")
public long getResultId() {
return resultId;
}
public void setResultId(long resultId) {
this.resultId = resultId;
}
@Column(name="grade")
public int getGrade() {
return grade;
}
public void setGrade(int grade) {
this.grade = grade;
}
@ManyToOne
@JoinColumn(name="student_id")
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
@ManyToOne
@JoinColumn(name="class_id")
public Course getCourse() {
return course;
}
public void setCourse(Course course) {
this.course = course;
}
@Column(name="creation_date")
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
}
| [
"[email protected]"
] | |
393202c5cf3775749180ca412653df3756e32ba0 | 7afbca4f5459256d84f8e064de4cd1652b28200e | /src/JavaBasic/Generic/GenericClass.java | d7bb715db3dfb02ff728a8e2328ffca399be48b9 | [] | no_license | Stephen-ps/Learn | 99dc1ab354afe0e45964222f6db4a3cf8067d859 | 17e20ee10a8c9eec21c20bb14c432eecb4612b90 | refs/heads/master | 2023-05-05T20:36:03.981512 | 2021-06-04T07:18:18 | 2021-06-04T07:18:18 | 373,749,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package JavaBasic.Generic;
/**<p>当不知道用什么数据类型的时候使用泛型</p>
* <p>泛型可以接受任意的数据类型</p>
* <p>注意:</p>
* <p>1.写法为<字母></p>
* <P>2.如果是定义一个类,那么<字母>必须写在类名的后面 </P>
* <P>3.类下面的数据类型也改为泛型</P>
*/
public class GenericClass<T> {
private T name;
public T getName() {
return name;
}
public void setName(T name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
510ae6e859cb0ffd534abc6292cfcd0e5682cf4a | 00e34a3e614a0c9929726a87498e66c46e12b686 | /app/src/main/java/com/example/hungary/RecyclerTouchListener.java | 681674333eb8969a06155e4f2d59f065eeaf6155 | [] | no_license | JannetZaied/TestInternship | 1c06e81c12b31d428f7128b21a6184c2e8a04d4a | 4604b762a496e88cde90518cc9ce256d33f67206 | refs/heads/master | 2020-11-26T16:55:02.607865 | 2019-12-19T22:25:46 | 2019-12-19T22:25:46 | 229,147,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,815 | java | package com.example.hungary;
import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener {
private GestureDetector gestureDetector;
private ClickListener clickListener;
public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final ClickListener clickListener) {
this.clickListener = clickListener;
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapUp(MotionEvent e) {
return true;
}
@Override
public void onLongPress(MotionEvent e) {
View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
if (child != null && clickListener != null) {
clickListener.onLongClick(child, recyclerView.getChildPosition(child));
}
}
});
}
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
View child = rv.findChildViewUnder(e.getX(), e.getY());
if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) {
clickListener.onClick(child, rv.getChildPosition(child));
}
return false;
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
public interface ClickListener {
void onClick(View view, int position);
void onLongClick(View view, int position);
}
} | [
"[email protected]"
] | |
613a872e5516194dc8194ffba2500e28806de4dd | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE129_Improper_Validation_of_Array_Index/s03/CWE129_Improper_Validation_of_Array_Index__getQueryString_Servlet_array_write_no_check_74b.java | 4767cea4fb034fad8b994ec516673befd32e4da1 | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,029 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE129_Improper_Validation_of_Array_Index__getQueryString_Servlet_array_write_no_check_74b.java
Label Definition File: CWE129_Improper_Validation_of_Array_Index.label.xml
Template File: sources-sinks-74b.tmpl.java
*/
/*
* @description
* CWE: 129 Improper Validation of Array Index
* BadSource: getQueryString_Servlet Parse id param out of the URL query string (without using getParameter())
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: array_write_no_check
* GoodSink: Write to array after verifying index
* BadSink : Write to array without any verification of index
* Flow Variant: 74 Data flow: data passed in a HashMap from one method to another in different source files in the same package
*
* */
package testcases.CWE129_Improper_Validation_of_Array_Index.s03;
import testcasesupport.*;
import java.util.HashMap;
import javax.servlet.http.*;
public class CWE129_Improper_Validation_of_Array_Index__getQueryString_Servlet_array_write_no_check_74b
{
public void badSink(HashMap<Integer,Integer> dataHashMap , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int data = dataHashMap.get(2);
/* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */
int array[] = { 0, 1, 2, 3, 4 };
/* POTENTIAL FLAW: Attempt to write to array at location data, which may be outside the array bounds */
array[data] = 42;
/* Skip reading back data from array since that may be another out of bounds operation */
}
/* goodG2B() - use GoodSource and BadSink */
public void goodG2BSink(HashMap<Integer,Integer> dataHashMap , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int data = dataHashMap.get(2);
/* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */
int array[] = { 0, 1, 2, 3, 4 };
/* POTENTIAL FLAW: Attempt to write to array at location data, which may be outside the array bounds */
array[data] = 42;
/* Skip reading back data from array since that may be another out of bounds operation */
}
/* goodB2G() - use BadSource and GoodSink */
public void goodB2GSink(HashMap<Integer,Integer> dataHashMap , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int data = dataHashMap.get(2);
/* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */
int array[] = { 0, 1, 2, 3, 4 };
/* FIX: Verify index before writing to array at location data */
if (data >= 0 && data < array.length)
{
array[data] = 42;
}
else
{
IO.writeLine("Array index out of bounds");
}
}
}
| [
"[email protected]"
] | |
6a0ec4201e57f43e31812bccc8186fbc55b34713 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/plugin/appbrand/report/model/c.java | c31874a5922d2e3833178864cfe82342eaf165d3 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 3,964 | java | package com.tencent.mm.plugin.appbrand.report.model;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.AppBrandRuntime;
import com.tencent.mm.plugin.appbrand.report.x;
import com.tencent.mm.plugin.appbrand.report.x.a;
import com.tencent.mm.plugin.appbrand.report.x.c;
import com.tencent.mm.plugin.appbrand.report.x.d;
import com.tencent.mm.sdk.platformtools.Log;
import com.tencent.mm.sdk.platformtools.Util;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicInteger;
public class c
{
public volatile String mAppId;
public volatile AppBrandRuntime qwG;
protected final x tPf;
public volatile String tPg;
public volatile long tPh;
public volatile long tPi;
private final LinkedList<Runnable> tPj;
public c(int paramInt)
{
AppMethodBeat.i(139925);
this.tPh = 0L;
this.tPi = 0L;
this.tPj = new LinkedList();
this.tPf = new x("MicroMsg.AppBrandPageViewStatistics[" + paramInt + "]");
AppMethodBeat.o(139925);
}
public final long cII()
{
AppMethodBeat.i(139926);
long l = Math.max(0L, this.tPi);
AppMethodBeat.o(139926);
return l;
}
public final long cIJ()
{
AppMethodBeat.i(139927);
if (1 == this.tPf.tOG.get())
{
i = 1;
if (i != 0) {
break label69;
}
i = this.tPf.tOG.get();
if ((-1 != i) && (2 != i)) {
break label64;
}
}
label64:
for (int i = 1;; i = 0)
{
if (i != 0) {
break label69;
}
AppMethodBeat.o(139927);
return 0L;
i = 0;
break;
}
label69:
long l2 = this.tPf.tOL;
long l1 = this.tPh;
long l3 = this.tPi;
if (l2 <= 0L)
{
if (isLoading())
{
AppMethodBeat.o(139927);
return 0L;
}
if ((this.qwG != null) && (this.qwG.ccV)) {}
for (boolean bool = true;; bool = false)
{
Log.i("MicroMsg.AppBrandPageViewStatistics", "foregroundMs invalid(%d), loadStart %d, loadCost %d, [%s/%s], runtimeIsFinishing=%b", new Object[] { Long.valueOf(l2), Long.valueOf(l1), Long.valueOf(l3), this.mAppId, this.tPg, Boolean.valueOf(bool) });
if ((l1 <= 0L) || (l3 <= 0L) || (l2 != 0L)) {
break;
}
l2 = Util.nowMilliSecond();
AppMethodBeat.o(139927);
return l2 - l1;
}
}
l1 = Math.max(0L, l2);
AppMethodBeat.o(139927);
return l1;
}
public final boolean isLoading()
{
return (this.tPh > 0L) && (this.tPi <= 0L);
}
public final void onBackground()
{
AppMethodBeat.i(321477);
if (this.tPf.cIE()) {
while (!this.tPj.isEmpty()) {
((Runnable)this.tPj.pollFirst()).run();
}
}
AppMethodBeat.o(321477);
}
public final void onDestroy()
{
AppMethodBeat.i(321483);
this.tPf.cIE();
x localx = this.tPf;
localx.tOG.set(-1);
localx.tOH = new x.d(localx, (byte)0);
AppMethodBeat.o(321483);
}
public final void onForeground()
{
AppMethodBeat.i(321481);
if (this.tPh <= 0L)
{
AppMethodBeat.o(321481);
return;
}
x localx = this.tPf;
if (localx.tOG.getAndSet(1) != 1) {}
for (boolean bool = true;; bool = false)
{
Log.d("Luggage.StayingRecorder", "%s toForeground, changed:%b", new Object[] { localx.mName, Boolean.valueOf(bool) });
if (bool)
{
localx.tOH.exit();
x.c localc = localx.tOI;
localx.tOH = localc;
localc.enter();
}
if (bool) {
this.tPj.clear();
}
AppMethodBeat.o(321481);
return;
}
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes8.jar
* Qualified Name: com.tencent.mm.plugin.appbrand.report.model.c
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
] | |
3b9ecf993c22c639a957031423f2307b5061b828 | 15c05e2a9299886dc5680d49e603dbb4fb1e62e2 | /app/src/main/java/com/fourteenfourhundred/critique/util/VolleyMultipartRequest.java | 4e4e8059b1bb0171193aadd6758c4f5be2c2219a | [] | no_license | marcfervil/Critique-Android-App | 2e11dc7c86e732c98d7c74baaea7b814750fa27d | 700f768f833cab1cf20e01f524edb17e5d632787 | refs/heads/master | 2021-09-20T12:32:29.072561 | 2018-08-09T20:44:24 | 2018-08-09T20:44:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,476 | java | package com.fourteenfourhundred.critique.util;
/**
* Created by Marc on 20/3/18.
*/
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.HttpHeaderParser;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Map;
/**
* Created by Belal on 10/24/2017.
*/
public class VolleyMultipartRequest extends Request<NetworkResponse> {
private final String twoHyphens = "--";
private final String lineEnd = "\r\n";
private final String boundary = "apiclient-" + System.currentTimeMillis();
private Response.Listener<NetworkResponse> mListener;
private Response.ErrorListener mErrorListener;
private Map<String, String> mHeaders;
public VolleyMultipartRequest(int method, String url,
Response.Listener<NetworkResponse> listener,
Response.ErrorListener errorListener) {
super(method, url, errorListener);
this.mListener = listener;
this.mErrorListener = errorListener;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return (mHeaders != null) ? mHeaders : super.getHeaders();
}
@Override
public String getBodyContentType() {
return "multipart/form-data;boundary=" + boundary;
}
@Override
public byte[] getBody() throws AuthFailureError {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
try {
// populate text payload
Map<String, String> params = getParams();
if (params != null && params.size() > 0) {
textParse(dos, params, getParamsEncoding());
}
// populate data byte payload
Map<String, DataPart> data = getByteData();
if (data != null && data.size() > 0) {
dataParse(dos, data);
}
// close multipart form data after text and file data
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
return bos.toByteArray();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* Custom method handle data payload.
*
* @return Map data part label with data byte
* @throws AuthFailureError
*/
protected Map<String, DataPart> getByteData() throws AuthFailureError {
return null;
}
@Override
protected Response<NetworkResponse> parseNetworkResponse(NetworkResponse response) {
try {
return Response.success(
response,
HttpHeaderParser.parseCacheHeaders(response));
} catch (Exception e) {
return Response.error(new ParseError(e));
}
}
@Override
protected void deliverResponse(NetworkResponse response) {
mListener.onResponse(response);
}
@Override
public void deliverError(VolleyError error) {
mErrorListener.onErrorResponse(error);
}
/**
* Parse string map into data output stream by key and value.
*
* @param dataOutputStream data output stream handle string parsing
* @param params string inputs collection
* @param encoding encode the inputs, default UTF-8
* @throws IOException
*/
private void textParse(DataOutputStream dataOutputStream, Map<String, String> params, String encoding) throws IOException {
try {
for (Map.Entry<String, String> entry : params.entrySet()) {
buildTextPart(dataOutputStream, entry.getKey(), entry.getValue());
}
} catch (UnsupportedEncodingException uee) {
throw new RuntimeException("Encoding not supported: " + encoding, uee);
}
}
/**
* Parse data into data output stream.
*
* @param dataOutputStream data output stream handle file attachment
* @param data loop through data
* @throws IOException
*/
private void dataParse(DataOutputStream dataOutputStream, Map<String, DataPart> data) throws IOException {
for (Map.Entry<String, DataPart> entry : data.entrySet()) {
buildDataPart(dataOutputStream, entry.getValue(), entry.getKey());
}
}
/**
* Write string data into header and data output stream.
*
* @param dataOutputStream data output stream handle string parsing
* @param parameterName name of input
* @param parameterValue value of input
* @throws IOException
*/
private void buildTextPart(DataOutputStream dataOutputStream, String parameterName, String parameterValue) throws IOException {
dataOutputStream.writeBytes(twoHyphens + boundary + lineEnd);
dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"" + parameterName + "\"" + lineEnd);
dataOutputStream.writeBytes(lineEnd);
dataOutputStream.writeBytes(parameterValue + lineEnd);
}
/**
* Write data file into header and data output stream.
*
* @param dataOutputStream data output stream handle data parsing
* @param dataFile data byte as DataPart from collection
* @param inputName name of data input
* @throws IOException
*/
private void buildDataPart(DataOutputStream dataOutputStream, DataPart dataFile, String inputName) throws IOException {
dataOutputStream.writeBytes(twoHyphens + boundary + lineEnd);
dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"" +
inputName + "\"; filename=\"" + dataFile.getFileName() + "\"" + lineEnd);
if (dataFile.getType() != null && !dataFile.getType().trim().isEmpty()) {
dataOutputStream.writeBytes("Content-Type: " + dataFile.getType() + lineEnd);
}
dataOutputStream.writeBytes(lineEnd);
ByteArrayInputStream fileInputStream = new ByteArrayInputStream(dataFile.getContent());
int bytesAvailable = fileInputStream.available();
int maxBufferSize = 1024 * 1024;
int bufferSize = Math.min(bytesAvailable, maxBufferSize);
byte[] buffer = new byte[bufferSize];
int bytesRead = fileInputStream.read(buffer, 0, bufferSize);
while (bytesRead > 0) {
dataOutputStream.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
}
dataOutputStream.writeBytes(lineEnd);
}
public class DataPart {
private String fileName;
private byte[] content;
private String type;
public DataPart() {
}
public DataPart(String name, byte[] data) {
fileName = name;
content = data;
}
String getFileName() {
return fileName;
}
byte[] getContent() {
return content;
}
String getType() {
return type;
}
}
} | [
"[email protected]"
] | |
d3faead2e32d310d29b562afeed0325e3eab407c | 60608b0bb87b0b11a14c5ab4e7c19589045ca6b2 | /src/main/java/com/cap/jumpthequeue/SpringBootBatchApp.java | 3f68cb397393526c0a9688e5d7bf08c88ddba739 | [] | no_license | ruizmat/onboarding-jumpthequeue | 018e42f7047b3a13b02e1660c08d48dcd1b6ffe1 | 18e6a9a03449ae752ab3bdf5ae334d9fef78032e | refs/heads/master | 2020-03-23T19:57:17.763712 | 2018-07-23T12:41:59 | 2018-07-23T12:41:59 | 142,012,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,239 | java | package com.cap.jumpthequeue;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfiguration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import io.oasp.module.jpa.dataaccess.api.AdvancedRevisionEntity;
/**
* {@link SpringBootApplication} for running this batch.
*/
@SpringBootApplication(exclude = { EndpointAutoConfiguration.class, SecurityAutoConfiguration.class,
SecurityFilterAutoConfiguration.class, })
@EntityScan(basePackages = { "com.cap.jumpthequeue" }, basePackageClasses = { AdvancedRevisionEntity.class })
@EnableGlobalMethodSecurity(jsr250Enabled = false)
public class SpringBootBatchApp {
/**
* Entry point for spring-boot based app
*
* @param args - arguments
*/
public static void main(String[] args) {
SpringApplication.run(SpringBootBatchApp.class, args);
}
}
| [
"[email protected]"
] | |
2ed2de4748efb23084df60fa640116e5a772679d | c0dedab9d479306b4c4657f5b998211693f6508f | /app/src/test/java/reloader/system/edu/ar/bdatossemana/ExampleUnitTest.java | 101209294539b59260556ce695c69ddac3d2a23d | [] | no_license | reloadersystem/CRUD_SQLite | f4db3a245568a579fc749feecea536491c46e766 | d7525ad6dae6b68930bd407148d357de094677ba | refs/heads/master | 2020-11-25T03:09:01.328685 | 2019-12-16T20:51:01 | 2019-12-16T20:51:01 | 228,472,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package reloader.system.edu.ar.bdatossemana;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
452311efaf4cad6b3db156db3e6e9937ff30e975 | 7da5bffbd22a6bf9cdec5a704917756fd311e5fb | /6. SERVER/Address/src/com/test/address/Address.java | cb058b7b227bd728b69c9b8b168b355a81371918 | [] | no_license | moods2/Code-Studty | 5648e96413ca5d6cd3eced757a9fd390c9271c6f | 5abfd9f3b4fa4ebf51898220d1302cfeb3ddb827 | refs/heads/master | 2022-12-17T10:06:19.621930 | 2020-09-26T12:40:23 | 2020-09-26T12:40:23 | 291,418,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package com.test.address;
public class Address {
private String seq;
private String name;
private String age;
private String address;
private String regdate;
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getRegdate() {
return regdate;
}
public void setRegdate(String regdate) {
this.regdate = regdate;
}
}
| [
"[email protected]"
] | |
7ef4ef1c86b35b61e7468f59e458f4101ce170b0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_fc905f6affec876a531ce732e95efee644087287/ObjectMapperImpl/11_fc905f6affec876a531ce732e95efee644087287_ObjectMapperImpl_t.java | 01ee0a075fab276eb86aa9f80253ccfa451153b5 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 50,396 | java | package de.caluga.morphium;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.DBRef;
import de.caluga.morphium.annotations.*;
import org.apache.log4j.Logger;
import org.bson.types.ObjectId;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* User: Stpehan Bösebeck
* Date: 26.03.12
* Time: 19:36
* <p/>
*/
public class ObjectMapperImpl implements ObjectMapper {
private static Logger log = Logger.getLogger(ObjectMapperImpl.class);
private static volatile Map<Class<?>, List<Field>> fieldCache = new Hashtable<Class<?>, List<Field>>();
public volatile Morphium morphium;
private volatile Hashtable<Class<?>, NameProvider> nameProviders;
public Morphium getMorphium() {
return morphium;
}
public void setMorphium(Morphium morphium) {
this.morphium = morphium;
}
public ObjectMapperImpl(Morphium m) {
morphium = m;
nameProviders = new Hashtable<Class<?>, NameProvider>();
}
public ObjectMapperImpl() {
this(null);
}
/**
* converts a sql/javascript-Name to Java, e.g. converts document_id to
* documentId.
*
* @param n
* @param capitalize : if true, first letter will be capitalized
* @return
*/
public String createCamelCase(String n, boolean capitalize) {
n = n.toLowerCase();
String f[] = n.split("_");
StringBuilder sb = new StringBuilder(f[0].substring(0, 1).toLowerCase());
//String ret =
sb.append(f[0].substring(1));
for (int i = 1; i < f.length; i++) {
sb.append(f[i].substring(0, 1).toUpperCase());
sb.append(f[i].substring(1));
}
String ret = sb.toString();
if (capitalize) {
ret = ret.substring(0, 1).toUpperCase() + ret.substring(1);
}
return ret;
}
/**
* turns documentId into document_id
*
* @param n
* @return
*/
public String convertCamelCase(String n) {
StringBuffer b = new StringBuffer();
for (int i = 0; i < n.length() - 1; i++) {
if (Character.isUpperCase(n.charAt(i)) && i > 0) {
b.append("_");
}
b.append(n.substring(i, i + 1).toLowerCase());
}
b.append(n.substring(n.length() - 1));
return b.toString();
}
/**
* override nameprovider in runtime!
*
* @param cls
* @param np
*/
public void setNameProviderForClass(Class<?> cls, NameProvider np) {
nameProviders.put(cls, np);
}
public NameProvider getNameProviderForClass(Class<?> cls) {
Entity e = morphium.getAnnotationFromHierarchy(cls, Entity.class);
if (e == null) {
throw new IllegalArgumentException("no entity annotation found");
}
try {
return getNameProviderForClass(cls, e);
} catch (Exception ex) {
log.error("Error getting nameProvider", ex);
throw new IllegalArgumentException("could not get name provicer", ex);
}
}
private NameProvider getNameProviderForClass(Class<?> cls, Entity p) throws IllegalAccessException, InstantiationException {
if (p == null) {
throw new IllegalArgumentException("No Entity " + cls.getSimpleName());
}
if (nameProviders.get(cls) == null) {
NameProvider np = p.nameProvider().newInstance();
nameProviders.put(cls, np);
}
return nameProviders.get(cls);
}
@Override
public String getCollectionName(Class cls) {
if (morphium == null) return null;
Entity p = morphium.getAnnotationFromHierarchy(cls, Entity.class); //(Entity) cls.getAnnotation(Entity.class);
if (p == null) {
throw new IllegalArgumentException("No Entity " + cls.getSimpleName());
}
try {
cls = getRealClass(cls);
NameProvider np = getNameProviderForClass(cls, p);
return np.getCollectionName(cls, this, p.translateCamelCase(), p.useFQN(), p.collectionName().equals(".") ? null : p.collectionName(), morphium);
} catch (InstantiationException e) {
log.error("Could not instanciate NameProvider: " + p.nameProvider().getName(), e);
throw new RuntimeException("Could not Instaciate NameProvider", e);
} catch (IllegalAccessException e) {
log.error("Illegal Access during instanciation of NameProvider: " + p.nameProvider().getName(), e);
throw new RuntimeException("Illegal Access during instanciation", e);
}
}
@Override
public DBObject marshall(Object o) {
//recursively map object ot mongo-Object...
if (!isEntity(o)) {
throw new IllegalArgumentException("Object is no entity: " + o.getClass().getSimpleName());
}
DBObject dbo = new BasicDBObject();
if (o == null) {
return dbo;
}
Class<?> cls = getRealClass(o.getClass());
if (cls == null) {
throw new IllegalArgumentException("No real class?");
}
o = getRealObject(o);
List<String> flds = getFields(cls);
if (flds == null) {
throw new IllegalArgumentException("Fields not found? " + cls.getName());
}
Entity e = morphium.getAnnotationFromHierarchy(o.getClass(), Entity.class); //o.getClass().getAnnotation(Entity.class);
Embedded emb = morphium.getAnnotationFromHierarchy(o.getClass(), Embedded.class); //o.getClass().getAnnotation(Embedded.class);
if (e != null && e.polymorph()) {
dbo.put("class_name", cls.getName());
}
if (emb != null && emb.polymorph()) {
dbo.put("class_name", cls.getName());
}
for (String f : flds) {
String fName = f;
try {
Field fld = getField(cls, f);
if (fld == null) {
log.error("Field not found");
continue;
}
//do not store static fields!
if (Modifier.isStatic(fld.getModifiers())) {
continue;
}
AdditionalData ad = fld.getAnnotation(AdditionalData.class);
if (ad != null) {
if (!ad.readOnly()) {
//storing additional data
dbo.putAll((Map<String, Object>) fld.get(o));
}
//additional data is usually transient
continue;
}
if (fld.isAnnotationPresent(Id.class)) {
fName = "_id";
}
Object v = null;
Object value = fld.get(o);
if (fld.isAnnotationPresent(Reference.class)) {
Reference r = fld.getAnnotation(Reference.class);
//reference handling...
//field should point to a certain type - store ObjectID only
if (value == null) {
//no reference to be stored...
v = null;
} else {
if (fld.getType().isAssignableFrom(List.class)) {
//list of references....
BasicDBList lst = new BasicDBList();
for (Object rec : ((List) value)) {
if (rec != null) {
ObjectId id = getId(rec);
if (id == null) {
if (r.automaticStore()) {
morphium.storeNoCache(rec);
id = getId(rec);
} else {
throw new IllegalArgumentException("Cannot store reference to unstored entity if automaticStore in @Reference is set to false!");
}
}
DBRef ref = new DBRef(morphium.getDatabase(), getRealClass(rec.getClass()).getName(), id);
lst.add(ref);
} else {
lst.add(null);
}
}
v = lst;
} else if (fld.getType().isAssignableFrom(Map.class)) {
throw new RuntimeException("Cannot store references in Maps!");
} else {
if (getId(value) == null) {
//not stored yet
if (r.automaticStore()) {
//TODO: this could cause an endless loop!
if (morphium == null) {
log.fatal("Could not store - no Morphium set!");
} else {
morphium.storeNoCache(value);
}
} else {
throw new IllegalArgumentException("Reference to be stored, that is null!");
}
}
//DBRef ref = new DBRef(morphium.getDatabase(), value.getClass().getName(), getId(value));
v = getId(value);
}
}
} else {
//check, what type field has
//Store Entities recursively
//TODO: Fix recursion - this could cause a loop!
if (morphium.isAnnotationPresentInHierarchy(fld.getType(), Entity.class)) {
if (value != null) {
DBObject obj = marshall(value);
obj.removeField("_id"); //Do not store ID embedded!
v = obj;
}
} else if (morphium.isAnnotationPresentInHierarchy(fld.getType(), Embedded.class)) {
if (value != null) {
v = marshall(value);
}
} else {
v = value;
if (v != null) {
if (v instanceof Map) {
//create MongoDBObject-Map
v = createDBMap((Map) v);
} else if (v instanceof List) {
v = createDBList((List) v);
} else if (v instanceof Iterable) {
ArrayList lst = new ArrayList();
for (Object i : (Iterable) v) {
lst.add(i);
}
v = createDBList(lst);
} else if (v.getClass().equals(GregorianCalendar.class)) {
v = ((GregorianCalendar) v).getTime();
} else if (v.getClass().isEnum()) {
v = ((Enum) v).name();
}
}
}
}
if (v == null) {
if (fld.isAnnotationPresent(NotNull.class)) {
throw new IllegalArgumentException("Value is null - but must not (NotNull-Annotation to" + o.getClass().getSimpleName() + ")! Field: " + fName);
}
if (!fld.isAnnotationPresent(UseIfnull.class)) {
//Do not put null-Values into dbo => not storing null-Values to db
continue;
}
}
dbo.put(fName, v);
} catch (IllegalAccessException exc) {
log.fatal("Illegal Access to field " + f);
}
}
return dbo;
}
private BasicDBList createDBList(List v) {
BasicDBList lst = new BasicDBList();
for (Object lo : ((List) v)) {
if (lo != null) {
if (morphium.isAnnotationPresentInHierarchy(lo.getClass(), Entity.class) ||
morphium.isAnnotationPresentInHierarchy(lo.getClass(), Embedded.class)) {
DBObject marshall = marshall(lo);
marshall.put("class_name", lo.getClass().getName());
lst.add(marshall);
} else if (lo instanceof List) {
lst.add(createDBList((List) lo));
} else if (lo instanceof Map) {
lst.add(createDBMap(((Map) lo)));
} else if (lo.getClass().isEnum()) {
BasicDBObject obj = new BasicDBObject();
obj.put("class_name", lo.getClass().getName());
obj.put("name", ((Enum) lo).name());
lst.add(obj);
//throw new IllegalArgumentException("List of enums not supported yet");
} else {
lst.add(lo);
}
} else {
lst.add(null);
}
}
return lst;
}
private BasicDBObject createDBMap(Map v) {
BasicDBObject dbMap = new BasicDBObject();
for (Map.Entry<Object, Object> es : ((Map<Object, Object>) v).entrySet()) {
Object k = es.getKey();
if (!(k instanceof String)) {
log.warn("Map in Mongodb needs to have String as keys - using toString");
k = k.toString();
if (((String) k).contains(".")) {
log.warn(". not allowed as Key in Maps - converting to _");
k = ((String) k).replaceAll("\\.", "_");
}
}
Object mval = es.getValue(); // ((Map) v).get(k);
if (mval != null) {
if (morphium.isAnnotationPresentInHierarchy(mval.getClass(), Entity.class) || morphium.isAnnotationPresentInHierarchy(mval.getClass(), Embedded.class)) {
DBObject obj = marshall(mval);
obj.put("class_name", mval.getClass().getName());
mval = obj;
} else if (mval instanceof Map) {
mval = createDBMap((Map) mval);
} else if (mval instanceof List) {
mval = createDBList((List) mval);
} else if (mval.getClass().isEnum()) {
BasicDBObject obj = new BasicDBObject();
obj.put("class_name", mval.getClass().getName());
obj.put("name", ((Enum) mval).name());
}
}
dbMap.put((String) k, mval);
}
return dbMap;
}
@Override
public <T> T unmarshall(Class<T> cls, DBObject o) {
try {
if (o.get("class_name") != null || o.get("className") != null) {
if (log.isDebugEnabled()) {
log.debug("overriding cls - it's defined in dbObject");
}
try {
String cN = (String) o.get("class_name");
if (cN == null) {
cN = (String) o.get("className");
}
cls = (Class<T>) Class.forName(cN);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
if (cls.isEnum()) {
T[] en = cls.getEnumConstants();
for (Enum e : ((Enum[]) en)) {
if (e.name().equals(o.get("name"))) {
return (T) e;
}
}
}
T ret = cls.newInstance();
List<String> flds = getFields(cls);
for (String f : flds) {
Field fld = getField(cls, f);
if (Modifier.isStatic(fld.getModifiers())) {
//skip static fields
continue;
}
if (fld.isAnnotationPresent(AdditionalData.class)) {
//this field should store all data that is not put to fields
if (!fld.getType().isAssignableFrom(Map.class)) {
log.error("Could not unmarshall additional data into fld of type " + fld.getType().toString());
continue;
}
Set<String> keys = o.keySet();
Map<String, Object> data = new HashMap<String, Object>();
for (String k : keys) {
if (flds.contains(k)) {
continue;
}
data.put(k, o.get(k));
}
fld.set(ret, data);
continue;
}
Object value = null;
if (!fld.getType().isAssignableFrom(Map.class) && !fld.getType().isAssignableFrom(List.class) && fld.isAnnotationPresent(Reference.class)) {
//A reference - only id stored
Reference reference = fld.getAnnotation(Reference.class);
if (morphium == null) {
log.fatal("Morphium not set - could not de-reference!");
} else {
ObjectId id = null;
if (o.get(f) instanceof ObjectId) {
id = (ObjectId) o.get(f);
} else {
DBRef ref = (DBRef) o.get(f);
if (ref != null) {
id = (ObjectId) ref.getId();
if (!ref.getRef().equals(fld.getType().getName())) {
log.warn("Reference to different object?! - continuing anyway");
}
}
}
if (id != null) {
if (reference.lazyLoading()) {
List<String> lst = getFields(fld.getType(), Id.class);
if (lst.size() == 0)
throw new IllegalArgumentException("Referenced object does not have an ID? Is it an Entity?");
value = morphium.createLazyLoadedEntity(fld.getType(), id);
} else {
// Query q = morphium.createQueryFor(fld.getType());
// q.f("_id").eq(id);
value = morphium.findById(fld.getType(), id);
}
} else {
value = null;
}
}
} else if (fld.isAnnotationPresent(Id.class)) {
value = (ObjectId) o.get("_id");
} else if (morphium.isAnnotationPresentInHierarchy(fld.getType(), Entity.class) || morphium.isAnnotationPresentInHierarchy(fld.getType(), Embedded.class)) {
//entity! embedded
if (o.get(f) != null) {
value = unmarshall(fld.getType(), (DBObject) o.get(f));
} else {
value = null;
}
} else if (fld.getType().isAssignableFrom(Map.class)) {
BasicDBObject map = (BasicDBObject) o.get(f);
value = createMap(map);
} else if (fld.getType().isAssignableFrom(List.class) || fld.getType().isArray()) {
BasicDBList l = (BasicDBList) o.get(f);
List lst = new ArrayList();
if (l != null) {
fillList(fld, l, lst);
if (fld.getType().isArray()) {
Object arr = Array.newInstance(fld.getType().getComponentType(), lst.size());
for (int i = 0; i < lst.size(); i++) {
Array.set(arr, i, lst.get(i));
}
value = arr;
} else {
value = lst;
}
} else {
value = l;
}
} else if (fld.getType().isEnum()) {
if (o.get(f) != null) {
value = Enum.valueOf((Class<? extends Enum>) fld.getType(), (String) o.get(f));
}
} else {
value = o.get(f);
}
setValue(ret, value, f);
}
if (morphium.isAnnotationPresentInHierarchy(cls, Entity.class)) {
flds = getFields(cls, Id.class);
if (flds.isEmpty()) {
throw new RuntimeException("Error - class does not have an ID field!");
}
getField(cls, flds.get(0)).set(ret, o.get("_id"));
}
if (morphium.isAnnotationPresentInHierarchy(cls, PartialUpdate.class) || cls.isInstance(PartiallyUpdateable.class)) {
return morphium.createPartiallyUpdateableEntity(ret);
}
return ret;
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
//recursively fill class
}
private Object createMap(BasicDBObject map) {
Object value;
if (map != null) {
for (String n : map.keySet()) {
if (map.get(n) instanceof BasicDBObject) {
Object val = map.get(n);
if (((BasicDBObject) val).containsField("class_name") || ((BasicDBObject) val).containsField("className")) {
//Entity to map!
String cn = (String) ((BasicDBObject) val).get("class_name");
if (cn == null) {
cn = (String) ((BasicDBObject) val).get("className");
}
try {
Class ecls = Class.forName(cn);
map.put(n, unmarshall(ecls, (DBObject) map.get(n)));
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} else {
//maybe a map of maps? --> recurse
map.put(n, createMap((BasicDBObject) val));
}
} else if (map.get(n) instanceof BasicDBList) {
BasicDBList lst = (BasicDBList) map.get(n);
List mapValue = createList(lst);
map.put(n, mapValue);
}
}
value = map;
} else {
value = null;
}
return value;
}
private List createList(BasicDBList lst) {
List mapValue = new ArrayList();
for (Object li : lst) {
if (li instanceof BasicDBObject) {
if (((BasicDBObject) li).containsField("class_name") || ((BasicDBObject) li).containsField("className")) {
String cn = (String) ((BasicDBObject) li).get("class_name");
if (cn == null) {
cn = (String) ((BasicDBObject) li).get("className");
}
try {
Class ecls = Class.forName(cn);
mapValue.add(unmarshall(ecls, (DBObject) li));
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} else {
mapValue.add(createMap((BasicDBObject) li));
}
} else if (li instanceof BasicDBList) {
mapValue.add(createList((BasicDBList) li));
} else {
mapValue.add(li);
}
}
return mapValue;
}
private void fillList(Field forField, BasicDBList fromDB, List toFillIn) {
for (Object val : fromDB) {
if (val instanceof BasicDBObject) {
if (((BasicDBObject) val).containsField("class_name") || ((BasicDBObject) val).containsField("className")) {
//Entity to map!
String cn = (String) ((BasicDBObject) val).get("class_name");
if (cn == null) {
cn = (String) ((BasicDBObject) val).get("className");
}
try {
Class ecls = Class.forName(cn);
toFillIn.add(unmarshall(ecls, (DBObject) val));
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} else {
//Probably an "normal" map
toFillIn.add(val);
}
} else if (val instanceof ObjectId) {
log.fatal("Cannot de-reference to unknown collection");
} else if (val instanceof BasicDBList) {
//one list once more
ArrayList lt = new ArrayList();
fillList(null, (BasicDBList) val, lt);
toFillIn.add(lt);
} else if (val instanceof DBRef) {
try {
DBRef ref = (DBRef) val;
ObjectId id = (ObjectId) ref.getId();
Class clz = Class.forName(ref.getRef());
List<String> idFlds = getFields(clz, Id.class);
Reference reference = forField != null ? forField.getAnnotation(Reference.class) : null;
if (reference != null && reference.lazyLoading()) {
if (idFlds.size() == 0)
throw new IllegalArgumentException("Referenced object does not have an ID? Is it an Entity?");
toFillIn.add(morphium.createLazyLoadedEntity(clz, id));
} else {
Query q = morphium.createQueryFor(clz);
q = q.f(idFlds.get(0)).eq(id);
toFillIn.add(q.get());
}
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} else {
toFillIn.add(val);
}
}
}
@Override
public ObjectId getId(Object o) {
if (o == null) {
throw new IllegalArgumentException("Object cannot be null");
}
Class<?> cls = getRealClass(o.getClass());
List<String> flds = getFields(cls, Id.class);
if (flds == null || flds.isEmpty()) {
throw new IllegalArgumentException("Object has no id defined: " + o.getClass().getSimpleName());
}
Field f = getField(cls, flds.get(0)); //first Id
if (f == null) {
throw new IllegalArgumentException("Object ID field not found " + o.getClass().getSimpleName());
}
try {
if (!(f.getType().equals(ObjectId.class))) {
throw new IllegalArgumentException("ID sould be of type ObjectId");
}
o = getRealObject(o);
if (o != null) {
return (ObjectId) f.get(o);
} else {
log.warn("Illegal reference?");
}
return null;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
/**
* return list of fields in class - including hierachy!!!
*
* @param clz
* @return
*/
public List<Field> getAllFields(Class clz) {
Class<?> cls = getRealClass(clz);
if (fieldCache.containsKey(cls)) {
return fieldCache.get(cls);
}
List<Field> ret = new Vector<Field>();
Class sc = cls;
//getting class hierachy
List<Class> hierachy = new Vector<Class>();
while (!sc.equals(Object.class)) {
hierachy.add(sc);
sc = sc.getSuperclass();
}
for (Class c : cls.getInterfaces()) {
hierachy.add(c);
}
//now we have a list of all classed up to Object
//we need to run through it in the right order
//in order to allow Inheritance to "shadow" fields
for (int i = hierachy.size() - 1; i >= 0; i--) {
Class c = hierachy.get(i);
for (Field f : c.getDeclaredFields()) {
ret.add(f);
}
}
fieldCache.put(cls, ret);
return ret;
}
@Override
/**
* get a list of valid fields of a given record as they are in the MongoDB
* so, if you have a field Mapping, the mapped Property-name will be used
* returns all fields, which have at least one of the given annotations
* if no annotation is given, all fields are returned
* Does not take the @Aliases-annotation int account
*
* @param cls
* @return
*/
public List<String> getFields(Class cls, Class<? extends Annotation>... annotations) {
List<String> ret = new Vector<String>();
Class sc = cls;
sc = getRealClass(sc);
Entity entity = morphium.getAnnotationFromHierarchy(sc, Entity.class); //(Entity) sc.getAnnotation(Entity.class);
Embedded embedded = morphium.getAnnotationFromHierarchy(sc, Embedded.class);//(Embedded) sc.getAnnotation(Embedded.class);
if (embedded != null && entity != null) {
log.warn("Class " + cls.getName() + " does have both @Entity and @Embedded Annotations - not allowed! Assuming @Entity is right");
}
if (embedded == null && entity == null) {
throw new IllegalArgumentException("This class " + cls.getName() + " does not have @Entity or @Embedded set, not even in hierachy - illegal!");
}
boolean tcc = entity == null ? embedded.translateCamelCase() : entity.translateCamelCase();
//getting class hierachy
List<Field> fld = getAllFields(cls);
for (Field f : fld) {
if (annotations.length > 0) {
boolean found = false;
for (Class<? extends Annotation> a : annotations) {
if (f.isAnnotationPresent(a)) {
found = true;
break;
}
}
if (!found) {
//no annotation found
continue;
}
}
if (f.isAnnotationPresent(Reference.class) && !".".equals(f.getAnnotation(Reference.class).fieldName())) {
ret.add(f.getAnnotation(Reference.class).fieldName());
continue;
}
if (f.isAnnotationPresent(Property.class) && !".".equals(f.getAnnotation(Property.class).fieldName())) {
ret.add(f.getAnnotation(Property.class).fieldName());
continue;
}
// if (f.isAnnotationPresent(Id.class)) {
// ret.add(f.getName());
// continue;
// }
if (f.isAnnotationPresent(Transient.class)) {
continue;
}
if (tcc) {
ret.add(convertCamelCase(f.getName()));
} else {
ret.add(f.getName());
}
}
return ret;
}
@Override
public <T> Class<T> getRealClass(Class<T> sc) {
if (sc.getName().contains("$$EnhancerByCGLIB$$")) {
try {
sc = (Class<T>) Class.forName(sc.getName().substring(0, sc.getName().indexOf("$$")));
} catch (Exception e) {
//TODO: Implement Handling
throw new RuntimeException(e);
}
}
return sc;
}
@Override
public String getFieldName(Class clz, String field) {
Class cls = getRealClass(clz);
if (field.contains(".")) {
//searching for a sub-element?
//no check possible
return field;
}
Field f = getField(cls, field);
if (f == null) throw new RuntimeException("Field not found " + field + " in cls: " + clz.getName());
if (f.isAnnotationPresent(Property.class)) {
Property p = f.getAnnotation(Property.class);
if (p.fieldName() != null && !p.fieldName().equals(".")) {
return p.fieldName();
}
}
if (f.isAnnotationPresent(Reference.class)) {
Reference p = f.getAnnotation(Reference.class);
if (p.fieldName() != null && !p.fieldName().equals(".")) {
return p.fieldName();
}
}
if (f.isAnnotationPresent(Id.class)) {
return "_id";
}
String fieldName = f.getName();
Entity ent = morphium.getAnnotationFromHierarchy(cls, Entity.class); //(Entity) cls.getAnnotation(Entity.class);
Embedded emb = morphium.getAnnotationFromHierarchy(cls, Embedded.class);//(Embedded) cls.getAnnotation(Embedded.class);
if (ent != null && ent.translateCamelCase()) {
fieldName = convertCamelCase(fieldName);
} else if (emb != null && emb.translateCamelCase()) {
fieldName = convertCamelCase(fieldName);
}
return fieldName;
}
@Override
/**
* extended logic: Fld may be, the java field name, the name of the specified value in Property-Annotation or
* the translated underscored lowercase name (mongoId => mongo_id) or a name specified in the Aliases-Annotation of this field
*
* @param clz - class to search
* @param fld - field name
* @return field, if found, null else
*/
public Field getField(Class clz, String fld) {
Class cls = getRealClass(clz);
List<Field> flds = getAllFields(cls);
for (Field f : flds) {
if (f.isAnnotationPresent(Property.class) && f.getAnnotation(Property.class).fieldName() != null && !".".equals(f.getAnnotation(Property.class).fieldName())) {
if (f.getAnnotation(Property.class).fieldName().equals(fld)) {
f.setAccessible(true);
return f;
}
}
if (f.isAnnotationPresent(Reference.class) && f.getAnnotation(Reference.class).fieldName() != null && !".".equals(f.getAnnotation(Reference.class).fieldName())) {
if (f.getAnnotation(Reference.class).fieldName().equals(fld)) {
f.setAccessible(true);
return f;
}
}
if (f.isAnnotationPresent(Aliases.class)) {
Aliases aliases = f.getAnnotation(Aliases.class);
String[] v = aliases.value();
for (String field : v) {
if (field.equals(fld)) {
f.setAccessible(true);
return f;
}
}
}
if (fld.equals("_id")) {
if (f.isAnnotationPresent(Id.class)) {
f.setAccessible(true);
return f;
}
}
if (f.getName().equals(fld)) {
f.setAccessible(true);
return f;
}
if (convertCamelCase(f.getName()).equals(fld)) {
f.setAccessible(true);
return f;
}
}
return null;
}
@Override
public boolean isEntity(Object o) {
Class cls = null;
if (o == null) return false;
if (o instanceof Class) {
cls = getRealClass((Class) o);
} else {
cls = getRealClass(o.getClass());
}
return morphium.isAnnotationPresentInHierarchy(cls, Entity.class) || morphium.isAnnotationPresentInHierarchy(cls, Embedded.class);
}
@Override
public Object getValue(Object o, String fld) {
if (o == null) {
return null;
}
try {
Field f = getField(o.getClass(), fld);
if (!Modifier.isStatic(f.getModifiers())) {
o = getRealObject(o);
return f.get(o);
}
} catch (IllegalAccessException e) {
log.fatal("Illegal access to field " + fld + " of type " + o.getClass().getSimpleName());
}
return null;
}
@Override
public void setValue(Object o, Object value, String fld) {
if (o == null) {
return;
}
try {
Field f = getField(getRealClass(o.getClass()), fld);
if (!Modifier.isStatic(f.getModifiers())) {
o = getRealObject(o);
try {
f.set(o, value);
} catch (Exception e) {
if (value == null) {
return;
} else {
if (log.isDebugEnabled()) {
log.debug("Setting of value (" + value.getClass().getSimpleName() + ") failed for field " + f.getName() + "- trying type-conversion");
}
//Doing some type conversions... lots of :-(
if (value instanceof Double) {
//maybe some kind of Default???
Double d = (Double) value;
if (f.getType().equals(Integer.class) || f.getType().equals(int.class)) {
f.set(o, d.intValue());
} else if (f.getType().equals(Long.class) || f.getType().equals(long.class)) {
f.set(o, d.longValue());
} else if (f.getType().equals(Date.class)) {
//Fucking date / timestamp mixup
f.set(o, new Date(d.longValue()));
} else if (f.getType().equals(Float.class) || f.getType().equals(float.class)) {
f.set(o, d.floatValue());
} else if (f.getType().equals(Boolean.class) || f.getType().equals(boolean.class)) {
f.set(o, d == 1.0);
} else if (f.getType().equals(String.class)) {
f.set(o, d.toString());
} else {
throw new RuntimeException("could not set field " + fld + ": Field has type " + f.getType().toString() + " got type " + value.getClass().toString());
}
} else if (value instanceof Float) {
//maybe some kind of Default???
Float d = (Float) value;
if (f.getType().equals(Integer.class) || f.getType().equals(int.class)) {
f.set(o, d.intValue());
} else if (f.getType().equals(Long.class) || f.getType().equals(long.class)) {
f.set(o, d.longValue());
} else if (f.getType().equals(Date.class)) {
//Fucking date / timestamp mixup
f.set(o, new Date(d.longValue()));
} else if (f.getType().equals(Float.class) || f.getType().equals(float.class)) {
f.set(o, d.floatValue());
} else if (f.getType().equals(Boolean.class) || f.getType().equals(boolean.class)) {
f.set(o, d == 1.0f);
} else if (f.getType().equals(String.class)) {
f.set(o, d.toString());
} else {
throw new RuntimeException("could not set field " + fld + ": Field has type " + f.getType().toString() + " got type " + value.getClass().toString());
}
} else if (value instanceof Date) {
//Date/String mess-up?
Date d = (Date) value;
if (f.getType().equals(Long.class) || f.getType().equals(long.class)) {
f.set(o, d.getTime());
} else if (f.getType().equals(GregorianCalendar.class)) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(d.getTime());
f.set(o, cal);
} else if (f.getType().equals(String.class)) {
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
f.set(o, df.format(d));
}
} else if (value instanceof String) {
//String->Number conversion necessary????
try {
String s = (String) value;
if (f.getType().equals(Long.class) || f.getType().equals(long.class)) {
f.set(o, Long.parseLong(s));
} else if (f.getType().equals(Integer.class) || f.getType().equals(int.class)) {
f.set(o, Integer.parseInt(s));
} else if (f.getType().equals(Double.class) || f.getType().equals(double.class)) {
f.set(o, Double.parseDouble(s));
} else if (f.getType().equals(Date.class)) {
//Fucking date / timestamp mixup
if (s.length() == 8) {
//probably time-string 20120812
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
f.set(o, df.parse(s));
} else if (s.indexOf("-") > 0) {
//maybe a date-String?
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
f.set(o, df.parse(s));
} else if (s.indexOf(".") > 0) {
//maybe a date-String?
SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy");
f.set(o, df.parse(s));
} else {
f.set(o, new Date(Long.parseLong(s)));
}
} else if (f.getType().equals(Boolean.class) || f.getType().equals(boolean.class)) {
f.set(o, s.equalsIgnoreCase("true"));
} else if (f.getType().equals(Float.class) || f.getType().equals(float.class)) {
f.set(o, Float.parseFloat(s));
} else {
throw new RuntimeException("could not set field " + fld + ": Field has type " + f.getType().toString() + " got type " + value.getClass().toString());
}
} catch (ParseException e1) {
throw new RuntimeException(e1);
}
} else if (value instanceof Integer) {
Integer i = (Integer) value;
if (f.getType().equals(Long.class) || f.getType().equals(long.class)) {
f.set(o, i.intValue());
} else if (f.getType().equals(Double.class) || f.getType().equals(double.class)) {
f.set(o, i.doubleValue());
} else if (f.getType().equals(Date.class)) {
//Fucking date / timestamp mixup
f.set(o, new Date(i.longValue()));
} else if (f.getType().equals(String.class)) {
f.set(o, i.toString());
} else if (f.getType().equals(Float.class) || f.getType().equals(float.class)) {
f.set(o, i.floatValue());
} else if (f.getType().equals(Boolean.class) || f.getType().equals(boolean.class)) {
f.set(o, i == 1);
} else {
throw new RuntimeException("could not set field " + fld + ": Field has type " + f.getType().toString() + " got type " + value.getClass().toString());
}
} else if (value instanceof Long) {
Long l = (Long) value;
if (f.getType().equals(Integer.class) || f.getType().equals(int.class)) {
f.set(o, l.intValue());
} else if (f.getType().equals(Double.class) || f.getType().equals(double.class)) {
f.set(o, l.doubleValue());
} else if (f.getType().equals(Date.class)) {
//Fucking date / timestamp mixup
f.set(o, new Date(l.longValue()));
} else if (f.getType().equals(Float.class) || f.getType().equals(float.class)) {
f.set(o, l.floatValue());
} else if (f.getType().equals(Boolean.class) || f.getType().equals(boolean.class)) {
f.set(o, l == 1l);
} else if (f.getType().equals(String.class)) {
f.set(o, l.toString());
} else {
throw new RuntimeException("could not set field " + fld + ": Field has type " + f.getType().toString() + " got type " + value.getClass().toString());
}
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
if (f.getType().equals(Integer.class) || f.getType().equals(int.class)) {
f.set(o, b ? 1 : 0);
} else if (f.getType().equals(Double.class) || f.getType().equals(double.class)) {
f.set(o, b ? 1.0 : 0.0);
} else if (f.getType().equals(Float.class) || f.getType().equals(float.class)) {
f.set(o, b ? 1.0f : 0.0f);
} else if (f.getType().equals(String.class)) {
f.set(o, b ? "true" : "false");
} else {
throw new RuntimeException("could not set field " + fld + ": Field has type " + f.getType().toString() + " got type " + value.getClass().toString());
}
}
}
}
}
} catch (IllegalAccessException e) {
log.fatal("Illegal access to field " + fld + " of toype " + o.getClass().getSimpleName());
return;
}
}
@Override
public <T> T getRealObject(T o) {
if (o.getClass().getName().contains("$$EnhancerByCGLIB$$")) {
//not stored or Proxy?
try {
Field f1 = o.getClass().getDeclaredField("CGLIB$CALLBACK_0");
f1.setAccessible(true);
Object delegate = f1.get(o);
Method m = delegate.getClass().getMethod("__getDeref");
o = (T) m.invoke(delegate);
} catch (Exception e) {
//throw new RuntimeException(e);
log.error("Exception: ", e);
}
}
return o;
}
}
| [
"[email protected]"
] | |
6380d517745a9737932786091f5e4fa3f18a653d | 75df7e77934c841681da70371bff24e579e558f7 | /e-2-e/src/test/java/com/traveloka/tdd/workshop/e2etest/E2eTestApplicationTests.java | 99fe23cc5176a9a8e1ce9ae5968d0c38f472a3a7 | [] | no_license | sanjeevblr/flight-root-tdd | 7bc4e88549eb677ba704368e45432cc97861ad52 | b835ddbb0a060ddbd306c42c53919de471838ae8 | refs/heads/master | 2020-04-27T23:55:01.343866 | 2019-03-13T07:42:45 | 2019-03-13T07:42:45 | 174,796,222 | 0 | 7 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.traveloka.tdd.workshop.e2etest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class E2eTestApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
06e6f26ba04e9dfa731e6cf43a955237a87dc5fe | fa51c68440b2baae16a611fb27ce289b23859e21 | /Royal-ejb/build/generated-sources/ap-source-output/beanInfo/TbSurvey_.java | 748a5870d03659f63890dab7dd74e1da4c808c3b | [] | no_license | trongtranminh/java-student-exam | ade22d5b5fff91d08ce802b81f0de7d0be409ac9 | b2b6c4b24fdb8ed889cdc069a1fd16ec4b15adc1 | refs/heads/master | 2021-09-05T20:59:17.755360 | 2018-01-31T00:56:43 | 2018-01-31T00:56:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | package beanInfo;
import beanInfo.TbAccount;
import beanInfo.TbAssignment;
import beanInfo.TbSurveyAnswer;
import javax.annotation.Generated;
import javax.persistence.metamodel.ListAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.2.0.v20110202-r8913", date="2011-12-09T16:45:51")
@StaticMetamodel(TbSurvey.class)
public class TbSurvey_ {
public static volatile ListAttribute<TbSurvey, TbAssignment> tbAssignmentList;
public static volatile SingularAttribute<TbSurvey, Integer> surveyID;
public static volatile SingularAttribute<TbSurvey, Boolean> status;
public static volatile ListAttribute<TbSurvey, TbSurveyAnswer> tbSurveyAnswerList;
public static volatile SingularAttribute<TbSurvey, TbAccount> userName;
public static volatile SingularAttribute<TbSurvey, String> question;
} | [
"[email protected]"
] | |
bb74a22332bd03db84a4ada6e0d8d5ba1f010ddb | ba5e1b92eed48565c3ab1303083d5ba5cd1c98e4 | /alumni-framework/src/main/java/com/alumni/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java | 6e78b030feb7e53dfaf0450377027d2028623e75 | [
"MIT"
] | permissive | HodoopMan/alumni | 9c06f4b65a5f3de555fc4196ada1f3672d8c1f80 | 20bfbbdb0819eb160526c78cc3d53462ed055fa9 | refs/heads/master | 2023-09-04T18:22:59.042477 | 2021-11-10T06:37:21 | 2021-11-10T06:37:21 | 417,342,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,633 | java | package com.alumni.framework.shiro.web.filter.captcha;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.web.filter.AccessControlFilter;
import com.google.code.kaptcha.Constants;
import com.alumni.common.constant.ShiroConstants;
import com.alumni.common.utils.StringUtils;
import com.alumni.framework.util.ShiroUtils;
/**
* 验证码过滤器
*
* @author ruoyi
*/
public class CaptchaValidateFilter extends AccessControlFilter
{
/**
* 是否开启验证码
*/
private boolean captchaEnabled = true;
/**
* 验证码类型
*/
private String captchaType = "math";
public void setCaptchaEnabled(boolean captchaEnabled)
{
this.captchaEnabled = captchaEnabled;
}
public void setCaptchaType(String captchaType)
{
this.captchaType = captchaType;
}
@Override
public boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception
{
request.setAttribute(ShiroConstants.CURRENT_ENABLED, captchaEnabled);
request.setAttribute(ShiroConstants.CURRENT_TYPE, captchaType);
return super.onPreHandle(request, response, mappedValue);
}
@Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue)
throws Exception
{
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
// 验证码禁用 或不是表单提交 允许访问
if (captchaEnabled == false || !"post".equals(httpServletRequest.getMethod().toLowerCase()))
{
return true;
}
return validateResponse(httpServletRequest, httpServletRequest.getParameter(ShiroConstants.CURRENT_VALIDATECODE));
}
public boolean validateResponse(HttpServletRequest request, String validateCode)
{
Object obj = ShiroUtils.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
String code = String.valueOf(obj != null ? obj : "");
// 验证码清除,防止多次使用。
request.getSession().removeAttribute(Constants.KAPTCHA_SESSION_KEY);
if (StringUtils.isEmpty(validateCode) || !validateCode.equalsIgnoreCase(code))
{
return false;
}
return true;
}
@Override
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception
{
request.setAttribute(ShiroConstants.CURRENT_CAPTCHA, ShiroConstants.CAPTCHA_ERROR);
return true;
}
}
| [
"[email protected]"
] | |
e075a43900e0898ecdc583aed108ce41b5bb7591 | 81295def6ba0a9d93e8d8ba064c31ff4ddb25256 | /BillionPeople/app/src/main/java/com/jsyrdb/yiren/adapter/SelectTagAdapter.java | e5b8e237ac36afcb1c754944486d3930904f3385 | [] | no_license | xiaotao666/MyProject | 46d642a906b24cb5916c950a67b31750c38d1add | 9efe693f68895a3033a59056f4aa56eb1d3045f9 | refs/heads/master | 2020-07-24T14:23:48.456435 | 2019-09-12T03:20:32 | 2019-09-12T03:23:16 | 207,954,363 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,672 | java | package com.jsyrdb.yiren.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.jsyrdb.yiren.R;
import com.jsyrdb.yiren.model.Attribute;
import com.jsyrdb.yiren.model.SelectParent;
import org.w3c.dom.Text;
import java.util.List;
public class SelectTagAdapter extends BaseExpandableListAdapter {
private Context context;
private LayoutInflater inflater;
private List<Attribute.ResultBean.SelectOptionsBean> list;
public SelectTagAdapter(Context context,List<Attribute.ResultBean.SelectOptionsBean> list) {
this.context = context;
this.list = list;
inflater = LayoutInflater.from(context);
}
@Override
public int getGroupCount() {
return list.size();
}
@Override
public int getChildrenCount(int groupPosition) {
return list.get(groupPosition).getChildren().size();
}
@Override
public Object getGroup(int groupPosition) {
return list.get(groupPosition);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return list.get(groupPosition).getChildren().get(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
ViewHolderParent viewHolderParent;
if (convertView == null) {
convertView = inflater.inflate(R.layout.expand_select_parent,null);
viewHolderParent = new ViewHolderParent(convertView);
convertView.setTag(viewHolderParent);
} else {
viewHolderParent = (ViewHolderParent) convertView.getTag();
}
viewHolderParent.tv_parent.setText(list.get(groupPosition).getValue());
if (isExpanded) {
viewHolderParent.iv_expand.setImageResource(R.drawable.downarrow);
} else {
viewHolderParent.iv_expand.setImageResource(R.drawable.right_arrow);
}
return convertView;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
ViewHolderChild viewHolderChild;
if (convertView == null) {
convertView = inflater.inflate(R.layout.expand_select_child,null);
viewHolderChild = new ViewHolderChild(convertView);
convertView.setTag(viewHolderChild);
} else {
viewHolderChild = (ViewHolderChild) convertView.getTag();
}
viewHolderChild.tv_child.setText(list.get(groupPosition).getChildren().get(childPosition).getValue());
return convertView;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
public class ViewHolderParent{
TextView tv_parent;
ImageView iv_expand;
public ViewHolderParent(View view) {
tv_parent = view.findViewById(R.id.tv_parent);
iv_expand = view.findViewById(R.id.iv_expand);
}
}
public class ViewHolderChild{
TextView tv_child;
public ViewHolderChild(View view) {
tv_child = view.findViewById(R.id.tv_child);
}
}
}
| [
"[email protected]"
] | |
7bcc1a185ffc76d9551183334f7ddf9ff7f9e73f | 6fd5476a7500115040101580026ee286715f5d8b | /JSPExample/src/java/db/DB.java | e2ad4ada01174c8f6768ca7b105e2b101bdce53d | [] | no_license | weixin1998/Git | 874232e2c69cabb882e0f7c9a362ee011b0d4188 | 5065b8c0da44f4b6437dd73cd6bc4d5d6a23c71a | refs/heads/master | 2021-06-29T17:39:51.192295 | 2020-10-22T04:06:15 | 2020-10-22T04:06:15 | 178,340,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,273 | java |
package db;
import java.sql.*;
import java.util.ArrayList;
import java.util.Date;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import model.LyTable;
import model.User;
public class DB {
Connection ct;
PreparedStatement pstmt;
public DB(){
try{
Class.forName("com.mysql.jdbc.Driver");
ct=DriverManager.getConnection
("jdbc:mysql://localhost:3306/JSP","root","123456");
}catch(Exception e){
e.printStackTrace();
}
}
public User checkUser(String username,String password){
try{
pstmt=ct.prepareStatement("select * from userTable where username=?and password=?");
pstmt.setString(1,username);
pstmt.setString(2,password);
ResultSet rs=pstmt.executeQuery();
User user=new User();
while(rs.next()){
user.setId(rs.getInt(1));
user.setUsername(rs.getString(2));
user.setPassword(rs.getString(3));
return user;
}
return null;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
public ArrayList findLyInfo(){
try{
ArrayList al=new ArrayList();
pstmt=ct.prepareStatement("select * from lyTable ");
ResultSet rs=pstmt.executeQuery();
while(rs.next()){
LyTable ly=new LyTable();
ly.setId(rs.getInt(1));
ly.setUserId(rs.getInt(2));
ly.setDate(rs.getDate(3));
ly.setTitle(rs.getString(4));
ly.setContent(rs.getString(5));
al.add(ly);
}
return al;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
public String getUserName(int id){
String username=null;
try{
pstmt=ct.prepareStatement("select username from userTable where id=?");
pstmt.setInt(1,id);
ResultSet rs=pstmt.executeQuery();
while(rs.next()){
username=rs.getString(1);
}
return username;
}catch(Exception e){
e.printStackTrace();
return null;
}
}
public boolean addInfo(LyTable ly){
try{
pstmt=ct.prepareStatement("insert into lyTable (userId,date,title,content) values(?,?,?,?)");
pstmt.setInt(1,ly.getUserId());
pstmt.setDate(2,ly.getDate());
pstmt.setString(3,ly.getTitle());
pstmt.setString(4,ly.getContent());
pstmt.executeUpdate();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}
}
public boolean insertUser(String username, String pwd) {
try{
pstmt=ct.prepareStatement("insert into userTable (username,password) values(?,?)");
pstmt.setString(1, username);
pstmt.setString(2, pwd);
pstmt.executeUpdate();
return true;
}catch(Exception e){
e.printStackTrace();
return false;
}
}
}
| [
"[email protected]"
] | |
34a85c4b2ecf7d0fbce38a8894900dbc3f8d2315 | fff8d45864fdca7f43e6d65acbe4c1f469531877 | /erp_desktop_all/src_seguridad/com/bydan/erp/seguridad/presentation/swing/jinternalframes/auxiliar/PerfilAccionTableCell.java | e3dd602e2ab907e8859b3b381d09b25592608f92 | [
"Apache-2.0"
] | permissive | jarocho105/pre2 | 26b04cc91ff1dd645a6ac83966a74768f040f418 | f032fc63741b6deecdfee490e23dfa9ef1f42b4f | refs/heads/master | 2020-09-27T16:16:52.921372 | 2016-09-01T04:34:56 | 2016-09-01T04:34:56 | 67,095,806 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,865 | java | /*
*AVISO LEGAL
© Copyright
*Este programa esta protegido por la ley de derechos de autor.
*La reproduccion o distribucion ilicita de este programa o de cualquiera de
*sus partes esta penado por la ley con severas sanciones civiles y penales,
*y seran objeto de todas las sanciones legales que correspondan.
*Su contenido no puede copiarse para fines comerciales o de otras,
*ni puede mostrarse, incluso en una version modificada, en otros sitios Web.
Solo esta permitido colocar hipervinculos al sitio web.
*/
package com.bydan.erp.seguridad.presentation.swing.jinternalframes.auxiliar;
import com.bydan.erp.seguridad.business.entity.Usuario;
import com.bydan.erp.seguridad.business.entity.Opcion;
import com.bydan.erp.seguridad.business.entity.PerfilOpcion;
import com.bydan.erp.seguridad.business.entity.PerfilCampo;
import com.bydan.erp.seguridad.business.entity.PerfilAccion;
import com.bydan.erp.seguridad.business.entity.ParametroGeneralSg;
import com.bydan.erp.seguridad.business.entity.ParametroGeneralUsuario;
import com.bydan.erp.seguridad.business.entity.Modulo;
import com.bydan.erp.seguridad.business.entity.Accion;
//import com.bydan.erp.seguridad.business.entity.PerfilAccion;
import com.bydan.erp.seguridad.util.SistemaConstantesFunciones;
import com.bydan.erp.seguridad.util.SistemaConstantesFuncionesAdditional;
import com.bydan.erp.seguridad.business.logic.SistemaLogicAdditional;
import com.bydan.erp.seguridad.util.PerfilAccionConstantesFunciones;
import com.bydan.erp.seguridad.util.PerfilAccionParameterReturnGeneral;
//import com.bydan.erp.seguridad.util.PerfilAccionParameterGeneral;
import com.bydan.framework.erp.business.dataaccess.ConstantesSql;
import com.bydan.framework.erp.business.entity.Classe;
import com.bydan.framework.erp.business.entity.DatoGeneral;
import com.bydan.framework.erp.business.entity.DatoGeneralMinimo;
import com.bydan.framework.erp.business.entity.GeneralEntity;
import com.bydan.framework.erp.business.entity.Mensajes;
//import com.bydan.framework.erp.business.entity.MaintenanceType;
import com.bydan.framework.erp.util.MaintenanceType;
import com.bydan.framework.erp.util.FuncionesReporte;
import com.bydan.framework.erp.business.logic.DatosCliente;
import com.bydan.framework.erp.business.logic.Pagination;
import com.bydan.erp.seguridad.presentation.swing.jinternalframes.PerfilAccionBeanSwingJInternalFrame;
import com.bydan.framework.erp.presentation.desktop.swing.TablaGeneralTotalModel;
import com.bydan.framework.erp.presentation.desktop.swing.DateConverter;
import com.bydan.framework.erp.presentation.desktop.swing.DateConverterFromDate;
import com.bydan.framework.erp.presentation.desktop.swing.DateRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.DateEditorRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.BooleanRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.BooleanEditorRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.TextFieldRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.*;
//import com.bydan.framework.erp.presentation.desktop.swing.TextFieldEditorRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.HeaderRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.JInternalFrameBase;
import com.bydan.framework.erp.presentation.desktop.swing.FuncionesSwing;
import com.bydan.framework.erp.presentation.desktop.swing.MainJFrame;
import com.bydan.framework.erp.resources.imagenes.AuxiliarImagenes;
import com.bydan.erp.seguridad.resources.reportes.AuxiliarReportes;
import com.bydan.erp.seguridad.util.*;
import com.bydan.erp.seguridad.business.logic.*;
//EJB
//PARAMETROS
//EJB PARAMETROS
import com.bydan.framework.erp.business.logic.*;
import com.bydan.framework.erp.util.*;
import com.bydan.erp.seguridad.business.entity.*;
//import com.bydan.framework.erp.business.entity.ConexionBeanFace;
//import com.bydan.framework.erp.business.entity.Mensajes;
import java.net.NetworkInterface;
import java.net.InterfaceAddress;
import java.net.InetAddress;
import javax.naming.InitialContext;
import java.lang.Long;
import java.util.Date;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;
import java.io.Serializable;
import java.util.Hashtable;
import java.io.File;
import java.io.FileInputStream;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;
import java.io.PrintWriter;
import java.sql.SQLException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.stream.StreamSource;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.w3c.dom.Document;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.data.JRBeanArrayDataSource;
import net.sf.jasperreports.view.JasperViewer;
import org.apache.log4j.Logger;
import com.bydan.framework.erp.business.entity.Reporte;
//VALIDACION
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.export.JExcelApiExporter;
import net.sf.jasperreports.engine.export.JRCsvExporter;
import net.sf.jasperreports.engine.export.JRRtfExporter;
import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
import net.sf.jasperreports.engine.util.JRSaver;
import net.sf.jasperreports.engine.xml.JRXmlWriter;
import com.bydan.erp.seguridad.presentation.web.jsf.sessionbean.*;
import com.bydan.erp.seguridad.presentation.swing.jinternalframes.PerfilAccionJInternalFrame;
import com.bydan.erp.seguridad.presentation.swing.jinternalframes.PerfilAccionDetalleFormJInternalFrame;
import java.util.EventObject;
import java.util.EventListener;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.event.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
import java.awt.event.*;
import org.jdesktop.beansbinding.Binding.SyncFailure;
import org.jdesktop.beansbinding.BindingListener;
import org.jdesktop.beansbinding.Bindings;
import org.jdesktop.beansbinding.BeanProperty;
import org.jdesktop.beansbinding.ELProperty;
import org.jdesktop.beansbinding.AutoBinding.UpdateStrategy;
import org.jdesktop.beansbinding.PropertyStateEvent;
import org.jdesktop.swingbinding.JComboBoxBinding;
import org.jdesktop.swingbinding.SwingBindings;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
@SuppressWarnings("unused")
public class PerfilAccionTableCell extends DefaultCellEditor implements TableCellRenderer {
private static final long serialVersionUID = 1L;
//PARA TABLECELL_FK
public JInternalFrameBase jInternalFrameBase;
protected JLabel jLabelPerfilAccion=new JLabelMe();
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxPerfilAccion=new JComboBoxMe();
protected Object valor=new Object();
protected List<PerfilAccion> perfilaccionsForeignKey=new ArrayList<PerfilAccion>();
protected List<PerfilAccion> perfilaccionsForeignKeyActual=new ArrayList<PerfilAccion>();
protected Border borderResaltarPerfilAccion=null;
protected Boolean conEnabled=true;
protected Integer iTotalRow=0;
protected Boolean conHotKeys=false;
protected String sNombreHotKeyAbstractAction="";
protected String sTipoBusqueda="NINGUNO";
protected Integer rowActual=-1;
protected ArrayList<Classe> classes;
//PARA TABLECELL_FK_FIN
//PARA TABLECELL
public String sTipo="FK"; //"BOTON"
protected JButton jButtonPerfilAccion;
//PARA TABLECELL FIN
//PARA TABLECELL_FK
public PerfilAccionTableCell() {
super(new JCheckBoxMe());
}
public PerfilAccionTableCell(JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(new JCheckBoxMe());
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public PerfilAccionTableCell(JInternalFrameBase jInternalFrameBase) {
this(jInternalFrameBase,true);
}
public PerfilAccionTableCell(JCheckBox checkBox,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(checkBox);
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public PerfilAccionTableCell(JCheckBox checkBox,JInternalFrameBase jInternalFrameBase) {
this(checkBox,jInternalFrameBase,true);
}
@SuppressWarnings("rawtypes")
public PerfilAccionTableCell(JComboBox jcComboBox,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(jcComboBox);
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.jComboBoxPerfilAccion=jcComboBox;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
@SuppressWarnings("rawtypes")
public PerfilAccionTableCell(JComboBox jcComboBox,JInternalFrameBase jInternalFrameBase) {
this(jcComboBox,jInternalFrameBase,true);
}
public PerfilAccionTableCell(List<PerfilAccion> perfilaccionsForeignKey,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(new JCheckBoxMe());
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.perfilaccionsForeignKey=perfilaccionsForeignKey;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public PerfilAccionTableCell(List<PerfilAccion> perfilaccionsForeignKey,JInternalFrameBase jInternalFrameBase) {
this(perfilaccionsForeignKey,jInternalFrameBase,true);
}
public PerfilAccionTableCell(List<PerfilAccion> perfilaccionsForeignKey,Border borderResaltarPerfilAccion,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(new JCheckBoxMe());
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.perfilaccionsForeignKey=perfilaccionsForeignKey;
this.borderResaltarPerfilAccion=borderResaltarPerfilAccion;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public PerfilAccionTableCell(List<PerfilAccion> perfilaccionsForeignKey,Border borderResaltarPerfilAccion,JInternalFrameBase jInternalFrameBase,Boolean conEnabled,Integer iTotalRow) {
super(new JCheckBoxMe());
this.iTotalRow=iTotalRow;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.perfilaccionsForeignKey=perfilaccionsForeignKey;
this.borderResaltarPerfilAccion=borderResaltarPerfilAccion;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public PerfilAccionTableCell(List<PerfilAccion> perfilaccionsForeignKey,Border borderResaltar,JInternalFrameBase jInternalFrameBase) {
this(perfilaccionsForeignKey,borderResaltar,jInternalFrameBase,true);
}
public PerfilAccionTableCell(List<PerfilAccion> perfilaccionsForeignKey,Border borderResaltarPerfilAccion,JInternalFrameBase jInternalFrameBase,Boolean conEnabled,Boolean conHotKeys,String sNombreHotKeyAbstractAction,String sTipoBusqueda) {
super(new JCheckBoxMe());
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=conHotKeys;
this.sNombreHotKeyAbstractAction=sNombreHotKeyAbstractAction;
this.sTipoBusqueda=sTipoBusqueda;
this.rowActual=-1;
this.perfilaccionsForeignKey=perfilaccionsForeignKey;
this.borderResaltarPerfilAccion=borderResaltarPerfilAccion;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
//PARA TABLECELL_FK_FIN
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
Component component=new JCheckBoxMe();
if(sTipo=="FK") {
component=this.getTableCellRendererComponentParaTableCellFk(table,value,isSelected,hasFocus,row,column);
} else if(sTipo=="BOTON") {
component=this.getTableCellRendererComponentParaTableCell(table,value,isSelected,hasFocus,row,column);
}
return component;
}
public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int column) {
Component component=new JCheckBoxMe();
if(sTipo=="FK") {
component=this.getTableCellEditorComponentParaTableCellFk(table,value,isSelected,row,column);
} else if(sTipo=="BOTON") {
component=this.getTableCellEditorComponentParaTableCell(table,value,isSelected,row,column);
}
return component;
}
public Component getTableCellRendererComponentParaTableCellFk(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
try{
int intSelectedRow = row;
//ARCHITECTURE
/*
if(Constantes.ISUSAEJBLOGICLAYER) {
perfil =(Perfil) perfilLogic.getPerfils().toArray()[table.convertRowIndexToModel(intSelectedRow)];
} else if(Constantes.ISUSAEJBREMOTE) {
perfil =(Perfil) perfils.toArray()[table.convertRowIndexToModel(intSelectedRow)];
}
*/
//ARCHITECTURE
jLabelPerfilAccion=new JLabelMe();
/*
if(perfil.getIsChanged()) {
perfil.setsistema_descripcion((getActualSistemaForeignKeyDescripcion((Long)value)));
}
*/
String sPerfilAccionDescripcion="";
sPerfilAccionDescripcion=jInternalFrameBase.getDescripcionFk("PerfilAccion",table,value,intSelectedRow);
jLabelPerfilAccion.setText(sPerfilAccionDescripcion);
if(this.borderResaltarPerfilAccion!=null) {
jLabelPerfilAccion.setBorder(this.borderResaltarPerfilAccion);
}
jLabelPerfilAccion.setOpaque(true);
//if(row!=(this.iTotalRow-1)) {
if((this.jInternalFrameBase.conTotales && row != table.getRowCount()-1) || !this.jInternalFrameBase.conTotales) {
jLabelPerfilAccion.setBackground(row % 2 == 0 ? FuncionesSwing.getColorTextFields(Constantes2.S_FONDOCONTROL_COLOR) : Funciones2.getColorFilaTabla2());
} else {
jLabelPerfilAccion.setBackground(Funciones2.getColorFilaTablaTotales());
}
if(isSelected) {
jLabelPerfilAccion.setForeground(FuncionesSwing.getColorSelectedForeground());
}
} catch(Exception e) {
;
}
this.jLabelPerfilAccion.setEnabled(this.conEnabled);
FuncionesSwing.setBoldLabel(this.jLabelPerfilAccion, this.jInternalFrameBase.getsTipoTamanioGeneralTabla(),true,false,this.jInternalFrameBase);
return this.jLabelPerfilAccion;
}
@SuppressWarnings({"unchecked" })
public Component getTableCellEditorComponentParaTableCellFk(JTable table,Object value,boolean isSelected,int row,int column) {
this.jComboBoxPerfilAccion=new JComboBoxMe();
try{
int intSelectedRow = row;
//ARCHITECTURE
/*
if(Constantes.ISUSAEJBLOGICLAYER) {
perfil =(Perfil) perfilLogic.getPerfils().toArray()[table.convertRowIndexToModel(intSelectedRow)];
} else if(Constantes.ISUSAEJBREMOTE) {
perfil =(Perfil) perfils.toArray()[table.convertRowIndexToModel(intSelectedRow)];
}
*/
//ARCHITECTURE
if(!PerfilAccionJInternalFrame.ISBINDING_MANUAL) {
} else {
this.jComboBoxPerfilAccion.removeAllItems();
//SIEMPRE <0 , NO USADO POR EL MOMENTO
//COMBO DE FILA ACTUAL SE ACTUALIZA, LOS DEMAS USAN EL ANTERIOR COMBO
if(this.rowActual<0 || (this.rowActual>=0 && this.rowActual!=row)) {
for(PerfilAccion perfilaccion:this.perfilaccionsForeignKey) {
this.jComboBoxPerfilAccion.addItem(perfilaccion);
}
} else {
if(this.rowActual==row && row>=0) {
for(PerfilAccion perfilaccion:this.perfilaccionsForeignKeyActual) {
this.jComboBoxPerfilAccion.addItem(perfilaccion);
}
}
}
}
//this.jComboBoxPerfilAccion.setSelectedItem(perfil.getPerfilAccion());
//setActualPerfilAccionForeignKey((Long)value,false,"Formulario");
PerfilAccionBeanSwingJInternalFrame.setActualComboBoxPerfilAccionGenerico((Long)value,this.jComboBoxPerfilAccion,this.perfilaccionsForeignKey);
if(this.conHotKeys) {
PerfilAccionBeanSwingJInternalFrame.setHotKeysComboBoxPerfilAccionGenerico(this.jComboBoxPerfilAccion,this.jInternalFrameBase,this.sNombreHotKeyAbstractAction,this.sTipoBusqueda);
}
//NO_FUNCIONA_perfil.setsistema_descripcion(getActualPerfilAccionForeignKeyDescripcion((Long)value));
valor=value;
this.jComboBoxPerfilAccion.setOpaque(true);
} catch(Exception e) {
e.printStackTrace();
}
this.jComboBoxPerfilAccion.setEnabled(this.conEnabled);
FuncionesSwing.setBoldComboBox(this.jComboBoxPerfilAccion, this.jInternalFrameBase.getsTipoTamanioGeneralTabla(),true,false,this.jInternalFrameBase);
return this.jComboBoxPerfilAccion;
}
public Component getTableCellRendererComponentParaTableCell(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
jButtonPerfilAccion =new JButtonMe((row+1)+"-Perfil Accion");
jButtonPerfilAccion.setToolTipText((row+1)+"-Perfil Accion");
if(this.borderResaltarPerfilAccion!=null) {
jButtonPerfilAccion.setBorder(this.borderResaltarPerfilAccion);
}
jButtonPerfilAccion.setOpaque(true);
jButtonPerfilAccion.setBackground(row % 2 == 0 ? FuncionesSwing.getColorTextFields(Constantes2.S_FONDOCONTROL_COLOR) : Funciones2.getColorFilaTabla2());
if(isSelected) {
jButtonPerfilAccion.setForeground(FuncionesSwing.getColorSelectedForeground());
}
this.jButtonPerfilAccion.setEnabled(this.conEnabled);
return jButtonPerfilAccion;
}
public Component getTableCellEditorComponentParaTableCell(JTable table,Object value,boolean isSelected,final int row,int column) {
jButtonPerfilAccion=new JButtonMe((row+1)+"-Perfil Accion");
jButtonPerfilAccion.setToolTipText((row+1)+"-Perfil Accion");
if(this.borderResaltarPerfilAccion!=null) {
jButtonPerfilAccion.setBorder(this.borderResaltarPerfilAccion);
}
/*
jButtonPerfilAccion.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
//jButtonPerfilAccionActionPerformed(evt,row,true,false);
jInternalFrameBase.jButtonRelacionActionPerformed("PerfilAccion",evt,row,true,false);
}
}
);
*/
this.jButtonPerfilAccion.addActionListener(new ButtonActionListener(this.jInternalFrameBase,"TableCell","PerfilAccion",row));
valor=value;
this.jButtonPerfilAccion.setEnabled(this.conEnabled);
return jButtonPerfilAccion;
}
public PerfilAccionTableCell(Border borderResaltarPerfilAccion,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(new JCheckBoxMe());
this.conEnabled=conEnabled;
this.jInternalFrameBase=jInternalFrameBase;
this.borderResaltarPerfilAccion=borderResaltarPerfilAccion;
this.sTipo="BOTON";
}
public PerfilAccionTableCell(Border borderResaltarPerfilAccion,JInternalFrameBase jInternalFrameBase) {
this(borderResaltarPerfilAccion,jInternalFrameBase,true);
}
public Object getCellEditorValue() {
Object value=new Object();
Long idActual=0L;
if(sTipo=="FK") {
PerfilAccion perfilaccion=((PerfilAccion)this.jComboBoxPerfilAccion.getSelectedItem());
if(perfilaccion!=null) {
idActual=perfilaccion.getId();
}
value=idActual;
} else if(sTipo=="BOTON") {
value=valor;
}
return value;
}
public boolean stopCellEditing() {
fireEditingStopped();
return true;
}
public Integer getRowActual() {
return this.rowActual;
}
public void setRowActual(Integer rowActual) {
this.rowActual = rowActual;
}
public Boolean getConEnabled() {
return this.conEnabled;
}
public void setConEnabled(Boolean conEnabled) {
this.conEnabled = conEnabled;
}
public Boolean getConHotKeys() {
return this.conHotKeys;
}
public void setConHotKeys(Boolean conHotKeys) {
this.conHotKeys = conHotKeys;
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxPerfilAccion() {
return this.jComboBoxPerfilAccion;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxPerfilAccion(JComboBox jComboBoxPerfilAccion) {
this.jComboBoxPerfilAccion = jComboBoxPerfilAccion;
}
public List<PerfilAccion> getperfilaccionsForeignKey() {
return this.perfilaccionsForeignKey;
}
public void setperfilaccionsForeignKey(List<PerfilAccion> perfilaccionsForeignKey) {
this.perfilaccionsForeignKey = perfilaccionsForeignKey;
}
public List<PerfilAccion> getperfilaccionsForeignKeyActual() {
return this.perfilaccionsForeignKeyActual;
}
public void setperfilaccionsForeignKeyActual(List<PerfilAccion> perfilaccionsForeignKeyActual) {
this.perfilaccionsForeignKeyActual = perfilaccionsForeignKeyActual;
}
@SuppressWarnings("unchecked")
public void RecargarPerfilAccionsForeignKey() {
this.jComboBoxPerfilAccion.removeAllItems();
//SIEMPRE <0 , NO USADO POR EL MOMENTO
//COMBO DE FILA ACTUAL SE ACTUALIZA, LOS DEMAS USAN EL ANTERIOR COMBO
if(this.rowActual<0) {
for(PerfilAccion perfilaccion:this.perfilaccionsForeignKey) {
this.jComboBoxPerfilAccion.addItem(perfilaccion);
}
} else {
for(PerfilAccion perfilaccion:this.perfilaccionsForeignKeyActual) {
this.jComboBoxPerfilAccion.addItem(perfilaccion);
}
}
}
}
| [
"[email protected]"
] | |
ff12be191fd1fdf1242108072285922e2bcb6c1a | 833a0ef2f4121acbb6a23481e117468a65d2dc3c | /SimpleJavaApp/src/org/co/main/Main.java | 937f01b225ce966990bdd961f65348398c8c7680 | [] | no_license | cesarurrea/simplejavaapp | 7f5dcdf5a2aa1e4e5d993e3496d9449bfc87ab34 | 762b4d470e63191db6adbaf5c21bf0e122a7ae55 | refs/heads/master | 2021-05-12T02:18:57.974226 | 2018-01-15T19:20:51 | 2018-01-15T19:20:51 | 117,584,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package org.co.main;
public class Main {
public static void main(String[] args) {
SalesData data = new SalesData();
displayGreeting();
data.display();
}
private static void displayGreeting() {
System.out.println("HELLO HAPPY SALES PEOPLE!");
System.out.println("THIS APP SHOWS SALES DATA");
System.out.println("Comentario simple");
}
}
| [
"[email protected]"
] | |
bd2346b348bb483ee791769b263e3648781f1ba6 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.horizon-Horizon/sources/com/oculus/horizon/service_media/AbuseCaptureProviderMethodAutoProvider.java | 36df3f0a05335a4cfb0ee35ef3798fe1f21eff31 | [] | no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 448 | java | package com.oculus.horizon.service_media;
import X.AnonymousClass0J3;
import X.AnonymousClass117;
import com.facebook.annotations.Generated;
import com.oculus.horizon.abuse_prevention.interfaces.AbuseCaptureProvider;
@Generated({"By: InjectorProcessor"})
public class AbuseCaptureProviderMethodAutoProvider extends AnonymousClass0J3<AbuseCaptureProvider> {
public final Object get() {
return AnonymousClass117.A00(525, this);
}
}
| [
"[email protected]"
] | |
ebdd6cbe07ffcc489c424965b42ae39b6b9d54db | 18c7a3372d4d6d179296b922fc8605915978f84b | /src/principal/Main.java | cedd88e7ddcedc43e925721c26f2d93ffe6910b0 | [] | no_license | alpimdenise/Treinamento | 1a8211e9617445794092f08e259ca7cbab99e6e4 | bc89cdc192253df2dba5a5373f85ba8703fe5cf9 | refs/heads/main | 2023-04-12T13:47:01.292291 | 2021-05-19T00:10:24 | 2021-05-19T00:10:24 | 368,697,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,931 | java | package principal;
//import com.googlecode.lanterna.TextColor;
public class Main {
public static void main(String[] args) { // ORIGEM (5,1) CO (4,2)
//Eixo X ->123456789
// 1 XX
// 2 XX
// 3
// 4
// 5
// 6
// 7
// CANTO OPOSTO VALIDO:
// O VALOR DO CANTO OPOSTO, DEVE SER MAIOR OU IGUAL AO X DA ORIGEM O K VIER APOS N IMPORTA
//CANTO OPOSTO INVALIDO:
// O VALOR DO CANTO OPOSTO, DEVE ser MENOR QUE O X DA ORIGEM, O K VIER APOS N IMPORTA
//OBS: PARA Y FUNCIONA DE FORMA ANALOGA
Pantera pantera = new Pantera();
pantera.setNome("Pantico");
// pantera.imprimirNomeDoAnimal();
// pantera.rugido();
// pantera.dormir();
//
// pantera.cor = "Brown";
// System.out.println(pantera.cor);
Tigre tigre = new Tigre();
tigre.setNome("Taylor");
// tigre.imprimirNomeDoAnimal();
// tigre.dormir();
//
// tigre.cor = "Gray"; // variavel que defini a cor
// tigre.imprimirCor();
Zoologico zoo = new Zoologico();
zoo.setMacaco(tigre);
zoo.getMacaco().imprimirNomeDoAnimal();
// zoo.macaco.imprimirNomeDoAnimal();
zoo.getMacaco().setCor("orange");
//zoo.macaco.cor = "orange"; // defini a cor / atribui
zoo.getMacaco().imprimirCor();
//zoo.macaco.imprimirCor();
zoo.getMacaco().dormir();
//zoo.macaco.dormir();
zoo.setPantera(pantera);
//zoo.pantera = pantera;
zoo.getPantera().imprimirNomeDoAnimal();
//zoo.pantera.imprimirNomeDoAnimal();
zoo.getPantera().setNome("B");
//zoo.pantera.nome = "Z"; // nao imprimiu o z pq nao dei o comando de imprimir system
zoo.getPantera().imprimirNomeDoAnimal();
// pantera.corTerminal = TextColor.ANSI.WHITE;
// int quantidade = 5;
//
// for (int i = 0; i < quantidade; i++) {
//
// System.out.println(i);
// // conteudo
// System.out.println("Denise");
//
// }
}
}
| [
"denye@LAPTOP-NM63A4EO"
] | denye@LAPTOP-NM63A4EO |
61f75e14e7d15c001ed13c1997e4b1d71bcce8e6 | 047b2883672a8179ed721c9b8fa2d0f4f0bd3d7f | /src/main/java/com/yfyk/entity/CommunityExample.java | a63f5183f992ddbc1d5082eb3f6425f11e0e5546 | [] | no_license | yanfeng918/yfykMs | d170088636b1aa70276065c44ea4b290198c2987 | 83a5c35b42cafeab55709ef5e1db6f8ab1a7f1d6 | refs/heads/master | 2021-01-19T06:47:58.172983 | 2016-09-28T07:04:39 | 2016-09-28T07:04:39 | 60,845,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,343 | java | package com.yfyk.entity;
import java.util.ArrayList;
import java.util.List;
public class CommunityExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table t_community
*
* @mbggenerated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table t_community
*
* @mbggenerated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table t_community
*
* @mbggenerated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public CommunityExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_community
*
* @mbggenerated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table t_community
*
* @mbggenerated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andAddressIsNull() {
addCriterion("address is null");
return (Criteria) this;
}
public Criteria andAddressIsNotNull() {
addCriterion("address is not null");
return (Criteria) this;
}
public Criteria andAddressEqualTo(String value) {
addCriterion("address =", value, "address");
return (Criteria) this;
}
public Criteria andAddressNotEqualTo(String value) {
addCriterion("address <>", value, "address");
return (Criteria) this;
}
public Criteria andAddressGreaterThan(String value) {
addCriterion("address >", value, "address");
return (Criteria) this;
}
public Criteria andAddressGreaterThanOrEqualTo(String value) {
addCriterion("address >=", value, "address");
return (Criteria) this;
}
public Criteria andAddressLessThan(String value) {
addCriterion("address <", value, "address");
return (Criteria) this;
}
public Criteria andAddressLessThanOrEqualTo(String value) {
addCriterion("address <=", value, "address");
return (Criteria) this;
}
public Criteria andAddressLike(String value) {
addCriterion("address like", value, "address");
return (Criteria) this;
}
public Criteria andAddressNotLike(String value) {
addCriterion("address not like", value, "address");
return (Criteria) this;
}
public Criteria andAddressIn(List<String> values) {
addCriterion("address in", values, "address");
return (Criteria) this;
}
public Criteria andAddressNotIn(List<String> values) {
addCriterion("address not in", values, "address");
return (Criteria) this;
}
public Criteria andAddressBetween(String value1, String value2) {
addCriterion("address between", value1, value2, "address");
return (Criteria) this;
}
public Criteria andAddressNotBetween(String value1, String value2) {
addCriterion("address not between", value1, value2, "address");
return (Criteria) this;
}
public Criteria andAreaIdIsNull() {
addCriterion("area_id is null");
return (Criteria) this;
}
public Criteria andAreaIdIsNotNull() {
addCriterion("area_id is not null");
return (Criteria) this;
}
public Criteria andAreaIdEqualTo(Integer value) {
addCriterion("area_id =", value, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdNotEqualTo(Integer value) {
addCriterion("area_id <>", value, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdGreaterThan(Integer value) {
addCriterion("area_id >", value, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdGreaterThanOrEqualTo(Integer value) {
addCriterion("area_id >=", value, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdLessThan(Integer value) {
addCriterion("area_id <", value, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdLessThanOrEqualTo(Integer value) {
addCriterion("area_id <=", value, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdIn(List<Integer> values) {
addCriterion("area_id in", values, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdNotIn(List<Integer> values) {
addCriterion("area_id not in", values, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdBetween(Integer value1, Integer value2) {
addCriterion("area_id between", value1, value2, "areaId");
return (Criteria) this;
}
public Criteria andAreaIdNotBetween(Integer value1, Integer value2) {
addCriterion("area_id not between", value1, value2, "areaId");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table t_community
*
* @mbggenerated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table t_community
*
* @mbggenerated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
396ef937e5535d704cc67e3934275d8db7d6a543 | b4c6a01eafb7d78e9058e9aefdb3197028e28a1d | /treeviewlib/src/androidTest/java/com/finchina/treeviewlib/ExampleInstrumentedTest.java | 9058dc4d7e8abc0b7b7f6a6c012e1807380c8dbd | [] | no_license | xing16/TreeView | 627e2d081b625aa08321cfddab70a061b66b6cfe | 7916a168ec381117874d1b5b2f6aa94462b5b90f | refs/heads/master | 2023-06-16T10:19:21.559325 | 2021-07-23T11:04:48 | 2021-07-23T11:04:48 | 388,772,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.finchina.treeviewlib;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.finchina.treeviewlib.test", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
b1b8ac85307d76c73b8795d598ef186038b80f51 | 1dd39d3bec933dad2a09cf24074f03ebd8776be1 | /message/src/main/java/com/github/bwsoft/iris/message/sbe/fixsbe/GroupType.java | 46f4bc0e606e661b902b4ab2998fcd58816397bb | [
"Apache-2.0"
] | permissive | bwsoft/iris | 1608894cbd3b35831f8dc2d08ca34a4969bc7920 | 75b0d5e870341b66406430d0e550d7d9ce7cde9d | refs/heads/master | 2020-04-17T01:54:01.969766 | 2017-02-08T01:30:52 | 2017-02-08T01:30:52 | 45,565,047 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,972 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.12.29 at 08:51:30 PM CST
//
package com.github.bwsoft.iris.message.sbe.fixsbe;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
*
* A repeating group contains an array of entries
*
*
* <p>Java class for groupType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="groupType">
* <complexContent>
* <extension base="{http://fixprotocol.io/2016/sbe}blockType">
* <attribute name="dimensionType" type="{http://fixprotocol.io/2016/sbe}symbolicName_t" default="groupSizeEncoding" />
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "groupType")
public class GroupType
extends BlockType
{
@XmlAttribute(name = "dimensionType")
protected String dimensionType;
/**
* Gets the value of the dimensionType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDimensionType() {
if (dimensionType == null) {
return "groupSizeEncoding";
} else {
return dimensionType;
}
}
/**
* Sets the value of the dimensionType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDimensionType(String value) {
this.dimensionType = value;
}
}
| [
"[email protected]"
] | |
da0aecda9620178f4505274bcb0adb1ccfe6dca6 | 0ac05e3da06d78292fdfb64141ead86ff6ca038f | /OSWE/oswe/openCRX/rtjar/rt.jar.src/com/sun/corba/se/spi/activation/LocatorOperations.java | 309ec283bdb5dbbc6e8612ba6f9606b423b3c50b | [] | no_license | qoo7972365/timmy | 31581cdcbb8858ac19a8bb7b773441a68b6c390a | 2fc8baba4f53d38dfe9c2b3afd89dcf87cbef578 | refs/heads/master | 2023-07-26T12:26:35.266587 | 2023-07-17T12:35:19 | 2023-07-17T12:35:19 | 353,889,195 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package com.sun.corba.se.spi.activation;
import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation;
import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB;
public interface LocatorOperations {
ServerLocation locateServer(int paramInt, String paramString) throws NoSuchEndPoint, ServerNotRegistered, ServerHeldDown;
ServerLocationPerORB locateServerForORB(int paramInt, String paramString) throws InvalidORBid, ServerNotRegistered, ServerHeldDown;
int getEndpoint(String paramString) throws NoSuchEndPoint;
int getServerPortForType(ServerLocationPerORB paramServerLocationPerORB, String paramString) throws NoSuchEndPoint;
}
/* Location: /Users/timmy/timmy/OSWE/oswe/openCRX/rt.jar!/com/sun/corba/se/spi/activation/LocatorOperations.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | [
"t0984456716"
] | t0984456716 |
7ac2066698ae45628e73cf9f6d0b5b4a1ccc1e4b | adbae4c05380070251129494608b9fb73bbd949c | /src/com/practies/RedbusTest.java | dd5bdb0695d6b96c635efe56e651759659975362 | [] | no_license | Seleniumvasu9pm/vasu | 862b001ab52ea79d037d70dd84fe8e784575a42d | 4e734ace9f2c2f74741a8b3f0313e89b46b64e8a | refs/heads/master | 2020-03-18T10:00:18.159150 | 2018-05-23T15:41:28 | 2018-05-23T15:41:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 681 | java | package com.practies;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class RedbusTest {
public static void main(String[] args) throws Exception
{
FirefoxDriver driver=new FirefoxDriver();
driver.get("Http://Redbus.in");
driver.manage().window().maximize();
driver.findElement(By.xpath(".//*[@id='src']")).sendKeys("H");
Thread.sleep(2000);
List<WebElement> city=driver.findElements(By.xpath(".//*[@id='search']/div/div[1]/div/ul/li"));
System.out.println(city.size());
for(WebElement element:city)
{
System.out.println(element.getText());
}
}
}
| [
"[email protected]"
] | |
b81c9ee0cf97b78ce4d0d545c3afb52daf03d69c | bd7b5d95c3bac79ba8219410a9523ee77da2d590 | /53-todo-list/src/test/java/com/example/HttpVerticleTests.java | 9b996fd7fb27f44f346ca4255a1f09e2b9c77c7f | [] | no_license | jamesdschmidt/exercises-for-programmers | 2945200b388607d85827f6c76c89172114abdca3 | 67d775a06e44440240cf58ed73f18dd9df3e5a45 | refs/heads/main | 2023-04-07T06:42:23.221582 | 2022-09-16T14:51:37 | 2022-09-16T14:51:37 | 97,868,919 | 3 | 2 | null | 2023-03-31T15:24:43 | 2017-07-20T18:58:07 | Java | UTF-8 | Java | false | false | 1,917 | java | package com.example;
import io.vertx.core.MultiMap;
import io.vertx.core.Vertx;
import io.vertx.ext.web.client.WebClient;
import io.vertx.junit5.VertxExtension;
import io.vertx.junit5.VertxTestContext;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ExtendWith(VertxExtension.class)
public class HttpVerticleTests {
@BeforeEach
public void setUp(Vertx vertx, VertxTestContext context) {
vertx.deployVerticle(new HttpVerticle(), context.succeeding(id -> context.completeNow()));
}
@Test
public void testIndex(Vertx vertx, VertxTestContext context) {
WebClient.create(vertx)
.get(8080, "localhost", "/")
.send(handler -> {
if (handler.succeeded()) {
context.completeNow();
} else {
context.failed();
}
});
}
@Test
public void testCreate(Vertx vertx, VertxTestContext context) {
var form = MultiMap.caseInsensitiveMultiMap();
form.set("todo", "Buy milk");
WebClient.create(vertx)
.post(8080, "localhost", "/")
.sendForm(form, handler -> {
if (handler.succeeded()) {
context.completeNow();
} else {
context.failed();
}
});
}
@Test
public void testDelete(Vertx vertx, VertxTestContext context) {
var form = MultiMap.caseInsensitiveMultiMap();
form.set("todo", "Buy milk");
WebClient.create(vertx)
.post(8080, "localhost", "/")
.sendForm(form, handler -> {
if (handler.succeeded()) {
WebClient.create(vertx)
.post(8080, "localhost", "/0/delete")
.send(result -> {
if (result.succeeded()) {
context.completeNow();
} else {
context.failed();
}
});
} else {
context.failed();
}
});
}
}
| [
"[email protected]"
] | |
0b822aa85f38942ce27b03061c94c3ebb00a4715 | fbeecb99d4afe5b4ddf3c77596ba2b2c3ee12e48 | /Errori7/src/errori7/SommaDueNumeri.java | 7b0400d47efcaa11153d59a050c55a0aaaa0480f | [] | no_license | MngMrn/TrovaErrore | 1931beba5cdcd818fa480198878881b71a85aac4 | 9aef74dfa2ba034a28dd7c746c7f4264e5e89f6f | refs/heads/master | 2020-06-27T23:27:47.978150 | 2019-08-01T16:06:13 | 2019-08-01T16:06:13 | 200,081,010 | 0 | 1 | null | null | null | null | ISO-8859-1 | Java | false | false | 598 | java | package errori7;
public class SommaDueNumeri {
public static void main(String[] args) {
System.out.print("Questo programma somma due numeri.");//Ho chiuso i doppi apici e sostituo la virgola con un punto e virgola
double i = 185;//Bisognava dare un tipo alla variabile i
double j = 1936.27;//Ho cambiato il tipo della variabile j da int a double poichè il numero ha una virgola
System.out.print("La somma di "+i+" e "+j+" e': ");
double somma = i+j;//Per stampare la somma ho crato una variabile dove ho fatto la somma delle due variabili
System.out.println(somma);
}
}
| [
"[email protected]"
] | |
1ad22f9e3e44154cf260a792f636ac38c99fbd14 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_4be6542867c6f2cebef646e1e26b2b8068335aca/MavenEmbedder/9_4be6542867c6f2cebef646e1e26b2b8068335aca_MavenEmbedder_t.java | 6eef7d5c34088bfaeb512544e35d56fd3564b0a4 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 18,649 | java | package org.apache.maven.embedder;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.maven.Maven;
import org.apache.maven.MavenTools;
import org.apache.maven.SettingsConfigurationException;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.embedder.execution.MavenExecutionRequestDefaultsPopulator;
import org.apache.maven.execution.DefaultMavenExecutionResult;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.lifecycle.LifecycleExecutor;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
import org.apache.maven.profiles.DefaultProfileManager;
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.reactor.MavenExecutionException;
import org.apache.maven.settings.Settings;
import org.apache.maven.wagon.events.TransferListener;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusContainerException;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.repository.ComponentDescriptor;
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Class intended to be used by clients who wish to embed Maven into their applications
*
* @author Jason van Zyl
*/
public class MavenEmbedder
{
private PlexusContainer container;
// ----------------------------------------------------------------------
// Components
// ----------------------------------------------------------------------
private MavenProjectBuilder mavenProjectBuilder;
private MavenXpp3Reader modelReader;
private MavenXpp3Writer modelWriter;
private ProfileManager profileManager;
private PluginDescriptorBuilder pluginDescriptorBuilder;
private ArtifactRepositoryFactory artifactRepositoryFactory;
private ArtifactFactory artifactFactory;
private ArtifactResolver artifactResolver;
private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
private Maven maven;
private MavenTools mavenTools;
private MavenExecutionRequestDefaultsPopulator defaultsPopulator;
// ----------------------------------------------------------------------
// Configuration
// ----------------------------------------------------------------------
private Settings settings;
private ArtifactRepository localRepository;
private ClassWorld classWorld;
private ClassRealm realm;
private MavenEmbedderLogger logger;
// ----------------------------------------------------------------------
// User options
// ----------------------------------------------------------------------
private MavenEmbedRequest embedderRequest;
// ----------------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------------
public MavenEmbedder( ClassWorld classWorld )
throws MavenEmbedderException
{
this( classWorld, null );
}
public MavenEmbedder( ClassWorld classWorld,
MavenEmbedderLogger logger )
throws MavenEmbedderException
{
this.classWorld = classWorld;
this.logger = logger;
start();
}
public MavenEmbedder( ClassLoader classLoader )
throws MavenEmbedderException
{
this( classLoader, null );
}
public MavenEmbedder( ClassLoader classLoader,
MavenEmbedderLogger logger )
throws MavenEmbedderException
{
this( new ClassWorld( "plexus.core", classLoader ), logger );
}
// ----------------------------------------------------------------------
// Accessors
// ----------------------------------------------------------------------
public ClassWorld getClassWorld()
{
return classWorld;
}
public ArtifactRepository getLocalRepository()
{
return localRepository;
}
public MavenEmbedderLogger getLogger()
{
return logger;
}
public void setLogger( MavenEmbedderLogger logger )
{
this.logger = logger;
}
public Model readModel( File model )
throws XmlPullParserException, IOException
{
return modelReader.read( new FileReader( model ) );
}
public void writeModel( Writer writer,
Model model )
throws IOException
{
modelWriter.write( writer, model );
}
// ----------------------------------------------------------------------
// Project
// ----------------------------------------------------------------------
public MavenProject readProject( File mavenProject )
throws ProjectBuildingException
{
return mavenProjectBuilder.build( mavenProject, localRepository, profileManager );
}
/**
* This method is used to grab the list of dependencies that belong to a project so that a UI
* can be populated. For example, a list of libraries that are used by an Eclipse, Netbeans, or
* IntelliJ project.
*/
public MavenExecutionResult readProjectWithDependencies( MavenExecutionRequest request )
{
MavenProject project = null;
try
{
request = defaultsPopulator.populateDefaults( request );
project = mavenProjectBuilder.buildWithDependencies( new File( request.getPomFile() ),
request.getLocalRepository(), profileManager,
request.getTransferListener() );
}
catch ( MavenEmbedderException e )
{
return new DefaultMavenExecutionResult( project, Collections.singletonList( e ) );
}
catch ( ProjectBuildingException e )
{
return new DefaultMavenExecutionResult( project, Collections.singletonList( e ) );
}
catch ( ArtifactResolutionException e )
{
return new DefaultMavenExecutionResult( project, Collections.singletonList( e ) );
}
catch ( ArtifactNotFoundException e )
{
return new DefaultMavenExecutionResult( project, Collections.singletonList( e ) );
}
return new DefaultMavenExecutionResult( project, Collections.EMPTY_LIST );
}
// ----------------------------------------------------------------------
// Artifacts
// ----------------------------------------------------------------------
public Artifact createArtifact( String groupId,
String artifactId,
String version,
String scope,
String type )
{
return artifactFactory.createArtifact( groupId, artifactId, version, scope, type );
}
public Artifact createArtifactWithClassifier( String groupId,
String artifactId,
String version,
String type,
String classifier )
{
return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
}
public void resolve( Artifact artifact,
List remoteRepositories,
ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException
{
artifactResolver.resolve( artifact, remoteRepositories, localRepository );
}
// ----------------------------------------------------------------------
// Plugins
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Execution of phases/goals
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Lifecycle information
// ----------------------------------------------------------------------
public List getLifecyclePhases()
throws MavenEmbedderException
{
List phases = new ArrayList();
ComponentDescriptor descriptor = container.getComponentDescriptor( LifecycleExecutor.ROLE );
PlexusConfiguration configuration = descriptor.getConfiguration();
PlexusConfiguration[] phasesConfigurations =
configuration.getChild( "lifecycles" ).getChild( 0 ).getChild( "phases" ).getChildren( "phase" );
try
{
for ( int i = 0; i < phasesConfigurations.length; i++ )
{
phases.add( phasesConfigurations[i].getValue() );
}
}
catch ( PlexusConfigurationException e )
{
throw new MavenEmbedderException( "Cannot retrieve default lifecycle phasesConfigurations.", e );
}
return phases;
}
// ----------------------------------------------------------------------
// Remote Repository
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Local Repository
// ----------------------------------------------------------------------
public static final String DEFAULT_LOCAL_REPO_ID = "local";
public static final String DEFAULT_LAYOUT_ID = "default";
public ArtifactRepository createLocalRepository( File localRepository )
throws ComponentLookupException
{
return createLocalRepository( localRepository.getAbsolutePath(), DEFAULT_LOCAL_REPO_ID );
}
public ArtifactRepository createLocalRepository( Settings settings )
{
return createLocalRepository( mavenTools.getLocalRepositoryPath( settings ), DEFAULT_LOCAL_REPO_ID );
}
public ArtifactRepository createLocalRepository( String url,
String repositoryId )
{
if ( !url.startsWith( "file:" ) )
{
url = "file://" + url;
}
return createRepository( url, repositoryId );
}
public ArtifactRepository createRepository( String url,
String repositoryId )
{
// snapshots vs releases
// offline = to turning the update policy off
//TODO: we'll need to allow finer grained creation of repositories but this will do for now
String updatePolicyFlag = ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS;
String checksumPolicyFlag = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
ArtifactRepositoryPolicy snapshotsPolicy =
new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );
ArtifactRepositoryPolicy releasesPolicy =
new ArtifactRepositoryPolicy( true, updatePolicyFlag, checksumPolicyFlag );
return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout,
snapshotsPolicy, releasesPolicy );
}
// ----------------------------------------------------------------------
// Lifecycle
// ----------------------------------------------------------------------
private void start()
throws MavenEmbedderException
{
start( new DefaultMavenEmbedRequest() );
}
public void start( MavenEmbedRequest req )
throws MavenEmbedderException
{
this.embedderRequest = req;
try
{
container = new DefaultPlexusContainer( null, null, classWorld );
}
catch ( PlexusContainerException e )
{
throw new MavenEmbedderException( "Error starting Maven embedder.", e );
}
if ( logger != null )
{
MavenEmbedderLoggerManager loggerManager = new MavenEmbedderLoggerManager( new PlexusLoggerAdapter( logger ) );
container.setLoggerManager( loggerManager );
}
try
{
if ( req.getContainerCustomizer() != null )
{
req.getContainerCustomizer().customize( container );
}
// ----------------------------------------------------------------------
// Lookup each of the components we need to provide the desired
// client interface.
// ----------------------------------------------------------------------
modelReader = new MavenXpp3Reader();
modelWriter = new MavenXpp3Writer();
maven = (Maven) container.lookup( Maven.ROLE );
mavenTools = (MavenTools) container.lookup( MavenTools.ROLE );
pluginDescriptorBuilder = new PluginDescriptorBuilder();
profileManager = new DefaultProfileManager( container, req.getSystemProperties() );
profileManager.explicitlyActivate( req.getActiveProfiles() );
profileManager.explicitlyDeactivate( req.getInactiveProfiles() );
mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
// ----------------------------------------------------------------------
// Artifact related components
// ----------------------------------------------------------------------
artifactRepositoryFactory = (ArtifactRepositoryFactory) container.lookup( ArtifactRepositoryFactory.ROLE );
artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE );
artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
defaultArtifactRepositoryLayout =
(ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, DEFAULT_LAYOUT_ID );
defaultsPopulator = (MavenExecutionRequestDefaultsPopulator) container.lookup(
MavenExecutionRequestDefaultsPopulator.ROLE );
// These three things can be cached for a single session of the embedder
settings = mavenTools.buildSettings( req.getUserSettingsFile(), req.getGlobalSettingsFile(), false );
localRepository = createLocalRepository( settings );
profileManager.loadSettingsProfiles( settings );
}
catch ( ComponentLookupException e )
{
throw new MavenEmbedderException( "Cannot lookup required component.", e );
}
catch ( SettingsConfigurationException e )
{
throw new MavenEmbedderException( "Cannot create settings configuration", e );
}
}
// ----------------------------------------------------------------------
// Lifecycle
// ----------------------------------------------------------------------
public void stop()
throws MavenEmbedderException
{
try
{
container.release( mavenProjectBuilder );
container.release( artifactRepositoryFactory );
}
catch ( ComponentLifecycleException e )
{
throw new MavenEmbedderException( "Cannot stop the embedder.", e );
}
}
// ----------------------------------------------------------------------
// Start of new embedder API
// ----------------------------------------------------------------------
public MavenExecutionResult execute( MavenExecutionRequest request )
{
try
{
request = defaultsPopulator.populateDefaults( request );
}
catch ( MavenEmbedderException e )
{
return new DefaultMavenExecutionResult( Collections.singletonList( e ) );
}
return maven.execute( request );
}
}
| [
"[email protected]"
] | |
19c7d19364174cc7ba7fb66b6cf43dffc4163547 | e46ac67f1c04afa033c1b557b7053ea162415eae | /app/src/main/java/com/lws/radarview/RadarView.java | a2cc18a12a14cb7deeaa5826ad159bdcda3432ae | [] | no_license | lws1076694749/RadarView | 07bb9fd09342d0710a543849005ac9536e64b4f8 | 9947c778defaa403e1ddfc842813ee51c5245b34 | refs/heads/master | 2021-01-11T21:00:46.290859 | 2017-01-17T13:12:03 | 2017-01-17T13:12:03 | 79,228,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,244 | java | package com.lws.radarview;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
/**
* Created by Wenshan.Lu on 2017/1/17.
*/
public class RadarView extends View {
private static final String TAG = "RadarView";
// 属性值范围,默认16个
private double[] mMaxValues = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100};
private double[] mMinValues = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// 属性名
private String[] mTitles = {"a", "b", "c", "d", "e", "f", "g", "h"};
// 属性值
private double[] mValues = {30, 70, 50, 20, 60, 100};
//绘制的网格密度
private int mGridNumber;
// 中心点坐标
private int mCenterX;
private int mCenterY;
// 半径
private float mRadius;
private float mAngle;
private Paint mLinePaint, mFillPaint, mTextPaint;
// 网格Path
private Path mLinePath = new Path();
// 覆盖区域的Path
private Path mValuePath = new Path();
public RadarView(Context context) {
this(context, null);
}
public RadarView(Context context, AttributeSet attrs) {
super(context, attrs);
mLinePaint = new Paint();
mLinePaint.setStyle(Paint.Style.STROKE);
mFillPaint = new Paint();
mTextPaint = new Paint();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RadarView);
mGridNumber = a.getInteger(R.styleable.RadarView_gridDensity, 5);
mFillPaint.setColor(a.getColor(R.styleable.RadarView_fillColor, Color.BLUE));
mLinePaint.setColor(a.getColor(R.styleable.RadarView_lineColor, Color.BLACK));
mTextPaint.setColor(a.getColor(R.styleable.RadarView_textColor, Color.BLACK));
mTextPaint.setTextSize(a.getDimension(R.styleable.RadarView_textSize,
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, context.getResources().getDisplayMetrics())));
a.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
float density = getContext().getResources().getDisplayMetrics().density;
int width = (int) (300 * density + 0.5f);
int height = (int) (300 * density + 0.5f);
if (widthMode == MeasureSpec.EXACTLY) {
width = widthSize;
} else if (widthMode == MeasureSpec.AT_MOST) {
width = Math.min(width, widthSize);
}
if (heightMode == MeasureSpec.EXACTLY) {
height = heightSize;
} else if (heightMode == MeasureSpec.AT_MOST) {
height = Math.min(height, heightSize);
}
setMeasuredDimension(width, height);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mCenterX = w / 2;
mCenterY = h / 2;
mRadius = Math.min(w, h) / 2.0f * 0.8f;
}
@Override
protected void onDraw(Canvas canvas) {
mAngle = (float) (2 * Math.PI / mValues.length);
drawPolygonGrid(canvas);
drawRegion(canvas);
drawText(canvas);
}
// 绘制多边形网格
private void drawPolygonGrid(Canvas canvas) {
canvas.save();
canvas.translate(mCenterX, mCenterY);
for (int i = 1; i <= mGridNumber; i++) {
float r = mRadius / mGridNumber * i;
mLinePath.reset();
for (int j = 0; j < mValues.length; j++) {
float x = (float) (r * Math.cos(mAngle * j));
float y = (float) (r * Math.sin(mAngle * j));
if (j == 0) {
mLinePath.moveTo(x, y);
} else {
mLinePath.lineTo(x, y);
}
// 绘制中心点到各顶点的直线
if (i == mGridNumber) {
canvas.drawLine(0, 0, x, y, mLinePaint);
}
}
mLinePath.close();
canvas.drawPath(mLinePath, mLinePaint);
}
canvas.restore();
}
// 绘制覆盖区域
public void drawRegion(Canvas canvas) {
canvas.save();
canvas.translate(mCenterX, mCenterY);
mFillPaint.setAlpha(255);
mFillPaint.setStyle(Paint.Style.FILL);
for (int i = 0; i < mValues.length; i++) {
float percent = (float) (mValues[i] / (mMaxValues[i] - mMinValues[i]));
float x = (float) (mRadius * Math.cos(mAngle * i) * percent);
float y = (float) (mRadius * Math.sin(mAngle * i) * percent);
if (i == 0) {
mValuePath.moveTo(x, y);
} else {
mValuePath.lineTo(x, y);
}
// 绘制小圆点
canvas.drawCircle(x, y, mRadius / 50f, mFillPaint);
}
mValuePath.close();
// 填充区域
mFillPaint.setAlpha(127);
canvas.drawPath(mValuePath, mFillPaint);
// 绘制外围Path
mFillPaint.setAlpha(255);
mFillPaint.setStyle(Paint.Style.STROKE);
mFillPaint.setStrokeWidth(5);
canvas.drawPath(mValuePath, mFillPaint);
canvas.restore();
}
//绘制属性值名称
public void drawText(Canvas canvas) {
canvas.save();
canvas.translate(mCenterX, mCenterY);
Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
float fontHeight = fontMetrics.descent - fontMetrics.ascent;
int count = Math.min(mValues.length, mTitles.length);
for (int i = 0; i < count; i++) {
float a = mAngle * i;
float x = (float) ((mRadius + fontHeight / 2) * Math.cos(a));
float y = (float) ((mRadius + fontHeight / 2) * Math.sin(a));
if ((0 <= a && a <= Math.PI / 2) || (a >= 3 * Math.PI / 2 && a <= 2 * Math.PI)) {
// 中心点右边部分
canvas.drawText(mTitles[i], x, y, mTextPaint);
} else {
// 中心点左边部分
float dis = mTextPaint.measureText(mTitles[i]);
canvas.drawText(mTitles[i], x - dis, y, mTextPaint);
}
}
canvas.restore();
}
/**
* *************************
* 对外的接口
* *************************
*/
public void setValues(double[] values) {
this.mValues = values;
postInvalidate();
}
public void setMaxValues(double[] values) {
this.mMaxValues = values;
postInvalidate();
}
public void setMinValues(double[] values) {
this.mMinValues = values;
postInvalidate();
}
public void setTitles(String[] titles) {
this.mTitles = titles;
postInvalidate();
}
}
| [
"[email protected]"
] | |
74b71c956b487fffc2693894f07b9ba3d77ab03c | 0c95a756c03c89209d4004cccea5e526bd435a17 | /community-question/src/main/java/com/shoukailiang/community/question/vo/ReplayVO.java | c3c7d9fdd4275b66bdd70e233c1bfff1753140d7 | [
"MIT"
] | permissive | shoukailiang/community | ab543834edf2dec1b188bd97e700d60722b9c848 | 3bfa089ae059ebc993168c0914af67cf47b3a3d7 | refs/heads/main | 2023-05-12T20:32:57.767953 | 2023-05-03T06:42:14 | 2023-05-03T06:42:14 | 193,202,618 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package com.shoukailiang.community.question.vo;
import com.shoukailiang.community.entities.Replay;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author shoukailiang
* @version 1.0
* @date 2021/5/18 15:20
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class ReplayVO extends Replay {
List<Replay> children;
}
| [
"[email protected]"
] | |
b3f4162ca0a6f18156527569983f147de79f377e | 84fc749ef75ef09a27308cb3c45b4b5ff8680444 | /src/day01/onClass/CardDemo.java | 3dc68f08feacb78648634375f9af4e5d75f9222e | [] | no_license | ca7erina/JavaSE1 | 43914dca554cc7dbfb1d884c2b55811b265319f2 | 7fcce243e3fca26fa6c81e24a318af186e9a7047 | refs/heads/master | 2021-01-01T19:46:23.726269 | 2013-05-12T13:29:44 | 2013-05-12T13:29:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package day01.onClass;
public class CardDemo {
public static void main(String[] args) {
Card card = new Card(Card.SPADE, Card.ACE);
Card ace = new Card(Card.SPADE, Card.ACE);
System.out.println(card.equals(ace));//true
System.out.println(card.hashCode());
System.out.println(ace.hashCode());
String s1 = new String("abc");
String s2 = new String("abc");
String s3 = new String("abd");
System.out.println(s1==s2);//false
System.out.println(s1.equals(s2));//true
System.out.println(s1.hashCode());
System.out.println(s2.hashCode());
System.out.println(s3.hashCode());
}
}
| [
"[email protected]"
] | |
bd013cde42d63d959073d9a3e98b3bbd11f1d198 | a94f75fbf6fc290550a72570bbaab8e3086f141a | /src/main/java/com/jesusgsdev/services/game/GameService.java | 955eeb4c7c5661cebb12f4f839db054163428e82 | [] | no_license | dimpisingh/hangman | 3f6c505e43a27d239735290351f87a5434cbffb5 | 13eee53d6f9119bd51ae5a01206d445996e45433 | refs/heads/master | 2022-01-09T15:27:36.094922 | 2018-05-07T20:58:11 | 2018-05-07T20:58:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.jesusgsdev.services.game;
import com.jesusgsdev.entities.game.Game;
import com.jesusgsdev.entities.users.Player;
import java.util.List;
/**
* Created by jesgarsal on 19/04/17.
*/
public interface GameService {
List<Game> getAllGames();
List<Game> getAllCurrentGames();
Game startNewGame(Player player, String secretWord, String visibleWord);
void updateGame(Game game, Character character);
}
| [
"[email protected]"
] | |
948eab3aadb139b9d0065bd13707764fb5ff9135 | 4c7f038033af3eeee75c8772652c5bb5181b5788 | /Chapter1/HelloWorld/app/src/androidTest/java/thud/helloworld/ExampleInstrumentedTest.java | 722fbb68ec5ee40ecec9d640f656d315690d4d21 | [] | no_license | hvtu/TN216 | 873f77a2d6c5e8a716638c12e908afe29603ffcf | 4d7bbeb720c1898fb5bcd4a7ad7b8c217b875cd4 | refs/heads/master | 2022-11-06T11:35:50.634541 | 2020-06-14T12:00:34 | 2020-06-14T12:00:34 | 272,029,333 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package thud.helloworld;
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.getInstrumentation().getTargetContext();
assertEquals("thud.helloworld", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
c51dd7b401f2ae907513df69c12089f9af4e112f | 4913ef8eb5cde6e3b1ee74a27c3f3d54319148d9 | /allbinary_src/data/DataJavaLibraryM/src/main/java/org/allbinary/logic/communication/smtp/EmailData.java | 8a32de7ac4948c0dd045de4790ea1fb2e03003a2 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | AllBinary/AllBinary-Platform | 0876cfbe8f0d003b628181551f90df36f6203c6a | 92adcd63427fcacbfac9cb4a6b47b92a3c2acaa7 | refs/heads/master | 2023-08-18T23:24:09.932268 | 2023-08-15T03:09:32 | 2023-08-15T03:09:32 | 1,953,077 | 16 | 3 | NOASSERTION | 2023-07-05T00:52:21 | 2011-06-25T18:29:09 | Java | UTF-8 | Java | false | false | 951 | java | /*
* AllBinary Open License Version 1
* Copyright (c) 2011 AllBinary
*
* By agreeing to this license you and any business entity you represent are
* legally bound to the AllBinary Open License Version 1 legal agreement.
*
* You may obtain the AllBinary Open License Version 1 legal agreement from
* AllBinary or the root directory of AllBinary's AllBinary Platform repository.
*
* Created By: Travis Berthelot
*
*/
package org.allbinary.logic.communication.smtp;
public class EmailData
{
private EmailData()
{
}
public static final String SERVER = "EMAIL_SERVER";
public static final String NAME = "EMAIL_NAME";
public static final String FROM = "EMAIL_FROM";
public static final String TO = "EMAIL_TO";
public static final String CC = "EMAIL_CC";
public static final String BCC = "EMAIL_BCC";
public static final String SUBJECT = "EMAIL_SUBJECT";
public static final String CONTENT = "EMAIL_CONTENT";
}
| [
"[email protected]"
] | |
f1fa56446a45e664d475fac439d8f731081f7824 | ee4a8c5f9a10b10545e77b86d0a4239e71547715 | /struts-app/bank-struts-app/src/test/java/LibraryTest.java | d7f79a221d0248dd9b2651fa83e49a2c79ee324d | [
"Apache-2.0"
] | permissive | KuntanSutar/Swabhav-Techlabs | 1b27e295d2c151722b424991b28ab6a267b4bad4 | 78703b80ba53685e82e17656c3d4132382991eff | refs/heads/master | 2023-01-12T19:17:52.608108 | 2019-05-25T03:41:57 | 2019-05-25T03:41:57 | 141,831,638 | 0 | 1 | null | 2022-12-30T07:22:43 | 2018-07-21T17:09:05 | Java | UTF-8 | Java | false | false | 479 | java | import org.junit.Test;
import static org.junit.Assert.*;
/*
* This Java source file was auto generated by running 'gradle init --type java-library'
* by 'Sutar' at '5/10/19 11:56 PM' with Gradle 3.0
*
* @author Sutar, @date 5/10/19 11:56 PM
*/
public class LibraryTest {
@Test public void testSomeLibraryMethod() {
Library classUnderTest = new Library();
assertTrue("someLibraryMethod should return 'true'", classUnderTest.someLibraryMethod());
}
}
| [
"[email protected]"
] | |
f4f995c0267c3a1c3d40bcf5130af28fa2a53a96 | ea03c0eff8dbdceaab3fc1c3c9e843fadf3018a2 | /modules/jaxws/src/org/apache/axis2/jaxws/message/util/StackableReader.java | 8b198d9c53faabb30e7907c917a9137ce5619e86 | [
"Apache-2.0"
] | permissive | cranelab/axis1_3 | 28544dbcf3bf0c9bf59a59441ad8ef21143f70f0 | 1754374507dee9d1502478c454abc1d13bcf15b9 | refs/heads/master | 2022-12-28T05:17:18.894411 | 2020-04-22T17:50:05 | 2020-04-22T17:50:05 | 257,970,632 | 0 | 0 | Apache-2.0 | 2020-10-13T21:25:37 | 2020-04-22T17:21:46 | Java | UTF-8 | Java | false | false | 7,528 | 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.axis2.jaxws.message.util;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.util.Stack;
/**
* StackableReader A StackableStreamReader provides an additional method push(XMLStreamReader)
* <p/>
* You can call push(...) to add a new XMLStreamReader. The next event will use the pushed stream
* reader. After the XMLStreamReader is consumed, it is automatically popped off of the stack.
* <p/>
* Note the information returned by the StackableReader is only applicable for the topmost
* XMLStreamReader. For example the NamespaceContext that is returned is not a combination of all
* the namespace contexts on the stack.
*/
public class StackableReader implements XMLStreamReader {
Stack<XMLStreamReader> stack = new Stack<XMLStreamReader>();
XMLStreamReader current = null;
/**
* Create a stackable reader with the initial reader
*
* @param first
*/
public StackableReader(XMLStreamReader first) {
current = first;
}
/**
* Push a new StreamReader
*
* @param streamReader
*/
public void push(XMLStreamReader streamReader) throws XMLStreamException {
// Push the current reader if it is not consumed
if (current != null &&
current.hasNext()) {
stack.push(current);
}
current = streamReader;
}
public void close() throws XMLStreamException {
current.close();
}
public int getAttributeCount() {
return current.getAttributeCount();
}
public String getAttributeLocalName(int arg0) {
return current.getAttributeLocalName(arg0);
}
public QName getAttributeName(int arg0) {
return current.getAttributeName(arg0);
}
public String getAttributeNamespace(int arg0) {
return current.getAttributeNamespace(arg0);
}
public String getAttributePrefix(int arg0) {
return current.getAttributePrefix(arg0);
}
public String getAttributeType(int arg0) {
return current.getAttributeType(arg0);
}
public String getAttributeValue(int arg0) {
return current.getAttributeValue(arg0);
}
public String getAttributeValue(String arg0, String arg1) {
return current.getAttributeValue(arg0, arg1);
}
public String getCharacterEncodingScheme() {
return current.getCharacterEncodingScheme();
}
public String getElementText() throws XMLStreamException {
return current.getElementText();
}
public String getEncoding() {
return current.getEncoding();
}
public int getEventType() {
return current.getEventType();
}
public String getLocalName() {
return current.getLocalName();
}
public Location getLocation() {
return current.getLocation();
}
public QName getName() {
return current.getName();
}
public NamespaceContext getNamespaceContext() {
return current.getNamespaceContext();
}
public int getNamespaceCount() {
return current.getNamespaceCount();
}
public String getNamespacePrefix(int arg0) {
return current.getNamespacePrefix(arg0);
}
public String getNamespaceURI() {
return current.getNamespaceURI();
}
public String getNamespaceURI(int arg0) {
return current.getNamespaceURI(arg0);
}
public String getNamespaceURI(String arg0) {
return current.getNamespaceURI(arg0);
}
public String getPIData() {
return current.getPIData();
}
public String getPITarget() {
return current.getPITarget();
}
public String getPrefix() {
return current.getPrefix();
}
public Object getProperty(String arg0) throws IllegalArgumentException {
return current.getProperty(arg0);
}
public String getText() {
return current.getText();
}
public char[] getTextCharacters() {
return current.getTextCharacters();
}
public int getTextCharacters(int arg0, char[] arg1, int arg2, int arg3)
throws XMLStreamException {
return current.getTextCharacters(arg0, arg1, arg2, arg3);
}
public int getTextLength() {
return current.getTextLength();
}
public int getTextStart() {
return current.getTextStart();
}
public String getVersion() {
return current.getVersion();
}
public boolean hasName() {
return current.hasName();
}
public boolean hasNext() throws XMLStreamException {
// This code assumes that the stack only contains readers that are not consumed
if (!current.hasNext() &&
!stack.isEmpty()) {
return stack.peek().hasNext();
}
return current.hasNext();
}
public boolean hasText() {
return current.hasText();
}
public boolean isAttributeSpecified(int arg0) {
return current.isAttributeSpecified(arg0);
}
public boolean isCharacters() {
return current.isCharacters();
}
public boolean isEndElement() {
return current.isEndElement();
}
public boolean isStandalone() {
return current.isStandalone();
}
public boolean isStartElement() {
return current.isStartElement();
}
public boolean isWhiteSpace() {
return current.isWhiteSpace();
}
public int next() throws XMLStreamException {
// Only next is allowed to pop the stack
if (!current.hasNext() &&
!stack.isEmpty()) {
current = stack.pop();
}
// The assumption is that the event on the stream reader was processed
// prior to pushing a new xmlstreamreader. thus we proceed to the next
// event in all cases
int tag = current.next();
// Skip start document and end document events for
// stacked stream readers
if ((tag == this.START_DOCUMENT ||
tag == this.END_DOCUMENT) &&
!stack.isEmpty()) {
tag = next();
}
return tag;
}
public int nextTag() throws XMLStreamException {
if (!current.hasNext() &&
!stack.isEmpty()) {
return stack.peek().nextTag();
}
return current.nextTag();
}
public void require(int arg0, String arg1, String arg2) throws XMLStreamException {
current.require(arg0, arg1, arg2);
}
public boolean standaloneSet() {
return current.standaloneSet();
}
}
| [
"[email protected]"
] | |
02221fbff9ea0e32d4220dcc9b1fac171018061b | ce6722230fc0fb17fd1e9b651d1e50fb398ae3c3 | /h2/src/main/org/h2/engine/Constants.java | b432cbbdf5b059beda3dc91c55b08c14ade01c2c | [] | no_license | jack870601/107-SE-HW1 | 879dc1a7779a888ede38a76cee96e1502b38dd30 | fbc945246230250ce18d671552a1bbc90f1b33f7 | refs/heads/master | 2020-04-09T07:25:33.678377 | 2018-12-05T04:00:09 | 2018-12-05T04:00:09 | 160,155,030 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,056 | java | /*
* Copyright 2004-2018 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.engine;
import java.sql.ResultSet;
/**
* Constants are fixed values that are used in the whole database code.
*/
public class Constants {
/**
* The build date is updated for each public release.
*/
public static final String BUILD_DATE = "2018-03-18";
/**
* The build date of the last stable release.
*/
public static final String BUILD_DATE_STABLE = "2017-06-10";
/**
* The build id is incremented for each public release.
*/
public static final int BUILD_ID = 197;
/**
* The build id of the last stable release.
*/
public static final int BUILD_ID_STABLE = 196;
/**
* Whether this is a snapshot version.
*/
public static final boolean BUILD_SNAPSHOT = false;
/**
* If H2 is compiled to be included in a product, this should be set to
* a unique vendor id (to distinguish from official releases).
* Additionally, a version number should be set to distinguish releases.
* Example: ACME_SVN1651_BUILD3
*/
public static final String BUILD_VENDOR_AND_VERSION = null;
/**
* The TCP protocol version number 8.
* @since 1.2.143 (2010-09-18)
*/
public static final int TCP_PROTOCOL_VERSION_8 = 8;
/**
* The TCP protocol version number 9.
* @since 1.3.158 (2011-07-17)
*/
public static final int TCP_PROTOCOL_VERSION_9 = 9;
/**
* The TCP protocol version number 10.
* @since 1.3.162 (2011-11-26)
*/
public static final int TCP_PROTOCOL_VERSION_10 = 10;
/**
* The TCP protocol version number 11.
* @since 1.3.163 (2011-12-30)
*/
public static final int TCP_PROTOCOL_VERSION_11 = 11;
/**
* The TCP protocol version number 12.
* @since 1.3.168 (2012-07-13)
*/
public static final int TCP_PROTOCOL_VERSION_12 = 12;
/**
* The TCP protocol version number 13.
* @since 1.3.174 (2013-10-19)
*/
public static final int TCP_PROTOCOL_VERSION_13 = 13;
/**
* The TCP protocol version number 14.
* @since 1.3.176 (2014-04-05)
*/
public static final int TCP_PROTOCOL_VERSION_14 = 14;
/**
* The TCP protocol version number 15.
* @since 1.4.178 Beta (2014-05-02)
*/
public static final int TCP_PROTOCOL_VERSION_15 = 15;
/**
* The TCP protocol version number 16.
* @since 1.4.194 (2017-03-10)
*/
public static final int TCP_PROTOCOL_VERSION_16 = 16;
/**
* The TCP protocol version number 17.
* @since 1.4.197 (TODO)
*/
public static final int TCP_PROTOCOL_VERSION_17 = 17;
/**
* Minimum supported version of TCP protocol.
*/
public static final int TCP_PROTOCOL_VERSION_MIN_SUPPORTED = TCP_PROTOCOL_VERSION_8;
/**
* Maximum supported version of TCP protocol.
*/
public static final int TCP_PROTOCOL_VERSION_MAX_SUPPORTED = TCP_PROTOCOL_VERSION_17;
/**
* The major version of this database.
*/
public static final int VERSION_MAJOR = 1;
/**
* The minor version of this database.
*/
public static final int VERSION_MINOR = 4;
/**
* The lock mode that means no locking is used at all.
*/
public static final int LOCK_MODE_OFF = 0;
/**
* The lock mode that means read locks are acquired, but they are released
* immediately after the statement is executed.
*/
public static final int LOCK_MODE_READ_COMMITTED = 3;
/**
* The lock mode that means table level locking is used for reads and
* writes.
*/
public static final int LOCK_MODE_TABLE = 1;
/**
* The lock mode that means table level locking is used for reads and
* writes. If a table is locked, System.gc is called to close forgotten
* connections.
*/
public static final int LOCK_MODE_TABLE_GC = 2;
/**
* Constant meaning both numbers and text is allowed in SQL statements.
*/
public static final int ALLOW_LITERALS_ALL = 2;
/**
* Constant meaning no literals are allowed in SQL statements.
*/
public static final int ALLOW_LITERALS_NONE = 0;
/**
* Constant meaning only numbers are allowed in SQL statements (but no
* texts).
*/
public static final int ALLOW_LITERALS_NUMBERS = 1;
/**
* Whether searching in Blob values should be supported.
*/
public static final boolean BLOB_SEARCH = false;
/**
* The minimum number of entries to keep in the cache.
*/
public static final int CACHE_MIN_RECORDS = 16;
/**
* The default cache size in KB for each GB of RAM.
*/
public static final int CACHE_SIZE_DEFAULT = 64 * 1024;
/**
* The default cache type.
*/
public static final String CACHE_TYPE_DEFAULT = "LRU";
/**
* The value of the cluster setting if clustering is disabled.
*/
public static final String CLUSTERING_DISABLED = "''";
/**
* The value of the cluster setting if clustering is enabled (the actual
* value is checked later).
*/
public static final String CLUSTERING_ENABLED = "TRUE";
/**
* The database URL used when calling a function if only the column list
* should be returned.
*/
public static final String CONN_URL_COLUMNLIST = "jdbc:columnlist:connection";
/**
* The database URL used when calling a function if the data should be
* returned.
*/
public static final String CONN_URL_INTERNAL = "jdbc:default:connection";
/**
* The cost is calculated on rowcount + this offset,
* to avoid using the wrong or no index if the table
* contains no rows _currently_ (when preparing the statement)
*/
public static final int COST_ROW_OFFSET = 1000;
/**
* The number of milliseconds after which to check for a deadlock if locking
* is not successful.
*/
public static final int DEADLOCK_CHECK = 100;
/**
* The default port number of the HTTP server (for the H2 Console).
* This value is also in the documentation and in the Server javadoc.
*/
public static final int DEFAULT_HTTP_PORT = 8082;
/**
* The default value for the LOCK_MODE setting.
*/
public static final int DEFAULT_LOCK_MODE = LOCK_MODE_READ_COMMITTED;
/**
* The default maximum length of an LOB that is stored with the record
* itself, and not in a separate place.
*/
public static final int DEFAULT_MAX_LENGTH_INPLACE_LOB = 256;
/**
* The default value for the maximum transaction log size.
*/
public static final long DEFAULT_MAX_LOG_SIZE = 16 * 1024 * 1024;
/**
* The default value for the MAX_MEMORY_UNDO setting.
*/
public static final int DEFAULT_MAX_MEMORY_UNDO = 50_000;
/**
* The default for the setting MAX_OPERATION_MEMORY.
*/
public static final int DEFAULT_MAX_OPERATION_MEMORY = 100_000;
/**
* The default page size to use for new databases.
*/
public static final int DEFAULT_PAGE_SIZE = 4096;
/**
* The default result set concurrency for statements created with
* Connection.createStatement() or prepareStatement(String sql).
*/
public static final int DEFAULT_RESULT_SET_CONCURRENCY =
ResultSet.CONCUR_READ_ONLY;
/**
* The default port of the TCP server.
* This port is also used in the documentation and in the Server javadoc.
*/
public static final int DEFAULT_TCP_PORT = 9092;
/**
* The default delay in milliseconds before the transaction log is written.
*/
public static final int DEFAULT_WRITE_DELAY = 500;
/**
* The password is hashed this many times
* to slow down dictionary attacks.
*/
public static final int ENCRYPTION_KEY_HASH_ITERATIONS = 1024;
/**
* The block of a file. It is also the encryption block size.
*/
public static final int FILE_BLOCK_SIZE = 16;
/**
* For testing, the lock timeout is smaller than for interactive use cases.
* This value could be increased to about 5 or 10 seconds.
*/
public static final int INITIAL_LOCK_TIMEOUT = 2000;
/**
* The block size for I/O operations.
*/
public static final int IO_BUFFER_SIZE = 4 * 1024;
/**
* The block size used to compress data in the LZFOutputStream.
*/
public static final int IO_BUFFER_SIZE_COMPRESS = 128 * 1024;
/**
* The number of milliseconds to wait between checking the .lock.db file
* still exists once a database is locked.
*/
public static final int LOCK_SLEEP = 1000;
/**
* The highest possible parameter index.
*/
public static final int MAX_PARAMETER_INDEX = 100_000;
/**
* The memory needed by a object of class Data
*/
public static final int MEMORY_DATA = 24;
/**
* This value is used to calculate the average memory usage.
*/
public static final int MEMORY_FACTOR = 64;
/**
* The memory needed by a regular object with at least one field.
*/
// Java 6, 64 bit: 24
// Java 6, 32 bit: 12
public static final int MEMORY_OBJECT = 24;
/**
* The memory needed by an object of class PageBtree.
*/
public static final int MEMORY_PAGE_BTREE =
112 + MEMORY_DATA + 2 * MEMORY_OBJECT;
/**
* The memory needed by an object of class PageData.
*/
public static final int MEMORY_PAGE_DATA =
144 + MEMORY_DATA + 3 * MEMORY_OBJECT;
/**
* The memory needed by an object of class PageDataOverflow.
*/
public static final int MEMORY_PAGE_DATA_OVERFLOW = 96 + MEMORY_DATA;
/**
* The memory needed by a pointer.
*/
// Java 6, 64 bit: 8
// Java 6, 32 bit: 4
public static final int MEMORY_POINTER = 8;
/**
* The memory needed by a Row.
*/
public static final int MEMORY_ROW = 40;
/**
* The minimum write delay that causes commits to be delayed.
*/
public static final int MIN_WRITE_DELAY = 5;
/**
* The name prefix used for indexes that are not explicitly named.
*/
public static final String PREFIX_INDEX = "INDEX_";
/**
* The name prefix used for synthetic nested join tables.
*/
public static final String PREFIX_JOIN = "SYSTEM_JOIN_";
/**
* The name prefix used for primary key constraints that are not explicitly
* named.
*/
public static final String PREFIX_PRIMARY_KEY = "PRIMARY_KEY_";
/**
* Every user belongs to this role.
*/
public static final String PUBLIC_ROLE_NAME = "PUBLIC";
/**
* The number of bytes in random salt that is used to hash passwords.
*/
public static final int SALT_LEN = 8;
/**
* The name of the default schema.
*/
public static final String SCHEMA_MAIN = "PUBLIC";
/**
* The default selectivity (used if the selectivity is not calculated).
*/
public static final int SELECTIVITY_DEFAULT = 50;
/**
* The number of distinct values to keep in memory when running ANALYZE.
*/
public static final int SELECTIVITY_DISTINCT_COUNT = 10_000;
/**
* The default directory name of the server properties file for the H2
* Console.
*/
public static final String SERVER_PROPERTIES_DIR = "~";
/**
* The name of the server properties file for the H2 Console.
*/
public static final String SERVER_PROPERTIES_NAME = ".h2.server.properties";
/**
* Queries that take longer than this number of milliseconds are written to
* the trace file with the level info.
*/
public static final long SLOW_QUERY_LIMIT_MS = 100;
/**
* The database URL prefix of this database.
*/
public static final String START_URL = "jdbc:h2:";
/**
* The file name suffix of all database files.
*/
public static final String SUFFIX_DB_FILE = ".db";
/**
* The file name suffix of large object files.
*/
public static final String SUFFIX_LOB_FILE = ".lob.db";
/**
* The suffix of the directory name used if LOB objects are stored in a
* directory.
*/
public static final String SUFFIX_LOBS_DIRECTORY = ".lobs.db";
/**
* The file name suffix of file lock files that are used to make sure a
* database is open by only one process at any time.
*/
public static final String SUFFIX_LOCK_FILE = ".lock.db";
/**
* The file name suffix of a H2 version 1.1 database file.
*/
public static final String SUFFIX_OLD_DATABASE_FILE = ".data.db";
/**
* The file name suffix of page files.
*/
public static final String SUFFIX_PAGE_FILE = ".h2.db";
/**
* The file name suffix of a MVStore file.
*/
public static final String SUFFIX_MV_FILE = ".mv.db";
/**
* The file name suffix of a new MVStore file, used when compacting a store.
*/
public static final String SUFFIX_MV_STORE_NEW_FILE = ".newFile";
/**
* The file name suffix of a temporary MVStore file, used when compacting a
* store.
*/
public static final String SUFFIX_MV_STORE_TEMP_FILE = ".tempFile";
/**
* The file name suffix of temporary files.
*/
public static final String SUFFIX_TEMP_FILE = ".temp.db";
/**
* The file name suffix of trace files.
*/
public static final String SUFFIX_TRACE_FILE = ".trace.db";
/**
* How often we check to see if we need to apply a throttling delay if SET
* THROTTLE has been used.
*/
public static final int THROTTLE_DELAY = 50;
/**
* The maximum size of an undo log block.
*/
public static final int UNDO_BLOCK_SIZE = 1024 * 1024;
/**
* The database URL format in simplified Backus-Naur form.
*/
public static final String URL_FORMAT = START_URL +
"{ {.|mem:}[name] | [file:]fileName | " +
"{tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value...]";
/**
* The package name of user defined classes.
*/
public static final String USER_PACKAGE = "org.h2.dynamic";
/**
* The maximum time in milliseconds to keep the cost of a view.
* 10000 means 10 seconds.
*/
public static final int VIEW_COST_CACHE_MAX_AGE = 10_000;
/**
* The name of the index cache that is used for temporary view (subqueries
* used as tables).
*/
public static final int VIEW_INDEX_CACHE_SIZE = 64;
/**
* The maximum number of entries in query statistics.
*/
public static final int QUERY_STATISTICS_MAX_ENTRIES = 100;
/**
* Announced version for PgServer.
*/
public static final String PG_VERSION = "8.2.23";
private Constants() {
// utility class
}
/**
* Get the version of this product, consisting of major version, minor
* version, and build id.
*
* @return the version number
*/
public static String getVersion() {
String version = VERSION_MAJOR + "." + VERSION_MINOR + "." + BUILD_ID;
if (BUILD_VENDOR_AND_VERSION != null) {
version += "_" + BUILD_VENDOR_AND_VERSION;
}
if (BUILD_SNAPSHOT) {
version += "-SNAPSHOT";
}
return version;
}
/**
* Get the last stable version name.
*
* @return the version number
*/
public static Object getVersionStable() {
return "1.4." + BUILD_ID_STABLE;
}
/**
* Get the complete version number of this database, consisting of
* the major version, the minor version, the build id, and the build date.
*
* @return the complete version
*/
public static String getFullVersion() {
return getVersion() + " (" + BUILD_DATE + ")";
}
}
| [
"[email protected]"
] | |
3ec2b8160209bf1874e295d01833d6ae8c35b2d5 | 8c8df68da59dc094370f52a91f5d75accf5da6e4 | /ip-model/src/test/java/com/gebond/ip/model/array/VectorTest.java | f4e9e2c05e4c56391b50bce004305f1e83cc4732 | [
"MIT"
] | permissive | gebond/image-processing-java | 2f0515ac4a0e2bcc293d188897bf6ac07650e1ed | ab140178335363031d82305e76e59004ea27711d | refs/heads/master | 2022-08-12T03:11:21.651442 | 2022-07-01T09:24:55 | 2022-07-01T09:24:55 | 117,418,565 | 1 | 0 | MIT | 2018-05-16T13:12:27 | 2018-01-14T09:46:06 | Java | UTF-8 | Java | false | false | 4,834 | java | package com.gebond.ip.model.array;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
/**
* Created on 07/05/18.
*/
class ListVectorTest {
@Test
@DisplayName("ListVector default")
void ListVector_default() {
ListVector<Object> testee = new ListVector<>(new Integer[]{});
assertEquals(0, testee.getSize());
}
@Test
@DisplayName("ListVector copyOfArray")
void ListVector_asArray() {
ListVector<Integer> testee = new ListVector<>(new Integer[]{1, 2, 3, 4, 5});
assertEquals(5, testee.getSize());
assertEquals(Integer.valueOf(1), testee.get(0));
assertEquals(Integer.valueOf(2), testee.get(1));
assertEquals(Integer.valueOf(3), testee.get(2));
assertEquals(Integer.valueOf(4), testee.get(3));
assertEquals(Integer.valueOf(5), testee.get(4));
}
@Test
@DisplayName("ListVector copyOfListVector")
void ListVector_asListVector() {
ListVector<Integer> target = new ListVector<>(new Integer[]{1, 2, 3, 4, 5});
ListVector<Integer> testee = new ListVector<>(target);
assertEquals(5, testee.getSize());
assertEquals(Integer.valueOf(1), testee.get(0));
assertEquals(Integer.valueOf(2), testee.get(1));
assertEquals(Integer.valueOf(3), testee.get(2));
assertEquals(Integer.valueOf(4), testee.get(3));
assertEquals(Integer.valueOf(5), testee.get(4));
}
@Test
@DisplayName("ListVector copyOfListVector without changes")
void ListVector_doNotAcceptChanges() {
ListVector<Integer> target = new ListVector<>(new Integer[]{1, 2, 3, 4, 5});
ListVector<Integer> testee = new ListVector<>(target);
target.set(1, Integer.valueOf(101));
assertEquals(5, testee.getSize());
assertEquals(Integer.valueOf(1), testee.get(0));
assertEquals(Integer.valueOf(2), testee.get(1));
assertEquals(Integer.valueOf(3), testee.get(2));
assertEquals(Integer.valueOf(4), testee.get(3));
assertEquals(Integer.valueOf(5), testee.get(4));
}
@Test
@DisplayName("ListVector set value")
void ListVector_setValue() {
ListVector<Integer> testee = new ListVector<>(new Integer[]{1, 2, 3, 4, 5});
testee.set(0, Integer.valueOf(10));
testee.set(4, Integer.valueOf(101));
assertEquals(Integer.valueOf(10), testee.get(0));
assertEquals(Integer.valueOf(101), testee.get(4));
}
@Test
@DisplayName("ListVector copyOfGeneralArray")
void ListVector_asGeneralArray() {
ListVector<Integer> testee = ListVector
.of(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3));
assertEquals(3, testee.getSize());
assertEquals(Integer.valueOf(1), testee.get(0));
assertEquals(Integer.valueOf(2), testee.get(1));
assertEquals(Integer.valueOf(3), testee.get(2));
}
@Test
@DisplayName("ListVector true equals")
void equals_true() {
ListVector<Integer> target = new ListVector<>(new Integer[]{1, 2, 3, 4, 5});
ListVector<Integer> testee = new ListVector<>(new Integer[]{1, 2, 3, 4, 5});
assertEquals(testee, testee);
assertEquals(target, testee);
}
@Test
@DisplayName("ListVector false equals")
void equals_false() {
ListVector<Object> target = new ListVector<>(new Integer[]{1, 2, 3, 4, 5});
ListVector<Object> testee = new ListVector<>(new Integer[]{1, 2, 3, 4, 6});
assertNotEquals(target, testee);
testee = new ListVector<>(new Integer[]{1, 2, 3});
assertNotEquals(target, testee);
testee = new ListVector<Object>(new Double[]{1.0, 2.0, 3.0});
assertNotEquals(target, testee);
assertNotEquals(target, null);
}
@Test
@DisplayName("ListVector toArray")
void toArray_accept() {
Integer[] sourceArray = new Integer[]{1, 2, 3, 4, 5};
ListVector<Integer> testee = new ListVector<Integer>(sourceArray);
assertArrayEquals(sourceArray, testee.toArray());
}
@Test
@DisplayName("ListVector size")
void getSize_accept() {
Integer[] sourceArray = new Integer[]{1, 2, 3, 4, 5};
ListVector<Integer> testee = new ListVector<Integer>(sourceArray);
assertEquals(5, testee.getSize());
}
@Test
@DisplayName("ListVector from base vector")
void vector_acceptBaseVector() {
Vector<Integer> base = new ListVector<>(1, 2, 3, 4, 5);
ListVector<Integer> testee = new ListVector<>(base);
assertEquals(base, testee);
base.set(2, 6);
assertNotEquals(base, testee);
}
@Test
@DisplayName("ListVector multiplied")
void multiply_apply() {
Vector<Integer> base = new ListVector<>(1, 2, 3);
Vector<Integer> target = new ListVector<>(2, 4, 6);
assertEquals(28, base.multiply(target));
assertEquals(28, target.multiply(base));
}
} | [
"[email protected]"
] | |
33cec0292f40a5b9254f259cc9927f34fba7bae8 | f0b00a54576553334d0d980c053acf8c20d98ab2 | /web-personal/src_2018-02-14/main/java/java100/app/web/json/PerformanceController.java | cc78a672c4d85ad85079469e0b10ea02f0177a1b | [] | no_license | KANG-SEONGHYEON/bitcamp | 35de0cfda9e13412548f6c59028aa2acbbf00e2d | 606b45bb519b18f7be5333565760e67aa884750b | refs/heads/master | 2021-05-08T05:38:29.152680 | 2018-02-15T15:10:25 | 2018-02-15T15:10:25 | 104,423,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,376 | java | package java100.app.web.json;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.multipart.MultipartFile;
import java100.app.domain.member.Member;
import java100.app.domain.performance.Jjim;
import java100.app.domain.performance.Performance;
import java100.app.domain.performance.PerformanceFile;
import java100.app.domain.performance.Rating;
import java100.app.domain.performance.Ripple;
import java100.app.service.PerformanceService;
@RestController
@RequestMapping("/performance")
@SessionAttributes("loginUser")
public class PerformanceController {
@Autowired ServletContext servletContext;
@Autowired PerformanceService performanceService;
@RequestMapping("list")
public Object list(
HttpSession session,
@RequestParam(value="pn", defaultValue="1") int pageNo,
@RequestParam(value="ps", defaultValue="5") int pageSize,
@RequestParam(value="words", required=false) String[] words,
@RequestParam(value="oc", required=false) String orderColumn,
@RequestParam(value="al", required=false) String align) throws Exception {
if (pageNo < 1) {
pageNo = 1;
}
if (pageSize < 5 || pageSize > 15) {
pageSize = 5;
}
HashMap<String,Object> options = new HashMap<>();
if (words != null && words[0].length() > 0) {
options.put("words", words);
}
options.put("orderColumn", orderColumn);
options.put("align", align);
int totalCount = performanceService.getTotalCount();
int lastPageNo = totalCount / pageSize;
if ((totalCount % pageSize) > 0) {
lastPageNo++;
}
HashMap<String,Object> result = new HashMap<>();
Member member = new Member();
member = (Member) session.getAttribute("loginUser");
result.put("pageNo", pageNo);
result.put("lastPageNo", lastPageNo);
result.put("list", performanceService.list(pageNo, pageSize, options));
result.put("loginUser", member);
return result;
}
@RequestMapping("{no}")
public Object view(@PathVariable int no) throws Exception {
HashMap<String, Object> result = new HashMap<>();
result.put("data", performanceService.get(no));
System.out.println("Controller.view => " + performanceService.get(no).toString());
return result;
}
// XML 설정으로 트랜잭션을 조정한다면 @Transactional 애노테이션은 필요없다.
//@Transactional
@RequestMapping(value="add", method = RequestMethod.POST)
public Object add(
Performance performance,
MultipartFile[] files,
HttpSession session) throws Exception {
//System.out.println("Controller.add => " + performance.toString());
String saveDir = servletContext.getRealPath("/download");
ArrayList<PerformanceFile> performanceFiles = new ArrayList<>();
for (MultipartFile file : files) {
if (file.isEmpty()) continue;
String filename = this.writePerformanceFile(file, saveDir);
performanceFiles.add(new PerformanceFile(filename));
}
performance.setMedias(performanceFiles);
Member member = (Member)session.getAttribute("loginUser");
performance.setWriter(member);
System.out.println("Controller.add => " + performance.toString());
performanceService.add(performance);
HashMap<String,Object> result = new HashMap<>();
result.put("status", "success");
return result;
}
@RequestMapping("update")
public Object update(
Performance performance,
MultipartFile[] files) throws Exception {
System.out.println("Controller.update => " + performance.toString());
ArrayList<PerformanceFile> performanceFiles = new ArrayList<>();
if (!files[0].isEmpty()) {
String uploadDir = servletContext.getRealPath("/download");
for (MultipartFile file : files) {
if (file.isEmpty()) continue;
String filename = this.writePerformanceFile(file, uploadDir);
performanceFiles.add(new PerformanceFile(filename));
}
performance.setMedias(performanceFiles);
}
performanceService.update(performance);
HashMap<String,Object> result = new HashMap<>();
result.put("status", "success");
return result;
}
/*@RequestMapping("delete")
public String delete(int no) throws Exception {
performanceService.delete(no);
return "redirect:list";
}*/
@RequestMapping("jjim")
public Object jjim(Jjim jjim) throws Exception {
System.out.println("Controller.jjim => " + jjim.toString());
performanceService.jjimHagi(jjim);
HashMap<String,Object> result = new HashMap<>();
result.put("status", "success");
return result;
}
@RequestMapping("viewjjim")
public Object viewJjim(Jjim jjim) throws Exception {
HashMap<String, Object> result = new HashMap<>();
result.put("jjim", performanceService.getJjim(jjim));
return result;
}
@RequestMapping("addrating")
public Object addRating(Rating rating) throws Exception {
System.out.println("Controller.addRating => " + rating.toString());
performanceService.addRating(rating);
HashMap<String,Object> result = new HashMap<>();
result.put("status", "success");
return result;
}
@RequestMapping("addripple")
public Object addRipple(Ripple ripple) throws Exception {
System.out.println("Controller.jjim => " + ripple.toString());
performanceService.addRipple(ripple);
HashMap<String,Object> result = new HashMap<>();
result.put("status", "success");
return result;
}
@RequestMapping("viewripple")
public Object viewRipple(Ripple ripple) throws Exception {
System.out.println("Controller.viewRipple => " + ripple.toString());
HashMap<String, Object> result = new HashMap<>();
result.put("ripple", performanceService.getRipple(ripple));
System.out.println("Controller.viewRipple => " + performanceService.getRipple(ripple));
return result;
}
long prevMillis = 0;
int count = 0;
// 다른 클라이언트가 보낸 파일명과 중복되지 않도록
// 서버에 파일을 저장할 때는 새 파일명을 만든다.
synchronized private String getNewFilename(String filename) {
long currMillis = System.currentTimeMillis();
if (prevMillis != currMillis) {
count = 0;
prevMillis = currMillis;
}
return currMillis + "_" + count++ + extractFileExtName(filename);
}
// 파일명에서 뒤의 확장자명을 추출한다.
private String extractFileExtName(String filename) {
int dotPosition = filename.lastIndexOf(".");
if (dotPosition == -1)
return "";
return filename.substring(dotPosition);
}
private String writePerformanceFile(MultipartFile part, String path) throws IOException {
String filename = getNewFilename(part.getOriginalFilename());
part.transferTo(new File(path + "/" + filename));
return filename;
}
}
| [
"[email protected]"
] | |
488cbdf40e3c8d5db02d98affe8415ad29c8a89d | f3ee0046b1d8b3ea4360fe953eac147c99ad4851 | /cws_services/src/uo/ri/cws/application/service/vehicle/VehicleCrudService.java | d989b8d8429455451456f036de5458635070f513 | [] | no_license | Borjarguez/CWS_JPA | 2db7e0b37559b0110777667b6f1802bdd1f8139d | fe3adb2acb7c9aa7a4476a12f2ec35ec0483975e | refs/heads/master | 2022-12-29T20:34:08.622115 | 2020-10-10T11:32:57 | 2020-10-10T11:32:57 | 217,888,350 | 0 | 0 | null | 2020-10-14T00:37:59 | 2019-10-27T17:08:14 | HTML | UTF-8 | Java | false | false | 545 | java | package uo.ri.cws.application.service.vehicle;
import java.util.Optional;
import uo.ri.cws.application.service.BusinessException;
/**
* This service is intended to be used by the Foreman
* It follows the ISP principle (@see SOLID principles from RC Martin)
*/
public interface VehicleCrudService {
/**
* @param plate number
* @return an Optional with the vehicle dto specified be the plate number
*
* @throws BusinessException, DOES NOT
*/
Optional<VehicleDto> findVehicleByPlate(String plate) throws BusinessException;
}
| [
"[email protected]"
] | |
d34ec7e00334bcf286910800e5c24551dfeccc32 | 21390096244b2400f135127097e4dbe5e6ebc64a | /src/test/java/com/currency/dollar/DollarTest.java | fb1985d7be6b8b22f5c477fd6a5ad4d78043342c | [] | no_license | aalbar/dollar | 4263eff01a327edffcc46676cd23c73b0f135668 | faff7ccc732132205a912a28ababfb6fe6c30fb2 | refs/heads/master | 2020-04-30T23:55:02.610610 | 2019-03-22T14:29:47 | 2019-03-22T14:29:47 | 177,155,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,243 | java | package com.currency.dollar;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author abhar
* @date 22/03/2019
*/
public class DollarTest {
@Test
public void should_compare_money_to_string_representation() {
assertThat("USD 2,00").isEqualTo(new Dollar(2).toString());
assertThat("USD 7,50").isEqualTo(new Dollar(7.50).toString());
}
@Test
public void should_test_equality_dollar_object() {
Dollar sevenFifty = new Dollar(7.50);
Dollar sevenFiftyToo = new Dollar(7.50);
assertThat(sevenFifty).isEqualTo(sevenFiftyToo);
}
@Test
public void should_test_inequality_dollar_object() {
Dollar sevenDollars = new Dollar(7);
Dollar threeDollars = new Dollar(3);
assertThat(sevenDollars).isNotEqualTo(threeDollars);
}
@Test
public void should_test_money_subtraction() {
assertThat(new Dollar(1)).isEqualTo(new Dollar(3).minus(new Dollar(2)));
assertThat(new Dollar(2)).isEqualTo(new Dollar(5).minus(new Dollar(3)));
}
@Test
public void should_test_numeric_safety() {
assertThat(new Dollar(0.61)).isEqualTo(new Dollar(1.03).minus(new Dollar(0.42)));
}
}
| [
"[email protected]"
] | |
30ee85f73cd3dec1d818eae107c001d3bef74107 | 91c46832ba6ad6fa71687ac5a2bb34df27934a20 | /Principalyava/src/main/java/com/rogerestrad/clases/motocicleta.java | ce21d14697d6ad8ab56ab62eda1d8035f717a7df | [] | no_license | rogerestrad/RepasoPoo | 1e77a4bdbb35ce7de81560bc72a486ede44c90bf | 6c537e2f63bd5f09e540afbf4bfddca30d9e466f | refs/heads/master | 2021-04-28T08:21:19.546640 | 2018-02-22T19:45:11 | 2018-02-22T19:45:11 | 122,248,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package com.rogerestrad.clases;
/**
* Created by Edgar Rogelio on 20/02/2018.
*/
public class motocicleta extends Carro {
//Carro c=new carro("asdhalsf")
boolean casco;
@Override
public void datosVehiculo() {
super.datosVehiculo();
System.out.println("Casco"+isCasco()+" gasolina: "+getGasolina());
}
public boolean isCasco() {
return casco;
}
public void setCasco(boolean casco) {
this.casco = casco;
}
public int getGasolina() {
return gasolina;
}
public void setGasolina(int gasolina) {
this.gasolina = gasolina;
}
int gasolina;
public motocicleta() {
super("generica");
}
public motocicleta(String nombre) {
super(nombre);
}
}
| [
"[email protected]"
] | |
49450cb9fc817afb1f3dde0c0008c1bb8c6dbb20 | 1c8a59592a72fa2f3b8a9d1cbd5ad08dfb3f760a | /src/main/java/com/emc/cto/ridagent/rid/jaxb/Confidence.java | 4813c998f1ab4c6d1aee26afd2632f58e586cc0d | [
"MIT"
] | permissive | BIE-Inc/RID-Server | f104d1099a90d8f0e06ef90dc7a3182a63faec6c | 42f1d965e7b21eaea11f4fe279f33d8c71c1fe73 | refs/heads/master | 2021-01-18T10:38:48.256551 | 2013-05-09T20:03:24 | 2013-05-09T20:03:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,992 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.03.26 at 05:36:33 PM IST
//
package com.emc.cto.ridagent.rid.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="rating" use="required">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN">
* <enumeration value="low"/>
* <enumeration value="medium"/>
* <enumeration value="high"/>
* <enumeration value="numeric"/>
* <enumeration value="unknown"/>
* </restriction>
* </simpleType>
* </attribute>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
@XmlRootElement(name = "Confidence")
public class Confidence {
@XmlValue
protected String content;
@XmlAttribute(name = "rating", required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String rating;
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContent(String value) {
this.content = value;
}
/**
* Gets the value of the rating property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRating() {
return rating;
}
/**
* Sets the value of the rating property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRating(String value) {
this.rating = value;
}
}
| [
"[email protected]"
] | |
0d03ef058efdb194a0da60a211d10f9888b51392 | 255ff79057c0ff14d0b760fc2d6da1165f1806c8 | /02JavaStep02/04Ja-va基础教程-小白的福音资料/day04/day04_作业&预习/day03作业代码/Test3.java | 12298f7b8fe34d5d34a4df66c74f43dcb9b48dd5 | [] | no_license | wjphappy90/Resource | 7f1f817d323db5adae06d26da17dfc09ee5f9d3a | 6574c8399f3cdfb6d6b39cd64dc9507e784a2549 | refs/heads/master | 2022-07-30T03:33:59.869345 | 2020-08-10T02:31:35 | 2020-08-10T02:31:35 | 285,701,650 | 2 | 6 | null | null | null | null | GB18030 | Java | false | false | 939 | java | public class Test3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //创建键盘录入对象
//键盘录入练习:键盘录入三个数据,获取这三个数据中的最小值
System.out.println("请输入第一个整数:");
int x = sc.nextInt(); //将键盘录入的数据存储在x中
System.out.println("请输入第二个整数:");
int y = sc.nextInt(); //将键盘录入的数据存储在y中
System.out.println("请输入第三个整数:");
int z = sc.nextInt(); //将键盘录入的数据存储在y中
//定义临时变量记录住比较出前两个变量中的最小值
//int temp = (x < y) ? x : y;
//将比较后的结果与第三个变量中的值比较,比较出三个数中的最小值
//int min = (temp < z) ? temp : z;
//用一条三元运算符搞定
int min = ((x < y) ? x : y)<z?((x < y) ? x : y):z;
System.out.println("min="+min);
}
}
| [
"[email protected]"
] | |
0dfc5b26fdb3226632cc080bb669280b602566cc | 028cbe18b4e5c347f664c592cbc7f56729b74060 | /v2/admin-gui/src/java/com/sun/jbi/jsf/framework/model/JBIServiceUnitStatus.java | 865fdc22f5a9429f8b5152fd52cb7f29319b4302 | [] | no_license | dmatej/Glassfish-SVN-Patched | 8d355ff753b23a9a1bd9d7475fa4b2cfd3b40f9e | 269e29ba90db6d9c38271f7acd2affcacf2416f1 | refs/heads/master | 2021-05-28T12:55:06.267463 | 2014-11-11T04:21:44 | 2014-11-11T04:21:44 | 23,610,469 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,296 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
/*
* JBIServiceUnitStatus.java
*
* @author ylee
* @author Graj
*
*/
package com.sun.jbi.jsf.framework.model;
import java.io.Serializable;
import java.util.logging.Logger;
public class JBIServiceUnitStatus implements Serializable {
private static final String SERVICE_UNIT_NAME = "ServiceUnitName";
private static final String SERVICE_UNIT_DESCRIPTION = "ServiceUnitDescription";
private static final String STATUS_TYPE = "Status";
private static final String TARGET_NAME_TYPE = "TargetName";
protected String serviceUnitName; // 0B000000-DBBABDE9030100-0A12437F-01
protected String serviceUnitDescription; // This represents the Application Sub-Assembly
protected String status; // UNKNOWN
protected String targetName; // xsltserviceengine-9bfbff60-467d-11d9-9669-0800200c9a67
private Logger logger = Logger.getLogger(JBIServiceUnitStatus.class.getName());
/**
*
*/
public JBIServiceUnitStatus() {
super();
// TODO Auto-generated constructor stub
}
/**
* @return Returns the serviceUnitDescription.
*/
public String getServiceUnitDescription() {
return this.serviceUnitDescription;
}
/**
* @param serviceUnitDescription The serviceUnitDescription to set.
*/
public void setServiceUnitDescription(String serviceUnitDescription) {
this.serviceUnitDescription = serviceUnitDescription;
}
/**
* @return Returns the serviceUnitName.
*/
public String getServiceUnitName() {
return this.serviceUnitName;
}
/**
* @param serviceUnitName The serviceUnitName to set.
*/
public void setServiceUnitName(String serviceUnitName) {
this.serviceUnitName = serviceUnitName;
}
/**
* @return Returns the status.
*/
public String getStatus() {
return this.status;
}
/**
* @param status The status to set.
*/
public void setStatus(String status) {
this.status = status;
}
/**
* @return Returns the targetName.
*/
public String getTargetName() {
return this.targetName;
}
/**
* @param targetName The targetName to set.
*/
public void setTargetName(String targetName) {
this.targetName = targetName;
}
}
| [
"kohsuke@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5"
] | kohsuke@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5 |
5f675a6c29d93114593716723cfe91a17600d07e | 2ee9269709bd410449cbb4f3af94d5ae1512596b | /app/src/main/java/com/codelagi/taaruf_hijaiyah/Hijaiyah.java | 4cd7f77f398ff9b84d1f095e5ca856f12c8bd53a | [] | no_license | ndrianggar/SubmitTest_BFAA-Android-Pemula | eb4cc492351d5057ecdc85766cb75a74afb6cf09 | e35f08806f0a1e8a6b10242b841d170df0dd1d12 | refs/heads/master | 2023-07-02T05:35:58.616494 | 2021-07-27T02:39:44 | 2021-07-27T02:39:44 | 389,827,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | package com.codelagi.taaruf_hijaiyah;
public class Hijaiyah {
private String name;
private String detail;
private int photo;
public String getName(){ return name;}
public void setName(String name){ this.name = name;}
public String getDetail(){ return detail;}
public void setDetail(String details){ this.detail = details;}
public int getPhoto(){ return photo;}
public void setPhoto(int photo){this.photo = photo;}
}
| [
"[email protected]"
] | |
172a1a632b1ada7fb28825e001c3b5a148f514ce | 4f4e8b46db3328510c222247cb05a9ef978ce84e | /CodigoFuente/Proyecto/Proyecto-war/src/java/cl/uv/proyecto/persistencia/jsf/mb/NotificacionController.java | e2e7a9657cf89581fd30a453ca516e3438502ab9 | [] | no_license | yano2h/TESIS | 46c2faad7a79abe37a52fa366a916bd3f3848e41 | 6c3d1f165497ef689c394f63c65b4b3fde8b3e27 | refs/heads/master | 2021-01-19T05:44:10.667446 | 2013-01-29T03:53:38 | 2013-01-29T03:53:38 | 3,670,899 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,199 | java | package cl.uv.proyecto.persistencia.jsf.mb;
import cl.uv.proyecto.persistencia.ejb.NotificacionFacadeLocal;
import cl.uv.proyecto.persistencia.entidades.Notificacion;
import cl.uv.proyecto.persistencia.jsf.mb.util.JsfUtil;
import cl.uv.proyecto.persistencia.jsf.mb.util.PaginationHelper;
import cl.uv.view.controller.base.utils.Resources;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
@ManagedBean(name = "notificacionController")
@SessionScoped
public class NotificacionController implements Serializable {
private Notificacion current;
private DataModel items = null;
@EJB
private NotificacionFacadeLocal ejbFacade;
private PaginationHelper pagination;
private int selectedItemIndex;
public NotificacionController() {
}
public Notificacion getSelected() {
if (current == null) {
current = new Notificacion();
selectedItemIndex = -1;
}
return current;
}
private NotificacionFacadeLocal getFacade() {
return ejbFacade;
}
public PaginationHelper getPagination() {
if (pagination == null) {
pagination = new PaginationHelper(10) {
@Override
public int getItemsCount() {
return getFacade().count();
}
@Override
public DataModel createPageDataModel() {
return new ListDataModel(getFacade().findRange(new int[]{getPageFirstItem(), getPageFirstItem() + getPageSize()}));
}
};
}
return pagination;
}
public String prepareList() {
recreateModel();
return "List";
}
public String prepareView() {
current = (Notificacion) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
return "View";
}
public String prepareCreate() {
current = new Notificacion();
selectedItemIndex = -1;
return "Create";
}
public String create() {
try {
getFacade().create(current);
JsfUtil.addSuccessMessage(Resources.getValue("bundle", "NotificacionCreated"));
return prepareCreate();
} catch (Exception e) {
JsfUtil.addErrorMessage(e, Resources.getValue("bundle", "PersistenceErrorOccured"));
return null;
}
}
public String prepareEdit() {
current = (Notificacion) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
return "Edit";
}
public String update() {
try {
getFacade().edit(current);
JsfUtil.addSuccessMessage(Resources.getValue("bundle", "NotificacionUpdated"));
return "View";
} catch (Exception e) {
JsfUtil.addErrorMessage(e, Resources.getValue("bundle", "PersistenceErrorOccured"));
return null;
}
}
public String destroy() {
current = (Notificacion) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
performDestroy();
recreatePagination();
recreateModel();
return "List";
}
public String destroyAndView() {
performDestroy();
recreateModel();
updateCurrentItem();
if (selectedItemIndex >= 0) {
return "View";
} else {
// all items were removed - go back to list
recreateModel();
return "List";
}
}
private void performDestroy() {
try {
getFacade().remove(current);
JsfUtil.addSuccessMessage(Resources.getValue("bundle", "NotificacionDeleted"));
} catch (Exception e) {
JsfUtil.addErrorMessage(e, Resources.getValue("bundle", "PersistenceErrorOccured"));
}
}
private void updateCurrentItem() {
int count = getFacade().count();
if (selectedItemIndex >= count) {
// selected index cannot be bigger than number of items:
selectedItemIndex = count - 1;
// go to previous page if last page disappeared:
if (pagination.getPageFirstItem() >= count) {
pagination.previousPage();
}
}
if (selectedItemIndex >= 0) {
current = getFacade().findRange(new int[]{selectedItemIndex, selectedItemIndex + 1}).get(0);
}
}
public DataModel getItems() {
if (items == null) {
items = getPagination().createPageDataModel();
}
return items;
}
private void recreateModel() {
items = null;
}
private void recreatePagination() {
pagination = null;
}
public String next() {
getPagination().nextPage();
recreateModel();
return "List";
}
public String previous() {
getPagination().previousPage();
recreateModel();
return "List";
}
public SelectItem[] getItemsAvailableSelectMany() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), false);
}
public SelectItem[] getItemsAvailableSelectOne() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), true);
}
@FacesConverter(forClass = Notificacion.class)
public static class NotificacionControllerConverter implements Converter {
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0) {
return null;
}
NotificacionController controller = (NotificacionController) facesContext.getApplication().getELResolver().
getValue(facesContext.getELContext(), null, "notificacionController");
return controller.ejbFacade.find(getKey(value));
}
java.lang.Long getKey(String value) {
java.lang.Long key;
key = Long.valueOf(value);
return key;
}
String getStringKey(java.lang.Long value) {
StringBuffer sb = new StringBuffer();
sb.append(value);
return sb.toString();
}
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null) {
return null;
}
if (object instanceof Notificacion) {
Notificacion o = (Notificacion) object;
return getStringKey(o.getIdNotificacion());
} else {
throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + NotificacionController.class.getName());
}
}
}
}
| [
"[email protected]"
] | |
ee9e0b04cab83491ed8ab04cc44daf78a825cc14 | d7c5f605608eb9b31a733b85eb7a24ddac3ca736 | /Java 2 Projects/tellepet_Assignment09/src/tellepet_Assignment09/StringLengthComparator.java | 4d78a817f12d6f9cd76186eb200b398571ad5cb3 | [] | no_license | navett52/Java-Repo | 590ecaa79e813b5b9210cf32e3d4c2bdb6559407 | 4c3e915f8f907af26edb3cd3bd2215db84bab31e | refs/heads/master | 2021-01-01T18:21:21.436951 | 2017-07-25T17:59:59 | 2017-07-25T17:59:59 | 98,320,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | /******************************************************
* Evan Tellep *
* Assignment 09 *
* 03/29/2016 *
* IT2045C (Computer Programming 2) *
* String length comparator for itemsToPurchase Queue *
* Ref: *
******************************************************/
package tellepet_Assignment09;
import java.util.Comparator;
public class StringLengthComparator implements Comparator<String> {
/**
* compare method compares the length of strings in the queue
*/
@Override
public int compare(String item0, String item1) {
if (item0.length() < item1.length()) {
return -1;
}
if (item0.length() > item1.length()) {
return 1;
}
return 0;
}
}
| [
"[email protected]"
] | |
2cb09735a4be5ec5425f607dd4f9a7587ee1bfad | 582e1bd6c73ace13e81723d24721d56a15154adc | /src/main/java/by/htp/shop/domain/Category.java | 21ab190e88046e99d9caa1a2b634feb2ce7d55e1 | [] | no_license | ShiMaks/OnlineShop | db5ca99bd6d6ec27903b22b0515f1b61fc0c8ea9 | ca98280cdfe689ce8c03a9f174130ce59fe55062 | refs/heads/master | 2020-03-21T23:03:49.930989 | 2018-07-05T13:53:57 | 2018-07-05T13:53:57 | 135,838,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,278 | java | package by.htp.shop.domain;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import java.util.List;
@Entity
public class Category extends BaseEntity {
private static final long serialVersionUID = 1L;
private String name;
@OneToMany(mappedBy = "category")
private List<Product> products;
public Category() {
}
public Category(int id) {
super(id);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Product> getProducts() {
return products;
}
public void setProducts(List<Product> products) {
this.products = products;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (int) (prime * getId());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Category other = (Category) obj;
if (getId() != other.getId()) {
return false;
}
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
| [
"[email protected]"
] | |
0303ca0f14dcd4b509482194e195e810a83441ad | d62c4ede31cab1fccf56a43c42c8734d19093b22 | /src/com/samodeika/builder/LunchOrderBeanDemo.java | 13a26d6487b601c3bcf2ade9103667f303761608 | [] | no_license | AlexanderNikolovAlexn/CreationalPatterns | 3e1496e2865236f49df1103deee387529f02ff13 | b0da84f9d0ef5e2ee75761937918531b77610c5c | refs/heads/master | 2021-01-13T12:53:55.664659 | 2015-10-22T14:34:18 | 2015-10-22T14:34:18 | 44,184,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package com.samodeika.builder;
public class LunchOrderBeanDemo {
public static void main(String[] args) {
// LunchOrderBean order = new LunchOrderBean();
// LunchOrderTele order = new LunchOrderTele("Wheat", "Lettuce");
// order.setBread("Wheat");
// order.setCondiments("Lettuce");
// order.setDressing("Mustard");
// order.setMeat("Ham");
// Builder pattern
LunchOrder.Builder builder = new LunchOrder.Builder();
builder.bread("Wheat").dressing("Dressing").meat("Chicken");
LunchOrder order = builder.build();
System.out.println(order.getBread());
System.out.println(order.getCondiments());
System.out.println(order.getDressing());
System.out.println(order.getMeat());
}
}
| [
"[email protected]"
] | |
7bdfca0f0ba9c10754fcaabc5b35c41795c12511 | d3a0179368d4c9cda20ee5d37933c4356edacfeb | /test/src/main/java/com/xiaocoder/test/http2/ListRefreshActivity.java | a4c3d77f7e8e926dcaef3e4706673bab93b367e4 | [] | no_license | xilinch/qlkproject | ef44b2389d9c0c3f8a1947261ec54a3d57128a46 | de45f5c94d5b3513202674e36f216c19307b1857 | refs/heads/master | 2021-01-22T14:10:15.202347 | 2015-11-23T05:02:21 | 2015-11-23T05:02:21 | 46,831,215 | 2 | 0 | null | 2015-11-25T02:07:49 | 2015-11-25T02:07:48 | null | UTF-8 | Java | false | false | 4,294 | java | package com.xiaocoder.test.http2;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.xiaocoder.android.fw.general.function.adapter.XCBaseAdapter;
import com.xiaocoder.android.fw.general.http.XCHttper;
import com.xiaocoder.ptrrefresh.XCIRefreshHandler;
import com.xiaocoder.middle.MActivity;
import com.xiaocoder.middle.parse.MResponseHandlerModel;
import com.xiaocoder.ptrrefresh.XCListRefreshLayout;
import com.xiaocoder.test.R;
import com.xiaocoder.test.bean.TestModel;
import org.apache.http.Header;
import java.util.HashMap;
import java.util.List;
public class ListRefreshActivity extends MActivity {
TestAdatpter adapter;
XCListRefreshLayout xcListRefreshLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_list_refresh);
super.onCreate(savedInstanceState);
// 未配置autorefresh属性
reqeust();
}
@Override
public void initWidgets() {
adapter = new TestAdatpter(ListRefreshActivity.this, null);
xcListRefreshLayout = getViewById(R.id.xc_id_refreshlayout);
xcListRefreshLayout.getListView().setAdapter(adapter);
// http请求中获取,这里为模拟数据
xcListRefreshLayout.setBgZeroHintInfo("无数据", "点击刷新", R.drawable.icon);
}
public static String url = "http://yyf.7lk.com/api/goods/category-goods-list?userId=399&token=c2a623a6f3c7d6e1a126f1655c13b3f0&_m=&catId=515&_v=1.0.0&page=1&num=20&ts=1438155912203&_c=&_p=android&sig=96702f0846e8cb5d2701f5e39f28ba95";
public void reqeust() {
XCHttper.getAsyn(true, url, new HashMap(), new MResponseHandlerModel<TestModel>(null, this, TestModel.class) {
@Override
public void success(int code, Header[] headers, byte[] arg2) {
super.success(code, headers, arg2);
if (result_boolean) {
List<TestModel.DataEntity.ResultEntity> result = result_bean.getData().getResult();
xcListRefreshLayout.setTotalPage("3");
result.addAll(result);// 多加点数据
xcListRefreshLayout.updateListAdd(result, adapter);
}
}
@Override
public void finish() {
super.finish();
xcListRefreshLayout.completeRefresh(result_boolean);
}
});
}
@Override
public void listeners() {
xcListRefreshLayout.setHandler(new XCIRefreshHandler() {
@Override
public boolean canRefresh() {
return true;
}
@Override
public boolean canLoad() {
return true;
}
@Override
public void refresh(View view, int request_page) {
reqeust();
}
@Override
public void load(View view, int request_page) {
reqeust();
}
});
}
class TestAdatpter extends XCBaseAdapter<TestModel.DataEntity.ResultEntity> {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
bean = list.get(position);
ViewHolder holder = null;
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.adapter_test_item, null);
holder = new ViewHolder();
holder.xc_id_adapter_test_textview = (TextView) convertView.findViewById(R.id.xc_id_adapter_test_textview);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// 获取和设置控件的显示值
holder.xc_id_adapter_test_textview.setText(bean.getCommission());
// 加载图片
return convertView;
}
public TestAdatpter(Context context, List<TestModel.DataEntity.ResultEntity> list) {
super(context, list);
}
class ViewHolder {
TextView xc_id_adapter_test_textview;
}
}
}
| [
"[email protected]"
] | |
47b352e2df9e69985a6e2b7cb9d3d367330bcac8 | c8655251bb853a032ab7db6a9b41c13241565ff6 | /jframe-utils/src/main/java/com/alipay/api/request/AlipayFundAuthOrderUnfreezeRequest.java | d095a7dbddfdad3600e49014b2176163592ddebd | [] | no_license | jacksonrick/JFrame | 3b08880d0ad45c9b12e335798fc1764c9b01756b | d9a4a9b17701eb698b957e47fa3f30c6cb8900ac | refs/heads/master | 2021-07-22T21:13:22.548188 | 2017-11-03T06:49:44 | 2017-11-03T06:49:44 | 107,761,091 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,122 | java | package com.alipay.api.request;
import com.alipay.api.domain.AlipayFundAuthOrderUnfreezeModel;
import java.util.Map;
import com.alipay.api.AlipayRequest;
import com.alipay.api.internal.util.AlipayHashMap;
import com.alipay.api.response.AlipayFundAuthOrderUnfreezeResponse;
import com.alipay.api.AlipayObject;
/**
* ALIPAY API: alipay.fund.auth.order.unfreeze request
*
* @author auto create
* @since 1.0, 2017-03-13 11:24:35
*/
public class AlipayFundAuthOrderUnfreezeRequest implements AlipayRequest<AlipayFundAuthOrderUnfreezeResponse> {
private AlipayHashMap udfParams; // add user-defined text parameters
private String apiVersion="1.0";
/**
* 预授权资金解冻接口
*/
private String bizContent;
public void setBizContent(String bizContent) {
this.bizContent = bizContent;
}
public String getBizContent() {
return this.bizContent;
}
private String terminalType;
private String terminalInfo;
private String prodCode;
private String notifyUrl;
private String returnUrl;
private boolean needEncrypt=false;
private AlipayObject bizModel=null;
public String getNotifyUrl() {
return this.notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}
public String getReturnUrl() {
return this.returnUrl;
}
public void setReturnUrl(String returnUrl) {
this.returnUrl = returnUrl;
}
public String getApiVersion() {
return this.apiVersion;
}
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
public void setTerminalType(String terminalType){
this.terminalType=terminalType;
}
public String getTerminalType(){
return this.terminalType;
}
public void setTerminalInfo(String terminalInfo){
this.terminalInfo=terminalInfo;
}
public String getTerminalInfo(){
return this.terminalInfo;
}
public void setProdCode(String prodCode) {
this.prodCode=prodCode;
}
public String getProdCode() {
return this.prodCode;
}
public String getApiMethodName() {
return "alipay.fund.auth.order.unfreeze";
}
public Map<String, String> getTextParams() {
AlipayHashMap txtParams = new AlipayHashMap();
txtParams.put("biz_content", this.bizContent);
if(udfParams != null) {
txtParams.putAll(this.udfParams);
}
return txtParams;
}
public void putOtherTextParam(String key, String value) {
if(this.udfParams == null) {
this.udfParams = new AlipayHashMap();
}
this.udfParams.put(key, value);
}
public Class<AlipayFundAuthOrderUnfreezeResponse> getResponseClass() {
return AlipayFundAuthOrderUnfreezeResponse.class;
}
public boolean isNeedEncrypt() {
return this.needEncrypt;
}
public void setNeedEncrypt(boolean needEncrypt) {
this.needEncrypt=needEncrypt;
}
public AlipayObject getBizModel() {
return this.bizModel;
}
public void setBizModel(AlipayObject bizModel) {
this.bizModel=bizModel;
}
}
| [
"[email protected]"
] | |
1eadbb5e3dd9131570ed1121031e26fb89fa955a | ba42487a6f57d7e0c8f9d1baf99486bc903000bc | /marketplace/src/test/java/com/marketplace/domain/MoneyTest.java | 05cab77c96487364dd71da4a86770f71302238e6 | [] | no_license | rnkoaa/marketplace-ddd | 1bdd79154245f34220c02d0f468e41e831876d75 | 11b5109e8de65da5d06e20d9d9205bb43adf6c30 | refs/heads/main | 2023-05-11T18:47:57.457847 | 2021-06-02T18:11:03 | 2021-06-02T18:11:03 | 308,887,024 | 0 | 1 | null | 2021-06-02T05:47:39 | 2020-10-31T13:23:41 | Java | UTF-8 | Java | false | false | 3,598 | java | package com.marketplace.domain;
import com.marketplace.domain.classifiedad.CurrencyLookup;
import com.marketplace.domain.classifiedad.CurrencyMismatchException;
import com.marketplace.domain.classifiedad.Money;
import com.marketplace.fixtures.FakeCurrencyLookup;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
class MoneyTest {
private final CurrencyLookup currencyLookup = new FakeCurrencyLookup();
@Test
void twoOfTheSameAmountShouldBeEqual() {
var firstAmount = Money.fromDecimal(5.00, "EUR", currencyLookup);
var secondAmount = Money.fromDecimal(5.00, "EUR", currencyLookup);
assertThat(firstAmount).isEqualTo(secondAmount);
}
@Test
void twoOfTheSameAmountButDifferentCurrenciesShouldNotBeEqual() {
var firstAmount = Money.fromDecimal(5.00, "EUR", currencyLookup);
var secondAmount = Money.fromDecimal(5.00, "USD", currencyLookup);
assertThat(firstAmount)
.isNotEqualTo(secondAmount);
}
@Test
public void fromString_and_FromDecimal_should_be_equal() {
var firstAmount = Money.fromDecimal(5, "EUR", currencyLookup);
var secondAmount = Money.fromString("5.00", "EUR", currencyLookup);
assertThat(firstAmount).isEqualTo(secondAmount);
}
@Test
public void sum_of_money_gives_full_amount() {
var coin1 = Money.fromDecimal(1, "EUR", currencyLookup);
var coin2 = Money.fromDecimal(2, "EUR", currencyLookup);
var coin3 = Money.fromDecimal(2, "EUR", currencyLookup);
var banknote = Money.fromDecimal(5, "EUR", currencyLookup);
var total = coin1.add(coin2).add(coin3);
assertThat(banknote).isEqualTo(total);
}
@Test
public void unused_currency_should_not_be_allowed() {
assertThatThrownBy(() -> {
Money.fromDecimal(100, "DEM", currencyLookup);
}).isInstanceOf(IllegalArgumentException.class)
.hasMessage("Currency DEM is not valid");
}
@Test
public void unknown_currency_should_not_be_allowed() {
assertThatThrownBy(() -> {
Money.fromDecimal(100, "WHAT?", currencyLookup);
}).isInstanceOf(IllegalArgumentException.class)
.hasMessage("Currency WHAT? is not valid");
}
@Test
public void throw_when_too_many_decimal_places() {
assertThatThrownBy(() -> {
Money.fromString("100.1234", "USD", currencyLookup);
}).isInstanceOf(IllegalArgumentException.class)
.hasMessage("Amount in USD cannot have more than 2 decimals");
}
@Test
public void throws_on_adding_different_currencies() {
var firstAmount = Money.fromDecimal(5, "USD", currencyLookup);
var secondAmount = Money.fromDecimal(5, "EUR", currencyLookup);
assertThatThrownBy(() -> {
firstAmount.add(secondAmount);
}).isInstanceOf(CurrencyMismatchException.class)
.hasMessage("Cannot sum amounts with different currencies");
}
@Test
public void throws_on_substracting_different_currencies() {
var firstAmount = Money.fromDecimal(5, "USD", currencyLookup);
var secondAmount = Money.fromDecimal(5, "EUR", currencyLookup);
assertThatThrownBy(() -> {
firstAmount.subtract(secondAmount);
}).isInstanceOf(CurrencyMismatchException.class)
.hasMessage("Cannot subtract amounts with different currencies");
}
} | [
"[email protected]"
] | |
e85141136d9e7d1dacafee1235d57f21863af83d | 2deb74d5bf569bdbe637846d93fac47c01b278a4 | /java/lang/ProcessBuilder.java | debbbf5561f6565e4531951ecd3f9cd54734f44a | [] | no_license | isabella232/android-sdk-sources-for-api-level-11 | 8aefeff38cbc0bbe7cfbbd04a940f8c4aa319772 | d772b816a1e388a5f8022d4bc47adc9016195600 | refs/heads/master | 2023-03-16T14:08:07.661845 | 2015-07-03T11:17:32 | 2015-07-03T11:17:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,472 | java | /* */ package java.lang;
/* */
/* */ import java.io.File;
/* */ import java.io.IOException;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */
/* */ public final class ProcessBuilder
/* */ {
/* */ public ProcessBuilder(String[] command)
/* */ {
/* 4 */ throw new RuntimeException("Stub!"); }
/* 5 */ public ProcessBuilder(List<String> command) { throw new RuntimeException("Stub!"); }
/* 6 */ public List<String> command() { throw new RuntimeException("Stub!"); }
/* 7 */ public ProcessBuilder command(String[] command) { throw new RuntimeException("Stub!"); }
/* 8 */ public ProcessBuilder command(List<String> command) { throw new RuntimeException("Stub!"); }
/* 9 */ public File directory() { throw new RuntimeException("Stub!"); }
/* 10 */ public ProcessBuilder directory(File directory) { throw new RuntimeException("Stub!"); }
/* 11 */ public Map<String, String> environment() { throw new RuntimeException("Stub!"); }
/* 12 */ public boolean redirectErrorStream() { throw new RuntimeException("Stub!"); }
/* 13 */ public ProcessBuilder redirectErrorStream(boolean redirectErrorStream) { throw new RuntimeException("Stub!"); }
/* 14 */ public Process start() throws IOException { throw new RuntimeException("Stub!");
/* */ }
/* */ }
/* Location: D:\xyh\Android_3.0\android.jar
* Qualified Name: java.lang.ProcessBuilder
* JD-Core Version: 0.6.0
*/ | [
"[email protected]"
] | |
2302d1b9fafc1303e88621b2feba2ef917c63309 | 38ef5e954941c8e66cd7ec8a909dd43ec5af000f | /camel.routing/src/main/java/camel/routing/config/RouteConfig.java | 213ac953010dca6f0c3c0637f5c71cfeea1efe81 | [] | no_license | tolgagokmen/camel-sample | 9d95e10b041a1e56de4ef92110d47467ce4dc01d | ae0dc3e9bab52f593a828601e57dc7c82efedbf0 | refs/heads/master | 2021-01-21T10:25:49.540955 | 2016-06-17T13:02:35 | 2016-06-17T13:02:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package camel.routing.config;
import java.util.Arrays;
import java.util.List;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.spring.javaconfig.CamelConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Route Configuration
*
* @author malalanayake
*
*/
@Configuration
public class RouteConfig extends CamelConfiguration {
@Autowired
Config config;
/**
* Message processing route
*
* @return
*/
@Bean
RouteBuilder messageProcessingRoute() {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("jms:queue:" + config.queueName).to("messageProcessor").routeId("mySampleRoute");
}
};
}
/**
* Expose all routes
*/
@Override
public List<RouteBuilder> routes() {
return Arrays.asList(messageProcessingRoute());
}
}
| [
"[email protected]"
] | |
2ad358bd4a2c6e3942bb914678b0c82098327f30 | 2678712c68dcbd7335051398e319d2460d947570 | /app/src/main/java/com/flat/rock/quiz/database/DatabaseHelper.java | 88a0163661406343daf6861947480d364bff920b | [] | no_license | droiden87/FamousQuiz | 739204fb5131ffcf82aa22e95ea3633d694925dc | 9661a2d6cce92ddb029be4646f503a755e6667e5 | refs/heads/master | 2020-09-20T07:45:19.242323 | 2019-11-27T11:29:17 | 2019-11-27T11:29:17 | 224,414,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,475 | java | package com.flat.rock.quiz.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DatabaseHelper extends SQLiteOpenHelper {
// Logcat tag
private static final String TAG = "DatabaseHelper";
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "UserManager.db";
// User table name
public static final String TABLE_USERS = "users";
//Quiz table name
public static final String TABLE_QUIZ = "quiz";
// User Table Columns names
public static final String COLUMN_USER_ID = "user_id";
public static final String COLUMN_USER_NAME = "user_name";
public static final String COLUMN_USER_EMAIL = "user_email";
public static final String COLUMN_USER_PASSWORD = "user_password";
public static final String COLUMN_IS_CURRENT_USER = "isCurrentUser";
//Quiz Table Columns names
public static final String COLUMN_QUIZ_ID = "id";
public static final String COLUMN_QUIZ_QUESTION = "question";
public static final String COLUMN_QUIZ_ANSWER = "answer";
public static final String COLUMN_QUIZ_OPTA = "optA";
public static final String COLUMN_QUIZ_OPTB = "optB";
public static final String COLUMN_QUIZ_OPTC = "optC";
// Table Create Statements
// Users table create statement
private String CREATE_USER_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_USERS + "("
+ COLUMN_USER_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_USER_NAME + " TEXT,"
+ COLUMN_USER_EMAIL + " TEXT," + COLUMN_USER_PASSWORD + " TEXT," + COLUMN_IS_CURRENT_USER + " BOOLEAN" + ")";
//Quiz table create statement
private String CREATE_QUIZ_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_QUIZ + "("
+ COLUMN_QUIZ_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_QUIZ_QUESTION + " TEXT,"
+ COLUMN_QUIZ_ANSWER + " TEXT," + COLUMN_QUIZ_OPTA + " TEXT,"
+ COLUMN_QUIZ_OPTB + " TEXT," + COLUMN_QUIZ_OPTC + " TEXT" + ")";
/**
* Constructor
*
* @param context
*/
private static DatabaseHelper instance;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
public static synchronized DatabaseHelper getHelper(Context context) {
if (instance == null)
instance = new DatabaseHelper(context);
return instance;
}
@Override
public void onConfigure(SQLiteDatabase db) {
}
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
if (!db.isReadOnly()) {
// Enable foreign key constraints
//db.execSQL("PRAGMA foreign_keys=ON");
//The case_sensitive_like pragma is enabled
//Then the LIKE operator pays attention to case
db.execSQL(" PRAGMA case_sensitive_like=ON;");
}
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_USER_TABLE);
db.execSQL(CREATE_QUIZ_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//Drop User Table if exist
db.execSQL("DROP TABLE IF EXISTS " + TABLE_USERS);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_QUIZ);
// Create tables again
onCreate(db);
}
}
| [
"[email protected]"
] | |
753d35c2a36fe8a04646146e456e9b1624539a69 | e2582ce4a21a47f2a98f7bd4e1f2c07b82e6e93c | /src/main/java/org/geilove/controller/CommentController.java | 03d13dd3168ccc9d5f0d4f80a4f904d6e106817e | [] | no_license | geilove/aixinsheBack | 82cb7a7c254fec0addee1ac212a29dd0da12e177 | 406764eeab573bd8fe1f4d8ec2ee81cf6fda3ce4 | refs/heads/master | 2020-05-22T06:38:28.824549 | 2016-11-30T11:55:39 | 2016-11-30T11:55:39 | 65,779,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,223 | java | package org.geilove.controller;
import org.geilove.requestParam.AddCommentParam;
import org.geilove.service.CommentService;
import org.geilove.service.HelpService;
import org.geilove.service.RegisterLoginService;
import org.geilove.sqlpojo.OtherPartHelpPojo;
import org.geilove.pojo.Confirm;
import org.geilove.pojo.DiscussReply;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.geilove.requestParam.DelCommentParam;
import org.geilove.requestParam.CommentListParam;
import org.geilove.response.CommentsListRsp;
import org.geilove.response.CommonRsp;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
//实现对推文的评论,获取,删除等
@Controller
@RequestMapping("/tweetcomment")
public class CommentController {
@Resource
private CommentService commentService;
@Resource
private HelpService helpService;
@Resource
private RegisterLoginService rlService;
@RequestMapping("/addcomment")
public @ResponseBody CommonRsp addComment(HttpServletRequest request){
CommonRsp commonRsp=new CommonRsp();
String token=request.getParameter("token");
String userPassword=token.substring(0,32); //token是password和userID拼接成的。
String useridStr=token.substring(32);
Long userid=Long.valueOf(useridStr).longValue();
String passwdTrue=rlService.selectMD5Password(Long.valueOf(userid));
if(!userPassword.equals(passwdTrue)){
commonRsp.setRetcode(2001);
commonRsp.setMsg("用户密码不对,非法");
return commonRsp;
}
String content=request.getParameter("content");
String tuiwenid=request.getParameter("tuiwenid");
DiscussReply dr=new DiscussReply();
dr.setTweetiddiscussreply(Long.valueOf(tuiwenid).longValue());
dr.setDiscussreplytext(content);
dr.setTweetiddiscussreply(userid);
dr.setDiscussreplytime(new Date());
dr.setDiscussreplyok(0);
try{
int a=commentService.addComment(dr);
if(a!=1){
commonRsp.setMsg("评论出错了");
commonRsp.setRetcode(2001);
}
}catch(Exception e){
}
commonRsp.setMsg("评论成功");
commonRsp.setRetcode(2000);
return commonRsp;//确认下插入成功后的返回值是什么
}
//根据微博客户端的设计,长按要删除的微博,松手后,如果是当前用户评论的会有删除选项,否则没有,
//这个应该是长按的时候检测了下该评论是不是当前用户发布的。客户端就能完成。
@RequestMapping("/delcomment")
public @ResponseBody Integer delComment(@RequestBody DelCommentParam delCommentParam ){
int err=0;
err=commentService.delComment(delCommentParam.getCommentid());
return err;
}
/*
* 这个实现获取某条推文的评论列表的功能。
*
*/
@RequestMapping("listcomments")
public @ResponseBody CommentsListRsp getCommentList(@RequestBody CommentListParam commentListParam){
CommentsListRsp rsp=new CommentsListRsp();
List<DiscussReply> ls=new ArrayList<DiscussReply>();
Integer tag=commentListParam.getTag();
Long tweetid=commentListParam.getTweetid();
Integer page=commentListParam.getPage();
Integer pageSize=commentListParam.getPageSize();
String lastCommentTime=commentListParam.getLastCommentTime();
Map<String,Object> map=new HashMap<String,Object>();
map.put("tweetid", tweetid);
map.put("page", page);
map.put("pageSize", pageSize);
map.put("tag",tag);
map.put("lastCommentTime", lastCommentTime);
//System.out.println(commentListParam.getLastCommentTime());
ls=commentService.getTweetComments(map);
if(ls==null || ls.size()==0){
rsp.setData(ls);
rsp.setMsg("推文暂时没有评论哦");
rsp.setRetcode(2001);
return rsp;
}
//然后从ls里面获取评论者id,根据这组id取得用户的部分信息,组合返回
List<Long> ll=new ArrayList<Long>();
for(int i=0;i<ls.size();i++){
ll.add(ls.get(i).getUseriddiscussreply()); //评论者的id
}
//System.out.println(ll.size());
List<OtherPartHelpPojo> lp=new ArrayList<OtherPartHelpPojo>();
lp=helpService.getOtherPartHelpList(ll); //根据id集合获取部分用户头像昵称等信息
//System.out.println(lp.size());
for(int k=0;k<ll.size();k++){
for(int p=0;p<lp.size();p++){
if(ll.get(k)==lp.get(p).getUserid()){
ls.get(k).setBackupone(lp.get(p).getUsernickname());
ls.get(k).setBackuptwo(lp.get(p).getUserphoto());
}
}
}
rsp.setData(ls);
//判断ls,然后返回不同的提示信息
if(ls==null || ls.size()==0){
rsp.setMsg("推文暂时没有评论哦");
rsp.setRetcode(2001);
}else{
rsp.setMsg("数据获取成功");
rsp.setRetcode(2000);
}
return rsp;
}
}
| [
"[email protected]"
] | |
4f7e26a6694cf19315aa81a101966c4ff280258c | a2fbc4116b3b7be046ef40fd00d270ad974c2159 | /com.cy.test/mybatis0817/UserMapperTest.java | c42c99d32cb150dc030e1502884f4721cef69abf | [] | no_license | yuanCheng0/mybatis0817 | 4a9c27c32138e5e5b8362f51af8517a8d000b21a | 96ea0796b88d9df2ac2e155ccb771d6fc2f7c302 | refs/heads/master | 2021-01-19T19:30:42.653806 | 2017-08-23T17:04:37 | 2017-08-23T17:04:37 | 101,199,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,434 | java | package mybatis0817;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Before;
import org.junit.Test;
import com.cy.mapper.UserMapper;
import com.cy.pojo.CustomOrders;
import com.cy.pojo.Orders;
import com.cy.pojo.QueryVo;
import com.cy.pojo.User;
public class UserMapperTest {
private SqlSessionFactory factory;
// 作用:在测试方法前执行
@Before
public void setUp() throws Exception {
String resource = "SqlMapConfig.xml";
// 通过流将核心配置文件读取进来
InputStream inputStream = Resources.getResourceAsStream(resource);
// 通过核心配置文件输入流来创建会话工厂
factory = new SqlSessionFactoryBuilder().build(inputStream);
}
@Test
public void testFindUserById() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
User user = mapper.findUserById(1);
System.out.println(user);
}
@Test
public void testFindUserByName() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
List<User> list = mapper.findUserName("王");
System.out.println(list);
}
@Test
public void testInsertUser() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
User user = new User();
user.setUsername("老王");
user.setSex("1");
user.setBirthday(new Date());
user.setAddress("上海宝山");
mapper.insertUser(user);
openSession.commit();
}
@Test
public void testfindUserByVo() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
QueryVo vo = new QueryVo();
User user = new User();
user.setUsername("老王");
user.setSex("1");
vo.setUser(user);
List<User> list = mapper.findUserByVo(vo);
System.out.println(list);
}
@Test
public void testFindUserCount() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
Integer count = mapper.findUserCount();
System.out.println(count);
}
@Test
public void testFindUserByUserNameandSex() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
User user = new User();
user.setUsername("王");
user.setSex("1");
List<User> list = mapper.findUserByUserNameandSex(user);
System.out.println(list);
}
@Test
public void testFindUserByIds() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
QueryVo vo = new QueryVo();
List<Integer> ids = new ArrayList<Integer>();
ids.add(1);
ids.add(16);
ids.add(28);
ids.add(22);
vo.setIds(ids);
List<User> list = mapper.findUserByIds(vo);
System.out.println(list);
}
@Test
public void testFindOrdersAndUser() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
List<CustomOrders> list = mapper.findOrdersAndUser1();
System.out.println(list);
}
@Test
public void testFindOrdersAndUser2() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
List<Orders> list = mapper.findOrdersAndUser2();
System.out.println(list);
}
@Test
public void testFindUserAndOrders() throws Exception {
SqlSession openSession = factory.openSession();
//通过getMapper方法实例化接口
UserMapper mapper = openSession.getMapper(UserMapper.class);
List<User> list = mapper.findUserAndOrders();
System.out.println(list);
}
}
| [
"[email protected]"
] | |
b78d210276bc6f96e2b41eef08e3c67b2e8bedf7 | ed782e881fcd6451758ac4bb9e40b8621696fab8 | /android/app/src/main/java/com/siakad/MainActivity.java | f8e7f41ee53bfcb3915e11cd9b5ed4dda45b5efd | [] | no_license | Juancesar123/sekolahjamannowmobile | ebe0ae480e97fcf3163685dccf0de7538926178c | ff9cd8fa6755c8a0b8a4c40e847b7515f45e133e | refs/heads/master | 2021-04-09T15:01:23.509929 | 2018-03-24T12:28:42 | 2018-03-24T12:28:42 | 125,654,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package com.siakad;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "siakad";
}
}
| [
"[email protected]"
] | |
28f5b45d9377e6285bd69c800cbb4f6b134f4c58 | c35adb6efcf4415ea5aef3313f290bf2dc04df4b | /StudyTest/src/part2/Test/Calculator.java | 846025f7b8593a586013bed0cfec937498689bed | [] | no_license | rioperm/StudyTest | 9de53f59d6cb3c3dcee712ee5b1e1afbdd6a6e17 | 32f2a975d7c379f58d88b202eaccbab33d345ee4 | refs/heads/master | 2020-06-23T21:38:54.971624 | 2017-02-04T03:32:48 | 2017-02-04T03:32:48 | 74,633,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 259 | java | package part2.Test;
public class Calculator {
int add(int i, int j){
return i+j;
}
int subtract(int i, int j){
return i-j;
}
int multiply(int i, int j){
return i*j;
}
int divide(int i, int j){
return i/j;
}
}
| [
"[email protected]"
] | |
e65e1c33f3527bf0131bd21fbb506f13b8f4e6fc | 73580617cfd754de34492eb440fc35e3da10d064 | /src/main/java/com/sahaj/hotelelectricitymanagement/service/HotelService.java | 47d66a268f3a7e5df7d9dda42522d9e0fccb5f93 | [] | no_license | gkumarpatel/hotel-electricity-management | 86837c91f074b1ed89a46beb5022cc5567bc5bbf | e6af4c8771f6eb9fb982d9566d8942b8f2fa9c85 | refs/heads/master | 2020-04-17T11:12:34.588839 | 2019-01-20T16:57:47 | 2019-01-20T17:18:50 | 166,531,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.sahaj.hotelelectricitymanagement.service;
import com.sahaj.hotelelectricitymanagement.vo.Hotel;
public interface HotelService {
Hotel switchOnLight(int floorId, int subcorridorId);
Hotel monitorSubcorridorLights(int floorId, int subcorridorId);
void readMotion();
}
| [
"[email protected]"
] | |
314871816c583a82c6c80b45b2fc38b2f8d000cc | df1de4e43461047c9db1086db82412b6bc76cec2 | /src/com/link/schoolunch/CaptureActivity.java | ea34bde601efbbf92116d3f9f981fe6218521f07 | [] | no_license | Trisaa/SchoolLaunch | 9763e4453590535f0b7d3b4270d83decc942caee | d5b1f508a716ce6786cd3e619e6d3515364db3b8 | refs/heads/master | 2021-01-10T15:16:19.078071 | 2016-03-15T07:35:59 | 2016-03-15T07:35:59 | 53,924,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,604 | java | package com.link.schoolunch;
import java.io.IOException;
import java.util.Vector;
import android.app.Activity;
import android.content.res.AssetFileDescriptor;
import android.graphics.Bitmap;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.os.Bundle;
import android.os.Handler;
import android.os.Vibrator;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
import android.widget.TextView;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Result;
import com.link.schoolunch.code.camera.CameraManager;
import com.link.schoolunch.code.decoding.CaptureActivityHandler;
import com.link.schoolunch.code.decoding.InactivityTimer;
import com.link.schoolunch.code.view.ViewfinderView;
import com.link.schoolunch.model.ShopOrder;
import com.link.schoolunch.service.OrderService;
import com.link.schoolunch.util.Utils;
public class CaptureActivity extends Activity implements Callback
{
private CaptureActivityHandler handler;
private ViewfinderView viewfinderView;
private boolean hasSurface;
private Vector<BarcodeFormat> decodeFormats;
private String characterSet;
private InactivityTimer inactivityTimer;
private MediaPlayer mediaPlayer;
private boolean playBeep;
private static final float BEEP_VOLUME = 0.10f;
private boolean vibrate;
private TextView text;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.camera);
CameraManager.init(getApplication());
viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
hasSurface = false;
inactivityTimer = new InactivityTimer(this);
text = (TextView) this.findViewById( R.id.code_text );
}
@Override
protected void onResume()
{
super.onResume();
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
SurfaceHolder surfaceHolder = surfaceView.getHolder();
if (hasSurface)
{
initCamera(surfaceHolder);
}
else
{
surfaceHolder.addCallback(this);
}
decodeFormats = null;
characterSet = "UTF-8";
playBeep = true;
AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL)
{
playBeep = false;
}
initBeepSound();
vibrate = true;
}
@Override
protected void onPause()
{
super.onPause();
if (handler != null)
{
handler.quitSynchronously();
handler = null;
}
CameraManager.get().closeDriver();
}
@Override
protected void onDestroy()
{
inactivityTimer.shutdown();
super.onDestroy();
}
private void initCamera(SurfaceHolder surfaceHolder)
{
try
{
CameraManager.get().openDriver(surfaceHolder);
}
catch (IOException ioe)
{
return;
}
catch (RuntimeException e)
{
return;
}
if (handler == null)
{
handler = new CaptureActivityHandler(this, decodeFormats, characterSet);
}
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
{
}
@Override
public void surfaceCreated(SurfaceHolder holder)
{
if (!hasSurface)
{
hasSurface = true;
initCamera(holder);
}
}
@Override
public void surfaceDestroyed(SurfaceHolder holder)
{
hasSurface = false;
}
public ViewfinderView getViewfinderView()
{
return viewfinderView;
}
public Handler getHandler()
{
return handler;
}
public void drawViewfinder()
{
viewfinderView.drawViewfinder();
}
public void handleDecode(final Result obj, Bitmap barcode)
{
//inactivityTimer.onActivity();
playBeepSoundAndVibrate();
String result = obj.getText();
System.out.println(result);
String[] lists = result.split("&");
ShopOrder order = Utils.Shop_list.get( Integer.valueOf( lists[1] ) );
text.setText( order.name + "\n" + order.price + "元\n" + lists[2] );
OrderService service = new OrderService( handler );
service.execute( OrderService.finishOrder , lists[3] );
try {
Thread.sleep( 1000 );
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
handler.sendEmptyMessage( R.id.restart_preview );
}
private void initBeepSound()
{
if (playBeep && mediaPlayer == null)
{
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setOnCompletionListener(beepListener);
AssetFileDescriptor file = getResources().openRawResourceFd(R.raw.beep);
try
{
mediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
file.close();
mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
mediaPlayer.prepare();
}
catch (IOException e)
{
mediaPlayer = null;
}
}
}
private static final long VIBRATE_DURATION = 200L;
private void playBeepSoundAndVibrate()
{
if (playBeep && mediaPlayer != null)
{
mediaPlayer.start();
}
if (vibrate)
{
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
vibrator.vibrate(VIBRATE_DURATION);
}
}
/**
* When the beep has finished playing, rewind to queue up another one.
*/
private final OnCompletionListener beepListener = new OnCompletionListener()
{
public void onCompletion(MediaPlayer mediaPlayer)
{
mediaPlayer.seekTo(0);
}
};
} | [
"[email protected]"
] | |
13516776e1d51a00cb161116ffe899b2d81bfd8f | 61a7a553fa04a61738b89d192b7b83bf5728a5df | /web/src/main/java/com/pandawork/web/controller/UserController.java | a84cf3b1c63fb5245e2950554b87ce3d58deacc5 | [] | no_license | lusizhang/newFrarmwork | 54bba62602c8065b74296f639af1060a4ac4e9df | 7841da5bcac4691c72c5acb227ad538ff4f7f76f | refs/heads/master | 2021-01-01T05:28:27.350488 | 2016-04-19T15:19:57 | 2016-04-19T15:19:57 | 56,607,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,613 | java | package com.pandawork.web.controller;
import com.pandawork.common.entity.User;
import com.pandawork.core.common.exception.SSException;
import com.pandawork.core.common.log.LogClerk;
import com.pandawork.core.common.util.CommonUtil;
import com.pandawork.web.spring.AbstractController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* description:
* user: mayuan
* date: 2016/3/27
* time: 20:04
**/
@Controller
@RequestMapping(value = "")
public class UserController extends AbstractController {
@RequestMapping(value = "/listUser" ,method = RequestMethod.GET)
public String listUser(Model model){
try {
List <User> list = Collections.emptyList();
list=userService.listAll();
model.addAttribute("userList",list) ;
return "userList";
} catch (SSException ee ){
LogClerk.errLog.error(ee);
sendErrMsg(ee.getMessage());
return ADMIN_SYS_ERR_PAGE;
}
}
@RequestMapping(value = "delete" ,method = RequestMethod.GET)
public String deleteUser(@RequestParam("id") int id){
try {
userService.deleteById(id);
return "redirect:/user/listUser";
} catch (SSException ee ){
LogClerk.errLog.error(ee);
sendErrMsg(ee.getMessage());
return ADMIN_SYS_ERR_PAGE;
}
}
@RequestMapping(value = "/new" ,method = RequestMethod.POST)
public String newUser(User user, @RequestParam("password2")String password2, Model model){
try {
if (!user.getPassword().equals(password2))
{
model.addAttribute("message","密码不一致");
return "login";
}
if (userService.checkUserName(user.getUserName()))
{
model.addAttribute("message","用户名已经存在");
return "login";
}
user.setPassword(CommonUtil.md5(user.getPassword()));
userService.newUser(user);
model.addAttribute("message","success");
return "message";
} catch (SSException ee ){
LogClerk.errLog.error(ee);
sendErrMsg(ee.getMessage());
return ADMIN_SYS_ERR_PAGE;
}
}
}
| [
"[email protected]"
] | |
c4c4136b18708433862ac995901c6e8e138ccb62 | 1e20d15eeada7453e35b22172872260cfb0f92a9 | /ndtp-admin/src/main/java/ndtp/persistence/DataSmartTilingMapper.java | 5e36177703affa5ad9f30758ca1416084c2dc618 | [] | no_license | Gaia3D/ndtp | 006859fa9a9f11a37690f953d52ff7e2e0ce1cb7 | 6d0e7659128adee99e95ba3cbb5f75249a02ae6a | refs/heads/develop | 2021-06-30T00:43:49.376463 | 2021-05-12T07:14:59 | 2021-05-12T07:14:59 | 228,551,107 | 6 | 4 | null | 2020-03-31T08:14:36 | 2019-12-17T06:44:42 | JavaScript | UTF-8 | Java | false | false | 874 | java | package ndtp.persistence;
import org.springframework.stereotype.Repository;
import ndtp.domain.DataSmartTilingFileInfo;
import ndtp.domain.DataSmartTilingFileParseLog;
/**
* Smart Tiling 데이터 파일 관리
* @author jeongdae
*
*/
@Repository
public interface DataSmartTilingMapper {
/**
* Smart Tiling Data 파일 정보 등록
* @param dataSmartTilingFileInfo
* @return
*/
int insertDataSmartTilingFileInfo(DataSmartTilingFileInfo dataSmartTilingFileInfo);
/**
* Smart Tiling Data 파일 파싱 정보 등록
* @param dataSmartTilingFileParseLog
* @return
*/
int insertDataSmartTilingFileParseLog(DataSmartTilingFileParseLog dataSmartTilingFileParseLog);
/**
* Smart Tiling Data 정보 수정
* @param dataSmartTilingFileInfo
* @return
*/
int updateDataSmartTilingFileInfo(DataSmartTilingFileInfo dataSmartTilingFileInfo);
}
| [
"[email protected]"
] | |
ee395f655410af57743405924e1aedb919a09e36 | 99a11820321f8251e8f8fb1d061a5fad2fc58dcf | /src/main/java/com/apitelevisivo/model/enumerate/Genero.java | d5767667c9b076cf28032f6cae17130b8f9fe4e5 | [] | no_license | zecardoso/API-Televisivo | d6450159b18bf759690121d2a5ae0cc3f359988f | be721ebc8b5161cfe6dc919999bd79dce0a083e1 | refs/heads/master | 2022-12-19T02:56:12.042803 | 2020-09-28T12:47:07 | 2020-09-28T12:47:07 | 272,597,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java | package com.apitelevisivo.model.enumerate;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum Genero {
MASCULINO("Masculino"),
FEMININO("Feminino");
private String descricao;
} | [
"[email protected]"
] | |
22bff1ec6ac029d229b399686dfc427e8c6346d3 | ebec2c87cdd30a84201fc8ab96f85dfd2e8e9d72 | /src/main/java/com/agiles231/mokta/controller/LinkEnvelop.java | 9ef2331eed921608e432964b0335fe642b440f95 | [] | no_license | agiles231/mokta | d16478e257037779df9bb054f8bf91ab8aa4ec7a | ea2bba2a0577c230ba44f14d5ae443f8d915686a | refs/heads/master | 2022-05-27T15:22:25.165260 | 2019-10-17T00:41:26 | 2019-10-17T00:41:26 | 215,427,913 | 1 | 0 | null | 2022-05-20T21:12:05 | 2019-10-16T01:17:26 | Java | UTF-8 | Java | false | false | 307 | java | package com.agiles231.mokta.controller;
import java.net.URI;
public class LinkEnvelop extends SimpleLinkEnvelop {
private final String method;
public LinkEnvelop(URI uri, String method) {
super(uri);
this.method = method;
}
public String getMethod() {
return method;
}
}
| [
"[email protected]"
] | |
7833e6fcadbf8c1b4ffa1852e393c7ce546948a5 | b01776f4cd740ba33a7f703acedf8521d1f27215 | /src/Assignment_Day3/Interface/Student.java | 696e9d1738a4989004936709c7139e2fc3486561 | [] | no_license | mgoyal05/ZemosoJavaAssignment | 52921ef11a65cfa9e6a72ab068024a498b2a1e24 | cbd8866424c4ddab355d797987dbf0c3e191701c | refs/heads/master | 2021-01-01T18:38:50.620975 | 2017-08-24T10:26:09 | 2017-08-24T10:26:09 | 98,388,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package Assignment_Day3.Interface;
/**
* @author Manish Goyal
* A Interface of Student with two methods declared as 'name' and 'age'.
*/
public interface Student {
void name();
void age();
}
| [
"[email protected]"
] | |
93eecee7d4a01bdc811f9b2d168585e2cda9f8f6 | 6755840b4fca876c218f4be335c5c7e7b8f4fd01 | /playmysong/app/src/main/java/com/example/shibanis/mymusic/DisplayPlaylists.java | 09407fbbd76beaa2d34c9af154dec1ac831398a3 | [] | no_license | shibani-s/Music_app | e13d2e6f7bba7e164d7b2ccb44008ea579d82c5f | c871e1b869ea97dd22932ebc9c49bcc73389e384 | refs/heads/master | 2016-08-08T14:26:30.652345 | 2015-04-27T02:34:01 | 2015-04-27T02:34:01 | 33,675,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,356 | java | package com.example.shibanis.mymusic;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Created by shibanis on 4/9/2015.
*/
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
public class DisplayPlaylists extends Activity {
// Array of strings...
EditText inputName;
Set Task = new HashSet();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.displayplaylists);
//getalbumlist();
inputName = (EditText) findViewById(R.id.playlist_name);
SQLiteDatabase db = openOrCreateDatabase("se_project", MODE_PRIVATE, null);
Cursor c = db.rawQuery("SELECT * FROM playlist", null);
Set Play = new HashSet();
if (c.moveToFirst()) {
//Toast.makeText(getApplicationContext(),c.getString(0) + "",Toast.LENGTH_LONG).show();
StringBuffer buffer = new StringBuffer();
int i = 0;
while (c.moveToNext()) {
buffer.append("name : " + c.getString(0));
//------------------------------------------------------check if play has unique names..
Play.add(c.getString(0));
buffer.append("tag : " + c.getString(1) + "\n");
}
Toast.makeText(getApplicationContext(), (String) buffer.toString(),
Toast.LENGTH_LONG).show();
}
ArrayList<String> Tasks = new ArrayList<String>(Play);
// Tasks = Task.toArray(new ArrayList<String>);
ArrayAdapter adapter = new ArrayAdapter<String>(this,
R.layout.activity_listview, Tasks);
ListView listView = (ListView) findViewById(R.id.song_list);
listView.setAdapter(adapter);
// listening to single list item on click
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// selected item
String product = ((TextView) view).getText().toString();
// Launching new Activity on selecting single List Item
Intent i = new Intent(getApplicationContext(), PlayListSongs.class);
// sending data to new activity
i.putExtra("product", product);
startActivity(i);
}
});
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), add_man_playlist.class);
// sending data to new activity
String product = inputName.getText().toString();
i.putExtra("product", product);
startActivity(i);
}
});
}
}
/* public void getalbumlist() {
//retrieve song info
ContentResolver musicResolver = getContentResolver();
Uri musicUri = android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
Cursor musicCursor = musicResolver.query(musicUri, null, null, null, null);
if(musicCursor!=null && musicCursor.moveToFirst()){
//get columns
int titleColumn = musicCursor.getColumnIndex
(android.provider.MediaStore.Audio.Media.TITLE);
int idColumn = musicCursor.getColumnIndex
(android.provider.MediaStore.Audio.Media._ID);
int artistColumn = musicCursor.getColumnIndex
(android.provider.MediaStore.Audio.Media.ARTIST);
int albumColumn = musicCursor.getColumnIndex
(android.provider.MediaStore.Audio.Media.ALBUM);
int yearColumn = musicCursor.getColumnIndex
(android.provider.MediaStore.Audio.Media.YEAR);
//add songs to list
do {
// JSONParser jsonParser = new JSONParser();
long thisId = musicCursor.getLong(idColumn);
String thisTitle = musicCursor.getString(titleColumn);
String thisAlbum = musicCursor.getString(albumColumn);
// new UpdateDB(params).execute();
Task.add(thisAlbum);
}
while (musicCursor.moveToNext());
}
}*/
| [
"[email protected]"
] | |
a7869a90db87e4761af85ffdcad6f263ddbc6085 | 04e2073a20a1f9be930241d25aab5b3f60d2d921 | /src/main/java/com/luxoft/videoplayer/dao/UserRepository.java | cea7bd2b9df59d57bf09ad7d71c150aeb240a336 | [] | no_license | VasiliKnyazev/videoplayer | 0bcdc6662e562a73d453b80161cca7758a02bd4e | a915c9d862e5ae1fa2d7102fd79a7d01e2a9232b | refs/heads/master | 2023-03-07T09:53:29.076807 | 2021-02-11T07:28:47 | 2021-02-11T07:28:47 | 334,344,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java | package com.luxoft.videoplayer.dao;
import com.luxoft.videoplayer.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface UserRepository extends JpaRepository<User, Integer> {
@Query(value = "select * from users where login = :login", nativeQuery = true)
User findByLogin(@Param("login") String login);
@Query(value = "select * from users where email = :email", nativeQuery = true)
User findByEmail(@Param("email") String email);
}
| [
"[email protected]"
] | |
f35746b75f4a6b35af5e119627fb40bf543b2800 | 2bca2a944276cc963012b815612c8bdbeb89715d | /RestExample/src/RestExample/infov2/Cliente.java | b84167eeb1a7b4447611a5bd47ad608ae104de17 | [] | no_license | npgarcia/CloudMSCAll | ecada58b12d90c451189cb6555d21192761c836f | 6a01759037dde2eb42a9f016e42abade78b6afac | refs/heads/master | 2021-01-25T12:19:33.602863 | 2015-04-25T01:04:48 | 2015-04-25T01:04:48 | 30,568,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package RestExample.infov2;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Cliente {
public String id;
public String name;
public Cliente(String id, String name) {
this.id = id;
this.name = name;
}
public Cliente() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
0d3ac54636b87a62cf8e41ecb75ce6b81244b77e | 7e651dc44a5fd2b636003958d7e5a283e1828318 | /minecraft/net/minecraft/pathfinding/PathNavigateClimber.java | 4efbd032848f2151bca0dfe14917d1973f0dd3b3 | [] | no_license | Niklas61/CandyClient | b05a1edc0d360dacc84fed7944bce5dc0a873be4 | 97e317aaacdcf029b8e87960adab4251861371eb | refs/heads/master | 2023-04-24T15:48:59.747252 | 2021-05-12T16:54:32 | 2021-05-12T16:54:32 | 352,600,734 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,409 | java | package net.minecraft.pathfinding;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class PathNavigateClimber extends PathNavigateGround
{
/** Current path navigation target */
private BlockPos targetPosition;
public PathNavigateClimber(EntityLiving entityLivingIn, World worldIn)
{
super(entityLivingIn, worldIn);
}
/**
* Returns path to given BlockPos
*/
public PathEntity getPathToPos(BlockPos pos)
{
this.targetPosition = pos;
return super.getPathToPos(pos);
}
/**
* Returns the path to the given EntityLiving. Args : entity
*/
public PathEntity getPathToEntityLiving(Entity entityIn)
{
this.targetPosition = new BlockPos(entityIn);
return super.getPathToEntityLiving(entityIn);
}
/**
* Try to find and set a path to EntityLiving. Returns true if successful. Args : entity, speed
*/
public boolean tryMoveToEntityLiving(Entity entityIn, double speedIn)
{
PathEntity pathentity = this.getPathToEntityLiving(entityIn);
if (pathentity != null)
{
return this.setPath(pathentity, speedIn);
}
else
{
this.targetPosition = new BlockPos(entityIn);
this.speed = speedIn;
return true;
}
}
public void onUpdateNavigation()
{
if (!this.noPath())
{
super.onUpdateNavigation();
}
else
{
if (this.targetPosition != null)
{
double d0 = this.theEntity.width * this.theEntity.width;
if (this.theEntity.getDistanceSqToCenter(this.targetPosition) >= d0 && (this.theEntity.posY <= (double)this.targetPosition.getY() || this.theEntity.getDistanceSqToCenter(new BlockPos(this.targetPosition.getX(), MathHelper.floor_double(this.theEntity.posY), this.targetPosition.getZ())) >= d0))
{
this.theEntity.getMoveHelper().setMoveTo( this.targetPosition.getX() , this.targetPosition.getY() , this.targetPosition.getZ() , this.speed);
}
else
{
this.targetPosition = null;
}
}
}
}
}
| [
"[email protected]"
] | |
3e3d94c06f94e886e5894ce305b8c401ac63c9d1 | 466ad3742cf7702ff6c6daf891f263833747e915 | /src/api/org/openhouse/api/service/impl/ConceptServiceImpl.java | 9ab550449eb7082a4c78648c58ad4ef14cd423db | [] | no_license | prediator/opennyumba | 7d4c7aecf18665e59c10cbd2263111c9873c9b3d | e6e950a61610246a8c6c648226dcb55d46f0c832 | refs/heads/master | 2021-01-10T04:37:56.442566 | 2011-01-12T11:51:26 | 2011-01-12T11:51:26 | 54,891,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,202 | java | package org.openhouse.api.service.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.Vector;
import org.openhouse.api.context.Context;
import org.openhouse.api.dao.ConceptDAO;
import org.openhouse.api.dao.HouseholdDAO;
import org.openhouse.api.database.model.Concept;
import org.openhouse.api.database.model.ConceptAnswer;
import org.openhouse.api.database.model.ConceptClass;
import org.openhouse.api.database.model.ConceptComplex;
import org.openhouse.api.database.model.ConceptDatatype;
import org.openhouse.api.database.model.ConceptName;
import org.openhouse.api.database.model.ConceptNameTag;
import org.openhouse.api.database.model.ConceptNumeric;
import org.openhouse.api.database.model.ConceptSet;
import org.openhouse.api.exception.APIException;
import org.openhouse.api.exception.ConceptNameInUseException;
import org.openhouse.api.exception.ConceptsLockedException;
import org.openhouse.api.service.ConceptService;
import org.openhouse.util.LocaleUtility;
import org.openhouse.util.OpenhouseConstants;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.BindException;
import org.springframework.validation.Errors;
public class ConceptServiceImpl implements ConceptService {
private ConceptDAO dao;
private static Concept trueConcept;
private static Concept falseConcept;
public ConceptServiceImpl() {
super();
}
public ConceptDAO getDao() {
return dao;
}
public void setDao(ConceptDAO dao) {
this.dao = dao;
}
public void checkIfLocked() throws ConceptsLockedException {
String locked = Context.getAdministrationService().getGlobalProperty(
OpenhouseConstants.GLOBAL_PROPERTY_CONCEPTS_LOCKED, "false");
if (locked.toLowerCase().equals("true"))
throw new ConceptsLockedException();
}
@Override
public List<ConceptClass> getAllConceptClasses() throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<ConceptClass> getAllConceptClasses(boolean includeRetired)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<ConceptDatatype> getAllConceptDatatypes() throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<ConceptDatatype> getAllConceptDatatypes(boolean includeRetired)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Concept> getAllConcepts() throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Concept> getAllConcepts(String sortBy, boolean asc,
boolean includeRetired) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public Concept getConcept(Integer conceptId) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public Concept getConcept(String conceptIdOrName) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptAnswer getConceptAnswerByUuid(String uuid) {
// TODO Auto-generated method stub
return null;
}
@Override
public Concept getConceptByName(String name) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public Concept getConceptByUuid(String uuid) {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptClass getConceptClass(Integer conceptClassId)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptClass getConceptClassByName(String name) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptClass getConceptClassByUuid(String uuid) {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptComplex getConceptComplex(Integer conceptId) {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptDatatype getConceptDatatype(Integer i) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptDatatype getConceptDatatypeByName(String name)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptDatatype getConceptDatatypeByUuid(String uuid) {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptName getConceptName(Integer conceptNameId)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptName getConceptNameByUuid(String uuid) {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptNameTag getConceptNameTagByUuid(String uuid) {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptNumeric getConceptNumeric(Integer conceptId)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptNumeric getConceptNumericByUuid(String uuid) {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptSet getConceptSetByUuid(String uuid) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<ConceptSet> getConceptSetsByConcept(Concept concept)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Concept> getConceptsByAnswer(Concept concept)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Concept> getConceptsByClass(ConceptClass cc)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Concept> getConceptsByConceptSet(Concept concept)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Concept> getConceptsByName(String name) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public Concept getNextConcept(Concept concept) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public Concept getPrevConcept(Concept concept) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<ConceptSet> getSetsContainingConcept(Concept concept)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean hasAnyObservation(ConceptName conceptName) throws APIException {
List<ConceptName> conceptNames = new Vector<ConceptName>();
conceptNames.add(conceptName);
Integer count = Context.getObsService().getObservationCount(conceptNames, true);
return count > 0;
}
@Override
public void purgeConcept(Concept concept) throws APIException {
checkIfLocked();
if (concept.getConceptId() != null) {
for (ConceptName conceptName : concept.getNames()) {
if (hasAnyObservation(conceptName))
throw new ConceptNameInUseException("Can't delete concept with id : " + concept.getConceptId()
+ " because it has a name '" + conceptName.getName()
+ "' which is being used by some observation(s)");
}
}
dao.purgeConcept(concept);
}
@Override
public void purgeConceptClass(ConceptClass cc) throws APIException {
// TODO Auto-generated method stub
}
@Override
public void purgeConceptDatatype(ConceptDatatype cd) throws APIException {
// TODO Auto-generated method stub
}
/*
*
*/
@Override
public boolean hasAnyObservation(Concept concept) {
List<Concept> concepts = new Vector<Concept>();
concepts.add(concept);
Integer count = Context.getObsService().getObservationCount(null, null, concepts, null, null, null, null, null,
null, true);
return count > 0;
}
@Override
public Concept retireConcept(Concept conceptOrConceptNumeric, String reason)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public Concept saveConcept(Concept concept) throws APIException {
return null;
}
@Override
public ConceptClass saveConceptClass(ConceptClass cc) throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public ConceptDatatype saveConceptDatatype(ConceptDatatype cd)
throws APIException {
// TODO Auto-generated method stub
return null;
}
@Override
public void setConceptDAO(ConceptDAO dao) {
// TODO Auto-generated method stub
}
@Override
public void updateConceptSetDerived(Concept concept) throws APIException {
// TODO Auto-generated method stub
}
@Override
public void updateConceptSetDerived() throws APIException {
// TODO Auto-generated method stub
}
}
| [
"Administrator@localhost"
] | Administrator@localhost |
216c1467235ba15e817f0395bd0b09a0f74b099a | cf4aa60a486f77723723bb6e4b3e022f8cda0087 | /src/main/java/kr/or/nko/certificate/controller/CertificateController.java | bf93c5ac8a82f26a1025b3d717a3b8bc53a45bbf | [] | no_license | shrtm1017/lastProject | 7fad45464ac742e6bfed059f9af99b76d14c697d | 91ae32683fd4164c18c87eb4edd39ab9ae7d7f7a | refs/heads/master | 2020-05-20T11:58:15.901365 | 2019-05-09T00:33:17 | 2019-05-09T00:33:17 | 185,561,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,963 | java | package kr.or.nko.certificate.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import kr.or.nko.certificate.model.CertificateDivVo;
import kr.or.nko.certificate.model.CertificateVo;
import kr.or.nko.certificate.service.ICertificateService;
import kr.or.nko.department.model.DepartmentVo;
import kr.or.nko.department.service.IDepartmentService;
import kr.or.nko.employee.model.EmployeeVo;
import kr.or.nko.util.UtilNKO;
import kr.or.nko.util.model.PageVo;
@Controller
public class CertificateController {
private Logger logger = LoggerFactory.getLogger(CertificateController.class);
@Resource(name="certificateService")
private ICertificateService certificateService;
@Resource(name="departmentService")
private IDepartmentService departmentService;
@Resource(name="utilNKO")
private UtilNKO utilNKO;
// list
@RequestMapping(path="ctfList", method=RequestMethod.GET)
public String certificateList(HttpSession session, Model model,PageVo pageVo){
List<CertificateDivVo> crtDivList = certificateService.selectCrtDivList();
model.addAttribute("crtDivList", crtDivList);
//list 뽑아주는 거 하나
utilNKO.certificatePaging("1", model, pageVo, new CertificateVo(), session);
return "certificateList";
}
@RequestMapping(path="ctfList", method=RequestMethod.POST)
public String certificateList_post(HttpSession session, Model model){
return "certificateList";
}
// 검색시
@RequestMapping(path="searchList", method=RequestMethod.GET)
public String certificateSearchList(HttpSession session, Model model,PageVo pageVo,
@RequestParam("crt_div_sq") int crt_div_sq,
@RequestParam("crt_whether") String crt_whether
){
List<CertificateDivVo> crtDivList = certificateService.selectCrtDivList();
model.addAttribute("crtDivList", crtDivList);
logger.debug("증명서 구분번호 : {}" , crt_div_sq);
logger.debug("증명서 상태 : {}" , crt_whether);
CertificateVo certificateVo = new CertificateVo();
if(crt_div_sq == 1){
certificateVo.setCrt_div_sq(crt_div_sq);
}
if(crt_div_sq == 2){
certificateVo.setCrt_div_sq(crt_div_sq);
}
if(crt_whether.equals("1")){
certificateVo.setCrt_whether(crt_whether);
}
if(crt_whether.equals("2")){
certificateVo.setCrt_whether(crt_whether);
}
if(crt_whether.equals("3")){
certificateVo.setCrt_whether(crt_whether);
}
model.addAttribute("crt_div_sq", crt_div_sq);
model.addAttribute("crt_whether", crt_whether);
//list 뽑아주는 거 하나
utilNKO.certificatePaging("2", model, pageVo, certificateVo, session);
return "certificateList";
}
//신청
@RequestMapping(path="/certificateapply",method=RequestMethod.GET)
public String form(HttpSession session, Model model){
EmployeeVo empVo = (EmployeeVo) session.getAttribute("employeeVo");
List<DepartmentVo> getalllist = departmentService.getAllDepartment();
List<DepartmentVo> getallnulllist = departmentService.selectDepartNull();
model.addAttribute("empVo", empVo);
model.addAttribute("alllist", getalllist);
model.addAttribute("allnulllist", getallnulllist);
return "certificateapply";
}
@RequestMapping(path="/certificateapply",method=RequestMethod.POST)
public String form_post(HttpSession session, Model model,
@RequestParam("crt_dt") String crt_dt,@RequestParam("crt_div_sq") String crt_div_sq,
@RequestParam("crt_emp_dpt") String emp_dpt,@RequestParam("crt_emp_grade") String emp_grade,
@RequestParam("crt_emp_phone") String emp_phone,@RequestParam("crt_emp_nm") String emp_nm,
@RequestParam("crt_dos_str") String crt_dos_str,@RequestParam("crt_dos_end") String crt_dos_end,
@RequestParam("crt_emp_addr1") String emp_addr1,@RequestParam("crt_emp_addr2") String emp_addr2,
@RequestParam("crt_purpose") String crt_purpose,@RequestParam("crt_submission") String crt_submission,
@RequestParam("crt_subdt") String crt_subdt) throws ParseException{
EmployeeVo empvo = (EmployeeVo) session.getAttribute("employeeVo");
logger.debug("신청일 : {}",crt_dt);
logger.debug("증명서구분번호 : {}",crt_div_sq);
logger.debug("사원부서번호 : {}",emp_dpt);
logger.debug("사원직급 : {}",emp_grade);
logger.debug("핸드폰 : {}",emp_phone);
logger.debug("이름 : {}", emp_nm);
logger.debug("입사일 : {}",crt_dos_str);
logger.debug("톼사ㅣ일 : {}",crt_dos_end);
logger.debug("주소 : {}",emp_addr1);
logger.debug("상세주소 : {}",emp_addr2);
logger.debug("용도 : {}",crt_purpose);
logger.debug("제출처 : {}",crt_submission);
logger.debug("제출예정일 : {}",crt_subdt);
logger.debug("사원번호 : {}",empvo.getEmp_sq());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
CertificateVo certificateVo = new CertificateVo();
certificateVo.setCrt_emp_sq(empvo.getEmp_sq()); // 사원번호
certificateVo.setCrt_div_sq(Integer.parseInt(crt_div_sq)); // 증명서 구분번호
certificateVo.setCrt_dt(sdf.parse(crt_dt)); // 증명서 신청일
certificateVo.setCrt_whether("1"); // 처음은 무조건 1: 승인대기 2: 발급완료 3:반려
certificateVo.setCrt_emp_dpt(Integer.parseInt(emp_dpt)); // 사원부서
certificateVo.setCrt_emp_grade(Integer.parseInt(emp_grade)); // 사원직급
certificateVo.setCrt_emp_phone(emp_phone); // 사원 핸드폰번호
certificateVo.setCrt_emp_nm(emp_nm); // 사원 이름
certificateVo.setCrt_dos_str(sdf.parse(crt_dos_str)); // 입사일
certificateVo.setCrt_dos_end(sdf.parse(crt_dos_end)); // 퇴사일
certificateVo.setCrt_emp_addr1(emp_addr1);// 사원주소
certificateVo.setCrt_emp_addr2(emp_addr2);// 사원 주소
certificateVo.setCrt_submission(crt_submission); // 제출처
certificateVo.setCrt_subdt(sdf.parse(crt_subdt)); // 제출 예정일
certificateVo.setCrt_con(crt_purpose); // 제출용도 1:일반용 2: 회사제출 3:공공기관 4:금융기관
int insert = certificateService.insertCrt(certificateVo);
if(insert == 1){
return "redirect:/ctfList";
}else{
return "certificateapply";
}
}
@RequestMapping(path="crtStateUpdate",produces={"application/json"})
@ResponseBody
public CertificateVo stateupdate(@RequestBody CertificateVo certificateVo,HttpSession session) throws ParseException{
EmployeeVo empvo = (EmployeeVo) session.getAttribute("employeeVo");
int crt_emp_sq = empvo.getEmp_sq();
CertificateVo crtVo = certificateService.select_Crtdetail(certificateVo.getCrt_sq());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
Date time = new Date();
String today = sdf.format(time);
crtVo.setCrt_emp_app_sq(crt_emp_sq); // 관리자 아이디
crtVo.setCrt_sign_dt(sdf.parse(today)); // 승인한 오늘날짜
if(certificateVo.getCrt_whether().equals("2")){ // 2: 승인
crtVo.setCrt_whether("2");
}if(certificateVo.getCrt_whether().equals("3")){ // 3: 반려
crtVo.setCrt_whether("3");
}
int update = certificateService.updateCrt(crtVo);
return crtVo;
}
//다운로드를 어디서 해야할까요?
}
| [
"[email protected]"
] | |
97e733976e49b1c4bd3fe972822edcb6f390adbc | 2564453f2e78d5c856ea12ceed2685cb95effd8d | /wavelabs-mobile-automation-framework-master-master/src/main/java/com/wavelabs/appium/reports/Loggers.java | c067deaa9aac6d3bef6ba427f135b96e5a357832 | [] | no_license | vivekbrahmadandi/Automation-Framework | c469540d030ff6d80ebe1000607a82f0e00f88b2 | c5bec957dfacb83553c28c3e565f3b820adc0719 | refs/heads/master | 2022-09-28T18:02:08.004267 | 2020-05-21T06:01:45 | 2020-05-21T06:01:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,542 | java | package com.wavelabs.appium.reports;
import com.wavelabs.appium.utils.ConfigFileReader;
import org.apache.log4j.Logger;
import org.testng.Reporter;
import com.epam.reportportal.service.ReportPortal;
import com.aventstack.extentreports.Status;
import com.wavelabs.appium.base.BasePage;
import java.io.File;
import java.util.Calendar;
import static com.wavelabs.appium.base.BasePage.captureScreenshot;
public class Loggers {
public static Logger log = BasePage.log;
/**
* Logs a message to the system.out, and the Test Reporter.
*
* @param inMessage
*/
public static void logInfoMessage(String inMessage) {
String consoleMessage = inMessage;
ReportPortal.emitLog(inMessage, "DEBUG", Calendar.getInstance().getTime());
Reporter.log(inMessage);
if (BasePage.test != null) {
BasePage.test.log(Status.INFO, inMessage);
}
}
public static void logWarningMessage(String inMessage) {
String consoleMessage = inMessage;
ReportPortal.emitLog(inMessage, "WARN", Calendar.getInstance().getTime());
Reporter.log(inMessage);
if (BasePage.test != null) {
BasePage.test.log(Status.INFO, inMessage);
}
}
public static void logInfoMessageWithScreenshot(String inMessage) {
String consoleMessage = inMessage;
if(ConfigFileReader.ConfigProperties.SCREENSHOT_ON_PASS){
String screenpath = captureScreenshot("rp_screenshot");
File screenshot = new File(screenpath);
ReportPortal.emitLog(inMessage, "INFO", Calendar.getInstance().getTime(), screenshot);
}else{
ReportPortal.emitLog(inMessage, "INFO", Calendar.getInstance().getTime());
}
Reporter.log(inMessage);
if (BasePage.test != null) {
BasePage.test.log(Status.INFO, inMessage);
}
}
public static void logErrorMessage(String inMessage, Boolean bold) {
String reportMessage = inMessage;
String consoleMessage = inMessage;
if (bold) {
reportMessage = "<strong>" + inMessage + "</strong>";
}
String screenpath = captureScreenshot("rp_screenshot");
File screenshot = new File(screenpath);
ReportPortal.emitLog(inMessage, "ERROR", Calendar.getInstance().getTime(), screenshot);
log.error(consoleMessage);
Reporter.log(reportMessage);
if (BasePage.test != null) {
BasePage.test.log(Status.INFO, reportMessage);
}
}
}
| [
"[email protected]"
] | |
85975d9f6cad0bed8a66fb2b3915dcaaa89c5c85 | 131feda406a5ba8a84db09d23abe23cc7c57684a | /practice/src/BinaryConversion.java | f6d1233f00ab1d4e8ad921af896a81044e9b1c69 | [] | no_license | SeriouslyJHD/mygithub | f37685b0c0e593fff61b54b19d6d0eaeee083d01 | 3b7534d7dc5de1d949448f1d33fbb9374b63f209 | refs/heads/master | 2020-04-28T20:52:03.479978 | 2019-03-14T06:21:10 | 2019-03-14T06:21:59 | 175,559,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | import java.util.Scanner;
/*进制转换
输入一个十进制数 N,将它转换成 R 进制数输出。
在 10≤R≤16的情况下,用'A'表示 10,用'B'表示 11,用'C'表示 12,用'D'表示 13,用'E'表示 14,用'F'表示 15。
输入格式
输入包含两个整数 N(N≤10000) 和 R(2≤R≤16)。
注意,N 有可能是负整数。
输出格式
输出一行,表示转换后的数。
样例输入
23 12
样例输出
1B */
public class BinaryConversion {
public static void main(String []args){
input();
}
static void input(){
Scanner sc = new Scanner(System.in);
while(sc.hasNext())
{
int n=sc.nextInt();
int x=sc.nextInt();
System.out.println(Integer.toString(n,x).toUpperCase());
}
}
}
| [
"[email protected]"
] | |
b69c0ed97b12aff805a1c7a9072b438798d45a55 | 7cdfdef4d91690b6708ee88821cd810f766b76a8 | /app/src/main/java/com/eaccid/hocreader/presentation/memorizing/cardremember/CardWordPresenter.java | 489e7801469022b91270b25ad3931381a5dba1ad | [] | no_license | haffling/HocReader | 3e6ef0ec252431baacee67c0531508361f16e7f6 | 6353a8be9a603a1cac78cdf8f22c768123235616 | refs/heads/master | 2021-01-21T17:29:10.603573 | 2017-03-20T19:40:49 | 2017-03-20T19:40:49 | 85,605,124 | 0 | 0 | null | 2017-03-20T17:17:51 | 2017-03-20T17:17:51 | null | UTF-8 | Java | false | false | 1,324 | java | package com.eaccid.hocreader.presentation.memorizing.cardremember;
import android.util.Log;
import com.eaccid.hocreader.data.local.AppDatabaseManager;
import com.eaccid.hocreader.data.local.db.entity.Word;
import com.eaccid.hocreader.App;
import com.eaccid.hocreader.presentation.BasePresenter;
import com.eaccid.hocreader.provider.db.words.WordItem;
import com.eaccid.hocreader.provider.db.words.WordItemImpl;
import javax.inject.Inject;
public class CardWordPresenter implements BasePresenter<CardWordActivity> {
private final String logTAG = "CardWordPresenter";
private CardWordActivity mView;
@Inject
AppDatabaseManager databaseManager;
@Override
public void attachView(CardWordActivity cardWordActivity) {
mView = cardWordActivity;
App.get(mView).getAppComponent().inject(this);
Log.i(logTAG, "CardWordActivity has been attached.");
}
@Override
public void detachView() {
Log.i(logTAG, "CardWordActivity has been detached.");
mView = null;
}
public void onViewCreate() {
mView.setDataToView(getWordItem());
}
private WordItem getWordItem() {
Word word = databaseManager.getWord(mView.getWord());
if (word == null)
word = new Word();
return new WordItemImpl(word);
}
}
| [
"[email protected]"
] | |
4a7a0c78f2da7a1060e3a732dc9d44f192c21cf5 | 9b683eeb8df6975dd90825c1ecf075ec94fe8056 | /src/main/java/br/edu/unievangelica/core/enums/SexoEnum.java | 9c0082a0fa315f6b3e5206215e2693e336273fb0 | [] | no_license | SamuelDourado/Aula-ProgWeb-Back- | c639e6eeac4c322b182bb0a0109836c08c5a5d7f | 605e62dfc0b70b47031f9b5fc0cd08a45a6bdc3e | refs/heads/master | 2021-06-24T16:07:24.938702 | 2020-09-24T13:04:20 | 2020-09-24T13:04:20 | 129,319,166 | 0 | 0 | null | 2020-09-24T13:12:50 | 2018-04-12T22:46:56 | Java | UTF-8 | Java | false | false | 253 | java | package br.edu.unievangelica.core.enums;
public enum SexoEnum {
/* SEXO MASCULINO */
MASCULINO("mensagem.masculino"),
/* SEXO FEMININO */
FEMININO("mensagem.feminino");
public String nome;
SexoEnum(String nome) {
this.nome = nome;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.