blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cd07713c39f98851c73ac1d570b02281143cf13d | fbac5c0fa26cdf1f6861d2bb5391adccdef913b0 | /src/main/java/com/largeyes/plat/paas/mongo/IRemoteMongoDB.java | 1ebbf5a105dafc8bdc2a411824ea32ea7338918e | [] | no_license | jie04baichi/plat-paas | 08d0587f581ff09194b560cf1a6be1584f83151e | 49ae1587e72d6e5d2dbd0b967f601cf28632dcc7 | refs/heads/master | 2020-03-25T02:00:07.942589 | 2018-08-02T08:48:40 | 2018-08-02T08:48:40 | 143,268,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.largeyes.plat.paas.mongo;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
/**
*
* @author pengjie
*/
public interface IRemoteMongoDB {
public void insert(String dbName, String collectionName, String doc);
public void remove(String dbName, String collectionName, String doc);
public <T> List<T> find(String dbName, String collectionName, JSONObject cond, Class<T> clazz);
}
| [
"pengjie@gzshapp.com"
] | pengjie@gzshapp.com |
a06b421ca205c7184cbb2e22bd186c9ad9bf31eb | 468dd3bcc1154a67a67091f0e4e76d0abff840e4 | /src/main/java/com/lidinghengretrofit/retrofitapplication/MainActivity.java | 3c680b2f05e3a0b71a34b29f22160ea981bd8fda | [] | no_license | lidingheng/uploadFile | cb801eb51a9a7c2b9d0785eaae13402bb613b169 | 47e0d07703466db2d4526279e221265b2eccad08 | refs/heads/master | 2021-09-04T03:22:59.940961 | 2018-01-15T07:21:25 | 2018-01-15T07:21:25 | 117,182,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,403 | java | package com.lidinghengretrofit.retrofitapplication;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
import http.AppConfig;
import http.BaseSubscriber;
import http.ExceptionHandle;
import http.RetrofitClient;
import okhttp3.ResponseBody;
import util.MyApplication;
public class MainActivity extends AppCompatActivity {
public EditText login_name;
public EditText login_password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
login_name = (EditText)findViewById(R.id.login_name);
login_password = (EditText)findViewById(R.id.login_password);
}
public void login(View view){
String strName = login_name.getText().toString();
String strPassword = login_password.getText().toString();
Map<String, Object> map=new HashMap<>();
map.put("loginName",strName);
map.put("password",strPassword);
map.put("phoneCode","86");
map.put("pushRegisterId","190e35f7e07d3e773fa");
RetrofitClient.getIntance(MainActivity.this).createBaseApi().login(AppConfig.LOGIN, map, MyApplication.getIntance().getLanguage(), new BaseSubscriber<ResponseBody>(MainActivity.this) {
@Override
public void onError(ExceptionHandle.ResponeThrowable e) {
Toast.makeText(MainActivity.this, "Error: "+e.message, Toast.LENGTH_SHORT).show();
}
@Override
public void onNext(ResponseBody responseBody) {
//Toast.makeText(MainActivity.this, "success: "+responseBody.toString() , Toast.LENGTH_SHORT).show();
String result = null;
try {
result = responseBody.string();
JSONObject jsonObject = new JSONObject(result);
String msg = (String) jsonObject.get("msg");
Toast.makeText(MainActivity.this, " "+msg, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
| [
"郭烈鹏"
] | 郭烈鹏 |
dcddc5fdacf2038754e1fecc2b51b8f7b9178f28 | e8024b125f90da5082275b58c42de5a71988f114 | /app/src/main/java/com/example/sweatch/coach/Activity_ChangeGoal.java | 6d864719b599dbf1a0c7225f0eb3f5563c554f5c | [] | no_license | Manthita/Sweatch-Coach | 5dda0ce875d5d82a92829ee81f927e9bff8dc461 | 3dd6a27ce60fb867c6e64c6fe810e013d709e3d8 | refs/heads/master | 2020-03-19T07:33:42.499099 | 2018-06-05T05:57:55 | 2018-06-05T05:57:55 | 136,124,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,507 | java | package com.example.sweatch.coach;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class Activity_ChangeGoal extends AppCompatActivity implements
NavigationView.OnNavigationItemSelectedListener{
private NavigationView navigationView;
private DrawerLayout drawerLayout;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_change_goal_settings);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Button saveButton = (Button) findViewById(R.id.saveButton);
saveButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Details saved", Toast.LENGTH_SHORT).show();
}
});
navigationView = (NavigationView) findViewById(R.id.navigation_view);
navigationView.setNavigationItemSelectedListener(this);
View mHeaderView = navigationView.getHeaderView(0);
TextView nameId = (TextView) mHeaderView.findViewById(R.id.txt1);
nameId.setText(LoginActivity.USER_NAME);
TextView emailId = (TextView) mHeaderView.findViewById(R.id.txt2);
emailId.setText(LoginActivity.USER_EMAIL);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer);
ActionBarDrawerToggle actionBarDrawerToggle =
new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open_drawer, R.string.close_drawer) {
@Override
public void onDrawerClosed(View drawerView){
super.onDrawerClosed(drawerView);
}
@Override
public void onDrawerOpened(View drawerView){
super.onDrawerOpened(drawerView);
}
};
drawerLayout.setDrawerListener(actionBarDrawerToggle);
actionBarDrawerToggle.syncState();
}
@Override
public boolean onNavigationItemSelected(MenuItem item){
int id = item.getItemId();
switch (id){
case R.id.item1:
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
break;
case R.id.item2:
intent = new Intent(this, OverviewActivity.class);
startActivity(intent);
break;
case R.id.item3:
intent = new Intent(this, AccountActivity.class);
startActivity(intent);
break;
case R.id.item4:
Intent myIntent = new Intent(this, LoginActivity.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);// clear back stack
startActivity(myIntent);
finish();
default:
break;
}
drawerLayout.closeDrawer(GravityCompat.START);
return true;
}
}
| [
"manthiata.sakho@gmail.com"
] | manthiata.sakho@gmail.com |
c267fa719712ba11a814e4b06877910d195a9c3f | 2bc2eadc9b0f70d6d1286ef474902466988a880f | /branches/mule-1.4-reconnect/core/src/main/java/org/mule/components/builder/MessageBuilder.java | 4f39e412305b2b65ca5843ac4b14123c52dd62af | [] | no_license | OrgSmells/codehaus-mule-git | 085434a4b7781a5def2b9b4e37396081eaeba394 | f8584627c7acb13efdf3276396015439ea6a0721 | refs/heads/master | 2022-12-24T07:33:30.190368 | 2020-02-27T19:10:29 | 2020-02-27T19:10:29 | 243,593,543 | 0 | 0 | null | 2022-12-15T23:30:00 | 2020-02-27T18:56:48 | null | UTF-8 | Java | false | false | 765 | java | /*
* $Id$
* --------------------------------------------------------------------------------------
* Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
*
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/
package org.mule.components.builder;
import org.mule.umo.UMOMessage;
/**
* A Strategy Class for Building one message from the invocation results of a chain
* if endpoints. This is used for invoking different endpoints to obain parts of a
* larger message.
*/
public interface MessageBuilder
{
Object buildMessage(UMOMessage request, UMOMessage response) throws MessageBuilderException;
}
| [
"holger@bf997673-6b11-0410-b953-e057580c5b09"
] | holger@bf997673-6b11-0410-b953-e057580c5b09 |
8a0cc8dfcb9830d0b52d9387207d178e23a584fd | a80fff7fd8bf0eb09e6f12bd4d084b5273b395e6 | /src/main/java/com/gupb/manager/python/PythonPackageManagementException.java | 7e71f1116ff6f1b9d6e321e34f2b4c94c5a10e2d | [] | no_license | Noble-Hamsters-GUPB/GUPB-manager-back | 4243f6b40593199f828fddbe273a8ba6b184fc84 | 3eb427ff3244551e60e9b75ee0028132bd6e8d70 | refs/heads/main | 2023-05-21T04:25:25.525455 | 2021-06-09T15:38:55 | 2021-06-09T15:38:55 | 348,768,173 | 0 | 0 | null | 2021-06-09T15:38:56 | 2021-03-17T15:55:56 | Java | UTF-8 | Java | false | false | 471 | java | package com.gupb.manager.python;
public class PythonPackageManagementException extends Exception {
private final int exitStatus;
private final String logs;
public PythonPackageManagementException(String message, int exitStatus, String logs) {
super(message);
this.exitStatus = exitStatus;
this.logs = logs;
}
int getExitStatus() {
return exitStatus;
}
public String getLogs() {
return logs;
}
}
| [
"kamil.burkiewicz@gmail.com"
] | kamil.burkiewicz@gmail.com |
b81cfa8f1eafe81be5318da4bca55f352311efdf | 88d5b3d1fc2340a993469e684bc5db56edd2f9a3 | /day14_01_transfer1/src/com/itheima/service/AccountService.java | 0c25320e705089a4f590721cbb2c744a9aa0f1b5 | [] | no_license | Huangdahuang/MYTESTWORKSPACE | df41a8cd1c80bdc26531178894d1d1598dacfc51 | a978f761090380a3d6b76364835f8e283912f426 | refs/heads/master | 2020-04-07T16:51:00.699373 | 2018-11-21T12:51:38 | 2018-11-21T12:51:38 | 158,545,689 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 305 | java | package com.itheima.service;
import java.sql.SQLException;
public interface AccountService {
/**
* 转账
* @param fromname 转出用户
* @param toname 转入用户
* @param money 转账金额
* @throws SQLException
*/
public void transfer(String fromname,String toname,double money);
}
| [
"794538296@qq.com"
] | 794538296@qq.com |
04b28911b4d1a1909bc0f727aca656609ae92968 | 5d220b8cbe0bcab98414349ac79b449ec2a5bdcf | /src/com/ufgov/zc/server/zc/service/impl/ZcEbXieyiService.java | 45d5d5a7dc9cf0ff6060312def54dc5e2ef08e3a | [] | no_license | jielen/puer | fd18bdeeb0d48c8848dc2ab59629f9bbc7a5633e | 0f56365e7bb8364f3d1b4daca0591d0322f7c1aa | refs/heads/master | 2020-04-06T03:41:08.173645 | 2018-04-15T01:31:56 | 2018-04-15T01:31:56 | 63,419,454 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,698 | java | /**
* ZcebZbService.java
* com.ufgov.gk.server.zc.service.impl
* Administrator
* 2010-7-16
*/
package com.ufgov.zc.server.zc.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.ufgov.zc.common.system.dto.ElementConditionDto;
import com.ufgov.zc.common.zc.model.ZcBBrand;
import com.ufgov.zc.common.zc.model.ZcBMerDiscount;
import com.ufgov.zc.common.zc.model.ZcBMerPrice;
import com.ufgov.zc.common.zc.model.ZcBMerchandise;
import com.ufgov.zc.common.zc.model.ZcBXieyiGoods;
import com.ufgov.zc.server.zc.dao.IZcEbXieyiDao;
import com.ufgov.zc.server.zc.service.IZcEbXieyiService;
/**
* @author LEO
*
*/
public class ZcEbXieyiService implements IZcEbXieyiService {
private IZcEbXieyiDao zcEbXieyiDao;
public IZcEbXieyiDao getZcEbXieyiDao() {
return zcEbXieyiDao;
}
public void setZcEbXieyiDao(IZcEbXieyiDao zcEbXieyiDao) {
this.zcEbXieyiDao = zcEbXieyiDao;
}
public List getXieyiGoodsRelationData(ElementConditionDto dto) {
List goodsList = new ArrayList();
for (int i = 0; i < dto.getPmAdjustCodeList().size(); i++) {
String zcMerCode = (String) dto.getPmAdjustCodeList().get(i);
ZcBXieyiGoods goods = new ZcBXieyiGoods();
ZcBMerchandise para1 = new ZcBMerchandise();
para1.setZcMerCode(zcMerCode);
ZcBMerchandise merchandise = this.zcEbXieyiDao.getZcBMerchandise(para1);
goods.setZcBMerchandise(merchandise);
ZcBBrand para2 = new ZcBBrand();
para2.setZcBraCode(merchandise.getZcBraCode());
ZcBBrand brand = this.zcEbXieyiDao.getZcBBrand(para2);
goods.setBelongZcBBrand(brand);
ZcBMerPrice para3 = new ZcBMerPrice();
para3.setZC_MER_CODE(zcMerCode);
para3.setZC_BRA_CODE(para2.getZcBraCode());
ZcBMerPrice price = this.zcEbXieyiDao.getZcBMerPrice(para3);
goods.setZcBMerPrice(price);
ZcBMerDiscount para4 = new ZcBMerDiscount();
para4.setZcMerCode(zcMerCode);
para4.setZcSuCode(price.getZC_SU_CODE());
List merDiscountList = this.zcEbXieyiDao.getZcBMerDiscountList(para4);
goods.setZcBMerDiscountList(merDiscountList);
goodsList.add(goods);
}
return goodsList;
}
public String importGoodsData(ZcBXieyiGoods goods) {
this.zcEbXieyiDao.addZcBMerchandise(goods.getZcBMerchandise());
for (int i = 0; i < goods.getZcBMerDiscountList().size(); i++) {
ZcBMerDiscount dis = (ZcBMerDiscount) goods.getZcBMerDiscountList().get(i);
this.zcEbXieyiDao.addZcBMerDiscountList(dis);
}
this.zcEbXieyiDao.addZcBBrand(goods.getBelongZcBBrand());
this.zcEbXieyiDao.addZcBMerPrice(goods.getZcBMerPrice());
return "OK";
}
}
| [
"jielenzghsy1@163.com"
] | jielenzghsy1@163.com |
a9a9ab4986adc6d2cf5afe827ab0f10dd850bf8a | 0316ae30d42e56b6e27ccfaa15838c1ae30e41bf | /2.JavaCore/src/com/codegym/task/task17/task1721/Solution.java | 49284f7c2cc81d92ef7dc521e8aee1267d98acd5 | [] | no_license | mackenziepl/javaTasks | d5961e9ab34333cb0cf445d8fa5b69c3468b7964 | d6ff0ffa22cbbbd5f8dde500f6708f9a7ccf0caf | refs/heads/master | 2020-04-12T11:55:45.068912 | 2019-01-02T21:17:51 | 2019-01-02T21:17:51 | 162,470,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,525 | java | package com.codegym.task.task17.task1721;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Transactionality
*/
public class Solution {
public static List<String> allLines = new ArrayList<>();
public static List<String> linesForRemoval = new ArrayList<>();
static Boolean debug = false; // you can name the variable anything you want;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// File file1 = new File("e:\\Java\\CodeGym\\CodeGymTasks\\2.JavaCore\\src\\com\\codegym\\task\\task17\\task1721\\file1.txt");
// File file2 = new File("e:\\Java\\CodeGym\\CodeGymTasks\\2.JavaCore\\src\\com\\codegym\\task\\task17\\task1721\\file2.txt");
// if (debug) {
//// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//// String s1 = debug ? "e:\\Java\\CodeGym\\CodeGymTasks\\2.JavaCore\\src\\com\\codegym\\task\\task17\\task1721\\file1.txt" : br.readLine();
//// String s2 = debug ? "e:\\Java\\CodeGym\\CodeGymTasks\\2.JavaCore\\src\\com\\codegym\\task\\task17\\task1721\\file2.txt" : br.readLine();
//// }
String s1 = br.readLine();
String s2 = br.readLine();
readFile(allLines, s1);
readFile(linesForRemoval, s2);
Solution solution = new Solution();
solution.joinData();
}
public void joinData() throws CorruptedDataException {
int i = 0;
for (String str1 : allLines) {
for (String str2 : linesForRemoval) {
if(str1.equals(str2)) {
i++;
}
}
}
if(i == linesForRemoval.size()) {
allLines.removeAll(linesForRemoval);
} else {
allLines.clear();
throw new CorruptedDataException();
}
}
public static void readFile(List<String> list, String s){
try {
BufferedReader br = new BufferedReader(new FileReader(s));
String line;
while ((line = br.readLine()) != null){
list.add(line);
}
br.close();
}
catch (FileNotFoundException e) {
System.out.println("File not found!");
}
catch (IOException e) {
System.out.println("IO Error");
}
}
}
| [
"“mackenziepl@poczta.onet.pl"
] | “mackenziepl@poczta.onet.pl |
83b95c8028fb3dac438c1f845f2c0146cf3be4f8 | fca5f9ecb1a0d3ecc9b801e0ac61e694a63b4224 | /src/main/java/repository/RoomRepository.java | 0a6b91e3a2b431aa8f5c31577ebf1ffb672f752a | [] | no_license | ainur-zinnatov/semestrovka | 6e8593a7cd4be0145be15ac8d373669e37c6677a | 4cfeaa5f20d7f376630e93510850d4f2d982effa | refs/heads/master | 2016-09-13T12:39:54.390667 | 2016-05-13T18:42:47 | 2016-05-13T18:42:47 | 58,764,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package repository;
import model.Room;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface RoomRepository extends CrudRepository<Room, Integer> {
Room findByName(String room);
} | [
"ainur.itis403@yandex.ru"
] | ainur.itis403@yandex.ru |
83d1bf7c6bf50ce2862a13051e9a0bd3613cfaf9 | c980c8eddc18cfba07a10cd6619aeed5a174803d | /Project/authorization-api/src/main/java/com/authorizationapi/domain/Reservation.java | c60385749f89506332a938e9c2b91feaf4d2e375 | [] | no_license | JeremicAleks/XML-i-Web-servisi | a8a1f80e7bc733fe4c4f87b19109169edab80102 | cc0f3f87e50a17d4426fad204194b717d10eac2f | refs/heads/master | 2020-04-27T17:12:28.133790 | 2019-06-30T08:48:33 | 2019-06-30T08:48:33 | 174,508,386 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,372 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
// 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: 2019.06.19 at 01:00:02 AM CEST
//
package com.authorizationapi.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
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.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <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 name="checkIn" type="{http://www.w3.org/2001/XMLSchema}date"/>
* <element name="checkOut" type="{http://www.w3.org/2001/XMLSchema}date"/>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}long"/>
* <element name="state" type="{http://www.xml-ftn.xml.domain.centralapi.com/Reservation}ReservationStateEnum"/>
* <sequence maxOccurs="unbounded">
* <element ref="{http://www.xml-ftn.xml.domain.centralapi.com/Reservation}MessageTable"/>
* </sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"checkIn",
"checkOut",
"id",
"state",
"messageTable"
})
@XmlRootElement(name = "Reservation")
@Entity
public class Reservation {
@XmlElement(required = true)
@XmlSchemaType(name = "date")
protected Date checkIn;
@XmlElement(required = true)
@XmlSchemaType(name = "date")
protected Date checkOut;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected long id;
@XmlElement(required = true)
@Enumerated
protected ReservationStateEnum state;
@XmlElement(name = "MessageTable", required = true)
@OneToMany(fetch = FetchType.LAZY,cascade = CascadeType.ALL)
protected List<MessageTable> messageTable;
/**
* Gets the value of the checkIn property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public Date getCheckIn() {
return checkIn;
}
/**
* Sets the value of the checkIn property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setCheckIn(Date value) {
this.checkIn = value;
}
/**
* Gets the value of the checkOut property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public Date getCheckOut() {
return checkOut;
}
/**
* Sets the value of the checkOut property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setCheckOut(Date value) {
this.checkOut = value;
}
/**
* Gets the value of the id property.
*
*/
public long getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(long value) {
this.id = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link ReservationStateEnum }
*
*/
public ReservationStateEnum getState() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link ReservationStateEnum }
*
*/
public void setState(ReservationStateEnum value) {
this.state = value;
}
/**
* Gets the value of the messageTable property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the messageTable property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMessageTable().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link MessageTable }
*
*
*/
public List<MessageTable> getMessageTable() {
if (messageTable == null) {
messageTable = new ArrayList<MessageTable>();
}
return this.messageTable;
}
}
| [
"38253493+kiriyaga@users.noreply.github.com"
] | 38253493+kiriyaga@users.noreply.github.com |
db70f2a480dde2f7fcb2c02bc4079e00b441f484 | c2ff9e156c403598785c239e5369a2b5ec3c2d51 | /PercolationStats.java | 9fb3d397a48a94a94dc1c9ee11e98234a347bcb3 | [] | no_license | amkanti/gridpercolator | 0a8e408f5156816edd5be92ee884ff883dc2b17b | d933963e0e7a57f61e5043d776880d09172084dc | refs/heads/master | 2016-08-12T05:43:09.987898 | 2015-10-14T23:03:31 | 2015-10-14T23:03:31 | 44,280,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,006 | java | /****************************************************************************
* Compilation: javac PercolationStats.java
* Execution: java PercolationStats N T
* Dependencies: StdIn.java StdStats.java Percolation.java WeightedQuickUNionUF.java
*
* Percolation Statistics.
*
****************************************************************************/
/**
* Class Name: PercolationStats.java Description: The <tt>PercolationStats</tt>
* .java program performs a series of T computations on N*N grid. It determines
* the mean, standard deviation of percolation threshold and also the confidence
* interval using methods mean(),stddev(), confidenceLo() and confidenceHi().
* <p>
* This implementation uses Percolation.java to compute the threshold for each
* computation.
*
* @author Amulya Manchikanti
* date : 06/26/2015
*/
public class PercolationStats {
private int comp; // Number of computations
private double[] threshold; // Percolation thresholds of T computations
private double mean, stddev, confilo, confihi;
/**
* Computes percolation threshold on N by N grid for T computations and
* stores the result in a data structure.
*
* @throws java.lang.IllegalArgumentException
* if N <= 0 or T<=0
* @param N
* indicates the size of the grid
* @param T
* indicates the number of computations
*/
public PercolationStats(int N, int T) // perform T independent experiments
// on an N-by-N grid
{
if (N <= 0 || T <= 0)
throw new IllegalArgumentException("Entered argument is not valid");
int open = 0;
comp = T;
threshold = new double[T];
for (int k = 0; k < T; k++) {
Percolation p = new Percolation(N);
while (!p.percolates()) {
int a = StdRandom.uniform(1, N + 1);
int b = StdRandom.uniform(1, N + 1);
// System.out.println("a : " + a + " , b : " + b);
if (!p.isOpen(a, b))
open++;
p.open(a, b);
p.isFull(a, b);
}
// System.out.println("threshold - " + (double)p.openSites/(N*N));
threshold[k] = (double) open / (N * N);
open = 0;
}
}
/**
* Computes sample mean of the thresholds
*
* @return mean value
*/
public double mean() // sample mean of percolation threshold
{
return StdStats.mean(threshold);
}
/**
* Computes sample standard deviation of the thresholds
*
* @return standard deviation value
*/
public double stddev() // sample standard deviation of percolation threshold
{
return StdStats.stddev(threshold);
}
/**
* Computes the low endpoint of the confidence interval
*
* @return low endpoint value
*/
public double confidenceLo() // low endpoint of 95% confidence interval
{
return (mean() - ((1.96 * stddev()) / Math.sqrt(comp)));
}
/**
* Computes the high endpoint of the confidence interval
*
* @return high endpoint value
*/
public double confidenceHi() // high endpoint of 95% confidence interval
{
return (mean() + ((1.96 * stddev()) / Math.sqrt(comp)));
}
public static void main(String[] args) // test client (described below)
{
// System.out.println("Enter the size of the grid : ");
int N = StdIn.readInt();
// System.out.println("Enter the number of computations : ");
int T = StdIn.readInt();
PercolationStats pstats = new PercolationStats(N, T);
pstats.mean = pstats.mean();
pstats.stddev = pstats.stddev();
pstats.confilo = pstats.confidenceLo();
pstats.confihi = pstats.confidenceHi();
System.out.println("mean = " + pstats.mean);
System.out.println("stddev = " + pstats.stddev);
System.out.println("95% confidence interval = " + pstats.confilo
+ ", " + pstats.confihi);
}
}
| [
"amulyam08@gmail.com"
] | amulyam08@gmail.com |
da0a061d244002a48d7bf216fb79742644d20b19 | ff54ab7a0e00bedd0b2a2a00c85f4fe0d1a9727f | /StrutsTest/StrutsWebForum/WebForum/src/com/johntopley/webforum/model/UserCookie.java | b4b88cbe9c611ac5421cfe6a7b36fd7610ad1d31 | [] | no_license | debjava/Core-Tutorials-I | cf4fcd4975d4a2ef870fd11b325b456bb7902791 | edd128bbdca3fb6386e21f55c65f82293b1ef8b0 | refs/heads/master | 2020-04-08T05:28:28.231423 | 2018-11-25T19:33:55 | 2018-11-25T19:33:55 | 159,061,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,442 | java | /*
* Copyright (c) 2004 John Topley (www.johntopley.com)
* Project : Web Forum
* File : UserCookie.java
* Classes : UserCookie
*/
package com.johntopley.webforum.model;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* A representation of the browser cookie containing the user ID of the
* currently logged in user.
*
* @author John Topley
* @version 1.0
*/
public class UserCookie
{
/**
* The maximum age of the cookie (thirty days).
*/
private static final int COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
/**
* The name of the cookie.
*/
private static final String COOKIE_NAME = "com.johntopley.webforum.userid";
/**
* The user ID.
*/
private String userID;
/**
* Constructor for constructing a new <code>UserCookie</code>. The
* <code>userID</code> instance variable is initialised to the value stored in
* the cookie, if it exists.
*
* @param request The HTTP request being processed.
*/
public UserCookie(HttpServletRequest request)
{
super();
// Initialise the user ID to the value stored in the cookie, if it exists.
Cookie[] cookies = request.getCookies();
if (cookies != null)
{
for (int i = 0; i < cookies.length; i++)
{
if (cookies[i].getName().equals(COOKIE_NAME))
{
setUserID(cookies[i].getValue());
}
}
}
}
/**
* Sets the cookie to expire immediately.
*
* @param response The HTTP response being processed.
*/
public void expire(HttpServletResponse response)
{
Cookie forumCookie = new Cookie(COOKIE_NAME, null);
// Setting max age to zero expires the cookie.
forumCookie.setMaxAge(0);
response.addCookie(forumCookie);
}
/**
* Returns the user ID.
*
* @return the user ID.
*/
public String getUserID()
{
return this.userID;
}
/**
* Sets the user ID.
*
* @param userID The user ID.
*/
public void setUserID(String userID)
{
this.userID = userID;
}
/**
* Saves the cookie in the HTTP response.
*
* @param response The HTTP response being processed.
*/
public void save(HttpServletResponse response)
{
Cookie forumCookie = new Cookie(COOKIE_NAME, getUserID());
forumCookie.setMaxAge(COOKIE_MAX_AGE);
response.addCookie(forumCookie);
}
} | [
"deba.java@gmail.com"
] | deba.java@gmail.com |
a35fe2b581902660d73a8e33a318597a1f83da09 | daabe8be9f5255b9b722abbfd2e885c7fde10f0a | /src/test/java/http/parsers/BodyParserTest.java | 14cca0f715a2d02988497f768912be7bfc52b52f | [] | no_license | Maikon/http_server | 6ef2757d301f6d620e9aa6d81d9abcd851b22516 | 90ba2d3f8160a1b118c711220d104df3879675b5 | refs/heads/master | 2021-01-20T11:31:16.100554 | 2015-03-06T10:33:29 | 2015-03-06T10:42:03 | 31,238,256 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | package http.parsers;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.StringReader;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class BodyParserTest {
@Test
public void parsesBodyWithOneLine() {
BodyParser parser = new BodyParser();
BufferedReader reader = createReader("Body of the Request\r\n");
assertThat(parser.read(reader, 19), is("Body of the Request"));
}
@Test
public void readsUpToSpecifiedAmountOfCharacters() {
BodyParser parser = new BodyParser();
BufferedReader reader = createReader("First Line\nSecond Line\nThird Line");
assertThat(parser.read(reader, 22), is("First Line\nSecond Line"));
}
@Test
public void ignoresBodyIfContentLengthIsNotPresent() {
BodyParser parser = new BodyParser();
BufferedReader reader = createReader("First Line\nSecond Line\nThird Line");
assertThat(parser.read(reader, 0), is(""));
}
private BufferedReader createReader(String body) {
StringReader request = new StringReader(body);
return new BufferedReader(request);
}
}
| [
"makisotman@gmail.com"
] | makisotman@gmail.com |
c9aa5f035f16c58ae53068ce2c16b1e006af7e0f | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/ListResourcesForWebACLResult.java | 57468de01bc26e62f56e5000ace844d1d73b2d69 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 6,430 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.waf.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/ListResourcesForWebACL"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ListResourcesForWebACLResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* <p>
* An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array with
* zero elements is returned if there are no resources associated with the web ACL.
* </p>
*/
private java.util.List<String> resourceArns;
/**
* <p>
* An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array with
* zero elements is returned if there are no resources associated with the web ACL.
* </p>
*
* @return An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array
* with zero elements is returned if there are no resources associated with the web ACL.
*/
public java.util.List<String> getResourceArns() {
return resourceArns;
}
/**
* <p>
* An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array with
* zero elements is returned if there are no resources associated with the web ACL.
* </p>
*
* @param resourceArns
* An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array
* with zero elements is returned if there are no resources associated with the web ACL.
*/
public void setResourceArns(java.util.Collection<String> resourceArns) {
if (resourceArns == null) {
this.resourceArns = null;
return;
}
this.resourceArns = new java.util.ArrayList<String>(resourceArns);
}
/**
* <p>
* An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array with
* zero elements is returned if there are no resources associated with the web ACL.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setResourceArns(java.util.Collection)} or {@link #withResourceArns(java.util.Collection)} if you want to
* override the existing values.
* </p>
*
* @param resourceArns
* An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array
* with zero elements is returned if there are no resources associated with the web ACL.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ListResourcesForWebACLResult withResourceArns(String... resourceArns) {
if (this.resourceArns == null) {
setResourceArns(new java.util.ArrayList<String>(resourceArns.length));
}
for (String ele : resourceArns) {
this.resourceArns.add(ele);
}
return this;
}
/**
* <p>
* An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array with
* zero elements is returned if there are no resources associated with the web ACL.
* </p>
*
* @param resourceArns
* An array of ARNs (Amazon Resource Names) of the resources associated with the specified web ACL. An array
* with zero elements is returned if there are no resources associated with the web ACL.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ListResourcesForWebACLResult withResourceArns(java.util.Collection<String> resourceArns) {
setResourceArns(resourceArns);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getResourceArns() != null)
sb.append("ResourceArns: ").append(getResourceArns());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ListResourcesForWebACLResult == false)
return false;
ListResourcesForWebACLResult other = (ListResourcesForWebACLResult) obj;
if (other.getResourceArns() == null ^ this.getResourceArns() == null)
return false;
if (other.getResourceArns() != null && other.getResourceArns().equals(this.getResourceArns()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getResourceArns() == null) ? 0 : getResourceArns().hashCode());
return hashCode;
}
@Override
public ListResourcesForWebACLResult clone() {
try {
return (ListResourcesForWebACLResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
f5fc6ade0eec100ad88e7053e4232db96a3a24bb | 13c2d3db2d49c40c74c2e6420a9cd89377f1c934 | /program_data/JavaProgramData/41/1097.java | 38fee233e2096569c647e56ad7a51c9c2d9599c9 | [
"MIT"
] | permissive | qiuchili/ggnn_graph_classification | c2090fefe11f8bf650e734442eb96996a54dc112 | 291ff02404555511b94a4f477c6974ebd62dcf44 | refs/heads/master | 2021-10-18T14:54:26.154367 | 2018-10-21T23:34:14 | 2018-10-21T23:34:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,620 | java | package <missing>;
public class GlobalMembers
{
public static int Main()
{
int i;
int j;
int k;
int[] gue = new int[5];
int[] qual = new int[5];
gue[1] = 1;
for (qual[0] = 1; qual[0] <= 5; qual[0]++)
{
for (qual[1] = 1; qual[1] <= 5; qual[1]++)
{
for (qual[2] = 1; qual[2] <= 5; qual[2]++)
{
for (qual[3] = 1; qual[3] <= 5; qual[3]++)
{
for (qual[4] = 1; qual[4] <= 5; qual[4]++)
{
gue[0] = (qual[4] == 1);
gue[1] = (qual[1] == 2);
gue[2] = (qual[0] == 5);
gue[3] = (qual[2] != 1);
gue[4] = (qual[3] == 1);
if (qual[0] != qual[1] && qual[0] != qual[2] && qual[0] != qual[3] && qual[0] != qual[4])
{
if (qual[1] != qual[2] && qual[1] != qual[3] && qual[1] != qual[4])
{
if (qual[2] != qual[3] && qual[2] != qual[4])
{
if (qual[3] != qual[4])
{
if (qual[4] != 2 && qual[4] != 3)
{
for (i = 0;i < 4; i++)
{
for (j = i + 1; j < 5;j++)
{
if (gue[i] == 1 && gue[j] == 1 && gue[0] + gue[1] + gue[2] + gue[3] + gue[4] == 2)
{
if ((qual[i] == 1 && qual [j] == 2) || (qual[j] == 1 && qual [i] == 2))
{
for (k = 0; k < 4;k++)
{
System.out.print(qual[k]);
System.out.print(" ");
}
System.out.print(qual[4]);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return 0;
}
}
| [
"y.yu@open.ac.uk"
] | y.yu@open.ac.uk |
3562ee6810e1e1be5ebff2ac548d14e0c52ada02 | f61784dc44a37c28012ca9a9d35e22219c2a976e | /Widgets/app/src/androidTest/java/com/udl/android/widgets/ExampleInstrumentedTest.java | 7bfc61945b61c32bdafb78621a1d51d2b65f901d | [] | no_license | n3x4r/prac6-android | baf6f50097c7e602ae9bb5372477fd92cc715efa | 6361496c7a25066816e0ca24bcc3d5db04e642f4 | refs/heads/master | 2021-03-30T16:37:39.944057 | 2017-03-27T22:08:49 | 2017-03-27T22:08:49 | 85,761,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package com.udl.android.widgets;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.udl.android.widgets", appContext.getPackageName());
}
}
| [
"sergi0.cach0@hotmail.com"
] | sergi0.cach0@hotmail.com |
53872edd138b4d7937ed5b90397247735670af2b | 02edef6fdd8a1f04a5e9d1a03e7988d140c4af33 | /OrderService/src/main/java/com/egen/ecom/repository/AddressRepository.java | fa5421cec4ac38c55f0f626d3a2ae138d0e7054d | [] | no_license | ajaymohandas89/Egen_Ecom_OrderProcessing | 669ee6c53756c1de23f1ef8d37032a44b1b15c22 | 05c389803f60ea65fffd1449b0e5413dcddf811f | refs/heads/master | 2023-02-26T07:07:05.205655 | 2021-01-30T23:43:55 | 2021-01-30T23:43:55 | 333,446,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.egen.ecom.repository;
import java.util.UUID;
import com.egen.ecom.model.Address;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface AddressRepository extends JpaRepository<Address, UUID> {
}
| [
"ajaymohandas89@gmail.com"
] | ajaymohandas89@gmail.com |
16e29524d0de055683a77985c3cd18d9a4eff20b | 9de2e0aa9ea82d21ba358a58d97fadb2db08f435 | /src/main/java/org/teomant/securityTest/repository/AuthoritiesRepository.java | d0d6f7f753875a5d6ecf4005468b37dae0d46073 | [] | no_license | teomant/securityTest | 665eaa37da90990b46eedd52a5f1d3465e70ea1d | 7aec5df4cb83f96152ea5245f0abc433bcf85598 | refs/heads/master | 2020-03-25T09:03:08.042366 | 2018-09-16T15:41:31 | 2018-09-16T15:41:31 | 143,644,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package org.teomant.securityTest.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.teomant.securityTest.entity.AuthoritiesEntity;
public interface AuthoritiesRepository extends JpaRepository<AuthoritiesEntity, Long> {
// @Query( "select au.authority from AuthoritiesEntity au where au.user = :user" )
// List<AuthoritiesEntity> getAuthoritiesByUser(
// @Param( "user" )
// UserEntity user );
}
| [
"teomant@bk.ru"
] | teomant@bk.ru |
bab794750aaee0556faf326fe470b749337f70ce | cec2ba559d91cc99f5be395e081ea1d05a0341ec | /vividus-plugin-web-app/src/test/java/org/vividus/selenium/screenshot/CoordsProviderTypeTests.java | 32f5e576022e7ab1f270c2283f4b42ddbf0ca72d | [
"Apache-2.0"
] | permissive | fireflysvet/vividus | 66aed830b446272f6aef6c9b06f36a23f63a7ec6 | 00efe48704c26e4002a0b6e43f45b0fc09190c13 | refs/heads/master | 2023-04-04T01:20:12.500911 | 2020-08-03T10:42:13 | 2020-08-03T10:42:13 | 285,602,526 | 0 | 1 | Apache-2.0 | 2020-08-06T15:12:07 | 2020-08-06T15:12:06 | null | UTF-8 | Java | false | false | 1,987 | java | /*
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.vividus.selenium.screenshot;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import java.util.stream.Stream;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.vividus.ui.web.action.IJavascriptActions;
import ru.yandex.qatools.ashot.coordinates.CoordsProvider;
import ru.yandex.qatools.ashot.coordinates.WebDriverCoordsProvider;
@ExtendWith(MockitoExtension.class)
class CoordsProviderTypeTests
{
@Mock
private IJavascriptActions javascriptActions;
private static Stream<Arguments> coordsProviderSource()
{
return Stream.of(
Arguments.of(CoordsProviderType.CEILING, CeilingJsCoordsProvider.class),
Arguments.of(CoordsProviderType.WEB_DRIVER, WebDriverCoordsProvider.class)
);
}
@MethodSource("coordsProviderSource")
@ParameterizedTest
void shouldReturnCoordsProviderType(CoordsProviderType type, Class<? extends CoordsProvider> expectedClazz)
{
assertThat(type.create(javascriptActions), is(instanceOf(expectedClazz)));
}
}
| [
"valfirst@yandex.ru"
] | valfirst@yandex.ru |
360cac09199e55802152479ae306b13a0c367df0 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_844.java | 16a7507ed51cb26dca4f0f2e68c1c240aa03fd43 | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | public static String getMessage(String key,Object... params){
String value=getMessage(key);
if (params == null || params.length == 0) {
return value;
}
return String.format(value,params);
}
| [
"sonnguyen@utdallas.edu"
] | sonnguyen@utdallas.edu |
5d14630369dcbc0f464c2df4abe5f72781288726 | 4689dce29840b227296370b4e18bde286cb1fcc2 | /nicki-consulting-core/src/main/java/org/mgnl/nicki/consulting/data/InvoiceWrapper.java | d7288c4c68065f957d6ffbbe006d809a9d84eedd | [] | no_license | rhirning/nicki-consulting | bbc68ba47baf09800ed3db2c6160bf81befd7c22 | 5154ab65392dae7d5e310fbf966f7aac1305660d | refs/heads/master | 2023-07-08T00:22:34.780066 | 2023-06-26T14:26:13 | 2023-06-26T14:26:13 | 125,993,520 | 0 | 0 | null | 2020-09-01T07:16:31 | 2018-03-20T09:33:28 | Java | UTF-8 | Java | false | false | 6,020 | java | package org.mgnl.nicki.consulting.data;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.mgnl.nicki.consulting.core.helper.Constants;
import org.mgnl.nicki.consulting.core.helper.InvoiceHelper;
import org.mgnl.nicki.consulting.core.helper.TimeHelper;
import org.mgnl.nicki.consulting.core.model.Customer;
import org.mgnl.nicki.consulting.core.model.Invoice;
import org.mgnl.nicki.consulting.core.model.Project;
import org.mgnl.nicki.consulting.core.model.Time;
import org.mgnl.nicki.consulting.db.CheckForLatestInvoiceSelectHandler;
import org.mgnl.nicki.consulting.db.InvoiceTimeSelectHandler;
import org.mgnl.nicki.consulting.db.TimeSelectException;
import org.mgnl.nicki.consulting.db.UndoCommand;
import org.mgnl.nicki.core.helper.DataHelper;
import org.mgnl.nicki.db.context.DBContext;
import org.mgnl.nicki.db.context.DBContextManager;
import org.mgnl.nicki.db.profile.InitProfileException;
import org.mgnl.nicki.vaadin.base.components.ConfirmDialog;
import org.mgnl.nicki.vaadin.base.notification.Notification;
import org.mgnl.nicki.vaadin.base.notification.Notification.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.html.Anchor;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.server.StreamResource;
public class InvoiceWrapper {
private static final Logger LOG = LoggerFactory.getLogger(InvoiceWrapper.class);
private Invoice invoice;
private Reloader reloader;
private Button undoButton;
public InvoiceWrapper(Invoice invoice, Reloader reloader) {
this.setInvoice(invoice);
this.reloader = reloader;
}
public Invoice getInvoice() {
return invoice;
}
public void setInvoice(Invoice invoice) {
this.invoice = invoice;
}
public Customer getCustomer() {
return TimeHelper.getCustomer(getProject().getCustomerId());
}
public String getCustomerName() {
return getCustomer().getName();
}
public Project getProject() {
return TimeHelper.getProject(invoice.getProjectId());
}
public String getProjectName() {
return getProject().getName();
}
public String getInvoiceNumber() {
return invoice.getInvoiceNumber();
}
public Date getStart() {
return invoice.getStart();
}
public Date getEnd() {
return invoice.getEnd();
}
public Date getInvoiceDate() {
return invoice.getInvoiceDate();
}
public Component getInvoiceDocument() {
Anchor anchor = new Anchor();
StreamResource pdfSource = createInvoicePDFStream();
anchor.setEnabled(true);
anchor.setHref(pdfSource);
anchor.setText("Download");
return new Div(anchor);
}
private StreamResource createInvoicePDFStream() {
return new StreamResource("Invoice_" + DataHelper.getMilli(invoice.getInvoiceDate()) + ".pdf",
() -> InvoiceHelper.renderInvoice(getProject(), getInvoiceParams()));
}
protected Map<String, Object> getInvoiceParams() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("times", getTimes());
params.put("invoiceNumber", invoice.getInvoiceNumber());
params.put("firstDay", invoice.getStart());
params.put("lastDay", new Date(invoice.getEnd().getTime() - InvoiceHelper.DAY_IN_MS));
params.put("timeHelper", new TimeHelper());
params.put("dataHelper", new DataHelper());
params.put("today", invoice.getInvoiceDate());
return params;
}
public Component getUndoButton() {
undoButton = new Button("Storno");
undoButton.addClickListener(event -> showUndo());
return undoButton;
}
private void showUndo() {
// check for latest project invoice
try (DBContext dbContext = DBContextManager.getContext(Constants.DB_CONTEXT_NAME)) {
CheckForLatestInvoiceSelectHandler handler = new CheckForLatestInvoiceSelectHandler(invoice, Constants.DB_CONTEXT_NAME);
dbContext.select(handler);
if (!handler.isLatest()) {
Notification.show("Es kann nur die letzte Rechnung eines Projekts storniert werden", Type.ERROR_MESSAGE);
return;
}
} catch (SQLException | InitProfileException | TimeSelectException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
UndoCommand undoCommand = new UndoCommand(invoice, reloader);
new ConfirmDialog(undoCommand).open();;
}
public Component getTimeSheetDocument() {
Anchor anchor = new Anchor();
StreamResource pdfSource = createTimeSheetPDFStream();
anchor.setEnabled(true);
anchor.setHref(pdfSource);
anchor.setText("Download");
return new Div(anchor);
}
private StreamResource createTimeSheetPDFStream() {
return new StreamResource("TimeSheet_" + DataHelper.getMilli(invoice.getInvoiceDate()) + ".pdf",
() -> InvoiceHelper.renderTimeSheet(getProject(), getTimeSheetParams()));
}
protected Map<String, Object> getTimeSheetParams() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("times", getTimes());
params.put("invoiceNumber", invoice.getInvoiceNumber());
params.put("firstDay", invoice.getStart());
params.put("lastDay", new Date(invoice.getEnd().getTime() - InvoiceHelper.DAY_IN_MS));
params.put("timeHelper", new TimeHelper());
params.put("dataHelper", new DataHelper());
params.put("today", invoice.getInvoiceDate());
return params;
}
private List<Time> getTimes() {
try (DBContext dbContext = DBContextManager.getContext(Constants.DB_CONTEXT_NAME)) {
InvoiceTimeSelectHandler selectHandler = new InvoiceTimeSelectHandler(invoice.getId(), Constants.DB_CONTEXT_NAME);
dbContext.select(selectHandler);
return selectHandler.getList();
} catch (SQLException | InitProfileException | TimeSelectException e) {
LOG.error("Could not load invoice times", e);
}
return new ArrayList<>();
}
}
| [
"ralf@hirning.de"
] | ralf@hirning.de |
1b75894d5c4b9777eefe5f9656ede52c8b31a27a | ee90e48c853f6bcb591321524b92d1695822f8c7 | /src/main/java/CDD/game/controller/StartGameController.java | 2dc1011baa3177f8c0ad1040889fd3ace7c3d459 | [] | no_license | EuKKK/CDDGame | bd3bed39344b9eb54d09028887dd90ccc84ffad4 | 4888ec59b5ef072db0e1058581460ddb5dd6b792 | refs/heads/master | 2020-05-31T23:01:23.144743 | 2019-06-06T06:35:55 | 2019-06-06T06:35:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,025 | java | package CDD.game.controller;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
import CDD.game.Game;
import CDD.game.Tools.FileUtils;
import CDD.game.model.Player.User;
import CDD.game.model.Player.UserPlayer;
import CDD.game.view.App;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.SingleSelectionModel;
import javafx.scene.control.Slider;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
public class StartGameController implements Initializable{
@FXML
private Label StartButton;
@FXML
private Label close;
@FXML
private Button settings;
@FXML
private Button rank;
@FXML
private StackPane settingPage;
@FXML
private StackPane rankPage;
@FXML
private ChoiceBox<User> name;
@FXML
private TextField nameTextField;
@FXML
private Slider SVolumn1;
@FXML
private Slider SVolumn2;
@FXML
private TableView<User> ranktable;
@FXML
private TableColumn<User, String> nameColumn;
@FXML
private TableColumn<User, Integer> scoreColumn;
private ObservableList<User> UserData = FXCollections.observableArrayList();
public void initialize(URL location, ResourceBundle resources) {
// TODO Auto-generated method stub
Bind();
StartButtonEvent();
SettingEvent();
RankEvent();
closeEvent();
initTable();
}
public void RankEvent()
{
rank.setOnMouseEntered(e->{
rank.setPrefHeight(105);
rank.setPrefWidth(205);
});
rank.setOnMouseExited(e->{
rank.setPrefHeight(100);
rank.setPrefWidth(200);
});
rank.setOnMouseClicked(e->{
settingPage.setVisible(false);
settingPage.setDisable(true);
rankPage.setVisible(true);
rankPage.setDisable(false);
rankPage.toFront();
List<User> lists=FileUtils.readUser();
UserData.clear();
UserData.addAll(lists);
});
}
public void StartButtonEvent()
{
StartButton.setOnMouseEntered(e->{
StartButton.setPrefHeight(105);
StartButton.setPrefWidth(205);
});
StartButton.setOnMouseExited(e->{
StartButton.setPrefHeight(100);
StartButton.setPrefWidth(200);
});
StartButton.setOnMouseClicked(e->{
try {
User user=null;
if(name.getSelectionModel().getSelectedItem() == null)
{
user=new User("游客");
}else
{
user=name.getSelectionModel().getSelectedItem();
}
Game.getInstance().setUserPlayer(new UserPlayer(user));
Game.getInstance().initBoard();
App.setRoot("BoardView");
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
});
}
public void closeEvent()
{
close.setOnMouseEntered(e->{
close.setPrefHeight(35);
close.setPrefWidth(35);
});
close.setOnMouseExited(e->{
close.setPrefHeight(30);
close.setPrefWidth(30);
});
close.setOnMouseClicked(e->{
rankPage.setVisible(false);
});
}
public void SettingEvent()
{
settings.setOnMouseEntered(e->{
settings.setPrefHeight(105);
settings.setPrefWidth(205);
});
settings.setOnMouseExited(e->{
settings.setPrefHeight(100);
settings.setPrefWidth(200);
});
settings.setOnMouseClicked(e->{
rankPage.setVisible(false);
rankPage.setDisable(true);
settingPage.setVisible(true);
settingPage.setDisable(false);
List<User> lists=FileUtils.readUser();
System.out.println(lists.size());
if(lists.size()!=0)
{
name.getItems().clear();
name.getItems().addAll(lists);
}
});
}
public void confirm()
{
settingPage.setVisible(false);
}
public void register()
{
if(nameTextField.getText()!=null&&!nameTextField.getText().equals(""))
{
List<User> users=FileUtils.readUser();
for(User user:users)
{
if(user.getName().equals(nameTextField.getText()))
{
nameTextField.setText("");
return;
}
}
User user=new User(nameTextField.getText());
users.add(user);
try {
FileUtils.writeUser(users);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
nameTextField.setText("");
name.getItems().clear();
name.getItems().addAll(users);
}
}
public void Bind() {
Game.getInstance().getPlayer().getPlayer().
volumeProperty().bind(SVolumn1.valueProperty().divide(100));
Game.getInstance().getShowcard().getPlayer().
volumeProperty().bind(SVolumn2.valueProperty().divide(100));
SVolumn1.setValue(50);
SVolumn2.setValue(50);
}
public void initTable()
{
this.nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
this.scoreColumn.setCellValueFactory(new PropertyValueFactory<>("score"));
this.ranktable.setItems(UserData);
}
}
| [
"731744768@qq.com"
] | 731744768@qq.com |
0c0e9a68c806aac400f7e9e9ae41e29fb81e4a1f | e75be673baeeddee986ece49ef6e1c718a8e7a5d | /submissions/blizzard/Corpus/eclipse.jdt.core/5666.java | 25accbfb9b4c42ff960b4e4cd95e27ba2e87122b | [
"MIT"
] | permissive | zhendong2050/fse18 | edbea132be9122b57e272a20c20fae2bb949e63e | f0f016140489961c9e3c2e837577f698c2d4cf44 | refs/heads/master | 2020-12-21T11:31:53.800358 | 2018-07-23T10:10:57 | 2018-07-23T10:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,110 | java | /*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.core.search.matching;
import org.eclipse.jdt.internal.compiler.ast.*;
public class VariableLocator extends PatternLocator {
protected VariablePattern pattern;
public VariableLocator(VariablePattern pattern) {
super(pattern);
this.pattern = pattern;
}
public int match(Expression node, MatchingNodeSet nodeSet) {
// interested in Assignment
if (this.pattern.writeAccess) {
// already checked the lhs in match(Reference...) before we reached here
if (this.pattern.readAccess)
return IMPOSSIBLE_MATCH;
if (node instanceof Assignment) {
Expression lhs = ((Assignment) node).lhs;
if (lhs instanceof Reference)
return matchReference((Reference) lhs, nodeSet, true);
}
} else if (this.pattern.readAccess || this.pattern.fineGrain != 0) {
if (node instanceof Assignment && !(node instanceof CompoundAssignment)) {
// the lhs of a simple assignment may be added in match(Reference...) before we reach here
// for example, the fieldRef to 'this.x' in the statement this.x = x; is not considered a readAccess
char[] lastToken = null;
Expression lhs = ((Assignment) node).lhs;
if (lhs instanceof QualifiedNameReference) {
char[][] tokens = ((QualifiedNameReference) lhs).tokens;
lastToken = tokens[tokens.length - 1];
}
if (lastToken == null || matchesName(this.pattern.name, lastToken)) {
nodeSet.removePossibleMatch(lhs);
nodeSet.removeTrustedMatch(lhs);
}
}
}
return IMPOSSIBLE_MATCH;
}
public int match(Reference node, MatchingNodeSet nodeSet) {
// interested in NameReference & its subtypes
return (this.pattern.readAccess || this.pattern.fineGrain != 0) ? matchReference(node, nodeSet, false) : IMPOSSIBLE_MATCH;
}
protected int matchReference(Reference node, MatchingNodeSet nodeSet, boolean writeOnlyAccess) {
if (node instanceof NameReference) {
if (this.pattern.name == null) {
return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
} else if (node instanceof SingleNameReference) {
if (matchesName(this.pattern.name, ((SingleNameReference) node).token))
return nodeSet.addMatch(node, POSSIBLE_MATCH);
} else {
QualifiedNameReference qNameRef = (QualifiedNameReference) node;
char[][] tokens = qNameRef.tokens;
if (writeOnlyAccess) {
// in the case of the assigment of a qualified name reference, the match must be on the last token
if (matchesName(this.pattern.name, tokens[tokens.length - 1]))
return nodeSet.addMatch(node, POSSIBLE_MATCH);
} else {
for (int i = 0, max = tokens.length; i < max; i++) if (matchesName(this.pattern.name, tokens[i]))
return nodeSet.addMatch(node, POSSIBLE_MATCH);
}
}
}
return IMPOSSIBLE_MATCH;
}
public String toString() {
//$NON-NLS-1$
return "Locator for " + this.pattern.toString();
}
}
| [
"tim.menzies@gmail.com"
] | tim.menzies@gmail.com |
5478a52e9f2babaedf752d2b7885f85d73363c09 | 2fc285f32155069c1349ba2d25782bf45ecc919c | /kopo39/Hong Class/L06/p10_2.java | 53c60a886ef354df8b0c6e68b8ad4539cf80efe7 | [
"MIT"
] | permissive | jyuna622/Kopo39_EclipseBackup | 39650e39caa31486ed17160ecf224ba0c706d61b | 9f137145814c79feef4d2379e41888db0e025bc1 | refs/heads/main | 2023-05-08T17:55:02.642089 | 2021-06-03T05:33:00 | 2021-06-03T05:33:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package L06;
public class p10_2 {
//클래스 메소드는 아귀먼트(argment,매개변수) 형식이나 갯수가 다르면 이름은 동일하게 사용하여 편리하게 사용할 수 있는데,
//이따위 짓을 메소드 오버로딩(Overloading)이라 한다.
public int k39_sum (int a, int b) {//2개형 덧셈 메소드
return a+b;//a+b을 계산해줌
}
public int k39_sum (int a, int b, int c) {//3개형 덧셈 메소드
return a+b+c;//a+b+c을 계산해줌
}
public int k39_sum (int a, int b, int c, int d) {//4개형 덧셈 메소드
return a+b+c+d;//a+b+c+d을 계산해줌
}
public double k39_sum (double a, double b) {//더블형 덧셈 메소드
return a+b;//a+b을 계산해줌
}
}
| [
"jyuna622@gmail.com"
] | jyuna622@gmail.com |
967c1dbd16a9a0d87c93b40471685447e2d0ae71 | 943daeaf9021923d3b9f7007f75bdaa00c01c77e | /conference-microservice/gateway/src/main/java/com/mynotes/demo/jhipster/config/DateTimeFormatConfiguration.java | e5f2a99f48373c869beea8f36f81e5dcec839cda | [] | no_license | dhananjay12/learn-jhipster | 9d0a994f0e4941a535c2e75b620605c3eb1e9386 | 349e85d5156d00a3e7a25f88b3f70788b205a689 | refs/heads/main | 2023-03-01T22:13:38.797350 | 2021-02-06T23:21:45 | 2021-02-06T23:21:45 | 334,247,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package com.mynotes.demo.jhipster.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.web.reactive.config.WebFluxConfigurer;
/**
* Configure the converters to use the ISO format for dates by default.
*/
@Configuration
public class DateTimeFormatConfiguration implements WebFluxConfigurer {
@Override
public void addFormatters(FormatterRegistry registry) {
DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
registrar.setUseIsoFormat(true);
registrar.registerFormatters(registry);
}
}
| [
"dhananjay1204@gmail.com"
] | dhananjay1204@gmail.com |
0e507720e712b499ac75094e4179c3cb89fb4e68 | 328970ce1df915b3021359267f2fbe653359fc37 | /Leetcode/problems/Heap/451_SortCharactersByFrequency_2.java | dde8ac3a11f74de5c93d264c367b3b6b4b4e760e | [] | no_license | baiyue12138/leetcode | 997f060115874eb37035c470b7c375948af4ce67 | 8e0f96eeb07f20d94eb5000baaad67228b6a5a36 | refs/heads/master | 2020-06-21T00:30:37.275823 | 2019-07-17T02:46:31 | 2019-07-17T02:46:31 | 190,007,358 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,082 | java | class Solution {
/**
1.维持一个长度为k的大顶堆,
**/
public String frequencySort(String s) {
if(s.length()==0||s==null){
return "";
}
Map<Character,Integer>map=new HashMap<>();
for(int i=0;i<s.length();i++){
if(map.containsKey(s.charAt(i))){
map.put(s.charAt(i),map.get(s.charAt(i))+1);
}else{
map.put(s.charAt(i),1);
}
}
//建堆
PriorityQueue<Character> queue=new PriorityQueue<>(map.size(),new Comparator<Character>(){
public int compare(Character a,Character b){
return map.get(b)-map.get(a);
}
});
//插入数据
for(Character key:map.keySet()){
queue.add(key);
}
//输出数据
StringBuilder sb=new StringBuilder();
while(!queue.isEmpty()){
char c=queue.poll();
int num=map.get(c);
while(num>0){
sb.append(c);
num--;
}
}
return sb.toString();
}
} | [
"noreply@github.com"
] | noreply@github.com |
016304cad60914c023bc698e9009683ee9712bef | de6b62d9b3cc900f2fc4a71d6b4a6d5955aaeaef | /src/com/atguigu/bookstore/dao/TradeDAO.java | c2cc456d42853a50e26bf8f2acc1d7a99dbb5ac5 | [] | no_license | czbzgwd/bookstore_idea | ddf5865291df460d534d3b7c74e5fc7d4ed3364f | 59983a8c87905e8a5231b3a044b3074906a4b191 | refs/heads/master | 2020-08-08T00:49:11.219072 | 2019-11-10T12:26:57 | 2019-11-10T12:26:57 | 213,647,584 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 447 | java | package com.atguigu.bookstore.dao;
import java.util.Set;
import com.atguigu.bookstore.domain.Trade;
/**
*2019年1月7日上午11:08:33
*
*/
public interface TradeDAO {
/**
* 向数据表中插入 Trade 对象
* @param trade
*/
public abstract void insert(Trade trade);
/**
* 根据 userId 获取和其关联的 Trade 的集合
* @param userId
* @return
*/
public abstract Set<Trade> getTradesWithUserId(Integer userId);
}
| [
"goodMorning_glb@atguigu.com"
] | goodMorning_glb@atguigu.com |
a2b8ec2ea66e1ef4b327c80c47186d6ddd72b135 | 0935a4e57d48130a7fd3f1c412b7baa15ec30e2d | /src/formulator/FormulaElement.java | 65b16551dee858bc2a7ab0cc80cfb0813f1a596a | [] | no_license | sahan756/Formulaic | c40adc2b3eb6248e0d286b3eb0c4851fde893738 | c800610230cba9d9da148ffbea23260aacdb317b | refs/heads/master | 2021-01-10T22:06:34.410490 | 2014-07-31T22:56:00 | 2014-07-31T22:56:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,509 | java | package formulator;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
public class FormulaElement{
Vector<VariableElement> variableList;
// protected String type;
// public String getType(){
// return type;
// }
// double diffValue = 0.0000001;
// double firstDiff = 0;
public String toString() {
return this.toString();
}
public void setVariableValue(String varName, double value) {
this.setVariableValue(varName, value);
}
public void setVariableValue(double value) {
this.setVariableValue(value);
}
// public void setVariableValue(FormulaElement value) {
// this.setVariableValue(value);
// }
public double getVariableValue(String varName) {
return this.getVariableValue(varName);
}
public boolean isFullyGrounded(){
return this.isFullyGrounded();
}
public double evaluate(){
// double value = this.evaluate();
// this.firstDiff = this.evaluate(getVariableValue("x")+diffValue)-value;
// return value;
return this.evaluate();
}
public Vector<VariableElement> getVariableList(){
return this.getVariableList();
}
// public double getFirstDerivative(){
// return this.firstDiff;
// }
// public static void main(String[] args) {
//// FormulaElement formula = parseFormula("(X+2)(X-(Y^3+7)-7cos(2^X+5X))");
//// System.out.println(formula.toString());
////
//// formula.setVariableValue("X", 2);
//// formula.setVariableValue("Y", 3);
////
////// Vector<FormulaElement> args0 = ((FunctionElement)formula).getArgList();
//////
////// for (FormulaElement formulaElement : args0) {
////// System.out.println(formulaElement.getVariableValue("X"));
////// }
//// System.out.println("X = " + formula.getVariableValue("X"));
//// System.out.println("Y = " + formula.getVariableValue("Y"));
//// System.out.println("isGrounded? " + formula.isFullyGrounded());
//// System.out.println("Evaluate = " + formula.evaluate());
////
////// System.out.println(parseFormula("2X + 7cos(2Y)").toString());
////// System.out.println(parseFormula("cos(3X)/2^sin(X)").toString());
////// System.out.println(parseFormula("(X+2)(X-(Y^3+7)-7cos(2^X+5x))").toString());
////// System.out.println(parseFormula("(X+2)(Y-3)").toString());
////// System.out.println(parseFormula("X-Y").toString());
//
// FormulaElement formula = parseFormula("(x+2)(x+3)(x+2)");
// System.out.println(formula.toString());
// formula.setVariableValue("x", 5);
// //formula.setVariableValue("Y", 4);
// System.out.println("Evaluate = " + formula.evaluate());
// }
public static FormulaElement parseFormula(String text){
try {
text = text.replaceAll("\\s", ""); //Remove all white spaces
//String[] functionNames = {"cos", "sin"};
StringTokenizer tokenizer = new StringTokenizer(text, "+-/^()*", true);
Vector<String> pass0 = new Vector<String>();
Vector<Object> elements = new Vector<Object>();
//Add to list with Removed white spaces and split compound tokens
while(tokenizer.hasMoreTokens()){
String token = tokenizer.nextToken();
//System.out.println(token);
Vector<String> splits = splitCompund(token); //Split compound tokens e.g. 2X, 7cos
for (String split : splits) {
pass0.add(split);
}
}
// pass 1 - create constants and variables
elements = pass1(pass0);
elements = parseElements(elements); //recursive parser
// for (Object val : elements) {
// System.out.println(val.getClass().toString() + "\t" + val);
// }
if(elements.size() > 0){
return (FormulaElement)elements.get(0);
} else {
return null;
}
} catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
return null;
}
}
//parse elements within brackets recursively
public static Vector<Object> parseElements(Vector<Object> pass0) {
String[] keywords = {"sin", "cos"};
List<String> keywordList = Arrays.asList(keywords);
Vector<Object> elements = new Vector<Object>();
Vector<Object> subElements = new Vector<Object>();
int level = 0, removeStart = 0, removeEnd = 0;
boolean addElements = false, sine = false;;
for (int i = 0; i < pass0.size(); i++) {
Object object = pass0.get(i);
elements.add(object);
if(object.toString().matches("\\(")){
level++;
if (!addElements) {
addElements = true;
if(i>0 && keywordList.contains(pass0.get(i-1).toString())) sine = true;
removeStart = sine ? elements.size() : elements.size() - 1;
//removeStart = elements.size() - 1;
} else {
subElements.add(object);
}
} else if(object.toString().matches("\\)")){
level--;
if(level == 0){
addElements = false;
removeEnd = elements.size();
elements.subList(removeStart, removeEnd).clear();
elements.addAll(parseElements(subElements));
if(sine){
sine = false;
elements.add(")");
}
subElements.clear();
//break;
} else {
subElements.add(object);
}
} else if(addElements){
subElements.add(object);
}
}
// pass 4 - add power function
// Moved power function before mutiple, to avoid something like 3x^3 misinterpreted as (3x)^5
elements = pass4(elements);
// pass 2 - create multiple functions for constants and variables
elements = pass2(elements);
// pass 3 - create sine and cosine functions
// Used pass2 again to multiply something like 7cos(x)
elements = pass3(elements);
// // pass 4 - add power function
// elements = pass4(elements);
// pass 5 - divide function
elements = pass5(elements);
// pass 6 - plus and minus function
elements = pass6(elements);
// pass 7 - minus function
//elements = pass7(elements);
// for (Object val : elements) {
// System.out.println(val.getClass().toString() + "\t" + val);
// }
return elements;
}
//Split compound tokens e.g. 2X, 7cos
public static Vector<String> splitCompund(String text){
Vector<String> tokens = new Vector<String>();
if(text.matches("^(\\d+)(\\.?\\d+)?([a-zA-Z]+\\d*)$")){
String constant = text.split("([a-zA-Z]+\\d*)$")[0];
String variable = text.split("^(\\d+)(\\.?\\d+)?")[1];
//System.out.println(constant);
//System.out.println(variable);
tokens.add(constant);
tokens.add(variable);
} else {
tokens.add(text);
}
return tokens;
}
//Check if token is a word or not
public static boolean isWord(String token){
String[] keywords = {"sin", "cos"};
if(token.matches("^[^a-zA-Z]+")){
return false;
}
if(Arrays.asList(keywords).contains(token)){
return false;
}
return true;
}
//pass 1 - create constants and variables
private static Vector<Object> pass1(Vector<String> list){
Vector<Object> pass1 = new Vector<Object>();
for (String val : list) {
if(val.matches("^(\\d+)(\\.?\\d+)?")){
ConstantElement constant = new ConstantElement(Double.parseDouble(val));
pass1.add(constant);
} else if(isWord(val)){
VariableElement variable = new VariableElement(val);
pass1.add(variable);
} else {
pass1.add(val);
}
}
return pass1;
}
//pass 2 - create multiple functions for adjacent constants and variables
private static Vector<Object> pass2(Vector<Object> list) {
Object prevElement = null;
Vector<Object> pass2 = new Vector<Object>();
try {
for (int i = 0; i < list.size(); i++) {
Object val = list.get(i);
if (val instanceof FormulaElement
&& prevElement instanceof FormulaElement) {
MultipleFunctionElement multi = new MultipleFunctionElement();
multi.addArg((FormulaElement) prevElement);
multi.addArg((FormulaElement) val);
pass2.remove(pass2.size()-1);
pass2.add(multi);
val = multi;
} else {
pass2.add(val);
}
prevElement = val;
}
} catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
return null;
}
return pass2;
}
//pass 3 - create sine and cosine functions (Assuming simple formula element within '(' and ')')
private static Vector<Object> pass3(Vector<Object> list) {
Object prevElement = null;
Vector<Object> pass3 = new Vector<Object>();
try {
String[] keywords = {"sin", "cos"};
List<String> keywordList = Arrays.asList(keywords);
boolean inBracket = false;
for (int i = 0; i < list.size(); i++) {
Object val = list.get(i);
//System.out.println(val);
if(val.toString().matches("\\(") && keywordList.contains(prevElement) && list.get(i+1) instanceof FormulaElement){
inBracket = true;
pass3.remove(pass3.size()-1);
if(prevElement.toString().matches("sin")){
SineFunctionElement sin = new SineFunctionElement((FormulaElement)list.get(i+1));
pass3.add(sin);
} else if(prevElement.toString().matches("cos")){
FormulaElement elem = (FormulaElement)list.get(i+1);
CosineFunctionElement cos = new CosineFunctionElement(elem);
pass3.add(cos);
}
} else if(val.toString().matches("\\)") && inBracket){
inBracket = false;
continue;
} else if(!inBracket){
pass3.add(val);
}
prevElement = val;
}
pass3 = pass2(pass3); //apply multiple function after cosine or sine e.g 7cos(2x);
} catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
return null;
}
return pass3;
}
//Pass 4 - add power function
private static Vector<Object> pass4(Vector<Object> list) {
Object prevElement = null;
Vector<Object> pass4 = new Vector<Object>();
try {
boolean skipNext = false;
for (int i = 0; i < list.size(); i++) {
Object val = list.get(i);
if(skipNext){
skipNext = false;
continue;
}
if(val.toString().matches("\\^") && prevElement instanceof FormulaElement){
//System.out.println(val);
pass4.remove(pass4.size()-1);
skipNext = true;
PowerFunctionElement power = new PowerFunctionElement();
power.addArg((FormulaElement)prevElement);
power.addArg((FormulaElement)list.get(i+1));
pass4.add(power);
} else {
pass4.add(val);
}
prevElement = val;
}
} catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
return null;
}
return pass4;
}
//pass 5 - divide function
private static Vector<Object> pass5(Vector<Object> list) {
Object prevElement = null;
Vector<Object> pass5 = new Vector<Object>();
try {
boolean skipNext = false;
for (int i = 0; i < list.size(); i++) {
Object val = list.get(i);
if(skipNext){
skipNext = false;
continue;
}
if(val.toString().matches("\\/") && prevElement instanceof FormulaElement){
//System.out.println(val);
pass5.remove(pass5.size()-1);
skipNext = true;
DivideFunctionElement divide = new DivideFunctionElement();
divide.addArg((FormulaElement)prevElement);
divide.addArg((FormulaElement)list.get(i+1));
pass5.add(divide);
} else {
pass5.add(val);
}
prevElement = val;
}
} catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
return null;
}
return pass5;
}
//pass 6 - plus function
private static Vector<Object> pass6(Vector<Object> list) {
Object prevElement = null;
Vector<Object> pass6 = new Vector<Object>();
try {
boolean skipNext = false;
for (int i = 0; i < list.size(); i++) {
Object val = list.get(i);
if (skipNext) {
skipNext = false;
continue;
}
if (val.toString().matches("\\+")
&& prevElement instanceof FormulaElement) {
// System.out.println(val);
pass6.remove(pass6.size() - 1);
skipNext = true;
PlusFunctionElement plus = new PlusFunctionElement();
plus.addArg((FormulaElement) prevElement);
plus.addArg((FormulaElement) list.get(i + 1));
pass6.add(plus);
prevElement = plus;
continue;
}
else if (val.toString().matches("\\-")
&& prevElement instanceof FormulaElement) {
// System.out.println(val);
pass6.remove(pass6.size() - 1);
skipNext = true;
MinusFunctionElement minus = new MinusFunctionElement();
minus.addArg((FormulaElement) prevElement);
minus.addArg((FormulaElement) list.get(i + 1));
pass6.add(minus);
prevElement = minus;
continue;
}
else {
pass6.add(val);
}
prevElement = val;
}
} catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
return null;
}
return pass6;
}
}
| [
"insharp-mac-pro-1@Insharps-MacBook-Pro.local"
] | insharp-mac-pro-1@Insharps-MacBook-Pro.local |
12eb4cae2c41b53fd34dc766d6f5a7f430cb2d75 | 3c2d7cbeb8c28286c7433befd54e022c6b5b9fb0 | /SecretariaTrasparencia/src/main/java/com/ub/st/services/negocio/CoordinacionesGenerales.java | 290d71dbe4dfa0f83386894933ac324178e4429a | [
"MIT",
"Apache-2.0"
] | permissive | jofer95/Secretaria-Transparencia | f97f7e1908f2d5d05a28d1ce2b5ad9d4b40f7912 | ebff07325492e771363e6f2cdda442b93da5e040 | refs/heads/master | 2021-04-06T19:26:44.913505 | 2018-05-23T04:25:11 | 2018-05-23T04:25:11 | 125,178,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ub.st.services.negocio;
import com.ub.st.entities.negocio.CoordinacionGeneral;
import com.ub.st.managers.negocio.ManagerCoordinacionGeneral;
import com.ub.st.services.commons.ServiceFacade;
import javax.ws.rs.Path;
/**
* Servicios LCRUD para catálogo de coordinaciones generales
*
* @author Ulises Beltrán Gómez --- beltrangomezulises@gmail.com
*/
@Path("/coordinacionesGenerales")
public class CoordinacionesGenerales extends ServiceFacade<ManagerCoordinacionGeneral, CoordinacionGeneral, Integer> {
public CoordinacionesGenerales() {
super(ManagerCoordinacionGeneral.class);
}
}
| [
"jofer_bz20@hotmail.com"
] | jofer_bz20@hotmail.com |
4c06629d7d8d918d218f1427918b5cedc006f35d | c416517f9093e28a169c773c542922097034e299 | /src/main/java/br/embrapa/repository/filter/CadTipoDeVerificadorFilter.java | bdfb647902341a5bbb2134cb7a8426eab5a36562 | [] | no_license | carlosmeloti/mop-api-pg | c5d9701c5bb24060f0459cc8712376830f860aa3 | 00aeefca7d78cbf6c3c5fdd0fc39f9fdb4ebf5bf | refs/heads/master | 2023-07-17T17:16:56.334796 | 2021-08-27T12:03:50 | 2021-08-27T12:03:50 | 370,042,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package br.embrapa.repository.filter;
public class CadTipoDeVerificadorFilter {
private String nmTipoDeVerificador;
private Long cdTipoDeVerificador;
public Long getCdTipoDeVerificador() {
return cdTipoDeVerificador;
}
public void setCdTipoDeVerificador(Long cdTipoDeVerificador) {
this.cdTipoDeVerificador = cdTipoDeVerificador;
}
public String getNmTipoDeVerificador() {
return nmTipoDeVerificador;
}
public void setNmTipoDeVerificador(String nmTipoDeVerificador) {
this.nmTipoDeVerificador = nmTipoDeVerificador;
}
}
| [
"carlosmeloti@gmail.com"
] | carlosmeloti@gmail.com |
9cea8a7a9d96c2c5f2c5601f273d65a86d0b7823 | 730f473dc130e07ff85cee53bc7a38298fe6608e | /src/test/java/com/cursor/cursor_hw18/CursorHw18ApplicationTests.java | 2ef6e9374e109fa6c94ed779751f8f3fccece6ef | [] | no_license | tupchiienko/Cursor_HW18 | ede83308230b970ad3c838ed394d5f9a755eb286 | 2594acd603d3868b920d21dc90ea719c62a64a2e | refs/heads/master | 2023-05-08T06:11:07.712584 | 2021-05-28T20:02:54 | 2021-05-28T20:02:54 | 371,807,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 227 | java | package com.cursor.cursor_hw18;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CursorHw18ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"vt.progr@gmail.com"
] | vt.progr@gmail.com |
008db5f445fc8622ac52cbe710d2f8bb676edd6e | 5baddcec0099b1a42348df384dad936881a0d113 | /src/main/java/com/appunite/guestbook/MainActivity.java | 6446d703f5ef508a64b69643be62dcca924905b4 | [] | no_license | m-zagorski/guestbook | b2a838905a193c52f4213f1212861c807bcdf77a | 76c31258261282c809057b6dc64c1c66ada9d77e | refs/heads/master | 2021-01-01T17:57:46.612345 | 2014-03-14T15:36:55 | 2014-03-14T15:36:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,000 | java | package com.appunite.guestbook;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
public class MainActivity extends BaseActivity {
private static final String LOGIN_FRAGMENT = "login_fragment";
/**
* Because when activity is recreated there are called onCreate and
* onNewIntent. We have to ignore second call to omit twice view creation.
*/
private boolean mIgnoreFirstIntent = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
if (savedInstanceState != null) {
mIgnoreFirstIntent = true;
}
final Intent intent = getIntent();
activate(intent, savedInstanceState);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (mIgnoreFirstIntent) {
mIgnoreFirstIntent = false;
return;
}
setIntent(intent);
int flags = intent.getFlags();
if ((flags & Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
activate(intent, null);
}
}
private void activate(Intent intent, Bundle savedInstanceState) {
if (savedInstanceState == null) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
getFragment(ft, intent);
ft.commit();
}
}
private void getFragment(FragmentTransaction ft, Intent intent) {
String action = intent.getAction();
if (AppConsts.ACTION_SHOW_ENTRIES.equals(action)) {
clearBackStack();
Fragment fragment = EntriesFragment.newInstance();
ft.replace(R.id.main_content, fragment);
} else if (AppConsts.ACTION_SHOW_LOGIN.equals(action)) {
Fragment fragment = LoginFragment.newInstance();
ft.replace(R.id.main_content, fragment, LOGIN_FRAGMENT);
ft.addToBackStack(null);
} else if (AppConsts.ACTION_SHOW_EMAIL_LOGIN.equals(action)) {
Fragment fragment = EmailLoginFragment.newInstance();
ft.replace(R.id.main_content, fragment);
ft.addToBackStack(null);
} else if (AppConsts.ACTION_SHOW_SIGNUP.equals(action)) {
Fragment fragment = SignupFragment.newInstance();
ft.replace(R.id.main_content, fragment);
ft.addToBackStack(null);
} else if (AppConsts.ACTION_SHOW_SETTINGS.equals(action)) {
Fragment fragment = EditProfileFragment.newInstance();
ft.replace(R.id.main_content, fragment);
ft.addToBackStack(null);
} else if (AppConsts.ACTION_SHOW_NEW_ENTRY.equals(action)) {
Fragment fragment = NewEntryFragment.newInstance();
ft.replace(R.id.main_content, fragment);
ft.addToBackStack(null);
} else {
throw new RuntimeException("Unknown action: " + action);
}
}
private void clearBackStack() {
FragmentManager fm = getSupportFragmentManager();
for(int i=0; i< fm.getBackStackEntryCount(); i++){
fm.popBackStack();
}
}
@Override
public void onBackPressed() {
FragmentManager fm = getSupportFragmentManager();
if (fm.getBackStackEntryCount() != 0) {
fm.popBackStack();
} else {
this.finish();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Fragment fragment = getSupportFragmentManager().findFragmentByTag(LOGIN_FRAGMENT);
if (fragment != null) {
fragment.onActivityResult(requestCode, resultCode, data);
}
}
}
| [
"mateusz.zagorski@appunite.com"
] | mateusz.zagorski@appunite.com |
b7c3adb9bd7f8486da19a7e7519b5e72a68d7a88 | e71c07d99ae38bf197da2f2202233656e652b4fa | /src/test/java/cn/tedu/store/service/UserServiceTestCase.java | e7b3510547086e140e94a86104a7451b4e3a8d24 | [] | no_license | CREATEUNKNOWN/tedustore | 21b972e988a06e578c5790fa83ce04e9746b8af0 | 9e59efbc6cff331d2eb71a6646d40fe036019f4a | refs/heads/master | 2020-05-28T13:33:31.964933 | 2019-04-29T12:46:01 | 2019-04-29T12:46:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,461 | java | package cn.tedu.store.service;
import cn.tedu.store.entity.User;
import cn.tedu.store.service.ex.ServiceException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class UserServiceTestCase {
@Autowired
private IUserService service;
@Test
public void reg() {
try {
User user = new User();
user.setUsername("ChengHeng");
user.setPassword("8888");
user.setPhone("13800138007");
user.setEmail("chengheng@tedu.cn");
user.setGender(1);
user.setAvatar("http://www.tedu.cn/logo.png");
service.reg(user);
System.err.println("OK.");
} catch (ServiceException e) {
System.err.println(e.getMessage());
}
}
@Test
public void login() {
try {
String username = "rest";
String password = "1234";
User user = service.login(username, password);
System.err.println(user);
} catch (ServiceException e) {
System.err.println(e.getMessage());
}
}
@Test
public void changePassword() {
try {
Integer uid = 6;
String oldPassword = "8888";
String newPassword = "1234";
service.changePassword(uid, oldPassword, newPassword);
System.err.println("OK.");
} catch (ServiceException e) {
System.err.println(e.getMessage());
}
}
@Test
public void changeInfo() {
try {
User user = new User();
user.setUid(50);
user.setGender(0);
user.setPhone("88888888");
user.setEmail("tedu@qq.com");
service.changeInfo(user);
System.err.println("OK.");
} catch (ServiceException e) {
System.err.println(e.getMessage());
}
}
@Test
public void changeAvatar() {
try {
Integer uid = 6;
String avatar = "123456";
service.changeAvatar(uid, avatar);
System.err.println("OK.");
} catch (ServiceException e) {
System.err.println(e.getMessage());
}
}
@Test
public void getByUid() {
Integer uid = 5;
User user = service.getByUid(uid);
System.err.println(user);
}
}
| [
"799597505@qq.com"
] | 799597505@qq.com |
4931f0f5cc25a2b7008b74701ffc92bbedd1d95a | 8df67727105889525b05840ce2e9d0cebd03cb41 | /TwitterStatsApp/src/main/java/com/ringort/dataprovider/AbstractProvider.java | a1eecf37410bce3fe674e40bdf369bed14e29a10 | [] | no_license | eyalrin/TwitterStatsApp | d4944d2d8ce1ad5bdbb302339a0476e80a7db563 | e017899e50806f4df6cb6dcb8c54875aed74aaf6 | refs/heads/master | 2023-03-24T02:31:13.939144 | 2021-03-21T12:08:14 | 2021-03-21T12:08:14 | 349,987,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,275 | java | package com.ringort.dataprovider;
import com.google.common.collect.Lists;
import com.twitter.hbc.core.endpoint.Location;
import javafx.util.Pair;
import java.util.*;
public abstract class AbstractProvider {
protected Map<String, Pair<Location.Coordinate, Location.Coordinate>> citiesCoordinates;
private long odd;
private long even;
public AbstractProvider() {
// Note - can be replaced with an external source lke google maps, used consts for simplicity
citiesCoordinates = new HashMap<>();
citiesCoordinates.put("San Francisco", new Pair<>(new Location.Coordinate(-122.75, 36.8), new Location.Coordinate(-121.75, 37.8)));
citiesCoordinates.put("New York", new Pair<>(new Location.Coordinate(-74, 40), new Location.Coordinate(-73, 41)));
citiesCoordinates.put("Chicago", new Pair<>(new Location.Coordinate(-88.41, 41), new Location.Coordinate(-86.87, 42.21)));
}
public abstract void startReading(List<String> cities);
public void handleText(Object text) {
if (text != null) {
String tweetText = text.toString();
if (tweetText != null && tweetText.length() > 0) {
StringTokenizer tokens = new StringTokenizer(tweetText);
if (tokens.countTokens() % 2 == 0) {
even++;
} else {
odd++;
}
}
}
}
public float calcPercentage() {
if (even > 0 || odd > 0) {
long total = even + odd;
return ((float) odd / ((float) total)) * 100;
}
return 0;
}
public void printPercentage() {
float percentage = calcPercentage();
System.out.println(String.format("\nOdd percentage: %.2f", percentage));
}
protected ArrayList<Location> getLocations(List<String> selectedLocations) {
ArrayList<Location> locations = Lists.newArrayList();
for (String selectedLocation : selectedLocations) {
Pair<Location.Coordinate, Location.Coordinate> pair = citiesCoordinates.get(selectedLocation);
if (pair != null) {
locations.add(new Location(pair.getKey(), pair.getValue()));
}
}
return locations;
}
}
| [
"ringort@gmail.com"
] | ringort@gmail.com |
fe6b3f15b67b8c363c69d862d5063bf8b81608a9 | 8173e35f72964d4dcc4853d6efdb9f8abf87992e | /src/main/java/com/levenshtein/leven/cli/Cli.java | 509f7b9cbfe0359ff37c8656d0b45fd14649eced | [] | no_license | coatespt/Fast-Levenshtein-Distance | 38987018400bc1a48101f6c4f89313cdbc94f9a4 | 501abde07ef831ac1a0d2d19f0cd7dc36e88cda6 | refs/heads/master | 2022-06-03T19:06:24.905765 | 2021-10-11T20:19:51 | 2021-10-11T20:19:51 | 2,438,867 | 3 | 0 | null | 2022-05-20T20:47:12 | 2011-09-22T17:45:36 | Java | UTF-8 | Java | false | false | 31,503 | java | package com.levenshtein.leven.cli;
import com.levenshtein.leven.*;
import com.levenshtein.leven.demo.SHA256Compressor;
import utilities.file.FileAndTimeUtility;
import java.io.Console;
import java.io.FileInputStream;
import java.util.*;
import static java.lang.Integer.valueOf;
/**
* Command Line Interface
* This program runs in standard Unix pipeline style, accepting CSV input from either a
* file or from standard-in and writing output to standard-in allowing the input to be
* directed to a file or piped into another program as input.
* <p>
* Compression mode: takes list of files from filenames given on command line
* or one-by-one from stdin. The output is csv lines on stout. This output can be used
* as-written as the LD target file.
* <p>
* LD matching: Find matches to set of input files among a set of target signatures.
* The files are given as file names similarly to compression mode. The targets are read
* from precomputed CSV signature lines in a file. The CSV Signature lines are exactly
* the format of the compression-mode output.
Important errors or weaknesses
TODO: ScoreDistance has two versions of the getLDEst one of which isn't used in the real code. Get rid of it
and fix the test.
TODO: Factor the properties file and command line arguments code out to their own class that can
be shared with the StatisticsUtility class.
TODO significance is a scalar between [0,1] but it might make more sense to somehow separate the cases where the
differences seem to be concentrated. For instance, if a result is significant, do a second level that
does the computation on K-length blocks of the files, e.g. 1/4 or 1/10 the length of the larger, with the
smaller chopped into blocks of the same size (not the same number of blacks.) Return the global significance
as computed now, and also compute the block-ordering that gives the highest score e.g. total-sig, b1 c3, b4
c1, b3 c2, b2 Note that the final b had no matching c block.
TODO: Need to work out how to put a true confidence interval around an estimate.
Part of above, what are the mean and stdev for LD of unrelated text?
Use the tool to find a large number of pairs that are not related---score at the bottom of significance.
YOu probably need write a program to blindly chop off the first and last few hundred lines so there is no
boiler plate and leave a residuum of one fixed size.
TODO: Deal with zero-length signatures that may result from tiny files and big C values.
What it does now is is abort if the hash is empty.
Possible Enhancements
TODO: Compute a list of good compression and N values.
Right now we're detecting pairs of C and outchars.size() for which GCD does not equal one.
I've been always using primes for both.
TODO: Make it work for binary data. Need a hash that works for arbitrary characters, not just strings.
perhaps the Java string hash could be modified?
TODO: Should have option for input from pre-computed signatures similar to targets from file?
TODO: Implement multi-threading for the matching. Would probably increase throughput by several x.
Frank says this is low priority.
TODO: Implement multi-threading for compression. I considered a strategy of breaking an input into K pieces
then computing hashes for n characters on either side and stitching them together at the point where
the output for the Nth position. This would not be too hard but why not simply hand an entire file
to each thread? This is simpler and probably more efficient as it's easier to keep the input streaming for longer.
Note, the problem will almost never be how long it takes to process a single file because
a file so long that this was an issue would result in an unusable signature too long to run LD on.
So just multi-thread at an input file level.
TODO: Effective use requires that files be in bucket of similar size. Work out a command-line
pipeline to bucket files by size into overlapping buckets.
TODO: Cross matching. Break files into equal size pieces and do the LD estimates for the
components. This would allow files with areas with a high degree of similarity in a limited
region to be more readily recognized.
TODO: The significance is quite simple. Could there be a version of it that considers the
signatures piecemeal? Sort of like the scheme to do the signatures in sections?
TODO: Input from stdin has not been tested--only input from files of filenames.
TODO: Test with some other document types such as MS Word .doc files, PDF's, etc.
TODO: Develop a data set for matching accuracy as a function of N which has two big effects on accuracy:
(1) Small N is less sensitive to minor differences as each can bleed out to at most
N-1 characters in either direction.
(2) On the other hand small N results in a low cardinality of neighborhood hash values and thus
less pseudo-randomness in the signatures.
(3) Number (2) is probably true because if you have N=1, you definitely get a very lumpy distribution.
for N=2 there are 9000+ values, but many never occur. Is the number so large for reasonable size
N that it never really matters?
TODO: Index of Coincidence might be a good measure of signatures quality. See below this item.
TODO: A script to go through a set of input files or find all files below some point in the fs, and assign them to
buckets by size. This would go with an enhancement to scale the compression to the signature size.
You would probably need to generate multiple signatures to bracket the ideal size of the signature.
Each search sig would have to be generated in three sizes too.
So that's nine computations for each match.
The same signature sets could be used with multiple approaches. E.g. you could scan at highest compression,
find a match, then estimate at lowest compression IIF it's a good match.
* https://www.johndcook.com/blog/2021/08/14/index-of-coincidence/
* John Cook blog post on "index of coincidence" which is similar to Renyi entropy
* (not quite the same as Shannon entropy.)
* i.e. it is the negative log. This is of interest here because the index of coincidence of
* of a body of text is characteristic of a language. (Or so I understand.) It should be different
* for different human languages and different types of binary data. Investigate this.
*
https://towardsdatascience.com/non-negative-matrix-factorization-for-image-compression-and-clustering-89bb0f9fa8ee
*/
public class Cli {
static String ARG_DASHES = "-";
static int DEF_SB_SIZE = 1024;
static int MinBits=28;
static int MaxBits=36;
static int Seed=12345;
protected String[] argv = null;
protected String propsfile = null;
protected String infile = null;
protected int c = 0;
protected int n = 0;
protected String outChars;
protected boolean ld = false;
protected String targetFile = null;
protected double t = 0.0;
private ScoreDistance sd = null;
protected boolean printHeader=true;
protected boolean verbose = false;
protected int outputLevel = 0;
protected String hashType = "JAVA";
private boolean squeeze=true;
// ld smaller than equal-len file by this much
// TODO: Set this default to the best value we can compute
protected double fr=0.22d;
// ld smaller than equal-len signature by this much
// TODO: Set this default to a to the best value we can compute
protected double sr=0.30d;
/**
* You want C and the cardinality of the output set to be co-prime.
* @param a
* @param b
* @return
*/
private boolean isCoprime(int a, int b){
if (gcd(a,b)==1){
return true;
}
return false;
}
/**
* Recursively determine if C and the size of the output set are co-prime.
* @param a
* @param b
* @return
*/
public int gcd(int a, int b) {
if (b==0) {
return a;
}
return gcd(b,a%b);
}
/**
* A CLI gets all it's setup via command-line arguments but you can
* set up automated tests by constructing argv list explicitly.
* @param argv An array of strings in the usual command-line form.
*/
public Cli(String[] argv) {
// If config or the cmd line does not set it, everything uses the default set
outChars=ICompressor.getChars();
this.argv = argv;
}
public static void main(String[] argv) {
Cli cli = new Cli(argv);
cli.go();
}
/**
* Main driver of CLI.
* <p>Get the arguments</p>
* <p>If a properties file is specified, read them
* properties setting instance values</p>
* <p>Read the rest of the command line arguments. CL arguments
* that set values already found int properties file override them.</p>
* <p>If -ld=true it's an LD computation. Otherwise it's compression.</p>
* <p>Print the output as CSV</p>
* <p>Compression output can be used as target input for LD.</p>
* <p>Both compression and LD will accept input from standard in if an
*/
public int go() {
try {
parseArgs(argv);
ICompressor.setSqueezeWhite(squeeze);
if (!isCoprime(c, outChars.length())){
System.err.println("Warning, c=" + c + " and outchars.length()=" + outChars.length() + " are not mutually-prime.");
if(quit()) {
System.exit(0);
}
System.err.println("Warning, continuing despite conflict!");
}
} catch (Exception x) {
failure("Failed getting arguments or properties.", x);
}
if (ld) {
try {
ScoreDistance.setSigRatio(sr);
ScoreDistance.setWholeFileRatio(fr);
sd = new ScoreDistance();
doLdComparisons();
} catch (Exception x) {
failure("Failed doing LD.", x);
}
} else {
try {
compression();
} catch (Exception x) {
failure("Failed doing compression.", x);
}
}
return 0;
}
// TODO: Always quit? Definitely for initialization failures but do you want to
// quit if one comparison blows up?
private void failure(String err, Exception x) {
System.err.println(err);
x.printStackTrace();
System.exit(1);
}
/**
* Read the list of targets into a data structure you can scan.
* <p>
* The file of signatures should have the same format as the
* output of compress.
* <p>
* Then accept filenames as input. Create a signature for each input
* file and test it against all of the targets.
* <p>
* The input can be either from a file or from standard in.
* <p>
*/
protected void doLdComparisons() throws Exception {
if(verbose) {
System.err.println(LDResult.outputLine());
}
if (printHeader) {
System.out.println(LDResult.header(outputLevel));
}
List<FileSignature> targets = getSigList(targetFile);
int inputFileCount=0;
if (infile == null) {
// Input expected from the command line
Scanner scanner = new Scanner(System.in);
String instr = null;
while ((instr = scanner.nextLine()) != null) {
inputFileCount++;
List<LDResult> ldResults = getLDResults(instr, targets, t);
printLDResults(ldResults);
}
scanner.close();
} else {
// input from file
List<String> fsList = FileAndTimeUtility.readListFromFile(infile);
// run each input file against all targets.
for (int i = 0; i < fsList.size(); i++) {
inputFileCount++;
String file=fsList.get(i).trim();
if(file.equals("")){
continue;
}
List<LDResult> ldResults = getLDResults(fsList.get(i), targets, t);
if (verbose) {
System.err.println("File search " + (i + 1) + " " + file + " complete.");
}
printLDResults(ldResults);
}
if (verbose) {
System.err.println("Input files:" + inputFileCount);
System.err.println("Target files:" + targets.size());
}
}
if (verbose) {
printMMStdev(ldrSigs);
}
}
/**
* Statistics about unrelated matches. Note in output that they are extremely low.
* @param lst
*/
private void printMMStdev(List<Double> lst) {
System.err.println("The significance computed for unrelated files should be small, with low variance.");
double accum = 0;
for (int i = 0; i < lst.size(); i++) {
accum = accum + lst.get(i);
}
double mean = accum / lst.size();
double ssd = 0;
for (int i = 0; i < lst.size(); i++) {
double diff = mean = lst.get(i);
ssd = ssd + (diff * diff);
}
double var = ssd / lst.size();
double stdev = Math.sqrt(var);
StringBuffer sb = new StringBuffer();
sb.append("\n\n");
sb.append("Significance mean:");
sb.append((int) (mean * 10000)/10000d);
sb.append(" variance:");
sb.append((int) (var * 10000)/10000d);
sb.append(" stdev:");
sb.append((int) (stdev * 10000)/10000d);
sb.append(" unrelated sig comparisons: ");
sb.append(lst.size());
sb.append(" matches:");
sb.append(matchedSigCount);
sb.append(" total comparisons:");
sb.append(sd.getTotalLDCalls());
System.err.println(sb.toString());
}
/**
Print all the items in a list of results as CSV
<p>
TODO: Put a flag in properties for suppressing printing the signatures, etc.
*/
protected void printLDResults(List<LDResult> lst) {
for (int i = 0; i < lst.size(); i++) {
System.out.println(lst.get(i).toShortCsvString(outputLevel));
}
}
static List<Double> ldrSigs = new ArrayList<Double>();
static int matchedSigCount=0;
/**
* Get a list of matches for a single input subject to filtering by the
* significance criterion, t.
*
* @param infile the file-spec of a file to process against the target signatures
* @param targets a list of target signatures read in once
* @param t a significance criterion the nature of which is TBD
* @return
* @throws Exception
*/
protected List<LDResult> getLDResults(String infile, List<FileSignature> targets,
double t) throws Exception {
FileSignature fsi = fileSignatureFromFilename(infile);
List<LDResult> ldResults = new ArrayList<LDResult>();
for (int j = 0; j < targets.size(); j++) {
FileSignature fst = targets.get(j);
int rawLd = sd.getLD(fsi.getSig(), fst.getSig());
int expectedForRandom =
sd.expectedDistanceForSigs(fsi.getSig().length(), fst.getSig().length());
int est =
sd.getLDEst(fsi,fst, rawLd);
LDResult ldr = new LDResult(
infile, fst.getInputFname(),
fsi.getInputFileLen(), fst.getInputFileLen(),
fsi.getSig(), fst.getSig(),
rawLd, expectedForRandom, est,
fsi.getC(), fsi.getN(), fsi.getcSet());
SignificanceResult sdr = sd.significant(ldr, t, rawLd);
if (sdr.getSignificnt()){
matchedSigCount++;
ldr.setSignificance(sdr.getComputedSignificane());
ldr.setT(sdr.getX());
ldResults.add(ldr);
if (verbose) {
System.err.println(sdr.toString());
}
}
else {
// only care about stats for unrelated file LD's
ldrSigs.add(sdr.getComputedSignificane());
}
}
return ldResults;
}
/**
* Set up a set of target-file signatures to search for each line of input.
*
* @return A list of FileSignature objects.
* @throws Exception if no file, can't read it, malformed, etc.
*/
protected List<FileSignature> getSigList(String targetFile) throws Exception {
if (targetFile == null) {
String err = "No file of targets signatures given.";
throw new Exception(err);
}
List<FileSignature> sigList = new ArrayList<FileSignature>();
List<String> csvStrings = FileAndTimeUtility.readListFromFile(targetFile);
for (int i = 0; i < csvStrings.size(); i++) {
String csvLine = csvStrings.get(i).trim();
if (csvLine.length()>8) {
// uncomment this to find a defective line.
//System.err.println("target:" + i);
try {
sigList.add(new FileSignature(csvLine));
}
catch(Exception x){
System.err.println("Signature read failed line:" + i + " Empty sig field? Malformed? " + csvLine);
}
}
else {
System.err.println("Something fishy in the signature list." +
"at line:" + Integer.toString(i) + ". Blank line?");
}
}
return sigList;
}
/**
* If there's an input file, read it and process all the files, otherwise expect
* input from standard in.
*/
protected void compression() throws Exception {
if (infile == null) {
Scanner scanner = new Scanner(System.in);
String instr = null;
while ((instr = scanner.nextLine()) != null) {
fileSignatureFromFilename(instr).compressionOutput(DEF_SB_SIZE);
}
scanner.close();
}
else if (FileAndTimeUtility.isFileExist(infile)) {
try {
List<String> fnames = FileAndTimeUtility.readListFromFile(infile);
for (int i = 0; i < fnames.size(); i++) {
String fn = fnames.get(i);
try {
fileSignatureFromFilename(fn).compressionOutput(DEF_SB_SIZE);
}
catch(Exception x){
System.err.println("Failed reading input file:" + fn + " msg:" + x.getMessage());
continue;
}
}
} catch (Exception x) {
System.err.println("Failed for unknown reason:" + infile + " msg:" + x.getMessage());
}
} else {
System.err.println("Input file for compression does not exist:" + infile);
}
}
/**
* Creaqte a FileSignature object for the named infile.
* @param fname The filespec of an input file.
* @return A FileSignature object
* @throws Exception
*/
protected FileSignature fileSignatureFromFilename(String fname) throws Exception {
String contents = FileAndTimeUtility.getFileContents(fname);
String sig = getCompressor(hashType).compress(contents);
return new FileSignature(fname,contents.length(),hashType,c,n,outChars,sig);
}
protected ICompressor compressor = null;
protected ICompressor getCompressor(String type) throws Exception{
if(type.equals("XOR")) {
if (compressor == null) {
compressor = new StringCompressorRH(n, c, ICompressor.StringToCharArray(outChars), MinBits, MaxBits, Seed);
compressor.setN(n);
compressor.setC(c);
//System.err.println("charset = " + outChars);
}
return compressor;
}
else if(type.equals("JAVA")){
if (compressor == null) {
compressor = new StringCompressorPlainJava(n, c, ICompressor.StringToCharArray(outChars));
}
return compressor;
}
else if(type.equals("SHA-256")){
if (compressor == null) {
compressor = new SHA256Compressor(n, c, ICompressor.StringToCharArray(outChars));
compressor.setN(n);
compressor.setC(c);
}
return compressor;
}
else throw new Exception("Unknown compressor type:" + type);
}
//////////////////////////////////////////
//////////////////////////////////////////
//// Just argument stuff below here /////
//////////////////////////////////////////
//////////////////////////////////////////
/**
* First read the properties file if one is specified, then parse
* the command line arguments overriding anything found in properties
* or set beforehand as a default.
*
* @param argv The usual String[] for command line args.
* @throws Exception
*/
public void parseArgs(String[] argv) throws Exception {
if (argv.length % 2 != 0) {
format();
System.exit(1);
}
for (int i = 0; i < argv.length; ) {
String a = argTrim(argv[i]);
String v = argTrim(argv[i + 1]);
//System.err.println("parameter: " + a + " argument: " + v);
if (a.equals("p")) {
propsfile = v;
try {
readPropsFile(propsfile);
} catch (Exception e) {
e.printStackTrace();
}
} else if (a.equals("f")) {
infile = v;
} else if (a.equals("c")) {
c = Integer.parseInt(v);
} else if (a.equals("n")) {
n = Integer.parseInt(v);
} else if (a.equals("ch")) {
outChars = v;
ICompressor.setChars(outChars);
}
else if (a.equals("ld")) {
v=v.toLowerCase(Locale.ROOT);
if (v.equals("true")) {
ld=true;
}
if(v.equals("false")){
ld=false;
}
}
else if (a.equals("ft")) {
targetFile = v;
}
else if (a.equals("t")) {
t = Double.parseDouble(v);
}
else if (a.equals("v")) {
verbose = Boolean.parseBoolean(v);
}
else if (a.equals("h")) {
printHeader = boolFromString(v);
}
else if (a.equals("ol")){
outputLevel = Integer.parseInt(v);
if (outputLevel<0 || outputLevel>3) {
String err = "Output level must be in range 0:3";
throw new Exception(err);
}
}
else if (a.equals("ht")){
hashType=v;
}
else if (a.equals("sr")) {
// ld this much less than equal len sig
sr = Double.parseDouble(v);
System.err.println("sr=" + sr);
}
else if (a.equals("fr")) {
// LS this much less than equal len file
fr = Double.parseDouble(v);
System.err.println("fr=" + fr);
}
else if (a.equals("s")) {
// LS this much less than equal len file
squeeze = Boolean.parseBoolean(v);
System.err.println("s=" + fr);
}
else {
System.err.println("Unknown argument encountered:" + a);
}
i = i + 2;
}
}
/**
* Remove white space and any leading dash from argument flag.
* @param s
* @return
*/
public String argTrim(String s) {
s = s.trim();
if (s.startsWith(ARG_DASHES)) {
return s.substring(1, s.length());
}
return s;
}
/**
* Return a format string (in response to un-parsable arguments.)
*
* @return
*/
public String format() {
StringBuffer sb = new StringBuffer();
sb.append("-p <a properties file> Read in a properties file. Any values on the command.\n");
sb.append("-f <a file> input data would be a list of files names If -f is not not.\n");
sb.append("-c <an integer> compression rate.\n");
sb.append("-n <an integer> neighborhhod size.\n");
sb.append("-ch <char-string> output-char-set in the form of a string.\n");
sb.append("-ld true/false estimate mode.\n");
sb.append("-f <input-file-spec> is a csv file of the form output by the compression step.\n");
sb.append("-i <input-file-spec> is a csv file of one or more rows you are tyring to match.\n");
sb.append("-t is how different from the expected value the estimated LD has to be.\n");
sb.append("-v true/false suppress the informational ouput written to stderr.\n");
sb.append("-h true/false print the output file header.\n");
sb.append("-ol 0 to 3, Higher number gives fewer output fields. \n");
sb.append("-ht hash type XOR, JAVA, SHA-256. \n");
sb.append("-fr a float [0,1] that is the shrinkage factor for LD or unrelated text. \n");
sb.append("-sr a float [0.1] that is the shrinkage factor for LD of unrelated signatures. \n");
sb.append("-s a boolean. Squeeze all strings of whitespace into a single space character. \n");
return sb.toString();
}
// TODO: Properties stuff should go in another class.
/**
* Read the properties file and override any values specified there.
*
* @param pfile
*/
public void readPropsFile(String pfile) throws Exception {
Properties defaultProps = new Properties();
FileInputStream in = new FileInputStream(pfile);
defaultProps.load(in);
in.close();
if (getIntVal("c", defaultProps) != null) {
c = getIntVal("c", defaultProps);
}
if (getIntVal("n", defaultProps) != null) {
n = getIntVal("n", defaultProps);
}
if (getStringVal("f", defaultProps) != null) {
infile = getStringVal("f", defaultProps);
}
if (getStringVal("ch", defaultProps) != null) {
outChars = getStringVal("ch", defaultProps);
ICompressor.setChars(outChars);
}
if (getBoolVal("ld", defaultProps) != null) {
ld = getBoolVal("ld", defaultProps);
}
if (getStringVal("ft", defaultProps) != null) {
targetFile = getStringVal("ft", defaultProps);
}
if (getDoubleVal("t", defaultProps) != null) {
t = getDoubleVal("t", defaultProps);
}
if (getBoolVal("h", defaultProps) != null) {
printHeader = getBoolVal("h", defaultProps);
}
if (getBoolVal("v", defaultProps) != null) {
verbose = getBoolVal("v", defaultProps);
}
if (getIntVal("ol", defaultProps) != null) {
outputLevel = getIntVal("ol", defaultProps);
}
if (getStringVal("ht", defaultProps) != null) {
hashType = getStringVal("ht", defaultProps);
}
if (getDoubleVal("fr", defaultProps) != null) {
fr = getDoubleVal("fr", defaultProps);
System.err.println("sr=" + sr);
}
if (getDoubleVal("sr", defaultProps) != null) {
sr = getDoubleVal("sr", defaultProps);
System.err.println("sr=" + sr);
}
if (getBoolVal("s", defaultProps) != null) {
squeeze = getBoolVal("s", defaultProps);
}
}
private String getStringVal(String a, Properties props) throws Exception {
String aa = a.toLowerCase(Locale.ROOT);
Object ob = props.get(aa);
if(ob==null){
aa=a.toUpperCase(Locale.ROOT);
ob = props.get(aa);
}
if (ob == null) {
String err = "No " + a + " value in properties";
} else {
//System.err.println("Found " + a + " value in properties:" + ob);
return ((String) ob).trim();
}
return null;
}
private Boolean getBoolVal(String a, Properties props) throws Exception {
String aa = a.toLowerCase(Locale.ROOT);
Object ob = props.get(aa);
if(ob==null){
aa=a.toUpperCase(Locale.ROOT);
ob = props.get(aa);
}
if (ob == null) {
String err = "No " + a + " value in properties";
} else {
return boolFromString((String) ob);
}
return null;
}
private Boolean boolFromString(String str) throws Exception{
//System.err.println("Found " + a + " value in properties:" + props.get(a));
String arg = (str.trim().toLowerCase(Locale.ROOT));
if (arg.equals("true")){
return true;
}
else if (arg.equals("false")){
return false;
}
else {
String err = "getBoolVal() expecting a boolean but got:" + arg;
throw new Exception(err);
}
}
private Double getDoubleVal(String a, Properties props) throws Exception {
String aa = a.toLowerCase(Locale.ROOT);
Object ob = props.get(a);
if(ob==null){
aa=a.toUpperCase(Locale.ROOT);
ob = props.get(aa);
}
if (ob == null) {
String err = "No " + a + " value in properties";
} else {
//System.err.println("Found " + a + " value in properties:" + ob);
return Double.valueOf(((String) ob).trim());
}
return null;
}
private Integer getIntVal(String a, Properties props) throws Exception {
String aa=a.toLowerCase(Locale.ROOT);
Object ob = props.get(aa);
if (ob==null){
aa=a.toUpperCase(Locale.ROOT);
ob = props.get(aa);
}
if (ob == null) {
String err = "No " + a + " value in properties";
} else {
//System.err.println("Found " + a + " value in properties:" + ob);
return valueOf(((String) ob).trim());
}
return null;
}
/**
* Ask if they want to continue and warn if they say yes...
* @return
*/
private boolean quit() {
Console console = System.console();
if (console==null) {
return true;
}
String input = "";
System.out.print("Do you want to exit? Y/N: ");
while (!"Y".equalsIgnoreCase(input) || !"N".equalsIgnoreCase(input)) {
input = console.readLine();
if(input.length()>1){
input=input.substring(0,input.length()-1);
}
input=input.toUpperCase(Locale.ROOT);
if (input.startsWith("Y")) {
return true;
}
if (input.startsWith("N")) {
return false;
}
System.out.print("Do you want to exit? Y/N: ");
}
return false;
}
}
| [
"coatespt@gmail.com"
] | coatespt@gmail.com |
67447012cd296f53ddd871bb06106899f0e8d8d3 | 58bc2346e334d015961bcb0bf3b65125ce407e8b | /allDocsReader/src/main/java/com/zapps/docsReaderModule/officereader/filelist/FileNameDialog.java | c080d40d2d21d3ed4fa23d87a21cb7bec9d7896b | [] | no_license | ZeeshanHayat2020/HtmlViewer | e7eeeb0adc40dd9fed7aa1128d15fdee5718c652 | 17b81bf0c33d271982dd86eef5f9891c709c0b31 | refs/heads/master | 2023-04-25T23:18:38.293648 | 2021-06-09T10:47:08 | 2021-06-09T10:47:08 | 350,306,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,157 | java | /*
* 文件名称: FileNameDialog.java
*
* 编译器: android2.2
* 时间: 上午9:12:31
*/
package com.zapps.docsReaderModule.officereader.filelist;
import android.content.Context;
import android.content.res.Configuration;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.zapps.docsReaderModule.R;
import com.zapps.docsReaderModule.system.IControl;
import com.zapps.docsReaderModule.system.IDialogAction;
import com.zapps.docsReaderModule.system.beans.ADialog;
import java.util.Vector;
/**
* get file name
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: jhy1790
* <p>
* 日期: 2011-12-13
* <p>
* 负责人: jhy1790
* <p>
* 负责小组:
* <p>
* <p>
*/
public class FileNameDialog extends ADialog
{
/**
*
* @param context
* @param action
* @param model
* @param dialogID
* @param titleResID
*/
public FileNameDialog(IControl control, Context context, IDialogAction action, Vector<Object> model, int dialogID, int titleResID)
{
super(control, context, action, model, dialogID, titleResID);
init(context);
}
/**
*
*/
public void init(Context context)
{
int mWidth = getContext().getResources().getDisplayMetrics().widthPixels - MARGIN * 2;
//text viewt
textView = new TextView(context);
textView.setGravity(Gravity.TOP);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
params.leftMargin = GAP;
params.rightMargin = GAP;
params.topMargin = GAP;
params.bottomMargin = GAP;
params.gravity = Gravity.CENTER;
dialogFrame.addView(textView, params);
//edit file name
editText = new EditText(context);
editText.setGravity(Gravity.TOP);
editText.setSingleLine();
params = new LayoutParams(mWidth, LayoutParams.WRAP_CONTENT);
params.leftMargin = GAP;
params.rightMargin = GAP;
dialogFrame.addView(editText, params);
//ok, cancel
LinearLayout linearLayoutBtn = new LinearLayout(context);
linearLayoutBtn.setGravity(Gravity.CENTER);
linearLayoutBtn.setOrientation(LinearLayout.HORIZONTAL);
params = new LayoutParams(mWidth / 2, LayoutParams.WRAP_CONTENT);
ok = new Button(context);
ok.setText(R.string.sys_button_ok);
ok.setOnClickListener(this);
ok.setEnabled(false);
linearLayoutBtn.addView(ok, params);
cancel = new Button(context);
cancel.setText(R.string.sys_button_cancel);
cancel.setOnClickListener(this);
linearLayoutBtn.addView(cancel, params);
dialogFrame.addView(linearLayoutBtn);
}
/**
*
*
*/
public void onClick(View v)
{
}
/**
*
*
*/
public void doLayout()
{
int mWidth = getContext().getResources().getDisplayMetrics().widthPixels;
if (control.getSysKit().isVertical(getContext()))
{
mWidth -= MARGIN * 2;
}
else
{
mWidth -= MARGIN * 8;
}
//text view
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
params.leftMargin = GAP;
params.rightMargin = GAP;
params.topMargin = GAP;
params.bottomMargin = GAP;
textView.setLayoutParams(params);
// editText
params = new LayoutParams(mWidth, LayoutParams.WRAP_CONTENT);
params.leftMargin = GAP;
params.rightMargin = GAP;
editText.setLayoutParams(params);
// ok、cancel
params = new LayoutParams(mWidth / 2, LayoutParams.WRAP_CONTENT);
ok.setLayoutParams(params);
cancel.setLayoutParams(params);
}
/**
*
*
*/
public void onConfigurationChanged(Configuration newConfig)
{
doLayout();
}
/**
* 判断文件名是否合法
*
* @param fileName
* @return
*/
public boolean isFileNameOK(String fileName)
{
if (fileName == null || fileName.length() < 1 || fileName.length() > 255)
{
return false;
}
String invalidateChars = "\\/:*?\"<>|";
int len = invalidateChars.length();
int index = 0;
while(index < len)
{
if(fileName.indexOf(invalidateChars.charAt(index)) > -1)
{
return false;
}
index++;
}
return true;
}
/**
*
*/
public void dispose()
{
super.dispose();
editText = null;
textView = null;
}
//
protected TextView textView;
//
protected EditText editText;
}
| [
"zeeshanhayat61@gmail.com"
] | zeeshanhayat61@gmail.com |
5d56be718e74b8a96cd00bf41321eb5ca30988e9 | ef1fd9f2df722d280b8b941128be2e56972c3395 | /src/main/java/Main.java | a92ac233fc1a2511701f2ecf48be2a05f9f00410 | [] | no_license | Gliganu/DebateSite | ac275f58962cf7a6e80c2c4d9a2f99074129b443 | 452a094117c3162995064f9976d4a7599deba939 | refs/heads/master | 2021-01-10T17:33:08.909779 | 2015-12-06T21:43:45 | 2015-12-06T21:43:45 | 46,216,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,955 | java | import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.Session;
import org.hibernate.Query;
import org.hibernate.cfg.Configuration;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import java.util.Map;
/**
* Created by GligaBogdan on 15-Nov-15.
*/
public class Main {
private static final SessionFactory ourSessionFactory;
private static final ServiceRegistry serviceRegistry;
static {
try {
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
ourSessionFactory = configuration.buildSessionFactory(serviceRegistry);
} catch (Throwable ex) {
throw new ExceptionInInitializerError(ex);
}
}
public static Session getSession() throws HibernateException {
return ourSessionFactory.openSession();
}
public static void main(final String[] args) throws Exception {
final Session session = getSession();
try {
System.out.println("querying all the managed entities...");
final Map metadataMap = session.getSessionFactory().getAllClassMetadata();
for (Object key : metadataMap.keySet()) {
final ClassMetadata classMetadata = (ClassMetadata) metadataMap.get(key);
final String entityName = classMetadata.getEntityName();
final Query query = session.createQuery("from " + entityName);
System.out.println("executing: " + query.getQueryString());
for (Object o : query.list()) {
System.out.println(" " + o);
}
}
} finally {
session.close();
}
}
}
| [
"gligabogdanh@gmail.com"
] | gligabogdanh@gmail.com |
db7bc0cdfb36c26aed5718009010a0cfb99775ce | 14d5808bf7a36a316d014af9497594fa42ca93c1 | /patient/src/main/java/com/shkjs/patient/data/em/AgreeStatus.java | 39a9593d2626bc116015bb2634a761a45cf5b083 | [] | no_license | Soon-gz/MySecondDemo | 3baa004b58043034d64c817bf49c071f17cb7687 | 36546731f4aef99ae29a26611277f4ce11361e2c | refs/heads/master | 2023-02-21T11:28:32.261133 | 2017-01-24T02:28:30 | 2017-01-24T02:28:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package com.shkjs.patient.data.em;
/**
* 添加成员状态
*
* @author ZHANGYUKUN
*/
public enum AgreeStatus {
AGREEMENT("同意"), DISAGREE("不同意"), ASK("询问中");
private String mark;
AgreeStatus(String mark) {
this.mark = mark;
}
public String getMark() {
return mark;
}
}
| [
"sw201202@126.com"
] | sw201202@126.com |
bd2bbcf9314662ceb52d8ef6e77168fdb04b2c80 | 98676481389951daa6a29529a33205f51b004541 | /code/HelloWorld.java | 2dfc2c834152d3b1987f1a6bebaf9544a8e32bea | [
"MIT"
] | permissive | StefanoMartella/UnivaqThesisTemplate | d248e20ce9d83c4ce3ecddc6ccafd5d2e9d3e3ad | 3b3ac3ba0ca94a51be6bfd4408ade712209ae90d | refs/heads/master | 2022-11-21T19:54:56.369077 | 2020-07-26T17:02:38 | 2020-07-26T17:02:38 | 199,600,162 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 122 | java | public class HelloWorld {
public static void main (String[] args){
System.out.println("Hello Wolrd!");
}
} | [
"stefano.martella9614@gmail.com"
] | stefano.martella9614@gmail.com |
cf99eee50e4bdf09109fb5d27daf30bf2a506ff0 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-14227-13-3-NSGA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/XWikiHibernateBaseStore_ESTest_scaffolding.java | eca6f15aa7c092e9aab3c3dc1e8c53c3df882527 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Jan 18 17:55:24 UTC 2020
*/
package com.xpn.xwiki.store;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class XWikiHibernateBaseStore_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
41792406d15edd56cebaed0175606cd3dbaf085c | 070b9e745c5aad76fb310f5c9111ed77a1036291 | /Drona-Package/com/bumptech/glide/provider/ImageHeaderParserRegistry.java | fc9d7fd8e426d32107757f9684025f4322833803 | [] | no_license | Drona-team/Drona | 0f057e62e7f77babf112311734ee98c5824f166c | e33a9d92011ef7790c7547cc5a5380083f0dbcd7 | refs/heads/master | 2022-11-18T06:38:57.404528 | 2020-07-18T09:35:57 | 2020-07-18T09:35:57 | 280,390,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.bumptech.glide.provider;
import com.bumptech.glide.load.ImageHeaderParser;
import java.util.ArrayList;
import java.util.List;
public final class ImageHeaderParserRegistry
{
private final List<ImageHeaderParser> parsers = new ArrayList();
public ImageHeaderParserRegistry() {}
public List getParsers()
{
try
{
List localList = parsers;
return localList;
}
catch (Throwable localThrowable)
{
throw localThrowable;
}
}
public void sendPacket(ImageHeaderParser paramImageHeaderParser)
{
try
{
parsers.add(paramImageHeaderParser);
return;
}
catch (Throwable paramImageHeaderParser)
{
throw paramImageHeaderParser;
}
}
}
| [
"samridh6759@gmail.com"
] | samridh6759@gmail.com |
aafa1b3b23726146dbda39460f927209aa746898 | d517e195af01b2b7425935605ce477a9108b4412 | /July27/Question2/src/com/deloitte/cui/EmplyeeSort.java | c65b34d437989d15e70b6be1e859e698050b55fb | [] | no_license | AkshathaEtagi/DeloitteTraining | c38b377a2484c270d7e509043fcf5b75de6ed054 | e2bff427d2f35026e889f81f34953a4973aa64b6 | refs/heads/master | 2020-03-23T14:57:08.723880 | 2018-07-27T13:15:22 | 2018-07-27T13:15:22 | 141,710,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package com.deloitte.cui;
import java.util.Comparator;
public class EmplyeeSort implements Comparator<EmplyeeVo> {
public EmplyeeSort() {
}
@Override
public int compare(EmplyeeVo e1, EmplyeeVo e2) {
return (int) (e1.getIncometa() - e2.getIncometa());
}
}
| [
"41478724+snehajpillai@users.noreply.github.com"
] | 41478724+snehajpillai@users.noreply.github.com |
b4a3d04611526bacd6f7e37bbd9427775de13213 | 72e57b1a19a08be8c5025fd245c1bf8039c90fc0 | /app/src/main/java/com/example/appfuncionesmatemticas/GradosMinutosYSegubdosAMinutos.java | 5bff17a38f023c546e45318cf38f4c301404104c | [] | no_license | karen-garcia19/prueba | 0e9d4d4a77b98d695135eaa1de4ed5bbf9594b3e | b1a126822e89f08cd538cf1e9afc32bd2fe5498e | refs/heads/master | 2021-01-26T09:19:36.068694 | 2020-03-23T18:11:52 | 2020-03-23T18:11:52 | 243,396,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,460 | java | package com.example.appfuncionesmatemticas;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class GradosMinutosYSegubdosAMinutos extends AppCompatActivity {
private EditText Grados;
private EditText Minutos;
private EditText Segundos;
private TextView resultado;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_grados_minutos_ysegubdos_aminutos);
Grados = (EditText)findViewById(R.id.ezer_grado1);
Minutos = (EditText)findViewById(R.id.ezer_min1);
Segundos = (EditText)findViewById(R.id.ezer_seg1);
resultado = (TextView)findViewById(R.id.ezer_resultado1);
}
//Este metodo realiza la conversion
public void minutos(View view){
String valor1 = Grados.getText().toString();
String valor2 = Minutos.getText().toString();
String valor3 = Segundos.getText().toString();
double num1 = Double.parseDouble(valor1);
double num2 = Double.parseDouble(valor2);
double num3 = Double.parseDouble(valor3);
double minutos1 = num1 * 60;
double minutos2 = num3 / 60;
double sumaMin = num2 + minutos1 + minutos2;
String res1 = String.valueOf(sumaMin);
resultado.setText(res1 +"'");
}
}
| [
"1930468@upv.edu.mx"
] | 1930468@upv.edu.mx |
7dd63a550cfec2076e0c64e520bdbef5f074707f | 5be523eb067429903dc704bb28599391bce1ba90 | /android/app/src/main/java/com/porttimereactnative/MainApplication.java | 24c19c64a4ad15a8dc0836722cd1b6fa4cd1cd5b | [] | no_license | DeadDuck83/PortTimeReactNative | 4df145c9b2275890b149c578f98e6cfbd445008a | b0f109a1347f94c700cbfd06ae5503014668f605 | refs/heads/master | 2023-01-20T08:17:08.207204 | 2020-03-17T17:50:37 | 2020-03-17T17:50:37 | 244,244,417 | 0 | 0 | null | 2023-01-05T08:46:46 | 2020-03-02T00:07:51 | JavaScript | UTF-8 | Java | false | false | 2,286 | java | package com.porttimereactnative;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
}
/**
* Loads Flipper in React Native templates.
*
* @param context
*/
private static void initializeFlipper(Context context) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"moore8577@gmail.com"
] | moore8577@gmail.com |
14e82e14b75fb58e89c5bd9e315629add9223f53 | 98fb3e661ddd44bd7cc0ba3d1e9e543e0cf4af96 | /src/main/java/com/kv/lc/L68_FindKSmallestElementsInArray.java | c451b45556680c190c02f6d7c55cc61f4ad36f23 | [] | no_license | kannuverma12/DSA | 2817d361f6ed750cd7e7773dce3c0ad6aad39b2f | 2ac3f246aed14af564a7d3dba258978d401a7e91 | refs/heads/master | 2023-04-29T18:50:00.141995 | 2021-01-15T17:53:38 | 2021-01-15T17:53:38 | 139,438,541 | 2 | 0 | null | 2023-04-14T17:40:57 | 2018-07-02T12:08:58 | Java | UTF-8 | Java | false | false | 2,638 | java | package com.kv.lc;
import java.util.Comparator;
import java.util.PriorityQueue;
public class L68_FindKSmallestElementsInArray {
public static void printSmall(int arr[], int n, int k)
{
// For each arr[i] find whether it is a part of n-smallest with insertion sort concept
for (int i = k; i < n; ++i) {
// Find largest from top n-element
int max_var = arr[k - 1];
int pos = k - 1;
for (int j = k - 2; j >= 0; j--) {
if (arr[j] > max_var) {
max_var = arr[j];
pos = j;
}
}
// If largest is greater than arr[i]
// shift all element one place left
if (max_var > arr[i]) {
int j = pos;
while (j < k - 1) {
arr[j] = arr[j + 1];
j++;
}
// make arr[k-1] = arr[i]
arr[k - 1] = arr[i];
}
}
// print result
for (int i = 0; i < k; i++)
System.out.print(arr[i] + " ");
}
// Driver function
public static void main(String argc[])
{
int[] arr = { 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
int n = 10;
int k = 5;
printSmall(arr, n, k);
int[] ret = smallestK(arr, k);
}
//method 2
static int[] smallestK(int[] array, int k) {
if (k <= 0 && k > array.length){
throw new IllegalArgumentException();
}
PriorityQueue<Integer> heap = getKMaxHeap(array, k);
return heapTointArray(heap);
}
/* Create max heap of smallest k elements. */
static PriorityQueue<Integer> getKMaxHeap(int[] array,
int k) {
PriorityQueue<Integer> heap = new PriorityQueue<>(k, new MaxHeapComparator());
for (int a : array) {
if (heap.size() < k) { //If space remaining
heap.add(a);
} else if (a < heap.peek()) { //If full and top is small
heap.poll(); //remove highest
heap.add(a); //insert new element
}
}
return heap;
}
/*Convert heap to int array. */
static int[] heapTointArray(PriorityQueue<Integer> heap) {
int[] array = new int[heap.size()];
while (!heap.isEmpty()) {
array[heap.size() - 1] = heap.poll();
}
return array;
}
static class MaxHeapComparator implements Comparator<Integer> {
public int compare(Integer x, Integer y) {
return y - x;
}
}
}
| [
"karan2.verma@paytm.com"
] | karan2.verma@paytm.com |
192ee77d453caa39b0becd6ed2038ac5e033c996 | fbe762b466c0a01977f3da758516dcf274aa2bdb | /build/app/generated/not_namespaced_r_class_sources/release/r/io/flutter/plugins/webviewflutter/R.java | 409602269bbe602364fd1ef2a183ecf5eb33fd77 | [] | no_license | JohnLoaiza/c1 | a97bc2c4fe067aa0da18b8446bc00871b33ef7d3 | b192eedb1cf0081a4feff3aa01114613cbed680f | refs/heads/master | 2023-01-08T16:56:32.965434 | 2020-10-29T09:31:43 | 2020-10-29T09:31:43 | 305,467,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,493 | 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 io.flutter.plugins.webviewflutter;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f030028;
public static final int font = 0x7f030128;
public static final int fontProviderAuthority = 0x7f03012a;
public static final int fontProviderCerts = 0x7f03012b;
public static final int fontProviderFetchStrategy = 0x7f03012c;
public static final int fontProviderFetchTimeout = 0x7f03012d;
public static final int fontProviderPackage = 0x7f03012e;
public static final int fontProviderQuery = 0x7f03012f;
public static final int fontStyle = 0x7f030130;
public static final int fontVariationSettings = 0x7f030131;
public static final int fontWeight = 0x7f030132;
public static final int ttcIndex = 0x7f030272;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f0500af;
public static final int notification_icon_bg_color = 0x7f0500b0;
public static final int ripple_material_light = 0x7f0500bb;
public static final int secondary_text_default_material_light = 0x7f0500bd;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f060053;
public static final int compat_button_inset_vertical_material = 0x7f060054;
public static final int compat_button_padding_horizontal_material = 0x7f060055;
public static final int compat_button_padding_vertical_material = 0x7f060056;
public static final int compat_control_corner_material = 0x7f060057;
public static final int compat_notification_large_icon_max_height = 0x7f060058;
public static final int compat_notification_large_icon_max_width = 0x7f060059;
public static final int notification_action_icon_size = 0x7f06012e;
public static final int notification_action_text_size = 0x7f06012f;
public static final int notification_big_circle_margin = 0x7f060130;
public static final int notification_content_margin_start = 0x7f060131;
public static final int notification_large_icon_height = 0x7f060132;
public static final int notification_large_icon_width = 0x7f060133;
public static final int notification_main_column_padding_top = 0x7f060134;
public static final int notification_media_narrow_margin = 0x7f060135;
public static final int notification_right_icon_size = 0x7f060136;
public static final int notification_right_side_padding_top = 0x7f060137;
public static final int notification_small_icon_background_padding = 0x7f060138;
public static final int notification_small_icon_size_as_large = 0x7f060139;
public static final int notification_subtext_size = 0x7f06013a;
public static final int notification_top_pad = 0x7f06013b;
public static final int notification_top_pad_large_text = 0x7f06013c;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f070098;
public static final int notification_bg = 0x7f070099;
public static final int notification_bg_low = 0x7f07009a;
public static final int notification_bg_low_normal = 0x7f07009b;
public static final int notification_bg_low_pressed = 0x7f07009c;
public static final int notification_bg_normal = 0x7f07009d;
public static final int notification_bg_normal_pressed = 0x7f07009e;
public static final int notification_icon_background = 0x7f07009f;
public static final int notification_template_icon_bg = 0x7f0700a0;
public static final int notification_template_icon_low_bg = 0x7f0700a1;
public static final int notification_tile_bg = 0x7f0700a2;
public static final int notify_panel_notification_icon_bg = 0x7f0700a3;
}
public static final class id {
private id() {}
public static final int accessibility_action_clickable_span = 0x7f08000a;
public static final int accessibility_custom_action_0 = 0x7f08000b;
public static final int accessibility_custom_action_1 = 0x7f08000c;
public static final int accessibility_custom_action_10 = 0x7f08000d;
public static final int accessibility_custom_action_11 = 0x7f08000e;
public static final int accessibility_custom_action_12 = 0x7f08000f;
public static final int accessibility_custom_action_13 = 0x7f080010;
public static final int accessibility_custom_action_14 = 0x7f080011;
public static final int accessibility_custom_action_15 = 0x7f080012;
public static final int accessibility_custom_action_16 = 0x7f080013;
public static final int accessibility_custom_action_17 = 0x7f080014;
public static final int accessibility_custom_action_18 = 0x7f080015;
public static final int accessibility_custom_action_19 = 0x7f080016;
public static final int accessibility_custom_action_2 = 0x7f080017;
public static final int accessibility_custom_action_20 = 0x7f080018;
public static final int accessibility_custom_action_21 = 0x7f080019;
public static final int accessibility_custom_action_22 = 0x7f08001a;
public static final int accessibility_custom_action_23 = 0x7f08001b;
public static final int accessibility_custom_action_24 = 0x7f08001c;
public static final int accessibility_custom_action_25 = 0x7f08001d;
public static final int accessibility_custom_action_26 = 0x7f08001e;
public static final int accessibility_custom_action_27 = 0x7f08001f;
public static final int accessibility_custom_action_28 = 0x7f080020;
public static final int accessibility_custom_action_29 = 0x7f080021;
public static final int accessibility_custom_action_3 = 0x7f080022;
public static final int accessibility_custom_action_30 = 0x7f080023;
public static final int accessibility_custom_action_31 = 0x7f080024;
public static final int accessibility_custom_action_4 = 0x7f080025;
public static final int accessibility_custom_action_5 = 0x7f080026;
public static final int accessibility_custom_action_6 = 0x7f080027;
public static final int accessibility_custom_action_7 = 0x7f080028;
public static final int accessibility_custom_action_8 = 0x7f080029;
public static final int accessibility_custom_action_9 = 0x7f08002a;
public static final int action_container = 0x7f080033;
public static final int action_divider = 0x7f080035;
public static final int action_image = 0x7f080036;
public static final int action_text = 0x7f08003c;
public static final int actions = 0x7f08003d;
public static final int async = 0x7f080045;
public static final int blocking = 0x7f080048;
public static final int chronometer = 0x7f080054;
public static final int dialog_button = 0x7f08006a;
public static final int forever = 0x7f08007d;
public static final int icon = 0x7f080085;
public static final int icon_group = 0x7f080086;
public static final int info = 0x7f08008a;
public static final int italic = 0x7f08008b;
public static final int line1 = 0x7f080091;
public static final int line3 = 0x7f080092;
public static final int normal = 0x7f0800b9;
public static final int notification_background = 0x7f0800ba;
public static final int notification_main_column = 0x7f0800bb;
public static final int notification_main_column_container = 0x7f0800bc;
public static final int right_icon = 0x7f0800ca;
public static final int right_side = 0x7f0800cb;
public static final int tag_accessibility_actions = 0x7f0800fa;
public static final int tag_accessibility_clickable_spans = 0x7f0800fb;
public static final int tag_accessibility_heading = 0x7f0800fc;
public static final int tag_accessibility_pane_title = 0x7f0800fd;
public static final int tag_screen_reader_focusable = 0x7f0800fe;
public static final int tag_transition_group = 0x7f0800ff;
public static final int tag_unhandled_key_event_manager = 0x7f080100;
public static final int tag_unhandled_key_listeners = 0x7f080101;
public static final int text = 0x7f080105;
public static final int text2 = 0x7f080106;
public static final int time = 0x7f080110;
public static final int title = 0x7f080111;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f090015;
}
public static final class layout {
private layout() {}
public static final int custom_dialog = 0x7f0b001c;
public static final int notification_action = 0x7f0b0048;
public static final int notification_action_tombstone = 0x7f0b0049;
public static final int notification_template_custom_big = 0x7f0b0050;
public static final int notification_template_icon_group = 0x7f0b0051;
public static final int notification_template_part_chronometer = 0x7f0b0055;
public static final int notification_template_part_time = 0x7f0b0056;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0e0062;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0f0155;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0156;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0158;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f015b;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f015d;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f023b;
public static final int Widget_Compat_NotificationActionText = 0x7f0f023c;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030028 };
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 = { 0x7f03012a, 0x7f03012b, 0x7f03012c, 0x7f03012d, 0x7f03012e, 0x7f03012f };
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, 0x7f030128, 0x7f030130, 0x7f030131, 0x7f030132, 0x7f030272 };
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;
}
}
| [
"jhon91811@gmail.com"
] | jhon91811@gmail.com |
37a399e723c222c0c5c93e7b3534d04f28dfc72f | 37f90118838a2b3f46c3e639817e774057a66943 | /src/main/Week6/Old/Solution4.java | 85a026c86337723a75c7f4d178dfff23bba41f8c | [] | no_license | OmarTheMostWanted/Algorithms-and-Data-Structures | 22130c5ea77f2cecaf6201c6271cb02436b51898 | c3d53f60c1ccf755da93795e486aed2e348c3b88 | refs/heads/master | 2021-07-04T08:54:19.308037 | 2021-02-01T01:23:41 | 2021-02-01T01:23:41 | 222,811,331 | 2 | 1 | null | 2019-12-06T01:28:51 | 2019-11-19T23:42:41 | Java | UTF-8 | Java | false | false | 2,090 | java | package main.Week6.Old;
import java.util.HashSet;
class MySet extends HashSet<String> {
private static final long serialVersionUID = 1L;
public MySet() {
super();
}
/**
* @return the union of the elements of this and that
*/
public MySet union(MySet that) {
MySet result = new MySet();
result.addAll(this);
if (that != null) {
result.addAll(that);
}
return result;
}
/**
* @return the intersection of the elements of this and that
*/
public MySet intersection(MySet that) {
MySet result = new MySet();
for (String s : this) {
if (that != null && that.contains(s)) {
result.add(s);
}
}
return result;
}
/**
* @return the difference of the elements of this and that
*/
public MySet difference(MySet that) {
MySet result = new MySet();
for (String s : this) {
if (that == null || !that.contains(s)) {
result.add(s);
}
}
return result;
}
/**
* @return the exclusive or (XOR) of the elements of this and that
*/
public MySet exclusiveOr(MySet that) {
MySet result = new MySet();
for (String s : this) {
if (that == null || !that.contains(s)) {
result.add(s);
}
}
if (that != null) {
for (String s : that) {
if (!this.contains(s)) {
result.add(s);
}
}
}
return result;
}
/**
* @return a String representation of a MySet object
*/
public String toString() {
StringBuilder builder = new StringBuilder("<MySet{");
String end = "}>";
int i = 0;
for (String s : this) {
builder.append(s);
if (i != this.size() - 1) {
builder.append(",");
}
i++;
}
return builder.append(end).toString();
}
} | [
"omarthabettmw@gmail.com"
] | omarthabettmw@gmail.com |
4f2f826d1b456973a5eb105e9a0f03196cfa0051 | 41176c5d4d0528a75214f59fabc803354d4a8ea0 | /Chapter9_Object_Oriented/src/MgRectangle.java | 20e0f20615d0bcfdfa695109983e23b4f8363361 | [] | no_license | sohyunbk/Java_Practice | 471dfb2816569bfded70c12664227e755052bbf7 | 329eb66b6cfafa4000efa669184fc8c056de1179 | refs/heads/master | 2021-02-17T04:57:04.022073 | 2020-03-05T05:03:47 | 2020-03-05T05:03:47 | 245,072,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | // Define the circle class with two constructors
class MgRectangle {
double width;
double height;
/** Construct a circle with radius 1 */
MgRectangle() {
width = 1;
height = 1;
}
/** Construct a circle with a specified radius */
MgRectangle(double newWidth, double newHeight) {
width = newWidth;
height = newHeight;
}
/** Return the area of this circle */
double getArea() {
return width * height;
}
/** Return the perimeter of this circle */
double getPerimeter() {
return 2 * (width + height);
}
/** Set a new radius for this circle */
void setRadius(double newWidth, double newHeight) {
width = newWidth;
height = newHeight;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f5ef75ac7467b2ca7c4c1930103dc79e0d6002b6 | 8d80f2f191fdc716b10b7f048669beeb059595d0 | /src/main/java/selenium/org/BrowserLaunch.java | 35013f344282da7201a5215dbebd99ec3dd25f55 | [] | no_license | Muthuraj95/Muthuraj | 572f30a652828afe52048a52b64c6e966d7319f1 | e7ea82e354d7a9195581e1dbbacb47b3bf2ed196 | refs/heads/master | 2023-04-06T05:16:59.484158 | 2021-04-25T00:17:01 | 2021-04-25T00:17:01 | 360,420,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | package selenium.org;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class BrowserLaunch extends Datadriven1 {
public static void main(String[] args) throws IOException, InterruptedException {
System.setProperty("webdriver.gecko.driver", "E:\\New java files\\Project1\\Driver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.adactin.com/HotelApp/");
Thread.sleep(3000);
WebElement findElement = driver.findElement(By.name("username"));
findElement.sendKeys(getData(0,0));
WebElement findElements = driver.findElement(By.id("password"));
findElements.sendKeys(getData(0,1));
}
}
| [
"muthunesik@gmail.com"
] | muthunesik@gmail.com |
d9585f6796406c11ef7e2b6a5958f9ce6f05d177 | 5b97950700ba9d669ceecf301086c69c742af7db | /app/src/main/java/online/motohub/interfaces/EventsInterface.java | 8b2c9210e5d152b9878b19cc2d923409007e726b | [] | no_license | MotoHub/Motohub | 298eb5634fea5dd3fac451a9af9cac671b944494 | 0867f70af5e92cc581aa84f06e5e3c727a315fca | refs/heads/master | 2021-01-16T13:09:50.181050 | 2019-06-20T17:15:41 | 2019-06-20T17:15:41 | 243,130,160 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package online.motohub.interfaces;
import android.support.annotation.NonNull;
import android.widget.Filter;
import online.motohub.model.EventsWhoIsGoingResModel;
public interface EventsInterface {
void bookAnEventSuccess(EventsWhoIsGoingResModel eventsWhoIsGoingResModel);
@NonNull
Filter getFilter();
}
| [
"mailtodeebanmca@gmail.com"
] | mailtodeebanmca@gmail.com |
492515e5fbe1de54337aa9d85aeaac84bc469a3a | 3b27b142aa6648a4da654be5067d6e7f9019c110 | /src/test/java/Hbase/HBaseTest.java | 4a42826d51988ade451725836ea211acbe66d038 | [] | no_license | 749888411/sparkForDB | 2985769cf4fd728898df8791f77bb5283671ea68 | 9c6bdfa3c56747d8616a2171a7216aa5204af64d | refs/heads/master | 2020-11-25T17:35:57.509077 | 2017-05-06T03:03:19 | 2017-05-06T03:03:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,267 | java | package Hbase;
import label.combine.SearchConstructor;
import label.hbase.HBaseClient;
import label.model.LabelResult;
import label.utils.ConstUtil;
import label.utils.Json;
import org.junit.Test;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
* 描述:TODO
* author qiaobin 2017/4/14 15:14.
*/
public class HBaseTest {
@Test
public void test() {
HBaseClient service = new HBaseClient("172.16.9.42", "2181");
service.dropTable("qiaobin");
service.createTable("qiaobin", "default");
}
@Test
public void insert() {
HBaseClient service = new HBaseClient("172.16.9.42", "2181");
try {
long ts1 = System.currentTimeMillis();
service.insertRow("qiaobin", "1", "default", "userid", "b", ts1);
service.insertRow("qiaobin", "1", "default", "genres", "1", ts1);
service.insertRow("qiaobin", "2", "default", "userid", "b", ts1);
service.insertRow("qiaobin", "2", "default", "genres", "2", ts1);
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
public void search() {
HBaseClient service = new HBaseClient("172.16.9.42", "2181");
try {
List<String> list = new ArrayList<>();
list.add("1");
list.add("2");
LabelResult rowData = service.getRowData("qiaobin", list, "default", 0);
System.out.println(rowData);
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
public void search1() {
HBaseClient service = new HBaseClient("172.16.9.42", "2181");
try {
SearchConstructor constructor = new SearchConstructor();
constructor.setVersion(Long.parseLong("1493705671238"));
LabelResult qiaobin = service.search("qiaobin", constructor, null);
System.out.println(Json.toJsonString(qiaobin));
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void tsToString() {
Timestamp ts = new Timestamp(Long.parseLong("1492224680375"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HHmmss");
try {
String s = sdf.format(ts);
System.out.println(s);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void count() {
long count;
try {
HBaseClient service = new HBaseClient("172.16.9.42", "2181");
count = service.count("qiaobin", "title");
System.out.println(count);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void get() {
HBaseClient service = new HBaseClient("172.16.9.42", "2181");
try {
service.getRowData("qiaobin", "1", ConstUtil.COLUMNFAMILY_DEFAULT, 0);
} catch (IOException e) {
e.printStackTrace();
}
}
//get 'combine','1001',{COLUMN=>'default:userName',VERSIONS=>10} 获取一个字段下的多版本数据
//get 'qiaobin','994',{COLUMN=>'default:Tag',TIMESTAMP=>1492224685}037
}
| [
"344399160@qq.com"
] | 344399160@qq.com |
f6eb299bdf5e347fb2409c5ba6238d0d5f71ac8c | ca65e45ea9e3c4e5421a9b46abefed98bc9850d8 | /src/test/java/com/example/ty_en/ires/ExampleUnitTest.java | 66d8d1852346a1b21b7095d48d7504965cb75e95 | [] | no_license | yusuketakei/Ires | 03526bea947b8f24d7d9ad59c1af947e5b3e0c9c | 95bdbac59597897ff2de519f547712e60be9e768 | refs/heads/master | 2021-09-05T06:54:43.097511 | 2018-01-25T01:47:40 | 2018-01-25T01:47:40 | 111,775,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package com.example.ty_en.ires;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"noreply@github.com"
] | noreply@github.com |
eced84a335112b561836ea803536bdbe2a7031d3 | 2ae7dad68e3600e6a4fd6a380316d4bb1bd55ca7 | /teams/droneKiteOD/STrainingHandler.java | effdeb852c76e2c4526f702bc016a12e00a546f6 | [] | no_license | kpeng94/shigatsu | 2e7e113de6d062a91b0a311eaa03c96744d7e840 | 6cfd81dd2a50321047334aff8184567b5ce04fcd | refs/heads/master | 2021-01-19T11:17:34.752822 | 2015-03-13T17:31:47 | 2015-03-13T17:31:47 | 28,466,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package droneKiteOD;
import battlecode.common.*;
public class STrainingHandler extends StructureHandler {
public static void loop(RobotController rcon) {
try {
init(rcon);
} catch (Exception e) {
// e.printStackTrace();
System.out.println(typ + " Initialization Exception");
}
while (true) {
try {
execute();
} catch (Exception e) {
// e.printStackTrace();
System.out.println(typ + " Execution Exception");
}
rc.yield(); // Yields to save remaining bytecodes
}
}
protected static void init(RobotController rcon) {
initStructure(rcon);
}
protected static void execute() {
executeStructure();
}
}
| [
"bz88@cornell.edu"
] | bz88@cornell.edu |
782f91b1baf5bd06ce1d1f4b08128734e66c27fb | 68a19507f18acff18aa4fa67d6611f5b8ac8913c | /lxs/lxs-api-client/src/main/java/lxs/api/v1/request/command/order/line/GetShouldPayMoneyCommand.java | 517ed31f4aba38b528cd9718d0140cbb149286dc | [] | no_license | ksksks2222/pl-workspace | cf0d0be2dfeaa62c0d4d5437f85401f60be0eadd | 6146e3e3c2384c91cac459d25b27ffeb4f970dcd | refs/heads/master | 2021-09-13T08:59:17.177105 | 2018-04-27T09:46:42 | 2018-04-27T09:46:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package lxs.api.v1.request.command.order.line;
import lxs.api.base.ApiPayload;
@SuppressWarnings("serial")
public class GetShouldPayMoneyCommand extends ApiPayload {
private String orderNO;
public String getOrderNO() {
return orderNO;
}
public void setOrderNO(String orderNO) {
this.orderNO = orderNO;
}
}
| [
"cangsong6908@gmail.com"
] | cangsong6908@gmail.com |
497a0d10efebebcf1fc55391db95f6936a048abe | f896faa0b5dd5dca87d9e373aad5ebbc03370975 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Bulldozers/JewelAutonRed1.java | 786daf44d430280823daa9c672b5b2b36100f70d | [
"BSD-3-Clause"
] | permissive | WagarFTC/ftc_app-master | bedaa0ad51e4cbe1abac1de1f32a45cfcbc112b9 | 2a34e05129d733fc9ce670896d1550c8102e60ac | refs/heads/master | 2021-08-14T06:18:36.044632 | 2017-11-14T19:49:05 | 2017-11-14T19:49:05 | 110,736,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | package org.firstinspires.ftc.teamcode.Bulldozers;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import org.firstinspires.ftc.teamcode.Bulldozers.Robot7901;
import org.firstinspires.ftc.teamcode.General.PossibleColors;
/**
* Created by nova on 11/10/2017.
*/
public class JewelAutonRed1 extends LinearOpMode {
Robot7901 robot = new Robot7901();
public void runOpMode() throws InterruptedException{
robot.init(hardwareMap);
waitForStart();
robot.setJewelServoDown();
robot.writePowers();
double t0 = this.getRuntime();
while (opModeIsActive() && this.getRuntime() -t0 < .2){
}
if (robot.colorSensorSeesColor(PossibleColors.RED)){
robot.tankDrive(-.7,.7);
} else if(robot.colorSensorSeesColor(PossibleColors.BLUE)){
robot.tankDrive(.7,-.7);
}
robot.writePowers();
t0 = this.getRuntime();
while (opModeIsActive() && this.getRuntime() -t0 < .2){
}
robot.tankDrive(0,0);
robot.setJewelServoUp();
robot.writePowers();
}
}
| [
"wagarftc@gmail.com"
] | wagarftc@gmail.com |
ca4495ccb59fa59eb74824cc63971b528f7d503c | 86b5fc1c3f37d5947a4c38a9a52b986f988311b9 | /spring-framework-2.5/src/org/springframework/beans/factory/xml/AbstractSingleBeanDefinitionParser.java | cae7865f7774f0484cb4b17e1091b3e388bc052e | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bachmeb/spring-framework-2.5 | 7367c3d6cbeb11a95382ab47eb2f90003a5a98a0 | 34240f4b92f2a56f25ee9719c208f7a38c9062ca | refs/heads/master | 2016-08-11T23:22:49.894742 | 2016-02-02T23:00:52 | 2016-02-02T23:00:52 | 50,949,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,178 | java | /*
* Copyright 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.xml;
import org.w3c.dom.Element;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
/**
* Base class for those {@link BeanDefinitionParser} implementations that
* need to parse and define just a <i>single</i> <code>BeanDefinition</code>.
*
* <p>Extend this parser class when you want to create a single bean definition
* from an arbitrarily complex XML element. You may wish to consider extending
* the {@link AbstractSimpleBeanDefinitionParser} when you want to create a
* single bean definition from a relatively simple custom XML element.
*
* <p>The resulting <code>BeanDefinition</code> will be automatically registered
* with the {@link org.springframework.beans.factory.support.BeanDefinitionRegistry}.
* Your job simply is to {@link #doParse parse} the custom XML {@link Element}
* into a single <code>BeanDefinition</code>.
*
* @author Rob Harrop
* @author Juergen Hoeller
* @author Rick Evans
* @since 2.0
* @see #getBeanClass
* @see #getBeanClassName
* @see #doParse
*/
public abstract class AbstractSingleBeanDefinitionParser extends AbstractBeanDefinitionParser {
/**
* Creates a {@link BeanDefinitionBuilder} instance for the
* {@link #getBeanClass bean Class} and passes it to the
* {@link #doParse} strategy method.
* @param element the element that is to be parsed into a single BeanDefinition
* @param parserContext the object encapsulating the current state of the parsing process
* @return the BeanDefinition resulting from the parsing of the supplied {@link Element}
* @throws IllegalStateException if the bean {@link Class} returned from
* {@link #getBeanClass(org.w3c.dom.Element)} is <code>null</code>
* @see #doParse
*/
protected final AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition();
String parentName = getParentName(element);
if (parentName != null) {
builder.getRawBeanDefinition().setParentName(parentName);
}
Class beanClass = getBeanClass(element);
if (beanClass != null) {
builder.getRawBeanDefinition().setBeanClass(beanClass);
}
else {
String beanClassName = getBeanClassName(element);
if (beanClassName != null) {
builder.getRawBeanDefinition().setBeanClassName(beanClassName);
}
}
builder.setSource(parserContext.extractSource(element));
if (parserContext.isNested()) {
// Inner bean definition must receive same scope as containing bean.
builder.setScope(parserContext.getContainingBeanDefinition().getScope());
}
if (parserContext.isDefaultLazyInit()) {
// Default-lazy-init applies to custom bean definitions as well.
builder.setLazyInit(true);
}
doParse(element, parserContext, builder);
return builder.getBeanDefinition();
}
/**
* Determine the name for the parent of the currently parsed bean,
* in case of the current bean being defined as a child bean.
* <p>The default implementation returns <code>null</code>,
* indicating a root bean definition.
* @param element the <code>Element</code> that is being parsed
* @return the name of the parent bean for the currently parsed bean,
* or <code>null</code> if none
*/
protected String getParentName(Element element) {
return null;
}
/**
* Determine the bean class corresponding to the supplied {@link Element}.
* <p>Note that, for application classes, it is generally preferable to
* override {@link #getBeanClassName} instead, in order to avoid a direct
* dependence on the bean implementation class. The BeanDefinitionParser
* and its NamespaceHandler can be used within an IDE plugin then, even
* if the application classes are not available on the plugin's classpath.
* @param element the <code>Element</code> that is being parsed
* @return the {@link Class} of the bean that is being defined via parsing
* the supplied <code>Element</code>, or <code>null</code> if none
* @see #getBeanClassName
*/
protected Class getBeanClass(Element element) {
return null;
}
/**
* Determine the bean class name corresponding to the supplied {@link Element}.
* @param element the <code>Element</code> that is being parsed
* @return the class name of the bean that is being defined via parsing
* the supplied <code>Element</code>, or <code>null</code> if none
* @see #getBeanClass
*/
protected String getBeanClassName(Element element) {
return null;
}
/**
* Parse the supplied {@link Element} and populate the supplied
* {@link BeanDefinitionBuilder} as required.
* <p>The default implementation delegates to the <code>doParse</code>
* version without ParserContext argument.
* @param element the XML element being parsed
* @param parserContext the object encapsulating the current state of the parsing process
* @param builder used to define the <code>BeanDefinition</code>
* @see #doParse(Element, BeanDefinitionBuilder)
*/
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
doParse(element, builder);
}
/**
* Parse the supplied {@link Element} and populate the supplied
* {@link BeanDefinitionBuilder} as required.
* <p>The default implementation does nothing.
* @param element the XML element being parsed
* @param builder used to define the <code>BeanDefinition</code>
*/
protected void doParse(Element element, BeanDefinitionBuilder builder) {
}
}
| [
"bachmeb@mail.uc.edu"
] | bachmeb@mail.uc.edu |
20bb56cc9d17228a98bb978f6a7b447d400b8b46 | 0491cd721741a196932e834bfc2f50f1c40d6832 | /ClientExtern/src/feukora/webservice/rmi/FindKontaktByOrt.java | a4cb68fc5c07d04bb882928e01fd3febcf869acc | [] | no_license | HSLU-WI-Feukora2016-GruppeB/Feukora_HSLU_2016_GruppeB | 5481814f005e023c1062b7646944c356b8c93add | df46b10cb7267537324b4d001630350f636a1417 | refs/heads/master | 2021-01-01T05:03:46.183931 | 2016-05-27T16:52:10 | 2016-05-27T16:52:10 | 57,364,241 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,377 | java |
package feukora.webservice.rmi;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java-Klasse für findKontaktByOrt complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType name="findKontaktByOrt">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ort" type="{http://rmi.webservice.feukora/}ort" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "findKontaktByOrt", propOrder = {
"ort"
})
public class FindKontaktByOrt {
protected Ort ort;
/**
* Ruft den Wert der ort-Eigenschaft ab.
*
* @return
* possible object is
* {@link Ort }
*
*/
public Ort getOrt() {
return ort;
}
/**
* Legt den Wert der ort-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link Ort }
*
*/
public void setOrt(Ort value) {
this.ort = value;
}
}
| [
"Olivia@OliviasNetbook"
] | Olivia@OliviasNetbook |
12c3463a0a25d500fa6fa2a9ef3969f714a7a847 | f98b15d9bec1b6f5a28165c95713b79345f68123 | /src/main/java/chap05/datetime/duration/DurationUsage.java | 86eb34f138517406a69b054a64e77dd8df92311d | [] | no_license | baki504/ocp-exam-java8 | 97da70640807b34e680fbf9a7ffa11d9fbcc0219 | 608787e80b796808c7c6adee3c53a0f9b70ec8df | refs/heads/master | 2020-04-30T14:06:43.722508 | 2019-05-11T04:26:38 | 2019-05-11T04:26:38 | 176,879,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,271 | java | package chap05.datetime.duration;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Period;
public class DurationUsage {
public static void main(String[] args) {
LocalDate date = LocalDate.of(2015, 1, 20);
LocalTime time = LocalTime.of(6, 15);
LocalDateTime dateTime = LocalDateTime.of(date, time);
Duration duration6h = Duration.ofHours(6);
System.out.println(dateTime.plus(duration6h)); // 2015–01–20T12:15
System.out.println(time.plus(duration6h)); // 12:15
// System.out.println(date.plus(duration)); // UnsupportedTemporalException
Duration duration23h = Duration.ofHours(23);
System.out.println(dateTime.plus(duration23h)); // 2015–01–21T05:15
System.out.println(time.plus(duration23h)); // 05:15
// System.out.println(date.plus(duration23h)); // UnsupportedTemporalException
LocalDate localdate = LocalDate.of(2015, 5, 25);
Period period = Period.ofDays(1);
Duration days = Duration.ofDays(1);
System.out.println(localdate.plus(period)); // 2015–05–26
System.out.println(localdate.plus(days)); // Unsupported unit: Seconds
}
}
| [
"baki504@msn.com"
] | baki504@msn.com |
1b1a71a7affa14779b90f94d08ff278c0fe4cbf1 | e626d371fdecf4e6b5d3d25309c087be69ad6c70 | /platforms/android/WeexSDK/src/main/java/com/taobao/weex/ui/component/Scrollable.java | d7c56b3eef6e889f8ee507f59c7d59665d85e143 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | erguotou520/weex-uikit | 9ae3a8ee590e24269798042ba3de1cc8dbfbde9f | 837c901f996b32d8afcdb9338e14ef380ca664de | refs/heads/master | 2022-02-24T03:02:55.335492 | 2017-11-23T12:29:08 | 2017-11-23T12:29:08 | 92,043,101 | 81 | 16 | MIT | 2022-02-12T07:29:25 | 2017-05-22T10:49:41 | Java | UTF-8 | Java | false | false | 12,508 | java | /**
*
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "[]"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright 2016 Alibaba Group
*
* 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.taobao.weex.ui.component;
import android.view.ViewGroup;
/**
* Created by sospartan on 7/5/16.
*/
public interface Scrollable {
void bindStickStyle(WXComponent component);
void unbindStickStyle(WXComponent component);
void bindAppearEvent(WXComponent component);
void bindDisappearEvent(WXComponent component);
void unbindAppearEvent(WXComponent component);
void unbindDisappearEvent(WXComponent component);
ViewGroup getView();
void scrollTo(WXComponent component, int offset);
String getRef();
int getScrollY();
int getScrollX();
}
| [
"erguotou525@gmail.com"
] | erguotou525@gmail.com |
e9b9e7d549f0827c2f50d178c1a4ef63fed2a46a | 0423cf9e0bace93c88a91d46620ff5fd152747ab | /algorithms/src/main/java/com/ithub/source/learn/DataStructures/Bags/Bag.java | 648e60d692846df9f88791de254a06066585b00b | [
"Apache-2.0"
] | permissive | itchenp/java-learn | 227c81c76c70810ae423deecdcf359b124c86ae5 | 9b43038a0d1c46b0c4b5db7badd4e70d5c1f8e58 | refs/heads/master | 2022-03-27T16:32:45.514087 | 2022-03-15T09:21:54 | 2022-03-15T09:21:54 | 204,019,261 | 1 | 0 | Apache-2.0 | 2022-02-14T10:40:39 | 2019-08-23T14:56:37 | Java | UTF-8 | Java | false | false | 3,174 | java | package com.ithub.source.learn.DataStructures.Bags;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Collection which does not allow removing elements (only collect and iterate)
*
* @param <Element> - the generic type of an element in this bag
*/
public class Bag<Element> implements Iterable<Element> {
private Node<Element> firstElement; // first element of the bag
private int size; // size of bag
private static class Node<Element> {
private Element content;
private Node<Element> nextElement;
}
/**
* Create an empty bag
*/
public Bag() {
firstElement = null;
size = 0;
}
/**
* @return true if this bag is empty, false otherwise
*/
public boolean isEmpty() {
return firstElement == null;
}
/**
* @return the number of elements
*/
public int size() {
return size;
}
/**
* @param element - the element to add
*/
public void add(Element element) {
Node<Element> oldfirst = firstElement;
firstElement = new Node<>();
firstElement.content = element;
firstElement.nextElement = oldfirst;
size++;
}
/**
* Checks if the bag contains a specific element
*
* @param element which you want to look for
* @return true if bag contains element, otherwise false
*/
public boolean contains(Element element) {
Iterator<Element> iterator = this.iterator();
while (iterator.hasNext()) {
if (iterator.next().equals(element)) {
return true;
}
}
return false;
}
/**
* @return an iterator that iterates over the elements in this bag in arbitrary order
*/
public Iterator<Element> iterator() {
return new ListIterator<>(firstElement);
}
@SuppressWarnings("hiding")
private class ListIterator<Element> implements Iterator<Element> {
private Node<Element> currentElement;
public ListIterator(Node<Element> firstElement) {
currentElement = firstElement;
}
public boolean hasNext() {
return currentElement != null;
}
/**
* remove is not allowed in a bag
*/
@Override
public void remove() {
throw new UnsupportedOperationException();
}
public Element next() {
if (!hasNext())
throw new NoSuchElementException();
Element element = currentElement.content;
currentElement = currentElement.nextElement;
return element;
}
}
/**
* main-method for testing
*/
public static void main(String[] args) {
Bag<String> bag = new Bag<>();
bag.add("1");
bag.add("1");
bag.add("2");
System.out.println("size of bag = " + bag.size());
for (String s : bag) {
System.out.println(s);
}
System.out.println(bag.contains(null));
System.out.println(bag.contains("1"));
System.out.println(bag.contains("3"));
}
}
| [
"2wsx3edc"
] | 2wsx3edc |
7bd08991260f43fbd14c5167962ad6b222755524 | 9108a7a71510b4a687da2cd2e521dc6d975dec1e | /alfresco/src/test/java/com/ixxus/alfresco/search/service/SearchTermFolderServiceTest.java | c48a39fbaddb98aa831f8eed9fee7d4ac10d8f34 | [] | no_license | dantuffery/search-terms-dashlet | 3c6de385f4f7918c6a1a273994f83bd2bc5aa063 | f3437df3916bfd613f03e4ead2fdce597f2c106e | refs/heads/master | 2021-01-15T16:10:20.822875 | 2013-04-01T17:21:22 | 2013-04-01T17:21:22 | 5,739,227 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,499 | java | package com.ixxus.alfresco.search.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.model.Repository;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import static org.junit.Assert.*;
import com.ixxus.alfresco.search.SearchTermTest;
import com.ixxus.alfresco.search.util.SearchConstants;
import static org.mockito.Mockito.*;
/**
* @author dantuffery
*/
@RunWith(MockitoJUnitRunner.class)
public class SearchTermFolderServiceTest implements SearchTermTest
{
private SearchTermFolderServiceImpl searchTermFolderService;
private NodeRef dummyNodeRef;
@Mock private ChildAssociationRef mockedChildAssociationRef;
@Mock private FileFolderService mockedFileFolderService;
@Mock private FileInfo mockedFileInfo;
@Mock private NodeService mockedNodeService;
@Mock private Repository mockedRepository;
@Before
public void setUp()
{
//Initalise mocks
MockitoAnnotations.initMocks(SearchTermFolderServiceTest.class);
searchTermFolderService = new SearchTermFolderServiceImpl();
searchTermFolderService.setNodeService(mockedNodeService);
searchTermFolderService.setRepository(mockedRepository);
searchTermFolderService.setFileFolderService(mockedFileFolderService);
searchTermFolderService.setSearchTermsFolderPath(SEARCH_TERMS_FOLDER_PATH);
dummyNodeRef = new NodeRef(DUMMY_NODE_REF);
List<ChildAssociationRef> children = new ArrayList<ChildAssociationRef>();
children.add(mockedChildAssociationRef);
//common mocks
when(mockedNodeService.getProperty(dummyNodeRef, ContentModel.PROP_NAME)).thenReturn(FOLDER_NAME);
when(mockedChildAssociationRef.getChildRef()).thenReturn(dummyNodeRef);
when(mockedNodeService.getChildAssocs(dummyNodeRef, ContentModel.ASSOC_CONTAINS,
RegexQNamePattern.MATCH_ALL)).thenReturn(children);
}
/**
* Test to retrieve the current daily search terms folder, will test the creation
* of a new daily folder.
*/
@Test
public void getCurrentSearchTermsFolder()
{
when(mockedNodeService.getChildAssocs(dummyNodeRef, ContentModel.ASSOC_CONTAINS,
RegexQNamePattern.MATCH_ALL)).thenReturn(new ArrayList<ChildAssociationRef>());
when(mockedFileFolderService.create(any(NodeRef.class), anyString(),
any(QName.class))).thenReturn(mockedFileInfo);
when(mockedFileInfo.getNodeRef()).thenReturn(dummyNodeRef);
NodeRef currentSearchTermsFolder = searchTermFolderService.getCurrentSearchTermsFolder(dummyNodeRef);
assertNotNull(currentSearchTermsFolder);
}
/**
* Test to ensure that an IllegalArgumentExption is thrown if a null object is
* passed as a parameter to the getCurrentSearchTermsFolder method.
*/
@Test(expected=IllegalArgumentException.class)
public void getCurrentSearchTermsFolderWithNullInput() {
searchTermFolderService.getCurrentSearchTermsFolder(null);
}
/**
* Test that ensures the daily search terms folder is created.
*/
@Test
public void getCurrentFolderNodeRef()
{
NodeRef currentFolderNodeRef = searchTermFolderService.getCurrentFolderNodeRef(dummyNodeRef, FOLDER_NAME);
assertEquals(currentFolderNodeRef, dummyNodeRef);
}
/**
* Test to ensure the folder name is in the correct format.
*/
@Test
public void getFolderName()
{
Date date = new Date();
String folderName = searchTermFolderService.getFolderName(date);
assertEquals(folderName, SearchConstants.CURRENT_SEARCH_TERMS_FOLDER_NAME_PREFIX +
SearchConstants.sdf.format(date));
}
/**
* Test to get the parent 'Search Terms' folder.
*/
@Test
public void getSearchTermsFolder()
{
when(mockedRepository.getCompanyHome()).thenReturn(dummyNodeRef);
when(mockedNodeService.getChildByName(any(NodeRef.class), any(QName.class),
anyString())).thenReturn(dummyNodeRef);
NodeRef searchTermsFolderNodeRef = searchTermFolderService.getSearchTermsFolder();
assertEquals(searchTermsFolderNodeRef, dummyNodeRef);
}
}
| [
"dan.tuffery@gmail.com"
] | dan.tuffery@gmail.com |
599ddaffad8117b052dfb73f9c84e853b2fe75a7 | d9a0e9937c2636bcc562a4e05d67ba9ffb3640df | /xc-framework/xc-service-ucenter-auth/src/main/java/com/xuecheng/auth/controller/AuthController.java | 7188cc9148985dd6a43d51072a5bbd4497d341de | [] | no_license | chrilwe/xuecheng | 2dbce54dce76a370e40fd20ca22ca501cb6c326e | 35625776678362d2a7a93001a5f5bbf4c7144be8 | refs/heads/master | 2022-12-08T14:57:12.792534 | 2019-06-18T15:44:34 | 2019-06-18T15:44:34 | 173,674,136 | 1 | 0 | null | 2022-11-24T06:26:08 | 2019-03-04T04:32:47 | Java | UTF-8 | Java | false | false | 3,398 | java | package com.xuecheng.auth.controller;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.druid.util.StringUtils;
import com.xuecheng.auth.service.AuthService;
import com.xuecheng.framework.api.AuthControllerApi;
import com.xuecheng.framework.common.exception.ExceptionCast;
import com.xuecheng.framework.common.model.response.CommonCode;
import com.xuecheng.framework.common.model.response.ResponseResult;
import com.xuecheng.framework.common.web.BaseController;
import com.xuecheng.framework.domain.ucenter.ext.AuthToken;
import com.xuecheng.framework.domain.ucenter.ext.UserTokenStore;
import com.xuecheng.framework.domain.ucenter.request.LoginRequest;
import com.xuecheng.framework.domain.ucenter.response.AuthCode;
import com.xuecheng.framework.domain.ucenter.response.LoginResult;
import com.xuecheng.framework.utils.CookieUtil;
@RestController
@RequestMapping("/")
public class AuthController extends BaseController implements AuthControllerApi {
@Autowired
private AuthService authService;
@Value("${auth.clientId}")
private String clientId;
@Value("${auth.clientSecret}")
private String clientSecret;
@Value("${auth.cookieDomain}")
private String domain;
@Value("${auth.cookieMaxAge}")
private int cookieMaxAge;
/**
* 登录认证,获取jwt令牌和身份令牌,前端将jwt令牌放到头部,身份令牌放到cookie中
*/
@Override
@PostMapping("/userlogin")
public LoginResult login(LoginRequest loginRequest) {
// 1.学成注册账号登录
AuthToken authToken = null;
String password = loginRequest.getPassword();
String username = loginRequest.getUsername();
String verifycode = loginRequest.getVerifycode();
if (StringUtils.isEmpty(verifycode)) {
return new LoginResult(AuthCode.AUTH_VERIFYCODE_NONE, null, null);// 请输入验证码
}
if (StringUtils.isEmpty(username)) {
return new LoginResult(AuthCode.AUTH_USERNAME_NONE, null, null);// 请输入账号
}
if (StringUtils.isEmpty(password)) {
return new LoginResult(AuthCode.AUTH_PASSWORD_NONE, null, null);// 请输入密码
}
// TODO 校验验证码是否正确
// 申请令牌
authToken = authService.login(username, password, clientId, clientSecret);
if (authToken == null || StringUtils.isEmpty(authToken.getAccess_token())
|| StringUtils.isEmpty(authToken.getJwt_token())) {
System.out.println("令牌申请失败");
return new LoginResult(CommonCode.SERVER_ERROR, null, null);
}
return new LoginResult(CommonCode.SUCCESS,authToken.getJwt_token(),authToken.getAccess_token());
}
/**
* 注销用户
*/
@Override
public ResponseResult logout() {
// TODO Auto-generated method stub
return null;
}
/**
* 根据身份令牌查询用户信息
*/
@Override
@GetMapping("/get/userinfo/{accessToken}")
public UserTokenStore getUserInfoByAccessToken(@PathVariable("accessToken")String accessToken) {
return authService.getUserInfoByAccessToken(accessToken, request);
}
}
| [
"1129864619@qq.com"
] | 1129864619@qq.com |
36d52c3853ceb85b0f1aa9758b85c4bfcc1025bb | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/hazelcast/2019/8/YamlConfigImportVariableReplacementTest.java | de2d4807cea673b1aac1048714ed39fe880b0748 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 28,747 | java | /*
* Copyright (c) 2008-2019, 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.config;
import com.hazelcast.config.replacer.EncryptionReplacer;
import com.hazelcast.nio.IOUtil;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.annotation.QuickTest;
import com.hazelcast.util.RootCauseMatcher;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Properties;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(HazelcastSerialClassRunner.class)
@Category(QuickTest.class)
public class YamlConfigImportVariableReplacementTest extends AbstractConfigImportVariableReplacementTest {
@Override
@Test
public void testHazelcastElementOnlyAppearsOnce() {
String yaml = ""
+ "hazelcast:\n{}"
+ "hazelcast:";
expectInvalid();
buildConfig(yaml, null);
}
@Override
@Test
public void readVariables() {
String yaml = ""
+ "hazelcast:\n"
+ " semaphore:\n"
+ " ${name}:\n"
+ " initial-permits: ${initial.permits}\n"
+ " backup-count: ${backupcount.part1}${backupcount.part2}\n";
Properties properties = new Properties();
properties.setProperty("name", "s");
properties.setProperty("initial.permits", "25");
properties.setProperty("backupcount.part1", "0");
properties.setProperty("backupcount.part2", "6");
Config config = buildConfig(yaml, properties);
SemaphoreConfig semaphoreConfig = config.getSemaphoreConfig("s");
assertEquals(25, semaphoreConfig.getInitialPermits());
assertEquals(6, semaphoreConfig.getBackupCount());
assertEquals(0, semaphoreConfig.getAsyncBackupCount());
}
@Override
@Test
public void testImportConfigFromResourceVariables() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String networkConfig = ""
+ "hazelcast:\n"
+ " network:\n"
+ " join:\n"
+ " multicast:\n"
+ " enabled: false\n"
+ " tcp-ip:\n"
+ " enabled: true\n";
writeStringToStreamAndClose(os, networkConfig);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - ${config.location}\n";
Config config = buildConfig(yaml, "config.location", file.getAbsolutePath());
JoinConfig join = config.getNetworkConfig().getJoin();
assertFalse(join.getMulticastConfig().isEnabled());
assertTrue(join.getTcpIpConfig().isEnabled());
}
@Override
@Test
public void testImportedConfigVariableReplacement() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String networkConfig = ""
+ "hazelcast:\n"
+ " network:\n"
+ " join:\n"
+ " multicast:\n"
+ " enabled: false\n"
+ " tcp-ip:\n"
+ " enabled: ${tcp.ip.enabled}\n";
writeStringToStreamAndClose(os, networkConfig);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - ${config.location}";
Properties properties = new Properties();
properties.setProperty("config.location", file.getAbsolutePath());
properties.setProperty("tcp.ip.enabled", "true");
Config config = buildConfig(yaml, properties);
JoinConfig join = config.getNetworkConfig().getJoin();
assertFalse(join.getMulticastConfig().isEnabled());
assertTrue(join.getTcpIpConfig().isEnabled());
}
@Override
@Test
public void testTwoResourceCyclicImportThrowsException() throws Exception {
File config1 = createConfigFile("hz1", "yaml");
File config2 = createConfigFile("hz2", "yaml");
FileOutputStream os1 = new FileOutputStream(config1);
FileOutputStream os2 = new FileOutputStream(config2);
String config1Yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///" + config2.getAbsolutePath();
String config2Yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///" + config1.getAbsolutePath();
writeStringToStreamAndClose(os1, config1Yaml);
writeStringToStreamAndClose(os2, config2Yaml);
expectInvalid();
buildConfig(config1Yaml, null);
}
@Override
@Test
public void testThreeResourceCyclicImportThrowsException() throws Exception {
String template = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///%s";
File config1 = createConfigFile("hz1", "yaml");
File config2 = createConfigFile("hz2", "yaml");
File config3 = createConfigFile("hz3", "yaml");
String config1Yaml = String.format(template, config2.getAbsolutePath());
String config2Yaml = String.format(template, config3.getAbsolutePath());
String config3Yaml = String.format(template, config1.getAbsolutePath());
writeStringToStreamAndClose(new FileOutputStream(config1), config1Yaml);
writeStringToStreamAndClose(new FileOutputStream(config2), config2Yaml);
writeStringToStreamAndClose(new FileOutputStream(config3), config3Yaml);
expectInvalid();
buildConfig(config1Yaml, null);
}
@Override
@Test
public void testImportEmptyResourceContent() throws Exception {
File config1 = createConfigFile("hz1", "yaml");
FileOutputStream os1 = new FileOutputStream(config1);
String config1Yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///" + config1.getAbsolutePath();
writeStringToStreamAndClose(os1, "%invalid-yaml");
expectInvalid();
buildConfig(config1Yaml, null);
}
@Override
@Test
public void testImportEmptyResourceThrowsException() {
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - \"\"";
expectInvalid();
buildConfig(yaml, null);
}
@Override
@Test
public void testImportNotExistingResourceThrowsException() {
expectInvalid();
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - notexisting.yaml";
buildConfig(yaml, null);
}
@Override
@Test
public void testImportNetworkConfigFromFile() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String networkConfig = ""
+ "hazelcast:\n"
+ " network:\n"
+ " join:\n"
+ " multicast:\n"
+ " enabled: false\n"
+ " tcp-ip:\n"
+ " enabled: true\n";
writeStringToStreamAndClose(os, networkConfig);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///" + file.getAbsolutePath();
Config config = buildConfig(yaml, null);
JoinConfig join = config.getNetworkConfig().getJoin();
assertFalse(join.getMulticastConfig().isEnabled());
assertTrue(join.getTcpIpConfig().isEnabled());
}
@Override
@Test
public void testImportMapConfigFromFile() throws Exception {
File file = createConfigFile("mymap", "config");
FileOutputStream os = new FileOutputStream(file);
String mapConfig = ""
+ "hazelcast:\n"
+ " map:\n"
+ " mymap:\n"
+ " backup-count: 6\n"
+ " time-to-live-seconds: 10\n"
+ " map-store:\n"
+ " enabled: true\n"
+ " initial-mode: LAZY\n"
+ " class-name: com.hazelcast.examples.MyMapStore\n"
+ " write-delay-seconds: 10\n"
+ " write-batch-size: 100\n";
writeStringToStreamAndClose(os, mapConfig);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///" + file.getAbsolutePath();
Config config = buildConfig(yaml, null);
MapConfig myMapConfig = config.getMapConfig("mymap");
assertEquals("mymap", myMapConfig.getName());
assertEquals(6, myMapConfig.getBackupCount());
assertEquals(10, myMapConfig.getTimeToLiveSeconds());
MapStoreConfig myMapStoreConfig = myMapConfig.getMapStoreConfig();
assertEquals(10, myMapStoreConfig.getWriteDelaySeconds());
assertEquals(100, myMapStoreConfig.getWriteBatchSize());
assertEquals("com.hazelcast.examples.MyMapStore", myMapStoreConfig.getClassName());
}
@Override
@Test
public void testImportOverlappingMapConfigFromFile() throws Exception {
File file = createConfigFile("mymap", "config");
FileOutputStream os = new FileOutputStream(file);
String mapConfig = ""
+ "hazelcast:\n"
+ " map:\n"
+ " mymap:\n"
+ " backup-count: 6\n"
+ " map-store:\n"
+ " enabled: true\n"
+ " initial-mode: LAZY\n"
+ " class-name: com.hazelcast.examples.MyMapStore\n"
+ " write-delay-seconds: 10\n"
+ " write-batch-size: 100\n";
writeStringToStreamAndClose(os, mapConfig);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///" + file.getAbsolutePath() + "\n"
+ " map:\n"
+ " mymap:\n"
+ " time-to-live-seconds: 10\n";
Config config = buildConfig(yaml, null);
MapConfig myMapConfig = config.getMapConfig("mymap");
assertEquals("mymap", myMapConfig.getName());
assertEquals(6, myMapConfig.getBackupCount());
assertEquals(10, myMapConfig.getTimeToLiveSeconds());
MapStoreConfig myMapStoreConfig = myMapConfig.getMapStoreConfig();
assertEquals(10, myMapStoreConfig.getWriteDelaySeconds());
assertEquals(100, myMapStoreConfig.getWriteBatchSize());
assertEquals("com.hazelcast.examples.MyMapStore", myMapStoreConfig.getClassName());
}
@Override
public void testMapConfigFromMainAndImportedFile() throws Exception {
File file = createConfigFile("importmap", "config");
FileOutputStream os = new FileOutputStream(file);
String mapConfig = ""
+ "hazelcast:\n"
+ " map:\n"
+ " importedMap:\n"
+ " backup-count: 6\n"
+ " time-to-live-seconds: 10\n"
+ " map-store:\n"
+ " enabled: true\n"
+ " initial-mode: LAZY\n"
+ " class-name: com.hazelcast.examples.MyMapStore\n"
+ " write-delay-seconds: 10\n"
+ " write-batch-size: 100\n";
writeStringToStreamAndClose(os, mapConfig);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///" + file.getAbsolutePath() + "\n"
+ " map:\n"
+ " mapInMain:\n"
+ " backup-count: 2\n"
+ " time-to-live-seconds: 5\n";
Config config = buildConfig(yaml, null);
MapConfig mapInMainMapConfig = config.getMapConfig("mapInMain");
assertEquals("mapInMain", mapInMainMapConfig.getName());
assertEquals(5, mapInMainMapConfig.getTimeToLiveSeconds());
assertEquals(2, mapInMainMapConfig.getBackupCount());
MapConfig importedMap = config.getMapConfig("importedMap");
assertEquals("importedMap", importedMap.getName());
assertEquals(10, importedMap.getTimeToLiveSeconds());
assertEquals(6, importedMap.getBackupCount());
MapStoreConfig myMapStoreConfig = importedMap.getMapStoreConfig();
assertEquals(10, myMapStoreConfig.getWriteDelaySeconds());
assertEquals(100, myMapStoreConfig.getWriteBatchSize());
assertEquals("com.hazelcast.examples.MyMapStore", myMapStoreConfig.getClassName());
}
@Override
@Test
public void testImportGroupConfigFromClassPath() {
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - classpath:test-hazelcast.yaml";
Config config = buildConfig(yaml, null);
GroupConfig groupConfig = config.getGroupConfig();
assertEquals("foobar-yaml", groupConfig.getName());
assertEquals("dev-pass", groupConfig.getPassword());
}
@Override
@Test
public void testReplacers() throws Exception {
File passwordFile = tempFolder.newFile(getClass().getSimpleName() + ".pwd");
PrintWriter out = new PrintWriter(passwordFile);
try {
out.print("This is a password");
} finally {
IOUtil.closeResource(out);
}
String yaml = ""
+ "hazelcast:\n"
+ " config-replacers:\n"
+ " replacers:\n"
+ " - class-name: " + EncryptionReplacer.class.getName() + "\n"
+ " properties:\n"
+ " passwordFile: " + passwordFile.getAbsolutePath() + "\n"
+ " passwordUserProperties: false\n"
+ " keyLengthBits: 64\n"
+ " saltLengthBytes: 8\n"
+ " cipherAlgorithm: DES\n"
+ " secretKeyFactoryAlgorithm: PBKDF2WithHmacSHA1\n"
+ " secretKeyAlgorithm: DES\n"
+ " - class-name: " + IdentityReplacer.class.getName() + "\n"
+ " group:\n"
+ " name: ${java.version} $ID{dev}\n"
+ " password: $ENC{7JX2r/8qVVw=:10000:Jk4IPtor5n/vCb+H8lYS6tPZOlCZMtZv}\n";
GroupConfig groupConfig = buildConfig(yaml, System.getProperties()).getGroupConfig();
assertEquals(System.getProperty("java.version") + " dev", groupConfig.getName());
assertEquals("My very secret secret", groupConfig.getPassword());
}
@Override
@Test(expected = InvalidConfigurationException.class)
public void testMissingReplacement() {
String yaml = ""
+ "hazelcast:\n"
+ " config-replacers:\n"
+ " replacers:\n"
+ " - class-name: " + EncryptionReplacer.class.getName() + "\n"
+ " group:\n"
+ " name: $ENC{7JX2r/8qVVw=:10000:Jk4IPtor5n/vCb+H8lYS6tPZOlCZMtZv}";
buildConfig(yaml, System.getProperties());
}
@Override
@Test
public void testBadVariableSyntaxIsIgnored() {
String yaml = ""
+ "hazelcast:\n"
+ " group:\n"
+ " name: ${noSuchPropertyAvailable]";
GroupConfig groupConfig = buildConfig(yaml, System.getProperties()).getGroupConfig();
assertEquals("${noSuchPropertyAvailable]", groupConfig.getName());
}
@Override
@Test
public void testReplacerProperties() {
String yaml = ""
+ "hazelcast:\n"
+ " config-replacers:\n"
+ " fail-if-value-missing: false\n"
+ " replacers:\n"
+ " - class-name: " + TestReplacer.class.getName() + "\n"
+ " properties:\n"
+ " p1: a property\n"
+ " p2: \"\"\n"
+ " p3: another property\n"
+ " p4: <test/>\n"
+ " group:\n"
+ " name: $T{p1} $T{p2} $T{p3} $T{p4} $T{p5}\n";
GroupConfig groupConfig = buildConfig(yaml, System.getProperties()).getGroupConfig();
assertEquals("a property another property <test/> $T{p5}", groupConfig.getName());
}
/**
* Given: No replacer is used in the configuration file<br>
* When: A property variable is used within the file<br>
* Then: The configuration parsing doesn't fail and the variable string remains unchanged (i.e. backward compatible
* behavior, as if {@code fail-if-value-missing} attribute is {@code false}).
*/
@Override
@Test
public void testNoConfigReplacersMissingProperties() {
String yaml = ""
+ "hazelcast:\n"
+ " group:\n"
+ " name: ${noSuchPropertyAvailable}";
GroupConfig groupConfig = buildConfig(yaml, System.getProperties()).getGroupConfig();
assertEquals("${noSuchPropertyAvailable}", groupConfig.getName());
}
@Override
@Test
public void testVariableReplacementAsSubstring() {
String yaml = ""
+ "hazelcast:\n"
+ " properties:\n"
+ " ${env}-with-suffix: local-with-suffix\n"
+ " with-prefix-${env}: with-prefix-local";
Config config = buildConfig(yaml, "env", "local");
assertEquals("local-with-suffix", config.getProperty("local-with-suffix"));
assertEquals("with-prefix-local", config.getProperty("with-prefix-local"));
}
@Override
@Test
public void testImportWithVariableReplacementAsSubstring() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String networkConfig = ""
+ "hazelcast:\n"
+ " properties:\n"
+ " prop1: value1\n"
+ " prop2: value2\n";
writeStringToStreamAndClose(os, networkConfig);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - file:///" + "${file}";
Config config = buildConfig(yaml, "file", file.getAbsolutePath());
assertEquals("value1", config.getProperty("prop1"));
assertEquals("value2", config.getProperty("prop2"));
}
@Test
public void testImportNoHazelcastRootNode() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String importedYaml = ""
+ "properties:\n"
+ " prop1: value1\n"
+ " prop2: value2\n";
writeStringToStreamAndClose(os, importedYaml);
String yaml = ""
+ "import:\n"
+ " - file:///" + "${file}\n"
+ "instance-name: my-instance";
Config config = buildConfig(yaml, "file", file.getAbsolutePath());
assertEquals("my-instance", config.getInstanceName());
assertEquals("value1", config.getProperty("prop1"));
assertEquals("value2", config.getProperty("prop2"));
}
@Override
@Test
public void testReplaceVariablesWithFileSystemConfig() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String configYaml = ""
+ "hazelcast:\n"
+ " properties:\n"
+ " prop: ${variable}";
writeStringToStreamAndClose(os, configYaml);
Properties properties = new Properties();
properties.put("variable", "foobar");
Config config = new FileSystemYamlConfig(file, properties);
assertEquals("foobar", config.getProperty("prop"));
}
@Override
@Test
public void testReplaceVariablesWithInMemoryConfig() {
String configYaml = ""
+ "hazelcast:\n"
+ " properties:\n"
+ " prop: ${variable}";
Properties properties = new Properties();
properties.put("variable", "foobar");
Config config = new InMemoryYamlConfig(configYaml, properties);
assertEquals("foobar", config.getProperty("prop"));
}
@Override
@Test
public void testReplaceVariablesWithClasspathConfig() {
Properties properties = new Properties();
properties.put("variable", "foobar");
Config config = new ClasspathYamlConfig("test-hazelcast-variable.yaml", properties);
assertEquals("foobar", config.getProperty("prop"));
}
@Override
@Test
public void testReplaceVariablesWithUrlConfig() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String configYaml = ""
+ "hazelcast:\n"
+ " properties:\n"
+ " prop: ${variable}";
writeStringToStreamAndClose(os, configYaml);
Properties properties = new Properties();
properties.put("variable", "foobar");
Config config = new UrlYamlConfig("file:///" + file.getPath(), properties);
assertEquals("foobar", config.getProperty("prop"));
}
@Override
@Test
public void testReplaceVariablesUseSystemProperties() {
String configYaml = ""
+ "hazelcast:\n"
+ " properties:\n"
+ " prop: ${variable}";
System.setProperty("variable", "foobar");
Config config = buildConfig(configYaml);
assertEquals("foobar", config.getProperty("prop"));
}
@Test
public void testImportRedefinesSameConfigScalarThrows() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String importedYaml = ""
+ "hazelcast:\n"
+ " group:\n"
+ " name: name1";
writeStringToStreamAndClose(os, importedYaml);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - ${config.location}\n"
+ " group:\n"
+ " name: name2";
rule.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/group/name"));
buildConfig(yaml, "config.location", file.getAbsolutePath());
}
@Test
public void testImportSameScalarConfig() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String importedYaml = ""
+ "hazelcast:\n"
+ " group:\n"
+ " name: name";
writeStringToStreamAndClose(os, importedYaml);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - ${config.location}\n"
+ " group:\n"
+ " name: name";
Config config = buildConfig(yaml, "config.location", file.getAbsolutePath());
assertEquals("name", config.getGroupConfig().getName());
}
@Test
public void testImportNodeScalarVsSequenceThrows() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String importedYaml = ""
+ "hazelcast:\n"
+ " group:\n"
+ " name: name1";
writeStringToStreamAndClose(os, importedYaml);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - ${config.location}\n"
+ " group:\n"
+ " name:\n"
+ " - seqName: {}";
rule.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/group/name"));
buildConfig(yaml, "config.location", file.getAbsolutePath());
}
@Test
public void testImportNodeScalarVsMappingThrows() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String importedYaml = ""
+ "hazelcast:\n"
+ " group:\n"
+ " name: name1";
writeStringToStreamAndClose(os, importedYaml);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - ${config.location}\n"
+ " group:\n"
+ " name: {}";
rule.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/group/name"));
buildConfig(yaml, "config.location", file.getAbsolutePath());
}
@Test
public void testImportNodeSequenceVsMappingThrows() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String importedYaml = ""
+ "hazelcast:\n"
+ " group:\n"
+ " name:\n"
+ " - seqname";
writeStringToStreamAndClose(os, importedYaml);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - ${config.location}\n"
+ " group:\n"
+ " name: {}";
rule.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/group/name"));
buildConfig(yaml, "config.location", file.getAbsolutePath());
}
@Test
public void testImportNodeSequenceVsSequenceMerges() throws Exception {
File file = createConfigFile("foo", "bar");
FileOutputStream os = new FileOutputStream(file);
String importedYaml = ""
+ "hazelcast:\n"
+ " listeners:\n"
+ " - com.hazelcast.examples.MembershipListener\n";
writeStringToStreamAndClose(os, importedYaml);
String yaml = ""
+ "hazelcast:\n"
+ " import:\n"
+ " - ${config.location}\n"
+ " listeners:\n"
+ " - com.hazelcast.examples.MigrationListener\n";
Config config = buildConfig(yaml, "config.location", file.getAbsolutePath());
List<ListenerConfig> listenerConfigs = config.getListenerConfigs();
assertEquals(2, listenerConfigs.size());
for (ListenerConfig listenerConfig : listenerConfigs) {
assertTrue("com.hazelcast.examples.MembershipListener".equals(listenerConfig.getClassName())
|| "com.hazelcast.examples.MigrationListener".equals(listenerConfig.getClassName()));
}
}
private static Config buildConfig(String yaml) {
ByteArrayInputStream bis = new ByteArrayInputStream(yaml.getBytes());
YamlConfigBuilder configBuilder = new YamlConfigBuilder(bis);
return configBuilder.build();
}
private static Config buildConfig(String yaml, Properties properties) {
ByteArrayInputStream bis = new ByteArrayInputStream(yaml.getBytes());
YamlConfigBuilder configBuilder = new YamlConfigBuilder(bis);
configBuilder.setProperties(properties);
return configBuilder.build();
}
private static Config buildConfig(String yaml, String key, String value) {
Properties properties = new Properties();
properties.setProperty(key, value);
return buildConfig(yaml, properties);
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
197de5288e53123f10d3dd13e24f3fa2083540be | 88e87ac43ee0e342b966d5d9bc1a7b093dbc00c8 | /Assignments/src/Assignment_12.java | fbeec00e2c7f2839c2afc17c49bf8d5c1785ee20 | [] | no_license | yasar-oz/java2 | c305ea825ffa97c92375fad63c3b6a72a0c9cb58 | 814f67357775ba71d11c27b47f8ae74b7dd1c780 | refs/heads/master | 2020-04-07T17:55:23.428153 | 2018-11-24T02:53:52 | 2018-11-24T02:53:52 | 158,589,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,456 | java | //Write a method called printNumberInWord
//
//This method should have one parameter called number which a whole number(type int)
//
//The method needs to print "ZERO" if the number parameter is passed with the value of 0
//The method needs to print "ONE" if the number parameter is passed with the value of 0
//The method needs to print "TWO" if the number parameter is passed with the value of 0
//
//... and so on up to and including "NINE" if the number parameter is passed with the value of 9
//
//If the number parameter has any other value than 0 to 9, then the method should print "OTHER"
public class Assignment_12 {
public static void main(String[] args) {
// TODO Auto-generated method stub
printNumberInWord (1);
printNumberInWord (3);
printNumberInWord (7);
printNumberInWord (11);
}
public static void printNumberInWord(int number) {
switch (number) {
case 0:
System.out.println("ZERO");
break;
case 1:
System.out.println("ONE");
break;
case 2:
System.out.println("TWO");
break;
case 3:
System.out.println("THREE");
break;
case 4:
System.out.println("FOUR");
break;
case 5:
System.out.println("FIVE");
break;
case 6:
System.out.println("SIX");
break;
case 7:
System.out.println("SEVEN");
break;
case 8:
System.out.println("EIGHT");
break;
case 9:
System.out.println("NINE");
break;
default:
System.out.println("OTHER");
}
}
}
| [
"yasarozen111@gmail.com"
] | yasarozen111@gmail.com |
f79cdd80e2bbe3b057fa55c53ecedee6253e7d38 | 4ae0f15e3c0b246cee270538ed95cb45d81da7c4 | /src/spiffy.java | bf1d05a511caa5262e34a00048e13b286a4a397c | [] | no_license | ca2longoria/spiffy | 481157badc4e930df2b6c88dfc498e763f76f85f | fbc838340980436c8cd798d0051a7bb3def80a17 | refs/heads/master | 2016-09-05T08:51:55.497027 | 2013-12-06T06:44:04 | 2013-12-06T06:44:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 939 | java | import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import net.synapsehaven.spiffy.Spiffy;
public class spiffy
{
public static final int defaultPort = 1337;
public static void main(String[] args)
{
Spiffy spiff = new Spiffy.Web()
{
public Object handleConnection(InputStream in, OutputStream out)
{
RequestHeader rq = (RequestHeader)super.handleConnection(in, out);
if (!rq.success) return null;
System.out.println(rq.method);
System.out.println(rq.uri);
System.out.println(rq.host);
String content = "<body>Hey there?</body>";
PrintWriter pout = new PrintWriter(out);
pout.println("HTTP/1.1 200 OK");
pout.println("Content-Type: text/html");
pout.println("Content-Length: "+content.length());
pout.println();
pout.println(content);
pout.flush();
return rq;
}
};
spiff.listen(spiffy.defaultPort);
}
}
| [
"ca2longoria@gmail.com"
] | ca2longoria@gmail.com |
dca7e1fda50e5e18dc8049a7706994918861fe50 | f2baf519b27ac663f434e4d20ed1b2a46a8ececa | /src/main/java/com/ftc/gedoc/utiles/comparators/CEPComparatorPorFecha.java | 3512cfeca3fec20548498131f6ce0ffe74db927a | [] | no_license | cafaray/ftcdev-ctrldoce | 71a09d622d0235feb0cfb6b29cead5600d6630ab | 83230c7b6c2b4b63a70d1829dda4cedec887d42c | refs/heads/development | 2021-06-26T06:32:57.495040 | 2018-05-22T18:37:27 | 2018-05-22T18:37:27 | 134,196,137 | 0 | 0 | null | 2018-05-21T12:46:35 | 2018-05-20T23:47:19 | Java | UTF-8 | Java | false | false | 319 | java | package com.ftc.gedoc.utiles.comparators;
import com.ftc.modelo.CEPArchivo;
import java.util.Comparator;
public class CEPComparatorPorFecha implements Comparator<CEPArchivo>{
@Override
public int compare(CEPArchivo o1, CEPArchivo o2) {
return o1.getFecha().compareTo(o2.getFecha());
}
}
| [
"omash@MacBook-Pro-de-Carlos.local"
] | omash@MacBook-Pro-de-Carlos.local |
d2eb8625bea566e3bdd1d89292c55fd582c756f6 | 98729e3cea0095ededfeac8d39586aeda85f85d3 | /whatsappdoc-master/whatsappdoc-master/src/main/java/whatsappdoc/wad/controllers/ContaController.java | 3eaf11915479f2f50df84fbce8bcc2f9de52f118 | [] | no_license | carlosmfmartins/whatsappdoc | e4f3effd491308c6dc600fe42e0cbac7c41f4f5a | 1d340eb31555961a863c47711887b5fc9999db51 | refs/heads/master | 2020-04-12T12:20:46.907425 | 2018-12-19T20:47:08 | 2018-12-19T20:47:08 | 162,488,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package whatsappdoc.wad.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import whatsappdoc.wad.models.perfil.Conta;
import whatsappdoc.wad.service.ContaServiceIF;
@RestController
@RequestMapping("/conta") // http://localhost:8080/conta
public class ContaController {
@Autowired
private ContaServiceIF conta_Service;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody Iterable<Conta> getAllConta() {return conta_Service.findAll();}
}
| [
"noreply@github.com"
] | noreply@github.com |
e91f8e31ed72df2d830c1ea781e66a245b6267b8 | 423b02413ccc5b3668a135fffed7b362107307fa | /Functions – Array type/Main.java | 9f371c261293ea01ad536aba9fa24f46aabef952 | [] | no_license | eswarlalkrishna/Playground | 24d3a8fac10bb27eac973ade83c3e25ce33392f5 | 6e20f035f432cb50e54dfd77c44f455fd583547a | refs/heads/master | 2023-08-03T23:36:07.077448 | 2021-09-08T09:30:18 | 2021-09-08T09:30:18 | 272,705,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | #include<iostream>
using namespace std;
int main() {
int n, count = 0 , evencount = 0, oddcount = 0;
cout << "Enter the number of elements in the array" << endl;
cin >> n; int a[n];
cout << "Enter the elements in the array" << endl;
for (int i = 0; i < n; i++){
cin >> a[i];
count += 1;
if(a[i]%2 == 0) evencount += 1;
else oddcount += 1;
}
if(count == evencount) cout << "The array is Even" <<endl;
else if(count == oddcount) cout << "The array is Odd" <<endl;
//else cout << "The array
else cout << "The array is Mixed" <<endl;
return 0;
} | [
"62464277+eswarlalkrishna@users.noreply.github.com"
] | 62464277+eswarlalkrishna@users.noreply.github.com |
e8b851d5c912c588c067e8cd2b8fc519fbe9208d | 01e25b532e9468fd35330266de10183a99a3dc15 | /commons-dict-wiktionary/src/main/java/org/swtk/commons/dict/wiktionary/generated/t/a/f/WiktionaryTAF000.java | ec6184748e984285ef0fe697bd89929aaf051bf6 | [
"Apache-2.0"
] | permissive | torrances/swtk-commons | a3f95206204becf138718e297f2bb939c65cafa5 | 78ee97835e4437d91fd4ba0cf6ccab40be5c8889 | refs/heads/master | 2021-01-17T11:31:27.004328 | 2016-01-07T17:26:09 | 2016-01-07T17:26:09 | 43,841,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,302 | java | package org.swtk.commons.dict.wiktionary.generated.t.a.f; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.swtk.common.dict.dto.wiktionary.Entry; import com.trimc.blogger.commons.utils.GsonUtils; public class WiktionaryTAF000 { private static Map<String, Entry> map = new HashMap<String, Entry>(); static { add("taffy", "{\"term\":\"taffy\", \"etymology\":{\"influencers\":[], \"languages\":[], \"text\":\"{{rfe|lang\u003den}}\"}, \"definitions\":{\"list\":[{\"upperType\":\"NOUN\", \"text\":\"A soft, chewy candy made from boiled molasses or brown sugar\", \"priority\":1}]}, \"synonyms\":{}}");
add("taffia", "{\"term\":\"taffia\", \"etymology\":{\"influencers\":[], \"languages\":[], \"text\":\"{{blend|Taff|mafia|lang\u003den}}\"}, \"definitions\":{\"list\":[{\"upperType\":\"NOUN\", \"text\":\"Any group of Welsh people who practice nepotism or live in an ethnic enclave\", \"priority\":1}]}, \"synonyms\":{}}");
} private static void add(String term, String json) { map.put(term, GsonUtils.toObject(json, Entry.class)); } public static Entry get(String term) { return map.get(term); } public static boolean has(String term) { return null != get(term); } public static Collection<String> terms() { return map.keySet(); } } | [
"cmtrim@us.ibm.com"
] | cmtrim@us.ibm.com |
b17fdc72abeee176986b55907517d4942b7f0eb0 | 7819115c054ff92b3955e094ecd17abebb4cca42 | /app/src/main/java/com/colsubsidio/arprueba/VideoActivity.java | b388f2919daf396f6c5e3f5e866fad85084c1b06 | [] | no_license | VictorBejarano/realidad-aumentada-colsubsidio | 02be5895c870170d070efed1bf133273595c2081 | ac6513cbc152d112094d4583928d8c2e4639d8e6 | refs/heads/master | 2022-04-03T21:33:58.807036 | 2019-07-02T22:04:18 | 2019-07-02T22:04:18 | 192,002,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,692 | java | package com.colsubsidio.arprueba;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.media.MediaPlayer;
import android.media.VolumeShaper;
import android.net.Uri;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.VideoView;
import com.colsubsidio.arprueba.augmentedimage.AugmentedImageActivity;
public class VideoActivity extends AppCompatActivity {
public VideoView videoFull;
private MediaPlayer mediaPlayer;
private int display_mode = 0;
private float scX = 0.0f;
private float ratioDisplay = 0.0f;
private float ratioVideo = 0.0f;
private SeekBar seekVideo;
private ImageButton buttonPlay;
public boolean conD = true;
public boolean conD2 = true;
Bundle datos;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
seekVideo = findViewById(R.id.seekvideo);
buttonPlay = findViewById(R.id.buttonplayvideo);
datos = getIntent().getExtras();
Integer continueVideo = datos.getInt("stateVideo");
Integer numVideo = datos.getInt("numVideo");
Log.e("VideoActivity" , "loco " + String.valueOf(numVideo));
videoFull = findViewById(R.id.videofull);
String path = "android.resource://" + getPackageName() + "/" + R.raw.video;
if(numVideo == 0){
path = "android.resource://" + getPackageName() + "/" + R.raw.video;
mediaPlayer = MediaPlayer.create(this, R.raw.video);
}
if(numVideo == 2){
path = "android.resource://" + getPackageName() + "/" + R.raw.video2;
mediaPlayer = MediaPlayer.create(this, R.raw.video2);
}
Uri uri = Uri.parse(path);
videoFull.setVideoURI(uri);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
display_mode = getResources().getConfiguration().orientation;
ratioDisplay = Float.valueOf(metrics.widthPixels) / Float.valueOf(metrics.heightPixels);
ratioVideo = Float.valueOf(mediaPlayer.getVideoWidth()) / Float.valueOf(mediaPlayer.getVideoHeight());
if(display_mode == Configuration.ORIENTATION_LANDSCAPE){
if(ratioDisplay >= ratioVideo){
scX = Float.valueOf(metrics.heightPixels) / Float.valueOf(mediaPlayer.getVideoHeight());
} else {
scX = Float.valueOf(metrics.widthPixels) / Float.valueOf(mediaPlayer.getVideoWidth());
}
} else if(display_mode == Configuration.ORIENTATION_PORTRAIT) {
scX = 1;
if(mediaPlayer.getVideoWidth() >= metrics.widthPixels){
scX = 1.0f;
} else {
scX = Float.valueOf(metrics.widthPixels) / Float.valueOf(mediaPlayer.getVideoWidth());
}
}
videoFull.setScaleX(scX);
videoFull.setScaleY(scX);
videoFull.seekTo(continueVideo);
videoFull.start();
buttonPlay.setImageResource(R.drawable.ic_button_pause);
new AsyncTaskVerificator().execute();
}
public void playButton(View view){
if(conD2) {
videoFull.pause();
buttonPlay.setImageResource(R.drawable.ic_button_play);
conD2=false;
}else{
videoFull.start();
buttonPlay.setImageResource(R.drawable.ic_button_pause);
conD2=true;
// if(!conD9){
// new AugmentedImageActivity.AsyncTaskVerificatorC().execute();
// }
}
}
public void exitFullButton(View view) {
// Intent intent = new Intent(this, AugmentedImageActivity.class);
// startActivity(intent);
exitFunction(videoFull.getCurrentPosition(),false);
}
public void exitButton(View view){
exitFunction(videoFull.getDuration(),true);
}
public void exitFunction(int duration ,boolean conditionVideo){
Bundle bundle = new Bundle();
bundle.putInt("continuar Video", duration);
bundle.putBoolean("video Condicional", conditionVideo);
Intent i = getIntent();
i.putExtras(bundle);
Log.e("VideoActivity", "Bun A " + String.valueOf(videoFull.getCurrentPosition()));
setResult(RESULT_OK, i);
videoFull.pause();
finish();
}
private class AsyncTaskVerificator extends AsyncTask<String,Integer,String> {
@Override
protected String doInBackground(String... strings) {
conD = true;
while (conD) {
try {
//Log.e(TAG, "Boom " + seekAudio.getProgress());
seekVideo.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
videoFull.pause();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
videoFull.seekTo(seekVideo.getProgress());
// if(conD8) {
videoFull.start();
// }
}
});
if(videoFull.isPlaying()) {
seekVideo.setMax(videoFull.getDuration());
seekVideo.setProgress(videoFull.getCurrentPosition());
//
if ((videoFull.getCurrentPosition() >= videoFull.getDuration())) {
// buttonPlay.setImageResource(R.drawable.ic_button_play);
exitFunction(videoFull.getCurrentPosition(),true);
conD = false;
//conD2=false;
// seekAudio.setProgress(0);
//// animPlay();
}
}
}
catch (Exception e) {
return e.getLocalizedMessage();
}
}
return "Button Pressed";
}
}
}
| [
"alejandrobjrn4@gmail.com"
] | alejandrobjrn4@gmail.com |
651da86967ae555099cf4cdc5a02e78c63609841 | ab9940be19df4f51bc90f643e4c80f24fd792086 | /CProg1/Prog1/Chap3_BooleanEx4.java | 0024bcaac67aa37190e909c961619e0a727a9e25 | [] | no_license | constanzacabrera/GitHub | 49338289cd23b460eaa8249f9533b5aae996f97d | 27134ece773721a24a8594016c40eba9c3261568 | refs/heads/master | 2021-07-23T00:27:51.393308 | 2017-11-02T18:08:52 | 2017-11-02T18:08:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | //Write an if-else statement that assigns 0.10 to commission unless sales is greater than
//or equal to 50000.0, in which case if assigns 0.2 to commision.
import java.util.Scanner;
public class Chap3_BooleanEx4
{
public static void main(String[] args)
{
double sales;
double commission;
Scanner keyboard = new Scanner(System. in);
System.out.println("Input a value for y");
y = keyboard.nextInt();
if (y == 100)
x = 1;
else
x = 0;
System.out.println("x = " + x + " y = " + y);
return;
}
} | [
"33143002+econavy-c@users.noreply.github.com"
] | 33143002+econavy-c@users.noreply.github.com |
44b10a5ba82b626a630590a19dbdd2344b6c67db | 928f40cf71e893a39a6de841b0bdb442f5ea1c07 | /mall-coupon/src/main/java/com/jinunn/mall/coupon/dao/MemberPriceDao.java | 9606fe377330773f46e2ee6add4cafcae2d94baf | [
"Apache-2.0"
] | permissive | jinunn/JinMall | d0598754f278c75434665cf9e8221a2e095f0a41 | 8bc2aa2743bd83a87012848c2a38b94e956a1d95 | refs/heads/main | 2023-07-10T06:06:59.936783 | 2021-06-16T16:40:09 | 2021-06-16T16:40:09 | 373,015,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.jinunn.mall.coupon.dao;
import com.jinunn.mall.coupon.entity.MemberPriceEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 商品会员价格
*
* @author jinunn
* @email 372138750@qq.com
* @date 2021-06-03 00:17:32
*/
@Mapper
public interface MemberPriceDao extends BaseMapper<MemberPriceEntity> {
}
| [
"372138750@qq.com"
] | 372138750@qq.com |
519ef2160cf3903c92dd9296669284dbf85398c9 | 373b4aed5b37a9f0635995d582ebcbb91c4dbbc8 | /src/main/java/com/example/workflowdemo/VacationRequest.java | dd6b8abbe9ee3d80921b2419ae4a77101577485c | [] | no_license | ekalya/activitiworkflowexample | 4934e1f5eec963ebdea9da30651b532dd2db49cf | e9cb2d9dc6f8c4dd2ad9428445734bf95f69484b | refs/heads/master | 2020-05-31T09:35:01.063152 | 2019-06-07T18:37:56 | 2019-06-07T18:37:56 | 190,215,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,577 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.example.workflowdemo;
import java.io.Serializable;
/**
*
* @author exk
*/
public class VacationRequest implements Serializable {
private String employeeName;
private Long numberOfDays;
private String vacationMotivation;
private String approver;
private String updateKey;
private String owner;
public VacationRequest() {
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public Long getNumberOfDays() {
return numberOfDays;
}
public void setNumberOfDays(Long numberOfDays) {
this.numberOfDays = numberOfDays;
}
public String getVacationMotivation() {
return vacationMotivation;
}
public void setVacationMotivation(String vacationMotivation) {
this.vacationMotivation = vacationMotivation;
}
public String getApprover() {
return approver;
}
public void setApprover(String approver) {
this.approver = approver;
}
public String getUpdateKey() {
return updateKey;
}
public void setUpdateKey(String updateKey) {
this.updateKey = updateKey;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
}
| [
"exk@cyberren.com"
] | exk@cyberren.com |
2e8834fa7c9e01f8c519dd07926323fcfe3c6b22 | 2dbd7e9640e5bf450d4f06303295a0fafc6bbd1b | /app/src/androidTest/java/com/example/admin/staggeredrecyclerviewexample/ExampleInstrumentedTest.java | 4cf0ec5a4a2fb7604d9a932bd836c898937a7355 | [] | no_license | mrudulakulkarni/StaggeredRecyclerview | d278a35b534a59a8e3ebcd2b6642f61fd458cc50 | 9e945db1074d71610c245097f1ced7797a94e90a | refs/heads/master | 2021-01-21T20:34:32.935176 | 2017-05-24T05:51:50 | 2017-05-24T05:51:50 | 92,254,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package com.example.admin.staggeredrecyclerviewexample;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.admin.staggeredrecyclerviewexample", appContext.getPackageName());
}
}
| [
"mrudula.kulkarni2@gmail.com"
] | mrudula.kulkarni2@gmail.com |
c9fb95218ff7bed83cea84a381a95c343c11a91b | 35ed35053f26204d53a33c71882576e850deea4b | /ColoryGame/src/main/java/com/home/colorygame/colory/ColoryArea.java | 397aea2ee967494c744502289e720466c9c04248 | [] | no_license | TomBitDe/Colory | d6754a859e7ebd22c9f2957d1ce351b9c66146eb | b69ae8a31b841d50d849723db5d1e57debda7c07 | refs/heads/master | 2021-06-18T14:38:08.725307 | 2020-10-17T15:42:30 | 2020-10-17T15:42:30 | 92,079,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,458 | java | package com.home.colorygame.colory;
import java.util.ArrayList;
import java.util.logging.Logger;
/**
* The main items of the Colory game
*/
public final class ColoryArea extends ArrayList<PushArea> {
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(ColoryArea.class.getName());
/**
* Create the Colory area. Initially it contains no PushAreas
*/
public ColoryArea() {
super();
}
/**
* For an ActionEvent evt find the assigned PushArea
*
* @param evt the event
*
* @return the PushArea
*/
public PushArea getPushArea(final java.awt.event.ActionEvent evt) {
for (PushArea item : this) {
if (item.getButton().equals(evt.getSource())) {
return item;
}
}
log.warning(new StringBuffer("PushArea for source=[").append(evt.getSource()).append("] not found").toString());
return (null);
}
/**
* For an KeyEvent e find the assigned PushArea
*
* @param e the key event
*
* @return the PushArea
*/
public PushArea getPushArea(final java.awt.event.KeyEvent e) {
for (PushArea item : this) {
if (item.getKey() == e.getKeyChar()) {
return item;
}
}
log.warning(new StringBuffer("PushArea for key=[").append(e.getKeyChar()).append("] not found").toString());
return (null);
}
/**
* For an ActionEvent evt find index of the assigned PushArea
*
* @param evt the event
*
* @return the index in the list of PushAreas or -1 if not found
*/
public int getPushAreaIndex(final java.awt.event.ActionEvent evt) {
for (int idx = 0; idx < this.size(); ++idx) {
if (this.get(idx).getButton().equals(evt.getSource())) {
return (idx);
}
}
log.warning(new StringBuffer("PushArea for source=[").append(evt.getSource()).append("] not found").toString());
return (-1);
}
/**
* Set the Enabled state for all buttons in PushAreas ArrayList
*
* @param bool the state true/false to set
*/
public void allPushAreasSetEnabled(final boolean bool) {
for (PushArea item : this) {
item.getButton().setEnabled(bool);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
37c290e4db3d9d11b0032621385562aad7865eea | b7d85f420aefd30009b01f5cc4cb03d3d40a3d96 | /JTrackREST/src/main/java/com/jtrack/service/CustomUserDetailsService.java | e6339b54dc1b538af317520fcb63998255c3dc65 | [] | no_license | kan-r/ProjectJTrackAll | 002b702be4e29771fd8299f2a2a25a433c1e0049 | 4556468a1c015163e6f4b479f65555a0bb92111b | refs/heads/master | 2023-02-04T10:20:35.913830 | 2020-12-20T21:17:09 | 2020-12-20T21:17:09 | 216,517,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,942 | java | package com.jtrack.service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
@Service("customUserDetailsService")
public class CustomUserDetailsService implements UserDetailsService {
@Resource
private UserService userService;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
public UserDetails loadUserByUsername(String userId) throws UsernameNotFoundException {
/*
* Note:
* userId will not be null (validated by the login)
* password must be same as userId (case sensitive)
*/
boolean enabled = true;
boolean accountNonExpired = true;
boolean credentialsNonExpired = true;
boolean accountNonLocked = true;
com.jtrack.model.User user = userService.getUser(userId.toUpperCase());
String pword = "";
if(user != null) {
pword = user.getPword();
}
return new org.springframework.security.core.userdetails.User(
userId,
passwordEncoder.encode(pword),
enabled,
accountNonExpired,
credentialsNonExpired,
accountNonLocked,
getAuthorities(userId));
}
public Collection<? extends GrantedAuthority> getAuthorities(String userId) {
List<GrantedAuthority> authList = getGrantedAuthorities(getRoles(userId));
return authList;
}
public List<String> getRoles(String userId) {
List<String> roles = new ArrayList<String>();
if(userId != null && !userId.equals("")) {
if(userId.equalsIgnoreCase("ADMIN")) {
roles.add("USER");
roles.add("ADMIN");
}else {
roles.add("USER");
}
}
return roles;
}
public static List<GrantedAuthority> getGrantedAuthorities(List<String> roles) {
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
for (String role : roles) {
authorities.add(new SimpleGrantedAuthority(role));
}
return authorities;
}
}
| [
"krangan100@gmail.com"
] | krangan100@gmail.com |
b6b4d168b1e9b9e74d608657f69caf83bfab0a1d | 4442fec89f0f0d55c15a975b256dd059856e33c2 | /src/com/company/Main.java | ac91a0ade35b1948d498f90fdaa891868285a0b6 | [] | no_license | adiiq535/untitled13 | 52101cc69c4d4f5ad685b1f3a1a6eb96857a8059 | f6ef81be3f887508af0782c7c074049ab65b82f7 | refs/heads/master | 2022-07-06T21:26:40.485478 | 2020-05-11T23:49:58 | 2020-05-11T23:49:58 | 263,155,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 172 | java | package com.company;
public class Main {
public static void main(String[] args) {
Runner runner1 = new Runner("Runner 1");
runner1.start();
}
}
| [
"adimamasaliev1552@gmail.com"
] | adimamasaliev1552@gmail.com |
ddea33628a8bb6679769a000da98f28ea302f021 | 19e5c19ed196d5c6e0b5d45ed9db62b9bd84b730 | /src/tableview/TableController.java | 000b803b16db719eb0149b7219cdc1747947d02e | [] | no_license | martomfyam/busmanager | cbc750bc3c2ae2b2ff267a82535f89e907526866 | 46cbe207ce8098eed71d9a91fbdc8d37ed9aeadb | refs/heads/master | 2020-04-05T11:06:08.846822 | 2018-11-26T07:55:16 | 2018-11-26T07:55:16 | 156,822,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,536 | 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 tableview;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.Image;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
/**
* FXML Controller class
*
* @author MARTIN
*/
public class TableController implements Initializable {
ObservableList<viewtable> list = FXCollections.observableArrayList();
@FXML
private TableView<viewtable> table;
@FXML
private TableColumn<viewtable, String> idcol;
@FXML
private TableColumn<viewtable, String> firstnamecol;
@FXML
private TableColumn<viewtable, String> lastnamecol;
@FXML
private TableColumn<viewtable, String> fromcol;
@FXML
private TableColumn<viewtable, String> tocol;
@FXML
private TableColumn<viewtable, String> dayscol;
@FXML
private TableColumn<viewtable, String> ticketnocol;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
loaddata();
}
public void loaddata(){
try {
String DATABASE = "busmanager"; //to be changed to busmanager
//String url = "jdbc:mysql://localhost:3306/";
// String userPass = "?user=root&password="; //mysql?zeroDateTimeBehavior=convertToNull";
String username = "root";
String password = "";
//connecting to the database to retrive the last record
Connection connection = null;
try {
// Load the MySQL JDBC driver
String driverName = "com.mysql.jdbc.Driver";
Class.forName(driverName);
// Create a connection to the database
String serverName = "localhost";
String url = "jdbc:mysql://" + serverName + "/" + DATABASE;
// String username = "username";
// String password = "password";
connection = DriverManager.getConnection(url, username, password);
System.out.println("Successfully Connected to the database!");
} catch (ClassNotFoundException e) {
System.out.println("Could not find the database driver " + e.getMessage());
} catch (SQLException e) {
System.out.println("Could not connect to the database " + e.getMessage());
}
ResultSet rs = connection.createStatement().executeQuery("select * from memberdetail");
while (rs.next()) {
list.add(new viewtable(rs.getString("id"), rs.getString("firstname"), rs.getString("lastname"),rs.getString("origin"),rs.getString("destination"), rs.getString("days"),rs.getString("ticketno") ));
}
} catch (SQLException ex) {
Logger.getLogger(TableController.class.getName()).log(Level.SEVERE, null, ex);
}
idcol.setCellValueFactory(new PropertyValueFactory<>("id"));
firstnamecol.setCellValueFactory(new PropertyValueFactory<>("firstname"));
lastnamecol.setCellValueFactory(new PropertyValueFactory<>("lastname"));
fromcol.setCellValueFactory(new PropertyValueFactory<>("from"));
tocol.setCellValueFactory(new PropertyValueFactory<>("to"));
dayscol.setCellValueFactory(new PropertyValueFactory<>("days"));
ticketnocol.setCellValueFactory(new PropertyValueFactory<>("ticketno"));
table.setItems(list);
// TODO
}
@FXML
private void back(MouseEvent event) {
closeStage();
loadDetailsForm();
}
void loadDetailsForm() {
try {
Parent parent = FXMLLoader.load(getClass().getResource("/bus/manager/FXMLDocument.fxml"));
Stage stage = new Stage(StageStyle.DECORATED);
stage.getIcons().add(new Image("/ticket/icons/bus.jpg"));
stage.setTitle("MAIN MENU");
stage.setScene(new Scene(parent));
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
public void closeStage() {
((Stage) table.getScene().getWindow()).close();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
aec4d10396c3384db09d6a7e1e7136ce36d4c92a | b877893db4b2e41f2463a0faebadeecc96dfa342 | /src/main/java/bplus/bptree/TreeNode.java | 348ab8b017e0d9971df4573a8d4fedf0ff2dddaf | [] | no_license | jointcloud-buaa/jcsIndex | 80fabd538b9aa488fafec7279f0f167ae5e28c19 | be2adfe7508a0be512259a5ce283e9e269eb5863 | refs/heads/master | 2021-07-05T03:45:53.804135 | 2019-04-08T15:01:09 | 2019-04-08T15:01:09 | 189,425,155 | 1 | 0 | null | 2020-10-13T13:34:27 | 2019-05-30T14:08:50 | Java | UTF-8 | Java | false | false | 14,586 | java | package bplus.bptree;
import bplus.util.InvalidBTreeStateException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.InvalidPropertiesFormatException;
import java.util.LinkedList;
/**
*
* Class that describes all the common properties that
* each of the node types have.
*
*/
@SuppressWarnings("unused")
abstract class TreeNode {
final LinkedList<Long> keyArray; // key array
private TreeNodeType nodeType; // actual node type
private long pageIndex; // node page index
private int currentCapacity; // current capacity
private boolean beingDeleted; // deleted flag
/**
* Constructor which takes into the node type as well as the
* page index
* @param nodeType the actual node type
* @param pageIndex the page index in the file
*/
TreeNode(TreeNodeType nodeType, long pageIndex) {
this.nodeType = nodeType; // actual node type
this.pageIndex = pageIndex; // node page index
this.currentCapacity = 0; // current capacity
this.keyArray = new LinkedList<>(); // instantiate the linked list
this.beingDeleted = true;
}
/**
* Check if the node is full (and needs splitting)
* @param conf configuration to deduce which degree to use
*
* @return true is the node is full false if it's not.
*/
boolean isFull(BPlusConfiguration conf) {
if(isLeaf()) {
return(isOverflow() ?
(conf.getMaxOverflowNodeCapacity() == currentCapacity) :
(conf.getMaxLeafNodeCapacity() == currentCapacity));}
else
// internal
{return(conf.getMaxInternalNodeCapacity() == currentCapacity);}
}
/**
* Check if the node is underutilized and needs to be merged
*
* @param conf B+ Tree configuration reference
* @return true is the node needs to be merged or false if it's not
*/
boolean isTimeToMerge(BPlusConfiguration conf) {
// for roots (internal or leaf) return true only when empty
if(isRoot())
{return(getCurrentCapacity() <= 1);}
else if(isLeaf()) {
// for overflow pages return true only if empty
if (isOverflow())
{return (isEmpty());}
// otherwise return based on degree
else
{return (conf.getMinLeafNodeCapacity() >= currentCapacity);}
} else // internal
{
return (conf.getMinInternalNodeCapacity() >= currentCapacity);
}
}
/**
* Returns the current node capacity
*
* @return the newCap variable value.
*/
int getCurrentCapacity() {
return (currentCapacity);
}
/**
* Set the current capacity
*
* @param newCap replace node capacity with this argument.
*/
void setCurrentCapacity(int newCap) {
currentCapacity = newCap;
}
/**
* Increment the node capacity by one.
*
* @param conf configuration instance for validating the limits.
* @throws InvalidBTreeStateException is thrown when the capacity limits are violated after incrementing.
*/
void incrementCapacity(BPlusConfiguration conf) throws InvalidBTreeStateException {
currentCapacity++;
validateNodeCapacityLimits(conf);
}
/**
* Decrement the node capacity by one.
*
* @param conf configuration instance for validating the limits.
* @throws InvalidBTreeStateException is thrown when the capacity limits are violated after decrementing.
*/
void decrementCapacity(BPlusConfiguration conf)
throws InvalidBTreeStateException {
currentCapacity--;
validateNodeCapacityLimits(conf);
}
/**
* Function that validates the node capacity invariants based on the current configuration instance.
*
* @param conf configuration instance for validating the limits.
* @throws InvalidBTreeStateException is thrown when the capacity limits are violated upon checking.
*/
private void validateNodeCapacityLimits(BPlusConfiguration conf)
throws InvalidBTreeStateException {
if(isRoot()) {
if(currentCapacity < 0) {
throw new InvalidBTreeStateException("Cannot have less than zero elements");
} else if(isLeaf() && currentCapacity > conf.getMaxLeafNodeCapacity()) {
throw new InvalidBTreeStateException("Exceeded leaf node " +
"allowed capacity at root");
} else if(isInternalNode() && currentCapacity > conf.getMaxInternalNodeCapacity()) {
throw new InvalidBTreeStateException("Exceeded internal node " +
"allowed capacity at root");
}
} else {
if (isLookupPageOverflowNode()) {
if (beingDeleted && currentCapacity < 0) {
throw new InvalidBTreeStateException("Cannot have less than " +
0 + " elements in a lookup overflow node when deleting it");
} else if (currentCapacity > conf.getMaxLookupPageOverflowCapacity()) {
throw new InvalidBTreeStateException("Exceeded lookup overflow node " +
"allowed capacity (node)");
}
}
if(isOverflow()) {
if(beingDeleted && currentCapacity < 0) {
throw new InvalidBTreeStateException("Cannot have less than " +
0 + " elements in a overflow node when deleting it");
}
else if(currentCapacity > conf.getMaxOverflowNodeCapacity()) {
throw new InvalidBTreeStateException("Exceeded overflow node " +
"allowed capacity (node)");
}
}
else if(isLeaf()) {
if(beingDeleted && currentCapacity < 0) {
throw new InvalidBTreeStateException("Cannot have less than " +
0 + " elements in a leaf node when deleting it");
} else if(!beingDeleted && currentCapacity < conf.getMinLeafNodeCapacity()) {
throw new InvalidBTreeStateException("Cannot have less than " +
conf.getMinLeafNodeCapacity() + " elements in a leaf node");
}
else if(currentCapacity > conf.getMaxLeafNodeCapacity()) {
throw new InvalidBTreeStateException("Exceeded leaf node " +
"allowed capacity (node)");
}
} else if(isInternalNode()) {
if(beingDeleted && currentCapacity < 0) {
throw new InvalidBTreeStateException("Cannot have less than " +
0 + " elements in an internal node");
}
else if(!beingDeleted && currentCapacity < conf.getMinInternalNodeCapacity()) {
throw new InvalidBTreeStateException("Cannot have less than " +
conf.getMinInternalNodeCapacity() +
" elements in an internal node");
}
else if(currentCapacity > conf.getMaxInternalNodeCapacity()) {
throw new InvalidBTreeStateException("Exceeded internal node " +
"allowed capacity (node)");
}
}
}
}
/**
* Being deleted flag
*
* @return true if the node is marked to be deleted, false otherwise.
*/
public boolean getBeingDeleted() {
return beingDeleted;
}
/**
* Set being deleted flag
*
* @param beingDeleted value to set the flag.
*/
void setBeingDeleted(boolean beingDeleted) {
this.beingDeleted = beingDeleted;
}
/**
* Check if the node is empty (and *definitely* needs merging)
*
* @return true if it is empty false if it's not.
*/
boolean isEmpty()
{return(currentCapacity == 0);}
/**
* Check if the node in question is an overflow page
*
* @return true if the node is an overflow page, false if it's not
*/
boolean isOverflow() {
return (nodeType == TreeNodeType.TREE_LEAF_OVERFLOW);
}
/**
* Check if the node in question is a leaf (including root)
*
* @return true if the node is a leaf, false if it's not.
*/
boolean isLeaf() {
return(nodeType == TreeNodeType.TREE_LEAF ||
nodeType == TreeNodeType.TREE_LEAF_OVERFLOW ||
nodeType == TreeNodeType.TREE_ROOT_LEAF);
}
/**
* Check if the node in question is a tree root.
*
* @return true if it is a tree root, false if it's not.
*/
boolean isRoot() {
return(nodeType == TreeNodeType.TREE_ROOT_INTERNAL ||
nodeType == TreeNodeType.TREE_ROOT_LEAF);
}
/**
* Check if the node in question is an internal node (including root)
*
* @return true if the node is an internal node, false if it's not.
*/
boolean isInternalNode() {
return(nodeType == TreeNodeType.TREE_INTERNAL_NODE ||
nodeType == TreeNodeType.TREE_ROOT_INTERNAL);
}
/**
* Check if the node in question is a lookup page overflow node
*
* @return true if the node is a lookup page overflow node, false otherwise
*/
boolean isLookupPageOverflowNode() {
return (nodeType == TreeNodeType.TREE_LOOKUP_OVERFLOW);
}
/**
* Return the node type
*
* @return the current node type
*/
TreeNodeType getNodeType() {
return (nodeType);
}
/**
* Explicitly set the node type
*
* @param nodeType set the node type
*/
void setNodeType(TreeNodeType nodeType) {
// check if we presently are a leaf
if (isLeaf()) {
this.nodeType = nodeType;
if (isInternalNode()) {
throw new IllegalArgumentException("Cannot convert Leaf to Internal Node");
}
}
// it must be an internal node
else {
this.nodeType = nodeType;
if (isLeaf()) {
throw new IllegalArgumentException("Cannot convert Internal Node to Leaf");
}
}
}
/**
* Get the specific key at position indicated by <code>index</code>
* @param index the position to get the key
* @return the key at position
*/
long getKeyAt(int index)
{return(keyArray.get(index));}
/**
* Return the page index
*
* @return current page index
*/
long getPageIndex()
{return pageIndex;}
/**
* Update the page index
*
* @param pageIndex new page index
*/
void setPageIndex(long pageIndex)
{this.pageIndex = pageIndex;}
/**
* Set the key in the array at specific position
*
* @param index index to set the key
* @param key key to set in position
*/
void setKeyArrayAt(int index, long key)
{keyArray.set(index, key);}
/**
* Add key at index while shifting entries
* pointed by index and after by one.
*
* @param index index to shift keys and add
* @param key key to add in position
*/
void addToKeyArrayAt(int index, long key)
{keyArray.add(index, key);}
/**
* Push a key to head of the array
*
* @param key key to push
*/
void pushToKeyArray(long key)
{keyArray.push(key);}
/**
* Add a key to the last place of the array
*
* @param key key to add
*/
void addLastToKeyArray(long key)
{keyArray.addLast(key);}
/**
* Get last element
*
* @return return the last key
*/
long getLastKey()
{return keyArray.getLast();}
/**
* Get first key
*
* @return return the first key value
*/
long getFirstKey()
{return keyArray.getFirst();}
/**
* Pop the key at the head of the array
*
* @return key that is in the head of the array
*/
long popKey()
{return keyArray.pop();}
/**
* Remove and pop the last key of the array
*
* @return key that is in the last place of the array
*/
long removeLastKey()
{return keyArray.removeLast();}
/**
* Remove and pop the key at specific position
*
* @param index index that points where to remvoe the key
* @return removed key
*/
long removeKeyAt(int index)
{return(keyArray.remove(index));}
/**
* Get the page type that maps the enumeration to numbers that are
* easily stored in our file.
*
* @return the number representation of the node type
* @throws InvalidPropertiesFormatException is thrown when the page type is not matched.
*/
short getPageType()
throws InvalidPropertiesFormatException {
switch(getNodeType()) {
case TREE_LEAF: // LEAF
{return(1);}
case TREE_INTERNAL_NODE: // INTERNAL NODE
{return(2);}
case TREE_ROOT_INTERNAL: // INTERNAL NODE /w ROOT
{return(3);}
case TREE_ROOT_LEAF: // LEAF NODE /w ROOT
{return(4);}
case TREE_LEAF_OVERFLOW: // LEAF OVERFLOW NODE
{return(5);}
case TREE_LOOKUP_OVERFLOW: // TREE LOOKUP OVERFLOW
{
return (6);
}
default: {
throw new InvalidPropertiesFormatException("Unknown " +
"node value read; file possibly corrupt?");
}
}
}
/**
* Abstract method that all classes must implement that writes
* each node type to a page slot.
*
* More details in each implementation.
*
* @param r an *already* open pointer which points to our B+ Tree file
* @param conf B+ Tree configuration
* @throws IOException is thrown when an I/O operation fails.
*/
public abstract void writeNode(RandomAccessFile r, BPlusConfiguration conf,
BPlusTreePerformanceCounter bPerf)
throws IOException;
/**
*
* Each class must implement it's own printing method.
*
*/
public abstract void printNode();
}
| [
"shminjs@outlook.com"
] | shminjs@outlook.com |
a8f4d149d06797ad26724bb4b2862d46d5a35f9f | efe8fcb54346e2fd7565fd1c80d264932432175f | /_beta_1/COCI/src/com/COCI/ActList.java | a0621871ec02d5bd2c496df040aa2851072b1469 | [] | no_license | jiahao1889/COCI | 5084791c266c291189c24c1118d6fa25c8ec4087 | ac883bc5e213ecaf6b05b3aa828d40a2d6b7810b | refs/heads/master | 2016-09-06T09:14:58.842905 | 2011-01-09T09:54:03 | 2011-01-09T09:54:03 | 990,334 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,884 | java | package com.COCI;
import java.sql.*;
import java.util.ArrayList;
/**
* The list of activities class.
* @author COCI group
* @since 2010-10-25
*/
public class ActList {
//modified by QJ 2010-11-19
/**
* The function is to find all the activities from the database;
* @return ArrayList<Activity>.
*/
public ArrayList<Activity> AllActs() throws ClassNotFoundException, SQLException
{
ArrayList<Activity> all = new ArrayList<Activity>();
Connection connection = SqlString.connectSql();
Statement statement1=connection.createStatement();
String sql="SELECT * FROM "+tableName;
ResultSet resultSet = statement1.executeQuery(sql);
while(resultSet.next()) {
String n = resultSet.getString(2);
int actid = resultSet.getInt(1);
Timestamp cdate = resultSet.getTimestamp(4);
Activity tmp = new Activity(n,actid,cdate);
all.add(tmp);
}
resultSet.close();
statement1.close();
connection.close();
return all;
}
/**
* The function is to find the latest 10 item of activities from the database;
* @return ArrayList<Activity>.
*/
public ArrayList<Activity> TopTenActs() throws ClassNotFoundException, SQLException
{
ArrayList<Activity> topTenActs = new ArrayList<Activity>();
Connection connection = SqlString.connectSql();
Statement statement1=connection.createStatement();
String sql="SELECT * FROM "+tableName +" order by a_id DESC limit 10";
ResultSet rs = statement1.executeQuery(sql);
while(rs.next()) {
String n = rs.getString(2);
int actid = rs.getInt(1);
Timestamp cdate = rs.getTimestamp(4);
Activity tmp = new Activity(n,actid,cdate);
topTenActs.add(tmp);
}
rs.close();
statement1.close();
connection.close();
return topTenActs;
}
public void SearchByDate()
{
}
//modified by YXY,WHD 2010-11-25
/**
* The function is to find the focused activities of a user from the database;
* @param int uID.
* @return ArrayList<Activity>.
*/
public ArrayList<Activity> SearchByFocus(int uID)throws ClassNotFoundException, SQLException
{
ArrayList<Activity> personActivityList = new ArrayList<Activity>();
Connection connection = SqlString.connectSql();
Statement statement1=connection.createStatement();
String sql="SELECT * FROM "+tableName+",care WHERE care.u_id="+uID+" AND "+tableName+".a_id=care.a_id";
ResultSet resultSet = statement1.executeQuery(sql);
while(resultSet.next()) {
String name = resultSet.getString(2);
int actid = resultSet.getInt(1);
Timestamp cdate = resultSet.getTimestamp(4);
Activity focusActivity = new Activity(name,actid,cdate);
personActivityList.add(focusActivity);
}
resultSet.close();
statement1.close();
connection.close();
return personActivityList;
}
public void SearchByGroup()
{
}
//modified by YXY,WHD 2010-11-19
/**
* The function is to delete an activity from the database;
* @param int uID.
*/
public void DelAct(int aID)throws ClassNotFoundException, SQLException
{
Connection connection = SqlString.connectSql();
java.sql.Statement statement1=connection.createStatement();
String sql="DELETE FROM "+tableName + " WHERE a_id = " + aID;
statement1.executeUpdate(sql);
statement1.close(); // 释放Statement对象
connection.close(); // 关闭到MySQL服务器的连接
}
//modified by WQY,WHD 2010-11-25
/**
* The function is to add an activity to the database;
* @param String title,String content,String place,String acturl,Timestamp actDate,
Timestamp deadline,int classify,int maxnum,int uid.
*/
public void AddAct(String title,String content,String place,String acturl,Timestamp actDate,
Timestamp deadline,int classify,int maxnum,int uid) throws ClassNotFoundException, SQLException
{
Connection connection = SqlString.connectSql();
Statement statement1=connection.createStatement();
String sql="INSERT INTO act(name,creator_id,create_date,act_date,act_place,act_describe,act_url,deadline_date,classify,maxnum)" +
" VALUES(?,?,now(),?,?,?,?,?,?,?)";
PreparedStatement Pstatement = connection.prepareStatement(sql);
Pstatement.setString(1,title);
Pstatement.setInt(2, uid);
Pstatement.setTimestamp(3, actDate);
Pstatement.setString(4,place);
Pstatement.setString(5,content);
Pstatement.setString(6,acturl);
Pstatement.setTimestamp(7, deadline);
Pstatement.setInt(8, classify);
Pstatement.setInt(9, maxnum);
Pstatement.executeUpdate();
statement1.close();
connection.close();
}
private String dbName="coci";
private String tableName="act";
//modified by WQY QJ
//private ArrayList<Activity> aList;
}
| [
"jiahao1889@126.com"
] | jiahao1889@126.com |
d176438d51cfe02af68d222fba7af4d4797252cc | ff8b65b2088d698c9a18c65ad02827c02e11a942 | /src/Dao/CasaSoftwareBD.java | de0372e7ef6a139fe2bc6e8952b4d9d4924a15a5 | [] | no_license | gppenag/Poo | 5cbae806a4a5e0970f94b6c82f179927a7087f01 | 2c0c37d163ba75d02af38af3ef057277cf5756b0 | refs/heads/master | 2021-01-20T03:21:47.310151 | 2017-04-26T21:03:53 | 2017-04-26T21:03:53 | 89,526,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | 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 Dao;
import datos.CasaSoftware;
import java.io.FileNotFoundException;
/**
*
* @author Estudiante
*/
public interface CasaSoftwareBD {
public void escribir(CasaSoftware cs) throws FileNotFoundException;
public CasaSoftware leer ();
}
| [
"Estudiante@DESKTOP-KS3QO24"
] | Estudiante@DESKTOP-KS3QO24 |
5cb1d0e7445e54fc8d486c9aac35c3956cd3fe3b | 4e5783bfee07d0ec4dcde472c03321d118c66775 | /app/src/main/java/appocorrencias/com/appocorrencias/Activitys/Adm.java | 4587e477e939aab71293cd4aaa641cccdad779c4 | [] | no_license | sakura0702/AppOcorrenciasv2.0 | a13e86bb2068266e64e99ebdb3cd82aca24a3ca0 | e61fe69e05b514ad2bcf36e8378d47e61c9bda81 | refs/heads/master | 2021-01-20T03:34:47.067346 | 2017-04-27T04:43:23 | 2017-04-27T04:43:23 | 87,866,594 | 0 | 0 | null | 2017-04-10T23:22:53 | 2017-04-10T23:22:53 | null | UTF-8 | Java | false | false | 2,931 | java | package appocorrencias.com.appocorrencias.Activitys;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import appocorrencias.com.appocorrencias.R;
//Cadastrar usuario
// Enviar dados separados por /
//Nome Completo (Nome jeanderson ALmeida);
//Login (ID);(id jean)
// Erlang devolve Ok
// PEGAR O RETORNO DO SERVIDOR ERLANG ERRADO E VOLTA PARA O INICIA
// PEGAR O RETORNO EM CASO POSITIVO E MOSTRAR AO USUARIO
//SENHA
//E-mail
//Telefone
// Endereco
public class Adm extends AppCompatActivity {
private Button btnConexao,btnCadastrarOcorrencias;
private TextView txvRetornoSocket;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_adm);
btnConexao = (Button) findViewById(R.id.teste);
txvRetornoSocket = (TextView) findViewById(R.id.txvRetornoSocket);
btnCadastrarOcorrencias = (Button) findViewById(R.id.btnCadastrarOcorrencias);
}
public void valida_conexao(View view) {
setContentView(R.layout.activity_cliente_socket);
this.startActivity(new Intent(this,Cliente_Socket.class));
}
public void cadastrar_usuario(View view) {
setContentView(R.layout.activity_cadastrar_usuario);
this.startActivity(new Intent(this,Cadastrar_Usuario.class));
}
public void cadastrar_ocorrencia(View v){
setContentView(R.layout.activity_cadastrar_ocorrencia);
this.startActivity(new Intent(this,Cadastrar_Ocorrencia.class));
this.finish();
}
private void conectarSocket() {
try{
Socket socket = null;
ObjectOutputStream canalSaida = null;
ObjectInputStream canalEntrada = null;
Toast.makeText(getApplicationContext(), "Tentando conexao", Toast.LENGTH_SHORT).show();
socket = new Socket("192.168.0.192", 5678);
canalSaida = new ObjectOutputStream(socket.getOutputStream());
canalSaida.writeObject("Teste");
canalEntrada = new ObjectInputStream(socket.getInputStream());
Object object = canalEntrada.readObject();
if ((object != null) && (object instanceof String)) {
txvRetornoSocket.setText(object.toString());
}
} catch(Exception e) {
//FIXME Tratar a Exception.
e.printStackTrace();
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
setContentView(R.layout.activity_main);
this.startActivity(new Intent(this,MainActivity.class));
}
} | [
"jeandymlameida@gmail.com"
] | jeandymlameida@gmail.com |
54fea84d7605be696adfc83396ba150a6a376c59 | 0ac09720b2f56c57f44ea132bb879bfcffd931ae | /Java/D_MedianTwoSortedArrays/EfficientSolution.java | 61c23d5b6ea9ea0e6a1a7cafd01379fa3758ac6e | [] | no_license | magmeghamsh/Leet-Code | 6a110ec13a31bade289a739d1f64335fd79f60c0 | 3af07a55ca5860d60d4362bf4b942418d7e51695 | refs/heads/master | 2021-03-10T05:26:54.585983 | 2020-06-13T16:57:58 | 2020-06-13T16:57:58 | 246,424,212 | 0 | 0 | null | 2020-05-31T17:56:59 | 2020-03-10T22:47:24 | Java | UTF-8 | Java | false | false | 1,627 | java | package Java.D_MedianTwoSortedArrays;
public class EfficientSolution {
public static void main(String[] args) {
int[] a = {1, 2, 3, 4};
int[] b = {10, 12, 13, 16};
double result = findMedianSortedArrays(a, b);
System.out.println("Result: " + result); // The result should be 7.0
}
public static double findMedianSortedArrays(int[] nums1, int[] nums2) {
int length = nums1.length + nums2.length;
int low = 0;
int high = nums1.length;
int value = nums1.length + nums2.length + 1;
while (low <= high) {
int partitionX = (low + high) / 2;
int partitionY = value / 2 - partitionX;
int maxLeftX = (partitionX == 0) ? Integer.MIN_VALUE : nums1[partitionX - 1];
int minRightX = (partitionX == nums1.length) ? Integer.MAX_VALUE : nums1[partitionX];
int maxLeftY = (partitionY == 0) ? Integer.MIN_VALUE : nums2[partitionY - 1];
int minRightY = (partitionY == nums2.length) ? Integer.MAX_VALUE : nums2[partitionY];
if (maxLeftX <= minRightY && maxLeftY<= minRightX) {
if (length % 2 == 0) {
return (double) (Math.max(maxLeftX, maxLeftY) + Math.min(minRightX, minRightY)) / 2;
} else {
return Math.max(maxLeftX, minRightY);
}
} else if (maxLeftX > minRightY) {
high = partitionY - 1;
} else {
low = partitionX + 1;
}
}
return 0;
}
}
| [
"meg@Meghamshs-MacBook-Pro.local"
] | meg@Meghamshs-MacBook-Pro.local |
6e866be83ac239052f22fabe3d0668a44dde0b1d | 226f1d37bdf4b53db0872138fc06531316db10e3 | /src/com/system/controller/Test.java | fa4451bcfea983aee0d37d02a534d3fdea63666e | [] | no_license | admin-haha/learn-ssh | e4b8d4d4795e048141cea1c5026773fed6e08ffb | 033e435c7c7bd67222ab08aa99efbab3b5348a66 | refs/heads/master | 2020-03-09T06:00:32.528517 | 2019-07-22T02:45:50 | 2019-07-22T02:45:50 | 128,627,638 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package com.system.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Test {
Logger logger = LoggerFactory.getLogger(Test.class);
@RequestMapping("/test")
public String test() {
logger.info("hahah");
return "Test!";
}
}
| [
"haohao.li@fbi-china.com"
] | haohao.li@fbi-china.com |
37a1d48a382eeafd746c4b7968839ed303391edb | 993a4b71475061978574f361a703204fc37f5138 | /phoneme_feature-mr1-rel-b04/jsr177/src/protocol/acl/octet_file/classes/com/sun/satsa/acl/AccessControlManager.java | eb2164cfea2c5add33a7cb4d3ad5bfc6a092bbf2 | [] | no_license | PhoneJ2ME/releases | 1d93e51e0081a1d331ea0cf1c1f1e5d55f0914cc | 6585f23149f090e0ff3a94ee61cae6bf2394e78b | refs/heads/master | 2021-01-19T10:39:17.955758 | 2008-12-17T20:32:36 | 2008-12-17T20:32:36 | 82,216,780 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,614 | java | /*
* @(#)AccessControlManager.java 1.7 06/06/09 @(#)
*
* Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
package com.sun.satsa.acl;
import com.sun.midp.crypto.MessageDigest;
import com.sun.midp.io.j2me.apdu.APDUManager;
/**
* This class represents access control information manager.
*/
public class AccessControlManager {
/** Access control information for card slots. */
private static ACSlot[] ACLInfo;
/**
* Initialise ACL information.
*/
private synchronized static void init() {
if (ACLInfo != null) {
return;
}
int maxSlot = APDUManager.getSlotCount();
ACLInfo = new ACSlot[maxSlot];
}
/**
* Initialize ACL information.
* @param slot int the slot number.
*/
public synchronized static void init(int slot) {
if (ACLInfo == null) {
init();
}
if (ACLInfo != null) {
ACLInfo[slot] = ACSlot.load(slot);
}
}
/**
* SHA-1 message digest object.
*/
private static MessageDigest sha;
/**
* Synchronization object for message digest calculation.
*/
private static Object shaSync = new Object();
/**
* Calculates hash value.
* @param inBuf data buffer.
* @param inOff offset of data in the buffer.
* @param inLen length of data.
* @return array containing SHA-1 hash.
*/
public static byte[] getHash(byte[] inBuf, int inOff, int inLen) {
synchronized (shaSync) {
try {
if (sha == null) {
sha = MessageDigest.getInstance("SHA-1");
}
sha.reset();
byte[] hash = new byte[20];
sha.update(inBuf, inOff, inLen);
sha.digest(hash, 0, hash.length);
return hash;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
/**
* Returns object that should be used for access control verification.
* @param slot slot number.
* @param selectAPDU SELECT APDU command data.
* @param root name of CA that authorized the suite.
* @return object that can be used to check permissions.
*/
public static APDUPermissions getAPDUPermissions(int slot,
byte[] selectAPDU,
String root) {
if (ACLInfo == null || ACLInfo[slot] == null) {
APDUPermissions perm;
perm = new APDUPermissions(null);
perm.setType(ACLPermissions.ALLOW);
return perm;
}
return (APDUPermissions) ACLInfo[slot].getACLPermissions(true,
selectAPDU, root);
}
/**
* Returns object that should be used for access control verification.
* @param slot slot number.
* @param selectAPDU SELECT APDU command data.
* @param root name of CA that authorized the suite.
* @return object that can be used to check permissions.
*/
public static JCRMIPermissions getJCRMIPermissions(int slot,
byte[] selectAPDU,
String root) {
if (ACLInfo == null || ACLInfo[slot] == null) {
JCRMIPermissions perm = new JCRMIPermissions(null);
perm.setType(ACLPermissions.ALLOW);
return perm;
}
return (JCRMIPermissions) ACLInfo[slot].getACLPermissions(false,
selectAPDU, root);
}
}
| [
"rajaa@6dfe35fe-931f-0410-af5f-a91b034811cd"
] | rajaa@6dfe35fe-931f-0410-af5f-a91b034811cd |
8b3f390b5eaf7d03e1b804361d5f2765d8065bbf | 102c0f3dc2ddd1e80c159b3bcce67ca214b9d9f1 | /src/SER/Snake.java | 69bfcd47689d060a2f94c2be75baac8e49de399d | [] | no_license | luislascano01/SER | 05a6b08057e36078a7585e61c1b96b4c658c1407 | 3f88c098c6262b0043990e06253416ed036dbc80 | refs/heads/master | 2023-02-21T07:22:59.308317 | 2021-01-30T01:53:52 | 2021-01-30T01:53:52 | 334,274,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,068 | java |
package SER;
public class Snake {
// Stores the joints / body part locations for our snake
private final int[] x = new int[Board.getAllDots()];
private final int[] y = new int[Board.getAllDots()];
// Stores direction of our snake
private boolean movingLeft = false;
private boolean movingRight = false;
private boolean movingUp = false;
private boolean movingDown = false;
private int joints = 0; // Stores # of dots / joints the snake has (starts
// with 3)
public int getsnakeX(int index) {
return x[index];
}
public int getsnakeY(int index) {
return y[index];
}
public void setsnakeX(int i) {
x[0] = i;
}
public void setsnakeY(int i) {
y[0] = i;
}
public boolean isMovingLeft() {
return movingLeft;
}
public void setMovingLeft(boolean movingLeft) {
this.movingLeft = movingLeft;
}
public boolean isMovingRight() {
return movingRight;
}
public void setMovingRight(boolean movingRight) {
this.movingRight = movingRight;
}
public boolean isMovingUp() {
return movingUp;
}
public void setMovingUp(boolean movingUp) {
this.movingUp = movingUp;
}
public boolean isMovingDown() {
return movingDown;
}
public void setMovingDown(boolean movingDown) {
this.movingDown = movingDown;
}
public int getJoints() {
return joints;
}
public void setJoints(int j) {
joints = j;
}
public void move() {
for (int i = joints; i > 0; i--) {
// Moves the joints of the snake 'up the chain'
// Meaning, the joint of the snake all move up one
x[i] = x[(i - 1)];
y[i] = y[(i - 1)];
}
// Moves snake to the left
if (movingLeft) {
x[0] -= Board.getDotSize();
}
// To the right
if (movingRight) {
x[0] += Board.getDotSize();
}
// Down
if (movingDown) {
y[0] += Board.getDotSize();
}
// And finally up
if (movingUp) {
y[0] -= Board.getDotSize();
}
// Dotsize represents the size of the joint, so a pixel of DOTSIZE
// gets added on to the snake in that direction
}
} | [
"luislascano01@users.noreply.github.com"
] | luislascano01@users.noreply.github.com |
9a1b6716ea3794fc98cf1c53df08444bd1ed3d00 | d5c3a552446e65e64631fd0c4df6456369a416f1 | /core/src/main/java/org/example/Controller.java | 6b4b3f0fab8710160337cc45f35dffab01ecb8f0 | [] | no_license | DmAwik/OOP6lab | b90c9d4bf1417248459d173c1adc2e1f104efe21 | fb9fe6f2e8d4316bf94d5cd4f14881a68c445260 | refs/heads/master | 2023-06-05T05:11:36.412688 | 2021-06-20T14:59:33 | 2021-06-20T14:59:33 | 378,653,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,643 | java | package org.example;
import java.io.File;
import java.io.IOException;
import java.util.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.*;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import javafx.stage.FileChooser;
import org.example.factory.*;
import org.example.Serialize.Coordinates;
import javafx.scene.layout.VBox;
import static org.example.Serialize.Serializer.*;
public class Controller {
@FXML
private Canvas canvasDraw;
@FXML
private Canvas canvasPreview;
@FXML
private Button btnRedo;
@FXML
private Button btnUndo;
@FXML
private TextField PenSize;
@FXML
private Button btnNew;
@FXML
private ColorPicker strokeColor;
@FXML
private ColorPicker brushColor;
@FXML
private ComboBox<String> choiceOfFigure;
private GraphicsContext gcDraw,gcPreview;
private final List<FiguresFactory> figuresFactoryList = new ArrayList<>(Arrays.asList(new LineFactory(), new PolylineFactory(), new PolygonFactory(), new RectangleFactory(), new CircleFactory()) );
private Figures currentFigure;
private boolean isDraw = false;
@FXML
public void onButtonClicked(MouseEvent mouseEvent){
btnUndo.setOnMouseClicked(event -> {
FigureHistory.undo(gcDraw, canvasDraw.getWidth(), canvasDraw.getHeight());
});
btnRedo.setOnMouseClicked(event -> {
FigureHistory.redo(gcDraw);
});
}
@FXML
public void initialize() {
PenSize.setText("1");
List<FiguresFactory> factories = new PluginLoader().getAllFactories();
ObservableList<String> figureList = FXCollections.observableArrayList();
for (FiguresFactory factory: factories) {
figuresFactoryList.add(factory);
}
for (FiguresFactory factory: figuresFactoryList){
figureList.add(factory.getName());
}
choiceOfFigure.getItems().setAll(figureList);
choiceOfFigure.setValue(figureList.get(0));
gcDraw = canvasDraw.getGraphicsContext2D();
gcPreview = canvasPreview.getGraphicsContext2D();
gcDraw.setFill(brushColor.getValue());
gcDraw.setStroke(strokeColor.getValue());
gcDraw.setLineWidth(Double.parseDouble(PenSize.getText()));
canvasPreview.setVisible(false);
updateCanvas();
}
public void brushColorChange(ActionEvent actionEvent) {
gcDraw.setFill(brushColor.getValue());
}
public void strokeColorChange(ActionEvent actionEvent) {
gcDraw.setStroke(strokeColor.getValue());
}
public void penSizeChange(ActionEvent actionEvent) {
gcDraw.setLineWidth(Double.parseDouble(PenSize.getText()));
}
public void updateCanvas() {
gcDraw.setFill(brushColor.getValue());
gcDraw.setStroke(strokeColor.getValue());
gcDraw.setLineWidth(Double.parseDouble(PenSize.getText()));
}
public void onCanvasClicked(MouseEvent mouseEvent) {
if (!isDraw) {
FiguresFactory figuresFactory = figuresFactoryList.get(choiceOfFigure.getSelectionModel().getSelectedIndex());
currentFigure = figuresFactory.newFigure(canvasDraw.getGraphicsContext2D(), new Coordinates(mouseEvent.getX(), mouseEvent.getY()));
isDraw = true;
FigureHistory.addFigure(currentFigure);}
else {
if (currentFigure.isPolyFigure()) {
currentFigure.addPoint(new Coordinates(mouseEvent.getX(), mouseEvent.getY()));
} else {
currentFigure.paint(gcDraw);
canvasPreview.setVisible(false);
isDraw = false;
}
}
}
public void onCanvasMouseMoved(MouseEvent mouseEvent) {
if (isDraw) {
canvasPreview.setVisible(true);
gcPreview.clearRect(0, 0, canvasPreview.getWidth(), canvasPreview.getHeight());
currentFigure.saveLastPoint(new Coordinates(mouseEvent.getX(), mouseEvent.getY()));
currentFigure.paint(gcPreview);
}
}
public void onKeyPressed(KeyEvent keyEvent) {
if (keyEvent.getCode() == KeyCode.ESCAPE && currentFigure.isPolyFigure()) {
currentFigure.deleteLastPoint();
currentFigure.paint(gcDraw);
canvasPreview.setVisible(false);
isDraw = false;
}
}
public void openFile(ActionEvent actionEvent) throws IOException {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open");
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("JSON", "*.json"));
File file = fileChooser.showOpenDialog(null);
if (file !=null) {
FigureHistory.setFiguresList(deserialize(file));
gcDraw.clearRect(0, 0, canvasPreview.getWidth(), canvasPreview.getHeight());
FigureHistory.drawFigures(gcDraw);
updateCanvas();
}
}
public void saveAsFile(ActionEvent actionEvent) throws IOException {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Save as...");
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("JSON", "*.json"));
File file = fileChooser.showSaveDialog(null);
if (file !=null) {
serialize(FigureHistory.getFiguresList(), file);
}
}
}
| [
"Awii15@mail.ru"
] | Awii15@mail.ru |
7dc4216345bc8c6be6501867361d4ccc87918bab | 0828eaf1f9f3f6cf5d4a3c88a8cad008975dfabf | /src/main/java/com/example/MidtermProject_EAD2/servlets/LogoutServlet.java | 2cd8501993a22e04614482f489b488262d2ac338 | [] | no_license | DimonCool00/MidtermProject_EAD2 | d104d9a4a6a6abf284e03864cfb8c13325acdb8f | aa9dcbdc54c773d9b1cb8f972ecbb6b2dcce7bdc | refs/heads/master | 2023-04-13T03:42:12.037534 | 2021-04-25T22:02:03 | 2021-04-25T22:02:03 | 347,773,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package com.example.MidtermProject_EAD2.servlets;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;
import javax.servlet.ServletException;
public class LogoutServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession(false);
// session.setAttribute("user", null);
session.removeAttribute("userr");
session.getMaxInactiveInterval();
request.getRequestDispatcher("index.jsp").include(request,response);
}
}
| [
"smirdimon2000@mail.ru"
] | smirdimon2000@mail.ru |
35d7e1b54960d7d9d1d4b3ced15b0f3b63ff3f87 | e3485a06680a10cee3dcb032e0a1d94a40148822 | /src/main/java/conflux/dex/service/DailyLimitService.java | 2cd0a2c013a561c52b5ee4ccd38682ff487a8545 | [
"MIT"
] | permissive | open-dex/conflux-dex | d31da78a391b73ea64c3b59f409799f088c88fc3 | faf970f0ea584e84850f635026612ae4a0850362 | refs/heads/main | 2023-08-31T14:09:16.463831 | 2023-08-21T03:31:04 | 2023-08-21T03:31:04 | 350,696,360 | 1 | 2 | MIT | 2023-09-07T10:41:55 | 2021-03-23T12:02:52 | Java | UTF-8 | Java | false | false | 5,445 | java | package conflux.dex.service;
import java.time.Duration;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import conflux.dex.common.channel.Sender;
import conflux.dex.dao.DexDao;
import conflux.dex.event.Events;
import conflux.dex.model.DailyLimit;
import conflux.dex.model.DailyLimitOperation;
import conflux.dex.model.DailyLimitOperationType;
import conflux.dex.model.InstantExchangeProduct;
import conflux.dex.model.Order;
import conflux.dex.model.OrderStatus;
import conflux.dex.model.Product;
@Service
public class DailyLimitService implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(DailyLimitService.class);
private static long oneDay = 86400000;
private DexDao dao;
private Sender<Object> dailyLimitSender;
private ScheduledExecutorService service;
private Map<Integer, List<ScheduledFuture<?>>> scheduledTask;
private ZoneId zoneId = ZoneId.systemDefault();
@Autowired
public DailyLimitService(DexDao dao, Sender<Object> dailyLimitSender) {
this.dao = dao;
this.dailyLimitSender = dailyLimitSender;
this.service = Executors.newScheduledThreadPool(1);
((ScheduledThreadPoolExecutor) this.service).setRemoveOnCancelPolicy(true);
this.scheduledTask = new ConcurrentHashMap<Integer, List<ScheduledFuture<?>>>();
}
@Autowired
public void setTimeZone(TimeZone systemTimeZone) {
this.zoneId = systemTimeZone.toZoneId();
}
@PostConstruct
public void setup() {
logger.info("initialization started ...");
List<Product> products = this.dao.listProducts();
for (Product product : products) {
if (product instanceof InstantExchangeProduct) {
continue;
}
this.setupProduct(product.getId());
}
logger.info("initialization completed");
}
public void sendDailyLimitOperation(int productId, boolean isOpen) {
DailyLimitOperation op = isOpen ? DailyLimitOperation.openTrade(productId) : DailyLimitOperation.closeTrade(productId);
this.dailyLimitSender.send(op);
}
public void removeScheduledTask(int productId) {
List<ScheduledFuture<?>> tasks = this.scheduledTask.get(productId);
if (tasks != null) {
for (ScheduledFuture<?> task : tasks)
task.cancel(false);
}
this.scheduledTask.put(productId, new ArrayList<ScheduledFuture<?>>());
}
public void setupProduct(int productId) {
List<DailyLimit> dailyLimits = this.dao.listDailyLimitsByProductId(productId);
if (dailyLimits.isEmpty()) {
return;
}
removeScheduledTask(productId);
LocalTime now = LocalTime.now(zoneId);
for (DailyLimit dailyLimit : dailyLimits) {
LocalTime startTime = LocalTime.parse(dailyLimit.getStartTime().toString());
LocalTime endTime = LocalTime.parse(dailyLimit.getEndTime().toString());
logger.info("setup daily limit, productId = {}, now = {}, startTime = {}, endTime = {}",
productId, now, startTime, endTime);
if (now.isAfter(startTime) && now.isBefore(endTime)) {
this.dailyLimitSender.send(DailyLimitOperation.openTrade(productId));
logger.info("open trade immediately");
}
OperationSender openSender = new OperationSender(this.dailyLimitSender, DailyLimitOperation.openTrade(productId), this.dao);
long initialDelay = Duration.between(now, startTime).toMillis();
if (startTime.isBefore(now)) {
initialDelay += oneDay;
}
this.scheduledTask.get(productId).add(this.service.scheduleWithFixedDelay(openSender, initialDelay, oneDay, TimeUnit.MILLISECONDS));
OperationSender closeSender = new OperationSender(this.dailyLimitSender, DailyLimitOperation.closeTrade(productId), this.dao);
initialDelay = Duration.between(now, endTime).toMillis();
if (endTime.isBefore(now)) {
initialDelay += oneDay;
}
this.scheduledTask.get(productId).add(this.service.scheduleWithFixedDelay(closeSender, initialDelay, oneDay, TimeUnit.MILLISECONDS));
}
}
@PreDestroy
@Override
public void close() throws Exception {
this.service.shutdownNow();
}
}
class OperationSender implements Runnable {
private static Logger logger = LoggerFactory.getLogger(OperationSender.class);
private Sender<Object> dailyLimitSender;
private DailyLimitOperation operation;
private DexDao dao;
public OperationSender(Sender<Object> dailyLimitSender, DailyLimitOperation operation, DexDao dao) {
this.dailyLimitSender = dailyLimitSender;
this.operation = operation;
this.dao = dao;
}
public void run(){
if (this.operation.getType() == DailyLimitOperationType.Open) {
List<Order> pendingOrders = this.dao.listAllOrdersByStatus(this.operation.getProductId(), OrderStatus.Pending);
Events.PENDING_ORDERS_OPENED.fire(pendingOrders);
}
this.dailyLimitSender.send(this.operation);
logger.info("change trade status, productId = {}, operation = {}", this.operation.getProductId(), this.operation.getType());
}
}
| [
"82121246@qq.com"
] | 82121246@qq.com |
a27003d0cbe0c4e9002e8c0bb20e67bc9d07c0e6 | 0d7ee3253dd28ce95d2a5b5413230efd90702163 | /src/vista/PanelCursos.java | 0ddfab4c04b6e151c0e35284e1723f6a52612f01 | [] | no_license | vinird/SIRES | 1a52caa545f8aa9755bc30c63b508f1449117919 | 63b6940b3eb2a038d64b05dea9a624ceb259022e | refs/heads/master | 2021-01-18T21:36:30.963837 | 2016-05-04T05:29:49 | 2016-05-04T05:29:49 | 33,688,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,985 | java | /**
* panel cursos de la ventana GUIECursos
*/
package vista;
import controlador.ControlCursos;
/**
*
* @author vini
*/
public class PanelCursos extends javax.swing.JPanel {
/**
* Creates new form PanelCursos
*/
public PanelCursos() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTxtCursos_nombre = new javax.swing.JTextField();
jTxtCursos_Siglas = new javax.swing.JTextField();
jTxtCursos_Creditos = new javax.swing.JTextField();
jBTNBuscarPorSiglas = new javax.swing.JButton();
jBTNConsultarCursos = new javax.swing.JButton();
jBtnAtrasCursos = new javax.swing.JButton();
jBTNAgregarCurso = new javax.swing.JButton();
jBTNModificarCurso = new javax.swing.JButton();
jBTNEliminarCurso = new javax.swing.JButton();
setBackground(new java.awt.Color(167, 172, 236));
jLabel1.setFont(new java.awt.Font("Droid Sans Fallback", 3, 22)); // NOI18N
jLabel1.setText("Registro cursos");
jLabel2.setFont(new java.awt.Font("Droid Sans Fallback", 1, 13)); // NOI18N
jLabel2.setText("Nombre del curso:");
jLabel3.setFont(new java.awt.Font("Droid Sans Fallback", 1, 13)); // NOI18N
jLabel3.setText("Siglas del curso:");
jLabel4.setFont(new java.awt.Font("Droid Sans Fallback", 1, 13)); // NOI18N
jLabel4.setText("Cantidad de creditos:");
jTxtCursos_nombre.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTxtCursos_nombreActionPerformed(evt);
}
});
jTxtCursos_Creditos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTxtCursos_CreditosActionPerformed(evt);
}
});
jTxtCursos_Creditos.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
jTxtCursos_CreditosKeyTyped(evt);
}
});
jBTNBuscarPorSiglas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/1426204169_xmag.png"))); // NOI18N
jBTNBuscarPorSiglas.setText("Buscar");
jBTNConsultarCursos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/1427791644_Zoom In.png"))); // NOI18N
jBTNConsultarCursos.setText("Consultar");
jBTNConsultarCursos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBTNConsultarCursosActionPerformed(evt);
}
});
jBtnAtrasCursos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/1427101796_back.png"))); // NOI18N
jBtnAtrasCursos.setText("Atras");
jBTNAgregarCurso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/1427791562_Add.png"))); // NOI18N
jBTNAgregarCurso.setText("Agregar");
jBTNModificarCurso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/1426203706_sign-up.png"))); // NOI18N
jBTNModificarCurso.setText("Modificar");
jBTNModificarCurso.setEnabled(false);
jBTNModificarCurso.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBTNModificarCursoActionPerformed(evt);
}
});
jBTNEliminarCurso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/1427791599_Delete.png"))); // NOI18N
jBTNEliminarCurso.setText("Eliminar");
jBTNEliminarCurso.setEnabled(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(54, 54, 54)
.addComponent(jBTNAgregarCurso)
.addGap(18, 18, 18)
.addComponent(jBTNModificarCurso)
.addGap(18, 18, 18)
.addComponent(jBTNEliminarCurso)
.addGap(18, 18, 18)
.addComponent(jBTNConsultarCursos)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 142, Short.MAX_VALUE)
.addComponent(jBtnAtrasCursos)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jTxtCursos_Siglas)
.addGap(18, 18, 18)
.addComponent(jBTNBuscarPorSiglas))
.addComponent(jTxtCursos_nombre, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(110, 110, 110)
.addComponent(jLabel1))))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTxtCursos_Creditos, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTxtCursos_nombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTxtCursos_Siglas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jBTNBuscarPorSiglas))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jTxtCursos_Creditos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBTNAgregarCurso)
.addComponent(jBTNModificarCurso)
.addComponent(jBTNEliminarCurso)
.addComponent(jBTNConsultarCursos)
.addComponent(jBtnAtrasCursos))
.addGap(52, 52, 52))
);
}// </editor-fold>//GEN-END:initComponents
private void jTxtCursos_nombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTxtCursos_nombreActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTxtCursos_nombreActionPerformed
private void jBTNConsultarCursosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTNConsultarCursosActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jBTNConsultarCursosActionPerformed
private void jBTNModificarCursoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTNModificarCursoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jBTNModificarCursoActionPerformed
private void jTxtCursos_CreditosKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTxtCursos_CreditosKeyTyped
char tipoEntrada = evt.getKeyChar();
if (tipoEntrada < '0' || tipoEntrada > '9') {
evt.consume();
}
}//GEN-LAST:event_jTxtCursos_CreditosKeyTyped
private void jTxtCursos_CreditosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTxtCursos_CreditosActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTxtCursos_CreditosActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBTNAgregarCurso;
private javax.swing.JButton jBTNBuscarPorSiglas;
private javax.swing.JButton jBTNConsultarCursos;
private javax.swing.JButton jBTNEliminarCurso;
private javax.swing.JButton jBTNModificarCurso;
private javax.swing.JButton jBtnAtrasCursos;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField jTxtCursos_Creditos;
private javax.swing.JTextField jTxtCursos_Siglas;
private javax.swing.JTextField jTxtCursos_nombre;
// End of variables declaration//GEN-END:variables
/**
*
* ************* metodos sets & gets ************
*/
public int getjTxtCursos_Creditos() {
if (jTxtCursos_Creditos.getText().equalsIgnoreCase("")) {
return 0;
}
int valor = Integer.parseInt(this.jTxtCursos_Creditos.getText());
return valor;
}
public void setjTxtCursos_Creditos(String jTxtCursos_Creditos) {
this.jTxtCursos_Creditos.setText(jTxtCursos_Creditos);
}
public String getjTxtCursos_Siglas() {
return this.jTxtCursos_Siglas.getText().toString().trim();
}
public void setjTxtCursos_Siglas(String jTxtCursos_Siglas) {
this.jTxtCursos_Siglas.setText(jTxtCursos_Siglas);
}
public String getjTxtCursos_nombre() {
return this.jTxtCursos_nombre.getText().toString().trim();
}
public void setjTxtCursos_nombre(String jTxtCursos_nombre) {
this.jTxtCursos_nombre.setText(jTxtCursos_nombre);
}
public static final String BTNAGREGAR_CURSOS = "Agregar";
public static final String BTNBUSCAR_CURSOS = "Buscar";
public static final String BTNMODIFICAR_CURSOS = "Modificar";
public static final String BTNELIMINAR_CURSOS = "Eliminar";
public static final String BTNCONSULTAR_CURSOS = "Consultar";
public static final String BTNATRAS_CURSOS = "Atras";
/**
*
* @param control
*/
public void escucharBotonesCursos (ControlCursos control) {
this.jBTNAgregarCurso.addActionListener(control);
this.jBTNBuscarPorSiglas.addActionListener(control);
this.jBTNConsultarCursos.addActionListener(control);
this.jBtnAtrasCursos.addActionListener(control);
this.jBTNModificarCurso.addActionListener(control);
this.jBTNEliminarCurso.addActionListener(control);
}
/**
*
* @param estado
*/
public void enableButtons (boolean estado){
this.jBTNModificarCurso.setEnabled(estado);
this.jBTNEliminarCurso.setEnabled(estado);
}
/**
*
*/
public void limpiar () {
this.jTxtCursos_nombre.setText("");
this.jTxtCursos_Siglas.setText("");
this.jTxtCursos_Creditos.setText("");
}
} | [
"vini@vini-XPS-L521X"
] | vini@vini-XPS-L521X |
bbcff5bb96b623b97b50e2a243951d467e00737c | 9769f4e33fb83539025416c3e9fda0f0af72bdf3 | /app/src/main/java/com/aaron_tejero/mascotaspersistencia/presentador/RecyclerViewFragmentPresenter.java | 9fda8312a75a62f153d78567f8af1b0043e38fc0 | [] | no_license | aarontejero/MascotasPersistencia | d09b9b19f30e73b1fc98056569807bc6dd854d16 | baa1eae1a1904ad08702e68f6fe30a95cc3aac4f | refs/heads/master | 2020-04-05T23:14:31.979871 | 2016-07-07T18:33:15 | 2016-07-07T18:33:15 | 60,053,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,710 | java | package com.aaron_tejero.mascotaspersistencia.presentador;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import com.aaron_tejero.mascotaspersistencia.Fragments.IRecyclerviewFragment;
import com.aaron_tejero.mascotaspersistencia.db.ConstructorMascotas;
import com.aaron_tejero.mascotaspersistencia.pojo.Mascota;
import com.aaron_tejero.mascotaspersistencia.pojo.Seguidores;
import com.aaron_tejero.mascotaspersistencia.restApi.EndPointsApi;
import com.aaron_tejero.mascotaspersistencia.restApi.adapter.RestApiAdapter;
import com.aaron_tejero.mascotaspersistencia.restApi.model.ListaImagenesResponse;
import com.aaron_tejero.mascotaspersistencia.restApi.model.SeguidoresResponse;
import com.google.gson.Gson;
import java.util.ArrayList;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* Created by AaronTejero on 30/05/2016.
*/
public class RecyclerViewFragmentPresenter implements IRecyclerViewFragmentPresenter {
IRecyclerviewFragment iRecyclerviewFragment;
Context context;
private ConstructorMascotas constructorMascotas;
ArrayList<Mascota> mascotas=new ArrayList<>();
ArrayList<Seguidores> seguidores=new ArrayList<>();
public RecyclerViewFragmentPresenter(IRecyclerviewFragment iRecyclerviewFragment,Context context) {
this.iRecyclerviewFragment=iRecyclerviewFragment;
this.context=context;
//obtenerMascotasBD();
obtenerSeguidores();
//obtenerImagenesMascotas();
mostrarMascotasRV();
}
@Override
public void obtenerMascotasBD() {
constructorMascotas=new ConstructorMascotas(context);
mascotas=constructorMascotas.obtenerDatos();
mostrarMascotasRV();
}
@Override
public void mostrarMascotasRV() {
iRecyclerviewFragment.inicializarAdaptadorRV(iRecyclerviewFragment.crearAdaptador(mascotas));
iRecyclerviewFragment.generarLinearLayoutVertical();
}
@Override
public void obtenerImagenesMascotas() {
RestApiAdapter restApiAdapter = new RestApiAdapter();
Gson gson = restApiAdapter.construyendoDeserealizadorMascotas();
EndPointsApi endpointsApi = restApiAdapter.establecerConexionRestApiInstagram(gson);
for (int i=0;i<seguidores.size();i++){
String id = seguidores.get(i).getId();
Call<ListaImagenesResponse> listaImagenesResponseCall = endpointsApi.getRecentMediaUser(id);
listaImagenesResponseCall.enqueue(new Callback<ListaImagenesResponse>() {
@Override
public void onResponse(Call<ListaImagenesResponse> call, Response<ListaImagenesResponse> response) {
ListaImagenesResponse listaImagenesResponse=response.body();
ArrayList<Mascota> mascotasaux=new ArrayList<>();
mascotasaux=listaImagenesResponse.getMascotas();
// mostrarMascotasRV();
mascotas.addAll(mascotasaux);
}
@Override
public void onFailure(Call<ListaImagenesResponse> call, Throwable t) {
Toast.makeText(context, "Fallo Mascotas: " + t.toString(), Toast.LENGTH_LONG).show();
Log.e("FALLO LA CONEXION", t.toString());
}
});
}
}
@Override
public void obtenerSeguidores() {
RestApiAdapter restApiAdapter = new RestApiAdapter();
Gson gson = restApiAdapter.construyeDeserealizadorSeguidores();
EndPointsApi endpointsApi = restApiAdapter.establecerConexionRestApiInstagram(gson);
Call<SeguidoresResponse> seguidoresResponseCall=endpointsApi.getSeguidores();
seguidoresResponseCall.enqueue(new Callback<SeguidoresResponse>() {
@Override
public void onResponse(Call<SeguidoresResponse> call, Response<SeguidoresResponse> response) {
SeguidoresResponse seguidoresResponse=response.body();
seguidores=seguidoresResponse.getSeguidores();
/*Seguidores yo = new Seguidores();
yo.setId("3436368772");
yo.setNombre("Aaron Tejero");
yo.setUsuario("atena_alana");
seguidores.add(yo);*/
obtenerImagenesMascotas();
mostrarMascotasRV();
}
@Override
public void onFailure(Call<SeguidoresResponse> call, Throwable t) {
Toast.makeText(context, "Fallo Seguidores TODAS FOTOS: " + t.toString(), Toast.LENGTH_LONG).show();
//Log.e("FALLO LA CONEXION SEGUIDORES", t.toString());
}
});
}
}
| [
"aaron.tejero@uno.edu.mx"
] | aaron.tejero@uno.edu.mx |
afd1bb022d99b651080c981dbdbf9e951fcfafea | 8196d31e59f4185d03fc7dbeb632f30d79c85b62 | /manager/src/main/java/com/gin/wms/manager/db/contract/processing/ProcessingTaskItemResultContract.java | cd1a1d25245c16c518ed94ee5dfd774f51c7c742 | [] | no_license | kelvinks777/WMS_Android | 5cc274ea121ec2734057b9530e2ad5d3106dd51b | bb0e06ed87ec0e754cb1b6c285eb88a2761006b0 | refs/heads/master | 2020-05-02T02:31:45.331488 | 2019-03-26T03:22:48 | 2019-03-26T03:22:48 | 177,706,363 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,480 | java | package com.gin.wms.manager.db.contract.processing;
import com.bosnet.ngemart.libgen.Contract;
import com.bosnet.ngemart.libgen.SqlLiteDataType;
import java.text.MessageFormat;
/**
* Created by manbaul on 10/05/2018.
*/
public class ProcessingTaskItemResultContract extends Contract {
public final static String TABLE_NAME = "processing_task_item_result";
public ProcessingTaskItemResultContract() throws Exception {
super();
}
@Override
public String getTableName() {
return TABLE_NAME;
}
@Override
public String[] getListColumn() {
return new String[] {
Column.PROCESSING_TASK_ID,
Column.PRODUCT_ID,
Column.CLIENT_ID,
Column.PALLET_NO,
Column.QTY,
Column.QTY_REMAINING,
Column.COMPUOM_VALUE,
Column.ALREADY_USED,
Column.EXPIRED_DATE,
Column.UPDATED,
};
}
@Override
public String[] getListType() {
return new String[] {
Type.PROCESSING_TASK_ID,
Type.PRODUCT_ID,
Type.CLIENT_ID,
Type.PALLET_NO,
Type.QTY,
Type.QTY_REMAINING,
Type.COMPUOM_VALUE,
Type.ALREADY_USED,
Type.EXPIRED_DATE,
Type.UPDATED,
};
}
@Override
public String[] getPrimaryKey() {
return new String[] {
Column.PROCESSING_TASK_ID,
Column.PRODUCT_ID,
Column.CLIENT_ID,
Column.PALLET_NO,
};
}
public class Column {
public final static String UPDATED = "updated";
public final static String PROCESSING_TASK_ID = "processingTaskId";
public final static String PRODUCT_ID = "productId";
public final static String CLIENT_ID = "clientId";
public final static String PALLET_NO = "palletNo";
public final static String QTY = "qty";
public final static String QTY_REMAINING = "qtyRemaining";
public final static String COMPUOM_VALUE = "compUomValue";
public final static String ALREADY_USED = "alreadyUsed";
public final static String EXPIRED_DATE = "expiredDate";
}
public class Type {
public final static String UPDATED = SqlLiteDataType.DATE;
public final static String PROCESSING_TASK_ID = SqlLiteDataType.TEXT;
public final static String PRODUCT_ID = SqlLiteDataType.TEXT;
public final static String CLIENT_ID = SqlLiteDataType.TEXT;
public final static String PALLET_NO = SqlLiteDataType.TEXT;
public final static String QTY = SqlLiteDataType.DOUBLE;
public final static String QTY_REMAINING = SqlLiteDataType.DOUBLE;
public final static String COMPUOM_VALUE = SqlLiteDataType.TEXT;
public final static String ALREADY_USED = SqlLiteDataType.INTEGER;
public final static String EXPIRED_DATE = SqlLiteDataType.DATE;
}
public static class Query {
private static final String SELECT_LIST = "select * from " + TABLE_NAME +
" where " + Column.PROCESSING_TASK_ID + "=''{0}'' and " +
Column.PRODUCT_ID + "=''{1}''";
public static String getSelectList(String taskId, String productId) {
return MessageFormat.format(SELECT_LIST, taskId, productId);
}
}
}
| [
"vin7kelvin@gmail.com"
] | vin7kelvin@gmail.com |
8ec6abb3de1b4002b79a93a1440f9edb05da9ac9 | 47b3ff9100dff71ecfcee1148c90ae11c326070d | /platforms/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/org/nativescript/widgets/R.java | 2c8b75aeec769d9c47e3db9ee6df2ee03df0645c | [] | no_license | maozhuzhou/playground1 | 43463e65392ab0c28b33f8f7eedfa2885f6b5f8a | 915456da46e8665d1c66430cf38772e829e40e31 | refs/heads/master | 2020-04-21T21:00:46.973495 | 2019-02-23T13:56:25 | 2019-02-23T13:56:25 | 169,864,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,500 | 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 org.nativescript.widgets;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f030039;
public static final int coordinatorLayoutStyle = 0x7f0300c5;
public static final int font = 0x7f0300fd;
public static final int fontProviderAuthority = 0x7f0300ff;
public static final int fontProviderCerts = 0x7f030100;
public static final int fontProviderFetchStrategy = 0x7f030101;
public static final int fontProviderFetchTimeout = 0x7f030102;
public static final int fontProviderPackage = 0x7f030103;
public static final int fontProviderQuery = 0x7f030104;
public static final int fontStyle = 0x7f030105;
public static final int fontVariationSettings = 0x7f030106;
public static final int fontWeight = 0x7f030107;
public static final int keylines = 0x7f030138;
public static final int layout_anchor = 0x7f03014c;
public static final int layout_anchorGravity = 0x7f03014d;
public static final int layout_behavior = 0x7f03014e;
public static final int layout_dodgeInsetEdges = 0x7f030151;
public static final int layout_insetEdge = 0x7f030152;
public static final int layout_keyline = 0x7f030153;
public static final int statusBarBackground = 0x7f0301d7;
public static final int ttcIndex = 0x7f030245;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f050070;
public static final int notification_icon_bg_color = 0x7f050071;
public static final int notification_material_background_media_default_color = 0x7f050072;
public static final int primary_text_default_material_dark = 0x7f05007c;
public static final int ripple_material_light = 0x7f050081;
public static final int secondary_text_default_material_dark = 0x7f050082;
public static final int secondary_text_default_material_light = 0x7f050083;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f060051;
public static final int compat_button_inset_vertical_material = 0x7f060052;
public static final int compat_button_padding_horizontal_material = 0x7f060053;
public static final int compat_button_padding_vertical_material = 0x7f060054;
public static final int compat_control_corner_material = 0x7f060055;
public static final int compat_notification_large_icon_max_height = 0x7f060056;
public static final int compat_notification_large_icon_max_width = 0x7f060057;
public static final int notification_action_icon_size = 0x7f0600cc;
public static final int notification_action_text_size = 0x7f0600cd;
public static final int notification_big_circle_margin = 0x7f0600ce;
public static final int notification_content_margin_start = 0x7f0600cf;
public static final int notification_large_icon_height = 0x7f0600d0;
public static final int notification_large_icon_width = 0x7f0600d1;
public static final int notification_main_column_padding_top = 0x7f0600d2;
public static final int notification_media_narrow_margin = 0x7f0600d3;
public static final int notification_right_icon_size = 0x7f0600d4;
public static final int notification_right_side_padding_top = 0x7f0600d5;
public static final int notification_small_icon_background_padding = 0x7f0600d6;
public static final int notification_small_icon_size_as_large = 0x7f0600d7;
public static final int notification_subtext_size = 0x7f0600d8;
public static final int notification_top_pad = 0x7f0600d9;
public static final int notification_top_pad_large_text = 0x7f0600da;
public static final int subtitle_corner_radius = 0x7f0600db;
public static final int subtitle_outline_width = 0x7f0600dc;
public static final int subtitle_shadow_offset = 0x7f0600dd;
public static final int subtitle_shadow_radius = 0x7f0600de;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f070081;
public static final int notification_bg = 0x7f070082;
public static final int notification_bg_low = 0x7f070083;
public static final int notification_bg_low_normal = 0x7f070084;
public static final int notification_bg_low_pressed = 0x7f070085;
public static final int notification_bg_normal = 0x7f070086;
public static final int notification_bg_normal_pressed = 0x7f070087;
public static final int notification_icon_background = 0x7f070088;
public static final int notification_template_icon_bg = 0x7f070089;
public static final int notification_template_icon_low_bg = 0x7f07008a;
public static final int notification_tile_bg = 0x7f07008b;
public static final int notify_panel_notification_icon_bg = 0x7f07008c;
}
public static final class id {
private id() {}
public static final int action0 = 0x7f080028;
public static final int action_container = 0x7f080030;
public static final int action_divider = 0x7f080032;
public static final int action_image = 0x7f080033;
public static final int action_text = 0x7f080039;
public static final int actions = 0x7f08003a;
public static final int async = 0x7f080041;
public static final int blocking = 0x7f080045;
public static final int bottom = 0x7f080047;
public static final int cancel_action = 0x7f08004b;
public static final int chronometer = 0x7f080057;
public static final int end = 0x7f08008c;
public static final int end_padder = 0x7f08008d;
public static final int forever = 0x7f08009a;
public static final int icon = 0x7f0800a3;
public static final int icon_group = 0x7f0800a4;
public static final int info = 0x7f0800a8;
public static final int italic = 0x7f0800ad;
public static final int left = 0x7f0800b1;
public static final int line1 = 0x7f0800b6;
public static final int line3 = 0x7f0800b7;
public static final int media_actions = 0x7f0800bf;
public static final int none = 0x7f0800cb;
public static final int normal = 0x7f0800cc;
public static final int notification_background = 0x7f0800cd;
public static final int notification_main_column = 0x7f0800ce;
public static final int notification_main_column_container = 0x7f0800cf;
public static final int right = 0x7f0800e2;
public static final int right_icon = 0x7f0800e3;
public static final int right_side = 0x7f0800e4;
public static final int start = 0x7f080109;
public static final int status_bar_latest_event_content = 0x7f08010a;
public static final int tag_transition_group = 0x7f080112;
public static final int tag_unhandled_key_event_manager = 0x7f080113;
public static final int tag_unhandled_key_listeners = 0x7f080114;
public static final int text = 0x7f080115;
public static final int text2 = 0x7f080117;
public static final int time = 0x7f08011f;
public static final int title = 0x7f080120;
public static final int top = 0x7f080127;
}
public static final class integer {
private integer() {}
public static final int cancel_button_image_alpha = 0x7f090004;
public static final int status_bar_notification_info_maxnum = 0x7f09000e;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0b005c;
public static final int notification_action_tombstone = 0x7f0b005d;
public static final int notification_media_action = 0x7f0b005e;
public static final int notification_media_cancel_action = 0x7f0b005f;
public static final int notification_template_big_media = 0x7f0b0060;
public static final int notification_template_big_media_custom = 0x7f0b0061;
public static final int notification_template_big_media_narrow = 0x7f0b0062;
public static final int notification_template_big_media_narrow_custom = 0x7f0b0063;
public static final int notification_template_custom_big = 0x7f0b0064;
public static final int notification_template_icon_group = 0x7f0b0065;
public static final int notification_template_lines_media = 0x7f0b0066;
public static final int notification_template_media = 0x7f0b0067;
public static final int notification_template_media_custom = 0x7f0b0068;
public static final int notification_template_part_chronometer = 0x7f0b0069;
public static final int notification_template_part_time = 0x7f0b006a;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c0039;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d0131;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d0132;
public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0d0133;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d0134;
public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0d0135;
public static final int TextAppearance_Compat_Notification_Media = 0x7f0d0136;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d0137;
public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0d0138;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d0139;
public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0d013a;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d01e1;
public static final int Widget_Compat_NotificationActionText = 0x7f0d01e2;
public static final int Widget_Support_CoordinatorLayout = 0x7f0d0211;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030039 };
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[] CoordinatorLayout = { 0x7f030138, 0x7f0301d7 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f03014c, 0x7f03014d, 0x7f03014e, 0x7f030151, 0x7f030152, 0x7f030153 };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f0300ff, 0x7f030100, 0x7f030101, 0x7f030102, 0x7f030103, 0x7f030104 };
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, 0x7f0300fd, 0x7f030105, 0x7f030106, 0x7f030107, 0x7f030245 };
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;
}
}
| [
"2174767144@qq.com"
] | 2174767144@qq.com |
6d95c4ff653f7b2ba40206f73e76581990b8d07f | 3b9306a030acd660ba9c58af8a804ade2e4399a6 | /app/src/main/java/pl/edu/uwr/pum/footballapp/service/emotes/Twtich/model/TwitchResponse.java | 06bbc7f87dc684f3c3a22a2095f3b94e4cc57660 | [] | no_license | szymonslezak/Twitch_Chat | 08fb79431193e1e43346b821389d0a80c7ae7e66 | f7d335e47f1fd1b067a46aeba7a78061c102408a | refs/heads/master | 2023-04-09T07:52:01.200426 | 2021-04-24T13:12:35 | 2021-04-24T13:12:35 | 361,165,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package pl.edu.uwr.pum.footballapp.service.emotes.Twtich.model;
import java.util.List;
public class TwitchResponse {
public List<TwitchEmote> emoticons;
}
| [
"szymonslezak@gmail.com"
] | szymonslezak@gmail.com |
c95475ed2a1aa98f5fca059a6685e251f156ac5d | 070a01a32110d03e31791ce141e42138eebbf005 | /RecursionTest.java | 6575064f3cbdf614e76f0d9cd319625a0d158348 | [] | no_license | Nisha556/DataStructre_prog | 7776bd692de11c643c5033712ab3ee7b37af1f59 | e35504f3e1408167c5d97c123cc47c38c58c0a64 | refs/heads/master | 2022-12-07T10:13:29.785362 | 2020-08-31T18:13:04 | 2020-08-31T18:13:04 | 290,836,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package Recursion;
public class RecursionTest {
private static void recurse(int i)
{
try {
recurse(i+1);
}
catch(StackOverflowError e)
{
System.out.println("Recusrion depth on this system" + i + ".");
}
}
public static void main(String args[])
{
recurse(0);
}
}
| [
"shandilyanisha1@gmail.com"
] | shandilyanisha1@gmail.com |
d1d7cda6cfdb563995146853a5f389909769db43 | ca9e9e313897dc33d91eb96defe2996ff7e32036 | /kurs_java_homework/java/zadanie4/threads/AppThreads.java | ce9af33d5bc6012902ee84203a5feebe74134d18 | [] | no_license | magdalenathomas/MyCode | 342e2aebefb9665315bdfd44273ce8f411d952c3 | ade012d9138cd8be2399e63d2a8e8c4b1782287e | refs/heads/master | 2022-12-11T17:04:02.374730 | 2020-08-09T19:14:11 | 2020-08-09T19:14:11 | 174,194,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package zadanie4.threads;
public class AppThreads {
public static void main(String[] args) throws InterruptedException{
Auto a1 = new Auto(100);
Auto a2 = new Auto(50);
Thread th1 = new Thread(a1);
Thread th2 = new Thread(a2);
th1.start();
//Thread.sleep(1000);
th2.start();
}
}
| [
"magdalena_thomas@poczta.fm"
] | magdalena_thomas@poczta.fm |
f82b7f8fdf98acc2049d954c571cea2938f5a3d7 | c4da222ca6f109cd9649f30634b56d97ac730d8c | /example/src/main/java/com/gaumala/mvi/example/reddit/Post.java | a7c4d7fdc5b83ae99ed74477793edb3c114e31f3 | [] | no_license | GAumala/mvi-android | 3a443c2f2afac106fbfdc5770cb51c88db171c39 | 184077c3f934dbaa06f26781a43307346fdf3e08 | refs/heads/master | 2020-05-18T08:32:08.008396 | 2019-07-22T20:06:18 | 2019-07-22T20:06:18 | 184,297,530 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | package com.gaumala.mvi.example.reddit;
import android.os.Parcelable;
import com.google.auto.value.AutoValue;
@AutoValue
public abstract class Post implements Parcelable {
public abstract String title();
public abstract String url();
public abstract int karma();
public static Post create(String title, String url, int karma) {
return new AutoValue_Post(title, url, karma);
}
}
| [
"gaumala@protonmail.com"
] | gaumala@protonmail.com |
999941b9cd90fd6075d9f9228fb7eca823cf49b8 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /resourcemanager-20161111/src/main/java/com/aliyun/resourcemanager20161111/models/CreateServiceLinkedRoleRequest.java | 7c614986b8628074bbc368dd9168a5a52b493cdb | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,298 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.resourcemanager20161111.models;
import com.aliyun.tea.*;
public class CreateServiceLinkedRoleRequest extends TeaModel {
@NameInMap("CustomSuffix")
public String customSuffix;
@NameInMap("Description")
public String description;
@NameInMap("ServiceName")
public String serviceName;
public static CreateServiceLinkedRoleRequest build(java.util.Map<String, ?> map) throws Exception {
CreateServiceLinkedRoleRequest self = new CreateServiceLinkedRoleRequest();
return TeaModel.build(map, self);
}
public CreateServiceLinkedRoleRequest setCustomSuffix(String customSuffix) {
this.customSuffix = customSuffix;
return this;
}
public String getCustomSuffix() {
return this.customSuffix;
}
public CreateServiceLinkedRoleRequest setDescription(String description) {
this.description = description;
return this;
}
public String getDescription() {
return this.description;
}
public CreateServiceLinkedRoleRequest setServiceName(String serviceName) {
this.serviceName = serviceName;
return this;
}
public String getServiceName() {
return this.serviceName;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
432e6f44061416dccbfdc4cd6b306798fdf150a2 | 3287552769c6f1dc735fe4cd70c429eec3f8759a | /codelabor-system-core/src/test/java/org/codelabr/system/util/StringUtilsTest.java | e7ff18ab9151133770a2e1cca9900112d9ebf1fc | [
"Apache-2.0"
] | permissive | kwbaek/codelabor | bbe4e4a8852dcb74ffed0cac38e810560eab2106 | 14e1a623a00d03e924557bf16ddd9b6640dae1d1 | refs/heads/master | 2020-05-20T10:02:27.014587 | 2015-07-26T16:16:35 | 2015-07-26T16:16:35 | 42,217,187 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | 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.codelabr.system.util;
import static org.junit.Assert.assertTrue;
import org.codelabor.system.util.StringUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* DateUtils 테스트 케이스
*
* @author Shin Sang-jae
*
*/
public class StringUtilsTest {
/**
* 로거
*/
Logger logger = LoggerFactory.getLogger(StringUtilsTest.class);
@Test
public void testRemoveNonAlphanumeric() {
String originalString = "!@#$1234QWERASDFqwerasdf가나다라 \t\n\r";
String removedString = StringUtils
.removeNonAlphanumeric(originalString);
assertTrue(org.apache.commons.lang3.StringUtils
.isAlphanumeric(removedString));
}
}
| [
"codelabor@28bd6c16-bb75-11dd-ad1f-f1f9622dbc98"
] | codelabor@28bd6c16-bb75-11dd-ad1f-f1f9622dbc98 |
db093f0d205ebc0f98c3e19b08948c75722fed41 | c3ce8baf020634866d0cad8bbb75262e1d2e2d43 | /DAO/src/main/java/com/dalian/sea/parameter/ReturnGoodsPara.java | 3a78f166f26f7d06ac91233f8ede0528a2bf9af9 | [] | no_license | ChrisYangjian007/test | 756cfc2f093e193f440085fc525b812a6a983513 | 5a770a3b3c3872cf41126439131253cb85ecaf95 | refs/heads/master | 2020-03-21T17:11:42.018601 | 2018-06-27T03:02:06 | 2018-06-27T03:02:06 | 138,819,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 578 | java | package com.dalian.sea.parameter;
import com.dalian.sea.model.ReturnGoods;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author YH
*/
@Data
public class ReturnGoodsPara extends ReturnGoods{
private Long isMaterial;
private String materialName;
private String updateUserName;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date beginTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/**
* 资源id
*/
Long resourceId;
}
| [
"yangjian_yj1234@163.com"
] | yangjian_yj1234@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.