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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c0087bf31deed034943fdb654963cb184206d9da | 6742f629153f9519052975892beb4795bc1c8872 | /app/src/main/java/com/example/pigdtt12345/coeats/ConditionActivity.java | d02762d17ba155a689944a84523b19a6a3fe9aaa | [] | no_license | hhwang39/COEATS | b37d54b23c3e570032807525aa629c896e601e90 | ffb8abc11b81d80ba96e6500c93fbdbdbf7b0cf3 | refs/heads/master | 2022-12-27T00:29:25.115601 | 2020-09-19T00:30:48 | 2020-09-19T00:30:48 | 138,661,769 | 0 | 0 | null | 2022-12-10T16:20:51 | 2018-06-25T23:51:19 | JavaScript | UTF-8 | Java | false | false | 2,266 | java | package com.example.pigdtt12345.coeats;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
/**
* Created by pigdtt12345 on 3/26/18.
*/
public class ConditionActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.condition_layout);
final Bundle bundle = this.getIntent().getExtras();
EditText tempMoney = (EditText) findViewById(R.id.condition_input_money);
tempMoney.setText("" + utils.getMinDeliveryMoney());
Button btm = (Button) findViewById(R.id.condition_button);
btm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText tmpMoney = (EditText) findViewById(R.id.condition_input_money);
EditText tmpPeople = (EditText) findViewById(R.id.condition_input_people);
EditText tmpTime = (EditText) findViewById(R.id.condition_input_time);
double money = Double.parseDouble(tmpMoney.getText().toString());
int people = Integer.parseInt(tmpPeople.getText().toString());
double time = Double.parseDouble(tmpTime.getText().toString());
if (money > 0) {
bundle.putDouble("rMoney", money);
}
else {
bundle.putDouble("rMoney", 0);
}
if (people > 1) {
bundle.putInt("rPeople", people);
}
else {
bundle.putInt("rPeople", 1);
}
if (time > 0) {
bundle.putDouble("rTime", time);
}
else {
bundle.putDouble("rTime", 0);
}
Intent intent = new Intent(ConditionActivity.this, SummaryActivity.class);
intent.putExtras(bundle);
startActivity(intent);
}
});
}
}
| [
"hhwang39@gatech.edu"
] | hhwang39@gatech.edu |
ef13d375c89fb0f134b160c42441d82687cdf098 | 8a4b59815dda83ab06b1c55db80305761be11053 | /src-data/com/openbravo/data/loader/SerializerWriteBasicExt.java | 76c79d8018a85c099d9e62b015b5f0eef32a2e25 | [] | no_license | CesarChaMal/UnicentaPOS | ac7353240ba9b1b6c3b1483b4637cc64bc5eaccf | 22b60dc4fd14da936a338591be0c0b0e9795e322 | refs/heads/master | 2022-07-25T16:24:28.138317 | 2022-07-11T08:08:40 | 2022-07-11T08:08:40 | 273,901,433 | 0 | 0 | null | 2020-06-21T12:39:28 | 2020-06-21T12:39:27 | null | UTF-8 | Java | false | false | 1,500 | java | // uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2011 uniCenta
// http://www.unicenta.net/unicentaopos
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.openbravo.data.loader;
import com.openbravo.basic.BasicException;
public class SerializerWriteBasicExt implements SerializerWrite<Object[]> {
private Datas[] m_classes;
private int[] m_index;
/** Creates a new instance of SerializerWriteBasic */
public SerializerWriteBasicExt(Datas[] classes, int[] index) {
m_classes = classes;
m_index = index;
}
public void writeValues(DataWrite dp, Object[] obj) throws BasicException {
for (int i = 0; i < m_index.length; i++) {
m_classes[m_index[i]].setValue(dp, i + 1, obj[m_index[i]]);
}
}
} | [
"egonzalez@ergio.com.ar"
] | egonzalez@ergio.com.ar |
26b6f3a008b942a5abd78eb64542481811b93299 | 52b948436b826df8164565ffe69e73a92eb92cda | /Source/comingd4jmore/GenProg_patch_Defects4J_Closure_21_0_500/CheckSideEffects/GenProg_patch_Defects4J_Closure_21_0_500_CheckSideEffects_t.java | cd4b39a42f258af0af14379b42b2cf95d3ec4049 | [] | no_license | tdurieux/ODSExperiment | 910365f1388bc684e9916f46f407d36226a2b70b | 3881ef06d6b8d5efb751860811def973cb0220eb | refs/heads/main | 2023-07-05T21:30:30.099605 | 2021-08-18T15:56:56 | 2021-08-18T15:56:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,892 | java | /*
* Copyright 2006 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.javascript.jscomp;
import com.google.common.collect.Lists;
import com.google.javascript.jscomp.CheckLevel;
import com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback;
import com.google.javascript.rhino.IR;
import com.google.javascript.rhino.JSDocInfoBuilder;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.Token;
import java.util.List;
/**
* Checks for non side effecting statements such as
* <pre>
* var s = "this string is "
* "continued on the next line but you forgot the +";
* x == foo(); // should that be '='?
* foo();; // probably just a stray-semicolon. Doesn't hurt to check though
* </p>
* and generates warnings.
*
*/
final class CheckSideEffects extends AbstractPostOrderCallback
implements HotSwapCompilerPass {
static final DiagnosticType USELESS_CODE_ERROR = DiagnosticType.warning(
"JSC_USELESS_CODE",
"Suspicious code. {0}");
static final String PROTECTOR_FN = "JSCOMPILER_PRESERVE";
private final CheckLevel level;
private final List<Node> problemNodes = Lists.newArrayList();
private final AbstractCompiler compiler;
private final boolean protectSideEffectFreeCode;
CheckSideEffects(AbstractCompiler compiler, CheckLevel level,
boolean protectSideEffectFreeCode) {
this.compiler = compiler;
this.level = level;
this.protectSideEffectFreeCode = protectSideEffectFreeCode;
}
@Override
public void process(Node externs, Node root) {
NodeTraversal.traverse(compiler, root, this);
// Code with hidden side-effect code is common, for example
// accessing "el.offsetWidth" forces a reflow in browsers, to allow this
// will still allowing local dead code removal in general,
// protect the "side-effect free" code in the source.
//
if (protectSideEffectFreeCode) {
protectSideEffects();
}
}
@Override
public void hotSwapScript(Node scriptRoot, Node originalRoot) {
NodeTraversal.traverse(compiler, scriptRoot, this);
}
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
// VOID nodes appear when there are extra semicolons at the BLOCK level.
// I've been unable to think of any cases where this indicates a bug,
// and apparently some people like keeping these semicolons around,
// so we'll allow it.
if (n.isEmpty() ||
n.isComma()) {
return;
}
if (parent == null) {
return;
}
// Do not try to remove a block or an expr result. We already handle
// these cases when we visit the child, and the peephole passes will
// fix up the tree in more clever ways when these are removed.
if (n.isExprResult()) {
return;
}
// This no-op statement was there so that JSDoc information could
// be attached to the name. This check should not complain about it.
if (n.isQualifiedName() && n.getJSDocInfo() != null) {
return;
}
boolean isResultUsed = NodeUtil.isExpressionResultUsed(n);
boolean isSimpleOp = NodeUtil.isSimpleOperatorType(n.getType());
if (parent.getType() == Token.COMMA) {
if (isResultUsed) {
return;
}
if (n == parent.getLastChild()) {
int start = 0;
}
} else if (parent.getType() != Token.EXPR_RESULT && parent.getType() != Token.BLOCK) {
if (! (parent.getType() == Token.FOR && parent.getChildCount() == 4 && (n == parent.getFirstChild() || n == parent.getFirstChild().getNext().getNext()))) {
return;
}
}
if (
(isSimpleOp || !NodeUtil.mayHaveSideEffects(n, t.getCompiler()))) {
String msg = "This code lacks side-effects. Is there a bug?";
if (n.isString()) {
msg = "Is there a missing '+' on the previous line?";
} else if (isSimpleOp) {
msg = "The result of the '" + Token.name(n.getType()).toLowerCase() +
"' operator is not being used.";
}
t.getCompiler().report(
t.makeError(n, level, USELESS_CODE_ERROR, msg));
// TODO(johnlenz): determine if it is necessary to
// try to protect side-effect free statements as well.
if (!NodeUtil.isStatement(n)) {
problemNodes.add(n);
}
}
}
/**
* Protect side-effect free nodes by making them parameters
* to a extern function call. This call will be removed
* after all the optimizations passes have run.
*/
private void protectSideEffects() {
if (!problemNodes.isEmpty()) {
addExtern();
for (Node n : problemNodes) {
Node name = IR.name(PROTECTOR_FN).srcref(n);
name.putBooleanProp(Node.IS_CONSTANT_NAME, true);
Node replacement = IR.call(name).srcref(n);
replacement.putBooleanProp(Node.FREE_CALL, true);
n.getParent().replaceChild(n, replacement);
replacement.addChildToBack(n);
}
compiler.reportCodeChange();
}
}
private void addExtern() {
Node name = IR.name(PROTECTOR_FN);
name.putBooleanProp(Node.IS_CONSTANT_NAME, true);
Node var = IR.var(name);
// Add "@noalias" so we can strip the method when AliasExternals is enabled.
JSDocInfoBuilder builder = new JSDocInfoBuilder(false);
var.setJSDocInfo(builder.build(var));
CompilerInput input = compiler.getSynthesizedExternsInput();
input.getAstRoot(compiler).addChildrenToBack(var);
compiler.reportCodeChange();
}
/**
* Remove side-effect sync functions.
*/
static class StripProtection extends AbstractPostOrderCallback implements CompilerPass {
private final AbstractCompiler compiler;
StripProtection(AbstractCompiler compiler) {
this.compiler = compiler;
}
@Override
public void process(Node externs, Node root) {
NodeTraversal.traverse(compiler, root, this);
}
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
if (n.isCall()) {
Node target = n.getFirstChild();
// TODO(johnlenz): add this to the coding convention
// so we can remove goog.reflect.sinkValue as well.
if (target.isName() && target.getString().equals(PROTECTOR_FN)) {
Node expr = n.getLastChild();
n.detachChildren();
parent.replaceChild(n, expr);
}
}
}
}
}
| [
"he_ye_90s@hotmail.com"
] | he_ye_90s@hotmail.com |
2c91c770138f6cd2a87d48aa48344ed3dbf70f25 | 3aa51dd763f3559b0b1a2b61c3e752423dfea020 | /chap05/src/sec06/exam03_array_length/ArrayRankExample02.java | f47e71368e0a79e77e3e383614bb464ff4a9647b | [] | no_license | JoSooBin/thejoeun | b50df3a19dea49525e8a30a6c722bff86838f0b9 | 95c5f466db512239d43488244b59cc8b86bfff4f | refs/heads/master | 2023-01-22T14:22:56.413275 | 2020-12-01T09:22:15 | 2020-12-01T09:22:15 | 309,948,111 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,403 | java | package sec06.exam03_array_length;
//석차구하기 for문. 자기 자신 빼고 했던 비교 중복 제외하고 비교. 비교횟수: 4321..
public class ArrayRankExample02 {
public static void main(String[] args) {
int[] scores = { 83, 90, 87, 50, 88, 55, 75 };
int i, j, k ;
// int[] rank = { 1,1,1,1,1,1,1 };
int[] rank = new int[scores.length];//8번줄이랑 같은 말
System.out.println("---------기본data출력----------");
for (i=0; i<scores.length; i++){
System.out.printf("%3d ",scores[i]);// 83 90 87 50 88 55 75
}
System.out.println("------------------------");
System.out.println("---------기본 석차 출력----------");
for (i=0; i<rank.length; i++){
System.out.printf("%3d ",rank[i]); // 0 0 0 0 0 0 0
}
System.out.println("------------------------");
for (j=0; j<scores.length-1; j++){
for (k=j+1; k<scores.length; k++){
if(scores[j]<scores[k]) {
rank[j]=rank[j]+1; //나보다 점수 큰 사람 만나면 석차 증가
}else if(scores[j]>scores[k]){
rank[k]=rank[k]+1; //나보다 점수 작은 사람 만나면 상대 석차 증가
}else{
continue;
}
}
}
System.out.println("---------정렬 석차 출력----------");
for (i=0; i<rank.length; i++){
System.out.printf("%3d ",rank[i]); // 3 0 2 6 1 5 4
}
}
}
| [
"tjoeun-jg-501@DESKTOP-4IU9U8O"
] | tjoeun-jg-501@DESKTOP-4IU9U8O |
1218c87c3132c77954ca7e1ed1fe1fd71ddf95dd | 3c6c5a9158120c7647f65b079c6289ebe8eba617 | /customerapi/src/main/java/com/nec/customerapi/models/Address.java | 597c923ff79c1541446ac7f55d463622d38ee232 | [] | no_license | eswaribala/rpsnecmsaug2021projects | 80547d088547d2e811c206b042fc2dba97fa12ac | f381b57ce5901f6f34aa4d3a379cbeed3bbd5dc9 | refs/heads/master | 2023-08-10T19:36:17.293672 | 2021-09-04T07:20:11 | 2021-09-04T07:20:11 | 401,583,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,256 | java | package com.nec.customerapi.models;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.ForeignKey;
@Entity
@Table(name="Address")
@Data
public class Address {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(position = 1, required = true, hidden=true, notes = "Auto generated column")
@Column(name="Address_Id")
private long addressId;
@Column(name="Door_No",nullable = false)
private String doorNo;
@Column(name="Street_Name",nullable = false)
private String streetName;
@Column(name="City",nullable = false)
private String city;
@Column(name="State",nullable = false)
private String state;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(foreignKey = @ForeignKey(name = "Customer_Id"), name = "CustomerFK_Id")
@JsonIgnore
private Customer customer;
}
| [
"parameswaribala@gmail.com"
] | parameswaribala@gmail.com |
b8d0598f608ef89320c81c928e8aeb22b884abb6 | d58ba9f52c3db4177a9b517d202c9a87058c3015 | /src/main/java/com/ibotta/interview/service/AnagramService.java | 2dcdc86f891e2daca75e7580b94c374b6d1c22b9 | [] | no_license | nnsandford/anagram-finder | 436dfa80e14349ba41472c4bf65541f6aee87ce5 | c36874dc9a40bb9605bc74b87704e831c0cd0204 | refs/heads/master | 2021-01-20T11:18:18.990175 | 2017-03-06T06:50:03 | 2017-03-06T06:50:03 | 83,948,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.ibotta.interview.service;
import com.ibotta.interview.vo.AnagramsWrapper;
import java.util.List;
/**
* Created by nsandford on 3/4/17 at 9:10 PM
*/
public interface AnagramService
{
AnagramsWrapper searchForAnagrams(String word, Integer maxResults, boolean includeProperNouns);
List<String> retrieveAllWords();
void addWordsToDictionary(List<String> words);
void deleteWordFromDictionary(String word);
void deleteAllWords();
int deleteAllAnagrams(String anagram);
}
| [
"nsandford@homeadvisor.com"
] | nsandford@homeadvisor.com |
ec8402cb9c03811d0c5f53fe560c11f1cda389ca | 84be5730573e398082fd126a8a0bf3a0669d8c4c | /src/main/java/com/dkohut/dmbrb/generators/WrapperGenerator.java | ddb35c93cde04eab40a1fc95bdc3ec87bf900ff4 | [
"MIT"
] | permissive | dmytrokohut/DMBRB | 7a2f27686b91d0ec83e76fbc3d10556bb82cfc51 | 4cf0046963d5dea1df3318a0f6ef6b6030e2924a | refs/heads/master | 2021-09-03T20:46:37.002277 | 2018-01-11T22:35:34 | 2018-01-11T22:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,362 | java | package com.dkohut.dmbrb.generators;
import java.io.File;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.web3j.codegen.TruffleJsonFunctionWrapperGenerator;
public class WrapperGenerator {
private static final Logger logger = Logger.getLogger(WrapperGenerator.class.getName());
private static String pathToFiles;
private static String pathForOutput;
private static String packageName;
public static void generateWrappers(String pathToFiles, String pathForOutput, String packageName) {
WrapperGenerator.pathToFiles = pathToFiles;
WrapperGenerator.pathForOutput = pathForOutput;
WrapperGenerator.packageName = packageName;
File directory = new File(pathToFiles);
String[] solidityFiles = directory.list((file, name) -> {
return name.endsWith(".json");
});
Arrays.stream(solidityFiles).forEach(WrapperGenerator::generate);
logger.info("Wrappers generated");
}
public static void generate(String filename) {
String[] params = new String[] {
"--solidityTypes",
pathToFiles + "/" + filename,
"-o",
pathForOutput,
"-p",
packageName
};
try {
TruffleJsonFunctionWrapperGenerator.main(params);
} catch(Exception e) {
logger.log(Level.SEVERE, "Exception during wrapper generetors\n" + e.getMessage() + "\n" + e.getStackTrace());
}
}
}
| [
"retr0finr1r@gmail.com"
] | retr0finr1r@gmail.com |
2d112647e63e568367d7424dfbf676d35dfda0b6 | bf4122f5ae3a9f9b9c2cc94ef87cdb9dcadc9dc9 | /Transfer/My Study/forestrymanagementsystemcollection/src/main/java/com/tyss/forestrymanagementsystemcollection/controller/ProductIO.java | a7f3f02cc528a32bd567a403cef6a23c8d009685 | [] | no_license | haren7474/TY_ELF_JFS_HarendraKumar | 7ef8b9a0bb6d6bdddb94b88ab2db4e0aef0fbc1d | f99ef30b40d0877167c8159e8b7f322af7cc87b9 | refs/heads/master | 2023-01-11T01:01:10.458037 | 2020-01-23T18:20:20 | 2020-01-23T18:20:20 | 225,845,989 | 0 | 0 | null | 2023-01-07T22:01:21 | 2019-12-04T11:00:37 | HTML | UTF-8 | Java | false | false | 6,862 | java | package com.tyss.forestrymanagementsystemcollection.controller;
import java.util.List;
import java.util.Scanner;
import com.tyss.forestrymanagementsystemcollection.dto.ProductBean;
import com.tyss.forestrymanagementsystemcollection.factory.ForestryManagementSystemFactory;
import com.tyss.forestrymanagementsystemcollection.services.ProductServices;
public class ProductIO {
static Scanner sc = new Scanner(System.in);
static ProductBean product = null;
static List<ProductBean> productList = null;
static ProductServices productServices = ForestryManagementSystemFactory.instanceOfProductServies();
public static void productHandler(String userType) {
while (true) {
int productId;
switch (productMenu(userType)) {
case 1:
displayAllProducts();
break;
case 2:
System.out.println("Please enter Product Id to be searched");
productId = Validation.readValidInteger();
product = productServices.searchProduct(productId);
if (product != null) {
System.out.println("Product Id: " + productId + " is present in database.");
System.out.println("Product Name: " + product.getProductName());
System.out.println("Product Quantity: " + product.getProductQuantity());
System.out.println("Product Price: " + product.getProductPrice());
} else {
System.out.println("Product Id: " + productId + " is not present in database.");
}
break;
case 3:
displayProductDemand();
break;
case 4:
if (userType.equalsIgnoreCase("Owner")) {
if (productServices.addProduct(readProductDetails())) {
System.out.println("New Product has been added");
} else {
System.err.println("Incorrect Input, please try again.");
}
} else {
System.out.println("Modification rights are reserved for Owner only.");
}
break;
case 5:
if (userType.equalsIgnoreCase("Owner")) {
System.out.println("Please enter Product Id to be deleted");
productId = Validation.readValidInteger();
if (productServices.deleteProduct(productId)) {
System.out.println("Product with ID: " + productId + " has been deleted");
} else {
System.out.println("Product with ID: " + productId + " is not present in database");
}
} else {
System.out.println("Modification rights are reserved for Owner only.");
}
break;
case 6:
if (userType.equalsIgnoreCase("Owner")) {
displayAllProducts();
System.out.println("Please enter Product Id from above list to update quantity");
productId = Validation.readValidInteger();
if (productServices.searchProduct(productId) != null) {
System.out.println("Please enter new Quantity");
int newQuantity = Validation.readValidQuantity();
productServices.updateQuantity(productId, newQuantity);
System.out.println("Product quantity has been updated.");
} else {
System.out.println("Product Id: " + productId + " is not present in database.");
}
} else {
System.out.println("Modification rights are reserved for Owner only.");
}
break;
case 7:
return;
case 8:
System.exit(0);
break;
default:
System.out.println("Invalid Choice");
}
}
}
private static void displayProductDemand() {
productList = productServices.getAllProduct();
if (productList.size() > 0) {
System.out.println("\t\t<<<<<<Product Details>>>>>");
System.out.println("PId\tOwnId\tQuantity\tPrice($)\tName\t\tComments");
System.out.println("---------------------------------------------------------------------");
int countOfProductsInDemand = 0;
for (ProductBean product : productList) {
if (product.getProductQuantity() < 20) {
countOfProductsInDemand++;
System.out.println(product);
}
}
if (countOfProductsInDemand == 0) {
System.out.println("All product have enough stock as per current demand!!!!");
} else {
System.out.println(countOfProductsInDemand
+ " products which are listed above are in demand, need to be imported");
}
} else {
System.out.println("No Database for Products, please add new product");
}
}
public static int productMenu(String userType) {
if (userType.equalsIgnoreCase("Owner")) {
System.out.println("***********Product Menu***********");
System.out.println(
"1. Display All Product\n2. Search Product\n3. Check Product Demand\n4. Add Product\n5. Delete Product\n6. Update Product Quantity\n7. Go to Dashboard\n8. Exit");
System.out.println("*********************************");
System.out.println("Please enter your choice from Product Menu");
int productChoice = Validation.readValidInteger();
return productChoice;
} else {
System.out.println("***********Product Menu***********");
System.out.println(
"1. Display All Product\n2. Search Product\n3. Check Product Demand\n4. Go to Dashboard\n5. Exit");
System.out.println("*********************************");
System.out.println("Please enter your choice from Product Menu");
int productChoice = Validation.readValidInteger();
if (productChoice == 1) {
productChoice = 1;
} else if (productChoice == 2) {
productChoice = 2;
} else if (productChoice == 3) {
productChoice = 3;
} else if (productChoice == 4) {
productChoice = 7;
} else if (productChoice == 5) {
productChoice = 8;
} else {
productChoice = -1;
}
return productChoice;
}
}
public static ProductBean readProductDetails() {
product = new ProductBean();
System.out.println("Please enter Product Id");
int productId = Validation.readValidInteger();
product.setProductId(productId);
System.out.println("Please enter Product Name");
sc.nextLine();
String productName = Validation.readValidName();
product.setProductName(productName);
System.out.println("Please enter Product Quantity");
int productQuantity = Validation.readValidInteger();
product.setProductQuantity(productQuantity);
System.out.println("Please enter Product Price per unit");
double productPrice = sc.nextDouble();
product.setProductPrice(productPrice);
System.out.println("Please enter Product Comments");
sc.nextLine();
product.setProductComments(sc.nextLine());
product.setProductOwnerId(ContractIO.displayAllUsersGetIdInput("Owner"));
return product;
}
public static void displayAllProducts() {
productList = productServices.getAllProduct();
if (productList.size() > 0) {
System.out.println("\t\t<<<<<<Product Details>>>>>");
System.out.println("PId\tOwnId\tQuantity\tPrice($)\tName\t\tComments");
System.out.println("---------------------------------------------------------------------");
for (ProductBean product : productList) {
System.out.println(product);
}
} else {
System.out.println("No Database for Products, please add new product");
}
}
}
| [
"harendra10104698@gmail.com"
] | harendra10104698@gmail.com |
ae8084f3cbfae98fdfebdc19c3ca77834d7d52aa | 28fb9884e4b35831bbccf3ead11296bf08272173 | /estatioapp/app/src/main/java/org/estatio/module/lease/dom/invoicing/summary/comms/DocAndCommForInvoiceDoc_downloadSelected.java | 8c67d262d1f5d1ad21210d67c9dbbee2aeb77a0c | [
"Apache-2.0"
] | permissive | grandPiano/estatio | 1703191d57f4a784fbfa33f96cd3fe68ce66a575 | 3923f15a59fc13dff2aa181e89dbd4fa6750c107 | refs/heads/master | 2020-08-12T18:39:28.628482 | 2019-10-04T09:33:09 | 2019-10-04T09:33:09 | 214,820,841 | 1 | 0 | Apache-2.0 | 2019-10-13T13:00:55 | 2019-10-13T13:00:55 | null | UTF-8 | Java | false | false | 1,218 | java | /*
*
* Copyright 2012-2014 Eurocommercial Properties NV
*
*
* 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.estatio.module.lease.dom.invoicing.summary.comms;
import org.apache.isis.applib.annotation.Mixin;
import org.estatio.module.invoice.dom.DocumentTypeData;
/**
* TODO: inline this mixin (including superclass functionality) ... too confusing/abstracted
*/
@Mixin(method = "act")
public class DocAndCommForInvoiceDoc_downloadSelected extends DocAndCommAbstract_downloadSelected<DocAndCommForInvoiceDoc> {
public DocAndCommForInvoiceDoc_downloadSelected(final DocAndCommForInvoiceDoc docAndComm) {
super(docAndComm, DocumentTypeData.INVOICE);
}
}
| [
"dan@haywood-associates.co.uk"
] | dan@haywood-associates.co.uk |
860472e27432973ba30e1d091c77b42bc88a5595 | be12d70cbbf603ee8ece436d955a75fa15fb10c3 | /Packages/Demo1.java | 8642ef3743e9a21532616e4ffa86fa688144980f | [] | no_license | sahilanand14/JavaPrograms | da06f1581ee9e43b924e2dcc9b844944c54c5ce3 | 5df98807a2721281cb22a6a29da82eaf4d986934 | refs/heads/master | 2020-03-24T14:05:07.437078 | 2018-07-29T12:23:01 | 2018-07-29T12:23:01 | 142,758,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 182 | java | package p1;
public class Demo1
{
public static void main(String...s)
{
print();
}
public static void print()
{
System.out.println("Class of Package p1");
}
} | [
"sahilanand620@gmail.com"
] | sahilanand620@gmail.com |
5de61781b926410ead066fd5f84ac2022b2f6694 | 15e74fb0aabc1fa26826853d43461a349f9664f7 | /nlf2-core/src/main/java/com/nlf/dao/setting/IDbSettingManager.java | fac6da810c977658aef3c1931951892eb4ce00f9 | [
"MIT"
] | permissive | BasicTime/nlf2-maven | 6b9b4c20cf0a3f307cceb6bddb0648813317bcf6 | cd654bb905bb775ddf2faadf1185d5696808ed41 | refs/heads/master | 2023-01-23T03:21:27.104030 | 2020-12-10T09:20:26 | 2020-12-10T09:20:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package com.nlf.dao.setting;
/**
* DB配置管理接口
*
* @author 6tail
*
*/
public interface IDbSettingManager{
/**
* 获取DB配置列表
* @return DB配置列表
*/
java.util.List<IDbSetting> listDbSettings();
} | [
"6tail@6tail.cn"
] | 6tail@6tail.cn |
8a7a1698be45f9b3208896d3cdbb086c4c2515db | 9dc4c60f1529a6740e3abf6d487124ed3342c57c | /src/main/java/com/web2/hotel/entities/Reservas.java | 471172ee3c3b71831863f8ccde912b1993cccd7e | [] | no_license | lorenazuazo/proyectoWeb2 | 4a12d77b6dbb0b4fc366f53cd671393fed97d02a | e0ee3e0ebcdabff29c4c2a50bd4df486022f8bd6 | refs/heads/master | 2022-11-17T21:24:16.807230 | 2020-07-10T18:13:25 | 2020-07-10T18:13:25 | 278,689,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,548 | java | package com.web2.hotel.entities;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Set;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;
import com.sun.istack.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Entity
@SuppressWarnings("serial")
@Table(name="reservas")
@Data @AllArgsConstructor @NoArgsConstructor
public class Reservas implements Serializable{
@Id
@GeneratedValue(strategy=GenerationType.AUTO, generator="native")
@GenericGenerator(name="native",strategy="native")
@Column
private long idReserva;
@Column
@NotNull
private String nombre;
@Column
@NotNull
private String apellido;
@Column
@NotNull
private String dni;
@Column
@NotNull
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate fechaEntrada;
@Column
@NotNull
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate fechaSalida;
@Column
@NotNull
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate fechaReserva;
@Column
private int cantDias;
@Column
@NotNull
private int cantHabitaciones;
@Column
@NotNull
private int cantAdultos;
@Column
private int cantNinios;
@Column
private int tarifaReserva;
@Column
@Enumerated(EnumType.STRING)
private Estado estado;
@Transient
private String username;
/*union con usuario para saber quien hace la reserva*/
@ToString.Exclude
@EqualsAndHashCode.Exclude
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="idUsuario")
private Usuario usuario;
/*union con huesped para el grupo del huesped que hace la reserva*/
@ToString.Exclude
@EqualsAndHashCode.Exclude
@ManyToMany
@JoinTable(
name = "reserva_grupohuesped",
joinColumns = { @JoinColumn(name = "reserva_id")},
inverseJoinColumns = {@JoinColumn(name = "huesped_id")})
private Set<Huesped>huespedGrupo;
/*union con habitaciones*/
@ToString.Exclude
@EqualsAndHashCode.Exclude
@ManyToMany
@JoinTable(
name = "reserva_habitacion",
joinColumns = { @JoinColumn(name = "reserva_id")},
inverseJoinColumns = {@JoinColumn(name = "habitacion_id")})
private Set<Habitacion>habitacion;
public enum Estado {
CONFIRMADA,CONCLUIDA,EXPIRADA,CANCELADA
}
}
| [
"pepa_zz@hotmail.com"
] | pepa_zz@hotmail.com |
7b90287bc15599a621fc0ffc95d59977179986a9 | 2670e2ee9a147ce75066e52bb6230da68affe043 | /src/com/adriana/psExececao/ErroCadastroDadosException.java | c6092a53f17889dd69124ff766d32dc007d4f59b | [] | no_license | Adrianapppsss/Projeto-POOII | 2691351bdce7cea1783c512c22a8f06679c61398 | 3906ab11b7b596ce9ccf320fe647f08ef56136a4 | refs/heads/master | 2021-01-13T14:28:48.023604 | 2015-10-23T00:29:51 | 2015-10-23T00:29:51 | 44,780,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package com.adriana.psExececao;
public class ErroCadastroDadosException extends Exception {
public ErroCadastroDadosException(){
super("Erro no cadastro de dados");
}
}
| [
"adrinaps2016@hotmail.com"
] | adrinaps2016@hotmail.com |
55e299694344e97c80016b08cc28c2555bdc791f | 273a9e2aaaba7b4dafe9acbf5d52a20339f762b3 | /src/main/java/com/young/http/DataUtil.java | 9fe355a9339a8d85c8ceba6259443ffbaed910c8 | [] | no_license | missaouib/icore | 419ba817de7c466ec3962ad62bcaadb854c5d90e | 759a2f472f3d52e07ed466120fbcd9dfa02213e9 | refs/heads/master | 2021-12-30T05:37:47.338587 | 2018-02-06T02:05:39 | 2018-02-06T02:05:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,822 | java | package com.young.http;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Internal static utilities for handling data.
*
*/
public class DataUtil {
private static final Pattern charsetPattern = Pattern
.compile("(?i)\\bcharset=\\s*\"?([^\\s;\"]*)");
public static final String defaultCharset = "UTF-8"; // used if not found in
// header
// or meta charset
private static final int bufferSize = 0x20000; // ~130K.
public DataUtil() {
}
/**
* Loads a file to a Document.
*
* @param in
* file to load
* @param charsetName
* character set of input
* @param baseUri
* base URI of document, to resolve relative links against
* @return Document
* @throws IOException
* on IO error
*/
public static ByteBuffer readToByteBuffer(InputStream inStream)
throws IOException {
byte[] buffer = new byte[bufferSize];
ByteArrayOutputStream outStream = new ByteArrayOutputStream(bufferSize);
int read;
while (true) {
read = inStream.read(buffer);
if (read == -1)
break;
outStream.write(buffer, 0, read);
}
ByteBuffer byteData = ByteBuffer.wrap(outStream.toByteArray());
return byteData;
}
/**
* Parse out a charset from a content type header.
*
* @param contentType
* e.g. "text/html; charset=EUC-JP"
* @return "EUC-JP", or null if not found. Charset is trimmed and
* uppercased.
*/
static String getCharsetFromContentType(String contentType) {
if (contentType == null)
return null;
Matcher m = charsetPattern.matcher(contentType);
if (m.find()) {
return m.group(1).trim().toUpperCase();
}
return null;
}
}
| [
"cng1985@gmail.com"
] | cng1985@gmail.com |
cb077398af45195614061354a499d031b0dcdf7e | 78811ea9217a638e78502aa9dc1f5dab6ef8bf47 | /OTM/app/src/test/java/com/nuntteuniachim/otm/ExampleUnitTest.java | c6f612d9e16b526e4364a16a79d915991e43c4d0 | [] | no_license | jnh0465/Android_OTM-Project | 6edaf55c22429f2c5b561ce8ba329347af6bd3b8 | e1c68c282af6f744801504015df0fc383e27431f | refs/heads/master | 2020-04-21T02:20:46.936998 | 2019-02-27T05:22:39 | 2019-02-27T05:22:39 | 169,251,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.nuntteuniachim.otm;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"jnh0465@naver.com"
] | jnh0465@naver.com |
9d8bed1609ecdbb55ac0a820cd44c644dbcb5223 | 4fd5a26360467ab071c5ae991ada8edce244b569 | /app/src/test/java/com/google/guo/myapplication/ExampleUnitTest.java | d78935887f534801592d2cb72554419de8c5324c | [] | no_license | wherego/MyApplication | f6219d8379ae2984f7b87251c2ebcaba6e62b8b0 | 1c126221eda68536e5e2b19b914c31fcb3a33375 | refs/heads/master | 2021-01-20T12:58:06.169996 | 2016-08-17T09:17:14 | 2016-08-17T09:17:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.google.guo.myapplication;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"729634515@qq.com"
] | 729634515@qq.com |
bd956ce0b549c53028578a306e996215d1a75f23 | 50572602b6f922127ffc97b4de12bcabb017ca17 | /moneta-core/src/main/java/org/moneta/dao/sqlgen/DefaultSqlGenerator.java | 0bad7f33bdf3332f15c845aa15fda8131f95dbb1 | [
"Apache-2.0"
] | permissive | Brogramr786/moneta | 348cef351406622f6537e95e284fa6eef1281764 | 089d1d60ff43f8b40818de8f20fadb297711868b | refs/heads/master | 2020-03-20T11:50:00.071507 | 2017-05-20T20:36:32 | 2017-05-20T20:36:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,883 | java | /*
* This software is licensed under the Apache License, Version 2.0
* (the "License") agreement; 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.moneta.dao.sqlgen;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.moneta.dao.types.SqlStatement;
import org.moneta.types.search.CompositeCriteria;
import org.moneta.types.search.Criteria;
import org.moneta.types.search.FilterCriteria;
import org.moneta.types.topic.Topic;
/**
* Default SQL generator for ANSI-standard Sql.
* @author D. Ashmore
*
*/
public class DefaultSqlGenerator implements SqlGenerator {
protected static enum LockIntent {NONE, ROW};
private Map<FilterCriteria.Operation, String> operationSymbolMap = new HashMap<FilterCriteria.Operation, String>();
public DefaultSqlGenerator() {
operationSymbolMap.put(FilterCriteria.Operation.EQUAL, "=");
operationSymbolMap.put(FilterCriteria.Operation.GREATER_THAN, ">");
operationSymbolMap.put(FilterCriteria.Operation.IS_NOT_NULL, " is not null ");
operationSymbolMap.put(FilterCriteria.Operation.IS_NULL, " is null ");
operationSymbolMap.put(FilterCriteria.Operation.LESS_THAN, "<");
operationSymbolMap.put(FilterCriteria.Operation.LIKE, " like ");
operationSymbolMap.put(FilterCriteria.Operation.NOT_EQUAL, "<>");
}
public SqlStatement generateSelect(Topic topic, CompositeCriteria searchCriteria,
String[] fieldNames) {
StringBuilder builder = new StringBuilder(this.generateSelectClause(fieldNames));
builder.append(" ");
builder.append(this.generateFromClause(topic, LockIntent.NONE));
SqlStatement statement = null;
if (searchCriteria != null) {
builder.append(" ");
statement = this.generateWhereClause(searchCriteria);
builder.append(statement.getSqlText());
}
else {
statement = new SqlStatement();
}
statement.setSqlText(builder.toString());
return statement;
}
protected SqlStatement generateWhereClause(CompositeCriteria searchCriteria) {
if (searchCriteria.getSearchCriteria() == null) {
return new SqlStatement("");
}
if (searchCriteria.getSearchCriteria().length == 0) {
return new SqlStatement("");
}
SqlStatement sqlStatement = new SqlStatement();
StringBuilder builder = new StringBuilder();
for (Criteria criteria : searchCriteria.getSearchCriteria()) {
if (builder.length() == 0) {
builder.append("where ");
}
else {
builder.append(" ");
builder.append(searchCriteria.getOperator().toString().toLowerCase());
builder.append(" ");
}
appendCriteria(builder, criteria, sqlStatement.getHostVariableValueList());
}
sqlStatement.setSqlText(builder.toString());
return sqlStatement;
}
protected String formatCompositeCriteria(CompositeCriteria compositeCriteria, List<Object> hostVariableValueList) {
Validate.notNull(compositeCriteria, "Null compositeCriteria not allowed. criteria="+compositeCriteria);
Validate.notNull(compositeCriteria.getOperator(), "Null compositeCriteria operator not allowed. criteria="+compositeCriteria);
if (compositeCriteria.getSearchCriteria() == null) {
return "";
}
if (compositeCriteria.getSearchCriteria().length == 0) {
return "";
}
StringBuilder builder = new StringBuilder("(");
for (Criteria criteria: compositeCriteria.getSearchCriteria()) {
if (builder.length() > 1) {
builder.append(" ");
builder.append(compositeCriteria.getOperator().toString().toLowerCase());
builder.append(" ");
}
appendCriteria(builder, criteria, hostVariableValueList);
}
builder.append(")");
return builder.toString();
}
protected void appendCriteria(StringBuilder builder, Criteria criteria, List<Object> hostVariableValueList) {
if (criteria instanceof FilterCriteria) {
builder.append(this.formatFilterCriteria((FilterCriteria) criteria, hostVariableValueList));
}
else {
builder.append(this.formatCompositeCriteria((CompositeCriteria) criteria, hostVariableValueList));
}
}
protected String formatFilterCriteria(FilterCriteria filterCriteria, List<Object> hostVariableValueList) {
Validate.notNull(filterCriteria, "Null filterCriteria not allowed.");
Validate.notNull(filterCriteria.getOperation(), "Null operation not allowed. criteria="+filterCriteria);
Validate.notEmpty(filterCriteria.getFieldName(), "Null or blank field name not allowed.");
StringBuilder builder = new StringBuilder();
builder.append(filterCriteria.getFieldName());
builder.append(" ");
builder.append(this.formatConditionOperation(filterCriteria.getOperation()));
if ( !FilterCriteria.Operation.IS_NULL.equals(filterCriteria.getOperation()) &&
!FilterCriteria.Operation.IS_NOT_NULL.equals(filterCriteria.getOperation())) {
hostVariableValueList.add(filterCriteria.getValue());
builder.append("?");
}
return builder.toString();
}
protected String formatConditionOperation(FilterCriteria.Operation operation) {
return operationSymbolMap.get(operation);
}
protected String generateSelectClause(String[] fieldNames) {
StringBuilder builder = new StringBuilder("select ");
if (fieldNames == null) {
builder.append("*");
}
else {
builder.append(StringUtils.join(fieldNames, ','));
}
return builder.toString();
}
protected String generateFromClause(Topic topic, LockIntent lockIntent) {
StringBuilder builder = new StringBuilder("from ");
if ( !StringUtils.isEmpty(topic.getCatalogName())) {
builder.append(this.formatCatalogName(topic.getCatalogName()));
builder.append(".");
}
if ( !StringUtils.isEmpty(topic.getSchemaName())) {
builder.append(this.formatSchemaName(topic.getSchemaName()));
builder.append(".");
}
else if (!StringUtils.isEmpty(topic.getCatalogName())) {
builder.append(".");
}
builder.append(this.formatTableName(topic.getTableName(), lockIntent));
return builder.toString();
}
protected String formatCatalogName(String catalogName) {
return catalogName;
}
protected String formatSchemaName(String schemaName) {
return schemaName;
}
protected String formatTableName(String tableName, LockIntent lockIntent) {
return tableName;
}
}
| [
"dashmore@force66.com"
] | dashmore@force66.com |
a6b812a59ca5123ee3b3fd61158b32fea03c48c8 | e34a4340714b8398a059ff3b1d67d1b1d7175d32 | /src/tp1/Fou.java | dee5796a9c6631c55339d96201bb68789bacb419 | [] | no_license | Boumediene1/Chess_game | e657e90da6b5f61fee2e1c591a983b7806973113 | a47fb30acc31eeee47ce192cd4d9f4fa6e4bcd72 | refs/heads/master | 2021-01-24T09:29:42.510998 | 2018-02-26T19:05:08 | 2018-02-26T19:05:08 | 123,016,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,309 | 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 tp1;
import static java.lang.Math.abs;
/**
*
* @author Patrick
*/
public class Fou extends Piece {
public Fou(boolean est_blancC, int colonneC, int ligneC, Echiquier echiquierC) {
super(est_blancC, colonneC, ligneC, echiquierC);
}
public String representationAscii() {
if (super.estBlanc()==true) {return "F";}
else {return "f";}
}
public String representationUnicode() {
if (super.estBlanc()==true) {return "\u2657";}
else {return "\u265D";}
}
public boolean deplacementValide(int nouvelle_colonne, int nouvelle_ligne) {
int ligneInit = super.getLigne();
int colonneInit = super.getColonne();
if ((abs(ligneInit-nouvelle_ligne)==abs(colonneInit-nouvelle_colonne))
&&((abs(ligneInit-nouvelle_ligne)+abs(colonneInit-nouvelle_colonne))>0)) {
if (super.deplacementValide(nouvelle_colonne, nouvelle_ligne)) {}
else return false;
}
else return false;
if (colonneInit<nouvelle_colonne&&ligneInit<nouvelle_ligne) {
for (int i=1 , j=1; colonneInit+i < nouvelle_colonne && ligneInit+i < nouvelle_ligne; i++, j++) {
if (super.getEchiquier().examinePiece(colonneInit+i, ligneInit+i)!=null) {
return false;
}
}
}
if (colonneInit<nouvelle_colonne&&ligneInit>nouvelle_ligne) {
for (int i=1 , j=1; colonneInit+i < nouvelle_colonne && ligneInit-i > nouvelle_ligne; i++, j++) {
if (super.getEchiquier().examinePiece(colonneInit+i, ligneInit-i)!=null) {
return false;
}
}
}
if (colonneInit>nouvelle_colonne&&ligneInit<nouvelle_ligne) {
for (int i=1 , j=1; colonneInit-i > nouvelle_colonne && ligneInit+i < nouvelle_ligne; i++, j++) {
if (super.getEchiquier().examinePiece(colonneInit-i, ligneInit+i)!=null) {
return false;
}
}
}
if (colonneInit>nouvelle_colonne&&ligneInit>nouvelle_ligne) {
for (int i=1 , j=1; colonneInit-i > nouvelle_colonne && ligneInit-i > nouvelle_ligne; i++, j++) {
if (super.getEchiquier().examinePiece(colonneInit-i, ligneInit-i)!=null) {
return false;
}
}
}
return true;
}
}
| [
"noreply@github.com"
] | Boumediene1.noreply@github.com |
f7a6facdff5a68149395ac53d63e32a191de5987 | 7826588e64bb04dfb79c8262bad01235eb409b3d | /src/test/java/com/microsoft/bingads/v13/api/test/entities/criterions/adgroup/hoteladvancebookingwindow/BulkAdGroupHotelAdvanceBookingWindowCriterionReadTests.java | 40750a2c936809d6fb5dd26cb08cb9f38c16f555 | [
"MIT"
] | permissive | BingAds/BingAds-Java-SDK | dcd43e5a1beeab0b59c1679da1151d7dd1658d50 | a3d904bbf93a0a93d9c117bfff40f6911ad71d2f | refs/heads/main | 2023-08-28T13:48:34.535773 | 2023-08-18T06:41:51 | 2023-08-18T06:41:51 | 29,510,248 | 33 | 44 | NOASSERTION | 2023-08-23T01:29:18 | 2015-01-20T03:40:03 | Java | UTF-8 | Java | false | false | 755 | java | package com.microsoft.bingads.v13.api.test.entities.criterions.adgroup.hoteladvancebookingwindow;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import com.microsoft.bingads.v13.api.test.entities.criterions.adgroup.hoteladvancebookingwindow.read.BulkAdGroupHotelAdvanceBookingWindowCriterionReadMaxDaysTest;
import com.microsoft.bingads.v13.api.test.entities.criterions.adgroup.hoteladvancebookingwindow.read.BulkAdGroupHotelAdvanceBookingWindowCriterionReadMinDaysTest;
@RunWith(Suite.class)
@Suite.SuiteClasses({
BulkAdGroupHotelAdvanceBookingWindowCriterionReadMaxDaysTest.class,
BulkAdGroupHotelAdvanceBookingWindowCriterionReadMinDaysTest.class,
})
public class BulkAdGroupHotelAdvanceBookingWindowCriterionReadTests {
}
| [
"xinyuwen@microsoft.com"
] | xinyuwen@microsoft.com |
0753a321566743bec63128f3d12ceb8e33f8d0da | da2ba7e4533148c236ba65b38e5727370def39c5 | /app/src/main/java/com/centa/aplusframework/contracts/base/BasePresenter.java | c1cda4e5b0abb70152820844fa9c250d3607b47a | [] | no_license | Andy888888/AplusFrameWork | 3de489d8579f2df5f8f66767d00a3b97e2a46839 | eeefa9383afac2c6faf6e225073e0af1376e1d60 | refs/heads/master | 2020-04-05T14:02:42.777475 | 2017-06-29T14:50:00 | 2017-06-29T14:50:00 | 94,745,611 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package com.centa.aplusframework.contracts.base;
/**
* Created by yanwenqiang on 2017/6/28.
* <p>
* 描述:MVP-Presenter基类
*/
public abstract class BasePresenter<V extends BaseView, M extends BaseModel> {
/**
* View
*/
protected final V selfView;
/**
* Modle
*/
protected final M selfModel;
public BasePresenter(V view, M model) {
selfView = view;
selfModel = model;
}
}
| [
"yanwenqiang1991@foxmail.com"
] | yanwenqiang1991@foxmail.com |
c2c7de25a9f23914049c1ab32dffe428ae1dedcc | a56d4c80e5d5ba5cf09944fbb3430bbfc647ad55 | /src/main/java/br/com/zup/Treinopropostas/Cartao/BloqueioFeignResult.java | 97b669cf554b29026df532e6bd5f686db63f1f6a | [
"Apache-2.0"
] | permissive | MatheusHudson/orange-talents-03-template-proposta | ed07a7dd13edb65fb68386f7e3a77163f0a4a033 | 89b5f7f616312a68e104826e049eac93002a7dc4 | refs/heads/main | 2023-04-18T19:32:46.213324 | 2021-04-30T14:21:31 | 2021-04-30T14:21:31 | 357,996,306 | 0 | 0 | Apache-2.0 | 2021-04-14T17:58:26 | 2021-04-14T17:58:25 | null | UTF-8 | Java | false | false | 380 | java | package br.com.zup.Treinopropostas.Cartao;
import org.springframework.stereotype.Component;
public class BloqueioFeignResult {
private String resultado;
@Deprecated
public BloqueioFeignResult() {}
public BloqueioFeignResult(String resultado) {
this.resultado = resultado;
}
public String getResultado() {
return resultado;
}
}
| [
"matheushudson2013@gmail.com"
] | matheushudson2013@gmail.com |
1377323521da5aa5963ceac8a47bcda8b78121b2 | 4cc79a8b5b8c81d653045deb1f6d8f078bfca396 | /app/src/main/java/com/aang/aplikasigempa/adapter/ReycleViewAdapter.java | 261663393c4778f93cdf1b05b63865ce312dfebf | [] | no_license | aangKurniyawan/AplikasiGempa | 6a3b21df6aaecf19951d807f5a4a455195da16cc | e5612727ab79a8099105f26a8cd625b678108107 | refs/heads/master | 2021-01-12T18:14:12.594282 | 2016-10-19T10:27:59 | 2016-10-19T10:27:59 | 71,344,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,791 | java | package com.aang.aplikasigempa.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.lang.reflect.Constructor;
import java.util.List;
/**
* Created by Aang on 10/19/2016.
*/
public abstract class ReycleViewAdapter <T, VH extends RecyclerView.ViewHolder>
extends RecyclerView.Adapter<VH> {
protected int mLayout;
Class<VH> mViewHolderClass;
Class<T> mModelClass;
List<T> mData;
public ReycleViewAdapter(int mLayout,
Class<VH> mViewHolderClass,
Class<T> mModelClass, List<T> mData) {
this.mLayout = mLayout;
this.mViewHolderClass = mViewHolderClass;
this.mModelClass = mModelClass;
this.mData = mData;
}
@Override
public VH onCreateViewHolder(ViewGroup parent, int viewType) {
ViewGroup view = (ViewGroup)
LayoutInflater.from(parent.getContext())
.inflate(mLayout, parent, false);
try {
Constructor<VH> constructor = mViewHolderClass.getConstructor(View.class);
return constructor.newInstance(view);
}catch (Exception e){
throw new RuntimeException(e);
}
}
@Override
public void onBindViewHolder(VH holder, int position) {
T model = getItem(position);
bindView(holder, model, position);
}
abstract protected void bindView(VH holder, T model, int position);
private T getItem(int position) {
return mData.get(position);
}
@Override
public int getItemCount() {
if(mData == null){
return 0;
}else{
return mData.size();
}
}
}
| [
"aangkurniyawan@gmail.com"
] | aangkurniyawan@gmail.com |
926503593a9db43c2bcdeab1d3cf8717f45fb8d9 | 7b17f15297561ba5d9149ffea065ee515878899b | /src/com/galaxii/common/util/ImageUtil.java | 02953c0e50d85b78d3c9d5bc5d80128c1a21a823 | [] | no_license | t-kawatsu/galaxii | f4ece07fd98091164f42656e2ea811866ec87780 | 4828cfc34997ea5b0629dc5509ef6b8fe9148d87 | refs/heads/master | 2020-03-23T23:39:15.026973 | 2018-07-25T05:32:06 | 2018-07-25T05:32:06 | 142,247,063 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,074 | java | package com.galaxii.common.util;
import java.io.File;
import java.io.IOException;
import org.im4java.core.ConvertCmd;
import org.im4java.core.IMOperation;
import org.im4java.core.Info;
/**
* http://books.google.co.jp/books?id=SKJxWg_uKJUC&pg=PA60&lpg=PA60&dq=imagemagick+%E5%9B%BA%E5%AE%9A%E5%B9%85%E3%80%80%E4%BD%99%E7%99%BD&source=bl&ots=efIl-8qfih&sig=tsuH1Pvz1wQXPVnxyok5MG6VIw4&hl=ja&sa=X&ei=0vpFUY2oKJDvmAXoyYFw&ved=0CEkQ6AEwAw#v=onepage&q=imagemagick%20%E5%9B%BA%E5%AE%9A%E5%B9%85%E3%80%80%E4%BD%99%E7%99%BD&f=false
* @author t-kawatsu
*
*/
public class ImageUtil {
private ConvertCmd cmd = new ConvertCmd();
public void resize(File base, File dest, int w, int h)
throws IOException, InterruptedException, Exception {
// create the operation, add images and operators/options
IMOperation op = new IMOperation();
// add base image
op.addImage();
// resize
op.resize(w, h);
// make opaque to white
op.addRawArgs("-background", "white");
op.addRawArgs("-flatten");
// fix image size
op.addRawArgs("-gravity", "center");
op.extent(w, h);
// add dest image
op.addImage();
// execute the operation
cmd.run(op, base.toString(), dest.toString());
}
public void trimResize(File base, File dest, int w, int h)
throws IOException, InterruptedException, Exception {
Info info = new Info(base.toString(),true);
int bw = info.getImageWidth();
int bh = info.getImageHeight();
int dw = bw - w;
int dh = bh - h;
// create the operation, add images and operators/options
IMOperation op = new IMOperation();
// add base image
op.addImage();
// resize
if(dw < dh) {
op.resize(w, null);
} else {
op.resize(null, h);
}
// make opaque to white
op.background("white");
op.flatten();
// fix image size
op.gravity("center");
op.extent(w, h);
// crop
if(dw < dh) {
op.crop(w, h, 0, 0);
} else {
op.crop(w, h, 0, 0);
}
// +repage
op.p_repage();
// add dest image
op.addImage();
// execute the operation
cmd.run(op, base.toString(), dest.toString());
}
}
| [
"t-kawatsu@share.jogoj.com"
] | t-kawatsu@share.jogoj.com |
4253407a2926adec3a9a7019307a637e2f4aa696 | 69b79fcd9ce0b968d9900647b33e4bf988bf7fa0 | /interview/src/arrays/DiagonalTraverse.java | 63e13dcefc4fe09e319d4a5a14a66fb5b5e3cfa0 | [] | no_license | ryjarvis/interview | 77db65e6c26221db1dec1f9d9585003cd81494b8 | 75c95cbed7dd1e1a90ea104b26b124329d66f0b8 | refs/heads/master | 2021-05-16T12:33:02.203387 | 2018-10-12T18:13:54 | 2018-10-12T18:13:54 | 105,297,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,009 | java | package arrays;
/**
* @author: ryjarvis
* May 29, 2018
*
*/
//LeetCode 498
public class DiagonalTraverse {
public static int[] findDiagonalOrder(int[][] mat) {
int m=mat.length;
int n=mat[0].length;
int[] res=new int[m*n];
if(m==0) return res;
traverse(res,0,0,mat,true,0,m,n);
return res;
}
public static void traverse(int[]res,int x,int y,int[][]mat,boolean up,int idx,int m,int n){
if(x==m-1&&y==n-1){
res[idx]=mat[x][y];
return;
}
if(up){
while(x>=0&&y<n){
res[idx++]=mat[x--][y++];
}
x++;
y--;
if(y==n-1) {
x++;
}
else{
y++;
}
traverse(res,x,y,mat,false,idx,m,n);
}
else{
while(x<m&&y>=0){
res[idx++]=mat[x++][y--];
}
x--;
y++;
if(x==m-1) {
y++;
}
else{
x++;
}
traverse(res,x,y,mat,true,idx,m,n);
}
}
//cleaner solution
public int[] findDiagonalOrderOptimized(int[][] matrix) {
if (matrix == null || matrix.length == 0) return new int[0];
int m = matrix.length, n = matrix[0].length;
int[] result = new int[m * n];
int row = 0, col = 0, d = 0;
int[][] dirs = {{-1, 1}, {1, -1}};
for (int i = 0; i < m * n; i++) {
result[i] = matrix[row][col];
row += dirs[d][0];
col += dirs[d][1];
if (row >= m) { row = m - 1; col += 2; d = 1 - d;}
if (col >= n) { col = n - 1; row += 2; d = 1 - d;}
if (row < 0) { row = 0; d = 1 - d;}
if (col < 0) { col = 0; d = 1 - d;}
}
return result;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int[][]mat={{1,2,3},{4,5,6},{7,8,9}};
findDiagonalOrder(mat);
}
}
| [
"ej7414@rit.edu"
] | ej7414@rit.edu |
b8c22081387c6df2926f9ae4ac92de51eef08bfc | e572b4d707075cad4fbdf5d294f01868bd8128bf | /src/main/java/ShadowGamerXY/TileEntitys/Machines/TileEntiyEnergyCubeMk3.java | f4deca0fecda87580fdef902389d7c7080b98889 | [] | no_license | ShadowGamerXY/ShadowCraftEvolved | c8cdd33ba23cb0964c23da9a585851c17892c1d7 | 7b09a3edab41eccff8c6e27cefc0640f0f74da1b | refs/heads/master | 2021-01-10T15:35:46.048969 | 2016-01-23T15:30:24 | 2016-01-23T15:30:24 | 50,241,563 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,114 | java | package ShadowGamerXY.TileEntitys.Machines;
import ShadowGamerXY.Utilitys.BlockType;
import ShadowGamerXY.Utilitys.Power.EnergyBar;
import ShadowGamerXY.Utilitys.Power.EnergyNet;
import ShadowGamerXY.Utilitys.Power.IEnergy;
import net.minecraft.client.gui.GuiScreenBook;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.util.Constants.NBT;
public class TileEntiyEnergyCubeMk3 extends TileEntity implements IEnergy
{
private EnergyBar energyBar = new EnergyBar(800000000);
public ForgeDirection outputSide2 = ForgeDirection.SOUTH;
public void updateEntity()
{
EnergyNet.distributeEnergyToSide(worldObj, xCoord, yCoord, zCoord, outputSide2, energyBar);
}
@Override
public boolean canAddEnergyOnSide(ForgeDirection direction)
{
return direction != outputSide2;
}
@Override
public boolean canConnect(ForgeDirection direction)
{
return true;
}
@Override
public EnergyBar getEnergyBar()
{
return energyBar;
}
@Override
public void setLastRecivedDirection(ForgeDirection directoion)
{
}
@Override
public int getEnergyTransferRate()
{
return 100;
}
@Override
public BlockType getTypeOfBlock()
{
return BlockType.MACHINE;
}
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
energyBar.writeToNBT(tag);
tag.setInteger("outputSide", outputSide2.ordinal());
}
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
energyBar.readFromNBT(tag);
outputSide2 = ForgeDirection.getOrientation(tag.getInteger("outputSide"));
}
public Packet getDiscriptionPacek()
{
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord,yCoord,zCoord, 1, tag);
}
public void onDataPacket(NetworkManager maneger, S35PacketUpdateTileEntity packet)
{
readFromNBT(packet.func_148857_g());
}
}
| [
"shadowgamerxy@gmail.com"
] | shadowgamerxy@gmail.com |
b15bb7d46c99627bc342605eea3a9b81eca0abd4 | 6369cc7ec9c1f3746421883ba38a7fea9c878b5a | /src/main/java/org/logicng/transformations/qe/ExistentialQuantifierElimination.java | 2a762d48af8e60274d75ba5ee39280814291441f | [
"Apache-2.0"
] | permissive | logic-ng/LogicNG16 | 18dae0ed960553b236c5b24eef07dc937fe75bbf | f9b3720dcb2d2e09a97566b1862fdcb5617f950f | refs/heads/master | 2023-08-19T22:02:50.432921 | 2017-02-27T18:03:45 | 2017-02-27T18:03:45 | 77,247,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,802 | java | ///////////////////////////////////////////////////////////////////////////
// __ _ _ ________ //
// / / ____ ____ _(_)____/ | / / ____/ //
// / / / __ \/ __ `/ / ___/ |/ / / __ //
// / /___/ /_/ / /_/ / / /__/ /| / /_/ / //
// /_____/\____/\__, /_/\___/_/ |_/\____/ //
// /____/ //
// //
// The Next Generation Logic Library //
// //
///////////////////////////////////////////////////////////////////////////
// //
// Copyright 2015-2016 Christoph Zengler //
// //
// 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.logicng.transformations.qe;
import org.logicng.datastructures.Assignment;
import org.logicng.formulas.Formula;
import org.logicng.formulas.FormulaFactory;
import org.logicng.formulas.FormulaTransformation;
import org.logicng.formulas.Variable;
import java.util.Arrays;
import java.util.Collection;
/**
* This transformation eliminates a number of existentially quantified variables by replacing them with the Shannon
* expansion. If {@code x} is eliminated from a formula {@code f}, the resulting formula is
* {@code f[true/x] | f[false/x]}.
* <p>
* This transformation cannot be cached since it is dependent on the set of literals to eliminate.
* @version 1.0
* @since 1.0
*/
public final class ExistentialQuantifierElimination implements FormulaTransformation {
private final Variable[] elimination;
/**
* Constructs a new existential quantifier elimination for the given variables.
* @param variables the variables
*/
public ExistentialQuantifierElimination(final Variable... variables) {
this.elimination = Arrays.copyOf(variables, variables.length);
}
/**
* Constructs a new existential quantifier elimination for a given collection of variables.
* @param variables the collection of variables
*/
public ExistentialQuantifierElimination(final Collection<Variable> variables) {
this.elimination = variables.toArray(new Variable[variables.size()]);
}
@Override
public Formula apply(final Formula formula, boolean cache) {
Formula result = formula;
final FormulaFactory f = formula.factory();
for (final Variable var : elimination)
result = f.or(result.restrict(new Assignment(var)), result.restrict(new Assignment(var.negate())));
return result;
}
}
| [
"christoph@zengler.eu"
] | christoph@zengler.eu |
6757d18239f3e1cdea08827a0f60e25cbe525fc4 | f2ece8f9a5a04ef83e718278dd91bf7b19e35a3e | /INE5404/RPG Grid/src/MasterGrid/MonsterSheetManager.java | 60769e6ac2e370be204d16dccce2939a48e2a016 | [
"MIT"
] | permissive | kundlatsch/UFSC | 230a327743b87788f5eb186c6a04947220ccec9a | 26238ab5eb06883443d979818fc2aa56498b13f9 | refs/heads/master | 2022-10-22T21:57:20.991100 | 2022-09-28T14:29:37 | 2022-09-28T14:29:37 | 197,419,530 | 15 | 4 | null | 2022-09-28T14:33:06 | 2019-07-17T15:48:37 | C++ | UTF-8 | Java | false | false | 1,719 | java | package MasterGrid;
import java.io.IOException;
import java.util.ArrayList;
public class MonsterSheetManager implements Sheet {
private ArrayList<String> titles = new ArrayList<String>();
private ArrayList<String> contents = new ArrayList<String>();
public MonsterSheetManager () {
super ();
}
@Override
public void processSheets(String content) {
String[] contentA = content.split(";");
for (int i = 0; i < contentA.length - 1; i += 2) {
this.addSheet(contentA[i], contentA[i + 1]);
}
}
@Override
public void addSheet (String title, String body) {
titles.add(title);
contents.add(body);
}
@Override
public void removeSheet (int index) {
titles.remove(index);
contents.remove(index);
}
@Override
public void editSheet (int index, String title, String body) {
titles.set(index, title);
contents.set(index, body);
}
@Override
public String getDefaultSheet () {
GenericFileReader characterModel = new GenericFileReader("monsterModel.txt");
String sReturn = "";
try {
sReturn = characterModel.readFile();
} catch (IOException e) {
// TODO Auto-generated catch block
return "erro de leitura";
}
return sReturn;
}
@Override
public String[] getTitles () {
String[] arrayReturn = new String[titles.size()];
arrayReturn = titles.toArray(arrayReturn);
return arrayReturn;
}
@Override
public String getTitle (int index) {
return titles.get(index);
}
@Override
public String getContent (int index) {
return contents.get(index);
}
@Override
public String toString() {
String sReturn = "";
for (int i = 0; i < titles.size(); i++) {
sReturn += titles.get(i) + ";" + contents.get(i) + ";";
}
return sReturn;
};
}
| [
"gustavo.kundlatsch@gmail.com"
] | gustavo.kundlatsch@gmail.com |
bd1e18c33e789115b4bdde1ebcd67b9a56154b33 | 524476d6ebd2a25b7191c23b1bac2d0c8a911504 | /RZChat/app/src/main/java/com/example/ismai/rzchat/MainActivity.java | 911cdc61acbc9bd83e11e25ee4f97df07929d34f | [] | no_license | ismailrz/Android-Training | 4eb4f04ed56d982a0e551b6f9bcfba694dfccd7c | 0fe91d100edeeaadbe38a45356c39b6d5f587d75 | refs/heads/master | 2020-05-19T05:44:14.497240 | 2019-05-04T05:20:23 | 2019-05-04T05:20:23 | 184,854,970 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,746 | java | package com.example.ismai.rzchat;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class MainActivity extends AppCompatActivity {
private FirebaseAuth mAuth;
private Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAuth = FirebaseAuth.getInstance();
mToolbar = findViewById(R.id.appBarId);
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle("RZ Chat");
}
@Override
public void onStart() {
super.onStart();
// Check if user is signed in (non-null) and update UI accordingly.
FirebaseUser currentUser = mAuth.getCurrentUser();
if(currentUser == null){
sentToStart();
}
}
private void sentToStart() {
Intent startIntent = new Intent(MainActivity.this, StartActivity.class);
startActivity(startIntent);
finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
if(item.getItemId() == R.id.main_page_logout_btn){
FirebaseAuth.getInstance().signOut();
sentToStart();
}
return true;
}
}
| [
"ismailcse14@gmail.com"
] | ismailcse14@gmail.com |
17df6f33dc42f7bc8696020daabe26a3be3636f0 | d3b134ef8564c33ab1cee9a6978bb1ffe3a37d49 | /src/main/java/br/com/tecnogroup/eicon/api/rest/service/pedidos/model/dtos/PedidoDTO.java | 02f17c10f0b6a4d220cebe1c9c684df0b810876b | [
"Apache-2.0"
] | permissive | NecoDan/tecnogroup-eicon-api-rest-service-pedidos | f932119d9349a338b2e9d1d9704031e3188d363e | 545a79069b1076455d2991b6993b1c1e5d74e66e | refs/heads/master | 2022-12-25T07:25:17.270452 | 2020-09-29T16:05:40 | 2020-09-29T16:05:40 | 299,506,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package br.com.tecnogroup.eicon.api.rest.service.pedidos.model.dtos;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.*;
import java.math.BigDecimal;
@Getter
@Setter
public class PedidoDTO {
@NotNull(message = "Nenhum número de controle atrelado ao pedido informado. Inválido e/ou inexistente {NULL}.")
@Positive(message = "O número de control atrelado ao pedido informado deve ser positivo, ou seja, maior que zero (0)")
private Long numeroControle;
@NotNull(message = "Nenhum codigo de cliente atrelado ao pedido informado. Inválido e/ou inexistente {NULL}.")
@Positive(message = "O código do cliente atrelado ao pedido informado deve ser positivo, ou seja, maior que zero (0)")
private Long codigoCliente;
@Size(max = 300, message = "Qtde de caracteres da descrição/nome ultrapassa o valor permitido igual à 300.")
@NotNull(message = "Insira uma descrição e/ou nome válida para o produto.")
@NotBlank(message = "Insira uma descrição e/ou nome válido para o produto.")
private String nomeProduto;
@NotNull(message = "Nenhum valor referente ao pedido informado. Inválido e/ou inexistente {NULL}.")
@Positive(message = "Valor referente ao pedido informado deve ser maior que zero (0).")
@Digits(integer = 19, fraction = 6)
private BigDecimal valor;
private BigDecimal quantidade;
}
| [
"neco.daniel@gmail.com"
] | neco.daniel@gmail.com |
3b15e6d311c3d9e9bad558dd3eee5c065db5db0a | 1bc27de9f15fdf25d60e6cf7c9601d8eed7d2277 | /src/design/behavioral_design_pattern/template_pattern/ConcreteClassA.java | e1165dce1097fe3fd2613213e870ca36d40ccaa2 | [] | no_license | renxiaohu/design_pattern | e4170da945c37f74dc6231ceacd90ba33538580f | 77f65ecdd2fb1b2c5619fd0bdb87604aa8312af9 | refs/heads/master | 2020-05-23T17:14:05.912899 | 2019-11-27T15:26:45 | 2019-11-27T15:26:45 | 84,774,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package design.behavioral_design_pattern.template_pattern;
/**
* Created by Administrator on 2016/12/13.
*/
public class ConcreteClassA extends AbstractClass {
public void PrimitiveOperation1(){
System.out.print("具体类A方法1实现=======\n");
}
public void PrimitiveOperation2(){
System.out.print("具体类A方法2实现=======\n");
}
}
| [
"renxiaohu@netfinworks.com"
] | renxiaohu@netfinworks.com |
23fe9b35e349da391a97027bad11153568744c07 | 46739ddb77feee2265af8436db6ac0eb2517e85a | /wallet-dap/wallet-dap-common/src/main/java/org/wallet/dap/common/bind/Results.java | 1df6361767ad14bf8ba04a5f28217df333453b33 | [] | no_license | guolinxin/wallet-parent | 9f21e6208153a35c85ed9feb1e2112c5ca53d8c5 | 47dcec9c477dfe0433464033d234acf62c2dad57 | refs/heads/master | 2022-04-06T23:50:50.385832 | 2020-02-04T07:07:40 | 2020-02-04T07:07:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,413 | java | package org.wallet.dap.common.bind;
import org.wallet.common.dto.SimpleResult;
import org.wallet.common.enums.ResultCode;
import org.wallet.dap.common.dubbo.ServiceResponse;
/**
* @author zengfucheng
**/
public class Results {
public static <T> SimpleResult<T> by(ServiceResponse response){
if(null == response){ return success(); }
if(response.success()){
return success(response.getResult());
}else{
return fail(response.getRespMsg());
}
}
public static <T> SimpleResult<T> success(){
return new SimpleResult<>();
}
public static <T> SimpleResult<T> success(T t){
return new SimpleResult<>(t);
}
public static <T> SimpleResult<T> of(String code, String message) {
return new SimpleResult<>(code, message);
}
public static <T> SimpleResult<T> fail(String msg){
return new SimpleResult<>(ResultCode.BusinessFail.getCode(), msg);
}
public static <T> SimpleResult<T> fatal(String msg){
return new SimpleResult<>(ResultCode.ServiceFatal.getCode(), msg);
}
public static <T> SimpleResult<T> paramInvalid(String msg) {
return new SimpleResult<>(ResultCode.ParamInvalid.getCode(), msg);
}
public static <T> SimpleResult<T> byCode(ResultCode resultCode){
return new SimpleResult<>(resultCode.getCode(), resultCode.getMessage());
}
}
| [
"snzke@live.cn"
] | snzke@live.cn |
52afc2c68731b276d5fae251b95d804b4627e18a | ad507066034a5d0cce9ac32edd0856c24403061f | /src/com/cafe24/bookmall/dao/BookDao.java | e5dd355d51b9c20d72b405b83aa4bb982f9e7719 | [] | no_license | JongMinP/bookmall | d43fbd33184c973810da645d28f45d3ea1a5f553 | 8f5a3e085fba7512c3b2f03de50ba9ea0daebbc5 | refs/heads/master | 2021-04-06T01:18:27.590516 | 2018-03-29T12:20:38 | 2018-03-29T12:20:38 | 124,537,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,168 | java | package com.cafe24.bookmall.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.cafe24.bookmall.util.AutoClose;
import com.cafe24.bookmall.util.ConnectionFactroy;
import com.cafe24.bookmall.vo.BookVo;
import com.cafe24.bookmall.vo.CategroyVo;
public class BookDao {
public List<BookVo> getBookList() {
List<BookVo> list = new ArrayList<>();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuilder sql = new StringBuilder();
try {
conn = ConnectionFactroy.getInstance().createConnection();
sql.append("select b.no,b.title,b.price,b.category_no,c.category ");
sql.append("from book b , category c ");
sql.append("where b.category_no = c.no ");
pstmt = conn.prepareStatement(sql.toString());
rs = pstmt.executeQuery();
while (rs.next()) {
BookVo vo = new BookVo();
vo.setNo(rs.getInt(1));
vo.setTittle(rs.getString(2));
vo.setPrice(Integer.parseInt(rs.getString(3)));
CategroyVo cvo = new CategroyVo(rs.getInt(4),rs.getString(5));
vo.setCvo(cvo);
// vo.setCategoryNo(Integer.parseInt(rs.getString(4)));
list.add(vo);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
AutoClose.closeResource(rs, pstmt, conn);
}
return list;
}
public boolean insert(BookVo vo) {
boolean result = false;
Connection conn = null;
PreparedStatement pstmt = null;
StringBuilder sql = new StringBuilder();
try {
conn = ConnectionFactroy.getInstance().createConnection();
sql.append("insert into book ");
sql.append("values(null,?,?,?) ");
pstmt = conn.prepareStatement(sql.toString());
pstmt.setString(1, vo.getTittle());
pstmt.setInt(2, vo.getPrice());
pstmt.setInt(3,vo.getCvo().getNo());
int count = pstmt.executeUpdate();
result = (count == 1);
} catch (SQLException e) {
e.printStackTrace();
}
return result;
}
public BookVo getBook(int no) {
BookVo vo = new BookVo();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuilder sql = new StringBuilder();
try {
conn = ConnectionFactroy.getInstance().createConnection();
sql.append("select b.no,b.title,b.price,b.category_no, c.category ");
sql.append("from book b , category c ");
sql.append("where b.no = ? ");
sql.append("and b.category_no = c.no ");
pstmt = conn.prepareStatement(sql.toString());
pstmt.setInt(1, no);
rs = pstmt.executeQuery();
while (rs.next()) {
vo.setNo(rs.getInt(1));
vo.setTittle(rs.getString(2));
vo.setPrice(Integer.parseInt(rs.getString(3)));
CategroyVo cvo = new CategroyVo(rs.getInt(4),rs.getString(5));
vo.setCvo(cvo);
// vo.setCategoryNo(Integer.parseInt(rs.getString(4)));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
AutoClose.closeResource(rs, pstmt, conn);
}
return vo;
}
}
| [
"bit@DESKTOP-A8LCUFN"
] | bit@DESKTOP-A8LCUFN |
d3c5843e085f6702822639b1a6af00f764bf73e6 | 5c452a039eddc80d7f267d5a40cccacce75f4837 | /app/src/androidTest/java/com/sagittarius/nfc/ExampleInstrumentedTest.java | 3d58f79e7a83e0efaf7e8d8d31cd4fb69c91572f | [] | no_license | cananugurluuu/NFCVerification_V1 | 3fec6e91513e17a4e7d96dcd13b174d1d2d06d06 | 631cc4bf95db2fa20518c1cfc2ad9180b87d4f42 | refs/heads/main | 2023-08-23T21:34:14.455314 | 2021-09-27T22:13:43 | 2021-09-27T22:13:43 | 411,056,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.sagittarius.nfc;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.sagittarius.nfc", appContext.getPackageName());
}
} | [
"cananugurluuu@gmail.com"
] | cananugurluuu@gmail.com |
53643f1f9d72a43907ffb37c9ebd87a410e4d379 | 42e6d3197c94ca9a18c93deba739dfd2876f8acd | /WebdriverProject/src/day18/Xpath.java | 6cc6cce2c5edd87f5fbff1d637b4ef0869d6fb74 | [] | no_license | SaiKrishna12/24hrFitnessSessions | 4475d80a692735994f09cdefb8db85b8e3a950f9 | 1e051273cd40c4d89a0af0b7ccfad79db366a728 | refs/heads/master | 2020-04-04T15:26:59.566107 | 2015-04-27T11:28:40 | 2015-04-27T11:28:40 | 33,820,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package day18;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class Xpath {
FirefoxDriver driver;
@BeforeMethod
public void setup()
{
ProfilesIni pr=new ProfilesIni();
FirefoxProfile fp=pr.getProfile("SeleniumUser");
driver=new FirefoxDriver(fp);
driver.get("http://yahoo.com");
}
@Test
public void xpathTest()
{
driver.findElement(By.xpath("//*[starts-with(@id,'yui_3_12_0_1_14254')]/div/ol/li[6]/a")).click();
}
}
| [
"saikrishna_gandham@yahoo.co.in"
] | saikrishna_gandham@yahoo.co.in |
b723578ccd627c5cb89619fed4e3696732258371 | 6ec3f7e05c8556cdc0c64226a8a8b04fdf0083ed | /AndroidMetamodel.diagram/src/android/diagram/edit/helpers/DialogEditHelper.java | 7897ae936533fdca33170663213dd0000f5d4bf1 | [] | no_license | vicdoz/metaAndroid | 9ce0cd218ed84d5bf7fc29e744225c36eee33594 | dfa82b86efb5e231bbb407444e6eea13c8842373 | refs/heads/master | 2020-12-24T13:16:42.323560 | 2014-06-15T21:29:30 | 2014-06-15T21:29:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package android.diagram.edit.helpers;
/**
* @generated
*/
public class DialogEditHelper extends AndroidBaseEditHelper {
}
| [
"v.ahuir@gmail.com"
] | v.ahuir@gmail.com |
7d31f8907c230f4d36baab68e7c635c45e866314 | 5d432567f5304bacf14f46a7f7e9eeb219c0162b | /src/main/java/com/listore/vo/CartProductVo.java | aa920ac92fb30f3c9d6a8ebc01eb3162e54f61bc | [] | no_license | lck898989/listore | c9970600d9d5e576ece58e67044910973445bd2f | e4ce683693584b78b605de04a19253fabcb5bdde | refs/heads/master | 2020-12-30T12:23:31.705691 | 2018-01-18T14:13:13 | 2018-01-18T14:13:13 | 91,431,661 | 0 | 0 | null | 2018-01-18T14:13:14 | 2017-05-16T07:59:18 | Java | UTF-8 | Java | false | false | 3,041 | java | package com.listore.vo;
import java.math.BigDecimal;
/**
* Created by HP on 2017/8/26.
*/
/*
*
* 返回给前端的购物车对象,即买家买到的商品的展示结合了商品对象
*
* */
public class CartProductVo {
private Integer id;
private Integer userId;
private Integer productId;
private Integer quantity; //购物车中此商品的数量
private String productSubtitle;
private String prouductName;
private Integer productChecked;
private String productMainImage;
private BigDecimal productPrice;
private Integer productStatus;
private BigDecimal productTotalPrice;
private Integer productStock;
private String limitQuantity; //限制数量的一个返回结果
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public String getProductSubtitle() {
return productSubtitle;
}
public void setProductSubtitle(String productSubtitle) {
this.productSubtitle = productSubtitle;
}
public String getProuductName() {
return prouductName;
}
public void setProuductName(String prouductName) {
this.prouductName = prouductName;
}
public String getProductMainImage() {
return productMainImage;
}
public void setProductMainImage(String productMainImage) {
this.productMainImage = productMainImage;
}
public BigDecimal getProductPrice() {
return productPrice;
}
public void setProductPrice(BigDecimal productPrice) {
this.productPrice = productPrice;
}
public Integer getProductStatus() {
return productStatus;
}
public void setProductStatus(Integer productStatus) {
this.productStatus = productStatus;
}
public BigDecimal getProductTotalPrice() {
return productTotalPrice;
}
public void setProductTotalPrice(BigDecimal productTotalPrice) {
this.productTotalPrice = productTotalPrice;
}
public Integer getProductStock() {
return productStock;
}
public void setProductStock(Integer productStock) {
this.productStock = productStock;
}
public String getLimitQuantity() {
return limitQuantity;
}
public void setLimitQuantity(String limitQuantity) {
this.limitQuantity = limitQuantity;
}
public Integer getProductChecked() {
return productChecked;
}
public void setProductChecked(Integer productChecked) {
this.productChecked = productChecked;
}
}
| [
"1783887127@qq.com"
] | 1783887127@qq.com |
ca61945ad38f076fff7a07fae44844f8fc9bdb66 | 518a89fedbbf6e3c20c4a808924ca6cd0b1a5cbe | /src/test/java/com/kodilla/SocialMediaApp/openweather/OpenWeatherServiceTestSuite.java | c487ed3860144f1b32a465af38d110f44ed187fb | [] | no_license | ete02/SocialMedia-Backend- | ff3d91070bf41a34cee09cd95ddd8d68e2528401 | cc5de04b51a7bf94f331bea08dd26fb77d9af86f | refs/heads/master | 2023-06-29T16:20:14.225375 | 2021-08-02T00:23:05 | 2021-08-02T00:23:05 | 383,548,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,871 | java | package com.kodilla.SocialMediaApp.openweather;
import com.kodilla.SocialMediaApp.openweather.client.OpenWeatherClient;
import com.kodilla.SocialMediaApp.openweather.dto.OpenWeatherMainDto;
import com.kodilla.SocialMediaApp.openweather.dto.OpenWeatherResponse;
import com.kodilla.SocialMediaApp.openweather.dto.OpenWeatherWeatherDto;
import com.kodilla.SocialMediaApp.openweather.exceptions.OpenWeatherApiException;
import com.kodilla.SocialMediaApp.openweather.service.OpenWeatherService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import static com.kodilla.SocialMediaApp.util.DomainDataFixture.*;
import static com.kodilla.SocialMediaApp.util.DtoDataFixture.createOpenWeatherMainDto;
import static com.kodilla.SocialMediaApp.util.DtoDataFixture.createOpenWeatherWeatherDto;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.BDDMockito.given;
@ExtendWith(MockitoExtension.class)
public class OpenWeatherServiceTestSuite {
@InjectMocks
private OpenWeatherService openWeatherService;
@Mock
private OpenWeatherClient openWeatherClient;
@Test
public void shouldGetWeatherForCityResponseFromClient() {
//GIVEN
String city = "Poznan";
OpenWeatherWeatherDto openWeatherWeatherDto = createOpenWeatherWeatherDto();
OpenWeatherMainDto openWeatherMainDto = createOpenWeatherMainDto();
OpenWeatherResponse openWeatherResponse = createOpenWeatherResponse(openWeatherMainDto, openWeatherWeatherDto);
CompletableFuture<OpenWeatherResponse> completableFuture = CompletableFuture.completedFuture(openWeatherResponse);
given(openWeatherClient.getWeatherForCityFromUrl(city)).willReturn(completableFuture);
//WHEN
OpenWeatherResponse weatherForCityResponseFromClient = openWeatherService.getWeatherForCityResponseFromClient("Poznan");
//THEN
assertEquals(openWeatherResponse, weatherForCityResponseFromClient);
}
@Test
public void shouldNotGetWeatherForCityResponseFromClientAndThrowOpenWeatherApiException() throws ExecutionException, InterruptedException {
//GIVEN
String city = "Poznan";
given(openWeatherClient.getWeatherForCityFromUrl(city)).willThrow(OpenWeatherApiException.class);
//WHEN && THEN
assertThatThrownBy(() -> openWeatherService.getWeatherForCityResponseFromClient(city))
.isInstanceOf(OpenWeatherApiException.class)
.hasMessage("OpenWeatherApi error for receiving createWeatherEmail data from city: Poznan");
}
}
| [
"eugen.te11@gmail.com"
] | eugen.te11@gmail.com |
326bcc844e2b352fcfa0ee31a0461cd6a8c69a7e | 1568c40f143fc3a9cf3ef1a2d54cb9919397628a | /src/main/java/pages/olxAuto/VehicleInfoPage.java | 2527440279790f393514bab6c450fdb6e6fe0809 | [] | no_license | alexnaum/LearnJava | 3f419946538c2092abbf3d5f7eb2cb5a3bcc43ee | 17a1a63e1cbb5080236b9d087c85e2f08bce46db | refs/heads/main | 2023-08-30T11:00:51.386905 | 2021-11-17T21:06:06 | 2021-11-17T21:12:49 | 397,722,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package pages.olxAuto;
import lombok.Getter;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import pages.BasePage;
@Getter
public class VehicleInfoPage extends BasePage {
public VehicleInfoPage(WebDriver driver) {
super(driver);
}
@FindBy(xpath = "//*[contains(text(),'Пробег')]")
private WebElement mileAge;
public VehicleInfoPage getMileAge(){
return this;
}
}
| [
"test@gmail.com"
] | test@gmail.com |
fae65cfb322c8aa548645a4822a43ff33763fa64 | 8577a16cd5e5e569d7787c7820497e5d5b4b7ee7 | /Chap9/9.8/solution/Quadrilateral.java | 5c8841f51ff4663ad3b4b93ffb8f6b39fe284b21 | [] | no_license | guiprix/javahtp | aa91271aa99dda34b651877714ca66cef6fb7f41 | edd2ff337fef5f2c5c60190aea01d7e33106ef86 | refs/heads/master | 2021-01-10T10:58:38.579568 | 2015-12-08T15:32:27 | 2015-12-08T15:32:27 | 46,408,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,493 | java | // Exercise 9.8 Solution: Quadrilateral.java
// Class Quadrilateral definition
public class Quadrilateral
{
private Point point1; // first endpoint
private Point point2; // second endpoint
private Point point3; // third endpoint
private Point point4; // fourth endpoint
// eight-argument constructor
public Quadrilateral(double x1, double y1, double x2, double y2,
double x3, double y3, double x4, double y4)
{
point1 = new Point(x1, y1);
point2 = new Point(x2, y2);
point3 = new Point(x3, y3);
point4 = new Point(x4, y4);
}
// return point1
public Point getPoint1()
{
return point1;
}
// return point2
public Point getPoint2()
{
return point2;
}
// return point3
public Point getPoint3()
{
return point3;
}
// return point4
public Point getPoint4()
{
return point4;
}
// return string representation of a Quadrilateral object
@Override
public String toString()
{
return String.format("%s:\n%s",
"Coordinates of Quadrilateral are", getCoordinatesAsString());
}
// return string containing coordinates as strings
public String getCoordinatesAsString()
{
return String.format(
"%s, %s, %s, %s\n", point1, point2, point3, point4);
}
} // end class Quadrilateral
/**************************************************************************
* (C) Copyright 1992-2015 by Deitel & Associates, Inc. and Prentice *
* Hall. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/ | [
"guido.vndr@gmail.com"
] | guido.vndr@gmail.com |
e2bc63347bd723a12bcba2b03da540175cd41c2f | 714590d8e3512194888612b55cc6e300421763d7 | /we-web-parent/web-linyun-airline/src/main/java/com/linyun/airline/common/actionfilter/Md5AccessFilter.java | 6d4e0a5f0b6e03ed7c6197ab6d467f9fcc3296f1 | [] | no_license | HKjournalists/zhiliren-we | 140624a6ded06b156245ef194eba4b1cc12583fb | ab969fafc617891f46d0a36130157248f932d4af | refs/heads/master | 2021-01-20T15:23:28.633464 | 2016-11-16T09:34:37 | 2016-11-16T09:34:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,432 | java | package com.linyun.airline.common.actionfilter;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.nutz.json.JsonFormat;
import org.nutz.mvc.ActionContext;
import org.nutz.mvc.ActionFilter;
import org.nutz.mvc.Mvcs;
import org.nutz.mvc.View;
import org.nutz.mvc.view.ViewWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.linyun.airline.common.access.AccessConfig;
import com.linyun.airline.common.access.AccessCore;
import com.linyun.airline.common.annotation.NoFilter;
import com.uxuexi.core.common.util.Util;
import com.uxuexi.core.web.chain.support.JsonResult;
import com.uxuexi.core.web.view.Utf8JsonTransferView;
/**
* 访问接口过滤器,实现对合作方接口的MD5访问验证
* @author 朱晓川
*
*/
public class Md5AccessFilter implements ActionFilter {
protected Logger logger = LoggerFactory.getLogger(Md5AccessFilter.class) ;
@Override
public View match(ActionContext ac) {
if (ac.getModule().getClass().isAnnotationPresent(NoFilter.class)) {
return null;
}
HttpServletRequest request = Mvcs.getReq();
/**
* 请求参数:
* 有时像checkbox这样的组件会有一个name对应对个value的时候,所以该Map中键值对是<String,String[]>的实现
*/
@SuppressWarnings("unchecked")
Map<String,String[]> sParaTemp = request.getParameterMap() ;
Map<String,String> spara = new HashMap<String, String>() ;
Set<String> keys = sParaTemp.keySet() ;
if(!Util.isEmpty(keys)){
for(String key : keys){
String[] value = sParaTemp.get(key) ;
//因为不存在checkbox之类的参数传递,因此取第一个值即可
String newVal = null ;
if(null != value && value.length > 0){
newVal = value[0] ;
}
spara.put(key, newVal) ;
}
}
String sign = (String) spara.get("sign") ;
logger.info("请求端签名值:" + sign) ;
if(!Util.isEmpty(sign)){
boolean verify = AccessCore.verify(spara, AccessConfig.terminal_secret) ;
if(verify){
return null ;
}else{
return new ViewWrapper(new Utf8JsonTransferView(new JsonFormat()), JsonResult.error("签名验证失败")) ;
}
}else{
return new ViewWrapper(new Utf8JsonTransferView(new JsonFormat()), JsonResult.error("签名值不能为空")) ;
}
}
}
| [
"3065805295@qq.com"
] | 3065805295@qq.com |
838638cd7bd1064eef06243201728ef7665c4327 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/test/tk/mybatis/mapper/test/rowbounds/TestSelectRowBounds.java | d1bf17923d674e2df093f4262036e0c689e51602 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 2,253 | java | /**
* The MIT License (MIT)
*
* Copyright (c) 2014-2017 abel533@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package tk.mybatis.mapper.test.rowbounds;
import java.util.List;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSession;
import org.junit.Assert;
import org.junit.Test;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.mapper.CountryMapper;
import tk.mybatis.mapper.mapper.MybatisHelper;
import tk.mybatis.mapper.model.Country;
/**
*
*
* @author liuzh
*/
public class TestSelectRowBounds {
@Test
public void testSelectByExample() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Example example = new Example(Country.class);
example.createCriteria().andGreaterThan("id", 100).andLessThan("id", 151);
example.or().andLessThan("id", 41);
List<Country> countries = mapper.selectByExampleAndRowBounds(example, new RowBounds(10, 20));
// ????
Assert.assertEquals(20, countries.size());
} finally {
sqlSession.close();
}
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
e5483d47d651533646256239ea1981c18f2ad83f | 33456d6a297295d35301a00fa2ed03398cc82bc7 | /libglide/src/main/java/com/zhxh/libglide/glide/binding/inter/LifeCycle.java | ed35b063e55d49e4ca98cb06ebcbfa2a30d85499 | [] | no_license | zhxhcoder/XSourcStudy | 78b01956721545f5f66b18195084d3500c07fe94 | c07e7f75a4ecf5b788344f6d177bc3d21b3cf80e | refs/heads/master | 2022-12-13T11:20:43.479176 | 2022-12-11T03:54:27 | 2022-12-11T03:54:27 | 174,454,806 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package com.zhxh.libglide.glide.binding.inter;
import androidx.annotation.NonNull;
/**
*/
public interface LifeCycle {
void addListener(@NonNull LifecycleListener listener);
void removeListener(@NonNull LifecycleListener listener);
}
| [
"zhxhcoder@gmail.com"
] | zhxhcoder@gmail.com |
306f1267a14898f3838c38b131c6e16a9b37aff2 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_management_remote_JMXConnectionNotification_setTimeStamp_long.java | f8c21b7289cda8fb102cb627541de9670c9b67cc | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | class javax_management_remote_JMXConnectionNotification_setTimeStamp_long{ public static void function() {javax.management.remote.JMXConnectionNotification obj = new javax.management.remote.JMXConnectionNotification();obj.setTimeStamp(3563713459980104933);}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
0d9c64832011907e62f0a1115bf81c4e7170d41c | 6f84c6be627d715bb05761992d971388c0763494 | /core/src/main/java/etap/core/listeners/SimpleResourceListener.java | 5b3e865acbcdb1b663c8a51688a175fa400d2253 | [] | no_license | Chandreyee10/sonarQube | 198136ea44ab13d33b6ced9f757ff66c65b5babb | 6c8a40bcc04f9732328258425bd7c57583780569 | refs/heads/master | 2022-07-29T11:37:17.473124 | 2019-06-25T14:50:28 | 2019-06-25T14:50:28 | 193,723,136 | 0 | 0 | null | 2022-07-06T20:18:46 | 2019-06-25T14:24:27 | JavaScript | UTF-8 | Java | false | false | 1,928 | java | /*
* Copyright 2015 Adobe Systems Incorporated
*
* 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 etap.core.listeners;
import org.apache.sling.api.SlingConstants;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A service to demonstrate how changes in the resource tree
* can be listened for. It registers an event handler service.
* The component is activated immediately after the bundle is
* started through the immediate flag.
* Please note, that apart from EventHandler services,
* the immediate flag should not be set on a service.
*/
@Component(service = EventHandler.class,
immediate = true,
property = {
Constants.SERVICE_DESCRIPTION + "=Demo to listen on changes in the resource tree",
EventConstants.EVENT_TOPIC + "=org/apache/sling/api/resource/Resource/*"
})
public class SimpleResourceListener implements EventHandler {
private final Logger logger = LoggerFactory.getLogger(getClass());
public void handleEvent(final Event event) {
logger.debug("Resource event: {} at: {}", event.getTopic(), event.getProperty(SlingConstants.PROPERTY_PATH));
}
}
| [
"chandreyee.datta5600@gmail.com"
] | chandreyee.datta5600@gmail.com |
dfe4d4e0079196951e880cac9c955c722dab48f2 | aaa9751e4ed70a7b3b41fa2025900dd01205518a | /org.eclipse.rcpl.libs/src2/com/microsoft/schemas/office/x2006/digsig/impl/STSignatureTextImpl.java | 28718dc815d1d0bbed28b256e1679799e4524585 | [] | no_license | rassisi/rcpl | 596f0c0aeb4b4ae838f001ad801f9a9c42e31759 | 93b4620bb94a45d0f42666b0bf6ffecae2c0d063 | refs/heads/master | 2022-09-20T19:57:54.802738 | 2020-05-10T20:54:01 | 2020-05-10T20:54:01 | 141,136,917 | 0 | 0 | null | 2022-09-01T23:00:59 | 2018-07-16T12:40:18 | Java | UTF-8 | Java | false | false | 905 | java | /*
* XML Type: ST_SignatureText
* Namespace: http://schemas.microsoft.com/office/2006/digsig
* Java type: com.microsoft.schemas.office.x2006.digsig.STSignatureText
*
* Automatically generated - do not modify.
*/
package com.microsoft.schemas.office.x2006.digsig.impl;
/**
* An XML ST_SignatureText(@http://schemas.microsoft.com/office/2006/digsig).
*
* This is an atomic type that is a restriction of com.microsoft.schemas.office.x2006.digsig.STSignatureText.
*/
public class STSignatureTextImpl extends org.apache.xmlbeans.impl.values.JavaStringHolderEx implements com.microsoft.schemas.office.x2006.digsig.STSignatureText
{
public STSignatureTextImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType, false);
}
protected STSignatureTextImpl(org.apache.xmlbeans.SchemaType sType, boolean b)
{
super(sType, b);
}
}
| [
"Ramin@DESKTOP-69V2J7P.fritz.box"
] | Ramin@DESKTOP-69V2J7P.fritz.box |
49879646ba25da5700175cca9b7fa85f7cc36435 | 75c16740535e52572c35e886e1eb81b9e25a0c11 | /src/main/java/me/frankthedev/manhuntcore/command/ForceEndCommand.java | 55840a787416ae8e3edcc67aa4d25c75a48e789d | [] | no_license | Frank-ZW/ManhuntCore | c54c122431d2cd6acce6adfa87634d5aca6d1309 | 4fc29f3fa8f618bff6243b986d21ac7a1a25b743 | refs/heads/master | 2023-02-26T01:14:30.904517 | 2021-01-24T19:32:28 | 2021-01-24T19:32:28 | 322,778,865 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package me.frankthedev.manhuntcore.command;
import me.frankthedev.manhuntcore.manhunt.Manhunt;
import me.frankthedev.manhuntcore.manhunt.manager.ManhuntManager;
import me.frankthedev.manhuntcore.util.bukkit.ManhuntPermissions;
import me.frankthedev.manhuntcore.util.java.StringUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class ForceEndCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!sender.hasPermission(ManhuntPermissions.FORCE_END)) {
sender.sendMessage(StringUtil.NO_PERMISSION);
return true;
}
if (args.length == 1) {
try {
int gameKey = Integer.parseInt(args[0]);
Manhunt manhunt = ManhuntManager.getInstance().getManhunt(gameKey);
if (manhunt == null) {
sender.sendMessage(ChatColor.RED + "There aren't any ongoing Manhunt games with the game key " + gameKey);
return true;
}
ManhuntManager.getInstance().endManhuntNow(manhunt);
sender.sendMessage(ChatColor.GREEN + "The manhunt game with the game key " + gameKey + " has forcefully been ended.");
} catch (NumberFormatException e) {
sender.sendMessage(ChatColor.RED + "The game key entered must be an integer.");
}
} else {
sender.sendMessage(ChatColor.RED + "To force end an ongoing manhunt game, type /forceend <game key>");
}
return true;
}
}
| [
"fwei1729@gmail.com"
] | fwei1729@gmail.com |
be95df7f56f69b17196e510369a051c7c6bd50c3 | 43dee3e77379471a10de6b78375f903156bcebe4 | /src/main/java/ru/timmson/workshop/bddandtdd/client/Client.java | 065771a4c7aee73a39ecd84deb82157ea665c551 | [
"MIT"
] | permissive | timmson/bdd-and-tdd | 36b4403f3f76700286f70e8780d8a30d2a377472 | 49eb1a83a0d736c38f6b151abf32403987f277d6 | refs/heads/master | 2023-05-26T05:22:15.125228 | 2023-05-11T12:59:23 | 2023-05-11T12:59:23 | 254,746,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package ru.timmson.workshop.bddandtdd.client;
public class Client {
protected Client() {
}
public static Client forType(String clientType) {
return clientType.equals("VIP") ?
new VipClient(2500, 0.95) :
new CommonClient(1000);
}
public int calc(int cartAmount, int deliveryAmount) {
return cartAmount + deliveryAmount;
}
}
| [
"timmson666@mail.ru"
] | timmson666@mail.ru |
8102fa4f137260f8fbb75cfe002016650359f0b9 | a1c11e8817a1de8a4494909c8c3c8e420d5b124e | /sample.user/src/main/java/com/sample/user/service/handler/EditUserHandler.java | 9d1d6fcaa60c3dadc0123fc33e3a6842898d8a6d | [] | no_license | mysticalmountain/sample | 51011376efc02b4b5204a43f544ac6416b6cd0d6 | c80c7ecc05413721858cc3bd6b55f3b55b9b0969 | refs/heads/master | 2020-04-15T06:55:31.635205 | 2017-10-28T15:38:28 | 2017-10-28T15:38:28 | 68,129,193 | 0 | 0 | null | 2016-11-18T03:12:48 | 2016-09-13T17:03:14 | Java | UTF-8 | Java | false | false | 3,603 | java | package com.sample.user.service.handler;
import com.sample.core.Constant;
import com.sample.core.exception.UnifiedException;
import com.sample.core.model.dto.GenericReq;
import com.sample.core.model.dto.Rsp;
import com.sample.core.service.Service;
import com.sample.core.service.handler.AbstractServiceHandler;
import com.sample.permission.dto.RoleDto;
import com.sample.permission.model.Role;
import com.sample.permission.repository.RoleRepository;
import com.sample.user.dto.UserDto;
import com.sample.user.model.Authority;
import com.sample.user.model.Profile;
import com.sample.user.model.User;
import com.sample.user.model.enums.AuthType;
import com.sample.user.repository.AuthorityRepository;
import com.sample.user.repository.ProfileRepository;
import com.sample.user.repository.UserRepository;
import com.sample.user.service.EditUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/**
* Created by andongxu on 16-11-18.
*/
@Component
public class EditUserHandler extends AbstractServiceHandler<GenericReq<UserDto>, Rsp> {
@Autowired
private UserRepository userRepository;
@Autowired
private ProfileRepository profileRepository;
@Autowired
private RoleRepository roleRepository;
@Autowired
private AuthorityRepository authorityRepository;
@Override
public boolean support(Object... objs) {
Service service = (Service) objs[1];
if (service.code().equals(EditUserService.class.getAnnotation(Service.class).code())) {
return true;
}
return false;
}
@Override
public Rsp doHandle(GenericReq<UserDto> userDtoGenericReq, Service service) throws UnifiedException {
UserDto userDto = userDtoGenericReq.getData();
User user = null;
if (userDto != null && userDto.getId() != null) {
user = userRepository.findOne(userDto.getId());
}
if (user == null) {
user = new User();
BeanUtils.copyProperties(userDto, user);
user = userRepository.save(user);
} else {
BeanUtils.copyProperties(userDto, user);
user = userRepository.save(user);
}
if (userDto.getProfileDto() != null) {
Profile profile = new Profile();
BeanUtils.copyProperties(userDto.getProfileDto(), profile);
profile.setUser(user);
profileRepository.save(profile);
}
if (userDto.getAuthorityDto() != null) {
Authority authority = new Authority();
BeanUtils.copyProperties(userDto.getAuthorityDto(), authority);
authority.setAuthType(AuthType.USERNAME);
authority.setUser(user);
authorityRepository.save(authority);
}
if (userDto.getRoleDtos() != null) {
Iterator<RoleDto> roleDtoIterator = userDto.getRoleDtos().iterator();
Set<Role> roleSet = new HashSet<Role>();
while (roleDtoIterator.hasNext()) {
RoleDto roleDto = roleDtoIterator.next();
Role role = roleRepository.findOne(roleDto.getId());
roleSet.add(role);
}
user.setRoles(roleSet);
userRepository.save(user);
}
Rsp rsp = new Rsp();
rsp.setErrorMsg(Constant.SUCCESS[1]);
rsp.setErrorCode(Constant.SUCCESS[0]);
rsp.setSuccess(true);
return rsp;
}
}
| [
"dongxudotan@163.com"
] | dongxudotan@163.com |
45040b8e9df466383c0023cb109a7551501d08fa | e3f50a97b37dc5c1415b2d0348564ceb78832698 | /1909 NSA Codebreaker Challenge/terrortime_jadx/java/android/support/design/widget/BottomNavigationView.java | db04811e4fbe0dea728c6f2a6f8754a595ebd864 | [] | no_license | sears-s/ctf | b8d13f121deb43189487b168a68f18dfc5538212 | c0e5960b1b975ba7073dae28b0c0f28a6eab563e | refs/heads/master | 2021-07-26T21:12:01.384166 | 2021-06-29T04:42:52 | 2021-06-29T04:42:52 | 145,129,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,226 | java | package android.support.design.widget;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.ClassLoaderCreator;
import android.os.Parcelable.Creator;
import android.support.design.R;
import android.support.design.internal.BottomNavigationMenu;
import android.support.design.internal.BottomNavigationMenuView;
import android.support.design.internal.BottomNavigationPresenter;
import android.support.design.internal.ThemeEnforcement;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.AbsSavedState;
import android.support.v4.view.ViewCompat;
import android.support.v7.view.SupportMenuInflater;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuBuilder.Callback;
import android.support.v7.widget.TintTypedArray;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
public class BottomNavigationView extends FrameLayout {
private static final int MENU_PRESENTER_ID = 1;
private final MenuBuilder menu;
private MenuInflater menuInflater;
private final BottomNavigationMenuView menuView;
private final BottomNavigationPresenter presenter;
/* access modifiers changed from: private */
public OnNavigationItemReselectedListener reselectedListener;
/* access modifiers changed from: private */
public OnNavigationItemSelectedListener selectedListener;
public interface OnNavigationItemReselectedListener {
void onNavigationItemReselected(MenuItem menuItem);
}
public interface OnNavigationItemSelectedListener {
boolean onNavigationItemSelected(MenuItem menuItem);
}
static class SavedState extends AbsSavedState {
public static final Creator<SavedState> CREATOR = new ClassLoaderCreator<SavedState>() {
public SavedState createFromParcel(Parcel in, ClassLoader loader) {
return new SavedState(in, loader);
}
public SavedState createFromParcel(Parcel in) {
return new SavedState(in, null);
}
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
Bundle menuPresenterState;
public SavedState(Parcelable superState) {
super(superState);
}
public SavedState(Parcel source, ClassLoader loader) {
super(source, loader);
readFromParcel(source, loader);
}
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeBundle(this.menuPresenterState);
}
private void readFromParcel(Parcel in, ClassLoader loader) {
this.menuPresenterState = in.readBundle(loader);
}
}
public BottomNavigationView(Context context) {
this(context, null);
}
public BottomNavigationView(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.bottomNavigationStyle);
}
public BottomNavigationView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.presenter = new BottomNavigationPresenter();
this.menu = new BottomNavigationMenu(context);
this.menuView = new BottomNavigationMenuView(context);
LayoutParams params = new LayoutParams(-2, -2);
params.gravity = 17;
this.menuView.setLayoutParams(params);
this.presenter.setBottomNavigationMenuView(this.menuView);
this.presenter.setId(1);
this.menuView.setPresenter(this.presenter);
this.menu.addMenuPresenter(this.presenter);
this.presenter.initForMenu(getContext(), this.menu);
TintTypedArray a = ThemeEnforcement.obtainTintedStyledAttributes(context, attrs, R.styleable.BottomNavigationView, defStyleAttr, R.style.Widget_Design_BottomNavigationView, R.styleable.BottomNavigationView_itemTextAppearanceInactive, R.styleable.BottomNavigationView_itemTextAppearanceActive);
if (a.hasValue(R.styleable.BottomNavigationView_itemIconTint)) {
this.menuView.setIconTintList(a.getColorStateList(R.styleable.BottomNavigationView_itemIconTint));
} else {
BottomNavigationMenuView bottomNavigationMenuView = this.menuView;
bottomNavigationMenuView.setIconTintList(bottomNavigationMenuView.createDefaultColorStateList(16842808));
}
setItemIconSize(a.getDimensionPixelSize(R.styleable.BottomNavigationView_itemIconSize, getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_icon_size)));
if (a.hasValue(R.styleable.BottomNavigationView_itemTextAppearanceInactive)) {
setItemTextAppearanceInactive(a.getResourceId(R.styleable.BottomNavigationView_itemTextAppearanceInactive, 0));
}
if (a.hasValue(R.styleable.BottomNavigationView_itemTextAppearanceActive)) {
setItemTextAppearanceActive(a.getResourceId(R.styleable.BottomNavigationView_itemTextAppearanceActive, 0));
}
if (a.hasValue(R.styleable.BottomNavigationView_itemTextColor)) {
setItemTextColor(a.getColorStateList(R.styleable.BottomNavigationView_itemTextColor));
}
if (a.hasValue(R.styleable.BottomNavigationView_elevation)) {
ViewCompat.setElevation(this, (float) a.getDimensionPixelSize(R.styleable.BottomNavigationView_elevation, 0));
}
setLabelVisibilityMode(a.getInteger(R.styleable.BottomNavigationView_labelVisibilityMode, -1));
setItemHorizontalTranslationEnabled(a.getBoolean(R.styleable.BottomNavigationView_itemHorizontalTranslationEnabled, true));
this.menuView.setItemBackgroundRes(a.getResourceId(R.styleable.BottomNavigationView_itemBackground, 0));
if (a.hasValue(R.styleable.BottomNavigationView_menu)) {
inflateMenu(a.getResourceId(R.styleable.BottomNavigationView_menu, 0));
}
a.recycle();
addView(this.menuView, params);
if (VERSION.SDK_INT < 21) {
addCompatibilityTopDivider(context);
}
this.menu.setCallback(new Callback() {
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
boolean z = true;
if (BottomNavigationView.this.reselectedListener == null || item.getItemId() != BottomNavigationView.this.getSelectedItemId()) {
if (BottomNavigationView.this.selectedListener == null || BottomNavigationView.this.selectedListener.onNavigationItemSelected(item)) {
z = false;
}
return z;
}
BottomNavigationView.this.reselectedListener.onNavigationItemReselected(item);
return true;
}
public void onMenuModeChange(MenuBuilder menu) {
}
});
}
public void setOnNavigationItemSelectedListener(OnNavigationItemSelectedListener listener) {
this.selectedListener = listener;
}
public void setOnNavigationItemReselectedListener(OnNavigationItemReselectedListener listener) {
this.reselectedListener = listener;
}
public Menu getMenu() {
return this.menu;
}
public void inflateMenu(int resId) {
this.presenter.setUpdateSuspended(true);
getMenuInflater().inflate(resId, this.menu);
this.presenter.setUpdateSuspended(false);
this.presenter.updateMenuView(true);
}
public int getMaxItemCount() {
return 5;
}
public ColorStateList getItemIconTintList() {
return this.menuView.getIconTintList();
}
public void setItemIconTintList(ColorStateList tint) {
this.menuView.setIconTintList(tint);
}
public void setItemIconSize(int iconSize) {
this.menuView.setItemIconSize(iconSize);
}
public void setItemIconSizeRes(int iconSizeRes) {
setItemIconSize(getResources().getDimensionPixelSize(iconSizeRes));
}
public int getItemIconSize() {
return this.menuView.getItemIconSize();
}
public ColorStateList getItemTextColor() {
return this.menuView.getItemTextColor();
}
public void setItemTextColor(ColorStateList textColor) {
this.menuView.setItemTextColor(textColor);
}
@Deprecated
public int getItemBackgroundResource() {
return this.menuView.getItemBackgroundRes();
}
public void setItemBackgroundResource(int resId) {
this.menuView.setItemBackgroundRes(resId);
}
public Drawable getItemBackground() {
return this.menuView.getItemBackground();
}
public void setItemBackground(Drawable background) {
this.menuView.setItemBackground(background);
}
public int getSelectedItemId() {
return this.menuView.getSelectedItemId();
}
public void setSelectedItemId(int itemId) {
MenuItem item = this.menu.findItem(itemId);
if (item != null && !this.menu.performItemAction(item, this.presenter, 0)) {
item.setChecked(true);
}
}
public void setLabelVisibilityMode(int labelVisibilityMode) {
if (this.menuView.getLabelVisibilityMode() != labelVisibilityMode) {
this.menuView.setLabelVisibilityMode(labelVisibilityMode);
this.presenter.updateMenuView(false);
}
}
public int getLabelVisibilityMode() {
return this.menuView.getLabelVisibilityMode();
}
public void setItemTextAppearanceInactive(int textAppearanceRes) {
this.menuView.setItemTextAppearanceInactive(textAppearanceRes);
}
public int getItemTextAppearanceInactive() {
return this.menuView.getItemTextAppearanceInactive();
}
public void setItemTextAppearanceActive(int textAppearanceRes) {
this.menuView.setItemTextAppearanceActive(textAppearanceRes);
}
public int getItemTextAppearanceActive() {
return this.menuView.getItemTextAppearanceActive();
}
public void setItemHorizontalTranslationEnabled(boolean itemHorizontalTranslationEnabled) {
if (this.menuView.isItemHorizontalTranslationEnabled() != itemHorizontalTranslationEnabled) {
this.menuView.setItemHorizontalTranslationEnabled(itemHorizontalTranslationEnabled);
this.presenter.updateMenuView(false);
}
}
public boolean isItemHorizontalTranslationEnabled() {
return this.menuView.isItemHorizontalTranslationEnabled();
}
private void addCompatibilityTopDivider(Context context) {
View divider = new View(context);
divider.setBackgroundColor(ContextCompat.getColor(context, R.color.design_bottom_navigation_shadow_color));
divider.setLayoutParams(new LayoutParams(-1, getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_shadow_height)));
addView(divider);
}
private MenuInflater getMenuInflater() {
if (this.menuInflater == null) {
this.menuInflater = new SupportMenuInflater(getContext());
}
return this.menuInflater;
}
/* access modifiers changed from: protected */
public Parcelable onSaveInstanceState() {
SavedState savedState = new SavedState(super.onSaveInstanceState());
savedState.menuPresenterState = new Bundle();
this.menu.savePresenterStates(savedState.menuPresenterState);
return savedState;
}
/* access modifiers changed from: protected */
public void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
}
SavedState savedState = (SavedState) state;
super.onRestoreInstanceState(savedState.getSuperState());
this.menu.restorePresenterStates(savedState.menuPresenterState);
}
}
| [
"sears-s@users.noreply.github.com"
] | sears-s@users.noreply.github.com |
3d4542bf2619aa0d441dbde697c1d5d98407e4ba | a6c35bad8c441fec15f2721c84aafde22cc04473 | /app/src/main/java/com/prac/apti/gittest_one/MainActivity.java | cd21cde047f9bad2a08f6f35b5589d6af45d2f36 | [] | no_license | zsx488266907/Git_one | 90b1982ac8ce95be30d995e582a59b091040afe5 | 87105be1f7a976784dd637edf35393ea1c0847f9 | refs/heads/master | 2022-09-07T14:55:36.243990 | 2020-06-01T14:56:24 | 2020-06-01T14:56:24 | 266,363,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package com.prac.apti.gittest_one;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button button;
private View viewById;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//撒打算看到
// ..阿瑟东撒的阿瑟东
//撒大苏打
Intent intent2= new Intent();
intent2.setClass(MainActivity.this,HomeActivity.class);
viewById = findViewById(R.id.button02);
Intent intent = new Intent();
intent.setClass(MainActivity.this,HomeActivity.class);
}
}
| [
"488266907@qq.com"
] | 488266907@qq.com |
d67c7740223c3047134748296b0df3a4713cc531 | 0a1c985c04292339912b38e6466ff455287f0d41 | /Informatica/40ProdottiDaXmlACsv/src/it/itis/cuneo/Magazzino.java | a8cad884306f00ad751f0cafecc97f8a0fcc8ccb | [] | no_license | giosuetrapani/4AInf1920 | 64b66254bffb954e732570afc5dfaa82c8dd680c | b8f8658cfe3f7d21e1a32c57451e07ee8c9e1a17 | refs/heads/master | 2022-06-14T06:57:39.383288 | 2020-05-05T06:41:58 | 2020-05-05T06:41:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,397 | java | package it.itis.cuneo;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Magazzino {
public static final String NOME_CLASSE = "Magazzino";
public static final String SEPARATOR = ",";
public static final String PATH_XML = "C:\\Users\\giosu\\OneDrive\\Documenti\\4AInf1920-master\\IdeaProjects\\4AInf1920\\Informatica\\40ProdottiDaXmlACsv\\src\\prodottoXml.xml";
public static final String PATH_CSV = "C:\\Users\\giosu\\OneDrive\\Documenti\\4AInf1920-master\\IdeaProjects\\4AInf1920\\Informatica\\40ProdottiDaXmlACsv\\src\\prodottoCsv.csv";
private String name;
private List<Prodotto> lProdotto;
public Magazzino() {
lProdotto = new ArrayList<Prodotto>();
}
public String getName() {
return name;
}
@XmlAttribute(name = "name")
public void setName(String name) {
this.name = name;
}
public List<Prodotto> getlProdotto() {
return lProdotto;
}
@XmlElement
public void setlProdotto(List<Prodotto> lProdotto) {
this.lProdotto = lProdotto;
}
@Override
public String toString() {
return "Magazzino{" +
"name='" + name + '\'' +
", lProdotto=" + lProdotto +
'}';
}
public String toRowCsv(){
return NOME_CLASSE + SEPARATOR + name;
}
public void unmarshall(){
File file = new File(PATH_XML);
JAXBContext jaxbContext = null;
Magazzino magazzino = null;
try{
jaxbContext = JAXBContext.newInstance(Magazzino.class);
Unmarshaller jaxbunmarshaller = jaxbContext.createUnmarshaller();
magazzino = (Magazzino) jaxbunmarshaller.unmarshal(file);
this.name= magazzino.name;
this.lProdotto = magazzino.lProdotto;
System.out.println(magazzino.toString());
}catch(JAXBException e){
e.printStackTrace();
}
}
public void marshall(){
File file = new File(PATH_XML);
JAXBContext jaxbContext = null;
try{
jaxbContext = JAXBContext.newInstance(Magazzino.class);
Marshaller jaxbmarshaller = jaxbContext.createMarshaller();
jaxbmarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbmarshaller.marshal(this, file);
jaxbmarshaller.marshal(this, System.out);
}catch(JAXBException e){
e.printStackTrace();
}
}
public void salvaCsv(){
File file = new File(PATH_CSV);
BufferedWriter bw = null;
try{
bw = new BufferedWriter(new FileWriter(file));
bw.write(this.toRowCsv());
for (Prodotto prodotto : this.getlProdotto()){
bw.write(this.toRowCsv());
}
bw.close();
}catch(IOException e){
e.printStackTrace();
}
}
public static void main(String[] args) {
Magazzino m1 = new Magazzino();
m1.unmarshall();
m1.salvaCsv();
}
}
| [
"giosue.trapani@itiscuneo.eu"
] | giosue.trapani@itiscuneo.eu |
63286cb45d65efec9bc0b74bf171985fac6dba02 | 35a66af09e0435049b708ebecbb88eb0b68dd3da | /src/test/java/by/modern/service/impl/AnswerServiceImplTest.java | 5e065932e96e5579137f1146010a496f853635af | [] | no_license | ValeraMakarenko/Modern | f291c342f5f61fd8bfca823bbf34b2392834c157 | 9bf23c6ba204e6ac4359adf33d455913ba6b255d | refs/heads/master | 2020-06-09T15:02:05.321004 | 2016-12-11T15:24:09 | 2016-12-11T15:24:09 | 76,032,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,321 | java | /*
package by.modern.service.impl;
import by.modern.dao.AnswerDao;
import by.modern.service.AnswerService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.junit.Assert.*;
@RunWith(MockitoJUnitRunner.class)
public class AnswerServiceImplTest {
*/
/* private static final Long AGENT_ID = StaticVariable.AGENT_ID;
private static final Long BANK_ID = StaticVariable.BANK_ID;*//*
private MockMvc mockMvc;
@Autowired
private AnswerDao answerDao;
@Autowired
private WebApplicationContext webApplicationContext;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
Mockito.reset(answerDao);
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
@Test
public void addAnswerList() throws Exception {
}
@Test
public void updateCount() throws Exception {
}
}*/
| [
"v.makarenko90@gmail.com"
] | v.makarenko90@gmail.com |
25d5f10fff146cf0b06ebd869311d6a7ba0564ff | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdas/applicationModule/src/main/java/applicationModulepackageJava15/Foo258.java | 816da4d9d7ab69f9d0b98a75872cb5e4993bbf1e | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package applicationModulepackageJava15;
public class Foo258 {
public void foo0() {
new applicationModulepackageJava15.Foo257().foo5();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
}
| [
"nikita.e.kozlov@gmail.com"
] | nikita.e.kozlov@gmail.com |
66fc3289583d1aa28d5620d7d39234014556b6f2 | ca2e81f9a3eb96ab3a4644a30c90216fc895a359 | /src/main/java/com/kiragames/model/IPSource.java | 400fad10f5aabb81fa3b16a87d8fb5deaf614de4 | [] | no_license | Michael-Kochis/Ascendant | 1df65c96bbb63ae7ff5c417100fe8b4274bd8d4f | a38b7e9d17f657630543cb3441de265777106ac1 | refs/heads/master | 2023-02-08T13:50:14.200839 | 2021-01-02T01:40:44 | 2021-01-02T01:40:44 | 273,267,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package com.kiragames.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.validation.constraints.PositiveOrZero;
import org.springframework.stereotype.Component;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Component
@Entity
@NoArgsConstructor @Getter @Setter @EqualsAndHashCode @ToString
public class IPSource {
@Id
@PositiveOrZero
private long sourceID;
@Column
private String sourceName;
}
| [
"rhishisikk@gmail.com"
] | rhishisikk@gmail.com |
00ca271ab23139707cb7c95377a0dac3c88b33cd | 4699d76440b0d545e868a7250d07878caf1d3e35 | /staticDemo/src/DatabaseHelper.java | 492c9176a17fc7b4af52ca9ac6e227f69592ee42 | [] | no_license | sbaltinsoy/JAVA-LEARNING | 783cd440fc00b7d9e39d1c89ec9076b26dd5c7f6 | 25fb13a5fc56a664e0d217240ddd27830ca20b3f | refs/heads/master | 2023-08-16T10:12:39.174550 | 2021-09-22T09:40:43 | 2021-09-22T09:40:43 | 409,136,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | public class DatabaseHelper {
public static class Crud{
// Create Read Update Delete
public static void Delete(){
}
public static void Update(){
}
}
public static class Connection{
public static void createConnection(){
}
}
}
| [
"serhatburakaltinsoy@gmail.com"
] | serhatburakaltinsoy@gmail.com |
9d7571a9986f2f230a96fb17a6c966661cff5fdd | 74fa1b13539414030cb8c1ce29116e4e51b3539a | /app/src/main/java/com/example/ifiag12/MainActivity.java | ed5fbe93879701342e3fa412e279a29a1d51e9e1 | [] | no_license | iadoSaad/ifiag12 | 7cc00234b8856d0e4a220faf953b130c51293066 | 0f19d10325494211e8ffb54c1f30f0c7adc8cf43 | refs/heads/master | 2022-12-19T12:22:29.891484 | 2020-09-19T10:49:55 | 2020-09-19T10:49:55 | 296,847,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | package com.example.ifiag12;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void click(View v){
Intent intent=new Intent(this,CalculatorActivity.class);
startActivity(intent);
}
public void toRecyclerView(View v){
Intent intent=new Intent(this,ListAcitivity.class);
startActivity(intent);
}
}
| [
"saad.bougrine@gmail.com"
] | saad.bougrine@gmail.com |
d779836027758143a5c81d00e96d6cd6b94a40ed | 7d8d9da92a77b37acc2042a16366c82e45c900ea | /cube/src/main/java/com/kylinolap/cube/dataGen/ColumnConfig.java | e86ed5247396536955a182259f1ff31bb8f075e9 | [
"Apache-2.0"
] | permissive | huangweili/Kylin | d5d9c1b8cd2fe17ac3910aec13620bc432bab449 | ce1f5e1e483372c5f45ffa9f29c42e4618f91a3e | refs/heads/master | 2021-01-15T12:15:12.887727 | 2014-10-10T08:28:54 | 2014-10-10T08:29:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,377 | java | package com.kylinolap.cube.dataGen;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
/**
* Created by honma on 5/29/14.
*/
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
public class ColumnConfig {
@JsonProperty("columnName")
private String columnName;
@JsonProperty("valueSet")
private ArrayList<String> valueSet;
@JsonProperty("exclusive")
private boolean exclusive;
@JsonProperty("asRange")
private boolean asRange;
public boolean isAsRange() {
return asRange;
}
public void setAsRange(boolean asRange) {
this.asRange = asRange;
}
public boolean isExclusive() {
return exclusive;
}
public void setExclusive(boolean exclusive) {
this.exclusive = exclusive;
}
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public ArrayList<String> getValueSet() {
return valueSet;
}
public void setValueSet(ArrayList<String> valueSet) {
this.valueSet = valueSet;
}
}
| [
"luke.hq@gmail.com"
] | luke.hq@gmail.com |
8ba97d02e1fa4614eacb69c45e6b1c5458103c94 | 3b590c0a1765e28f78d8308dd8e4a3bac7b60b8d | /search/searchItemAdapter.java | b9bf9394eb2f3cdbd90acebe9f1c627cfcd69a67 | [] | no_license | SinaKhorrami/IPA | 1ec9a123f8d79131e007ee870e9fc8732b0eb06b | 827629f19971074fcbca04f2f684214f0fb5d7ea | refs/heads/master | 2022-08-25T16:48:29.212289 | 2016-01-31T15:45:07 | 2016-01-31T15:45:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package com.example.shahin.test.search;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.shahin.test.R;
import com.example.shahin.test.search.searchItem;
import com.google.android.gms.games.Player;
import java.util.List;
/**
* Created by sina on 11/19/2015.
*/
public class searchItemAdapter extends ArrayAdapter<searchItem> {
private LayoutInflater inflater;
private List<searchItem> searchItems;
public searchItemAdapter(Context context, int resource, List<searchItem> objects, Activity activity) {
super(context, resource, objects);
this.searchItems = objects;
inflater = activity.getWindow().getLayoutInflater();
}
@Override
public View getView(int position, View convertView, ViewGroup parent){
View v = convertView;
v = inflater.inflate(R.layout.search_textview, null);
searchItem SearchItem = this.searchItems.get(position);
TextView titleTextview = (TextView) v.findViewById(R.id.searchTextView);
TextView urlTextview = (TextView) v.findViewById(R.id.searchTextView2);
TextView descriptionTextview = (TextView) v.findViewById(R.id.searchTextView3);
titleTextview.setText(SearchItem.getTitle());
urlTextview.setText(SearchItem.getURL());
descriptionTextview.setText(SearchItem.getDescription());
return v;
}
}
| [
"Shahin@Shahins-MacBook-Pro.local"
] | Shahin@Shahins-MacBook-Pro.local |
7d6df88b661679fc8d8b795f8078699d66103480 | a6e8243ac65f628754be918c5131f9ec30f5a0ab | /src/net/commerce/zocalo/experiment/ScoreExplanationAccumulator.java | cdf0f88d8b5ec0948c122fe84108d959209c3cc8 | [] | no_license | Yakushima/Zocalo | 2eac87f856979993520e67779091dd0168d1d4fc | 51ad46c33b22eb5da01b6eb8ea55f8426d145e74 | refs/heads/master | 2021-01-11T22:40:16.327114 | 2018-01-14T12:31:28 | 2018-01-14T12:31:28 | 79,013,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,458 | java | package net.commerce.zocalo.experiment;
import net.commerce.zocalo.html.HtmlTable;
import net.commerce.zocalo.html.HtmlSimpleElement;
import net.commerce.zocalo.html.HtmlRow;
import net.commerce.zocalo.logging.GID;
import net.commerce.zocalo.NumberDisplay;
import net.commerce.zocalo.currency.Quantity;
import net.commerce.zocalo.experiment.role.TradingSubject;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.log4j.Logger;
// Copyright 2009 Chris Hibbert. All rights reserved.
// This software is published under the terms of the MIT license, a copy
// of which has been included with this distribution in the LICENSE file.
/** collect matched HTML header, log labels and values for experiment scoring so we'll be able to
print htmlTables or log the info. */
public class ScoreExplanationAccumulator {
private List<String> headers = new ArrayList<String>();
private List<String> cells = new ArrayList<String>();
private List<String> logLabels = new ArrayList<String>();
private List<String> logValues = new ArrayList<String>();
private List<Integer> widths = new ArrayList<Integer>();
private boolean hasWidths = false;
public void addEntry(String htmlLabel, int width, String logLabel, Quantity v) {
String score = v.printAsScore();
if (null != htmlLabel && 0 != htmlLabel.length()) {
headers.add(htmlLabel);
cells.add(score);
widths.add(width);
hasWidths = true;
}
if (null != logLabel && 0 != logLabel.length()) {
logLabels.add(logLabel);
logValues.add(score);
}
}
public void addEntry(String htmlLabel, String logLabel, Quantity v) {
String score = v == null ? "MISSING" : v.printAsScore();
if (null != htmlLabel && 0 != htmlLabel.length()) {
headers.add(htmlLabel);
cells.add(score);
widths.add(0);
}
if (null != logLabel && 0 != logLabel.length()) {
logLabels.add(logLabel);
logValues.add(score);
}
}
public void addEntry(String htmlLabel, String logLabel, String value) {
if (null != htmlLabel && 0 != htmlLabel.length()) {
headers.add(htmlLabel);
cells.add(value);
widths.add(0);
}
if (null != logLabel && 0 != logLabel.length()) {
logLabels.add(logLabel);
logValues.add(value);
}
}
public void addEntryIfDefined(String htmlLabel, Object key, String logLabel, TradingSubject subject) {
Quantity scoreComponent = subject.getScoreComponent(key);
if (scoreComponent != null) {
addEntry(htmlLabel, logLabel, scoreComponent);
}
}
public void renderAsColumns(StringBuffer buf) {
String[] headerArray = headers.toArray(new String[headers.size()]);
String[] valueArray = cells.toArray(new String[cells.size()]);
if (hasWidths) {
Integer[] widths = this.widths.toArray(new Integer[this.widths.size()]);
HtmlTable.oneRowTable(buf, headerArray, valueArray, widths);
} else {
HtmlTable.oneRowTable(buf, headerArray, valueArray);
}
}
public void log(String pref, Logger logger) {
StringBuffer buf = new StringBuffer();
buf.append(GID.log());
buf.append(pref);
if (!pref.substring(pref.length() -1 ).equals(" ")) {
buf.append(" ");
}
Iterator<String> valueIterator = logValues.iterator();
for (Iterator<String> labelIterator = logLabels.iterator(); labelIterator.hasNext();) {
String label = labelIterator.next();
String body = valueIterator.next();
buf.append(label).append(": ").append(body);
if (labelIterator.hasNext()) {
buf.append(" ");
}
}
logger.info(buf.toString());
}
public static void renderAsTwoColumns(ScoreExplanationAccumulator left, ScoreExplanationAccumulator right, StringBuffer buf) {
String[] leftHeaders = left.headers.toArray(new String[left.headers.size()]);
String[] leftValues = left.cells.toArray(new String[left.cells.size()]);
String[] rightHeaders = right.headers.toArray(new String[right.headers.size()]);
String[] rightValues = right.cells.toArray(new String[right.cells.size()]);
buf.append("<table border=1>\n <tbody>\n\t");
int maxLen = Math.max(left.cells.size(), right.cells.size());
HtmlSimpleElement emptyCell = HtmlSimpleElement.cell(" ");
for (int i = 0 ; i < maxLen ; i++ ) {
HtmlRow.startTag(buf);
if (leftHeaders.length > i && rightHeaders.length > i) {
HtmlSimpleElement.cell(leftHeaders[i]).render(buf);
HtmlSimpleElement.centeredCell(leftValues[i]).render(buf);
emptyCell.render(buf);
HtmlSimpleElement.cell(rightHeaders[i]).render(buf);
HtmlSimpleElement.centeredCell(rightValues[i]).render(buf);
} else if (leftHeaders.length > i) {
HtmlSimpleElement.cell(leftHeaders[i]).render(buf);
HtmlSimpleElement.centeredCell(leftValues[i]).render(buf);
emptyCell.render(buf);
emptyCell.render(buf);
emptyCell.render(buf);
} else {
emptyCell.render(buf);
emptyCell.render(buf);
emptyCell.render(buf);
HtmlSimpleElement.cell(rightHeaders[i]).render(buf);
HtmlSimpleElement.centeredCell(rightValues[i]).render(buf);
}
HtmlRow.endTag(buf);
}
buf.append("</tbody></table>");
}
public static void renderAsOneColumn(ScoreExplanationAccumulator column, StringBuffer buf) {
String[] headers = column.headers.toArray(new String[column.headers.size()]);
String[] values = column.cells.toArray(new String[column.cells.size()]);
buf.append("<table border=1>\n <tbody>\n\t");
for (int i = 0 ; i < column.cells.size(); i++ ) {
HtmlRow.startTag(buf);
HtmlSimpleElement.cell(headers[i]).render(buf);
HtmlSimpleElement.centeredCell(values[i]).render(buf);
HtmlRow.endTag(buf);
}
buf.append("</tbody></table>");
}
}
| [
"michael.eugene.turner@gmail.com"
] | michael.eugene.turner@gmail.com |
444c6e9f964c10ef6ec9397dd848448406ca05ba | f8c25e4b677f395f22cfc83f2ef5835c9d8cd7a2 | /app/src/main/java/br/org/sidia/eva/healthmonitor/IHealthPreferencesView.java | e59a9516717dbafa8d050bef1996c9b385f5dd5d | [] | no_license | sidia-sxr/eva | 53ab14c100c52a31e7b140b9bb615df7c1498078 | a5bac8fe46339854283873faa27100aa61f48b67 | refs/heads/master | 2020-04-14T22:18:58.501711 | 2019-03-19T14:26:27 | 2019-03-19T14:26:27 | 164,157,902 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | /*
* Copyright 2015 Samsung Electronics Co., LTD
*
* 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 br.org.sidia.eva.healthmonitor;
import android.widget.Button;
import java.util.List;
import br.org.sidia.eva.view.IView;
public interface IHealthPreferencesView extends IView {
Button getResetButton();
Button getCloseButton();
Button getApplyButton();
Button getApplyAndCloseButton();
List<HealthPreferenceViewModel> getPreferences();
void setPreferences(List<HealthPreferenceViewModel> preferences);
}
| [
"a.naveca@samsung.com"
] | a.naveca@samsung.com |
75e243004f1174b950270c13004c9500a67c7aa2 | 7a3553fa9fb48c3f032471fa91c2f9d4e0194ffe | /src/com/keisse/gevorderd/hoofdstuk17/opdracht3Lambdas/lambdaIntro/WordFilter.java | e824e1933aaa9c8a8946ffe4dfbd023d514090f9 | [] | no_license | kridboy/javaGevorderden | a0c256191649ebca346231a18d32c7d036bac7eb | 3025ef8e3f6f12f1188a898528e47babffea24be | refs/heads/master | 2020-06-04T08:46:34.893005 | 2019-06-17T15:21:52 | 2019-06-17T15:21:52 | 191,950,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package com.keisse.gevorderd.hoofdstuk17.opdracht3Lambdas.lambdaIntro;
@FunctionalInterface
public interface WordFilter {
boolean isValid(String s);
static boolean hasString(String s){
return s.contains("la")||s.contains("g");
}
}
| [
"keisse.m@hotmail.com"
] | keisse.m@hotmail.com |
22261b611fa5f22054605e6c41c0d1be0acd9851 | 7f95b0c2d6e1922aeb64d0ba0a52698d17b6a5f2 | /product-service/supermarket/src/main/java/com/gemini/business/supermarket/platform/enums/TargetEnum.java | 80912bf6fc7360c7c8a5d7ec0ecdb960d0aa02ec | [] | no_license | xiaominglol/product-cloud | 35cb8cc50748d1748e0e64737d5ab1b95ecf53ef | a0227879f92cc85a72839d34530ea5514bf3ed5e | refs/heads/master | 2020-11-25T21:44:39.903145 | 2020-03-30T06:34:30 | 2020-03-30T06:34:30 | 228,858,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 855 | java | package com.gemini.business.supermarket.platform.enums;
import com.gemini.boot.framework.mybatis.entity.Dict;
import com.gemini.boot.framework.mybatis.service.DictService;
/**
* id:402609161446912
* code:Target
* name:打开方式
* description:打开方式
*/
public enum TargetEnum implements DictService {
/**
* id:402609161446914
* code:_blank
* name:新窗口
* description:打开方式:新窗口
*/
_blank() {
@Override
public Dict dict() {
return Dicts.get(402609161446914L);
}
},
/**
* id:402609161446915
* code:_self
* name:当前窗口
* description:打开方式:当前窗口
*/
_self() {
@Override
public Dict dict() {
return Dicts.get(402609161446915L);
}
}
}
| [
"474345633@qq.com"
] | 474345633@qq.com |
0f8502730880d5509a42e6e69d6c3b0c6cc817dc | 2e76ee7edbb7fd762bc28bfb3874c799139e3ae1 | /app/src/main/java/com/yunyou/icloudinn/bookhouse/JavaBean/UserData.java | e46c2e93c6b0fddcdb343eb1f498d573359bad7d | [] | no_license | ypl1306961052/bt | c47f1f2460bc381c424cc70f1869c8e33804e24e | 7a4e3ba26146daae07edf06f686dbdd950112147 | refs/heads/master | 2020-03-27T15:54:34.817777 | 2018-08-30T12:32:54 | 2018-08-30T12:32:54 | 146,746,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,817 | java | package com.yunyou.icloudinn.bookhouse.JavaBean;
import java.io.Serializable;
public class UserData implements Serializable {
private int yunsu_id;
private String account;
private String nickname;
private String head_img_url;
private String sex;
private String age;
private String city;
private String phone;
private String access_token;
private int point;
private int rent_book_num;
private int donate_book_num;
private int check_in_hotel_num;
private int is_concern;
public int getYunsu_id() {
return yunsu_id;
}
public void setYunsu_id(int yunsu_id) {
this.yunsu_id = yunsu_id;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getHead_img_url() {
return head_img_url;
}
public void setHead_img_url(String head_img_url) {
this.head_img_url = head_img_url;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAge() {return age;}
public void setAge(String age) {this.age = age;}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public int getPoint() {
return point;
}
public void setPoint(int point) {
this.point = point;
}
public int getRent_book_num() {
return rent_book_num;
}
public void setRent_book_num(int rent_book_num) {
this.rent_book_num = rent_book_num;
}
public int getDonate_book_num() {
return donate_book_num;
}
public void setDonate_book_num(int donate_book_num) {
this.donate_book_num = donate_book_num;
}
public int getCheck_in_hotel_num() {
return check_in_hotel_num;
}
public void setCheck_in_hotel_num(int check_in_hotel_num) {
this.check_in_hotel_num = check_in_hotel_num;
}
public int getIs_concern() {
return is_concern;
}
public void setIs_concern(int is_concern) {
this.is_concern = is_concern;
}
}
| [
"38916444+ypl1306961052@users.noreply.github.com"
] | 38916444+ypl1306961052@users.noreply.github.com |
d4655397711d3748f5d22303e26073798df121dc | cdf6ca91f86c4266a36320c3dc91d6b59c8578ec | /src/main/java/com/LiuZhaoyang/controller/AdminOrderListServlet.java | 299a69770ba2643ea1f4efe15604fcb24892f90f | [] | no_license | 2019211001001223-LiuZhaoyang/LiuZhaoyang2019211001001223 | bc5e75819305d3538d517a46f4c5db8be485cb5e | bd33bc67fa056ff5b05c9cf33d57869c247071ba | refs/heads/master | 2023-06-03T09:34:38.628614 | 2021-06-18T01:49:08 | 2021-06-18T01:49:08 | 345,343,791 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,416 | java | package com.LiuZhaoyang.controller;
import com.LiuZhaoyang.dao.OrderDao;
import com.LiuZhaoyang.model.Order;
import com.LiuZhaoyang.model.Payment;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Connection;
import java.util.List;
@WebServlet("/admin/orderList")
public class AdminOrderListServlet extends HttpServlet {
Connection con=null;
public void init() throws ServletException {
con=(Connection)getServletContext().getAttribute("con");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request,response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
List<Payment> paymentTypeList=Payment.findAllPayment(con);
request.setAttribute("paymentTypeList",paymentTypeList);
OrderDao orderDao=new OrderDao();
List<Order> orderList=orderDao.findAll(con);
request.setAttribute("orderList",orderList);
String path="/WEB-INF/views/admin/orderList.jsp";
request.getRequestDispatcher(path).forward(request,response);
}
}
| [
"noreply@github.com"
] | 2019211001001223-LiuZhaoyang.noreply@github.com |
964b70ad95bc13a60fa9a266c9b46823c2eaeb36 | 6a625032bbc989ca2a598f2ac8c29626369c3894 | /core/src/main/java/com/gapfyl/util/MD5.java | bb46981c68291a3a4edb2ae479751095b24a0d6a | [] | no_license | vigneshwaran26/gapfyl_application | 037caf26d3916f5be127d8a33d3867d8e944ceff | b1c9e2fb5b6abaac665b51cac4957e10f5f284a6 | refs/heads/master | 2023-08-28T14:14:27.628920 | 2021-09-19T18:02:03 | 2021-09-19T18:02:03 | 408,198,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.gapfyl.util;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* @author vignesh
* Created on 13/04/21
**/
public class MD5 {
public static String getMD5(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(str.getBytes());
BigInteger no = new BigInteger(1, messageDigest);
String hashNext = no.toString(16);
while (hashNext.length() < 32) {
hashNext = "0" + hashNext;
}
return hashNext;
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
}
| [
"vicky.ravi26@gmail.com"
] | vicky.ravi26@gmail.com |
75e844ca11d0a9ad3a67ca79a484beb904cc88e6 | 2da2989c1a949098f3afdce2b740090eaa07eb7f | /src/main/java/com/spring/mta/controller/CartController.java | 54bd247bbc62af3291c3b8509d5230fbeb91530a | [] | no_license | leesoengsuk/MTA_PRO | 4fc37637ff7e9a3b95052ae2e00b15054561ea36 | c4494162e8d592e88a8d3b97a39cea461f440ee6 | refs/heads/master | 2023-05-10T22:35:34.337906 | 2021-06-03T07:24:45 | 2021-06-03T07:24:45 | 373,387,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,682 | java | package com.spring.mta.controller;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.spring.mta.service.CartService;
import com.spring.mta.vo.CartVO;
import com.spring.mta.vo.UserVO;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j;
@Controller
@Log4j
@RequestMapping("/order/*")
@AllArgsConstructor
public class CartController {
private CartService cartService;
@ResponseBody
@RequestMapping(value ="/addCart", method =RequestMethod.POST)
public String addCart(@ModelAttribute("data") CartVO cvo)throws Exception {
log.info("addcart call ");
int result = 0;
int cartCheck = 0;
cartCheck = cartService.CartListCheck(cvo);
log.info("장바구니 중복 체크"+cartCheck);
System.out.println(cartCheck);
if(cartCheck < 1) {
result = cartService.addCart(cvo);
log.info("장바구니 추가 결과 : "+result );
}else {
result = 2;
}
return String.valueOf(result);
}
@RequestMapping(value = "/cartList", method = RequestMethod.GET)
public String cartList(@ModelAttribute("cart") CartVO cvo, UserVO uvo,Model model, HttpSession session) {
log.info("cartList call");
// 추후 세션 정보로 변경해주어야 함.
UserVO uvo2 = (UserVO) session.getAttribute("userInfo");
cvo.setUser_id(uvo2.getUser_id());
List<CartVO> list = cartService.CartList(cvo);
model.addAttribute("cartList",list);
//String user_id = cvo.getUser_id();
return "order/cartList";
}
//ordrList
@RequestMapping(value = "/orderList", method = RequestMethod.GET)
public String cartList2(@ModelAttribute("cart") CartVO cvo, UserVO uvo,Model model, HttpSession session) {
log.info("orderList call");
// 추후 세션 정보로 변경해주어야 함.
UserVO uvo2 = (UserVO) session.getAttribute("userInfo");
cvo.setUser_id(uvo2.getUser_id());
List<CartVO> list = cartService.CartList(cvo);
model.addAttribute("cartList",list);
//String user_id = cvo.getUser_id();
return "order/orderList";
}
// 카트 삭제
@ResponseBody
@RequestMapping(value = "/deleteCart", method = RequestMethod.GET)
public String deleteCart(HttpSession session, @RequestParam(value = "check[]") List<String> chArr, CartVO cvo ,UserVO uvo) throws Exception {
log.info("delete cart call ");
int result = 0;
String cart_id = "";
uvo = (UserVO) session.getAttribute("userInfo");
String user_id = uvo.getUser_id();
for(String i : chArr) {
cart_id = i;
cvo.setUser_id(user_id);
cvo.setCart_id(cart_id);
cartService.deleteCart(cvo);
}
result = 1;
//}
return String.valueOf(result);
}
@ResponseBody
@RequestMapping(value = "/checkOut", method = RequestMethod.POST)
public String checkOut(@RequestParam(value = "check[]") List<String> chArr,UserVO uvo, CartVO cvo, Model model, HttpSession session) throws Exception {
int result = 0;
String cart_id = "";
uvo = (UserVO) session.getAttribute("userInfo");
String user_id = uvo.getUser_id();
for(String i : chArr) {
cart_id = i;
cvo.setUser_id(user_id);
cvo.setCart_id(cart_id);
cartService.checkOut(cvo);
}
result = 1;
//}
return String.valueOf(result);
}
}
| [
"lss8710@gmail.com"
] | lss8710@gmail.com |
05f3339d499ff0e47cf5f5ab288e47d728f037fa | 0432b1fead39650bd6f599a6823948dd7cedbaba | /src/Lesson11/Ex05/Client/MessageProviderImplementation.java | b4a80faaf00c0d6dce04f52e183c60429d0cb0e0 | [] | no_license | oleksalab/java-oop | 7fa2ab78fcc6a522ffe5a43a68b6af5f92e066be | e988c13828c3a4eb0c5e3ee479a438387b6c82bc | refs/heads/master | 2020-03-25T00:42:39.926826 | 2018-09-11T04:32:32 | 2018-09-11T04:32:32 | 143,201,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,539 | java | package Lesson11.Ex05.Client;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
public class MessageProviderImplementation implements MessageProvider {
private Socket socet;
private ObjectInputStream ois = null;
private ObjectOutputStream oos = null;
public MessageProviderImplementation(Socket socet) {
super();
this.socet = socet;
}
public MessageProviderImplementation() {
super();
}
public Socket getSocet() {
return socet;
}
public void setSocet(Socket socet) throws IOException {
this.socet = socet;
oos = new ObjectOutputStream(socet.getOutputStream());
ois = new ObjectInputStream(socet.getInputStream());
}
@Override
public void sendMessage(Message message) throws IOException {
try {
oos.writeObject(message);
} catch (IOException e) {
closeStream();
throw e;
}
}
@Override
public Message readMessage() throws IOException {
try {
return (Message) ois.readObject();
} catch (ClassNotFoundException e) {
return null;
} catch (IOException e) {
closeStream();
throw e;
}
}
private final void closeStream() {
try {
oos.close();
ois.close();
socet.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"oleksalab@gmail.com"
] | oleksalab@gmail.com |
9cdf3b9a4ef5cf5aa7f63a8b52f7cc8b8d65675b | c01507f512f426a1aec3f7eadda25ae870336d46 | /TransMototaxi/src/com/munichosica/myapp/exceptions/MotBoletaInternamientoDaoException.java | b48d6f66455f183e0e910487d750234d10323c8b | [] | no_license | frankapazac/jfmototaxis | 1795b9bca16756d3c0d3deb8b08f54ee850c2ee0 | d768a9570f781b4ea010d87d318b26a73e35c950 | refs/heads/master | 2021-01-10T11:39:01.742765 | 2014-02-18T20:41:13 | 2014-02-18T20:41:13 | 50,777,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.munichosica.myapp.exceptions;
public class MotBoletaInternamientoDaoException extends DaoException{
public MotBoletaInternamientoDaoException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public MotBoletaInternamientoDaoException(String message,
Throwable throwable) {
super(message, throwable);
// TODO Auto-generated constructor stub
}
}
| [
"frankjavadev@gmail.com"
] | frankjavadev@gmail.com |
af206323c32e01e7e66a87f6dd3d3630eaacf056 | 173de488a15d876ff570e523c7ed8fb442498a94 | /src/util/RelacionBean.java | 2b97e68f26c6587300f852718bd7ac6076da1061 | [] | no_license | LethalDrumsXxl/TT | a679e0239fb6b58fbb626b874a7cdfaf00f89374 | a71be9cbfde76dbed9ea5b26638ceba747069254 | refs/heads/master | 2021-01-10T01:01:02.806709 | 2015-04-16T21:55:40 | 2015-04-16T21:55:40 | 33,287,293 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package util;
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name = "relacionBean")
@SessionScoped
public class RelacionBean implements Serializable {
private String nombre;
private List<AtributoBean> atributos;
private List<TuplaBean> tuplas;
public RelacionBean(){
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public List<AtributoBean> getAtributos() {
return atributos;
}
public void setAtributos(List<AtributoBean> atributos) {
this.atributos = atributos;
}
public List<TuplaBean> getTuplasBean() {
return tuplas;
}
public void setTuplas(List<TuplaBean> tuplas) {
this.tuplas = tuplas;
}
}
| [
"s.segovia.c@gmail.com"
] | s.segovia.c@gmail.com |
62221107bdb8f6c4b3fcd0d1a2756da63721b897 | cd1404e88c7e203b1c985add6d9d61c84b83a2c3 | /Part 1/NeedARide/src/main/java/com/ucm/needaride/model/AppUser.java | 517d84d4677059ab2036c00ba6c0f59068f262bd | [] | no_license | lakmez/NeedARide | 5f2b993cfe349dbb2e8fe8572d34a69044f1d459 | dcf0c90f78346fb343ed2dd64cac9e0894ea8cd0 | refs/heads/master | 2020-06-10T11:23:35.246896 | 2016-12-08T19:36:44 | 2016-12-08T19:36:44 | 75,967,580 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package com.ucm.needaride.model;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection="rideUsers")
public class AppUser {
private String userName;
private String email;
private String firstName;
private String lastName;
private String PhNo;
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
private String rollNo;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhNo() {
return PhNo;
}
public void setPhNo(String phNo) {
PhNo = phNo;
}
public String getRollNo() {
return rollNo;
}
public void setRollNo(String rollNo) {
this.rollNo = rollNo;
}
}
| [
"lakme.1989@gmail.com"
] | lakme.1989@gmail.com |
e59eef0c7a0ac33a63dbe78a29b97a685174518f | 00958474f44161ea1ae247a5a7421adddf479122 | /src/main/java/com/z/service/serviceImpl/UserServiceImpl.java | c1a4d623fd2a9fcdbc3eacd20b672bd5b669e31e | [] | no_license | hodooage/SharedPPX | 0ccb01c7fcdb1693cf8fbc71a09863dd52c06f8c | 1019f9d66e311b848f1cbb5c32f6b5dc89b512c5 | refs/heads/master | 2021-01-24T21:18:48.910052 | 2018-04-19T10:20:15 | 2018-04-19T10:20:15 | 123,268,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,288 | java | package com.z.service.serviceImpl;
import com.z.dao.mapper.UserMapper;
import com.z.pojo.User;
import com.z.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class UserServiceImpl implements UserService {
@Autowired
UserMapper userMapper;
@Override
public User userLogin(String username, String password) {
System.out.println(userMapper);
return userMapper.userLogin(username,password);
}
@Override
public User getUserById(int userId) {
return userMapper.selectByPrimaryKey(userId);
}
@Override
public float retrieveUserBalance(int userId) {
return userMapper.retrieveUserBalance(userId);
}
@Override
public void setUserImage(int userId, String url) {
userMapper.setUserImage(userId,url);
}
@Override
public String getUserImage(int userId) {
return userMapper.getUserImage(userId);
}
@Override
public int editUserInformation(User user) {
return userMapper.updateByPrimaryKeySelective(user);
}
@Override
public int changeUserBalance(int userId, double newBalance) {
return userMapper.changeUserBalance(userId,newBalance);
}
}
| [
"wenjie.zhang@aorise.org"
] | wenjie.zhang@aorise.org |
cce01dd95d8a0c89b76b05d97127c10837f79e5a | ab7fcaefee61952e5eb95a9eee44679227e6f15e | /CreateTargetOnly/Source/gen/Source/impl/SourceFactoryImpl.java | d83f6f89f213d73a39ef88dc4fdc64dea226523e | [] | no_license | mabilov/tgg_workarounds | 9b12e81994ea34c272235722cb0bc160ab8df5b8 | 3d6c6b568745030b443ceb58f7d34834b5ff37ac | refs/heads/master | 2016-08-08T06:30:44.735028 | 2015-06-24T10:21:53 | 2015-06-24T10:21:53 | 37,904,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,554 | java | /**
*/
package Source.impl;
import Source.*;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class SourceFactoryImpl extends EFactoryImpl implements SourceFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static SourceFactory init() {
try {
SourceFactory theSourceFactory = (SourceFactory) EPackage.Registry.INSTANCE
.getEFactory(SourcePackage.eNS_URI);
if (theSourceFactory != null) {
return theSourceFactory;
}
} catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new SourceFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SourceFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case SourcePackage.SOURCE_MODEL:
return createSourceModel();
case SourcePackage.ACTIVITY:
return createActivity();
case SourcePackage.SPLIT_MERGE:
return createSplitMerge();
default:
throw new IllegalArgumentException("The class '" + eClass.getName()
+ "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SourceModel createSourceModel() {
SourceModelImpl sourceModel = new SourceModelImpl();
return sourceModel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Activity createActivity() {
ActivityImpl activity = new ActivityImpl();
return activity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SplitMerge createSplitMerge() {
SplitMergeImpl splitMerge = new SplitMergeImpl();
return splitMerge;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SourcePackage getSourcePackage() {
return (SourcePackage) getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static SourcePackage getPackage() {
return SourcePackage.eINSTANCE;
}
} //SourceFactoryImpl
| [
"marat.abilov@gmail.com"
] | marat.abilov@gmail.com |
88e9aca7b997726d9642b2600d4e108859cb130e | 82bda3ed7dfe2ca722e90680fd396935c2b7a49d | /app-meipai/src/main/java/com/arashivision/insbase/arlog/MultipartUtility.java | 81d903f7b37cab810a353da029906435bf5310e6 | [] | no_license | cvdnn/PanoramaApp | 86f8cf36d285af08ba15fb32348423af7f0b7465 | dd6bbe0987a46f0b4cfb90697b38f37f5ad47cfc | refs/heads/master | 2023-03-03T11:15:40.350476 | 2021-01-29T09:14:06 | 2021-01-29T09:14:06 | 332,968,433 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,135 | java | package com.arashivision.insbase.arlog;
import android.util.Log;
import com.baidubce.http.Headers;
import com.facebook.stetho.websocket.WebSocketHandler;
import com.tencent.connect.common.Constants;
import e.a.a.a.a;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.UUID;
public class MultipartUtility {
public static final String CTRLF = "\r\n";
public static final String TWO_HYPHENS = "--";
public final String mBoundary = UUID.randomUUID().toString();
public ArrayList<Part> mParts = new ArrayList<>();
public final String mRequestUrl;
public class FilePart implements Part {
public byte[] end;
public String fieldName;
public long fieldSize;
public File file;
public long fileLength;
public byte[] head;
public final /* synthetic */ MultipartUtility this$0;
public FilePart(MultipartUtility multipartUtility, String str, String str2) {
String str3 = "UTF-8";
this.this$0 = multipartUtility;
this.fieldName = str;
File file2 = new File(str2);
this.file = file2;
if (file2.isFile()) {
this.fileLength = this.file.length();
String name = this.file.getName();
StringBuilder a2 = a.a(MultipartUtility.TWO_HYPHENS);
a2.append(multipartUtility.mBoundary);
String str4 = MultipartUtility.CTRLF;
a2.append(str4);
a2.append("Content-Disposition: form-data; name=\"");
a2.append(str);
a2.append("\";filename=\"");
a.a(a2, name, "\"", str4, str4);
try {
this.head = a2.toString().getBytes(str3);
byte[] bytes = str4.getBytes(str3);
this.end = bytes;
this.fieldSize = ((long) (this.head.length + bytes.length)) + this.fileLength;
} catch (UnsupportedEncodingException e2) {
throw new RuntimeException(e2);
}
} else {
throw new RuntimeException(a.a("file: ", str2, " is not a file"));
}
}
public long getSize() {
return this.fieldSize;
}
public PartType getType() {
return PartType.FILE;
}
}
public interface Part {
long getSize();
PartType getType();
}
public enum PartType {
STRING,
FILE
}
public class StringPart implements Part {
public byte[] content;
public String name;
public String value;
public StringPart(String str, String str2) {
this.name = str;
this.value = str2;
StringBuilder a2 = a.a(MultipartUtility.TWO_HYPHENS);
a2.append(MultipartUtility.this.mBoundary);
String str3 = MultipartUtility.CTRLF;
a2.append(str3);
a2.append("Content-Disposition: form-data; name=\"");
a2.append(str);
a2.append("\"");
a.a(a2, str3, "Content-Type: text/plain; charset=UTF-8\r\n", str3, str2);
a2.append(str3);
try {
this.content = a2.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e2) {
throw new RuntimeException(e2);
}
}
public long getSize() {
return (long) this.content.length;
}
public PartType getType() {
return PartType.STRING;
}
}
public MultipartUtility(String str) {
this.mRequestUrl = str;
}
public MultipartUtility addFilePart(String str, String str2) {
this.mParts.add(new FilePart(this, str, str2));
return this;
}
public MultipartUtility addFormField(String str, String str2) {
this.mParts.add(new StringPart(str, str2));
return this;
}
public String commit() throws IOException {
Iterator it = this.mParts.iterator();
long j2 = 0;
while (it.hasNext()) {
j2 += ((Part) it.next()).getSize();
}
String str = TWO_HYPHENS;
StringBuilder a2 = a.a(str);
a2.append(this.mBoundary);
a2.append(str);
a2.append(CTRLF);
byte[] bytes = a2.toString().getBytes("UTF-8");
long length = j2 + ((long) bytes.length);
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(this.mRequestUrl).openConnection();
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
httpURLConnection.setFixedLengthStreamingMode((int) length);
httpURLConnection.setRequestMethod(Constants.HTTP_POST);
httpURLConnection.setRequestProperty(WebSocketHandler.HEADER_CONNECTION, "Keep-Alive");
httpURLConnection.setRequestProperty(Headers.CACHE_CONTROL, "no-cache");
StringBuilder sb = new StringBuilder();
sb.append("multipart/form-data;boundary=");
sb.append(this.mBoundary);
httpURLConnection.setRequestProperty("Content-Type", sb.toString());
DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
Iterator it2 = this.mParts.iterator();
while (it2.hasNext()) {
Part part = (Part) it2.next();
if (part.getType() == PartType.STRING) {
dataOutputStream.write(((StringPart) part).content);
} else if (part.getType() == PartType.FILE) {
FilePart filePart = (FilePart) part;
dataOutputStream.write(filePart.head);
FileInputStream fileInputStream = new FileInputStream(filePart.file);
byte[] bArr = new byte[16384];
long j3 = 0;
while (true) {
int read = fileInputStream.read(bArr);
if (read == -1) {
break;
}
j3 += (long) read;
dataOutputStream.write(bArr, 0, read);
}
if (j3 == filePart.fileLength) {
dataOutputStream.write(filePart.end);
} else {
StringBuilder a3 = a.a("upload file's size changed: ");
a3.append(filePart.fileLength);
a3.append("->");
a3.append(j3);
throw new RuntimeException(a3.toString());
}
} else {
continue;
}
}
dataOutputStream.write(bytes);
dataOutputStream.flush();
dataOutputStream.close();
int responseCode = httpURLConnection.getResponseCode();
StringBuilder sb2 = new StringBuilder();
sb2.append("response code: ");
sb2.append(responseCode);
Log.i("MultipartUtility", sb2.toString());
if (responseCode < 400) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new BufferedInputStream(httpURLConnection.getInputStream())));
StringBuilder sb3 = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
sb3.append(readLine);
sb3.append("\n");
} else {
bufferedReader.close();
String sb4 = sb3.toString();
httpURLConnection.disconnect();
return sb4;
}
}
} else {
throw new IOException(a.a("Server response: ", responseCode));
}
}
}
| [
"cvvdnn@gmail.com"
] | cvvdnn@gmail.com |
ce8f9fbc69a01ea44b586450ab0e6cb23c6ed978 | f2e5867efc3ace3d5bce53219dabb0a95f5a14b5 | /src/main/java/com/example/pty/mode/CommentExample.java | 8ce2424b9e8d3ae3bac93a513d3d254abad8e548 | [] | no_license | gcy1070398201/PtyDemo | bb4de872fed8c57bb30bb61bbc71343bdc89e592 | 8af80cb967e7f10e81b66f827c9f51faebfbb996 | refs/heads/master | 2022-06-21T18:38:11.550169 | 2019-11-07T09:44:02 | 2019-11-07T09:44:02 | 216,979,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,941 | java | package com.example.pty.mode;
import java.util.ArrayList;
import java.util.List;
public class CommentExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public CommentExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andParentIdIsNull() {
addCriterion("parent_id is null");
return (Criteria) this;
}
public Criteria andParentIdIsNotNull() {
addCriterion("parent_id is not null");
return (Criteria) this;
}
public Criteria andParentIdEqualTo(Long value) {
addCriterion("parent_id =", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotEqualTo(Long value) {
addCriterion("parent_id <>", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThan(Long value) {
addCriterion("parent_id >", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThanOrEqualTo(Long value) {
addCriterion("parent_id >=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThan(Long value) {
addCriterion("parent_id <", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThanOrEqualTo(Long value) {
addCriterion("parent_id <=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdIn(List<Long> values) {
addCriterion("parent_id in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotIn(List<Long> values) {
addCriterion("parent_id not in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdBetween(Long value1, Long value2) {
addCriterion("parent_id between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotBetween(Long value1, Long value2) {
addCriterion("parent_id not between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("type is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("type =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("type <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("type >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("type >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("type <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("type <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("type in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("type not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("type between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andCommentatorIsNull() {
addCriterion("commentator is null");
return (Criteria) this;
}
public Criteria andCommentatorIsNotNull() {
addCriterion("commentator is not null");
return (Criteria) this;
}
public Criteria andCommentatorEqualTo(Long value) {
addCriterion("commentator =", value, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorNotEqualTo(Long value) {
addCriterion("commentator <>", value, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorGreaterThan(Long value) {
addCriterion("commentator >", value, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorGreaterThanOrEqualTo(Long value) {
addCriterion("commentator >=", value, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorLessThan(Long value) {
addCriterion("commentator <", value, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorLessThanOrEqualTo(Long value) {
addCriterion("commentator <=", value, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorIn(List<Long> values) {
addCriterion("commentator in", values, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorNotIn(List<Long> values) {
addCriterion("commentator not in", values, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorBetween(Long value1, Long value2) {
addCriterion("commentator between", value1, value2, "commentator");
return (Criteria) this;
}
public Criteria andCommentatorNotBetween(Long value1, Long value2) {
addCriterion("commentator not between", value1, value2, "commentator");
return (Criteria) this;
}
public Criteria andGmtCreateIsNull() {
addCriterion("gmt_create is null");
return (Criteria) this;
}
public Criteria andGmtCreateIsNotNull() {
addCriterion("gmt_create is not null");
return (Criteria) this;
}
public Criteria andGmtCreateEqualTo(Long value) {
addCriterion("gmt_create =", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotEqualTo(Long value) {
addCriterion("gmt_create <>", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateGreaterThan(Long value) {
addCriterion("gmt_create >", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateGreaterThanOrEqualTo(Long value) {
addCriterion("gmt_create >=", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateLessThan(Long value) {
addCriterion("gmt_create <", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateLessThanOrEqualTo(Long value) {
addCriterion("gmt_create <=", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateIn(List<Long> values) {
addCriterion("gmt_create in", values, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotIn(List<Long> values) {
addCriterion("gmt_create not in", values, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateBetween(Long value1, Long value2) {
addCriterion("gmt_create between", value1, value2, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotBetween(Long value1, Long value2) {
addCriterion("gmt_create not between", value1, value2, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtModifiedIsNull() {
addCriterion("gmt_modified is null");
return (Criteria) this;
}
public Criteria andGmtModifiedIsNotNull() {
addCriterion("gmt_modified is not null");
return (Criteria) this;
}
public Criteria andGmtModifiedEqualTo(Long value) {
addCriterion("gmt_modified =", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotEqualTo(Long value) {
addCriterion("gmt_modified <>", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedGreaterThan(Long value) {
addCriterion("gmt_modified >", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedGreaterThanOrEqualTo(Long value) {
addCriterion("gmt_modified >=", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedLessThan(Long value) {
addCriterion("gmt_modified <", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedLessThanOrEqualTo(Long value) {
addCriterion("gmt_modified <=", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedIn(List<Long> values) {
addCriterion("gmt_modified in", values, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotIn(List<Long> values) {
addCriterion("gmt_modified not in", values, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedBetween(Long value1, Long value2) {
addCriterion("gmt_modified between", value1, value2, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotBetween(Long value1, Long value2) {
addCriterion("gmt_modified not between", value1, value2, "gmtModified");
return (Criteria) this;
}
public Criteria andLikeCountIsNull() {
addCriterion("like_count is null");
return (Criteria) this;
}
public Criteria andLikeCountIsNotNull() {
addCriterion("like_count is not null");
return (Criteria) this;
}
public Criteria andLikeCountEqualTo(Integer value) {
addCriterion("like_count =", value, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountNotEqualTo(Integer value) {
addCriterion("like_count <>", value, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountGreaterThan(Integer value) {
addCriterion("like_count >", value, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountGreaterThanOrEqualTo(Integer value) {
addCriterion("like_count >=", value, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountLessThan(Integer value) {
addCriterion("like_count <", value, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountLessThanOrEqualTo(Integer value) {
addCriterion("like_count <=", value, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountIn(List<Integer> values) {
addCriterion("like_count in", values, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountNotIn(List<Integer> values) {
addCriterion("like_count not in", values, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountBetween(Integer value1, Integer value2) {
addCriterion("like_count between", value1, value2, "likeCount");
return (Criteria) this;
}
public Criteria andLikeCountNotBetween(Integer value1, Integer value2) {
addCriterion("like_count not between", value1, value2, "likeCount");
return (Criteria) this;
}
public Criteria andContentIsNull() {
addCriterion("content is null");
return (Criteria) this;
}
public Criteria andContentIsNotNull() {
addCriterion("content is not null");
return (Criteria) this;
}
public Criteria andContentEqualTo(String value) {
addCriterion("content =", value, "content");
return (Criteria) this;
}
public Criteria andContentNotEqualTo(String value) {
addCriterion("content <>", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThan(String value) {
addCriterion("content >", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThanOrEqualTo(String value) {
addCriterion("content >=", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThan(String value) {
addCriterion("content <", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThanOrEqualTo(String value) {
addCriterion("content <=", value, "content");
return (Criteria) this;
}
public Criteria andContentLike(String value) {
addCriterion("content like", value, "content");
return (Criteria) this;
}
public Criteria andContentNotLike(String value) {
addCriterion("content not like", value, "content");
return (Criteria) this;
}
public Criteria andContentIn(List<String> values) {
addCriterion("content in", values, "content");
return (Criteria) this;
}
public Criteria andContentNotIn(List<String> values) {
addCriterion("content not in", values, "content");
return (Criteria) this;
}
public Criteria andContentBetween(String value1, String value2) {
addCriterion("content between", value1, value2, "content");
return (Criteria) this;
}
public Criteria andContentNotBetween(String value1, String value2) {
addCriterion("content not between", value1, value2, "content");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table comment
*
* @mbg.generated do_not_delete_during_merge Wed Oct 23 20:40:47 CST 2019
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table comment
*
* @mbg.generated Wed Oct 23 20:40:47 CST 2019
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"gu1070398201@sina.com"
] | gu1070398201@sina.com |
9256d451d27f784c2ed4c7014a519e92959dfd90 | 07d805c6b80878f0173080c225fc9055435fb078 | /剑指Offer/src/leetcode/editor/cn/剑指Offer_13_机器人的运动范围.java | 3db07a3130a2e74f8c65139b50519a61680c4089 | [] | no_license | pxf1997/LeetCode--Algorithm | e264f1f8c966e4dcf538bb7a727b65e0f82b117f | 0077d58dbf48b37cefa095d99f29fdfa3032c9ff | refs/heads/master | 2023-07-20T06:52:08.428773 | 2021-08-31T12:15:49 | 2021-08-31T12:15:49 | 401,691,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,389 | java | /**
* 题目Id:剑指 Offer 13
* 题目:机器人的运动范围
* 日期:2021-06-16 15:16:43
*/
//地上有一个m行n列的方格,从坐标 [0,0] 到坐标 [m-1,n-1] 。一个机器人从坐标 [0, 0] 的格子开始移动,它每次可以向左、右、上、下移动一
//格(不能移动到方格外),也不能进入行坐标和列坐标的数位之和大于k的格子。例如,当k为18时,机器人能够进入方格 [35, 37] ,因为3+5+3+7=18。但
//它不能进入方格 [35, 38],因为3+5+3+8=19。请问该机器人能够到达多少个格子?
//
//
//
// 示例 1:
//
// 输入:m = 2, n = 3, k = 1
//输出:3
//
//
// 示例 2:
//
// 输入:m = 3, n = 1, k = 0
//输出:1
//
//
// 提示:
//
//
// 1 <= n,m <= 100
// 0 <= k <= 20
//
// 👍 298 👎 0
package leetcode.editor.cn;
//机器人的运动范围
public class 剑指Offer_13_机器人的运动范围 {
public static void main(String[] args) {
//测试代码
Solution solution = new 剑指Offer_13_机器人的运动范围().new Solution();
int movingCount = solution.movingCount(100, 100, 18);
System.out.println("movingCount = " + movingCount);
}
//力扣代码
//leetcode submit region begin(Prohibit modification and deletion)
// 思路--用visited数组记录到过的位置,统计位置之和
class Solution {
int m, n;
int[][] directions = new int[][]{{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
public int movingCount(int m, int n, int k) {
this.m = m;
this.n = n;
boolean[][] visited = new boolean[m][n];
dfs(0, 0, k, visited);
int cnt = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (visited[i][j]) cnt++;
}
}
return cnt;
}
// 注意--排除条件写在前面(递归终止处),四个方向递归深入时不判断
private void dfs(int i, int j, int k, boolean[][] visited) {
// 1--递归终止
// ①坐标越界 ②已经访问过 ③坐标不能通过check
if (!inArea(i, j)) return;
if (visited[i][j]) return;
if (!check(i, j, k)) return;
visited[i][j] = true;
// helper
System.out.println("到达坐标:(" + i + "," + j + ")");
// 2--递归深入--四个方向,不进行判断
for (int[] direction : directions) {
dfs(i + direction[0], j + direction[1], k, visited);
}
}
// 辅助计算函数 [35,37]--3+5+3+7=18
private boolean check(int i, int j, int k) {
return check_help(i) + check_help(j) <= k;
}
private int check_help(int x) {
int res = 0;
while (x != 0) {
res += x % 10;
x /= 10;
}
return res;
}
public boolean inArea(int x, int y) {
return x >= 0 && x < m && y >= 0 && y < n;
}
}
//leetcode submit region end(Prohibit modification and deletion)
// 这题是dfs而不是回溯,分析二者区别
// 回溯backtracking--关注的是路径,所以回退的时候需要 "复原现场"
// dfs--深度优先搜索,关注的是探索
}
| [
"1287952062@qq.com"
] | 1287952062@qq.com |
e9855bd23a5c3e4a6ae79661b049a38d7d4e688e | 6a50f96f33d4957701a2cfff216dd1854a18a4ff | /src/main/java/dy/network/hundred/service/impl/IntegralServiceImpl.java | 205e47f631303844e27f60cc332326087d8affdb | [] | no_license | bouquet12138/hundred | 79c66c52b815cc36188ccd8acd9bec287f1b0953 | bb60257eda78762048e13d886fa048ad7b92abcf | refs/heads/master | 2022-12-07T02:15:17.979217 | 2020-08-25T06:03:32 | 2020-08-25T06:03:32 | 289,230,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,271 | java | package dy.network.hundred.service.impl;
import dy.network.hundred.dao.AdminDao;
import dy.network.hundred.dao.IntegralDao;
import dy.network.hundred.dao.PayrollDao;
import dy.network.hundred.dao.UserDao;
import dy.network.hundred.java_bean.*;
import dy.network.hundred.java_bean.db_bean.AdminBean;
import dy.network.hundred.java_bean.db_bean.IntegralBean;
import dy.network.hundred.java_bean.db_bean.PayrollBean;
import dy.network.hundred.java_bean.db_bean.UserBean;
import dy.network.hundred.service.IntegraService;
import dy.network.hundred.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Service("integralService")
public class IntegralServiceImpl implements IntegraService {
@Autowired
private AdminDao adminDao;
@Autowired
private IntegralDao integralDao;
@Autowired
private PayrollDao payrollDao;
@Autowired
private UserDao userDao;
@Transactional(propagation = Propagation.REQUIRED)
public BaseBean TransferToEachOther(IntegralBean integralBean) {
BaseBean baseBean = new BaseBean();
UserBean property = userDao.findUserDataByUserId(integralBean.getUser_id());
if (property == null) {
baseBean.setMsg("用户不存在");
return baseBean;
}
UserBean targetUser = userDao.findUserDataByUserId(integralBean.getTarget_user_id());
if (targetUser == null) {
baseBean.setMsg("目标用户不存在");
return baseBean;
}
if (integralBean.getUser_id() == integralBean.getTarget_user_id()) {
baseBean.setMsg("不能给自己转账");
return baseBean;
}
log.info(integralBean.getPay_password());
property.setPay_password(MD5Utils.generateMD5(integralBean.getPay_password()));
log.info(property.toString());
log.info(property.getPay_password());
Integer isTrue = userDao.payPasswordIsTrue(property);
if (isTrue <= 0) {
baseBean.setMsg("支付密码错误");
return baseBean;
}
if (property.getIntegral_num() < integralBean.getTransaction_amount()) {
baseBean.setMsg("你的积分不足");
return baseBean;
}
boolean result = IntegerUtil.addIntegerRecord(IntegralBean.TRANSFERS_BETWEEN, -integralBean.getTransaction_amount(), integralBean.getUser_id(), integralBean.getTarget_user_id(), integralBean
.getTransaction_remark(), userDao, integralDao);
boolean result2 = IntegerUtil.addIntegerRecord(IntegralBean.TRANSFERS_BETWEEN, integralBean.getTransaction_amount(), integralBean.getTarget_user_id(), integralBean.getUser_id(), integralBean
.getTransaction_remark(), userDao, integralDao);
if (result && result2) {
baseBean.setCode(BaseBean.SUCCESS);
baseBean.setMsg("转账成功");
} else {
baseBean.setMsg("转账失败");
}
return baseBean;
}
public BaseBean<List<IntegralBean>> findIntegralDataByUid(Integer user_id) {
Integer exists = userDao.getUserExists(user_id);
BaseBean<List<IntegralBean>> baseBean = new BaseBean();
if (exists != 0) {
List<IntegralBean> integralBeans = integralDao.findIntegralDataByUid(user_id);
if (integralBeans != null && integralBeans.size() != 0) {
baseBean.setCode(BaseBean.SUCCESS);
baseBean.setMsg("信息获取成功");
baseBean.setData(integralBeans);
} else {
baseBean.setCode(BaseBean.SUCCESS);
baseBean.setMsg("信息获取成功");
}
} else {
baseBean.setMsg("用户不存在");
}
return baseBean;
}
public BaseBean<Long> findUserIntegralByUserID(Integer user_id) {
Integer exists = userDao.getUserExists(user_id);
BaseBean<Long> baseBean = new BaseBean();
if (exists != 0) {
UserBean property = userDao.getUserProperty(user_id);
baseBean.setData(Long.valueOf(property.getIntegral_num()));
baseBean.setCode(BaseBean.SUCCESS);
baseBean.setMsg("信息获取成功");
} else {
baseBean.setMsg("用户不存在");
}
return baseBean;
}
public BaseBean<Long> integralToPayroll(IntegralBean integralBean) {
BaseBean<Long> baseBean = new BaseBean();
UserBean user = userDao.findUserDataByUserId(integralBean.getUser_id());
if (user == null) {
baseBean.setMsg("用户不存在");
return baseBean;
}
user.setPay_password(MD5Utils.generateMD5(integralBean.getPay_password()));
Integer isTrue = userDao.payPasswordIsTrue(user);
if (isTrue <= 0) {
baseBean.setMsg("支付密码错误");
return baseBean;
}
int amount = (int) integralBean.getTransaction_amount();
if (user.getIntegral_num() < amount) {
baseBean.setMsg("积分不足");
return baseBean;
}
IntegerUtil.addIntegerRecord(IntegralBean.OTHER, -amount, user.getUser_id(), null, integralBean
.getTransaction_remark(), userDao, integralDao);
PayrollUtil.addPayrollRecord(PayrollBean.CONVERSION, amount, user.getUser_id(), null, "", 0, integralBean
.getTransaction_remark(), userDao, payrollDao);
baseBean.setCode(BaseBean.SUCCESS);
baseBean.setMsg("转换成功");
return baseBean;
}
@Override
public BaseBean rechargeIntegralForUser(IntegralBean integralBean) {
BaseBean baseBean = new BaseBean();
AdminBean adminBean = new AdminBean();
adminBean.setAdmin_pay_password(MD5Utils.generateMD5(integralBean.getPay_password()));
int count = adminDao.adminPayPass(adminBean);
if (count <= 0) {
baseBean.setMsg("支付密码错误");
return baseBean;
}
IntegerUtil.addIntegerRecord(IntegralBean.CONVERSION, integralBean.getTransaction_amount(), integralBean.getUser_id(),
null, integralBean
.getTransaction_remark(), userDao, integralDao);
baseBean.setCode(BaseBean.SUCCESS);//充值成功
baseBean.setMsg("充值成功");
return baseBean;
}
@Override
public BaseBean<List<IntegralBean>> getIntegralList(PageBean pageBean) {
BaseBean<List<IntegralBean>> baseBean = new BaseBean();
boolean result = PageUtil.setPageBean(pageBean, userDao);
if (!result) {
baseBean.setMsg("没有数据");
return baseBean;
}
List<IntegralBean> integralBeans = integralDao.getIntegralList(pageBean);
baseBean.setCode(BaseBean.SUCCESS);
baseBean.setMsg("信息获取成功");
baseBean.setData(integralBeans);
return baseBean;
}
}
| [
"211@qq.com"
] | 211@qq.com |
12d67dfd77f07e8e6d55da23899de3865ad3728e | ee93bb916047f812b407992cd0458786a9bacda1 | /demo/src/main/java/com/example/demo/Config/JwtRequestFilter.java | 49908c0f1841b88c15c1a4280c38541b81ad02ee | [] | no_license | 14911Ace/Auth2.0SpringBoot | d4a6376e65c2b8c64ba32ddd6092375dcc6b0a09 | 3040a51baa0f18ec38167208eaed7e99e41dfb72 | refs/heads/main | 2023-06-26T22:52:57.826045 | 2021-07-29T08:24:47 | 2021-07-29T08:24:47 | 390,653,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,258 | java | package com.example.demo.Config;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.example.demo.Service.JwtUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import io.jsonwebtoken.ExpiredJwtException;
@Component
public class JwtRequestFilter extends OncePerRequestFilter {
@Autowired
private JwtUserDetailsService jwtUserDetailsService;
@Autowired
private JwtTokenUtil jwtTokenUtil;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
final String requestTokenHeader = request.getHeader("Authorization");
String username = null;
String jwtToken = null;
// JWT Token is in the form "Bearer token". Remove Bearer word and get
// only the Token
if (requestTokenHeader != null && requestTokenHeader.startsWith("Bearer ")) {
jwtToken = requestTokenHeader.substring(7);
try {
username = jwtTokenUtil.getUsernameFromToken(jwtToken);
} catch (IllegalArgumentException e) {
System.out.println("Unable to get JWT Token");
} catch (ExpiredJwtException e) {
System.out.println("JWT Token has expired");
}
} else {
logger.warn("JWT Token does not begin with Bearer String");
}
// Once we get the token validate it.
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
UserDetails userDetails = this.jwtUserDetailsService.loadUserByUsername(username);
// if token is valid configure Spring Security to manually set
// authentication
if (jwtTokenUtil.validateToken(jwtToken, userDetails)) {
UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(
userDetails, null, userDetails.getAuthorities());
usernamePasswordAuthenticationToken
.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
// After setting the Authentication in the context, we specify
// that the current user is authenticated. So it passes the
// Spring Security Configurations successfully.
SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken);
}
}
chain.doFilter(request, response);
}
}
| [
"noreply@github.com"
] | 14911Ace.noreply@github.com |
29bc81827f24117711011e34ebaa4d95f93e9379 | 257366ced6a740705e1686be6ab801f085bc6b74 | /housematch-core/src/main/java/ca/ulaval/glo4003/housematch/taskscheduler/TaskScheduler.java | fb309240ee0f87dabad9c47841a946bf329a5f01 | [
"MIT"
] | permissive | Lorac/house-match | 1cac7096904cac0fe27dcbf6ae234e6e83633481 | ca6334008df13e4f42cf0f940df78e25c3e03394 | refs/heads/master | 2021-01-21T15:12:13.879916 | 2016-02-11T02:47:47 | 2016-02-11T02:47:47 | 47,229,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 899 | java | package ca.ulaval.glo4003.housematch.taskscheduler;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
public class TaskScheduler {
private ScheduledExecutorService scheduledExecutorService;
public TaskScheduler(final ScheduledExecutorService scheduledExecutorService, final List<TaskSchedule> taskSchedules) {
this.scheduledExecutorService = scheduledExecutorService;
scheduleTasks(taskSchedules);
}
private void scheduleTasks(List<TaskSchedule> taskSchedules) {
for (TaskSchedule taskSchedule : taskSchedules) {
scheduleTask(taskSchedule);
}
}
private void scheduleTask(TaskSchedule taskSchedule) {
scheduledExecutorService.scheduleAtFixedRate(taskSchedule.getRunnableTask(), taskSchedule.getInitialDelay(),
taskSchedule.getInterval(), taskSchedule.getTimeUnit());
}
}
| [
"o.robert@hotmail.com"
] | o.robert@hotmail.com |
145a27e859af1e5fc5cfd8d970c8dcbbdac2ccea | 675b9cc3d9f02391e0cc49ce08cc60eb25f1cba4 | /ch2/Solution08.java | 2f9b9d68ffdf0f7d8a762272f15a5119f85eaa5e | [] | no_license | Selag/CCAssignment | 4773dd3b23cce1e891c78be3450a17bd94ba7780 | 6a54c67c4a9a35f3b75c6e797d77ab14d8fc7ad1 | refs/heads/master | 2021-01-17T23:09:08.240303 | 2015-10-08T07:56:48 | 2015-10-08T07:56:48 | 42,421,640 | 0 | 0 | null | 2015-09-14T02:07:53 | 2015-09-14T02:07:53 | null | UTF-8 | Java | false | false | 1,470 | java | package LinkedLists;
import java.util.*;
import LinkedLists.Solution08.ListNode;
public class Solution08 {
/*
* 1. Maintain two pointers, one of them 2X faster than another.
* 2. When the two pointers meet, move one to the head.
* 3. Move two pointers at the same pace.
* 4. When they meet, the node is the head of circle.
*/
public static class ListNode {
ListNode next;
int val;
public ListNode(int val) {
this.val = val;
}
public String toString() {
return this.val + "";
}
}
public static ListNode detectCycle(ListNode head) {
ListNode fast = head;
ListNode slow = head;
while(fast != null&&fast.next!=null){
fast = fast.next.next;
slow = slow.next;
if(fast==slow){
fast = head;
while(fast!=slow){
slow=slow.next;
fast=fast.next;
}
return slow;
}
}
return null;
}
public static void main(String[] args) {
ListNode a = new ListNode(1);
ListNode b = new ListNode(2);
ListNode c = new ListNode(3);
ListNode d = new ListNode(4);
ListNode e = new ListNode(5);
ListNode g = new ListNode(7);
ListNode h = new ListNode(8);
a.next = b;
b.next = c;
c.next = d;
d.next = e;
e.next = g;
g.next = h;
h.next = e;
System.out.println(detectCycle(a));
}
}
| [
"zhiyulia@andrew.cmu.edu"
] | zhiyulia@andrew.cmu.edu |
a18ec9a2d259e5a7a6a3440661967add2dddd0fa | 5c2c1692afa95ef3f3947be791cb9741ab3dacd1 | /Unidade5/src/br/ufscar/si/poo/cap5/museu/ObraDeArte.java | 091cdae5337369dd61559c82e9f503ba2056ed05 | [] | no_license | delanobeder/POO-Java | d353449f04dc3e3d0be3caf77055ef049bd8da15 | 8ffb01da0173e08a3b58fbe5d775e116a52f2463 | refs/heads/master | 2021-05-27T08:20:53.053023 | 2013-11-06T15:17:57 | 2013-11-06T15:17:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package br.ufscar.si.poo.cap5.museu;
/**
* Classe ObraDeArte
*
* @author Delano Medeiros Beder
*/
public abstract class ObraDeArte implements Comparable<ObraDeArte>{
/*
* Declaração dos atributos da classe
*/
private String título, artista, material;
private int ano;
/*
* Declaração do construtor da classe
*/
public ObraDeArte(String título, String artista, String material, int ano) {
this.título = título;
this.artista = artista;
this.material = material;
this.ano = ano;
}
/*
* Declaração dos métodos da classe
*/
public abstract void imprime();
public String getTítulo() {
return título;
}
public String getArtista() {
return artista;
}
public String getMaterial() {
return material;
}
public int getAno() {
return ano;
}
@Override
public final int compareTo(ObraDeArte o) {
return título.compareTo(o.título);
}
}
| [
"delano@jequie.(none)"
] | delano@jequie.(none) |
097388545645ecef2e11e054ba5fb87c53bf8bf0 | 08c17ec05b4ed865c2b9be53f19617be7562375d | /aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/transform/FpgaDeviceInfoStaxUnmarshaller.java | fda70671264dd74fa58e318f4e450f12a641695b | [
"Apache-2.0"
] | permissive | shishir2510GitHub1/aws-sdk-java | c43161ac279af9d159edfe96dadb006ff74eefff | 9b656cfd626a6a2bfa5c7662f2c8ff85b7637f60 | refs/heads/master | 2020-11-26T18:13:34.317060 | 2019-12-19T22:41:44 | 2019-12-19T22:41:44 | 229,156,587 | 0 | 1 | Apache-2.0 | 2020-02-12T01:52:47 | 2019-12-19T23:45:32 | null | UTF-8 | Java | false | false | 3,059 | java | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.ec2.model.transform;
import javax.xml.stream.events.XMLEvent;
import javax.annotation.Generated;
import com.amazonaws.services.ec2.model.*;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;
/**
* FpgaDeviceInfo StAX Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class FpgaDeviceInfoStaxUnmarshaller implements Unmarshaller<FpgaDeviceInfo, StaxUnmarshallerContext> {
public FpgaDeviceInfo unmarshall(StaxUnmarshallerContext context) throws Exception {
FpgaDeviceInfo fpgaDeviceInfo = new FpgaDeviceInfo();
int originalDepth = context.getCurrentDepth();
int targetDepth = originalDepth + 1;
if (context.isStartOfDocument())
targetDepth += 1;
while (true) {
XMLEvent xmlEvent = context.nextEvent();
if (xmlEvent.isEndDocument())
return fpgaDeviceInfo;
if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
if (context.testExpression("name", targetDepth)) {
fpgaDeviceInfo.setName(StringStaxUnmarshaller.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("manufacturer", targetDepth)) {
fpgaDeviceInfo.setManufacturer(StringStaxUnmarshaller.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("count", targetDepth)) {
fpgaDeviceInfo.setCount(IntegerStaxUnmarshaller.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("memoryInfo", targetDepth)) {
fpgaDeviceInfo.setMemoryInfo(FpgaDeviceMemoryInfoStaxUnmarshaller.getInstance().unmarshall(context));
continue;
}
} else if (xmlEvent.isEndElement()) {
if (context.getCurrentDepth() < originalDepth) {
return fpgaDeviceInfo;
}
}
}
}
private static FpgaDeviceInfoStaxUnmarshaller instance;
public static FpgaDeviceInfoStaxUnmarshaller getInstance() {
if (instance == null)
instance = new FpgaDeviceInfoStaxUnmarshaller();
return instance;
}
}
| [
""
] | |
4954c6836fc59216dc9634d71940ab017f841f47 | 4477ae165805263ec3610506f40268fe727ebbd8 | /src/java/com/meiah/core/dao/HibernateCommonDao.java | 0c15039ccafdf9a87ad08865b22af5dc9205f42e | [] | no_license | empty1987/PatrolService_cxf_rest | cc1739747e8fcef41b839494dd04c5c86b6b68ec | 2343e9b3b78a75c3cc34d4e945111dc89529d16d | refs/heads/master | 2021-01-10T21:23:33.861368 | 2015-04-14T15:25:00 | 2015-04-14T15:25:00 | 33,939,793 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 13,466 | java | /** * A级 */
/**
*
*/
package com.meiah.core.dao;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;
/**
* 数据库访问对象类。具体模块的dao可继承此类(同时最好创建该模块接口继承ICommonDao)
*
* @author xiegh
*
*/
@SuppressWarnings("unchecked")
@Repository("hibernateCommonDao")
public class HibernateCommonDao extends HibernateDaoSupport implements
ICommonDao {
/** 声明日志通用类,使用protected以便子类也可以使用 */
protected Log log = LogFactory.getLog(getClass());
/**
* 注入sessionFactory,同时声明为私有,以便外部直接使用<code>HibernateTemplate</code>而非
* <code>SessionFactory</code>
*/
@Resource(name = "sessionFactory")
private SessionFactory _sessionFactory;
/**
* 此处添加此private方法是为了注入sessionFactory到HibernateDaoSupport中去,
* 同时为了保证此方法不被其他的方法所引用
*/
@SuppressWarnings("unused")
@PostConstruct
private void setupMySessionFactory() {
super.setSessionFactory(_sessionFactory);
}
/**
* 通过SQL查询结果集
*
* @param sql
*/
public List<?> find(String sql) throws Exception {
return super.getHibernateTemplate().find(sql);
}
/**
* 通过SQL及参数值paramValues查询符合条件的结果
*
* @param sql
* @param paramValues
*/
public List<?> find(String sql, Object... paramValues) throws Exception {
return super.getHibernateTemplate().find(sql, paramValues);
}
/**
* 通过SQL及参数值paramValues查询符合条件的结果
*
* @param sql
* @param paramNames
* @param paramValues
*/
public List<?> find(String sql, String[] paramNames, Object[] paramValues)
throws Exception {
List<?> list = super.getHibernateTemplate().findByNamedParam(sql,
paramNames, paramValues);
return list;
}
/**
* 使用hibernate配置文件中声明的name为queryName的SQL来执行查询
*
* @param queryName
*/
public List<?> findByNamedQuery(String queryName) throws Exception {
List<?> list = super.getHibernateTemplate().findByNamedQuery(queryName);
return list;
}
/**
* 使用hibernate配置文件中声明的name为queryName的SQL来执行查询。同时使用paramValues作 为此SQL中的参数值
*
* @param queryName
* @param paramValues
*/
public List<?> findByNamedQuery(String queryName, Object[] paramValues)
throws Exception {
List<?> list = super.getHibernateTemplate().findByNamedQuery(queryName,
paramValues);
return list;
}
/**
* 使用hibernate配置文件中声明的name为queryName的SQL来执行查询
*
* @param queryName
* @param paramNames
* sql中的参数名
* @param paramValues
* 参数名对应的参数值
*/
public List<?> findByNamedQuery(String queryName, String[] paramNames,
Object[] paramValues) throws Exception {
List<?> list = super.getHibernateTemplate()
.findByNamedQueryAndNamedParam(queryName, paramNames,
paramValues);
return list;
}
/**
* 使用hibernate配置文件中声明的name为queryName的SQL来执行查询
*
* @param queryName
* @param paramNames
* sql中的参数名
* @param paramValues
* 参数名对应的参数值
* @param max
* 查询的最大结果集
* @param first
* 查询的初始列
*/
public List<?> findByNamedQuery(final String queryName,
final String[] paramNames, final Object[] paramValues,
final int first, final int max) throws Exception {
List res = (List) super.getHibernateTemplate().execute(
new HibernateCallback<Object>() {
public Object doInHibernate(Session s)
throws HibernateException, SQLException {
Query q = s.getNamedQuery(queryName).setMaxResults(max)
.setFirstResult(first);
if (paramNames != null && paramNames.length > 0) {
for (int i = 0; i < paramValues.length; i++) {
q.setParameter(paramNames[i], paramValues[i]);
}
}
return q.list();
}
});
return res;
}
/**
* 保存单实体
*
* @param entity
*/
public void save(Object entity) throws Exception {
super.getHibernateTemplate().save(entity);
}
/**
* 保存或更新
*
* @param entity
*/
public void saveOrUpdate(Object entity) throws Exception {
super.getHibernateTemplate().saveOrUpdate(entity);
}
/**
* 保存或更新多个实体
*
* @param entities
*/
public void saveOrUpdateAll(Collection<?> entities) throws Exception {
super.getHibernateTemplate().saveOrUpdateAll(entities);
}
/**
* 执行此SQl,返回更新的数据库行数
*
* @return 更新的行数
*/
public int bulkUpdate(String sql) throws Exception {
int updateRows = super.getHibernateTemplate().bulkUpdate(sql);
return updateRows;
}
/**
* 执行此SQl,返回更新的数据库行数
*
* @param paramValue
* @return 更新的行数
*/
public int bulkUpdate(String sql, Object paramValue) throws Exception {
int updateRows = super.getHibernateTemplate().bulkUpdate(sql,
paramValue);
return updateRows;
}
/**
* 执行此SQl,返回更新的数据库行数
*
* @param paramValues
* @return 更新的行数
*/
public int bulkUpdate(String sql, Object[] paramValues) throws Exception {
int updateRows = super.getHibernateTemplate().bulkUpdate(sql,
paramValues);
return updateRows;
}
/**
* 执行增删改的HQL
*
* @param hql
*/
public int executeBySQL(final String hql){
return executeBySQL(hql, null, null);
}
/**
* 执行增删改的HQL
*
* @param hql
* @param paramNames
* @param paramValues
*/
public int executeBySQL(final String hql, final String[] paramNames,
final Object[] paramValues) {
int effectRows = super.getHibernateTemplate().execute(new HibernateCallback<Integer>() {
public Integer doInHibernate(Session s) throws HibernateException,
SQLException {
org.hibernate.Query query = s.createQuery(hql);
if (paramNames != null && paramNames.length > 0) {
for (int i = 0; i < paramNames.length; i++) {
// 在update-delete等情况下,hibernate无法自动识别List类型参数,故此处手工添加识别条件。 modified by xiegh,2012/10/23
if(Collection.class.isAssignableFrom(paramValues[i].getClass())) {
query.setParameterList(paramNames[i], (Collection)paramValues[i]);
} else {
query.setParameter(paramNames[i], paramValues[i]);
}
}
}
return query.executeUpdate();
}
});
return effectRows;
}
/**
* find entities by criteria
*
* @param criteria
*/
public List<?> findByCriteria(DetachedCriteria criteria) throws Exception {
List<?> list = super.getHibernateTemplate().findByCriteria(criteria);
return list;
}
/**
* find entities by criteria
*
* @param criteria
* @param firstResult
* @param maxResults
* @return
* @throws Exception
*/
public List<?> findByCriteria(DetachedCriteria criteria, int firstResult,
int maxResults) throws Exception {
List<?> list = super.getHibernateTemplate().findByCriteria(criteria,
firstResult, maxResults);
return list;
}
/**
* get an entity
*
* @param clazz
* @param id
*/
public Object get(Class<?> clazz, Serializable id) throws Exception {
return super.getHibernateTemplate().get(clazz, id);
}
/**
* load an entity
*
* @param clazz
* @param id
*/
public Object load(Class<?> clazz, Serializable id) throws Exception {
return super.getHibernateTemplate().load(clazz, id);
}
/**
* 删除某个实体
*
* @param entity
* @throws Exception
*/
public void delete(Object entity) throws Exception {
super.getHibernateTemplate().delete(entity);
}
/**
* 删除多个实体
*
* @param entities
* @throws Exception
*/
public void deleteAll(Collection<?> entities) throws Exception {
super.getHibernateTemplate().deleteAll(entities);
}
/**
* 按此实体的属性做匹配搜索符合条件的实体
*
* @param example
* 待匹配的实体及其属性值;需注意对外键及主键
* @return
* @throws Exception
*/
public List<?> findByExample(Object example) throws Exception {
return super.getHibernateTemplate().findByExample(example);
}
/**
* 从指定起始位置开始查询指定个数的结果集
*
* @param hql
* 使用的查询语句
* @param maxRes
* 查询的最大结果集
* @param first
* 查询的起始位置
* @return
* @throws Exception
*/
public List<?> find(String hql, int maxRes, int first) throws Exception {
return find(hql, maxRes, first, new Object[0]);
}
/**
* 从指定起始位置开始查询指定个数的结果集
*
* @param hql
* @param maxRes
* @param first
* @return
* @throws Exception
*/
public List<?> find(final String hql, final int maxRes, final int first,
final Object... pvalues) throws Exception {
return super.getHibernateTemplate().executeFind(
new HibernateCallback() {
public List<?> doInHibernate(Session session)
throws HibernateException, SQLException {
org.hibernate.Query query = session.createQuery(hql);
if (first >= 0)// 设置初始
query.setFirstResult(first);
if (maxRes >= 0)// 设置最大抓取
query.setMaxResults(maxRes);
// 填充参数
if (pvalues != null && pvalues.length > 0) {
for (int i = 0; i < pvalues.length; i++) {
query.setParameter(i, pvalues[i]);
}
}
return query.list();
}
});
}
/**
* 从指定起始位置开始查询指定个数的结果集
*
* @param hql
* @param maxRes
* @param first
* @return
* @throws Exception
*/
public List<?> find(final String hql, final int maxRes, final int first,
final String[] pnames, final Object[] pvalues) throws Exception {
return super.getHibernateTemplate().executeFind(
new HibernateCallback() {
public List<?> doInHibernate(Session session)
throws HibernateException, SQLException {
org.hibernate.Query query = session.createQuery(hql);
if (first >= 0)// 设置初始
query.setFirstResult(first);
if (maxRes >= 0)// 设置最大抓取
query.setMaxResults(maxRes);
// 填充参数
if (pnames != null && pnames.length > 0) {
for (int i = 0; i < pnames.length; i++) {
query.setParameter(pnames[i], pvalues[i]);
}
}
return query.list();
}
});
}
/**
* 使用原生SQL执行查询
*
* @param sql
* @param pnames
* @param pvalues
* @param first
* @param max
* @return
*/
public List<?> findUsingNativeSQL(final String sql, final String[] pnames,
final Object[] pvalues, final int first, final int max) {
return super.getHibernateTemplate().executeFind(
new HibernateCallback() {
public List<?> doInHibernate(Session session)
throws HibernateException, SQLException {
org.hibernate.SQLQuery query = session
.createSQLQuery(sql);
if (first >= 0)// 设置初始
query.setFirstResult(first);
if (max >= 0)// 设置最大抓取
query.setMaxResults(max);
// 填充参数
if (pnames != null && pnames.length > 0) {
for (int i = 0; i < pnames.length; i++) {
query.setParameter(pnames[i], pvalues[i]);
}
}
return query.list();
}
});
}
/**
* 执行原生SQL
*
* @param sql
* @param names
* @param pvalues
*/
public void executeUsingNativeSQL(final String sql, final String[] pnames,
final Object[] pvalues) {
super.getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
org.hibernate.SQLQuery query = session.createSQLQuery(sql);
// 填充参数
if (pnames != null && pnames.length > 0) {
for (int i = 0; i < pnames.length; i++) {
query.setParameter(pnames[i], pvalues[i]);
}
}
return query.executeUpdate();
}
});
}
/**
* 如果提供通用方法无法满足需求时,允许披露此数据库操作模板类给接口。
*
* @return
*/
public HibernateTemplate usingHibernateTemplate() {
return super.getHibernateTemplate();
}
}
| [
"471520384@qq.com"
] | 471520384@qq.com |
476f56513a848f5e2c0d3ed079849efc0d9d4f35 | 95e76c7c1840c64c34e403dfa6ce08fdcd117a75 | /src/main/java/Main.java | eef7f27f0b31893ceaaabe7246914ac8355fe111 | [] | no_license | him0/BimsSOnBrowser | f38bc354cd1e0faa72fff3c4c7ac4355bf44bc9e | 5ba17a6fc64edfc7e2c2db54e9cdb46a64c0162d | refs/heads/master | 2021-01-17T14:51:23.323139 | 2016-06-23T16:16:08 | 2016-06-23T16:16:08 | 52,154,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | import static spark.Spark.*;
import BimsS.*;
public class Main {
public static void main(String[] args) {
try {
get("/api", "application/json", (request, response) ->{
response.header(
"Access-Control-Allow-Origin",
"*" );
String code = request.queryParams("code");
System.out.println(code);
Interpret i = new Interpret();
String out = i.exec(code);
System.out.println(out);
return out;
});
} catch(Exception e) {
}
}
}
| [
"nakashimaorz@gmail.com"
] | nakashimaorz@gmail.com |
64825eadc1b0727db4bd8bb4b4d2834cbfd988f7 | c3b78178cce0e0cb4dde02a60d37dbf507f9cd02 | /springboot-jwt/src/main/java/cn/aleestar/mapper/UserMapper.java | 9e06f23f7a171ad2f33c6474599d2c08a8661811 | [] | no_license | lee-xs/springboot-learn | 00dd0376b99bfbfa1ea327d3ff81912a235edf7e | ab54a8a703e416baacad05fe6207695bff46c43d | refs/heads/master | 2022-12-22T20:37:26.345484 | 2020-05-29T07:32:02 | 2020-05-29T07:32:02 | 203,687,728 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | package cn.aleestar.mapper;
import cn.aleestar.dto.User;
import tk.mybatis.mapper.common.Mapper;
public interface UserMapper extends Mapper<User> {
}
| [
"52110919@qq.com"
] | 52110919@qq.com |
fc5690a62161203dd4e06dbf13a40a76b15cd83f | 370c42ea4e92835e0a25e5cf2a5e7bc65c6f525f | /8pm_13agosto2018_1/src/principal/Programa.java | 25bc48b241d66ef5abc9590d141fb5baf172ca19 | [] | no_license | Camilomf321/PAGrupo3SII2018 | 49069ccc1cd590bd54539060b248f14aaa0b7212 | 296aa3e648f84bb76d9df2f4f0516b8d8369d5e9 | refs/heads/master | 2020-04-21T11:00:54.312250 | 2018-11-16T21:02:34 | 2018-11-16T21:02:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package principal;
public class Programa {
public static void main(String[] args) {
int ivar1 = 100;
int ivar2 = 32432423;
short svar1 = (short)ivar1;
short svar2 = (short)ivar2;
float fvar1 = 100.02f;
int ivar3 = (int)fvar1;
System.out.println(svar1); //conversion x casting entre variables primitivas
System.out.println(ivar3);
}
}
| [
"ohnivia@gmail.com"
] | ohnivia@gmail.com |
a3c21b454a02c5f4347d935321ad2538f2e530ba | 3c7145a5fb38c3bbc84e38743721600a49c28a24 | /ajedrez/src/ajedrez/Principal.java | 902c365860f7d6df7831c7025de8a3534be6abdf | [] | no_license | miguellperezzv/POO | 3c4dc40646bc06f6eb37e447dfc70149ce2462a5 | 8368c221745d5c2957f3b558aeb03b2bee0fa755 | refs/heads/master | 2021-05-18T12:26:21.751230 | 2020-03-30T11:17:22 | 2020-03-30T11:17:22 | 251,242,795 | 0 | 0 | null | 2020-03-30T09:32:48 | 2020-03-30T08:17:25 | Java | UTF-8 | Java | false | false | 9,996 | java | package ajedrez;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
public class Principal extends JFrame implements ActionListener{
JMenuBar mb = new JMenuBar();
JMenu menu1 = new JMenu("OPCIONES");
JMenuItem rey = new JMenuItem("Posicion Rey");
JMenuItem caballo = new JMenuItem("Posicion Caballo");
JMenuItem reina = new JMenuItem("Posicion Reina");
JMenuItem jaque = new JMenuItem("JAQUE");
JMenuItem pintar = new JMenuItem("Pintar");
JTextField txtx = new JTextField();
JTextField txty = new JTextField();
Graphics g = getGraphics();
Reina todos = new Reina();
int[][] tablero = new int [8][8];
Image reyimg = Toolkit.getDefaultToolkit().getImage("./img/rey.jpg");
Image caballoimg = Toolkit.getDefaultToolkit().getImage("./img/caballo.jpg");
Image reinaimg = Toolkit.getDefaultToolkit().getImage("./img/reina.jpg");
int[][] pos = new int[2][3];
Principal(){
Container c=this.getContentPane();
c.add(txtx);
c.add(txty);
//c.add(subx);
txtx.setBounds(30, 60, 50, 40);
txty.setBounds(80, 60, 50, 40);
setLayout(null);
setJMenuBar(mb);
mb.add(menu1);
rey.addActionListener(this);
caballo.addActionListener(this);
reina.addActionListener(this);
menu1.add(rey);
menu1.add(caballo);
menu1.add(reina);
menu1.add(jaque);
menu1.add(pintar);
jaque.addActionListener(this);
pintar.addActionListener(this);
}
public void paintComponent (Graphics g) {
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Principal m = new Principal();
m.setSize(700, 700);
m.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
Graphics g = getGraphics();
String txt1 = txtx.getText();
String txt2 = txty.getText();
int error = 0;
for(int i=0; i<txt1.length();i++) {
if(txt1.charAt(i)<'0' ||txt2.charAt(i)>'9'|| txtx.getText().isEmpty()||txty.getText().isEmpty()) {
error=0;
}
else {
if(Integer.parseInt(txt1)>8||Integer.parseInt(txt2)>8||Integer.parseInt(txt1)<1||Integer.parseInt(txt2)<1) {
error=2;
}
else {
error=1;
}
}
}
if(arg0.getSource()==rey) {
if (error==0) {
JOptionPane.showMessageDialog(null, "Ingrese valores válidos");
}
else if (error==2) {
JOptionPane.showMessageDialog(null, "solo numeros entre 1 y 8");
}
else {
pos[0][0]=Integer.parseInt(txtx.getText());
pos[1][0]=Integer.parseInt(txty.getText());
}
}
if(arg0.getSource()==caballo) {
if (error==0) {
JOptionPane.showMessageDialog(null, "Ingrese valores válidos");
}
else if (error==2) {
JOptionPane.showMessageDialog(null, "solo numeros entre 1 y 8");
}
else {
pos[0][1]=Integer.parseInt(txtx.getText());
pos[1][1]=Integer.parseInt(txty.getText());
}
}
if(arg0.getSource()==reina) {
tablero=new int[8][8];
if (error==0) {
JOptionPane.showMessageDialog(null, "Ingrese valores válidos");
}
else if (error==2) {
JOptionPane.showMessageDialog(null, "solo numeros entre 1 y 8");
}
else {
pos[0][2]=Integer.parseInt(txtx.getText());
pos[1][2]=Integer.parseInt(txty.getText());
}
}
if(arg0.getSource()==pintar) {
int xf=100;
int yf=200;
g.clearRect(1, 200, 500, 500);
todos = new Reina(pos[0][0],pos[1][0],pos[0][1],pos[1][1],pos[0][2],pos[1][2]);
//getContentPane().add(subx);
g.drawRect(xf, yf, 400, 400);
for(int i=1;i<8;i++) {
g.drawLine(xf+(i*50), yf, xf+(i*50), yf+ 400);
g.drawLine(xf, yf+(i*50), xf+400, yf+ (i*50));
}
/*
g.drawString("K", xf+(todos.xk-1)*50, 600-(todos.yk-1)*50);
g.drawString("Q", xf+(todos.qx-1)*50, 600-(todos.qy-1)*50);
g.drawString("H", xf+(todos.hx-1)*50, 600-(todos.hy-1)*50);
*/
g.drawImage(reyimg,xf+(todos.xk-1)*50, 600-(todos.yk)*50, this);
g.drawImage(reinaimg,xf+(todos.qx-1)*50, 600-(todos.qy)*50, this);
g.drawImage(caballoimg,xf+(todos.hx-1)*50, 600-(todos.hy)*50, this);
}
if(arg0.getSource()==jaque) {
tablero=new int[8][8];
int contx=pos[0][1]-1;
int conty=pos[1][1]-1;
if(contx+2>7||contx+2<0||conty+1>7||conty+1<0) {}
else {tablero[contx+2][conty+1]=1;}
if(contx+1<0 ||contx+1>7|| conty+2<0|| conty+2>7) {}
else {tablero[contx+1][conty+2]=1;}
if(contx-1>7|| contx-1<0|| conty-2>7|| conty-2<0) {}
else {tablero[contx-1][conty-2]=1;}
if(contx-2>7|| contx-2<0|| conty-1>7|| conty-1<0) {}
else {tablero[contx-2][conty-1]=1;}
if(contx-2>7|| contx-2<0|| conty+1>7|| conty+1<0) {}
else {tablero[contx-2][conty+1]=1;}
if(contx+2>7|| contx+2<0|| conty-1>7|| conty-1<0) {}
else {tablero[contx+2][conty-1]=1;}
if(contx-1>7|| contx-1<0|| conty+2>7|| conty+2<0) {}
else {tablero[contx-1][conty+2]=1;}
if(contx+1>7|| contx+1<0|| conty-2>7|| conty-2<0) {}
else {tablero[contx+1][conty-2]=1;}
tablero[contx][conty]=3;
contx=pos[0][2]-1;
conty=pos[1][2]-1;
int cont=0;
tablero[contx][conty]=5;
while(contx+cont<=7 ||(contx==pos[0][1]&&conty==pos[1][1])) {
tablero[contx+cont][conty]=1;
cont++;
}
cont=0;
while(contx-cont>=0||(contx==pos[0][1]&&conty==pos[1][1])) {
tablero[contx-cont][conty]=1;
cont++;
}
cont=0;
while(conty+cont<=7||(contx==pos[0][1]&&conty==pos[1][1])) {
tablero[contx][conty+cont]=1;
cont++;
}
cont=0;
while(conty-cont>=0||(contx==pos[0][1]&&conty==pos[1][1])) {
tablero[contx][conty-cont]=1;
cont++;
}
cont=0;
while(conty+cont<=7&&contx+cont<=7||(contx==pos[0][1]&&conty==pos[1][1])) {
tablero[contx+cont][conty+cont]=1;
cont++;
}
cont=0;
while(contx-cont>=0&&conty+cont<=7||(contx==pos[0][1]&&conty==pos[1][1])) {
tablero[contx-cont][conty+cont]=1;
cont++;
}
cont=0;
while(contx+cont<=7&&conty-cont>=0||(contx==pos[0][1]&&conty==pos[1][1])) {
tablero[contx+cont][conty-cont]=1;
cont++;
}
cont=0;
while(contx-cont>=0&&conty-cont>=0||(contx==pos[0][1]&&conty==pos[1][1])) {
tablero[contx-cont][conty-cont]=1;
cont++;
}
/*
* eliminar unos en relacion cab reina
*/
if((pos[0][2]<pos[0][1])&&(pos[1][1]==pos[1][2])){
for(int i=pos[0][1];i<8;i++){
tablero[i-1][pos[1][1]-1]=0;
}
}
if((pos[0][2]>pos[0][1])&&(pos[1][1]==pos[1][2])){
for(int i=pos[0][1];i>0;i--){
tablero[i-1][pos[1][1]-1]=0;
}
}
if((pos[1][2]<pos[1][1])&&(pos[0][1]==pos[0][2])){
for(int i=pos[1][1];i<8;i++){
tablero[pos[0][1]-1][i-1]=0;
}
}
if((pos[1][2]>pos[1][1])&&(pos[0][1]==pos[0][2])){
for(int i=pos[1][1];i>0;i--){
tablero[pos[0][1]-1][i-1]=0;
}
}
int cont2=0;
if(todos.qx-todos.hx==todos.qy-todos.hy&&todos.qx-todos.hx>0) {
cont=0;
contx=todos.hx-1;
conty=todos.hy-1;
while(contx-cont>=0&&conty-cont>=0) {
tablero[contx-cont][conty-cont]=0;
cont++;
}
}
if(todos.qx-todos.hx==todos.qy-todos.hy&&todos.qx-todos.hx<0) {
cont=0;
contx=todos.hx-1;
conty=todos.hy-1;
while(contx+cont<8&&conty+cont<8) {
tablero[contx+cont][conty+cont]=0;
cont++;
}
}
for(int i=7; i>=0;i--){
for(int j=0; j<8;j++){
System.out.print(tablero[j][i]+" ");
}
System.out.print("\n");
}
System.out.print("\n");
if(tablero[pos[0][0]-1][pos[1][0]-1]==1) {
contx=pos[0][0]-1;
conty=pos[1][0]-1;
int movreales=0; //cuantos espacios tiene alrededor
int posib=0; //posibles espacios sin 1
System.out.print(contx+" "+conty);
if(contx+1<8&&conty+1<8) {
movreales++;
if(tablero[contx+1][conty+1]==1) {
posib++;
}
}
if(contx+1<8&&conty<8) {
movreales++;
if(tablero[contx+1][conty]==1) {
posib++;
}
}
if(contx+1<8&&conty-1>=0) {
movreales++;
if(tablero[contx+1][conty-1]==1) {
posib++;
}
}
if(contx<8&&conty-1>=0) {
movreales++;
if(tablero[contx][conty-1]==1) {
posib++;
}
}
if(contx-1>=0&&conty-1>=0) {
movreales++;
if(tablero[contx-1][conty-1]==1) {
posib++;
}
}
if(contx-1>=0&&conty>=0) {
movreales++;
if(tablero[contx-1][conty]==1) {
posib++;
}
}
if(contx<8&&conty+1<8) {
movreales++;
if(tablero[contx][conty+1]==1) {
posib++;
}
}
if(contx+1<8&&conty-1>=0) {
movreales++;
if(tablero[contx+1][conty-1]==1) {
posib++;
}
}
System.out.print("\nmovreales ="+movreales+"\nposib ="+posib+"\n");
if(movreales==posib) {
JOptionPane.showMessageDialog(null, "AHOGADO");
}
else if (posib>=1){
JOptionPane.showMessageDialog(null, "ESTÁ EN JAQUE");
}
}
else {
JOptionPane.showMessageDialog(null, "NO ESTA EN JAQUE");
}
}
}
} | [
"noreply@github.com"
] | miguellperezzv.noreply@github.com |
71e980dbdbcba536452557834ac2e5dd9ef7e45b | 243c674bce7ceb91ecf031f83bcef2dd6faa3a35 | /controller/src/main/java/io/pravega/controller/store/stream/ZkOrderedStore.java | b4b3b0adb694f3f3bc83b8b62de208c861e59874 | [
"Apache-2.0"
] | permissive | huide9/pravega | d6c5b3b2c2800ce3a44821099229982ffea68d43 | 6fa9e55ae17e8e94defdcd62eb9c7a001e489172 | refs/heads/master | 2020-03-18T05:07:37.189464 | 2019-06-17T15:57:50 | 2019-06-17T15:58:14 | 134,326,168 | 0 | 0 | Apache-2.0 | 2019-02-14T23:55:27 | 2018-05-21T21:16:31 | Java | UTF-8 | Java | false | false | 18,884 | java | /**
* Copyright (c) 2017 Dell Inc., or its subsidiaries. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
package io.pravega.controller.store.stream;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Charsets;
import io.pravega.common.Exceptions;
import io.pravega.common.concurrent.Futures;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.curator.utils.ZKPaths;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.stream.Collectors;
import static io.pravega.controller.store.stream.ZKStreamMetadataStore.DATA_NOT_FOUND_PREDICATE;
/**
* This class is used to store ordered objects on a per stream basis.
* It uses Persistent Sequential znodes to create ordered collection of entries.
* New entities can be added and existing entities can be removed from these ordered collections.
* All entities from the collection can be viewed and ordered based on the given order (a long).
*
* Since we use Persistent Sequential znodes to assign order, we can exhaust the order space which is basically 10 digits
* (Integer.Max). So this store creates multiple ordered collection of collections and is responsible for internally
* creating and progressing new collections once a previous collection is exhausted.
* Overall we can create Integer.Max new collections. This means overall we have approximately Long.Max entries that
* each ordered collection can support in its lifetime.
*/
@Slf4j
class ZkOrderedStore {
private static final String COLLECTIONS_NODE = "collections";
private static final String SEALED_NODE = "sealed";
private static final String ENTITIES_NODE = "entities";
private static final String POSITION_NODE = "pos";
private final ZKStoreHelper storeHelper;
private final String ordererName;
private final Executor executor;
private final int rollOverAfter;
/**
* This class creates a collection of collections starting with collection numbered 0.
* A new collection is created under the znode:
* \<root\>/scope/stream/collections\<collectionNum\>/entities
* It adds entries to lowest numbered collection using a persistent sequential znode
* until its capacity is exhausted.
* Once a collection is exhausted, a successor collection with number `current + 1` is created and current successor
* is marked as sealed by created following znode:
* `\<root\>/scope/stream/collections\<collectionNum\>/sealed
* @param ordererName name of ordered which is used to generate the `root` of the orderer
* @param storeHelper store helper
* @param executor executor
*/
ZkOrderedStore(String ordererName, ZKStoreHelper storeHelper, Executor executor) {
// default roll over is after 90% or 1.8 billion entries have been added to a collection.
this(ordererName, storeHelper, executor, (Integer.MAX_VALUE / 10) * 9);
}
@VisibleForTesting
ZkOrderedStore(String ordererName, ZKStoreHelper storeHelper, Executor executor, int rollOverAfter) {
this.ordererName = ordererName;
this.storeHelper = storeHelper;
this.executor = executor;
this.rollOverAfter = rollOverAfter;
}
/**
* Method to add new entity to the ordered collection. Note: Same entity could be added to the collection multiple times.
* Entities are added to the latest collection for the stream. If the collection has exhausted positions allowed for by rollOver limit,
* a new successor collection is initiated and the entry is added to the new collection.
* Any entries with positions higher than rollover values under a set are ignored and eventually purged.
*
* @param scope scope
* @param stream stream
* @param entity entity to add
* @return CompletableFuture which when completed returns the position where the entity is added to the set.
*/
CompletableFuture<Long> addEntity(String scope, String stream, String entity) {
// add persistent sequential node to the latest collection number
// if collectionNum is sealed, increment collection number and write the entity there.
return getLatestCollection(scope, stream)
.thenCompose(latestcollectionNum ->
storeHelper.createPersistentSequentialZNode(getEntitySequentialPath(scope, stream, latestcollectionNum),
entity.getBytes(Charsets.UTF_8))
.thenCompose(positionPath -> {
int position = getPositionFromPath(positionPath);
if (position > rollOverAfter) {
// if newly created position exceeds rollover limit, we need to delete that entry
// and roll over.
// 1. delete newly created path
return storeHelper.deletePath(positionPath, false)
// 2. seal latest collection
.thenCompose(v -> storeHelper.createZNodeIfNotExist(
getCollectionSealedPath(scope, stream, latestcollectionNum)))
// 3. call addEntity recursively
.thenCompose(v -> addEntity(scope, stream, entity))
// 4. delete empty sealed collection path
.thenCompose(orderedPosition ->
tryDeleteSealedCollection(scope, stream, latestcollectionNum)
.thenApply(v -> orderedPosition));
} else {
return CompletableFuture.completedFuture(Position.toLong(latestcollectionNum, position));
}
}))
.whenComplete((r, e) -> {
if (e != null) {
log.error("error encountered while trying to add entity {} for stream {}/{}", entity, scope, stream, e);
} else {
log.debug("entity {} added for stream {}/{} at position {}", entity, scope, stream, r);
}
});
}
/**
* Method to remove entities from the ordered set. Entities are referred to by their position pointer.
* @param scope scope
* @param stream stream
* @param entities list of entities' positions to remove
* @return CompletableFuture which when completed will indicate that entities are removed from the set.
*/
CompletableFuture<Void> removeEntities(String scope, String stream, Collection<Long> entities) {
Set<Integer> collections = entities.stream().collect(Collectors.groupingBy(x -> new Position(x).collectionNumber)).keySet();
return Futures.allOf(entities.stream()
.map(entity -> storeHelper.deletePath(getEntityPath(scope, stream, entity), false))
.collect(Collectors.toList()))
.thenCompose(v -> Futures.allOf(
collections.stream().map(collectionNum -> isSealed(scope, stream, collectionNum)
.thenCompose(sealed -> {
if (sealed) {
return tryDeleteSealedCollection(scope, stream, collectionNum);
} else {
return CompletableFuture.completedFuture(null);
}
})).collect(Collectors.toList())))
.whenComplete((r, e) -> {
if (e != null) {
log.error("error encountered while trying to remove entity positions {} for stream {}/{}", entities, scope, stream, e);
} else {
log.debug("entities at positions {} removed for stream {}/{}", entities, scope, stream);
}
});
}
/**
* Returns a map of position to entity that was added to the set.
* Note: Entities are ordered by position in the set but the map responded from this api is not ordered by default.
* Users can filter and order elements based on the position and entity id.
* @param scope scope scope
* @param stream stream stream
* @return CompletableFuture which when completed will contain all positions to entities in the set.
*/
CompletableFuture<Map<Long, String>> getEntitiesWithPosition(String scope, String stream) {
Map<Long, String> result = new ConcurrentHashMap<>();
return Futures.exceptionallyExpecting(storeHelper.getChildren(getCollectionsPath(scope, stream)), DATA_NOT_FOUND_PREDICATE, Collections.emptyList())
.thenCompose(children -> {
// start with smallest collection and collect records
List<Integer> iterable = children.stream().map(Integer::parseInt).collect(Collectors.toList());
return Futures.loop(iterable, collectionNumber -> {
return Futures.exceptionallyExpecting(storeHelper.getChildren(getEntitiesPath(scope, stream, collectionNumber)),
DATA_NOT_FOUND_PREDICATE, Collections.emptyList())
.thenCompose(entities -> Futures.allOf(
entities.stream().map(x -> {
int pos = getPositionFromPath(x);
return storeHelper.getData(getEntityPath(scope, stream, collectionNumber, pos),
m -> new String(m, Charsets.UTF_8))
.thenAccept(r -> {
result.put(Position.toLong(collectionNumber, pos),
r.getObject());
});
}).collect(Collectors.toList()))
).thenApply(v -> true);
}, executor);
}).thenApply(v -> result)
.whenComplete((r, e) -> {
if (e != null) {
log.error("error encountered while trying to retrieve entities for stream {}/{}", scope, stream, e);
} else {
log.debug("entities at positions {} retrieved for stream {}/{}", r, scope, stream);
}
});
}
private String getStreamPath(String scope, String stream) {
String scopePath = ZKPaths.makePath(ordererName, scope);
return ZKPaths.makePath(scopePath, stream);
}
private String getCollectionsPath(String scope, String stream) {
return ZKPaths.makePath(getStreamPath(scope, stream), COLLECTIONS_NODE);
}
private String getCollectionPath(String scope, String stream, int collectionNum) {
return ZKPaths.makePath(getCollectionsPath(scope, stream), Integer.toString(collectionNum));
}
private String getCollectionSealedPath(String scope, String stream, Integer collectionNum) {
return ZKPaths.makePath(getCollectionPath(scope, stream, collectionNum), SEALED_NODE);
}
private String getEntitiesPath(String scope, String stream, Integer collectionNum) {
return ZKPaths.makePath(getCollectionPath(scope, stream, collectionNum), ENTITIES_NODE);
}
private String getEntitySequentialPath(String scope, String stream, Integer collectionNum) {
return ZKPaths.makePath(getEntitiesPath(scope, stream, collectionNum), POSITION_NODE);
}
private String getEntityPath(String scope, String stream, int collectionNumber, int position) {
return String.format("%s%010d", getEntitySequentialPath(scope, stream, collectionNumber), position);
}
private String getEntityPath(String scope, String stream, long entity) {
Position position = new Position(entity);
return getEntityPath(scope, stream, position.collectionNumber, position.positionInCollection);
}
private int getPositionFromPath(String name) {
return Integer.parseInt(name.substring(name.length() - 10));
}
private CompletableFuture<Integer> getLatestCollection(String scope, String stream) {
return storeHelper.getChildren(getCollectionsPath(scope, stream))
.thenCompose(children -> {
int latestcollectionNum = children.stream().mapToInt(Integer::parseInt).max().orElse(0);
return storeHelper.checkExists(getCollectionSealedPath(scope, stream, latestcollectionNum))
.thenCompose(sealed -> {
if (sealed) {
return storeHelper.createZNodeIfNotExist(
getCollectionPath(scope, stream, latestcollectionNum + 1))
.thenApply(v -> latestcollectionNum + 1);
} else {
return CompletableFuture.completedFuture(latestcollectionNum);
}
});
});
}
/**
* Collection should be sealed while calling this method
* @param scope scope
* @param stream stream
* @param collectionNum collection to delete
* @return future which when completed will have the collection deleted if it is empty or ignored otherwise.
*/
private CompletableFuture<Void> tryDeleteSealedCollection(String scope, String stream, Integer collectionNum) {
// purge garbage znodes
// attempt to delete entities node
// delete collection
return getLatestCollection(scope, stream)
.thenCompose(latestcollectionNum ->
// 1. purge
storeHelper.getChildren(getEntitiesPath(scope, stream, collectionNum))
.thenCompose(entitiesPos -> {
String entitiesPath = getEntitiesPath(scope, stream, collectionNum);
// delete entities greater than max pos
return Futures.allOf(entitiesPos.stream().filter(pos -> getPositionFromPath(pos) > rollOverAfter)
.map(pos -> storeHelper.deletePath(ZKPaths.makePath(entitiesPath, pos), false))
.collect(Collectors.toList()));
}))
.thenCompose(x -> {
// 2. Try deleting entities root path.
// if we are able to delete entities node then we can delete the whole thing
return Futures.exceptionallyExpecting(storeHelper.deletePath(getEntitiesPath(scope, stream, collectionNum), false)
.thenCompose(v -> storeHelper.deleteTree(getCollectionPath(scope, stream, collectionNum))),
e -> Exceptions.unwrap(e) instanceof StoreException.DataNotEmptyException, null);
});
}
@VisibleForTesting
CompletableFuture<Boolean> isSealed(String scope, String stream, int collectionNum) {
return Futures.exceptionallyExpecting(storeHelper.getData(getCollectionSealedPath(scope, stream, collectionNum), x -> x).thenApply(v -> true),
e -> Exceptions.unwrap(e) instanceof StoreException.DataNotFoundException, false);
}
@VisibleForTesting
CompletableFuture<Boolean> isDeleted(String scope, String stream, int collectionNum) {
return Futures.exceptionallyExpecting(storeHelper.getData(getCollectionPath(scope, stream, collectionNum), x -> x).thenApply(v -> false),
e -> Exceptions.unwrap(e) instanceof StoreException.DataNotFoundException, true);
}
@VisibleForTesting
CompletableFuture<Boolean> positionExists(String scope, String stream, long position) {
return Futures.exceptionallyExpecting(storeHelper.getData(getEntityPath(scope, stream, position), x -> x).thenApply(v -> true),
e -> Exceptions.unwrap(e) instanceof StoreException.DataNotFoundException, false);
}
@Data
@AllArgsConstructor
@VisibleForTesting
static class Position {
private final int collectionNumber;
private final int positionInCollection;
public Position(long position) {
this.collectionNumber = (int) (position >> 32);
this.positionInCollection = (int) position;
}
static long toLong(int collectionNumber, int positionInCollection) {
return (long) collectionNumber << 32 | (positionInCollection & 0xFFFFFFFFL);
}
}
}
| [
"fpj@users.noreply.github.com"
] | fpj@users.noreply.github.com |
2359a6ee528564bcb171122c678576cc3f0db5bf | d9952aa5097ea9e3125d4adbdad7d3bb1df53f34 | /9831066_MohammadMahdi_Nemati_Haravani/Session3/Music/src/Run.java | 2351dd846afe062e02299e6446a2c1db1fbb1205 | [] | permissive | mohammadmahdi255/workshop-1 | 05e024dd27993b083815430d24ac77151fda29fd | 825b5bc3b1c7a17477a181198109d101157b2405 | refs/heads/master | 2023-02-07T06:03:19.985601 | 2020-04-24T10:26:29 | 2020-04-24T10:26:29 | 250,034,328 | 0 | 0 | MIT | 2020-03-25T16:40:16 | 2020-03-25T16:40:15 | null | UTF-8 | Java | false | false | 1,632 | java | public class Run {
public static void main(String[] args) {
MusicCollection[] musicCollection = new MusicCollection[4];
musicCollection[0] = new MusicCollection("Pop");
musicCollection[1] = new MusicCollection("Jazz");
musicCollection[2] = new MusicCollection("Rock");
musicCollection[3] = new MusicCollection("Country");
Music ms1 = new Music("Sunrise", "Adel", "queer1289", 1396);
Music ms2 = new Music("midnight", "Ali", "fief1349", 1397);
Music ms3 = new Music("Moon Shine", "Mahdi", "quid1234", 1398);
Music ms4 = new Music("green field", "Mohammad", "norm7685", 1399);
Music ms5 = new Music("blue sky", "Armin", "grub5679", 1390);
musicCollection[0].addFileMusic(ms1);
musicCollection[1].addFileMusic(ms2);
musicCollection[2].addFileMusic(ms3);
musicCollection[3].addFileMusic(ms4);
musicCollection[0].addFileMusic(ms5);
musicCollection[0].addFileMusicToFavoriteFiles(ms5);
musicCollection[0].listAllFavoriteFiles();
musicCollection[0].removeFavoriteFiles(ms5);
musicCollection[0].searchMusic("blue sky");
musicCollection[0].searchMusic("Adel");
musicCollection[0].searchMusic("queer1289");
musicCollection[0].startPlaying(1);
musicCollection[0].stopPlaying();
System.out.println(musicCollection[0].getNumberOfFiles());
musicCollection[0].listFile(0);
musicCollection[0].removeFileMusic(1);
for (int i = 0; i < 4; i++)
musicCollection[i].listAllFiles();
}
} | [
"noreply@github.com"
] | mohammadmahdi255.noreply@github.com |
d420298edcd050268a40596f17fa032e329e49cc | 7773ea6f465ffecfd4f9821aad56ee1eab90d97a | /java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/adjustFunctionContext/beforeIntStreamMap.java | f8319f3e83f87e0c5b73586ba929cbc5d75b2d31 | [
"Apache-2.0"
] | permissive | aghasyedbilal/intellij-community | 5fa14a8bb62a037c0d2764fb172e8109a3db471f | fa602b2874ea4eb59442f9937b952dcb55910b6e | refs/heads/master | 2023-04-10T20:55:27.988445 | 2020-05-03T22:00:26 | 2020-05-03T22:26:23 | 261,074,802 | 2 | 0 | Apache-2.0 | 2020-05-04T03:48:36 | 2020-05-04T03:48:35 | null | UTF-8 | Java | false | false | 199 | java | // "Replace 'map()' with 'mapToDouble()'" "true"
import java.util.stream.*;
class Test {
void test() {
IntStream.range(0, 100).map(x -> x/<caret>1.0).forEach(s -> System.out.println(s));
}
} | [
"Tagir.Valeev@jetbrains.com"
] | Tagir.Valeev@jetbrains.com |
805121b9a2e82679b0f7b9bf568915ece15c761d | 92225460ebca1bb6a594d77b6559b3629b7a94fa | /src/com/kingdee/eas/fdc/invite/app/AbstractAppraiseGuideLineTypeEditUIHandler.java | 00d197984cba4b39a5cc75dd95d14910e41c018f | [] | no_license | yangfan0725/sd | 45182d34575381be3bbdd55f3f68854a6900a362 | 39ebad6e2eb76286d551a9e21967f3f5dc4880da | refs/heads/master | 2023-04-29T01:56:43.770005 | 2023-04-24T05:41:13 | 2023-04-24T05:41:13 | 512,073,641 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | /**
* output package name
*/
package com.kingdee.eas.fdc.invite.app;
import com.kingdee.bos.Context;
import com.kingdee.eas.framework.batchHandler.RequestContext;
import com.kingdee.eas.framework.batchHandler.ResponseContext;
/**
* output class name
*/
public abstract class AbstractAppraiseGuideLineTypeEditUIHandler extends com.kingdee.eas.framework.app.EditUIHandler
{
} | [
"yfsmile@qq.com"
] | yfsmile@qq.com |
71ff2765039e1c3ab67051efbcac5331ef5a5c21 | 0e74fa024170404134f5d38a0fc6baf2e3ff5444 | /Sprint_3/Java/11_Merge_Sort/src/Solution.java | a2403fa2e20158ac402f10c66127e59eb776e965 | [] | no_license | sergeymamonov/Algorithm_Yandex_Praktikum | ceeb7ff8fa44cdd17a42fa752dd4a5f2fc156b9e | a470feabc936e1b71fc17c465a897b90dd89dca8 | refs/heads/master | 2023-08-17T22:59:08.422992 | 2021-10-20T20:11:58 | 2021-10-20T20:11:58 | 378,496,312 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,591 | java | import java.util.ArrayList;
public class Solution {
public static int[] merge(int[] arr, int left, int mid, int right) {
int i = left;
int j = mid;
ArrayList<Integer> result = new ArrayList<>();
while (i < mid && j < right) {
if (arr[i] < arr[j]) {
result.add(arr[i]);
i++;
} else {
result.add(arr[j]);
j++;
}
}
while (i < mid) {
result.add(arr[i]);
i++;
}
while (j < right) {
result.add(arr[j]);
j++;
}
int[] answer = new int[result.size()];
for (int k = 0; k < result.size(); k++) {
answer[k] = result.get(k);
}
return answer;
}
public static void merge_sort(int[] arr, int left, int right) {
if (right - left <= 1) {
return;
}
int mid = (left + right) / 2;
merge_sort(arr, left, mid);
merge_sort(arr, mid, right);
int[] result = merge(arr, left, mid, right);
int j = 0;
for (int i = left; i < right; i++) {
arr[i] = result[j++];
}
}
public static void main(String[] args) {
int[] a = {1, 4, 9, 2, 10, 11};
int[] b = merge(a, 0, 3, 6);
int[] expected = {1, 2, 4, 9, 10, 11};
assert b.equals(expected);
int[] c = {1, 4, 2, 10, 1, 2};
merge_sort(c, 0, 6);
int[] expected2 = {1, 1, 2, 2, 4, 10};
assert c.equals(expected2);
}
} | [
"sv.mamonov@jet.su"
] | sv.mamonov@jet.su |
2ad445e66142b02595926687728679ec4c554f1b | 6fde8acd9edc00c1f5cba9bca6857b83672fecdc | /src/main/java/org/codethink/symmetricencryption/DESCoder.java | 48d1ac011ce39be87efda16802e83c9d74d1ba57 | [] | no_license | HKMV/ck-security | 0144fc38b0f10ed9c827e162276566579ff3b643 | 04e5ad43199f00fa215cdc907bbc115c2693b8fb | refs/heads/master | 2020-04-05T08:07:23.719317 | 2016-12-14T08:19:13 | 2016-12-14T08:19:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,845 | java | package org.codethink.symmetricencryption;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
/**
*
* 对称加密算法之DES算法实现类
*
* @author CaiXiangNing
* @date 2016年12月11日
* @email caixiangning@gmail.com
*/
public abstract class DESCoder {
// 密钥算法
public static final String KEY_ALGORITHM = "DES";
// 工作模式和填充方式
public static final String CIPHER_ALGORITHM = "DES/ECB/PKCS5Padding";
/**
* 生成密钥 每次使用密钥生成器生成的密钥是不同的
*
* @return 字节数组形式的密钥
* @throws Exception
*/
public static byte[] generateSecretKey() throws Exception {
// 实例化密钥生成器
KeyGenerator keyGenerator = KeyGenerator.getInstance(KEY_ALGORITHM);
// 生成密钥(Key类型)
SecretKey secretKey = keyGenerator.generateKey();
// 生成字节数组形式的密钥
// 附:使用字节数组便于存储在文件中,或者以数据流的形式在网络上传输
return secretKey.getEncoded();
}
/**
* 字节数组形式的密钥转换为Key类型的密钥
* 附:字节数组形式的密钥便于保存或者在网络上传输,但是如果使用还得转换为Key类型的密钥对象
*
* @param key 字节数组形式的密钥
* @return
* @throws Exception
*/
private static SecretKey byteArrayToKey(byte[] keyByte) throws Exception {
SecretKey secretKey = new SecretKeySpec(keyByte, KEY_ALGORITHM);
return secretKey;
}
/**
* 加密操作
*
* @param data 待加密的字节数组形式的明文
* @param keyByte 字节数组形式的密钥
* @return
* @throws Exception
*/
public static byte[] encrypt(byte[] data, byte[] keyByte) throws Exception {
// 字节数组形式的密钥转换为Key类型的密钥
SecretKey secretKey = byteArrayToKey(keyByte);
// 执行工作模式和填充方式
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
// 初始化Cipher,设置为加密模式
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
// 执行加密操作
return cipher.doFinal(data);
}
/**
* 解密操作
*
* @param data 待解密的字节数组形式的密文
* @param keyByte 字节数组形式的密钥
* @return
* @throws Exception
*/
public static byte[] decrypt(byte[] data, byte[] keyByte) throws Exception {
// 字节数组形式的密钥转换为Key类型的密钥
SecretKey secretKey = byteArrayToKey(keyByte);
// 执行工作模式和填充方式
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
// 初始化Cipher,设置为解密模式
cipher.init(Cipher.DECRYPT_MODE, secretKey);
// 执行解密操作
return cipher.doFinal(data);
}
}
| [
"caixiangning@gmail.com"
] | caixiangning@gmail.com |
7d5fcea30f072fbdc49e5d652fde91af5173b9f6 | 33669eec1110c064c8fb744ee18b2d92d74b9589 | /storelocator/api/src/main/java/com/oscon2018/tutorials/configuration/SwaggerDocumentationConfig.java | 48278778f727ea4f484e4c764cef76b007e255d3 | [
"Apache-2.0"
] | permissive | VSaliy/oscon-2018-workshop | a64a13acce18740509b12aab94184072026213d2 | 46e66c555a37bd622e3bb7e0cb4eb463f70ccb7f | refs/heads/master | 2020-04-28T15:55:28.844032 | 2018-07-20T20:09:04 | 2018-07-20T20:09:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,470 | java | package com.oscon2018.tutorials.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
@Configuration
public class SwaggerDocumentationConfig {
ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Store Locator API")
.description("This is a simple storelocator API")
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.termsOfServiceUrl("")
.version("1.0.0")
.contact(new Contact("","", "apisupport@appsbyram.com"))
.build();
}
@Bean
public Docket customImplementation(){
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.oscon2018.tutorials.api"))
.build()
.directModelSubstitute(org.joda.time.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(org.joda.time.DateTime.class, java.util.Date.class)
.apiInfo(apiInfo());
}
}
| [
"ramprakash.gopinathan@t-mobile.com"
] | ramprakash.gopinathan@t-mobile.com |
f50fd1955af93847ecee8b22201a9451502d8991 | 26070a01fd1bdead2efb351d2e26e779e8cb0517 | /sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/filter/PreLimitFilter.java | 319a5e6a86eb09d54f0205edc1040b1ed00ff112 | [] | no_license | zuoqiangTX/sop-parent | c55cedbeab393bbd5080b0adfe7bc81c51631994 | e08253fb28c7597df15726b88e6d21ff7befa966 | refs/heads/read_base_on_springgateway | 2022-12-22T22:58:54.047398 | 2019-12-18T15:44:00 | 2019-12-18T15:44:00 | 224,376,469 | 0 | 0 | null | 2022-12-16T00:43:14 | 2019-11-27T08:02:06 | Java | UTF-8 | Java | false | false | 4,042 | java | package com.gitee.sop.gatewaycommon.zuul.filter;
import com.gitee.sop.gatewaycommon.bean.ApiConfig;
import com.gitee.sop.gatewaycommon.bean.ConfigLimitDto;
import com.gitee.sop.gatewaycommon.exception.ApiException;
import com.gitee.sop.gatewaycommon.limit.LimitManager;
import com.gitee.sop.gatewaycommon.limit.LimitType;
import com.gitee.sop.gatewaycommon.manager.LimitConfigManager;
import com.gitee.sop.gatewaycommon.message.ErrorImpl;
import com.gitee.sop.gatewaycommon.param.ApiParam;
import com.gitee.sop.gatewaycommon.util.RequestUtil;
import com.gitee.sop.gatewaycommon.zuul.ZuulContext;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* 限流拦截器
*
* @author tanghc
*/
public class PreLimitFilter extends BaseZuulFilter {
@Autowired
private LimitManager limitManager;
@Autowired
private LimitConfigManager limitConfigManager;
@Override
protected FilterType getFilterType() {
return FilterType.PRE;
}
@Override
protected int getFilterOrder() {
return PRE_LIMIT_FILTER_ORDER;
}
@Override
protected Object doRun(RequestContext requestContext) throws ZuulException {
ApiConfig apiConfig = ApiConfig.getInstance();
// 限流功能未开启,直接返回
if (!apiConfig.isOpenLimit()) {
return null;
}
ApiParam apiParam = ZuulContext.getApiParam();
ConfigLimitDto configLimitDto = this.findConfigLimitDto(apiConfig, apiParam, requestContext.getRequest());
if (configLimitDto == null) {
return null;
}
// 单个限流功能未开启
if (configLimitDto.getLimitStatus() == ConfigLimitDto.LIMIT_STATUS_CLOSE) {
return null;
}
byte limitType = configLimitDto.getLimitType();
// 如果是漏桶策略
if (limitType == LimitType.LEAKY_BUCKET.getType()) {
boolean acquire = limitManager.acquire(configLimitDto);
if (!acquire) {
throw new ApiException(new ErrorImpl(configLimitDto.getLimitCode(), configLimitDto.getLimitMsg()));
}
} else if (limitType == LimitType.TOKEN_BUCKET.getType()) {
limitManager.acquireToken(configLimitDto);
}
return null;
}
protected ConfigLimitDto findConfigLimitDto(ApiConfig apiConfig, ApiParam apiParam, HttpServletRequest request) {
String routeId = apiParam.fetchNameVersion();
String appKey = apiParam.fetchAppKey();
String ip = RequestUtil.getIP(request);
// 最多7种情况
String[] limitKeys = new String[]{
// 根据路由ID限流
routeId,
// 根据appKey限流
appKey,
// 根据路由ID + appKey限流
routeId + appKey,
// 根据ip限流
ip,
// 根据ip+路由id限流
ip + routeId,
// 根据ip+appKey限流
ip + appKey,
// 根据ip+路由id+appKey限流
ip + routeId + appKey,
};
List<ConfigLimitDto> limitConfigList = new ArrayList<>();
for (String limitKey : limitKeys) {
ConfigLimitDto configLimitDto = limitConfigManager.get(limitKey);
if (configLimitDto == null) {
continue;
}
if (configLimitDto.getLimitStatus().intValue() == ConfigLimitDto.LIMIT_STATUS_OPEN) {
limitConfigList.add(configLimitDto);
}
}
if (limitConfigList.isEmpty()) {
return null;
}
limitConfigList.sort(Comparator.comparing(ConfigLimitDto::getOrderIndex));
return limitConfigList.get(0);
}
}
| [
"thc8775@163.com"
] | thc8775@163.com |
bb28707276905a7f6a3ea5effba1fb73698b9719 | 1d06f8ef5269c66b504cdfaa9e7e4b43d5283b10 | /Day10/src/J03_mainCla.java | d99f74e664cf67b4a4825db40727ed2d005a7d21 | [] | no_license | network514/Day10 | 543039834ee3891b55c3ea360af43d2da080b741 | 1fe00636eace7af4014b95464450fa1268b27066 | refs/heads/master | 2020-04-06T03:42:51.472801 | 2015-06-19T02:45:59 | 2015-06-19T02:45:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java |
public class J03_mainCla {
public static void main(String[] args) {
// 일반 인스턴스 변수의 이용(객체 필요)
J03_staticCla ref = new J03_staticCla();
ref.n1 = "객체가 있어야만 사용 가능";
ref.mth();
// static 변수의 이용(클래스, 객체 가능)
J03_staticCla.n2 = "객체 없이 가능";
J03_staticCla.mth2();
J03_staticCla sCla = new J03_staticCla();
sCla.n2 = "객체 있을때에도 가능";
sCla.mth2();
}
}
| [
"JAVA_0608@ITB401-PC"
] | JAVA_0608@ITB401-PC |
a13c6bd0eef06d78bcaf823b248f5e85774b41f0 | 6fe6082ef377d61c945bce234dc295b500ea7821 | /app/src/main/java/com/linson/android/hiandroid2/JavaPractice/ThreadsPractice.java | 7803559f22455f390c62115177bf39dd4d7979db | [] | no_license | lsfv/HiAndroidok | 5e0fc5dd4fdcd4c4596423a5b9dafbe2829908f8 | f26066359a458a682f4f05c3dc27d8c851bb1dd1 | refs/heads/master | 2020-12-11T19:21:58.417644 | 2020-01-14T21:14:31 | 2020-01-14T21:14:33 | 233,937,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,812 | java | package com.linson.android.hiandroid2.JavaPractice;
import android.content.BroadcastReceiver;
import com.linson.LSLibrary.AndroidHelper.LSComponentsHelper;
import java.util.LinkedList;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
//无锁,多线程读,因为removefrist 操作,大概率会出错,推测是同时删除,导致list为空了? 数据竞增必须加锁。
//writer use millseconds:21087 reader :error.
//单纯性加锁,当然只锁住操作共享数据mBookNum,mReadBookNum,mBooksID。除了不会出错之外。发现效率基本没有变低。大概降低了千分之5.基本没变了。
// writer1use millseconds:21106. reader1use millseconds:22548: reader2use millseconds:22554.num:4001
//那下面confition就无法测试下去了。所以必须做一个特殊场景来体现其作用。就假设内存非常紧张。让写线程,发现数据超过10条。就轮询sleep或yied,等待reader来取走一些数据。这样让writer多做点无效的轮询。
//突然发现sleep或yied,是有bug的,因为必须交出锁给读线程,不然死锁啊。 所以误打误撞,发现了condition的作用,不单是理论上的效率的提高,而是这张场景下必须使用的元素。不然死锁。
//恩,,,也可以不用。把轮询中的轮询改为contion。跳过这次。当然需要休息一下。不能让写线程故意疯狂无用功。
//writer1use millseconds:22499. reader1use millseconds:22552 reader2use millseconds:22556 .sencond:22520
//测试发现单线程无脑轮询,效率降低 5%,不过这里的降低应该是没有降低,而是在等待读线程罢了。应该是记录使用cpu的时间和峰值才对。
//用condition. aweit, single。发现无任何变化。应该是压力不够大。无法测试出condition的优势了。
//基本上这里的短板就在于读线程没有
public class ThreadsPractice
{
private LinkedList<Integer> mBooksID=new LinkedList<>();
private int mBookNum=0;
private int mReadBookNum=0;
private final int maxBOOKS=4000;
private ReentrantLock mReentrantLock=new ReentrantLock();
private Condition mCondition=mReentrantLock.newCondition();
public void start() throws Exception
{
Thread writer1=new Thread(new Writer(),"writer1");
writer1.start();
Thread reader1=new Thread(new Reader(),"reader1");
reader1.start();
Thread reader2=new Thread(new Reader(),"reader2");
reader2.start();
}
private class Writer implements Runnable
{
@Override
public void run()
{
long startTime= System.currentTimeMillis();
while (true)
{
if(mBookNum>maxBOOKS)
{
break;
}
try
{
Thread.sleep(5);
}
catch (Exception e)
{
LSComponentsHelper.LS_Log.Log_Exception(e);
}
mReentrantLock.lock();
try
{
if (mBooksID.size()>10)
{
//mCondition.await();
Thread.yield();
continue;
}
mBooksID.add(mBookNum);
//LSComponentsHelper.LS_Log.Log_INFO("write:"+mReadBookNum+"");
mBookNum++;
}
catch (Exception e)
{
LSComponentsHelper.LS_Log.Log_Exception(e);
}
finally
{
mReentrantLock.unlock();
}
}
long endTime=System.currentTimeMillis();
LSComponentsHelper.LS_Log.Log_INFO(Thread.currentThread().getName()+"use millseconds:"+(endTime-startTime)+". maxid:"+mBookNum);
}
}
private class Reader implements Runnable
{
@Override
public void run()
{
long startTime= System.currentTimeMillis();
while (true)
{
//LSComponentsHelper.LS_Log.Log_INFO(Thread.currentThread().getName()+"say :"+mReadBookNum+".size"+mBooksID.size());
if(mReadBookNum>=maxBOOKS)
{
break;
}
try
{
if(mBooksID.size()>0)
{
Thread.sleep(22);
mReentrantLock.lock();
try
{
mBooksID.removeFirst();
//LSComponentsHelper.LS_Log.Log_INFO(Thread.currentThread().getName()+"read:"+mReadBookNum+".size"+mBooksID.size());
mReadBookNum++;
//mCondition.signalAll();
} catch (Exception e)
{
LSComponentsHelper.LS_Log.Log_Exception(e,"nofity");
}
finally
{
mReentrantLock.unlock();
}
}
else
{
Thread.yield();
}
} catch (InterruptedException e)
{
LSComponentsHelper.LS_Log.Log_Exception(e);
}
}
long endTime=System.currentTimeMillis();
LSComponentsHelper.LS_Log.Log_INFO(Thread.currentThread().getName()+"use millseconds:"+(endTime-startTime)+".num:"+mReadBookNum);
}
}
} | [
"lsfv@163.com"
] | lsfv@163.com |
8e6c9ce5caeb48102106d6bc2abe9e844ae65dc3 | 7efb9146bde21bb768417cffc72516e9633c0a02 | /src/reading/ReadGraph.java | 14bfc768d9f66a66db0ea59e2ff69f20a06ab68a | [] | no_license | YurBurGer/BFS | 44f11c6cfc859f3e3f46dae11b3b18d8e7630550 | f62111854b763a815ae12156426c2ce196dd9114 | refs/heads/master | 2020-04-16T08:10:47.820048 | 2014-05-12T04:54:48 | 2014-05-12T04:54:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,719 | java | package reading;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
import data.Graph;
public class ReadGraph {
public static Graph ReadOrientedGraphFromEdgeList(String fname) throws FileNotFoundException{
Scanner sc;
if(fname.endsWith(".txt")){
sc=new Scanner(new FileInputStream(fname));
}
else{
sc=new Scanner(new FileInputStream(fname+".txt"));
}
int count=sc.nextInt();
Graph graph=new Graph(count);
while(sc.hasNext()){
int from=sc.nextInt();
int to=sc.nextInt();
graph.addOrientedEdge(from, to);
}
sc.close();
return graph;
}
public static Graph ReadOrinetedGraphFromAdjacencyMatrix(String fname) throws FileNotFoundException{
Scanner sc;
if(fname.endsWith(".txt")){
sc=new Scanner(new FileInputStream(fname));
}
else{
sc=new Scanner(new FileInputStream(fname+".txt"));
}
int count=sc.nextInt();
Graph graph=new Graph(count);
int[][] matrix=new int[count][count];
for(int i=0;i<count;i++)
for(int j=0;j<count;j++)
matrix[i][j]=sc.nextInt();
for(int i=0;i<count;i++)
for(int j=0;j<count;j++)
if(matrix[i][j]==1)
graph.addOrientedEdge(i, j);
sc.close();
return graph;
}
public static Graph ReadOrientedGraphFromIncidencematrix(String fname) throws FileNotFoundException{
Scanner sc;
if(fname.endsWith(".txt")){
sc=new Scanner(new FileInputStream(fname));
}
else{
sc=new Scanner(new FileInputStream(fname+".txt"));
}
int vcount=sc.nextInt();
int ecount=sc.nextInt();
Graph graph=new Graph(vcount);
int[][] matrix=new int[ecount][vcount];
for(int i=0;i<ecount;i++)
for(int j=0;j<vcount;j++)
matrix[i][j]=sc.nextInt();
for(int i=0;i<ecount;i++){
int from=0;
int to=0;
for(int j=i;j<vcount;j++){
if(matrix[i][j]==1)
from=j;
if(matrix[i][j]==-1)
to=j;
}
graph.addOrientedEdge(from, to);
}
sc.close();
return graph;
}
public static Graph ReadUnorientedGraphFromEdgeList(String fname) throws FileNotFoundException{
Scanner sc;
if(fname.endsWith(".txt")){
sc=new Scanner(new FileInputStream(fname));
}
else{
sc=new Scanner(new FileInputStream(fname+".txt"));
}
int count=sc.nextInt();
Graph graph=new Graph(count);
while(sc.hasNext()){
int from=sc.nextInt();
int to=sc.nextInt();
graph.addUnorientedEdge(from, to);
}
sc.close();
return graph;
}
public static Graph ReadUnorinetedGraphFromAdjacencyMatrix(String fname) throws FileNotFoundException{
Scanner sc;
if(fname.endsWith(".txt")){
sc=new Scanner(new FileInputStream(fname));
}
else{
sc=new Scanner(new FileInputStream(fname+".txt"));
}
int count=sc.nextInt();
Graph graph=new Graph(count);
int[][] matrix=new int[count][count];
for(int i=0;i<count;i++)
for(int j=0;j<count;j++)
matrix[i][j]=sc.nextInt();
for(int i=0;i<count;i++)
for(int j=i;j<count;j++)
if(matrix[i][j]==1)
graph.addUnorientedEdge(i, j);
sc.close();
return graph;
}
public static Graph ReadUnorientedGraphFromIncidencematrix(String fname) throws FileNotFoundException{
Scanner sc;
if(fname.endsWith(".txt")){
sc=new Scanner(new FileInputStream(fname));
}
else{
sc=new Scanner(new FileInputStream(fname+".txt"));
}
int vcount=sc.nextInt();
int ecount=sc.nextInt();
Graph graph=new Graph(vcount);
int[][] matrix=new int[ecount][vcount];
for(int i=0;i<ecount;i++)
for(int j=0;j<vcount;j++)
matrix[i][j]=sc.nextInt();
for(int i=0;i<ecount;i++){
int from=0;
int to=0;
for(int j=i;j<vcount;j++){
if(matrix[i][j]==1)
if(from==0)
from=j;
else
to=j;
}
graph.addUnorientedEdge(from, to);
}
sc.close();
return graph;
}
} | [
"yurger2009@gmail.com"
] | yurger2009@gmail.com |
c5557acfa1c5d1bf631cf3f9e188d47f5bbce549 | 41cae82299f9f6f7eab1676a4fde570fd3d8691d | /Lista 2/src/ex2/Cliente.java | c86f6dba6f77e5b7579817b7285e32cf25cf187c | [] | no_license | PalomaSts/fatec-java-poo | 80f62b951fd624443f229961b86b098fa9df624f | e1c449b62c46c3f8fba8a21cf12b70c4756f4cda | refs/heads/master | 2023-05-28T04:54:08.151643 | 2021-06-07T14:59:54 | 2021-06-07T14:59:54 | 374,703,158 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 1,233 | java | package ex2;
public class Cliente {
private String nome;
private double saldo;
private double limite;
public Cliente(String nome, double saldo, double limite) {
this.nome = nome;
this.saldo = saldo;
this.limite = limite;
}
boolean sacar (double valor) {
boolean valido;
double disponivel = saldo + limite;
double aux1;
if(valor<=disponivel) {
if(saldo>0) {
if(saldo>=valor) {
saldo = saldo - valor;
}
else {
aux1 = valor - saldo; //qtd que sobra depois de tirar do saldo
saldo = 0;
limite = limite - aux1;
System.out.println("\nSaque realizado");
valido = true;
return valido;
}
}
else {
limite = limite - valor;
System.out.println("\nSaque realizado");
valido = true;
return valido;
}
}
else
System.out.println("\nValor de saque maior que o disponível");
valido = false;
return valido;
}
void depositar(double valor) {
saldo = saldo + valor;
}
public String getNome() {
return nome;
}
public double getSaldo() {
return saldo;
}
public double getLimite() {
return limite;
}
public void checarSaldo() {
System.out.println("\nSaldo: " + getSaldo() + " + Limite: " + getLimite());
}
}
| [
"paloma.sts28@gmail.com"
] | paloma.sts28@gmail.com |
c7305134ae248a32fa9c273a23e40e9ebc128785 | 9a70020d409332b7db0e2e5e087f500a0e58217c | /BOJ/17177/Main.java | 7e10a1af11e71ca748d9f578f520079c8e897fba | [
"MIT"
] | permissive | ISKU/Algorithm | daf5e9d5397eaf7dad2d6f7fb18c1c94d8f0246d | a51449e4757e07a9dcd1ff05f2ef4b53e25a9d2a | refs/heads/master | 2021-06-22T09:42:45.033235 | 2021-02-01T12:45:28 | 2021-02-01T12:45:28 | 62,798,871 | 55 | 12 | null | null | null | null | UTF-8 | Java | false | false | 624 | java | /*
* Author: Minho Kim (ISKU)
* Date: May 4, 2019
* E-mail: minho.kim093@gmail.com
*
* https://github.com/ISKU/Algorithm
* https://www.acmicpc.net/problem/17177
*/
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double a = sc.nextDouble();
double b = sc.nextDouble();
double c = sc.nextDouble();
double e = Math.sqrt((a * a) - (b * b));
double f = Math.sqrt((a * a) - (c * c));
// ad + bc = ef, d = (ef - bc) / a
double d = ((e * f) - (b * c)) / a;
System.out.printf("%.0f\n", (d <= 0) ? -1 : d);
}
} | [
"minho.kim093@gmail.com"
] | minho.kim093@gmail.com |
817074bb7d84d38809e175d8c9cd8d481899b2ae | ac0f3e6bebcc0f2026cd8efafcbbcbf83f70a7a2 | /TechnoCommonCode/src/main/java/org/firstinspires/ftc/samplecode/clawbot/Robot.java | 546f5d2d288382fad0d82997379d0b046f9217f0 | [] | no_license | big-beast-boss/FreightFrenzy2021 | 3f862ef0ce9283b2c85ca56fc2b460a0dae037e0 | 05ab5ba1f6006516905e860d582c6bbd863631cb | refs/heads/master | 2023-08-21T16:20:23.408938 | 2021-10-23T22:07:30 | 2021-10-23T22:07:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | package org.firstinspires.ftc.samplecode.clawbot;
import org.firstinspires.ftc.samplecode.clawbot.subsystems.ArmSubsystem;
import org.firstinspires.ftc.samplecode.clawbot.subsystems.ClawSubsystem;
import org.firstinspires.ftc.samplecode.clawbot.subsystems.DrivebaseSubsystem;
public class Robot {
public DrivebaseSubsystem drivebaseSubsystem;
public ArmSubsystem armSubsystem;
public ClawSubsystem clawSubsystem;
public Hardware hardware;
public Robot(){
hardware = new Hardware();
drivebaseSubsystem = new DrivebaseSubsystem(hardware.leftMotor, hardware.rightMotor);
armSubsystem = new ArmSubsystem(hardware.armMotor);
clawSubsystem = new ClawSubsystem(hardware.clawServo);
}
}
| [
"jeffastedman@gmail.com"
] | jeffastedman@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.