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
9233ef67d06279d37e2e51d543e8ca5314fe5717
1,201
java
Java
websocket-teaching/src/main/java/com/neoframework/microservices/wsteaching/api/WsSysController.java
mingt/spring-websocket-example
447e8dddac8bf84ae2de4ca976751a3949d46b7c
[ "Apache-2.0" ]
null
null
null
websocket-teaching/src/main/java/com/neoframework/microservices/wsteaching/api/WsSysController.java
mingt/spring-websocket-example
447e8dddac8bf84ae2de4ca976751a3949d46b7c
[ "Apache-2.0" ]
null
null
null
websocket-teaching/src/main/java/com/neoframework/microservices/wsteaching/api/WsSysController.java
mingt/spring-websocket-example
447e8dddac8bf84ae2de4ca976751a3949d46b7c
[ "Apache-2.0" ]
null
null
null
28.595238
88
0.732723
996,753
package com.neoframework.microservices.wsteaching.api; import com.websocket.config.StompProperties; import com.websocket.config.StompPropertiesDto; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * ws 系统相关公共接口. */ @RestController @RequestMapping("wssys") public class WsSysController { private static final Logger logger = LoggerFactory.getLogger(WsSysController.class); @Autowired private StompProperties stompProperties; /** * 获取版本信息. * * @return */ @GetMapping("ifExternalBroker") public StompPropertiesDto ifExternalBroker() { StompPropertiesDto result = new StompPropertiesDto(); if (stompProperties != null) { result.setExternalBroker(stompProperties.getExternalBroker()); result.setIfExternalBroker(stompProperties.ifExternalBroker()); } else { result.setIfExternalBroker(false); } return result; } }
9233ef87af4e8026070a7d1fb49fe6b87ff29e80
5,897
java
Java
jme3-terrain/src/main/java/com/jme3/terrain/noise/basis/ImprovedNoise.java
Markil3/jmonkeyengine
49383a5c0c80557b99275bbe0d9af42e7527bd03
[ "BSD-3-Clause" ]
3,139
2015-01-01T10:18:09.000Z
2022-03-31T12:51:24.000Z
jme3-terrain/src/main/java/com/jme3/terrain/noise/basis/ImprovedNoise.java
Markil3/jmonkeyengine
49383a5c0c80557b99275bbe0d9af42e7527bd03
[ "BSD-3-Clause" ]
1,385
2015-01-01T00:21:56.000Z
2022-03-31T18:36:04.000Z
jme3-terrain/src/main/java/com/jme3/terrain/noise/basis/ImprovedNoise.java
Markil3/jmonkeyengine
49383a5c0c80557b99275bbe0d9af42e7527bd03
[ "BSD-3-Clause" ]
1,306
2015-01-01T10:18:11.000Z
2022-03-27T06:38:48.000Z
46.070313
136
0.609632
996,754
/** * Copyright (c) 2011, Novyon Events * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @author Anthyon */ package com.jme3.terrain.noise.basis; import com.jme3.terrain.noise.ShaderUtils; // JAVA REFERENCE IMPLEMENTATION OF IMPROVED NOISE - COPYRIGHT 2002 KEN PERLIN. /** * Perlin's default implementation of Improved Perlin Noise * designed to work with Noise base */ public final class ImprovedNoise extends Noise { @Override public void init() { } static public float noise(float x, float y, float z) { int X = ShaderUtils.floor(x), // FIND UNIT CUBE THAT Y = ShaderUtils.floor(y), // CONTAINS POINT. Z = ShaderUtils.floor(z); x -= X; // FIND RELATIVE X,Y,Z y -= Y; // OF POINT IN CUBE. z -= Z; X = X & 255; Y = Y & 255; Z = Z & 255; float u = ImprovedNoise.fade(x), // COMPUTE FADE CURVES v = ImprovedNoise.fade(y), // FOR EACH OF X,Y,Z. w = ImprovedNoise.fade(z); int A = ImprovedNoise.p[X] + Y; int AA = ImprovedNoise.p[A] + Z; int AB = ImprovedNoise.p[A + 1] + Z; int B = ImprovedNoise.p[X + 1] + Y; int BA = ImprovedNoise.p[B] + Z; int BB = ImprovedNoise.p[B + 1] + Z; return ImprovedNoise.lerp( w, ImprovedNoise.lerp( v, ImprovedNoise.lerp(u, ImprovedNoise.grad3(ImprovedNoise.p[AA], x, y, z), ImprovedNoise.grad3(ImprovedNoise.p[BA], x - 1, y, z)), // BLENDED ImprovedNoise.lerp(u, ImprovedNoise.grad3(ImprovedNoise.p[AB], x, y - 1, z), // RESULTS ImprovedNoise.grad3(ImprovedNoise.p[BB], x - 1, y - 1, z))),// FROM ImprovedNoise.lerp(v, ImprovedNoise.lerp(u, ImprovedNoise.grad3(ImprovedNoise.p[AA + 1], x, y, z - 1), // CORNERS ImprovedNoise.grad3(ImprovedNoise.p[BA + 1], x - 1, y, z - 1)), // OF ImprovedNoise.lerp(u, ImprovedNoise.grad3(ImprovedNoise.p[AB + 1], x, y - 1, z - 1), ImprovedNoise.grad3(ImprovedNoise.p[BB + 1], x - 1, y - 1, z - 1)))); } static final float fade(final float t) { return t * t * t * (t * (t * 6 - 15) + 10); } static final float lerp(final float t, final float a, final float b) { return a + t * (b - a); } static float grad(final int hash, final float x, final float y, final float z) { int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE float u = h < 8 ? x : y, // INTO 12 GRADIENT DIRECTIONS. v = h < 4 ? y : h == 12 || h == 14 ? x : z; return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); } static final float grad3(final int hash, final float x, final float y, final float z) { int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE return x * ImprovedNoise.GRAD3[h][0] + y * ImprovedNoise.GRAD3[h][1] + z * ImprovedNoise.GRAD3[h][2]; } static final int p[] = new int[512], permutation[] = { 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180 }; private static float[][] GRAD3 = new float[][] { { 1, 1, 0 }, { -1, 1, 0 }, { 1, -1, 0 }, { -1, -1, 0 }, { 1, 0, 1 }, { -1, 0, 1 }, { 1, 0, -1 }, { -1, 0, -1 }, { 0, 1, 1 }, { 0, -1, 1 }, { 0, 1, -1 }, { 0, -1, -1 }, { 1, 0, -1 }, { -1, 0, -1 }, { 0, -1, 1 }, { 0, 1, 1 } }; static { for (int i = 0; i < 256; i++) { ImprovedNoise.p[256 + i] = ImprovedNoise.p[i] = ImprovedNoise.permutation[i]; } } @Override public float value(final float x, final float y, final float z) { return ImprovedNoise.noise(this.scale * x, this.scale * y, this.scale * z); } }
9233efa7410a34ee622beba92bc778a3225e3919
201
java
Java
core/src/main/java/com/choy/thriftplus/core/retry/TRetryListener.java
choyaFan/thrift-extention
85bb4857fe5afe2b241cb6570213f812655d50bd
[ "MIT" ]
null
null
null
core/src/main/java/com/choy/thriftplus/core/retry/TRetryListener.java
choyaFan/thrift-extention
85bb4857fe5afe2b241cb6570213f812655d50bd
[ "MIT" ]
null
null
null
core/src/main/java/com/choy/thriftplus/core/retry/TRetryListener.java
choyaFan/thrift-extention
85bb4857fe5afe2b241cb6570213f812655d50bd
[ "MIT" ]
null
null
null
25.125
63
0.756219
996,755
package com.choy.thriftplus.core.retry; public interface TRetryListener<Result, Error> { void onSuccess(Result result, TRetry<Result, Error> retry); void onFail(TRetryJobErr<Error> error); }
9233efab93460648a09712ddd77d26a6f5599ed1
701
java
Java
src/test/java/org/nem/core/model/primitive/SupplyTest.java
qyy891878034/nem-core
90f5aca368048a3e5dc0ec156636678d84e27f25
[ "MIT" ]
368
2016-07-08T09:28:58.000Z
2022-01-04T12:30:28.000Z
src/test/java/org/nem/core/model/primitive/SupplyTest.java
qyy891878034/nem-core
90f5aca368048a3e5dc0ec156636678d84e27f25
[ "MIT" ]
39
2016-07-07T12:32:32.000Z
2022-01-31T16:27:08.000Z
src/test/java/org/nem/core/model/primitive/SupplyTest.java
qyy891878034/nem-core
90f5aca368048a3e5dc0ec156636678d84e27f25
[ "MIT" ]
144
2016-07-13T09:34:24.000Z
2022-02-23T10:03:37.000Z
21.90625
97
0.763195
996,756
package org.nem.core.model.primitive; import org.nem.core.serialization.*; public class SupplyTest extends AbstractQuantityTest<Supply> { @Override protected Supply getZeroConstant() { return Supply.ZERO; } @Override protected Supply fromValue(final long raw) { return Supply.fromValue(raw); } @Override protected Supply construct(final long raw) { return new Supply(raw); } @Override protected Supply readFrom(final Deserializer deserializer, final String label) { return Supply.readFrom(deserializer, label); } @Override protected void writeTo(final Serializer serializer, final String label, final Supply quantity) { Supply.writeTo(serializer, label, quantity); } }
9233f0792de0ba1760dd29eb044fb1af09d5ac6d
2,439
java
Java
src/test/java/nl/esciencecenter/xenon/adaptors/schedulers/MockInteractiveProcess.java
cffbots/xenon
6c44efbca84cfecae5a8bcf9e330878feef48181
[ "Apache-2.0" ]
null
null
null
src/test/java/nl/esciencecenter/xenon/adaptors/schedulers/MockInteractiveProcess.java
cffbots/xenon
6c44efbca84cfecae5a8bcf9e330878feef48181
[ "Apache-2.0" ]
null
null
null
src/test/java/nl/esciencecenter/xenon/adaptors/schedulers/MockInteractiveProcess.java
cffbots/xenon
6c44efbca84cfecae5a8bcf9e330878feef48181
[ "Apache-2.0" ]
null
null
null
25.673684
97
0.661337
996,757
/* * Copyright 2013 Netherlands eScience Center * * 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 nl.esciencecenter.xenon.adaptors.schedulers; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import nl.esciencecenter.xenon.schedulers.JobDescription; import nl.esciencecenter.xenon.schedulers.Streams; public class MockInteractiveProcess implements InteractiveProcess { JobDescription job; String jobID; long deadline; long killDeadline; long killDelay; Streams streams; boolean destroyed = false; public MockInteractiveProcess(JobDescription job, String jobID, long delay, long killDelay) { this.job = job; this.jobID = jobID; ByteArrayInputStream stdout = new ByteArrayInputStream("Hello World\n".getBytes()); ByteArrayInputStream stderr = new ByteArrayInputStream(new byte[0]); ByteArrayOutputStream stdin = new ByteArrayOutputStream(); this.streams = new StreamsImplementation(jobID, stdout, stdin, stderr); this.deadline = System.currentTimeMillis() + delay; this.killDelay = killDelay; } @Override public synchronized boolean isDone() { if (System.currentTimeMillis() >= deadline) { return true; } if (destroyed && System.currentTimeMillis() >= killDeadline) { return true; } return false; } @Override public synchronized int getExitStatus() { if (destroyed) { return 1; } if (isDone()) { return 0; } return -1; } @Override public synchronized void destroy() { if (destroyed || isDone()) { return; } destroyed = true; killDeadline = System.currentTimeMillis() + killDelay; } @Override public Streams getStreams() { return streams; } }
9233f0e084c2655eb399f158424679ec83640f6b
567
java
Java
src/main/java/edu/mit/broad/genome/reports/web/WebResource.java
davideby/gsea-desktop
6908351f2c5bcbd5b64c4d61965582c2fb8ab835
[ "MIT" ]
30
2017-07-14T15:07:28.000Z
2022-02-04T22:08:13.000Z
src/main/java/edu/mit/broad/genome/reports/web/WebResource.java
davideby/gsea-desktop
6908351f2c5bcbd5b64c4d61965582c2fb8ab835
[ "MIT" ]
50
2017-08-14T17:59:26.000Z
2022-03-28T16:46:50.000Z
src/main/java/edu/mit/broad/genome/reports/web/WebResource.java
davideby/gsea-desktop
6908351f2c5bcbd5b64c4d61965582c2fb8ab835
[ "MIT" ]
15
2017-07-05T02:04:16.000Z
2022-03-13T01:45:37.000Z
33.352941
155
0.52381
996,758
/******************************************************************************* * Copyright (c) 2003-2016 Broad Institute, Inc., Massachusetts Institute of Technology, and Regents of the University of California. All rights reserved. *******************************************************************************/ package edu.mit.broad.genome.reports.web; /** * @author Aravind Subramanian */ public interface WebResource { public String getName(); // always of the form: prefix= public String getUrlPrefix(); } // End interface WebCgiResource
9233f24b95daaf36f37523d500ce1d8ea2bc26a7
2,991
java
Java
tests/generations/rmosa/tests/s1009/4_rif/evosuite-tests/com/densebrain/rif/client/RIFClassLoader_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
null
null
null
tests/generations/rmosa/tests/s1009/4_rif/evosuite-tests/com/densebrain/rif/client/RIFClassLoader_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
3
2020-11-16T20:40:56.000Z
2021-03-23T00:18:04.000Z
tests/generations/rmosa/tests/s1009/4_rif/evosuite-tests/com/densebrain/rif/client/RIFClassLoader_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
null
null
null
29.038835
176
0.661317
996,759
/* * This file was automatically generated by EvoSuite * Sun Nov 08 14:16:26 GMT 2020 */ package com.densebrain.rif.client; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import com.densebrain.rif.client.RIFClassLoader; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class RIFClassLoader_ESTest extends RIFClassLoader_ESTest_scaffolding { /** //Test case number: 0 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test0() throws Throwable { RIFClassLoader rIFClassLoader0 = new RIFClassLoader(); byte[] byteArray0 = new byte[0]; // Undeclared exception! try { rIFClassLoader0.registerClass("/KC($.v!`VPt", byteArray0); fail("Expecting exception: NoClassDefFoundError"); } catch(NoClassDefFoundError e) { } } /** //Test case number: 1 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test1() throws Throwable { RIFClassLoader rIFClassLoader0 = new RIFClassLoader(); byte[] byteArray0 = new byte[0]; // Undeclared exception! try { rIFClassLoader0.registerClass("?EM=dx0bF", byteArray0); fail("Expecting exception: ClassFormatError"); } catch(ClassFormatError e) { } } /** //Test case number: 2 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test2() throws Throwable { RIFClassLoader rIFClassLoader0 = new RIFClassLoader(); // Undeclared exception! try { rIFClassLoader0.findClass((String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // } } /** //Test case number: 3 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test3() throws Throwable { RIFClassLoader rIFClassLoader0 = new RIFClassLoader(); // Undeclared exception! try { rIFClassLoader0.registerClass((String) null, (byte[]) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("com.densebrain.rif.client.RIFClassLoader", e); } } /** //Test case number: 4 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test4() throws Throwable { RIFClassLoader rIFClassLoader0 = new RIFClassLoader(); Class<?> class0 = rIFClassLoader0.findClass(""); assertNull(class0); } }
9233f25d464ac23399ff17827b19bcb271cc47b7
10,010
java
Java
Client/src/main/controlleur/actionMedicale/OrdonanceMaladeController.java
tafoca/nexthms
f274765f8a7ca485ef816e03df63f337927138b0
[ "Apache-2.0" ]
null
null
null
Client/src/main/controlleur/actionMedicale/OrdonanceMaladeController.java
tafoca/nexthms
f274765f8a7ca485ef816e03df63f337927138b0
[ "Apache-2.0" ]
null
null
null
Client/src/main/controlleur/actionMedicale/OrdonanceMaladeController.java
tafoca/nexthms
f274765f8a7ca485ef816e03df63f337927138b0
[ "Apache-2.0" ]
null
null
null
40.04
293
0.667333
996,760
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package main.controlleur.actionMedicale; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.rmi.Naming; import java.rmi.NotBoundException; import java.rmi.Remote; import java.rmi.RemoteException; import java.sql.Date; import java.time.LocalDate; import java.util.ArrayList; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.BorderPane; import javafx.util.Callback; import main.Main; import main.beans.Fiche_patient; import main.beans.Ordonance; import main.util.FactorielleChargeurCentre; import main.util.OrdonanceToDisplay; import uds.information.RemoteOrdonance; /** * FXML Controller class * * @author user */ public class OrdonanceMaladeController implements Initializable { @FXML private Label erreur; @FXML private TextField nom_medicament; @FXML private ComboBox famille_medicament; @FXML private ComboBox forme_medicament; @FXML private TextArea posologie; @FXML private TextArea observations; @FXML private TableView ordonances; private ObservableList<OrdonanceToDisplay> data=FXCollections.observableArrayList(); private ArrayList<Ordonance> tabOrdonance=new ArrayList(); private Main application; private BorderPane conteneur; private Fiche_patient fiche; public void setApp(Main application) {this.application = application;} public void setContainer(BorderPane b){conteneur=b;} public void setFiche(Fiche_patient f) throws NotBoundException, MalformedURLException, RemoteException{ fiche=f; famille_medicament.getItems().addAll("Virusticide","MicrobeTicide","BacterieTicide"); forme_medicament.getItems().addAll("Comprime","Liquide","Capsule"); Remote r = Naming.lookup("rmi://127.0.0.1/serveurHospital/ordonance"); tabOrdonance=((RemoteOrdonance)r).getAllOrdonanceByIdPatient(fiche.getNum_fiche()); for(int i=0;i<tabOrdonance.size();i++) data.add(new OrdonanceToDisplay( tabOrdonance.get(i).getNom_medicament(), tabOrdonance.get(i).getFamille_medicament(), tabOrdonance.get(i).getForme_medicament(), tabOrdonance.get(i).getPosologie(), tabOrdonance.get(i).getObservation() )); TableColumn colNom=new TableColumn("Nom");colNom.setPrefWidth(100); TableColumn colFamille=new TableColumn("Famille");colFamille.setPrefWidth(100); TableColumn colForme=new TableColumn("Forme");colForme.setPrefWidth(100); TableColumn colPosologie=new TableColumn("Posologie");colPosologie.setPrefWidth(200); TableColumn colObservation=new TableColumn("Observation");colObservation.setPrefWidth(290); colNom.setCellValueFactory(new PropertyValueFactory<OrdonanceToDisplay,String>("nom")); colFamille.setCellValueFactory(new PropertyValueFactory<OrdonanceToDisplay,String>("famille")); colForme.setCellValueFactory(new PropertyValueFactory<OrdonanceToDisplay,String>("forme")); colPosologie.setCellValueFactory(new PropertyValueFactory<OrdonanceToDisplay,String>("posologie")); colObservation.setCellValueFactory(new PropertyValueFactory<OrdonanceToDisplay,String>("observation")); TableColumn<OrdonanceToDisplay, Boolean> btnCol = new TableColumn<>("Supprimer"); btnCol.setPrefWidth(120); btnCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<OrdonanceToDisplay, Boolean>, ObservableValue<Boolean>>() { @Override public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<OrdonanceToDisplay, Boolean> features) { return new ReadOnlyObjectWrapper(features.getValue()!=null); } }); btnCol.setCellFactory(new Callback<TableColumn<OrdonanceToDisplay, Boolean>, TableCell<OrdonanceToDisplay, Boolean>>() { @Override public TableCell<OrdonanceToDisplay, Boolean> call(TableColumn<OrdonanceToDisplay, Boolean> p) { return new ButtonCell(); } }); TableColumn<OrdonanceToDisplay, Boolean> btnColPrint = new TableColumn<>("Impprimer"); btnColPrint.setPrefWidth(120); btnColPrint.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<OrdonanceToDisplay, Boolean>, ObservableValue<Boolean>>() { @Override public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<OrdonanceToDisplay, Boolean> features) { return new ReadOnlyObjectWrapper(features.getValue()!=null); } }); btnColPrint.setCellFactory(new Callback<TableColumn<OrdonanceToDisplay, Boolean>, TableCell<OrdonanceToDisplay, Boolean>>() { @Override public TableCell<OrdonanceToDisplay, Boolean> call(TableColumn<OrdonanceToDisplay, Boolean> p) { return new ButtonCellPrint(); } }); ordonances.setItems(data); ordonances.getColumns().clear(); ordonances.getColumns().addAll(colNom,colFamille,colForme,colPosologie,colObservation,btnCol,btnColPrint); } @FXML public void ajouter(){ try{ erreur.setText(null); Ordonance o=new Ordonance(-1,Date.valueOf(LocalDate.now()), nom_medicament.getText(), famille_medicament.getValue().toString(), forme_medicament.getValue().toString(), posologie.getText(),observations.getText(),true,application.getUser().getNum_utilisateur(),fiche.getNum_fiche()); Remote r = Naming.lookup("rmi://127.0.0.1/serveurHospital/ordonance"); o=(Ordonance) ((RemoteOrdonance)r).saveOrdonance(o); tabOrdonance.add(o); OrdonanceToDisplay otd=new OrdonanceToDisplay(o.getNom_medicament(), o.getFamille_medicament(), o.getForme_medicament(), o.getPosologie(), o.getObservation()); data.add(otd); }catch(Exception e){ erreur.setText("Erreur"); } } @FXML public void retour() throws IOException{ FactorielleChargeurCentre chargeur=new FactorielleChargeurCentre(); HomeMaladeController con=(HomeMaladeController)chargeur.sonFactory(conteneur, "vue/actionMedicale/HomeMalade.fxml"); con.setApp(application); con.setContainer(conteneur); con.setFiche(fiche); } /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO } private class ButtonCell extends TableCell<OrdonanceToDisplay, Boolean> { final Button cellButton = new Button("Supprimer");{ cellButton.setPrefWidth(120); } ButtonCell(){ cellButton.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent t) { try { int selectdIndex = getTableRow().getIndex(); OrdonanceToDisplay c=data.get(selectdIndex); //puis on enleve c de la bd et apres... data.remove(selectdIndex); Remote r = Naming.lookup("rmi://127.0.0.1/serveurHospital/ordonance"); ((RemoteOrdonance)r).remove(tabOrdonance.get(selectdIndex)); tabOrdonance.remove(selectdIndex); } catch (NotBoundException ex) { Logger.getLogger(OrdonanceMaladeController.class.getName()).log(Level.SEVERE, null, ex); } catch (MalformedURLException ex) { Logger.getLogger(OrdonanceMaladeController.class.getName()).log(Level.SEVERE, null, ex); } catch (RemoteException ex) { Logger.getLogger(OrdonanceMaladeController.class.getName()).log(Level.SEVERE, null, ex); } } }); } //Display button if the row is not empty @Override protected void updateItem(Boolean t, boolean empty) { super.updateItem(t, empty); if(!empty){ setGraphic(cellButton); }else{ setGraphic(null); } } } private class ButtonCellPrint extends TableCell<OrdonanceToDisplay, Boolean> { final Button cellButton = new Button("Imprimer l'ordonance");{ cellButton.setPrefWidth(150); } ButtonCellPrint(){ cellButton.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent t) { //On dit au serveur d'imprimer } }); } //Display button if the row is not empty @Override protected void updateItem(Boolean t, boolean empty) { super.updateItem(t, empty); if(!empty){ setGraphic(cellButton); }else{ setGraphic(null); } } } }
9233f2abca26775fd303835a026e930f72867af3
753
java
Java
src/main/java/nl/vpro/poel/UserUtil.java
vpro/poel-backend
49df800871b0b3d198e1809d09ed9541d0d53fa2
[ "Apache-2.0" ]
null
null
null
src/main/java/nl/vpro/poel/UserUtil.java
vpro/poel-backend
49df800871b0b3d198e1809d09ed9541d0d53fa2
[ "Apache-2.0" ]
null
null
null
src/main/java/nl/vpro/poel/UserUtil.java
vpro/poel-backend
49df800871b0b3d198e1809d09ed9541d0d53fa2
[ "Apache-2.0" ]
null
null
null
31.375
91
0.734396
996,761
package nl.vpro.poel; import lombok.experimental.UtilityClass; import nl.vpro.poel.domain.CurrentUser; import org.springframework.security.cas.authentication.CasAuthenticationToken; import org.springframework.security.core.userdetails.UserDetails; import java.security.Principal; import java.util.Optional; @UtilityClass public class UserUtil { public Optional<CurrentUser> getCurrentUser(Principal principal) { if (principal instanceof CasAuthenticationToken) { UserDetails userDetails = ((CasAuthenticationToken)principal).getUserDetails(); if (userDetails instanceof CurrentUser) { return Optional.of((CurrentUser) userDetails); } } return Optional.empty(); } }
9233f2dc259721230b39ac49834db474fb683971
2,750
java
Java
Get-Me-Home-Server/app/src/main/java/danie/gmhserver/SmsReceiver.java
dhosseinian/Get-Me-Home
e095e8ee639c99e5aeaf3f03d41400aa3822eff8
[ "MIT" ]
null
null
null
Get-Me-Home-Server/app/src/main/java/danie/gmhserver/SmsReceiver.java
dhosseinian/Get-Me-Home
e095e8ee639c99e5aeaf3f03d41400aa3822eff8
[ "MIT" ]
null
null
null
Get-Me-Home-Server/app/src/main/java/danie/gmhserver/SmsReceiver.java
dhosseinian/Get-Me-Home
e095e8ee639c99e5aeaf3f03d41400aa3822eff8
[ "MIT" ]
null
null
null
33.13253
81
0.537455
996,762
package danie.gmhserver; /** * Created by danie on 3/12/2017. */ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.telephony.SmsMessage; import android.util.Log; import static android.support.v4.content.ContextCompat.startActivity; public class SmsReceiver extends BroadcastReceiver { public static String MESSAGE1 = "destination"; //Value will change public static String MESSAGE2 = "phoneNumber"; //Value will change Context context; String data; String source; @Override public void onReceive(Context cont, Intent intent) { // TODO: This method is called when the BroadcastReceiver is receiving // an Intent broadcast. //---get the SMS message passed in--- context = cont; Bundle bundle = intent.getExtras(); SmsMessage[] msgs = null; String[] str = {""}; data = ""; source = ""; if (bundle != null) { //---retrieve the SMS message received--- Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; for (int i = 0; i < msgs.length; i++) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { String format = bundle.getString("format"); msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i], format); } else { msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); } Log.d("source", msgs[i].getOriginatingAddress()); source = msgs[i].getOriginatingAddress(); str[i] += msgs[i].getMessageBody(); str[i] += "\n"; } } for (int i = 0; i < str.length; i++) { data += str[i]; } //Check if text starts with tag if(data.startsWith("#GMH")) { /* Intent getDir = new Intent(context, MainActivity.class); getDir.putExtra(MESSAGE1, data); getDir.putExtra(MESSAGE2, source); context.startActivity(getDir); */ Thread thread = new Thread(new Runnable() { SmsSender sender = new SmsSender(context, source); @Override public void run() { try { sender.sendDirections(data); } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); } //throw new UnsupportedOperationException("Not yet implemented"); } }
9233f53b4eedca8cbcbd873d871046440efb376e
753
java
Java
src/main/java/com/bitso/BitsoTicker.java
gera-rcg/bitso-java
8fe6d968cf4dd1566a5370cf7fa4a7544af2b0ea
[ "MIT" ]
null
null
null
src/main/java/com/bitso/BitsoTicker.java
gera-rcg/bitso-java
8fe6d968cf4dd1566a5370cf7fa4a7544af2b0ea
[ "MIT" ]
null
null
null
src/main/java/com/bitso/BitsoTicker.java
gera-rcg/bitso-java
8fe6d968cf4dd1566a5370cf7fa4a7544af2b0ea
[ "MIT" ]
null
null
null
23.53125
56
0.555113
996,763
package com.bitso; import java.math.BigDecimal; import org.json.JSONObject; import com.bitso.exchange.Ticker; import com.bitso.helpers.Helpers; public class BitsoTicker extends Ticker { public BitsoTicker(JSONObject o) { last = getBD(o, "last"); high = getBD(o, "high"); low = getBD(o, "low"); vwap = getBD(o, "vwap"); volume = getBD(o, "volume"); bid = getBD(o, "bid"); ask = getBD(o, "ask"); } private BigDecimal getBD(JSONObject o, String key) { if (o.has(key)) { return new BigDecimal(o.getString(key)); } else { System.err.println("No " + key + ": " + o); Helpers.printStackTrace(); } return null; } }
9233f574036fb01d1eff6fe3bdab26a48f74931e
820
java
Java
micro-biz/src/main/java/cn/micro/biz/mapper/member/IRolePermissionMapper.java
yu120/micro
7296f1ba1a194b55ad5390a8cdeee4cc09cd8b45
[ "MIT" ]
6
2017-04-26T15:10:02.000Z
2020-02-26T14:04:16.000Z
micro-biz/src/main/java/cn/micro/biz/mapper/member/IRolePermissionMapper.java
yu120/micro
7296f1ba1a194b55ad5390a8cdeee4cc09cd8b45
[ "MIT" ]
1
2022-01-12T23:02:57.000Z
2022-01-12T23:02:57.000Z
micro-biz/src/main/java/cn/micro/biz/mapper/member/IRolePermissionMapper.java
yu120/micro
7296f1ba1a194b55ad5390a8cdeee4cc09cd8b45
[ "MIT" ]
5
2017-04-27T06:42:13.000Z
2021-05-22T16:37:43.000Z
25.625
81
0.72561
996,764
package cn.micro.biz.mapper.member; import cn.micro.biz.entity.member.RoleEntity; import cn.micro.biz.entity.member.RolePermissionEntity; import cn.micro.biz.model.view.RoleCodePermission; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List; /** * Role Permission Mapper * * @author lry */ public interface IRolePermissionMapper extends BaseMapper<RolePermissionEntity> { /** * The select roleCode permission list * * @return {@link List<RoleCodePermission>} */ List<RoleCodePermission> selectRoleCodePermissions(); /** * The select permission list by roleCode * * @param roleCode {@link RoleEntity#code} * @return {@link List<RoleCodePermission>} */ List<RoleCodePermission> selectPermissionsByRoleCode(String roleCode); }
9233f697eacf6d0b3a8bebafdf877ffe9284ec45
1,242
java
Java
src/main/java/io/jboot/support/jwt/JwtInterceptorBuilder.java
blongz/jboot
ce88356e91d52bda38aac88ba9592f3e24cd918b
[ "Apache-2.0" ]
784
2017-05-24T02:41:03.000Z
2022-03-13T05:44:11.000Z
src/main/java/io/jboot/support/jwt/JwtInterceptorBuilder.java
icewater2020/jboot
09d48f85ca65e7f0cc02900152aefc4d9dbf907c
[ "Apache-2.0" ]
47
2017-06-04T15:02:44.000Z
2022-03-25T11:18:13.000Z
src/main/java/io/jboot/support/jwt/JwtInterceptorBuilder.java
icewater2020/jboot
09d48f85ca65e7f0cc02900152aefc4d9dbf907c
[ "Apache-2.0" ]
264
2017-05-24T15:11:54.000Z
2022-03-22T07:56:18.000Z
32.736842
110
0.733923
996,765
/** * Copyright (c) 2015-2021, Michael Yang 杨福海 (upchh@example.com). * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.jboot.support.jwt; import io.jboot.aop.InterceptorBuilder; import io.jboot.aop.Interceptors; import io.jboot.aop.annotation.AutoLoad; import java.lang.reflect.Method; /** * @author michael yang (upchh@example.com) */ @AutoLoad public class JwtInterceptorBuilder implements InterceptorBuilder { @Override public void build(Class<?> targetClass, Method method, Interceptors interceptors) { if (Util.isJbootController(targetClass) && Util.hasAnnotation(targetClass, method, EnableJwt.class)) { interceptors.addToFirst(JwtInterceptor.class); } } }
9233f73fb39e9d8a62f8f39b7d4e5d523ca1d628
744
java
Java
Mage/src/main/java/mage/game/permanent/token/NestOfScarabsBlackInsectToken.java
mdschatz/mage
56df62a743491e75f39ad2c92c8cf60392595e41
[ "MIT" ]
1
2022-01-25T23:14:44.000Z
2022-01-25T23:14:44.000Z
Mage/src/main/java/mage/game/permanent/token/NestOfScarabsBlackInsectToken.java
mdschatz/mage
56df62a743491e75f39ad2c92c8cf60392595e41
[ "MIT" ]
null
null
null
Mage/src/main/java/mage/game/permanent/token/NestOfScarabsBlackInsectToken.java
mdschatz/mage
56df62a743491e75f39ad2c92c8cf60392595e41
[ "MIT" ]
null
null
null
24
85
0.694892
996,766
package mage.game.permanent.token; import mage.constants.CardType; import mage.constants.SubType; import mage.MageInt; /** * * @author spjspj */ public final class NestOfScarabsBlackInsectToken extends TokenImpl { public NestOfScarabsBlackInsectToken() { super("Insect Token", "1/1 black Insect creature token"); cardType.add(CardType.CREATURE); color.setBlack(true); subtype.add(SubType.INSECT); power = new MageInt(1); toughness = new MageInt(1); } public NestOfScarabsBlackInsectToken(final NestOfScarabsBlackInsectToken token) { super(token); } public NestOfScarabsBlackInsectToken copy() { return new NestOfScarabsBlackInsectToken(this); } }
9233fa4624df074b7b5cb5e250bf0d18c1c1dadc
14,153
java
Java
src-bct-porting/gui/environment/Environment.java
lta-disco-unimib-it/KLFA
7bbf0b31846239c849a307a48f820e28b62c874e
[ "Apache-2.0" ]
1
2021-06-06T01:36:32.000Z
2021-06-06T01:36:32.000Z
src-bct-porting/gui/environment/Environment.java
lta-disco-unimib-it/KLFA
7bbf0b31846239c849a307a48f820e28b62c874e
[ "Apache-2.0" ]
null
null
null
src-bct-porting/gui/environment/Environment.java
lta-disco-unimib-it/KLFA
7bbf0b31846239c849a307a48f820e28b62c874e
[ "Apache-2.0" ]
null
null
null
32.610599
81
0.671165
996,767
/******************************************************************************* * Copyright 2019 Fabrizio Pastore, Leonardo Mariani * * 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 gui.environment; import file.Encoder; import gui.environment.tag.EditorTag; import gui.environment.tag.Satisfier; import gui.environment.tag.Tag; import java.awt.BorderLayout; import java.awt.Component; import java.io.File; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; /** * The environment class is the central view that manages various * "hangers on" of an object. A hanger on is a component that has * some relevance to the object that this environment contains. * * @see gui.environment.EnvironmentFrame * @see gui.environment.tag * * @author Thomas Finley */ public abstract class Environment extends JPanel { /** * Instantiates a new environment for the given object. This * environment is assumed to have no native file to which to save * the object. One should use the <CODE>setFile</CODE> object if * this environment should have one. * @param object assumed to be some sort of object that this * environment holds; subclasses may provide more stringent * requirements for this kind of object */ public Environment(Serializable object) { theMainObject = object; clearDirty(); initView(); } /** * Returns the main object for this environment. This is the * object that was passed in for the constructor. * @return the main object for this environment */ public Serializable getObject() { return theMainObject; } /** * Adds a file change listener to this environment. * @param listener the listener to add */ public void addFileChangeListener(FileChangeListener listener) { fileListeners.add(listener); } /** * Removes a file change listener from this environment. * @param listener the listener to remove */ public void removeFileChangeListener(FileChangeListener listener) { fileListeners.remove(listener); } /** * Distributes the given file change event among all file change * listeners. * @param event the file change event to distribute */ protected void distributeFileChangeEvent(FileChangeEvent event) { Iterator it = fileListeners.iterator(); while (it.hasNext()) { FileChangeListener listener = (FileChangeListener) it.next(); listener.fileChanged(event); } } /** * Returns the file that this <CODE>Environment</CODE> has loaded * itself from. * @return the file object that is owned by this environment as * the place to store the serializable object, or * <CODE>null</CODE> if this environment currently has no file */ public File getFile() { return file; } /** * Sets the file owned by this <CODE>Environment</CODE> as the * default location to save the object. * @param file the new file for the environment */ public void setFile(File file) { File oldFile = this.file; this.file = file; distributeFileChangeEvent(new FileChangeEvent(this, oldFile)); } /** * Sets the encoder to use when writing this environment's file. * This should be set when the file is ever written, or when a * file is read and the format it was read in has a corresponding * encoder. * @param encoder the encoder for this */ public void setEncoder(Encoder encoder) { this.encoder = encoder; } /** * Gets the encoder to be used when saving this file. * @return the encoder to use to save this file, or * <CODE>null</CODE> if no encoder has been chosen yet */ public Encoder getEncoder() { return encoder; } /** * A helper function to set up the GUI components. */ private void initView() { this.setLayout(new BorderLayout()); tabbed = new JTabbedPane(); super.add(tabbed, BorderLayout.CENTER); // So that when the user changes the view by clicking in the // tabbed pane, this knows about it. tabbed.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { distributeChangeEvent(); } }); } /** * Adds a new component to the environment. Presumably this added * component has some relevance to the current automaton or * grammar held by the environment, though this is not strictly * required. * @param component the component to add, which should be unique * for this environment * @param name the name this component should be labeled with, * which is not necessarily a unique label * @param tags the tags associated with the component, or just a * raw <CODE>Tag</CODE> implementor if this component has no * special tags associated with it * @see gui.environment.tag */ public void add(Component component, String name, Tag tags) { componentTags.put(component, tags); tabbed.addTab(name, component); // Takes care of the deactivation of EditorTag tagged // components in the event that such action is appropriate. if (tags instanceof gui.environment.tag.CriticalTag) { criticalObjects++; if (criticalObjects == 1) setEnabledEditorTagged(false); } distributeChangeEvent(); } /** * Returns if a particular component is part of this environment, * as through addition through one of the <CODE>add</CODE> * methods * @param component the component to check for membership in this * environment * @see #add * @see #remove */ public boolean contains(Component component) { return tabbed.indexOfComponent(component) != -1; } /** * Deactivates or activates editor tagged objects in this environment. * @param enabled <CODE>true</CODE> if editor tagged objects * should be enabled, <CODE>false</CODE> if editor tagged objects * should be disabled */ public void setEnabledEditorTagged(boolean enabled) { for (int i=0; i<tabbed.getTabCount(); i++) { Component c = tabbed.getComponentAt(i); if (((Tag) componentTags.get(c)) instanceof EditorTag) tabbed.setEnabledAt(i, enabled); } } /** * Adds a component with the specified name. This is the same as * the other add method, except without that tag field, which is * assumed to be a basic tag object with no other tagness ascribed * to it (i.e. a generic tag). * @param component the component to add, which should be unique * for this environment * @param name the name this component should be labeled with, * which is not necessarily a unique label * @see #add(Component, String, Tag) */ public void add(Component component, String name) { this.add(component, name, new Tag(){}); } /** * Programmatically sets the currently active component in this * environment. * @param component the component to make active * @see #getActive */ public void setActive(Component component) { tabbed.setSelectedComponent(component); // The change event should be automatically distributed by the // model of the tabbed pane } /** * Returns the currently active component in this environment. * @return the currently active component in this environment * @see #setActive */ public Component getActive() { return tabbed.getSelectedComponent(); } /** * Returns whether or not the component is enabled, that is, * selectable. * @param component the component to check for enabledness * @return <CODE>true</CODE> if the given component is enabled, * <CODE>false</CODE> if the given component is disabled */ public boolean isEnabled(Component component) { return tabbed.isEnabledAt(tabbed.indexOfComponent(component)); } /** * Sets whether or not a component is enabled. * @param component the component to change the enabledness * @param enabled <CODE>true</CODE> if the component should be * made enabled, <CODE>false</CODE> if it should be made disabled */ public void setEnabled(Component component, boolean enabled) { tabbed.setEnabledAt(tabbed.indexOfComponent(component), enabled); distributeChangeEvent(); } /** * Adds a change listener to this object. The listener will * receive events whenever the active component changes, or when * components are made enabled or disabled, or when components are * added or removed. * @param listener the listener to add */ public void addChangeListener(ChangeListener listener) { changeListeners.add(listener); } /** * Removes a change listener from this object. * @param listener the listener to remove */ public void removeChangeListener(ChangeListener listener) { changeListeners.remove(listener); } /** * Distributes a change event to all listeners. */ protected void distributeChangeEvent() { ChangeEvent e = new ChangeEvent(this); Iterator it = (new HashSet(changeListeners)).iterator(); while (it.hasNext()) ((ChangeListener)it.next()).stateChanged(e); } /** * Removes a component from this environment. * @param component the component to remove */ public void remove(Component component) { tabbed.remove(component); Tag tag = (Tag)componentTags.remove(component); // Takes care of the deactivation of EditorTag tagged // components in the event that such action is appropriate. if (tag instanceof gui.environment.tag.CriticalTag) { criticalObjects--; if (criticalObjects == 0) setEnabledEditorTagged(true); } distributeChangeEvent(); } /** * Returns the tag for a given component, provided this tag is in * the component. * @param component the component to get the tag for * @return the tag for the component */ public Tag getTag(Component component) { return (Tag) componentTags.get(component); } /** * Returns an array containing all components. * @return an array containing all components. */ public Component[] getComponents() { Component[] comps = new Component[tabbed.getTabCount()]; for (int i=0; i<comps.length; i++) comps[i] = tabbed.getComponentAt(i); return comps; } /** * Returns an array whose components and tags satisfy the given * satisfier. * @param satisfier the satisfier all components and their tags * must satisfy * @return an array containing all those components who, along * with their tags, satisfied the satisfier */ public Component[] getComponents(Satisfier satisfier) { ArrayList list = new ArrayList(); for (int i=0; i<tabbed.getTabCount(); i++) { Component c = tabbed.getComponentAt(i); if (satisfier.satisfies(c, (Tag) componentTags.get(c))) list.add(c); } return (Component[]) list.toArray(new Component[0]); } /** * Detects if there are any components in this environment that * satisfy the given satisfier. This method works in time linear * in the number of components in this environment. * @param satisfier the satisfier to check components and their * tags against * @return <CODE>true</CODE> if the satisfier has managed to match * at least one object, <CODE>false</CODE> if none of the objects * in this satisfier are matched */ public boolean isPresent(Satisfier satisfier) { for (int i=0; i<tabbed.getTabCount(); i++) { Component c = tabbed.getComponentAt(i); if (satisfier.satisfies(c, (Tag) componentTags.get(c))) return true; } return false; } /** * Returns if this environment dirty. An environment is called * dirty if the object it holds has been modified since the last * save. * @return <CODE>true</CODE> if the environment is dirty, * <CODE>false</CODE> otherwise */ public boolean isDirty() { return dirty; } /** * Sets the dirty bit. This should be called if the object is * changed. */ public void setDirty() { dirty = true; } /** * Clears the dirty bit. This should be called when the object is * saved to a file, or is in some other such state that a save is * not required. */ public void clearDirty() { dirty = false; } /** The encoder for this document. */ private Encoder encoder = null; /** The mapping of components to their respective tag objects. */ private HashMap componentTags = new HashMap(); /** The tabbed pane for this environment. */ private JTabbedPane tabbed; /** The collection of change listeners for this object. */ private transient HashSet changeListeners = new HashSet(); /** The object that this environment centers on. */ private Serializable theMainObject; /** The file owned by this serializable object. */ private File file; /** The collection of file change listeners. */ private Set fileListeners = new HashSet(); /** The number of "CriticalTag" tagged components. Hokey but * fast. */ private int criticalObjects = 0; /** The dirty bit. */ private boolean dirty = false; }
9233fa8245b937dc04cd63c2c123ce3c20fe9f92
7,364
java
Java
src/main/java/com/example/dmx/show/ImageSlideShow.java
randomnoun/dmx-web
c1fd97fb43c2531679100a9a83f7347e8de8f9ec
[ "BSD-2-Clause" ]
1
2021-12-19T22:42:49.000Z
2021-12-19T22:42:49.000Z
src/main/java/com/example/dmx/show/ImageSlideShow.java
randomnoun/dmx-web
c1fd97fb43c2531679100a9a83f7347e8de8f9ec
[ "BSD-2-Clause" ]
null
null
null
src/main/java/com/example/dmx/show/ImageSlideShow.java
randomnoun/dmx-web
c1fd97fb43c2531679100a9a83f7347e8de8f9ec
[ "BSD-2-Clause" ]
null
null
null
40.461538
154
0.593156
996,768
package com.example.dmx.show; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; import org.apache.log4j.Logger; import com.randomnoun.common.Text; import com.randomnoun.dmx.Controller; import com.randomnoun.dmx.PropertyDef; import com.randomnoun.dmx.fixture.Fixture; import com.randomnoun.dmx.fixture.FixtureController; import com.randomnoun.dmx.show.Show; /** Generate an animation by transitioning form one image to another. * * @author knoxg */ public class ImageSlideShow extends Show { Logger logger = Logger.getLogger(ImageSlideShow.class); int maxX=0, maxY=0; FixtureController[][] matrix; BufferedImage[] anim; // only has one element atm public ImageSlideShow(long id, Controller controller, Properties properties) { super(id, controller, "ImageSlideShow", Long.MAX_VALUE, properties); String fixtureTemplate = (String) properties.get("fixtureTemplate"); String animation = (String) properties.get("animation"); if (fixtureTemplate==null) { fixtureTemplate = "matrix{x}-{y}"; } if (animation==null) { animation = "words-1000x8.gif"; } logger.info("Initialising ImageSlideShow with fixtureTemplate='" + fixtureTemplate + "', animation='" + animation + "'"); matrix = getMatrixArray(fixtureTemplate); maxX = matrix.length; maxY = matrix.length==0 ? 0 : matrix[0].length; // @TODO maxY = max(matrix[n].length) for all n anim = getImages(animation); if (anim!=null) { logger.info("Read animation with " + anim.length + " frames"); } else { logger.info("Error loading animation"); } } public List getDefaultProperties() { List properties = new ArrayList(); properties.add(new PropertyDef("fixtureTemplate", "Fixture template", "matrix{x}-{y}")); properties.add(new PropertyDef("animation", "Animation", "words-1000x8.gif")); return properties; } public FixtureController[][] getMatrixArray(String fixtureNameTemplate) { // @TODO: detect {y} before {x} String fixtureNameRegex = Text.replaceString(fixtureNameTemplate, "{x}", "(.*)"); fixtureNameRegex = Text.replaceString(fixtureNameRegex, "{y}", "(.*)"); Controller c = getController(); Pattern p = Pattern.compile(fixtureNameRegex); int maxX=0, maxY=0; for (Fixture f : c.getFixtures()) { Matcher m = p.matcher(f.getName()); if (m.matches()) { maxX = Math.max(maxX, Integer.parseInt(m.group(1))); maxY = Math.max(maxY, Integer.parseInt(m.group(2))); } } logger.debug("getMatrixArray[][]; found matrix " + fixtureNameTemplate + " with maxX=" + maxX + ", maxY=" + maxY); FixtureController[][] fc = new FixtureController[maxX][maxY]; for (int x=0; x<maxX; x++) { for (int y=0; y<maxY; y++) { String name = Text.replaceString(fixtureNameTemplate, "{x}", String.valueOf(x+1)); name = Text.replaceString(name, "{y}", String.valueOf(y+1)); fc[x][y] = c.getFixtureControllerByNameNoEx(name); if (fc[x][y]==null) { logger.warn("getMatrixArray[][]; missing fixture '" + name + "' in matrix"); } } } return fc; } public BufferedImage[] getImages(String resourceName) { // InputStream is = getController().getClass().getResourceAsStream("matrix-animations/" + resourceName); try { File f = new File("C:/data/tomcat/eclipse-embedded/dmx-web/matrix-animations/" + resourceName); InputStream is = new FileInputStream("C:/data/tomcat/eclipse-embedded/dmx-web/matrix-animations/" + resourceName); if (is==null) { logger.error("No resource found at 'C:/data/tomcat/eclipse-embedded/dmx-web/matrix-animations/matrix-animations/" + resourceName + "'"); return null; } ImageInputStream stream = ImageIO.createImageInputStream(f); Iterator readers = ImageIO.getImageReaders(stream); if (!readers.hasNext()) { logger.error("no image reader found"); return null; } ImageReader reader = (ImageReader) readers.next(); reader.setInput(stream); // don't omit this line! int numImages = reader.getNumImages(true); // don't use false! logger.info("numImages = " + numImages); BufferedImage[] bi = new BufferedImage[numImages]; for (int i = 0; i < numImages; i++) { BufferedImage frame = reader.read(i); /* BufferedImage resizedImage = new BufferedImage(maxX, maxY, BufferedImage.TYPE_INT_ARGB); Graphics2D g = resizedImage.createGraphics(); g.setComposite(AlphaComposite.Src); // g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); // g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.drawImage(frame, 0, 0, maxX, maxY, null); g.dispose(); */ bi[i] = frame; //System.out.println("image[" + i + "] = " + image); } is.close(); return bi; } catch (Exception e) { logger.error("Could not read resource 'C:/data/tomcat/eclipse-embedded/dmx-web/matrix-animations/matrix-animations/" + resourceName + "'", e); return null; } } public void pause() {} public void stop() {} protected void reset() { super.reset(); logger.debug("reset()"); for (int x=0; x<maxX; x++) { for (int y=0; y<maxY; y++) { matrix[x][y].blackOut(); } } } public void play() { logger.debug("play()"); reset(); //int frameNum = 0; BufferedImage bi = anim[0]; int width = bi.getWidth(); int scrollOffset = 0; while (!isCancelled()) { for (int x=0; x<maxX; x++) { for (int y=0; y<maxY; y++) { Color c = new Color(bi.getRGB((x + scrollOffset) % width, y)); matrix[x][y].setColor(c); } } //frameNum = (frameNum+1) % anim.length; scrollOffset++; waitFor(100); } logger.debug("play() completed"); } }
9233fa8a0272e7a00c6e1a48a00dd9ec00affdf2
1,280
java
Java
Codes/String/string_data_count.java
datta-agni/Java-Codes
915b8415cfc70aa81dbaefcab31eeb9e4f7a5f77
[ "MIT" ]
null
null
null
Codes/String/string_data_count.java
datta-agni/Java-Codes
915b8415cfc70aa81dbaefcab31eeb9e4f7a5f77
[ "MIT" ]
null
null
null
Codes/String/string_data_count.java
datta-agni/Java-Codes
915b8415cfc70aa81dbaefcab31eeb9e4f7a5f77
[ "MIT" ]
null
null
null
29.767442
80
0.460938
996,769
import java.util.Scanner; // count vowels, consonants, digits, and spaces public class string_data_count { public static void main(String[] args) { Scanner input = new Scanner(System.in); String line = input.nextLine(); int vowels = 0, consonants = 0, digits = 0, spaces = 0; line = line.toLowerCase(); for (int i = 0; i < line.length(); ++i) { char ch = line.charAt(i); // check if character is any of a, e, i, o, u if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') { ++vowels; } // check if character is in between a to z else if ((ch >= 'a' && ch <= 'z')) { ++consonants; } // check if character is in between 0 to 9 else if (ch >= '0' && ch <= '9') { ++digits; } // check if character is a white space else if (ch == ' ') { ++spaces; } } System.out.println("Vowels: " + vowels); System.out.println("Consonants: " + consonants); System.out.println("Digits: " + digits); System.out.println("White spaces: " + spaces); input.close(); } }
9233faaaf787e41dd1d913779020f61fda8c151f
1,775
java
Java
Agenda/src/Model/JavaBeans.java
marceloaikawafatec/PROJETO-AGENDA-DE-CONTATOS-JAVA-WEB-
17b2979c5805510028cb9325bf4597b61e671ebf
[ "MIT" ]
null
null
null
Agenda/src/Model/JavaBeans.java
marceloaikawafatec/PROJETO-AGENDA-DE-CONTATOS-JAVA-WEB-
17b2979c5805510028cb9325bf4597b61e671ebf
[ "MIT" ]
null
null
null
Agenda/src/Model/JavaBeans.java
marceloaikawafatec/PROJETO-AGENDA-DE-CONTATOS-JAVA-WEB-
17b2979c5805510028cb9325bf4597b61e671ebf
[ "MIT" ]
null
null
null
14.669421
79
0.611268
996,770
package Model; // TODO: Auto-generated Javadoc /** * The Class JavaBeans. */ public class JavaBeans { /** The idcontatos. */ private int idcontatos; /** The nome. */ private String nome; /** The telefone. */ private String telefone; /** The email. */ private String email; /** * Instantiates a new java beans. */ public JavaBeans() { super(); } /** * Instantiates a new java beans. * * @param idcontatos the idcontatos * @param nome the nome * @param telefone the telefone * @param email the email */ public JavaBeans(int idcontatos, String nome, String telefone, String email) { super(); this.idcontatos = idcontatos; this.nome = nome; this.telefone = telefone; this.email = email; } /** * Gets the idcontatos. * * @return the idcontatos */ public int getIdcontatos() { return idcontatos; } /** * Sets the idcontatos. * * @param idcontatos the new idcontatos */ public void setIdcontatos(int idcontatos) { this.idcontatos = idcontatos; } /** * Gets the nome. * * @return the nome */ public String getNome() { return nome; } /** * Sets the nome. * * @param nome the new nome */ public void setNome(String nome) { this.nome = nome; } /** * Gets the telefone. * * @return the telefone */ public String getTelefone() { return telefone; } /** * Sets the telefone. * * @param telefone the new telefone */ public void setTelefone(String telefone) { this.telefone = telefone; } /** * Gets the email. * * @return the email */ public String getEmail() { return email; } /** * Sets the email. * * @param email the new email */ public void setEmail(String email) { this.email = email; } }
9233fb62f5a8acbebb5b354e302ca399635a7fe7
832
java
Java
test/main/BitManipulatorTest.java
mikhsol/crackingTheCodingInterviewJava
5b60512bb57534a4b17d33f188d2aac59e52621d
[ "BSD-3-Clause" ]
null
null
null
test/main/BitManipulatorTest.java
mikhsol/crackingTheCodingInterviewJava
5b60512bb57534a4b17d33f188d2aac59e52621d
[ "BSD-3-Clause" ]
null
null
null
test/main/BitManipulatorTest.java
mikhsol/crackingTheCodingInterviewJava
5b60512bb57534a4b17d33f188d2aac59e52621d
[ "BSD-3-Clause" ]
null
null
null
26.83871
109
0.632212
996,771
package main; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; class BitManipulatorTest { @Test void testSetBitsToPosition() { int N = 0b1000000000; int M = 0b10011; int i = 2; int j = 6; int Output = 0b1000100110; assertEquals(Output, BitManipulator.insertBitsToPosition(N, M, i, j)); } @Test void testBinaryRepresentationOfDoubleFromZeroToOne() { assertEquals("Error", BitManipulator.doubleAsBinString(1.5)); assertEquals("Error", BitManipulator.doubleAsBinString(-0.2)); // In = 0.75 assertEquals(".11", BitManipulator.doubleAsBinString(.5*1 + .5*.5 *1)); assertEquals(".1101", BitManipulator.doubleAsBinString(.5*1 + .5*.5*1 + .5*.5*.5*0 + .5*.5*.5*.5*1)); } }
9233fbef3a6be32c2cf9432fd36d79ca00e8f896
2,382
java
Java
app/src/main/java/com/birdbraintechnologies/birdblox/Robots/RobotStates/RobotStateObjects/Buzzer.java
BirdBrainTechnologies/BirdBlox-FinchBlox-Android
7730e22494dfd10797cbb0ad559612754826191b
[ "MIT" ]
1
2017-08-02T16:51:41.000Z
2017-08-02T16:51:41.000Z
app/src/main/java/com/birdbraintechnologies/birdblox/Robots/RobotStates/RobotStateObjects/Buzzer.java
BirdBrainTechnologies/BirdBlox-FinchBlox-Android
7730e22494dfd10797cbb0ad559612754826191b
[ "MIT" ]
null
null
null
app/src/main/java/com/birdbraintechnologies/birdblox/Robots/RobotStates/RobotStateObjects/Buzzer.java
BirdBrainTechnologies/BirdBlox-FinchBlox-Android
7730e22494dfd10797cbb0ad559612754826191b
[ "MIT" ]
5
2017-03-06T19:55:30.000Z
2018-10-10T06:16:17.000Z
21.459459
103
0.538203
996,772
package com.birdbraintechnologies.birdblox.Robots.RobotStates.RobotStateObjects; import android.util.Log; import java.util.Arrays; /** * @author Shreyan Bakshi (AppyFizz). */ public class Buzzer extends RobotStateObject { private byte volume; private short frequency; public Buzzer() { //has to be chanc volume = 0; frequency = 0; } public Buzzer(byte v, short f) { volume = v; frequency = f; } // TODO: IMPLEMENT SETTERS CORRECTLY (CLAMP AND BYTE/SHORT/CONVERSION) public byte getVolume() { return volume; } public void setVolume(byte v) { this.volume = v; } public void setVolume(int v) { this.volume = (byte) v; } public short getFrequency() { return frequency; } public void setFrequency(byte f) { this.frequency = (short) f; } public void setFrequency(short f) { this.frequency = f; } public void setFrequency(int f) { this.frequency = (short) f; } public int[] getVF() { int[] vf = new int[2]; vf[0] = (int) volume; vf[1] = (int) frequency; return vf; } private void setVF(byte v, short f) { volume = v; frequency = f; } private void setVF(int v, int f) { volume = (byte) v; frequency = (short) f; } private void setVF(int[] vf) { try { volume = (byte) vf[0]; frequency = (short) vf[1]; } catch (ArrayIndexOutOfBoundsException | ArrayStoreException | NegativeArraySizeException e) { Log.e("Buzzer", "setVF: " + e.getMessage()); } } @Override public void setValue(int... values) { if (values.length == 2) { setVF(values[0], values[1]); } } @Override public void setValue(byte... values) { if (values.length == 2) { setVF(values[0], values[1]); } } @Override public boolean equals(Object buzzer) { // self check if (this == buzzer) return true; // null check if (buzzer == null) return false; // type check and cast if (getClass() != buzzer.getClass()) return false; return Arrays.equals(this.getVF(), ((Buzzer) buzzer).getVF()); } }
9233fcf25cc3200d56c616d6a16831090a2ab57b
5,388
java
Java
cs6301-probabilistic-graphical-models/ANDORSampling/src/utd/cs/pgm/ao/core/tree/JunctionTree.java
gsteelman/utd
65bf3b81b7a089612f6c7546aa0bbdfbdcdb334e
[ "Apache-2.0" ]
3
2017-03-17T15:15:11.000Z
2020-10-01T16:05:17.000Z
cs6301-probabilistic-graphical-models/ANDORSampling/src/utd/cs/pgm/ao/core/tree/JunctionTree.java
gsteelman/utd
65bf3b81b7a089612f6c7546aa0bbdfbdcdb334e
[ "Apache-2.0" ]
null
null
null
cs6301-probabilistic-graphical-models/ANDORSampling/src/utd/cs/pgm/ao/core/tree/JunctionTree.java
gsteelman/utd
65bf3b81b7a089612f6c7546aa0bbdfbdcdb334e
[ "Apache-2.0" ]
7
2016-02-07T22:56:26.000Z
2021-02-26T02:50:28.000Z
32.654545
153
0.693207
996,773
package utd.cs.pgm.ao.core.tree; import java.util.ArrayList; import java.util.List; import java.util.Stack; import java.util.concurrent.CompletionService; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import utd.cs.pgm.ao.core.INode; import utd.cs.pgm.ao.core.JTNode; import utd.cs.pgm.ao.core.LeafNodeTask; import utd.cs.pgm.core.graphmodel.GraphModel; import utd.cs.pgm.core.variable.IVariable; import utd.cs.pgm.probability.DynamicDistributionDos; import utd.cs.pgm.util.LogDouble; // The junction tree/graph for computing the partition function approximation. public class JunctionTree implements IJunctionTree { // The root node has its parent as null. protected JTNode root = new JTNode(null); // A list of the leaves in the junction graph. protected ArrayList<JTNode> leaves = new ArrayList<JTNode>(); // A pointer to the graphmodel which this junction graph is built from. protected GraphModel gm; // The samples generated from the proposal distribution Q! protected ArrayList<ArrayList<Integer>> samples; public JunctionTree(GraphModel g, ArrayList<ArrayList<Integer>> s){ this.gm = g; this.samples = s; } // This function builds the junction graph by recursively, depth first, // expanding each node. Fill in the node's context, add functions to it, // ad entries from Q to it, if it's a leaf, add it to the leaves set, // then expand the children nodes. @Override public void buildTree(INode pt_n, JTNode jt_n, Stack<IVariable> context, DynamicDistributionDos Q) { context.push(pt_n.getVariable()); jt_n.setContext(context); jt_n.addFunctions(gm); jt_n.fillOutSparseTable(samples, Q); if(pt_n.getChildren().isEmpty()) { leaves.add(jt_n); } // Now recursively (depth first) expand the child nodes. int size = pt_n.getChildren().size(); for(int i = 0; i < size; i++){ JTNode temp = new JTNode(jt_n); jt_n.addChild(temp); buildTree(pt_n.getChildren().get(i), temp, context, Q); } // Necessary to clear this cluster's added context when the calls go back // up the graph one level. context.pop(); } // This function was supposed to build the junction grpah in parallel, thus // speeding up the building process. However, due to messing with Q and with F // in parallel, there are some nuances we didn't have time to fix. We'll // come back to it later. public void buildTreeDos(INode pt_n, JTNode jt_n, Stack<IVariable> context, DynamicDistributionDos Q) throws InterruptedException, ExecutionException { ExecutorService es = Executors.newFixedThreadPool(1); CompletionService<JTBuildTaskRetType> pool = new ExecutorCompletionService<JTBuildTaskRetType>(es); //start at the root pool.submit(new JTBuildTask(jt_n, pt_n, context, Q, gm, samples)); //every time a node returns, add its children as new tasks and any leaves are added to leaves. int total = 1; for(int i = 0; i < total; i++){ JTBuildTaskRetType ret = pool.take().get(); for(JTBuildTask jtb : ret.tasks){ pool.submit(jtb); ++total; } for(JTNode jtl : ret.leaves) this.leaves.add(jtl); } //shutdown the pool es.shutdown(); } @Override public JTNode getRoot() { return root; } @Override public void setRoot(JTNode jt) { root = jt; } @Override public ArrayList<JTNode> getLeaves() { return leaves; } // String for this tree is build recursively. Yurp. public String toStringHelper(int indent, JTNode n) { StringBuilder sb = new StringBuilder(); sb.append(n.getContext().get(n.getContext().size()-1).getId()); if(!n.getChildren().isEmpty()) sb.append("->"); for(JTNode t : n.getChildren()){ sb.append(toStringHelper(indent+1, t)); } sb.append("\n"); for(int i = 0; i < indent; i++) sb.append(" "); return sb.toString(); } @Override public String toString() { return toStringHelper(0,root); } // Parallelized computation of the partition frunction approximation (z) by // starting at the leaf nodes and computing up. public LogDouble computeZ() throws InterruptedException, ExecutionException { // Use a thread pool of size 16. ExecutorService pool = Executors.newFixedThreadPool(16); // Stores a list of values computed at each node. Each value comes from // JTNode.computeNodeValue. Thus, if the value is nonzero, it is the // partition function approximation. List<Future<LogDouble>> futures = new ArrayList<Future<LogDouble>>(leaves.size()); // Add a task to the work queue for each leaf node. for(int i = 0; i < leaves.size(); i++) { futures.add(pool.submit(new LeafNodeTask(leaves.get(i)))); } // Call .get() on each future, thus making it compute. LogDouble z = LogDouble.LS_ONE; for(Future<LogDouble> future : futures) { LogDouble clusterValue = future.get(); // If the value of the cluster after its computations is nonzero, consider // it the partition function approximation and store it. if(clusterValue != LogDouble.LS_ZERO) { z = clusterValue; } } pool.shutdown(); return z; } }
9233fd8fc1f4662f7e2760826e093fdfd6a182bb
915
java
Java
src/com/vijay/creational/singleton/LazyLoadingByInstanceVariable.java
vijaykumarsrivastava/design-pattern
54255d65de0f057ae7b25ea94371b169419c3ade
[ "Apache-2.0" ]
null
null
null
src/com/vijay/creational/singleton/LazyLoadingByInstanceVariable.java
vijaykumarsrivastava/design-pattern
54255d65de0f057ae7b25ea94371b169419c3ade
[ "Apache-2.0" ]
null
null
null
src/com/vijay/creational/singleton/LazyLoadingByInstanceVariable.java
vijaykumarsrivastava/design-pattern
54255d65de0f057ae7b25ea94371b169419c3ade
[ "Apache-2.0" ]
null
null
null
26.142857
81
0.765027
996,774
package com.vijay.creational.singleton; import com.vijay.util.Print; /** * * @author vijay * */ public class LazyLoadingByInstanceVariable { private static LazyLoadingByInstanceVariable lazyLoadingByInstanceVariable; private LazyLoadingByInstanceVariable() { synchronized (LazyLoadingByInstanceVariable.class) { if (lazyLoadingByInstanceVariable != null) { Print.print("Can't construct object because one instance is already there."); throw new IllegalStateException(); } } Print.print("LazyLoadingByInstanceVariable constructed."); } public static LazyLoadingByInstanceVariable getInstance() { if (lazyLoadingByInstanceVariable == null) { synchronized (LazyLoadingByInstanceVariable.class) { if (lazyLoadingByInstanceVariable == null) { lazyLoadingByInstanceVariable = new LazyLoadingByInstanceVariable(); } } } return lazyLoadingByInstanceVariable; } }
9233fe0b4197ced81b6b9a94b7676bd03fc2bba9
6,948
java
Java
algorithm_helper/src/test/java/de/metanome/algorithm_helper/data_structures/SubSetGraphTest.java
sekruse/Metanome
0e272e04b6a9f6490a43023739766b19dbdf5a1e
[ "Apache-2.0", "MIT" ]
178
2015-01-29T05:41:51.000Z
2022-03-16T04:35:15.000Z
algorithm_helper/src/test/java/de/metanome/algorithm_helper/data_structures/SubSetGraphTest.java
sekruse/Metanome
0e272e04b6a9f6490a43023739766b19dbdf5a1e
[ "Apache-2.0", "MIT" ]
145
2015-01-08T14:20:42.000Z
2021-11-23T17:16:50.000Z
algorithm_helper/src/test/java/de/metanome/algorithm_helper/data_structures/SubSetGraphTest.java
sekruse/Metanome
0e272e04b6a9f6490a43023739766b19dbdf5a1e
[ "Apache-2.0", "MIT" ]
64
2015-03-16T20:12:51.000Z
2022-02-21T07:54:01.000Z
32.018433
114
0.727547
996,775
/** * Copyright 2014-2016 by Metanome Project * * 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.metanome.algorithm_helper.data_structures; import de.metanome.test_helper.EqualsAndHashCodeTester; import org.hamcrest.collection.IsIterableContainingInAnyOrder; import org.junit.Test; import java.util.Collection; import java.util.List; import java.util.Set; import static org.junit.Assert.*; /** * Tests for {@link de.metanome.algorithm_helper.data_structures.SubSetGraph} * * @author Jens Ehrlich * @author Jakob Zwiener */ public class SubSetGraphTest { /** * Test method for {@link de.metanome.algorithm_helper.data_structures.SubSetGraph#add(ColumnCombinationBitset)} * <p/> After inserting a column combination a subgraph for every set bit should exist. Add should * return the graph after addition. */ @Test public void testAdd() { // Setup SubSetGraph graph = new SubSetGraph(); ColumnCombinationBitset columnCombination = new ColumnCombinationBitset(2, 4, 7); // Execute functionality SubSetGraph graphAfterAdd = graph.add(columnCombination); // Check result // Check existence of column indices in subgraphs by iterating SubSetGraph actualSubGraph = graph; for (int setColumnIndex : columnCombination.getSetBits()) { assertTrue(actualSubGraph.subGraphs.containsKey(setColumnIndex)); actualSubGraph = actualSubGraph.subGraphs.get(setColumnIndex); } // Check add return value assertSame(graph, graphAfterAdd); } /** * Test method for {@link SubSetGraph#addAll(java.util.Collection)} <p/> After inserting all * column combinations the graph should be equal to the expected graph from the fixture. AddAll * should return the graph after addition. */ @Test public void testAddAll() { // Setup SubSetGraphFixture fixture = new SubSetGraphFixture(); SubSetGraph graph = new SubSetGraph(); // Expected values Collection<ColumnCombinationBitset> expectedColumnCombinations = fixture.getExpectedIncludedColumnCombinations(); SubSetGraph expectedGraph = fixture.getGraph(); // Execute functionality SubSetGraph graphAfterAddAll = graph.addAll(expectedColumnCombinations); // Check result assertEquals(expectedGraph, graph); assertSame(graph, graphAfterAddAll); } /** * Test method for {@link SubSetGraph#getExistingSubsets(ColumnCombinationBitset)} */ @Test public void testGetExistingSubsets() { // Setup SubSetGraphFixture fixture = new SubSetGraphFixture(); SubSetGraph graph = fixture.getGraph(); ColumnCombinationBitset columnCombinationToQuery = fixture.getColumnCombinationForSubsetQuery(); // Execute functionality List<ColumnCombinationBitset> actualSubsets = graph.getExistingSubsets(columnCombinationToQuery); // Check result assertThat(actualSubsets, IsIterableContainingInAnyOrder .containsInAnyOrder(fixture.getExpectedSubsetsFromQuery())); } /** * Test method for {@link SubSetGraph#getExistingSubsets(ColumnCombinationBitset)} * <p/> * Tests a special case with an empty graph. An empty list should be returned. */ @Test public void testGetExistingSubsetsOnEmptyGraph() { // Setup SubSetGraph graph = new SubSetGraph(); // Execute functionality List<ColumnCombinationBitset> actualSubsets = graph.getExistingSubsets(new ColumnCombinationBitset(1, 3, 5)); // Check result assertTrue(actualSubsets.isEmpty()); } /** * Test for the method {@link SubSetGraph#containsSubset(ColumnCombinationBitset)} )} */ @Test public void testContainsSubset() { //Setup SubSetGraphFixture fixture = new SubSetGraphFixture(); SubSetGraph actualGraph = fixture.getGraph(); //Execute functionality assertTrue(actualGraph.containsSubset(fixture.getExpectedIncludedColumnCombinations().get(0))); assertTrue(actualGraph.containsSubset(fixture.getColumnCombinationForSubsetQuery())); assertFalse(actualGraph.containsSubset(new ColumnCombinationBitset(1))); //Check Result } /** * Test for the method {@link SubSetGraph#containsSubset(ColumnCombinationBitset)} * <p/> * Tests a special case with an empty graph. False should be returned if the graph is empty. */ @Test public void testContainsSubsetOnEmptyGraph() { //Setup SubSetGraph actualGraph = new SubSetGraph(); //Execute functionality assertFalse(actualGraph.containsSubset(new ColumnCombinationBitset(1, 3))); //Check Result } /** * Test method for {@link SubSetGraph#isEmpty()} */ @Test public void testIsEmpty() { // Setup SubSetGraph emptyGraph = new SubSetGraph(); SubSetGraph nonEmptyGraph = new SubSetGraph(); nonEmptyGraph.add(new ColumnCombinationBitset(10)); // Execute functionality // Check result assertTrue(emptyGraph.isEmpty()); assertFalse(nonEmptyGraph.isEmpty()); } /** * Test method {@link SubSetGraph#equals(Object)} and {@link SubSetGraph#hashCode()} */ @Test public void testEqualsAndHashCode() { // Setup SubSetGraph actualGraph = new SubSetGraph(); SubSetGraph equalsGraph = new SubSetGraph(); SubSetGraph notEqualsGraph = new SubSetGraph(); actualGraph.add(new ColumnCombinationBitset(2, 5, 10, 20)); actualGraph.add((new ColumnCombinationBitset(2, 5, 8, 15))); equalsGraph.add((new ColumnCombinationBitset(2, 5, 8, 15))); equalsGraph.add(new ColumnCombinationBitset(2, 5, 10, 20)); notEqualsGraph.add(new ColumnCombinationBitset(2, 5, 12, 20)); notEqualsGraph.add((new ColumnCombinationBitset(2, 5, 10, 15))); // Execute functionality // Check result EqualsAndHashCodeTester<SubSetGraph> tester = new EqualsAndHashCodeTester<>(); tester.performBasicEqualsAndHashCodeChecks(actualGraph, equalsGraph, notEqualsGraph); } /** * Test method for {@link SubSetGraph#getMinimalSubsets()} */ @Test public void testGetMinimalSubsets() { //Setup SubSetGraphFixture fixture = new SubSetGraphFixture(); SubSetGraph graph = fixture.getGraph(); //Execute functionality Set<ColumnCombinationBitset> actualMinimalSubsets = graph.getMinimalSubsets(); // Check result assertThat(actualMinimalSubsets, IsIterableContainingInAnyOrder .containsInAnyOrder(fixture.getExpectedMinimalSubsets())); } }
9234001efd8c362e9e22364c851cd4404c0355bd
5,023
java
Java
BlueBridgeGP/src/main/java/de/mark225/bluebridge/griefprevention/addon/GriefPreventionIntegration.java
Mark-225/BlueBridge
b4eaa310a5693a8f4d953dcd8fd087289b303234
[ "MIT" ]
12
2020-11-16T10:02:32.000Z
2021-12-01T06:32:46.000Z
BlueBridgeGP/src/main/java/de/mark225/bluebridge/griefprevention/addon/GriefPreventionIntegration.java
Mark-225/BlueBridge
b4eaa310a5693a8f4d953dcd8fd087289b303234
[ "MIT" ]
12
2021-05-22T21:21:32.000Z
2022-01-15T23:02:31.000Z
BlueBridgeGP/src/main/java/de/mark225/bluebridge/griefprevention/addon/GriefPreventionIntegration.java
Mark-225/BlueBridge
b4eaa310a5693a8f4d953dcd8fd087289b303234
[ "MIT" ]
2
2021-05-22T19:47:04.000Z
2021-09-01T18:00:17.000Z
46.082569
315
0.689827
996,776
package de.mark225.bluebridge.griefprevention.addon; import com.flowpowered.math.vector.Vector2d; import de.mark225.bluebridge.core.addon.ActiveAddonEventHandler; import de.mark225.bluebridge.core.region.RegionSnapshot; import de.mark225.bluebridge.core.region.RegionSnapshotBuilder; import de.mark225.bluebridge.griefprevention.BlueBridgeGP; import de.mark225.bluebridge.griefprevention.addon.listener.GriefPreventionListener; import de.mark225.bluebridge.griefprevention.config.BlueBridgeGPConfig; import me.ryanhamshire.GriefPrevention.Claim; import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.util.BoundingBox; import org.bukkit.Bukkit; import java.awt.*; import java.util.*; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; public class GriefPreventionIntegration{ public void init(){ Bukkit.getPluginManager().registerEvents(new GriefPreventionListener(), BlueBridgeGP.getInstance()); } public void addOrUpdateClaim(Claim claim){ //Schedule updates for all child claims if(claim.children != null && !claim.children.isEmpty()){ for(Claim child : claim.children){ Bukkit.getScheduler().runTaskLater(BlueBridgeGP.getInstance(), () ->{ addOrUpdateClaim(child); }, 0l); } } ActiveAddonEventHandler.addOrUpdate(convertClaim(claim)); } private RegionSnapshot convertClaim(Claim claim){ //Figure out claim depth (how many layers of parents are above this claim) int layer = 0; Claim currentClaim = claim; while (currentClaim.parent != null){ layer++; currentClaim = currentClaim.parent; } BoundingBox boundingBox = trimmedBoundingBox(claim); List<Vector2d> points = boundingBoxToPolyCorners(boundingBox); String label = claim.isAdminClaim() ? BlueBridgeGPConfig.getInstance().adminDisplayName() : claim.getOwnerName() + "'s Claim"; int claimFloor = claim.getLesserBoundaryCorner().getBlockY(); int claimCeiling = claim.getGreaterBoundaryCorner().getWorld().getMaxHeight(); boolean extrude = BlueBridgeGPConfig.getInstance().defaultExtrude(); float heightModifier = 0f; //Adjust height if plugin is configured to layer child claims and 3D markers are off if(!extrude && BlueBridgeGPConfig.getInstance().layerChildren()){ //Add 1/16 of a block per layer depth heightModifier = (float) layer * 0.0625f; } Color borderColor = claim.isAdminClaim() ? BlueBridgeGPConfig.getInstance().adminOutlineColor() : BlueBridgeGPConfig.getInstance().defaultOutlineColor(); Color fillColor = claim.isAdminClaim() ? BlueBridgeGPConfig.getInstance().adminFillColor() : BlueBridgeGPConfig.getInstance().defaultColor(); return new RegionSnapshotBuilder(BlueBridgeGP.getInstance().getAddon(), claim.getID().toString(), points, claim.getLesserBoundaryCorner().getWorld().getUID()) .setHtmlDisplay(label) .setShortName(label) .setHeight(extrude ? claimFloor : (float) BlueBridgeGPConfig.getInstance().renderHeight() + heightModifier) .setExtrude(extrude) .setUpperHeight(claimCeiling) .setColor(fillColor) .setBorderColor(borderColor) .build(); } public void removeClaim(Claim claim){ ActiveAddonEventHandler.delete(new RegionSnapshotBuilder(BlueBridgeGP.getInstance().getAddon(), claim.getID().toString(), Collections.emptyList(), claim.getLesserBoundaryCorner().getWorld().getUID()).build()); } public List<RegionSnapshot> getAllClaims(UUID world){ return GriefPrevention.instance.dataStore.getClaims().stream().filter(claim -> claim.getLesserBoundaryCorner().getWorld().getUID().equals(world)).flatMap(claim -> Stream.concat(Stream.of(claim.children.toArray(new Claim[0])),Stream.of(claim))).map(claim -> convertClaim(claim)).collect(Collectors.toList()); } private BoundingBox trimmedBoundingBox(Claim claim){ BoundingBox bb = new BoundingBox(claim); while(claim.parent != null){ claim = claim.parent; BoundingBox parentBox = new BoundingBox(claim); //Failsafe for parent claims that don't overlap with their child. Should probably never happen. if(!parentBox.intersects(bb)) return bb; bb = parentBox.intersection(bb); } return bb; } private List<Vector2d> boundingBoxToPolyCorners(BoundingBox bb){ List<Vector2d> points = new ArrayList<>(); points.add(new Vector2d(bb.getMinX(), bb.getMinZ())); points.add(new Vector2d(bb.getMaxX() + 1, bb.getMinZ())); points.add(new Vector2d(bb.getMaxX() + 1, bb.getMaxZ() + 1)); points.add(new Vector2d(bb.getMinX(), bb.getMaxZ() + 1)); return points; } }
92340175c5b7c9b3afc08ed880bc7870a70fdf56
2,012
java
Java
vertx-config/src/test/java/io/vertx/config/verticle/VerticleDeploymentTest.java
LyndonArmitage/vertx-config
f9b737ac0d90997ddbc36b8b5edf2e495edd4acf
[ "Apache-2.0" ]
null
null
null
vertx-config/src/test/java/io/vertx/config/verticle/VerticleDeploymentTest.java
LyndonArmitage/vertx-config
f9b737ac0d90997ddbc36b8b5edf2e495edd4acf
[ "Apache-2.0" ]
null
null
null
vertx-config/src/test/java/io/vertx/config/verticle/VerticleDeploymentTest.java
LyndonArmitage/vertx-config
f9b737ac0d90997ddbc36b8b5edf2e495edd4acf
[ "Apache-2.0" ]
null
null
null
31.936508
126
0.700298
996,777
package io.vertx.config.verticle; import io.vertx.config.ConfigRetriever; import io.vertx.config.ConfigRetrieverOptions; import io.vertx.config.ConfigStoreOptions; import io.vertx.core.DeploymentOptions; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(VertxUnitRunner.class) public class VerticleDeploymentTest { private Vertx vertx; @Before public void setUp() { vertx = Vertx.vertx(); } @After public void tearDown() { vertx.close(); } @Test public void testDeploymentOfVerticles(TestContext ctxt) { Async async1 = ctxt.async(); Async async2 = ctxt.async(); ConfigRetriever retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions() .addStore(new ConfigStoreOptions().setType("file").setConfig(new JsonObject().put("path", "verticles.json")))); retriever.getConfig(json -> { ctxt.assertTrue(json.succeeded()); JsonObject a = json.result().getJsonObject("a"); JsonObject b = json.result().getJsonObject("b"); vertx.deployVerticle(GreetingVerticle.class.getName(), new DeploymentOptions().setConfig(a), ctxt.asyncAssertSuccess()); vertx.deployVerticle(GreetingVerticle.class.getName(), new DeploymentOptions().setConfig(b), ctxt.asyncAssertSuccess()); vertx.eventBus().<String>send("greeting/hello", "", response -> { ctxt.assertTrue(response.succeeded()); String body = response.result().body(); ctxt.assertEquals(body, "hello"); async1.complete(); }); vertx.eventBus().<String>send("greeting/bonjour", "", response -> { ctxt.assertTrue(response.succeeded()); String body = response.result().body(); ctxt.assertEquals(body, "bonjour"); async2.complete(); }); }); } }
923402783c421e3518f84ccefd0486eba9f5500e
1,473
java
Java
grpc-spring-boot-samples/grpc-spring-boot-sample-client/src/main/java/sample/java/xyz/srclab/grpc/spring/boot/client/BaseClientInterceptor.java
srclab-projects/srclab-message
608ecf76915a57b08150b62cbf4ee379f494517e
[ "Apache-2.0" ]
1
2021-05-20T01:39:59.000Z
2021-05-20T01:39:59.000Z
grpc-spring-boot-samples/grpc-spring-boot-sample-client/src/main/java/sample/java/xyz/srclab/grpc/spring/boot/client/BaseClientInterceptor.java
srclab-projects/srclab-message
608ecf76915a57b08150b62cbf4ee379f494517e
[ "Apache-2.0" ]
null
null
null
grpc-spring-boot-samples/grpc-spring-boot-sample-client/src/main/java/sample/java/xyz/srclab/grpc/spring/boot/client/BaseClientInterceptor.java
srclab-projects/srclab-message
608ecf76915a57b08150b62cbf4ee379f494517e
[ "Apache-2.0" ]
null
null
null
35.926829
116
0.567549
996,778
package sample.java.xyz.srclab.grpc.spring.boot.client; import io.grpc.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class BaseClientInterceptor implements ClientInterceptor { private static final Logger logger = LoggerFactory.getLogger(BaseClientInterceptor.class); @Override public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall( MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) { logger.info(">>>>interceptor: " + method); return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(next.newCall(method, callOptions)) { @Override public void start(Listener<RespT> responseListener, Metadata headers) { super.start( new ForwardingClientCallListener.SimpleForwardingClientCallListener<RespT>(responseListener) { @Override public void onHeaders(Metadata headers) { super.onHeaders(headers); } @Override public void onMessage(RespT message) { super.onMessage(message); } }, headers ); } @Override public void sendMessage(ReqT message) { super.sendMessage(message); } }; } }
923402b02e2372492953a2354f99c19bc089a6c9
3,884
java
Java
Aula07b/Lutador.java
ErikDMCosta/CEV-Praticas_JAVA_POO
e8fc1aca0fa65e381cd90c55a27bfcb55e4a173d
[ "MIT" ]
null
null
null
Aula07b/Lutador.java
ErikDMCosta/CEV-Praticas_JAVA_POO
e8fc1aca0fa65e381cd90c55a27bfcb55e4a173d
[ "MIT" ]
null
null
null
Aula07b/Lutador.java
ErikDMCosta/CEV-Praticas_JAVA_POO
e8fc1aca0fa65e381cd90c55a27bfcb55e4a173d
[ "MIT" ]
null
null
null
27.546099
134
0.546344
996,779
package aula07b; public class Lutador { // Atributos private String nome; private String nacionalidade; private int idade; private float altura; private float peso; private String categoria; private int vitorias; private int derrotas; private int empates; // Métodos Personalizados public void apresentar() { System.out.println("----------"); System.out.println("CHEGOU A HORA! Apresentamos o lutador " + this.getNome()); System.out.println("Diretamente de " + this.getNacionalidade()); System.out.println("com " + this.getIdade() + " anos e " + this.getAltura() + " m de altura"); System.out.println("pesando " + this.getPeso() + " Kg"); System.out.println(this.getVitorias() + " vitorias"); System.out.println(this.getEmpates() + " empates e "); System.out.println(this.getDerrotas() + " derrotas"); } public void status () { System.out.println(this.getNome() + " é um peso " + this.getCategoria()); System.out.println("ganhou " + this.getVitorias() + " vezes"); System.out.println("empatou " + this.getEmpates() + " vezes"); System.out.println("perdeu " + this.getDerrotas() + " vezes"); } public void ganharLuta() { this.setVitorias(this.getVitorias() + 1); } public void perderLuta() { this.setDerrotas(this.getDerrotas() + 1); } public void empatarLuta() { this.setEmpates(this.getEmpates() +1); } // Métodos Especiais public Lutador(String nome, String nacionalidade, int idade, float altura, float peso, int vitorias, int derrotas, int empates) { this.setNome(nome); this.setNacionalidade(nacionalidade); this.setIdade(idade); this.setAltura(altura); this.setPeso(peso); this.setVitorias(vitorias); this.setDerrotas(derrotas); this.setEmpates(empates); } public String getNome () { return nome; } public void setNome (String nome) { this.nome = nome; } private String getNacionalidade () { return nacionalidade; } private void setNacionalidade (String nacionalidade) { this.nacionalidade = nacionalidade; } private int getIdade () { return idade; } private void setIdade (int idade) { this.idade = idade; } private double getAltura () { return altura; } private void setAltura(float altura) { this.altura = altura; } private double getPeso () { return peso; } private void setPeso (float peso) { this.peso = peso; this.setCategoria(); } public String getCategoria () { return categoria; } public void setCategoria () { if (this.peso < 52.2) { this.categoria = "Inválido"; } else if (this.peso <= 70.3) { this.categoria = "Leve"; } else if (this.peso <= 83.9) { this.categoria = "Médio"; } else if (this.peso <= 120.2) { this.categoria = "Pesado"; } else { this.categoria = "Inválido"; } } private int getVitorias () { return vitorias; } private void setVitorias (int vitorias) { this.vitorias = vitorias; } private int getDerrotas () { return derrotas; } private void setDerrotas (int derrotas) { this.derrotas = derrotas; } private int getEmpates () { return empates; } private void setEmpates (int empates) { this.empates = empates; } }
92340383e8c1fc28aa4572805395cbd47efbf3f4
1,609
java
Java
String/Easy_ImplStrstr_28.java
LinkWoong/LC-Solutions
98b2ce55f05f6acb672f20519f79ca9f4248961d
[ "MIT" ]
4
2019-05-15T10:40:34.000Z
2020-07-27T03:05:39.000Z
String/Easy_ImplStrstr_28.java
LinkWoong/LC-Solutions
98b2ce55f05f6acb672f20519f79ca9f4248961d
[ "MIT" ]
2
2019-08-20T15:34:33.000Z
2019-09-20T19:41:27.000Z
String/Easy_ImplStrstr_28.java
LinkWoong/LC-Solutions
98b2ce55f05f6acb672f20519f79ca9f4248961d
[ "MIT" ]
null
null
null
30.358491
142
0.544438
996,780
package Leetcode; /* Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystack = "hello", needle = "ll" Output: 2 Example 2: Input: haystack = "aaaaa", needle = "bba" Output: -1 Clarification: What should we return when needle is an empty string? This is a great question to ask during an interview. For the purpose of this problem, we will return 0 when needle is an empty string. This is consistent to C's strstr() and Java's indexOf(). */ public class Easy_ImplStrstr_28 { // 思路:先匹配第一个字符。匹配到以后,记录下index // 用两个指针分别检索haystack和needle的haystack.charAt(p1)和needle.charAt(p2), where p1和p2从index+1开始 // 退出条件:p1碰到haystack尾部 and 两个指针所指的字符一样,如果p1没到尾部就退出了说明有不匹配字符(不连续),返回-1 // 退出后返回第一次检索到的index public int strStr(String haystack, String needle) { if(needle.length() == 0) return 0; char first = needle.charAt(0); int max = haystack.length() - needle.length(); for(int i = 0; i <= max; i++){ if(haystack.charAt(i) != first){ while(i <= max && haystack.charAt(i) != first){ i++; } } if(i <= max){ int j = i + 1; int end = j + needle.length() - 1; for(int k = 1; j < end && haystack.charAt(j) == needle.charAt(k); k++){ j++; } if(j == end) return i; } } return -1; } }
9234040b2d1605177b77c2aa20c4ec064af3e287
500
java
Java
src/main/java/uk/gov/mca/beacons/api/gateways/AccountHolderGateway.java
madetech/mca-beacons-service
bdf6b57fb556add14037468361d4a3b5bf80b833
[ "MIT" ]
3
2021-01-20T15:12:36.000Z
2021-01-23T11:38:49.000Z
src/main/java/uk/gov/mca/beacons/api/gateways/AccountHolderGateway.java
mcagov/mca-beacons-service
5f0bb7329d4ca631b79bdbd6e4c5907a509bd893
[ "MIT" ]
109
2021-03-10T09:10:47.000Z
2022-02-22T10:04:30.000Z
src/main/java/uk/gov/mca/beacons/api/gateways/AccountHolderGateway.java
mcagov/mca-beacons-service
5f0bb7329d4ca631b79bdbd6e4c5907a509bd893
[ "MIT" ]
null
null
null
27.777778
78
0.826
996,781
package uk.gov.mca.beacons.api.gateways; import java.util.UUID; import uk.gov.mca.beacons.api.domain.AccountHolder; import uk.gov.mca.beacons.api.dto.CreateAccountHolderRequest; public interface AccountHolderGateway { AccountHolder getById(UUID id); AccountHolder getByAuthId(String authId); AccountHolder getByEmail(String email); AccountHolder create(CreateAccountHolderRequest createAccountHolderRequest); AccountHolder update(UUID id, AccountHolder createAccountHolderRequest); }
9234052ba9d6d3aa9c39b17a02196e452972f3cc
3,614
java
Java
flyway-core/src/main/java/org/flywaydb/core/internal/dbsupport/cockroachdb/CockroachDBDbSupport.java
felipebn/flyway
6d3a1a41683ff2b616400f661354576de038131b
[ "ECL-2.0", "Apache-2.0" ]
3
2018-09-06T01:15:13.000Z
2019-06-19T09:31:24.000Z
flyway-core/src/main/java/org/flywaydb/core/internal/dbsupport/cockroachdb/CockroachDBDbSupport.java
felipebn/flyway
6d3a1a41683ff2b616400f661354576de038131b
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
flyway-core/src/main/java/org/flywaydb/core/internal/dbsupport/cockroachdb/CockroachDBDbSupport.java
felipebn/flyway
6d3a1a41683ff2b616400f661354576de038131b
[ "ECL-2.0", "Apache-2.0" ]
5
2018-05-22T23:42:55.000Z
2020-03-19T16:24:45.000Z
29.622951
116
0.665191
996,782
/* * Copyright 2010-2017 Boxfuse GmbH * * 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.flywaydb.core.internal.dbsupport.cockroachdb; import org.flywaydb.core.internal.dbsupport.DbSupport; import org.flywaydb.core.internal.dbsupport.FlywaySqlException; import org.flywaydb.core.internal.dbsupport.JdbcTemplate; import org.flywaydb.core.internal.dbsupport.Schema; import org.flywaydb.core.internal.dbsupport.SqlStatementBuilder; import org.flywaydb.core.internal.dbsupport.Table; import org.flywaydb.core.internal.util.StringUtils; import java.sql.Connection; import java.sql.SQLException; import java.sql.Types; import java.util.concurrent.Callable; /** * CockroachDB-specific support. */ public class CockroachDBDbSupport extends DbSupport { /** * Creates a new instance. * * @param connection The connection to use. */ public CockroachDBDbSupport(Connection connection) { super(new JdbcTemplate(connection, Types.NULL)); } public String getDbName() { return "cockroachdb"; } public String getCurrentUserFunction() { return "(SELECT * FROM [SHOW SESSION_USER])"; } @Override public Schema getOriginalSchema() { if (originalSchema == null) { return null; } return getSchema(getFirstSchemaFromSearchPath(this.originalSchema)); } /* private -> testing */ String getFirstSchemaFromSearchPath(String searchPath) { String result = searchPath.replace(doQuote("$user"), "").trim(); if (result.startsWith(",")) { result = result.substring(1); } if (result.contains(",")) { result = result.substring(0, result.indexOf(",")); } result = result.trim(); // Unquote if necessary if (result.startsWith("\"") && result.endsWith("\"") && !result.endsWith("\\\"") && (result.length() > 1)) { result = result.substring(1, result.length() - 1); } return result; } @Override protected String doGetCurrentSchemaName() throws SQLException { return jdbcTemplate.queryForString("SHOW database"); } @Override protected void doChangeCurrentSchemaTo(String schema) throws SQLException { jdbcTemplate.execute("SET database = " + schema); } public boolean supportsDdlTransactions() { return false; } public String getBooleanTrue() { return "TRUE"; } public String getBooleanFalse() { return "FALSE"; } public SqlStatementBuilder createSqlStatementBuilder() { return new CockroachDBSqlStatementBuilder(); } @Override public String doQuote(String identifier) { return "\"" + StringUtils.replaceAll(identifier, "\"", "\"\"") + "\""; } @Override public Schema getSchema(String name) { return new CockroachDBSchema(jdbcTemplate, this, name); } @Override public boolean catalogIsSchema() { return false; } @Override public boolean useSingleConnection() { return false; } }
923406fe5858fc1e4ed9cabc0d447eafd9f6fb42
1,723
java
Java
hydrograph.engine/hydrograph.engine.transformation/src/test/java/hydrograph/engine/transformation/standardfunctions/StringDeFilterTest.java
oleksiy/Hydrograph
52836a0b7cecb84079a3edadfdd4ac7497eb2fde
[ "Apache-2.0" ]
129
2017-03-11T05:18:14.000Z
2018-10-31T21:50:58.000Z
hydrograph.engine/hydrograph.engine.transformation/src/test/java/hydrograph/engine/transformation/standardfunctions/StringDeFilterTest.java
oleksiy/Hydrograph
52836a0b7cecb84079a3edadfdd4ac7497eb2fde
[ "Apache-2.0" ]
58
2017-03-14T19:55:48.000Z
2018-09-19T15:48:31.000Z
hydrograph.engine/hydrograph.engine.transformation/src/test/java/hydrograph/engine/transformation/standardfunctions/StringDeFilterTest.java
oleksiy/Hydrograph
52836a0b7cecb84079a3edadfdd4ac7497eb2fde
[ "Apache-2.0" ]
116
2017-03-11T05:18:16.000Z
2018-10-27T16:48:19.000Z
33.784314
96
0.672084
996,783
/******************************************************************************* * Copyright 2017 Capital One Services, LLC and Bitwise, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License *******************************************************************************/ package hydrograph.engine.transformation.standardfunctions; import org.junit.Assert; import org.junit.Test; import static hydrograph.engine.transformation.standardfunctions.StringFunctions.stringDeFilter; /** * The Class StringDeFilterTest. * * @author Bitwise * */ public class StringDeFilterTest { @Test public void testStringFilter() { String input = "BitWise Solutions"; Assert.assertEquals("not matched", "BtW Soluton", stringDeFilter(input, "wise")); } @Test public void testSubStringIfInputIsNull() { String input = null; Assert.assertEquals("not matched", null, stringDeFilter(input, "Bit")); } @Test public void testStringFilterForDigits() { String input = "Apt. #2"; Assert.assertEquals("not matched", "Apt 2", stringDeFilter(input, ".#,%")); } @Test public void testStringFilterWithSapce() { String input = "Bit Wise"; Assert.assertEquals("not matched", "Bit Wi", stringDeFilter(input, "search")); } }
92340757dd104e7bc3c4d27f2314f7e4fee55139
2,827
java
Java
com/googlecode/jfilechooserbookmarks/core/Utils.java
Benn-Co/miniature-parakeet
94217f18822de64ebc291aaa70d964f93b06f735
[ "MIT" ]
null
null
null
com/googlecode/jfilechooserbookmarks/core/Utils.java
Benn-Co/miniature-parakeet
94217f18822de64ebc291aaa70d964f93b06f735
[ "MIT" ]
null
null
null
com/googlecode/jfilechooserbookmarks/core/Utils.java
Benn-Co/miniature-parakeet
94217f18822de64ebc291aaa70d964f93b06f735
[ "MIT" ]
null
null
null
27.182692
78
0.65405
996,784
/* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Utils.java * Copyright (C) 2008-2014 University of Waikato, Hamilton, New Zealand */ package com.googlecode.jfilechooserbookmarks.core; import java.io.PrintWriter; import java.io.StringWriter; /** * Class implementing some simple utility methods. * * @author FracPete (fracpete at waikat dot ac dot nz) */ public class Utils { /** * Returns the stacktrace of the throwable as string. * * @param t the throwable to get the stacktrace for * @return the stacktrace */ public static String throwableToString(Throwable t) { return throwableToString(t, -1); } /** * Returns the stacktrace of the throwable as string. * * @param t the throwable to get the stacktrace for * @param maxLines the maximum number of lines to print, <= 0 for all * @return the stacktrace */ public static String throwableToString(Throwable t, int maxLines) { StringWriter writer; StringBuilder result; String[] lines; int i; writer = new StringWriter(); t.printStackTrace(new PrintWriter(writer)); if (maxLines > 0) { result = new StringBuilder(); lines = writer.toString().split("\n"); for (i = 0; i < maxLines; i++) { if (i > 0) result.append("\n"); result.append(lines[i]); } } else { result = new StringBuilder(writer.toString()); } return result.toString(); } /** * Returns the current stack trace. * * @param maxDepth the maximum depth of the stack trace, <= 0 for full trace * @return the stack trace as string (multiple lines) */ public static String getStackTrace(int maxDepth) { StringBuilder result; Throwable th; StackTraceElement[] trace; int i; result = new StringBuilder(); th = new Throwable(); th.fillInStackTrace(); trace = th.getStackTrace(); if (maxDepth <= 0) maxDepth = trace.length - 1; maxDepth++; // we're starting at 1 not 0 maxDepth = Math.min(maxDepth, trace.length); for (i = 1; i < maxDepth; i++) { if (i > 1) result.append("\n"); result.append(trace[i]); } return result.toString(); } }
9234087396e5540d41588ec915db12f8808afc5d
986
java
Java
data/scripts/campaign/submarkets/SubmarketShared.java
KelvallRogers/moweaponsmoships
c74530a4a8be53a1c967de4e564ff97eb03f1fec
[ "MIT" ]
null
null
null
data/scripts/campaign/submarkets/SubmarketShared.java
KelvallRogers/moweaponsmoships
c74530a4a8be53a1c967de4e564ff97eb03f1fec
[ "MIT" ]
null
null
null
data/scripts/campaign/submarkets/SubmarketShared.java
KelvallRogers/moweaponsmoships
c74530a4a8be53a1c967de4e564ff97eb03f1fec
[ "MIT" ]
null
null
null
61.625
95
0.775862
996,785
package data.scripts.campaign.submarkets; import com.fs.starfarer.api.Global; public class SubmarketShared { static final boolean DEBUG = Global.getSettings().getBoolean("mwms_debug"); static final float WEAPON_MULT = Global.getSettings().getFloat("mwms_weapon_mult"); static final float FIGHTER_MULT = Global.getSettings().getFloat("mwms_fighter_mult"); static final float SHIP_MULT = Global.getSettings().getFloat("mwms_ship_mult"); static final float HULLMODS_MULT = Global.getSettings().getFloat("mwms_hullmods_mult"); static final boolean MANY_PICK = Global.getSettings().getBoolean("mwms_many_pick"); static final int WEAPON_PICKS = Global.getSettings().getInt("mwms_weapon_picks"); static final int FIGHTER_PICKS = Global.getSettings().getInt("mwms_fighter_picks"); static final int SHIP_PICKS = Global.getSettings().getInt("mwms_ship_picks"); static final boolean EXTRA_TANKERS = Global.getSettings().getBoolean("mwms_extra_tankers"); }
923408c795f3820dc30ed2ce60cdc913c8717c92
1,622
java
Java
src/test/unit/gov/nist/javax/sip/parser/ContentTypeParserTest.java
cgs1999/jain-sip
a68415306f03fb4856f168864606cce87598b87a
[ "Apache-2.0" ]
241
2016-04-28T07:16:13.000Z
2022-03-29T21:29:46.000Z
src/test/unit/gov/nist/javax/sip/parser/ContentTypeParserTest.java
cgs1999/jain-sip
a68415306f03fb4856f168864606cce87598b87a
[ "Apache-2.0" ]
150
2016-01-15T16:13:53.000Z
2022-03-16T08:11:07.000Z
src/test/unit/gov/nist/javax/sip/parser/ContentTypeParserTest.java
cgs1999/jain-sip
a68415306f03fb4856f168864606cce87598b87a
[ "Apache-2.0" ]
132
2016-05-17T13:41:17.000Z
2022-02-20T03:07:25.000Z
29.490909
83
0.675092
996,786
/* * Conditions Of Use * * This software was developed by employees of the National Institute of * Standards and Technology (NIST), and others. * This software is has been contributed to the public domain. * As a result, a formal license is not needed to use the software. * * This software is provided "AS IS." * NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT * AND DATA ACCURACY. NIST does not warrant or make any representations * regarding the use of the software or the results thereof, including but * not limited to the correctness, accuracy, reliability or usefulness of * the software. * * */ /* * Created on Jul 27, 2004 * *The Open SIP project */ package test.unit.gov.nist.javax.sip.parser; import gov.nist.javax.sip.parser.*; /** * */ public class ContentTypeParserTest extends ParserTestCase { /* (non-Javadoc) * @see test.unit.gov.nist.javax.sip.parser.ParserTestCase#testParser() */ public void testParser() { String content[] = { "c: text/html; charset=ISO-8859-4\n", "Content-Type: text/html; charset=ISO-8859-4\n", "Content-Type: multipart/mixed; boundary=p25-issi-body-boundary\n", "Content-Type: application/sdp\n", "Content-Type: application/sdp; o=we ;l=ek ; i=end \n", "Content-Type: multipart/mixed ;boundary=unique-boundary-1\n" }; super.testParser(ContentTypeParser.class,content); } }
92340a06a08a07f6ca8faa60e3650f8cf3f0c52c
2,711
java
Java
src/main/java/org/jminix/console/tool/StandaloneMiniConsole.java
JLLeitschuh/jminix
487b26ea5ce7e4dca8fb5e9fc2f4ea4b5e9ec089
[ "Apache-2.0" ]
104
2015-04-07T19:57:32.000Z
2021-06-20T15:17:43.000Z
src/main/java/org/jminix/console/tool/StandaloneMiniConsole.java
JLLeitschuh/jminix
487b26ea5ce7e4dca8fb5e9fc2f4ea4b5e9ec089
[ "Apache-2.0" ]
11
2015-01-14T12:13:14.000Z
2020-08-18T06:32:23.000Z
src/main/java/org/jminix/console/tool/StandaloneMiniConsole.java
JLLeitschuh/jminix
487b26ea5ce7e4dca8fb5e9fc2f4ea4b5e9ec089
[ "Apache-2.0" ]
36
2015-01-14T12:14:25.000Z
2021-09-17T12:19:04.000Z
28.536842
81
0.611214
996,787
/* * Copyright 2009 Laurent Bovet, Swiss Post IT <envkt@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 org.jminix.console.tool; import org.jminix.console.application.MiniConsoleApplication; import org.restlet.Component; import org.restlet.data.Protocol; /** * Runs the Mini Console standalone without servlet container. * * @author Laurent Bovet (envkt@example.com) * @since 0.8 */ public class StandaloneMiniConsole { private Component component=null; /** * @param port the listening HTTP port */ public StandaloneMiniConsole(int port) { this(port, new MiniConsoleApplication()); } /** * @param port the listening HTTP port * @param the application object, if you want to create it by yourself. */ public StandaloneMiniConsole(int port, MiniConsoleApplication application) { // Create a new Component. component = new Component(); component.getClients().add(Protocol.CLAP); // Add a new HTTP server component.getServers().add(Protocol.HTTP, port); // Attach the sample application. component.getDefaultHost().attach(application); // Start the component. try { component.start(); } catch (Exception e) { throw new RuntimeException(e); } } /** * Stops the Mini Console and frees the resources. */ public void shutdown() { try { component.stop(); } catch(Exception e) { throw new RuntimeException(e); } } /** * Runs as main, mostly for test purposes... * * @param args if present, first args is the port. Defaults to 8181. */ public static void main(String[] args) { int port=8181; if(args.length>0) { port=new Integer(args[0]); } new StandaloneMiniConsole(port); } public MiniConsoleApplication getApplication() { return (MiniConsoleApplication)component.getApplication(); } }
92340b3eb42f0de13ec8c3e4d09bae67538deae8
5,391
java
Java
sre/io.janusproject/io.janusproject.tests/src/test/java/io/janusproject/tests/bugs/Bug66.java
alexandrelombard/sarl
97a76350e35bf5e81c6c0e01b1dae17bad01278f
[ "Apache-2.0" ]
null
null
null
sre/io.janusproject/io.janusproject.tests/src/test/java/io/janusproject/tests/bugs/Bug66.java
alexandrelombard/sarl
97a76350e35bf5e81c6c0e01b1dae17bad01278f
[ "Apache-2.0" ]
null
null
null
sre/io.janusproject/io.janusproject.tests/src/test/java/io/janusproject/tests/bugs/Bug66.java
alexandrelombard/sarl
97a76350e35bf5e81c6c0e01b1dae17bad01278f
[ "Apache-2.0" ]
null
null
null
29.95
127
0.778149
996,789
/* * $Id$ * * Janus platform is an open-source multiagent platform. * More details on http://www.janusproject.io * * Copyright (C) 2014-2015 Sebastian RODRIGUEZ, Nicolas GAUD, Stéphane GALLAND. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.janusproject.tests.bugs; import java.util.UUID; import javax.inject.Inject; import com.google.inject.name.Named; import org.junit.Test; import io.janusproject.tests.testutils.AbstractJanusRunTest; import io.sarl.core.DefaultContextInteractions; import io.sarl.core.OpenEventSpace; import io.sarl.lang.SARLVersion; import io.sarl.lang.annotation.SarlSpecification; import io.sarl.lang.core.AgentContext; import io.sarl.lang.core.EventSpace; import io.sarl.lang.core.Space; import io.sarl.lang.core.SpaceID; import io.sarl.lang.core.SpaceSpecification; import io.sarl.lang.util.SynchronizedSet; import io.sarl.util.DefaultSpace; import io.sarl.util.concurrent.Collections3; /** * Unit test for the issue #66: Injection of the default space in a Space implementation. * * @author $Author: sgalland$ * @version $FullVersion$ * @mavengroupid $GroupId$ * @mavenartifactid $ArtifactId$ * @see https://github.com/sarl/sarl/issues/66 */ @SuppressWarnings("all") public class Bug66 extends AbstractJanusRunTest { @SarlSpecification(SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING) public interface MySpace extends Space { OpenEventSpace getTheOtherSpace(); } @SarlSpecification(SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING) public static class MySpaceImpl implements MySpace { private final SpaceID id; private final OpenEventSpace otherSpace; public MySpaceImpl(SpaceID id, OpenEventSpace otherSpace) { this.id = id; this.otherSpace = otherSpace; } public OpenEventSpace getTheOtherSpace() { return this.otherSpace; } @Override public SpaceID getID() { return getSpaceID(); } @Override public SpaceID getSpaceID() { return this.id; } @Override public SynchronizedSet<UUID> getParticipants() { return Collections3.emptySynchronizedSet(); } } @Test public void injectionWithNamedAnnotation() throws Exception { runJanus(SpaceCreatorWithNamedAnnotationAgent.class, false); assertEquals(2, getNumberOfResults()); final EventSpace dftSpc = getResult(EventSpace.class, 0); assertNotNull(dftSpc); final MySpace createdSpc = getResult(MySpace.class, 1); assertSame(dftSpc, createdSpc.getTheOtherSpace()); } @SarlSpecification(SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING) public static class MySpaceSpecificationWithNamedAnnotation implements SpaceSpecification<MySpace> { @Inject @Named("defaultSpace") private OpenEventSpace dftSpc; @Override public MySpace create(SpaceID id, Object... params) { return new MySpaceImpl(id, this.dftSpc); } } @SarlSpecification(SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING) public static class SpaceCreatorWithNamedAnnotationAgent extends TestingAgent { public SpaceCreatorWithNamedAnnotationAgent(UUID parentID, UUID agentID) { super(parentID, agentID); } @Override protected boolean runAgentTest() { final AgentContext ctx = getSkill(DefaultContextInteractions.class).getDefaultContext(); final EventSpace dftSpc = ctx.getDefaultSpace(); final MySpace space = ctx.getOrCreateSpaceWithSpec(MySpaceSpecificationWithNamedAnnotation.class, UUID.randomUUID()); addResult(dftSpc); addResult(space); return true; } } @Test public void injectionWithDefaultSpaceAnnotation() throws Exception { runJanus(SpaceCreatorWithDefaultSpaceAnnotationAgent.class, false); assertEquals(2, getNumberOfResults()); final EventSpace dftSpc = getResult(EventSpace.class, 0); assertNotNull(dftSpc); final MySpace createdSpc = getResult(MySpace.class, 1); assertSame(dftSpc, createdSpc.getTheOtherSpace()); } @SarlSpecification(SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING) public static class MySpaceSpecificationWithDefaultSpaceAnnotation implements SpaceSpecification<MySpace> { @Inject @DefaultSpace private OpenEventSpace dftSpc; @Override public MySpace create(SpaceID id, Object... params) { return new MySpaceImpl(id, this.dftSpc); } } @SarlSpecification(SARLVersion.SPECIFICATION_RELEASE_VERSION_STRING) public static class SpaceCreatorWithDefaultSpaceAnnotationAgent extends TestingAgent { public SpaceCreatorWithDefaultSpaceAnnotationAgent(UUID parentID, UUID agentID) { super(parentID, agentID); } @Override protected boolean runAgentTest() { final AgentContext ctx = getSkill(DefaultContextInteractions.class).getDefaultContext(); final EventSpace dftSpc = ctx.getDefaultSpace(); final MySpace space = ctx.getOrCreateSpaceWithSpec(MySpaceSpecificationWithDefaultSpaceAnnotation.class, UUID.randomUUID()); addResult(dftSpc); addResult(space); return true; } } }
92340ccce62d34311ba53d8f1e9d2b7a322a4e42
1,383
java
Java
ThermalCore/src/main/java/cofh/thermal/core/client/renderer/entity/BasalzRenderer.java
FallenAvatar/rp2-redux
20066bf1846b2f3a6411b491a9974d0a945734fa
[ "MIT" ]
null
null
null
ThermalCore/src/main/java/cofh/thermal/core/client/renderer/entity/BasalzRenderer.java
FallenAvatar/rp2-redux
20066bf1846b2f3a6411b491a9974d0a945734fa
[ "MIT" ]
null
null
null
ThermalCore/src/main/java/cofh/thermal/core/client/renderer/entity/BasalzRenderer.java
FallenAvatar/rp2-redux
20066bf1846b2f3a6411b491a9974d0a945734fa
[ "MIT" ]
null
null
null
37.378378
129
0.788142
996,790
package cofh.thermal.core.client.renderer.entity; import cofh.thermal.core.client.renderer.entity.model.BasalzModel; import cofh.thermal.core.entity.monster.BasalzEntity; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.MobRenderer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import static cofh.lib.util.constants.Constants.ID_THERMAL; @OnlyIn(Dist.CLIENT) public class BasalzRenderer extends MobRenderer<BasalzEntity, BasalzModel<BasalzEntity>> { private static final ResourceLocation CALM_TEXTURE = new ResourceLocation(ID_THERMAL + ":textures/entity/basalz.png"); private static final ResourceLocation ANGRY_TEXTURE = new ResourceLocation(ID_THERMAL + ":textures/entity/basalz_angry.png"); public BasalzRenderer(EntityRendererManager renderManagerIn) { super(renderManagerIn, new BasalzModel<>(), 0.5F); } @Override protected int getBlockLight(BasalzEntity entityIn, BlockPos partialTicks) { return entityIn.isAngry() ? 12 : super.getBlockLight(entityIn, partialTicks); } @Override public ResourceLocation getEntityTexture(BasalzEntity entity) { return entity.isAngry() ? ANGRY_TEXTURE : CALM_TEXTURE; } }
92340e65d6d9ae80ff34302fe786d2fa6a96852b
1,883
java
Java
src/main/java/io/syndesis/dv/server/endpoint/PublishRequestPayload.java
vhalbert/teiid-syndesis
5a308c208844243ab1a8e7cb58027397a20eecbe
[ "Apache-2.0" ]
3
2019-10-01T03:43:23.000Z
2021-10-15T08:56:55.000Z
src/main/java/io/syndesis/dv/server/endpoint/PublishRequestPayload.java
vhalbert/teiid-syndesis
5a308c208844243ab1a8e7cb58027397a20eecbe
[ "Apache-2.0" ]
42
2019-08-14T14:25:05.000Z
2019-11-21T21:07:15.000Z
src/main/java/io/syndesis/dv/server/endpoint/PublishRequestPayload.java
vhalbert/teiid-syndesis
5a308c208844243ab1a8e7cb58027397a20eecbe
[ "Apache-2.0" ]
15
2017-09-07T13:25:44.000Z
2019-04-25T16:59:57.000Z
24.454545
75
0.690388
996,791
/* * Copyright (C) 2013 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.syndesis.dv.server.endpoint; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonSerialize(as = PublishRequestPayload.class) @JsonInclude(value=Include.NON_NULL) public class PublishRequestPayload { private String name; private Integer cpuUnits = 500; private Integer memory = 1024; private Integer diskSize = 20; private Boolean enableOdata = true; public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getCpuUnits() { return cpuUnits; } public void setCpuUnits(Integer cpuUnits) { this.cpuUnits = cpuUnits; } public Integer getMemory() { return memory; } public void setMemory(Integer memory) { this.memory = memory; } public Integer getDiskSize() { return diskSize; } public void setDiskSize(Integer diskSize) { this.diskSize = diskSize; } public Boolean getEnableOdata() { return enableOdata; } public void setEnableOdata(Boolean enableOdata) { this.enableOdata = enableOdata; } }
92340e73df9afceb23aec110eb0425b1b4d934db
101
java
Java
1.JavaSyntax/src/com/javarush/task/pro/task07/task0713/Terran.java
ivaninkv/JavaRushTasks
95053dea5d938a564e8c9b9824f41f6ebb58eed4
[ "MIT" ]
null
null
null
1.JavaSyntax/src/com/javarush/task/pro/task07/task0713/Terran.java
ivaninkv/JavaRushTasks
95053dea5d938a564e8c9b9824f41f6ebb58eed4
[ "MIT" ]
null
null
null
1.JavaSyntax/src/com/javarush/task/pro/task07/task0713/Terran.java
ivaninkv/JavaRushTasks
95053dea5d938a564e8c9b9824f41f6ebb58eed4
[ "MIT" ]
null
null
null
11.222222
46
0.742574
996,792
package com.javarush.task.pro.task07.task0713; /* Простое наследование */ public class Terran { }
92340e8bba161741fb7727bc35a5ccf2b72e2159
966
java
Java
view/src/main/java/cz/airbank/cucumber/reports/view/reports/model/feature/Argument.java
stengvac/cucumber-reports
80cd19d4cc5fc9a57787a56cf5be2bd865c37229
[ "Apache-2.0" ]
null
null
null
view/src/main/java/cz/airbank/cucumber/reports/view/reports/model/feature/Argument.java
stengvac/cucumber-reports
80cd19d4cc5fc9a57787a56cf5be2bd865c37229
[ "Apache-2.0" ]
null
null
null
view/src/main/java/cz/airbank/cucumber/reports/view/reports/model/feature/Argument.java
stengvac/cucumber-reports
80cd19d4cc5fc9a57787a56cf5be2bd865c37229
[ "Apache-2.0" ]
null
null
null
20.125
71
0.643892
996,793
package cz.airbank.cucumber.reports.view.reports.model.feature; import java.io.Serializable; /** * View representation of method argument. * * @author Vaclav Stengl */ public class Argument implements Serializable { private static final long serialVersionUID = -3449329064631131642L; private String argumentValue; private int offset; private int diff = 1; /** * Value of argument sent to method declaration. */ public String getArgumentValue() { return argumentValue; } public void setArgumentValue(String argumentValue) { this.argumentValue = argumentValue; } /** * The position of argument in method declaration. */ public int getOffset() { return offset; } public void setOffset(int offset) { this.offset = offset; } public int getDiff() { return diff; } public void setDiff(int diff) { this.diff = diff; } }
92340eff0d7f94b0f0448b40039a6fad9805da5d
540
java
Java
src/main/java/algorithm/Recursion.java
dengyansen/Study
b2895930e485a96ca413018f46d072957a434b6f
[ "MIT" ]
null
null
null
src/main/java/algorithm/Recursion.java
dengyansen/Study
b2895930e485a96ca413018f46d072957a434b6f
[ "MIT" ]
3
2021-03-19T20:29:08.000Z
2022-03-31T21:01:17.000Z
src/main/java/algorithm/Recursion.java
dengyansen/Study
b2895930e485a96ca413018f46d072957a434b6f
[ "MIT" ]
null
null
null
19.285714
44
0.372222
996,794
package algorithm; /** * 递归 */ public class Recursion { public static void main(String[] args) { int i =5; System.out.println(sum(i)); } static int sum(int sum){ if(sum == 1){ return sum; }else{ return sum*sum(sum-1); /**sum(5) = 5*sum(4) * sum(4) = 4*sum(3) * sum(3) = 3*sum(2) * sum(2) = 2*sum(1) * sum(1) = 1; * so,sum(5) = 5*4*3*2*sum(1) * */ } } }
92341094c6182a239086baedb49f05394a3fc818
7,336
java
Java
core/index/src/main/java/org/locationtech/geowave/core/index/IndexPersistableRegistry.java
radiant-maxar/geowave
2d9f39d32e4621c8f5965a4dffff0623c1c03231
[ "Apache-2.0" ]
280
2017-06-14T01:26:19.000Z
2022-03-28T15:45:23.000Z
core/index/src/main/java/org/locationtech/geowave/core/index/IndexPersistableRegistry.java
radiant-maxar/geowave
2d9f39d32e4621c8f5965a4dffff0623c1c03231
[ "Apache-2.0" ]
458
2017-06-12T20:00:59.000Z
2022-03-31T04:41:59.000Z
core/index/src/main/java/org/locationtech/geowave/core/index/IndexPersistableRegistry.java
mzagorskirs/geowave
f54f1bb3c065c44a5baca4507685a35d5a94c5f8
[ "Apache-2.0" ]
135
2017-06-12T20:39:34.000Z
2022-03-15T13:42:30.000Z
69.207547
106
0.803708
996,795
/** * Copyright (c) 2013-2020 Contributors to the Eclipse Foundation * * <p> See the NOTICE file distributed with this work for additional information regarding copyright * ownership. All rights reserved. This program and the accompanying materials are made available * under the terms of the Apache License, Version 2.0 which accompanies this distribution and is * available at http://www.apache.org/licenses/LICENSE-2.0.txt */ package org.locationtech.geowave.core.index; import org.locationtech.geowave.core.index.CompoundIndexStrategy.CompoundIndexMetaDataWrapper; import org.locationtech.geowave.core.index.MultiDimensionalCoordinateRangesArray.ArrayOfArrays; import org.locationtech.geowave.core.index.dimension.BasicDimensionDefinition; import org.locationtech.geowave.core.index.dimension.UnboundedDimensionDefinition; import org.locationtech.geowave.core.index.dimension.bin.BasicBinningStrategy; import org.locationtech.geowave.core.index.numeric.BasicNumericDataset; import org.locationtech.geowave.core.index.numeric.BinnedNumericDataset; import org.locationtech.geowave.core.index.numeric.NumericRange; import org.locationtech.geowave.core.index.numeric.NumericValue; import org.locationtech.geowave.core.index.persist.InternalPersistableRegistry; import org.locationtech.geowave.core.index.persist.PersistableList; import org.locationtech.geowave.core.index.persist.PersistableRegistrySpi; import org.locationtech.geowave.core.index.sfc.BasicSFCIndexStrategy; import org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition; import org.locationtech.geowave.core.index.sfc.hilbert.HilbertSFC; import org.locationtech.geowave.core.index.sfc.tiered.SingleTierSubStrategy; import org.locationtech.geowave.core.index.sfc.tiered.TieredSFCIndexStrategy; import org.locationtech.geowave.core.index.sfc.tiered.TieredSFCIndexStrategy.TierIndexMetaData; import org.locationtech.geowave.core.index.sfc.xz.XZHierarchicalIndexStrategy; import org.locationtech.geowave.core.index.sfc.xz.XZHierarchicalIndexStrategy.XZHierarchicalIndexMetaData; import org.locationtech.geowave.core.index.sfc.xz.XZOrderSFC; import org.locationtech.geowave.core.index.sfc.zorder.ZOrderSFC; import org.locationtech.geowave.core.index.simple.HashKeyIndexStrategy; import org.locationtech.geowave.core.index.simple.RoundRobinKeyIndexStrategy; import org.locationtech.geowave.core.index.simple.SimpleByteIndexStrategy; import org.locationtech.geowave.core.index.simple.SimpleDoubleIndexStrategy; import org.locationtech.geowave.core.index.simple.SimpleFloatIndexStrategy; import org.locationtech.geowave.core.index.simple.SimpleIntegerIndexStrategy; import org.locationtech.geowave.core.index.simple.SimpleLongIndexStrategy; import org.locationtech.geowave.core.index.simple.SimpleShortIndexStrategy; import org.locationtech.geowave.core.index.text.BasicTextDataset; import org.locationtech.geowave.core.index.text.EnumIndexStrategy; import org.locationtech.geowave.core.index.text.EnumSearch; import org.locationtech.geowave.core.index.text.ExplicitTextSearch; import org.locationtech.geowave.core.index.text.TextIndexStrategy; import org.locationtech.geowave.core.index.text.TextRange; import org.locationtech.geowave.core.index.text.TextSearch; import org.locationtech.geowave.core.index.text.TextSearchPredicate; import org.locationtech.geowave.core.index.text.TextValue; public class IndexPersistableRegistry implements PersistableRegistrySpi, InternalPersistableRegistry { @Override public PersistableIdAndConstructor[] getSupportedPersistables() { return new PersistableIdAndConstructor[] { new PersistableIdAndConstructor((short) 100, CompoundIndexMetaDataWrapper::new), new PersistableIdAndConstructor((short) 101, TierIndexMetaData::new), new PersistableIdAndConstructor((short) 102, CompoundIndexStrategy::new), new PersistableIdAndConstructor((short) 103, CoordinateRange::new), new PersistableIdAndConstructor((short) 104, MultiDimensionalCoordinateRanges::new), new PersistableIdAndConstructor((short) 105, ArrayOfArrays::new), new PersistableIdAndConstructor((short) 106, MultiDimensionalCoordinateRangesArray::new), new PersistableIdAndConstructor((short) 107, NullNumericIndexStrategy::new), new PersistableIdAndConstructor((short) 108, NumericIndexStrategyWrapper::new), new PersistableIdAndConstructor((short) 109, BasicDimensionDefinition::new), new PersistableIdAndConstructor((short) 110, UnboundedDimensionDefinition::new), new PersistableIdAndConstructor((short) 111, SFCDimensionDefinition::new), new PersistableIdAndConstructor((short) 112, BasicNumericDataset::new), new PersistableIdAndConstructor((short) 113, BinnedNumericDataset::new), new PersistableIdAndConstructor((short) 114, NumericRange::new), new PersistableIdAndConstructor((short) 115, NumericValue::new), new PersistableIdAndConstructor((short) 116, HilbertSFC::new), new PersistableIdAndConstructor((short) 117, SingleTierSubStrategy::new), new PersistableIdAndConstructor((short) 118, TieredSFCIndexStrategy::new), new PersistableIdAndConstructor((short) 119, XZHierarchicalIndexStrategy::new), new PersistableIdAndConstructor((short) 120, XZOrderSFC::new), new PersistableIdAndConstructor((short) 121, ZOrderSFC::new), new PersistableIdAndConstructor((short) 122, HashKeyIndexStrategy::new), new PersistableIdAndConstructor((short) 123, RoundRobinKeyIndexStrategy::new), new PersistableIdAndConstructor((short) 124, SimpleIntegerIndexStrategy::new), new PersistableIdAndConstructor((short) 125, SimpleLongIndexStrategy::new), new PersistableIdAndConstructor((short) 126, SimpleShortIndexStrategy::new), new PersistableIdAndConstructor((short) 127, XZHierarchicalIndexMetaData::new), new PersistableIdAndConstructor((short) 128, InsertionIds::new), new PersistableIdAndConstructor((short) 129, PartitionIndexStrategyWrapper::new), new PersistableIdAndConstructor((short) 130, SinglePartitionInsertionIds::new), new PersistableIdAndConstructor((short) 131, SimpleFloatIndexStrategy::new), new PersistableIdAndConstructor((short) 132, SimpleDoubleIndexStrategy::new), new PersistableIdAndConstructor((short) 133, SimpleByteIndexStrategy::new), new PersistableIdAndConstructor((short) 134, BasicSFCIndexStrategy::new), new PersistableIdAndConstructor((short) 135, TextSearch::new), new PersistableIdAndConstructor((short) 136, TextSearchPredicate::new), new PersistableIdAndConstructor((short) 137, TextIndexStrategy::new), new PersistableIdAndConstructor((short) 138, EnumIndexStrategy::new), new PersistableIdAndConstructor((short) 139, EnumSearch::new), new PersistableIdAndConstructor((short) 140, BasicBinningStrategy::new), new PersistableIdAndConstructor((short) 141, BasicTextDataset::new), new PersistableIdAndConstructor((short) 142, TextRange::new), new PersistableIdAndConstructor((short) 143, TextValue::new), new PersistableIdAndConstructor((short) 144, ExplicitTextSearch::new), new PersistableIdAndConstructor((short) 145, PersistableList::new)}; } }
92341120ad35b56c9f06da2ba1ba61d662b49a07
516
java
Java
app/src/main/java/com/coolweather/android/gson/Forecast.java
huanghl365/myweather
9fb34dc72976a4a1df0b26c3a01cbe1234a2af69
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/coolweather/android/gson/Forecast.java
huanghl365/myweather
9fb34dc72976a4a1df0b26c3a01cbe1234a2af69
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/coolweather/android/gson/Forecast.java
huanghl365/myweather
9fb34dc72976a4a1df0b26c3a01cbe1234a2af69
[ "Apache-2.0" ]
null
null
null
17.2
50
0.662791
996,796
package com.coolweather.android.gson; import com.google.gson.annotations.SerializedName; import java.security.PublicKey; /** * Created by huanghl on 2018/1/24. */ public class Forecast { public String date; @SerializedName("tmp") public Temperature temperature; @SerializedName("cond") public More more; public class Temperature{ public String max; public String min; } public class More{ @SerializedName("txt_d") public String info; } }
9234118c144ee2474ae8e2ec63668308a125fbe9
286
java
Java
analysis/reverse-engineering/decompile-fitts-with-gradle-20191031-2200/src/main/java/io/reactivex/internal/util/Pow2.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
4
2019-10-07T05:17:21.000Z
2020-11-02T08:29:13.000Z
analysis/reverse-engineering/decompile-fitts-with-gradle-20191031-2200/src/main/java/io/reactivex/internal/util/Pow2.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
38
2019-10-07T02:40:35.000Z
2019-12-12T09:15:24.000Z
analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/io/reactivex/internal/util/Pow2.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
5
2019-10-07T02:41:15.000Z
2020-10-30T01:36:08.000Z
23.833333
64
0.590909
996,797
package io.reactivex.internal.util; public final class Pow2 { public static boolean isPowerOfTwo(int i) { return (i & (i + -1)) == 0; } public static int roundToPowerOfTwo(int i) { return 1 << (32 - Integer.numberOfLeadingZeros(i - 1)); } }
923411a89dc5b07b3db66e72a80fdc2f51362d01
735
java
Java
math/src/main/java/io/freedriver/math/measurement/types/electrical/Energy.java
kazetsukaimiko/freedriver
33c09bd5e3587d27fe3cf39e8d3f1a11a54429fe
[ "MIT" ]
null
null
null
math/src/main/java/io/freedriver/math/measurement/types/electrical/Energy.java
kazetsukaimiko/freedriver
33c09bd5e3587d27fe3cf39e8d3f1a11a54429fe
[ "MIT" ]
1
2022-03-27T18:25:11.000Z
2022-03-27T18:25:11.000Z
math/src/main/java/io/freedriver/math/measurement/types/electrical/Energy.java
kazetsukaimiko/freedriver
33c09bd5e3587d27fe3cf39e8d3f1a11a54429fe
[ "MIT" ]
null
null
null
25.344828
65
0.742857
996,798
package io.freedriver.math.measurement.types.electrical; import io.freedriver.math.TemporalUnit; import io.freedriver.math.measurement.types.TemporalMeasurement; import io.freedriver.math.measurement.units.SIElectricalUnit; import io.freedriver.math.number.ScaledNumber; /** * Measurement in Watt-Hours. * TODO : Temporal Conversion */ public class Energy extends TemporalMeasurement<Energy> { // TODO: Time Multiplier // private TemporalMultiplier temporalMultiplier public Energy(ScaledNumber value) { super(value, SIElectricalUnit.WATTS, TemporalUnit.HOURS); } public Energy() { } @Override protected Energy construct(ScaledNumber value) { return new Energy(value); } }
923411b304b158dcc23bed9a2b5a0220861e0326
11,241
java
Java
main/plugins/org.talend.cwm.mip.edit/src/orgomg/cwm/analysis/businessnomenclature/provider/BusinessnomenclatureItemProviderAdapterFactory.java
dmytro-sylaiev/tcommon-studio-se
b75fadfb9bd1a42897073fe2984f1d4fb42555bd
[ "Apache-2.0" ]
75
2015-01-29T03:23:32.000Z
2022-02-26T07:05:40.000Z
main/plugins/org.talend.cwm.mip.edit/src/orgomg/cwm/analysis/businessnomenclature/provider/BusinessnomenclatureItemProviderAdapterFactory.java
dmytro-sylaiev/tcommon-studio-se
b75fadfb9bd1a42897073fe2984f1d4fb42555bd
[ "Apache-2.0" ]
813
2015-01-21T09:36:31.000Z
2022-03-30T01:15:29.000Z
main/plugins/org.talend.cwm.mip.edit/src/orgomg/cwm/analysis/businessnomenclature/provider/BusinessnomenclatureItemProviderAdapterFactory.java
dmytro-sylaiev/tcommon-studio-se
b75fadfb9bd1a42897073fe2984f1d4fb42555bd
[ "Apache-2.0" ]
272
2015-01-08T06:47:46.000Z
2022-02-09T23:22:27.000Z
32.488439
171
0.646295
996,799
/** * <copyright> * </copyright> * * $Id$ */ package orgomg.cwm.analysis.businessnomenclature.provider; import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.edit.provider.ChangeNotifier; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.IChangeNotifier; import org.eclipse.emf.edit.provider.IDisposable; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.INotifyChangedListener; import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import orgomg.cwm.analysis.businessnomenclature.util.BusinessnomenclatureAdapterFactory; /** * This is the factory that is used to provide the interfaces needed to support Viewers. * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. * The adapters also support Eclipse property sheets. * Note that most of the adapters are shared among multiple instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class BusinessnomenclatureItemProviderAdapterFactory extends BusinessnomenclatureAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { /** * This keeps track of the root adapter factory that delegates to this adapter factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ComposedAdapterFactory parentAdapterFactory; /** * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IChangeNotifier changeNotifier = new ChangeNotifier(); /** * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<Object> supportedTypes = new ArrayList<Object>(); /** * This constructs an instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BusinessnomenclatureItemProviderAdapterFactory() { supportedTypes.add(IEditingDomainItemProvider.class); supportedTypes.add(IStructuredItemContentProvider.class); supportedTypes.add(ITreeItemContentProvider.class); supportedTypes.add(IItemLabelProvider.class); supportedTypes.add(IItemPropertySource.class); } /** * This keeps track of the one adapter used for all {@link orgomg.cwm.analysis.businessnomenclature.VocabularyElement} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected VocabularyElementItemProvider vocabularyElementItemProvider; /** * This creates an adapter for a {@link orgomg.cwm.analysis.businessnomenclature.VocabularyElement}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createVocabularyElementAdapter() { if (vocabularyElementItemProvider == null) { vocabularyElementItemProvider = new VocabularyElementItemProvider(this); } return vocabularyElementItemProvider; } /** * This keeps track of the one adapter used for all {@link orgomg.cwm.analysis.businessnomenclature.Nomenclature} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected NomenclatureItemProvider nomenclatureItemProvider; /** * This creates an adapter for a {@link orgomg.cwm.analysis.businessnomenclature.Nomenclature}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createNomenclatureAdapter() { if (nomenclatureItemProvider == null) { nomenclatureItemProvider = new NomenclatureItemProvider(this); } return nomenclatureItemProvider; } /** * This keeps track of the one adapter used for all {@link orgomg.cwm.analysis.businessnomenclature.Taxonomy} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TaxonomyItemProvider taxonomyItemProvider; /** * This creates an adapter for a {@link orgomg.cwm.analysis.businessnomenclature.Taxonomy}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createTaxonomyAdapter() { if (taxonomyItemProvider == null) { taxonomyItemProvider = new TaxonomyItemProvider(this); } return taxonomyItemProvider; } /** * This keeps track of the one adapter used for all {@link orgomg.cwm.analysis.businessnomenclature.Glossary} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected GlossaryItemProvider glossaryItemProvider; /** * This creates an adapter for a {@link orgomg.cwm.analysis.businessnomenclature.Glossary}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createGlossaryAdapter() { if (glossaryItemProvider == null) { glossaryItemProvider = new GlossaryItemProvider(this); } return glossaryItemProvider; } /** * This keeps track of the one adapter used for all {@link orgomg.cwm.analysis.businessnomenclature.BusinessDomain} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BusinessDomainItemProvider businessDomainItemProvider; /** * This creates an adapter for a {@link orgomg.cwm.analysis.businessnomenclature.BusinessDomain}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createBusinessDomainAdapter() { if (businessDomainItemProvider == null) { businessDomainItemProvider = new BusinessDomainItemProvider(this); } return businessDomainItemProvider; } /** * This keeps track of the one adapter used for all {@link orgomg.cwm.analysis.businessnomenclature.Concept} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ConceptItemProvider conceptItemProvider; /** * This creates an adapter for a {@link orgomg.cwm.analysis.businessnomenclature.Concept}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createConceptAdapter() { if (conceptItemProvider == null) { conceptItemProvider = new ConceptItemProvider(this); } return conceptItemProvider; } /** * This keeps track of the one adapter used for all {@link orgomg.cwm.analysis.businessnomenclature.Term} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TermItemProvider termItemProvider; /** * This creates an adapter for a {@link orgomg.cwm.analysis.businessnomenclature.Term}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createTermAdapter() { if (termItemProvider == null) { termItemProvider = new TermItemProvider(this); } return termItemProvider; } /** * This returns the root adapter factory that contains this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ComposeableAdapterFactory getRootAdapterFactory() { return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); } /** * This sets the composed adapter factory that contains this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { this.parentAdapterFactory = parentAdapterFactory; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean isFactoryForType(Object type) { return supportedTypes.contains(type) || super.isFactoryForType(type); } /** * This implementation substitutes the factory itself as the key for the adapter. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter adapt(Notifier notifier, Object type) { return super.adapt(notifier, this); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object adapt(Object object, Object type) { if (isFactoryForType(type)) { Object adapter = super.adapt(object, type); if (!(type instanceof Class) || (((Class<?>)type).isInstance(adapter))) { return adapter; } } return null; } /** * This adds a listener. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void addListener(INotifyChangedListener notifyChangedListener) { changeNotifier.addListener(notifyChangedListener); } /** * This removes a listener. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void removeListener(INotifyChangedListener notifyChangedListener) { changeNotifier.removeListener(notifyChangedListener); } /** * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void fireNotifyChanged(Notification notification) { changeNotifier.fireNotifyChanged(notification); if (parentAdapterFactory != null) { parentAdapterFactory.fireNotifyChanged(notification); } } /** * This disposes all of the item providers created by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void dispose() { if (vocabularyElementItemProvider != null) vocabularyElementItemProvider.dispose(); if (nomenclatureItemProvider != null) nomenclatureItemProvider.dispose(); if (taxonomyItemProvider != null) taxonomyItemProvider.dispose(); if (glossaryItemProvider != null) glossaryItemProvider.dispose(); if (businessDomainItemProvider != null) businessDomainItemProvider.dispose(); if (conceptItemProvider != null) conceptItemProvider.dispose(); if (termItemProvider != null) termItemProvider.dispose(); } }
923412d31b5dd387eec1f2b1912607d397582ca4
5,138
java
Java
runescape-client/src/main/java/class431.java
Magnusrn/runelite
c77297f6d6e0e78a37fcdefe88a8e61bf060d4d4
[ "BSD-2-Clause" ]
null
null
null
runescape-client/src/main/java/class431.java
Magnusrn/runelite
c77297f6d6e0e78a37fcdefe88a8e61bf060d4d4
[ "BSD-2-Clause" ]
null
null
null
runescape-client/src/main/java/class431.java
Magnusrn/runelite
c77297f6d6e0e78a37fcdefe88a8e61bf060d4d4
[ "BSD-2-Clause" ]
null
null
null
25.69
102
0.62826
996,800
import net.runelite.mapping.Export; import net.runelite.mapping.ObfuscatedGetter; import net.runelite.mapping.ObfuscatedName; import net.runelite.mapping.ObfuscatedSignature; @ObfuscatedName("pk") public class class431 implements MouseWheel { @ObfuscatedName("v") @ObfuscatedSignature( descriptor = "Lpk;" ) public static final class431 field4595; @ObfuscatedName("c") @ObfuscatedSignature( descriptor = "Lpk;" ) public static final class431 field4592; @ObfuscatedName("i") @ObfuscatedSignature( descriptor = "Lpk;" ) public static final class431 field4598; @ObfuscatedName("r") @ObfuscatedSignature( descriptor = "Lfr;" ) @Export("clock") static Clock clock; @ObfuscatedName("do") static boolean field4602; @ObfuscatedName("f") @ObfuscatedGetter( intValue = -1045232419 ) final int field4594; @ObfuscatedName("b") @ObfuscatedGetter( intValue = 690785775 ) public final int field4596; @ObfuscatedName("n") public final Class field4593; @ObfuscatedName("s") @ObfuscatedSignature( descriptor = "Lpw;" ) final class427 field4597; static { field4595 = new class431(1, 0, Integer.class, new class428()); // L: 10 field4592 = new class431(0, 1, Long.class, new class430()); // L: 23 field4598 = new class431(2, 2, String.class, new class432()); // L: 36 } @ObfuscatedSignature( descriptor = "(IILjava/lang/Class;Lpw;)V" ) class431(int var1, int var2, Class var3, class427 var4) { this.field4594 = var1; // L: 59 this.field4596 = var2; // L: 60 this.field4593 = var3; // L: 61 this.field4597 = var4; // L: 62 } // L: 63 @ObfuscatedName("v") @ObfuscatedSignature( descriptor = "(B)I", garbageValue = "16" ) @Export("rsOrdinal") public int rsOrdinal() { return this.field4596; // L: 94 } @ObfuscatedName("n") @ObfuscatedSignature( descriptor = "(Lpi;I)Ljava/lang/Object;", garbageValue = "1124863933" ) public Object method7581(Buffer var1) { return this.field4597.vmethod7598(var1); // L: 98 } @ObfuscatedName("i") @ObfuscatedSignature( descriptor = "(IIIIB)V", garbageValue = "32" ) static final void method7593(int var0, int var1, int var2, int var3) { for (int var4 = var1; var4 <= var3 + var1; ++var4) { // L: 79 for (int var5 = var0; var5 <= var0 + var2; ++var5) { // L: 80 if (var5 >= 0 && var5 < 104 && var4 >= 0 && var4 < 104) { // L: 81 class392.field4374[0][var5][var4] = 127; // L: 82 if (var0 == var5 && var5 > 0) { Tiles.Tiles_heights[0][var5][var4] = Tiles.Tiles_heights[0][var5 - 1][var4]; } if (var5 == var0 + var2 && var5 < 103) { // L: 84 Tiles.Tiles_heights[0][var5][var4] = Tiles.Tiles_heights[0][var5 + 1][var4]; } if (var4 == var1 && var4 > 0) { // L: 85 Tiles.Tiles_heights[0][var5][var4] = Tiles.Tiles_heights[0][var5][var4 - 1]; } if (var4 == var3 + var1 && var4 < 103) { Tiles.Tiles_heights[0][var5][var4] = Tiles.Tiles_heights[0][var5][var4 + 1]; } } } } } @ObfuscatedName("f") @ObfuscatedSignature( descriptor = "(B)[Lpk;", garbageValue = "1" ) public static class431[] method7584() { return new class431[]{field4592, field4595, field4598}; // L: 55 } @ObfuscatedName("b") @ObfuscatedSignature( descriptor = "(Ljava/lang/Object;Lpi;B)V", garbageValue = "54" ) public static void method7579(Object var0, Buffer var1) { Class var3 = var0.getClass(); // L: 67 class431[] var5 = method7584(); // L: 72 int var6 = 0; class431 var4; while (true) { if (var6 >= var5.length) { var4 = null; // L: 83 break; } class431 var7 = var5[var6]; // L: 74 if (var3 == var7.field4593) { // L: 76 var4 = var7; // L: 77 break; } ++var6; // L: 73 } if (var4 == null) { // L: 86 throw new IllegalArgumentException(); } else { class427 var2 = var4.field4597; // L: 87 var2.vmethod7597(var0, var1); // L: 90 } } // L: 91 @ObfuscatedName("n") @ObfuscatedSignature( descriptor = "(Lln;Lln;Ljava/lang/String;Ljava/lang/String;I)Lmd;", garbageValue = "986567968" ) public static Font method7594(AbstractArchive var0, AbstractArchive var1, String var2, String var3) { int var4 = var0.getGroupId(var2); // L: 149 int var5 = var0.getFileId(var4, var3); // L: 150 return class163.method3322(var0, var1, var4, var5); // L: 151 } @ObfuscatedName("jq") @ObfuscatedSignature( descriptor = "(Ljava/lang/String;Lky;I)Ljava/lang/String;", garbageValue = "695765846" ) static String method7592(String var0, Widget var1) { if (var0.indexOf("%") != -1) { // L: 10730 for (int var2 = 1; var2 <= 5; ++var2) { // L: 10731 while (true) { int var3 = var0.indexOf("%" + var2); // L: 10733 if (var3 == -1) { // L: 10734 break; } String var4 = var0.substring(0, var3); // L: 10735 int var6 = BufferedSource.method6907(var1, var2 - 1); // L: 10737 String var5; if (var6 < 999999999) { // L: 10739 var5 = Integer.toString(var6); // L: 10740 } else { var5 = "*"; // L: 10743 } var0 = var4 + var5 + var0.substring(var3 + 2); // L: 10745 } } } return var0; // L: 10749 } }
9234130171ece0f39dd0bbe9662636dc64beaeac
1,462
java
Java
nacid/src/com/ext/nacid/regprof/web/model/applications/report/ExtRegprofTrainingCourseSpecialitiesForReportWebModel.java
governmentbg/NACID-DOCTORS-TITLES
72b79b14af654573e5d23e0048adeac20d06696a
[ "MIT" ]
null
null
null
nacid/src/com/ext/nacid/regprof/web/model/applications/report/ExtRegprofTrainingCourseSpecialitiesForReportWebModel.java
governmentbg/NACID-DOCTORS-TITLES
72b79b14af654573e5d23e0048adeac20d06696a
[ "MIT" ]
null
null
null
nacid/src/com/ext/nacid/regprof/web/model/applications/report/ExtRegprofTrainingCourseSpecialitiesForReportWebModel.java
governmentbg/NACID-DOCTORS-TITLES
72b79b14af654573e5d23e0048adeac20d06696a
[ "MIT" ]
null
null
null
48.733333
153
0.677839
996,801
package com.ext.nacid.regprof.web.model.applications.report; import com.nacid.bl.NacidDataProvider; import com.nacid.data.regprof.external.ExtRegprofTrainingCourseSpecialitiesRecord; import com.nacid.regprof.web.model.applications.report.base.RegprofTrainingCourseSpecialityForReportBaseWebModel; //RayaWritten----------------------------------------------------------------------------------------------------------------- public class ExtRegprofTrainingCourseSpecialitiesForReportWebModel extends RegprofTrainingCourseSpecialityForReportBaseWebModel{ private String higherSpecialityTxt; private String sdkSpecialityTxt; private String secondarySpecialityTxt; public ExtRegprofTrainingCourseSpecialitiesForReportWebModel(ExtRegprofTrainingCourseSpecialitiesRecord record, NacidDataProvider nacidDataProvider){ super(record, nacidDataProvider); this.higherSpecialityTxt = record.getHigherSpecialityTxt(); this.sdkSpecialityTxt = record.getSdkSpecialityTxt(); this.secondarySpecialityTxt = record.getSecondarySpecialityTxt(); } public String getHigherSpecialityTxt() { return higherSpecialityTxt; } public String getSdkSpecialityTxt() { return sdkSpecialityTxt; } public String getSecondarySpecialityTxt() { return secondarySpecialityTxt; } } //----------------------------------------------------------------------------------------------------------
9234146a3fc8e8fce2ddbfe7b29b0b11811719fe
1,477
java
Java
src/cn/edu/xidian/ictt/yk/basic/DemoThread22.java
HengYk/ConcurrentDemo
81e1b5c17d4060eab3d08173166b2ca1719d8dc8
[ "MIT" ]
null
null
null
src/cn/edu/xidian/ictt/yk/basic/DemoThread22.java
HengYk/ConcurrentDemo
81e1b5c17d4060eab3d08173166b2ca1719d8dc8
[ "MIT" ]
null
null
null
src/cn/edu/xidian/ictt/yk/basic/DemoThread22.java
HengYk/ConcurrentDemo
81e1b5c17d4060eab3d08173166b2ca1719d8dc8
[ "MIT" ]
null
null
null
22.723077
48
0.500339
996,802
package cn.edu.xidian.ictt.yk.basic; /** * Created by heart_sunny on 2018/11/5 */ class NotifyAllCase { public synchronized void runOne() { System.out.println("进入runOne方法"); //this.notify(); this.notifyAll(); System.out.println("runOne执行完毕"); } public synchronized void runTwo() { System.out.println("进入runTwo方法"); try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } // this.notify(); // System.out.println("runTwo发起通知"); System.out.println("runTwo执行完毕"); } public synchronized void runThree() { System.out.println("进入runThree方法"); try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("runThree执行完毕"); } } public class DemoThread22 { public static void main(String[] args) { NotifyAllCase nac = new NotifyAllCase(); new Thread(new Runnable() { @Override public void run() { nac.runTwo(); } }).start(); new Thread(new Runnable() { @Override public void run() { nac.runThree(); } }).start(); new Thread(new Runnable() { @Override public void run() { nac.runOne(); } }).start(); } }
923414b2f9c9d7bccabd2082771bec7916c4a074
284
java
Java
api/topology/src/main/java/quarks/topology/plumbing/package-info.java
vdogaru/quarks
2f6ad0e9f63c6691da2ec23b68e84a6f47c9f9fd
[ "Apache-2.0" ]
134
2016-02-15T19:56:39.000Z
2019-11-16T18:23:47.000Z
api/topology/src/main/java/quarks/topology/plumbing/package-info.java
vdogaru/quarks
2f6ad0e9f63c6691da2ec23b68e84a6f47c9f9fd
[ "Apache-2.0" ]
77
2016-02-15T23:54:09.000Z
2019-07-07T01:40:10.000Z
api/topology/src/main/java/quarks/topology/plumbing/package-info.java
vdogaru/quarks
2f6ad0e9f63c6691da2ec23b68e84a6f47c9f9fd
[ "Apache-2.0" ]
56
2016-02-02T14:58:08.000Z
2022-02-22T09:01:54.000Z
21.846154
70
0.728873
996,803
/* # Licensed Materials - Property of IBM # Copyright IBM Corp. 2015,2016 */ /** * Plumbing for a streaming topology. * Methods that manipulate the flow of tuples in a streaming topology, * but are not part of the logic of the application. */ package quarks.topology.plumbing;
923414c051923f9e512cc5dcb6251615179a4753
333
java
Java
src/main/java/gov/usgs/volcanoes/swarm/map/MapLineDialog.java
CyberFlameGO/swarm
d78fe4e3adb4ecb695965a2a61fd2f0bf7bfdef1
[ "CC0-1.0" ]
32
2016-07-28T19:23:06.000Z
2021-06-30T02:26:34.000Z
src/main/java/gov/usgs/volcanoes/swarm/map/MapLineDialog.java
sefulretelei/swarm
d78fe4e3adb4ecb695965a2a61fd2f0bf7bfdef1
[ "CC0-1.0" ]
280
2015-10-08T19:37:14.000Z
2021-07-14T08:55:11.000Z
src/main/java/gov/usgs/volcanoes/swarm/map/MapLineDialog.java
sefulretelei/swarm
d78fe4e3adb4ecb695965a2a61fd2f0bf7bfdef1
[ "CC0-1.0" ]
16
2015-10-07T00:24:22.000Z
2021-07-26T18:53:38.000Z
22.2
69
0.786787
996,804
package gov.usgs.volcanoes.swarm.map; import gov.usgs.volcanoes.swarm.SwarmModalDialog; import javax.swing.JFrame; public class MapLineDialog extends SwarmModalDialog { private static final long serialVersionUID = -8220797914598647354L; protected MapLineDialog(JFrame parent, String title) { super(parent, title); } }
923414c27abf31708fe27e911d9226e52cc774cf
7,539
java
Java
src/org/opensha2/eq/model/PointSourceFinite.java
jmfee-usgs/nshmp-haz
feabafc4ccf02bb37e43f8aa2fa8287378bd512d
[ "Apache-2.0" ]
null
null
null
src/org/opensha2/eq/model/PointSourceFinite.java
jmfee-usgs/nshmp-haz
feabafc4ccf02bb37e43f8aa2fa8287378bd512d
[ "Apache-2.0" ]
null
null
null
src/org/opensha2/eq/model/PointSourceFinite.java
jmfee-usgs/nshmp-haz
feabafc4ccf02bb37e43f8aa2fa8287378bd512d
[ "Apache-2.0" ]
null
null
null
34.741935
90
0.719194
996,805
package org.opensha2.eq.model; import static java.lang.Math.ceil; import static java.lang.Math.cos; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.sin; import static java.lang.Math.tan; import static org.opensha2.eq.fault.FocalMech.NORMAL; import static org.opensha2.eq.fault.FocalMech.REVERSE; import static org.opensha2.eq.fault.FocalMech.STRIKE_SLIP; import static org.opensha2.geo.GeoTools.TO_RAD; import static org.opensha2.util.MathUtils.hypot; import java.util.Iterator; import java.util.Map; import org.opensha2.eq.fault.FocalMech; import org.opensha2.eq.fault.scaling.MagLengthRelationship; import org.opensha2.eq.fault.surface.PtSrcDistCorr; import org.opensha2.eq.fault.surface.RuptureScaling; import org.opensha2.geo.GeoTools; import org.opensha2.geo.Location; import org.opensha2.geo.Locations; import org.opensha2.mfd.IncrementalMfd; /** * Point-source earthquake implementation in which all magnitudes are * represented as finite faults and any normal or reverse sources are * represented with two possible geometries, one dipping towards the observer * and one dipping away. In both cases the leading edge of the finite source * representation is located at the point {@code Location} of the source itself * (in one representation the bottom trace is at the point {@code Location} and * the fault dips towards the observer, in its complement the top trace is at * the point {@code Location} and the fault dips away from the observer; TODO * add illustration or link). * * <p>This is the generalized point earthquake source representation used for * the 2014 NSHMP. It was created to provide support for weighted * magnitude-depth distributions and improved approximations of hanging wall * terms vis-a-vis self-consistent distance calculations.</p> * * <p><b>NOTE</b>: See {@link PointSource} description for notes on thread * safety and {@code Rupture} creation and iteration.</p> * * @author Peter Powers */ class PointSourceFinite extends PointSource { int fwIdxLo, fwIdxHi; /** * Constructs a new point earthquake source. * @param loc <code>Location</code> of the point source * @param mfd magnitude frequency distribution of the source * @param mechWtMap <code>Map</code> of focal mechanism weights * @param rupScaling rupture scaling model * @param depthModel specifies magnitude cutoffs and associated weights for * different depth-to-top-of-ruptures */ PointSourceFinite(Location loc, IncrementalMfd mfd, Map<FocalMech, Double> mechWtMap, RuptureScaling rupScaling, DepthModel depthModel) { super(loc, mfd, mechWtMap, rupScaling, depthModel); init(); } @Override public String name() { return "PointSourceFinite: " + loc; } /* * NOTE/TODO: Although there should not be many instances where a * PointSourceFinite rupture rate is reduced to zero (a mag-depth weight * [this is not curently checked] of an MFD rate could be zero), in the * cases where it is, we're doing a little more work than necessary below. * We could alternatively short-circuit updateRupture() this method to * return null reference but don't like returning null. */ private void updateRupture(Rupture rup, int idx) { int magDepthIdx = idx % magDepthSize; int magIdx = depthModel.magDepthIndices.get(magDepthIdx); double mag = mfd.getX(magIdx); double rate = mfd.getY(magIdx); double zTop = depthModel.magDepthDepths.get(magDepthIdx); double zTopWt = depthModel.magDepthWeights.get(magDepthIdx); FocalMech mech = mechForIndex(idx); double mechWt = mechWtMap.get(mech); if (mech != STRIKE_SLIP) mechWt *= 0.5; double dipRad = mech.dip() * TO_RAD; double maxWidthDD = (depthModel.maxDepth - zTop) / sin(dipRad); double widthDD = rupScaling.dimensions(mag, maxWidthDD).width; rup.mag = mag; rup.rake = mech.rake(); rup.rate = rate * zTopWt * mechWt; FiniteSurface fpSurf = (FiniteSurface) rup.surface; fpSurf.mag = mag; // KLUDGY needed for distance correction fpSurf.dipRad = dipRad; fpSurf.widthDD = widthDD; fpSurf.widthH = widthDD * cos(dipRad); fpSurf.zTop = zTop; fpSurf.zBot = zTop + widthDD * sin(dipRad); fpSurf.footwall = isOnFootwall(idx); } @Override public Iterator<Rupture> iterator() { return new Iterator<Rupture>() { Rupture rupture = new Rupture(); { rupture.surface = new FiniteSurface(loc, rupScaling); } int size = size(); int caret = 0; @Override public boolean hasNext() { if (caret >= size) return false; updateRupture(rupture, caret++); return (rupture.rate > 0.0) ? true : hasNext(); } @Override public Rupture next() { return rupture; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } @Override void init() { /* * Get the number of mag-depth iterations required to get to mMax. See * explanation in GridSourceSet for how magDepthIndices is set up */ magDepthSize = depthModel.magDepthIndices.lastIndexOf(mfd.getNum() - 1) + 1; /* * Init rupture indexing: SS-FW RV-FW RV-HW NR-FW NR-HW. Each category * will have ruptures for every mag in 'mfd' and depth in parent * 'magDepthMap'. */ int ssCount = (int) ceil(mechWtMap.get(STRIKE_SLIP)) * magDepthSize; int revCount = (int) ceil(mechWtMap.get(REVERSE)) * magDepthSize * 2; int norCount = (int) ceil(mechWtMap.get(NORMAL)) * magDepthSize * 2; ssIdx = ssCount; revIdx = ssCount + revCount; fwIdxLo = ssCount + revCount / 2; fwIdxHi = ssCount + revCount + norCount / 2; rupCount = ssCount + revCount + norCount; } /* * Returns whether the rupture at index should be on the footwall (i.e. have * its rX value set negative). Strike-slip mechs are marked as footwall to * potentially short circuit GMPE calcs. Because the index order is SS-FW * RV-FW RV-HW NR-FW NR-HW */ boolean isOnFootwall(int idx) { return (idx < fwIdxLo) ? true : (idx < revIdx) ? false : (idx < fwIdxHi) ? true : false; } static class FiniteSurface extends PointSurface { double zBot; // base of rupture; may be less than 14km double widthH; // horizontal width (surface projection) double widthDD; // down-dip width boolean footwall; FiniteSurface(Location loc, RuptureScaling rupScaling) { super(loc, rupScaling); } @Override public Distance distanceTo(Location loc) { // TODO 0.5 is WUS specific and based on discretization of distances // in grid source Gmm lookup tables // because we're not using table lookup optimizations, we push the // minimum rJB out to 0.5 (half the table bin-width) double rJB = Locations.horzDistanceFast(this.loc, loc); rJB = rupScaling.pointSourceDistance(mag, rJB); rJB = max(0.5, rJB); // TODO this should go away double rX = footwall ? -rJB : rJB + widthH; if (footwall) return Distance.create(rJB, hypot(rJB, zTop), rX); double rCut = zBot * tan(dipRad); if (rJB > rCut) return Distance.create(rJB, hypot(rJB, zBot), rX); // rRup when rJB is 0 -- we take the minimum the site-to-top-edge // and site-to-normal of rupture for the site being directly over // the down-dip edge of the rupture double rRup0 = min(hypot(widthH, zTop), zBot * cos(dipRad)); // rRup at cutoff rJB double rRupC = zBot / cos(dipRad); // scale linearly with rJB distance double rRup = (rRupC - rRup0) * rJB / rCut + rRup0; return Distance.create(rJB, rRup, rX); } // @formatter:off @Override public double width() { return widthDD; } } }
9234162a97069516425608281bb946926ffc9afd
1,823
java
Java
src/main/java/com/touwolf/mailchimp/model/list/growthhistory/ListsGrowthHistoryResponse.java
touwolf/mailchimp-client-api-v3
7ce92cc98a5d1f9e20cc98a245cceed223f939f3
[ "Apache-2.0" ]
1
2016-06-24T16:39:33.000Z
2016-06-24T16:39:33.000Z
src/main/java/com/touwolf/mailchimp/model/list/growthhistory/ListsGrowthHistoryResponse.java
touwolf/mailchimp-client-api-v3
7ce92cc98a5d1f9e20cc98a245cceed223f939f3
[ "Apache-2.0" ]
2
2016-06-16T19:17:23.000Z
2016-06-16T19:18:43.000Z
src/main/java/com/touwolf/mailchimp/model/list/growthhistory/ListsGrowthHistoryResponse.java
touwolf/mailchimp-client-api-v3
7ce92cc98a5d1f9e20cc98a245cceed223f939f3
[ "Apache-2.0" ]
null
null
null
20.483146
74
0.622052
996,806
package com.touwolf.mailchimp.model.list.growthhistory; import com.google.gson.annotations.SerializedName; import com.touwolf.mailchimp.data.MailchimpLinks; import java.util.List; public class ListsGrowthHistoryResponse { @SerializedName("list_id") private String listId; private String month; private Integer existing; private Integer imports; private Integer optins; @SerializedName("_links") private List<MailchimpLinks> links; /** * The list id for the growth activity report. */ public String getListId() { return listId; } public void setListId(String listId) { this.listId = listId; } /** * The month that the growth history is describing. */ public String getMonth() { return month; } public void setMonth(String month) { this.month = month; } /** * Existing members on the list for a specific month. */ public Integer getExisting() { return existing; } public void setExisting(Integer existing) { this.existing = existing; } /** * Imported members on the list for a specific month. */ public Integer getImports() { return imports; } public void setImports(Integer imports) { this.imports = imports; } /** * Newly opted-in members on the list for a specific month. */ public Integer getOptins() { return optins; } public void setOptins(Integer optins) { this.optins = optins; } /** * A list of link types and descriptions for the API schema documents. */ public List<MailchimpLinks> getLinks() { return links; } public void setLinks(List<MailchimpLinks> links) { this.links = links; } }
9234171094d9b2b9a5b796640ae9dcc84cb35279
5,819
java
Java
acceptance/src/test/java/com/sonicbase/accept/bench/TestRebalance.java
lowrydale/sonicbase
9cf11c46443570a87bc13752c088f497cd6e8923
[ "Apache-2.0" ]
1
2018-11-11T14:04:19.000Z
2018-11-11T14:04:19.000Z
acceptance/src/test/java/com/sonicbase/accept/bench/TestRebalance.java
lowrydale/sonicbase
9cf11c46443570a87bc13752c088f497cd6e8923
[ "Apache-2.0" ]
31
2020-03-04T22:06:40.000Z
2021-12-09T20:27:23.000Z
acceptance/src/test/java/com/sonicbase/accept/bench/TestRebalance.java
lowrydale/sonicbase
9cf11c46443570a87bc13752c088f497cd6e8923
[ "Apache-2.0" ]
1
2018-12-06T01:37:28.000Z
2018-12-06T01:37:28.000Z
40.131034
217
0.688434
996,807
package com.sonicbase.accept.bench; import com.sonicbase.client.DatabaseClient; import com.sonicbase.common.Config; import com.sonicbase.jdbcdriver.ParameterHandler; import com.sonicbase.server.DatabaseServer; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.testng.annotations.Test; import java.io.BufferedInputStream; import java.io.File; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.util.ArrayList; import java.util.List; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicBoolean; import static org.testng.Assert.assertEquals; public class TestRebalance { @Test(enabled=false) public void testBasics() throws Exception { String configStr = IOUtils.toString(new BufferedInputStream(getClass().getResourceAsStream("/config/config-4-servers.yaml")), "utf-8"); Config config = new Config(configStr); FileUtils.deleteDirectory(new File(System.getProperty("user.home"), "db-data")); final DatabaseServer[] dbServers = new DatabaseServer[8]; ThreadPoolExecutor executor = new ThreadPoolExecutor(32, 32, 10000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1000), new ThreadPoolExecutor.CallerRunsPolicy()); List<Future> futures = new ArrayList<>(); for (int i = 0; i < dbServers.length; i++) { final int shard = i; futures.add(executor.submit((Callable) () -> { String role = "primaryMaster"; dbServers[shard] = new DatabaseServer(); Config.copyConfig("test"); dbServers[shard].setConfig(config, "localhost", 9010 + (50 * shard), true, new AtomicBoolean(true), new AtomicBoolean(true),null, false); dbServers[shard].setRole(role); return null; })); } for (Future future : futures) { future.get(); } DatabaseClient client = new DatabaseClient("localhost", 9010, -1, -1, true); ParameterHandler parms = new ParameterHandler(); client.executeQuery("test", "create table Persons (id BIGINT, id2 BIGINT, socialSecurityNumber VARCHAR(20), relatives VARCHAR(64000), restricted BOOLEAN, gender VARCHAR(8), PRIMARY KEY (id))", parms, false, null, true); client.executeQuery("test", "create index socialSecurityNumber on persons(socialSecurityNumber)", parms, false, null, true); client.syncSchema(); List<Long> ids = new ArrayList<>(); Class.forName("com.sonicbase.jdbcdriver.Driver"); Connection conn = DriverManager.getConnection("jdbc:sonicbase:localhost:9010", "user", "password"); //test upsert int recordCount = dbServers.length * 50; for (int i = 0; i < recordCount; i++) { PreparedStatement stmt = conn.prepareStatement("insert into persons (id, socialSecurityNumber, relatives, restricted, gender) VALUES (?, ?, ?, ?, ?)"); stmt.setLong(1, i * 1000); stmt.setString(2, "933-28-" + i); stmt.setString(3, "12345678901,12345678901|12345678901,12345678901,12345678901,12345678901|12345678901"); stmt.setBoolean(4, false); stmt.setString(5, "m"); assertEquals(stmt.executeUpdate(), 1); ids.add((long) i); } assertEquals(client.getPartitionSize("test", 0, "persons", "_primarykey"), 400); assertEquals(client.getPartitionSize("test", 1, "persons", "_primarykey"), 0); assertEquals(client.getPartitionSize("test", 2, "persons", "_primarykey"), 0); assertEquals(client.getPartitionSize("test", 3, "persons", "_primarykey"), 0); //client.beginRebalance("persons", "_primarykey"); client.beginRebalance("test"); while (true) { if (client.isRepartitioningComplete("test")) { break; } Thread.sleep(1000); } assertEquals(client.getPartitionSize("test", 0, "persons", "_primarykey"), 101); assertEquals(client.getPartitionSize("test", 1, "persons", "_primarykey"), 100); assertEquals(client.getPartitionSize("test", 2, "persons", "_primarykey"), 100); assertEquals(client.getPartitionSize("test", 3, "persons", "_primarykey"), 99); //sync schema PreparedStatement stmt = conn.prepareStatement("create table Persons2 (id BIGINT, id2 BIGINT, socialSecurityNumber VARCHAR(20), relatives VARCHAR(64000), restricted BOOLEAN, gender VARCHAR(8), PRIMARY KEY (id))"); stmt.executeUpdate(); for (int i = 0; i < recordCount; i++) { stmt = conn.prepareStatement("insert into persons (id, socialSecurityNumber, relatives, restricted, gender) VALUES (" + 399 * 1000 + i + ", ?, ?, ?, ?)"); //stmt.setLong(1, 399 * 1000 + i); stmt.setString(1, "933-28-" + i); stmt.setString(2, "12345678901,12345678901|12345678901,12345678901,12345678901,12345678901|12345678901"); stmt.setBoolean(3, false); stmt.setString(4, "m"); assertEquals(stmt.executeUpdate(), 1); ids.add((long) i); } assertEquals(client.getPartitionSize("test", 0, "persons", "_primarykey"), 101); assertEquals(client.getPartitionSize("test", 1, "persons", "_primarykey"), 100); assertEquals(client.getPartitionSize("test", 2, "persons", "_primarykey"), 100); assertEquals(client.getPartitionSize("test", 3, "persons", "_primarykey"), 499); //client.beginRebalance("persons", "_primarykey"); client.beginRebalance("test"); while (true) { if (client.isRepartitioningComplete("test")) { break; } Thread.sleep(1000); } assertEquals(client.getPartitionSize("test", 0, "persons", "_primarykey"), 201); assertEquals(client.getPartitionSize("test", 1, "persons", "_primarykey"), 200); assertEquals(client.getPartitionSize("test", 2, "persons", "_primarykey"), 200); assertEquals(client.getPartitionSize("test", 3, "persons", "_primarykey"), 199); executor.shutdownNow(); } }
9234179dbfd0a7132a21f7ae5abbda6b755f62f0
1,221
java
Java
magic-api/src/main/java/org/ssssssss/magicapi/utils/JdbcUtils.java
ssssssss-team/ssssssss
25fa9d08396314f4735dd7f7ca3a1a4f806def36
[ "MIT" ]
16
2020-05-05T06:15:08.000Z
2020-05-13T07:54:14.000Z
magic-api/src/main/java/org/ssssssss/magicapi/utils/JdbcUtils.java
ssssssss-team/ssssssss
25fa9d08396314f4735dd7f7ca3a1a4f806def36
[ "MIT" ]
2
2020-05-11T03:30:50.000Z
2020-05-13T09:12:22.000Z
magic-api/src/main/java/org/ssssssss/magicapi/utils/JdbcUtils.java
ssssssss-team/ssssssss
25fa9d08396314f4735dd7f7ca3a1a4f806def36
[ "MIT" ]
5
2020-05-06T05:24:28.000Z
2020-05-13T03:10:41.000Z
27.133333
102
0.742834
996,808
package org.ssssssss.magicapi.utils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.jdbc.DatabaseDriver; import org.ssssssss.magicapi.core.exception.MagicAPIException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class JdbcUtils { private static final Logger logger = LoggerFactory.getLogger(JdbcUtils.class); public static Connection getConnection(String driver, String url, String username, String password) { try { if (StringUtils.isBlank(driver)) { driver = DatabaseDriver.fromJdbcUrl(url).getDriverClassName(); if (StringUtils.isBlank(driver)) { throw new MagicAPIException("无法从url中获得驱动类"); } } Class.forName(driver); } catch (ClassNotFoundException e) { throw new MagicAPIException("找不到驱动:" + driver); } try { return DriverManager.getConnection(url, username, password); } catch (SQLException e) { logger.error("获取Jdbc链接失败", e); throw new MagicAPIException("获取Jdbc链接失败:" + e.getMessage()); } } public static void close(Connection connection) { try { connection.close(); } catch (Exception ignored) { } } }
92341935d9799f1d8e164e1dc1b488e371b93c52
3,087
java
Java
components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisTestSupport.java
zangfuri/camel
661cd5be9d82292d4b2414c61b54c15ca5911d65
[ "Apache-2.0" ]
13
2018-08-29T09:51:58.000Z
2022-02-22T12:00:36.000Z
components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisTestSupport.java
zangfuri/camel
661cd5be9d82292d4b2414c61b54c15ca5911d65
[ "Apache-2.0" ]
12
2019-11-13T03:09:32.000Z
2022-02-01T01:05:20.000Z
components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisTestSupport.java
zangfuri/camel
661cd5be9d82292d4b2414c61b54c15ca5911d65
[ "Apache-2.0" ]
50
2016-12-21T07:35:36.000Z
2022-02-25T15:39:00.000Z
35.930233
136
0.682848
996,809
/** * 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.camel.component.mybatis; import java.sql.Connection; import java.sql.Statement; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.After; import org.junit.Before; public abstract class MyBatisTestSupport extends CamelTestSupport { protected boolean createTestData() { return true; } protected String createStatement() { return "create table ACCOUNT (ACC_ID INTEGER, ACC_FIRST_NAME VARCHAR(255), ACC_LAST_NAME VARCHAR(255), ACC_EMAIL VARCHAR(255))"; } @Override @Before public void setUp() throws Exception { super.setUp(); // lets create the table... Connection connection = createConnection(); Statement statement = connection.createStatement(); statement.execute(createStatement()); connection.commit(); statement.close(); connection.close(); if (createTestData()) { Account account1 = new Account(); account1.setId(123); account1.setFirstName("James"); account1.setLastName("Strachan"); account1.setEmailAddress("anpch@example.com"); Account account2 = new Account(); account2.setId(456); account2.setFirstName("Claus"); account2.setLastName("Ibsen"); account2.setEmailAddress("envkt@example.com"); template.sendBody("mybatis:insertAccount?statementType=Insert", new Account[]{account1, account2}); } } @Override @After public void tearDown() throws Exception { // should drop the table properly to avoid any side effects while running all the tests together under maven Connection connection = createConnection(); Statement statement = connection.createStatement(); statement.execute("drop table ACCOUNT"); connection.commit(); statement.close(); connection.close(); super.tearDown(); } private Connection createConnection() throws Exception { MyBatisComponent component = context.getComponent("mybatis", MyBatisComponent.class); return component.createSqlSessionFactory().getConfiguration().getEnvironment().getDataSource().getConnection(); } }
92341997c8b50d4f5fc0c93167013ee05d7b5967
780
java
Java
src/main/java/Dog.java
apcs-assignments-fall2020/13-pet-inheritance-amandacutrer
143ae0cb23c5f9a129e0c4985135df60a9946c7f
[ "Apache-2.0" ]
null
null
null
src/main/java/Dog.java
apcs-assignments-fall2020/13-pet-inheritance-amandacutrer
143ae0cb23c5f9a129e0c4985135df60a9946c7f
[ "Apache-2.0" ]
null
null
null
src/main/java/Dog.java
apcs-assignments-fall2020/13-pet-inheritance-amandacutrer
143ae0cb23c5f9a129e0c4985135df60a9946c7f
[ "Apache-2.0" ]
null
null
null
20.526316
93
0.521795
996,810
public class Dog extends Pet { // Instance variable(s) private String breed; // Constructors public Dog(String name, int age, String breed){ super(name, age); this.breed = breed; } public Dog(){ super("Max", 1); this.breed = "Terrier"; } // makeNoise() method public void makeNoise() { System.out.println("Bark!"); } // toString method public String toString(){ return ("Name: " + this.getName() + ", Age: " + this.getAge() + ", Breed: " + breed); } // Getter public String getBreed() { return this.breed; } // Setter public void setBreed(String breed){ if (breed.trim().length() != 0) { this.breed = breed; } } }
923419e12cbc9a098cbce8617c951c9979617e34
273
java
Java
src/com/subnetTool/AddressSpace.java
Valentijn1995/SubnetTool
a997439dbc799e12ff7736cb9ab27afdf45e3ff4
[ "MIT" ]
null
null
null
src/com/subnetTool/AddressSpace.java
Valentijn1995/SubnetTool
a997439dbc799e12ff7736cb9ab27afdf45e3ff4
[ "MIT" ]
null
null
null
src/com/subnetTool/AddressSpace.java
Valentijn1995/SubnetTool
a997439dbc799e12ff7736cb9ab27afdf45e3ff4
[ "MIT" ]
null
null
null
12.409091
36
0.556777
996,811
package com.subnetTool; /** * Created by valentijn on 09-12-16. */ public enum AddressSpace { IPv4(4), IPv6(16); private int len; AddressSpace(int len) { this.len = len; } public int getByteLen() { return this.len; } }
92341b80647738c30af12076de8e69b5c4be26a4
6,319
java
Java
data-aggregation-casestudies/src/main/java/inescid/dataaggregation/casestudies/dataquality/ProcessRepository.java
nfreire/data-aggregation-lab
acae17123587536b103fb2676593502585aa8ba7
[ "Apache-2.0" ]
4
2019-06-27T10:50:14.000Z
2020-05-26T02:59:06.000Z
data-aggregation-casestudies/src/main/java/inescid/dataaggregation/casestudies/dataquality/ProcessRepository.java
europeana/rd-data-aggregation-lab
24da66370daeeb29447a68ead64fb54efaa7af18
[ "Apache-2.0" ]
10
2021-12-10T01:04:20.000Z
2021-12-14T21:43:15.000Z
data-aggregation-casestudies/src/main/java/inescid/dataaggregation/casestudies/dataquality/ProcessRepository.java
europeana/rd-data-aggregation-lab
24da66370daeeb29447a68ead64fb54efaa7af18
[ "Apache-2.0" ]
1
2019-11-04T21:54:29.000Z
2019-11-04T21:54:29.000Z
35.903409
135
0.709922
996,812
package inescid.dataaggregation.casestudies.dataquality; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.Date; import java.util.List; import java.util.Map.Entry; import org.apache.any23.extractor.csv.CSVReaderBuilder; import org.apache.any23.writer.BenchmarkTripleHandler; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVPrinter; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.Resource; import org.apache.jena.riot.RiotException; import inescid.dataaggregation.dataset.Global; import inescid.dataaggregation.dataset.profile.completeness.TiersDqcCompletenessCalculator; import inescid.dataaggregation.dataset.profile.multilinguality.MultilingualSaturation; import inescid.dataaggregation.dataset.profile.multilinguality.MultilingualSaturationResult; import inescid.dataaggregation.dataset.profile.tiers.EpfTiersCalculator; import inescid.dataaggregation.dataset.profile.tiers.TiersCalculation; import inescid.dataaggregation.store.Repository; import inescid.dataaggregation.store.RepositoryResource; import inescid.util.RdfUtil; public class ProcessRepository { public interface EdmMeasurement { public String[] getCsvResult(Resource edmCho, String edmRdfXml) throws Exception; public String[] getHeaders(); } public static void main(String[] args) throws IOException { String repoFolder = "c://users/nfrei/desktop/data/EuropeanaRepository"; String datasetId = "data.europeana.eu"; //"https://api.europeana.eu/oai/record" String outputFolder = "c://users/nfrei/desktop/data/"; if(args!=null) { if(args.length>=1) { repoFolder = args[0]; if(args.length>=2) datasetId = args[1]; if(args.length>=3) outputFolder = args[2]; } } Global.init_componentDataRepository(repoFolder); Global.init_enableComponentHttpRequestCache(); Repository repository = Global.getDataRepository(); EdmMeasurement[] measurements=new EdmMeasurement[] { createEdmMeasurementCompleteness(), createEdmMeasurementMetadataTiers(), createEdmMeasurementLanguageSaturation() }; BufferedWriter csvBuffer = Files.newBufferedWriter(new File(outputFolder, "edm-measurements.csv").toPath(), StandardCharsets.UTF_8); CSVPrinter csvOut=new CSVPrinter(csvBuffer, CSVFormat.DEFAULT); for(EdmMeasurement measurement : measurements) { String[] csvHeaders = measurement.getHeaders(); for(String m:csvHeaders) csvOut.print(m); } csvOut.println(); Date start=new Date(); int tmpCnt=0; int okRecs=0; Iterable<RepositoryResource> it = repository.getIterableOfResources(datasetId); for(RepositoryResource r: it) { try { String uri = r.getUri(); String edmRdfXml = new String(r.getContent(), StandardCharsets.UTF_8); tmpCnt++; if(tmpCnt % 1000 == 0) { csvOut.flush(); csvBuffer.flush(); Date now=new Date(); long elapsedPerRecord=(now.getTime()-start.getTime())/tmpCnt; double recsMinute=60000/elapsedPerRecord; double minutesToEnd=(58000000-tmpCnt)/recsMinute; System.out.printf("%d recs. (%d ok) - %d recs/min - %d mins. to end\n",tmpCnt, okRecs, (int) recsMinute, (int)minutesToEnd); } Model readRdf = RdfUtil.readRdf(edmRdfXml, org.apache.jena.riot.Lang.RDFXML); csvOut.print(uri); for(EdmMeasurement measurement : measurements) { try { String[] csvResult = measurement.getCsvResult(readRdf.getResource(uri), edmRdfXml); for(String m:csvResult) csvOut.print(m); } catch (Exception e) { System.err.println("Error in: "+r.getUri()); System.err.println(e.getMessage()); } } okRecs++; csvOut.println(); } catch (RiotException e) { System.err.println("Error reading RDF: "+r.getUri()); System.err.println(e.getMessage()); // e.printStackTrace(); } catch (IOException e) { System.err.println("Error reading from repository: "+r.getUri()); System.err.println(e.getMessage()); // e.printStackTrace(); } } csvOut.close(); csvBuffer.close(); System.out.println(tmpCnt); } private static EdmMeasurement createEdmMeasurementLanguageSaturation() { return new EdmMeasurement() { @Override public String[] getCsvResult(Resource edmCho, String edmRdfXml) { MultilingualSaturationResult score; try { score = MultilingualSaturation.calculate(edmCho.getModel()); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } return new String[] {String.valueOf(score.getLanguagesCount()) , String.valueOf(score.getLangTagCount())}; }; @Override public String[] getHeaders() { return new String[] {"ls_languagesCount", "ls_langTagCount"}; } }; } private static EdmMeasurement createEdmMeasurementCompleteness() { return new EdmMeasurement() { @Override public String[] getCsvResult(Resource edmCho, String edmRdfXml) { TiersDqcCompletenessCalculator calculator=new TiersDqcCompletenessCalculator(); double calculate = calculator.calculate(edmCho.getModel()); return new String[] {String.valueOf(calculate)}; }; @Override public String[] getHeaders() { return new String[] {"completeness"}; } }; } private static EdmMeasurement createEdmMeasurementMetadataTiers() { return new EdmMeasurement() { @Override public String[] getCsvResult(Resource edmCho, String edmRdfXml) throws Exception { TiersCalculation calculate = EpfTiersCalculator.calculate(edmRdfXml); return new String[] {String.valueOf(calculate.getContent().getLevel()), String.valueOf(calculate.getMetadata().getLevel()), String.valueOf(calculate.getContextualClass().getLevel()), String.valueOf(calculate.getEnablingElements().getLevel()), String.valueOf(calculate.getLanguage().getLevel()) }; }; @Override public String[] getHeaders() { return new String[] {"epf_media", "epf_metadata", "epf_metadata_contextual", "epf_metadata_enabling", "epf_metadata_language"}; } }; } }
92341c088edb0ce33ec3129ff638f324d5daf3d4
4,733
java
Java
subprojects/plugins/src/main/java/org/gradle/api/internal/java/JavaLibrary.java
erdi/gradle
b0df0704a42d222645603533ad7342632320fc5b
[ "Apache-2.0" ]
null
null
null
subprojects/plugins/src/main/java/org/gradle/api/internal/java/JavaLibrary.java
erdi/gradle
b0df0704a42d222645603533ad7342632320fc5b
[ "Apache-2.0" ]
null
null
null
subprojects/plugins/src/main/java/org/gradle/api/internal/java/JavaLibrary.java
erdi/gradle
b0df0704a42d222645603533ad7342632320fc5b
[ "Apache-2.0" ]
null
null
null
34.05036
114
0.706951
996,813
/* * Copyright 2012 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.gradle.api.internal.java; import com.google.common.collect.ImmutableSet; import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.DependencySet; import org.gradle.api.artifacts.ModuleDependency; import org.gradle.api.artifacts.PublishArtifact; import org.gradle.api.attributes.Usage; import org.gradle.api.internal.component.SoftwareComponentInternal; import org.gradle.api.internal.component.UsageContext; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; import static org.gradle.api.plugins.JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME; import static org.gradle.api.plugins.JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME; /** * A SoftwareComponent representing a library that runs on a java virtual machine. */ public class JavaLibrary implements SoftwareComponentInternal { private final LinkedHashSet<PublishArtifact> artifacts = new LinkedHashSet<PublishArtifact>(); private final UsageContext runtimeUsage; private final UsageContext compileUsage; private final ConfigurationContainer configurations; public JavaLibrary(ConfigurationContainer configurations, PublishArtifact... artifacts) { Collections.addAll(this.artifacts, artifacts); this.configurations = configurations; this.runtimeUsage = new RuntimeUsageContext(); this.compileUsage = new CompileUsageContext(); } /** * This constructor should not be used, and is maintained only for backwards * compatibility with the widely used Shadow plugin. */ @Deprecated public JavaLibrary(PublishArtifact jarArtifact, DependencySet runtimeDependencies) { this.artifacts.add(jarArtifact); this.runtimeUsage = new BackwardsCompatibilityUsageContext(Usage.FOR_RUNTIME, runtimeDependencies); this.compileUsage = new BackwardsCompatibilityUsageContext(Usage.FOR_COMPILE, runtimeDependencies); this.configurations = null; } public String getName() { return "java"; } public Set<UsageContext> getUsages() { return ImmutableSet.of(runtimeUsage, compileUsage); } private class RuntimeUsageContext implements UsageContext { private DependencySet dependencies; @Override public Usage getUsage() { return Usage.FOR_RUNTIME; } public Set<PublishArtifact> getArtifacts() { return artifacts; } public Set<ModuleDependency> getDependencies() { if (dependencies == null) { dependencies = configurations.getByName(RUNTIME_ELEMENTS_CONFIGURATION_NAME).getAllDependencies(); } return dependencies.withType(ModuleDependency.class); } } private class CompileUsageContext implements UsageContext { private DependencySet dependencies; @Override public Usage getUsage() { return Usage.FOR_COMPILE; } public Set<PublishArtifact> getArtifacts() { return artifacts; } public Set<ModuleDependency> getDependencies() { if (dependencies == null) { dependencies = configurations.findByName(API_ELEMENTS_CONFIGURATION_NAME).getAllDependencies(); } return dependencies.withType(ModuleDependency.class); } } private class BackwardsCompatibilityUsageContext implements UsageContext { private final Usage usage; private final DependencySet runtimeDependencies; private BackwardsCompatibilityUsageContext(Usage usage, DependencySet runtimeDependencies) { this.usage = usage; this.runtimeDependencies = runtimeDependencies; } @Override public Usage getUsage() { return usage; } @Override public Set<PublishArtifact> getArtifacts() { return artifacts; } @Override public Set<ModuleDependency> getDependencies() { return runtimeDependencies.withType(ModuleDependency.class); } } }
92341cd3f5d6ae4f107e7a9deb6e4b6455834673
1,387
java
Java
src/main/java/jodtemplate/io/StandaloneOutputProcessor.java
andyakovlev/jodtemplate
5b2efd06c37264a04f2e295f9f922deec68a98e6
[ "Apache-2.0" ]
3
2015-01-30T09:52:23.000Z
2015-02-23T00:51:15.000Z
src/main/java/jodtemplate/io/StandaloneOutputProcessor.java
andyakovlev/jodtemplate
5b2efd06c37264a04f2e295f9f922deec68a98e6
[ "Apache-2.0" ]
1
2015-02-12T08:27:05.000Z
2020-05-02T20:05:11.000Z
src/main/java/jodtemplate/io/StandaloneOutputProcessor.java
andyakovlev/jodtemplate
5b2efd06c37264a04f2e295f9f922deec68a98e6
[ "Apache-2.0" ]
null
null
null
30.822222
100
0.664744
996,814
/* * * Copyright 2015 Andrey Yakovlev * * 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 jodtemplate.io; import java.io.IOException; import java.io.Writer; import org.jdom2.output.support.AbstractXMLOutputProcessor; import org.jdom2.output.support.FormatStack; public class StandaloneOutputProcessor extends AbstractXMLOutputProcessor { @Override protected void printDeclaration(final Writer out, final FormatStack fstack) throws IOException { if (fstack.isOmitDeclaration()) { return; } if (fstack.isOmitEncoding()) { write(out, "<?xml version=\"1.0"); } else { write(out, "<?xml version=\"1.0\""); write(out, " encoding=\""); write(out, fstack.getEncoding()); } write(out, "\" standalone=\"yes\"?>"); write(out, "\n"); } }
92341cf5440825ba72379c94d91ffe27eaf46743
668
java
Java
rains-graphql-admin/src/main/java/com/rains/graphql/system/service/LogService.java
hugoDD/rains-graphql-system
8bff1aeafc65a06ee4ab877555ae63243796044e
[ "Apache-2.0" ]
8
2020-05-05T02:09:11.000Z
2021-12-15T02:12:24.000Z
rains-graphql-admin/src/main/java/com/rains/graphql/system/service/LogService.java
zhengweixing/rains-graphql-system
8bff1aeafc65a06ee4ab877555ae63243796044e
[ "Apache-2.0" ]
null
null
null
rains-graphql-admin/src/main/java/com/rains/graphql/system/service/LogService.java
zhengweixing/rains-graphql-system
8bff1aeafc65a06ee4ab877555ae63243796044e
[ "Apache-2.0" ]
5
2021-01-10T10:36:03.000Z
2021-12-31T07:58:31.000Z
31.809524
84
0.811377
996,815
package com.rains.graphql.system.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.fasterxml.jackson.core.JsonProcessingException; import com.rains.graphql.common.domain.QueryRequest; import com.rains.graphql.common.log.ILogService; import com.rains.graphql.system.domain.Log; import org.aspectj.lang.ProceedingJoinPoint; import org.springframework.scheduling.annotation.Async; public interface LogService extends ILogService, IBaseService<Log> { IPage<Log> findLogs(QueryRequest request, Log log); void deleteLogs(String[] logIds); @Async void saveLog(ProceedingJoinPoint point, Log log) throws JsonProcessingException; }
92341cf6468b4d8120ffc028df3e61ec5ae1a442
1,389
java
Java
src/main/java/fr/piwithy/PiThread.java
piwithy/PiMonteCarloMth
8490505fc9cdd86e08eef491529e3c5d5b6fcfc9
[ "MIT" ]
null
null
null
src/main/java/fr/piwithy/PiThread.java
piwithy/PiMonteCarloMth
8490505fc9cdd86e08eef491529e3c5d5b6fcfc9
[ "MIT" ]
null
null
null
src/main/java/fr/piwithy/PiThread.java
piwithy/PiMonteCarloMth
8490505fc9cdd86e08eef491529e3c5d5b6fcfc9
[ "MIT" ]
null
null
null
26.711538
95
0.614831
996,816
package fr.piwithy; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.time.Duration; import java.time.Instant; import java.util.Random; import java.util.concurrent.Callable; import java.util.concurrent.ThreadLocalRandom; public class PiThread implements Callable<Integer> { private Logger logger; private int nIter,tID; public PiThread(int nIter, int tID) { this.nIter = nIter; this.tID = tID; this.logger=LogManager.getLogger("PiDart Thread " + tID); } public PiThread(int nIter){ this(nIter, ThreadLocalRandom.current().nextInt()); } public int piDarts(){ int count=0; double x,y,z; for(int i=0;i<nIter;i++){ x= ThreadLocalRandom.current().nextDouble(0,1); y= ThreadLocalRandom.current().nextDouble(0,1); z=x*x+y*y; if(z<=1) count++; } return count; } @Override public Integer call() throws Exception { logger.debug("This is Thread: " +this.tID+" ; Working on "+ this.nIter + " iteration"); Instant st = Instant.now(); int cnt = piDarts(); Instant end = Instant.now(); long time_ms= Duration.between(st, end).toMillis(); logger.debug("Computing Finished: " + cnt+ " duration " + time_ms+ "ms"); return cnt; } }
92341da05cc18bcaeed9180a80ca8b0c6c91955b
2,183
java
Java
slicing/src/main/java/de/tub/dima/scotty/slicing/slice/LazySlice.java
rafaelmoczalla/running-scotty
c74ba28dd40f4660ad0233c40cd880d1ef210554
[ "Apache-2.0" ]
52
2018-12-25T10:56:16.000Z
2022-03-28T11:06:05.000Z
slicing/src/main/java/de/tub/dima/scotty/slicing/slice/LazySlice.java
rafaelmoczalla/running-scotty
c74ba28dd40f4660ad0233c40cd880d1ef210554
[ "Apache-2.0" ]
26
2019-03-13T18:16:08.000Z
2022-03-28T10:30:17.000Z
slicing/src/main/java/de/tub/dima/scotty/slicing/slice/LazySlice.java
rafaelmoczalla/running-scotty
c74ba28dd40f4660ad0233c40cd880d1ef210554
[ "Apache-2.0" ]
24
2018-12-25T10:56:21.000Z
2022-03-28T11:06:09.000Z
32.58209
139
0.690334
996,817
package de.tub.dima.scotty.slicing.slice; import de.tub.dima.scotty.slicing.*; import de.tub.dima.scotty.slicing.state.*; import de.tub.dima.scotty.state.*; import de.tub.dima.scotty.state.memory.MemorySetState; import org.jetbrains.annotations.*; import java.util.*; public class LazySlice<InputType, ValueType> extends AbstractSlice<InputType, ValueType> { private final AggregateState<InputType> state; private final SetState<StreamRecord<InputType>> records; public LazySlice(StateFactory stateFactory, WindowManager windowManager, long startTs, long endTs, long startC, long endC, Type type) { super(startTs, endTs, startC, endC, type); this.records = stateFactory.createSetState(); this.state = new AggregateState<>(stateFactory, windowManager.getAggregations(), this.records); } @Override public void addElement(InputType element, long ts) { super.addElement(element, ts); state.addElement(element); records.add(new StreamRecord(ts, element)); } public void prependElement(StreamRecord<InputType> newElement) { super.addElement(newElement.record, newElement.ts); records.add(newElement); state.addElement(newElement.record); } public StreamRecord<InputType> dropLastElement() { StreamRecord<InputType> dropRecord = records.dropLast(); this.setCLast(this.getCLast()-1); if(!records.isEmpty()) { StreamRecord<InputType> currentLast = records.getLast(); this.setTLast(currentLast.ts); } this.state.removeElement(dropRecord); return dropRecord; } public StreamRecord<InputType> dropFirstElement() { StreamRecord<InputType> dropRecord = records.dropFrist(); StreamRecord<InputType> currentFirst = records.getFirst(); this.setCLast(this.getCLast()-1); this.setTFirst(currentFirst.ts); this.state.removeElement(dropRecord); return dropRecord; } @Override public AggregateState getAggState() { return state; } public SetState<StreamRecord<InputType>> getRecords(){ return this.records; } }
92341ee03301a2f392afb84f897a32e64a5a22e0
4,800
java
Java
android/src/main/java/com/robinpowered/react/vitals/RNVitalsModule.java
tobob/react-native-vitals
37cd48547ae3c3d4a8e9d7cde61b211c8a8cabe9
[ "MIT" ]
54
2018-07-25T14:52:32.000Z
2022-02-06T23:20:40.000Z
android/src/main/java/com/robinpowered/react/vitals/RNVitalsModule.java
tobob/react-native-vitals
37cd48547ae3c3d4a8e9d7cde61b211c8a8cabe9
[ "MIT" ]
11
2017-11-17T20:24:29.000Z
2021-02-09T02:52:35.000Z
android/src/main/java/com/robinpowered/react/vitals/RNVitalsModule.java
tobob/react-native-vitals
37cd48547ae3c3d4a8e9d7cde61b211c8a8cabe9
[ "MIT" ]
8
2017-11-16T18:31:50.000Z
2019-11-29T10:25:38.000Z
30.967742
119
0.749792
996,818
package com.robinpowered.react.vitals; import android.os.Environment; import android.os.StatFs; import android.os.Build; import android.os.Debug; import android.content.ComponentCallbacks2; import android.content.res.Configuration; import android.app.ActivityManager; import android.content.Context; import com.facebook.react.bridge.LifecycleEventListener; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.WritableMap; import com.facebook.react.bridge.Arguments; import com.facebook.react.modules.core.DeviceEventManagerModule; import java.util.Map; import java.util.HashMap; import javax.annotation.Nullable; import java.io.File; public class RNVitalsModule extends ReactContextBaseJavaModule implements ComponentCallbacks2, LifecycleEventListener { public static final String MODULE_NAME = "RNVitals"; public static final String LOW_MEMORY = "LOW_MEMORY"; public static final String MEMORY_LEVEL_KEY = "MemoryLevel"; public static final int MEMORY_MODERATE = TRIM_MEMORY_RUNNING_MODERATE; public static final int MEMORY_LOW = TRIM_MEMORY_RUNNING_LOW; public static final int MEMORY_CRITICAL = TRIM_MEMORY_RUNNING_CRITICAL; public RNVitalsModule(ReactApplicationContext reactContext) { super(reactContext); } private double toMB(long num) { return (double) (num / 1024 / 1024); } @Override public String getName() { return MODULE_NAME; } @Override public @Nullable Map<String, Object> getConstants() { HashMap<String, Object> memoryLevelConstants = new HashMap<String, Object>(); memoryLevelConstants.put("CRITICAL", MEMORY_CRITICAL); memoryLevelConstants.put("LOW", MEMORY_LOW); memoryLevelConstants.put("MODERATE", MEMORY_MODERATE); HashMap<String, Object> constants = new HashMap<String, Object>(); constants.put(LOW_MEMORY, LOW_MEMORY); constants.put(MEMORY_LEVEL_KEY, memoryLevelConstants); return constants; } private WritableMap getMemoryInfo() { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) getReactApplicationContext() .getSystemService(Context.ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi); Debug.MemoryInfo memInfo = new Debug.MemoryInfo(); Debug.getMemoryInfo(memInfo); long appUsed = memInfo.getTotalPss() * 1024L; WritableMap info = Arguments.createMap(); info.putDouble("systemTotal", toMB(mi.totalMem)); info.putDouble("appUsed", toMB(appUsed)); info.putDouble("systemFree", toMB(mi.availMem)); info.putDouble("systemUsed", toMB(mi.totalMem - mi.availMem)); return info; } @Override public void onTrimMemory(int level) { ReactApplicationContext context = getReactApplicationContext(); if (context.hasActiveCatalystInstance()) { WritableMap memoryInfo = getMemoryInfo(); memoryInfo.putInt("memoryLevel", level); context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(LOW_MEMORY, memoryInfo); } } @Override public void onLowMemory() { // no-op } @Override public void initialize() { getReactApplicationContext().addLifecycleEventListener(this); getReactApplicationContext().registerComponentCallbacks(this); } @Override public void onHostResume() { getReactApplicationContext().registerComponentCallbacks(this); } @Override public void onHostPause() { getReactApplicationContext().unregisterComponentCallbacks(this); } @Override public void onHostDestroy() { getReactApplicationContext().unregisterComponentCallbacks(this); getReactApplicationContext().removeLifecycleEventListener(this); } @Override public void onConfigurationChanged(Configuration newConfig) { // no-op } @ReactMethod public void getStorage(Promise promise) { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long totalSpace; long freeSpace; if (Build.VERSION.SDK_INT >= 18) { totalSpace = stat.getTotalBytes(); freeSpace = stat.getFreeBytes(); } else { long blockSize = stat.getBlockSize(); totalSpace = blockSize * stat.getBlockCount(); freeSpace = blockSize * stat.getAvailableBlocks(); } WritableMap info = Arguments.createMap(); info.putDouble("total", toMB(totalSpace)); info.putDouble("free", toMB(freeSpace)); long usedSpace = totalSpace - freeSpace; info.putDouble("used", toMB(usedSpace)); promise.resolve(info); } @ReactMethod public void getMemory(Promise promise) { promise.resolve(getMemoryInfo()); } }
92341f886192e12e49001372910914fd53871a74
239
java
Java
Test_Java/src/test/security/messagedigest/MDEncodeHex.java
atealxt/work-workspaces
f3a59de7ecb3b3278473209224307d440003fc42
[ "MIT" ]
null
null
null
Test_Java/src/test/security/messagedigest/MDEncodeHex.java
atealxt/work-workspaces
f3a59de7ecb3b3278473209224307d440003fc42
[ "MIT" ]
2
2021-12-14T20:32:17.000Z
2021-12-18T18:17:34.000Z
Test_Java/src/test/security/messagedigest/MDEncodeHex.java
atealxt/work-workspaces
f3a59de7ecb3b3278473209224307d440003fc42
[ "MIT" ]
1
2015-08-31T07:57:08.000Z
2015-08-31T07:57:08.000Z
21.727273
54
0.757322
996,819
package test.security.messagedigest; public interface MDEncodeHex { String encodeMD2Hex(byte[] data) throws Exception; String encodeMD4Hex(byte[] data) throws Exception; String encodeMD5Hex(byte[] data) throws Exception; }
923420b4d67cd6498711d298a3fcb3a2e775f8a3
216
java
Java
src/main/java/com/fs121/monitor/model/ISingleValueList.java
zsumore/weather-monitor
ff1705c11d7131c65c8c29df4b6cb6a534278713
[ "MIT" ]
null
null
null
src/main/java/com/fs121/monitor/model/ISingleValueList.java
zsumore/weather-monitor
ff1705c11d7131c65c8c29df4b6cb6a534278713
[ "MIT" ]
null
null
null
src/main/java/com/fs121/monitor/model/ISingleValueList.java
zsumore/weather-monitor
ff1705c11d7131c65c8c29df4b6cb6a534278713
[ "MIT" ]
null
null
null
13.5
38
0.736111
996,820
package com.fs121.monitor.model; import java.util.List; public interface ISingleValueList<E> { String getStationId(); void setStationId(String sid); void setListValue(List<E> l); List<E> getListValue(); }
923421e79eadf1c5bd51b38f9f1550be4d2dc256
901
java
Java
tourismwork-master/src/apps/manage/src/main/java/com/opentravelsoft/action/manage/operate/TouristInfoAction.java
xiaosongdeyx001/shujuku-----123
a0a009a732d74bf601f9d4ebccfb8d42c8a9b7d9
[ "Apache-2.0" ]
3
2019-06-18T16:12:33.000Z
2021-12-09T07:39:15.000Z
tourismwork-master/src/apps/manage/src/main/java/com/opentravelsoft/action/manage/operate/TouristInfoAction.java
xiaosongdeyx001/shujuku-----123
a0a009a732d74bf601f9d4ebccfb8d42c8a9b7d9
[ "Apache-2.0" ]
12
2020-11-16T20:38:06.000Z
2022-03-31T20:10:58.000Z
tourismwork-master/src/apps/manage/src/main/java/com/opentravelsoft/action/manage/operate/TouristInfoAction.java
xiaosongdeyx001/shujuku-----123
a0a009a732d74bf601f9d4ebccfb8d42c8a9b7d9
[ "Apache-2.0" ]
1
2019-06-21T07:44:03.000Z
2019-06-21T07:44:03.000Z
23.179487
68
0.755531
996,821
package com.opentravelsoft.action.manage.operate; import java.text.SimpleDateFormat; import org.springframework.beans.factory.annotation.Autowired; import com.opentravelsoft.action.ManageAction; import com.opentravelsoft.entity.Tourist; import com.opentravelsoft.service.operator.TouristService; /** * 成团处理 * * @author <a herf="mailto:envkt@example.com">Steven Zhang</a> * @version $Revision: 1.2 $ $Date: 2009/04/10 07:47:29 $ */ public class TouristInfoAction extends ManageAction { private static final long serialVersionUID = 7926144965633325472L; protected SimpleDateFormat SDF = new SimpleDateFormat("yyyyMMdd"); @Autowired private TouristService touristService; private Tourist tcustomer = new Tourist(); /** 名单号 */ private String nmno; public String input() { // 显示一个游客信息 tcustomer = touristService.roFindCustomerByNmno(nmno); return INPUT; } }
9234220780b4e3a403132d47f43d2f3bd10ca091
7,698
java
Java
datty-msgpack/src/main/java/io/datty/msgpack/core/ValueMessageReader.java
datty-io/datty
d826c0fd452f658e9c1aeb208ef2ecfd93284e02
[ "Apache-2.0" ]
null
null
null
datty-msgpack/src/main/java/io/datty/msgpack/core/ValueMessageReader.java
datty-io/datty
d826c0fd452f658e9c1aeb208ef2ecfd93284e02
[ "Apache-2.0" ]
null
null
null
datty-msgpack/src/main/java/io/datty/msgpack/core/ValueMessageReader.java
datty-io/datty
d826c0fd452f658e9c1aeb208ef2ecfd93284e02
[ "Apache-2.0" ]
null
null
null
21.684507
128
0.66173
996,822
/* * Copyright (C) 2016 Datty.io 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 io.datty.msgpack.core; import org.msgpack.core.MessageFormat; import org.msgpack.core.MessagePack.Code; import io.datty.msgpack.MessageReader; import io.datty.msgpack.core.reader.ArrayReader; import io.datty.msgpack.core.reader.ListReader; import io.datty.msgpack.core.reader.MapReader; import io.datty.msgpack.core.reader.ValueReader; import io.datty.msgpack.core.type.ArrayTypeInfo; import io.datty.msgpack.core.type.ListTypeInfo; import io.datty.msgpack.core.type.MapTypeInfo; import io.datty.msgpack.core.type.SimpleTypeInfo; import io.datty.msgpack.core.type.TypeInfo; import io.datty.msgpack.support.MessageParseException; import io.netty.buffer.ByteBuf; /** * ValueMessageReader * * @author Alex Shvid * */ public class ValueMessageReader extends AbstractMessageReader implements MessageReader { public static final ValueMessageReader INSTANCE = new ValueMessageReader(); public static final ValueReader<Object> OBJECT_KEY_READER = new ValueReader<Object>() { @Override public Object read(ByteBuf source, boolean copy) { return INSTANCE.readValue(source, true); } }; public static final ValueReader<Object> OBJECT_VALUE_READER = new ValueReader<Object>() { @Override public Object read(ByteBuf source, boolean copy) { return INSTANCE.readValue(source, copy); } }; @Override public int size() { throw new UnsupportedOperationException("this method must be overriden"); } /** * Return types: * * null * Boolean * Long * Double * String * */ @Override public Object readKey(ByteBuf buffer) { if (!hasNext(buffer)) { return null; } MessageFormat f = getNextFormat(buffer); switch(f) { case NIL: return readNull(buffer); case POSFIXINT: case NEGFIXINT: case UINT8: case UINT16: case UINT32: case UINT64: case INT8: case INT16: case INT32: case INT64: return Integer.valueOf(readVInt(buffer)); case FLOAT32 : case FLOAT64 : return Integer.valueOf((int) readVDouble(buffer)); case FIXSTR: case STR8 : case STR16 : case STR32 : return readString(buffer); default: throw new MessageParseException("reader not found for format: " + f.name()); } } /** * Return types: * * null * Boolean * Long * Double * String * ByteBuf * MessageReader * */ @Override public Object readValue(ByteBuf buffer, boolean copy) { if (!hasNext(buffer)) { return null; } MessageFormat f = getNextFormat(buffer); switch(f) { case NIL: return readNull(buffer); case BOOLEAN: return Boolean.valueOf(readBoolean(buffer)); case POSFIXINT: case NEGFIXINT: case UINT8: case UINT16: case UINT32: case UINT64: case INT8: case INT16: case INT32: case INT64: return Long.valueOf(readVLong(buffer)); case FLOAT32 : case FLOAT64 : return Double.valueOf(readVDouble(buffer)); case FIXSTR: case STR8 : case STR16 : case STR32 : return readString(buffer); case BIN8: case BIN16: case BIN32: return readBinary(buffer, copy); case FIXARRAY: case ARRAY16: case ARRAY32: return readArray(buffer, copy); case FIXMAP: case MAP16: case MAP32: return readMap(buffer, copy); default: throw new MessageParseException("reader not found for format: " + f.name()); } } @Override public ByteBuf skipValue(ByteBuf source, boolean copy) { if (!hasNext(source)) { return null; } int startIndex = source.readerIndex(); skipValue(source); int endIndex = source.readerIndex(); int length = endIndex - startIndex; if (copy) { ByteBuf dst = source.alloc().buffer(length); source.getBytes(startIndex, dst, length); return dst; } else { return source.slice(startIndex, length); } } public ByteBuf readBinary(ByteBuf source, boolean copy) { int length = readBinaryHeader(source); if (length > source.readableBytes()) { throw new MessageParseException("insufficient buffer length: " + source.readableBytes() + ", required length: " + length); } if (copy) { ByteBuf dst = source.alloc().buffer(length); source.readBytes(dst, length); return dst; } else { ByteBuf slice = source.slice(source.readerIndex(), length); source.skipBytes(length); return slice; } } public MessageReader readArray(ByteBuf source, boolean copy) { int length = readArrayHeader(source); return new ArrayMessageReader(length); } public MessageReader readMap(ByteBuf source, boolean copy) { int size = readMapHeader(source); return new MapMessageReader(size); } public boolean isInteger(MessageFormat f) { switch(f) { case POSFIXINT: case NEGFIXINT: case UINT8: case UINT16: case UINT32: case UINT64: case INT8: case INT16: case INT32: case INT64: return true; default: return false; } } public boolean isMap(ByteBuf source) { MessageFormat f = getNextFormat(source); return isMap(f); } public boolean isMap(MessageFormat f) { switch(f) { case FIXMAP: case MAP16: case MAP32: return true; default: return false; } } public boolean isNull(ByteBuf source) { if (!hasNext(source)) { return true; } byte b = getNextCode(source); return b == Code.NIL; } public boolean isBinary(ByteBuf source) { if (!hasNext(source)) { return false; } byte b = getNextCode(source); if (Code.isFixedRaw(b)) { // FixRaw return true; } switch (b) { case Code.BIN8: case Code.BIN16: case Code.BIN32: return true; } return false; } /** * This method automatically converts value to the expecting type */ @SuppressWarnings("unchecked") @Override public <T> T readValue(TypeInfo<T> type, ByteBuf source, boolean copy) { if (type instanceof SimpleTypeInfo) { SimpleTypeInfo<T> simpleType = (SimpleTypeInfo<T>) type; return simpleType.getValueReader().read(source, copy); } else if (type instanceof ArrayTypeInfo) { ArrayTypeInfo<Object, T> arrayType = (ArrayTypeInfo<Object, T>) type; return (T) ArrayReader.INSTANCE.read(arrayType.getComponentType(), arrayType.getComponentValueReader(), source, copy); } else if (type instanceof ListTypeInfo) { ListTypeInfo<Object, T> listType = (ListTypeInfo<Object, T>) type; return (T) ListReader.INSTANCE.read(listType.getComponentValueReader(), source, copy); } else if (type instanceof MapTypeInfo) { MapTypeInfo<Object, Object, T> mapType = (MapTypeInfo<Object, Object, T>) type; return (T) MapReader.INSTANCE.read(mapType.getKeyValueReader(), mapType.getComponentValueReader(), source, copy); } else { throw new MessageParseException("unknown type info: " + type); } } }
9234220a704798c9fda49f4dcd73b66915b34b2b
1,134
java
Java
opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/alignment/json/AlignmentDifferenceJsonMixin.java
roalva1/opencga
26f6fc6615d7039c9116d86171deb38bcfa7b480
[ "Apache-2.0" ]
null
null
null
opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/alignment/json/AlignmentDifferenceJsonMixin.java
roalva1/opencga
26f6fc6615d7039c9116d86171deb38bcfa7b480
[ "Apache-2.0" ]
null
null
null
opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/alignment/json/AlignmentDifferenceJsonMixin.java
roalva1/opencga
26f6fc6615d7039c9116d86171deb38bcfa7b480
[ "Apache-2.0" ]
null
null
null
29.789474
79
0.7447
996,823
/* * Copyright 2015 OpenCB * * 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. */ /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.opencb.opencga.storage.core.alignment.json; import com.fasterxml.jackson.annotation.JsonIgnore; /** * @author Jacobo Coll Moragon <lyhxr@example.com> */ public abstract class AlignmentDifferenceJsonMixin { @JsonIgnore public abstract boolean isSequenceStored(); @JsonIgnore public abstract boolean isAllSequenceStored(); }
9234224a91dfadc04d9115a5e4e46648d8c25ea6
6,463
java
Java
output/17fd993ecc644ff7808019e6850563be.java
comprakt/comprakt-fuzz-tests
c0082d105d7c54ad31ab4ea461c3b8319358eaaa
[ "Apache-2.0", "MIT" ]
null
null
null
output/17fd993ecc644ff7808019e6850563be.java
comprakt/comprakt-fuzz-tests
c0082d105d7c54ad31ab4ea461c3b8319358eaaa
[ "Apache-2.0", "MIT" ]
null
null
null
output/17fd993ecc644ff7808019e6850563be.java
comprakt/comprakt-fuzz-tests
c0082d105d7c54ad31ab4ea461c3b8319358eaaa
[ "Apache-2.0", "MIT" ]
null
null
null
41.165605
280
0.49559
996,824
class CCvpfqx4wBiv43 { } class rJ6C7aLBY { public boolean[][] v0kTRCChiq1U; public boolean l; public int[] z7QGhG3sGU () { void[] D8KVBHpgKKNH; int[][] CeBnE9phz5CNrb; LpYa8WLX G9plk; void lU60C0VEfCu7X; int[][][] k8K = false.xiP(); if ( this[ HF8Jpm().aJubyFXttx9()]) if ( new int[ this.aPY()]._S7Db()) ; ; while ( wsS[ null.Ngms]) { boolean[][][] Vw1IMS; } } public F6kO6[] TegXsrNoR; public WEWV0iQhDgDj[][] Nt9qq2n () { while ( false.aqtcJcAtuicn()) ; if ( null.ySqPBdPmhwv4l()) { while ( !!new boolean[ ( null[ gEw5FvcRHHvMu()[ false.lkkly]]).V6qc4MtW()][ !5909.Cv]) return; } if ( ( false[ new boolean[ -new boolean[ null.Ij6cu5Ay].UOz_6cMP()].rcwfAkbI4]).p5Qp26vdqfrVI()) if ( -!!true.WqtYmYiQD4H) { int[] DIym6i; }else if ( !210919720.UgMl3tmGSYnJJ) ( -!945.cJ_WPfw()).GFYAq(); void[][] IkPH; void[][] hVaOn3OfEa = !!532219708.i4d_; while ( !-new Iv7FMGiuw()[ !false.b8CBp5g8axe]) { while ( null.wg66nyNhq()) if ( !-MtIoZdRkj8BUI()[ LJ.mWoZ]) while ( ( ( !-813299[ !new LMJ65Xq()[ new g[ -!59086.DKwa3qRwoHM()][ this[ -!-!-cqC9BL.O1hw8JKr]]]]).Ue46r1i5iKUf()).pZo()) !!!-!-null[ -!-( !null[ false[ -new boolean[ this.R4wlIlv2].n5uwhR3hPC8Tj0]]).TWe]; } int zWBFstZxJjLsP = new void[ --!new int[ !new zST2enffAWPjzJ[ true.Ig6t6vPHg].p0U][ --TtY522FX5sJeDH.mJILieD]].UdgcVx() = --S.wGiHKj5NhAC; { void CX92h; while ( null.Uw_T9q0yq()) return; if ( false[ !-----this[ -null.NTMVBN1()]]) -null.xfSq1(); while ( 81856[ !--( new int[ -true[ null.fBg2DDh()]][ -79.ru89v77cFV8w3]).gSclq3A]) qldSh.Ci0AFug; while ( !-355.K7D1()) { { ; } } if ( --!EoiQ.z) ; while ( 2[ -WmHufVxDPsOnwu.ZW8OTm_]) !-false.Dg2rNOPtAsKUKz(); void[][][][] v; { while ( !new WZ3QTwmSBPFT()[ -AzCaicmna6r44[ 2040[ true.Iko0Zs]]]) !CPwFl91_f08().t7f; } { void sYo_e_ytFD; } l cf5n_Om6ytK; RcNj9bMt2IASO()[ -!( --null.a8()).AaB]; void GpXl80; ; boolean hp6610t0L5edQ; return; while ( !-( null.vIegc).gYYl0()) return; if ( ( !!!!new boolean[ 6846[ b[ !new OCbMwFVHEIDtc().MYXQAo]]].W0AwwPc()).tRR51d6IZG()) while ( null[ this[ ( true[ -pex().QIJinZUII5S])[ !CBQgo()[ new gDmeS()._rW()]]]]) this[ null[ c[ -!--!---null.wPgKhOY4mwj]]]; boolean QxQWPZn; } boolean[] k0hXDyy; if ( null[ -true[ !QZl9dNyK()[ false.hTqUJ]]]) while ( new IjnIBjhQ().HvBP7StneRI()) while ( true.NK6UobJ()) if ( true[ new Qa_jCEveXnZ3().FL()]) ;else ; boolean MThI4 = !!true.ERPAQy; ; if ( -!-!!( new Asu0f3w().EgZL4KC)[ !-!!-this.megXfo()]) return; boolean[][][] L = usOoLvdAL[ !-7192.sY()] = -this[ !new Rv5KKSxkchOJe[ 37[ new boolean[ new bfLbmP()[ -!-new G8Sp().qT()]][ !null.N6]]].v]; } public boolean[] icGdc_DEr52lwI; public int[] Z9GjhyeYEPu1 (Ip90VHQ50mMt73[] WjXq, int[][][][][][][] un, boolean[][] FvHtW) throws NTYX { if ( Y9.nZDUvG6E4TK8()) while ( -7851875.tRfgDcMpi2WB1()) while ( VevhjR().ktiKcVwo5S99p()) return;else return; int p9FyWUEPL1; boolean lJDC5tz8Qv9 = null[ new f37uf()[ HSiO().VsupVp()]]; } public static void y9vj7mBm (String[] W) throws a1J { int YiY9HD; if ( ( false.pHnjxrogh()).BMUTi()) while ( new riqok_297d991F().i7nkgYa) { { { return; } } } { { ; } int[] Ie8TJJo; !-87.f_TYKJgKc0Xc(); boolean[] mTrj1tDsr1Tj_Q; ; { while ( !!-!54064.gy9Ay4ryF) -false[ -new I().jH3ShynkxS()]; } boolean uBRJrmS2oD_; if ( this.y) if ( null.C46n) if ( ---!!HYsX9DiM5F().zto0q()) return; while ( -new int[ -!729326.YGJfdKu()][ --null.G8oDipdbyKvh]) while ( this[ !-this.KVU7WAw9fgH]) false.t4XuM; void[][] O4ZE8IETUaJ38Y; if ( !this[ ---!48565842.gepDDbnDV3_q8()]) ; while ( -this.dPDSy_LCwsb()) if ( !-p.aRxg4) { Gng[][] aPUt769yBNHcL; } while ( this.LjC0rb0wq5cL()) 134645629.VxJrT8O(); Ps JQxjfrlSm; GpL854f[][][] TgyaACJ79cEopU; boolean[] uYG87mD; } ; int aOOTCT3XC; ; { { return; } void[] _F1vrKkTru5; int V1jGfbak3nIf; void[] S; if ( --!JSIFayc().bh9bnknlBuZO()) ; !null[ !!null.Sa7NeE1]; NLpM0 Vm23HVFcPhoG; boolean[][][][] Y6Ci5tlaWo; HVmtiXQhnad[][] MLinpfMgcOg6; boolean[][][] uU; { if ( 80[ !true.iBA43]) true.k(); } boolean TSDvClMEys1; int hN; boolean qJFO5; } void DILbI1de76myoJ = -new _VmoHX2YS24P().BTu_z8XwBj(); } public boolean L (void[] RnYxveE8cFVFt, boolean[][] B8UnmSLKfQ, int IK_IMw3sA, boolean Xx) { boolean Q; int[][][] RmS0QDLc = !!this[ -!!true[ !--!BVy7uSozh_()[ new GvJzSyCB1().J40wRNUd()]]]; void[] ygcxdz9; if ( ( -( !null.q4())[ vF.nu307qY_FSsZ2()])[ !!( -!-pr9yTh_D.c0PhisQKDX0Cv()).U_Ca()]) if ( !381829902[ -!this.aatfBbfISM()]) ; G tVYM8 = !!--new int[ --!-!this[ this.u1K13mfRNqU2Ad]].xsea2aDj6(); if ( this.CiH7Eejv) if ( BC8DP[ --new tZst8DBLn()[ null.QDMh0pTgBT()]]) ; int kuv5Fs_bjD09FD; int N3rpQP; if ( false[ new JgOfBtw[ !false.B8i()].h]) if ( true.nz) ;else { FE67nor4cXcM j5BY10MWc7; } boolean[] drBD6xOOOiO = null[ ( -null[ !false.r7tQ9gv()]).ODQvR9yzeHm()] = -false.Nz2Bhb(); int cJWAsHJ = false.iLgqG1() = !false.aIZLK_UEMye8MI; AS[][][] Et6l7xLU = true.VhEvsT5Nb = M()[ !!null[ new Gh().IO3m6CnQysC]]; if ( new int[ 92.dm()][ new void[ null.vrtOOyD3c].YZfLaLEtO_of()]) 7574.JXApeYfxgvq;else return; } } class xa03yNbK_1 { }
9234224df8b0fdb2c2a03589cd043549228c42d9
887
java
Java
src/XStreamHandlers/BooleanPropertyConverter.java
mohabg/VoogaSalad
653abaaeffd75dbd17a3812fdcd9272787f1ca44
[ "MIT" ]
null
null
null
src/XStreamHandlers/BooleanPropertyConverter.java
mohabg/VoogaSalad
653abaaeffd75dbd17a3812fdcd9272787f1ca44
[ "MIT" ]
null
null
null
src/XStreamHandlers/BooleanPropertyConverter.java
mohabg/VoogaSalad
653abaaeffd75dbd17a3812fdcd9272787f1ca44
[ "MIT" ]
null
null
null
29.6
103
0.766892
996,825
package XStreamHandlers; import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.mapper.Mapper; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.value.WritableValue; /** * Created at 17/09/11 11:09.<br> * * @author Antoine Mischler <anpch@example.com> */ public class BooleanPropertyConverter extends AbstractPropertyConverter<Boolean> implements Converter { public BooleanPropertyConverter(Mapper mapper) { super(BooleanProperty.class, mapper); } @Override protected WritableValue<Boolean> createProperty() { return new SimpleBooleanProperty(); } @Override protected Class<? extends Boolean> readType(HierarchicalStreamReader reader) { return Boolean.class; } }
923422ed7aae5d5cc1f405a9158712933752faf5
809
java
Java
src/main/java/imagingbook/pub/sift/package-info.java
imagingbook/imagingbook-common
427d44797982572648444246f5ab175d7590f1b3
[ "BSD-2-Clause" ]
12
2017-02-24T10:58:58.000Z
2022-02-25T18:57:23.000Z
src/main/java/imagingbook/pub/sift/package-info.java
imagingbook/imagingbook-common
427d44797982572648444246f5ab175d7590f1b3
[ "BSD-2-Clause" ]
12
2018-03-07T08:20:29.000Z
2019-09-26T12:34:53.000Z
src/main/java/imagingbook/pub/sift/package-info.java
imagingbook/imagingbook-common
427d44797982572648444246f5ab175d7590f1b3
[ "BSD-2-Clause" ]
2
2018-09-07T07:44:45.000Z
2019-08-15T13:51:10.000Z
57.785714
84
0.614339
996,826
/******************************************************************************* * This software is provided as a supplement to the authors' textbooks on digital * image processing published by Springer-Verlag in various languages and editions. * Permission to use and distribute this software is granted under the BSD 2-Clause * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). * Copyright (c) 2006-2020 Wilhelm Burger, Mark J. Burge. All rights reserved. * Visit http://imagingbook.com for additional details. *******************************************************************************/ /** * This package implements David Lowe's SIFT feature detection. * TODO: cleanup point-related classes (KeyPoint, SiftKeyPoint, SiftDescriptor) */ package imagingbook.pub.sift;
9234238c79b327cc457e2e4ed82a6790d6178625
1,291
java
Java
bookkeeper-server/src/test/java/org/apache/bookkeeper/conf/TestBKConfiguration.java
sschepens/bookkeeper
bd2ebcd75f41552f37166616e05821f4f7752f26
[ "Apache-2.0" ]
1
2021-07-07T01:42:17.000Z
2021-07-07T01:42:17.000Z
bookkeeper-server/src/test/java/org/apache/bookkeeper/conf/TestBKConfiguration.java
sschepens/bookkeeper
bd2ebcd75f41552f37166616e05821f4f7752f26
[ "Apache-2.0" ]
null
null
null
bookkeeper-server/src/test/java/org/apache/bookkeeper/conf/TestBKConfiguration.java
sschepens/bookkeeper
bd2ebcd75f41552f37166616e05821f4f7752f26
[ "Apache-2.0" ]
null
null
null
34.891892
67
0.738962
996,827
/* * * 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.bookkeeper.conf; public class TestBKConfiguration { public static ServerConfiguration newServerConfiguration() { ServerConfiguration confReturn = new ServerConfiguration(); confReturn.setJournalFlushWhenQueueEmpty(true); // enable journal format version confReturn.setJournalFormatVersionToWrite(5); confReturn.setAllowLoopback(true); confReturn.setGcWaitTime(1000); return confReturn; } }
923423a5debd97a6d08c47c9bb1f8fc70fd9d2cf
106
java
Java
src/main/java/com/dotterbear/sorting/algorithms/Sort.java
kan01234/sorting-algorithms
93f3a46c0003ea24d3488901562bdbcbd3f2a80a
[ "MIT" ]
null
null
null
src/main/java/com/dotterbear/sorting/algorithms/Sort.java
kan01234/sorting-algorithms
93f3a46c0003ea24d3488901562bdbcbd3f2a80a
[ "MIT" ]
null
null
null
src/main/java/com/dotterbear/sorting/algorithms/Sort.java
kan01234/sorting-algorithms
93f3a46c0003ea24d3488901562bdbcbd3f2a80a
[ "MIT" ]
null
null
null
15.142857
42
0.716981
996,828
package com.dotterbear.sorting.algorithms; public interface Sort { public int[] sort(int[] nums); }
923424350aafeb70f1278a53621a89d59f778ed4
6,331
java
Java
app/src/main/java/com/xf/autoscrolltopbottomview/widget/AutoScrollTopBottomView.java
lvtanxi/AutoScrollTopBottomView
f8d00183ee5dcd2cfd847c13604f5ff71c368f95
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/xf/autoscrolltopbottomview/widget/AutoScrollTopBottomView.java
lvtanxi/AutoScrollTopBottomView
f8d00183ee5dcd2cfd847c13604f5ff71c368f95
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/xf/autoscrolltopbottomview/widget/AutoScrollTopBottomView.java
lvtanxi/AutoScrollTopBottomView
f8d00183ee5dcd2cfd847c13604f5ff71c368f95
[ "Apache-2.0" ]
null
null
null
35.567416
200
0.560101
996,829
package com.xf.autoscrolltopbottomview.widget; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.RelativeLayout; import android.widget.Scroller; /** * Created by X-FAN on 2016/7/5. */ public class AutoScrollTopBottomView extends RelativeLayout { private final int ANI_TIME = 800; private float mLastActionDownY; private View mBottomView; private ViewGroup mTopView; private Scroller mScroller; private MotionEvent mLastMoveEvent; public AutoScrollTopBottomView(Context context) { this(context, null); } public AutoScrollTopBottomView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public AutoScrollTopBottomView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mScroller = new Scroller(context); } @Override protected void onFinishInflate() { super.onFinishInflate(); if (getChildCount() != 2) { throw new IllegalStateException("only and should contain two child view"); } mBottomView = getChildAt(0); if (!(getChildAt(1) instanceof ViewGroup)) { throw new IllegalStateException("top view should be contained by a viewgroup"); } mTopView = (ViewGroup) getChildAt(1); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { View view = null; if (mTopView.getChildCount() > 0) { view = mTopView.getChildAt(0); } if (view != null) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: mLastActionDownY = ev.getRawY(); break; case MotionEvent.ACTION_MOVE: float distance = ev.getRawY() - mLastActionDownY; mLastActionDownY = ev.getRawY(); mLastMoveEvent = ev; if (!mScroller.computeScrollOffset()) { if (distance > 0 && isViewAtTop(view)) {//pull down if (Math.abs(mTopView.getScrollY() - distance) > mBottomView.getMeasuredHeight()) {//avoid out of bottom boundary mTopView.scrollBy(0, -mTopView.getScrollY() - mBottomView.getMeasuredHeight()); } else { mTopView.scrollBy(0, (int) -distance); } sendCancelEvent(); return true; } else if (distance < 0 && !isViewAtTop(mTopView)) {//pull up if ((distance - mTopView.getScrollY()) < 0) {//avoid out of top boundary mTopView.scrollBy(0, -mTopView.getScrollY()); } else { mTopView.scrollBy(0, (int) -distance); } sendCancelEvent(); return true; } } else { sendCancelEvent(); } break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: if (isInUp()) {//prepare scroll to top mScroller.startScroll(mTopView.getScrollX(), mTopView.getScrollY(), 0, -mTopView.getScrollY(), ANI_TIME); } else if (isInDown()) {//prepare scroll to bottom mScroller.startScroll(mTopView.getScrollX(), mTopView.getScrollY(), 0, -mTopView.getScrollY() - mBottomView.getMeasuredHeight(), ANI_TIME); } invalidate(); break; default: break; } } return super.dispatchTouchEvent(ev); } public void autoMove() { if ( mScroller.getCurrY() != 0) {//prepare scroll to top mScroller.startScroll(mTopView.getScrollX(), mTopView.getScrollY(), 0, -mTopView.getScrollY(), ANI_TIME/2); } else {//prepare scroll to bottom mScroller.startScroll(mTopView.getScrollX(), mTopView.getScrollY(), 0, -mTopView.getScrollY() - mBottomView.getMeasuredHeight(), ANI_TIME/2); } invalidate(); } @Override public void computeScroll() { if (mScroller.computeScrollOffset()) { mTopView.scrollTo(mScroller.getCurrX(), mScroller.getCurrY()); invalidate(); } } /** * detect top view in top half of bottom view * * @return */ private boolean isInUp() {//在上半部分内 int y = -mTopView.getScrollY(); if ((y > 0 && y < mBottomView.getMeasuredHeight() / 2)) { return true; } return false; } /** * detect top view in bottom half of bottom view * * @return */ private boolean isInDown() {//在下半部分内 int y = -mTopView.getScrollY(); if (y >= mBottomView.getMeasuredHeight() / 2 && y < mBottomView.getMeasuredHeight()) { return true; } return false; } private boolean isViewAtTop(View view) { if (view instanceof AbsListView) {//这里可以自己更改代码,判断listview等在什么情况下为拉到顶部,默认为第一个item可见的时候 final AbsListView absListView = (AbsListView) view; return absListView.getChildCount() > 0 && (absListView.getFirstVisiblePosition() == 0 && absListView.getChildAt(0).getTop() >= absListView.getPaddingTop()); } else { return view.getScrollY() == 0; } } /** * 滑动过程调用,解决滑动与其他事件冲突 * solve conflict move event between other event */ private void sendCancelEvent() { if (mLastMoveEvent == null) { return; } MotionEvent last = mLastMoveEvent; MotionEvent e = MotionEvent.obtain(last.getDownTime(), last.getEventTime() + ViewConfiguration.getLongPressTimeout(), MotionEvent.ACTION_CANCEL, last.getX(), last.getY(), last.getMetaState()); super.dispatchTouchEvent(e); } }
923424746681cabb49e871b30fb828f86605b5f8
14,084
java
Java
platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java
liveqmock/platform-tools-idea
1c4b76108add6110898a7e3f8f70b970e352d3d4
[ "Apache-2.0" ]
2
2015-05-08T15:07:10.000Z
2022-03-09T05:47:53.000Z
platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java
lshain-android-source/tools-idea
b37108d841684bcc2af45a2539b75dd62c4e283c
[ "Apache-2.0" ]
null
null
null
platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java
lshain-android-source/tools-idea
b37108d841684bcc2af45a2539b75dd62c4e283c
[ "Apache-2.0" ]
2
2017-04-24T15:48:40.000Z
2022-03-09T05:48:05.000Z
39.122222
165
0.690926
996,830
/* * Copyright 2000-2011 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.notification.impl; import com.intellij.ide.FrameStateManager; import com.intellij.notification.*; import com.intellij.notification.impl.ui.NotificationsUtil; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.project.DumbAwareRunnable; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.project.ProjectManagerAdapter; import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.popup.*; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.IdeFrame; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.WindowManager; import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeFrame; import com.intellij.ui.BalloonImpl; import com.intellij.ui.BalloonLayout; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.util.ArrayUtil; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import java.awt.*; import java.util.ArrayList; import java.util.List; /** * @author spleaner */ public class NotificationsManagerImpl extends NotificationsManager { public NotificationsManagerImpl() { ApplicationManager.getApplication().getMessageBus().connect().subscribe(Notifications.TOPIC, new MyNotificationListener(null)); } @Override public void expire(@NotNull final Notification notification) { UIUtil.invokeLaterIfNeeded(new Runnable() { public void run() { EventLog.expireNotification(notification); } }); } @Override public <T extends Notification> T[] getNotificationsOfType(Class<T> klass, @Nullable final Project project) { final List<T> result = new ArrayList<T>(); if (project == null || !project.isDefault() && !project.isDisposed()) { for (Notification notification : EventLog.getLogModel(project).getNotifications()) { if (klass.isInstance(notification)) { //noinspection unchecked result.add((T) notification); } } } return ArrayUtil.toObjectArray(result, klass); } private static void doNotify(@NotNull final Notification notification, @Nullable NotificationDisplayType displayType, @Nullable final Project project) { final NotificationsConfigurationImpl configuration = NotificationsConfigurationImpl.getNotificationsConfigurationImpl(); if (!configuration.isRegistered(notification.getGroupId())) { configuration.register(notification.getGroupId(), displayType == null ? NotificationDisplayType.BALLOON : displayType); } final NotificationSettings settings = NotificationsConfigurationImpl.getSettings(notification.getGroupId()); boolean shouldLog = settings.isShouldLog(); boolean displayable = settings.getDisplayType() != NotificationDisplayType.NONE; boolean willBeShown = displayable && NotificationsConfigurationImpl.getNotificationsConfigurationImpl().SHOW_BALLOONS; if (!shouldLog && !willBeShown) { notification.expire(); } if (NotificationsConfigurationImpl.getNotificationsConfigurationImpl().SHOW_BALLOONS) { final Runnable runnable = new DumbAwareRunnable() { @Override public void run() { showNotification(notification, project); } }; if (project == null) { runnable.run(); } else if (!project.isDisposed()) { StartupManager.getInstance(project).runWhenProjectIsInitialized(runnable); } } } private static void showNotification(final Notification notification, @Nullable final Project project) { Application application = ApplicationManager.getApplication(); if (application instanceof ApplicationEx && !((ApplicationEx)application).isLoaded()) { application.invokeLater(new Runnable() { @Override public void run() { showNotification(notification, project); } }, ModalityState.current()); return; } String groupId = notification.getGroupId(); final NotificationSettings settings = NotificationsConfigurationImpl.getSettings(groupId); NotificationDisplayType type = settings.getDisplayType(); String toolWindowId = NotificationsConfigurationImpl.getNotificationsConfigurationImpl().getToolWindowId(groupId); if (type == NotificationDisplayType.TOOL_WINDOW && (toolWindowId == null || project == null || !ToolWindowManager.getInstance(project).canShowNotification(toolWindowId))) { type = NotificationDisplayType.BALLOON; } switch (type) { case NONE: return; //case EXTERNAL: // notifyByExternal(notification); // break; case STICKY_BALLOON: case BALLOON: default: Balloon balloon = notifyByBalloon(notification, type, project); if (!settings.isShouldLog() || type == NotificationDisplayType.STICKY_BALLOON) { if (balloon == null) { notification.expire(); } else { balloon.addListener(new JBPopupAdapter() { @Override public void onClosed(LightweightWindowEvent event) { if (!event.isOk()) { notification.expire(); } } }); } } break; case TOOL_WINDOW: MessageType messageType = notification.getType() == NotificationType.ERROR ? MessageType.ERROR : notification.getType() == NotificationType.WARNING ? MessageType.WARNING : MessageType.INFO; final NotificationListener notificationListener = notification.getListener(); HyperlinkListener listener = notificationListener == null ? null : new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { notificationListener.hyperlinkUpdate(notification, e); } }; assert toolWindowId != null; String msg = notification.getTitle(); if (StringUtil.isNotEmpty(notification.getContent())) { if (StringUtil.isNotEmpty(msg)) { msg += "<br>"; } msg += notification.getContent(); } //noinspection SSBasedInspection ToolWindowManager.getInstance(project).notifyByBalloon(toolWindowId, messageType, msg, notification.getIcon(), listener); } } @Nullable private static Balloon notifyByBalloon(final Notification notification, final NotificationDisplayType displayType, @Nullable final Project project) { if (isDummyEnvironment()) return null; Window window = findWindowForBalloon(project); if (window instanceof IdeFrame) { final ProjectManager projectManager = ProjectManager.getInstance(); final boolean noProjects = projectManager.getOpenProjects().length == 0; final boolean sticky = NotificationDisplayType.STICKY_BALLOON == displayType || noProjects; final Balloon balloon = createBalloon((IdeFrame)window, notification, false, false); Disposer.register(project != null ? project : ApplicationManager.getApplication(), balloon); if (notification.isExpired()) { return null; } BalloonLayout layout = ((IdeFrame)window).getBalloonLayout(); if (layout == null) return null; layout.add(balloon); if (NotificationDisplayType.BALLOON == displayType) { FrameStateManager.getInstance().getApplicationActive().doWhenDone(new Runnable() { @Override public void run() { if (balloon.isDisposed()) { return; } if (!sticky) { ((BalloonImpl)balloon).startFadeoutTimer(15000); ((BalloonImpl)balloon).setHideOnClickOutside(true); } else //noinspection ConstantConditions if (noProjects) { projectManager.addProjectManagerListener(new ProjectManagerAdapter() { @Override public void projectOpened(Project project) { projectManager.removeProjectManagerListener(this); if (!balloon.isDisposed()) { ((BalloonImpl)balloon).startFadeoutTimer(300); } } }); } } }); } return balloon; } return null; } @Nullable public static Window findWindowForBalloon(Project project) { Window frame = WindowManager.getInstance().getFrame(project); if (frame == null && project == null) { frame = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); } if (frame == null && project == null) { frame = (Window)WelcomeFrame.getInstance(); } return frame; } public static Balloon createBalloon(@NotNull final IdeFrame window, final Notification notification, final boolean showCallout, final boolean hideOnClickOutside) { final JEditorPane text = new JEditorPane(); text.setEditorKit(UIUtil.getHTMLEditorKit()); final HyperlinkListener listener = NotificationsUtil.wrapListener(notification); if (listener != null) { text.addHyperlinkListener(listener); } final JLabel label = new JLabel(NotificationsUtil.buildHtml(notification, null)); text.setText(NotificationsUtil.buildHtml(notification, "width:" + Math.min(400, label.getPreferredSize().width) + "px;")); text.setEditable(false); text.setOpaque(false); if (UIUtil.isUnderNimbusLookAndFeel()) { text.setBackground(UIUtil.TRANSPARENT_COLOR); } text.setBorder(null); final JPanel content = new NonOpaquePanel(new BorderLayout((int)(label.getIconTextGap() * 1.5), (int)(label.getIconTextGap() * 1.5))); text.setCaretPosition(0); JScrollPane pane = ScrollPaneFactory.createScrollPane(text, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); pane.setBorder(null); pane.setOpaque(false); pane.getViewport().setOpaque(false); content.add(pane, BorderLayout.CENTER); final NonOpaquePanel north = new NonOpaquePanel(new BorderLayout()); north.add(new JLabel(NotificationsUtil.getIcon(notification)), BorderLayout.NORTH); content.add(north, BorderLayout.WEST); content.setBorder(new EmptyBorder(2, 4, 2, 4)); Dimension preferredSize = text.getPreferredSize(); text.setSize(preferredSize); Dimension paneSize = new Dimension(text.getPreferredSize()); int maxHeight = Math.min(400, window.getComponent().getHeight() - 20); int maxWidth = Math.min(600, window.getComponent().getWidth() - 20); if (paneSize.height > maxHeight) { pane.setPreferredSize(new Dimension(Math.min(maxWidth, paneSize.width + UIUtil.getScrollBarWidth()), maxHeight)); } else if (paneSize.width > maxWidth) { pane.setPreferredSize(new Dimension(maxWidth, paneSize.height + UIUtil.getScrollBarWidth())); } final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(content); builder.setFillColor(NotificationsUtil.getBackground(notification)).setCloseButtonEnabled(true).setShowCallout(showCallout) .setHideOnClickOutside(hideOnClickOutside) .setHideOnAction(hideOnClickOutside) .setHideOnKeyOutside(hideOnClickOutside).setHideOnFrameResize(false) .setBorderColor(NotificationsUtil.getBorderColor(notification)); final Balloon balloon = builder.createBalloon(); notification.setBalloon(balloon); return balloon; } private static boolean isDummyEnvironment() { final Application application = ApplicationManager.getApplication(); return application.isUnitTestMode() || application.isCommandLine(); } public static class ProjectNotificationsComponent { public ProjectNotificationsComponent(final Project project) { if (isDummyEnvironment()) { return; } project.getMessageBus().connect().subscribe(Notifications.TOPIC, new MyNotificationListener(project)); } } private static class MyNotificationListener implements Notifications { private final Project myProject; public MyNotificationListener(@Nullable Project project) { myProject = project; } @Override public void notify(@NotNull Notification notification) { doNotify(notification, null, myProject); } @Override public void register(@NotNull String groupDisplayName, @NotNull NotificationDisplayType defaultDisplayType) { } @Override public void register(@NotNull String groupDisplayName, @NotNull NotificationDisplayType defaultDisplayType, boolean shouldLog) { } } }
9234247ff0c30b580ae69fcf76bcc65092f25e31
772
java
Java
src/main/java/com/ddf/fakeplayer/js/functions/BaseFunction.java
Townrain/FakePlayer
2c238b8c9e28bf5a443e3d4ed8ab2654b8d81776
[ "MIT" ]
73
2021-02-07T06:08:58.000Z
2022-03-27T15:59:26.000Z
src/main/java/com/ddf/fakeplayer/js/functions/BaseFunction.java
xiaoqch/FakePlayer
5b69025438ad86ed38f586ac352df29222f88041
[ "MIT" ]
45
2021-02-20T10:49:00.000Z
2022-03-20T14:54:13.000Z
src/main/java/com/ddf/fakeplayer/js/functions/BaseFunction.java
xiaoqch/FakePlayer
5b69025438ad86ed38f586ac352df29222f88041
[ "MIT" ]
14
2021-03-02T15:01:22.000Z
2022-03-23T07:04:44.000Z
28.592593
78
0.734456
996,831
package com.ddf.fakeplayer.js.functions; import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject; public class BaseFunction extends org.mozilla.javascript.BaseFunction { public BaseFunction() {} public BaseFunction(Scriptable scope) { super(scope, ScriptableObject.getFunctionPrototype(scope)); } public BaseFunction(Scriptable scope, Scriptable prototype) { super(scope, prototype); } public void install(Scriptable scope) { ScriptableObject.putProperty(scope, getFunctionName(), this); } @Override public Scriptable construct(Context cx, Scriptable scope, Object[] args) { throw new UnsupportedOperationException(); } }
923424967bcfcba0099d99e8dc98e95fa5b2d8f4
1,565
java
Java
ruby-api/src/main/java/org/jetbrains/plugins/ruby/rails/langs/rhtml/lang/structureView/impl/xml/RHTMLStructureViewElementProvider.java
consulo/incubating-consulo-ruby
bea61f038c273eaf46a2ac35d874b00ae7bfab1a
[ "Apache-2.0" ]
null
null
null
ruby-api/src/main/java/org/jetbrains/plugins/ruby/rails/langs/rhtml/lang/structureView/impl/xml/RHTMLStructureViewElementProvider.java
consulo/incubating-consulo-ruby
bea61f038c273eaf46a2ac35d874b00ae7bfab1a
[ "Apache-2.0" ]
3
2021-11-01T08:26:45.000Z
2021-11-06T17:29:47.000Z
ruby-api/src/main/java/org/jetbrains/plugins/ruby/rails/langs/rhtml/lang/structureView/impl/xml/RHTMLStructureViewElementProvider.java
consulo/incubating-consulo-ruby
bea61f038c273eaf46a2ac35d874b00ae7bfab1a
[ "Apache-2.0" ]
null
null
null
33.297872
102
0.787859
996,832
/* * Copyright 2000-2008 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.plugins.ruby.rails.langs.rhtml.lang.structureView.impl.xml; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.jetbrains.plugins.ruby.rails.langs.rhtml.lang.psi.impl.rhtmlRoot.RHTMLRubyInjectionTag; import org.jetbrains.plugins.ruby.rails.langs.rhtml.lang.psi.impl.rhtmlRoot.RHTMLRubyInjectionTagImpl; import com.intellij.ide.structureView.StructureViewTreeElement; import com.intellij.ide.structureView.xml.XmlStructureViewElementProvider; import com.intellij.psi.xml.XmlTag; /** * Created by IntelliJ IDEA. * * @author: Roman Chernyatchik * @date: 21.05.2007 */ public class RHTMLStructureViewElementProvider implements XmlStructureViewElementProvider { @Override @Nullable public StructureViewTreeElement createCustomXmlTagTreeElement(@Nonnull final XmlTag tag) { if(tag instanceof RHTMLRubyInjectionTag) { return new RHTMLScriptNode((RHTMLRubyInjectionTagImpl) tag); } return null; } }
923424ac73946eae90c76e1fe5061bf0b64289ff
1,107
java
Java
launcher/src/main/java/pt/hlbk/launcher/config/ActorsConfig.java
halfbreak/order-management-event-source
5f76d1b4ee67c8e031ef4eafa96db7a839978726
[ "MIT" ]
null
null
null
launcher/src/main/java/pt/hlbk/launcher/config/ActorsConfig.java
halfbreak/order-management-event-source
5f76d1b4ee67c8e031ef4eafa96db7a839978726
[ "MIT" ]
null
null
null
launcher/src/main/java/pt/hlbk/launcher/config/ActorsConfig.java
halfbreak/order-management-event-source
5f76d1b4ee67c8e031ef4eafa96db7a839978726
[ "MIT" ]
null
null
null
30.75
92
0.727191
996,833
package pt.hlbk.launcher.config; import akka.actor.ActorRef; import akka.actor.ActorSystem; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import pt.hlbk.actors.orders.OrderPersister; import pt.hlbk.actors.orders.OrderRouter; import pt.hlbk.actors.source.OrderListener; @Configuration public class ActorsConfig { @Bean ActorSystem orderActorSystem() { return ActorSystem.create("orders"); } @Bean ActorRef orderPersister(final ActorSystem orderActorSystem) { return orderActorSystem.actorOf(OrderPersister.props(), "order-persister"); } @Bean ActorRef orderRouter(final ActorSystem orderActorSystem, final ActorRef orderPersister) { return orderActorSystem.actorOf(OrderRouter.props(orderPersister), "order-router"); } @Bean ActorRef orderListener(final ActorSystem orderActorSystem, final ActorRef orderRouter) { return orderActorSystem.actorOf(OrderListener.props(orderRouter), "order-listener"); } }
92342574d859fcd9b3d3ca5018dea7b54763581b
30,193
java
Java
jt-lookup/src/main/java/it/geosolutions/jaiext/lookup/LookupTable.java
simboss/jai-ext
dad228002555e474cdc1cff8a0004ca0cbc909ff
[ "Apache-2.0" ]
null
null
null
jt-lookup/src/main/java/it/geosolutions/jaiext/lookup/LookupTable.java
simboss/jai-ext
dad228002555e474cdc1cff8a0004ca0cbc909ff
[ "Apache-2.0" ]
null
null
null
jt-lookup/src/main/java/it/geosolutions/jaiext/lookup/LookupTable.java
simboss/jai-ext
dad228002555e474cdc1cff8a0004ca0cbc909ff
[ "Apache-2.0" ]
null
null
null
35.901308
150
0.640778
996,834
/* JAI-Ext - OpenSource Java Advanced Image Extensions Library * http://www.geo-solutions.it/ * Copyright 2014 GeoSolutions * 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 it.geosolutions.jaiext.lookup; import it.geosolutions.jaiext.range.Range; import java.awt.Rectangle; import java.awt.image.DataBuffer; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferInt; import java.awt.image.DataBufferShort; import java.awt.image.DataBufferUShort; import java.awt.image.Raster; import java.awt.image.SampleModel; import java.awt.image.WritableRaster; import java.io.Serializable; import javax.media.jai.PlanarImage; import javax.media.jai.RasterFactory; import javax.media.jai.iterator.RandomIter; import com.sun.media.jai.util.DataBufferUtils; /** * This abstract class defines the general methods of a LookupTable. This class contains all the table informations used by its direct subclasses for * doing the lookup operation. The Constructor methods are called by all the 4 subclasses(one for every integral data type). The set/unsetROI() and * set/unsetNoData() methods are used for setting or unsetting the ROI or No Data Range used by this table. ALl the get() methods are support methods * used for retrieve table information in a faster way. Lookup(), lookupFloat() and lookupDouble() are 3 methods that return the table data associated * with the selected input image. The lase method called lookup(Raster,WritableRaster,Rectangle) is abstract because its implementation depends on the * subClass data type. */ public abstract class LookupTable implements Serializable { /** The table data. */ protected transient DataBuffer data; /** The band offset values */ protected int[] tableOffsets; /** Destination no data for Byte images */ protected byte destinationNoDataByte; /** Destination no data for Short/Ushort images */ protected short destinationNoDataShort; /** Destination no data for Integer images */ protected int destinationNoDataInt; /** Destination no data for Float images */ protected float destinationNoDataFloat; /** Destination no data for Double images */ protected double destinationNoDataDouble; /** Range object containing no data values */ protected Range noData; /** Rectangle containing roi bounds */ protected Rectangle roiBounds; /** Iterator used for iterating on the roi data */ protected RandomIter roiIter; /** Boolean indicating if Roi RasterAccessor must be used */ protected boolean useROIAccessor; /** ROI image */ protected PlanarImage srcROIImage; /** Boolean indicating if the image contains No Data values */ protected boolean hasNoData; /** Boolean indicating if the image contains a ROI */ protected boolean hasROI; /** * Constructs a single-banded byte lookup table. The index offset is 0. * * @param data The single-banded byte data. * @throws IllegalArgumentException if data is null. */ protected LookupTable(byte[] data) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.data = new DataBufferByte(data, data.length); this.initOffsets(1, 0); } /** * Constructs a single-banded byte lookup table with an index offset. * * @param data The single-banded byte data. * @param offset The offset. * @throws IllegalArgumentException if data is null. */ protected LookupTable(byte[] data, int offset) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, offset); this.data = new DataBufferByte(data, data.length); } /** * Constructs a multi-banded byte lookup table. The index offset for each band is 0. * * @param data The multi-banded byte data in [band][index] format. * @throws IllegalArgumentException if data is null. */ public LookupTable(byte[][] data) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, 0); this.data = new DataBufferByte(data, data[0].length); } /** * Constructs a multi-banded byte lookup table where all bands have the same index offset. * * @param data The multi-banded byte data in [band][index] format. * @param offset The common offset for all bands. * @throws IllegalArgumentException if data is null. */ public LookupTable(byte[][] data, int offset) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offset); this.data = new DataBufferByte(data, data[0].length); } /** * Constructs a multi-banded byte lookup table where each band has a different index offset. * * @param data The multi-banded byte data in [band][index] format. * @param offsets The offsets for the bands. * @throws IllegalArgumentException if data is null. */ protected LookupTable(byte[][] data, int[] offsets) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offsets); this.data = new DataBufferByte(data, data[0].length); } /** * Constructs a single-banded short or unsigned short lookup table. The index offset is 0. * * @param data The single-banded short data. * @param isUShort True if data type is DataBuffer.TYPE_USHORT; false if data type is DataBuffer.TYPE_SHORT. * @throws IllegalArgumentException if data is null. */ protected LookupTable(short[] data, boolean isUShort) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, 0); if (isUShort) { this.data = new DataBufferUShort(data, data.length); } else { this.data = new DataBufferShort(data, data.length); } } /** * Constructs a single-banded short or unsigned short lookup table with an index offset. * * @param data The single-banded short data. * @param offset The offset. * @param isUShort True if data type is DataBuffer.TYPE_USHORT; false if data type is DataBuffer.TYPE_SHORT. * @throws IllegalArgumentException if data is null. */ protected LookupTable(short[] data, int offset, boolean isUShort) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, offset); if (isUShort) { this.data = new DataBufferUShort(data, data.length); } else { this.data = new DataBufferShort(data, data.length); } } /** * Constructs a multi-banded short or unsigned short lookup table. The index offset for each band is 0. * * @param data The multi-banded short data in [band][index] format. * @param isUShort True if data type is DataBuffer.TYPE_USHORT; false if data type is DataBuffer.TYPE_SHORT. * @throws IllegalArgumentException if data is null. */ protected LookupTable(short[][] data, boolean isUShort) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, 0); if (isUShort) { this.data = new DataBufferUShort(data, data[0].length); } else { this.data = new DataBufferShort(data, data[0].length); } } /** * Constructs a multi-banded short or unsigned short lookup table where all bands have the same index offset. * * @param data The multi-banded short data in [band][index] format. * @param offset The common offset for all bands. * @param isUShort True if data type is DataBuffer.TYPE_USHORT; false if data type is DataBuffer.TYPE_SHORT. * @throws IllegalArgumentException if data is null. */ protected LookupTable(short[][] data, int offset, boolean isUShort) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offset); if (isUShort) { this.data = new DataBufferUShort(data, data[0].length); } else { this.data = new DataBufferShort(data, data[0].length); } } /** * Constructs a multi-banded short or unsigned short lookup table where each band has a different index offset. * * @param data The multi-banded short data in [band][index] format. * @param offsets The offsets for the bands. * @param isUShort True if data type is DataBuffer.TYPE_USHORT; false if data type is DataBuffer.TYPE_SHORT. * @throws IllegalArgumentException if data is null. */ protected LookupTable(short[][] data, int[] offsets, boolean isUShort) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offsets); if (isUShort) { this.data = new DataBufferUShort(data, data[0].length); } else { this.data = new DataBufferShort(data, data[0].length); } } /** * Constructs a single-banded int lookup table. The index offset is 0. * * @param data The single-banded int data. * @throws IllegalArgumentException if data is null. */ protected LookupTable(int[] data) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, 0); this.data = new DataBufferInt(data, data.length); } /** * Constructs a single-banded int lookup table with an index offset. * * @param data The single-banded int data. * @param offset The offset. * @throws IllegalArgumentException if data is null. */ protected LookupTable(int[] data, int offset) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, offset); this.data = new DataBufferInt(data, data.length); } /** * Constructs a multi-banded int lookup table. The index offset for each band is 0. * * @param data The multi-banded int data in [band][index] format. * @throws IllegalArgumentException if data is null. */ protected LookupTable(int[][] data) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, 0); this.data = new DataBufferInt(data, data[0].length); } /** * Constructs a multi-banded int lookup table where all bands have the same index offset. * * @param data The multi-banded int data in [band][index] format. * @param offset The common offset for all bands. * @throws IllegalArgumentException if data is null. */ protected LookupTable(int[][] data, int offset) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offset); this.data = new DataBufferInt(data, data[0].length); } /** * Constructs a multi-banded int lookup table where each band has a different index offset. * * @param data The multi-banded int data in [band][index] format. * @param offsets The offsets for the bands. * @throws IllegalArgumentException if data is null. */ protected LookupTable(int[][] data, int[] offsets) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offsets); this.data = new DataBufferInt(data, data[0].length); } /** * Constructs a single-banded float lookup table. The index offset is 0. * * @param data The single-banded float data. * @throws IllegalArgumentException if data is null. */ protected LookupTable(float[] data) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, 0); this.data = DataBufferUtils.createDataBufferFloat(data, data.length); } /** * Constructs a single-banded float lookup table with an index offset. * * @param data The single-banded float data. * @param offset The offset. * @throws IllegalArgumentException if data is null. */ protected LookupTable(float[] data, int offset) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, offset); this.data = DataBufferUtils.createDataBufferFloat(data, data.length); } /** * Constructs a multi-banded float lookup table. The index offset for each band is 0. * * @param data The multi-banded float data in [band][index] format. * @throws IllegalArgumentException if data is null. */ protected LookupTable(float[][] data) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, 0); this.data = DataBufferUtils.createDataBufferFloat(data, data[0].length); } /** * Constructs a multi-banded float lookup table where all bands have the same index offset. * * @param data The multi-banded float data in [band][index] format. * @param offset The common offset for all bands. * @throws IllegalArgumentException if data is null. */ protected LookupTable(float[][] data, int offset) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offset); this.data = DataBufferUtils.createDataBufferFloat(data, data[0].length); } /** * Constructs a multi-banded float lookup table where each band has a different index offset. * * @param data The multi-banded float data in [band][index] format. * @param offsets The offsets for the bands. * @throws IllegalArgumentException if data is null. */ protected LookupTable(float[][] data, int[] offsets) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offsets); this.data = DataBufferUtils.createDataBufferFloat(data, data[0].length); } /** * Constructs a single-banded double lookup table. The index offset is 0. * * @param data The single-banded double data. * @throws IllegalArgumentException if data is null. */ protected LookupTable(double[] data) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, 0); this.data = DataBufferUtils.createDataBufferDouble(data, data.length); } /** * Constructs a single-banded double lookup table with an index offset. * * @param data The single-banded double data. * @param offset The offset. * @throws IllegalArgumentException if data is null. */ protected LookupTable(double[] data, int offset) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(1, offset); this.data = DataBufferUtils.createDataBufferDouble(data, data.length); } /** * Constructs a multi-banded double lookup table. The index offset for each band is 0. * * @param data The multi-banded double data in [band][index] format. * @throws IllegalArgumentException if data is null. */ protected LookupTable(double[][] data) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, 0); this.data = DataBufferUtils.createDataBufferDouble(data, data[0].length); } /** * Constructs a multi-banded double lookup table where all bands have the same index offset. * * @param data The multi-banded double data in [band][index] format. * @param offset The common offset for all bands. * @throws IllegalArgumentException if data is null. */ protected LookupTable(double[][] data, int offset) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offset); this.data = DataBufferUtils.createDataBufferDouble(data, data[0].length); } /** * Constructs a multi-banded double lookup table where each band has a different index offset. * * @param data The multi-banded double data in [band][index] format. * @param offsets The offsets for the bands. * @throws IllegalArgumentException if data is null. */ protected LookupTable(double[][] data, int[] offsets) { if (data == null) { throw new IllegalArgumentException("Input data cannot be null"); } this.initOffsets(data.length, offsets); this.data = DataBufferUtils.createDataBufferDouble(data, data[0].length); } /** * Returns the table data as a DataBuffer. */ public DataBuffer getData() { return data; } /** * Returns the byte table data in array format, or null if the table's data type is not byte. */ public byte[][] getByteData() { return data instanceof DataBufferByte ? ((DataBufferByte) data).getBankData() : null; } /** * Returns the byte table data of a specific band in array format, or null if the table's data type is not byte. */ public byte[] getByteData(int band) { return data instanceof DataBufferByte ? ((DataBufferByte) data).getData(band) : null; } /** * Returns the short table data in array format, or null if the table's data type is not short. This includes both signed and unsigned short table * data. * */ public short[][] getShortData() { if (data instanceof DataBufferUShort) { return ((DataBufferUShort) data).getBankData(); } else if (data instanceof DataBufferShort) { return ((DataBufferShort) data).getBankData(); } else { return null; } } /** * Returns the short table data of a specific band in array format, or null if the table's data type is not short. * */ public short[] getShortData(int band) { if (data instanceof DataBufferUShort) { return ((DataBufferUShort) data).getData(band); } else if (data instanceof DataBufferShort) { return ((DataBufferShort) data).getData(band); } else { return null; } } /** * Returns the integer table data in array format, or null if the table's data type is not int. * */ public int[][] getIntData() { return data instanceof DataBufferInt ? ((DataBufferInt) data).getBankData() : null; } /** * Returns the integer table data of a specific band in array format, or null if table's data type is not int. * */ public int[] getIntData(int band) { return data instanceof DataBufferInt ? ((DataBufferInt) data).getData(band) : null; } /** * Returns the float table data in array format, or null if the table's data type is not float. * */ public float[][] getFloatData() { return data.getDataType() == DataBuffer.TYPE_FLOAT ? DataBufferUtils.getBankDataFloat(data) : null; } /** * Returns the float table data of a specific band in array format, or null if table's data type is not float. * */ public float[] getFloatData(int band) { return data.getDataType() == DataBuffer.TYPE_FLOAT ? DataBufferUtils.getDataFloat(data, band) : null; } /** * Returns the double table data in array format, or null if the table's data type is not double. * */ public double[][] getDoubleData() { return data.getDataType() == DataBuffer.TYPE_DOUBLE ? DataBufferUtils .getBankDataDouble(data) : null; } /** * Returns the double table data of a specific band in array format, or null if table's data type is not double. * */ public double[] getDoubleData(int band) { return data.getDataType() == DataBuffer.TYPE_DOUBLE ? DataBufferUtils.getDataDouble(data, band) : null; } /** Returns the index offsets of entry 0 for all bands. */ public int[] getOffsets() { return tableOffsets; } /** * Returns the index offset of entry 0 for the default band. * */ public int getOffset() { return tableOffsets[0]; } /** * Returns the index offset of entry 0 for a specific band. * */ public int getOffset(int band) { return tableOffsets[band]; } /** Returns the number of bands of the table. */ public int getNumBands() { return data.getNumBanks(); } /** * Returns the number of entries per band of the table. * */ public int getNumEntries() { return data.getSize(); } /** * Returns the data type of the table data. * */ public int getDataType() { return data.getDataType(); } /** * Returns the number of bands of the destination image, based on the number of bands of the source image and lookup table. * * @param srcNumBands The number of bands of the source image. * @return the number of bands in destination image. */ public int getDestNumBands(int srcNumBands) { int tblNumBands = getNumBands(); return srcNumBands == 1 ? tblNumBands : srcNumBands; } /** * Returns a <code>SampleModel</code> suitable for holding the output of a lookup operation on the source data described by a given SampleModel * with this table. The width and height of the destination SampleModel are the same as that of the source. This method will return null if the * source SampleModel has a non-integral data type. * * @param srcSampleModel The SampleModel of the source image. * * @throws IllegalArgumentException if srcSampleModel is null. * @return sampleModel suitable for the destination image. */ public SampleModel getDestSampleModel(SampleModel srcSampleModel) { if (srcSampleModel == null) { throw new IllegalArgumentException("Source SampleModel must be not null"); } return getDestSampleModel(srcSampleModel, srcSampleModel.getWidth(), srcSampleModel.getHeight()); } /** * Returns a <code>SampleModel</code> suitable for holding the output of a lookup operation on the source data described by a given SampleModel * with this table. This method will return null if the source SampleModel has a non-integral data type. * * @param srcSampleModel The SampleModel of the source image. * @param width The width of the destination SampleModel. * @param height The height of the destination SampleModel. * * @throws IllegalArgumentException if srcSampleModel is null. * @return sampleModel suitable for the destination image. */ public SampleModel getDestSampleModel(SampleModel srcSampleModel, int width, int height) { if (srcSampleModel == null) { throw new IllegalArgumentException("Source SampleModel must be not null"); } // Control if the source has non-integral data type if (!isIntegralDataType(srcSampleModel)) { return null; } // If the sample model is present, then a new component sample model is created return RasterFactory.createComponentSampleModel(srcSampleModel, getDataType(), width, height, getDestNumBands(srcSampleModel.getNumBands())); } /** * Validates data type. Returns true if it's one of the integral data types; false otherwise. * * @throws IllegalArgumentException if sampleModel is null. */ public boolean isIntegralDataType(SampleModel sampleModel) { if (sampleModel == null) { throw new IllegalArgumentException("SampleModel must be not null"); } return isIntegralDataType(sampleModel.getTransferType()); } /** * Returns <code>true</code> if the specified data type is an integral data type, such as byte, ushort, short, or int. */ public boolean isIntegralDataType(int dataType) { if ((dataType == DataBuffer.TYPE_BYTE) || (dataType == DataBuffer.TYPE_USHORT) || (dataType == DataBuffer.TYPE_SHORT) || (dataType == DataBuffer.TYPE_INT)) { return true; } else { return false; } } /** * Performs lookup on a given value belonging to a given source band, and returns the result as an int. NoData Range or ROI are not considered. * * @param band The source band the value is from. * @param value The source value to be placed through the lookup table. */ public int lookup(int band, int value) { return data.getElem(band, value - tableOffsets[band]); } /** * Performs lookup on a given value belonging to a given source band, and returns the result as a float. NoData Range or ROI are not considered. * * @param band The source band the value is from. * @param value The source value to be placed through the lookup table. */ public float lookupFloat(int band, int value) { return data.getElemFloat(band, value - tableOffsets[band]); } /** * Performs lookup on a given value belonging to a given source band, and returns the result as a double. NoData Range or ROI are not considered. * * @param band The source band the value is from. * @param value The source value to be placed through the lookup table. */ public double lookupDouble(int band, int value) { return data.getElemDouble(band, value - tableOffsets[band]); } /** This method sets the same table offset for all the bands */ protected void initOffsets(int nbands, int offset) { tableOffsets = new int[nbands]; for (int i = 0; i < nbands; i++) { tableOffsets[i] = offset; } } /** This method sets the table offset related to every band */ protected void initOffsets(int nbands, int[] offset) { tableOffsets = new int[nbands]; for (int i = 0; i < nbands; i++) { tableOffsets[i] = offset[i]; } } /** This method sets destination no data used for No Data or ROI calculation */ public void setDestinationNoData(double destinationNoData) { // Selection of the table data type int dataType = getDataType(); // Cast of the initial double value to that of the data type switch (dataType) { case DataBuffer.TYPE_BYTE: destinationNoDataByte = (byte) ((byte) destinationNoData & 0xff); break; case DataBuffer.TYPE_USHORT: destinationNoDataShort = (short) ((short) destinationNoData & 0xffff); break; case DataBuffer.TYPE_SHORT: destinationNoDataShort = (short) destinationNoData; break; case DataBuffer.TYPE_INT: destinationNoDataInt = (int) destinationNoData; break; case DataBuffer.TYPE_FLOAT: destinationNoDataFloat = (float) destinationNoData; break; case DataBuffer.TYPE_DOUBLE: destinationNoDataDouble = destinationNoData; break; default: throw new IllegalArgumentException("Wrong data type"); } } /** No Data flag is set to true and no data range is taken */ public void setNoDataRange(Range noData) { this.noData = noData; this.hasNoData = true; } /** No Data flag is set to false and no data range is set to null */ public void unsetNoData() { this.noData = null; this.hasNoData = false; } /** ROI flag is set to true and the ROI fields are all filled */ public void setROIparams(Rectangle roiBounds, RandomIter roiIter, PlanarImage srcROIImage, boolean useROIAccessor) { this.hasROI = true; this.roiBounds = roiBounds; this.roiIter = roiIter; this.useROIAccessor = useROIAccessor; this.srcROIImage = srcROIImage; } /** ROI flag is set to flag and the ROI fields are all left empty */ public void unsetROI() { this.hasROI = false; this.roiBounds = null; this.roiIter = null; this.srcROIImage = null; this.useROIAccessor = false; } /** Abstract method for calculating the destination tile from the source tile and an eventual ROI raster */ protected abstract void lookup(Raster source, WritableRaster dst, Rectangle rect, Raster roi); }
923427ab0b9d7ae85d4ea77d6d7c680564d8fc5f
2,748
java
Java
src/main/java/net/gobbob/mobends/animation/bit/biped/SprintAnimationBit.java
Tommsy64/MoBends
412d33e56ceab338792ffcd667c3c217b82536f1
[ "MIT" ]
null
null
null
src/main/java/net/gobbob/mobends/animation/bit/biped/SprintAnimationBit.java
Tommsy64/MoBends
412d33e56ceab338792ffcd667c3c217b82536f1
[ "MIT" ]
null
null
null
src/main/java/net/gobbob/mobends/animation/bit/biped/SprintAnimationBit.java
Tommsy64/MoBends
412d33e56ceab338792ffcd667c3c217b82536f1
[ "MIT" ]
null
null
null
42.276923
122
0.737627
996,835
package net.gobbob.mobends.animation.bit.biped; import net.gobbob.mobends.animation.bit.AnimationBit; import net.gobbob.mobends.client.event.DataUpdateHandler; import net.gobbob.mobends.data.BipedEntityData; import net.gobbob.mobends.data.EntityData; import net.gobbob.mobends.pack.BendsPack; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.math.MathHelper; public class SprintAnimationBit extends AnimationBit<BipedEntityData<?, ?>> { private static String[] ACTIONS = new String[] { "sprint" }; @Override public String[] getActions(BipedEntityData<?, ?> entityData) { return ACTIONS; } @Override public void perform(BipedEntityData<?, ?> data) { data.renderOffset.slideToZero(0.1F); data.renderRotation.setSmoothness(.3F).orientZero(); data.renderRightItemRotation.setSmoothness(.3F).orientZero(); data.renderLeftItemRotation.setSmoothness(.3F).orientZero(); final float PI = (float) Math.PI; float limbSwing = data.getLimbSwing() * 0.6662F * 0.8F; float armSwingAmount = data.getLimbSwingAmount() / PI * 180F * 1.1F; data.rightArm.rotation.setSmoothness(0.8F).orientX(MathHelper.cos(limbSwing + PI) * armSwingAmount) .rotateZ(5); data.leftArm.rotation.setSmoothness(0.8F).orientX(MathHelper.cos(limbSwing) * armSwingAmount) .rotateZ(-5); float legSwingAmount = 1.26F * data.getLimbSwingAmount() / PI * 180F; data.rightLeg.rotation.setSmoothness(1.0F).orientX(-5F + MathHelper.cos(limbSwing) * legSwingAmount) .rotateZ(2); data.leftLeg.rotation.setSmoothness(1.0F).orientX(-5F + MathHelper.cos(limbSwing + PI) * legSwingAmount) .rotateZ(-2); float foreLegSwingAmount = 0.7F * data.getLimbSwingAmount() / PI * 180F; float var = (limbSwing / PI) % 2; data.leftForeLeg.rotation.setSmoothness(.7F).orientX(40F + MathHelper.cos(limbSwing + 1.8F) * foreLegSwingAmount); data.rightForeLeg.rotation.setSmoothness(.7F).orientX(40F + MathHelper.cos(limbSwing + PI + 1.8F) * foreLegSwingAmount); data.leftForeArm.rotation.setSmoothness(.3F).orientX((var > 1 ? -10F : -45F)); data.rightForeArm.rotation.setSmoothness(.3F).orientX((var > 1 ? -45F : -10F)); float bodyRotationY = MathHelper.cos(limbSwing) * -40; float bodyRotationX = MathHelper.cos(limbSwing * 2F) * 10F + 10F; float var10 = data.getHeadYaw() * .3F; var10 = Math.max(-10, Math.min(var10, 10)); data.body.rotation.setSmoothness(.8F).orientY(bodyRotationY) .rotateX(bodyRotationX) .rotateZ(-var10); data.head.rotation.setSmoothness(.5F).orientX(MathHelper.wrapDegrees(data.getHeadPitch()) - bodyRotationX) .rotateY(MathHelper.wrapDegrees(data.getHeadYaw()) - bodyRotationY); data.renderOffset.slideY(MathHelper.cos(limbSwing * 2F + 0.6F) * 1.5f, .9f); } }
923427b39a4b9201bae867d54725ea848ea6dbf5
3,778
java
Java
plugin-shared/src/main/java/com/funnelback/publicui/search/model/transaction/facet/order/FacetComparatorProvider.java
FunnelbackPtyLtd/funnelback-shared
c723a4c69aaa99216aef9422c19827d8b7dfa9eb
[ "Apache-2.0" ]
null
null
null
plugin-shared/src/main/java/com/funnelback/publicui/search/model/transaction/facet/order/FacetComparatorProvider.java
FunnelbackPtyLtd/funnelback-shared
c723a4c69aaa99216aef9422c19827d8b7dfa9eb
[ "Apache-2.0" ]
19
2020-04-20T05:25:43.000Z
2022-01-05T06:11:21.000Z
plugin-shared/src/main/java/com/funnelback/publicui/search/model/transaction/facet/order/FacetComparatorProvider.java
FunnelbackPtyLtd/funnelback-shared
c723a4c69aaa99216aef9422c19827d8b7dfa9eb
[ "Apache-2.0" ]
null
null
null
41.516484
158
0.7054
996,836
package com.funnelback.publicui.search.model.transaction.facet.order; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import com.funnelback.common.facetednavigation.models.FacetValuesOrder; import com.funnelback.publicui.search.model.transaction.Facet; import com.funnelback.publicui.search.model.transaction.Facet.CategoryValue; import com.google.common.collect.ImmutableMap; import lombok.AllArgsConstructor; public class FacetComparatorProvider { private final Map<FacetValuesOrder, Comparator<Facet.CategoryValue>> FACET_ORDER_TO_COMPARATOR = ImmutableMap.<FacetValuesOrder, Comparator<Facet.CategoryValue>>builder() .put(FacetValuesOrder.COUNT_DESCENDING, FacetComparators.BY_COUNT_DESCENDING) .put(FacetValuesOrder.COUNT_ASCENDING, FacetComparators.BY_COUNT_ASCENDING) .put(FacetValuesOrder.SELECTED_FIRST, new BySelectedFirst()) .put(FacetValuesOrder.CATEGORY_DEFINITION_ORDER, new FacetConfigOrder()) .put(FacetValuesOrder.LABEL_ASCENDING, FacetComparators.BY_LABEL_ASCENDING) .put(FacetValuesOrder.LABEL_DESCENDING, FacetComparators.BY_LABEL_DESCENDING) .put(FacetValuesOrder.LABEL_AS_NUMBER_ASCENDING, FacetComparators.BY_LABEL_AS_NUMBER_ASCENDING) .put(FacetValuesOrder.LABEL_AS_NUMBER_DESCENDING, FacetComparators.BY_LABEL_AS_NUMBER_DESCENDING) .put(FacetValuesOrder.DATE_ASCENDING, new ByDateComparator(true)) .put(FacetValuesOrder.DATE_DESCENDING, new ByDateComparator(false)) .build(); Comparator<Facet.CategoryValue> getComparator(FacetValuesOrder orderToSortBy, Optional<Comparator<Facet.CategoryValue>> customComparator) { if(orderToSortBy == FacetValuesOrder.CUSTOM_COMPARATOR) { return customComparator.orElse(new AsIsComparator()); } return FACET_ORDER_TO_COMPARATOR.get(orderToSortBy); } /** * Creates a comparator by chaining the wanted comparators. * * @param ordersToSortBy The list describing the comparators wanted. * @return */ Comparator<Facet.CategoryValue> makeComparatorChain(List<FacetValuesOrder> ordersToSortBy, Optional<Comparator<Facet.CategoryValue>> customComparator) { if(ordersToSortBy == null || ordersToSortBy.isEmpty()) { return new AsIsComparator(); } List<Comparator<Facet.CategoryValue>> comparators = ordersToSortBy.stream().map(o -> getComparator(o, customComparator)).collect(Collectors.toList()); return new ChainComparator<>(comparators); } @AllArgsConstructor private static class ChainComparator<T> implements Comparator<T> { private List<Comparator<T>> comparatorList; @Override public int compare(T o1, T o2) { for(Comparator<T> comparator : comparatorList) { int res = comparator.compare(o1, o2); if(res != 0) return res; } return 0; } } /** * Gets the comparator to use when we are sorting on ALL category values. * * * @param ordersToSortBy * @return */ public Comparator<Facet.CategoryValue> getComparatorWhenSortingAllValues(List<FacetValuesOrder> ordersToSortBy, Optional<Comparator<Facet.CategoryValue>> customComparator) { return makeComparatorChain(ordersToSortBy, customComparator); } private static class AsIsComparator implements Comparator<Facet.CategoryValue> { @Override public int compare(CategoryValue o1, CategoryValue o2) { return 0; } } }
92342ac51b69ef1086649b45df500836254d52f7
634
java
Java
freeipa/src/test/java/com/sequenceiq/freeipa/entity/util/InstanceMetadataTypeConverterTest.java
drorke/cloudbreak
8a1d4749fe9d1d683f5bec3102e8b86f59928f67
[ "Apache-2.0" ]
174
2017-07-14T03:20:42.000Z
2022-03-25T05:03:18.000Z
freeipa/src/test/java/com/sequenceiq/freeipa/entity/util/InstanceMetadataTypeConverterTest.java
drorke/cloudbreak
8a1d4749fe9d1d683f5bec3102e8b86f59928f67
[ "Apache-2.0" ]
2,242
2017-07-12T05:52:01.000Z
2022-03-31T15:50:08.000Z
freeipa/src/test/java/com/sequenceiq/freeipa/entity/util/InstanceMetadataTypeConverterTest.java
drorke/cloudbreak
8a1d4749fe9d1d683f5bec3102e8b86f59928f67
[ "Apache-2.0" ]
172
2017-07-12T08:53:48.000Z
2022-03-24T12:16:33.000Z
33.368421
107
0.805994
996,837
package com.sequenceiq.freeipa.entity.util; import com.sequenceiq.cloudbreak.converter.DefaultEnumConverterBaseTest; import com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceMetadataType; import javax.persistence.AttributeConverter; public class InstanceMetadataTypeConverterTest extends DefaultEnumConverterBaseTest<InstanceMetadataType> { @Override public InstanceMetadataType getDefaultValue() { return InstanceMetadataType.GATEWAY; } @Override public AttributeConverter<InstanceMetadataType, String> getVictim() { return new InstanceMetadataTypeConverter(); } }
92342ad58a9cf5289445ed82844b02e2f17eaf05
1,522
java
Java
src/cn/optimize_2/client/ui/clickable/entities/ClickableRect.java
florr-recode/florr
e4047697ee91639d5388814ede959ea5b08a563f
[ "MIT" ]
2
2021-09-17T11:35:03.000Z
2021-09-17T12:05:35.000Z
src/cn/optimize_2/client/ui/clickable/entities/ClickableRect.java
florr-recode/florr
e4047697ee91639d5388814ede959ea5b08a563f
[ "MIT" ]
null
null
null
src/cn/optimize_2/client/ui/clickable/entities/ClickableRect.java
florr-recode/florr
e4047697ee91639d5388814ede959ea5b08a563f
[ "MIT" ]
1
2021-09-17T11:59:06.000Z
2021-09-17T11:59:06.000Z
22.382353
110
0.605782
996,838
package cn.optimize_2.client.ui.clickable.entities; import cn.optimize_2.client.ui.Rect; import cn.optimize_2.client.ui.clickable.ClickEntity; import cn.optimize_2.utils.graphic.Color; import cn.optimize_2.utils.graphic.Renderer; public class ClickableRect extends ClickEntity { private Rect rect; public ClickableRect(double x, double y, double x1, double y1, Color color, Runnable click, Runnable hold, Runnable focus, Runnable release, Runnable onBlur, Renderer renderer) { super(x, y, x1, y1, click, hold, focus, release, onBlur); this.rect = new Rect(x, y, x1, y1, color, renderer); } public void draw() { rect.draw(); super.tick(); } public double getX() { return rect.getX(); } public void setX(double x) { super.setX(x); rect.setX(x); } public double getY() { return rect.getY(); } public void setY(double y) { super.setY(y); rect.setY(y); } public double getWidth() { return rect.getWidth(); } public void setWidth(double width) { super.setX1(width); rect.setWidth(width); } public double getHeight() { return rect.getHeight(); } public void setHeight(double height) { super.setY1(height); rect.setHeight(height); } public Color getColor() { return rect.getColor(); } public void setColor(Color color) { rect.setColor(color); } }
92342b5e3fbbadbae7332ebc1dbe3735adedd5cd
22,633
java
Java
src/main/java/io/renren/modules/inspection/service/impl/InspectionTaskDeviceServiceImpl.java
zhu5369598zhu/sva
9133fc35a96d76c7539847d9054ad6fde0d1a08f
[ "Apache-2.0" ]
null
null
null
src/main/java/io/renren/modules/inspection/service/impl/InspectionTaskDeviceServiceImpl.java
zhu5369598zhu/sva
9133fc35a96d76c7539847d9054ad6fde0d1a08f
[ "Apache-2.0" ]
1
2021-04-22T17:10:06.000Z
2021-04-22T17:10:06.000Z
src/main/java/io/renren/modules/inspection/service/impl/InspectionTaskDeviceServiceImpl.java
zhu5369598zhu/sva
9133fc35a96d76c7539847d9054ad6fde0d1a08f
[ "Apache-2.0" ]
null
null
null
44.033074
158
0.624619
996,839
package io.renren.modules.inspection.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import io.renren.common.utils.PageUtils; import io.renren.common.utils.Query; import io.renren.modules.inspection.dao.InspectionTaskDeviceDao; import io.renren.modules.inspection.entity.ClassGroupEntity; import io.renren.modules.inspection.entity.InspectionTaskDeviceEntity; import io.renren.modules.inspection.entity.TurnClassGroupEntity; import io.renren.modules.inspection.service.ClassGroupService; import io.renren.modules.inspection.service.InspectionTaskDeviceService; import io.renren.modules.inspection.service.TurnClassGroupService; import io.renren.modules.sys.service.SysDeptService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; @Service("inspectionTaskDeviceService") public class InspectionTaskDeviceServiceImpl extends ServiceImpl<InspectionTaskDeviceDao, InspectionTaskDeviceEntity> implements InspectionTaskDeviceService { @Autowired SysDeptService deptService; @Autowired TurnClassGroupService turnClassGroupService; @Autowired ClassGroupService classGroupService; @Override public PageUtils queryPage(Map<String, Object> params) { Page<InspectionTaskDeviceEntity> page = this.selectPage( new Query<InspectionTaskDeviceEntity>(params).getPage(), new EntityWrapper<InspectionTaskDeviceEntity>() ); return new PageUtils(page); } @Override public Map<String, Object> selectByParams(Map<String, Object> params) { //String lineId = (String)((Number)params.get("line_id")).intValue(); String lineId = params.get("line_id").toString(); String turnId = params.get("turn_id").toString(); String turnStartTime = params.get("turn_start_time").toString(); String turnEndTime = params.get("turn_end_time").toString(); return this.baseMapper.selectByParams(lineId, turnId, turnStartTime, turnEndTime); } @Override public PageUtils getMissingByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } Page<Map<String, Object>> page = new Query<Map<String, Object>>(params).getPage(); List<Map<String, Object>> list = this.baseMapper.selectMissingDetailByDate( page, lineId, deptIds, inspectStartTime, inspectEndTime ); for(Map<String, Object> item:list){ List<String> classGroupList = new ArrayList<>(); Long turnId = (Long)item.get("turnId"); HashMap<String,Object> turnClassparams = new HashMap<>(); turnClassparams.put("turn_id",turnId); List<TurnClassGroupEntity> turnClassGroupEntities = turnClassGroupService.selectByMap(turnClassparams); for(TurnClassGroupEntity turnClassGroupEntity:turnClassGroupEntities){ ClassGroupEntity classGroupEntity = classGroupService.selectById(turnClassGroupEntity.getClassGroupId()); if(classGroupEntity != null){ classGroupList.add(classGroupEntity.getName()); } } item.put("workerList",org.apache.commons.lang.StringUtils.join(classGroupList.toArray(), '/')); } page.setRecords(list); return new PageUtils(page); } @Override public List<Map<String,Object>> getAllMissingByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } List<Map<String, Object>> list = this.baseMapper.selectMissingDetailByDate( lineId, deptIds, inspectStartTime, inspectEndTime ); for(Map<String, Object> item:list){ List<String> classGroupList = new ArrayList<>(); Long turnId = (Long)item.get("turnId"); HashMap<String,Object> turnClassparams = new HashMap<>(); turnClassparams.put("turn_id",turnId); List<TurnClassGroupEntity> turnClassGroupEntities = turnClassGroupService.selectByMap(turnClassparams); for(TurnClassGroupEntity turnClassGroupEntity:turnClassGroupEntities){ ClassGroupEntity classGroupEntity = classGroupService.selectById(turnClassGroupEntity.getClassGroupId()); if(classGroupEntity != null){ classGroupList.add(classGroupEntity.getName()); } } item.put("workerList",org.apache.commons.lang.StringUtils.join(classGroupList.toArray(), '/')); } return list; } @Override public Map<String,Object> getMissingStatisticsByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } List<Map<String, Object>> list = this.baseMapper.selectMissingStatisticsByDate( lineId, deptIds, inspectStartTime, inspectEndTime ); LinkedHashSet<String> legend = new LinkedHashSet(); LinkedHashSet<String> category = new LinkedHashSet(); LinkedList<Long> series = new LinkedList(); HashMap<String, Object> json = new HashMap<>(); Integer i = 0; for(Map<String, Object> item:list){ legend.add((String)item.get("deviceName")); category.add((String)item.get("deviceName")); series.add((Long) item.get("count")); } json.put("legend", legend); json.put("category", category); json.put("series", series); return json; } @Override public PageUtils getLineByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } Page<Map<String, Object>> page = new Query<Map<String, Object>>(params).getPage(); List<Map<String, Object>> list = this.baseMapper.selectMissingLineByDate( page, lineId, deptIds, inspectStartTime, inspectEndTime ); for(Map<String, Object> item:list){ List<String> classGroupList = new ArrayList<>(); Long turnId = (Long)item.get("turnId"); HashMap<String,Object> turnClassparams = new HashMap<>(); turnClassparams.put("turn_id",turnId); List<TurnClassGroupEntity> turnClassGroupEntities = turnClassGroupService.selectByMap(turnClassparams); for(TurnClassGroupEntity turnClassGroupEntity:turnClassGroupEntities){ ClassGroupEntity classGroupEntity = classGroupService.selectById(turnClassGroupEntity.getClassGroupId()); if(classGroupEntity != null){ classGroupList.add(classGroupEntity.getName()); } } item.put("workerList",org.apache.commons.lang.StringUtils.join(classGroupList.toArray(), '/')); } page.setRecords(list); return new PageUtils(page); } @Override public List<Map<String,Object>> getAllLineByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } List<Map<String, Object>> list = this.baseMapper.selectMissingLineByDate( lineId, deptIds, inspectStartTime, inspectEndTime ); for(Map<String, Object> item:list){ List<String> classGroupList = new ArrayList<>(); Long turnId = (Long)item.get("turnId"); HashMap<String,Object> turnClassparams = new HashMap<>(); turnClassparams.put("turn_id",turnId); List<TurnClassGroupEntity> turnClassGroupEntities = turnClassGroupService.selectByMap(turnClassparams); for(TurnClassGroupEntity turnClassGroupEntity:turnClassGroupEntities){ ClassGroupEntity classGroupEntity = classGroupService.selectById(turnClassGroupEntity.getClassGroupId()); if(classGroupEntity != null){ classGroupList.add(classGroupEntity.getName()); } } item.put("workerList",org.apache.commons.lang.StringUtils.join(classGroupList.toArray(), '/')); } return list; } @Override public Map<String,Object> getLineStatisticsByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } List<Map<String, Object>> list = this.baseMapper.selectMissingLineByDate( lineId, deptIds, inspectStartTime, inspectEndTime ); LinkedHashSet<String> legend = new LinkedHashSet(); LinkedHashSet<String> category = new LinkedHashSet(); LinkedList series = new LinkedList(); HashMap<String, Object> inspectedHash = new HashMap(); HashMap<String, Object> missInspectHash = new HashMap(); HashMap<String, Object> json = new HashMap<>(); Long inspected = 0L; Long missInspect = 0L; for(Map<String, Object> item:list){ inspected += Long.parseLong(item.get("inspectedItemCount").toString()); missInspect += Long.parseLong(item.get("inspectMissItemCount").toString()); } legend.add("已检"); legend.add("漏检"); inspectedHash.put("name","已检"); inspectedHash.put("value",inspected); missInspectHash.put("name","漏检"); missInspectHash.put("value",missInspect); if(list.size() > 0){ series.add(missInspectHash); series.add(inspectedHash); } json.put("legend", legend); json.put("series", series); return json; } @Override public PageUtils getTurnByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } Page<Map<String, Object>> page = new Query<Map<String, Object>>(params).getPage(); List<Map<String, Object>> list = this.baseMapper.selectMissingTurnByDate( page, lineId, deptIds, inspectStartTime, inspectEndTime ); for(Map<String, Object> item:list){ List<String> classGroupList = new ArrayList<>(); Long turnId = (Long)item.get("turnId"); HashMap<String,Object> turnClassparams = new HashMap<>(); turnClassparams.put("turn_id",turnId); List<TurnClassGroupEntity> turnClassGroupEntities = turnClassGroupService.selectByMap(turnClassparams); for(TurnClassGroupEntity turnClassGroupEntity:turnClassGroupEntities){ ClassGroupEntity classGroupEntity = classGroupService.selectById(turnClassGroupEntity.getClassGroupId()); if(classGroupEntity != null){ classGroupList.add(classGroupEntity.getName()); } } item.put("workerList",org.apache.commons.lang.StringUtils.join(classGroupList.toArray(), '/')); } page.setRecords(list); return new PageUtils(page); } @Override public List<Map<String,Object>> getAllTurnByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } List<Map<String, Object>> list = this.baseMapper.selectMissingTurnByDate( lineId, deptIds, inspectStartTime, inspectEndTime ); for(Map<String, Object> item:list){ List<String> classGroupList = new ArrayList<>(); Long turnId = (Long)item.get("turnId"); HashMap<String,Object> turnClassparams = new HashMap<>(); turnClassparams.put("turn_id",turnId); List<TurnClassGroupEntity> turnClassGroupEntities = turnClassGroupService.selectByMap(turnClassparams); for(TurnClassGroupEntity turnClassGroupEntity:turnClassGroupEntities){ ClassGroupEntity classGroupEntity = classGroupService.selectById(turnClassGroupEntity.getClassGroupId()); if(classGroupEntity != null){ classGroupList.add(classGroupEntity.getName()); } } item.put("workerList",org.apache.commons.lang.StringUtils.join(classGroupList.toArray(), '/')); } return list; } @Override public Map<String,Object> getTurnStatisticsByDate(Map<String, Object> params){ List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); if(inspectStartTime.equals(inspectEndTime)){ inspectStartTime = inspectStartTime + " 00:00:00"; inspectEndTime = inspectEndTime + " 59:59:59"; } if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } List<Map<String, Object>> list = this.baseMapper.selectMissingTurnByDate( lineId, deptIds, inspectStartTime, inspectEndTime ); LinkedHashSet<String> legend = new LinkedHashSet(); LinkedHashSet<String> category = new LinkedHashSet(); HashMap<String, Object> series = new HashMap(); LinkedList<Long> inspectedList = new LinkedList<>(); LinkedList<Long> InspectList = new LinkedList(); LinkedList<Long> InspectMissList = new LinkedList(); HashMap<String, Object> json = new HashMap<>(); Integer i = 0; for(Map<String, Object> item:list){ category.add((String)item.get("turnName")); inspectedList.add(Long.parseLong(item.get("inspectedItemCount").toString())); InspectList.add(Long.parseLong(item.get("inspectItemCount").toString())); InspectMissList.add(Long.parseLong(item.get("inspectMissItemCount").toString())); } legend.add("已检"); legend.add("漏检"); legend.add("应检"); series.put("已检",inspectedList); series.put("漏检",InspectMissList); series.put("应检",InspectList); json.put("legend", legend); json.put("category", category); json.put("series", series); return json; } @Override public PageUtils getDeviceDate(Map<String, Object> params) { List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); inspectEndTime = inspectEndTime + " 23:59:59"; if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } Page<Map<String, Object>> page = new Query<Map<String, Object>>(params).getPage(); List<Map<String, Object>> list = this.baseMapper.getDeviceByTime( page, lineId, deptIds, inspectStartTime, inspectEndTime ); for(Map<String, Object> item:list){ List<String> classGroupList = new ArrayList<>(); Long turnId = (Long)item.get("turnId"); HashMap<String,Object> turnClassparams = new HashMap<>(); turnClassparams.put("turn_id",turnId); List<TurnClassGroupEntity> turnClassGroupEntities = turnClassGroupService.selectByMap(turnClassparams); for(TurnClassGroupEntity turnClassGroupEntity:turnClassGroupEntities){ ClassGroupEntity classGroupEntity = classGroupService.selectById(turnClassGroupEntity.getClassGroupId()); if(classGroupEntity != null){ classGroupList.add(classGroupEntity.getName()); } } item.put("workerList",org.apache.commons.lang.StringUtils.join(classGroupList.toArray(), '/')); } page.setRecords(list); return new PageUtils(page); } @Override public List<Map<String, Object>> getAllDeviceDate(Map<String, Object> params) { List<Integer> deptIds = null; String deptId = (String)params.get("deptId"); String lineId = (String)params.get("lineId"); String inspectStartTime = (String)params.get("startTime"); String inspectEndTime = (String)params.get("endTime"); inspectEndTime = inspectEndTime + " 23:59:59"; if(deptId != null && !deptId.equals("")){ deptIds = deptService.queryRecursiveChildByParentId(Long.parseLong(deptId)); } Page<Map<String, Object>> page = new Query<Map<String, Object>>(params).getPage(); List<Map<String, Object>> list = this.baseMapper.getAllDeviceByTime( lineId, deptIds, inspectStartTime, inspectEndTime ); for(Map<String, Object> item:list){ List<String> classGroupList = new ArrayList<>(); Long turnId = (Long)item.get("turnId"); HashMap<String,Object> turnClassparams = new HashMap<>(); turnClassparams.put("turn_id",turnId); List<TurnClassGroupEntity> turnClassGroupEntities = turnClassGroupService.selectByMap(turnClassparams); for(TurnClassGroupEntity turnClassGroupEntity:turnClassGroupEntities){ ClassGroupEntity classGroupEntity = classGroupService.selectById(turnClassGroupEntity.getClassGroupId()); if(classGroupEntity != null){ classGroupList.add(classGroupEntity.getName()); } } item.put("workerList",org.apache.commons.lang.StringUtils.join(classGroupList.toArray(), '/')); } return list; } }
92342c8fef56f03501f871c1173875ae94f07a3b
833
java
Java
src/trabalhofinal/modelos/Constantes.java
DayaToledo/TrabalhoFinal-POO
8f5b38588da164c97e8bb0de9d76124235ef0dbe
[ "MIT" ]
null
null
null
src/trabalhofinal/modelos/Constantes.java
DayaToledo/TrabalhoFinal-POO
8f5b38588da164c97e8bb0de9d76124235ef0dbe
[ "MIT" ]
null
null
null
src/trabalhofinal/modelos/Constantes.java
DayaToledo/TrabalhoFinal-POO
8f5b38588da164c97e8bb0de9d76124235ef0dbe
[ "MIT" ]
null
null
null
29.75
91
0.709484
996,840
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package trabalhofinal.modelos; import java.text.NumberFormat; import java.util.Locale; /** * * @author dayan */ public class Constantes { public static final double T1 = 0.10; public static final double T2 = 0.20; public static final double D1 = 0.05; public static final double D2 = 0.10; public static final double D3 = 0.20; public static final double S1 = 0.05; public static final double S2 = 0.10; public static final double EFETIVO = 0.05; public static final Locale localeBR = new Locale("pt","BR"); public static final NumberFormat dinheiro = NumberFormat.getCurrencyInstance(localeBR); }
92342ce9db6e168a5dc6e748fc8140e4d56dd120
344
java
Java
src/main/java/com/unrealdinnerbone/yastm/client/gui/GUIColorSlider.java
UnRealDinnerbone/ModJam5
254148675fb3d43e1eb32fb44f7466dc81359c66
[ "MIT" ]
2
2019-01-17T12:17:08.000Z
2019-03-23T03:21:49.000Z
src/main/java/com/unrealdinnerbone/yastm/client/gui/GUIColorSlider.java
UnRealDinnerbone/ModJam5
254148675fb3d43e1eb32fb44f7466dc81359c66
[ "MIT" ]
1
2019-01-05T18:12:35.000Z
2019-01-06T12:04:34.000Z
src/main/java/com/unrealdinnerbone/yastm/client/gui/GUIColorSlider.java
UnRealDinnerbone/ModJam5
254148675fb3d43e1eb32fb44f7466dc81359c66
[ "MIT" ]
1
2019-01-05T18:03:46.000Z
2019-01-05T18:03:46.000Z
26.461538
91
0.718023
996,841
package com.unrealdinnerbone.yastm.client.gui; import net.minecraftforge.fml.client.config.GuiSlider; public class GUIColorSlider extends GuiSlider { public GUIColorSlider(int id, int xPos, int yPos, double currentVal, ISlider iSlider) { super(id, xPos, yPos, 255, 20, "", "", 0, 255, currentVal, false, true, iSlider); } }
92342ee897a373f5f3f6b87edf9194b55b97d19d
5,728
java
Java
unifiednlp-base/src/main/java/org/microg/nlp/location/BackendFuser.java
Tomy0498/android_packages_apps_UnifiedNlp
82479b79c76353f532e0c6edd0d1dee8d49c48f4
[ "Apache-2.0" ]
2
2020-07-15T05:49:50.000Z
2020-07-22T21:15:26.000Z
unifiednlp-base/src/main/java/org/microg/nlp/location/BackendFuser.java
olbinn/android_packages_apps_UnifiedNlp
82479b79c76353f532e0c6edd0d1dee8d49c48f4
[ "Apache-2.0" ]
1
2021-01-21T12:24:53.000Z
2021-01-21T12:24:53.000Z
unifiednlp-base/src/main/java/org/microg/nlp/location/BackendFuser.java
olbinn/android_packages_apps_UnifiedNlp
82479b79c76353f532e0c6edd0d1dee8d49c48f4
[ "Apache-2.0" ]
2
2019-02-13T13:09:58.000Z
2020-05-09T17:44:37.000Z
32.91954
114
0.601606
996,842
/* * Copyright (C) 2013-2017 microG Project Team * * 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.microg.nlp.location; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationManager; import android.util.Log; import org.microg.nlp.Preferences; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import static org.microg.nlp.api.Constants.ACTION_LOCATION_BACKEND; import static org.microg.nlp.api.Constants.LOCATION_EXTRA_OTHER_BACKENDS; class BackendFuser { private static final String TAG = "NlpLocationBackendFuser"; private final List<BackendHelper> backendHelpers = new ArrayList<BackendHelper>(); private final LocationProvider locationProvider; private final Context context; private boolean fusing = false; private long lastLocationReportTime = 0; public BackendFuser(Context context, LocationProvider locationProvider) { this.locationProvider = locationProvider; this.context = context; reset(); } public void reset() { unbind(); backendHelpers.clear(); lastLocationReportTime = 0; for (String backend : Preferences .splitBackendString(new Preferences(context).getLocationBackends())) { String[] parts = backend.split("/"); if (parts.length >= 2) { Intent intent = new Intent(ACTION_LOCATION_BACKEND); intent.setPackage(parts[0]); intent.setClassName(parts[0], parts[1]); backendHelpers.add(new BackendHelper(context, this, intent, parts.length >= 3 ? parts[2] : null)); } } } public void unbind() { for (BackendHelper handler : backendHelpers) { handler.unbind(); } } public void bind() { fusing = false; for (BackendHelper handler : backendHelpers) { handler.bind(); } } public void update() { boolean hasUpdates = false; fusing = true; for (BackendHelper handler : backendHelpers) { if (handler.update() != null) hasUpdates = true; } fusing = false; if (hasUpdates) updateLocation(); } void updateLocation() { List<Location> locations = new ArrayList<Location>(); for (BackendHelper handler : backendHelpers) { locations.add(handler.getLastLocation()); } Location location = mergeLocations(locations); if (location != null) { location.setProvider(LocationManager.NETWORK_PROVIDER); if (lastLocationReportTime < location.getTime()) { lastLocationReportTime = location.getTime(); locationProvider.reportLocation(location); Log.v(TAG, "location=" + location); } else { Log.v(TAG, "Ignoring location update as it's older than other provider."); } } } private Location mergeLocations(List<Location> locations) { Collections.sort(locations, LocationComparator.INSTANCE); if (locations.isEmpty() || locations.get(0) == null) return null; if (locations.size() == 1) return locations.get(0); Location location = new Location(locations.get(0)); ArrayList<Location> backendResults = new ArrayList<Location>(); for (Location backendResult : locations) { if (locations.get(0) == backendResult) continue; if (backendResult != null) backendResults.add(backendResult); } if (!backendResults.isEmpty()) { location.getExtras().putParcelableArrayList(LOCATION_EXTRA_OTHER_BACKENDS, backendResults); } return location; } public void reportLocation() { if (fusing) return; updateLocation(); } public void destroy() { unbind(); backendHelpers.clear(); } public static class LocationComparator implements Comparator<Location> { public static final LocationComparator INSTANCE = new LocationComparator(); public static final long SWITCH_ON_FRESHNESS_CLIFF_MS = 30000; // 30 seconds /** * @return whether {@param lhs} is better than {@param rhs} */ @Override public int compare(Location lhs, Location rhs) { if (lhs == rhs) return 0; if (lhs == null) { return 1; } if (rhs == null) { return -1; } if (!lhs.hasAccuracy()) { return 1; } if (!rhs.hasAccuracy()) { return -1; } if (rhs.getTime() > lhs.getTime() + SWITCH_ON_FRESHNESS_CLIFF_MS) { return 1; } if (lhs.getTime() > rhs.getTime() + SWITCH_ON_FRESHNESS_CLIFF_MS) { return -1; } return (int) (lhs.getAccuracy() - rhs.getAccuracy()); } } }
92342f0d4970f9f3cc6cee63e3d1f7a7aea7774b
2,623
java
Java
bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/Matchers.java
EyelynSu/pinpoint
3f9b3302940353d504a80940a9484b4c0e36a563
[ "Apache-2.0" ]
1,473
2020-10-14T02:18:07.000Z
2022-03-31T11:43:49.000Z
bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/Matchers.java
EyelynSu/pinpoint
3f9b3302940353d504a80940a9484b4c0e36a563
[ "Apache-2.0" ]
995
2020-10-14T05:09:43.000Z
2022-03-31T12:04:05.000Z
bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/instrument/matcher/Matchers.java
EyelynSu/pinpoint
3f9b3302940353d504a80940a9484b4c0e36a563
[ "Apache-2.0" ]
446
2020-10-14T02:42:50.000Z
2022-03-31T03:03:53.000Z
35.931507
109
0.767442
996,843
/* * Copyright 2014 NAVER Corp. * * 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.navercorp.pinpoint.bootstrap.instrument.matcher; import com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand; import com.navercorp.pinpoint.common.annotations.InterfaceStability; import java.util.List; /** * Matcher Utils * * @author emeroad */ @InterfaceStability.Unstable public final class Matchers { private Matchers() { } public static Matcher newClassNameMatcher(String classInternalName) { return new DefaultClassNameMatcher(classInternalName); } public static Matcher newMultiClassNameMatcher(List<String> classNameList) { return new DefaultMultiClassNameMatcher(classNameList); } public static Matcher newPackageBasedMatcher(String basePackageName) { return new DefaultPackageBasedMatcher(basePackageName); } public static Matcher newPackageBasedMatcher(String basePackageName, MatcherOperand additional) { return new DefaultPackageBasedMatcher(basePackageName, additional); } public static Matcher newPackageBasedMatcher(List<String> basePackageNames) { return new DefaultMultiPackageBasedMatcher(basePackageNames); } public static Matcher newPackageBasedMatcher(List<String> basePackageNames, MatcherOperand additional) { return new DefaultMultiPackageBasedMatcher(basePackageNames, additional); } public static Matcher newClassBasedMatcher(String baseClassName) { return new DefaultClassBasedMatcher(baseClassName); } public static Matcher newClassBasedMatcher(String baseClassName, MatcherOperand additional) { return new DefaultClassBasedMatcher(baseClassName, additional); } public static Matcher newMultiClassBasedMatcher(List<String> baseClassNames) { return new DefaultMultiClassBasedMatcher(baseClassNames); } public static Matcher newMultiClassBasedMatcher(List<String> baseClassNames, MatcherOperand additional) { return new DefaultMultiClassBasedMatcher(baseClassNames, additional); } }
92342f7a91f50253fd7c6059037e24020a8a67e6
1,001
java
Java
src/main/java/com/kyleposluns/ai/util/Location.java
ProRival/Physics-AI
5f63162bec549ba5d7f8ab0d5afd30b6a4741282
[ "MIT" ]
null
null
null
src/main/java/com/kyleposluns/ai/util/Location.java
ProRival/Physics-AI
5f63162bec549ba5d7f8ab0d5afd30b6a4741282
[ "MIT" ]
null
null
null
src/main/java/com/kyleposluns/ai/util/Location.java
ProRival/Physics-AI
5f63162bec549ba5d7f8ab0d5afd30b6a4741282
[ "MIT" ]
null
null
null
19.627451
90
0.638362
996,844
package com.kyleposluns.ai.util; public class Location { public static final int MANHATTAN = 0; public static final int EUCLIDEAN = 1; public final int x, y; public Location(int x, int y) { this.x = x; this.y = y; } public Location() { this(0, 0); } public double distance(Location location, int type) { switch (type) { case MANHATTAN: return Math.abs(location.x - this.x) + Math.abs(location.y - this.y); case EUCLIDEAN: return Math.sqrt(Math.pow(location.x - this.x, 2) + Math.pow(location.y - this.y, 2)); } return 0.0; } public double distance(Location location) { return distance(location, MANHATTAN); } @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Location)) return false; if (!(o.getClass().equals(this.getClass()))) return false; Location loc = (Location) o; return loc.x == this.x && loc.y == this.y; } @Override public String toString() { return "(" + x + "," + y + ")"; } }
9234301f5f4143585f82aff26afe207dabb86a58
1,638
java
Java
src/main/java/org/phenoscape/model/Association.java
phenoscape/Phenex
d2c781a775b73a99afd477becb45857036464202
[ "MIT" ]
5
2017-12-07T23:24:32.000Z
2021-02-02T08:05:05.000Z
src/main/java/org/phenoscape/model/Association.java
phenoscape/Phenex
d2c781a775b73a99afd477becb45857036464202
[ "MIT" ]
21
2015-10-01T01:56:02.000Z
2022-03-30T22:45:02.000Z
src/main/java/org/phenoscape/model/Association.java
phenoscape/Phenex
d2c781a775b73a99afd477becb45857036464202
[ "MIT" ]
2
2016-04-04T13:47:40.000Z
2021-02-02T08:05:07.000Z
23.4
107
0.664225
996,845
package org.phenoscape.model; public class Association { private final String taxonID; private final String characterID; private final String stateID; public Association(final String taxonID, final String characterID, final String stateID) { this.taxonID = taxonID; this.characterID = characterID; this.stateID = stateID; } public String getTaxonID() { return taxonID; } public String getCharacterID() { return characterID; } public String getStateID() { return stateID; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((characterID == null) ? 0 : characterID.hashCode()); result = prime * result + ((stateID == null) ? 0 : stateID.hashCode()); result = prime * result + ((taxonID == null) ? 0 : taxonID.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Association other = (Association) obj; if (characterID == null) { if (other.characterID != null) return false; } else if (!characterID.equals(other.characterID)) return false; if (stateID == null) { if (other.stateID != null) return false; } else if (!stateID.equals(other.stateID)) return false; if (taxonID == null) { if (other.taxonID != null) return false; } else if (!taxonID.equals(other.taxonID)) return false; return true; } @Override public String toString() { return "Association [taxonID=" + taxonID + ", characterID=" + characterID + ", stateID=" + stateID + "]"; } }
923431d09484fe4333dba1802de5a3f436a46806
2,102
java
Java
service/service_oss/src/main/java/com/yntx/service/oss/util/controller/FileController.java
yntx-github/edu_online
0ec1ae8f0683de2c149e7bbd65c93c8a8787d372
[ "MIT" ]
null
null
null
service/service_oss/src/main/java/com/yntx/service/oss/util/controller/FileController.java
yntx-github/edu_online
0ec1ae8f0683de2c149e7bbd65c93c8a8787d372
[ "MIT" ]
null
null
null
service/service_oss/src/main/java/com/yntx/service/oss/util/controller/FileController.java
yntx-github/edu_online
0ec1ae8f0683de2c149e7bbd65c93c8a8787d372
[ "MIT" ]
null
null
null
29.605634
89
0.668887
996,846
package com.yntx.service.oss.util.controller; import com.yntx.common.base.result.R; import com.yntx.common.base.result.ResultCodeEnum; import com.yntx.common.base.util.ExceptionUtils; import com.yntx.handler.CustomException; import com.yntx.service.oss.util.service.FileService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; @Api(description="阿里云文件管理") @CrossOrigin //跨域 @RestController @RequestMapping("/admin/oss/file") @Slf4j public class FileController { @Autowired private FileService fileService; @ApiOperation(value = "测试") @GetMapping("test") public R test() { log.info("oss test被调用"); return R.ok(); } /** * 文件上传 * @param file */ @ApiOperation("文件上传") @PostMapping("upload") public R upload( @ApiParam(value = "文件", required = true) @RequestParam("file") MultipartFile file, @ApiParam(value = "模块", required = true) @RequestParam("module") String module) throws IOException { try { InputStream inputStream = file.getInputStream(); String originalFilename = file.getOriginalFilename(); String uploadUrl = fileService.upload(inputStream, module, originalFilename); //返回r对象 return R.ok().message("文件上传成功").data("url", uploadUrl); }catch (Exception e) { log.error(ExceptionUtils.getMessage(e)); throw new CustomException(ResultCodeEnum.FILE_UPLOAD_ERROR); } } @ApiOperation("文件删除") @DeleteMapping("remove") public R removeFile( @ApiParam(value = "要删除的文件路径", required = true) @RequestBody String url) { fileService.removeFile(url); return R.ok().message("文件刪除成功"); } }
9234320f201066bc642ea684c12b43d8f9ecfb2d
2,040
java
Java
houseServer/src/main/java/com/hpy/distributed/House/dao/HouseStatusMapper.java
beichenhpy/rent-backend
58408eadd282f083f490632387dc5ea247db2b14
[ "MIT" ]
null
null
null
houseServer/src/main/java/com/hpy/distributed/House/dao/HouseStatusMapper.java
beichenhpy/rent-backend
58408eadd282f083f490632387dc5ea247db2b14
[ "MIT" ]
null
null
null
houseServer/src/main/java/com/hpy/distributed/House/dao/HouseStatusMapper.java
beichenhpy/rent-backend
58408eadd282f083f490632387dc5ea247db2b14
[ "MIT" ]
1
2022-03-14T05:19:32.000Z
2022-03-14T05:19:32.000Z
24
114
0.594118
996,847
package com.hpy.distributed.House.dao; import org.apache.ibatis.annotations.Update; import org.springframework.stereotype.Repository; /** * @author: beichenhpy * @Date: 2020/5/4 21:49 */ @Repository public interface HouseStatusMapper { /** admin * 更新check为1 变成已经核验 * 用于admin核验房屋信息 * @param hid hid * @return 返回影响行数 */ @Update("update house set isCheck = 1 where hid = #{hid} and isCheck = 0") Integer updateCheck(String hid); /** admin * 更新check为2 变成审核未通过 * 用于admin核验房屋信息 * @param hid hid * @return 返回影响行数 */ @Update("update house set isCheck = 2 where hid = #{hid} and isCheck = 0") Integer updateCheckToUnSuccess(String hid); /* * 更新check为0 变成未核验 * 用于admin核验房屋信息 * @param hid hid * @return 返回影响行数 */ @Update("update house set isCheck = 0 where hid = #{hid}") void updateCheckToUnCheck(String hid); /** * rented * 更改房屋的是否出租的信息为 1 代表已出租 不可使用 * isCheck是是否通过核验 * 乐观锁 * @param hid hid * @return 返回影响行数 */ @Update("update house set isRented = 1 where hid = #{hid} and isRented = 0 and isCheck = 1 and isOnRent = 1") Integer updateUnRentedToRented(String hid); /** * 更改房屋的是否出租的信息为 0 代表未出租 可以使用 * isCheck是是否通过核验 * 乐观锁 * @param hid hid * @return 返回影响行数 */ @Update("update house set isRented = 0 where hid = #{hid} and isRented = 1 and isCheck = 1 and isOnRent = 1") Integer updateRentedToUnRented(String hid); /** * 更新房屋的状态为已经发布到出租信息 1 当这个房子已经通过核验并且还未出租 * @param hid hid * @return 影响行数 */ @Update("update house set isOnRent = 1 where hid = #{hid}") Integer updateUnOnRentToOnRent(String hid); /** * 更新房屋的状态为未发布到出租信息 0 当这个房子已经通过核验,出不出租都可以 * @param hid hid * @return 影响行数 */ @Update("update house set isOnRent = 0 where hid = #{hid}") Integer updateOnRentToUnOnRent(String hid); }
9234322729e53335d1c7f02be4ddda1704db6616
1,133
java
Java
src/test/java/uk/gov/hmcts/reform/iahomeofficeintegrationapi/domain/entities/HomeOfficeInstructResponseTest.java
uk-gov-mirror/hmcts.ia-home-office-integration-api
8cdce0dbed21456e20ca707454525dca3a858da3
[ "MIT" ]
null
null
null
src/test/java/uk/gov/hmcts/reform/iahomeofficeintegrationapi/domain/entities/HomeOfficeInstructResponseTest.java
uk-gov-mirror/hmcts.ia-home-office-integration-api
8cdce0dbed21456e20ca707454525dca3a858da3
[ "MIT" ]
228
2020-03-26T10:15:45.000Z
2021-09-15T10:51:14.000Z
src/test/java/uk/gov/hmcts/reform/iahomeofficeintegrationapi/domain/entities/HomeOfficeInstructResponseTest.java
hmcts/ia-home-office-integration-api-old
d0517a488a98c37693bdda5729fe2d5e60ce7b06
[ "MIT" ]
1
2021-04-10T22:36:28.000Z
2021-04-10T22:36:28.000Z
31.472222
73
0.766108
996,848
package uk.gov.hmcts.reform.iahomeofficeintegrationapi.domain.entities; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) @SuppressWarnings("unchecked") public class HomeOfficeInstructResponseTest { @Mock MessageHeader messageHeader; @Mock private HomeOfficeError errorDetail; private HomeOfficeInstructResponse instructResponse; @BeforeEach void setUp() { instructResponse = new HomeOfficeInstructResponse( messageHeader, errorDetail ); } @Test public void has_correct_values_after_setting() { assertNotNull(instructResponse); assertNotNull(instructResponse.getMessageHeader()); assertEquals(messageHeader, instructResponse.getMessageHeader()); assertEquals(errorDetail, instructResponse.getErrorDetail()); } }
92343228b36495a044b328b951d40105f402eece
2,045
java
Java
SillyChildTrave/app/src/main/java/com/yinglan/sct/homepage/airporttransportation/comments/CharterCommentsPresenter.java
921668753/SillyChildTravel-Android
eb2574bf1bb5934b3efbc7cb87f0a8ec3bbfa03f
[ "Apache-2.0" ]
null
null
null
SillyChildTrave/app/src/main/java/com/yinglan/sct/homepage/airporttransportation/comments/CharterCommentsPresenter.java
921668753/SillyChildTravel-Android
eb2574bf1bb5934b3efbc7cb87f0a8ec3bbfa03f
[ "Apache-2.0" ]
null
null
null
SillyChildTrave/app/src/main/java/com/yinglan/sct/homepage/airporttransportation/comments/CharterCommentsPresenter.java
921668753/SillyChildTravel-Android
eb2574bf1bb5934b3efbc7cb87f0a8ec3bbfa03f
[ "Apache-2.0" ]
null
null
null
32.983871
125
0.656724
996,849
package com.yinglan.sct.homepage.airporttransportation.comments; import android.content.Context; import com.common.cklibrary.common.KJActivityStack; import com.common.cklibrary.utils.httputil.HttpUtilParams; import com.common.cklibrary.utils.httputil.ResponseListener; import com.kymjs.rxvolley.client.HttpParams; import com.yinglan.sct.retrofit.RequestClient; /** * Created by ruitu on 2016/9/24. */ public class CharterCommentsPresenter implements CharterCommentsContract.Presenter { private CharterCommentsContract.View mView; public CharterCommentsPresenter(CharterCommentsContract.View view) { mView = view; mView.setPresenter(this); } @Override public void getCommentList(Context context, int product_id, int onlyimage, int page) { HttpParams httpParams = HttpUtilParams.getInstance().getHttpParams(); httpParams.put("product_id", product_id); httpParams.put("onlyimage", onlyimage); httpParams.put("page", page); httpParams.put("pagesize", 10); RequestClient.getEvaluationPage(context, httpParams, new ResponseListener<String>() { @Override public void onSuccess(String response) { mView.getSuccess(response, 0); } @Override public void onFailure(String msg) { mView.errorMsg(msg, 0); } }); } @Override public void postAddCommentLike(int id, int type) { HttpParams httpParams = HttpUtilParams.getInstance().getHttpParams(); httpParams.put("comment_id", id); httpParams.put("type", type); RequestClient.postAddCommentLike(KJActivityStack.create().topActivity(), httpParams, new ResponseListener<String>() { @Override public void onSuccess(String response) { mView.getSuccess(response, 1); } @Override public void onFailure(String msg) { mView.errorMsg(msg, 1); } }); } }
92343280cc611caab54a275d6f5cd2395cdfc6a6
1,546
java
Java
server/upgrade/data-migration-0.9.0-0.10.0/src/main/java/org/kaaproject/kaa/server/datamigration/utils/BaseSchemaIdCounter.java
MiddlewareICS/kaa
65c02e847d6019e4afb20fbfb03c3416e0972908
[ "ECL-2.0", "Apache-2.0" ]
2
2019-08-27T10:45:57.000Z
2019-08-30T06:21:04.000Z
server/upgrade/data-migration-0.9.0-0.10.0/src/main/java/org/kaaproject/kaa/server/datamigration/utils/BaseSchemaIdCounter.java
MiddlewareICS/kaa
65c02e847d6019e4afb20fbfb03c3416e0972908
[ "ECL-2.0", "Apache-2.0" ]
8
2020-01-31T18:26:22.000Z
2022-01-21T23:34:19.000Z
server/upgrade/data-migration-0.9.0-0.10.0/src/main/java/org/kaaproject/kaa/server/datamigration/utils/BaseSchemaIdCounter.java
MiddlewareICS/kaa
65c02e847d6019e4afb20fbfb03c3416e0972908
[ "ECL-2.0", "Apache-2.0" ]
1
2019-11-24T07:01:26.000Z
2019-11-24T07:01:26.000Z
23.424242
75
0.68564
996,850
/* * Copyright 2014-2016 CyberVision, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kaaproject.kaa.server.datamigration.utils; public class BaseSchemaIdCounter { private static BaseSchemaIdCounter instance; private static boolean isInitMethodCalled; private Long value; private BaseSchemaIdCounter() { } /** * Sets init value for counter, can be called only once. * * @param value the initial value */ public static void setInitValue(Long value) { getInstance(); if (isInitMethodCalled) { return; } isInitMethodCalled = true; instance.value = value; } /** * Gets uniq instance. */ public static BaseSchemaIdCounter getInstance() { if (instance == null) { instance = new BaseSchemaIdCounter(); } return instance; } /** * Return old value and add to one shift. * * @param shift the shift */ public Long getAndShift(Long shift) { Long oldValue = value; value += shift; return oldValue; } }
9234329fd8089d4c0c882c6f93021515f07cfe49
1,157
java
Java
01-StatePattern/src/main/java/com/coderwjq/statepattern/state/LogoutState.java
coderwjq/design-pattern-coderwjq
2b4ede258cb10d21af77b42c49aeb035c099edae
[ "Apache-2.0" ]
null
null
null
01-StatePattern/src/main/java/com/coderwjq/statepattern/state/LogoutState.java
coderwjq/design-pattern-coderwjq
2b4ede258cb10d21af77b42c49aeb035c099edae
[ "Apache-2.0" ]
null
null
null
01-StatePattern/src/main/java/com/coderwjq/statepattern/state/LogoutState.java
coderwjq/design-pattern-coderwjq
2b4ede258cb10d21af77b42c49aeb035c099edae
[ "Apache-2.0" ]
null
null
null
23.612245
72
0.694901
996,851
package com.coderwjq.statepattern.state; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.widget.Toast; import com.coderwjq.statepattern.LoginActivity; import com.coderwjq.statepattern.LoginContext; /** * @Created by coderwjq on 2017/6/3 17:20. * @Desc 未登录状态 */ public class LogoutState implements IUserState { @Override public void forward(Context context) { gotoLoginActivity(context); } @Override public void comment(Context context) { gotoLoginActivity(context); } @Override public void logout(Context context) { Toast.makeText(context, "当前未登录", Toast.LENGTH_SHORT).show(); } @Override public void login(Context context) { LoginContext.getLoginContext().setUserState(new LoginedState()); Toast.makeText(context, "登陆成功", Toast.LENGTH_SHORT).show(); Activity activity = (Activity) context; activity.finish(); } private void gotoLoginActivity(Context context) { Intent intent = new Intent(context, LoginActivity.class); context.startActivity(intent); } }
923432c47a6f05770ff8d1e7cd6846d49bef0625
5,775
java
Java
jraft-core/src/test/java/com/alipay/sofa/jraft/util/concurrent/MpscSingleThreadExecutorTest.java
li2014/sofa-jraft
a16d9066de73a81186ce40c963bb51d1e205a52b
[ "Apache-2.0" ]
1,828
2019-04-15T05:53:23.000Z
2022-03-30T02:03:20.000Z
jraft-core/src/test/java/com/alipay/sofa/jraft/util/concurrent/MpscSingleThreadExecutorTest.java
hzh0425/sofa-jraft
72b71ba194b93b836631531ec303399d107a5915
[ "Apache-2.0" ]
503
2019-05-13T12:26:49.000Z
2022-03-31T16:27:31.000Z
jraft-core/src/test/java/com/alipay/sofa/jraft/util/concurrent/MpscSingleThreadExecutorTest.java
hzh0425/sofa-jraft
72b71ba194b93b836631531ec303399d107a5915
[ "Apache-2.0" ]
674
2019-05-13T06:00:01.000Z
2022-03-31T07:52:10.000Z
35.648148
115
0.634632
996,852
/* * 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 com.alipay.sofa.jraft.util.concurrent; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import org.junit.Assert; import org.junit.Test; import com.alipay.sofa.jraft.util.NamedThreadFactory; /** * @author jiachun.fjc */ public class MpscSingleThreadExecutorTest { private static final ThreadFactory THREAD_FACTORY = new NamedThreadFactory("test", true); @Test public void testExecutorIsShutdownWithoutTask() { final MpscSingleThreadExecutor executor = new MpscSingleThreadExecutor(1024, THREAD_FACTORY); Assert.assertTrue(executor.shutdownGracefully()); executeShouldFail(executor); executeShouldFail(executor); Assert.assertTrue(executor.isTerminated()); } @Test public void testExecutorIsShutdownWithTask() throws InterruptedException { final MpscSingleThreadExecutor executor = new MpscSingleThreadExecutor(1024, THREAD_FACTORY); final CountDownLatch latch = new CountDownLatch(10); final AtomicLong ret = new AtomicLong(0); for (int i = 0; i < 10; i++) { executor.execute(() -> { try { Thread.sleep(100); ret.incrementAndGet(); latch.countDown(); } catch (final InterruptedException e) { e.printStackTrace(); } }); } Assert.assertTrue(executor.shutdownGracefully()); executeShouldFail(executor); executeShouldFail(executor); Assert.assertTrue(executor.isTerminated()); latch.await(); Assert.assertEquals(10, ret.get()); } @Test public void testExecutorShutdownHooksWithoutTask() { final MpscSingleThreadExecutor executor = new MpscSingleThreadExecutor(1024, THREAD_FACTORY); final AtomicBoolean hookCalled = new AtomicBoolean(false); final CountDownLatch latch = new CountDownLatch(1); executor.addShutdownHook(() -> { hookCalled.set(true); latch.countDown(); }); Assert.assertTrue(executor.shutdownGracefully()); executeShouldFail(executor); executeShouldFail(executor); Assert.assertTrue(executor.isTerminated()); Assert.assertTrue(hookCalled.get()); } @Test public void testExecutorShutdownHooksWithTask() { final MpscSingleThreadExecutor executor = new MpscSingleThreadExecutor(1024, THREAD_FACTORY); final AtomicBoolean hookCalled = new AtomicBoolean(false); final CountDownLatch latch = new CountDownLatch(11); executor.addShutdownHook(() -> { hookCalled.set(true); latch.countDown(); }); final AtomicLong ret = new AtomicLong(0); for (int i = 0; i < 10; i++) { executor.execute(() -> { try { Thread.sleep(100); ret.incrementAndGet(); latch.countDown(); } catch (final InterruptedException e) { e.printStackTrace(); } }); } Assert.assertTrue(executor.shutdownGracefully()); executeShouldFail(executor); executeShouldFail(executor); Assert.assertTrue(executor.isTerminated()); Assert.assertTrue(hookCalled.get()); } @Test public void testExecutorRejected() throws InterruptedException { // 2048 is the minimum of maxPendingTasks final int minMaxPendingTasks = 2048; final MpscSingleThreadExecutor executor = new MpscSingleThreadExecutor(minMaxPendingTasks, THREAD_FACTORY); final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); // add a block task executor.execute(() -> { try { latch1.await(); } catch (final InterruptedException e) { e.printStackTrace(); } latch2.countDown(); }); // wait until the work is blocked Thread.sleep(1000); // fill the task queue for (int i = 0; i < minMaxPendingTasks; i++) { executor.execute(() -> {}); } executeShouldFail(executor); executeShouldFail(executor); executeShouldFail(executor); latch1.countDown(); latch2.await(); executor.shutdownGracefully(); } private static void executeShouldFail(final Executor executor) { try { executor.execute(() -> { // Noop. }); Assert.fail(); } catch (final RejectedExecutionException expected) { // expected } } }
923433471710986c78f7f70a648679a0b023e322
500
java
Java
linker-common-lib/src/main/java/com/linker/common/messages/AuthClient.java
disney007/linker
f470464d6d0687a850f9394a924408197d7a0074
[ "MIT" ]
2
2019-07-16T00:01:52.000Z
2019-07-18T20:13:49.000Z
linker-common-lib/src/main/java/com/linker/common/messages/AuthClient.java
disney007/linker
f470464d6d0687a850f9394a924408197d7a0074
[ "MIT" ]
7
2019-07-23T06:58:00.000Z
2019-08-14T20:40:14.000Z
linker-common-lib/src/main/java/com/linker/common/messages/AuthClient.java
disney007/linker
f470464d6d0687a850f9394a924408197d7a0074
[ "MIT" ]
1
2020-10-30T02:59:03.000Z
2020-10-30T02:59:03.000Z
20
71
0.81
996,853
package com.linker.common.messages; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import java.io.Serializable; @NoArgsConstructor @AllArgsConstructor @Getter @Setter @ToString @EqualsAndHashCode public class AuthClient implements Serializable { private static final long serialVersionUID = -2476945184181905355L; String appId; String userId; String token; }