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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1506d0e23698d7316f2a238d016b88d1f376e9e2 | 799f9c964ebff8c2f478b70f38411722ad1ec567 | /src/laboratorio2/Laboratorio2.java | b98f3ea40c191f5201fff0c3a97a07ad9fc3f1a5 | [] | no_license | jucmorati/laboratorio2.2 | 648db14a5b178382f7457f31b667fbad756b2721 | d018ae5a04b8e9fe92f8918983974561904b4549 | refs/heads/master | 2021-01-10T09:29:05.903711 | 2016-02-25T04:22:43 | 2016-02-25T04:22:43 | 52,496,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,265 | 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 laboratorio2;
/**
*
* @author USUARIO
*/
public class Laboratorio2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
java.util.Scanner num=
new java.util.Scanner(System.in);
String nompasajero;
String variable;
int cedula;
boolean [][] Avion = new boolean [12][7];
String [][] Nombre= new String [12][7];
int [][] Cedula =new int [12][7];
Avion[0][2]=true;
Avion[1][2]=true;
Avion[0][4]=true;
Avion[1][4]=true;
for (int i =0;i<12;i++){
for(int j=0;j<7;j++){
Avion[i][3]=true;
Avion[2][j]=true;
Avion[3][j]=true;
Avion[4][j]=true;
}
}
System.out.println(" 1 clase ejecutiva,2 economica,3 avion");
System.out.println("4 identificar con cedula silla de alguien,5 cuantas sillas vacias en economica");
while(true) {
int op = num.nextInt();
switch(op) {
case 1:
System.out.println("¿ventana o pasillo?");
variable=num.next();
System.out.println("ingrese el nombre del pasajero");
nompasajero=num.next();
System.out.println("ingrese la cedula del pasajero");
cedula=num.nextInt();
boolean x = false;
for(int i=0;i<2;i++){
for(int j=0;j<7;j++){
if(variable.equals("ventana")){
if(Avion[i][0]==false||Avion [i][6]==false){
Avion[i][j]=true;
Nombre[i][j]=nompasajero;
Cedula[i][j]=cedula;
x = true;
break;
}
}
if(variable.equals("pasillo")){
if(Avion[i][1]==false||Avion [i][5]==false){
Avion[i][1]=true;
Nombre[i][j]=nompasajero;
Cedula[i][j]=cedula;
x = true;
break;
}
}
}
if(x == true) {
break;
}
System.out.println();
}
break;
case 2:
System.out.println("¿ventana , centro o pasillo?");
variable=num.next();
System.out.println("ingrese el nombre del pasajero");
nompasajero=num.next();
System.out.println("ingrese la cedula del pasajero");
cedula=num.nextInt();
boolean y = false;
for(int i=0;4<i||i<12;i++){
for(int j=0;j<7;j++){
if(variable.equals("ventana")){
if(Avion[i][0]==false||Avion [i][6]==false){
Avion[i+6][0]=true;
Nombre[i][j]=nompasajero;
Cedula[i][j]=cedula;
y = true;
break;
}
}
if(variable.equals("pasillo")){
if(Avion[i][2]==false||Avion [i][4]==false){
Avion[i+6][2]=true;
Nombre[i][j]=nompasajero;
Cedula[i][j]=cedula;
y = true;
break;
}
}
if(variable.equals("centro")){
if(Avion[i][1]==false||Avion [i][5]==false){
Avion[i+6][1]=true;
Nombre[i][j]=nompasajero;
Cedula[i][j]=cedula;
y = true;
break;
}
}
}
if(y == true) {
break;
}
System.out.println();
}
break;
case 3:
int sillasocupadas=0;
for(int i=0;i<12;i++){
for(int j=0;j<7;j++){
if(Avion[i][j]==true){
sillasocupadas++;
}
System.out.print(Avion[i][j]+"\t");
}
System.out.println();
}
System.out.print("la cantidad de sillas ocupadas es: "+(sillasocupadas-34));
break;
case 4:
System.out.println("ingrese la cedula del pasajero que quiere saber donde se ubica");
int cedulacomp= num.nextInt();
for(int i=0;i<12;i++){
for(int j=0;j<7;j++){
if(cedulacomp==Cedula[i][j]){
System.out.println(" el pasajero se encuentra en la silla:( "+i+";"+j+")");
break;
}
}
}
break;
case 5:
int sillasvacias=0;
for(int i=0;4<i||i<12;i++){
for(int j=0;j<7;j++){
if (Avion[i][j]==false){
sillasvacias++;
}
}
}
System.out.println("la cantidad de sillas vacias en economica es: "+sillasvacias);
break;
default:
System.out.println("se ha cometido un error al ingresar algun dato");
break;
}
}
}
}
| [
"USUARIO@USUARIO-PC"
] | USUARIO@USUARIO-PC |
b4714848bf2c0423c4996f56376847920365e93a | ea116d6a879c4ab9f2aa5cb1ad620abb2d12d2e2 | /app/src/main/java/com/lulu/shopdemo/model/CartItem.java | 1e6b21483bc0002cbb39b14747aed520d3181908 | [] | no_license | changer0/ShopDemo | f86ba217a5a5faff0ee0c372e12f0094048c8959 | 3b48b04ea40467eeb0f4c3f5d0688f0fc38f017a | refs/heads/master | 2021-01-12T15:03:40.881490 | 2016-10-23T02:43:23 | 2016-10-23T02:43:23 | 71,673,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,351 | java | package com.lulu.shopdemo.model;
/**
* Created by Lulu on 2016/10/22.
*/
public class CartItem {
private long productId;//商品ID
private String productName;
private String productIcon;
private float productPrice;
private int count;
// TODO: 2016/10/22 CheckBox的选择是否要做在这儿
private boolean isChecked;//购物车中是否选中某一个商品
public boolean isChecked() {
return isChecked;
}
public void setChecked(boolean checked) {
isChecked = checked;
}
public long getProductId() {
return productId;
}
public void setProductId(long productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductIcon() {
return productIcon;
}
public void setProductIcon(String productIcon) {
this.productIcon = productIcon;
}
public float getProductPrice() {
return productPrice;
}
public void setProductPrice(float productPrice) {
this.productPrice = productPrice;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
| [
"zhanglulu1007@foxmail.com"
] | zhanglulu1007@foxmail.com |
afbfc03c2c4d67f1092123669c4109d932cbf11e | 2fe9534a2aeb593f2a9167ff7829a1237570ee43 | /src/applications/springmvc/src/java/org/apache/portals/applications/springmvc/DOMTreeDeleteController.java | dfd3a302e2f3f1956b53882ed0ed333cf5c463da | [
"Apache-2.0"
] | permissive | martin-d-ball/portals-bridges | cb2ce2b3ff58f8e9a466ca3f51fc26478af9e429 | 955440dc599a6abbcd3c85b7b7e859aae8ff145f | refs/heads/master | 2021-01-09T20:05:44.230496 | 2016-08-12T10:26:33 | 2016-08-12T10:26:33 | 65,476,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,998 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.portals.applications.springmvc;
import java.util.HashMap;
import java.util.Map;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.portlet.mvc.AbstractController;
import org.springframework.web.portlet.ModelAndView;
public class DOMTreeDeleteController extends AbstractController implements InitializingBean
{
private DOMTreeService domTreeService;
public void afterPropertiesSet() throws Exception
{
if (this.domTreeService == null)
throw new IllegalArgumentException( "DOMTreeService is required" );
}
public void handleActionRequestInternal( ActionRequest request, ActionResponse response ) throws Exception
{
// get the id and delete it
String name = request.getParameter( "domTree" ) ;
domTreeService.deleteDOMTree( name, request );
response.setRenderParameter( "action", "list" );
}
public void setDomTreeService( DOMTreeService domTreeService )
{
this.domTreeService = domTreeService;
}
}
| [
"martin.ball@grg.com"
] | martin.ball@grg.com |
3df02e735369d9fd895541fcbe1730b8c99b50b2 | 724042a99b4f206cb1fe7e59eb06733a825021a4 | /springBootAndCloud教程code-snippet/code-snippet-master/java/netty-heartbeat/server/src/main/java/com/karonda/server/ServerApplication.java | 92b5d20709d0ded1d8a2f62fda26a4519ecb56bb | [] | no_license | hou520/CoursesOnWeb | 71c89e02ec450c29819896a5864a3268dc9eb4c5 | 87bffcd7c5926d93d3631083c15e1f8958949045 | refs/heads/master | 2022-12-05T06:53:13.071126 | 2020-09-04T11:03:46 | 2020-09-04T11:03:46 | 292,801,021 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.karonda.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ServerApplication {
public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}
| [
"hou820159358@163.com"
] | hou820159358@163.com |
d186d07e9d372919da8c959ca623fb1445483219 | de2a6cbed9c133cbc532b1dabab0afb5f586a543 | /account/acc-item/acc-account-dbservice/src/main/java/com/account/item/pojo/AllDataPojo.java | 00b148aec020fbbf541ed18b59ad391c8c8c6fd9 | [] | no_license | dp207/repo6 | 63448c1a0edd2acae12f2ecd97c6b4111d9887af | 2e7b205562d099f9091525aac8eb91d073cb4e92 | refs/heads/master | 2022-06-25T04:10:06.386334 | 2019-10-19T11:08:57 | 2019-10-19T11:08:57 | 215,965,680 | 0 | 0 | null | 2022-06-21T02:04:05 | 2019-10-18T07:26:35 | Java | UTF-8 | Java | false | false | 190 | java | package com.account.item.pojo;
import lombok.Data;
import java.util.List;
@Data
public class AllDataPojo {
private List<List<String>> mainData;
private List<String> titleData;
}
| [
"563282025@qq.com"
] | 563282025@qq.com |
7bd58679f1696b1e3ad4e8cb464e42f8838245a8 | edad591b9ca00ac579566842c60aef6f395112ec | /src/main/java/com/marlabs/rmbs/entities/ClaimApproveFwdEmployees.java | 7ea1919f351b7229a44007f944696c8b36f1233c | [] | no_license | pk-gupta/ers | 3492f8a5637551688851c3ec507f6222f62181a3 | 717d1f6582145086d0ffc5e4f41efcca36ba1028 | refs/heads/master | 2022-07-13T07:03:06.322697 | 2019-07-25T17:15:08 | 2019-07-25T17:15:08 | 198,871,882 | 0 | 0 | null | 2022-06-29T17:32:09 | 2019-07-25T17:09:10 | Java | UTF-8 | Java | false | false | 1,162 | java | package com.marlabs.rmbs.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "claimapprovefwd_employees")
public class ClaimApproveFwdEmployees {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@OneToOne
@NotNull
private UserMaster approveFwdFromEmployeeId;
@OneToOne
@NotNull
private UserMaster approveFwdToEmployeeId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public UserMaster getApproveFwdFromEmployeeId() {
return approveFwdFromEmployeeId;
}
public void setApproveFwdFromEmployeeId(UserMaster approveFwdFromEmployeeId) {
this.approveFwdFromEmployeeId = approveFwdFromEmployeeId;
}
public UserMaster getApproveFwdToEmployeeId() {
return approveFwdToEmployeeId;
}
public void setApproveFwdToEmployeeId(UserMaster approveFwdToEmployeeId) {
this.approveFwdToEmployeeId = approveFwdToEmployeeId;
}
}
| [
"sagar.pkgupta@gmail.com"
] | sagar.pkgupta@gmail.com |
ce4973d91f65a7d2cb8ef8a0de3d86c365fcf7c9 | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module588/src/main/java/module588packageJava0/Foo119.java | a64c50634ed9543754ac1d0c04b0845127dcc9f4 | [
"Apache-2.0"
] | permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 431 | java | package module588packageJava0;
import java.lang.Integer;
public class Foo119 {
Integer int0;
Integer int1;
public void foo0() {
new module588packageJava0.Foo118().foo6();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
}
| [
"oliviern@uber.com"
] | oliviern@uber.com |
9f382556be5c9048496beb0e90e9ce48b1463ede | 715c088150e970831140ccc66c59aba323f2c8f3 | /TallerDos/src/tallerdos/Ejercicio6.java | da568dc24317ead2280e0673a93f9926e97b7a5d | [] | no_license | majosoala/TRABAJO2 | 885cf92ea4569a5c3efe0918ffc64d928c4387af | 5aeca8cb8567dd0a9b2c22f456458f03a3379f1b | refs/heads/main | 2023-03-14T02:15:08.914423 | 2021-03-07T02:00:24 | 2021-03-07T02:00:24 | 343,157,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | 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 tallerdos;
import java.util.Scanner;
/** Desarrolle un programa en java que calcule el índice de masa corporal BMI el cual está dado por la formula (pesoenKg
/ alturaenmetros*alturaenmetros)
*
* @author majos
*/
public class Ejercicio6 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
System.out.println("Digite el peso ");
double peso=entrada.nextFloat();
System.out.println("Digite su altura en metros ");
double h=entrada.nextDouble();
double bmi=peso/(h*h);
System.out.printf("Su indice de masa corporal es: %.2f \n", bmi);
}
}
| [
"79801791+majosoala@users.noreply.github.com"
] | 79801791+majosoala@users.noreply.github.com |
f4928b670809c141acd710c0588b8bb1804047c4 | 23a9d0a627178a2bce26357dc41f33a6970a4d03 | /src/jart/netbeans/refactoring/RefactoringHelper.java | b17b4cf7915d9a9e46963a7e662a2c7f43a129e4 | [] | no_license | jwloka/JArt | ee96bd8bc27e912c8e7ebe1b7bf87f060eb0e7f6 | 799e66695aeb0327ff7139a91ce1f65b8e5ca808 | refs/heads/master | 2020-03-26T23:17:39.734267 | 2013-08-25T17:40:00 | 2013-08-25T17:40:00 | 4,327,060 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,126 | java | /*
* Copyright (C) 2002 Thomas Dudziak, Jan Wloka
*
* 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 jart.netbeans.refactoring;
import jart.analysis.AnalysisFunction;
import jart.netbeans.Integration;
import jart.netbeans.gui.RefactoringDialog;
import jart.smelling.MultipleSmellLocator;
import jart.smelling.SmellOccurrence;
import jart.smelling.SmellOccurrenceIterator;
import java.util.Hashtable;
import java.util.Vector;
public class RefactoringHelper
{
private MultipleSmellLocator _locator = new MultipleSmellLocator();
private Hashtable _mappings = new Hashtable();
public void smell(Object[] smellNames)
{
for (int idx = 0; idx < smellNames.length; idx++)
{
try
{
_locator.addAnalysisFunction(
(AnalysisFunction) Class
.forName("jart.smelling." + smellNames[idx].toString())
.newInstance());
}
catch (Exception ex)
{
}
}
_locator.applyTo(Integration.getInstance().getProject().getJastProject());
determinePossibleRefactorings();
}
private RefactoringMapping[] getKnownMappings()
{
RefactoringMapping[] result = { new ParameterObjectMapping()};
return result;
}
private void determinePossibleRefactorings()
{
RefactoringMapping[] knownMappings = getKnownMappings();
RefactoringMapping initMapping;
SmellOccurrence occurrence;
Vector mappingsFor;
_mappings.clear();
for (int idx = 0; idx < knownMappings.length; idx++)
{
for (SmellOccurrenceIterator it = getOccurrences(); it.hasNext();)
{
occurrence = it.getNext();
initMapping = knownMappings[idx].getInitializedInstance(occurrence);
if (initMapping != null)
{
mappingsFor = (Vector) _mappings.get(occurrence);
if (mappingsFor == null)
{
mappingsFor = new Vector();
_mappings.put(occurrence, mappingsFor);
}
mappingsFor.addElement(initMapping);
}
}
}
}
public void showInEditor(SmellOccurrence occurrence)
{
String unitName = occurrence.getEnclosingUnit().getTopLevelQualifiedName();
int pos =
occurrence.getPosition() != null ? occurrence.getPosition().getAbsolute() : 0;
Integration.openInEditor(unitName, pos);
}
public SmellOccurrenceIterator getOccurrences()
{
return _locator.getOccurrences();
}
public void showResults()
{
new RefactoringDialog(this).setVisible(true);
;
}
public Vector getMappingsFor(SmellOccurrence occurrence)
{
return (Vector) _mappings.get(occurrence);
}
}
| [
"jan.wloka@gmail.com"
] | jan.wloka@gmail.com |
c602373a925479c296031de93f438ad212618960 | c707ab6be499af14de178db33c2a32bb7a8e1dc2 | /PaymentService/src/main/java/com/limitless/services/engage/CustomerAddressListBean.java | 958a8e69f6d5d9293bbff4f58ba58b89284f4888 | [] | no_license | nandhu0308/nandhu | 569783e4d70717a9f580064420ee60a5f7f823d2 | ad1242f06e8b25174ad2e74ef4c1ae9cc9c3c7d1 | refs/heads/master | 2021-09-04T18:49:20.245529 | 2017-12-10T20:16:36 | 2017-12-10T20:16:36 | 118,317,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 631 | java | package com.limitless.services.engage;
import java.util.List;
public class CustomerAddressListBean {
private String message;
private int customerId;
private List<AddressListBean> addressList;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getCustomerId() {
return customerId;
}
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
public List<AddressListBean> getAddressList() {
return addressList;
}
public void setAddressList(List<AddressListBean> addressList) {
this.addressList = addressList;
}
}
| [
"ram@limitlesscircle.com"
] | ram@limitlesscircle.com |
718e61f85ed6affaed6e7c8fca1291440e9ab3ca | 4f15aef52442d9d8ffc57a8fa996b551571360bf | /demo/src/main/java/com/example/demo/service/GoodsService.java | ec2bab544e015c7659f0b6fb440a1e20a712b86e | [] | no_license | wz14122/LauduryBackground | 1a8cc22b0257706942e56102b220a5a64a80abd4 | 1d2f1be3a72778e985eb7268c73b4bf4ba0deca5 | refs/heads/master | 2020-03-15T06:32:21.324968 | 2018-07-31T06:54:41 | 2018-07-31T06:54:41 | 132,009,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,773 | java | package com.example.demo.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo.dao.GoodsDao;
import com.example.demo.entity.Consumption;
import com.example.demo.entity.Goods;
import com.example.demo.utils.DateUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Service
public class GoodsService {
@Autowired
private GoodsDao dao;
public List<Goods> saveAll(List<Goods> list) {
return dao.saveAll(list);
}
public List<Goods> saveAllFromJSONArray(String jsonArray, Consumption consumption) {
JSONArray ja = JSONArray.fromObject(jsonArray);
ArrayList<Goods> entity = new ArrayList<>();
for (Object object : ja) {
JSONObject jsonObject2 = JSONObject.fromObject(object);
Goods good = (Goods) JSONObject.toBean(jsonObject2, Goods.class);
good.setConsumptionId(consumption.getConsumptionId());
good.setConsumptionDate(DateUtil.getToday());
good.setExpectFetchDate(consumption.getSuggestDate());
good.setHaveFetch(false);
good.setCustomerId(1);
System.out.println(good);
entity.add(good);
}
return this.saveAll(entity);
}
public List<Goods> findByConsumptionId(String consumptionId){
return dao.findByConsumptionId(consumptionId);
}
public List<Goods> findByFetchState(boolean state){
return dao.findByHaveFetch(state);
}
public void updateGoodsState(String goods) {
JSONArray ja = JSONArray.fromObject(goods);
ArrayList<Integer> ids = new ArrayList<>();
for (Object obj : ja) {
ids.add(Integer.parseInt((String) obj));
}
//修改货物状态
dao.updateGoodsStateByIds(ids);
}
}
| [
"18329030206@163.com"
] | 18329030206@163.com |
8501f90f9118027e616574e2c64166f2a20d013d | 7c7e97bb3ed1d364a9638a6c65d1fc555cac163d | /app/src/main/java/com/example/httpserver/parsers/ByteBuffer.java | 86bde9fb09d8eae83a1f8efe99da7bd75416a78e | [] | no_license | henzigo/osmz-vsb | 71a9a8a69ea50017b510490bb8aaee20d9686060 | f99a896f6e2cdc710fa3ccd73a5cc3877112a35b | refs/heads/master | 2021-05-18T21:54:22.001098 | 2020-03-30T22:15:55 | 2020-03-30T22:15:55 | 251,440,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,455 | java | package com.example.httpserver.parsers;
import java.io.UnsupportedEncodingException;
public class ByteBuffer {
private byte[] buffer = new byte[1024];
private int offset = 0;
public void write(byte[] buffer, int offset, int length) {
this.reallocate(length);
System.arraycopy(buffer, offset, this.buffer, this.offset, length);
this.offset += length;
}
public void write(byte[] buffer) {
this.write(buffer, 0, buffer.length);
}
public void write(String data, String encoding) {
try {
this.write(data.getBytes(encoding));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
public void writeln(String data, String encoding) {
this.write(data, encoding);
this.write("\n", encoding);
}
public void write(String data) {
this.write(data, "UTF-8");
}
public void writeln(String data) {
this.writeln(data, "UTF-8");
}
public byte[] getBuffer() {
return this.buffer;
}
public int getSize() {
return this.offset;
}
private void reallocate(int length) {
if (length + this.offset > this.buffer.length) {
byte[] newBuffer = new byte[Math.max(this.buffer.length * 2, length + this.offset)];
System.arraycopy(this.buffer, 0, newBuffer, 0, this.offset);
this.buffer = newBuffer;
}
}
} | [
"jan.gorecki@shopsys.com"
] | jan.gorecki@shopsys.com |
2540d8a3cba80dcde5b9ba108fd368dd071b91c4 | 4036f135cd79bd509c600c6b377a83a5af174bc0 | /pragolan2/src/simulator/Tower.java | fe02d2933c4fe1009f67ff35e9f6b5c930031e9a | [] | no_license | Voiceless-Words/avaj-launcher | e56b288cc0e53a282126943a542a5c3cab4b41ee | 8c9b99286d7ed20978f66c4a7fb3d19f721d033e | refs/heads/master | 2020-06-11T03:22:52.718401 | 2019-12-12T12:45:09 | 2019-12-12T12:45:09 | 193,837,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package simulator;
import simulator.vehicles.Flyable;
import java.util.ArrayList;
import java.util.List;
public class Tower {
private List<Flyable> observers = new ArrayList<Flyable>();
public void register(Flyable flyable)
{
if (observers.contains(flyable))
return;
observers.add(flyable);
}
public void unregister(Flyable flyable)
{
observers.remove(flyable);
}
protected void conditionChanged()
{
for (int i = 0; i < observers.size(); i++)
{
observers.get(i).updateConditions();
}
}
}
| [
"pragolan@c4r16s4.wethinkcode.co.za"
] | pragolan@c4r16s4.wethinkcode.co.za |
7733803736b0099affa275c3b02c3b439500a649 | 70f6a9a1c5aaacba26063d9419fcc71d408cfe2c | /core/src/test/java/co/dlighthouse/aem/featuretoggles/core/schedulers/SimpleScheduledTaskTest.java | 8d1b84da908a6314c5ebed89f4d5d70cae92bec4 | [] | no_license | drginm/aem-feature-toggles | f82fa48b7b00fdb56d52ea69ad4513424b14a855 | 49909e22b84fde6d72af02d331cdc3020fdf9dcf | refs/heads/master | 2022-08-21T02:34:05.225855 | 2020-02-22T21:41:40 | 2020-02-22T21:41:40 | 242,415,527 | 0 | 0 | null | 2022-07-06T20:20:08 | 2020-02-22T21:40:13 | Java | UTF-8 | Java | false | false | 2,086 | java | /*
* Copyright 2018 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 co.dlighthouse.aem.featuretoggles.core.schedulers;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
import uk.org.lidalia.slf4jext.Level;
import uk.org.lidalia.slf4jtest.LoggingEvent;
import uk.org.lidalia.slf4jtest.TestLogger;
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ExtendWith(AemContextExtension.class)
class SimpleScheduledTaskTest {
private SimpleScheduledTask fixture = new SimpleScheduledTask();
private TestLogger logger = TestLoggerFactory.getTestLogger(fixture.getClass());
@BeforeEach
void setup() {
TestLoggerFactory.clear();
}
@Test
void run() {
SimpleScheduledTask.Config config = mock(SimpleScheduledTask.Config.class);
when(config.myParameter()).thenReturn("parameter value");
fixture.activate(config);
fixture.run();
List<LoggingEvent> events = logger.getLoggingEvents();
assertEquals(1, events.size());
LoggingEvent event = events.get(0);
assertEquals(Level.DEBUG, event.getLevel());
assertEquals(1, event.getArguments().size());
assertEquals("parameter value", event.getArguments().get(0));
}
}
| [
"drginm"
] | drginm |
d027cb713ce7332ed65053a4c35f5cd236e704e3 | d0af5a05a1d5c3794791cd737e251bdbadcc424a | /src/by/it/kopchik/lesson02/TaskA1.java | 2e9beb59f74dccf0071b31a75231a4b92a3a06be | [] | no_license | Losker/cs2018-06-04 | 412f9007149fb5b65778796f81c2295bcdc73593 | f45be04231fb4e10b04c015c721800caf171347d | refs/heads/master | 2020-03-19T09:55:51.702276 | 2018-06-17T21:50:48 | 2018-06-17T21:50:48 | 136,328,818 | 0 | 0 | null | 2018-06-06T12:56:57 | 2018-06-06T12:56:56 | null | UTF-8 | Java | false | false | 550 | java | package by.it.kopchik.lesson02;
/*
напишите программу которая выводит на экран
Hello world!
(строка должа быть одна, ошибки в тексте не допускаются)
Для ручной проверки запустите программу Ctrl+Shift+F10
Для автоматической проверки откройте и запустите класс Testing
*/
class TaskA1 {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
| [
"aaaa@aaaaa.aaa"
] | aaaa@aaaaa.aaa |
95e4c1e2f9677212ab7cb0ba0ab44a9c1b8a9b0f | 042ea4d393be8d5ec3221d380c33377d31e1fbfa | /src/com/demon/distributed/curator/barrier/package-info.java | 7f9c141f55c1182f27e4a5eb39c975ada51f5f42 | [] | no_license | windfish/essay | 7c9dc49784fb29a86923df475a574d0374284529 | a259ee0f05dbb33ecba57c8b71c57eee41302f77 | refs/heads/master | 2022-12-25T18:31:48.201767 | 2020-11-17T06:53:46 | 2020-11-17T06:53:46 | 55,202,008 | 8 | 1 | null | 2022-12-16T09:43:20 | 2016-04-01T03:46:55 | Java | UTF-8 | Java | false | false | 80 | java | /**
* 分布式栅栏Barrier
*/
package com.demon.distributed.curator.barrier; | [
"xuliang_1827@163.com"
] | xuliang_1827@163.com |
1f7917102b791c612e42ad3f9b038cc0f6ac8ee4 | 8358717b853f240843ffa56784773a29b1efc19e | /service-interface-wms/src/main/java/com/jumbo/webservice/sf/tw/vendor/command/ReqVendor.java | 0e1eae7a57b9f12e41343f07f932f0ff235f4f1b | [] | no_license | huanglongf/enterprise_project | 65ec3e2c56e4a2909f0881a9276a9966857bb9c7 | de1865e638c9620e702818124f0b2deac04028c9 | refs/heads/master | 2020-05-07T13:25:07.223338 | 2018-10-21T08:44:33 | 2018-10-21T08:44:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,286 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.01.28 at 10:41:01 ���� CST
//
package com.jumbo.webservice.sf.tw.vendor.command;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{}VendorCode"/>
* <element ref="{}VendorName"/>
* <element ref="{}AttentionTo"/>
* <element ref="{}PhoneNum"/>
* <element ref="{}Address"/>
* <element ref="{}ZipCode"/>
* <element ref="{}FaxNum"/>
* <element ref="{}EmailAddress"/>
* <element ref="{}Country"/>
* <element ref="{}Province"/>
* <element ref="{}City"/>
* <element ref="{}Area"/>
* <element ref="{}UserDef1"/>
* <element ref="{}UserDef2"/>
* <element ref="{}UserDef3"/>
* <element ref="{}UserDef4"/>
* <element ref="{}UserDef5"/>
* <element ref="{}UserDef6"/>
* <element ref="{}UserDef7"/>
* <element ref="{}UserDef8"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"vendorCode",
"vendorName",
"attentionTo",
"phoneNum",
"address",
"zipCode",
"faxNum",
"emailAddress",
"country",
"province",
"city",
"area",
"userDef1",
"userDef2",
"userDef3",
"userDef4",
"userDef5",
"userDef6",
"userDef7",
"userDef8"
})
@XmlRootElement(name = "Vendor")
public class ReqVendor {
@XmlElement(name = "VendorCode", required = true)
protected String vendorCode;
@XmlElement(name = "VendorName", required = true)
protected String vendorName;
@XmlElement(name = "AttentionTo", required = true)
protected String attentionTo;
@XmlElement(name = "PhoneNum", required = true)
protected String phoneNum;
@XmlElement(name = "Address", required = true)
protected String address;
@XmlElement(name = "ZipCode", required = true)
protected String zipCode;
@XmlElement(name = "FaxNum", required = true)
protected String faxNum;
@XmlElement(name = "EmailAddress", required = true)
protected String emailAddress;
@XmlElement(name = "Country", required = true)
protected String country;
@XmlElement(name = "Province", required = true)
protected String province;
@XmlElement(name = "City", required = true)
protected String city;
@XmlElement(name = "Area", required = true)
protected String area;
@XmlElement(name = "UserDef1", required = true)
protected String userDef1;
@XmlElement(name = "UserDef2", required = true)
protected String userDef2;
@XmlElement(name = "UserDef3", required = true)
protected String userDef3;
@XmlElement(name = "UserDef4", required = true)
protected String userDef4;
@XmlElement(name = "UserDef5", required = true)
protected String userDef5;
@XmlElement(name = "UserDef6", required = true)
protected String userDef6;
@XmlElement(name = "UserDef7", required = true)
protected String userDef7;
@XmlElement(name = "UserDef8", required = true)
protected String userDef8;
/**
* Gets the value of the vendorCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVendorCode() {
return vendorCode;
}
/**
* Sets the value of the vendorCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVendorCode(String value) {
this.vendorCode = value;
}
/**
* Gets the value of the vendorName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVendorName() {
return vendorName;
}
/**
* Sets the value of the vendorName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVendorName(String value) {
this.vendorName = value;
}
/**
* Gets the value of the attentionTo property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAttentionTo() {
return attentionTo;
}
/**
* Sets the value of the attentionTo property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAttentionTo(String value) {
this.attentionTo = value;
}
/**
* Gets the value of the phoneNum property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPhoneNum() {
return phoneNum;
}
/**
* Sets the value of the phoneNum property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPhoneNum(String value) {
this.phoneNum = value;
}
/**
* Gets the value of the address property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAddress() {
return address;
}
/**
* Sets the value of the address property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAddress(String value) {
this.address = value;
}
/**
* Gets the value of the zipCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getZipCode() {
return zipCode;
}
/**
* Sets the value of the zipCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setZipCode(String value) {
this.zipCode = value;
}
/**
* Gets the value of the faxNum property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFaxNum() {
return faxNum;
}
/**
* Sets the value of the faxNum property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFaxNum(String value) {
this.faxNum = value;
}
/**
* Gets the value of the emailAddress property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEmailAddress() {
return emailAddress;
}
/**
* Sets the value of the emailAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEmailAddress(String value) {
this.emailAddress = value;
}
/**
* Gets the value of the country property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCountry() {
return country;
}
/**
* Sets the value of the country property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCountry(String value) {
this.country = value;
}
/**
* Gets the value of the province property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProvince() {
return province;
}
/**
* Sets the value of the province property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setProvince(String value) {
this.province = value;
}
/**
* Gets the value of the city property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCity() {
return city;
}
/**
* Sets the value of the city property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCity(String value) {
this.city = value;
}
/**
* Gets the value of the area property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getArea() {
return area;
}
/**
* Sets the value of the area property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setArea(String value) {
this.area = value;
}
/**
* Gets the value of the userDef1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDef1() {
return userDef1;
}
/**
* Sets the value of the userDef1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDef1(String value) {
this.userDef1 = value;
}
/**
* Gets the value of the userDef2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDef2() {
return userDef2;
}
/**
* Sets the value of the userDef2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDef2(String value) {
this.userDef2 = value;
}
/**
* Gets the value of the userDef3 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDef3() {
return userDef3;
}
/**
* Sets the value of the userDef3 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDef3(String value) {
this.userDef3 = value;
}
/**
* Gets the value of the userDef4 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDef4() {
return userDef4;
}
/**
* Sets the value of the userDef4 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDef4(String value) {
this.userDef4 = value;
}
/**
* Gets the value of the userDef5 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDef5() {
return userDef5;
}
/**
* Sets the value of the userDef5 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDef5(String value) {
this.userDef5 = value;
}
/**
* Gets the value of the userDef6 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDef6() {
return userDef6;
}
/**
* Sets the value of the userDef6 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDef6(String value) {
this.userDef6 = value;
}
/**
* Gets the value of the userDef7 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDef7() {
return userDef7;
}
/**
* Sets the value of the userDef7 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDef7(String value) {
this.userDef7 = value;
}
/**
* Gets the value of the userDef8 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDef8() {
return userDef8;
}
/**
* Sets the value of the userDef8 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDef8(String value) {
this.userDef8 = value;
}
}
| [
"lijg@many-it.com"
] | lijg@many-it.com |
58dde194da7b6c4678c047f70c9b6f5e3b32a426 | 9cdf4a803b5851915b53edaeead2546f788bddc6 | /machinelearning/5.0/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/ui/LHSDSLSentenceWidget.java | 2c46af364fb55e9eea7b229122c9bf09445d0458 | [
"Apache-2.0"
] | permissive | kiegroup/droolsjbpm-contributed-experiments | 8051a70cfa39f18bc3baa12ca819a44cc7146700 | 6f032d28323beedae711a91f70960bf06ee351e5 | refs/heads/master | 2023-06-01T06:11:42.641550 | 2020-07-15T15:09:02 | 2020-07-15T15:09:02 | 1,184,582 | 1 | 13 | null | 2021-06-24T08:45:52 | 2010-12-20T15:42:26 | Java | UTF-8 | Java | false | false | 1,027 | java | package org.drools.eclipse.rulebuilder.ui;
import org.drools.guvnor.client.modeldriven.brl.DSLSentence;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
public class LHSDSLSentenceWidget extends DSLSentenceWidget {
public LHSDSLSentenceWidget(FormToolkit toolkit,
Composite parent,
DSLSentence sentence,
RuleModeller modeller,
int index) {
super( toolkit,
parent,
sentence,
modeller,
index );
}
protected void updateModel() {
if ( getModeller().getModel().removeLhsItem( index ) ) {
getModeller().reloadLhs();
} else {
showMessage( "Can't remove that item as it is used in the action part of the rule." );
}
getModeller().reloadLhs();
getModeller().setDirty( true );
}
}
| [
"gizil.oguz@gmail.com"
] | gizil.oguz@gmail.com |
ba013331874d533022d48c4c738fce9f14c9b7a5 | edfa5bce7cf79567ebed678de5c01654d39e10ec | /src/java/util/concurrent/FutureTask.java | 3c75a7cec530a9a3d3c65e1005918ab62b74f234 | [] | no_license | JulyJunWu/jdk-source-analysis | 856794de80f9ff957d06d5d8cdb6d7db9d3a018b | 0eb2f85d67882efb786f73cbad9e88800e09baa5 | refs/heads/master | 2021-03-08T12:20:42.221644 | 2020-03-22T06:33:09 | 2020-03-22T06:33:09 | 246,344,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,154 | java | /*
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
/*
*
*
*
*
*
* Written by Doug Lea with assistance from members of JCP JSR-166
* Expert Group and released to the public domain, as explained at
* http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util.concurrent;
import java.util.concurrent.locks.LockSupport;
/**
* A cancellable asynchronous computation. This class provides a base
* implementation of {@link Future}, with methods to start and cancel
* a computation, query to see if the computation is complete, and
* retrieve the result of the computation. The result can only be
* retrieved when the computation has completed; the {@code get}
* methods will block if the computation has not yet completed. Once
* the computation has completed, the computation cannot be restarted
* or cancelled (unless the computation is invoked using
* {@link #runAndReset}).
*
* <p>A {@code FutureTask} can be used to wrap a {@link Callable} or
* {@link Runnable} object. Because {@code FutureTask} implements
* {@code Runnable}, a {@code FutureTask} can be submitted to an
* {@link Executor} for execution.
*
* <p>In addition to serving as a standalone class, this class provides
* {@code protected} functionality that may be useful when creating
* customized task classes.
*
* @since 1.5
* @author Doug Lea
* @param <V> The result type returned by this FutureTask's {@code get} methods
*/
public class FutureTask<V> implements RunnableFuture<V> {
/*
* Revision notes: This differs from previous versions of this
* class that relied on AbstractQueuedSynchronizer, mainly to
* avoid surprising users about retaining interrupt status during
* cancellation races. Sync control in the current design relies
* on a "state" field updated via CAS to track completion, along
* with a simple Treiber stack to hold waiting threads.
*
* Style note: As usual, we bypass overhead of using
* AtomicXFieldUpdaters and instead directly use Unsafe intrinsics.
*/
/**
* The run state of this task, initially NEW. The run state
* transitions to a terminal state only in methods set,
* setException, and cancel. During completion, state may take on
* transient values of COMPLETING (while outcome is being set) or
* INTERRUPTING (only while interrupting the runner to satisfy a
* cancel(true)). Transitions from these intermediate to final
* states use cheaper ordered/lazy writes because values are unique
* and cannot be further modified.
*
* Possible state transitions:
* NEW -> COMPLETING -> NORMAL
* NEW -> COMPLETING -> EXCEPTIONAL
* NEW -> CANCELLED
* NEW -> INTERRUPTING -> INTERRUPTED
*/
// 当前任务的状态
private volatile int state;
private static final int NEW = 0;
private static final int COMPLETING = 1;
private static final int NORMAL = 2;
private static final int EXCEPTIONAL = 3;
private static final int CANCELLED = 4;
private static final int INTERRUPTING = 5;
private static final int INTERRUPTED = 6;
/** The underlying callable; nulled out after running */
private Callable<V> callable;
/** The result to return or exception to throw from get()
* 这玩意就是我们get()的值
**/
private Object outcome; // non-volatile, protected by state reads/writes
/** The thread running the callable; CASed during run() */
private volatile Thread runner;
/** Treiber stack of waiting threads */
private volatile WaitNode waiters;
/**
* Returns result or throws exception for completed task.
*
* @param s completed state value
*/
@SuppressWarnings("unchecked")
private V report(int s) throws ExecutionException {
Object x = outcome;
if (s == NORMAL)
return (V)x;
if (s >= CANCELLED)
throw new CancellationException();
throw new ExecutionException((Throwable)x);
}
/**
* Creates a {@code FutureTask} that will, upon running, execute the
* given {@code Callable}.
*
* @param callable the callable task
* @throws NullPointerException if the callable is null
*/
public FutureTask(Callable<V> callable) {
if (callable == null)
throw new NullPointerException();
this.callable = callable;
this.state = NEW; // ensure visibility of callable
}
/**
* Creates a {@code FutureTask} that will, upon running, execute the
* given {@code Runnable}, and arrange that {@code get} will return the
* given result on successful completion.
*
* @param runnable the runnable task
* @param result the result to return on successful completion. If
* you don't need a particular result, consider using
* constructions of the form:
* {@code Future<?> f = new FutureTask<Void>(runnable, null)}
* @throws NullPointerException if the runnable is null
*/
public FutureTask(Runnable runnable, V result) {
this.callable = Executors.callable(runnable, result);
this.state = NEW; // ensure visibility of callable
}
public boolean isCancelled() {
return state >= CANCELLED;
}
public boolean isDone() {
return state != NEW;
}
public boolean cancel(boolean mayInterruptIfRunning) {
if (!(state == NEW &&
UNSAFE.compareAndSwapInt(this, stateOffset, NEW,
mayInterruptIfRunning ? INTERRUPTING : CANCELLED)))
return false;
try { // in case call to interrupt throws exception
if (mayInterruptIfRunning) {
try {
Thread t = runner;
if (t != null)
t.interrupt();
} finally { // final state
UNSAFE.putOrderedInt(this, stateOffset, INTERRUPTED);
}
}
} finally {
finishCompletion();
}
return true;
}
/**
* @throws CancellationException {@inheritDoc}
*/
public V get() throws InterruptedException, ExecutionException {
int s = state;
if (s <= COMPLETING)
s = awaitDone(false, 0L);
return report(s);
}
/**
* @throws CancellationException {@inheritDoc}
*/
public V get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
if (unit == null)
throw new NullPointerException();
int s = state;
if (s <= COMPLETING &&
(s = awaitDone(true, unit.toNanos(timeout))) <= COMPLETING)
throw new TimeoutException();
return report(s);
}
/**
* Protected method invoked when this task transitions to state
* {@code isDone} (whether normally or via cancellation). The
* default implementation does nothing. Subclasses may override
* this method to invoke completion callbacks or perform
* bookkeeping. Note that you can query status inside the
* implementation of this method to determine whether this task
* has been cancelled.
*/
protected void done() { }
/**
* Sets the result of this future to the given value unless
* this future has already been set or has been cancelled.
*
* <p>This method is invoked internally by the {@link #run} method
* upon successful completion of the computation.
*
* @param v the value
*/
protected void set(V v) {
//通过CAS设置 任务的状态为完成
if (UNSAFE.compareAndSwapInt(this, stateOffset, NEW, COMPLETING)) {
outcome = v;
UNSAFE.putOrderedInt(this, stateOffset, NORMAL); // final state
finishCompletion();
}
}
/**
* Causes this future to report an {@link ExecutionException}
* with the given throwable as its cause, unless this future has
* already been set or has been cancelled.
*
* <p>This method is invoked internally by the {@link #run} method
* upon failure of the computation.
*
* @param t the cause of failure
*/
protected void setException(Throwable t) {
if (UNSAFE.compareAndSwapInt(this, stateOffset, NEW, COMPLETING)) {
outcome = t;
UNSAFE.putOrderedInt(this, stateOffset, EXCEPTIONAL); // final state
finishCompletion();
}
}
public void run() {
if (state != NEW ||
!UNSAFE.compareAndSwapObject(this, runnerOffset,
null, Thread.currentThread()))
return;
try {
Callable<V> c = callable;
if (c != null && state == NEW) {
V result;
boolean ran;
try {
result = c.call();
ran = true;
} catch (Throwable ex) {
result = null;
ran = false;
setException(ex);
}
if (ran)
//设置执行结果,唤醒其他等待结果的线程
set(result);
}
} finally {
// runner must be non-null until state is settled to
// prevent concurrent calls to run()
runner = null;
// state must be re-read after nulling runner to prevent
// leaked interrupts
int s = state;
if (s >= INTERRUPTING)
handlePossibleCancellationInterrupt(s);
}
}
/**
* Executes the computation without setting its result, and then
* resets this future to initial state, failing to do so if the
* computation encounters an exception or is cancelled. This is
* designed for use with tasks that intrinsically execute more
* than once.
*
* @return {@code true} if successfully run and reset
*/
protected boolean runAndReset() {
if (state != NEW ||
!UNSAFE.compareAndSwapObject(this, runnerOffset,
null, Thread.currentThread()))
return false;
boolean ran = false;
int s = state;
try {
Callable<V> c = callable;
if (c != null && s == NEW) {
try {
//执行我们的任务
c.call(); // don't set result
ran = true;
} catch (Throwable ex) {
setException(ex);
}
}
} finally {
// runner must be non-null until state is settled to
// prevent concurrent calls to run()
runner = null;
// state must be re-read after nulling runner to prevent
// leaked interrupts
s = state;
if (s >= INTERRUPTING)
handlePossibleCancellationInterrupt(s);
}
return ran && s == NEW;
}
/**
* Ensures that any interrupt from a possible cancel(true) is only
* delivered to a task while in run or runAndReset.
*/
private void handlePossibleCancellationInterrupt(int s) {
// It is possible for our interrupter to stall before getting a
// chance to interrupt us. Let's spin-wait patiently.
if (s == INTERRUPTING)
while (state == INTERRUPTING)
Thread.yield(); // wait out pending interrupt
// assert state == INTERRUPTED;
// We want to clear any interrupt we may have received from
// cancel(true). However, it is permissible to use interrupts
// as an independent mechanism for a task to communicate with
// its caller, and there is no way to clear only the
// cancellation interrupt.
//
// Thread.interrupted();
}
/**
* Simple linked list nodes to record waiting threads in a Treiber
* stack. See other classes such as Phaser and SynchronousQueue
* for more detailed explanation.
*/
static final class WaitNode {
volatile Thread thread;
volatile WaitNode next;
WaitNode() { thread = Thread.currentThread(); }
}
/**
* Removes and signals all waiting threads, invokes done(), and
* nulls out callable.
*
* 执行任务完毕,唤醒等待结果的线程
*/
private void finishCompletion() {
// assert state > COMPLETING;
for (WaitNode q; (q = waiters) != null;) {
if (UNSAFE.compareAndSwapObject(this, waitersOffset, q, null)) {
for (;;) {
Thread t = q.thread;
if (t != null) {
q.thread = null;
//唤醒线程
LockSupport.unpark(t);
}
WaitNode next = q.next;
if (next == null)
break;
q.next = null; // unlink to help gc
q = next;
}
break;
}
}
done();
callable = null; // to reduce footprint
}
/**
* Awaits completion or aborts on interrupt or timeout.
*
* @param timed true if use timed waits
* @param nanos time to wait, if timed
* @return state upon completion
*/
private int awaitDone(boolean timed, long nanos)
throws InterruptedException {
final long deadline = timed ? System.nanoTime() + nanos : 0L;
WaitNode q = null;
boolean queued = false;
for (;;) {
//是否被中断
if (Thread.interrupted()) {
removeWaiter(q);
throw new InterruptedException();
}
int s = state;
//如果当前任务已经完成
if (s > COMPLETING) {
if (q != null)
q.thread = null;
return s;
}
else if (s == COMPLETING) // cannot time out yet
Thread.yield();
else if (q == null)
q = new WaitNode();
else if (!queued)
//通过CAS将当前WaitNode(就是q)设置为waiter
queued = UNSAFE.compareAndSwapObject(this, waitersOffset,
q.next = waiters, q);
else if (timed) {
nanos = deadline - System.nanoTime();
if (nanos <= 0L) {
removeWaiter(q);
return state;
}
//阻塞一定时间
LockSupport.parkNanos(this, nanos);
}
else
//完全阻塞,等待唤醒
LockSupport.park(this);
}
}
/**
* Tries to unlink a timed-out or interrupted wait node to avoid
* accumulating garbage. Internal nodes are simply unspliced
* without CAS since it is harmless if they are traversed anyway
* by releasers. To avoid effects of unsplicing from already
* removed nodes, the list is retraversed in case of an apparent
* race. This is slow when there are a lot of nodes, but we don't
* expect lists to be long enough to outweigh higher-overhead
* schemes.
*/
private void removeWaiter(WaitNode node) {
if (node != null) {
node.thread = null;
retry:
for (;;) { // restart on removeWaiter race
for (WaitNode pred = null, q = waiters, s; q != null; q = s) {
s = q.next;
if (q.thread != null)
pred = q;
else if (pred != null) {
pred.next = s;
if (pred.thread == null) // check for race
continue retry;
}
else if (!UNSAFE.compareAndSwapObject(this, waitersOffset,
q, s))
continue retry;
}
break;
}
}
}
// Unsafe mechanics
private static final sun.misc.Unsafe UNSAFE;
private static final long stateOffset;
private static final long runnerOffset;
private static final long waitersOffset;
static {
try {
UNSAFE = sun.misc.Unsafe.getUnsafe();
Class<?> k = FutureTask.class;
stateOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("state"));
runnerOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("runner"));
waitersOffset = UNSAFE.objectFieldOffset
(k.getDeclaredField("waiters"));
} catch (Exception e) {
throw new Error(e);
}
}
}
| [
"djian@linewell.com"
] | djian@linewell.com |
8fbb0b216802389bbb8ef86228b6b9cba1c381d6 | 2a86cc5a14d2facf6e0a3b8472aab3bd259ed5ce | /openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/components/properties/type/Property.java | 20b54757f14d1bc7436f4cb6a48098f325a18664 | [
"MIT",
"CC-BY-4.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jiangtaojiang/opentcs | 8d0e0ecf71e87e912b82f139671107c26c75364a | 96eceed8ea95f4aa9f5e5f09c0c96abc5bce6504 | refs/heads/master | 2023-08-03T22:37:33.838443 | 2021-10-06T16:09:08 | 2021-10-06T16:09:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,489 | java | /**
* Copyright (c) The openTCS Authors.
*
* This program is free software and subject to the MIT license. (For details,
* see the licensing information (LICENSE.txt) you should have received with
* this copy of the software.)
*/
package org.opentcs.guing.components.properties.type;
/**
* Interface für Attribute. Die Attribute arbeiten als Wrapper, d.h. sie
* erlauben den Zugriff auf ihre Daten, ohne dabei jedoch ein neues
* Attribut-Objekt zu erzeugen. Die Datentypen String, Boolean, Integer usw.
* bieten dieses nicht, so dass die Veränderung eines Attributs zu einem neuen
* Attribut führen würde. Ergebnis wäre das ständige Setzen der Attribute im
* Datenobjekt.
* Vorteil der hier eingesetzten Methode ist, dass das Attribut-Objekt selbst
* stets dasselbe bleibt, dessen Inhalt sich jedoch ändern lässt.
*
* @author Sebastian Naumann (ifak e.V. Magdeburg)
*/
public interface Property
extends ModelAttribute,
Cloneable {
/**
* Übernimmt die Werte von dem übergebenen Attribut. Die Eigenschaften
* Visibility, Editable usw. werden jedoch nicht übernommen.
*
* @param property The property.
*/
void copyFrom(Property property);
/**
* Returns a comparable represantation of the value of this property.
*
* @return A represantation to compare this property to other ones.
*/
Object getComparableValue();
/**
* Klont das Property.
*
* @return The cloned property.
*/
Object clone();
}
| [
"stefan.walter@iml.fraunhofer.de"
] | stefan.walter@iml.fraunhofer.de |
c437030211cc7d9b2581a12bb529bde3c1c16ebb | fa2c6f9d77c185d47e8072033a64a329c513f798 | /src/sortTest/InsertSort.java | c38d990f5605a1c47c9ef65bfc3188f1fa3ee948 | [] | no_license | HLOVET/algorithms | ac5b26778d2d7f69f2bbab4a6328903ec41f8574 | 437cff0fd49ffe414f77e2061e726367c98ad2e5 | refs/heads/master | 2022-01-20T03:28:24.329477 | 2019-07-24T02:55:26 | 2019-07-24T02:55:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,120 | java | package sortTest;
public class InsertSort {
//test
public static void main(String[] args) {
int[] arr = {1, 3, 4, 5, 2, 6, 9, 7, 8, 0};
ShellSort.sortCore(arr);
for(Integer ele:arr){
System.out.print(ele+" ");
}
}
//1.简单插入排序,像一个有序序列中不断插入元素o(n2)
//选择排序,插入排序等
//2.shell排序(属于插入排序),逐步缩小增量 多种增量序列供选择{n/2,(n/2)/2,...,1}等 最差O(n2)
public static class ShellSort{
public static void sortCore(int[] arr){
//逐步缩小增量gap
for(int gap=arr.length/2;gap>0;gap/=2){
//将数组分成以gap为步长的多个数组,逐个对小分组进行直接插入排序
for(int i=gap;i<arr.length;i++){
int j = i;
//左边元素大于右边,交换继续
while(j-gap>=0 && arr[j]<arr[j-gap]){
swap(arr,j,j-gap);
j-=gap;
}
}
}
}
private static void swap(int[] arr,int a,int b){
arr[a] = arr[a]+arr[b];
arr[b] = arr[a]-arr[b];
arr[a] = arr[a]-arr[b];
}
}
}
| [
"hlovet128@gmail.com"
] | hlovet128@gmail.com |
f14901ee6145d6c217c4c73a825d9fecb38f3a26 | 07eb699b94d404063c2509f22f9c05c61aae3b12 | /arguments_parser/src/main/java/com.anotheria.bootcamp.arguments_parser/InvalidArgumentException.java | 7085b63fa83985cac74e4f82e1e29fbad7f17129 | [] | no_license | ogmudbone/bootcamp | 8ca72b7c32e5ac02c50f7cd74bde5e50a2873f17 | 4e508062d28150a8524ba70686a0907b4a7e3224 | refs/heads/master | 2021-01-11T23:09:54.025190 | 2017-03-07T12:56:06 | 2017-03-07T12:56:06 | 78,554,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package com.anotheria.bootcamp.arguments_parser;
public class InvalidArgumentException extends Exception {
public InvalidArgumentException() {
}
public InvalidArgumentException(String s) {
super(s);
}
}
| [
"submitthesatan666@gmail.com"
] | submitthesatan666@gmail.com |
eb1a1a53944cac15aad33abc22143d038a963ac2 | 71eae1c8f20c7e29f9ed612ab9f0d553a52e6754 | /src/main/java/org/ryebread/algorithmplayground/AlgorithmPlaygroundApplication.java | abb5898416f74ddb18c93ec7fee5c345ff3e4c21 | [] | no_license | ryebr3ad/algorithm_playground_java | dba8cd9c3b6f7eaf4978901249e7f018854722e5 | 401abeb0aa19eefaf871cf053b00ca818ed5f17d | refs/heads/main | 2023-03-09T09:03:05.558598 | 2021-02-17T01:49:07 | 2021-02-17T01:49:07 | 333,624,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package org.ryebread.algorithmplayground;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AlgorithmPlaygroundApplication {
public static void main(String[] args) {
SpringApplication.run(AlgorithmPlaygroundApplication.class, args);
}
}
| [
"rprauschenberg@gmail.com"
] | rprauschenberg@gmail.com |
487e5ecb60897ec7e3d705b305a9cfd7d4d67f58 | 6a89edc9a8915abf7a65f9d867b880c04a93bf0a | /the_core/list_forest_edge/makeArrayConsecutive2.java | fddecb1ee04cc94187f6258a47b88ac1009163ee | [] | no_license | ntnprdhmm/codefights | eb3e9a7261be45b71d1105472222b1b7d8dc55f2 | 543781db759e32f4857ef3769197c42d2b43f843 | refs/heads/master | 2022-09-16T05:01:34.531343 | 2018-05-18T19:41:42 | 2018-05-18T19:41:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | int makeArrayConsecutive2(int[] statues) {
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for (int i = 0; i < statues.length; i++) {
min = Math.min(min, statues[i]);
max = Math.max(max, statues[i]);
}
return (max - min) + 1 - statues.length;
}
| [
"antoineprudhomme5@gmail.com"
] | antoineprudhomme5@gmail.com |
f6f88d3740f934f3cb20b169ed1515bbd12a8615 | 2e8bfad08c759db33d3e31d9a4e0ef7cf3bd2592 | /app/src/main/java/com/example/konrad/apzumiproject/APIdataSearcherBitbucket.java | afd4ad968d025d8af12635dc363c2a1bc926af7e | [] | no_license | KonradSar/OldProjects | 00b1579a7bac660e97ee2f5af124fd29c334e7fe | 4d510930fb74eb52ee43c0fc70e8f775cd28fa9c | refs/heads/master | 2020-03-25T22:09:55.406817 | 2018-08-09T22:21:37 | 2018-08-09T22:21:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,922 | java | package com.example.konrad.apzumiproject;
import android.os.AsyncTask;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import static com.example.konrad.apzumiproject.GeneralMethods.apiResults;
/**
* Created by Konrad on 08.08.2018.
*/
// Uzywamy asyncTaskow w celu pobrania danych dzieki API. Nie blokujemy glownego watku a zadanie leci sobie nezaleznie w tle
public class APIdataSearcherBitbucket extends AsyncTask<Object, Object, List<APIResults>> {
@Override
protected List<APIResults> doInBackground(Object... params) {
URL url = null;
// Pamietamy o wyczyszczeniu listy przed ponownym pobraniem danych
apiResults.clear();
try {
url = new URL("https://api.bitbucket.org/2.0/repositories?fields=values.name,values.owner,values.description");
HttpURLConnection http = (HttpURLConnection) url.openConnection();
http.setRequestMethod("GET");
http.connect();
int responseCode = http.getResponseCode();
if (responseCode == 200) { //jeżeli ok TO:
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(http.getInputStream()));
String line = null;
StringBuilder stringBuilder = new StringBuilder();
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line);
}
// Wchodzimy do tablicy ktora wyciagamy z obiektu
JSONObject jsonObject = new JSONObject(stringBuilder.toString());
JSONArray valuesArray = (JSONArray) jsonObject.get("values");
// Przechodzimy po tablicy i wyciagamy kolejne elementy
List<APIResults> objectsList = new ArrayList<>();
for (int i = 0; i < valuesArray.length(); i++) {
JSONObject obj = (JSONObject) valuesArray.get(i);
// Wchodzimy jeszcze glebiej i wyciagamy konkretne dane z obiektu tablicy
JSONObject singleObjOwner = (JSONObject) obj.get("owner");
// Wchodzimy jeden poziom glebiej i wyciagamy description
// JSONObject descriptionForUser = (JSONObject) obj.get("description");
String descriptionForUser = (String) obj.get("description");
// Wchodzimy jeszcze glebiej wyciagajac username
// JSONObject userName = (JSONObject) singleObjOwner.get("username");
String nameOfUserStringFormat = (String) singleObjOwner.get("username");
JSONObject linksObject = (JSONObject) singleObjOwner.get("links");
JSONObject awatarObject = (JSONObject) linksObject.get("avatar");
// JSONObject finalAwatarLink = (JSONObject) awatarObject.get("href");
String finalAwatarStringFormat = (String) awatarObject.get("href");
objectsList.add(i, new APIResults(nameOfUserStringFormat, "BITBUCKET", finalAwatarStringFormat, true, descriptionForUser));
apiResults.add(i, objectsList.get(i));
}
} else {
System.out.println("tabla nie obsluzona");
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}catch (RuntimeException e) {
e.printStackTrace();
}
return apiResults;
}
} | [
"konradsar2015@gmail.com"
] | konradsar2015@gmail.com |
a41a1f308d43e623c163fe8babdd0cce872255b8 | 56bad03af76ed9189d708a90d98963fda4cb6c53 | /src/edu/umass/cs/gnsserver/utils/CertificateSigning.java | 0359a28b7ab008abac448da2e32493e32ee5e5d8 | [
"Apache-2.0"
] | permissive | vava24680/GNS | 76a89827a0a8c65d0d686e1fe33c301f86c6bf55 | 1eb5524457e0075dc9f451bd66e39f9291052eb8 | refs/heads/master | 2020-12-08T17:03:35.677846 | 2019-07-24T17:15:34 | 2019-07-24T17:15:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,487 | java | package edu.umass.cs.gnsserver.utils;
import edu.umass.cs.gnscommon.GNSProtocol;
import edu.umass.cs.gnscommon.SharedGuidUtils;
import edu.umass.cs.gnsserver.main.GNSConfig;
import org.json.JSONException;
import org.json.JSONObject;
import sun.security.tools.keytool.CertAndKeyGen;
import sun.security.x509.X500Name;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.*;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Properties;
/**
* A class to generate signed certificates for pre-approved account names and
* keys. An account GUID is required in order to do anything except
* world-accessible operations with the GNS.
*
* @author arun
*/
public class CertificateSigning {
public static final int CERT_BITLENGTH = 2048;
/**
* Generates a certificate from the supplied [name, publickey] tuple.
* Suffices to self-sign because the only place where this certificate is
* checked is at servers.
*
* @param hrName
* @param publicKey
* @return
* @throws NoSuchProviderException
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
* @throws IOException
* @throws CertificateException
* @throws SignatureException
* @throws JSONException
* @throws UnrecoverableKeyException
* @throws KeyStoreException
*/
public static Certificate generateCertificate(String hrName, PublicKey
publicKey) throws NoSuchProviderException, NoSuchAlgorithmException,
InvalidKeyException, IOException, CertificateException,
SignatureException, JSONException, UnrecoverableKeyException,
KeyStoreException {
// read private key from keyStore
PrivateKey caPrivateKey = GNSConfig.getPrivateKey();
CertAndKeyGen certGen = new CertAndKeyGen("RSA", "SHA256WithRSA",
null);
certGen.generate(CERT_BITLENGTH);
long validSecs = (long) 365 * 24 * 60 * 60; // one year
String certInfo = genCertInfoString(hrName, publicKey);
X509Certificate cert = certGen.getSelfCertificate(
// enter your details according to your application
new X500Name(certInfo), validSecs);
return cert;
}
private static String genCertInfoString(String hrName, PublicKey
publicKey) throws JSONException {
return new JSONObject().put(GNSProtocol.NAME.toString(), hrName).put
(GNSProtocol.PUBLIC_KEY.toString(), SharedGuidUtils
.getPublicKeyString(publicKey)).toString();
}
}
| [
"arun@cs.umass.edu"
] | arun@cs.umass.edu |
343ebe1e4f69a0aae34d93abc7f58603cf7563c9 | 7aa41e4a99307bea121121b4cdf67c457b97a129 | /src/com/jiaoyang/base/caching/ImageResizer.java | a70d48bbe6978c1f3e24cbe29151585ad7b71816 | [] | no_license | wangpan2011/sun-tv | 6e7a84075b3b839d76b7da56153189ffe2dda0d9 | 40e6c807565b421763757ed769175da8877b0b83 | refs/heads/master | 2016-09-05T20:37:34.776959 | 2014-09-02T09:20:36 | 2014-09-02T09:20:36 | 22,907,085 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,686 | java | package com.jiaoyang.base.caching;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.jiaoyang.tv.util.Logger;
/**
* A simple subclass of {@link ImageWorker} that resizes images from resources given a target width and height. Useful
* for when the input images might be too large to simply load directly into memory.
*/
public class ImageResizer extends ImageWorker {
private static final Logger LOG = Logger.getLogger(ImageResizer.class);
protected int mImageWidth;
protected int mImageHeight;
/**
* Initialize providing a single target image size (used for both width and height);
*
* @param context
* @param imageWidth
* @param imageHeight
*/
public ImageResizer(Context context, int imageWidth, int imageHeight) {
super(context);
mLoadingImageResId = -1;
setImageSize(imageWidth, imageHeight);
}
/**
* Initialize providing a single target image size (used for both width and height);
*
* @param context
* @param imageSize
*/
public ImageResizer(Context context, int imageSize) {
super(context);
setImageSize(imageSize);
}
/**
* Set the target image width and height.
*
* @param width
* @param height
*/
public void setImageSize(int width, int height) {
mImageWidth = width;
mImageHeight = height;
}
/**
* Set the target image size (width and height will be the same).
*
* @param size
*/
public void setImageSize(int size) {
setImageSize(size, size);
}
/**
* The main processing method. This happens in a background task. In this case we are just sampling down the bitmap
* and returning it from a resource.
*
* @param resId
* @return
*/
private Bitmap processBitmap(int resId) {
Bitmap bitmap = null;
String key = Integer.toString(resId, 16);
ImageCache cache = getImageCache();
bitmap = cache.getBitmapFromMemCache(key);
if (bitmap == null) {
LOG.debug("process bitmap. resId={}", key);
bitmap = decodeSampledBitmapFromResource(mContext.getResources(), resId, mImageWidth, mImageHeight);
cache.addBitmapToCache(key, bitmap);
} else {
LOG.debug("process bitmap in cache. resId={}", key);
}
return bitmap;
}
@Override
protected Bitmap processBitmap(Object data) {
return processBitmap(Integer.parseInt(String.valueOf(data)));
}
/**
* Decode and sample down a bitmap from resources to the requested width and height.
*
* @param res
* The resources object containing the image data
* @param resId
* The resource id of the image data
* @param reqWidth
* The requested width of the resulting bitmap
* @param reqHeight
* The requested height of the resulting bitmap
* @return A bitmap sampled down from the original with the same aspect ratio and dimensions that are equal to or
* greater than the requested width and height
*/
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeResource(res, resId, options);
}
/**
* Decode and sample down a bitmap from a file to the requested width and height.
*
* @param filename
* The full path of the file to decode
* @param reqWidth
* The requested width of the resulting bitmap
* @param reqHeight
* The requested height of the resulting bitmap
* @return A bitmap sampled down from the original with the same aspect ratio and dimensions that are equal to or
* greater than the requested width and height
*/
public static synchronized Bitmap decodeSampledBitmapFromFile(String filename,
int reqWidth, int reqHeight, final int maxNumOfPixels) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(filename, options);
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(filename, options);
}
/**
* Calculate an inSampleSize for use in a {@link BitmapFactory.Options} object when decoding bitmaps using the
* decode* methods from {@link BitmapFactory}. This implementation calculates the closest inSampleSize that will
* result in the final decoded bitmap having a width and height equal to or larger than the requested width and
* height. This implementation does not ensure a power of 2 is returned for inSampleSize which can be faster when
* decoding but results in a larger bitmap which isn't as useful for caching purposes.
*
* @param options
* An options object with out* params already populated (run through a decode* method with
* inJustDecodeBounds==true
* @param reqWidth
* The requested width of the resulting bitmap
* @param reqHeight
* The requested height of the resulting bitmap
* @return The value to be used for inSampleSize
*/
public static int calculateInSampleSize(BitmapFactory.Options options,
int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
if (width > height) {
inSampleSize = Math.round((float) height / (float) reqHeight);
} else {
inSampleSize = Math.round((float) width / (float) reqWidth);
}
// This offers some additional logic in case the image has a strange
// aspect ratio. For example, a panorama may have a much larger
// width than height. In these cases the total pixels might still
// end up being too large to fit comfortably in memory, so we should
// be more aggressive with sample down the image (=larger
// inSampleSize).
final float totalPixels = width * height;
// Anything more than 2x the requested pixels we'll sample down
// further.
final float totalReqPixelsCap = reqWidth * reqHeight * 2;
while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) {
inSampleSize++;
}
}
return inSampleSize;
}
public void setLoadingImage(int resId) {
if (mLoadingImageResId != resId) {
setLoadingImage(processBitmap(resId));
mLoadingImageResId = resId;
}
}
}
| [
"van.gogh@foxmail.com"
] | van.gogh@foxmail.com |
40c458fc6283d15b0bd27be30bcbe4dfad5448f4 | e44b4326ba380b19609015b9ff9f36109f898995 | /com.pilosa.client/src/main/java/com/pilosa/client/status/IndexInfo.java | 5ba58859ab3e3d506109571ec68079e04ade08ae | [
"BSD-3-Clause"
] | permissive | benbjohnson/java-pilosa | 22c558f87d975901448b963c702dd996b584cea9 | 565cd27e037769ed320b0fecda3135406a815b51 | refs/heads/master | 2021-09-04T02:54:56.684269 | 2017-10-31T14:03:00 | 2017-10-31T14:03:00 | 107,995,295 | 0 | 0 | BSD-3-Clause | 2018-11-02T09:43:59 | 2017-10-23T14:40:08 | Java | UTF-8 | Java | false | false | 3,043 | java | /*
* Copyright 2017 Pilosa Corp.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package com.pilosa.client.status;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.pilosa.client.TimeQuantum;
import com.pilosa.client.orm.IndexOptions;
import java.util.ArrayList;
import java.util.List;
public final class IndexInfo {
IndexInfo() {
}
public IndexOptions getOptions() {
return this.meta.getOptions();
}
@JsonProperty("Name")
public String getName() {
return this.name;
}
void setName(String name) {
this.name = name;
}
@JsonProperty("Frames")
public List<FrameInfo> getFrames() {
return this.frames;
}
public void setFrames(List<FrameInfo> frames) {
this.frames = frames;
}
@JsonProperty("Meta")
void setMeta(IndexMeta meta) {
this.meta = meta;
}
private String name;
private List<FrameInfo> frames = new ArrayList<>();
private IndexMeta meta;
}
final class IndexMeta {
IndexOptions getOptions() {
return IndexOptions.builder()
.setColumnLabel(this.columnLabel)
.setTimeQuantum(this.timeQuantum)
.build();
}
@JsonProperty("ColumnLabel")
void setColumnLabel(String columnLabel) {
this.columnLabel = columnLabel;
}
@JsonProperty("TimeQuantum")
void setTimeQuantum(String s) {
this.timeQuantum = TimeQuantum.fromString(s);
}
private String columnLabel;
private TimeQuantum timeQuantum = TimeQuantum.NONE;
}
| [
"yucetekol@gmail.com"
] | yucetekol@gmail.com |
abb06c122b6b6916f9f88706fe5e4a615d4a5334 | db386c5b3bdcad10a9bf960351fb1304094cffd8 | /LearningPatterns/src/main/java/by/moiseenko/structural/decorator/RecallerDecorator.java | c29074b12772a8b25d070c613decc3cf71aec3d5 | [] | no_license | SMoiseenko/Learning | 31cc40504d58b3142f18f72fbcccd7ee583b0b38 | e3634d8e877251bfe9519c91602d607b439854dd | refs/heads/master | 2023-05-10T15:52:00.710574 | 2022-11-18T13:39:05 | 2022-11-18T13:39:05 | 172,510,726 | 0 | 0 | null | 2023-05-09T18:10:30 | 2019-02-25T13:25:51 | Java | UTF-8 | Java | false | false | 630 | java | package by.moiseenko.structural.decorator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Default javadoc
*
* @author moiseenko-s
*/
public class RecallerDecorator implements Recaller {
private static final Logger LOG = LogManager.getLogger(RecallerDecorator.class.getName());
private Recaller recaller;
public RecallerDecorator(Recaller recaller) {
this.recaller = recaller;
}
@Override
public String getName() {
return recaller.getName() + " \"ADDED BY DECORATOR\"";
}
@Override
public void setName(String name) {
recaller.setName(name);
}
}
| [
"slipknotbiocom@gmail.com"
] | slipknotbiocom@gmail.com |
0bde1e915526d6fcf7747a9a23908410e47bc76d | ceba37da0b185afd8f400160bdd55fba00130501 | /algorithm/src/main/java/algorithm/entity/MikiHotelGeoLocation.java | 01bcb9168522b2355ecf1d698417a9facfb1d011 | [] | no_license | fengfujie25/spring-cloud | b2362ce280ed54095a9df5236311b2a7707520ae | 1eb63efa838a209a841e67d91e36b0460088bdfc | refs/heads/master | 2021-06-18T22:09:10.243268 | 2019-07-31T10:14:23 | 2019-07-31T10:14:23 | 198,985,314 | 1 | 0 | null | 2021-04-26T19:21:44 | 2019-07-26T09:10:02 | Java | UTF-8 | Java | false | false | 585 | java | /**
* Copyright (c) 2018 Qunar.com. All Rights Reserved.
*/
package algorithm.entity;
/**
* @author: create by qingxiang.zhu
* @version: v1.0
* @date:2018/10/16
**/
public class MikiHotelGeoLocation {
private String latitude;
private String longitude;
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
}
| [
"4272231@163.com"
] | 4272231@163.com |
7b633ac65352dab5d109327f13348db83d17ff60 | 74feb3fcb1421d3d6cf8ece0ed42307951ca8dab | /app/src/main/java/com/example/userapp/model/ApplicationListResponse.java | d12967b83414051a3753e99676bdaebafb3de136 | [] | no_license | DAniket02/UserApp | a7e223eff103a054b902df7199fafeac59a7ca20 | c6a4855105688a0529abf014f23ba69c6453c86f | refs/heads/master | 2023-02-08T23:31:47.523445 | 2020-12-02T17:17:51 | 2020-12-02T17:17:51 | 317,936,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,636 | java | package com.example.userapp.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ApplicationListResponse {
@SerializedName("status")
@Expose
public String status;
@SerializedName("message")
@Expose
public String message;
@SerializedName("requestList")
@Expose
public List<RequestList> requestList = null;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<RequestList> getRequestList() {
return requestList;
}
public void setRequestList(List<RequestList> requestList) {
this.requestList = requestList;
}
public class RequestList {
@SerializedName("id")
@Expose
private Long id;
@SerializedName("prajati")
@Expose
private String prajati;
@SerializedName("tree_total")
@Expose
private String treeTotal;
@SerializedName("reason")
@Expose
private String reason;
@SerializedName("zone")
@Expose
private String zone;
@SerializedName("department")
@Expose
private String department;
@SerializedName("type")
@Expose
private String type;
@SerializedName("last_status")
@Expose
private String lastStatus;
@SerializedName("application_status")
@Expose
private Long applicationStatus;
@SerializedName("created_by")
@Expose
private Long createdBy;
@SerializedName("modified_by")
@Expose
private Long modifiedBy;
@SerializedName("created_at")
@Expose
private String createdAt;
@SerializedName("updated_at")
@Expose
private String updatedAt;
@SerializedName("zone_name")
@Expose
private String zoneName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPrajati() {
return prajati;
}
public void setPrajati(String prajati) {
this.prajati = prajati;
}
public String getTreeTotal() {
return treeTotal;
}
public void setTreeTotal(String treeTotal) {
this.treeTotal = treeTotal;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getZone() {
return zone;
}
public void setZone(String zone) {
this.zone = zone;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getLastStatus() {
return lastStatus;
}
public void setLastStatus(String lastStatus) {
this.lastStatus = lastStatus;
}
public Long getApplicationStatus() {
return applicationStatus;
}
public void setApplicationStatus(Long applicationStatus) {
this.applicationStatus = applicationStatus;
}
public Long getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Long createdBy) {
this.createdBy = createdBy;
}
public Long getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(Long modifiedBy) {
this.modifiedBy = modifiedBy;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public String getZoneName() {
return zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
}
}
| [
"aniketdhanrao02@gmail.com"
] | aniketdhanrao02@gmail.com |
8f61673c4a1937ffc59322fcc1d294acd62ce481 | 38e5773b5edd8b9ceaafab0bb0abf11dc4097fd0 | /sql-parser/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLCreateMaterializedViewStatement.java | f685d7f98fa0dd227be89a4ef9f71c5257438b25 | [
"Apache-2.0"
] | permissive | cjdxhjj/sharding-jdbc | f2eac2193a89fe389e04239c7c12f4ce2c6bcf3e | 05a88dc658d47f9f89cd2a948ffb9ccfeefef40d | refs/heads/master | 2022-11-13T06:46:02.096003 | 2022-10-29T06:30:42 | 2022-10-29T06:30:42 | 61,268,353 | 1 | 0 | null | 2016-06-16T06:35:10 | 2016-06-16T06:35:09 | null | UTF-8 | Java | false | false | 1,334 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl;
import lombok.ToString;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateMaterializedViewStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.PostgreSQLStatement;
/**
* PostgreSQL create materialized view statement.
*/
@ToString(callSuper = true)
public final class PostgreSQLCreateMaterializedViewStatement extends CreateMaterializedViewStatement implements PostgreSQLStatement {
}
| [
"noreply@github.com"
] | cjdxhjj.noreply@github.com |
78789ffeaf73de2d1ea5d9ea3dc51d88d70926f6 | 6192f184fe22cb49b066ee49d0fd103a043f3a9d | /Lab11/src/test/java/edu/miu/cs/swe/myjunittestdemo/AllLabTests.java | 48d8720d32c75c6585d2ddeae3badc1bd362f894 | [] | no_license | kirubelandargie/SELabs | ffbaa90506e4344a51bbfb6efbdc9003e5f70e30 | d3b13222d7e27a9a27f8395e4805deecf165304c | refs/heads/master | 2022-12-29T04:02:56.845678 | 2020-06-10T04:09:45 | 2020-06-10T04:09:45 | 267,488,878 | 0 | 0 | null | 2020-10-13T22:41:18 | 2020-05-28T03:59:00 | Java | UTF-8 | Java | false | false | 307 | java | package edu.miu.cs.swe.myjunittestdemo;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({ ArrayFlattenerTest.class, ArrayReversorTest.class, Question1.class, Question2.class })
public class AllLabTests {
}
| [
"kandargie@miu.edu"
] | kandargie@miu.edu |
5a073c7ca2c26d9d2eb61a238d321d4bc6c0b431 | 7e2120c5109da3169e8c93ebe8c5f0969ea8c296 | /src/com/programacion/Evaluacion2/Boletin_14/conversorTemperaturas.java | 3fcb66d0cc4459604155c1db2a925d61702e6a44 | [] | no_license | gabri185/Programacion2 | 0c2c9d9a85a7b528c871e9cfbdb6ef35d78c738e | fc49aa894d0aab559dcb9c4ee1687e340e351dbb | refs/heads/master | 2023-04-12T21:36:51.482857 | 2021-05-05T18:39:23 | 2021-05-05T18:39:23 | 307,660,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package com.programacion.Evaluacion2.Boletin_14;
public class conversorTemperaturas {
public static final float TEMPERATURA_MINIMA =80F;
public conversorTemperaturas() {
}
public float centigradosAFarenheit(float temperaturaCentigrados) throws TemperaturaErradaException{
if (temperaturaCentigrados<TEMPERATURA_MINIMA)
throw new TemperaturaErradaException("Introduzca una temperatura superior a 80º");
else {
return (temperaturaCentigrados * 1.8F) + 32.4F;
}
}
public void centigradosAReamur (float celsius){
try {
float temperaturaReamur=0.8F*celsius;
if (celsius<TEMPERATURA_MINIMA) {
throw new TemperaturaErradaException();
}
System.out.println("temperatura en celsius= " + temperaturaReamur);
}catch (TemperaturaErradaException es){
System.out.println(es.getMessage());
}
}
}
| [
"gdominguezreyes@danielcastelao.com"
] | gdominguezreyes@danielcastelao.com |
039062548247652891d377a4c7a1d7d9ccdfceeb | 7c19c18a82be0300595b8ab6faa6fd24e7884410 | /app/src/main/java/com/example/josepablo/supercitoapp/object/Carrito.java | 01cbfab557e329a2b79ab913c351e00bcf80472d | [] | no_license | Yu553F/Supercito | 3c840e9c85f1109893bbe90478b5e49844d5fb0b | 344c226697400b32b136064fd3022ff437e567b5 | refs/heads/master | 2021-07-15T15:07:33.595016 | 2017-10-20T03:18:36 | 2017-10-20T03:18:36 | 107,626,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,114 | java | package com.example.josepablo.supercitoapp.object;
/**
* Created by Jose Pablo on 10/15/2017.
*/
public class Carrito {
private int id;
private String fecha;
private float total;
private int elementos;
public Carrito(int id, String fecha, float total, int elementos) {
this.id = id;
this.fecha = fecha;
this.total = total;
this.elementos = elementos;
}
public Carrito(String fecha, float total, int elementos) {
this.fecha = fecha;
this.total = total;
this.elementos = elementos;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFecha() {
return fecha;
}
public void setFecha(String fecha) {
this.fecha = fecha;
}
public float getTotal() {
return total;
}
public void setTotal(float total) {
this.total = total;
}
public int getElementos() {
return elementos;
}
public void setElementos(int elementos) {
this.elementos = elementos;
}
}
| [
"abrhmtrmri@gmail.com"
] | abrhmtrmri@gmail.com |
edcfcff91d6fe9c5a8b49fb137c109f4d07e9a64 | 465a6c794f19099c0a3de1c13e985b7a7d77a388 | /mutipleThread_in_java/ComplicatePratice/src/base/baseJoinAndYield.java | 7fa97103309ffcb742a7b96a85c8ac77a616e5d0 | [
"Apache-2.0"
] | permissive | liberjiang/PracticeCode | b27c80b1fd31d982b742aedcf26502b027872513 | 3d6ea55f58ab25791cbdff096f4e30d013ca9be5 | refs/heads/master | 2020-04-25T15:59:44.211442 | 2016-09-25T01:46:40 | 2016-09-25T01:46:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package base;
/**
* join() 等待 yield() 谦让
* thread.join() 让所在线程等待 目标线程走完再继续走
* thread.yield() 让出当前的CPU给其他的线程运行
*
* @author liufengkai
* Created by liufengkai on 16/5/13.
*/
public class baseJoinAndYield {
public volatile static int i = 0;
public static class AddThread extends Thread {
@Override
public void run() {
super.run();
for (i = 0; i < 100000; i++) ;
}
}
public static void main(String[] args) throws InterruptedException {
AddThread at = new AddThread();
at.start();
// at.join();
System.out.println(i);
}
}
| [
"lfk_dsk@hotmail.com"
] | lfk_dsk@hotmail.com |
90d70c0895fe9013ba1a689a245d62e504008cb3 | 94e925f39a9f1024d8377b25c87ba884e16b22d2 | /Cracking Coding Interview/Chap8 - Object-Oriented Design/Q8.10.java | 2d1f21cc9bfda1d9f12bda1a37dd19623d1ab637 | [] | no_license | usunyu/coding-for-food | dba5d30b2aa53f08dfc90d32024dc1b0674edc14 | 2654f5b7194851256a053bac5adbc925b7440899 | refs/heads/master | 2021-05-28T20:03:01.668254 | 2014-11-24T04:02:13 | 2014-11-24T04:02:13 | 27,059,775 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,305 | java | /*
Design and implement a hash table which uses chaining (linked lists) to handle collisions.
*/
import java.util.*;
class MyHashNode<K, V> {
K key;
V value;
MyHashNode<K, V> next;
public MyHashNode(K key, V value) {
this.key = key;
this.value = value;
}
}
class MyHashTable<K, V> {
ArrayList<MyHashNode<K, V>> hashValueArray;
int MAX = 1000;
public MyHashTable() {
hashValueArray = new ArrayList<MyHashNode<K, V>>(MAX);
for(int i = 0; i < MAX; i++) {
MyHashNode<K, V> nullNode = new MyHashNode<K, V>(null, null);
hashValueArray.add(nullNode);
}
}
public int computeHashKey(K key) {
return (Integer)key % MAX;
}
public void put(K key, V value) {
int hashKey = computeHashKey(key);
MyHashNode<K, V> node = hashValueArray.get(hashKey);
if(node.key == null) { // no collision
node.key = key;
node.value = value;
}
else { // has collision
MyHashNode<K, V> previous = null;
while(node != null) {
if(node.key.equals(key)) { // if same key, replace
node.value = value;
break;
}
previous = node;
node = node.next;
}
if(node == null) { // no smae key
MyHashNode<K, V> newNode = new MyHashNode<K, V>(key, value);
previous.next = newNode;
}
}
}
public V get(K key) {
int hashKey = computeHashKey(key);
MyHashNode<K, V> node = hashValueArray.get(hashKey);
if(node == null)
return null;
else {
while(node != null) {
if(node.key.equals(key))
return node.value;
node = node.next;
}
return null;
}
}
}
class Q8_10App {
public static void main(String[] args) {
MyHashTable<Integer, String> myHashTable = new MyHashTable<Integer, String>();
myHashTable.put(1, "One");
myHashTable.put(2, "Two");
myHashTable.put(3, "Three");
myHashTable.put(4, "Four");
myHashTable.put(5, "Five");
myHashTable.put(1, "New One");
myHashTable.put(1002, "One thousand and two");
System.out.println("Key: 1,\t\tValue: " + myHashTable.get(1));
System.out.println("Key: 2,\t\tValue: " + myHashTable.get(2));
System.out.println("Key: 3,\t\tValue: " + myHashTable.get(3));
System.out.println("Key: 4,\t\tValue: " + myHashTable.get(4));
System.out.println("Key: 5,\t\tValue: " + myHashTable.get(5));
System.out.println("Key: 1002,\tValue: " + myHashTable.get(1002));
}
}
| [
"usunyu@gmail.com"
] | usunyu@gmail.com |
24103eb98087159d5a52244766f9e78ff70949a0 | 0afd008d276c5686d61f2a49a9b46c744080835c | /ACM/2017ACM集训/lec02pm/BigIntegerDemo.java | df56e0bae5b43328b26790622330f3064491dd2d | [
"MIT",
"AFL-2.0"
] | permissive | DataYI/cplusplus | e8e4e39ea1bd5fbb5e603ce0858ebbb17e6b711f | 6b9c671b0c9a7c0d24d937610bf54e9aec9a5a1f | refs/heads/master | 2022-12-22T00:37:12.934376 | 2020-09-28T14:23:38 | 2020-09-28T14:23:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | package lec02pm;
import java.math.BigInteger;
/**
* Created by zj on 17-6-29.
*/
public class BigIntegerDemo {
public static void main(String[] args) {
BigInteger b=new BigInteger("111111111111111111111111111");
BigInteger a=new BigInteger("111111111111111111111111111");
System.out.println(a.add(b));
System.out.println(a.subtract(b));
System.out.println(a.multiply(b));
System.out.println(a.isProbablePrime(10));
}
}
| [
"zj@webturing.com"
] | zj@webturing.com |
c184fb43d1e2c9dd2461f78e64307f8b62724253 | fac8df6991db03ddf5fa2c521c38b65bdd2b37e6 | /EvolutionaryFirefighting/src/ConnectedStrategy.java | ca97265e6ac74c2486ea4c1091ae94980f9e6ecd | [
"MIT"
] | permissive | pfeifenheini/javaProjects | 421331047841852a6590ba18a57fe4fbf4fe30ef | 2371a40bc25a93d7fa67a5154e75bf4255363bb3 | refs/heads/master | 2021-01-20T17:54:27.264674 | 2017-04-14T10:49:12 | 2017-04-14T10:49:12 | 60,957,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,516 | java | import java.util.LinkedList;
import java.util.Queue;
public class ConnectedStrategy extends Strategy {
/** possible directions to protect the next cell */
enum Direction {N, NE, E, SE, S, SW, W, NW};
/**
* An Extension contains the information where to extend the barrier.
*/
private class Extension {
/** direction of the next cell */
Direction dir;
/** decides whether to extend the front or the back of the barrier */
boolean extendFront;
/**
* Constructor
*/
public Extension() {
dir = Direction.values()[Strategy.rand.nextInt(Direction.values().length)];
if(dir.ordinal()%2==1)
dir = Direction.values()[Strategy.rand.nextInt(Direction.values().length)];
extendFront = Strategy.rand.nextBoolean();
}
public Extension(Direction dir, boolean extendFront) {
this.dir = dir;
this.extendFront = extendFront;
}
@Override
public Extension clone() {
Extension e = new Extension();
e.dir = dir;
e.extendFront = extendFront;
return e;
}
}
/** start coordinate */
private Coordinate[] start;
/** tells which cell to protect next */
private Extension[][] sequence;
/** tells which barrier to continue */
private int[] pickedBarrier;
/**
* Constructor
*/
public ConnectedStrategy() {
super();
start = new Coordinate[numberOfConnectedBarriers];
for(int i=0;i<numberOfConnectedBarriers;i++) {
int x = (int)(10*rand.nextGaussian()+startFireX);
int y = (int)(10*rand.nextGaussian()+startFireY);
if(mode == Mode.CatchFire)
x = Math.max(Math.min(x, xBoundary-1), 0);
else
x = Math.max(Math.min(x, xBoundary-2), 0);
y = Math.max(Math.min(y, yBoundary-1), 0);
start[i] = new Coordinate(x,y);
}
sequence = new Extension[numberOfConnectedBarriers][];
for(int i=0;i<numberOfConnectedBarriers;i++)
sequence[i] = new Extension[(int)((xBoundary+yBoundary)*Math.max(budget,1)+1)];
for(int i=0;i<numberOfConnectedBarriers;i++)
for(int j=0;j<sequence[i].length;j++)
sequence[i][j] = new Extension();
pickedBarrier = new int[numberOfConnectedBarriers*sequence[0].length];
for(int i=0;i<pickedBarrier.length;i++) {
pickedBarrier[i] = rand.nextInt(numberOfConnectedBarriers);
}
if(!initializeRandom) {
start[0] = new Coordinate(xBoundary-2,startFireY+0);
pickedBarrier[0] = 0;
}
}
/**
* Creates a new Strategy given two parent strategies
* @param parent1
* @param parent2
*/
public ConnectedStrategy(ConnectedStrategy parent1, ConnectedStrategy parent2) {
super();
start = new Coordinate[numberOfConnectedBarriers];
int crossPoint = rand.nextInt(parent1.start.length);
for(int i=0;i<numberOfConnectedBarriers;i++) {
if(i<=crossPoint)
start[i] = parent1.start[i].clone();
else
start[i] = parent2.start[i].clone();
}
sequence = new Extension[numberOfConnectedBarriers][];
for(int i=0;i<numberOfConnectedBarriers;i++)
sequence[i] = new Extension[(int)((xBoundary+yBoundary)*Math.max(budget,1)+1)];
for(int i=0;i<numberOfConnectedBarriers;i++) {
crossPoint = rand.nextInt(parent1.sequence[i].length);
for(int j=0;j<sequence[i].length;j++) {
if(j<=crossPoint)
sequence[i][j] = parent1.sequence[i][j].clone();
else
sequence[i][j] = parent2.sequence[i][j].clone();
}
}
pickedBarrier = new int[parent1.pickedBarrier.length];
crossPoint = rand.nextInt(pickedBarrier.length);
for(int i=0;i<pickedBarrier.length;i++) {
if(i<=crossPoint)
pickedBarrier[i] = parent1.pickedBarrier[i];
else
pickedBarrier[i] = parent2.pickedBarrier[i];
}
}
@Override
boolean simulate(boolean force, boolean printGrid, boolean saveAllSteps) {
if(!changed && !force) return false;
int minX=0, minY=0, maxX=xBoundary-1, maxY=yBoundary-1;
if(saveAllSteps) {
minX=xBoundary-1; minY=yBoundary-1; maxX=0; maxY=0;
for(int x=0;x<xBoundary;x++)
{
for(int y=0;y<yBoundary;y++)
{
if(grid[x][y] != FREE)
{
if(x<minX) minX = x;
if(y<minY) minY = y;
if(x>maxX) maxX = x;
if(y>maxY) maxY = y;
}
}
}
}
clearGrid();
double account = initialAccount;
int iterations = Math.max(xBoundary/2,yBoundary/2);
int[] sequenceIterator = new int[numberOfConnectedBarriers];
int barrierIterator = 0;
Coordinate[] front = new Coordinate[start.length];
Coordinate[] back = new Coordinate[start.length];
for(int i=0;i<start.length;i++) {
front[i] = start[i].clone();
back[i] = start[i].clone();
}
boolean[] startProtected = new boolean[numberOfConnectedBarriers];
for(int i=0;i<startProtected.length;i++)
startProtected[i] = false;
grid[startFireX][startFireY] = 0;
Queue<Coordinate> burningBoundary = new LinkedList<Coordinate>();
burningBoundary.add(new Coordinate(startFireX,startFireY));
timeToReachHighway = 0;
timeToEncloseFire = 1;
Extension ext;
Coordinate nextCell = null;
Direction scan = null;
if(saveAllSteps)
save("steps/step_0",minX,maxX,minY,maxY);
fitness = 1;
for(int time=0;time<iterations && !burningBoundary.isEmpty();time++) {
while(account >= 1
&& barrierIterator<pickedBarrier.length
&& sequenceIterator[pickedBarrier[barrierIterator]]<sequence[pickedBarrier[barrierIterator]].length) {
int currBarrier = pickedBarrier[barrierIterator];
if(!startProtected[currBarrier]) {
if(protect(start[currBarrier]))
account -= 1.0;
startProtected[currBarrier] = true;
}
else {
ext = sequence[currBarrier][sequenceIterator[currBarrier]];
if(ext.extendFront) {
for(int look=0;look<8;look++) {
scan = Direction.values()[(ext.dir.ordinal()+look)%Direction.values().length];
nextCell = findCell(front[currBarrier], scan);
if(grid[nextCell.x][nextCell.y] < 0)
break;
}
if(protect(nextCell)) {
account -= 1.0;
}
if(grid[nextCell.x][nextCell.y] == SAVE)
front[currBarrier] = nextCell;
}
else {
for(int look=7;look>=0;look--) {
scan = Direction.values()[(ext.dir.ordinal()+look)%Direction.values().length];
nextCell = findCell(back[currBarrier], scan);
if(grid[nextCell.x][nextCell.y] < 0)
break;
}
if(protect(nextCell)) {
account -= 1.0;
}
if(grid[nextCell.x][nextCell.y] == SAVE)
back[currBarrier] = nextCell;
}
// sequence[currBarrier][sequenceIterator[currBarrier]] = new Extension(scan, ext.extendFront);
sequenceIterator[currBarrier]++;
}
barrierIterator++;
}
if(printGrid) {
printGrid();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
fitness += burningBoundary.size();
if(!spreadFire(burningBoundary,time+1)) {
timeToReachHighway++;
highwayProtected = true;
if(burningBoundary.isEmpty()) {
timeToReachHighway = iterations+1;
}
}
else
highwayProtected = false;
if(burningBoundary.isEmpty())
fireEnclosed = true;
else
timeToEncloseFire++;
account += budget;
if(saveAllSteps)
save("steps/step_" + (time+1),minX,maxX,minY,maxY);
}
fitness += burningBoundary.size();
nonBurningHighwayCells = 0;
for(int i=0;i<yBoundary;i++) {
if(grid[xBoundary-1][i] < 0)
nonBurningHighwayCells++;
}
totalSavedCells = 0;
for(int x=0;x<xBoundary;x++) {
nonBurningPerLevel[x] = 0;
for(int y=0;y<yBoundary;y++) {
if(grid[x][y] < 0) {
nonBurningPerLevel[x]++;
totalSavedCells++;
}
}
}
changed = false;
return true;
}
/**
* Determines the next cell given a start cell and a direction
* @param cell start cell
* @param course direction of the next cell
* @return next cell
*/
private Coordinate findCell(Coordinate cell, Direction course) {
int x = cell.x;
int y = cell.y;
if(course == Direction.N || course == Direction.NE || course == Direction.NW)
x++;
if(course == Direction.S || course == Direction.SE || course == Direction.SW)
x--;
if(course == Direction.W || course == Direction.NW || course == Direction.SW)
y--;
if(course == Direction.E || course == Direction.NE || course == Direction.SE)
y++;
// correction if the next cell lies otside of the grid
x = Math.max(0, x);
x = Math.min(xBoundary-2, x);
y = Math.max(0, y);
y = Math.min(yBoundary-1, y);
return new Coordinate(x,y);
}
@Override
void mutate() {
double chance = mutationRate/(start.length+numberOfConnectedBarriers*sequence[0].length+pickedBarrier.length);
for(int i=0;i<numberOfConnectedBarriers;i++) {
if(rand.nextDouble() <= chance) {
start[i].x = Math.max(0, Math.min(xBoundary-2, start[i].x+wiggleOffset()));
start[i].y = Math.max(0, Math.min(yBoundary-1, start[i].y+wiggleOffset()));
}
}
for(int i=0;i<numberOfConnectedBarriers;i++) {
for(int j=0;j<sequence[i].length;j++) {
if(rand.nextDouble() <= chance) {
sequence[i][j] = new Extension();
changed = true;
}
}
}
for(int i=0;i<pickedBarrier.length;i++) {
if(rand.nextDouble() <= chance) {
pickedBarrier[i] = rand.nextInt(numberOfConnectedBarriers);
}
}
if(!initializeRandom) {
start[0] = new Coordinate(xBoundary-2,startFireY+0);
pickedBarrier[0] = 0;
}
}
}
| [
"pfei@gmx.de"
] | pfei@gmx.de |
fe4dddaf7e5d9730e648eb78f961da7381e14bb6 | cba635ebfd8a6e28d5de1ab86a0700ff966a14ae | /app/src/androidTest/java/com/example/bookscrapingexampleapp/ExampleInstrumentedTest.java | df16be7331a105435025698235bb89ce9451ae3b | [] | no_license | sdenna/BookScrapingExampleApp | 4500a4ee3602ed0f408224ed9653fe039ef45061 | 275819db9352fd9736f9e3c5512a2b3ee6c560db | refs/heads/master | 2020-12-11T01:06:11.653984 | 2020-01-14T05:04:43 | 2020-01-14T05:04:43 | 233,760,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package com.example.bookscrapingexampleapp;
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.example.bookscrapingexampleapp", appContext.getPackageName());
}
}
| [
"49918103+sdenna17@users.noreply.github.com"
] | 49918103+sdenna17@users.noreply.github.com |
062872ed451123680ba35ddbe2dd231f7fb621f9 | c2745516073be0e243c2dff24b4bb4d1d94d18b8 | /sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/models/SearchErrorException.java | a1dfbf9a2966d57415dd01ebc1ae362b91405fff | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"CC0-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later"
] | permissive | milismsft/azure-sdk-for-java | 84b48d35e3fca8611933b3f86929788e5e8bceed | f4827811c870d09855417271369c592412986861 | refs/heads/master | 2022-09-25T19:29:44.973618 | 2022-08-17T14:43:22 | 2022-08-17T14:43:22 | 90,779,733 | 1 | 0 | MIT | 2021-12-21T21:11:58 | 2017-05-09T18:37:49 | Java | UTF-8 | Java | false | false | 1,429 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package com.azure.search.documents.implementation.models;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.http.HttpResponse;
/** Exception thrown for an invalid response with SearchError information. */
public final class SearchErrorException extends HttpResponseException {
/**
* Initializes a new instance of the SearchErrorException class.
*
* @param message the exception message or the response content if a message is not available.
* @param response the HTTP response.
*/
public SearchErrorException(String message, HttpResponse response) {
super(message, response);
}
/**
* Initializes a new instance of the SearchErrorException class.
*
* @param message the exception message or the response content if a message is not available.
* @param response the HTTP response.
* @param value the deserialized response value.
*/
public SearchErrorException(String message, HttpResponse response, SearchError value) {
super(message, response, value);
}
@Override
public SearchError getValue() {
return (SearchError) super.getValue();
}
}
| [
"noreply@github.com"
] | milismsft.noreply@github.com |
61c4caec929e917b5cdd3a19b7b805d8ebb176ef | 46db98bcdb7f17571d08c791a51186c06c37e2e5 | /src/main/java/pl/waw/mizinski/mbi/commons/AlignmentClass.java | 8bb09417baf85ad9492cad753d9e25e799942ebe | [] | no_license | mizin1/mbi | e10ee9db08b4c5fcf7dbb71b4b6f21263fd3a930 | 996d3a1ccda09f5413266009726c2a3c50b6d8ef | refs/heads/master | 2020-09-12T20:59:50.322370 | 2015-08-19T09:15:43 | 2015-08-19T09:15:43 | 19,346,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package pl.waw.mizinski.mbi.commons;
public enum AlignmentClass {
alig0(0), alig1(1), alig2(2), alig3(3), alig4(4), alig5(5);
private int alig;
private AlignmentClass(int alig) {
this.alig = alig;
}
public int getAlig() {
return alig;
}
public static AlignmentClass fromInt(int alig) {
if (alig > alig5.alig) {
return alig5;
}
if(alig < alig0.alig) {
return alig0;
}
for (AlignmentClass alignmentClass : values()) {
if(alignmentClass.alig == alig) {
return alignmentClass;
}
}
throw new IllegalStateException("Should never happen!");
}
}
| [
"konrad_1916@wp.pl"
] | konrad_1916@wp.pl |
db6268814afbfb55a0e4cca83029e3ff428a7591 | 86ff73089cf6697c5026e1f4bab9aec443725a93 | /examples/build/jar/src/main/java/com/libfly/example/App.java | 0728ab63e8c4014ccdd5bd0efbd36b8df6f93da0 | [
"MIT"
] | permissive | blockspacer/libfly | 83760521221ddde5b4b65c3bb2c4b10ed390d277 | 95a00248368791a020d4e7a8c8d98875d633be38 | refs/heads/master | 2023-02-08T21:30:47.587477 | 2020-12-26T02:25:55 | 2020-12-26T02:42:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package com.libfly.example;
public class App
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
| [
"trflynn89@pm.me"
] | trflynn89@pm.me |
68f318c5c7ccbb8ec4c6b324498e4b5e186010ac | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/20/20_6d7a23d1c934692462d55083405a1772316e0ef0/PyString/20_6d7a23d1c934692462d55083405a1772316e0ef0_PyString_t.java | 196588d3c46f5d5d986b7fe786783d02efeb26a4 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 97,804 | java | /// Copyright (c) Corporation for National Research Initiatives
package org.python.core;
import java.math.BigInteger;
import org.python.core.util.ExtraMath;
import org.python.core.util.StringUtil;
import org.python.expose.ExposedMethod;
import org.python.expose.ExposedNew;
import org.python.expose.ExposedType;
import org.python.expose.MethodType;
/**
* A builtin python string.
*/
@ExposedType(name = "str")
public class PyString extends PyBaseString
{
public static final PyType TYPE = PyType.fromClass(PyString.class);
protected String string;
private transient int cached_hashcode=0;
protected transient boolean interned=false;
// for PyJavaClass.init()
public PyString() {
this(TYPE, "");
}
public PyString(PyType subType, String string) {
super(subType);
if (string == null) {
throw new IllegalArgumentException(
"Cannot create PyString from null!");
}
this.string = string;
}
public PyString(String string) {
this(TYPE, string);
}
public PyString(char c) {
this(TYPE,String.valueOf(c));
}
PyString(StringBuilder buffer) {
this(TYPE, new String(buffer));
}
/**
* Creates a PyString from an already interned String. Just means it won't
* be reinterned if used in a place that requires interned Strings.
*/
public static PyString fromInterned(String interned) {
PyString str = new PyString(TYPE, interned);
str.interned = true;
return str;
}
@ExposedNew
final static PyObject str_new(PyNewWrapper new_, boolean init, PyType subtype,
PyObject[] args, String[] keywords) {
ArgParser ap = new ArgParser("str", args, keywords, new String[] { "object" }, 0);
PyObject S = ap.getPyObject(0, null);
if(new_.for_type == subtype) {
if(S == null) {
return new PyString("");
}
return new PyString(S.__str__().toString());
} else {
if (S == null) {
return new PyStringDerived(subtype, "");
}
return new PyStringDerived(subtype, S.__str__().toString());
}
}
public int[] toCodePoints() {
int n = string.length();
int[] codePoints = new int[n];
for (int i = 0; i < n; i++) {
codePoints[i] = string.charAt(i);
}
return codePoints;
}
public String substring(int start, int end) {
return string.substring(start, end);
}
public PyString __str__() {
return str___str__();
}
@ExposedMethod
final PyString str___str__() {
if (getClass() == PyString.class) {
return this;
}
return new PyString(string);
}
public PyUnicode __unicode__() {
return str___unicode__();
}
@ExposedMethod
final PyUnicode str___unicode__() {
return new PyUnicode(this);
}
public int __len__() {
return str___len__();
}
@ExposedMethod
final int str___len__() {
return string.length();
}
public String toString() {
return string;
}
public String internedString() {
if (interned)
return string;
else {
string = string.intern();
interned = true;
return string;
}
}
public PyString __repr__() {
return str___repr__();
}
@ExposedMethod
final PyString str___repr__() {
return new PyString(encode_UnicodeEscape(string, true));
}
private static char[] hexdigit = "0123456789abcdef".toCharArray();
public static String encode_UnicodeEscape(String str,
boolean use_quotes)
{
int size = str.length();
StringBuilder v = new StringBuilder(str.length());
char quote = 0;
if (use_quotes) {
quote = str.indexOf('\'') >= 0 &&
str.indexOf('"') == -1 ? '"' : '\'';
v.append(quote);
}
for (int i = 0; size-- > 0; ) {
int ch = str.charAt(i++);
/* Escape quotes */
if (use_quotes && (ch == quote || ch == '\\')) {
v.append('\\');
v.append((char) ch);
continue;
}
/* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */
else if (ch >= 0xD800 && ch < 0xDC00) {
char ch2 = str.charAt(i++);
size--;
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
int ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
v.append('\\');
v.append('U');
v.append(hexdigit[(ucs >> 28) & 0xf]);
v.append(hexdigit[(ucs >> 24) & 0xf]);
v.append(hexdigit[(ucs >> 20) & 0xf]);
v.append(hexdigit[(ucs >> 16) & 0xf]);
v.append(hexdigit[(ucs >> 12) & 0xf]);
v.append(hexdigit[(ucs >> 8) & 0xf]);
v.append(hexdigit[(ucs >> 4) & 0xf]);
v.append(hexdigit[ucs & 0xf]);
continue;
}
/* Fall through: isolated surrogates are copied as-is */
i--;
size++;
}
/* Map 16-bit characters to '\\uxxxx' */
if (ch >= 256) {
v.append('\\');
v.append('u');
v.append(hexdigit[(ch >> 12) & 0xf]);
v.append(hexdigit[(ch >> 8) & 0xf]);
v.append(hexdigit[(ch >> 4) & 0xf]);
v.append(hexdigit[ch & 15]);
}
/* Map special whitespace to '\t', \n', '\r' */
else if (ch == '\t') v.append("\\t");
else if (ch == '\n') v.append("\\n");
else if (ch == '\r') v.append("\\r");
/* Map non-printable US ASCII to '\ooo' */
else if (ch < ' ' || ch >= 127) {
v.append('\\');
v.append('x');
v.append(hexdigit[(ch >> 4) & 0xf]);
v.append(hexdigit[ch & 0xf]);
}
/* Copy everything else as-is */
else
v.append((char) ch);
}
if (use_quotes)
v.append(quote);
return v.toString();
}
private static ucnhashAPI pucnHash = null;
public static String decode_UnicodeEscape(String str,
int start,
int end,
String errors,
boolean unicode) {
StringBuilder v = new StringBuilder(end - start);
for(int s = start; s < end;) {
char ch = str.charAt(s);
/* Non-escape characters are interpreted as Unicode ordinals */
if(ch != '\\') {
v.append(ch);
s++;
continue;
}
int loopStart = s;
/* \ - Escapes */
s++;
if(s == end) {
s = codecs.insertReplacementAndGetResume(v,
errors,
"unicodeescape",
str,
loopStart,
s + 1,
"\\ at end of string");
continue;
}
ch = str.charAt(s++);
switch(ch){
/* \x escapes */
case '\n':
break;
case '\\':
v.append('\\');
break;
case '\'':
v.append('\'');
break;
case '\"':
v.append('\"');
break;
case 'b':
v.append('\b');
break;
case 'f':
v.append('\014');
break; /* FF */
case 't':
v.append('\t');
break;
case 'n':
v.append('\n');
break;
case 'r':
v.append('\r');
break;
case 'v':
v.append('\013');
break; /* VT */
case 'a':
v.append('\007');
break; /* BEL, not classic C */
/* \OOO (octal) escapes */
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
int x = Character.digit(ch, 8);
for(int j = 0; j < 2 && s < end; j++, s++) {
ch = str.charAt(s);
if(ch < '0' || ch > '7')
break;
x = (x << 3) + Character.digit(ch, 8);
}
v.append((char)x);
break;
case 'x':
s = hexescape(v, errors, 2, s, str, end, "truncated \\xXX");
break;
case 'u':
if(!unicode) {
v.append('\\');
v.append('u');
break;
}
s = hexescape(v,
errors,
4,
s,
str,
end,
"truncated \\uXXXX");
break;
case 'U':
if(!unicode) {
v.append('\\');
v.append('U');
break;
}
s = hexescape(v,
errors,
8,
s,
str,
end,
"truncated \\UXXXXXXXX");
break;
case 'N':
if(!unicode) {
v.append('\\');
v.append('N');
break;
}
/*
* Ok, we need to deal with Unicode Character Names now,
* make sure we've imported the hash table data...
*/
if(pucnHash == null) {
PyObject mod = imp.importName("ucnhash", true);
mod = mod.__call__();
pucnHash = (ucnhashAPI)mod.__tojava__(Object.class);
if(pucnHash.getCchMax() < 0)
throw Py.UnicodeError("Unicode names not loaded");
}
if(str.charAt(s) == '{') {
int startName = s + 1;
int endBrace = startName;
/*
* look for either the closing brace, or we exceed the
* maximum length of the unicode character names
*/
int maxLen = pucnHash.getCchMax();
while(endBrace < end && str.charAt(endBrace) != '}'
&& (endBrace - startName) <= maxLen) {
endBrace++;
}
if(endBrace != end && str.charAt(endBrace) == '}') {
int value = pucnHash.getValue(str,
startName,
endBrace);
if(storeUnicodeCharacter(value, v)) {
s = endBrace + 1;
} else {
s = codecs.insertReplacementAndGetResume(v,
errors,
"unicodeescape",
str,
loopStart,
endBrace + 1,
"illegal Unicode character");
}
} else {
s = codecs.insertReplacementAndGetResume(v,
errors,
"unicodeescape",
str,
loopStart,
endBrace,
"malformed \\N character escape");
}
break;
} else {
s = codecs.insertReplacementAndGetResume(v,
errors,
"unicodeescape",
str,
loopStart,
s + 1,
"malformed \\N character escape");
}
break;
default:
v.append('\\');
v.append(str.charAt(s - 1));
break;
}
}
return v.toString();
}
private static int hexescape(StringBuilder partialDecode,
String errors,
int digits,
int hexDigitStart,
String str,
int size,
String errorMessage) {
if(hexDigitStart + digits > size) {
return codecs.insertReplacementAndGetResume(partialDecode,
errors,
"unicodeescape",
str,
hexDigitStart - 2,
size,
errorMessage);
}
int i = 0;
int x = 0;
for(; i < digits; ++i) {
char c = str.charAt(hexDigitStart + i);
int d = Character.digit(c, 16);
if(d == -1) {
return codecs.insertReplacementAndGetResume(partialDecode,
errors,
"unicodeescape",
str,
hexDigitStart - 2,
hexDigitStart + i + 1,
errorMessage);
}
x = (x << 4) & ~0xF;
if(c >= '0' && c <= '9')
x += c - '0';
else if(c >= 'a' && c <= 'f')
x += 10 + c - 'a';
else
x += 10 + c - 'A';
}
if(storeUnicodeCharacter(x, partialDecode)) {
return hexDigitStart + i;
} else {
return codecs.insertReplacementAndGetResume(partialDecode,
errors,
"unicodeescape",
str,
hexDigitStart - 2,
hexDigitStart + i + 1,
"illegal Unicode character");
}
}
/*pass in an int since this can be a UCS-4 character */
private static boolean storeUnicodeCharacter(int value,
StringBuilder partialDecode) {
if (value < 0 || (value >= 0xD800 && value <= 0xDFFF)) {
return false;
} else if (value <= PySystemState.maxunicode) {
partialDecode.appendCodePoint(value);
return true;
}
return false;
}
@ExposedMethod
final PyObject str___getitem__(PyObject index) {
PyObject ret = seq___finditem__(index);
if (ret == null) {
throw Py.IndexError("string index out of range");
}
return ret;
}
@ExposedMethod(defaults = "null")
final PyObject str___getslice__(PyObject start, PyObject stop, PyObject step) {
return seq___getslice__(start, stop, step);
}
public int __cmp__(PyObject other) {
return str___cmp__(other);
}
@ExposedMethod(type = MethodType.CMP)
final int str___cmp__(PyObject other) {
if (!(other instanceof PyString))
return -2;
int c = string.compareTo(((PyString)other).string);
return c < 0 ? -1 : c > 0 ? 1 : 0;
}
public PyObject __eq__(PyObject other) {
return str___eq__(other);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___eq__(PyObject other) {
String s = coerce(other);
if (s == null)
return null;
return string.equals(s) ? Py.True : Py.False;
}
public PyObject __ne__(PyObject other) {
return str___ne__(other);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___ne__(PyObject other) {
String s = coerce(other);
if (s == null)
return null;
return string.equals(s) ? Py.False : Py.True;
}
public PyObject __lt__(PyObject other) {
return str___lt__(other);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___lt__(PyObject other){
String s = coerce(other);
if (s == null)
return null;
return string.compareTo(s) < 0 ? Py.True : Py.False;
}
public PyObject __le__(PyObject other) {
return str___le__(other);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___le__(PyObject other){
String s = coerce(other);
if (s == null)
return null;
return string.compareTo(s) <= 0 ? Py.True : Py.False;
}
public PyObject __gt__(PyObject other) {
return str___gt__(other);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___gt__(PyObject other){
String s = coerce(other);
if (s == null)
return null;
return string.compareTo(s) > 0 ? Py.True : Py.False;
}
public PyObject __ge__(PyObject other) {
return str___ge__(other);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___ge__(PyObject other){
String s = coerce(other);
if (s == null)
return null;
return string.compareTo(s) >= 0 ? Py.True : Py.False;
}
private static String coerce(PyObject o) {
if (o instanceof PyString)
return o.toString();
return null;
}
public int hashCode() {
return str___hash__();
}
@ExposedMethod
final int str___hash__() {
if (cached_hashcode == 0)
cached_hashcode = string.hashCode();
return cached_hashcode;
}
/**
* @return a byte array with one byte for each char in this object's
* underlying String. Each byte contains the low-order bits of its
* corresponding char.
*/
public byte[] toBytes() {
return StringUtil.toBytes(string);
}
public Object __tojava__(Class c) {
if (c.isAssignableFrom(String.class)) {
return string;
}
if (c == Character.TYPE || c == Character.class)
if (string.length() == 1)
return new Character(string.charAt(0));
if (c.isArray()) {
if (c.getComponentType() == Byte.TYPE)
return toBytes();
if (c.getComponentType() == Character.TYPE)
return string.toCharArray();
}
if (c.isInstance(this))
return this;
return Py.NoConversion;
}
protected PyObject pyget(int i) {
return Py.newString(string.charAt(i));
}
protected PyObject getslice(int start, int stop, int step) {
if (step > 0 && stop < start)
stop = start;
if (step == 1)
return fromSubstring(start, stop);
else {
int n = sliceLength(start, stop, step);
char new_chars[] = new char[n];
int j = 0;
for (int i=start; j<n; i+=step)
new_chars[j++] = string.charAt(i);
return createInstance(new String(new_chars), true);
}
}
public PyString createInstance(String str) {
return new PyString(str);
}
protected PyString createInstance(String str, boolean isBasic) {
// ignore isBasic, doesn't apply to PyString, just PyUnicode
return new PyString(str);
}
public boolean __contains__(PyObject o) {
return str___contains__(o);
}
@ExposedMethod
final boolean str___contains__(PyObject o) {
if (!(o instanceof PyString))
throw Py.TypeError("'in <string>' requires string as left operand");
PyString other = (PyString) o;
return string.indexOf(other.string) >= 0;
}
protected PyObject repeat(int count) {
if(count < 0) {
count = 0;
}
int s = string.length();
if((long)s * count > Integer.MAX_VALUE) {
// Since Strings store their data in an array, we can't make one
// longer than Integer.MAX_VALUE. Without this check we get
// NegativeArraySize exceptions when we create the array on the
// line with a wrapped int.
throw Py.OverflowError("max str len is " + Integer.MAX_VALUE);
}
char new_chars[] = new char[s * count];
for(int i = 0; i < count; i++) {
string.getChars(0, s, new_chars, i * s);
}
return createInstance(new String(new_chars), true);
}
@Override
public PyObject __mul__(PyObject o) {
return str___mul__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___mul__(PyObject o) {
if (!o.isIndex()) {
return null;
}
return repeat(o.asIndex(Py.OverflowError));
}
@Override
public PyObject __rmul__(PyObject o) {
return str___rmul__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___rmul__(PyObject o) {
if (!o.isIndex()) {
return null;
}
return repeat(o.asIndex(Py.OverflowError));
}
public PyObject __add__(PyObject generic_other) {
return str___add__(generic_other);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject str___add__(PyObject generic_other) {
if (generic_other instanceof PyString) {
PyString other = (PyString)generic_other;
String result = string.concat(other.string);
if (generic_other instanceof PyUnicode) {
return new PyUnicode(result);
}
return createInstance(result, true);
}
else return null;
}
@ExposedMethod
final PyTuple str___getnewargs__() {
return new PyTuple(new PyString(this.string));
}
public PyTuple __getnewargs__() {
return str___getnewargs__();
}
public PyObject __mod__(PyObject other) {
return str___mod__(other);
}
@ExposedMethod
public PyObject str___mod__(PyObject other){
StringFormatter fmt = new StringFormatter(string, false);
return fmt.format(other);
}
public PyObject __int__() {
try
{
return Py.newInteger(atoi(10));
} catch (PyException e) {
if (Py.matchException(e, Py.OverflowError)) {
return atol(10);
}
throw e;
}
}
public PyObject __long__() {
return atol(10);
}
public PyFloat __float__() {
return new PyFloat(atof());
}
public PyObject __pos__() {
throw Py.TypeError("bad operand type for unary +");
}
public PyObject __neg__() {
throw Py.TypeError("bad operand type for unary -");
}
public PyObject __invert__() {
throw Py.TypeError("bad operand type for unary ~");
}
public PyComplex __complex__() {
boolean got_re = false;
boolean got_im = false;
boolean done = false;
boolean sw_error = false;
int s = 0;
int n = string.length();
while (s < n && Character.isSpaceChar(string.charAt(s)))
s++;
if (s == n) {
throw Py.ValueError("empty string for complex()");
}
double z = -1.0;
double x = 0.0;
double y = 0.0;
int sign = 1;
do {
char c = string.charAt(s);
switch (c) {
case '-':
sign = -1;
/* Fallthrough */
case '+':
if (done || s+1 == n) {
sw_error = true;
break;
}
// a character is guaranteed, but it better be a digit
// or J or j
c = string.charAt(++s); // eat the sign character
// and check the next
if (!Character.isDigit(c) && c!='J' && c!='j')
sw_error = true;
break;
case 'J':
case 'j':
if (got_im || done) {
sw_error = true;
break;
}
if (z < 0.0) {
y = sign;
} else {
y = sign * z;
}
got_im = true;
done = got_re;
sign = 1;
s++; // eat the J or j
break;
case ' ':
while (s < n && Character.isSpaceChar(string.charAt(s)))
s++;
if (s != n)
sw_error = true;
break;
default:
boolean digit_or_dot = (c == '.' || Character.isDigit(c));
if (!digit_or_dot) {
sw_error = true;
break;
}
int end = endDouble(string, s);
z = Double.valueOf(string.substring(s, end)).doubleValue();
if (z == Double.POSITIVE_INFINITY) {
throw Py.ValueError(String.format("float() out of range: %.150s", string));
}
s=end;
if (s < n) {
c = string.charAt(s);
if (c == 'J' || c == 'j') {
break;
}
}
if (got_re) {
sw_error = true;
break;
}
/* accept a real part */
x = sign * z;
got_re = true;
done = got_im;
z = -1.0;
sign = 1;
break;
} /* end of switch */
} while (s < n && !sw_error);
if (sw_error) {
throw Py.ValueError("malformed string for complex() " +
string.substring(s));
}
return new PyComplex(x,y);
}
private int endDouble(String string, int s) {
int n = string.length();
while (s < n) {
char c = string.charAt(s++);
if (Character.isDigit(c))
continue;
if (c == '.')
continue;
if (c == 'e' || c == 'E') {
if (s < n) {
c = string.charAt(s);
if (c == '+' || c == '-')
s++;
continue;
}
}
return s-1;
}
return s;
}
// Add in methods from string module
public String lower() {
return str_lower();
}
@ExposedMethod
final String str_lower() {
return string.toLowerCase();
}
public String upper() {
return str_upper();
}
@ExposedMethod
final String str_upper() {
return string.toUpperCase();
}
public String title() {
return str_title();
}
@ExposedMethod
final String str_title() {
char[] chars = string.toCharArray();
int n = chars.length;
boolean previous_is_cased = false;
for (int i = 0; i < n; i++) {
char ch = chars[i];
if (previous_is_cased)
chars[i] = Character.toLowerCase(ch);
else
chars[i] = Character.toTitleCase(ch);
if (Character.isLowerCase(ch) ||
Character.isUpperCase(ch) ||
Character.isTitleCase(ch))
previous_is_cased = true;
else
previous_is_cased = false;
}
return new String(chars);
}
public String swapcase() {
return str_swapcase();
}
@ExposedMethod
final String str_swapcase() {
char[] chars = string.toCharArray();
int n=chars.length;
for (int i=0; i<n; i++) {
char c = chars[i];
if (Character.isUpperCase(c)) {
chars[i] = Character.toLowerCase(c);
}
else if (Character.isLowerCase(c)) {
chars[i] = Character.toUpperCase(c);
}
}
return new String(chars);
}
public String strip() {
return str_strip(null);
}
public String strip(String sep) {
return str_strip(sep);
}
@ExposedMethod(defaults = "null")
final String str_strip(String sep) {
char[] chars = string.toCharArray();
int n=chars.length;
int start=0;
if (sep == null)
while (start < n && Character.isWhitespace(chars[start]))
start++;
else
while (start < n && sep.indexOf(chars[start]) >= 0)
start++;
int end=n-1;
if (sep == null)
while (end >= 0 && Character.isWhitespace(chars[end]))
end--;
else
while (end >= 0 && sep.indexOf(chars[end]) >= 0)
end--;
if (end >= start) {
return (end < n-1 || start > 0)
? string.substring(start, end+1) : string;
} else {
return "";
}
}
public String lstrip() {
return str_lstrip(null);
}
public String lstrip(String sep) {
return str_lstrip(sep);
}
@ExposedMethod(defaults = "null")
final String str_lstrip(String sep) {
char[] chars = string.toCharArray();
int n=chars.length;
int start=0;
if (sep == null)
while (start < n && Character.isWhitespace(chars[start]))
start++;
else
while (start < n && sep.indexOf(chars[start]) >= 0)
start++;
return (start > 0) ? string.substring(start, n) : string;
}
public String rstrip(String sep) {
return str_rstrip(sep);
}
@ExposedMethod(defaults = "null")
final String str_rstrip(String sep) {
char[] chars = string.toCharArray();
int n=chars.length;
int end=n-1;
if (sep == null)
while (end >= 0 && Character.isWhitespace(chars[end]))
end--;
else
while (end >= 0 && sep.indexOf(chars[end]) >= 0)
end--;
return (end < n-1) ? string.substring(0, end+1) : string;
}
public PyList split() {
return str_split(null, -1);
}
public PyList split(String sep) {
return str_split(sep, -1);
}
public PyList split(String sep, int maxsplit) {
return str_split(sep, maxsplit);
}
@ExposedMethod(defaults = {"null", "-1"})
final PyList str_split(String sep, int maxsplit) {
if (sep != null) {
if (sep.length() == 0) {
throw Py.ValueError("empty separator");
}
return splitfields(sep, maxsplit);
}
PyList list = new PyList();
char[] chars = string.toCharArray();
int n=chars.length;
if (maxsplit < 0)
maxsplit = n;
int splits=0;
int index=0;
while (index < n && splits < maxsplit) {
while (index < n && Character.isWhitespace(chars[index]))
index++;
if (index == n)
break;
int start = index;
while (index < n && !Character.isWhitespace(chars[index]))
index++;
list.append(fromSubstring(start, index));
splits++;
}
while (index < n && Character.isWhitespace(chars[index]))
index++;
if (index < n) {
list.append(fromSubstring(index, n));
}
return list;
}
public PyList rsplit() {
return str_rsplit(null, -1);
}
public PyList rsplit(String sep) {
return str_rsplit(sep, -1);
}
public PyList rsplit(String sep, int maxsplit) {
return str_rsplit(sep, maxsplit);
}
@ExposedMethod(defaults = {"null", "-1"})
final PyList str_rsplit(String sep, int maxsplit) {
if (sep != null) {
if (sep.length() == 0) {
throw Py.ValueError("empty separator");
}
PyList list = rsplitfields(sep, maxsplit);
list.reverse();
return list;
}
PyList list = new PyList();
char[] chars = string.toCharArray();
if (maxsplit < 0) {
maxsplit = chars.length;
}
int splits = 0;
int i = chars.length - 1;
while (i > -1 && Character.isWhitespace(chars[i])) {
i--;
}
if (i == -1) {
return list;
}
while (splits < maxsplit) {
while (i > -1 && Character.isWhitespace(chars[i])) {
i--;
}
if (i == -1) {
break;
}
int nextWsChar = i;
while (nextWsChar > -1 && !Character.isWhitespace(chars[nextWsChar])) {
nextWsChar--;
}
if (nextWsChar == -1) {
break;
}
splits++;
list.add(fromSubstring(nextWsChar + 1, i + 1));
i = nextWsChar;
}
while (i > -1 && Character.isWhitespace(chars[i])) {
i--;
}
if (i > -1) {
list.add(fromSubstring(0,i+1));
}
list.reverse();
return list;
}
public PyTuple partition(PyObject sepObj) {
return str_partition(sepObj);
}
@ExposedMethod
final PyTuple str_partition(PyObject sepObj) {
String sep;
if (sepObj instanceof PyUnicode) {
return unicodePartition(sepObj);
} else if (sepObj instanceof PyString) {
sep = ((PyString)sepObj).string;
} else {
throw Py.TypeError("expected a character buffer object");
}
if (sep.length() == 0) {
throw Py.ValueError("empty separator");
}
int index = string.indexOf(sep);
if (index != -1) {
return new PyTuple(fromSubstring(0, index), sepObj,
fromSubstring(index + sep.length(), string.length()));
} else {
return new PyTuple(this, Py.EmptyString, Py.EmptyString);
}
}
final PyTuple unicodePartition(PyObject sepObj) {
PyUnicode strObj = __unicode__();
String str = strObj.string;
// Will throw a TypeError if not a basestring
String sep = sepObj.asString();
sepObj = sepObj.__unicode__();
if (sep.length() == 0) {
throw Py.ValueError("empty separator");
}
int index = str.indexOf(sep);
if (index != -1) {
return new PyTuple(strObj.fromSubstring(0, index), sepObj,
strObj.fromSubstring(index + sep.length(), str.length()));
} else {
PyUnicode emptyUnicode = Py.newUnicode("");
return new PyTuple(this, emptyUnicode, emptyUnicode);
}
}
public PyTuple rpartition(PyObject sepObj) {
return str_rpartition(sepObj);
}
@ExposedMethod
final PyTuple str_rpartition(PyObject sepObj) {
String sep;
if (sepObj instanceof PyUnicode) {
return unicodePartition(sepObj);
} else if (sepObj instanceof PyString) {
sep = ((PyString)sepObj).string;
} else {
throw Py.TypeError("expected a character buffer object");
}
if (sep.length() == 0) {
throw Py.ValueError("empty separator");
}
int index = string.lastIndexOf(sep);
if (index != -1) {
return new PyTuple(fromSubstring(0, index), sepObj,
fromSubstring(index + sep.length(), string.length()));
} else {
return new PyTuple(Py.EmptyString, Py.EmptyString, this);
}
}
final PyTuple unicodeRpartition(PyObject sepObj) {
PyUnicode strObj = __unicode__();
String str = strObj.string;
// Will throw a TypeError if not a basestring
String sep = sepObj.asString();
sepObj = sepObj.__unicode__();
if (sep.length() == 0) {
throw Py.ValueError("empty separator");
}
int index = str.lastIndexOf(sep);
if (index != -1) {
return new PyTuple(strObj.fromSubstring(0, index), sepObj,
strObj.fromSubstring(index + sep.length(), str.length()));
} else {
PyUnicode emptyUnicode = Py.newUnicode("");
return new PyTuple(emptyUnicode, emptyUnicode, this);
}
}
private PyList splitfields(String sep, int maxsplit) {
PyList list = new PyList();
int length = string.length();
if (maxsplit < 0)
maxsplit = length + 1;
int lastbreak = 0;
int splits = 0;
int sepLength = sep.length();
int index;
if((sep.length() == 0) && (maxsplit != 0)) {
index = string.indexOf(sep, lastbreak);
list.append(fromSubstring(lastbreak, index));
splits++;
}
while (splits < maxsplit) {
index = string.indexOf(sep, lastbreak);
if (index == -1)
break;
if(sep.length() == 0)
index++;
splits += 1;
list.append(fromSubstring(lastbreak, index));
lastbreak = index + sepLength;
}
if (lastbreak <= length) {
list.append(fromSubstring(lastbreak, length));
}
return list;
}
private PyList rsplitfields(String sep, int maxsplit) {
PyList list = new PyList();
int length = string.length();
if (maxsplit < 0) {
maxsplit = length + 1;
}
int lastbreak = length;
int splits = 0;
int index = length;
int sepLength = sep.length();
while (index > 0 && splits < maxsplit) {
int i = string.lastIndexOf(sep, index - sepLength);
if (i == index) {
i -= sepLength;
}
if (i < 0) {
break;
}
splits++;
list.append(fromSubstring(i + sepLength, lastbreak));
lastbreak = i;
index = i;
}
list.append(fromSubstring(0, lastbreak));
return list;
}
public PyList splitlines() {
return str_splitlines(false);
}
public PyList splitlines(boolean keepends) {
return str_splitlines(keepends);
}
@ExposedMethod(defaults = "false")
final PyList str_splitlines(boolean keepends) {
PyList list = new PyList();
char[] chars = string.toCharArray();
int n=chars.length;
int j = 0;
for (int i = 0; i < n; ) {
/* Find a line and append it */
while (i < n && chars[i] != '\n' && chars[i] != '\r' &&
Character.getType(chars[i]) != Character.LINE_SEPARATOR)
i++;
/* Skip the line break reading CRLF as one line break */
int eol = i;
if (i < n) {
if (chars[i] == '\r' && i + 1 < n && chars[i+1] == '\n')
i += 2;
else
i++;
if (keepends)
eol = i;
}
list.append(fromSubstring(j, eol));
j = i;
}
if (j < n) {
list.append(fromSubstring(j, n));
}
return list;
}
protected PyString fromSubstring(int begin, int end) {
return createInstance(string.substring(begin, end), true);
}
public int index(String sub) {
return str_index(sub, 0, null);
}
public int index(String sub, int start) {
return str_index(sub, start, null);
}
public int index(String sub, int start, int end) {
return str_index(sub, start, Py.newInteger(end));
}
@ExposedMethod(defaults = {"0", "null"})
final int str_index(String sub, int start, PyObject end) {
int index = str_find(sub, start, end);
if (index == -1)
throw Py.ValueError("substring not found in string.index");
return index;
}
public int rindex(String sub) {
return str_rindex(sub, 0, null);
}
public int rindex(String sub, int start) {
return str_rindex(sub, start, null);
}
public int rindex(String sub, int start, int end) {
return str_rindex(sub, start, Py.newInteger(end));
}
@ExposedMethod(defaults = {"0", "null"})
final int str_rindex(String sub, int start, PyObject end) {
int index = str_rfind(sub, start, end);
if(index == -1)
throw Py.ValueError("substring not found in string.rindex");
return index;
}
public int count(String sub) {
return str_count(sub, 0, null);
}
public int count(String sub, int start) {
return str_count(sub, start, null);
}
public int count(String sub, int start, int end) {
return str_count(sub, start, Py.newInteger(end));
}
@ExposedMethod(defaults = {"0", "null"})
final int str_count(String sub, int start, PyObject end) {
int[] indices = translateIndices(start, end);
int n = sub.length();
if(n == 0) {
if (start > string.length()) {
return 0;
}
return indices[1] - indices[0] + 1;
}
int count = 0;
while(true){
int index = string.indexOf(sub, indices[0]);
indices[0] = index + n;
if(indices[0] > indices[1] || index == -1) {
break;
}
count++;
}
return count;
}
public int find(String sub) {
return str_find(sub, 0, null);
}
public int find(String sub, int start) {
return str_find(sub, start, null);
}
public int find(String sub, int start, int end) {
return str_find(sub, start, Py.newInteger(end));
}
@ExposedMethod(defaults = {"0", "null"})
final int str_find(String sub, int start, PyObject end) {
int[] indices = translateIndices(start, end);
int index = string.indexOf(sub, indices[0]);
if (index < start || index > indices[1]) {
return -1;
}
return index;
}
public int rfind(String sub) {
return str_rfind(sub, 0, null);
}
public int rfind(String sub, int start) {
return str_rfind(sub, start, null);
}
public int rfind(String sub, int start, int end) {
return str_rfind(sub, start, Py.newInteger(end));
}
@ExposedMethod(defaults = {"0", "null"})
final int str_rfind(String sub, int start, PyObject end) {
int[] indices = translateIndices(start, end);
int index = string.lastIndexOf(sub, indices[1] - sub.length());
if (index < start) {
return -1;
}
return index;
}
public double atof() {
StringBuilder s = null;
int n = string.length();
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (ch == '\u0000') {
throw Py.ValueError("null byte in argument for float()");
}
if (Character.isDigit(ch)) {
if (s == null)
s = new StringBuilder(string);
int val = Character.digit(ch, 10);
s.setCharAt(i, Character.forDigit(val, 10));
}
}
String sval = string;
if (s != null)
sval = s.toString();
try {
// Double.valueOf allows format specifier ("d" or "f") at the end
String lowSval = sval.toLowerCase();
if (lowSval.equals("nan")) return Double.NaN;
else if (lowSval.equals("inf")) return Double.POSITIVE_INFINITY;
else if (lowSval.equals("-inf")) return Double.NEGATIVE_INFINITY;
if (lowSval.endsWith("d") || lowSval.endsWith("f")) {
throw new NumberFormatException("format specifiers not allowed");
}
return Double.valueOf(sval).doubleValue();
}
catch (NumberFormatException exc) {
throw Py.ValueError("invalid literal for __float__: "+string);
}
}
public int atoi() {
return atoi(10);
}
public int atoi(int base) {
if ((base != 0 && base < 2) || (base > 36)) {
throw Py.ValueError("invalid base for atoi()");
}
int b = 0;
int e = string.length();
while (b < e && Character.isWhitespace(string.charAt(b)))
b++;
while (e > b && Character.isWhitespace(string.charAt(e-1)))
e--;
char sign = 0;
if (b < e) {
sign = string.charAt(b);
if (sign == '-' || sign == '+') {
b++;
while (b < e && Character.isWhitespace(string.charAt(b))) b++;
}
if (base == 0 || base == 16) {
if (string.charAt(b) == '0') {
if (b < e-1 &&
Character.toUpperCase(string.charAt(b+1)) == 'X') {
base = 16;
b += 2;
} else {
if (base == 0)
base = 8;
}
}
}
}
if (base == 0)
base = 10;
String s = string;
if (b > 0 || e < string.length())
s = string.substring(b, e);
try {
BigInteger bi;
if (sign == '-') {
bi = new BigInteger("-" + s, base);
} else
bi = new BigInteger(s, base);
if (bi.compareTo(PyInteger.maxInt) > 0 || bi.compareTo(PyInteger.minInt) < 0) {
throw Py.OverflowError("long int too large to convert to int");
}
return bi.intValue();
} catch (NumberFormatException exc) {
throw Py.ValueError("invalid literal for int() with base " + base + ": " + string);
} catch (StringIndexOutOfBoundsException exc) {
throw Py.ValueError("invalid literal for int() with base " + base + ": " + string);
}
}
public PyLong atol() {
return atol(10);
}
public PyLong atol(int base) {
String str = string;
int b = 0;
int e = str.length();
while (b < e && Character.isWhitespace(str.charAt(b)))
b++;
while (e > b && Character.isWhitespace(str.charAt(e-1)))
e--;
char sign = 0;
if (b < e) {
sign = string.charAt(b);
if (sign == '-' || sign == '+') {
b++;
while (b < e && Character.isWhitespace(str.charAt(b))) b++;
}
if (base == 0 || base == 16) {
if (string.charAt(b) == '0') {
if (b < e-1 &&
Character.toUpperCase(string.charAt(b+1)) == 'X') {
base = 16;
b += 2;
} else {
if (base == 0)
base = 8;
}
}
}
}
if (base == 0)
base = 10;
if (base < 2 || base > 36)
throw Py.ValueError("invalid base for long literal:" + base);
// if the base >= 22, then an 'l' or 'L' is a digit!
if (base < 22 && e > b && (str.charAt(e-1) == 'L' || str.charAt(e-1) == 'l'))
e--;
if (b > 0 || e < str.length())
str = str.substring(b, e);
try {
java.math.BigInteger bi = null;
if (sign == '-')
bi = new java.math.BigInteger("-" + str, base);
else
bi = new java.math.BigInteger(str, base);
return new PyLong(bi);
} catch (NumberFormatException exc) {
if (this instanceof PyUnicode) {
// TODO: here's a basic issue: do we use the BigInteger constructor
// above, or add an equivalent to CPython's PyUnicode_EncodeDecimal;
// we should note that the current error string does not quite match
// CPython regardless of the codec, that's going to require some more work
throw Py.UnicodeEncodeError("decimal", "codec can't encode character",
0,0, "invalid decimal Unicode string");
}
else {
throw Py.ValueError("invalid literal for long() with base " + base + ": " + string);
}
} catch (StringIndexOutOfBoundsException exc) {
throw Py.ValueError("invalid literal for long() with base " + base + ": " + string);
}
}
private static String padding(int n, char pad) {
char[] chars = new char[n];
for (int i=0; i<n; i++)
chars[i] = pad;
return new String(chars);
}
private static char parse_fillchar(String function, String fillchar) {
if (fillchar == null) { return ' '; }
if (fillchar.length() != 1) {
throw Py.TypeError(function + "() argument 2 must be char, not str");
}
return fillchar.charAt(0);
}
public String ljust(int width) {
return str_ljust(width, null);
}
public String ljust(int width, String padding) {
return str_ljust(width, padding);
}
@ExposedMethod(defaults="null")
final String str_ljust(int width, String fillchar) {
char pad = parse_fillchar("ljust", fillchar);
int n = width-string.length();
if (n <= 0)
return string;
return string+padding(n, pad);
}
public String rjust(int width) {
return str_rjust(width, null);
}
@ExposedMethod(defaults="null")
final String str_rjust(int width, String fillchar) {
char pad = parse_fillchar("rjust", fillchar);
int n = width-string.length();
if (n <= 0)
return string;
return padding(n, pad)+string;
}
public String center(int width) {
return str_center(width, null);
}
@ExposedMethod(defaults="null")
final String str_center(int width, String fillchar) {
char pad = parse_fillchar("center", fillchar);
int n = width-string.length();
if (n <= 0)
return string;
int half = n/2;
if (n%2 > 0 && width%2 > 0)
half += 1;
return padding(half, pad)+string+padding(n-half, pad);
}
public String zfill(int width) {
return str_zfill(width);
}
@ExposedMethod
final String str_zfill(int width) {
String s = string;
int n = s.length();
if (n >= width)
return s;
char[] chars = new char[width];
int nzeros = width-n;
int i=0;
int sStart=0;
if (n > 0) {
char start = s.charAt(0);
if (start == '+' || start == '-') {
chars[0] = start;
i += 1;
nzeros++;
sStart=1;
}
}
for(;i<nzeros; i++) {
chars[i] = '0';
}
s.getChars(sStart, s.length(), chars, i);
return new String(chars);
}
public String expandtabs() {
return str_expandtabs(8);
}
public String expandtabs(int tabsize) {
return str_expandtabs(tabsize);
}
@ExposedMethod(defaults = "8")
final String str_expandtabs(int tabsize) {
String s = string;
StringBuilder buf = new StringBuilder((int)(s.length()*1.5));
char[] chars = s.toCharArray();
int n = chars.length;
int position = 0;
for(int i=0; i<n; i++) {
char c = chars[i];
if (c == '\t') {
int spaces = tabsize-position%tabsize;
position += spaces;
while (spaces-- > 0) {
buf.append(' ');
}
continue;
}
if (c == '\n' || c == '\r') {
position = -1;
}
buf.append(c);
position++;
}
return buf.toString();
}
public String capitalize() {
return str_capitalize();
}
@ExposedMethod
final String str_capitalize() {
if (string.length() == 0)
return string;
String first = string.substring(0,1).toUpperCase();
return first.concat(string.substring(1).toLowerCase());
}
@ExposedMethod(defaults = "null")
final PyString str_replace(PyObject oldPiece, PyObject newPiece, PyObject maxsplit) {
if(!(oldPiece instanceof PyString) || !(newPiece instanceof PyString)) {
throw Py.TypeError("str or unicode required for replace");
}
return replace((PyString)oldPiece, (PyString)newPiece, maxsplit == null ? -1 : maxsplit.asInt());
}
protected PyString replace(PyString oldPiece, PyString newPiece, int maxsplit) {
int len = string.length();
int old_len = oldPiece.string.length();
if (len == 0) {
if (maxsplit == -1 && old_len == 0) {
return createInstance(newPiece.string, true);
}
return createInstance(string, true);
}
if (old_len == 0 && newPiece.string.length() != 0 && maxsplit !=0) {
// old="" and new != "", interleave new piece with each char in original, taking in effect maxsplit
StringBuilder buffer = new StringBuilder();
int i = 0;
buffer.append(newPiece.string);
for (; i < len && (i < maxsplit-1 || maxsplit == -1); i++) {
buffer.append(string.charAt(i));
buffer.append(newPiece.string);
}
buffer.append(string.substring(i));
return createInstance(buffer.toString(), true);
}
if(maxsplit == -1) {
if(old_len == 0) {
maxsplit = len + 1;
} else {
maxsplit = len;
}
}
return newPiece.str_join(splitfields(oldPiece.string, maxsplit));
}
public String join(PyObject seq) {
return str_join(seq).string;
}
@ExposedMethod
final PyString str_join(PyObject obj) {
// Similar to CPython's abstract::PySequence_Fast
PySequence seq;
if (obj instanceof PySequence) {
seq = (PySequence)obj;
} else {
seq = new PyList(obj.__iter__());
}
PyObject item;
int seqlen = seq.__len__();
if (seqlen == 0) {
return createInstance("", true);
}
if (seqlen == 1) {
item = seq.pyget(0);
if (item.getType() == PyUnicode.TYPE ||
(item.getType() == PyString.TYPE && getType() == PyString.TYPE)) {
return (PyString)item;
}
}
boolean needsUnicode = false;
long joinedSize = 0;
StringBuilder buf = new StringBuilder();
for (int i = 0; i < seqlen; i++) {
item = seq.pyget(i);
if (!(item instanceof PyString)) {
throw Py.TypeError(String.format("sequence item %d: expected string, %.80s found",
i, item.getType().fastGetName()));
}
if (item instanceof PyUnicode) {
needsUnicode = true;
}
if (i > 0) {
buf.append(string);
joinedSize += string.length();
}
String itemString = ((PyString)item).string;
buf.append(itemString);
joinedSize += itemString.length();
if (joinedSize > Integer.MAX_VALUE) {
throw Py.OverflowError("join() result is too long for a Python string");
}
}
if (needsUnicode){
return new PyUnicode(buf.toString());
}
return createInstance(buf.toString(), true);
}
public boolean startswith(PyObject prefix) {
return str_startswith(prefix, 0, null);
}
public boolean startswith(PyObject prefix, int offset) {
return str_startswith(prefix, offset, null);
}
public boolean startswith(PyObject prefix, int start, int end) {
return str_startswith(prefix, start, Py.newInteger(end));
}
@ExposedMethod(defaults = {"0", "null"})
final boolean str_startswith(PyObject prefix, int start, PyObject end) {
int[] indices = translateIndices(start, end);
if (prefix instanceof PyString) {
String strPrefix = ((PyString)prefix).string;
if (indices[1] - indices[0] < strPrefix.length())
return false;
return string.startsWith(strPrefix, indices[0]);
} else if (prefix instanceof PyTuple) {
PyObject[] prefixes = ((PyTuple)prefix).getArray();
for (int i = 0 ; i < prefixes.length ; i++) {
if (!(prefixes[i] instanceof PyString))
throw Py.TypeError("expected a character buffer object");
String strPrefix = ((PyString)prefixes[i]).string;
if (indices[1] - indices[0] < strPrefix.length())
continue;
if (string.startsWith(strPrefix, indices[0]))
return true;
}
return false;
} else {
throw Py.TypeError("expected a character buffer object or tuple");
}
}
public boolean endswith(PyObject suffix) {
return str_endswith(suffix, 0, null);
}
public boolean endswith(PyObject suffix, int start) {
return str_endswith(suffix, start, null);
}
public boolean endswith(PyObject suffix, int start, int end) {
return str_endswith(suffix, start, Py.newInteger(end));
}
@ExposedMethod(defaults = {"0", "null"})
final boolean str_endswith(PyObject suffix, int start, PyObject end) {
int[] indices = translateIndices(start, end);
String substr = string.substring(indices[0], indices[1]);
if (suffix instanceof PyString) {
return substr.endsWith(((PyString)suffix).string);
} else if (suffix instanceof PyTuple) {
PyObject[] suffixes = ((PyTuple)suffix).getArray();
for (int i = 0 ; i < suffixes.length ; i++) {
if (!(suffixes[i] instanceof PyString))
throw Py.TypeError("expected a character buffer object");
if (substr.endsWith(((PyString)suffixes[i]).string))
return true;
}
return false;
} else {
throw Py.TypeError("expected a character buffer object or tuple");
}
}
/**
* Turns the possibly negative Python slice start and end into valid indices
* into this string.
*
* @return a 2 element array of indices into this string describing a
* substring from [0] to [1]. [0] <= [1], [0] >= 0 and [1] <=
* string.length()
*
*/
protected int[] translateIndices(int start, PyObject end) {
int iEnd;
if(end == null) {
iEnd = string.length();
} else {
iEnd = end.asInt();
}
int n = string.length();
if(iEnd < 0) {
iEnd = n + iEnd;
if(iEnd < 0) {
iEnd = 0;
}
} else if(iEnd > n) {
iEnd = n;
}
if(start < 0) {
start = n + start;
if(start < 0) {
start = 0;
}
}
if(start > iEnd) {
start = iEnd;
}
return new int[] {start, iEnd};
}
public String translate(String table) {
return str_translate(table, null);
}
public String translate(String table, String deletechars) {
return str_translate(table, deletechars);
}
@ExposedMethod(defaults = "null")
final String str_translate(String table, String deletechars) {
if (table.length() != 256)
throw Py.ValueError(
"translation table must be 256 characters long");
StringBuilder buf = new StringBuilder(string.length());
for (int i=0; i < string.length(); i++) {
char c = string.charAt(i);
if (deletechars != null && deletechars.indexOf(c) >= 0)
continue;
try {
buf.append(table.charAt(c));
}
catch (IndexOutOfBoundsException e) {
throw Py.TypeError(
"translate() only works for 8-bit character strings");
}
}
return buf.toString();
}
//XXX: is this needed?
public String translate(PyObject table) {
StringBuilder v = new StringBuilder(string.length());
for (int i=0; i < string.length(); i++) {
char ch = string.charAt(i);
PyObject w = Py.newInteger(ch);
PyObject x = table.__finditem__(w);
if (x == null) {
/* No mapping found: default to 1-1 mapping */
v.append(ch);
continue;
}
/* Apply mapping */
if (x instanceof PyInteger) {
int value = ((PyInteger) x).getValue();
v.append((char) value);
} else if (x == Py.None) {
;
} else if (x instanceof PyString) {
if (x.__len__() != 1) {
/* 1-n mapping */
throw new PyException(Py.NotImplementedError,
"1-n mappings are currently not implemented");
}
v.append(x.toString());
}
else {
/* wrong return value */
throw Py.TypeError(
"character mapping must return integer, " +
"None or unicode");
}
}
return v.toString();
}
public boolean islower() {
return str_islower();
}
@ExposedMethod
final boolean str_islower() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1)
return Character.isLowerCase(string.charAt(0));
boolean cased = false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (Character.isUpperCase(ch) || Character.isTitleCase(ch))
return false;
else if (!cased && Character.isLowerCase(ch))
cased = true;
}
return cased;
}
public boolean isupper() {
return str_isupper();
}
@ExposedMethod
final boolean str_isupper() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1)
return Character.isUpperCase(string.charAt(0));
boolean cased = false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (Character.isLowerCase(ch) || Character.isTitleCase(ch))
return false;
else if (!cased && Character.isUpperCase(ch))
cased = true;
}
return cased;
}
public boolean isalpha() {
return str_isalpha();
}
@ExposedMethod
final boolean str_isalpha() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1)
return Character.isLetter(string.charAt(0));
if (n == 0)
return false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (!Character.isLetter(ch))
return false;
}
return true;
}
public boolean isalnum() {
return str_isalnum();
}
@ExposedMethod
final boolean str_isalnum() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1)
return _isalnum(string.charAt(0));
if (n == 0)
return false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (!_isalnum(ch))
return false;
}
return true;
}
private boolean _isalnum(char ch) {
// This can ever be entirely compatible with CPython. In CPython
// The type is not used, the numeric property is determined from
// the presense of digit, decimal or numeric fields. These fields
// are not available in exactly the same way in java.
return Character.isLetterOrDigit(ch) ||
Character.getType(ch) == Character.LETTER_NUMBER;
}
public boolean isdecimal() {
return str_isdecimal();
}
@ExposedMethod
final boolean str_isdecimal() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1) {
char ch = string.charAt(0);
return _isdecimal(ch);
}
if (n == 0)
return false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (!_isdecimal(ch))
return false;
}
return true;
}
private boolean _isdecimal(char ch) {
// See the comment in _isalnum. Here it is even worse.
return Character.getType(ch) == Character.DECIMAL_DIGIT_NUMBER;
}
public boolean isdigit() {
return str_isdigit();
}
@ExposedMethod
final boolean str_isdigit() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1)
return Character.isDigit(string.charAt(0));
if (n == 0)
return false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (!Character.isDigit(ch))
return false;
}
return true;
}
public boolean isnumeric() {
return str_isnumeric();
}
@ExposedMethod
final boolean str_isnumeric() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1)
return _isnumeric(string.charAt(0));
if (n == 0)
return false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (!_isnumeric(ch))
return false;
}
return true;
}
private boolean _isnumeric(char ch) {
int type = Character.getType(ch);
return type == Character.DECIMAL_DIGIT_NUMBER ||
type == Character.LETTER_NUMBER ||
type == Character.OTHER_NUMBER;
}
public boolean istitle() {
return str_istitle();
}
@ExposedMethod
final boolean str_istitle() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1)
return Character.isTitleCase(string.charAt(0)) ||
Character.isUpperCase(string.charAt(0));
boolean cased = false;
boolean previous_is_cased = false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (Character.isUpperCase(ch) || Character.isTitleCase(ch)) {
if (previous_is_cased)
return false;
previous_is_cased = true;
cased = true;
}
else if (Character.isLowerCase(ch)) {
if (!previous_is_cased)
return false;
previous_is_cased = true;
cased = true;
}
else
previous_is_cased = false;
}
return cased;
}
public boolean isspace() {
return str_isspace();
}
@ExposedMethod
final boolean str_isspace() {
int n = string.length();
/* Shortcut for single character strings */
if (n == 1)
return Character.isWhitespace(string.charAt(0));
if (n == 0)
return false;
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (!Character.isWhitespace(ch))
return false;
}
return true;
}
public boolean isunicode() {
return str_isunicode();
}
@ExposedMethod
final boolean str_isunicode() {
int n = string.length();
for (int i = 0; i < n; i++) {
char ch = string.charAt(i);
if (ch > 255)
return true;
}
return false;
}
public String encode() {
return str_encode(null, null);
}
public String encode(String encoding) {
return str_encode(encoding, null);
}
public String encode(String encoding, String errors) {
return str_encode(encoding, errors);
}
@ExposedMethod(defaults = {"null", "null"})
final String str_encode(String encoding, String errors) {
return codecs.encode(this, encoding, errors);
}
public PyObject decode() {
return str_decode(null, null);
}
public PyObject decode(String encoding) {
return str_decode(encoding, null);
}
public PyObject decode(String encoding, String errors) {
return str_decode(encoding, errors);
}
@ExposedMethod(defaults = {"null", "null"})
final PyObject str_decode(String encoding, String errors) {
return codecs.decode(this, encoding, errors);
}
/* arguments' conversion helper */
public String asString(int index) throws PyObject.ConversionException {
return string;
}
@Override
public String asString() {
return string;
}
public String asName(int index) throws PyObject.ConversionException {
return internedString();
}
protected String unsupportedopMessage(String op, PyObject o2) {
if (op.equals("+")) {
return "cannot concatenate ''{1}'' and ''{2}'' objects";
}
return super.unsupportedopMessage(op, o2);
}
}
final class StringFormatter
{
int index;
String format;
StringBuilder buffer;
boolean negative;
int precision;
int argIndex;
PyObject args;
boolean unicodeCoercion;
final char pop() {
try {
return format.charAt(index++);
} catch (StringIndexOutOfBoundsException e) {
throw Py.ValueError("incomplete format");
}
}
final char peek() {
return format.charAt(index);
}
final void push() {
index--;
}
public StringFormatter(String format) {
this(format, false);
}
public StringFormatter(String format, boolean unicodeCoercion) {
index = 0;
this.format = format;
this.unicodeCoercion = unicodeCoercion;
buffer = new StringBuilder(format.length()+100);
}
PyObject getarg() {
PyObject ret = null;
switch(argIndex) {
// special index indicating a mapping
case -3:
return args;
// special index indicating a single item that has already been
// used
case -2:
break;
// special index indicating a single item that has not yet been
// used
case -1:
argIndex=-2;
return args;
default:
ret = args.__finditem__(argIndex++);
break;
}
if (ret == null)
throw Py.TypeError("not enough arguments for format string");
return ret;
}
int getNumber() {
char c = pop();
if (c == '*') {
PyObject o = getarg();
if (o instanceof PyInteger)
return ((PyInteger)o).getValue();
throw Py.TypeError("* wants int");
} else {
if (Character.isDigit(c)) {
int numStart = index-1;
while (Character.isDigit(c = pop()))
;
index -= 1;
Integer i = Integer.valueOf(
format.substring(numStart, index));
return i.intValue();
}
index -= 1;
return 0;
}
}
private void checkPrecision(String type) {
if(precision > 250) {
// A magic number. Larger than in CPython.
throw Py.OverflowError("formatted " + type + " is too long (precision too long?)");
}
}
private String formatLong(PyObject arg, char type, boolean altFlag) {
PyString argAsString;
switch (type) {
case 'o':
argAsString = arg.__oct__();
break;
case 'x':
case 'X':
argAsString = arg.__hex__();
break;
default:
argAsString = arg.__str__();
break;
}
checkPrecision("long");
String s = argAsString.toString();
int end = s.length();
int ptr = 0;
int numnondigits = 0;
if (type == 'x' || type == 'X')
numnondigits = 2;
if (s.endsWith("L"))
end--;
negative = s.charAt(0) == '-';
if (negative) {
ptr++;
}
int numdigits = end - numnondigits - ptr;
if (!altFlag) {
switch (type) {
case 'o' :
if (numdigits > 1) {
++ptr;
--numdigits;
}
break;
case 'x' :
case 'X' :
ptr += 2;
numnondigits -= 2;
break;
}
}
if (precision > numdigits) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < numnondigits; ++i)
buf.append(s.charAt(ptr++));
for (int i = 0; i < precision - numdigits; i++)
buf.append('0');
for (int i = 0; i < numdigits; i++)
buf.append(s.charAt(ptr++));
s = buf.toString();
} else if (end < s.length() || ptr > 0)
s = s.substring(ptr, end);
switch (type) {
case 'X' :
s = s.toUpperCase();
break;
}
return s;
}
/**
* Formats arg as an integer, with the specified radix
*
* type and altFlag are needed to be passed to {@link #formatLong(PyObject, char, boolean)}
* in case the result of <code>arg.__int__()</code> is a PyLong.
*/
private String formatInteger(PyObject arg, int radix, boolean unsigned, char type, boolean altFlag) {
PyObject argAsInt;
if (arg instanceof PyInteger || arg instanceof PyLong) {
argAsInt = arg;
} else {
// use __int__ to get an int (or long)
if (arg instanceof PyFloat) {
// safe to call __int__:
argAsInt = arg.__int__();
} else {
// Same case noted on formatFloatDecimal:
// We can't simply call arg.__int__() because PyString implements
// it without exposing it to python (i.e, str instances has no
// __int__ attribute). So, we would support strings as arguments
// for %d format, which is forbidden by CPython tests (on
// test_format.py).
try {
argAsInt = arg.__getattr__("__int__").__call__();
} catch (PyException e) {
// XXX: Swallow customs AttributeError throws from __float__ methods
// No better alternative for the moment
if (Py.matchException(e, Py.AttributeError)) {
throw Py.TypeError("int argument required");
}
throw e;
}
}
}
if (argAsInt instanceof PyInteger) {
return formatInteger(((PyInteger)argAsInt).getValue(), radix, unsigned);
} else { // must be a PyLong (as per __int__ contract)
return formatLong(argAsInt, type, altFlag);
}
}
private String formatInteger(long v, int radix, boolean unsigned) {
checkPrecision("integer");
if (unsigned) {
if (v < 0)
v = 0x100000000l + v;
} else {
if (v < 0) {
negative = true;
v = -v;
}
}
String s = Long.toString(v, radix);
while (s.length() < precision) {
s = "0"+s;
}
return s;
}
private String formatFloatDecimal(PyObject arg, boolean truncate) {
PyFloat argAsFloat;
if (arg instanceof PyFloat) {
// Fast path
argAsFloat = (PyFloat)arg;
} else {
// Use __float__
if (arg instanceof PyInteger || arg instanceof PyLong) {
// Typical cases, safe to call __float__:
argAsFloat = arg.__float__();
} else {
try {
// We can't simply call arg.__float__() because PyString implements
// it without exposing it to python (i.e, str instances has no
// __float__ attribute). So, we would support strings as arguments
// for %g format, which is forbidden by CPython tests (on
// test_format.py).
argAsFloat = (PyFloat)arg.__getattr__("__float__").__call__();
} catch (PyException e) {
// XXX: Swallow customs AttributeError throws from __float__ methods
// No better alternative for the moment
if (Py.matchException(e, Py.AttributeError)) {
throw Py.TypeError("float argument required");
}
throw e;
}
}
}
return formatFloatDecimal(argAsFloat.getValue(), truncate);
}
private String formatFloatDecimal(double v, boolean truncate) {
checkPrecision("decimal");
java.text.NumberFormat format = java.text.NumberFormat.getInstance(
java.util.Locale.US);
int prec = precision;
if (prec == -1)
prec = 6;
if (v < 0) {
v = -v;
negative = true;
}
format.setMaximumFractionDigits(prec);
format.setMinimumFractionDigits(truncate ? 0 : prec);
format.setGroupingUsed(false);
String ret = format.format(v);
// System.err.println("formatFloat: "+v+", prec="+prec+", ret="+ret);
// if (ret.indexOf('.') == -1) {
// return ret+'.';
// }
return ret;
}
private String formatFloatExponential(PyObject arg, char e,
boolean truncate)
{
StringBuilder buf = new StringBuilder();
double v = arg.__float__().getValue();
boolean isNegative = false;
if (v < 0) {
v = -v;
isNegative = true;
}
double power = 0.0;
if (v > 0)
power = ExtraMath.closeFloor(Math.log10(v));
//System.err.println("formatExp: "+v+", "+power);
int savePrecision = precision;
precision = 2;
String exp = formatInteger((long)power, 10, false);
if (negative) {
negative = false;
exp = '-'+exp;
}
else {
exp = '+' + exp;
}
precision = savePrecision;
double base = v/Math.pow(10, power);
buf.append(formatFloatDecimal(base, truncate));
buf.append(e);
buf.append(exp);
negative = isNegative;
return buf.toString();
}
public PyString format(PyObject args) {
PyObject dict = null;
this.args = args;
boolean needUnicode = unicodeCoercion;
if (args instanceof PyTuple) {
argIndex = 0;
} else {
// special index indicating a single item rather than a tuple
argIndex = -1;
if (args instanceof PyDictionary ||
args instanceof PyStringMap ||
(!(args instanceof PySequence) &&
args.__findattr__("__getitem__") != null))
{
dict = args;
argIndex = -3;
}
}
while (index < format.length()) {
boolean ljustFlag=false;
boolean signFlag=false;
boolean blankFlag=false;
boolean altFlag=false;
boolean zeroFlag=false;
int width = -1;
precision = -1;
char c = pop();
if (c != '%') {
buffer.append(c);
continue;
}
c = pop();
if (c == '(') {
if (dict == null)
throw Py.TypeError("format requires a mapping");
int parens = 1;
int keyStart = index;
while (parens > 0) {
c = pop();
if (c == ')')
parens--;
else if (c == '(')
parens++;
}
String tmp = format.substring(keyStart, index-1);
this.args = dict.__getitem__(new PyString(tmp));
} else {
push();
}
while (true) {
switch (c = pop()) {
case '-': ljustFlag=true; continue;
case '+': signFlag=true; continue;
case ' ': blankFlag=true; continue;
case '#': altFlag=true; continue;
case '0': zeroFlag=true; continue;
}
break;
}
push();
width = getNumber();
if (width < 0) {
width = -width;
ljustFlag = true;
}
c = pop();
if (c == '.') {
precision = getNumber();
if (precision < -1)
precision = 0;
c = pop();
}
if (c == 'h' || c == 'l' || c == 'L') {
c = pop();
}
if (c == '%') {
buffer.append(c);
continue;
}
PyObject arg = getarg();
char fill = ' ';
String string=null;
negative = false;
if (zeroFlag)
fill = '0';
else
fill = ' ';
switch(c) {
case 's':
case 'r':
fill = ' ';
if (arg instanceof PyUnicode) {
needUnicode = true;
}
if (c == 's')
if (needUnicode)
string = arg.__unicode__().toString();
else
string = arg.__str__().toString();
else
string = arg.__repr__().toString();
if (precision >= 0 && string.length() > precision) {
string = string.substring(0, precision);
}
break;
case 'i':
case 'd':
if (arg instanceof PyLong)
string = formatLong(arg, c, altFlag);
else
string = formatInteger(arg, 10, false, c, altFlag);
break;
case 'u':
if (arg instanceof PyLong)
string = formatLong(arg, c, altFlag);
else if (arg instanceof PyInteger || arg instanceof PyFloat)
string = formatInteger(arg, 10, false, c, altFlag);
else throw Py.TypeError("int argument required");
break;
case 'o':
if (arg instanceof PyLong)
string = formatLong(arg, c, altFlag);
else if (arg instanceof PyInteger || arg instanceof PyFloat) {
string = formatInteger(arg, 8, false, c, altFlag);
if (altFlag && string.charAt(0) != '0') {
string = "0" + string;
}
}
else throw Py.TypeError("int argument required");
break;
case 'x':
if (arg instanceof PyLong)
string = formatLong(arg, c, altFlag);
else if (arg instanceof PyInteger || arg instanceof PyFloat) {
string = formatInteger(arg, 16, false, c, altFlag);
string = string.toLowerCase();
if (altFlag) {
string = "0x" + string;
}
}
else throw Py.TypeError("int argument required");
break;
case 'X':
if (arg instanceof PyLong)
string = formatLong(arg, c, altFlag);
else if (arg instanceof PyInteger || arg instanceof PyFloat) {
string = formatInteger(arg, 16, false, c, altFlag);
string = string.toUpperCase();
if (altFlag) {
string = "0X" + string;
}
}
else throw Py.TypeError("int argument required");
break;
case 'e':
case 'E':
string = formatFloatExponential(arg, c, false);
break;
case 'f':
case 'F':
string = formatFloatDecimal(arg, false);
// if (altFlag && string.indexOf('.') == -1)
// string += '.';
break;
case 'g':
case 'G':
int origPrecision = precision;
if (precision == -1) {
precision = 6;
}
double v = arg.__float__().getValue();
int exponent = (int)ExtraMath.closeFloor(Math.log10(Math.abs(v == 0 ? 1 : v)));
if (v == Double.POSITIVE_INFINITY) {
string = "inf";
} else if (v == Double.NEGATIVE_INFINITY) {
string = "-inf";
} else if (exponent >= -4 && exponent < precision) {
precision -= exponent + 1;
string = formatFloatDecimal(arg, !altFlag);
// XXX: this block may be unnecessary now
if (altFlag && string.indexOf('.') == -1) {
int zpad = origPrecision - string.length();
string += '.';
if (zpad > 0) {
char zeros[] = new char[zpad];
for (int ci=0; ci<zpad; zeros[ci++] = '0')
;
string += new String(zeros);
}
}
} else {
// Exponential precision is the number of digits after the decimal
// point, whereas 'g' precision is the number of significant digits --
// and expontential always provides one significant digit before the
// decimal point
precision--;
string = formatFloatExponential(arg, (char)(c-2), !altFlag);
}
break;
case 'c':
fill = ' ';
if (arg instanceof PyString) {
string = ((PyString)arg).toString();
if (string.length() != 1) {
throw Py.TypeError("%c requires int or char");
}
if (arg instanceof PyUnicode) {
needUnicode = true;
}
break;
}
int val;
try {
val = ((PyInteger)arg.__int__()).getValue();
} catch (PyException e){
if (Py.matchException(e, Py.AttributeError)) {
throw Py.TypeError("%c requires int or char");
}
throw e;
}
if (val < 0) {
throw Py.OverflowError("unsigned byte integer is less than minimum");
} else if (val > 255) {
throw Py.OverflowError("unsigned byte integer is greater than maximum");
}
string = new Character((char)val).toString();
break;
default:
throw Py.ValueError("unsupported format character '" +
codecs.encode(Py.newString(c), null, "replace") +
"' (0x" + Integer.toHexString(c) + ") at index " +
(index-1));
}
int length = string.length();
int skip = 0;
String signString = null;
if (negative) {
signString = "-";
} else {
if (signFlag) {
signString = "+";
} else if (blankFlag) {
signString = " ";
}
}
if (width < length)
width = length;
if (signString != null) {
if (fill != ' ')
buffer.append(signString);
if (width > length)
width--;
}
if (altFlag && (c == 'x' || c == 'X')) {
if (fill != ' ') {
buffer.append('0');
buffer.append(c);
skip += 2;
}
width -= 2;
if (width < 0)
width = 0;
length -= 2;
}
if (width > length && !ljustFlag) {
do {
buffer.append(fill);
} while (--width > length);
}
if (fill == ' ') {
if (signString != null)
buffer.append(signString);
if (altFlag && (c == 'x' || c == 'X')) {
buffer.append('0');
buffer.append(c);
skip += 2;
}
}
if (skip > 0)
buffer.append(string.substring(skip));
else
buffer.append(string);
while (--width >= length) {
buffer.append(' ');
}
}
if (argIndex == -1 ||
(argIndex >= 0 && args.__finditem__(argIndex) != null))
{
throw Py.TypeError("not all arguments converted during string formatting");
}
if (needUnicode) {
return new PyUnicode(buffer);
}
return new PyString(buffer);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
67564a256452073f8f01293d14afbe8caea1160d | 1bd081a2f75bc8378baeb0fda455d1fbf894facc | /app/src/main/java/id/ac/polban/jtk/models/Place.java | 77d572291a1fe24e9af38e837f581e6f542a7920 | [
"MIT"
] | permissive | MufidJamaluddin/NearestPlace | f24c756325063a35c67139acef353562372f9633 | d3452c0c13dbf5742b99902babb7b91ffebe67c9 | refs/heads/master | 2020-03-09T17:24:28.845383 | 2018-04-12T05:17:01 | 2018-04-12T05:17:01 | 128,908,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package id.ac.polban.jtk.models;
public class Place
{
private int id;
private String name;
private double latitude;
private double longitude;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
}
| [
"mufid.jamaluddin@gmail.com"
] | mufid.jamaluddin@gmail.com |
23bfa142f88fda244ff997ffa75657b740a629f1 | de91a868946d2e93c2f0ef713437d1c00d50dd0a | /camellia-redis-proxy/src/main/java/com/netease/nim/camellia/redis/proxy/conf/Constants.java | 90023cd5ebd8d5ea0a4b84290ddea6b356d1f760 | [
"MIT"
] | permissive | roy2015/camellia | 64369a8fe863b02f8abe07d1c45ffe2b835960a8 | 9b0a176ce00ec6bd1f68ed2410fe47df9160deee | refs/heads/master | 2023-06-26T12:13:32.505186 | 2021-07-20T14:17:29 | 2021-07-20T14:17:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,776 | java | package com.netease.nim.camellia.redis.proxy.conf;
import com.netease.nim.camellia.core.util.SysUtils;
import com.netease.nim.camellia.redis.proxy.command.async.bigkey.LoggingBigKeyMonitorCallback;
import com.netease.nim.camellia.redis.proxy.command.async.hotkey.LoggingHotKeyMonitorCallback;
import com.netease.nim.camellia.redis.proxy.command.async.hotkeycache.DummyHotKeyCacheKeyChecker;
import com.netease.nim.camellia.redis.proxy.command.async.hotkeycache.LoggingHotKeyCacheStatsCallback;
import com.netease.nim.camellia.redis.proxy.command.async.route.DynamicConfProxyRouteConfUpdater;
import com.netease.nim.camellia.redis.proxy.command.async.spendtime.LoggingSlowCommandMonitorCallback;
import com.netease.nim.camellia.redis.proxy.monitor.LoggingMonitorCallback;
/**
* 一些默认配置项
* Created by caojiajun on 2020/2/5.
*/
public class Constants {
public static class Server {
public static final int severPort = 6379;
public static final int consolePort = 16379;
public static final boolean monitorEnable = false;
public static final boolean commandSpendTimeMonitorEnable = false;
public static final String monitorCallbackClassName = LoggingMonitorCallback.class.getName();
public static final long slowCommandThresholdMillisTime = 2000L;
public static final String slowCommandMonitorCallbackClassName = LoggingSlowCommandMonitorCallback.class.getName();
public static final int monitorIntervalSeconds = 60;
public static final int workThread = SysUtils.getCpuNum();
public static final int commandDecodeMaxBatchSize = 256;
public static final int commandDecodeBufferInitializerSize = 32;
public static final int soBacklog = 1024;
public static final int soSndbuf = 10 * 1024 * 1024;
public static final int soRcvbuf = 10 * 1024 * 1024;
public static final int writeBufferWaterMarkLow = 128 * 1024;
public static final int writeBufferWaterMarkHigh = 512 * 1024;
public static final boolean hotKeyMonitorEnable = false;
public static final long hotKeyMonitorCheckMillis = 1000L;
public static final int hotKeyMonitorCheckCacheMaxCapacity = 100000;
public static final long hotKeyMonitorCheckThreshold = 100;
public static final int hotKeyMonitorMaxHotKeyCount = 32;
public static final String hotKeyMonitorCallbackClassName = LoggingHotKeyMonitorCallback.class.getName();
public static final boolean hotKeyCacheEnable = false;
public static final long hotKeyCacheExpireMillis = 10000;
public static final int hotKeyCacheMaxCapacity = 1000;
public static final long hotKeyCacheCounterCheckMillis = 1000;
public static final int hotKeyCacheCounterMaxCapacity = 100000;
public static final long hotKeyCacheCounterCheckThreshold = 100;
public static final boolean hotKeyCacheNeedCacheNull = true;
public static final String hotKeyCacheKeyCheckerClassName = DummyHotKeyCacheKeyChecker.class.getName();
public static final long hotKeyCacheStatsCallbackIntervalSeconds = 60;
public static final String hotKeyCacheStatsCallbackClassName = LoggingHotKeyCacheStatsCallback.class.getName();
public static final boolean bigKeyMonitorEnable = false;
public static final int bigKeyStringSizeThreshold = 1024 * 1024 * 2;
public static final int bigKeyListSizeThreshold = 10000;
public static final int bigKeyZsetSizeThreshold = 10000;
public static final int bigKeyHashSizeThreshold = 10000;
public static final int bigKeySetSizeThreshold = 10000;
public static final String bigKeyMonitorCallbackClassName = LoggingBigKeyMonitorCallback.class.getName();
public static final boolean monitorDataMaskPassword = false;//对外暴露的监控数据是否把密码隐藏(用*代替)
}
public static class Transpond {
public static final int redisClusterMaxAttempts = 5;
public static final int heartbeatIntervalSeconds = 60;//若小于等于0则不发心跳
public static final long heartbeatTimeoutMillis = 10000L;
public static final int connectTimeoutMillis = 500;
public static final int failCountThreshold = 5;
public static final long failBanMillis = 5000L;
public static final int defaultTranspondWorkThread = SysUtils.getCpuHalfNum();//if queueType is None, then effective
public static final MultiWriteMode multiWriteMode = MultiWriteMode.FIRST_RESOURCE_ONLY;
public static final boolean preheat = true;//预热,若开启,则启动proxy时会预先建立好到后端redis的连接
public static final boolean closeIdleConnection = true;//是否关闭空闲连接(到后端redis的)
public static final long checkIdleConnectionThresholdSeconds = 60 * 10;//判断一个连接空闲的阈值,单位秒
public static final int closeIdleConnectionDelaySeconds = 60;//判断一个连接空闲后,再过多少秒去执行关闭操作
}
public static class Remote {
public static final boolean dynamic = true;
public static final boolean monitorEnable = true;
public static final long checkIntervalMillis = 5000;
public static final int connectTimeoutMillis = 10000;
public static final int readTimeoutMillis = 60000;
}
public static class Custom {
public static final String proxyRouteConfUpdaterClassName = DynamicConfProxyRouteConfUpdater.class.getName();
public static final boolean dynamic = true;
public static final long reloadIntervalMillis = 10 * 60 * 1000;//避免ProxyRouteConfUpdater更新丢失,兜底轮询的间隔
}
}
| [
"hzcaojiajun@corp.netease.com"
] | hzcaojiajun@corp.netease.com |
379b52768499e98b675a8800c4300d00ca520a48 | b7c6bb804cf723474480fc1e619a6311a9425995 | /app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/loader/R.java | 6655efd606fcb80c09f055a0e54109f93e7f74b5 | [] | no_license | shusrushabezugam/ValetParkingProto | c41307104ec2db9487d64caafe67998a6af00782 | 5ceec6232761ca78d478d041e4702188a8bca061 | refs/heads/master | 2020-07-27T20:05:30.599707 | 2019-09-18T15:26:45 | 2019-09-18T15:26:45 | 209,194,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,453 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.loader;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f02008a;
public static final int fontProviderAuthority = 0x7f02008c;
public static final int fontProviderCerts = 0x7f02008d;
public static final int fontProviderFetchStrategy = 0x7f02008e;
public static final int fontProviderFetchTimeout = 0x7f02008f;
public static final int fontProviderPackage = 0x7f020090;
public static final int fontProviderQuery = 0x7f020091;
public static final int fontStyle = 0x7f020092;
public static final int fontVariationSettings = 0x7f020093;
public static final int fontWeight = 0x7f020094;
public static final int ttcIndex = 0x7f020150;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04004a;
public static final int notification_icon_bg_color = 0x7f04004b;
public static final int ripple_material_light = 0x7f040056;
public static final int secondary_text_default_material_light = 0x7f040058;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int compat_notification_large_icon_max_height = 0x7f050050;
public static final int compat_notification_large_icon_max_width = 0x7f050051;
public static final int notification_action_icon_size = 0x7f05005b;
public static final int notification_action_text_size = 0x7f05005c;
public static final int notification_big_circle_margin = 0x7f05005d;
public static final int notification_content_margin_start = 0x7f05005e;
public static final int notification_large_icon_height = 0x7f05005f;
public static final int notification_large_icon_width = 0x7f050060;
public static final int notification_main_column_padding_top = 0x7f050061;
public static final int notification_media_narrow_margin = 0x7f050062;
public static final int notification_right_icon_size = 0x7f050063;
public static final int notification_right_side_padding_top = 0x7f050064;
public static final int notification_small_icon_background_padding = 0x7f050065;
public static final int notification_small_icon_size_as_large = 0x7f050066;
public static final int notification_subtext_size = 0x7f050067;
public static final int notification_top_pad = 0x7f050068;
public static final int notification_top_pad_large_text = 0x7f050069;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060075;
public static final int notification_bg = 0x7f060076;
public static final int notification_bg_low = 0x7f060077;
public static final int notification_bg_low_normal = 0x7f060078;
public static final int notification_bg_low_pressed = 0x7f060079;
public static final int notification_bg_normal = 0x7f06007a;
public static final int notification_bg_normal_pressed = 0x7f06007b;
public static final int notification_icon_background = 0x7f06007c;
public static final int notification_template_icon_bg = 0x7f06007d;
public static final int notification_template_icon_low_bg = 0x7f06007e;
public static final int notification_tile_bg = 0x7f06007f;
public static final int notify_panel_notification_icon_bg = 0x7f060080;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f07000e;
public static final int action_divider = 0x7f070010;
public static final int action_image = 0x7f070011;
public static final int action_text = 0x7f070017;
public static final int actions = 0x7f070018;
public static final int async = 0x7f070020;
public static final int blocking = 0x7f070025;
public static final int chronometer = 0x7f070032;
public static final int forever = 0x7f070054;
public static final int icon = 0x7f07005d;
public static final int icon_group = 0x7f07005e;
public static final int info = 0x7f070064;
public static final int italic = 0x7f070066;
public static final int line1 = 0x7f07006a;
public static final int line3 = 0x7f07006b;
public static final int normal = 0x7f07007e;
public static final int notification_background = 0x7f07007f;
public static final int notification_main_column = 0x7f070080;
public static final int notification_main_column_container = 0x7f070081;
public static final int right_icon = 0x7f070094;
public static final int right_side = 0x7f070095;
public static final int tag_transition_group = 0x7f0700bd;
public static final int tag_unhandled_key_event_manager = 0x7f0700be;
public static final int tag_unhandled_key_listeners = 0x7f0700bf;
public static final int text = 0x7f0700c2;
public static final int text2 = 0x7f0700c3;
public static final int time = 0x7f0700c7;
public static final int title = 0x7f0700c8;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080005;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f09002b;
public static final int notification_action_tombstone = 0x7f09002c;
public static final int notification_template_custom_big = 0x7f090033;
public static final int notification_template_icon_group = 0x7f090034;
public static final int notification_template_part_chronometer = 0x7f090038;
public static final int notification_template_part_time = 0x7f090039;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c0043;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d00ec;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00ed;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00ef;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00f2;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00f4;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d015d;
public static final int Widget_Compat_NotificationActionText = 0x7f0d015e;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f02008c, 0x7f02008d, 0x7f02008e, 0x7f02008f, 0x7f020090, 0x7f020091 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02008a, 0x7f020092, 0x7f020093, 0x7f020094, 0x7f020150 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"sbezugam@villanova.edu"
] | sbezugam@villanova.edu |
7f53353760266e0076a4384339bf4131cf5628f8 | 9290655536e7ec1bb79f2646395f9b882be254ec | /djmall_provider/djmall_auth_provider/src/main/java/com/dj/mall/auth/bo/user/UserBO.java | 4b9a66778f2590f8725de1dbe71ce2df8a56049e | [] | no_license | CF1024/djmall | 6ff074d681c0ef6c114420bbcfb1ee816e5cad51 | 8ed8315f65a4b2dba1eef0602b55d895a8297237 | refs/heads/master | 2022-12-27T08:49:44.588877 | 2020-09-28T14:14:18 | 2020-09-28T14:14:18 | 299,317,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,862 | java | /*
* 作者:CF
* 日期:2020-07-06 10:25
* 项目:djmall
* 模块:djmall_auth_provider
* 类名:UserBO
* 版权所有(C), 2020. 所有权利保留
*/
package com.dj.mall.auth.bo.user;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author chengf
* @date 2020/6/3 14:19
* 用户bo
*/
@Data
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
public class UserBO implements Serializable {
/**
* 用户id
*/
private Integer userId;
/**
* 用户名
*/
private String userName;
/**
* 用户昵称
*/
private String nickName;
/**
* 手机号
*/
private String userPhone;
/**
* 邮箱
*/
private String userEmail;
/**
* 用户激活状态
*/
private String userStatus;
/**
* 性别
*/
private String userSex;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 用户状态
*/
private String isDel;
/**
* 非此表字段 角色名
*/
private String roleName;
/**
* 非此表字段 用户角色关联表
*/
private Integer userRole;
/**
* 非此表字段 用户性别
*/
private String userSexShow;
/**
* 非此表字段 最后登录时间
*/
private LocalDateTime lastLoginTime;
/**
* 非此表字段 激活状态
*/
private String userStatusShow;
/**
* 非此表字段 用户角色集合
*/
private List<Integer> userRoleList;
/**
* 非此表字段 用户性别集合
*/
private List<String> userSexList;
/**
* 用户头像
*/
private String userImg;
}
| [
"chengfan0905@163.com"
] | chengfan0905@163.com |
a42b4dff31cd0bf1e7c4310472fb7d351d69c92d | 55286760cc2078b01d1858eb1689d1be3da8db79 | /tech-zookeeper/src/main/java/com/study/liyq/techzookeeper/ZookeeperConfiguration.java | 89792f0fb1d3007cd7ab6f73caaebec1fa935a47 | [] | no_license | kevinliyq/tech | 06943abda26760a6e71a418909f8b65641f8c7f1 | c8ef5bc7ac9ea32e98758c2c7ccf12f64d9c0a69 | refs/heads/master | 2022-11-25T06:45:59.373103 | 2019-12-08T15:24:17 | 2019-12-08T15:24:17 | 208,444,599 | 0 | 0 | null | 2022-11-16T08:56:44 | 2019-09-14T13:31:21 | JavaScript | UTF-8 | Java | false | false | 3,818 | java | package com.study.liyq.techzookeeper;
import com.google.common.base.Joiner;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.api.CuratorWatcher;
import org.apache.curator.framework.recipes.cache.NodeCache;
import org.apache.curator.framework.recipes.cache.NodeCacheListener;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.retry.RetryNTimes;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author: yoli
* @since: 2019/10/07
*/
@Configuration
public class ZookeeperConfiguration implements Watcher
{
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Value("${zookeeper.servers}")
private String zkClientStr;
@Value("${spring.application.name}")
private String applicationName;
private String rootPath = "/admin";
@Bean(destroyMethod = "close")
public CuratorFramework zooKeeperClient() throws Exception
{
RetryPolicy retryPolicy = new RetryNTimes(10, 5000);
CuratorFramework client = CuratorFrameworkFactory.builder().connectString(zkClientStr)
.sessionTimeoutMs(10000)
.retryPolicy(retryPolicy)
//.namespace("admin")
.connectionTimeoutMs(30 * 1000)
.sessionTimeoutMs(90 * 1000)
.build();
client.start();
CuratorWatcher watcher = (WatchedEvent watchedEvent) -> {
logger.info(String.format("monitored: event=%s,path=%s,state=%s",watchedEvent.getType(),watchedEvent.getPath(),watchedEvent.getState()));
};
if (client.checkExists().forPath(rootPath) == null)
{
createPath(client, rootPath);
}
logger.info("watcher path:{}",rootPath);
client.getData().usingWatcher(watcher).forPath(rootPath);
//register data change for itself, it is can't be notified when children is changed.
//byte[] parentConfig = client.getData().usingWatcher(watcher).forPath("/config");
String currentPath = "/config";
registerNodeListener(client, currentPath);
//register watcher to monitor children change
//client.getChildren().usingWatcher(this).forPath("/config");
//logger.info("config data {}",new String(parentConfig));
createPath(client, currentPath);
String path = Joiner.on("/").join(rootPath, applicationName);
createPath(client, path);
return client;
}
private void registerNodeListener(CuratorFramework client, String path)
{
final NodeCache nodeCache = new NodeCache(client, path, false);
nodeCache.getListenable().addListener(() -> logger.info("Current node data: {}", nodeCache.getCurrentData()));
}
@Override public void process(WatchedEvent watchedEvent)
{
logger.info(String.format("monitored: event=%s,path=%s,state=%s",watchedEvent.getType(),watchedEvent.getPath(),watchedEvent.getState()));
}
private void createPath(CuratorFramework client, String path) throws Exception
{
if (client.checkExists().forPath(path) == null)
{
client.create()
.withMode(CreateMode.EPHEMERAL_SEQUENTIAL)
.withACL(ZooDefs.Ids.OPEN_ACL_UNSAFE)
.forPath(path);
}
}
}
| [
"yoli@tripadvisor.com"
] | yoli@tripadvisor.com |
f55d06aeef40ec5e3586766b7b0d2dfda9754ca3 | 713afdba0b5a407d7d30ecd4107b5ff7a392ca65 | /src/net/ion/message/push/message/google/GoogleMessage.java | 150de372985e97a34ac2f76f6e9c1ab1d7e0b96e | [] | no_license | tomdev2008/talkserver | 48950c7428412c2735129c743bba39987a93c77c | 27fdab290122860840b36073a5b8daf6d8911dd7 | refs/heads/master | 2021-01-18T15:32:04.855689 | 2014-03-19T08:02:27 | 2014-03-19T08:02:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,527 | java | package net.ion.message.push.message.google;
import com.google.android.gcm.server.Message;
import net.ion.message.push.sender.GCMSender;
import net.ion.message.push.sender.PushResponse;
import org.apache.commons.lang.StringUtils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
public class GoogleMessage {
private int timeToLive = -1;
private String collapseKey;
private boolean delayWhileIdle = false;
private String message;
private GCMSender sender;
private String receiver;
private GoogleMessage(String receiver, GCMSender sender) {
this.sender = sender;
this.receiver = receiver;
}
public static GoogleMessage create(String receiver, GCMSender sender) {
return new GoogleMessage(receiver, sender);
}
public GoogleMessage message(String message) {
this.message = message;
return this;
}
public GoogleMessage delayWhenIdle(boolean isWait) {
this.delayWhileIdle = isWait;
return this;
}
public GoogleMessage timeToLive(int lifetime) {
this.timeToLive = lifetime;
return this;
}
public GoogleMessage collapseKey(String collapseKey) {
this.collapseKey = collapseKey;
return this;
}
public PushResponse push() throws IOException {
checkValidity();
return this.sender.send(this);
}
private void checkValidity() {
messageNotEmpty();
tooLargeMessage();
}
private final int MAX_MESSAGE_BYTES = 4096;
private void tooLargeMessage() {
try {
if(this.message.getBytes("UTF-8").length > MAX_MESSAGE_BYTES) {
throw new IllegalStateException("Message is larger than 4096 bytes");
}
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e);
}
}
private void messageNotEmpty() {
if (StringUtils.isEmpty(this.message)) {
throw new IllegalStateException("message is null");
}
}
public String getReceiver() {
return receiver;
}
public Message toPayload() {
Message.Builder builder = new Message.Builder();
if(this.collapseKey != null) {
builder.collapseKey(this.collapseKey);
}
if(this.timeToLive != -1) {
builder.timeToLive(this.timeToLive);
}
return builder.delayWhileIdle(this.delayWhileIdle).addData("message", this.message).build();
}
}
| [
"bleujin@gmail.com"
] | bleujin@gmail.com |
44bf66d2809c0a5cb367ca5ff1593a700342cc3e | de979da9e1aaaac337c7fbcc3d4822df495074c7 | /app/src/main/java/shp/kalbecallplanaedp/Repo/mUserMappingAreaRepo.java | 8626a3cf0d17de6cd5e77e65e7f9d09b249f088f | [] | no_license | robertocapah/AEDPV2 | f929db1fce3a975d52418c55a154a4830bdebdef | e688b90328f1db0fd3b8b9204cbcc21879d61e13 | refs/heads/master | 2020-04-18T12:34:04.324683 | 2019-02-04T10:39:46 | 2019-02-04T10:39:46 | 167,537,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,157 | java | package shp.kalbecallplanaedp.Repo;
import android.content.Context;
import com.j256.ormlite.dao.Dao;
import shp.kalbecallplanaedp.Common.mUserMappingArea;
import shp.kalbecallplanaedp.Data.DatabaseHelper;
import shp.kalbecallplanaedp.Data.DatabaseManager;
import java.sql.SQLException;
import java.util.List;
/**
* Created by Dewi Oktaviani on 10/19/2018.
*/
public class mUserMappingAreaRepo implements crud {
DatabaseHelper helper;
public mUserMappingAreaRepo(Context context){
DatabaseManager.init(context);
helper = DatabaseManager.getInstance().getHelper();
}
@Override
public int create(Object item) throws SQLException {
int index = -1;
mUserMappingArea object = (mUserMappingArea) item;
try {
index = helper.getmUserMappingAreaDao().create(object);
}catch (SQLException e){
e.printStackTrace();
}
return index;
}
@Override
public int createOrUpdate(Object item) throws SQLException {
int index = -1;
mUserMappingArea object = (mUserMappingArea) item;
try {
Dao.CreateOrUpdateStatus status = helper.getmUserMappingAreaDao().createOrUpdate(object);
index = status.getNumLinesChanged();
}catch (SQLException e){
e.printStackTrace();
}
return index;
}
@Override
public int update(Object item) throws SQLException {
return 0;
}
@Override
public int delete(Object item) throws SQLException {
return 0;
}
@Override
public Object findById(int id) throws SQLException {
mUserMappingArea item = null;
try{
item = helper.getmUserMappingAreaDao().queryForId(id);
}catch (SQLException e){
e.printStackTrace();
}
return item;
}
@Override
public List<?> findAll() throws SQLException {
List<mUserMappingArea> items = null;
try{
items = helper.getmUserMappingAreaDao().queryForAll();
}catch (SQLException e){
e.printStackTrace();
}
return items;
}
}
| [
"roberto.capah@gmail.com"
] | roberto.capah@gmail.com |
e4a3d6d67b3b83e7b7afe35114a8e6565b4d89a7 | 4aa8f43d1d3e25075f05cd835e0d90fe6143aca4 | /Plugins/org.emftext.term.propositional.expression.resource.expression/src-gen/org/emftext/term/propositional/expression/resource/expression/util/ExpressionEClassUtil.java | 89839959f0b3f6f6e854ae969fedcbcef02c3824 | [] | no_license | multi-perspectives/cluster | bb8adb5f1710eb502e1d933375e9d51da9bb2c7c | 8c3f2ccfc784fb0e0cce7411f75e18e25735e9f8 | refs/heads/master | 2016-09-05T11:23:16.096796 | 2014-03-13T20:07:59 | 2014-03-13T20:07:59 | 2,890,695 | 0 | 1 | null | 2012-11-22T14:58:18 | 2011-12-01T11:41:12 | Java | UTF-8 | Java | false | false | 2,308 | java | /**
* <copyright>
* </copyright>
*
*
*/
package org.emftext.term.propositional.expression.resource.expression.util;
/**
* A utility class that provides methods to handle EClasses.
*/
public class ExpressionEClassUtil {
public boolean isSubClass(org.eclipse.emf.ecore.EClass subClassCandidate, org.eclipse.emf.ecore.EClass superClass) {
for (org.eclipse.emf.ecore.EClass superClassCandidate : subClassCandidate.getEAllSuperTypes()) {
// There seem to be multiple instances of meta classes when accessed through the
// generator model. Therefore, we compare by name.
if (namesAndPackageURIsAreEqual(superClassCandidate, superClass)) {
return true;
}
}
return false;
}
/**
* Returns all subclasses of 'superClass' that are contained in 'availableClasses'.
*
* @param superClass the superclass
* @param availableClasses the set of classes to search in
*
* @return a list of all subclasses of 'superClass'
*/
public java.util.List<org.eclipse.emf.ecore.EClass> getSubClasses(org.eclipse.emf.ecore.EClass superClass, org.eclipse.emf.ecore.EClass[] availableClasses) {
java.util.List<org.eclipse.emf.ecore.EClass> result = new java.util.ArrayList<org.eclipse.emf.ecore.EClass>();
for (org.eclipse.emf.ecore.EClass next : availableClasses) {
if (isSubClass(next, superClass) && isConcrete(next)) {
result.add(next);
}
}
return result;
}
public boolean namesAndPackageURIsAreEqual(org.eclipse.emf.ecore.EClass classA,
org.eclipse.emf.ecore.EClass classB) {
return namesAreEqual(classA, classB) && packageURIsAreEqual(classA, classB);
}
public boolean packageURIsAreEqual(org.eclipse.emf.ecore.EClass classA,
org.eclipse.emf.ecore.EClass classB) {
String nsURI_A = classA.getEPackage().getNsURI();
String nsURI_B = classB.getEPackage().getNsURI();
return (nsURI_A == null && nsURI_B == null) || nsURI_A.equals(nsURI_B);
}
public boolean namesAreEqual(org.eclipse.emf.ecore.EClass classA, org.eclipse.emf.ecore.EClass classB) {
return classA.getName().equals(classB.getName());
}
public boolean isConcrete(org.eclipse.emf.ecore.EClass eClass) {
return !eClass.isAbstract() && !eClass.isInterface();
}
public boolean isNotConcrete(org.eclipse.emf.ecore.EClass eClass) {
return !isConcrete(eClass);
}
}
| [
"schroeter_julia@gmx.net"
] | schroeter_julia@gmx.net |
59f8497e28b30a2d6cdc698d5acb66f526d4a012 | 118975c2d0e3441ad6c9a2ea09deda187e7507ca | /pattern/src/main/java/com/xiattong/principle/lishi/Rectangle.java | 2e279e2365cb615a5bacc0e1af7bcffca189b79b | [] | no_license | xiattong/spring-basic | b2e24fa637e2d3ca2c46cd52e9dd6a893d8b10dd | 16195654a9b5b3eb438284d9987c7825e06dc4d6 | refs/heads/master | 2022-06-26T00:02:03.562515 | 2022-04-15T15:36:02 | 2022-04-15T15:36:02 | 243,045,698 | 0 | 0 | null | 2022-06-17T03:03:56 | 2020-02-25T16:18:44 | Java | UTF-8 | Java | false | false | 566 | java | package com.xiattong.principle.lishi;
/**
* @author :xiattong
* @description:长方形
* @version: $
* @date :Created in 2021/2/7 21:22
* @modified By:
*/
public class Rectangle implements Quadrangle {
private long width;
private long height;
public void setWidth(long width) {
this.width = width;
}
public void setHeight(long height) {
this.height = height;
}
@Override
public long getWidth() {
return width;
}
@Override
public long getHeight() {
return height;
}
}
| [
"864380220@qq.com"
] | 864380220@qq.com |
f6fbc575559bb74fe3a6bc9bf3ae40dc2045ae44 | 7bf936a136e8b8aab712304143ab975a2003bbe3 | /testng-core/src/test/java/test/configuration/issue2426/IssueTest.java | 9ae7986eb81e04790c2fc384066c69dae13023cf | [
"Apache-2.0"
] | permissive | kdevendraraju/testng | 342045b373a25ec22e8f835fda81be66d9e1c63e | 38279c6deae78cbfe0c616540b869bf69e9c896d | refs/heads/master | 2023-06-08T15:34:40.539124 | 2023-05-30T02:59:47 | 2023-05-30T02:59:47 | 214,407,171 | 0 | 0 | Apache-2.0 | 2019-10-21T17:08:19 | 2019-10-11T10:21:50 | Java | UTF-8 | Java | false | false | 651 | java | package test.configuration.issue2426;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Map;
import org.testng.TestNG;
import org.testng.annotations.Test;
import test.SimpleBaseTest;
public class IssueTest extends SimpleBaseTest {
@Test
public void testIfConfigMethodsHaveAccessToFactoryParams() {
TestNG testng = create(SampleTestCase.class);
MyMethodListener listener = new MyMethodListener();
testng.addListener(listener);
testng.run();
Map<Class<?>, Object[]> data = listener.getContents();
assertThat(data).hasSize(8);
data.values().forEach(each -> assertThat(each).hasSize(2));
}
}
| [
"krishnan.mahadevan1978@gmail.com"
] | krishnan.mahadevan1978@gmail.com |
7388e56507cf4da48187f09542777f0cb46677ed | e686cb36bc7c84f81a8caa8d16c934ec94e2d9e3 | /src/BattleRoyale/main.java | 07beb4c34516ae93dc9233c56021065e43f21d7e | [] | no_license | Drake62610/BattleRoyale | eb2d434a30dafe26fbde61d464efcf4d14e5aa34 | be5ee1dea7d4f5af02b27e91c7e67d1de93e79ce | refs/heads/master | 2021-08-23T03:19:19.154205 | 2017-12-02T20:51:14 | 2017-12-02T20:51:14 | 107,516,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,312 | java | package BattleRoyale;
import Exception.InitialisationCarteException;
import Exception.InitialisationPersonnageException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Projet JAVA Semestre1 M1
* Classe main pour lancer un BattleRoyal
* @author MATTE FLORIAN, MARISSAL LOIC
*/
public class main {
/**
* @param args the command line arguments
* @throws java.lang.InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
//Création d'un battleroyale appelé "platinum"
BattleRoyale platinum;
try {
//initialisation de platinum
platinum = new BattleRoyale(5,3,15,3,8,5,7); //nbr_soigneur, nbr_piegeur, nbr_normal,
//nbr_trouillard,nbr_tueur,nbr_pacifiste,nbr_traitre
//On lance le jeu
platinum.lancer(1);
//platinum.pause();
} catch (InitialisationPersonnageException ex) {//Exception intervennant lors de l'initialisation
Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
} catch (InitialisationCarteException ex) {
Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| [
"matteflorian@live.fr"
] | matteflorian@live.fr |
6b15f3b0fe82e4de44e494effbb3a70e50f43de7 | 3d97675498c7a569878d909b6d48e210c02729ae | /src/test/java/sk/sav/SavSuite.java | 93917ac0f12e617d600c15ca6248a4f0719e8bd0 | [] | no_license | ibotsk/dataflos | 9cfd5ed8ddb334d04050c11e0f97c767b7ddbcfa | 5733260a314bda62b9224aa07f715812493f9a4d | refs/heads/master | 2020-04-05T14:07:45.469746 | 2017-06-19T14:00:38 | 2017-06-19T14:00:38 | 94,782,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | 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 sk.sav;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
*
* @author jakub.husar
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({sk.sav.bot.BotSuite.class})
public class SavSuite {
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
}
| [
"matus.kempa@gmail.sk"
] | matus.kempa@gmail.sk |
178744456c6e0f184b838a96d38ce6ca5d5766aa | fd203ca9d40b7ccb1ee19bfdea6058cd376a6acc | /ProQuant/src/test/java/dataTest/package-info.java | b9b49b7de1a760a23bac5c76c95838d2eb1294a1 | [] | no_license | StockScripts/ProQuant | 82be380d6d2f500ce872356763da00c48b48cbd1 | 8918b0e0b3818ca6eae3945d76690a9f255a362a | refs/heads/master | 2021-09-07T06:52:55.613371 | 2018-02-19T04:40:50 | 2018-02-19T04:40:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 55 | java | /**
*
*/
/**
* @author 凡
*
*/
package dataTest; | [
"151250169@smail.nju.edu.cn"
] | 151250169@smail.nju.edu.cn |
9ab70724947b7157621b496845e98cf27e429f60 | ee0db89af989d327dc67ce69d4696d5602200a09 | /src/main/java/edu/samford/tyboles/lists/DNode.java | 8b5f06afe0eaae8386e07cc507934e0793452f16 | [] | no_license | tybolescs/COC210 | 5d6909a0903efbd6508ee0382d239e5af4f39a0c | dd2ceea4cf31b6d557b43eddc97a6bc82d40c918 | refs/heads/master | 2020-07-14T21:52:15.952490 | 2019-12-11T21:22:17 | 2019-12-11T21:22:17 | 205,410,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,201 | 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 edu.samford.tyboles.lists;
/**
*
* @author Tyrone
*/
public class DNode<T> {
private T data; // the data being stored in this node
private DNode<T> prev; // link to the previous node in the list
private DNode<T> next; // link to the next node in the list
public DNode() {
data = null;
prev = next = null;
}
public DNode(T data, DNode prev, DNode next) {
this.data = data;
this.prev = prev;
this.next = next;
}
public DNode getPrev() {
return prev;
}
public DNode getNext() {
return next;
}
public void setPrev(DNode node) {
prev = node;
}
public void setNext(DNode node) {
next = node;
}
public T element() {
return data;
}
public void setElement(T data) {
this.data = data;
}
}
| [
"Tyrone@172.31.168.226"
] | Tyrone@172.31.168.226 |
8ce0367c2cfb75f0d4fb443e995db3c515743106 | 5d435a93352f119a0032998a1f732c2448caa19c | /app/src/main/java/com/example/drawer/chatf/model/dataCommunication.java | 479bbcb79020a27ffe675e7856c0b18700fea8ee | [] | no_license | David-bhk/SchoolXParent | 47a2562ee0ca69d154542becca42a4752e207b04 | 4d78d749f8e3fb52c36be5ae7267cf4074451f95 | refs/heads/master | 2023-08-14T15:07:31.211579 | 2021-10-01T23:56:29 | 2021-10-01T23:56:29 | 409,662,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package com.example.drawer.chatf.model;
public class dataCommunication {
private String key;
private String de;
private String message;
private String date;
private long time;
private String type;
public dataCommunication() {
}
//HERE IS THE MODEL O HOW OUR ITEM MESSAGE WILL APPEAR
public dataCommunication(String key, String de, String message, String date, long time, String type) {
this.key = key;
this.de = de;
this.message = message;
this.date = date;
this.time = time;
this.type = type;
}
//SETTING GETTERS AND SETTERS
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getDe() {
return de;
}
public void setDe(String de) {
this.de = de;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}
| [
"josephmuhindo089@gmail.com"
] | josephmuhindo089@gmail.com |
2e4e9716457bfdeda674d8a9d4e17f31681099dd | 96ed7ebc8cdd04bdfa92a7df837b0797c30ac00c | /src/test/java/de/hscoburg/evelin/secat/test/model/FragenModelTest.java | 7c7296db6f31badd6f82dc4862f67224955a1925 | [] | no_license | hauntedhill/SE-CAT | 1756ffa33be4c60921fc9e9018b16acb8162df4f | a600f4eb99b9553cb8ae4aefc59d28bb350a0cd5 | refs/heads/master | 2021-01-02T08:46:18.127824 | 2014-10-16T14:31:15 | 2014-10-16T14:32:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,188 | java | package de.hscoburg.evelin.secat.test.model;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import de.hscoburg.evelin.secat.dao.FrageDAO;
import de.hscoburg.evelin.secat.dao.entity.Frage;
import de.hscoburg.evelin.secat.dao.entity.Skala;
import de.hscoburg.evelin.secat.model.FragenModel;
import de.hscoburg.evelin.secat.test.mock.BaseModelTest;
public class FragenModelTest extends BaseModelTest {
private static FragenModel model = new FragenModel();
@Test(expected = IllegalArgumentException.class)
public void save1() {
model.saveFrage(null, null, null);
}
@Test(expected = IllegalArgumentException.class)
public void save2() {
model.saveFrage("", null, null);
}
@Test(expected = IllegalArgumentException.class)
public void save3() {
model.saveFrage("", "", null);
}
@Test(expected = IllegalArgumentException.class)
public void save4() {
model.saveFrage("123", "", null);
}
@Test(expected = IllegalArgumentException.class)
public void save5() {
model.saveFrage("123", "123", null);
}
@Test
public void save6() {
model.saveFrage("123", "123", new Skala());
Assert.assertTrue(persistObjects.size() == 1);
Assert.assertTrue(((Frage) persistObjects.get(0)).getName().equals("123"));
}
private static FrageDAO perspektivenDAO;
@BeforeClass
public static void setup() throws Exception {
perspektivenDAO = Mockito.mock(FrageDAO.class);
Mockito.doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock invocation) throws Throwable {
persistObjects.add(invocation.getArguments()[0]);
return null;
}
}).when(perspektivenDAO).persist(Mockito.any(Frage.class));
Mockito.doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock invocation) throws Throwable {
mergedObjects.add(invocation.getArguments()[0]);
return null;
}
}).when(perspektivenDAO).merge(Mockito.any(Frage.class));
setValueToField(perspektivenDAO, "frageDAO", model);
}
}
| [
"haunted24@gmail.com"
] | haunted24@gmail.com |
bc4a2e19979e62d9ac7d918012d70fa7712af0cc | 3b64d7612c52c19af5b4d63ee4e22df52d527452 | /src/model/aplication/Main.java | cab85858aea3fae27e7fbe74d67069559d67c70b | [] | no_license | lucasnike/CD_141_ExercicioContaBancaria | 6118ed3937f1f56402d596b1864dc3ad16c522b9 | 5130754617f25d057ca2a8ac14a84488c171561c | refs/heads/master | 2020-09-01T04:13:55.562738 | 2019-11-01T00:44:37 | 2019-11-01T00:44:37 | 218,878,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,062 | java | package model.aplication;
import java.util.Locale;
import java.util.Scanner;
import model.entities.Account;
import model.exceptions.ActionOutOfNormException;
public class Main {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner tec = new Scanner(System.in);
try {
System.out.print("Número da conta:");
int number = tec.nextInt();
System.out.print("Nome: ");
tec.nextLine();
String holder = tec.nextLine();
System.out.print("Saldo: ");
double balance = tec.nextDouble();
System.out.print("Limite de saque: ");
double withDrawLimit = tec.nextDouble();
Account conta = new Account(number, holder, balance, withDrawLimit);
System.out.println("");
System.out.print("Valor pra sacar: ");
conta.withDraw(tec.nextDouble());
System.out.println("Saldo atual: $ " + conta.getBalance());
} catch (ActionOutOfNormException e) {
System.err.println(e.getMessage());
}catch (RuntimeException e) {
System.err.println("Erro inesperado !!!");
}
finally {
tec.close();
}
}
}
| [
"lucas4cristal@gmail.com"
] | lucas4cristal@gmail.com |
e1580d5be62580cc0aebab05ebf814a7c35cbb91 | b257883eafe5a8cec36c585ba69535b42852c290 | /app/src/androidTestPaid/java/com/udacity/gradle/builditbigger/paid/MainActivityTestPaid.java | 35d6330dfe2a515b4be0a29dc35e5506c7da09c8 | [] | no_license | ahmedsabrymohamed/Build-It-Bigger | 47a2faaa851ede79d16dd528404647df14499d9b | 97dd73b5b726f13c95e4a900488b0eeee7cc3d9f | refs/heads/master | 2021-05-09T19:10:10.059742 | 2018-01-23T18:05:05 | 2018-01-23T18:05:05 | 118,632,802 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,023 | java | package com.udacity.gradle.builditbigger.paid;
import android.support.test.espresso.ViewInteraction;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import com.udacity.gradle.builditbigger.R;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.allOf;
@LargeTest
@RunWith(AndroidJUnit4.class)
public class MainActivityTestPaid {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void mainActivityTestPaid() {
ViewInteraction appCompatButton = onView(
allOf(withText("Tell Joke"),
childAtPosition(
childAtPosition(
withId(android.R.id.content),
0),
1),
isDisplayed()));
appCompatButton.perform(click());
ViewInteraction textView = onView(
allOf(withId(R.id.joke_text), withText("Atoms are untrustworthy little critters. They make up everything!"),
childAtPosition(
childAtPosition(
withId(android.R.id.content),
0),
0),
isDisplayed()));
textView.check(matches(withText("Atoms are untrustworthy little critters. They make up everything!")));
}
private static Matcher<View> childAtPosition(
final Matcher<View> parentMatcher, final int position) {
return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
description.appendText("Child at position " + position + " in parent ");
parentMatcher.describeTo(description);
}
@Override
public boolean matchesSafely(View view) {
ViewParent parent = view.getParent();
return parent instanceof ViewGroup && parentMatcher.matches(parent)
&& view.equals(((ViewGroup) parent).getChildAt(position));
}
};
}
}
| [
"ahmeddood7@gmail.com"
] | ahmeddood7@gmail.com |
9862a6b89f67db4ac24ef76e25b37a6f9f295623 | 36f500a1f84d7d85a2f85c18337cfd99338f3de2 | /src/org/idream/moneymaker/net/impl/NSEStockPublisher.java | 2991f098e30bacded2b1cb5e14999ee6a761881e | [] | no_license | idreamcreate/rupeemaker | 43755436918afa091401f6950733132c7a4eb0c1 | e6a01e7a689ce4a9766b6f08752c0933e382751e | refs/heads/master | 2020-06-06T16:59:29.390979 | 2013-10-27T17:17:49 | 2013-10-27T17:17:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,823 | java | package org.idream.moneymaker.net.impl;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.StringTokenizer;
import org.idream.moneymaker.net.StockPublisher;
import org.idream.moneymaker.net.beans.PublishedStockDetails;
public final class NSEStockPublisher implements StockPublisher{
@Override
public synchronized PublishedStockDetails getStockDetails(String stockCode) {
PublishedStockDetails stockDetails = new PublishedStockDetails();
stockDetails.setMarket("NSE");
stockDetails.setStockCode(stockCode);
try{
String urlString = "http://www.nseindia.com/marketinfo/companyTracker/ajaxquote.jsp?symbol="+stockCode;
//String urlString = "http://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/ajaxGetQuoteJSON.jsp?symbol=RELIANCE&series=EQ";
URL url = new URL(urlString);
URLConnection con = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuilder responseString = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null){
responseString.append(inputLine);
}
parseResponseString(responseString, stockDetails);
in.close();
}catch(Exception er){
er.printStackTrace();
}
return stockDetails;
}
private synchronized void parseResponseString(StringBuilder responseString, PublishedStockDetails stockDetails){
String str = responseString.toString();
if(str.startsWith("SUCCESS")){
str = str.substring(str.indexOf(";")+2);
System.out.println("PARSING RESPONSE STRING: \n "+str);
StringTokenizer strTok = new StringTokenizer(str, ":");
int i=0;
while(strTok.hasMoreTokens()){
String token = strTok.nextToken();
// System.out.println(i+" "+token);
switch (i) {
case 6:
stockDetails.setHigh52Price(Float.parseFloat(token));
break;
case 7:
stockDetails.setLow52Price(Float.parseFloat(token));
break;
case 8:
stockDetails.setPreviousClosePrice(Float.parseFloat(token));
break;
case 9:
stockDetails.setOpenedPrice(Float.parseFloat(token));
break;
case 10:
stockDetails.setHighPriceToday(Float.parseFloat(token));
break;
case 11:
stockDetails.setLowPriceToday(Float.parseFloat(token));
break;
case 12:
stockDetails.setVolumeWeightedAveragePrice(Float.parseFloat(token));
break;
case 13:
stockDetails.setCurrentPrice(Float.parseFloat(token));
break;
case 14:
stockDetails.setChangeFromPrevClose(Float.parseFloat(token));
break;
case 15:
stockDetails.setPercentChangeFromPrevClose(Float.parseFloat(token));
break;
case 16:
token = token.replaceAll(",", "");
stockDetails.setTradedVolume(Long.parseLong(token));
break;
case 17:
stockDetails.setTradedValue(Double.parseDouble(token));
break;
case 19:
if(!"-".equals(token))
stockDetails.setClosePrice(Float.parseFloat(token));
break;
case 20:
if(!"-".equals(token))
stockDetails.setClosePrice(Float.parseFloat(token));
break;
case 41:
token = token.replaceAll(";", ":");
stockDetails.setStockDate(token);
break;
}
i++;
}
}
}
public static void main(String[] args) {
NSEStockPublisher pub = new NSEStockPublisher();
PublishedStockDetails stkDetails = pub.getStockDetails("INFY");
System.out.println(stkDetails);
PublishedStockDetails stkDetails1 = pub.getStockDetails("TATAMOTORS");
System.out.println(stkDetails1);
}
}
| [
"chandrashekar.ch@gmail.com"
] | chandrashekar.ch@gmail.com |
648edf59b2c2530df3036a4771e0decb3e3e826f | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /packages/apps/ContactsCommon/TestCommon/src/com/android/contacts/common/test/IntegrationTestUtils.java | 060edd1578ef61ba3645b393d9e101b5d92187e9 | [
"MIT"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | Java | false | false | 7,617 | java | /*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.contacts.common.test;
import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP;
import static android.os.PowerManager.FULL_WAKE_LOCK;
import static android.os.PowerManager.ON_AFTER_RELEASE;
import android.app.Activity;
import android.app.Instrumentation;
import android.content.Context;
import android.os.PowerManager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.common.base.Preconditions;
import junit.framework.Assert;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
/** Some utility methods for making integration testing smoother. */
@ThreadSafe
public class IntegrationTestUtils {
private static final String TAG = "IntegrationTestUtils";
private final Instrumentation mInstrumentation;
private final Object mLock = new Object();
@GuardedBy("mLock") private PowerManager.WakeLock mWakeLock;
public IntegrationTestUtils(Instrumentation instrumentation) {
mInstrumentation = instrumentation;
}
/**
* Find a view by a given resource id, from the given activity, and click it, iff it is
* enabled according to {@link View#isEnabled()}.
*/
public void clickButton(final Activity activity, final int buttonResourceId) throws Throwable {
runOnUiThreadAndGetTheResult(new Callable<Void>() {
@Override
public Void call() throws Exception {
View view = activity.findViewById(buttonResourceId);
Assert.assertNotNull(view);
if (view.isEnabled()) {
view.performClick();
}
return null;
}
});
}
/** Returns the result of running {@link TextView#getText()} on the ui thread. */
public CharSequence getText(final TextView view) throws Throwable {
return runOnUiThreadAndGetTheResult(new Callable<CharSequence>() {
@Override
public CharSequence call() {
return view.getText();
}
});
}
// TODO: Move this class and the appropriate documentation into a test library, having checked
// first to see if exactly this code already exists or not.
/**
* Execute a callable on the ui thread, returning its result synchronously.
* <p>
* Waits for an idle sync on the main thread (see {@link Instrumentation#waitForIdle(Runnable)})
* before executing this callable.
*/
public <T> T runOnUiThreadAndGetTheResult(Callable<T> callable) throws Throwable {
FutureTask<T> future = new FutureTask<T>(callable);
mInstrumentation.waitForIdle(future);
try {
return future.get();
} catch (ExecutionException e) {
// Unwrap the cause of the exception and re-throw it.
throw e.getCause();
}
}
/**
* Wake up the screen, useful in tests that want or need the screen to be on.
* <p>
* This is usually called from setUp() for tests that require it. After calling this method,
* {@link #releaseScreenWakeLock()} must be called, this is usually done from tearDown().
*/
public void acquireScreenWakeLock(Context context) {
synchronized (mLock) {
Preconditions.checkState(mWakeLock == null, "mWakeLock was already held");
mWakeLock = ((PowerManager) context.getSystemService(Context.POWER_SERVICE))
.newWakeLock(
PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE | PowerManager.FULL_WAKE_LOCK, TAG);
mWakeLock.acquire();
}
}
/** Release the wake lock previously acquired with {@link #acquireScreenWakeLock(Context)}. */
public void releaseScreenWakeLock() {
synchronized (mLock) {
// We don't use Preconditions to force you to have acquired before release.
// This is because we don't want unnecessary exceptions in tearDown() since they'll
// typically mask the actual exception that happened during the test.
// The other reason is that this method is most likely to be called from tearDown(),
// which is invoked within a finally block, so it's not infrequently the case that
// the setUp() method fails before getting the lock, at which point we don't want
// to fail in tearDown().
if (mWakeLock != null) {
mWakeLock.release();
mWakeLock = null;
}
}
}
/**
* Gets all {@link TextView} objects whose {@link TextView#getText()} contains the given text as
* a substring.
*/
public List<TextView> getTextViewsWithString(final Activity activity, final String text)
throws Throwable {
return runOnUiThreadAndGetTheResult(new Callable<List<TextView>>() {
@Override
public List<TextView> call() throws Exception {
List<TextView> matchingViews = new ArrayList<TextView>();
for (TextView textView : getAllViews(TextView.class, getRootView(activity))) {
if (textView.getText().toString().contains(text)) {
matchingViews.add(textView);
}
}
return matchingViews;
}
});
}
/** Find the root view for a given activity. */
public static View getRootView(Activity activity) {
return activity.findViewById(android.R.id.content).getRootView();
}
/**
* Gets a list of all views of a given type, rooted at the given parent.
* <p>
* This method will recurse down through all {@link ViewGroup} instances looking for
* {@link View} instances of the supplied class type. Specifically it will use the
* {@link Class#isAssignableFrom(Class)} method as the test for which views to add to the list,
* so if you provide {@code View.class} as your type, you will get every view. The parent itself
* will be included also, should it be of the right type.
* <p>
* This call manipulates the ui, and as such should only be called from the application's main
* thread.
*/
private static <T extends View> List<T> getAllViews(final Class<T> clazz, final View parent) {
List<T> results = new ArrayList<T>();
if (parent.getClass().equals(clazz)) {
results.add(clazz.cast(parent));
}
if (parent instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) parent;
for (int i = 0; i < viewGroup.getChildCount(); ++i) {
results.addAll(getAllViews(clazz, viewGroup.getChildAt(i)));
}
}
return results;
}
}
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
759db548ab7ea3278211d944e0c824b65866f981 | 14a90bda579062aa266f4469a81e6385c3f074e4 | /Plugin/model/plugins/com.tibco.bw.palette.elasticache.palette.elasticache.model/src/com/tibco/bw/palette/elasticache/model/elasticache/ElasticachePackage.java | bcca530f1b5533338aa7374c6ce3d3ea20f6bb1b | [] | no_license | vijaynalawade/TCI-Hackathon | a9f5a9050caf8496ab8d5976430b0470f47975ba | 3fef9aa10a69627fd96a6124eaef9b5d3d80b331 | refs/heads/master | 2020-04-06T06:55:01.237573 | 2016-08-20T07:15:11 | 2016-08-20T07:15:11 | 65,858,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,168 | java | /**
*/
package com.tibco.bw.palette.elasticache.model.elasticache;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
/**
* <!-- begin-user-doc -->
* The <b>Package</b> for the model.
* It contains accessors for the meta objects to represent
* <ul>
* <li>each class,</li>
* <li>each feature of each class,</li>
* <li>each enum,</li>
* <li>and each data type</li>
* </ul>
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.ElasticacheFactory
* @model kind="package"
* @generated
*/
public interface ElasticachePackage extends EPackage {
/**
* The package name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNAME = "elasticache";
/**
* The package namespace URI.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNS_URI = "http://ns.tibco.com/bw/palette/elasticache";
/**
* The package namespace name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNS_PREFIX = "elasticache";
/**
* The singleton instance of the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
ElasticachePackage eINSTANCE = com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl.init();
/**
* The meta object id for the '{@link com.tibco.bw.palette.elasticache.model.elasticache.impl.GetImpl <em>Get</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.GetImpl
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl#getGet()
* @generated
*/
int GET = 0;
/**
* The feature id for the '<em><b>Connection</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int GET__CONNECTION = 0;
/**
* The feature id for the '<em><b>Username</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int GET__USERNAME = 1;
/**
* The feature id for the '<em><b>Password</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int GET__PASSWORD = 2;
/**
* The feature id for the '<em><b>Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int GET__TYPE = 3;
/**
* The feature id for the '<em><b>Value Type QName</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int GET__VALUE_TYPE_QNAME = 4;
/**
* The number of structural features of the '<em>Get</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int GET_FEATURE_COUNT = 5;
/**
* The meta object id for the '{@link com.tibco.bw.palette.elasticache.model.elasticache.impl.SetImpl <em>Set</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.SetImpl
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl#getSet()
* @generated
*/
int SET = 1;
/**
* The feature id for the '<em><b>Connection</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int SET__CONNECTION = 0;
/**
* The feature id for the '<em><b>Username</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int SET__USERNAME = 1;
/**
* The feature id for the '<em><b>Password</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int SET__PASSWORD = 2;
/**
* The feature id for the '<em><b>Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int SET__TYPE = 3;
/**
* The feature id for the '<em><b>Value Type QName</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int SET__VALUE_TYPE_QNAME = 4;
/**
* The number of structural features of the '<em>Set</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int SET_FEATURE_COUNT = 5;
/**
* The meta object id for the '{@link com.tibco.bw.palette.elasticache.model.elasticache.impl.DeleteImpl <em>Delete</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.DeleteImpl
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl#getDelete()
* @generated
*/
int DELETE = 2;
/**
* The feature id for the '<em><b>Connection</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DELETE__CONNECTION = 0;
/**
* The feature id for the '<em><b>Username</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DELETE__USERNAME = 1;
/**
* The feature id for the '<em><b>Password</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DELETE__PASSWORD = 2;
/**
* The number of structural features of the '<em>Delete</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DELETE_FEATURE_COUNT = 3;
/**
* The meta object id for the '{@link com.tibco.bw.palette.elasticache.model.elasticache.ValueTypes <em>Value Types</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.ValueTypes
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl#getValueTypes()
* @generated
*/
int VALUE_TYPES = 3;
/**
* Returns the meta object for class '{@link com.tibco.bw.palette.elasticache.model.elasticache.Get <em>Get</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Get</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Get
* @generated
*/
EClass getGet();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Get#getConnection <em>Connection</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Connection</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Get#getConnection()
* @see #getGet()
* @generated
*/
EAttribute getGet_Connection();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Get#getUsername <em>Username</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Username</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Get#getUsername()
* @see #getGet()
* @generated
*/
EAttribute getGet_Username();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Get#getPassword <em>Password</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Password</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Get#getPassword()
* @see #getGet()
* @generated
*/
EAttribute getGet_Password();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Get#getType <em>Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Type</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Get#getType()
* @see #getGet()
* @generated
*/
EAttribute getGet_Type();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Get#getValueTypeQName <em>Value Type QName</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Value Type QName</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Get#getValueTypeQName()
* @see #getGet()
* @generated
*/
EAttribute getGet_ValueTypeQName();
/**
* Returns the meta object for class '{@link com.tibco.bw.palette.elasticache.model.elasticache.Set <em>Set</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Set</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Set
* @generated
*/
EClass getSet();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Set#getConnection <em>Connection</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Connection</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Set#getConnection()
* @see #getSet()
* @generated
*/
EAttribute getSet_Connection();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Set#getUsername <em>Username</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Username</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Set#getUsername()
* @see #getSet()
* @generated
*/
EAttribute getSet_Username();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Set#getPassword <em>Password</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Password</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Set#getPassword()
* @see #getSet()
* @generated
*/
EAttribute getSet_Password();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Set#getType <em>Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Type</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Set#getType()
* @see #getSet()
* @generated
*/
EAttribute getSet_Type();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Set#getValueTypeQName <em>Value Type QName</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Value Type QName</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Set#getValueTypeQName()
* @see #getSet()
* @generated
*/
EAttribute getSet_ValueTypeQName();
/**
* Returns the meta object for class '{@link com.tibco.bw.palette.elasticache.model.elasticache.Delete <em>Delete</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Delete</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Delete
* @generated
*/
EClass getDelete();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Delete#getConnection <em>Connection</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Connection</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Delete#getConnection()
* @see #getDelete()
* @generated
*/
EAttribute getDelete_Connection();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Delete#getUsername <em>Username</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Username</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Delete#getUsername()
* @see #getDelete()
* @generated
*/
EAttribute getDelete_Username();
/**
* Returns the meta object for the attribute '{@link com.tibco.bw.palette.elasticache.model.elasticache.Delete#getPassword <em>Password</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Password</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.Delete#getPassword()
* @see #getDelete()
* @generated
*/
EAttribute getDelete_Password();
/**
* Returns the meta object for enum '{@link com.tibco.bw.palette.elasticache.model.elasticache.ValueTypes <em>Value Types</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for enum '<em>Value Types</em>'.
* @see com.tibco.bw.palette.elasticache.model.elasticache.ValueTypes
* @generated
*/
EEnum getValueTypes();
/**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the factory that creates the instances of the model.
* @generated
*/
ElasticacheFactory getElasticacheFactory();
/**
* <!-- begin-user-doc -->
* Defines literals for the meta objects that represent
* <ul>
* <li>each class,</li>
* <li>each feature of each class,</li>
* <li>each enum,</li>
* <li>and each data type</li>
* </ul>
* <!-- end-user-doc -->
* @generated
*/
interface Literals {
/**
* The meta object literal for the '{@link com.tibco.bw.palette.elasticache.model.elasticache.impl.GetImpl <em>Get</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.GetImpl
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl#getGet()
* @generated
*/
EClass GET = eINSTANCE.getGet();
/**
* The meta object literal for the '<em><b>Connection</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute GET__CONNECTION = eINSTANCE.getGet_Connection();
/**
* The meta object literal for the '<em><b>Username</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute GET__USERNAME = eINSTANCE.getGet_Username();
/**
* The meta object literal for the '<em><b>Password</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute GET__PASSWORD = eINSTANCE.getGet_Password();
/**
* The meta object literal for the '<em><b>Type</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute GET__TYPE = eINSTANCE.getGet_Type();
/**
* The meta object literal for the '<em><b>Value Type QName</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute GET__VALUE_TYPE_QNAME = eINSTANCE.getGet_ValueTypeQName();
/**
* The meta object literal for the '{@link com.tibco.bw.palette.elasticache.model.elasticache.impl.SetImpl <em>Set</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.SetImpl
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl#getSet()
* @generated
*/
EClass SET = eINSTANCE.getSet();
/**
* The meta object literal for the '<em><b>Connection</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute SET__CONNECTION = eINSTANCE.getSet_Connection();
/**
* The meta object literal for the '<em><b>Username</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute SET__USERNAME = eINSTANCE.getSet_Username();
/**
* The meta object literal for the '<em><b>Password</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute SET__PASSWORD = eINSTANCE.getSet_Password();
/**
* The meta object literal for the '<em><b>Type</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute SET__TYPE = eINSTANCE.getSet_Type();
/**
* The meta object literal for the '<em><b>Value Type QName</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute SET__VALUE_TYPE_QNAME = eINSTANCE.getSet_ValueTypeQName();
/**
* The meta object literal for the '{@link com.tibco.bw.palette.elasticache.model.elasticache.impl.DeleteImpl <em>Delete</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.DeleteImpl
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl#getDelete()
* @generated
*/
EClass DELETE = eINSTANCE.getDelete();
/**
* The meta object literal for the '<em><b>Connection</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute DELETE__CONNECTION = eINSTANCE.getDelete_Connection();
/**
* The meta object literal for the '<em><b>Username</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute DELETE__USERNAME = eINSTANCE.getDelete_Username();
/**
* The meta object literal for the '<em><b>Password</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute DELETE__PASSWORD = eINSTANCE.getDelete_Password();
/**
* The meta object literal for the '{@link com.tibco.bw.palette.elasticache.model.elasticache.ValueTypes <em>Value Types</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see com.tibco.bw.palette.elasticache.model.elasticache.ValueTypes
* @see com.tibco.bw.palette.elasticache.model.elasticache.impl.ElasticachePackageImpl#getValueTypes()
* @generated
*/
EEnum VALUE_TYPES = eINSTANCE.getValueTypes();
}
} //ElasticachePackage
| [
"vnalawad@tibco.com"
] | vnalawad@tibco.com |
9d2e753ed6e91a9b143ec8f2f1084261bc905801 | 8e8c43cc8223c2cc8baea74285c3a23c3c418240 | /protocols/src/main/java/com/tuacy/protocols/bean/response/LifeStyleResponse.java | 03751212949f4f3412ed1363b528106dc1424c5d | [] | no_license | tuacy/architecturedev | b6f01c918a0fb50c43956e935c62e29396845679 | 70e81cd2ba5de46f300294d234dce3c02f65454b | refs/heads/master | 2020-03-15T02:38:52.150557 | 2018-05-04T03:49:50 | 2018-05-04T03:49:50 | 131,922,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,986 | java | package com.tuacy.protocols.bean.response;
import java.util.List;
public class LifeStyleResponse {
private List<HeWeather6Bean> HeWeather6;
public List<HeWeather6Bean> getHeWeather6() {
return HeWeather6;
}
public void setHeWeather6(List<HeWeather6Bean> HeWeather6) {
this.HeWeather6 = HeWeather6;
}
public static class HeWeather6Bean {
/**
* basic : {"cid":"CN101010100","location":"北京","parent_city":"北京","admin_area":"北京","cnty":"中国","lat":"39.90498734","lon":"116.40528870","tz":"8.0"}
* lifestyle : [{"brf":"舒适","txt":"今天夜间不太热也不太冷,风力不大,相信您在这样的天气条件下,应会感到比较清爽和舒适。","type":"comf"},{"brf":"较舒适","txt":"建议着薄外套、开衫牛仔衫裤等服装。年老体弱者应适当添加衣物,宜着夹克衫、薄毛衣等。","type":"drsg"},{"brf":"少发","txt":"各项气象条件适宜,无明显降温过程,发生感冒机率较低。","type":"flu"},{"brf":"适宜","txt":"天气较好,赶快投身大自然参与户外运动,尽情感受运动的快乐吧。","type":"sport"},{"brf":"适宜","txt":"天气较好,但丝毫不会影响您出行的心情。温度适宜又有微风相伴,适宜旅游。","type":"trav"},{"brf":"弱","txt":"紫外线强度较弱,建议出门前涂擦SPF在12-15之间、PA+的防晒护肤品。","type":"uv"},{"brf":"较不宜","txt":"较不宜洗车,未来一天无雨,风力较大,如果执意擦洗汽车,要做好蒙上污垢的心理准备。","type":"cw"},{"brf":"较差","txt":"气象条件较不利于空气污染物稀释、扩散和清除,请适当减少室外活动时间。","type":"air"}]
* status : ok
* update : {"loc":"2017-10-26 23:09","utc":"2017-10-26 15:09"}
*/
private BasicBean basic;
private String status;
private UpdateBean update;
private List<LifestyleItem> lifestyle;
public BasicBean getBasic() {
return basic;
}
public void setBasic(BasicBean basic) {
this.basic = basic;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public UpdateBean getUpdate() {
return update;
}
public void setUpdate(UpdateBean update) {
this.update = update;
}
public List<LifestyleItem> getLifestyle() {
return lifestyle;
}
public void setLifestyle(List<LifestyleItem> lifestyle) {
this.lifestyle = lifestyle;
}
public static class BasicBean {
/**
* cid : CN101010100
* location : 北京
* parent_city : 北京
* admin_area : 北京
* cnty : 中国
* lat : 39.90498734
* lon : 116.40528870
* tz : 8.0
*/
private String cid;
private String location;
private String parent_city;
private String admin_area;
private String cnty;
private String lat;
private String lon;
private String tz;
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getParent_city() {
return parent_city;
}
public void setParent_city(String parent_city) {
this.parent_city = parent_city;
}
public String getAdmin_area() {
return admin_area;
}
public void setAdmin_area(String admin_area) {
this.admin_area = admin_area;
}
public String getCnty() {
return cnty;
}
public void setCnty(String cnty) {
this.cnty = cnty;
}
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
public String getLon() {
return lon;
}
public void setLon(String lon) {
this.lon = lon;
}
public String getTz() {
return tz;
}
public void setTz(String tz) {
this.tz = tz;
}
}
public static class UpdateBean {
/**
* loc : 2017-10-26 23:09
* utc : 2017-10-26 15:09
*/
private String loc;
private String utc;
public String getLoc() {
return loc;
}
public void setLoc(String loc) {
this.loc = loc;
}
public String getUtc() {
return utc;
}
public void setUtc(String utc) {
this.utc = utc;
}
}
public static class LifestyleItem {
/**
* brf : 舒适
* txt : 今天夜间不太热也不太冷,风力不大,相信您在这样的天气条件下,应会感到比较清爽和舒适。
* type : comf
*/
private String brf;
private String txt;
private String type;
public String getBrf() {
return brf;
}
public void setBrf(String brf) {
this.brf = brf;
}
public String getTxt() {
return txt;
}
public void setTxt(String txt) {
this.txt = txt;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
}
}
| [
"1007178106@qq.com"
] | 1007178106@qq.com |
5eb26c26a7ac6031d4de6455f33cc6b308b00c8d | 52e426349b54503560913de964480e7b444e22bd | /mongodb/src/main/java/com/github/sandor_balazs/nosql_java/service/impl/SkillServiceImpl.java | d4954b02fcfdf707f44234074084712493f54ea7 | [
"BSD-2-Clause"
] | permissive | sandor-balazs/nosql-java | 4c4012c7be3e55ef87ababd0d0cd5e978a55a078 | 417c04477a61cd1517091ce8b6b7c2aae3c329c4 | refs/heads/master | 2021-01-10T04:00:44.162983 | 2015-12-09T20:11:06 | 2015-12-09T20:11:06 | 47,703,147 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,206 | java | package com.github.sandor_balazs.nosql_java.service.impl;
import com.github.sandor_balazs.nosql_java.service.SkillService;
import com.github.sandor_balazs.nosql_java.domain.Skill;
import com.github.sandor_balazs.nosql_java.repository.SkillRepository;
import com.github.sandor_balazs.nosql_java.web.rest.dto.SkillDTO;
import com.github.sandor_balazs.nosql_java.web.rest.mapper.SkillMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* Service Implementation for managing Skill.
*/
@Service
public class SkillServiceImpl implements SkillService{
private final Logger log = LoggerFactory.getLogger(SkillServiceImpl.class);
@Inject
private SkillRepository skillRepository;
@Inject
private SkillMapper skillMapper;
/**
* Save a skill.
* @return the persisted entity
*/
public SkillDTO save(SkillDTO skillDTO) {
log.debug("Request to save Skill : {}", skillDTO);
Skill skill = skillMapper.skillDTOToSkill(skillDTO);
skill = skillRepository.save(skill);
SkillDTO result = skillMapper.skillToSkillDTO(skill);
return result;
}
/**
* get all the skills.
* @return the list of entities
*/
public List<SkillDTO> findAll() {
log.debug("Request to get all Skills");
List<SkillDTO> result = skillRepository.findAll().stream()
.map(skillMapper::skillToSkillDTO)
.collect(Collectors.toCollection(LinkedList::new));
return result;
}
/**
* get one skill by id.
* @return the entity
*/
public SkillDTO findOne(String id) {
log.debug("Request to get Skill : {}", id);
Skill skill = skillRepository.findOne(id);
SkillDTO skillDTO = skillMapper.skillToSkillDTO(skill);
return skillDTO;
}
/**
* delete the skill by id.
*/
public void delete(String id) {
log.debug("Request to delete Skill : {}", id);
skillRepository.delete(id);
}
}
| [
"sandor.balazs@ymail.com"
] | sandor.balazs@ymail.com |
6e2c77d3fdce64fe0b240f4c2dacc7c2ccb6c2dc | d43b95c75c5ca792da4a3c278f30a4239264558c | /java/foobar/src/main/java/foobar/LoggableMiddleware.java | 683f6483c6b7f35f5aba015ccbfdada55a249f21 | [] | no_license | ffMathy/TurboPotato.CQRS | 94cb53c1ebb8e1722e43ba88b1c4857ded7f1d78 | 03efbcd27f1dff9aa12049a4c3a980f32117cd34 | refs/heads/master | 2023-03-25T22:08:01.621667 | 2021-02-19T11:47:18 | 2021-02-19T11:47:18 | 340,100,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package foobar;
import an.awesome.pipelinr.Command;
import org.springframework.stereotype.Component;
@Component
class LoggableMiddleware implements Command.Middleware {
@Override
public <R, C extends Command<R>> R invoke(C command, Next<R> next) {
// System.out.println("logging stuff.");
return next.invoke();
}
} | [
"mathias.lorenzen@live.com"
] | mathias.lorenzen@live.com |
03031baf15a2f86b760c85fefe05b652a43b09df | 09a457ec13e54edf1835aed7ff8f4e9239bab3e2 | /src/main/java/com/mengka/springboot/DP_state_02/AnonymousGreetingState.java | c5ce05480eb6cc56b307e845daeb738db21ca624 | [] | no_license | sanqianyuejiamk/springboot-mvc-xb | f143bd8e642c02ee0135094b566b51962aeda158 | b73acef130d6e455f6b1c7fa0c9985063494bb61 | refs/heads/master | 2022-02-25T11:19:10.942315 | 2022-01-23T07:57:46 | 2022-01-23T07:57:46 | 94,222,885 | 0 | 0 | null | 2021-04-26T20:40:56 | 2017-06-13T14:36:23 | Java | UTF-8 | Java | false | false | 274 | java | package com.mengka.springboot.DP_state_02;
public class AnonymousGreetingState implements GreetingState {
private static final String FOOTER_MESSAGE = "<p><Hello anonymous user!</p>";
@Override
public String create() {
return FOOTER_MESSAGE;
}
}
| [
"934734735@qq.com"
] | 934734735@qq.com |
38d514e11a0c3e949dfde8beb5c278d25aafe5e6 | 46dbb5b58ee189a680c96af9a183a23604367920 | /exercice-robot/src/main/java/robot/impl/Batterie.java | f0692c7fba2e6f58f871bf965e59dd8336f83834 | [] | no_license | floodboad/functional-design-patterns | eb91cbb9a0d01a3497b636063e5da1eb5d29be54 | ae85cd868c36627a844617c7bec562035653c0af | refs/heads/master | 2022-12-30T16:10:44.790097 | 2020-08-24T17:19:34 | 2020-08-24T17:19:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,705 | java | /**
* $Id: $
* $Change: $
*
* Copyright 2012 Murex, S.A. All Rights Reserved.
*
* This software is the proprietary information of Murex, S.A.
* Use is subject to license terms.
*/
package robot.impl;
import robot.inter.IBatterie;
/**
*/
public class Batterie implements IBatterie {
//~ ----------------------------------------------------------------------------------------------------------------
//~ Static fields/initializers
//~ ----------------------------------------------------------------------------------------------------------------
/** permet le calcul de l'energie consommee. */
private static final float CONSTANTE_GRAV = (float) 3.7;
//~ ----------------------------------------------------------------------------------------------------------------
//~ Instance fields
//~ ----------------------------------------------------------------------------------------------------------------
/** represente l'autonomie de la batterie. */
private int autonomie;
//~ ----------------------------------------------------------------------------------------------------------------
//~ Constructors
//~ ----------------------------------------------------------------------------------------------------------------
/**
* Constructeur.
*
* @param auto autonomie de la batterie
*/
public Batterie(final int auto) {
this.autonomie = auto;
}
//~ ----------------------------------------------------------------------------------------------------------------
//~ Methods
//~ ----------------------------------------------------------------------------------------------------------------
/* (non-Javadoc)
* @see fr.licence.agl.robot.impl.IBatterie#getAutonomie()
*/
/* (non-Javadoc)
* @see fr.licence.agl.robot.impl.IBatterie#getAutonomie()
*/
/**
* Retourne l'autonomie de la batterie.
*
* @return retourne la valeur de l'autonomie de la batterie
*/
public int getAutonomie() {
return autonomie;
}
/* (non-Javadoc)
* @see fr.licence.agl.robot.impl.IBatterie#setAutonomie(int)
*/
/* (non-Javadoc)
* @see fr.licence.agl.robot.impl.IBatterie#setAutonomie(int)
*/
/**
* Permet de modifier l'autonomie de la batterie.
*
* @param auto nouvelle autonomie de la batterie
*/
public void setAutonomie(final int auto) {
this.autonomie = auto;
}
/* (non-Javadoc)
* @see fr.licence.agl.robot.impl.IBatterie#toString()
*/
/* (non-Javadoc)
* @see fr.licence.agl.robot.impl.IBatterie#toString()
*/
/**
* Retourne l'autonomie de la batterie.
*
* @return retourne l'autonomie dans une chaine de caracteres
*/
public String toString() {
return autonomie + "";
}
/**
* verifie l'egalite entre deux batterie.
*
* @param ib batterie a tester
*
* @return retourne vrai si ib est identique a la batterie
*/
public boolean equals(final IBatterie ib) {
return ib.getAutonomie() == autonomie;
}
/**
* calcule l'energie consommee lors d'un deplacement d'un noeud A a un noeud B.
*
* @param hauteurA hauteur du noeud A
* @param hauteurB hauteur du noeud B
*
* @return retourne la valeur de l'energie consommee a soustraire a l'autonomie de la batterie
*/
public double energieConsommee(final int hauteurA, final int hauteurB) {
double res = (float) (hauteurB - hauteurA);
res /= (float) hauteurB;
res += 1;
res *= CONSTANTE_GRAV;
return res;
}
}
| [
"abailly@murex.com"
] | abailly@murex.com |
a34a3b2f6b23b9e0b225a79321690eb4ffc1b3c5 | 1bdfc534c53b84dfbafcfe31a5e3bcc53544e711 | /hazelcast/src/main/java/com/hazelcast/client/impl/protocol/codec/builtin/ListCNByteCodec.java | 45155dee1a61fa380658fc45cad919228d82e5a9 | [
"LicenseRef-scancode-hazelcast-community-1.0",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | neilstevenson/hazelcast | 2c624e4e7623c3c9d3964e17b7749f1e87f74b91 | ace7273e8f47313c90bdb345fd8235ed5387d9c6 | refs/heads/master | 2023-03-19T22:05:57.052418 | 2023-01-10T11:00:44 | 2023-01-10T11:00:44 | 222,541,553 | 0 | 0 | Apache-2.0 | 2019-11-18T20:47:18 | 2019-11-18T20:47:17 | null | UTF-8 | Java | false | false | 1,458 | java | /*
* Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.client.impl.protocol.codec.builtin;
import com.hazelcast.client.impl.protocol.ClientMessage;
import java.util.List;
import static com.hazelcast.client.impl.protocol.codec.builtin.FixedSizeTypesCodec.BYTE_SIZE_IN_BYTES;
public final class ListCNByteCodec {
private ListCNByteCodec() {
}
public static void encode(ClientMessage clientMessage, Iterable<Byte> items) {
ListCNFixedSizeCodec.encode(clientMessage, items, BYTE_SIZE_IN_BYTES, FixedSizeTypesCodec::encodeByte);
}
public static List<Byte> decode(ClientMessage.ForwardFrameIterator iterator) {
return decode(iterator.next());
}
public static List<Byte> decode(ClientMessage.Frame frame) {
return ListCNFixedSizeCodec.decode(frame, BYTE_SIZE_IN_BYTES, FixedSizeTypesCodec::decodeByte);
}
}
| [
"noreply@github.com"
] | neilstevenson.noreply@github.com |
23c2714bee16b72ebd2224e97ef4a7b5d98f2c4b | 9fad28c9d71ea1657a4170d9406f1aaf04292ca7 | /src/com/zmansiv/plugin/chat/callback/InputCallbackImpl.java | 3467ba5e15d946c4dfa3c9c17ef5b127938fd924 | [] | no_license | zmansiv/rsbuddy-chat | b51f4031f8f63a859bf0f8934ba4a8bf729fbca4 | 8595b094b19df1cb2da3b5e087e14c20d09654a1 | refs/heads/master | 2016-09-11T03:19:52.937849 | 2013-03-15T00:32:28 | 2013-03-15T00:32:28 | 8,782,721 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,774 | java | package com.zmansiv.plugin.chat.callback;
import com.mercuryirc.model.Channel;
import com.mercuryirc.model.Entity;
import com.mercuryirc.model.Message;
import com.mercuryirc.model.Mode;
import com.mercuryirc.model.User;
import com.mercuryirc.network.Connection;
import com.mercuryirc.network.callback.InputCallback;
import com.rsbuddy.api.env.Client;
import com.zmansiv.plugin.chat.Chat;
import com.zmansiv.plugin.chat.ui.ChatPane;
import com.zmansiv.plugin.chat.util.Configuration;
import com.zmansiv.plugin.chat.util.HtmlMessageRow;
import javafx.application.Platform;
import java.util.List;
import java.util.Set;
public class InputCallbackImpl implements InputCallback {
private final ChatPane chatPane;
public InputCallbackImpl(ChatPane chatPane) {
this.chatPane = chatPane;
}
@Override
public void onConnect(final Connection connection) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Client client = Chat.context.lookup(Client.class);
if (connection.getServer().getName().equals(Configuration.DEFAULT_NETWORK)) {
Message message = new Message(connection.getLocalUser(), connection.getServer().getUser("NickServ"), "IDENTIFY " + client.username() + " " + client.session());
connection.privmsg(message, true);
connection.join(Configuration.DEFAULT_CHANNEL);
if (client.dev()) {
connection.join(Configuration.DEFAULT_DEV_CHANNEL);
}
} else {
if (connection.getLocalUser().getNickservPassword() != null) {
Message message = new Message(connection.getLocalUser(), connection.getServer().getUser("NickServ"), "IDENTIFY " + client.username() + " " + connection.getLocalUser().getNickservPassword());
connection.privmsg(message, true);
}
}
if (connection.getLocalUser().getAutojoinChannels() != null) {
for (String channel : connection.getLocalUser().getAutojoinChannels()) {
connection.join(channel);
}
}
}
});
}
@Override
public void onPrivMsg(final Connection connection, final Message message) {
Platform.runLater(new Runnable() {
@Override
public void run() {
chatPane.tabPane().addTargetedMessage(connection, message, HtmlMessageRow.Type.PRIVMSG);
}
});
}
@Override
public void onNotice(final Connection connection, final Message message) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message _message = new Message(message.getSource(), null, message.getMessage());
chatPane.tabPane().addUntargetedMessage(connection, _message, HtmlMessageRow.Type.NOTICE);
}
});
}
@Override
public void onCtcp(final Connection connection, final User source, final String message) {
Platform.runLater(new Runnable() {
@Override
public void run() {
if (message.startsWith("ACTION")) {
Message _message = new Message(source, null, "- " + source.getName() + " " + message.substring(7));
chatPane.tabPane().addUntargetedMessage(connection, _message, HtmlMessageRow.Type.CTCP);
} else {
Message _message = new Message(source, null, "Received from " + source.getName() + ": CTCP " + message);
chatPane.tabPane().addUntargetedMessage(connection, _message, HtmlMessageRow.Type.CTCP);
}
}
});
}
@Override
public void onChannelJoin(final Connection connection, final Channel channel, final User user) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message message = new Message(user, channel, "has joined " + channel.getName());
chatPane.tabPane().addTargetedMessage(connection, message, HtmlMessageRow.Type.JOIN);
}
});
}
@Override
public void onChannelPart(final Connection connection, final Channel channel, final User user, final String reason) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message message = new Message(user, channel, "has left " + channel.getName());
chatPane.tabPane().addTargetedMessage(connection, message, HtmlMessageRow.Type.PART);
if (user.equals(connection.getLocalUser())) {
chatPane.tabPane().closeTab(channel);
chatPane.userPane().setEmpty();
chatPane.userPane().setUserCount(0);
}
}
});
}
@Override
public void onUserQuit(final Connection connection, final User user, final String reason) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message message = new Message(user, null, "has quit (" + reason + ")");
chatPane.tabPane().addUserStatusMessage(user, message, HtmlMessageRow.Type.PART);
}
});
}
@Override
public void onChannelNickList(final Connection connection, Channel channel, Set<User> users) {
}
@Override
public void onTopicChange(final Connection connection, final Channel channel, final User source, final String topic) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message message = new Message(source, channel, "has set the topic: " + topic);
chatPane.tabPane().addTargetedMessage(connection, message, HtmlMessageRow.Type.EVENT);
}
});
}
@Override
public void onUserNickChange(final Connection connection, final User user, final String oldNick) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message message = new Message(null, null, oldNick + " is now known as " + user.getName());
chatPane.tabPane().addUserStatusMessage(user, message, HtmlMessageRow.Type.EVENT);
}
});
}
@Override
public void onUserKick(final Connection connection, final Channel channel, final User user, final String reason) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message message = new Message(user, channel, "has been kicked from " + channel.getName());
chatPane.tabPane().addTargetedMessage(connection, message, HtmlMessageRow.Type.PART);
}
});
}
@Override
public void onChannelModeList(final Connection connection, final Channel channel, final Mode.Type type, final List<Mode> list) {
Message message = new Message(null, null, "Channel " + type.toString() + " list:");
chatPane.tabPane().addTargetedMessage(connection, message, HtmlMessageRow.Type.EVENT);
for (Mode mode : list) {
Message message2 = new Message(null, null, ((User) mode.getTarget()).getHost() + " by " + mode.getSource().getHost());
chatPane.tabPane().addTargetedMessage(connection, message2, HtmlMessageRow.Type.EVENT);
}
}
@Override
public void onError(final Connection connection, final String error) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message message = new Message(null, null, error);
chatPane.tabPane().addUntargetedMessage(connection, message, HtmlMessageRow.Type.ERROR);
}
});
}
@Override
public void onUnknownCommand(final Connection connection, final String command) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Message message = new Message(null, null, "Unknown command: " + command);
chatPane.tabPane().addUntargetedMessage(connection, message, HtmlMessageRow.Type.ERROR);
}
});
}
@Override
public void onModeChange(final Connection connection, final Entity target, final Set<Mode> modes, final boolean add) {
Platform.runLater(new Runnable() {
@Override
public void run() {
for (Mode mode : modes) {
Message message = new Message(mode.getSource(), target, (add ? "" : "un") + "sets " + mode.getType().toString() + " on " + mode.getTarget().getName() + (mode.getTarget().equals(target) ? "" : " in " + target.getName()));
if (target instanceof Channel) {
chatPane.tabPane().addTargetedMessage(connection, message, HtmlMessageRow.Type.EVENT);
} else {
chatPane.tabPane().addUntargetedMessage(connection, message, HtmlMessageRow.Type.EVENT);
}
}
}
});
}
} | [
"zmansiv@gmail.com"
] | zmansiv@gmail.com |
faa77d06b53e3778910c64d77eb993753159f440 | 417ee90476c9f4ab46ee7350a03691ae429d85b7 | /src/main/java/com/ecjtu/fbn/common/AbstractController.java | 480dc6e1e83673ce1bb97f47fe50d1e22ef2bf39 | [] | no_license | yan5yue/fbn | 97496081f67a7325cf2bf06f4880300d6daaeed5 | 574c7a1d2a833a88f3581a0aaa096ea4b2b9f519 | refs/heads/master | 2020-03-06T15:31:15.965527 | 2018-03-27T08:53:45 | 2018-03-27T08:53:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package com.ecjtu.fbn.common;
/**
* @description:
* @author: xu_pf@suixingpay.com
* @date: 2018/2/6
*/
public class AbstractController {
public final static int PAGE_NUM = 1;
public final static int PAGE_SIZE = 5;
public final String REQUEST_METHOD = "GET";
}
| [
"1830166767@qq.com"
] | 1830166767@qq.com |
9cdc969659ce261508c276e15715ade641c04d6f | 9395925cc3485f9b90fc3ecef55f837f8ccf0310 | /org.eclipse.kEEPER.plugin/src/model/impl/ComplexEventImpl.java | 5f3db0124d45fe1cffea9c8a041f52d2afff7599 | [] | no_license | lpasquale/kEEPER | 281c291382598eea23dae473a81acca5bcf3d8fa | c28814cc68e08ef23449c9bcf00124828ffcbfbd | refs/heads/master | 2021-06-27T07:21:44.304759 | 2017-07-06T08:01:04 | 2017-07-06T08:01:04 | 66,030,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,160 | java | /**
*/
package model.impl;
import java.util.ArrayList;
import java.util.Collection;
import model.Agent;
import model.BehaviouralDescription;
import model.ComplexEvent;
import model.ModelPackage;
import model.Parameter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Complex Event</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link model.impl.ComplexEventImpl#getBehaviouralDescriptions <em>Behavioural Descriptions</em>}</li>
* <li>{@link model.impl.ComplexEventImpl#getAgent <em>Agent</em>}</li>
* </ul>
*
* @generated
*/
public class ComplexEventImpl extends EventImpl implements ComplexEvent {
/**
* The cached value of the '{@link #getBehaviouralDescriptions() <em>Behavioural Descriptions</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBehaviouralDescriptions()
* @generated
* @ordered
*/
protected EList<BehaviouralDescription> behaviouralDescriptions;
/**
* The cached value of the '{@link #getAgent() <em>Agent</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAgent()
* @generated
* @ordered
*/
protected Agent agent;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ComplexEventImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ModelPackage.Literals.COMPLEX_EVENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<BehaviouralDescription> getBehaviouralDescriptions() {
if (behaviouralDescriptions == null) {
behaviouralDescriptions = new EObjectResolvingEList<BehaviouralDescription>(BehaviouralDescription.class, this, ModelPackage.COMPLEX_EVENT__BEHAVIOURAL_DESCRIPTIONS);
}
return behaviouralDescriptions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Agent getAgent() {
if (agent != null && agent.eIsProxy()) {
InternalEObject oldAgent = (InternalEObject)agent;
agent = (Agent)eResolveProxy(oldAgent);
if (agent != oldAgent) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.COMPLEX_EVENT__AGENT, oldAgent, agent));
}
}
return agent;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Agent basicGetAgent() {
return agent;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAgent(Agent newAgent) {
Agent oldAgent = agent;
agent = newAgent;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.COMPLEX_EVENT__AGENT, oldAgent, agent));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ModelPackage.COMPLEX_EVENT__BEHAVIOURAL_DESCRIPTIONS:
return getBehaviouralDescriptions();
case ModelPackage.COMPLEX_EVENT__AGENT:
if (resolve) return getAgent();
return basicGetAgent();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ModelPackage.COMPLEX_EVENT__BEHAVIOURAL_DESCRIPTIONS:
getBehaviouralDescriptions().clear();
getBehaviouralDescriptions().addAll((Collection<? extends BehaviouralDescription>)newValue);
return;
case ModelPackage.COMPLEX_EVENT__AGENT:
setAgent((Agent)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ModelPackage.COMPLEX_EVENT__BEHAVIOURAL_DESCRIPTIONS:
getBehaviouralDescriptions().clear();
return;
case ModelPackage.COMPLEX_EVENT__AGENT:
setAgent((Agent)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ModelPackage.COMPLEX_EVENT__BEHAVIOURAL_DESCRIPTIONS:
return behaviouralDescriptions != null && !behaviouralDescriptions.isEmpty();
case ModelPackage.COMPLEX_EVENT__AGENT:
return agent != null;
}
return super.eIsSet(featureID);
}
@Override
public ArrayList<Parameter> getCorrectedParams() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setCorrectedParams(ArrayList<Parameter> c) {
// TODO Auto-generated method stub
}
} //ComplexEventImpl
| [
"marco.latona92@gmail.com"
] | marco.latona92@gmail.com |
dd9a60b427bff42f6823c5976ddcb18ae467f628 | 5470d97b349d780fe14d9c4ebaeb1a6d8aab7ddb | /RecyclerView/app/src/main/java/bd/com/parvez/controller/Data.java | 8960db63782d70d9d963a0899f6dbae0e0f33e3a | [] | no_license | p4rv3z/android | fec166cfba05c68888e4d1bdcf2fa3dc406044ef | 4fe52454a143c2a409d80da7202d3fb3c31dc019 | refs/heads/master | 2021-01-11T08:17:29.900542 | 2017-06-23T19:47:01 | 2017-06-23T19:47:01 | 76,389,399 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,360 | java | package bd.com.parvez.controller;
import java.util.ArrayList;
import java.util.List;
import bd.com.parvez.model.Item;
import bd.com.parvez.recyclerview.R;
/**
* Created by ParveZ on 1/11/2017.
*/
public class Data {
private static final String[] name = {"Arfan", "Sudip", "Rajdip", "Papan", "Sourav", "Akash", "Jahid",
"Rabbier", "Tuhin"};
private static final String[] email = {"arfan@gmail.com", "sudip@gmail.com", "Rajdip@gmail.com",
"Papan@gmail.com", "Sourav@gmail.com", "Akash@gmail.com", "Jahid@gmail.com",
"Rabbier@gmail.com", "Tuhin@gmail.com"};
private static final int[] images = {R.drawable.arfan, R.drawable.sudip, R.drawable.rajdip, R.drawable.papan,
R.drawable.sourav, R.drawable.akash, R.drawable.jahid, R.drawable.rabbier, R.drawable.tuhin};
/**
* Create a list of Item
* @return all Item data
*/
public static List<Item> getAllData() {
//Create List of Item
List<Item> data = new ArrayList<>();
for (int j = 0;j<3;j++)//for increse item for better test
for (int i = 0; i < name.length; i++) {
Item item = new Item();
item.setName(name[i]);
item.setEmail(email[i].toLowerCase());
item.setImage(images[i]);
data.add(item);
}
return data;
}
}
| [
"md.parvez28@gmail.com"
] | md.parvez28@gmail.com |
b7b4c03c66d0a2508f10a0b43ccfd0b4d4307373 | 2ebabea7d16dc4d2a9ffdc1153c60bd9073fe9d8 | /pet-clinic/pet-clinic-data/src/main/java/com/sletras/model/Visit.java | 32aab1782a41e78eb311470a4da8f9068105d19a | [] | no_license | sefrota/spring5 | a9c24639d29dde7c472c73d3259162bcac40b8c1 | 602a9e60ed0c3e3aa28f70ea72c2a5a0f2d8fcfe | refs/heads/master | 2020-04-20T11:32:00.750408 | 2019-02-25T23:55:27 | 2019-02-25T23:55:27 | 168,819,071 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package com.sletras.model;
import java.time.LocalDate;
/**
* Created by sergioletras on 25/02/19.
*/
public class Visit extends BaseEntity<Long> {
private LocalDate date;
private String description;
private Pet pet;
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Pet getPet() {
return pet;
}
public void setPet(Pet pet) {
this.pet = pet;
}
public Visit(LocalDate date) {
this.date = date;
}
}
| [
"miguel265"
] | miguel265 |
03764fde0b9ee22970356e19bc26b3b7dcc0cfda | 1ec827193b5aeae39b5f5241f85093e6dbf16f76 | /study-spring-jdbc/src/main/java/com/hzdongcheng/persistent/sequence/SeqWaterID.java | 350063bd5287cad6bc8bef8aea2433ac31a69bf3 | [] | no_license | valiantzh/study-spring | b66e51f9505349baa9d26eeab2c056c5bd5afbe8 | 5356b8a0351a45ed5048d0eb4c26e24570a6eb9d | refs/heads/master | 2020-04-07T13:13:48.562750 | 2018-12-12T03:29:45 | 2018-12-12T03:29:45 | 158,398,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package com.hzdongcheng.persistent.sequence;
import com.hzdongcheng.toolkits.EduException;
/**
* <p>Title: 智能柜系统</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2018</p>
*
* <p>Company: 杭州东城电子有限公司</p>
*
* @author zxy
* @version 1.0
*/
public class SeqWaterID extends Sequence{
private static String SEQUENCE_NAME = SeqWaterID.class.getSimpleName();
public SeqWaterID() {
}
protected void doGetCurrentMaxValue() throws EduException
{
executeSelectForUpdate(SEQUENCE_NAME);
}
}
| [
"zhengxiaoyong@hzdongcheng.com"
] | zhengxiaoyong@hzdongcheng.com |
12e85e6924ca54fa480d1f3ed6bbc57611ae58a6 | e5802f36e49f7b4362f52d20e80f2d4ec57a97d1 | /proj0/NBody.java | 8985cc3e7c0a75c1d87d11ea7b31d8313e17ff9b | [] | no_license | xpingg/CS61B | 0ef53da33ee6e7d7bb88357500d515e2541c8457 | 6be54843aaf52938a6c66986ddac5f255f3fe55a | refs/heads/main | 2023-05-30T11:07:46.398002 | 2021-06-11T11:26:34 | 2021-06-11T11:26:34 | 372,423,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,553 | java | public class NBody
{
public static double readRadius(String filePath)
{
In in = new In(filePath);
in.readInt();
return in.readDouble();
}
public static Planet[] readPlanets(String filePath)
{
In in = new In(filePath);
int numberOfPlanets = in.readInt();
in.readDouble();
Planet[] allPlanets = new Planet[numberOfPlanets];
for(int indexOfPlanet = 0; indexOfPlanet < numberOfPlanets; indexOfPlanet++)
{
allPlanets[indexOfPlanet] = new Planet(0,0,0,0,0,"");
allPlanets[indexOfPlanet].xxPos = in.readDouble();
allPlanets[indexOfPlanet].yyPos = in.readDouble();
allPlanets[indexOfPlanet].xxVel = in.readDouble();
allPlanets[indexOfPlanet].yyVel = in.readDouble();
allPlanets[indexOfPlanet].mass = in.readDouble();
allPlanets[indexOfPlanet].imgFileName = in.readString();
}
return allPlanets;
}
public static void main(String[] args)
{
double T = Double.parseDouble(args[0]);
double dt = Double.parseDouble(args[1]);
String fileName = args[2];
double universeRadius = readRadius(fileName);
Planet[] allPlanets = readPlanets(fileName);
StdDraw.setScale(-2.5e11,2.5e11);
StdDraw.picture(0,0,"images/starfield.jpg");
for(Planet p : allPlanets)
{
p.draw();
}
StdDraw.enableDoubleBuffering();
double elapsedTime = 0;
int numberOfPlanets = allPlanets.length;
while(elapsedTime < T)
{
double[] xForces = new double[numberOfPlanets];
double[] yForces = new double[numberOfPlanets];
for(int index = 0; index < numberOfPlanets; index++)
{
xForces[index] = allPlanets[index].calcNetForceExertedByX(allPlanets);
yForces[index] = allPlanets[index].calcNetForceExertedByY(allPlanets);
allPlanets[index].update(dt,xForces[index],yForces[index]);
StdDraw.picture(0,0,"images/starfield.jpg");
for(Planet p : allPlanets)
{
p.draw();
}
StdDraw.show();
StdDraw.pause(10);
elapsedTime += dt;
}
}
StdOut.printf("%d\n", allPlanets.length);
StdOut.printf("%.2e\n", universeRadius);
for (int i = 0; i < allPlanets.length; i++)
{
StdOut.printf("%11.4e %11.4e %11.4e %11.4e %11.4e %12s\n",
allPlanets[i].xxPos, allPlanets[i].yyPos, allPlanets[i].xxVel,
allPlanets[i].yyVel, allPlanets[i].mass, allPlanets[i].imgFileName);
}
}
} | [
"you@qq.com"
] | you@qq.com |
50b3b1dc47374935cadc31b1333ee48878a1292f | aef0d16d6904a45660900ea371bb700567c9e32f | /src/main/java/com/baizhi/service/PersonServiceImpl.java | 81b902dcc26b006cbb151063335b914230a7c162 | [] | no_license | xiangwyf/git_day1 | df46a018233e3ea7ce3c23a4566af95eb54f037f | defabaa908aac28e0b35e0804152479fa247a63d | refs/heads/master | 2020-04-11T22:12:23.003165 | 2018-12-17T13:03:15 | 2018-12-17T13:03:15 | 162,126,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package com.baizhi.service;
import com.baizhi.entity.Person;
import com.baizhi.mapper.PersonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.Table;
import java.util.List;
@Service
@Transactional
public class PersonServiceImpl implements PersonService {
@Autowired
private PersonMapper personMapper;
@Override
public List<Person> queryAll() {
return personMapper.selectAll();
}
}
| [
"370309997@qq.com"
] | 370309997@qq.com |
a80131b417390211ed6b648077953732d0c6deca | ad8cab629c58402bb3226363781bceb1ac7ef1db | /src/main/java/models/response/CopyleaksStartResponse.java | c5a886b587151cd5b54e1ef5ca6b79c125ea897b | [
"MIT"
] | permissive | Copyleaks/Java-Plagiarism-Checker | d1ec6f574e5c6ceeb234e797426784eeebcf7c8b | 4348673a72f227818a2b1befcbe56e91883ba33c | refs/heads/master | 2023-06-22T00:57:02.369548 | 2023-06-08T06:50:02 | 2023-06-08T06:50:02 | 43,291,077 | 13 | 12 | MIT | 2023-06-08T06:50:03 | 2015-09-28T09:09:30 | Java | UTF-8 | Java | false | false | 1,432 | java | /*
The MIT License(MIT)
Copyright(c) 2016 Copyleaks LTD (https://copyleaks.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 NON INFRINGEMENT. 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 models.response;
public class CopyleaksStartResponse {
private SuccessScansResponse[] success;
private FailedScansResponse[] failed;
public SuccessScansResponse[] getSuccess() {
return success;
}
public FailedScansResponse[] getFailed() {
return failed;
}
}
| [
"ora@copyleaks.com"
] | ora@copyleaks.com |
e9e3ca1c382449c57834bc3a373059af40068626 | 78bf9c6e3c42f5e5176fa07464f351d305c85ba3 | /src/main/java/com/dagarath/mods/plenainanis/common/registrars/RecipeRegistrar.java | c4805657f50d28265731f4a378de9cfcd740255e | [
"MIT"
] | permissive | dagarath/PlenaInanis | 022a9b434e456e7dab61e9972209bd61b5827d6c | 7f0786eedbb86dcdfdc6a3d6d89ab9493c5680d5 | refs/heads/master | 2016-08-11T14:07:20.623448 | 2016-02-27T14:14:59 | 2016-02-27T14:14:59 | 51,817,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,944 | java | package com.dagarath.mods.plenainanis.common.registrars;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/**
* Created by dagarath on 2016-01-23.
*/
public class RecipeRegistrar {
static ItemStack oakPlanks;
static ItemStack oakSlabs;
static ItemStack sprucePlanks;
static ItemStack spruceSlabs;
static ItemStack birchPlanks;
static ItemStack birchSlabs;
static ItemStack junglePlanks;
static ItemStack jungleSlabs;
static ItemStack acaciaPlanks;
static ItemStack acaciaSlabs;
static ItemStack darkOakPlanks;
static ItemStack darkOakSlabs;
static ItemStack string;
static ItemStack cobbleStone;
static ItemStack dirt;
static ItemStack compost;
static ItemStack stone;
static ItemStack compostItem;
static ItemStack furnace;
static ItemStack glass;
static ItemStack stick;
static ItemStack ironIngot;
static ItemStack goldIngot;
static ItemStack wool;
static ItemStack charcoal;
public static void init(){
oakPlanks = new ItemStack(Blocks.planks, 0,0);
oakSlabs = new ItemStack(Blocks.wooden_slab, 0, 0);
sprucePlanks = new ItemStack(Blocks.planks, 0,1);
spruceSlabs = new ItemStack(Blocks.wooden_slab, 0, 1);
birchPlanks = new ItemStack(Blocks.planks, 0, 2);
birchSlabs = new ItemStack(Blocks.wooden_slab, 0, 2);
junglePlanks = new ItemStack(Blocks.planks, 0, 3);
jungleSlabs = new ItemStack(Blocks.wooden_slab, 0, 3);
acaciaPlanks = new ItemStack(Blocks.planks, 0, 4);
acaciaSlabs = new ItemStack(Blocks.wooden_slab, 0, 4);
darkOakPlanks = new ItemStack(Blocks.planks, 0, 5);
darkOakSlabs = new ItemStack(Blocks.wooden_slab, 0, 5);
string = new ItemStack(Items.string);
cobbleStone = new ItemStack(Item.getItemFromBlock(Blocks.cobblestone));
dirt = new ItemStack(Item.getItemFromBlock(Blocks.dirt));
compost = new ItemStack(Item.getItemFromBlock(BlockRegistrar.blockCompost));
stone = new ItemStack(Item.getItemFromBlock(Blocks.stone));
compostItem = new ItemStack(ItemRegistrar.itemCompost);
furnace = new ItemStack(Item.getItemFromBlock(Blocks.furnace));
glass = new ItemStack(Item.getItemFromBlock(Blocks.glass));
stick = new ItemStack(Items.stick);
ironIngot = new ItemStack(Items.iron_ingot);
goldIngot = new ItemStack(Items.gold_ingot);
wool = new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, OreDictionary.WILDCARD_VALUE);
charcoal = new ItemStack(Items.coal, 1, 1);
registerComposters();
}
public static void registerComposters(){
//Composters
GameRegistry.addRecipe(new ItemStack(BlockRegistrar.composterOak), new Object[]{
"ABA",
"ABA",
"A A",
'A', oakPlanks, 'B', oakSlabs});
GameRegistry.addRecipe(new ItemStack(BlockRegistrar.composterSpruce), new Object[]{
"ABA",
"ABA",
"A A",
'A', sprucePlanks, 'B', spruceSlabs});
GameRegistry.addRecipe(new ItemStack(BlockRegistrar.composterBirch), new Object[]{
"ABA",
"ABA",
"A A",
'A', birchPlanks, 'B', birchSlabs});
GameRegistry.addShapedRecipe(new ItemStack(BlockRegistrar.composterJungle), new Object[]{
"ABA",
"ABA",
"A A",
'A', junglePlanks, 'B', jungleSlabs});
GameRegistry.addShapedRecipe(new ItemStack(BlockRegistrar.composterAcacia), new Object[]{
"ABA",
"ABA",
"A A",
'A', acaciaPlanks, 'B',acaciaSlabs});
GameRegistry.addShapedRecipe(new ItemStack(BlockRegistrar.composterDarkOak), new Object[]{
"ABA",
"ABA",
"A A",
'A', darkOakPlanks, 'B',darkOakSlabs});
//Dirt
GameRegistry.addShapedRecipe(new ItemStack(Blocks.dirt), new Object[]{
"AAA",
"AAA",
"AAA",
'A', ItemRegistrar.itemCompost});
//Sieve
GameRegistry.addShapedRecipe(new ItemStack(BlockRegistrar.blockSieve), new Object[]{
"ABA",
"BBB",
"ABA",
'A', oakPlanks, 'B', string});
//Compost Block
GameRegistry.addShapedRecipe(new ItemStack(BlockRegistrar.blockCompost), new Object[]{
"AA",
"AA",
'A', ItemRegistrar.itemCompost});
//Rich Soil
GameRegistry.addShapedRecipe(new ItemStack(BlockRegistrar.blockRichSoil), new Object[]{
"ABA",
"BAB",
"ABA",
'A', compost, 'B', dirt});
//Block Smasher
GameRegistry.addShapedRecipe(new ItemStack(ItemRegistrar.itemBlockSmasher), new Object[]{
"AAA",
" B ",
" B ",
'A', cobbleStone, 'B', oakPlanks});
//Cobblestone
GameRegistry.addShapedRecipe(new ItemStack(Blocks.cobblestone), new Object[]{
"AAA",
"AAA",
"AAA",
'A', ItemRegistrar.itemPebble});
//Block Squasher
GameRegistry.addShapedRecipe(new ItemStack(Item.getItemFromBlock(BlockRegistrar.blockSquasher)), new Object[]{
"AAA",
" A ",
"AAA",
'A', stone});
//Fertilizer
GameRegistry.addShapedRecipe(new ItemStack(Item.getItemFromBlock(BlockRegistrar.blockSquasher)), new Object[]{
"AAA",
"ABA",
"AAA",
'A', compostItem, 'B', compost});
//Crucible
GameRegistry.addShapedRecipe(new ItemStack(Item.getItemFromBlock(BlockRegistrar.blockCrucible)), new Object[]{
"AAA",
"ABA",
"AAA",
'A', furnace, 'B', glass});
//Minor Moisture Upgrade
GameRegistry.addShapedRecipe(new ItemStack(ItemRegistrar.itemMoisture, 1, 0), new Object[]{
" A ",
"ABA",
" A ",
'A', stick, 'B', charcoal});
//Minor Airflow Upgrade
GameRegistry.addShapedRecipe(new ItemStack(ItemRegistrar.itemAirflow, 1, 0), new Object[]{
" A ",
"ABA",
" A ",
'A', stick, 'B', wool});
//Average Moisture Upgrade
GameRegistry.addShapedRecipe(new ItemStack(ItemRegistrar.itemMoisture, 1, 1), new Object[]{
" A ",
"ABA",
" A ",
'A', ironIngot, 'B', new ItemStack(ItemRegistrar.itemMoisture, 1, 0)});
//Average Airflow Upgrade
GameRegistry.addShapedRecipe(new ItemStack(ItemRegistrar.itemAirflow, 1, 1), new Object[]{
" A ",
"ABA",
" A ",
'A', ironIngot, 'B', new ItemStack(ItemRegistrar.itemAirflow, 1, 0)});
//Major Moisture Upgrade
GameRegistry.addShapedRecipe(new ItemStack(ItemRegistrar.itemMoisture, 1, 2), new Object[]{
" A ",
"ABA",
" A ",
'A', goldIngot, 'B', new ItemStack(ItemRegistrar.itemMoisture, 1, 1)});
//Major Airflow Upgrade
GameRegistry.addShapedRecipe(new ItemStack(ItemRegistrar.itemAirflow, 1, 2), new Object[]{
" A ",
"ABA",
" A ",
'A', goldIngot, 'B', new ItemStack(ItemRegistrar.itemAirflow, 1, 1)});
}
}
| [
"dagarath@gmail.com"
] | dagarath@gmail.com |
0f3df4fe4c0c01eb0d469f9ec43e693f06eb0ead | ed0d1052e4bc078e0bf9378db56385a0865da590 | /src/main/java/com/blastedstudios/freeboot/ai/bt/actions/CooldownStart.java | c00497e78e8ae278dc8f364649b3b2cc5697af33 | [
"MIT"
] | permissive | narfman0/freeboot | 42b7d5053da6546dd7596483a87c6d59a38844bd | 2b24b056b7b37506f1c20cfa30d2ee0acf9953ba | refs/heads/master | 2020-07-20T12:21:43.051269 | 2016-09-23T03:18:46 | 2016-09-23T03:18:46 | 66,181,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,922 | java | // *******************************************************
// MACHINE GENERATED CODE
// DO NOT MODIFY
//
// Generated on 10/19/2014 09:10:19
// *******************************************************
package com.blastedstudios.freeboot.ai.bt.actions;
/** ModelAction class created from MMPM action CooldownStart. */
public class CooldownStart extends jbt.model.task.leaf.action.ModelAction {
/**
* Value of the parameter "identifier" in case its value is specified at
* construction time. null otherwise.
*/
private java.lang.String identifier;
/**
* Location, in the context, of the parameter "identifier" in case its value
* is not specified at construction time. null otherwise.
*/
private java.lang.String identifierLoc;
/**
* Value of the parameter "duration" in case its value is specified at
* construction time. null otherwise.
*/
private java.lang.Integer duration;
/**
* Location, in the context, of the parameter "duration" in case its value
* is not specified at construction time. null otherwise.
*/
private java.lang.String durationLoc;
/**
* Constructor. Constructs an instance of CooldownStart.
*
* @param identifier
* value of the parameter "identifier", or null in case it should
* be read from the context. If null, <code>identifierLoc</code>
* cannot be null.
* @param identifierLoc
* in case <code>identifier</code> is null, this variable
* represents the place in the context where the parameter's
* value will be retrieved from.
* @param duration
* value of the parameter "duration", or null in case it should
* be read from the context. If null, <code>durationLoc</code>
* cannot be null.
* @param durationLoc
* in case <code>duration</code> is null, this variable
* represents the place in the context where the parameter's
* value will be retrieved from.
*/
public CooldownStart(jbt.model.core.ModelTask guard,
java.lang.String identifier, java.lang.String identifierLoc,
java.lang.Integer duration, java.lang.String durationLoc) {
super(guard);
this.identifier = identifier;
this.identifierLoc = identifierLoc;
this.duration = duration;
this.durationLoc = durationLoc;
}
/**
* Returns a com.blastedstudios.freeboot.ai.bt.actions.execution.CooldownStart
* task that is able to run this task.
*/
public jbt.execution.core.ExecutionTask createExecutor(
jbt.execution.core.BTExecutor executor,
jbt.execution.core.ExecutionTask parent) {
return new com.blastedstudios.freeboot.ai.bt.actions.execution.CooldownStart(
this, executor, parent, this.identifier, this.identifierLoc,
this.duration, this.durationLoc);
}
} | [
"narfman0@gmail.com"
] | narfman0@gmail.com |
8f3892953b88e5361a869723172ca976e3ae9dc2 | c68ce6dd4d3a67190d6caf9d23009b8b49f02193 | /CommercialBank/app/src/main/java/com/example/asus/commercialbank/LoanCalculatorFragment.java | 745fed6b5fe57ab6673d359d8f81089632f41b26 | [] | no_license | vinuGamage/MAD-Project | 92e4be41d617a87c1ae7f164f98618120bb86746 | 7bea36cce294db24f656dd8078a599aba7008478 | refs/heads/master | 2020-05-30T17:20:48.111711 | 2019-06-02T00:32:38 | 2019-06-02T00:32:38 | 189,871,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.example.asus.commercialbank;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class LoanCalculatorFragment extends Fragment {
View view;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_loancalculator,container,false);
return view;
}
public void onStart(){
super.onStart();
}
@Override
public void onResume(){
super.onResume();
}
}
| [
"atheeqrc@gmail.com"
] | atheeqrc@gmail.com |
ef9cf2cfd35b529b8b025f68942b6fbbe666b789 | 2134b10210af35e728799cb37c695b7167d537ad | /OneTouchLock/src/workspace/loopj/RetryHandler.java | 92816f702d23704feaa63580260d9aa566c641fe | [] | no_license | rusteer/plugin | c1e9a6f46f61b1b5a5f5d149ab2dee272df02403 | 9268d8744d5b085d89b1e562c7923c92757b95e5 | refs/heads/master | 2020-12-24T05:20:53.595288 | 2016-08-04T08:17:33 | 2016-08-04T08:17:33 | 61,505,486 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,050 | java | /*
Android Asynchronous Http Client
Copyright (c) 2011 James Smith <james@loopj.com>
http://loopj.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Some of the retry logic in this class is heavily borrowed from the
fantastic droid-fu project: https://github.com/donnfelker/droid-fu
*/
package workspace.loopj;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.HashSet;
import javax.net.ssl.SSLException;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.HttpRequestRetryHandler;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.protocol.ExecutionContext;
import org.apache.http.protocol.HttpContext;
import android.os.SystemClock;
class RetryHandler implements HttpRequestRetryHandler {
static void addClassToBlacklist(Class<?> cls) {
exceptionBlacklist.add(cls);
}
static void addClassToWhitelist(Class<?> cls) {
exceptionWhitelist.add(cls);
}
private final static HashSet<Class<?>> exceptionWhitelist = new HashSet<Class<?>>();
private final static HashSet<Class<?>> exceptionBlacklist = new HashSet<Class<?>>();
static {
// Retry if the server dropped connection on us
exceptionWhitelist.add(NoHttpResponseException.class);
// retry-this, since it may happens as part of a Wi-Fi to 3G failover
exceptionWhitelist.add(UnknownHostException.class);
// retry-this, since it may happens as part of a Wi-Fi to 3G failover
exceptionWhitelist.add(SocketException.class);
// never retry timeouts
exceptionBlacklist.add(InterruptedIOException.class);
// never retry SSL handshake failures
exceptionBlacklist.add(SSLException.class);
}
private final int maxRetries;
private final int retrySleepTimeMS;
public RetryHandler(int maxRetries, int retrySleepTimeMS) {
this.maxRetries = maxRetries;
this.retrySleepTimeMS = retrySleepTimeMS;
}
protected boolean isInList(HashSet<Class<?>> list, Throwable error) {
for (Class<?> aList : list) {
if (aList.isInstance(error)) { return true; }
}
return false;
}
@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
boolean retry = true;
Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
boolean sent = b != null && b;
if (executionCount > maxRetries) {
// Do not retry if over max retry count
retry = false;
} else if (isInList(exceptionWhitelist, exception)) {
// immediately retry if error is whitelisted
retry = true;
} else if (isInList(exceptionBlacklist, exception)) {
// immediately cancel retry if the error is blacklisted
retry = false;
} else if (!sent) {
// for most other errors, retry only if request hasn't been fully sent yet
retry = true;
}
if (retry) {
// resend all idempotent requests
HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
if (currentReq == null) { return false; }
}
if (retry) {
SystemClock.sleep(retrySleepTimeMS);
} else {
exception.printStackTrace();
}
return retry;
}
}
| [
"rusteer@outlook.com"
] | rusteer@outlook.com |
f8aa9a81d10796aeeb20121315b377de1af1c08b | 1b480e389b6e96c2db966d374d53ef49b7e925be | /app/src/main/java/flickr/imagesearch/data/utils/URLBuilder.java | 70a4bb44a6e72584eaf7c44b4e34c58218cd1836 | [
"Apache-2.0"
] | permissive | CHIRANJIT1988/flickr-image-search-android-mvvm | 57b6624516ebf193d7399ef162a973afe68e6fb3 | 087a04a2ab977c6d1d400314f8ca99d41f88a479 | refs/heads/master | 2020-03-30T07:26:48.753447 | 2018-09-30T09:14:05 | 2018-09-30T09:14:05 | 150,940,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,257 | java | package flickr.imagesearch.data.utils;
import android.util.Log;
import flickr.imagesearch.model.Photo;
public class URLBuilder
{
private static final String TAG = URLBuilder.class.getSimpleName();
private static final String BASE_URL = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=3e7cc266ae2b0e0d78e279ce8e361736&\n" +
"format=json&nojsoncallback=1&safe_search=1";
private int page;
private String query;
@Override
public String toString()
{
String url = BASE_URL.concat("&text=" + query).concat(page > 0 ? "&page=" + page : "");
Log.i(TAG, url);
return url;
}
public String toPhotoUrl(Photo photo)
{
return "http://farm".concat(String.valueOf(photo.getFarm())).concat(".static.flickr.com/")
.concat(photo.getServer()).concat("/").concat(photo.getId())
.concat("_").concat(photo.getSecret()).concat(".jpg");
}
public String getQuery()
{
return this.query;
}
public void setQuery(String query)
{
this.query = query;
}
public int getPage()
{
return this.page;
}
public void setPage(int page)
{
this.page = page;
}
} | [
"chiranjit.bardhan@conversionbug.com"
] | chiranjit.bardhan@conversionbug.com |
55a1f8f5c688195d64faed7f9c0ddb6c63799a78 | ea868c94a037848d69b43799d525f98f122c5bc8 | /Tutorial_42_toString/bucky/Potpie.java | f4f21629d1723ba7d12a847b322a63b2c7af1e19 | [] | no_license | GiggityGiggity/java-tutorials | 833fed4e8fcc252bc81a185dbe880b3da08b05bb | 2e0d5cb59b5551e9853c1adf08fa374911d6ffcf | refs/heads/master | 2021-01-12T10:58:37.036650 | 2016-11-03T18:38:54 | 2016-11-03T18:38:54 | 72,775,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package bucky;
public class Potpie {
private int month;
private int day;
private int year;
public Potpie(int m, int d, int y){ //This is the 1st thing we do and pass the parameters 4,5,6
month = m; //This will = 4
day = d; //This will = 5
year = y; //This will = 6
//Every time we create an object we will print out this string but in the %s variable we had a reference to an
//object "this" and any time you reference an object and it needs something in the string format it will look
//to the method on line 19
System.out.printf("The constructor for this is %s\n", this); //"this" is going to reference the current object
}
public String toString(){
return String.format("%d/%d/%d", month, day, year); //this is where the format 4/5/6 comes from
}
}
| [
"SchaalD@pragmatics.com"
] | SchaalD@pragmatics.com |
63e8432831ad1f5c7839038d4ea2e39bafdc5704 | 89362361eb854ef670e5a290c4f690963d03adbe | /app/src/main/java/com/example/kaizhang/kaiapplication/database/DatabaseHelper.java | d36123228d9521b2a6879032fbc6f469fd1d0a3b | [] | no_license | zero2424/hello-world | a530117c9e6361162e968989e377ef39b181292c | 548b7fb7488e88eff80a7d24d9c8657ed964710d | refs/heads/master | 2021-01-10T01:41:35.683166 | 2016-01-20T07:48:57 | 2016-01-20T07:48:57 | 49,616,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,649 | java | package com.example.kaizhang.kaiapplication.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.example.kaizhang.kaiapplication.modle.FunctionInfo;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kai zhang on 2016/1/11.
*/
public class DatabaseHelper extends SQLiteOpenHelper {
//类没有实例化,是不能用作父类构造器的参数,必须声明为静态
private static final String name = "kai.db"; //数据库名称
private static final String TABLE_FAVORITES = "favorites";
private static final int version = 1; //数据库版本
public DatabaseHelper(Context context) {
//第三个参数CursorFactory指定在执行查询时获得一个游标实例的工厂类,设置为null,代表使用系统默认的工厂类
super(context, name, null, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE IF NOT EXISTS " + TABLE_FAVORITES + " (" +
"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
"title TEXT," +
"isInHotseat INTEGER NOT NULL DEFAULT 0," +
"functionType INTEGER NOT NULL DEFAULT 0," +
"orderInHotseat INTEGER DEFAULT 0," +
"orderInFunctionListLayout INTEGER DEFAULT 0" +
");");
insertDatas(db);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
private void insertDatas(SQLiteDatabase db) {
db.beginTransaction();
try {
ContentValues contentValues = new ContentValues();
contentValues.put(FunctionInfo.Favorites.FUNCTIONTYPE, FunctionInfo.Favorites.RemoteControl);
contentValues.put(FunctionInfo.Favorites.TITLE, "远程启动");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 0);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "取消启动");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 1);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "车门上锁");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 2);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "车门解锁");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 3);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "车辆闪灯鸣笛");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 4);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.FUNCTIONTYPE, FunctionInfo.Favorites.VehicleState);
contentValues.put(FunctionInfo.Favorites.TITLE, "检测报告");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 0);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "经销商预约");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 1);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.FUNCTIONTYPE, FunctionInfo.Favorites.Navigation);
contentValues.put(FunctionInfo.Favorites.TITLE, "实时路况");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 0);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "搜索兴趣点");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 1);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "电子围栏");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 2);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "一键回家");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 3);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "一键回公司");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 4);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.FUNCTIONTYPE, FunctionInfo.Favorites.Other);
contentValues.put(FunctionInfo.Favorites.TITLE, "联系安吉星");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 0);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "电话云助手");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 1);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "超级管家");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 2);
db.insert(TABLE_FAVORITES, null, contentValues);
contentValues.put(FunctionInfo.Favorites.TITLE, "驾驶行为");
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, 3);
db.insert(TABLE_FAVORITES, null, contentValues);
db.setTransactionSuccessful();
} catch (Exception e) {
e.printStackTrace();
} finally {
db.endTransaction();
}
}
public int update(FunctionInfo functionInfo) {
SQLiteDatabase db = getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(FunctionInfo.Favorites.ID, functionInfo.getId());
contentValues.put(FunctionInfo.Favorites.TITLE, functionInfo.getTitle());
contentValues.put(FunctionInfo.Favorites.ISINHOTSEAT, functionInfo.isInHotseat());
contentValues.put(FunctionInfo.Favorites.FUNCTIONTYPE, functionInfo.getFunctionType());
contentValues.put(FunctionInfo.Favorites.ORDERINHOTSEAT, functionInfo.getOrderInHotseat());
contentValues.put(FunctionInfo.Favorites.ORDERINFUNCTIONLISTLAYOUT, functionInfo.getOrderInFunctionListLayout());
return db.update(TABLE_FAVORITES, contentValues, FunctionInfo.Favorites.ID + " =?", new String[]{functionInfo.getId() + ""});
}
public List<FunctionInfo> getAll() {
List<FunctionInfo> functionInfos = new ArrayList<FunctionInfo>();
SQLiteDatabase db = getReadableDatabase();
Cursor c = null;
db.beginTransaction();
try {
c = getReadableDatabase().query(TABLE_FAVORITES, null, null, null, null, null, null);
while (c != null && c.moveToNext()) {
FunctionInfo functionInfo = new FunctionInfo(c.getLong(0), c.getString(1), c.getInt(2) != 0, c.getInt(3), c.getInt(4), c.getInt(5));
functionInfos.add(functionInfo);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
db.endTransaction();
if (c != null) {
c.close();
}
}
return functionInfos;
}
}
| [
"zero2424@gmail.com"
] | zero2424@gmail.com |
50c8534fe298b0d789270b71421d390a1d2a3dea | bbf97d7496ba592468b9a93f4697ddbb2a62cfa5 | /app/src/main/java/com/example/anonymouscharityapp/ModelVolunteers.java | 259be14c370f26a66d5a10b24570113d991cb908 | [] | no_license | IsuruManjitha/AnonymousCharityApp | 1f18360d0a8b7ea5b53468fbc522faa70cdca45e | 9a327fcecd458d25e36e961e3916b78b4d36bf60 | refs/heads/main | 2023-08-17T15:14:41.435209 | 2021-09-28T15:31:30 | 2021-09-28T15:31:30 | 408,180,004 | 0 | 0 | null | 2021-09-28T15:31:31 | 2021-09-19T16:35:34 | Java | UTF-8 | Java | false | false | 561 | java | package com.example.anonymouscharityapp;
public class ModelVolunteers {
String fullname, email;
public ModelVolunteers() {
}
public ModelVolunteers(String fullname, String email) {
this.fullname = fullname;
this.email = email;
}
public String getFullname() {
return fullname;
}
public void setFullname(String fullname) {
this.fullname = fullname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| [
"88765902+thisuri-dileka@users.noreply.github.com"
] | 88765902+thisuri-dileka@users.noreply.github.com |
368264b3c64aee282e9a092ec53673bb2c9c8d6a | 138b8b1f007d605085756d53a93032c59785d3b4 | /app/src/main/java/com/kuycoding/covid19/model/HospitalModel.java | cad20ac3108aafbdf33e3b2ab6bee40ef4acfdb8 | [] | no_license | kuycoding/disCovid19 | 95534165935da20590ee619e71b83243d8713acb | 33d6dfcbd6241a6f86a1b8ca80961b98437963fc | refs/heads/master | 2022-04-24T05:51:20.990607 | 2020-04-25T06:09:26 | 2020-04-25T06:09:26 | 258,699,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,046 | java | package com.kuycoding.covid19.model;
import android.os.Parcel;
import android.os.Parcelable;
public class HospitalModel implements Parcelable {
String namaRs, alamatRs, route, web, telp;
public HospitalModel() {
}
public HospitalModel(String namaRs, String alamatRs, String route, String web, String telp) {
this.namaRs = namaRs;
this.alamatRs = alamatRs;
this.route = route;
this.web = web;
this.telp = telp;
}
protected HospitalModel(Parcel in) {
namaRs = in.readString();
alamatRs = in.readString();
route = in.readString();
web = in.readString();
telp = in.readString();
}
public static final Creator<HospitalModel> CREATOR = new Creator<HospitalModel>() {
@Override
public HospitalModel createFromParcel(Parcel in) {
return new HospitalModel(in);
}
@Override
public HospitalModel[] newArray(int size) {
return new HospitalModel[size];
}
};
public String getNamaRs() {
return namaRs;
}
public void setNamaRs(String namaRs) {
this.namaRs = namaRs;
}
public String getAlamatRs() {
return alamatRs;
}
public void setAlamatRs(String alamatRs) {
this.alamatRs = alamatRs;
}
public String getRoute() {
return route;
}
public void setRoute(String route) {
this.route = route;
}
public String getWeb() {
return web;
}
public void setWeb(String web) {
this.web = web;
}
public String getTelp() {
return telp;
}
public void setTelp(String telp) {
this.telp = telp;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(namaRs);
dest.writeString(alamatRs);
dest.writeString(route);
dest.writeString(web);
dest.writeString(telp);
}
}
| [
"kuycoding@gmail.com"
] | kuycoding@gmail.com |
5f76993d9863a4c6ef779a5cef8e307f4a02f9e8 | be3169c6835017b8979f23656b952f345bab5af6 | /plover/library/plover-commons/src/main/java/com/bee32/plover/util/i18n/ICurrencyAware.java | ac74f7d2b47e39a5e5c1d00057548faa7931d9be | [] | no_license | lenik/stack | 5ca08d14a71e661f1d5007ba756eff264716f3a3 | a69e2719d56d08a410c19cc73febf0f415d8d045 | refs/heads/master | 2023-07-10T10:54:14.351577 | 2017-07-23T00:10:15 | 2017-07-23T00:12:33 | 395,319,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,722 | java | package com.bee32.plover.util.i18n;
import java.util.Currency;
public interface ICurrencyAware {
/** 人民币 */
Currency CNY = Currency.getInstance("CNY");
/** 法国法郎 */
Currency FRF = Currency.getInstance("FRF");
/** 英镑 */
Currency GBP = Currency.getInstance("GBP");
/** 日元 */
Currency JPY = Currency.getInstance("JPY");
/** 韩圆 */
Currency KRW = Currency.getInstance("KRW");
/** 美元 */
Currency USD = Currency.getInstance("USD");
interface codes {
/** 安道尔比塞塔 */
Currency ADP = Currency.getInstance("ADP");
/** 阿联酋迪拉姆 */
Currency AED = Currency.getInstance("AED");
/** 阿富汗尼 (1927-2002) */
Currency AFA = Currency.getInstance("AFA");
/** 阿富汗尼 */
Currency AFN = Currency.getInstance("AFN");
/** 阿尔巴尼亚列克 */
Currency ALL = Currency.getInstance("ALL");
/** 亚美尼亚德拉姆 */
Currency AMD = Currency.getInstance("AMD");
/** 荷兰安替兰盾 */
Currency ANG = Currency.getInstance("ANG");
/** 安哥拉宽扎 */
Currency AOA = Currency.getInstance("AOA");
/** 阿根廷比索 */
Currency ARS = Currency.getInstance("ARS");
/** 奥地利先令 */
Currency ATS = Currency.getInstance("ATS");
/** 澳大利亚元 */
Currency AUD = Currency.getInstance("AUD");
/** 阿鲁巴基尔德元 */
Currency AWG = Currency.getInstance("AWG");
/** AYM */
Currency AYM = Currency.getInstance("AYM");
/** 阿塞拜疆马纳特 (1993-2006) */
Currency AZM = Currency.getInstance("AZM");
/** 阿塞拜疆马纳特 */
Currency AZN = Currency.getInstance("AZN");
/** 波士尼亚-赫塞哥维纳兑换券 */
Currency BAM = Currency.getInstance("BAM");
/** 巴巴多斯元 */
Currency BBD = Currency.getInstance("BBD");
/** 孟加拉塔卡 */
Currency BDT = Currency.getInstance("BDT");
/** 比利时法郎 */
Currency BEF = Currency.getInstance("BEF");
/** 保加利亚硬列弗 */
Currency BGL = Currency.getInstance("BGL");
/** 保加利亚新列弗 */
Currency BGN = Currency.getInstance("BGN");
/** 巴林第纳尔 */
Currency BHD = Currency.getInstance("BHD");
/** 布隆迪法郎 */
Currency BIF = Currency.getInstance("BIF");
/** 百慕大元 */
Currency BMD = Currency.getInstance("BMD");
/** 文莱元 */
Currency BND = Currency.getInstance("BND");
/** 玻利维亚诺 */
Currency BOB = Currency.getInstance("BOB");
/** 玻利维亚 Mvdol(资金) */
Currency BOV = Currency.getInstance("BOV");
/** 巴西雷亚尔 */
Currency BRL = Currency.getInstance("BRL");
/** 巴哈马元 */
Currency BSD = Currency.getInstance("BSD");
/** 不丹努扎姆 */
Currency BTN = Currency.getInstance("BTN");
/** 博茨瓦纳普拉 */
Currency BWP = Currency.getInstance("BWP");
/** 白俄罗斯新卢布 (1994-1999) */
Currency BYB = Currency.getInstance("BYB");
/** 白俄罗斯卢布 */
Currency BYR = Currency.getInstance("BYR");
/** 伯利兹元 */
Currency BZD = Currency.getInstance("BZD");
/** 加拿大元 */
Currency CAD = Currency.getInstance("CAD");
/** 刚果法郎 */
Currency CDF = Currency.getInstance("CDF");
/** 瑞士法郎 */
Currency CHF = Currency.getInstance("CHF");
/** 智利 Unidades de Fomento(资金) */
Currency CLF = Currency.getInstance("CLF");
/** 智利比索 */
Currency CLP = Currency.getInstance("CLP");
/** 人民币 */
Currency CNY = Currency.getInstance("CNY");
/** 哥伦比亚比索 */
Currency COP = Currency.getInstance("COP");
/** 哥斯达黎加科朗 */
Currency CRC = Currency.getInstance("CRC");
/** 旧塞尔维亚第纳尔 */
Currency CSD = Currency.getInstance("CSD");
/** 古巴比索 */
Currency CUP = Currency.getInstance("CUP");
/** 佛得角埃斯库多 */
Currency CVE = Currency.getInstance("CVE");
/** 塞浦路斯镑 */
Currency CYP = Currency.getInstance("CYP");
/** 捷克克郎 */
Currency CZK = Currency.getInstance("CZK");
/** 德国马克 */
Currency DEM = Currency.getInstance("DEM");
/** 吉布提法郎 */
Currency DJF = Currency.getInstance("DJF");
/** 丹麦克朗 */
Currency DKK = Currency.getInstance("DKK");
/** 多米尼加比索 */
Currency DOP = Currency.getInstance("DOP");
/** 阿尔及利亚第纳尔 */
Currency DZD = Currency.getInstance("DZD");
/** 爱沙尼亚克朗 */
Currency EEK = Currency.getInstance("EEK");
/** 埃及镑 */
Currency EGP = Currency.getInstance("EGP");
/** 厄立特里亚纳克法 */
Currency ERN = Currency.getInstance("ERN");
/** 西班牙比塞塔 */
Currency ESP = Currency.getInstance("ESP");
/** 埃塞俄比亚比尔 */
Currency ETB = Currency.getInstance("ETB");
/** 欧元 */
Currency EUR = Currency.getInstance("EUR");
/** 芬兰马克 */
Currency FIM = Currency.getInstance("FIM");
/** 斐济元 */
Currency FJD = Currency.getInstance("FJD");
/** 福克兰镑 */
Currency FKP = Currency.getInstance("FKP");
/** 法国法郎 */
Currency FRF = Currency.getInstance("FRF");
/** 英镑 */
Currency GBP = Currency.getInstance("GBP");
/** 乔治亚拉瑞 */
Currency GEL = Currency.getInstance("GEL");
/** 加纳塞第 */
Currency GHC = Currency.getInstance("GHC");
/** 加纳塞地 */
Currency GHS = Currency.getInstance("GHS");
/** 直布罗陀镑 */
Currency GIP = Currency.getInstance("GIP");
/** 冈比亚达拉西 */
Currency GMD = Currency.getInstance("GMD");
/** 几内亚法郎 */
Currency GNF = Currency.getInstance("GNF");
/** 希腊德拉克马 */
Currency GRD = Currency.getInstance("GRD");
/** 危地马拉格查尔 */
Currency GTQ = Currency.getInstance("GTQ");
/** 几内亚比绍比索 */
Currency GWP = Currency.getInstance("GWP");
/** 圭亚那元 */
Currency GYD = Currency.getInstance("GYD");
/** 港元 */
Currency HKD = Currency.getInstance("HKD");
/** 洪都拉斯拉伦皮拉 */
Currency HNL = Currency.getInstance("HNL");
/** 克罗地亚库纳 */
Currency HRK = Currency.getInstance("HRK");
/** 海地古德 */
Currency HTG = Currency.getInstance("HTG");
/** 匈牙利福林 */
Currency HUF = Currency.getInstance("HUF");
/** 印度尼西亚盾 */
Currency IDR = Currency.getInstance("IDR");
/** 爱尔兰镑 */
Currency IEP = Currency.getInstance("IEP");
/** 以色列新谢克尔 */
Currency ILS = Currency.getInstance("ILS");
/** 印度卢比 */
Currency INR = Currency.getInstance("INR");
/** 伊拉克第纳尔 */
Currency IQD = Currency.getInstance("IQD");
/** 伊朗里亚尔 */
Currency IRR = Currency.getInstance("IRR");
/** 冰岛克朗 */
Currency ISK = Currency.getInstance("ISK");
/** 意大利里拉 */
Currency ITL = Currency.getInstance("ITL");
/** 牙买加元 */
Currency JMD = Currency.getInstance("JMD");
/** 约旦第纳尔 */
Currency JOD = Currency.getInstance("JOD");
/** 日元 */
Currency JPY = Currency.getInstance("JPY");
/** 肯尼亚先令 */
Currency KES = Currency.getInstance("KES");
/** 吉尔吉斯斯坦索姆 */
Currency KGS = Currency.getInstance("KGS");
/** 柬埔寨瑞尔 */
Currency KHR = Currency.getInstance("KHR");
/** 科摩罗法郎 */
Currency KMF = Currency.getInstance("KMF");
/** 朝鲜圆 */
Currency KPW = Currency.getInstance("KPW");
/** 韩圆 */
Currency KRW = Currency.getInstance("KRW");
/** 科威特第纳尔 */
Currency KWD = Currency.getInstance("KWD");
/** 开曼元 */
Currency KYD = Currency.getInstance("KYD");
/** 哈萨克斯坦坚戈 */
Currency KZT = Currency.getInstance("KZT");
/** 老挝基普 */
Currency LAK = Currency.getInstance("LAK");
/** 黎巴嫩镑 */
Currency LBP = Currency.getInstance("LBP");
/** 斯里兰卡卢比 */
Currency LKR = Currency.getInstance("LKR");
/** 利比亚元 */
Currency LRD = Currency.getInstance("LRD");
/** 莱索托洛蒂 */
Currency LSL = Currency.getInstance("LSL");
/** 立陶宛立特 */
Currency LTL = Currency.getInstance("LTL");
/** 卢森堡法郎 */
Currency LUF = Currency.getInstance("LUF");
/** 拉脱维亚拉特 */
Currency LVL = Currency.getInstance("LVL");
/** 利比亚第纳尔 */
Currency LYD = Currency.getInstance("LYD");
/** 摩洛哥迪拉姆 */
Currency MAD = Currency.getInstance("MAD");
/** 摩尔多瓦列伊 */
Currency MDL = Currency.getInstance("MDL");
/** 马达加斯加阿里亚里 */
Currency MGA = Currency.getInstance("MGA");
/** 马达加斯加法郎 */
Currency MGF = Currency.getInstance("MGF");
/** 马其顿戴代纳尔 */
Currency MKD = Currency.getInstance("MKD");
/** 缅甸开亚特 */
Currency MMK = Currency.getInstance("MMK");
/** 蒙古图格里克 */
Currency MNT = Currency.getInstance("MNT");
/** 澳门元 */
Currency MOP = Currency.getInstance("MOP");
/** 毛里塔尼亚乌吉亚 */
Currency MRO = Currency.getInstance("MRO");
/** 马耳他里拉 */
Currency MTL = Currency.getInstance("MTL");
/** 毛里求斯卢比 */
Currency MUR = Currency.getInstance("MUR");
/** 马尔代夫拉菲亚 */
Currency MVR = Currency.getInstance("MVR");
/** 马拉维克瓦查 */
Currency MWK = Currency.getInstance("MWK");
/** 墨西哥比索 */
Currency MXN = Currency.getInstance("MXN");
/** 墨西哥 Unidad de Inversion (UDI)(资金) */
Currency MXV = Currency.getInstance("MXV");
/** 马来西亚林吉特 */
Currency MYR = Currency.getInstance("MYR");
/** 旧莫桑比克美提卡 */
Currency MZM = Currency.getInstance("MZM");
/** 莫桑比克美提卡 */
Currency MZN = Currency.getInstance("MZN");
/** 纳米比亚元 */
Currency NAD = Currency.getInstance("NAD");
/** 尼日利亚奈拉 */
Currency NGN = Currency.getInstance("NGN");
/** 尼加拉瓜金科多巴 */
Currency NIO = Currency.getInstance("NIO");
/** 荷兰盾 */
Currency NLG = Currency.getInstance("NLG");
/** 挪威克朗 */
Currency NOK = Currency.getInstance("NOK");
/** 尼泊尔卢比 */
Currency NPR = Currency.getInstance("NPR");
/** 新西兰元 */
Currency NZD = Currency.getInstance("NZD");
/** 阿曼里亚尔 */
Currency OMR = Currency.getInstance("OMR");
/** 巴拿马巴波亚 */
Currency PAB = Currency.getInstance("PAB");
/** 秘鲁新索尔 */
Currency PEN = Currency.getInstance("PEN");
/** 巴布亚新几内亚基那 */
Currency PGK = Currency.getInstance("PGK");
/** 菲律宾比索 */
Currency PHP = Currency.getInstance("PHP");
/** 巴基斯坦卢比 */
Currency PKR = Currency.getInstance("PKR");
/** 波兰兹罗提 */
Currency PLN = Currency.getInstance("PLN");
/** 葡萄牙埃斯库多 */
Currency PTE = Currency.getInstance("PTE");
/** 巴拉圭瓜拉尼 */
Currency PYG = Currency.getInstance("PYG");
/** 卡塔尔里亚尔 */
Currency QAR = Currency.getInstance("QAR");
/** 旧罗马尼亚列伊 */
Currency ROL = Currency.getInstance("ROL");
/** 罗马尼亚列伊 */
Currency RON = Currency.getInstance("RON");
/** 塞尔维亚第纳尔 */
Currency RSD = Currency.getInstance("RSD");
/** 俄国卢布 */
Currency RUB = Currency.getInstance("RUB");
/** 俄国卢布 (1991-1998) */
Currency RUR = Currency.getInstance("RUR");
/** 卢旺达法郎 */
Currency RWF = Currency.getInstance("RWF");
/** 沙特里亚尔 */
Currency SAR = Currency.getInstance("SAR");
/** 所罗门群岛元 */
Currency SBD = Currency.getInstance("SBD");
/** 塞舌尔卢比 */
Currency SCR = Currency.getInstance("SCR");
/** 苏丹第纳尔 */
Currency SDD = Currency.getInstance("SDD");
/** Sudanese Pound */
Currency SDG = Currency.getInstance("SDG");
/** 瑞典克朗 */
Currency SEK = Currency.getInstance("SEK");
/** 新加坡元 */
Currency SGD = Currency.getInstance("SGD");
/** 圣赫勒拿群岛磅 */
Currency SHP = Currency.getInstance("SHP");
/** 斯洛文尼亚托拉尔 */
Currency SIT = Currency.getInstance("SIT");
/** 斯洛伐克克朗 */
Currency SKK = Currency.getInstance("SKK");
/** 塞拉利昂利昂 */
Currency SLL = Currency.getInstance("SLL");
/** 索马里先令 */
Currency SOS = Currency.getInstance("SOS");
/** 苏里南元 */
Currency SRD = Currency.getInstance("SRD");
/** 苏里南盾 */
Currency SRG = Currency.getInstance("SRG");
/** 圣多美和普林西比多布拉 */
Currency STD = Currency.getInstance("STD");
/** 萨尔瓦多科朗 */
Currency SVC = Currency.getInstance("SVC");
/** 叙利亚镑 */
Currency SYP = Currency.getInstance("SYP");
/** 斯威士兰里兰吉尼 */
Currency SZL = Currency.getInstance("SZL");
/** 泰铢 */
Currency THB = Currency.getInstance("THB");
/** 塔吉克斯坦索莫尼 */
Currency TJS = Currency.getInstance("TJS");
/** 土库曼斯坦马纳特 */
Currency TMM = Currency.getInstance("TMM");
/** 突尼斯第纳尔 */
Currency TND = Currency.getInstance("TND");
/** 汤加潘加 */
Currency TOP = Currency.getInstance("TOP");
/** 帝汶埃斯库多 */
Currency TPE = Currency.getInstance("TPE");
/** 土耳其里拉 */
Currency TRL = Currency.getInstance("TRL");
/** 新土耳其里拉 */
Currency TRY = Currency.getInstance("TRY");
/** 特立尼达和多巴哥元 */
Currency TTD = Currency.getInstance("TTD");
/** 新台币 */
Currency TWD = Currency.getInstance("TWD");
/** 坦桑尼亚先令 */
Currency TZS = Currency.getInstance("TZS");
/** 乌克兰格里夫尼亚 */
Currency UAH = Currency.getInstance("UAH");
/** 乌干达先令 */
Currency UGX = Currency.getInstance("UGX");
/** 美元 */
Currency USD = Currency.getInstance("USD");
/** 美元(次日) */
Currency USN = Currency.getInstance("USN");
/** 美元(当日) */
Currency USS = Currency.getInstance("USS");
/** 乌拉圭比索 */
Currency UYU = Currency.getInstance("UYU");
/** 乌兹别克斯苏姆 */
Currency UZS = Currency.getInstance("UZS");
/** 委内瑞拉博利瓦 */
Currency VEB = Currency.getInstance("VEB");
/** 委内瑞拉强势玻利瓦 */
Currency VEF = Currency.getInstance("VEF");
/** 越南盾 */
Currency VND = Currency.getInstance("VND");
/** 瓦努阿图瓦图 */
Currency VUV = Currency.getInstance("VUV");
/** 西萨摩亚塔拉 */
Currency WST = Currency.getInstance("WST");
/** 中非金融合作法郎 */
Currency XAF = Currency.getInstance("XAF");
/** 银 */
Currency XAG = Currency.getInstance("XAG");
/** 黄金 */
Currency XAU = Currency.getInstance("XAU");
/** 欧洲复合单位 */
Currency XBA = Currency.getInstance("XBA");
/** 欧洲货币联盟 */
Currency XBB = Currency.getInstance("XBB");
/** 欧洲计算单位 (XBC) */
Currency XBC = Currency.getInstance("XBC");
/** 欧洲计算单位 (XBD) */
Currency XBD = Currency.getInstance("XBD");
/** 东加勒比元 */
Currency XCD = Currency.getInstance("XCD");
/** 特别提款权 */
Currency XDR = Currency.getInstance("XDR");
/** 法国金法郎 */
Currency XFO = Currency.getInstance("XFO");
/** 法国 UIC 法郎 */
Currency XFU = Currency.getInstance("XFU");
/** 非洲金融共同体法郎 */
Currency XOF = Currency.getInstance("XOF");
/** 钯 */
Currency XPD = Currency.getInstance("XPD");
/** 太平洋法郎 */
Currency XPF = Currency.getInstance("XPF");
/** 铂 */
Currency XPT = Currency.getInstance("XPT");
/** 为测试保留的代码 */
Currency XTS = Currency.getInstance("XTS");
/** 货币未知或无效 */
Currency XXX = Currency.getInstance("XXX");
/** 也门里亚尔 */
Currency YER = Currency.getInstance("YER");
/** 南斯拉夫偌威第纳尔 */
Currency YUM = Currency.getInstance("YUM");
/** 南非兰特 */
Currency ZAR = Currency.getInstance("ZAR");
/** 赞比亚克瓦查 */
Currency ZMK = Currency.getInstance("ZMK");
/** 津巴布韦元 */
Currency ZWD = Currency.getInstance("ZWD");
/** ZWN */
Currency ZWN = Currency.getInstance("ZWN");
}
}
| [
"xjl@99jsj.com"
] | xjl@99jsj.com |
e8d8c369c52a04edcc2a60335e6458a02d2ca46b | 1e4bbb8f9e408d3b2bf5cf21dffcfd244e238419 | /net.cloudkit.enterprises/src/main/java/net/cloudkit/experiment/infrastructure/support/messaging/Transformer.java | ca6a564b90c55117a92a0998a0899a5d04a84adc | [
"Apache-2.0"
] | permissive | icloudkit/net.cloudkit | 1606ed135c3c61c5ebefc24ffdb4004763d01f10 | 96b4ed687530b3049f79996df3418f112341b6cd | refs/heads/master | 2020-04-10T21:57:22.496937 | 2017-10-11T09:50:26 | 2017-10-11T09:50:26 | 62,359,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 123 | java | package net.cloudkit.experiment.infrastructure.support.messaging;
/**
* Transformer
*/
public interface Transformer {
}
| [
"hongquanli@qq.com"
] | hongquanli@qq.com |
42dd3e88acecb20541bd4b4436520be5e43e3d6d | 14bc8bdc219ef449a512ae12828c209270514412 | /Translation methods/lab-3/src/main/java/kek/translation/KekGlobalContext.java | cc3e3c5e5f92f84889a1703202b8fd7b582da471 | [] | no_license | ppv-vldmr/ITMO | a7d1858912e8b7f48b74dd7055887d9c39c13520 | 03aafeb575e209139d181c52758d76902447cd85 | refs/heads/master | 2023-04-13T05:39:04.913662 | 2023-04-08T07:22:22 | 2023-04-08T07:22:22 | 231,659,824 | 15 | 12 | null | 2022-06-19T01:39:51 | 2020-01-03T20:25:57 | Jupyter Notebook | UTF-8 | Java | false | false | 2,054 | java | package kek.translation;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
public class KekGlobalContext extends KekContext {
private final Map<String, KekFunc> deferFuncs = new LinkedHashMap<>();
private final Map<String, KekFunc> externFuncs = new LinkedHashMap<>();
private final Map<String, KekFunc> funcs = new LinkedHashMap<>();
private final Map<String, Block> funcsContent = new LinkedHashMap<>();
public KekGlobalContext() {
super(null);
}
@Override
public boolean containsName(String name) {
return super.containsName(name) || funcs.containsKey(name);
}
public void addFunc(KekFunc kekFunc) {
if (deferFuncs.containsKey(kekFunc.name())) {
deferFuncs.remove(kekFunc.name());
} else {
if (containsName(kekFunc.name()))
throw new RuntimeException("Redeclaration of the function '" + kekFunc.name() + "'");
funcs.put(kekFunc.name(), kekFunc);
}
}
public void addDeferFunc(KekFunc kekFunc) {
addFunc(kekFunc);
deferFuncs.put(kekFunc.name(), kekFunc);
}
public void addExternFunc(KekFunc kekFunc) {
externFuncs.put(kekFunc.name(), kekFunc);
}
public void addFuncContent(KekFunc func, Block content) {
if (!containsName(func.name()))
throw new RuntimeException("Impossible case 1");
funcsContent.put(func.name(), content);
}
public void ensureFunc(String name) {
if (!funcs.containsKey(name) && !externFuncs.containsKey(name))
throw new RuntimeException("Could not find definition of the function '" + name + "'");
}
public KekFunc getFunc(String name) {
var result = funcs.get(name);
if (result == null)
result = externFuncs.get(name);
return result;
}
public Collection<KekFunc> getFuncs() {
return funcs.values();
}
public Map<String, Block> getFuncsContent() {
return funcsContent;
}
}
| [
"vova_57@bk.ru"
] | vova_57@bk.ru |
a24f405627943612f7bf958120bc041acf187129 | 184be81816a49bb95bc077d0d5040f3f5a2d38e3 | /app/src/main/java/com/example/splash/DisplayCropToAdmin.java | c37b50f65e030bfc230f3bbc120ecb8847dc2a60 | [] | no_license | upulka/Android-Agroid | 6f2f92940859d28091ddbe3482541ae6364ac1e2 | 94e0b2082f973bc7f67415f7a3c1b5b25493a1ce | refs/heads/master | 2022-12-22T10:20:07.949280 | 2020-10-04T15:27:59 | 2020-10-04T15:27:59 | 297,803,195 | 1 | 0 | null | 2020-09-23T00:07:24 | 2020-09-23T00:07:23 | null | UTF-8 | Java | false | false | 2,976 | java | package com.example.splash;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
public class DisplayCropToAdmin extends AppCompatActivity {
Button myDisplay;
EditText cropID_enteredByAdmin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_crop_to_admin);
myDisplay = findViewById(R.id.btnUpdate);
cropID_enteredByAdmin = findViewById(R.id.txtCropID);
myDisplay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final String adminEnterCropID = cropID_enteredByAdmin.getText().toString().trim();
DatabaseReference ref = FirebaseDatabase.getInstance().getReference().child("Crops");
Query checkCrop = ref.orderByChild("crpID").equalTo(adminEnterCropID);
checkCrop.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
String cropIdFromDB = dataSnapshot.child(adminEnterCropID).child("crpID").getValue(String.class);
if(cropIdFromDB.equals(adminEnterCropID)){
String cropNameFromDB = dataSnapshot.child(adminEnterCropID).child("crpName").getValue(String.class);
String cropDesFromDB = dataSnapshot.child(adminEnterCropID).child("crpDes").getValue(String.class);
String cropIDFromDB = dataSnapshot.child(adminEnterCropID).child("crpID").getValue(String.class);
Intent intent = new Intent(getApplicationContext(), UpdateDeleteCrops.class);
intent.putExtra("crpName" , cropNameFromDB);
intent.putExtra("crpDes" , cropDesFromDB);
intent.putExtra("crpID" , cropIDFromDB);
startActivity(intent);
}else{
Toast.makeText(getApplicationContext() , "ID doesn't Exist..." , Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
});
}
} | [
"it19029528@my.sliit.lk"
] | it19029528@my.sliit.lk |
f32aa8e8b07cf6fa0217a4c358155f817e3d97dd | 86644838b65295323d3a136e08fed4c935cd4488 | /src/main/java/ja/kobespiral/toDo/dto/ToDoDto.java | 47711203babbdb612fb781bb5318dbf0a7df3f2b | [] | no_license | KobeSpiral/ToDoTeamA | 8aa48a0e27dc653c482091472eae979b49ebacc3 | 11bc15926f2c06f02c5ca4c6c10d24aec07214fb | refs/heads/master | 2022-11-19T09:19:17.621106 | 2020-07-10T09:04:09 | 2020-07-10T09:04:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package ja.kobespiral.toDo.dto;
import java.util.Date;
import ja.kobespiral.toDo.entity.ToDo;
import lombok.Data;
@Data
public class ToDoDto {
private Long tid;
private String uid;
private String title;
private String description;
private boolean isOpen;
private Date createdAt;
private Date limitAt;
private Date doneAt;
/**
* ToDoEntityからDTOを作成
*
*/
public static ToDoDto build(ToDo todo) {
ToDoDto dto = new ToDoDto();
dto.tid = todo.getId();
dto.uid = todo.getUid();
dto.title = todo.getTitle();
dto.description = todo.getDescription();
dto.isOpen = todo.isOpen();
dto.createdAt = todo.getCreatedAt();
dto.limitAt = todo.getLimitAt();
dto.doneAt = todo.getDoneAt();
return dto;
}
} | [
"tayataya0626@gmail.com"
] | tayataya0626@gmail.com |
bd7add894cefdb031ccf90dbce56ce6e1f50f4b6 | 76e86a2e835a121eb0531ffb2795625b7b2e531c | /src/JAVA/UI/JListDemo.java | d981769660b2a4ca5427aab95ab452148afbed24 | [] | no_license | 0ranges/OldTest | 7b942d0d4bbc94e1604874ee66d09307000e5e79 | 6f8ffd62d8b2c3eea3c65ffb1a46d800cf9da8ad | refs/heads/master | 2020-04-20T10:06:49.344822 | 2019-06-26T07:55:33 | 2019-06-26T07:55:33 | 168,781,870 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,095 | java | package JAVA.UI;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Vector;
/**
* Created by user on 2017/6/1.
*/
public class JListDemo {
public static void main(String[] args) {
new MyList();
}
}
class MyList{
private JFrame frame = new JFrame("List");
private Container cont = frame.getContentPane();
private JList list1 = null;
private JList list2 = null;
public MyList(){
frame.setLayout(new GridLayout(1,3));
String nationals[] = {"China","England","America","Japan","France","Germany","Italy","Canada","Austrilia"};
list1 = new JList(nationals);
Vector<String> vector = new Vector<>();
vector.add("中国");
vector.add("英国");
vector.add("美国");
list2 = new JList(vector);
list1.setBorder(BorderFactory.createTitledBorder("请选择一个国家:"));
list2.setBorder(BorderFactory.createTitledBorder("Please choose a country:"));
list1.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
list2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list1.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
int temp[] = list1.getSelectedIndices();
System.out.print("output:");
for(int i:temp){
System.out.print(list1.getModel().getElementAt(i)+",");
}
System.out.println();
}
});
JScrollPane scr = new JScrollPane(list1);
cont.add(scr);
cont.add(list2);
frame.setSize(330,180);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(1);
}
});
}
}
| [
"864160262@qq.com"
] | 864160262@qq.com |
e179319fad4eed7275a546fcfd269c038ecccebb | a323f17e56e5f896d3fb519f1ec95b36772d541a | /src/main/java/pl/wieloskalowe/automaton/Automaton.java | bbb6754645503c55957d4691d53821021129f790 | [] | no_license | ishfid4/Automata | cc1747fed557d807c8b16a76d57f7d956f376fec | b54d1825610025aae265df6d3ac625577dc110a4 | refs/heads/master | 2021-01-20T08:01:52.799241 | 2017-05-27T11:58:01 | 2017-05-27T11:58:01 | 90,089,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,890 | java | package pl.wieloskalowe.automaton;
import pl.wieloskalowe.Board2D;
import pl.wieloskalowe.cell.Cell;
import pl.wieloskalowe.cell.CellCoordinates;
import pl.wieloskalowe.CoordinatesWrapper;
import pl.wieloskalowe.neighborhoods.Neighborhood;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Created by ishfi on 03.05.2017.
*/
public abstract class Automaton {
protected Board2D board2D;
protected Neighborhood neighborhood;
protected CoordinatesWrapper coordinatesWrapper = null;
public Automaton(Board2D board2D, Neighborhood neighborhood) {
this.board2D = board2D;
this.neighborhood = neighborhood;
}
public Automaton(Board2D board2D, Neighborhood neighborhood, CoordinatesWrapper coordinatesWrapper) {
this.board2D = board2D;
this.neighborhood = neighborhood;
this.coordinatesWrapper = coordinatesWrapper;
}
abstract protected Cell getNextCellState(Cell cell, Set<Cell> neighbours);
public synchronized void oneIteration() {
Set<CellCoordinates> coordinatesSet = board2D.getAllCoordinates();
Board2D nextBoard = new Board2D(board2D);
for (CellCoordinates cellCoordinates : coordinatesSet) {
Cell currentCell = board2D.getCell(cellCoordinates);
Set<CellCoordinates> coordinatesNeighbours = neighborhood.cellNeighbors(cellCoordinates);
if (coordinatesWrapper != null)
coordinatesNeighbours = coordinatesWrapper.wrapCellCoordinates(coordinatesNeighbours);
Set<Cell> neighbours = coordinatesNeighbours.stream()
.map(cord -> board2D.getCell(cord)).collect(Collectors.toSet());
nextBoard.setCell(cellCoordinates, getNextCellState(currentCell, neighbours));
}
board2D = nextBoard;
}
public Board2D getBoard() {
return board2D;
}
}
| [
"ishfid4@gmail.com"
] | ishfid4@gmail.com |
90230cd8c18a0168a6f4a40f1651655bb43cf684 | 454eb75d7402c4a0da0e4c30fb91aca4856bbd03 | /o2o/trunk/java/o2o-web/src/main/java/cn/com/dyninfo/o2o/furniture/web/page/widget/AdvWidget.java | 98bdffa99f0281e9405d4157f29fb126fb3d2f9f | [] | no_license | fengclondy/guanhongshijia | 15a43f6007cdf996f57c4d09f61b25143b117d73 | c710fe725022fe82aefcb552ebe6d86dcb598d75 | refs/heads/master | 2020-04-15T16:43:37.291843 | 2016-09-09T05:44:14 | 2016-09-09T05:44:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,652 | java | /*
* Copyright (c) 2009-2016 SHENZHEN Eternal Dynasty Technology Co.,Ltd.
* All rights reserved.
*
* This file contains valuable properties of SHENZHEN Eternal Dynasty
* Technology Co.,Ltd., embodying substantial creative efforts and
* confidential information, ideas and expressions. No part of this
* file may be reproduced or distributed in any form or by any means,
* or stored in a data base or a retrieval system, without the prior
* written permission of SHENZHEN Eternal Dynasty Technology Co.,Ltd.
*
*/
package cn.com.dyninfo.o2o.furniture.web.page.widget;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import cn.com.dyninfo.o2o.old.model.AreaInfo;
import cn.com.dyninfo.o2o.old.service.AreaService;
import cn.com.dyninfo.o2o.furniture.web.framework.facade.Widget;
import cn.com.dyninfo.o2o.old.model.Advwz;
import cn.com.dyninfo.o2o.old.service.AdvService;
import cn.com.dyninfo.o2o.old.service.AdvwzService;
@Component("adv")
@Scope("prototype")
public class AdvWidget extends Widget {
@Resource
private AdvService advService;
@Resource
private AreaService areaService;
@Resource
private AdvwzService advwzService;
@Override
public void display(Map pamtr) {
AreaInfo area=(AreaInfo) areaService.getDefaultArea(this.HttpRequest, this.HttpResponse);
String id=(String) pamtr.get("id");
String time=new SimpleDateFormat("yyyy-MM-dd").format(new Date());
List list=advService.getListByWhere(new StringBuffer(" and n.adv_starttime<='"+time+"' and n.adv_endtime>='"+time+"' and n.advwz.advwz_id="+id +(area!=null?" and n.area.id='"+area.getId()+"' order by n.orderIndex asc":" and n.area.id is null order by n.orderIndex asc")));
// System.out.println(" and n.adv_starttime<='"+time+"' and n.adv_endtime>='"+time+"' and n.advwz.advwz_id="+id +(area!=null?" and n.area.id='"+area.getId()+"' order by n.orderIndex asc":"and n.area.id is null order by n.orderIndex asc"));
putData("data", list);
Advwz info=(Advwz) advwzService.getObjById(id);
// System.out.println("广告!:"+id);
this.putData("info", info);
if(info!=null){
if(info.getAdvwz_type().equals("2")){
this.putData("isBtn", pamtr.get("isBtn"));
this.setPageName("slide.html");
}else if(info.getAdvwz_type().equals("1")){
this.setPageName("pic.html");
}else if(info.getAdvwz_type().equals("0")){
this.setPageName("flash.html");
}
}}
}
| [
"leo.cai@9c87f486-7f2d-4350-b948-b2028470fdc6"
] | leo.cai@9c87f486-7f2d-4350-b948-b2028470fdc6 |
ca13e1b059c82014423177e5a60991faa429ca8e | 439d0e963b1a1be120b234703b20044115f4048a | /code/ToDoList/src/LogoutServlet.java | 50c6e0913ca037432c94dae28304d6674828ee1b | [] | no_license | CS212-S16/lectures | d3cec18547b510d4a4f379b4a0213d328f7e9801 | 906628f380d24d590d0cf3304368bc3b0af5ed76 | refs/heads/master | 2021-05-02T12:17:05.104972 | 2017-07-03T18:09:56 | 2017-07-03T18:09:56 | 49,468,451 | 4 | 5 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LogoutServlet extends BaseServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
request.getSession().invalidate();
response.sendRedirect(response.encodeRedirectURL("/login"));
}
}
| [
"srollins@cs.usfca.edu"
] | srollins@cs.usfca.edu |
451f88bb0fe658d8fd5722fd74b053519f2c6fdd | e43fbf4c66b9624bad4832540f48691eea38a0d9 | /TMCProjects/mooc-java-programming-i/part04-Part04_18.PersonalInformation/src/main/java/PersonalInformationCollection.java | f9d54ba0609c799e38a96a7dbd3f7da7c668c709 | [] | no_license | manbakescode/Java-Mooc_2021 | 02977cf9f3caa796fd0f063a757e72c47215b226 | 2cb437cb96cd6f3219323aa9e9e394baa11f2fac | refs/heads/main | 2023-07-16T06:39:39.228813 | 2021-09-02T15:03:10 | 2021-09-02T15:03:10 | 398,874,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,020 | java |
import java.util.ArrayList;
import java.util.Scanner;
public class PersonalInformationCollection {
public static void main(String[] args) {
// implement here your program that uses the PersonalInformation class
ArrayList<PersonalInformation> infoCollection = new ArrayList<>();
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("First name: ");
String firstName = scanner.nextLine();
if (firstName.isEmpty()) {
break;
}
System.out.println("Last name: ");
String lastName = scanner.nextLine();
System.out.println("Identification number: ");
String idNumber = scanner.nextLine();
infoCollection.add(new PersonalInformation(firstName, lastName, idNumber));
}
for (PersonalInformation person: infoCollection) {
System.out.println(person.getFirstName() + " " + person.getLastName());
}
}
}
| [
"42654011+manbakescode@users.noreply.github.com"
] | 42654011+manbakescode@users.noreply.github.com |
3b8bd2fd91bccee18648c01c82d128c67a943010 | fe5aaa70cf34233b7f56d8d5d5c88b27b8bda6d9 | /src/main/Bezahlmethode.java | e45f2013d6e6ffea01e3a7e43ea7dab2db887664 | [] | no_license | KINQQQQQQ/Reiseagentur | 7be514b11b53cde3a013f758eb688a71615f7668 | 416673800c6e59fce991a907d8e6a6d86b871d36 | refs/heads/master | 2020-08-29T03:59:45.149166 | 2019-10-27T20:47:28 | 2019-10-27T20:47:28 | 217,918,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46 | java | package main;
public class Bezahlmethode {
}
| [
"Vince21798@googlemai.com"
] | Vince21798@googlemai.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.