hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 1
value | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 5
1.02k
| max_stars_repo_name
stringlengths 4
126
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
list | max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 5
1.02k
| max_issues_repo_name
stringlengths 4
114
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
list | max_issues_count
float64 1
92.2k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 5
1.02k
| max_forks_repo_name
stringlengths 4
136
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
list | max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | avg_line_length
float64 2.55
99.9
| max_line_length
int64 3
1k
| alphanum_fraction
float64 0.25
1
| index
int64 0
1M
| content
stringlengths 3
1.05M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3e07993568d247c992e8f76737030ecb3308c30a
| 18,547 |
java
|
Java
|
tests/generations/rmosa/tests/s1002/69_lhamacaw/evosuite-tests/macaw/businessLayer/SupportingDocument_ESTest.java
|
sealuzh/termite-replication
|
1636b1973c8692ed6a818e323cd1dd826cabbad3
|
[
"MIT"
] | null | null | null |
tests/generations/rmosa/tests/s1002/69_lhamacaw/evosuite-tests/macaw/businessLayer/SupportingDocument_ESTest.java
|
sealuzh/termite-replication
|
1636b1973c8692ed6a818e323cd1dd826cabbad3
|
[
"MIT"
] | 3 |
2020-11-16T20:40:56.000Z
|
2021-03-23T00:18:04.000Z
|
tests/generations/rmosa/tests/s1002/69_lhamacaw/evosuite-tests/macaw/businessLayer/SupportingDocument_ESTest.java
|
sealuzh/termite-replication
|
1636b1973c8692ed6a818e323cd1dd826cabbad3
|
[
"MIT"
] | null | null | null | 34.602612 | 176 | 0.710627 | 3,218 |
/*
* This file was automatically generated by EvoSuite
* Sun Nov 08 04:20:31 GMT 2020
*/
package macaw.businessLayer;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.util.ArrayList;
import macaw.businessLayer.SupportingDocument;
import macaw.businessLayer.User;
import macaw.system.MacawChangeEvent;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class SupportingDocument_ESTest extends SupportingDocument_ESTest_scaffolding {
/**
//Test case number: 0
/*Coverage entropy=1.6674619334292948
*/
@Test(timeout = 4000)
public void test00() throws Throwable {
User user0 = new User();
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setDescription((String) null);
// Undeclared exception!
try {
SupportingDocument.detectFieldChanges(user0, supportingDocument0, supportingDocument0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
}
}
/**
//Test case number: 1
/*Coverage entropy=1.9459347757561138
*/
@Test(timeout = 4000)
public void test01() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
SupportingDocument supportingDocument1 = new SupportingDocument();
User user0 = new User(",", ",");
supportingDocument0.setDocumentCode(",");
ArrayList<MacawChangeEvent> arrayList0 = SupportingDocument.detectFieldChanges(user0, supportingDocument1, supportingDocument0);
assertEquals(0, supportingDocument1.getIdentifier());
assertFalse(supportingDocument1.isNewRecord());
assertEquals(1, arrayList0.size());
}
/**
//Test case number: 2
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test02() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setTitle((String) null);
supportingDocument0.getTitle();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 3
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test03() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setTitle("vOYnV/aIUz");
supportingDocument0.getTitle();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 4
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test04() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setIdentifier((-1560));
int int0 = supportingDocument0.getIdentifier();
assertEquals("-1560", supportingDocument0.getDisplayItemIdentifier());
assertEquals((-1560), int0);
}
/**
//Test case number: 5
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test05() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setFilePath((String) null);
supportingDocument0.getFilePath();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 6
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test06() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setFileName((String) null);
supportingDocument0.getFileName();
assertFalse(supportingDocument0.isNewRecord());
assertEquals(0, supportingDocument0.getIdentifier());
}
/**
//Test case number: 7
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test07() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setFileName("<aA");
supportingDocument0.getFileName();
assertFalse(supportingDocument0.isNewRecord());
assertEquals(0, supportingDocument0.getIdentifier());
}
/**
//Test case number: 8
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test08() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setDocumentCode((String) null);
supportingDocument0.getDocumentCode();
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
assertFalse(supportingDocument0.isNewRecord());
}
/**
//Test case number: 9
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test09() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setDocumentCode("%");
supportingDocument0.getDocumentCode();
assertEquals(0, supportingDocument0.getIdentifier());
assertFalse(supportingDocument0.isNewRecord());
}
/**
//Test case number: 10
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test10() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setDescription((String) null);
supportingDocument0.getDescription();
assertFalse(supportingDocument0.isNewRecord());
assertEquals(0, supportingDocument0.getIdentifier());
}
/**
//Test case number: 11
/*Coverage entropy=1.5607104090414063
*/
@Test(timeout = 4000)
public void test11() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setDocumentCode((String) null);
// Undeclared exception!
try {
SupportingDocument.validateFields(supportingDocument0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("macaw.util.ValidationUtility", e);
}
}
/**
//Test case number: 12
/*Coverage entropy=1.5607104090414063
*/
@Test(timeout = 4000)
public void test12() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
User user0 = new User();
supportingDocument0.setDocumentCode((String) null);
// Undeclared exception!
try {
SupportingDocument.detectFieldChanges(user0, supportingDocument0, supportingDocument0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
}
}
/**
//Test case number: 13
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test13() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
int int0 = supportingDocument0.getIdentifier();
assertFalse(supportingDocument0.isNewRecord());
assertEquals(0, int0);
}
/**
//Test case number: 14
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test14() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.getTitle();
assertFalse(supportingDocument0.isNewRecord());
assertEquals(0, supportingDocument0.getIdentifier());
}
/**
//Test case number: 15
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test15() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.getFilePath();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 16
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test16() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.getDescription();
assertEquals(0, supportingDocument0.getIdentifier());
assertFalse(supportingDocument0.isNewRecord());
}
/**
//Test case number: 17
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test17() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.getDocumentCode();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 18
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test18() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setIdentifier(1152);
int int0 = supportingDocument0.getIdentifier();
assertEquals("1152", supportingDocument0.getDisplayItemIdentifier());
assertEquals(1152, int0);
}
/**
//Test case number: 19
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test19() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.getFileName();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 20
/*Coverage entropy=1.9459347757561138
*/
@Test(timeout = 4000)
public void test20() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
SupportingDocument supportingDocument1 = new SupportingDocument();
supportingDocument0.setFilePath("-");
User user0 = new User(",", ",");
ArrayList<MacawChangeEvent> arrayList0 = SupportingDocument.detectFieldChanges(user0, supportingDocument1, supportingDocument0);
assertEquals(0, supportingDocument1.getIdentifier());
assertEquals(1, arrayList0.size());
assertFalse(supportingDocument1.isNewRecord());
}
/**
//Test case number: 21
/*Coverage entropy=1.9459347757561138
*/
@Test(timeout = 4000)
public void test21() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
SupportingDocument supportingDocument1 = new SupportingDocument();
supportingDocument0.setFileName("-");
User user0 = new User(",", ",");
ArrayList<MacawChangeEvent> arrayList0 = SupportingDocument.detectFieldChanges(user0, supportingDocument1, supportingDocument0);
assertEquals(0, supportingDocument1.getIdentifier());
assertFalse(supportingDocument1.isNewRecord());
assertEquals(1, arrayList0.size());
}
/**
//Test case number: 22
/*Coverage entropy=1.9459347757561138
*/
@Test(timeout = 4000)
public void test22() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
SupportingDocument supportingDocument1 = new SupportingDocument();
supportingDocument1.setDocumentCode("-");
User user0 = new User(",", ",");
ArrayList<MacawChangeEvent> arrayList0 = SupportingDocument.detectFieldChanges(user0, supportingDocument1, supportingDocument0);
assertEquals(0, supportingDocument1.getIdentifier());
assertFalse(supportingDocument1.isNewRecord());
assertEquals(1, arrayList0.size());
}
/**
//Test case number: 23
/*Coverage entropy=1.9459347757561138
*/
@Test(timeout = 4000)
public void test23() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
SupportingDocument supportingDocument1 = new SupportingDocument();
User user0 = new User("-", "-");
supportingDocument0.setTitle(",");
ArrayList<MacawChangeEvent> arrayList0 = SupportingDocument.detectFieldChanges(user0, supportingDocument0, supportingDocument1);
assertEquals(1, arrayList0.size());
assertFalse(supportingDocument1.isNewRecord());
assertEquals(0, supportingDocument1.getIdentifier());
}
/**
//Test case number: 24
/*Coverage entropy=1.8937882323911377
*/
@Test(timeout = 4000)
public void test24() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setFileName("<aA");
supportingDocument0.setTitle("d [g>:tW@G=a^2");
supportingDocument0.setDocumentCode("<aA");
SupportingDocument.validateFields(supportingDocument0);
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 25
/*Coverage entropy=1.4205719259467045
*/
@Test(timeout = 4000)
public void test25() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setFileName("@wr4>n%xSAk$09%@");
try {
SupportingDocument.validateFields(supportingDocument0);
fail("Expecting exception: Exception");
} catch(Exception e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("macaw.businessLayer.SupportingDocument", e);
}
}
/**
//Test case number: 26
/*Coverage entropy=1.4205719259467042
*/
@Test(timeout = 4000)
public void test26() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setDocumentCode("<aA");
try {
SupportingDocument.validateFields(supportingDocument0);
fail("Expecting exception: Exception");
} catch(Exception e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("macaw.businessLayer.SupportingDocument", e);
}
}
/**
//Test case number: 27
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test27() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
String string0 = supportingDocument0.getDisplayItemIdentifier();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", string0);
}
/**
//Test case number: 28
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test28() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
assertFalse(supportingDocument0.isNewRecord());
supportingDocument0.setIsNewRecord(true);
boolean boolean0 = supportingDocument0.isNewRecord();
assertTrue(boolean0);
}
/**
//Test case number: 29
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test29() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
boolean boolean0 = supportingDocument0.isNewRecord();
assertFalse(boolean0);
assertEquals(0, supportingDocument0.getIdentifier());
}
/**
//Test case number: 30
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test30() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
String string0 = supportingDocument0.getDisplayName();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("-", string0);
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 31
/*Coverage entropy=1.9459347757561138
*/
@Test(timeout = 4000)
public void test31() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
SupportingDocument supportingDocument1 = new SupportingDocument();
User user0 = new User();
supportingDocument0.setDescription(",");
ArrayList<MacawChangeEvent> arrayList0 = SupportingDocument.detectFieldChanges(user0, supportingDocument0, supportingDocument1);
assertFalse(supportingDocument1.isNewRecord());
assertEquals(1, arrayList0.size());
assertEquals(0, supportingDocument1.getIdentifier());
}
/**
//Test case number: 32
/*Coverage entropy=2.0794415416798357
*/
@Test(timeout = 4000)
public void test32() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
SupportingDocument supportingDocument1 = (SupportingDocument)supportingDocument0.clone();
assertFalse(supportingDocument1.isNewRecord());
assertEquals("0", supportingDocument1.getDisplayItemIdentifier());
assertNotSame(supportingDocument1, supportingDocument0);
}
/**
//Test case number: 33
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test33() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setFilePath("UNABLE_TO_UPDATE_CATEGORY");
supportingDocument0.getFilePath();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 34
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test34() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
supportingDocument0.setDescription("y");
supportingDocument0.getDescription();
assertFalse(supportingDocument0.isNewRecord());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
}
/**
//Test case number: 35
/*Coverage entropy=1.666332585328325
*/
@Test(timeout = 4000)
public void test35() throws Throwable {
SupportingDocument supportingDocument0 = new SupportingDocument();
User user0 = new User();
ArrayList<MacawChangeEvent> arrayList0 = SupportingDocument.detectFieldChanges(user0, supportingDocument0, supportingDocument0);
assertEquals(0, arrayList0.size());
assertEquals("0", supportingDocument0.getDisplayItemIdentifier());
assertFalse(supportingDocument0.isNewRecord());
}
}
|
3e07994a7477195704767e06f9e2a1abc93d234a
| 2,125 |
java
|
Java
|
src/test/java/net/andreinc/mockneat/unit/user/UsersTest.java
|
varzay-abbas/datagenerate
|
9e90cac69f6d68bafbaa63a7fab0439a659bd40a
|
[
"Apache-2.0"
] | 1 |
2021-02-19T11:45:21.000Z
|
2021-02-19T11:45:21.000Z
|
src/test/java/net/andreinc/mockneat/unit/user/UsersTest.java
|
varzay-abbas/datagenerate
|
9e90cac69f6d68bafbaa63a7fab0439a659bd40a
|
[
"Apache-2.0"
] | null | null | null |
src/test/java/net/andreinc/mockneat/unit/user/UsersTest.java
|
varzay-abbas/datagenerate
|
9e90cac69f6d68bafbaa63a7fab0439a659bd40a
|
[
"Apache-2.0"
] | null | null | null | 44.270833 | 125 | 0.769882 | 3,219 |
package net.andreinc.mockneat.unit.user;
/**
* Copyright 2017, Andrei N. Ciobanu
Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE.
*/
import net.andreinc.mockneat.types.enums.UserNameType;
import org.junit.Test;
import static net.andreinc.mockneat.Constants.M;
import static net.andreinc.mockneat.types.enums.PassStrengthType.MEDIUM;
import static net.andreinc.mockneat.types.enums.PassStrengthType.WEAK;
import static net.andreinc.mockneat.unit.text.Formatter.fmt;
import static net.andreinc.mockneat.unit.user.Emails.emails;
import static net.andreinc.mockneat.unit.user.Passwords.passwords;
public class UsersTest {
@Test(expected = NullPointerException.class)
public void testUsersTypeNull() throws Exception {
M.users().type(null).val();
}
@Test(expected = NullPointerException.class)
public void testUsersTypesNull() throws Exception {
UserNameType[] types = null;
M.users().types(types).val();
}
@Test(expected = IllegalArgumentException.class)
public void testUsersTypesEmpty() throws Exception {
M.users().types(new UserNameType[]{}).val();
}
}
|
3e0799a4337a7c78393008a19e907fc12152956f
| 1,981 |
java
|
Java
|
Team406/src/main/java/org/firstinspires/ftc/team406/oldOpModes/PhotoHandler.java
|
PsouthRobotics1182/FTC16-17
|
93b066954decbd20454c42099cca9571ffd108a1
|
[
"MIT"
] | null | null | null |
Team406/src/main/java/org/firstinspires/ftc/team406/oldOpModes/PhotoHandler.java
|
PsouthRobotics1182/FTC16-17
|
93b066954decbd20454c42099cca9571ffd108a1
|
[
"MIT"
] | null | null | null |
Team406/src/main/java/org/firstinspires/ftc/team406/oldOpModes/PhotoHandler.java
|
PsouthRobotics1182/FTC16-17
|
93b066954decbd20454c42099cca9571ffd108a1
|
[
"MIT"
] | null | null | null | 30.476923 | 83 | 0.627966 | 3,220 |
/*
package org.firstinspires.ftc.team406.OldOpmodes;
import java.io.File;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import android.content.Context;
import android.hardware.Camera;
import android.hardware.Camera.PictureCallback;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;
public class PhotoHandler implements PictureCallback {
private final Context context;
public PhotoHandler(Context context) {
this.context = context;
}
@Override
public void onPictureTaken(byte[] data, Camera camera) {
File pictureFileDir = getDir();
if (!pictureFileDir.exists() && !pictureFileDir.mkdirs()) {
Log.d("","Can't create directory to save image.");
Toast.makeText(context, "Can't create directory to save image.",
Toast.LENGTH_LONG).show();
return;
}
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyymmddhhmmss");
String date = dateFormat.format(new Date());
String photoFile = "Picture_" + date + ".jpg";
String filename = pictureFileDir.getPath() + File.separator + photoFile;
File pictureFile = new File(filename);
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
Toast.makeText(context, "New Image saved:" + photoFile,
Toast.LENGTH_LONG).show();
} catch (Exception error) {
Log.d("", "File" + filename + "not saved: "
+ error.getMessage());
Toast.makeText(context, "Image could not be saved.",
Toast.LENGTH_LONG).show();
}
}
private File getDir() {
File sdDir = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
return new File(sdDir, "CameraAPIDemo");
}
}*/
|
3e079a1508de606ebe6959f928dc4078fad1f34c
| 2,595 |
java
|
Java
|
assetconnection/opcua/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/assetconnection/opcua/OpcUaOperationProviderConfig.java
|
FraunhoferIOSB/FAAAST-Service
|
3b1b4201029e65bc8339f588d1b748aaff31fb1f
|
[
"ECL-2.0",
"Apache-2.0"
] | 9 |
2022-02-25T10:36:56.000Z
|
2022-03-31T13:13:40.000Z
|
assetconnection/opcua/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/assetconnection/opcua/OpcUaOperationProviderConfig.java
|
FraunhoferIOSB/FAAAST-Service
|
3b1b4201029e65bc8339f588d1b748aaff31fb1f
|
[
"ECL-2.0",
"Apache-2.0"
] | 9 |
2022-02-25T12:08:12.000Z
|
2022-03-29T11:01:43.000Z
|
assetconnection/opcua/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/assetconnection/opcua/OpcUaOperationProviderConfig.java
|
FraunhoferIOSB/FAAAST-Service
|
3b1b4201029e65bc8339f588d1b748aaff31fb1f
|
[
"ECL-2.0",
"Apache-2.0"
] | 2 |
2022-03-19T02:24:27.000Z
|
2022-03-25T08:43:08.000Z
| 30.174419 | 157 | 0.665511 | 3,221 |
/*
* Copyright (c) 2021 Fraunhofer IOSB, eine rechtlich nicht selbstaendige
* Einrichtung der Fraunhofer-Gesellschaft zur Foerderung der angewandten
* Forschung e.V.
* 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 de.fraunhofer.iosb.ilt.faaast.service.assetconnection.opcua;
import de.fraunhofer.iosb.ilt.faaast.service.assetconnection.AssetOperationProviderConfig;
import io.adminshell.aas.v3.model.builder.ExtendableBuilder;
import java.util.Objects;
/**
* * Config file for OPC UA-based
* {@link de.fraunhofer.iosb.ilt.faaast.service.assetconnection.AssetOperationProvider}.
*/
public class OpcUaOperationProviderConfig implements AssetOperationProviderConfig {
private String nodeId;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OpcUaOperationProviderConfig that = (OpcUaOperationProviderConfig) o;
return Objects.equals(nodeId, that.nodeId);
}
public String getNodeId() {
return nodeId;
}
public void setNodeId(String nodeId) {
this.nodeId = nodeId;
}
@Override
public int hashCode() {
return Objects.hash(nodeId);
}
public static Builder builder() {
return new Builder();
}
public static class Builder extends AbstractBuilder<OpcUaOperationProviderConfig, Builder> {
@Override
protected Builder getSelf() {
return this;
}
@Override
protected OpcUaOperationProviderConfig newBuildingInstance() {
return new OpcUaOperationProviderConfig();
}
}
private abstract static class AbstractBuilder<T extends OpcUaOperationProviderConfig, B extends AbstractBuilder<T, B>> extends ExtendableBuilder<T, B> {
public B nodeId(String value) {
getBuildingInstance().setNodeId(value);
return getSelf();
}
}
}
|
3e079aa28f8baec0dd09e1c057b902e2741e0c08
| 852 |
java
|
Java
|
src/main/java/net/minecraft/client/renderer/entity/SheepRenderer.java
|
grialion/Modern-Utility
|
4f1f75748ca83b8ccde5ed79bf3816c52ff425ec
|
[
"MIT"
] | null | null | null |
src/main/java/net/minecraft/client/renderer/entity/SheepRenderer.java
|
grialion/Modern-Utility
|
4f1f75748ca83b8ccde5ed79bf3816c52ff425ec
|
[
"MIT"
] | null | null | null |
src/main/java/net/minecraft/client/renderer/entity/SheepRenderer.java
|
grialion/Modern-Utility
|
4f1f75748ca83b8ccde5ed79bf3816c52ff425ec
|
[
"MIT"
] | null | null | null | 32.769231 | 123 | 0.761737 | 3,222 |
package net.minecraft.client.renderer.entity;
import net.minecraft.client.renderer.entity.layers.SheepWoolLayer;
import net.minecraft.client.renderer.entity.model.SheepModel;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.util.ResourceLocation;
public class SheepRenderer extends MobRenderer<SheepEntity, SheepModel<SheepEntity>>
{
private static final ResourceLocation SHEARED_SHEEP_TEXTURES = new ResourceLocation("textures/entity/sheep/sheep.png");
public SheepRenderer(EntityRendererManager renderManagerIn)
{
super(renderManagerIn, new SheepModel<>(), 0.7F);
this.addLayer(new SheepWoolLayer(this));
}
/**
* Returns the location of an entity's texture.
*/
public ResourceLocation getEntityTexture(SheepEntity entity)
{
return SHEARED_SHEEP_TEXTURES;
}
}
|
3e079b0172d9f1077906c74b35d3c88c5566dd0c
| 2,128 |
java
|
Java
|
src/main/java/mod/vemerion/wizardstaff/renderer/WizardHatRenderer.java
|
ankor24/Wizard-Staff
|
2d7a7fcf515c3a1fef1e069c7a911427920e993f
|
[
"MIT"
] | 1 |
2020-09-10T00:10:11.000Z
|
2020-09-10T00:10:11.000Z
|
src/main/java/mod/vemerion/wizardstaff/renderer/WizardHatRenderer.java
|
ankor24/Wizard-Staff
|
2d7a7fcf515c3a1fef1e069c7a911427920e993f
|
[
"MIT"
] | 11 |
2020-12-15T17:31:08.000Z
|
2022-03-21T01:35:09.000Z
|
src/main/java/mod/vemerion/wizardstaff/renderer/WizardHatRenderer.java
|
ankor24/Wizard-Staff
|
2d7a7fcf515c3a1fef1e069c7a911427920e993f
|
[
"MIT"
] | 3 |
2020-12-14T16:14:02.000Z
|
2021-02-25T03:30:48.000Z
| 43.428571 | 109 | 0.81015 | 3,223 |
package mod.vemerion.wizardstaff.renderer;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import mod.vemerion.wizardstaff.Main;
import mod.vemerion.wizardstaff.entity.WizardHatEntity;
import mod.vemerion.wizardstaff.model.WizardHatModel;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Quaternion;
public class WizardHatRenderer extends EntityRenderer<WizardHatEntity> {
private static final ResourceLocation TEXTURES = new ResourceLocation(Main.MODID,
"textures/armor/wizard_armor.png");
private static final ResourceLocation OVERLAY = new ResourceLocation(Main.MODID,
"textures/armor/wizard_armor_overlay.png");
private final WizardHatModel<WizardHatEntity> model = new WizardHatModel<>(64, 128);
public WizardHatRenderer(EntityRendererManager renderManagerIn) {
super(renderManagerIn);
}
@Override
public void render(WizardHatEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn,
IRenderTypeBuffer bufferIn, int packedLightIn) {
matrixStackIn.push();
matrixStackIn.scale(-1, -1, 1);
matrixStackIn.translate(0, 0.5, 0);
matrixStackIn.rotate(new Quaternion(0, entityIn.getHatRotation(partialTicks), 0, true));
IVertexBuilder ivertexbuilder = bufferIn.getBuffer(model.getRenderType(this.getEntityTexture(entityIn)));
model.render(matrixStackIn, ivertexbuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 0.1F, 0.8F,
1.0F);
ivertexbuilder = bufferIn.getBuffer(model.getRenderType(OVERLAY));
model.render(matrixStackIn, ivertexbuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F,
1.0F);
matrixStackIn.pop();
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
}
@Override
public ResourceLocation getEntityTexture(WizardHatEntity entity) {
return TEXTURES;
}
}
|
3e079b44bf81a190116db3db353e341674d84e8a
| 535 |
java
|
Java
|
src/main/java/com/jobSearch/cli/CLIFunction.java
|
jcorvera/job-search_
|
b252c2d7c01070344f42eb5bb1b48c4fd2abfeaf
|
[
"MIT"
] | null | null | null |
src/main/java/com/jobSearch/cli/CLIFunction.java
|
jcorvera/job-search_
|
b252c2d7c01070344f42eb5bb1b48c4fd2abfeaf
|
[
"MIT"
] | null | null | null |
src/main/java/com/jobSearch/cli/CLIFunction.java
|
jcorvera/job-search_
|
b252c2d7c01070344f42eb5bb1b48c4fd2abfeaf
|
[
"MIT"
] | null | null | null | 29.722222 | 72 | 0.650467 | 3,224 |
package com.jobSearch.cli;
import java.util.HashMap;
import java.util.Map;
public class CLIFunction {
public static Map<String, Object> toMap(CLIArguments cliArguments) {
Map<String, Object> params = new HashMap<>();
params.put("description",cliArguments.getKeyword());
params.put("location", cliArguments.getLocation());
params.put("full_time",cliArguments.isFullTime());
if (cliArguments.isMarkdown()) {
params.put("markdown",true);
}
return params;
}
}
|
3e079c69075f133ef6cabdf7b9dc291e08fb77f9
| 2,109 |
java
|
Java
|
src/main/java/graph/DFS.java
|
WeiyanXiang/algorithm-study
|
639598c15467af2255e3ef71938d7b9becfed056
|
[
"Apache-2.0"
] | 3 |
2018-01-14T21:54:39.000Z
|
2021-08-31T16:17:13.000Z
|
src/main/java/graph/DFS.java
|
WeiyanXiang/algorithm-study
|
639598c15467af2255e3ef71938d7b9becfed056
|
[
"Apache-2.0"
] | 1 |
2020-09-18T12:33:35.000Z
|
2020-09-18T12:33:35.000Z
|
src/main/java/graph/DFS.java
|
WeiyanXiang/algorithm-study
|
639598c15467af2255e3ef71938d7b9becfed056
|
[
"Apache-2.0"
] | 1 |
2018-08-07T04:14:16.000Z
|
2018-08-07T04:14:16.000Z
| 24.811765 | 87 | 0.455666 | 3,225 |
package graph;
import java.util.Stack;
/**
* @author Weiyan Xiang on 2020/6/20
* <p>
* https://www.baeldung.com/java-depth-first-search
*/
public class DFS {
private boolean[] visited = new boolean[10];
/**
* recursive
*/
public void doDfs(Graph g, int s) {
visited[s] = true;
System.out.print("[" + s + "] ");
for (int e : g.adj[s]) {
if (!visited[e]) {
doDfs(g, e);
}
}
}
/**
* iterative
* <p>
* time complexity: O(V+E), where V is vertices and E is edges.
* <p>
* space complexity: O(n)
*
* @param g
* @param s
*/
public void doDfsIterative(Graph g, int s) {
boolean[] myVisited = new boolean[8];
Stack<Integer> stack = new Stack<>();
stack.push(s);
myVisited[s] = true;
while (!stack.isEmpty()) {
int top = stack.pop();
System.out.print("[" + top + "] ");
for (int e : g.adj[top]) {
if (!myVisited[e]) {
stack.push(e);
myVisited[e] = true;
}
}
}
}
/**
* my own answer for adj matrix. It should be correct.
* <p>
* it is also possible to use recursive, same idea as recusive adj list approaches.
*
* @param grid
*/
public void doDfsGraphMatrix(char[][] grid) {
boolean[] myVisited = new boolean[8];
// row number represents node, so row number will be pushed to stack
Stack<Integer> stack = new Stack<>();
stack.push(0);
myVisited[0] = true;
// should be same idea, when adj list, loop the row
while (!stack.isEmpty()) {
int r = stack.pop();
System.out.print("[" + r + "] ");
for (int c = 0; c < grid[r].length; c++) {
// when there is a path
if (grid[r][c] == '1' && !visited[c]) {
stack.push(c);
visited[c] = true;
}
}
}
}
}
|
3e079c81a13d298b8e60f83f7fe5300dbd291479
| 8,152 |
java
|
Java
|
simbaLib/src/main/java/com/ebay/cip/framework/job/Job.java
|
thesky90/SimbaPipelines
|
95c1277924e0983789e2e97ee3947f187ea93a01
|
[
"Apache-2.0"
] | 3 |
2016-11-07T03:11:47.000Z
|
2021-08-19T14:56:29.000Z
|
simbaLib/src/main/java/com/ebay/cip/framework/job/Job.java
|
thesky90/SimbaPipelines
|
95c1277924e0983789e2e97ee3947f187ea93a01
|
[
"Apache-2.0"
] | null | null | null |
simbaLib/src/main/java/com/ebay/cip/framework/job/Job.java
|
thesky90/SimbaPipelines
|
95c1277924e0983789e2e97ee3947f187ea93a01
|
[
"Apache-2.0"
] | 4 |
2017-08-04T07:04:21.000Z
|
2021-01-15T11:06:40.000Z
| 30.192593 | 192 | 0.650147 | 3,226 |
package com.ebay.cip.framework.job;
/**
* Created by hachong on 4/3/2015.
*/
import akka.actor.ActorRef;
import com.ebay.cip.framework.*;
import com.ebay.cip.framework.configuration.CipActorSystem;
import com.ebay.cip.framework.enumeration.JobTypeEnum;
import com.ebay.cip.framework.exception.FeedNotFoundException;
import com.ebay.cip.framework.exception.InstanceProcessingException;
import com.ebay.cip.framework.feed.Feed;
import com.ebay.cip.framework.feed.FeedFactory;
import com.ebay.cip.framework.handler.ForkedJobCompletionCounterHandler;
import com.ebay.cip.framework.messages.StopMonitoringJobMessage;
import com.ebay.cip.framework.payload.Payload;
import com.ebay.cip.framework.enumeration.JobStatusEnum;
import com.ebay.cip.framework.samples.configBean.FrameworkConfigBean;
import com.ebay.cip.service.FeedRequestData;
import com.ebay.cip.service.FeedResponseData;
import com.ebay.kernel.calwrapper.CalEventHelper;
import com.ebay.kernel.logger.LogLevel;
import com.ebay.kernel.logger.Logger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.*;
@JsonInclude(JsonInclude.Include.NON_NULL)
public abstract class Job implements ICipJob {
private String jobId;
private String pipelineId;
private boolean forkComplete = true;
private JobMetadata jobMetadata;
private transient Feed feed;
private transient JobContext jobContext;
static transient Logger logger = Logger.getInstance(Job.class);
public Job(){
if(jobId == null) {
this.jobId = UUID.randomUUID().toString();
}
}
public Job( JobMetadata jobMetadata,String pipelineId){
this();
this.jobMetadata = jobMetadata;
this.pipelineId = pipelineId;
}
public String getJobId() {
return jobId;
}
public abstract JobTypeEnum getJobType();
private Context getContext(String id){
return new BaseContext(id,jobMetadata.getFeedId());
}
/**
* Gives jobContext active for current job
* @return
*/
public JobContext getJobContext() {
if(jobContext == null)
jobContext = (JobContext) getContext(this.pipelineId);
return jobContext;
}
/**
* Gives Global level feed context. Any data here are visible throughout the feed execution.
* @return
*/
@JsonIgnore
public FeedContext getFeedContext() {
return getFeed().getFeedContext();
}
public JobStatusEnum getJobStatus(){
return getJobMetaData().getJobStatus();
}
//TODO need to question business logic for the usage of the payload
@JsonIgnore
public Payload getPayload() {
return getFeed().getFeedRequestData().getRequestPayload();
}
public int getMaxRetryCount() {
return FrameworkConfigBean.getBean().getRetryCount();
}
public int getTimeoutPeriod() { return FrameworkConfigBean.getBean().getTimeoutPeriod(); }
public boolean isComplete() {
return JobStatusEnum.SUCCESS.equals(jobMetadata.getJobStatus()) || JobStatusEnum.FAILURE.equals(jobMetadata.getJobStatus()) || JobStatusEnum.TIMEOUT.equals(jobMetadata.getJobStatus());
}
public boolean isForkComplete(){
return forkComplete;
}
/**
* Business logic will set the fork complete to false. in case the forking is not done from execute() method.
*/
public void setForkComplete(boolean status){
forkComplete = status;
}
public void success(){
feed = getFeed();
if(isComplete()){
String message = "Job id: "+jobId+" is already complete";
CalEventHelper.writeLog("Framework", "job.success()", message, "0");
logger.log(LogLevel.INFO,message);
return;
}
if(JobStatusEnum.WAITING.equals(jobMetadata.getJobStatus())) {
jobMetadata.setJobStatus(JobStatusEnum.SUCCESS);
//sent to watcher actor to stop monitoring this job
CipActorSystem.getInstance().getJobMonitorActor().tell(new StopMonitoringJobMessage(this.getFeedId(), this.getJobId()), ActorRef.noSender());
}
else{
jobMetadata.setJobStatus(JobStatusEnum.SUCCESS);
}
try {
feed.getInstanceFactory().saveObjectInstance(this.getJobId(), this);
} catch (InstanceProcessingException e) {
e.printStackTrace();
CalEventHelper.writeException("Framework",e,true,"Unable to save the job. JobId: "+this.getJobId());
}
}
public void failure(){
feed = getFeed();
if(isComplete()){
String message = "Job id: "+jobId+" is already complete";
CalEventHelper.writeLog("Framework", "job failure", message, "0");
logger.log(LogLevel.INFO,message);
return;
}
jobMetadata.setJobStatus(JobStatusEnum.FAILURE);
try {
feed.getInstanceFactory().saveObjectInstance(this.getJobId(), this);
} catch (InstanceProcessingException e) {
e.printStackTrace();
CalEventHelper.writeException("Framework",e,true,"Unable to save the job. JobId: "+this.getJobId());
}
}
public void timeout(){
feed = getFeed();
if(isComplete()){
CalEventHelper.writeLog("Framework", "job.timeout()", "Job id: " +jobId+ " is already complete", "0");
return;
}
jobMetadata.setJobStatus(JobStatusEnum.TIMEOUT);
try {
feed.getInstanceFactory().saveObjectInstance(this.getJobId(), this);
} catch (InstanceProcessingException e) {
e.printStackTrace();
CalEventHelper.writeException("Framework",e,true,"Unable to save the job. JobId: "+this.getJobId());
}
}
/**
* Returns parent job id for this job
* @return
*/
public String getParentJobId(){
return jobMetadata.getParentJobId();
}
@JsonIgnore
public Job getParentJob() {
try {
return getFeed().getInstanceFactory().getObjectInstance(getParentJobId(), Job.class);
} catch (InstanceProcessingException e) {
e.printStackTrace();
CalEventHelper.writeException("DBError", e,true,"Unable to get instance job with key: " + getParentJobId());
}
return null;
}
/**
* This method returns current count of forked jobs.
* @return
*/
public int getForkedJobsCount() {
return jobMetadata.getForkedJobsCounts();
}
public void incrementForkedJobsCount(){
int currentCount = jobMetadata.getForkedJobsCounts();
currentCount++;
jobMetadata.setForkedJobsCounts(currentCount);
}
public String getNextJobId(){
return jobMetadata.getNextJobId();
}
/**
* Returns job id of previous job in this pipeline. Please not that its not parent job id.
*/
public String getPreviousJobId(){
return jobMetadata.getPreviousJobId();
}
@Override
public JobMetadata getJobMetaData(){
return jobMetadata;
}
public void setJobMetadata(JobMetadata jobMetadata) {
this.jobMetadata = jobMetadata;
}
@Override
public String getPipelineId(){
return pipelineId;
}
public void setPipelineId(String pipelineId){
this.pipelineId = pipelineId;
}
public void addForkedJobId(Job forkedJob){
feed = getFeed();
ForkedJobCompletionCounterHandler.addChildrenId(jobId,forkedJob.getJobId(),forkedJob.getPipelineId(),feed);
}
public String getFeedId(){
return jobMetadata.getFeedId();
}
private Feed getFeed(){
if(feed == null){
try {
feed = FeedFactory.getFeed(jobMetadata.getFeedId());
}
catch(FeedNotFoundException e){
e.printStackTrace();
CalEventHelper.writeException("Framework",e,true,e.getMessage());
return null;
}
}
return feed;
}
public void setFeed(){
}
}
|
3e079fc625a95fd6d788564883cc45e6b50ce8af
| 1,287 |
java
|
Java
|
twitterurlextractor/src/main/java/com/ashudevs/twitterurlextractor/TwitterFile.java
|
qaziabubakar/TwitterUrlExtractor
|
592850c1e799d350bfa557d70d7054257fc4d125
|
[
"MIT"
] | 2 |
2019-02-27T13:54:21.000Z
|
2020-10-02T05:27:50.000Z
|
twitterurlextractor/src/main/java/com/ashudevs/twitterurlextractor/TwitterFile.java
|
qaziabubakar/TwitterUrlExtractor
|
592850c1e799d350bfa557d70d7054257fc4d125
|
[
"MIT"
] | null | null | null |
twitterurlextractor/src/main/java/com/ashudevs/twitterurlextractor/TwitterFile.java
|
qaziabubakar/TwitterUrlExtractor
|
592850c1e799d350bfa557d70d7054257fc4d125
|
[
"MIT"
] | 1 |
2022-02-28T07:09:43.000Z
|
2022-02-28T07:09:43.000Z
| 18.926471 | 51 | 0.594406 | 3,227 |
package com.ashudevs.twitterurlextractor;
public class TwitterFile {
private String quality;
private String url;
private String ext;
private String filename;
private String author;
private String size;
private Integer duration;
public String getAuthor() {
return author!=null ? author : "Not Found";
}
public void setAuthor(String author) {
this.author = author;
}
public String getQuality() {
return quality;
}
public void setQuality(String quality) {
this.quality = quality;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getExt() {
return ext;
}
public void setExt(String ext) {
this.ext = ext;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public Integer getDuration() {
return duration!=null ? duration : 0;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
}
|
3e07a09960f08cba7a13a606f11012d026a0151a
| 641 |
java
|
Java
|
src/main/java/com/shilton/weather/weatherapp/models/Main.java
|
shiltz/weatherbackend
|
54d692d54670a408d3f4098a4393b5fd422dbe63
|
[
"MIT"
] | null | null | null |
src/main/java/com/shilton/weather/weatherapp/models/Main.java
|
shiltz/weatherbackend
|
54d692d54670a408d3f4098a4393b5fd422dbe63
|
[
"MIT"
] | null | null | null |
src/main/java/com/shilton/weather/weatherapp/models/Main.java
|
shiltz/weatherbackend
|
54d692d54670a408d3f4098a4393b5fd422dbe63
|
[
"MIT"
] | null | null | null | 16.435897 | 51 | 0.647426 | 3,228 |
package com.shilton.weather.weatherapp.models;
import java.io.Serializable;
public class Main implements Serializable{
public static final long serialVersionUID = 1L;
private double temp;
private double pressure;
private double humdity;
private double temp_min;
private double temp_max;
public double getTemp() {
return temp;
}
public double getPressure() {
return pressure;
}
public double getHumdity() {
return humdity;
}
public double getTemp_min() {
return temp_min;
}
public double getTemp_max() {
return temp_max;
}
}
|
3e07a0a2ac517e6e348a307a1bf3e8388029208f
| 1,267 |
java
|
Java
|
documentation/manual/working/javaGuide/main/tests/code/javaguide/tests/InjectionTest.java
|
cookiee01/playframework
|
4abf9114a82acc751032178c4f6b4a61a3cb6834
|
[
"Apache-2.0"
] | 8,605 |
2015-01-01T13:22:59.000Z
|
2022-03-31T11:11:39.000Z
|
documentation/manual/working/javaGuide/main/tests/code/javaguide/tests/InjectionTest.java
|
cookiee01/playframework
|
4abf9114a82acc751032178c4f6b4a61a3cb6834
|
[
"Apache-2.0"
] | 5,659 |
2015-01-01T01:40:25.000Z
|
2022-03-31T12:26:00.000Z
|
documentation/manual/working/javaGuide/main/tests/code/javaguide/tests/InjectionTest.java
|
cookiee01/playframework
|
4abf9114a82acc751032178c4f6b4a61a3cb6834
|
[
"Apache-2.0"
] | 3,534 |
2015-01-01T11:13:51.000Z
|
2022-03-31T23:45:12.000Z
| 21.844828 | 74 | 0.703236 | 3,229 |
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package javaguide.tests;
import static play.test.Helpers.*;
import static org.junit.Assert.*;
import javax.inject.Inject;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Module;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import play.Application;
import play.ApplicationLoader.Context;
import play.Environment;
import play.inject.guice.GuiceApplicationBuilder;
import play.inject.guice.GuiceApplicationLoader;
import play.test.Helpers;
public class InjectionTest {
// #test-injection
@Inject Application application;
@Before
public void setup() {
Module testModule =
new AbstractModule() {
@Override
public void configure() {
// Install custom test binding here
}
};
GuiceApplicationBuilder builder =
new GuiceApplicationLoader()
.builder(new Context(Environment.simple()))
.overrides(testModule);
Guice.createInjector(builder.applicationModule()).injectMembers(this);
Helpers.start(application);
}
@After
public void teardown() {
Helpers.stop(application);
}
// #test-injection
}
|
3e07a18195e8e98f578516e75da632c743a06f31
| 49,334 |
java
|
Java
|
org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java
|
sanjan2/org.hl7.fhir.core
|
918ade1beeec7c50a0702d9219e66e09bc152e17
|
[
"Apache-2.0"
] | null | null | null |
org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java
|
sanjan2/org.hl7.fhir.core
|
918ade1beeec7c50a0702d9219e66e09bc152e17
|
[
"Apache-2.0"
] | null | null | null |
org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java
|
sanjan2/org.hl7.fhir.core
|
918ade1beeec7c50a0702d9219e66e09bc152e17
|
[
"Apache-2.0"
] | null | null | null | 38.125193 | 263 | 0.615113 | 3,230 |
package org.hl7.fhir.r5.renderers;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.exceptions.TerminologyServiceException;
import org.hl7.fhir.r5.context.IWorkerContext.CodingValidationRequest;
import org.hl7.fhir.r5.context.IWorkerContext.ValidationResult;
import org.hl7.fhir.r5.model.BooleanType;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.ConceptMap;
import org.hl7.fhir.r5.model.DataType;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Enumerations.FilterOperator;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent;
import org.hl7.fhir.r5.model.Extension;
import org.hl7.fhir.r5.model.ExtensionHelper;
import org.hl7.fhir.r5.model.PrimitiveType;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent;
import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent;
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Title;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
public class ValueSetRenderer extends TerminologyRenderer {
public ValueSetRenderer(RenderingContext context) {
super(context);
}
public ValueSetRenderer(RenderingContext context, ResourceContext rcontext) {
super(context, rcontext);
}
private static final String ABSTRACT_CODE_HINT = "This code is not selectable ('Abstract')";
private static final int MAX_DESIGNATIONS_IN_LINE = 5;
private List<ConceptMapRenderInstructions> renderingMaps = new ArrayList<ConceptMapRenderInstructions>();
public boolean render(XhtmlNode x, Resource dr) throws FHIRFormatError, DefinitionException, IOException {
return render(x, (ValueSet) dr, false);
}
public boolean render(XhtmlNode x, ValueSet vs, boolean header) throws FHIRFormatError, DefinitionException, IOException {
List<UsedConceptMap> maps = findReleventMaps(vs);
boolean hasExtensions;
if (vs.hasExpansion()) {
// for now, we just accept an expansion if there is one
hasExtensions = generateExpansion(x, vs, header, maps);
} else {
hasExtensions = generateComposition(x, vs, header, maps);
}
return hasExtensions;
}
public void describe(XhtmlNode x, ValueSet vs) {
x.tx(display(vs));
}
public String display(ValueSet vs) {
return vs.present();
}
private List<UsedConceptMap> findReleventMaps(ValueSet vs) throws FHIRException {
List<UsedConceptMap> res = new ArrayList<UsedConceptMap>();
for (CanonicalResource md : getContext().getWorker().allConformanceResources()) {
if (md instanceof ConceptMap) {
ConceptMap cm = (ConceptMap) md;
if (isSource(vs, cm.getSource())) {
ConceptMapRenderInstructions re = findByTarget(cm.getTarget());
if (re != null) {
ValueSet vst = cm.hasTarget() ? getContext().getWorker().fetchResource(ValueSet.class, cm.hasTargetCanonicalType() ? cm.getTargetCanonicalType().getValue() : cm.getTargetUriType().asStringValue()) : null;
res.add(new UsedConceptMap(re, vst == null ? cm.getUserString("path") : vst.getUserString("path"), cm));
}
}
}
}
return res;
// Map<ConceptMap, String> mymaps = new HashMap<ConceptMap, String>();
// for (ConceptMap a : context.getWorker().findMapsForSource(vs.getUrl())) {
// String url = "";
// ValueSet vsr = context.getWorker().fetchResource(ValueSet.class, ((Reference) a.getTarget()).getReference());
// if (vsr != null)
// url = (String) vsr.getUserData("filename");
// mymaps.put(a, url);
// }
// Map<ConceptMap, String> mymaps = new HashMap<ConceptMap, String>();
// for (ConceptMap a : context.getWorker().findMapsForSource(cs.getValueSet())) {
// String url = "";
// ValueSet vsr = context.getWorker().fetchResource(ValueSet.class, ((Reference) a.getTarget()).getReference());
// if (vsr != null)
// url = (String) vsr.getUserData("filename");
// mymaps.put(a, url);
// }
// also, look in the contained resources for a concept map
// for (Resource r : cs.getContained()) {
// if (r instanceof ConceptMap) {
// ConceptMap cm = (ConceptMap) r;
// if (((Reference) cm.getSource()).getReference().equals(cs.getValueSet())) {
// String url = "";
// ValueSet vsr = context.getWorker().fetchResource(ValueSet.class, ((Reference) cm.getTarget()).getReference());
// if (vsr != null)
// url = (String) vsr.getUserData("filename");
// mymaps.put(cm, url);
// }
// }
// }
}
private boolean isSource(ValueSet vs, DataType source) {
return vs.hasUrl() && source != null && vs.getUrl().equals(source.primitiveValue());
}
private boolean generateExpansion(XhtmlNode x, ValueSet vs, boolean header, List<UsedConceptMap> maps) throws FHIRFormatError, DefinitionException, IOException {
boolean hasExtensions = false;
List<String> langs = new ArrayList<String>();
if (header) {
XhtmlNode h = x.addTag(getHeader());
h.tx("Value Set Contents");
if (IsNotFixedExpansion(vs))
addMarkdown(x, vs.getDescription());
if (vs.hasCopyright())
generateCopyright(x, vs);
}
if (ToolingExtensions.hasExtension(vs.getExpansion(), ToolingExtensions.EXT_EXP_TOOCOSTLY)) {
List<Extension> exl = vs.getExpansion().getExtensionsByUrl(ToolingExtensions.EXT_EXP_TOOCOSTLY);
boolean other = false;
for (Extension ex : exl) {
if (ex.getValue() instanceof BooleanType) {
x.para().style("border: maroon 1px solid; background-color: #FFCCCC; font-weight: bold; padding: 8px").addText(vs.getExpansion().getContains().isEmpty() ? getContext().getTooCostlyNoteEmpty() : getContext().getTooCostlyNoteNotEmpty());
} else if (!other) {
x.para().style("border: maroon 1px solid; background-color: #FFCCCC; font-weight: bold; padding: 8px").addText(vs.getExpansion().getContains().isEmpty() ? getContext().getTooCostlyNoteEmptyDependent() : getContext().getTooCostlyNoteNotEmptyDependent());
other = true;
}
}
} else {
Integer count = countMembership(vs);
if (count == null)
x.para().tx("This value set does not contain a fixed number of concepts");
else
x.para().tx("This value set contains "+count.toString()+" concepts");
}
generateContentModeNotices(x, vs.getExpansion());
generateVersionNotice(x, vs.getExpansion());
CodeSystem allCS = null;
boolean doLevel = false;
for (ValueSetExpansionContainsComponent cc : vs.getExpansion().getContains()) {
if (cc.hasContains()) {
doLevel = true;
break;
}
}
boolean doSystem = true; // checkDoSystem(vs, src);
boolean doDefinition = checkDoDefinition(vs.getExpansion().getContains());
if (doSystem && allFromOneSystem(vs)) {
doSystem = false;
XhtmlNode p = x.para();
p.tx("All codes in this table are from the system ");
allCS = getContext().getWorker().fetchCodeSystem(vs.getExpansion().getContains().get(0).getSystem());
String ref = null;
if (allCS != null)
ref = getCsRef(allCS);
if (ref == null)
p.code(vs.getExpansion().getContains().get(0).getSystem());
else
p.ah(context.fixReference(ref)).code(vs.getExpansion().getContains().get(0).getSystem());
}
XhtmlNode t = x.table( "codes");
XhtmlNode tr = t.tr();
if (doLevel)
tr.td().b().tx("Level");
tr.td().attribute("style", "white-space:nowrap").b().tx("Code");
if (doSystem)
tr.td().b().tx("System");
XhtmlNode tdDisp = tr.td();
tdDisp.b().tx("Display");
boolean doLangs = false;
for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) {
scanForLangs(c, langs);
}
if (doDefinition) {
tr.td().b().tx("Definition");
doLangs = false;
} else {
// if we're not doing definitions and we don't have too many languages, we'll do them in line
if (langs.size() < MAX_DESIGNATIONS_IN_LINE) {
doLangs = true;
if (vs.hasLanguage()) {
tdDisp.tx(" - "+describeLang(vs.getLanguage()));
}
for (String lang : langs) {
tr.td().b().addText(describeLang(lang));
}
}
}
addMapHeaders(tr, maps);
for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) {
addExpansionRowToTable(t, c, 1, doLevel, doSystem, doDefinition, maps, allCS, langs, doLangs);
}
// now, build observed languages
if (!doLangs && langs.size() > 0) {
Collections.sort(langs);
x.para().b().tx("Additional Language Displays");
t = x.table( "codes");
tr = t.tr();
tr.td().b().tx("Code");
for (String lang : langs) {
tr.td().b().addText(describeLang(lang));
}
for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) {
addLanguageRow(c, t, langs);
}
}
return hasExtensions;
}
private void generateContentModeNotices(XhtmlNode x, ValueSetExpansionComponent expansion) {
generateContentModeNotice(x, expansion, "example", "Expansion based on example code system");
generateContentModeNotice(x, expansion, "fragment", "Expansion based on code system fragment");
}
private void generateContentModeNotice(XhtmlNode x, ValueSetExpansionComponent expansion, String mode, String text) {
Multimap<String, String> versions = HashMultimap.create();
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
if (p.getName().equals(mode)) {
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
if (parts.length == 2)
versions.put(parts[0], parts[1]);
}
}
if (versions.size() > 0) {
XhtmlNode div = null;
XhtmlNode ul = null;
boolean first = true;
for (String s : versions.keySet()) {
if (versions.size() == 1 && versions.get(s).size() == 1) {
for (String v : versions.get(s)) { // though there'll only be one
XhtmlNode p = x.para().style("border: black 1px dotted; background-color: #ffcccc; padding: 8px; margin-bottom: 8px");
p.tx(text+" ");
expRef(p, s, v);
}
} else {
for (String v : versions.get(s)) {
if (first) {
div = x.div().style("border: black 1px dotted; background-color: #EEEEEE; padding: 8px; margin-bottom: 8px");
div.para().tx(text+"s: ");
ul = div.ul();
first = false;
}
expRef(ul.li(), s, v);
}
}
}
}
}
private boolean checkDoSystem(ValueSet vs, ValueSet src) {
if (src != null)
vs = src;
return vs.hasCompose();
}
private boolean IsNotFixedExpansion(ValueSet vs) {
if (vs.hasCompose())
return false;
// it's not fixed if it has any includes that are not version fixed
for (ConceptSetComponent cc : vs.getCompose().getInclude()) {
if (cc.hasValueSet())
return true;
if (!cc.hasVersion())
return true;
}
return false;
}
private ConceptMapRenderInstructions findByTarget(DataType source) {
if (source == null) {
return null;
}
String src = source.primitiveValue();
if (src != null)
for (ConceptMapRenderInstructions t : renderingMaps) {
if (src.equals(t.getUrl()))
return t;
}
return null;
}
private Integer countMembership(ValueSet vs) {
int count = 0;
if (vs.hasExpansion())
count = count + conceptCount(vs.getExpansion().getContains());
else {
if (vs.hasCompose()) {
if (vs.getCompose().hasExclude()) {
try {
ValueSetExpansionOutcome vse = getContext().getWorker().expandVS(vs, true, false);
count = 0;
count += conceptCount(vse.getValueset().getExpansion().getContains());
return count;
} catch (Exception e) {
return null;
}
}
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
if (inc.hasFilter())
return null;
if (!inc.hasConcept())
return null;
count = count + inc.getConcept().size();
}
}
}
return count;
}
private int conceptCount(List<ValueSetExpansionContainsComponent> list) {
int count = 0;
for (ValueSetExpansionContainsComponent c : list) {
if (!c.getAbstract())
count++;
count = count + conceptCount(c.getContains());
}
return count;
}
private void addCSRef(XhtmlNode x, String url) {
CodeSystem cs = getContext().getWorker().fetchCodeSystem(url);
if (cs == null) {
x.code(url);
} else if (cs.hasUserData("path")) {
x.ah(cs.getUserString("path")).tx(cs.present());
} else {
x.code(url);
x.tx(" ("+cs.present()+")");
}
}
@SuppressWarnings("rawtypes")
private void generateVersionNotice(XhtmlNode x, ValueSetExpansionComponent expansion) {
Multimap<String, String> versions = HashMultimap.create();
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
if (p.getName().equals("version")) {
String[] parts = ((PrimitiveType) p.getValue()).asStringValue().split("\\|");
if (parts.length == 2)
versions.put(parts[0], parts[1]);
}
}
if (versions.size() > 0) {
XhtmlNode div = null;
XhtmlNode ul = null;
boolean first = true;
for (String s : versions.keySet()) {
if (versions.size() == 1 && versions.get(s).size() == 1) {
for (String v : versions.get(s)) { // though there'll only be one
XhtmlNode p = x.para().style("border: black 1px dotted; background-color: #EEEEEE; padding: 8px; margin-bottom: 8px");
p.tx("Expansion based on ");
expRef(p, s, v);
}
} else {
for (String v : versions.get(s)) {
if (first) {
div = x.div().style("border: black 1px dotted; background-color: #EEEEEE; padding: 8px; margin-bottom: 8px");
div.para().tx("Expansion based on: ");
ul = div.ul();
first = false;
}
expRef(ul.li(), s, v);
}
}
}
}
}
private void expRef(XhtmlNode x, String u, String v) {
// TODO Auto-generated method stub
if (u.equals("http://snomed.info/sct")) {
String[] parts = v.split("\\/");
if (parts.length >= 5) {
String m = describeModule(parts[4]);
if (parts.length == 7) {
x.tx("SNOMED CT "+m+" edition "+formatSCTDate(parts[6]));
} else {
x.tx("SNOMED CT "+m+" edition");
}
} else {
x.tx(describeSystem(u)+" version "+v);
}
} else if (u.equals("http://loinc.org")) {
String vd = describeLoincVer(v);
if (vd != null) {
x.tx("Loinc v"+v+" ("+vd+")");
} else {
x.tx("Loinc v"+v);
}
} else {
CanonicalResource cr = (CanonicalResource) getContext().getWorker().fetchResource(Resource.class, u+"|"+v);
if (cr != null) {
if (cr.hasUserData("path")) {
x.ah(cr.getUserString("path")).tx(cr.present()+" v"+v+" ("+cr.fhirType()+")");
} else {
x.tx(describeSystem(u)+" v"+v+" ("+cr.fhirType()+")");
}
} else {
x.tx(describeSystem(u)+" version "+v);
}
}
}
private String describeLoincVer(String v) {
if ("2.67".equals(v)) return "Dec 2019";
if ("2.66".equals(v)) return "Jun 2019";
if ("2.65".equals(v)) return "Dec 2018";
if ("2.64".equals(v)) return "Jun 2018";
if ("2.63".equals(v)) return "Dec 2017";
if ("2.61".equals(v)) return "Jun 2017";
if ("2.59".equals(v)) return "Feb 2017";
if ("2.58".equals(v)) return "Dec 2016";
if ("2.56".equals(v)) return "Jun 2016";
if ("2.54".equals(v)) return "Dec 2015";
if ("2.52".equals(v)) return "Jun 2015";
if ("2.50".equals(v)) return "Dec 2014";
if ("2.48".equals(v)) return "Jun 2014";
if ("2.46".equals(v)) return "Dec 2013";
if ("2.44".equals(v)) return "Jun 2013";
if ("2.42".equals(v)) return "Dec 2012";
if ("2.40".equals(v)) return "Jun 2012";
if ("2.38".equals(v)) return "Dec 2011";
if ("2.36".equals(v)) return "Jun 2011";
if ("2.34".equals(v)) return "Dec 2010";
if ("2.32".equals(v)) return "Jun 2010";
if ("2.30".equals(v)) return "Feb 2010";
if ("2.29".equals(v)) return "Dec 2009";
if ("2.27".equals(v)) return "Jul 2009";
if ("2.26".equals(v)) return "Jan 2009";
if ("2.24".equals(v)) return "Jul 2008";
if ("2.22".equals(v)) return "Dec 2007";
if ("2.21".equals(v)) return "Jun 2007";
if ("2.19".equals(v)) return "Dec 2006";
if ("2.17".equals(v)) return "Jun 2006";
if ("2.16".equals(v)) return "Dec 2005";
if ("2.15".equals(v)) return "Jun 2005";
if ("2.14".equals(v)) return "Dec 2004";
if ("2.13".equals(v)) return "Aug 2004";
if ("2.12".equals(v)) return "Feb 2004";
if ("2.10".equals(v)) return "Oct 2003";
if ("2.09".equals(v)) return "May 2003";
if ("2.08 ".equals(v)) return "Sep 2002";
if ("2.07".equals(v)) return "Aug 2002";
if ("2.05".equals(v)) return "Feb 2002";
if ("2.04".equals(v)) return "Jan 2002";
if ("2.03".equals(v)) return "Jul 2001";
if ("2.02".equals(v)) return "May 2001";
if ("2.01".equals(v)) return "Jan 2001";
if ("2.00".equals(v)) return "Jan 2001";
if ("1.0n".equals(v)) return "Feb 2000";
if ("1.0ma".equals(v)) return "Aug 1999";
if ("1.0m".equals(v)) return "Jul 1999";
if ("1.0l".equals(v)) return "Jan 1998";
if ("1.0ja".equals(v)) return "Oct 1997";
return null;
}
private String formatSCTDate(String ds) {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
Date date;
try {
date = format.parse(ds);
} catch (ParseException e) {
return ds;
}
return new SimpleDateFormat("dd-MMM yyyy").format(date);
}
private String describeModule(String module) {
if ("900000000000207008".equals(module))
return "International";
if ("731000124108".equals(module))
return "United States";
if ("32506021000036107".equals(module))
return "Australian";
if ("449081005".equals(module))
return "Spanish";
if ("554471000005108".equals(module))
return "Danish";
if ("11000146104".equals(module))
return "Dutch";
if ("45991000052106".equals(module))
return "Swedish";
if ("999000041000000102".equals(module))
return "United Kingdon";
return module;
}
private boolean hasVersionParameter(ValueSetExpansionComponent expansion) {
for (ValueSetExpansionParameterComponent p : expansion.getParameter()) {
if (p.getName().equals("version"))
return true;
}
return false;
}
private void addLanguageRow(ValueSetExpansionContainsComponent c, XhtmlNode t, List<String> langs) {
XhtmlNode tr = t.tr();
tr.td().addText(c.getCode());
addLangaugesToRow(c, langs, tr);
for (ValueSetExpansionContainsComponent cc : c.getContains()) {
addLanguageRow(cc, t, langs);
}
}
public void addLangaugesToRow(ValueSetExpansionContainsComponent c, List<String> langs, XhtmlNode tr) {
for (String lang : langs) {
String d = null;
for (Extension ext : c.getExtension()) {
if (ToolingExtensions.EXT_TRANSLATION.equals(ext.getUrl())) {
String l = ToolingExtensions.readStringExtension(ext, "lang");
if (lang.equals(l)) {
d = ToolingExtensions.readStringExtension(ext, "content");
}
}
}
if (d == null) {
for (ConceptReferenceDesignationComponent dd : c.getDesignation()) {
String l = dd.getLanguage();
if (lang.equals(l)) {
d = dd.getValue();
}
}
}
tr.td().addText(d == null ? "" : d);
}
}
private boolean checkDoDefinition(List<ValueSetExpansionContainsComponent> contains) {
for (ValueSetExpansionContainsComponent c : contains) {
CodeSystem cs = getContext().getWorker().fetchCodeSystem(c.getSystem());
if (cs != null) {
ConceptDefinitionComponent cd = CodeSystemUtilities.getCode(cs, c.getCode());
if (cd != null && cd.hasDefinition()) {
return true;
}
}
if (checkDoDefinition(c.getContains()))
return true;
}
return false;
}
private boolean allFromOneSystem(ValueSet vs) {
if (vs.getExpansion().getContains().isEmpty())
return false;
String system = vs.getExpansion().getContains().get(0).getSystem();
for (ValueSetExpansionContainsComponent cc : vs.getExpansion().getContains()) {
if (!checkSystemMatches(system, cc))
return false;
}
return true;
}
private String getCsRef(String system) {
CodeSystem cs = getContext().getWorker().fetchCodeSystem(system);
return getCsRef(cs);
}
private <T extends Resource> String getCsRef(T cs) {
String ref = (String) cs.getUserData("filename");
if (ref == null)
ref = (String) cs.getUserData("path");
if (ref == null)
return "?ngen-14?.html";
if (!ref.contains(".html"))
ref = ref + ".html";
return ref.replace("\\", "/");
}
private void scanForLangs(ValueSetExpansionContainsComponent c, List<String> langs) {
for (Extension ext : c.getExtension()) {
if (ToolingExtensions.EXT_TRANSLATION.equals(ext.getUrl())) {
String lang = ToolingExtensions.readStringExtension(ext, "lang");
if (!Utilities.noString(lang) && !langs.contains(lang)) {
langs.add(lang);
}
}
}
for (ConceptReferenceDesignationComponent d : c.getDesignation()) {
String lang = d.getLanguage();
if (!Utilities.noString(lang) && !langs.contains(lang)) {
langs.add(lang);
}
}
for (ValueSetExpansionContainsComponent cc : c.getContains()) {
scanForLangs(cc, langs);
}
}
private void addExpansionRowToTable(XhtmlNode t, ValueSetExpansionContainsComponent c, int i, boolean doLevel, boolean doSystem, boolean doDefinition, List<UsedConceptMap> maps, CodeSystem allCS, List<String> langs, boolean doLangs) {
XhtmlNode tr = t.tr();
XhtmlNode td = tr.td();
String tgt = makeAnchor(c.getSystem(), c.getCode());
td.an(tgt);
if (doLevel) {
td.addText(Integer.toString(i));
td = tr.td();
}
String s = Utilities.padLeft("", '\u00A0', i*2);
td.attribute("style", "white-space:nowrap").addText(s);
addCodeToTable(c.getAbstract(), c.getSystem(), c.getCode(), c.getDisplay(), td);
if (doSystem) {
td = tr.td();
td.addText(c.getSystem());
}
td = tr.td();
if (c.hasDisplayElement())
td.addText(c.getDisplay());
if (doDefinition) {
CodeSystem cs = allCS;
if (cs == null)
cs = getContext().getWorker().fetchCodeSystem(c.getSystem());
td = tr.td();
if (cs != null)
td.addText(CodeSystemUtilities.getCodeDefinition(cs, c.getCode()));
}
for (UsedConceptMap m : maps) {
td = tr.td();
List<TargetElementComponentWrapper> mappings = findMappingsForCode(c.getCode(), m.getMap());
boolean first = true;
for (TargetElementComponentWrapper mapping : mappings) {
if (!first)
td.br();
first = false;
XhtmlNode span = td.span(null, mapping.comp.getRelationship().toString());
span.addText(getCharForRelationship(mapping.comp));
addRefToCode(td, mapping.group.getTarget(), m.getLink(), mapping.comp.getCode());
if (!Utilities.noString(mapping.comp.getComment()))
td.i().tx("("+mapping.comp.getComment()+")");
}
}
if (doLangs) {
addLangaugesToRow(c, langs, tr);
}
for (ValueSetExpansionContainsComponent cc : c.getContains()) {
addExpansionRowToTable(t, cc, i+1, doLevel, doSystem, doDefinition, maps, allCS, langs, doLangs);
}
}
private boolean checkSystemMatches(String system, ValueSetExpansionContainsComponent cc) {
if (!system.equals(cc.getSystem()))
return false;
for (ValueSetExpansionContainsComponent cc1 : cc.getContains()) {
if (!checkSystemMatches(system, cc1))
return false;
}
return true;
}
private void addCodeToTable(boolean isAbstract, String system, String code, String display, XhtmlNode td) {
CodeSystem e = getContext().getWorker().fetchCodeSystem(system);
if (e == null || e.getContent() != org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE) {
if (isAbstract)
td.i().setAttribute("title", ABSTRACT_CODE_HINT).addText(code);
else if ("http://snomed.info/sct".equals(system)) {
td.ah(sctLink(code)).addText(code);
} else if ("http://loinc.org".equals(system)) {
td.ah("http://details.loinc.org/LOINC/"+code+".html").addText(code);
} else
td.addText(code);
} else {
String href = context.fixReference(getCsRef(e));
if (href.contains("#"))
href = href + "-"+Utilities.nmtokenize(code);
else
href = href + "#"+e.getId()+"-"+Utilities.nmtokenize(code);
if (isAbstract)
td.ah(href).setAttribute("title", ABSTRACT_CODE_HINT).i().addText(code);
else
td.ah(href).addText(code);
}
}
public String sctLink(String code) {
// if (snomedEdition != null)
// http://browser.ihtsdotools.org/?perspective=full&conceptId1=428041000124106&edition=us-edition&release=v20180301&server=https://prod-browser-exten.ihtsdotools.org/api/snomed&langRefset=900000000000509007
return "http://snomed.info/id/"+code;
}
private void addRefToCode(XhtmlNode td, String target, String vslink, String code) {
CodeSystem cs = getContext().getWorker().fetchCodeSystem(target);
String cslink = getCsRef(cs);
XhtmlNode a = null;
if (cslink != null)
a = td.ah(getContext().getSpecificationLink()+cslink+"#"+cs.getId()+"-"+code);
else
a = td.ah(getContext().getSpecificationLink()+vslink+"#"+code);
a.addText(code);
}
private boolean generateComposition(XhtmlNode x, ValueSet vs, boolean header, List<UsedConceptMap> maps) throws FHIRException, IOException {
boolean hasExtensions = false;
List<String> langs = new ArrayList<String>();
Map<String, String> designations = new HashMap<>(); // map of url = description, where url is the designation code. Designations that are for languages won't make it into this list
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
scanDesignations(inc, langs, designations);
}
for (ConceptSetComponent inc : vs.getCompose().getExclude()) {
scanDesignations(inc, langs, designations);
}
boolean doDesignations = langs.size() + designations.size() < MAX_DESIGNATIONS_IN_LINE;
if (header) {
XhtmlNode h = x.h2();
h.addText(vs.present());
addMarkdown(x, vs.getDescription());
if (vs.hasCopyrightElement())
generateCopyright(x, vs);
}
int index = 0;
if (vs.getCompose().getInclude().size() == 1 && vs.getCompose().getExclude().size() == 0) {
hasExtensions = genInclude(x.ul(), vs.getCompose().getInclude().get(0), "Include", langs, doDesignations, maps, designations, index) || hasExtensions;
} else {
XhtmlNode p = x.para();
p.tx("This value set includes codes based on the following rules:");
XhtmlNode ul = x.ul();
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
hasExtensions = genInclude(ul, inc, "Include", langs, doDesignations, maps, designations, index) || hasExtensions;
index++;
}
if (vs.getCompose().hasExclude()) {
p = x.para();
p.tx("This value set excludes codes based on the following rules:");
ul = x.ul();
for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
hasExtensions = genInclude(ul, exc, "Exclude", langs, doDesignations, maps, designations, index) || hasExtensions;
index++;
}
}
}
// now, build observed languages
if (!doDesignations && langs.size() + designations.size() > 0) {
Collections.sort(langs);
if (designations.size() == 0) {
x.para().b().tx("Additional Language Displays");
} else if (langs.size() == 0) {
x.para().b().tx("Additional Designations");
} else {
x.para().b().tx("Additional Designations and Language Displays");
}
XhtmlNode t = x.table("codes");
XhtmlNode tr = t.tr();
tr.td().b().tx("Code");
for (String url : designations.keySet()) {
tr.td().b().addText(designations.get(url));
}
for (String lang : langs) {
tr.td().b().addText(describeLang(lang));
}
for (ConceptSetComponent c : vs.getCompose().getInclude()) {
for (ConceptReferenceComponent cc : c.getConcept()) {
addLanguageRow(cc, t, langs);
}
}
}
return hasExtensions;
}
private void renderExpansionRules(XhtmlNode x, ConceptSetComponent inc, int index, Map<String, ConceptDefinitionComponent> definitions) throws FHIRException, IOException {
String s = "This include specifies a heirarchy for when value sets are generated for use in a User Interface, but the rules are not properly defined";
if (inc.hasExtension(ToolingExtensions.EXT_EXPAND_RULES)) {
String rule = inc.getExtensionString(ToolingExtensions.EXT_EXPAND_RULES);
if (rule != null) {
switch (rule) {
case "all-codes": s = "This include specifies a heirarchy for when value sets are generated for use in a User Interface. The expansion contains all the codes, and also this structure:";
case "ungrouped": s = "This include specifies a heirarchy for when value sets are generated for use in a User Interface. The expansion contains this structure, and any codes not found in the structure:";
case "groups-only": s = "This include specifies a heirarchy for when value sets are generated for use in a User Interface. The expansion contains this structure:";
}
}
}
x.br();
x.tx(s);
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
TableModel model = gen.new TableModel("exp.h="+index, !forResource);
model.setAlternating(true);
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("vs.exp.header", "Code"), translate("vs.exp.hint", "The code for the item"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("vs.exp.header", "Display"), translate("vs.exp.hint", "The display for the item"), null, 0));
for (Extension ext : inc.getExtensionsByUrl(ToolingExtensions.EXT_EXPAND_GROUP)) {
renderExpandGroup(gen, model, ext, inc, definitions);
}
x.br();
x.tx("table");
XhtmlNode xn = gen.generate(model, context.getLocalPrefix(), 1, null);
x.getChildNodes().add(xn);
}
private void renderExpandGroup(HierarchicalTableGenerator gen, TableModel model, Extension ext, ConceptSetComponent inc, Map<String, ConceptDefinitionComponent> definitions) {
Row row = gen.new Row();
model.getRows().add(row);
row.setIcon("icon_entry_blue.png", "entry");
String code = ext.getExtensionString("code");
if (code != null) {
row.getCells().add(gen.new Cell(null, null, code, null, null));
row.getCells().add(gen.new Cell(null, null, getDisplayForCode(inc, code, definitions), null, null));
} else if (ext.hasId()) {
row.getCells().add(gen.new Cell(null, null, "(#"+ext.getId()+")", null, null));
row.getCells().add(gen.new Cell(null, null, ext.getExtensionString("display"), null, null));
} else {
row.getCells().add(gen.new Cell(null, null, null, null, null));
row.getCells().add(gen.new Cell(null, null, ext.getExtensionString("display"), null, null));
}
for (Extension member : ext.getExtensionsByUrl("member")) {
Row subRow = gen.new Row();
row.getSubRows().add(subRow);
subRow.setIcon("icon_entry_blue.png", "entry");
String mc = member.getValue().primitiveValue();
// mc might be a reference to another expansion group - we check that first, or to a code in the compose
if (mc.startsWith("#")) {
// it's a reference by id
subRow.getCells().add(gen.new Cell(null, null, "("+mc+")", null, null));
subRow.getCells().add(gen.new Cell(null, null, "group reference by id", null, null));
} else {
Extension tgt = findTargetByCode(inc, mc);
if (tgt != null) {
subRow.getCells().add(gen.new Cell(null, null, mc, null, null));
subRow.getCells().add(gen.new Cell(null, null, "group reference by code", null, null));
} else {
subRow.getCells().add(gen.new Cell(null, null, mc, null, null));
subRow.getCells().add(gen.new Cell(null, null, getDisplayForCode(inc, mc, definitions), null, null));
}
}
}
}
private Extension findTargetByCode(ConceptSetComponent inc, String mc) {
for (Extension ext : inc.getExtensionsByUrl(ToolingExtensions.EXT_EXPAND_GROUP)) {
String code = ext.getExtensionString("code");
if (mc.equals(code)) {
return ext;
}
}
return null;
}
private String getDisplayForCode(ConceptSetComponent inc, String code, Map<String, ConceptDefinitionComponent> definitions) {
for (ConceptReferenceComponent cc : inc.getConcept()) {
if (code.equals(cc.getCode())) {
if (cc.hasDisplay()) {
return cc.getDisplay();
}
}
}
if (definitions.containsKey(code)) {
return definitions.get(code).getDisplay();
}
return null;
}
private void scanDesignations(ConceptSetComponent inc, List<String> langs, Map<String, String> designations) {
for (ConceptReferenceComponent cc : inc.getConcept()) {
for (Extension ext : cc.getExtension()) {
if (ToolingExtensions.EXT_TRANSLATION.equals(ext.getUrl())) {
String lang = ToolingExtensions.readStringExtension(ext, "lang");
if (!Utilities.noString(lang) && !langs.contains(lang)) {
langs.add(lang);
}
}
}
for (ConceptReferenceDesignationComponent d : cc.getDesignation()) {
String lang = d.getLanguage();
if (!Utilities.noString(lang) && !langs.contains(lang)) {
langs.add(lang);
} else {
// can we present this as a designation that we know?
String url = getUrlForDesignation(d);
String disp = getDisplayForUrl(url);
if (disp != null && !designations.containsKey(url)) {
designations.put(url, disp);
}
}
}
}
}
private String getDisplayForUrl(String url) {
if (url == null) {
return null;
}
switch (url) {
case "http://snomed.info/sct#900000000000003001":
return "Fully specified name";
case "http://snomed.info/sct#900000000000013009":
return "Synonym";
default:
return null;
}
}
private String getUrlForDesignation(ConceptReferenceDesignationComponent d) {
if (d.hasUse() && d.getUse().hasSystem() && d.getUse().hasCode()) {
return d.getUse().getSystem()+"#"+d.getUse().getCode();
} else {
return null;
}
}
private boolean genInclude(XhtmlNode ul, ConceptSetComponent inc, String type, List<String> langs, boolean doDesignations, List<UsedConceptMap> maps, Map<String, String> designations, int index) throws FHIRException, IOException {
boolean hasExtensions = false;
XhtmlNode li;
li = ul.li();
CodeSystem e = getContext().getWorker().fetchCodeSystem(inc.getSystem());
Map<String, ConceptDefinitionComponent> definitions = new HashMap<>();
if (inc.hasSystem()) {
if (inc.getConcept().size() == 0 && inc.getFilter().size() == 0) {
li.addText(type+" all codes defined in ");
addCsRef(inc, li, e);
} else {
if (inc.getConcept().size() > 0) {
li.addText(type+" these codes as defined in ");
addCsRef(inc, li, e);
if (inc.hasVersion()) {
li.addText(" version ");
li.code(inc.getVersion());
}
// for performance reasons, we do all the fetching in one batch
definitions = getConceptsForCodes(e, inc);
XhtmlNode t = li.table("none");
boolean hasComments = false;
boolean hasDefinition = false;
for (ConceptReferenceComponent c : inc.getConcept()) {
hasComments = hasComments || ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_VS_COMMENT);
ConceptDefinitionComponent cc = definitions.get(c.getCode());
hasDefinition = hasDefinition || ((cc != null && cc.hasDefinition()) || ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_DEFINITION));
}
if (hasComments || hasDefinition)
hasExtensions = true;
addMapHeaders(addTableHeaderRowStandard(t, false, true, hasDefinition, hasComments, false, false, null, langs, designations, doDesignations), maps);
for (ConceptReferenceComponent c : inc.getConcept()) {
XhtmlNode tr = t.tr();
XhtmlNode td = tr.td();
ConceptDefinitionComponent cc = definitions.get(c.getCode());
addCodeToTable(false, inc.getSystem(), c.getCode(), c.hasDisplay()? c.getDisplay() : cc != null ? cc.getDisplay() : "", td);
td = tr.td();
if (!Utilities.noString(c.getDisplay()))
td.addText(c.getDisplay());
else if (cc != null && !Utilities.noString(cc.getDisplay()))
td.addText(cc.getDisplay());
if (hasDefinition) {
td = tr.td();
if (ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_DEFINITION)) {
smartAddText(td, ToolingExtensions.readStringExtension(c, ToolingExtensions.EXT_DEFINITION));
} else if (cc != null && !Utilities.noString(cc.getDefinition())) {
smartAddText(td, cc.getDefinition());
}
}
if (hasComments) {
td = tr.td();
if (ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_VS_COMMENT)) {
smartAddText(td, "Note: "+ToolingExtensions.readStringExtension(c, ToolingExtensions.EXT_VS_COMMENT));
}
}
if (doDesignations) {
addDesignationsToRow(c, designations, tr);
addLangaugesToRow(c, langs, tr);
}
}
}
if (inc.getFilter().size() > 0) {
li.addText(type+" codes from ");
addCsRef(inc, li, e);
li.tx(" where ");
for (int i = 0; i < inc.getFilter().size(); i++) {
ConceptSetFilterComponent f = inc.getFilter().get(i);
if (i > 0) {
if (i == inc.getFilter().size()-1) {
li.tx(" and ");
} else {
li.tx(", ");
}
}
if (f.getOp() == FilterOperator.EXISTS) {
if (f.getValue().equals("true")) {
li.tx(f.getProperty()+" exists");
} else {
li.tx(f.getProperty()+" doesn't exist");
}
} else {
li.tx(f.getProperty()+" "+describe(f.getOp())+" ");
if (e != null && codeExistsInValueSet(e, f.getValue())) {
String href = getContext().fixReference(getCsRef(e));
if (href.contains("#"))
href = href + "-"+Utilities.nmtokenize(f.getValue());
else
href = href + "#"+e.getId()+"-"+Utilities.nmtokenize(f.getValue());
li.ah(href).addText(f.getValue());
} else if ("concept".equals(f.getProperty()) && inc.hasSystem()) {
li.addText(f.getValue());
ValidationResult vr = getContext().getWorker().validateCode(getContext().getTerminologyServiceOptions(), inc.getSystem(), inc.getVersion(), f.getValue(), null);
if (vr.isOk()) {
li.tx(" ("+vr.getDisplay()+")");
}
}
else
li.addText(f.getValue());
String disp = ToolingExtensions.getDisplayHint(f);
if (disp != null)
li.tx(" ("+disp+")");
}
}
}
}
if (inc.hasValueSet()) {
li.tx(", where the codes are contained in ");
boolean first = true;
for (UriType vs : inc.getValueSet()) {
if (first)
first = false;
else
li.tx(", ");
AddVsRef(vs.asStringValue(), li);
}
}
if (inc.hasExtension(ToolingExtensions.EXT_EXPAND_RULES) || inc.hasExtension(ToolingExtensions.EXT_EXPAND_GROUP)) {
hasExtensions = true;
renderExpansionRules(li, inc, index, definitions);
}
} else {
li.tx("Import all the codes that are contained in ");
if (inc.getValueSet().size() < 4) {
boolean first = true;
for (UriType vs : inc.getValueSet()) {
if (first)
first = false;
else
li.tx(", ");
AddVsRef(vs.asStringValue(), li);
}
} else {
XhtmlNode xul = li.ul();
for (UriType vs : inc.getValueSet()) {
AddVsRef(vs.asStringValue(), xul.li());
}
}
}
return hasExtensions;
}
public void addDesignationsToRow(ConceptReferenceComponent c, Map<String, String> designations, XhtmlNode tr) {
for (String url : designations.keySet()) {
String d = null;
if (d == null) {
for (ConceptReferenceDesignationComponent dd : c.getDesignation()) {
if (url.equals(getUrlForDesignation(dd))) {
d = dd.getValue();
}
}
}
tr.td().addText(d == null ? "" : d);
}
}
public void addLangaugesToRow(ConceptReferenceComponent c, List<String> langs, XhtmlNode tr) {
for (String lang : langs) {
String d = null;
for (Extension ext : c.getExtension()) {
if (ToolingExtensions.EXT_TRANSLATION.equals(ext.getUrl())) {
String l = ToolingExtensions.readStringExtension(ext, "lang");
if (lang.equals(l)) {
d = ToolingExtensions.readStringExtension(ext, "content");
}
}
}
if (d == null) {
for (ConceptReferenceDesignationComponent dd : c.getDesignation()) {
String l = dd.getLanguage();
if (lang.equals(l)) {
d = dd.getValue();
}
}
}
tr.td().addText(d == null ? "" : d);
}
}
private Map<String, ConceptDefinitionComponent> getConceptsForCodes(CodeSystem e, ConceptSetComponent inc) {
if (e == null) {
e = getContext().getWorker().fetchCodeSystem(inc.getSystem());
}
ValueSetExpansionComponent vse = null;
if (!context.isNoSlowLookup() && !getContext().getWorker().hasCache()) {
try {
ValueSetExpansionOutcome vso = getContext().getWorker().expandVS(inc, false, false);
ValueSet valueset = vso.getValueset();
if (valueset == null)
throw new TerminologyServiceException("Error Expanding ValueSet: "+vso.getError());
vse = valueset.getExpansion();
} catch (TerminologyServiceException e1) {
return null;
}
}
Map<String, ConceptDefinitionComponent> results = new HashMap<>();
List<CodingValidationRequest> serverList = new ArrayList<>();
// 1st pass, anything we can resolve internally
for (ConceptReferenceComponent cc : inc.getConcept()) {
String code = cc.getCode();
ConceptDefinitionComponent v = null;
if (e != null) {
v = getConceptForCode(e.getConcept(), code);
}
if (v == null && vse != null) {
v = getConceptForCodeFromExpansion(vse.getContains(), code);
}
if (v != null) {
results.put(code, v);
} else {
serverList.add(new CodingValidationRequest(new Coding(inc.getSystem(), code, null)));
}
}
if (!context.isNoSlowLookup() && !serverList.isEmpty()) {
getContext().getWorker().validateCodeBatch(getContext().getTerminologyServiceOptions(), serverList, null);
for (CodingValidationRequest vr : serverList) {
ConceptDefinitionComponent v = vr.getResult().asConceptDefinition();
if (v != null) {
results.put(vr.getCoding().getCode(), v);
}
}
}
return results;
}
private ConceptDefinitionComponent getConceptForCode(List<ConceptDefinitionComponent> list, String code) {
for (ConceptDefinitionComponent c : list) {
if (code.equals(c.getCode()))
return c;
ConceptDefinitionComponent v = getConceptForCode(c.getConcept(), code);
if (v != null)
return v;
}
return null;
}
private ConceptDefinitionComponent getConceptForCodeFromExpansion(List<ValueSetExpansionContainsComponent> list, String code) {
for (ValueSetExpansionContainsComponent c : list) {
if (code.equals(c.getCode())) {
ConceptDefinitionComponent res = new ConceptDefinitionComponent();
res.setCode(c.getCode());
res.setDisplay(c.getDisplay());
return res;
}
ConceptDefinitionComponent v = getConceptForCodeFromExpansion(c.getContains(), code);
if (v != null)
return v;
}
return null;
}
private boolean codeExistsInValueSet(CodeSystem cs, String code) {
for (ConceptDefinitionComponent c : cs.getConcept()) {
if (inConcept(code, c))
return true;
}
return false;
}
private void addLanguageRow(ConceptReferenceComponent c, XhtmlNode t, List<String> langs) {
XhtmlNode tr = t.tr();
tr.td().addText(c.getCode());
for (String lang : langs) {
String d = null;
for (ConceptReferenceDesignationComponent cd : c.getDesignation()) {
String l = cd.getLanguage();
if (lang.equals(l))
d = cd.getValue();
}
tr.td().addText(d == null ? "" : d);
}
}
private String describe(FilterOperator op) {
if (op == null)
return " null ";
switch (op) {
case EQUAL: return " = ";
case ISA: return " is-a ";
case ISNOTA: return " is-not-a ";
case REGEX: return " matches (by regex) ";
case NULL: return " ?ngen-13? ";
case IN: return " in ";
case NOTIN: return " not in ";
case DESCENDENTOF: return " descends from ";
case EXISTS: return " exists ";
case GENERALIZES: return " generalizes ";
}
return null;
}
private boolean inConcept(String code, ConceptDefinitionComponent c) {
if (c.hasCodeElement() && c.getCode().equals(code))
return true;
for (ConceptDefinitionComponent g : c.getConcept()) {
if (inConcept(code, g))
return true;
}
return false;
}
}
|
3e07a1874cf2fa7eb9e3d6f082f4d8d239f66988
| 2,143 |
java
|
Java
|
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/events/PreAlterPartitionEvent.java
|
manbuyun/hive
|
cdb1052e24ca493c6486fef3dd8956dde61be834
|
[
"Apache-2.0"
] | 4,140 |
2015-01-07T11:57:35.000Z
|
2022-03-31T06:26:22.000Z
|
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/events/PreAlterPartitionEvent.java
|
manbuyun/hive
|
cdb1052e24ca493c6486fef3dd8956dde61be834
|
[
"Apache-2.0"
] | 1,779 |
2015-05-27T04:32:42.000Z
|
2022-03-31T18:53:19.000Z
|
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/events/PreAlterPartitionEvent.java
|
manbuyun/hive
|
cdb1052e24ca493c6486fef3dd8956dde61be834
|
[
"Apache-2.0"
] | 3,958 |
2015-01-01T15:14:49.000Z
|
2022-03-30T21:08:32.000Z
| 30.183099 | 103 | 0.75035 | 3,231 |
/*
* 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.hadoop.hive.metastore.events;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.hive.metastore.IHMSHandler;
import org.apache.hadoop.hive.metastore.api.Partition;
import org.apache.hadoop.hive.metastore.api.Table;
@InterfaceAudience.Public
@InterfaceStability.Stable
public class PreAlterPartitionEvent extends PreEventContext {
private final String dbName;
private final String tableName;
private final Table table;
private final List<String> oldPartVals;
private final Partition newPart;
public PreAlterPartitionEvent(String dbName, String tableName, Table table, List<String> oldPartVals,
Partition newPart, IHMSHandler handler) {
super(PreEventType.ALTER_PARTITION, handler);
this.dbName = dbName;
this.tableName = tableName;
this.table = table;
this.oldPartVals = oldPartVals;
this.newPart = newPart;
}
public String getDbName() {
return dbName;
}
public String getTableName() {
return tableName;
}
public Table getTable() { return table; }
public List<String> getOldPartVals() {
return oldPartVals;
}
/**
*
* @return the new partition
*/
public Partition getNewPartition() {
return newPart;
}
}
|
3e07a42f5038f929631b25bced1bb0390e883c52
| 1,071 |
java
|
Java
|
core/src/main/java/com/sequenceiq/cloudbreak/service/AbstractArchivistService.java
|
nbathra/cloudbreak
|
6e784b9ebd4804de1dcd2d0efd14de65def2abdd
|
[
"Apache-2.0"
] | null | null | null |
core/src/main/java/com/sequenceiq/cloudbreak/service/AbstractArchivistService.java
|
nbathra/cloudbreak
|
6e784b9ebd4804de1dcd2d0efd14de65def2abdd
|
[
"Apache-2.0"
] | null | null | null |
core/src/main/java/com/sequenceiq/cloudbreak/service/AbstractArchivistService.java
|
nbathra/cloudbreak
|
6e784b9ebd4804de1dcd2d0efd14de65def2abdd
|
[
"Apache-2.0"
] | null | null | null | 34.548387 | 152 | 0.763772 | 3,232 |
package com.sequenceiq.cloudbreak.service;
import javax.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sequenceiq.cloudbreak.domain.ArchivableResource;
import com.sequenceiq.cloudbreak.domain.workspace.WorkspaceAwareResource;
import com.sequenceiq.cloudbreak.logger.MDCBuilder;
public abstract class AbstractArchivistService<T extends WorkspaceAwareResource & ArchivableResource> extends AbstractWorkspaceAwareResourceService<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractArchivistService.class);
@Inject
private Clock clock;
@Override
public T delete(T resource) {
MDCBuilder.buildMdcContext(resource);
LOGGER.debug("Archiving {} with name: {}", resource().getReadableName(), resource.getName());
prepareDeletion(resource);
resource.setArchived(true);
resource.setDeletionTimestamp(clock.getCurrentTimeMillis());
resource.unsetRelationsToEntitiesToBeDeleted();
repository().save(resource);
return resource;
}
}
|
3e07a465f1c8f6f31991a937767f68d1915080a5
| 1,382 |
java
|
Java
|
Codici/Lezioni/src/it/franzil/animations/SimpleTransitionDemo.java
|
BigEmperor26/LinguaggiMod1UniTN
|
a0f8d0ed10b5e38a5edb8bf2dea2bf7ecf10bc0a
|
[
"MIT"
] | 3 |
2019-05-30T12:14:53.000Z
|
2019-05-30T19:48:46.000Z
|
Codici/Lezioni/src/it/franzil/animations/SimpleTransitionDemo.java
|
BigEmperor26/LinguaggiMod1UniTN
|
a0f8d0ed10b5e38a5edb8bf2dea2bf7ecf10bc0a
|
[
"MIT"
] | null | null | null |
Codici/Lezioni/src/it/franzil/animations/SimpleTransitionDemo.java
|
BigEmperor26/LinguaggiMod1UniTN
|
a0f8d0ed10b5e38a5edb8bf2dea2bf7ecf10bc0a
|
[
"MIT"
] | 1 |
2019-05-30T19:49:10.000Z
|
2019-05-30T19:49:10.000Z
| 26.576923 | 64 | 0.609262 | 3,233 |
package it.franzil.animations;
import javafx.animation.Animation;
import javafx.animation.Transition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.util.Duration;
/**
* @author ronchet
*/
public class SimpleTransitionDemo extends Application {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
final String content = "Animazioni Java FX";
final Text text = new Text(10, 20, "");
final Animation animation = new Transition() {
{
setCycleDuration(Duration.millis(3000));
setAutoReverse(false);
setCycleCount(INDEFINITE);
}
protected void interpolate(double frac) {
final int length = content.length();
final int n = Math.round(length * (float) frac);
text.setText(content.substring(0, n));
}
};
StackPane root = new StackPane();
root.getChildren().add(text);
Scene scene = new Scene(root, 300, 250);
primaryStage.setScene(scene);
primaryStage.show();
animation.play();
}
}
|
3e07a4b897f24f697a14e751213e2cb9be0578d3
| 1,213 |
java
|
Java
|
src/main/java/com/wechat/pay/contrib/apache/httpclient/serializer/DecryptDeserializer.java
|
icielo/wechatpay-apache-httpclient
|
2b41e3b2cb6c1ffa1cb7e5485f3f9ca531e7933d
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/wechat/pay/contrib/apache/httpclient/serializer/DecryptDeserializer.java
|
icielo/wechatpay-apache-httpclient
|
2b41e3b2cb6c1ffa1cb7e5485f3f9ca531e7933d
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/wechat/pay/contrib/apache/httpclient/serializer/DecryptDeserializer.java
|
icielo/wechatpay-apache-httpclient
|
2b41e3b2cb6c1ffa1cb7e5485f3f9ca531e7933d
|
[
"Apache-2.0"
] | null | null | null | 28.880952 | 84 | 0.70404 | 3,234 |
package com.wechat.pay.contrib.apache.httpclient.serializer;
import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.JSONLexer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import com.wechat.pay.contrib.apache.httpclient.WechatpayConfig;
import com.wechat.pay.contrib.apache.httpclient.util.RSAUtil;
import lombok.extern.slf4j.Slf4j;
import javax.crypto.BadPaddingException;
import java.io.IOException;
import java.lang.reflect.Type;
/**
* json转对象反序列化时,进行解密处理
*
* @author lincl
*/
@Slf4j
public class DecryptDeserializer implements ObjectDeserializer {
@Override
public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
JSONLexer jsonLexer = parser.lexer;
String value = jsonLexer.stringVal();
String result = value;
try {
result = RSAUtil.rsaDecryptOAEP(value, WechatpayConfig.PRIVATE_KEY);
} catch (BadPaddingException e) {
log.error(e.getMessage(), e);
} catch (IOException e) {
log.error(e.getMessage(), e);
}
return (T) result;
}
@Override
public int getFastMatchToken() {
return 0;
}
}
|
3e07a4e55f8789117f1040ef10d1b5ba0fe26565
| 1,274 |
java
|
Java
|
app/src/main/java/com/icaynia/dmxario/Layout/Fragment/MessageFragment.java
|
sionuume/DMXArio
|
9c05dcc3d1e5895584cf86d21edab1ab0fd3926f
|
[
"MIT"
] | 1 |
2020-06-03T13:37:10.000Z
|
2020-06-03T13:37:10.000Z
|
app/src/main/java/com/icaynia/dmxario/Layout/Fragment/MessageFragment.java
|
sionuume/DMXArio
|
9c05dcc3d1e5895584cf86d21edab1ab0fd3926f
|
[
"MIT"
] | 11 |
2020-04-05T07:49:27.000Z
|
2020-04-05T07:50:43.000Z
|
app/src/main/java/com/icaynia/dmxario/Layout/Fragment/MessageFragment.java
|
sionuume/DMXArio
|
9c05dcc3d1e5895584cf86d21edab1ab0fd3926f
|
[
"MIT"
] | null | null | null | 29.627907 | 103 | 0.701727 | 3,235 |
package com.icaynia.dmxario.Layout.Fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.icaynia.dmxario.Layout.Activity.MainActivity;
import com.icaynia.dmxario.R;
import com.icaynia.dmxario.Layout.View.MessageCardView;
/**
* Created by icaynia on 2017. 1. 13..
*/
public class MessageFragment extends Fragment {
private View v;
//詳しくはメッセージリスト。
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
v = inflater.inflate(R.layout.fragment_message, container, false);
viewInitialize();
return v;
}
private void viewInitialize() {
((MainActivity)getActivity()).getSupportActionBar().setTitle("메시지");
LinearLayout parent = (LinearLayout) v.findViewById(R.id.parentBox);
for (int count = 0; count <= 5; count++) {
MessageCardView messageCardView = new MessageCardView(getActivity());
messageCardView.setTitleText("title = " + count );
messageCardView.setSubtitleText("subtitle!" + count);
parent.addView(messageCardView);
}
}
}
|
3e07a5763579e16f7ec2b9185ca0167ae78ad57c
| 326 |
java
|
Java
|
HebrewNLP4J/src/il/co/hebrewnlp/morphology/Person.java
|
HebrewNLP/HebrewNLP4J
|
cc63665e3649e6ba105c2eb38066435f9e83e40c
|
[
"MIT"
] | 6 |
2018-07-15T07:48:33.000Z
|
2021-04-20T22:27:33.000Z
|
HebrewNLP4J/src/il/co/hebrewnlp/morphology/Person.java
|
HebrewNLP/HebrewNLP4J
|
cc63665e3649e6ba105c2eb38066435f9e83e40c
|
[
"MIT"
] | 1 |
2020-09-09T15:24:20.000Z
|
2020-09-09T15:24:20.000Z
|
HebrewNLP4J/src/il/co/hebrewnlp/morphology/Person.java
|
HebrewNLP/HebrewNLP4J
|
cc63665e3649e6ba105c2eb38066435f9e83e40c
|
[
"MIT"
] | null | null | null | 9.055556 | 55 | 0.564417 | 3,236 |
package il.co.hebrewnlp.morphology;
import java.io.Serializable;
/**
* גוף
*/
public enum Person implements Serializable, Cloneable {
/**
* אין
*/
NONE,
/**
* כל האפשרויות
*/
ALL,
/**
* גוף ראשון
*/
FIRST_PERSON,
/**
* גוף שני
*/
SECOND_PERSON,
/**
* גוף שלישי
*/
THIRD_PERSON,
}
|
3e07a5e69d190fe26d9d5d3bc95d8ae81814285f
| 732 |
java
|
Java
|
org.nightglower.hutubill/src/startup/Bootstrap.java
|
RitaRossweiss/PiecemealCode
|
422165504153fa5c3e2107eace743a87a9a1c955
|
[
"MIT"
] | null | null | null |
org.nightglower.hutubill/src/startup/Bootstrap.java
|
RitaRossweiss/PiecemealCode
|
422165504153fa5c3e2107eace743a87a9a1c955
|
[
"MIT"
] | null | null | null |
org.nightglower.hutubill/src/startup/Bootstrap.java
|
RitaRossweiss/PiecemealCode
|
422165504153fa5c3e2107eace743a87a9a1c955
|
[
"MIT"
] | null | null | null | 21.529412 | 75 | 0.617486 | 3,237 |
package startup;
import gui.frame.MainFrame;
import gui.panel.MainPanel;
import util.GUIUtil;
import util.SpendPanel;
import javax.swing.*;
import java.lang.reflect.InvocationTargetException;
/**
* @ClassName Bootstrap
* @Description 引导启动
* @Author NightGlower
* @Date 2020/7/23 16:18
* @Version 1.0
*/
public class Bootstrap {
public static void main(String[] args) throws Exception {
GUIUtil.useLNF();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
MainFrame.instance.setVisible(true);
MainPanel.instance.workingPanel.show(SpendPanel.instance);
}
});
}
}
|
3e07a615419841903493e2f3f50744b622d9eada
| 3,052 |
java
|
Java
|
vt-admin/src/main/java/com/snk/web/controller/door/CwaHolidayController.java
|
vt-jack/vt-SmartPark
|
541111e3cd496f313aa0adb52e1d69b173debb8a
|
[
"MIT"
] | 4 |
2021-02-23T03:00:26.000Z
|
2022-03-10T05:11:50.000Z
|
vt-admin/src/main/java/com/snk/web/controller/door/CwaHolidayController.java
|
vt-jack/vt-SmartPark
|
541111e3cd496f313aa0adb52e1d69b173debb8a
|
[
"MIT"
] | null | null | null |
vt-admin/src/main/java/com/snk/web/controller/door/CwaHolidayController.java
|
vt-jack/vt-SmartPark
|
541111e3cd496f313aa0adb52e1d69b173debb8a
|
[
"MIT"
] | 4 |
2021-04-10T05:50:13.000Z
|
2021-06-29T01:52:36.000Z
| 25.016393 | 83 | 0.673657 | 3,238 |
package com.snk.web.controller.door;
import com.snk.common.annotation.Log;
import com.snk.common.core.controller.BaseController;
import com.snk.common.core.domain.AjaxResult;
import com.snk.common.core.page.TableDataInfo;
import com.snk.common.enums.BusinessType;
import com.snk.door.domain.CwaHoliday;
import com.snk.door.service.ICwaHolidayService;
import com.snk.framework.util.ShiroUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 节假日Controller
*
* @author snk
* @date 2020-10-28
*/
@Controller
@RequestMapping("/door/cwa/holiday")
public class CwaHolidayController extends BaseController
{
private String prefix = "door/cwa/holiday";
@Autowired
private ICwaHolidayService cwaHolidayService;
@RequiresPermissions("door:holiday:view")
@GetMapping()
public String user()
{
return prefix + "/holiday";
}
/**
* 查询节假日列表
*/
@RequiresPermissions("door:holiday:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(CwaHoliday cwaHoliday)
{
startPage();
List<CwaHoliday> list = cwaHolidayService.selectCwaHolidayList(cwaHoliday);
return getDataTable(list);
}
/**
* 查询节假日列表
*/
@GetMapping("/all")
@ResponseBody
public List<CwaHoliday> all()
{
return cwaHolidayService.selectCwaHolidayList(new CwaHoliday());
}
/**
* 新增节假日
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存节假日
*/
@RequiresPermissions("door:holiday:add")
@Log(title = "节假日", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(CwaHoliday cwaHoliday)
{
cwaHoliday.setCreateBy(ShiroUtils.getLoginName());
return toAjax(cwaHolidayService.insertCwaHoliday(cwaHoliday));
}
/**
* 修改节假日
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable Long id, ModelMap mmap)
{
mmap.put("holiday", cwaHolidayService.selectCwaHolidayById(id));
return prefix + "/edit";
}
/**
* 修改保存节假日
*/
@RequiresPermissions("door:holiday:edit")
@Log(title = "节假日", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(CwaHoliday cwaHoliday)
{
cwaHoliday.setUpdateBy(ShiroUtils.getLoginName());
return toAjax(cwaHolidayService.updateCwaHoliday(cwaHoliday));
}
/**
* 删除节假日
*/
@RequiresPermissions("door:holiday:remove")
@Log(title = "节假日", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(cwaHolidayService.deleteCwaHolidayByIds(ids));
}
}
|
3e07a622aab39e30b009bf8155af14d72e5139da
| 577 |
java
|
Java
|
src/main/java/seedu/address/model/IgnoreImportConflictResolver.java
|
ranaldmiao/CS2103-DeadlineManager
|
4c1fe6da9eb170900ca889a62050b0a21a1d1f0a
|
[
"MIT"
] | 1 |
2018-10-10T13:55:59.000Z
|
2018-10-10T13:55:59.000Z
|
src/main/java/seedu/address/model/IgnoreImportConflictResolver.java
|
ranaldmiao/CS2103-DeadlineManager
|
4c1fe6da9eb170900ca889a62050b0a21a1d1f0a
|
[
"MIT"
] | 246 |
2018-09-08T13:48:36.000Z
|
2018-11-12T15:58:01.000Z
|
src/main/java/seedu/address/model/IgnoreImportConflictResolver.java
|
ranaldmiao/CS2103-DeadlineManager
|
4c1fe6da9eb170900ca889a62050b0a21a1d1f0a
|
[
"MIT"
] | 7 |
2018-09-19T09:08:43.000Z
|
2020-03-02T16:31:36.000Z
| 28.85 | 112 | 0.7487 | 3,239 |
package seedu.address.model;
import java.util.function.Consumer;
import seedu.address.model.task.Task;
/**
* The DuplicateImportConflictResolver class.
* This class will resolve import conflicts by ignoring the incoming entry, i.e. after the resolver is complete,
* the existing entry in the TaskCollection will remain.
*/
public class IgnoreImportConflictResolver extends ImportConflictResolver {
@Override
public void resolve(Consumer<Task> addTask, Consumer<Task> removeTask, Task task) {
//Ignore task.
LOGGER.info("Ignoring task");
}
}
|
3e07a819e3de20666bf2ebe27a39a5dd80aca272
| 369 |
java
|
Java
|
basic/FahrenheitToCelsius.java
|
shilpasayura/java
|
9202f264b9d6199eeb8fe00b47ce81768b861d07
|
[
"MIT"
] | 1 |
2021-08-21T20:59:53.000Z
|
2021-08-21T20:59:53.000Z
|
basic/OddOrEven2.java
|
shilpasayura/java
|
9202f264b9d6199eeb8fe00b47ce81768b861d07
|
[
"MIT"
] | null | null | null |
basic/OddOrEven2.java
|
shilpasayura/java
|
9202f264b9d6199eeb8fe00b47ce81768b861d07
|
[
"MIT"
] | null | null | null | 24.6 | 64 | 0.653117 | 3,240 |
import java.util.*;
class FahrenheitToCelsius {
public static void main(String[] args) {
float temperatue;
Scanner in = new Scanner(System.in);
System.out.println("Enter temperatue in Fahrenheit");
temperatue = in.nextInt();
temperatue = ((temperatue - 32)*5)/9;
System.out.println("Temperatue in Celsius = " + temperatue);
}
}
|
3e07a92d8946d9cdb5755dabe8d54c2a7d724b1c
| 817 |
java
|
Java
|
web/web_client/src/main/java/cz/nkp/urnnbn/client/forms/LabelField.java
|
NLCR/CZIDLO
|
c830b6d4d5cfdf75c91f0937eea3470f2d23f5c9
|
[
"PostgreSQL"
] | 3 |
2017-03-21T10:12:48.000Z
|
2020-07-18T11:47:15.000Z
|
web/web_client/src/main/java/cz/nkp/urnnbn/client/forms/LabelField.java
|
NLCR/CZIDLO
|
c830b6d4d5cfdf75c91f0937eea3470f2d23f5c9
|
[
"PostgreSQL"
] | 117 |
2015-06-16T13:20:34.000Z
|
2021-06-17T14:31:57.000Z
|
web/web_client/src/main/java/cz/nkp/urnnbn/client/forms/LabelField.java
|
NLCR/CZIDLO
|
c830b6d4d5cfdf75c91f0937eea3470f2d23f5c9
|
[
"PostgreSQL"
] | null | null | null | 17.76087 | 58 | 0.597307 | 3,241 |
package cz.nkp.urnnbn.client.forms;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class LabelField extends Field {
private final Widget label;
public LabelField(String labelText) {
// this.label = new Label(labelText);
this.label = new HTML("<b>" + labelText + "</b>");
}
@Override
public Widget getLabelWidget() {
return label;
}
@Override
public Widget getContentWidget() {
return null;
}
@Override
public boolean validValueInserted() {
return true;
}
@Override
public Object getInsertedValue() {
return null;
}
@Override
public void disable() {
// nothing
}
@Override
public void enable() {
// nothing
}
}
|
3e07a97625c3f26c2a4fb5c061d85c095d2c7ace
| 2,625 |
java
|
Java
|
wk-nb-web-app-demo/src/main/java/com/budwk/nb/app/commons/base/Globals.java
|
waterlovevip/budwk
|
f19d8d5cdb0394da07bb0ddb34b491fae542a49a
|
[
"Apache-2.0"
] | null | null | null |
wk-nb-web-app-demo/src/main/java/com/budwk/nb/app/commons/base/Globals.java
|
waterlovevip/budwk
|
f19d8d5cdb0394da07bb0ddb34b491fae542a49a
|
[
"Apache-2.0"
] | null | null | null |
wk-nb-web-app-demo/src/main/java/com/budwk/nb/app/commons/base/Globals.java
|
waterlovevip/budwk
|
f19d8d5cdb0394da07bb0ddb34b491fae542a49a
|
[
"Apache-2.0"
] | null | null | null | 31.963415 | 87 | 0.595193 | 3,242 |
package com.budwk.nb.app.commons.base;
import com.alibaba.dubbo.config.annotation.Reference;
import com.budwk.nb.sys.models.Sys_config;
import com.budwk.nb.sys.services.SysConfigService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import java.util.List;
/**
* @author wizzer([email protected]) on 2016/12/19.
*/
@IocBean(create = "init")
public class Globals {
// 项目路径
public static String AppRoot = "";
// 项目目录
public static String AppBase = "";
// 项目名称
public static String AppName = "BudWk V6";
// 项目短名称
public static String AppShrotName = "budwk";
// 项目域名
public static String AppDomain = "http://127.0.0.1";
// 文件访问域名
public static String AppFileDomain = "";
// 文件上传路径
public static String AppUploadBase = "/upload";
// 默认微信ID
public static String AppDefultWxID = "MAIN";
// 系统自定义参数
public static NutMap MyConfig = NutMap.NEW();
// 微信map
public static NutMap WxMap = NutMap.NEW();
// 微信支付map
public static NutMap WxPay3Map = NutMap.NEW();
@Inject
@Reference
private SysConfigService sysConfigService;
public void init() {
initSysParam(sysConfigService);
}
public static void initSysParam(SysConfigService sysConfigService) {
Globals.MyConfig.clear();
List<Sys_config> configList = sysConfigService.query();
for (Sys_config sysConfig : configList) {
switch (Strings.sNull(sysConfig.getConfigKey())) {
case "AppName":
Globals.AppName = sysConfig.getConfigValue();
break;
case "AppShrotName":
Globals.AppShrotName = sysConfig.getConfigValue();
break;
case "AppDomain":
Globals.AppDomain = sysConfig.getConfigValue();
break;
case "AppFileDomain":
Globals.AppFileDomain = sysConfig.getConfigValue();
break;
case "AppUploadBase":
Globals.AppUploadBase = sysConfig.getConfigValue();
break;
case "AppDefultWxID":
Globals.AppDefultWxID = sysConfig.getConfigValue();
break;
default:
break;
}
Globals.MyConfig.put(sysConfig.getConfigKey(), sysConfig.getConfigValue());
}
}
public static void initWx() {
Globals.WxMap.clear();
}
}
|
3e07a9cb6455db0b6a91e593eba5440a856a572d
| 1,003 |
java
|
Java
|
src/main/java/es/upm/miw/apaw_practice/adapters/mongodb/garage/persistence/MechanicPersistenceMongodb.java
|
helderhernandez/apaw-practice
|
38fbe250f5ff21f2503ab129e243c2cbecf312d9
|
[
"MIT"
] | null | null | null |
src/main/java/es/upm/miw/apaw_practice/adapters/mongodb/garage/persistence/MechanicPersistenceMongodb.java
|
helderhernandez/apaw-practice
|
38fbe250f5ff21f2503ab129e243c2cbecf312d9
|
[
"MIT"
] | null | null | null |
src/main/java/es/upm/miw/apaw_practice/adapters/mongodb/garage/persistence/MechanicPersistenceMongodb.java
|
helderhernandez/apaw-practice
|
38fbe250f5ff21f2503ab129e243c2cbecf312d9
|
[
"MIT"
] | null | null | null | 37.148148 | 90 | 0.813559 | 3,243 |
package es.upm.miw.apaw_practice.adapters.mongodb.garage.persistence;
import es.upm.miw.apaw_practice.adapters.mongodb.garage.daos.MechanicRepository;
import es.upm.miw.apaw_practice.adapters.mongodb.garage.entities.MechanicEntity;
import es.upm.miw.apaw_practice.domain.models.garage.Mechanic;
import es.upm.miw.apaw_practice.domain.persistence_ports.garage.MechanicPersistence;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.stream.Stream;
@Repository("mechanicPersistence")
public class MechanicPersistenceMongodb implements MechanicPersistence {
private final MechanicRepository mechanicRepository;
@Autowired
public MechanicPersistenceMongodb(MechanicRepository mechanicRepository) {
this.mechanicRepository = mechanicRepository;
}
@Override
public Stream<Mechanic> readAll() {
return this.mechanicRepository.findAll().stream().map(MechanicEntity::toMechanic);
}
}
|
3e07aa4eb080f10a07956ac734ce8d450d313ef1
| 1,608 |
java
|
Java
|
platform-common/src/test/java/com/softicar/platform/common/string/ImploderTest.java
|
softicar/platform
|
d4cf99f3e3537272af23bf60f6b088891bd271ff
|
[
"MIT"
] | 1 |
2021-11-25T09:58:31.000Z
|
2021-11-25T09:58:31.000Z
|
platform-common/src/test/java/com/softicar/platform/common/string/ImploderTest.java
|
softicar/platform
|
d4cf99f3e3537272af23bf60f6b088891bd271ff
|
[
"MIT"
] | 22 |
2021-11-10T13:59:22.000Z
|
2022-03-04T16:38:33.000Z
|
platform-common/src/test/java/com/softicar/platform/common/string/ImploderTest.java
|
softicar/platform
|
d4cf99f3e3537272af23bf60f6b088891bd271ff
|
[
"MIT"
] | null | null | null | 17.67033 | 85 | 0.636194 | 3,244 |
package com.softicar.platform.common.string;
import com.softicar.platform.common.testing.AbstractTest;
import org.junit.Test;
/**
* @author Robert Kühne
*/
public class ImploderTest extends AbstractTest {
@Test
public void implodeEmptyArray() {
String s = Imploder.implode(new String[] {}, "sep");
assertEquals("", s);
}
@Test
public void implodeSingleEntryArray() {
String s = Imploder.implode(new String[] { "House" }, "Wall");
assertEquals("House", s);
}
@Test
public void implodeArray() {
String s = Imploder.implode(new String[] { "a", "b", "c" }, ":");
assertEquals("a:b:c", s);
}
@Test
public void repeat() {
String s = Imploder.implode("Cat", 3, "woman");
assertEquals("CatwomanCatwomanCat", s);
}
@Test
public void repeatEmptySeparator() {
String s = Imploder.implode("Emma", 3, "");
assertEquals("EmmaEmmaEmma", s);
}
@Test
public void repeatEmptyItem() {
String s = Imploder.implode("", 4, "sep");
assertEquals("sepsepsep", s);
}
@Test
public void repeatNegativeCount() {
String s = Imploder.implode("Batman", -3, "");
assertEquals("", s);
}
@Test
public void implodeQuotedNoEntry() {
String s = Imploder.implodeQuoted(new String[] {}, ", ", "X");
assertEquals("", s);
}
@Test
public void implodeQuotedOneEntry() {
String s = Imploder.implodeQuoted(new String[] { "Garfield" }, ", ", "X");
assertEquals("XGarfieldX", s);
}
@Test
public void implodeQuoted() {
String s = Imploder.implodeQuoted(new String[] { "Batman", "Robin" }, ", ", "+++");
assertEquals("+++Batman+++, +++Robin+++", s);
}
}
|
3e07aa8e1dfd3d4d100e4fff462550c67b8116e4
| 611 |
java
|
Java
|
powerhigh-core/src/org/powerhigh/graphics/BitmapFont.java
|
zenith391/PixEngine
|
c3d9b5ccd96fe73e77dd5b53ef1e00323cd0ad64
|
[
"MIT"
] | 2 |
2018-06-16T09:10:52.000Z
|
2018-06-16T09:16:10.000Z
|
powerhigh-core/src/org/powerhigh/graphics/BitmapFont.java
|
zenith391/PixEngine
|
c3d9b5ccd96fe73e77dd5b53ef1e00323cd0ad64
|
[
"MIT"
] | 2 |
2018-06-07T10:02:14.000Z
|
2018-07-09T18:22:41.000Z
|
powerhigh-core/src/org/powerhigh/graphics/BitmapFont.java
|
DigitalSnakeSoftware/PowerHigh
|
c3d9b5ccd96fe73e77dd5b53ef1e00323cd0ad64
|
[
"MIT"
] | null | null | null | 16.972222 | 54 | 0.685761 | 3,245 |
package org.powerhigh.graphics;
public class BitmapFont {
private Texture[] chars;
private String encoding;
public BitmapFont(Texture[] chars, String encoding) {
this.chars = chars;
this.encoding = encoding;
}
public String getEncoding() {
return encoding;
}
public Texture getChar(int ch) {
return chars[ch];
}
public void setChar(int ch, Texture t) {
chars[ch] = t;
}
public int getCharsLength() {
return chars.length;
}
public static BitmapFont load(String path) {
Texture[] chars = null;
String encoding = "UTF-8";
return new BitmapFont(chars, encoding);
}
}
|
3e07aaa4758205f416905c842e24d4346b79e4e8
| 7,984 |
java
|
Java
|
jstarcraft-core-common/src/main/java/com/jstarcraft/core/utility/RandomUtility.java
|
yuandaoma/jstarcraft-core
|
d2fa3513a7b98b1d1da68629d962d119a98a554d
|
[
"Apache-2.0"
] | 157 |
2019-04-22T03:37:30.000Z
|
2022-03-21T06:43:12.000Z
|
jstarcraft-core-common/src/main/java/com/jstarcraft/core/utility/RandomUtility.java
|
yuandaoma/jstarcraft-core
|
d2fa3513a7b98b1d1da68629d962d119a98a554d
|
[
"Apache-2.0"
] | 18 |
2020-01-02T04:25:09.000Z
|
2022-03-08T21:11:42.000Z
|
jstarcraft-core-common/src/main/java/com/jstarcraft/core/utility/RandomUtility.java
|
yuandaoma/jstarcraft-core
|
d2fa3513a7b98b1d1da68629d962d119a98a554d
|
[
"Apache-2.0"
] | 44 |
2019-04-22T12:30:09.000Z
|
2021-08-06T01:04:16.000Z
| 23.276968 | 96 | 0.490982 | 3,246 |
package com.jstarcraft.core.utility;
import java.util.Random;
/**
* 随机工具
*
* @author Birdy
*/
public final class RandomUtility {
private static Random random = new Random(NumberUtility.LONG_ZERO);
private RandomUtility() {
}
/**
* 获取随机引擎
*
* @return
*/
public static Random getRandom() {
return random;
}
/**
* 设置随机引擎
*
* @param engine
*/
public static void setRandom(Random engine) {
random = engine;
}
/**
* 设置随机种子
*
* @param seed
*/
public static void setSeed(long seed) {
random.setSeed(seed);
}
public static boolean randomBoolean() {
return random.nextBoolean();
}
public static byte[] randomBytes(byte[] bytes) {
random.nextBytes(bytes);
return bytes;
}
public static int randomInteger(final int beginInclusive, final int endExclusive) {
assert beginInclusive <= endExclusive;
if (beginInclusive == endExclusive) {
return beginInclusive;
}
return beginInclusive + random.nextInt(endExclusive - beginInclusive);
}
public static int randomInteger(final int range) {
return randomInteger(0, range);
}
public static int randomInteger() {
return randomInteger(Integer.MAX_VALUE);
}
public static long randomLong(final long beginInclusive, final long endExclusive) {
assert beginInclusive <= endExclusive;
if (beginInclusive == endExclusive) {
return beginInclusive;
}
return (long) randomDouble(beginInclusive, endExclusive);
}
public static long randomLong(final long range) {
return randomLong(0L, range);
}
public static long randomLong() {
return randomLong(Long.MAX_VALUE);
}
public static float randomFloat(final float beginInclusive, final float endExclusive) {
assert beginInclusive <= endExclusive;
if (beginInclusive == endExclusive) {
return beginInclusive;
}
return beginInclusive + ((endExclusive - beginInclusive) * random.nextFloat());
}
public static float randomFloat(final float range) {
return randomFloat(0F, range);
}
public static float randomFloat() {
return randomFloat(Float.MAX_VALUE);
}
public static double randomDouble(final double beginInclusive, final double endExclusive) {
assert beginInclusive <= endExclusive;
if (beginInclusive == endExclusive) {
return beginInclusive;
}
return beginInclusive + ((endExclusive - beginInclusive) * random.nextDouble());
}
public static double randomDouble(final double range) {
return randomDouble(0D, range);
}
public static double randomDouble() {
return randomDouble(Double.MAX_VALUE);
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(boolean[] datas) {
int size = datas.length;
shuffle(datas, 0, size);
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(int[] datas) {
int size = datas.length;
shuffle(datas, 0, size);
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(long[] datas) {
int size = datas.length;
shuffle(datas, 0, size);
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(float[] datas) {
int size = datas.length;
shuffle(datas, 0, size);
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(double[] datas) {
int size = datas.length;
shuffle(datas, 0, size);
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(T[] datas) {
int size = datas.length;
shuffle(datas, 0, size);
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(boolean[] datas, int from, int to) {
int size = to - from;
if (size <= 1) {
return;
}
for (int index = from; index < to; index++) {
int random = RandomUtility.randomInteger(from, to);
boolean data = datas[index];
datas[index] = datas[random];
datas[random] = data;
}
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(int[] datas, int from, int to) {
int size = to - from;
if (size <= 1) {
return;
}
for (int index = from; index < to; index++) {
int random = RandomUtility.randomInteger(from, to);
int data = datas[index];
datas[index] = datas[random];
datas[random] = data;
}
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(long[] datas, int from, int to) {
int size = to - from;
if (size <= 1) {
return;
}
for (int index = from; index < to; index++) {
int random = RandomUtility.randomInteger(from, to);
long data = datas[index];
datas[index] = datas[random];
datas[random] = data;
}
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(float[] datas, int from, int to) {
int size = to - from;
if (size <= 1) {
return;
}
for (int index = from; index < to; index++) {
int random = RandomUtility.randomInteger(from, to);
float data = datas[index];
datas[index] = datas[random];
datas[random] = data;
}
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(double[] datas, int from, int to) {
int size = to - from;
if (size <= 1) {
return;
}
for (int index = from; index < to; index++) {
int random = RandomUtility.randomInteger(from, to);
double data = datas[index];
datas[index] = datas[random];
datas[random] = data;
}
}
/**
* 洗牌
*
* <pre>
* 通过随机与交换的方式实现打乱排序的目的.
* </pre>
*
* @param datas
*/
public static <T> void shuffle(T[] datas, int from, int to) {
int size = to - from;
if (size <= 1) {
return;
}
for (int index = from; index < to; index++) {
int random = RandomUtility.randomInteger(from, to);
T data = datas[index];
datas[index] = datas[random];
datas[random] = data;
}
}
/**
* 随机分布
*
* @return
*/
// TODO 考虑是否使用概率分布替代
public static double randomGaussian() {
return random.nextGaussian();
}
}
|
3e07ae2b018471bfc606511a13d0a67d985c6f3e
| 567 |
java
|
Java
|
src/main/java/com/nerdkapp/homebot/infrastructure/resources/Echo.java
|
Nerdkapp/HomeBot
|
43e497a8b7e8596302e02a1d0f2edc0b670b2eee
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/nerdkapp/homebot/infrastructure/resources/Echo.java
|
Nerdkapp/HomeBot
|
43e497a8b7e8596302e02a1d0f2edc0b670b2eee
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/nerdkapp/homebot/infrastructure/resources/Echo.java
|
Nerdkapp/HomeBot
|
43e497a8b7e8596302e02a1d0f2edc0b670b2eee
|
[
"Apache-2.0"
] | null | null | null | 27 | 70 | 0.779541 | 3,247 |
package com.nerdkapp.homebot.infrastructure.resources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Echo
{
private final Logger log = LoggerFactory.getLogger(this.getClass());
@RequestMapping(value = "/echo", method = RequestMethod.GET)
public String echo() {
log.info("Echo resource was called");
return "ECHO!";
}
}
|
3e07ae9302941d6afea14fe7799b9f51a66177bc
| 361 |
java
|
Java
|
src/main/java/net/angusbeefgaming/playerstatus/PS.java
|
angusbeefsteak/player-status
|
0db50722fd1d831790e87fc7398288fe6b54d260
|
[
"MIT"
] | null | null | null |
src/main/java/net/angusbeefgaming/playerstatus/PS.java
|
angusbeefsteak/player-status
|
0db50722fd1d831790e87fc7398288fe6b54d260
|
[
"MIT"
] | null | null | null |
src/main/java/net/angusbeefgaming/playerstatus/PS.java
|
angusbeefsteak/player-status
|
0db50722fd1d831790e87fc7398288fe6b54d260
|
[
"MIT"
] | 1 |
2020-05-24T21:37:57.000Z
|
2020-05-24T21:37:57.000Z
| 25.785714 | 75 | 0.67036 | 3,248 |
package net.angusbeefgaming.playerstatus;
import org.bukkit.plugin.java.JavaPlugin;
public class PS extends JavaPlugin {
@Override
public void onEnable() {
getCommand("player").setExecutor(new Menu());
getServer().getPluginManager().registerEvents(new onClick(), this);
}
@Override
public void onDisable() {
}
}
|
3e07aecccde3b1d09c663ec2283435e8f0b8ea78
| 1,282 |
java
|
Java
|
rest-helix/src/main/java/com/github/twitch4j/helix/webhooks/topics/ExtensionTransactionsTopic.java
|
p4czyk/twitch4j
|
7d7574f3fe98d0423eb34b3d2e615375c68daaba
|
[
"MIT"
] | 1 |
2020-07-08T20:25:43.000Z
|
2020-07-08T20:25:43.000Z
|
rest-helix/src/main/java/com/github/twitch4j/helix/webhooks/topics/ExtensionTransactionsTopic.java
|
p4czyk/twitch4j
|
7d7574f3fe98d0423eb34b3d2e615375c68daaba
|
[
"MIT"
] | null | null | null |
rest-helix/src/main/java/com/github/twitch4j/helix/webhooks/topics/ExtensionTransactionsTopic.java
|
p4czyk/twitch4j
|
7d7574f3fe98d0423eb34b3d2e615375c68daaba
|
[
"MIT"
] | null | null | null | 29.136364 | 94 | 0.695008 | 3,249 |
package com.github.twitch4j.helix.webhooks.topics;
import com.github.twitch4j.helix.domain.ExtensionTransactionList;
import lombok.Getter;
import lombok.NonNull;
import java.util.TreeMap;
/**
* Sends a notification when a new transaction is created for an extension.
*/
@Getter
public class ExtensionTransactionsTopic extends TwitchWebhookTopic<ExtensionTransactionList> {
public static final String PATH = "/extensions/transactions";
private static TreeMap<String, Object> mapParameters(String extensionId) {
TreeMap<String, Object> parameterMap = new TreeMap<>();
parameterMap.put("extension_id", extensionId);
parameterMap.put("first", 1);
return parameterMap;
}
/**
* @return The ID of the extension to listen to for transactions.
*/
private final String extensionId;
/**
* Sends a notification when a new transaction is created for an extension.
*
* @param extensionId Required. The ID of the extension to listen to for transactions.
*/
public ExtensionTransactionsTopic(@NonNull String extensionId) {
super(
PATH,
ExtensionTransactionList.class,
mapParameters(extensionId)
);
this.extensionId = extensionId;
}
}
|
3e07aedb5e62d796e866b9240da6b40758bbf325
| 14,157 |
java
|
Java
|
sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleAdWordsLinkedServiceTypeProperties.java
|
liukun2634/azure-sdk-for-java
|
a42ba097eef284333c9befba180eea3cfed41312
|
[
"MIT"
] | 1,350 |
2015-01-17T05:22:05.000Z
|
2022-03-29T21:00:37.000Z
|
sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleAdWordsLinkedServiceTypeProperties.java
|
liukun2634/azure-sdk-for-java
|
a42ba097eef284333c9befba180eea3cfed41312
|
[
"MIT"
] | 16,834 |
2015-01-07T02:19:09.000Z
|
2022-03-31T23:29:10.000Z
|
sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleAdWordsLinkedServiceTypeProperties.java
|
liukun2634/azure-sdk-for-java
|
a42ba097eef284333c9befba180eea3cfed41312
|
[
"MIT"
] | 1,586 |
2015-01-02T01:50:28.000Z
|
2022-03-31T11:25:34.000Z
| 36.487113 | 120 | 0.699442 | 3,250 |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.datafactory.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datafactory.models.GoogleAdWordsAuthenticationType;
import com.azure.resourcemanager.datafactory.models.SecretBase;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/** Google AdWords service linked service properties. */
@Fluent
public final class GoogleAdWordsLinkedServiceTypeProperties {
@JsonIgnore private final ClientLogger logger = new ClientLogger(GoogleAdWordsLinkedServiceTypeProperties.class);
/*
* Properties used to connect to GoogleAds. It is mutually exclusive with
* any other properties in the linked service. Type: object.
*/
@JsonProperty(value = "connectionProperties")
private Object connectionProperties;
/*
* The Client customer ID of the AdWords account that you want to fetch
* report data for.
*/
@JsonProperty(value = "clientCustomerID")
private Object clientCustomerId;
/*
* The developer token associated with the manager account that you use to
* grant access to the AdWords API.
*/
@JsonProperty(value = "developerToken")
private SecretBase developerToken;
/*
* The OAuth 2.0 authentication mechanism used for authentication.
* ServiceAuthentication can only be used on self-hosted IR.
*/
@JsonProperty(value = "authenticationType")
private GoogleAdWordsAuthenticationType authenticationType;
/*
* The refresh token obtained from Google for authorizing access to AdWords
* for UserAuthentication.
*/
@JsonProperty(value = "refreshToken")
private SecretBase refreshToken;
/*
* The client id of the google application used to acquire the refresh
* token. Type: string (or Expression with resultType string).
*/
@JsonProperty(value = "clientId")
private Object clientId;
/*
* The client secret of the google application used to acquire the refresh
* token.
*/
@JsonProperty(value = "clientSecret")
private SecretBase clientSecret;
/*
* The service account email ID that is used for ServiceAuthentication and
* can only be used on self-hosted IR.
*/
@JsonProperty(value = "email")
private Object email;
/*
* The full path to the .p12 key file that is used to authenticate the
* service account email address and can only be used on self-hosted IR.
*/
@JsonProperty(value = "keyFilePath")
private Object keyFilePath;
/*
* The full path of the .pem file containing trusted CA certificates for
* verifying the server when connecting over SSL. This property can only be
* set when using SSL on self-hosted IR. The default value is the
* cacerts.pem file installed with the IR.
*/
@JsonProperty(value = "trustedCertPath")
private Object trustedCertPath;
/*
* Specifies whether to use a CA certificate from the system trust store or
* from a specified PEM file. The default value is false.
*/
@JsonProperty(value = "useSystemTrustStore")
private Object useSystemTrustStore;
/*
* The encrypted credential used for authentication. Credentials are
* encrypted using the integration runtime credential manager. Type: string
* (or Expression with resultType string).
*/
@JsonProperty(value = "encryptedCredential")
private Object encryptedCredential;
/**
* Get the connectionProperties property: Properties used to connect to GoogleAds. It is mutually exclusive with any
* other properties in the linked service. Type: object.
*
* @return the connectionProperties value.
*/
public Object connectionProperties() {
return this.connectionProperties;
}
/**
* Set the connectionProperties property: Properties used to connect to GoogleAds. It is mutually exclusive with any
* other properties in the linked service. Type: object.
*
* @param connectionProperties the connectionProperties value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withConnectionProperties(Object connectionProperties) {
this.connectionProperties = connectionProperties;
return this;
}
/**
* Get the clientCustomerId property: The Client customer ID of the AdWords account that you want to fetch report
* data for.
*
* @return the clientCustomerId value.
*/
public Object clientCustomerId() {
return this.clientCustomerId;
}
/**
* Set the clientCustomerId property: The Client customer ID of the AdWords account that you want to fetch report
* data for.
*
* @param clientCustomerId the clientCustomerId value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withClientCustomerId(Object clientCustomerId) {
this.clientCustomerId = clientCustomerId;
return this;
}
/**
* Get the developerToken property: The developer token associated with the manager account that you use to grant
* access to the AdWords API.
*
* @return the developerToken value.
*/
public SecretBase developerToken() {
return this.developerToken;
}
/**
* Set the developerToken property: The developer token associated with the manager account that you use to grant
* access to the AdWords API.
*
* @param developerToken the developerToken value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withDeveloperToken(SecretBase developerToken) {
this.developerToken = developerToken;
return this;
}
/**
* Get the authenticationType property: The OAuth 2.0 authentication mechanism used for authentication.
* ServiceAuthentication can only be used on self-hosted IR.
*
* @return the authenticationType value.
*/
public GoogleAdWordsAuthenticationType authenticationType() {
return this.authenticationType;
}
/**
* Set the authenticationType property: The OAuth 2.0 authentication mechanism used for authentication.
* ServiceAuthentication can only be used on self-hosted IR.
*
* @param authenticationType the authenticationType value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withAuthenticationType(
GoogleAdWordsAuthenticationType authenticationType) {
this.authenticationType = authenticationType;
return this;
}
/**
* Get the refreshToken property: The refresh token obtained from Google for authorizing access to AdWords for
* UserAuthentication.
*
* @return the refreshToken value.
*/
public SecretBase refreshToken() {
return this.refreshToken;
}
/**
* Set the refreshToken property: The refresh token obtained from Google for authorizing access to AdWords for
* UserAuthentication.
*
* @param refreshToken the refreshToken value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withRefreshToken(SecretBase refreshToken) {
this.refreshToken = refreshToken;
return this;
}
/**
* Get the clientId property: The client id of the google application used to acquire the refresh token. Type:
* string (or Expression with resultType string).
*
* @return the clientId value.
*/
public Object clientId() {
return this.clientId;
}
/**
* Set the clientId property: The client id of the google application used to acquire the refresh token. Type:
* string (or Expression with resultType string).
*
* @param clientId the clientId value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withClientId(Object clientId) {
this.clientId = clientId;
return this;
}
/**
* Get the clientSecret property: The client secret of the google application used to acquire the refresh token.
*
* @return the clientSecret value.
*/
public SecretBase clientSecret() {
return this.clientSecret;
}
/**
* Set the clientSecret property: The client secret of the google application used to acquire the refresh token.
*
* @param clientSecret the clientSecret value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withClientSecret(SecretBase clientSecret) {
this.clientSecret = clientSecret;
return this;
}
/**
* Get the email property: The service account email ID that is used for ServiceAuthentication and can only be used
* on self-hosted IR.
*
* @return the email value.
*/
public Object email() {
return this.email;
}
/**
* Set the email property: The service account email ID that is used for ServiceAuthentication and can only be used
* on self-hosted IR.
*
* @param email the email value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withEmail(Object email) {
this.email = email;
return this;
}
/**
* Get the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account
* email address and can only be used on self-hosted IR.
*
* @return the keyFilePath value.
*/
public Object keyFilePath() {
return this.keyFilePath;
}
/**
* Set the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account
* email address and can only be used on self-hosted IR.
*
* @param keyFilePath the keyFilePath value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withKeyFilePath(Object keyFilePath) {
this.keyFilePath = keyFilePath;
return this;
}
/**
* Get the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying
* the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default
* value is the cacerts.pem file installed with the IR.
*
* @return the trustedCertPath value.
*/
public Object trustedCertPath() {
return this.trustedCertPath;
}
/**
* Set the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying
* the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default
* value is the cacerts.pem file installed with the IR.
*
* @param trustedCertPath the trustedCertPath value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withTrustedCertPath(Object trustedCertPath) {
this.trustedCertPath = trustedCertPath;
return this;
}
/**
* Get the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or
* from a specified PEM file. The default value is false.
*
* @return the useSystemTrustStore value.
*/
public Object useSystemTrustStore() {
return this.useSystemTrustStore;
}
/**
* Set the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or
* from a specified PEM file. The default value is false.
*
* @param useSystemTrustStore the useSystemTrustStore value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withUseSystemTrustStore(Object useSystemTrustStore) {
this.useSystemTrustStore = useSystemTrustStore;
return this;
}
/**
* Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted
* using the integration runtime credential manager. Type: string (or Expression with resultType string).
*
* @return the encryptedCredential value.
*/
public Object encryptedCredential() {
return this.encryptedCredential;
}
/**
* Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted
* using the integration runtime credential manager. Type: string (or Expression with resultType string).
*
* @param encryptedCredential the encryptedCredential value to set.
* @return the GoogleAdWordsLinkedServiceTypeProperties object itself.
*/
public GoogleAdWordsLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) {
this.encryptedCredential = encryptedCredential;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (developerToken() != null) {
developerToken().validate();
}
if (refreshToken() != null) {
refreshToken().validate();
}
if (clientSecret() != null) {
clientSecret().validate();
}
}
}
|
3e07aff2959088b75b11e05e58827dfeda98e1fb
| 213 |
java
|
Java
|
jsoar-core/src/main/java/org/jsoar/util/HashTableItem.java
|
soartech/jsoar
|
7c32c192b1b47f8cb975ee5f0397b48ac53088d3
|
[
"BSD-3-Clause"
] | 33 |
2015-04-05T09:26:05.000Z
|
2021-12-05T04:18:28.000Z
|
jsoar-core/src/main/java/org/jsoar/util/HashTableItem.java
|
soartech/jsoar
|
7c32c192b1b47f8cb975ee5f0397b48ac53088d3
|
[
"BSD-3-Clause"
] | 73 |
2015-04-17T07:11:18.000Z
|
2021-07-06T06:00:06.000Z
|
jsoar-core/src/main/java/org/jsoar/util/HashTableItem.java
|
soartech/jsoar
|
7c32c192b1b47f8cb975ee5f0397b48ac53088d3
|
[
"BSD-3-Clause"
] | 19 |
2015-05-28T21:39:54.000Z
|
2022-03-03T07:59:30.000Z
| 14.2 | 51 | 0.671362 | 3,251 |
/*
* Copyright (c) 2008 Dave Ray <[email protected]>
*
* Created on Aug 24, 2008
*/
package org.jsoar.util;
/**
* @author ray
*/
public class HashTableItem
{
public HashTableItem next_in_hash_table;
}
|
3e07b0c85f61ef7911f0c5a5a7143a2485ac0129
| 281 |
java
|
Java
|
src/main/java/com/tngtech/propertyloader/impl/filters/DecryptingFilterException.java
|
christian-ertl/property-loader
|
a7790167164183c1d9bf22d83404915528e0e400
|
[
"Apache-2.0"
] | 3 |
2015-12-07T15:20:02.000Z
|
2021-01-31T17:11:01.000Z
|
src/main/java/com/tngtech/propertyloader/impl/filters/DecryptingFilterException.java
|
christian-ertl/property-loader
|
a7790167164183c1d9bf22d83404915528e0e400
|
[
"Apache-2.0"
] | 34 |
2015-12-01T17:47:24.000Z
|
2022-01-28T15:16:41.000Z
|
src/main/java/com/tngtech/propertyloader/impl/filters/DecryptingFilterException.java
|
christian-ertl/property-loader
|
a7790167164183c1d9bf22d83404915528e0e400
|
[
"Apache-2.0"
] | 8 |
2015-01-29T15:58:12.000Z
|
2019-03-11T19:20:27.000Z
| 25.545455 | 72 | 0.80427 | 3,252 |
package com.tngtech.propertyloader.impl.filters;
import com.tngtech.propertyloader.exception.PropertyLoaderException;
public class DecryptingFilterException extends PropertyLoaderException {
public DecryptingFilterException(String message) {
super(message);
}
}
|
3e07b0d685697d070cd85ce0182bbbc7a33936ad
| 2,727 |
java
|
Java
|
viewers/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/services/ImpersonatedUserHolderWicket.java
|
ErnoViitanen-LUT/isis
|
35adaa101bfc6ac71df5784b615af31a8ee47cb1
|
[
"Apache-2.0"
] | 1 |
2021-04-20T06:30:24.000Z
|
2021-04-20T06:30:24.000Z
|
viewers/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/services/ImpersonatedUserHolderWicket.java
|
ErnoViitanen-LUT/isis
|
35adaa101bfc6ac71df5784b615af31a8ee47cb1
|
[
"Apache-2.0"
] | 1 |
2021-04-20T15:53:33.000Z
|
2021-04-20T15:53:33.000Z
|
viewers/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/services/ImpersonatedUserHolderWicket.java
|
ErnoViitanen-LUT/isis
|
35adaa101bfc6ac71df5784b615af31a8ee47cb1
|
[
"Apache-2.0"
] | null | null | null | 35.881579 | 131 | 0.759809 | 3,253 |
/*
* 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.isis.viewer.wicket.viewer.services;
import java.util.Optional;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
import org.apache.isis.applib.annotation.OrderPrecedence;
import org.apache.isis.applib.services.user.ImpersonatedUserHolder;
import org.apache.isis.applib.services.user.UserMemento;
/**
* Implementation that supports impersonation, using the {@link HttpSession}
* to store the value.
*
* @since 2.0 {@index}
*/
@Service
@Named("isis.runtimeservices.ImpersonatedUserHolderWicket")
@Order(OrderPrecedence.MIDPOINT)
@Qualifier("HttpSession")
public class ImpersonatedUserHolderWicket implements ImpersonatedUserHolder {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Inject private final HttpSession httpSession;
private static final String HTTP_SESSION_KEY_IMPERSONATED_USER = ImpersonatedUserHolderWicket.class.getName() + "#userMemento";
public ImpersonatedUserHolderWicket(HttpSession httpSession) {
this.httpSession = httpSession;
}
@Override
public boolean supportsImpersonation() {
return true;
}
public void setUserMemento(final UserMemento userMemento) {
this.httpSession.setAttribute(HTTP_SESSION_KEY_IMPERSONATED_USER, userMemento);
}
public Optional<UserMemento> getUserMemento() {
final Object attribute = this.httpSession.getAttribute(HTTP_SESSION_KEY_IMPERSONATED_USER);
return attribute instanceof UserMemento
? Optional.of((UserMemento)attribute)
: Optional.empty();
}
public void clearUserMemento() {
this.httpSession.removeAttribute(HTTP_SESSION_KEY_IMPERSONATED_USER);
}
}
|
3e07b131938226a8b738e4971443bfe70eef93d3
| 2,043 |
java
|
Java
|
src/org/teachingkidsprogramming/section02methods/Variations/Houses_Pointy.java
|
91084872/TeachingKidsProgramming
|
e0570f1b389d94df367b5bf61a5e56a5eda3b041
|
[
"Apache-2.0"
] | null | null | null |
src/org/teachingkidsprogramming/section02methods/Variations/Houses_Pointy.java
|
91084872/TeachingKidsProgramming
|
e0570f1b389d94df367b5bf61a5e56a5eda3b041
|
[
"Apache-2.0"
] | null | null | null |
src/org/teachingkidsprogramming/section02methods/Variations/Houses_Pointy.java
|
91084872/TeachingKidsProgramming
|
e0570f1b389d94df367b5bf61a5e56a5eda3b041
|
[
"Apache-2.0"
] | null | null | null | 24.035294 | 67 | 0.68184 | 3,254 |
package org.teachingkidsprogramming.section02methods.Variations;
import org.teachingextensions.logo.Tortoise;
import org.teachingextensions.logo.utils.ColorUtils.PenColors.Reds;
public class Houses_Pointy
{
public static void main(String[] args)
{
Tortoise.show();
Tortoise.setSpeed(10);
Tortoise.setX(200);
int Height = 40;
drawHouseFlatRoof(Height);
drawHouseFlatRoof(120);
drawHouseFlatRoof(90);
drawHouseFlatRoof(20);
drawHousePointyRoof(Height);
drawHousePointyRoof(120);
// drawHousePointyRoof(90);
// drawHousePointyRoof(20);
drawHouseTrapezoidRoof(Height);
drawHouseTrapezoidRoof(120);
// drawHouseTrapezoidRoof(90);
//drawHouseTrapezoidRoof(20);
}
private static void drawHouseFlatRoof(int Height)
{
Tortoise.setPenColor(Reds.Red);
Tortoise.setPenWidth(3);
Tortoise.move(Height);
drawFlatRoof();
Tortoise.move(Height);
Tortoise.turn(-90);
Tortoise.move(20);
Tortoise.turn(-90);
}
private static void drawHouseTrapezoidRoof(int Height)
{
Tortoise.setPenColor(Reds.Red);
Tortoise.setPenWidth(3);
Tortoise.move(Height);
drawTrapezoidRoof();
Tortoise.move(Height);
Tortoise.turn(-90);
Tortoise.move(20);
Tortoise.turn(-90);
}
private static void drawHousePointyRoof(int Height)
{
Tortoise.setPenColor(Reds.Red);
Tortoise.setPenWidth(3);
Tortoise.move(Height);
drawPointyRoof();
Tortoise.move(Height);
Tortoise.turn(-90);
Tortoise.move(20);
Tortoise.turn(-90);
}
private static void drawFlatRoof()
{
Tortoise.turn(90);
Tortoise.move(30);
Tortoise.turn(90);
}
private static void drawTrapezoidRoof()
{
Tortoise.turn(30);
Tortoise.move(15);
Tortoise.turn(60);
Tortoise.move(15);
Tortoise.turn(50);
Tortoise.move(15);
Tortoise.turn(40);
}
private static void drawPointyRoof()
{
Tortoise.turn(45);
Tortoise.move(15);
Tortoise.turn(90);
Tortoise.move(15);
Tortoise.turn(45);
}
}
|
3e07b20f9899c615113b6926bc32cd8301803133
| 1,214 |
java
|
Java
|
open-sphere-plugins/wps/src/main/java/io/opensphere/wps/config/v2/ProcessConfig.java
|
smagill/opensphere-desktop
|
ac18dac63d6496a9f9b96debf2e1d06841f92118
|
[
"Apache-2.0"
] | 25 |
2018-01-25T23:01:39.000Z
|
2022-02-21T22:24:00.000Z
|
open-sphere-plugins/wps/src/main/java/io/opensphere/wps/config/v2/ProcessConfig.java
|
smagill/opensphere-desktop
|
ac18dac63d6496a9f9b96debf2e1d06841f92118
|
[
"Apache-2.0"
] | 71 |
2019-11-22T22:39:25.000Z
|
2020-03-30T01:06:30.000Z
|
open-sphere-plugins/wps/src/main/java/io/opensphere/wps/config/v2/ProcessConfig.java
|
smagill/opensphere-desktop
|
ac18dac63d6496a9f9b96debf2e1d06841f92118
|
[
"Apache-2.0"
] | 11 |
2018-09-04T09:35:01.000Z
|
2021-04-21T14:15:33.000Z
| 22.072727 | 67 | 0.659802 | 3,255 |
package io.opensphere.wps.config.v2;
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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/** A process config entry. */
@XmlRootElement(name = "process")
@XmlAccessorType(XmlAccessType.NONE)
public class ProcessConfig
{
/** The identifier. */
@XmlAttribute(name = "identifier")
private String myIdentifier;
/** The list of UI elements. */
@XmlElement(name = "uiElement")
private final List<UiElement> myUiElements = new ArrayList<>();
/**
* Gets the identifier.
*
* @return the identifier
*/
public String getIdentifier()
{
return myIdentifier;
}
/**
* Sets the identifier.
*
* @param identifier the identifier
*/
public void setIdentifier(String identifier)
{
myIdentifier = identifier;
}
/**
* Gets the uiElements.
*
* @return the uiElements
*/
public List<UiElement> getUiElements()
{
return myUiElements;
}
}
|
3e07b2398ef598e1268d1ff9fd28838ba1b7566a
| 501 |
java
|
Java
|
src/main/java/ru/job4j/total/field/Field.java
|
Nikolamba/OOD
|
a28b368208e529a9db00877f848bc55f1ff4b777
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/ru/job4j/total/field/Field.java
|
Nikolamba/OOD
|
a28b368208e529a9db00877f848bc55f1ff4b777
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/ru/job4j/total/field/Field.java
|
Nikolamba/OOD
|
a28b368208e529a9db00877f848bc55f1ff4b777
|
[
"Apache-2.0"
] | null | null | null | 25 | 65 | 0.722 | 3,256 |
package ru.job4j.total.field;
import javafx.util.Pair;
import ru.job4j.total.figures.Figure;
import java.util.List;
/**
* Интерфейс, определяющий поведение поля для игры
* @author Nikolay Meleshkin ([email protected])
* @version 0.1
*/
public interface Field {
int getSize();
Figure getFigure(int coor1, int coor2);
boolean setFigure(int coor1, int coor2, Figure figure);
boolean isBusy(int coor1, int coor2);
List<Pair<Integer, Integer>> getPointByFigure(Figure figure);
}
|
3e07b2449a80cf806e69991710af98b32dc0de2a
| 1,400 |
java
|
Java
|
src/main/java/com/log/monitor/entity/logFilter/LogFilter.java
|
yanjingfan/log-monitor-svc
|
26fb4d988412e2ab1469bb52ddbd4d818454a6ba
|
[
"Apache-2.0"
] | 2 |
2021-07-08T07:52:48.000Z
|
2021-09-15T07:30:19.000Z
|
src/main/java/com/log/monitor/entity/logFilter/LogFilter.java
|
yanjingfan/log-monitor-svc
|
26fb4d988412e2ab1469bb52ddbd4d818454a6ba
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/log/monitor/entity/logFilter/LogFilter.java
|
yanjingfan/log-monitor-svc
|
26fb4d988412e2ab1469bb52ddbd4d818454a6ba
|
[
"Apache-2.0"
] | null | null | null | 16.666667 | 67 | 0.709286 | 3,257 |
package com.log.monitor.entity.logFilter;
import io.swagger.annotations.ApiParam;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import java.util.Date;
/**
* @auther YangFan
* @Date 2020/5/28 10:04
*/
@Document(indexName = "log-filter",createIndex = false)
public class LogFilter {
@Id
private String id;
private String filterName;
private String indexName;
@ApiParam("参数形式:field1,filed2")
private String selectFields;
private int status = 1;
private Date createTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFilterName() {
return filterName;
}
public void setFilterName(String filterName) {
this.filterName = filterName;
}
public String getIndexName() {
return indexName;
}
public void setIndexName(String indexName) {
this.indexName = indexName;
}
public String getSelectFields() {
return selectFields;
}
public void setSelectFields(String selectFields) {
this.selectFields = selectFields;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
// private Date editTime;
}
|
3e07b2c8a0b00f4b09ccb1d31cf8910729e68016
| 1,437 |
java
|
Java
|
src/main/java/org/musicbox/core/config/JsonConfiguration.java
|
daviddev16/java-musicbox
|
0cdc181192cf2b8d8e480e1691ce25ff5ce26d97
|
[
"Apache-2.0"
] | 3 |
2021-10-01T11:18:07.000Z
|
2021-10-04T06:03:53.000Z
|
src/main/java/org/musicbox/core/config/JsonConfiguration.java
|
daviddev16/java-musicbox
|
0cdc181192cf2b8d8e480e1691ce25ff5ce26d97
|
[
"Apache-2.0"
] | 4 |
2021-10-01T10:31:39.000Z
|
2021-10-07T05:14:39.000Z
|
src/main/java/org/musicbox/core/config/JsonConfiguration.java
|
daviddev16/java-musicbox
|
0cdc181192cf2b8d8e480e1691ce25ff5ce26d97
|
[
"Apache-2.0"
] | null | null | null | 26.611111 | 100 | 0.677105 | 3,258 |
package org.musicbox.core.config;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonReader;
public class JsonConfiguration {
private JsonObject map;
public JsonConfiguration(String name) {
InputStream configStream = JsonConfiguration.class.getResourceAsStream("/" + name + ".json");
JsonReader reader = new JsonReader(new InputStreamReader(configStream));
map = new Gson().fromJson(reader, JsonObject.class);
try {
configStream.close();
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public JsonElement get(String memberName) {
return map.get(memberName);
}
public JsonObject getJsonObject(String memberName) {
return get(memberName).getAsJsonObject();
}
public JsonArray getJsonArray(String memberName) {
return get(memberName).getAsJsonArray();
}
public String getString(String memberName) {
return get(memberName).getAsString();
}
public boolean getBoolean(String memberName) {
return get(memberName).getAsBoolean();
}
public int getInt(String memberName) {
return get(memberName).getAsInt();
}
}
|
3e07b2e6f838a51c1b83c5ea356c6a4fdef6a85e
| 1,543 |
java
|
Java
|
dummy-repo-service-impl/src/main/java/org/irods/jargon/dataone/repo/impl/dummy/DummyRepoServiceImpl.java
|
slr71/dfc-dataone
|
e793d155536023b5bdf992eaae574a235e9648ff
|
[
"BSD-3-Clause"
] | null | null | null |
dummy-repo-service-impl/src/main/java/org/irods/jargon/dataone/repo/impl/dummy/DummyRepoServiceImpl.java
|
slr71/dfc-dataone
|
e793d155536023b5bdf992eaae574a235e9648ff
|
[
"BSD-3-Clause"
] | null | null | null |
dummy-repo-service-impl/src/main/java/org/irods/jargon/dataone/repo/impl/dummy/DummyRepoServiceImpl.java
|
slr71/dfc-dataone
|
e793d155536023b5bdf992eaae574a235e9648ff
|
[
"BSD-3-Clause"
] | null | null | null | 29.673077 | 112 | 0.803629 | 3,259 |
/**
*
*/
package org.irods.jargon.dataone.repo.impl.dummy;
import org.dataone.service.types.v1.Identifier;
import org.dataone.service.types.v1.ObjectFormatIdentifier;
import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.exception.JargonException;
import org.irods.jargon.core.pub.domain.Collection;
import org.irods.jargon.core.pub.domain.DataObject;
import org.irods.jargon.dataone.model.DataOneObjectListResponse;
import org.irods.jargon.dataone.plugin.PublicationContext;
import org.irods.jargon.dataone.reposervice.AbstractDataOneRepoServiceAO;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author mcc
*
*/
public class DummyRepoServiceImpl extends AbstractDataOneRepoServiceAO {
public DummyRepoServiceImpl(IRODSAccount irodsAccount, PublicationContext publicationContext) {
super(irodsAccount, publicationContext);
}
@Override
public DataOneObjectListResponse getExposedObjects(Date fromDate, Date toDate, ObjectFormatIdentifier formatId,
Boolean replicaStatus, Integer start, Integer count) throws JargonException {
return new DataOneObjectListResponse(new ArrayList<>(), 0, 0);
}
@Override
public List<Identifier> getListOfDataoneExposedIdentifiers() throws JargonException {
// FIXME: narrow down the needed public methods
return null;
}
@Override
public Date getLastModifiedDate(String path) throws JargonException {
return new Date();
}
@Override
public String getFormat(String path) throws JargonException {
return "";
}
}
|
3e07b3c3ffcf42bd4ab4410cff3a2f972254e46a
| 5,029 |
java
|
Java
|
PDFBox-0.7.3/src/org/pdfbox/util/ResourceLoader.java
|
edoardo-ferocino/FunzioniMatlab
|
93acd291d2db32677dcdddb478bcbf8b11c9d9eb
|
[
"BSD-2-Clause"
] | null | null | null |
PDFBox-0.7.3/src/org/pdfbox/util/ResourceLoader.java
|
edoardo-ferocino/FunzioniMatlab
|
93acd291d2db32677dcdddb478bcbf8b11c9d9eb
|
[
"BSD-2-Clause"
] | null | null | null |
PDFBox-0.7.3/src/org/pdfbox/util/ResourceLoader.java
|
edoardo-ferocino/FunzioniMatlab
|
93acd291d2db32677dcdddb478bcbf8b11c9d9eb
|
[
"BSD-2-Clause"
] | null | null | null | 31.26087 | 106 | 0.608583 | 3,260 |
/**
* Copyright (c) 2003-2006, www.pdfbox.org
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of pdfbox; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://www.pdfbox.org
*/
package org.pdfbox.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.Properties;
/**
* This class will handle loading resource files(AFM/CMAP).
*
* @author <a href="mailto:[email protected]">Ben Litchfield</a>
* @version $Revision: 1.8 $
*/
public class ResourceLoader
{
/**
* private constructor for utility class.
*/
private ResourceLoader()
{
//private utility class
}
/**
* This will attempt to load the resource given the resource name.
*
* @param resourceName The resource to try and load.
*
* @return The resource as a stream or null if it could not be found.
*
* @throws IOException If there is an error while attempting to load the resource.
*/
public static InputStream loadResource( String resourceName ) throws IOException
{
ClassLoader loader = ResourceLoader.class.getClassLoader();
InputStream is = null;
if( loader != null )
{
is = loader.getResourceAsStream( resourceName );
}
//see sourceforge bug 863053, this is a fix for a user that
//needed to have PDFBox loaded by the bootstrap classloader
if( is == null )
{
loader = ClassLoader.getSystemClassLoader();
if( loader != null )
{
is = loader.getResourceAsStream( resourceName );
}
}
if( is == null )
{
File f = new File( resourceName );
if( f.exists() )
{
is = new FileInputStream( f );
}
}
return is;
}
/**
* This will attempt to load the resource given the resource name.
*
* @param resourceName The resource to try and load.
*
* @return The resource as a stream or null if it could not be found.
*
* @throws IOException If there is an error loading the properties.
*/
public static Properties loadProperties( String resourceName ) throws IOException
{
Properties properties = null;
InputStream is = null;
try
{
is = loadResource( resourceName );
if( is != null )
{
properties = new Properties();
properties.load( is );
}
}
finally
{
if( is != null )
{
is.close();
}
}
return properties;
}
/**
* This will attempt to load the resource given the resource name.
*
* @param resourceName The resource to try and load.
* @param defaults A stream of default properties.
*
* @return The resource as a stream or null if it could not be found.
*
* @throws IOException If there is an error loading the properties.
*/
public static Properties loadProperties( String resourceName, Properties defaults ) throws IOException
{
InputStream is = null;
try
{
is = loadResource( resourceName );
if( is != null )
{
defaults.load( is );
}
}
finally
{
if( is != null )
{
is.close();
}
}
return defaults;
}
}
|
3e07b4060678f468aaff1b9f2e8656827c1cc4ac
| 648 |
java
|
Java
|
src/test/java/com/vaadin/tutorial/crm/it/LoginIT.java
|
thproflord/Vaadin-Guide
|
078bc15fd749141138c13a8a87f3eb0d940b1033
|
[
"Unlicense"
] | null | null | null |
src/test/java/com/vaadin/tutorial/crm/it/LoginIT.java
|
thproflord/Vaadin-Guide
|
078bc15fd749141138c13a8a87f3eb0d940b1033
|
[
"Unlicense"
] | null | null | null |
src/test/java/com/vaadin/tutorial/crm/it/LoginIT.java
|
thproflord/Vaadin-Guide
|
078bc15fd749141138c13a8a87f3eb0d940b1033
|
[
"Unlicense"
] | null | null | null | 24 | 78 | 0.686728 | 3,261 |
package com.vaadin.tutorial.crm.it;
import com.vaadin.tutorial.crm.it.elements.login.LoginViewElement;
import org.junit.Assert;
import org.junit.Test;
public class LoginIT extends AbstractTest {
public LoginIT() {
super("");
}
@Test
public void loginAsValidUserSucceeds() {
LoginViewElement loginView = $(LoginViewElement.class).onPage().first();
Assert.assertTrue(loginView.login("user", "u"));
}
@Test
public void loginAsInvalidUserFails() {
LoginViewElement loginView = $(LoginViewElement.class).onPage().first();
Assert.assertFalse(loginView.login("user", "invalid"));
}
}
|
3e07b4728c56a82781025bd6b5e31a3a94f18f02
| 277 |
java
|
Java
|
pipes-core/src/main/java/org/pipecraft/pipes/serialization/ByteArrayCodec.java
|
pipecraft/pipes
|
64f700c08be846940cdc63001a89b8a2ba6832d8
|
[
"MIT"
] | 9 |
2021-07-30T14:43:32.000Z
|
2022-01-02T11:47:05.000Z
|
pipes-core/src/main/java/org/pipecraft/pipes/serialization/ByteArrayCodec.java
|
pipecraft/pipes
|
64f700c08be846940cdc63001a89b8a2ba6832d8
|
[
"MIT"
] | 2 |
2021-08-01T22:49:47.000Z
|
2022-03-30T12:57:31.000Z
|
pipes-core/src/main/java/org/pipecraft/pipes/serialization/ByteArrayCodec.java
|
pipecraft/pipes
|
64f700c08be846940cdc63001a89b8a2ba6832d8
|
[
"MIT"
] | null | null | null | 23.083333 | 85 | 0.736462 | 3,262 |
package org.pipecraft.pipes.serialization;
/**
* An interface for byte array encoder and decoder
*
* @param <T> the type of the items to encode/decode
*
* @author Eyal Schneider
*/
public interface ByteArrayCodec<T> extends ByteArrayEncoder<T>, ByteArrayDecoder<T> {
}
|
3e07b5948d1954ecc6dae07612934e140b3b5d3e
| 2,436 |
java
|
Java
|
SillyChildClient/app/src/main/java/com/sillykid/app/homepage/airporttransportation/airportselect/fragment/AirportClassificationPresenter.java
|
921668753/SillyChildClient2-Android
|
f8f8ea3cca9013d39c9d7164bd2bd9573528093d
|
[
"Apache-2.0"
] | 1 |
2020-12-08T05:54:36.000Z
|
2020-12-08T05:54:36.000Z
|
SillyChildClient/app/src/main/java/com/sillykid/app/homepage/airporttransportation/airportselect/fragment/AirportClassificationPresenter.java
|
921668753/SillyChildClient2-Android
|
f8f8ea3cca9013d39c9d7164bd2bd9573528093d
|
[
"Apache-2.0"
] | null | null | null |
SillyChildClient/app/src/main/java/com/sillykid/app/homepage/airporttransportation/airportselect/fragment/AirportClassificationPresenter.java
|
921668753/SillyChildClient2-Android
|
f8f8ea3cca9013d39c9d7164bd2bd9573528093d
|
[
"Apache-2.0"
] | null | null | null | 34.309859 | 96 | 0.646552 | 3,263 |
package com.sillykid.app.homepage.airporttransportation.airportselect.fragment;
import android.content.Context;
import com.common.cklibrary.utils.httputil.HttpUtilParams;
import com.common.cklibrary.utils.httputil.ResponseListener;
import com.kymjs.rxvolley.client.HttpParams;
import com.sillykid.app.retrofit.RequestClient;
public class AirportClassificationPresenter implements AirportClassificationContract.Presenter {
private AirportClassificationContract.View mView;
public AirportClassificationPresenter(AirportClassificationContract.View view) {
mView = view;
mView.setPresenter(this);
}
@Override
public void getCountryAreaListByParentid(Context context, int id, int type, int flag) {
HttpParams httpParams = HttpUtilParams.getInstance().getHttpParams();
httpParams.put("parentid", id);
httpParams.put("category", type);
RequestClient.getAreaListParent(context, httpParams, new ResponseListener<String>() {
@Override
public void onSuccess(String response) {
mView.getSuccess(response, flag);
}
@Override
public void onFailure(String msg) {
mView.errorMsg(msg, flag);
}
});
}
@Override
public void getAirportByCountryId(Context context, int country_id) {
HttpParams httpParams = HttpUtilParams.getInstance().getHttpParams();
httpParams.put("parentid", country_id);
RequestClient.getAreaTransfer(context, httpParams, new ResponseListener<String>() {
@Override
public void onSuccess(String response) {
mView.getSuccess(response, 1);
}
@Override
public void onFailure(String msg) {
mView.errorMsg(msg, 1);
}
});
}
@Override
public void getRecommendAirport(Context context, int type) {
HttpParams httpParams = HttpUtilParams.getInstance().getHttpParams();
httpParams.put("category", type);
RequestClient.getRecommendAirport(context, httpParams, new ResponseListener<String>() {
@Override
public void onSuccess(String response) {
mView.getSuccess(response, 0);
}
@Override
public void onFailure(String msg) {
mView.errorMsg(msg, 0);
}
});
}
}
|
3e07b60d49a0740d333b357dadcb65bda2ec3d76
| 4,913 |
java
|
Java
|
sample/src/main/java/com/baina/apps/andrxpermissions/sample/MainActivity.java
|
YoungBill/AndRxPermission
|
930ac6936f7a042b06f2964511cd242249d58a14
|
[
"Apache-2.0"
] | 1 |
2018-12-21T08:01:52.000Z
|
2018-12-21T08:01:52.000Z
|
sample/src/main/java/com/baina/apps/andrxpermissions/sample/MainActivity.java
|
YoungBill/AndRxPermission
|
930ac6936f7a042b06f2964511cd242249d58a14
|
[
"Apache-2.0"
] | null | null | null |
sample/src/main/java/com/baina/apps/andrxpermissions/sample/MainActivity.java
|
YoungBill/AndRxPermission
|
930ac6936f7a042b06f2964511cd242249d58a14
|
[
"Apache-2.0"
] | null | null | null | 43.096491 | 129 | 0.475677 | 3,264 |
package com.baina.apps.andrxpermissions.sample;
import android.Manifest.permission;
import android.hardware.Camera;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.SurfaceView;
import android.widget.Toast;
import com.jakewharton.rxbinding2.view.RxView;
import java.io.IOException;
import baina.android.com.andrxpermissions.Permission;
import baina.android.com.andrxpermissions.AndRxPermissions;
import baina.android.com.andrxpermissions.setting.RuntimeSetting;
import baina.android.com.andrxpermissions.setting.Setting;
import baina.android.com.andrxpermissions.source.ContextSource;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "AndRxPermissionsSample";
private Camera camera;
private SurfaceView surfaceView;
private Disposable disposable;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndRxPermissions andRxPermissions = new AndRxPermissions(this);
andRxPermissions.setLogging(true);
setContentView(R.layout.act_main);
surfaceView = findViewById(R.id.surfaceView);
disposable = RxView.clicks(findViewById(R.id.enableCamera))
// Ask for permissions when button is clicked
.compose(andRxPermissions.ensureEach(permission.CAMERA, permission.WRITE_EXTERNAL_STORAGE))
.subscribe(new Consumer<Permission>() {
@Override
public void accept(Permission permission) {
Log.i(TAG, "Permission result " + permission);
if (permission.granted) {
releaseCamera();
camera = Camera.open(0);
try {
camera.setPreviewDisplay(surfaceView.getHolder());
camera.startPreview();
} catch (IOException e) {
Log.e(TAG, "Error while trying to display the camera preview", e);
}
} else if (permission.shouldShowRequestPermissionRationale) {
// Denied permission without ask never again
Toast.makeText(MainActivity.this,
"Denied permission without ask never again",
Toast.LENGTH_SHORT).show();
} else {
// Denied permission with ask never again
// Need to go to the settings
Toast.makeText(MainActivity.this,
"Permission denied, can't enable the camera",
Toast.LENGTH_SHORT).show();
new RuntimeSetting(new ContextSource(MainActivity.this)).onComeback(new Setting.Action() {
@Override
public void onAction() {
Toast.makeText(MainActivity.this,
"setting, onComeback",
Toast.LENGTH_SHORT).show();
}
}).start();
}
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable t) {
Log.e(TAG, "onError", t);
}
},
new Action() {
@Override
public void run() {
Log.i(TAG, "OnComplete");
}
});
}
@Override
protected void onDestroy() {
if (disposable != null && !disposable.isDisposed()) {
disposable.dispose();
}
super.onDestroy();
}
@Override
protected void onStop() {
super.onStop();
releaseCamera();
}
private void releaseCamera() {
if (camera != null) {
camera.release();
camera = null;
}
}
}
|
3e07b61e9fef16f5729244ba91ffcce0d4475c0d
| 1,974 |
java
|
Java
|
core-customize/hybris/bin/modules/integration-apis/odata2services/src/de/hybris/platform/odata2services/odata/schema/attribute/AutoCreateAnnotationGenerator.java
|
karthik-git-user/SAP-Stage
|
72487ab521e7e2411f1b081615817d099edf9744
|
[
"Apache-2.0"
] | null | null | null |
core-customize/hybris/bin/modules/integration-apis/odata2services/src/de/hybris/platform/odata2services/odata/schema/attribute/AutoCreateAnnotationGenerator.java
|
karthik-git-user/SAP-Stage
|
72487ab521e7e2411f1b081615817d099edf9744
|
[
"Apache-2.0"
] | null | null | null |
core-customize/hybris/bin/modules/integration-apis/odata2services/src/de/hybris/platform/odata2services/odata/schema/attribute/AutoCreateAnnotationGenerator.java
|
karthik-git-user/SAP-Stage
|
72487ab521e7e2411f1b081615817d099edf9744
|
[
"Apache-2.0"
] | null | null | null | 36.555556 | 110 | 0.799899 | 3,265 |
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company.
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.odata2services.odata.schema.attribute;
import de.hybris.platform.integrationservices.model.IntegrationObjectItemAttributeModel;
import de.hybris.platform.integrationservices.model.TypeAttributeDescriptor;
import de.hybris.platform.integrationservices.model.impl.DefaultTypeAttributeDescriptor;
import org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute;
/**
* A generator responsible for including {@code s:IsAutoCreate} annotation on the
* {@code Property} and {@code NavigationProperty} EDMX elements.
* @deprecated Use {@link AutoCreatePropertyAnnotationGenerator} instead
*/
@Deprecated(since = "1905.09-CEP", forRemoval = true)
public class AutoCreateAnnotationGenerator implements AnnotationGenerator<IntegrationObjectItemAttributeModel>
{
private static final String IS_AUTO_CREATE = "s:IsAutoCreate";
@Override
public boolean isApplicable(final IntegrationObjectItemAttributeModel attributeModel)
{
return attributeModel != null && toDescriptor(attributeModel).isAutoCreate();
}
@Override
public AnnotationAttribute generate(final IntegrationObjectItemAttributeModel attributeModel)
{
return new AnnotationAttribute()
.setName(IS_AUTO_CREATE)
.setText("true");
}
/**
* Converts model to the attribute descriptor.
* @param model a model to convert
* @return an instance created by calling {@code DefaultTypeAttributeDescriptor.create(model)}
*/
protected TypeAttributeDescriptor toDescriptor(final IntegrationObjectItemAttributeModel model)
{
return DefaultTypeAttributeDescriptor.create(model);
}
}
|
3e07b64919685c44b2acb301c44d285d663e34b2
| 1,328 |
java
|
Java
|
src/sorts/misc/CupcakeWrapperSort.java
|
PCBoyGames/ArrayV-v4.0
|
238e28bcfca74dfd514b19fffa73829b51edd098
|
[
"MIT"
] | 1 |
2021-12-16T16:52:39.000Z
|
2021-12-16T16:52:39.000Z
|
src/sorts/misc/CupcakeWrapperSort.java
|
PCBoyGames/ArrayV-v4.0
|
238e28bcfca74dfd514b19fffa73829b51edd098
|
[
"MIT"
] | 1 |
2021-11-30T22:03:44.000Z
|
2021-12-31T02:08:54.000Z
|
src/sorts/misc/CupcakeWrapperSort.java
|
PCBoyGames/ArrayV-v4.0
|
238e28bcfca74dfd514b19fffa73829b51edd098
|
[
"MIT"
] | 1 |
2021-10-05T16:39:39.000Z
|
2021-10-05T16:39:39.000Z
| 34.051282 | 163 | 0.625753 | 3,266 |
package sorts.misc;
import main.ArrayVisualizer;
import sorts.templates.Sort;
/*
CODED FOR ARRAYV BY PCBOYGAMES
------------------------------
- SORTING ALGORITHM MADHOUSE -
------------------------------
*/
final public class CupcakeWrapperSort extends Sort {
public CupcakeWrapperSort(ArrayVisualizer arrayVisualizer) {
super(arrayVisualizer);
this.setSortListName("Cupcake Wrapper");
this.setRunAllSortsName("Cupcake Wrapper Sort");
this.setRunSortName("Cupcake Wrapper Sort");
this.setCategory("Miscellaneous Sorts");
this.setComparisonBased(true);
this.setBucketSort(false);
this.setRadixSort(false);
this.setUnreasonablySlow(false);
this.setUnreasonableLimit(0);
this.setBogoSort(false);
}
@Override
public void runSort(int[] array, int currentLength, int bucketCount) {
int right = currentLength;
for (int limit = currentLength - 1; limit >= 0; limit--) {
for (right = limit; right > 0; right--) if (Reads.compareIndices(array, 0, right, 0.25, true) > 0) Writes.reversal(array, 0, right, 0.25, true, false);
Writes.reversal(array, 0, currentLength - 1, 0.25, true, false);
Writes.reversal(array, 0, currentLength - 2, 0.25, true, false);
}
}
}
|
3e07b669c63f0951ae41a141b21e3e6a448b4ddc
| 10,978 |
java
|
Java
|
dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/DataFileAnnotationServiceImpl.java
|
Gouzhong1223/Dubhe
|
8959a51704410dc38b595a0926646b9928451c9a
|
[
"Apache-2.0"
] | 1 |
2022-01-11T07:14:37.000Z
|
2022-01-11T07:14:37.000Z
|
dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/DataFileAnnotationServiceImpl.java
|
Gouzhong1223/Dubhe
|
8959a51704410dc38b595a0926646b9928451c9a
|
[
"Apache-2.0"
] | 1 |
2022-03-04T07:19:43.000Z
|
2022-03-04T07:19:43.000Z
|
dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/DataFileAnnotationServiceImpl.java
|
Gouzhong1223/Dubhe
|
8959a51704410dc38b595a0926646b9928451c9a
|
[
"Apache-2.0"
] | 1 |
2022-03-20T13:09:14.000Z
|
2022-03-20T13:09:14.000Z
| 40.212454 | 192 | 0.689105 | 3,267 |
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.data.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dubhe.biz.base.constant.MagicNumConstant;
import org.dubhe.biz.base.service.UserContextService;
import org.dubhe.biz.base.utils.DateUtil;
import org.dubhe.biz.log.enums.LogEnum;
import org.dubhe.biz.log.utils.LogUtil;
import org.dubhe.cloud.authconfig.utils.JwtUtils;
import org.dubhe.data.constant.Constant;
import org.dubhe.data.dao.DataFileAnnotationMapper;
import org.dubhe.data.domain.entity.DataFileAnnotation;
import org.dubhe.data.domain.entity.Dataset;
import org.dubhe.data.domain.entity.DatasetVersionFile;
import org.dubhe.data.service.DataFileAnnotationService;
import org.dubhe.data.util.FileUtil;
import org.dubhe.data.util.GeneratorKeyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.stream.Collectors;
/**
* @description 数据文件标注服务实现类
* @date 2021-01-06
*/
@Service
public class DataFileAnnotationServiceImpl extends ServiceImpl<DataFileAnnotationMapper, DataFileAnnotation> implements DataFileAnnotationService {
@Autowired
private DataFileAnnotationMapper dataFileAnnotationMapper;
@Autowired
private UserContextService userContextService;
@Autowired
private DatasetVersionFileServiceImpl datasetVersionFileServiceImpl;
@Autowired
private GeneratorKeyUtil generatorKeyUtil;
/**
* 批量保存数据文件标注数据
*
* @param dataFileAnnotations 数据文件标注集合
*/
@Override
public void insertDataFileBatch(List<DataFileAnnotation> dataFileAnnotations) {
if(!CollectionUtils.isEmpty(dataFileAnnotations)){
dataFileAnnotationMapper.insertBatch(dataFileAnnotations);
}
}
/**
* 根据版本文件ID批量删除标注数据
*
* @param versionIds 版本文件IDS
*/
@Override
public void deleteBatch(Long datasetId,List<Long> versionIds) {
dataFileAnnotationMapper.deleteBatch(datasetId,versionIds);
}
/**
* 根据版本ID查询标签列表
*
* @param versionFileId 版本ID
* @return 标签ID列表
*/
@Override
public List<Long> findInfoByVersionId(Long datasetId,Long versionFileId) {
return dataFileAnnotationMapper.findInfoByVersionId(datasetId,versionFileId);
}
/**
* 批量新增标注文件数据
* @param datasetId 数据集ID
* @param versionFileId 版本文件ID
* @param fileLabelIds 标注标签Ids
* @param fileName 文件名称
*/
@Override
public void insertAnnotationFileByVersionIdAndLabelIds(Long datasetId, Long versionFileId, List<Long> fileLabelIds, String fileName) {
List<DataFileAnnotation> dataFileAnnotations = fileLabelIds.stream().map(labelId -> {
DataFileAnnotation dataFileAnnotation = new DataFileAnnotation();
dataFileAnnotation.setDatasetId(datasetId);
dataFileAnnotation.setVersionFileId(versionFileId);
dataFileAnnotation.setLabelId(labelId);
dataFileAnnotation.setPrediction(1D);
dataFileAnnotation.setCreateUserId(JwtUtils.getCurUserId());
dataFileAnnotation.setUpdateUserId(JwtUtils.getCurUserId());
dataFileAnnotation.setCreateTime(DateUtil.getCurrentTimestamp());
dataFileAnnotation.setUpdateTime(DateUtil.getCurrentTimestamp());
dataFileAnnotation.setStatus(MagicNumConstant.ZERO);
dataFileAnnotation.setInvariable(MagicNumConstant.ZERO);
dataFileAnnotation.setFileName(fileName);
dataFileAnnotation.setDeleted(false);
return dataFileAnnotation;
}).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(dataFileAnnotations)){
Queue<Long> dataFileAnnotionIds = generatorKeyUtil.getSequenceByBusinessCode(Constant.DATA_FILE_ANNOTATION, dataFileAnnotations.size());
for (DataFileAnnotation dataFileAnnotation : dataFileAnnotations) {
dataFileAnnotation.setId(dataFileAnnotionIds.poll());
}
dataFileAnnotationMapper.insertBatch(dataFileAnnotations);
}
}
/**
* 批量删除标注文件数据
*
* @param versionFileId 版本文件ID
* @param fileLabelIds 标注标签Ids
*/
@Override
public void deleteAnnotationFileByVersionIdAndLabelIds(Long datasetId, Long versionFileId, List<Long> fileLabelIds) {
dataFileAnnotationMapper.deleteAnnotationFileByVersionIdAndLabelIds(datasetId,versionFileId,fileLabelIds);
}
/**
* 根据版本文件 id 修改状态
*
* @param ids 版本文件ID
* @param deleteFlag 删除标识
*/
@Override
public void updateStatusByVersionIds(Long datasetId,List<Long> ids, boolean deleteFlag) {
dataFileAnnotationMapper.updateStatusByVersionIds(datasetId,ids,deleteFlag);
}
/**
* 文本数据集需备份文本标注数据
*
* @param originDataset 原数据集实体
* @param targetDataset 目标数据集实体
* @param versionFiles 版本文件
*/
@Override
public void backupDataFileAnnotationDataByDatasetId(Dataset originDataset, Dataset targetDataset, List<DatasetVersionFile> versionFiles) {
LogUtil.info(LogEnum.BIZ_DATASET, "文本数据集需备份文本标注数据1");
Long curUserId = userContextService.getCurUserId();
List<DatasetVersionFile> filesByDatasetIdAndVersionName = datasetVersionFileServiceImpl.getFilesByDatasetIdAndVersionName(originDataset.getId(), originDataset.getCurrentVersionName());
List<Long> objects = new ArrayList<>();
for (DatasetVersionFile versionFile : filesByDatasetIdAndVersionName){
objects.add(versionFile.getId());
}
Map<String, Long> nameMap = versionFiles.stream().collect(Collectors.toMap(DatasetVersionFile::getFileName, DatasetVersionFile::getId));
List<DataFileAnnotation> dataFileAnnotations = baseMapper.selectList(new LambdaUpdateWrapper<DataFileAnnotation>().eq(DataFileAnnotation::getDatasetId, originDataset.getId())
.in(DataFileAnnotation::getVersionFileId,objects));
LogUtil.info(LogEnum.BIZ_DATASET, "文本数据集需备份文本标注数据2");
if(CollectionUtil.isNotEmpty(dataFileAnnotations)){
LogUtil.info(LogEnum.BIZ_DATASET, "文本数据集需备份文本标注数据3");
List<DataFileAnnotation> fileAnnotations = dataFileAnnotations.stream().map(a -> {
DataFileAnnotation annotation = DataFileAnnotation.builder()
.datasetId(targetDataset.getId())
.fileName(a.getFileName())
.labelId(a.getLabelId())
.prediction(a.getPrediction())
.versionFileId(nameMap.get(a.getFileName()))
.build();
annotation.setDeleted(false);
annotation.setCreateUserId(curUserId);
annotation.setUpdateUserId(annotation.getCreateUserId());
return annotation;
}).collect(Collectors.toList());
LogUtil.info(LogEnum.BIZ_DATASET, "文本数据集需备份文本标注数据4");
if(!CollectionUtils.isEmpty(fileAnnotations)){
Queue<Long> dataFileAnnotionIds = generatorKeyUtil.getSequenceByBusinessCode(Constant.DATA_FILE_ANNOTATION, fileAnnotations.size());
for (DataFileAnnotation dataFileAnnotation : fileAnnotations) {
dataFileAnnotation.setId(dataFileAnnotionIds.poll());
dataFileAnnotation.setStatus(MagicNumConstant.ZERO);
dataFileAnnotation.setInvariable(MagicNumConstant.ZERO);
}
LogUtil.info(LogEnum.BIZ_DATASET, "文本数据集需备份文本标注数据5");
}
List<List<DataFileAnnotation>> splitAnnotations = CollectionUtil.split(fileAnnotations, MagicNumConstant.FOUR_THOUSAND);
splitAnnotations.forEach(splitAnnotation->baseMapper.insertBatch(splitAnnotation));
}
}
/**
* 根据标签Id,数据集Id,数据集文件版本id查询标签标注信息
*
* @param labelId 标签id
* @param datasetId 数据集Id
* @return DataFileAnnotation
*/
@Override
public List<DataFileAnnotation> getLabelIdByDatasetIdAndVersionId(Long[] labelId, Long datasetId, Long offset, Integer limit,String versionName) {
return baseMapper.getLabelIdByDatasetIdAndVersionId(labelId,datasetId,offset,limit, versionName);
}
/**
* 获取发布时版本标注信息
*
* @param datasetId 数据集ID
* @param versionName 版本名称
* @param status 版本文件状态
* @return List<DataFileAnnotation> 标注信息
*/
@Override
public List<DataFileAnnotation> getAnnotationByVersion(Long datasetId, String versionName, Integer status) {
return baseMapper.getAnnotationByVersion(datasetId, versionName, status);
}
/**
* 更新标注信息
*
* @param dataFileAnnotations 标注信息列表
*/
@Override
public void updateDataFileAnnotations(List<DataFileAnnotation> dataFileAnnotations) {
dataFileAnnotations.forEach(dataFileAnnotation -> baseMapper.updateDataFileAnnotations(dataFileAnnotation.getId(),
dataFileAnnotation.getStatus(),dataFileAnnotation.getInvariable(),dataFileAnnotation.getDatasetId(),
dataFileAnnotation.getVersionFileId()));
}
/**
* 回退标注信息
*
* @param datasetId 数据集ID
* @param versionSource 源版本
* @param status 标注状态
* @param invariable 是否为版本标注
*/
@Override
public void rollbackAnnotation(Long datasetId, String versionSource, Integer status, Integer invariable){
baseMapper.rollbackAnnotation(datasetId, versionSource, status, invariable);
}
/**
* 筛选查询数量
*
* @param datasetId 数据集id
* @param versionName 版本名称
* @param labelId 标签id
*/
@Override
public Long selectDetectionCount(Long datasetId, String versionName, Long[] labelId) {
return baseMapper.selectDetectionCount(datasetId, versionName, labelId);
}
}
|
3e07b71d179bb451038dae230985624e87215fc1
| 16,076 |
java
|
Java
|
src/main/java/com/github/quickhull3d/Face.java
|
Quickhull3d/quickhull3d
|
3f80953b86c46385e84730e5d2a1745cbfa12703
|
[
"BSD-2-Clause"
] | 17 |
2015-01-26T14:14:18.000Z
|
2022-02-18T07:46:36.000Z
|
src/main/java/com/github/quickhull3d/Face.java
|
Quickhull3d/quickhull3d
|
3f80953b86c46385e84730e5d2a1745cbfa12703
|
[
"BSD-2-Clause"
] | 1 |
2016-08-07T22:43:18.000Z
|
2016-08-07T22:43:18.000Z
|
src/main/java/com/github/quickhull3d/Face.java
|
Quickhull3d/quickhull3d
|
3f80953b86c46385e84730e5d2a1745cbfa12703
|
[
"BSD-2-Clause"
] | 7 |
2015-04-10T06:30:56.000Z
|
2020-10-02T09:32:35.000Z
| 30.104869 | 174 | 0.530169 | 3,268 |
package com.github.quickhull3d;
/*
* #%L
* A Robust 3D Convex Hull Algorithm in Java
* %%
* Copyright (C) 2004 - 2014 John E. Lloyd
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
/**
* Basic triangular face used to form the hull.
* <p>
* The information stored for each face consists of a planar normal, a planar
* offset, and a doubly-linked list of three <a href=HalfEdge>HalfEdges</a>
* which surround the face in a counter-clockwise direction.
*
* @author John E. Lloyd, Fall 2004
*/
class Face {
protected static final int DELETED = 3;
protected static final int NON_CONVEX = 2;
protected static final int VISIBLE = 1;
protected double area;
protected HalfEdge he0;
protected int mark = VISIBLE;
protected Face next;
protected int numVerts;
protected Vertex outside;
protected double planeOffset;
private Point3d centroid;
private Vector3d normal;
public Face() {
normal = new Vector3d();
centroid = new Point3d();
mark = VISIBLE;
}
public static Face create(Vertex[] vtxArray, int[] indices) {
Face face = new Face();
HalfEdge hePrev = null;
for (int i = 0; i < indices.length; i++) {
HalfEdge he = new HalfEdge(vtxArray[indices[i]], face);
if (hePrev != null) {
he.setPrev(hePrev);
hePrev.setNext(he);
} else {
face.he0 = he;
}
hePrev = he;
}
face.he0.setPrev(hePrev);
hePrev.setNext(face.he0);
// compute the normal and offset
face.computeNormalAndCentroid();
return face;
}
public static Face createTriangle(Vertex v0, Vertex v1, Vertex v2) {
return createTriangle(v0, v1, v2, 0);
}
/**
* Constructs a triangule Face from vertices v0, v1, and v2.
*
* @param v0
* first vertex
* @param v1
* second vertex
* @param v2
* third vertex
*/
public static Face createTriangle(Vertex v0, Vertex v1, Vertex v2, double minArea) {
Face face = new Face();
HalfEdge he0 = new HalfEdge(v0, face);
HalfEdge he1 = new HalfEdge(v1, face);
HalfEdge he2 = new HalfEdge(v2, face);
he0.prev = he2;
he0.next = he1;
he1.prev = he0;
he1.next = he2;
he2.prev = he1;
he2.next = he0;
face.he0 = he0;
// compute the normal and offset
face.computeNormalAndCentroid(minArea);
return face;
}
public void computeCentroid(Point3d centroid) {
centroid.setZero();
HalfEdge he = he0;
do {
centroid.add(he.head().pnt);
he = he.next;
} while (he != he0);
centroid.scale(1 / (double) numVerts);
}
public void computeNormal(Vector3d normal) {
HalfEdge he1 = he0.next;
HalfEdge he2 = he1.next;
Point3d p0 = he0.head().pnt;
Point3d p2 = he1.head().pnt;
double d2x = p2.x - p0.x;
double d2y = p2.y - p0.y;
double d2z = p2.z - p0.z;
normal.setZero();
numVerts = 2;
while (he2 != he0) {
double d1x = d2x;
double d1y = d2y;
double d1z = d2z;
p2 = he2.head().pnt;
d2x = p2.x - p0.x;
d2y = p2.y - p0.y;
d2z = p2.z - p0.z;
normal.x += d1y * d2z - d1z * d2y;
normal.y += d1z * d2x - d1x * d2z;
normal.z += d1x * d2y - d1y * d2x;
he1 = he2;
he2 = he2.next;
numVerts++;
}
area = normal.norm();
normal.scale(1 / area);
}
public void computeNormal(Vector3d normal, double minArea) {
computeNormal(normal);
if (area < minArea) {
// make the normal more robust by removing
// components parallel to the longest edge
HalfEdge hedgeMax = null;
double lenSqrMax = 0;
HalfEdge hedge = he0;
do {
double lenSqr = hedge.lengthSquared();
if (lenSqr > lenSqrMax) {
hedgeMax = hedge;
lenSqrMax = lenSqr;
}
hedge = hedge.next;
} while (hedge != he0);
Point3d p2 = hedgeMax.head().pnt;
Point3d p1 = hedgeMax.tail().pnt;
double lenMax = Math.sqrt(lenSqrMax);
double ux = (p2.x - p1.x) / lenMax;
double uy = (p2.y - p1.y) / lenMax;
double uz = (p2.z - p1.z) / lenMax;
double dot = normal.x * ux + normal.y * uy + normal.z * uz;
normal.x -= dot * ux;
normal.y -= dot * uy;
normal.z -= dot * uz;
normal.normalize();
}
}
/**
* Computes the distance from a point p to the plane of this face.
*
* @param p
* the point
* @return distance from the point to the plane
*/
public double distanceToPlane(Point3d p) {
return normal.x * p.x + normal.y * p.y + normal.z * p.z - planeOffset;
}
/**
* Finds the half-edge within this face which has tail <code>vt</code> and
* head <code>vh</code>.
*
* @param vt
* tail point
* @param vh
* head point
* @return the half-edge, or null if none is found.
*/
public HalfEdge findEdge(Vertex vt, Vertex vh) {
HalfEdge he = he0;
do {
if (he.head() == vh && he.tail() == vt) {
return he;
}
he = he.next;
} while (he != he0);
return null;
}
public Point3d getCentroid() {
return centroid;
}
/**
* Gets the i-th half-edge associated with the face.
*
* @param i
* the half-edge index, in the range 0-2.
* @return the half-edge
*/
public HalfEdge getEdge(int i) {
HalfEdge he = he0;
while (i > 0) {
he = he.next;
i--;
}
while (i < 0) {
he = he.prev;
i++;
}
return he;
}
public HalfEdge getFirstEdge() {
return he0;
}
/**
* Returns the normal of the plane associated with this face.
*
* @return the planar normal
*/
public Vector3d getNormal() {
return normal;
}
public void getVertexIndices(int[] idxs) {
HalfEdge he = he0;
int i = 0;
do {
idxs[i++] = he.head().index;
he = he.next;
} while (he != he0);
}
public String getVertexString() {
String s = null;
HalfEdge he = he0;
do {
if (s == null) {
s = "" + he.head().index;
} else {
s += " " + he.head().index;
}
he = he.next;
} while (he != he0);
return s;
}
public int mergeAdjacentFace(HalfEdge hedgeAdj, Face[] discarded) {
Face oppFace = hedgeAdj.oppositeFace();
int numDiscarded = 0;
discarded[numDiscarded++] = oppFace;
oppFace.mark = DELETED;
HalfEdge hedgeOpp = hedgeAdj.getOpposite();
HalfEdge hedgeAdjPrev = hedgeAdj.prev;
HalfEdge hedgeAdjNext = hedgeAdj.next;
HalfEdge hedgeOppPrev = hedgeOpp.prev;
HalfEdge hedgeOppNext = hedgeOpp.next;
while (hedgeAdjPrev.oppositeFace() == oppFace) {
hedgeAdjPrev = hedgeAdjPrev.prev;
hedgeOppNext = hedgeOppNext.next;
}
while (hedgeAdjNext.oppositeFace() == oppFace) {
hedgeOppPrev = hedgeOppPrev.prev;
hedgeAdjNext = hedgeAdjNext.next;
}
HalfEdge hedge;
for (hedge = hedgeOppNext; hedge != hedgeOppPrev.next; hedge = hedge.next) {
hedge.face = this;
}
if (hedgeAdj == he0) {
he0 = hedgeAdjNext;
}
// handle the half edges at the head
Face discardedFace;
discardedFace = connectHalfEdges(hedgeOppPrev, hedgeAdjNext);
if (discardedFace != null) {
discarded[numDiscarded++] = discardedFace;
}
// handle the half edges at the tail
discardedFace = connectHalfEdges(hedgeAdjPrev, hedgeOppNext);
if (discardedFace != null) {
discarded[numDiscarded++] = discardedFace;
}
computeNormalAndCentroid();
checkConsistency();
return numDiscarded;
}
public int numVertices() {
return numVerts;
}
public void triangulate(FaceList newFaces, double minArea) {
HalfEdge hedge;
if (numVertices() < 4) {
return;
}
Vertex v0 = he0.head();
hedge = he0.next;
HalfEdge oppPrev = hedge.opposite;
Face face0 = null;
for (hedge = hedge.next; hedge != he0.prev; hedge = hedge.next) {
Face face = createTriangle(v0, hedge.prev.head(), hedge.head(), minArea);
face.he0.next.setOpposite(oppPrev);
face.he0.prev.setOpposite(hedge.opposite);
oppPrev = face.he0;
newFaces.add(face);
if (face0 == null) {
face0 = face;
}
}
hedge = new HalfEdge(he0.prev.prev.head(), this);
hedge.setOpposite(oppPrev);
hedge.prev = he0;
hedge.prev.next = hedge;
hedge.next = he0.prev;
hedge.next.prev = hedge;
computeNormalAndCentroid(minArea);
checkConsistency();
for (Face face = face0; face != null; face = face.next) {
face.checkConsistency();
}
}
/**
* return the squared area of the triangle defined by the half edge hedge0
* and the point at the head of hedge1.
*
* @param hedge0
* @param hedge1
* @return
*/
public double areaSquared(HalfEdge hedge0, HalfEdge hedge1) {
Point3d p0 = hedge0.tail().pnt;
Point3d p1 = hedge0.head().pnt;
Point3d p2 = hedge1.head().pnt;
double dx1 = p1.x - p0.x;
double dy1 = p1.y - p0.y;
double dz1 = p1.z - p0.z;
double dx2 = p2.x - p0.x;
double dy2 = p2.y - p0.y;
double dz2 = p2.z - p0.z;
double x = dy1 * dz2 - dz1 * dy2;
double y = dz1 * dx2 - dx1 * dz2;
double z = dx1 * dy2 - dy1 * dx2;
return x * x + y * y + z * z;
}
private void computeNormalAndCentroid() {
computeNormal(normal);
computeCentroid(centroid);
planeOffset = normal.dot(centroid);
int numv = 0;
HalfEdge he = he0;
do {
numv++;
he = he.next;
} while (he != he0);
if (numv != numVerts) {
throw new InternalErrorException("face " + getVertexString() + " numVerts=" + numVerts + " should be " + numv);
}
}
private void computeNormalAndCentroid(double minArea) {
computeNormal(normal, minArea);
computeCentroid(centroid);
planeOffset = normal.dot(centroid);
}
private Face connectHalfEdges(HalfEdge hedgePrev, HalfEdge hedge) {
Face discardedFace = null;
if (hedgePrev.oppositeFace() == hedge.oppositeFace()) { // then there is
// a redundant
// edge that we
// can get rid
// off
Face oppFace = hedge.oppositeFace();
HalfEdge hedgeOpp;
if (hedgePrev == he0) {
he0 = hedge;
}
if (oppFace.numVertices() == 3) { // then we can get rid of the
// opposite face altogether
hedgeOpp = hedge.getOpposite().prev.getOpposite();
oppFace.mark = DELETED;
discardedFace = oppFace;
} else {
hedgeOpp = hedge.getOpposite().next;
if (oppFace.he0 == hedgeOpp.prev) {
oppFace.he0 = hedgeOpp;
}
hedgeOpp.prev = hedgeOpp.prev.prev;
hedgeOpp.prev.next = hedgeOpp;
}
hedge.prev = hedgePrev.prev;
hedge.prev.next = hedge;
hedge.opposite = hedgeOpp;
hedgeOpp.opposite = hedge;
// oppFace was modified, so need to recompute
oppFace.computeNormalAndCentroid();
} else {
hedgePrev.next = hedge;
hedge.prev = hedgePrev;
}
return discardedFace;
}
void checkConsistency() {
// do a sanity check on the face
HalfEdge hedge = he0;
double maxd = 0;
int numv = 0;
if (numVerts < 3) {
throw new InternalErrorException("degenerate face: " + getVertexString());
}
do {
HalfEdge hedgeOpp = hedge.getOpposite();
if (hedgeOpp == null) {
throw new InternalErrorException("face " + getVertexString() + ": " + "unreflected half edge " + hedge.getVertexString());
} else if (hedgeOpp.getOpposite() != hedge) {
throw new InternalErrorException("face " + getVertexString() + ": " + "opposite half edge " + hedgeOpp.getVertexString() + " has opposite "
+ hedgeOpp.getOpposite().getVertexString());
}
if (hedgeOpp.head() != hedge.tail() || hedge.head() != hedgeOpp.tail()) {
throw new InternalErrorException("face " + getVertexString() + ": " + "half edge " + hedge.getVertexString() + " reflected by " + hedgeOpp.getVertexString());
}
Face oppFace = hedgeOpp.face;
if (oppFace == null) {
throw new InternalErrorException("face " + getVertexString() + ": " + "no face on half edge " + hedgeOpp.getVertexString());
} else if (oppFace.mark == DELETED) {
throw new InternalErrorException("face " + getVertexString() + ": " + "opposite face " + oppFace.getVertexString() + " not on hull");
}
double d = Math.abs(distanceToPlane(hedge.head().pnt));
if (d > maxd) {
maxd = d;
}
numv++;
hedge = hedge.next;
} while (hedge != he0);
if (numv != numVerts) {
throw new InternalErrorException("face " + getVertexString() + " numVerts=" + numVerts + " should be " + numv);
}
}
}
|
3e07b7a9ecef933b8131ebfa35252e68b0f48b97
| 5,506 |
java
|
Java
|
drawer/src/space/earlygrey/shapedrawer/PolygonDrawer.java
|
guichazan/shapedrawer
|
7cceb4fc096f1a021805d082740be5fc3a02898c
|
[
"MIT"
] | null | null | null |
drawer/src/space/earlygrey/shapedrawer/PolygonDrawer.java
|
guichazan/shapedrawer
|
7cceb4fc096f1a021805d082740be5fc3a02898c
|
[
"MIT"
] | null | null | null |
drawer/src/space/earlygrey/shapedrawer/PolygonDrawer.java
|
guichazan/shapedrawer
|
7cceb4fc096f1a021805d082740be5fc3a02898c
|
[
"MIT"
] | null | null | null | 41.089552 | 174 | 0.558482 | 3,269 |
package space.earlygrey.shapedrawer;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
class PolygonDrawer extends DrawerTemplate {
static final Vector2 centre = new Vector2(), radius = new Vector2();
PolygonDrawer(ShapeDrawer drawer) {
super(drawer);
}
void polygon(float centreX, float centreY, int sides, float radiusX, float radiusY, float rotation, float lineWidth, JoinType joinType, float startAngle, float radians) {
float halfLineWidth = 0.5f*lineWidth;
radians = ShapeUtils.normaliseAngleToPositive(radians);
if (radians==0) {
radians = ShapeUtils.PI2;
startAngle = 0;
}
centre.set(centreX, centreY);
radius.set(radiusX, radiusY);
if (joinType==JoinType.NONE) {
drawPolygonNoJoin(centre, sides, lineWidth, rotation, radius, startAngle, radians);
} else {
drawPolygonWithJoin(centre, sides, halfLineWidth, rotation, radius, startAngle, radians, joinType==JoinType.SMOOTH);
}
}
void drawPolygonNoJoin(Vector2 centre, int sides, float lineWidth, float rotation, Vector2 radius, float startAngle, float radians) {
float angleInterval = MathUtils.PI2 / sides;
float endAngle = startAngle + radians;
float cos = (float) Math.cos(angleInterval), sin = (float) Math.sin(angleInterval);
float cosRot = (float) Math.cos(rotation), sinRot = (float) Math.sin(rotation);
int start = (int) Math.ceil(sides * (startAngle / ShapeUtils.PI2));
int end = (int) Math.floor(sides * (endAngle / ShapeUtils.PI2)) + 1;
dir.set(1, 0).rotateRad(Math.min(start * angleInterval, endAngle));
A.set(1, 0).rotateRad(startAngle).scl(radius);
B.set(dir).scl(radius);
for (int i = start; i <= end; i++) {
float x1 = A.x*cosRot-A.y*sinRot + centre.x, y1 = A.x*sinRot+A.y*cosRot + centre.y;
float x2 = B.x*cosRot-B.y*sinRot + centre.x, y2 = B.x*sinRot+B.y*cosRot + centre.y;
drawer.line(x1, y1, x2, y2, lineWidth, false);
if (i<end-1) {
A.set(B);
dir.set(dir.x * cos - dir.y * sin, dir.x * sin + dir.y * cos);
B.set(dir).scl(radius);
} else if (i==end-1) {
A.set(B);
B.set(1, 0).rotateRad(endAngle).scl(radius);
}
}
}
void drawPolygonWithJoin(Vector2 centre, int sides, float halfLineWidth, float rotation, Vector2 radius, float startAngle, float radians, boolean smooth) {
boolean full = ShapeUtils.epsilonEquals(radians, ShapeUtils.PI2);
float angleInterval = MathUtils.PI2 / sides;
float endAngle = startAngle + radians;
float cos = (float) Math.cos(angleInterval), sin = (float) Math.sin(angleInterval);
float cosRot = (float) Math.cos(rotation), sinRot = (float) Math.sin(rotation);
int start, end;
if (full) {
start = 1;
end = sides;
dir.set(1, 0).rotateRad(start * angleInterval);
A.set(1, 0).rotateRad((start-2) * angleInterval).scl(radius);
C.set(dir).scl(radius);
B.set(1, 0).rotateRad((start-1) * angleInterval).scl(radius);
} else {
start = (int) Math.ceil(sides * (startAngle / ShapeUtils.PI2));
if (ShapeUtils.epsilonEquals(sides * start, startAngle)) start++;
end = (int) Math.floor(sides * (endAngle / ShapeUtils.PI2)) + 1;
end = Math.min(end, start + sides);
dir.set(1, 0).rotateRad(Math.min(start * angleInterval, endAngle));
A.set(1, 0).rotateRad((start-1) * angleInterval).scl(radius);
B.set(1, 0).rotateRad(startAngle).scl(radius);
C.set(dir).scl(radius);
}
for (int i = start; i <= end; i++) {
if (!full && i==start) {
Joiner.prepareRadialEndpoint(B, D, E, halfLineWidth);
} else {
if (smooth) {
Joiner.prepareSmoothJoin(A, B, C, D, E, halfLineWidth, true);
} else {
Joiner.preparePointyJoin(A, B, C, D, E, halfLineWidth);
}
}
vert1(E.x*cosRot-E.y*sinRot + centre.x, E.x*sinRot+E.y*cosRot + centre.y);
vert2(D.x*cosRot-D.y*sinRot + centre.x, D.x*sinRot+D.y*cosRot + centre.y);
if (full || i<end) {
A.set(B);
B.set(C);
dir.set(dir.x * cos - dir.y * sin, dir.x * sin + dir.y * cos);
C.set(dir).scl(radius);
} else {
B.set(1, 0).rotateRad(endAngle).scl(radius);
}
if (full || i<end) {
if (smooth) {
Joiner.prepareSmoothJoin(A, B, C, D, E, halfLineWidth, false);
} else {
Joiner.preparePointyJoin(A, B, C, D, E, halfLineWidth);
}
} else {
Joiner.prepareRadialEndpoint(B, D, E, halfLineWidth);
}
vert3(D.x*cosRot-D.y*sinRot + centre.x, D.x*sinRot+D.y*cosRot + centre.y);
vert4(E.x*cosRot-E.y*sinRot + centre.x, E.x*sinRot+E.y*cosRot + centre.y);
drawVerts(); //draw current AB
if (smooth && (full || i<end)) drawSmoothJoinFill(A, B, C, D, E, centre, cosRot, sinRot, halfLineWidth);
}
}
}
|
3e07b7aba84833880e04ae7e80fecfc5c39b2475
| 1,320 |
java
|
Java
|
src/main/java/com/simbest/boot/base/annotations/ConditionalOnPropertyNotEmpty.java
|
zhanshigong889/simbest-boot-cores
|
7a70a42021648e7e9ac20480d59839b92a972074
|
[
"MIT"
] | null | null | null |
src/main/java/com/simbest/boot/base/annotations/ConditionalOnPropertyNotEmpty.java
|
zhanshigong889/simbest-boot-cores
|
7a70a42021648e7e9ac20480d59839b92a972074
|
[
"MIT"
] | null | null | null |
src/main/java/com/simbest/boot/base/annotations/ConditionalOnPropertyNotEmpty.java
|
zhanshigong889/simbest-boot-cores
|
7a70a42021648e7e9ac20480d59839b92a972074
|
[
"MIT"
] | null | null | null | 33.846154 | 120 | 0.756818 | 3,270 |
/*
* 版权所有 © 北京晟壁科技有限公司 2008-2027。保留一切权利!
*/
package com.simbest.boot.base.annotations;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.core.type.AnnotatedTypeMetadata;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Map;
/**
* 用途:判断属性是否有设置
* 作者: lishuyi
* 时间: 2018/8/20 11:55
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Conditional(ConditionalOnPropertyNotEmpty.OnPropertyNotEmptyCondition.class)
public @interface ConditionalOnPropertyNotEmpty {
String value();
class OnPropertyNotEmptyCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
Map<String, Object> attrs = metadata.getAnnotationAttributes(ConditionalOnPropertyNotEmpty.class.getName());
String propertyName = (String) attrs.get("value");
String val = context.getEnvironment().getProperty(propertyName);
return val != null && !val.trim().isEmpty();
}
}
}
|
3e07b7b9b3c3cdf5dc0825c561c1bb921188e78f
| 1,630 |
java
|
Java
|
server/src/com/codefict/film/FilmInitData.java
|
vazrupe/FilmInfomation
|
af52b5ed0c7bccfba0ac7f7ed11f3186e373dc35
|
[
"MIT"
] | null | null | null |
server/src/com/codefict/film/FilmInitData.java
|
vazrupe/FilmInfomation
|
af52b5ed0c7bccfba0ac7f7ed11f3186e373dc35
|
[
"MIT"
] | null | null | null |
server/src/com/codefict/film/FilmInitData.java
|
vazrupe/FilmInfomation
|
af52b5ed0c7bccfba0ac7f7ed11f3186e373dc35
|
[
"MIT"
] | null | null | null | 30.185185 | 84 | 0.670552 | 3,271 |
package com.codefict.film;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
@WebServlet("/FilmInitData")
public class FilmInitData extends HttpServlet {
private static final long serialVersionUID = 1L;
public FilmInitData() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("application/json;charset=utf-8");
response.setCharacterEncoding("utf-8");
Database db = (Database) getServletContext().getAttribute("film_database");
PrintWriter out = response.getWriter();
String getISOListSql = "select DISTINCT ISO from ISO ORDER BY ISO";
String getMakerSql = "select DISTINCT MAKER from FILM";
try {
ResultSet rs_iso = db.runSql(getISOListSql);
String isoList = "";
int count = 0;
while (rs_iso.next()) {
int iso = rs_iso.getInt(1);
isoList += String.format((count++ > 0 ? ",%s" : "%s"), iso);
}
ResultSet rs_maker = db.runSql(getMakerSql);
String makerList = "";
count = 0;
while (rs_maker.next()) {
String maker = rs_maker.getString(1);
makerList += String.format((count++ > 0 ? ",\"%s\"" : "\"%s\""), maker.trim());
}
out.print("{\"maker\":[" + makerList + "], \"iso\":[" + isoList + "]}");
} catch (SQLException e) {
out.print("오류가있음");
}
}
}
|
3e07b82b637b0b8a3591f6a90ceac0a9381643b7
| 397 |
java
|
Java
|
springboot-starter/src/main/java/com/udemy/springboot/basics/springbootstarter/BookController.java
|
DhirenKumar13/SpringBootProjects
|
a3b3150494c3e433740a31955e219baaa3769eda
|
[
"Apache-2.0"
] | null | null | null |
springboot-starter/src/main/java/com/udemy/springboot/basics/springbootstarter/BookController.java
|
DhirenKumar13/SpringBootProjects
|
a3b3150494c3e433740a31955e219baaa3769eda
|
[
"Apache-2.0"
] | null | null | null |
springboot-starter/src/main/java/com/udemy/springboot/basics/springbootstarter/BookController.java
|
DhirenKumar13/SpringBootProjects
|
a3b3150494c3e433740a31955e219baaa3769eda
|
[
"Apache-2.0"
] | null | null | null | 24.8125 | 63 | 0.788413 | 3,272 |
package com.udemy.springboot.basics.springbootstarter;
import java.util.List;
import java.util.Arrays;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class BookController {
@GetMapping("/books")
public List<Book> getBooks(){
return Arrays.asList(new Book(1L,"Java 8","David Machsafe"));
}
}
|
3e07b8a859a6a41f710284ece0773fa922e33333
| 12,415 |
java
|
Java
|
jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecTest.java
|
jebeaudet/jetty.project
|
e859c98eac1b819e6614b198bfb4620f117db349
|
[
"Apache-2.0"
] | null | null | null |
jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecTest.java
|
jebeaudet/jetty.project
|
e859c98eac1b819e6614b198bfb4620f117db349
|
[
"Apache-2.0"
] | 32 |
2022-02-15T04:33:42.000Z
|
2022-03-31T04:39:24.000Z
|
jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecTest.java
|
jebeaudet/jetty.project
|
e859c98eac1b819e6614b198bfb4620f117db349
|
[
"Apache-2.0"
] | 1 |
2022-03-03T05:49:59.000Z
|
2022-03-03T05:49:59.000Z
| 42.372014 | 114 | 0.62199 | 3,273 |
//
// ========================================================================
// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package org.eclipse.jetty.http.pathmap;
import java.util.Map;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests for URI Template Path Specs
*/
public class UriTemplatePathSpecTest
{
private void assertDetectedVars(UriTemplatePathSpec spec, String... expectedVars)
{
String prefix = String.format("Spec(\"%s\")", spec.getDeclaration());
assertEquals(expectedVars.length, spec.getVariableCount(), prefix + ".variableCount");
assertEquals(expectedVars.length, spec.getVariables().length, prefix + ".variable.length");
for (int i = 0; i < expectedVars.length; i++)
{
assertThat(String.format("%s.variable[%d]", prefix, i), spec.getVariables()[i], is(expectedVars[i]));
}
}
private void assertMatches(PathSpec spec, String path)
{
String msg = String.format("Spec(\"%s\").matches(\"%s\")", spec.getDeclaration(), path);
assertThat(msg, spec.matches(path), is(true));
}
private void assertNotMatches(PathSpec spec, String path)
{
String msg = String.format("!Spec(\"%s\").matches(\"%s\")", spec.getDeclaration(), path);
assertThat(msg, spec.matches(path), is(false));
}
@Test
public void testDefaultPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/");
assertEquals("/", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(1, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.EXACT, spec.getGroup(), "Spec.group");
assertEquals(0, spec.getVariableCount(), "Spec.variableCount");
assertEquals(0, spec.getVariables().length, "Spec.variable.length");
}
@Test
public void testExactOnePathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/a");
assertEquals("/a", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/a$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(1, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.EXACT, spec.getGroup(), "Spec.group");
assertMatches(spec, "/a");
assertMatches(spec, "/a?type=other");
assertNotMatches(spec, "/a/b");
assertNotMatches(spec, "/a/");
assertEquals(0, spec.getVariableCount(), "Spec.variableCount");
assertEquals(0, spec.getVariables().length, "Spec.variable.length");
}
@Test
public void testExactPathSpecTestWebapp()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/deep.thought/");
assertEquals("/deep.thought/", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/deep\\.thought/$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(1, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.EXACT, spec.getGroup(), "Spec.group");
assertMatches(spec, "/deep.thought/");
assertNotMatches(spec, "/deep.thought");
assertEquals(0, spec.getVariableCount(), "Spec.variableCount");
assertEquals(0, spec.getVariables().length, "Spec.variable.length");
}
@Test
public void testExactTwoPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/a/b");
assertEquals("/a/b", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/a/b$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(2, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.EXACT, spec.getGroup(), "Spec.group");
assertEquals(0, spec.getVariableCount(), "Spec.variableCount");
assertEquals(0, spec.getVariables().length, "Spec.variable.length");
assertMatches(spec, "/a/b");
assertNotMatches(spec, "/a/b/");
assertNotMatches(spec, "/a/");
assertNotMatches(spec, "/a/bb");
}
@Test
public void testMiddleVarPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/a/{var}/c");
assertEquals("/a/{var}/c", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/a/([^/]+)/c$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(3, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.MIDDLE_GLOB, spec.getGroup(), "Spec.group");
assertDetectedVars(spec, "var");
assertMatches(spec, "/a/b/c");
assertMatches(spec, "/a/zz/c");
assertMatches(spec, "/a/hello+world/c");
assertNotMatches(spec, "/a/bc");
assertNotMatches(spec, "/a/b/");
assertNotMatches(spec, "/a/b");
Map<String, String> mapped = spec.getPathParams("/a/b/c");
assertThat("Spec.pathParams", mapped, notNullValue());
assertThat("Spec.pathParams.size", mapped.size(), is(1));
assertEquals("b", mapped.get("var"), "Spec.pathParams[var]");
}
@Test
public void testOneVarPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/a/{foo}");
assertEquals("/a/{foo}", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/a/([^/]+)$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(2, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.PREFIX_GLOB, spec.getGroup(), "Spec.group");
assertDetectedVars(spec, "foo");
assertMatches(spec, "/a/b");
assertNotMatches(spec, "/a/");
assertNotMatches(spec, "/a");
Map<String, String> mapped = spec.getPathParams("/a/b");
assertThat("Spec.pathParams", mapped, notNullValue());
assertThat("Spec.pathParams.size", mapped.size(), is(1));
assertEquals("b", mapped.get("foo"), "Spec.pathParams[foo]");
}
@Test
public void testOneVarSuffixPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/{var}/b/c");
assertEquals("/{var}/b/c", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/([^/]+)/b/c$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(3, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.SUFFIX_GLOB, spec.getGroup(), "Spec.group");
assertDetectedVars(spec, "var");
assertMatches(spec, "/a/b/c");
assertMatches(spec, "/az/b/c");
assertMatches(spec, "/hello+world/b/c");
assertNotMatches(spec, "/a/bc");
assertNotMatches(spec, "/a/b/");
assertNotMatches(spec, "/a/b");
Map<String, String> mapped = spec.getPathParams("/a/b/c");
assertThat("Spec.pathParams", mapped, notNullValue());
assertThat("Spec.pathParams.size", mapped.size(), is(1));
assertEquals("a", mapped.get("var"), "Spec.pathParams[var]");
}
@Test
public void testTwoVarComplexInnerPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/a/{var1}/c/{var2}/e");
assertEquals("/a/{var1}/c/{var2}/e", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/a/([^/]+)/c/([^/]+)/e$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(5, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.MIDDLE_GLOB, spec.getGroup(), "Spec.group");
assertDetectedVars(spec, "var1", "var2");
assertMatches(spec, "/a/b/c/d/e");
assertNotMatches(spec, "/a/bc/d/e");
assertNotMatches(spec, "/a/b/d/e");
assertNotMatches(spec, "/a/b//d/e");
Map<String, String> mapped = spec.getPathParams("/a/b/c/d/e");
assertThat("Spec.pathParams", mapped, notNullValue());
assertThat("Spec.pathParams.size", mapped.size(), is(2));
assertEquals("b", mapped.get("var1"), "Spec.pathParams[var1]");
assertEquals("d", mapped.get("var2"), "Spec.pathParams[var2]");
}
@Test
public void testTwoVarComplexOuterPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/{var1}/b/{var2}/{var3}");
assertEquals("/{var1}/b/{var2}/{var3}", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/([^/]+)/b/([^/]+)/([^/]+)$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(4, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.MIDDLE_GLOB, spec.getGroup(), "Spec.group");
assertDetectedVars(spec, "var1", "var2", "var3");
assertMatches(spec, "/a/b/c/d");
assertNotMatches(spec, "/a/bc/d/e");
assertNotMatches(spec, "/a/c/d/e");
assertNotMatches(spec, "/a//d/e");
Map<String, String> mapped = spec.getPathParams("/a/b/c/d");
assertThat("Spec.pathParams", mapped, notNullValue());
assertThat("Spec.pathParams.size", mapped.size(), is(3));
assertEquals("a", mapped.get("var1"), "Spec.pathParams[var1]");
assertEquals("c", mapped.get("var2"), "Spec.pathParams[var2]");
assertEquals("d", mapped.get("var3"), "Spec.pathParams[var3]");
}
@Test
public void testTwoVarPrefixPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/a/{var1}/{var2}");
assertEquals("/a/{var1}/{var2}", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/a/([^/]+)/([^/]+)$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(3, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.PREFIX_GLOB, spec.getGroup(), "Spec.group");
assertDetectedVars(spec, "var1", "var2");
assertMatches(spec, "/a/b/c");
assertNotMatches(spec, "/a/bc");
assertNotMatches(spec, "/a/b/");
assertNotMatches(spec, "/a/b");
Map<String, String> mapped = spec.getPathParams("/a/b/c");
assertThat("Spec.pathParams", mapped, notNullValue());
assertThat("Spec.pathParams.size", mapped.size(), is(2));
assertEquals("b", mapped.get("var1"), "Spec.pathParams[var1]");
assertEquals("c", mapped.get("var2"), "Spec.pathParams[var2]");
}
@Test
public void testVarOnlyPathSpec()
{
UriTemplatePathSpec spec = new UriTemplatePathSpec("/{var1}");
assertEquals("/{var1}", spec.getDeclaration(), "Spec.pathSpec");
assertEquals("^/([^/]+)$", spec.getPattern().pattern(), "Spec.pattern");
assertEquals(1, spec.getPathDepth(), "Spec.pathDepth");
assertEquals(PathSpecGroup.PREFIX_GLOB, spec.getGroup(), "Spec.group");
assertDetectedVars(spec, "var1");
assertMatches(spec, "/a");
assertNotMatches(spec, "/");
assertNotMatches(spec, "/a/b");
assertNotMatches(spec, "/a/b/c");
Map<String, String> mapped = spec.getPathParams("/a");
assertThat("Spec.pathParams", mapped, notNullValue());
assertThat("Spec.pathParams.size", mapped.size(), is(1));
assertEquals("a", mapped.get("var1"), "Spec.pathParams[var1]");
}
@Test
public void testEquals()
{
assertThat(new UriTemplatePathSpec("/{var1}"), equalTo(new UriTemplatePathSpec("/{var1}")));
assertThat(new UriTemplatePathSpec("/{var1}"), equalTo(new UriTemplatePathSpec("/{var2}")));
assertThat(new UriTemplatePathSpec("/{var1}/{var2}"), equalTo(new UriTemplatePathSpec("/{var2}/{var1}")));
assertThat(new UriTemplatePathSpec("/{var1}"), not(equalTo(new UriTemplatePathSpec("/{var1}/{var2}"))));
assertThat(new UriTemplatePathSpec("/a/b/c"), not(equalTo(new UriTemplatePathSpec("/a/{var}/c"))));
assertThat(new UriTemplatePathSpec("/foo"), not(equalTo(new ServletPathSpec("/foo"))));
}
}
|
3e07b8c0b41aaf2bfbd82377dce7cad18ba9e258
| 430 |
java
|
Java
|
src/com/zetcode/bl/apples/concrete/BlueApple.java
|
equirosa/snake-game
|
cd7f8f2817979fc8811155bb455ad2113028022b
|
[
"BSD-2-Clause"
] | null | null | null |
src/com/zetcode/bl/apples/concrete/BlueApple.java
|
equirosa/snake-game
|
cd7f8f2817979fc8811155bb455ad2113028022b
|
[
"BSD-2-Clause"
] | null | null | null |
src/com/zetcode/bl/apples/concrete/BlueApple.java
|
equirosa/snake-game
|
cd7f8f2817979fc8811155bb455ad2113028022b
|
[
"BSD-2-Clause"
] | null | null | null | 21.5 | 90 | 0.730233 | 3,274 |
package com.zetcode.bl.apples.concrete;
import com.zetcode.bl.apples.prototype.Apple;
import javax.swing.*;
public class BlueApple extends Apple {
public BlueApple(){setPoints(2);setIcon(new ImageIcon("src/resources/apples/blue.png"));}
public BlueApple(ImageIcon icon, int points) {
super();
setIcon(icon);
setPoints(points);
}
@Override
public Apple clone() {
return new BlueApple(getIcon(), getPoints());
}
}
|
3e07b97a90c61f87b7ca9ddc5b71b263093bab95
| 2,893 |
java
|
Java
|
conjure-java-core/src/integrationInput/java/com/palantir/product/AnyExample.java
|
viktornordling/conjure-java
|
db4ff09b13fe038220c2d283a80025e6497f7163
|
[
"Apache-2.0"
] | null | null | null |
conjure-java-core/src/integrationInput/java/com/palantir/product/AnyExample.java
|
viktornordling/conjure-java
|
db4ff09b13fe038220c2d283a80025e6497f7163
|
[
"Apache-2.0"
] | null | null | null |
conjure-java-core/src/integrationInput/java/com/palantir/product/AnyExample.java
|
viktornordling/conjure-java
|
db4ff09b13fe038220c2d283a80025e6497f7163
|
[
"Apache-2.0"
] | null | null | null | 28.643564 | 107 | 0.641894 | 3,275 |
package com.palantir.product;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.palantir.conjure.java.api.errors.ErrorType;
import com.palantir.conjure.java.api.errors.ServiceException;
import com.palantir.logsafe.Preconditions;
import com.palantir.logsafe.SafeArg;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
@JsonDeserialize(builder = AnyExample.Builder.class)
@Generated("com.palantir.conjure.java.types.BeanGenerator")
public final class AnyExample {
private final Object any;
private AnyExample(Object any) {
validateFields(any);
this.any = any;
}
@JsonProperty("any")
public Object getAny() {
return this.any;
}
@Override
public boolean equals(Object other) {
return this == other || (other instanceof AnyExample && equalTo((AnyExample) other));
}
private boolean equalTo(AnyExample other) {
return this.any.equals(other.any);
}
@Override
public int hashCode() {
return Objects.hashCode(this.any);
}
@Override
public String toString() {
return "AnyExample{any: " + any + '}';
}
public static AnyExample of(Object any) {
return builder().any(any).build();
}
private static void validateFields(Object any) {
List<String> missingFields = null;
missingFields = addFieldIfMissing(missingFields, any, "any");
if (missingFields != null) {
throw new ServiceException(
ErrorType.create(ErrorType.Code.INVALID_ARGUMENT, "Error:MissingField"),
SafeArg.of("missingFields", missingFields));
}
}
private static List<String> addFieldIfMissing(List<String> prev, Object fieldValue, String fieldName) {
List<String> missingFields = prev;
if (fieldValue == null) {
if (missingFields == null) {
missingFields = new ArrayList<>(1);
}
missingFields.add(fieldName);
}
return missingFields;
}
public static Builder builder() {
return new Builder();
}
@Generated("com.palantir.conjure.java.types.BeanBuilderGenerator")
public static final class Builder {
private Object any;
private Builder() {}
public Builder from(AnyExample other) {
any(other.getAny());
return this;
}
@JsonSetter("any")
public Builder any(@Nonnull Object any) {
this.any = Preconditions.checkNotNull(any, "any cannot be null");
return this;
}
public AnyExample build() {
return new AnyExample(any);
}
}
}
|
3e07ba1277fc58f065412dbae5da2b133552bff4
| 6,240 |
java
|
Java
|
mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/itemlist/ItemListTest.java
|
guilhermejccavalcanti/mvvmFX
|
6f8ed3f92e5df381fce10dea76f8190726f8926c
|
[
"Apache-2.0"
] | 460 |
2015-01-19T16:32:11.000Z
|
2022-03-16T11:03:21.000Z
|
mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/itemlist/ItemListTest.java
|
guilhermejccavalcanti/mvvmFX
|
6f8ed3f92e5df381fce10dea76f8190726f8926c
|
[
"Apache-2.0"
] | 322 |
2015-01-04T19:56:56.000Z
|
2022-03-02T01:41:03.000Z
|
mvvmfx/src/test/java/de/saxsys/mvvmfx/utils/itemlist/ItemListTest.java
|
guilhermejccavalcanti/mvvmFX
|
6f8ed3f92e5df381fce10dea76f8190726f8926c
|
[
"Apache-2.0"
] | 148 |
2015-01-08T18:40:12.000Z
|
2022-03-14T15:26:34.000Z
| 33.548387 | 114 | 0.729327 | 3,276 |
/*******************************************************************************
* Copyright 2013 Alexander Casall
*
* 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 de.saxsys.mvvmfx.utils.itemlist;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ItemList}.
*
* @author sialcasa
*
*/
public class ItemListTest {
private static final String PERSON3_NAME = "Person3";
private static final String PREFIX = "SOME WORDS ";
// List which comes from the model and should be displayed in a view.
private ObservableList<Person> listWithModelObjects;
// Defines the mapping between model elements and view representation
private ModelToStringFunction<Person> stringMapper;
// New element which encapsulates and maps the 2 lists
private ItemList<Person> itemList;
private Person person1 = new Person("Person1");
private Person person2 = new Person("Person2");
private Person person3 = new Person(PERSON3_NAME);
/**
* Prepares the test.
*/
@BeforeEach
public void init() {
// Create the items in the model
listWithModelObjects = FXCollections.observableArrayList();
listWithModelObjects.add(person1);
listWithModelObjects.add(person2);
listWithModelObjects.add(person3);
// Create the mapper
stringMapper = new ModelToStringFunction<Person>() {
@Override
public String apply(Person object) {
return PREFIX + object.name;
}
};
itemList = new ItemList<>(listWithModelObjects, stringMapper);
}
/**
* Checks whether the mapping from the model to the string representation works.
*/
@Test
public void mapFromModelToString() {
Assertions.assertEquals(PREFIX + PERSON3_NAME, itemList
.stringListProperty().get(2));
}
/**
* Check whether the string list changes when the item list changes (add item).
*/
@Test
public void addItemToItemList() {
Assertions.assertEquals(3, itemList.stringListProperty().size());
Assertions.assertEquals(3, listWithModelObjects.size());
listWithModelObjects.add(new Person("addedPerson"));
Assertions.assertEquals(4, itemList.stringListProperty().size());
Assertions.assertEquals(4, listWithModelObjects.size());
}
/**
* Check whether the string list changes when the item list changes (remove item).
*/
@Test
public void removeItemFromItemList() {
Assertions.assertEquals(3, itemList.stringListProperty().size());
Assertions.assertEquals(3, listWithModelObjects.size());
listWithModelObjects.remove(0);
Assertions.assertEquals(2, itemList.stringListProperty().size());
Assertions.assertEquals(2, listWithModelObjects.size());
}
@Test
public void removeMultipleItemsFromItemList() {
listWithModelObjects.removeAll(person1, person2);
Assertions.assertEquals(1, listWithModelObjects.size());
Assertions.assertEquals(1, itemList.stringListProperty().size());
Assertions.assertEquals(person3, listWithModelObjects.get(0));
Assertions.assertEquals(PREFIX + PERSON3_NAME, itemList
.stringListProperty().get(0));
}
@Test
public void removeAllItemsFromItemList() {
listWithModelObjects.clear();
Assertions.assertEquals(0, listWithModelObjects.size());
Assertions.assertEquals(0, itemList.stringListProperty().size());
}
@Test
public void addItemToItemListAtIndex() {
listWithModelObjects.add(1, new Person("addedPerson"));
Assertions.assertEquals(4, itemList.stringListProperty().size());
Assertions.assertEquals(4, listWithModelObjects.size());
Assertions.assertEquals(PREFIX + "addedPerson", itemList
.stringListProperty().get(1));
}
@Test
public void addMultipleItemsToItemList() {
listWithModelObjects.addAll(new Person("added1"), new Person("added2"));
Assertions.assertEquals(5, listWithModelObjects.size());
Assertions.assertEquals(5, itemList.stringListProperty().size());
Assertions.assertEquals(PREFIX + "added1", itemList.stringListProperty()
.get(3));
Assertions.assertEquals(PREFIX + "added2", itemList.stringListProperty()
.get(4));
}
@Test
public void replaceItemInItemListAtIndex() {
listWithModelObjects.set(1, new Person("replacedPerson"));
Assertions.assertEquals(3, listWithModelObjects.size());
Assertions.assertEquals(3, itemList.stringListProperty().size());
Assertions.assertEquals(PREFIX + "replacedPerson", itemList
.stringListProperty().get(1));
}
/**
* This test is used to reproduce the bug <a href="https://github.com/sialcasa/mvvmFX/issues/281">#281</a>.
*
* When multiple elements are added to the list in a single method call ({@link ObservableList#addAll(Object[])},
* only a single change event should be fired.
*/
@Test
public void addMultipleItemsEventListener() {
AtomicInteger counter = new AtomicInteger(0);
itemList.getTargetList().addListener((ListChangeListener<String>) c -> {
counter.incrementAndGet();
});
listWithModelObjects.addAll(new Person("one"), new Person("two"), new Person("three"));
assertThat(counter.get()).isEqualTo(1);
}
@Test
public void removeMultipleItemsEventListener() {
AtomicInteger counter = new AtomicInteger(0);
itemList.getTargetList().addListener((ListChangeListener<String>) c -> {
counter.incrementAndGet();
});
listWithModelObjects.removeAll(person1, person3);
assertThat(counter.get()).isEqualTo(1);
}
}
|
3e07bc3c869c121eed3b25293c04c29313a47983
| 1,306 |
java
|
Java
|
demo/demo-calculator/src/main/java/io/github/legion2/demo_calculator/DemoCalculator.java
|
Legion2/external-service-injection
|
c353f55ab9f8f2650801458e4e758ccd88bdb88d
|
[
"Apache-2.0"
] | null | null | null |
demo/demo-calculator/src/main/java/io/github/legion2/demo_calculator/DemoCalculator.java
|
Legion2/external-service-injection
|
c353f55ab9f8f2650801458e4e758ccd88bdb88d
|
[
"Apache-2.0"
] | null | null | null |
demo/demo-calculator/src/main/java/io/github/legion2/demo_calculator/DemoCalculator.java
|
Legion2/external-service-injection
|
c353f55ab9f8f2650801458e4e758ccd88bdb88d
|
[
"Apache-2.0"
] | 1 |
2020-08-06T02:30:55.000Z
|
2020-08-06T02:30:55.000Z
| 34.368421 | 75 | 0.742726 | 3,277 |
/*
* Copyright 2019 Leon Kiefer
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.legion2.demo_calculator;
import io.github.amyassist.amy.core.di.annotation.Reference;
import io.github.legion2.calculator.Calculator;
import io.github.legion2.service_injection_bootstrap.InitComponent;
import io.github.legion2.service_injection_bootstrap.annotations.Init;
@Init
public class DemoCalculator implements InitComponent {
@Reference
private Calculator calculator;
@Override
public void init() {
System.out.printf("17 + 42 = %s%n", this.calculator.add(17, 42));
System.out.printf("17 - 42 = %s%n", this.calculator.sub(17, 42));
System.out.printf("17 * 42 = %s%n", this.calculator.mul(17, 42));
System.out.printf("17 / 42 = %s%n", this.calculator.div(17, 42));
}
}
|
3e07bc4ceb8dc86c4d4b964af385f6d370017fe3
| 6,174 |
java
|
Java
|
erp_desktop_all/src/com/bydan/framework/erp/util/FuncionesNetwork.java
|
jarocho105/pre2
|
f032fc63741b6deecdfee490e23dfa9ef1f42b4f
|
[
"Apache-2.0"
] | 1 |
2018-01-05T17:50:03.000Z
|
2018-01-05T17:50:03.000Z
|
erp_desktop_all/src/com/bydan/framework/erp/util/FuncionesNetwork.java
|
jarocho105/pre2
|
f032fc63741b6deecdfee490e23dfa9ef1f42b4f
|
[
"Apache-2.0"
] | null | null | null |
erp_desktop_all/src/com/bydan/framework/erp/util/FuncionesNetwork.java
|
jarocho105/pre2
|
f032fc63741b6deecdfee490e23dfa9ef1f42b4f
|
[
"Apache-2.0"
] | null | null | null | 30.564356 | 118 | 0.647878 | 3,278 |
package com.bydan.framework.erp.util;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import javax.activation.DataHandler;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.bydan.erp.seguridad.business.entity.Modulo;
import com.bydan.erp.seguridad.business.entity.ParametroGeneralSg;
import com.bydan.erp.seguridad.business.entity.ParametroGeneralUsuario;
import com.bydan.erp.seguridad.business.entity.Usuario;
import com.bydan.framework.erp.business.entity.Classe;
import com.bydan.framework.erp.business.entity.LogHtmlFormatter;
import com.bydan.framework.erp.business.entity.GeneralEntity;
import com.bydan.framework.erp.business.entity.Reporte;
import com.bydan.framework.erp.business.logic.ParameterSelectionGeneral;
import com.bydan.framework.erp.business.logic.QueryWhereSelectParameters;
@SuppressWarnings("unused")
public class FuncionesNetwork {
public static String getPrimerMacAddress() throws Exception {
//String sPrimerMacAddress=FuncionesNetwork.getPrimerMacAddressBase(true,false);
String sPrimerMacAddress=FuncionesNetwork.getPrimerMacAddressBase(false,false);
return sPrimerMacAddress;
}
public static String getTodosMacAddress() throws Exception {
String sPrimerMacAddress=FuncionesNetwork.getPrimerMacAddressBase(false,true);
return sPrimerMacAddress;
}
public static String getPrimerMacAddressBase(Boolean esDefecto,Boolean conTodosMac) throws Exception {
String sPrimerMacAddress="NONE";
StringBuilder stringBuilder = new StringBuilder();
Boolean esPrimero=true;
try {
if(esDefecto) {
InetAddress inetAddress=null;
inetAddress = InetAddress.getLocalHost();
NetworkInterface networkInterface = NetworkInterface.getByInetAddress(inetAddress);
byte[] macAddress = networkInterface.getHardwareAddress();
//byte[] macAddress =inetAddress.getAddress();
if(macAddress != null) {
for (int i = 0; i < macAddress.length; i++) {
stringBuilder.append(String.format("%02X%s", macAddress[i], (i < macAddress.length - 1) ? "-" : ""));
}
}
sPrimerMacAddress=stringBuilder.toString();
} else {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
List<InterfaceAddress> interfaceAddresses = networkInterface.getInterfaceAddresses();
Iterator<InterfaceAddress> interfaceAddressIterator = interfaceAddresses.iterator();
//NO ESTA FUNCIONANDO O ES VIRTUAL
if(!networkInterface.isUp() || networkInterface.isVirtual()
|| networkInterface.isPointToPoint() || networkInterface.isLoopback()) {
continue;
}
while (interfaceAddressIterator.hasNext()) {
InterfaceAddress interfaceAddress = interfaceAddressIterator.next();
InetAddress inetAddress=interfaceAddress.getAddress();
stringBuilder = new StringBuilder();
byte[] macAddress = networkInterface.getHardwareAddress();
//byte[] macAddress =inetAddress.getAddress();
if(macAddress != null) {
for (int i = 0; i < macAddress.length; i++) {
stringBuilder.append(String.format("%02X%s", macAddress[i], (i < macAddress.length - 1) ? "-" : ""));
}
}
if(!conTodosMac) {
sPrimerMacAddress=stringBuilder.toString();
break;
} else {
if(!esPrimero) {
sPrimerMacAddress+=",";
} else {
sPrimerMacAddress="";
}
sPrimerMacAddress+=stringBuilder.toString();
if(esPrimero) {
esPrimero=false;
}
}
}//WHILE
if(!conTodosMac) {
break;
}
}
}
} catch(Exception e) {
e.printStackTrace();
}
return sPrimerMacAddress;
}
public static String getHostName() throws Exception {
String sHostname = "NONE";
try {
InetAddress inetAddress=null;
inetAddress = InetAddress.getLocalHost();
sHostname = inetAddress.getHostName();
} catch(Exception e) {
e.printStackTrace();
}
return sHostname;
}
public static String getHostIp() throws Exception {
String sHostname = "NONE";
try {
InetAddress inetAddress=null;
inetAddress = InetAddress.getLocalHost();
sHostname = inetAddress.getHostAddress();
} catch(Exception e) {
e.printStackTrace();
}
return sHostname;
}
public static String getHostUser() throws Exception {
String sHostname = "NONE";
try {
sHostname=System.getProperty("user.name");
} catch(Exception e) {
e.printStackTrace();
}
return sHostname;
}
}
|
3e07bc7d0d59a11cbd8eb244fbd0528a80a144d4
| 4,281 |
java
|
Java
|
src/gen/java/com/hevelian/identity/client/model/AddRemoveUserRolesRequestDTO.java
|
Hevelian/hevelian-identity-client
|
62f4639cf91a7e3896fbf2439e85d70b801132bf
|
[
"Apache-2.0"
] | null | null | null |
src/gen/java/com/hevelian/identity/client/model/AddRemoveUserRolesRequestDTO.java
|
Hevelian/hevelian-identity-client
|
62f4639cf91a7e3896fbf2439e85d70b801132bf
|
[
"Apache-2.0"
] | null | null | null |
src/gen/java/com/hevelian/identity/client/model/AddRemoveUserRolesRequestDTO.java
|
Hevelian/hevelian-identity-client
|
62f4639cf91a7e3896fbf2439e85d70b801132bf
|
[
"Apache-2.0"
] | null | null | null | 27.094937 | 131 | 0.698669 | 3,279 |
/**
* Api Documentation
* Api Documentation
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* 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.hevelian.identity.client.model;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* AddRemoveUserRolesRequestDTO
*/
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-11-21T06:58:56.984+01:00")
public class AddRemoveUserRolesRequestDTO {
@SerializedName("name")
private String name = null;
@SerializedName("newRoles")
private List<String> newRoles = new ArrayList<String>();
@SerializedName("removedRoles")
private List<String> removedRoles = new ArrayList<String>();
public AddRemoveUserRolesRequestDTO name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@ApiModelProperty(example = "null", value = "")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public AddRemoveUserRolesRequestDTO newRoles(List<String> newRoles) {
this.newRoles = newRoles;
return this;
}
public AddRemoveUserRolesRequestDTO addNewRolesItem(String newRolesItem) {
this.newRoles.add(newRolesItem);
return this;
}
/**
* Get newRoles
* @return newRoles
**/
@ApiModelProperty(example = "null", value = "")
public List<String> getNewRoles() {
return newRoles;
}
public void setNewRoles(List<String> newRoles) {
this.newRoles = newRoles;
}
public AddRemoveUserRolesRequestDTO removedRoles(List<String> removedRoles) {
this.removedRoles = removedRoles;
return this;
}
public AddRemoveUserRolesRequestDTO addRemovedRolesItem(String removedRolesItem) {
this.removedRoles.add(removedRolesItem);
return this;
}
/**
* Get removedRoles
* @return removedRoles
**/
@ApiModelProperty(example = "null", value = "")
public List<String> getRemovedRoles() {
return removedRoles;
}
public void setRemovedRoles(List<String> removedRoles) {
this.removedRoles = removedRoles;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AddRemoveUserRolesRequestDTO addRemoveUserRolesRequestDTO = (AddRemoveUserRolesRequestDTO) o;
return Objects.equals(this.name, addRemoveUserRolesRequestDTO.name) &&
Objects.equals(this.newRoles, addRemoveUserRolesRequestDTO.newRoles) &&
Objects.equals(this.removedRoles, addRemoveUserRolesRequestDTO.removedRoles);
}
@Override
public int hashCode() {
return Objects.hash(name, newRoles, removedRoles);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AddRemoveUserRolesRequestDTO {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" newRoles: ").append(toIndentedString(newRoles)).append("\n");
sb.append(" removedRoles: ").append(toIndentedString(removedRoles)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
3e07bd49657164c841815bc85909b19854259282
| 5,081 |
java
|
Java
|
modules/core/shipping/provider/dhl/src/com/dhl/datatypes_ea/ExportLineItem.java
|
geetools/geeCommerce-Java-Shop-Software
|
48823ccf012d7a1f11a5bf7b99619a67805984f4
|
[
"Apache-2.0"
] | 9 |
2016-11-24T11:41:02.000Z
|
2020-04-22T02:43:51.000Z
|
modules/core/shipping/provider/dhl/src/com/dhl/datatypes_ea/ExportLineItem.java
|
geetools/geeCommerce-Java-Shop-Software
|
48823ccf012d7a1f11a5bf7b99619a67805984f4
|
[
"Apache-2.0"
] | null | null | null |
modules/core/shipping/provider/dhl/src/com/dhl/datatypes_ea/ExportLineItem.java
|
geetools/geeCommerce-Java-Shop-Software
|
48823ccf012d7a1f11a5bf7b99619a67805984f4
|
[
"Apache-2.0"
] | 2 |
2020-03-28T09:23:32.000Z
|
2020-10-02T13:58:57.000Z
| 25.923469 | 113 | 0.60126 | 3,280 |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
// 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.11.20 at 05:07:03 PM MSK
//
package com.dhl.datatypes_ea;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>
* Java class for ExportLineItem complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* <complexType name="ExportLineItem">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="LineNumber" type="{http://www.dhl.com/datatypes_EA}LineNumber"/>
* <element name="Quantity" type="{http://www.dhl.com/datatypes_EA}Quantity"/>
* <element name="QuantityUnit" type="{http://www.dhl.com/datatypes_EA}QuantityUnit"/>
* <element name="Description" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Value" type="{http://www.w3.org/2001/XMLSchema}float"/>
* <element name="IsDomestic" type="{http://www.dhl.com/datatypes_EA}YesNo" minOccurs="0"/>
* <element name="CommodityCode" type="{http://www.dhl.com/datatypes_EA}CommodityCode" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ExportLineItem", propOrder = { "lineNumber", "quantity", "quantityUnit", "description", "value",
"isDomestic", "commodityCode" })
public class ExportLineItem {
@XmlElement(name = "LineNumber")
protected int lineNumber;
@XmlElement(name = "Quantity")
protected int quantity;
@XmlElement(name = "QuantityUnit", required = true)
protected String quantityUnit;
@XmlElement(name = "Description", required = true)
protected String description;
@XmlElement(name = "Value")
protected float value;
@XmlElement(name = "IsDomestic")
protected YesNo isDomestic;
@XmlElement(name = "CommodityCode")
protected String commodityCode;
/**
* Gets the value of the lineNumber property.
*
*/
public int getLineNumber() {
return lineNumber;
}
/**
* Sets the value of the lineNumber property.
*
*/
public void setLineNumber(int value) {
this.lineNumber = value;
}
/**
* Gets the value of the quantity property.
*
*/
public int getQuantity() {
return quantity;
}
/**
* Sets the value of the quantity property.
*
*/
public void setQuantity(int value) {
this.quantity = value;
}
/**
* Gets the value of the quantityUnit property.
*
* @return possible object is {@link String }
*
*/
public String getQuantityUnit() {
return quantityUnit;
}
/**
* Sets the value of the quantityUnit property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setQuantityUnit(String value) {
this.quantityUnit = value;
}
/**
* Gets the value of the description property.
*
* @return possible object is {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the value property.
*
*/
public float getValue() {
return value;
}
/**
* Sets the value of the value property.
*
*/
public void setValue(float value) {
this.value = value;
}
/**
* Gets the value of the isDomestic property.
*
* @return possible object is {@link YesNo }
*
*/
public YesNo getIsDomestic() {
return isDomestic;
}
/**
* Sets the value of the isDomestic property.
*
* @param value
* allowed object is {@link YesNo }
*
*/
public void setIsDomestic(YesNo value) {
this.isDomestic = value;
}
/**
* Gets the value of the commodityCode property.
*
* @return possible object is {@link String }
*
*/
public String getCommodityCode() {
return commodityCode;
}
/**
* Sets the value of the commodityCode property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setCommodityCode(String value) {
this.commodityCode = value;
}
}
|
3e07bde4f8d3b33ad82874bd1bd3e40e75f75bc9
| 4,055 |
java
|
Java
|
facade/src/main/java/net/jlxxw/apicenter/facade/utils/ZookeeperUtils.java
|
lcy19930619/api-center
|
6ff58b03355d4ffd459ad7e0d2057be286586dd8
|
[
"Apache-2.0"
] | 7 |
2020-12-11T07:35:41.000Z
|
2021-11-02T02:00:11.000Z
|
facade/src/main/java/net/jlxxw/apicenter/facade/utils/ZookeeperUtils.java
|
lcy19930619/api-center
|
6ff58b03355d4ffd459ad7e0d2057be286586dd8
|
[
"Apache-2.0"
] | null | null | null |
facade/src/main/java/net/jlxxw/apicenter/facade/utils/ZookeeperUtils.java
|
lcy19930619/api-center
|
6ff58b03355d4ffd459ad7e0d2057be286586dd8
|
[
"Apache-2.0"
] | null | null | null | 31.679688 | 139 | 0.667078 | 3,281 |
package net.jlxxw.apicenter.facade.utils;
import net.jlxxw.apicenter.facade.exception.ApiCenterException;
import net.jlxxw.apicenter.facade.properties.ApiCenterClientProperties;
import net.jlxxw.apicenter.facade.watcher.ZookeeperWatcher;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
/**
* @author zhanxiumei
* @Description:
* @date: 2020/10/16 13:51
*/
@Component
public class ZookeeperUtils {
private static final Logger logger = LoggerFactory.getLogger(ZookeeperUtils.class);
private ZooKeeper zooKeeper = null;
private ZookeeperWatcher zookeeperWatcher = null;
private ZookeeperUtils(ApiCenterClientProperties apiCenterClientProperties) throws IOException {
zookeeperWatcher = new ZookeeperWatcher(apiCenterClientProperties,this);
zooKeeper = new ZooKeeper(apiCenterClientProperties.getZookeeperHosts(), apiCenterClientProperties.getTimeout(), zookeeperWatcher);
}
/**
* 创建一个开放权限的永久节点
* @param node 节点
* @param data 数据
*/
public void createOpenACLPersistentNode(String node, byte[] data) throws ApiCenterException {
try {
zooKeeper.create(node, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}catch (Exception e){
logger.error("zookeeper error :",e);
throw new ApiCenterException(e.getMessage());
}
}
/**
* 判断节点是否存在
* @param node 节点
* @return true 存在,false 不存在
* @throws ApiCenterException 自定义异常
*/
public Boolean existsNode(String node) throws ApiCenterException {
try {
return Objects.nonNull(zooKeeper.exists(node, zookeeperWatcher));
}catch (Exception e){
logger.error("zookeeper error :",e);
throw new ApiCenterException(e.getMessage());
}
}
/**
* 创建一个开放权限的临时节点
* @param node 节点
* @param data 数据
* @throws ApiCenterException 自定义异常
*/
public void createOpenACLEphemeralNode(String node, byte[] data) throws ApiCenterException {
try {
zooKeeper.create(node,data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
}catch (Exception e){
logger.error("zookeeper error :",e);
throw new ApiCenterException(e.getMessage());
}
}
/**
* 查询指定节点下的全部子节点
* @param parentNode 父节点
* @throws ApiCenterException 自定义异常
*/
public List<String> listChildrenNodes(String parentNode) throws ApiCenterException {
try {
return zooKeeper.getChildren(parentNode,null);
}catch (Exception e){
logger.error("zookeeper error :",e);
throw new ApiCenterException(e.getMessage());
}
}
/**
* 获取指定节点的数据
* @param node 节点(如果是zookeeper,则需要完整路径,例如:/parentNode/childNode)
* @throws ApiCenterException 自定义异常
* @return
*/
public byte[] getNodeData(String node) throws ApiCenterException {
try {
return zooKeeper.getData(node, false, new Stat());
}catch (Exception e){
logger.error("zookeeper error :",e);
throw new ApiCenterException(e.getMessage());
}
}
/**
* 添加监听器
* @param watcher
*/
public void addWatcher(Watcher watcher){
try {
zooKeeper.register( watcher );
}catch (Exception e){
logger.error("zookeeper error :",e);
throw new ApiCenterException(e.getMessage());
}
}
public void resetConnection(ApiCenterClientProperties apiCenterClientProperties) throws IOException {
zooKeeper = new ZooKeeper(apiCenterClientProperties.getZookeeperHosts(), apiCenterClientProperties.getTimeout(), zookeeperWatcher);
}
}
|
3e07be7b082e740d1106ac943f57682d53612178
| 330 |
java
|
Java
|
demo8/src/main/java/com/example/demo8/bean/Accommodation.java
|
JeffrayZ/Dagger2Demo
|
98e33da8df6f4e93868fbefa0f2feca5dd8afe1e
|
[
"Apache-2.0"
] | 1 |
2020-05-11T06:22:31.000Z
|
2020-05-11T06:22:31.000Z
|
demo8/src/main/java/com/example/demo8/bean/Accommodation.java
|
JeffrayZ/Dagger2Demo
|
98e33da8df6f4e93868fbefa0f2feca5dd8afe1e
|
[
"Apache-2.0"
] | null | null | null |
demo8/src/main/java/com/example/demo8/bean/Accommodation.java
|
JeffrayZ/Dagger2Demo
|
98e33da8df6f4e93868fbefa0f2feca5dd8afe1e
|
[
"Apache-2.0"
] | null | null | null | 19.411765 | 31 | 0.687879 | 3,282 |
package com.example.demo8.bean;
/**
* @ProjectName: Dagger2Demo
* @Package: com.example.demo8
* @ClassName: Accommodation
* @Description: java类作用描述
* @Author: Jeffray
* @CreateDate: 2020/5/6 18:45
* @UpdateUser: 更新者
* @UpdateDate: 2020/5/6 18:45
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
public class Accommodation {
}
|
3e07bea6fc52a8d7b5b70ccccaec3a7db563a501
| 868 |
java
|
Java
|
src/ethos/model/players/combat/effects/TridentOfTheSwampEffect.java
|
SkynSSL/Server
|
9eda672770dcda83989d668c3cd89ad60a4f72bc
|
[
"MIT"
] | null | null | null |
src/ethos/model/players/combat/effects/TridentOfTheSwampEffect.java
|
SkynSSL/Server
|
9eda672770dcda83989d668c3cd89ad60a4f72bc
|
[
"MIT"
] | null | null | null |
src/ethos/model/players/combat/effects/TridentOfTheSwampEffect.java
|
SkynSSL/Server
|
9eda672770dcda83989d668c3cd89ad60a4f72bc
|
[
"MIT"
] | null | null | null | 28.933333 | 100 | 0.785714 | 3,283 |
package ethos.model.players.combat.effects;
import java.util.Optional;
import ethos.model.entity.HealthStatus;
import ethos.model.npcs.NPC;
import ethos.model.players.Player;
import ethos.model.players.combat.Damage;
import ethos.model.players.combat.DamageEffect;
import ethos.util.Misc;
public class TridentOfTheSwampEffect implements DamageEffect {
@Override
public void execute(Player attacker, Player defender, Damage damage) {
defender.getHealth().proposeStatus(HealthStatus.VENOM, damage.getAmount(), Optional.of(attacker));
}
@Override
public void execute(Player attacker, NPC defender, Damage damage) {
defender.getHealth().proposeStatus(HealthStatus.VENOM, damage.getAmount(), Optional.of(attacker));
}
@Override
public boolean isExecutable(Player operator) {
return operator.getItems().isWearingItem(12899) && Misc.random(3) == 0;
}
}
|
3e07bf634df0879ad355bb1e941d8a8219d63a97
| 360 |
java
|
Java
|
Java/EncryptCredentials/src/main/java/com/encryptcredentialsample/encryptcredential/models/Gateway.java
|
tenshi13/PowerBI-Developer-Samples
|
a6a9da1a90b685655c461c73c0d7b509d5a7e228
|
[
"MIT"
] | 2 |
2021-10-10T17:38:35.000Z
|
2021-11-17T10:30:18.000Z
|
Java/EncryptCredentials/src/main/java/com/encryptcredentialsample/encryptcredential/models/Gateway.java
|
tenshi13/PowerBI-Developer-Samples
|
a6a9da1a90b685655c461c73c0d7b509d5a7e228
|
[
"MIT"
] | null | null | null |
Java/EncryptCredentials/src/main/java/com/encryptcredentialsample/encryptcredential/models/Gateway.java
|
tenshi13/PowerBI-Developer-Samples
|
a6a9da1a90b685655c461c73c0d7b509d5a7e228
|
[
"MIT"
] | null | null | null | 32.727273 | 79 | 0.447222 | 3,284 |
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// ----------------------------------------------------------------------------
package com.encryptcredentialsample.encryptcredential.models;
public class Gateway {
public GatewayPublicKey publicKey;
}
|
3e07c09d4bc8dd06516b8070df4f81f38b36fe21
| 1,488 |
java
|
Java
|
qinsql-main/src/test/java/com/facebook/presto/operator/aggregation/TestApproximateCountDistinctLong.java
|
codefollower/QinSQL
|
d85650206b3d2d7374520d344e4745fe1847b2a5
|
[
"Apache-2.0"
] | 9,782 |
2016-03-18T15:16:19.000Z
|
2022-03-31T07:49:41.000Z
|
qinsql-main/src/test/java/com/facebook/presto/operator/aggregation/TestApproximateCountDistinctLong.java
|
codefollower/QinSQL
|
d85650206b3d2d7374520d344e4745fe1847b2a5
|
[
"Apache-2.0"
] | 10,310 |
2016-03-18T01:03:00.000Z
|
2022-03-31T23:54:08.000Z
|
qinsql-main/src/test/java/com/facebook/presto/operator/aggregation/TestApproximateCountDistinctLong.java
|
codefollower/QinSQL
|
d85650206b3d2d7374520d344e4745fe1847b2a5
|
[
"Apache-2.0"
] | 3,803 |
2016-03-18T22:54:24.000Z
|
2022-03-31T07:49:46.000Z
| 32.347826 | 104 | 0.750672 | 3,285 |
/*
* 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.facebook.presto.operator.aggregation;
import com.facebook.presto.common.type.Type;
import java.util.concurrent.ThreadLocalRandom;
import static com.facebook.presto.common.type.BigintType.BIGINT;
import static com.facebook.presto.common.type.DoubleType.DOUBLE;
import static com.facebook.presto.sql.analyzer.TypeSignatureProvider.fromTypes;
public class TestApproximateCountDistinctLong
extends AbstractTestApproximateCountDistinct
{
@Override
public InternalAggregationFunction getAggregationFunction()
{
return FUNCTION_AND_TYPE_MANAGER.getAggregateFunctionImplementation(
FUNCTION_AND_TYPE_MANAGER.lookupFunction("approx_distinct", fromTypes(BIGINT, DOUBLE)));
}
@Override
public Type getValueType()
{
return BIGINT;
}
@Override
public Object randomValue()
{
return ThreadLocalRandom.current().nextLong();
}
}
|
3e07c0dd8bb1d5e0d591ada634fcead6694e9ae8
| 5,347 |
java
|
Java
|
blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceImportXSDsBetweenNamespaceHandlersTest.java
|
gnodet/aries
|
6bc40b560d280f3b6ab3e144acbca043e997c6b5
|
[
"Apache-2.0"
] | 1 |
2022-01-21T11:37:06.000Z
|
2022-01-21T11:37:06.000Z
|
blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceImportXSDsBetweenNamespaceHandlersTest.java
|
gnodet/aries
|
6bc40b560d280f3b6ab3e144acbca043e997c6b5
|
[
"Apache-2.0"
] | null | null | null |
blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceImportXSDsBetweenNamespaceHandlersTest.java
|
gnodet/aries
|
6bc40b560d280f3b6ab3e144acbca043e997c6b5
|
[
"Apache-2.0"
] | null | null | null | 51.413462 | 122 | 0.695156 | 3,286 |
/**
* 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.aries.blueprint.itests;
import java.io.InputStream;
import java.net.URL;
import org.apache.aries.blueprint.ComponentDefinitionRegistry;
import org.apache.aries.blueprint.itests.cm.handler.Aries1503aNamespaceHandler;
import org.apache.aries.blueprint.itests.cm.handler.Aries1503bNamespaceHandler;
import org.apache.aries.blueprint.services.ParserService;
import org.junit.Test;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.tinybundles.core.TinyBundles;
import org.osgi.framework.Constants;
import static org.apache.aries.blueprint.itests.Helper.blueprintBundles;
import static org.junit.Assert.assertNotNull;
import static org.ops4j.pax.exam.CoreOptions.*;
public class ParserServiceImportXSDsBetweenNamespaceHandlersTest extends AbstractBlueprintIntegrationTest {
private static final String NS_HANDLER_BUNDLE = "org.apache.aries.blueprint.aries1503";
private static final String NS_HANDLER2_BUNDLE = "org.apache.aries.blueprint.aries1503b";
private static final String TEST_BUNDLE = "org.apache.aries.blueprint.aries1503.test";
@org.ops4j.pax.exam.Configuration
public Option[] config() {
return new Option[] {
baseOptions(),
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
blueprintBundles(),
keepCaches(),
streamBundle(createAries1503aNamespaceHandlerBundle()).noStart(),
streamBundle(createAries1503bNamespaceHandlerBundle()),
streamBundle(createTestBundle())
};
}
private InputStream createAries1503aNamespaceHandlerBundle() {
return TinyBundles.bundle()
.add(Aries1503aNamespaceHandler.class)
.add("OSGI-INF/blueprint/blueprint-aries-1503.xml", getResource("blueprint-aries-1503.xml"))
.add("blueprint-aries-1503.xsd", getResource("blueprint-aries-1503.xsd"))
.set(Constants.BUNDLE_SYMBOLICNAME, NS_HANDLER_BUNDLE)
.set(Constants.EXPORT_PACKAGE, Aries1503aNamespaceHandler.class.getPackage().getName())
.set(Constants.IMPORT_PACKAGE, "org.apache.aries.blueprint,org.apache.aries.blueprint.ext," +
"org.apache.aries.blueprint.mutable," +
"org.osgi.service.blueprint.reflect,org.w3c.dom")
.build(TinyBundles.withBnd());
}
private InputStream createAries1503bNamespaceHandlerBundle() {
return TinyBundles.bundle()
.add(Aries1503bNamespaceHandler.class)
// add this class too - we don't want to play with split packages, etc.
.add(Aries1503aNamespaceHandler.class)
.add("OSGI-INF/blueprint/blueprint-aries-1503-2.xml", getResource("blueprint-aries-1503-2.xml"))
.add("blueprint-aries-1503-2.xsd", getResource("blueprint-aries-1503-2.xsd"))
.add("blueprint-aries-1503.xsd", getResource("blueprint-aries-1503.xsd"))
.set(Constants.BUNDLE_SYMBOLICNAME, NS_HANDLER2_BUNDLE)
.set(Constants.EXPORT_PACKAGE, Aries1503bNamespaceHandler.class.getPackage().getName())
.set(Constants.IMPORT_PACKAGE, "org.apache.aries.blueprint,org.apache.aries.blueprint.ext," +
"org.apache.aries.blueprint.mutable," +
"org.osgi.service.blueprint.reflect,org.w3c.dom," +
Aries1503bNamespaceHandler.class.getPackage().getName())
.build(TinyBundles.withBnd());
}
private InputStream createTestBundle() {
return TinyBundles.bundle()
.add("OSGI-INF/blueprint/ImportNamespacesTest.xml", getResource("ImportNamespacesTest.xml"))
.set(Constants.BUNDLE_SYMBOLICNAME, TEST_BUNDLE)
.set(Constants.IMPORT_PACKAGE, Aries1503bNamespaceHandler.class.getPackage().getName()
+ ",org.apache.aries.blueprint,org.apache.aries.blueprint.ext")
.build(TinyBundles.withBnd());
}
@Test
public void testXSDImports() throws Exception {
ParserService parserService = context().getService(ParserService.class);
URL blueprintXML = context().getBundleByName(TEST_BUNDLE).getEntry("OSGI-INF/blueprint/ImportNamespacesTest.xml");
ComponentDefinitionRegistry cdr = parserService.parse(blueprintXML, context().getBundleByName(TEST_BUNDLE));
assertNotNull(cdr.getComponentDefinition("aries-1503"));
}
}
|
3e07c1593bda7ac095e44b3d9de573b64ae97b45
| 241 |
java
|
Java
|
oa/oa/src/test/java/com/xiaofeng/oa/utils/MD5UtilsTest.java
|
xiaofengrong/demo
|
bf928df362b06d8b11a94fc7fc9bfb5fb67ea2b8
|
[
"Apache-2.0"
] | 1 |
2021-07-16T17:29:10.000Z
|
2021-07-16T17:29:10.000Z
|
oa/oa/src/test/java/com/xiaofeng/oa/utils/MD5UtilsTest.java
|
xiaofengrong/demo
|
bf928df362b06d8b11a94fc7fc9bfb5fb67ea2b8
|
[
"Apache-2.0"
] | null | null | null |
oa/oa/src/test/java/com/xiaofeng/oa/utils/MD5UtilsTest.java
|
xiaofengrong/demo
|
bf928df362b06d8b11a94fc7fc9bfb5fb67ea2b8
|
[
"Apache-2.0"
] | 1 |
2021-01-14T03:45:42.000Z
|
2021-01-14T03:45:42.000Z
| 21.909091 | 55 | 0.717842 | 3,287 |
package com.xiaofeng.oa.utils;
import junit.framework.TestCase;
import org.junit.Test;
public class MD5UtilsTest extends TestCase {
@Test
public void testMd5Digest() {
System.out.println(MD5Utils.md5Digest("test"));
}
}
|
3e07c27cadd039675db8836cddf8c1ccea120d20
| 8,993 |
java
|
Java
|
drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/builder/generator/expression/AbstractExpressionBuilder.java
|
barboras7/drools
|
3d17f6349b196835bb258eeb54fd67343fb61307
|
[
"Apache-2.0"
] | null | null | null |
drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/builder/generator/expression/AbstractExpressionBuilder.java
|
barboras7/drools
|
3d17f6349b196835bb258eeb54fd67343fb61307
|
[
"Apache-2.0"
] | null | null | null |
drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/builder/generator/expression/AbstractExpressionBuilder.java
|
barboras7/drools
|
3d17f6349b196835bb258eeb54fd67343fb61307
|
[
"Apache-2.0"
] | null | null | null | 51.096591 | 214 | 0.738908 | 3,288 |
/*
* Copyright 2005 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.modelcompiler.builder.generator.expression;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import org.drools.javaparser.ast.body.Parameter;
import org.drools.javaparser.ast.expr.BigDecimalLiteralExpr;
import org.drools.javaparser.ast.expr.BigIntegerLiteralExpr;
import org.drools.javaparser.ast.expr.EnclosedExpr;
import org.drools.javaparser.ast.expr.Expression;
import org.drools.javaparser.ast.expr.FieldAccessExpr;
import org.drools.javaparser.ast.expr.LambdaExpr;
import org.drools.javaparser.ast.expr.LiteralExpr;
import org.drools.javaparser.ast.expr.MethodCallExpr;
import org.drools.javaparser.ast.expr.NameExpr;
import org.drools.javaparser.ast.expr.StringLiteralExpr;
import org.drools.javaparser.ast.stmt.ExpressionStmt;
import org.drools.javaparser.ast.type.UnknownType;
import org.drools.modelcompiler.builder.generator.DeclarationSpec;
import org.drools.modelcompiler.builder.generator.DrlxParseUtil;
import org.drools.modelcompiler.builder.generator.IndexIdGenerator;
import org.drools.modelcompiler.builder.generator.RuleContext;
import org.drools.modelcompiler.builder.generator.TypedExpression;
import org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess;
import static org.drools.modelcompiler.builder.generator.DrlxParseUtil.generateLambdaWithoutParameters;
import static org.drools.modelcompiler.builder.generator.DrlxParseUtil.toNewBigDecimalExpr;
import static org.drools.modelcompiler.builder.generator.DrlxParseUtil.toNewBigIntegerExpr;
public abstract class AbstractExpressionBuilder {
protected static final IndexIdGenerator indexIdGenerator = new IndexIdGenerator();
protected RuleContext context;
protected AbstractExpressionBuilder( RuleContext context ) {
this.context = context;
}
public void processExpression(DrlxParseSuccess drlxParseResult) {
if (drlxParseResult.hasUnificationVariable()) {
Expression dslExpr = buildUnificationExpression(drlxParseResult);
context.addExpression(dslExpr);
} else if ( drlxParseResult.isValidExpression() ) {
Expression dslExpr = buildExpressionWithIndexing(drlxParseResult);
context.addExpression(dslExpr);
}
if (drlxParseResult.getExprBinding() != null) {
Expression dslExpr = buildBinding(drlxParseResult);
context.addExpression(dslExpr);
}
}
private Expression buildUnificationExpression(DrlxParseSuccess drlxParseResult) {
MethodCallExpr exprDSL = buildBinding(drlxParseResult);
context.addDeclaration(new DeclarationSpec(drlxParseResult.getUnificationVariable(),
drlxParseResult.getUnificationVariableType(),
drlxParseResult.getUnificationName()
));
return exprDSL;
}
public abstract Expression buildExpressionWithIndexing(DrlxParseSuccess drlxParseResult);
public abstract MethodCallExpr buildBinding(DrlxParseSuccess drlxParseResult );
protected Expression getConstraintExpression(DrlxParseSuccess drlxParseResult) {
if (drlxParseResult.getExpr() instanceof EnclosedExpr) {
return buildConstraintExpression(drlxParseResult, ((EnclosedExpr) drlxParseResult.getExpr()).getInner());
} else {
final TypedExpression left = drlxParseResult.getLeft();
// Can we unify it? Sometimes expression is in the left sometimes in expression
final Expression e;
if(left != null) {
e = DrlxParseUtil.findLeftLeafOfMethodCall(left.getExpression());
} else {
e = drlxParseResult.getExpr();
}
return buildConstraintExpression(drlxParseResult, drlxParseResult.getUsedDeclarationsOnLeft(), e);
}
}
protected Expression buildConstraintExpression(DrlxParseSuccess drlxParseResult, Expression expr ) {
return buildConstraintExpression(drlxParseResult, drlxParseResult.getUsedDeclarations(), expr );
}
protected Expression buildConstraintExpression(DrlxParseSuccess drlxParseResult, Collection<String> usedDeclarations, Expression expr ) {
return drlxParseResult.isStatic() ? expr : generateLambdaWithoutParameters(usedDeclarations, expr, drlxParseResult.isSkipThisAsParam());
}
boolean hasIndex( DrlxParseSuccess drlxParseResult ) {
TypedExpression left = drlxParseResult.getLeft();
Collection<String> usedDeclarations = drlxParseResult.getUsedDeclarations();
return drlxParseResult.getDecodeConstraintType() != null && left.getFieldName() != null && !isThisExpression( left.getExpression() ) &&
( isAlphaIndex( usedDeclarations ) || isBetaIndex( usedDeclarations, drlxParseResult.getRight() ) );
}
boolean isAlphaIndex( Collection<String> usedDeclarations ) {
return usedDeclarations.isEmpty();
}
private boolean isBetaIndex( Collection<String> usedDeclarations, TypedExpression right ) {
// a Beta node should NOT create the index when the "right" is not just-a-symbol, the "right" is not a declaration referenced by name
return usedDeclarations.size() == 1 && context.getDeclarationById( getExpressionSymbol( right.getExpression() ) ).isPresent();
}
public static String getExpressionSymbol(Expression expr) {
if (expr instanceof MethodCallExpr && (( MethodCallExpr ) expr).getScope().isPresent()) {
return getExpressionSymbol( (( MethodCallExpr ) expr).getScope().get() );
}
if (expr instanceof FieldAccessExpr ) {
return getExpressionSymbol( (( FieldAccessExpr ) expr).getScope() );
}
return expr.toString();
}
private boolean isThisExpression( Expression leftExpr ) {
return leftExpr instanceof NameExpr && ((NameExpr)leftExpr).getName().getIdentifier().equals("_this");
}
public static AbstractExpressionBuilder getExpressionBuilder(RuleContext context) {
return context.isPatternDSL() ? new PatternExpressionBuilder( context ) : new FlowExpressionBuilder( context );
}
protected Expression narrowExpressionWithBigDecimal(TypedExpression right, java.lang.reflect.Type leftType) {
Expression expression = right.getExpression();
if(expression instanceof BigDecimalLiteralExpr) {
expression = toNewBigDecimalExpr(new StringLiteralExpr(((BigDecimalLiteralExpr) expression).asBigDecimal().toString()));
} else if (expression instanceof LiteralExpr && leftType.equals(BigDecimal.class)) {
final BigDecimal bigDecimal = new BigDecimal(expression.toString());
expression = toNewBigDecimalExpr(new StringLiteralExpr(bigDecimal.toString()));
} else if (expression instanceof NameExpr && leftType.equals(BigDecimal.class)) {
expression = toNewBigDecimalExpr(expression);
} else if (expression instanceof BigIntegerLiteralExpr) {
expression = toNewBigIntegerExpr(new StringLiteralExpr(((BigIntegerLiteralExpr) expression).asBigInteger().toString()));
} else if (expression instanceof LiteralExpr && leftType.equals(BigInteger.class)) {
final BigInteger bigInteger = new BigDecimal(expression.toString()).toBigInteger();
expression = toNewBigIntegerExpr(new StringLiteralExpr(bigInteger.toString()));
} else if (expression instanceof NameExpr && leftType.equals(BigInteger.class)) {
expression = toNewBigIntegerExpr(expression);
}
return expression;
}
protected void addIndexedByDeclaration(TypedExpression left, TypedExpression right, boolean leftContainsThis, MethodCallExpr indexedByDSL, Collection<String> usedDeclarations, java.lang.reflect.Type leftType) {
LambdaExpr indexedBy_rightOperandExtractor = new LambdaExpr();
indexedBy_rightOperandExtractor.addParameter(new Parameter(new UnknownType(), usedDeclarations.iterator().next()));
final TypedExpression expression;
if (!leftContainsThis) {
expression = left;
} else {
expression = right;
}
final Expression narrowed = narrowExpressionWithBigDecimal(expression, leftType);
indexedBy_rightOperandExtractor.setBody(new ExpressionStmt(narrowed));
indexedByDSL.addArgument(indexedBy_rightOperandExtractor);
}
}
|
3e07c3b14df958d8890ccb059c2f24b6abc91476
| 1,334 |
java
|
Java
|
src/com/ulyssesss/leetcode/solution/_0092.java
|
Ulyssesss/LeetCode
|
7af7ad84cbbfa1c5fa97049ae112eed60f6ae270
|
[
"Apache-2.0"
] | 1 |
2017-05-06T15:20:31.000Z
|
2017-05-06T15:20:31.000Z
|
src/com/ulyssesss/leetcode/solution/_0092.java
|
Ulyssesss/LeetCode
|
7af7ad84cbbfa1c5fa97049ae112eed60f6ae270
|
[
"Apache-2.0"
] | null | null | null |
src/com/ulyssesss/leetcode/solution/_0092.java
|
Ulyssesss/LeetCode
|
7af7ad84cbbfa1c5fa97049ae112eed60f6ae270
|
[
"Apache-2.0"
] | null | null | null | 23.403509 | 65 | 0.41904 | 3,289 |
package com.ulyssesss.leetcode.solution;
import com.ulyssesss.leetcode.common.ListNode;
/**
* 92. 反转链表 II
*
* 反转从位置 m 到 n 的链表。请使用一趟扫描完成反转。
*
* 说明:
* 1 ≤ m ≤ n ≤ 链表长度。
*
* 示例:
*
* 输入: 1->2->3->4->5->NULL, m = 2, n = 4
* 输出: 1->4->3->2->5->NULL
*
*/
public class _0092 {
public ListNode reverseBetween(ListNode head, int m, int n) {
if (head == null || head.next == null) {
return head;
}
ListNode dummy = new ListNode(0);
dummy.next = head;
ListNode current = dummy;
ListNode next;
ListNode previous = null;
ListNode firstReverse = null;
int i = 1;
while (head != null) {
next = head.next;
if (i >= m && i <= n) {
if (firstReverse == null) {
firstReverse = head;
}
head.next = previous;
previous = head;
current.next = head;
if (i == n) {
current = firstReverse;
}
} else {
if (i == n + 1) {
current.next = head;
break;
}
current = current.next;
}
head = next;
i++;
}
return dummy.next;
}
}
|
3e07c3d179654cd0250a83ced5debd363d948401
| 3,537 |
java
|
Java
|
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java
|
liveqmock/platform-tools-idea
|
1c4b76108add6110898a7e3f8f70b970e352d3d4
|
[
"Apache-2.0"
] | 2 |
2015-05-08T15:07:10.000Z
|
2022-03-09T05:47:53.000Z
|
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java
|
lshain-android-source/tools-idea
|
b37108d841684bcc2af45a2539b75dd62c4e283c
|
[
"Apache-2.0"
] | null | null | null |
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java
|
lshain-android-source/tools-idea
|
b37108d841684bcc2af45a2539b75dd62c4e283c
|
[
"Apache-2.0"
] | 2 |
2017-04-24T15:48:40.000Z
|
2022-03-09T05:48:05.000Z
| 36.091837 | 118 | 0.708227 | 3,290 |
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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.intellij.openapi.vcs.changes.committed;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
import java.util.*;
public class RootsCalculator {
private final static Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.committed.RootsCalculator");
private final Project myProject;
private final AbstractVcs myVcs;
private final ProjectLevelVcsManager myPlManager;
private VirtualFile[] myContentRoots;
private final RepositoryLocationCache myLocationCache;
public RootsCalculator(final Project project, final AbstractVcs vcs, final RepositoryLocationCache locationCache) {
myProject = project;
myLocationCache = locationCache;
myPlManager = ProjectLevelVcsManager.getInstance(myProject);
myVcs = vcs;
}
public Map<VirtualFile, RepositoryLocation> getRoots() {
myContentRoots = myPlManager.getRootsUnderVcs(myVcs);
List<VirtualFile> roots = new ArrayList<VirtualFile>();
final List<VcsDirectoryMapping> mappings = myPlManager.getDirectoryMappings(myVcs);
for (VcsDirectoryMapping mapping : mappings) {
if (mapping.isDefaultMapping()) {
if (myVcs.equals(myPlManager.getVcsFor(myProject.getBaseDir()))) {
roots.add(myProject.getBaseDir());
}
}
else {
VirtualFile newFile = LocalFileSystem.getInstance().findFileByPath(mapping.getDirectory());
if (newFile == null) {
newFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(mapping.getDirectory());
}
if (newFile != null) {
roots.add(newFile);
}
else {
LOG.info("Can not file virtual file for root: " + mapping.getDirectory());
}
}
}
ContainerUtil.addAll(roots, myContentRoots);
final Map<VirtualFile, RepositoryLocation> result = new HashMap<VirtualFile, RepositoryLocation>();
for (Iterator<VirtualFile> iterator = roots.iterator(); iterator.hasNext();) {
final VirtualFile vf = iterator.next();
final RepositoryLocation location = myLocationCache.getLocation(myVcs, new FilePathImpl(vf), false);
if (location != null) {
result.put(vf, location);
}
else {
iterator.remove();
}
}
roots = myVcs.filterUniqueRoots(roots, IntoSelfVirtualFileConvertor.getInstance());
result.keySet().retainAll(roots);
logRoots(roots);
return result;
}
private void logRoots(final List<VirtualFile> roots) {
if (LOG.isDebugEnabled()) {
LOG.debug("Roots for committed changes load:\n");
for (VirtualFile root : roots) {
LOG.debug(root.getPath() + ", ");
}
}
}
public VirtualFile[] getContentRoots() {
return myContentRoots;
}
}
|
3e07c43516ffa678e0fae2991c2529a61cefa983
| 580 |
java
|
Java
|
study-notes/j2ee-collection/architecture/02-分布式事务/mysql-demo/src/main/java/com/sq/demo/mysqldemo/web/UserController.java
|
coderZsq/coderZsq.practice.server
|
f789ee4b43b4a8dee5d8872e86c04ca2fe139b68
|
[
"MIT"
] | 1 |
2020-06-14T12:43:47.000Z
|
2020-06-14T12:43:47.000Z
|
study-notes/j2ee-collection/architecture/02-分布式事务/mysql-demo/src/main/java/com/sq/demo/mysqldemo/web/UserController.java
|
coderZsq/coderZsq.practice.server
|
f789ee4b43b4a8dee5d8872e86c04ca2fe139b68
|
[
"MIT"
] | 88 |
2020-03-03T15:16:28.000Z
|
2022-01-04T16:44:37.000Z
|
study-notes/j2ee-collection/architecture/02-分布式事务/mysql-demo/src/main/java/com/sq/demo/mysqldemo/web/UserController.java
|
coderZsq/coderZsq.practice.server
|
f789ee4b43b4a8dee5d8872e86c04ca2fe139b68
|
[
"MIT"
] | 1 |
2021-09-08T06:34:11.000Z
|
2021-09-08T06:34:11.000Z
| 29 | 62 | 0.768966 | 3,291 |
package com.sq.demo.mysqldemo.web;
import com.sq.demo.mysqldemo.domain.User;
import com.sq.demo.mysqldemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/user/save")
public String save(User user, String userName) {
userService.save(user, userName);
return "success";
}
}
|
3e07c4a68d6c94787f2e1065adb2a0c419664c91
| 1,625 |
java
|
Java
|
src/main/java/com/upc/gessi/qrapids/app/presentation/rest/dto/DTOAssessment.java
|
q-rapids/learning-dashboard
|
63b1b46419ca4d9940c863100564ec95e32dcc05
|
[
"Apache-2.0"
] | 5 |
2019-05-14T14:05:20.000Z
|
2021-09-08T15:58:19.000Z
|
src/main/java/com/upc/gessi/qrapids/app/presentation/rest/dto/DTOAssessment.java
|
q-rapids/qrapids-dashboard
|
d15c869faf65df454d48abe3452cb4d7f5b54132
|
[
"Apache-2.0"
] | 168 |
2019-01-23T12:05:51.000Z
|
2021-09-12T09:19:45.000Z
|
src/main/java/com/upc/gessi/qrapids/app/presentation/rest/dto/DTOAssessment.java
|
q-rapids/learning-dashboard
|
63b1b46419ca4d9940c863100564ec95e32dcc05
|
[
"Apache-2.0"
] | 4 |
2019-04-16T00:14:17.000Z
|
2021-01-05T21:45:36.000Z
| 21.666667 | 98 | 0.592615 | 3,292 |
package com.upc.gessi.qrapids.app.presentation.rest.dto;
/**
* @author Oriol M.
*/
public class DTOAssessment {
private Long id;
private String label;
private Float value;
private String color;
private Float upperThreshold;
public DTOAssessment(Long id, String label, Float value, String color, Float upperThreshold) {
this.id = id;
this.label = label;
this.value = value;
this.color = color;
this.upperThreshold = upperThreshold;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Float getValue() {
return value;
}
public void setValue(Float value) {
this.value = value;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public Float getUpperThreshold() {
return upperThreshold;
}
public void setUpperThreshold(Float upperThreshold) {
this.upperThreshold = upperThreshold;
}
/*
* Function that returns de desc*/
public String toString(){
String description;
String thresholdLabel;
description = label;
if (upperThreshold != null && !upperThreshold.isNaN()) {
thresholdLabel = String.format("%.2f",upperThreshold);
description = description + " (" + thresholdLabel + ')';
}
return description;
}
}
|
3e07c54fbf143fc3b019c2a58616ad77a75da9db
| 2,181 |
java
|
Java
|
core/src/test/java/org/infinispan/persistence/PassivatePersistentTest.java
|
clara0/infinispan
|
f2cb717bbd51dd8e3e4265679585cd637a55bed5
|
[
"Apache-2.0"
] | 713 |
2015-01-06T02:14:17.000Z
|
2022-03-29T10:22:07.000Z
|
core/src/test/java/org/infinispan/persistence/PassivatePersistentTest.java
|
clara0/infinispan
|
f2cb717bbd51dd8e3e4265679585cd637a55bed5
|
[
"Apache-2.0"
] | 5,732 |
2015-01-01T19:13:35.000Z
|
2022-03-31T16:31:11.000Z
|
core/src/test/java/org/infinispan/persistence/PassivatePersistentTest.java
|
clara0/infinispan
|
f2cb717bbd51dd8e3e4265679585cd637a55bed5
|
[
"Apache-2.0"
] | 402 |
2015-01-05T23:23:42.000Z
|
2022-03-25T08:14:32.000Z
| 32.552239 | 79 | 0.716185 | 3,293 |
package org.infinispan.persistence;
import javax.transaction.TransactionManager;
import org.infinispan.Cache;
import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.manager.CacheContainer;
import org.infinispan.persistence.dummy.DummyInMemoryStore;
import org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder;
import org.infinispan.persistence.spi.PersistenceException;
import org.infinispan.test.AbstractInfinispanTest;
import org.infinispan.test.TestingUtil;
import org.infinispan.test.fwk.TestCacheManagerFactory;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@Test(testName = "persistence.PassivatePersistentTest", groups = "functional")
public class PassivatePersistentTest extends AbstractInfinispanTest {
Cache<String, String> cache;
DummyInMemoryStore store;
TransactionManager tm;
ConfigurationBuilder cfg;
CacheContainer cm;
@BeforeMethod
public void setUp() {
cfg = new ConfigurationBuilder();
cfg
.persistence()
.passivation(true)
.addStore(DummyInMemoryStoreConfigurationBuilder.class)
.storeName(this.getClass().getName())
.purgeOnStartup(false);
cm = TestCacheManagerFactory.createCacheManager(cfg);
cache = cm.getCache();
store = TestingUtil.getFirstStore(cache);
tm = TestingUtil.getTransactionManager(cache);
}
@AfterMethod
public void tearDown() throws PersistenceException {
store.clear();
TestingUtil.killCacheManagers(cm);
}
public void testPersistence() throws PersistenceException {
cache.put("k", "v");
assert "v".equals(cache.get("k"));
cache.evict("k");
assert store.contains("k");
assert "v".equals(cache.get("k"));
eventually(() -> !store.contains("k"));
cache.stop();
cache.start();
// The old store's marshaller is not working any more
store = TestingUtil.getFirstStore(cache);
assert store.contains("k");
assert "v".equals(cache.get("k"));
eventually(() -> !store.contains("k"));
}
}
|
3e07c59d7b97d8e27e74c6d679a3f68f2a0f036e
| 3,346 |
java
|
Java
|
src/com/microsoft/azure/shortcuts/resources/samples/ProvidersSample.java
|
Bhaskers-Blu-Org2/azure-shortcuts-for-java
|
7ef5cda0d1de6d0acf4cbb914ce61660b5d3023c
|
[
"MIT"
] | 6 |
2016-03-22T21:31:47.000Z
|
2018-07-30T21:53:12.000Z
|
src/com/microsoft/azure/shortcuts/resources/samples/ProvidersSample.java
|
microsoft/azure-shortcuts-for-java
|
7ef5cda0d1de6d0acf4cbb914ce61660b5d3023c
|
[
"MIT"
] | 5 |
2016-03-21T18:03:32.000Z
|
2016-06-24T00:26:21.000Z
|
src/com/microsoft/azure/shortcuts/resources/samples/ProvidersSample.java
|
microsoft/azure-shortcuts-for-java
|
7ef5cda0d1de6d0acf4cbb914ce61660b5d3023c
|
[
"MIT"
] | 6 |
2019-11-02T21:19:32.000Z
|
2021-11-10T09:58:46.000Z
| 43.454545 | 138 | 0.705021 | 3,294 |
/**
* Copyright (c) Microsoft Corporation
*
* All rights reserved.
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
* THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.microsoft.azure.shortcuts.resources.samples;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.microsoft.azure.shortcuts.resources.Provider;
import com.microsoft.azure.shortcuts.resources.Provider.ResourceType;
import com.microsoft.azure.shortcuts.resources.implementation.Subscription;
// Tests resources
public class ProvidersSample {
public static void main(String[] args) {
try {
Subscription subscription = Subscription.authenticate("my.azureauth", null);
test(subscription);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void test(Subscription subscription) throws Exception {
// List provider namespaces
Map<String, Provider> providers = subscription.providers().asMap();
System.out.println(String.format("Provider namespaces: %s\t", StringUtils.join(providers.keySet(), "\n\t")));
// List providers
for(Provider provider : providers.values()) {
System.out.println(provider.id() + " - " + provider.registrationState());
}
if(providers.size() > 0) {
// Get information about a specific provider
Provider provider = subscription.providers("microsoft.classicstorage");
System.out.println(String.format("Found provider: %s\n"
+ "\tRegistration State: %s\n"
+ "\tAPI versions for resource types:",
provider.id(),
provider.registrationState()));
for(ResourceType t : provider.resourceTypes().values()) {
System.out.println(String.format("\t\t%s: %s", t.id(), StringUtils.join(t.apiVersions(), ", ")));
}
// Get latest API version for a specific resource type
String resourceType = "storageAccounts";
System.out.println(String.format("\n\t\tLatest version for type %s: %s", resourceType,
provider.resourceTypes().get(resourceType).latestApiVersion()));
// Get latest API version for a specific resource type - shortcut
System.out.println(String.format("\n\t\tLatest version for type %s: %s", resourceType,
provider.resourceTypes(resourceType).latestApiVersion()));
}
}
}
|
3e07c5b4b493c9c7896b4af486bc6744de1e1086
| 8,450 |
java
|
Java
|
FM2Workbench/src/fm2client/table/FaceFindResultTable.java
|
LostPersonFinder/FaceMatch-2
|
f750868c47ac8b0a8c0fc65d5cc7bb995af05d62
|
[
"BSD-3-Clause"
] | null | null | null |
FM2Workbench/src/fm2client/table/FaceFindResultTable.java
|
LostPersonFinder/FaceMatch-2
|
f750868c47ac8b0a8c0fc65d5cc7bb995af05d62
|
[
"BSD-3-Clause"
] | null | null | null |
FM2Workbench/src/fm2client/table/FaceFindResultTable.java
|
LostPersonFinder/FaceMatch-2
|
f750868c47ac8b0a8c0fc65d5cc7bb995af05d62
|
[
"BSD-3-Clause"
] | null | null | null | 43.782383 | 152 | 0.595385 | 3,295 |
/*
Informational Notice:
This software was developed under contract funded by the National Library of Medicine, which is part of the National Institutes of Health,
an agency of the Department of Health and Human Services, United States Government.
- The license of this software is an open-source BSD license. It allows use in both commercial and non-commercial products.
- The license does not supersede any applicable United States law.
- The license does not indemnify you from any claims brought by third parties whose proprietary rights may be infringed by your usage of this software.
Government usage rights for this software are established by Federal law, which includes, but may not be limited to, Federal Acquisition Regulation
(FAR) 48 C.F.R. Part52.227-14, Rights in Data—General.
The license for this software is intended to be expansive, rather than restrictive, in encouraging the use of this software in both commercial and
non-commercial products.
LICENSE:
Government Usage Rights Notice: The U.S. Government retains unlimited, royalty-free usage rights to this software, but not ownership,
as provided by Federal law.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
• Redistributions of source code must retain the above Government Usage Rights Notice, this list of conditions and the following disclaimer.
• Redistributions in binary form must reproduce the above Government Usage Rights Notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
• The names,trademarks, and service marks of the National Library of Medicine, the National Cancer Institute, the National Institutes
of Health, and the names of any of the software developers shall not be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE U.S. GOVERNMENT AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITEDTO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE U.S. GOVERNMENT
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* ResultDisplay.java
*/
package fm2client.table;
import fm2client.analyzer.ResultAnalyzer;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import org.json.simple.*;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.util.HashMap;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.ListSelectionEvent;
import org.apache.log4j.Logger;
/********************************************************************************************
* Display FaceFind results, returned by the Server to the client, as a Table.
*
* Add New Rows to the table as data is added.
* Rows are not editable, but selectable.
* When a row is selected, the image with the face and its coordinates are displayed
* in a new frame.
*
*-*****************************************************************************************/
public class FaceFindResultTable extends ResultTable
{
private static Logger log = Logger.getLogger(FaceFindResultTable.class);
public HashMap noFaceURLMap;
/*---------------------------------------------------------------------------------------*/
// implementation of abstract method
public int getOperationType() { return FACEFIND_OPERATION;}
/*---------------------------------------------------------------------------------------*/
public FaceFindResultTable (ResultAnalyzer analyzer)
{
super( FACEFIND_OPERATION, FF_TABLE_NAME, GetFacesColumnNames, analyzer, null);
setTableColor(new Color(0xF6F9D9));;
noFaceURLMap = new HashMap();
//----------------------------------------------------------------------------------------------------------
// add a listner to know when a row is selected
// Enable/Disable the Annotation Display button accordingly
//----------------------------------------------------------------------------------------------------------------
myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent event) {
if (myTable.getSelectedRow() > -1)
{
// enable/disable the Annotation drawing button
int selectedRow = myTable.getSelectedRow();
String imageURL = (String)myTable.getValueAt(selectedRow, FFImageNameCol);
boolean annot = analyzer.isAnnotationAvailable(imageURL);
actionButtons[FF_ANNOT_BUTTON].setEnabled(annot);
}
}
});
}
public FaceFindResultTable (JPanel parentPanel, String tableName)
{
super(parentPanel, tableName, GetFacesColumnNames);
setTableColor(new Color(0xF6F9D9));;
noFaceURLMap = new HashMap();
this.setVisible(true);
}
public int addRow(int testNum, int testId, JSONObject testResult)
{
int displayStatus = displayFaceFinderRecord(testNum, testId, testResult);
return displayStatus ;
}
/*--------------------------------------------------------------------------------
* display a new Row in the table
* using data in the input JSON object
*--------------------------------------------------------------------------------*/
public int displayFaceFinderRecord(int testNum, int testId, JSONObject testResult)
{
JTable table = myTable;
DefaultTableModel model= (DefaultTableModel)table.getModel();
try
{
String imageURL = (String) testResult.get("url");
//String imageTag = (String) testResult.get("imageTag");
String coordinates = "";
JSONArray arr = (JSONArray) testResult.get("faceRegions");
int numFaces = (arr == null) ? 0 : arr.size();
if (numFaces > 0)
{
for (int j=0; j< arr.size(); j++)
{
coordinates += (String) arr.get(j);
if (j < (arr.size()-1))
coordinates += " ";
}
}
float serviceTime = ((Double) testResult.get("serviceTimeMsec")).floatValue();
float faceFindTime = ((Double) testResult.get("faceFindTimeMsec")).floatValue();
boolean gpuUsed = ((Boolean)testResult.get("gpuUsed")).booleanValue();
String perfType= ((String)testResult.get("performance"));
Object[] data= {testNum, testId, imageURL, numFaces, coordinates, perfType,
faceFindTime, serviceTime, gpuUsed};
model.addRow(data);
/* for testing only
System.out.println("Number of rows: " + model.getRowCount());
*/
// Thread.currentThread().sleep(100);
} // end try
catch(Exception e)
{
log.error("Could not display FaceFind result for test number " + testNum, e);
return 0;
} // end catch
int rowCount = model.getRowCount();
if (rowCount >= 1)
{
resultTable.setVisible(true); // self, the JDialog
// resultTable.requestFocus();
}
// make the last table rows visible
scrollToVisible(rowCount);
return 1;
}
public HashMap getURLsWithNoFaces()
{
return noFaceURLMap;
}
} //end class
|
3e07c5ba44ea01109273bd4a113eea313be8233b
| 26,835 |
java
|
Java
|
src/generated/java/com/prowidesoftware/swift/model/field/Field14S.java
|
sman-81/prowide-core
|
3dff7251d0207cc5b8675e263355629deec6fc44
|
[
"Apache-2.0"
] | null | null | null |
src/generated/java/com/prowidesoftware/swift/model/field/Field14S.java
|
sman-81/prowide-core
|
3dff7251d0207cc5b8675e263355629deec6fc44
|
[
"Apache-2.0"
] | null | null | null |
src/generated/java/com/prowidesoftware/swift/model/field/Field14S.java
|
sman-81/prowide-core
|
3dff7251d0207cc5b8675e263355629deec6fc44
|
[
"Apache-2.0"
] | null | null | null | 30.185602 | 144 | 0.617999 | 3,296 |
/*
* Copyright 2006-2021 Prowide
*
* 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.prowidesoftware.swift.model.field;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.Generated;
import com.prowidesoftware.deprecation.ProwideDeprecated;
import com.prowidesoftware.deprecation.TargetYear;
import java.io.Serializable;
import java.util.Locale;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Calendar;
import org.apache.commons.lang3.StringUtils;
import com.prowidesoftware.swift.model.field.SwiftParseUtils;
import com.prowidesoftware.swift.model.field.Field;
import com.prowidesoftware.swift.model.*;
import com.prowidesoftware.swift.utils.SwiftFormatUtils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* SWIFT MT Field 14S.
* <p>
* Model and parser for field 14S of a SWIFT MT message.
*
* <p>Subfields (components) Data types
* <ol>
* <li><code>String</code></li>
* <li><code>Long</code></li>
* <li><code>Calendar</code></li>
* <li><code>String</code></li>
* </ol>
*
* <p>Structure definition
* <ul>
* <li>validation pattern: <code>3!a2!n[/<HHMM>/4!c]</code></li>
* <li>parser pattern: <code>SN[/<HHMM>/S]</code></li>
* <li>components pattern: <code>SNHS</code></li>
* </ul>
*
* <p>
* This class complies with standard release <strong>SRU2021</strong>
*/
@SuppressWarnings("unused")
@Generated
public class Field14S extends Field implements Serializable {
/**
* Constant identifying the SRU to which this class belongs to.
*/
public static final int SRU = 2021;
private static final long serialVersionUID = 1L;
/**
* Constant with the field name 14S.
*/
public static final String NAME = "14S";
/**
* Same as NAME, intended to be clear when using static imports.
*/
public static final String F_14S = "14S";
/**
* @deprecated use {@link #parserPattern()} method instead.
*/
@Deprecated
@ProwideDeprecated(phase2 = TargetYear.SRU2022)
public static final String PARSER_PATTERN = "SN[/<HHMM>/S]";
/**
* @deprecated use {@link #typesPattern()} method instead.
*/
@Deprecated
@ProwideDeprecated(phase2 = TargetYear.SRU2022)
public static final String COMPONENTS_PATTERN = "SNHS";
/**
* @deprecated use {@link #typesPattern()} method instead.
*/
@Deprecated
@ProwideDeprecated(phase2 = TargetYear.SRU2022)
public static final String TYPES_PATTERN = "SNHS";
/**
* Component number for the Source subfield.
*/
public static final Integer SOURCE = 1;
/**
* Component number for the Number subfield.
*/
public static final Integer NUMBER = 2;
/**
* Component number for the Time subfield.
*/
public static final Integer TIME = 3;
/**
* Component number for the Location subfield.
*/
public static final Integer LOCATION = 4;
/**
* Default constructor. Creates a new field setting all components to null.
*/
public Field14S() {
super(4);
}
/**
* Creates a new field and initializes its components with content from the parameter value.
* @param value complete field value including separators and CRLF
*/
public Field14S(final String value) {
super(value);
}
/**
* Creates a new field and initializes its components with content from the parameter tag.
* The value is parsed with {@link #parse(String)}
* @throws IllegalArgumentException if the parameter tag is null or its tagname does not match the field name
* @since 7.8
*/
public Field14S(final Tag tag) {
this();
if (tag == null) {
throw new IllegalArgumentException("tag cannot be null.");
}
if (!StringUtils.equals(tag.getName(), "14S")) {
throw new IllegalArgumentException("cannot create field 14S from tag "+tag.getName()+", tagname must match the name of the field.");
}
parse(tag.getValue());
}
/**
* Copy constructor.
* Initializes the components list with a deep copy of the source components list.
* @param source a field instance to copy
* @since 7.7
*/
public static Field14S newInstance(Field14S source) {
Field14S cp = new Field14S();
cp.setComponents(new ArrayList<>(source.getComponents()));
return cp;
}
/**
* Create a Tag with this field name and the given value.
* Shorthand for <code>new Tag(NAME, value)</code>
* @see #NAME
* @since 7.5
*/
public static Tag tag(final String value) {
return new Tag(NAME, value);
}
/**
* Create a Tag with this field name and an empty string as value.
* Shorthand for <code>new Tag(NAME, "")</code>
* @see #NAME
* @since 7.5
*/
public static Tag emptyTag() {
return new Tag(NAME, "");
}
/**
* Parses the parameter value into the internal components structure.
*
* <p>Used to update all components from a full new value, as an alternative
* to setting individual components. Previous component values are overwritten.
*
* @param value complete field value including separators and CRLF
* @since 7.8
*/
@Override
public void parse(final String value) {
init(4);
if (value != null) {
String left;
String right = null;
if (value.indexOf('/') >= 0) {
left = SwiftParseUtils.getTokenFirst(value, "/");
right = SwiftParseUtils.getTokenSecondLast(value, "/");
} else {
left = value;
}
setComponent1(SwiftParseUtils.getAlphaPrefix(left));
final String second = getComponent1() == null ? left : StringUtils.substringAfter(left, getComponent1());
setComponent2(second);
if (right != null) {
setComponent3(SwiftParseUtils.getTokenFirst(right, "/"));
setComponent4(SwiftParseUtils.getTokenSecondLast(right, "/"));
}
}
}
/**
* Serializes the fields' components into the single string value (SWIFT format)
*/
@Override
public String getValue() {
final StringBuilder result = new StringBuilder();
append(result, 1);
append(result, 2);
if (getComponent3() != null || getComponent4() != null) {
result.append("/");
append(result, 3);
result.append("/");
append(result, 4);
}
return result.toString();
}
/**
* Returns a localized suitable for showing to humans string of a field component.<br>
*
* @param component number of the component to display
* @param locale optional locale to format date and amounts, if null, the default locale is used
* @return formatted component value or null if component number is invalid or not present
* @throws IllegalArgumentException if component number is invalid for the field
* @since 7.8
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 4) {
throw new IllegalArgumentException("invalid component number " + component + " for field 14S");
}
if (component == 1) {
//default format (as is)
return getComponent(1);
}
if (component == 2) {
//default format (as is)
return getComponent(2);
}
if (component == 3) {
//time: HH[mm]
java.text.DateFormat f = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
java.util.Calendar cal = getComponent3AsCalendar();
if (cal != null) {
return f.format(cal.getTime());
}
}
if (component == 4) {
//default format (as is)
return getComponent(4);
}
return null;
}
/**
* @deprecated use {@link #typesPattern()} instead.
*/
@Override
@Deprecated
@ProwideDeprecated(phase2 = TargetYear.SRU2022)
public String componentsPattern() {
return "SNHS";
}
/**
* Returns the field component types pattern.
*
* This method returns a letter representing the type for each component in the Field. It supersedes
* the Components Pattern because it distinguishes between N (Number) and I (BigDecimal).
* @since 9.2.7
*/
@Override
public String typesPattern() {
return "SNHS";
}
/**
* Returns the field parser pattern.
*/
@Override
public String parserPattern() {
return "SN[/<HHMM>/S]";
}
/**
* Returns the field validator pattern
*/
@Override
public String validatorPattern() {
return "3!a2!n[/<HHMM>/4!c]";
}
/**
* Given a component number it returns true if the component is optional,
* regardless of the field being mandatory in a particular message.<br>
* Being the field's value conformed by a composition of one or several
* internal component values, the field may be present in a message with
* a proper value but with some of its internal components not set.
*
* @param component component number, first component of a field is referenced as 1
* @return true if the component is optional for this field, false otherwise
*/
@Override
public boolean isOptional(int component) {
if (component == 3) {
return true;
}
if (component == 4) {
return true;
}
return false;
}
/**
* Returns true if the field is a GENERIC FIELD as specified by the standard.
* @return true if the field is generic, false otherwise
*/
@Override
public boolean isGeneric() {
return false;
}
/**
* Returns the defined amount of components.<br>
* This is not the amount of components present in the field instance, but the total amount of components
* that this field accepts as defined.
* @since 7.7
*/
@Override
public int componentsSize() {
return 4;
}
/**
* Returns english label for components.
* <br>
* The index in the list is in sync with specific field component structure.
* @see #getComponentLabel(int)
* @since 7.8.4
*/
@Override
public List<String> getComponentLabels() {
List<String> result = new ArrayList<>();
result.add("Source");
result.add("Number");
result.add("Time");
result.add("Location");
return result;
}
/**
* Returns a mapping between component numbers and their label in camel case format.
* @since 7.10.3
*/
@Override
protected Map<Integer, String> getComponentMap() {
Map<Integer, String> result = new HashMap<>();
result.put(1, "source");
result.put(2, "number");
result.put(3, "time");
result.put(4, "location");
return result;
}
/**
* Gets the component 1 (Source).
* @return the component 1
*/
public String getComponent1() {
return getComponent(1);
}
/**
* Gets the Source (component 1).
* @return the Source from component 1
*/
public String getSource() {
return getComponent1();
}
/**
* Gets the component 2 (Number).
* @return the component 2
*/
public String getComponent2() {
return getComponent(2);
}
/**
* Get the component 2 as Long
*
* @return the component 2 converted to Long or null if cannot be converted
* @since 9.2.7
*/
public java.lang.Long getComponent2AsLong() {
return SwiftFormatUtils.getLong(getComponent(2));
}
/**
* Get the component 2 as Number (BigDecimal)
*
* The value is returned as BigDecimal to keep compatibility with previous API. You should
* use <code>getComponent2AsLong()</code> to get the proper value.
*
* @return the component 2 converted to Number (BigDecimal) or null if cannot be converted
* @see #getComponent2AsLong()
*/
@Deprecated
@ProwideDeprecated(phase2 = TargetYear.SRU2022)
public java.lang.Number getComponent2AsNumber() {
Long l = getComponent2AsLong();
return l != null ? new BigDecimal(l) : null;
}
/**
* Gets the Number (component 2).
* @return the Number from component 2
*/
public String getNumber() {
return getComponent2();
}
/**
* Get the Number (component 2) as Long
* @return the Number from component 2 converted to Long or null if cannot be converted
* @since 9.2.7
*/
public java.lang.Long getNumberAsLong() {
return getComponent2AsLong();
}
/**
* Get the Number (component 2) as as Number (BigDecimal)
*
* The value is returned as BigDecimal to keep compatibility with previous API. You should
* use <code>getComponent2AsLong()</code> to get the proper value.
*
* @return the component 2 converted to Number (BigDecimal) or null if cannot be converted
* @see #getNumberAsLong()
*/
@Deprecated
@ProwideDeprecated(phase2 = TargetYear.SRU2022)
public java.lang.Number getNumberAsNumber() {
return getComponent2AsNumber();
}
/**
* Gets the component 3 (Time).
* @return the component 3
*/
public String getComponent3() {
return getComponent(3);
}
/**
* Get the component 3 as Calendar
*
* @return the component 3 converted to Calendar or null if cannot be converted
*/
public java.util.Calendar getComponent3AsCalendar() {
return SwiftFormatUtils.getTime3(getComponent(3));
}
/**
* Gets the Time (component 3).
* @return the Time from component 3
*/
public String getTime() {
return getComponent3();
}
/**
* Get the Time (component 3) as Calendar
* @return the Time from component 3 converted to Calendar or null if cannot be converted
*/
public java.util.Calendar getTimeAsCalendar() {
return getComponent3AsCalendar();
}
/**
* Gets the component 4 (Location).
* @return the component 4
*/
public String getComponent4() {
return getComponent(4);
}
/**
* Gets the Location (component 4).
* @return the Location from component 4
*/
public String getLocation() {
return getComponent4();
}
/**
* Set the component 1 (Source).
*
* @param component1 the Source to set
* @return the field object to enable build pattern
*/
public Field14S setComponent1(String component1) {
setComponent(1, component1);
return this;
}
/**
* Set the Source (component 1).
*
* @param component1 the Source to set
* @return the field object to enable build pattern
*/
public Field14S setSource(String component1) {
return setComponent1(component1);
}
/**
* Set the component 2 (Number).
*
* @param component2 the Number to set
* @return the field object to enable build pattern
*/
public Field14S setComponent2(String component2) {
setComponent(2, component2);
return this;
}
/**
* Set the component2 from a Long object.
* <br>
* <em>If the component being set is a fixed length number, the argument will not be
* padded.</em> It is recommended for these cases to use the setComponent2(String)
* method.
*
* @see #setComponent2(String)
* @since 9.2.7
*
* @param component2 the Long with the Number content to set
* @return the field object to enable build pattern
*/
public Field14S setComponent2(java.lang.Long component2) {
setComponent(2, SwiftFormatUtils.getLong(component2));
return this;
}
/**
* Alternative method setter for field's Number (component 2) as as Number
*
* This method supports java constant value boxing for simpler coding styles (ex: 10 becomes an Integer)
*
* @param component2 the Number with the Number content to set
* @return the field object to enable build pattern
* @see #setNumber(java.lang.Long)
*/
public Field14S setComponent2(java.lang.Number component2) {
// NOTE: remember instanceof implicitly checks for non-null
if (component2 instanceof Long) {
setComponent(2, SwiftFormatUtils.getLong((Long) component2));
} else if (component2 instanceof BigInteger || component2 instanceof Integer) {
setComponent(2, SwiftFormatUtils.getLong(component2.longValue()));
} else if (component2 != null) {
// it's another non-null Number (Float, Double, BigDecimal, etc...)
setComponent(2, SwiftFormatUtils.getLong(component2.longValue()));
} else {
// explicitly set component as null
setComponent(2, null);
}
return this;
}
/**
* Set the Number (component 2).
*
* @param component2 the Number to set
* @return the field object to enable build pattern
*/
public Field14S setNumber(String component2) {
return setComponent2(component2);
}
/**
* Set the Number (component 2) from a Long object.
*
* @see #setComponent2(java.lang.Long)
*
* @param component2 Long with the Number content to set
* @return the field object to enable build pattern
* @since 9.2.7
*/
public Field14S setNumber(java.lang.Long component2) {
return setComponent2(component2);
}
/**
* Alternative method setter for field's Number (component 2) as as Number
*
* This method supports java constant value boxing for simpler coding styles (ex: 10 becomes an Integer)
*
* @param component2 the Number with the Number content to set
* @return the field object to enable build pattern
* @see #setNumber(java.lang.Long)
*/
public Field14S setNumber(java.lang.Number component2) {
return setComponent2(component2);
}
/**
* Set the component 3 (Time).
*
* @param component3 the Time to set
* @return the field object to enable build pattern
*/
public Field14S setComponent3(String component3) {
setComponent(3, component3);
return this;
}
/**
* Set the component3 from a Calendar object.
*
* @param component3 the Calendar with the Time content to set
* @return the field object to enable build pattern
*/
public Field14S setComponent3(java.util.Calendar component3) {
setComponent(3, SwiftFormatUtils.getTime3(component3));
return this;
}
/**
* Set the Time (component 3).
*
* @param component3 the Time to set
* @return the field object to enable build pattern
*/
public Field14S setTime(String component3) {
return setComponent3(component3);
}
/**
* Set the Time (component 3) from a Calendar object.
*
* @see #setComponent3(java.util.Calendar)
*
* @param component3 Calendar with the Time content to set
* @return the field object to enable build pattern
*/
public Field14S setTime(java.util.Calendar component3) {
return setComponent3(component3);
}
/**
* Set the component 4 (Location).
*
* @param component4 the Location to set
* @return the field object to enable build pattern
*/
public Field14S setComponent4(String component4) {
setComponent(4, component4);
return this;
}
/**
* Set the Location (component 4).
*
* @param component4 the Location to set
* @return the field object to enable build pattern
*/
public Field14S setLocation(String component4) {
return setComponent4(component4);
}
/**
* Returns the field's name composed by the field number and the letter option (if any).
* @return the static value of Field14S.NAME
*/
@Override
public String getName() {
return NAME;
}
/**
* Gets the first occurrence form the tag list or null if not found.
* @return null if not found o block is null or empty
* @param block may be null or empty
*/
public static Field14S get(final SwiftTagListBlock block) {
if (block == null || block.isEmpty()) {
return null;
}
final Tag t = block.getTagByName(NAME);
if (t == null) {
return null;
}
return new Field14S(t);
}
/**
* Gets the first instance of Field14S in the given message.
* @param msg may be empty or null
* @return null if not found or msg is empty or null
* @see #get(SwiftTagListBlock)
*/
public static Field14S get(final SwiftMessage msg) {
if (msg == null || msg.getBlock4() == null || msg.getBlock4().isEmpty()) {
return null;
}
return get(msg.getBlock4());
}
/**
* Gets a list of all occurrences of the field Field14S in the given message
* an empty list is returned if none found.
* @param msg may be empty or null in which case an empty list is returned
* @see #getAll(SwiftTagListBlock)
*/
public static List<Field14S> getAll(final SwiftMessage msg) {
if (msg == null || msg.getBlock4() == null || msg.getBlock4().isEmpty()) {
return java.util.Collections.emptyList();
}
return getAll(msg.getBlock4());
}
/**
* Gets a list of all occurrences of the field Field14S from the given block
* an empty list is returned if none found.
*
* @param block may be empty or null in which case an empty list is returned
*/
public static List<Field14S> getAll(final SwiftTagListBlock block) {
final List<Field14S> result = new ArrayList<>();
if (block == null || block.isEmpty()) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
for (final Tag f : arr) {
result.add(new Field14S(f));
}
}
return result;
}
/**
* This method deserializes the JSON data into a Field14S object.
* @param json JSON structure including tuples with label and value for all field components
* @return a new field instance with the JSON data parsed into field components or an empty field id the JSON is invalid
* @since 7.10.3
* @see Field#fromJson(String)
*/
public static Field14S fromJson(final String json) {
final Field14S field = new Field14S();
final JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject();
// **** COMPONENT 1 - Source
if (jsonObject.get("source") != null) {
field.setComponent1(jsonObject.get("source").getAsString());
}
// **** COMPONENT 2 - Number
if (jsonObject.get("number") != null) {
field.setComponent2(jsonObject.get("number").getAsString());
}
// **** COMPONENT 3 - Time
if (jsonObject.get("time") != null) {
field.setComponent3(jsonObject.get("time").getAsString());
}
// **** COMPONENT 4 - Location
if (jsonObject.get("location") != null) {
field.setComponent4(jsonObject.get("location").getAsString());
}
return field;
}
/**
* Gets the Rate Source (components 1 and 2) as a unit
* @return the concatenated values of component 1 and 2
* @since 9.2.7
*/
public String getRateSource() {
final StringBuilder result = new StringBuilder();
append(result, 1);
append(result, 2);
return result.toString();
}
/**
* Sets the Rate Source (components 1 and 2) as a unit
* @param rateSource the new expected value for components 1 and 2 concatenated
* @return the field object to enable build pattern
* @since 9.2.7
*/
public Field14S setRateSource(String rateSource) {
// get the parts
String source = SwiftParseUtils.getAlphaPrefix(rateSource);
String number = source == null ? rateSource : StringUtils.substringAfter(rateSource, source);
// set the values
setComponent1(StringUtils.trimToNull(source));
setComponent2(StringUtils.trimToNull(number));
return this;
}
/**
* Gets the Time And Location (components 3 and 4) as a unit
* @return the concatenated values of component 3 and 4 with the separating "/"
* @since 9.2.7
*/
public String getTimeAndLocation() {
// if both empty => just nothing
if (StringUtils.isBlank(getComponent3()) && StringUtils.isBlank(getComponent4())) {
return null;
}
// build
final StringBuilder result = new StringBuilder();
result.append("/");
append(result, 3);
result.append("/");
append(result, 4);
return result.toString();
}
/**
* Sets the Time And Location (components 3 and 4) as a unit
* @param timeAndLocation the new expected value for components 3 and 4 concatenated, including "/
* @return the field object to enable build pattern
* @since 9.2.7
*/
public Field14S setTimeAndLocation(String timeAndLocation) {
// get the parts
String time = null;
String location = null;
if (StringUtils.indexOf(timeAndLocation, '/') != -1) {
// get the parts and
timeAndLocation = SwiftParseUtils.removePrefix(timeAndLocation, "/");
time = SwiftParseUtils.getTokenFirst(timeAndLocation, "/");
location = SwiftParseUtils.getTokenSecond(timeAndLocation, "/");
}
// set the new component values
setComponent3(StringUtils.trimToNull(time));
setComponent4(StringUtils.trimToNull(location));
return this;
}
}
|
3e07c5c1b776212fe5c65e875ca3c75995b49111
| 13,170 |
java
|
Java
|
clients/jaxrs-jersey/generated/src/gen/java/org/openapitools/model/EnvironmentLinks.java
|
shinesolutions/cloudmanager-api-clients
|
d73a25878f6cc57af954362ba8dccc90d54e6131
|
[
"Apache-2.0"
] | 3 |
2020-06-23T05:31:52.000Z
|
2020-11-26T05:34:57.000Z
|
clients/jaxrs-jersey/generated/src/gen/java/org/openapitools/model/EnvironmentLinks.java
|
shinesolutions/cloudmanager-api-clients
|
d73a25878f6cc57af954362ba8dccc90d54e6131
|
[
"Apache-2.0"
] | 2 |
2021-01-21T01:19:54.000Z
|
2021-12-09T22:30:22.000Z
|
clients/jaxrs-jersey/generated/src/gen/java/org/openapitools/model/EnvironmentLinks.java
|
shinesolutions/cloudmanager-api-clients
|
d73a25878f6cc57af954362ba8dccc90d54e6131
|
[
"Apache-2.0"
] | 1 |
2020-11-18T11:48:13.000Z
|
2020-11-18T11:48:13.000Z
| 45.770833 | 535 | 0.81672 | 3,297 |
/*
* Cloud Manager API
* This API allows access to Cloud Manager programs, pipelines, and environments by an authorized technical account created through the Adobe I/O Console. The base url for this API is https://cloudmanager.adobe.io, e.g. to get the list of programs for an organization, you would make a GET request to https://cloudmanager.adobe.io/api/programs (with the correct set of headers as described below). This swagger file can be downloaded from https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml.
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.model.HalLink;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import javax.validation.constraints.*;
import javax.validation.Valid;
/**
* EnvironmentLinks
*/
@JsonPropertyOrder({
EnvironmentLinks.JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PROGRAM,
EnvironmentLinks.JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PIPELINE,
EnvironmentLinks.JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_AUTHOR,
EnvironmentLinks.JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PUBLISH,
EnvironmentLinks.JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_DEVELOPER_CONSOLE,
EnvironmentLinks.JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_LOGS,
EnvironmentLinks.JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_VARIABLES,
EnvironmentLinks.JSON_PROPERTY_SELF
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2020-06-22T02:54:02.008Z[GMT]")
public class EnvironmentLinks {
public static final String JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PROGRAM = "http://ns.adobe.com/adobecloud/rel/program";
@JsonProperty(JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PROGRAM)
private HalLink httpColonNsAdobeComAdobecloudRelProgram;
public static final String JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PIPELINE = "http://ns.adobe.com/adobecloud/rel/pipeline";
@JsonProperty(JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PIPELINE)
private HalLink httpColonNsAdobeComAdobecloudRelPipeline;
public static final String JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_AUTHOR = "http://ns.adobe.com/adobecloud/rel/author";
@JsonProperty(JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_AUTHOR)
private HalLink httpColonNsAdobeComAdobecloudRelAuthor;
public static final String JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PUBLISH = "http://ns.adobe.com/adobecloud/rel/publish";
@JsonProperty(JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_PUBLISH)
private HalLink httpColonNsAdobeComAdobecloudRelPublish;
public static final String JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_DEVELOPER_CONSOLE = "http://ns.adobe.com/adobecloud/rel/developerConsole";
@JsonProperty(JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_DEVELOPER_CONSOLE)
private HalLink httpColonNsAdobeComAdobecloudRelDeveloperConsole;
public static final String JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_LOGS = "http://ns.adobe.com/adobecloud/rel/logs";
@JsonProperty(JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_LOGS)
private HalLink httpColonNsAdobeComAdobecloudRelLogs;
public static final String JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_VARIABLES = "http://ns.adobe.com/adobecloud/rel/variables";
@JsonProperty(JSON_PROPERTY_HTTP_COLON_NS_ADOBE_COM_ADOBECLOUD_REL_VARIABLES)
private HalLink httpColonNsAdobeComAdobecloudRelVariables;
public static final String JSON_PROPERTY_SELF = "self";
@JsonProperty(JSON_PROPERTY_SELF)
private HalLink self;
public EnvironmentLinks httpColonNsAdobeComAdobecloudRelProgram(HalLink httpColonNsAdobeComAdobecloudRelProgram) {
this.httpColonNsAdobeComAdobecloudRelProgram = httpColonNsAdobeComAdobecloudRelProgram;
return this;
}
/**
* Get httpColonNsAdobeComAdobecloudRelProgram
* @return httpColonNsAdobeComAdobecloudRelProgram
**/
@JsonProperty("http://ns.adobe.com/adobecloud/rel/program")
@ApiModelProperty(value = "")
@Valid
public HalLink getHttpColonNsAdobeComAdobecloudRelProgram() {
return httpColonNsAdobeComAdobecloudRelProgram;
}
public void setHttpColonNsAdobeComAdobecloudRelProgram(HalLink httpColonNsAdobeComAdobecloudRelProgram) {
this.httpColonNsAdobeComAdobecloudRelProgram = httpColonNsAdobeComAdobecloudRelProgram;
}
public EnvironmentLinks httpColonNsAdobeComAdobecloudRelPipeline(HalLink httpColonNsAdobeComAdobecloudRelPipeline) {
this.httpColonNsAdobeComAdobecloudRelPipeline = httpColonNsAdobeComAdobecloudRelPipeline;
return this;
}
/**
* Get httpColonNsAdobeComAdobecloudRelPipeline
* @return httpColonNsAdobeComAdobecloudRelPipeline
**/
@JsonProperty("http://ns.adobe.com/adobecloud/rel/pipeline")
@ApiModelProperty(value = "")
@Valid
public HalLink getHttpColonNsAdobeComAdobecloudRelPipeline() {
return httpColonNsAdobeComAdobecloudRelPipeline;
}
public void setHttpColonNsAdobeComAdobecloudRelPipeline(HalLink httpColonNsAdobeComAdobecloudRelPipeline) {
this.httpColonNsAdobeComAdobecloudRelPipeline = httpColonNsAdobeComAdobecloudRelPipeline;
}
public EnvironmentLinks httpColonNsAdobeComAdobecloudRelAuthor(HalLink httpColonNsAdobeComAdobecloudRelAuthor) {
this.httpColonNsAdobeComAdobecloudRelAuthor = httpColonNsAdobeComAdobecloudRelAuthor;
return this;
}
/**
* Get httpColonNsAdobeComAdobecloudRelAuthor
* @return httpColonNsAdobeComAdobecloudRelAuthor
**/
@JsonProperty("http://ns.adobe.com/adobecloud/rel/author")
@ApiModelProperty(value = "")
@Valid
public HalLink getHttpColonNsAdobeComAdobecloudRelAuthor() {
return httpColonNsAdobeComAdobecloudRelAuthor;
}
public void setHttpColonNsAdobeComAdobecloudRelAuthor(HalLink httpColonNsAdobeComAdobecloudRelAuthor) {
this.httpColonNsAdobeComAdobecloudRelAuthor = httpColonNsAdobeComAdobecloudRelAuthor;
}
public EnvironmentLinks httpColonNsAdobeComAdobecloudRelPublish(HalLink httpColonNsAdobeComAdobecloudRelPublish) {
this.httpColonNsAdobeComAdobecloudRelPublish = httpColonNsAdobeComAdobecloudRelPublish;
return this;
}
/**
* Get httpColonNsAdobeComAdobecloudRelPublish
* @return httpColonNsAdobeComAdobecloudRelPublish
**/
@JsonProperty("http://ns.adobe.com/adobecloud/rel/publish")
@ApiModelProperty(value = "")
@Valid
public HalLink getHttpColonNsAdobeComAdobecloudRelPublish() {
return httpColonNsAdobeComAdobecloudRelPublish;
}
public void setHttpColonNsAdobeComAdobecloudRelPublish(HalLink httpColonNsAdobeComAdobecloudRelPublish) {
this.httpColonNsAdobeComAdobecloudRelPublish = httpColonNsAdobeComAdobecloudRelPublish;
}
public EnvironmentLinks httpColonNsAdobeComAdobecloudRelDeveloperConsole(HalLink httpColonNsAdobeComAdobecloudRelDeveloperConsole) {
this.httpColonNsAdobeComAdobecloudRelDeveloperConsole = httpColonNsAdobeComAdobecloudRelDeveloperConsole;
return this;
}
/**
* Get httpColonNsAdobeComAdobecloudRelDeveloperConsole
* @return httpColonNsAdobeComAdobecloudRelDeveloperConsole
**/
@JsonProperty("http://ns.adobe.com/adobecloud/rel/developerConsole")
@ApiModelProperty(value = "")
@Valid
public HalLink getHttpColonNsAdobeComAdobecloudRelDeveloperConsole() {
return httpColonNsAdobeComAdobecloudRelDeveloperConsole;
}
public void setHttpColonNsAdobeComAdobecloudRelDeveloperConsole(HalLink httpColonNsAdobeComAdobecloudRelDeveloperConsole) {
this.httpColonNsAdobeComAdobecloudRelDeveloperConsole = httpColonNsAdobeComAdobecloudRelDeveloperConsole;
}
public EnvironmentLinks httpColonNsAdobeComAdobecloudRelLogs(HalLink httpColonNsAdobeComAdobecloudRelLogs) {
this.httpColonNsAdobeComAdobecloudRelLogs = httpColonNsAdobeComAdobecloudRelLogs;
return this;
}
/**
* Get httpColonNsAdobeComAdobecloudRelLogs
* @return httpColonNsAdobeComAdobecloudRelLogs
**/
@JsonProperty("http://ns.adobe.com/adobecloud/rel/logs")
@ApiModelProperty(value = "")
@Valid
public HalLink getHttpColonNsAdobeComAdobecloudRelLogs() {
return httpColonNsAdobeComAdobecloudRelLogs;
}
public void setHttpColonNsAdobeComAdobecloudRelLogs(HalLink httpColonNsAdobeComAdobecloudRelLogs) {
this.httpColonNsAdobeComAdobecloudRelLogs = httpColonNsAdobeComAdobecloudRelLogs;
}
public EnvironmentLinks httpColonNsAdobeComAdobecloudRelVariables(HalLink httpColonNsAdobeComAdobecloudRelVariables) {
this.httpColonNsAdobeComAdobecloudRelVariables = httpColonNsAdobeComAdobecloudRelVariables;
return this;
}
/**
* Get httpColonNsAdobeComAdobecloudRelVariables
* @return httpColonNsAdobeComAdobecloudRelVariables
**/
@JsonProperty("http://ns.adobe.com/adobecloud/rel/variables")
@ApiModelProperty(value = "")
@Valid
public HalLink getHttpColonNsAdobeComAdobecloudRelVariables() {
return httpColonNsAdobeComAdobecloudRelVariables;
}
public void setHttpColonNsAdobeComAdobecloudRelVariables(HalLink httpColonNsAdobeComAdobecloudRelVariables) {
this.httpColonNsAdobeComAdobecloudRelVariables = httpColonNsAdobeComAdobecloudRelVariables;
}
public EnvironmentLinks self(HalLink self) {
this.self = self;
return this;
}
/**
* Get self
* @return self
**/
@JsonProperty("self")
@ApiModelProperty(value = "")
@Valid
public HalLink getSelf() {
return self;
}
public void setSelf(HalLink self) {
this.self = self;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EnvironmentLinks environmentLinks = (EnvironmentLinks) o;
return Objects.equals(this.httpColonNsAdobeComAdobecloudRelProgram, environmentLinks.httpColonNsAdobeComAdobecloudRelProgram) &&
Objects.equals(this.httpColonNsAdobeComAdobecloudRelPipeline, environmentLinks.httpColonNsAdobeComAdobecloudRelPipeline) &&
Objects.equals(this.httpColonNsAdobeComAdobecloudRelAuthor, environmentLinks.httpColonNsAdobeComAdobecloudRelAuthor) &&
Objects.equals(this.httpColonNsAdobeComAdobecloudRelPublish, environmentLinks.httpColonNsAdobeComAdobecloudRelPublish) &&
Objects.equals(this.httpColonNsAdobeComAdobecloudRelDeveloperConsole, environmentLinks.httpColonNsAdobeComAdobecloudRelDeveloperConsole) &&
Objects.equals(this.httpColonNsAdobeComAdobecloudRelLogs, environmentLinks.httpColonNsAdobeComAdobecloudRelLogs) &&
Objects.equals(this.httpColonNsAdobeComAdobecloudRelVariables, environmentLinks.httpColonNsAdobeComAdobecloudRelVariables) &&
Objects.equals(this.self, environmentLinks.self);
}
@Override
public int hashCode() {
return Objects.hash(httpColonNsAdobeComAdobecloudRelProgram, httpColonNsAdobeComAdobecloudRelPipeline, httpColonNsAdobeComAdobecloudRelAuthor, httpColonNsAdobeComAdobecloudRelPublish, httpColonNsAdobeComAdobecloudRelDeveloperConsole, httpColonNsAdobeComAdobecloudRelLogs, httpColonNsAdobeComAdobecloudRelVariables, self);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EnvironmentLinks {\n");
sb.append(" httpColonNsAdobeComAdobecloudRelProgram: ").append(toIndentedString(httpColonNsAdobeComAdobecloudRelProgram)).append("\n");
sb.append(" httpColonNsAdobeComAdobecloudRelPipeline: ").append(toIndentedString(httpColonNsAdobeComAdobecloudRelPipeline)).append("\n");
sb.append(" httpColonNsAdobeComAdobecloudRelAuthor: ").append(toIndentedString(httpColonNsAdobeComAdobecloudRelAuthor)).append("\n");
sb.append(" httpColonNsAdobeComAdobecloudRelPublish: ").append(toIndentedString(httpColonNsAdobeComAdobecloudRelPublish)).append("\n");
sb.append(" httpColonNsAdobeComAdobecloudRelDeveloperConsole: ").append(toIndentedString(httpColonNsAdobeComAdobecloudRelDeveloperConsole)).append("\n");
sb.append(" httpColonNsAdobeComAdobecloudRelLogs: ").append(toIndentedString(httpColonNsAdobeComAdobecloudRelLogs)).append("\n");
sb.append(" httpColonNsAdobeComAdobecloudRelVariables: ").append(toIndentedString(httpColonNsAdobeComAdobecloudRelVariables)).append("\n");
sb.append(" self: ").append(toIndentedString(self)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
3e07c71269e191d160d7dd063f28067f1ea47f1c
| 814 |
java
|
Java
|
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java
|
jovi521/ruoyi-springboot-vue-update
|
2a5af6e9a571389051dedb302507c3be0b26f710
|
[
"Apache-2.0"
] | null | null | null |
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java
|
jovi521/ruoyi-springboot-vue-update
|
2a5af6e9a571389051dedb302507c3be0b26f710
|
[
"Apache-2.0"
] | null | null | null |
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java
|
jovi521/ruoyi-springboot-vue-update
|
2a5af6e9a571389051dedb302507c3be0b26f710
|
[
"Apache-2.0"
] | null | null | null | 14.535714 | 54 | 0.584767 | 3,298 |
package com.ruoyi.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.List;
/**
* 路由配置信息
*
* @author ruoyi
*/
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RouterVo {
/**
* 路由名字
*/
private String name;
/**
* 路由地址
*/
private String path;
/**
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
*/
private boolean hidden;
/**
* 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
*/
private String redirect;
/**
* 组件地址
*/
private String component;
/**
* 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
*/
private Boolean alwaysShow;
/**
* 其他元素
*/
private MetaVo meta;
/**
* 子路由
*/
private List<RouterVo> children;
}
|
3e07c954a1ec813ad40c5e9846c5945dd313abe7
| 1,482 |
java
|
Java
|
portal/src/main/java/usi/dbdp/portal/dto/LoginLogInfo.java
|
pyplzy/mylab
|
c3a897f217d871f3d66e15d0ebbc3325a4ec8910
|
[
"MIT"
] | null | null | null |
portal/src/main/java/usi/dbdp/portal/dto/LoginLogInfo.java
|
pyplzy/mylab
|
c3a897f217d871f3d66e15d0ebbc3325a4ec8910
|
[
"MIT"
] | null | null | null |
portal/src/main/java/usi/dbdp/portal/dto/LoginLogInfo.java
|
pyplzy/mylab
|
c3a897f217d871f3d66e15d0ebbc3325a4ec8910
|
[
"MIT"
] | null | null | null | 17.855422 | 62 | 0.717274 | 3,299 |
package usi.dbdp.portal.dto;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 登录日志dto
* @author ma.guangming
*
*/
public class LoginLogInfo implements Serializable {
/** 默认serialVersionUID*/
private static final long serialVersionUID = 1L;
private long loginId;//登录ID
private String userId;//登录帐号
private String loginIp;//登录IP
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date loginTime;//登录时间
private int isSuccess;//登录结果(0:失败,1:成功)
private String userName;//用户姓名
private String orgName;//机构名称
public long getLoginId() {
return loginId;
}
public void setLoginId(long loginId) {
this.loginId = loginId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public Date getLoginTime() {
return loginTime;
}
public void setLoginTime(Date loginTime) {
this.loginTime = loginTime;
}
public int getIsSuccess() {
return isSuccess;
}
public void setIsSuccess(int isSuccess) {
this.isSuccess = isSuccess;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
}
|
3e07c9f21a3ceb730f5f89a48f982fa4686440b1
| 613 |
java
|
Java
|
src/main/java/edu/fiuba/algo3/interfaz/estilos/estilosBotonBonificacion/EstilosBotonMultiplicadorX2.java
|
joaquinfontela/tp2-algo3
|
f749943385156b25ddde660d6514ae97f83d463a
|
[
"MIT"
] | null | null | null |
src/main/java/edu/fiuba/algo3/interfaz/estilos/estilosBotonBonificacion/EstilosBotonMultiplicadorX2.java
|
joaquinfontela/tp2-algo3
|
f749943385156b25ddde660d6514ae97f83d463a
|
[
"MIT"
] | null | null | null |
src/main/java/edu/fiuba/algo3/interfaz/estilos/estilosBotonBonificacion/EstilosBotonMultiplicadorX2.java
|
joaquinfontela/tp2-algo3
|
f749943385156b25ddde660d6514ae97f83d463a
|
[
"MIT"
] | null | null | null | 34.055556 | 115 | 0.792822 | 3,300 |
package edu.fiuba.algo3.interfaz.estilos.estilosBotonBonificacion;
import edu.fiuba.algo3.interfaz.botones.Boton;
import javafx.geometry.Insets;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.paint.Color;
public class EstilosBotonMultiplicadorX2 extends EstilosBotonMultiplicador {
public EstilosBotonMultiplicadorX2(Boton unBoton) {
super(unBoton);
boton.setBackground(new Background(new BackgroundFill(Color.DARKORANGE, CornerRadii.EMPTY, Insets.EMPTY)));
boton.setText("X2");
}
}
|
3e07caa843c5ac977b06f769a3d34eaa186b50d6
| 2,049 |
java
|
Java
|
service.data.impl/src/main/java/com/hack23/cia/service/data/impl/ViewRiksdagenCommitteeDAOImpl.java
|
TrisA/cia
|
c67d638ec50b47afb9a033eae6e350fa514a0469
|
[
"Apache-2.0"
] | 75 |
2015-08-01T15:31:54.000Z
|
2022-03-19T12:07:06.000Z
|
service.data.impl/src/main/java/com/hack23/cia/service/data/impl/ViewRiksdagenCommitteeDAOImpl.java
|
TrisA/cia
|
c67d638ec50b47afb9a033eae6e350fa514a0469
|
[
"Apache-2.0"
] | 2,662 |
2016-12-16T17:27:08.000Z
|
2022-03-28T09:32:36.000Z
|
service.data.impl/src/main/java/com/hack23/cia/service/data/impl/ViewRiksdagenCommitteeDAOImpl.java
|
TrisA/cia
|
c67d638ec50b47afb9a033eae6e350fa514a0469
|
[
"Apache-2.0"
] | 38 |
2017-03-03T23:15:18.000Z
|
2021-12-31T19:07:13.000Z
| 34.15 | 98 | 0.79551 | 3,301 |
/*
* Copyright 2010-2021 James Pether Sörling
*
* 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.
*
* $Id$
* $HeadURL$
*/
package com.hack23.cia.service.data.impl;
import java.util.List;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.springframework.stereotype.Repository;
import com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenCommitteeEmbeddedId;
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee;
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee_;
import com.hack23.cia.service.data.api.ViewRiksdagenCommitteeDAO;
/**
* The Class ViewRiksdagenCommitteeDAOImpl.
*/
@Repository("ViewRiksdagenCommitteeDAO")
final class ViewRiksdagenCommitteeDAOImpl
extends
AbstractGenericDAOImpl<ViewRiksdagenCommittee, RiksdagenCommitteeEmbeddedId>
implements ViewRiksdagenCommitteeDAO {
/**
* Instantiates a new view riksdagen committee dao impl.
*/
public ViewRiksdagenCommitteeDAOImpl() {
super(ViewRiksdagenCommittee.class);
}
@Override
public List<RiksdagenCommitteeEmbeddedId> getIdList() {
final CriteriaQuery<RiksdagenCommitteeEmbeddedId> criteria = getCriteriaBuilder()
.createQuery(RiksdagenCommitteeEmbeddedId.class);
final Root<ViewRiksdagenCommittee> root = criteria
.from(ViewRiksdagenCommittee.class);
criteria.select(root.get(ViewRiksdagenCommittee_.embeddedId));
return getEntityManager().createQuery(criteria).getResultList();
}
}
|
3e07caef1ecbce13bbbcbdc8b8d9f68fb84ed1e7
| 1,340 |
java
|
Java
|
src/main/java/com/soares/cadastrocliente/api/entities/Telefone.java
|
elieziobr/cadastro-cliente-servidor
|
59bcb64f9f602e9249a99df9417d53b3985f622b
|
[
"MIT"
] | null | null | null |
src/main/java/com/soares/cadastrocliente/api/entities/Telefone.java
|
elieziobr/cadastro-cliente-servidor
|
59bcb64f9f602e9249a99df9417d53b3985f622b
|
[
"MIT"
] | null | null | null |
src/main/java/com/soares/cadastrocliente/api/entities/Telefone.java
|
elieziobr/cadastro-cliente-servidor
|
59bcb64f9f602e9249a99df9417d53b3985f622b
|
[
"MIT"
] | null | null | null | 18.873239 | 57 | 0.625373 | 3,302 |
package com.soares.cadastrocliente.api.entities;
import com.soares.cadastrocliente.api.enums.TipoTelefone;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "telefone")
public class Telefone implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "ddd")
private String ddd;
@Column(name = "numero")
private String numero;
@Enumerated(EnumType.STRING)
@Column(name = "tipo")
private TipoTelefone tipo;
@ManyToOne
@JoinColumn(name = "id_cliente")
private Cliente cliente;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDdd() {
return ddd;
}
public void setDdd(String ddd) {
this.ddd = ddd;
}
public String getNumero() {
return numero;
}
public void setNumero(String numero) {
this.numero = numero;
}
public TipoTelefone getTipo() {
return tipo;
}
public void setTipo(TipoTelefone tipo) {
this.tipo = tipo;
}
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
}
|
3e07cd485c6978bf306f0d014373bb8bf01a157d
| 4,758 |
java
|
Java
|
MCLN-SEM/src/main/java/sem/appui/controller/BasicOperationRequest.java
|
dsdsam/Kaleidoscope
|
6dcbeb126f645ca58a9f0619bb403c0f8cf1ecbc
|
[
"MIT"
] | 1 |
2018-01-08T02:15:32.000Z
|
2018-01-08T02:15:32.000Z
|
MCLN-SEM/src/main/java/sem/appui/controller/BasicOperationRequest.java
|
dsdsam/Kaleidoscope
|
6dcbeb126f645ca58a9f0619bb403c0f8cf1ecbc
|
[
"MIT"
] | null | null | null |
MCLN-SEM/src/main/java/sem/appui/controller/BasicOperationRequest.java
|
dsdsam/Kaleidoscope
|
6dcbeb126f645ca58a9f0619bb403c0f8cf1ecbc
|
[
"MIT"
] | null | null | null | 32.813793 | 135 | 0.711854 | 3,303 |
package sem.appui.controller;
import sem.infrastructure.OperationRequestStatus;
import sem.mission.controlles.modelcontroller.BasicOperationExecutionController;
import sem.mission.controlles.modelcontroller.actions.ServiceExecutionListener;
/**
* Created by IntelliJ IDEA.
* User: VL
* Date: Nov 2, 2011
* Time: 10:32:38 PM
* To change this template use File | Settings | File Templates.
*/
public class BasicOperationRequest<OT,DT> {
public static final BasicOperationRequest createBasicOperationRequest(Enum operation, Object argument,
ServiceExecutionListener serviceExecutionListener,
OperationExecutionListener operationExecutionListener) {
return new BasicOperationRequest(operation, argument, serviceExecutionListener, operationExecutionListener);
}
protected static long instanceCnt;
private long requestID;
private OT operation;
private OT actualOperation;
private DT argument;
private BasicOperationExecutionController sourceBasicOperationExecutionController;
private ServiceExecutionListener serviceExecutionListener;
OperationExecutionListener operationExecutionListener;
// response
private OperationRequestStatus operationRequestStatus = OperationRequestStatus.SUCCESS;
private boolean executingFromQueue;
BasicOperationRequest(OT operation, DT argument,
ServiceExecutionListener serviceExecutionListener,
OperationExecutionListener operationExecutionListener) {
requestID = ++instanceCnt;
this.operation = operation;
this.argument = argument;
this.serviceExecutionListener = serviceExecutionListener;
this.operationExecutionListener = operationExecutionListener;
}
public BasicOperationExecutionController getSourceBasicOperationExecutionController() {
return sourceBasicOperationExecutionController;
}
public void setSourceBasicOperationExecutionController(BasicOperationExecutionController sourceBasicOperationExecutionController) {
this.sourceBasicOperationExecutionController = sourceBasicOperationExecutionController;
}
public OT getActualOperation() {
return actualOperation;
}
public void setActualOperation(OT actualOperation) {
this.actualOperation = actualOperation;
}
public long getRequestID() {
return requestID;
}
public OT getRequestedOperation() {
return operation;
}
public boolean isArgumentAssigned() {
return argument != null;
}
public void setArgument(DT argument) {
this.argument = argument;
}
public DT getArgument() {
return argument;
}
public ServiceExecutionListener getServiceExecutionListener() {
return serviceExecutionListener;
}
public OperationExecutionListener getOperationExecutionListener() {
return operationExecutionListener;
}
public OperationRequestStatus getOperationRequestStatus() {
return operationRequestStatus;
}
public boolean isRequestEnqueued() {
return operationRequestStatus == OperationRequestStatus.ENQUEUED;
}
public void setRequestEnqueued() {
this.operationRequestStatus = OperationRequestStatus.ENQUEUED;
executingFromQueue = true;
}
public boolean isExecutingFromQueue() {
return executingFromQueue;
}
public boolean isRequestExecutedSuccessfully() {
return operationRequestStatus == OperationRequestStatus.SUCCESS;
}
public void setRequestExecutedSuccessfully() {
this.operationRequestStatus = OperationRequestStatus.SUCCESS;
}
public boolean isRequestFailed() {
return operationRequestStatus == OperationRequestStatus.FAILURE;
}
public void setRequestFailed() {
this.operationRequestStatus = OperationRequestStatus.FAILURE;
}
public boolean isTimeout() {
return operationRequestStatus == OperationRequestStatus.TIMEOUT;
}
public void setTimeout() {
this.operationRequestStatus = OperationRequestStatus.TIMEOUT;
}
public boolean isOperationInterrupted() {
return operationRequestStatus == OperationRequestStatus.INTERRUPTED;
}
public void setOperationInterrupted() {
this.operationRequestStatus = OperationRequestStatus.INTERRUPTED;
}
public String toString() {
return "Operation Request: ID= " + requestID + ", operation = " + operation + ", status = " +
operationRequestStatus+", executed from queue = "+executingFromQueue;
}
}
|
3e07cd4ca2d41140dec589ea7bbf982bd3b08b6d
| 8,993 |
java
|
Java
|
src/magPanel.java
|
tvelliott/jNanoVNA
|
3c94e0027eead7964c5dad6655b1069ba3f91419
|
[
"MIT"
] | 2 |
2019-09-08T00:50:20.000Z
|
2019-10-04T22:14:53.000Z
|
src/magPanel.java
|
tvelliott/jNanoVNA
|
3c94e0027eead7964c5dad6655b1069ba3f91419
|
[
"MIT"
] | null | null | null |
src/magPanel.java
|
tvelliott/jNanoVNA
|
3c94e0027eead7964c5dad6655b1069ba3f91419
|
[
"MIT"
] | 1 |
2019-10-19T01:39:32.000Z
|
2019-10-19T01:39:32.000Z
| 27.670769 | 119 | 0.543534 | 3,304 |
/*
MIT License
Copyright (c) 2019 tvelliott
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
import java.util.*;
import java.lang.Math.*;
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
public class magPanel extends JPanel
{
int w;
int h;
int hw;
int hh;
int cx;
int cy;
double freq_mhz[];
double scale_factor = 0.85;
Color bg;
Color fg;
Color line_color;
Color vswr_color;
boolean do_antialias=false;
double inset1 = 100.0;
double inset2 = inset1*2.0;
int inseth = (int) (inset1/4.0);
int inseth2 = (int) (inset1/2.0);
int inset3 = (int) (inset1);
int inset4 = (int) (inset1*2);
Line2D.Double l2d=null;
double[] mags_s11;
double[] mags_s21;
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
public magPanel()
{
line_color = new Color(210,210,210);
fg = Color.black;
bg = new Color(200,200,200);
vswr_color = Color.blue;
do_antialias=true;
setPreferredSize( new Dimension(1024,768) );
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
public void plotS11(double freq[], double[] mag)
{
if(freq==null || freq.length==0) return;
freq_mhz = freq;
mags_s11 = mag;
for(int i=0; i<mags_s11.length; i++) {
mags_s11[i] -= 10.0; //adjust for nanoVNA output
}
repaint();
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
public void plotS21(double freq[], double[] mag)
{
if(freq==null || freq.length==0) return;
freq_mhz = freq;
mags_s21 = mag;
for(int i=0; i<mags_s21.length; i++) {
mags_s21[i] -= 10.0; //adjust for nanoVNA output
}
repaint();
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
public void paint(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
Font font = new Font("Arial", Font.PLAIN, 18);
g2d.setFont(font);
if(do_antialias) {
g2d.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.setRenderingHint(
RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
}
w = getWidth();
h = getHeight();
cx = w/2;
cy = h/2;
hw = w/2;
hh = h/2;
//clear background
g2d.setColor( bg );
g2d.fillRect( 0,0,w,h);
g2d.setColor( Color.white );
BasicStroke bs = new BasicStroke((float) inset1);
g2d.setStroke(bs);
Rectangle2D.Double bgr = new Rectangle2D.Double(inseth*2.0,inseth*2.0,w-inseth2*2.0,h-inseth2*2.0);
g2d.draw(bgr);
bs = new BasicStroke(2.0f);
g2d.setStroke(bs);
//draw inner border line
g2d.setColor( Color.black );
bgr = new Rectangle2D.Double(inset3,inset3,w-inset4,h-inset4);
g2d.draw(bgr);
//draw outer border line
g2d.setColor( Color.black );
bgr = new Rectangle2D.Double(1,1,w-2,h-2);
g2d.draw(bgr);
double yt = inset1;
double yb = h-inset1;
double stepy = (yb-yt)/20.0;
double yst = yt+stepy;
double hl = inset1;
double hr = w-inset1;
double stepx = (hr-hl)/10.0;
double xst = (double) hl+(double) stepx;
//find min in both datasets
double min = 0.0;
int len = freq_mhz.length;
//for(int j=0; j<len; j++) {
// if(mags_s11[j]<min) min = mags_s11[j];
//}
min = -100.0; //fixed min
//auto-range y-axis for dB mag
//double modval = min;
//if(modval > -0.5) modval = 1.0;
//else if(modval > -40.0) modval = 2.0;
//else if(modval > -80.0) modval = 5.0;
//else modval = 10.0;
double modval = 10.0;
double modmin = (min-modval)%modval;
modmin = min-modmin;
modmin -= modval;
double modstep = modval;
//insertion loss / return loss
font = new Font("Arial", Font.PLAIN, 12);
g2d.setFont(font);
bs = new BasicStroke(1.0f);
g2d.setPaint(Color.black);
yst = 0.0;
double magdb = 10.0;
int nsteps = (int) Math.abs((modmin/modstep));
stepy = (yb-yt)/(double)nsteps-1;
yst = yt+6;
for( int x=0; x<nsteps+1; x++) {
g2d.setPaint(Color.black);
g2d.drawString(String.format("%3.1f",magdb), 60, (int)yst);
g2d.setPaint(line_color);
l2d = new Line2D.Double( (double) inset1+5.0, (double) yst, (double) (w-inset1)-5.0, (double) yst);
g2d.draw(l2d);
yst += stepy;
magdb -= modstep;
}
int n_xtick=10;
if( w>1024 ) n_xtick=20;
stepx = (hr-hl)/(double)n_xtick;
xst -= stepx;
//draw grid lines
for( int y=0; y<n_xtick-1; y++) {
l2d = new Line2D.Double( (double) xst, (double) yt+5.0, (double) xst, (double) yb-5.0);
g2d.setPaint(line_color);
g2d.draw(l2d);
xst += stepx;
}
//draw x / freq axis
xst = hl-20.0;
double fst = freq_mhz[0];
double fend = freq_mhz[freq_mhz.length-1];
double fstep = (fend-fst)/(double)n_xtick;
//frequency
for( int y=0; y<n_xtick+1; y++) {
g2d.setPaint(Color.black);
if(y==0) g2d.drawString(String.format("%3.2f",(fst+fstep*(double)y)/1e6), (int) (xst+stepx*0.15), (int)(yb+20));
else g2d.drawString(String.format("%3.1f",(fst+fstep*(double)y)/1e6), (int) (xst+stepx*0.15), (int)(yb+20));
xst+=stepx;
}
//draw lines last
double px=0.0;
double py=0.0;
bs = new BasicStroke(1.0f);
g2d.setStroke(bs);
g2d.setPaint(fg);
font = new Font("Arial", Font.PLAIN, 22);
g2d.setFont(font);
g2d.drawString("S-Parameters",hw-70,75);
g2d.drawString("Frequency (MHz)",hw-100,h-inseth);
AffineTransform atorg = g2d.getTransform();
AffineTransform at = new AffineTransform();
at.translate(30,cy+50);
at.rotate(Math.toRadians(-90));
g2d.transform(at);
g2d.drawString("Return Loss (dB)", 0, 0);
g2d.setTransform(atorg);
font = new Font("Arial", Font.PLAIN, 12);
g2d.setFont(font);
g2d.setPaint(Color.blue);
g2d.drawString("S11 _____", 50,50);
if(mags_s11!=null) {
for(int i=0; i<len; i++) {
double mag = mags_s11[i];
double slope = (yt-yb) / (0.0-modmin);
double intercept = ((yt+yb)/2.0) - (slope * ((0.0+modmin)/2.0));
mag *= slope;
mag += intercept;
double x = inset1 + (freq_mhz[i]/freq_mhz[len-1]) * (w-inset2);
double y = mag+3; //3 offset to get it on the grid line
if(px>0) {
l2d = new Line2D.Double( (double) px, (double) py, (double) x, (double) y);
g2d.draw(l2d);
}
px = x;
py = y;
}
}
g2d.setPaint(Color.red);
g2d.drawString("S21 _____", 50,70);
//draw lines last
px=0.0;
py=0.0;
if(mags_s21!=null) {
for(int i=0; i<len; i++) {
double mag = mags_s21[i];
double slope = (yt-yb) / (0.0-modmin);
double intercept = ((yt+yb)/2.0) - (slope * ((0.0+modmin)/2.0));
mag *= slope;
mag += intercept;
double x = inset1 + (freq_mhz[i]/freq_mhz[len-1]) * (w-inset2);
double y = mag+3; //3 offset to get it on the grid line
if(px>0) {
l2d = new Line2D.Double( (double) px, (double) py, (double) x, (double) y);
g2d.draw(l2d);
}
px = x;
py = y;
}
}
}
}
|
3e07cd69329e01303f4494f776069a17ec09ae97
| 1,970 |
java
|
Java
|
TODO-categorise-past-exercises/main/java/com/dkafetzi/kata/testdome/java/twoSum/TwoSum.java
|
amolofos/kata
|
55efb173bbe9f38af724dc9d821f2d4cdc774482
|
[
"MIT"
] | null | null | null |
TODO-categorise-past-exercises/main/java/com/dkafetzi/kata/testdome/java/twoSum/TwoSum.java
|
amolofos/kata
|
55efb173bbe9f38af724dc9d821f2d4cdc774482
|
[
"MIT"
] | null | null | null |
TODO-categorise-past-exercises/main/java/com/dkafetzi/kata/testdome/java/twoSum/TwoSum.java
|
amolofos/kata
|
55efb173bbe9f38af724dc9d821f2d4cdc774482
|
[
"MIT"
] | null | null | null | 25.584416 | 73 | 0.528934 | 3,305 |
/*
* https://www.testdome.com/d/java-interview-questions/4
*
* 4. Two Sum
*
* Write a function that, when passed a list and a target sum,
* returns two distinct zero-based indices of any two of the numbers,
* whose sum is equal to the target sum. If there are no two numbers,
* the function should return null.
*
* For example, findTwoSum(new int[] { 3, 1, 5, 7, 5, 9 }, 10) should
* return a single dimensional array with two elements and contain any of
* the following pairs of indices:
* 0 and 3 (or 3 and 0) as 3 + 7 = 10
* 1 and 5 (or 5 and 1) as 1 + 9 = 10
* 2 and 4 (or 4 and 2) as 5 + 5 = 10
*/
package com.dkafetzi.kata.testdome.java.twoSum;
import java.util.ArrayList;
import java.util.List;
public class TwoSum {
public static int[] findTwoSum(int[] list, int sum) {
Integer x = null;
Integer y = null;
boolean found = false;
for (int i = 0; i < list.length - 1 && !found; i++) {
for (int j = i + 1; j < list.length && !found; j++) {
if (list[i] == list[j]) {
continue;
}
int temp_sum = list[i] + list[j];
if (temp_sum == sum) {
x = i;
y = j;
found = true;
break;
}
}
}
return x == null ? null : new int[] {x.intValue(), y.intValue()};
}
public static int[] findTwoSum_with_ArrayList(int[] list, int sum) {
List<Integer> findings = new ArrayList<Integer>();
for (int i = 0; i < list.length - 1; i++) {
for (int j = i + 1; j < list.length; j++) {
if (list[i] == list[j]) {
continue;
}
int temp_sum = list[i] + list[j];
if (temp_sum == sum) {
findings.add(i);
findings.add(j);
break;
}
}
}
if (findings.size() == 0) {
return null;
}
int[] arr = new int[2];
arr[0] = findings.get(0);
arr[1] = findings.get(1);
return arr;
}
}
|
3e07cd7487a3ecafe00470265bf8150d777f5ecb
| 1,873 |
java
|
Java
|
spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java
|
eas5/tutorials
|
4b460a9e25f6f0b0292e98144add0ce631a9e05e
|
[
"MIT"
] | 32,544 |
2015-01-02T16:59:22.000Z
|
2022-03-31T21:04:05.000Z
|
spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java
|
eas5/tutorials
|
4b460a9e25f6f0b0292e98144add0ce631a9e05e
|
[
"MIT"
] | 1,577 |
2015-02-21T17:47:03.000Z
|
2022-03-31T14:25:58.000Z
|
spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/optionalpathvars/ArticleViewerControllerIntegrationTest.java
|
eas5/tutorials
|
4b460a9e25f6f0b0292e98144add0ce631a9e05e
|
[
"MIT"
] | 55,853 |
2015-01-01T07:52:09.000Z
|
2022-03-31T21:08:15.000Z
| 34.054545 | 82 | 0.742125 | 3,306 |
package com.baeldung.web.controller.optionalpathvars;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import com.baeldung.spring.web.config.WebConfig;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { WebConfig.class })
public class ArticleViewerControllerIntegrationTest {
@Autowired
private WebApplicationContext wac;
private MockMvc mockMvc;
@Before
public void setup() throws Exception {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
}
@Test
public void whenIdPathVariableIsPassed_thenResponseOK() throws Exception {
int articleId = 5;
this.mockMvc
.perform(MockMvcRequestBuilders.get("/article/{id}", articleId))
.andExpect(MockMvcResultMatchers.status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$.id").value(articleId));
}
@Test
public void whenIdPathVariableIsNotPassed_thenResponse500() throws Exception {
this.mockMvc
.perform(MockMvcRequestBuilders.get("/article"))
.andExpect(MockMvcResultMatchers.status().isInternalServerError());
}
}
|
3e07cfbcdb5fb60dbdb15e2372f59066355f2403
| 1,045 |
java
|
Java
|
src/main/java/com/sda/dao/UserDaoHiberImpl.java
|
GeorgyBA/ChatApp
|
78c546da0b6f5242a3ff2e8d903bcb1a95856771
|
[
"MIT"
] | null | null | null |
src/main/java/com/sda/dao/UserDaoHiberImpl.java
|
GeorgyBA/ChatApp
|
78c546da0b6f5242a3ff2e8d903bcb1a95856771
|
[
"MIT"
] | null | null | null |
src/main/java/com/sda/dao/UserDaoHiberImpl.java
|
GeorgyBA/ChatApp
|
78c546da0b6f5242a3ff2e8d903bcb1a95856771
|
[
"MIT"
] | null | null | null | 30.735294 | 124 | 0.711962 | 3,307 |
package com.sda.dao;
import com.sda.model.Role;
import com.sda.model.User;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
@Repository
public class UserDaoHiberImpl implements UserDao {
@PersistenceContext
private EntityManager session;
@Override
public User getByLoginAndPassword(String login, String password) {
TypedQuery<User> query = session.createQuery("Select x FROM User x Where x.login=:e and x.password=:p", User.class);
query.setParameter("e", login);
query.setParameter("p", password);
System.out.println(query.getSingleResult());
return query.getSingleResult();
}
@Override
public User getByLogin(String login) {
TypedQuery<User> query = session.createQuery("Select x FROM User x Where x.login=:e ", User.class);
query.setParameter("e", login);
User user =query.getSingleResult();
return user;
}
}
|
3e07d02e9d9eef45ded2144c6494c8b72c1606bb
| 754 |
java
|
Java
|
src/main/java/com/kahramani/mancala/application/model/response/ErrorResponse.java
|
kahramani/mancala
|
e91199613594c88dc1e20e36486488117a1718aa
|
[
"MIT"
] | null | null | null |
src/main/java/com/kahramani/mancala/application/model/response/ErrorResponse.java
|
kahramani/mancala
|
e91199613594c88dc1e20e36486488117a1718aa
|
[
"MIT"
] | null | null | null |
src/main/java/com/kahramani/mancala/application/model/response/ErrorResponse.java
|
kahramani/mancala
|
e91199613594c88dc1e20e36486488117a1718aa
|
[
"MIT"
] | null | null | null | 23.5625 | 65 | 0.618037 | 3,308 |
package com.kahramani.mancala.application.model.response;
public class ErrorResponse implements Response {
private String errorCode;
private String errorMessage;
public ErrorResponse() {
}
public ErrorResponse(String errorCode, String errorMessage) {
this.errorCode = errorCode;
this.errorMessage = errorMessage;
}
public String getErrorCode() {
return errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
@Override
public String toString() {
return String.format(
"%s{errorCode=%s, errorMessage=%s}",
this.getClass().getSimpleName(),
getErrorCode(),
getErrorMessage());
}
}
|
3e07d10791f0ad2087302e0d9d4b49a1b657eeb7
| 2,925 |
java
|
Java
|
src/main/gen/com/github/nthykier/debpkg/dch/psi/DchTypes.java
|
nthykier/IDEA-debpkg
|
738f4572197f5035039278a1d9e8376a733a8577
|
[
"Apache-2.0"
] | 2 |
2021-08-17T15:28:34.000Z
|
2022-03-12T21:45:30.000Z
|
src/main/gen/com/github/nthykier/debpkg/dch/psi/DchTypes.java
|
nthykier/IDEA-debpkg
|
738f4572197f5035039278a1d9e8376a733a8577
|
[
"Apache-2.0"
] | 36 |
2020-07-22T07:04:53.000Z
|
2022-03-31T15:10:40.000Z
|
src/main/gen/com/github/nthykier/debpkg/dch/psi/DchTypes.java
|
nthykier/IDEA-debpkg
|
738f4572197f5035039278a1d9e8376a733a8577
|
[
"Apache-2.0"
] | null | null | null | 42.391304 | 77 | 0.73812 | 3,309 |
// This is a generated file. Not intended for manual editing.
package com.github.nthykier.debpkg.dch.psi;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.PsiElement;
import com.intellij.lang.ASTNode;
import com.github.nthykier.debpkg.dch.psi.impl.*;
public interface DchTypes {
IElementType CHANGELOG_ENTRY = new DchElementType("CHANGELOG_ENTRY");
IElementType CHANGELOG_LINE = new DchElementType("CHANGELOG_LINE");
IElementType CHANGE_DESCRIPTION = new DchElementType("CHANGE_DESCRIPTION");
IElementType DISTRIBUTION = new DchElementType("DISTRIBUTION");
IElementType SIGNOFF = new DchElementType("SIGNOFF");
IElementType SIGNOFF_DATE = new DchElementType("SIGNOFF_DATE");
IElementType SOURCE = new DchElementType("SOURCE");
IElementType VERSION_LINE = new DchElementType("VERSION_LINE");
IElementType CHANGE_BULLET_POINT = new DchTokenType("CHANGE_BULLET_POINT");
IElementType CHANGE_DETAILS = new DchTokenType("CHANGE_DETAILS");
IElementType CHANGE_RESPONSIBLE = new DchTokenType("CHANGE_RESPONSIBLE");
IElementType DISTRIBUTION_NAME = new DchTokenType("DISTRIBUTION_NAME");
IElementType DOUBLE_SPACE = new DchTokenType("DOUBLE_SPACE");
IElementType GREATER_THAN = new DchTokenType("GREATER_THAN");
IElementType KEYVALUE_PAIR = new DchTokenType("KEYVALUE_PAIR");
IElementType LESS_THAN = new DchTokenType("LESS_THAN");
IElementType MAINTAINER_EMAIL = new DchTokenType("MAINTAINER_EMAIL");
IElementType MAINTAINER_NAME = new DchTokenType("MAINTAINER_NAME");
IElementType PARANTHESES_CLOSE = new DchTokenType("PARANTHESES_CLOSE");
IElementType PARANTHESES_OPEN = new DchTokenType("PARANTHESES_OPEN");
IElementType SEMI_COLON = new DchTokenType("SEMI_COLON");
IElementType SIGNOFF_DATE_TOKEN = new DchTokenType("SIGNOFF_DATE_TOKEN");
IElementType SIGNOFF_STARTER = new DchTokenType("SIGNOFF_STARTER");
IElementType SOURCE_NAME = new DchTokenType("SOURCE_NAME");
IElementType VERSION = new DchTokenType("VERSION");
class Factory {
public static PsiElement createElement(ASTNode node) {
IElementType type = node.getElementType();
if (type == CHANGELOG_ENTRY) {
return new DchChangelogEntryImpl(node);
}
else if (type == CHANGELOG_LINE) {
return new DchChangelogLineImpl(node);
}
else if (type == CHANGE_DESCRIPTION) {
return new DchChangeDescriptionImpl(node);
}
else if (type == DISTRIBUTION) {
return new DchDistributionImpl(node);
}
else if (type == SIGNOFF) {
return new DchSignoffImpl(node);
}
else if (type == SIGNOFF_DATE) {
return new DchSignoffDateImpl(node);
}
else if (type == SOURCE) {
return new DchSourceImpl(node);
}
else if (type == VERSION_LINE) {
return new DchVersionLineImpl(node);
}
throw new AssertionError("Unknown element type: " + type);
}
}
}
|
3e07d22e0cd45edeb7ec0e4032d1d8b90a15ed94
| 303 |
java
|
Java
|
src/edu/osu/cse/pa/spg/ArrayElementField.java
|
jyothivedurada/BatchAnalyzer
|
520836e13d1a52291aa9cdcb719a721b0c08eef8
|
[
"BSD-3-Clause"
] | 1 |
2019-09-18T11:03:12.000Z
|
2019-09-18T11:03:12.000Z
|
src/edu/osu/cse/pa/spg/ArrayElementField.java
|
jyothivedurada/BatchAnalyzer
|
520836e13d1a52291aa9cdcb719a721b0c08eef8
|
[
"BSD-3-Clause"
] | null | null | null |
src/edu/osu/cse/pa/spg/ArrayElementField.java
|
jyothivedurada/BatchAnalyzer
|
520836e13d1a52291aa9cdcb719a721b0c08eef8
|
[
"BSD-3-Clause"
] | null | null | null | 18.9375 | 69 | 0.759076 | 3,310 |
package edu.osu.cse.pa.spg;
import soot.SootField;
public class ArrayElementField extends SootField {
private static ArrayElementField instance = new ArrayElementField();
public static ArrayElementField v() {
return instance;
}
public ArrayElementField() {
super("arrayElement", null);
}
}
|
3e07d30e9e7e76c9a437f05ef479feac618b5560
| 3,404 |
java
|
Java
|
src/main/java/com/jianma/fzkb/dao/impl/CorporationDaoImpl.java
|
jianmakeji/FZKB
|
780fc232f40296dca4da481b05f7c18fb466b465
|
[
"MIT"
] | 1 |
2021-05-11T00:06:12.000Z
|
2021-05-11T00:06:12.000Z
|
src/main/java/com/jianma/fzkb/dao/impl/CorporationDaoImpl.java
|
jianmakeji/FZKB
|
780fc232f40296dca4da481b05f7c18fb466b465
|
[
"MIT"
] | null | null | null |
src/main/java/com/jianma/fzkb/dao/impl/CorporationDaoImpl.java
|
jianmakeji/FZKB
|
780fc232f40296dca4da481b05f7c18fb466b465
|
[
"MIT"
] | null | null | null | 30.123894 | 84 | 0.730905 | 3,311 |
package com.jianma.fzkb.dao.impl;
import java.util.List;
import java.util.Optional;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import com.jianma.fzkb.dao.CorporationDao;
import com.jianma.fzkb.model.Corporation;
import com.jianma.fzkb.model.Designer;
@Repository
@Component
@Qualifier(value = "corporationDaoImpl")
public class CorporationDaoImpl implements CorporationDao {
@Autowired
@Qualifier("sessionFactory")
private SessionFactory sessionFactory;
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public void createCorporation(Corporation corporation) {
sessionFactory.getCurrentSession().save(corporation);
}
@Override
public void updateCorporation(Corporation corporation) {
sessionFactory.getCurrentSession().update(corporation);
}
@Override
public void deleteCorporation(int id) {
Session session = this.getSessionFactory().getCurrentSession();
String hql = " delete from Corporation c where c.id = ? ";
Query query = session.createQuery(hql);
query.setParameter(0, id);
query.executeUpdate();
}
@Override
public Optional<Corporation> getCorporationById(int id) {
Session session = this.getSessionFactory().getCurrentSession();
String hql = " from Corporation where id = ?";
Query query = session.createQuery(hql);
query.setParameter(0, id);
@SuppressWarnings("unchecked")
List<Corporation> list = query.list();
if (list.size() > 0){
Optional<Corporation> designer = Optional.ofNullable(list.get(0));
return designer;
}
else{
return Optional.empty();
}
}
@Override
public List<Corporation> getCorporationByPage(int offset, int limit) {
Session session = sessionFactory.getCurrentSession();
String hql = " from Corporation ";
Query query = session.createQuery(hql);
query.setFirstResult(offset);
query.setMaxResults(limit);
return query.list();
}
@Override
public int getCountCorporation() {
Session session = this.getSessionFactory().getCurrentSession();
final String hql = " select count(c) from Corporation c ";
final Query query = session.createQuery(hql);
long count = (Long)query.uniqueResult();
return (int)count;
}
@Override
public List<Corporation> getCorporationByName(String name, int offset, int limit) {
Session session = sessionFactory.getCurrentSession();
String hql = " from Corporation where name like ? ";
Query query = session.createQuery(hql);
query.setParameter(0, "%"+name+"%");
query.setFirstResult(offset);
query.setMaxResults(limit);
return query.list();
}
@Override
public int getCountCorporationByName(String name) {
Session session = this.getSessionFactory().getCurrentSession();
final String hql = " select count(c) from Corporation c where name like ? ";
final Query query = session.createQuery(hql);
query.setParameter(0, "%"+name+"%");
long count = (Long)query.uniqueResult();
return (int)count;
}
}
|
3e07d589dcc58e1a9026fc2a699fb343fe22ef2a
| 2,088 |
java
|
Java
|
src/main/java/com/privatekit/server/entity/Question.java
|
PrivateKit/private-kit-service
|
f0fd5dbd2b6bcb412d1d4d2578c8947d951e36f0
|
[
"MIT"
] | 2 |
2020-06-01T09:21:22.000Z
|
2020-06-04T15:04:36.000Z
|
src/main/java/com/privatekit/server/entity/Question.java
|
Path-Check/private-kit-service
|
f0fd5dbd2b6bcb412d1d4d2578c8947d951e36f0
|
[
"MIT"
] | null | null | null |
src/main/java/com/privatekit/server/entity/Question.java
|
Path-Check/private-kit-service
|
f0fd5dbd2b6bcb412d1d4d2578c8947d951e36f0
|
[
"MIT"
] | 3 |
2020-07-10T20:09:04.000Z
|
2020-07-16T14:56:27.000Z
| 26.769231 | 84 | 0.676245 | 3,312 |
package com.privatekit.server.entity;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;
@Getter
@Setter
@Entity
@Table(name = "questions")
public class Question implements Serializable {
@EmbeddedId
private QuestionId id;
@Column(name = "question_text")
private String text;
@Column(name = "question_title")
private String title;
@Column(name = "question_description")
private String description;
@Column(name = "question_image")
private String image;
@Column(name = "question_type", nullable = false)
private String type;
@Column(name = "question_required")
private Boolean required;
@Column(name = "screen_type_key")
private String screenType;
@Column(name = "option_key")
private String optionKey;
@Column(name = "survey_id", updatable = false, insertable = false)
private Integer surveyId;
public static Question from(com.privatekit.server.controller.model.Question q) {
final Question question = new Question();
final QuestionId id = new QuestionId();
id.setQuestionKey(q.getQuestionKey());
question.setId(id);
question.setText(q.getQuestionText());
question.setImage(q.getImage());
question.setType(q.getQuestionType());
question.setRequired(q.isRequired());
question.setScreenType(q.getScreenType());
question.setOptionKey(q.getOptionKey());
question.setTitle(q.getQuestionTitle());
question.setDescription(q.getQuestionDescription());
return question;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Question question = (Question) o;
return Objects.equals(id, question.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
|
3e07d5ccd584dd36eb6f5bee20d1660756a5e515
| 867 |
java
|
Java
|
dolphin-common/dolphin-common-core/src/main/java/cn/goktech/dolphin/common/exception/UnautherizedException.java
|
funcas/dolphin-cloud
|
dd72199579195d5c7e4d1558fea75e716df92a70
|
[
"MIT"
] | 5 |
2019-05-10T08:17:26.000Z
|
2021-07-14T10:41:00.000Z
|
dolphin-common/dolphin-common-core/src/main/java/cn/goktech/dolphin/common/exception/UnautherizedException.java
|
funcas/dolphin-cloud
|
dd72199579195d5c7e4d1558fea75e716df92a70
|
[
"MIT"
] | null | null | null |
dolphin-common/dolphin-common-core/src/main/java/cn/goktech/dolphin/common/exception/UnautherizedException.java
|
funcas/dolphin-cloud
|
dd72199579195d5c7e4d1558fea75e716df92a70
|
[
"MIT"
] | 3 |
2019-05-10T08:17:28.000Z
|
2021-07-14T10:41:00.000Z
| 19.266667 | 67 | 0.604383 | 3,313 |
package cn.goktech.dolphin.common.exception;
/**
* 未认证异常,该异常是为 spring mvc 异常方法签名提供的异常,当出现该异常时,会自动跳转到登录页面。
*
*/
public class UnautherizedException extends ServiceException {
/**
* 未认证异常,该异常是为 spring mvc 异常方法签名提供的异常
*/
public UnautherizedException() {
super();
}
/**
* 未认证异常,该异常是为 spring mvc 异常方法签名提供的异常
*
* @param message 异常信息
*/
public UnautherizedException(String message) {
super(message);
}
/**
* 未认证异常,该异常是为 spring mvc 异常方法签名提供的异常
*
* @param cause 异常类
*/
public UnautherizedException(Throwable cause) {
super(cause);
}
/**
* 未认证异常,该异常是为 spring mvc 异常方法签名提供的异常
*
* @param message 异常信息
* @param cause 异常类
*/
public UnautherizedException(String message, Throwable cause) {
super(message, cause);
}
}
|
3e07d67ff3a467fb6a03f9ff50c94ea85b3825da
| 703 |
java
|
Java
|
src/main/java/epicsquid/roots/handler/IPouchHandler.java
|
axalox/Roots
|
b8480f76b26ca4154b6415fdfa4b9355aa05c304
|
[
"MIT"
] | 30 |
2019-08-14T00:22:19.000Z
|
2022-02-01T00:29:52.000Z
|
src/main/java/epicsquid/roots/handler/IPouchHandler.java
|
axalox/Roots
|
b8480f76b26ca4154b6415fdfa4b9355aa05c304
|
[
"MIT"
] | 628 |
2019-07-21T23:53:24.000Z
|
2022-03-30T22:05:51.000Z
|
src/main/java/epicsquid/roots/handler/IPouchHandler.java
|
axalox/Roots
|
b8480f76b26ca4154b6415fdfa4b9355aa05c304
|
[
"MIT"
] | 28 |
2019-07-31T12:48:50.000Z
|
2022-03-19T05:00:57.000Z
| 20.085714 | 55 | 0.73542 | 3,314 |
package epicsquid.roots.handler;
import epicsquid.roots.item.PouchType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandlerModifiable;
public interface IPouchHandler {
PouchType getPouchType();
int refill(ItemStack herbStack);
default boolean isApothecary() {
return getPouchType() == PouchType.APOTHECARY;
}
default boolean isHerb() {
return getPouchType() == PouchType.HERB;
}
default boolean isCreative() {
return getPouchType() == PouchType.CREATIVE;
}
default boolean isFey () {
return getPouchType() == PouchType.FEY;
}
IItemHandlerModifiable getInventory();
IItemHandlerModifiable getHerbs();
void markDirty();
}
|
3e07d7afa30a294e5230f3bc03c0fe0d9b56ffda
| 664 |
java
|
Java
|
common/src/main/java/com/kc/common/common/HttpConfig.java
|
qiu-yongheng/CodeRepository
|
567b450c73c8a2d8d3513ff714076c70c7d842a6
|
[
"Apache-2.0"
] | null | null | null |
common/src/main/java/com/kc/common/common/HttpConfig.java
|
qiu-yongheng/CodeRepository
|
567b450c73c8a2d8d3513ff714076c70c7d842a6
|
[
"Apache-2.0"
] | null | null | null |
common/src/main/java/com/kc/common/common/HttpConfig.java
|
qiu-yongheng/CodeRepository
|
567b450c73c8a2d8d3513ff714076c70c7d842a6
|
[
"Apache-2.0"
] | null | null | null | 33.2 | 83 | 0.692771 | 3,315 |
package com.kc.common.common;
/**
* @author 邱永恒
* @time 2017/12/15 11:54
* @desc ${TODD}
*/
public class HttpConfig {
public static final int MAX_AGE_ONLINE = 60;//默认最大在线缓存时间(秒)
public static final int MAX_AGE_OFFLINE = 24 * 60 * 60;//默认最大离线缓存时间(秒)
public static final int MAX_OFFLINE_SIZE = 1024 * 1024 * 50;//最大离线缓存空间(50M)
public static final int CONNECT_TIMEOUT = 30;//连接超时(秒)
public static final int READ_TIMEOUT = 30;//读取超时(秒)
public static final int WRITE_TIMEOUT = 30;//写超时(秒)
public static final String BASE_URL = "https://free-api.heweather.com";//写超时(秒)
public static final String REQUEST_SERVER_URL = "填入接口地址";
}
|
3e07d85042a9acd94d9125ea2e469f795d4823f2
| 377 |
java
|
Java
|
lib/src/main/java/com/ittianyu/relight/widget/stateful/navigator/route/Route.java
|
gzu-liyujiang/relight
|
d3ba70225a3c9c44a39a44f3ca969711d2bea4c8
|
[
"Apache-2.0"
] | 276 |
2018-10-08T07:01:02.000Z
|
2022-03-29T13:15:08.000Z
|
lib/src/main/java/com/ittianyu/relight/widget/stateful/navigator/route/Route.java
|
lkwdzh/relight
|
d3ba70225a3c9c44a39a44f3ca969711d2bea4c8
|
[
"Apache-2.0"
] | 17 |
2018-11-14T08:38:57.000Z
|
2020-05-26T01:46:29.000Z
|
lib/src/main/java/com/ittianyu/relight/widget/stateful/navigator/route/Route.java
|
lkwdzh/relight
|
d3ba70225a3c9c44a39a44f3ca969711d2bea4c8
|
[
"Apache-2.0"
] | 48 |
2018-10-08T08:28:54.000Z
|
2021-06-06T16:15:10.000Z
| 29 | 61 | 0.798408 | 3,316 |
package com.ittianyu.relight.widget.stateful.navigator.route;
import android.arch.lifecycle.Lifecycle;
import android.content.Context;
import android.view.View;
import com.ittianyu.relight.widget.Widget;
import java.io.Serializable;
public interface Route<V extends View> extends Serializable {
Widget<V> build(Context context, Lifecycle lifecycle);
String path();
}
|
3e07d8ada71154e57ae0d257412b0f2c27f796c8
| 2,149 |
java
|
Java
|
jdi-light-mobile/src/main/java/com/epam/jdi/light/mobile/elements/init/MobileUIFactory.java
|
foria1405/jdi-light-1
|
8f40a57c5f2556e6f78a962449d99312f5361226
|
[
"MIT"
] | 92 |
2018-08-28T12:39:33.000Z
|
2022-03-22T16:30:59.000Z
|
jdi-light-mobile/src/main/java/com/epam/jdi/light/mobile/elements/init/MobileUIFactory.java
|
foria1405/jdi-light-1
|
8f40a57c5f2556e6f78a962449d99312f5361226
|
[
"MIT"
] | 2,299 |
2018-10-05T11:32:28.000Z
|
2022-03-31T09:55:59.000Z
|
jdi-light-mobile/src/main/java/com/epam/jdi/light/mobile/elements/init/MobileUIFactory.java
|
foria1405/jdi-light-1
|
8f40a57c5f2556e6f78a962449d99312f5361226
|
[
"MIT"
] | 51 |
2018-06-21T16:10:54.000Z
|
2022-03-30T19:18:47.000Z
| 32.560606 | 83 | 0.705444 | 3,317 |
package com.epam.jdi.light.mobile.elements.init;
import com.epam.jdi.light.elements.pageobjects.annotations.locators.MarkupLocator;
import com.epam.jdi.light.mobile.elements.base.MobileUIElement;
import com.epam.jdi.light.mobile.elements.complex.MobileWebList;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
import static com.epam.jdi.light.driver.WebDriverByUtils.defineLocator;
public class MobileUIFactory {
public static MobileUIElement element(@MarkupLocator String locator) {
return locator.matches("[A-Z].*]")
? new MobileUIElement().setName(locator)
: element(defineLocator(locator));
}
public static MobileUIElement element(@MarkupLocator By byLocator) {
return new MobileUIElement(byLocator);
}
public static MobileUIElement $(@MarkupLocator String locator) {
return element(locator);
}
public static MobileUIElement $(@MarkupLocator String locator, Object parent) {
return element(locator).setup(j -> j.setParent(parent));
}
public static MobileUIElement $(@MarkupLocator By locator) {
return element(locator);
}
public static MobileUIElement $(WebElement webElement) {
return new MobileUIElement(webElement);
}
public static MobileUIElement $(@MarkupLocator By locator, Object parent) {
return element(locator).setup(j -> j.setParent(parent));
}
public static MobileWebList $$(@MarkupLocator String locator) {
return MobileJDITalk.list(locator);
}
public static MobileWebList $$(@MarkupLocator String locator, Object parent) {
return MobileJDITalk.list(locator).setup(j -> j.setParent(parent));
}
public static MobileWebList $$(@MarkupLocator By locator) {
return MobileJDITalk.list(locator);
}
public static MobileWebList $$(@MarkupLocator By locator, Object parent) {
return MobileJDITalk.list(locator).setup(j -> j.setParent(parent));
}
public static MobileWebList $$(List<WebElement> els, String name) {
return MobileJDITalk.list(els, name);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.