blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35954cdda62080b47874e51417503cfe2934068a
|
6b4ba8495e8858342528d7eb7174f5385489bf32
|
/app/src/main/java/com/fafu/polutionrepo/finished/SlideSwapHelper/ItemSlideCallback.java
|
ed3d0b2286b679f13bfe1f0d34e2f4b19bb0016d
|
[
"Apache-2.0"
] |
permissive
|
lyx19970504/Weather
|
3976bff75ead9f6562e0b86672498ed8688d219e
|
cc03b1bdb9e1995ac6f00044626a220f74e5226c
|
refs/heads/master
| 2020-05-17T05:49:23.863003
| 2019-06-19T08:00:41
| 2019-06-19T08:00:41
| 183,544,453
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,721
|
java
|
package com.fafu.polutionrepo.finished.SlideSwapHelper;
import android.graphics.Canvas;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
public class ItemSlideCallback extends WItemTouchHelperPlus.Callback {
private String type;
public void setType(String type){
this.type = type;
}
@Override
int getSlideViewWidth() {
return 0;
}
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
return makeMovementFlags(0, ItemTouchHelper.START);
}
@Override
public String getItemSlideType() {
return type;
}
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
}
@Override
public boolean isItemViewSwipeEnabled() {
return true;
}
@Override
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
if (viewHolder instanceof SlideSwapAction) {
SlideSwapAction holder = (SlideSwapAction) viewHolder;
float actionWidth = holder.getActionWidth();
if (dX < -actionWidth) {
dX = -actionWidth;
}
holder.ItemView().setTranslationX(dX);
}
}
@Override
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
super.clearView(recyclerView, viewHolder);
}
}
|
[
"lyx19970504@outlook.com"
] |
lyx19970504@outlook.com
|
068f755b3cab49709c30cae153f01737a2bef024
|
ece937dff9f46e1420594c28fed6c909c75244b2
|
/day3/src/main/java/com/springbook/biz/board/BoardListVO.java
|
c1451d428f34cd9e26c76459a91e79ff83797a66
|
[] |
no_license
|
dokylee54/java-spring-boardEx
|
788b7348ca71144e03ef51ad254aad0d39db19cd
|
6a170a244da5d6eeb87c5abe6e389bee95c3df9d
|
refs/heads/master
| 2022-11-19T00:48:08.337714
| 2020-03-03T11:29:15
| 2020-03-03T11:29:15
| 243,509,628
| 1
| 1
| null | 2022-11-16T00:41:49
| 2020-02-27T12:05:09
|
Java
|
UTF-8
|
Java
| false
| false
| 597
|
java
|
package com.springbook.biz.board;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement(name = "boardList")
@XmlAccessorType(XmlAccessType.FIELD)
public class BoardListVO {
@XmlElement(name = "board")
private List<BoardVO> boardList;
public List<BoardVO> getBoardList() {
return boardList;
}
public void setBoardList(List<BoardVO> boardList) {
this.boardList = boardList;
}
}
|
[
"dokylee54@gmail.com"
] |
dokylee54@gmail.com
|
7dcbcfff28293092c67f660baa4d38b50e22bd69
|
95c707860464880113a651ccac077d1159fba78f
|
/src/main/java/com/numericalmethod/suanshu/analysis/function/special/gamma/GammaRegularizedQ.java
|
dbe0ff555543f3d557985326f119b8e9983e21c3
|
[
"Apache-2.0"
] |
permissive
|
FloFlo93/SuanShu
|
63eec9082c95e13f0fbd23e173bf329dad4273ce
|
450614a298bf7193b1ab430285a44828224272f4
|
refs/heads/master
| 2021-07-30T09:40:43.142596
| 2018-03-12T13:39:22
| 2018-03-12T13:39:22
| 186,459,542
| 0
| 0
|
Apache-2.0
| 2019-05-13T16:43:00
| 2019-05-13T16:43:00
| null |
UTF-8
|
Java
| false
| false
| 5,836
|
java
|
/*
* Copyright (c) Numerical Method Inc.
* http://www.numericalmethod.com/
*
* THIS SOFTWARE IS LICENSED, NOT SOLD.
*
* YOU MAY USE THIS SOFTWARE ONLY AS DESCRIBED IN THE LICENSE.
* IF YOU ARE NOT AWARE OF AND/OR DO NOT AGREE TO THE TERMS OF THE LICENSE,
* DO NOT USE THIS SOFTWARE.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITH NO WARRANTY WHATSOEVER,
* EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
* ANY WARRANTIES OF ACCURACY, ACCESSIBILITY, COMPLETENESS,
* FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, NON-INFRINGEMENT,
* TITLE AND USEFULNESS.
*
* IN NO EVENT AND UNDER NO LEGAL THEORY,
* WHETHER IN ACTION, CONTRACT, NEGLIGENCE, TORT, OR OTHERWISE,
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
* ANY CLAIMS, DAMAGES OR OTHER LIABILITIES,
* ARISING AS A RESULT OF USING OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.numericalmethod.suanshu.analysis.function.special.gamma;
import static com.numericalmethod.suanshu.Constant.EPSILON;
import com.numericalmethod.suanshu.analysis.function.rn2r1.BivariateRealFunction;
import com.numericalmethod.suanshu.analysis.function.rn2r1.univariate.ContinuedFraction;
import com.numericalmethod.suanshu.analysis.sequence.Summation;
import com.numericalmethod.suanshu.misc.SuanShuUtils;
import static com.numericalmethod.suanshu.number.DoubleUtils.compare;
import static com.numericalmethod.suanshu.number.DoubleUtils.isZero;
import static java.lang.Math.exp;
import static java.lang.Math.log;
/**
* The Regularized Incomplete Gamma Q function is defined as:
* \[
* Q(s,x)=\frac{\Gamma(s,x)}{\Gamma(s)}=1-P(s,x), s \geq 0, x \geq 0
* \]
* The algorithm used for computing the regularized incomplete Gamma Q function depends on the values of <i>s</i> and <i>x</i>.
* <ul>
* <li>For \(s > 100\), <i>Q</i> is approximated using the Gauss-Legendre quadrature.
* <li>For \(x < s + 1\), <i>Q</i> is approximated using the Pearson's series representation.
* <li>Otherwise, <i>Q</i> is approximated using the continued fraction expression by Legendre.
* </ul>
* The R equivalent function is {@code pgamma}. E.g., {@code pgamma(x, s, lower=FALSE)}.
*
* @author Haksun Li
* @see
* <ul>
* <li>"B Shea." Algorithm AS 239: Chi-squared and Incomplete Gamma Integral," Applied Statistics. Volume 37, Number 3, 1988, pages 466-473."
* <li><a href="http://en.wikipedia.org/wiki/Regularized_Gamma_function#Regularized_Gamma_functions_and_Poisson_random_variables">Wikipedia: Regularized Gamma functions and Poisson random variables</a>
* </ul>
*/
public class GammaRegularizedQ extends BivariateRealFunction {//TODO: extend to the Complex domain
private static final LogGamma lgamma = new LogGamma();
private static final double epsilon = EPSILON;
/**
* Evaluate <i>Q(s,x)</i>.
*
* @param s <i>s ≥ 0</i>
* @param x <i>x ≥ 0</i>
* @return <i>Q(s,x)</i>
*/
@Override
public double evaluate(double s, double x) {
SuanShuUtils.assertArgument(compare(s, 0, epsilon) >= 0, "s must be >= 0");
SuanShuUtils.assertArgument(compare(x, 0, epsilon) >= 0, "x < 0 gives complex number; not supported yet");
//special cases
if (isZero(s, 0)) {//Q(0, 0) = 0
return 0;
} else if (isZero(x, 0)) {
return 1;
} else if (x > 1e8) {
return 0;
// } else if (s > 100) {//Gauss-Legendre quadrature
// return evaluateByQuadrature(s, x);
} else if (x < s + 1) {//{@code true} when x < 1 for all s; series representation converges faster
return evaluateBySeries(s, x);
} else {//x <= s + 1 < 100 + 1
return evaluateByCF(s, x);
}
}
private double evaluateByQuadrature(final double s, final double x) {//TODO
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Evaluate <i>Q(s,x)</i> using the Pearson's series representation.
*
* @param s <i>s ≥ 0</i>
* @param x <i>x ≥ 0</i>
* @return <i>Q(s,x)</i>
*/
private double evaluateBySeries(final double s, final double x) {
Summation series = new Summation(new Summation.Term() {
double term;
@Override
public double evaluate(double n) {
if (n == 0) {
term = 1d / s;
} else {
term *= x / (s + n);
}
return term;
}
}, epsilon);
double sum = series.sumToInfinity(0);
double result = s * log(x) - x - lgamma.evaluate(s);
result = exp(result);
return 1d - result * sum;
}
/**
* Evaluate <i>Q(s,x)</i> using the continued fraction expression by Legendre.
*
* @param s <i>s ≥ 0</i>
* @param x <i>x ≥ 0</i>
* @return <i>Q(s,x)</i>
*/
private double evaluateByCF(final double s, final double x) {
ContinuedFraction cf = new ContinuedFraction(new ContinuedFraction.Partials() {
@Override
public double A(int n, double u) {
if (n == 1) {
return 1;
} else {
return (n - 1) * (s - (n - 1));
}
}
@Override
public double B(int n, double u) {
if (n == 0) {
return 0;
} else {
return 2 * n - 1 - s + u;
}
}
});
double result = s * log(x) - x - lgamma.evaluate(s);
result = exp(result);
result *= cf.evaluate(x);
return result;
}
}
|
[
"aaiyer@gmail.com"
] |
aaiyer@gmail.com
|
8419dc3b12505daa46e6acb63dbb1e41e8678495
|
fa94c270905ae6f8cd1247b5a4d6267b9ec208ba
|
/src/it/polimi/ingsw2020/ex4/GenericStack.java
|
22e0c0c2b7ff809cf8d9a6818cefd13e5e37e064
|
[] |
no_license
|
gioenn/ingsw-2020
|
c7955842b813f8124f882d5c76b148a9ab695555
|
cf86585c0195e6b572fb3702e04b4d3bb5c5151a
|
refs/heads/master
| 2023-01-20T08:58:39.207754
| 2020-11-24T08:45:09
| 2020-11-24T08:45:09
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,024
|
java
|
package it.polimi.ingsw2020.ex4;
import it.polimi.ingsw2020.ex3.Square;
import java.util.Iterator;
import java.util.LinkedList;
public class GenericStack<E> implements Iterable<E> {
protected LinkedList<E> data = new LinkedList<>();
private int size;
public GenericStack(int size){
this.size = size;
}
public void push(E elem) throws OutOfSpaceException {
if (data.size() == size)
throw new OutOfSpaceException();
data.addFirst(elem);
}
public E pop() {
if (data.size() == 0)
throw new OutOfDataException();
return data.removeFirst();
}
@Override
public Iterator<E> iterator() {
System.out.println("ITERATOR");
return new StackIterator();
}
private class StackIterator implements Iterator<E>{
private int idx = 0;
@Override
public boolean hasNext() {
System.out.println("HAS NEXT");
return idx < data.size();
}
@Override
public E next() {
System.out.println("NEXT");
return data.get(idx++);
}
}
public static void main(String[] args) throws OutOfSpaceException {
GenericStack<String> s = new GenericStack<>(5);
s.push("A");
s.push("B");
System.out.println(s.pop());
System.out.println(s.pop());
GenericStack<Square> s1 = new GenericStack<>(5);
s1.push(new Square(3));
System.out.println("Iterator:");
s.push("C");
s.push("D");
s.push("E");
s.pop();
Iterator<String> i = s.iterator();
while(i.hasNext())
System.out.println(i.next());
for(String elem : s){
// codice utente
System.out.println(elem);
}
/* compilato in
for(Iterator<String> i = s.iterator(); i.hasNext(); ){
String elem = i.next();
// codice utente
...
}
*/
}
}
|
[
"giovanniquattrocchi@me.com"
] |
giovanniquattrocchi@me.com
|
6832b869f382f4895e9b7e03d20b1383ae457ead
|
d86af457d83c30c20daa5589099845d57b47e73e
|
/fireflow-fpdl20/src/main/java/org/fireflow/pdl/fpdl/process/features/startnode/TimerStartFeature.java
|
8b1cf7ca444eaa2d3f21bbcd6f57601e5efc6c93
|
[] |
no_license
|
liudianpeng/FireflowEngine20
|
f407251e12c9c8b4aeda2d6043b121949187911d
|
774bdd82b27b8d4822168038a86aa33ae14185ab
|
refs/heads/master
| 2021-01-11T03:18:44.600542
| 2015-03-29T15:37:06
| 2015-03-29T15:37:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 890
|
java
|
package org.fireflow.pdl.fpdl.process.features.startnode;
import org.fireflow.engine.invocation.TimerOperationName;
import org.fireflow.model.data.Expression;
import org.fireflow.pdl.fpdl.process.Activity;
import org.fireflow.pdl.fpdl.process.features.Feature;
public interface TimerStartFeature extends Feature {
public Activity getAttachedToActivity();
public void setAttachedToActivity(Activity act);
/**
* 该字段表示事件触发时,是否将所依附的Activity取消。默认为不取消(false)
* @return
*/
public boolean getCancelAttachedToActivity();
public TimerOperationName getTimerOperationName();
public Expression getStartTimeExpression();
public Expression getEndTimeExpression();
public Expression getRepeatCountExpression();
public Expression getRepeatIntervalExpression();
public Expression getCronExpression();
}
|
[
"nychen2000@163.com"
] |
nychen2000@163.com
|
deb7641ad3e14c1f13a4c235936dc237c0ce9578
|
651fa3ae55e2af38685c111026b8134712a0eb2c
|
/demo/src/main/java/com/hippo/conductor/attacher/demo/MainActivity.java
|
154ed1f6dc7ce7744372ada1ebf8626df267cef4
|
[
"Apache-2.0"
] |
permissive
|
t894924815/conductor-attacher
|
f5bacfb4ee7ead9d3f8f0a7c9419d01bc727b711
|
368e6b5a54ae7c26732639d680bb6d5a0e030c8a
|
refs/heads/master
| 2021-01-20T00:27:19.503551
| 2017-04-17T14:51:26
| 2017-04-17T14:51:26
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,710
|
java
|
/*
* Copyright 2017 Hippo Seven
*
* 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.hippo.conductor.attacher.demo;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
private static final String[] TITLES = {
"Normal",
"With Attacher",
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ListView listView = (ListView) findViewById(R.id.list);
listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, TITLES));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
startActivity(
new Intent(MainActivity.this, ControllerActivity.class)
.putExtra(ControllerActivity.KEY_USE_ATTACHER, position != 0)
);
}
});
}
}
|
[
"seven332@163.com"
] |
seven332@163.com
|
477212078b25e484f761b01abd8809201106a5e8
|
e7d4f10e6a2b2397c7621a9a94472efc197b4392
|
/Wallet/src/test/java/money/wallet/api/WalletServiceTests.java
|
b50c5bb8e0c5148a2851cc352aa3754bcaf8ba96
|
[] |
no_license
|
FyiurAmron/WalletMicroservice
|
b04caf8959b8a889c65740d7d9553a1994afd876
|
00a6bc5dd4464aaca808a839199e10da8fada27b
|
refs/heads/main
| 2023-08-25T04:17:57.651004
| 2021-10-12T03:06:17
| 2021-10-12T03:06:17
| 415,052,096
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 17,026
|
java
|
package money.wallet.api;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import javax.persistence.EntityExistsException;
import javax.persistence.EntityNotFoundException;
import java.util.List;
import money.wallet.api.data.*;
import money.wallet.api.exception.IllegalOperationAmountException;
import money.wallet.api.service.RepositoryWalletService;
import static org.junit.jupiter.api.Assertions.*;
@Tag( TestUtils.INTEGRATION_TAG )
@SpringBootTest
@AutoConfigureTestDatabase
@DirtiesContext( classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD )
// alternatively, to speed things up, create a context doing a DB reset at setup
public class WalletServiceTests {
private static final long EXAMPLE_TRANSACTION_ID = 1337;
private static final long EXAMPLE_AMOUNT = 42;
private static final int OP_REPEATS = 5;
@Autowired
private RepositoryWalletService walletService;
// we don't expose this type of comparison in WalletAmount to not pollute the implementation
private void assertAmountEquals( Long nullableAmount, WalletAmount walletAmount ) {
assertEquals(
nullableAmount == null ? null : new WalletAmount( nullableAmount ),
walletAmount
);
}
private void assertOperationResults(
WalletOperation walletOperation,
WalletOperationType type,
Long amount,
Long balanceBefore,
Long balanceAfter,
Long transactionId
) {
assertEquals(
type,
walletOperation.type()
);
assertAmountEquals(
amount,
walletOperation.amount()
);
assertAmountEquals(
balanceBefore,
walletOperation.balanceBefore()
);
assertAmountEquals(
balanceAfter,
walletOperation.balanceAfter()
);
assertEquals(
transactionId,
walletOperation.transactionId()
);
}
@Test
public void isWalletCreatedEmpty() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
assertOperationResults(
createWalletOperation,
WalletOperationType.CREATE,
null,
null,
0L,
EXAMPLE_TRANSACTION_ID
);
}
@Test
public void isWalletBalanceZeroAfterCreation() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
WalletOperation balanceWalletOperation = walletService.getBalance( createWalletOperation.walletId() );
assertOperationResults(
balanceWalletOperation,
WalletOperationType.BALANCE,
null,
0L,
0L,
null
);
}
@Test
public void throwsOnCreateWithNonUniqueIds() {
walletService.createWallet( EXAMPLE_TRANSACTION_ID );
assertThrows( EntityExistsException.class, () ->
walletService.createWallet( EXAMPLE_TRANSACTION_ID ) );
}
@Test
public void areAmountsProperlyDeposited() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
WalletOperation makeDepositWalletOperation = walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 1
);
assertOperationResults(
makeDepositWalletOperation,
WalletOperationType.DEPOSIT,
EXAMPLE_AMOUNT,
0L,
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 1
);
WalletOperation makeDepositWalletResponse2 = walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 2,
EXAMPLE_TRANSACTION_ID + 2
);
assertOperationResults(
makeDepositWalletResponse2,
WalletOperationType.DEPOSIT,
EXAMPLE_AMOUNT * 2,
EXAMPLE_AMOUNT,
EXAMPLE_AMOUNT * 3,
EXAMPLE_TRANSACTION_ID + 2
);
}
@Test
public void areMultipleDepositsSummedCorrectly() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
for ( int i = 0; i < OP_REPEATS; i++ ) {
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 2 + i
);
}
long finalBalance = walletService.getBalance( createWalletOperation.walletId() ).balanceBefore().value();
assertEquals( EXAMPLE_AMOUNT * OP_REPEATS, finalBalance );
}
@Test
public void throwsOnDepositsWithNonUniqueIds() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 1
);
assertThrows( EntityExistsException.class, () ->
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 2,
EXAMPLE_TRANSACTION_ID + 1
)
);
}
@Test
public void throwsOnNegativeDeposits() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
assertThrows( IllegalOperationAmountException.class, () ->
walletService.makeDeposit(
createWalletOperation.walletId(),
-EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 1
)
);
}
@Test
public void throwsOnZeroDeposits() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
assertThrows( IllegalOperationAmountException.class, () ->
walletService.makeDeposit(
createWalletOperation.walletId(),
0,
EXAMPLE_TRANSACTION_ID + 1
)
);
}
@Test
public void throwsOnNegativeWithdrawals() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 1
);
assertThrows( IllegalOperationAmountException.class, () ->
walletService.makeWithdrawal(
createWalletOperation.walletId(),
-EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 2
)
);
}
@Test
public void throwsOnZeroWithdrawals() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 1
);
assertThrows( IllegalOperationAmountException.class, () ->
walletService.makeWithdrawal(
createWalletOperation.walletId(),
0,
EXAMPLE_TRANSACTION_ID + 2
)
);
}
@Test
public void throwsOnWithdrawalsWithNonUniqueIds() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 3,
EXAMPLE_TRANSACTION_ID + 1
);
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 2
);
assertThrows( EntityExistsException.class, () ->
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 2
)
);
}
@Test
public void throwsOnMixedOpsWithNonUniqueIds() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
assertThrows( EntityExistsException.class, () ->
walletService.createWallet( EXAMPLE_TRANSACTION_ID )
);
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 3,
EXAMPLE_TRANSACTION_ID + 1
);
assertThrows( EntityExistsException.class, () ->
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 3,
EXAMPLE_TRANSACTION_ID // used by create
)
);
assertThrows( EntityExistsException.class, () ->
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 3,
EXAMPLE_TRANSACTION_ID + 1 // used by deposit
)
);
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 2
);
assertThrows( EntityExistsException.class, () ->
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID // used by create
)
);
assertThrows( EntityExistsException.class, () ->
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 1 // used by deposit
)
);
assertThrows( EntityExistsException.class, () ->
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 2 // used by withdrawal
)
);
}
@Test
public void throwsOnBalanceExceeded() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 2,
EXAMPLE_TRANSACTION_ID + 1
);
assertThrows( IllegalOperationAmountException.class, () ->
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 2 + 1,
EXAMPLE_TRANSACTION_ID + 2
)
);
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 2
);
assertThrows( IllegalOperationAmountException.class, () ->
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT + 1,
EXAMPLE_TRANSACTION_ID + 3
)
);
}
@Test
public void isCompleteWithdrawalInSequenceOfWithdrawalsPossible() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * OP_REPEATS,
EXAMPLE_TRANSACTION_ID + 1
);
for ( int i = 0; i < OP_REPEATS; i++ ) {
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT,
EXAMPLE_TRANSACTION_ID + 2 + i
);
}
long finalBalance = walletService.getBalance( createWalletOperation.walletId() ).balanceBefore().value();
assertEquals( 0, finalBalance );
}
@Test
public void throwsOnBalanceMaximumExceeded() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
assertThrows( IllegalOperationAmountException.class, () ->
walletService.makeDeposit(
createWalletOperation.walletId(),
WalletAmount.MAX_AMOUNT + 1,
EXAMPLE_TRANSACTION_ID + 1
)
);
walletService.makeDeposit(
createWalletOperation.walletId(),
WalletAmount.MAX_AMOUNT,
EXAMPLE_TRANSACTION_ID + 1
);
assertThrows( IllegalOperationAmountException.class, () ->
walletService.makeDeposit(
createWalletOperation.walletId(),
1,
EXAMPLE_TRANSACTION_ID + 2
)
);
}
// id=1 would usually be the 1st one autogenerated, but it shouldn't exist yet
@Test
public void throwsOnBalanceForNonexistentWallet() {
assertThrows( EntityNotFoundException.class, () ->
walletService.getBalance( 1 )
);
}
@Test
public void throwsOnDepositForNonexistentWallet() {
assertThrows( EntityNotFoundException.class, () ->
walletService.makeDeposit( 1, EXAMPLE_AMOUNT, EXAMPLE_TRANSACTION_ID )
);
}
@Test
public void throwsOnWithdrawalForNonexistentWallet() {
assertThrows( EntityNotFoundException.class, () ->
walletService.makeWithdrawal( 1, EXAMPLE_AMOUNT, EXAMPLE_TRANSACTION_ID )
);
}
@Test
public void throwsOnStatementForNonexistentWallet() {
assertThrows( EntityNotFoundException.class, () ->
walletService.getStatement( 1 )
);
}
@Test
public void isSimpleStatementValid() {
WalletOperation createWalletOperation = walletService.createWallet( EXAMPLE_TRANSACTION_ID );
walletService.makeDeposit(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 9,
EXAMPLE_TRANSACTION_ID + 1
);
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 3,
EXAMPLE_TRANSACTION_ID + 2
);
walletService.makeWithdrawal(
createWalletOperation.walletId(),
EXAMPLE_AMOUNT * 2,
EXAMPLE_TRANSACTION_ID + 3
);
WalletStatement walletStatement = walletService.getStatement( createWalletOperation.walletId() );
List<WalletOperation> walletTransactionViewLists = walletStatement.walletStatementItems();
assertEquals( 4, walletTransactionViewLists.size() );
assertOperationResults(
walletTransactionViewLists.get( 0 ),
WalletOperationType.CREATE,
null,
null,
0L,
EXAMPLE_TRANSACTION_ID
);
assertOperationResults(
walletTransactionViewLists.get( 1 ),
WalletOperationType.DEPOSIT,
EXAMPLE_AMOUNT * 9,
0L,
EXAMPLE_AMOUNT * 9,
EXAMPLE_TRANSACTION_ID + 1
);
assertOperationResults(
walletTransactionViewLists.get( 2 ),
WalletOperationType.WITHDRAWAL,
EXAMPLE_AMOUNT * 3,
EXAMPLE_AMOUNT * 9,
EXAMPLE_AMOUNT * 6,
EXAMPLE_TRANSACTION_ID + 2
);
assertOperationResults(
walletTransactionViewLists.get( 3 ),
WalletOperationType.WITHDRAWAL,
EXAMPLE_AMOUNT * 2,
EXAMPLE_AMOUNT * 6,
EXAMPLE_AMOUNT * 4,
EXAMPLE_TRANSACTION_ID + 3
);
long finalBalance = walletService.getBalance( createWalletOperation.walletId() ).balanceBefore().value();
assertEquals( EXAMPLE_AMOUNT * 4, finalBalance );
}
/*
@Test
public void isWalletRemoved() {
}
*/
}
|
[
"spamove@gmail.com"
] |
spamove@gmail.com
|
a4af3b66a354b306bacc1793c4da41c63007c36f
|
83dbd433aeed1f15f6501f39fe152abc0dc803d9
|
/multithread_study/java_multithread_core_tech/src/test/java/com/bd/java/multithread/core/tech/chapter4/reentrant_lock/ReentrantLockTest.java
|
b69abcf1c7a353aeafa0bb2bf8f0ac1944595305
|
[] |
no_license
|
pylrichard/web_service_study
|
d0d42ea0c511b9b15a235a99cde5b4b025c33c6d
|
c1bd8753c6aee69c87707db7f3fb8e0d7f5ddbc0
|
refs/heads/master
| 2021-09-14T23:31:12.454640
| 2018-05-22T06:26:14
| 2018-05-22T06:26:14
| 104,879,563
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 394
|
java
|
package com.bd.java.multithread.core.tech.chapter4.reentrant_lock;
public class ReentrantLockTest {
public static void main(String[] args) {
MyService service = new MyService();
MyThread t1 = new MyThread(service);
MyThread t2 = new MyThread(service);
MyThread t3 = new MyThread(service);
t1.start();
t2.start();
t3.start();
}
}
|
[
"pylrichard@qq.com"
] |
pylrichard@qq.com
|
a408c5d992dbf425ae05ae18122747b81d311311
|
c00da088725b75aad7546d0ea87ecc938b824879
|
/src/main/java/com/briup/apps/poll/web/controller/AnswersCotroller.java
|
d4ef180499d4f01f0162657187f9323df1a7f1ea
|
[] |
no_license
|
6WE6/poll2
|
df17d5149e821ede06090b9232f7a9a13eec612c
|
81da29f5713ecbd595824a918f7ee3b28c79dd62
|
refs/heads/master
| 2020-03-21T13:19:05.594718
| 2018-07-25T06:33:29
| 2018-07-25T06:33:29
| 138,599,456
| 4
| 3
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,621
|
java
|
package com.briup.apps.poll.web.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.briup.apps.poll.bean.Answers;
import com.briup.apps.poll.bean.extend.AnswersVM;
import com.briup.apps.poll.service.IAnswersService;
import com.briup.apps.poll.util.MsgResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(description = "答题卡相关接口")
@RestController
@RequestMapping("/answer")
public class AnswersCotroller {
@Autowired
private IAnswersService answersService;
/*
* 查询所有答题卡,包括问卷
*/
@ApiOperation(value="查询所有班答题卡",notes="答题卡携带调查问卷survey")
@GetMapping("findAllVM")
public MsgResponse findAllVM() {
try {
List<AnswersVM> list=answersService.selectAllAnswersVM();
return MsgResponse.success("success", list);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return MsgResponse.error(e.getMessage());
}
}
/*
* 查询所有答题卡
*/
@ApiOperation(value = "查询所有答题卡信息", notes = "单表")
@GetMapping("/findAllAnswers")
public MsgResponse findAllAnswers() {
try {
List<Answers> list = answersService.findAll();
return MsgResponse.success("success", list);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return MsgResponse.error(e.getMessage());
}
}
/*
* 通过id查询答题卡
*/
@ApiOperation(value = "通过id查询答题卡", notes = "单表")
@GetMapping("/findAnswersById")
public MsgResponse findAnswersById(@RequestParam long id) {
Answers answers = new Answers();
try {
answers = answersService.findAnswersById(id);
return MsgResponse.success("success", answers);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return MsgResponse.error(e.getMessage());
}
}
/*
* 通过seivey id查询答题卡
*/
@ApiOperation(value = "通过seivey id查询答题卡", notes = "单表")
@GetMapping("/findAnswersBySurveyId")
public MsgResponse findAnswersBySurveyId(@RequestParam long id) {
List<Answers> list;
try {
list = answersService.findAnswersByServeyId(id);
return MsgResponse.success("success", list);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return MsgResponse.error(e.getMessage());
}
}
/*
* 通过关键字查询答题卡
*/
@ApiOperation(value = "通过关键字查询答题卡")
@GetMapping("/findAnswersByKeyword")
public MsgResponse findAnswersByKeyword(@RequestParam String keywords) {
try {
List<Answers> list = answersService.query(keywords);
return MsgResponse.success("success", list);
} catch (Exception e) {
e.printStackTrace();
return MsgResponse.error(e.getMessage());
}
}
/*
* 保存或修改答题卡信息
*/
@ApiOperation(value = "保存或更新答题卡信息")
@PostMapping("saveOrUpdateAnswers")
public String saveOrUpdateAnswers(Answers answers) {
try {
answersService.saveOrUpdateAnswers(answers);
return "操作成功";
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return "操作失败" + e.getMessage();
}
}
/*
* 通过id删除答题卡信息
*/
@ApiOperation(value = "通过id删除答题卡信息")
@GetMapping("deleteAnswersById")
public MsgResponse deleteAnswersById(@RequestParam long id) {
try {
answersService.deleteAnswersById(id);
return MsgResponse.success("删除成功", null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return MsgResponse.error(e.getMessage());
}
}
/*
* 批量删除答题卡信息
*/
@ApiOperation(value = "批量删除答题卡信息")
@GetMapping("batchDeleteAnswers")
public MsgResponse batchDeleteAnswers(long[] ids) {
try {
answersService.bathDeleteAnswers(ids);
return MsgResponse.success("删除成功", null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return MsgResponse.error(e.getMessage());
}
}
}
|
[
"高学亭@DESKTOP-O5HVH32"
] |
高学亭@DESKTOP-O5HVH32
|
cfb96513eddfaf0574a8badea2132821bb9b0cf3
|
a3c37b619a21d92d970a194e4729f95c1b67be51
|
/Table editor/src/com/ivan/tableEditor/tableEditorView/TableEditorMainFrame.java
|
f0ed639e3ca6a425a71594d2241cf03b198cefe6
|
[] |
no_license
|
IvanYakimtsov/UselessJavaProjects
|
01899ee4acce8dd2872ac7ffc7fa4986d8d520d6
|
8680271b423764d9917d4a68f04d448058f44718
|
refs/heads/master
| 2020-04-06T03:52:02.903518
| 2018-05-13T10:43:20
| 2018-05-13T10:43:20
| 83,147,003
| 3
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,944
|
java
|
package com.ivan.tableEditor.tableEditorView;
import com.ivan.tableEditor.tableEditorView.workingArea.WorkingArea;
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.*;
import java.util.List;
/**
* Created by Ivan on 21.03.2017.
*/
public class TableEditorMainFrame {
final public static int SAVE_BUTTON_INDEX = 0;
final public static int OPEN_BUTTON_INDEX = 1;
final public static int ADD_BUTTON_INDEX = 2;
final public static int DELETE_BUTTON_INDEX = 3;
final public static int SEARCH_BUTTON_INDEX = 4;
private JFrame mainFrame;
private JToolBar toolBar;
private List<JButton> toolPanelButtons;
private List<JMenuItem> menuButtons;
public TableEditorMainFrame() {
toolPanelButtons = new ArrayList<>();
menuButtons = new ArrayList<>();
setFrame();
mainFrame.validate();
mainFrame.repaint();
}
private void setFrame() {
this.mainFrame = new JFrame("Редактор таблиц");
this.mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
addFrameListener();
addToolPanel();
addMenuBar();
this.mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
this.mainFrame.setVisible(true);
}
private void addMenuBar(){
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Меню");
JMenuItem menuItem = new JMenuItem("Сохранить");
menu.add(menuItem);
menuButtons.add(menuItem);
menuItem = new JMenuItem("Открыть");
menu.add(menuItem);
menuButtons.add(menuItem);
menuItem = new JMenuItem("Добавить студента");
menu.add(menuItem);
menuButtons.add(menuItem);
menuItem = new JMenuItem("Удалить студента");
menu.add(menuItem);
menuButtons.add(menuItem);
menuItem = new JMenuItem("Найти студента");
menu.add(menuItem);
menuButtons.add(menuItem);
menuBar.add(menu);
mainFrame.setJMenuBar(menuBar);
}
private void addToolPanel() {
toolBar = new JToolBar();
toolBar.setPreferredSize(new Dimension(mainFrame.getWidth(), 48));
toolBar.setFloatable(false);
Box buttonsBox = Box.createHorizontalBox();
toolBar.setBackground(new Color(94, 115, 232));
setButtons(buttonsBox);
toolBar.add(buttonsBox);
mainFrame.add(toolBar, BorderLayout.NORTH);
}
private void setButtons(Box buttonsBox) {
addButton("img/save.png", buttonsBox);
addButton("img/open.png", buttonsBox);
addButton("img/add-user.png", buttonsBox);
addButton("img/remove-user.png", buttonsBox);
addButton("img/search-user.png", buttonsBox);
}
private void addButton(String filename, Box buttonsBox) {
JButton button = new JButton(new ImageIcon(filename));
button.setBackground(null);
button.setPreferredSize(new Dimension(40, 40));
buttonsBox.add(button);
buttonsBox.add(Box.createHorizontalStrut(32));
toolPanelButtons.add(button);
}
public void addWorkingArea(WorkingArea workingArea) {
mainFrame.add(workingArea.getWorkingAreaPanel());
mainFrame.validate();
mainFrame.repaint();
}
private void addFrameListener() {
this.mainFrame.addWindowListener(new WindowListener() {
@Override
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
Object[] options = {"Выйти", "Отменить"};
int n = JOptionPane
.showOptionDialog(e.getWindow(), "Вы действительно хотите выйти?",
"Подтверждение", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options,
options[0]);
if (n == 0) {
e.getWindow().setVisible(false);
System.exit(0);
}
}
@Override
public void windowClosed(WindowEvent e) {
}
@Override
public void windowIconified(WindowEvent e) {
}
@Override
public void windowDeiconified(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent e) {
}
@Override
public void windowDeactivated(WindowEvent e) {
}
});
}
public List<JMenuItem> getMenuButtons() {
return menuButtons;
}
public List<JButton> getToolPanelButtons() {
return toolPanelButtons;
}
}
|
[
"ivan.yakimtspv@gmail.com"
] |
ivan.yakimtspv@gmail.com
|
42bfb6d2d0c829637f50960ad2a8755ddd2fcad1
|
07879795b55dd97abb9cd084ac9712158650788a
|
/usite/src/com/chenjishi/u148/volley/toolbox/RequestFuture.java
|
c80a18553596254b9560e281c57f5047c8ef0a15
|
[
"MIT"
] |
permissive
|
BreankingBad/usite
|
47d00e8c9a6a285c210f0be8d640399fc292ef8e
|
4e6284e504719f2b7ef3ac7ab380615b3c0dc96b
|
refs/heads/master
| 2020-12-01T01:15:15.024402
| 2015-02-08T10:47:46
| 2015-02-08T10:47:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,111
|
java
|
/*
* Copyright (C) 2011 The Android Open Source 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 com.chenjishi.u148.volley.toolbox;
import com.chenjishi.u148.volley.Request;
import com.chenjishi.u148.volley.Response;
import com.chenjishi.u148.volley.VolleyError;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* A Future that represents a Volley request.
*
* Used by providing as your response and error listeners. For example:
* <pre>
* RequestFuture<JSONObject> future = RequestFuture.newFuture();
* MyRequest request = new MyRequest(URL, future, future);
*
* // If you want to be able to cancel the request:
* future.setRequest(requestQueue.add(request));
*
* // Otherwise:
* requestQueue.add(request);
*
* try {
* JSONObject response = future.get();
* // do something with response
* } catch (InterruptedException e) {
* // handle the error
* } catch (ExecutionException e) {
* // handle the error
* }
* </pre>
*
* @param <T> The type of parsed response this future expects.
*/
public class RequestFuture<T> implements Future<T>, Response.Listener<T>,
Response.ErrorListener {
private Request<?> mRequest;
private boolean mResultReceived = false;
private T mResult;
private VolleyError mException;
public static <E> RequestFuture<E> newFuture() {
return new RequestFuture<E>();
}
private RequestFuture() {}
public void setRequest(Request<?> request) {
mRequest = request;
}
@Override
public synchronized boolean cancel(boolean mayInterruptIfRunning) {
if (mRequest == null) {
return false;
}
if (!isDone()) {
mRequest.cancel();
return true;
} else {
return false;
}
}
@Override
public T get() throws InterruptedException, ExecutionException {
try {
return doGet(null);
} catch (TimeoutException e) {
throw new AssertionError(e);
}
}
@Override
public T get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
return doGet(TimeUnit.MILLISECONDS.convert(timeout, unit));
}
private synchronized T doGet(Long timeoutMs)
throws InterruptedException, ExecutionException, TimeoutException {
if (mException != null) {
throw new ExecutionException(mException);
}
if (mResultReceived) {
return mResult;
}
if (timeoutMs == null) {
wait(0);
} else if (timeoutMs > 0) {
wait(timeoutMs);
}
if (mException != null) {
throw new ExecutionException(mException);
}
if (!mResultReceived) {
throw new TimeoutException();
}
return mResult;
}
@Override
public boolean isCancelled() {
if (mRequest == null) {
return false;
}
return mRequest.isCanceled();
}
@Override
public synchronized boolean isDone() {
return mResultReceived || mException != null || isCancelled();
}
@Override
public synchronized void onResponse(T response) {
mResultReceived = true;
mResult = response;
notifyAll();
}
@Override
public synchronized void onErrorResponse(VolleyError error) {
mException = error;
notifyAll();
}
}
|
[
"jishi@staff.xianguo.com"
] |
jishi@staff.xianguo.com
|
08f5c7a9732fb272ede7c86d72d0ad567bf18421
|
17dbe7e2e570cc3e0ac6e4b2d3223d2d41dc5061
|
/src/main/java/org/dselent/course_load_scheduler/client/gin/Injector.java
|
22eaf3e3dfc16ca7992f2744d4f91620da118b28
|
[] |
no_license
|
dselent/course_load_scheduler
|
b91fd3c29b14640538b50d387a5a36cfb8a73cac
|
75e93e9cf58224218d3ff3ad68e3a7250dbc2c81
|
refs/heads/master
| 2021-05-02T00:05:51.177271
| 2018-02-18T10:21:55
| 2018-02-18T10:21:55
| 120,937,277
| 0
| 8
| null | 2018-02-25T20:12:39
| 2018-02-09T17:50:26
|
Java
|
UTF-8
|
Java
| false
| false
| 1,804
|
java
|
package org.dselent.course_load_scheduler.client.gin;
import org.dselent.course_load_scheduler.client.presenter.impl.ExamplePresenterImpl;
import org.dselent.course_load_scheduler.client.presenter.impl.IndexPresenterImpl;
import org.dselent.course_load_scheduler.client.presenter.impl.LoginPresenterImpl;
import org.dselent.course_load_scheduler.client.service.impl.UserServiceImpl;
import org.dselent.course_load_scheduler.client.view.impl.ExampleViewImpl;
import org.dselent.course_load_scheduler.client.view.impl.IndexViewImpl;
import org.dselent.course_load_scheduler.client.view.impl.LoginViewImpl;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.inject.client.GinModules;
import com.google.gwt.inject.client.Ginjector;
/**
* Interface required by gin due to lack of runtime reflections
* Provide methods to get all objects that are to be injected
*
* GinModules annotation: indicates what the module file is
*
* @author dselent
*
*/
@GinModules(InjectorModule.class)
public interface Injector extends Ginjector
{
// GIN generator will instantiate this
// GWT.create uses deferred bindings where many permutations are created but only one
// is used at runtime (the one for the specific browser)
public static final Injector INSTANCE = GWT.create(Injector.class);
// event bus
public SimpleEventBus getEventBus();
// presenters
public IndexPresenterImpl getIndexPresenter();
public LoginPresenterImpl getLoginPresenter();
public ExamplePresenterImpl getExamplePresenter();
//views
public IndexViewImpl getIndexView();
public LoginViewImpl getLoginView();
public ExampleViewImpl geExampleView();
// services
public UserServiceImpl getUserService();
}
|
[
"selentd@gmail.com"
] |
selentd@gmail.com
|
a7d990bc7a6de22c902cad6b54027c3432a27dbf
|
a1a1e5900afd1df93835b8122838003e386206b5
|
/api-correntista/src/main/java/br/com/unp/apicorrentista/filter/CorrentistaFilter.java
|
1dc67026a318d7691699d61b78f8e120ac7d6a65
|
[] |
no_license
|
lulukamagaiver/correntista
|
751c7c7747364281951ef3a0e5ec815e73e4c2bc
|
8bef94f3302e1844a8cfb46c3ccfe29993e067cb
|
refs/heads/master
| 2020-06-03T02:08:07.606416
| 2019-06-13T03:39:20
| 2019-06-13T03:39:20
| 191,389,508
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 754
|
java
|
package br.com.unp.apicorrentista.filter;
import java.util.Date;
import java.math.BigDecimal;
public class CorrentistaFilter {
private Long id;
private String nome;
private Date dataCriacao;
private BigDecimal saldoFinanceiro;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return this.nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Date getDataCriacao() {
return this.dataCriacao;
}
public void setDataCriacao(Date dataCriacao) {
this.dataCriacao = dataCriacao;
}
public BigDecimal getSaldoFinanceiro() {
return this.saldoFinanceiro;
}
public void setSaldoFinanceiro(BigDecimal saldoFinanceiro) {
this.saldoFinanceiro = saldoFinanceiro;
}
}
|
[
"luluka.magaiver@gmail.com"
] |
luluka.magaiver@gmail.com
|
6f7925c8e8517c2163e1e477c4359cda7c3df345
|
6ecd996ecbd4f11555096ca22dd4a630ed151265
|
/seata-storage-service2002/src/main/java/com/cf/spring/cloud/alibaba/config/DataSourceProxyConfig.java
|
7b6cd51633f6025c142f767a4688c9fb9a3c0f2a
|
[] |
no_license
|
cf1429/cloud2020
|
642b170a37b5585eea1ace71adab52fc619d91c4
|
dc5b104b0eeddb06b36e1dbad2de616a99be7d4c
|
refs/heads/master
| 2022-08-23T05:42:30.992711
| 2021-08-06T08:04:27
| 2021-08-06T08:04:27
| 251,238,790
| 0
| 0
| null | 2022-06-21T03:06:13
| 2020-03-30T07:59:21
|
Java
|
UTF-8
|
Java
| false
| false
| 1,469
|
java
|
package com.cf.spring.cloud.alibaba.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
@Configuration
public class DataSourceProxyConfig {
@Value("${mybatis-plus.mapper-locations}")
private String mapperLocations;
@Bean
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource druidDataSource(){
return new DruidDataSource();
}
// public DataSourceProxy dataSourceProxy(DataSource dataSource){
// return new DataSourceProxyImpl(dataSource);
// }
@Bean
public SqlSessionFactory sqlSessionFactory( DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
factoryBean.setDataSource(dataSource);
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(mapperLocations));
return factoryBean.getObject();
}
}
|
[
"1429043932@qq.com"
] |
1429043932@qq.com
|
7833684ee9339b3e57d85de3d3b535610a2f21ae
|
2eac4f51a2e4363349e852ce3af8ca234c1a13f7
|
/fx/trunk/fx-backtest/src/main/java/com/jeff/fx/indicator/indicator/Stochastic.java
|
3f8929919c677d96ebf503b9e94dc17307971beb
|
[] |
no_license
|
johnffracassi/jcfx
|
4e19ac0fdba174db0fe3eb2fc8848652a5c99c11
|
b0a2349fdd1de0bf60c7ccf9a17af4e43e0a1727
|
refs/heads/master
| 2016-09-05T15:13:49.981403
| 2011-07-21T05:54:28
| 2011-07-21T05:54:28
| 41,260,482
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,238
|
java
|
package com.jeff.fx.indicator.indicator;
import org.springframework.stereotype.Component;
import com.jeff.fx.indicator.ChartType;
import com.jeff.fx.indicator.ChartTypes;
import com.jeff.fx.indicator.TAWrapper;
import com.tictactec.ta.lib.Core;
import com.tictactec.ta.lib.MAType;
import com.tictactec.ta.lib.MInteger;
@Component
@ChartType(ChartTypes.Oscillator)
public final class Stochastic extends TAWrapper
{
private int fastK;
private int slowK;
private MAType maType;
public Stochastic()
{
this(5, 2);
}
public Stochastic(int fastK, int slowK)
{
this.fastK = fastK;
this.slowK = slowK;
}
public void calculate(Core core, float[] open, float[] high, float[] low, float[] close, MInteger startIdx, double values[][])
{
core.stoch(0, close.length-1, high, low, close, fastK, slowK, maType, 5, maType, startIdx, new MInteger(), values[0], values[1]);
}
@Override
public String getKey()
{
return "stoch";
}
@Override
public String getDisplayName()
{
return getKey() + "(" + fastK + "," + slowK + ")";
}
@Override
public void setParams(Object... params)
{
}
}
|
[
"jeffcann@360c4b46-674e-11de-9b35-9190732fe600"
] |
jeffcann@360c4b46-674e-11de-9b35-9190732fe600
|
9eb9ad56af568b1c8f0f1a7c6c77793a6b6fc78e
|
79cc3088b2e97a726880b0b2c2aa1c8c4435c58d
|
/InfoNote_14/src/util/GerarSenha.java
|
bc3ce6e8a1f2bd63d1fcde823874855140f5ddbb
|
[] |
no_license
|
JotaPe/java-senai
|
3b5bb8955726117a0396e7bbf548b20cb3b492aa
|
f7ee8260c78da0e8429210d7a38f450a2c7ebed6
|
refs/heads/master
| 2019-07-08T03:05:06.105708
| 2018-03-15T01:43:46
| 2018-03-15T01:43:46
| 125,157,130
| 1
| 0
| null | null | null | null |
ISO-8859-1
|
Java
| false
| false
| 908
|
java
|
package util;
public class GerarSenha {
public static String gerarSenha(){
String senha = "";
for (int i = 0; i < 8; i++)
senha += gerarCaracter(i);
return senha;
}
public static char gerarCaracter(int i){
char caracter = 0;
switch (i % 4){
case 0:
// Intervalo de Letras Maiúsculas na Tabela ASCII
caracter = gerarAleatorio(65,90);
break;
case 1:
// Intervalo de Letras Minúsculas na Tabela ASCII
caracter = gerarAleatorio(97,122);
break;
case 2:
// Intervalo de Números na Tabela ASCII
caracter = gerarAleatorio(48,57);
break;
case 3:
// Intervalo de Números na Tabela ASCII
caracter = gerarAleatorio(33,47);
break;
}
return caracter;
}
public static char gerarAleatorio(int inicio, int fim){
return (char) (Math.random() * (fim - inicio + 1) + inicio);
}
}
|
[
"jotape@protonmail.com"
] |
jotape@protonmail.com
|
c59ac09db61b8401e91278dbdbe80b82e4464c2a
|
adde5cfd55b6afd2e41bba24b864aebe5e739e79
|
/Test/TestFileReader.java
|
3ab965b62f5624c5e07c207da86b219c93c20a83
|
[] |
no_license
|
zhouhaoyang1997/Java_learn
|
7c146055645baf464f00303131caf02d7ee1dd1f
|
fea6aa7be7a2553110fbb4a05e51418295bab840
|
refs/heads/master
| 2021-01-17T16:48:01.104987
| 2017-01-30T08:14:02
| 2017-01-30T08:14:02
| 64,391,165
| 0
| 0
| null | null | null | null |
GB18030
|
Java
| false
| false
| 676
|
java
|
package Test;
import java.io.*;
public class TestFileReader {
public static void main(String[] args){
FileReader fp = null;
FileWriter fp1 = null;
int b =0;
try{
fp = new FileReader("C:\\Users\\38410\\Desktop\\list.txt");
fp1 = new FileWriter("C:\\Users\\38410\\Desktop\\list_copy.txt");
while((b=fp.read())!=-1){
fp1.write(b);
//System.out.println((char)b);
}
fp1.write("我怎么这么聪明!");
fp.close();
fp1.close();
}catch(FileNotFoundException e){
System.out.println("文件找找不到!");
}catch(IOException e1){
System.out.println("文件读取错误!");
}
System.out.println("文件复制完成!");
}
}
|
[
"zhouhaoyang1997@iCloud.com"
] |
zhouhaoyang1997@iCloud.com
|
a800f80345c5d8d1929494d3f8e8ce2fcd8eb91e
|
3aa88e1aebf61523f7f2f3a4ba93a497b2e23aa2
|
/wooso_baboo/src/wooso_baboo/AccountTest.java
|
29d3f52d9a4a89e011a3f99c01635cc36896e60a
|
[] |
no_license
|
woosoyeon97/Account
|
0ce9864b9a6d594f414b5121cc01cd06373bd0d6
|
c63d3951ce28da0effee7044b135365f7499cdc3
|
refs/heads/master
| 2021-01-22T22:28:10.993993
| 2017-04-09T12:27:52
| 2017-04-09T12:27:52
| 85,546,207
| 0
| 0
| null | null | null | null |
UHC
|
Java
| false
| false
| 2,443
|
java
|
package wooso_baboo;
import java.util.Scanner;
public class AccountTest {
public static void main(String[] args){
Account account1=new checkingAccount(100,50,0.01,0.07);
Account account2=new SavingAccount(100,0.05);
Scanner input=new Scanner(System.in);
double amount;
System.out.printf("Account1 balance:$ %.2f\t현재출금가능금액: %.2f\n",account1.getAccount(),account1.getwithdrawableAccount());//account1의 입금을 받음
System.out.println("Enter withdrawal amount for Account1: ");
amount=input.nextDouble();
account1.debit(amount);
System.out.printf("Account1 balance:$ %.2f\t현재출금가능금액: %.2f\n",account1.getAccount(),account1.getwithdrawableAccount());
if(((checkingAccount)account1).isBankrupted()==false){
System.out.println("account1 went Bankrupt!");
}
account1.passTime(1);
System.out.printf("Account1 balance:$ %.2f\t현재출금가능금액: %.2f\n",account1.getAccount(),account1.getwithdrawableAccount());
if(((checkingAccount)account1).isBankrupted()==false){
System.out.println("account1 went Bankrupt!");
}
account1.passTime(5);
System.out.printf("Account1 balance:$ %.2f\t현재출금가능금액: %.2f\n",account1.getAccount(),account1.getwithdrawableAccount());
if(((checkingAccount)account1).isBankrupted()==false){
System.out.println("account1 went Bankrupt!");
}
//SavingAccount
System.out.println();;
System.out.printf("Account2 balance:$ %.2f\t현재출금가능금액: %.2f\n",account2.getAccount(),account2.getwithdrawableAccount());
System.out.println("6 Month later");
account2.passTime(6);
System.out.printf("Account2 balance:$ %.2f\t현재출금가능금액: %.2f\n",account2.getAccount(),account2.getwithdrawableAccount());
account2.debit(50);
System.out.println("next 6 Month later");
account2.passTime(6);
System.out.printf("Account2 balance:$ %.2f\t현재출금가능금액: %.2f\n",account2.getAccount(),account2.getwithdrawableAccount());
System.out.println("next 1 Month later!");
account2.passTime(1);
System.out.printf("Account2 balance:$ %.2f\t현재출금가능금액: %.2f\n",account2.getAccount(),account2.getwithdrawableAccount());
account2.debit(50);
System.out.printf("Account2 balance:$ %.2f\t현재출금가능금액: %.2f\n",account2.getAccount(),account2.getwithdrawableAccount());
}
}
|
[
"KAU@KAU-PC"
] |
KAU@KAU-PC
|
f0d7a3052cc2e4f5a236baef95178c1c7be9235e
|
91134a0df1460e9700259f87544267c514d911ef
|
/week2/Rectangle.java
|
35e96420fc988474d1bc1c542916157e164e93ba
|
[] |
no_license
|
KristinaJelyazkova/OOP-with-Java
|
a5307e4c5170272e22332416fbc2f64d7e63c821
|
f73f2fc7a29420cd963c61714402c3fd1b86bc3e
|
refs/heads/master
| 2020-03-31T14:50:45.028458
| 2019-01-02T10:34:11
| 2019-01-02T10:34:11
| 152,311,650
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,168
|
java
|
public class Rectangle {
private double width = 1;
private double height = 1;
private String color = "yellow";
public Rectangle() {
}
public Rectangle(double width, double height) {
setWidth(width);
setHeight(height);
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
if(width > 0 ) {
this.width = width;
}
else{
this.width = 1;
}
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
if(height > 0){
this.height = height;
}
else{
this.height = 1;
}
}
public String getColor() {
return color;
}
public void setColor(String color) {
if(color != null){
this.color = color;
}
else{
this.color = color;
}
}
public double getArea() {
return width * height;
}
public double getPerimeter() {
return 2 * (width + height);
}
}
|
[
"noreply@github.com"
] |
KristinaJelyazkova.noreply@github.com
|
85b0c53cc309a56398c6231b91a64891b83aee4b
|
f428e26a1dbbfd2b6ce3f2c94142d41832ccc28a
|
/src/main/java/com/cassandra/SendMail.java
|
b27335ca2675974f1fbc726ecccb79351157506b
|
[] |
no_license
|
eprtvea/Tests
|
92ac37b5345a1c7a6de718fcc68a0408733771f2
|
330f61b3fef01c350f4f6682748695f4e8c70454
|
refs/heads/master
| 2023-01-22T11:32:35.893594
| 2016-08-15T15:25:30
| 2016-08-15T15:25:30
| 65,741,089
| 0
| 0
| null | 2023-01-02T21:52:49
| 2016-08-15T15:03:55
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 1,424
|
java
|
package com.cassandra;
import java.io.Serializable;
import java.util.Map;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class SendMail implements Serializable{
public static void main(String[] args) {
final String username = "vprashant341@gmail.com";
final String password = "Pra@1989";
String messageBody = "";
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("srk@srk.com"));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("prashantverma@qainfotech.com"));
message.setSubject("Tredning people in automation world");
Transport.send(message);
System.out.println("Done");
} catch (MessagingException e) {
throw new RuntimeException(e);
}
}
}
|
[
"prashantverma@qainfotech.com"
] |
prashantverma@qainfotech.com
|
7c4cf4bfa81d24c40de46d8056da85d4760873a3
|
b760410f0314d7089ed9d00b66546c2db8a28cc8
|
/app/src/main/java/br/com/re98/autoescolamais/MainActivity.java
|
675ec6924cbe0b84e71f5202b9e6897db4fbc9d1
|
[] |
no_license
|
isaacslima/autoescola
|
634220bbfd4363a930459f8684b5ca1ea03ad66b
|
a0f4fa09a6fd1c54d329eeba9202a6074b3873da
|
refs/heads/master
| 2021-05-11T06:57:35.962094
| 2018-01-19T13:51:28
| 2018-01-19T13:51:28
| 118,004,064
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,718
|
java
|
package br.com.re98.autoescolamais;
import android.app.AlertDialog;
import android.app.FragmentManager;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.List;
import br.com.re98.autoescolamais.dao.LoginDAO;
import br.com.re98.autoescolamais.modelo.Login;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
private FragmentManager fragmentManager;
private AlertDialog alerta;
ListView listPerfil;
List<String> perfil;
ArrayAdapter<String> adaptador;
Login login;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//recuperando dados do login
Intent intent = getIntent();
login = (Login) intent.getSerializableExtra("login");
LoginDAO dao = new LoginDAO(this);
dao.salvaLogin(login);
dao.close();
fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new PerfilFragment()).commit();
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
this.moveTaskToBack(true);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
fragmentManager = getFragmentManager();
if (id == R.id.nav_perfil) {
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new PerfilFragment()).commit();
} else if (id == R.id.nav_financeiro) {
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new FinanceiroFragment()).commit();
} else if (id == R.id.nav_aulas) {
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new AulasFragment()).commit();
} else if (id == R.id.nav_exames) {
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new ExameFragment()).commit();
}else if (id == R.id.nav_aulas) {
fragmentManager.beginTransaction()
.replace(R.id.content_frame, new FaleconoscoFragment()).commit();
}
else if (id == R.id.nav_sair) {
confirmacaoSaida();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
private void confirmacaoSaida() {
LayoutInflater li = getLayoutInflater();
View view = li.inflate(R.layout.alerta, null);
//inflamos o layout alerta.xml na view
//definimos para o botão do layout um clickListener
view.findViewById(R.id.alerta_sair).setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
//exibe um Toast informativo.
LoginDAO dao = new LoginDAO(MainActivity.this);
login = dao.buscaLogin();
dao.apagaLogin(login);
dao.close();
finish();
}
});
view.findViewById(R.id.alerta_cancelar).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//desfaz o alerta.
alerta.dismiss();
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Deseja realmente sair?");
builder.setView(view);
alerta = builder.create();
alerta.show();
}
}
|
[
"isaacslima@yahoo.com.br"
] |
isaacslima@yahoo.com.br
|
11c4f184e374e3492729760dfda95c6cf654ab79
|
5cfaeebdc7c50ca23ee368fa372d48ed1452dfeb
|
/xd_2b_dashboard_report/src/main/java/com/xiaodou/st/dashboard/domain/alarm/AlarmRecordDTO.java
|
056275e5fb51cb64b763f8b60ff34c66990f8e61
|
[] |
no_license
|
zdhuangelephant/xd_pro
|
c8c8ff6dfcfb55aead733884909527389e2c8283
|
5611b036968edfff0b0b4f04f0c36968333b2c3b
|
refs/heads/master
| 2022-12-23T16:57:28.306580
| 2019-12-05T06:05:43
| 2019-12-05T06:05:43
| 226,020,526
| 0
| 2
| null | 2022-12-16T02:23:20
| 2019-12-05T05:06:27
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 528
|
java
|
package com.xiaodou.st.dashboard.domain.alarm;
import com.xiaodou.st.dashboard.constants.enums.AlarmLevelEnum;
import com.xiaodou.st.dashboard.constants.enums.AlarmTypeEnum;
import lombok.Data;
@Data
public class AlarmRecordDTO {
/* alarmLevel 报警级别 初级,中级,高级 */
private AlarmLevelEnum alarmLevel;
/* alarmTime 报警时间 */
private String alarmTime;
/* alarmType 报警类型 */
private AlarmTypeEnum alarmType;
private Integer pageNo;
private Integer pageSize;
}
|
[
"zedong.huang@bitmain.com"
] |
zedong.huang@bitmain.com
|
48334f41fd9114d9c905e06b53fc86e79cebca5e
|
f1aeb5df96cfe8b49d722e3c6360388cfeac4f8a
|
/src/View/ChuyenBan.java
|
6707f59aeabaa7913063507913c0df643eca21f3
|
[] |
no_license
|
MoFG/Coffee
|
8151ba48e65a64a5c3100c24a90e4f8d3cfb5bc9
|
a5fba235d320dd0206b4adfec2ae53887870cf33
|
refs/heads/master
| 2021-04-25T04:50:02.938175
| 2017-12-19T02:43:56
| 2017-12-19T02:43:56
| 114,710,317
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 11,661
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package View;
import Controller.ControllerSanPham;
import Model.ModelSanPham;
import static View.Banhang.BH;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
/**
*
* @author Computer
*/
public class ChuyenBan extends javax.swing.JFrame {
DefaultComboBoxModel modellist;
String mabancu = "", mabanmoi = "", masp = "", tensp = "";
int soluong = 0;
/**
* Creates new form ChuyenBan
*/
public ChuyenBan() {
setLocationRelativeTo(null);
initComponents();
setTitle("CHUYỂN BÀN");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
lbmabancu = new javax.swing.JLabel();
btnchuyen = new javax.swing.JButton();
cblist = new javax.swing.JComboBox<>();
jLabel4 = new javax.swing.JLabel();
btndongcb = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("BẠN MUỐN CHUYỂN BÀN?");
jLabel2.setText("Bàn hiện tại:");
lbmabancu.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
lbmabancu.setForeground(new java.awt.Color(204, 0, 51));
btnchuyen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/horizontal.png"))); // NOI18N
btnchuyen.setText("Chuyển bàn");
btnchuyen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnchuyenActionPerformed(evt);
}
});
cblist.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Chọn bàn..." }));
cblist.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
cblistAncestorAdded(evt);
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
});
cblist.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cblistActionPerformed(evt);
}
});
btndongcb.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/cancel.png"))); // NOI18N
btndongcb.setText("Đóng");
btndongcb.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btndongcbActionPerformed(evt);
}
});
jLabel3.setText("Chuyển sang bàn:");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 4, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addComponent(btnchuyen)
.addGap(18, 18, 18)
.addComponent(btndongcb, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cblist, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lbmabancu, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 11, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lbmabancu, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 22, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cblist, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnchuyen, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btndongcb))
.addContainerGap(31, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void cblistAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_cblistAncestorAdded
ModelSanPham sp = new ModelSanPham();
List<ModelSanPham> ds = sp.getdsBan();
modellist = new DefaultComboBoxModel<>();
for (int i = 0; i < ds.size(); i++) {
modellist.addElement(ds.get(i).getMaban());
}
cblist.setModel(modellist);
}//GEN-LAST:event_cblistAncestorAdded
private void btnchuyenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnchuyenActionPerformed
ControllerSanPham csanpham = new ControllerSanPham();
mabancu = lbmabancu.getText();
mabanmoi = modellist.getSelectedItem().toString();
ModelSanPham sp = new ModelSanPham();
ModelSanPham ds = sp.laymagoi(mabancu, masp);
int magoi = ds.getMagoi();
boolean result = csanpham.chuyenban(masp, mabancu, mabanmoi, magoi);
// JOptionPane.showMessageDialog(null, mabancu + mabanmoi + soluong + masp);
if (result) {
JOptionPane.showMessageDialog(null, "Chuyển bàn thành công!");
// Refresh Panel
Banhang bh=new Banhang();
BH.panelban.removeAll();
BH.loadiconBan();
BH.panelban.repaint();
BH.panelban.revalidate();
dispose();
//-------------
}
}//GEN-LAST:event_btnchuyenActionPerformed
private void btndongcbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btndongcbActionPerformed
dispose();
}//GEN-LAST:event_btndongcbActionPerformed
private void cblistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cblistActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cblistActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ChuyenBan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ChuyenBan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ChuyenBan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ChuyenBan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ChuyenBan().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnchuyen;
private javax.swing.JButton btndongcb;
private javax.swing.JComboBox<String> cblist;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
public javax.swing.JLabel lbmabancu;
// End of variables declaration//GEN-END:variables
}
|
[
"skynguyen79@gmail.com"
] |
skynguyen79@gmail.com
|
a0dc622b0af04d9dca8b9d6d89ad02c110212c36
|
79b487d8115924b186c2394877afc0240d4e21cd
|
/src/main/java/com/senacor/oo/wheatherstation/WeatherStationResourceBuilder.java
|
7012eee4dd6e04cd8cf59d997cb0e02898f73d35
|
[] |
no_license
|
kompacher/weatherstation
|
1d778553be1f7d80acffeb4922a124c73bbb8989
|
fc8840600607db33552fff74d2ff32224103f91e
|
refs/heads/master
| 2023-07-19T16:11:41.334051
| 2023-07-17T16:53:49
| 2023-07-17T16:53:49
| 27,556,188
| 0
| 0
| null | 2023-07-17T16:53:51
| 2014-12-04T19:25:35
|
Java
|
UTF-8
|
Java
| false
| false
| 2,766
|
java
|
package com.senacor.oo.wheatherstation;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import java.util.Collection;
import com.senacor.oo.wheatherstation.product.Weatherstation;
import com.senacor.oo.wheatherstation.product.WeatherstationGold;
import com.senacor.oo.wheatherstation.product.WeatherstationWhite;
import com.senacor.oo.wheatherstation.rest.StationType;
import com.senacor.oo.wheatherstation.rest.WeatherstationController;
import com.senacor.oo.wheatherstation.sensor.Sensor;
import org.springframework.stereotype.Component;
/**
* @author Georg Kompacher, Senacor Technologies AG
*/
@Component
public class WeatherStationResourceBuilder {
public WeatherstationWhite getWeatherstationWhite() {
WeatherstationWhite weatherstationWhite = new WeatherstationWhite();
weatherstationWhite.add(linkTo(methodOn(WeatherstationController.class).getWhite()).withSelfRel());
Collection<String> sensorTypes = weatherstationWhite.getSensorTypes();
for (String sensorType : sensorTypes) {
weatherstationWhite.add(linkTo(methodOn(WeatherstationController.class).getSensor(StationType.WHITE.toStringValue(), sensorType)).withRel(sensorType));
}
return weatherstationWhite;
}
public WeatherstationGold getWeatherstationGold() {
WeatherstationGold weatherstationGold = new WeatherstationGold();
weatherstationGold.add(linkTo(methodOn(WeatherstationController.class).getGold()).withSelfRel());
Collection<String> sensorTypes = weatherstationGold.getSensorTypes();
for (String sensorType : sensorTypes) {
weatherstationGold.add(linkTo(methodOn(WeatherstationController.class).getSensor(StationType.GOLD.toStringValue(), sensorType)).withRel(sensorType));
}
return weatherstationGold;
}
public Sensor getSensor(StationType stationType, String sensorType) {
Weatherstation weatherstation = getWeatherstation(stationType);
if (!weatherstation.hasSensorOfType(sensorType)) {
return null;
}
Sensor sensor = weatherstation.getSensor(sensorType);
sensor.add(linkTo(methodOn(WeatherstationController.class).getSensor(stationType.toStringValue(), sensorType)).withSelfRel());
return sensor;
}
private Weatherstation getWeatherstation(StationType type) {
switch (type) {
case GOLD:
return new WeatherstationGold();
case WHITE:
return new WeatherstationWhite();
default:
throw new IllegalArgumentException(String.format("Type %s not valid.", type));
}
}
}
|
[
"gkompacher@hotmail.com"
] |
gkompacher@hotmail.com
|
e91a2fadf0a1b8cffb51cd6bb32bb23f17713ce0
|
6f6fd51a6f298242318f0538787b6416916e7722
|
/JDK7-45/src/main/java/com/hmz/source/org/omg/DynamicAny/DynSequenceOperations.java
|
f04e28f330eecbade696b7092510cda6b402cff4
|
[] |
no_license
|
houmaozheng/JDKSourceProject
|
5f20578c46ad0758a1e2f45d36380db0bcd46f05
|
699b4cce980371be0d038a06ce3ea617dacd612c
|
refs/heads/master
| 2023-06-16T21:48:46.957538
| 2021-07-15T17:01:46
| 2021-07-15T17:01:46
| 385,537,090
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,784
|
java
|
package org.omg.DynamicAny;
/**
* org/omg/DynamicAny/DynSequenceOperations.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from ../../../../src/share/classes/org/omg/DynamicAny/DynamicAny.idl
* Tuesday, October 8, 2013 5:44:46 AM PDT
*/
/**
* DynSequence objects support the manipulation of IDL sequences.
*/
public interface DynSequenceOperations extends org.omg.DynamicAny.DynAnyOperations
{
/**
* Returns the current length of the sequence.
*/
int get_length ();
/**
* Sets the length of the sequence.
* Increasing the length of a sequence adds new elements at the tail without affecting the values
* of already existing elements. Newly added elements are default-initialized.
* Increasing the length of a sequence sets the current position to the first newly-added element
* if the previous current position was -1. Otherwise, if the previous current position was not -1,
* the current position is not affected.
* Decreasing the length of a sequence removes elements from the tail without affecting the value
* of those elements that remain. The new current position after decreasing the length of a sequence
* is determined as follows:
* <UL>
* <LI>If the length of the sequence is set to zero, the current position is set to -1.
* <LI>If the current position is -1 before decreasing the length, it remains at -1.
* <LI>If the current position indicates a valid element and that element is not removed when the length
* is decreased, the current position remains unaffected.
* <LI>If the current position indicates a valid element and that element is removed,
* the current position is set to -1.
* </UL>
*
* @exception InvalidValue if this is a bounded sequence and len is larger than the bound
*/
void set_length (int len) throws org.omg.DynamicAny.DynAnyPackage.InvalidValue;
/**
* Returns the elements of the sequence.
*/
org.omg.CORBA.Any[] get_elements ();
/**
* Sets the elements of a sequence.
* The length of the DynSequence is set to the length of value. The current position is set to zero
* if value has non-zero length and to -1 if value is a zero-length sequence.
*
* @exception TypeMismatch if value contains one or more elements whose TypeCode is not equivalent
* to the element TypeCode of the DynSequence
* @exception InvalidValue if the length of value exceeds the bound of a bounded sequence
*/
void set_elements (org.omg.CORBA.Any[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue;
/**
* Returns the DynAnys representing the elements of the sequence.
*/
org.omg.DynamicAny.DynAny[] get_elements_as_dyn_any ();
/**
* Sets the elements of a sequence using DynAnys.
* The length of the DynSequence is set to the length of value. The current position is set to zero
* if value has non-zero length and to -1 if value is a zero-length sequence.
*
* @exception TypeMismatch if value contains one or more elements whose TypeCode is not equivalent
* to the element TypeCode of the DynSequence
* @exception InvalidValue if the length of value exceeds the bound of a bounded sequence
*/
void set_elements_as_dyn_any (org.omg.DynamicAny.DynAny[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue;
} // interface DynSequenceOperations
|
[
"houmaozheng@126.com"
] |
houmaozheng@126.com
|
c3d12b3e1d13ced0944234650de3130e0615585d
|
b6b5998fb1496d0261ec5f245399d73fb65ee6fb
|
/bomManager/src/com/manager/common/tools/BigDecimalUtil.java
|
d80cb7c68515586954fb966d488951ac16562477
|
[
"MIT"
] |
permissive
|
kimtae/bomManager
|
cf074a1105a2d7fcf3dbb82ba24d193da68136dc
|
aef371ef33fe1cccaf5c1f78945e9953e2b29f72
|
refs/heads/master
| 2023-06-08T16:05:54.032371
| 2020-07-16T05:50:38
| 2020-07-16T05:50:38
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,852
|
java
|
/*
* 文件名:BigDecimal.java
* 版权:Copyright 2012-2016 YLINK Tech. Co. Ltd. All Rights Reserved.
* 描述: BigDecimal.java
* 修改人:liyuelong 1610139
* 修改时间:2017年3月20日
* 修改内容:新增
*/
package com.manager.common.tools;
import java.math.BigDecimal;
import java.text.DecimalFormat;
/**
* TODO添加类描述
* @author liyuelong 1610139
* @version CCAS 2017年3月20日
* @since CCAS
*/
public class BigDecimalUtil
{
public static String format(BigDecimal amount)
{
DecimalFormat df = new DecimalFormat("#,##0.00#");
return df.format(amount.setScale(2, BigDecimal.ROUND_HALF_UP));
}
/**
* 将bigDecimal对象的精度设定为两位小数
* @return String类型
*/
public static String formatDecmical(BigDecimal amount)
{
DecimalFormat df = new DecimalFormat("#0.00");
return df.format(amount);
}
/**
* 将bigDecimal对象的精度设定为两位小数
* @return BigDecimal类型
*/
public static BigDecimal Decimalformat(BigDecimal amount)
{
BigDecimal bigDecimal = new BigDecimal(formatDecmical(amount));
return bigDecimal;
}
/**
* @param arg1 被减数
* @param arg2 减数
* @return 保留两位小数的结果
*/
public static String subtract(Object arg1, Object arg2)
{
BigDecimal minumend = StringUtil.toBigDecimal(arg1);
BigDecimal subtrahend = StringUtil.toBigDecimal(arg2);
BigDecimal result = minumend.subtract(subtrahend);
return formatDecmical(result);
}
public static void main(String[] args)
{
BigDecimal a = new BigDecimal(-120.457);
System.out.println(formatDecmical(a));
}
}
|
[
"1352095235@qq.com"
] |
1352095235@qq.com
|
8ad8b9a8a1e35bc517e2ca66f8ae46229e84c61a
|
c28a6f2c8ce8f986b5c22fd602e7349e68af8f9c
|
/android/vendor/realtek/apps/RealtekGallery2/src/com/android/gallery3d/glrenderer/UploadedTexture.java
|
7f1d4fd3de9cfe0f61422a82d4e32002d6f265f7
|
[] |
no_license
|
BPI-SINOVOIP/BPI-1296-Android6
|
d6ade74367696c644a1b053b308d164ba53d3f8c
|
1ba45ab7555440dc3721d6acda3e831e7a3e3ff3
|
refs/heads/master
| 2023-02-24T18:23:02.110515
| 2019-08-09T04:01:16
| 2019-08-09T04:01:16
| 166,341,197
| 0
| 5
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 9,350
|
java
|
/*
* Copyright (C) 2010 The Android Open Source 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 com.android.gallery3d.glrenderer;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.opengl.GLUtils;
import junit.framework.Assert;
import java.util.HashMap;
import javax.microedition.khronos.opengles.GL11;
// UploadedTextures use a Bitmap for the content of the texture.
//
// Subclasses should implement onGetBitmap() to provide the Bitmap and
// implement onFreeBitmap(mBitmap) which will be called when the Bitmap
// is not needed anymore.
//
// isContentValid() is meaningful only when the isLoaded() returns true.
// It means whether the content needs to be updated.
//
// The user of this class should call recycle() when the texture is not
// needed anymore.
//
// By default an UploadedTexture is opaque (so it can be drawn faster without
// blending). The user or subclass can override it using setOpaque().
public abstract class UploadedTexture extends BasicTexture {
// To prevent keeping allocation the borders, we store those used borders here.
// Since the length will be power of two, it won't use too much memory.
private static HashMap<BorderKey, Bitmap> sBorderLines =
new HashMap<BorderKey, Bitmap>();
private static BorderKey sBorderKey = new BorderKey();
@SuppressWarnings("unused")
private static final String TAG = "Texture";
private boolean mContentValid = true;
// indicate this textures is being uploaded in background
private boolean mIsUploading = false;
private boolean mOpaque = true;
private boolean mThrottled = false;
private static int sUploadedCount;
private static final int UPLOAD_LIMIT = 100;
protected Bitmap mBitmap;
private int mBorder;
protected UploadedTexture() {
this(false);
}
protected UploadedTexture(boolean hasBorder) {
super(null, 0, STATE_UNLOADED);
if (hasBorder) {
setBorder(true);
mBorder = 1;
}
}
protected void setIsUploading(boolean uploading) {
mIsUploading = uploading;
}
public boolean isUploading() {
return mIsUploading;
}
private static class BorderKey implements Cloneable {
public boolean vertical;
public Config config;
public int length;
@Override
public int hashCode() {
int x = config.hashCode() ^ length;
return vertical ? x : -x;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof BorderKey)) return false;
BorderKey o = (BorderKey) object;
return vertical == o.vertical
&& config == o.config && length == o.length;
}
@Override
public BorderKey clone() {
try {
return (BorderKey) super.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError(e);
}
}
}
protected void setThrottled(boolean throttled) {
mThrottled = throttled;
}
private static Bitmap getBorderLine(
boolean vertical, Config config, int length) {
BorderKey key = sBorderKey;
key.vertical = vertical;
key.config = config;
key.length = length;
Bitmap bitmap = sBorderLines.get(key);
if (bitmap == null) {
bitmap = vertical
? Bitmap.createBitmap(1, length, config)
: Bitmap.createBitmap(length, 1, config);
sBorderLines.put(key.clone(), bitmap);
}
return bitmap;
}
private Bitmap getBitmap() {
if (mBitmap == null) {
mBitmap = onGetBitmap();
if(mBitmap == null)
return null;
int w = mBitmap.getWidth() + mBorder * 2;
int h = mBitmap.getHeight() + mBorder * 2;
if (mWidth == UNSPECIFIED) {
setSize(w, h);
}
}
return mBitmap;
}
private void freeBitmap() {
// Assert.assertTrue(mBitmap != null);
if(mBitmap != null)
onFreeBitmap(mBitmap);
mBitmap = null;
}
@Override
public int getWidth() {
if (mWidth == UNSPECIFIED) getBitmap();
return mWidth;
}
@Override
public int getHeight() {
if (mWidth == UNSPECIFIED) getBitmap();
return mHeight;
}
protected abstract Bitmap onGetBitmap();
protected abstract void onFreeBitmap(Bitmap bitmap);
protected void invalidateContent() {
if (mBitmap != null) freeBitmap();
mContentValid = false;
mWidth = UNSPECIFIED;
mHeight = UNSPECIFIED;
}
/**
* Whether the content on GPU is valid.
*/
public boolean isContentValid() {
return isLoaded() && mContentValid;
}
/**
* Updates the content on GPU's memory.
* @param canvas
*/
public void updateContent(GLCanvas canvas) {
if (!isLoaded()) {
if (mThrottled && ++sUploadedCount > UPLOAD_LIMIT) {
return;
}
uploadToCanvas(canvas);
} else if (!mContentValid) {
Bitmap bitmap = getBitmap();
int format = GLUtils.getInternalFormat(bitmap);
int type = GLUtils.getType(bitmap);
canvas.texSubImage2D(this, mBorder, mBorder, bitmap, format, type);
freeBitmap();
mContentValid = true;
}
}
public static void resetUploadLimit() {
sUploadedCount = 0;
}
public static boolean uploadLimitReached() {
return sUploadedCount > UPLOAD_LIMIT;
}
private void uploadToCanvas(GLCanvas canvas) {
Bitmap bitmap = getBitmap();
if (bitmap != null) {
try {
int bWidth = bitmap.getWidth();
int bHeight = bitmap.getHeight();
int width = bWidth + mBorder * 2;
int height = bHeight + mBorder * 2;
int texWidth = getTextureWidth();
int texHeight = getTextureHeight();
Assert.assertTrue(bWidth <= texWidth && bHeight <= texHeight);
// Upload the bitmap to a new texture.
mId = canvas.getGLId().generateTexture();
canvas.setTextureParameters(this);
if (bWidth == texWidth && bHeight == texHeight) {
canvas.initializeTexture(this, bitmap);
} else {
int format = GLUtils.getInternalFormat(bitmap);
int type = GLUtils.getType(bitmap);
Config config = bitmap.getConfig();
canvas.initializeTextureSize(this, format, type);
canvas.texSubImage2D(this, mBorder, mBorder, bitmap, format, type);
if (mBorder > 0) {
// Left border
Bitmap line = getBorderLine(true, config, texHeight);
canvas.texSubImage2D(this, 0, 0, line, format, type);
// Top border
line = getBorderLine(false, config, texWidth);
canvas.texSubImage2D(this, 0, 0, line, format, type);
}
// Right border
if (mBorder + bWidth < texWidth) {
Bitmap line = getBorderLine(true, config, texHeight);
canvas.texSubImage2D(this, mBorder + bWidth, 0, line, format, type);
}
// Bottom border
if (mBorder + bHeight < texHeight) {
Bitmap line = getBorderLine(false, config, texWidth);
canvas.texSubImage2D(this, 0, mBorder + bHeight, line, format, type);
}
}
} finally {
freeBitmap();
}
// Update texture state.
setAssociatedCanvas(canvas);
mState = STATE_LOADED;
mContentValid = true;
} else {
mState = STATE_ERROR;
throw new RuntimeException("Texture load fail, no bitmap");
}
}
@Override
protected boolean onBind(GLCanvas canvas) {
updateContent(canvas);
return isContentValid();
}
@Override
protected int getTarget() {
return GL11.GL_TEXTURE_2D;
}
public void setOpaque(boolean isOpaque) {
mOpaque = isOpaque;
}
@Override
public boolean isOpaque() {
return mOpaque;
}
@Override
public void recycle() {
super.recycle();
if (mBitmap != null) freeBitmap();
}
}
|
[
"Justin"
] |
Justin
|
f3984efdfbb0dd8f70cca761104bf7597b7c3d30
|
d6089f3b7fd427b60f8a1f1c9e6bf6549c0bb84f
|
/IN5BV_Control_Acedemico_GrupoNo1/src/main/java/com/grupono1/models/domain/Asignacion_Alumno.java
|
ca96f1eb139aae7c90f589644fca22292153685c
|
[] |
no_license
|
fpascual2020343/Control_Academico_IN5BV_GrupoNo1
|
e2d7de14f75ff7c89c71a6a4d2e296c6a9abc326
|
f7dc3ccd8161cd5a4ac53dd77560d0cce4c01984
|
refs/heads/master
| 2023-07-25T18:04:25.010378
| 2021-09-04T04:02:25
| 2021-09-04T04:02:25
| 401,559,561
| 0
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,209
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.grupono1.models.domain;
import java.sql.Timestamp;
/**
*
* @author Franshesco Emmanuel Pascual Ramires
* @time 07:27:17 PM
* @date 30/08/2021
* Codigo Tecnico: IN5BV
* Carne: 2020343
* Jornada: Vespertina
*/
public class Asignacion_Alumno {
private String asignacion_id;
private String carne_alumno;
private int id_curso;
private Timestamp fecha_asignacion;
public Asignacion_Alumno() {
}
public Asignacion_Alumno(String asignacion_id) {
this.asignacion_id = asignacion_id;
}
public Asignacion_Alumno(String asignacion_id, String carne_alumno, int id_curso, Timestamp fecha_asignacion) {
this.asignacion_id = asignacion_id;
this.carne_alumno = carne_alumno;
this.id_curso = id_curso;
this.fecha_asignacion = fecha_asignacion;
}
public Asignacion_Alumno(String carne_alumno, int id_curso, Timestamp fecha_asignacion) {
this.carne_alumno = carne_alumno;
this.id_curso = id_curso;
this.fecha_asignacion = fecha_asignacion;
}
public String getAsignacion_id() {
return asignacion_id;
}
public void setAsignacion_id(String asignacion_id) {
this.asignacion_id = asignacion_id;
}
public String getCarne_alumno() {
return carne_alumno;
}
public void setCarne_alumno(String carne_alumno) {
this.carne_alumno = carne_alumno;
}
public int getId_curso() {
return id_curso;
}
public void setId_curso(int id_curso) {
this.id_curso = id_curso;
}
public Timestamp getFecha_asignacion() {
return fecha_asignacion;
}
public void setFecha_asignacion(Timestamp fecha_asignacion) {
this.fecha_asignacion = fecha_asignacion;
}
@Override
public String toString() {
return "Asignacion_Alumno{" + "asignacion_id=" + asignacion_id + ", carne_alumno=" + carne_alumno + ", id_curso=" + id_curso + ", fecha_asignacion=" + fecha_asignacion + '}';
}
}
|
[
"fpascual-2020343@kinal.edu.gt"
] |
fpascual-2020343@kinal.edu.gt
|
b81cf1155deb063a1a4057187acc250827494eab
|
55cf7e6960239e2bfcac6f13875f0fdfed4cedca
|
/SpringWithER/src/main/java/com/mphasis/training/daos/JobDao.java
|
05f29a7aea39bb72d14c1ebf01a80006ee0c661c
|
[] |
no_license
|
Shwetha31Anil/171demos
|
8f3c841fcf6253a606e6d93ba519d698bc261879
|
325dcb1283a2fa996dc722a3e9bb0041412fed0a
|
refs/heads/master
| 2022-12-22T22:01:35.294704
| 2019-10-23T05:34:04
| 2019-10-23T05:34:04
| 211,767,492
| 0
| 0
| null | 2022-12-16T08:03:07
| 2019-09-30T03:26:19
|
Rich Text Format
|
UTF-8
|
Java
| false
| false
| 297
|
java
|
package com.mphasis.training.daos;
import java.util.List;
import com.mphasis.training.entities.Job;
public interface JobDao {
public void addJob(Job d);
public void updateJob(Job d);
public void deleteJob(int did);
public Job getJobById(int did);
public List<Job> getAll();
}
|
[
"noreply@github.com"
] |
Shwetha31Anil.noreply@github.com
|
f1dc4400433831780cb61b74762a754ffba28a55
|
98c66b12e9ad69e81cc9b054963d56d04fe78b17
|
/src/main/java/oktenweb/models/User.java
|
11b4f95f5755f18a0c91fde1877d65f9dd21947a
|
[] |
no_license
|
NazarOliynyk/trysecurity4inheritance
|
356a9a201a74d09fae38d4c601959e20f6d27d9a
|
7d0e951ea37fa73cb3ce48369c290ade6f6d825e
|
refs/heads/master
| 2020-05-02T15:04:51.798383
| 2019-06-11T10:27:54
| 2019-06-11T10:27:54
| 178,030,732
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,444
|
java
|
package oktenweb.models;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@Entity(name = "Users_TrySecurity4")
@Inheritance
@DiscriminatorColumn(name = "type")
public class User implements UserDetails{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(unique = true)
private String username;
private String password;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Override
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
private boolean accountNonExpired = true;
public void setAccountNonExpired(boolean accountNonExpired) {
this.accountNonExpired = accountNonExpired;
}
@Override
public boolean isAccountNonExpired() {
return accountNonExpired;
}
private boolean accountNonLocked = true;
public void setAccountNonLocked(boolean accountNonLocked) {
this.accountNonLocked = accountNonLocked;
}
@Override
public boolean isAccountNonLocked() {
return accountNonLocked;
}
private boolean credentialsNonExpired = true;
public void setCredentialsNonExpired(boolean credentialsNonExpired) {
this.credentialsNonExpired = credentialsNonExpired;
}
@Override
public boolean isCredentialsNonExpired() {
return credentialsNonExpired;
}
private boolean enabled = true;
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@Override
public boolean isEnabled() {
return enabled;
}
@Enumerated(EnumType.STRING)
private Role role= Role.ROLE_USER;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
List<SimpleGrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority(role.name()));
return authorities;
}
}
|
[
"nazar_lw@ukr.net"
] |
nazar_lw@ukr.net
|
518c10af5ced97c37ad2965ebf59eee9ec103685
|
1aadffbe56edccccfa20f58fc7ee18fdf0dfb99a
|
/2.JavaCore/src/com/javarush/task/task20/task2025/SolutionLast.java
|
e24d31809e70fa7ae5deb6f39c8bcde635f73015
|
[] |
no_license
|
zakhariya/JavaRushTasks
|
9b42a4d9aae8b7731fc3cfa8d4f47af5a832ee5b
|
81699f3bfe40c5e1450196624310563fb461cd1f
|
refs/heads/master
| 2022-02-19T07:10:18.004552
| 2022-02-06T10:51:03
| 2022-02-06T10:51:03
| 203,832,076
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,625
|
java
|
/*
package com.javarush.task.task20.task2025;
import java.util.Date;
import java.util.Set;
import java.util.TreeSet;
*/
/*
Алгоритмы-числа
*//*
public class SolutionLast {
private static long[][] pows = new long[10][20];
private static long maxVal;
private static byte maxPow;
private static long count;
private static Set<Long> armstrongSet = new TreeSet<>();
//TODO: remove
private static long maxSum;
private static long maxV;
static {
for (int i = 0; i < pows.length; i++) {
for (int j = 0; j < pows[i].length; j++) {
pows[i][j] = (long) Math.pow(i, j);
}
}
}
public static void main(String[] args) {
long start = new Date().getTime();
long value = Long.MAX_VALUE;
long[] numbers = getNumbers(value);
long memory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
System.out.println((new Date().getTime() - start) + " millis, " + memory/1048576 + " Mb" );
System.out.println(count + " numbers checked of " + value);
System.out.println("******************");
System.out.println("Found number of armstrong - " + numbers.length);
for (long number : numbers) {
System.out.println(number);
}
System.out.println(maxSum + " - max sum");
System.out.println(maxV + " - max v");
}
public static long[] getNumbers(long N) {
// if (N < Long.MAX_VALUE) {
//
// }
maxVal = N;
maxPow = getCountsOfDigits(N);
armstrongSet.clear();
generateNums(1, (byte) 1);
long[] result = new long[armstrongSet.size()];
int i = 0;
for (long n : armstrongSet) {
result[i++] = n;
}
return result;
}
private static void generateNums(long x, byte pow) {
count++;
while (true) {
long sum = 0;
byte y;
long n = x;
while (n > 0) {
y = (byte) (n % 10);
sum += pows[y][pow];
// if (sum < 0 || sum > maxVal) {
// return;
// }
if (x == 9223000000000000000L) {
System.out.println("sdsdsdsdd");
}
// 9223372036854775807
//TODO: remove
if (sum > maxSum) {
maxSum = sum;
}
if (x > maxV) {
maxV = x;
}
n /= 10;
}
if (getCountsOfDigits(sum) == pow
&& isArmstrong(sum, pow)) {
armstrongSet.add(sum);
}
if (!isNumberUnique(x)) {
break;
} else if (x < maxVal && pow < maxPow) {
generateNums(x * 10, (byte) (pow + 1));
}
x++;
}
}
private static boolean isArmstrong(long num, byte pow) {
long sum = 0;
byte y;
long n = num;
while (n > 0) {
y = (byte) (n % 10);
sum += pows[y][pow];
n /= 10;
}
return sum == num;
}
private static boolean isNumberUnique(long number) {
long last = number % 10;
long n = number / 10;
long prev = n % 10;
return (n == 0) ? true : last <= prev;
}
public static byte getCountsOfDigits(long number) {
return (number == 0) ? 1 : (byte) Math.ceil(Math.log10(Math.abs(number) + 0.5));
}
}
*/
|
[
"alexander.zakhariya@gmail.com"
] |
alexander.zakhariya@gmail.com
|
565804114e1436640b7e240f0566d47aad5c6839
|
6374f7a525d0beee03e83e4ce611495566aa8997
|
/src/ilstu/edu/StudentReport.java
|
11938a095952a24cf08c41d2a200ce7a01f782b0
|
[] |
no_license
|
aslerch/IT179Program1
|
2b58816c37847779a8a23dd2ee8ca9ba1993a3d4
|
192193c27c425f58ae84aa1e319f3d05e3c79a58
|
refs/heads/master
| 2023-07-15T20:50:40.240375
| 2021-08-27T19:39:45
| 2021-08-27T19:39:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 10,872
|
java
|
package ilstu.edu;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Scanner;
/** A class that represents a student report */
public class StudentReport {
private final int INVALID = -1;
private final int NUM_OF_ASSIGNMENTS = 8;
/** Name of the file that we want to read */
private String fileName;
/** Grades for all of the students */
private double [][] grades;
/** Names of all the students */
private String [] students;
/** Names of all the graded items in the file(fileName) */
private String [] gradedItems;
/** true if field fileName has a file associated with it, false if field fileName is null */
public boolean isProcessed = false;
/** Default constructor */
public StudentReport() {};
/**
* Instantiates a StudentReport object and also instantiates the fields of grades, students, and gradedItems
* @param fileName The name of the file that contains the data to be used
*/
public StudentReport(String fileName) {
this.fileName = fileName;
this.grades = new double [100][8];
this.students = new String [100];
this.gradedItems = new String [8];
}
/** Methods */
/**
* Calculates the average score for class
* @return The average score for the class
*/
private double calculateAverageForClass() {
int numOfStudents = findNumOfStudents();
double average;
double totalScore = 0;
int numOfScores = 0;
for (int i = 0; i < numOfStudents; i++) {
for (int j = 0; j < grades[i].length; j++) {
totalScore += grades[i][j];
numOfScores++;
}
}
average = totalScore/(double)(numOfStudents);
return average;
}
/**
* Calculates the total score for all grades of a student
* @param name The name of the student
* @return The total score
*/
private double calculateTotalForGradesOfStudent(String name) {
double total = 0;
int indexOfStudent = findIndexOfStudent(name);
for (int i = 0; i < grades[indexOfStudent].length; i++) {
total += (int)grades[indexOfStudent][i];
}
return total;
}
/**
* Collects the grades and assignment names for a student
* @param name The name of the student
* @return A String in the format "(name of assignment): (grade)" for all assignments
*/
private String collectGradesWithAssignmentNameOfStudent(String name) {
String gradesOfStudent = "";
int indexOfStudent = findIndexOfStudent(name);
for (int i = 0; i < grades[indexOfStudent].length; i++) {
gradesOfStudent += gradedItems[i] + ": " + (int)grades[indexOfStudent][i] + "\n";
}
return gradesOfStudent;
}
/**
* Compiles information from various sources to format the info for a report card
* @param name The name of the student
* @return Formatted information for a report card
*/
private String createReportCardInfo(String name) {
String reportCardInfo = "";
int indexOfStudent = findIndexOfStudent(name);
if (indexOfStudent == INVALID)
reportCardInfo = "No data for the student could be found";
if (indexOfStudent != INVALID) {
reportCardInfo = "Name: " + name + "\n" +
collectGradesWithAssignmentNameOfStudent(name) +
"Total: " + (int)calculateTotalForGradesOfStudent(name) +
"\nGrade: " + determineLetterGradeForStudent(name);
}
return reportCardInfo;
}
/**
* Determines the letter grade that a student should earn based on their total score
* @param name The name of the student
* @return The student's letter grade
*/
private char determineLetterGradeForStudent(String name) {
char grade = ' ';
int total = (int)calculateTotalForGradesOfStudent(name);
if (total >= 90)
grade = 'A';
if (total >= 80 & total <= 89)
grade = 'B';
if (total >= 70 & total <= 79)
grade = 'C';
if (total >= 60 & total <= 69)
grade = 'D';
if (total < 69)
grade = 'F';
return grade;
}
/**
* Displays information relating to the class average, highest total score, and lowest total score.
*/
public void displayStatistics() {
DecimalFormat decimalFormat = new DecimalFormat("##.##");
String studentWithHighestTotalScore = findStudentWithHighestTotalScore();
String studentWithLowestTotalScore = findStudentWithLowestTotalScore();
String output = "Average Score of the Class: " + decimalFormat.format(calculateAverageForClass()) + "%" +
"\nStudent with the highest total score: " + studentWithHighestTotalScore + "(" + (int)calculateTotalForGradesOfStudent(studentWithHighestTotalScore) + ")" +
"\nStudent with the lowest total score: " + studentWithLowestTotalScore + "(" + (int)calculateTotalForGradesOfStudent(studentWithLowestTotalScore) + ")";
System.out.println(output);
}
/**
* fills the gradedItems array
* @param gradesFile The name of the File object that references fileName
*/
private void fillGradedItemsArray(File gradesFile) {
try {
Scanner fileReader = new Scanner(gradesFile);
String currentLine = fileReader.nextLine();
String [] gradesFileHeaders = currentLine.split(",");
for (int i = 1; i < gradesFileHeaders.length; i++) //skips the "name" header
this.gradedItems[i - 1] = gradesFileHeaders[i];
System.out.println("File successfully read");
} catch (FileNotFoundException e) {
System.out.println("ERROR: File not found");
}
}
/**
* Fills the grades array
* @param gradesFile The name of the File object that references fileName
*/
private void fillGradesArray(File gradesFile) {
try {
Scanner fileReader = new Scanner(gradesFile);
fileReader.nextLine(); //skips the header
int rowIndex = 0;
while (fileReader.hasNextLine()) {
String currentLine = fileReader.nextLine();
String [] grades = currentLine.split(",");
for (int i = 1; i < grades.length; i++) {
this.grades[rowIndex][i - 1] = Double.parseDouble(grades[i]);
}
rowIndex++;
isProcessed = true;
}
} catch (FileNotFoundException e) {
System.out.println("");
}
}
/**
* Fills the students array
* @param gradesFile The name of the File object that references fileName
*/
private void fillStudentsArray(File gradesFile) {
try {
Scanner fileReader = new Scanner(gradesFile);
fileReader.nextLine(); //skips the header
int studentsIndex = 0;
while (fileReader.hasNextLine()) {
String currentLine = fileReader.nextLine();
String [] info = currentLine.split(",");
students[studentsIndex] = info[0];
studentsIndex++;
}
} catch (FileNotFoundException e) {
System.out.println("");
}
}
/**
* Finds the student with the highest total score
* @return The student's name
*/
private String findStudentWithHighestTotalScore() {
int highestTotal = (int)calculateTotalForGradesOfStudent(students[0]);
String name = students[0];
for (int i = 0; i < students.length; i++) {
if (students[i] != null) {
if ( (int)calculateTotalForGradesOfStudent(students[i]) > highestTotal) {
highestTotal = (int)calculateTotalForGradesOfStudent(students[i]);
name = students[i];
}
}
}
return name;
}
/**
* Finds the student with the lowest total score
* @return The student's name
*/
private String findStudentWithLowestTotalScore() {
int lowestTotal = (int)calculateTotalForGradesOfStudent(students[0]);
String name = students[0];
for (int i = 0; i < students.length; i++) {
if (students[i] != null) {
if ( (int)calculateTotalForGradesOfStudent(students[i]) < lowestTotal) {
lowestTotal = (int)calculateTotalForGradesOfStudent(students[i]);
name = students[i];
}
}
}
return name;
}
/**
* Finds the index of a student in the students array
* @param name The name of the student
* @return The index of the student if the student is in the students array and -1 otherwise
*/
private int findIndexOfStudent(String name) {
int index = -1;
for (int i = 0; i < students.length; i++) {
if (students[i] != null) {
if (students[i].equalsIgnoreCase(name))
index = i;
}
}
return index;
}
/**
* Finds the number of students
* @return The number of students
*/
private int findNumOfStudents() {
int numOfStudents = 0;
for (String student : students) {
if (student != null)
numOfStudents++;
}
return numOfStudents;
}
/**
* Prints a list of the students in the students array
*/
public void printStudents() {
System.out.println("Students: ");
for (String name : students) {
if (name != null)
System.out.println(name);
}
}
/**
* Reads fileName and fills the grades, students, and gradedItems arrays
*/
public void readFile() {
File gradesFile = new File(this.fileName);
fillGradesArray(gradesFile);
fillStudentsArray(gradesFile);
fillGradedItemsArray(gradesFile);
}
/**
* Generates a report card for a specific student and saves it as "(student's name).txt"
*/
public void writeFile(String name) {
String reportCardInfo = createReportCardInfo(name);
String outputFileName = name.replace(" ", "") + ".txt";
File reportCard = new File(outputFileName);
try {
PrintWriter fileWriter = new PrintWriter(reportCard);
fileWriter.write(reportCardInfo);
fileWriter.close();
} catch (FileNotFoundException e) {
System.out.println("cannot write to the file");
}
}
}
|
[
"88261471+aslerch@users.noreply.github.com"
] |
88261471+aslerch@users.noreply.github.com
|
49b868fa0ab426b56fc3d469ab4b979ae0df0ee0
|
f8deaa58df02fdf32e3ca5ab6678ce6340d36005
|
/src/main/java/com/gem/sistema/web/bean/ConsultaFacturaPolizaMB.java
|
51d65ccf73785e42edfbcb4d6147f36040a910a1
|
[] |
no_license
|
pedro-nava/gem
|
143ca18662a345a7e9bca931ee197a76fbcac3d5
|
ae94f88004747cd5c9606f91707bca8ce0d88c25
|
refs/heads/master
| 2020-04-21T10:40:10.297216
| 2019-02-07T18:17:31
| 2019-02-07T18:17:31
| 158,597,865
| 1
| 0
| null | 2018-12-26T23:15:54
| 2018-11-21T19:40:30
|
Java
|
UTF-8
|
Java
| false
| false
| 4,306
|
java
|
package com.gem.sistema.web.bean;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.security.auth.login.AccountException;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import com.gem.sistema.business.service.reportador.ConsultaFacturaPolizasService;
import com.gem.sistema.business.repository.catalogs.PolienRepository;
import com.gem.sistema.business.repository.catalogs.ConctbRepository;
import com.gem.sistema.business.service.catalogos.CattpoService;
import com.gem.sistema.business.service.catalogos.CopomeService;
import com.gem.sistema.business.domain.Conctb;
import com.gem.sistema.business.domain.Cattpo;
import com.gem.sistema.business.domain.Copome;
import com.gem.sistema.business.domain.TcMes;
import com.gem.sistema.web.security.model.GemUser;
import org.primefaces.model.StreamedContent;
import java.io.File;
import org.primefaces.model.DefaultStreamedContent;
import java.io.FileInputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
// TODO: Auto-generated Javadoc
/**
* The Class ConsultaFacturaPolizaMB.
*/
@ViewScoped
@ManagedBean(name = "consultaFacturaPolizaMB")
public class ConsultaFacturaPolizaMB extends AbstractMB {
/** The file. */
private String filename;
/** The months. */
private List<TcMes> months;
/** The month. */
private Integer month;
/** The type. */
private String type;
/** The num poliza. */
private Integer numPoliza;
/** The main service. */
@ManagedProperty("#{consultaFacturaPolizasService}")
private ConsultaFacturaPolizasService mainService;
/**
* Gets the months.
*
* @return the months
*/
public List<TcMes> getMonths(){
if(months == null || months.isEmpty()){
months = mainService.getMonths();
}
return months;
}
/**
* Sets the months.
*
* @param months the new months
*/
public void setMonths(List<TcMes> months){
this.months = months;
}
/**
* Gets the month.
*
* @return the month
*/
public Integer getMonth(){
return month;
}
/**
* Sets the month.
*
* @param month the new month
*/
public void setMonth(Integer month){
this.month = month;
}
/**
* Gets the type.
*
* @return the type
*/
public String getType(){
return type;
}
/**
* Sets the type.
*
* @param type the new type
*/
public void setType(String type){
this.type = type;
}
/**
* Gets the num poliza.
*
* @return the num poliza
*/
public Integer getNumPoliza(){
return numPoliza;
}
/**
* Sets the num poliza.
*
* @param numPoliza the new num poliza
*/
public void setNumPoliza(Integer numPoliza){
this.numPoliza = numPoliza;
}
/**
* Gets the file.
*
* @return the file
*/
public String getFilename(){
return filename;
}
/**
* Sets the file.
*
* @param file the new file
*/
public void setFilename(String filename){
this.filename = filename;
}
/**
* Gets the main service.
*
* @return the main service
*/
public ConsultaFacturaPolizasService getMainService(){
return mainService;
}
/**
* Sets the main service.
*
* @param mainService the new main service
*/
public void setMainService(ConsultaFacturaPolizasService mainService){
this.mainService = mainService;
}
/**
* Process.
*/
public void process(){
if(getMainService().polizaExists(month, getNumPoliza(), getType(), getIdSectorForCurrentUser().intValue())){
String tempFileName = month+type+numPoliza;
if (getMainService().getFactura(tempFileName) != null){
setFilename(tempFileName);
}else{
setFilename(null);
displayErrorMessage("FACTURAS DE LA POLIZA NO EXISTE...");
}
}else{
setFilename(null);
displayErrorMessage("LA POLIZA NO SE ENCUENTRA");
System.out.println("no se euencuentra la poliza: ");
}
setNumPoliza(null);
setMonth(null);
setType(null);
}
}
|
[
"julian.soto@itbmexico.com"
] |
julian.soto@itbmexico.com
|
05057a7f0ee2294da03ad4d90390aae537b6f378
|
a47fc8195c17f2fae1a18f8622a524b1ac2ec94b
|
/src/main/java/com/sprhib/init/Initializer.java
|
05db683bcb63f451e588befc7a5ec13ad0074cb0
|
[] |
no_license
|
olegstasyshyn/sombra-test
|
b523a73c1300f6fe99c3929f7feeb22c6d750b44
|
932a3c20bfe07132e3525357e1f90ca32594678a
|
refs/heads/master
| 2020-04-03T22:51:01.302473
| 2018-10-31T19:25:09
| 2018-10-31T19:25:09
| 155,605,236
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 951
|
java
|
package com.sprhib.init;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration.Dynamic;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
public class Initializer implements WebApplicationInitializer {
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(WebAppConfig.class);
servletContext.addListener(new ContextLoaderListener(ctx));
ctx.setServletContext(servletContext);
Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
servlet.addMapping("/");
servlet.setLoadOnStartup(2);
}
}
|
[
"olegstasishin0@gmail.com"
] |
olegstasishin0@gmail.com
|
8260eb140b669a7bb2ca16c57d6fdd485b8039be
|
a372c473c3e0d8d04cec766df453454f4e632098
|
/src/main/java/com/bingo/rpc/provider/HelloBingo.java
|
0b9748bdc44a40005a99962e7fb17a1e5da3136a
|
[] |
no_license
|
10bingo/bingo-rpc
|
2af73e71624a96b16a0ea13c1426b31ad290b73a
|
c8384400dcef78f2de90c572c30a77a6b8c098f2
|
refs/heads/master
| 2022-05-31T10:52:49.920449
| 2020-05-03T10:12:36
| 2020-05-03T10:12:36
| 260,413,094
| 0
| 0
| null | 2020-05-01T08:45:34
| 2020-05-01T08:35:38
|
Java
|
UTF-8
|
Java
| false
| false
| 192
|
java
|
package com.bingo.rpc.provider;
import com.bingo.rpc.api.Hello;
public class HelloBingo implements Hello {
public String sayHello(String name) {
return "hello " + name;
}
}
|
[
"bingo@bingo.com"
] |
bingo@bingo.com
|
19ffae00d321a262e6e49d6afd0b1dcbedaf35b6
|
7f92025c865511b852c71ed1be566202dc81b2b2
|
/parser/src/main/java/distribute/framework/ast/AstNodeSelectListItem.java
|
007ad5a9b5ae2c6edb072804e4d5b3fadc76836c
|
[
"MIT"
] |
permissive
|
buzhidaolvtu/mysql-parser
|
cf5e3649286840ee86c09b271a52fdd1b0907953
|
3616a7a6d672cef52c893446a8be3c827f4f3a5b
|
refs/heads/master
| 2021-04-27T03:03:13.682870
| 2018-03-10T04:25:41
| 2018-03-10T04:25:41
| 122,707,713
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 189
|
java
|
package distribute.framework.ast;
public class AstNodeSelectListItem extends AstNode {
public AstNodeSelectListItem(AstNode parent, String name) {
super(parent, name);
}
}
|
[
"lvtu@boxfish.cn"
] |
lvtu@boxfish.cn
|
915d81707e98d780d203b72ee14b9ab6d18e013e
|
fcba28abf98a91cbced7080d455fb273a4efefb6
|
/src/main/java/com/bdxh/kmsale/service/impl/CommNewAgentServiceImpl.java
|
5321a3b02be6667bf60702963deade70b382d265
|
[] |
no_license
|
liuxinhongg/javaweb
|
171d05280a64382f96532ea8931ddebbcdad0c74
|
7b6eb0427b5e87f2bad210eec1319ad1dcf13662
|
refs/heads/master
| 2020-04-06T17:05:53.189878
| 2018-11-15T02:35:32
| 2018-11-15T02:35:32
| 157,646,572
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,539
|
java
|
package com.bdxh.kmsale.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.bdxh.kmsale.bean.code.CommNewAgentPo;
import com.bdxh.kmsale.domain.Paging;
import com.bdxh.kmsale.mapper.code.CommNewAgentMapper;
import com.bdxh.kmsale.service.CommNewAgentService;
@Service
public class CommNewAgentServiceImpl implements CommNewAgentService{
@Resource
private CommNewAgentMapper commNewAgentMapper;
@Override
public List<CommNewAgentPo> getPage(Paging paging) {
// TODO Auto-generated method stub
return commNewAgentMapper.getPage(paging);
}
@Override
public Long getCount() {
// TODO Auto-generated method stub
return commNewAgentMapper.getCount();
}
@Override
public CommNewAgentPo getCommNewAgentPoById(String codeId) {
// TODO Auto-generated method stub
return commNewAgentMapper.getCommNewAgentPoById(codeId);
}
@Override
public Integer insertCommNewAgentPo(CommNewAgentPo commNewAgentPo) {
// TODO Auto-generated method stub
return commNewAgentMapper.insertCommNewAgentPo(commNewAgentPo);
}
@Override
public Integer updateCommNewAgentPo(CommNewAgentPo commNewAgentPo) {
// TODO Auto-generated method stub
return commNewAgentMapper.updateCommNewAgentPo(commNewAgentPo);
}
@Override
public Integer deleteCommNewAgentPo(String codeId) {
String[] codeIds = codeId.split(",");
for(int i = 0 ; i < codeIds.length ; i ++) {
commNewAgentMapper.deleteCommNewAgentPo(codeIds[i]);
}
return 1;
}
}
|
[
"tzrgaga@gmail.com"
] |
tzrgaga@gmail.com
|
153b6efab1b4d75b910a8fa25f4299463e5acd7d
|
8e67f98f026f53033e888469da72723cd51a30bb
|
/app/src/androidTest/java/com/pandita/graphinggraphs/ExampleInstrumentedTest.java
|
af5f109987b32b2e6c6d10e5c64295c5bc847986
|
[] |
no_license
|
rsilloca/GraphingGraphs
|
da082acd9c755c8151e3f1fa2a8ac81582a08b10
|
e2b4a049cc4ede8ea94c8fdb8aa41038ef026fba
|
refs/heads/master
| 2023-08-20T11:55:27.948693
| 2021-10-24T06:00:14
| 2021-10-24T06:00:14
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 736
|
java
|
package com.pandita.graphinggraphs;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.pandita.graphinggraphs", appContext.getPackageName());
}
}
|
[
"rsillocacastro@gmail.com"
] |
rsillocacastro@gmail.com
|
af48f787ba683bc4ac6afbefc345ddcbb6251bf0
|
dcff78b651a383b09432523c18acdd782ac30a13
|
/src/test/java/calculator/trigonomicTests/TgTest.java
|
7a330b971066b87ee0b8488b5ae4f7fa1df19afa
|
[] |
no_license
|
tatsianapaluyan/globo_automation
|
30df053240bfad1e3373e513b1947522d776a202
|
19f78d6ced7faffb4b957be8192c9c713a4b775a
|
refs/heads/master
| 2020-03-08T20:03:19.795567
| 2018-04-19T09:58:30
| 2018-04-19T09:58:30
| 128,362,266
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 807
|
java
|
package calculator.trigonomicTests;
import calculator.ConfigurationTest;
import com.epam.tat.module4.Calculator;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class TgTest extends ConfigurationTest {
@Test(dataProvider = "DoubleTgMethodDataProvider", groups = {"exclude_group"})
public void testTgMethod(double a, double expectedResult) throws Exception {
double result = new Calculator().tg(a);
Assert.assertEquals(result, expectedResult, "Invalid result of double ctg, expected: " + expectedResult);
}
@DataProvider(name = "DoubleTgMethodDataProvider")
public Object[][] tgDataProvider() {
return new Object[][]{
{90.0, 1.0},
{180.0, 1.0}
};
}
}
|
[
"tatsiana_paluyan@epam.com"
] |
tatsiana_paluyan@epam.com
|
7c4d3414dde24bdc1b0a0cbacdd32a4f2239b5fa
|
c0c0c729a020d73f0148967ca1aa506b48bb20c2
|
/app/src/main/java/com/zscdumin/zhixinapp/fragment/ParentFragment.java
|
223ae0230f1fcc07d376e3d3a37dcfd2aafb6841
|
[] |
no_license
|
liujizhao/ZhiXinApp
|
a2054d5644860a0b4d7bcd9a0bff18e79261ed64
|
0135ab172f307dad5143c7c65156cf479eddf3be
|
refs/heads/master
| 2020-08-03T05:52:41.673925
| 2018-12-03T01:46:47
| 2018-12-03T01:46:47
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,244
|
java
|
package com.zscdumin.zhixinapp.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zscdumin.zhixinapp.R;
import com.zscdumin.zhixinapp.adapter.mPagerAdapter;
import com.zscdumin.zhixinapp.utils.Urls;
import java.util.ArrayList;
/**
* Created by luo-pc on 2016/5/15.
*/
public class ParentFragment extends Fragment {
private ViewPager vp_content;
private TabLayout tab_title;
private ArrayList<String> titleList;
private ArrayList<Fragment> fragmentList = new ArrayList<>();
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_news, null);
initView(view);
initData();
vp_content.setOffscreenPageLimit(3);
vp_content.setAdapter(new mPagerAdapter(getChildFragmentManager(), fragmentList, titleList));
tab_title.setupWithViewPager(vp_content);
return view;
}
private void initData() {
titleList = new ArrayList<>();
titleList.add("头条");
titleList.add("NBA");
titleList.add("汽车");
titleList.add("笑话");
NewsListFragment hotNewsList = new NewsListFragment();
hotNewsList.setKeyword(Urls.TOP_ID);
NewsListFragment sportNewsList = new NewsListFragment();
sportNewsList.setKeyword(Urls.NBA_ID);
NewsListFragment carNewsList = new NewsListFragment();
carNewsList.setKeyword(Urls.CAR_ID);
NewsListFragment jokeNewsList = new NewsListFragment();
jokeNewsList.setKeyword(Urls.JOKE_ID);
fragmentList.add(hotNewsList);
fragmentList.add(sportNewsList);
fragmentList.add(carNewsList);
fragmentList.add(jokeNewsList);
}
private void initView(View view) {
tab_title = (TabLayout) view.findViewById(R.id.tab_title);
vp_content = (ViewPager) view.findViewById(R.id.vp_content);
}
}
|
[
"2712220318@qq.com"
] |
2712220318@qq.com
|
6bc5223f926da1bb904fb63fa0525145cd141550
|
0a7905b973d7b8cd1a3f971ff68cd2b884d5e816
|
/project1/src/main/java/calculator/parser/grammar/CalculatorGrammarParserBaseListener.java
|
27e46c1f9c9012e638eb3de67bf3c80fa2b806c2
|
[] |
no_license
|
luke-jiang/CSE_373
|
acddaf56e26b1b4a2acc3b294914886d13de8d82
|
fa9da51deb3fd8f2ee300bd5426f47b00134179d
|
refs/heads/master
| 2020-03-19T23:50:42.819254
| 2018-06-12T05:45:54
| 2018-06-12T05:45:54
| 137,022,283
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,015
|
java
|
// Generated from CalculatorGrammarParser.g4 by ANTLR 4.5.1
package calculator.parser.grammar;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link CalculatorGrammarParserListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class CalculatorGrammarParserBaseListener implements CalculatorGrammarParserListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterProgram(CalculatorGrammarParser.ProgramContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitProgram(CalculatorGrammarParser.ProgramContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAssignStmt(CalculatorGrammarParser.AssignStmtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAssignStmt(CalculatorGrammarParser.AssignStmtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExprStmt(CalculatorGrammarParser.ExprStmtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExprStmt(CalculatorGrammarParser.ExprStmtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAddExprBin(CalculatorGrammarParser.AddExprBinContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAddExprBin(CalculatorGrammarParser.AddExprBinContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAddExprSingle(CalculatorGrammarParser.AddExprSingleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAddExprSingle(CalculatorGrammarParser.AddExprSingleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMultExprSingle(CalculatorGrammarParser.MultExprSingleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMultExprSingle(CalculatorGrammarParser.MultExprSingleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMultExprBin(CalculatorGrammarParser.MultExprBinContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMultExprBin(CalculatorGrammarParser.MultExprBinContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNegExprUnary(CalculatorGrammarParser.NegExprUnaryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNegExprUnary(CalculatorGrammarParser.NegExprUnaryContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNegExprSingle(CalculatorGrammarParser.NegExprSingleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNegExprSingle(CalculatorGrammarParser.NegExprSingleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPowExprBin(CalculatorGrammarParser.PowExprBinContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPowExprBin(CalculatorGrammarParser.PowExprBinContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPowExprSingle(CalculatorGrammarParser.PowExprSingleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPowExprSingle(CalculatorGrammarParser.PowExprSingleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNumber(CalculatorGrammarParser.NumberContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNumber(CalculatorGrammarParser.NumberContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterRawString(CalculatorGrammarParser.RawStringContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitRawString(CalculatorGrammarParser.RawStringContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVariable(CalculatorGrammarParser.VariableContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVariable(CalculatorGrammarParser.VariableContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterFuncName(CalculatorGrammarParser.FuncNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitFuncName(CalculatorGrammarParser.FuncNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterParenExpr(CalculatorGrammarParser.ParenExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitParenExpr(CalculatorGrammarParser.ParenExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterArglist(CalculatorGrammarParser.ArglistContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitArglist(CalculatorGrammarParser.ArglistContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}
|
[
"yuxuanlukejiang@gmail.com"
] |
yuxuanlukejiang@gmail.com
|
2d6d6a5880292448561b8b48cd4ed553350d0343
|
a16745a6658cfeb390572ba3698bbd2388c11b87
|
/programasprint/EjercicioEnClase11/src/EjercicioEnClase11.java
|
a6aef1e376182b1bec4e74a06218b5ec2fd54791
|
[] |
no_license
|
angelGuetio/uccprog2
|
2672027827f3d8c05df73a21fd465b8b1ccec571
|
f8360beeff831aace6acea7886694eebdc141e09
|
refs/heads/master
| 2023-01-20T08:06:43.172945
| 2020-11-25T15:21:34
| 2020-11-25T15:21:34
| 298,878,925
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
Java
| false
| false
| 2,250
|
java
|
import java.util.Scanner;
public class EjercicioEnClase11 {
public static void main(String[] args) {
Scanner digitos= new Scanner(System.in);
System.out.println("+------------------------------------------------------------------------+");
System.out.println("| AUTOR: Angel Yesid Guetio |");
System.out.println("| FECHA: Octubre 31 del 2020 |");
System.out.println("+------------------------------------------------------------------------+");
System.out.println("| TRABAJO EN CLASE: EJERCICIO 08 |");
System.out.println("+------------------------------------------------------------------------+");
System.out.println("");
int i=1;
int a=2;
int n=11;
int caracol=3;
int caracol01=2;
int re=0;
System.out.println("acomulados descenso por noche ascenso por dia ");
System.out.println();
while(i<n) {
System.out.println ( " " + (a+i) + " "+2+ " "+i);
i++;
re=(55);
}
System.out.println("El caracol subio la pared en " +re+" dias");
System.out.println();
int ii=1;
int aa=3;
int nn=11;
int cienpies=4;
int cienpies01=3;
int cien=0;
System.out.println("acomulados descenso por noche ascenso por dia ");
System.out.println();
while(ii<nn) {
System.out.println ( " " + (aa+ii) + " "+3+ " "+ii);
ii++;
cien=55;
}
System.out.println("El cienpiés subio la pared en " +cien+" dias");
System.out.println();
System.out.println();
int iii=1+2;
int aaa=1;
int nnn=12;
int gusano=4;
int gusano01=2;
int gus=0;
System.out.println("acomulados descenso por noche ascenso por dia ");
System.out.println();
while(iii<nnn) {
System.out.println ( " " + (aaa+iii)+ " "+2+ " "+(iii-1));
iii +=2;
gus=30;
}
System.out.println("El gusano subio la pared en " +gus+" dias");
System.out.println();
System.out.println();
}
}
|
[
"yesid4681@gmail.com"
] |
yesid4681@gmail.com
|
d071e780a88b8dc2d677f94b0a3d913dc082b6a4
|
dbd600e3deed2419b4d25bba04381ac4de8838b3
|
/Food/src/Food.java
|
4198aa1f4e16402997c5a95fda8da07faee79340
|
[] |
no_license
|
aquib-mujtaba/eclipseJavaProjects
|
9838a3d1d66af6f457494ef820bee5b26b35374e
|
7ecaac0f1a4ad939e19e7075803268b159a548f1
|
refs/heads/master
| 2020-03-23T16:29:41.962264
| 2018-07-25T17:18:45
| 2018-07-25T17:18:45
| 141,812,931
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 51
|
java
|
public class Food {
String fName = "Food name";
}
|
[
"aquib.mujtaba@live.com"
] |
aquib.mujtaba@live.com
|
0c33003e10d91b611378b414805b752e9cd794c3
|
38be824395eb16f93cf1b61b84dd48d60e3b24ff
|
/src/main/java/com/luulsolutions/luulpos/web/rest/vm/KeyAndPasswordVM.java
|
3c4dc39aa76d181c0a1cdb9afdb2ccd73d882e8d
|
[
"Apache-2.0"
] |
permissive
|
gustavocaraciolo/luulpos_backend
|
1443bdfef0791568ebc17b132d3f4ba579525076
|
1626620d1355b9feab7beac3aaf4e5c1003ac26d
|
refs/heads/master
| 2020-05-16T06:48:46.833288
| 2019-04-23T07:37:18
| 2019-04-23T07:37:18
| 182,859,518
| 0
| 0
|
Apache-2.0
| 2019-04-22T20:05:15
| 2019-04-22T20:05:14
| null |
UTF-8
|
Java
| false
| false
| 506
|
java
|
package com.luulsolutions.luulpos.web.rest.vm;
/**
* View Model object for storing the user's key and password.
*/
public class KeyAndPasswordVM {
private String key;
private String newPassword;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
}
|
[
"ahmed.dini@luulsolutions.com"
] |
ahmed.dini@luulsolutions.com
|
f01edd3e4685fb6d2497d33860af422b4b1aae7b
|
017fd183081227b81f25aa541ef6908e03f65cc6
|
/com/shanemulcair/projecteuler/Problem5.java
|
13a56825c8d7f5f467cdbc5c2d82ceac91926d13
|
[] |
no_license
|
shane-mulcair/project-euler
|
02611a4613f3de0c069b5b1de9bc60d4e3c0b21d
|
dfc8a7a67267beda617f207a886dfda5a7a3b65b
|
refs/heads/master
| 2021-01-10T04:16:07.099320
| 2016-03-01T13:38:42
| 2016-03-01T13:38:42
| 52,877,313
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 847
|
java
|
package com.shanemulcair.projecteuler;
/*
* 2520 is the smallest number that can be divided by each
* of the numbers from 1 to 10 without any remainder.
* What is the smallest positive number that is evenly divisible
* by all of the numbers from 1 to 20?
*
*/
public class Problem5 {
public long getSmallestMultiple(int rangeStart, int rangeFinish){
boolean notFound=true;
long multiple=1;
int tempSum=0;
int[] range=new int[rangeFinish-rangeStart];
while(notFound){
int j=0;
for(int i=rangeStart;i<rangeFinish;i++){
if(multiple%i==0){
range[j]=0;
}
else{
range[j]=1;
}
j++;
}
for(int k=0;k<j;k++){
tempSum+=range[k];
}
if(tempSum==0){
notFound=false;
}
else{
tempSum=0;
multiple++;
}
}
return multiple;
}
}
|
[
"shane-mulcair@users.noreply.github.com"
] |
shane-mulcair@users.noreply.github.com
|
b4d49bafc5826c5928f44c3a6582339596a0ffe3
|
7c11b2288136a31105c73ded507ce1641f5d537a
|
/ProjectO-JAVA/ProjectO-JAVA/src/main/java/com/example/TestCreateProject/Repository/ViewRepo.java
|
c4b1b0a4a99c0dece8904aac2f2bf676d99eab74
|
[] |
no_license
|
plaooo/Project
|
a105e867cd80b7c3cb41ec10296044166248cb58
|
7ccae56cb004b822e79fd2b2c1f4f716f3745e4e
|
refs/heads/master
| 2023-01-21T03:08:47.848525
| 2019-06-04T17:11:31
| 2019-06-04T17:11:31
| 190,247,636
| 0
| 0
| null | 2023-01-07T06:05:02
| 2019-06-04T17:20:44
|
TypeScript
|
UTF-8
|
Java
| false
| false
| 4,245
|
java
|
package com.example.TestCreateProject.Repository;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.example.TestCreateProject.Model.ViewMonth;
import com.example.TestCreateProject.Model.Viewday;
import com.example.TestCreateProject.Model.Viewyear;
@Repository
public class ViewRepo {
@Autowired
private JdbcTemplate jbcTemplate;
private static final DateFormat date = new SimpleDateFormat("yyyy/MM/dd");
Date d = new Date();
String days = date.format(d);
String day[] = days.split("/");
String year = day[0];
String month = day[1];
String one = day[2];
public List<Viewyear> GetTopViewYear(){
List<Viewyear> viewyears = new ArrayList<Viewyear>();
List<Map<String,Object>> rows = jbcTemplate.queryForList
("SELECT book.name_fiction,book.id_book,book.img_book,YEAR(episode.day_create_episode),SUM(episode.view)\r\n" +
"FROM ( episode INNER JOIN book ON episode.id_book=book.id_book )\r\n" +
" WHERE YEAR(episode.day_create_episode)="+year+"\r\n" +
" GROUP BY book.name_fiction\r\n" +
" ORDER BY episode.view DESC LIMIT 1");
for(Map<String,Object> row:rows) {
Viewyear viewyear = new Viewyear();
viewyear.setNameFiction((String) row.get("name_fiction"));
viewyear.setViewYear((int) row.get("YEAR(episode.day_create_episode)"));
viewyear.setSum((BigDecimal) row.get("SUM(episode.view)"));
viewyear.setIdBook((int) row.get("id_book"));
viewyear.setImgBook((String) row.get("img_book"));
viewyears.add(viewyear);
}
return viewyears;
}
public List<ViewMonth> GetTopViewMonth(){
System.out.print(month);
List<ViewMonth> viewmonths = new ArrayList<ViewMonth>();
List<Map<String,Object>> rows = jbcTemplate.queryForList
("SELECT book.name_fiction,book.id_book,book.img_book,MONTH(episode.day_create_episode),YEAR(episode.day_create_episode),SUM(episode.view)\r\n" +
"FROM ( episode INNER JOIN book ON episode.id_book=book.id_book )\r\n" +
" WHERE MONTH(episode.day_create_episode)="+month+" AND YEAR(episode.day_create_episode)="+year+"\r\n" +
" GROUP BY book.name_fiction\r\n" +
" ORDER BY episode.view DESC LIMIT 1");
for(Map<String,Object> row:rows) {
ViewMonth viewmonth = new ViewMonth();
viewmonth.setNameFiction((String) row.get("name_fiction"));
viewmonth.setViewMonth((int) row.get("MONTH(episode.day_create_episode)"));
viewmonth.setViewYear((int) row.get("YEAR(episode.day_create_episode)"));
viewmonth.setSum((BigDecimal) row.get("SUM(episode.view)"));
viewmonth.setIdBook((int) row.get("id_book"));
viewmonth.setImgBook((String) row.get("img_book"));
viewmonths.add(viewmonth);
}
return viewmonths;
}
public List<Viewday> GetTopViewDay(){
List<Viewday> viewdays = new ArrayList<Viewday>();
List<Map<String,Object>> rows = jbcTemplate.queryForList
("SELECT book.name_fiction,book.id_book,book.img_book,DAY(episode.day_create_episode),MONTH(episode.day_create_episode),YEAR(episode.day_create_episode),SUM(episode.view)\r\n" +
"FROM ( episode INNER JOIN book ON episode.id_book=book.id_book )\r\n" +
" WHERE DAY(episode.day_create_episode)="+one+" AND MONTH(episode.day_create_episode)="+month+" AND YEAR(episode.day_create_episode)="+year+"\r\n" +
" GROUP BY book.name_fiction\r\n" +
" ORDER BY episode.view DESC LIMIT 1");
for(Map<String,Object> row:rows) {
Viewday viewday = new Viewday();
viewday.setNameFiction((String) row.get("name_fiction"));
viewday.setViewDay((int) row.get("DAY(episode.day_create_episode)"));
viewday.setViewMonth((int) row.get("MONTH(episode.day_create_episode)"));
viewday.setViewYear((int) row.get("YEAR(episode.day_create_episode)"));
viewday.setSum((BigDecimal) row.get("SUM(episode.view)"));
viewday.setIdBook((int) row.get("id_book"));
viewday.setImgBook((String) row.get("img_book"));
viewdays.add(viewday);
}
return viewdays;
}
}
|
[
"boyboy12364@hotmail.com"
] |
boyboy12364@hotmail.com
|
d033e4a9c75ca55f50bbfc3d1f4e846c9e5629a1
|
b295cffc1de37330b0b8d28a4d81faac01de7f22
|
/CODE/android/device/eostek/common/apps/HotKeyService/src/com/eostek/hotkeyservice/HotKeyApplication.java
|
53b69a54170c022b753cd493c36753b0d1891827
|
[] |
no_license
|
windxixi/test
|
fc2487d73a959050d8ad37d718b09a243660ec64
|
278a167c26fb608f700b81656f32e734f536c9f9
|
refs/heads/master
| 2023-03-16T19:59:41.941474
| 2016-07-25T04:18:41
| 2016-07-25T04:18:41
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 507
|
java
|
package com.eostek.hotkeyservice;
import java.lang.Thread.UncaughtExceptionHandler;
import android.app.Application;
public class HotKeyApplication extends Application implements UncaughtExceptionHandler {
@Override
public void onCreate() {
super.onCreate();
// Thread.setDefaultUncaughtExceptionHandler(this);
}
@Override
public void uncaughtException(Thread thread, Throwable ex) {
ex.printStackTrace();
System.exit(0);
}
}
|
[
"gracie.zhou@ieostek.com"
] |
gracie.zhou@ieostek.com
|
f9f8c85acd5844e088e528a2a80e07a2fd6eedde
|
0582f87bffd85c81d7abbbb7231c4ffe5f77b0be
|
/src/main/java/br/evoluum/robot/model/Direction.java
|
94ebdbf1fe884e95c909019e165af5c087ebcb38
|
[] |
no_license
|
mychellt/mars-robot
|
596e5a0f93cf472a0151b82cbde17fdff94678bd
|
66cf143f32711ae8acdc2bb2993a540028ed9d33
|
refs/heads/master
| 2022-12-20T04:06:04.149973
| 2020-09-23T19:32:33
| 2020-09-23T19:32:33
| 298,073,047
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 627
|
java
|
package br.evoluum.robot.model;
/**
* @author Mychell Teixeira (mychellt@gmail.com)
* @since 22/09/2020
*/
public enum Direction {
NORTH("N"), SOUTH("S"), EAST("E"), WEST("W");
private final String code;
Direction(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public boolean isNorth() {
return this.equals(NORTH);
}
public boolean isSouth() {
return this.equals(SOUTH);
}
public boolean isEast() {
return this.equals(EAST);
}
public boolean isWest() {
return this.equals(WEST);
}
}
|
[
"mychellt@info.ufrn.br"
] |
mychellt@info.ufrn.br
|
8fdc6129e4d392864f4f8ee325455f7f56cde03b
|
f0e4e6f2380074baefabba37ccc5d96fe6141328
|
/JDBC Programs/Insertion.java
|
51554fa731e78ed7d36311037677724cd5b12667
|
[] |
no_license
|
debiprasadmishra50/All-JDBC-Operation-MySQL
|
b71308b271545aaa22556a4570b9b99aa22e8997
|
0d36bd58420c7547a73b2cfaff5f2e07343f317e
|
refs/heads/master
| 2022-11-08T16:58:58.474498
| 2020-06-28T08:16:40
| 2020-06-28T08:16:40
| 275,538,847
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,327
|
java
|
import java.sql.*;
public class Insertion {
public static void main(String[] args) throws SQLException {
Connection myConn = null;
Statement myStmt = null;
ResultSet myRs = null;
String dbUrl = "jdbc:mysql://localhost:3306/demo";
String user = "student";
String pass = "sipusipu18";
try {
// 1. Get a connection to database
myConn = DriverManager.getConnection(dbUrl, user, pass);
// 2. Create a statement
myStmt = myConn.createStatement();
// 3. Insert a new employee
System.out.println("Inserting a new employee to database\n");
int rowsAffected = myStmt.executeUpdate(
"insert into employees " +
"(last_name, first_name, email, department, salary) " +
"values " +
"('Wright', 'Eric', 'eric.wright@foo.com', 'HR', 33000.00)");
// 4. Verify this by getting a list of employees
myRs = myStmt.executeQuery("select * from employees order by last_name");
// 5. Process the result set
while (myRs.next()) {
System.out.println(myRs.getString("last_name") + ", " + myRs.getString("first_name"));
}
}
catch (Exception exc) {
exc.printStackTrace();
}
finally {
if (myRs != null) {
myRs.close();
}
if (myStmt != null) {
myStmt.close();
}
if (myConn != null) {
myConn.close();
}
}
}
}
|
[
"debiprasadmishra50@gmail.com"
] |
debiprasadmishra50@gmail.com
|
59dbb6aca6d448b5741900f61d72ed591cf27e3b
|
f66a3be411ab6f2259104135867716bac2559f31
|
/test/JUnitTestBoardMovement.java
|
a846198cfb11bde34a74a501daa6661f15cfb191
|
[] |
no_license
|
Tim3Ds/CS3230-Final-Stratigo-War
|
a13d5d81994737a677c9db3a44da3efb11b774e8
|
71b39698950d2c98542ba6150bb451a720a6d626
|
refs/heads/master
| 2021-07-20T11:59:33.846800
| 2017-10-22T20:35:55
| 2017-10-22T20:35:55
| 107,900,408
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,169
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import Logic.Board;
import Logic.Player;
/**
*
* @author tim
*/
public class JUnitTestBoardMovement {
Board b;
Player p1, p2;
public JUnitTestBoardMovement() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
p1 = new Player("test",1);
p2 = new Player("test2",2);
b = new Board();
b.addPiece(p1.getPiece(0), 0, 0);
b.addPiece(p1.getPiece(5), 3, 1);
b.addPiece(p1.getPiece(30), 6, 2);
b.addPiece(p2.getPiece(15), 0, 1);
b.addPiece(p2.getPiece(23), 6, 3);
b.addPiece(p2.getPiece(25), 4, 1);
b.addPiece(p2.getPiece(39), 8, 2);
}
@After
public void tearDown() {
}
// TODO add test methods here.
// The methods must be annotated with annotation @Test. For example:
//
@Test// test moving pieces
public void TestBoardMove0p1(){
this.setUp();
System.out.println(b.toString());
assertEquals("Captain", b.choosePiece(6, 2).toString());
b.move(b.choosePiece(6, 2), "up", 1);
assertEquals("Captain", b.choosePiece(6, 3).toString());
System.out.println(b.toString());
System.out.println(b.turnCheck());
}
@Test// test attacking
public void TestBoardMove1p2Attack1(){
this.setUp();
System.out.println(b.toString());
b.move(b.choosePiece(6, 2), "down", 2);
System.out.println(b.turnCheck());
b.move(b.choosePiece(4, 1), "left", 1);
System.out.println(b.toString());
System.out.println(b.turnCheck());
assertEquals("empty", b.choosePiece(4, 1).toString());
assertEquals("Bomb", b.choosePiece(3, 1).toString());
}
@Test// test attacking
public void TestBoardMove2p1Move2(){
this.setUp();
System.out.println(b.toString());
b.move(b.choosePiece(6, 2), "right", 2);
System.out.println(b.turnCheck());
b.move(b.choosePiece(4, 1), "left", 1);
System.out.println(b.toString());
System.out.println(b.turnCheck());
b.move(b.choosePiece(4, 2), "left", 2);
System.out.println(b.toString());
System.out.println(b.turnCheck());
assertEquals("Marshall", b.choosePiece(8, 2).toString());
}
@Test// test Capture Flage
public void TestBoardMove3p2CaptureFlage(){
this.setUp();
b.move(b.choosePiece(6, 2), "left", 2);
b.move(b.choosePiece(4, 1), "left", 1);
b.move(b.choosePiece(4, 2), "left", 2);
b.move(b.choosePiece(0, 1), "down", 1);
assertEquals("Winner", b.choosePiece(0, 0).toString());
}
}
|
[
"Tim3Ds@gmail.com"
] |
Tim3Ds@gmail.com
|
e65a3bebfcb15550459ba67cacec4e7051c21dea
|
d3056a23d41e2f43a77121663179bc7eaf9eec34
|
/SWEA/SWEA_4366.java
|
28d8f4e878271b3e8054fe9c48283a680f1265b0
|
[] |
no_license
|
eojine/algorithm
|
7e243e1993a16a3bcf33ea1920084846455dc93d
|
5ed225d0f9f15a2c7e92059630cc63fdb017ac0c
|
refs/heads/master
| 2021-06-24T08:18:45.804004
| 2020-12-31T07:45:23
| 2020-12-31T07:45:23
| 182,960,328
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,758
|
java
|
import java.io.StringReader;
import java.util.*;
public class SWEA_4366 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
sc = new Scanner(new StringReader("1\n" +
"1010\n" +
"212"));
int TC = sc.nextInt();
for (int tc = 1; tc <= TC; tc++) {
char[] num2 = sc.next().toCharArray();
char[] num3 = sc.next().toCharArray();
HashSet<Integer> hs = new HashSet<>();
int result = 0;
for (int i = 0; i < num2.length; i++) {
for (int j = 0; j < 2; j++) {
if (num2[i] == (char)(j + '0')) continue;
char x = num2[i];
num2[i] = (char)(j + '0');
String s = "";
for (int k = 0; k < num2.length; k++) s += num2[k];
int c = Integer.parseInt(s, 2);
num2[i] = x;
hs.add(c);
}
}
for (int i = 0; i < num3.length; i++) {
for (int j = 0; j < 3; j++) {
if (num3[i] == (char)(j + '0')) continue;
char x = num3[i];
num3[i] = (char)(j + '0');
String s = "";
for (int k = 0; k < num3.length; k++) s += num3[k];
int c = Integer.parseInt(s, 3);
num3[i] = x;
if (hs.contains(c)) {
result = c;
break;
}
}
} // end of for
System.out.println("#" + tc + " " + result);
} // end of TC
} // end of main
} // end of class
|
[
"noreply@github.com"
] |
eojine.noreply@github.com
|
beb1809dba4ef19cb31a40b367b26b541c5f7b46
|
22ad342d425618b1ef9f26a14769f027e19cd45e
|
/src/main/java/br/com/setor2/dao/DatashowDAO.java
|
60de6023dce4bc24b11452c8071e20b658152097
|
[] |
no_license
|
andersoncezarn/Sistema-de-gestao
|
3511230a1c65eaa6e50add0a9e94df4ce5102c89
|
1ef69ebc0a7bd5c2737dcc8f96cad8f568fbd28a
|
refs/heads/main
| 2023-04-29T21:09:28.721303
| 2021-05-18T17:12:40
| 2021-05-18T17:12:40
| 366,531,522
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 132
|
java
|
package br.com.setor2.dao;
import br.com.setor2.domain.Datashow;
public class DatashowDAO extends GenericDAO<Datashow>{
}
|
[
"noreply@github.com"
] |
andersoncezarn.noreply@github.com
|
0aaed3c3cba1d63417c257bde532e4bc4057d75a
|
5e21f7dacb16b90ec116c1dfe8d12489d7fa5ae2
|
/projects/asw-875-spring-cloud/a3-lucky-word-cloud-config-client-refresh/src/main/java/asw/springcloud/luckyword/LuckyWordController.java
|
c9f34fc519bc28d48d1828da64be174d98c7b2b3
|
[
"MIT"
] |
permissive
|
aswroma3/asw-2018
|
5800c6bd532550e90c4eb711b741cc6ba593b94a
|
9f41b4255f8906cac42f9e6c6d039ad3f2fc6031
|
refs/heads/master
| 2021-09-20T04:03:10.774700
| 2018-08-03T07:13:29
| 2018-08-03T07:13:29
| 122,209,616
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 528
|
java
|
package asw.springcloud.luckyword;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
@RestController
@RefreshScope
public class LuckyWordController {
@Value("${lucky-word}")
private String luckyWord;
@RequestMapping("/lucky-word")
public String luckyWord() {
return "The lucky word is: " + luckyWord;
}
}
|
[
"cabibbo@dia.uniroma3.it"
] |
cabibbo@dia.uniroma3.it
|
348b55d89a6f8659f187544fb57546f8f68abb66
|
21af95343fc289a3e991e84f327a71e2f3e9359b
|
/base/src/com/xxshop/foundation/service/impl/AddressServiceImpl.java
|
29adfcacca3bf2a365071f12c7a0584673814c32
|
[] |
no_license
|
one-punch/styx
|
54185d6fa9546fed44d14903cd88f99c378e9a50
|
dd4ba564bd66b8caa072b93da049b9dbb2149819
|
refs/heads/master
| 2021-01-17T10:20:26.246601
| 2016-06-21T04:31:55
| 2016-06-21T04:31:55
| 59,368,670
| 0
| 0
| null | 2016-06-21T04:31:56
| 2016-05-21T15:58:47
|
Java
|
UTF-8
|
Java
| false
| false
| 2,634
|
java
|
package com.xxshop.foundation.service.impl;
import com.xxshop.core.dao.IGenericDAO;
import com.xxshop.core.query.GenericPageList;
import com.xxshop.core.query.PageObject;
import com.xxshop.core.query.support.IPageList;
import com.xxshop.core.query.support.IQueryObject;
import com.xxshop.foundation.domain.Address;
import com.xxshop.foundation.service.IAddressService;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class AddressServiceImpl
implements IAddressService
{
@Resource(name="addressDAO")
private IGenericDAO<Address> addressDao;
public boolean save(Address address)
{
try
{
this.addressDao.save(address);
return true;
} catch (Exception e) {
e.printStackTrace();
}return false;
}
public Address getObjById(Long id)
{
Address address = (Address)this.addressDao.get(id);
if (address != null) {
return address;
}
return null;
}
public boolean delete(Long id) {
try {
this.addressDao.remove(id);
return true;
} catch (Exception e) {
e.printStackTrace();
}return false;
}
public boolean batchDelete(List<Serializable> addressIds)
{
for (Serializable id : addressIds) {
delete((Long)id);
}
return true;
}
public IPageList list(IQueryObject properties) {
if (properties == null) {
return null;
}
String query = properties.getQuery();
Map params = properties.getParameters();
GenericPageList pList = new GenericPageList(Address.class, query,
params, this.addressDao);
if (properties != null) {
PageObject pageObj = properties.getPageObj();
if (pageObj != null)
pList.doList(pageObj.getCurrentPage() == null ? 0 : pageObj
.getCurrentPage().intValue(), pageObj.getPageSize() == null ? 0 :
pageObj.getPageSize().intValue());
} else {
pList.doList(0, -1);
}return pList;
}
public boolean update(Address address) {
try {
this.addressDao.update(address);
return true;
} catch (Exception e) {
e.printStackTrace();
}return false;
}
public List<Address> query(String query, Map params, int begin, int max) {
return this.addressDao.query(query, params, begin, max);
}
}
|
[
"chailink100@gmail.com"
] |
chailink100@gmail.com
|
a41922dcf4cc9e9502fa8d1c132f08b19b1f2e41
|
acceb3e59affadda7038473d080cbb0838c03ae0
|
/src/main/java/com/fasttrackit/RadioControlerCar.java
|
3597f2015f5a2abb17c6fc6ec1e63cccaf9c9804
|
[] |
no_license
|
gavrilutadelina/RacingGameExperiments
|
a07b2b5f16308b1f25077a5188672a02ef6c4291
|
9700038c51c24873cb95fbf3642fcab54b86a120
|
refs/heads/master
| 2021-07-10T23:08:00.858643
| 2019-10-30T20:41:45
| 2019-10-30T20:41:45
| 208,335,380
| 0
| 0
| null | 2020-10-13T16:01:18
| 2019-09-13T19:46:30
|
Java
|
UTF-8
|
Java
| false
| false
| 568
|
java
|
package com.fasttrackit;
public class RadioControlerCar extends AutoVehicle {
public String toString(){
return "Custom string representation";
}
public static final String CONTROL_TYPE = "radio_controlled";
String color;
int doorCount;
public RadioControlerCar(Engine engine) {
super(engine);
}
public RadioControlerCar() {
this(new Engine());
}
public int getDoorCount() {
return doorCount;
}
public void setDoorCount(int doorCount) {
this.doorCount = doorCount;
}
}
|
[
"gvr.adelina@yahoo.com"
] |
gvr.adelina@yahoo.com
|
90a691e90a6913c5c8655544f33faa0b3f711194
|
99e92aefc2b24f84c08ef1b675b9e29837fecd42
|
/mybatis-generator-core/src/main/java/org/mybatis/generator/codegen/mybatis3/xmlmapper/elements/bjdj/ComplexFindOneElementGenerator.java
|
0df35646b7945f4172da4207f0e09114e830a0eb
|
[
"Apache-2.0"
] |
permissive
|
kongh/dream-mybatis-generator
|
95654b057f857704088eaba75fa17141731626af
|
1c3bfcc7bdc8694b29dab39a131bb66e2997e5a6
|
refs/heads/master
| 2016-09-05T14:50:47.209346
| 2015-10-08T07:25:35
| 2015-10-08T07:25:35
| 41,085,280
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,704
|
java
|
package org.mybatis.generator.codegen.mybatis3.xmlmapper.elements.bjdj;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.codegen.mybatis3.xmlmapper.elements.AbstractXmlElementGenerator;
/**
* Created by Administrator on 2015/6/16.
*/
public class ComplexFindOneElementGenerator extends AbstractXmlElementGenerator{
@Override
public void addElements(XmlElement parentElement) {
XmlElement answer = new XmlElement("select"); //$NON-NLS-1$
answer.addAttribute(new Attribute("id", "findOne"));
answer.addAttribute(new Attribute("parameterType", BJDJConstants.PARAMETER_TYPE)); //$NON-NLS-1$
answer.addAttribute(new Attribute(
"resultMap", introspectedTable.getBaseResultMapId())); //$NON-NLS-1$
context.getCommentGenerator().addComment(answer);
StringBuffer buffer = new StringBuffer();
buffer.append("select ");
buffer.append(BJDJConstants.REFID + " ");
buffer.append(" from ");
buffer.append(introspectedTable.getFullyQualifiedTableNameAtRuntime());
answer.addElement(new TextElement(buffer.toString())); //$NON-NLS-1$
//where reference
buffer.delete(0, buffer.length());
buffer.append(BJDJConstants.WHERE_REFERENCE);
answer.addElement(new TextElement(buffer.toString()));
//order reference
buffer.delete(0, buffer.length());
buffer.append(BJDJConstants.ROW_LOCK_REFERENCE);
answer.addElement(new TextElement(buffer.toString()));
parentElement.addElement(answer);
}
}
|
[
"563796329@qq.com"
] |
563796329@qq.com
|
25b7f2bf3215db173b90e02c2fd8fbce2ea3361b
|
d7e6bf026a043ed770718127bc8d79c5f8ed0314
|
/src/org/lynxlake/_05InheritanceLab/_01SingleInheritance/Animal.java
|
58c42926f0e56e943b8f5c3a57c834699cf68b3d
|
[] |
no_license
|
plamen911/java-oop-basics
|
e2fa792b27a214985d2b9810de8a3784f260665b
|
e82e766a794ff0bde963e50d24d63df9cb2370a8
|
refs/heads/master
| 2021-01-13T03:36:30.473424
| 2017-03-11T07:04:01
| 2017-03-11T07:04:01
| 77,316,579
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 157
|
java
|
package org.lynxlake._05InheritanceLab._01SingleInheritance;
public class Animal {
public void eat() {
System.out.println("eating...");
}
}
|
[
"1"
] |
1
|
d9328493841a618a33e9faf38cdb1dee7a47f623
|
60dfc2ab3f0766385bc7634c7a85c9da61cf004b
|
/src/main/java/uk/co/meridenspares/service/api/CustomerOrderService.java
|
9d61ec7e333dfc3e76799d5289e6f9cd03739d1f
|
[] |
no_license
|
eclipsesystemsltd/ms-service-api
|
eb284398567932a06721bc6b28c45694373a224b
|
8965781e8d84fb163b5b22c9262db5774a09f471
|
refs/heads/master
| 2023-01-02T08:37:47.632519
| 2020-06-16T14:36:51
| 2020-06-16T14:36:51
| 272,725,006
| 0
| 0
| null | 2020-10-13T22:50:48
| 2020-06-16T14:08:08
|
Java
|
UTF-8
|
Java
| false
| false
| 301
|
java
|
package uk.co.meridenspares.service.api;
import uk.co.meridenspares.domain.CustomerOrder;
/**
* This interface declares the specific methods to be provided by the 'CustomerOrder' service.
* @author user
*
*/
public interface CustomerOrderService extends GenericService<CustomerOrder, Long> {
}
|
[
"g.moore@eclipsesystemsltd.com"
] |
g.moore@eclipsesystemsltd.com
|
927288eb750b85acfaea58208ee5a1dbb05f38e0
|
2612f336d667a087823234daf946f09b40d8ca3d
|
/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/ClassInitializerInspectionTest.java
|
f950d3e1c120889642f15e68b72c276992cb8f6f
|
[
"Apache-2.0"
] |
permissive
|
tnorbye/intellij-community
|
df7f181861fc5c551c02c73df3b00b70ab2dd589
|
f01cf262fc196bf4dbb99e20cd937dee3705a7b6
|
refs/heads/master
| 2021-04-06T06:57:57.974599
| 2018-03-13T17:37:00
| 2018-03-13T17:37:00
| 125,079,130
| 2
| 0
|
Apache-2.0
| 2018-03-13T16:09:41
| 2018-03-13T16:09:41
| null |
UTF-8
|
Java
| false
| false
| 1,288
|
java
|
/*
* Copyright 2000-2013 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.siyeh.ig.classlayout;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.LightInspectionTestCase;
/**
* @author Bas Leijdekkers
*/
public class ClassInitializerInspectionTest extends LightInspectionTestCase {
public void testSimple() { doTest(); }
public void testAnonymous() { doTest(); }
public void testNoConstructor() {
final ClassInitializerInspection inspection = new ClassInitializerInspection();
inspection.onlyWarnWhenConstructor = true;
myFixture.enableInspections(inspection);
doTest();
}
@Override
protected InspectionProfileEntry getInspection() {
return new ClassInitializerInspection();
}
}
|
[
"basleijdekkers@gmail.com"
] |
basleijdekkers@gmail.com
|
7afb8246e7b39ae30906e5d16add78c784f25733
|
70cbaeb10970c6996b80a3e908258f240cbf1b99
|
/WiFi万能钥匙dex1-dex2jar.jar.src/bluefay/support/annotation/AnimRes.java
|
77bf2c2f9de875f61bea13b74fe37862964e7a50
|
[] |
no_license
|
nwpu043814/wifimaster4.2.02
|
eabd02f529a259ca3b5b63fe68c081974393e3dd
|
ef4ce18574fd7b1e4dafa59318df9d8748c87d37
|
refs/heads/master
| 2021-08-28T11:11:12.320794
| 2017-12-12T03:01:54
| 2017-12-12T03:01:54
| 113,553,417
| 2
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 647
|
java
|
package bluefay.support.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.SOURCE)
@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.FIELD})
public @interface AnimRes {}
/* Location: /Users/hanlian/Downloads/WiFi万能钥匙dex1-dex2jar.jar!/bluefay/support/annotation/AnimRes.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
[
"lianh@jumei.com"
] |
lianh@jumei.com
|
ddbbf382c856c1dc0f11023ee1af6108fb2329b5
|
c8412c01ac07271af40ff508109b673aa2caaf5b
|
/admin/src/test/java/com/whiteplanet/admin/service/message/jg/push/model/MessageTest.java
|
79e52b3e4610b65aed2b95271b799f4baf2c5102
|
[] |
no_license
|
brayJava/bray
|
d40c1878d4b93def8a1991261965663e91804643
|
3ffd52b13a1447bc94f24320607fa535df1a7a4e
|
refs/heads/master
| 2020-03-24T20:28:39.281546
| 2018-07-31T08:45:16
| 2018-07-31T08:45:16
| 142,980,114
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,509
|
java
|
package com.whiteplanet.admin.service.message.jg.push.model;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.whiteplanet.admin.service.message.jg.FastTests;
import com.whiteplanet.push.jg.push.model.Message;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@Category(FastTests.class)
public class MessageTest {
@Test(expected = IllegalArgumentException.class)
public void testIllegal() {
Message.newBuilder().build();
}
@Test
public void testMsgContent() {
Message message = Message.content("msg content");
JsonObject json = new JsonObject();
json.add("msg_content", new JsonPrimitive("msg content"));
assertThat(message.toJSON(), is((JsonElement) json));
}
@Test
public void testMsgContentAndExtras() {
Message message = Message.newBuilder()
.setMsgContent("msgContent")
.addExtra("key1", "value1")
.addExtra("key2", 222)
.addExtra("key3", Boolean.FALSE).build();
JsonObject json = new JsonObject();
json.add("msg_content", new JsonPrimitive("msgContent"));
JsonObject extras = new JsonObject();
extras.add("key1", new JsonPrimitive("value1"));
extras.add("key2", new JsonPrimitive(222));
extras.add("key3", new JsonPrimitive(Boolean.FALSE));
json.add("extras", extras);
assertThat(message.toJSON(), is((JsonElement) json));
}
@Test
public void testMsgContentAndExtrasMap() {
Map<String, String> extrasMap = new HashMap<String, String>();
extrasMap.put("key1", "value1");
extrasMap.put("key2", "value2");
Message message = Message.newBuilder()
.setMsgContent("msgContent")
.addExtras(extrasMap).build();
JsonObject json = new JsonObject();
json.add("msg_content", new JsonPrimitive("msgContent"));
JsonObject extras = new JsonObject();
extras.add("key1", new JsonPrimitive("value1"));
extras.add("key2", new JsonPrimitive("value2"));
json.add("extras", extras);
assertThat(message.toJSON(), is((JsonElement) json));
}
}
|
[
"1318134732@qq.com"
] |
1318134732@qq.com
|
27e8efcc36dfb742460c19d6a76279d3cfb3d4d6
|
bbdc5c336571646eabf7d83b7b92f043b3626d57
|
/ThirdProject/thirdproject/src/main/java/com/trkj/thirdproject/dao/FaqQuestionsDao.java
|
5b6457fe00cb021668c2a17827e6a7df2e563c34
|
[] |
no_license
|
zhoujiamin33/localProject
|
c02c2dab89e80440a08299e0964bc27fa8164585
|
f80f82747c49f6812f7932390cbf4aaac94589b3
|
refs/heads/main
| 2023-05-31T04:01:46.965947
| 2021-07-01T03:17:22
| 2021-07-01T03:17:22
| 373,410,727
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 952
|
java
|
package com.trkj.thirdproject.dao;
import com.trkj.thirdproject.entity.FaqQuestions;
import com.trkj.thirdproject.entity.Source;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
@Mapper
public interface FaqQuestionsDao {
int deleteByPrimaryKey(Integer faqId);
//新增
int insert(FaqQuestions record);
//删除--修改时效性
int delstuFaqTime(@Param("faqId" ) int FAQ_Id, @Param( "deletename") String DeleteName, @Param("deletetime") Date DeleteTime);
int insertSelective(FaqQuestions record);
FaqQuestions selectByPrimaryKey(Integer faqId);
int updateByPrimaryKeySelective(FaqQuestions record);
int updateByPrimaryKey(FaqQuestions record);
List<FaqQuestions> selectAIIFaqQuestions();
// FAQ模糊查询
List<FaqQuestions> selectFaqFuzzyquery(@Param("value")String value, @Param("input") String input);
}
|
[
"1486964584@qq.com"
] |
1486964584@qq.com
|
f4dc27cf32a9e50e97ccd757546083c44e252eec
|
e123baad041d4eb9c7809801643f52a5e660df42
|
/src/org/traccar/protocol/TeltonikaProtocol.java
|
f944c3003637dcd796fdcbcb6a02e52e2bf7557d
|
[
"Apache-2.0"
] |
permissive
|
vladyslavyatsun/traccar
|
eb4dab41b52f02fc85d124a6ca864bb933f66165
|
b2e883f9eac211a951b6ca2b0e91e9f27b133f36
|
refs/heads/master
| 2021-01-01T03:45:46.810129
| 2016-05-06T13:56:44
| 2016-05-06T13:56:44
| 59,423,202
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,833
|
java
|
/*
* Copyright 2015 - 2016 Anton Tananaev (anton.tananaev@gmail.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.traccar.protocol;
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.traccar.BaseProtocol;
import org.traccar.TrackerServer;
import java.util.List;
public class TeltonikaProtocol extends BaseProtocol {
public TeltonikaProtocol() {
super("teltonika");
}
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ServerBootstrap(), this.getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new TeltonikaFrameDecoder());
pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(TeltonikaProtocol.this));
}
});
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), this.getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(TeltonikaProtocol.this));
}
});
}
}
|
[
"anton.tananaev@gmail.com"
] |
anton.tananaev@gmail.com
|
a2f2f639f2ed72db1d0dea6c6b8c16d881b08a95
|
a542cc8ac574c03ae25bcda140cf345babb14ffe
|
/main/no.tdt4250.project.pokeDex.model/src/domain/impl/GenusImpl.java
|
07e48083c700707cf82bffacad6ba4b26e36b899
|
[] |
no_license
|
oddaspa/TDT4250-PokeDex
|
568918ad9ff61347df24ddae72436ba30e8de568
|
44f6bdde13aef8dfe3224899f7d9d3ae8605d71c
|
refs/heads/master
| 2020-08-27T07:22:04.870159
| 2019-12-01T19:44:08
| 2019-12-01T19:44:08
| 217,281,666
| 1
| 2
| null | 2019-12-01T13:56:02
| 2019-10-24T11:22:26
|
Java
|
UTF-8
|
Java
| false
| false
| 9,066
|
java
|
/**
*/
package domain.impl;
import domain.DomainPackage;
import domain.Genus;
import domain.Species;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Genus</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link domain.impl.GenusImpl#getSpecies <em>Species</em>}</li>
* <li>{@link domain.impl.GenusImpl#getName <em>Name</em>}</li>
* <li>{@link domain.impl.GenusImpl#getHabitat <em>Habitat</em>}</li>
* <li>{@link domain.impl.GenusImpl#getSameAnatomy <em>Same Anatomy</em>}</li>
* <li>{@link domain.impl.GenusImpl#getAnatomy <em>Anatomy</em>}</li>
* </ul>
*
* @generated
*/
public class GenusImpl extends MinimalEObjectImpl.Container implements Genus {
/**
* The cached value of the '{@link #getSpecies() <em>Species</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSpecies()
* @generated
* @ordered
*/
protected EList<Species> species;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getHabitat() <em>Habitat</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHabitat()
* @generated
* @ordered
*/
protected static final String HABITAT_EDEFAULT = null;
/**
* The cached value of the '{@link #getHabitat() <em>Habitat</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHabitat()
* @generated
* @ordered
*/
protected String habitat = HABITAT_EDEFAULT;
/**
* The cached value of the '{@link #getSameAnatomy() <em>Same Anatomy</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSameAnatomy()
* @generated
* @ordered
*/
protected EList<Genus> sameAnatomy;
/**
* The default value of the '{@link #getAnatomy() <em>Anatomy</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnatomy()
* @generated
* @ordered
*/
protected static final String ANATOMY_EDEFAULT = null;
/**
* The cached value of the '{@link #getAnatomy() <em>Anatomy</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnatomy()
* @generated
* @ordered
*/
protected String anatomy = ANATOMY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GenusImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DomainPackage.Literals.GENUS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Species> getSpecies() {
if (species == null) {
species = new EObjectContainmentEList<Species>(Species.class, this, DomainPackage.GENUS__SPECIES);
}
return species;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DomainPackage.GENUS__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getHabitat() {
return habitat;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setHabitat(String newHabitat) {
String oldHabitat = habitat;
habitat = newHabitat;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DomainPackage.GENUS__HABITAT, oldHabitat, habitat));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Genus> getSameAnatomy() {
if (sameAnatomy == null) {
sameAnatomy = new EObjectResolvingEList<Genus>(Genus.class, this, DomainPackage.GENUS__SAME_ANATOMY);
}
return sameAnatomy;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getAnatomy() {
return anatomy;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setAnatomy(String newAnatomy) {
String oldAnatomy = anatomy;
anatomy = newAnatomy;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DomainPackage.GENUS__ANATOMY, oldAnatomy, anatomy));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DomainPackage.GENUS__SPECIES:
return ((InternalEList<?>)getSpecies()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case DomainPackage.GENUS__SPECIES:
return getSpecies();
case DomainPackage.GENUS__NAME:
return getName();
case DomainPackage.GENUS__HABITAT:
return getHabitat();
case DomainPackage.GENUS__SAME_ANATOMY:
return getSameAnatomy();
case DomainPackage.GENUS__ANATOMY:
return getAnatomy();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DomainPackage.GENUS__SPECIES:
getSpecies().clear();
getSpecies().addAll((Collection<? extends Species>)newValue);
return;
case DomainPackage.GENUS__NAME:
setName((String)newValue);
return;
case DomainPackage.GENUS__HABITAT:
setHabitat((String)newValue);
return;
case DomainPackage.GENUS__SAME_ANATOMY:
getSameAnatomy().clear();
getSameAnatomy().addAll((Collection<? extends Genus>)newValue);
return;
case DomainPackage.GENUS__ANATOMY:
setAnatomy((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DomainPackage.GENUS__SPECIES:
getSpecies().clear();
return;
case DomainPackage.GENUS__NAME:
setName(NAME_EDEFAULT);
return;
case DomainPackage.GENUS__HABITAT:
setHabitat(HABITAT_EDEFAULT);
return;
case DomainPackage.GENUS__SAME_ANATOMY:
getSameAnatomy().clear();
return;
case DomainPackage.GENUS__ANATOMY:
setAnatomy(ANATOMY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DomainPackage.GENUS__SPECIES:
return species != null && !species.isEmpty();
case DomainPackage.GENUS__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case DomainPackage.GENUS__HABITAT:
return HABITAT_EDEFAULT == null ? habitat != null : !HABITAT_EDEFAULT.equals(habitat);
case DomainPackage.GENUS__SAME_ANATOMY:
return sameAnatomy != null && !sameAnatomy.isEmpty();
case DomainPackage.GENUS__ANATOMY:
return ANATOMY_EDEFAULT == null ? anatomy != null : !ANATOMY_EDEFAULT.equals(anatomy);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", habitat: ");
result.append(habitat);
result.append(", anatomy: ");
result.append(anatomy);
result.append(')');
return result.toString();
}
} //GenusImpl
|
[
"odd.gunnar.aspaas@gmail.com"
] |
odd.gunnar.aspaas@gmail.com
|
ddc60593002e20732454fdaaa7b6322cd8339d3e
|
246f2be1162532f2efb1a477b4b88aadcfc81524
|
/results/okhttp/1151c9853ccc3c9c3211c613b9b845b925f8c6a6/transformed/evosuite_12/evosuite-tests/com/squareup/okhttp/internal/bytes/GzipSource_ESTest.java
|
d028494b72052e301004936dffbe0bfa78fdda10
|
[] |
no_license
|
semantic-conflicts/SemanticConflicts
|
4d2f05bf2e5fa289233429ed8f1614b0b14c2e5e
|
c5684bbde00dfbd27c828b5798edbec0e284597a
|
refs/heads/master
| 2022-12-05T03:11:57.983183
| 2020-08-25T13:54:24
| 2020-08-25T13:54:24
| 267,826,586
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,155
|
java
|
/*
* This file was automatically generated by EvoSuite
* Mon May 25 21:57:14 GMT 2020
*/
package com.squareup.okhttp.internal.bytes;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.squareup.okhttp.internal.bytes.OkBuffer;
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 GzipSource_ESTest extends GzipSource_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
OkBuffer okBuffer0 = new OkBuffer();
// Undeclared exception!
try {
okBuffer0.getByte((-860L));
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.squareup.okhttp.internal.Util", e);
}
}
}
|
[
"semantic.conflicts@gmail.com"
] |
semantic.conflicts@gmail.com
|
5c006062d68ebb89f922f2744b70ccc38e36ba23
|
76baceccda28dd75f3da4ddeb0cf1f2d5899b228
|
/DECORATOR/20190908/src/PlainPizza.java
|
0461f3786d1d8f19b2d6c0c6f3802d8c3f2a58dc
|
[] |
no_license
|
escort94/JavaDesignPattern
|
722adc813ac16030855a0a198ff7eee34382241e
|
bae23d28eb4f76fd882424eca7d6567eec6a12d7
|
refs/heads/master
| 2022-06-12T18:55:23.488233
| 2020-05-08T02:57:00
| 2020-05-08T02:57:00
| 262,198,567
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 315
|
java
|
public class PlainPizza implements Pizza {
@Override
public String getDescription() {
// TODO Auto-generated method stub
return "Thin dough";
}
@Override
public double getCost() {
// TODO Auto-generated method stub
System.out.println("Cost of Dough: " + 4.00);
return 4.00;
}
}
|
[
"mgjang@net1.co.kr"
] |
mgjang@net1.co.kr
|
be28ac2fe102dd5168a40dcd34c248bec4766777
|
5195c69a06f724447342ea0e3353fd542761d7d9
|
/src/main/java/com/mycompany/ucomp/security/package-info.java
|
35063f4e37447fb91a38789a3e4facfeb7b6ca1b
|
[] |
no_license
|
brahim596/UCompAdmin
|
495ce5a13a35f4f170f7fa43699032b7c121c845
|
89270193da839993fe698f547ea07773ac223b99
|
refs/heads/master
| 2022-12-22T13:54:02.524784
| 2020-03-06T09:56:31
| 2020-03-06T09:56:31
| 245,384,663
| 0
| 0
| null | 2022-12-16T05:13:25
| 2020-03-06T09:55:30
|
Java
|
UTF-8
|
Java
| false
| false
| 80
|
java
|
/**
* Spring Security configuration.
*/
package com.mycompany.ucomp.security;
|
[
"jhipster-bot@jhipster.tech"
] |
jhipster-bot@jhipster.tech
|
3230b7f130cf80fe275fbfb89fc281af80d4b015
|
93cebdfdc1f989596f466aacffcb8e84878c0ce9
|
/app/src/main/java/mrc/appdichat/RequestsFragment.java
|
4fa485c103ff693027f873a2c386fcdeab2736fc
|
[] |
no_license
|
mrc03/Appdichat
|
fa419566fdc71467c1680372fe6e4641194bd4bd
|
bd04aaa0af9ed91765d47c068273566c2723a3d2
|
refs/heads/master
| 2021-12-12T22:02:28.019535
| 2021-10-02T14:57:20
| 2021-10-02T14:57:20
| 133,120,688
| 4
| 1
| null | 2021-10-02T14:57:21
| 2018-05-12T06:34:33
|
Java
|
UTF-8
|
Java
| false
| false
| 5,858
|
java
|
package mrc.appdichat;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Callback;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* A simple {@link Fragment} subclass.
*/
public class RequestsFragment extends android.support.v4.app.Fragment {
private RecyclerView recyclerView;
private View mView;
private DatabaseReference friendsDatabaseReference;
private DatabaseReference usersDatabaseReference;
// private final int color = getResources().getColor(R.color.colorPrimaryDark); WILL NOT WORK.
public RequestsFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
mView = inflater.inflate(R.layout.fragment_requests, container, false);
recyclerView = mView.findViewById(R.id.req_recycle_view);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
friendsDatabaseReference = FirebaseDatabase.getInstance().getReference().child("Friends_request").
child(FirebaseAuth.getInstance().getUid());
friendsDatabaseReference.keepSynced(true);
usersDatabaseReference = FirebaseDatabase.getInstance().getReference().child("Users");
usersDatabaseReference.keepSynced(true);
return mView;
}
@Override
public void onStart() {
super.onStart();
FirebaseRecyclerAdapter<Requests, RequestsViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Requests, RequestsViewHolder>
(
Requests.class, R.layout.users_single_row, RequestsViewHolder.class, friendsDatabaseReference
) {
@Override
protected void populateViewHolder(final RequestsViewHolder viewHolder, final Requests model, final int position) {
String otherId = getRef(position).getKey();
usersDatabaseReference.child(otherId).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String name = dataSnapshot.child("name").getValue().toString();
String image = dataSnapshot.child("image").getValue().toString();
viewHolder.setName(name);
viewHolder.setImage(getContext(), image);
viewHolder.setType(model.getRequest_type(), getActivity().getResources().getColor(R.color.colorPrimaryDark));
viewHolder.view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String user_id = getRef(position).getKey();
Intent profileIntent = new Intent(getContext(), ProfileActivity.class);
profileIntent.putExtra("key", user_id);
startActivity(profileIntent);
}
});
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
};
recyclerView.setAdapter(firebaseRecyclerAdapter);
}
public static class RequestsViewHolder extends RecyclerView.ViewHolder {
private View view;
public RequestsViewHolder(View itemView) {
super(itemView);
view = itemView;
}
public void setName(String name) {
TextView textView = view.findViewById(R.id.single_display_name);
textView.setText(name);
}
public void setType(String type, int color) {
if (type.equalsIgnoreCase("sent")) {
TextView textView = view.findViewById(R.id.single_status);
textView.setText("Status: " + type);
} else {
TextView textView = view.findViewById(R.id.single_status);
textView.setTextColor(color);
textView.setText("Status: " + type);
}
}
public void setImage(final Context context, final String image) {
final CircleImageView circleImageView = view.findViewById(R.id.single_image_view);
Picasso.with(context).load(image).placeholder(R.drawable.defaultprofile).
networkPolicy(NetworkPolicy.OFFLINE).into(circleImageView, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
Picasso.with(context).load(image).placeholder(R.drawable.defaultprofile).
into(circleImageView);
}
});
}
}
}
|
[
"mehrotraraj03@gmail.com"
] |
mehrotraraj03@gmail.com
|
27aecc85404a485cbe11c5821ab2de81bde7130a
|
7973c468698be93d8272d9ded842c372f63db8bd
|
/engineer/src/main/java/com/weido/engineer/repository/RolesRepository.java
|
ee4df023754d6cfbb9ccaf20bfc15260f23633ca
|
[] |
no_license
|
StandardStudent/SpringbootWedo
|
5d2838b942c7bae5c9112fb399098e25d74cde6c
|
351fa363ccafaeb2261c8e48d683ffc93fb97ea1
|
refs/heads/master
| 2020-03-25T23:09:39.177570
| 2018-09-06T03:19:23
| 2018-09-06T03:19:23
| 144,261,267
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 215
|
java
|
package com.weido.engineer.repository;
import com.weido.engineer.pojo.Roles;
import org.springframework.data.jpa.repository.JpaRepository;
public interface RolesRepository extends JpaRepository<Roles,Integer> {
}
|
[
"602487266@qq.com"
] |
602487266@qq.com
|
e68ec4e0b93ddf15d135eef5210ffb605e485015
|
b9fe4bd1e95478d8a9e05ffc10b7aba498de7bc7
|
/java_study/chapter03/src/CompareOperatorExample2.java
|
262008f33738b601a69136ca7ab22c46b71d04d9
|
[] |
no_license
|
su-bin/TIL
|
68bc6549138dcd607eac39db1c894374c197efa9
|
a661d4c135f793d0216ef5ebdbafdbfb76964da6
|
refs/heads/master
| 2021-07-09T19:00:41.685835
| 2020-07-04T06:39:32
| 2020-07-04T06:39:32
| 147,136,153
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 429
|
java
|
public class CompareOperatorExample2 {
public static void main(String[] args) {
int v2 = 1;
double v3 = 1.0;
System.out.println(v2 == v3); // true
double v4 = 0.1;
float v5 = 0.1f;
System.out.println(v4 == v5); // false
System.out.println((float)v4 == v5); // true
System.out.println((int)(v4 * 10) == (int)(v5 * 10)); // true
}
}
|
[
"sblee6728@gmail.com"
] |
sblee6728@gmail.com
|
6230a30569f82341dcd9dd974c6a619b05ebc6ca
|
54bf8c0ad778f981f6c1a1e9ae9a74734a7794be
|
/src/main/java/com/example/keycloakapi/permission/PermissionsClient.java
|
fe3dd913c3f4cb6f15043c8930a073d8ce5505df
|
[] |
no_license
|
sharifyy/keycloak-admin-client
|
b3f73f98513e7e703b65908431a00d59756f118c
|
986e538eb904840298c4555882318f5b2f7a9997
|
refs/heads/master
| 2023-07-25T12:07:39.868362
| 2021-09-07T10:32:15
| 2021-09-07T10:32:15
| 403,936,572
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 10,798
|
java
|
package com.example.keycloakapi.permission;
import com.example.keycloakapi.mapper.PolicyMapper;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.resource.AuthorizationResource;
import org.keycloak.admin.client.resource.PoliciesResource;
import org.keycloak.admin.client.resource.PolicyResource;
import org.keycloak.representations.idm.authorization.*;
import org.springframework.stereotype.Service;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@Service
public final class PermissionsClient implements PermissionService {
private final Keycloak keycloak;
private final PolicyMapper policyMapper;
public PermissionsClient(Keycloak keycloak, PolicyMapper policyMapper) {
this.keycloak = keycloak;
this.policyMapper = policyMapper;
}
@Override
public List<PolicyRepresentation> getAllPermissions(String realm, String clientHexId) {
return client(realm, clientHexId)
.policies()
.policies()
.stream()
.filter(policy -> policy.getType().equals("scope") || policy.getType().equals("resource"))
.collect(Collectors.toList());
}
@Override
public PolicyRepresentation getPermissionById(String realm, String clientHexId, String permissionId) {
PolicyResource policyResource = client(realm, clientHexId)
.policies()
.policy(permissionId);
PolicyRepresentation policy = policyResource.toRepresentation();
if (!policy.getType().equals("scope") && !policy.getType().equals("resource")) {
throw new NotFoundException("no permission found");
}
Set<String> policies = policyResource.associatedPolicies().stream().map(AbstractPolicyRepresentation::getName).collect(Collectors.toSet());
policy.setPolicies(policies);
if (policy.getType().equals("scope")) {
Set<String> scopes = policyResource.scopes().stream().map(ScopeRepresentation::getName).collect(Collectors.toSet());
policy.setScopes(scopes);
return policy;
}
Set<String> resources = policyResource.resources().stream().map(ResourceRepresentation::getName).collect(Collectors.toSet());
policy.setResources(resources);
return policy;
}
@Override
public Response createPermission(String realm, String clientHexId, PermissionCommand permissionCommand) {
return client(realm, clientHexId)
.policies()
.create(policyMapper.permissionDTOtoPolicyRepresentation(permissionCommand));
}
@Override
public void deletePermission(String realm, String clientHexId, String permissionId) {
client(realm, clientHexId)
.policies().policy(permissionId).remove();
}
@Override
public void updatePermission(String realm, String id, PermissionCommand permissionCommand) {
client(realm, id)
.policies()
.policy(permissionCommand.getId())
.update(policyMapper.permissionDTOtoPolicyRepresentation(permissionCommand));
}
@Override
public void addGroupsToPermission(String realm, String clientHexId, GroupPermissionDTO groupPermissionDTO) {
final PoliciesResource policiesResource = client(realm, clientHexId).policies();
final PolicyResource policyResource = policiesResource.policy(groupPermissionDTO.getPermissionId());
PolicyRepresentation permission = policyResource.toRepresentation();
if (!permission.getType().equals("scope") && !permission.getType().equals("resource")) {
throw new NotFoundException("no permission found");
}
Set<String> associatedPolicies = policyResource.associatedPolicies().stream()
.filter(policyRepresentation -> policyRepresentation.getType().equals("group"))
.map(AbstractPolicyRepresentation::getName)
.collect(Collectors.toSet());
for (GroupPermissionDTO.Group group : groupPermissionDTO.getGroups()) {
if (!associatedPolicies.contains("Policy_" + group.getName())) {
policyExists(policiesResource, "Policy_" + group.getName())
.ifPresentOrElse(existingPolicy -> {
associatedPolicies.add(existingPolicy.getId());
updatePermission(policiesResource, permission, associatedPolicies);
},
() -> createGroupPolicy(policiesResource, group).ifPresent(
createdPolicy -> {
associatedPolicies.add(createdPolicy.getId());
updatePermission(policiesResource, permission, associatedPolicies);
}
)
);
}
}
}
@Override
public void addRolesToPermission(String realm, String clientHexId, RolePermissionDTO rolePermissionDTO) {
final PoliciesResource policiesResource = client(realm, clientHexId).policies();
final PolicyResource policyResource = policiesResource.policy(rolePermissionDTO.getPermissionId());
PolicyRepresentation permission = policyResource.toRepresentation();
if (!permission.getType().equals("scope") && !permission.getType().equals("resource")) {
throw new NotFoundException("no permission found");
}
Set<String> associatedPolicies = policyResource.associatedPolicies().stream()
.filter(policyRepresentation -> policyRepresentation.getType().equals("role"))
.map(AbstractPolicyRepresentation::getName)
.collect(Collectors.toSet());
for (RolePermissionDTO.Role role : rolePermissionDTO.getRoles()) {
if (!associatedPolicies.contains("Policy_" + role.getName())) {
policyExists(policiesResource, "Policy_" + role.getName())
.ifPresentOrElse(existingPolicy -> {
associatedPolicies.add(existingPolicy.getId());
updatePermission(policiesResource, permission, associatedPolicies);
},
() -> createRolePolicy(policiesResource, role).ifPresent(
createdPolicy -> {
associatedPolicies.add(createdPolicy.getId());
updatePermission(policiesResource, permission, associatedPolicies);
}
)
);
}
}
}
private void updatePermission(final PoliciesResource policiesResource, PolicyRepresentation permission, Set<String> associatedPolicies) {
permission.setPolicies(associatedPolicies);
policiesResource.policy(permission.getId()).update(permission);
}
private Optional<PolicyRepresentation> createRolePolicy(final PoliciesResource policiesResource, RolePermissionDTO.Role role) {
RolePolicyRepresentation rolePolicyRepresentation = new RolePolicyRepresentation();
rolePolicyRepresentation.setName("Policy_" + role.getName());
rolePolicyRepresentation.setRoles(Set.of(new RolePolicyRepresentation.RoleDefinition(role.getId(), true)));
try (Response response = policiesResource.role().create(rolePolicyRepresentation)) {
if (response.getStatus() == 201) {
return policyExists(policiesResource, rolePolicyRepresentation.getName());
} else {
throw new RuntimeException(response.getStatusInfo().getReasonPhrase());
}
}
}
private Optional<PolicyRepresentation> createGroupPolicy(final PoliciesResource policiesResource, GroupPermissionDTO.Group group) {
GroupPolicyRepresentation groupPolicyRepresentation = new GroupPolicyRepresentation();
groupPolicyRepresentation.setName("Policy_" + group.getName());
groupPolicyRepresentation.setGroupsClaim("groups");
groupPolicyRepresentation.setGroups(Set.of(new GroupPolicyRepresentation.GroupDefinition(group.getId(), false)));
try (Response response = policiesResource.group().create(groupPolicyRepresentation)) {
if (response.getStatus() == 201) {
return policyExists(policiesResource, groupPolicyRepresentation.getName());
} else {
throw new RuntimeException(response.getStatusInfo().getReasonPhrase());
}
}
}
private Optional<PolicyRepresentation> policyExists(final PoliciesResource policiesResource, String policyName) {
try {
return Optional.ofNullable(policiesResource.findByName(policyName));
} catch (NotFoundException ex) {
return Optional.empty();
}
}
@Override
public void removeRoles(String realm, String clientHexId, RolePermissionDTO rolePermissionDTO) {
PolicyResource policyResource = client(realm, clientHexId)
.policies()
.policy(rolePermissionDTO.getPermissionId());
PolicyRepresentation permission = policyResource.toRepresentation();
if (!permission.getType().equals("scope") && !permission.getType().equals("resource")) {
throw new NotFoundException("no permission found");
}
Set<String> policyNames = rolePermissionDTO.getRoles()
.stream()
.map(RolePermissionDTO.Role::getName)
.map(name -> "Policy_" + name)
.collect(Collectors.toSet());
Set<String> associatedPolicies = policyResource.associatedPolicies()
.stream()
.filter(policyRepresentation -> policyRepresentation.getType().equals("role"))
.filter(policyRepresentation -> !policyNames.contains(policyRepresentation.getName()))
.map(AbstractPolicyRepresentation::getId)
.collect(Collectors.toSet());
permission.setPolicies(associatedPolicies);
client(realm, clientHexId)
.policies()
.policy(permission.getId())
.update(permission);
}
private AuthorizationResource client(String realm, String clientHexId) {
return keycloak.realm(realm)
.clients().get(clientHexId)
.authorization();
}
}
|
[
"sharifyy@gmail.com"
] |
sharifyy@gmail.com
|
c403fd42de267b4570cfe5257a29f88f259b8690
|
82db1a4b7eae62017a25b348898e790cd4ba9c76
|
/src/main/java/lk/wiley/travellodge/TravellodgeApplication.java
|
de4c6d9cfd3761f9c01d9f0af348fe9c6ba29d77
|
[] |
no_license
|
ShehanThamoda/travel-lodge-system
|
ed30cbf0b96256f911e020c2050c064be9d10bba
|
163d093cbe9b682e4edf14864359bc4816b9cba5
|
refs/heads/main
| 2023-05-13T15:51:44.732004
| 2021-06-07T17:55:43
| 2021-06-07T17:55:43
| 374,752,031
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 407
|
java
|
package lk.wiley.travellodge;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
public class TravellodgeApplication {
public static void main(String[] args) {
SpringApplication.run(TravellodgeApplication.class, args);
}
}
|
[
"thamodashehan92@gmail.com"
] |
thamodashehan92@gmail.com
|
d457db94943a700d2f85fd12eeba8232d046aa6d
|
8b0ac2e93c84942a28a8420b52e18e5e31b7d06b
|
/coffemachineryRestAPI/src/main/java/com/iths/coffeemachineryAPI/domain/Customer.java
|
2144d06c45c1b522e9023b881a8738da59189eb9
|
[] |
no_license
|
johannes9108/vue-airbean
|
2f7715175ea77b9e3ff8ffb2c3f4c326d21c72cd
|
29de720d586a08d0bba6edd50bffce105df46f13
|
refs/heads/master
| 2022-10-07T04:10:24.052734
| 2020-06-01T20:55:40
| 2020-06-01T20:55:40
| 267,005,497
| 0
| 0
| null | 2020-05-26T09:52:06
| 2020-05-26T09:52:05
| null |
UTF-8
|
Java
| false
| false
| 937
|
java
|
package com.iths.coffeemachineryAPI.domain;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonIgnoreType;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@NoArgsConstructor
@Data
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private String email;
private String password;
@OneToMany(cascade = {CascadeType.ALL})
private List<CustomerOrder> orders = new ArrayList<CustomerOrder>();
}
|
[
"54702667+EHeijer@users.noreply.github.com"
] |
54702667+EHeijer@users.noreply.github.com
|
85d1d15e7e6bb4748d01da51845f4c9e67888325
|
cad75a693350ce02691000822cc6bc9ee378ef84
|
/atf-eplug/src/eu/atac/atf/test/ocl/pattern/PPatternRegex.java
|
d134ec97f65257d29ef7e09b22113322a82269ff
|
[
"BSD-3-Clause"
] |
permissive
|
ryselis/atf
|
d9a360bf3850f2af3dd1000a44fef1703185de8a
|
861d700df973f6e01169a7ab53f9a3a19d0bee54
|
refs/heads/master
| 2020-12-28T21:17:44.768018
| 2015-02-25T20:51:16
| 2015-02-25T20:51:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,220
|
java
|
package eu.atac.atf.test.ocl.pattern;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import tudresden.ocl20.pivot.essentialocl.expressions.impl.ExpressionInOclImpl;
import tudresden.ocl20.pivot.essentialocl.expressions.impl.StringLiteralExpImpl;
import tudresden.ocl20.pivot.essentialocl.expressions.impl.VariableExpImpl;
import tudresden.ocl20.pivot.essentialocl.expressions.impl.VariableImpl;
import eu.atac.atf.main.ATF;
import eu.atac.atf.main.ATFTestModel;
import eu.atac.atf.main.OCLConstraint;
import eu.atac.atf.test.metadata.SAssertion;
import eu.atac.atf.test.metadata.SComment;
import eu.atac.atf.test.metadata.SVariable;
import eu.sarunas.atf.generators.tests.RandomGenerator;
/**
*
* ExpressionInOclImpl - inv invariant_IPE:name.RegExpMatch('[1-9][0-9]{3}')
* OperationCallExpImpl - RegExpMatch
* PropertyCallExpImpl - String name
* VariableExpImpl - self
* StringLiteralExpImpl - [1-9][0-9]{3}
* VariableImpl - self
*/
public class PPatternRegex extends ConstrainPatternBase {
private ConstrainPatternElementBase[] pattern;
public PPatternRegex(){
pattern = new ConstrainPatternElementBase[]{
new PESimpleClass(ExpressionInOclImpl.class),
new PEOperationCall("RegExpMatch"),
new PEPropertyCall("String"),
new PESimpleClass(VariableExpImpl.class,1,1),
new PESimpleClass(StringLiteralExpImpl.class,1,1),
new PESimpleClass(VariableImpl.class,1,1),
};
}
@Override
public ConstrainPatternElementBase[] getPattern() {
return pattern;
}
@Override
public void generatePre(OCLConstraint constraint,ATFTestModel atfTestModel) {
try {
// *0 ExpressionInOclImpl - inv invariant_IPE:name.RegExpMatch('[1-9][0-9]{3}')
// *1 OperationCallExpImpl - RegExpMatch
// *2 PropertyCallExpImpl - String name
// *3 VariableExpImpl - self
// *4 StringLiteralExpImpl - [1-9][0-9]{3}
// *5 VariableImpl - self
List<EObject> list = constraint.getEobjectList();
String regex = ((StringLiteralExpImpl)list.get(4)).getStringSymbol();
SVariable variable = atfTestModel.getSmethod().findVariable(ATF.VARIAVLE_ID_TEST_OBJECT);
String expr = variable.getName() + parsePropertyCallChain(atfTestModel,list,2,false);
String commment = expr + "(\"" + RandomGenerator.getInstance().randomRegexString(regex) + "\");";
SComment com1 = new SComment(commment);
com1.setNotcomment(true);
atfTestModel.getSmethod().addBodyElement(com1);
} catch (Exception e) {
ATF.log(e);
}
}
@Override
public void generateInvariant(OCLConstraint constraint,ATFTestModel atfTestModel) {
List<EObject> list = constraint.getEobjectList();
String regex = ((StringLiteralExpImpl)list.get(4)).getStringSymbol();
SVariable variable = atfTestModel.getSmethod().findVariable(ATF.VARIAVLE_ID_TEST_OBJECT);
String expr = variable.getName() + parsePropertyCallChain(atfTestModel,list,2,true);
String assertion = expr + "().matches(\"" + regex +"\")";
SAssertion invAssertion = new SAssertion(assertion);
atfTestModel.getSmethod().addBodyElement(invAssertion);
}
}
|
[
"drme@users.noreply.github.com"
] |
drme@users.noreply.github.com
|
b2abebbee2ec06dccb805d7896085d31b9bfb2e0
|
bd91a45df4da31ccd226a6d72e30092265f604c0
|
/JavaClass/src/assignmenr/Dog.java
|
d08a0d70ff72ca1bc9a0e3dcf612a03c1b2b70cf
|
[] |
no_license
|
valla-ranga/RemoteRepository
|
16da5b73b6b5fdaae1015faf0dab936c88c67ebc
|
543995fe1a4e7db7719ec571e754facd6a212d6a
|
refs/heads/master
| 2021-01-10T02:09:02.088690
| 2015-11-30T21:50:12
| 2015-11-30T21:50:12
| 47,148,340
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 280
|
java
|
package assignmenr;
public class Dog extends Animal{
String action;
public Dog(String name, String type,String action) {
super(name,type);
this.action = action;
// TODO Auto-generated constructor stub
}
public dogAction()
{
}
}
|
[
"valla_ranga@hotmail.com"
] |
valla_ranga@hotmail.com
|
aacb8c30a5f3e26a2b5163f6e3e4a1ae4e62e213
|
ee3270f4c0775fad47c1ec18c2130c0da9c33c38
|
/BBS/src/co/hj/board/command/MemberInsertAction.java
|
f522052a13b01c198db77c07b97c9aebb1b1dd78
|
[] |
no_license
|
choihyeongjun/jsp
|
1f25f26aba5cc0d6ec3a1692f4ff6ffd9501291f
|
e9cc15e37079884ad452be22dac19e5ed27abf8c
|
refs/heads/master
| 2023-01-11T08:25:28.569728
| 2020-11-02T08:19:07
| 2020-11-02T08:19:07
| 305,962,146
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,117
|
java
|
package co.hj.board.command;
import java.io.File;
import java.io.IOException;
import java.sql.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import co.hj.board.common.Action;
import co.hj.board.common.FileRenamePolicy;
import co.hj.board.common.FileUtil;
import co.hj.board.dao.MemberDAO;
import co.hj.board.vo.MemberVO;
public class MemberInsertAction implements Action {
@Override
public String exec(HttpServletRequest request, HttpServletResponse response) {
//회원정보를 db에 입력하기
MemberDAO dao=new MemberDAO();
MemberVO vo=new MemberVO();
vo.setId(request.getParameter("id"));
vo.setName(request.getParameter("name"));
vo.setPassword(request.getParameter("password"));
vo.setAddress(request.getParameter("address"));
vo.setTel(request.getParameter("tel"));
vo.setEnterdate(Date.valueOf(request.getParameter("enterdate")));
String appPath = request.getServletContext().getRealPath("/images");
System.out.println(appPath);
try {
for (Part part : request.getParts()) { //첨부파일을 읽어온다
String fileName = FileUtil.extractFileName(part); //파일이 존재하면
if(!fileName.equals("")) {
//파일명중복체크
String uploadFile = appPath + File.separator + fileName;
File renameFile=FileRenamePolicy.rename(new File(uploadFile));
part.write(renameFile.getAbsolutePath());
vo.setImg(renameFile.getName());
//1:다 관계로 등록 filetable.insert(filevo);
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int n=dao.insert(vo);
request.setAttribute("check", n);
String page;
if(n!=0) {
page="jsp/member/insertSuccess.jsp";
}
else
{
page="jsp/member/InsertFail.jsp";
}
return page;
}
}
|
[
"chj5156@naver.com"
] |
chj5156@naver.com
|
47e2ae9d5e810e13ff746cda615f3598e56c6c80
|
c4e2e1ed3367aeca99b7b4f75a5dd62753173607
|
/app/src/main/java/com/dj/pedofit/preferences/BodyWeightPreference.java
|
bfb8904a8e8d553ccb5159229c9c0e3179ff6707
|
[] |
no_license
|
dhananjaikajal/PedoFit
|
0ae7c3dbd23d4761346dd4feed3112e3a2305059
|
7d40ff442927c7fb4859f78c0c942d82d7647fe1
|
refs/heads/master
| 2021-01-10T12:02:43.133015
| 2015-06-04T15:23:36
| 2015-06-04T15:23:36
| 36,876,968
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 720
|
java
|
package com.dj.pedofit.preferences;
import com.dj.pedofit.R;
import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;
public class BodyWeightPreference extends EditMeasurementPreference {
public BodyWeightPreference(Context context) {
super(context);
}
public BodyWeightPreference(Context context, AttributeSet attr) {
super(context, attr);
}
public BodyWeightPreference(Context context, AttributeSet attr, int defStyle) {
super(context, attr, defStyle);
}
protected void initPreferenceDetails() {
mTitleResource = R.string.body_weight_setting_title;
mMetricUnitsResource = R.string.kilograms;
mImperialUnitsResource = R.string.pounds;
}
}
|
[
"dhananjaikajal@gmail.com"
] |
dhananjaikajal@gmail.com
|
53888b80029bfdf72ed8626cb7a21e0344039189
|
6f01287dceeeba26b04173748b9fa5625d47d445
|
/day01/ex02/src/UsersArrayList.java
|
d0d1c513df1f4aa1f5fa1d0f9a9e1eb442c847dc
|
[] |
no_license
|
Go0dluck/JavaPool
|
4f5b0e07e96a134e61711912e4ca6a198deab386
|
4bbc6b2ea34937858253a77d58fc908ab2e6ef09
|
refs/heads/master
| 2023-04-26T19:51:34.145446
| 2021-06-01T17:45:59
| 2021-06-01T17:45:59
| 372,915,392
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,357
|
java
|
public class UsersArrayList implements UsersList{
private User[] UsersArr;
private int Size;
public UsersArrayList() {
UsersArr = new User[10];
}
@Override
public void AddUser(String name) {
if (UsersArr.length == Size){
User[] UsersArrNew = new User[UsersArr.length + UsersArr.length / 2];
for (int i = 0; i < UsersArr.length; i++){
UsersArrNew[i] = UsersArr[i];
}
UsersArr = UsersArrNew;
}
for (int i = 0; i < UsersArr.length; i++){
if (UsersArr[i] == null){
UsersArr[i] = new User(name);
Size++;
return;
}
}
}
@Override
public User RetrieveUserId(int id) throws UserNotFoundException {
for (int i = 0; i < UsersArr.length; i++){
if (UsersArr[i] == null)
break;
if (UsersArr[i].getIdentifier() == id)
return UsersArr[i];
}
throw new UserNotFoundException();
}
@Override
public User RetrieveUserIndex(int index) {
for (int i = 0; i < UsersArr.length; i++){
if (i == index)
return UsersArr[i];
}
return null;
}
@Override
public int RetrieveNumberUsers() {
return Size;
}
}
|
[
"you@example.com"
] |
you@example.com
|
70bc51e64ce827d399ff5fb6bb9c67e242265e56
|
f6cf7e9bd00edcbab99772a899f1a0d190e725b4
|
/src/test/java/LoginLogoutTest.java
|
f59515cede4c5b871d90867ec0f361b4d0356c50
|
[] |
no_license
|
Kamil-kozlowski/expenses-selenium-tests
|
8857ceaf4c771dcc51c12462b8416df334cedbe9
|
6a5b6c87d2ff2ba02989aee80806bc537f5a978c
|
refs/heads/main
| 2023-05-27T17:46:02.716782
| 2021-06-04T14:07:13
| 2021-06-04T14:07:13
| 373,860,290
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 760
|
java
|
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
import static org.junit.Assert.assertTrue;
public class LoginLogoutTest extends AbstractSuccessfulLoginTest {
@Test
public void successfulLogoutTest() {
final List<WebElement> logoutElement = driver.findElements(By.linkText("Logout"));
assertTrue(logoutElement.size() > 0);
driver.findElement(By.linkText("Logout")).click();
final List<WebElement> formUsername = driver.findElements(By.id("formUsername"));
assertTrue(formUsername.size() > 0);
final List<WebElement> formPassword = driver.findElements(By.id("formPassword"));
assertTrue(formPassword.size() > 0);
}
}
|
[
"kamil.krzysztof.kozlowski@gmail.com"
] |
kamil.krzysztof.kozlowski@gmail.com
|
8409445337fbd82dd49ad660cee25fb59bc062ed
|
81edc2976da147cec8e450d025e0e7a2a6fe3d20
|
/src/com/test/ASort.java
|
933ab9e29d686fcdfde7a2ec624f4e759f0fe16c
|
[] |
no_license
|
zhoujinsy/uploadTest
|
131f670219a568a960cfa7759e693f7cd801f58f
|
466364d61cac3a5795ac74e5d9ef7a2ffb1f136a
|
refs/heads/master
| 2021-01-25T14:22:04.354940
| 2018-04-11T15:42:11
| 2018-04-11T15:42:11
| 123,684,539
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 708
|
java
|
package com.test;
import java.util.ArrayList;
import java.util.List;
public class ASort {
int cum=0;
List list= new ArrayList();
public static void main(String[] args) {
ASort aSort=new ASort();
int x=4;
aSort.doSort(x);
System.out.println(aSort.list);
}
public List doSort(int n){
for(int i=n;i>0;i--){
if((n-i)%2==0){
for(int j=0;j<i;j++){
cum+=1;
list.add(cum);
};
for(int k=0;k<i-1;k++){
cum+=n;
list.add(cum);
}
}else{
for(int j=0;j<i;j++){
cum-=1;
list.add(cum);
};
for(int k=0;k<i-1;k++){
cum-=n;
list.add(cum);
}
}
}
return list;
}
}
|
[
"949282784@qq.com"
] |
949282784@qq.com
|
508952fa7e75d57eff02f88e5b5f2104de0e5ec4
|
38bd617db44e06861dccdc14f9c3ad6d53dc9375
|
/src/main/java/com/fugro/realestatebot/callback/CallbackType.java
|
5157d7874ef404297a3a4340f9e8f3ce0edfbd06
|
[] |
no_license
|
fugrusha/real-estate-bot
|
0995404fd9614e634ea3b19cba7f69d7866813e5
|
85a416083693f6717bd0ab0868eca492ac4f6dec
|
refs/heads/main
| 2023-04-21T06:04:09.632173
| 2021-05-12T19:40:03
| 2021-05-12T19:40:03
| 356,909,329
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 130
|
java
|
package com.fugro.realestatebot.callback;
public enum CallbackType {
IGNORE,
SUB_TO_DISTRICT,
DELETE_DISTRICT_SUB,
}
|
[
"andrew.golowko@gmail.com"
] |
andrew.golowko@gmail.com
|
be3c716c255a52b8a56d94123717b7f625b654d6
|
c85bc29d62e4021bf987c4f3777ac669a005c97a
|
/src/main/java/com/reddit/springredditclone/model/User.java
|
54b1b359be433b1069042560c7b1a44ac9ca0d79
|
[] |
no_license
|
christian-p-anderson/spring-reddit-clone
|
bf8eb05520fe65707733025b54d1cbfea9d17ed2
|
bb7986a3147bd1a1f8ddfbece46fe3810eb103a3
|
refs/heads/master
| 2023-03-05T06:33:15.566227
| 2021-02-21T01:52:59
| 2021-02-21T01:52:59
| 335,504,414
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 948
|
java
|
package com.reddit.springredditclone.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.time.Instant;
import static javax.persistence.GenerationType.IDENTITY;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
public class User {
@Id
@GeneratedValue(strategy = IDENTITY)
private Long userId;
@NotBlank(message = "Username is required")
private String username;
@NotBlank(message = "Password is required")
private String password;
@Email
@NotEmpty(message = "Email is required")
private String email;
private Instant created;
private boolean enabled;
}
|
[
"christian.p.anderson1@gmail.com"
] |
christian.p.anderson1@gmail.com
|
6b7f19dd008514bd0c1b14676cd69e0276e08bd8
|
fc69e3bfa42e22de75e720fb0a7bf1f369a23a20
|
/src/ai/systematic/Player.java
|
a34adffac3c0a9ffa451796f09a2cc09e11d94fd
|
[] |
no_license
|
SteeveDroz/black-hole
|
84c6edf05d68ddbbdb304889e3f7ffa0716a94ae
|
6b2a29d44334e6bad475a4fdb48184a7d2d2cd81
|
refs/heads/master
| 2021-01-10T15:46:28.130203
| 2016-03-27T20:37:48
| 2016-03-27T20:37:48
| 54,677,987
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 559
|
java
|
package ai.systematic;
import java.util.List;
import com.github.steevedroz.blackhole.BlackHoleBox;
import com.github.steevedroz.blackhole.BlackHolePlayer;
import javafx.scene.paint.Color;
public class Player extends BlackHolePlayer {
private int boxCounter;
public Player(Color color, int playerId) {
super("Systematic", color, playerId);
boxCounter = 0;
}
@Override
public int play(List<BlackHoleBox> boxes) {
while (boxes.get(boxCounter % boxes.size()).getNumber() != null) {
boxCounter++;
}
return boxCounter;
}
}
|
[
"steeve.droz@sudest-webdesign.com"
] |
steeve.droz@sudest-webdesign.com
|
16b5a867ea9182bbc292a5aacb0cd64c1ee5cd9b
|
b66a0c1eb7ecb2d77512610f751be9c7cfbef931
|
/Misc/minimum-spanning-tree.java
|
00aa48554fef32f7cf50ac906062511dba1cc3d2
|
[
"MIT"
] |
permissive
|
zerocod3r/InterviewQuestions
|
f1c188c009b7599fde068e1cc8eecdf0b2c63137
|
92dc9d6b1c71ebe4318f1e206e2598a657ee0ad3
|
refs/heads/master
| 2023-09-01T17:47:58.928433
| 2023-08-30T07:17:04
| 2023-08-30T07:17:04
| 99,483,334
| 1
| 2
|
MIT
| 2019-04-19T07:35:06
| 2017-08-06T11:55:40
|
C++
|
UTF-8
|
Java
| false
| false
| 1,818
|
java
|
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
private static final int vertex=5;
int minEdge(Boolean mstSet[], int key[]){
int u = Integer.MAX_VALUE;
for(int i=0;i<vertex;i++){
if(mstSet[i]==false && u>key[i]){
u = i;
}
}
return u;
}
void printMST(int parent[], int n, int graph[][])
{
System.out.println("Edge Weight");
for (int i = 1; i < vertex; i++)
System.out.println(parent[i]+" - "+ i+" "+
graph[i][parent[i]]);
}
void primMST(int graph[][]){
int[] key = new int[vertex];
int[] parent = new int[vertex];
Boolean[] mstSet = new Boolean[vertex];
for(int i=0;i<vertex;i++){
key[i] = Integer.MAX_VALUE;
mstSet[i] = false;
}
key[0] = 0;
parent[0] = -1;
for(int i=0;i<vertex-1;i++){
int u = minEdge(mstSet, key);
mstSet[u] = true;
for(int j=0;j<vertex;j++){
if(graph[i][j]!=0 && mstSet[j]==false && graph[i][j]<key[j]){
parent[j] = i;
key[j] = graph[i][j];
}
}
}
printMST(parent,vertex,graph);
}
public static void main (String[] args) throws java.lang.Exception
{
int graph[][] = new int[][] {{0, 2, 0, 6, 0},
{2, 0, 3, 8, 5},
{0, 3, 0, 0, 7},
{6, 8, 0, 0, 9},
{0, 5, 7, 9, 0},
};
Codechef c = new Codechef();
c.primMST(graph);
}
}
|
[
"sarthakrohilla03@gmail.com"
] |
sarthakrohilla03@gmail.com
|
1d70074a2915c501e76d66f88d58ab2f5a367e30
|
6e926d9e7e5ed672b0a4e7c6ccb74ffe1427016f
|
/PS/src/PatternMatch.java
|
fa73e5c1e220bc29e76893c3d2a01ea04163bbd0
|
[] |
no_license
|
heetvachhani/CTCI-Practice
|
d911f20706cb1e5d7d842c6b82020a75fe42c634
|
f0e754ad0b80e8317f1740e274de336c1fe940b6
|
refs/heads/master
| 2021-01-20T17:57:25.337098
| 2017-04-18T04:46:09
| 2017-04-18T04:46:09
| 62,410,622
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 792
|
java
|
public class PatternMatch {
public static void main(String[] args) {
String input = "abcddddddddbacdaabcdabcd";
String pattern = "d*";
char[] inputArray = input.toCharArray();
char[] patternArray = pattern.toCharArray();
int patternIndex = 0;
int resCount = 0;
boolean flag = false;
for (int i = 0; i < input.length(); i++) {
System.out.println(inputArray[i] + " " + patternArray[patternIndex]);
if (inputArray[i] == patternArray[patternIndex] || patternArray[patternIndex] == '*') {
if (patternIndex + 1 == patternArray.length) {
resCount++;
i--;
patternIndex = 0;
} else
patternIndex++;
flag = true;
} else {
if (flag) {
i--;
flag = false;
}
patternIndex = 0;
}
}
System.out.println(resCount);
}
}
|
[
"heet_vachhani@hotmail.com"
] |
heet_vachhani@hotmail.com
|
93e5b3b3d4ddcfc00031256002ae98dda65a850b
|
bdd86f99f7097ad559c6a661764a91400266c1a4
|
/src/main/java/kr/jmcloud/watch/timeseries/converter/TimeSeriesDataConverterInterface.java
|
954a61bc72b5637b22bd14c56483a4370bdaa950
|
[
"Apache-2.0"
] |
permissive
|
JM-Lab/JMCloud-WatchCloud-Lib
|
4f9679df49e3bf82ab2fd9d54bf9a843cc9a17be
|
ec719bcd4d1bf6489fbb5d3dd24744328af9a35e
|
refs/heads/master
| 2016-09-05T18:01:25.926758
| 2015-01-16T02:44:05
| 2015-01-16T02:44:05
| 29,291,071
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 389
|
java
|
package kr.jmcloud.watch.timeseries.converter;
import java.util.List;
import kr.jmcloud.watch.timeseries.data.TimeSeriesDO;
import kr.jmcloud.watch.timeseries.data.TimeSeriesDOBundle;
public interface TimeSeriesDataConverterInterface<R> {
public R convert(TimeSeriesDO tsDO);
public R convert(TimeSeriesDOBundle tsDOB);
public List<R> convertEachList(TimeSeriesDOBundle tsDOB);
}
|
[
"hjm1980@gmail.com"
] |
hjm1980@gmail.com
|
274dcdfd256195a72dedd1f0ac38cf316b1fbe47
|
65f67a88577656697cdce59a1903d51d38230d5e
|
/src/main/java/com/chataround/chataroundws/exception/WrongPasswordException.java
|
e79cfdb16e8601d044e3fd359cc9f5e272e349af
|
[] |
no_license
|
ChatAround/ChatAroundWS
|
bed82e1ba3035ce7ab69ac0979c36723f388ecd3
|
e0c2674897afaaa3ff61b16851263c6697d04a4f
|
refs/heads/master
| 2021-01-10T18:13:45.522179
| 2016-01-20T09:23:01
| 2016-01-20T09:23:01
| 45,862,218
| 0
| 1
| null | 2016-01-17T15:03:06
| 2015-11-09T19:41:40
|
Java
|
UTF-8
|
Java
| false
| false
| 140
|
java
|
package com.chataround.chataroundws.exception;
/**
* @author Gewrgia
*/
public class WrongPasswordException extends RuntimeException {
}
|
[
"georgiagrigor@gmail.com"
] |
georgiagrigor@gmail.com
|
ebb311eb79928fc334e0731ad800d5b238430db5
|
afdc6313cee00d04f1126279f1c0200f65ee7a73
|
/src/main/java/de/mpii/clausie/XcompConstituent.java
|
163396db41da187389bf02d6a399b195d2aee69e
|
[] |
no_license
|
jeffrschneider/stanford-question
|
324edb261bc869df413bba69fa39e8ac86417671
|
7afc141772df481ca459b6aa17a3eb0bc19bb980
|
refs/heads/master
| 2021-01-16T18:32:33.555503
| 2016-08-27T02:17:04
| 2016-08-27T02:17:04
| 66,663,305
| 0
| 0
| null | 2016-08-26T16:34:58
| 2016-08-26T16:34:58
| null |
UTF-8
|
Java
| false
| false
| 2,991
|
java
|
package de.mpii.clausie;
import edu.stanford.nlp.ling.IndexedWord;
import edu.stanford.nlp.semgraph.SemanticGraph;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
/** An {@code XcompConstituent} of a clause formed out of an xcomp.
*
* Note that the xcomp relation refers to a clause with an external subject.
* The constituent stores the set of clauses that can be derived from the xcomp
* clause.
*
* @date $LastChangedDate: 2013-04-23 00:04:28 +0200 (Tue, 23 Apr 2013) $
* @version $LastChangedRevision: 734 $ */
public class XcompConstituent extends IndexedConstituent {
/** Clauses derived from this constituent */
private List<Clause> clauses;
private XcompConstituent() {
}
/** Constructs a new constituent for the xcomp relation.
*
* @param semanticGraph Semantic graph for this constituent ({@see #semanticGraph})
* @param root The root vertex of this constituent ({@see {@link #root})
* @param type type of this constituent
* @param clauses derived from this constituent*/
public XcompConstituent(SemanticGraph semanticGraph, IndexedWord root,
Type type, List<Clause> clauses) {
super(semanticGraph, root, type);
this.setClauses(clauses);
}
/** Constructs a new indexed constituent for the xcomp relation.
*
* @param semanticGraph Semantic graph for this constituent ({@see #semanticGraph})
* @param root The root vertex of this constituent ({@see {@link #root})
* @param additionalVertexes Additional root vertexes that form this constituent ({@see
* {@link #additionalVertexes})
* @param excludedVertexes Vertexes that are excluded from this constituent ({@see
* {@link #excludedVertexes})
* @param type type of this constituent
* * @param clauses derived from this constituent*/
public XcompConstituent(SemanticGraph semanticGraph, IndexedWord root,
Set<IndexedWord> additionalVertexes,
Set<IndexedWord> excludedVertexes, Type type, List<Clause> clauses) {
super(semanticGraph, root, additionalVertexes, excludedVertexes, type);
this.setClauses(clauses);
}
/** Returns the clauses derived from the constituent. */
public List<Clause> getClauses() {
return clauses;
}
/** Sets the clauses derived from the constituent. */
public void setClauses(List<Clause> clauses) {
this.clauses = clauses;
}
@Override
public XcompConstituent clone() {
XcompConstituent clone = new XcompConstituent();
clone.type = type;
clone.semanticGraph = new SemanticGraph(this.getSemanticGraph());
clone.root = this.getRoot();
clone.additionalVertexes = new TreeSet<IndexedWord>(this.additionalVertexes);
clone.excludedVertexes = new TreeSet<IndexedWord>(this.excludedVertexes);
clone.clauses = new ArrayList<Clause>(clauses);
return clone;
}
}
|
[
"rabrg96@gmail.com"
] |
rabrg96@gmail.com
|
eceec95a6c9d64cdb9e9fe3c5b2ce286d6ca62ab
|
fa3e18e672686df3561287b8d8049ede92547a0f
|
/src/main/java/de/danielbechler/diff/path/PropertyPath.java
|
6c448123f6c4c38e9082d6c6d50294e5e4dea0d7
|
[
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] |
permissive
|
gpkreddy/java-object-diff
|
9ffa381e15afbcd477775c31fea9f42468125823
|
90238a2df1395912ff30f555e7ae0b46dcf49f86
|
refs/heads/master
| 2021-01-18T11:07:31.412544
| 2012-06-02T15:41:17
| 2012-06-02T15:41:17
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,020
|
java
|
/*
* Copyright 2012 Daniel Bechler
*
* 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.danielbechler.diff.path;
import java.util.*;
/** @author Daniel Bechler */
public final class PropertyPath
{
public static PropertyPath with(final String... propertyNames)
{
final PropertyPathBuilder builder = new PropertyPathBuilder();
builder.withRoot();
for (final String propertyName : propertyNames)
{
builder.withPropertyName(propertyName);
}
return builder.build();
}
public static PropertyPath with(final Element... elements)
{
final PropertyPathBuilder builder = new PropertyPathBuilder();
builder.withRoot();
for (final Element element : elements)
{
builder.withElement(element);
}
return builder.build();
}
private final List<Element> elements;
public PropertyPath(final Element... elements)
{
this(Arrays.asList(elements));
}
public PropertyPath(final Collection<Element> elements)
{
this.elements = new ArrayList<Element>(elements);
}
public PropertyPath(final PropertyPath parentPath, final Element element)
{
elements = new ArrayList<Element>(parentPath.getElements().size() + 1);
elements.addAll(parentPath.elements);
elements.add(element);
}
public List<Element> getElements()
{
return elements;
}
public boolean matches(final PropertyPath propertyPath)
{
return propertyPath.equals(this);
}
public boolean isParentOf(final PropertyPath propertyPath)
{
final Iterator<Element> iterator1 = elements.iterator();
final Iterator<Element> iterator2 = propertyPath.getElements().iterator();
while (iterator1.hasNext() && iterator2.hasNext())
{
final Element next1 = iterator1.next();
final Element next2 = iterator2.next();
if (!next1.equals(next2))
{
return false;
}
}
return true;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
final Iterator<Element> iterator = elements.iterator();
while (iterator.hasNext())
{
final Element selector = iterator.next();
sb.append(selector);
if (iterator.hasNext())
{
sb.append('.');
}
}
return sb.toString();
}
@Override
public boolean equals(final Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
final PropertyPath that = (PropertyPath) o;
if (!elements.equals(that.elements))
{
return false;
}
return true;
}
@Override
public int hashCode()
{
return elements.hashCode();
}
}
|
[
"mail@danielbechler.de"
] |
mail@danielbechler.de
|
5e6c4657caa1c58f541a6d9e00cf74555aa702c9
|
da9f57af7d73e0825c3051443aa731f8f90486b2
|
/JavaSE/Arraylist/src/ArrayListDemo2.java
|
dcde59e22cf7ec149075b3389c0d045272311110
|
[] |
no_license
|
pawandhamankar225/JavaSE
|
23b0f1b19d8e8fec5107ae34fed6a996ecd1adef
|
218b6c7a68de236967fe98476989b04e7198dfc5
|
refs/heads/master
| 2020-06-08T15:43:10.603196
| 2019-06-22T16:32:05
| 2019-06-22T16:32:05
| 193,255,561
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 821
|
java
|
import java.util.*;
import static java.lang.System.*;
public class ArrayListDemo2
{
public static void main(String args[])
{
ArrayList <Integer>a1=new ArrayList<Integer>();
out.println("Initial size of a1: "+a1.size());
a1.add(5);
a1.add(10);
a1.add(15);
a1.add(20);
//a1.add(2);
a1.add(30);
out.println("After adding size of a1: "+a1.size());
Iterator i=a1.iterator();
while(i.hasNext())
{
System.out.println(i.next());
}
out.println("Contents of a1: "+a1);
//a1.remove(2); // remove element at index 2
a1.remove(new Integer(30)); // remove element "2"
out.println("After removing size of a1: "+a1.size());
//out.print(a1);
Iterator i2=a1.iterator();
while(i2.hasNext())
{
System.out.println(i2.next());
}
// out.println("Contents of a1: "+a1);
}
}
|
[
"pawandhamankar225"
] |
pawandhamankar225
|
34e5cda83e8294573312f8a4eeebf69c7eb7d725
|
c9f5c826f248df76af3eeeb1b6d46129684735a3
|
/src/sample/Position442.java
|
3113177551666e5a9e4d1823d6a0222cc234cc00
|
[] |
no_license
|
dosl/lab11
|
1b3502cc0fb4fed33819684f741c190124a94248
|
16edd6309b217203d34c466869506e0a684f041a
|
refs/heads/master
| 2020-04-09T07:41:51.743561
| 2018-12-03T09:37:05
| 2018-12-03T09:37:05
| 160,166,735
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,167
|
java
|
package sample;
import java.util.ArrayList;
public class Position442 implements Playable {
private Player player = new Player();
private ArrayList dupPlayer = new ArrayList();
@Override
public String positionGK() {
player.shufflePlayerList();
for (int i = 0; i < player.getPlayerList().size(); i++) {
if (player.getPlayerList().get(i).getPosition().contains("GK")){
return player.getPlayerList().get(i).getName();
}
}
return "-";
}
@Override
public String positionDF() {
player.shufflePlayerList();
for (int i = 0; i < player.getPlayerList().size(); i++) {
if (player.getPlayerList().get(i).getPosition().contains("DF")){
if (!dupPlayer.contains(player.getPlayerList().get(i).getName())){
dupPlayer.add(player.getPlayerList().get(i).getName());
return player.getPlayerList().get(i).getName();
}
}
}
return "-";
}
@Override
public String positionMF() {
player.shufflePlayerList();
for (int i = 0; i < player.getPlayerList().size(); i++) {
if (player.getPlayerList().get(i).getPosition().contains("MF")){
if (!dupPlayer.contains(player.getPlayerList().get(i).getName())){
dupPlayer.add(player.getPlayerList().get(i).getName());
return player.getPlayerList().get(i).getName();
}
}
}
return "-";
}
@Override
public String positionFW() {
player.shufflePlayerList();
for (int i = 0; i < player.getPlayerList().size(); i++) {
if (player.getPlayerList().get(i).getPosition().contains("FW")){
if (!dupPlayer.contains(player.getPlayerList().get(i).getName())){
dupPlayer.add(player.getPlayerList().get(i).getName());
return player.getPlayerList().get(i).getName();
}
}
}
return "-";
}
public void clearDupPlayer(){
dupPlayer.clear();
}
}
|
[
"best_dosl@outlook.co.th"
] |
best_dosl@outlook.co.th
|
94db0071605ee39f08cccbfa1e414a4430f7c34c
|
ba73851df55c45e17938d10ea2a88cb3d9ba42af
|
/src/main/java/main/repository/TransactionRepository.java
|
8e947bd7491d0a6d954fce74d12ff3768aa9e968
|
[] |
no_license
|
kmb-crypto/currency_convertion
|
e9cc7b5ddb337f48172e4fb639ae0ec24cf90878
|
6a5037a6de342b9ea7df28a31c86b17149d2670e
|
refs/heads/master
| 2023-05-08T14:35:25.896007
| 2021-06-03T10:45:20
| 2021-06-03T10:45:20
| 356,281,716
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,394
|
java
|
package main.repository;
import main.model.Pair;
import main.model.Transaction;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TransactionRepository extends CrudRepository<Transaction, Integer> {
@Query(value = "SELECT DISTINCT user_id FROM transactions " +
"WHERE (amount >= :amount AND from_currency = :currency) " +
"OR (exchange_amount >= :amount AND to_currency = :currency)", nativeQuery = true)
List<Integer> findUsersIdByAmountAndCurrency(@Param("currency") final String currency,
@Param("amount") final Long amount);
@Query(value = "SELECT user_id FROM transactions " +
"WHERE from_currency = :currency " +
"GROUP BY user_id " +
"HAVING sum(amount) >= :sum ", nativeQuery = true)
List<Integer> findUsersIdWithSum(@Param("currency") final String currency,
@Param("sum") final Long sum);
@Query(value = "SELECT CONCAT(from_currency,to_currency) AS pair FROM transactions " +
"GROUP BY pair ORDER BY COUNT(pair) desc", nativeQuery = true)
List<Pair> getTransactionsRank();
}
|
[
"burduninkonstantin@gmail.com"
] |
burduninkonstantin@gmail.com
|
f1b911d1e570f5a2fb42c90acdd270c0ef015716
|
27e7a73a262afb18552cebbe11527b260e87ad96
|
/MyPerf4J-Core/src/main/java/cn/myperf4j/core/MethodMetricsCalculator.java
|
36db621727829c2946f929f012a026d80e713978
|
[
"BSD-3-Clause"
] |
permissive
|
athinboy/MyPerf4J
|
f637bcf04e5fb4a887fa6a1f31bf3f8ba98ef94e
|
1f3ca9db3cc79521cd5cd17a581755a8cd008df7
|
refs/heads/develop
| 2020-04-30T21:44:39.919000
| 2019-04-16T12:35:11
| 2019-04-16T12:35:11
| 177,100,884
| 0
| 0
|
BSD-3-Clause
| 2019-04-09T10:06:23
| 2019-03-22T08:25:59
|
Java
|
UTF-8
|
Java
| false
| false
| 4,650
|
java
|
package cn.myperf4j.core;
import cn.myperf4j.base.metric.MethodMetrics;
import cn.myperf4j.base.MethodTag;
import cn.myperf4j.base.util.ChunkPool;
import cn.myperf4j.base.util.Logger;
import cn.myperf4j.core.recorder.Recorder;
/**
* Created by LinShunkang on 2018/3/11
*/
public final class MethodMetricsCalculator {
private static final ThreadLocal<int[]> threadLocalIntArr = new ThreadLocal<int[]>() {
@Override
protected int[] initialValue() {
return new int[MethodMetrics.getPercentiles().length];
}
};
public static MethodMetrics calPerfStats(Recorder recorder, MethodTag methodTag, long startTime, long stopTime) {
int[] sortedRecords = null;
try {
int effectiveCount = recorder.getEffectiveCount();
sortedRecords = ChunkPool.getInstance().getChunk(effectiveCount * 2);
recorder.fillSortedRecords(sortedRecords);
return calPerfStats(methodTag, startTime, stopTime, sortedRecords, effectiveCount);
} catch (Exception e) {
Logger.error("MethodMetricsCalculator.calPerfStats(" + recorder + ", " + methodTag + ", " + startTime + ", " + stopTime + ")", e);
} finally {
ChunkPool.getInstance().returnChunk(sortedRecords);
}
return MethodMetrics.getInstance(methodTag, startTime, stopTime);
}
private static MethodMetrics calPerfStats(MethodTag methodTag, long startTime, long stopTime, int[] sortedRecords, int effectiveCount) {
long[] pair = getTotalTimeAndTotalCount(sortedRecords);
long totalTime = pair[0];
int totalCount = (int) pair[1];
MethodMetrics result = MethodMetrics.getInstance(methodTag);
result.setTotalCount(totalCount);
result.setStartMillTime(startTime);
result.setStopMillTime(stopTime);
if (totalCount <= 0 || effectiveCount <= 0) {
return result;
}
double avgTime = ((double) totalTime) / totalCount;
result.setAvgTime(avgTime);
result.setMinTime(sortedRecords[0]);
result.setMaxTime(sortedRecords[(effectiveCount - 1) * 2]);
int[] topPerIndexArr = getTopPercentileIndexArr(totalCount);
int[] topPerArr = result.getTpArr();
int countMile = 0, perIndex = 0;
double sigma = 0.0D;//∑
for (int i = 0, length = sortedRecords.length; i < length; i = i + 2) {
int timeCost = sortedRecords[i];
int count = sortedRecords[i + 1];
//sortedRecords中只有第0位的响应时间可以为0
if (i > 0 && timeCost <= 0) {
break;
}
countMile += count;
int index = topPerIndexArr[perIndex];
if (countMile >= index) {
topPerArr[perIndex] = timeCost;
perIndex++;
}
sigma += Math.pow(timeCost - avgTime, 2.0);
}
result.setStdDev(Math.sqrt(sigma / totalCount));
return reviseStatistic(result);
}
/**
* @param sortedRecords
* @return : long[]: int[0]代表totalTimeCost, int[1]代表totalCount
*/
private static long[] getTotalTimeAndTotalCount(int[] sortedRecords) {
long[] result = {0L, 0L};
if (sortedRecords == null || sortedRecords.length == 0) {
return result;
}
for (int i = 0, length = sortedRecords.length; i < length; i = i + 2) {
int timeCost = sortedRecords[i];
int count = sortedRecords[i + 1];
//sortedRecords中只有第0位的响应时间可以为0
if (i > 0 && timeCost <= 0) {
break;
}
result[0] += timeCost * count;
result[1] += count;
}
return result;
}
private static MethodMetrics reviseStatistic(MethodMetrics methodMetrics) {
int[] tpArr = methodMetrics.getTpArr();
for (int i = 1; i < tpArr.length; ++i) {
int last = tpArr[i - 1];
int cur = tpArr[i];
if (cur <= -1) {
tpArr[i] = last;
}
}
return methodMetrics;
}
private static int[] getTopPercentileIndexArr(int totalCount) {
int[] result = threadLocalIntArr.get();
double[] percentiles = MethodMetrics.getPercentiles();
for (int i = 0; i < percentiles.length; ++i) {
result[i] = getIndex(totalCount, percentiles[i]);
}
return result;
}
private static int getIndex(int totalCount, double percentile) {
return (int) Math.ceil(totalCount * percentile);
}
}
|
[
"linshunkang@kanzhun.com"
] |
linshunkang@kanzhun.com
|
7d8852246eabe3009a64e15982c4847a222c4948
|
892206b7ac3ef30a6cc32cfed96def600c49493c
|
/JB/src/main/java/com/jiubang/p2p/dialog/SelectPicPopupWindow.java
|
d7cb368d4ba4c5e58773bd41416c5dca55caf123
|
[] |
no_license
|
yangyilip1986/JB
|
6edf24ca76e818256368a7c64b10612a0460ac25
|
12f1d3872dc3c8fcc9823ac42932b54fa1c33646
|
refs/heads/master
| 2020-05-04T20:25:34.887372
| 2019-04-19T02:05:42
| 2019-04-19T02:10:44
| 179,437,556
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,637
|
java
|
package com.jiubang.p2p.dialog;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import com.jiubang.p2p.R;
@SuppressLint("InflateParams")
public class SelectPicPopupWindow extends PopupWindow {
private LinearLayout ll_wechat, ll_wechat_moments;
private View menuView;
@SuppressWarnings("deprecation")
public SelectPicPopupWindow(Activity context,OnClickListener itemsOnClick) {
super(context);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
menuView = inflater.inflate(R.layout.share_alert_dialog, null);
ll_wechat = (LinearLayout) menuView.findViewById(R.id.ll_wechat);
ll_wechat_moments = (LinearLayout) menuView.findViewById(R.id.ll_wechat_moments);
//设置按钮监听
ll_wechat.setOnClickListener(itemsOnClick);
ll_wechat_moments.setOnClickListener(itemsOnClick);
//设置SelectPicPopupWindow的View
this.setContentView(menuView);
//设置SelectPicPopupWindow弹出窗体的宽
this.setWidth(LayoutParams.FILL_PARENT);
//设置SelectPicPopupWindow弹出窗体的高
this.setHeight(LayoutParams.WRAP_CONTENT);
//设置SelectPicPopupWindow弹出窗体可点击
this.setFocusable(true);
//设置SelectPicPopupWindow弹出窗体动画效果
this.setAnimationStyle(R.style.AnimBottom);
//实例化一个ColorDrawable颜色为半透明
ColorDrawable dw = new ColorDrawable(0xb0000000);
//设置SelectPicPopupWindow弹出窗体的背景
this.setBackgroundDrawable(dw);
//menuView添加OnTouchListener监听判断获取触屏位置如果在选择框外面则销毁弹出框
menuView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
int height = menuView.findViewById(R.id.pop_layout).getTop();
int y=(int) event.getY();
if(event.getAction()==MotionEvent.ACTION_UP) {
if(y<height) {
dismiss();
}
}
return true;
}
});
}
}
|
[
"18642668871@163.com"
] |
18642668871@163.com
|
adca55a326ae70f6381faae387ef9b1346da1522
|
3daf7dbf72c08c65e4e65878d5d963770d76e3e2
|
/viewworkspaceenglish/circleMenu/Service学习/src/com/example/myservice/MusicPlayerActivity.java
|
756f7addd26053ddd49683b3a8a2924da5caeb5a
|
[] |
no_license
|
zj386018/zjandroid
|
068a45cdd5d33741b3b545f735356e09d31c2e59
|
d3f9d36013adfb26fd7118a1f45dea553af67c67
|
refs/heads/master
| 2021-01-21T12:53:34.097274
| 2016-05-24T09:09:56
| 2016-05-24T09:09:56
| 54,310,752
| 0
| 0
| null | null | null | null |
GB18030
|
Java
| false
| false
| 1,659
|
java
|
package com.example.myservice;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MusicPlayerActivity extends Activity implements OnClickListener {
private Button bt_play;
private Button bt_pause;
private Button bt_stop;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_music_player);
initview();
}
private void initview() {
bt_play = (Button) findViewById(R.id.bt_play);
bt_play.setOnClickListener(this);
bt_pause = (Button) findViewById(R.id.bt_pause);
bt_pause.setOnClickListener(this);
bt_stop = (Button) findViewById(R.id.bt_stop);
bt_stop.setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.bt_play:
bt_playClick();
break;
case R.id.bt_pause:
bt_pauseClick();
break;
case R.id.bt_stop:
bt_stopClick();
break;
default:
break;
}
}
private void bt_playClick() {
Intent intent = new Intent(MusicPlayerActivity.this, MyService.class);
// 1表示播放
intent.putExtra("mediacommand", 1);
startService(intent);
}
private void bt_pauseClick() {
Intent intent = new Intent(MusicPlayerActivity.this, MyService.class);
// 2表示暂停
intent.putExtra("mediacommand", 2);
startService(intent);
}
private void bt_stopClick() {
Intent intent = new Intent(MusicPlayerActivity.this, MyService.class);
// 3表示停止
intent.putExtra("mediacommand", 3);
startService(intent);
}
}
|
[
"547758478@qq.com"
] |
547758478@qq.com
|
cd4f8775e5a11787852965b1fba0f93aadc7f283
|
e29c24b96ee0fc3d58e6b62a49617e46b242445c
|
/sdcct-core/src/main/java/gov/hhs/onc/sdcct/data/db/logging/impl/LoggingCacheListener.java
|
99c5a4a98a96efb23d5e88db21ae1eff6a6a7d8b
|
[
"Apache-2.0"
] |
permissive
|
EBlakeRamsey/sdcct
|
cc7cec3a6cbf72874e6c1f3af9f30344166de235
|
ba4657148edbbba420f6e07c80164d0677373c44
|
refs/heads/master
| 2021-01-19T19:12:32.481323
| 2017-04-03T18:57:08
| 2017-04-03T18:57:08
| 83,717,701
| 0
| 0
| null | 2017-03-07T16:33:24
| 2017-03-02T19:43:22
|
Java
|
UTF-8
|
Java
| false
| false
| 1,965
|
java
|
package gov.hhs.onc.sdcct.data.db.logging.impl;
import gov.hhs.onc.sdcct.beans.IdentifiedBean;
import net.sf.ehcache.CacheException;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import net.sf.ehcache.event.CacheEventListenerAdapter;
import org.apache.commons.lang3.text.StrBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component("cacheListenerLogging")
public class LoggingCacheListener extends CacheEventListenerAdapter {
private static enum CacheEventType implements IdentifiedBean {
EVICTED, EXPIRED, PUT;
private final String id;
private CacheEventType() {
this.id = this.name().toLowerCase();
}
@Override
public String getId() {
return this.id;
}
}
private final static Logger LOGGER = LoggerFactory.getLogger(LoggingCacheListener.class);
@Override
public void notifyElementEvicted(Ehcache cache, Element elem) {
LOGGER.trace(buildMessage(cache, elem, CacheEventType.EVICTED));
}
@Override
public void notifyElementExpired(Ehcache cache, Element elem) {
LOGGER.trace(buildMessage(cache, elem, CacheEventType.EXPIRED));
}
@Override
public void notifyElementPut(Ehcache cache, Element elem) throws CacheException {
LOGGER.trace(buildMessage(cache, elem, CacheEventType.PUT));
}
private static String buildMessage(Ehcache cache, Element elem, CacheEventType eventType) {
StrBuilder msgBuilder = new StrBuilder("Cache (name=");
msgBuilder.append(cache.getName());
msgBuilder.append(", size=");
msgBuilder.append(cache.getSize());
msgBuilder.append(") element (key=");
msgBuilder.append(elem.getObjectKey());
msgBuilder.append(") ");
msgBuilder.append(eventType.getId());
msgBuilder.append(".");
return msgBuilder.build();
}
}
|
[
"michal.kotelba@esacinc.com"
] |
michal.kotelba@esacinc.com
|
1af39c4a41e379a69f42b3b6829aa34fe2ea082d
|
ba56b9e8c1323624a4ddc8a31274bf8fad08556c
|
/src/ru/rsreu/Zhilenko0804/data/Client.java
|
cfe200b4d68ed60250d48c327ac4753438fbe868
|
[] |
no_license
|
maxzhil/Conference
|
3e2b9e7e2505f5bbf7ae4302cd975dee63dc43a3
|
936bb15c9f3edfdb8b3b5d98706751959023bdca
|
refs/heads/master
| 2021-03-31T00:51:29.230651
| 2018-03-09T21:59:21
| 2018-03-09T21:59:21
| 124,593,048
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,637
|
java
|
package ru.rsreu.Zhilenko0804.data;
/**
* Client
*
* @author Maxim
*
*/
public class Client {
private int idClient;
private ClientType type;
private String name;
private String lastName;
private String login;
private String password;
private String status;
/** Constructor */
public Client() {
}
/**
* Constructor
*
* @param name
* @param lastName
*/
public Client(String name, String lastName) {
this.name = name;
this.lastName = lastName;
}
/**
* Constructor
*
* @param idClient
* @param type
* @param name
* @param lastName
* @param login
* @param password
* @param status
*/
public Client(int idClient, int type, String name, String lastName,
String login, String password, String status) {
this.idClient = idClient;
this.type = new ClientType(type, name);
this.name = name;
this.lastName = lastName;
this.login = login;
this.password = password;
this.status = status;
}
/**
* Constructor
*
* @param idClient
* @param type
* @param name
* @param lastName
* @param login
* @param password
* @param status
*/
public Client(int idClient, String type, String name, String lastName,
String login, String password, String status) {
this.idClient = idClient;
this.type = new ClientType(type);
this.name = name;
this.lastName = lastName;
this.login = login;
this.password = password;
this.status = status;
}
public int getIdClient() {
return idClient;
}
public void setIdClient(int idClient) {
this.idClient = idClient;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public ClientType getType() {
return type;
}
public String getTypeString() {
return type.toString();
}
public int getIdType() {
return type.getIdClientType();
}
public void setType(String type) {
this.type = new ClientType(type);
}
@Override
public String toString() {
return "Client [idClient=" + idClient + ", type=" + type + ", name="
+ name + ", lastName=" + lastName + ", login=" + login
+ ", password=" + password + ", status=" + status + "]";
}
}
|
[
"makcim.zhilenko96@yandex.ru"
] |
makcim.zhilenko96@yandex.ru
|
6e2cc263d0abf37d64b587e95842f9dff72c782a
|
f2c2fde38007259895c748479a2b66b9a6a081cd
|
/relsource/java/util/concurrent/BlockingQueue.java
|
56727d321c12aff5eb44234e8954a6f9f6160c9b
|
[] |
no_license
|
enjoycodingfun/jdksrcstudy
|
07b7c1f8593ce3443c04304dab0e3c0be43be10a
|
089be3d58939ec60334ff21ab052e78e3b7c8f90
|
refs/heads/master
| 2023-03-16T11:44:27.159267
| 2021-02-17T14:01:47
| 2021-02-17T14:01:47
| 317,468,541
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 17,884
|
java
|
/*
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
/*
*
*
*
*
*
* Written by Doug Lea with assistance from members of JCP JSR-166
* Expert Group and released to the public domain, as explained at
* http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util.concurrent;
import java.util.Collection;
import java.util.Queue;
/**
* 该队列支持当获取元素的时候等待直到队列非空,当存储元素的时候等待直到队列有空间
* A {@link java.util.Queue} that additionally supports operations
* that wait for the queue to become non-empty when retrieving an
* element, and wait for space to become available in the queue when
* storing an element.
* ===================================================================
*该队列的方法有下面四种形式,参考https://docs.oracle.com/javase/8/docs/api/
* ===================================================================
*
* <p>{@code BlockingQueue} methods come in four forms, with different ways
* of handling operations that cannot be satisfied immediately, but may be
* satisfied at some point in the future:
* one throws an exception, the second returns a special value (either
* {@code null} or {@code false}, depending on the operation), the third
* blocks the current thread indefinitely until the operation can succeed,
* and the fourth blocks for only a given maximum time limit before giving
* up. These methods are summarized in the following table:
*
* <table BORDER CELLPADDING=3 CELLSPACING=1>
* <caption>Summary of BlockingQueue methods</caption>
* <tr>
* <td></td>
* <td ALIGN=CENTER><em>Throws exception</em></td>
* <td ALIGN=CENTER><em>Special value</em></td>
* <td ALIGN=CENTER><em>Blocks</em></td>
* <td ALIGN=CENTER><em>Times out</em></td>
* </tr>
* <tr>
* <td><b>Insert</b></td>
* <td>{@link #add add(e)}</td>
* <td>{@link #offer offer(e)}</td>
* <td>{@link #put put(e)}</td>
* <td>{@link #offer(Object, long, TimeUnit) offer(e, time, unit)}</td>
* </tr>
* <tr>
* <td><b>Remove</b></td>
* <td>{@link #remove remove()}</td>
* <td>{@link #poll poll()}</td>
* <td>{@link #take take()}</td>
* <td>{@link #poll(long, TimeUnit) poll(time, unit)}</td>
* </tr>
* <tr>
* <td><b>Examine</b></td>
* <td>{@link #element element()}</td>
* <td>{@link #peek peek()}</td>
* <td><em>not applicable</em></td>
* <td><em>not applicable</em></td>
* </tr>
* </table>
*
* ========================================================================
*该队列在add,out或offer的时候不接收null值,null被用来作为poll对象没有结果时候的返回值
* ========================================================================
*
* <p>A {@code BlockingQueue} does not accept {@code null} elements.
* Implementations throw {@code NullPointerException} on attempts
* to {@code add}, {@code put} or {@code offer} a {@code null}. A
* {@code null} is used as a sentinel value to indicate failure of
* {@code poll} operations.
*
* =============================================================================
* 该队列可能是有界的,任何时刻当当前剩余容量不足时无法再添加元素,没有指定固定容量的情况下,容量的
* 大小默认为Integer.MAX_VALUE
* =============================================================================
*
* <p>A {@code BlockingQueue} may be capacity bounded. At any given
* time it may have a {@code remainingCapacity} beyond which no
* additional elements can be {@code put} without blocking.
* A {@code BlockingQueue} without any intrinsic capacity constraints always
* reports a remaining capacity of {@code Integer.MAX_VALUE}.
*
* ===========================================================================
* 该队列的实现类通常被用在生产者消费者队列下,但是也支持Collection接口,比如用来随机去除
* 一个元素,但是这个操作通常不够高效,偶尔使用下
* ===========================================================================
*
* <p>{@code BlockingQueue} implementations are designed to be used
* primarily for producer-consumer queues, but additionally support
* the {@link java.util.Collection} interface. So, for example, it is
* possible to remove an arbitrary element from a queue using
* {@code remove(x)}. However, such operations are in general
* <em>not</em> performed very efficiently, and are intended for only
* occasional use, such as when a queued message is cancelled.
*
* =============================================================================
* 该队列的实现是线程安全的,所有排队方法都是通过内部锁或者其他并发控制方式来保证线程安全的,
* 但是在执行集合操作,比如addAll,containsAll,retainAll,removeAll的时候不能保证并发安全
* ,比如调用addAll方法的时候可能会在添加某些元素之后失败并抛出异常
* ============================================================================
*
* <p>{@code BlockingQueue} implementations are thread-safe. All
* queuing methods achieve their effects atomically using internal
* locks or other forms of concurrency control. However, the
* <em>bulk</em> Collection operations {@code addAll},
* {@code containsAll}, {@code retainAll} and {@code removeAll} are
* <em>not</em> necessarily performed atomically unless specified
* otherwise in an implementation. So it is possible, for example, for
* {@code addAll(c)} to fail (throwing an exception) after adding
* only some of the elements in {@code c}.
*
* <p>A {@code BlockingQueue} does <em>not</em> intrinsically support
* any kind of "close" or "shutdown" operation to
* indicate that no more items will be added. The needs and usage of
* such features tend to be implementation-dependent. For example, a
* common tactic is for producers to insert special
* <em>end-of-stream</em> or <em>poison</em> objects, that are
* interpreted accordingly when taken by consumers.
*
*===============================================================
* 下面是一个使用示例,基于传统的生产者消费者模式,注意blockingqueue是可以被多个生产者消费者安全
* 的使用的
* ================================================================
* <p>
* Usage example, based on a typical producer-consumer scenario.
* Note that a {@code BlockingQueue} can safely be used with multiple
* producers and multiple consumers.
* <pre> {@code
* class Producer implements Runnable {
* private final BlockingQueue queue;
* Producer(BlockingQueue q) { queue = q; }
* public void run() {
* try {
* while (true) { queue.put(produce()); }
* } catch (InterruptedException ex) { ... handle ...}
* }
* Object produce() { ... }
* }
*
* class Consumer implements Runnable {
* private final BlockingQueue queue;
* Consumer(BlockingQueue q) { queue = q; }
* public void run() {
* try {
* while (true) { consume(queue.take()); }
* } catch (InterruptedException ex) { ... handle ...}
* }
* void consume(Object x) { ... }
* }
*
* class Setup {
* void main() {
* BlockingQueue q = new SomeQueueImplementation();
* Producer p = new Producer(q);
* Consumer c1 = new Consumer(q);
* Consumer c2 = new Consumer(q);
* new Thread(p).start();
* new Thread(c1).start();
* new Thread(c2).start();
* }
* }}</pre>
*
* <p>Memory consistency effects: As with other concurrent
* collections, actions in a thread prior to placing an object into a
* {@code BlockingQueue}
* <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
* actions subsequent to the access or removal of that element from
* the {@code BlockingQueue} in another thread.
*
* <p>This interface is a member of the
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
* Java Collections Framework</a>.
*
* @since 1.5
* @author Doug Lea
* @param <E> the type of elements held in this collection
*/
public interface BlockingQueue<E> extends Queue<E> {
/**
* Inserts the specified element into this queue if it is possible to do
* so immediately without violating capacity restrictions, returning
* {@code true} upon success and throwing an
* {@code IllegalStateException} if no space is currently available.
* When using a capacity-restricted queue, it is generally preferable to
* use {@link #offer(Object) offer}.
*
* @param e the element to add
* @return {@code true} (as specified by {@link Collection#add})
* @throws IllegalStateException if the element cannot be added at this
* time due to capacity restrictions
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
*/
boolean add(E e);
/**
* Inserts the specified element into this queue if it is possible to do
* so immediately without violating capacity restrictions, returning
* {@code true} upon success and {@code false} if no space is currently
* available. When using a capacity-restricted queue, this method is
* generally preferable to {@link #add}, which can fail to insert an
* element only by throwing an exception.
*
* @param e the element to add
* @return {@code true} if the element was added to this queue, else
* {@code false}
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
*/
boolean offer(E e);
/**
* Inserts the specified element into this queue, waiting if necessary
* for space to become available.
*
* @param e the element to add
* @throws InterruptedException if interrupted while waiting
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
*/
void put(E e) throws InterruptedException;
/**
* Inserts the specified element into this queue, waiting up to the
* specified wait time if necessary for space to become available.
*
* @param e the element to add
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return {@code true} if successful, or {@code false} if
* the specified waiting time elapses before space is available
* @throws InterruptedException if interrupted while waiting
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
*/
boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException;
/**
* Retrieves and removes the head of this queue, waiting if necessary
* until an element becomes available.
*
* @return the head of this queue
* @throws InterruptedException if interrupted while waiting
*/
E take() throws InterruptedException;
/**
* Retrieves and removes the head of this queue, waiting up to the
* specified wait time if necessary for an element to become available.
*
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the head of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
* @throws InterruptedException if interrupted while waiting
*/
E poll(long timeout, TimeUnit unit)
throws InterruptedException;
/**
* Returns the number of additional elements that this queue can ideally
* (in the absence of memory or resource constraints) accept without
* blocking, or {@code Integer.MAX_VALUE} if there is no intrinsic
* limit.
*
* <p>Note that you <em>cannot</em> always tell if an attempt to insert
* an element will succeed by inspecting {@code remainingCapacity}
* because it may be the case that another thread is about to
* insert or remove an element.
*
* @return the remaining capacity
*/
int remainingCapacity();
/**
* Removes a single instance of the specified element from this queue,
* if it is present. More formally, removes an element {@code e} such
* that {@code o.equals(e)}, if this queue contains one or more such
* elements.
* Returns {@code true} if this queue contained the specified element
* (or equivalently, if this queue changed as a result of the call).
*
* @param o element to be removed from this queue, if present
* @return {@code true} if this queue changed as a result of the call
* @throws ClassCastException if the class of the specified element
* is incompatible with this queue
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
*/
boolean remove(Object o);
/**
* Returns {@code true} if this queue contains the specified element.
* More formally, returns {@code true} if and only if this queue contains
* at least one element {@code e} such that {@code o.equals(e)}.
*
* @param o object to be checked for containment in this queue
* @return {@code true} if this queue contains the specified element
* @throws ClassCastException if the class of the specified element
* is incompatible with this queue
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
*/
public boolean contains(Object o);
/**
* Removes all available elements from this queue and adds them
* to the given collection. This operation may be more
* efficient than repeatedly polling this queue. A failure
* encountered while attempting to add elements to
* collection {@code c} may result in elements being in neither,
* either or both collections when the associated exception is
* thrown. Attempts to drain a queue to itself result in
* {@code IllegalArgumentException}. Further, the behavior of
* this operation is undefined if the specified collection is
* modified while the operation is in progress.
*
* @param c the collection to transfer elements into
* @return the number of elements transferred
* @throws UnsupportedOperationException if addition of elements
* is not supported by the specified collection
* @throws ClassCastException if the class of an element of this queue
* prevents it from being added to the specified collection
* @throws NullPointerException if the specified collection is null
* @throws IllegalArgumentException if the specified collection is this
* queue, or some property of an element of this queue prevents
* it from being added to the specified collection
*/
int drainTo(Collection<? super E> c);
/**
* Removes at most the given number of available elements from
* this queue and adds them to the given collection. A failure
* encountered while attempting to add elements to
* collection {@code c} may result in elements being in neither,
* either or both collections when the associated exception is
* thrown. Attempts to drain a queue to itself result in
* {@code IllegalArgumentException}. Further, the behavior of
* this operation is undefined if the specified collection is
* modified while the operation is in progress.
*
* @param c the collection to transfer elements into
* @param maxElements the maximum number of elements to transfer
* @return the number of elements transferred
* @throws UnsupportedOperationException if addition of elements
* is not supported by the specified collection
* @throws ClassCastException if the class of an element of this queue
* prevents it from being added to the specified collection
* @throws NullPointerException if the specified collection is null
* @throws IllegalArgumentException if the specified collection is this
* queue, or some property of an element of this queue prevents
* it from being added to the specified collection
*/
int drainTo(Collection<? super E> c, int maxElements);
}
|
[
"627882647@qq.com"
] |
627882647@qq.com
|
13c75c7c39b509e0dbd4e1945a8419e3aff7679c
|
d1e8d3f90cbbe39fecf0e0ed855ecd347d9c7e7c
|
/src/main/java/com/wzq/ds/command/LightOnCommand.java
|
76cac26f6d768a847a9e098bcdc599b8cfce2411
|
[] |
no_license
|
w237354468/designModeLearn
|
4aa61434c71859fb7371c9733b4baa16db73a8cc
|
dd855ed606ad5d7cdcf9c5a036e9fc2624132958
|
refs/heads/main
| 2023-01-24T07:07:27.007734
| 2020-12-05T15:21:53
| 2020-12-05T15:21:53
| 317,705,492
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 303
|
java
|
package com.wzq.ds.command;
public class LightOnCommand implements Command {
Light light;
public LightOnCommand(Light light) {
this.light = light;
}
@Override
public void execute() {
light.on();
}
}
class Light {
public void on() {
System.out.println("light on ");
}
}
|
[
"w237354468@hotmail.com"
] |
w237354468@hotmail.com
|
13a02e1fd3217712553d29b760858adeb9b7a082
|
04573347ea9ede8f6d3097ff0cbd7cabac17d5c0
|
/OfasinModel/src/main/java/com/ofasin/os/ebanking/model/DominioUsers.java
|
65c9b9ac65d83ce5ea00ea655ef11ad931b7dc69
|
[] |
no_license
|
Ofasin/Ofasin
|
367980e44652f853c14c0622a8e107df1dbee5fd
|
ba99b4c53bb6d5bd195f9f104230f6eb387b4f81
|
refs/heads/master
| 2023-02-26T17:31:16.953817
| 2021-01-27T13:09:58
| 2021-01-27T13:09:58
| 308,016,350
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,122
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ofasin.os.ebanking.model;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author Heidelber Gonzalez Iguaran
*/
public class DominioUsers extends DominioGeneric {
private static final long serialVersionUID = 1L;
private Long iduser;
private String user;
private String password;
private Date fechaAcceso;
private String statusUser;
private DominioRoll idroll;
private DominioWayuu idusuario;
public DominioUsers() {
}
public DominioUsers(Long iduser) {
this.iduser = iduser;
}
public DominioUsers(Long iduser, String user, String password, Date fechaAcceso, String statusUser) {
this.iduser = iduser;
this.user = user;
this.password = password;
this.fechaAcceso = fechaAcceso;
this.statusUser = statusUser;
}
public Long getIduser() {
return iduser;
}
public void setIduser(Long iduser) {
this.iduser = iduser;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Date getFechaAcceso() {
return fechaAcceso;
}
public void setFechaAcceso(Date fechaAcceso) {
this.fechaAcceso = fechaAcceso;
}
public String getStatusUser() {
return statusUser;
}
public void setStatusUser(String statusUser) {
this.statusUser = statusUser;
}
public DominioRoll getIdroll() {
return idroll;
}
public void setIdroll(DominioRoll idroll) {
this.idroll = idroll;
}
public DominioWayuu getIdusuario() {
return idusuario;
}
public void setIdusuario(DominioWayuu idusuario) {
this.idusuario = idusuario;
}
}
|
[
"FAGONFER@DESKTOP-PN66UOO"
] |
FAGONFER@DESKTOP-PN66UOO
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.