blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 132
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 28
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
352
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2cfd4c85199e63fe10fecf16e1c82ebff011eda0
|
66cf615e7f9f7255d0934535184a08794208f5ad
|
/mf-predictor/mf_predictor/trunk/mf_predictor/src/test/java/jp/ndca/test/MovieLensDataHandler.java
|
327004354908d0ec53582677fdcfbe130e93a83c
|
[] |
no_license
|
igara432/mf-predictor
|
91d8589c539c1a85605be3746dc57d63a3114ef7
|
d91d605d217160750af5aa198ce161a4a2b7ae4c
|
refs/heads/master
| 2021-01-10T10:18:07.963473
| 2011-08-10T05:56:49
| 2011-08-10T05:56:49
| 55,459,083
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,616
|
java
|
package jp.ndca.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import jp.ndca.recommend.common.data.RatingDataset;
import jp.ndca.recommend.common.util.RatingDatasetMaker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MovieLensDataHandler {
private static Logger log = LoggerFactory.getLogger(MovieLensDataHandler.class);
private static String encode = "utf-8";
public static RatingDataset[] get5FolodTrainingData() throws IOException{
int foldNum = 5;
RatingDataset[] trainingDataset = new RatingDataset[foldNum];
RatingDatasetMaker datasetMaker = new RatingDatasetMaker();
for( int i = 0 ; i < foldNum ; i++ ){
String learningPath = "u" + (i+1) + ".base";
log.info(learningPath);
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( learningPath );
BufferedReader br = new BufferedReader ( new InputStreamReader(is, encode) );
while( br.ready() ){
String line = br.readLine();
String[] splits = line.split("\t");
if( splits.length != 4 )
throw new IllegalArgumentException("data format error");
int userID = Integer.parseInt( splits[0] ) - 1;
int itemID = Integer.parseInt( splits[1] );
int rating = Integer.parseInt( splits[2] );
datasetMaker.add(userID, itemID, rating);
}
br.close();
trainingDataset[i] = datasetMaker.create();
datasetMaker.refresh();
}
return trainingDataset;
}
public static RatingDataset[] get5FolodTestData() throws IOException{
int foldNum = 5;
RatingDataset[] trainingDataset = new RatingDataset[foldNum];
RatingDatasetMaker datasetMaker = new RatingDatasetMaker();
for( int i = 0 ; i < foldNum ; i++ ){
String learningPath = "u" + (i+1) + ".test";
log.info(learningPath);
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( learningPath );
BufferedReader br = new BufferedReader ( new InputStreamReader(is, encode) );
while( br.ready() ){
String line = br.readLine();
String[] splits = line.split("\t");
if( splits.length != 4 )
throw new IllegalArgumentException("data format error");
int userID = Integer.parseInt( splits[0] ) - 1;
int itemID = Integer.parseInt( splits[1] );
int rating = Integer.parseInt( splits[2] );
datasetMaker.add(userID, itemID, rating);
}
br.close();
trainingDataset[i] = datasetMaker.create();
datasetMaker.refresh();
}
return trainingDataset;
}
}
|
[
"hattori_tsukasa@cyberagent.co.jp"
] |
hattori_tsukasa@cyberagent.co.jp
|
cc35abde965f91159205e4a47896a0113c4eff19
|
149e03af23cb885844f2fe768b44096ea3adf9e9
|
/src/main/java/lv/javaguru/java2/config/SpringConfig.java
|
88caa2716292c024ee7679344b0a545d53b83d73
|
[] |
no_license
|
profaust93/MyTi
|
213a8ca6157ca9128eb60b255e8cf507f9f43631
|
704a09c16e6000d7429343646b4ec7779339fc63
|
refs/heads/master
| 2021-01-21T04:50:54.287060
| 2016-06-08T10:01:19
| 2016-06-08T10:01:19
| 53,520,119
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,650
|
java
|
package lv.javaguru.java2.config;
import org.apache.commons.dbcp.BasicDataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
import java.beans.PropertyVetoException;
import java.util.Properties;
@Configuration
@ComponentScan(basePackages = "lv.javaguru.java2")
@EnableTransactionManagement
public class SpringConfig {
private static final String DATABASE_PROPERTIES_FILE = "database.properties";
@Bean
public static PropertySourcesPlaceholderConfigurer prodPropertiesPlaceholderConfigurer() {
PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer();
Resource[] resourceLocations = new Resource[] {
new ClassPathResource(DATABASE_PROPERTIES_FILE)
};
p.setLocations(resourceLocations);
return p;
}
@Bean
public Properties hibernateProperties(
@Value("${hibernate.dialect}") String dialect,
@Value("${hibernate.show_sql}") boolean showSql,
@Value("${hibernate.format_sql}") boolean formatSql,
@Value("${hibernate.hbm2ddl.auto}") String hbm2ddl) {
Properties properties = new Properties();
properties.put("hibernate.dialect", dialect);
properties.put("hibernate.show_sql", showSql);
properties.put("hibernate.format_sql", formatSql);
properties.put("hibernate.hbm2ddl.auto", hbm2ddl);
return properties;
}
@Bean(destroyMethod = "close")
public DataSource dataSource(
@Value("${driverClass}") String driver,
@Value("${dbUrl}") String url,
@Value("${database.userName}") String user,
@Value("${password}") String password) throws PropertyVetoException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(driver);
dataSource.setUrl(url);
dataSource.setUsername(user);
dataSource.setPassword(password);
dataSource.setDefaultAutoCommit(false);
return dataSource;
}
@Bean
public SessionFactory sessionFactory(DataSource dataSource,
@Value("${hibernate.packagesToScan}") String packagesToScan,
@Qualifier("hibernateProperties") Properties properties) throws Exception {
LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
sessionFactoryBean.setPackagesToScan(packagesToScan.split(";"));
sessionFactoryBean.setHibernateProperties(properties);
sessionFactoryBean.afterPropertiesSet();
return sessionFactoryBean.getObject();
}
@Bean
public PlatformTransactionManager transactionManager(SessionFactory sessionFactory) {
return new HibernateTransactionManager(sessionFactory);
}
}
|
[
"germans.kuzmins@gmail.com"
] |
germans.kuzmins@gmail.com
|
00dec428858a36942f11dec7eef5c02369a80d50
|
ee4c29dcea9ebc488db5a6104dd5a743659db170
|
/java/src/main/java/edu/dair/sgdb/gserver/giga/GIGASrv.java
|
d852eaab1d89e3bfb7195a51750b36eb6a439552
|
[] |
no_license
|
anirudhnarayanan/sirius
|
b711907c5c4d9a5bcf861d5be560f2a39eff60aa
|
485eaec7bb330fc2ea01d043271f71b0c546e3ca
|
refs/heads/master
| 2020-04-16T09:11:24.141417
| 2018-10-20T07:24:31
| 2018-10-20T07:24:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,663
|
java
|
package edu.dair.sgdb.gserver.giga;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadedSelectorServer;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TNonblockingServerSocket;
import edu.dair.sgdb.gserver.AbstractSrv;
import edu.dair.sgdb.partitioner.GigaIndex;
import edu.dair.sgdb.sengine.DBKey;
import edu.dair.sgdb.thrift.KeyValue;
import edu.dair.sgdb.thrift.TGraphFSServer;
import edu.dair.sgdb.utils.Constants;
import edu.dair.sgdb.utils.GLogger;
import edu.dair.sgdb.utils.JenkinsHash;
public class GIGASrv extends AbstractSrv {
public ConcurrentHashMap<ByteBuffer, GigaIndex> gigaMaps;
public GigaSplitWorker worker;
public GIGASrv() {
super();
this.gigaMaps = new ConcurrentHashMap<>();
//GigaHandler handler = new GigaHandler(this);
AsyncGigaHandler handler = new AsyncGigaHandler(this);
this.handler = handler;
this.processor = new TGraphFSServer.Processor(this.handler);
//this.worker = new GigaSplitWorker(this);
//this.workerPool.execute(worker);
}
protected GigaIndex surelyGetGigaMap(byte[] bsrc) {
ByteBuffer src = ByteBuffer.wrap(bsrc);
int startIdx = getHashLocation(bsrc, Constants.MAX_VIRTUAL_NODE);
GigaIndex t = this.gigaMaps.putIfAbsent(src, new GigaIndex(startIdx, this.serverNum));
if (t == null) {
return this.gigaMaps.get(src);
}
return t;
}
@Override
public Set<Integer> getEdgeLocs(byte[] src, int type) {
GigaIndex gi = surelyGetGigaMap(src);
Set<Integer> locs = gi.giga_get_all_servers();
return locs;
}
@Override
public Set<Integer> getEdgeLocs(byte[] src) {
return getEdgeLocs(src, 0);
}
@Override
public Set<Integer> getVertexLoc(byte[] src) {
Set<Integer> locs = new HashSet<>();
int startIdx = getHashLocation(src, Constants.MAX_VIRTUAL_NODE);
int physicalIdx = startIdx % this.serverNum;
locs.add(physicalIdx);
return locs;
}
private void initGigaSrvFromDBFile() {
// Build this.gigaMaps from DB.
DBKey minDBMeta = DBKey.MinDBKey(Constants.DB_META.getBytes(), 0);
DBKey maxDBMeta = DBKey.MaxDBKey(Constants.DB_META.getBytes(), 0);
List<KeyValue> r = this.localStore.scanKV(minDBMeta.toKey(), maxDBMeta.toKey());
for (KeyValue kv : r) {
byte[] key = kv.getKey();
DBKey dbKey = new DBKey(key);
byte[] bsrc = dbKey.dst; //dst is the real key;
byte[] gigaIndexArray = kv.getValue();
ByteBuffer src = ByteBuffer.wrap(bsrc);
GigaIndex t = new GigaIndex(gigaIndexArray);
this.gigaMaps.putIfAbsent(src, t);
}
// Build VirtualNodeStatus from DB for each GigaIndex
DBKey minDBKey = DBKey.MinDBKey();
DBKey maxDBKey = DBKey.MaxDBKey();
ArrayList<KeyValue> vals = new ArrayList<KeyValue>();
byte[] cur = this.localStore.scanLimitedRes(minDBKey.toKey(), maxDBKey.toKey(), Constants.LIMITS, vals);
while (cur != null) {
for (KeyValue kv : vals) {
DBKey dbKey = new DBKey(kv.getKey());
byte[] src = dbKey.src;
byte[] dst = dbKey.dst;
//Let's get ride of src == Constants.DB_META
if (Arrays.equals(src, Constants.DB_META.getBytes())) {
//GLogger.info("[%d] Scan %s:%s", this.localIdx, new String(src), new String(dst));
continue;
}
JenkinsHash jh = new JenkinsHash();
int dstHash = Math.abs(jh.hash32(dst));
GigaIndex gi = surelyGetGigaMap(src);;
int vid = gi.giga_get_vid_from_hash(dstHash);
gi.add_vid_count(vid);
}
vals.clear();
cur = this.localStore.scanLimitedRes(cur, maxDBKey.toKey(), Constants.LIMITS, vals);
}
}
@Override
public void start() {
try {
initGigaSrvFromDBFile();
/*
TServerTransport serverTransport = new TServerSocket(this.port);
Factory proFactory = new Factory();
TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport).processor(processor).protocolFactory(proFactory);
//NOTE: TThreadPoolServer could be the best option for concurrent client less than 10,000, check: https://github.com/m1ch1/mapkeeper/wiki/Thrift-Java-Servers-Compared
args.maxWorkerThreads(this.serverNum * 200);
TServer server = new TThreadPoolServer(args);
*/
TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(this.port);
TThreadedSelectorServer.Args tArgs = new TThreadedSelectorServer.Args(serverTransport);
tArgs.processor(processor);
tArgs.transportFactory(new TFramedTransport.Factory());
tArgs.protocolFactory(new TBinaryProtocol.Factory());
TServer server = new TThreadedSelectorServer(tArgs);
GLogger.info("[%d] start GigaSrv at %s:%d", this.getLocalIdx(), this.localAddr, this.port);
server.serve();
} catch (TException e) {
e.printStackTrace();
}
}
}
|
[
"daidongly@gmail.com"
] |
daidongly@gmail.com
|
5c40ac0831aa79313f8cbeb575ff68989ef7b427
|
8e381c005e7e80e4f85e7a3ea40f301a60099de2
|
/app/src/main/java/com/library/circularprofileupload/circularprofileupload/MainActivity.java
|
5eec01d944f2c30655ad424244ffc8a9595f7d7c
|
[] |
no_license
|
joyshah/CircularProfilePic
|
cfbec65af0768ae526fdb6c16a5a1f3364debf6c
|
2989ea076b5020aa76d06adee50c40641ca83845
|
refs/heads/master
| 2021-05-08T02:35:00.252244
| 2018-08-17T12:28:47
| 2018-08-17T12:28:47
| 108,017,183
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,714
|
java
|
package com.library.circularprofileupload.circularprofileupload;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import com.library.circularprofileupload.circularprofilepiclibrary.CircularProfile;
import com.library.circularprofileupload.circularprofilepiclibrary.CircularProfileClickListener;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final CircularProfile ap = (CircularProfile) findViewById(R.id.img1);
ap.setCircularProfileClickListener(new CircularProfileClickListener() {
@Override
public void onConcentricCircleClick() {
Log.i("MAinActivity", "onclick");
}
@Override
public void onClick() {
Log.i("MAinActivity", "noty");
}
});
findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ap.setConcentricCircleRadius(60);
ap.setCircularBorderWidth(60);
ap.setCircularBorderRadius(150);
ap.setCircularBorderColor(Color.parseColor("#FF2CD90E"));
ap.setConcentricCircleColor(Color.parseColor("#FF2CD90E"));
ap.setConcentricCircleDegree(135);
ap.setConcentricCircleImage(R.drawable.ic_person_add_black_24dp);
//ap.setHideConcentricCircle(true);
}
});
}
}
|
[
"shahjoy831994@gmail.com"
] |
shahjoy831994@gmail.com
|
c4cd9ed91b273e998078e33d2e65ad0eb58448ee
|
72473952759db71520c3271e63be29160dce0d57
|
/src/main/java/com/flamingo/controller/GirlController.java
|
9900fdaea488bec66b7c2818e4799237dc5b1270
|
[] |
no_license
|
BingYuQHS/girl_SpringBoot_2
|
6f372288c1691154d2b9953fc0e38c1cfce47c96
|
ea53820bffe1cd71dcda65b6c9bd7401910d1418
|
refs/heads/master
| 2020-03-22T14:26:40.330830
| 2018-07-08T15:34:16
| 2018-07-08T15:34:16
| 140,180,314
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,089
|
java
|
package com.flamingo.controller;
import com.flamingo.aspect.HttpAspect;
import com.flamingo.domain.Result;
import com.flamingo.repository.GirlRepository;
import com.flamingo.domain.Girl;
import com.flamingo.service.GirlService;
import com.flamingo.utils.ResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
public class GirlController {
private final static Logger logger = LoggerFactory.getLogger(GirlController.class);
@Autowired
private GirlRepository girlRepository;
@Autowired
private GirlService girlService;
/**
* 查询所有女生列表
* @return
*/
@GetMapping(value = "/girls")
public List<Girl> girlList(){
logger.info("执行girlList方法");
return girlRepository.findAll();
}
/**
* 添加一条记录
* @param girl
* @return
*/
@PostMapping(value = "/girls")
public Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult){
if (bindingResult.hasErrors()){
return ResultUtil.error(1,bindingResult.getFieldError().getDefaultMessage());
}
girl.setName(girl.getName());
girl.setAge(girl.getAge());
return ResultUtil.success(girlRepository.save(girl));
}
/**
* 根据id查询一条记录
* @param id
* @return
*/
@GetMapping(value = "/girls/{id}")
public Girl girlFindOne(@PathVariable("id") Integer id) {
return girlRepository.getOne(id);
}
/**
* 更新一条记录
* @param id
* @param name
* @param age
* @return
*/
@PutMapping(value = "/girls/{id}")
public Girl girlUpdate(@PathVariable("id") Integer id,
@RequestParam("name") String name,
@RequestParam("age") Integer age){
Girl girl = new Girl();
girl.setId(id);
girl.setName(name);
girl.setAge(age);
return girlRepository.save(girl);
}
/**
* 删除一条记录
* @param id
*/
@DeleteMapping(value = "/girls/{id}")
public void girlDelete(@PathVariable("id") Integer id){
girlRepository.deleteById(id);
}
/**
* 根据年龄查询
* @param age
* @return
*/
@GetMapping(value = "/girls/age/{age}")
public List<Girl> girlListByAge(@PathVariable("age") Integer age){
return girlRepository.findByAge(age);
}
/**
* 插入两条记录
*/
@PostMapping(value = "/girls/two")
public void girlTwo(){
girlService.insertTwo();
}
@GetMapping(value = "girls/getAge/{id}")
public void getAge(@PathVariable("id") Integer id) throws Exception{
girlService.getAge(id);
}
}
|
[
"1756217895@qq.com"
] |
1756217895@qq.com
|
97b7eff3d24d508b12d9bafbe6ddd154bb0f0514
|
4d4fb4b025e6a096db15a5bac50f76eb8a1e7fd9
|
/app/src/main/java/com/zhaopf/createvcf/MainActivity.java
|
10d39f9d736ea3e2c8647c1620824a4e32be2541
|
[] |
no_license
|
zhao-pf/VcfCreate
|
348a92f0d57e890b28fd47f37f9a0cf243a1a2be
|
1a9649abdaa2ef435b2084e93c8db153cdc7b0bf
|
refs/heads/master
| 2020-09-13T13:57:09.132226
| 2020-02-27T06:27:21
| 2020-02-27T06:27:21
| 222,808,053
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 9,199
|
java
|
package com.zhaopf.createvcf;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import a_vcard.android.provider.Contacts;
import a_vcard.android.syncml.pim.vcard.ContactStruct;
import a_vcard.android.syncml.pim.vcard.VCardComposer;
import a_vcard.android.syncml.pim.vcard.VCardException;
/**
* 根据规则批量创建Vcf联系人文件
*
* @author zhao-pf 2019/11/19
* Github:https://github.com/zhao-pf/VcfCreate
*/
public class MainActivity extends AppCompatActivity {
public static final String VCARD_FILE_PATH = Environment.getExternalStorageDirectory() + "/Download";
//读写权限
private static String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
//请求状态码
private static int REQUEST_PERMISSION_CODE = 1;
EditText startNumber1;
EditText startNumber2;
EditText startNumber3;
EditText number;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = findViewById(R.id.createVcard);
number = findViewById(R.id.et_number);//生成数量
startNumber1 = findViewById(R.id.et_startNumber1);//字段 1
startNumber2 = findViewById(R.id.et_startNumber2);//字段 2
startNumber3 = findViewById(R.id.et_startNumber3);//字段 3
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
number = findViewById(R.id.et_number);//生成数量
startNumber1 = findViewById(R.id.et_startNumber1);//字段 1
startNumber2 = findViewById(R.id.et_startNumber2);//字段 2
startNumber3 = findViewById(R.id.et_startNumber3);//字段 3
if (startNumber1.getText().toString().trim().equals("")) {
Toast.makeText(MainActivity.this, "号码为空", Toast.LENGTH_SHORT).show();
} else {
if (number.getText().toString().trim().equals("")) {
Toast.makeText(MainActivity.this, "数量为空", Toast.LENGTH_SHORT).show();
} else {
long start_number1 = Long.parseLong(String.valueOf(startNumber1.getText()));
long start_number2 = Long.parseLong(String.valueOf(startNumber2.getText()));
long start_number3 = Long.parseLong(String.valueOf(startNumber3.getText()));
long create_number = Integer.parseInt(String.valueOf(number.getText()));
int x = (int) Math.pow(10, number.length()) - 1;
long maxnumber = (int) Math.pow(10, startNumber2.length()) - 1;
Log.e("x", String.valueOf(x));
Log.e("start_number", String.valueOf(start_number2));
long max = maxnumber - start_number2;
if (create_number > max) {
Log.e("max", String.valueOf(max));
Toast.makeText(MainActivity.this, "最大生成数量为" + max, Toast.LENGTH_SHORT).show();
number.setText(max + "");
} else {
Toast.makeText(MainActivity.this, "生成成功", Toast.LENGTH_SHORT).show();
generatorVCard(start_number1, start_number2, start_number3, create_number);//生成函数,判断循环某项就可以
}
}
}
}
});
startNumber1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (startNumber1.length() == 3) {
startNumber2.requestFocus();
}
}
});
startNumber2.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
startNumber3.setFilters(new InputFilter[]{new InputFilter.LengthFilter(8 - startNumber2.length())});
if (startNumber2.length() == 7) {
startNumber3.requestFocus();
}
}
});
}
/**
* 获取存储权限
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_PERMISSION_CODE) {
for (int i = 0; i < permissions.length; i++) {
if (grantResults[i] == -1) {
this.finish();
Toast.makeText(this, "未获取存储权限", Toast.LENGTH_SHORT).show();
}
}
}
}
// 生成vcard文件
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@SuppressLint("SimpleDateFormat")
public void generatorVCard(long number1, long number2, long number3, long creatNumber) {
//获取存储权限
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, PERMISSIONS_STORAGE, REQUEST_PERMISSION_CODE);
}
}
String fileName = "数量" + creatNumber + ".vcf";
OutputStreamWriter writer;
File file = new File(VCARD_FILE_PATH, fileName);
//得到存储卡的根路径,将fileName的文件写入到根目录下
try {
writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
//通过循环遍历生成联系人,可以通过随机生成名字
for (int i = 0; i <= creatNumber; i++) {
number2++;
// Log.e("number1", String.valueOf(number1));
// Log.e("number2", String.valueOf(number2));
// Log.e("number3", String.valueOf(number3));
//创建一个联系人
VCardComposer composer = new VCardComposer();
ContactStruct contact1 = new ContactStruct();
contact1.name = number + "";//名字
contact1.addPhone(Contacts.Phones.TYPE_MOBILE, number1+String.valueOf(number2)+number3, null, true);
String vcardString;
vcardString = composer.createVCard(contact1, VCardComposer.VERSION_VCARD30_INT);
//将vcardString写入
writer.write(vcardString);
writer.write("\n");
}
writer.close();
Toast.makeText(MainActivity.this, "已成功导出到Download/" + fileName + "文件", Toast.LENGTH_SHORT).show();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (VCardException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//跳转到GitHub
public void goToGitHub(View view) {
Uri uri = Uri.parse("https://github.com/zhao-pf/VcfCreate");
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(uri);
startActivity(intent);
}
}
|
[
"2722246227@qq.com"
] |
2722246227@qq.com
|
a33eecf3a1049bcd3234158062dc4a673907c984
|
13b48e6194328829a1eae8b70b383b31ca6f6341
|
/src/main/java/com/ecs/measure/GUI/Screen.java
|
adc146eacb2ae6555ed13b092766e24ab16b3259
|
[
"MIT"
] |
permissive
|
IgorTimofeev/Measure
|
f036114d1e145064bd564547bd17c53b66f7efc1
|
fbf3e973252bc1b5a0d663bf5dd21657ed480017
|
refs/heads/master
| 2020-03-21T12:40:53.168404
| 2018-06-25T23:42:33
| 2018-06-25T23:42:33
| 138,566,216
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,572
|
java
|
package com.ecs.measure.GUI;
import com.ecs.measure.Measure;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.input.Mouse;
public class Screen extends GuiScreen {
public MainContainer container;
public class MainContainer extends Container {
MainContainer(int x, int y, int width, int height) {
super(x, y, width, height);
}
@Override
public void update() {
ScaledResolution scaledResolution = new ScaledResolution(Measure.minecraft);
width = scaledResolution.getScaledWidth();
height = scaledResolution.getScaledHeight();
super.update();
}
}
public Screen() {
this.container = new MainContainer(0, 0, Measure.minecraft.displayWidth, Measure.minecraft.displayHeight);
}
private void handleMouse(Container container, int mouseX, int mouseY, boolean objectFound) {
Object child;
for (int i = container.children.size() - 1; i >= 0; i--) {
child = container.children.get(i);
if (child instanceof Container) {
handleMouse((Container) child, mouseX, mouseY, objectFound);
}
else {
if (!child.hidden && !child.disabled) {
if (objectFound) {
child.hovered = false;
}
else {
child.hovered = child.isPointInside(mouseX, mouseY);
if (child.hovered)
objectFound = true;
}
if (child.onMouseEvent != null)
child.onMouseEvent.run(mouseX, mouseY);
}
else {
child.hovered = false;
}
}
}
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
@Override
public void handleMouseInput() {
int scaleFactor = new ScaledResolution(Measure.minecraft).getScaleFactor();
handleMouse(
container,
Mouse.getEventX() / scaleFactor,
(Measure.minecraft.displayHeight - Mouse.getEventY() - 3) / scaleFactor,
false
);
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
container.update();
container.draw();
}
}
|
[
"methodman1@mail.ru"
] |
methodman1@mail.ru
|
ebeb489d9ec3024ec5cd166f2975970d5fb35369
|
f31040c83d613f3672b55bbb7ef6d2f026b5d087
|
/app/src/main/java/com/example/samjingwen/androidbookstore/EditActivity.java
|
2c1bdaf470c12e6a1b3535778cdae9cda7c11d04
|
[] |
no_license
|
samjingwen/AndroidBookstore
|
68076a6d74f7e1790739e811c033c390d88dbce5
|
162e4e266c8dcc0439d56e4622b4934642f286ee
|
refs/heads/master
| 2021-10-09T15:08:24.259350
| 2018-12-30T06:06:06
| 2018-12-30T06:06:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,000
|
java
|
package com.example.samjingwen.androidbookstore;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import java.util.List;
public class EditActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
Intent intent = getIntent();
int id = Integer.parseInt(intent.getExtras().getString("BookID"));
new AsyncTask<Integer, Void, Book>(){
@Override
protected Book doInBackground(Integer...id){
return Book.ReadBook(id[0]);
}
@Override
protected void onPostExecute(Book book) {
show(book);
}
}.execute(id);
}
void show(Book book) {
int []dest = new int[]{R.id.editText1, R.id.editText2, R.id.editText3, R.id.editText4, R.id.editText5, R.id.editText6};
String []src = new String[]{"BookID", "Title", "Category", "Author", "Stock", "Price"};
for (int n=0; n<dest.length; n++) {
EditText txt = findViewById(dest[n]);
txt.setText(book.get(src[n]));
}
int id = Integer.parseInt(book.get("BookID"));
new AsyncTask<Integer, Void, Bitmap>(){
@Override
protected Bitmap doInBackground(Integer...id){
return Book.getPhoto(id[0]);
}
@Override
protected void onPostExecute(Bitmap bitmap) {
ImageView image = findViewById(R.id.imageView);
image.setImageBitmap(bitmap);
}
}.execute(id);
}
public void save(View v){
AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
builder1.setMessage("Confirm update?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
int []src = new int[]{R.id.editText1, R.id.editText2, R.id.editText3, R.id.editText4, R.id.editText5, R.id.editText6};
String []dest = new String[6];
for (int n=0; n<dest.length; n++) {
EditText txt = findViewById(src[n]);
dest[n] = txt.getText().toString();
}
Book book = new Book(dest[0], dest[1], dest[2], dest[3],dest[4],dest[5],"");
new AsyncTask<Book, Void, Void>() {
@Override
protected Void doInBackground(Book... params) {
Book.saveBook(params[0]);
return null;
}
}.execute(book);
Toast.makeText(getApplicationContext(), "Book updated", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
}
}
|
[
"e0321129@u.nus.edu"
] |
e0321129@u.nus.edu
|
43291f6fd1f3880960b055cbea5c8f11234d23b6
|
7efbd298b931bdd1234f067b8d2aaecd5277d97e
|
/src/com/company/Driver.java
|
253ff6f57757c75134f3fec9cfa0ec7b35c0b6a5
|
[] |
no_license
|
AdamJamil/PottsModel
|
819f8965dd6fb6b68876d7a4e0c909a715be5f34
|
0f750fd1fbf8cc4da11d88eb058f2e5d58452e5a
|
refs/heads/master
| 2020-06-02T17:18:29.424512
| 2019-06-26T06:47:03
| 2019-06-26T06:47:03
| 191,245,428
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 19,893
|
java
|
package com.company;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import static com.company.Main.*;
class Driver
{
TransitionMatrix tm;
static ArrayList<State> states;
ArrayList<boolean[]> upsets = new ArrayList<>();
private static ArrayList<Arrow> arrows = new ArrayList<>();
private static int[][] neighbors;
//stores all the information regarding "bad cases" (ie the upset criteria doesn't work)
ArrayList<State> bs1, bs2;
ArrayList<RESum> p1, p2;
ArrayList<boolean[]> bu;
private boolean[][] partialOrder, temp;
private boolean[][] minUpset;
private boolean[][] blacklist;
private boolean[][] minRel;
ArrayList<boolean[][]> partialOrders = new ArrayList<>();
private ArrayList<Integer>[] checklist;
private static final double err = 0.00000000001;
private long time;
Driver()
{
arrows.add(new Arrow(" does (*→B)", new int[]{1, -1, 0}));
arrows.add(new Arrow(" does (*→†)", new int[]{0, -1, 1}));
arrows.add(new Arrow(" does (B→†)", new int[]{-1, 0, 1}));
arrows.add(new Arrow(" does (B→*)", new int[]{-1, 1, 0}));
arrows.add(new Arrow(" does (†→*)", new int[]{0, 1, -1}));
arrows.add(new Arrow(" does (†→B)", new int[]{1, 0, -1}));
arrows.add(new Arrow(" does (nothing)", new int[]{0, 0, 0}));
tm = new TransitionMatrix();
initializeNeighbors();
initializePow();
initializeProbArr();
partialOrder = guessAndInitPartialOrder();
fixPartialOrder();
System.out.println(new DecimalFormat("#.000").format(((double) (System.nanoTime() - time)) / 1000000000) + "s");
partialOrders.add(partialOrder);
checkTransitivity();
printMinPartialOrder(partialOrder);
}
private void fixPartialOrder()
{
boolean good = false;
while (!good)
{
partialOrders.add(copy(partialOrder));
initializeMinUpset(partialOrder);
initalizeOtherCrapTemp(partialOrder); //TODO: REMOVE THIS LATER OR NOT //DEPENDS ON MEMORY
getUpset(partialOrder);
//oneStepCoupling(partialOrder);
good = true;
for (int i = 1; i < blacklist.length; i++)
{
int idx = -1;
for (int j = 0; j < blacklist.length; j++)
if (blacklist[i][j])
partialOrder[i][idx = j] = (blacklist[i][j] = false);
good &= idx == -1;
}
if (good)
{
boolean actuallyGood = true;
for (boolean bArr[] : blacklist)
for (boolean b : bArr)
actuallyGood &= !b;
if (!actuallyGood)
System.out.println("shippaishita :(");
else
System.out.println("sakusen kanryo!!!");
}
}
}
private boolean[][] guessAndInitPartialOrder()
{
boolean[][] geq = new boolean[states.size()][states.size()];
for (int i = 0; i < geq.length; i++)
for (int j = 0; j < geq.length; j++)
{
State s1 = states.get(i), s2 = states.get(j);
int[] o1 = s1.order, o2 = s2.order;
geq[i][j] = (i == j) || (i == 0) || (o1[0] >= k && o2[0] >= k && s1.geq(s2)) || (o2[2] == 0 && o1[0] == o2[0]) || (o2[2] == 0 && s1.geq(s2));
}
for (double lambda = 1.01; lambda < 100; lambda *= 1.01)
{
double[][] arr = tm.evaluate(lambda), temp = new double[arr.length][arr.length];
for (int i = 0; i < arr.length; i++)
System.arraycopy(arr[i], 0, temp[i], 0, arr[i].length);
for (int pow = 0; pow < 100; pow++)
{
arr = multiply(arr, temp);
for (int i = 0; i < geq.length; i++)
for (int j = 0; j < geq.length; j++)
geq[i][j] &= arr[i][0] + err >= arr[j][0];
}
}
return geq;
}
//maps from pair of (state|neighbors) (format 32-7|7) to result of comparison
private HashMap<Integer, Boolean> result = new HashMap<>();
//maps from (state|neighbors) to RESum of probability of going into upset
private HashMap<Integer, RESum> probability = new HashMap<>();
// @SuppressWarnings("Duplicates")
// void oneStepCoupling(boolean[][] partialOrder)
// {
// blacklist = new boolean[partialOrder.length][partialOrder.length];
// boolean[][] minRel = copy(minUpset);
//
// //init minRel
// for (int i = 0; i < partialOrder.length; i++)
// {
// boolean[] set = minRel[i];
// set[i] = false;
//
// outer:
// for (int j = 0; j < minUpset.length; j++)
// {
// if (!set[j])
// continue;
//
// for (int k = 0; k < minUpset.length; k++)
// {
// if (!set[k])
// continue;
//
// if (j == k)
// continue;
//
// if (minRel[k][j])
// {
// set[j] = false;
// continue outer;
// }
// }
// }
// }
//
// long time = System.nanoTime();
// System.out.println("sakusen kaishi!");
//
// ArrayList<Integer>[] checklist = new ArrayList[states.size()];
//
// for (int i = 0; i < partialOrder.length; i++)
// {
// checklist[i] = new ArrayList<>(partialOrder.length);
// for (int j = 0; j < partialOrder.length; j++)
// if (i != j && partialOrder[i][j] && minRel[j][i])
// checklist[i].add(j);
// }
//
// for (boolean[] upset : upsets)
// {
// for (int i = 0; i < partialOrder.length; i++)
// {
// int key1 = i << 7;
// for (int j = 0; j < neighbors[i].length; j++)
// if (upset[neighbors[i][j]])
// key1 += (1 << j);
//
// outer:
// for (int w = checklist[i].size() - 1; w >= 0; w--)
// {
// int j = checklist[i].get(w);
//
// int key2 = j << 7;
// for (int k = 0; k < neighbors[j].length; k++)
// if (upset[neighbors[j][k]])
// key2 += (1 << k);
//
// boolean temp;
// int key = (key1 << 16) + key2;
//
// if (result.containsKey(key))
// temp = result.get(key);
// else
// {
// RESum p1, p2;
//
// if (probability.containsKey(key1))
// p1 = probability.get(key1);
// else
// {
// p1 = new RESum();
// for (int k = 0; k < 7; k++)
// if ((key1 & (1 << k)) != 0)
// p1.add(tm.arr[i][neighbors[i][k]]);
// probability.put(key1, p1);
// }
//
// if (probability.containsKey(key2))
// p2 = probability.get(key2);
// else
// {
// p2 = new RESum();
// for (int k = 0; k < 7; k++)
// if ((key2 & (1 << k)) != 0)
// p2.add(tm.arr[j][neighbors[j][k]]);
// probability.put(key2, p2);
// }
//
// result.put(key, temp = p1.geq(p2));
// }
//
// if (!temp)
// {
// blacklist[i][j] = true;
// checklist[i].remove(w);
// }
// }
// }
// }
//
// System.out.println(((double) (System.nanoTime() - time)) / 1000000000 + "s");
// }
// void twoStepCoupling()
// {
// HashMap<RESum, HashMap<RESum, Integer>> map = new HashMap<>();
//
// long time = System.nanoTime();
// System.out.println("sakusen kaishi! dainimaku!!!");
//
// for (int i = 0; i < bs1.size(); i++)
// {
// State s1 = bs1.get(i), s2 = bs2.get(i);
// boolean[] upset = bu.get(i);
//
// RESum p1 = sumZero.copy();
// RESum p2 = sumZero.copy();
//
// for (State target : upset)
// {
// p1.add(tm.map2.get(s1).get(target));
// p2.add(tm.map2.get(s2).get(target));
// }
//
// int temp;
//
// if (map.containsKey(p1) && map.get(p1).containsKey(p2))
// temp = map.get(p1).get(p2);
// else
// {
// //System.out.println(p1 + " " + p2);
// temp = p1.compare(p2);
// if (!map.containsKey(p1))
// map.put(p1, new HashMap<>());
// map.get(p1).put(p2, temp);
// }
//
// if (temp == 2 || temp == 1)
// {
// System.out.println("yikes!");
// System.out.println(p1);
// System.out.println(p2);
//// bs1.add(s1);
//// bs2.add(s2);
//// bu.add(upset);
//// p1.add(p1);
//// p2.add(p2);
// }
// }
//
// System.out.println(((double) (System.nanoTime() - time)) / 1000000000 + "s");
// }
private void initializeMinUpset(boolean[][] partialOrder)
{
minUpset = new boolean[partialOrder.length][partialOrder.length];
for (int i = 0; i < partialOrder.length; i++)
for (int j = 0; j < partialOrder.length; j++)
minUpset[j][i] = partialOrder[i][j];
}
private double[][] multiply(double[][] arr1, double[][] arr2)
{
double[][] out = new double[arr1.length][arr2[0].length];
for (int i = 0; i < out.length; i++)
for (int j = 0; j < out[0].length; j++)
for (int k = 0; k < arr1.length; k++)
out[i][j] += arr1[i][k] * arr2[k][j];
return out;
}
static ArrayList<int[]> partitions()
{
ArrayList<int[]> start = new ArrayList<>(), good = new ArrayList<>();
for (int i = 0; i <= Main.n; i++)
{
int[] temp = new int[3];
temp[0]= i;
start.add(temp);
}
start = partitions(start, 1);
for (int[] ints : start)
{
int a = ints[0], b = ints[1], c = ints[2];
if (a + b + c == n && a >= b && b >= c)
good.add(ints);
}
return good;
}
private static ArrayList<int[]> partitions(ArrayList<int[]> list, int pos)
{
if (pos == 3)
return list;
ArrayList<int[]> out = new ArrayList<>();
for (int[] ints : list)
{
for (int i = 0; i <= n; i++)
{
int[] temp = new int[3];
System.arraycopy(ints, 0, temp, 0, pos);
temp[pos] = i;
out.add(temp);
}
}
return partitions(out, pos + 1);
}
private void initializePow()
{
Polynomial.pow = new ArrayList<>();
Polynomial.pow.add(Main.one.copy());
for (int i = 1; i <= 100; i++)
{
Polynomial temp = Polynomial.pow.get(i - 1).copy();
temp.multiply(Main.x);
Polynomial.pow.add(temp);
}
}
private void initializeNeighbors()
{
neighbors = new int[states.size()][];
for (int i = 0; i < states.size(); i++)
{
ArrayList<Integer> temp = new ArrayList<>();
for (int j = 0; j < arrows.size(); j++)
if (arrows.get(j).valid(states.get(i)))
temp.add(j);
neighbors[i] = new int[temp.size()];
for (int j = 0; j < neighbors[i].length; j++)
neighbors[i][j] = states.indexOf(arrows.get(temp.get(j)).map(states.get(i)));
}
}
private void initializeProbArr()
{
tm.arr = new RESum[states.size()][states.size()];
for (int i = 0; i < states.size(); i++)
{
State s1 = states.get(i);
for (Arrow arrow : arrows)
if (arrow.valid(s1))
tm.arr[i][states.indexOf(arrow.map(s1))] = tm.map.get(states.get(i)).get(arrow.map(s1)).copy();
}
for (RESum[] reSums : tm.arr)
for (RESum reSum : reSums)
if (reSum != null)
reSum.simplify();
}
private void checkTransitivity()
{
for (int i = 0; i < states.size(); i++)
for (int j = 0; j < states.size(); j++)
for (int k = 0; k < states.size(); k++)
if (partialOrder[i][j] && partialOrder[j][k] && !partialOrder[i][k])
System.out.println("not transitive :(");
}
private void printMinPartialOrder(boolean[][] partialOrder)
{
partialOrder = copy(partialOrder);
for (int i = 0; i < partialOrder.length; i++)
{
boolean[] set = minUpset[i];
set[i] = false;
outer: for (int j = 0; j < minUpset.length; j++)
{
if (!set[j])
continue;
for (int k = 0; k < minUpset.length; k++)
{
if (!set[k])
continue;
if (j == k)
continue;
if (minUpset[k][j])
{
set[j] = false;
continue outer;
}
}
}
System.out.print(states.get(i) + ": ");
for (int j = 0; j < minUpset[i].length; j++)
if (minUpset[i][j])
System.out.print(states.get(j) + " ");
System.out.println();
}
}
boolean[][] copy(boolean[][] arr)
{
boolean[][] out = new boolean[arr.length][arr[0].length];
for (int i = 0; i < arr.length; i++)
System.arraycopy(arr[i], 0, out[i], 0, arr[i].length);
return out;
}
private void getUpset(boolean[][] partialOrder)
{
//upsets = new ArrayList<>();
temp = partialOrder;
boolean[] allowed = new boolean[partialOrder.length];
for (int i = 0; i < partialOrder.length; i++)
allowed[i] = true;
generateAntichains(new boolean[partialOrder.length], allowed);
//System.out.println(upsets.size());
}
private void generateAntichains(boolean[] curr, boolean[] allowed)
{
int idx = -1;
for (int i = 0; i < allowed.length; i++)
if (allowed[i])
{
idx = i;
break;
}
if (idx == -1)
{
boolean[] upset = new boolean[partialOrder.length], cp = new boolean[partialOrder.length];
for (int i = 0; i < curr.length; i++)
if (curr[i])
for (int j = 0; j < minUpset.length; j++)
upset[j] |= minUpset[i][j];
System.arraycopy(upset, 0, cp, 0, upset.length);
upsets.add(cp);
for (int i = 0; i < partialOrder.length; i++)
{
int key1 = i << 7;
for (int j = 0; j < neighbors[i].length; j++)
if (upset[neighbors[i][j]])
key1 += (1 << j);
for (int w = checklist[i].size() - 1; w >= 0; w--)
{
int j = checklist[i].get(w);
int key2 = j << 7;
for (int k = 0; k < neighbors[j].length; k++)
if (upset[neighbors[j][k]])
key2 += (1 << k);
boolean temp;
int key = (key1 << 16) + key2;
if (result.containsKey(key))
temp = result.get(key);
else
{
RESum p1, p2;
if (probability.containsKey(key1))
p1 = probability.get(key1);
else
{
p1 = new RESum();
for (int k = 0; k < 7; k++)
if ((key1 & (1 << k)) != 0)
p1.add(tm.arr[i][neighbors[i][k]]);
probability.put(key1, p1);
}
if (probability.containsKey(key2))
p2 = probability.get(key2);
else
{
p2 = new RESum();
for (int k = 0; k < 7; k++)
if ((key2 & (1 << k)) != 0)
p2.add(tm.arr[j][neighbors[j][k]]);
probability.put(key2, p2);
}
result.put(key, temp = p1.geq(p2));
}
if (!temp)
{
blacklist[i][j] = true;
checklist[i].remove(w);
}
}
}
return;
}
allowed[idx] = false;
boolean[] other = new boolean[curr.length], otherAllowed = new boolean[allowed.length];
System.arraycopy(curr, 0, other, 0, curr.length);
System.arraycopy(allowed, 0, otherAllowed, 0, allowed.length);
generateAntichains(curr, allowed);
other[idx] = true;
for (int i = 0; i < otherAllowed.length; i++)
if (minUpset[idx][i] || temp[idx][i])
otherAllowed[i] = false;
generateAntichains(other, otherAllowed);
}
private void initalizeOtherCrapTemp(boolean[][] partialOrder)
{
blacklist = new boolean[partialOrder.length][partialOrder.length];
minRel = copy(minUpset);
//init minRel
for (int i = 0; i < partialOrder.length; i++)
{
boolean[] set = minRel[i];
set[i] = false;
outer:
for (int j = 0; j < minUpset.length; j++)
{
if (!set[j])
continue;
for (int k = 0; k < minUpset.length; k++)
{
if (!set[k])
continue;
if (j == k)
continue;
if (minRel[k][j])
{
set[j] = false;
continue outer;
}
}
}
}
time = System.nanoTime();
System.out.println("sakusen kaishi!");
checklist = new ArrayList[states.size()];
for (int i = 0; i < partialOrder.length; i++)
{
checklist[i] = new ArrayList<>(partialOrder.length);
for (int j = 0; j < partialOrder.length; j++)
if (i != j && partialOrder[i][j])// && minRel[j][i])
checklist[i].add(j);
}
}
}
|
[
"adam.a1d9c@gmail.com"
] |
adam.a1d9c@gmail.com
|
32d0ad309a23d6592e7d0e61128681598796a8e1
|
dc2abd1a2d7153f429e909355b8e40d03531eb7a
|
/src/com/primeresponse/testcases/Accounts/Send_SocialIntegrationEmail.java
|
d0c77043c6fe705fa5594a46b782b13cfacb0a2a
|
[] |
no_license
|
rajkrsingh/Prime-Project
|
acdf4bb466f9a821fffe2d96031af06b6257cd21
|
60e0250cafcd93a7d58ea98fa30d1550b4028a5d
|
refs/heads/master
| 2020-03-19T02:53:49.344714
| 2018-06-01T05:47:00
| 2018-06-01T05:47:00
| 135,672,472
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,331
|
java
|
package com.primeresponse.testcases.Accounts;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.primeresponse.pagehelper.AccountsHelper;
import com.primeresponse.pagehelper.HeaderHelper;
import com.primeresponse.pagehelper.LoginHelper;
import com.primeresponse.util.DriverTestCase;
import com.primeresponse.util.ExecutionLog;
public class Send_SocialIntegrationEmail extends DriverTestCase {
@Test
public void testSend_SocialIntegrationEmail() throws Exception {
// Initialize objects
loginHelper = new LoginHelper(getWebDriver());
headerHelper = new HeaderHelper(getWebDriver());
AccountsHelper accountsHelper = new AccountsHelper(getWebDriver());
ExecutionLog.LogAddClass(this.getClass().getName()
+ " and Test method "
+ Thread.currentThread().getStackTrace()[1].getMethodName());
try {
// Open application
getWebDriver().navigate().to(applicationUrl);
ExecutionLog.Log("open application giturl");
// login to the application
login("Admin");
ExecutionLog.Log("log-in into application");
// Select "Selenium Test" Account if not selected
selectAccount();
ExecutionLog.Log("Select Selenium Test Account if not selected");
//Click on logged in account edit icon
headerHelper.clickOnEditIconOfLoggedAccount();
ExecutionLog.Log("Click on logged in account edit icon");
//Click on Accounts->Users
getWebDriver().navigate().to("https://app.prime-response.com/accounts/13594/accounts_users");
//headerHelper.clickOnUsers();
//ExecutionLog.Log("Click on Accounts->Users");
//Method to Send Social Integration
accountsHelper.sendSocialIntegration(userEmail);
ExecutionLog.Log("Method to Send Social Integration");
//verify the success notification
headerHelper.checkSuccessMessage("Email successfully sent to "+userEmail+" for social integration.");
ExecutionLog.Log("success message");
}
catch (Error e) {
captureScreenshot("testSend_SocialIntegrationEmail");
ExecutionLog.LogErrorMessage(e);
throw e;
} catch (Exception e) {
captureScreenshot("testSend_SocialIntegrationEmail");
ExecutionLog.LogExceptionMessage(e);
throw e;
}
}
@AfterMethod
public void endMethods() throws Exception {
ExecutionLog.LogEndClass(this.getClass().getName());
}
}
|
[
"you@example.com"
] |
you@example.com
|
86cf19b6287a16e3508e353050ee67e298960574
|
9410ef0fbb317ace552b6f0a91e0b847a9a841da
|
/src/main/java/com/tencentcloudapi/tdid/v20210519/models/DownCptResponse.java
|
ff8a06fe60b73fba1a6ee8a1c522f312d95b1b00
|
[
"Apache-2.0"
] |
permissive
|
TencentCloud/tencentcloud-sdk-java-intl-en
|
274de822748bdb9b4077e3b796413834b05f1713
|
6ca868a8de6803a6c9f51af7293d5e6dad575db6
|
refs/heads/master
| 2023-09-04T05:18:35.048202
| 2023-09-01T04:04:14
| 2023-09-01T04:04:14
| 230,567,388
| 7
| 4
|
Apache-2.0
| 2022-05-25T06:54:45
| 2019-12-28T06:13:51
|
Java
|
UTF-8
|
Java
| false
| false
| 2,445
|
java
|
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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.tencentcloudapi.tdid.v20210519.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class DownCptResponse extends AbstractModel{
/**
* The unique request ID, which is returned for each request. RequestId is required for locating a problem.
*/
@SerializedName("RequestId")
@Expose
private String RequestId;
/**
* Get The unique request ID, which is returned for each request. RequestId is required for locating a problem.
* @return RequestId The unique request ID, which is returned for each request. RequestId is required for locating a problem.
*/
public String getRequestId() {
return this.RequestId;
}
/**
* Set The unique request ID, which is returned for each request. RequestId is required for locating a problem.
* @param RequestId The unique request ID, which is returned for each request. RequestId is required for locating a problem.
*/
public void setRequestId(String RequestId) {
this.RequestId = RequestId;
}
public DownCptResponse() {
}
/**
* NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy,
* and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy.
*/
public DownCptResponse(DownCptResponse source) {
if (source.RequestId != null) {
this.RequestId = new String(source.RequestId);
}
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "RequestId", this.RequestId);
}
}
|
[
"tencentcloudapi@tencent.com"
] |
tencentcloudapi@tencent.com
|
7fd4f931ca1e830d617db801aeb59d9c6f0831cc
|
df71f195c8d6e84f2f4c485569c3be4b5fea5836
|
/src/main/java/com/cloud/distribution/web/rest/ProductTypeResource.java
|
be586b4338c6813c0297f5dff15111454e9a6573
|
[] |
no_license
|
bobying/distribution
|
1366e6bdfb99ce27ce4f1356d4e5f3d8e08f8258
|
2c0225010276f20d6f407da9f916a5f4d97b331a
|
refs/heads/master
| 2021-05-06T15:08:26.984615
| 2017-12-07T04:24:44
| 2017-12-07T04:24:44
| 113,430,964
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,800
|
java
|
package com.cloud.distribution.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.cloud.distribution.service.ProductTypeService;
import com.cloud.distribution.web.rest.errors.BadRequestAlertException;
import com.cloud.distribution.web.rest.util.HeaderUtil;
import com.cloud.distribution.web.rest.util.PaginationUtil;
import com.cloud.distribution.service.dto.ProductTypeDTO;
import com.cloud.distribution.service.dto.ProductTypeCriteria;
import com.cloud.distribution.service.ProductTypeQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
import java.util.stream.StreamSupport;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* REST controller for managing ProductType.
*/
@RestController
@RequestMapping("/api")
public class ProductTypeResource {
private final Logger log = LoggerFactory.getLogger(ProductTypeResource.class);
private static final String ENTITY_NAME = "productType";
private final ProductTypeService productTypeService;
private final ProductTypeQueryService productTypeQueryService;
public ProductTypeResource(ProductTypeService productTypeService, ProductTypeQueryService productTypeQueryService) {
this.productTypeService = productTypeService;
this.productTypeQueryService = productTypeQueryService;
}
/**
* POST /product-types : Create a new productType.
*
* @param productTypeDTO the productTypeDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new productTypeDTO, or with status 400 (Bad Request) if the productType has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/product-types")
@Timed
public ResponseEntity<ProductTypeDTO> createProductType(@RequestBody ProductTypeDTO productTypeDTO) throws URISyntaxException {
log.debug("REST request to save ProductType : {}", productTypeDTO);
if (productTypeDTO.getId() != null) {
throw new BadRequestAlertException("A new productType cannot already have an ID", ENTITY_NAME, "idexists");
}
ProductTypeDTO result = productTypeService.save(productTypeDTO);
return ResponseEntity.created(new URI("/api/product-types/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /product-types : Updates an existing productType.
*
* @param productTypeDTO the productTypeDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated productTypeDTO,
* or with status 400 (Bad Request) if the productTypeDTO is not valid,
* or with status 500 (Internal Server Error) if the productTypeDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/product-types")
@Timed
public ResponseEntity<ProductTypeDTO> updateProductType(@RequestBody ProductTypeDTO productTypeDTO) throws URISyntaxException {
log.debug("REST request to update ProductType : {}", productTypeDTO);
if (productTypeDTO.getId() == null) {
return createProductType(productTypeDTO);
}
ProductTypeDTO result = productTypeService.save(productTypeDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, productTypeDTO.getId().toString()))
.body(result);
}
/**
* GET /product-types : get all the productTypes.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of productTypes in body
*/
@GetMapping("/product-types")
@Timed
public ResponseEntity<List<ProductTypeDTO>> getAllProductTypes(ProductTypeCriteria criteria, Pageable pageable) {
log.debug("REST request to get ProductTypes by criteria: {}", criteria);
Page<ProductTypeDTO> page = productTypeQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/product-types");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* GET /product-types/:id : get the "id" productType.
*
* @param id the id of the productTypeDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the productTypeDTO, or with status 404 (Not Found)
*/
@GetMapping("/product-types/{id}")
@Timed
public ResponseEntity<ProductTypeDTO> getProductType(@PathVariable Long id) {
log.debug("REST request to get ProductType : {}", id);
ProductTypeDTO productTypeDTO = productTypeService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(productTypeDTO));
}
/**
* DELETE /product-types/:id : delete the "id" productType.
*
* @param id the id of the productTypeDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/product-types/{id}")
@Timed
public ResponseEntity<Void> deleteProductType(@PathVariable Long id) {
log.debug("REST request to delete ProductType : {}", id);
productTypeService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
/**
* SEARCH /_search/product-types?query=:query : search for the productType corresponding
* to the query.
*
* @param query the query of the productType search
* @param pageable the pagination information
* @return the result of the search
*/
@GetMapping("/_search/product-types")
@Timed
public ResponseEntity<List<ProductTypeDTO>> searchProductTypes(@RequestParam String query, Pageable pageable) {
log.debug("REST request to search for a page of ProductTypes for query {}", query);
Page<ProductTypeDTO> page = productTypeService.search(query, pageable);
HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/product-types");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
}
|
[
"124599792@qq.com"
] |
124599792@qq.com
|
9a384e7e729e51c6421c2498dcdb4b9c449d05ae
|
18599504244240b2b0e70bc1648b72ce9235c513
|
/WS/DogusAtolye/src/BilgisayarCikartmaYapamazken.java
|
1eb64f7b936ca9ae3f1c4675b36335f76494f179
|
[] |
no_license
|
javaci-net/dogus_atolye
|
25694f03cc8934e855690627226d3edef9218c8a
|
50e073fdac55c056ae3b7b09a17ceb427fc1c42b
|
refs/heads/master
| 2022-04-25T18:54:25.162069
| 2020-04-26T16:45:48
| 2020-04-26T16:45:48
| 259,068,817
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 127
|
java
|
public class BilgisayarCikartmaYapamazken {
public static void main(String[] args) {
System.out.println(1 - 0.9F);
}
}
|
[
"volkanistek@gmail.com"
] |
volkanistek@gmail.com
|
67d80258dd08438a6a8c05615ab9e10c475f61bc
|
1d9492a95cfcd1120b3c886cbfc12b609f3f313d
|
/springhub-web/src/main/java/com/mjeanroy/springhub/exceptions/UploadException.java
|
1942b2e80b0545819d2431e3f41e1e68ce7271c1
|
[] |
no_license
|
mjeanroy/springhub
|
59a4273f3079b1ffdc61fe99e878645762e738a9
|
5dbfe89fb8e8b2ba40731383cac625a452534880
|
refs/heads/master
| 2021-05-15T02:02:38.685508
| 2020-02-12T08:02:55
| 2020-02-12T08:02:55
| 9,960,985
| 0
| 2
| null | 2020-02-12T08:02:56
| 2013-05-09T14:35:08
|
Java
|
UTF-8
|
Java
| false
| false
| 437
|
java
|
package com.mjeanroy.springhub.exceptions;
public class UploadException extends ApplicationException {
private UploadExceptionType type;
public UploadException(UploadExceptionType type, String msg) {
super(msg);
this.type = type;
}
@Override
public String getType() {
return "UPLOAD_" + this.type.toString();
}
public static enum UploadExceptionType {
MULTIPART_HTTP,
FILE_NOT_FOUND,
FILE_EMPTY,
FILE_TYPE
}
}
|
[
"mickael.jeanroy@gmail.com"
] |
mickael.jeanroy@gmail.com
|
380a9d774b71bb7c3efb57b77f7730ba3cec5f56
|
94b6aaf872dd881c4fee93018b2c5c0d4f1134c9
|
/modules/CoreSets/src/edu/uncc/genosets/core/api/OrthoMcl.java
|
3b9b61206cc2a815672001c09dedc32d71f47e5f
|
[
"BSD-3-Clause"
] |
permissive
|
aacain/genosets
|
6978f00729bcda179890e2a6e2ef361689a6edbf
|
96f7a161b35f79c1e87aa88be93666adaeaf2f56
|
refs/heads/master
| 2020-04-06T07:00:33.820564
| 2015-02-16T17:15:43
| 2015-02-16T17:15:43
| 26,338,552
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,092
|
java
|
/*
*
*
*/
package edu.uncc.genosets.core.api;
import edu.uncc.genosets.datamanager.entity.AnnotationMethod;
import edu.uncc.genosets.datamanager.entity.FeatureCluster;
import edu.uncc.genosets.taskmanager.api.ProgramStep;
import java.io.File;
import java.util.List;
import org.openide.filesystems.FileObject;
/**
*
* @author aacain
*/
public interface OrthoMcl {
public static final String METHOD_ENTITY_NAME = AnnotationMethod.DEFAULT_NAME;
public static final String CLUSTER_ENTITY_NAME = FeatureCluster.DEFAULT_NAME;
public static final String FACT_LOCATION_ENTITY_NAME = "OrthoFact";
public static final String CLUSTER_CATEGORY = "Ortholog";
public static final String CLUSTER_TYPE = "OrthoMCL";
public static final String METHOD_SOURCE_TYPE = "OrthoMCL";
public OrthoMcl getDefault();
public List<? extends ProgramStep> getSteps();
public void run(FileObject folder);
public void load(File file, AnnotationMethod method);
public void load(File file, String methodName, String methodDescription);
public String getVersion();
}
|
[
"aurora.cain@gmail.com"
] |
aurora.cain@gmail.com
|
34707e90e2e1baad34812d07dc4c1c39115fde9a
|
24cc25194f81803501694288e84aae2e1482b62a
|
/java/core/src/main/java/com/greenscriptool/ResourceType.java
|
2d7d173072180196d1e4c6111ea0693473a5c201
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
novadata/greenscript
|
40096bf9984186ed9c81a4465d4b8a66420add84
|
26ae7fb9d07a0d81005d66beaba0cfcec126f969
|
refs/heads/master
| 2021-01-18T15:09:11.447600
| 2015-07-21T08:31:42
| 2015-07-21T08:31:42
| 39,362,281
| 1
| 0
| null | 2015-07-20T03:55:41
| 2015-07-20T03:55:41
| null |
UTF-8
|
Java
| false
| false
| 665
|
java
|
package com.greenscriptool;
import java.util.Arrays;
import java.util.List;
/**
* Resource type enumeration
*
* @author greenlaw110@gmail.com
* @version 1.0, 2010-10-13
* @since 1.0
*/
public enum ResourceType {
JS(".js", ".coffee"), CSS(".css", ".less");
private ResourceType(String... extension) {
if (extension.length == 0) throw new IllegalArgumentException("needs at least one extension");
exts_ = extension;
}
private String[] exts_;
public String getExtension() {
return exts_[0];
}
public List<String> getAllExtensions() {
return Arrays.asList(exts_);
}
}
|
[
"greenlaw110@gmail.com"
] |
greenlaw110@gmail.com
|
17e84516b11d4bc940419296308c7b701682f238
|
0d8e13b07067b93a7bf807d53a8921e3e307ad46
|
/src/house/ImpHouseBuilder.java
|
746850b6614cb5ce30b14697a8511957c966694b
|
[
"Apache-2.0"
] |
permissive
|
Saio88/java-bootcamp-bahia
|
1ba9383e52747bbffd5946fccd74909a2a702327
|
922faab97b8082cecc15e23ef1997b2aa8814345
|
refs/heads/master
| 2021-01-18T06:35:33.650830
| 2015-02-18T14:00:28
| 2015-02-18T14:00:28
| 30,596,276
| 0
| 0
| null | 2015-03-10T00:41:30
| 2015-02-10T14:38:31
|
Java
|
UTF-8
|
Java
| false
| false
| 507
|
java
|
package house;
import house.Partes.*;
public class ImpHouseBuilder implements HouseBuilder {
private House house;
public ImpHouseBuilder() {
this.house = new House();
}
public void buildWalls() {
for (int i = 0; i < 4; i++)
this.house.addWall(new Wall());
}
public void buildRoof() {
this.house.setRoot(new Roof());
}
public void buildFloor() {
this.house.setFloor(new Floor());
}
public House getHouse() {
return this.house;
}
}
|
[
"santiagolirio@hotmail.com"
] |
santiagolirio@hotmail.com
|
65e90233f6db8a2f9d6e505b4d00b7971c7c68ff
|
846a3695e2c5257b6b812e3d389caf94eca82b47
|
/app/src/main/java/com/weima/aishangyi/jiaoshi/activity/UserClassroomOrderActivity.java
|
b5f3f04ae703c68553512b8282cd54d6f41dc813
|
[] |
no_license
|
cgy529387306/AiShangYiTeacher
|
2482759cb8540cf4c30b02bc1a62a1146de2e5d2
|
6129f6aa5396a95bb9a9ebb73873b30cd359f4be
|
refs/heads/master
| 2020-04-26T03:21:41.866430
| 2019-03-01T08:32:27
| 2019-03-01T08:32:27
| 173,264,544
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,754
|
java
|
package com.weima.aishangyi.jiaoshi.activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import com.weima.aishangyi.jiaoshi.R;
import com.weima.aishangyi.jiaoshi.base.BaseActivity;
import com.weima.aishangyi.jiaoshi.fragment.ClassroomOrderFragment;
import com.weima.aishangyi.jiaoshi.tabstrip.PagerSlidingTabStrip;
/**
* 课程/课室订单
*/
public class UserClassroomOrderActivity extends BaseActivity {
private PagerSlidingTabStrip tabstrip;
private ViewPager viewpager;
private int status = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.common_trip_viewpager);
setCustomTitle("课程/课室订单");
initUI();
}
private void initUI() {
status = getIntent().getIntExtra("status",0);
tabstrip = (PagerSlidingTabStrip) findViewById(R.id.tabstrip);
viewpager = (ViewPager) findViewById(R.id.viewpager);
viewpager.setAdapter(new MyAdapter(getSupportFragmentManager()));
tabstrip.setViewPager(viewpager);
viewpager.setCurrentItem(status); //初始化显示0
tabstrip.setTextColor(getResources().getColor(R.color.text_color));//未选中字体的颜色
tabstrip.setSelectedTextColor(getResources().getColor(R.color.base_orange));//选中选项中字体的颜色
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);//获取屏幕宽度
int width = dm.widthPixels;//宽度
tabstrip.setTextSize(width / 28);//字体的大小
}
public class MyAdapter extends FragmentStatePagerAdapter {
private final String[] titles = {"全部", "待确认", "待授课","待评价"};
public MyAdapter(FragmentManager fm) {
super(fm);
}
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
@Override
public int getCount() {
return titles.length;
}
@Override
public Fragment getItem(int position) {
if (position == 1) {
return ClassroomOrderFragment.newInstance(0);
} else if (position == 2) {
return ClassroomOrderFragment.newInstance(1);
} else if (position == 3) {
return ClassroomOrderFragment.newInstance(2);
}else{
return ClassroomOrderFragment.newInstance(-1);
}
}
}
}
|
[
"661005@nd.com"
] |
661005@nd.com
|
64da83401995f8aef3bc86137570fd70fc3063d5
|
5ecd15baa833422572480fad3946e0e16a389000
|
/framework/MCS-Open/subsystems/runtime/main/api/java/com/volantis/mcs/runtime/policies/PolicyReferenceResolver.java
|
cec4edcb48173dfd591b6faac17caed263c7e08c
|
[] |
no_license
|
jabley/volmobserverce
|
4c5db36ef72c3bb7ef20fb81855e18e9b53823b9
|
6d760f27ac5917533eca6708f389ed9347c7016d
|
refs/heads/master
| 2021-01-01T05:31:21.902535
| 2009-02-04T02:29:06
| 2009-02-04T02:29:06
| 38,675,289
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,451
|
java
|
/*
This file is part of Volantis Mobility Server.
Volantis Mobility Server is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Volantis Mobility Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Volantis Mobility Server. If not, see <http://www.gnu.org/licenses/>.
*/
/* ----------------------------------------------------------------------------
* (c) Volantis Systems Ltd 2005.
* ----------------------------------------------------------------------------
*/
package com.volantis.mcs.runtime.policies;
import com.volantis.mcs.expression.PolicyExpression;
import com.volantis.mcs.policies.PolicyType;
import com.volantis.mcs.protocols.assets.LinkAssetReference;
import com.volantis.mcs.protocols.assets.ScriptAssetReference;
import com.volantis.mcs.protocols.assets.TextAssetReference;
import com.volantis.mcs.integration.PageURLType;
import com.volantis.mcs.themes.StyleValue;
import com.volantis.mcs.themes.StyleString;
import com.volantis.mcs.themes.StyleComponentURI;
/**
* @mock.generate
*/
public interface PolicyReferenceResolver {
/**
* @param policyExpression
* @return
*/
RuntimePolicyReference resolvePolicyExpression(
PolicyExpression policyExpression);
RuntimePolicyReference resolveUnquotedPolicyExpression(
String expressionAsString, PolicyType policyType);
LinkAssetReference resolveQuotedLinkExpression(
String expression, PageURLType urlType);
ScriptAssetReference resolveQuotedScriptExpression(
String expression);
TextAssetReference resolveQuotedTextExpression(String expression);
TextAssetReference resolveUnquotedTextExpression(String name);
/**
* Resolve the possibly quoted text expression as a style value.
*
* @param expression The possibly quoted text expression.
* @return The style value, may be a {@link StyleString}, or a {@link
* StyleComponentURI}.
*/
StyleValue resolveQuotedTextExpressionAsStyleValue(String expression);
}
|
[
"iwilloug@b642a0b7-b348-0410-9912-e4a34d632523"
] |
iwilloug@b642a0b7-b348-0410-9912-e4a34d632523
|
7c8d15cb3f348ef89151d34632c30abf18db39fa
|
084b48c094b15a3a9434b80c7145f58f6388cf90
|
/org.eclipse.emf.emfstore.client.ui/src/org/eclipse/emf/emfstore/client/ui/epackages/RegisterEPackageHandler.java
|
1f78e989d409a9d55b25a6cecd07367d2702d994
|
[] |
no_license
|
aumann/emfstore.core
|
f179021da999c60893754acfab21b7c0b8aa1327
|
da7c216c1a8b3c612306b14d3a568750d46690ee
|
refs/heads/master
| 2016-09-06T03:55:13.533823
| 2012-07-27T05:12:07
| 2012-07-27T05:12:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,151
|
java
|
/*******************************************************************************
* Copyright (c) 2008-2012 Chair for Applied Software Engineering,
* Technische Universitaet Muenchen.
* 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:
******************************************************************************/
package org.eclipse.emf.emfstore.client.ui.epackages;
import org.eclipse.emf.emfstore.client.model.ServerInfo;
import org.eclipse.emf.emfstore.client.ui.handlers.AbstractEMFStoreHandler;
/**
* RegisterEPackageHandler.
*
* @author Tobias Verhoeven
*/
public class RegisterEPackageHandler extends AbstractEMFStoreHandler {
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.emfstore.client.ui.handlers.AbstractEMFStoreHandler#handle()
*/
@Override
public void handle() {
ServerInfo serverInfo = requireSelection(ServerInfo.class);
new UIRegisterEPackageController(getShell(),serverInfo).execute();
}
}
|
[
"maximilian@emfstore.org"
] |
maximilian@emfstore.org
|
f0072f1dd562bb7c494313d558aab84dd149c5ec
|
3af8218a7f821c4d63b2e0ae929a29d3761a53a7
|
/src/main/java/com/goufaning/bysj/utils/maths/InfiniteSeries.java
|
974ca13db462e48bed43b1bc7b80a9f2b31dde42
|
[] |
no_license
|
goufaning/bysj
|
18bed4729d5be0293fcf103c30ced99248303b14
|
1b54dfe3afa3e69a6938f3bdd5e62c283494ebe0
|
refs/heads/master
| 2020-03-09T09:06:38.384484
| 2018-06-05T10:07:06
| 2018-06-05T10:07:06
| 128,704,585
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 925
|
java
|
/*
* InfiniteSeries.java
*
* Created on August 19, 2005, 11:24 AM
*
* author: Stephen A. Smith
*/
package com.goufaning.bysj.utils.maths;
/**
*
* @author stephensmith
*/
public abstract class InfiniteSeries extends IterativeProcess{
/** Creates a new instance of InfiniteSeries */
public InfiniteSeries() {
}
protected abstract void computeTermAt(int n);
public double evaluateIteration(){
computeTermAt(getIterations());
result+=lastTerm;
return relativePrecision(Math.abs(lastTerm), Math.abs(result));
}
public double getResult(){
return result;
}
public void initializeIterations(){
result = initialValue();
}
protected abstract double initialValue();
public void setArgument(double r){
x = r;
return;
}
private double result;
protected double x;
protected double lastTerm;
}
|
[
"1031974286@qq.com"
] |
1031974286@qq.com
|
b53b05c54f147e263d9e5d88594a9f9dd03d18b3
|
05116b1ebda3311f50858630fbfd143d5fcecdf1
|
/RestApiAutomation/src/main/java/com/qa/base/TestBase.java
|
b443614c47fa7795e445daff26279aa235f8cd24
|
[] |
no_license
|
charitra-qait/Test1
|
12ca36e4e8c0c13971ef400804503cd1f726f605
|
98f69cbab1c2330a708bd1da2925d61f7de94ed5
|
refs/heads/master
| 2021-01-20T15:09:49.750315
| 2018-09-25T08:49:48
| 2018-09-25T08:49:48
| 82,798,628
| 0
| 0
| null | 2018-09-25T08:49:50
| 2017-02-22T11:51:28
|
HTML
|
UTF-8
|
Java
| false
| false
| 789
|
java
|
package com.qa.base;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
public class TestBase {
public Properties prop;
public int RESPONSE_STATUS_CODE_200 = 200;
public int RESPONSE_STATUS_CODE_201 = 201;
public int RESPONSE_STATUS_CODE_500 = 500;
public int RESPONSE_STATUS_CODE_404 = 404;
public int RESPONSE_STATUS_CODE_401 = 401;
public TestBase() {
try {
prop = new Properties();
FileInputStream ip = new FileInputStream(
System.getProperty("user.dir") + "/src/main/java/com/qa/configuration/config.properties");
prop.load(ip);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
[
"charitrakumar@qainfotech.com"
] |
charitrakumar@qainfotech.com
|
e9d1ad46a9eb291dc58a6bfef28f995da81dfd31
|
47119d527d55e9adcb08a3a5834afe9a82dd2254
|
/exportLibraries/vnxe/src/main/java/com/emc/storageos/vnxe/models/BlockHostAccess.java
|
a1f542d680477a1061aefd137b1ef982b461397f
|
[] |
no_license
|
chrisdail/coprhd-controller
|
1c3ddf91bb840c66e4ece3d4b336a6df421b43e4
|
38a063c5620135a49013aae5e078aeb6534a5480
|
refs/heads/master
| 2020-12-03T10:42:22.520837
| 2015-06-08T15:24:36
| 2015-06-08T15:24:36
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,220
|
java
|
/**
* Copyright 2015 EMC Corporation
* All Rights Reserved
*/
/**
* Copyright (c) 2014 EMC Corporation
* All Rights Reserved
*
* This software contains the intellectual property of EMC Corporation
* or is licensed to EMC Corporation from third parties. Use of this
* software and the intellectual property contained therein is expressly
* limited to the terms and conditions of the License Agreement under which
* it is provided by or on behalf of EMC.
*/
package com.emc.storageos.vnxe.models;
public class BlockHostAccess {
private VNXeBase host;
private int accessMask;
public VNXeBase getHost() {
return host;
}
public void setHost(VNXeBase host) {
this.host = host;
}
public int getAccessMask() {
return accessMask;
}
public void setAccessMask(int accessMask) {
this.accessMask = accessMask;
}
public static enum HostLUNAccessEnum {
NOACCESS(0),
PRODUCTION(1),
SNAPSHOT(2),
BOTH(3);
private int value;
private HostLUNAccessEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
}
|
[
"review-coprhd@coprhd.org"
] |
review-coprhd@coprhd.org
|
77d4ef72b26d50fe1e3e96869cf5a2deee4d933f
|
02127aef528ff9ba18ae478f481ab37cf3c2fb4c
|
/src/main/java/com/wanliang/small/service/CartItemService.java
|
be07ec838e318df2d27c891134820b1ca4075d49
|
[] |
no_license
|
pf5512/small
|
2f2c78a9fcc7f0fc9df56fb4d251df49ea037ae8
|
923eda30e9c85214a9efb78fc3750b7fc3e572d4
|
refs/heads/master
| 2021-01-01T06:53:32.059039
| 2015-04-13T01:15:50
| 2015-04-13T01:15:50
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 286
|
java
|
package com.wanliang.small.service;
import com.wanliang.small.entity.CartItem;
import com.wanliang.small.entity.CartItem;
/**
* Service - 购物车项
*
* @author wan_liang@126.com Team
* @version 3.0
*/
public interface CartItemService extends BaseService<CartItem, Long> {
}
|
[
"wan_liang@126.com"
] |
wan_liang@126.com
|
8c906e0ca19167635895bfff482a34b8475accd2
|
9078461df0cc6bb4d8c6cf4613c71a8834bd33a8
|
/src/bbcar/persistence/dao/JPAValoracionDAO.java
|
afa790e8e0abb8b6d6eb36d5e2304b9db82a1f86
|
[] |
no_license
|
Etaira/AADD
|
8d9553fc89c0aeada528f64bd24b59a06d044e0f
|
13cc3929256309f84ce42cc8d3a630c02622d596
|
refs/heads/master
| 2020-08-22T13:57:28.013950
| 2019-10-25T13:22:24
| 2019-10-25T13:22:24
| 216,397,028
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,433
|
java
|
package bbcar.persistence.dao;
import javax.persistence.EntityManager;
import bbcar.persistence.bean.EntityManagerHelper;
import bbcar.persistence.bean.Reserva;
import bbcar.persistence.bean.Usuario;
import bbcar.persistence.bean.Valoracion;
public class JPAValoracionDAO implements ValoracionDAO {
@Override
public Valoracion createValoracion(String comentario, Integer puntuacion, Integer reserva, Integer usuarioEmisor, Integer usuarioReceptor) {
EntityManager em = EntityManagerHelper.getEntityManager();
em.getTransaction().begin();
Valoracion valoracion = new Valoracion();
valoracion.setComentario(comentario);
valoracion.setPuntuacion(puntuacion);
Reserva res = em.find(Reserva.class, reserva);
Usuario ureceptor = em.find(Usuario.class, usuarioReceptor);
Usuario uemisor = em.find(Usuario.class, usuarioEmisor);
valoracion.setReserva(res);
valoracion.setUsuarioEmisor(uemisor);
valoracion.setUsuarioReceptor(ureceptor);
res.getValoraciones().add(valoracion);
uemisor.getValoracionesEmitidas().add(valoracion);
ureceptor.getValoracionesRecibidas().add(valoracion);
em.persist(valoracion);
em.getTransaction().commit();
em.close();
return valoracion;
}
@Override
public void update(Valoracion v) throws DAOException {
EntityManager em = EntityManagerHelper.getEntityManager();
em.getTransaction().begin();
em.merge(v);
em.getTransaction().commit();
em.close();
}
}
|
[
"evalos.santos@um.es"
] |
evalos.santos@um.es
|
213bb79ad0b863f8ce574e1445d295ba8ea28125
|
36a80ecec12da8bf43980768a920c28842d2763b
|
/src/main/java/com/tools20022/repository/entity/SettlementTimeRequest.java
|
d0921adfae8d86a7dcd51b6f786805082ee06125
|
[] |
no_license
|
bukodi/test02
|
e9045f6f88d44a5833b1cf32b15a3d7b9a64aa83
|
30990a093e1239b4244c2a64191b6fe1eacf3b00
|
refs/heads/master
| 2021-05-08T03:22:32.792980
| 2017-10-24T23:00:52
| 2017-10-24T23:00:52
| 108,186,993
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,513
|
java
|
package com.tools20022.repository.entity;
import com.tools20022.metamodel.MMBusinessAssociationEnd;
import com.tools20022.metamodel.MMBusinessAttribute;
import com.tools20022.metamodel.MMBusinessComponent;
import com.tools20022.repository.datatype.ISODateTime;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicReference;
/**
* Provides information on the requested settlement time(s) of the payment
* instruction.
*/
public class SettlementTimeRequest {
final static private AtomicReference<MMBusinessComponent> mmObject_lazy = new AtomicReference<>();
/**
* Payment for which settlement times are specified.
*/
public static final MMBusinessAssociationEnd Payment = new MMBusinessAssociationEnd() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "Payment";
definition = "Payment for which settlement times are specified.";
maxOccurs = 1;
minOccurs = 0;
opposite_lazy = () -> com.tools20022.repository.entity.Payment.SettlementTimeRequest;
aggregation = com.tools20022.metamodel.MMAggregation.NONE;
type_lazy = () -> com.tools20022.repository.entity.Payment.mmObject();
}
};
/**
* Time by which the amount of money must be credited, with confirmation, to
* the CLS Bank's account at the central bank.<br>
* Usage: Time must be expressed in Central European Time (CET).
*/
public static final MMBusinessAttribute CLSTime = new MMBusinessAttribute() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "CLSTime";
definition = "Time by which the amount of money must be credited, with confirmation, to the CLS Bank's account at the central bank.\r\nUsage: Time must be expressed in Central European Time (CET).";
maxOccurs = 1;
minOccurs = 1;
simpleType_lazy = () -> ISODateTime.mmObject();
}
};
/**
* Time until when the payment may be settled.
*/
public static final MMBusinessAttribute TillTime = new MMBusinessAttribute() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "TillTime";
definition = "Time until when the payment may be settled.";
maxOccurs = 1;
minOccurs = 1;
simpleType_lazy = () -> ISODateTime.mmObject();
}
};
/**
* Time as from when the payment may be settled.
*/
public static final MMBusinessAttribute FromTime = new MMBusinessAttribute() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "FromTime";
definition = "Time as from when the payment may be settled.";
maxOccurs = 1;
minOccurs = 1;
simpleType_lazy = () -> ISODateTime.mmObject();
}
};
/**
* Time by when the payment must be settled to avoid rejection.
*/
public static final MMBusinessAttribute RejectTime = new MMBusinessAttribute() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "RejectTime";
definition = "Time by when the payment must be settled to avoid rejection.";
maxOccurs = 1;
minOccurs = 1;
simpleType_lazy = () -> ISODateTime.mmObject();
}
};
static public MMBusinessComponent mmObject() {
mmObject_lazy.compareAndSet(null, new MMBusinessComponent() {
{
dataDictionary_lazy = () -> com.tools20022.repository.GeneratedRepository.dataDict;
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "SettlementTimeRequest";
definition = "Provides information on the requested settlement time(s) of the payment instruction.";
associationDomain_lazy = () -> Arrays.asList(com.tools20022.repository.entity.Payment.SettlementTimeRequest);
element_lazy = () -> Arrays.asList(com.tools20022.repository.entity.SettlementTimeRequest.Payment, com.tools20022.repository.entity.SettlementTimeRequest.CLSTime,
com.tools20022.repository.entity.SettlementTimeRequest.TillTime, com.tools20022.repository.entity.SettlementTimeRequest.FromTime, com.tools20022.repository.entity.SettlementTimeRequest.RejectTime);
}
});
return mmObject_lazy.get();
}
}
|
[
"bukodi@gmail.com"
] |
bukodi@gmail.com
|
daa695a104c6e3c5e2a4a381a3ed4da10fbf4dab
|
beb2fbdd8e5343fe76c998824c7228a546884c5e
|
/com.kabam.marvelbattle/src/com/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest.java
|
4c3b4df3c852ee12cb129e744d9f07324ce1e82f
|
[] |
no_license
|
alamom/mcoc_11.2.1_store_apk
|
4a988ab22d6c7ad0ca5740866045083ec396841b
|
b43c41d3e8a43f63863d710dad812774cd14ace0
|
refs/heads/master
| 2021-01-11T17:13:02.358134
| 2017-01-22T19:51:35
| 2017-01-22T19:51:35
| 79,740,812
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,080
|
java
|
package com.google.android.gms.drive.realtime.internal;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
public class BeginCompoundOperationRequest
implements SafeParcelable
{
public static final Parcelable.Creator<BeginCompoundOperationRequest> CREATOR = new a();
final int BR;
final boolean Ri;
final boolean Rj;
final String mName;
BeginCompoundOperationRequest(int paramInt, boolean paramBoolean1, String paramString, boolean paramBoolean2)
{
this.BR = paramInt;
this.Ri = paramBoolean1;
this.mName = paramString;
this.Rj = paramBoolean2;
}
public int describeContents()
{
return 0;
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
a.a(this, paramParcel, paramInt);
}
}
/* Location: C:\tools\androidhack\com.kabam.marvelbattle\classes.jar!\com\google\android\gms\drive\realtime\internal\BeginCompoundOperationRequest.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
[
"eduard.martini@gmail.com"
] |
eduard.martini@gmail.com
|
c061c0a727b5f11ae425192b0079dcc9a18731eb
|
74d82ec1ec7455b23e0e5ec7198932e4b14201cf
|
/src/main/java/cn/edu/hust/utils/RowKeyUtil.java
|
bc86ecacd32200f1a204acd88ea194bb2fbb415a
|
[
"Apache-2.0"
] |
permissive
|
oeljeklaus-you/iNote
|
39371812d75c6c96224a420d0b66b8ec1d2f4dbf
|
2d865c3f71704e4d8c1038976a123f817fc08182
|
refs/heads/master
| 2020-03-21T03:07:40.940537
| 2018-06-20T13:39:33
| 2018-06-20T13:39:33
| 138,037,471
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 557
|
java
|
package cn.edu.hust.utils;
import cn.edu.hust.utils.constants.Constants;
public class RowKeyUtil {
public static String getRowKeyUserName(String rowKey) {
String[] split = rowKey.split(Constants.ROWKEY_SEPARATOR);
String name = "";
for (int i = 0; i < split.length - 1; i++) {
name = name + split[i] + Constants.ROWKEY_SEPARATOR;
}
return name.substring(0, name.length() - 1);
}
public static String getRowKeyCreateTime(String rowKey) {
String[] split = rowKey.split(Constants.ROWKEY_SEPARATOR);
return split[split.length - 1];
}
}
|
[
"oeljeklaus2heart@gmail.com"
] |
oeljeklaus2heart@gmail.com
|
8deaabc0e90e7283dda7c89e1647b85f20b65f8e
|
f22016e5670e437bd7c1338f28aedfe7871580f9
|
/axl/src/main/java/ru/cg/cda/axl/generated/ListImeRouteFilterElementRes.java
|
ca36a3e117126bc706237580ad2c66199c244624
|
[] |
no_license
|
ilgiz-badamshin/cda
|
4e3c75407a0b2edbb7321b83b66e4cf455157eae
|
0a16d90fc9be74932ef3df682013b444d425741e
|
refs/heads/master
| 2020-05-17T05:34:17.707445
| 2015-12-18T13:38:49
| 2015-12-18T13:38:49
| 39,076,024
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,094
|
java
|
package ru.cg.cda.axl.generated;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ListImeRouteFilterElementRes complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ListImeRouteFilterElementRes">
* <complexContent>
* <extension base="{http://www.cisco.com/AXL/API/10.0}APIResponse">
* <sequence>
* <element name="return">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="imeRouteFilterElement" type="{http://www.cisco.com/AXL/API/10.0}LImeRouteFilterElement" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ListImeRouteFilterElementRes", propOrder = {
"_return"
})
public class ListImeRouteFilterElementRes
extends APIResponse
{
@XmlElement(name = "return", required = true)
protected ListImeRouteFilterElementRes.Return _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link ListImeRouteFilterElementRes.Return }
*
*/
public ListImeRouteFilterElementRes.Return getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link ListImeRouteFilterElementRes.Return }
*
*/
public void setReturn(ListImeRouteFilterElementRes.Return value) {
this._return = value;
}
/**
* <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="imeRouteFilterElement" type="{http://www.cisco.com/AXL/API/10.0}LImeRouteFilterElement" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"imeRouteFilterElement"
})
public static class Return {
protected List<LImeRouteFilterElement> imeRouteFilterElement;
/**
* Gets the value of the imeRouteFilterElement 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 imeRouteFilterElement property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getImeRouteFilterElement().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LImeRouteFilterElement }
*
*
*/
public List<LImeRouteFilterElement> getImeRouteFilterElement() {
if (imeRouteFilterElement == null) {
imeRouteFilterElement = new ArrayList<LImeRouteFilterElement>();
}
return this.imeRouteFilterElement;
}
}
}
|
[
"badamshin.ilgiz@cg.ru"
] |
badamshin.ilgiz@cg.ru
|
51619e664278958f76b599ce3602900c8a621349
|
386fdd75f3adf70ed42654948f5f40f763e377bf
|
/desafioSprint5TESTE/src/model/Cliente.java
|
05082406b9b210544c2500e5da1a40058f793aed
|
[] |
no_license
|
DouglasKuhn/Compasso
|
6a93ffc28777e90cc47646626fe82e10deb19a14
|
b0f0d5a8a88d9375387b868ba9f3e18b5257a5ba
|
refs/heads/master
| 2020-12-10T19:15:31.947393
| 2020-02-10T17:45:20
| 2020-02-10T17:45:20
| 233,683,322
| 0
| 0
| null | 2020-10-13T18:52:18
| 2020-01-13T20:08:54
|
Java
|
ISO-8859-1
|
Java
| false
| false
| 1,253
|
java
|
package model;
public class Cliente implements Converter {
private Integer codigo;
private String nome;
private String endereco;
public Integer getCodigo() {
return codigo;
}
public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getEndereco() {
return endereco;
}
public void setEndereco(String endereco) {
this.endereco = endereco;
}
@Override
public Object converterLinhaDoArquivo(String linha) {
if (linha == null || linha.length() == 0) {
return null;
}
String[] props = linha.split(DELIMITADOR);
this.setCodigo(Integer.parseInt(props[0]));
this.setNome(props[1]);
this.setEndereco(props[2]);
return this;
}
@Override
public String converterParaLinhaDoArquivo() {
StringBuffer lineStr = new StringBuffer();
lineStr.append(this.getCodigo());
lineStr.append(DELIMITADOR);
lineStr.append(this.getNome());
lineStr.append(DELIMITADOR);
lineStr.append(this.getEndereco());
return lineStr.toString();
}
@Override
public String toString() {
return "Código: " + codigo + "" + "\n" + "Nome: " + nome + "" + "\n" + "Endereço: " + endereco + "" + "\n";
}
}
|
[
"43782830+DouglasKuhn@users.noreply.github.com"
] |
43782830+DouglasKuhn@users.noreply.github.com
|
ab9ee8a94d0b6b63cede7c73460eb5660c4a7b0c
|
c03abda7e9996afacc8dcd9529f1e38b8db9a845
|
/Coursera/Princeton/unionAndFind/TestAlgs4.java
|
3e53b1131c4767456ae368c482d55b80ae60fcfa
|
[] |
no_license
|
dufufeisdu/algorithms
|
335c4e820bebec4ba14a412017458e084c2fa5b1
|
c3619c1253e2432403a77e62b3fbb8566cce4d2e
|
refs/heads/master
| 2021-01-22T06:24:02.235262
| 2019-07-17T00:27:40
| 2019-07-17T00:27:40
| 92,550,641
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,006
|
java
|
import edu.princeton.cs.algs4.StdDraw;
public class TestAlgs4 {
public static void main (String[] args) {
StdDraw.setScale(-1, 1);
StdDraw.clear(StdDraw.BLACK);
StdDraw.setPenColor(StdDraw.WHITE);
StdDraw.square(0, 0, 1);
// write some text
StdDraw.setPenColor(StdDraw.WHITE);
StdDraw.text(0, +0.95, "Hello, world! This is a test Java program.");
StdDraw.text(0, -0.95, "Close this window to finish the installation.");
// draw the bullseye
StdDraw.setPenColor(StdDraw.BOOK_BLUE);
StdDraw.filledCircle(0, 0, 0.9);
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledCircle(0, 0, 0.8);
StdDraw.setPenColor(StdDraw.BOOK_BLUE);
StdDraw.filledCircle(0, 0, 0.7);
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledCircle(0, 0, 0.6);
// draw a picture of the textbook
StdDraw.picture(0, 0, "cover.jpg", 0.65, 0.80);
}
}
|
[
"fufei.du@gmail.com"
] |
fufei.du@gmail.com
|
4337e79c3f7a1b639b84428f80283598a4c7c3ee
|
01a0c2148e07ad08fb7c4fa7d08c1caddd095e6a
|
/src/com/tz/act/observer/observe/Observe2.java
|
482d4d0aa7963dc3c3e51f9ae7929e17a3464f71
|
[] |
no_license
|
tz1992/designModel
|
18168c8879c8e640936f4e77c74cbaa33ba5d6f3
|
87f9abe927ef3473af1c5befb8aa41122613996d
|
refs/heads/master
| 2020-03-13T03:23:16.578421
| 2018-05-15T02:15:05
| 2018-05-15T02:15:05
| 130,943,133
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 332
|
java
|
package com.tz.act.observer.observe;
import com.tz.act.observer.observed.Subject;
public class Observe2 extends Observer {
public Observe2(Subject subject) {
this.subject=subject;
subject.attach(this);
}
@Override
public void update() {
System.out.println("观察者2"+this.subject.getState());
}
}
|
[
"gogs@fake.local"
] |
gogs@fake.local
|
4a11f7f1e39d3ae828da92971028f05e58bbad0a
|
270d84ff244d9870e484cd61c630721829616588
|
/gmall-api/src/main/java/org/lf/gmall/api/model/PmsBrand.java
|
fe6af83ba7c2106be903edd62924dc0a064d9f0d
|
[] |
no_license
|
Jvinhao/gmall
|
46fd1ca9df1acd83dbff5e42ec507d3ddfe44441
|
8fe36c5fdca35c56f246c17d95d9041a07802b61
|
refs/heads/master
| 2022-09-13T13:22:47.396587
| 2019-11-27T14:53:16
| 2019-11-27T14:53:16
| 221,921,626
| 0
| 0
| null | 2022-09-01T23:16:02
| 2019-11-15T12:40:11
|
CSS
|
UTF-8
|
Java
| false
| false
| 2,217
|
java
|
package org.lf.gmall.api.model;
import javax.persistence.Id;
import java.io.Serializable;
public class PmsBrand implements Serializable {
@Id
private String id;
private String name;
private String firstLetter;
private int sort;
private int factoryStatus;
private int showStatus;
private int productCount;
private String productCommentCount;
private String logo;
private String bigPic;
private String brandStory;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstLetter() {
return firstLetter;
}
public void setFirstLetter(String firstLetter) {
this.firstLetter = firstLetter;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public int getFactoryStatus() {
return factoryStatus;
}
public void setFactoryStatus(int factoryStatus) {
this.factoryStatus = factoryStatus;
}
public int getShowStatus() {
return showStatus;
}
public void setShowStatus(int showStatus) {
this.showStatus = showStatus;
}
public int getProductCount() {
return productCount;
}
public void setProductCount(int productCount) {
this.productCount = productCount;
}
public String getProductCommentCount() {
return productCommentCount;
}
public void setProductCommentCount(String productCommentCount) {
this.productCommentCount = productCommentCount;
}
public String getLogo() {
return logo;
}
public void setLogo(String logo) {
this.logo = logo;
}
public String getBigPic() {
return bigPic;
}
public void setBigPic(String bigPic) {
this.bigPic = bigPic;
}
public String getBrandStory() {
return brandStory;
}
public void setBrandStory(String brandStory) {
this.brandStory = brandStory;
}
}
|
[
"1340589637@qq.com"
] |
1340589637@qq.com
|
7b7f2d0b83f5b59a82f0c18880996462c706a242
|
e8fe1ad1386db55324e86a1ebccc45f565f129a4
|
/src/mobi/hsz/idea/gitignore/actions/IgnoreFileGroupAction.java
|
4717986a6df03bd11a3960bccac87de6707a49a9
|
[
"MIT",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
Deckhandfirststar01/idea-gitignore
|
232202f593c64d6df0616a837a876383439cc2a4
|
aae29d82fadfe37ac85c681de2d76d6819e8187c
|
refs/heads/master
| 2023-06-26T18:36:37.802008
| 2018-01-30T07:05:22
| 2018-01-30T07:05:22
| 117,659,536
| 0
| 0
|
MIT
| 2022-09-08T18:59:03
| 2018-01-16T09:01:33
|
Java
|
UTF-8
|
Java
| false
| false
| 7,375
|
java
|
/*
* The MIT License (MIT)
*
* Copyright (c) 2017 hsz Jakub Chrzanowski <jakub@hsz.mobi>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package mobi.hsz.idea.gitignore.actions;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
import mobi.hsz.idea.gitignore.IgnoreBundle;
import mobi.hsz.idea.gitignore.file.type.IgnoreFileType;
import mobi.hsz.idea.gitignore.lang.IgnoreLanguage;
import mobi.hsz.idea.gitignore.util.CommonDataKeys;
import mobi.hsz.idea.gitignore.util.ExternalFileException;
import mobi.hsz.idea.gitignore.util.Utils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.PropertyKey;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static mobi.hsz.idea.gitignore.IgnoreBundle.BUNDLE_NAME;
/**
* Group action that ignores specified file or directory.
* {@link ActionGroup} expands single action into a more child options to allow user specify
* the IgnoreFile that will be used for file's path storage.
*
* @author Jakub Chrzanowski <jakub@hsz.mobi>
* @since 0.5
*/
public class IgnoreFileGroupAction extends ActionGroup {
/** Maximum filename length for the action name. */
private static final int FILENAME_MAX_LENGTH = 30;
/** List of suitable Gitignore {@link VirtualFile}s that can be presented in an IgnoreFile action. */
@NotNull
private final Map<IgnoreFileType, List<VirtualFile>> files = ContainerUtil.newHashMap();
/** Action presentation's text for single element. */
@PropertyKey(resourceBundle = BUNDLE_NAME)
private final String presentationTextSingleKey;
/** {@link Project}'s base directory. */
@Nullable
private VirtualFile baseDir;
/**
* Builds a new instance of {@link IgnoreFileGroupAction}.
* Describes action's presentation.
*/
public IgnoreFileGroupAction() {
this("action.addToIgnore.group", "action.addToIgnore.group.description", "action.addToIgnore.group.noPopup");
}
/**
* Builds a new instance of {@link IgnoreFileGroupAction}.
* Describes action's presentation.
*
* @param textKey Action presentation's text key
* @param descriptionKey Action presentation's description key
*/
public IgnoreFileGroupAction(@PropertyKey(resourceBundle = BUNDLE_NAME) String textKey,
@PropertyKey(resourceBundle = BUNDLE_NAME) String descriptionKey,
@PropertyKey(resourceBundle = BUNDLE_NAME) String textSingleKey) {
final Presentation p = getTemplatePresentation();
p.setText(IgnoreBundle.message(textKey));
p.setDescription(IgnoreBundle.message(descriptionKey));
this.presentationTextSingleKey = textSingleKey;
}
/**
* Presents a list of suitable Gitignore files that can cover currently selected {@link VirtualFile}.
* Shows a subgroup with available files or one option if only one Gitignore file is available.
*
* @param e action event
*/
@Override
public void update(AnActionEvent e) {
final VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE);
final Project project = e.getData(CommonDataKeys.PROJECT);
final Presentation presentation = e.getPresentation();
files.clear();
if (project != null && file != null) {
try {
presentation.setVisible(true);
baseDir = project.getBaseDir();
for (IgnoreLanguage language : IgnoreBundle.LANGUAGES) {
final IgnoreFileType fileType = language.getFileType();
List<VirtualFile> list = Utils.getSuitableIgnoreFiles(project, fileType, file);
Collections.reverse(list);
files.put(fileType, list);
}
} catch (ExternalFileException e1) {
presentation.setVisible(false);
}
}
setPopup(countFiles() > 1);
}
/**
* Creates subactions bound to the specified Gitignore {@link VirtualFile}s using {@link IgnoreFileAction}.
*
* @param e action event
* @return actions list
*/
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
AnAction[] actions;
int count = countFiles();
if (count == 0 || baseDir == null) {
actions = new AnAction[0];
} else {
actions = new AnAction[count];
int i = 0;
for (Map.Entry<IgnoreFileType, List<VirtualFile>> entry : files.entrySet()) {
for (VirtualFile file : entry.getValue()) {
IgnoreFileAction action = createAction(file);
actions[i++] = action;
String name = Utils.getRelativePath(baseDir, file);
if (StringUtil.isNotEmpty(name)) {
name = StringUtil.shortenPathWithEllipsis(name, FILENAME_MAX_LENGTH);
}
if (count == 1) {
name = IgnoreBundle.message(presentationTextSingleKey, name);
}
Presentation presentation = action.getTemplatePresentation();
presentation.setIcon(entry.getKey().getIcon());
presentation.setText(name);
}
}
}
return actions;
}
/**
* Creates new {@link IgnoreFileAction} action instance.
*
* @param file current file
* @return action instance
*/
protected IgnoreFileAction createAction(@NotNull VirtualFile file) {
return new IgnoreFileAction(file);
}
/**
* Counts items in {@link #files} map.
*
* @return files amount
*/
private int countFiles() {
int size = 0;
for (List value : files.values()) {
size += value.size();
}
return size;
}
}
|
[
"jakub@chrzanowski.info"
] |
jakub@chrzanowski.info
|
9db5d297e0f66fe094db6942cf162783f4a042f5
|
4e223c4d4c89621d28185521703c849fc100fbcc
|
/src/main/java/com/parkit/parkingsystem/constants/DBConstants.java
|
cd8ee7e980a2a8bfce7dc800ae78681557b6f79a
|
[] |
no_license
|
Ludo76190/ParkingSystem
|
7e78672f52993f184f3948d66aedd19645de27d4
|
387b636237dbc807a74c0414af05c9e6e81d036b
|
refs/heads/master
| 2023-03-06T07:06:26.618783
| 2021-02-12T21:22:10
| 2021-02-12T21:22:10
| 337,445,845
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 959
|
java
|
package com.parkit.parkingsystem.constants;
public class DBConstants {
public static final String GET_NEXT_PARKING_SPOT = "select min(PARKING_NUMBER) from parking where AVAILABLE = true and TYPE = ?";
public static final String UPDATE_PARKING_SPOT = "update parking set available = ? where PARKING_NUMBER = ?";
public static final String SAVE_TICKET = "insert into ticket(PARKING_NUMBER, VEHICLE_REG_NUMBER, PRICE, IN_TIME, OUT_TIME) values(?,?,?,?,?)";
public static final String UPDATE_TICKET = "update ticket set PRICE=?, OUT_TIME=? where ID=?";
public static final String GET_TICKET = "select t.PARKING_NUMBER, t.ID, t.PRICE, t.IN_TIME, t.OUT_TIME, p.TYPE from ticket t,parking p where p.parking_number = t.parking_number and t.VEHICLE_REG_NUMBER=? order by t.ID DESC limit 1";
public static final String IS_RECURRENT_USER ="SELECT VEHICLE_REG_NUMBER FROM ticket where VEHICLE_REG_NUMBER=? and OUT_TIME is not null limit 1;";
}
|
[
"allegaertl@gmail.com"
] |
allegaertl@gmail.com
|
76c03da9e282eeb22af1cc05093eb6fb16d53d77
|
5194d8757a49139f0174a8932125aaffb293ca60
|
/org.opentravel/_2014B/opentravel-schema/golf/src/main/java/org/jibx/schema/org/opentravel/_2014B/golf/ws/GolfService.java
|
bb335ba57038048c220e71e21aec00bb0d0e5393
|
[] |
no_license
|
mrshishirr/schema-library
|
ad18c208cc321c91fef483d1dca36dbd39581b3f
|
37e3432665aaa10544c0491dc550c3c5ca293641
|
refs/heads/master
| 2022-03-31T23:19:13.476699
| 2020-01-27T05:04:54
| 2020-01-27T05:04:54
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 256
|
java
|
package org.jibx.schema.org.opentravel._2014B.golf.ws;
import org.jibx.schema.org.opentravel._2014B.golf.*;
public interface GolfService {
/**
* Service the xyz request.
* @param request
* @return
*/
// TODO public XyzRS xyz(XyzRQ request);
}
|
[
"don@donandann.com"
] |
don@donandann.com
|
c43f76a47de38594be7c3fac3279c7f66e39e743
|
d249c4bb104384abc51558b45ebc4b7aca7f9e2b
|
/src/main/java/com/ib/webapp/jsp/EscapeXml.java
|
e72a19bdb67630a63c2c64311c660a2b9e9d26db
|
[] |
no_license
|
siwiwit/appfuse-refresh
|
e7a347007ac01aa75ad4ff9c76817ac4f9d6b321
|
94f6ae97e5035851a5a66a656edf7a7e879ac573
|
refs/heads/master
| 2021-01-17T05:21:53.080856
| 2015-02-04T23:45:00
| 2015-02-04T23:45:00
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,118
|
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 com.ib.webapp.jsp;
/**
* Handles escaping of characters that could be interpreted as XML markup.
* <p>The specification for <code><c:out></code> defines the following
* character conversions to be applied:
* <table rules="all" frame="border">
* <tr><th>Character</th><th>Character Entity Code</th></tr>
* <tr><td><</td><td>&lt;</td></tr>
* <tr><td>></td><td>&gt;</td></tr>
* <tr><td>&</td><td>&amp;</td></tr>
* <tr><td>'</td><td>&#039;</td></tr>
* <tr><td>"</td><td>&#034;</td></tr>
* </table>
*/
public class EscapeXml {
private static final String[] ESCAPES;
static {
int size = '>' + 1; // '>' is the largest escaped value
ESCAPES = new String[size];
ESCAPES['<'] = "<";
ESCAPES['>'] = ">";
ESCAPES['&'] = "&";
ESCAPES['\''] = "'";
ESCAPES['"'] = """;
}
private static String getEscape(char c) {
if (c < ESCAPES.length) {
return ESCAPES[c];
} else {
return null;
}
}
/**
* Escape a string.
*
* @param src
* the string to escape; must not be null
* @return the escaped string
*/
public static String escape(String src) {
// first pass to determine the length of the buffer so we only allocate once
int length = 0;
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
String escape = getEscape(c);
if (escape != null) {
length += escape.length();
} else {
length += 1;
}
}
// skip copy if no escaping is needed
if (length == src.length()) {
return src;
}
// second pass to build the escaped string
StringBuilder buf = new StringBuilder(length);
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
String escape = getEscape(c);
if (escape != null) {
buf.append(escape);
} else {
buf.append(c);
}
}
return buf.toString();
}
}
|
[
"imam.baihaqi1999@gmail.com@016012ff-7e1c-b358-0303-e04b5bdd684d"
] |
imam.baihaqi1999@gmail.com@016012ff-7e1c-b358-0303-e04b5bdd684d
|
e25113d19354d3233b955c8333c0de94fca01b59
|
d931eae55c638dc24565cb7e8e4b7569f0c178d4
|
/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/template/TemplateContainer.java
|
e978ac25c96087beb1187d3f1616d5c12d242479
|
[
"Apache-2.0"
] |
permissive
|
qll3609120/bboss-elasticsearch
|
af93d350e50cc22e0f1debdc7a1781dc7e492f4e
|
d112946dbeb8183e06086dec40bb83569f9c1c56
|
refs/heads/master
| 2021-04-23T06:20:06.750481
| 2020-03-20T15:38:07
| 2020-03-20T15:38:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,847
|
java
|
package org.frameworkset.elasticsearch.template;
/**
* Copyright 2008 biaoping.yin
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.frameworkset.util.DaemonThread;
import com.frameworkset.util.ResourceInitial;
import java.util.Set;
/**
* <p>Description: </p>
* <p></p>
* <p>Copyright (c) 2018</p>
* @Date 2020/1/17 14:36
* @author biaoping.yin
* @version 1.0
*/
public interface TemplateContainer {
public final String NAME_perKeyDSLStructionCacheSize = "perKeyDSLStructionCacheSize";
public final String NAME_alwaysCacheDslStruction = "alwaysCacheDslStruction";
public final String NAME_templateFile = "templateFile";
public final String NAME_templateName = "templateName";
public final String NAME_istpl = "istpl";
public final String NAME_multiparser = "multiparser";
String getNamespace();
Set getTempalteNames();
TemplateMeta getProBean(String key);
void destroy(boolean b);
void reinit(ESUtil esUtil);
/**
* 命名空间对应的全局每一个template对应的dsl语法缓冲区大小
* @return
*/
int getPerKeyDSLStructionCacheSize();
/**
* 命名空间对应的全局是否开启每一个template对应的dsl语法缓冲机制
* @return
*/
boolean isAlwaysCacheDslStruction();
void monitor(DaemonThread daemonThread, ResourceInitial resourceTempateRefresh);
}
|
[
"yin-bp@163.com"
] |
yin-bp@163.com
|
204134cbcee4d45457fe823b15aaa481a2786104
|
c8c47d4ac12b169a943c76a85818455da153dcb7
|
/src/Decorator/ToppingGiftBox.java
|
f4c664fc6467d11201b50816cb21ef534f23dee0
|
[] |
no_license
|
K-O-G/AAD_LabWork3
|
73f83bbe07791b545582bef6a21b2edb99a3bf7b
|
7d7c66fbb7821af8992aadb8e287f38e6fe4f887
|
refs/heads/master
| 2020-05-21T08:19:57.367061
| 2017-03-11T06:57:25
| 2017-03-11T06:57:25
| 84,602,681
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 264
|
java
|
package Decorator;
public class ToppingGiftBox extends ToppingAdditions{
private Chocolate_cake cake;
public ToppingGiftBox(Chocolate_cake cake)
{
this.cake=cake;
topping();
}
void topping() {
cake.giftbox=cake.giftbox+"Happy Birthday GiftBox";
}
}
|
[
"KaterinaO.Gordiyenko@livenau.net"
] |
KaterinaO.Gordiyenko@livenau.net
|
d57be715a2048b9a8d1d632019c56a2cab2aceda
|
e24ccd143be2142d8a27285836ebc2497ed39bc2
|
/Homework531/src/Test3/SimpleDateFormatDemo.java
|
027928f0aa73259308eea759cb42aee82df6e507
|
[] |
no_license
|
SweetCukes/BookDinner_demo
|
867c464ba53ced3d45ef178724cd01cb9d534613
|
4693c0dc92eb830b7d7e67b083f4ae37152b228f
|
refs/heads/master
| 2020-07-19T14:25:00.321881
| 2019-09-05T03:00:22
| 2019-09-05T03:00:22
| 206,464,437
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 598
|
java
|
package Test3;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SimpleDateFormatDemo {
public static void main(String[] args) throws Exception{
String oldDate = "1999-1-24 12:52:37.900";
String newDate = null;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒sss毫秒");
Date date = sdf1.parse(oldDate);
newDate = sdf2.format(date);
System.out.println("格式化后日期:" + newDate);
}
}
|
[
"89217167@qq.com"
] |
89217167@qq.com
|
4e43004c0d23b91fd32355941a39be7d38f95b0d
|
842f2fb7ddb5b21569291567056edb16ea54e71f
|
/Practice/src/in/second/Question.java
|
10519af6bee86449909ba2c6fb0164831bf4e1d8
|
[] |
no_license
|
adatapost/krunal
|
4ce7dfcc38f714c6f46101c9bfe700c60bfde2d3
|
5f31df4e959f6af6635f9421c0a5f8332bb05f09
|
refs/heads/master
| 2020-06-04T17:33:42.808840
| 2014-11-11T03:05:29
| 2014-11-11T03:05:29
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,286
|
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 in.second;
/**
*
* @author admin
*/
public abstract class Question {
private String question;
private String answer1, answer2, answer3;
public abstract boolean isCorrect();
public abstract void display();
public Question() {
}
public Question(String question, String answer1, String answer2, String answer3) {
this.question = question;
this.answer1 = answer1;
this.answer2 = answer2;
this.answer3 = answer3;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getAnswer1() {
return answer1;
}
public void setAnswer1(String answer1) {
this.answer1 = answer1;
}
public String getAnswer2() {
return answer2;
}
public void setAnswer2(String answer2) {
this.answer2 = answer2;
}
public String getAnswer3() {
return answer3;
}
public void setAnswer3(String answer3) {
this.answer3 = answer3;
}
}
|
[
"adatapost@gmail.com"
] |
adatapost@gmail.com
|
2b9bc2180fba8e7fb12ddb632a28beee5a06acbc
|
e8f171ddb3c8fb54fcecaff0a84648e76681f982
|
/community/logicaldoc/tags/logicaldoc-7.4.3/logicaldoc-webapp/src/main/java/com/logicaldoc/web/service/DocumentServiceImpl.java
|
3ea0bf901cae85d99b19d589cd43ffacb1a69cb3
|
[] |
no_license
|
zhunengfei/logicaldoc
|
f12114ef72935e683af4b50f30a88fbd5df9bfde
|
9d432d29a9b43ebd2b13a1933a50add3f4784815
|
refs/heads/master
| 2021-01-20T01:05:48.499693
| 2017-01-13T16:24:16
| 2017-01-13T16:24:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 65,149
|
java
|
package com.logicaldoc.web.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.security.AccessControlException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.logicaldoc.core.ExtendedAttribute;
import com.logicaldoc.core.communication.EMail;
import com.logicaldoc.core.communication.EMailAttachment;
import com.logicaldoc.core.communication.EMailSender;
import com.logicaldoc.core.communication.Recipient;
import com.logicaldoc.core.contact.Contact;
import com.logicaldoc.core.contact.ContactDAO;
import com.logicaldoc.core.document.AbstractDocument;
import com.logicaldoc.core.document.Bookmark;
import com.logicaldoc.core.document.Document;
import com.logicaldoc.core.document.DocumentEvent;
import com.logicaldoc.core.document.DocumentLink;
import com.logicaldoc.core.document.DocumentManager;
import com.logicaldoc.core.document.DocumentNote;
import com.logicaldoc.core.document.DocumentTemplate;
import com.logicaldoc.core.document.History;
import com.logicaldoc.core.document.Rating;
import com.logicaldoc.core.document.Version;
import com.logicaldoc.core.document.dao.BookmarkDAO;
import com.logicaldoc.core.document.dao.DocumentDAO;
import com.logicaldoc.core.document.dao.DocumentLinkDAO;
import com.logicaldoc.core.document.dao.DocumentNoteDAO;
import com.logicaldoc.core.document.dao.DocumentTemplateDAO;
import com.logicaldoc.core.document.dao.HistoryDAO;
import com.logicaldoc.core.document.dao.RatingDAO;
import com.logicaldoc.core.document.dao.VersionDAO;
import com.logicaldoc.core.document.pdf.PdfConverterManager;
import com.logicaldoc.core.document.thumbnail.ThumbnailManager;
import com.logicaldoc.core.security.Folder;
import com.logicaldoc.core.security.Permission;
import com.logicaldoc.core.security.User;
import com.logicaldoc.core.security.UserSession;
import com.logicaldoc.core.security.dao.FolderDAO;
import com.logicaldoc.core.security.dao.UserDAO;
import com.logicaldoc.core.store.Storer;
import com.logicaldoc.core.ticket.Ticket;
import com.logicaldoc.core.ticket.TicketDAO;
import com.logicaldoc.core.transfer.InMemoryZipImport;
import com.logicaldoc.core.transfer.ZipExport;
import com.logicaldoc.core.util.IconSelector;
import com.logicaldoc.core.util.UserUtil;
import com.logicaldoc.gui.common.client.ServerException;
import com.logicaldoc.gui.common.client.beans.GUIBookmark;
import com.logicaldoc.gui.common.client.beans.GUIDocument;
import com.logicaldoc.gui.common.client.beans.GUIEmail;
import com.logicaldoc.gui.common.client.beans.GUIExtendedAttribute;
import com.logicaldoc.gui.common.client.beans.GUIFolder;
import com.logicaldoc.gui.common.client.beans.GUIRating;
import com.logicaldoc.gui.common.client.beans.GUIVersion;
import com.logicaldoc.gui.frontend.client.services.DocumentService;
import com.logicaldoc.i18n.I18N;
import com.logicaldoc.util.Context;
import com.logicaldoc.util.LocaleUtil;
import com.logicaldoc.util.MimeType;
import com.logicaldoc.util.crypt.CryptUtil;
import com.logicaldoc.util.io.FileUtil;
import com.logicaldoc.web.UploadServlet;
import com.logicaldoc.web.util.ServiceUtil;
/**
* Implementation of the DocumentService
*
* @author Matteo Caruso - Logical Objects
* @since 6.0
*/
public class DocumentServiceImpl extends RemoteServiceServlet implements DocumentService {
private static final long serialVersionUID = 1L;
private static Logger log = LoggerFactory.getLogger(DocumentServiceImpl.class);
@Override
public void addBookmarks(String sid, long[] ids, int type) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
BookmarkDAO bookmarkDao = (BookmarkDAO) Context.getInstance().getBean(BookmarkDAO.class);
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
int added = 0;
int alreadyAdded = 0;
for (long id : ids) {
try {
Bookmark bookmark = null;
if (bookmarkDao.findByUserIdAndDocId(ServiceUtil.getSessionUser(sid).getId(), id).size() > 0) {
// The bookmark already exists
alreadyAdded++;
} else {
bookmark = new Bookmark();
bookmark.setTenantId(session.getTenantId());
bookmark.setType(type);
bookmark.setTargetId(id);
bookmark.setUserId(ServiceUtil.getSessionUser(sid).getId());
if (type == Bookmark.TYPE_DOCUMENT) {
Document doc = dao.findById(id);
bookmark.setTitle(doc.getTitle());
bookmark.setFileType(doc.getType());
} else {
Folder f = fdao.findById(id);
bookmark.setTitle(f.getName());
}
bookmarkDao.store(bookmark);
added++;
}
} catch (AccessControlException e) {
ServiceUtil.throwServerException(session, log, e);
} catch (Exception e) {
ServiceUtil.throwServerException(session, log, e);
}
}
}
@Override
public void indexDocuments(String sid, Long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
for (Long id : docIds) {
if (id != null)
try {
documentManager.reindex(id, null);
} catch (Throwable e) {
ServiceUtil.throwServerException(session, log, e);
}
}
}
@Override
public GUIDocument[] addDocuments(String sid, boolean importZip, boolean immediateIndexing,
final GUIDocument metadata) throws ServerException {
final UserSession session = ServiceUtil.validateSession(sid);
List<GUIDocument> createdDocs = new ArrayList<GUIDocument>();
Map<String, File> uploadedFilesMap = UploadServlet.getReceivedFiles(getThreadLocalRequest(), sid);
log.debug("Uploading " + uploadedFilesMap.size() + " files");
Map<String, String> uploadedFileNames = UploadServlet.getReceivedFileNames(getThreadLocalRequest(), sid);
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
FolderDAO folderDao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
final Folder parent = folderDao.findById(metadata.getFolder().getId());
if (uploadedFilesMap.isEmpty())
ServiceUtil.throwServerException(session, log, new Exception("No file uploaded"));
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (!fdao.isWriteEnabled(metadata.getFolder().getId(), session.getUserId()))
ServiceUtil.throwServerException(session, log, new Exception(
"The user doesn't have the write permission on the current folder"));
List<Long> docsToIndex = new ArrayList<Long>();
try {
for (String fileId : uploadedFilesMap.keySet()) {
final File file = uploadedFilesMap.get(fileId);
final String filename = uploadedFileNames.get(fileId);
if (filename.endsWith(".zip") && importZip) {
log.debug("file = " + file);
// copy the file into the user folder
final File destFile = new File(UserUtil.getUserResource(ServiceUtil.getSessionUser(sid).getId(),
"zip"), filename);
FileUtils.copyFile(file, destFile);
final long userId = ServiceUtil.getSessionUser(sid).getId();
final String sessionId = sid;
// Prepare the import thread
Thread zipImporter = new Thread(new Runnable() {
public void run() {
/*
* Prepare the Master document used to create the
* new one
*/
Document doc = toDocument(metadata);
doc.setTenantId(session.getTenantId());
doc.setCreation(new Date());
InMemoryZipImport importer = new InMemoryZipImport(doc);
importer.process(destFile, parent, userId, sessionId);
try {
FileUtils.forceDelete(destFile);
} catch (IOException e) {
log.error("Unable to delete " + destFile, e);
}
}
});
// And launch it
zipImporter.start();
} else {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.STORED.toString());
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(metadata.getComment());
/*
* Prepare the Master document used to create the new one
*/
Document doc = toDocument(metadata);
doc.setTenantId(session.getTenantId());
doc.setCreation(new Date());
doc.setFileName(filename);
doc.setTitle(FilenameUtils.getBaseName(filename));
// Create the new document
doc = documentManager.create(file, doc, transaction);
if (immediateIndexing && doc.getIndexed() == Document.INDEX_TO_INDEX)
docsToIndex.add(doc.getId());
createdDocs.add(fromDocument(doc, metadata.getFolder()));
}
}
UploadServlet.cleanReceivedFiles(getThreadLocalRequest().getSession());
if (!docsToIndex.isEmpty())
indexDocuments(sid, docsToIndex.toArray(new Long[0]));
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
return createdDocs.toArray(new GUIDocument[0]);
}
@Override
public GUIDocument[] addDocuments(String sid, String language, long folderId, boolean importZip,
boolean immediateIndexing, final Long templateId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (folderId == fdao.findRoot(session.getTenantId()).getId())
throw new RuntimeException("Cannot add documents in the root");
GUIDocument metadata = new GUIDocument();
metadata.setLanguage(language);
metadata.setFolder(new GUIFolder(folderId));
metadata.setTemplateId(templateId);
return addDocuments(sid, importZip, immediateIndexing, metadata);
}
@Override
public GUIDocument checkin(String sid, GUIDocument document, boolean major) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
Map<String, File> uploadedFilesMap = UploadServlet.getReceivedFiles(getThreadLocalRequest(), sid);
File file = uploadedFilesMap.values().iterator().next();
if (file != null) {
// check that we have a valid file for storing as new version
Map<String, String> uploadedFileNames = UploadServlet.getReceivedFileNames(getThreadLocalRequest(), sid);
String fileName = uploadedFileNames.values().iterator().next();
log.debug("Checking in file " + fileName);
try {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.CHECKEDIN.toString());
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(document.getComment());
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
Document doc = dao.findById(document.getId());
if (doc.getDocRef() != null)
doc = dao.findById(doc.getDocRef().longValue());
// checkin the document; throws an exception if
// something goes wrong
DocumentManager documentManager = (DocumentManager) Context.getInstance()
.getBean(DocumentManager.class);
documentManager.checkin(doc.getId(), new FileInputStream(file), fileName, major, toDocument(document),
transaction);
UploadServlet.cleanReceivedFiles(getThreadLocalRequest().getSession());
return getById(sid, doc.getId());
} catch (Throwable t) {
return (GUIDocument) ServiceUtil.throwServerException(session, log, t);
}
} else
return null;
}
@Override
public void checkout(String sid, long docId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.CHECKEDOUT.toString());
transaction.setComment("");
transaction.setUser(ServiceUtil.getSessionUser(sid));
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
Document doc = dao.findById(docId);
if (doc.getDocRef() != null)
docId = doc.getDocRef().longValue();
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
try {
documentManager.checkout(docId, transaction);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void delete(String sid, long[] ids) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
if (ids.length > 0) {
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
for (long id : ids) {
try {
Document doc = dao.findById(id);
if (doc == null)
continue;
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.DELETED.toString());
transaction.setComment("");
transaction.setUser(ServiceUtil.getSessionUser(sid));
// If it is a shortcut, we delete only the shortcut
if (doc.getDocRef() != null) {
transaction.setEvent(DocumentEvent.SHORTCUT_DELETED.toString());
dao.delete(doc.getId(), transaction);
continue;
}
// The document of the selected documentRecord must be
// not immutable
if (doc.getImmutable() == 1 && !transaction.getUser().isInGroup("admin")) {
log.debug("Document " + id + " was not deleted because immutable");
continue;
}
// The document must be not locked
if (doc.getStatus() == Document.DOC_LOCKED) {
log.debug("Document " + id + " was not deleted because locked");
continue;
}
// Check if there are some shortcuts associated to the
// deleting document. All the shortcuts must be deleted.
if (dao.findAliasIds(doc.getId()).size() > 0)
for (Long shortcutId : dao.findAliasIds(doc.getId())) {
dao.delete(shortcutId);
}
dao.delete(doc.getId(), transaction);
} catch (Throwable t) {
t.printStackTrace();
ServiceUtil.throwServerException(session, log, t);
}
}
}
}
@Override
public void deleteBookmarks(String sid, long[] bookmarkIds) throws ServerException {
ServiceUtil.validateSession(sid);
BookmarkDAO dao = (BookmarkDAO) Context.getInstance().getBean(BookmarkDAO.class);
for (long id : bookmarkIds) {
dao.delete(id);
}
}
@Override
public void deleteLinks(String sid, long[] ids) throws ServerException {
ServiceUtil.validateSession(sid);
DocumentLinkDAO dao = (DocumentLinkDAO) Context.getInstance().getBean(DocumentLinkDAO.class);
for (long id : ids) {
dao.delete(id);
}
}
@Override
public GUIExtendedAttribute[] getAttributes(String sid, long templateId) throws ServerException {
ServiceUtil.validateSession(sid);
DocumentTemplateDAO templateDao = (DocumentTemplateDAO) Context.getInstance()
.getBean(DocumentTemplateDAO.class);
DocumentTemplate template = templateDao.findById(templateId);
GUIExtendedAttribute[] attributes = prepareGUIAttributes(template, null);
return attributes;
}
private static GUIExtendedAttribute[] prepareGUIAttributes(DocumentTemplate template, Document doc) {
try {
if (template != null) {
GUIExtendedAttribute[] attributes = new GUIExtendedAttribute[template.getAttributeNames().size()];
int i = 0;
for (String attrName : template.getAttributeNames()) {
ExtendedAttribute extAttr = template.getAttributes().get(attrName);
GUIExtendedAttribute att = new GUIExtendedAttribute();
att.setName(attrName);
att.setPosition(extAttr.getPosition());
att.setLabel(extAttr.getLabel());
att.setMandatory(extAttr.getMandatory() == 1);
att.setEditor(extAttr.getEditor());
att.setStringValue(extAttr.getStringValue());
att.setOptions(new String[] { extAttr.getStringValue() });
if (doc != null) {
if (doc.getValue(attrName) != null)
att.setValue(doc.getValue(attrName));
} else
att.setValue(extAttr.getValue());
att.setType(extAttr.getType());
attributes[i] = att;
i++;
}
return attributes;
} else {
List<GUIExtendedAttribute> list = new ArrayList<GUIExtendedAttribute>();
for (String name : doc.getAttributeNames()) {
ExtendedAttribute e = doc.getAttributes().get(name);
GUIExtendedAttribute ext = new GUIExtendedAttribute();
ext.setName(name);
ext.setDateValue(e.getDateValue());
ext.setStringValue(e.getStringValue());
ext.setIntValue(e.getIntValue());
ext.setDoubleValue(e.getDoubleValue());
ext.setBooleanValue(e.getBooleanValue());
ext.setType(e.getType());
list.add(ext);
}
return list.toArray(new GUIExtendedAttribute[0]);
}
} catch (Throwable t) {
log.error(t.getMessage(), t);
return null;
}
}
@Override
public GUIDocument getById(String sid, long docId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
Document doc = docDao.findById(docId);
GUIDocument document = null;
GUIFolder folder = null;
if (doc != null) {
folder = FolderServiceImpl.getFolder(sid, doc.getFolder().getId());
Long aliasId = null;
// Check if it is an alias
if (doc.getDocRef() != null) {
long id = doc.getDocRef();
doc = docDao.findById(id);
aliasId = docId;
}
try {
User user = ServiceUtil.getSessionUser(sid);
checkPublished(user, doc);
docDao.initialize(doc);
document = fromDocument(doc, folder);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
document.setPathExtended(fdao.computePathExtended(folder.getId()));
if (aliasId != null)
document.setDocRef(aliasId);
Set<Permission> permissions = fdao.getEnabledPermissions(doc.getFolder().getId(), session.getUserId());
List<String> permissionsList = new ArrayList<String>();
for (Permission permission : permissions)
permissionsList.add(permission.toString());
folder.setPermissions(permissionsList.toArray(new String[permissionsList.size()]));
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
return document;
}
public static GUIDocument fromDocument(Document doc, GUIFolder folder) {
GUIDocument document = new GUIDocument();
document.setId(doc.getId());
if (doc.getDocRef() != null && doc.getDocRef().longValue() != 0) {
document.setDocRef(doc.getDocRef());
document.setDocRefType(doc.getDocRefType());
}
document.setTitle(doc.getTitle());
document.setCustomId(doc.getCustomId());
if (doc.getTags().size() > 0)
document.setTags(doc.getTagsAsWords().toArray(new String[doc.getTags().size()]));
else
document.setTags(new String[0]);
document.setType(doc.getType());
document.setFileName(doc.getFileName());
document.setVersion(doc.getVersion());
document.setCreation(doc.getCreation());
document.setCreator(doc.getCreator());
document.setDate(doc.getDate());
document.setPublisher(doc.getPublisher());
document.setFileVersion(doc.getFileVersion());
document.setLanguage(doc.getLanguage());
document.setSource(doc.getSource());
document.setRecipient(doc.getRecipient());
document.setTemplateId(doc.getTemplateId());
document.setSourceType(doc.getSourceType());
document.setObject(doc.getObject());
document.setCoverage(doc.getCoverage());
document.setSourceAuthor(doc.getSourceAuthor());
document.setSourceDate(doc.getSourceDate());
document.setSourceId(doc.getSourceId());
document.setLastModified(doc.getLastModified());
document.setLockUserId(doc.getLockUserId());
document.setLockUser(doc.getLockUser());
document.setComment(doc.getComment());
document.setStatus(doc.getStatus());
document.setWorkflowStatus(doc.getWorkflowStatus());
document.setImmutable(doc.getImmutable());
document.setFileSize(new Long(doc.getFileSize()).floatValue());
document.setStartPublishing(doc.getStartPublishing());
document.setStopPublishing(doc.getStopPublishing());
document.setPublished(doc.getPublished());
document.setSigned(doc.getSigned());
document.setStamped(doc.getStamped());
document.setBarcoded(doc.getBarcoded());
document.setIndexed(doc.getIndexed());
document.setExtResId(doc.getExtResId());
document.setPages(doc.getPages());
document.setNature(doc.getNature());
document.setFormId(doc.getFormId());
document.setIcon(FilenameUtils.getBaseName(IconSelector.selectIcon(FilenameUtils.getExtension(document
.getFileName()))));
if (doc.getRating() != null)
document.setRating(doc.getRating());
if (doc.getCustomId() != null)
document.setCustomId(doc.getCustomId());
else
document.setCustomId("");
if (doc.getTemplate() != null) {
document.setTemplate(doc.getTemplate().getName());
document.setTemplateId(doc.getTemplate().getId());
}
if (doc.getAttributes() != null && !doc.getAttributes().isEmpty()) {
GUIExtendedAttribute[] attributes = prepareGUIAttributes(doc.getTemplate(), doc);
document.setAttributes(attributes);
}
if (folder != null) {
document.setFolder(folder);
} else {
GUIFolder f = new GUIFolder(doc.getFolder().getId());
f.setName(doc.getFolder().getName());
document.setFolder(f);
}
return document;
}
@Override
public GUIVersion[] getVersionsById(String sid, long id1, long id2) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
VersionDAO versDao = (VersionDAO) Context.getInstance().getBean(VersionDAO.class);
Version docVersion = versDao.findById(id1);
versDao.initialize(docVersion);
GUIVersion version1 = null;
if (docVersion != null) {
version1 = new GUIVersion();
version1.setDocId(docVersion.getDocId());
version1.setUsername(docVersion.getUsername());
version1.setComment(docVersion.getComment());
version1.setId(id1);
version1.setTitle(docVersion.getTitle());
version1.setCustomId(docVersion.getCustomId());
version1.setTagsString(docVersion.getTgs());
version1.setType(docVersion.getType());
version1.setFileName(docVersion.getFileName());
version1.setVersion(docVersion.getVersion());
version1.setCreation(docVersion.getCreation());
version1.setCreator(docVersion.getCreator());
version1.setDate(docVersion.getDate());
version1.setPublisher(docVersion.getPublisher());
version1.setFileVersion(docVersion.getFileVersion());
version1.setLanguage(docVersion.getLanguage());
version1.setTemplateId(docVersion.getTemplateId());
version1.setFileSize(new Float(docVersion.getFileSize()));
version1.setSource(docVersion.getSource());
version1.setCoverage(docVersion.getCoverage());
version1.setRecipient(docVersion.getRecipient());
version1.setObject(docVersion.getObject());
version1.setWorkflowStatus(docVersion.getWorkflowStatus());
if (docVersion.getRating() != null)
version1.setRating(docVersion.getRating());
version1.setSourceType(docVersion.getSourceType());
version1.setSourceAuthor(docVersion.getSourceAuthor());
version1.setSourceId(docVersion.getSourceId());
version1.setSourceDate(docVersion.getSourceDate());
version1.setStartPublishing(docVersion.getStartPublishing());
version1.setStopPublishing(docVersion.getStopPublishing());
version1.setPublished(docVersion.getPublished());
version1.setPages(docVersion.getPages());
version1.setTemplate(docVersion.getTemplateName());
versDao.initialize(docVersion);
for (String attrName : docVersion.getAttributeNames()) {
ExtendedAttribute extAttr = docVersion.getAttributes().get(attrName);
version1.setValue(attrName, extAttr.getValue());
}
GUIFolder folder1 = new GUIFolder();
folder1.setName(docVersion.getFolderName());
folder1.setId(docVersion.getFolderId());
version1.setFolder(folder1);
}
docVersion = versDao.findById(id2);
versDao.initialize(docVersion);
GUIVersion version2 = null;
if (docVersion != null) {
version2 = new GUIVersion();
version2.setDocId(docVersion.getDocId());
version2.setUsername(docVersion.getUsername());
version2.setComment(docVersion.getComment());
version2.setId(id1);
version2.setTitle(docVersion.getTitle());
version2.setCustomId(docVersion.getCustomId());
version2.setTagsString(docVersion.getTgs());
version2.setType(docVersion.getType());
version2.setFileName(docVersion.getFileName());
version2.setVersion(docVersion.getVersion());
version2.setCreation(docVersion.getCreation());
version2.setCreator(docVersion.getCreator());
version2.setDate(docVersion.getDate());
version2.setPublisher(docVersion.getPublisher());
version2.setFileVersion(docVersion.getFileVersion());
version2.setLanguage(docVersion.getLanguage());
version2.setFileSize(new Float(docVersion.getFileSize()));
version2.setSource(docVersion.getSource());
version2.setCoverage(docVersion.getCoverage());
version2.setRecipient(docVersion.getRecipient());
version2.setObject(docVersion.getObject());
if (docVersion.getRating() != null)
version2.setRating(docVersion.getRating());
version2.setSourceType(docVersion.getSourceType());
version2.setSourceAuthor(docVersion.getSourceAuthor());
version2.setSourceId(docVersion.getSourceId());
version2.setSourceDate(docVersion.getSourceDate());
version2.setWorkflowStatus(docVersion.getWorkflowStatus());
version2.setStartPublishing(docVersion.getStartPublishing());
version2.setStopPublishing(docVersion.getStopPublishing());
version2.setPublished(docVersion.getPublished());
version2.setPages(docVersion.getPages());
version2.setTemplateId(docVersion.getTemplateId());
version2.setTemplate(docVersion.getTemplateName());
versDao.initialize(docVersion);
for (String attrName : docVersion.getAttributeNames()) {
ExtendedAttribute extAttr = docVersion.getAttributes().get(attrName);
version2.setValue(attrName, extAttr.getValue());
}
GUIFolder folder2 = new GUIFolder();
folder2.setName(docVersion.getFolderName());
folder2.setId(docVersion.getFolderId());
version2.setFolder(folder2);
}
GUIVersion[] versions = null;
if (version1 != null && version2 != null) {
versions = new GUIVersion[2];
versions[0] = version1;
versions[1] = version2;
} else if (version1 != null && version2 == null) {
versions = new GUIVersion[1];
versions[0] = version1;
} else if (version1 == null && version2 != null) {
versions = new GUIVersion[1];
versions[0] = version2;
} else
return null;
return versions;
} catch (Throwable t) {
log.error("Exception linking documents: " + t.getMessage(), t);
return (GUIVersion[]) ServiceUtil.throwServerException(session, null, t);
}
}
@Override
public void linkDocuments(String sid, long[] inDocIds, long[] outDocIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
DocumentLinkDAO linkDao = (DocumentLinkDAO) Context.getInstance().getBean(DocumentLinkDAO.class);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
if (outDocIds.length > 0) {
try {
for (int i = 0; i < inDocIds.length; i++) {
for (int j = 0; j < outDocIds.length; j++) {
DocumentLink link = linkDao.findByDocIdsAndType(inDocIds[i], outDocIds[j], "default");
if (link == null) {
// The link doesn't exist and must be created
link = new DocumentLink();
link.setTenantId(session.getTenantId());
link.setDocument1(docDao.findById(inDocIds[i]));
link.setDocument2(docDao.findById(outDocIds[j]));
link.setType("default");
linkDao.store(link);
}
}
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
}
@Override
public void lock(String sid, long[] docIds, String comment) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
// Unlock the document; throws an exception if something
// goes wrong
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
try {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.LOCKED.toString());
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(comment);
for (long id : docIds) {
documentManager.lock(id, Document.DOC_LOCKED, transaction);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void makeImmutable(String sid, long[] docIds, String comment) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
for (long id : docIds) {
Document doc = docDao.findById(id);
if (doc.getImmutable() == 0) {
// The document of the selected documentRecord must be
// not locked
if (doc.getStatus() != Document.DOC_UNLOCKED) {
continue;
}
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setComment(comment);
transaction.setUser(ServiceUtil.getSessionUser(sid));
manager.makeImmutable(id, transaction);
}
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void markHistoryAsRead(String sid, String event) throws ServerException {
ServiceUtil.validateSession(sid);
HistoryDAO dao = (HistoryDAO) Context.getInstance().getBean(HistoryDAO.class);
for (History history : dao.findByUserIdAndEvent(ServiceUtil.getSessionUser(sid).getId(), event, null)) {
dao.initialize(history);
history.setNew(0);
dao.store(history);
}
}
@Override
public void markIndexable(String sid, long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
for (long id : docIds) {
manager.changeIndexingStatus(docDao.findById(id), AbstractDocument.INDEX_TO_INDEX);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void markUnindexable(String sid, long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
for (long id : docIds) {
manager.changeIndexingStatus(docDao.findById(id), AbstractDocument.INDEX_SKIP);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void restore(String sid, long[] docIds, long folderId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
for (long docId : docIds) {
History transaction = new History();
transaction.setUser(ServiceUtil.getSessionUser(session.getId()));
transaction.setSessionId(session.getId());
docDao.restore(docId, folderId, transaction);
}
}
@Override
public GUIDocument save(String sid, GUIDocument document) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
if (document.getId() != 0) {
Document doc = docDao.findById(document.getId());
docDao.initialize(doc);
doc.setCustomId(document.getCustomId());
doc.setComment(document.getComment());
try {
Document docVO = toDocument(document);
docVO.setBarcoded(doc.getBarcoded());
docVO.setTenantId(session.getTenantId());
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.CHANGED.toString());
transaction.setComment(document.getComment());
transaction.setUser(ServiceUtil.getSessionUser(sid));
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(
DocumentManager.class);
documentManager.update(doc, docVO, transaction);
return getById(sid, doc.getId());
} catch (Throwable t) {
log.error(t.getMessage(), t);
throw new RuntimeException(t.getMessage(), t);
}
} else
return null;
} catch (Throwable t) {
return (GUIDocument) ServiceUtil.throwServerException(session, log, t);
}
}
/**
* Produces a plain new Document from a GUIDocument
*/
protected Document toDocument(GUIDocument document) {
Document docVO = new Document();
if (document.getTags() != null && document.getTags().length > 0)
docVO.setTagsFromWords(new HashSet<String>(Arrays.asList(document.getTags())));
docVO.setTitle(document.getTitle());
docVO.setCustomId(document.getCustomId());
docVO.setSourceType(document.getSourceType());
docVO.setFileName(document.getFileName());
docVO.setVersion(document.getVersion());
docVO.setCreation(document.getCreation());
docVO.setCreator(document.getCreator());
docVO.setDate(document.getDate());
docVO.setPublisher(document.getPublisher());
docVO.setFileVersion(document.getFileVersion());
docVO.setLanguage(document.getLanguage());
if (document.getFileSize() != null)
docVO.setFileSize(document.getFileSize().longValue());
docVO.setSource(document.getSource());
docVO.setRecipient(document.getRecipient());
docVO.setObject(document.getObject());
docVO.setCoverage(document.getCoverage());
docVO.setSourceAuthor(document.getSourceAuthor());
docVO.setSourceDate(document.getSourceDate());
docVO.setSourceId(document.getSourceId());
docVO.setRating(document.getRating());
docVO.setComment(document.getComment());
docVO.setWorkflowStatus(document.getWorkflowStatus());
docVO.setStartPublishing(document.getStartPublishing());
docVO.setStopPublishing(document.getStopPublishing());
docVO.setPublished(document.getPublished());
docVO.setBarcoded(document.getBarcoded());
docVO.setExtResId(document.getExtResId());
docVO.setPages(document.getPages());
docVO.setNature(document.getNature());
docVO.setFormId(document.getFormId());
if (document.getTemplateId() != null) {
docVO.setTemplateId(document.getTemplateId());
DocumentTemplateDAO templateDao = (DocumentTemplateDAO) Context.getInstance().getBean(
DocumentTemplateDAO.class);
DocumentTemplate template = templateDao.findById(document.getTemplateId());
docVO.setTemplate(template);
if (document.getAttributes().length > 0) {
for (GUIExtendedAttribute attr : document.getAttributes()) {
ExtendedAttribute templateAttribute = template.getAttributes().get(attr.getName());
// This control is necessary because, changing
// the template, the values of the old template
// attributes keys remains on the form value
// manager,
// so the GUIDocument contains also the old
// template attributes keys that must be
// skipped.
if (templateAttribute == null)
continue;
ExtendedAttribute extAttr = new ExtendedAttribute();
int templateType = templateAttribute.getType();
int extAttrType = attr.getType();
if (templateType != extAttrType) {
// This check is useful to avoid errors
// related to the old template
// attributes keys that remains on the form
// value manager
if (attr.getValue().toString().trim().isEmpty() && templateType != 0) {
if (templateType == ExtendedAttribute.TYPE_INT
|| templateType == ExtendedAttribute.TYPE_BOOLEAN) {
extAttr.setIntValue(null);
} else if (templateType == ExtendedAttribute.TYPE_DOUBLE) {
extAttr.setDoubleValue(null);
} else if (templateType == ExtendedAttribute.TYPE_DATE) {
extAttr.setDateValue(null);
}
} else if (templateType == GUIExtendedAttribute.TYPE_DOUBLE) {
extAttr.setValue(Double.parseDouble(attr.getValue().toString()));
} else if (templateType == GUIExtendedAttribute.TYPE_INT) {
extAttr.setValue(Long.parseLong(attr.getValue().toString()));
} else if (templateType == GUIExtendedAttribute.TYPE_BOOLEAN) {
extAttr.setValue(attr.getBooleanValue());
extAttr.setType(ExtendedAttribute.TYPE_BOOLEAN);
} else if (templateType == GUIExtendedAttribute.TYPE_USER) {
extAttr.setIntValue(attr.getIntValue());
extAttr.setStringValue(attr.getStringValue());
extAttr.setType(templateType);
}
} else {
if (templateType == ExtendedAttribute.TYPE_INT) {
if (attr.getValue() != null)
extAttr.setIntValue((Long) attr.getValue());
else
extAttr.setIntValue(null);
} else if (templateType == ExtendedAttribute.TYPE_BOOLEAN) {
if (attr.getBooleanValue() != null)
extAttr.setValue(attr.getBooleanValue());
else
extAttr.setBooleanValue(null);
} else if (templateType == ExtendedAttribute.TYPE_DOUBLE) {
if (attr.getValue() != null)
extAttr.setDoubleValue((Double) attr.getValue());
else
extAttr.setDoubleValue(null);
} else if (templateType == ExtendedAttribute.TYPE_DATE) {
if (attr.getValue() != null)
extAttr.setDateValue((Date) attr.getValue());
else
extAttr.setDateValue(null);
} else if (templateType == ExtendedAttribute.TYPE_STRING) {
if (attr.getValue() != null)
extAttr.setStringValue((String) attr.getValue());
else
extAttr.setStringValue(null);
} else if (templateType == ExtendedAttribute.TYPE_USER) {
if (attr.getValue() != null) {
extAttr.setIntValue(attr.getIntValue());
extAttr.setStringValue(attr.getStringValue());
} else {
extAttr.setIntValue(null);
extAttr.setStringValue(null);
}
extAttr.setType(templateType);
}
}
extAttr.setLabel(attr.getLabel());
extAttr.setType(templateType);
extAttr.setPosition(attr.getPosition());
extAttr.setMandatory(attr.isMandatory() ? 1 : 0);
docVO.getAttributes().put(attr.getName(), extAttr);
}
}
}
docVO.setStatus(document.getStatus());
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (document.getFolder() != null)
docVO.setFolder(fdao.findById(document.getFolder().getId()));
return docVO;
}
@Override
public String sendAsEmail(String sid, GUIEmail email, String locale) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
UserDAO userDao = (UserDAO) Context.getInstance().getBean(UserDAO.class);
DocumentDAO documentDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
User user = userDao.findById(session.getUserId());
EMail mail;
try {
mail = new EMail();
mail.setHtml(1);
mail.setTenantId(session.getTenantId());
mail.setAccountId(-1);
mail.setAuthor(user.getUserName());
mail.setAuthorAddress(user.getEmail());
if (StringUtils.isNotEmpty(email.getRecipients()))
mail.parseRecipients(email.getRecipients());
if (StringUtils.isNotEmpty(email.getCc()))
mail.parseRecipientsCC(email.getCc());
mail.setFolder("outbox");
String message = email.getMessage();
mail.setSentDate(new Date());
mail.setSubject(email.getSubject());
mail.setUserName(user.getUserName());
// Needed in case the zip compression was requested by the user
File zipFile = null;
if (email.isSendAsTicket()) {
// Prepare a new download ticket
Ticket ticket = prepareTicket(email.getDocIds()[0], user);
History transaction = new History();
transaction.setSessionId(session.getId());
transaction.setUser(user);
storeTicket(ticket, transaction);
Document doc = documentDao.findById(ticket.getDocId());
String ticketUrl = composeTicketUrl(ticket);
message = email.getMessage()
+ "<div style='margin-top:10px; border-top:1px solid black; background-color:#CCCCCC;'><b> "
+ I18N.message("clicktodownload", LocaleUtil.toLocale(locale)) + ": <a href='" + ticketUrl
+ "'>" + doc.getFileName() + "</a></b></div>";
if (doc.getDocRef() != null)
doc = documentDao.findById(doc.getDocRef());
String thumb = createPreview(doc, user.getId(), sid);
if (thumb != null) {
mail.getImages().add(thumb);
message += "<p><img src='cid:image_1'/></p>";
}
mail.setMessageText("<html><body>" + message + "</body></html>");
} else {
if (email.isZipCompression()) {
/*
* Create a temporary archive for sending it as unique
* attachment
*/
zipFile = File.createTempFile("email", "zip");
OutputStream out = null;
try {
out = new FileOutputStream(zipFile);
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.DOWNLOADED.toString());
transaction.setUser(ServiceUtil.getSessionUser(sid));
ZipExport export = new ZipExport();
export.process(email.getDocIds(), out, email.isPdfConversion(), transaction);
createAttachment(mail, zipFile);
} catch (Throwable t) {
log.error(t.getMessage(), t);
try {
if (out != null)
out.close();
} catch (Throwable q) {
}
}
} else {
for (long id : email.getDocIds())
createAttachment(mail, id, email.isPdfConversion(), sid);
}
}
try {
message = "<html><body>" + message + "</body></html>";
// message =
// "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"></head><body>"
// + message + "</body></html>";
mail.setMessageText(message);
// Send the message
EMailSender sender = new EMailSender(session.getTenantName());
sender.send(mail);
if (zipFile != null)
FileUtils.forceDelete(zipFile);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
FolderDAO fDao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
for (long id : email.getDocIds()) {
Document doc = docDao.findById(id);
if (doc.getDocRef() != null)
doc = documentDao.findById(doc.getDocRef());
// Create the document history event
HistoryDAO dao = (HistoryDAO) Context.getInstance().getBean(HistoryDAO.class);
History history = new History();
history.setSessionId(sid);
history.setDocId(id);
history.setEvent(DocumentEvent.SENT.toString());
history.setUser(ServiceUtil.getSessionUser(sid));
history.setComment(StringUtils.abbreviate(email.getRecipients(), 4000));
history.setTitle(doc.getTitle());
history.setVersion(doc.getVersion());
history.setPath(fDao.computePathExtended(doc.getFolder().getId()));
dao.store(history);
}
/*
* Save the recipients in the user's contacts
*/
ContactDAO cdao = (ContactDAO) Context.getInstance().getBean(ContactDAO.class);
for (Recipient recipient : mail.getRecipients()) {
List<Contact> contacts = cdao.findByUser(user.getId(), recipient.getAddress());
if (contacts.isEmpty()) {
Contact cont = new Contact();
cont.setUserId(user.getId());
cont.setEmail(recipient.getAddress().trim());
cdao.store(cont);
}
}
return "ok";
} catch (Exception ex) {
log.warn(ex.getMessage(), ex);
return "error";
}
} catch (Exception e) {
log.warn(e.getMessage(), e);
return "error";
}
}
private String composeTicketUrl(Ticket ticket) {
HttpServletRequest request = this.getThreadLocalRequest();
String urlPrefix = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ request.getContextPath();
String address = urlPrefix + "/download-ticket?ticketId=" + ticket.getTicketId();
return address;
}
private void storeTicket(Ticket ticket, History transaction) {
// Store the ticket
TicketDAO ticketDao = (TicketDAO) Context.getInstance().getBean(TicketDAO.class);
ticketDao.store(ticket, transaction);
// Try to clean the DB from old tickets
ticketDao.deleteExpired();
}
private Ticket prepareTicket(long docId, User user) {
String temp = new Date().toString() + user.getId();
String ticketid = CryptUtil.cryptString(temp);
Ticket ticket = new Ticket();
ticket.setTicketId(ticketid);
ticket.setDocId(docId);
ticket.setUserId(user.getId());
return ticket;
}
private String createPreview(Document doc, long userId, String sid) {
Storer storer = (Storer) Context.getInstance().getBean(Storer.class);
String thumbResource = storer.getResourceName(doc, doc.getFileVersion(), "thumb.jpg");
// In any case try to produce the thumbnail
if (!storer.exists(doc.getId(), thumbResource)) {
ThumbnailManager thumbManager = (ThumbnailManager) Context.getInstance().getBean(ThumbnailManager.class);
try {
thumbManager.createTumbnail(doc, doc.getFileVersion(), sid);
} catch (Throwable t) {
log.error(t.getMessage(), t);
}
}
if (storer.exists(doc.getId(), thumbResource)) {
File file = UserUtil.getUserResource(userId, "/tmp/thumb.jpg");
file.getParentFile().mkdirs();
storer.writeToFile(doc.getId(), thumbResource, file);
try {
return file.toURI().toURL().toString();
} catch (MalformedURLException e) {
}
}
return null;
}
private void createAttachment(EMail email, long docId, boolean pdfConversion, String sid) throws IOException {
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
Storer storer = (Storer) Context.getInstance().getBean(Storer.class);
Document doc = docDao.findById(docId);
String resource = storer.getResourceName(doc, null, null);
boolean convertToPdf = pdfConversion;
if (doc.getDocRef() != null) {
// this is an alias
if ("pdf".equals(doc.getDocRefType())) {
doc = docDao.findById(doc.getDocRef());
convertToPdf = true;
}
}
EMailAttachment att = new EMailAttachment();
att.setIcon(doc.getIcon());
att.setFileName(doc.getFileName());
String extension = doc.getFileExtension();
att.setMimeType(MimeType.get(extension));
if (convertToPdf) {
if (!"pdf".equals(FilenameUtils.getExtension(doc.getFileName().toLowerCase()))) {
PdfConverterManager manager = (PdfConverterManager) Context.getInstance().getBean(
PdfConverterManager.class);
manager.createPdf(doc, sid);
resource = storer.getResourceName(doc, null, "conversion.pdf");
}
att.setMimeType(MimeType.get("pdf"));
att.setFileName(FilenameUtils.getBaseName(doc.getFileName()) + ".pdf");
}
att.setData(storer.getBytes(doc.getId(), resource));
if (att != null) {
email.addAttachment(2 + email.getAttachments().size(), att);
}
}
private void createAttachment(EMail email, File zipFile) throws IOException {
EMailAttachment att = new EMailAttachment();
att.setData(FileUtil.toByteArray(zipFile));
att.setFileName("doc.zip");
String extension = "zip";
att.setMimeType(MimeType.get(extension));
if (att != null) {
email.addAttachment(2 + email.getAttachments().size(), att);
}
}
@Override
public void unlock(String sid, long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(ServiceUtil.getSessionUser(sid));
// Unlock the document; throws an exception if something
// goes wrong
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
for (long id : docIds) {
documentManager.unlock(id, transaction);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void updateBookmark(String sid, GUIBookmark bookmark) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
BookmarkDAO bookmarkDao = (BookmarkDAO) Context.getInstance().getBean(BookmarkDAO.class);
try {
Bookmark bk;
if (bookmark.getId() != 0) {
bk = bookmarkDao.findById(bookmark.getId());
bookmarkDao.initialize(bk);
} else
return;
bk.setTitle(bookmark.getName());
bk.setDescription(bookmark.getDescription());
bookmarkDao.store(bk);
bookmark.setId(bk.getId());
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void updateLink(String sid, long id, String type) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentLinkDAO dao = (DocumentLinkDAO) Context.getInstance().getBean(DocumentLinkDAO.class);
DocumentLink link = dao.findById(id);
dao.initialize(link);
link.setType(type);
dao.store(link);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void cleanUploadedFileFolder(String sid) throws ServerException {
ServiceUtil.validateSession(sid);
UploadServlet.cleanReceivedFiles(sid);
}
@Override
public GUIRating getRating(String sid, long docId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
RatingDAO ratingDao = (RatingDAO) Context.getInstance().getBean(RatingDAO.class);
try {
GUIRating rating = new GUIRating();
Rating rat = ratingDao.findVotesByDocId(docId);
if (rat != null) {
ratingDao.initialize(rat);
rating.setId(rat.getId());
rating.setDocId(docId);
// We use the rating userId value to know in the GUI if the user
// has already vote this document.
if (ratingDao.findByDocIdAndUserId(docId, session.getUserId()))
rating.setUserId(session.getUserId());
rating.setCount(rat.getCount());
rating.setAverage(rat.getAverage());
} else {
rating.setDocId(docId);
rating.setCount(0);
rating.setAverage(0F);
}
return rating;
} catch (Throwable t) {
return (GUIRating) ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public int saveRating(String sid, GUIRating rating) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
RatingDAO ratingDao = (RatingDAO) Context.getInstance().getBean(RatingDAO.class);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
try {
Rating rat = new Rating();
rat.setTenantId(session.getTenantId());
rat.setDocId(rating.getDocId());
rat.setUserId(rating.getUserId());
rat.setVote(rating.getVote());
ratingDao.store(rat);
Rating votesDoc = ratingDao.findVotesByDocId(rating.getDocId());
Document doc = docDao.findById(rating.getDocId());
docDao.initialize(doc);
int average = 0;
if (votesDoc != null && votesDoc.getAverage() != null)
average = votesDoc.getAverage().intValue();
doc.setRating(average);
docDao.store(doc);
return average;
} catch (Throwable t) {
return (Integer) ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public long addNote(String sid, long docId, String message) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User sessionUser = ServiceUtil.getSessionUser(sid);
DocumentNote note = new DocumentNote();
note.setTenantId(session.getTenantId());
note.setDocId(docId);
note.setUserId(sessionUser.getId());
note.setUsername(sessionUser.getFullName());
note.setDate(new Date());
note.setMessage(message);
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(sessionUser);
DocumentNoteDAO dao = (DocumentNoteDAO) Context.getInstance().getBean(DocumentNoteDAO.class);
dao.store(note, transaction);
return note.getId();
} catch (Throwable t) {
return (Integer) ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void deleteNotes(String sid, long[] ids) throws ServerException {
ServiceUtil.validateSession(sid);
DocumentNoteDAO dao = (DocumentNoteDAO) Context.getInstance().getBean(DocumentNoteDAO.class);
for (long id : ids)
dao.delete(id);
}
@Override
public void bulkUpdate(String sid, long[] ids, GUIDocument vo) throws ServerException {
for (long id : ids) {
try {
GUIDocument buf = getById(sid, id);
if (buf.getImmutable() == 1 || buf.getStatus() != Document.DOC_UNLOCKED)
continue;
buf.setComment(vo.getComment() != null ? vo.getComment() : "");
if (StringUtils.isNotEmpty(vo.getLanguage()))
buf.setLanguage(vo.getLanguage());
if (vo.getTags() != null && vo.getTags().length > 0)
buf.setTags(vo.getTags());
if (StringUtils.isNotEmpty(vo.getCoverage()))
buf.setCoverage(vo.getCoverage());
if (StringUtils.isNotEmpty(vo.getObject()))
buf.setObject(vo.getObject());
if (StringUtils.isNotEmpty(vo.getRecipient()))
buf.setRecipient(vo.getRecipient());
if (StringUtils.isNotEmpty(vo.getSource()))
buf.setSource(vo.getSource());
if (StringUtils.isNotEmpty(vo.getSourceAuthor()))
buf.setSourceAuthor(vo.getSourceAuthor());
if (StringUtils.isNotEmpty(vo.getSourceId()))
buf.setSourceId(vo.getSourceId());
if (StringUtils.isNotEmpty(vo.getSourceType()))
buf.setSourceType(vo.getSourceType());
if (vo.getTemplateId() != null)
buf.setTemplateId(vo.getTemplateId());
if (vo.getAttributes() != null && vo.getAttributes().length > 0)
buf.setAttributes(vo.getAttributes());
if (vo.getSourceDate() != null)
buf.setSourceDate(vo.getSourceDate());
if (StringUtils.isNotEmpty(vo.getWorkflowStatus()))
buf.setSource(vo.getWorkflowStatus());
if (vo.getPublished() > -1)
buf.setPublished(vo.getPublished());
if (vo.getStartPublishing() != null)
buf.setStartPublishing(vo.getStartPublishing());
if (vo.getStopPublishing() != null)
buf.setStopPublishing(vo.getStopPublishing());
save(sid, buf);
} catch (Throwable e) {
log.error(e.getMessage(), e);
}
}
}
protected void checkPublished(User user, Document doc) throws Exception {
if (!user.isInGroup("admin") && !user.isInGroup("publisher") && !doc.isPublishing())
throw new FileNotFoundException("Document not published");
}
@Override
public void updateNote(String sid, long docId, long noteId, String message) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User user = ServiceUtil.getSessionUser(session.getId());
DocumentNoteDAO dao = (DocumentNoteDAO) Context.getInstance().getBean(DocumentNoteDAO.class);
DocumentNote note = dao.findById(noteId);
note.setUserId(user.getId());
note.setUsername(user.getFullName());
note.setMessage(message);
dao.store(note);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public GUIDocument deleteVersions(String sid, long[] ids) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User user = ServiceUtil.getSessionUser(session.getId());
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
for (long id : ids) {
History transaction = new History();
transaction.setUser(user);
Version version = manager.deleteVersion(id, transaction);
return getById(sid, version.getDocId());
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
return null;
}
@Override
public GUIDocument createEmpty(String sid, GUIDocument vo) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User user = ServiceUtil.getSessionUser(session.getId());
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (!fdao.isWriteEnabled(vo.getFolder().getId(), session.getUserId())) {
throw new RuntimeException("The user doesn't have the write permission on the current folder");
}
Document doc = toDocument(vo);
doc.setId(0L);
History transaction = new History();
transaction.setUser(user);
transaction.setEvent(DocumentEvent.STORED.toString());
Document document = documentManager.create(IOUtils.toInputStream(""), doc, transaction);
// If that VO is in checkout, perform a checkout also
if (vo.getStatus() == Document.DOC_CHECKED_OUT) {
transaction = new History();
transaction.setUser(user);
documentManager.checkout(document.getId(), transaction);
}
return fromDocument(document, vo.getFolder());
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
return null;
}
@Override
public void deleteFromTrash(String sid, Long[] ids) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
if (ids == null || ids.length < 1)
return;
try {
String idsStr = Arrays.asList(ids).toString().replace('[', '(').replace(']', ')');
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
dao.bulkUpdate("set ld_deleted=2 where ld_id in " + idsStr, null);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void emptyTrash(String sid) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
dao.bulkUpdate("set ld_deleted=2 where ld_deleted=1 and ld_deleteuserid=" + session.getUserId(), null);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
fdao.bulkUpdate("set ld_deleted=2 where ld_deleted=1 and ld_deleteuserid=" + session.getUserId(), null);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void archiveDocuments(String sid, long[] docIds, String comment) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(comment);
manager.archiveDocuments(docIds, transaction);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public long archiveFolder(String sid, long folderId, String comment) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(comment);
return manager.archiveFolder(folderId, transaction);
} catch (Throwable t) {
return (Long) ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void unarchiveDocuments(String sid, long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
User user = ServiceUtil.getSessionUser(sid);
for (long id : docIds) {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(user);
dao.unarchive(id, transaction);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public long countDocuments(String sid, long[] folderIds, int status) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
User user = ServiceUtil.getSessionUser(sid);
long count = 0;
try {
for (int i = 0; i < folderIds.length; i++) {
count += countDocuments(sid, user, folderIds[i], status);
}
} catch (Throwable t) {
return (Long) ServiceUtil.throwServerException(session, log, t);
}
return count;
}
private long countDocuments(String sid, User user, long folderId, int status) throws ServerException {
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
List<Long> childrenFolderIds = fdao.findIdsByParentId(folderId);
childrenFolderIds.add(folderId);
StringBuffer query = new StringBuffer("select count(ld_id) from ld_document where ld_deleted=0 and ld_status="
+ status);
query.append(" and ld_folderid in " + childrenFolderIds.toString().replace("[", "(").replace("]", ")"));
return dao.queryForLong(query.toString());
}
@Override
public String createDownloadTicket(String sid, long docId, String suffix, Integer expireHours, Date expireDate)
throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User user = ServiceUtil.getSessionUser(session.getId());
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (!fdao.isWriteEnabled(getById(sid, docId).getFolder().getId(), user.getId())) {
throw new RuntimeException("You don't have the download permission");
}
Ticket ticket = prepareTicket(docId, ServiceUtil.getSessionUser(sid));
ticket.setSuffix(suffix);
Calendar cal = GregorianCalendar.getInstance();
if (expireDate != null) {
cal.setTime(expireDate);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
cal.set(Calendar.MILLISECOND, 999);
ticket.setExpired(cal.getTime());
} else if (expireHours != null) {
cal.add(Calendar.HOUR_OF_DAY, expireHours.intValue());
ticket.setExpired(cal.getTime());
}
History transaction = new History();
transaction.setSessionId(session.getId());
transaction.setUser(user);
storeTicket(ticket, transaction);
return composeTicketUrl(ticket);
} catch (Throwable t) {
return (String) ServiceUtil.throwServerException(session, log, t);
}
}
}
|
[
"car031@bae09422-6297-422f-b3ee-419521344c47"
] |
car031@bae09422-6297-422f-b3ee-419521344c47
|
03be3a719f76680d7fcbb97d9c470136a820a65c
|
9dfb07095844525a9d1b5a3e5de3cb840486c12b
|
/MinecraftServer/src/net/minecraft/network/play/server/SPacketUnloadChunk.java
|
e31021b2921160d1ff5a66fdc354535fc5051797
|
[] |
no_license
|
ilYYYa/ModdedMinecraftServer
|
0ae1870e6ba9d388afb8fd6e866ca6a62f96a628
|
7b8143a11f848bf6411917e3d9c60b0289234a3f
|
refs/heads/master
| 2020-12-24T20:10:30.533606
| 2017-04-03T15:32:15
| 2017-04-03T15:32:15
| 86,241,373
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,146
|
java
|
package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
public class SPacketUnloadChunk implements Packet<INetHandlerPlayClient>
{
private int x;
private int z;
public SPacketUnloadChunk()
{
}
public SPacketUnloadChunk(int xIn, int zIn)
{
this.x = xIn;
this.z = zIn;
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.x = buf.readInt();
this.z = buf.readInt();
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeInt(this.x);
buf.writeInt(this.z);
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient handler)
{
handler.processChunkUnload(this);
}
}
|
[
"ilyyya.777@gmail.com"
] |
ilyyya.777@gmail.com
|
52b6bcf17e1adf9327066a334da065e014c06842
|
d31bd08e2a54249b41df4245b9719e08e2df6be0
|
/src/com/moayad/oop/interface_example/CreditCard.java
|
76a8189ec798be7fe3eb4309df74409c0fbe8093
|
[] |
no_license
|
Moayadooh/Java
|
3a395a1ae185c483fdbc99b86810820c9c91b323
|
45e40307af5054fe32e5ea11c6c4d8e754f33686
|
refs/heads/master
| 2023-05-05T09:12:50.551488
| 2021-05-26T10:54:43
| 2021-05-26T10:54:43
| 286,448,215
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 383
|
java
|
package com.moayad.oop.interface_example;
//Interface
//Object oriented design
public interface CreditCard {
int num = 0;
void Score(int age);
/*default void Score(int age) {
//Implementation
}*/
}
class MasterCard implements CreditCard {
@Override
public void Score(int age) {
if(age>40)
System.out.println("Negative");
else
System.out.println("Positive");
}
}
|
[
"49630526+Moayadooh@users.noreply.github.com"
] |
49630526+Moayadooh@users.noreply.github.com
|
38ef01e577d09039bde7f2776f549824ca9c8a49
|
c992cc664787167313fb4d317f172e8b057b1f5b
|
/modules/ui-widgets/src/main/java/io/jmix/ui/widgets/client/Tools.java
|
8badee91c4c583d8e66bca24d3617c89cbb81c72
|
[
"Apache-2.0"
] |
permissive
|
alexbudarov/jmix
|
42628ce00a2a67bac7f4113a7e642d5a67c38197
|
23272dc3d6cb1f1a9826edbe888b3c993ab22d85
|
refs/heads/master
| 2020-12-19T15:57:38.886284
| 2020-01-23T10:06:16
| 2020-01-23T10:06:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 12,058
|
java
|
/*
* Copyright (c) 2008-2016 Haulmont.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package io.jmix.ui.widgets.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.Widget;
import io.jmix.ui.widgets.client.jqueryfileupload.CubaFileUploadWidget;
import io.jmix.ui.widgets.client.sys.ToolsImpl;
import com.vaadin.client.BrowserInfo;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.ui.VButton;
import com.vaadin.client.ui.VOverlay;
import com.vaadin.client.ui.VUpload;
import com.vaadin.client.ui.VVerticalLayout;
import com.vaadin.client.ui.orderedlayout.Slot;
import com.vaadin.client.ui.orderedlayout.VAbstractOrderedLayout;
public class Tools {
public static final String SELECTED_ITEM_STYLE = "c-cm-button-selected";
public static final String CUBA_CONTEXT_MENU_CONTAINER = "c-cm-container";
private static ToolsImpl impl;
static {
impl = GWT.create(ToolsImpl.class);
}
public static void textSelectionEnable(Element el, boolean b) {
impl.textSelectionEnable(el, b);
}
public static void replaceClassNames(Element element, String from, String to) {
String className = element.getClassName();
String newClassName = "";
String[] classNames = className.split(" ");
for (String classNamePart : classNames) {
if (classNamePart.startsWith(from + "-")) {
classNamePart = classNamePart.replace(from + "-", to + "-");
} else if (classNamePart.equals(from)) {
classNamePart = to;
}
newClassName = newClassName + " " + classNamePart;
}
element.setClassName(newClassName.trim());
}
public static VOverlay createCubaTablePopup(boolean autoClose) {
VOverlay tableCustomPopup = autoClose ? createTableContextMenu() : new VOverlay();
tableCustomPopup.setStyleName("c-table-popup");
return tableCustomPopup;
}
public static VOverlay createCubaTableContextMenu() {
VOverlay tableContextMenu = createTableContextMenu();
tableContextMenu.setStyleName("c-context-menu");
return tableContextMenu;
}
protected static VOverlay createTableContextMenu() {
return new TableOverlay();
}
public static boolean isLayoutChild(VAbstractOrderedLayout layout, Widget child) {
for (Widget widget : layout) {
Slot slot = (Slot) widget;
Widget slotWidget = slot.getWidget();
if (slotWidget.equals(child)) {
return true;
}
}
return false;
}
public static void focusSelectedItem(Widget parentWidget, Widget target) {
resetItemSelection(parentWidget);
target.addStyleName(SELECTED_ITEM_STYLE);
}
public static void resetItemSelection(Widget popup) {
if (popup instanceof VAbstractOrderedLayout) {
VAbstractOrderedLayout content = (VAbstractOrderedLayout) popup;
if (content.getStyleName().contains(CUBA_CONTEXT_MENU_CONTAINER)) {
for (Widget slot : content) {
VButton button = (VButton) ((Slot) slot).getWidget();
if (button != null && button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
button.removeStyleName(SELECTED_ITEM_STYLE);
}
}
}
}
}
public static void showPopup(VOverlay overlay, int left, int top) {
overlay.setAutoHideEnabled(true);
overlay.setVisible(false);
overlay.show();
Widget widget = overlay.getWidget();
if (widget instanceof VVerticalLayout) {
resetItemSelection(widget);
VVerticalLayout verticalLayout = (VVerticalLayout) widget;
if (verticalLayout.getStyleName().contains(CUBA_CONTEXT_MENU_CONTAINER)) {
int widgetCount = verticalLayout.getWidgetCount();
if (widgetCount > 1) {
Widget verticalSlot = verticalLayout.getWidget(0);
Widget buttonWidget = ((Slot) verticalSlot).getWidget();
buttonWidget.addStyleName(SELECTED_ITEM_STYLE);
if (buttonWidget instanceof FocusWidget) {
((FocusWidget) buttonWidget).setFocus(true);
}
}
}
}
// mac FF gets bad width due GWT popups overflow hacks,
// re-determine width
int offsetWidth = overlay.getOffsetWidth();
int offsetHeight = overlay.getOffsetHeight();
if (offsetWidth + left > Window.getClientWidth()) {
left = left - offsetWidth;
if (left < 0) {
left = 0;
}
}
if (offsetHeight + top > Window.getClientHeight()) {
top = top - offsetHeight;
if (top < 0) {
top = 0;
}
}
overlay.setPopupPosition(left, top);
overlay.setVisible(true);
}
public static boolean isAnyModifierKeyPressed(Event event) {
return (event.getShiftKey()
|| event.getAltKey()
|| event.getCtrlKey()
|| event.getMetaKey());
}
public static Element findCurrentOrParentTd(Element target) {
if (target == null) {
return null;
}
// Iterate upwards until we find the TR element
Element element = target;
while (element != null
&& !"td".equalsIgnoreCase(element.getTagName())) {
element = element.getParentElement();
}
return element;
}
public static Widget findPrevWidget(FlowPanel layout, int widgetIndex) {
for (int i = widgetIndex - 1; i >= 0; i--) {
Widget widget = layout.getWidget(i);
if (widget instanceof Slot) {
widget = ((Slot) widget).getWidget();
}
if (isSuitableWidget(widget)) {
return widget;
}
}
// try to find button from last
for (int i = layout.getWidgetCount() - 1; i > widgetIndex; i--) {
Widget widget = layout.getWidget(i);
if (widget instanceof Slot) {
widget = ((Slot) widget).getWidget();
}
if (isSuitableWidget(widget)) {
return widget;
}
}
return null;
}
public static Widget findNextWidget(FlowPanel layout, int widgetIndex) {
for (int i = widgetIndex + 1; i < layout.getWidgetCount(); i++) {
Widget widget = layout.getWidget(i);
if (widget instanceof Slot) {
widget = ((Slot) widget).getWidget();
}
if (isSuitableWidget(widget)) {
return widget;
}
}
// try to find button from first
for (int i = 0; i < widgetIndex; i++) {
Widget widget = layout.getWidget(i);
if (widget instanceof Slot) {
widget = ((Slot) widget).getWidget();
}
if (isSuitableWidget(widget)) {
return widget;
}
}
return null;
}
public static boolean isSuitableWidget(Widget slotWidget) {
if (slotWidget instanceof VButton) {
VButton button = (VButton) slotWidget;
if (button.isEnabled()) {
return true;
}
} else if (slotWidget instanceof CubaFileUploadWidget) {
return true;
} else if (slotWidget instanceof VUpload) {
return true;
}
return false;
}
// CAUTION Do not use multiselect mode SIMPLE for touch devices, it may be laptop with touch screen
public static boolean isUseSimpleMultiselectForTouchDevice() {
return BrowserInfo.get().isAndroid()
|| BrowserInfo.get().isIOS();
}
public static class TableOverlay extends VOverlay {
@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
super.onPreviewNativeEvent(event);
NativeEvent nativeEvent = event.getNativeEvent();
Element target = Element.as(nativeEvent.getEventTarget());
if (Event.ONCLICK == event.getTypeInt()) {
if (getElement().isOrHasChild(target)) {
Scheduler.get().scheduleDeferred(this::hide);
}
}
previewTableContextMenuEvent(event);
}
protected void previewTableContextMenuEvent(Event.NativePreviewEvent event) {
NativeEvent nativeEvent = event.getNativeEvent();
Element target = Element.as(nativeEvent.getEventTarget());
if (Event.ONKEYDOWN == event.getTypeInt()) {
int keyCode = event.getNativeEvent().getKeyCode();
if (KeyCodes.KEY_ESCAPE == keyCode) {
event.cancel();
event.getNativeEvent().stopPropagation();
event.getNativeEvent().preventDefault();
hide();
} else {
VAbstractOrderedLayout verticalLayout = ((VAbstractOrderedLayout) getWidget());
Widget widget = WidgetUtil.findWidget(target, null);
if (isLayoutChild(verticalLayout, widget)) {
Widget widgetParent = widget.getParent();
VAbstractOrderedLayout layout = (VAbstractOrderedLayout) widgetParent.getParent();
Widget focusWidget = null;
int widgetIndex = layout.getWidgetIndex(widgetParent);
if (keyCode == KeyCodes.KEY_DOWN) {
focusWidget = Tools.findNextWidget(layout, widgetIndex);
} else if (keyCode == KeyCodes.KEY_UP) {
focusWidget = Tools.findPrevWidget(layout, widgetIndex);
}
if (focusWidget instanceof VButton) {
VButton button = (VButton) focusWidget;
focusSelectedItem(widgetParent.getParent(), button);
button.setFocus(true);
}
}
}
} else if (Event.ONMOUSEOVER == event.getTypeInt()) {
VAbstractOrderedLayout verticalLayout = ((VAbstractOrderedLayout) getWidget());
Widget widget = WidgetUtil.findWidget(target, null);
if (isLayoutChild(verticalLayout, widget)) {
if (widget instanceof VButton) {
VButton button = (VButton) widget;
Widget widgetParent = button.getParent();
if (!button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
focusSelectedItem(widgetParent.getParent(), button);
button.setFocus(true);
}
}
}
}
}
}
}
|
[
"minaev@haulmont.com"
] |
minaev@haulmont.com
|
fa5e41b3ad680f4ca1cff38102265ccaa70c33f7
|
3ac4ee50b0f871e0da47c9b9aa982c0231aa0470
|
/spring-application-core/src/test/java/com/custodio/spring/application/core/service/CsvFileServiceTest.java
|
7cff4ab2ac88ce9cc57e5ccdec9a60a7372bdbb4
|
[] |
no_license
|
williampedrini/spring-application
|
3c8f368d6ebbd2d94be58e3d66f439df6b605c35
|
8b91a7a987e52360ff45f1222181e795c28627cc
|
refs/heads/master
| 2020-05-21T13:09:30.630225
| 2019-05-10T22:47:47
| 2019-05-10T22:47:47
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,349
|
java
|
package com.custodio.spring.application.core.service;
import com.custodio.spring.application.core.bean.AirportCsvBean;
import com.custodio.spring.application.core.configuration.root.BaseTestRunner;
import org.hamcrest.core.StringContains;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* Class responsible for executing unit tests for {@link CsvFileService}.
*
* @author wcustodio.
*/
public class CsvFileServiceTest extends BaseTestRunner {
/**
* Expected results used by the unit tests.
*/
private static final int EXPECTED_AIRPORTS = 46505;
private static final String EXPECTED_ERROR_MESSAGE_FILE_WITHOUT_MAPPED_HEADER_FIELD = "Unrecognized field \"line_number\"";
private static final String EXPECTED_ERROR_MESSAGE_FILE_WITHOUT_HEADER = "Unrecognized field \"6523\"";
/**
* Files used by the unit tests.
*/
private static final String VALID_FILE = "/csv/valid_file.csv";
private static final String FILE_WITHOUT_HEADER = "/csv/file_without_header.csv";
private static final String FILE_WITHOUT_CONTENT = "/csv/file_without_content.csv";
private static final String FILE_WITHOUT_MAPPED_HEADER_FIELD = "/csv/file_without_mapped_header_field.csv";
@Autowired
private CsvFileService csvFileService;
@Rule
public ExpectedException expected = ExpectedException.none();
@Test
public void readValidFile() {
try {
final List<AirportCsvBean> beans = csvFileService.read(AirportCsvBean.class, new File(this.getClass().getResource(VALID_FILE).getPath()));
Assert.assertNotNull(beans);
Assert.assertFalse(beans.isEmpty());
Assert.assertEquals(EXPECTED_AIRPORTS, beans.size());
for (final AirportCsvBean bean : beans) {
Assert.assertNotNull(bean.getId());
}
} catch (final IOException ioException) {
Assert.fail(ioException.getMessage());
}
}
@Test
public void readFileWithoutHeader() throws IOException {
expected.expect(IOException.class);
expected.expectMessage(StringContains.containsString(EXPECTED_ERROR_MESSAGE_FILE_WITHOUT_HEADER));
csvFileService.read(AirportCsvBean.class, new File(this.getClass().getResource(FILE_WITHOUT_HEADER).getPath()));
}
@Test
public void readFileWithoutContent() throws IOException {
try {
final List<AirportCsvBean> beans = csvFileService.read(AirportCsvBean.class, new File(this.getClass().getResource(FILE_WITHOUT_CONTENT).getPath()));
Assert.assertNotNull(beans);
Assert.assertTrue(beans.isEmpty());
} catch (final IOException ioException) {
Assert.fail(ioException.getMessage());
}
}
@Test
public void readFileWithoutMappedHeaderField() throws IOException {
expected.expect(IOException.class);
expected.expectMessage(StringContains.containsString(EXPECTED_ERROR_MESSAGE_FILE_WITHOUT_MAPPED_HEADER_FIELD));
csvFileService.read(AirportCsvBean.class, new File(this.getClass().getResource(FILE_WITHOUT_MAPPED_HEADER_FIELD).getPath()));
}
}
|
[
"william.custodio@sap.com"
] |
william.custodio@sap.com
|
1378a5790c92b17e85968acb3c1fa48d34abc424
|
6fbe208c51bd5779ff0f185599e807684cf2c13c
|
/src/main/java/com/plasticon/erp/service/ManagePaymentGateWayService.java
|
4baac09820ec7be75a4651e86dc7aeca6e6f4e97
|
[] |
no_license
|
saishanker41/erpProject
|
5e405e4f27b6af99b343ab34a9ac8b2a0589d907
|
23423248384fa9f4c82a70d9132e4df53a54ca71
|
refs/heads/master
| 2023-06-09T07:20:41.658421
| 2021-06-16T07:02:40
| 2021-06-16T07:02:40
| 377,395,357
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 848
|
java
|
package com.plasticon.erp.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.plasticon.erp.model.ManagePaymentGateWay;
import com.plasticon.erp.repository.ManagePaymentGateWayRepository;
@Service
public class ManagePaymentGateWayService {
@Autowired
ManagePaymentGateWayRepository managePaymentGateWayRepository;
public List<ManagePaymentGateWay> getManagePaymentGateWayDetails(){
return managePaymentGateWayRepository.findAll();
}
public void saveManagePaymentGateWayDetails(ManagePaymentGateWay managePaymentGateWay) {
managePaymentGateWayRepository.save(managePaymentGateWay);
}
public void deleteManagePaymentGateWayDetails(int managePaymentGateWayId) {
managePaymentGateWayRepository.deleteById(managePaymentGateWayId);
}
}
|
[
"saishanker41@gmail.com"
] |
saishanker41@gmail.com
|
b16ffe918af0317f619b67a9388c69278b6c75d5
|
b2bfac7b91b2542228931c10c668ca2f67e86b51
|
/fba/app/src/main/java/com/ppu/fba/ui/dy.java
|
79e21470938225998d695b9ccf0625d92c48f08f
|
[] |
no_license
|
abozanona/fbaAndroid
|
b58be90fc94ceec5170d84133c1e8c4e2be8806f
|
f058eb0317df3e76fd283e285c4dd3dbc354aef5
|
refs/heads/master
| 2021-09-26T22:05:31.517265
| 2018-11-03T07:21:17
| 2018-11-03T07:21:17
| 108,681,428
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 506
|
java
|
package com.ppu.fba.ui;
import com.ppu.fba.p009d.C0309f;
import java.util.Comparator;
public class dy implements Comparator {
final /* synthetic */ bg f1790a;
dy(bg bgVar) {
this.f1790a = bgVar;
}
public int m2130a(String str, String str2) {
return (str == null || str2 == null) ? -1 : C0309f.m1980c(str).compareTo(C0309f.m1980c(str2));
}
public /* synthetic */ int compare(Object obj, Object obj2) {
return m2130a((String) obj, (String) obj2);
}
}
|
[
"abozanona@gmail.com"
] |
abozanona@gmail.com
|
e716fc740e95eb0ccfc1dfbdaec36a05d1f16e49
|
74d4626d88eb55e320146c59f45a38597861c1c7
|
/Chapter 9 - Iterator and Composite Patterns/PancakeHouseMerge/src/IteratorWayImprovedMergedCafe/CafeMenu.java
|
953dcf0a7951a76e286ede4ae74b703b73b1bd00
|
[] |
no_license
|
ioanzicu/design-patterns-java
|
95a0d746e3c342a2bda2d5e6a5269009cab3584a
|
9acb70ca1e64039070f3bed6f352777176aa911a
|
refs/heads/main
| 2023-07-25T12:05:24.609472
| 2021-09-08T09:10:56
| 2021-09-08T09:10:56
| 404,259,865
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,050
|
java
|
package IteratorWayImprovedMergedCafe;
import java.util.Hashtable;
import java.util.Iterator;
public class CafeMenu implements Menu {
Hashtable<String, Object> menuItems = new Hashtable<>();
public CafeMenu() {
addItem("Veggie Pierogi",
"Veggie Pierogi with potatos and tomatoes",
true,
3.99);
addItem("Soup of the day",
"A cup of the soup of the day, with a side salad",
false,
3.69);
addItem("Burrito",
"A large burrito, with whole pinto beans, salsa, guacamole",
true,
4.29);
}
public void addItem(String name, String description,
boolean vegetarian, double price) {
MenuItem menuItem = new MenuItem(name, description, vegetarian, price);
menuItems.put(menuItem.getName(), menuItem);
}
@Override
public Iterator<Object> createIterator() {
return menuItems.values().iterator();
}
}
|
[
"ioan.zicu94@gmail.com"
] |
ioan.zicu94@gmail.com
|
95d76675ebd944407f32ff453cba6337e4b58a37
|
dab84f47bda8ec2588ac0acf1de0c79a47d55a29
|
/java/src/headfirst/iterator/dinermerger/DinerMenu.java
|
bbf96ed87bb29e80b1c771097de15f889f8b452d
|
[] |
no_license
|
RobinNunkesser/HeadFirstDesignPatterns
|
ecd1ebb970b6b67641df43fb259f8ee20c4b2f18
|
2b3d9c5d8c4d498cc5008991e4ac4796583f7492
|
refs/heads/master
| 2022-07-17T19:44:49.383898
| 2020-05-19T20:48:37
| 2020-05-19T20:48:37
| 263,099,648
| 2
| 0
| null | 2020-05-11T16:37:32
| 2020-05-11T16:37:32
| null |
UTF-8
|
Java
| false
| false
| 1,602
|
java
|
package headfirst.iterator.dinermerger;
public class DinerMenu implements Menu {
static final int MAX_ITEMS = 6;
int numberOfItems = 0;
MenuItem[] menuItems;
public DinerMenu() {
menuItems = new MenuItem[MAX_ITEMS];
addItem("Vegetarian BLT",
"(Fakin') Bacon with lettuce & tomato on whole wheat", true, 2.99);
addItem("BLT",
"Bacon with lettuce & tomato on whole wheat", false, 2.99);
addItem("Soup of the day",
"Soup of the day, with a side of potato salad", false, 3.29);
addItem("Hotdog",
"A hot dog, with saurkraut, relish, onions, topped with cheese",
false, 3.05);
addItem("Steamed Veggies and Brown Rice",
"Steamed vegetables over brown rice", true, 3.99);
addItem("Pasta",
"Spaghetti with Marinara Sauce, and a slice of sourdough bread",
true, 3.89);
}
public void addItem(String name, String description,
boolean vegetarian, double price)
{
MenuItem menuItem = new MenuItem(name, description, vegetarian, price);
if (numberOfItems >= MAX_ITEMS) {
System.err.println("Sorry, menu is full! Can't add item to menu");
} else {
menuItems[numberOfItems] = menuItem;
numberOfItems = numberOfItems + 1;
}
}
public MenuItem[] getMenuItems() {
return menuItems;
}
public Iterator createIterator() {
return new DinerMenuIterator(menuItems);
}
// other menu methods here
}
|
[
"daniel.buch@gmail.com"
] |
daniel.buch@gmail.com
|
6a31b29a1b5ce9ace651c555e7f9aab3e3d95895
|
9bc72ca5c7cb823b207ee250c0f0fa9c2426a510
|
/src/org/mybatis/page/MySQLServerDialect.java
|
fd24953268f6572ec42995b72317445b5440a3b6
|
[] |
no_license
|
fnet123/mybatispage
|
5fe8bb1525bbd86eb2d981a42a5d2985c24471d1
|
46a7d2a4be60cc4ad797ed36d94893590bb1e794
|
refs/heads/master
| 2021-01-18T10:14:11.813611
| 2014-05-21T02:29:29
| 2014-05-21T02:29:29
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 762
|
java
|
package org.mybatis.page;
public class MySQLServerDialect extends Dialect {
public boolean supportsLimitOffset() {
return true;
}
public boolean supportsLimit() {
return true;
}
static int getAfterSelectInsertPoint(String sql) {
int selectIndex = sql.toLowerCase().indexOf("select");
final int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct");
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
}
public String getLimitString(String sql, int offset, int limit) {
sql = sql.trim();
StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);
pagingSelect.append(sql);
pagingSelect.append(" limit " + offset + "," + limit);
return pagingSelect.toString();
}
}
|
[
"meiwenhui@ThinkPad-Edge-E431"
] |
meiwenhui@ThinkPad-Edge-E431
|
c0c7fdcd915d25aee919c142275cb148329976cf
|
cce0978d570fd5ba02f6278c6d17a9d7d066795a
|
/test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerNamespaceITest.java
|
acd8173cba2df34fa54742631eccb468aaaff387
|
[
"Apache-2.0"
] |
permissive
|
conquer/spring-ldap
|
07d06ee41c27d95d0783d7b86f3c3b4cd375d3b2
|
86da41fe3da72815e386a2797d27ccc125d5bb3b
|
refs/heads/master
| 2021-01-16T22:51:14.818159
| 2015-08-04T15:56:05
| 2015-08-04T15:56:05
| 40,586,791
| 1
| 0
| null | 2015-08-12T07:33:50
| 2015-08-12T07:33:50
| null |
UTF-8
|
Java
| false
| false
| 12,232
|
java
|
/*
* Copyright 2005-2013 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.ldap.itest.manager.hibernate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.ldap.NameNotFoundException;
import org.springframework.ldap.core.AttributesMapper;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.itest.AbstractLdapTemplateIntegrationTest;
import org.springframework.ldap.itest.transaction.compensating.manager.DummyException;
import org.springframework.ldap.itest.transaction.compensating.manager.hibernate.OrgPerson;
import org.springframework.ldap.itest.transaction.compensating.manager.hibernate.OrgPersonDao;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
/**
* Integration tests for {@link org.springframework.ldap.transaction.compensating.manager.ContextSourceAndHibernateTransactionManager}
* with namespace configuration.
*
* @author Hans Westerbeek
*/
@ContextConfiguration(locations = {"/conf/ldapAndHibernateTransactionNamespaceTestContext.xml"})
public class ContextSourceAndHibernateTransactionManagerNamespaceITest extends AbstractLdapTemplateIntegrationTest {
private static Logger log = LoggerFactory.getLogger(ContextSourceAndHibernateTransactionManagerNamespaceITest.class);
@Autowired
@Qualifier("dummyDao")
private OrgPersonDao dummyDao;
@Autowired
private LdapTemplate ldapTemplate;
@Autowired
private HibernateTemplate hibernateTemplate;
@Autowired
private SessionFactory sessionFactory;
@Before
public void prepareTest() throws Exception {
if (TransactionSynchronizationManager.isSynchronizationActive()) {
TransactionSynchronizationManager.clearSynchronization();
}
OrgPerson person = new OrgPerson();
person.setId(new Integer(1));
person.setLastname("Person");
person.setFullname("Some Person");
person.setDescription("Sweden, Company1, Some Person");
person.setCountry("Sweden");
person.setCompany("Company1");
// "Some Person", "Person", "Sweden, Company1, Some Person"
// avoid the transaction manager we have configured, do it manually
Session session = this.sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.saveOrUpdate(person);
tx.commit();
session.close();
}
@After
public void cleanup() throws Exception {
// probably the wrong idea, this will use the thing i am trying to
// test..
Session session = this.sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Query query = session.createQuery("delete from OrgPerson");
query.executeUpdate();
tx.commit();
session.close();
}
@Test
public void testCreateWithException() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");
person.setCountry("Sweden");
person.setCompany("company1");
try {
dummyDao.createWithException(person);
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
log.debug("Verifying result");
// Verify that no entry was created in ldap or hibernate db
try {
ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
fail("NameNotFoundException expected");
}
catch (NameNotFoundException expected) {
assertTrue(true);
}
List result = hibernateTemplate.findByNamedParam("from OrgPerson person where person.lastname = :lastname",
"lastname", person.getLastname());
assertTrue(result.size() == 0);
}
@Test
public void testCreate() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");
person.setCountry("Sweden");
person.setCompany("company1");
// dummyDao.create("Sweden", "company1", "some testperson",
// "testperson", "some description");
this.dummyDao.create(person);
person = null;
log.debug("Verifying result");
Object ldapResult = ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2));
assertNotNull(ldapResult);
assertNotNull(fromDb);
}
@Test
public void testUpdateWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
originalPerson.setLastname("fooo");
try {
dummyDao.updateWithException(originalPerson);
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
log.debug("Verifying result");
Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertNotNull("Person", attributes.get("sn").get());
assertEquals("Sweden, Company1, Some Person", attributes.get("description").get());
return new Object();
}
});
OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
assertEquals("Person", notUpdatedPerson.getLastname());
assertEquals("Sweden, Company1, Some Person", notUpdatedPerson.getDescription());
assertNotNull(ldapResult);
// no need to assert if notUpdatedPerson exists
}
@Test
public void testUpdate() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
person.setLastname("Updated Person");
person.setDescription("Updated description");
dummyDao.update(person);
log.debug("Verifying result");
Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Updated Person", attributes.get("sn").get());
assertEquals("Updated description", attributes.get("description").get());
return new Object();
}
});
OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
assertEquals("Updated Person", updatedPerson.getLastname());
assertEquals("Updated description", updatedPerson.getDescription());
assertNotNull(ldapResult);
}
@Test
public void testUpdateAndRenameWithException() {
String dn = "cn=Some Person2,ou=company1,ou=Sweden";
String newDn = "cn=Some Person2,ou=company2,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
person.setLastname("Updated Person");
person.setDescription("Updated description");
try {
// Perform test
dummyDao.updateAndRenameWithException(dn, newDn, "Updated description");
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
// Verify that entry was not moved.
try {
ldapTemplate.lookup(newDn);
fail("NameNotFoundException expected");
}
catch (NameNotFoundException expected) {
assertTrue(true);
}
// Verify that original entry was not updated.
Object object = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Sweden, Company1, Some Person2", attributes.get("description").get());
return new Object();
}
});
assertNotNull(object);
}
@Test
public void testUpdateAndRename() {
String dn = "cn=Some Person2,ou=company1,ou=Sweden";
String newDn = "cn=Some Person2,ou=company2,ou=Sweden";
// Perform test
dummyDao.updateAndRename(dn, newDn, "Updated description");
// Verify that entry was moved and updated.
Object object = ldapTemplate.lookup(newDn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Updated description", attributes.get("description").get());
return new Object();
}
});
assertNotNull(object);
}
@Test
public void testModifyAttributesWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
try {
// Perform test
dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description");
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
// Verify result - check that the operation was properly rolled back
Object result = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Person", attributes.get("sn").get());
assertEquals("Sweden, Company1, Some Person", attributes.get("description").get());
return new Object();
}
});
assertNotNull(result);
}
@Test
public void testModifyAttributes() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
// Perform test
dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description");
// Verify result - check that the operation was not rolled back
Object result = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Updated lastname", attributes.get("sn").get());
assertEquals("Updated description", attributes.get("description").get());
return new Object();
}
});
assertNotNull(result);
}
@Test
public void testUnbindWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
try {
// Perform test
dummyDao.unbindWithException(person);
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
person = null;
// Verify result - check that the operation was properly rolled back
Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
// Just verify that the entry still exists.
return new Object();
}
});
person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); // will
// throw
// exception
// of
// person
// does
// not
// exist
assertNotNull(ldapResult);
}
@Test
public void testUnbind() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
// Perform test
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
dummyDao.unbind(person);
try {
// Verify result - check that the operation was not rolled back
ldapTemplate.lookup(dn);
fail("NameNotFoundException expected");
}
catch (NameNotFoundException expected) {
assertTrue(true);
}
person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1));
assertNull(person);
}
}
|
[
"mattias@261consulting.com"
] |
mattias@261consulting.com
|
d5ccedd7163a3df6a2d0c8db392757f33281f5f2
|
4398b91a930c1a998583b9fa666242fc1eaf7594
|
/A2_Queues/RandomizedQueue.java
|
4ea961ff9f57658f590c36bbe7351a8fa1db1e50
|
[
"MIT"
] |
permissive
|
zhiqiyu/Algorithms_P1_Coursera
|
4d5b81fa4892512a275b56798cdafd37645df76e
|
42dd3c9352c69601a34dc22ae7f38f4cb6193ef5
|
refs/heads/master
| 2020-06-09T08:13:08.936312
| 2019-07-15T14:50:01
| 2019-07-15T14:50:01
| 193,407,604
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,366
|
java
|
import java.util.Iterator;
import edu.princeton.cs.algs4.StdRandom;
public class RandomizedQueue<Item> implements Iterable<Item> {
private Item[] arr;
private int n;
// construct an empty randomized queue
public RandomizedQueue() {
arr = (Item[]) new Object[2];
n = 0;
}
// is the randomized queue empty?
public boolean isEmpty() {
return n == 0;
}
private void resize(int capacity) {
Item[] new_arr = (Item[]) new Object[capacity];
for (int i = 0; i < n; i ++) {
new_arr[i] = arr[i]; // straighten warpped around array
}
arr = new_arr;
}
// return the number of items on the randomized queue
public int size() {
return n;
}
// add the item
public void enqueue(Item item) {
if (item == null) {
throw new IllegalArgumentException();
}
if (n == arr.length) {
resize(2*n);
}
arr[n++] = item;
}
// remove and return a random item
public Item dequeue() {
if (isEmpty()) {
throw new java.util.NoSuchElementException("Queue underflow");
}
int rand = StdRandom.uniform(n);
Item out = arr[rand];
if (rand == n-1) {
arr[rand] = null;
}
else {
Item tail = arr[n-1];
arr[n-1] = null;
arr[rand] = tail;
}
n--;
if (n <= arr.length/4.0 && n > 0) {
resize(n/2);
}
return out;
}
// return a random item (but do not remove it)
public Item sample() {
if (isEmpty()) {
throw new java.util.NoSuchElementException("Queue underflow");
}
int rand = StdRandom.uniform(n);
return arr[rand];
}
// return an independent iterator over items in random order
public Iterator<Item> iterator() {
return new RandomIterator();
}
private class RandomIterator implements Iterator<Item> {
private final int[] perm;
private int cur_ind = 0;
public RandomIterator() {
perm = StdRandom.permutation(n);
}
public boolean hasNext() {
return cur_ind < n;
}
public void remove() {
throw new UnsupportedOperationException();
}
public Item next() {
if (!hasNext()) {
throw new java.util.NoSuchElementException();
}
return arr[perm[cur_ind++]];
}
}
// unit testing (required)
public static void main(String[] args) {
RandomizedQueue<String> rq = new RandomizedQueue<>();
rq.enqueue("a");
rq.enqueue("b");
rq.enqueue("c");
rq.enqueue("d");
rq.enqueue("e");
System.out.println(rq.size());
for (String i : rq) {
System.out.print(i + " ");
}
System.out.println();
for (String i : rq) {
System.out.print(i + " ");
}
System.out.println();
System.out.println("first sample: " + rq.sample());
System.out.println("second sample: " + rq.sample());
rq.dequeue();
rq.dequeue();
System.out.println(rq.size());
for (String i : rq) {
System.out.print(i + " ");
}
}
}
|
[
"yzq1027@hotmail.com"
] |
yzq1027@hotmail.com
|
7dc9735427dfa4d5a8d734963d18807735324f57
|
413590c0d8aa7f59860124cc79310d57217f2a17
|
/Functional Programming And Lambda Expressions/ExerciseStream/src/entities/Product.java
|
817ddfd5dc8105cf53fc8515e36c6602a6e02c21
|
[] |
no_license
|
enzofalvo/estudies-java
|
3c2b6bc4f818fd634bacbfabd615bd7dc11345b6
|
e5ad69eb6e3fc16a1c4ac77b27becbbe1ea7b0ce
|
refs/heads/master
| 2022-11-14T16:43:53.912764
| 2020-06-26T19:01:58
| 2020-06-26T19:01:58
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 605
|
java
|
package entities;
public class Product {
private String name;
private Double price;
public Product(String name, Double price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
@Override
public String toString() {
return "Product{" + "name=" + name + ", price=" + price + '}';
}
}
|
[
"bestwordno@gmail.com"
] |
bestwordno@gmail.com
|
f10676eb554eaa7007062712ab9d5541ec8b0c0b
|
8d9899bb30f5c30ad5942f8b92999739668c061b
|
/src/main/java/me/uquark/barrymore/internal/DatabaseProvider.java
|
84af808be084c5b56195f65e3599f946d4488da5
|
[] |
no_license
|
UQuark/Barrymore
|
8ba7dabe7b6dd1a855b504fb2751c02c4d27a8ae
|
bfe0b7523c30f3323c11a663ed996e2068722cd6
|
refs/heads/master
| 2023-07-08T21:56:01.308826
| 2020-03-05T12:33:51
| 2020-03-05T12:33:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,221
|
java
|
package me.uquark.barrymore.internal;
import me.uquark.barrymore.Application;
import org.h2.tools.Server;
import javax.sql.rowset.CachedRowSet;
import javax.sql.rowset.RowSetProvider;
import java.net.MalformedURLException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class DatabaseProvider {
private static Server server = null;
private static String url = "";
public static void startServer() throws SQLException, MalformedURLException {
url = "jdbc:h2:" + Application.BARRYMORE_HOME + "database";
if (server != null && server.isRunning(false))
return;
server = Server.createTcpServer("-tcpPort", "0");
}
public static void stopServer() {
server.stop();
}
public static CachedRowSet query(String query) throws SQLException {
Connection connection = DriverManager.getConnection(url, "barrymore", "");
Statement statement = connection.createStatement();
CachedRowSet result = RowSetProvider.newFactory().createCachedRowSet();
result.populate(statement.executeQuery(query));
connection.close();
return result;
}
}
|
[
"artem@bigdan.in"
] |
artem@bigdan.in
|
3aed11e15e13feac2ce3a469f8dff778de4ee3f1
|
c4d170c50fb270b22c127c7e77efdcb48a07b080
|
/src/main/java/com/jack/tmall/dao/PropertyDAO.java
|
5013e1950954285bb4155578bfeb999c4da4588f
|
[] |
no_license
|
Jack-RSW/springboot_tmall
|
0e9747973aac75f497b85fa1ea12b03a4fd08e39
|
7b6259333ceb51fd6da03e530b6a2f84e0096435
|
refs/heads/master
| 2022-06-27T15:04:12.893618
| 2019-08-12T02:21:47
| 2019-08-12T02:21:47
| 201,842,311
| 0
| 0
| null | 2022-06-21T01:38:51
| 2019-08-12T02:20:13
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 524
|
java
|
package com.jack.tmall.dao;
import com.jack.tmall.pojo.Category;
import com.jack.tmall.pojo.Product;
import com.jack.tmall.pojo.Property;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface PropertyDAO extends JpaRepository<Property,Integer> {
Page<Property> findByCategory(Category category, Pageable pageable);
List<Property> findByCategory(Category category);
}
|
[
"1009840537@qq.com"
] |
1009840537@qq.com
|
d2171b47ddbca73807bbdda72138bae74bc2b698
|
794aa335f0499bb36465e3eae5693fa4300be819
|
/IGTI/DesafioModulo3/src/entidades/Pessoa.java
|
ff3c0cf04d9cc2e5429bd8151fb6c1281f5ccfe8
|
[
"MIT"
] |
permissive
|
larissaloureiro/java-exercises
|
af2364f53aff4eab857a6a2c9685458d1199d98c
|
4d48a7d666ccf674875bfefa45ff97672ab83741
|
refs/heads/main
| 2023-05-07T21:28:40.225679
| 2021-05-28T02:04:50
| 2021-05-28T02:04:50
| 369,244,383
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 314
|
java
|
package entidades;
public abstract class Pessoa {
protected String nome;
protected String cpf;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
}
|
[
"80994671+larissaloureiro@users.noreply.github.com"
] |
80994671+larissaloureiro@users.noreply.github.com
|
b0759288f3fb3d663d51e5ad1f3b66c79591432a
|
48849d2ddaf3b9ad355b63d241bbcf8fd65f7a23
|
/the_4_musketeers_source_code/src/pk6/CarFactory.java
|
a4e55768cd2698d98934aa36e682e9c7e0639570
|
[] |
no_license
|
tech-magic/oop-concepts
|
7fd3f6ad2d5faa53ed6be2dd9a5ada009f274b55
|
a0e1fd7f4f3afb4701406ab283926ee37468db51
|
refs/heads/master
| 2021-01-10T22:57:52.564289
| 2016-10-13T10:05:31
| 2016-10-13T10:05:31
| 69,718,349
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 512
|
java
|
package pk6;
public class CarFactory implements AbstractProductFactory {
public IProduct createProductByModel(String model) {
if(model.equals("civic")) { return new CivicCar(); }
else if(model.equals("vitz")) { return new VitzCar(); }
else { throw new IllegalArgumentException("Invalid Model ...");
}
}
public SalesCenter[] getAllSalesCenters() {
return new SalesCenter[] {
new CarSalesCenter("malabe", "malabe"),
new CarSalesCenter("wattala", "wattala")
};
}
}
|
[
"wimal.perera@ebuilder.com"
] |
wimal.perera@ebuilder.com
|
acbea6f256805893bf548c0ac821411c2455bd90
|
b3cc0a05955c6b6682281924369719f095dcac04
|
/splitwise/src/main/java/com/lld/splitwise/splitwise/models/split/PercentSplit.java
|
9608eb0ebd4f60ea477dfbcbfe467c9b4585231f
|
[] |
no_license
|
Akash1304/LLD
|
63f28bd017be43dffb728d287b37adb78023482c
|
1a610b6ed8ba2971657a20fe0448bbaf68397779
|
refs/heads/main
| 2023-07-05T12:15:04.877144
| 2021-08-11T14:38:23
| 2021-08-11T14:38:23
| 393,258,278
| 0
| 0
| null | 2021-08-11T14:33:24
| 2021-08-06T05:12:34
|
Java
|
UTF-8
|
Java
| false
| false
| 357
|
java
|
package com.lld.splitwise.splitwise.models.split;
import com.lld.splitwise.splitwise.models.User;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class PercentSplit extends Split {
private double percentage;
public PercentSplit(User user, double percentage) {
super(user);
this.percentage = percentage;
}
}
|
[
"akash.panigrahi@belvilla.com"
] |
akash.panigrahi@belvilla.com
|
94a14bba86d77aca62b72388030075c8f604fa6a
|
3b14f2674d39ec729b3ac41628a2920eef45ee1d
|
/src/main/java/com/baomidou/springboot/entity/Users.java
|
4d08e8c3170a68e439d66d8ae1a9f253588c2a1c
|
[] |
no_license
|
sparkvip/Sharing-SpringBoot
|
edbc37c19ebd8fe3cc5eef042569dca33a44b4cb
|
e1736901853bd8fdeb39c336a44c9b244864b2e4
|
refs/heads/master
| 2022-01-08T17:57:45.529809
| 2019-05-16T05:22:07
| 2019-05-16T05:22:07
| 180,062,913
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 966
|
java
|
package com.baomidou.springboot.entity;
import java.beans.Transient;
import java.util.Date;
import lombok.Data;
/**
* 用户表
*/
@SuppressWarnings("serial")
@Data
public class Users extends SuperEntity<Users> {
/**
* 名称
*/
private String name;
/**
* 学院
*/
private String insititute;
/**
* 密码
*/
private String password;
/**
* 头像
*/
private String portrait;
/**
* 权限
*/
private String privilege;
/**
* 电话
*/
private String phone;
@Override
public String toString() {
return "Users{" +
"name='" + name + '\'' +
", insititute='" + insititute + '\'' +
", password='" + password + '\'' +
", portrait='" + portrait + '\'' +
", privilege='" + privilege + '\'' +
", phone='" + phone + '\'' +
'}';
}
}
|
[
"jin.li05@hand-china.com"
] |
jin.li05@hand-china.com
|
5233d4c3aa9a1fbc042048cad838b6c548933ba0
|
a8a89f61d0c462b1b334f69ca742e6c70b6b60a0
|
/SpringBoot/src/main/java/com/example/test/comm/base/BaseTools.java
|
7fe4bea646940a8a879d1cde79222efc99e5f3fc
|
[] |
no_license
|
xiaohe-2020/manager
|
d52171bc00a5b26399e8f4c8a054afa49f951b56
|
2c4eaeb1bd3e581f6a37dacaaf42c2a33dd1df28
|
refs/heads/main
| 2023-05-11T03:00:25.367552
| 2021-06-03T09:35:37
| 2021-06-03T09:35:37
| 311,593,676
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 346
|
java
|
package com.example.test.comm.base;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import org.springframework.util.StringUtils;
public class BaseTools {
public boolean _isNum(String str) {
return str.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|(([0-9]+))?)$");
}
}
|
[
"hedefeng@hteis.cn"
] |
hedefeng@hteis.cn
|
a6975b8569307135f02b57d66b145fdf3ed49ad2
|
8217a23d88d4c230a3ace95c722c2c752713b8ec
|
/app/src/main/java/com/cds/iot/util/DimenUtils.java
|
b7d300053c1c0997ce9378787f88b8d453fffb18
|
[
"Apache-2.0"
] |
permissive
|
TonyJava/Iot_Project
|
b1d370c9c0c76713adf2b471c5aab6f9ed857850
|
68ab418cb934c267897a166b39e2ee3f0c0f3caf
|
refs/heads/master
| 2022-02-22T08:44:51.481730
| 2019-07-02T09:33:25
| 2019-07-02T09:33:25
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,976
|
java
|
package com.cds.iot.util;
import android.content.Context;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by Michael Smith on 2016/8/2.
*/
public class DimenUtils {
/**
* dp转px
*/
public static int dp2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* px转dp
*/
public static int px2dp(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
/**
* sp转px
*/
public static int sp2px(Context context, float spValue) {
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (spValue * fontScale + 0.5f);
}
/**
* px转sp
*/
public static int px2sp(Context context, float pxValue) {
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (pxValue / fontScale + 0.5f);
}
/**
* 各种单位转换
* 该方法存在于TypedValue
*/
public static float applyDimension(int unit, float value, DisplayMetrics metrics) {
switch (unit) {
case TypedValue.COMPLEX_UNIT_PX:
return value;
case TypedValue.COMPLEX_UNIT_DIP:
return value * metrics.density;
case TypedValue.COMPLEX_UNIT_SP:
return value * metrics.scaledDensity;
case TypedValue.COMPLEX_UNIT_PT:
return value * metrics.xdpi * (1.0f / 72);
case TypedValue.COMPLEX_UNIT_IN:
return value * metrics.xdpi;
case TypedValue.COMPLEX_UNIT_MM:
return value * metrics.xdpi * (1.0f / 25.4f);
}
return 0;
}
/**
* 在onCreate()即可强行获取View的尺寸
*/
public static int[] forceGetViewSize(View view) {
int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
view.measure(widthMeasureSpec, heightMeasureSpec);
return new int[]{view.getMeasuredWidth(), view.getMeasuredHeight()};
}
/**
* ListView中提前测量View尺寸
* 如headerView,用的时候拷贝到ListView中
*/
private void measureView(View view) {
ViewGroup.LayoutParams p = view.getLayoutParams();
if (p == null) {
p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
int width = ViewGroup.getChildMeasureSpec(0, 0, p.width);
int height;
int tempHeight = p.height;
if (tempHeight > 0) {
height = View.MeasureSpec.makeMeasureSpec(tempHeight,
View.MeasureSpec.EXACTLY);
} else {
height = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
}
view.measure(width, height);
}
}
|
[
"1102743539@qq.com"
] |
1102743539@qq.com
|
20122434af1ad34e5165a365a53e26a4425ca81a
|
08760a7c942d7b8fc2cafaab3c429983e755dce2
|
/src/helimy/project/model/PaymentListDTO.java
|
dff9cf318fad9605c0fe68b227d027e069e8934b
|
[] |
no_license
|
JYoung-lee/Helimy
|
e195d64ec0b51f245838e6e363602d6e5087c3ea
|
d183b3136c27f91fdb3e8d4d5c2ab262351a2ee6
|
refs/heads/master
| 2023-04-01T08:37:39.444022
| 2021-04-13T05:51:01
| 2021-04-13T05:51:01
| 357,436,243
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,773
|
java
|
package helimy.project.model;
import java.sql.Timestamp;
public class PaymentListDTO {
private Integer paymentcode; // 결제코드
private Timestamp reg; // 결제 시간
private String shopname; // 매장명
private String productname; // 상품명
private Integer price; // 가격
private String state; //결제상태
private String id; // 아이디
private Integer productcode; // 상품코드
private Integer francode; // 매장코드
public Integer getPaymentcode() {
return paymentcode;
}
public void setPaymentcode(Integer paymentcode) {
this.paymentcode = paymentcode;
}
public Timestamp getReg() {
return reg;
}
public void setReg(Timestamp reg) {
this.reg = reg;
}
public String getShopname() {
return shopname;
}
public void setShopname(String shopname) {
this.shopname = shopname;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getProductcode() {
return productcode;
}
public void setProductcode(Integer productcode) {
this.productcode = productcode;
}
public Integer getFrancode() {
return francode;
}
public void setFrancode(Integer francode) {
this.francode = francode;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
|
[
"wnsdyd4@gmail.com"
] |
wnsdyd4@gmail.com
|
b05856e954c8675498f75b256aff602ef5834d60
|
21870efa56b3e4f4337f40cc059aee11e3e42fc5
|
/core/management/src/main/java/uk/ac/ebi/interpro/scan/management/model/implementations/superfamily/RunSuperFamilyAss3Step.java
|
5512844615eedd3e0832254e92d628b5df827c13
|
[
"Apache-2.0"
] |
permissive
|
Shicheng-Guo/interproscan
|
f15b73ec6be64203b554ef34b5cde6c3bcbcf92b
|
25feb0729c9ba81b58ae6c748b528ea169f9475f
|
refs/heads/master
| 2022-04-26T22:33:19.735644
| 2020-03-10T15:10:00
| 2020-03-10T15:10:00
| 261,788,293
| 0
| 1
|
Apache-2.0
| 2020-05-06T14:42:39
| 2020-05-06T14:42:37
| null |
UTF-8
|
Java
| false
| false
| 4,691
|
java
|
package uk.ac.ebi.interpro.scan.management.model.implementations.superfamily;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Required;
import uk.ac.ebi.interpro.scan.management.model.StepInstance;
import uk.ac.ebi.interpro.scan.management.model.implementations.RunBinaryStep;
import java.util.ArrayList;
import java.util.List;
/**
* This step defines running the SuperFamily Perl script.
*
* @author Matthew Fraser
* @version $Id$
* @since 1.0-SNAPSHOT
*/
public class RunSuperFamilyAss3Step extends RunBinaryStep {
private static final Logger LOGGER = Logger.getLogger(RunSuperFamilyAss3Step.class.getName());
private String perlCommand;
private String fullPathToSuperFamilyAss3PerlScript;
private String fullPathToSelfHitsFile;
private String fullPathToClaFile;
private String fullPathToModelTabFile;
private String fullPathToPDBJ95DFile;
private String fastaFileNameTemplate;
private String hmmer3ResultsFileNameTemplate;
private String binaryOutputFileNameTemplate;
@Required
public void setPerlCommand(String perlCommand) {
this.perlCommand = perlCommand;
}
@Required
public void setFullPathToSuperFamilyAss3PerlScript(String fullPathToSuperFamilyAss3PerlScript) {
this.fullPathToSuperFamilyAss3PerlScript = fullPathToSuperFamilyAss3PerlScript;
}
@Required
public void setFullPathToSelfHitsFile(String fullPathToSelfHitsFile) {
this.fullPathToSelfHitsFile = fullPathToSelfHitsFile;
}
@Required
public void setFullPathToClaFile(String fullPathToClaFile) {
this.fullPathToClaFile = fullPathToClaFile;
}
@Required
public void setFullPathToModelTabFile(String fullPathToModelTabFile) {
this.fullPathToModelTabFile = fullPathToModelTabFile;
}
@Required
public void setFullPathToPDBJ95DFile(String fullPathToPDBJ95DFile) {
this.fullPathToPDBJ95DFile = fullPathToPDBJ95DFile;
}
@Required
public void setFastaFileNameTemplate(String fastaFileNameTemplate) {
this.fastaFileNameTemplate = fastaFileNameTemplate;
}
@Required
public void setHmmer3ResultsFileNameTemplate(String hmmer3ResultsFileNameTemplate) {
this.hmmer3ResultsFileNameTemplate = hmmer3ResultsFileNameTemplate;
}
@Required
public void setBinaryOutputFileNameTemplate(String binaryOutputFileNameTemplate) {
this.binaryOutputFileNameTemplate = binaryOutputFileNameTemplate;
}
/**
* Create the command ready to run the binary.
* <p/>
* Example:
* <p/>
* perl ass3.pl -e 0.0001 -s data/superfamily/1.75/self_hits.tab -r data/superfamily/1.75/dir.cla.scop.txt_1.75 -m data/superfamily/1.75/model.tab -p data/superfamily/1.75/pdbj95d -t n -f 1 INPUT_SEQUENCE_FILE HMMER3_OUTPUT_FILE PP_OUTPUT_FILE
*
* @param stepInstance containing the parameters for executing.
* @param temporaryFileDirectory is the relative path in which files are stored.
* @return The command
*/
@Override
protected List<String> createCommand(StepInstance stepInstance, String temporaryFileDirectory) {
final String fastaFilePathName = stepInstance.buildFullyQualifiedFilePath(temporaryFileDirectory, this.fastaFileNameTemplate);
final String hmmer3ResultsFilePathName = stepInstance.buildFullyQualifiedFilePath(temporaryFileDirectory, this.hmmer3ResultsFileNameTemplate);
final String binaryOutputFilePathName = stepInstance.buildFullyQualifiedFilePath(temporaryFileDirectory, this.binaryOutputFileNameTemplate);
List<String> command = new ArrayList<String>();
command.add(this.perlCommand); // Run the perl script using installed version of Perl
command.add(this.fullPathToSuperFamilyAss3PerlScript);
command.addAll(this.getBinarySwitchesAsList());
command.add("-s");
command.add(this.fullPathToSelfHitsFile);
command.add("-r");
command.add(this.fullPathToClaFile);
command.add("-m");
command.add(this.fullPathToModelTabFile);
command.add("-p");
command.add(this.fullPathToPDBJ95DFile);
command.add(fastaFilePathName); // Input sequences
command.add(hmmer3ResultsFilePathName); // Hmmer3 output from previous step
command.add(binaryOutputFilePathName); // Output file for this binary run
// Note: Superclasses getOutputFileNameTemplate() contains STDOUT from the binary - keep for logging purposes but will probably be empty!
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(command.toString());
}
return command;
}
}
|
[
"mr.matthew.fraser@ea5da8b0-6d6b-11de-9de6-4d42d2ab87c0"
] |
mr.matthew.fraser@ea5da8b0-6d6b-11de-9de6-4d42d2ab87c0
|
cbb6a7d5e259d2a427aa06afacf0e8fa8b4d5fa3
|
d493276f3a09b6f161b9d3a79d5df55f48a0557c
|
/LeetCode_ClimbingStairs.java
|
2aaee60fbae458b7ebc0576b6e5ea302c6524a7d
|
[] |
no_license
|
AnneMayor/algorithmstudy
|
31e034e9e7c8ffab0601f58b9ec29bea62aacf24
|
944870759ff43d0c275b28f0dcf54f5dd4b8f4b1
|
refs/heads/master
| 2023-04-26T21:25:21.679777
| 2023-04-15T09:08:02
| 2023-04-15T09:08:02
| 182,223,870
| 0
| 0
| null | 2021-06-20T06:49:02
| 2019-04-19T07:42:00
|
C++
|
UTF-8
|
Java
| false
| false
| 328
|
java
|
public class Solution {
public int climbStairs(int n) {
if(n == 1) return 1;
if(n == 2) return 2;
int [] dp = new int[n+1];
dp[1] = 1;
dp[2] = 2;
for(int i = 3; i <= n; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
}
return dp[n];
}
}
|
[
"melllamodahye@gmail.com"
] |
melllamodahye@gmail.com
|
ce087ea5608a73f986d3a0e3774b93bcf7f62ac4
|
b5389245f454bd8c78a8124c40fdd98fb6590a57
|
/big_variable_tree/androidAppModule55/src/main/java/androidAppModule55packageJava0/Foo3.java
|
956f99d357ad467e95eb3c1833a96dd52a09188b
|
[] |
no_license
|
jin/android-projects
|
3bbf2a70fcf9a220df3716b804a97b8c6bf1e6cb
|
a6d9f050388cb8af84e5eea093f4507038db588a
|
refs/heads/master
| 2021-10-09T11:01:51.677994
| 2018-12-26T23:10:24
| 2018-12-26T23:10:24
| 131,518,587
| 29
| 1
| null | 2018-12-26T23:10:25
| 2018-04-29T18:21:09
|
Java
|
UTF-8
|
Java
| false
| false
| 264
|
java
|
package androidAppModule55packageJava0;
public class Foo3 {
public void foo0() {
new androidAppModule55packageJava0.Foo2().foo3();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
}
|
[
"jingwen@google.com"
] |
jingwen@google.com
|
d97ed33c1b4c011248aaa28ea8172309d77d0060
|
2bef59efd6fbf74a0168debfe4b5c3eaf5616a08
|
/src/main/java/net/fabricmc/loader/transformer/EnvironmentStrippingData.java
|
cdd7c295b94a7b28d687bfd70ca85f79768877b2
|
[
"Apache-2.0"
] |
permissive
|
modmuss50/fabric-loader
|
07476f6570c563c1fb9d8cb91c8fd56494851527
|
c46087e6bc8265fa7781bc861a6a5c02f4d0fc23
|
refs/heads/master
| 2023-07-06T21:42:20.226007
| 2019-09-18T21:41:21
| 2019-09-18T21:41:21
| 211,907,484
| 4
| 1
|
Apache-2.0
| 2021-06-24T06:50:57
| 2019-09-30T16:43:35
| null |
UTF-8
|
Java
| false
| false
| 5,052
|
java
|
/*
* Copyright 2016 FabricMC
*
* 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 net.fabricmc.loader.transformer;
import net.fabricmc.api.Environment;
import net.fabricmc.api.EnvironmentInterface;
import net.fabricmc.api.EnvironmentInterfaces;
import org.objectweb.asm.*;
import java.util.Collection;
import java.util.HashSet;
/**
* Scans a class for Environment and EnvironmentInterface annotations to figure out what needs to be stripped.
*/
public class EnvironmentStrippingData extends ClassVisitor {
private static final String ENVIRONMENT_DESCRIPTOR = Type.getDescriptor(Environment.class);
private static final String ENVIRONMENT_INTERFACE_DESCRIPTOR = Type.getDescriptor(EnvironmentInterface.class);
private static final String ENVIRONMENT_INTERFACES_DESCRIPTOR = Type.getDescriptor(EnvironmentInterfaces.class);
private final String envType;
private boolean stripEntireClass = false;
private final Collection<String> stripInterfaces = new HashSet<>();
private final Collection<String> stripFields = new HashSet<>();
private final Collection<String> stripMethods = new HashSet<>();
private class EnvironmentAnnotationVisitor extends AnnotationVisitor {
private final Runnable onEnvMismatch;
private EnvironmentAnnotationVisitor(int api, Runnable onEnvMismatch) {
super(api);
this.onEnvMismatch = onEnvMismatch;
}
@Override
public void visitEnum(String name, String descriptor, String value) {
if ("value".equals(name) && !envType.equals(value)) {
onEnvMismatch.run();
}
}
}
private class EnvironmentInterfaceAnnotationVisitor extends AnnotationVisitor {
private boolean envMismatch;
private Type itf;
private EnvironmentInterfaceAnnotationVisitor(int api) {
super(api);
}
@Override
public void visitEnum(String name, String descriptor, String value) {
if ("value".equals(name) && !envType.equals(value)) {
envMismatch = true;
}
}
@Override
public void visit(String name, Object value) {
if ("itf".equals(name)) {
itf = (Type) value;
}
}
@Override
public void visitEnd() {
if (envMismatch) {
stripInterfaces.add(itf.getInternalName());
}
}
}
private AnnotationVisitor visitMemberAnnotation(String descriptor, boolean visible, Runnable onEnvMismatch) {
if (ENVIRONMENT_DESCRIPTOR.equals(descriptor)) {
return new EnvironmentAnnotationVisitor(api, onEnvMismatch);
}
return null;
}
public EnvironmentStrippingData(int api, String envType) {
super(api);
this.envType = envType;
}
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
if (ENVIRONMENT_DESCRIPTOR.equals(descriptor)) {
return new EnvironmentAnnotationVisitor(api, () -> stripEntireClass = true);
} else if (ENVIRONMENT_INTERFACE_DESCRIPTOR.equals(descriptor)) {
return new EnvironmentInterfaceAnnotationVisitor(api);
} else if (ENVIRONMENT_INTERFACES_DESCRIPTOR.equals(descriptor)) {
return new AnnotationVisitor(api) {
@Override
public AnnotationVisitor visitArray(String name) {
if ("value".equals(name)) {
return new AnnotationVisitor(api) {
@Override
public AnnotationVisitor visitAnnotation(String name, String descriptor) {
return new EnvironmentInterfaceAnnotationVisitor(api);
}
};
}
return null;
}
};
}
return null;
}
@Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
return new FieldVisitor(api) {
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return visitMemberAnnotation(descriptor, visible, () -> stripFields.add(name + descriptor));
}
};
}
@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
String methodId = name + descriptor;
return new MethodVisitor(api) {
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return visitMemberAnnotation(descriptor, visible, () -> stripMethods.add(methodId));
}
};
}
public boolean stripEntireClass() {
return stripEntireClass;
}
public Collection<String> getStripInterfaces() {
return stripInterfaces;
}
public Collection<String> getStripFields() {
return stripFields;
}
public Collection<String> getStripMethods() {
return stripMethods;
}
public boolean isEmpty() {
return stripInterfaces.isEmpty() && stripFields.isEmpty() && stripMethods.isEmpty();
}
}
|
[
"kontakt@asie.pl"
] |
kontakt@asie.pl
|
e2b9101365dcedeabe78058cebc79acb61b31659
|
70722bec203abbdc5159a67563cb2b82a944c668
|
/projection/src/InsererF.java
|
363a1499d25064c44309f98545d79b2e6c522f07
|
[] |
no_license
|
christian-kocke/cpoa_s3
|
7512a5e083be0ce6549ffa6e854fdfaf70dbe8fb
|
69d232478a4aa172ce6e4949c9dfb2a4ae0ea768
|
refs/heads/master
| 2016-09-06T08:25:50.174366
| 2015-01-14T10:22:58
| 2015-01-14T10:22:58
| 27,433,864
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 32,338
|
java
|
import java.awt.Dimension;
import java.awt.List;
import java.sql.Date;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableModel;
import projection.Creneau;
import projection.DaoCreneau;
import projection.DaoException;
import projection.DaoFilm;
import projection.DaoPlanning;
import projection.DaoProjection;
import projection.DaoSalle;
import projection.Projection;
import projection.Salle;
/*
* 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.
*/
/**
*
* @author Aïssa
*/
public class InsererF extends javax.swing.JFrame {
static final long ONE_MINUTE_IN_MILLIS=60000;//millisecs
public String titre;
public int duree;
/**
* Creates new form InsererF
* @param titre
* @param duree
* @throws projection.DaoException
*/
public InsererF(String titre, int duree) throws DaoException {
this.titre=titre;
this.duree=duree;
initComponents();
this.setLocationRelativeTo(null);
jLabel6.setText("Film sélectionné: " + titre);
jLabel7.setText("Pour cette date, la limite de film de ce concours a été atteinte");
jLabel7.setVisible(false);
DaoProjection daoPr = DaoProjection.getDAO();
Collection<Projection> col2;
col2= new ArrayList();
//Retire le choix de projection officiel si elle est déja programmée
col2=daoPr.ProjectionPrevues(titre);
for (Projection p : col2) {
if(p.getId_type()==1) {
jComboBox1.removeItemAt(0);
}
}
DaoSalle daoS = DaoSalle.getDAO();
Collection<Salle> col;
col = new ArrayList();
col=daoS.salleParType(titre);
//Insertion des salles possibles pour le film sélectionné
for (Salle s : col) {
this.jComboBox3.addItem(s.getNom());
}
Collection<String> col3;
col3 = new ArrayList();
DaoProjection daoP = DaoProjection.getDAO();
col3=daoP.TypeDeProjectionPrevue(titre);
//Ne laisse que le type de projections possibles
if(col3.contains("Officielle")) {
jComboBox1.removeItem("Officielle");
}
if(col3.contains("Lendemain")) {
jComboBox1.removeItem("Lendemain");
}
if(col3.contains("Veille")) {
jComboBox1.removeItem("Veille");
}
}
private InsererF() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
/**
* 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() {
jLabel5 = new javax.swing.JLabel();
jComboBox3 = new javax.swing.JComboBox();
b1 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
b2 = new javax.swing.JLabel();
dateChooserCombo1 = new datechooser.beans.DateChooserCombo();
jLabel7 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jComboBox2 = new javax.swing.JComboBox();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel1 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
reduce = new javax.swing.JLabel();
close = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(791, 578));
setUndecorated(true);
setPreferredSize(new java.awt.Dimension(791, 578));
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel5.setText("Sélectionner une salle pour la projection:");
getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 150, -1, -1));
jComboBox3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox3ActionPerformed(evt);
}
});
getContentPane().add(jComboBox3, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 146, -1, -1));
b1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/valider_default.png"))); // NOI18N
b1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
b1MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
b1MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
b1MouseExited(evt);
}
});
getContentPane().add(b1, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 400, 160, 50));
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 90, 300, -1));
b2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/retour_default.png"))); // NOI18N
b2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
b2MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
b2MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
b2MouseExited(evt);
}
});
getContentPane().add(b2, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 400, 40, 50));
dateChooserCombo1.setCurrentView(new datechooser.view.appearance.AppearancesList("Contrast",
new datechooser.view.appearance.ViewAppearance("custom",
new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
new java.awt.Color(0, 0, 0),
new java.awt.Color(0, 0, 255),
false,
true,
new datechooser.view.appearance.swing.ButtonPainter()),
new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
new java.awt.Color(0, 0, 0),
new java.awt.Color(0, 0, 255),
true,
true,
new datechooser.view.appearance.swing.ButtonPainter()),
new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
new java.awt.Color(0, 0, 255),
new java.awt.Color(0, 0, 255),
false,
true,
new datechooser.view.appearance.swing.ButtonPainter()),
new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
new java.awt.Color(128, 128, 128),
new java.awt.Color(0, 0, 255),
false,
true,
new datechooser.view.appearance.swing.LabelPainter()),
new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
new java.awt.Color(0, 0, 0),
new java.awt.Color(0, 0, 255),
false,
true,
new datechooser.view.appearance.swing.LabelPainter()),
new datechooser.view.appearance.swing.SwingCellAppearance(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 11),
new java.awt.Color(0, 0, 0),
new java.awt.Color(255, 0, 0),
false,
false,
new datechooser.view.appearance.swing.ButtonPainter()),
(datechooser.view.BackRenderer)null,
false,
true)));
dateChooserCombo1.setNothingAllowed(false);
try {
dateChooserCombo1.setDefaultPeriods(new datechooser.model.multiple.PeriodSet(new datechooser.model.multiple.Period(new java.util.GregorianCalendar(2015, 4, 13),
new java.util.GregorianCalendar(2015, 4, 13))));
} catch (datechooser.model.exeptions.IncompatibleDataExeption e1) {
e1.printStackTrace();
}
dateChooserCombo1.setMaxDate(new java.util.GregorianCalendar(2015, 4, 24));
dateChooserCombo1.setMinDate(new java.util.GregorianCalendar(2015, 4, 13));
dateChooserCombo1.addCommitListener(new datechooser.events.CommitListener() {
public void onCommit(datechooser.events.CommitEvent evt) {
dateChooserCombo1actionPerformed(evt);
}
});
getContentPane().add(dateChooserCombo1, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 244, 90, -1));
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
jLabel7.setForeground(new java.awt.Color(255, 51, 51));
getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 120, 300, -1));
jLabel3.setText("Préférence de date:");
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 250, -1, -1));
jLabel4.setText("Préférence de créneau:");
getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 300, -1, -1));
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Aucune", "Matinée", "Après-midi", "Soirée" }));
jComboBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox2ActionPerformed(evt);
}
});
getContentPane().add(jComboBox2, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 296, -1, -1));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Créneau(x) disponible(s)"
}
));
jScrollPane1.setViewportView(jTable1);
if (jTable1.getColumnModel().getColumnCount() > 0) {
jTable1.getColumnModel().getColumn(0).setHeaderValue("Créneau(x) disponible(s)");
}
getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 80, 200, 270));
jLabel1.setText("Type de projection:");
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 200, -1, -1));
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Officielle", "Presse", "Veille", "Lendemain" }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
}
});
getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 194, -1, -1));
reduce.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/reduire2_default.png"))); // NOI18N
reduce.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
reduceMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
reduceMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
reduceMouseExited(evt);
}
});
getContentPane().add(reduce, new org.netbeans.lib.awtextra.AbsoluteConstraints(740, 10, 20, 20));
close.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/fermer_default.png"))); // NOI18N
close.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
closeMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
closeMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
closeMouseExited(evt);
}
});
getContentPane().add(close, new org.netbeans.lib.awtextra.AbsoluteConstraints(762, 5, 20, 20));
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/InsererF.png"))); // NOI18N
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 790, 560));
pack();
}// </editor-fold>//GEN-END:initComponents
private void reduceMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_reduceMouseClicked
this.setState(1);
}//GEN-LAST:event_reduceMouseClicked
private void reduceMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_reduceMouseEntered
ImageIcon II = new ImageIcon(getClass().getResource("Images/reduire2_hover.png"));
reduce.setIcon(II);
}//GEN-LAST:event_reduceMouseEntered
private void reduceMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_reduceMouseExited
ImageIcon II = new ImageIcon(getClass().getResource("Images/reduire2_default.png"));
reduce.setIcon(II);
}//GEN-LAST:event_reduceMouseExited
private void closeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseClicked
System.exit(0);
}//GEN-LAST:event_closeMouseClicked
private void closeMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseEntered
ImageIcon II = new ImageIcon(getClass().getResource("Images/fermer_hover.png"));
close.setIcon(II);
}//GEN-LAST:event_closeMouseEntered
private void closeMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseExited
ImageIcon II = new ImageIcon(getClass().getResource("Images/fermer_default.png"));
close.setIcon(II);
}//GEN-LAST:event_closeMouseExited
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox1ActionPerformed
private void b2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_b2MouseClicked
ChoixF cf = null;
try {
cf = new ChoixF();
} catch (DaoException ex) {
Logger.getLogger(InsererF.class.getName()).log(Level.SEVERE, null, ex);
}
cf.setVisible(rootPaneCheckingEnabled);
this.dispose();
}//GEN-LAST:event_b2MouseClicked
private void b2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_b2MouseEntered
ImageIcon II = new ImageIcon(getClass().getResource("Images/retour_hover.png"));
b2.setIcon(II);
}//GEN-LAST:event_b2MouseEntered
private void b2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_b2MouseExited
ImageIcon II = new ImageIcon(getClass().getResource("Images/retour_default.png"));
b2.setIcon(II);
}//GEN-LAST:event_b2MouseExited
private void b1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_b1MouseEntered
ImageIcon II = new ImageIcon(getClass().getResource("Images/valider_hover.png"));
b1.setIcon(II);
}//GEN-LAST:event_b1MouseEntered
private void b1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_b1MouseExited
ImageIcon II = new ImageIcon(getClass().getResource("Images/valider_default.png"));
b1.setIcon(II);
}//GEN-LAST:event_b1MouseExited
private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed
//Récuperer la date sélectionner et proposer des créneaux selon celle-ci
String date = dateChooserCombo1.getText();
String mois = date.substring(3, 5);
String jour = date.substring(0,2);
String date_sql= "2015-" +mois+ "-" +jour;
//Proposer dans créneau selon la salle,la date sélectionnée et la durée du film
try {
DaoProjection daoP = DaoProjection.getDAO();
Collection <Projection> col;
col = new ArrayList();
col = daoP.ProjectionsDuJour(date_sql, jComboBox3.getSelectedItem().toString(), jComboBox2.getSelectedItem().toString());
afficherCreneaux(date_sql,col,jComboBox2.getSelectedItem().toString());
} catch (DaoException ex) {
Logger.getLogger(InsererF.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jComboBox3ActionPerformed
private void dateChooserCombo1actionPerformed(datechooser.events.CommitEvent evt) {//GEN-FIRST:event_dateChooserCombo1actionPerformed
//Récuperer la date sélectionner et proposer des créneaux selon celle-ci
String date = dateChooserCombo1.getText();
String mois = date.substring(3, 5);
String jour = date.substring(0,2);
String date_sql= "2015-" +mois+ "-" +jour;
//Proposer dans créneau selon la salle,la date sélectionnée et la durée du film
try {
DaoProjection daoP = DaoProjection.getDAO();
Collection <Projection> col;
col = new ArrayList();
col = daoP.ProjectionsDuJour(date_sql, jComboBox3.getSelectedItem().toString(), jComboBox2.getSelectedItem().toString());
afficherCreneaux(date_sql,col,jComboBox2.getSelectedItem().toString());
} catch (DaoException ex) {
Logger.getLogger(InsererF.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_dateChooserCombo1actionPerformed
private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
//Récuperer la date sélectionner et proposer des créneaux selon celle-ci
String date = dateChooserCombo1.getText();
String mois = date.substring(3, 5);
String jour = date.substring(0,2);
String date_sql= "2015-" +mois+ "-" +jour;
//Proposer dans créneau selon la salle,la date sélectionnée et la durée du film
try {
DaoProjection daoP = DaoProjection.getDAO();
Collection <Projection> col;
col = new ArrayList();
col = daoP.ProjectionsDuJour(date_sql, jComboBox3.getSelectedItem().toString(), jComboBox2.getSelectedItem().toString());
afficherCreneaux(date_sql,col,jComboBox2.getSelectedItem().toString());
} catch (DaoException ex) {
Logger.getLogger(InsererF.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jComboBox2ActionPerformed
private void b1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_b1MouseClicked
DaoPlanning daoPl = null;
try {
daoPl = DaoPlanning.getDAO();
} catch (DaoException ex) {
Logger.getLogger(InsererF.class.getName()).log(Level.SEVERE, null, ex);
}
//Verifie qu'un seul créneau est sélectionné
if(jTable1.getSelectedRowCount()>1) {
jLabel7.setText("Merci de sélectionner un seul créneau horaire");
jLabel7.setVisible(true);
}
else if(jTable1.getSelectedRowCount()<1) {
jLabel7.setText("Merci de sélectionner un créneau horaire");
jLabel7.setVisible(true);
}
//Vérifie qu'un planning existe pour ce film (ce concours)
else try {
if(!daoPl.PlanningExiste(this.titre)) {
jLabel7.setText("Aucun planning n'a été créé pour le concours faisant participer ce film");
jLabel7.setVisible(true);
}
//Récupération des choix et insertion
else {
DaoProjection daoP = DaoProjection.getDAO();
String salle= (String)jComboBox3.getSelectedItem();
String type_proj = (String)jComboBox1.getSelectedItem();
String date = dateChooserCombo1.getText();
String mois = date.substring(3, 5);
String jour = date.substring(0,2);
String date_sql= "2015-" +mois+ "-" +jour;
int ligne = jTable1.getSelectedRow();
String heure_choisie = jTable1.getValueAt(ligne, 0).toString() + ":00"; //Ajout des secondes pour le format SQL
daoP.insérerProjection(type_proj, salle, date_sql, heure_choisie, this.titre);
}
} catch (DaoException ex) {
Logger.getLogger(InsererF.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_b1MouseClicked
public void afficherCreneaux(String date, Collection<Projection> c, String preference) throws DaoException {
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
model.setRowCount(0);
/*OPÉRATION SUR TIME:
Time t = Time.valueOf("09:00:00");
Calendar cal = Calendar.getInstance();
cal.setTime(t);
cal.add(Calendar.MINUTE, 123);
System.out.println(cal.getTime().toString().substring(11, 16));*/
DaoFilm daoF = DaoFilm.getDAO();
//Test des contraintes de nombres de film par jour
if (daoF.testNbFilmParJour(this.titre, date)) {
int indiceTab = 0;
Projection[] tab_proj = new Projection[15];
for (Projection p : c) {
tab_proj[indiceTab] = p;
indiceTab++;
}
indiceTab=0;
System.out.println(c.size());
//Si il y a au moins une projection dejà prevue ce jour la
if (c.size()>0) {
while(indiceTab<14) {
Time debut_creneau_libre = null;
Time fin_creneau_libre = null;
Time heure_possible;
Time fin_default = null;
Time debut_default = null;
Calendar cal_possible=Calendar.getInstance();
Calendar cal_debut = Calendar.getInstance();
Calendar cal_fin = Calendar.getInstance();
//Toute la journée
if (preference.equals("Aucune")){
debut_default=Time.valueOf("09:00:00");
fin_default=Time.valueOf("23:00:00");
}
//Matinée
else if (preference.equals("Matinée")) {
debut_default=Time.valueOf("09:00:00");
fin_default=Time.valueOf("12:00:00");
}
//Après-midi
else if (preference.equals("Après_midi")) {
debut_default=Time.valueOf("13:00:00");
fin_default=Time.valueOf("19:00:00");
}
//Soirée
else if (preference.equals("Soirée")) {
debut_default=Time.valueOf("19:00:00");
fin_default=Time.valueOf("23:00:00");
}
//Si c'est le premier creneau on verifie si il est à la première heure ou non
if (indiceTab==0) {
if(!tab_proj[indiceTab].getHeure().equals(debut_default)) {
debut_creneau_libre=debut_default;
}
else {
debut_creneau_libre=HeureFin(tab_proj[indiceTab]);
}
}
else {
debut_creneau_libre=HeureFin(tab_proj[indiceTab-1]);
if(tab_proj[indiceTab]==null) {
fin_creneau_libre=fin_default;
}
//Si c'était la dernière projection
else{
fin_creneau_libre = Time.valueOf(tab_proj[indiceTab].getHeure());
indiceTab=14;
}
}
cal_debut.setTime(debut_creneau_libre);
cal_fin.setTime(fin_creneau_libre);
int duree_creneau = Math.round(Math.abs((cal_debut.getTimeInMillis()- cal_fin.getTimeInMillis())/ONE_MINUTE_IN_MILLIS));
int i = 0;
//Tant que l'on peut encore placer le film au moins une fois dans le créneau
//Ici, i nous donnera le nombre de fois que l'on peut placer le film dans le créneau
while (duree_creneau>this.duree) {
duree_creneau = duree_creneau - this.duree;
i++;
}
heure_possible = debut_creneau_libre;
cal_possible.setTime(heure_possible);
//Ajout à la jTable des créneaux possibles
for ( int j=0; j<i;j++) {
model.addRow(new Object[]{cal_debut.getTime().toString().substring(11, 16)});
cal_debut.add(Calendar.MINUTE, this.duree);
}
indiceTab++;
}
}
//Si il n'y a pas de projections prévues ce jour là
else {
Time debut_creneau_libre = null;
Time fin_creneau_libre = null;
Time heure_possible;
Calendar cal_possible=Calendar.getInstance();
Calendar cal_debut = Calendar.getInstance();
Calendar cal_fin = Calendar.getInstance();
if (preference.equals("Aucune")) {
debut_creneau_libre= Time.valueOf("09:00:00");
fin_creneau_libre=Time.valueOf("23:00:00");
}
else if (preference.equals("Matinée")) {
debut_creneau_libre= Time.valueOf("09:00:00");
fin_creneau_libre=Time.valueOf("12:00:00");
}
else if (preference.equals("Après-midi")) {
debut_creneau_libre= Time.valueOf("13:00:00");
fin_creneau_libre=Time.valueOf("19:00:00");
}
else if (preference.equals("Soirée")) {
debut_creneau_libre= Time.valueOf("19:00:00");
fin_creneau_libre=Time.valueOf("23:00:00");
}
cal_debut.setTime(debut_creneau_libre);
cal_fin.setTime(fin_creneau_libre);
int duree_creneau = Math.round(Math.abs((cal_debut.getTimeInMillis()- cal_fin.getTimeInMillis())/ONE_MINUTE_IN_MILLIS));
System.out.println("debut_creneau =" + debut_creneau_libre);
System.out.println("fin_creneau =" + fin_creneau_libre);
System.out.println("duree_creneau =" + duree_creneau);
int i = 0;
//Tant que l'on peut encore placer le film au moins une fois dans le créneau
//Ici, i nous donnera le nombre de fois que l'on peut placer le film dans le créneau
while (duree_creneau>this.duree) {
duree_creneau = duree_creneau - this.duree;
i++;
}
System.out.println("i = " +i);
heure_possible = debut_creneau_libre;
cal_possible.setTime(heure_possible);
//Ajout à la jTable des créneaux possibles
for ( int j=0; j<i;j++) {
model.addRow(new Object[]{cal_debut.getTime().toString().substring(11, 16)});
cal_debut.add(Calendar.MINUTE, this.duree);
}
}
}
else {
jLabel7.setVisible(true);
}
}
//Retourne l'heure de fin d'une projection
public Time HeureFin(Projection p) {
Time t = Time.valueOf(p.getHeure());
Calendar cal = Calendar.getInstance();
cal.setTime(t);
cal.add(Calendar.MINUTE, p.getDuree());
Time t1 = Time.valueOf(cal.getTime().toString().substring(11, 19));
return t1;
}
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(InsererF.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(InsererF.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(InsererF.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(InsererF.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new InsererF().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel b1;
private javax.swing.JLabel b2;
private javax.swing.JLabel close;
private datechooser.beans.DateChooserCombo dateChooserCombo1;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JComboBox jComboBox2;
private javax.swing.JComboBox jComboBox3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JLabel reduce;
// End of variables declaration//GEN-END:variables
}
|
[
"aissa.henni@hotmail.com"
] |
aissa.henni@hotmail.com
|
0e2bd666cf2517379c913c80044bd70a6488692b
|
4dd22e45d6216df9cd3b64317f6af953f53677b7
|
/LMS/src/main/java/com/ulearning/ulms/content/ugroupship/dao/UGroupShipDAOFactory.java
|
2ea405e43ac3f16b4cf6592ce835aef4f7b46c24
|
[] |
no_license
|
tianpeijun198371/flowerpp
|
1325344032912301aaacd74327f24e45c32efa1e
|
169d3117ee844594cb84b2114e3fd165475f4231
|
refs/heads/master
| 2020-04-05T23:41:48.254793
| 2008-02-16T18:03:08
| 2008-02-16T18:03:08
| 40,278,397
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,032
|
java
|
/**
* Copyright (c) 2000-2005.Huaxia Dadi Distance Learning Services Co.,Ltd.
* All rights reserved.
*/
package com.ulearning.ulms.content.ugroupship.dao;
import com.ulearning.ulms.content.ugroupship.exceptions.UGroupShipDAOSysException;
/**
* Class description goes here.
* <p/>
* Created by Auto Code Produce System
* User: xiejh
* Date: 20060317
* Time: 103906
*/
public class UGroupShipDAOFactory
{
public static UGroupShipDAO getDAO() throws UGroupShipDAOSysException
{
UGroupShipDAO dao = null;
try
{
dao = new UGroupShipDAOImpl();
}
catch (Exception se)
{
throw new UGroupShipDAOSysException(
"UGroupShipDAOFactory.getDAO: Exception while getting DAO type : \n" +
se.getMessage());
}
return dao;
}
}
|
[
"flowerpp@aeb45441-6f43-0410-8555-aba96bfc7626"
] |
flowerpp@aeb45441-6f43-0410-8555-aba96bfc7626
|
1d23c65320466521080287be1c0db981a84348eb
|
1b1eabbc2784c1cc9268ec952f0e363b9dc0270e
|
/src/main/java/tv/floe/metronome/deeplearning/datasets/MnistManager.java
|
8c45ea7cbd836ee62445747d0be5b2e8bc35b3dd
|
[
"Apache-2.0"
] |
permissive
|
jibaro/Metronome
|
35606dc7f9dbc8d32458205e0eb48ab20d808844
|
c9889484eb081329f185dea416779cfeef3bf402
|
refs/heads/master
| 2021-01-18T00:42:28.280366
| 2014-06-24T22:45:31
| 2014-06-24T22:45:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,902
|
java
|
package tv.floe.metronome.deeplearning.datasets;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/**
* <p>
* Utility class for working with the MNIST database.
* <p>
* Provides methods for traversing the images and labels data files separately,
* as well as simultaneously.
* <p>
* Provides also method for exporting an image by writing it as a PPM file.
* <p>
* Example usage:
* <pre>
* MnistManager m = new MnistManager("t10k-images.idx3-ubyte", "t10k-labels.idx1-ubyte");
* m.setCurrent(10); //index of the image that we are interested in
* int[][] image = m.readImage();
* System.out.println("Label:" + m.readLabel());
* MnistManager.writeImageToPpm(image, "10.ppm");
* </pre>
*
*
* @author Adam Gibson
*/
public class MnistManager {
private MnistImageFile images;
private MnistLabelFile labels;
/**
* Writes the given image in the given file using the PPM data format.
*
* @param image
* @param ppmFileName
* @throws IOException
*/
public static void writeImageToPpm(int[][] image, String ppmFileName) throws IOException {
BufferedWriter ppmOut = null;
try {
ppmOut = new BufferedWriter(new FileWriter(ppmFileName));
int rows = image.length;
int cols = image[0].length;
ppmOut.write("P3\n");
ppmOut.write("" + rows + " " + cols + " 255\n");
for (int i = 0; i < rows; i++) {
StringBuffer s = new StringBuffer();
for (int j = 0; j < cols; j++) {
s.append(image[i][j] + " " + image[i][j] + " " + image[i][j] + " ");
}
ppmOut.write(s.toString());
}
} finally {
ppmOut.close();
}
}
/**
* Constructs an instance managing the two given data files. Supports
* <code>NULL</code> value for one of the arguments in case reading only one
* of the files (images and labels) is required.
*
* @param imagesFile
* Can be <code>NULL</code>. In that case all future operations
* using that file will fail.
* @param labelsFile
* Can be <code>NULL</code>. In that case all future operations
* using that file will fail.
* @throws IOException
*/
public MnistManager(String imagesFile, String labelsFile) throws IOException {
if (imagesFile != null) {
images = new MnistImageFile(imagesFile, "r");
}
if (labelsFile != null) {
labels = new MnistLabelFile(labelsFile, "r");
}
}
/**
* Reads the current image.
*
* @return matrix
* @throws IOException
*/
public int[][] readImage() throws IOException {
if (images == null) {
throw new IllegalStateException("Images file not initialized.");
}
return images.readImage();
}
/**
* Set the position to be read.
*
* @param index
*/
public void setCurrent(int index) {
images.setCurrentIndex(index);
labels.setCurrentIndex(index);
}
/**
* Reads the current label.
*
* @return int
* @throws IOException
*/
public int readLabel() throws IOException {
if (labels == null) {
throw new IllegalStateException("labels file not initialized.");
}
return labels.readLabel();
}
/**
* Get the underlying images file as {@link MnistImageFile}.
*
* @return {@link MnistImageFile}.
*/
public MnistImageFile getImages() {
return images;
}
/**
* Get the underlying labels file as {@link MnistLabelFile}.
*
* @return {@link MnistLabelFile}.
*/
public MnistLabelFile getLabels() {
return labels;
}
}
|
[
"jpatterson@floe.tv"
] |
jpatterson@floe.tv
|
7b1138689f1aa3c145ebdd39b1e268b86a1a8eb9
|
f33516ffd4ac82b741f936ae2f7ef974b5f7e2f9
|
/changedPlugins/org.emftext.language.java.resource.java/src-gen/org/emftext/language/java/resource/java/mopp/JavaAntlrScanner.java
|
a8c5b5e09a485b62ed51cc28cf27d31a3a4bbbf0
|
[] |
no_license
|
ichupakhin/sdq
|
e8328d5fdc30482c2f356da6abdb154e948eba77
|
32cc990e32b761aa37420f9a6d0eede330af50e2
|
refs/heads/master
| 2023-01-06T13:33:20.184959
| 2020-11-01T13:29:04
| 2020-11-01T13:29:04
| 246,244,334
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,633
|
java
|
/*******************************************************************************
* Copyright (c) 2006-2015
* Software Technology Group, Dresden University of Technology
* DevBoost GmbH, Dresden, Amtsgericht Dresden, HRB 34001
*
* 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:
* Software Technology Group - TU Dresden, Germany;
* DevBoost GmbH - Dresden, Germany
* - initial API and implementation
******************************************************************************/
package org.emftext.language.java.resource.java.mopp;
import org.antlr.runtime3_4_0.ANTLRStringStream;
import org.antlr.runtime3_4_0.Lexer;
import org.antlr.runtime3_4_0.Token;
public class JavaAntlrScanner implements org.emftext.language.java.resource.java.IJavaTextScanner {
private Lexer antlrLexer;
public JavaAntlrScanner(Lexer antlrLexer) {
this.antlrLexer = antlrLexer;
}
public org.emftext.language.java.resource.java.IJavaTextToken getNextToken() {
if (antlrLexer.getCharStream() == null) {
return null;
}
final Token current = antlrLexer.nextToken();
if (current == null || current.getType() < 0) {
return null;
}
org.emftext.language.java.resource.java.IJavaTextToken result = new org.emftext.language.java.resource.java.mopp.JavaANTLRTextToken(current);
return result;
}
public void setText(String text) {
antlrLexer.setCharStream(new ANTLRStringStream(text));
}
}
|
[
"bla@mail.com"
] |
bla@mail.com
|
90282438755508202c5bdbe7e138aed59b7527cf
|
d80a0041cfcd8ab1ab248a1652bd0e13b1b8ffd7
|
/src/practick_SS/Employee.java
|
dddbdf1f43302f978e47d04f08f96fb6af1f7997
|
[] |
no_license
|
iraVG/JavaPracktic
|
ed8f8cd53412122e1811eb3fecf9c86c69a45420
|
59ffc05f243152a4c0fb19c73f8f70b8c04e1a63
|
refs/heads/master
| 2023-07-28T18:08:23.976022
| 2021-09-08T11:05:38
| 2021-09-08T11:05:38
| 404,312,752
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,195
|
java
|
package practick_SS;
import java.io.Serializable;
import java.util.Objects;
public abstract class Employee implements Serializable {
private int id;
private String name;
public abstract double averageMonthlySalary();
public Employee() {
}
public Employee(int id, String name) {
this.id = id;
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Employee employee = (Employee) o;
return id == employee.id &&
Objects.equals(name, employee.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
return "Employee{" +
"id=" + id +
", name='" + name + '\'' + " Salary= "+averageMonthlySalary()+
'}';
}
}
|
[
"ira.v.gado@gmail.com"
] |
ira.v.gado@gmail.com
|
4dec3361f6bd0cc8b3fe765af04de53825678e4d
|
481adc8f5686985a7b9241055d50ff6084beea95
|
/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/FullLifecycleObserver.java
|
c959d0312866b922b2fd437bc5dea0d251b9af95
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RikkaW/androidx
|
5f5e8a996f950a85698073330c16f5341b48e516
|
6d53f95e5d979366cf7935ad7f4f14f76a951ea5
|
refs/heads/androidx-main
| 2023-06-18T22:35:12.976328
| 2021-07-24T13:53:34
| 2021-07-24T13:53:34
| 389,105,112
| 4
| 0
|
Apache-2.0
| 2021-07-24T13:53:34
| 2021-07-24T13:25:43
| null |
UTF-8
|
Java
| false
| false
| 961
|
java
|
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.lifecycle;
interface FullLifecycleObserver extends LifecycleObserver {
void onCreate(LifecycleOwner owner);
void onStart(LifecycleOwner owner);
void onResume(LifecycleOwner owner);
void onPause(LifecycleOwner owner);
void onStop(LifecycleOwner owner);
void onDestroy(LifecycleOwner owner);
}
|
[
"aurimas@google.com"
] |
aurimas@google.com
|
69cfb1d43b4925c8f2c5790362ce844dc299f64f
|
339265c37840a7a8fece6418c0398f93b0a95ac4
|
/src/com/engc/oamobile/ui/home/MainActivity.java
|
05d4b19ae2c1c8e32c0b1cf11c9e1aac6151e28f
|
[] |
no_license
|
giserh/OAMobile
|
f93b69ea72f21ac8a4b7cc4de032fb7c41fef10b
|
98e7fafc63b003f5f6b77e15397a0524a431441e
|
refs/heads/master
| 2021-01-14T14:06:42.335423
| 2014-07-17T16:23:42
| 2014-07-17T16:23:42
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,303
|
java
|
package com.engc.oamobile.ui.home;
import java.util.ArrayList;
import java.util.List;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.engc.oamobile.R;
import com.engc.oamobile.support.utils.BitmapManager;
import com.engc.oamobile.support.utils.GlobalContext;
import com.engc.oamobile.support.widgets.ShowMorePopupWindow;
import com.engc.oamobile.ui.audit.OnlineAudit;
@SuppressLint("NewApi")
public class MainActivity extends Activity {
private GridView gvModem;
public List<String> imgtitleList; // 存放应用标题list
public List<Integer> imgList; // 存放应用图片list
public View[] itemViews;
private ShowMorePopupWindow smPw;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar action = getActionBar();
action.hide();
initView();
initGridData();
}
private void initView() {
gvModem = (GridView) findViewById(R.id.gvmodem);
ImageView imgMore = (ImageView) findViewById(R.id.img_titlebar_more);
imgMore.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showPopupWindow();
showPopupView();
}
});
gvModem.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent intent;
switch (position) {
case 0:
intent = new Intent(MainActivity.this, OnlineAudit.class);
startActivity(intent);
break;
case 1:
break;
default:
break;
}
}
});
}
public void showPopupWindow() {
smPw = new ShowMorePopupWindow(MainActivity.this, itemsOnClick);
// 显示窗口
View view = MainActivity.this.findViewById(R.id.img_titlebar_more);
// 计算坐标的偏移量
int xoffInPixels = smPw.getWidth() - view.getWidth() + 10;
smPw.showAsDropDown(view, -xoffInPixels, 0);
}
// 为弹出窗口实现监听类
private OnClickListener itemsOnClick = new OnClickListener() {
public void onClick(View v) {
smPw.dismiss();
}
};
// 设置popupView
private void showPopupView() {
View view = ShowMorePopupWindow.initView();
/* ImageView userFace = (ImageView) view.findViewById(R.id.userface);
TextView userName = (TextView) view.findViewById(R.id.username);*/
// userName.setText(GlobalContext.getInstance().getSpUtil().getUserInfo().getUsername());
// String url
// =GlobalContext.getInstance().getSpUtil().getUserInfo().getPhoto();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
/*
* if (id == R.id.action_settings) { return true; }
*/
return super.onOptionsItemSelected(item);
}
private void initGridData() {
imgtitleList = new ArrayList<String>();
imgList = new ArrayList<Integer>();
imgtitleList.clear();
imgList.clear();
imgtitleList.add("新闻公告");
imgtitleList.add("在线审批");
imgtitleList.add("请假");
imgtitleList.add("即时消息");
imgtitleList.add("通讯录");
imgtitleList.add("请假记录");
imgList.add(R.drawable.icon_news);
imgList.add(R.drawable.icon_online_audit);
imgList.add(R.drawable.icon_leave);
imgList.add(R.drawable.icon_message);
imgList.add(R.drawable.icon_contact);
imgList.add(R.drawable.icon_leave_record);
gvModem.setAdapter(new GridViewModemAdapter(imgtitleList, imgList));
}
/**
*
* @ClassName: GridViewModemAdapter
* @Description: APPs 九宫格 数据适配源
* @author wutao
* @date 2013-10-10 上午11:23:54
*
*/
public class GridViewModemAdapter extends BaseAdapter {
public GridViewModemAdapter(List<String> imgTitles, List<Integer> images) {
itemViews = new View[images.size()];
for (int i = 0; i < itemViews.length; i++) {
itemViews[i] = makeItemView(imgTitles.get(i), images.get(i));
}
}
public View makeItemView(String imageTitilsId, int imageId) {
// try {
// LayoutInflater inflater = (LayoutInflater)
// UtitlsModemFragment.this
// .getSystemService(LAYOUT_INFLATER_SERVICE);
// View
// view=LayoutInflater.from(getActivity().getApplicationContext()).inflate(R.layout.grid_apps_item,
// null);
LayoutInflater inflater = LayoutInflater.from(MainActivity.this);
View itemView = inflater.inflate(R.layout.grid_apps_item, null);
TextView title = (TextView) itemView.findViewById(R.id.TextItemId);
title.setText(imageTitilsId);
ImageView image = (ImageView) itemView
.findViewById(R.id.ImageItemId);
image.setImageResource(imageId);
// image.setScaleType(ImageView.ScaleType.FIT_CENTER);
return itemView;
/*
* } catch (Exception e) {
* System.out.println("makeItemView Exception error" +
* e.getMessage()); return null; }
*/
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return itemViews.length;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return itemViews[position];
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if (convertView == null) {
return itemViews[position];
}
return convertView;
}
}
}
|
[
"taowu78@gmail.com"
] |
taowu78@gmail.com
|
18815f178e2df308577942658e042b7d414a60b6
|
24130494cd83717c794915642653f62b6cda78a1
|
/gof-patterns/src/main/java/br/com/gof/patterns/visitor/FormatoVisitante.java
|
775675eed46a8fbc672c9c2cfd0d2621ef68d1dd
|
[] |
no_license
|
motadiego/gof-patterns
|
d7cd28d612339b84a65097a384e400d1031458e5
|
116f9c68a4090b5f7265692c8fa9456f2c1e71ea
|
refs/heads/master
| 2023-02-25T09:43:09.257857
| 2021-01-28T02:09:56
| 2021-01-28T02:09:56
| 321,667,732
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 428
|
java
|
package br.com.gof.patterns.visitor;
public interface FormatoVisitante {
public void visitarTitulo(String t);
public void visitarSubtitulo(String t);
public void visitarParagrafo(String p);
public void visitarTabela();
public void visitarTabelaCabecalho(String... ct);
public void visitarTabelaLinha(Object... o);
public void visitarTabelaFim();
public void visitarImagem(String path);
public Object getResultado();
}
|
[
"diegoalves123@gmail.com"
] |
diegoalves123@gmail.com
|
f47a037667b0360eb93f5a6cf2c88ebd6ae9174f
|
5639be2318fc624d8dac7f00b9cf8838859ec63f
|
/src/main/java/com/tatvasoft/employeejob/web/rest/DepartmentResource.java
|
6a69dac8d161b80bbefbd09315378abaaaa8a050
|
[] |
no_license
|
manojrpatil/jhipster_demo
|
445ea1f8fe8f04adf44b31e5c808a6f85238d0a3
|
6481260c489001b91372f0e3058ac5233db0b90e
|
refs/heads/master
| 2021-09-01T14:18:56.936775
| 2017-12-27T12:18:02
| 2017-12-27T12:18:02
| 115,495,554
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,835
|
java
|
package com.tatvasoft.employeejob.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.tatvasoft.employeejob.service.DepartmentService;
import com.tatvasoft.employeejob.web.rest.errors.BadRequestAlertException;
import com.tatvasoft.employeejob.web.rest.util.HeaderUtil;
import com.tatvasoft.employeejob.service.dto.DepartmentDTO;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Department.
*/
@RestController
@RequestMapping("/api")
public class DepartmentResource {
private final Logger log = LoggerFactory.getLogger(DepartmentResource.class);
private static final String ENTITY_NAME = "department";
private final DepartmentService departmentService;
public DepartmentResource(DepartmentService departmentService) {
this.departmentService = departmentService;
}
/**
* POST /departments : Create a new department.
*
* @param departmentDTO the departmentDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new departmentDTO, or with status 400 (Bad Request) if the department has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/departments")
@Timed
public ResponseEntity<DepartmentDTO> createDepartment(@Valid @RequestBody DepartmentDTO departmentDTO) throws URISyntaxException {
log.debug("REST request to save Department : {}", departmentDTO);
if (departmentDTO.getId() != null) {
throw new BadRequestAlertException("A new department cannot already have an ID", ENTITY_NAME, "idexists");
}
DepartmentDTO result = departmentService.save(departmentDTO);
return ResponseEntity.created(new URI("/api/departments/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /departments : Updates an existing department.
*
* @param departmentDTO the departmentDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated departmentDTO,
* or with status 400 (Bad Request) if the departmentDTO is not valid,
* or with status 500 (Internal Server Error) if the departmentDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/departments")
@Timed
public ResponseEntity<DepartmentDTO> updateDepartment(@Valid @RequestBody DepartmentDTO departmentDTO) throws URISyntaxException {
log.debug("REST request to update Department : {}", departmentDTO);
if (departmentDTO.getId() == null) {
return createDepartment(departmentDTO);
}
DepartmentDTO result = departmentService.save(departmentDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, departmentDTO.getId().toString()))
.body(result);
}
/**
* GET /departments : get all the departments.
*
* @return the ResponseEntity with status 200 (OK) and the list of departments in body
*/
@GetMapping("/departments")
@Timed
public List<DepartmentDTO> getAllDepartments() {
log.debug("REST request to get all Departments");
return departmentService.findAll();
}
/**
* GET /departments/:id : get the "id" department.
*
* @param id the id of the departmentDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the departmentDTO, or with status 404 (Not Found)
*/
@GetMapping("/departments/{id}")
@Timed
public ResponseEntity<DepartmentDTO> getDepartment(@PathVariable Long id) {
log.debug("REST request to get Department : {}", id);
DepartmentDTO departmentDTO = departmentService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(departmentDTO));
}
/**
* DELETE /departments/:id : delete the "id" department.
*
* @param id the id of the departmentDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/departments/{id}")
@Timed
public ResponseEntity<Void> deleteDepartment(@PathVariable Long id) {
log.debug("REST request to delete Department : {}", id);
departmentService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}
|
[
"apoorva.mehar@tatvasoft.com"
] |
apoorva.mehar@tatvasoft.com
|
cfe47d164b5f8b847e410a1a5ab6c36f4557914f
|
72030344b6f1a60df460889fe751253e78f2548a
|
/Training_Projects/Day5/PageFactorySoftest/PageFactorySoftest/src/packPageObject/SoftestRunner.java
|
af6c83061409b3acf707d582ab9e1320256eb204
|
[] |
no_license
|
mranirudha/WebMarketing_SeleniumProject
|
6928542704b8e2a7767bd401d0f23a71e7b9f1af
|
cfcd5cacf3f7abf1f535f5981b1039e2c16784fc
|
refs/heads/master
| 2023-08-07T12:14:02.140033
| 2021-08-27T10:32:04
| 2021-08-27T10:32:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,199
|
java
|
package packPageObject;
import org.openqa.selenium.support.PageFactory;
import org.testng.Reporter;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import packPageObject.MyDataproviders;
public class SoftestRunner extends OpenAndCloseBrowser
{
Home home ;
Login login ;
Student student;
Library lib;
@BeforeMethod
public void initElem()
{
home = PageFactory.initElements(driver, Home.class);
login = PageFactory.initElements(driver, Login.class);
student=PageFactory.initElements(driver, Student.class);
}
@Test(dataProvider="DP-XL",dataProviderClass=MyDataproviders.class)
public void testLogin(String user,String pwd,String verify,String page,String type) throws Exception
{
Reporter.log("HOME : ",true);
home.OpenHomePage().VerifyHome().VerifyLogo().clickOnLogin();
Reporter.log("Login Type : " + type,true);
login.enterUser(user).enterPwd(pwd).clickSubmit();
lib=new Library(driver);
lib.VerifyExpPage(page);
if(type.equalsIgnoreCase("Valid"))
{
student.VerifyStudent(verify).clickSignout().VerifyHome();
}
else
{
login.VerifyMsg(verify, type);
}
}
}
|
[
"anirudha.sahoo@eurofins.com"
] |
anirudha.sahoo@eurofins.com
|
4c336672ace5fb5488997275eb5b48f81058b3b1
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/35/35_7f0863e3a13e435aad9b0eba2d6a314c2adb9f44/IO/35_7f0863e3a13e435aad9b0eba2d6a314c2adb9f44_IO_t.java
|
26ffc7dbee366157cfeae5fe5dd72377e495afe3
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692
| 2023-06-22T07:55:56
| 2023-06-22T07:55:56
| 259,613,157
| 6
| 2
| null | 2023-06-22T07:55:57
| 2020-04-28T11:07:49
| null |
UTF-8
|
Java
| false
| false
| 1,230
|
java
|
package tdt4186.exercise3.code;
public class IO {
private Queue ioQueue;
private Statistics statistics;
private long ioWait;
private Gui gui;
private Process activeProcess = null;
public IO(Queue ioQueue, Statistics statistics, EventQueue eventQueue, long ioWait, Gui gui) {
this.ioQueue = ioQueue;
this.statistics = statistics;
this.gui = gui;
this.ioWait = ioWait;
}
public boolean addProcess(Process p) {
ioQueue.insert(p);
if (activeProcess == null) {
start();
return true;
} else {
return false;
}
}
public Process start() {
if (ioQueue.isEmpty()) {
return null;
}
Process p = (Process) ioQueue.removeNext();
activeProcess = p;
gui.setIoActive(p);
return p;
}
public Process getProcess() {
Process p = activeProcess;
activeProcess = null;
gui.setIoActive(activeProcess);
return p;
}
public long getIoTime() {
return (long) (Math.random() * (ioWait * 2) + ioWait / 2);
}
public void updateTime(long timePassed) {
long l = this.ioQueue.getQueueLength();
statistics.ioQueueLengthTime += l*timePassed;
if(l > statistics.longestIoQueueLength)
statistics.longestIoQueueLength = l;
}
}
|
[
"yuzhongxing88@gmail.com"
] |
yuzhongxing88@gmail.com
|
61a63c103db227db0ab72843e27e0b1b744e7f7c
|
d753126ed72abdcd961138a7eb07f6bdb06f57eb
|
/src/main/java/modern/annotations/CORS.java
|
b17e3b7a9f6c460b2437382f57fc6536cdd109df
|
[] |
no_license
|
Abkholy/Modern
|
00ce2de94b62a9e368bcca927d3e2c663c191eca
|
fbd41c633c6dfab5eae30b42b560fecdb8fe1b20
|
refs/heads/master
| 2020-05-24T04:59:09.242748
| 2019-05-16T21:38:15
| 2019-05-16T21:38:15
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 347
|
java
|
package modern.annotations;
import javax.ws.rs.NameBinding;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@NameBinding
public @interface CORS {
}
|
[
"abdelrahman.alkholy@uflare.io"
] |
abdelrahman.alkholy@uflare.io
|
60f288c892794d8eafe5cac8d2e71849bcac399c
|
dbeb2bc2c0a29a038b9f1675774f9ee0a0047e10
|
/src/main/java/soreco/training/designpatterns/creational/builder/HairType.java
|
5ad9ff982bb56b68a7a3621c45fc784b8bce402f
|
[] |
no_license
|
sgr-src/designpatterns
|
368bde939518e21f77deba312dc457f2db0b1775
|
2e96975899f2d9bf088d78a8b5e4a3bd78edeae1
|
refs/heads/master
| 2020-05-18T15:21:44.322574
| 2014-10-23T13:13:34
| 2014-10-23T13:13:34
| 24,752,789
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 485
|
java
|
package soreco.training.designpatterns.creational.builder;
public enum HairType {
BALD, SHORT, CURLY, LONG_STRAIGHT, LONG_CURLY;
@Override
public String toString() {
String s = "";
switch (this) {
case BALD:
s = "bold";
break;
case SHORT:
s = "short";
break;
case CURLY:
s = "curly";
break;
case LONG_STRAIGHT:
s = "long straight";
break;
case LONG_CURLY:
s = "long curly";
break;
}
return s;
}
}
|
[
"sgrebenjuk@soreco.ch"
] |
sgrebenjuk@soreco.ch
|
a4754d69bfe3b500ec9e4fcb870389bb02de4c46
|
c47526d11280ae2872d21ce7a5a36ec1312f7ae5
|
/src/main/java/com/artmark/avs5rs/sale/model/Seat.java
|
9852cd6f85642198014c804d1615d2464300790e
|
[] |
no_license
|
ushmodin/avs5rs
|
ec19a403e9b42dd14e02bf4990782c15b09df173
|
04a7ab39c9155fa44bbd196a13dee8c9ac811635
|
refs/heads/master
| 2021-01-12T22:15:25.723303
| 2018-08-10T05:00:15
| 2018-08-10T05:00:15
| 68,369,438
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,676
|
java
|
package com.artmark.avs5rs.sale.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Seat complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Seat">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="id" type="{}IDType"/>
* <element name="num" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Seat", propOrder = {
"id",
"num"
})
public class Seat {
@XmlElement(required = true)
protected String id;
protected int num;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the num property.
*
*/
public int getNum() {
return num;
}
/**
* Sets the value of the num property.
*
*/
public void setNum(int value) {
this.num = value;
}
}
|
[
"ushmodin@gmail.com"
] |
ushmodin@gmail.com
|
3c6b24f265539e79b7a1dedc8a42347e367518bc
|
80e32257a04999dbe7fd74cebf9c86df6284c670
|
/stage-1/stage-1-lesson-4/src/main/java/com/zhang/deep/in/java/fucntional/FunctionDemo.java
|
f72118affde7ac43ef7b5faf0a048d5317f3dbe5
|
[] |
no_license
|
zhang1990zxc/deep-in-java
|
19cede7833b38257b8f5587a8368ee31764c5447
|
0661fcdc48d9f6d702a08797bbd7279cdeab1826
|
refs/heads/master
| 2023-05-01T05:40:30.117242
| 2020-09-21T10:33:22
| 2020-09-21T10:33:22
| 253,047,624
| 0
| 0
| null | 2023-04-17T19:34:58
| 2020-04-04T16:36:51
|
Java
|
UTF-8
|
Java
| false
| false
| 619
|
java
|
package com.zhang.deep.in.java.fucntional;
import java.util.function.Function;
/**
* @ClassName FunctionDemo
* @Description 整条街最靓的仔,写点注释吧
* @Author 天涯
* @Date 2020/4/7 23:30
* @Version 1.0
**/
public class FunctionDemo {
public static void main(String[] args) {
Function<String, Long> stringToLong = Long::valueOf;
System.out.println(stringToLong.apply("1"));
Function<Long, String> longToString = String::valueOf;
System.out.println(longToString.apply(1L));
Long value = stringToLong.compose(String::valueOf).apply(1L);
}
}
|
[
"1018736264@qq.com"
] |
1018736264@qq.com
|
eb422181c2e070149d39ba027917f944048312c2
|
89acccb1d06415ed13abf94c2e78de294e4fa647
|
/src/main/java/org/ibp/api2/web/rest/dto/UserDTO.java
|
aac3a790d9f4f57d443ffee6a40803353b7bd6f9
|
[] |
no_license
|
BulkSecurityGeneratorProject/opturn
|
3e8041bce114ad727dd0570c9345743d674b2fab
|
9463545162ca3baa46c99b5a5aa405faa1ce04c5
|
refs/heads/master
| 2022-12-23T15:05:40.347966
| 2015-09-18T05:42:56
| 2015-09-18T05:42:56
| 296,590,918
| 0
| 0
| null | 2020-09-18T10:36:40
| 2020-09-18T10:36:40
| null |
UTF-8
|
Java
| false
| false
| 2,078
|
java
|
package org.ibp.api2.web.rest.dto;
import org.hibernate.validator.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.List;
public class UserDTO {
public static final int PASSWORD_MIN_LENGTH = 5;
public static final int PASSWORD_MAX_LENGTH = 100;
@Pattern(regexp = "^[a-z0-9]*$")
@NotNull
@Size(min = 1, max = 50)
private String login;
@NotNull
@Size(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH)
private String password;
@Size(max = 50)
private String firstName;
@Size(max = 50)
private String lastName;
@Email
@Size(min = 5, max = 100)
private String email;
@Size(min = 2, max = 5)
private String langKey;
private List<String> roles;
public UserDTO() {
}
public UserDTO(String login, String password, String firstName, String lastName, String email, String langKey,
List<String> roles) {
this.login = login;
this.password = password;
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.langKey = langKey;
this.roles = roles;
}
public String getPassword() {
return password;
}
public String getLogin() {
return login;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getEmail() {
return email;
}
public String getLangKey() {
return langKey;
}
public List<String> getRoles() {
return roles;
}
@Override
public String toString() {
return "UserDTO{" +
"login='" + login + '\'' +
", password='" + password + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", langKey='" + langKey + '\'' +
", roles=" + roles +
'}';
}
}
|
[
"naymesh@leafnode.io"
] |
naymesh@leafnode.io
|
cf280d750891e22c068804a8671b8c81953f58bf
|
0541dffd53ce59391b0e5988af6e98dd5a6e5919
|
/g_a_0/src/main/java/com/wsdc/g_a_0/plugin/IProxy.java
|
5a480632e11b5b1c68774963ea95480baa17bc21
|
[] |
no_license
|
wsdchigh/t0
|
ec7785b50cb1f3761bf3d5fe9a750437facf4f51
|
b159865426c73898566af227d63c92cea1f51542
|
refs/heads/master
| 2020-04-30T10:52:36.494798
| 2019-03-19T18:13:13
| 2019-03-19T18:13:13
| 176,569,099
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 468
|
java
|
package com.wsdc.g_a_0.plugin;
/*
*
* <li> 里面注册了字符串类型的key
* <li> 如果需要处理,必须要有可以
* <li> 如果没有key,会将任务抛给上层的IProxy 进行处理
*/
public interface IProxy<T>{
boolean containKey(Integer key);
IPlugin<T,Integer> plugin();
// 具体的处理函数 因为参数的不确定,所以使用可变参数
boolean proxy(Integer key,Object... args);
}
|
[
"wsdchigh@wsdchigh.ste"
] |
wsdchigh@wsdchigh.ste
|
fffde435adcfab051f18035aca5c2748cd68e345
|
ba2386ce813d793d4ed122065575878bd4a9bd38
|
/app/src/main/java/ve/com/abicelis/cryptomaster/data/local/CachedCoinDao.java
|
66753330ac7de0cbda6b594ec7cc6985054a61e6
|
[
"MIT"
] |
permissive
|
abicelis/CryptoMaster
|
1b9bdc9ae5341d0f986562502c54620494563dd9
|
cad16738bdad5e36dfc6ae9e091b4db6e35638b1
|
refs/heads/master
| 2020-03-18T05:10:59.880500
| 2019-01-04T20:47:43
| 2019-01-04T20:47:43
| 134,328,677
| 1
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,325
|
java
|
package ve.com.abicelis.cryptomaster.data.local;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.RoomWarnings;
import android.arch.persistence.room.Transaction;
import android.arch.persistence.room.Update;
import java.util.List;
import io.reactivex.Maybe;
import io.reactivex.Single;
import ve.com.abicelis.cryptomaster.data.model.CachedCoin;
import ve.com.abicelis.cryptomaster.data.model.Coin;
/**
* Created by abicelis on 23/6/2018.
*/
@Dao
public abstract class CachedCoinDao {
@Query("SELECT count(*) FROM cached_coin")
public abstract Single<Integer> count();
@Query("SELECT * FROM cached_coin")
public abstract Single<List<CachedCoin>> getAll();
@Query("SELECT * FROM cached_coin where cached_coin_id = :cachedCoinId")
public abstract Maybe<CachedCoin> getById(long cachedCoinId);
@Query("SELECT * FROM cached_coin where cached_coin_id IN (:cachedCoinIds)")
public abstract Maybe<List<CachedCoin>> getByIds(long[] cachedCoinIds);
@Query("SELECT * FROM cached_coin where code = :code")
public abstract Maybe<CachedCoin> getByCode(String code);
@Query("SELECT * FROM cached_coin where code IN (:codes)")
public abstract Maybe<List<CachedCoin>> getByCodes(String codes);
@Query("SELECT * FROM cached_coin where name = :name")
public abstract Maybe<CachedCoin> getByName(String name);
@Query("SELECT * FROM cached_coin where name IN (:names)")
public abstract Maybe<List<CachedCoin>> getByNames(String names);
@Query("SELECT * FROM cached_coin ORDER BY rank ASC LIMIT :limit")
public abstract Single<List<CachedCoin>> getByRank(int limit);
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH) //Skip warning, mismatch with calculated column relevance
@Query("SELECT *" +
",(name LIKE :query) +" +
" (website_slug LIKE :query) +" +
" (CASE WHEN code LIKE :query THEN 2 ELSE 0 END)" +
" AS relevance" +
" FROM cached_coin" +
" WHERE name LIKE :query OR code LIKE :query OR website_slug LIKE :query" +
" ORDER BY [relevance] desc")
public abstract Single<List<CachedCoin>> find(String query);
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH) //Skip warning, mismatch with calculated column relevance
@Query("SELECT *" +
",(name LIKE :query) +" +
" (website_slug LIKE :query) +" +
" (CASE WHEN code LIKE :query THEN 2 ELSE 0 END)" +
" AS relevance" +
" FROM cached_coin" +
" WHERE name LIKE :query OR code LIKE :query OR website_slug LIKE :query" +
" ORDER BY [relevance] desc" +
" LIMIT :limit")
public abstract Single<List<CachedCoin>> find(String query, int limit);
@Insert(onConflict = OnConflictStrategy.REPLACE)
public abstract long[] insert(List<CachedCoin> coins);
@Query("DELETE FROM cached_coin")
public abstract int deleteAll();
@Transaction
public void deleteCachedCoinsAndInsertNewOnes(List<CachedCoin> coins) {
deleteAll();
insert(coins);
}
}
|
[
"abicelis@gmail.com"
] |
abicelis@gmail.com
|
5d7b6b0dab4f063247f9a97a654ee9568d22280c
|
281fc20ae4900efb21e46e8de4e7c1e476f0d132
|
/samples/seamEAR/primary-source/src/main/java/org/richfaces/demo/SeamUtil.java
|
ed1a115e979f678f58cc169e415a5d69a2d7f4f8
|
[] |
no_license
|
nuxeo/richfaces-3.3
|
c23b31e69668810219cf3376281f669fa4bf256f
|
485749c5f49ac6169d9187cc448110d477acab3b
|
refs/heads/master
| 2023-08-25T13:27:08.790730
| 2015-01-05T10:42:11
| 2015-01-05T10:42:11
| 10,627,040
| 3
| 5
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 56
|
java
|
package org.richfaces.demo;
public class SeamUtil {
}
|
[
"grenard@nuxeo.com"
] |
grenard@nuxeo.com
|
518f2786c9376c0cd66c1f38fad5b3b53b4d06c2
|
e2912ce67a6946cec4606d4468ca80852dfc178a
|
/hello-designpattern/src/main/java/com/kilogate/hello/designpattern/proxy/dynamicproxy/jdk/test/ServiceImpl.java
|
0f6bf88efd7ba28b3b5b2d460ebe2c072347c7c2
|
[] |
no_license
|
kilogate/hellojava
|
0377868adf21aa65f1d54e9aa4be9482ef569096
|
57a478cc7bc00ec0003c7d5353d5ab6aa7c29cf2
|
refs/heads/master
| 2022-07-03T23:38:59.323929
| 2017-11-20T08:47:48
| 2017-11-20T08:47:48
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 437
|
java
|
package com.kilogate.hello.designpattern.proxy.dynamicproxy.jdk.test;
/**
* 接口具体实现
*
* @author fengquanwei
* @create 2017/4/20 10:53
**/
public class ServiceImpl implements Service1, Service2 {
@Override
public void method1() {
System.out.println("ServiceImpl implements Service1");
}
@Override
public void method2() {
System.out.println("ServiceImpl implements Service2");
}
}
|
[
"kilogate@163.com"
] |
kilogate@163.com
|
d75135af0bd90036b6d5316250d6eedb293c7c20
|
0af8b92686a58eb0b64e319b22411432aca7a8f3
|
/large-multiproject/project95/src/main/java/org/gradle/test/performance95_5/Production95_486.java
|
f40137d57c278ca24f20cf42be6fae7a68014483
|
[] |
no_license
|
gradle/performance-comparisons
|
b0d38db37c326e0ce271abebdb3c91769b860799
|
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
|
refs/heads/master
| 2023-08-14T19:24:39.164276
| 2022-11-24T05:18:33
| 2022-11-24T05:18:33
| 80,121,268
| 17
| 15
| null | 2022-09-30T08:04:35
| 2017-01-26T14:25:33
| null |
UTF-8
|
Java
| false
| false
| 305
|
java
|
package org.gradle.test.performance95_5;
public class Production95_486 extends org.gradle.test.performance17_5.Production17_486 {
private final String property;
public Production95_486() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
|
[
"cedric.champeau@gmail.com"
] |
cedric.champeau@gmail.com
|
e3c66d7b979c36b6eab41b5722fd11101e228c04
|
315cd94cef2f6e43f7a7e532f763604f8c55d574
|
/app/src/main/java/self/samsung/gallery/view/SlowerCustomScroller.java
|
0504daec9aba877b39ebd5b6cd6a2d9500fcac0a
|
[] |
no_license
|
subinbabu89/SamsungGalleryUI
|
ede9dd462ff58b7c7bed7e015e4dfd522eecec02
|
662e158400774046890aff5fddf6872bf300a659
|
refs/heads/master
| 2021-01-19T00:19:08.990444
| 2017-03-28T23:23:16
| 2017-03-28T23:23:16
| 85,439,060
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,103
|
java
|
package self.samsung.gallery.view;
import android.content.Context;
import android.view.animation.Interpolator;
import android.widget.Scroller;
/**
* Custom slower scroller for the pager view
* <p>
* Created by subin on 3/19/2017.
*/
class SlowerCustomScroller extends Scroller {
private double mScrollFactor = 1;
@SuppressWarnings("unused")
public SlowerCustomScroller(Context context) {
super(context);
}
SlowerCustomScroller(Context context, Interpolator interpolator) {
super(context, interpolator);
}
@SuppressWarnings("unused")
public SlowerCustomScroller(Context context, Interpolator interpolator, boolean flywheel) {
super(context, interpolator, flywheel);
}
/**
* Set the factor by which the duration will change
*/
void setScrollDurationFactor(double scrollFactor) {
mScrollFactor = scrollFactor;
}
@Override
public void startScroll(int startX, int startY, int dx, int dy, int duration) {
super.startScroll(startX, startY, dx, dy, (int) (duration * mScrollFactor));
}
}
|
[
"subin.babu@mavs.uta.edu"
] |
subin.babu@mavs.uta.edu
|
33735d13db2bc927c0546e581dea466ac809a60e
|
32cd70512c7a661aeefee440586339211fbc9efd
|
/aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/CreateByteMatchSetRequest.java
|
c0260048eff00dbc564fce711a6983e5a0cf4cc4
|
[
"Apache-2.0"
] |
permissive
|
twigkit/aws-sdk-java
|
7409d949ce0b0fbd061e787a5b39a93db7247d3d
|
0b8dd8cf5e52ad7ae57acd2ce7a584fd83a998be
|
refs/heads/master
| 2020-04-03T16:40:16.625651
| 2018-05-04T12:05:14
| 2018-05-04T12:05:14
| 60,255,938
| 0
| 1
|
Apache-2.0
| 2018-05-04T12:48:26
| 2016-06-02T10:40:53
|
Java
|
UTF-8
|
Java
| false
| false
| 5,791
|
java
|
/*
* Copyright 2010-2016 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 com.amazonaws.AmazonWebServiceRequest;
/**
*
*/
public class CreateByteMatchSetRequest extends AmazonWebServiceRequest
implements Serializable, Cloneable {
/**
* <p>
* A friendly name or description of the <a>ByteMatchSet</a>. You can't
* change <code>Name</code> after you create a <code>ByteMatchSet</code>.
* </p>
*/
private String name;
/**
* <p>
* The value returned by the most recent call to <a>GetChangeToken</a>.
* </p>
*/
private String changeToken;
/**
* <p>
* A friendly name or description of the <a>ByteMatchSet</a>. You can't
* change <code>Name</code> after you create a <code>ByteMatchSet</code>.
* </p>
*
* @param name
* A friendly name or description of the <a>ByteMatchSet</a>. You
* can't change <code>Name</code> after you create a
* <code>ByteMatchSet</code>.
*/
public void setName(String name) {
this.name = name;
}
/**
* <p>
* A friendly name or description of the <a>ByteMatchSet</a>. You can't
* change <code>Name</code> after you create a <code>ByteMatchSet</code>.
* </p>
*
* @return A friendly name or description of the <a>ByteMatchSet</a>. You
* can't change <code>Name</code> after you create a
* <code>ByteMatchSet</code>.
*/
public String getName() {
return this.name;
}
/**
* <p>
* A friendly name or description of the <a>ByteMatchSet</a>. You can't
* change <code>Name</code> after you create a <code>ByteMatchSet</code>.
* </p>
*
* @param name
* A friendly name or description of the <a>ByteMatchSet</a>. You
* can't change <code>Name</code> after you create a
* <code>ByteMatchSet</code>.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateByteMatchSetRequest withName(String name) {
setName(name);
return this;
}
/**
* <p>
* The value returned by the most recent call to <a>GetChangeToken</a>.
* </p>
*
* @param changeToken
* The value returned by the most recent call to
* <a>GetChangeToken</a>.
*/
public void setChangeToken(String changeToken) {
this.changeToken = changeToken;
}
/**
* <p>
* The value returned by the most recent call to <a>GetChangeToken</a>.
* </p>
*
* @return The value returned by the most recent call to
* <a>GetChangeToken</a>.
*/
public String getChangeToken() {
return this.changeToken;
}
/**
* <p>
* The value returned by the most recent call to <a>GetChangeToken</a>.
* </p>
*
* @param changeToken
* The value returned by the most recent call to
* <a>GetChangeToken</a>.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateByteMatchSetRequest withChangeToken(String changeToken) {
setChangeToken(changeToken);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getName() != null)
sb.append("Name: " + getName() + ",");
if (getChangeToken() != null)
sb.append("ChangeToken: " + getChangeToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CreateByteMatchSetRequest == false)
return false;
CreateByteMatchSetRequest other = (CreateByteMatchSetRequest) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null
&& other.getName().equals(this.getName()) == false)
return false;
if (other.getChangeToken() == null ^ this.getChangeToken() == null)
return false;
if (other.getChangeToken() != null
&& other.getChangeToken().equals(this.getChangeToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime
* hashCode
+ ((getChangeToken() == null) ? 0 : getChangeToken().hashCode());
return hashCode;
}
@Override
public CreateByteMatchSetRequest clone() {
return (CreateByteMatchSetRequest) super.clone();
}
}
|
[
"aws@amazon.com"
] |
aws@amazon.com
|
d8dddaf736af8552f683d3ab220fbf6dfe0f8b5e
|
0910327122a149aa546cb721fe51d84e5d9f4150
|
/yxx-streaming/src/main/java/com/yxx/framework/config/MySparkContextConfig.java
|
9ca4b75120261813e3cf045115b8514c9f071d56
|
[] |
no_license
|
HoldMe/yxx-project
|
538be14870941ba4f0a8442b9f3040ef7899b558
|
6145fd4e4c3a4bff4787ba51c8e58e863dbd1698
|
refs/heads/master
| 2022-12-22T16:11:39.694497
| 2021-02-19T00:58:36
| 2021-02-19T00:58:36
| 218,025,927
| 0
| 1
| null | 2022-12-15T23:55:50
| 2019-10-28T10:55:47
|
Java
|
UTF-8
|
Java
| false
| false
| 803
|
java
|
package com.yxx.framework.config;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* <p>
* desc
* </p>
*
* @author wangpan
* @date 2019/11/4
*/
@Configuration
public class MySparkContextConfig {
@Bean
@ConditionalOnMissingBean(SparkConf.class)
public SparkConf sparkConf(){
return new SparkConf().setAppName("spark_test").setMaster("local");
}
@Bean
@ConditionalOnMissingBean(JavaSparkContext.class)
public JavaSparkContext javaSparkContext() throws Exception {
return new JavaSparkContext(sparkConf());
}
}
|
[
"admin@example.com"
] |
admin@example.com
|
c565fd2c9513cc2301672e7c0511744dcf8259a2
|
76d1211346b45c1d84c11d6e45f2998e6d6dbd10
|
/user-src.tld/studiranje/ip/taglib/descript/FlipFlopTag.java
|
d9c70b4ffc3a4ea3784d4dc9bf482e95851bb850
|
[] |
no_license
|
mirko-27-93/007YIKorisnici
|
b8428342f52bd87346324f0dd81182fbef4b7211
|
8642abb2948da2f5d090f6d1cc9edcdbd4d0d7f5
|
refs/heads/master
| 2022-12-08T04:38:13.692457
| 2020-08-28T15:01:14
| 2020-08-28T15:01:14
| 291,072,006
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,778
|
java
|
package studiranje.ip.taglib.descript;
import java.io.ByteArrayInputStream;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;
import nu.xom.Builder;
import nu.xom.Document;
import nu.xom.Element;
import nu.xom.Elements;
import studiranje.ip.taglib.descript.tagcode.enviroment.FlipFlopDescribeEnviroment;
/**
* Таг који се користи за лакше постављање садржаја описа за неки елемент.
* @author Masinacc
* @version 1.0
*/
public class FlipFlopTag extends BodyTagSupport{
private static final long serialVersionUID = 6844367664908175825L;
private String elementId = "";
private String descId = "";
public String getElementId() {
return elementId;
}
public void setElementId(String elementId) {
if(elementId==null) elementId="";
this.elementId = elementId;
}
public String getDescId() {
return descId;
}
public void setDescId(String descId) {
if(descId==null) descId="";
this.descId = descId;
}
public boolean testElementId() {
if(elementId.trim().length()==0) return false;
for(char c: elementId.toCharArray()){
if(Character.isAlphabetic(c)) continue;
if(Character.isDigit(c)) continue;
if(c=='_') continue;
return false;
}
return true;
}
public boolean testDescId() {
if(descId.trim().length()==0) return false;
for(char c: descId.toCharArray()){
if(Character.isAlphabetic(c)) continue;
if(Character.isDigit(c)) continue;
if(c=='_') continue;
return false;
}
return true;
}
@Override
public int doStartTag() throws JspException{
if(pageContext.getAttribute("yi.tag.root.node")!=null) {
throw new JspException("DESC:Describe Tag - duplicate.");
}
pageContext.setAttribute("yi.tag.root.node", this);
pageContext.setAttribute("yi.tag.element.node", null);
pageContext.setAttribute("yi.tag.info.node", null);
return EVAL_BODY_AGAIN;
}
@Override
public int doEndTag() throws JspException {
if(!testDescId() || !testElementId())
throw new RuntimeException("DESC:DESCRIBE - ID names bad syntax. Valid is alphanumerics and downline.");
JspWriter out=pageContext.getOut();
String xmlHtmlContent = "<desc:describe xmlns:desc=\"http://www.yatospace.org/describe\">";
xmlHtmlContent+=bodyContent.getString();
xmlHtmlContent+="</desc:describe>";
try {
FlipFlopDescribeEnviroment schemarValidator = new FlipFlopDescribeEnviroment(xmlHtmlContent);
schemarValidator.exceptioningValidate();
Builder builder = new Builder();
Document document = builder.build(new ByteArrayInputStream(xmlHtmlContent.getBytes("UTF-8")));
Element root = document.getRootElement();
Elements nodes = root.getChildElements();
Element element = null;
Element info = null;
for(int i=0; i<nodes.size(); i++) {
Element node = nodes.get(i);
if(node.getQualifiedName().contentEquals("desc:element"))
element = node;
if(node.getQualifiedName().contentEquals("desc:info"))
info = node;
}
if(info==null) {
System.out.println(element.toXML());
out.print(element.toXML());
}else {
out.println("<div id='"+elementId+"' style='display:block' onclick='descript_flipflop_show(\""+elementId+"\", \""+descId+"\")'>"+element.toXML()+"</div>");
out.println("<div id='"+descId+"' style='display:none'><blockquote><p>"+info.toXML()+"</p></blockquote></div>");
}
}catch(Exception ex) {
throw new JspException(ex);
}finally {
pageContext.setAttribute("yi.tag.root.node", null);
pageContext.setAttribute("yi.tag.element.node", null);
pageContext.setAttribute("yi.tag.info.node", null);
}
return SKIP_BODY;
}
}
|
[
"mirko.vidakovic.2020.002@gmail.com"
] |
mirko.vidakovic.2020.002@gmail.com
|
65b72042d90bbea693c72cf228d79fd8a64f7917
|
804b645602f4ff11bba61d1f373813ecd7a130c1
|
/MouseControl/src/main/java/ch/unifr/pai/twice/multipointer/provider/client/MouseCursorTimeoutEvent.java
|
3ce6a40cb8298fbe08a417068ba90d39b8667e89
|
[] |
no_license
|
incidincer/twice-temp2
|
8d5d7d3b8c6ec6a3b981ef9a4cfdba2b06330311
|
a98f0bcdf105418595e70cc2a7ea613525407fe3
|
refs/heads/master
| 2016-09-11T08:37:17.646561
| 2015-07-28T01:40:14
| 2015-07-28T01:40:14
| 39,807,287
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,642
|
java
|
package ch.unifr.pai.twice.multipointer.provider.client;
/*
* Copyright 2013 Oliver Schmid
* 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.
*/
import ch.unifr.pai.twice.multipointer.provider.client.MouseCursorTimeoutEvent.Handler;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
/**
* An event notifying about timed out mouse pointers
*
* @author Oliver Schmid
*
*/
public class MouseCursorTimeoutEvent extends GwtEvent<Handler> {
boolean detached;
/**
* @return true if the cursor is detached from a uuid and therefore free to be used by another user or false if only the visibility timed out and the cursor
* is still assigned to the user.
*/
public boolean isDetached() {
return detached;
}
public static interface Handler extends EventHandler {
public void onMouseCursorTimeout(MouseCursorTimeoutEvent event);
}
public static final Type<Handler> TYPE = new Type<Handler>();
@Override
public Type<Handler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(Handler handler) {
handler.onMouseCursorTimeout(this);
}
}
|
[
"inci.dincer@unine.ch"
] |
inci.dincer@unine.ch
|
3c4e43465aee4cf249dfe640576cb681e5477ca6
|
aad9f1801fac79001caabde50a949b7f6812bd0f
|
/Semana 3 - FabricaAbstrataTemaInterface/src/fabrica/abstrata/botoes/FabricaPadrao.java
|
fd5aa65ee0eb538a8530add25d286882870d2c97
|
[] |
no_license
|
lukasg18/exercicios_POO2
|
0899f1dd9113fd27714ea7700dd634e4e706363d
|
13b8178571207265adbb848b9a58924e50fcc27c
|
refs/heads/master
| 2020-03-25T15:41:24.019557
| 2018-08-20T21:03:21
| 2018-08-20T21:03:21
| 143,896,407
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 344
|
java
|
package fabrica.abstrata.botoes;
import javax.swing.JButton;
/**
*
* @author harã heique
*/
public class FabricaPadrao extends FabricaAbstrataBotoes
{
@Override
public JButton criaBotaoOK()
{
return new JButton();
}
@Override
public JButton criaBotaoCancel()
{
return new JButton();
}
}
|
[
"lukas.gomes2010@gmail.com"
] |
lukas.gomes2010@gmail.com
|
07e0b6fc34b7cceb8155d25aa168218252538161
|
f77d2d84af7b1d555a96f5ab9f42f1b7c7abd60c
|
/src/_java/dsa/ComparatorLexicographic.java
|
4414f672376ee065941fb6430a13becf09d9d58d
|
[] |
no_license
|
pangpang20/data-structure
|
d8e43a2cf167c88a64d9128b165ed438f194d3e5
|
53a2f76919eda2add01f6e60bc40c4c13365d481
|
refs/heads/main
| 2023-05-01T01:43:06.359569
| 2021-05-26T07:14:23
| 2021-05-26T07:14:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 845
|
java
|
/******************************************************************************************
* Data Structures in C++
* ISBN: 7-302-33064-6 & 7-302-33065-3 & 7-302-29652-2 & 7-302-26883-3
* Junhui DENG, deng@tsinghua.edu.cn
* Computer Science & Technology, Tsinghua University
* Copyright (c) 2003-2020. All rights reserved.
******************************************************************************************/
/*
* 按照字典序确定平面点之间次序的比较器
*/
package dsa;
public class ComparatorLexicographic implements Comparator {
public int compare(Object a, Object b) throws ClassCastException {
int ax = ((Point2D) a).getX();
int ay = ((Point2D) a).getY();
int bx = ((Point2D) b).getX();
int by = ((Point2D) b).getY();
return (ax != bx) ? (ax - bx) : (ay - by);
}
}
|
[
"melodyhaya@gmail.com"
] |
melodyhaya@gmail.com
|
5cba80fc451e3bc3d9c544d9fc5e5715e7631e44
|
8819720c373fdf89bd28c7f35ff4e08a37959d33
|
/src/main/java/com/emergon/config/MyInterceptor.java
|
2a72489bd37f589c8dfc32d592981ec59a1f83ee
|
[] |
no_license
|
emergon/SpringMVCJavaBased
|
1592a2317fe7ebd4124a9c0120c12db367936a77
|
ab11d55b8382abadb858c9021b709ceb614d61a7
|
refs/heads/master
| 2022-12-28T03:43:59.411067
| 2019-12-11T13:01:30
| 2019-12-11T13:01:30
| 226,889,250
| 1
| 1
| null | 2022-12-16T14:51:13
| 2019-12-09T14:20:34
|
Java
|
UTF-8
|
Java
| false
| false
| 885
|
java
|
package com.emergon.config;
import com.emergon.entities.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class MyInterceptor extends HandlerInterceptorAdapter{
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
User user = (User)request.getSession().getAttribute("user");
boolean requestToLogin = request.getRequestURI().contains("login")||
request.getRequestURI().contains("logout");
if(!requestToLogin && (user == null||user.getUsername()==null)){
response.sendRedirect(request.getContextPath()+"/login");
}
}
}
|
[
"tasospatra@hotmail.com"
] |
tasospatra@hotmail.com
|
866ad95ca47a4bed3e02c7814b7ec77fcc26951f
|
fd49852c3426acf214b390c33927b5a30aeb0e0a
|
/aosp/javalib/android/graphics/drawable/TransitionDrawable.java
|
210746913caef205559a507b76fe420571c7bdfb
|
[] |
no_license
|
HanChangHun/MobilePlus-Prototype
|
fb72a49d4caa04bce6edb4bc060123c238a6a94e
|
3047c44a0a2859bf597870b9bf295cf321358de7
|
refs/heads/main
| 2023-06-10T19:51:23.186241
| 2021-06-26T08:28:58
| 2021-06-26T08:28:58
| 333,411,414
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,309
|
java
|
package android.graphics.drawable;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.os.SystemClock;
public class TransitionDrawable extends LayerDrawable implements Drawable.Callback {
private static final int TRANSITION_NONE = 2;
private static final int TRANSITION_RUNNING = 1;
private static final int TRANSITION_STARTING = 0;
private int mAlpha = 0;
private boolean mCrossFade;
private int mDuration;
private int mFrom;
private int mOriginalDuration;
private boolean mReverse;
private long mStartTimeMillis;
private int mTo;
private int mTransitionState = 2;
TransitionDrawable() {
this(new TransitionState(null, null, null), (Resources)null);
}
private TransitionDrawable(TransitionState paramTransitionState, Resources paramResources) {
super(paramTransitionState, paramResources);
}
private TransitionDrawable(TransitionState paramTransitionState, Drawable[] paramArrayOfDrawable) {
super(paramArrayOfDrawable, paramTransitionState);
}
public TransitionDrawable(Drawable[] paramArrayOfDrawable) {
this(new TransitionState(null, null, null), paramArrayOfDrawable);
}
LayerDrawable.LayerState createConstantState(LayerDrawable.LayerState paramLayerState, Resources paramResources) {
return new TransitionState((TransitionState)paramLayerState, this, paramResources);
}
public void draw(Canvas paramCanvas) {
boolean bool = true;
int i = this.mTransitionState;
if (i != 0) {
if (i == 1 && this.mStartTimeMillis >= 0L) {
float f = (float)(SystemClock.uptimeMillis() - this.mStartTimeMillis) / this.mDuration;
if (f >= 1.0F) {
bool = true;
} else {
bool = false;
}
f = Math.min(f, 1.0F);
i = this.mFrom;
this.mAlpha = (int)(i + (this.mTo - i) * f);
}
} else {
this.mStartTimeMillis = SystemClock.uptimeMillis();
bool = false;
this.mTransitionState = 1;
}
i = this.mAlpha;
boolean bool1 = this.mCrossFade;
LayerDrawable.ChildDrawable[] arrayOfChildDrawable = this.mLayerState.mChildren;
if (bool) {
if (!bool1 || i == 0)
(arrayOfChildDrawable[0]).mDrawable.draw(paramCanvas);
if (i == 255)
(arrayOfChildDrawable[1]).mDrawable.draw(paramCanvas);
return;
}
Drawable drawable = (arrayOfChildDrawable[0]).mDrawable;
if (bool1)
drawable.setAlpha(255 - i);
drawable.draw(paramCanvas);
if (bool1)
drawable.setAlpha(255);
if (i > 0) {
Drawable drawable1 = (arrayOfChildDrawable[1]).mDrawable;
drawable1.setAlpha(i);
drawable1.draw(paramCanvas);
drawable1.setAlpha(255);
}
if (!bool)
invalidateSelf();
}
public boolean isCrossFadeEnabled() {
return this.mCrossFade;
}
public void resetTransition() {
this.mAlpha = 0;
this.mTransitionState = 2;
invalidateSelf();
}
public void reverseTransition(int paramInt) {
long l1 = SystemClock.uptimeMillis();
long l2 = this.mStartTimeMillis;
long l3 = this.mDuration;
char c = 'ÿ';
if (l1 - l2 > l3) {
if (this.mTo == 0) {
this.mFrom = 0;
this.mTo = 255;
this.mAlpha = 0;
this.mReverse = false;
} else {
this.mFrom = 255;
this.mTo = 0;
this.mAlpha = 255;
this.mReverse = true;
}
this.mOriginalDuration = paramInt;
this.mDuration = paramInt;
this.mTransitionState = 0;
invalidateSelf();
return;
}
int i = this.mReverse ^ true;
this.mReverse = i;
this.mFrom = this.mAlpha;
paramInt = c;
if (i != 0)
paramInt = 0;
this.mTo = paramInt;
if (this.mReverse) {
l1 -= this.mStartTimeMillis;
} else {
l1 = this.mOriginalDuration - l1 - this.mStartTimeMillis;
}
this.mDuration = (int)l1;
this.mTransitionState = 0;
}
public void setCrossFadeEnabled(boolean paramBoolean) {
this.mCrossFade = paramBoolean;
}
public void showSecondLayer() {
this.mAlpha = 255;
this.mReverse = false;
this.mTransitionState = 2;
invalidateSelf();
}
public void startTransition(int paramInt) {
this.mFrom = 0;
this.mTo = 255;
this.mAlpha = 0;
this.mOriginalDuration = paramInt;
this.mDuration = paramInt;
this.mReverse = false;
this.mTransitionState = 0;
invalidateSelf();
}
static class TransitionState extends LayerDrawable.LayerState {
TransitionState(TransitionState param1TransitionState, TransitionDrawable param1TransitionDrawable, Resources param1Resources) {
super(param1TransitionState, param1TransitionDrawable, param1Resources);
}
public int getChangingConfigurations() {
return this.mChangingConfigurations;
}
public Drawable newDrawable() {
return new TransitionDrawable(this, (Resources)null);
}
public Drawable newDrawable(Resources param1Resources) {
return new TransitionDrawable(this, param1Resources);
}
}
}
/* Location: /home/chun/Desktop/temp/!/android/graphics/drawable/TransitionDrawable.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
|
[
"ehwjs1914@naver.com"
] |
ehwjs1914@naver.com
|
ba27bafaa0623586f3bc05569c7bcde380141efd
|
18afe6d7aeba352762f6a5d413e0c417390d8d1b
|
/roboto-examples/roboto-examples-springboot/src/main/java/roboto/examples/springboot/controller/BarController.java
|
ac61f25ff023d6497fb2030484ef9b5de967751e
|
[
"Apache-2.0"
] |
permissive
|
gregwhitaker/roboto
|
97dbe854dc330337a8ea07701fee62c4c21e5e27
|
81e05074fd29ca0f5d3bedbbce23c55051779d6c
|
refs/heads/master
| 2020-03-18T05:34:33.403138
| 2018-05-27T05:26:31
| 2018-05-27T05:26:31
| 134,349,691
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,467
|
java
|
/*
* Copyright 2018 Greg Whitaker
*
* 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 roboto.examples.springboot.controller;
import com.github.gregwhitaker.roboto.spring.annotation.DisallowRobots;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
/**
* Example controller with all methods excluded from robots.txt file.
*/
@Controller
@DisallowRobots
public class BarController {
// SEO is disabled for this endpoint due to the class-level @DenySEO annotation
@GetMapping("/bar/1")
public String bar1(Model model) {
model.addAttribute("message", "This is Bar1");
return "bar";
}
// SEO is disabled for this endpoint due to the class-level @DenySEO annotation
@GetMapping("/bar/2")
public String bar2(Model model) {
model.addAttribute("message", "This is Bar2");
return "bar";
}
}
|
[
"gwhitake@gmail.com"
] |
gwhitake@gmail.com
|
3c6c414122b9b19baa0caf4cf519279dc20c0bf5
|
f93013d9464a50ab9944f270177ad21139e7391c
|
/Production_ERP/src/main/java/com/nosuchteam/service/WorkService.java
|
b9f2fb412064a9587adf7bdc3d68bbb0f03c9255
|
[] |
no_license
|
San-Qian/Production_ERP
|
6100c435bda7d111813def74ded8022391035601
|
38c953f31b4edc808fd4e7942376c8d759382a64
|
refs/heads/master
| 2020-04-09T17:48:24.003112
| 2018-12-14T13:44:23
| 2018-12-14T13:44:23
| 160,491,822
| 3
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 455
|
java
|
package com.nosuchteam.service;
import com.nosuchteam.bean.Work;
import com.nosuchteam.util.commons.PageInfo;
/**
* @Author: Evan
* @Date: 2018/12/5 15:59
* @Description:
*/
public interface WorkService {
void save(Work work) throws Exception;
PageInfo selectByPage(Work work, Integer page, Integer rows);
void update(Work work) throws Exception;
void delete(String[] ids) throws Exception;
Work selectById(String workId);
}
|
[
"605833491@qq.com"
] |
605833491@qq.com
|
9b8c34f48b51ccf6703193d3732acdc116b81c38
|
6dc3bdad488314ed86b04559ac3a7208778d7963
|
/app/src/main/java/com/example/dickysuryo/moviecatalogue/Model/DetailPopular_Model.java
|
609ed36fb1e8954197ae130f7a0fa136772e0616
|
[] |
no_license
|
dickysuryos/dicodingMovie
|
3f52b008db75c081d57b6c43ee8e28315c630bd3
|
37fe74501385071df2ae46a73a055e95ece5df4c
|
refs/heads/master
| 2020-07-26T19:29:01.027006
| 2019-10-05T15:22:24
| 2019-10-05T15:22:24
| 208,745,607
| 0
| 2
| null | 2019-10-08T16:31:17
| 2019-09-16T08:12:48
|
Java
|
UTF-8
|
Java
| false
| false
| 5,651
|
java
|
package com.example.dickysuryo.moviecatalogue.Model;
import java.util.ArrayList;
import java.util.List;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class DetailPopular_Model implements Parcelable
{
@SerializedName("vote_count")
@Expose
private Integer voteCount;
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("video")
@Expose
private Boolean video;
@SerializedName("vote_average")
@Expose
private Double voteAverage;
@SerializedName("title")
@Expose
private String title;
@SerializedName("popularity")
@Expose
private Double popularity;
@SerializedName("poster_path")
@Expose
private String posterPath;
@SerializedName("original_language")
@Expose
private String originalLanguage;
@SerializedName("original_title")
@Expose
private String originalTitle;
@SerializedName("backdrop_path")
@Expose
private String backdropPath;
@SerializedName("adult")
@Expose
private Boolean adult;
@SerializedName("overview")
@Expose
private String overview;
@SerializedName("release_date")
@Expose
private String releaseDate;
public final static Parcelable.Creator<DetailPopular_Model> CREATOR = new Creator<DetailPopular_Model>() {
@SuppressWarnings({
"unchecked"
})
public DetailPopular_Model createFromParcel(Parcel in) {
return new DetailPopular_Model(in);
}
public DetailPopular_Model[] newArray(int size) {
return (new DetailPopular_Model[size]);
}
}
;
protected DetailPopular_Model(Parcel in) {
this.voteCount = ((Integer) in.readValue((Integer.class.getClassLoader())));
this.id = ((Integer) in.readValue((Integer.class.getClassLoader())));
this.video = ((Boolean) in.readValue((Boolean.class.getClassLoader())));
this.voteAverage = ((Double) in.readValue((Double.class.getClassLoader())));
this.title = ((String) in.readValue((String.class.getClassLoader())));
this.popularity = ((Double) in.readValue((Double.class.getClassLoader())));
this.posterPath = ((String) in.readValue((String.class.getClassLoader())));
this.originalLanguage = ((String) in.readValue((String.class.getClassLoader())));
this.originalTitle = ((String) in.readValue((String.class.getClassLoader())));
this.backdropPath = ((String) in.readValue((String.class.getClassLoader())));
this.adult = ((Boolean) in.readValue((Boolean.class.getClassLoader())));
this.overview = ((String) in.readValue((String.class.getClassLoader())));
this.releaseDate = ((String) in.readValue((String.class.getClassLoader())));
}
public DetailPopular_Model() {
}
public Integer getVoteCount() {
return voteCount;
}
public void setVoteCount(Integer voteCount) {
this.voteCount = voteCount;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Boolean getVideo() {
return video;
}
public void setVideo(Boolean video) {
this.video = video;
}
public Double getVoteAverage() {
return voteAverage;
}
public void setVoteAverage(Double voteAverage) {
this.voteAverage = voteAverage;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Double getPopularity() {
return popularity;
}
public void setPopularity(Double popularity) {
this.popularity = popularity;
}
public String getPosterPath() {
return posterPath;
}
public void setPosterPath(String posterPath) {
this.posterPath = posterPath;
}
public String getOriginalLanguage() {
return originalLanguage;
}
public void setOriginalLanguage(String originalLanguage) {
this.originalLanguage = originalLanguage;
}
public String getOriginalTitle() {
return originalTitle;
}
public void setOriginalTitle(String originalTitle) {
this.originalTitle = originalTitle;
}
public String getBackdropPath() {
return backdropPath;
}
public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath;
}
public Boolean getAdult() {
return adult;
}
public void setAdult(Boolean adult) {
this.adult = adult;
}
public String getOverview() {
return overview;
}
public void setOverview(String overview) {
this.overview = overview;
}
public String getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(voteCount);
dest.writeValue(id);
dest.writeValue(video);
dest.writeValue(voteAverage);
dest.writeValue(title);
dest.writeValue(popularity);
dest.writeValue(posterPath);
dest.writeValue(originalLanguage);
dest.writeValue(originalTitle);
dest.writeValue(backdropPath);
dest.writeValue(adult);
dest.writeValue(overview);
dest.writeValue(releaseDate);
}
public int describeContents() {
return 0;
}
}
|
[
"dicky.suryo@detik.com"
] |
dicky.suryo@detik.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.