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
3e1985382941cdbe24ed02212e6b6c5e4c074f66
4,650
java
Java
phase2/src/View/Account/UserInfoView.java
s-nau/conference-program
b04d20b618a0338909f42380a983233afc970080
[ "MIT" ]
null
null
null
phase2/src/View/Account/UserInfoView.java
s-nau/conference-program
b04d20b618a0338909f42380a983233afc970080
[ "MIT" ]
null
null
null
phase2/src/View/Account/UserInfoView.java
s-nau/conference-program
b04d20b618a0338909f42380a983233afc970080
[ "MIT" ]
null
null
null
27.034884
107
0.634194
10,840
package View.Account; import Presenter.Central.SubMenu; import Presenter.Exceptions.InvalidChoiceException; import Presenter.PersonController.UserInfoController; import Presenter.PersonController.UserInfoMenu; import javax.swing.*; import java.awt.event.ActionEvent; public class UserInfoView extends AccountView { UserInfoController controller; UserInfoMenu presenter; String[] menuOp; JLabel dialogPrompt, pwordPrompt; JTextField inputField, passwordField; JButton submit; public UserInfoView(SubMenu controller) { super(controller); this.controller = (UserInfoController) controller; this.presenter = (UserInfoMenu) controller.getPresenter(); menuOp = this.presenter.getMenuOptions(); pwordPrompt = new JLabel(presenter.printEnterPassword()); initializeObject(pwordPrompt); passwordField = new JTextField(30); initializeObject(passwordField); dialogPrompt = new JLabel(""); initializeObject(dialogPrompt); inputField = new JTextField(30); initializeObject(inputField); submit = new JButton("submit"); initializeObject(submit); contentPane.setBackground(blueBG); } private void showVerifyWithPassword() { pwordPrompt.setVisible(true); passwordField.setText(""); passwordField.setVisible(true); } private void showPwordPrompt() { dialogPrompt.setText(presenter.printNewPasswordPrompt()); dialogPrompt.setVisible(true); inputField.setText(""); inputField.setVisible(true); showVerifyWithPassword(); frame.setTitle(presenter.changePwordTitle()); submit.setActionCommand("password"); submit.addActionListener(this); submit.setVisible(true); } private void showUsernamePrompt() { dialogPrompt.setText(presenter.printNewUsernamePrompt()); dialogPrompt.setVisible(true); inputField.setText(""); inputField.setVisible(true); showVerifyWithPassword(); frame.setTitle(presenter.changeUsernameTitle()); submit.setActionCommand("username"); submit.addActionListener(this); submit.setVisible(true); } private void showEmailPrompt() { dialogPrompt.setText(presenter.printNewEmailPrompt()); dialogPrompt.setVisible(true); inputField.setText(""); inputField.setVisible(true); showVerifyWithPassword(); frame.setTitle(presenter.changeEmailTitle()); submit.setActionCommand("email"); submit.addActionListener(this); submit.setVisible(true); } private void hideInput(){ inputField.setVisible(false); passwordField.setVisible(false); pwordPrompt.setVisible(false); submit.setVisible(false); backButton.setVisible(true); } private void changePassword() { try { hideInput(); dialogPrompt.setText(controller.changePassword(inputField.getText(), passwordField.getText())); } catch (InvalidChoiceException e) { exceptionDialogBox(presenter.printException(e)); } } private void changeUsername() { try { hideInput(); dialogPrompt.setText(controller.changeUsername(inputField.getText(), passwordField.getText())); } catch (InvalidChoiceException e) { exceptionDialogBox(presenter.printException(e)); } } private void changeEmail() { try { hideInput(); dialogPrompt.setText(controller.changeEmail(inputField.getText(), passwordField.getText())); } catch (InvalidChoiceException e) { exceptionDialogBox(presenter.printException(e)); } } @Override public void actionPerformed(ActionEvent event) { super.actionPerformed(event); if(eventName.equals(menuOp[0])) { hideMainDropDownMenu(); showUsernamePrompt(); } if(eventName.equals(menuOp[1])) { hideMainDropDownMenu(); showPwordPrompt(); } if(eventName.equals(menuOp[2])) { showEmailPrompt(); } if (eventName.equals("password")) { changePassword(); } if (eventName.equals("username")) { changeUsername(); } if (eventName.equals("email")) { changeEmail(); } if (eventName.equals("back")) { showMainDropDownMenu(); frame.setTitle(presenter.getMenuTitle()); } } }
3e198693234a4d076e7fe8dfa08a45d5a3f18789
1,282
java
Java
core/src/tech/otter/gdxsandbox/MenuScreen.java
madigan/gdx-sandbox
1c6afef85b56e3d00cb599793d8275f10592645f
[ "MIT" ]
null
null
null
core/src/tech/otter/gdxsandbox/MenuScreen.java
madigan/gdx-sandbox
1c6afef85b56e3d00cb599793d8275f10592645f
[ "MIT" ]
null
null
null
core/src/tech/otter/gdxsandbox/MenuScreen.java
madigan/gdx-sandbox
1c6afef85b56e3d00cb599793d8275f10592645f
[ "MIT" ]
1
2019-05-14T10:22:18.000Z
2019-05-14T10:22:18.000Z
29.136364
78
0.660686
10,841
package tech.otter.gdxsandbox; import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTextButton; import tech.otter.gdxsandbox.demos.Demo; class MenuScreen extends StageScreen { private Array<Demo> demos; public MenuScreen(Game controller, Array<Demo> demos) { super(controller); this.demos = demos; } @Override public void show() { stage = new Stage(new ScreenViewport()); Gdx.input.setInputProcessor(stage); VisTable table = new VisTable(); table.setFillParent(true); for(final Demo demo : demos) { table.add(new VisTextButton(demo.getName(), new ChangeListener() { @Override public void changed(ChangeEvent changeEvent, Actor actor) { controller.setScreen(demo); } })); table.row(); } stage.addActor(table); } }
3e198745a6518493010a4ab8481993b25934d699
3,665
java
Java
freedom-boot-core/src/main/java/com/extlight/core/component/LocalFileService.java
moonlightL/freedom-boot
d52917d691d946e2aca204085d9d58cfa8532bd4
[ "MIT" ]
2
2019-08-15T06:09:51.000Z
2019-09-10T05:07:58.000Z
freedom-boot-core/src/main/java/com/extlight/core/component/LocalFileService.java
moonlightL/freedom-boot
d52917d691d946e2aca204085d9d58cfa8532bd4
[ "MIT" ]
2
2021-06-04T22:01:38.000Z
2022-02-09T22:16:17.000Z
freedom-boot-core/src/main/java/com/extlight/core/component/LocalFileService.java
moonlightL/freedom-boot
d52917d691d946e2aca204085d9d58cfa8532bd4
[ "MIT" ]
1
2019-09-10T05:07:35.000Z
2019-09-10T05:07:35.000Z
30.040984
102
0.621555
10,842
package com.extlight.core.component; import com.extlight.common.component.file.*; import com.extlight.common.exception.GlobalException; import com.extlight.common.utils.CacheUtil; import com.extlight.common.utils.DateUtil; import com.extlight.common.utils.StringUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.springframework.stereotype.Component; import java.io.ByteArrayInputStream; import java.io.File; import java.util.Date; import java.util.Map; /** * @Author MoonlightL * @ClassName: LocalFileService * @ProjectName: freedom-boot * @Description: 本地文件管理 * @DateTime: 2019/7/31 16:45 */ @Component @Slf4j public class LocalFileService implements FileService { @Override public FileResponse upload(FileRequest fileRequest) throws GlobalException { FileResponse fileResponse = new FileResponse(); try { ByteArrayInputStream bis = new ByteArrayInputStream(fileRequest.getData()); String uploadDir = this.getUploadDir(fileRequest); uploadDir = uploadDir + "/files/" + DateUtil.toStr(new Date(), "yyyy/MM/dd"); File dir = new File(uploadDir); if (!dir.exists()) { dir.mkdirs(); } File dest = new File(uploadDir, fileRequest.getFilename()); FileUtils.copyToFile(bis, dest); fileResponse.setSuccess(true).setUrl(dest.getAbsolutePath()); return fileResponse; } catch (GlobalException e) { throw e; } catch (Exception e) { log.error("========【默认管理】文件 fileName: {} 文件上传失败=============", fileRequest.getFilename()); e.printStackTrace(); } return fileResponse; } @Override public FileResponse download(FileRequest fileRequest) throws GlobalException { FileResponse fileResponse = new FileResponse(); try { byte[] data = FileUtils.readFileToByteArray(new File(fileRequest.getUrl())); fileResponse.setSuccess(true).setData(data); } catch (Exception e) { log.error("========【默认管理】文件 url: {} 文件下载失败=============", fileRequest.getUrl()); e.printStackTrace(); } return fileResponse; } @Override public FileResponse remove(FileRequest fileRequest) throws GlobalException { FileResponse fileResponse = new FileResponse(); File file = new File(fileRequest.getUrl()); if (!file.exists()) { return fileResponse; } try { FileUtils.forceDelete(file); fileResponse.setSuccess(true); return fileResponse; } catch (Exception e) { log.error("========【默认管理】文件 url: {} 文件删除失败=============", fileRequest.getUrl()); e.printStackTrace(); } return fileResponse; } @Override public int getCode() { return FileManageEnum.LOCAL.getCode(); } private String getUploadDir(FileRequest fileRequest) { String uploadDir = fileRequest.getUploadDir(); if (StringUtil.isBlank(uploadDir)) { Map<String, String> fileConfigMap = CacheUtil.get(GlobalFileConstant.FILE_CONFIG_KEY); if (fileConfigMap != null && fileConfigMap.containsKey(GlobalFileConstant.UPLOAD_DIR) && !StringUtil.isBlank(fileConfigMap.get(GlobalFileConstant.UPLOAD_DIR))) { uploadDir = fileConfigMap.get(GlobalFileConstant.UPLOAD_DIR); } else { uploadDir = System.getProperty("user.home"); } } return uploadDir; } }
3e1987714f7274bb595434b36ad7c4f88a38860c
1,107
java
Java
src/main/java/me/hugmanrique/pokedata/roms/ROMLoader.java
hugmanrique/PokeData
f094326f66d78d1d45dfe13cd25b9a88d26857de
[ "MIT" ]
19
2017-05-04T05:54:33.000Z
2022-01-02T18:48:21.000Z
src/main/java/me/hugmanrique/pokedata/roms/ROMLoader.java
hugmanrique/PokeData
f094326f66d78d1d45dfe13cd25b9a88d26857de
[ "MIT" ]
null
null
null
src/main/java/me/hugmanrique/pokedata/roms/ROMLoader.java
hugmanrique/PokeData
f094326f66d78d1d45dfe13cd25b9a88d26857de
[ "MIT" ]
1
2019-08-07T01:51:58.000Z
2019-08-07T01:51:58.000Z
23.553191
79
0.535682
10,843
package me.hugmanrique.pokedata.roms; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; /** * @author Hugmanrique * @since 27/05/2017 */ public class ROMLoader { public static void load(ROM rom, File file) throws IOException { // IO loading loadRomBytes(rom, file); rom.setGameVars( // Game code rom.readText(0xAC, 4), // Game name rom.readText(0xA0, 12).trim(), // Maker name rom.readText(0xB0, 2) ); rom.updateFlags(); } private static void loadRomBytes(ROM rom, File file) throws IOException { try (InputStream in = new FileInputStream(file)) { long length = file.length(); byte[] bytes = new byte[(int) length]; int offset = 0; int n; while (offset < bytes.length && (n = in.read(bytes, offset, bytes.length - offset)) >= 0) { offset += n; } rom.setData(bytes); } } }
3e198822eb087e21501f49934193578705a75c71
612
java
Java
src/math/UglyNumber.java
gitmichaelz/LeetCodeByTags
0a1ce6deff430271909ecd3b7346cd1d54844b7a
[ "Apache-2.0" ]
null
null
null
src/math/UglyNumber.java
gitmichaelz/LeetCodeByTags
0a1ce6deff430271909ecd3b7346cd1d54844b7a
[ "Apache-2.0" ]
null
null
null
src/math/UglyNumber.java
gitmichaelz/LeetCodeByTags
0a1ce6deff430271909ecd3b7346cd1d54844b7a
[ "Apache-2.0" ]
null
null
null
20.4
87
0.535948
10,844
package math; /** * An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5. * * Given an integer n, return true if n is an ugly number. * * Example 1: * * Input: n = 6 * Output: true * Explanation: 6 = 2 × 3 * * Example 2: * * Input: n = 8 * Output: true * Explanation: 8 = 2 × 2 × 2 */ public class UglyNumber { public boolean isUgly(int num) { if(num == 1) return true; if(num == 0) return false; while(num % 2 == 0) num /= 2; while(num % 3 == 0) num /= 3; while(num % 5 == 0) num /= 5; return num == 1; } }
3e1988245bbb20328215a1b3e3509dc943472c00
729
java
Java
modules/MarchCommand/src/main/java/com/marchnetworks/device_ws/GetConfigHashResponse.java
TheAmeliaDeWitt/YAHoneyPot
569c2578b876f776e629ba7d7d2952c535f33357
[ "MIT" ]
null
null
null
modules/MarchCommand/src/main/java/com/marchnetworks/device_ws/GetConfigHashResponse.java
TheAmeliaDeWitt/YAHoneyPot
569c2578b876f776e629ba7d7d2952c535f33357
[ "MIT" ]
null
null
null
modules/MarchCommand/src/main/java/com/marchnetworks/device_ws/GetConfigHashResponse.java
TheAmeliaDeWitt/YAHoneyPot
569c2578b876f776e629ba7d7d2952c535f33357
[ "MIT" ]
null
null
null
27
61
0.794239
10,845
package com.marchnetworks.device_ws; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; @XmlAccessorType( XmlAccessType.FIELD ) @XmlType( name = "", propOrder = {"getConfigHashResult"} ) @XmlRootElement( name = "GetConfigHashResponse" ) public class GetConfigHashResponse { @XmlElement( name = "GetConfigHashResult", required = true ) protected String getConfigHashResult; public String getGetConfigHashResult() { return getConfigHashResult; } public void setGetConfigHashResult( String value ) { getConfigHashResult = value; } }
3e1988a284e79b522821d652b44c53b9e57fc590
672
java
Java
src/main/java/POGOProtos/Rpc/SubmitPoiImageProtoOrBuilder.java
celandro/pogoprotos-java
af129776faf08bfbfc69b32e19e8293bff2e8991
[ "BSD-3-Clause" ]
6
2019-07-08T10:29:18.000Z
2020-10-18T20:27:03.000Z
src/main/java/POGOProtos/Rpc/SubmitPoiImageProtoOrBuilder.java
Furtif/POGOProtos-Java-Private
655adefaca9e9185138aad08c55da85048d0c0ef
[ "BSD-3-Clause" ]
4
2018-07-22T19:44:39.000Z
2018-11-17T14:56:13.000Z
src/main/java/POGOProtos/Rpc/SubmitPoiImageProtoOrBuilder.java
Furtif/POGOProtos-Java-Private
655adefaca9e9185138aad08c55da85048d0c0ef
[ "BSD-3-Clause" ]
1
2017-03-29T09:34:17.000Z
2017-03-29T09:34:17.000Z
24
85
0.6875
10,846
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: POGOProtos.Rpc.proto package POGOProtos.Rpc; public interface SubmitPoiImageProtoOrBuilder extends // @@protoc_insertion_point(interface_extends:POGOProtos.Rpc.SubmitPoiImageProto) com.google.protobuf.MessageOrBuilder { /** * <code>string poi_id = 1;</code> * @return The poiId. */ java.lang.String getPoiId(); /** * <code>string poi_id = 1;</code> * @return The bytes for poiId. */ com.google.protobuf.ByteString getPoiIdBytes(); /** * <code>bool async_file_upload = 2;</code> * @return The asyncFileUpload. */ boolean getAsyncFileUpload(); }
3e19890becbbbcdff347a5f39e378945d67c338a
2,843
java
Java
Android/PoseEstimationApp/app/src/main/java/ai/fritz/camera/MainActivity.java
beeshopCayleb/FRITZ
5420c84590a438383102e00a0e1597a813b49de1
[ "MIT" ]
2
2019-10-09T17:15:59.000Z
2019-10-09T17:16:04.000Z
Android/PoseEstimationApp/app/src/main/java/ai/fritz/camera/MainActivity.java
Pisut1995/fritz-examples
0ad9608acf47db709f7c1252cf69a2695cb7c986
[ "MIT" ]
null
null
null
Android/PoseEstimationApp/app/src/main/java/ai/fritz/camera/MainActivity.java
Pisut1995/fritz-examples
0ad9608acf47db709f7c1252cf69a2695cb7c986
[ "MIT" ]
null
null
null
34.253012
104
0.582483
10,847
package ai.fritz.camera; import android.graphics.Canvas; import android.media.Image; import android.util.Size; import java.util.List; import ai.fritz.core.Fritz; import ai.fritz.poseestimationmodel.PoseEstimationOnDeviceModel; import ai.fritz.vision.FritzVision; import ai.fritz.vision.FritzVisionImage; import ai.fritz.vision.FritzVisionOrientation; import ai.fritz.vision.ImageRotation; import ai.fritz.vision.poseestimation.FritzVisionPosePredictor; import ai.fritz.vision.poseestimation.FritzVisionPoseResult; import ai.fritz.vision.poseestimation.Pose; public class MainActivity extends LiveCameraActivity { private static final String API_KEY = "949d1u22cbffbrarjh182eig55721odj"; FritzVisionPosePredictor predictor; FritzVisionImage visionImage; FritzVisionPoseResult poseResult; @Override protected void initializeFritz() { // TODO: Uncomment this and modify your api key above. Fritz.configure(this, API_KEY); } @Override protected void setupPredictor() { // STEP 1: Get the predictor and set the options. // ---------------------------------------------- // A FritzOnDeviceModel object is available when a model has been // successfully downloaded and included with the app. PoseEstimationOnDeviceModel poseEstimationOnDeviceModel = new PoseEstimationOnDeviceModel(); predictor = FritzVision.PoseEstimation.getPredictor(poseEstimationOnDeviceModel); // ---------------------------------------------- // END STEP 1 } @Override protected void setupImageForPrediction(Image image) { // Set the rotation ImageRotation imageRotation = FritzVisionOrientation.getImageRotationFromCamera(this, cameraId); // STEP 2: Create the FritzVisionImage object from media.Image // ------------------------------------------------------------------------ visionImage = FritzVisionImage.fromMediaImage(image, imageRotation); // ------------------------------------------------------------------------ // END STEP 2 } @Override protected void runInference() { // STEP 3: Run predict on the image // --------------------------------------------------- poseResult = predictor.predict(visionImage); // ---------------------------------------------------- // END STEP 3 } @Override protected void showResult(Canvas canvas, Size cameraSize) { // STEP 4: Draw the prediction result // ---------------------------------- if (poseResult != null) { List<Pose> poses = poseResult.getPoses(); for (Pose pose : poses) { pose.draw(canvas); } } // ---------------------------------- // END STEP 4 } }
3e19899048428f2218258cc750d17e48fc22b858
2,095
java
Java
src/main/java/yi/app/com/vertx.hw/Verticle/RouterNextVertecle.java
YiChengRepo/vertx-helloworld
8baebd8464240e15da3d264c9d6a51edbe46eced
[ "Apache-2.0" ]
null
null
null
src/main/java/yi/app/com/vertx.hw/Verticle/RouterNextVertecle.java
YiChengRepo/vertx-helloworld
8baebd8464240e15da3d264c9d6a51edbe46eced
[ "Apache-2.0" ]
1
2018-06-17T10:32:50.000Z
2018-06-17T10:34:51.000Z
src/main/java/yi/app/com/vertx.hw/Verticle/RouterNextVertecle.java
YiChengRepo/vertx-helloworld
8baebd8464240e15da3d264c9d6a51edbe46eced
[ "Apache-2.0" ]
null
null
null
38.796296
88
0.629594
10,848
package yi.app.com.vertx.hw.Verticle; import io.vertx.core.AbstractVerticle; import io.vertx.core.http.HttpServer; import io.vertx.core.http.HttpServerResponse; import io.vertx.ext.web.Route; import io.vertx.ext.web.Router; public class RouterNextVertecle extends AbstractVerticle { public static final String KEY = "MY_KEY"; @Override public void start() throws Exception { HttpServer server = vertx.createHttpServer(); Router router = Router.router(vertx); Route route1 = router.route("/test/path/").handler(routingContext -> { HttpServerResponse response = routingContext.response(); routingContext.put(KEY, "value 1 from route 1"); response.setChunked(true); response.write("route1\n"); System.out.println("routeNext -> route 1"); routingContext.vertx().setTimer(2000, tid -> routingContext.next()); }); Route route2 = router.route("/test/path/").handler(routingContext -> { System.out.println("routeNext -> route 2"); String value = routingContext.get(KEY); HttpServerResponse response = routingContext.response(); response.write("value from previous route is: [ " + value + " ], route2\n"); routingContext.next(); }); Route route3 = router.route("/test/path/").handler(routingContext -> { System.out.println("routeNext -> route 3"); HttpServerResponse response = routingContext.response(); response.write("route3\n"); routingContext.vertx().setTimer(1000, tid -> routingContext.next()); }); Route route4 = router.route("/test/path/").handler(routingContext -> { System.out.println("routeNext -> route 4"); HttpServerResponse response = routingContext.response(); response.write("route4 "); routingContext.response().end(); }); server.requestHandler(router::accept).listen(8082); System.out.println("HTTP server started on port 8082"); } }
3e198a63756edb54b4f9cd49d8cc573d38bacca5
1,311
java
Java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java
sharmajiii/so
174f48bee127c51f98ec6054f72be7567e0d8073
[ "Apache-2.0" ]
16
2018-05-04T20:47:02.000Z
2021-10-15T15:01:14.000Z
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java
sharmajiii/so
174f48bee127c51f98ec6054f72be7567e0d8073
[ "Apache-2.0" ]
4
2020-07-28T01:56:20.000Z
2021-02-10T09:01:46.000Z
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java
sharmajiii/so
174f48bee127c51f98ec6054f72be7567e0d8073
[ "Apache-2.0" ]
22
2018-06-13T01:40:03.000Z
2022-03-22T10:06:08.000Z
40.96875
103
0.583524
10,849
/*- * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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. * ============LICENSE_END========================================================= */ package org.onap.aaiclient.client.aai; import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperPatchProvider; public class AAICommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperPatchProvider { public AAICommonObjectMapperPatchProvider() { super(); } }
3e198a7928b522138b5eb2eb45ef64304acb0ce9
3,275
java
Java
enhanced/archive/classlib/modules/crypto2/test/ar/org/fitc/test/integration/crypto/agreement/ClientDHKeyAgreement.java
qinFamily/freeVM
9caa0256b4089d74186f84b8fb2afc95a0afc7bc
[ "Apache-2.0" ]
5
2017-03-08T20:32:39.000Z
2021-07-10T10:12:38.000Z
enhanced/archive/classlib/modules/crypto2/test/ar/org/fitc/test/integration/crypto/agreement/ClientDHKeyAgreement.java
qinFamily/freeVM
9caa0256b4089d74186f84b8fb2afc95a0afc7bc
[ "Apache-2.0" ]
null
null
null
enhanced/archive/classlib/modules/crypto2/test/ar/org/fitc/test/integration/crypto/agreement/ClientDHKeyAgreement.java
qinFamily/freeVM
9caa0256b4089d74186f84b8fb2afc95a0afc7bc
[ "Apache-2.0" ]
4
2015-07-07T07:06:59.000Z
2018-06-19T22:38:04.000Z
32.75
120
0.699847
10,850
/* * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @author Hugo Beilis * @author Osvaldo Demo * @author Jorge Rafael * @version 1.0 */ package ar.org.fitc.test.integration.crypto.agreement; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.net.Socket; import java.rmi.Naming; import java.rmi.NotBoundException; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.SealedObject; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.SecretKeySpec; import ar.org.fitc.test.integration.crypto.wrapunwrap.WrapUnwrap; public class ClientDHKeyAgreement extends DHKeyAgreement { final private WrapUnwrap ci; private InputStream in; private OutputStream out; private byte[] b; public static void main(String[] arg) { try { Socket client = new Socket("localhost", 2000); System.out.println(Arrays.toString(agree(client))); } catch (Exception e) { e.printStackTrace(); } } public ClientDHKeyAgreement(Socket s) throws IOException, NoSuchAlgorithmException, NotBoundException { super(2); in = s.getInputStream(); out = s.getOutputStream(); //ci = (WrapUnwrap) RSACipherWrap.getInstance(); ci = (WrapUnwrap) Naming.lookup("SecretKeyWrapUnwrap"); } @Override public void sendKey(PublicKey key) throws Exception { ObjectOutputStream out = new ObjectOutputStream(this.out); Cipher cipher = Cipher.getInstance("DES"); cipher.init(Cipher.ENCRYPT_MODE, SecretKeyFactory.getInstance("DES").translateKey(new SecretKeySpec(b, "DES"))); SealedObject encryptedKey = new SealedObject(key, cipher); out.writeObject(encryptedKey); } @Override public PublicKey recieveKey() throws Exception { DataInputStream in = new DataInputStream(this.in); int l = in.readInt(); b = new byte[l]; in.read(b); return (PublicKey) ci.unwrap(b); } public static SecretKey agree(Socket s, String alg) throws Exception { ClientDHKeyAgreement kagree = new ClientDHKeyAgreement(s); return kagree.applyDH(kagree.recieveKey()).generateSecret(alg); } public static byte[] agree(Socket s) throws Exception { ClientDHKeyAgreement kagree = new ClientDHKeyAgreement(s); return kagree.applyDH(kagree.recieveKey()).generateSecret(); } }
3e198a84e53e30d5ebe30217827cbd9bbb53a080
2,322
java
Java
src/org/fseek/simon/swing/filetree/impl/TreeFileFilter.java
swimmesberger/FileTree
b8e3d37f3fa1e26a7ba628684e16fb437e30947e
[ "MIT" ]
3
2015-06-08T13:52:38.000Z
2017-02-18T14:59:05.000Z
src/org/fseek/simon/swing/filetree/impl/TreeFileFilter.java
swimmesberger/FileTree
b8e3d37f3fa1e26a7ba628684e16fb437e30947e
[ "MIT" ]
null
null
null
src/org/fseek/simon/swing/filetree/impl/TreeFileFilter.java
swimmesberger/FileTree
b8e3d37f3fa1e26a7ba628684e16fb437e30947e
[ "MIT" ]
null
null
null
35.723077
80
0.7205
10,851
/* * The MIT License * * Copyright 2014 Simon Wimmesberger. * * 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 org.fseek.simon.swing.filetree.impl; import java.io.File; import org.apache.commons.io.filefilter.AbstractFileFilter; import org.apache.commons.io.filefilter.DirectoryFileFilter; import org.apache.commons.io.filefilter.HiddenFileFilter; import org.apache.commons.io.filefilter.IOFileFilter; /** * * @author root */ public class TreeFileFilter extends AbstractFileFilter{ public static final IOFileFilter VISIBLE = HiddenFileFilter.VISIBLE; public static final IOFileFilter DIRECTORY = DirectoryFileFilter.DIRECTORY; private boolean showHidden = true; private boolean showFiles = true; public TreeFileFilter(boolean showHidden, boolean showFiles) { this.showHidden = showHidden; this.showFiles = showFiles; } @Override public boolean accept(File file) { if(showFiles == false && showHidden == false){ return VISIBLE.accept(file) && DIRECTORY.accept(file); }else if(showFiles == false){ return DIRECTORY.accept(file); }else if(showHidden == false){ return VISIBLE.accept(file); }else{ return true; } } }
3e198a9b08c2f4ff60e4370e2f089180d79adef0
848
java
Java
java/hfj/SimpleMidi/src/SimpleMidi.java
justFooln/proj
bdf0706a282ab691cbcd21a90f555c431972a1ce
[ "Apache-2.0" ]
null
null
null
java/hfj/SimpleMidi/src/SimpleMidi.java
justFooln/proj
bdf0706a282ab691cbcd21a90f555c431972a1ce
[ "Apache-2.0" ]
null
null
null
java/hfj/SimpleMidi/src/SimpleMidi.java
justFooln/proj
bdf0706a282ab691cbcd21a90f555c431972a1ce
[ "Apache-2.0" ]
null
null
null
15.703704
48
0.59434
10,852
/** * */ import javax.sound.midi.*; /** * @author jhake * */ public class SimpleMidi { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { Sequencer player = MidiSystem.getSequencer(); player.open(); Sequence seq = new Sequence(Sequence.PPQ, 4); Track trk = seq.createTrack(); ShortMessage a = new ShortMessage(); a.setMessage(144, 1, 44, 100); MidiEvent noteOn = new MidiEvent(a, 1); trk.add(noteOn); ShortMessage b = new ShortMessage(); b.setMessage(128, 1, 44, 100); MidiEvent noteOff = new MidiEvent(b, 16); trk.add(noteOff); player.setSequence(seq); player.start(); System.out.println("And play..."); } catch (Exception ex) { System.out.println("Midi exception"); } } }
3e198ab57f03bd91fa7a375822f1a6f928bf386b
17,913
java
Java
storage/src/main/java/com/linkedpipes/etl/storage/pipeline/PipelineManager.java
zhangzhikuan/linked_etl
d446615ac4036944bebbaa945eb40669194823ff
[ "MIT" ]
null
null
null
storage/src/main/java/com/linkedpipes/etl/storage/pipeline/PipelineManager.java
zhangzhikuan/linked_etl
d446615ac4036944bebbaa945eb40669194823ff
[ "MIT" ]
null
null
null
storage/src/main/java/com/linkedpipes/etl/storage/pipeline/PipelineManager.java
zhangzhikuan/linked_etl
d446615ac4036944bebbaa945eb40669194823ff
[ "MIT" ]
null
null
null
37.474895
80
0.591972
10,853
package com.linkedpipes.etl.storage.pipeline; import com.linkedpipes.etl.executor.api.v1.vocabulary.LP_PIPELINE; import com.linkedpipes.etl.storage.BaseException; import com.linkedpipes.etl.storage.Configuration; import com.linkedpipes.etl.storage.mapping.MappingFacade; import com.linkedpipes.etl.storage.pipeline.info.InfoFacade; import com.linkedpipes.etl.storage.rdf.PojoLoader; import com.linkedpipes.etl.storage.rdf.RdfUtils; import com.linkedpipes.etl.storage.template.Template; import com.linkedpipes.etl.storage.template.TemplateFacade; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.Value; import org.eclipse.rdf4j.model.ValueFactory; import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.model.vocabulary.RDF; import org.eclipse.rdf4j.model.vocabulary.SKOS; import org.eclipse.rdf4j.rio.RDFFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.File; import java.text.SimpleDateFormat; import java.util.*; import static com.linkedpipes.etl.storage.rdf.RdfUtils.write; /** * Manage pipeline storage. */ @Service class PipelineManager { private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); @Autowired private Configuration configuration; @Autowired private InfoFacade infoFacade; @Autowired private MappingFacade mappingFacade; @Autowired private TemplateFacade templatesFacade; /** * Store pipelines. */ private final Map<String, Pipeline> pipelines = new HashMap<>(); /** * Contains list of used or reserved IRIs. */ private final Set<String> reserved = new HashSet<>(); /** * Object use as a lock, for inner synchronisation. */ private final Object lock = new Object(); @PostConstruct public void initialize() { final File pipelineDirectory = configuration.getPipelinesDirectory(); if (!pipelineDirectory.exists()) { pipelineDirectory.mkdirs(); } for (File file : pipelineDirectory.listFiles()) { // Read only files without the .backup extension. final String fileName = file.getName().toLowerCase(); if (!file.isFile() || fileName.endsWith(".backup")) { continue; } // Load pipeline. try { loadPipeline(file); } catch (Exception ex) { throw new RuntimeException("Invalid pipeline: " + file, ex); } } } /** * Load pipeline from a given file. Check version, perform migration * (if necessary) and add pipeline to pipelines. * * @param file * @return Loaded pipeline. */ protected void loadPipeline(File file) throws PipelineFacade.OperationFailed { Collection<Statement> pipelineRdf; Pipeline.Info info; try { pipelineRdf = RdfUtils.read(file); info = new Pipeline.Info(); PojoLoader.loadOfType(pipelineRdf, Pipeline.TYPE, info); } catch (PojoLoader.CantLoadException | RdfUtils.RdfException ex) { throw new PipelineFacade.OperationFailed("Can't read pipeline: {}", file, ex); } // Migration. if (info.getVersion() != Pipeline.VERSION_NUMBER) { // Perform migrationFacade of the pipeline definition. try { pipelineRdf = PipelineUpdate.migrate(pipelineRdf, templatesFacade, true); info = new Pipeline.Info(); PojoLoader.loadOfType(pipelineRdf, Pipeline.TYPE, info); } catch (PipelineUpdate.UpdateFailed | PojoLoader.CantLoadException ex) { throw new PipelineFacade.OperationFailed( "Can't migrate pipeline: {}", file, ex); } // Create backup file. String fileName = file.getName(); fileName = fileName.substring(0, fileName.lastIndexOf(".")); final File backupFile = new File(file.getParent(), fileName + "_" + DATE_FORMAT.format(new Date()) + ".trig.backup"); try { RdfUtils.write(backupFile, RDFFormat.TRIG, pipelineRdf); } catch (RdfUtils.RdfException ex) { throw new PipelineFacade.OperationFailed( "Can't write backup file: {}", backupFile, ex); } // We need to create backup of the pipeline file // and write updated pipeline to new file. final File newFile = new File(file.getParent(), fileName + ".trig"); // Write new file. try { RdfUtils.write(newFile, RDFFormat.TRIG, pipelineRdf); } catch (RdfUtils.RdfException ex) { throw new PipelineFacade.OperationFailed( "Can't write new pipeline to file: {}", newFile, ex); } // Delete old file and switch to new file. if (!file.equals(newFile)) { file.delete(); } file = newFile; } // Create pipeline record. final Pipeline pipeline = new Pipeline(file, info); createPipelineReference(pipeline); infoFacade.onPipelineCreate(pipeline, pipelineRdf); // pipelines.put(pipeline.getIri(), pipeline); reserved.add(pipeline.getIri()); } /** * Create and set reference for the pipeline. The pipeline reference * consists from typed pipeline resource and labels. Use information * in the pipeline.info. * * @param pipeline */ protected static void createPipelineReference(Pipeline pipeline) { final ValueFactory vf = SimpleValueFactory.getInstance(); final IRI pipelineIri = vf.createIRI(pipeline.getIri()); final List<Statement> referenceRdf = new ArrayList<>(4); // referenceRdf.add(vf.createStatement(pipelineIri, RDF.TYPE, Pipeline.TYPE, pipelineIri)); for (Value label : pipeline.getInfo().getLabels()) { referenceRdf.add(vf.createStatement(pipelineIri, SKOS.PREF_LABEL, label, pipelineIri)); } final IRI tagIri = vf.createIRI( "http://etl.linkedpipes.com/ontology/tag"); for (Value tag : pipeline.getInfo().getTags()) { referenceRdf.add(vf.createStatement(pipelineIri, tagIri, tag, pipelineIri)); } // pipeline.setReferenceRdf(referenceRdf); } /** * @return A map of all pipelines. */ public Map<String, Pipeline> getPipelines() { return Collections.unmodifiableMap(pipelines); } /** * @return Reserved pipeline IRI as string. */ public String reservePipelineIri() { String iri; synchronized (lock) { do { iri = configuration.getDomainName() + "/resources/pipelines/created-" + (new Date()).getTime(); } while (reserved.contains(iri)); reserved.add(iri); } return iri; } /** * @param iri * @return Empty pipeline of given IRI. */ private final Collection<Statement> createEmptyPipeline(IRI iri) { final ValueFactory vf = SimpleValueFactory.getInstance(); IRI profileIri = vf.createIRI(iri.stringValue() + "/profile/default"); return Arrays.asList( vf.createStatement(iri, RDF.TYPE, Pipeline.TYPE, iri), vf.createStatement(iri, Pipeline.HAS_VERSION, vf.createLiteral(Pipeline.VERSION_NUMBER), iri), vf.createStatement(iri, SKOS.PREF_LABEL, vf.createLiteral(iri.stringValue()), iri), vf.createStatement(iri, vf.createIRI(LP_PIPELINE.HAS_PROFILE) , profileIri, iri), vf.createStatement(profileIri, RDF.TYPE, vf.createIRI(LP_PIPELINE.PROFILE), iri), vf.createStatement(profileIri, vf.createIRI(LP_PIPELINE.HAS_RDF_REPOSITORY_POLICY), vf.createIRI(LP_PIPELINE.SINGLE_REPOSITORY), iri), vf.createStatement(profileIri, vf.createIRI(LP_PIPELINE.HAS_RDF_REPOSITORY_TYPE), vf.createIRI(LP_PIPELINE.NATIVE_STORE), iri) ); } /** * Import pipeline from given data and apply given options. If the * pipelineRdf is empty then create new empty pipeline. * * @param pipelineRdf * @param optionsRdf * @return */ public Pipeline createPipeline(Collection<Statement> pipelineRdf, Collection<Statement> optionsRdf) throws PipelineFacade.OperationFailed { final ValueFactory valueFactory = SimpleValueFactory.getInstance(); // Prepare pipeline IRI and update pipeline resources. final IRI iri = valueFactory.createIRI(reservePipelineIri()); if (pipelineRdf.isEmpty()) { pipelineRdf = createEmptyPipeline(iri); } else { pipelineRdf = localizePipeline(pipelineRdf, optionsRdf, iri); } // Read pipeline info. Pipeline.Info info = new Pipeline.Info(); try { PojoLoader.loadOfType(pipelineRdf, Pipeline.TYPE, info); } catch (PojoLoader.CantLoadException ex) { throw new PipelineFacade.OperationFailed( "Can't read pipeline after localization.", ex); } // Add to pipeline list. final String fileName = iri.getLocalName() + ".trig"; final Pipeline pipeline = new Pipeline(new File( configuration.getPipelinesDirectory(), fileName), info); pipeline.setInfo(info); createPipelineReference(pipeline); // Save to dist. try { RdfUtils.write(pipeline.getFile(), RDFFormat.TRIG, pipelineRdf); } catch (RdfUtils.RdfException ex) { pipeline.getFile().delete(); // throw new PipelineFacade.OperationFailed( "Can't write pipeline to {}", pipeline.getFile(), ex); } // pipelines.put(iri.stringValue(), pipeline); infoFacade.onPipelineCreate(pipeline, pipelineRdf); return pipeline; } /** * Update pipeline definition and perform all related operations. * * @param pipeline * @param pipelineRdf */ public void updatePipeline(Pipeline pipeline, Collection<Statement> pipelineRdf) throws PipelineFacade.OperationFailed { // Update pipeline in-memory model. Pipeline.Info info = new Pipeline.Info(); try { PojoLoader.loadOfType(pipelineRdf, Pipeline.TYPE, info); pipeline.setInfo(info); // createPipelineReference(pipeline); } catch (PojoLoader.CantLoadException ex) { throw new PipelineFacade.OperationFailed( "Can't read pipeline.", ex); } // Write to disk. try { write(pipeline.getFile(), RDFFormat.TRIG, pipelineRdf); } catch (RdfUtils.RdfException ex) { throw new PipelineFacade.OperationFailed( "Can't write pipeline: {}", pipeline.getFile(), ex); } infoFacade.onPipelineUpdate(pipeline, pipelineRdf); // TODO Use events to notify all about pipeline change ! } /** * Delete given pipeline. * * @param pipeline */ public void deletePipeline(Pipeline pipeline) { // TODO Add tomb-stone infoFacade.onPipelineDelete(pipeline); pipeline.getFile().delete(); pipelines.remove(pipeline.getIri()); // TODO Use event to notify about changes ! } public Collection<Statement> localizePipeline( Collection<Statement> pipelineRdf, Collection<Statement> optionsRdf) throws PipelineFacade.OperationFailed { return localizePipeline(pipelineRdf, optionsRdf, null); } /** * Return RDF definition of the pipeline with optional additional * information. * * @param pipeline * @param includeTemplate * @param includeMapping * @return */ public Collection<Statement> getPipelineRdf(Pipeline pipeline, boolean includeTemplate, boolean includeMapping) throws PipelineFacade.OperationFailed { // Read pipeline. final Collection<Statement> pipelineRdf; try { pipelineRdf = RdfUtils.read(pipeline.getFile()); } catch (Exception ex) { throw new PipelineFacade.OperationFailed("Can't read file.", ex); } // Add additional data. Set<Template> templates = null; final Collection<Statement> additionalRdf = new LinkedList<>(); if (includeTemplate) { if (templates == null) { templates = getTemplates(pipelineRdf, pipeline.getIri()); } // for (Template template : templates) { // We need to remove duplicity from definition and interface. final Set<Statement> templateRdf = new HashSet<>(); templateRdf.addAll(templatesFacade.getInterface(template)); templateRdf.addAll(templatesFacade.getDefinition(template)); // additionalRdf.addAll(templateRdf); additionalRdf.addAll(templatesFacade .getConfigurationTemplate(template)); } } if (includeMapping) { if (templates == null) { templates = getTemplates(pipelineRdf, pipeline.getIri()); } // additionalRdf.addAll(mappingFacade.write(templates)); } // Merge and return. pipelineRdf.addAll(additionalRdf); return pipelineRdf; } /** * Return list of all templates used in the pipeline, also include * transitive templates. * * @param pipelineRdf * @return */ private Set<Template> getTemplates(Collection<Statement> pipelineRdf, String pipelineIri) { final Set<Template> templates = new HashSet<>(); for (Statement statement : pipelineRdf) { if (statement.getPredicate().stringValue().equals( "http://linkedpipes.com/ontology/template") && statement.getContext().stringValue().equals(pipelineIri)) { templates.addAll(templatesFacade.getTemplates( statement.getObject().stringValue(), false)); } } return templates; } /** * Prepare given pipeline to be used on this instance. * * @param pipelineRdf * @param optionsRdf * @param pipelineIri * @return */ private Collection<Statement> localizePipeline( Collection<Statement> pipelineRdf, Collection<Statement> optionsRdf, IRI pipelineIri) throws PipelineFacade.OperationFailed { final ValueFactory valueFactory = SimpleValueFactory.getInstance(); // Check if we have some data. if (pipelineRdf.isEmpty()) { return Collections.EMPTY_LIST; } // Load localization import. final PipelineOptions options = new PipelineOptions(); try { PojoLoader.loadOfType(optionsRdf, PipelineOptions.TYPE, options); } catch (PojoLoader.CantLoadException ex) { throw new PipelineFacade.OperationFailed("Can't load options.", ex); } // Load pipeline info. Pipeline.Info info = new Pipeline.Info(); try { PojoLoader.loadOfType(pipelineRdf, Pipeline.TYPE, info); } catch (PojoLoader.CantLoadException ex) { throw new PipelineFacade.OperationFailed( "Can't read pipeline.", ex); } // Import templates. if (!options.isLocal()) { try { pipelineRdf = PipelineUpdate.updateTemplates(pipelineRdf, templatesFacade, mappingFacade, options.isImportTemplates(), options.isUpdateTemplates()); } catch (BaseException ex) { throw new PipelineFacade.OperationFailed( "Can't import templates.", ex); } } // Migration. if (info.getVersion() != Pipeline.VERSION_NUMBER) { try { pipelineRdf = PipelineUpdate.migrate(pipelineRdf, templatesFacade, false); } catch (PipelineUpdate.UpdateFailed ex) { throw new PipelineFacade.OperationFailed( "Migration failed from version: {}", info.getVersion(), ex); } } // Update pipeline IRI. if (pipelineIri != null) { pipelineRdf = PipelineUpdate.updateResources(pipelineRdf, pipelineIri.stringValue()); } else { pipelineIri = valueFactory.createIRI(info.getIri()); } // Update labels. if (options.getLabels() != null && !options.getLabels().isEmpty()) { pipelineRdf = PipelineUpdate.updateLabels(pipelineRdf, pipelineIri, options.getLabels()); } return pipelineRdf; } }
3e198c608dbe10648608b1e0cfd6c46027dc0c0b
3,197
java
Java
api-model/src/gen/java/au/org/consumerdatastandards/api/banking/models/BankingLoanAccount.java
perlboy/cds-java-artefacts
2fe6580d275774fa3ee76b66e045570deca29bad
[ "MIT" ]
null
null
null
api-model/src/gen/java/au/org/consumerdatastandards/api/banking/models/BankingLoanAccount.java
perlboy/cds-java-artefacts
2fe6580d275774fa3ee76b66e045570deca29bad
[ "MIT" ]
null
null
null
api-model/src/gen/java/au/org/consumerdatastandards/api/banking/models/BankingLoanAccount.java
perlboy/cds-java-artefacts
2fe6580d275774fa3ee76b66e045570deca29bad
[ "MIT" ]
null
null
null
30.447619
429
0.708164
10,854
package au.org.consumerdatastandards.api.banking.models; import java.util.List; import au.org.consumerdatastandards.support.data.*; @DataDefinition public class BankingLoanAccount { public enum RepaymentType { INTEREST_ONLY, PRINCIPAL_AND_INTEREST } @Property( description = "Optional original start date for the loan" ) @CDSDataType(CustomDataType.Date) String originalStartDate; @Property( description = "Optional original loan value" ) @CDSDataType(CustomDataType.Amount) String originalLoanAmount; @Property( description = "If absent assumes AUD" ) @CDSDataType(CustomDataType.Currency) String originalLoanCurrency; @Property( description = "Date that the loan is due to be repaid in full", required = true ) @CDSDataType(CustomDataType.Date) String loanEndDate; @Property( description = "Next date that an instalment is required", required = true ) @CDSDataType(CustomDataType.Date) String nextInstalmentDate; @Property( description = "Minimum amount of next instalment" ) @CDSDataType(CustomDataType.Amount) String minInstalmentAmount; @Property( description = "If absent assumes AUD" ) @CDSDataType(CustomDataType.Currency) String minInstalmentCurrency; @Property( description = "Maximum amount of funds that can be redrawn. If not present redraw is not available even if the feature exists for the account" ) @CDSDataType(CustomDataType.Amount) String maxRedraw; @Property( description = "If absent assumes AUD" ) @CDSDataType(CustomDataType.Currency) String maxRedrawCurrency; @Property( description = "Minimum redraw amount" ) @CDSDataType(CustomDataType.Amount) String minRedraw; @Property( description = "If absent assumes AUD" ) @CDSDataType(CustomDataType.Currency) String minRedrawCurrency; @Property( description = "Set to true if one or more offset accounts are configured for this loan account" ) @CDSDataType(CustomDataType.Boolean) Boolean offsetAccountEnabled; @Property( description = "The accountIDs of the configured offset accounts attached to this loan. Only offset accounts that can be accessed under the current authorisation should be included. It is expected behaviour that offsetAccountEnabled is set to true but the offsetAccountIds field is absent or empty. This represents a situation where an offset account exists but details can not be accessed under the current authorisation" ) List<String> offsetAccountIds; @Property( description = "Options in place for repayments. If absent defaults to PRINCIPAL_AND_INTEREST" ) RepaymentType repaymentType = RepaymentType.PRINCIPAL_AND_INTEREST; @Property( description = "The expected or required repayment frequency. Formatted according to [ISO 8601 Durations](https://en.wikipedia.org/wiki/ISO_8601#Durations)", required = true ) @CDSDataType(CustomDataType.ExternalRef) String repaymentFrequency; }
3e198cd29b964e2b608443917c4f21c76b90e139
3,119
java
Java
proxy/src/test/java/org/beanplanet/proxy/cglib/CGLibProxyFactoryTests.java
lamerexter/beanplanet-framework
28a89f53fddf4a38e2e813e05d4fb9bd3789761b
[ "MIT" ]
null
null
null
proxy/src/test/java/org/beanplanet/proxy/cglib/CGLibProxyFactoryTests.java
lamerexter/beanplanet-framework
28a89f53fddf4a38e2e813e05d4fb9bd3789761b
[ "MIT" ]
4
2020-05-15T19:16:46.000Z
2021-12-09T19:45:19.000Z
proxy/src/test/java/org/beanplanet/proxy/cglib/CGLibProxyFactoryTests.java
lamerexter/beanplanet-framework
28a89f53fddf4a38e2e813e05d4fb9bd3789761b
[ "MIT" ]
null
null
null
41.039474
123
0.676819
10,855
/******************************************************************************* * Copyright 2004-2010 BeanPlanet Limited * * 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.beanplanet.proxy.cglib; import org.beanplanet.core.lang.proxy.*; import org.beanplanet.core.models.tree.FilesystemTree; import org.beanplanet.core.models.tree.PostorderIterator; import org.beanplanet.core.models.tree.Tree; import org.beanplanet.testing.proxies.ABProxiedClassImpl; import org.beanplanet.testing.proxies.FinalClass; import org.beanplanet.testing.proxies.ProxiedClass; import java.io.File; import java.util.*; public class CGLibProxyFactoryTests extends AbstractCommonProxyFactoryTests { public void setUp() { proxyFactory = new CGLibProxyFactory(); } public void testSimpleTargetProxyOperation() { ABProxiedClassImpl target = new ABProxiedClassImpl(); try { proxyFactory.dynamicProxy(target.getClass(), new TargetInvokingMethodCallInterceptor(target)); } catch (UnsupportedProxyOperationException unEx) { fail("The CGLIbProxyFactory is supposed to support proxy via concrete types!"); } } public void testSimpleTargetProxy() { ProxiedClass target = new ProxiedClass(); ProxiedClass proxy = proxyFactory.dynamicProxy(target.getClass(), new TargetInvokingMethodCallInterceptor(target)); assertTrue(proxy != target); assertTrue(target == proxy.getThis()); assertTrue(target == target.getThis()); assertEquals(0, proxy.getTestMethodCallCount()); assertEquals(0, target.getTestMethodCallCount()); proxy.testMethod(); assertEquals(1, proxy.getTestMethodCallCount()); assertEquals(1, target.getTestMethodCallCount()); proxy.testMethod(); proxy.testMethod(); proxy.testMethod(); proxy.testMethod(); assertEquals(5, proxy.getTestMethodCallCount()); assertEquals(5, target.getTestMethodCallCount()); assertTrue(proxy.equals(target)); assertTrue(proxy.hashCode() == target.hashCode()); } public void testAttemptToProxyFinalClassFailsTest() { FinalClass target = new FinalClass(); try { proxyFactory.dynamicProxy(target.getClass(), new TargetInvokingMethodCallInterceptor(target)); fail("The CGLIb framework is not supposed to be able to proxy concrete types marked as final!"); } catch (FinalClassProxyOperationException unEx) { } } }
3e198e6e4d8f2c5fd89d26583b02bcb526f6a6ab
787
java
Java
kornell-gwt/src/main/java/kornell/gui/client/presentation/admin/courseclass/courseclasses/AdminCourseClassesView.java
Craftware/Kornell
592fd243dac4602141233cddb43240f05155c787
[ "Apache-2.0" ]
19
2015-02-27T05:58:21.000Z
2021-05-25T02:30:43.000Z
kornell-gwt/src/main/java/kornell/gui/client/presentation/admin/courseclass/courseclasses/AdminCourseClassesView.java
Craftware/Kornell
592fd243dac4602141233cddb43240f05155c787
[ "Apache-2.0" ]
14
2015-04-28T18:48:11.000Z
2015-04-28T18:48:59.000Z
kornell-gwt/src/main/java/kornell/gui/client/presentation/admin/courseclass/courseclasses/AdminCourseClassesView.java
Craftware/Kornell
592fd243dac4602141233cddb43240f05155c787
[ "Apache-2.0" ]
8
2015-06-02T08:40:42.000Z
2021-05-25T02:30:45.000Z
32.791667
81
0.801779
10,856
package kornell.gui.client.presentation.admin.courseclass.courseclasses; import java.util.List; import com.google.gwt.user.client.ui.IsWidget; import kornell.core.to.CourseClassTO; import kornell.gui.client.util.view.table.PaginationPresenter; public interface AdminCourseClassesView extends IsWidget { public interface Presenter extends PaginationPresenter<CourseClassTO> { void updateCourseClass(String courseClassUUID); void deleteCourseClass(CourseClassTO courseClassTO); void duplicateCourseClass(CourseClassTO courseClassTO); boolean showActionButton(String actionName, CourseClassTO courseClassTO); } void setPresenter(AdminCourseClassesView.Presenter presenter); void setCourseClasses(List<CourseClassTO> courseClasses); }
3e1990254f3a4699e0623e42a345e4deea72a121
389
java
Java
mobile_app1/module971/src/main/java/module971packageJava0/Foo51.java
HiWong/android-build-eval
d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6
[ "Apache-2.0" ]
70
2021-01-22T16:48:06.000Z
2022-02-16T10:37:33.000Z
mobile_app1/module971/src/main/java/module971packageJava0/Foo51.java
HiWong/android-build-eval
d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6
[ "Apache-2.0" ]
16
2021-01-22T20:52:52.000Z
2021-08-09T17:51:24.000Z
mobile_app1/module971/src/main/java/module971packageJava0/Foo51.java
HiWong/android-build-eval
d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6
[ "Apache-2.0" ]
5
2021-01-26T13:53:49.000Z
2021-08-11T20:10:57.000Z
11.441176
45
0.575835
10,857
package module971packageJava0; import java.lang.Integer; public class Foo51 { Integer int0; Integer int1; public void foo0() { new module971packageJava0.Foo50().foo5(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } }
3e199125bd1aad88729f90197c520b582a51d6fe
315
java
Java
com/intkr/saas/dao/item/ItemTagRelatedDAO.java
Beiden/Intkr_SAAS_BEIDEN
fb2b68f2e04a891523e3589dd3abebd2fcd5828d
[ "Apache-2.0" ]
null
null
null
com/intkr/saas/dao/item/ItemTagRelatedDAO.java
Beiden/Intkr_SAAS_BEIDEN
fb2b68f2e04a891523e3589dd3abebd2fcd5828d
[ "Apache-2.0" ]
null
null
null
com/intkr/saas/dao/item/ItemTagRelatedDAO.java
Beiden/Intkr_SAAS_BEIDEN
fb2b68f2e04a891523e3589dd3abebd2fcd5828d
[ "Apache-2.0" ]
1
2022-03-16T15:04:17.000Z
2022-03-16T15:04:17.000Z
16.578947
70
0.720635
10,858
package com.intkr.saas.dao.item; import com.intkr.saas.dao.BaseDAO; import com.intkr.saas.domain.dbo.item.ItemTagRelatedDO; /** * 商品标签 * * @table item_tag_related * * @author Beiden * @date 2020-11-02 09:54:14 * @version 1.0 */ public interface ItemTagRelatedDAO extends BaseDAO<ItemTagRelatedDO> { }
3e19915089ad014464355420b4a691c6e3b27183
4,288
java
Java
test/com/cedarsolutions/client/gwt/widget/UnorderedListClientTest.java
cedarsolutions/cedar-common
0984a7f11f7819b7561e8875008697af1a77dd3f
[ "Apache-2.0" ]
null
null
null
test/com/cedarsolutions/client/gwt/widget/UnorderedListClientTest.java
cedarsolutions/cedar-common
0984a7f11f7819b7561e8875008697af1a77dd3f
[ "Apache-2.0" ]
null
null
null
test/com/cedarsolutions/client/gwt/widget/UnorderedListClientTest.java
cedarsolutions/cedar-common
0984a7f11f7819b7561e8875008697af1a77dd3f
[ "Apache-2.0" ]
null
null
null
35.147541
74
0.553172
10,859
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C E D A R * S O L U T I O N S "Software done right." * S O F T W A R E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (c) 2013 Kenneth J. Pronovici. * All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the Apache License, Version 2.0. * See LICENSE for more information about the licensing terms. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Author : Kenneth J. Pronovici <envkt@example.com> * Language : Java 6 * Project : Common Java Functionality * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package com.cedarsolutions.client.gwt.widget; import com.cedarsolutions.client.gwt.junit.ClientTestCase; /** * Client-side unit tests for UnorderedList. * @author Kenneth J. Pronovici <envkt@example.com> */ public class UnorderedListClientTest extends ClientTestCase { /** Test the constructor(). */ public void testConstructor() { UnorderedList list = new UnorderedList(); assertEquals("ul", list.getElement().getTagName().toLowerCase()); assertEquals(0, list.getElement().getChildCount()); } /** Test add() for text data. */ public void testAddText() { UnorderedList list = new UnorderedList(); list.add("Hello"); ListItem widget = (ListItem) list.getWidget(0); assertEquals("Hello", widget.getText()); list.add("ken"); widget = (ListItem) list.getWidget(0); assertEquals("Hello", widget.getText()); widget = (ListItem) list.getWidget(1); assertEquals("ken", widget.getText()); } /** Test add() for a ListItem. */ public void testAddListItem() { UnorderedList list = new UnorderedList(); ListItem listItem = new ListItem("Hello"); list.add(listItem); ListItem widget = (ListItem) list.getWidget(0); assertEquals("Hello", widget.getText()); listItem = new ListItem("ken"); list.add(listItem); widget = (ListItem) list.getWidget(0); assertEquals("Hello", widget.getText()); widget = (ListItem) list.getWidget(1); assertEquals("ken", widget.getText()); } /** Test insert() for text data. */ public void testInsertText() { UnorderedList list = new UnorderedList(); list.insert("Hello", 0); ListItem widget = (ListItem) list.getWidget(0); assertEquals("Hello", widget.getText()); list.insert("ken", 0); widget = (ListItem) list.getWidget(0); assertEquals("ken", widget.getText()); widget = (ListItem) list.getWidget(1); assertEquals("Hello", widget.getText()); list.insert("whatever", 1); widget = (ListItem) list.getWidget(0); assertEquals("ken", widget.getText()); widget = (ListItem) list.getWidget(1); assertEquals("whatever", widget.getText()); widget = (ListItem) list.getWidget(2); assertEquals("Hello", widget.getText()); } /** Test insert() for a ListItem. */ public void testInsertListItem() { UnorderedList list = new UnorderedList(); ListItem listItem = new ListItem("Hello"); list.insert(listItem, 0); ListItem widget = (ListItem) list.getWidget(0); assertEquals("Hello", widget.getText()); listItem = new ListItem("ken"); list.insert(listItem, 0); widget = (ListItem) list.getWidget(0); assertEquals("ken", widget.getText()); widget = (ListItem) list.getWidget(1); assertEquals("Hello", widget.getText()); listItem = new ListItem("whatever"); list.insert(listItem, 1); widget = (ListItem) list.getWidget(0); assertEquals("ken", widget.getText()); widget = (ListItem) list.getWidget(1); assertEquals("whatever", widget.getText()); widget = (ListItem) list.getWidget(2); assertEquals("Hello", widget.getText()); } }
3e199190d901d347f162adc47c3285ca47f0bcd8
261
java
Java
sample-chat-java/app/src/main/java/com/quickblox/sample/chat/java/ui/adapter/listeners/AttachClickListener.java
ShreeKrish/quickblox-android-sdk
d01e0b651058e99de74a90792b412ad9ca875c97
[ "BSD-3-Clause" ]
378
2015-01-06T18:57:01.000Z
2022-02-16T02:49:13.000Z
sample-chat-java/app/src/main/java/com/quickblox/sample/chat/java/ui/adapter/listeners/AttachClickListener.java
ShreeKrish/quickblox-android-sdk
d01e0b651058e99de74a90792b412ad9ca875c97
[ "BSD-3-Clause" ]
623
2015-01-04T20:10:55.000Z
2022-03-31T11:12:52.000Z
sample-chat-java/app/src/main/java/com/quickblox/sample/chat/java/ui/adapter/listeners/AttachClickListener.java
ShreeKrish/quickblox-android-sdk
d01e0b651058e99de74a90792b412ad9ca875c97
[ "BSD-3-Clause" ]
616
2015-01-04T20:44:00.000Z
2022-02-06T12:59:10.000Z
26.1
83
0.816092
10,860
package com.quickblox.sample.chat.java.ui.adapter.listeners; import android.view.View; import com.quickblox.chat.model.QBAttachment; public interface AttachClickListener { void onAttachmentClicked(int itemViewType, View view, QBAttachment attachment); }
3e19930f99df4619bdcc19e39a025d5e49bdc1a0
607
java
Java
CodingBat/Java/Array-2/bigDiff.java
unobatbayar/codingbat
085c86f8f2f043cc020ba0f5fcc364d3f03de9e6
[ "MIT" ]
2
2018-10-28T16:56:20.000Z
2019-05-17T19:13:21.000Z
CodingBat/Java/Array-2/bigDiff.java
unobatbayar/coding-bat
3493f1e6b926877f78c47c8efc348a2d7870a39e
[ "MIT" ]
2
2022-02-22T04:23:15.000Z
2022-03-31T06:55:56.000Z
CodingBat/Java/Array-2/bigDiff.java
unobatbayar/coding-bat
3493f1e6b926877f78c47c8efc348a2d7870a39e
[ "MIT" ]
null
null
null
27.590909
225
0.62603
10,861
/* Given an array length 1 or more of ints, return the difference between the largest and smallest values in the array. Note: the built-in Math.min(v1, v2) and Math.max(v1, v2) methods return the smaller or larger of two values. bigDiff([10, 3, 5, 6]) → 7 bigDiff([7, 2, 10, 9]) → 8 bigDiff([2, 10, 7, 2]) → 8 @author unobatbayar */ public int bigDiff(int[] nums) { int smallest = nums[0]; int largest = nums[0]; for(int i = 0; i<nums.length; i++){ smallest = Math.min(smallest, nums[i]); largest = Math.max(largest, nums[i]); } return largest - smallest; }
3e19943d098612138bcd647397c7a92a16f30e3f
4,995
java
Java
app/src/test/java/model/report/ReportTest.java
kapistelijaKrisu/a-stars-in-map
7ad10a365303c72c8cee834c44081e3066fc3fc6
[ "MIT" ]
null
null
null
app/src/test/java/model/report/ReportTest.java
kapistelijaKrisu/a-stars-in-map
7ad10a365303c72c8cee834c44081e3066fc3fc6
[ "MIT" ]
1
2019-02-12T09:04:37.000Z
2019-02-18T15:47:00.000Z
app/src/test/java/model/report/ReportTest.java
kapistelijaKrisu/a-stars-in-map
7ad10a365303c72c8cee834c44081e3066fc3fc6
[ "MIT" ]
1
2019-02-20T18:05:54.000Z
2019-02-20T18:05:54.000Z
46.682243
115
0.684084
10,862
package model.report; import org.junit.jupiter.api.Test; import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.*; public class ReportTest { @Test public void validationTest() { Report report = new Report(); report.setValueOf(ReportCodeKey.ALGORITHM_NAME, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.CPU, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.COMPILER, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.RUNTIME, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.VM_NAME, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.VM_VERSION, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.ENV_HEAP, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.MAP_INFO, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.THEORY_TIME_COMPLEXITY, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.THEORY_SPACE_COMPLEXITY, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.IMPLEMENTATION_INFO, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.TIME_USED, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.SPACE_USED, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.MAX_STEPS, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.PATH_WEIGHT, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.PROCESSED_MAP, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.STEPS_USED, ""); assertFalse(report.isValid()); report.setValueOf(ReportCodeKey.OS, ""); assertTrue(report.isValid()); } @Test public void setterAndGetterTest() { Report report = new Report(); report.setValueOf(ReportCodeKey.ALGORITHM_NAME, "a"); assertEquals("a", report.getValueOf(ReportCodeKey.ALGORITHM_NAME)); report.setValueOf(ReportCodeKey.CPU, "b"); assertEquals("b", report.getValueOf(ReportCodeKey.CPU)); report.setValueOf(ReportCodeKey.COMPILER, "c"); assertEquals("c", report.getValueOf(ReportCodeKey.COMPILER)); report.setValueOf(ReportCodeKey.RUNTIME, "d"); assertEquals("d", report.getValueOf(ReportCodeKey.RUNTIME)); report.setValueOf(ReportCodeKey.VM_NAME, "e"); assertEquals("e", report.getValueOf(ReportCodeKey.VM_NAME)); report.setValueOf(ReportCodeKey.VM_VERSION, "f"); assertEquals("f", report.getValueOf(ReportCodeKey.VM_VERSION)); report.setValueOf(ReportCodeKey.ENV_HEAP, "g"); assertEquals("g", report.getValueOf(ReportCodeKey.ENV_HEAP)); report.setValueOf(ReportCodeKey.MAP_INFO, "h"); assertEquals("h", report.getValueOf(ReportCodeKey.MAP_INFO)); report.setValueOf(ReportCodeKey.THEORY_TIME_COMPLEXITY, "i"); assertEquals("i", report.getValueOf(ReportCodeKey.THEORY_TIME_COMPLEXITY)); report.setValueOf(ReportCodeKey.THEORY_SPACE_COMPLEXITY, "j"); assertEquals("j", report.getValueOf(ReportCodeKey.THEORY_SPACE_COMPLEXITY)); report.setValueOf(ReportCodeKey.IMPLEMENTATION_INFO, "q"); assertEquals("q", report.getValueOf(ReportCodeKey.IMPLEMENTATION_INFO)); report.setValueOf(ReportCodeKey.TIME_USED, "l"); assertEquals("l", report.getValueOf(ReportCodeKey.TIME_USED)); report.setValueOf(ReportCodeKey.SPACE_USED, "m"); assertEquals("m", report.getValueOf(ReportCodeKey.SPACE_USED)); report.setValueOf(ReportCodeKey.MAX_STEPS, "o"); assertEquals("o", report.getValueOf(ReportCodeKey.MAX_STEPS)); report.setValueOf(ReportCodeKey.PATH_WEIGHT, "p"); assertEquals("p", report.getValueOf(ReportCodeKey.PATH_WEIGHT)); report.setValueOf(ReportCodeKey.PROCESSED_MAP, "q"); assertEquals("q", report.getValueOf(ReportCodeKey.PROCESSED_MAP)); report.setValueOf(ReportCodeKey.STEPS_USED, "r"); assertEquals("r", report.getValueOf(ReportCodeKey.STEPS_USED)); report.setValueOf(ReportCodeKey.OS, "s"); assertEquals("s", report.getValueOf(ReportCodeKey.OS)); } @Test public void throwsErrorIfNoSuchKeyTest() { Report report = new Report(); Throwable exceptionNull = assertThrows(IllegalArgumentException.class, () -> report.setValueOf(null, "a")); assertEquals("No such value in report!", exceptionNull.getMessage()); } @Test public void valuesToMapTest() { Report report = new Report(); var resultingMap = report.valuesToMap(); assertEquals(ReportCodeKey.values().length, resultingMap.entrySet().size()); } }
3e19948147eb15ee1908b929895d93730edbcb31
2,041
java
Java
src/main/java/net/talaatharb/experiments/config/DatasourceProxyBeanPostProcessor.java
TalaatHarb/mapstruct-experiments
372290e46f54297e0327d2ade8a914db1df3acb0
[ "Apache-2.0" ]
null
null
null
src/main/java/net/talaatharb/experiments/config/DatasourceProxyBeanPostProcessor.java
TalaatHarb/mapstruct-experiments
372290e46f54297e0327d2ade8a914db1df3acb0
[ "Apache-2.0" ]
null
null
null
src/main/java/net/talaatharb/experiments/config/DatasourceProxyBeanPostProcessor.java
TalaatHarb/mapstruct-experiments
372290e46f54297e0327d2ade8a914db1df3acb0
[ "Apache-2.0" ]
null
null
null
34.59322
94
0.809897
10,863
package net.talaatharb.experiments.config; import java.lang.reflect.Method; import javax.sql.DataSource; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; import org.springframework.aop.framework.ProxyFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.stereotype.Component; import org.springframework.util.ReflectionUtils; import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel; import net.ttddyy.dsproxy.support.ProxyDataSource; import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; @Component public class DatasourceProxyBeanPostProcessor implements BeanPostProcessor { @Value(value = "${spring.datasource.url:Datasource}") private String dataSourceName; @Override public Object postProcessAfterInitialization(Object bean, String beanName) { if (bean instanceof DataSource && !(bean instanceof ProxyDataSource)) { final ProxyFactory factory = new ProxyFactory(bean); factory.setProxyTargetClass(true); factory.addAdvice(new ProxyDataSourceInterceptor((DataSource) bean, dataSourceName)); return factory.getProxy(); } return bean; } @Override public Object postProcessBeforeInitialization(Object bean, String beanName) { return bean; } } class ProxyDataSourceInterceptor implements MethodInterceptor { private final DataSource dataSource; public ProxyDataSourceInterceptor(final DataSource dataSource, String dataSourceName) { this.dataSource = ProxyDataSourceBuilder.create(dataSource).name(dataSourceName).multiline() .logQueryBySlf4j(SLF4JLogLevel.INFO).build(); } @Override public Object invoke(final MethodInvocation invocation) throws Throwable { final Method proxyMethod = ReflectionUtils.findMethod(this.dataSource.getClass(), invocation.getMethod().getName()); if (proxyMethod != null) { return proxyMethod.invoke(this.dataSource, invocation.getArguments()); } return invocation.proceed(); } }
3e1994a4b5d0d1246800b8cc43a428e031a4d963
1,115
java
Java
BookKeeping/src/main/java/com/kgc/service/impl/BillsServiceImpl.java
jijunshuo/SSM-BookKeeping
3aaba5bc674e104d1e35779673ed3d6f1bc129ad
[ "Apache-2.0" ]
null
null
null
BookKeeping/src/main/java/com/kgc/service/impl/BillsServiceImpl.java
jijunshuo/SSM-BookKeeping
3aaba5bc674e104d1e35779673ed3d6f1bc129ad
[ "Apache-2.0" ]
null
null
null
BookKeeping/src/main/java/com/kgc/service/impl/BillsServiceImpl.java
jijunshuo/SSM-BookKeeping
3aaba5bc674e104d1e35779673ed3d6f1bc129ad
[ "Apache-2.0" ]
null
null
null
29.342105
98
0.678924
10,864
package com.kgc.service.impl; import com.kgc.mapper.BillsMapper; import com.kgc.pojo.Bills; import com.kgc.service.BillsService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.List; @Service("billsService") public class BillsServiceImpl implements BillsService { @Resource BillsMapper billsMapper; @Override public List<Bills> selectBytypeIdandbillTime(Integer typeid, Date billTime1, Date billTime2) { /* BillsExample example = new BillsExample(); BillsExample.Criteria criteria = example.createCriteria();*/ /* if (typeid != 0) { criteria.andTypeIdEqualTo(typeid); } if (billTime1 != null && billTime2 != null) { System.out.println("111111111"); criteria.andBillTimeBetween(billTime1, billTime2); }*/ List<Bills> bills = billsMapper.selectByExample(null); return bills; } @Override public List<Bills> selectAll() { List<Bills> bills = billsMapper.selectByExample(null); return bills; } }
3e1995baf5166f20c7b44309de413f5c6ea67d43
4,389
java
Java
ExtractedJars/Health_com.huawei.health/javafiles/o/ku.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
3
2019-05-01T09:22:08.000Z
2019-07-06T22:21:59.000Z
ExtractedJars/Health_com.huawei.health/javafiles/o/ku.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
null
null
null
ExtractedJars/Health_com.huawei.health/javafiles/o/ku.java
Andreas237/AndroidPolicyAutomation
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
[ "MIT" ]
1
2020-11-26T12:22:02.000Z
2020-11-26T12:22:02.000Z
34.023256
143
0.533835
10,865
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package o; import android.widget.ImageView; class ku { ku() { // 0 0:aload_0 // 1 1:invokespecial #10 <Method void Object()> // 2 4:return } static void a(float f, float f1, float f2) { if(f >= f1) //* 0 0:fload_0 //* 1 1:fload_1 //* 2 2:fcmpl //* 3 3:iflt 16 throw new IllegalArgumentException("Minimum zoom has to be less than Medium zoom. Call setMinimumZoom() with a more appropriate value"); // 4 6:new #15 <Class IllegalArgumentException> // 5 9:dup // 6 10:ldc1 #17 <String "Minimum zoom has to be less than Medium zoom. Call setMinimumZoom() with a more appropriate value"> // 7 12:invokespecial #20 <Method void IllegalArgumentException(String)> // 8 15:athrow if(f1 >= f2) //* 9 16:fload_1 //* 10 17:fload_2 //* 11 18:fcmpl //* 12 19:iflt 32 throw new IllegalArgumentException("Medium zoom has to be less than Maximum zoom. Call setMaximumZoom() with a more appropriate value"); // 13 22:new #15 <Class IllegalArgumentException> // 14 25:dup // 15 26:ldc1 #22 <String "Medium zoom has to be less than Maximum zoom. Call setMaximumZoom() with a more appropriate value"> // 16 28:invokespecial #20 <Method void IllegalArgumentException(String)> // 17 31:athrow else return; // 18 32:return } static boolean c(android.widget.ImageView.ScaleType scaletype) { if(scaletype == null) //* 0 0:aload_0 //* 1 1:ifnonnull 6 return false; // 2 4:iconst_0 // 3 5:ireturn static class _cls3 { static final int b[]; static { b = new int[android.widget.ImageView.ScaleType.values().length]; // 0 0:invokestatic #18 <Method android.widget.ImageView$ScaleType[] android.widget.ImageView$ScaleType.values()> // 1 3:arraylength // 2 4:newarray int[] // 3 6:putstatic #20 <Field int[] b> try { b[android.widget.ImageView.ScaleType.MATRIX.ordinal()] = 1; // 4 9:getstatic #20 <Field int[] b> // 5 12:getstatic #24 <Field android.widget.ImageView$ScaleType android.widget.ImageView$ScaleType.MATRIX> // 6 15:invokevirtual #28 <Method int android.widget.ImageView$ScaleType.ordinal()> // 7 18:iconst_1 // 8 19:iastore // 9 20:return } catch(NoSuchFieldError nosuchfielderror) { } // 10 21:astore_0 //* 11 22:return } } switch(_cls3.b[scaletype.ordinal()]) //* 4 6:getstatic #28 <Field int[] ku$3.b> //* 5 9:aload_0 //* 6 10:invokevirtual #34 <Method int android.widget.ImageView$ScaleType.ordinal()> //* 7 13:iaload { //* 8 14:lookupswitch 1: default 32 // 1: 35 //* 9 32:goto 45 case 1: // '\001' throw new IllegalStateException("Matrix scale type is not supported"); // 10 35:new #36 <Class IllegalStateException> // 11 38:dup // 12 39:ldc1 #38 <String "Matrix scale type is not supported"> // 13 41:invokespecial #39 <Method void IllegalStateException(String)> // 14 44:athrow } return true; // 15 45:iconst_1 // 16 46:ireturn } static boolean c(ImageView imageview) { return imageview.getDrawable() != null; // 0 0:aload_0 // 1 1:invokevirtual #46 <Method android.graphics.drawable.Drawable ImageView.getDrawable()> // 2 4:ifnull 9 // 3 7:iconst_1 // 4 8:ireturn // 5 9:iconst_0 // 6 10:ireturn } static int d(int i) { return (0xff00 & i) >> 8; // 0 0:ldc1 #49 <Int 65280> // 1 2:iload_0 // 2 3:iand // 3 4:bipush 8 // 4 6:ishr // 5 7:ireturn } }
3e1997bc623a71d06bdf5f00cfb707eb90f4cebb
3,325
java
Java
net.tascalate.javaflow.tools.cdi-javaagent/src/main/java/org/apache/commons/javaflow/instrumentation/cdi/weld/WeldProxyClassProcessor.java
sancar/tascalate-javaflow
ebd370e4665a5dd3de2299b7f87592f2d2f6958a
[ "Apache-2.0" ]
62
2016-06-14T13:36:57.000Z
2022-03-30T13:41:10.000Z
net.tascalate.javaflow.tools.cdi-javaagent/src/main/java/org/apache/commons/javaflow/instrumentation/cdi/weld/WeldProxyClassProcessor.java
sancar/tascalate-javaflow
ebd370e4665a5dd3de2299b7f87592f2d2f6958a
[ "Apache-2.0" ]
6
2016-10-30T19:17:22.000Z
2021-08-02T16:58:35.000Z
net.tascalate.javaflow.tools.cdi-javaagent/src/main/java/org/apache/commons/javaflow/instrumentation/cdi/weld/WeldProxyClassProcessor.java
sancar/tascalate-javaflow
ebd370e4665a5dd3de2299b7f87592f2d2f6958a
[ "Apache-2.0" ]
10
2017-03-29T23:58:53.000Z
2022-03-15T12:12:40.000Z
42.088608
149
0.680902
10,866
/** * Copyright 2013-2019 Valery Silaev (http://vsilaev.com) * * 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.apache.commons.javaflow.instrumentation.cdi.weld; import net.tascalate.asmx.MethodVisitor; import net.tascalate.asmx.Opcodes; import net.tascalate.asmx.Type; import net.tascalate.asmx.commons.Method; import org.apache.commons.javaflow.providers.asmx.ContinuableClassInfo; import org.apache.commons.javaflow.instrumentation.cdi.ExtendedClassVisitor; import org.apache.commons.javaflow.instrumentation.cdi.ProxyClassProcessor; import org.apache.commons.javaflow.instrumentation.cdi.common.ProxiedMethodAdvice; public class WeldProxyClassProcessor extends ProxyClassProcessor { boolean hasTargetInstanceMethod = false; public WeldProxyClassProcessor(int api, String className, ContinuableClassInfo classInfo) { super(api, className, classInfo); } @Override protected MethodVisitor visitMethod(ExtendedClassVisitor cv, int access, String name, String descriptor, String signature, String[] exceptions) { Method m = GET_TARGET_INSTANCE; // True if NEW weld_getTargetInstance() is present hasTargetInstanceMethod |= m.getName().equals(name) && m.getDescriptor().equals(descriptor); return super.visitMethod(cv, access, name, descriptor, signature, exceptions); } @Override protected MethodVisitor createAdviceAdapter(MethodVisitor mv, int access, String name, String descriptor) { return new ProxiedMethodAdvice(api, mv, access, className, name, descriptor) { @Override protected void loadProxiedInstance() { loadThis(); invokeVirtual(Type.getObjectType(className), GET_TARGET_INSTANCE); } }; } @Override protected void visitEnd(ExtendedClassVisitor cv) { if (!hasTargetInstanceMethod) { // If NEW weld_getTargetInstance() is missing // then generate it and delegate call to OLD getTargetInstance() Method m = GET_TARGET_INSTANCE; MethodVisitor mv = cv.visitMethod(Opcodes.ACC_SYNTHETIC + Opcodes.ACC_FINAL, m.getName(), m.getDescriptor(), null, null); mv.visitCode(); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className, "getTargetInstance", m.getDescriptor(), false); mv.visitInsn(Opcodes.ARETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } super.visitEnd(cv); } private static final Method GET_TARGET_INSTANCE = Method.getMethod("java.lang.Object weld_getTargetInstance()"); }
3e1997cbd3701183c26939baf574e13604c12b48
747
java
Java
mobile-client-android/sentinel_android/app/src/main/java/sentinelgroup/io/sentinel/viewmodel/TxHistoryViewModelFactory.java
sentinel-official/sentinel-go
d0238f4ff21d0a7f2d684f645e47cff85550f0d9
[ "MIT" ]
342
2017-08-21T20:12:56.000Z
2022-03-19T17:58:25.000Z
mobile-client-android/sentinel_android/app/src/main/java/sentinelgroup/io/sentinel/viewmodel/TxHistoryViewModelFactory.java
sentinel-official/sentinel-go
d0238f4ff21d0a7f2d684f645e47cff85550f0d9
[ "MIT" ]
57
2017-11-13T11:16:47.000Z
2022-03-01T13:54:31.000Z
mobile-client-android/sentinel_android/app/src/main/java/sentinelgroup/io/sentinel/viewmodel/TxHistoryViewModelFactory.java
smtcrms/sentinel
ff65bc9200f6c940aa184c0ec0872fdcfef25363
[ "MIT" ]
72
2017-11-23T05:13:24.000Z
2022-02-25T14:18:33.000Z
32.478261
85
0.787149
10,867
package sentinelgroup.io.sentinel.viewmodel; import android.arch.lifecycle.ViewModel; import android.arch.lifecycle.ViewModelProvider; import android.support.annotation.NonNull; import sentinelgroup.io.sentinel.repository.TxHistoryRepository; import sentinelgroup.io.sentinel.util.AppExecutors; public class TxHistoryViewModelFactory extends ViewModelProvider.NewInstanceFactory { private final TxHistoryRepository mRepository; public TxHistoryViewModelFactory(TxHistoryRepository iRepository) { mRepository = iRepository; } @NonNull @Override public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { //noinspection unchecked return (T) new TxHistoryViewModel(mRepository); } }
3e1997d8e3902ee8a55b4d0decf440599b5bf235
1,012
java
Java
fabric-jdbc-driver/src/main/java/com/impetus/fabric/jdbc/DriverConstants.java
ajay-shriwastava/fabric-jdbc-connector
7c98f9ebfc1831e1f034eb5a4e2fd4c2f12f58ec
[ "Apache-2.0" ]
13
2018-06-19T11:57:06.000Z
2020-06-07T04:32:46.000Z
fabric-jdbc-driver/src/main/java/com/impetus/fabric/jdbc/DriverConstants.java
ajay-shriwastava/fabric-jdbc-connector
7c98f9ebfc1831e1f034eb5a4e2fd4c2f12f58ec
[ "Apache-2.0" ]
10
2018-06-22T07:32:39.000Z
2018-09-03T05:39:24.000Z
fabric-jdbc-driver/src/main/java/com/impetus/fabric/jdbc/DriverConstants.java
ajay-shriwastava/fabric-jdbc-connector
7c98f9ebfc1831e1f034eb5a4e2fd4c2f12f58ec
[ "Apache-2.0" ]
18
2018-06-20T06:53:02.000Z
2019-05-16T08:45:31.000Z
38.923077
80
0.603755
10,868
/******************************************************************************* * * Copyright 2018 Impetus Infotech. * * * * 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.impetus.fabric.jdbc; public class DriverConstants { public static final String DRIVER_PREFIX = "jdbc:fabric"; public static final int MAJOR_VERSION = 1; public static final int MINOR_VERSION = 0; }
3e199a3d538ae9ed3e4164d73e1541e43945c025
544
java
Java
src/bandago/filters/SwitchFilter.java
hcvazquez/JSpIRIT
633aba4abe48aa7a166b8b91957d44c6ad3ca4f9
[ "MIT" ]
11
2018-08-17T12:18:46.000Z
2020-06-26T14:11:39.000Z
src/bandago/filters/SwitchFilter.java
hcvazquez/JSpIRIT
633aba4abe48aa7a166b8b91957d44c6ad3ca4f9
[ "MIT" ]
2
2018-08-17T11:10:28.000Z
2019-05-20T11:06:00.000Z
src/bandago/filters/SwitchFilter.java
hcvazquez/JSpIRIT
633aba4abe48aa7a166b8b91957d44c6ad3ca4f9
[ "MIT" ]
7
2018-08-17T11:01:55.000Z
2022-02-11T13:07:11.000Z
21.76
72
0.75
10,869
package bandago.filters; import java.util.ArrayList; import org.eclipse.jdt.core.dom.ASTNode; import bandago.utils.StatementSet; public class SwitchFilter extends StatementFilter { public SwitchFilter(int minimunStatements) { super(minimunStatements); name = "Switch-Case Getter"; } protected void getter() { ArrayList<StatementSet> auxstatements = new ArrayList<StatementSet>(); for(StatementSet s:statements){ if ((s.getType() == ASTNode.SWITCH_STATEMENT)) auxstatements.add(s); } statements = auxstatements; } }
3e199a9db8b3e4261c6f2132d56037586f1b5998
322
java
Java
androidsbrick/src/main/java/it/ambient/androidsbrick/command/SBrickCommand.java
salzix/androidsbrick
a5d05d9f774d5503faf92094f51e0003a053967d
[ "MIT" ]
1
2019-03-31T12:47:26.000Z
2019-03-31T12:47:26.000Z
androidsbrick/src/main/java/it/ambient/androidsbrick/command/SBrickCommand.java
salzix/androidsbrick
a5d05d9f774d5503faf92094f51e0003a053967d
[ "MIT" ]
null
null
null
androidsbrick/src/main/java/it/ambient/androidsbrick/command/SBrickCommand.java
salzix/androidsbrick
a5d05d9f774d5503faf92094f51e0003a053967d
[ "MIT" ]
null
null
null
26.833333
50
0.736025
10,870
package it.ambient.androidsbrick.command; import java.io.IOException; public interface SBrickCommand { static final byte CHANNEL_A = 0x00; static final byte CHANNEL_B = 0x01; static final byte CHANNEL_C = 0x02; static final byte CHANNEL_D = 0x03; byte[] getPreparedStream() throws IOException; }
3e199af37bfcc8911b976ebbebd8dc18f9843458
2,685
java
Java
addressbook-web-tests/src/test/java/spkrash/krashinc/addressbook/tests/ContactRemoveFromGroupTests.java
spkrash/java_workshop
c39dc39dfef08878058b251647cba3b53a6ee306
[ "Apache-2.0" ]
null
null
null
addressbook-web-tests/src/test/java/spkrash/krashinc/addressbook/tests/ContactRemoveFromGroupTests.java
spkrash/java_workshop
c39dc39dfef08878058b251647cba3b53a6ee306
[ "Apache-2.0" ]
null
null
null
addressbook-web-tests/src/test/java/spkrash/krashinc/addressbook/tests/ContactRemoveFromGroupTests.java
spkrash/java_workshop
c39dc39dfef08878058b251647cba3b53a6ee306
[ "Apache-2.0" ]
null
null
null
40.104478
116
0.65054
10,871
package spkrash.krashinc.addressbook.tests; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import spkrash.krashinc.addressbook.model.ContactData; import spkrash.krashinc.addressbook.model.Contacts; import spkrash.krashinc.addressbook.model.GroupData; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; /** * Created by Krash on 07.12.2016. */ public class ContactRemoveFromGroupTests extends TestBase { @BeforeMethod public void ensurePreconditions() { app.goTo().homePage(); if (app.db().contacts().size() == 0) { app.contact().create(new ContactData() .withFirstName("Bruce").withMiddleName("(B)").withLastName("Wayne").withNickname("Batman") .withAddress("Gotham City").withEmail("dycjh@example.com").withEmail2("dycjh@example.com") .withEmail3("upchh@example.com").withMobileNum("+380500000000").withHomePhone("+380400000000") .withWorkPhone("+380600000000")); } if (app.db().groups().size() == 0) { app.goTo().groupPage(); app.group().create(new GroupData().withName("testGroup1").withHeader("headerGr1").withFooter("footerGr1")); app.goTo().homePage(); } } @Test public void testRemoveContactFromGroup() { for (GroupData group : app.db().groups()) { if (!group.getContacts().isEmpty()) { Contacts before = group.getContacts(); app.contact().selectGroupView(group.getId()); ContactData removedContact = before.iterator().next(); app.contact().selectContactById(removedContact.getId()); app.contact().removeSelectedContactsFromGroup(); app.goTo().homePage(); app.db().refresh(group); Contacts after = group.getContacts(); assertThat(after, equalTo(before.withOut(removedContact))); return; } } ContactData contactInTest = app.db().contacts().iterator().next(); app.contact().selectContactById(contactInTest.getId()); GroupData group = app.db().groups().iterator().next(); app.contact().selectGroupForAdd(group.getId()); app.contact().addToSelectedGroup(); app.goTo().homePage(); app.db().refresh(group); assertThat(group.getContacts().size(), equalTo(1)); app.contact().selectGroupView(group.getId()); app.contact().selectContactById(contactInTest.getId()); app.contact().removeSelectedContactsFromGroup(); app.goTo().homePage(); app.db().refresh(group); assertThat(group.getContacts().size(), equalTo(0)); } }
3e199afb067db0d2f67c06f4761feb4191651844
2,024
java
Java
src/main/java/frc/robot/commands/AutomaticLED.java
FRC0322/FRC322Java2020
c40dd48486967bc999ff23acc59a672bb38b6f87
[ "BSD-3-Clause" ]
null
null
null
src/main/java/frc/robot/commands/AutomaticLED.java
FRC0322/FRC322Java2020
c40dd48486967bc999ff23acc59a672bb38b6f87
[ "BSD-3-Clause" ]
2
2020-02-04T23:46:07.000Z
2020-02-06T02:35:42.000Z
src/main/java/frc/robot/commands/AutomaticLED.java
FRC0322/FRC322Java2020
c40dd48486967bc999ff23acc59a672bb38b6f87
[ "BSD-3-Clause" ]
1
2021-01-08T01:31:13.000Z
2021-01-08T01:31:13.000Z
31.625
80
0.655632
10,872
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.commands; import edu.wpi.first.wpilibj.util.Color; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.Constants; import frc.robot.subsystems.AddressableLEDs; import frc.robot.subsystems.LED; public class AutomaticLED extends CommandBase { private final LED m_led; private final AddressableLEDs m_addressableLEDs; /** * Creates a new AutomaticLED. */ public AutomaticLED(LED led, AddressableLEDs addressableLEDs) { m_led = led; m_addressableLEDs = addressableLEDs; // Use addRequirements() here to declare subsystem dependencies. addRequirements(m_led); addRequirements(m_addressableLEDs); } // Called when the command is initially scheduled. @Override public void initialize() { m_led.setRGB(Color.kWhite, Constants.DEFAULT_BLINK_RATE); for(var i = 0; i < m_addressableLEDs.getLength(); i++) m_addressableLEDs.setLED(i, Color.kWhite); } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { m_led.automaticLEDSetter(); m_addressableLEDs.automaticLEDSetter(); } // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { m_led.setRGB(Color.kWhite, Constants.DEFAULT_BLINK_RATE); for(var i = 0; i < m_addressableLEDs.getLength(); i++) m_addressableLEDs.setLED(i, Color.kWhite); } // Returns true when the command should end. @Override public boolean isFinished() { return false; } @Override public boolean runsWhenDisabled() { return true; } }
3e199b86a84315f0b4137faea474bec9a2be3421
477
java
Java
keanu-project/src/test/java/io/improbable/keanu/util/CsvDataResource.java
rs992214/keanu
f7f9b877aaaf9c9f732604f17da238e15dfdad13
[ "MIT" ]
153
2018-04-06T13:30:31.000Z
2022-01-31T10:05:27.000Z
keanu-project/src/test/java/io/improbable/keanu/util/CsvDataResource.java
shinnlok/keanu
c75b2a00571a0da93c6b1d5e9f0cbe09aebdde4d
[ "MIT" ]
168
2018-04-06T16:37:33.000Z
2021-09-27T21:43:54.000Z
keanu-project/src/test/java/io/improbable/keanu/util/CsvDataResource.java
shinnlok/keanu
c75b2a00571a0da93c6b1d5e9f0cbe09aebdde4d
[ "MIT" ]
46
2018-04-10T10:46:01.000Z
2022-02-24T02:53:50.000Z
23.85
65
0.672956
10,873
package io.improbable.keanu.util; import io.improbable.keanu.util.csv.ReadCsv; import org.junit.rules.ExternalResource; public class CsvDataResource<T> extends ExternalResource { private T data; public CsvDataResource(String fileLocation, Class<T> clazz) { this.data = ReadCsv .fromResources(fileLocation) .asVectorizedColumnsDefinedBy(clazz) .load(true); } public T getData() { return this.data; } }
3e199b9587fe612eb335759adfa59e79e1e6f960
1,284
java
Java
javacors-runtime/src/main/java/io/mikesir87/javacors/validators/OriginValidator.java
mikesir87/javacors
fa65ea88ae0bde22ba8174c26f77b2101aca0967
[ "Apache-2.0" ]
null
null
null
javacors-runtime/src/main/java/io/mikesir87/javacors/validators/OriginValidator.java
mikesir87/javacors
fa65ea88ae0bde22ba8174c26f77b2101aca0967
[ "Apache-2.0" ]
8
2017-03-31T15:08:45.000Z
2019-09-10T13:31:37.000Z
javacors-runtime/src/main/java/io/mikesir87/javacors/validators/OriginValidator.java
mikesir87/javacors
fa65ea88ae0bde22ba8174c26f77b2101aca0967
[ "Apache-2.0" ]
2
2017-04-18T20:35:26.000Z
2017-10-23T23:57:04.000Z
28.533333
112
0.719626
10,874
package io.mikesir87.javacors.validators; import io.mikesir87.javacors.CorsConfiguration; import java.util.List; /** * A {@link CorsValidator} that validates that the requested request has an Origin header that is allowed by the * server configuration. * * @author Michael Irwin */ public class OriginValidator implements CorsValidator { private static final String NAME = "OriginValidator"; private static final String WILDCARD_ORIGIN = "*"; @Override public String getName() { return NAME; } public boolean shouldAddHeaders(CorsRequestContext requestContext, CorsConfiguration configuration) { String origin = requestContext.getOriginHeader(); // Origin header MUST be provided (Spec 6.2, Step #1) if (origin == null) return false; List<String> authorizedOrigins = configuration.getAuthorizedOrigins(); if (authorizedOrigins.size() == 1 && authorizedOrigins.get(0).equals(WILDCARD_ORIGIN)) return true; for (String authorizedOrigin : authorizedOrigins) { if (origin.equals(authorizedOrigin)) return true; if (authorizedOrigin.startsWith(WILDCARD_ORIGIN + ".") && origin.endsWith(authorizedOrigin.substring(WILDCARD_ORIGIN.length()))) return true; } return false; } }
3e199d3b423097b2c3e2625a937b32a1cc3af611
366
java
Java
DesignPattern/src/main/java/com/jdayssol/designpattern/behaviour/interpreter/OperateurBinaire.java
jdayssol/SampleDesignPatterns
5898a29aefd43a0938b1ec5e0898809961e9926a
[ "MIT" ]
null
null
null
DesignPattern/src/main/java/com/jdayssol/designpattern/behaviour/interpreter/OperateurBinaire.java
jdayssol/SampleDesignPatterns
5898a29aefd43a0938b1ec5e0898809961e9926a
[ "MIT" ]
null
null
null
DesignPattern/src/main/java/com/jdayssol/designpattern/behaviour/interpreter/OperateurBinaire.java
jdayssol/SampleDesignPatterns
5898a29aefd43a0938b1ec5e0898809961e9926a
[ "MIT" ]
null
null
null
26.142857
58
0.775956
10,875
package com.jdayssol.designpattern.behaviour.interpreter; public abstract class OperateurBinaire extends Expression { protected Expression operandeGauche, operandeDroite; public OperateurBinaire(Expression operandeGauche, Expression operandeDroite) { this.operandeGauche = operandeGauche; this.operandeDroite = operandeDroite; } }
3e199d746fdc298a82d6c209f9f609033ceca891
502
java
Java
documents/javaFiles/programmingTwo/lab11/craps/GameLayoutApplication.java
KeyMaker13/portfolio
a6c02fe09af4f9a86caf4cd7b74e215751977f88
[ "Zlib", "Apache-2.0" ]
null
null
null
documents/javaFiles/programmingTwo/lab11/craps/GameLayoutApplication.java
KeyMaker13/portfolio
a6c02fe09af4f9a86caf4cd7b74e215751977f88
[ "Zlib", "Apache-2.0" ]
null
null
null
documents/javaFiles/programmingTwo/lab11/craps/GameLayoutApplication.java
KeyMaker13/portfolio
a6c02fe09af4f9a86caf4cd7b74e215751977f88
[ "Zlib", "Apache-2.0" ]
null
null
null
15.6875
72
0.643426
10,876
package craps; import javax.swing.JFrame; public class GameLayoutApplication { /** * @param args */ public static void main(String[] args) { JFrame window = new JFrame("Ivan Capistran Simple Dice Application"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GameLayoutPanel panel = new GameLayoutPanel(); panel.setSize(400,400); window.getContentPane().add(panel); window.pack(); window.setVisible(true); } }
3e199f15f3a354eeb61e69813d1240891bc78122
1,407
java
Java
jvm/src/main/java/edu/nyu/acsys/CVC4/DatatypeHashFunction.java
peterzeller/repliss
33f0a855f3644969f74319870d81a4f21ac5c40e
[ "Apache-2.0" ]
2
2017-04-23T21:28:14.000Z
2020-11-29T13:30:11.000Z
jvm/src/main/java/edu/nyu/acsys/CVC4/DatatypeHashFunction.java
AntidoteDB/repliss-filesystem
3f8c9e59b9f9810721f470930c5332a253cfa738
[ "Apache-2.0" ]
4
2021-01-24T22:19:11.000Z
2021-01-24T22:25:46.000Z
jvm/src/main/java/edu/nyu/acsys/CVC4/DatatypeHashFunction.java
peterzeller/repliss
33f0a855f3644969f74319870d81a4f21ac5c40e
[ "Apache-2.0" ]
5
2017-08-24T12:38:22.000Z
2022-01-17T16:50:05.000Z
27.588235
109
0.619048
10,877
/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 3.0.12 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package edu.nyu.acsys.CVC4; public class DatatypeHashFunction { private transient long swigCPtr; protected transient boolean swigCMemOwn; protected DatatypeHashFunction(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } protected static long getCPtr(DatatypeHashFunction obj) { return (obj == null) ? 0 : obj.swigCPtr; } /* protected void finalize() { delete(); } */ public synchronized void delete() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; CVC4JNI.delete_DatatypeHashFunction(swigCPtr); } swigCPtr = 0; } } public long apply(Datatype dt) { return CVC4JNI.DatatypeHashFunction_apply__SWIG_0(swigCPtr, this, Datatype.getCPtr(dt), dt); } public long apply(DatatypeConstructor dtc) { return CVC4JNI.DatatypeHashFunction_apply__SWIG_1(swigCPtr, this, DatatypeConstructor.getCPtr(dtc), dtc); } public DatatypeHashFunction() { this(CVC4JNI.new_DatatypeHashFunction(), true); } }
3e199f691bd1b79c0eafb6e780c9ae70c1192ac1
201
java
Java
src/Scraper/ScraperCallbackType.java
Gabbersaurus/JavaSpotlightScraper
e3b0f4bb579e36ecffbfe6becf73f686d9cfeb0b
[ "MIT" ]
1
2018-03-15T13:02:50.000Z
2018-03-15T13:02:50.000Z
src/Scraper/ScraperCallbackType.java
Gabbersaurus/JavaSpotlightScraper
e3b0f4bb579e36ecffbfe6becf73f686d9cfeb0b
[ "MIT" ]
null
null
null
src/Scraper/ScraperCallbackType.java
Gabbersaurus/JavaSpotlightScraper
e3b0f4bb579e36ecffbfe6becf73f686d9cfeb0b
[ "MIT" ]
1
2021-05-16T06:35:05.000Z
2021-05-16T06:35:05.000Z
16.75
40
0.681592
10,878
package Scraper; /** * Defines the type of the callback * * LOG = a log message from the scraper * FINISH = the scraper is done scraping */ public enum ScraperCallbackType { LOG, FINISH }
3e199f81f0fe1d5cd8f53d869b92aa601accc100
2,205
java
Java
graphviz-java/src/main/java/guru/nidi/graphviz/engine/V8JavascriptEngine.java
sirocchj/graphviz-java
f0c1fdfa37c8b9876ef1dcccec1a6c19219e727e
[ "Apache-2.0" ]
777
2015-10-19T14:19:41.000Z
2022-03-30T19:44:08.000Z
graphviz-java/src/main/java/guru/nidi/graphviz/engine/V8JavascriptEngine.java
sirocchj/graphviz-java
f0c1fdfa37c8b9876ef1dcccec1a6c19219e727e
[ "Apache-2.0" ]
223
2015-10-20T22:11:01.000Z
2022-03-28T16:10:28.000Z
graphviz-java/src/main/java/guru/nidi/graphviz/engine/V8JavascriptEngine.java
sirocchj/graphviz-java
f0c1fdfa37c8b9876ef1dcccec1a6c19219e727e
[ "Apache-2.0" ]
107
2016-05-17T13:58:24.000Z
2022-03-09T17:14:02.000Z
33.846154
88
0.680455
10,879
/* * Copyright © 2015 Stefan Niederhauser (efpyi@example.com) * * 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 guru.nidi.graphviz.engine; import com.eclipsesource.v8.V8; import com.eclipsesource.v8.V8RuntimeException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Nullable; public class V8JavascriptEngine extends AbstractJavascriptEngine { private static final Logger LOG = LoggerFactory.getLogger(V8JavascriptEngine.class); private final V8 v8; private final ResultHandler resultHandler = new ResultHandler(); public V8JavascriptEngine() { this(null); } public V8JavascriptEngine(@Nullable String extractionPath) { LOG.info("Starting V8 runtime..."); v8 = V8.createV8Runtime(null, extractionPath); LOG.info("Started V8 runtime. Initializing javascript..."); v8.registerJavaMethod((receiver, parameters) -> { resultHandler.setResult(parameters.getString(0)); }, "result"); v8.registerJavaMethod((receiver, parameters) -> { resultHandler.setError(parameters.getString(0)); }, "error"); v8.registerJavaMethod((receiver, parameters) -> { resultHandler.log(parameters.getString(0)); }, "log"); LOG.info("Initialized javascript."); } @Override protected String execute(String js) { try { v8.executeVoidScript(js); return resultHandler.waitFor(); } catch (V8RuntimeException e) { throw new GraphvizException("Problem executing javascript", e); } } @Override public void close() { v8.release(true); } }
3e19a0c96e5e20754d8d314bf9960da9c0b2430d
3,424
java
Java
src/main/java/de/vandermeer/asciithemes/a7/A7_CheckedItems.java
hunter1703/ascii-utf-themes
fa5a689759d20d6554ea9199f35bbee6006dd267
[ "Apache-2.0" ]
1
2017-07-18T13:09:34.000Z
2017-07-18T13:09:34.000Z
src/main/java/de/vandermeer/asciithemes/a7/A7_CheckedItems.java
hunter1703/ascii-utf-themes
fa5a689759d20d6554ea9199f35bbee6006dd267
[ "Apache-2.0" ]
null
null
null
src/main/java/de/vandermeer/asciithemes/a7/A7_CheckedItems.java
hunter1703/ascii-utf-themes
fa5a689759d20d6554ea9199f35bbee6006dd267
[ "Apache-2.0" ]
4
2017-12-12T14:27:23.000Z
2021-04-30T11:46:44.000Z
24.326241
88
0.550146
10,880
/* Copyright 2016 Sven van der Meer <lyhxr@example.com> * * 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.vandermeer.asciithemes.a7; import de.vandermeer.asciithemes.TA_CheckedItem; /** * Collection of {@link TA_CheckedItem} for ASCII characters. * * @author Sven van der Meer &lt;vdmeer.sven@mykolab.com&gt; * @version v0.0.1 build 170404 (04-Apr-17) for Java 1.8 * @since v0.0.1 */ public abstract class A7_CheckedItems { /** * A checked item using `[X]` and `[ ]`. * * ---- * [X] checked item * [ ] unchecked item * ---- * * @return the checked item */ public static TA_CheckedItem sbrX(){ return TA_CheckedItem.create("[X]", "[ ]", "checked item using \"[X]\" and \"[ ]\""); } /** * A checked item using `[x]` and `[ ]`. * * ---- * [x] checked item * [ ] unchecked item * ---- * * @return the checked item */ public static TA_CheckedItem sbrx(){ return TA_CheckedItem.create("[x]", "[ ]", "checked item using \"[x]\" and \"[ ]\""); } /** * A checked item using `{X}` and `{ }`. * * ---- * {X} checked item * { } unchecked item * ---- * * @return the checked item */ public static TA_CheckedItem cbrX(){ return TA_CheckedItem.create("{X}", "{ }", "checked item using \"{X}\" and \"{ }\""); } /** * A checked item using `{x}` and `{ }`. * * ---- * {x} checked item * { } unchecked item * ---- * * @return the checked item */ public static TA_CheckedItem cbrx(){ return TA_CheckedItem.create("{x}", "{ }", "checked item using \"{x}\" and \"{ }\""); } /** * A checked item using `(X)` and `( )`. * * ---- * (X) checked item * ( ) unchecked item * ---- * * @return the checked item */ public static TA_CheckedItem brX(){ return TA_CheckedItem.create("(X)", "( )", "checked item using \"(X)\" and \"( )\""); } /** * A checked item using `(x)` and `( )`. * * ---- * (x) checked item * ( ) unchecked item * ---- * * @return the checked item */ public static TA_CheckedItem brx(){ return TA_CheckedItem.create("(x)", "( )", "checked item using \"(x)\" and \"( )\""); } /** * A checked item using `&lt;X&gt;` and `&lt; &gt;`. * * ---- * &lt;X&gt; checked item * &lt; &gt; unchecked item * ---- * * @return the checked item */ public static TA_CheckedItem gtltX(){ return TA_CheckedItem.create("<X>", "< >", "checked item using \"<X>\" and \"< >\""); } /** * A checked item using `&lt;x&gt;` and `&lt; &gt;`. * * ---- * &lt;x&gt; checked item * &lt; &gt; unchecked item * ---- * * @return the checked item */ public static TA_CheckedItem gtltx(){ return TA_CheckedItem.create("<x>", "< >", "checked item using \"<x>\" and \"< >\""); } }
3e19a14504b54e18f5d371175852ef60c96bb73c
655
java
Java
sonferenz-service/src/main/java/de/bitnoise/sonferenz/service/v2/services/verify/VerifyObject.java
Seitenbau/Sonferenz
734953d464559089602160cc4659fa5525ab842d
[ "Apache-2.0" ]
null
null
null
sonferenz-service/src/main/java/de/bitnoise/sonferenz/service/v2/services/verify/VerifyObject.java
Seitenbau/Sonferenz
734953d464559089602160cc4659fa5525ab842d
[ "Apache-2.0" ]
null
null
null
sonferenz-service/src/main/java/de/bitnoise/sonferenz/service/v2/services/verify/VerifyObject.java
Seitenbau/Sonferenz
734953d464559089602160cc4659fa5525ab842d
[ "Apache-2.0" ]
null
null
null
19.264706
64
0.696183
10,881
package de.bitnoise.sonferenz.service.v2.services.verify; public class VerifyObject { protected StringBuffer _description = new StringBuffer(); protected Object _current; public VerifyObject(Object parameter) { _current = parameter; } public VerifyObject as(String text) { addDescription(text); return this; } public void addDescription(String text) { _description.append(text); } public void isNotNull() { if (_current == null) { error(" was null"); } } protected void error(String postifx) { addDescription(postifx); throw new IllegalArgumentException(_description.toString()); } }
3e19a157bc4cf0a473ec514849c832741e3e05ce
5,043
java
Java
src/ui/Controls.java
addison-howenstine/cell-society
a4b3de123564585cf22795484d8390dc3a563704
[ "MIT" ]
1
2018-03-26T16:04:56.000Z
2018-03-26T16:04:56.000Z
src/ui/Controls.java
billhanyu/cell-society
53f080bfa7ee784a1cc553bd50bf1a925873fa8a
[ "MIT" ]
null
null
null
src/ui/Controls.java
billhanyu/cell-society
53f080bfa7ee784a1cc553bd50bf1a925873fa8a
[ "MIT" ]
null
null
null
29.664706
119
0.706722
10,882
package ui; import java.util.ResourceBundle; import javax.xml.parsers.ParserConfigurationException; import grid.CellGraphic; import init.Initializer; import javafx.beans.value.ChangeListener; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.layout.HBox; /** * @author billyu * UI controls of simulations * return Node's that are sliders and buttons * this class include the general ones: size, play, reset, pause, stop etc * controls unique to each simulation are in subclasses */ public class Controls { private Initializer initializer; private ResourceBundle myResource; public Controls(Initializer initializer, ResourceBundle myResource) { this.initializer = initializer; this.myResource = myResource; } /** * @param input default value of the slider * @param min minimum value of the slider * @param max maximum value of the slider * @param resourceName slider prompt resource key * @param listener what will happens after the value of slider is changed * @return a Node that contains the slider and a Label prompt */ public Node makeSliderBox(int input, int min, int max, String resourceName, ChangeListener<Number> listener) { if (input < min || input > max) { ErrorPop pop = new ErrorPop(300, 200, this.myResource.getString("SliderRangeError"), this.myResource); pop.popup(); throw new IllegalArgumentException(this.myResource.getString("SliderRangeError")); } return new SliderBox(resourceName, min, max, input, 5, listener).getBox(); } /** * @param size default size of the grid * @return slider control of the size */ public Node initSizeSlider(int size) { return makeSliderBox(size, 10, 50, this.myResource.getString("Size"), (observable, old_val, new_val) -> { int newSize = new_val.intValue(); initializer.getParameters().setRows(newSize); initializer.getParameters().setCols(newSize); initializer.update(); }); } /** * @return slider control of refresh speed */ public Node initSpeedSlider() { return makeSliderBox(90, 0, 100, this.myResource.getString("Speed"), (observable, old_val, new_val) -> { int newSpeed = 100 - new_val.intValue(); initializer.getRunner().setSpeed(newSpeed); }); } public Node initShapeButtons() { Button rectangle = initRectangleButton(); Button triangle = initTriangleButton(); Button hexagon = initHexagonButton(); HBox buttons = new HBox(); buttons.getChildren().addAll(rectangle, triangle, hexagon); buttons.setSpacing(10); return buttons; } private Button initRectangleButton() { return makeButton(myResource.getString(CellGraphic.SQUARE), e-> { initializer.setGraphicType(CellGraphic.SQUARE); }); } private Button initTriangleButton() { return makeButton(myResource.getString(CellGraphic.TRIANGLE), e-> { initializer.setGraphicType(CellGraphic.TRIANGLE); }); } private Button initHexagonButton() { return makeButton(myResource.getString(CellGraphic.HEXAGON), e-> { initializer.setGraphicType(CellGraphic.HEXAGON); }); } /** * @return an HBox that contains animation control buttons */ public Node initActionButtons() { Button start = initStartButton(); Button step = initStepButton(); Button stop = initStopButton(); Button reset = initResetButton(); HBox buttons = new HBox(); buttons.getChildren().addAll(start, step, stop, reset); buttons.setSpacing(10); return buttons; } public Node initBackButton() { return makeButton(this.myResource.getString("Back"), e->initializer.start()); } protected Initializer getInitializer() { return this.initializer; } protected ResourceBundle getResource() { return this.myResource; } private Button initStartButton() { return makeButton(myResource.getString("Start"), e->initializer.getRunner().start()); } private Button initStepButton() { return makeButton(myResource.getString("Step"), e->initializer.getRunner().step()); } private Button initStopButton() { return makeButton(myResource.getString("Stop"), e->initializer.getRunner().pause()); } private Button initResetButton() { return makeButton(myResource.getString("Reset"), e->initializer.reset()); } /** * This method will be used to save current simulation parameters to an xml file */ public Button initXMLSaveButton(){ return makeButton(myResource.getString("SaveFile"), e->{ try { initializer.saveFile(); } catch (ParserConfigurationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }); } /** * @param text button text * @param handler button action handler * @return a button with text and handler */ private Button makeButton(String text, EventHandler<ActionEvent> handler) { Button btn = new Button(text); btn.setOnAction(handler); return btn; } }
3e19a20569016015ed873862ce70416e319d6602
771
java
Java
codes/java/concurrency/src/main/java/tamp/ch04/Register/register/SafeBooleanSRSWRegister.java
zhoujiagen/learning-algorithms
de3c17a68319499afc72acea1be92b1c92ea30cd
[ "MIT" ]
null
null
null
codes/java/concurrency/src/main/java/tamp/ch04/Register/register/SafeBooleanSRSWRegister.java
zhoujiagen/learning-algorithms
de3c17a68319499afc72acea1be92b1c92ea30cd
[ "MIT" ]
null
null
null
codes/java/concurrency/src/main/java/tamp/ch04/Register/register/SafeBooleanSRSWRegister.java
zhoujiagen/learning-algorithms
de3c17a68319499afc72acea1be92b1c92ea30cd
[ "MIT" ]
null
null
null
24.09375
78
0.718547
10,883
/* * SafeBoolSRSWRegister.java * * Created on January 11, 2006, 10:20 PM * * From "Multiprocessor Synchronization and Concurrent Data Structures", * by Maurice Herlihy and Nir Shavit. * Copyright 2006 Elsevier Inc. All rights reserved. */ package tamp.ch04.Register.register; /** * Safe Boolean Single-reader single-writer register * This class is assumed as a primitive by the other algorithms. * This implementation is provided only for testing the other implementations. * * @author Maurice Herlihy */ public class SafeBooleanSRSWRegister implements Register<Boolean> { private Boolean value = false; public synchronized Boolean read() { return value; } public synchronized void write(Boolean v) { value = v; } }
3e19a21d6ac11fa61477446a8bae9da6889f23b6
2,491
java
Java
src/mobi/hsz/idea/latex/ui/ImageEditorActionDialog.java
hsz/idea-latex
a84ec8e09acb31963300646c91b30be1b4801842
[ "MIT" ]
186
2015-01-19T17:03:15.000Z
2021-06-17T05:46:23.000Z
src/mobi/hsz/idea/latex/ui/ImageEditorActionDialog.java
hsz/idea-latex
a84ec8e09acb31963300646c91b30be1b4801842
[ "MIT" ]
30
2015-01-17T10:30:31.000Z
2021-05-11T07:51:41.000Z
src/mobi/hsz/idea/latex/ui/ImageEditorActionDialog.java
hsz/idea-latex
a84ec8e09acb31963300646c91b30be1b4801842
[ "MIT" ]
47
2015-02-02T22:51:31.000Z
2020-10-18T16:06:30.000Z
33.621622
162
0.738746
10,884
/* * The MIT License (MIT) * * Copyright (c) 2016 hsz Jakub Chrzanowski <hzdkv@example.com> * * 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 mobi.hsz.idea.latex.ui; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import mobi.hsz.idea.latex.LatexBundle; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; public class ImageEditorActionDialog extends DialogWrapper { private JPanel panel; private TextFieldWithBrowseButton path; private JTextField caption; private JTextField label; public ImageEditorActionDialog(@NotNull Project project) { super(project); path.addBrowseFolderListener(LatexBundle.message("editor.image.dialog.browse"), null, project, FileChooserDescriptorFactory.createSingleFileDescriptor()); setTitle(LatexBundle.message("editor.image.dialog.title")); init(); } @Nullable @Override protected JComponent createCenterPanel() { return panel; } @NotNull public String getPath() { return path.getText().trim(); } @NotNull public String getCaption() { return caption.getText().trim(); } @NotNull public String getLabel() { return label.getText().trim(); } }
3e19a4e9715eb87920f3c51876e4084e66b55f6d
3,926
java
Java
tools/org.apache.felix.scr.generator/src/test/java/org/apache/felix/scrplugin/SCRDescriptorGeneratorTest.java
chrisr3/felix-dev
f3597cc709d1469d36314b3bff9cb1e609b6cdab
[ "Apache-2.0" ]
73
2020-02-28T19:50:03.000Z
2022-03-31T14:40:18.000Z
tools/org.apache.felix.scr.generator/src/test/java/org/apache/felix/scrplugin/SCRDescriptorGeneratorTest.java
chrisr3/felix-dev
f3597cc709d1469d36314b3bff9cb1e609b6cdab
[ "Apache-2.0" ]
50
2020-03-02T10:53:06.000Z
2022-03-25T13:23:51.000Z
tools/org.apache.felix.scr.generator/src/test/java/org/apache/felix/scrplugin/SCRDescriptorGeneratorTest.java
chrisr3/felix-dev
f3597cc709d1469d36314b3bff9cb1e609b6cdab
[ "Apache-2.0" ]
97
2020-03-02T10:40:18.000Z
2022-03-25T01:13:32.000Z
31.408
144
0.653337
10,885
/* * 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.felix.scrplugin; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Collections; import java.util.UUID; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.easymock.EasyMock; import org.junit.After; import org.junit.Before; import org.junit.Test; public class SCRDescriptorGeneratorTest { File folder; File dest; @Before public void setup() throws IOException { folder = new File(FileUtils.getTempDirectory(), UUID.randomUUID().toString()); FileUtils.forceMkdir(folder); dest = new File(folder, "testComponents"); FileUtils.forceMkdir(dest); } @After public void tearDown() throws IOException { FileUtils.deleteDirectory(folder); } @Test public void testSimpleComponent() throws SCRDescriptorException, SCRDescriptorFailureException, IOException { Env env = new Env("SimpleComponent").invoke(); EasyMock.replay(env.log()); env.generator().execute(); EasyMock.verify(env.log()); } @Test public void testComponentWithClassReferenceAndMissingInterface() throws SCRDescriptorException, SCRDescriptorFailureException, IOException { Env env = new Env("ComponentWithClassReferenceAndMissingInterface").invoke(); EasyMock.replay(env.log()); try { env.generator().execute(); } catch ( final SCRDescriptorFailureException e) { // this is expected as the interface for a reference is missing } EasyMock.verify(env.log()); } private void unpackSource(String resource, File dest) throws IOException { InputStream is = getClass().getResourceAsStream(resource); FileOutputStream fos = new FileOutputStream(dest); try { IOUtils.copy(is, fos); } finally { fos.close(); is.close(); } } /** * Setups a minimal environment. */ private class Env { private String className; private Log log; private SCRDescriptorGenerator gen; public Env(String className) { this.className = className; } public Log log() { return log; } public SCRDescriptorGenerator generator() { return gen; } public Env invoke() throws IOException { File aFile = new File(dest, className + ".class"); unpackSource("/testComponents/" + className + ".class", aFile); log = EasyMock.createNiceMock(Log.class); gen = new SCRDescriptorGenerator(log); Project p = new Project(); p.setClassLoader(getClass().getClassLoader()); p.setSources(Collections.<Source>singletonList(new SourceImpl("testComponents." + className, aFile))); Options o = new Options(); o.setOutputDirectory(folder); gen.setProject(p); gen.setOptions(o); return this; } } }
3e19a511fdbed9c138b064ab53b65883b03e905d
1,506
java
Java
core/src/main/java/org/jdbi/v3/core/collector/OptionalCollectorFactory.java
paladin235/jdbi
fc9cbe070291e9c68c168fb72256b1c60eb88880
[ "Apache-2.0" ]
1,396
2015-01-02T17:08:38.000Z
2022-03-31T22:39:30.000Z
core/src/main/java/org/jdbi/v3/core/collector/OptionalCollectorFactory.java
paladin235/jdbi
fc9cbe070291e9c68c168fb72256b1c60eb88880
[ "Apache-2.0" ]
1,498
2015-01-01T00:08:02.000Z
2022-03-26T15:02:57.000Z
core/src/main/java/org/jdbi/v3/core/collector/OptionalCollectorFactory.java
paladin235/jdbi
fc9cbe070291e9c68c168fb72256b1c60eb88880
[ "Apache-2.0" ]
322
2015-01-17T20:20:30.000Z
2022-03-30T22:21:14.000Z
35.857143
113
0.755644
10,886
/* * 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.jdbi.v3.core.collector; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Optional; import java.util.stream.Collector; import static org.jdbi.v3.core.collector.OptionalCollectors.toOptional; import static org.jdbi.v3.core.generic.GenericTypes.findGenericParameter; import static org.jdbi.v3.core.generic.GenericTypes.getErasedType; class OptionalCollectorFactory implements CollectorFactory { @Override public boolean accepts(Type containerType) { return containerType instanceof ParameterizedType && Optional.class.equals(getErasedType(containerType)); } @Override public Optional<Type> elementType(Type containerType) { Class<?> erasedType = getErasedType(containerType); return findGenericParameter(containerType, erasedType); } @Override public Collector<?, ?, ?> build(Type containerType) { return toOptional(); } }
3e19a5565a9bd78597d46dc5b0e09a25dcd0031c
3,691
java
Java
src/test/java/uk/ac/ebi/ena/webin/cli/manifest/ManifestCVListTest.java
enasequence/webin-cli
51fda353ad538b268e46d686683a00a8bc7e1496
[ "Apache-2.0" ]
13
2018-08-23T11:18:53.000Z
2021-12-02T10:32:10.000Z
src/test/java/uk/ac/ebi/ena/webin/cli/manifest/ManifestCVListTest.java
enasequence/webin-cli
51fda353ad538b268e46d686683a00a8bc7e1496
[ "Apache-2.0" ]
43
2018-06-14T09:53:23.000Z
2022-03-14T07:40:43.000Z
src/test/java/uk/ac/ebi/ena/webin/cli/manifest/ManifestCVListTest.java
enasequence/webin-cli
51fda353ad538b268e46d686683a00a8bc7e1496
[ "Apache-2.0" ]
5
2018-08-08T13:43:56.000Z
2021-11-20T01:03:31.000Z
51.985915
130
0.674885
10,887
/* * Copyright 2018-2021 EMBL - European Bioinformatics Institute * 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 uk.ac.ebi.ena.webin.cli.manifest; import org.junit.Assert; import org.junit.Test; import uk.ac.ebi.ena.webin.cli.context.reads.ReadsManifestReader; public class ManifestCVListTest { @Test public void testFromList() { ManifestCVList cvList = new ManifestCVList("TEST1", "test2"); Assert.assertTrue( cvList.contains("TEST1") ); Assert.assertTrue( cvList.contains("test1") ); Assert.assertEquals( "TEST1", cvList.getKey( "te_st1" ) ); Assert.assertEquals( "TEST1", cvList.getKey( "test1" ) ); Assert.assertEquals( "TEST1", cvList.getKey( "TEST1" ) ); Assert.assertEquals( "TEST1", cvList.getValue( "te_st1" ) ); Assert.assertEquals( "TEST1", cvList.getValue( "test1" ) ); Assert.assertEquals( "TEST1", cvList.getValue( "TEST1" ) ); Assert.assertTrue( cvList.contains("TEST2") ); Assert.assertTrue( cvList.contains("test2") ); Assert.assertEquals( "test2", cvList.getKey( "te_st2" ) ); Assert.assertEquals( "test2", cvList.getKey( "test2" ) ); Assert.assertEquals( "test2", cvList.getKey( "TEST2" ) ); Assert.assertEquals( "test2", cvList.getValue( "te_st2" ) ); Assert.assertEquals( "test2", cvList.getValue( "test2" ) ); Assert.assertEquals( "test2", cvList.getValue( "TEST2" ) ); } @Test public void testFromResource() { ManifestCVList cvList = ReadsManifestReader.CV_INSTRUMENT; Assert.assertTrue( cvList.contains("unspecified") ); Assert.assertTrue( cvList.contains("UNSPECIFIED") ); Assert.assertEquals( "unspecified", cvList.getKey( "uns_pecified" ) ); Assert.assertEquals( "unspecified", cvList.getKey( "unspecified" ) ); Assert.assertEquals( "unspecified", cvList.getKey( "UNSPECIFIED" ) ); Assert.assertEquals( "LS454,ILLUMINA,PACBIO_SMRT,ION_TORRENT,OXFORD_NANOPORE,DNBSEQ", cvList.getValue( "unspecified" ) ); Assert.assertEquals( "LS454,ILLUMINA,PACBIO_SMRT,ION_TORRENT,OXFORD_NANOPORE,DNBSEQ", cvList.getValue( "UNSPECIFIED" ) ); Assert.assertTrue( cvList.contains("Illumina Genome Analyzer") ); Assert.assertTrue( cvList.contains("illumina genome analyzer") ); Assert.assertTrue( cvList.contains("ILLUMINA GENOME ANALYZER") ); Assert.assertEquals( "Illumina Genome Analyzer", cvList.getKey( "Illumina Genome __ Analyzer" ) ); Assert.assertEquals( "Illumina Genome Analyzer", cvList.getKey( "Illumina Genome Analyzer" ) ); Assert.assertEquals( "Illumina Genome Analyzer", cvList.getKey( "illumina genome analyzer" ) ); Assert.assertEquals( "Illumina Genome Analyzer", cvList.getKey( "ILLUMINA GENOME ANALYZER" ) ); Assert.assertEquals( "ILLUMINA", cvList.getValue( "Illumina Genome Analyzer" ) ); Assert.assertEquals( "ILLUMINA", cvList.getValue( "illumina genome analyzer" ) ); Assert.assertEquals( "ILLUMINA", cvList.getValue( "ILLUMINA GENOME ANALYZER" ) ); } }
3e19a74abd6b26bd373c40b3107af1ac10adb103
1,750
java
Java
processing/src/test/java/io/druid/query/aggregation/post/FieldAccessPostAggregatorTest.java
acdn-ekeddy/druid
b9b3be6965f86aded444ae9a0a2ef47da9d10fac
[ "Apache-2.0" ]
142
2015-01-03T14:03:14.000Z
2022-03-07T18:17:13.000Z
processing/src/test/java/io/druid/query/aggregation/post/FieldAccessPostAggregatorTest.java
acdn-ekeddy/druid
b9b3be6965f86aded444ae9a0a2ef47da9d10fac
[ "Apache-2.0" ]
17
2015-07-01T16:38:59.000Z
2019-06-28T14:46:02.000Z
processing/src/test/java/io/druid/query/aggregation/post/FieldAccessPostAggregatorTest.java
acdn-ekeddy/druid
b9b3be6965f86aded444ae9a0a2ef47da9d10fac
[ "Apache-2.0" ]
34
2015-01-11T06:55:07.000Z
2021-06-10T03:54:27.000Z
33.653846
116
0.748
10,888
/* * Licensed to Metamarkets Group Inc. (Metamarkets) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. Metamarkets 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 io.druid.query.aggregation.post; import io.druid.query.aggregation.CountAggregator; import org.junit.Assert; import org.junit.Test; import java.util.HashMap; import java.util.Map; /** */ public class FieldAccessPostAggregatorTest { @Test public void testCompute() { final String aggName = "rows"; FieldAccessPostAggregator fieldAccessPostAggregator; fieldAccessPostAggregator = new FieldAccessPostAggregator("To be, or not to be, that is the question:", "rows"); CountAggregator agg = new CountAggregator(); Map<String, Object> metricValues = new HashMap<String, Object>(); metricValues.put(aggName, agg.get()); Assert.assertEquals(new Long(0L), fieldAccessPostAggregator.compute(metricValues)); agg.aggregate(); agg.aggregate(); agg.aggregate(); metricValues.put(aggName, agg.get()); Assert.assertEquals(new Long(3L), fieldAccessPostAggregator.compute(metricValues)); } }
3e19a8651e68e9309cef984c49b8b71ab05632a3
1,228
java
Java
vividus-util/src/main/java/org/vividus/util/wait/WaitMode.java
EDbarvinsky/vividus
0203a40f826b477f95c29291c6a5bf0d3a898923
[ "Apache-2.0" ]
335
2019-06-24T06:43:45.000Z
2022-03-26T08:26:23.000Z
vividus-util/src/main/java/org/vividus/util/wait/WaitMode.java
EDbarvinsky/vividus
0203a40f826b477f95c29291c6a5bf0d3a898923
[ "Apache-2.0" ]
2,414
2019-08-15T15:24:31.000Z
2022-03-31T14:38:26.000Z
vividus-util/src/main/java/org/vividus/util/wait/WaitMode.java
EDbarvinsky/vividus
0203a40f826b477f95c29291c6a5bf0d3a898923
[ "Apache-2.0" ]
64
2019-08-16T11:32:48.000Z
2022-03-12T06:15:18.000Z
25.583333
75
0.702769
10,889
/* * Copyright 2019-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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.vividus.util.wait; import java.time.Duration; import java.util.concurrent.TimeUnit; public class WaitMode { private final Duration duration; private final int retryTimes; public WaitMode(Duration duration, int retryTimes) { this.duration = duration; this.retryTimes = retryTimes; } public Duration getDuration() { return duration; } public int getRetryTimes() { return retryTimes; } public long calculatePollingTimeout(TimeUnit timeUnit) { return timeUnit.convert(duration) / retryTimes; } }
3e19a882c8da183bea6e11289253006a57af0266
3,391
java
Java
org/eclipse/persistence/jpa/jpql/parser/QueryPosition.java
chenjiafan/eclipselink
a1a6cfa35417931430bf2f4e3220d9ed72a2d6c2
[ "BSD-3-Clause" ]
null
null
null
org/eclipse/persistence/jpa/jpql/parser/QueryPosition.java
chenjiafan/eclipselink
a1a6cfa35417931430bf2f4e3220d9ed72a2d6c2
[ "BSD-3-Clause" ]
null
null
null
org/eclipse/persistence/jpa/jpql/parser/QueryPosition.java
chenjiafan/eclipselink
a1a6cfa35417931430bf2f4e3220d9ed72a2d6c2
[ "BSD-3-Clause" ]
2
2020-02-03T09:24:10.000Z
2021-06-15T13:27:27.000Z
30.276786
97
0.654379
10,890
/******************************************************************************* * Copyright (c) 2006, 2014 Oracle and/or its affiliates. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * Oracle - initial API and implementation * ******************************************************************************/ package org.eclipse.persistence.jpa.jpql.parser; import java.util.HashMap; import java.util.Map; /** * This object contains the cursor position within the parsed tree and within each of the {@link * Expression} from the root to the deepest leaf. * * @version 2.5 * @since 2.3 * @author Pascal Filion */ public final class QueryPosition { /** * The deepest child {@link Expression} where the position of the cursor is. */ private Expression expression; /** * The position of the cursor in the query. */ private int position; /** * The table containing the position of each of the {@link Expression} up to the deepest leaf. */ private Map<Expression, Integer> positions; /** * Creates a new <code>QueryPosition</code>. * * @param position The position of the cursor in the query */ public QueryPosition(int position) { super(); this.position = position; this.positions = new HashMap<Expression, Integer>(); } /** * Adds the position of the cursor within the given {@link Expression} * * @param expression An {@link Expression} in which the cursor is located * @param position The position of the cursor within the given {@link Expression} */ public void addPosition(Expression expression, int position) { positions.put(expression, position); } /** * Returns the child {@link Expression} where the position of the cursor is. * * @return The deepest {@link Expression} child that was retrieving by * traversing the parsed tree up to the position of the cursor. */ public Expression getExpression() { return expression; } /** * Returns the position of the cursor in the query. * * @return The position of the cursor in the query */ public int getPosition() { return position; } /** * Returns the position of the cursor within the given {@link Expression} * * @param expression The {@link Expression} for which the position of the cursor is requested * @return Either the position of the cursor within the given {@link Expression} or -1 if the * cursor is not within it */ public int getPosition(Expression expression) { Integer position = positions.get(expression); return (position == null) ? -1 : position; } /** * Sets the deepest leaf where the cursor is located. * * @param expression The {@link Expression} that is the deepest leaf within the parsed tree */ public void setExpression(Expression expression) { this.expression = expression; } /** * {@inheritDoc} */ @Override public String toString() { return positions.toString(); } }
3e19a8fcc2f35b9138c6c79f45f101dc3196080a
508
java
Java
classpath/java/lang/reflect/InvocationHandler.java
lostdj/avian
394c5cacce092967d38fccee2f8a9c3b9160cccb
[ "0BSD" ]
1
2015-04-25T23:32:56.000Z
2015-04-25T23:32:56.000Z
classpath/java/lang/reflect/InvocationHandler.java
lostdj/avian
394c5cacce092967d38fccee2f8a9c3b9160cccb
[ "0BSD" ]
65
2016-01-24T19:44:46.000Z
2022-02-09T01:00:07.000Z
classpath/java/lang/reflect/InvocationHandler.java
lostdj/avian
394c5cacce092967d38fccee2f8a9c3b9160cccb
[ "0BSD" ]
1
2019-05-02T14:23:43.000Z
2019-05-02T14:23:43.000Z
31.75
89
0.759843
10,891
/* Copyright (c) 2008-2014, Avian Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. There is NO WARRANTY for this software. See license.txt for details. */ package java.lang.reflect; public interface InvocationHandler { public Object invoke(Object proxy, Method method, Object[] arguments) throws Throwable; }
3e19a91b32cce663272b18e0ba5966cf8decd395
4,632
java
Java
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/VortexUtils.java
drykisftc/relic
6d57537f9219b8d9972d76d37b30365889880892
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/VortexUtils.java
drykisftc/relic
6d57537f9219b8d9972d76d37b30365889880892
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/VortexUtils.java
drykisftc/relic
6d57537f9219b8d9972d76d37b30365889880892
[ "MIT" ]
null
null
null
29.316456
108
0.539076
10,892
package org.firstinspires.ftc.teamcode; import com.qualcomm.robotcore.hardware.ColorSensor; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.GyroSensor; import com.qualcomm.robotcore.util.Range; public class VortexUtils { static double lookUpTableFunc (double dVal, double[] scaleArray ) { int size = scaleArray.length-1; // get the corresponding index for the scaleInput array. int index = (int) (dVal * size); // index should be positive. if (index < 0) { index = -index; } // index cannot exceed size of array minus 1. if (index > size) { index = size; } // get value from the array. double dScale; if (dVal < 0) { dScale = -scaleArray[index]; } else { dScale = scaleArray[index]; } // return scaled value. return dScale; } static void getGyroData (GyroSensor gyro, GyroData data){ data.heading =gyro.getHeading(); data.xRotation = gyro.rawX(); data.yRotation = gyro.rawY(); data.zRotation = gyro.rawZ(); } static char getColor(ColorSensor cs, float snrLimit, int minBrightness, RGB rgb) { rgb.r = cs.red(); rgb.g = cs.green(); rgb.b = cs.blue(); // find the max int m = Math.max(rgb.r, rgb.g); m = Math.max(m, rgb.b); int sum = rgb.r + rgb.g + rgb.b; // if SNR is good if (sum > minBrightness && m > sum * 0.333 * snrLimit) { if (m == rgb.g) return 'g'; if (m == rgb.r) return 'r'; if (m == rgb.b) return 'b'; } return 'u'; // unknown color } static int followColorLine(char colorFollowed, ColorSensor cs, float snrLimit, int minBrightness, DcMotor left, DcMotor right, float powerForward, float powerTurn) { RGB rgb = new RGB(0,0,0); char color = getColor(cs, snrLimit, minBrightness, rgb); int intensity = rgb.getIntensity(); if ( color != colorFollowed || intensity < minBrightness) { left.setPower(Range.clip(powerForward+powerTurn,-1,1)); right.setPower(Range.clip(powerForward - powerTurn, -1, 1)); } else { left.setPower(Range.clip(powerForward-powerTurn,-1,1)); right.setPower(Range.clip(powerForward+powerTurn,-1,1)); } return 0; } static int moveMotorByEncoder (DcMotor motor, int pos, int tolerance, double maxDelta, double [] lut ) { if (motor.getMode() != DcMotor.RunMode.RUN_USING_ENCODER) { motor.setMode(DcMotor.RunMode.RUN_USING_ENCODER); } int currentPos = motor.getCurrentPosition(); int deltaPos = pos - currentPos; if (Math.abs(deltaPos) > tolerance) { // map deltaPos to power double delta = Range.clip(deltaPos/maxDelta, -1.0, 1.0); // set power motor.setPower(VortexUtils.lookUpTableFunc(delta, lut)); } else { motor.setPower(0); } return currentPos; } static void moveMotorByPower(DcMotor motor, float power) { motor.setMode(DcMotor.RunMode.RUN_USING_ENCODER); motor.setPower(power); } static void moveMotorByEncoder(DcMotor motor, int pos, double power) { motor.setTargetPosition(pos); motor.setMode(DcMotor.RunMode.RUN_TO_POSITION); motor.setPower(power); } /** * * @param targetAngle, the target angle * @param currentAngle, current angel * @return */ static double getAngleError(double targetAngle, double currentAngle) { double robotError; // calculate error in -179 to +180 range ( robotError = targetAngle - currentAngle; while (robotError > 180) robotError -= 360; while (robotError <= -180) robotError += 360; return robotError; } /** * * @param value * @return heading in [0,360] */ static double normalizeHeading (double value) { // set it to [-360, 360] double v = value/360.0; double v2 = (v-(int)v) * 360.0; // set it in [0,360] while (v2 < 0) v2 += 360; return v2; } }
3e19a9a45cd216703d4edb294b659cd607d8a3d5
3,858
java
Java
pinot-controller/src/main/java/org/apache/pinot/controller/api/access/AccessControl.java
nizarhejazi/pinot
d616a097e5b28443b42a9e84113d3fced254444d
[ "Apache-2.0" ]
2,144
2015-06-10T16:02:11.000Z
2018-11-08T07:59:13.000Z
pinot-controller/src/main/java/org/apache/pinot/controller/api/access/AccessControl.java
nizarhejazi/pinot
d616a097e5b28443b42a9e84113d3fced254444d
[ "Apache-2.0" ]
1,894
2015-06-11T05:17:48.000Z
2018-11-09T19:22:27.000Z
pinot-controller/src/main/java/org/apache/pinot/controller/api/access/AccessControl.java
nizarhejazi/pinot
d616a097e5b28443b42a9e84113d3fced254444d
[ "Apache-2.0" ]
418
2015-06-10T15:53:06.000Z
2018-11-09T00:05:06.000Z
33.842105
119
0.735355
10,893
/** * 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.pinot.controller.api.access; import javax.ws.rs.core.HttpHeaders; import org.apache.pinot.spi.annotations.InterfaceAudience; import org.apache.pinot.spi.annotations.InterfaceStability; @InterfaceAudience.Public @InterfaceStability.Stable public interface AccessControl { String WORKFLOW_NONE = "NONE"; String WORKFLOW_BASIC = "BASIC"; /** * Return whether the client has data access to the given table. * * Note: This method is only used fore read access. It's being deprecated and its usage will be replaced by * `hasAccess` method with AccessType.READ. * * @param httpHeaders HTTP headers containing requester identity * @param tableName Name of the table to be accessed * @return Whether the client has data access to the table */ @Deprecated boolean hasDataAccess(HttpHeaders httpHeaders, String tableName); /** * Return whether the client has permission to the given table * * @param tableName name of the table to be accessed * @param accessType type of the access * @param httpHeaders HTTP headers containing requester identity * @param endpointUrl the request url for which this access control is called * @return whether the client has permission */ default boolean hasAccess(String tableName, AccessType accessType, HttpHeaders httpHeaders, String endpointUrl) { return true; } /** * Return whether the client has permission to access the endpoints with are not table level * * @param accessType type of the access * @param httpHeaders HTTP headers * @param endpointUrl the request url for which this access control is called * @return whether the client has permission */ default boolean hasAccess(AccessType accessType, HttpHeaders httpHeaders, String endpointUrl) { return true; } default boolean hasAccess(HttpHeaders httpHeaders) { return true; } /** * Determine whether authentication is required for annotated (controller) endpoints only * * @return {@code true} if annotated methods are protected only, {@code false} otherwise */ default boolean protectAnnotatedOnly() { return true; } /** * Return workflow info for authenticating users. Not all workflows may be supported by the pinot UI implementation. * * @return workflow info for user authentication */ default AuthWorkflowInfo getAuthWorkflowInfo() { return new AuthWorkflowInfo(WORKFLOW_NONE); } /** * Container for authentication workflow info for the Pinot UI. May be extended by implementations. * * Auth workflow info hold any configuration necessary to execute a UI workflow. We currently foresee supporting NONE * (auth disabled) and BASIC (basic auth with username and password) */ class AuthWorkflowInfo { String _workflow; public AuthWorkflowInfo(String workflow) { _workflow = workflow; } public String getWorkflow() { return _workflow; } public void setWorkflow(String workflow) { _workflow = workflow; } } }
3e19abb54ea26fd825a3db332f370eb6317b3ab4
6,750
java
Java
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RollupStepTests.java
diwasjoshi/elasticsearch
58ce0f94a0bbdf2576e0a00a62abe1854ee7fe2f
[ "Apache-2.0" ]
null
null
null
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RollupStepTests.java
diwasjoshi/elasticsearch
58ce0f94a0bbdf2576e0a00a62abe1854ee7fe2f
[ "Apache-2.0" ]
null
null
null
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RollupStepTests.java
diwasjoshi/elasticsearch
58ce0f94a0bbdf2576e0a00a62abe1854ee7fe2f
[ "Apache-2.0" ]
null
null
null
45.608108
140
0.705926
10,894
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ package org.elasticsearch.xpack.core.ilm; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.DataStream; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.LifecycleExecutionState; import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.xpack.core.ilm.Step.StepKey; import org.elasticsearch.xpack.core.rollup.RollupActionConfig; import org.elasticsearch.xpack.core.rollup.RollupActionConfigTests; import org.elasticsearch.xpack.core.rollup.action.RollupAction; import org.mockito.Mockito; import java.util.Collections; import java.util.List; import java.util.Map; import static org.elasticsearch.cluster.metadata.DataStreamTestHelper.createTimestampField; import static org.elasticsearch.cluster.metadata.DataStreamTestHelper.newInstance; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; public class RollupStepTests extends AbstractStepTestCase<RollupStep> { @Override public RollupStep createRandomInstance() { StepKey stepKey = randomStepKey(); StepKey nextStepKey = randomStepKey(); RollupActionConfig config = RollupActionConfigTests.randomConfig(random()); return new RollupStep(stepKey, nextStepKey, client, config); } @Override public RollupStep mutateInstance(RollupStep instance) { StepKey key = instance.getKey(); StepKey nextKey = instance.getNextStepKey(); switch (between(0, 1)) { case 0 -> key = new StepKey(key.getPhase(), key.getAction(), key.getName() + randomAlphaOfLength(5)); case 1 -> nextKey = new StepKey(key.getPhase(), key.getAction(), key.getName() + randomAlphaOfLength(5)); default -> throw new AssertionError("Illegal randomisation branch"); } return new RollupStep(key, nextKey, instance.getClient(), instance.getConfig()); } @Override public RollupStep copyInstance(RollupStep instance) { return new RollupStep(instance.getKey(), instance.getNextStepKey(), instance.getClient(), instance.getConfig()); } private IndexMetadata getIndexMetadata(String index) { Map<String, String> ilmCustom = Collections.singletonMap("rollup_index_name", "rollup-index"); return IndexMetadata.builder(index) .settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, "test-ilm-policy")) .numberOfShards(randomIntBetween(1, 5)) .numberOfReplicas(randomIntBetween(0, 5)) .putCustom(LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY, ilmCustom) .build(); } private static void assertRollupActionRequest(RollupAction.Request request, String sourceIndex) { assertNotNull(request); assertThat(request.getSourceIndex(), equalTo(sourceIndex)); assertThat(request.getRollupIndex(), equalTo("rollup-index")); } public void testPerformAction() throws Exception { String index = randomAlphaOfLength(5); IndexMetadata indexMetadata = getIndexMetadata(index); RollupStep step = createRandomInstance(); mockClientRollupCall(index); ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).metadata(Metadata.builder().put(indexMetadata, true)).build(); PlainActionFuture.<Void, Exception>get(f -> step.performAction(indexMetadata, clusterState, null, f)); } public void testPerformActionFailureInvalidExecutionState() { IndexMetadata indexMetadata = IndexMetadata.builder(randomAlphaOfLength(10)) .settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, "test-ilm-policy")) .numberOfShards(randomIntBetween(1, 5)) .numberOfReplicas(randomIntBetween(0, 5)) .build(); String policyName = indexMetadata.getSettings().get(LifecycleSettings.LIFECYCLE_NAME); String indexName = indexMetadata.getIndex().getName(); RollupStep step = createRandomInstance(); step.performAction(indexMetadata, emptyClusterState(), null, new ActionListener<>() { @Override public void onResponse(Void unused) { fail("expecting a failure as the index doesn't have any rollup index name in its ILM execution state"); } @Override public void onFailure(Exception e) { assertThat(e, instanceOf(IllegalStateException.class)); assertThat( e.getMessage(), is("rollup index name was not generated for policy [" + policyName + "] and index [" + indexName + "]") ); } }); } public void testPerformActionOnDataStream() throws Exception { String dataStreamName = "test-datastream"; String backingIndexName = DataStream.getDefaultBackingIndexName(dataStreamName, 1); IndexMetadata indexMetadata = getIndexMetadata(backingIndexName); RollupStep step = createRandomInstance(); mockClientRollupCall(backingIndexName); ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT) .metadata( Metadata.builder() .put(newInstance(dataStreamName, createTimestampField("@timestamp"), List.of(indexMetadata.getIndex()))) .put(indexMetadata, true) ) .build(); PlainActionFuture.<Void, Exception>get(f -> step.performAction(indexMetadata, clusterState, null, f)); } private void mockClientRollupCall(String sourceIndex) { Mockito.doAnswer(invocation -> { RollupAction.Request request = (RollupAction.Request) invocation.getArguments()[1]; @SuppressWarnings("unchecked") ActionListener<AcknowledgedResponse> listener = (ActionListener<AcknowledgedResponse>) invocation.getArguments()[2]; assertRollupActionRequest(request, sourceIndex); listener.onResponse(AcknowledgedResponse.of(true)); return null; }).when(client).execute(Mockito.any(), Mockito.any(), Mockito.any()); } }
3e19ac296b41487e7c807c5c49172f85d3fc4581
2,525
java
Java
extensions/flyway/runtime/src/main/java/io/quarkus/flyway/runtime/graal/QuarkusPathLocationScanner.java
n1hility/quarkus-ci
f66babef34f647aa899a393af6dfd5c90b1dd44e
[ "Apache-2.0" ]
4
2021-07-27T13:22:28.000Z
2021-12-26T18:01:06.000Z
extensions/flyway/runtime/src/main/java/io/quarkus/flyway/runtime/graal/QuarkusPathLocationScanner.java
n1hility/quarkus-ci
f66babef34f647aa899a393af6dfd5c90b1dd44e
[ "Apache-2.0" ]
456
2020-01-14T10:58:06.000Z
2021-12-10T20:04:51.000Z
extensions/flyway/runtime/src/main/java/io/quarkus/flyway/runtime/graal/QuarkusPathLocationScanner.java
n1hility/quarkus-ci
f66babef34f647aa899a393af6dfd5c90b1dd44e
[ "Apache-2.0" ]
2
2019-11-24T16:35:19.000Z
2020-03-13T20:20:01.000Z
39.453125
107
0.712871
10,895
package io.quarkus.flyway.runtime.graal; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; import org.flywaydb.core.api.logging.Log; import org.flywaydb.core.api.logging.LogFactory; import org.flywaydb.core.internal.resource.LoadableResource; import org.flywaydb.core.internal.resource.classpath.ClassPathResource; import org.flywaydb.core.internal.scanner.classpath.ResourceAndClassScanner; public final class QuarkusPathLocationScanner implements ResourceAndClassScanner { private static final Log LOG = LogFactory.getLog(QuarkusPathLocationScanner.class); /** * File with the migrations list. It is generated dynamically in the Flyway Quarkus Processor */ public final static String MIGRATIONS_LIST_FILE = "META-INF/flyway-migrations.txt"; /** * Returns the migrations loaded into the {@see MIGRATIONS_LIST_FILE} * * @return The resources that were found. */ @Override public Collection<LoadableResource> scanForResources() { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try (InputStream resource = classLoader.getResourceAsStream(MIGRATIONS_LIST_FILE); BufferedReader reader = new BufferedReader( new InputStreamReader(Objects.requireNonNull(resource), StandardCharsets.UTF_8))) { List<String> migrations = reader.lines().collect(Collectors.toList()); Set<LoadableResource> resources = new HashSet<>(); for (String file : migrations) { LOG.debug("Loading " + file); resources.add(new ClassPathResource(null, file, classLoader, StandardCharsets.UTF_8)); } return resources; } catch (IOException e) { throw new IllegalStateException(e); } } /** * Scans the classpath for concrete classes under the specified package implementing this interface. * Non-instantiable abstract classes are filtered out. * * @return The non-abstract classes that were found. */ @Override public Collection<Class<?>> scanForClasses() { // Classes are not supported in native mode return Collections.emptyList(); } }
3e19ac38ba656692f4927c0f43ed9bf96b3434d0
4,041
java
Java
test/net/ssehub/kernel_haven/incremental/diff/analyzer/ComAnAnalyzerTest.java
KernelHaven/ModelStoragePipeline
447c2d707114a41683f8a324ce587de869c154b8
[ "Apache-2.0" ]
null
null
null
test/net/ssehub/kernel_haven/incremental/diff/analyzer/ComAnAnalyzerTest.java
KernelHaven/ModelStoragePipeline
447c2d707114a41683f8a324ce587de869c154b8
[ "Apache-2.0" ]
null
null
null
test/net/ssehub/kernel_haven/incremental/diff/analyzer/ComAnAnalyzerTest.java
KernelHaven/ModelStoragePipeline
447c2d707114a41683f8a324ce587de869c154b8
[ "Apache-2.0" ]
1
2021-07-23T14:41:23.000Z
2021-07-23T14:41:23.000Z
43.923913
119
0.725068
10,896
package net.ssehub.kernel_haven.incremental.diff.analyzer; import java.io.File; import java.io.IOException; import java.nio.file.Paths; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test; import net.ssehub.kernel_haven.SetUpException; import net.ssehub.kernel_haven.config.Configuration; import net.ssehub.kernel_haven.incremental.diff.parser.DiffFile; import net.ssehub.kernel_haven.incremental.diff.parser.DiffFileParser; import net.ssehub.kernel_haven.incremental.diff.parser.FileEntry; import net.ssehub.kernel_haven.incremental.settings.IncrementalAnalysisSettings; import net.ssehub.kernel_haven.util.Logger; /** * Tests for {@link ComAnAnalyzer}. * * @author moritz */ public class ComAnAnalyzerTest { /** The logger. */ private static final Logger LOGGER = Logger.get(); /** * Tests whether the doFilter method works in instances where variability did * not change. * * @throws IOException Signals that an I/O exception has occurred. * @throws SetUpException */ @Test // CHECKSTYLE:OFF public void testParse_modification_no_variability_change() throws IOException, SetUpException { // CHECKSTYLE:ON DiffFile diffFile = DiffFileParser.parse(new File("testdata/variability-changes/no-variability-changes.diff")); ComAnAnalyzer analyzer = new ComAnAnalyzer(); Configuration config = new Configuration(new File("testdata/variability-changes/no-configuration.properties")); config.registerSetting(IncrementalAnalysisSettings.SOURCE_TREE_DIFF_FILE); analyzer.analyzeDiffFile(diffFile, config); LOGGER.logInfo("The following entries were found: "); diffFile.getEntries().forEach(entry -> LOGGER.logInfo(entry.toString())); Assert.assertThat(diffFile.getEntry(Paths.get("modify/Kbuild")).getVariabilityChange(), CoreMatchers.equalTo(FileEntry.VariabilityChange.NO_CHANGE)); Assert.assertThat(diffFile.getEntry(Paths.get("modify/Kconfig")).getVariabilityChange(), CoreMatchers.equalTo(FileEntry.VariabilityChange.NO_CHANGE)); Assert.assertThat(diffFile.getEntry(Paths.get("modify/a-code-file.c")).getVariabilityChange(), CoreMatchers.equalTo(FileEntry.VariabilityChange.NO_CHANGE)); } /** * Tests whether the doFilter method works in instances where variability did * change. * * @throws IOException Signals that an I/O exception has occurred. * @throws SetUpException */ @Test // CHECKSTYLE:OFF public void testParse_variability_change() throws IOException, SetUpException { // CHECKSTYLE:ON DiffFile diffFile = DiffFileParser.parse(new File("testdata/variability-changes/some-variability-changes.diff")); ComAnAnalyzer analyzer = new ComAnAnalyzer(); Configuration config = new Configuration(new File("testdata/variability-changes/some-configuration.properties")); config.registerSetting(IncrementalAnalysisSettings.SOURCE_TREE_DIFF_FILE); analyzer.analyzeDiffFile(diffFile, config); LOGGER.logInfo("The following entries were found: "); diffFile.getEntries().forEach(entry -> LOGGER.logInfo(entry.toString())); Assert.assertThat(diffFile.getEntry(Paths.get("include/linux/compat.h")).getVariabilityChange(), CoreMatchers.equalTo(FileEntry.VariabilityChange.NO_CHANGE)); Assert.assertThat(diffFile.getEntry(Paths.get(".mailmap")).getVariabilityChange(), CoreMatchers.equalTo(FileEntry.VariabilityChange.NOT_A_VARIABILITY_FILE)); Assert.assertThat(diffFile.getEntry(Paths.get("include/linux/bitmap.h")).getVariabilityChange(), CoreMatchers.equalTo(FileEntry.VariabilityChange.CHANGE)); Assert.assertThat(diffFile.getEntry(Paths.get("drivers/crypto/caam/ctrl.c")).getVariabilityChange(), CoreMatchers.equalTo(FileEntry.VariabilityChange.CHANGE)); } }
3e19ad3161e056740df0a622e4f07967a69d4018
659
java
Java
src/test/java/com/mirkocaserta/bruce/key/DsaKeyPairTest.java
mcaserta/bruce
38fe71ba82dcc44995c70b7a785a21865a5fa548
[ "Apache-2.0" ]
13
2021-05-31T11:22:09.000Z
2021-08-17T15:57:19.000Z
src/test/java/com/mirkocaserta/bruce/key/DsaKeyPairTest.java
mcaserta/bruce
38fe71ba82dcc44995c70b7a785a21865a5fa548
[ "Apache-2.0" ]
68
2021-04-12T19:56:43.000Z
2022-03-31T18:36:43.000Z
src/test/java/com/mirkocaserta/bruce/key/DsaKeyPairTest.java
mcaserta/bruce
38fe71ba82dcc44995c70b7a785a21865a5fa548
[ "Apache-2.0" ]
null
null
null
28.652174
70
0.707132
10,897
package com.mirkocaserta.bruce.key; import org.junit.jupiter.api.Test; import static com.mirkocaserta.bruce.Bruce.*; import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.jupiter.api.Assertions.assertTrue; class DsaKeyPairTest { private static final byte[] MESSAGE = "Hello".getBytes(UTF_8); @Test void generateAndUse() { var keyPair = keyPair("DSA", 2048); var signer = signer(keyPair.getPrivate(), "SHA256withDSA"); var verifier = verifier(keyPair.getPublic(), "SHA256withDSA"); var signature = signer.sign(MESSAGE); assertTrue(verifier.verify(MESSAGE, signature)); } }
3e19ae7d0bc31b36d20b79f5f2c76882d0ca48fb
3,138
java
Java
src/main/java/firmware/ifd/IntelFlashFileSystem.java
nstarke/ghidra-firmware-utils
b74a8c288626de5fd123cd51844593faba108fcd
[ "Apache-2.0" ]
275
2019-06-04T20:38:35.000Z
2022-03-30T10:34:52.000Z
src/main/java/firmware/ifd/IntelFlashFileSystem.java
nstarke/ghidra-firmware-utils
b74a8c288626de5fd123cd51844593faba108fcd
[ "Apache-2.0" ]
15
2019-06-04T13:57:48.000Z
2022-02-10T01:56:19.000Z
src/main/java/firmware/ifd/IntelFlashFileSystem.java
nstarke/ghidra-firmware-utils
b74a8c288626de5fd123cd51844593faba108fcd
[ "Apache-2.0" ]
34
2019-05-29T01:43:23.000Z
2021-12-13T02:33:35.000Z
28.527273
114
0.753983
10,898
/* ### * IP: GHIDRA * * 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 firmware.ifd; import java.io.IOException; import java.io.InputStream; import java.util.List; import ghidra.app.util.bin.BinaryReader; import ghidra.app.util.bin.ByteProvider; import ghidra.formats.gfilesystem.*; import ghidra.formats.gfilesystem.annotations.FileSystemInfo; import ghidra.util.exception.CancelledException; import ghidra.util.task.TaskMonitor; @FileSystemInfo(type = "ifd", description = "Intel Flash Descriptor", factory = IntelFlashFileSystemFactory.class) public class IntelFlashFileSystem implements GFileSystem { private final FSRLRoot fsFSRL; private FileSystemIndexHelper<IntelFlashRegion> fsih; private FileSystemRefManager refManager = new FileSystemRefManager(this); private ByteProvider provider; public IntelFlashFileSystem(FSRLRoot fsFSRL) { this.fsFSRL = fsFSRL; this.fsih = new FileSystemIndexHelper<>(this, fsFSRL); } public void mount(ByteProvider provider, long offset, TaskMonitor monitor) throws IOException { this.provider = provider; BinaryReader reader = new BinaryReader(provider, true); reader.setPointerIndex(offset - 16); IntelFlashDescriptor ifd = new IntelFlashDescriptor(reader); List<IntelFlashRegion> regions = ifd.getRegions(); for (IntelFlashRegion region : regions) { String regionName = String.format("Region %02d - %s", region.getType(), IntelFlashDescriptorConstants.FlashRegionType.toString(region.getType())); fsih.storeFileWithParent(regionName, null, -1, false, region.length(), region); } } @Override public String getName() { return fsFSRL.getContainer().getName(); } @Override public FSRLRoot getFSRL() { return fsFSRL; } @Override public boolean isClosed() { return provider == null; } @Override public FileSystemRefManager getRefManager() { return refManager; } @Override public void close() throws IOException { refManager.onClose(); if (provider != null) { provider.close(); provider = null; } fsih.clear(); } @Override public String getInfo(GFile file, TaskMonitor monitor) { IntelFlashRegion region = fsih.getMetadata(file); return (region != null) ? region.toString() : null; } @Override public List<GFile> getListing(GFile directory) { return fsih.getListing(directory); } @Override public GFile lookup(String path) throws IOException { return fsih.lookup(path); } @Override public InputStream getInputStream(GFile file, TaskMonitor monitor) throws IOException, CancelledException { IntelFlashRegion region = fsih.getMetadata(file); return region.getData(); } }
3e19ae970daf4266408a326209d963289d5b69a5
790
java
Java
app/src/main/java/com/example/android/our_project/HomeActivity.java
omar160197/RestoApp
9f821aa89dc2f467d48b768050f112468190bf52
[ "MIT" ]
null
null
null
app/src/main/java/com/example/android/our_project/HomeActivity.java
omar160197/RestoApp
9f821aa89dc2f467d48b768050f112468190bf52
[ "MIT" ]
null
null
null
app/src/main/java/com/example/android/our_project/HomeActivity.java
omar160197/RestoApp
9f821aa89dc2f467d48b768050f112468190bf52
[ "MIT" ]
null
null
null
23.235294
84
0.66962
10,899
package com.example.android.our_project; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.support.v7.app.ActionBar; public class HomeActivity extends AppCompatActivity { private int SPLASH_TIME_OUT=3000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent homeIntent =new Intent(HomeActivity.this,MainActivity.class); startActivity(homeIntent); finish(); } },SPLASH_TIME_OUT); } }
3e19af47f0306e35634180e7a8512d3833f4a025
1,894
java
Java
src/common/ee/pri/bcup/common/util/ThreadUtils.java
rla/bcup
d0b15c3828f00cc9e4688a4b0023207a9a46fdc9
[ "MIT" ]
1
2015-11-08T10:02:27.000Z
2015-11-08T10:02:27.000Z
src/common/ee/pri/bcup/common/util/ThreadUtils.java
rla/bcup
d0b15c3828f00cc9e4688a4b0023207a9a46fdc9
[ "MIT" ]
null
null
null
src/common/ee/pri/bcup/common/util/ThreadUtils.java
rla/bcup
d0b15c3828f00cc9e4688a4b0023207a9a46fdc9
[ "MIT" ]
null
null
null
22.282353
75
0.680042
10,900
package ee.pri.bcup.common.util; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; /** * Helper methods for working with threads. * * Thread listing code is from: http://nadeausoftware.com/articles/2008/04/ * java_tip_how_list_and_find_threads_and_thread_groups * #Gettingtherootthreadgroup * * @author Raivo Laanemets */ public class ThreadUtils { /** * Joins thread. See {@link Thread#join()}. Throws * {@link InterruptedException} wrapped inside {@link RuntimeException}. */ public static void join(Thread thread) { try { thread.join(); } catch (InterruptedException e) { throw new RuntimeException("Cannot join on thread " + thread, e); } } /** * Returns the root thread group. */ public static ThreadGroup getRootThreadGroup() { ThreadGroup tg = Thread.currentThread().getThreadGroup(); ThreadGroup ptg; while ((ptg = tg.getParent()) != null) { tg = ptg; } return tg; } /** * Returns all thread groups. */ public static ThreadGroup[] getAllThreadGroups() { final ThreadGroup root = getRootThreadGroup(); int nAlloc = root.activeGroupCount(); int n = 0; ThreadGroup[] groups; do { nAlloc *= 2; groups = new ThreadGroup[nAlloc]; n = root.enumerate(groups, true); } while (n == nAlloc); ThreadGroup[] allGroups = new ThreadGroup[n + 1]; allGroups[0] = root; System.arraycopy(groups, 0, allGroups, 1, n); return allGroups; } /** * Returns all threads. */ public static Thread[] getAllThreads() { ThreadGroup root = getRootThreadGroup(); ThreadMXBean thbean = ManagementFactory.getThreadMXBean(); int nAlloc = thbean.getThreadCount(); int n = 0; Thread[] threads; do { nAlloc *= 2; threads = new Thread[nAlloc]; n = root.enumerate(threads, true); } while (n == nAlloc); return java.util.Arrays.copyOf(threads, n); } }
3e19b040150c6d012ef8ca2fb566e1cea2a6781d
670
java
Java
dosomething/src/org/dosomething/android/tasks/ErrorResponseCodeException.java
DoSomething/ds-android
255f5f492d444e777a2848f73f5d5774b9544011
[ "MIT" ]
null
null
null
dosomething/src/org/dosomething/android/tasks/ErrorResponseCodeException.java
DoSomething/ds-android
255f5f492d444e777a2848f73f5d5774b9544011
[ "MIT" ]
null
null
null
dosomething/src/org/dosomething/android/tasks/ErrorResponseCodeException.java
DoSomething/ds-android
255f5f492d444e777a2848f73f5d5774b9544011
[ "MIT" ]
null
null
null
17.179487
79
0.738806
10,901
package org.dosomething.android.tasks; public class ErrorResponseCodeException extends RuntimeException { private static final long serialVersionUID = 1L; private int responseCode; private String url; public ErrorResponseCodeException(int responseCode, String url){ super(String.format("Received response code %d from %s", responseCode, url)); this.responseCode = responseCode; this.url = url; } public int getResponseCode() { return responseCode; } public void setResponseCode(int responseCode) { this.responseCode = responseCode; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } }
3e19b0c3fb31e803e2788968f29022836a1dc2a5
265
java
Java
yatl-kmf/src/test/java/edoc/EdocVisitable.java
opatrascoiu/jmf
be597da51fa5964f07ee74213640894af8fff535
[ "Apache-2.0" ]
null
null
null
yatl-kmf/src/test/java/edoc/EdocVisitable.java
opatrascoiu/jmf
be597da51fa5964f07ee74213640894af8fff535
[ "Apache-2.0" ]
null
null
null
yatl-kmf/src/test/java/edoc/EdocVisitable.java
opatrascoiu/jmf
be597da51fa5964f07ee74213640894af8fff535
[ "Apache-2.0" ]
null
null
null
15.588235
52
0.675472
10,902
/** * * Class EdocVisitable.java * * Generated by KMFStudio at 09 March 2004 11:42:37 * Visit http://www.cs.ukc.ac.uk/kmf * */ package edoc; public interface EdocVisitable { /** Accept the visitor */ public Object accept(EdocVisitor v, Object obj); }
3e19b1c519cb0277f2e0a629f7618914f6d69a29
3,420
java
Java
library/src/main/java/com/jiajieshen/android/library/util/ApplicationUtil.java
jiajieshen/AndroidDevSamples
ee5b3a5f68a0083bb16999b107777cd2bd680c85
[ "Apache-2.0" ]
2
2017-08-08T05:05:56.000Z
2018-06-29T13:57:24.000Z
library/src/main/java/com/jiajieshen/android/library/util/ApplicationUtil.java
jiajieshen/AndroidDevSamples
ee5b3a5f68a0083bb16999b107777cd2bd680c85
[ "Apache-2.0" ]
null
null
null
library/src/main/java/com/jiajieshen/android/library/util/ApplicationUtil.java
jiajieshen/AndroidDevSamples
ee5b3a5f68a0083bb16999b107777cd2bd680c85
[ "Apache-2.0" ]
null
null
null
38
105
0.664912
10,903
package com.jiajieshen.android.library.util; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.net.Uri; import android.support.annotation.CheckResult; import android.support.annotation.NonNull; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public final class ApplicationUtil { private ApplicationUtil() { throw new UnsupportedOperationException(); } public static String getAppName(Context context) { String appName = ""; try { PackageManager packageManager = context.getPackageManager(); PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); int labelRes = packageInfo.applicationInfo.labelRes; appName = context.getResources().getString(labelRes); } catch (NameNotFoundException e) { e.printStackTrace(); } return appName; } public static String getMetaData(Context context, @NonNull String key) { String metaDataValue = ""; try { PackageManager packageManager = context.getPackageManager(); if (packageManager != null) { ApplicationInfo applicationInfo = packageManager.getApplicationInfo( context.getPackageName(), PackageManager.GET_META_DATA); if (applicationInfo != null && applicationInfo.metaData != null) { metaDataValue = applicationInfo.metaData.getString(key); } } } catch (NameNotFoundException e) { e.printStackTrace(); } return metaDataValue; } @CheckResult public static boolean checkApk(Context context, @NonNull String apkPath) { try { PackageManager pm = context.getPackageManager(); PackageInfo info = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES); if (info != null) { return true; } } catch (Exception e) { Toast.makeText(context, "安装包失效", Toast.LENGTH_SHORT).show(); } return false; } public static void installApk(Context context, String apkPath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.parse("file://" + apkPath), "application/vnd.android.package-archive"); context.startActivity(intent); } public static List<String> getAllAppPackageName(Activity activity) { final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); final PackageManager packageManager = activity.getPackageManager(); List<ResolveInfo> apps = packageManager.queryIntentActivities(mainIntent, 0); List<String> packageNameList = new ArrayList<>(apps.size()); for (int i = 0, size = apps.size(); i < size; i++) { ResolveInfo info = apps.get(i); packageNameList.add(info.activityInfo.applicationInfo.packageName); } return packageNameList; } }
3e19b3472ac7fee8a8bd65f27f97cf581f416f04
1,995
java
Java
xmlintelledit/intelledit/src/main/java/at/ac/tuwien/big/xmlintelledit/intelledit/test/InterpretingOCLBooleanExpressionEvaluator.java
patrickneubauer/XMLIntellEdit
5e4a0ad59b7e9446e7f79dcb32e09971c2193118
[ "MIT" ]
6
2017-05-18T13:38:37.000Z
2021-12-16T19:29:29.000Z
xmlintelledit/intelledit/src/main/java/at/ac/tuwien/big/xmlintelledit/intelledit/test/InterpretingOCLBooleanExpressionEvaluator.java
patrickneubauer/XMLIntellEdit
5e4a0ad59b7e9446e7f79dcb32e09971c2193118
[ "MIT" ]
null
null
null
xmlintelledit/intelledit/src/main/java/at/ac/tuwien/big/xmlintelledit/intelledit/test/InterpretingOCLBooleanExpressionEvaluator.java
patrickneubauer/XMLIntellEdit
5e4a0ad59b7e9446e7f79dcb32e09971c2193118
[ "MIT" ]
null
null
null
33.813559
105
0.803008
10,904
package at.ac.tuwien.big.xmlintelledit.intelledit.test; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.mwe.utils.StandaloneSetup; import org.eclipse.ocl.ParserException; import org.eclipse.ocl.ecore.OCL; import org.eclipse.ocl.ecore.OCL.Helper; import org.eclipse.ocl.ecore.OCLExpression; import org.eclipse.ocl.ecore.delegate.OCLDelegateDomain; import org.eclipse.ocl.ecore.delegate.OCLInvocationDelegateFactory; import org.eclipse.ocl.ecore.delegate.OCLSettingDelegateFactory; import at.ac.tuwien.big.xmlintelledit.intelledit.oclgen.OCLBooleanExpressionEvaluator; public class InterpretingOCLBooleanExpressionEvaluator implements OCLBooleanExpressionEvaluator<Object> { static { //Just to be able to call everything for OCL new StandaloneSetup().setPlatformUri("./"); // CompleteOCLStandaloneSetup.doSetup(); // OCLinEcoreStandaloneSetup.doSetup(); // OCLstdlibStandaloneSetup.doSetup(); String oclDelegateURI = OCLDelegateDomain.OCL_DELEGATE_URI; EOperation.Internal.InvocationDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI, new OCLInvocationDelegateFactory.Global()); EStructuralFeature.Internal.SettingDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI, new OCLSettingDelegateFactory.Global()); OCL.initialize(null); } private final OCLExpression oclExpression; public InterpretingOCLBooleanExpressionEvaluator(EClassifier context, String oclExpression) { OCL ocl = OCL.newInstance(); Helper oclHelper = ocl.createOCLHelper(); oclHelper.setContext(context); try { this.oclExpression = oclHelper.createQuery(oclExpression); } catch (ParserException ex) { throw new RuntimeException(ex); } } @Override public boolean isValid(Object context) { OCL ocl = OCL.newInstance(); return ocl.check(context, oclExpression); } @Override public EStructuralFeature findErrorFeature(Object self) { return null; } }
3e19b3b58c461a665ada7ec1b4200227855d635d
517
java
Java
src/DeleteButton.java
shearjac/DrawingProgram
5f19966756a30eb45fe682c18f5a4f492aa75347
[ "MIT" ]
null
null
null
src/DeleteButton.java
shearjac/DrawingProgram
5f19966756a30eb45fe682c18f5a4f492aa75347
[ "MIT" ]
null
null
null
src/DeleteButton.java
shearjac/DrawingProgram
5f19966756a30eb45fe682c18f5a4f492aa75347
[ "MIT" ]
null
null
null
30.411765
70
0.764023
10,905
import javax.swing.*; import java.awt.event.*; public class DeleteButton extends JButton implements ActionListener { private DeleteCommand deleteCommand; private UndoManager undoManager; public DeleteButton(UndoManager undoManager) { super("Delete"); this.undoManager = undoManager; addActionListener(this); } public void actionPerformed(ActionEvent event) { deleteCommand = new DeleteCommand(); undoManager.beginCommand(deleteCommand); undoManager.endCommand(deleteCommand); } }
3e19b43f578306aa0cb7587444af13526693456e
2,959
java
Java
spring-web/src/main/java/org/springframework/web/context/support/ServletContextAwareProcessor.java
dongxiaoxu/spring3.2
8f238c0ed8fc2abcdf76f8fa44e2ed8eb3e4ce65
[ "Apache-2.0" ]
8
2017-05-24T03:07:34.000Z
2019-08-27T15:10:33.000Z
spring-web/src/main/java/org/springframework/web/context/support/ServletContextAwareProcessor.java
dongxiaoxu/spring3.2
8f238c0ed8fc2abcdf76f8fa44e2ed8eb3e4ce65
[ "Apache-2.0" ]
null
null
null
spring-web/src/main/java/org/springframework/web/context/support/ServletContextAwareProcessor.java
dongxiaoxu/spring3.2
8f238c0ed8fc2abcdf76f8fa44e2ed8eb3e4ce65
[ "Apache-2.0" ]
25
2017-06-07T15:36:17.000Z
2021-12-17T10:40:46.000Z
33.625
100
0.781683
10,906
/* * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.context.support; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.web.context.ServletConfigAware; import org.springframework.web.context.ServletContextAware; /** * {@link org.springframework.beans.factory.config.BeanPostProcessor} * implementation that passes the ServletContext to beans that implement * the {@link ServletContextAware} interface. * * <p>Web application contexts will automatically register this with their * underlying bean factory. Applications do not use this directly. * * @author Juergen Hoeller * @since 12.03.2004 * @see org.springframework.web.context.ServletContextAware * @see org.springframework.web.context.support.XmlWebApplicationContext#postProcessBeanFactory */ public class ServletContextAwareProcessor implements BeanPostProcessor { private ServletContext servletContext; private ServletConfig servletConfig; /** * Create a new ServletContextAwareProcessor for the given context. */ public ServletContextAwareProcessor(ServletContext servletContext) { this(servletContext, null); } /** * Create a new ServletContextAwareProcessor for the given config. */ public ServletContextAwareProcessor(ServletConfig servletConfig) { this(null, servletConfig); } /** * Create a new ServletContextAwareProcessor for the given context and config. */ public ServletContextAwareProcessor(ServletContext servletContext, ServletConfig servletConfig) { this.servletContext = servletContext; this.servletConfig = servletConfig; if (servletContext == null && servletConfig != null) { this.servletContext = servletConfig.getServletContext(); } } public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (this.servletContext != null && bean instanceof ServletContextAware) { ((ServletContextAware) bean).setServletContext(this.servletContext); } if (this.servletConfig != null && bean instanceof ServletConfigAware) { ((ServletConfigAware) bean).setServletConfig(this.servletConfig); } return bean; } public Object postProcessAfterInitialization(Object bean, String beanName) { return bean; } }
3e19b603c0fc4ad384cc0da9644e309d7c54f29f
1,288
java
Java
College/Object Oriented Programming/Lista03/src/Exercicio09/Exercicio09.java
thierrygb/Dumpcode
820e3fd3379fda4149423de3b6b9fd4b87e4901f
[ "MIT" ]
null
null
null
College/Object Oriented Programming/Lista03/src/Exercicio09/Exercicio09.java
thierrygb/Dumpcode
820e3fd3379fda4149423de3b6b9fd4b87e4901f
[ "MIT" ]
null
null
null
College/Object Oriented Programming/Lista03/src/Exercicio09/Exercicio09.java
thierrygb/Dumpcode
820e3fd3379fda4149423de3b6b9fd4b87e4901f
[ "MIT" ]
null
null
null
32.2
96
0.708075
10,907
package Exercicio09; import javax.swing.JApplet; import javax.swing.JOptionPane; public class Exercicio09 extends JApplet{ public void init(){ Veiculos [] veiculos = new Veiculos[2]; for (int i = 0; i < veiculos.length; i++){ String nomeVeiculo = JOptionPane.showInputDialog("Digite o nome do veículo " + (i+1) + "."); String anoFabricacao = JOptionPane.showInputDialog("Digite o ano do veículo " + (i+1) + "."); veiculos[i] = new Veiculos(anoFabricacao, nomeVeiculo); } String saida = ""; for (int i = 0; i < veiculos.length; i++){ saida = saida + "-- Veículo " + (i+1) + " --\nNome: " + veiculos[i].getNomeveiculo() + "\nAno de fabricação: " + veiculos[i].getAnodefabricacao() + "\n\n"; } JOptionPane.showMessageDialog (null, saida); } } class Veiculos{ private String anodefabricacao; private String nomeveiculo; Veiculos(String anopassado, String nomepassado){ setAnodefabricacao(anopassado); setNomeveiculo(nomepassado); } public String getAnodefabricacao() { return anodefabricacao; } public void setAnodefabricacao(String anodefabricacao) { this.anodefabricacao = anodefabricacao; } public String getNomeveiculo() { return nomeveiculo; } public void setNomeveiculo(String nomeveiculo) { this.nomeveiculo = nomeveiculo; } }
3e19b624edcc4ab89585d0e4f2980f514c7aaae1
1,106
java
Java
src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/hwyla/TombstoneProvider.java
mcBegins2Snow/TouhouLittleMaid
a25dcd18ee111caeb35fb26956593c88811475eb
[ "MIT" ]
null
null
null
src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/hwyla/TombstoneProvider.java
mcBegins2Snow/TouhouLittleMaid
a25dcd18ee111caeb35fb26956593c88811475eb
[ "MIT" ]
1
2019-12-28T02:03:26.000Z
2019-12-28T02:03:26.000Z
src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/hwyla/TombstoneProvider.java
mcBegins2Snow/TouhouLittleMaid
a25dcd18ee111caeb35fb26956593c88811475eb
[ "MIT" ]
1
2019-12-27T20:20:15.000Z
2019-12-27T20:20:15.000Z
36.866667
138
0.749548
10,908
package com.github.tartaricacid.touhoulittlemaid.compat.hwyla; import com.github.tartaricacid.touhoulittlemaid.tileentity.TileEntityTombstone; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataProvider; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import javax.annotation.Nonnull; import java.util.List; /** * @author TartaricAcid * @date 2019/10/5 20:57 **/ public class TombstoneProvider implements IWailaDataProvider { @Nonnull @Override public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) { if (accessor.getTileEntity() instanceof TileEntityTombstone) { TileEntityTombstone tombstone = (TileEntityTombstone) accessor.getTileEntity(); if (!tombstone.getOwnerName().isEmpty()) { tooltip.add(I18n.format("hwyla.touhou_little_maid.tombstone.maid_owner", tombstone.getOwnerName())); } } return tooltip; } }
3e19b7de574edfd077f65c93a64ec06614c37e3b
17,571
java
Java
library/src/main/java/com/nostra13/universalimageloader/core/DisplayImageOptions.java
folee/Android-Universal-Image-Loader
44655172f8f64234fb1095f36c0330403ae1d427
[ "Apache-2.0" ]
13,016
2015-01-01T00:37:50.000Z
2022-03-30T13:10:29.000Z
library/src/main/java/com/nostra13/universalimageloader/core/DisplayImageOptions.java
folee/Android-Universal-Image-Loader
44655172f8f64234fb1095f36c0330403ae1d427
[ "Apache-2.0" ]
579
2015-01-01T13:50:55.000Z
2022-02-22T00:09:30.000Z
library/src/main/java/com/nostra13/universalimageloader/core/DisplayImageOptions.java
folee/Android-Universal-Image-Loader
44655172f8f64234fb1095f36c0330403ae1d427
[ "Apache-2.0" ]
5,199
2015-01-01T00:37:58.000Z
2022-03-27T09:05:02.000Z
34.794059
118
0.742701
10,909
/******************************************************************************* * Copyright 2011-2014 Sergey Tarasevich * * 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.nostra13.universalimageloader.core; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory.Options; import android.graphics.drawable.Drawable; import android.os.Handler; import com.nostra13.universalimageloader.core.listener.ImageLoadingListener; import com.nostra13.universalimageloader.core.assist.ImageScaleType; import com.nostra13.universalimageloader.core.display.BitmapDisplayer; import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer; import com.nostra13.universalimageloader.core.download.ImageDownloader; import com.nostra13.universalimageloader.core.process.BitmapProcessor; /** * Contains options for image display. Defines: * <ul> * <li>whether stub image will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} during image loading</li> * <li>whether stub image will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} if empty URI is passed</li> * <li>whether stub image will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} if image loading fails</li> * <li>whether {@link com.nostra13.universalimageloader.core.imageaware.ImageAware image aware view} should be reset * before image loading start</li> * <li>whether loaded image will be cached in memory</li> * <li>whether loaded image will be cached on disk</li> * <li>image scale type</li> * <li>decoding options (including bitmap decoding configuration)</li> * <li>delay before loading of image</li> * <li>whether consider EXIF parameters of image</li> * <li>auxiliary object which will be passed to {@link ImageDownloader#getStream(String, Object) ImageDownloader}</li> * <li>pre-processor for image Bitmap (before caching in memory)</li> * <li>post-processor for image Bitmap (after caching in memory, before displaying)</li> * <li>how decoded {@link Bitmap} will be displayed</li> * </ul> * <p/> * You can create instance: * <ul> * <li>with {@link Builder}:<br /> * <b>i.e.</b> : * <code>new {@link DisplayImageOptions}.Builder().{@link Builder#cacheInMemory() cacheInMemory()}. * {@link Builder#showImageOnLoading(int) showImageOnLoading()}.{@link Builder#build() build()}</code><br /> * </li> * <li>or by static method: {@link #createSimple()}</li> <br /> * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.0.0 */ public final class DisplayImageOptions { private final int imageResOnLoading; private final int imageResForEmptyUri; private final int imageResOnFail; private final Drawable imageOnLoading; private final Drawable imageForEmptyUri; private final Drawable imageOnFail; private final boolean resetViewBeforeLoading; private final boolean cacheInMemory; private final boolean cacheOnDisk; private final ImageScaleType imageScaleType; private final Options decodingOptions; private final int delayBeforeLoading; private final boolean considerExifParams; private final Object extraForDownloader; private final BitmapProcessor preProcessor; private final BitmapProcessor postProcessor; private final BitmapDisplayer displayer; private final Handler handler; private final boolean isSyncLoading; private DisplayImageOptions(Builder builder) { imageResOnLoading = builder.imageResOnLoading; imageResForEmptyUri = builder.imageResForEmptyUri; imageResOnFail = builder.imageResOnFail; imageOnLoading = builder.imageOnLoading; imageForEmptyUri = builder.imageForEmptyUri; imageOnFail = builder.imageOnFail; resetViewBeforeLoading = builder.resetViewBeforeLoading; cacheInMemory = builder.cacheInMemory; cacheOnDisk = builder.cacheOnDisk; imageScaleType = builder.imageScaleType; decodingOptions = builder.decodingOptions; delayBeforeLoading = builder.delayBeforeLoading; considerExifParams = builder.considerExifParams; extraForDownloader = builder.extraForDownloader; preProcessor = builder.preProcessor; postProcessor = builder.postProcessor; displayer = builder.displayer; handler = builder.handler; isSyncLoading = builder.isSyncLoading; } public boolean shouldShowImageOnLoading() { return imageOnLoading != null || imageResOnLoading != 0; } public boolean shouldShowImageForEmptyUri() { return imageForEmptyUri != null || imageResForEmptyUri != 0; } public boolean shouldShowImageOnFail() { return imageOnFail != null || imageResOnFail != 0; } public boolean shouldPreProcess() { return preProcessor != null; } public boolean shouldPostProcess() { return postProcessor != null; } public boolean shouldDelayBeforeLoading() { return delayBeforeLoading > 0; } public Drawable getImageOnLoading(Resources res) { return imageResOnLoading != 0 ? res.getDrawable(imageResOnLoading) : imageOnLoading; } public Drawable getImageForEmptyUri(Resources res) { return imageResForEmptyUri != 0 ? res.getDrawable(imageResForEmptyUri) : imageForEmptyUri; } public Drawable getImageOnFail(Resources res) { return imageResOnFail != 0 ? res.getDrawable(imageResOnFail) : imageOnFail; } public boolean isResetViewBeforeLoading() { return resetViewBeforeLoading; } public boolean isCacheInMemory() { return cacheInMemory; } public boolean isCacheOnDisk() { return cacheOnDisk; } public ImageScaleType getImageScaleType() { return imageScaleType; } public Options getDecodingOptions() { return decodingOptions; } public int getDelayBeforeLoading() { return delayBeforeLoading; } public boolean isConsiderExifParams() { return considerExifParams; } public Object getExtraForDownloader() { return extraForDownloader; } public BitmapProcessor getPreProcessor() { return preProcessor; } public BitmapProcessor getPostProcessor() { return postProcessor; } public BitmapDisplayer getDisplayer() { return displayer; } public Handler getHandler() { return handler; } boolean isSyncLoading() { return isSyncLoading; } /** * Builder for {@link DisplayImageOptions} * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) */ public static class Builder { private int imageResOnLoading = 0; private int imageResForEmptyUri = 0; private int imageResOnFail = 0; private Drawable imageOnLoading = null; private Drawable imageForEmptyUri = null; private Drawable imageOnFail = null; private boolean resetViewBeforeLoading = false; private boolean cacheInMemory = false; private boolean cacheOnDisk = false; private ImageScaleType imageScaleType = ImageScaleType.IN_SAMPLE_POWER_OF_2; private Options decodingOptions = new Options(); private int delayBeforeLoading = 0; private boolean considerExifParams = false; private Object extraForDownloader = null; private BitmapProcessor preProcessor = null; private BitmapProcessor postProcessor = null; private BitmapDisplayer displayer = DefaultConfigurationFactory.createBitmapDisplayer(); private Handler handler = null; private boolean isSyncLoading = false; /** * Stub image will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} during image loading * * @param imageRes Stub image resource * @deprecated Use {@link #showImageOnLoading(int)} instead */ @Deprecated public Builder showStubImage(int imageRes) { imageResOnLoading = imageRes; return this; } /** * Incoming image will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} during image loading * * @param imageRes Image resource */ public Builder showImageOnLoading(int imageRes) { imageResOnLoading = imageRes; return this; } /** * Incoming drawable will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} during image loading. * This option will be ignored if {@link DisplayImageOptions.Builder#showImageOnLoading(int)} is set. */ public Builder showImageOnLoading(Drawable drawable) { imageOnLoading = drawable; return this; } /** * Incoming image will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} if empty URI (null or empty * string) will be passed to <b>ImageLoader.displayImage(...)</b> method. * * @param imageRes Image resource */ public Builder showImageForEmptyUri(int imageRes) { imageResForEmptyUri = imageRes; return this; } /** * Incoming drawable will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} if empty URI (null or empty * string) will be passed to <b>ImageLoader.displayImage(...)</b> method. * This option will be ignored if {@link DisplayImageOptions.Builder#showImageForEmptyUri(int)} is set. */ public Builder showImageForEmptyUri(Drawable drawable) { imageForEmptyUri = drawable; return this; } /** * Incoming image will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} if some error occurs during * requested image loading/decoding. * * @param imageRes Image resource */ public Builder showImageOnFail(int imageRes) { imageResOnFail = imageRes; return this; } /** * Incoming drawable will be displayed in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} if some error occurs during * requested image loading/decoding. * This option will be ignored if {@link DisplayImageOptions.Builder#showImageOnFail(int)} is set. */ public Builder showImageOnFail(Drawable drawable) { imageOnFail = drawable; return this; } /** * {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} will be reset (set <b>null</b>) before image loading start * * @deprecated Use {@link #resetViewBeforeLoading(boolean) resetViewBeforeLoading(true)} instead */ public Builder resetViewBeforeLoading() { resetViewBeforeLoading = true; return this; } /** * Sets whether {@link com.nostra13.universalimageloader.core.imageaware.ImageAware * image aware view} will be reset (set <b>null</b>) before image loading start */ public Builder resetViewBeforeLoading(boolean resetViewBeforeLoading) { this.resetViewBeforeLoading = resetViewBeforeLoading; return this; } /** * Loaded image will be cached in memory * * @deprecated Use {@link #cacheInMemory(boolean) cacheInMemory(true)} instead */ @Deprecated public Builder cacheInMemory() { cacheInMemory = true; return this; } /** Sets whether loaded image will be cached in memory */ public Builder cacheInMemory(boolean cacheInMemory) { this.cacheInMemory = cacheInMemory; return this; } /** * Loaded image will be cached on disk * * @deprecated Use {@link #cacheOnDisk(boolean) cacheOnDisk(true)} instead */ @Deprecated public Builder cacheOnDisc() { return cacheOnDisk(true); } /** * Sets whether loaded image will be cached on disk * * @deprecated Use {@link #cacheOnDisk(boolean)} instead */ @Deprecated public Builder cacheOnDisc(boolean cacheOnDisk) { return cacheOnDisk(cacheOnDisk); } /** Sets whether loaded image will be cached on disk */ public Builder cacheOnDisk(boolean cacheOnDisk) { this.cacheOnDisk = cacheOnDisk; return this; } /** * Sets {@linkplain ImageScaleType scale type} for decoding image. This parameter is used while define scale * size for decoding image to Bitmap. Default value - {@link ImageScaleType#IN_SAMPLE_POWER_OF_2} */ public Builder imageScaleType(ImageScaleType imageScaleType) { this.imageScaleType = imageScaleType; return this; } /** Sets {@link Bitmap.Config bitmap config} for image decoding. Default value - {@link Bitmap.Config#ARGB_8888} */ public Builder bitmapConfig(Bitmap.Config bitmapConfig) { if (bitmapConfig == null) throw new IllegalArgumentException("bitmapConfig can't be null"); decodingOptions.inPreferredConfig = bitmapConfig; return this; } /** * Sets options for image decoding.<br /> * <b>NOTE:</b> {@link Options#inSampleSize} of incoming options will <b>NOT</b> be considered. Library * calculate the most appropriate sample size itself according yo {@link #imageScaleType(ImageScaleType)} * options.<br /> * <b>NOTE:</b> This option overlaps {@link #bitmapConfig(android.graphics.Bitmap.Config) bitmapConfig()} * option. */ public Builder decodingOptions(Options decodingOptions) { if (decodingOptions == null) throw new IllegalArgumentException("decodingOptions can't be null"); this.decodingOptions = decodingOptions; return this; } /** Sets delay time before starting loading task. Default - no delay. */ public Builder delayBeforeLoading(int delayInMillis) { this.delayBeforeLoading = delayInMillis; return this; } /** Sets auxiliary object which will be passed to {@link ImageDownloader#getStream(String, Object)} */ public Builder extraForDownloader(Object extra) { this.extraForDownloader = extra; return this; } /** Sets whether ImageLoader will consider EXIF parameters of JPEG image (rotate, flip) */ public Builder considerExifParams(boolean considerExifParams) { this.considerExifParams = considerExifParams; return this; } /** * Sets bitmap processor which will be process bitmaps before they will be cached in memory. So memory cache * will contain bitmap processed by incoming preProcessor.<br /> * Image will be pre-processed even if caching in memory is disabled. */ public Builder preProcessor(BitmapProcessor preProcessor) { this.preProcessor = preProcessor; return this; } /** * Sets bitmap processor which will be process bitmaps before they will be displayed in * {@link com.nostra13.universalimageloader.core.imageaware.ImageAware image aware view} but * after they'll have been saved in memory cache. */ public Builder postProcessor(BitmapProcessor postProcessor) { this.postProcessor = postProcessor; return this; } /** * Sets custom {@link BitmapDisplayer displayer} for image loading task. Default value - * {@link DefaultConfigurationFactory#createBitmapDisplayer()} */ public Builder displayer(BitmapDisplayer displayer) { if (displayer == null) throw new IllegalArgumentException("displayer can't be null"); this.displayer = displayer; return this; } Builder syncLoading(boolean isSyncLoading) { this.isSyncLoading = isSyncLoading; return this; } /** * Sets custom {@linkplain Handler handler} for displaying images and firing {@linkplain ImageLoadingListener * listener} events. */ public Builder handler(Handler handler) { this.handler = handler; return this; } /** Sets all options equal to incoming options */ public Builder cloneFrom(DisplayImageOptions options) { imageResOnLoading = options.imageResOnLoading; imageResForEmptyUri = options.imageResForEmptyUri; imageResOnFail = options.imageResOnFail; imageOnLoading = options.imageOnLoading; imageForEmptyUri = options.imageForEmptyUri; imageOnFail = options.imageOnFail; resetViewBeforeLoading = options.resetViewBeforeLoading; cacheInMemory = options.cacheInMemory; cacheOnDisk = options.cacheOnDisk; imageScaleType = options.imageScaleType; decodingOptions = options.decodingOptions; delayBeforeLoading = options.delayBeforeLoading; considerExifParams = options.considerExifParams; extraForDownloader = options.extraForDownloader; preProcessor = options.preProcessor; postProcessor = options.postProcessor; displayer = options.displayer; handler = options.handler; isSyncLoading = options.isSyncLoading; return this; } /** Builds configured {@link DisplayImageOptions} object */ public DisplayImageOptions build() { return new DisplayImageOptions(this); } } /** * Creates options appropriate for single displaying: * <ul> * <li>View will <b>not</b> be reset before loading</li> * <li>Loaded image will <b>not</b> be cached in memory</li> * <li>Loaded image will <b>not</b> be cached on disk</li> * <li>{@link ImageScaleType#IN_SAMPLE_POWER_OF_2} decoding type will be used</li> * <li>{@link Bitmap.Config#ARGB_8888} bitmap config will be used for image decoding</li> * <li>{@link SimpleBitmapDisplayer} will be used for image displaying</li> * </ul> * <p/> * These option are appropriate for simple single-use image (from drawables or from Internet) displaying. */ public static DisplayImageOptions createSimple() { return new Builder().build(); } }
3e19b99888845c14200de728ca4ed5547a5f798b
3,748
java
Java
src/main/java/lsieun/net/http/utils/HTMLUtils.java
lsieun/lsieun-web
c1ce6f8d127224979f29b812d73bc4c2bdb73a6f
[ "Apache-2.0" ]
null
null
null
src/main/java/lsieun/net/http/utils/HTMLUtils.java
lsieun/lsieun-web
c1ce6f8d127224979f29b812d73bc4c2bdb73a6f
[ "Apache-2.0" ]
1
2020-10-21T15:18:56.000Z
2020-10-21T15:18:56.000Z
src/main/java/lsieun/net/http/utils/HTMLUtils.java
lsieun/lsieun-web
c1ce6f8d127224979f29b812d73bc4c2bdb73a6f
[ "Apache-2.0" ]
null
null
null
31.233333
102
0.615261
10,910
package lsieun.net.http.utils; import lsieun.utils.FileUtils; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class HTMLUtils { private static final String TEMPLATE_PATH = System.getProperty ("user.dir") + "/static/template/"; public static String getListHead() throws IOException { String filepath = TEMPLATE_PATH + "list_head.html"; return FileUtils.readHtml(filepath); } public static String getListBody() throws IOException { String filepath = TEMPLATE_PATH + "list_body.html"; return FileUtils.readHtml(filepath); } public static String getListEntry() throws IOException { String filepath = TEMPLATE_PATH + "list_entry.html"; return FileUtils.readHtml(filepath); } public static String getIntroductionMenu() throws IOException { String filepath = TEMPLATE_PATH + "list_introduction_menu.html"; return FileUtils.readHtml(filepath); } public static String getPopularPostEntry() throws IOException { String filepath = TEMPLATE_PATH + "list_popular_post_entry.html"; return FileUtils.readHtml(filepath); } public static String getContentHead() throws IOException { String filepath = TEMPLATE_PATH + "content_head.html"; return FileUtils.readHtml(filepath); } public static String getContentBody() throws IOException { String filepath = TEMPLATE_PATH + "content_body.html"; return FileUtils.readHtml(filepath); } public static String getNavBar() throws IOException { String filepath = TEMPLATE_PATH + "nav_bar.html"; return FileUtils.readHtml(filepath); } public static String getTitle(String content) { String reg = "<h\\d .+><span .+?>(.+)</span></h\\d>"; Pattern p = Pattern.compile(reg); Matcher matcher = p.matcher(content); if(matcher.find()){ String title = matcher.group(1); return title; } return "In My Humble Opinion"; } public static void generateContentHtml(String relative_path) { try { String from_path = relative_path; String to_path = relative_path; String head = getContentHead(); String body = getContentBody(); String nav_bar = getNavBar(); String content = FileUtils.readHtml(from_path); String title = getTitle(content); String html = head.replace("__TITLE__", title) + body.replace("__NAVIGATION_BAR__", nav_bar) .replace("__PAGE_CONTENT__", content); FileUtils.writeHtml(html, to_path); } catch (IOException e) { e.printStackTrace(); } } public static void getAllFiles(File dir, List<File> fileList) { File[] files = dir.listFiles(); if (files == null || files.length < 1) return; for (File file : files) { if (file.isDirectory()) { getAllFiles(file, fileList); } else { if (file.getName().endsWith(".html")) { fileList.add(file); } } } } public static void generateStaticHTML() { File dir = new File(""); List<File> fileList = new ArrayList<>(); getAllFiles(dir, fileList); for (File f : fileList) { String relative_path = f.getPath().substring("".length()); HTMLUtils.generateContentHtml(relative_path); } } public static void main(String[] args) { generateStaticHTML(); } }
3e19ba87a2beff43ec03a4628e3c0b696a31c2ba
1,016
java
Java
src/main/java/com/gmail/samuel/kerrien/demo_2/ConsumerThread.java
samuel-kerrien/kafka-demo
525462354abd29391d27c7a0163d07a4e125e599
[ "Apache-2.0" ]
null
null
null
src/main/java/com/gmail/samuel/kerrien/demo_2/ConsumerThread.java
samuel-kerrien/kafka-demo
525462354abd29391d27c7a0163d07a4e125e599
[ "Apache-2.0" ]
null
null
null
src/main/java/com/gmail/samuel/kerrien/demo_2/ConsumerThread.java
samuel-kerrien/kafka-demo
525462354abd29391d27c7a0163d07a4e125e599
[ "Apache-2.0" ]
null
null
null
28.222222
98
0.634843
10,911
package com.gmail.samuel.kerrien.demo_2; import kafka.consumer.ConsumerIterator; import kafka.consumer.KafkaStream; public class ConsumerThread implements Runnable { private final KafkaStream stream; private final int threadNumber; private final int id; private int messages = 0; public ConsumerThread(KafkaStream stream, int threadNumber) { this.threadNumber = threadNumber; this.stream = stream; this.id = threadNumber; } public int getMessages() { return messages; } public int getId() { return id; } public void run() { ConsumerIterator<byte[], byte[]> it = stream.iterator(); while (it.hasNext()) { System.out.println("Thread " + threadNumber + ": " + new String(it.next().message())); messages++; } System.out.println(String.format( "Thread %d: %,d messages", threadNumber, messages )); System.out.println("Shutting down Thread: " + threadNumber); } }
3e19ba88278213556799f14bc2a3ebe238d66443
87
java
Java
municipio-service-api/src/test/java/com/lambdasys/microservices/municipio/api/MunicipioData.java
leoluzh/microprofile
0c55a99d7382ee19e022d8079c5cbd1f1d4be129
[ "Apache-2.0" ]
null
null
null
municipio-service-api/src/test/java/com/lambdasys/microservices/municipio/api/MunicipioData.java
leoluzh/microprofile
0c55a99d7382ee19e022d8079c5cbd1f1d4be129
[ "Apache-2.0" ]
null
null
null
municipio-service-api/src/test/java/com/lambdasys/microservices/municipio/api/MunicipioData.java
leoluzh/microprofile
0c55a99d7382ee19e022d8079c5cbd1f1d4be129
[ "Apache-2.0" ]
null
null
null
12.428571
50
0.781609
10,912
package com.lambdasys.microservices.municipio.api; public class MunicipioData { }
3e19baa1b546a8ec18c4b56329c32e4ba693bcf1
900
java
Java
org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/primitivetypes10_50/Oid10_50.java
jelmerterwal/org.hl7.fhir.core
99fcac64ac35ca7dc3a4aa9922684ac7fdb0ee7b
[ "Apache-2.0" ]
null
null
null
org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/primitivetypes10_50/Oid10_50.java
jelmerterwal/org.hl7.fhir.core
99fcac64ac35ca7dc3a4aa9922684ac7fdb0ee7b
[ "Apache-2.0" ]
null
null
null
org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/datatypes10_50/primitivetypes10_50/Oid10_50.java
jelmerterwal/org.hl7.fhir.core
99fcac64ac35ca7dc3a4aa9922684ac7fdb0ee7b
[ "Apache-2.0" ]
null
null
null
47.368421
156
0.743333
10,913
package org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50; import org.hl7.fhir.convertors.conv10_50.datatypes10_50.Element10_50; import org.hl7.fhir.exceptions.FHIRException; public class Oid10_50 { public static org.hl7.fhir.r5.model.OidType convertOid(org.hl7.fhir.dstu2.model.OidType src) throws FHIRException { org.hl7.fhir.r5.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.OidType(src.getValue()) : new org.hl7.fhir.r5.model.OidType(); Element10_50.copyElement(src, tgt); return tgt; } public static org.hl7.fhir.dstu2.model.OidType convertOid(org.hl7.fhir.r5.model.OidType src) throws FHIRException { org.hl7.fhir.dstu2.model.OidType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.OidType(src.getValue()) : new org.hl7.fhir.dstu2.model.OidType(); Element10_50.copyElement(src, tgt); return tgt; } }
3e19bb52a6ee82e4782540ce98db53e9ce93b7cf
3,981
java
Java
src/com/dermotblair/touchball/TouchView.java
dermotblair/TouchBall
7e3901e6e43724a4e967cf48496739a094e8f1fe
[ "MIT" ]
null
null
null
src/com/dermotblair/touchball/TouchView.java
dermotblair/TouchBall
7e3901e6e43724a4e967cf48496739a094e8f1fe
[ "MIT" ]
null
null
null
src/com/dermotblair/touchball/TouchView.java
dermotblair/TouchBall
7e3901e6e43724a4e967cf48496739a094e8f1fe
[ "MIT" ]
null
null
null
28.640288
113
0.702838
10,914
package com.dermotblair.touchball; import com.dermotblair.touchball.R; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Typeface; import android.media.AudioManager; import android.media.SoundPool; import android.media.SoundPool.OnLoadCompleteListener; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; public class TouchView extends View { private Paint mPaint; private Paint textPaint; private Ball ballCurrentlyDisplayed = null; private SoundPool soundPool; private int soundID; private boolean loadedBallTouchSound = false; private AudioManager audioManager = null; private MainActivity context = null; private float actualVolume = 0; private float maxVolume = 0; private float volume = 0; private boolean gameOver = false; public TouchView(Context context, AttributeSet attrs) { super(context, attrs); this.context = (MainActivity)context; initView(); } private void initView() { mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setColor(Color.BLUE); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); textPaint.setTextSize(30); Typeface typeFace = Typeface.create((String)null,Typeface.BOLD); textPaint.setTypeface(typeFace); // Set the hardware buttons to control the music ((MainActivity)getContext()).setVolumeControlStream(AudioManager.STREAM_MUSIC); // Load the sound soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); soundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() { @Override public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { loadedBallTouchSound = true; } }); soundID = soundPool.load(context, R.raw.small_explosion_8_bit, 1); audioManager = (AudioManager)getContext().getSystemService(Context.AUDIO_SERVICE); // Getting the user sound settings actualVolume = (float) audioManager.getStreamVolume(AudioManager.STREAM_MUSIC); maxVolume = (float) audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); volume = actualVolume / maxVolume; } @Override public boolean onTouchEvent(MotionEvent event) { int pointerIndex = event.getActionIndex(); int maskedAction = event.getActionMasked(); switch (maskedAction) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_POINTER_DOWN: { float x = event.getX(pointerIndex); float y = event.getY(pointerIndex); // Check if the user touched the last ball that was displayed. if(ballCurrentlyDisplayed != null) { if(!ballCurrentlyDisplayed.isTouched() && ballCurrentlyDisplayed.contains(x, y)) { if(gameOver) return true; ballCurrentlyDisplayed.setTouched(true); if (loadedBallTouchSound) { soundPool.play(soundID, volume, volume, 1, 0, 1f); } invalidate(); context.addToScore(1); context.updateMissedBallCount(0); } } break; } case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_CANCEL: break; } return true; } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if(gameOver) return; ballCurrentlyDisplayed = ((MainActivity)getContext()).getBallCurrentlyDisplayed(); if(ballCurrentlyDisplayed != null && !ballCurrentlyDisplayed.isTouched()) { mPaint.setColor(ballCurrentlyDisplayed.getColor()); canvas.drawCircle(ballCurrentlyDisplayed.getX(), ballCurrentlyDisplayed.getY(), Constants.BALL_RADIUS, mPaint); } } public void setGameOver(boolean gameOver) { this.gameOver = gameOver; } }
3e19bbbc26e26f2a4ab6c69db08d81f956b09bb1
1,342
java
Java
src/main/java/com/rbs/vanquish/bpm/example/ExampleMessageSender.java
LitheshGopalan/vanquish
f1d48456591f21ff3289fc4d0b5cb15f63cacfa8
[ "Apache-2.0" ]
null
null
null
src/main/java/com/rbs/vanquish/bpm/example/ExampleMessageSender.java
LitheshGopalan/vanquish
f1d48456591f21ff3289fc4d0b5cb15f63cacfa8
[ "Apache-2.0" ]
null
null
null
src/main/java/com/rbs/vanquish/bpm/example/ExampleMessageSender.java
LitheshGopalan/vanquish
f1d48456591f21ff3289fc4d0b5cb15f63cacfa8
[ "Apache-2.0" ]
null
null
null
45
108
0.638519
10,915
package com.rbs.vanquish.bpm.example; import org.springframework.beans.factory.annotation.Autowired; import com.rbs.vanquish.bpm.message.creator.ExampleMessageCreator; import com.rbs.vanquish.framework.bpm.message.VanquishMessageCreator; import com.rbs.vanquish.framework.bpm.service.MessageSender; /** -------------------------------------------------------------------------------------------------------- * Description : An class to be written by the devloper to dispatch a message to the queue used * : in vanquish application. During execution framework will execute this class. * Author : Lithesh Anargha * Email : lyhxr@example.com * Date : 20/08/2018 * Project : Vanquish * Platform : Bankline Direct Digital * Organization : Royal Bank of Scotland plc. -------------------------------------------------------------------------------------------------------- **/ public class ExampleMessageSender { @Autowired MessageSender messageSender; public void dispatchMessage(String aBusinessKey, Object aMessageObject) { VanquishMessageCreator loExampleMessageCreator = new ExampleMessageCreator(aBusinessKey,aMessageObject); messageSender.sendMessage("VANQUISH.DUPLICATE.CHECK.RESPONSE.DEV", loExampleMessageCreator); }//eof dispatchMessage }//eof class
3e19bc095f5dea580a887b0b1dd5c3ae3594ab3a
4,014
java
Java
anchor-spatial/src/main/java/org/anchoranalysis/spatial/point/Tuple3f.java
anchorimageanalysis/anchor
28a5b068841a405e66bd9e0e29d287b0e7afb0b9
[ "MIT" ]
null
null
null
anchor-spatial/src/main/java/org/anchoranalysis/spatial/point/Tuple3f.java
anchorimageanalysis/anchor
28a5b068841a405e66bd9e0e29d287b0e7afb0b9
[ "MIT" ]
136
2020-02-17T10:33:05.000Z
2022-02-13T12:10:58.000Z
anchor-spatial/src/main/java/org/anchoranalysis/spatial/point/Tuple3f.java
anchoranalysis/anchor
b8a267ebcc69412200388f8e4959aed7c08ea828
[ "MIT" ]
null
null
null
32.901639
98
0.642501
10,916
package org.anchoranalysis.spatial.point; /*- * #%L * anchor-core * %% * Copyright (C) 2010 - 2020 Owen Feehan * %% * 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. * #L% */ import java.io.Serializable; import lombok.Data; import lombok.experimental.Accessors; import org.anchoranalysis.core.exception.friendly.AnchorFriendlyRuntimeException; import org.anchoranalysis.spatial.axis.Axis; import org.anchoranalysis.spatial.axis.AxisConverter; /** * A <i>three</i>-dimensional tuple of <i>float</i> values. * * @author Owen Feehan */ @Data @Accessors(fluent = true) public abstract class Tuple3f implements Serializable { /** */ private static final long serialVersionUID = 1L; /** X-axis component of the tuple. */ protected float x = 0.0f; /** Y-axis component of the tuple. */ protected float y = 0.0f; /** Z-axis component of the tuple. */ protected float z = 0.0f; /** * A component of a tuple corresponding to a particular axis. * * @param axis the axis. * @return the component of the tuple corresponding to that axis. */ public final float valueByDimension(Axis axis) { switch (axis) { case X: return x; case Y: return y; case Z: return z; default: assert false; throw new AnchorFriendlyRuntimeException(AxisConverter.INVALID_AXIS_INDEX); } } /** * A component of a tuple corresponding to a particular dimension by index. * * @param dimensionIndex the index corresponding to an axis, as per {@link AxisConverter}. * @return the component of the tuple corresponding to that axis. */ public final float valueByDimension(int dimensionIndex) { if (dimensionIndex == 0) { return x; } else if (dimensionIndex == 1) { return y; } else if (dimensionIndex == 2) { return z; } else { throw new AnchorFriendlyRuntimeException(AxisConverter.INVALID_AXIS_STRING); } } /** * Assigns a value to a component of a tuple corresponding to a particular dimension by index. * * @param dimensionIndex the index corresponding to an axis, as per {@link AxisConverter}. * @param valueToAssign the value to assign. */ public final void setValueByDimension(int dimensionIndex, float valueToAssign) { switch (dimensionIndex) { case 0: this.x = valueToAssign; break; case 1: this.y = valueToAssign; break; case 2: this.z = valueToAssign; break; default: throw new AnchorFriendlyRuntimeException(AxisConverter.INVALID_AXIS_STRING); } } @Override public String toString() { return String.format("[%f,%f,%f]", x, y, z); } }
3e19bd02b152ec6248ed9dce468b3cb091afe5e1
76
java
Java
src/main/java/edu/xiyou/shortrent/service/package-info.java
zzy25/ShotRent
14d4373f0afefc25b3f8d76a0adec734fa341c85
[ "Apache-2.0" ]
null
null
null
src/main/java/edu/xiyou/shortrent/service/package-info.java
zzy25/ShotRent
14d4373f0afefc25b3f8d76a0adec734fa341c85
[ "Apache-2.0" ]
null
null
null
src/main/java/edu/xiyou/shortrent/service/package-info.java
zzy25/ShotRent
14d4373f0afefc25b3f8d76a0adec734fa341c85
[ "Apache-2.0" ]
1
2018-11-06T13:57:02.000Z
2018-11-06T13:57:02.000Z
19
36
0.684211
10,917
/** * Created by andrew on 16-3-9. */ package edu.xiyou.shortrent.service;
3e19bd77f25f53413e48a04b7109b343ca5819c9
355
java
Java
cq-component-annotations/src/main/java/com/citytechinc/cq/component/dialog/exception/InvalidComponentClassException.java
d-wells/cq-component-maven-plugin
3355f18e7a85bdde3e9cb2367e8c1a372674b0f3
[ "Apache-2.0" ]
12
2016-11-22T16:17:45.000Z
2018-12-20T02:05:22.000Z
cq-component-annotations/src/main/java/com/citytechinc/cq/component/dialog/exception/InvalidComponentClassException.java
d-wells/cq-component-maven-plugin
3355f18e7a85bdde3e9cb2367e8c1a372674b0f3
[ "Apache-2.0" ]
33
2016-10-12T23:20:35.000Z
2019-01-16T16:17:24.000Z
cq-component-annotations/src/main/java/com/citytechinc/cq/component/dialog/exception/InvalidComponentClassException.java
d-wells/cq-component-maven-plugin
3355f18e7a85bdde3e9cb2367e8c1a372674b0f3
[ "Apache-2.0" ]
24
2016-10-20T15:06:04.000Z
2018-11-30T20:58:08.000Z
23.666667
70
0.743662
10,918
package com.citytechinc.cq.component.dialog.exception; public class InvalidComponentClassException extends Exception { private static final long serialVersionUID = 7680073500861821616L; public InvalidComponentClassException() { super(); } public InvalidComponentClassException(String message) { super(message); } }
3e19bd979d8e033b92734a35d176daac5919d00d
8,085
java
Java
gms-common/java/gms/shared/mechanisms/object-storage-distribution/osd-signaldetection-repository-service/src/test/java/gms/shared/mechanisms/objectstoragedistribution/coi/signaldetection/service/handlers/ChannelProcessingGroupRouteHandlerTests.java
SNL-GMS/GMS-PI7-OPEN
4c5f2a33a45566b12897bcdc129609c9e6b95442
[ "BSD-3-Clause" ]
5
2020-01-20T14:53:11.000Z
2021-11-30T23:01:08.000Z
gms-common/java/gms/shared/mechanisms/object-storage-distribution/osd-signaldetection-repository-service/src/test/java/gms/shared/mechanisms/objectstoragedistribution/coi/signaldetection/service/handlers/ChannelProcessingGroupRouteHandlerTests.java
SNL-GMS/GMS-PI7-OPEN
4c5f2a33a45566b12897bcdc129609c9e6b95442
[ "BSD-3-Clause" ]
7
2019-12-30T06:08:08.000Z
2022-03-02T06:38:09.000Z
gms-common/java/gms/shared/mechanisms/object-storage-distribution/osd-signaldetection-repository-service/src/test/java/gms/shared/mechanisms/objectstoragedistribution/coi/signaldetection/service/handlers/ChannelProcessingGroupRouteHandlerTests.java
SNL-GMS/GMS-PI7-OPEN
4c5f2a33a45566b12897bcdc129609c9e6b95442
[ "BSD-3-Clause" ]
1
2019-12-10T19:37:03.000Z
2019-12-10T19:37:03.000Z
36.255605
119
0.748547
10,919
package gms.shared.mechanisms.objectstoragedistribution.coi.signaldetection.service.handlers; import static org.hamcrest.CoreMatchers.both; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.doNothing; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.never; import static org.mockito.BDDMockito.times; import static org.mockito.BDDMockito.verify; import static org.mockito.BDDMockito.when; import static org.mockito.Mockito.reset; import com.fasterxml.jackson.databind.JavaType; import gms.shared.mechanisms.objectstoragedistribution.coi.common.TestUtilities; import gms.shared.mechanisms.objectstoragedistribution.coi.signaldetection.commonobjects.ChannelProcessingGroup; import gms.shared.mechanisms.objectstoragedistribution.coi.signaldetection.commonobjects.ChannelProcessingGroupType; import gms.shared.mechanisms.objectstoragedistribution.coi.signaldetection.repository.ChannelProcessingGroupRepository; import gms.shared.mechanisms.objectstoragedistribution.coi.signaldetection.service.testUtilities.TestFixtures; import gms.shared.mechanisms.objectstoragedistribution.coi.signaldetection.service.util.ObjectSerialization; import java.time.Instant; import java.util.HashMap; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.UUID; import org.eclipse.jetty.http.HttpStatus; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import spark.Request; import spark.Response; @RunWith(MockitoJUnitRunner.class) public class ChannelProcessingGroupRouteHandlerTests { private static ArgumentCaptor<ChannelProcessingGroup> sigDetArgumentCaptor = ArgumentCaptor.forClass(ChannelProcessingGroup.class); private static ChannelProcessingGroupRepository repository = Mockito.mock(ChannelProcessingGroupRepository.class); private static ChannelProcessingGroupRouteHandlers handlers; private static JavaType mapUuidToSigDetsJavaType; private static JavaType sigDetsListType; static { JavaType uuidType = TestFixtures.objectMapper.constructType(UUID.class); sigDetsListType = TestFixtures.objectMapper.getTypeFactory().constructCollectionType( List.class, ChannelProcessingGroup.class); mapUuidToSigDetsJavaType = TestFixtures.objectMapper.getTypeFactory().constructMapType( HashMap.class, uuidType, sigDetsListType); } @Rule public final ExpectedException exception = ExpectedException.none(); @Mock private Request request; @Mock private Response response; @BeforeClass public static void setupHandlers() { handlers = ChannelProcessingGroupRouteHandlers.create(repository); } @Before public void setUp() throws Exception { reset(repository); } @Test public void testCreateNullParameterThrowsNullPointerException() { exception.expect(NullPointerException.class); ChannelProcessingGroupRouteHandlers.create(null); } @Test public void testGetChannelProcessingGroupValidatesNullValues() throws IllegalAccessException { TestUtilities.checkMethodValidatesNullArguments(handlers, "getChannelProcessingGroup", request, response); } @Test public void testGetChannelProcessingGroupBadAcceptReturnsError406() throws Exception{ given(request.params(":id")) .willReturn(UUID.randomUUID().toString()); String responseBody = handlers.getChannelProcessingGroup(request, response); assertThat(responseBody, containsString("406")); verify(response, times(1)).status(406); } @Test public void testGetChannelProcessingGroupNoIdParameterReturnsAll() throws Exception { UUID testId = UUID.randomUUID(); List<ChannelProcessingGroup> expected = List.of( ChannelProcessingGroup.from( UUID.randomUUID(), ChannelProcessingGroupType.BEAM, Set.of(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()), Instant.EPOCH, Instant.EPOCH, "good", "status is good" ) ); given(request.headers("Accept")).willReturn("application/json"); given(request.params(":id")) .willReturn(null); given(repository.retrieveAll()).willReturn(expected); String actual = handlers.getChannelProcessingGroup(request, response); assertThat(actual, is(both(notNullValue()).and(equalTo(ObjectSerialization.writeValue(expected))))); verify(repository, times(1)).retrieveAll(); } @Test public void testGetSignalDetectionWithIdNotFoundReturnsNullString() throws Exception { given(request.headers("Accept")).willReturn("application/json"); given(request.params(":id")) .willReturn(UUID.randomUUID().toString()); given(repository.retrieve(any())) .willReturn(Optional.empty()); String actual = handlers.getChannelProcessingGroup(request, response); //Jackson serialization converts an empty optional to "null" assertThat(actual, is(both(notNullValue()).and(equalTo("null")))); } @Test public void testGetSignalDetectionWithIdReturnsSingleSignalDetection() throws Exception { UUID testId = UUID.randomUUID(); ChannelProcessingGroup expected = ChannelProcessingGroup.from( testId, ChannelProcessingGroupType.BEAM, Set.of(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()), Instant.EPOCH, Instant.EPOCH, "good", "status is good" ); given(repository.retrieve(testId)) .willReturn(Optional.of(expected)); given(request.headers("Accept")).willReturn("application/json"); given(request.params(":id")) .willReturn(testId.toString()); String actual = handlers.getChannelProcessingGroup(request, response); assertThat(actual, is(both(notNullValue()).and(equalTo(ObjectSerialization.writeValue(expected))))); verify(repository, times(1)).retrieve(testId); verify(repository, never()).retrieveAll(); } @Test public void testStoreSignalDetectionsFromArray() throws Exception { List<ChannelProcessingGroup> expected = List.of( ChannelProcessingGroup.from( UUID.randomUUID(), ChannelProcessingGroupType.BEAM, Set.of(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()), Instant.EPOCH, Instant.EPOCH, "good", "status is good" ), ChannelProcessingGroup.from( UUID.randomUUID(), ChannelProcessingGroupType.BEAM, Set.of(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()), Instant.EPOCH, Instant.EPOCH, "bad", "status is bad" ) ); doNothing().when(repository).createChannelProcessingGroup(sigDetArgumentCaptor.capture()); given(request.body()).willReturn(TestFixtures.objectMapper.writeValueAsString( expected)); when(response.status()).thenReturn(HttpStatus.OK_200); String serviceResponse = handlers.storeChannelProcessingGroups( request, response); assertEquals("", serviceResponse); assertEquals(expected, sigDetArgumentCaptor.getAllValues()); assertEquals(HttpStatus.OK_200, response.status()); } @Test public void testNullParametersForSignalDetectionArrayStore() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("Cannot store null channel processing groups"); given(request.body()).willReturn(null); handlers.storeChannelProcessingGroups( request, response); } }
3e19bdb4b183426bbd05b03aaf248868d838a046
2,661
java
Java
apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/impl/AbstractObjectPool.java
golino/apm-agent-java
71251b5af4e886f125df2d349254dd0d75454498
[ "Apache-2.0" ]
496
2018-02-24T01:52:00.000Z
2022-03-20T16:39:36.000Z
apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/impl/AbstractObjectPool.java
golino/apm-agent-java
71251b5af4e886f125df2d349254dd0d75454498
[ "Apache-2.0" ]
2,324
2018-03-08T19:15:38.000Z
2022-03-31T21:06:29.000Z
apm-agent-core/src/main/java/co/elastic/apm/agent/objectpool/impl/AbstractObjectPool.java
hectorespert/apm-agent-java
aa9bdd0895a376d80f4d05b0fd9cefc573817480
[ "Apache-2.0" ]
280
2018-02-26T08:05:49.000Z
2022-03-22T07:06:01.000Z
33.2625
101
0.695979
10,920
/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. 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 co.elastic.apm.agent.objectpool.impl; import co.elastic.apm.agent.objectpool.Allocator; import co.elastic.apm.agent.objectpool.ObjectPool; import co.elastic.apm.agent.objectpool.Resetter; import javax.annotation.Nullable; import java.util.concurrent.atomic.AtomicInteger; public abstract class AbstractObjectPool<T> implements ObjectPool<T> { protected final Allocator<T> allocator; protected final Resetter<T> resetter; private final AtomicInteger garbageCreated; protected AbstractObjectPool(Allocator<T> allocator, Resetter<T> resetter) { this.allocator = allocator; this.resetter = resetter; this.garbageCreated = new AtomicInteger(); } @Override public final T createInstance() { T object = tryCreateInstance(); if (object == null) { // pool does not have available instance, falling back to creating a new one object = allocator.createInstance(); } return object; } @Override public final void recycle(T obj) { resetter.recycle(obj); if (!returnToPool(obj)) { // when not able to return object to pool, it means this object will be garbage-collected garbageCreated.incrementAndGet(); } } @Override public final long getGarbageCreated() { return garbageCreated.longValue(); } /** * Pushes object reference back into the available pooled instances * * @param obj recycled object to return to pool * @return true if object has been returned to pool, false if pool is already full */ abstract protected boolean returnToPool(T obj); /** * Tries to create an instance in pool * * @return {@code null} if pool capacity is exhausted */ @Nullable abstract protected T tryCreateInstance(); }
3e19bdce838662685e4b91161ce8531799752a6b
2,106
java
Java
components/org.wso2.carbon.consent.mgt.ui/src/main/java/org/wso2/carbon/consent/mgt/ui/dto/PiiCategoryDTO.java
tharindu1st/carbon-consent-management
29afc5ac4e94ccf031a0b50c3b3b65d75e3a3479
[ "Apache-2.0" ]
5
2018-05-16T20:15:14.000Z
2022-03-22T07:29:14.000Z
components/org.wso2.carbon.consent.mgt.ui/src/main/java/org/wso2/carbon/consent/mgt/ui/dto/PiiCategoryDTO.java
tharindu1st/carbon-consent-management
29afc5ac4e94ccf031a0b50c3b3b65d75e3a3479
[ "Apache-2.0" ]
39
2018-02-04T16:05:24.000Z
2022-03-12T05:46:28.000Z
components/org.wso2.carbon.consent.mgt.ui/src/main/java/org/wso2/carbon/consent/mgt/ui/dto/PiiCategoryDTO.java
tharindu1st/carbon-consent-management
29afc5ac4e94ccf031a0b50c3b3b65d75e3a3479
[ "Apache-2.0" ]
62
2018-01-10T09:38:15.000Z
2022-02-25T04:53:09.000Z
21.272727
99
0.646249
10,921
/* * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) 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.wso2.carbon.consent.mgt.ui.dto; public class PiiCategoryDTO { private int id; private String name; private String displayName; private String description; private boolean mandatory; public PiiCategoryDTO(String name) { this.name = name; } public PiiCategoryDTO(String name, String displayName, String description, boolean mandatory) { this.name = name; this.displayName = displayName; this.description = description; this.mandatory = mandatory; } public PiiCategoryDTO(int id) { this.id = id; } public PiiCategoryDTO(int id, String name) { this.id = id; this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public boolean isMandatory() { return mandatory; } public void setMandatory(boolean mandatory) { this.mandatory = mandatory; } }
3e19bf430d2c6d28ee05ffaf12833b436b5c633f
332
java
Java
src/main/java/quiz1/question9/Answer1.java
rhanneken/oracle-mooc-lambdas-streams-quiz1-question9
0ab63558465c0b632afcd62391ca3a6f111d17f7
[ "Unlicense" ]
null
null
null
src/main/java/quiz1/question9/Answer1.java
rhanneken/oracle-mooc-lambdas-streams-quiz1-question9
0ab63558465c0b632afcd62391ca3a6f111d17f7
[ "Unlicense" ]
null
null
null
src/main/java/quiz1/question9/Answer1.java
rhanneken/oracle-mooc-lambdas-streams-quiz1-question9
0ab63558465c0b632afcd62391ca3a6f111d17f7
[ "Unlicense" ]
null
null
null
16.6
58
0.683735
10,922
package quiz1.question9; import java.util.List; /** * <code>l.replace(Integer::hashCode)</code> */ public class Answer1 extends Answer { @Override protected void replaceAllWithHashCode(List<Integer> l) { l.replace(Integer::hashCode); } public static void main(String[] args) { new Answer1().validate(); } }
3e19bf8da0cb97eb15fe92796551139692fdca0d
3,163
java
Java
src/main/java/org/xmlet/xsdparser/xsdelements/XsdList.java
Wael-Fathallah/XsdParser
7816ccf3ab7f55210adad5b1c8a0ce5715d54dfe
[ "MIT" ]
52
2018-07-31T07:17:19.000Z
2022-02-11T21:33:15.000Z
src/main/java/org/xmlet/xsdparser/xsdelements/XsdList.java
Wael-Fathallah/XsdParser
7816ccf3ab7f55210adad5b1c8a0ce5715d54dfe
[ "MIT" ]
35
2018-08-01T06:34:42.000Z
2021-12-18T13:20:21.000Z
src/main/java/org/xmlet/xsdparser/xsdelements/XsdList.java
Wael-Fathallah/XsdParser
7816ccf3ab7f55210adad5b1c8a0ce5715d54dfe
[ "MIT" ]
30
2018-10-30T14:05:19.000Z
2022-01-22T23:13:02.000Z
37.211765
178
0.72779
10,923
package org.xmlet.xsdparser.xsdelements; import org.xmlet.xsdparser.core.XsdParserCore; import org.xmlet.xsdparser.core.utils.ParseData; import org.xmlet.xsdparser.xsdelements.elementswrapper.ReferenceBase; import org.xmlet.xsdparser.xsdelements.elementswrapper.UnsolvedReference; import org.xmlet.xsdparser.xsdelements.visitors.XsdAbstractElementVisitor; import javax.validation.constraints.NotNull; import java.util.Map; import java.util.function.Function; /** * A class representing the xsd:list element. * * @see <a href="https://www.w3schools.com/xml/el_list.asp">xsd:list description and usage at w3c</a> */ public class XsdList extends XsdAnnotatedElements { public static final String XSD_TAG = "xsd:list"; public static final String XS_TAG = "xs:list"; /** * The {@link XsdSimpleType} instance that states the type of the elements that belong to this {@link XsdList} * instance. This value shouldn't be present if there is a {@link XsdList#itemType} present. */ private XsdSimpleType simpleType; /** * The itemType defines the built-it type or the name of a present {@link XsdSimpleType} instance that represent * the type of the elements that belong to this {@link XsdList}. This value shouldn't be present if there is a * {@link XsdList#simpleType} is present. */ private String itemType; private XsdList(@NotNull XsdParserCore parser, @NotNull Map<String, String> attributesMap, @NotNull Function<XsdAbstractElement, XsdAbstractElementVisitor> visitorFunction) { super(parser, attributesMap, visitorFunction); this.itemType = attributesMap.getOrDefault(ITEM_TYPE_TAG, itemType); } @Override public void accept(XsdAbstractElementVisitor visitorParam) { super.accept(visitorParam); visitorParam.visit(this); } /** * Performs a copy of the current object for replacing purposes. The cloned objects are used to replace * {@link UnsolvedReference} objects in the reference solving process. * @param placeHolderAttributes The additional attributes to add to the clone. * @return A copy of the object from which is called upon. */ @Override public XsdList clone(@NotNull Map<String, String> placeHolderAttributes) { placeHolderAttributes.putAll(attributesMap); XsdList elementCopy = new XsdList(this.parser, placeHolderAttributes, visitorFunction); if (this.simpleType != null){ elementCopy.simpleType = (XsdSimpleType) this.simpleType.clone(simpleType.getAttributesMap(), elementCopy); } elementCopy.parent = null; return elementCopy; } public static ReferenceBase parse(@NotNull ParseData parseData){ return xsdParseSkeleton(parseData.node, new XsdList(parseData.parserInstance, convertNodeMap(parseData.node.getAttributes()), parseData.visitorFunction)); } public XsdSimpleType getXsdSimpleType() { return simpleType; } public String getItemType() { return itemType; } public void setSimpleType(XsdSimpleType simpleType) { this.simpleType = simpleType; } }
3e19c06a199ac716ed756e80d8f5c54ea79ba194
4,380
java
Java
sdk/storageimportexport/azure-resourcemanager-storageimportexport/src/main/java/com/azure/resourcemanager/storageimportexport/fluent/models/OperationInner.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
1,350
2015-01-17T05:22:05.000Z
2022-03-29T21:00:37.000Z
sdk/storageimportexport/azure-resourcemanager-storageimportexport/src/main/java/com/azure/resourcemanager/storageimportexport/fluent/models/OperationInner.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
16,834
2015-01-07T02:19:09.000Z
2022-03-31T23:29:10.000Z
sdk/storageimportexport/azure-resourcemanager-storageimportexport/src/main/java/com/azure/resourcemanager/storageimportexport/fluent/models/OperationInner.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
1,586
2015-01-02T01:50:28.000Z
2022-03-31T11:25:34.000Z
27.037037
108
0.639269
10,924
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.storageimportexport.fluent.models; import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Describes a supported operation by the Storage Import/Export job API. */ @JsonFlatten @Fluent public class OperationInner { @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); /* * Name of the operation. */ @JsonProperty(value = "name", required = true) private String name; /* * The resource provider name to which the operation belongs. */ @JsonProperty(value = "display.provider") private String provider; /* * The name of the resource to which the operation belongs. */ @JsonProperty(value = "display.resource") private String resource; /* * The display name of the operation. */ @JsonProperty(value = "display.operation") private String operation; /* * Short description of the operation. */ @JsonProperty(value = "display.description") private String description; /** * Get the name property: Name of the operation. * * @return the name value. */ public String name() { return this.name; } /** * Set the name property: Name of the operation. * * @param name the name value to set. * @return the OperationInner object itself. */ public OperationInner withName(String name) { this.name = name; return this; } /** * Get the provider property: The resource provider name to which the operation belongs. * * @return the provider value. */ public String provider() { return this.provider; } /** * Set the provider property: The resource provider name to which the operation belongs. * * @param provider the provider value to set. * @return the OperationInner object itself. */ public OperationInner withProvider(String provider) { this.provider = provider; return this; } /** * Get the resource property: The name of the resource to which the operation belongs. * * @return the resource value. */ public String resource() { return this.resource; } /** * Set the resource property: The name of the resource to which the operation belongs. * * @param resource the resource value to set. * @return the OperationInner object itself. */ public OperationInner withResource(String resource) { this.resource = resource; return this; } /** * Get the operation property: The display name of the operation. * * @return the operation value. */ public String operation() { return this.operation; } /** * Set the operation property: The display name of the operation. * * @param operation the operation value to set. * @return the OperationInner object itself. */ public OperationInner withOperation(String operation) { this.operation = operation; return this; } /** * Get the description property: Short description of the operation. * * @return the description value. */ public String description() { return this.description; } /** * Set the description property: Short description of the operation. * * @param description the description value to set. * @return the OperationInner object itself. */ public OperationInner withDescription(String description) { this.description = description; return this; } /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (name() == null) { throw logger .logExceptionAsError( new IllegalArgumentException("Missing required property name in model OperationInner")); } } }
3e19c2080704a857db78e8caba0cfeeea2b9b6a8
208
java
Java
src/main/java/info/pascalkrause/vertx/datacollector/service/package-info.java
caspal/vertx-datacollecor
740ef44b772d177dab347c14c3cd62643cedf076
[ "MIT" ]
1
2019-01-09T11:48:18.000Z
2019-01-09T11:48:18.000Z
src/main/java/info/pascalkrause/vertx/datacollector/service/package-info.java
caspal/vertx-datacollecor
740ef44b772d177dab347c14c3cd62643cedf076
[ "MIT" ]
null
null
null
src/main/java/info/pascalkrause/vertx/datacollector/service/package-info.java
caspal/vertx-datacollecor
740ef44b772d177dab347c14c3cd62643cedf076
[ "MIT" ]
null
null
null
52
105
0.831731
10,925
@ModuleGen(groupPackage = "info.pascalkrause.vertx.datacollector.service", name = "datacollector-module") package info.pascalkrause.vertx.datacollector.service; import io.vertx.codegen.annotations.ModuleGen;
3e19c2bb2cdac5f8d13b130ec9327320882d5a3b
158
java
Java
slovoed/libraries/toolbar_manager_api/lib/src/main/java/com/paragon_software/toolbar_manager/ToolbarControllerType.java
ilius/paragon_slovoed_ce
a85d8c7a5cabee5f30fc7403fa44b6ed7022d430
[ "BSD-3-Clause-Clear" ]
5
2020-09-11T15:55:39.000Z
2021-11-12T19:11:35.000Z
slovoed/libraries/toolbar_manager_api/lib/src/main/java/com/paragon_software/toolbar_manager/ToolbarControllerType.java
ilius/paragon_slovoed_ce
a85d8c7a5cabee5f30fc7403fa44b6ed7022d430
[ "BSD-3-Clause-Clear" ]
null
null
null
slovoed/libraries/toolbar_manager_api/lib/src/main/java/com/paragon_software/toolbar_manager/ToolbarControllerType.java
ilius/paragon_slovoed_ce
a85d8c7a5cabee5f30fc7403fa44b6ed7022d430
[ "BSD-3-Clause-Clear" ]
3
2020-09-30T17:00:24.000Z
2021-12-10T07:27:56.000Z
22.571429
71
0.835443
10,926
package com.paragon_software.toolbar_manager; public class ToolbarControllerType { public static final String DEFAULT_CONTROLLER = "DEFAULT_CONTROLLER"; }
3e19c37dfd88417a6d03ba4f8a46afdcf62fc3e4
3,737
java
Java
app/src/main/java/cn/mw/growthhacker/activity/App.java
snailflying/GrowthHacker
e1b312c484c28b69ee597e1ce632452ca93897da
[ "Apache-2.0" ]
null
null
null
app/src/main/java/cn/mw/growthhacker/activity/App.java
snailflying/GrowthHacker
e1b312c484c28b69ee597e1ce632452ca93897da
[ "Apache-2.0" ]
null
null
null
app/src/main/java/cn/mw/growthhacker/activity/App.java
snailflying/GrowthHacker
e1b312c484c28b69ee597e1ce632452ca93897da
[ "Apache-2.0" ]
null
null
null
29.425197
103
0.611721
10,927
package cn.mw.growthhacker.activity; import android.app.Application; import android.util.Log; import com.zxinsight.MWConfiguration; import com.zxinsight.MagicWindowSDK; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import cn.mw.growthhacker.Config; import cn.mw.growthhacker.utils.AppPrefs; /** * Created by aaron on 16/9/15. */ public class App extends Application { private static App mInstance = null; private AppPrefs appPrefs; public static App getInstance() { return mInstance; } public void onCreate() { super.onCreate(); mInstance = this; appPrefs = AppPrefs.get(mInstance); initMW(); initJson(); // initImageLoader(getApplicationContext()); } /** * 初始化json,如果网络出现问题,取本地的json */ private void initJson() { List<String> list = new ArrayList<String>(); // list.add(Config.businessList); // list.add(Config.o2oList); // list.add(Config.newsList); // list.add(Config.picList); // list.add(Config.travelList); list.add(Config.shopDetail); list.add(Config.o2oDetail); list.add(Config.travelDetail); for (final String path : list) { initAssetsJson(path); } } // public static void initImageLoader(Context context) { // DisplayImageOptions option = new DisplayImageOptions.Builder() // .cacheInMemory(true) // .cacheOnDisk(true) // .bitmapConfig(Bitmap.Config.RGB_565) // .imageScaleType(ImageScaleType.EXACTLY) // .build(); // // ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context); // config.threadPriority(Thread.NORM_PRIORITY - 2); // config.denyCacheImageMultipleSizesInMemory(); // config.diskCacheFileNameGenerator(new Md5FileNameGenerator()); // config.diskCacheSize(50 * 1024 * 1024); // 50 MiB // config.tasksProcessingOrder(QueueProcessingType.LIFO); // config.defaultDisplayImageOptions(option); //// config.writeDebugLogs(); // Remove for release app // // // Initialize ImageLoader with configuration. // ImageLoader.getInstance().init(config.build()); // } //@mw 初始化魔窗 private void initMW() { long t1 = System.currentTimeMillis(); MWConfiguration config = new MWConfiguration(this); long t2 = System.currentTimeMillis(); config.setChannel("魔窗") //todo:del debug model // .setLogEnable(true) .setPageTrackWithFragment(true) .setSharePlatform(MWConfiguration.ORIGINAL); long t3 = System.currentTimeMillis(); MagicWindowSDK.initSDK(config); long t4 = System.currentTimeMillis(); long time = t2 - t1; long time1 = t3 - t2; long time2 = t4 - t3; long time3 = t4 - t1; Log.e("aaron", "time = " + time + ",time1 = " + time1 + ",time2 = " + time2 + ",time3 = " + time3); } private void initAssetsJson(String path) { if (appPrefs != null) appPrefs.saveJson(path, getFromAssets(path)); } //从assets 文件夹中获取文件并读取数据 private String getFromAssets(String fileName) { String result = ""; try { InputStream in = mInstance.getResources().getAssets().open(fileName); //获取文件的字节数 int lenght = in.available(); //创建byte数组 byte[] buffer = new byte[lenght]; //将文件中的数据读到byte数组中 in.read(buffer); result = new String(buffer, "UTF-8"); in.close(); } catch (Exception e) { e.printStackTrace(); } return result; } }
3e19c4001d90e9d67ac4ff2ec62c03b41b8bf71b
803
java
Java
Dataset/Leetcode/train/22/544.java
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/22/544.java
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/22/544.java
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
27.689655
83
0.530511
10,928
class Solution { public List<String> XXX(int n) { List<String> res = new ArrayList<>(); backTrack(n,n,new StringBuilder(),res); return res; } public void backTrack(int left,int right,StringBuilder track,List<String> res){ if(left<0 || right<0){ return; } if(left>right){ return; //已使用的左括号数量必须小于等于有括号,否则是非法的括号。 } if(left == 0 && right==0){ res.add(track.toString()); //括号全部生成,加入结果集 return; } track.append("("); //先左 backTrack(left-1,right,track,res); track.deleteCharAt(track.length()-1); //回溯算法记得取消本次选择。 track.append(")"); //后右 backTrack(left,right-1,track,res); track.deleteCharAt(track.length()-1); } }
3e19c663ff11222bb5f3defe2a8cc21228eb87d8
507
java
Java
src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParameterForPropertyValuesFromOrangeGroup.java
nimble-platform/catalog-search-service
256abd69693cc19f277cf1589e6d3a90d1fc3ad2
[ "Apache-2.0" ]
4
2017-07-06T05:07:06.000Z
2019-03-18T17:11:37.000Z
src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParameterForPropertyValuesFromOrangeGroup.java
nimble-platform/catalog-search-service
256abd69693cc19f277cf1589e6d3a90d1fc3ad2
[ "Apache-2.0" ]
6
2018-02-07T07:13:35.000Z
2018-06-22T07:28:19.000Z
src/main/java/eu/nimble/service/catalog/search/impl/dao/input/InputParameterForPropertyValuesFromOrangeGroup.java
nimble-platform/catalog-search-service
256abd69693cc19f277cf1589e6d3a90d1fc3ad2
[ "Apache-2.0" ]
2
2019-03-18T17:11:41.000Z
2020-04-03T03:51:13.000Z
20.28
62
0.74359
10,929
package eu.nimble.service.catalog.search.impl.dao.input; public class InputParameterForPropertyValuesFromOrangeGroup { public String conceptURL; public String orangeCommand; public String getConceptURL() { return conceptURL; } public void setConceptURL(String conceptURL) { this.conceptURL = conceptURL; } public String getOrangeCommand() { return orangeCommand; } public void setOrangeCommand(String orangeCommand) { this.orangeCommand = orangeCommand; } }
3e19c6b80f4dee9bf533da5fe9da1a299e1e18d4
404
java
Java
src/main/java/com/qaprosoft/carina/demo/api/PosttokenMethods.java
Priyanka1691/Atlas_Demo
98a143b0a71a4422e620b1966619846ea754d54a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/qaprosoft/carina/demo/api/PosttokenMethods.java
Priyanka1691/Atlas_Demo
98a143b0a71a4422e620b1966619846ea754d54a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/qaprosoft/carina/demo/api/PosttokenMethods.java
Priyanka1691/Atlas_Demo
98a143b0a71a4422e620b1966619846ea754d54a
[ "Apache-2.0" ]
null
null
null
31.076923
78
0.764851
10,930
package com.qaprosoft.carina.demo.api; import com.qaprosoft.carina.core.foundation.api.AbstractApiMethodV2; import com.qaprosoft.carina.core.foundation.utils.Configuration; public class PosttokenMethods extends AbstractApiMethodV2 { public PosttokenMethods() { super(null,null ); replaceUrlPlaceholder("base_url", Configuration.getEnvArg("api_url")); } } //"api/uidpwd/rs.json"
3e19c6f86e23ab22671f64129364e7ab2f9e7b0b
214
java
Java
KosmosToolkit/src/main/java/cos/mos/toolkit/listener/NormalIntListener.java
KosmoSakura/KosmosToolkit
2a00daee23ee496a4a460d4d0ca22a6bf4603f10
[ "Apache-2.0" ]
21
2019-04-25T02:59:50.000Z
2021-07-12T13:12:59.000Z
KosmosToolkit/src/main/java/cos/mos/toolkit/listener/NormalIntListener.java
KosmoSakura/KosmosUtils
2a00daee23ee496a4a460d4d0ca22a6bf4603f10
[ "Apache-2.0" ]
1
2019-04-12T01:48:55.000Z
2019-04-12T03:18:21.000Z
KosmosToolkit/src/main/java/cos/mos/toolkit/listener/NormalIntListener.java
KosmoSakura/KosmosUtils
2a00daee23ee496a4a460d4d0ca22a6bf4603f10
[ "Apache-2.0" ]
4
2019-06-19T08:00:35.000Z
2020-07-28T12:28:15.000Z
18.166667
36
0.715596
10,931
package cos.mos.toolkit.listener; /** * @Description 一般的Int类型结果监听 * @Author Kosmos * @Date 2020.06.02 16:18 * @Email dycjh@example.com */ public interface NormalIntListener { void onResult(int result); }
3e19c7155e42fde739cfb79644c501bd557db6e0
7,634
java
Java
engine/src/main/java/org/camunda/bpm/engine/impl/OptimizeService.java
mrFranklin/camunda-bpm-platform
7c5bf37307d3eeac3aee5724b6e4669a9992eaba
[ "Apache-2.0" ]
2,577
2015-01-02T07:43:55.000Z
2022-03-31T22:31:45.000Z
engine/src/main/java/org/camunda/bpm/engine/impl/OptimizeService.java
mrFranklin/camunda-bpm-platform
7c5bf37307d3eeac3aee5724b6e4669a9992eaba
[ "Apache-2.0" ]
839
2015-01-12T22:06:28.000Z
2022-03-24T13:26:29.000Z
engine/src/main/java/org/camunda/bpm/engine/impl/OptimizeService.java
mrFranklin/camunda-bpm-platform
7c5bf37307d3eeac3aee5724b6e4669a9992eaba
[ "Apache-2.0" ]
1,270
2015-01-02T03:39:25.000Z
2022-03-31T06:04:37.000Z
53.013889
108
0.63191
10,932
/* * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH * under one or more contributor license agreements. See the NOTICE file * distributed with this work for additional information regarding copyright * ownership. Camunda licenses this file to you under the Apache License, * Version 2.0; 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.camunda.bpm.engine.impl; import org.camunda.bpm.engine.history.HistoricActivityInstance; import org.camunda.bpm.engine.history.HistoricDecisionInstance; import org.camunda.bpm.engine.history.HistoricProcessInstance; import org.camunda.bpm.engine.history.HistoricTaskInstance; import org.camunda.bpm.engine.history.HistoricVariableUpdate; import org.camunda.bpm.engine.history.UserOperationLogEntry; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeCompletedHistoricActivityInstanceQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeCompletedHistoricIncidentsQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeCompletedHistoricProcessInstanceQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeCompletedHistoricTaskInstanceQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeHistoricDecisionInstanceQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeHistoricIdentityLinkLogQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeHistoricUserOperationsLogQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeHistoricVariableUpdateQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeOpenHistoricIncidentsQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeRunningHistoricActivityInstanceQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeRunningHistoricProcessInstanceQueryCmd; import org.camunda.bpm.engine.impl.cmd.optimize.OptimizeRunningHistoricTaskInstanceQueryCmd; import org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity; import org.camunda.bpm.engine.impl.persistence.entity.optimize.OptimizeHistoricIdentityLinkLogEntity; import java.util.Date; import java.util.List; public class OptimizeService extends ServiceImpl { public List<HistoricActivityInstance> getCompletedHistoricActivityInstances(Date finishedAfter, Date finishedAt, int maxResults) { return commandExecutor.execute( new OptimizeCompletedHistoricActivityInstanceQueryCmd(finishedAfter, finishedAt, maxResults) ); } public List<HistoricActivityInstance> getRunningHistoricActivityInstances(Date startedAfter, Date startedAt, int maxResults) { return commandExecutor.execute( new OptimizeRunningHistoricActivityInstanceQueryCmd(startedAfter, startedAt, maxResults) ); } public List<HistoricTaskInstance> getCompletedHistoricTaskInstances(Date finishedAfter, Date finishedAt, int maxResults) { return commandExecutor.execute( new OptimizeCompletedHistoricTaskInstanceQueryCmd(finishedAfter, finishedAt, maxResults) ); } public List<HistoricTaskInstance> getRunningHistoricTaskInstances(Date startedAfter, Date startedAt, int maxResults) { return commandExecutor.execute( new OptimizeRunningHistoricTaskInstanceQueryCmd(startedAfter, startedAt, maxResults) ); } public List<UserOperationLogEntry> getHistoricUserOperationLogs(Date occurredAfter, Date occurredAt, int maxResults) { return commandExecutor.execute( new OptimizeHistoricUserOperationsLogQueryCmd(occurredAfter, occurredAt, maxResults) ); } public List<OptimizeHistoricIdentityLinkLogEntity> getHistoricIdentityLinkLogs(Date occurredAfter, Date occurredAt, int maxResults) { return commandExecutor.execute( new OptimizeHistoricIdentityLinkLogQueryCmd(occurredAfter, occurredAt, maxResults) ); } public List<HistoricProcessInstance> getCompletedHistoricProcessInstances(Date finishedAfter, Date finishedAt, int maxResults) { return commandExecutor.execute( new OptimizeCompletedHistoricProcessInstanceQueryCmd(finishedAfter, finishedAt, maxResults) ); } public List<HistoricProcessInstance> getRunningHistoricProcessInstances(Date startedAfter, Date startedAt, int maxResults) { return commandExecutor.execute( new OptimizeRunningHistoricProcessInstanceQueryCmd(startedAfter, startedAt, maxResults) ); } public List<HistoricVariableUpdate> getHistoricVariableUpdates(Date occurredAfter, Date occurredAt, boolean excludeObjectValues, int maxResults) { return commandExecutor.execute( new OptimizeHistoricVariableUpdateQueryCmd(occurredAfter, occurredAt, excludeObjectValues, maxResults) ); } public List<HistoricIncidentEntity> getCompletedHistoricIncidents(Date finishedAfter, Date finishedAt, int maxResults) { return commandExecutor.execute( new OptimizeCompletedHistoricIncidentsQueryCmd(finishedAfter, finishedAt, maxResults) ); } public List<HistoricIncidentEntity> getOpenHistoricIncidents(Date createdAfter, Date createdAt, int maxResults) { return commandExecutor.execute( new OptimizeOpenHistoricIncidentsQueryCmd(createdAfter, createdAt, maxResults) ); } public List<HistoricDecisionInstance> getHistoricDecisionInstances(Date evaluatedAfter, Date evaluatedAt, int maxResults) { return commandExecutor.execute( new OptimizeHistoricDecisionInstanceQueryCmd(evaluatedAfter, evaluatedAt, maxResults) ); } }
3e19c7d53c121e08e55f9b874e5e57e6dee4c723
14,482
java
Java
sdk/core/azure-core/src/main/java/com/azure/android/core/http/ServiceClient.java
sima-zhu/azure-sdk-for-android
ec7c2a2ae893ee6f26e36585e10f7c6d0e0080f3
[ "MIT" ]
1
2021-01-08T21:38:25.000Z
2021-01-08T21:38:25.000Z
sdk/core/azure-core/src/main/java/com/azure/android/core/http/ServiceClient.java
kammio89/azure-sdk-for-android
afadb246d79a1e7bb49525de390536573c184737
[ "MIT" ]
null
null
null
sdk/core/azure-core/src/main/java/com/azure/android/core/http/ServiceClient.java
kammio89/azure-sdk-for-android
afadb246d79a1e7bb49525de390536573c184737
[ "MIT" ]
null
null
null
38.110526
122
0.60993
10,933
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.android.core.http; import androidx.annotation.NonNull; import com.azure.android.core.internal.util.serializer.SerializerAdapter; import com.azure.android.core.internal.util.serializer.SerializerFormat; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.concurrent.TimeUnit; import okhttp3.ConnectionPool; import okhttp3.Dispatcher; import okhttp3.Interceptor; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.RequestBody; import okhttp3.ResponseBody; import okio.AsyncTimeout; import retrofit2.Converter; import retrofit2.Retrofit; /** * Type that stores information used to create REST API Client instances that share common resources such as an HTTP * connection pool, callback executor, etc. */ public class ServiceClient { private final OkHttpClient httpClient; private final Retrofit retrofit; private final ServiceClient.Builder builder; /** * PRIVATE CTR. * <p> * Creates ServiceClient. * * @param httpClient The HTTP client. * @param retrofit The Retrofit to create an API Client. * @param builder The builder. */ private ServiceClient(OkHttpClient httpClient, Retrofit retrofit, ServiceClient.Builder builder) { this.httpClient = httpClient; this.retrofit = retrofit; this.builder = builder; } /** * Gets this {@link ServiceClient}'s Retrofit instance, which can be used to create API Clients. * * @return The Retrofit instance. */ public Retrofit getRetrofit() { return this.retrofit; } /** * Gets a base URL that will be used for any API Client created using a configured Retrofit, which can be accessed * using {@link ServiceClient#getRetrofit()}. * * @return The Retrofit base URL. */ public String getBaseUrl() { return this.retrofit.baseUrl().toString(); } /** * The request or response content serializer adapter that will be used by any API Client created using a * configured Retrofit, which can be accessed using {@link ServiceClient#getRetrofit()}. * * @return The serializer adapter. */ public SerializerAdapter getSerializerAdapter() { return this.builder.serializerAdapter; } /** * @return A new builder with configurations copied from this {@link ServiceClient}. */ public ServiceClient.Builder newBuilder() { return new Builder(this); } /** * Close and release any resources reserved for the {@link ServiceClient}. */ public void close() { this.httpClient.dispatcher().executorService().shutdown(); this.httpClient.connectionPool().evictAll(); synchronized (this.httpClient.connectionPool()) { this.httpClient.connectionPool().notifyAll(); } synchronized (AsyncTimeout.class) { AsyncTimeout.class.notifyAll(); } } /** * A builder to configure and build a {@link ServiceClient}. */ public static final class Builder { private static MediaType XML_MEDIA_TYPE = MediaType.parse("application/xml; charset=UTF-8"); private static MediaType JSON_MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8"); private ConnectionPool connectionPool; private Dispatcher dispatcher; private Interceptor credentialsInterceptor; private OkHttpClient.Builder httpClientBuilder; private Retrofit.Builder retrofitBuilder; private SerializerFormat serializerFormat; private SerializerAdapter serializerAdapter; private String baseUrl; /** * Create a new {@link ServiceClient} builder. */ public Builder() { this(new OkHttpClient.Builder()); } /** * Create a new {@link ServiceClient} builder that uses a provided {@link OkHttpClient.Builder} for the * underlying {@link OkHttpClient}. * * @param httpClientBuilder {@link OkHttpClient.Builder} with initial configurations applied. */ public Builder(@NonNull OkHttpClient.Builder httpClientBuilder) { this.httpClientBuilder = httpClientBuilder; this.retrofitBuilder = new Retrofit.Builder(); } /** * PRIVATE CTR. * <p> * Create a builder with configurations copied from the given {@link ServiceClient}. * * @param serviceClient The service client to use as base. */ private Builder(final ServiceClient serviceClient) { this(serviceClient.httpClient.newBuilder()); this.httpClientBuilder.readTimeout(serviceClient.httpClient.readTimeoutMillis(), TimeUnit.MILLISECONDS); this.httpClientBuilder.connectTimeout(serviceClient.httpClient.connectTimeoutMillis(), TimeUnit.MILLISECONDS); this.httpClientBuilder.interceptors().clear(); this.httpClientBuilder.networkInterceptors().clear(); this.baseUrl = serviceClient.getBaseUrl(); this.serializerAdapter = serviceClient.builder.serializerAdapter; this.serializerFormat = serviceClient.builder.serializerFormat; for (Interceptor interceptor : serviceClient.httpClient.interceptors()) { if (interceptor != serviceClient.builder.credentialsInterceptor) { this.addInterceptor(interceptor); } } this.credentialsInterceptor = serviceClient.builder.credentialsInterceptor; for (Interceptor interceptor : serviceClient.httpClient.networkInterceptors()) { this.addNetworkInterceptor(interceptor); } } /** * Set the base URL for any API Client created through the configured Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param baseUrl The base url * @return Builder with base URL applied. */ public Builder setBaseUrl(@NonNull String baseUrl) { this.baseUrl = baseUrl; return this; } /** * Set the request or response content serialization format for any API Client created through the configured * Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param format The serialization format. * @return Builder with serialization format applied. */ public Builder setSerializationFormat(@NonNull SerializerFormat format) { this.serializerFormat = format; return this; } /** * Add an interceptor that gets called for authentication when invoking APIs using any API Client created * through the configured Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param credentialsInterceptor The credential interceptor. * @return Builder with credential interceptor applied. */ public Builder setCredentialsInterceptor(@NonNull Interceptor credentialsInterceptor) { this.credentialsInterceptor = credentialsInterceptor; return this; } /** * Add an interceptor that gets called when invoking APIs using any API Client created through the configured * Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param interceptor The interceptor. * @return Builder with interceptor applied. */ public Builder addInterceptor(@NonNull Interceptor interceptor) { this.httpClientBuilder.addInterceptor(interceptor); return this; } /** * Add a network interceptor that gets called when invoking APIs using any API Client created through the * configured Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param networkInterceptor The interceptor. * @return Builder with network interceptor applied. */ public Builder addNetworkInterceptor(@NonNull Interceptor networkInterceptor) { this.httpClientBuilder.addNetworkInterceptor(networkInterceptor); return this; } /** * Sets the read timeout for the API Client created through the configured Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param timeout The read timeout. * @param unit The timeout unit. * @return Builder with read timeout applied. */ public Builder setReadTimeout(long timeout, @NonNull TimeUnit unit) { this.httpClientBuilder.readTimeout(timeout, unit); return this; } /** * Sets the connection timeout for the API Client created through the configured Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param timeout The connection timeout. * @param unit The timeout unit. * @return Builder with connection timeout applied. */ public Builder setConnectionTimeout(long timeout, @NonNull TimeUnit unit) { this.httpClientBuilder.connectTimeout(timeout, unit); return this; } /** * Sets the pool providing connections for APIs invoked on any API Client created through the configured * Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param connectionPool The connection pool. * @return Builder with connection pool applied. */ public Builder setConnectionPool(@NonNull ConnectionPool connectionPool) { this.connectionPool = connectionPool; return this; } /** * Sets the dispatcher used by any API Client created through the configured Retrofit. * <p> * The configured Retrofit is accessed using {@link ServiceClient#getRetrofit()}. * * @param dispatcher The dispatcher. * @return Builder with dispatcher applied. */ public Builder setDispatcher(@NonNull Dispatcher dispatcher) { this.dispatcher = dispatcher; return this; } /** * @return A {@link ServiceClient} configured with settings applied through this builder. */ public ServiceClient build() { if (this.baseUrl == null) { throw new IllegalArgumentException("baseUrl must be set."); } if (!this.baseUrl.endsWith("/")) { this.baseUrl += "/"; } if (this.connectionPool != null) { this.httpClientBuilder.connectionPool(this.connectionPool); } if (this.dispatcher != null) { this.httpClientBuilder.dispatcher(this.dispatcher); } if (this.credentialsInterceptor != null) { this.httpClientBuilder.addInterceptor(this.credentialsInterceptor); } OkHttpClient httpClient = this.httpClientBuilder.build(); if (this.serializerFormat == null) { throw new IllegalArgumentException("Serialization format must be set."); } if (this.serializerAdapter == null) { this.serializerAdapter = SerializerAdapter.createDefault(); } Converter.Factory converterFactory = wrapSerializerInRetrofitConverter(this.serializerAdapter, this.serializerFormat); return new ServiceClient( httpClient, this.retrofitBuilder .baseUrl(this.baseUrl) .client(httpClient) // Use same executor instance for OkHttp and Retrofit callback. .callbackExecutor(httpClient.dispatcher().executorService()) .addConverterFactory(converterFactory) .build(), this); } /** * Given an azure-core {@link SerializerAdapter}, wrap it in a Retrofit {@link Converter} so that it can be * plugged into the Retrofit serialization-deserialization pipeline. * * @param serializer azure-core {@link SerializerAdapter}. * @param serializerFormat The serializer format. * @return A Retrofit {@link Converter}. */ private static Converter.Factory wrapSerializerInRetrofitConverter(SerializerAdapter serializer, final SerializerFormat serializerFormat) { return new Converter.Factory() { @Override public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { return value -> RequestBody.create( serializerFormat == SerializerFormat.XML ? XML_MEDIA_TYPE : JSON_MEDIA_TYPE, serializer.serialize(value, serializerFormat)); } @Override public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { return (Converter<ResponseBody, Object>) body -> serializer.deserialize(body.string(), type, serializerFormat); } }; } } }
3e19c80d9ff1a0ecaa0493af6fb0db9d6a03e971
3,362
java
Java
library/src/test/java/com/github/pwittchen/prefser/library/rx2/utils/RecordingObserver.java
ubuntudroid/prefser
f4d304048b538ef2e01a4ec8feda908b23075ff3
[ "Apache-2.0" ]
253
2015-02-22T13:03:38.000Z
2021-06-14T21:16:11.000Z
library/src/test/java/com/github/pwittchen/prefser/library/rx2/utils/RecordingObserver.java
ubuntudroid/prefser
f4d304048b538ef2e01a4ec8feda908b23075ff3
[ "Apache-2.0" ]
164
2015-02-22T17:50:24.000Z
2020-08-19T02:23:06.000Z
library/src/test/java/com/github/pwittchen/prefser/library/rx2/utils/RecordingObserver.java
ubuntudroid/prefser
f4d304048b538ef2e01a4ec8feda908b23075ff3
[ "Apache-2.0" ]
43
2015-02-26T08:51:19.000Z
2021-11-06T01:41:06.000Z
27.333333
83
0.693635
10,934
/* * Copyright (C) 2015 Jake Wharton * * 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.github.pwittchen.prefser.library.rx2.utils; import android.util.Log; import io.reactivex.Observer; import io.reactivex.annotations.NonNull; import io.reactivex.disposables.Disposable; import java.util.NoSuchElementException; import java.util.concurrent.BlockingDeque; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; import static com.google.common.truth.Truth.assertThat; /** * This class is taken from RxBinding (former NotRxAndroid) project by Jake Wharton * Original source of this file can be found at: * https://github.com/JakeWharton/RxBinding (former: NotRxAndroid) */ public final class RecordingObserver<T> implements Observer<T> { private static final String TAG = "RecordingObserver"; private final BlockingDeque<Object> events = new LinkedBlockingDeque<>(); @Override public void onError(Throwable e) { Log.v(TAG, "onError", e); events.addLast(new OnError(e)); } @Override public void onComplete() { Log.v(TAG, "onCompleted"); events.addLast(new OnCompleted()); } @Override public void onSubscribe(@NonNull Disposable d) { Log.v(TAG, "onSubscribe"); } @Override public void onNext(T t) { Log.v(TAG, "onNext " + t); events.addLast(new OnNext(t)); } private <E> E takeEvent(Class<E> wanted) { Object event; try { event = events.pollFirst(1, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } if (event == null) { throw new NoSuchElementException( "No event found while waiting for " + wanted.getSimpleName()); } assertThat(event).isInstanceOf(wanted); return wanted.cast(event); } public T takeNext() { OnNext event = takeEvent(OnNext.class); return event.value; } public Throwable takeError() { return takeEvent(OnError.class).throwable; } public void assertOnCompleted() { takeEvent(OnCompleted.class); } public void assertNoMoreEvents() { try { Object event = takeEvent(Object.class); throw new IllegalStateException("Expected no more events but got " + event); } catch (NoSuchElementException ignored) { } } private final class OnNext { final T value; private OnNext(T value) { this.value = value; } @Override public String toString() { return "OnNext[" + value + "]"; } } private final class OnCompleted { @Override public String toString() { return "OnCompleted"; } } private final class OnError { private final Throwable throwable; private OnError(Throwable throwable) { this.throwable = throwable; } @Override public String toString() { return "OnError[" + throwable + "]"; } } }
3e19c89741b51cb16d1ef0111b1fd5aacc484e90
510
java
Java
src/test/java/PageObjects/PaginaHome.java
LeticiaPeretti/Desafio_Mentoria_Banrisul
8a16516733e183872c915762d34ea88f7dcb4712
[ "MIT" ]
null
null
null
src/test/java/PageObjects/PaginaHome.java
LeticiaPeretti/Desafio_Mentoria_Banrisul
8a16516733e183872c915762d34ea88f7dcb4712
[ "MIT" ]
null
null
null
src/test/java/PageObjects/PaginaHome.java
LeticiaPeretti/Desafio_Mentoria_Banrisul
8a16516733e183872c915762d34ea88f7dcb4712
[ "MIT" ]
1
2021-03-08T05:26:22.000Z
2021-03-08T05:26:22.000Z
18.888889
89
0.737255
10,935
package PageObjects; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import Utilitarios.Esperas; public class PaginaHome { private WebDriver driver; public PaginaHome(WebDriver driver) { this.driver = driver; } public WebElement detalhaProduto() { return driver.findElement(By.xpath("//*[@id=\"homefeatured\"]/li[2]/div/div[2]/h5/a")); } public WebElement botaoCarrinho() { return driver.findElement(By.id("add_to_cart")); } }
3e19c8f4c41e5a817fd6cd264da181b8d708b120
875
java
Java
Task_Management_System_Java_Application/src/sample/ApprovedUser.java
muntasir-hossain314159/Task-Management-System
99d1046d7753ac97edf1b18dc89021483d9f82c2
[ "MIT" ]
1
2021-05-09T02:39:53.000Z
2021-05-09T02:39:53.000Z
Task_Management_System_Java_Application/src/sample/ApprovedUser.java
muntasir-hossain314159/Task-Management-System
99d1046d7753ac97edf1b18dc89021483d9f82c2
[ "MIT" ]
null
null
null
Task_Management_System_Java_Application/src/sample/ApprovedUser.java
muntasir-hossain314159/Task-Management-System
99d1046d7753ac97edf1b18dc89021483d9f82c2
[ "MIT" ]
1
2021-05-09T02:40:03.000Z
2021-05-09T02:40:03.000Z
19.444444
82
0.618286
10,936
package sample; //ApprovedUser class stores the data from a ResultSet in GetApprovedUserList class public class ApprovedUser { private int ID; private String username = null; private String password = null; //Constructor public ApprovedUser() {} //Constructor public ApprovedUser(int ID, String username, String password) { this.ID = ID; this.username = username; this.password = password; } public int getID() { return ID; } public void setID(int ID) { this.ID = ID; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
3e19c94499308a202b5bed8d2457d2054cd3afa4
1,789
java
Java
jpa/org.eclipse.persistence.jpa.jpql/src/org/eclipse/persistence/jpa/jpql/parser/TableExpression.java
brettdavidson3/eclipselink.runtime
a992a67ce49ca56117df4632c9c0c70938a0b28e
[ "BSD-3-Clause" ]
null
null
null
jpa/org.eclipse.persistence.jpa.jpql/src/org/eclipse/persistence/jpa/jpql/parser/TableExpression.java
brettdavidson3/eclipselink.runtime
a992a67ce49ca56117df4632c9c0c70938a0b28e
[ "BSD-3-Clause" ]
null
null
null
jpa/org.eclipse.persistence.jpa.jpql/src/org/eclipse/persistence/jpa/jpql/parser/TableExpression.java
brettdavidson3/eclipselink.runtime
a992a67ce49ca56117df4632c9c0c70938a0b28e
[ "BSD-3-Clause" ]
null
null
null
30.322034
101
0.634992
10,937
/******************************************************************************* * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * Oracle - initial API and implementation * ******************************************************************************/ package org.eclipse.persistence.jpa.jpql.parser; /** * Defines a table expression. This allow a non-mapped table to be used in a query. This is not part * of the JPA functional specification but is EclipseLink specific support. * <p> * <div nowrap><b>BNF:</b> <code>table_expression ::= TABLE(string_literal)</code> * <p> * * @version 2.5 * @since 2.4 * @author James Sutherland */ public final class TableExpression extends AbstractSingleEncapsulatedExpression { /** * Creates a new <code>TableExpression</code>. * * @param parent The parent of this expression */ public TableExpression(AbstractExpression parent) { super(parent, TABLE); } /** * {@inheritDoc} */ public void accept(ExpressionVisitor visitor) { acceptUnknownVisitor(visitor); } /** * {@inheritDoc} */ @Override public String getEncapsulatedExpressionQueryBNFId() { return StringLiteralBNF.ID; } /** * {@inheritDoc} */ public JPQLQueryBNF getQueryBNF() { return getQueryBNF(TableExpressionBNF.ID); } }
3e19c9c2664990a4ea78ea1205dd2d6872b74859
1,189
java
Java
nativerl-policy/src/test/java/ai/skymind/nativerl/ActionMaskProcessorTest.java
SkymindIO/nativerl
48f1a9897ca67fd892165818904fe8a33c5c19d4
[ "Apache-2.0" ]
3
2022-02-14T09:48:53.000Z
2022-02-20T15:06:01.000Z
nativerl-policy/src/test/java/ai/skymind/nativerl/ActionMaskProcessorTest.java
SkymindIO/nativerl
48f1a9897ca67fd892165818904fe8a33c5c19d4
[ "Apache-2.0" ]
1
2022-02-16T11:38:44.000Z
2022-02-16T19:33:42.000Z
nativerl-policy/src/test/java/ai/skymind/nativerl/ActionMaskProcessorTest.java
SkymindIO/nativerl
48f1a9897ca67fd892165818904fe8a33c5c19d4
[ "Apache-2.0" ]
1
2022-02-14T09:48:54.000Z
2022-02-14T09:48:54.000Z
29
125
0.638352
10,938
package ai.skymind.nativerl; import org.junit.Test; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; /** * * @author saudet */ public class ActionMaskProcessorTest { boolean data1 = true; boolean data2 = false; boolean data3[] = {false, true}; class TestActionMasks { boolean mask1 = data1; boolean mask2 = data2; boolean[] mask3 = data3; } void actionMasks(int agentId) { class DummyActionMasks extends TestActionMasks { boolean mask4 = agentId != 0; } } @Test public void testActionMasks() { try { ActionMaskProcessor ap = new ActionMaskProcessor(this.getClass()); assertEquals("DummyActionMasks", ap.getActionMaskClass().getSimpleName()); assertArrayEquals(new String[] {"mask1", "mask2", "mask3[0]", "mask3[1]", "mask4"}, ap.getActionMaskNames(this)); assertArrayEquals(new boolean[] {true, false, false, true, true}, ap.getActionMasks(this, 64)); } catch (ReflectiveOperationException ex) { fail(ex.getMessage()); } } }
3e19ca7e9781ac9854767b3dc11028407785a0ed
3,406
java
Java
spring-context/src/jmh/java/org/springframework/context/annotation/AnnotationProcessorBenchmark.java
Jervis-Miao/spring-framework
30efa4d478d6673ecfc735bef1ce65decadf4e77
[ "Apache-2.0" ]
49,076
2015-01-01T07:23:26.000Z
2022-03-31T23:57:00.000Z
spring-context/src/jmh/java/org/springframework/context/annotation/AnnotationProcessorBenchmark.java
Jervis-Miao/spring-framework
30efa4d478d6673ecfc735bef1ce65decadf4e77
[ "Apache-2.0" ]
7,918
2015-01-06T17:17:21.000Z
2022-03-31T20:10:05.000Z
spring-context/src/jmh/java/org/springframework/context/annotation/AnnotationProcessorBenchmark.java
Jervis-Miao/spring-framework
30efa4d478d6673ecfc735bef1ce65decadf4e77
[ "Apache-2.0" ]
37,778
2015-01-01T08:25:16.000Z
2022-03-31T17:25:08.000Z
32.438095
110
0.782149
10,939
/* * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.context.annotation; import jakarta.annotation.Resource; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.testfixture.beans.ITestBean; import org.springframework.beans.testfixture.beans.TestBean; import org.springframework.context.support.GenericApplicationContext; /** * Benchmark for bean annotation processing with various annotations. * @author Brian Clozel */ @BenchmarkMode(Mode.Throughput) public class AnnotationProcessorBenchmark { @State(Scope.Benchmark) public static class BenchmarkState { public GenericApplicationContext context; @Param({"ResourceAnnotatedTestBean", "AutowiredAnnotatedTestBean"}) public String testBeanClass; @Param({"true", "false"}) public boolean overridden; @Setup public void setup() { RootBeanDefinition rbd; this.context = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(this.context); this.context.refresh(); if (this.testBeanClass.equals("ResourceAnnotatedTestBean")) { rbd = new RootBeanDefinition(ResourceAnnotatedTestBean.class); } else { rbd = new RootBeanDefinition(AutowiredAnnotatedTestBean.class); } rbd.setScope(BeanDefinition.SCOPE_PROTOTYPE); if (this.overridden) { rbd.getPropertyValues().add("spouse", new RuntimeBeanReference("spouse")); } this.context.registerBeanDefinition("test", rbd); this.context.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class)); } } @Benchmark public ITestBean prototypeCreation(BenchmarkState state) { TestBean tb = state.context.getBean("test", TestBean.class); return tb.getSpouse(); } private static class ResourceAnnotatedTestBean extends org.springframework.beans.testfixture.beans.TestBean { @Override @Resource @SuppressWarnings("deprecation") @org.springframework.beans.factory.annotation.Required public void setSpouse(ITestBean spouse) { super.setSpouse(spouse); } } private static class AutowiredAnnotatedTestBean extends TestBean { @Override @Autowired @SuppressWarnings("deprecation") @org.springframework.beans.factory.annotation.Required public void setSpouse(ITestBean spouse) { super.setSpouse(spouse); } } }