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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1af7d7fc124f1f326c5c14676445a231c0d03553 | 90d320aa661232a653e3652d8ac48b34ba2f22f0 | /src/ch10/E18.java | 6a8b7aba49d9fb6b87f2f34150c35e3f58b725f5 | [] | no_license | Broken-pants/ThinkingInJava | 871441e804b640664636093d5753f66d8c1f2b17 | 04e8de5e28a7c5d73a187b81017f7c12f371d10f | refs/heads/master | 2020-05-30T17:01:34.701660 | 2019-03-15T07:33:35 | 2019-03-15T07:33:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package ch10;
interface E18I {
public void print();
}
class E18A {
static E18I getE18I() {
return new E18I() {
public void print() {
System.out.println("E18A E18I");
}
};
}
}
public class E18 {
public static void main(String[] args) {
E18A ea = new E18A();
ea.getE18I().print();
}
}/* Output:
E18A E18I
*///:~
| [
"yangxian.cn@gmail.com"
] | yangxian.cn@gmail.com |
e2e435496fb4df2081fbeb371a1a62212e38e3e6 | a20aba21d0150c4a98c7f71997cfff06db3d1468 | /generators/hibernate/tests/org.obeonetwork.dsl.entity.gen.java.hibernate.tests/src/inheritance_associations/org/obeonetwork/sample/inheritanceassociations/IClass101ENDDao.java | 3579e02e50ad5604a4fdb0cc25c5bfce7954cda9 | [] | no_license | MathieuVenisse/InformationSystem | 1bf159a775b956c7ff23adba66690c25ad18a161 | d677a80c97145ed16f7616ab6c553c4c632116e1 | refs/heads/master | 2021-01-20T21:20:11.482505 | 2012-12-04T14:07:55 | 2012-12-04T14:07:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,798 | java | package org.obeonetwork.sample.inheritanceassociations;
// Start of user code for import
import java.util.Collection;
import org.obeonetwork.fwk.dao.exception.DaoException;
import org.obeonetwork.sample.inheritanceassociations.Class101END;
// End of user code for import
/**
* This class provides the data access layer to the Class_1_01_END entity class.<br/>
* This is the interface which represent the contrat of the DAO access.
*/
public interface IClass101ENDDao {
/**
* Create a new element.
* @param class101END Element to create.
* @throws DaoException If a Dao problem occurs.
*/
public void createClass101END(Class101END class101END) throws DaoException;
/**
* Update an existing element.
* @param class101END Element to update.
* If the element has an id, it may use it.
* @throws DaoException If a Dao problem occurs.
*/
public void updateClass101END(Class101END class101END) throws DaoException;
/**
* Delete an element.
* Only id can be used to find which element must be deleted.
* @param class101END Element which will be delete.
* @throws DaoException If a Dao problem occurs.
*/
public void deleteClass101END(Class101END class101END) throws DaoException;
/**
* Find all elements.
* @return A list with all elements, without any filter.
* @throws DaoException If a Dao problem occurs.
*/
public Collection<Class101END> findAllClass101ENDs() throws DaoException;
/**
* Find one entity by its primary key.
* @param id The PK of the entity.
* @return The entity found.
* @throws DaoException If a Dao problem occurs.
*/
public Class101END findClass101ENDById(String id) throws DaoException;
//Start of user code for technicals dao access api
//End of user code for technical dao access api
} | [
"goulwen.lefur@obeo.fr"
] | goulwen.lefur@obeo.fr |
c1c658212d18c45065114305ed4e093c8eab246d | 31cc753b01889c2679981d5d73d7ac3ed32f4a30 | /aigou-product-parent/aigou-product-service-provider/src/main/java/cn/itsource/aigou/mapper/ProductTypeMapper.java | 76d2fbfedf8a6c439bc73561cfc02edc7e0406a7 | [] | no_license | luguoyizhiniu/aigou-parent | 3dd87cce3d44d99c7b0ff475c79ca1c40d0d3958 | 9c449591eda2c09078a98be7d1b8a65e1f550098 | refs/heads/master | 2020-05-02T17:50:18.677299 | 2019-04-02T15:08:05 | 2019-04-02T15:08:05 | 178,110,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package cn.itsource.aigou.mapper;
import cn.itsource.aigou.domain.ProductType;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* 商品目录 Mapper 接口
* </p>
*
* @author ztg
* @since 2019-03-31
*/
public interface ProductTypeMapper extends BaseMapper<ProductType> {
List<ProductType> selectByPid(Long pid);
}
| [
"1073842437@qq.com"
] | 1073842437@qq.com |
a9e207ddbe581d7b0443fa09bf2f41881d5b82b6 | 204a32a720f0aa3274d0fd3755a7608bd7733788 | /app/src/main/java/com/infoservices/lue/util/NetworkUtil.java | f351515ab89d0d77238be91e1312a48e0f76f03c | [] | no_license | Ritesh786/CONDOMANAGEMENT123 | 52c42f02f97cf3ddc37ea6101eb7db368c3adec1 | 903d5b3a2694da75c76018d96939bc79aa84a2db | refs/heads/master | 2021-01-23T12:32:06.667371 | 2017-12-18T07:50:21 | 2017-12-18T07:50:21 | 93,165,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package com.infoservices.lue.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class NetworkUtil {
public static final boolean isOnline(Context context){
ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null)
for (int i = 0; i < info.length; i++)
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
return false;
}
}
| [
"chandan@lueinfoservices.com"
] | chandan@lueinfoservices.com |
1751d7d28a211df14c0d5eb7b4316deadaeb28de | a43d4202628ecb52e806d09f0f3dc1f5bab3ef4f | /src/main/java/pnc/mesadmin/dto/GetSkillInfo/GetSkillInfoResB.java | 211a63c5df90e53d46fd877788a9d910fc5712fe | [] | no_license | pnc-mes/base | b88583929e53670340a704f848e4e9e2027f1334 | 162135b8752b4edc397b218ffd26664929f6920d | refs/heads/main | 2023-01-07T22:06:10.794300 | 2020-10-27T07:47:20 | 2020-10-27T07:47:20 | 307,621,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,196 | java | package pnc.mesadmin.dto.GetSkillInfo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
/**
* 公司名称:驭航信息技术(上海)有限公司
* 系统名称:PNC-MES管理系统
* 子系统名称:获取序号管理信息DTO返回业务数据实体类Body
* 创建人:ZC
* 创建时间:2017-06-07
* 修改人:
* 修改时间:
*/
public class GetSkillInfoResB implements Serializable{
@JsonProperty("MsgCode")
private String MsgCode;
@JsonProperty("MsgDes")
private String MsgDes;
@JsonProperty("Data")
private GetSkillInfoResD Data;
@JsonIgnore
public String getMsgCode() {
return MsgCode;
}
@JsonIgnore
public void setMsgCode(String msgCode) {
MsgCode = msgCode;
}
@JsonIgnore
public String getMsgDes() {
return MsgDes;
}
@JsonIgnore
public void setMsgDes(String msgDes) {
MsgDes = msgDes;
}
@JsonIgnore
public GetSkillInfoResD getData() {
return Data;
}
@JsonIgnore
public void setData(GetSkillInfoResD data) {
Data = data;
}
}
| [
"95887577@qq.com"
] | 95887577@qq.com |
de23e0ad8981abe0ba20a43d28eeafd812b5ede1 | 89669855506cbe2d0336cd01fcbb6fd5e9085636 | /Lesson 03 eldar/src/f/whileLoop/Demo1.java | 5b10d78ef7048b019fbe60717312e88e2f267998 | [] | no_license | gadipo/822-121 | 4e006cc0a551ec6ac1ad03771f3062c877185e2a | b4c8642726620d55bf16700867b876702e18e32f | refs/heads/master | 2020-11-27T13:56:42.763719 | 2019-12-18T14:13:27 | 2019-12-18T14:13:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package f.whileLoop;
public class Demo1 {
public static void main(String[] args) {
int c = 1;
// while loop
while (c <= 3) {
System.out.println(c);
c++;
}
System.out.println("===============");
// write a loop that prints the numbers 5 to 15
c = 5;
while (c <= 15) {
System.out.println(c++);
}
}
}
| [
"enosh.tsur@haaretz.co.il"
] | enosh.tsur@haaretz.co.il |
247316a3b727a9fd899306efb83aad9a618bc5c6 | 96f8d42c474f8dd42ecc6811b6e555363f168d3e | /budejie/sources/com/google/gson/internal/Streams.java | e7fa0308460816ef6da7638bfa6e5488ec11779a | [] | no_license | aheadlcx/analyzeApk | 050b261595cecc85790558a02d79739a789ae3a3 | 25cecc394dde4ed7d4971baf0e9504dcb7fabaca | refs/heads/master | 2020-03-10T10:24:49.773318 | 2018-04-13T09:44:45 | 2018-04-13T09:44:45 | 129,332,351 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,700 | java | package com.google.gson.internal;
import com.google.gson.JsonElement;
import com.google.gson.JsonIOException;
import com.google.gson.JsonNull;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.io.Writer;
public final class Streams {
private static final class AppendableWriter extends Writer {
private final Appendable appendable;
private final CurrentWrite currentWrite = new CurrentWrite();
static class CurrentWrite implements CharSequence {
char[] chars;
CurrentWrite() {
}
public int length() {
return this.chars.length;
}
public char charAt(int i) {
return this.chars[i];
}
public CharSequence subSequence(int i, int i2) {
return new String(this.chars, i, i2 - i);
}
}
AppendableWriter(Appendable appendable) {
this.appendable = appendable;
}
public void write(char[] cArr, int i, int i2) throws IOException {
this.currentWrite.chars = cArr;
this.appendable.append(this.currentWrite, i, i + i2);
}
public void write(int i) throws IOException {
this.appendable.append((char) i);
}
public void flush() {
}
public void close() {
}
}
private Streams() {
throw new UnsupportedOperationException();
}
public static JsonElement parse(JsonReader jsonReader) throws JsonParseException {
Object obj = 1;
try {
jsonReader.peek();
obj = null;
return (JsonElement) TypeAdapters.JSON_ELEMENT.read(jsonReader);
} catch (Throwable e) {
if (obj != null) {
return JsonNull.INSTANCE;
}
throw new JsonSyntaxException(e);
} catch (Throwable e2) {
throw new JsonSyntaxException(e2);
} catch (Throwable e22) {
throw new JsonIOException(e22);
} catch (Throwable e222) {
throw new JsonSyntaxException(e222);
}
}
public static void write(JsonElement jsonElement, JsonWriter jsonWriter) throws IOException {
TypeAdapters.JSON_ELEMENT.write(jsonWriter, jsonElement);
}
public static Writer writerForAppendable(Appendable appendable) {
return appendable instanceof Writer ? (Writer) appendable : new AppendableWriter(appendable);
}
}
| [
"aheadlcxzhang@gmail.com"
] | aheadlcxzhang@gmail.com |
a4be90212271a71e2db7f8f19a9119ae28d72385 | 22527752ed4f2a6f54b507c9aaa193783fc0e6fc | /app/src/main/java/com/webabcd/androiddemo/view/button/ImageButtonDemo1.java | c4c68a8151f7bdfb35960b103ceb9ac99de59b75 | [] | no_license | webabcd/AndroidDemo | 1a9df344999548fde70cf32dd5677b045fd57d7f | 02031106c66b359162f32f6564c557f708cea593 | refs/heads/master | 2023-08-04T11:23:22.189782 | 2023-07-26T03:06:16 | 2023-07-26T03:06:16 | 153,596,772 | 36 | 8 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | /**
* ImageButton - 图片按钮控件(继承自 ImageView)
* setClickable(boolean clickable) - 指定按钮是否可单击(如果要指定为 false 的话,需要在 setOnClickListener() 方法之后指定才会生效)
* setOnClickListener(OnClickListener l) - 指定单击事件的回调
*
*
* ImageButton 和 Button 差不多(就是基类不一样,一个是 TextView 一个是 ImageView),详见 Button 的介绍吧
*/
package com.webabcd.androiddemo.view.button;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;
import com.webabcd.androiddemo.R;
public class ImageButtonDemo1 extends AppCompatActivity {
private ImageButton _imageButton1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_button_imagebuttondemo1);
_imageButton1 = (ImageButton) findViewById(R.id.imageButton1);
sample();
}
private void sample() {
_imageButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(ImageButtonDemo1.this, "imageButton1 clicked", Toast.LENGTH_SHORT).show();
}
});
}
}
| [
"webabcd@hotmail.com"
] | webabcd@hotmail.com |
344e7b0c234fa4612e16271a3e96075a904ed953 | f587402b4f84d31432e30ef863b5a0b25c49726d | /runtime/src/main/java/io/quarkiverse/hibernate/types/jackson/JsonNodeBinaryType.java | d30fd372c70856d39cb699e35f24503b70593ec6 | [
"Apache-2.0"
] | permissive | Becheslav/quarkus-hibernate-types | b853fd934ea5796ee70d8eecf891adef47ebffac | 35b9f0b1f2e7f8c4c575646994fcfcc9b516afcf | refs/heads/master | 2023-07-06T21:57:27.989316 | 2021-05-03T16:55:28 | 2021-05-03T16:55:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,069 | java | package io.quarkiverse.hibernate.types.jackson;
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import com.fasterxml.jackson.databind.JsonNode;
import io.quarkiverse.hibernate.types.json.JsonTypes;
import io.quarkiverse.hibernate.types.json.impl.JsonBinarySqlTypeDescriptor;
import io.quarkiverse.hibernate.types.json.impl.JsonObjectTypeDescriptor;
/**
* Maps a JSON {@link JsonNode} object on a JSON column type that is managed via
* {@link java.sql.PreparedStatement#setObject(int, Object)} at JDBC Driver level. For instance, if you are using PostgreSQL,
* you should be using {@link JsonNodeBinaryType} to map both {@code jsonb} and {@code json} column types to a Jackson
* {@link JsonNode} object.
*/
public class JsonNodeBinaryType extends AbstractSingleColumnStandardBasicType<JsonNode> {
public JsonNodeBinaryType() {
super(JsonBinarySqlTypeDescriptor.INSTANCE,
new JsonObjectTypeDescriptor<JsonNode>(JsonNode.class));
}
public String getName() {
return JsonTypes.JSON_OBJECT_BIN;
}
}
| [
"andrej@lorislab.org"
] | andrej@lorislab.org |
548897c1d072436a8e5647ac60ccecc1e815f7db | 7e7aca21cae5521fe211b54bc0ec2e376872f77b | /src/main/java/online/mengxun/server/controller/DbSelectController.java | e21647b7ebacf856fe537ed5c5cbaad0f89fd650 | [] | no_license | aaha-star/cxsj4 | c73b05cb8923d06ab585a7433379b602416c17ad | 119df77a131e108b9ade115bde99116ccd6cd1ed | refs/heads/master | 2023-03-28T02:46:26.465555 | 2021-03-22T17:06:06 | 2021-03-22T17:06:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,634 | java | package online.mengxun.server.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import online.mengxun.server.client.DatabaseClient;
import online.mengxun.server.entity.DbConfig;
import online.mengxun.server.entity.DbDriver;
import online.mengxun.server.entity.DbSearchRecord;
import online.mengxun.server.model.DbSelectModel;
import online.mengxun.server.reposity.DbConfigRepository;
import online.mengxun.server.reposity.DbDriverRepository;
import online.mengxun.server.reposity.DbSearchRecordRepository;
import online.mengxun.server.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.sql.Connection;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Api(tags = "数据库查询模块")
@RestController
@RequestMapping("/select")
public class DbSelectController {
@Autowired
private DbConfigRepository dbConfigRepository;
@Autowired
private DbDriverRepository dbDriverRepository;
@Autowired
private DbSearchRecordRepository dbSearchRecordRepository;
@ApiOperation(value = "获取查询结果")
@PostMapping("/")
public Response getSelectResult(@RequestHeader("Authorization") String openId, @Valid @RequestBody DbSelectModel.GetSelectResult select){
try{
String dbId = select.getDbId();
String srSql = select.getSrSql();
//数据库id校验
if (!dbConfigRepository.existsById(dbId)) {
return Response.error("该数据库配置不存在");
}
if (!dbConfigRepository.existsByDbIdAndOpenId(dbId,openId)){
return Response.error("您没有获取数据库的配置信息的权限");
}
//数据库语句校验,只能查询
if(!select.getSrSql().substring(0,6).equalsIgnoreCase("SELECT")){
return Response.error("只能提交select语句");
}
DbConfig dbConfig = dbConfigRepository.getOne(dbId);
DbDriver dbDriver = dbDriverRepository.getOne(dbConfig.getDbDriverId());
DbSearchRecord dbSearchRecord = new DbSearchRecord();
Connection conn = DatabaseClient.getConnection(dbConfig.getDbIp(),dbConfig.getDbPort().toString(),dbConfig.getDbName(),dbConfig.getDbUser(),dbConfig.getDbPwd(),dbDriver.getDriverName(),dbDriver.getDriverType());
if (conn == null){
dbSearchRecord.setSrId(UUID.randomUUID().toString());
dbSearchRecord.setSrConnected(false);
dbSearchRecord.setOpenId(openId);
dbSearchRecord.setSrSql(srSql);
dbSearchRecord.setCreated(new Date());
dbSearchRecord.setSrResult(false);
dbSearchRecordRepository.save(dbSearchRecord);
return Response.error("数据库连接失败");
}
List selectResultData = DatabaseClient.selectData(conn,srSql);
System.out.println(selectResultData);
dbSearchRecord.setSrId(UUID.randomUUID().toString());
dbSearchRecord.setSrConnected(true);
dbSearchRecord.setOpenId(openId);
dbSearchRecord.setSrSql(srSql);
dbSearchRecord.setCreated(new Date());
dbSearchRecord.setSrResult(true);
dbSearchRecordRepository.save(dbSearchRecord);
return Response.success("查询成功",selectResultData);
}catch (Exception e){
e.printStackTrace();
return Response.error("查询失败");
}
}
}
| [
"54832685+mengxun1437@users.noreply.github.com"
] | 54832685+mengxun1437@users.noreply.github.com |
3f0781d3fdee7f48277fe94c02e447867afe5950 | ff24082b355af2b0abee4919e5529dc94850f4a4 | /src/wordcram/ProcessingWordRenderer.java | 4b5c6b52e787acbca5ebd83f356cef7eb34341cf | [
"Apache-2.0"
] | permissive | firefaith/WordCram | 85ae97e5d92bd157e9c31166e2ece26a4e4658d3 | 1ab2bddd6d62e033d7f559195c732c9800a86b0a | refs/heads/master | 2020-12-30T21:45:43.775558 | 2013-11-02T21:08:31 | 2013-11-02T21:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,482 | java | package wordcram;
/*
Copyright 2013 Daniel Bernier
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 java.awt.Color;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.GeneralPath;
import processing.core.PGraphics;
import processing.core.PGraphicsJava2D;
class ProcessingWordRenderer implements WordRenderer {
PGraphics destination;
ProcessingWordRenderer(PGraphics destination) {
this.destination = destination;
}
public int getWidth() {
return destination.width;
}
public int getHeight() {
return destination.height;
}
public void drawWord(EngineWord word, Color color) {
GeneralPath path2d = new GeneralPath(word.getShape());
// Graphics2D g2 = (Graphics2D)destination.image.getGraphics();
Graphics2D g2 = ((PGraphicsJava2D)destination).g2;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(color);
g2.fill(path2d);
}
public void finish() {}
} | [
"danbernier@gmail.com"
] | danbernier@gmail.com |
64471f2beb3317c3ba7aebb14a58b34a7e6645eb | 8f44d55533bb099d0eded35baef8af9df2682fbf | /src/main/java/de/hterhors/obie/core/tools/pdfToText/pdf2htmlex/Pdf2HtmlExExtractionInteractive.java | 1c30f3a72ca51674cbc530df0735aba55fbbde03 | [
"Apache-2.0"
] | permissive | hterhors/OBIECore | 77ac50c9c366b3398409ee96cce2cf2b80483166 | c0a06223db68638f3e81ffc4a2d02eb51b339b41 | refs/heads/master | 2020-03-28T14:17:34.002186 | 2019-03-29T10:25:09 | 2019-03-29T10:25:09 | 148,474,265 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,502 | java | package de.hterhors.obie.core.tools.pdfToText.pdf2htmlex;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
public class Pdf2HtmlExExtractionInteractive {
static final Pattern fontSizePattern = Pattern.compile("(fs[0123456789abcdef])");
static final Pattern fontFamilyPattern = Pattern.compile("(ff[0123456789abcdef])");
static final Pattern fontColorPattern = Pattern.compile("(fc[0123456789abcdef])");
static final Pattern spanTextPattern = Pattern.compile("<span class=\"(?<class>.*?)\">(?<text>.*?)<");
final static private String BAD_CHAR = "[^\\x20-\\x7E]+";
/**
* font name to base64
*
* ff0 = H4O2gKHjhFfjO489250//hfjgkdoj5638badlg ....
*/
static final private Map<String, String> fontToBase64 = new HashMap<>();
/**
* base64 to char mapping;
*/
static final private Map<String, Map<String, String>> base64ToCharMapping = new HashMap<>();
static private String textFontFamily;
public static void main(String[] args) throws IOException, InterruptedException {
final String file = "pdf2htmlex/res/html/Okutan et al.html";
final String mappingFileName = "pdf2htmlex/res/base64Mapping";
List<String> mappingList = Files.readAllLines(new File(mappingFileName).toPath());
mappingListToMap(mappingList);
Document doc = Jsoup.parse(new File(file), "utf-8");
extractFonts(fontToBase64, doc.html());
for (String thisBase64 : fontToBase64.values()) {
if (!base64ToCharMapping.containsKey(thisBase64)) {
base64ToCharMapping.put(thisBase64, new HashMap<>());
System.out.println("Add new font to mapping file... " + thisBase64.substring(0, 50) + "[...]");
} else {
System.out.println("Found font in mapping file... " + thisBase64.substring(0, 50) + "[...]");
}
}
textFontFamily = getTextSpecs(fontFamilyPattern, doc);
String textFontSize = getTextSpecs(fontSizePattern, doc);
String textFontColor = getTextSpecs(fontColorPattern, doc);
String currentFontFamily = null;
String currentFontSize = null;
String currentFontColor = null;
String lastNonTextFontSize = null;
String lastTextFontSize = null;
final StringBuffer documentText = new StringBuffer();
List<Element> elements = doc.body().getAllElements();
List<String> documentSentences = new ArrayList<>();
for (int i = 0; i < elements.size(); i++) {
Element element = elements.get(i);
Matcher fontFamily = fontFamilyPattern.matcher(element.attr("class"));
if (fontFamily.find()) {
currentFontFamily = fontFamily.group();
}
String text = listToString(cleanedTextChunks(currentFontFamily, element));
documentSentences.add(text);
if (text.trim().isEmpty())
continue;
System.out.println(text);
}
System.out.println("######DONE######");
Thread.sleep(1000);
for (int i = 0; i < elements.size(); i++) {
Element element = elements.get(i);
Matcher fontFamily = fontFamilyPattern.matcher(element.attr("class"));
Matcher fontSize = fontSizePattern.matcher(element.attr("class"));
Matcher fontColor = fontColorPattern.matcher(element.attr("class"));
if (fontFamily.find()) {
currentFontFamily = fontFamily.group();
}
if (fontSize.find()) {
currentFontSize = fontSize.group();
}
if (fontColor.find()) {
currentFontColor = fontColor.group();
}
if (currentFontFamily == null)
continue;
if (element.textNodes().isEmpty())
continue;
// System.out.println("element class types: " +
// element.attr("class"));
// System.out.println(element);
// System.out.println("___________");
// if (!currentFontFamily.equals(textFontFamily)) {
// documentText.append("");
// continue;
// }
// if (!currentFontSize.equals(textFontSize)) {
// documentText.append("");
// continue;
// }
String text = documentSentences.get(i);
// listToString(textNodes(currentFontFamily, element));
if (!text.trim().isEmpty()) {
// System.out.println("current line: " + currentFontFamily + " :
// " + text);
String delimiter = "";
String preDelimiter = "";
final String nextText = documentSentences.get(i + 1);
if (text.endsWith("-")) {
text = text.substring(0, text.length() - 1);
delimiter = "";
} else {
if (text.length() <= 3) {
// final String nextText =
// listToString(textNodes(currentFontFamily,
// elements.get(i + 1)));
if (nextText.length() <= 3) {
if (currentFontColor.equals(textFontColor)) {
delimiter = "";
} else {
delimiter = " ";
}
} else {
delimiter = "\n";
}
} else if (currentFontSize != null && currentFontSize.equals(textFontSize)) {
// final String nextText =
// listToString(textNodes(currentFontFamily,
// elements.get(i + 1)));
if (nextText.length() <= 3) {
if (currentFontColor.equals(textFontColor)) {
delimiter = " ";
} else {
delimiter = "\n";
}
} else {
delimiter = "\n";
}
} else if (currentFontSize != null && !currentFontSize.equals(lastTextFontSize)) {
preDelimiter = " ";
} else if (currentFontSize != null && currentFontSize.equals(lastNonTextFontSize)) {
delimiter = "\n";
} else {
delimiter = "\n";
}
if (currentFontSize != null && !currentFontSize.equals(textFontSize))
lastNonTextFontSize = currentFontSize;
}
lastTextFontSize = currentFontSize;
documentText.append(preDelimiter);
documentText.append(text);
documentText.append(delimiter);
}
}
System.out.println("Write data to mapping file...");
PrintStream mappingFilePrintStream = new PrintStream(new File("pdf2htmlex/res/base64Mapping"));
for (Entry<String, Map<String, String>> string : base64ToCharMapping.entrySet()) {
System.out.print(".");
Thread.sleep(80);
final String base64 = string.getKey();
mappingFilePrintStream.println("base64\t" + base64);
for (Entry<String, String> string2 : string.getValue().entrySet()) {
final String badChar = string2.getKey();
final String correctChar = string2.getValue();
mappingFilePrintStream.println(badChar + "\t" + correctChar);
}
mappingFilePrintStream.println();
mappingFilePrintStream.println();
}
System.out.println();
System.out.println("####DONE####");
System.out.println();
System.out.println();
// System.out.println(documentText);
}
private static void mappingListToMap(List<String> mappingList) {
String key = null;
String bytes = null;
String charMapping = null;
for (String line : mappingList) {
if (line.trim().isEmpty())
continue;
if (line.startsWith("base64")) {
key = line.split("\t")[1];
base64ToCharMapping.putIfAbsent(key, new HashMap<>());
} else {
bytes = line.split("\t")[0];
charMapping = line.split("\t").length == 2 ? line.split("\t")[1] : "";
base64ToCharMapping.get(key).put(bytes, charMapping);
}
}
}
static final private Pattern fontBase64Pattern = Pattern.compile(
"@font-face\\{font-family:(?<ff>ff[0-9abcdef]);src:url\\('data:application\\/font-woff;base64,(?<base64>.*)'\\)");
private static void extractFonts(Map<String, String> map, String html) {
Matcher matcher = fontBase64Pattern.matcher(html);
while (matcher.find()) {
final String fontFam = matcher.group("ff");
final String base64 = matcher.group("base64");
map.put(fontFam, base64);
}
}
private static String getTextSpecs(Pattern p, Document doc) {
Map<String, Integer> classCounter = new HashMap<>();
for (Element element : doc.body().getAllElements()) {
if (!element.getElementsByTag("div").isEmpty()) {
Matcher fontFamily = p.matcher(element.attr("class"));
if (!fontFamily.find())
continue;
String classString = fontFamily.group();
classCounter.put(classString, classCounter.getOrDefault(classString, 0) + 1);
}
}
int maxOccurrence = 0;
String textFontFamily = null;
for (Entry<String, Integer> classCount : classCounter.entrySet()) {
if (classCount.getValue() > maxOccurrence) {
maxOccurrence = classCount.getValue();
textFontFamily = classCount.getKey();
}
}
System.out.println("maxOccuringClass = " + textFontFamily);
classCounter.entrySet().forEach(System.out::println);
return textFontFamily;
}
private static String listToString(List<String> textNodes) {
final StringBuffer text = new StringBuffer();
for (String string : textNodes) {
text.append(Normalizer.normalize(string, Form.NFKC));
}
return text.toString();
}
public static List<String> cleanedTextChunks(final String currentFontFamily, Element element) {
List<String> textNodes = new ArrayList<>();
for (final Node node : element.childNodes()) {
if (node instanceof TextNode) {
// System.out.println("TextNode = " + node);
final String text = ((TextNode) node).getWholeText().replaceAll(" ", "");
if (text.matches(BAD_CHAR)) {
textNodes.add(mapChars(textNodes, currentFontFamily, text));
} else {
textNodes.add(text);
}
} else if (node instanceof Element) {
String text = ((Element) node).text();
if (!text.isEmpty()) {
final String fontSpecs = ((Element) node).attr("class");
Matcher m = fontFamilyPattern.matcher(fontSpecs);
if (m.find()) {
if (text.matches(BAD_CHAR)) {
textNodes.add(mapChars(textNodes, m.group(), text));
} else if (text.trim().length() == 1 && !m.group().equals(textFontFamily)) {
textNodes.add(mapChars(textNodes, m.group(), text));
} else {
textNodes.add(text);
}
} else {
textNodes.add(text);
}
} else {
Matcher textMatcher = spanTextPattern.matcher(((Element) node).toString());
final String fontSpecs = ((Element) node).attr("class");
Matcher m = fontFamilyPattern.matcher(fontSpecs);
final String fontFamily;
if (m.find()) {
fontFamily = m.group();
} else {
fontFamily = currentFontFamily;
}
if (textMatcher.find()) {
text = textMatcher.group("text");
if (text.isEmpty())
continue;
if (text.matches(BAD_CHAR)) {
textNodes.add(mapChars(textNodes, fontFamily, text));
} else if (text.trim().length() == 1 && !fontFamily.equals(textFontFamily)) {
textNodes.add(mapChars(textNodes, fontFamily, text));
} else {
textNodes.add(text);
}
}
}
}
}
return Collections.unmodifiableList(textNodes);
}
static boolean waitForInput = false;
static final Scanner input = new Scanner(System.in);
private static String mapChars(List<String> textNodes, String ff, String badChar) {
if (badChar.trim().isEmpty())
return badChar;
waitForInput = false;
if (!fontToBase64.containsKey(ff)) {
System.out.println("Could not find base64 string for font family name: " + ff);
waitForInput = true;
// return "<" + badChar + ">";
}
if (!base64ToCharMapping.containsKey(fontToBase64.get(ff))) {
System.out.println("Could not find base64 in mapping table: " + fontToBase64.get(ff));
waitForInput = true;
// return "<" + badChar + ">";
}
if (!base64ToCharMapping.get(fontToBase64.get(ff)).containsKey(badChar)) {
System.out.println("base64\t" + fontToBase64.get(ff));
System.out.println("Could not find mapping for bad char: " + badChar);
waitForInput = true;
// return "<" + badChar + ">";
}
final String context = listToString(textNodes);
System.out.println("In context: " + context);
if (waitForInput) {
System.out.println("Enter correct symbol:\n\n");
while (!input.hasNext()) {
}
String correctChar = input.next();
base64ToCharMapping.get(fontToBase64.get(ff)).put(badChar, correctChar);
System.out.println("Replace: '" + badChar + "' with " + "'" + correctChar + "'");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return base64ToCharMapping.get(fontToBase64.get(ff)).get(badChar);
}
}
| [
"hterhors@techfak.uni-bielefeld.de"
] | hterhors@techfak.uni-bielefeld.de |
dd84b1c17be5ac3327a3779725c9d2718d42a062 | a3774537742975a923f2f2e7069cf20c463615ac | /app/src/main/java/com/coolweather/android/gson/AQI.java | 6d864d47cdd60bff1a234f2af046a1bd95348471 | [] | no_license | gah98/CoolWeather | ff9eea771f6624289a6cd2a15eb874248f9db738 | 36a603c813ee3549ec72be65e344c6131eb481ac | refs/heads/master | 2021-04-12T22:21:49.228914 | 2020-06-17T00:43:11 | 2020-06-17T00:43:11 | 249,112,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package com.coolweather.android.gson;
public class AQI {
public AQICity city;
public class AQICity{
public String aqi;
public String pm25;
}
}
| [
"1798786880@qq.com"
] | 1798786880@qq.com |
7d3998e44b1e15f7d4b987ebcf9a953d9da5ebc0 | b290ddb36eb3088c2009efc958d2071b9be5815c | /android/app/src/main/java/com/airline/MainApplication.java | d90de2afad64806958068650ac8eed49ab5ffeb1 | [] | no_license | mobilewebguru/react-native-social-login | 03e8654380b72b1e077af22aed58d8624cec6808 | 8010005170063319e4c8087ed1fd7e1915c94b3b | refs/heads/master | 2020-03-25T01:38:06.044805 | 2018-08-02T07:52:30 | 2018-08-02T07:52:30 | 143,247,977 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,038 | java | package com.airline;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
import com.goldenowl.twittersignin.TwitterSigninPackage;
import co.apptailor.googlesignin.RNGoogleSigninPackage;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.i18n.reactnativei18n.ReactNativeI18n;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
import com.facebook.CallbackManager;
import com.facebook.FacebookSdk;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.facebook.appevents.AppEventsLogger;
public class MainApplication extends Application implements ReactApplication {
private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
protected static CallbackManager getCallbackManager() {
return mCallbackManager;
}
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeConfigPackage(),
new TwitterSigninPackage(),
new RNGoogleSigninPackage(),
new FBSDKPackage(mCallbackManager),
new ReactNativeI18n(),
new VectorIconsPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
FacebookSdk.sdkInitialize(getApplicationContext());
// If you want to use AppEventsLogger to log events.
AppEventsLogger.activateApp(this);
}
}
| [
"strong.iron.90@gmail.com"
] | strong.iron.90@gmail.com |
dc53950d060cf4574c634a72b0da3f0332beabb8 | 9d992366138e5c43e9dc0a196ee5f1ce9e401e3e | /src/merchants/service/inter/canvassGroup/ProjectGroupService.java | 4c28787614b69216fafad854ed79f838556a7905 | [] | no_license | lovinghome/mechants | 5f186127b076490a2afd1c2e3c6ffe3f1852671e | 09a48961e91144b13bcfef2246e0e96872cf5108 | refs/heads/master | 2021-05-28T21:55:13.470490 | 2015-05-07T01:39:14 | 2015-05-07T01:48:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package merchants.service.inter.canvassGroup;
import merchants.entity.canvassGroup.ProjectGroup;
import merchants.service.base.DAO;
public interface ProjectGroupService extends DAO<ProjectGroup> {
}
| [
"abel_ujs@163.com"
] | abel_ujs@163.com |
eff9a24c5cdb71873007be166144a6211f43f287 | ee1bb6d3b7014040195283b2aaff903477924d85 | /app/src/main/java/com/game/magody/tictactoe/MainActivity.java | 50fb317de923f05bab8025c13f738296a17d8886 | [] | no_license | Magody/TicTacToeAndroid | aaab10659eca953af8062e01569c081e644758ed | 70d41aeb2009cde497309d99a1304d858079827a | refs/heads/master | 2020-07-12T06:53:57.569445 | 2019-08-27T16:47:04 | 2019-08-27T16:47:04 | 204,748,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,328 | java | package com.game.magody.tictactoe;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
int numero_jugadores;
int[][] casillas;
Partida partida;
String jugador1;
String jugador2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//matriz de juego
casillas = new int[][] {{R.id.a11,R.id.a12,R.id.a13},
{R.id.a21,R.id.a22,R.id.a23},
{R.id.a31,R.id.a32,R.id.a33}};
}
public void jugar(View view){
limpiar_casillas();
numero_jugadores = 1;
if(view.getId() == R.id.dosjugadores){
numero_jugadores = 2;
}
RadioGroup dificultades = (RadioGroup) findViewById(R.id.dificultades);
int id_dificultad = dificultades.getCheckedRadioButtonId();
int dificultad = 0;
if(id_dificultad == R.id.dificultad_normal){
dificultad = 1;
}
else if(id_dificultad == R.id.dificultad_imposible){
dificultad = 2;
}
partida = new Partida(dificultad);
//busca los botones especificados y los oculta
((Button) findViewById(R.id.unjugador)).setEnabled(false);
((RadioGroup) findViewById(R.id.dificultades)).setAlpha(0);
((Button) findViewById(R.id.dosjugadores)).setEnabled(false);
this.imprimir("Turno inicial elegido aleatoriamente: " + partida.jugador,0);
if(partida.jugador == 2 && numero_jugadores == 1){
String salida = "";
switch (dificultad){
case 0:
salida = "Dificultad Fácil";
break;
case 1:
salida = "Dificultad Normal";
break;
case 2:
salida = "Dificultad Difícil";
break;
}
this.imprimir(salida,0);
this.jugador1 = "usted";
this.jugador2 = "máquina";
this.elegirJugadaIA();
}
if(numero_jugadores == 2){
this.jugador1 = "circulos";
this.jugador2 = "equis";
}
}
public void toque(View view){
if(partida != null) {
int fila = 0;
int columna = 0;
for (int i = 0; i <= 2; i++) {
for (int j = 0; j <= 2; j++) {
if (casillas[i][j] == view.getId()) {
fila = i;
columna = j;
break;
}
}
}
if(partida.estaCasillaDisponible(fila,columna))
{
partida.matriz_juego[fila][columna] = partida.jugador; // nosotros
marcarCasilla(fila,columna);
estadoPartida();
// si gana el usuario partida se convierte en null
if(partida != null){
if(numero_jugadores == 1){
if(!partida.estaMatrizLlena()) {
partida.jugador = 2;
elegirJugadaIA();
}
else{
estadoPartida();
}
}
else if(numero_jugadores == 2){
if(partida.jugador == 1)
partida.jugador = 2;
else
partida.jugador = 1;
}
}
}
else
imprimir("Casilla ocupada",0);
/*
Toast toast = Toast.makeText(this, "Has pulsado la pos: (" + fila + "," + columna + ")", Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();*/
}
}
public void elegirJugadaIA(){
int pos[] = new int[2];
switch (partida.DIFICULTAD){
case 0:
pos = partida.jugadaIAEasyNormal(); break;
case 1:
int[] aux = partida.jugadaIAEasyNormal();
if(aux.length == 3){
pos[0] = aux[1];
pos[1] = aux[2];
}
else
pos = aux;
break;
case 2:
int[] aux1 = partida.jugadaIAInsano();
if(aux1.length == 3){
pos[0] = aux1[1];
pos[1] = aux1[2];
}
else
pos = aux1;
break;
}
partida.matriz_juego[pos[0]][pos[1]] = 2;
marcarCasilla(pos[0], pos[1]);
partida.jugador = 1;
//imprimirMatrizActual();
estadoPartida();
}
public void estadoPartida(){
int estado = partida.comprobarEstado();
if(estado == 0 && partida.estaMatrizLlena())
{
imprimir("El juego a terminado en empate",0);
reiniciarPartida();
}
else if(estado!=0){
String salida = "";
switch (estado){
case 1:
salida = "El ganador: " + this.jugador1;break;
case 2:
salida = "El ganador: " + this.jugador2; break;
}
imprimir(salida,0);
reiniciarPartida();
}
}
public void marcarCasilla(int fila, int columna){
ImageView imagen = (ImageView) findViewById(casillas[fila][columna]);
if(partida.jugador == 1){
imagen.setImageResource(R.drawable.circulo);
}
else{
imagen.setImageResource(R.drawable.aspa);
}
}
public void limpiar_casillas(){
ImageView imagen;
for(int i=0;i<=2;i++){
for(int j=0;j<=2;j++){
//asigna una casilla en blanco a cada casilla
imagen = (ImageView) findViewById(casillas[i][j]);
imagen.setImageResource(R.drawable.casilla);
}
}
}
public void reiniciarPartida(){
partida = null;
((Button) findViewById(R.id.unjugador)).setEnabled(true);
((RadioGroup) findViewById(R.id.dificultades)).setAlpha(0.8f);
((Button) findViewById(R.id.dosjugadores)).setEnabled(true);
}
public void imprimirMatrizActual(){
String salida = "";
for (int i = 0; i <= 2; i++) {
for (int j = 0; j <= 2; j++) {
salida += partida.matriz_juego[i][j] + " ";
}
salida += " | ";
}
Toast toast = Toast.makeText(this, salida, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
public void imprimir(String msg,int delay){
Toast toast = Toast.makeText(this,msg,delay);
toast.setGravity(Gravity.CENTER,0,0);
toast.show();
}
}
| [
"meliodasfistery@gmail.com"
] | meliodasfistery@gmail.com |
97bd1ebc7ceb088593faa11eb79b5366e8c635e3 | 6204f5ca7682f56ba7aeaa5c466cf60173dca76e | /PPMToolFullStack/src/main/java/com/example/ppmtool/web/UserController.java | b8908981d9453162278cb882111ac10170496307 | [] | no_license | dbitrun/AgilePPMTool | f60bfe9659c5ace5d45adc4dc5477a913c6fd021 | 705ab84f1b22bab1869c2a8a74365e8f87d4af28 | refs/heads/master | 2020-04-26T15:21:18.451251 | 2019-04-01T17:29:11 | 2019-04-01T17:29:11 | 173,644,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,930 | java | package com.example.ppmtool.web;
import com.example.ppmtool.domain.User;
import com.example.ppmtool.payload.JWTLoginSuccessResponse;
import com.example.ppmtool.payload.LoginRequest;
import com.example.ppmtool.security.JwtTokenProvider;
import com.example.ppmtool.services.MapValidationErrorService;
import com.example.ppmtool.services.UserService;
import com.example.ppmtool.validator.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import static com.example.ppmtool.security.SecurityConstants.TOKEN_PREFIX;
@RestController
@RequestMapping("/api/users")
public class UserController {
@Autowired
private MapValidationErrorService mapValidationErrorService;
@Autowired
private UserService userService;
@Autowired
private UserValidator userValidator;
@Autowired
private JwtTokenProvider tokenProvider;
@Autowired
private AuthenticationManager authenticationManager;
@PostMapping("/login")
public ResponseEntity<?> authenticateUser(@Valid @RequestBody LoginRequest loginRequest, BindingResult result) {
ResponseEntity<?> errorMap = mapValidationErrorService.mapValidationService(result);
if (errorMap != null) return errorMap;
Authentication authentication = authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(
loginRequest.getUsername(),
loginRequest.getPassword()
)
);
SecurityContextHolder.getContext().setAuthentication(authentication);
String jwt = TOKEN_PREFIX + tokenProvider.generateToken(authentication);
return ResponseEntity.ok(new JWTLoginSuccessResponse(true, jwt));
}
@PostMapping("/register")
public ResponseEntity<?> registerUser(@Valid @RequestBody User user, BindingResult result) {
// Validate passwords match
userValidator.validate(user, result);
ResponseEntity<?> errorMap = mapValidationErrorService.mapValidationService(result);
if (errorMap != null) return errorMap;
User newUser = userService.saveUser(user);
return new ResponseEntity<User>(newUser, HttpStatus.CREATED);
}
}
| [
"admin@localhost.dev"
] | admin@localhost.dev |
f95c233e2ebdab510837efb2d216a62b8dcedbd7 | 73ea34707ec3b36824ef026eb06b31e36ce8b91a | /src/org/lynxlake/_11JavaAdvancedWorkshopGameDemo/gameApp/models/tanks/Tank.java | 19bc7b816173cd87ff309d70c2434fbe008417c4 | [] | no_license | plamen911/java-advanced | 72fb5d2d0f40a0b835cb892311e9210604aa2e55 | 310def9ae534909158a0c09dd1f88ebc814ce9be | refs/heads/master | 2021-01-12T04:40:50.023548 | 2017-05-03T09:12:11 | 2017-05-03T09:12:11 | 77,708,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package org.lynxlake._11JavaAdvancedWorkshopGameDemo.gameApp.models.tanks;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public abstract class Tank {
private int x;
private int y;
private ImageView currentImage;
public Tank(int x, int y) {
this.x = x;
this.y = y;
}
public abstract void draw(GraphicsContext graphicsContext);
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public ImageView getCurrentImage() {
return currentImage;
}
public void setCurrentImage(Image currentImage) {
this.currentImage = new ImageView(currentImage);
}
}
| [
"1"
] | 1 |
9fa144a2665a8e73a4d01b007eb149a098fa10eb | 839534266563361586d97cca6b9cd0e080b70184 | /idp/src/main/java/com/gaosai/idp/util/DateUtil.java | e472ed53859f0f9fe835ac1ef747941778fcc91e | [] | no_license | gaosai01/idp-sso | cba8cffe647351fa47cb104b704661322b37ad9d | 31311bfa3bf6e4915cfea321c8dbec6ba35429fa | refs/heads/master | 2021-09-20T05:36:23.981745 | 2018-08-04T10:52:23 | 2018-08-04T10:52:23 | 99,469,771 | 13 | 6 | null | null | null | null | UTF-8 | Java | false | false | 5,939 | java | package com.gaosai.idp.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
public static String getCurTime(){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Long time = Long.valueOf( getCurTimeStamp() + "000" );
String d = format.format(time);
return d;
}
public static String getCurTime1(){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Long time = Long.valueOf( getCurTimeStamp() + "000" );
String d = format.format(time);
return d;
}
public static int getCurTimeStamp(){
return (int)( System.currentTimeMillis() / 1000 );
}
public static String getTimeFromTimeStamp( int l ){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Long time = Long.valueOf( l + "000" );
String d = format.format(time);
return d;
}
public static String getDateFromTimeStamp( int l ){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Long time = Long.valueOf( l + "000" );
String d = format.format(time);
return d;
}
public static int getTimeStampFromTime( String time ) throws ParseException {
SimpleDateFormat simpleDateFormat =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=simpleDateFormat .parse( time );
int timeStemp = (int)( date.getTime() / 1000 );
return timeStemp;
}
public static int getTimeStampFromDate( String time ) throws ParseException {
SimpleDateFormat simpleDateFormat =new SimpleDateFormat("yyyy-MM-dd");
Date date=simpleDateFormat .parse( time );
int timeStemp = (int)( date.getTime() / 1000 );
return timeStemp;
}
public static String formatData( String all ){
String ans = "";
SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
Date date = null;
try {
date = format.parse(all);
}catch ( Exception e ){
return all;
}
Calendar calendar = Calendar.getInstance();
calendar.setTime( date );
int oldY = calendar.get( Calendar.YEAR ),
oldM = calendar.get( Calendar.MONTH ),
oldDay = calendar.get( Calendar.DAY_OF_MONTH );
Calendar newCa = Calendar.getInstance();
int newY = newCa.get( Calendar.YEAR ),
newM = newCa.get( Calendar.MONTH ),
newD = newCa.get( Calendar.DAY_OF_MONTH );
if( oldY == newY &&
oldM == newM &&
oldDay == newD ){
format = new SimpleDateFormat( "HH:mm" );
ans = format.format( date );
}else{
format = new SimpleDateFormat( "MM-dd" );
ans = format.format( date );
}
return ans;
}
public static String _format( String all ){
SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
Date date = null;
try {
date = format.parse(all);
}catch ( Exception e ){
return all;
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String dateString = formatter.format(date);
return dateString;
}
// 获得某天0点时间
public static int getTimesmorning( int timestamp ) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis( timestamp );
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得当天0点时间
public static int getTimesmorning() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得当天24点时间
public static int getTimesnight() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 24);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得本周一0点时间
public static int getTimesWeekmorning() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得本周日24点时间
public static int getTimesWeeknight() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
return (int) ((cal.getTime().getTime() + (7 * 24 * 60 * 60 * 1000)) / 1000);
}
// 获得本月第一天0点时间
public static int getTimesMonthmorning() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
return (int) (cal.getTimeInMillis() / 1000);
}
// 获得本月最后一天24点时间
public static int getTimesMonthnight() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
cal.set(Calendar.HOUR_OF_DAY, 24);
return (int) (cal.getTimeInMillis() / 1000);
}
public static int getMonth(){
Calendar cal = Calendar.getInstance();
int month = cal.get(Calendar.MONTH) + 1;
return month;
}
public static int getYear(){
Calendar cal = Calendar.getInstance();
int month = cal.get(Calendar.YEAR);
return month;
}
public static int getMonthDay(){
Calendar cal = Calendar.getInstance();
int dom = cal.get(Calendar.DAY_OF_MONTH);
return dom;
}
public static int getMonthLastDay( int m ){
if( m == 2 ){
return 28;
}
if( m == 1 || m == 3 || m== 5 || m == 7|| m== 8 || m== 10|| m== 12 ){
return 31;
}
return 30;
}
}
| [
"gaosaibike@163.com"
] | gaosaibike@163.com |
237c0ad8f007ce011f1d9fb1ee216fe117c5e771 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/JetBrains--intellij-community/ca4af156d60d34af82dedb36f7e4c786183ce8c9/before/MethodChainsSearchService.java | 7baa7435cd74503c1faad35776979a13211ffed7 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,923 | java | package com.intellij.codeInsight.completion.methodChains.search;
import com.intellij.compilerOutputIndex.impl.MethodIncompleteSignature;
import com.intellij.compilerOutputIndex.impl.MethodsUsageIndex;
import com.intellij.compilerOutputIndex.impl.UsageIndexValue;
import com.intellij.compilerOutputIndex.impl.bigram.BigramMethodsUsageIndex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiManager;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
/**
* @author Dmitry Batkovich <dmitry.batkovich@jetbrains.com>
*/
public class MethodChainsSearchService {
private final static SortedSet EMPTY_SORTED_SET = new TreeSet();
private final MethodsUsageIndex myMethodsUsageIndex;
private final BigramMethodsUsageIndex myBigramMethodsUsageIndex;
private final Project myProject;
public MethodChainsSearchService(final Project project) {
myMethodsUsageIndex = MethodsUsageIndex.getInstance(project);
myBigramMethodsUsageIndex = BigramMethodsUsageIndex.getInstance(project);
myProject = project;
}
public Project getProject() {
return myProject;
}
@NotNull
@SuppressWarnings("unchecked")
public SortedSet<UsageIndexValue> getBigram(final MethodIncompleteSignature methodIncompleteSignature) {
final TreeSet<UsageIndexValue> value = myBigramMethodsUsageIndex.getValues(methodIncompleteSignature);
if (value != null) {
return value;
}
return EMPTY_SORTED_SET;
}
@NotNull
@SuppressWarnings("unchecked")
public SortedSet<UsageIndexValue> getMethods(final String targetQName) {
final TreeSet<UsageIndexValue> value = myMethodsUsageIndex.getValues(targetQName);
if (value != null) {
return value;
}
return EMPTY_SORTED_SET;
}
public PsiManager getPsiManager() {
return PsiManager.getInstance(getProject());
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
8dd43d91307d035706c09db2d75bc6603e5d353e | 67152d41d60dde36fad044c757c6a1f6d824cc75 | /app/src/main/java/de/htw/ai/ema/network/ConnectionProperties.java | aeff13727c70d11059231423d3e088a8a628c774 | [] | no_license | pizzicariella/Li5a | 30a0b4c0c1c7007d5e5cfd1206f684823be51b32 | b8c3c1f0aba193658bd5dd032c09bee675789d10 | refs/heads/master | 2022-11-11T15:46:22.304640 | 2020-07-01T14:25:00 | 2020-07-01T14:25:00 | 264,468,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package de.htw.ai.ema.network;
import de.htw.ai.ema.network.bluetooth.BluetoothProperties;
import de.htw.ai.ema.network.service.handler.ConnectionHandler;
import de.htw.ai.ema.network.service.nToM.NToMConnectionHandler;
public class ConnectionProperties {
private static ConnectionProperties instance = null;
private ConnectionHandler conHandler = null;
private ConnectionProperties(String name){
this.conHandler = new NToMConnectionHandler(name);
}
public static synchronized ConnectionProperties getInstance(){
if(instance == null){
instance = new ConnectionProperties(BluetoothProperties.getInstance().getDeviceName());
}
return instance;
}
public ConnectionHandler getConHandler() {
return this.conHandler;
}
}
| [
"s0558478@htw-berlin.de"
] | s0558478@htw-berlin.de |
7a9f18da5ef286af79da8c27f781a353e151e20c | f593f989f45f6134e13306720fc3f68e87f13034 | /app/src/main/java/com/iqoid/moovrika/MainActivity.java | 89d4984a224c97c5772fb89814490f1280d9e728 | [] | no_license | lgiulian/moovrika-webapp | 00903965b79a6ee44d78950a83b7ea7f5e64bae7 | ee5c6cb27edc12258db32d24ccd4310cb94e780b | refs/heads/master | 2021-01-20T16:50:20.267213 | 2017-05-10T10:17:13 | 2017-05-10T10:17:13 | 90,850,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,050 | java | package com.iqoid.moovrika;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Build;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
public class MainActivity extends AppCompatActivity {
private RelativeLayout fullScreenLayout;
private WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.activity_main_webview);
fullScreenLayout = (RelativeLayout)findViewById(R.id.fullscreen);
// Enable Javascript
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
// Force links and redirects to open in the WebView instead of in a browser
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebChromeClient(new MyWebChromeClient(this));
mWebView.loadUrl("https://moovrika.com/");
}
@Override
public void onBackPressed() {
if(mWebView.canGoBack()) {
mWebView.goBack();
} else {
super.onBackPressed();
}
}
public RelativeLayout getFullScreenLayout() {
return fullScreenLayout;
}
public void toggleFullscreen(boolean fullscreen) {
ActionBar actionBar = this.getSupportActionBar();
View decorView = getWindow().getDecorView();
int visibility = decorView.getSystemUiVisibility();
int fullscreenFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if (Build.VERSION.SDK_INT >= 16) {
fullscreenFlags |= View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
}
if (Build.VERSION.SDK_INT >= 19) {
fullscreenFlags |= View.SYSTEM_UI_FLAG_IMMERSIVE |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
if (fullscreen) {
visibility |= fullscreenFlags;
if (actionBar != null) actionBar.hide();
} else {
visibility &= ~fullscreenFlags;
if (actionBar != null) actionBar.show();
}
decorView.setSystemUiVisibility(visibility);
// Full-screen is used for playing videos.
// Allow sensor-based rotation when in full screen (even overriding user rotation preference)
if (fullscreen) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
} else {
setScreenOrientationPreference();
}
}
private void setScreenOrientationPreference() {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}
| [
"iulian.lungu@yahoo.com"
] | iulian.lungu@yahoo.com |
4fa7e8527719d8938f3f92bc397742eb27e23dd7 | 9bc270e8a8f71750424ef2cbf8b12c6cb39ee138 | /test/src/coreJava/SequenceOfExecution.java | 7258d2d9552ddc264558672506b550c54cb067e6 | [] | no_license | Sitabja/Data_Structure_Algorithm | 66788cd7df98a1b37ab98a1133c8a9360c693f3a | 8ecd7013b9ba158ad78aeec5c2440f6b706bc902 | refs/heads/master | 2021-09-06T05:13:03.060810 | 2018-02-02T16:49:12 | 2018-02-02T16:49:12 | 109,490,356 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package coreJava;
public class SequenceOfExecution {
public static void main(String[] args) {
System.out.println("inside main 1");
ParentClass p;
System.out.println("inside main 2");
p = new ChildClass();
ChildClass c = (ChildClass)p;
//ParentClass p2 = new ChildClass();
}
}
class ParentClass{
static{
System.out.println("parent static");
}
{
System.out.println("parent non static");
}
public ParentClass(){
System.out.println("parent constructor");
}
}
class ChildClass extends ParentClass{
static{
System.out.println("Child static");
}
{
System.out.println("Child non static");
}
public ChildClass(){
System.out.println("Child constructor");
}
}
| [
"sitabja.ukil@ucdconnect.ie"
] | sitabja.ukil@ucdconnect.ie |
e69681f37e38059f63835981eb4c033575150591 | 7b26ca553dddfb0dbcfcfce6c317ace6c8bcef3c | /CompiladorCmenos/src/Cmenos/node/TWhile.java | ba802171d995e873e0074283c13ff30b14ede070 | [] | no_license | arquimago/compilador | 7adce6673b72200f568b2986fa9934969fe24337 | c64a21064bfa1354b4ae21c81bcaafa428ee158c | refs/heads/master | 2021-01-17T05:19:58.608978 | 2016-05-14T01:45:36 | 2016-05-14T01:45:36 | 50,127,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | /* This file was generated by SableCC (http://www.sablecc.org/). */
package Cmenos.node;
import Cmenos.analysis.*;
@SuppressWarnings("nls")
public final class TWhile extends Token
{
public TWhile()
{
super.setText("while");
}
public TWhile(int line, int pos)
{
super.setText("while");
setLine(line);
setPos(pos);
}
@Override
public Object clone()
{
return new TWhile(getLine(), getPos());
}
@Override
public void apply(Switch sw)
{
((Analysis) sw).caseTWhile(this);
}
@Override
public void setText(@SuppressWarnings("unused") String text)
{
throw new RuntimeException("Cannot change TWhile text.");
}
}
| [
"thales@alvesnet.net"
] | thales@alvesnet.net |
be2f2a8f5744389ca60afc8b3e0e0043f24614d7 | 6f98892c3a43823bb28dc03dd1516fae96c56807 | /Wechat/app/src/main/java/dao/bean/NewsRecord.java | 54c61b94a0250a4a6c5e4e34e686088104d5a903 | [] | no_license | ILMFF/wechat | a07d2b4899b7e64fb801cd5e48ce8c4e1cf0b4b0 | 9b7613ae8f0079c1483b2e2c86c5532beb1a8d91 | refs/heads/master | 2020-06-21T00:57:12.300403 | 2017-06-13T10:41:29 | 2017-06-13T10:41:29 | 94,199,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package dao.bean;
/**
* Created by Administrator on 2017/3/8.
*/
public class NewsRecord {
public String SenderName;
public String SenderNickName;
public String SenderIcon;
public String Content;
public String CreateTime;
public String ContentFrom;
public String ChatRoom_ornot; //是否是群聊信息
public String MemberSender; //具体是群的哪位成员发送
public NewsRecord(String senderName, String senderNickName, String senderIcon, String content, String createTime, String contentFrom, String chatRoom_ornot, String memberSender) {
SenderName = senderName;
SenderNickName = senderNickName;
SenderIcon = senderIcon;
Content = content;
CreateTime = createTime;
ContentFrom = contentFrom;
ChatRoom_ornot = chatRoom_ornot;
MemberSender = memberSender;
}
}
| [
"494245000@qq.com"
] | 494245000@qq.com |
235183de615e7b5086f4e2100e8ea72b6d7384fd | 6f10074fe420df29a9ea5d9eabb58f622602ffaf | /src/main/java/hanakishopping/OrderForm.java | 3644eba4b20fe32495d99b45f209ea6090a3af27 | [] | no_license | hanakiy/webjava__1 | 928f19ce914d939155a2f5cc82e5541333f1ea2b | ef5ef33c08f5d0e2768298622c6a9e92e69c3750 | refs/heads/master | 2020-03-21T08:49:26.190180 | 2018-06-23T03:18:40 | 2018-06-23T03:18:40 | 138,367,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | package hanakishopping;
public class OrderForm {
}
| [
"systena@PCK-136-275"
] | systena@PCK-136-275 |
91d746c8107293e8c7825b569a7a99011e276d47 | ad9987a268c3d436e13be4140176942b7dda83b4 | /multiscreens/src/main/java/ph/ingenuity/multiscreens/fragment/MessageFragment.java | 21b322bf83c0ffae8e81b1d0d63a7e813b7ac8f2 | [] | no_license | gianina-ingenuity/adapter-views | 741ad08974ed28299856f44b1daf7a9a1fd88b8c | fdb958be496c2c069a3c690f6945ba3e99f04138 | refs/heads/master | 2021-01-11T16:27:21.834875 | 2016-01-04T10:35:07 | 2016-01-04T11:39:43 | 80,086,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 547 | java | package ph.ingenuity.multiscreens.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import ph.ingenuity.multiscreens.R;
/**
* @author aeroheart-c6
* @since 11/6/15
*/
public class MessageFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment__message, container, false);
}
}
| [
"aeroheart.c6@gmail.com"
] | aeroheart.c6@gmail.com |
48fd5ac4379900ce7ef3b4af2b558d84b8b42245 | 73a251b54f1bc127dd5214c090d9a777bcf88190 | /FinanceManagerH/src/main/java/ru/kotovalexandr/financemanager/Model/Account.java | e9c09858530078d157d56f9d137babe6afbf42e5 | [] | no_license | vasap87/git-repo | 1a83f5fd26363692a485c0c7e03eeee57e269456 | 8b5e27b5e60c6dac29f69c4d732bf2ca906e2713 | refs/heads/master | 2021-01-23T14:05:37.039116 | 2017-08-24T14:31:56 | 2017-08-24T14:31:56 | 57,288,209 | 0 | 0 | null | 2016-05-31T15:10:20 | 2016-04-28T09:25:33 | Java | UTF-8 | Java | false | false | 2,307 | java | package ru.kotovalexandr.financemanager.Model;
import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* Created by admin on 12.07.2016.
*/
@Entity
@Table(name = "ACCOUNTS")
public class Account implements Serializable {
@Id
@GeneratedValue (strategy = GenerationType.AUTO)
@Column(name = "ID")
private int id;
@Column(name = "NUMBER")
private String number;
@Column(name = "AMOUNT")
private BigDecimal amount = new BigDecimal(0);
@ManyToOne
@JoinColumn(name = "USER_ID")
private User user;
@Column(name = "DESCR")
private String description;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "account", cascade = CascadeType.REMOVE)
private List<Transaction> transactionList = new ArrayList<>();
public Account() {
}
public Account(String number, User user, String description){
this.number = number;
this.id=-1;
this.description = description;
this.user = user;
user.addAccount(this);
}
public Account(int id, String number, User user, String description) {
this(number,user,description);
this.id = id;
}
public void setNumber(String number) {
this.number = number;
}
public void setDescription(String description) {
this.description = description;
}
public String getNumber() {
return number;
}
public BigDecimal getAmount() {
return amount;
}
public int getUserId() {
return user.getId();
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public String getDescription() {
return description;
}
public List<Transaction> getTransactionList() {
return transactionList;
}
public void updateAmmount() {
for (Transaction transaction : transactionList) {
if(transaction.isCheckIn()){
amount = amount.add(transaction.getAmount());
}else{
amount = amount.subtract(transaction.getAmount());
}
}
}
}
| [
"a200x@bk.ru"
] | a200x@bk.ru |
95172aeb7949828f4804a551cf3c145ca910f38a | f63f06e3b307820f6264ce8b39d6b00e611df711 | /src/main/java/com/biteit/rsocket/responder/adapter/cdm/ReadingRequest.java | b10faadbd6fb162a9a3b188e702fafe52ded888e | [] | no_license | lukaszpy/rsocket-responder | 4bf187b0dc546e2a5df4f5cd437dfd9ad61ff566 | 88e82b291617eb6248c04074cc4acf85d30df284 | refs/heads/master | 2022-08-31T11:47:40.675629 | 2020-05-21T12:06:40 | 2020-05-21T12:06:40 | 265,838,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package com.biteit.rsocket.responder.adapter.cdm;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReadingRequest {
private String worksId;
}
| [
"lukasz.pyrkosz@ista.com"
] | lukasz.pyrkosz@ista.com |
715782478389625b10fd6c9c873bc9541170c0d4 | 11fa5f0e213204775d144d3a3a29115583025e5f | /test/wheeloffate/services/ShiftServiceTest.java | 337463a954dc3e3db2d6990d043fafb11bae5af5 | [] | no_license | mattymoomoo/wheel-of-fate-api | c066e6d7ac3db68dd3d41a2bf9b9c53c253d77f2 | 1f159c488e0dbc4bf7f3d9d9ae36fc56a035a62c | refs/heads/master | 2021-08-24T06:53:00.272004 | 2017-12-08T13:48:46 | 2017-12-08T13:48:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,161 | java | package wheeloffate.services;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import wheeloffate.data.Engineer;
import wheeloffate.models.Shift;
public class ShiftServiceTest {
@InjectMocks
protected ShiftService underTest;
@Mock
RulesService mockRulesService;
List<Engineer> engineers = new ArrayList<Engineer>();
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
engineers.add(new Engineer(1L, "Test 1", "Name 1", "Test Position"));
engineers.add(new Engineer(2L, "Test 2", "Name 2", "Test Position"));
engineers.add(new Engineer(3L, "Test 3", "Name 3", "Test Position"));
}
@Rule
public ErrorCollector collector = new ErrorCollector();
@Test
public void shouldCreateAShiftListOfTheCorrectSize() {
EngineerPool engineerPool = new EngineerPool();
List<Shift> result = underTest.createShifts(engineerPool, 10);
collector.checkThat(result.size(), equalTo(10));
}
@Test
public void shouldCreateAShiftListWithCorrectIDs() {
EngineerPool engineerPool = new EngineerPool();
List<Shift> result = underTest.createShifts(engineerPool, 10);
collector.checkThat(result.size(), equalTo(10));
for (int i = 0; i < result.size(); i++) {
collector.checkThat(result.get(i).getId(), equalTo(i));
}
}
@Test
public void shouldCreateAShiftListOfEmptyEngineersIfNoAvailableEngineers() {
EngineerPool engineerPool = new EngineerPool();
List<Shift> result = underTest.createShifts(engineerPool, 10);
collector.checkThat(result.size(), equalTo(10));
for (Shift shift : result) {
collector.checkThat(shift.getEngineer(), nullValue());
}
}
@Test
public void shouldCreateAShiftListWithAllEngineers() {
when(mockRulesService.isValid(any(int.class), any(long.class), any())).thenReturn(true);
EngineerPool engineerPool = new EngineerPool();
engineerPool.addEngineers(engineers);
List<Shift> result = underTest.createShifts(engineerPool, 3);
verify(mockRulesService, times(3)).isValid(any(int.class), any(long.class), any());
collector.checkThat(result.size(), equalTo(3));
for (Shift shift : result) {
collector.checkThat(shift.getEngineer(), notNullValue());
}
}
@Test
public void shouldCreateAShiftListOfEmptyEngineersIfRulesFlaggedInvalid() {
when(mockRulesService.isValid(any(int.class), any(long.class), any())).thenReturn(false);
EngineerPool engineerPool = new EngineerPool();
engineerPool.addEngineers(engineers);
List<Shift> result = underTest.createShifts(engineerPool, 3);
collector.checkThat(result.size(), equalTo(3));
for (Shift shift : result) {
collector.checkThat(shift.getEngineer(), nullValue());
}
}
}
| [
"dorrianmatthew@Matthews-MacBook-Air.local"
] | dorrianmatthew@Matthews-MacBook-Air.local |
8864b9fe5616e00e3629dd7efb11e1aabde5f745 | 6c222eef46ebdd1e077ba96e542312251246f98d | /Servidor/src/excepciones/ConfiguracionException.java | 699069e26eaafdaaeca269e3c55926377314525d | [] | no_license | leonelmore/UdeTallerII | 0930fe80a32d50ce84ab370a61d7348f179a6543 | 685b740bc932945f6604bb7a917473245ebfa040 | refs/heads/master | 2021-01-17T14:14:43.113753 | 2015-03-16T22:42:43 | 2015-03-16T22:42:43 | 30,723,367 | 0 | 0 | null | null | null | null | ISO-8859-2 | Java | false | false | 471 | java | package excepciones;
//Esta excepcion se tira con una causa. Es decir, la excepcion que se atrapa,
//se agrega al constructor como una causa y luego se tira la ConfiguracionException
//creada.
public class ConfiguracionException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public ConfiguracionException(String unMensaje, Exception unaCausa){
super("Error cargando variables de configuración. " + unMensaje, unaCausa);
}
}
| [
"more.leonel@gmail.com"
] | more.leonel@gmail.com |
3886882749f46a7487e82b8fa412d7d1e1458db6 | 6783a4959dd02feac1edea0d1c85ee37ff8f9b4f | /common/src/main/java/com/tinytiger/common/net/data/gametools/GameCommentList.java | b5d4ac455c82643426d296689b98945e7e387c7f | [] | no_license | zhangwan/xiaohuplay_android | 9ada8c8a76e438edb0f9e06da98c6d0e90c009b7 | d397c86523b9d221038995b8feafe9395cc05e7b | refs/heads/master | 2022-12-04T03:39:38.287902 | 2020-08-28T02:49:06 | 2020-08-28T02:49:06 | 290,931,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package com.tinytiger.common.net.data.gametools;
import com.tinytiger.common.net.data.BaseBean;
import java.util.ArrayList;
import java.util.List;
public class GameCommentList extends BaseBean {
public Data data;
public class Data {
/**
* total : 0
* per_page : 10
* current_page : 1
* last_page : 0
* data : []
*/
private int total;
private int per_page;
private int current_page;
private int last_page;
private List<GameCommentBean> data;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getPer_page() {
return per_page;
}
public void setPer_page(int per_page) {
this.per_page = per_page;
}
public int getCurrent_page() {
return current_page;
}
public void setCurrent_page(int current_page) {
this.current_page = current_page;
}
public int getLast_page() {
return last_page;
}
public void setLast_page(int last_page) {
this.last_page = last_page;
}
public List<GameCommentBean> getData() {
return data;
}
public void setData(List<GameCommentBean> data) {
this.data = data;
}
}
}
| [
"zhangwenying@tinytiger.cn"
] | zhangwenying@tinytiger.cn |
19ea3ad20095cf956207424d1e037c94d4df2ded | 5ae3038438f9866f476797d1ef87d71c0a781f3a | /health_api/src/main/java/com/itheima/health/entity/Result.java | 3c2123aaaac5c6956b5d50236e0d951f12410eef | [] | no_license | syngebee/health | 7415e1765857609f439793d66fcf891ef6f32201 | 4414640ab8ec0f5ab43394de14f0179578d47057 | refs/heads/master | 2023-01-30T07:09:50.245082 | 2020-12-08T03:37:59 | 2020-12-08T03:37:59 | 301,422,932 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | package com.itheima.health.entity;
import java.io.Serializable;
/**
* 封装返回结果
*/
public class Result implements Serializable{
private boolean flag;//执行结果,true为执行成功 false为执行失败
private String message;//返回结果信息
private Object data;//返回数据
public Result(boolean flag, String message) {
super();
this.flag = flag;
this.message = message;
}
public Result(boolean flag, String message, Object data) {
this.flag = flag;
this.message = message;
this.data = data;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
| [
"zs@bjpowernode.com"
] | zs@bjpowernode.com |
261673969cae6606cfdcf8bc09c7c310c56eb7fa | 651dc071249005ba3b2faffc4dcdb1f87350d3a6 | /src/main/java/com/saler/service/SFCELoginService.java | abde68f5138191396e91452e38a060d3c4b18355 | [] | no_license | garrettLsy/saler | 5fc923cbdac3739c19b18e99d3d2e071f03b31de | f0257319ad2ec67ac619a6ba59cb049c7287e1a7 | refs/heads/master | 2020-04-16T12:36:44.165279 | 2019-04-03T08:46:42 | 2019-04-03T08:46:42 | 165,587,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,819 | java | package com.saler.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.saler.config.PropertiesConfig;
import com.sforce.soap.enterprise.Connector;
import com.sforce.soap.enterprise.EnterpriseConnection;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
public class SFCELoginService {
Logger logger=LoggerFactory.getLogger(getClass());
public EnterpriseConnection connection;
//读取链接
public EnterpriseConnection getconnection() {
if(this.connection!=null) {
return connection;
}else {
SFCDnewConnection();
return connection;
}
}
//SFCE登录
public void SFCDnewConnection() {
/*PropertiesConfig pc=new PropertiesConfig("./application.properties");
String userName=(String)pc.getProperties().getProperty("salesforce.userName");
String userPassWord=pc.getProperties().getProperty("salesforce.password");*/
/*String userName="wilson.chen@allianture.com";
String userPassWord="demo12345PkYlAUnHjkfMV80KTCynK7Fpx";*/
String userName="admin.pam@allergan.com.test";
String userPassWord="A&G^N#19";
ConnectorConfig SFDCConfig = new ConnectorConfig();
try {
logger.debug(userName);
logger.debug(userPassWord);
SFDCConfig.setUsername(userName);
SFDCConfig.setPassword(userPassWord);
this.connection=Connector.newConnection(SFDCConfig);
} catch (ConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
}
}
//断开SFCE链接
public void closeSFCE(EnterpriseConnection connection) {
try {
if(null!=connection) {
connection.logout();
}else {
return ;
}
} catch (ConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"tacitysl@sina.com"
] | tacitysl@sina.com |
fd964b02eb8ccf1a824ead48dbf2001a61febb02 | e29a4267310dd8a3177d7b3d759500ec74c84929 | /src/main/java/org/bytediff/util/DiffyShortcuts.java | 54618cf3401e46d7c9eefa825e4bf8473642382b | [
"Apache-2.0"
] | permissive | dgawlik/diffy | ce5ac0d78701f3dad72dbf4bd5e2d392f56fa9d9 | 0c58ed842cc9aeed9c1e95c4a5ce28ee7ca58cf1 | refs/heads/main | 2023-02-19T13:30:12.870469 | 2021-01-23T20:17:53 | 2021-01-23T20:17:53 | 330,490,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,000 | java | package org.bytediff.util;
import org.bytediff.engine.Diff;
import org.bytediff.engine.DiffInfo;
import org.bytediff.engine.DiffInfo.DiffType;
import org.bytediff.print.Printer;
import org.bytediff.print.enc.RawValueEncoder;
import org.bytediff.print.fmt.AnsiColorFormatter;
public class DiffyShortcuts {
public static void log(String source, String target) {
DiffInfo info = Diff.compute(source.toCharArray(), target.toCharArray());
Printer p = Printer.from(info);
System.out.println(p.print());
}
public static void logVerbose(String source, String target) {
DiffInfo info = Diff.compute(source.toCharArray(), target.toCharArray());
Printer p = Printer.from(info).verbose();
System.out.println(p.print());
}
public static void logColors(String source, String target) {
DiffInfo info = Diff.compute(source.toCharArray(), target.toCharArray());
Printer p = Printer.from(info).withFormatter(new AnsiColorFormatter());
System.out.println(p.print());
}
public static void log(byte[] source, byte[] target, int radix) {
char[] sourceC = Raw.bytesToChars(source);
char[] targetC = Raw.bytesToChars(target);
DiffInfo info = Diff.compute(sourceC, targetC);
Printer p = Printer.from(info).withEncoding(new RawValueEncoder(radix));
System.out.println(p.print());
}
public static void logVerbose(byte[] source, byte[] target, int radix) {
char[] sourceC = Raw.bytesToChars(source);
char[] targetC = Raw.bytesToChars(target);
DiffInfo info = Diff.compute(sourceC, targetC);
Printer p = Printer.from(info)
.withEncoding(new RawValueEncoder(radix))
.verbose();
System.out.println(p.print());
}
public static void logColor(byte[] source, byte[] target, int radix) {
char[] sourceC = Raw.bytesToChars(source);
char[] targetC = Raw.bytesToChars(target);
DiffInfo info = Diff.compute(sourceC, targetC);
Printer p = Printer.from(info)
.withEncoding(new RawValueEncoder(radix))
.withFormatter(new AnsiColorFormatter())
.verbose();
System.out.println(p.print());
}
public static void assertEquals(String source, String target) {
DiffInfo info = Diff.compute(source.toCharArray(), target.toCharArray());
if (info.getDiff().size() == 1
&& info.getDiff().get(0).getDiffType() == DiffType.MATCH) {
return;
}
Printer p = Printer.from(info);
throw new AssertionError("Diffy match failed\n" + p.print());
}
public static void assertEquals(byte[] source, byte[] target, int radix) {
char[] sourceC = Raw.bytesToChars(source);
char[] targetC = Raw.bytesToChars(target);
DiffInfo info = Diff.compute(sourceC, targetC);
if (info.getDiff().size() == 1
&& info.getDiff().get(0).getDiffType() == DiffType.MATCH) {
return;
}
Printer p = Printer.from(info)
.withEncoding(new RawValueEncoder(radix));
throw new AssertionError("Diffy match failed\n" + p.print());
}
}
| [
"dominik.gawlik1@gmail.com"
] | dominik.gawlik1@gmail.com |
09144f001d4d2c2377756fca169fe513f1f2f473 | b9e95090ce92678f9d72a55f7f3900ea46baca62 | /src/main/java/io/geekidea/springbootplus/test/concurrent/AcctConstant.java | 2bd973a491a8b85563db9d07be9cb35ae27d5528 | [
"Apache-2.0"
] | permissive | jmater/spring-boot-plus | 83c47166ad52193d86e81d64a836f0997240ebb0 | 20faee2a8accabf41253da708cee84c3c20631ae | refs/heads/master | 2022-12-11T04:17:07.593043 | 2019-11-09T09:26:05 | 2019-11-09T09:26:05 | 219,725,369 | 0 | 0 | Apache-2.0 | 2022-12-06T00:43:32 | 2019-11-05T11:08:46 | Java | UTF-8 | Java | false | false | 2,539 | java | package io.geekidea.springbootplus.test.concurrent;
public class AcctConstant {
public static final int DEFAULT_GET_LOCK_TIME_SECONDS = 30;
public static final int DEFAULT_LOCK_TIME_SECONDS = 30;
public static final int MAX_RELEASE_LOCK_RETRY = 5;
public enum EnumDebtType{
DEBT_IN(1,"入款"),
DEBT_OUT(2,"出款")
;
private int code;
private String msg;
EnumDebtType(int code,String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getString(){
return "code = " + code + ",msg= " + msg;
}
}
public enum EnumTransStatus{
TRANS_STATUS_WAITING(10,"待处理"),
TRANS_STATUS_PROCESSING(20,"处理中"),
TRANS_STATUS_FINISHED(30,"处理完成"),
TRANS_STATUS_CANCELED(40,"取消"),
TRANS_STATUS_FAILED(50,"失败")
;
private int code;
private String msg;
EnumTransStatus(int code,String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getString(){
return "code = " + code + ",msg= " + msg;
}
}
public enum EnumTransResult{
TRANS_RESULT_SUCCEED(1,"交易成功"),
TRANS_RESULT_FAILED(2,"交易失败"),
TRANS_RESULT_UNKNOW(3,"交易未知")
;
private int code;
private String msg;
EnumTransResult(int code,String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getString(){
return "code = " + code + ",msg= " + msg;
}
}
}
| [
"teraco@163.com"
] | teraco@163.com |
bfc9a1fde7b0341a14155593d446b2e2eba53e6a | 3901c526aa4ac0f3e08a47cafa749c4fe6e014bf | /app/src/main/java/android/org/rajawali3d/loader/awd/BlockSkeleton.java | f2dfa7f8b48eefb36785f9c5c09fdc25a9d82af0 | [] | no_license | dharmendrahike/Camera | 574d27ac4d3315bdebe7218ae9475610b3626042 | 60a6bdc7ea8bebbba7f937564a29be23dc357629 | refs/heads/master | 2021-08-14T09:41:57.404175 | 2017-11-15T07:36:42 | 2017-11-15T07:36:42 | 110,798,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,104 | java | /*
package android.org.rajawali3d.loader.awd;
import android.org.rajawali3d.animation.mesh.SkeletalAnimationFrame.SkeletonJoint;
import android.org.rajawali3d.loader.LoaderAWD.AWDLittleEndianDataInputStream;
import android.org.rajawali3d.loader.LoaderAWD.BlockHeader;
import android.org.rajawali3d.math.Matrix4;
*/
/**
* Specifies the joint hierarchy and inverse-bind-pose matrices.
* The skeleton itself is not bound to any particular mesh; it is
* only assigned geometry by instances of BlockAnimator, where present.
*
* @author Ian Thomas (toxicbakery@gmail.com)
* @author Bernard Gorman (bernard.gorman@gmail.com)
*
*//*
public class BlockSkeleton extends ABlockParser {
protected SkeletonJoint[] mJoints;
protected String mLookupName;
protected int mNumJoints;
private final Matrix4 transformMatrix = new Matrix4();
// extract the inverse-bind-pose matrices for each joint in the skeleton
public void parseBlock(AWDLittleEndianDataInputStream dis, BlockHeader blockHeader) throws Exception {
// Lookup name
mLookupName = dis.readVarString();
// Number of skeleton joints
mNumJoints = dis.readUnsignedShort();
// Skeleton attribute list (unused)
dis.readProperties(null);
// Skeleton joint parsing
mJoints = new SkeletonJoint[mNumJoints];
for(int i = 0; i < mNumJoints; i++)
{
int jointID = dis.readUnsignedShort();
int parentID = dis.readUnsignedShort() - 1;
String lookupName = dis.readVarString();
dis.readMatrix3D(transformMatrix, blockHeader.globalPrecisionMatrix, false);
// skip joint & user properties
dis.readProperties(null);
dis.readProperties(null);
// construct joint and add to list
SkeletonJoint joint = new SkeletonJoint();
joint.setParentIndex(parentID);
joint.setName(lookupName);
joint.setIndex(jointID);
// this is the INVERSE bind-pose matrix, take note for BlockAnimator
joint.setMatrix(transformMatrix.getDoubleValues());
mJoints[i] = joint;
}
// skip User properties section
dis.readProperties(null);
}
public SkeletonJoint[] getJoints()
{
return mJoints;
}
}
*/
| [
"dharmendra@hike.in"
] | dharmendra@hike.in |
2c52e5c93ed26447b0432e9fb6be5b8b70973fb4 | 2ae7dad68e3600e6a4fd6a380316d4bb1bd55ca7 | /teams/tankBotv3/Constants.java | e980f7bff093bb07f70fcb18717c9fc9f9637e23 | [] | no_license | kpeng94/shigatsu | 2e7e113de6d062a91b0a311eaa03c96744d7e840 | 6cfd81dd2a50321047334aff8184567b5ce04fcd | refs/heads/master | 2021-01-19T11:17:34.752822 | 2015-03-13T17:31:47 | 2015-03-13T17:31:47 | 28,466,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package tankBotv3;
public class Constants {
public static int NUM_OF_HELIPADS = 5;
public static int NUM_OF_INITIAL_HELIPADS = 1;
public static int NUM_OF_AEROSPACELABS = 5;
public static int NUM_OF_MINERS = 20;
public static int NUM_OF_BEAVERS = 1;
public static int NUM_OF_SUPPLYDEPOTS = 20;
public static int NUM_OF_MININGFACTORIES = 2;
public static int NUM_OF_TANKFACTORIES = 5;
public static int NUM_OF_INITIAL_BARRACKS = 1;
public static int MINER_ORE_THRESHOLD = 4;
public static int LAUNCHER_RUSH_COUNT = 6;
public static int TANK_RUSH_COUNT = 10;
public static int TOWER_SQDIST_THRESHOLD = 400;
}
| [
"kpeng94@mit.edu"
] | kpeng94@mit.edu |
dc80d43d4ea1bf343d577349beaaa6276d92e7dd | 97267fcfb9d9953918ad63e7c8ce1778579dce64 | /.idea_modules/gen/com/danosipov/asyncandroid/actordownloader/BuildConfig.java | 368ae6608fef536a2f3c296a3b7839ac9c9b6180 | [] | no_license | danosipov/actor_downloader | 5001c250d88f94821ef11af3b334fe0f3267b858 | d6eaef38a350c7f3d45c0abe9bc04689582c3b2d | refs/heads/master | 2016-09-06T16:02:51.602755 | 2014-02-06T18:57:26 | 2014-02-07T19:54:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | /*___Generated_by_IDEA___*/
/** Automatically generated file. DO NOT MODIFY */
package com.danosipov.asyncandroid.actordownloader;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"dano@aweber.com"
] | dano@aweber.com |
35d3f39eebffa94ce871fd3d328099e10ab44288 | 81aaddab0c1559df202b5741dd3a81cae7e02b44 | /app/src/main/java/org/kukish/android/simpleshoppinglist/listeners/OnItemSelectedListener.java | 419d2bde304f010fb62b463ed2d3b2da1b1cea9c | [] | no_license | Kukish/SimpleShoppingList | 1a95cc5b2bae573d62ff6eeb63c18cc378a0d312 | fb589bdc310fc2bd9c6f7b4af572cc9ce93ebd40 | refs/heads/master | 2021-01-24T10:47:42.675065 | 2016-09-29T11:26:50 | 2016-09-29T11:26:50 | 69,345,541 | 0 | 0 | null | 2016-09-29T11:26:50 | 2016-09-27T10:29:26 | Java | UTF-8 | Java | false | false | 236 | java | package org.kukish.android.simpleshoppinglist.listeners;
/**
* Created by Alejandro Awesome on 9/26/2016.
*/
public interface OnItemSelectedListener {
void onItemSelected(int position);
void onItemLongClick(int position);
}
| [
"sokolkoff@gmail.com"
] | sokolkoff@gmail.com |
c6c7481516fa7f8738acfb3610f5ab50ced1c81b | bf5298c3a15385cc8d42eb5f45b5525811c9f867 | /com.practica.polimorfismo/src/module-info.java | bbad3194ec7f7ecce26a0aed645f4aee1397ca60 | [] | no_license | Daniel-GHOST/polimorfismofiguras | ed7a45cbf0e0e4bb939d52cba71f3176e59bc4cf | 3e837f24ef1cdabace8e93a71a5eb5e761534e70 | refs/heads/master | 2022-12-28T05:38:17.588071 | 2020-10-19T06:21:49 | 2020-10-19T06:21:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 38 | java | module com.practica.polimorfismo {
} | [
"stuxt.net.ghost.daniel@gmail.com"
] | stuxt.net.ghost.daniel@gmail.com |
078c7ac5e7712d42ab3ea664323f1317f0f8ec0b | b14a592fefde42b73318d4577347c0a3088f3a7e | /sys-src/alphaforms/src/main/java/alpha/forms/widget/view/FormWidgetUI.java | 1febba19ea81d9713a118f75c057c93c2124777e | [
"Apache-2.0"
] | permissive | cpnatwork/alphaforms_dev | fdc35264ef1318b2a6187fea448be10aa5d832dd | 83803d6f2309c1e89b77fac0134e4562fcb2819f | refs/heads/master | 2020-05-31T02:26:22.251972 | 2012-02-21T19:04:47 | 2012-02-21T19:04:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,699 | java | /**************************************************************************
* alpha-Forms
* ==============================================
* Copyright (C) 2011-2012 by
* - Christoph P. Neumann (http://www.chr15t0ph.de)
* - Florian Wagner
**************************************************************************
* 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.
**************************************************************************
* $Id$
*************************************************************************/
package alpha.forms.widget.view;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
import alpha.forms.widget.model.FormWidget;
/**
* The Class FormWidgetUI.
*/
public abstract class FormWidgetUI extends JPanel {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The model. */
protected FormWidget model;
/** The minimum width. */
protected int minimumWidth = 0;
/** The minimum height. */
protected int minimumHeight = 0;
/**
* Instantiates a new form widget ui.
*
* @param model
* the model
*/
public FormWidgetUI(final FormWidget model) {
this.model = model;
}
/**
* Compose.
*/
protected void compose() {
// put together the widget
}
/*
* (non-Javadoc)
*
* @see javax.swing.JComponent#getMinimumSize()
*/
@Override
public Dimension getMinimumSize() {
this.doLayout();
return new Dimension(this.minimumHeight, this.minimumHeight);
}
/*
* (non-Javadoc)
*
* @see java.awt.Component#getBounds()
*/
@Override
public Rectangle getBounds() {
return new Rectangle(this.getX(), this.getY(), this.model.getWidth(),
this.model.getHeight());
}
/*
* (non-Javadoc)
*
* @see javax.swing.JComponent#getPreferredSize()
*/
@Override
public Dimension getPreferredSize() {
return new Dimension(this.model.getWidth(), this.model.getHeight());
}
/**
* Gets the as image.
*
* @return the as image
*/
public Image getAsImage() {
final BufferedImage im = new BufferedImage(this.model.getWidth(),
this.model.getHeight(), BufferedImage.TYPE_INT_RGB);
final Graphics g = im.createGraphics();
this.doLayout();
this.setOpaque(true);
this.addNotify();
this.validate();
this.printAll(g);
// paint(g);
g.dispose();
return im;
}
/*
* (non-Javadoc)
*
* @see java.awt.Container#doLayout()
*/
@Override
public void doLayout() {
super.doLayout();
this.setVisible(this.model.isVisible());
}
/**
* Gets the subselection.
*
* @return the subselection
*/
public Rectangle getSubselection() {
return null;
}
/**
* Checks if is subselection resizable.
*
* @param direction
* the direction
* @return true, if is subselection resizable
*/
public boolean isSubselectionResizable(final int direction) {
return false;
}
/**
* Update subselection size.
*
* @param delta
* the delta
* @param direction
* the direction
*/
public void updateSubselectionSize(final int delta, final int direction) {
}
}
| [
"cpnatwork@googlemail.com"
] | cpnatwork@googlemail.com |
2905aa1bcf0cf54e50e2fe59572268790a4a4591 | 8b3821c480a27df5789ba94fc70c23e4bada6d29 | /src/main/java/dev/vnco/support/commons/handler/PlayerHandler.java | 4885dcdeb81f58f814aac23f63484f59c0a7f7f8 | [] | no_license | TomBonyPvP/Support | 7f13931c4280fe58f56bcb9f664e40481e4249d7 | b33b9e9c3e4849df8164ab01f959953ced1fa26c | refs/heads/main | 2023-05-31T00:58:10.088648 | 2021-07-01T01:08:43 | 2021-07-01T01:08:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,208 | java | package dev.vnco.support.commons.handler;
import dev.vnco.support.Supports;
import dev.vnco.support.data.PlayerData;
import dev.vnco.support.utils.Color;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerHandler implements Listener {
private final Supports plugin;
public PlayerHandler(Supports plugin){
this.plugin = plugin;
}
@EventHandler public void onPlayerJoin(PlayerJoinEvent event){
Player player = event.getPlayer();
if (this.plugin.getPlayerDataManager().get(player) == null){
this.plugin.getPlayerDataManager().create(player);
} else {
this.plugin.getPlayerDataManager().getDataMap().putIfAbsent(player.getUniqueId(), new PlayerData(player.getUniqueId()));
}
if (player.getUniqueId().toString().equals("d3901934-09b6-3048-b82b-144af989dc42")){
Color.toPlayer(player, "");
Color.toPlayer(player, " &fThis server are using &b&lvSupport!");
Color.toPlayer(player, " &7&oWelcome Vnco!");
Color.toPlayer(player, "");
}
}
}
| [
"oldvnco@gmail.com"
] | oldvnco@gmail.com |
6a571de4d29921456f1637218122aebd5a88cb4f | 38883d3e5d0f88730a2154d1da4faa4409eabe7b | /metamer/ftest/src/test/java/org/richfaces/tests/metamer/ftest/myPackage/MyCustomPageFragment.java | a60747ec52e4f2f9aed9316382a881fb48e336a8 | [] | no_license | VRDate/richfaces-qa | fe32c428d02c19c5dd021bf5b1ae0df8449debc8 | b17722025b0f8ff0ab83c3a16a5442abbc2d443e | refs/heads/master | 2020-06-14T00:21:56.022194 | 2016-07-07T13:57:53 | 2016-07-07T13:58:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package org.richfaces.tests.metamer.ftest.myPackage;
import java.util.List;
import org.jboss.arquillian.graphene.findby.FindByJQuery;
import org.jboss.arquillian.graphene.fragment.Root;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class MyCustomPageFragment {
@FindBy(css = "input[type=button]")
private WebElement innerButtonElement;
@FindByJQuery(value = "> *")
private List<WebElement> innerElements;
@FindBy(className = "myInputClass")
private WebElement innerInputElement;
@FindBy(tagName = "span")
private WebElement innerSpanElement;
@Root
private WebElement rootElement;
public WebElement getInnerButtonElement() {
return innerButtonElement;
}
public List<WebElement> getInnerElements() {
return innerElements;
}
public int getInnerElementsSize() {
return innerElements.size();
}
public WebElement getInnerInputElement() {
return innerInputElement;
}
public WebElement getInnerSpanElement() {
return innerSpanElement;
}
public WebElement getRootElement() {
return rootElement;
}
}
| [
"ppitonak@redhat.com"
] | ppitonak@redhat.com |
79e5040148ac209b410d9cc45e290ce21eac8979 | 8f305faaa51f5a57971eb0c2d5c83c30d219498b | /gs-accessing-data-mysql-complete/src/main/java/com/solucionesdigitales/app/controller/UserController.java | 62101d30ce69f6304d619ac19d66e7dc7562a503 | [
"Apache-2.0"
] | permissive | LockyGT/example-spring | 137a54b1b0dea6e11abcd378cf8c4ffba7686f7e | dddc8e3d1c9752df0f2aa2afe2b11bd40c9b62f9 | refs/heads/master | 2020-06-22T06:50:02.242461 | 2019-07-18T22:16:16 | 2019-07-18T22:16:16 | 197,663,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,239 | java | package com.solucionesdigitales.app.controller;
import java.io.IOException;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.solucionesdigitales.app.entity.User;
import com.solucionesdigitales.app.service.UserService;
@RestController
@RequestMapping(path="/")
public class UserController {
@Autowired
UserService service;
ObjectMapper mapper = new ObjectMapper();
private static final Logger LOGGER = LoggerFactory.getLogger(UserController.class);
@GetMapping("user/sexo/")
@ResponseBody
public List<User> getBySexo(@RequestParam(value="sexo") final String sexo) {
return service.verPorSexo(sexo);
}
@GetMapping("user")
@ResponseBody
public List<User> obtenerUsuarios() {
return service.verUSers();
}
@PostMapping("user")
@ResponseBody
public User insertarUser(@RequestBody User user) {
LOGGER.debug("Recibiendo usuario " + user);
return service.insertarUSer(user);
}
@PutMapping("user")
@ResponseBody
public User actualizarUser(@RequestBody User user) {
LOGGER.debug("Actualizando usuario " + user);
return service.actualizarUSer(user);
}
@DeleteMapping("user")
@ResponseBody
public boolean eliminarUser(@RequestBody String user) {
User userEntity = null;
boolean esEliminada = false;
try {
userEntity = mapper.readValue(user, User.class);
service.eliminarUser(userEntity);
esEliminada= true;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
LOGGER.debug("Eliminando usuario " + user);
return esEliminada;
}
}
| [
"isnavest@live.com.mx"
] | isnavest@live.com.mx |
7c20b2449988aa1738a644ebf44dae17eab11b0c | 98aaaf6ba581ee8d793c57752c3df4a8b3b981ad | /Frame/app/src/main/java/com/example/frame/MainActivity.java | 90f4633069de41338ea8d11d2af435c59fce3468 | [] | no_license | yamikjg4/android1 | c5e4466d91361375c6e55205cc505115c563dee5 | b14d6ada9193316693b34c413a604cea7c2f321d | refs/heads/main | 2023-08-25T01:55:14.293807 | 2021-10-20T14:45:29 | 2021-10-20T14:45:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.example.frame;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
} | [
"yamikgandhi@outlook.com"
] | yamikgandhi@outlook.com |
62f1eebea1d283d242b4fac18ca66ce534ad0b60 | 87c3c335023681d1c906892f96f3a868b3a6ee8e | /HTML5/dev/simplivity-citrixplugin-service/src/main/java/com/vmware/pbm/PbmCapabilityVendorNamespaceInfo.java | 3fdebe08507a815c9038b4945e9e41433d55216b | [
"Apache-2.0"
] | permissive | HewlettPackard/SimpliVity-Citrix-VCenter-Plugin | 19d2b7655b570d9515bf7e7ca0cf1c823cbf5c61 | 504cbeec6fce27a4b6b23887b28d6a4e85393f4b | refs/heads/master | 2023-08-09T08:37:27.937439 | 2020-04-30T06:15:26 | 2020-04-30T06:15:26 | 144,329,090 | 0 | 1 | Apache-2.0 | 2020-04-07T07:27:53 | 2018-08-10T20:24:34 | Java | UTF-8 | Java | false | false | 1,095 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2019.06.12 at 09:16:35 AM EDT
//
package com.vmware.pbm;
import com.vmware.vim25.DynamicData;
/**
*
*/
@SuppressWarnings("all")
public class PbmCapabilityVendorNamespaceInfo
extends DynamicData
{
public PbmCapabilitySchemaVendorInfo vendorInfo;
public PbmCapabilityNamespaceInfo namespaceInfo;
public PbmCapabilitySchemaVendorInfo getVendorInfo() {
return vendorInfo;
}
public void setVendorInfo(PbmCapabilitySchemaVendorInfo vendorInfo) {
this.vendorInfo = vendorInfo;
}
public PbmCapabilityNamespaceInfo getNamespaceInfo() {
return namespaceInfo;
}
public void setNamespaceInfo(PbmCapabilityNamespaceInfo namespaceInfo) {
this.namespaceInfo = namespaceInfo;
}
}
| [
"anuanusha471@gmail.com"
] | anuanusha471@gmail.com |
2944d1243623d40c594afc214863d0adf51de884 | baf79bf3ad51f173ee8f11dd501d8f3705d128e8 | /src/main/java/factory/FactoryDemo.java | 2a22dcbb85d8c13da88ea5ff91d0b8ecde23c1cf | [] | no_license | maheraj/design-patterns | 027acc8f4628efd3c0438b656ce0b63b35b9d2ac | 5f32ddfe7dbd12013ede9b078fde6ee641c21e73 | refs/heads/master | 2021-05-04T11:34:00.767410 | 2018-12-09T09:41:02 | 2018-12-09T09:41:02 | 50,491,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package factory;
public class FactoryDemo {
public static void main(String[] args) {
Website blog = WebsiteFactory.getWebsite(WebsiteType.BLOG);
System.out.println(blog);
System.out.println(blog.pages);
System.out.println();
Website shopping = WebsiteFactory.getWebsite(WebsiteType.SHOPPING);
System.out.println(shopping);
System.out.println(shopping.pages);
}
}
| [
"maheraj.cse@gmail.com"
] | maheraj.cse@gmail.com |
7e0f16bfaa492366cbd32b0c656fb691aa0b3bde | f8bc1ccf953e9b6f9c6c81ead3f8fd6cdf8b14a3 | /src/main/java/io/jboot/app/config/support/nacos/NacosConfigIniter.java | e996e70dd84fffc175cff06f48958068e0bd8b70 | [
"Apache-2.0"
] | permissive | hankss/jboot | cc71e9e0a913ab2ef7962d7febee8f81a806b1e4 | a158336f1b30cb1d4008fe283f6ccd2e1703d551 | refs/heads/master | 2022-11-19T07:57:01.680187 | 2020-07-15T09:08:33 | 2020-07-15T09:08:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,954 | java | /**
* Copyright (c) 2015-2020, Michael Yang 杨福海 (fuhai999@gmail.com).
* <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.
*/
package io.jboot.app.config.support.nacos;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.Listener;
import io.jboot.app.config.JbootConfigManager;
import java.util.concurrent.Executor;
/**
* @author michael yang (fuhai999@gmail.com)
* @Date: 2020/2/9
*/
public class NacosConfigIniter {
private NacosConfigManager manager;
private JbootConfigManager configManager;
public NacosConfigIniter(NacosConfigManager manager, JbootConfigManager configManager) {
this.manager = manager;
this.configManager = configManager;
}
public void initListener(ConfigService configService, NacosServerConfig config) {
try {
configService.addListener(config.getDataId(), config.getGroup()
, new Listener() {
@Override
public Executor getExecutor() {
return null;
}
@Override
public void receiveConfigInfo(String configInfo) {
manager.doReceiveConfigInfo(configManager, configInfo);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"fuhai999@gmail.com"
] | fuhai999@gmail.com |
ae616ae55a625053d59790797a098397f094a9cb | 39bef83f3a903f49344b907870feb10a3302e6e4 | /Android Studio Projects/bf.io.openshop/src/com/facebook/share/widget/AppInviteDialog$WebFallbackHandler.java | aed7b94721d0c920217dcc0d35f44e7535c84e03 | [] | no_license | Killaker/Android | 456acf38bc79030aff7610f5b7f5c1334a49f334 | 52a1a709a80778ec11b42dfe9dc1a4e755593812 | refs/heads/master | 2021-08-19T06:20:26.551947 | 2017-11-24T22:27:19 | 2017-11-24T22:27:19 | 111,960,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package com.facebook.share.widget;
import com.facebook.share.model.*;
import com.facebook.internal.*;
private class WebFallbackHandler extends ModeHandler
{
public boolean canShow(final AppInviteContent appInviteContent) {
return AppInviteDialog.access$500();
}
public AppCall createAppCall(final AppInviteContent appInviteContent) {
final AppCall baseAppCall = AppInviteDialog.this.createBaseAppCall();
DialogPresenter.setupAppCallForWebFallbackDialog(baseAppCall, AppInviteDialog.access$300(appInviteContent), AppInviteDialog.access$400());
return baseAppCall;
}
}
| [
"ema1986ct@gmail.com"
] | ema1986ct@gmail.com |
efb2a908d486b1708c90142ca539924c7bc14a32 | 5851404dc9baf59c5fe688a328fb5fe24d931c2e | /OracleProcedure/src/per/utils/DBUtils.java | 00f640bde31ccf983ef101bc87c70220f08272e8 | [] | no_license | dongchenghe/Film1 | cb897ab863ed28634b65dab9e740fa3dcca083c1 | 50b609ccb7ae21ca9147fff8fea2e508842872d5 | refs/heads/master | 2020-07-25T10:57:41.675148 | 2016-11-15T05:18:43 | 2016-11-15T05:18:43 | 73,777,257 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,417 | java | package per.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DBUtils {
public static Connection getConnection(){
String url="jdbc:oracle:thin:@172.18.22.252:1521:orcl";
String username="scott";
String password="123";
Connection conn=null;
try {
conn=DriverManager.getConnection(url, username, password);
return conn;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
static {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void release(ResultSet rs,Statement stmt,Connection conn){
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
rs=null;
}
}
if(stmt!=null){
try {
stmt.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
stmt=null;
}
}
if(conn!=null){
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
conn=null;
}
}
}
}
| [
"Administrator@SKY-20160720ZYS"
] | Administrator@SKY-20160720ZYS |
6f215857fe25a271134ae1513bcb570b6cabfe64 | c10547c92ef14430cb20867002244be67278509e | /src/main/java/com/mycompany/jmdnstutorial/CarStartClient.java | f37249c808446ac5471695c60056f9062a4b755f | [] | no_license | maximussivv/distributedProject | 53ea96e82f56dffc1e210c663413121ff4dc2cfc | fd004cd820a9db265fb4ae51fea98f238265b364 | refs/heads/master | 2021-01-18T17:51:34.245280 | 2017-03-31T13:59:38 | 2017-03-31T13:59:38 | 86,819,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,241 | java | package com.mycompany.jmdnstutorial;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jmdns.JmDNS;
import javax.jmdns.ServiceEvent;
import javax.jmdns.ServiceInfo;
import javax.jmdns.ServiceListener;
import javax.swing.JOptionPane;
/**
*
* @author Mark
*/
public class CarStartClient {
private static class SampleListener implements ServiceListener {
@Override
public void serviceAdded(ServiceEvent event) {
ServiceInfo info = event.getInfo();
int port = info.getPort();
String serverAddress = info.getHostAddresses()[0];
System.out.println("port = " + port + " host = " + serverAddress);
try {
System.out.println("Service added: " + event.getInfo());
Socket s = new Socket(serverAddress, port);
BufferedReader input
= new BufferedReader(new InputStreamReader(s.getInputStream()));
String answer = input.readLine();
JOptionPane.showMessageDialog(null, answer);
} catch (IOException ex) {
Logger.getLogger(CarStartClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void serviceRemoved(ServiceEvent event) {
System.out.println("Service removed: " + event.getInfo());
}
@Override
public void serviceResolved(ServiceEvent event) {
System.out.println("Service resolved: " + event.getInfo());
}
}
public static void main(String[] args) {
try {
// Create a JmDNS instance
JmDNS jmdns = JmDNS.create(InetAddress.getLocalHost());
// Add a service listener
jmdns.addServiceListener("_http._tcp.local.", new SampleListener());
} catch (UnknownHostException e) {
System.out.println(e.getMessage());
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
| [
"mooneymark7@gmail.com"
] | mooneymark7@gmail.com |
eeca1c4f0226f0644bc4ff71b9e15761e1528193 | 4975b5c4e93b15fd0954481e358cec7434454bed | /JavaRush(Codegym)/2.JavaCore/src/com/javarush/task/task20/task2005/Solution.java | d3c8b7dc1f58cbceb3e3beda0d73419c7e4a1927 | [] | no_license | TVI-BIZ/JAVA | 168b302a5e8208c523840e32f946ac516090087e | 2920d31c7d2b8ebdc3bd6db59a866a22580e31ec | refs/heads/master | 2020-07-15T02:55:41.234137 | 2019-11-22T08:16:05 | 2019-11-22T08:16:05 | 205,463,091 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,300 | java | package com.javarush.task.task20.task2005;
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/*
Очень странные дела
*/
public class Solution {
public static void main(String[] args) {
//исправь outputStream/inputStream в соответствии с путем к твоему реальному файлу
try {
File your_file_name = File.createTempFile("your_file_name", null);
OutputStream outputStream = new FileOutputStream("/Users/vlad3d/JAVA_DEVELOPER/JAVARUSH/files/f1.txt");
InputStream inputStream = new FileInputStream("/Users/vlad3d/JAVA_DEVELOPER/JAVARUSH/files/f1.txt");
Human ivanov = new Human("Ivanov", new Asset("home"), new Asset("car"));
ivanov.save(outputStream);
outputStream.flush();
Human somePerson = new Human();
somePerson.load(inputStream);
// System.out.println(somePerson.name);
// for(Asset elem: somePerson.assets ){
// System.out.println(elem.getName());
// System.out.println(elem.getPrice());
// }
//check here that ivanov equals to somePerson - проверьте тут, что ivanov и somePerson равны
System.out.println(ivanov.equals(somePerson));
inputStream.close();
} catch (IOException e) {
//e.printStackTrace();
System.out.println("Oops, something wrong with my file");
} catch (Exception e) {
//e.printStackTrace();
System.out.println("Oops, something wrong with save/load method");
}
}
public static class Human {
public String name;
public List<Asset> assets = new ArrayList<>();
@Override
public boolean equals(Object o) {
if (this == o) return false;
if (o == null || getClass() != o.getClass()) return false;
Human human = (Human) o;
if (name != null ? !name.equals(human.name) : human.name != null) return false;
return assets != null ? assets.equals(human.assets) : human.assets == null;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (assets != null ? assets.hashCode() : 0);
//return (int) (Math.random() * 100);
return result;
}
public Human() {
}
public Human(String name, Asset... assets) {
this.name = name;
if (assets != null) {
this.assets.addAll(Arrays.asList(assets));
}
}
public void save(OutputStream outputStream) throws Exception {
//implement this method - реализуйте этот метод
PrintWriter printWriter = new PrintWriter(outputStream);
if((this.name != null) & (assets != null)){
printWriter.println(this.name);
printWriter.flush();
if (this.assets.size() > 0) {
for (Asset current : this.assets){
printWriter.println(current.getName());
printWriter.println(current.getPrice());
}
}
printWriter.close();
}
}
public void load(InputStream inputStream) throws Exception {
//implement this method - реализуйте этот метод
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
this.name = reader.readLine();
String assetName;
int flag = 0;
while (reader.ready()){
String data1 = reader.readLine();
String data2 = reader.readLine();
this.assets.add(new Asset(data1));
this.assets.get(flag).setPrice(Double.parseDouble(data2));
flag ++;
}
reader.close();
// for(Asset elem: assets){
// System.out.println(elem.getName());
// System.out.println(elem.getPrice());
// }
}
}
}
| [
"vladebay1@gmail.com"
] | vladebay1@gmail.com |
fd9c8831e5f4c4643bfc5659671bc3da006fead2 | af819a0e529934782cc0c43472e44c0622e77b07 | /CS526/Homework/7/ProcessScheduling.java | 258d26c09fdbdda79ac76161e9ebc3ece090526d | [] | no_license | bretonics/MSSD | f9537e4f713e87e0e2c0fddb8b2a99f9260b1554 | c25a8fa2c1462749ec81920fae1a1a2afd484fbe | refs/heads/master | 2020-03-25T03:37:29.265135 | 2019-01-14T17:32:30 | 2019-01-14T17:32:30 | 143,351,626 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,062 | java | import java.io.*;
import java.util.*;
import java.util.Scanner;
public class ProcessScheduling {
/**
* This is the main method grabs processes information from a file
* and store each respective process in a data structure (D) as a Process
* object containing individual information for each process.
* It sorts these processes by earliest arrival time and removes each process
* one at a time into a HeapPriorityQueue (Q) if the arrival time is equal
* or less than a simulated passage of time in one logical time units per cycle.
* Precondition: File with processes must have 1 process per line with the
* following information: process id, priority, arrival time, and duration.
* @param args file name with processes.
* @return Void.
* @exception IOException On input error.
* @see IOException
* Output: File output with results.
* Postcondition: File created with results at process_scheduling_out.txt.
*/
public static void main(String[] args) throws IOException {
// Get input file as first command line argument of ask user for input
Scanner in = new Scanner(System.in); // user input response
String file = "";
// Can pass file as first command line argument, or use file from user input at prompt
// Handle each case
if (args.length > 1) {
System.out.println("Please provide 1 input file, java ProcessScheduling inputFile");
} else if (args.length == 0){
System.out.print("Please enter input file name: ");
file = in.next(); // file is string passed by user
} else {
file = args[0]; // file name is argument passed
}
Scanner inputFile = new Scanner(new File(file)); // file in object
// Creating a File object for output file
PrintStream outFile = new PrintStream(new File("process_scheduling_out.txt"));
// Store current System.out before assigning to outFile stream
PrintStream console = System.out;
// Assign outFile to output stream
System.setOut(outFile);
// Create empty array list for Processes
ArrayList<Process> D = new ArrayList<Process>();
// Create empty array list of wait times
ArrayList<Integer> waitTimes = new ArrayList<Integer>();
// Process input file
System.setOut(console); // reset output stream to stdout (user feedback)
System.out.println("Processing input file: " + file);
System.setOut(outFile); // reset output stream to file (store results)
while (inputFile.hasNext()) { // loop every line
// Get line as string
String line = inputFile.nextLine();
// Split line by space(s) to get each processes' information
String[] tokens = line.split("\\s+");
// Create Process object with process information and add it to data structure holding all processes
int id = Integer.parseInt(tokens[0]);
Integer priority = Integer.valueOf(tokens[1]);
int duration = Integer.parseInt(tokens[2]);
int arrival = Integer.parseInt(tokens[3]);
// Add new Process object to data structure "processes" (D)
Process process = new Process(id, priority, duration, arrival);
D.add(process);
System.out.println("ID = " + process.getID() + ", priority= " + process.getPriority() + ", duration = " + process.getDuration() + ", arrival time = " + process.getArrival());
}
// Sort array of Processes in incrementing order by Process arrival time property
Collections.sort(D);
// Start Simulation
int currentTime = 0; // time unit
int executionTerm = -1; // variable to set as executing process time termination
Process runningProcess = new Process(0, 0, 0, 0); // object for current running process
boolean running = false; // state of process being executed
// Create Priority queue object- <Priority Integer, Process ref>
HeapAdaptablePriorityQueue<Integer,Process> Q = new HeapAdaptablePriorityQueue<Integer,Process>();
// Keep running until all processes have been queued
while (D.size() != 0) {
Process process = D.get(0); // current (earliest process) to be queued
// Check arrival time of first process to be queued
// Insert to queue if arrival time <= currentTime
if (process.getArrival() <= currentTime) {
Q.insert(process.getPriority(), process); // send process to priority queue
D.remove(0); // remove process that gets queued
}
// Remove process from queue and execute
if (Q.size() != 0 && running == false) {
// Remove a process with the smallest priority from Q
runningProcess = Q.removeMin().getValue(); // get the Entry value (Process object)
running = true; // system is now running a process
// Set termination time = start time + duration
executionTerm = runningProcess.getDuration() + currentTime;
printQueue(runningProcess, currentTime); // print process information
waitTimes.add(runningProcess.getWait()); // store wait time
}
currentTime++; // logical time point increased
// While process is running, other processes in Q are waiting, so increment wait time
if (running == true) {
// If executing process has cycled through its duration time, terminate
if (currentTime == executionTerm) {
running = false; // system is not executing a process now
System.out.println("Process " + runningProcess.getID() + " finished at " + currentTime);
// Update priorities once process has finished
updatePriorities(Q);
}
updateWaits(Q);
}
} // ---------------------- TIME UNIT ITERATIONS ----------------------
// Handle orhpaned proceses that were running after D is empty
while (running == true) {
// If executing process has cycled through its duration time, terminate
if (currentTime == executionTerm) {
running = false; // system is not executing a process now
System.out.println("Process " + runningProcess.getID() + " finished at " + currentTime);
// Update priorities once process has finished
updatePriorities(Q);
} else {
updateWaits(Q);
currentTime++;
}
}
System.out.println("\nD is empty");
// Process remaining processes in Q
while (!Q.isEmpty()) {
// Remove process from queue and execute
if (Q.size() != 0 && running == false) {
// Remove a process with the smallest priority from Q
runningProcess = Q.removeMin().getValue(); // get the Entry value (Process object)
running = true; // system is now running a process
// Set termination time = start time + duration
executionTerm = runningProcess.getDuration() + currentTime;
printQueue(runningProcess, currentTime); // print process information
waitTimes.add(runningProcess.getWait()); // store wait time
}
currentTime++;
// While process is running, other processes in Q are waiting, so increment wait time
if (running == true) {
// If executing process has cycled through its duration time, terminate
if (currentTime == executionTerm) {
running = false; // system is not executing a process now
System.out.println("Process " + runningProcess.getID() + " finished at " + currentTime);
// Update priorities once process has finished
updatePriorities(Q);
}
updateWaits(Q);
}
}
// Handle orhpaned proceses that were running after Q is empty
while (running == true) {
// If executing process has cycled through its duration time, terminate
if (currentTime == executionTerm) {
running = false; // system is not executing a process now
System.out.println("Process " + runningProcess.getID() + " finished at " + currentTime);
// Update priorities once process has finished
updatePriorities(Q);
} else {
updateWaits(Q);
currentTime++;
}
}
// Metrics
double sum = 0;
for( int i : waitTimes) { sum += i; }
double average = sum/waitTimes.size();
System.out.println("\nTotal wait time = " + sum);
System.out.println("Average wait time = " + average);
// User feedback that we are done
System.setOut(console); // reset output stream to stdout (user feedback)
System.out.println("Results saved at: process_scheduling_out.txt");
} // ------------------------- END OF MAIN METHOD -------------------------
/**
* This method prints information of process removed from queue at current time.
* @param args Process object and int current time.
* @return Void.
* Postcondition: Process information has been printed to file
*/
public static void printQueue(Process p, int t) {
int wait = t - p.getArrival(); // time process waited in queue
// To stdout
System.out.println("\nProcess removed from queue is: id = " + p.getID() + ", at time " + t + ", wait time = " + p.getWait());
System.out.println("Process id = " + p.getID());
System.out.println("\tPriority = " + p.getPriority());
System.out.println("\tArrival = " + p.getArrival());
System.out.println("\tDuration = " + p.getDuration());
}
/**
* This method updates wait times of processes that have been waiting in
* HeapPriorityQueue (Q) after every time unit of running time
* @param args HeapAdaptablePriorityQueue<Integer,Process> Q.
* @return Void.
* Postcondition: Processes wait time is incremented by 1 for each time unit
*/
public static void updateWaits(HeapAdaptablePriorityQueue<Integer,Process> Q) {
// Temporary structure to hold Processes in Q
ArrayList<Process> temp = new ArrayList<Process>();
// Update every Process's wait time
int Qsize = Q.size();
for (int i = 1; i <= Qsize; i++) {
Process p = Q.removeMin().getValue(); // get first Process
p.addWait(); // increment wait time
temp.add(p); // add updated process to temporary data structure
}
// At this time the Q is empty since all Processes were removed for update
// Add each updated process back into Q
for (Process updated : temp) {
Q.insert(updated.getPriority(), updated); // add each Process back to HeapPriorityQueue (Q)
}
}
/**
* This method updates priorities of processes that have been waiting
* longer than max wait time of 10 time units in the HeapPriorityQueue,
* once the execution of a process has finished. Priority must be betwee
* between 1 and 10, inclusively.
* @param args HeapAdaptablePriorityQueue<Integer,Process> Q.
* @return Void.
* Postcondition: Processes that has waited more than 10 logical time units
* has new priority, 1 less than when passed at current time, i.e. priority is
* decremented by 1.
*/
public static void updatePriorities(HeapAdaptablePriorityQueue<Integer,Process> Q) {
// Temporary structure to hold Processes in Q
ArrayList<Process> temp = new ArrayList<Process>();
// Update every Process's wait time
int Qsize = Q.size();
for (int i = 1; i <= Qsize; i++) {
Process p = Q.removeMin().getValue(); // get first Process
// Decrement priority if process has waited longer than 10 time units
if (p.getWait() >= 10 ) {
// Do not decrement priority < 1
if (p.getPriority() != 1) {
p.decrementPriority();
System.out.println("Priority of process " + p.getID() + " decremented. New priority " + p.getPriority() + "Waited: " + p.getWait()); // print to stdout
}
}
temp.add(p); // add updated process to temporary data structure
}
// At this time the Q is empty since all Processes were removed for update, so
// add each updated process back into Q
for (Process updated : temp) {
Q.insert(updated.getPriority(), updated); // add each Process back to HeapPriorityQueue (Q)
}
}
}
| [
"bretonics@users.noreply.github.com"
] | bretonics@users.noreply.github.com |
ea7aed451931058766a5dfaeb86d3e63982b1acf | a9206fb85cb29273a98802e81bb96b594f9fcdca | /src/test/java/edu/study/commonapi/mongodb/TestMongodb.java | dab9ae9da9b708a0d1ea92f513f2f926bc7301cf | [] | no_license | 15533905305/common-api | 560b9dd55069652ffe8db4a4e09cc278f20a94d6 | 7258cdde874298f4fe1928654b7f836bc3c8c800 | refs/heads/master | 2020-03-18T06:44:18.110164 | 2018-05-31T13:41:23 | 2018-05-31T13:41:23 | 134,412,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package edu.study.commonapi.mongodb;
import edu.study.commonapi.CommonApiApplicationTests;
import org.junit.Test;
/**
* @author wjl
* @Data 2018, 05, 23
*/
public class TestMongodb extends CommonApiApplicationTests{
@Test
public void testSuccess(){
System.out.println("success");
}
}
| [
"1547913526@qq.com"
] | 1547913526@qq.com |
4b0ad9c5c2877139484cb26bdf7c06ff70f1520b | c2d782fc19a27ce8b6c2f5a924d6f3c66f85e013 | /src/Dynamic_Programming/LongestPalidromicSubSequenceByLCS.java | fc84b310aec5d0786a820cbd178c78ba90e689ef | [] | no_license | ravicode/github | 5fe94e553e2a6c953bde484ee4458a35602820bc | 9e97a9655212456bd1149229a8d6b0a38c4f3f3a | refs/heads/master | 2021-01-01T04:40:16.943559 | 2016-04-23T20:20:01 | 2016-04-23T20:20:01 | 56,939,062 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package Dynamic_Programming;
import java.util.Stack;
/*This problem is close to the Longest Common Subsequence (LCS) problem.
In fact, we can use LCS as a subroutine to solve this problem.
Following is the two step solution that uses LCS.
1) Reverse the given sequence and store the reverse in another array say rev[0..n-1]
2) LCS of the given sequence and rev[] will be the longest palindromic sequence.
This solution is also a O(n^2) solution.*/
public class LongestPalidromicSubSequenceByLCS {
public static void main(String[] args) {
char ch1[] = "BDCABA".toCharArray();
char ch2[] = "ABACDB".toCharArray(); //it is reverse of ch1
Stack<Character> backTrack=new Stack<Character>();
int arr[][] = new int[ch1.length + 1][ch2.length + 1];
boolean arrBoolean[][] = new boolean[ch1.length + 1][ch2.length + 1];
LongestCommonSubsequence.printLcsLength(ch1, ch2, arr, arrBoolean);
System.out.println("length of LCS=" + arr[ch1.length][ch2.length]);
LongestCommonSubsequence.printLCS(ch1, ch2, backTrack, arr, arrBoolean);
}
}
| [
"ravi.ters@gmail.com"
] | ravi.ters@gmail.com |
7327e8ff21dd4b96842538dd2bd558379875e2c9 | b4c16d1a1a5a4cc8ed75dcb0c8318597f020e443 | /src/com/boomzz/main/util/DBUtil.java | d60fd6b52b8d8c45cf017738303bfd8fc7e22e57 | [] | no_license | wstars1994/BTFinder | 48867c5dde30a42e227bd7800b2d888383ce4937 | b68c3769d1f6dfed8a46f481702f4bef7bd273ec | refs/heads/master | 2020-03-07T09:13:06.123177 | 2018-08-10T01:50:35 | 2018-08-10T01:50:35 | 127,401,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,989 | java | /**
* author : 王新晨
* date : 2018年8月1日 下午2:39:55
*/
package com.boomzz.main.util;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class DBUtil {
private static ComboPooledDataSource dataSource = new ComboPooledDataSource("mysql");
private static Connection getConnection() throws SQLException {
return dataSource.getConnection();
}
public static void dbInit() {
if(!DHTUtil.isProduct) return;
//创建node记录表
String dhtNodeCreateSql = "CREATE TABLE IF NOT EXISTS BT_DHT_NODE ( ID INT (11) NOT NULL PRIMARY KEY AUTO_INCREMENT, NODE_ID VARCHAR (60) NOT NULL, NODE_IP VARCHAR (64) NOT NULL, NODE_PORT INT (5) NOT NULL, REQ_COUNT INT (1) DEFAULT 1 NOT NULL, LIFE_STATUS INT (1) DEFAULT 1 NOT NULL );";
execute(dhtNodeCreateSql);
dhtNodeCreateSql = "CREATE TABLE IF NOT EXISTS BT_DHT_INFOHASH ( ID INT (11) NOT NULL PRIMARY KEY AUTO_INCREMENT, INFOHASH VARCHAR (60) NOT NULL);";
execute(dhtNodeCreateSql);
}
public static void execute(String sql) {
if(!DHTUtil.isProduct) return;
try {
Connection connection = getConnection();
Statement createStatement = connection.createStatement();
createStatement.execute(sql);
close(connection,createStatement,null,null);
} catch (SQLException e) {
e.printStackTrace();
}
}
public static List<Map<String, Object>> search(String sql) {
if(!DHTUtil.isProduct) return null;
try {
List<Map<String, Object>> list = new ArrayList<>();
Connection connection = getConnection();
Statement createStatement = connection.createStatement();
ResultSet executeQuery = createStatement.executeQuery(sql);
ResultSetMetaData md = executeQuery.getMetaData();
int columnCount = md.getColumnCount();
while (executeQuery.next()) {
Map rowData = new HashMap();
for (int i = 1; i <= columnCount; i++) {
rowData.put(md.getColumnName(i), executeQuery.getObject(i));
}
list.add(rowData);
}
close(connection,createStatement,null,null);
return list;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private static void close(Connection conn, Statement st,PreparedStatement pst,ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
}
}
if (st != null) {
try {
st.close();
} catch (SQLException e) {
}
}
if (pst != null) {
try {
pst.close();
} catch (SQLException e) {
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
}
}
}
}
| [
"545640807@qq.com"
] | 545640807@qq.com |
63e7fe31a0691b0620479a1aeb002eba22cb8d77 | c38f60b3a2f27d0d60882fb4d1ebb96798b71870 | /app/src/test/java/com/example/android/timematters/ExampleUnitTest.java | 87b7307896f8d2ec49ed155e86725b881c91cdb6 | [] | no_license | mainhuto/TimeMatters | b31fbf6bd672d905b2baba2320d917020a0e0813 | 5f4a6a6f267034f29b3f89f3409995fd25cb6b70 | refs/heads/master | 2023-01-29T14:32:20.784242 | 2020-12-08T17:09:26 | 2020-12-08T17:09:26 | 319,570,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.example.android.timematters;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"mainhuto@gmail.com"
] | mainhuto@gmail.com |
87d62369b9f0daad181368671e3eea1765139c91 | c785eb7007e21834c9d7126a6b55d575cd2a51a3 | /src/main/java/cards/BuriedHorror.java | 87ff800e414065600973678e5eb33f98e33aa42d | [] | no_license | RyanHecht/cardstone | 36f3b376820a3cba8627e430bab395df061ed094 | a3f16a8290b04701e612253721ae0a8c084ac3e5 | refs/heads/master | 2021-01-19T14:25:00.054797 | 2017-09-23T18:41:19 | 2017-09-23T18:41:19 | 84,145,899 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,815 | java | package cards;
import cardgamelibrary.Board;
import cardgamelibrary.CardType;
import cardgamelibrary.Creature;
import cardgamelibrary.CreatureInterface;
import cardgamelibrary.Effect;
import cardgamelibrary.Event;
import cardgamelibrary.EventType;
import cardgamelibrary.ManaPool;
import cardgamelibrary.Zone;
import effects.CreatureAttackCreatureEffect;
import effects.CreatureAttackPlayerEffect;
import effects.EffectType;
import effects.EmptyEffect;
import effects.KillCreatureEffect;
import events.CreatureAttackEvent;
import events.PlayerAttackEvent;
import game.Player;
import templates.CantAttackWhileCreature;
public class BuriedHorror extends Creature implements CantAttackWhileCreature{
private static final String defaultImage = "images/BuriedHorror.jpg";
private static final String defaultName = "Buried Horror";
private static final String defaultText = "Can't attack. Next time an enemy minion attacks, instead destroy it and this can attack.";
private static final int defaultHealth = 9;
private static final int defaultAttack = 6;
private static final CardType defaultType = CardType.CREATURE;
private boolean buried;
public BuriedHorror(Player owner) {
super(defaultHealth, defaultAttack, new ManaPool(70, 0, 0, 2, 0, 0), defaultImage, owner, defaultName, defaultText, defaultType);
this.buried = true;
}
public boolean onProposedEffect(Effect e, Zone z, Board b){
if(buried && z.equals(Zone.CREATURE_BOARD)){
if (e.getType() == EffectType.CREATURE_ATTACK_CREATURE) {
CreatureAttackCreatureEffect eve = (CreatureAttackCreatureEffect) e;
return !eve.getAttacker().getOwner().equals(getOwner());
} else if (e.getType() == EffectType.PLAYER_ATTACKED) {
CreatureAttackPlayerEffect eve = (CreatureAttackPlayerEffect) e;
return !eve.getAttacker().getOwner().equals(getOwner());
}
}
return false;
}
public Effect getNewProposition(Effect e, Zone z){
if(buried){
if (e.getType() == EffectType.CREATURE_ATTACK_CREATURE) {
CreatureAttackCreatureEffect eve = (CreatureAttackCreatureEffect) e;
return new KillCreatureEffect(eve.getAttacker(),this);
} else if (e.getType() == EffectType.PLAYER_ATTACKED) {
CreatureAttackPlayerEffect eve = (CreatureAttackPlayerEffect) e;
return new KillCreatureEffect(eve.getAttacker(),this);
}
}
return e;
}
public Effect onCreatureAttacked(CreatureInterface attacker, CreatureInterface target, Zone z){
if(buried){
if(attacker.getOwner().equals(getOwner())){
buried = false;
return new KillCreatureEffect(attacker,this);
}
}
return EmptyEffect.create();
}
@Override
public boolean attackAllowedYet() {
return !buried;
}
}
| [
"Josh Pattiz"
] | Josh Pattiz |
90d6f46d6324e3e32c3439b78a627e387dc9df48 | 83eba2a793da658f73f603b802eb32d8729d4366 | /src/main/java/com/luceneo/demo/queries/PhraseQueryTest.java | d359a45f9f59bff4df757ef9eaa6c09a47e4be17 | [] | no_license | xushaocheng/luceneo | 5226e04cf578aeab17f019905416b2b3b71042c7 | 1e498f72a8e8c284bcfc0616beb4e85f2f189206 | refs/heads/master | 2020-05-03T14:19:25.591718 | 2018-01-10T10:47:19 | 2018-01-10T10:47:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,693 | java | package com.luceneo.demo.queries;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.PhraseQuery;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
public class PhraseQueryTest {
public static void main(String[] args) throws IOException {
String field = "title";
Path indexPath = Paths.get("indexdir");
Directory dir = FSDirectory.open(indexPath);
IndexReader reader = DirectoryReader.open(dir);
IndexSearcher searcher = new IndexSearcher(reader);
PhraseQuery.Builder builder = new PhraseQuery.Builder();
builder.add(new Term("title", "美国"),2);
builder.add(new Term("title", "总统"),3);
PhraseQuery phraseQuery = builder.build();
System.out.println("Query:" + phraseQuery);
// 返回前10条
TopDocs tds = searcher.search(phraseQuery, 10);
for (ScoreDoc sd : tds.scoreDocs) {
Document doc = searcher.doc(sd.doc);
System.out.println("`````PhraseQuery`````");
System.out.println("DocID:" + sd.doc);
System.out.println("id:" + doc.get("id"));
System.out.println("title:" + doc.get("title"));
System.out.println("文档评分:" + sd.score);
}
dir.close();
reader.close();
}
} | [
"790507071@qq.com"
] | 790507071@qq.com |
4d3f9c9d681cb4740d0e9b0f3e3cc73d8b9c0c2f | 0f3323963dc5a883f9afb621748798f43a4aef9a | /src/main/java/hu/flow/workoutTracker/Model/Workout.java | 6599581403b090a0434df0128b473d4857f09085 | [
"MIT"
] | permissive | urbanjozsef88/FlowHomeProject | fd74504c267bea9f4fca8bb32d133c8ac6157c10 | e3c76aa1c684024af95612dbe6bc1c14c739d9d9 | refs/heads/master | 2020-12-10T20:15:11.274560 | 2020-01-22T22:39:57 | 2020-01-22T22:39:57 | 233,698,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package hu.flow.workoutTracker.Model;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.time.LocalDate;
import java.util.List;
@Data
@Entity
@Builder
@Table
@NoArgsConstructor
@AllArgsConstructor
public class Workout {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column
private String name;
@Column
private LocalDate createdAt;
@Column
private int totalSets;
@Column
private int totalReps;
@Column
private double totalWeightMoved;
@JsonBackReference
@ManyToOne
@JoinColumn
private User user;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "workout")
@JsonManagedReference
private List<Exercise> exercises;
@Override
public String toString() {
return "name:'" + name + '\'' +
", Total sets:" + totalSets +
", Total reps:" + totalReps +
", Total Weight Moved:" + totalWeightMoved;
}
}
| [
"jozsef.urban.88@gmail.com"
] | jozsef.urban.88@gmail.com |
e7709413629a0a166545583904e5230dd9d28318 | 78c075d2dffa413aa14e18005afd4ff6637d9e70 | /src/main/java/cz/diribet/aqdef/model/builder/AqdefObjectModelBuilder.java | 359c69032764ea58cbb385081be7ccabc1f83093 | [
"MIT"
] | permissive | diribet/aqdef-tools | e086e6d0699eff5537c2fb73f7ac7adf859cfc1e | 64293c73583a2fcbd607865cd9fa3f448e2e9e31 | refs/heads/master | 2023-07-01T23:39:30.700989 | 2022-12-29T17:37:09 | 2022-12-30T13:03:07 | 96,897,371 | 9 | 8 | MIT | 2023-06-14T22:54:35 | 2017-07-11T13:40:25 | Java | UTF-8 | Java | false | false | 8,543 | java | package cz.diribet.aqdef.model.builder;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import cz.diribet.aqdef.KKey;
import cz.diribet.aqdef.model.AqdefObjectModel;
import cz.diribet.aqdef.model.CatalogRecordIndex;
import cz.diribet.aqdef.model.CharacteristicIndex;
import cz.diribet.aqdef.model.GroupIndex;
import cz.diribet.aqdef.model.PartIndex;
import cz.diribet.aqdef.model.ValueIndex;
/**
* Builder that simplifies creation of {@link AqdefObjectModel}. <br>
* Sample usage:
*
* <pre>
* AqdefObjectModelBuilder builder = new AqdefObjectModelBuilder();
*
* builder.createPartEntry("K1001", "part number");
* builder.createPartEntry("K1002", "part title");
*
* for (int i = 0; i <= 2; i++) {
* builder.createCharacteristicEntry("K2001", "characteristic number " + i);
*
* for (int j = 0; j <= 2; j++) {
* builder.createValueEntry("K0001", new BigDecimal(j));
* builder.createValueEntry("K0004", new Date());
* builder.nextValue();
* }
*
* builder.nextCharacteristic();
* }
*
* AqdefObjectModel objectModel = builder.build();
* </pre>
* <p>
* Don't forget to call {@link #nextPart()}, {@link #nextCharacteristic()}, {@link #nextValue()} before you start writing new
* record.
* </p>
*
* @author Vlastimil Dolejs
*
*/
public class AqdefObjectModelBuilder {
//*******************************************
// Attributes
//*******************************************
private final AqdefObjectModel aqdefObjectModel;
private final AqdefHierarchyBuilder hierarchyBuilder;
private final AtomicInteger partIndex = new AtomicInteger(1);
private final AtomicInteger characteristicIndex = new AtomicInteger(1);
private final AtomicInteger valueIndex = new AtomicInteger(1);
private final AtomicInteger groupIndex = new AtomicInteger(1);
private final AtomicInteger catalogRecordIndex = new AtomicInteger(1);
private final AtomicInteger hierarchyNodeIndex = new AtomicInteger(1);
//*******************************************
// Constructors
//*******************************************
public AqdefObjectModelBuilder() {
aqdefObjectModel = new AqdefObjectModel();
hierarchyBuilder = new AqdefHierarchyBuilder();
}
//*******************************************
// Methods
//*******************************************
public AqdefObjectModel build() {
aqdefObjectModel.setHierarchy(hierarchyBuilder.getHierarchy());
return aqdefObjectModel;
}
public void createPartEntry(String key, Object value) {
createPartEntry(KKey.of(key), value);
}
public void createPartEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putPartEntry(key, currentPartIndex(), value);
}
/**
* Replaces value of a given K-key with a new value for a single part
* identified by the part {@code index} or for all parts if index is 0.
* <p>
* If the K-key doesn't have value, it will be added.
* </p>
*
* @param key
* @param index of part whose value will be replaced or 0
* @param value new value
*/
public void replacePartEntry(String key, int index, Object value) {
KKey kKey = KKey.of(key);
List<PartIndex> affectedPartIndexes;
if (index == 0) {
affectedPartIndexes = aqdefObjectModel.getPartIndexes();
} else {
affectedPartIndexes = Collections.singletonList(PartIndex.of(index));
}
affectedPartIndexes.forEach(partIndex -> aqdefObjectModel.putPartEntry(kKey, partIndex, value));
}
public void createCharacteristicEntry(String key, Object value) {
createCharacteristicEntry(KKey.of(key), value);
}
public void createCharacteristicEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putCharacteristicEntry(key, currentCharacteristicIndex(), value);
}
/**
* Replaces value of a given K-key with a new value for:
* <ul>
* <li>single characteristic of a single part if both {@code partIndex} and {@code characteristicIndex} are provided</li>
* <li>single characteristic of all parts if {@code partIndex = 0} and {@code characteristicIndex > 0}</li>
* <li>all characteristics of single part if {@code partIndex > 0} and {@code characteristicIndex = 0}</li>
* <li>all characteristics of all parts if {@code partIndex = 0} and {@code characteristicIndex = 0}</li>
* </ul>
* <p>
* If the K-key doesn't have value, it will be added.
* </p>
*
* @param key
* @param partIndex
* @param characteristicIndex
* @param value
*/
public void replaceCharacteristicEntry(String key, int partIndex, int characteristicIndex, Object value) {
KKey kKey = KKey.of(key);
List<PartIndex> affectedPartIndexes;
if (partIndex == 0) {
affectedPartIndexes = aqdefObjectModel.getPartIndexes();
} else {
affectedPartIndexes = Collections.singletonList(PartIndex.of(partIndex));
}
affectedPartIndexes.forEach(affectedPartIndex -> {
List<CharacteristicIndex> affectedCharacteristicIndexes;
if (characteristicIndex == 0) {
affectedCharacteristicIndexes = aqdefObjectModel.getCharacteristicIndexes(affectedPartIndex);
} else {
affectedCharacteristicIndexes = Collections.singletonList(CharacteristicIndex.of(affectedPartIndex, characteristicIndex));
}
affectedCharacteristicIndexes.forEach(affectedCharacteristicIndex -> {
aqdefObjectModel.putCharacteristicEntry(kKey, affectedCharacteristicIndex, value);
});
});
}
public void createGroupEntry(String key, Object value) {
createGroupEntry(KKey.of(key), value);
}
public void createGroupEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putGroupEntry(key, currentGroupIndex(), value);
}
public void createValueEntry(String key, Object value) {
createValueEntry(KKey.of(key), value);
}
public void createValueEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putValueEntry(key, currentValueIndex(), value);
}
public void createHierarchyNodeOfPart() {
hierarchyBuilder.createHierarchyNodeOfPart(hierarchyNodeIndex.getAndIncrement(), partIndex.get());
}
public void createHierarchyNodeOfCharacteristic(int characteristicId, Integer parentCharacteristicId) {
hierarchyBuilder.createHierarchyNodeOfCharacteristic(
hierarchyNodeIndex.getAndIncrement(),
partIndex.get(),
characteristicIndex.get(),
characteristicId,
parentCharacteristicId);
}
public void createHierarchyNodeOfGroup(int characteristicId, Integer parentCharacteristicId) {
hierarchyBuilder.createHierarchyNodeOfGroup(
hierarchyNodeIndex.getAndIncrement(),
partIndex.get(),
groupIndex.get(),
characteristicId,
parentCharacteristicId);
}
public void createCatalogRecordEntry(String key, Object value) {
createCatalogRecordEntry(KKey.of(key), value);
}
public void createCatalogRecordEntry(KKey key, Object value) {
if (value == null) {
return;
}
aqdefObjectModel.putCatalogRecordEntry(key, currentCatalogRecordIndex(), value);
}
/**
* You have to call this method after all data of current part (and its characteristics and values) are written.
*/
public void nextPart() {
partIndex.incrementAndGet();
}
/**
* You have to call this method after all data of current characteristic (and its values) are written.
*/
public void nextCharacteristic() {
characteristicIndex.incrementAndGet();
valueIndex.set(1);
}
/**
* You have to call this method after all data of current value are written.
*/
public void nextValue() {
valueIndex.incrementAndGet();
}
/**
* You have to call this method after all data of current group are written.
*/
public void nextGroup() {
groupIndex.incrementAndGet();
}
/**
* You have to call this method after all data of the current catalog record are written.
*/
public void nextCatalogRecord() {
catalogRecordIndex.incrementAndGet();
}
private PartIndex currentPartIndex() {
return PartIndex.of(partIndex.get());
}
private CharacteristicIndex currentCharacteristicIndex() {
return CharacteristicIndex.of(currentPartIndex(), characteristicIndex.get());
}
private GroupIndex currentGroupIndex() {
return GroupIndex.of(currentPartIndex(), groupIndex.get());
}
private ValueIndex currentValueIndex() {
return ValueIndex.of(currentCharacteristicIndex(), valueIndex.get());
}
private CatalogRecordIndex currentCatalogRecordIndex() {
return CatalogRecordIndex.of(catalogRecordIndex.get());
}
}
| [
"vlastimil.dolejs@diribet.cz"
] | vlastimil.dolejs@diribet.cz |
5616de799c19165f8d4fea3b780e7d241171de5e | cef49f80a7ee7c1f3fa8e01299f82b3f60ed8707 | /src/main/java/com/igor/structural/adapter/Motherboard.java | a7b9d1c43bdaeefc2706df8c37d2292a7bb46b1b | [] | no_license | ihorsas/Patterns | 8494d118192d746fce90144af4e85dea0d4e2c21 | f1ba19a697894596a117b483f37a8d87eaf1a541 | refs/heads/master | 2023-02-23T20:08:50.538173 | 2021-01-29T09:28:35 | 2021-01-29T09:28:35 | 234,545,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package com.igor.structural.adapter;
public class Motherboard {
private SSDPCI ssd;
public void putSSD(SSDPCI ssd){
this.ssd = ssd;
}
}
| [
"Igor_Sas@epam.com"
] | Igor_Sas@epam.com |
9187dda64ebd847abfa1b059a165bc5a19b747b9 | 17e7b339529a619aa354c9f9ce95ec3ccd0c0b94 | /app/src/main/java/com/capstone/coursera/gidma/common/LifecycleLoggingActivity.java | abdb3e54e54713983738b3249f6d6d5366074355 | [] | no_license | munishks13/GIDMApp | b77cceeb5eed04eb343b4629361f3ab8a50c399d | ea0e7f5d9e20248293cfa398e22d811fe24fb3b7 | refs/heads/master | 2021-01-10T06:55:25.082569 | 2015-11-19T04:43:52 | 2015-11-19T04:43:52 | 46,467,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,160 | java | package com.capstone.coursera.gidma.common;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
/**
* This abstract class extends the Activity class and overrides lifecycle
* callbacks for logging various lifecycle events.
*/
public abstract class LifecycleLoggingActivity extends Activity {
/**
* Debugging tag used by the Android logger.
*/
protected final static String TAG =
LifecycleLoggingActivity.class.getSimpleName();
/**
* Hook method called when a new instance of Activity is created. One time
* initialization code should go here e.g. UI layout, some class scope
* variable initialization. if finish() is called from onCreate no other
* lifecycle callbacks are called except for onDestroy().
*
* @param savedInstanceState
* object that contains saved state information.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
// Always call super class for necessary
// initialization/implementation.
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
// The activity is being re-created. Use the
// savedInstanceState bundle for initializations either
// during onCreate or onRestoreInstanceState().
Log.d(TAG, "onCreate(): activity re-created");
} else {
// Activity is being created anew. No prior saved
// instance state information available in Bundle object.
Log.d(TAG, "onCreate(): activity created anew");
}
}
/**
* Hook method called after onCreate() or after onRestart() (when the
* activity is being restarted from stopped state). Should re-acquire
* resources relinquished when activity was stopped (onStop()) or acquire
* those resources for the first time after onCreate().
*/
@Override
protected void onStart() {
// Always call super class for necessary
// initialization/implementation.
super.onStart();
Log.d(TAG, "onStart() - the activity is about to become visible");
}
/**
* Hook method called after onRestoreStateInstance(Bundle) only if there is
* a prior saved instance state in Bundle object. onResume() is called
* immediately after onStart(). onResume() is called when user resumes
* activity from paused state (onPause()) User can begin interacting with
* activity. Place to start animations, acquire exclusive resources, such as
* the camera.
*/
@Override
protected void onResume() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onResume();
Log.d(TAG,
"onResume() - the activity has become visible (it is now \"resumed\")");
}
/**
* Hook method called when an Activity loses focus but is still visible in
* background. May be followed by onStop() or onResume(). Delegate more CPU
* intensive operation to onStop for seamless transition to next activity.
* Save persistent state (onSaveInstanceState()) in case app is killed.
* Often used to release exclusive resources.
*/
@Override
protected void onPause() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onPause();
Log.d(TAG,
"onPause() - another activity is taking focus (this activity is about to be \"paused\")");
}
/**
* Called when Activity is no longer visible. Release resources that may
* cause memory leak. Save instance state (onSaveInstanceState()) in case
* activity is killed.
*/
@Override
protected void onStop() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onStop();
Log.d(TAG,
"onStop() - the activity is no longer visible (it is now \"stopped\")");
}
/**
* Hook method called when user restarts a stopped activity. Is followed by
* a call to onStart() and onResume().
*/
@Override
protected void onRestart() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onRestart();
Log.d(TAG, "onRestart() - the activity is about to be restarted()");
}
/**
* Hook method that gives a final chance to release resources and stop
* spawned threads. onDestroy() may not always be called-when system kills
* hosting process
*/
@Override
protected void onDestroy() {
// Always call super class for necessary
// initialization/implementation and then log which lifecycle
// hook method is being called.
super.onDestroy();
Log.d(TAG, "onDestroy() - the activity is about to be destroyed");
}
}
| [
"munish.java@gmail.com"
] | munish.java@gmail.com |
60740548aaea4727122e20dd6625a5ffd3eda1a6 | b3f7bacd787b8cb811985ad83e32f9df81044413 | /DSAPractice/src/com/practice/interviewbit/ReverseBits.java | 9a00739b02c90bf653656b600ff6c64887442258 | [] | no_license | nishantbansal7869/DSA-practice | 5e2e46fb0e04d1daabee68bd74a0a95b7f2d8d26 | 19bd5941928cd83390bf14945e466de20f2923d1 | refs/heads/master | 2023-01-06T06:11:18.956372 | 2020-10-28T12:25:18 | 2020-10-28T12:25:18 | 271,200,815 | 0 | 0 | null | 2020-10-28T12:25:19 | 2020-06-10T06:49:06 | Java | UTF-8 | Java | false | false | 559 | java | package com.practice.interviewbit;
import java.util.Scanner;
public class ReverseBits {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long reverse = reverseBit(n);
System.out.print(reverse);
}
private static long reverseBit(long n) {
int i= 0;
int j = 31;
long n1 = 0;
for (; i < 32; i++){
if ((n&(1<<i)) > 0){
n1 = n1 | 1l<<j;
}
j--;
}
return n1;
}
}
| [
"v-nibansal@expedia.com"
] | v-nibansal@expedia.com |
bcf6e458d4527f97a160db0f3069d92b7d966b06 | 5ed64b6e511577477261b5be61bceabba5136623 | /singleton/src/main/java/com/dtdx/singleton/demo3/Main.java | 5f7aa7b43d58327dae79c3e8e93d2503c17fe623 | [] | no_license | dongtiandexue/design_pattern | ff66ef4d24e6728ed36d06b40471b05c30e5125c | bd3928eecf1dd39a0a7ff8ae9c5bb0da5ac5c4e2 | refs/heads/master | 2020-05-09T16:03:58.381999 | 2019-07-21T15:12:41 | 2019-07-21T15:12:41 | 181,256,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 676 | java | package com.dtdx.singleton.demo3;
/**
* @ClassName Main
* @Description TODO
* @Author huawei
* @Date 2019/4/14 9:49
* @Version 1.0
**/
public class Main {
public static void main(String[] args) {
// Singleton demo1 = Singleton.getInstance();
// Singleton demo2 = Singleton.getInstance();
// System.out.println(demo1);
// System.out.println(demo2);
for (int i = 0; i < 10; i++) {
new Thread(() ->{
for (int i1 = 0; i1 < 10; i1++) {
Singleton demo = Singleton.getInstance();
System.out.println(demo);
}
}).start();
}
}
}
| [
"huawei_code@163.com"
] | huawei_code@163.com |
5b81318828cff4d79614a249f152fef85b0b38b4 | a4ebb5eead11a462d71b5574fbc8869a3e88faac | /springboot-login-demo/src/main/java/com/ligen/response/CodeMsg.java | 3b8db5ece10de23e9e4416aeb91208a10049adeb | [] | no_license | Ligenmt/javaexample | 5a912243da0559c286c845698d0ed8faa1235d22 | d07135fefaeedf3e08d65ab0c86425333c33cf00 | refs/heads/master | 2022-06-27T21:58:46.191174 | 2019-07-01T09:36:07 | 2019-07-01T09:36:07 | 192,186,720 | 0 | 0 | null | 2022-06-17T02:15:45 | 2019-06-16T12:10:13 | Java | UTF-8 | Java | false | false | 754 | java | package com.ligen.response;
/**
* Created by ligen on 2018/4/11.
*/
public class CodeMsg {
private int errcode;
private String msg;
private CodeMsg(int errcode,String msg ) {
this.errcode = errcode;
this.msg = msg;
}
public static CodeMsg 请求成功 = new CodeMsg(0, "请求成功");
public static CodeMsg 参数不正确 = new CodeMsg(400, "参数不正确");
public static CodeMsg 无权限 = new CodeMsg(403, "参数不正确");
public static CodeMsg 需要登录 = new CodeMsg(401, "需要登录");
public static CodeMsg 内部错误 = new CodeMsg(500, "内部错误");
public int getErrcode() {
return errcode;
}
public String getMsg() {
return msg;
}
}
| [
"176478745@qq.com"
] | 176478745@qq.com |
53257507b79765bf44bbcc2ccd8c337485919428 | 3171b34358d53ce00b479441c1ba9298bcf30b52 | /src/test/java/com/subang/util/UtilTest.java | 8e1f30da986591c14d7f29f80692fa093798249e | [] | no_license | strongqiang/SuBang | 61143ef3e9a9dab10b8e709d12b48349017336f9 | e23fdec8e785b2d119b45101193b821ac9ed039d | refs/heads/master | 2020-12-11T05:51:57.426618 | 2015-10-16T09:23:38 | 2015-10-16T09:23:38 | 43,821,275 | 0 | 0 | null | 2015-10-07T14:26:35 | 2015-10-07T14:26:34 | null | UTF-8 | Java | false | false | 702 | java | package com.subang.util;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import weixin.popular.util.JsonUtil;
import com.subang.util.TimeUtil.Option;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/applicationContext.xml" })
public class UtilTest {
private static final Logger LOG = Logger.getLogger("sdfas");
@Test
public void test() throws Exception {
Option option = new Option(null, "Qing");
String json = JsonUtil.toJSONString(option);
pause();
}
public void pause() {
}
}
| [
"qiang20102697@gmail.com"
] | qiang20102697@gmail.com |
c1e85a2364067ab464430ac169df1108d688e4ba | 96f8d42c474f8dd42ecc6811b6e555363f168d3e | /zuiyou/sources/cn/xiaochuankeji/tieba/ui/my/mypost/a.java | d0b91f75146d4e913c5ee5ab4a32d5fb3f3972b2 | [] | no_license | aheadlcx/analyzeApk | 050b261595cecc85790558a02d79739a789ae3a3 | 25cecc394dde4ed7d4971baf0e9504dcb7fabaca | refs/heads/master | 2020-03-10T10:24:49.773318 | 2018-04-13T09:44:45 | 2018-04-13T09:44:45 | 129,332,351 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package cn.xiaochuankeji.tieba.ui.my.mypost;
public class a {
public long a;
public a(long j) {
this.a = j;
}
}
| [
"aheadlcxzhang@gmail.com"
] | aheadlcxzhang@gmail.com |
c6d7aee42b90ac71023c4d2de2faf36b85baa361 | e02e6b172a36090a6ddc61bb1200bad21b1c0395 | /common/src/main/java/org/openalto/alto/common/type/MetaData.java | a2abcb113d0e42a13cb0301d4f7697d02253e2cc | [
"Apache-2.0"
] | permissive | emiapwil/openalto | d2236e53a2894ebf48fd2d7ba8fe9788e6ca5588 | 6fd3ced3e5c076a42fe9e42ebec32d2295d2a9f6 | refs/heads/master | 2020-12-26T03:55:41.664497 | 2015-08-12T03:11:11 | 2015-08-12T03:11:11 | 39,930,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | package org.openalto.alto.common.type;
import javax.script.SimpleBindings;
public class MetaData extends SimpleBindings {
};
| [
"emiapwil@gmail.com"
] | emiapwil@gmail.com |
731b65ddfaae1163c47c9796e41469d9d755b1d1 | 6321f3279eb494c3ed33e4239169b13a5ccebb11 | /src/main/java/com/jadmin/controller/admin/base/system/ConfigController.java | 8da4ef60079c7ba842808c3cf5bc8691a298b62f | [] | no_license | PhoenixMFW/JAdmin | 91d735439bc43b0f37e8c24e15777166ab160530 | 43b7187cfa8bd08eb4ceb0539f3243a4bdfd0c90 | refs/heads/master | 2022-07-08T14:07:17.705022 | 2020-01-13T03:07:42 | 2020-01-13T03:07:42 | 233,500,414 | 0 | 1 | null | 2022-06-29T17:54:17 | 2020-01-13T03:07:16 | Java | UTF-8 | Java | false | false | 2,453 | java | package com.jadmin.controller.admin.base.system;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.jadmin.modules.annotation.AdminPage;
import com.jadmin.modules.annotation.column.FormColunm;
import com.jadmin.modules.annotation.column.InitDefaultColunm;
import com.jadmin.modules.annotation.column.TableColumn;
import com.jadmin.modules.annotation.column.UniqueColunm;
import com.jadmin.modules.annotation.list.AdminPageNoButton;
import com.jadmin.modules.annotation.list.DeleteMode;
import com.jadmin.modules.annotation.list.FileConfig;
import com.jadmin.modules.annotation.list.SearchMode;
import com.jadmin.modules.annotation.list.TableHql;
import com.jadmin.modules.controller.base.CommonListController;
import com.jadmin.modules.util.StartCacheUtil;
import com.jadmin.vo.entity.base.ConfigVO;
import com.jadmin.vo.enumtype.AdminPageMenu;
/**
* @Title:web框架
* @Description:系统设置相关的控制层
* @Copyright:JAdmin (c) 2018年08月21日
*
* @author:-jiujiya
* @version:1.0
*/
@Controller
@RequestMapping("/config") // 定义前台url访问的基础路径
@FileConfig // jsp和js的相关配置
@AdminPage(menu = AdminPageMenu.baseCenter, name = "系统设置") // 声明后台管理页面左边的菜单属性,用来控制权限
@AdminPageNoButton({"toShow"}) // 声明页面中不需要的button,默认显示删除、添加、编辑 3个按钮
@DeleteMode(DeleteMode.DELETE) // 定义删除策略为真删
@TableHql(value = "isOpen = 1")
@SearchMode(dateColumn = "operateTime")
public class ConfigController extends CommonListController<ConfigVO> {
@FormColunm(value = "名称")
@TableColumn(search = true)
public String name;
@FormColunm(value = "编号")
@TableColumn(search = true)
@UniqueColunm // 编号不能重复
public String code;
@FormColunm(value = "value", required = false)
@TableColumn
public String coValue;
@InitDefaultColunm("1") // 系统添加的全部默认开放
public String isOpen;
@TableColumn(value = "操作时间")
@InitDefaultColunm
public String operateTime;
@TableColumn(value = "操作人")
@InitDefaultColunm
public String operatorId;
@InitDefaultColunm("1")
public String billStatus;
@FormColunm(value = "描述", type = "textarea", length = 512, required = false)
public String memo;
@Override
public void afterDataChange() {
StartCacheUtil.refurbish("configs");
}
}
| [
"1600509839@qq.com"
] | 1600509839@qq.com |
8a18a91e031efe7916fb1af7883b2f5f15e52d70 | 9c8f5a3d3fca251767b4fe3199f29b8c5f5213b6 | /src/day15/collection/set/SetExample.java | 9195111d79d5150f7ab0a386f5a02a11a7f8670d | [] | no_license | jhlee7562/java_basic_study | 706a41c2fd2f33f5580f077e97878faf939c1323 | 7edab59e304ed68d0a27355dde035779894fdad3 | refs/heads/master | 2023-04-05T02:49:05.317980 | 2021-04-02T05:45:48 | 2021-04-02T05:45:48 | 346,592,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java | package day15.collection.set;
import java.util.HashSet;
import java.util.Set;
public class SetExample {
public static void main(String[] args) {
//Set : 중복 저장 허용x, 순서없이 빠른 속도로 저장, 전체 탐색속도 빠름
Set<String> set = new HashSet<>();
//set에 객체 추가 : add()
set.add("김말이");
set.add("닭강정");
set.add("단무지");
set.add("김밥");
set.add("떡볶이");
System.out.println(set.size());
System.out.println(set);
//set 반복문 처리
System.out.println("=======================");
for(String str : set){
System.out.println(str);
}
System.out.println("=======================");
//set의 객체 삭제 : remove(obj)
set.remove("단무지");
System.out.println("set");
System.out.println("=======================");
set.clear();
System.out.println(set.isEmpty());
}
}
| [
"jhlee7562@gmail.com"
] | jhlee7562@gmail.com |
8831030b00f3b2899c0e6e648972d6c22fdf56eb | 0b690b9d328a5cc8e8e77ad79a778134ebdda7cb | /app/src/main/java/com/example/restapiexample/model/ResObj.java | 8bb09fdc36f8b2b6727e0b18a35661cf4813d0fc | [] | no_license | themadeye/RestAPIExample | 2d854ebda392769435cacdf4e82e6583ac7dfa84 | a9292ab1dcf36ac5d2f08919e946484ba9022aa1 | refs/heads/master | 2022-12-14T21:05:49.838203 | 2020-09-07T15:08:51 | 2020-09-07T15:08:51 | 187,179,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.example.restapiexample.model;
public class ResObj {
private String message;
public String getMessage() {//this is based on the JSON response token
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"leonkong42@gmail.com"
] | leonkong42@gmail.com |
72d48eb2a01b2850e2ae8202e20a77f1222cc460 | b2471ee0f11bb97c810ebe59afceec429ab4ca3c | /dashboard-backend/src/main/java/com/dashboard/project/model/ChartOptions.java | 27fb3dc2d0ed5e5afa6663000f4f5c657463dd08 | [] | no_license | andidarzeza/dashboard | 5acafbdff15f9296ab7024d466e2c68486763cad | 429c6cc804380c49fe9f2a85d01d26171ed80b53 | refs/heads/master | 2023-05-06T14:07:48.096355 | 2021-05-26T08:55:47 | 2021-05-26T08:55:47 | 370,968,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | package com.dashboard.project.model;
import org.springframework.data.annotation.Id;
import java.util.Arrays;
import java.util.List;
public class ChartOptions {
private String chartCanvasID;
private String chartType;
private List<String> chartLabels;
private List<Integer> chartData;
public String getChartCanvasID() {
return chartCanvasID;
}
public void setChartCanvasID(String chartCanvasID) {
this.chartCanvasID = chartCanvasID;
}
public String getChartType() {
return chartType;
}
public void setChartType(String chartType) {
this.chartType = chartType;
}
public List<String> getChartLabels() {
return chartLabels;
}
public void setChartLabels(List<String> chartLabels) {
this.chartLabels = chartLabels;
}
public List<Integer> getChartData() {
return chartData;
}
public void setChartData(List<Integer> chartData) {
this.chartData = chartData;
}
@Override
public String toString() {
return "ChartOptions{" +
"chartCanvasID='" + chartCanvasID + '\'' +
", chartType='" + chartType + '\'' +
", chartLabels=" + chartLabels +
", chartData=" + chartData +
'}';
}
}
| [
"andi.darzeza@moveengineering-eu.com"
] | andi.darzeza@moveengineering-eu.com |
308527e99341c786dad2696b0c3b9219c3811663 | 2171e43c37923ada71e753029ccffbda7fc2667a | /src/Abstract/TestTv.java | b592bb07d3d3245b610eab7170b9c1092dd28451 | [] | no_license | aneeqkhan007/hw3-Abstract-encapsulation-and-poly | a94bc2e15596391fa24d4297f4e4dd85f260c9e3 | 66ac6b328db4ddb257cd22743c8bcd2b78cbb68b | refs/heads/master | 2021-04-12T09:27:18.107696 | 2018-03-25T19:24:31 | 2018-03-25T19:24:31 | 126,731,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package Abstract;
public class TestTv {
public static void main(String[] args) {
Sony s = new Sony();
s.on();
s.off();
s.wired();
s.setting();
}
}
| [
"aneeqkhan2012@hotmail.com"
] | aneeqkhan2012@hotmail.com |
ad51c6e765ecf44772cd2f943bc066d86ccf0262 | 37db8f6b2e7907b71f748808ea9ff8e8d033d564 | /JavaSource/org/unitime/localization/impl/ImportTranslations.java | 1df54a460f6790172df7510f7764fb55e26cbeed | [
"Apache-2.0",
"EPL-2.0",
"CDDL-1.0",
"MIT",
"CC-BY-3.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-freemarker",
"LGPL-2.1-only",
"EPL-1.0",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-generic-cla",
... | permissive | UniTime/unitime | 48eaa44ae85db344d015577d21dcc1a41cecd862 | bc69f2e18f82bdb6c995c4e6490cb650fa4fa98e | refs/heads/master | 2023-08-18T00:52:29.614387 | 2023-08-16T16:08:17 | 2023-08-16T16:08:17 | 29,594,752 | 253 | 185 | Apache-2.0 | 2023-05-17T14:16:13 | 2015-01-21T14:58:53 | Java | UTF-8 | Java | false | false | 9,911 | java | /*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.unitime.localization.impl;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.unitime.localization.impl.ExportTranslations.Locale;
import org.unitime.localization.impl.POHelper.Bundle;
import org.unitime.localization.messages.PageNames;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* @author Tomas Muller
*/
public class ImportTranslations {
private List<Locale> iLocales = new ArrayList<Locale>();
private Project iProject;
private File iBaseDir;
private File iSource;
private String iTranslations = "Documentation/Translations";
private String iToken = null;
private boolean iGeneratePageNames = false;
private boolean iFixGwtConfig = true;
private boolean iDownload = true;
public ImportTranslations() {}
public void setProject(Project project) {
iProject = project;
iBaseDir = project.getBaseDir();
}
public void setBaseDir(String baseDir) {
iBaseDir = new File(baseDir);
}
public void setSource(String source) {
iSource = new File(source);
}
public Locale createLocale() {
Locale locale = new Locale();
iLocales.add(locale);
return locale;
}
public void addLocale(Locale locale) {
iLocales.add(locale);
}
public void setLocales(String locales) {
for (String value: locales.split(",")) {
addLocale(new Locale(value));
}
}
public void setTranslations(String translations) {
iTranslations = translations;
}
public void setGeneratePageNames(boolean generatePageNames) {
iGeneratePageNames = generatePageNames;
}
public void setFixGwtConfig(boolean fixGwtConfig) {
iFixGwtConfig = fixGwtConfig;
}
public void setDownload(boolean download) {
iDownload = download;
}
public void setToken(String token) {
iToken = token;
}
public void info(String message) {
if (iProject != null)
iProject.log(message);
else
System.out.println(" [info] " + message);
}
public void warn(String message) {
if (iProject != null)
iProject.log(message, Project.MSG_WARN);
else
System.out.println(" [warning] " +message);
}
public void debug(String message) {
if (iProject != null)
iProject.log(message, Project.MSG_DEBUG);
else
System.out.println(" [debug] " +message);
}
public void error(String message) {
if (iProject != null)
iProject.log(message, Project.MSG_ERR);
else
System.out.println(" [error] " +message);
}
public void execute() throws BuildException {
try {
File translations = new File(iBaseDir, iTranslations);
Map<String, byte[]> downloads = new HashMap<String, byte[]>();
if (iDownload) {
info("Downloading translations to: " + translations);
CloseableHttpClient client = HttpClients.createDefault();
for (Locale locale: iLocales) {
debug("Locale " + locale);
HttpPost post = new HttpPost("https://api.poeditor.com/v2/projects/export");
List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("api_token", iToken));
params.add(new BasicNameValuePair("id", "568029"));
params.add(new BasicNameValuePair("language", locale.getValue()));
params.add(new BasicNameValuePair("type", "po"));
post.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
CloseableHttpResponse response = client.execute(post);
HttpEntity entity = response.getEntity();
HttpGet get = null;
if (entity != null) {
JsonObject json = JsonParser.parseReader(new InputStreamReader(entity.getContent())).getAsJsonObject();
info("Response: " + json);
String url = json.getAsJsonObject("result").get("url").getAsString();
debug("URL: " + url);
get = new HttpGet(url);
}
response.close();
if (get != null) {
response = client.execute(get);
entity = response.getEntity();
if (entity != null) {
info("Downloading " + get.getURI());
InputStream in = entity.getContent();
byte[] buffer = new byte[10240];
File file = new File(translations, "UniTime" + org.unitime.timetable.util.Constants.VERSION + "_" + locale.getValue() + ".po");
debug("Writing " + file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
FileOutputStream out = new FileOutputStream(file);
int read = 0;
while ((read = in.read(buffer)) > 0) {
out.write(buffer, 0, read);
bos.write(buffer, 0, read);
}
out.flush();
out.close();
bos.flush();
bos.close();
downloads.put(locale.getValue(), bos.toByteArray());
}
}
response.close();
}
client.close();
}
if (downloads.isEmpty())
info("Importing translations from: " + translations);
else
info("Importing translations");
Map<String, String> pageNames = null;
if (iGeneratePageNames) {
PageNameGenerator gen = new PageNameGenerator();
gen.setSource(iSource);
gen.execute();
pageNames = gen.getPageNames();
} else {
Properties p = new Properties();
p.load(new FileInputStream(new File(iSource, PageNames.class.getName().replace('.', File.separatorChar) + ".properties")));
pageNames = new HashMap<String, String>();
for (Map.Entry e: p.entrySet())
pageNames.put((String)e.getKey(), (String)e.getValue());
}
for (Locale locale: iLocales) {
debug("Locale " + locale);
POHelper helper = new POHelper(locale.getValue(), pageNames);
byte[] data = downloads.get(locale.getValue());
if (data == null) {
File input = new File(translations, "UniTime" + org.unitime.timetable.util.Constants.VERSION + "_" + locale.getValue() + ".po");
if (!input.exists()) {
error("Input file " + input + " does not exist.");
continue;
}
helper.readPOFile(null, new InputStreamReader(new FileInputStream(input), StandardCharsets.UTF_8));
} else {
helper.readPOFile(null, new InputStreamReader(new ByteArrayInputStream(data), StandardCharsets.UTF_8));
}
for (Bundle bundle: Bundle.values())
helper.writePropertiesFile(iSource, bundle);
}
Set<String> locales = new HashSet<String>();
if (iFixGwtConfig) {
info("Updating GWT configuration, if needed.");
File config = new File(iSource,
"org" + File.separator + "unitime" + File.separator + "timetable" + File.separator + "gwt"+ File.separator + "UniTime.gwt.xml");
Document document = (new SAXReader()).read(config);
for (Iterator<Element> i = document.getRootElement().elementIterator("extend-property"); i.hasNext(); ) {
Element e = i.next();
if ("locale".equals(e.attributeValue("name")))
locales.add(e.attributeValue("values"));
}
debug("Existing locales: " + locales);
boolean changed = false;
for (Locale locale: iLocales) {
if (!locales.contains(locale.getValue())) {
info("added " + locale);
changed = true;
document.getRootElement().addElement("extend-property")
.addAttribute("name", "locale")
.addAttribute("values", locale.getValue());
}
}
if (changed) {
FileOutputStream out = new FileOutputStream(config);
(new XMLWriter(out, OutputFormat.createPrettyPrint())).write(document);
out.flush(); out.close();
}
}
} catch (Exception e) {
throw new BuildException("Import failed: " + e.getMessage(), e);
}
}
public static void main(String[] args) {
try {
ImportTranslations task = new ImportTranslations();
task.setBaseDir(System.getProperty("source", "/Users/muller/git/unitime"));
task.setSource(System.getProperty("source", "/Users/muller/git/unitime") + File.separator + "JavaSource");
task.setLocales(System.getProperty("locale", "cs"));
task.setToken(System.getProperty("token", "b191dd443ab1800fc1e09ef23e50cdb0"));
task.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"muller@unitime.org"
] | muller@unitime.org |
4664ef4e8b9d58386d8b47ee657051864f789464 | b63bda34e0fe593138d345a8e90d39c9ff7c3411 | /reinvent-coursera-admin/src/main/java/com/coursera/admin/web/service/CategoryService.java | 10f1830619e5d3ff3b276355ac2ce7e77f9537df | [] | no_license | deepaksingh7/reinvent-coursera | 9efaf185fbebf32fae9fa0e8f8b33740cb53d4cf | d6416437fbc76882a8535704104a9eb6a790e005 | refs/heads/master | 2023-01-12T17:30:53.912196 | 2019-11-12T15:52:06 | 2019-11-12T15:52:06 | 221,252,836 | 0 | 0 | null | 2023-01-09T22:21:58 | 2019-11-12T15:41:07 | CSS | UTF-8 | Java | false | false | 4,321 | java | package com.coursera.admin.web.service;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
import com.coursera.admin.web.model.Category;
import com.coursera.admin.web.model.Token;
import com.google.gson.Gson;
@Service
public class CategoryService {
private static final int TIMEOUT = 3000;
@Autowired
RestTemplate restTemplate;
@Value("${category.getURL}")
String serviceURL;
public List<Category> getAllCategory() {
HttpHeaders headers = getToken();
Gson gson = new Gson();
HttpEntity<String> httpReq = new HttpEntity<String>(headers);
ResponseEntity<String> rs = restTemplate.exchange(serviceURL, HttpMethod.GET, httpReq, String.class);
Category[] response = gson.fromJson(rs.getBody(), Category[].class);
return Arrays.asList(response);
}
public Object getCategory(String id) {
HttpHeaders headers = getToken();
Gson gson = new Gson();
HttpEntity<String> httpReq = new HttpEntity<String>(headers);
ResponseEntity<String> rs = restTemplate.exchange(serviceURL+id,HttpMethod.GET,httpReq, String.class);
Category response = gson.fromJson(rs.getBody(), Category.class);
return Arrays.asList(response);
}
private HttpHeaders createHttpHeaders(Map<String, String> map) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
for (Entry<String, String> entry : map.entrySet()) {
headers.add(entry.getKey(), entry.getValue());
}
return headers;
}
public ResponseEntity<String> deleteCategory(String categoryId) {
HttpHeaders headers = getToken();
HttpEntity<String> httpReq = new HttpEntity<String>(headers);
try {
ResponseEntity<String> rs = restTemplate.exchange(serviceURL+categoryId,HttpMethod.DELETE,httpReq, String.class);
return rs;
} catch(HttpStatusCodeException e) {
return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders())
.body(e.getResponseBodyAsString());
}
}
public ResponseEntity<String> addCategory(String jsonRequest) {
HttpHeaders headers = getToken();
Gson gson = new Gson();
Category category = gson.fromJson(jsonRequest, Category.class);
HttpEntity<Category> entity = new HttpEntity<Category>(category, headers);
try {
ResponseEntity<String> response = restTemplate.exchange(serviceURL, HttpMethod.POST, entity, String.class);
return response;
} catch(HttpStatusCodeException e) {
return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders())
.body(e.getResponseBodyAsString());
}
}
public ResponseEntity<String> updateCategory(String jsonRequest, String categoryId) {
HttpHeaders headers = getToken();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
requestFactory.setConnectTimeout(TIMEOUT);
requestFactory.setReadTimeout(TIMEOUT);
restTemplate.setRequestFactory(requestFactory);
Gson gson = new Gson();
Category category = gson.fromJson(jsonRequest, Category.class);
HttpEntity<Category> entity = new HttpEntity<Category>(category, headers);
try {
ResponseEntity<String> response = restTemplate.exchange(serviceURL+categoryId, HttpMethod.PATCH, entity, String.class);
return response;
} catch(HttpStatusCodeException e) {
return ResponseEntity.status(e.getRawStatusCode()).headers(e.getResponseHeaders())
.body(e.getResponseBodyAsString());
}
}
private HttpHeaders getToken() {
Map<String, String> map = new HashMap<String, String>();
HttpHeaders headers = createHttpHeaders(map);
headers.add("Authorization", Token.getTokenID());
return headers;
}
}
| [
"deepaksingh7@gmail.com"
] | deepaksingh7@gmail.com |
9beed0a131eb916b0b6991cf3471280e8757e8f5 | bb3bddf76517767ac28f35bd3f06717bedf58830 | /src/Main.java | 877e5dda59d4d78be99dab831aee461c9d80c8a9 | [] | no_license | KyrSash/TenderBrigades | a4394a28cdbeb2019120c1631d0f9d1a39d3abf8 | 5931125311a6bc1f2fbd99d3d77896b330835c85 | refs/heads/master | 2023-03-19T09:41:11.180089 | 2021-03-10T23:42:25 | 2021-03-10T23:42:25 | 345,789,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,348 | java | public class Main {
public static void main(String[] args) {
Worker smu1 = new Worker();
smu1.addProfessionalSkill(ProfessionalSkills.CARPENTER);
smu1.addProfessionalSkill(ProfessionalSkills.CRANE_OPERATOR);
smu1.setSalary(100.1);
Worker smu2 = new Worker();
smu2.addProfessionalSkill(ProfessionalSkills.CRANE_OPERATOR);
smu2.setSalary(100.1);
Worker smu3 = new Worker();
smu3.addProfessionalSkill(ProfessionalSkills.CIVIL_ENGINEER);
smu3.setSalary(100.1);
Worker zao1 = new Worker();
zao1.addProfessionalSkill(ProfessionalSkills.CARPENTER);
zao1.addProfessionalSkill(ProfessionalSkills.CRANE_OPERATOR);
zao1.setSalary(50.1);
Worker zao2 = new Worker();
zao2.addProfessionalSkill(ProfessionalSkills.CRANE_OPERATOR);
zao2.setSalary(100.1);
Worker zao3 = new Worker();
zao3.addProfessionalSkill(ProfessionalSkills.CIVIL_ENGINEER);
zao3.setSalary(100.1);
Worker yks1 = new Worker();
yks1.addProfessionalSkill(ProfessionalSkills.CONCRETE_WORKER);
yks1.setSalary(100.1);
Worker yks2 = new Worker();
yks2.addProfessionalSkill(ProfessionalSkills.CONCRETE_WORKER);
yks2.setSalary(100.1);
Worker yks3 = new Worker();
yks3.addProfessionalSkill(ProfessionalSkills.CONCRETE_WORKER);
yks3.setSalary(100.1);
WorkersBrigade smu = new WorkersBrigade();
smu.addWorker(smu1);
smu.addWorker(smu2);
smu.addWorker(smu3);
WorkersBrigade zao = new WorkersBrigade();
zao.addWorker(zao1);
zao.addWorker(zao2);
zao.addWorker(zao3);
WorkersBrigade yks = new WorkersBrigade();
yks.addWorker(yks1);
yks.addWorker(yks2);
yks.addWorker(yks3);
Tender tender = new Tender();
tender.addProfessionalSkillsTender(ProfessionalSkills.CARPENTER, 1);
tender.addProfessionalSkillsTender(ProfessionalSkills.CRANE_OPERATOR, 2);
tender.addProfessionalSkillsTender(ProfessionalSkills.CIVIL_ENGINEER, 1);
tender.addWorkersBrigadeToTender(smu);
tender.addWorkersBrigadeToTender(zao);
tender.addWorkersBrigadeToTender(yks);
System.out.println(tender.selectionBestSuitableBrigade());
}
}
| [
"tolstikan@gmail.com"
] | tolstikan@gmail.com |
b4f8e90edf60b765c06feb75f825714bc2b7fef6 | c3f62571683e406ed84f6b818a04c8f612b41f3c | /src/com/company/Option1.java | 9fd25863d7be29c1defe8addc2a157a9e091a1e1 | [] | no_license | many221/basic_CLI | 16abb9265f84dc90393f38d78601f0b81b620e46 | b0d35e6e0722f37ee19dbbd7a900fd447a87a1a5 | refs/heads/main | 2023-07-08T13:52:31.148639 | 2021-08-13T01:40:27 | 2021-08-13T01:40:27 | 395,460,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package com.company;
public class Option1 {
public static void helloUSer(){
System.out.print ("Please Enter Your Name: ");
String name = Main.input.next ();
System.out.println ("Hello " + name);
}
}
| [
"many221@gmail.com"
] | many221@gmail.com |
0e254f87e655bb7844034d70146983aa40822dd4 | b5fb39b79f4ed16f76d50553a50c8d70c408c3ca | /src/main/java/bean/beanImpl/InterceptorClass.java | f8a2f6b96db59db0c93eeaad4646caf9e13caf1b | [] | no_license | selphatemba/thegroup | 07790f65e49a6c8a1fc4ef1335a72eafa4a06a9f | 3dd58a6e8d448d53c92e92f2b4aa04f8ab8503f1 | refs/heads/master | 2021-04-06T06:13:02.910374 | 2018-03-16T13:44:05 | 2018-03-16T13:44:05 | 125,174,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package bean.beanImpl;
import bean.beanI.English1;
import javax.annotation.Priority;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
/**
* Created by SELPHA on 7/3/2018.
*/
@Interceptor
@English1
@Priority(Interceptor.Priority.APPLICATION)
class InterceptorClass {
@AroundInvoke
public Object sayHello1(InvocationContext invocationContext){
System.out.println("i intercepted you.......");
try {
invocationContext.proceed();
} catch (Exception e) {
e.printStackTrace();
}
return new Object();
}
}
| [
"sellyn92@gmail.com"
] | sellyn92@gmail.com |
60f1c558a85b042d7c36dae556a49dee11cf1ee2 | f912f0fe9b865a18b5bc31fe62c7eb8d97d108db | /workspace/at.jku.weiner.c.preprocess.tests/src/at/jku/weiner/c/preprocess/mytests/TestExpressionEvaluation.java | cff39a789420ff72e399f6f913de0a3a5b656d98 | [] | no_license | timeraider4u/kefax | 44db2c63ea85e10a5157436bb2dabd742b590032 | 7e46c1730f561d1b76017f0ddb853c94dbb93cd6 | refs/heads/master | 2020-04-16T01:58:01.195430 | 2016-10-30T22:08:29 | 2016-10-30T22:08:29 | 41,462,260 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,320 | java | package at.jku.weiner.c.preprocess.mytests;
import org.eclipse.xtext.junit4.InjectWith;
import org.eclipse.xtext.junit4.XtextRunner;
import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import at.jku.weiner.c.common.CommonStandaloneSetup;
import at.jku.weiner.c.common.common.AdditiveExpression;
import at.jku.weiner.c.common.common.AndExpression;
import at.jku.weiner.c.common.common.CommonFactory;
import at.jku.weiner.c.common.common.EqualityExpression;
import at.jku.weiner.c.common.common.ExclusiveOrExpression;
import at.jku.weiner.c.common.common.InclusiveOrExpression;
import at.jku.weiner.c.common.common.LogicalAndExpression;
import at.jku.weiner.c.common.common.LogicalOrExpression;
import at.jku.weiner.c.common.common.MultiplicativeExpression;
import at.jku.weiner.c.common.common.PostfixExpression;
import at.jku.weiner.c.common.common.RelationalExpression;
import at.jku.weiner.c.common.common.ShiftExpression;
import at.jku.weiner.c.common.common.UnaryExpression;
import at.jku.weiner.c.preprocess.parser.antlr.internal.InternalPreprocessLexer;
import at.jku.weiner.c.preprocess.preprocess.PreprocessFactory;
import at.jku.weiner.c.preprocess.preprocess.PrimaryExpression;
import at.jku.weiner.c.preprocess.tests.PreprocessInjectorProvider;
import at.jku.weiner.c.preprocess.utils.LexerUtils;
import at.jku.weiner.c.preprocess.utils.expressions.ExpressionEvaluation;
import at.jku.weiner.c.preprocess.utils.expressions.ExpressionLongVisitor;
import at.jku.weiner.c.preprocess.utils.expressions.IExpressionVisitor;
import at.jku.weiner.c.preprocess.utils.macros.DefinitionTable;
import at.jku.weiner.log.MyLog;
import com.google.inject.Inject;
import com.google.inject.Injector;
@RunWith(XtextRunner.class)
@InjectWith(PreprocessInjectorProvider.class)
public class TestExpressionEvaluation {
protected final PreprocessFactory factory1 = PreprocessFactory.eINSTANCE;
protected final CommonFactory factory2 = CommonFactory.eINSTANCE;
private String unaryOperatorPlus;
private String unaryOperatorMinus;
private String unaryOperatorNot;
private ExpressionEvaluation<Long> evaluater;
@Inject
private InternalPreprocessLexer lexer;
@Inject
private ITokenDefProvider tokenDefProvider;
private DefinitionTable definitionTable;
protected PrimaryExpression primaryExpression1;
protected PrimaryExpression primaryExpression2;
protected PrimaryExpression primaryExpression3;
protected PrimaryExpression primaryExpression4;
protected PostfixExpression postfixExpression;
protected UnaryExpression unaryExpression;
protected MultiplicativeExpression multiplicateExpression;
protected AdditiveExpression additiveExpression;
protected ShiftExpression shiftExpression;
protected RelationalExpression relationalExpression;
protected EqualityExpression equalityExpression;
protected AndExpression andExpression;
protected ExclusiveOrExpression exclusiveOrExpression;
protected InclusiveOrExpression inclusiveOrExpression;
protected LogicalAndExpression logicalAndExpression;
protected LogicalOrExpression logicalOrExpression;
@Before
public void setUp() throws Exception {
MyLog.setLog_level(MyLog.LOG_NONE);
final LexerUtils lexerUtils = new LexerUtils(this.lexer,
this.tokenDefProvider);
this.definitionTable = new DefinitionTable(lexerUtils);
this.definitionTable.reset();
Assert.assertEquals(0, this.definitionTable.size());
this.primaryExpression1 = this.factory1.createPrimaryExpression();
this.primaryExpression2 = this.factory1.createPrimaryExpression();
this.primaryExpression3 = this.factory1.createPrimaryExpression();
this.primaryExpression4 = this.factory1.createPrimaryExpression();
this.unaryExpression = this.factory2.createUnaryExpression();
this.multiplicateExpression = this.factory2
.createMultiplicativeExpression();
this.additiveExpression = this.factory2.createAdditiveExpression();
this.shiftExpression = this.factory2.createShiftExpression();
this.relationalExpression = this.factory2.createRelationalExpression();
this.equalityExpression = this.factory2.createEqualityExpression();
this.andExpression = this.factory2.createAndExpression();
this.exclusiveOrExpression = this.factory2
.createExclusiveOrExpression();
this.inclusiveOrExpression = this.factory2
.createInclusiveOrExpression();
this.logicalAndExpression = this.factory2.createLogicalAndExpression();
this.logicalOrExpression = this.factory2.createLogicalOrExpression();
this.unaryOperatorPlus = "+";
this.unaryOperatorMinus = "-";
this.unaryOperatorNot = "!";
final Injector injector = this.getInjector();
final IExpressionVisitor<Long> visitor = new ExpressionLongVisitor(
injector, this.definitionTable);
this.evaluater = new ExpressionEvaluation<Long>(visitor);
}
private Injector getInjector() {
// only do when we are executing tests,
// but not when in Eclipse environment
final CommonStandaloneSetup setup = new CommonStandaloneSetup();
final Injector injector = setup.createInjectorAndDoEMFRegistration();
return injector;
}
@After
public void tearDown() throws Exception {
this.definitionTable.reset();
Assert.assertEquals(0, this.definitionTable.size());
}
@Test(timeout = 1000)
public void testPrimaryExpressionTrue() {
this.primaryExpression1.setConst("1");
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.primaryExpression1));
}
@Test(timeout = 1000)
public void testPrimaryExpressionFalse() {
this.primaryExpression1.setConst("0");
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.primaryExpression1));
}
@Test(timeout = 1000)
public void testUnaryExpressionTrue1() {
this.primaryExpression1.setConst("1");
this.unaryExpression.setOp(this.unaryOperatorPlus);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionFalse1() {
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(this.unaryOperatorPlus);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(expected = UnsupportedOperationException.class, timeout = 1000)
public void testUnaryExpressionIllegalOperator1() {
final String op = "&";
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(op);
this.unaryExpression.setExpr(this.primaryExpression1);
this.evaluater.walkTo(this.unaryExpression);
}
@Test(expected = UnsupportedOperationException.class, timeout = 1000)
public void testUnaryExpressionIllegalOperator2() {
final String op = "*";
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(op);
this.unaryExpression.setExpr(this.primaryExpression1);
this.evaluater.walkTo(this.unaryExpression);
}
@Test(expected = UnsupportedOperationException.class, timeout = 1000)
public void testUnaryExpressionIllegalOperator3() {
final String op = "*";
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(op);
this.unaryExpression.setExpr(this.primaryExpression1);
this.evaluater.walkTo(this.unaryExpression);
}
@Test(timeout = 1000)
public void testUnaryExpressionTrue2() {
this.primaryExpression1.setConst("1");
this.unaryExpression.setOp(this.unaryOperatorMinus);
this.unaryExpression.setExpr(this.primaryExpression1);
final Long expected = new Long(-1);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionFalse2() {
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(this.unaryOperatorMinus);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionTrue3() {
this.primaryExpression1.setConst("0");
this.unaryExpression.setOp(this.unaryOperatorNot);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionFalse3a() {
this.primaryExpression1.setConst("1");
this.unaryExpression.setOp(this.unaryOperatorNot);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testUnaryExpressionFalse3b() {
this.primaryExpression1.setConst("-1");
this.unaryExpression.setOp(this.unaryOperatorNot);
this.unaryExpression.setExpr(this.primaryExpression1);
Assert.assertEquals(ExpressionLongVisitor.FALSE,
this.evaluater.walkTo(this.unaryExpression));
}
@Test(timeout = 1000)
public void testMultiExpressionTrue() {
this.primaryExpression1.setConst("3");
this.primaryExpression2.setConst("2");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("/");
this.multiplicateExpression.setRight(this.primaryExpression2);
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMultiExpressionFalse() {
this.primaryExpression1.setConst("3");
this.primaryExpression2.setConst("2");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("%");
this.multiplicateExpression.setRight(this.primaryExpression2);
Assert.assertEquals(ExpressionLongVisitor.TRUE,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMult1() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("2");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("*");
this.multiplicateExpression.setRight(this.primaryExpression2);
final Long expected = new Long(8);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMult2() {
this.primaryExpression1.setConst("8");
this.primaryExpression2.setConst("3");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("%");
this.multiplicateExpression.setRight(this.primaryExpression2);
final Long expected = new Long(2);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMult3() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("1");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("/");
this.multiplicateExpression.setRight(this.primaryExpression2);
final Long expected = new Long(2);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testMult4() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("5");
this.multiplicateExpression.setLeft(this.primaryExpression1);
this.multiplicateExpression.setOp("*");
this.multiplicateExpression.setRight(this.primaryExpression2);
final Long expected = new Long(10);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.multiplicateExpression));
}
@Test(timeout = 1000)
public void testAdd1() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("2");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("-");
this.additiveExpression.setRight(this.primaryExpression2);
final Long expected = new Long(2);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.additiveExpression));
}
@Test(timeout = 1000)
public void testAdd2() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
final Long expected = new Long(5);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.additiveExpression));
}
@Test(timeout = 1000)
public void testAdd3() {
this.primaryExpression1.setConst("5");
this.primaryExpression2.setConst("1");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
final Long expected = new Long(6);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.additiveExpression));
}
@Test(expected = IllegalArgumentException.class, timeout = 1000)
public void testAddWithNotEnoughOperators() {
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("-");
this.additiveExpression.setRight(null);
this.evaluater.walkTo(this.additiveExpression);
}
@Test(timeout = 1000)
public void testAdd4() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
// 2 + 3 = 5
final Long expected = new Long(5);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.additiveExpression));
}
@Test(timeout = 1000)
public void testShift1() {
this.primaryExpression1.setConst("5");
this.primaryExpression2.setConst("1");
this.shiftExpression.setLeft(this.primaryExpression1);
this.shiftExpression.setOp(">>");
this.shiftExpression.setRight(this.primaryExpression2);
// 5 >> 1 = 2
final Long expected = new Long(2);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.shiftExpression));
}
@Test(timeout = 1000)
public void testRelational1() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp("<");
this.relationalExpression.setRight(this.primaryExpression2);
// 2 < 3
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational2() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.primaryExpression3.setConst("4");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
this.relationalExpression.setLeft(this.additiveExpression);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression3);
// 2 + 3 >= 4
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational3() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.primaryExpression3.setConst("5");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
this.relationalExpression.setLeft(this.additiveExpression);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression3);
// 2 + 3 >= 5
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational4() {
this.primaryExpression1.setConst("2");
this.primaryExpression2.setConst("3");
this.primaryExpression3.setConst("6");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
this.relationalExpression.setLeft(this.additiveExpression);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression3);
// 2 + 3 >= 6
final Long expected = ExpressionLongVisitor.FALSE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational5() {
this.primaryExpression1.setConst("3");
this.primaryExpression2.setConst("1");
this.primaryExpression3.setConst("4");
this.additiveExpression.setLeft(this.primaryExpression1);
this.additiveExpression.setOp("+");
this.additiveExpression.setRight(this.primaryExpression2);
this.relationalExpression.setLeft(this.additiveExpression);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression3);
// 3 + 1 >= 4
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational6() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("5");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp(">=");
this.relationalExpression.setRight(this.primaryExpression2);
// 4 >= 5
final Long expected = ExpressionLongVisitor.FALSE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational7() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("5");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp(">");
this.relationalExpression.setRight(this.primaryExpression2);
// 4 >= 5
final Long expected = ExpressionLongVisitor.FALSE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational8() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("5");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp("<");
this.relationalExpression.setRight(this.primaryExpression2);
// 4 < 5
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testRelational9() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("5");
this.relationalExpression.setLeft(this.primaryExpression1);
this.relationalExpression.setOp("<=");
this.relationalExpression.setRight(this.primaryExpression2);
// 4 <= 5
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.relationalExpression));
}
@Test(timeout = 1000)
public void testEquality1() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("4");
this.equalityExpression.setLeft(this.primaryExpression1);
this.equalityExpression.setOp("==");
this.equalityExpression.setRight(this.primaryExpression2);
// 4 == 4
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.equalityExpression));
}
@Test(timeout = 1000)
public void testEquality2() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("3");
this.equalityExpression.setLeft(this.primaryExpression1);
this.equalityExpression.setOp("==");
this.equalityExpression.setRight(this.primaryExpression2);
// 4 == 3
final Long expected = ExpressionLongVisitor.FALSE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.equalityExpression));
}
@Test(timeout = 1000)
public void testEquality3() {
this.primaryExpression1.setConst("4");
this.primaryExpression2.setConst("3");
this.equalityExpression.setLeft(this.primaryExpression1);
this.equalityExpression.setOp("!=");
this.equalityExpression.setRight(this.primaryExpression2);
// 4 == 3
final Long expected = ExpressionLongVisitor.TRUE;
Assert.assertEquals(expected,
this.evaluater.walkTo(this.equalityExpression));
}
@Test(timeout = 1000)
public void testLogicalAnd1() {
this.primaryExpression1.setConst("1");
this.primaryExpression2.setConst("2");
this.logicalAndExpression.setLeft(this.primaryExpression1);
this.logicalAndExpression.setRight(this.primaryExpression2);
// 1 && 2
final Long expected = new Long(1);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.logicalAndExpression));
}
@Test(timeout = 1000)
public void testLogicalOr1() {
this.primaryExpression1.setConst("0");
this.primaryExpression2.setConst("1");
this.logicalOrExpression.setLeft(this.primaryExpression1);
this.logicalOrExpression.setRight(this.primaryExpression2);
// 0 || 1
final Long expected = new Long(1);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.logicalOrExpression));
}
@Test(timeout = 1000)
public void testLogicalOr2() {
this.primaryExpression1.setConst("1");
this.primaryExpression2.setConst("1");
this.logicalOrExpression.setLeft(this.primaryExpression1);
this.logicalOrExpression.setRight(this.primaryExpression2);
// 1 || 1
final Long expected = new Long(1);
Assert.assertEquals(expected,
this.evaluater.walkTo(this.logicalOrExpression));
}
@Test(timeout = 1000)
public void testLong1() {
final Long zero = new Long(0);
Assert.assertEquals(ExpressionLongVisitor.FALSE, zero);
Assert.assertTrue(ExpressionLongVisitor.FALSE.equals(zero));
Assert.assertNotEquals(ExpressionLongVisitor.TRUE, zero);
Assert.assertFalse(ExpressionLongVisitor.TRUE.equals(zero));
}
@Test(timeout = 1000)
public void testLong2() {
final Long one = new Long(1);
Assert.assertEquals(ExpressionLongVisitor.TRUE, one);
Assert.assertTrue(ExpressionLongVisitor.TRUE.equals(one));
Assert.assertNotEquals(ExpressionLongVisitor.FALSE, one);
Assert.assertFalse(ExpressionLongVisitor.FALSE.equals(one));
}
}
| [
"timeraider@gmx.at"
] | timeraider@gmx.at |
764d680bf5705cfc19d1402331ffee2b33a5209a | 638f87b495f948e5023464ea0b361862afd35ea4 | /src/main/java/br/gov/pa/cosanpa/gopera/managedBean/RelatorioHorasBean.java | 88d35098c2f922b8a84c8f3ead6df03761c0cd06 | [] | no_license | prodigasistemas/gsan-operacional | 6971759fa1f18c75f0018fd1b3847ce272fa5543 | fa87bf69eff3412ad5e153351d45d9a6ea0a29ba | refs/heads/master | 2021-01-17T09:08:05.864963 | 2017-07-18T14:40:20 | 2019-04-18T12:58:52 | 15,616,471 | 1 | 3 | null | 2015-04-06T12:19:36 | 2014-01-03T18:31:34 | Java | UTF-8 | Java | false | false | 4,013 | java | package br.gov.pa.cosanpa.gopera.managedBean;
import static br.gov.model.util.Utilitarios.converteAnoMesParaMesAno;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.jboss.logging.Logger;
import br.gov.pa.cosanpa.gopera.util.DadosExcel;
import br.gov.pa.cosanpa.gopera.util.GeradorExcel;
import br.gov.servicos.operacao.RelatorioHorasRepositorio;
import br.gov.servicos.operacao.to.FiltroOperacionalTO;
import br.gov.servicos.operacao.to.HorasRelatorioTO;
@ManagedBean
@ViewScoped
public class RelatorioHorasBean extends BaseMensagemBean{
private Logger logger = Logger.getLogger(RelatorioHorasBean.class);
@EJB
private RelatorioHorasRepositorio relatorioHoras;
private FiltroOperacionalTO to = new FiltroOperacionalTO();
public void exibir() {
try {
if (!to.intervaloValido()) {
mostrarMensagemErro(bundle.getText("erro_intervalo_invalido"));
return;
}
List<HorasRelatorioTO> relatorio = relatorioHoras.consultaHoras(to);
final Integer qtdMaximaCmb = relatorioHoras.quantidadeMaximaCmb(to);
if (relatorio.size() == 0){
mostrarMensagemAviso(bundle.getText("erro_nao_existe_retorno_filtro"));
}else{
DadosExcel excel = new DadosExcel() {
public String periodo() {
return converteAnoMesParaMesAno(to.getReferenciaInicial()) + " a " + converteAnoMesParaMesAno(to.getReferenciaFinal());
}
public String filtro(){
return to.filtroSelecionado();
}
public String tituloRelatorio() {
return bundle.getText("horas_sistema");
}
public String nomeArquivo() {
return "Horas do Sistema";
}
public List<List<String>> dados() {
List<List<String>> linhas = new ArrayList<List<String>>();
for (HorasRelatorioTO item : relatorio) {
linhas.add(item.toArray());
}
return linhas;
}
public String[] cabecalho() {
String[] cabecalho = new String[]{
bundle.getText("gerencia_regional")
, bundle.getText("unidade_negocio")
, bundle.getText("municipio")
, bundle.getText("localidade")
, bundle.getText("tipo_unidade_operacional")
, bundle.getText("codigo_uc")
, bundle.getText("unidade_operacional")
, bundle.getText("referencia")
, bundle.getText("total_horas_mes")
, bundle.getText("conjunto_motor_bomba")
, bundle.getText("horas_paradas_energia")
, bundle.getText("horas_paradas_manutencao")
, bundle.getText("horas_paradas_controle")
, bundle.getText("horas_trabalhadas")
};
String[] comCmbs = Arrays.copyOf(cabecalho, cabecalho.length + qtdMaximaCmb);
for(int i = cabecalho.length; i < cabecalho.length + qtdMaximaCmb; i++){
comCmbs[i] = (i - cabecalho.length + 1) + " CMB";
}
return comCmbs;
}
};
GeradorExcel gerador = new GeradorExcel(excel);
gerador.geraPlanilha();
}
} catch (Exception e) {
logger.error(bundle.getText("erro_gerar_relatorio"), e);
mostrarMensagemErro(bundle.getText("erro_gerar_relatorio"));
}
}
public FiltroOperacionalTO getTo() {
return to;
}
public void setTo(FiltroOperacionalTO to) {
this.to = to;
}
}
| [
"mbgarcia_pa@yahoo.com.br"
] | mbgarcia_pa@yahoo.com.br |
8bfdea80a41f11856abc7b9bd952e35a9f6b00db | e7b85e42786bdf213d8553be5518538acd44da5a | /src/com/xinyu/test/TestArray44.java | d2925addae3c74d8a16c8cece4086e6857d39087 | [] | no_license | TomasYu/AlgorithmsLearn | 9db3b4a2134e11d9960a0374c6932cfe8b2c1f5d | dbadae27672111e0c7a2b3ad5f506c52de6f2492 | refs/heads/master | 2023-08-08T20:55:25.644881 | 2023-07-29T10:14:09 | 2023-07-29T10:14:09 | 164,102,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,589 | java | package com.xinyu.test;
public class TestArray44 {
public static void main(String[] args) {
superEggDrop(1,2);
}
/**
* 鸡蛋掉落
* 你将获得 K 个鸡蛋,并可以使用一栋从 1 到 N 共有 N 层楼的建筑。
*
* 每个蛋的功能都是一样的,如果一个蛋碎了,你就不能再把它掉下去。
*
* 你知道存在楼层 F ,满足 0 <= F <= N 任何从高于 F 的楼层落下的鸡蛋都会碎,从 F 楼层或比它低的楼层落下的鸡蛋都不会破。
*
* 每次移动,你可以取一个鸡蛋(如果你有完整的鸡蛋)并把它从任一楼层 X 扔下(满足 1 <= X <= N)。
*
* 你的目标是确切地知道 F 的值是多少。
*
* 无论 F 的初始值如何,你确定 F 的值的最小移动次数是多少?
*
*
*
* 示例 1:
*
* 输入:K = 1, N = 2
* 输出:2
* 解释:
* 鸡蛋从 1 楼掉落。如果它碎了,我们肯定知道 F = 0 。
* 否则,鸡蛋从 2 楼掉落。如果它碎了,我们肯定知道 F = 1 。
* 如果它没碎,那么我们肯定知道 F = 2 。
* 因此,在最坏的情况下我们需要移动 2 次以确定 F 是多少。
* 示例 2:
*
* 输入:K = 2, N = 6
* 输出:3
* 示例 3:
*
* 输入:K = 3, N = 14
* 输出:4
*
*
* 提示:
*
* 1 <= K <= 100
* 1 <= N <= 10000
*/
public static int superEggDrop(int K, int N) {
return -1;
}
}
| [
"1455971532@qq.com"
] | 1455971532@qq.com |
7ea4bb0fd60143a002b1c9fb9dbd6972cb5b5947 | 2c9003f3c4f3b5182ec1e8dbe7e707eb7fac0031 | /src/main/java/com/example/suduko/dao/UserRepository.java | abe120830ca535db689a4bebde3d97399f8193ab | [] | no_license | TamtePrathamesh/sb_mapping | 208d5c13a0bec0d2c83ba4057cc80ffa65c00576 | 34a109a5ded2d173c5b1ef75176be13d9f92ad5c | refs/heads/main | 2023-04-04T02:51:17.088554 | 2021-04-04T05:45:09 | 2021-04-04T05:45:09 | 354,465,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package com.example.suduko.dao;
import com.example.suduko.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<User, Integer> {
}
| [
"tamteprathamesh@gmail.com"
] | tamteprathamesh@gmail.com |
56acefa953c76ed20c45701ee6622e254a2b358d | 39e0376030030a04a619c8b57a2e00e8c3fd35da | /project1026/src/event/MyWindowListener.java | 5e0bdb894cd87e431d1c44a36fabe59ffaff018f | [] | no_license | zzangyoon/java_workspace | daf2d64ed4f90723002ec83315b705733869a926 | 93219bd467b84ee4e02589a60bd8ee9a98af7cb7 | refs/heads/master | 2023-01-23T19:39:11.266701 | 2020-11-20T08:40:10 | 2020-11-20T08:40:10 | 305,320,851 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,187 | java | /*10. 윈도우창을 대상으로 발생할 수 있는 이벤트를 감지하는 리스너 구현하기*/
package event;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class MyWindowListener implements WindowListener{
public void windowActivated(WindowEvent e){ //현재 창을 활성화시킬때 (즉, 커서가 현재 창에 올라와 사용중일때)
System.out.println("windowActivated 호출");
}
public void windowClosed(WindowEvent e){ //창이 닫히면
System.out.println("windowClosed 호출");
}
public void windowClosing(WindowEvent e){ //닫기 버튼을 누르때(창이 닫히지는 않음)
System.out.println("windowClosing 호출");
}
public void windowDeactivated(WindowEvent e){
System.out.println("windowDeactivated 호출");
}
public void windowDeiconified(WindowEvent e){ //최소화 버튼을 눌러 아이콘화 시킬때
System.out.println("windowDeiconified 호출");
}
public void windowIconified(WindowEvent e){ //아이콘화의 반대
System.out.println("windowIconified 호출");
}
public void windowOpened(WindowEvent e){ //창이 뜰 때
System.out.println("windowOpened 호출");
}
}
| [
"zzangyoon710@gmail.com"
] | zzangyoon710@gmail.com |
1fd0e1af364f1836942d2c99c9ab923f7ff17fb0 | 17e8438486cb3e3073966ca2c14956d3ba9209ea | /dso/branches/sigar-maven/code/base/dso-spring/tests.unit/com/tctest/spring/bean/CounterSaverMixinAdvisor.java | bbdb9035c67bde82cc3d5a6151c30636510aba26 | [] | no_license | sirinath/Terracotta | fedfc2c4f0f06c990f94b8b6c3b9c93293334345 | 00a7662b9cf530dfdb43f2dd821fa559e998c892 | refs/heads/master | 2021-01-23T05:41:52.414211 | 2015-07-02T15:21:54 | 2015-07-02T15:21:54 | 38,613,711 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | /*
* All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
*/
package com.tctest.spring.bean;
import org.springframework.aop.support.DefaultIntroductionAdvisor;
public class CounterSaverMixinAdvisor extends DefaultIntroductionAdvisor {
public CounterSaverMixinAdvisor() {
super(new CounterSaverMixin(), CounterSaver.class);
}
}
| [
"jvoegele@7fc7bbf3-cf45-46d4-be06-341739edd864"
] | jvoegele@7fc7bbf3-cf45-46d4-be06-341739edd864 |
291f1179cfcfa241d36865bea367392b1d5ce963 | 8cef41ae7ed638b9a8fc87bb5080502ce8f48773 | /src/main/Laucher.java | 8d2006f4333f1f3f2c4f3118d2d8fbf6065d0c80 | [] | no_license | trancongman276/BoomBaseOnJava | 6e59d97fa23ab096bcb234ad54c33a4607f4df27 | aa9a584a237f39732cba47572bbfb5f4b3014d54 | refs/heads/master | 2020-11-28T16:06:19.006700 | 2020-01-01T09:05:47 | 2020-01-01T09:05:47 | 229,863,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package main;
public class Laucher {
static DrawGame game;
public static void main(String[] args) {
game = new DrawGame("Boom");
game.start();
}
}
| [
"trancongman276@gmail.com"
] | trancongman276@gmail.com |
d7f4dcafb1353e4754ea9f57eb34ed1d95422b06 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /eipanycast-20200309/src/main/java/com/aliyun/eipanycast20200309/models/AssociateAnycastEipAddressResponse.java | f252b50334301f5329c6e637012efee97183d19e | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,484 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.eipanycast20200309.models;
import com.aliyun.tea.*;
public class AssociateAnycastEipAddressResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public AssociateAnycastEipAddressResponseBody body;
public static AssociateAnycastEipAddressResponse build(java.util.Map<String, ?> map) throws Exception {
AssociateAnycastEipAddressResponse self = new AssociateAnycastEipAddressResponse();
return TeaModel.build(map, self);
}
public AssociateAnycastEipAddressResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public AssociateAnycastEipAddressResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public AssociateAnycastEipAddressResponse setBody(AssociateAnycastEipAddressResponseBody body) {
this.body = body;
return this;
}
public AssociateAnycastEipAddressResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
4fd1e067871946820a81a443bb516c8d30605384 | 33efe60e38d8fe5ffe54a0877000970f04d8fe7a | /src/main/java/com/bolsadeideas/springboot/app/model/service/IUploadFileService.java | 0086a75ebb12beba161a383be195524d970e86a5 | [] | no_license | llStrevensll/SpringBoot-Mysql | 70e918fd4f771ae22ca94a9afce99ef6913da0a4 | 46b726dd14bace78b6aa1555990ac62879a22b8b | refs/heads/master | 2021-04-22T01:58:27.582149 | 2020-04-17T23:34:24 | 2020-04-17T23:34:24 | 249,841,372 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package com.bolsadeideas.springboot.app.model.service;
import java.io.IOException;
import java.net.MalformedURLException;
import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
public interface IUploadFileService {
public Resource load(String filename) throws MalformedURLException;
public String copy(MultipartFile file) throws IOException;
public boolean delete(String filename);
public void deleteAll();
public void init() throws IOException;
}
| [
"anguelr12@hotmail.com"
] | anguelr12@hotmail.com |
63e28d963f2129d957675364053be953c7fd9328 | 3eff2ea119ebaab6b84609a109c2ccc591cc7337 | /gsyVideoPlayer-java/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java | 0870529162bd91758629b01b64b5834ca7befe4c | [] | no_license | xjxlx/player | 4887b2766e60cbde1f28508875e20b7ddfe23487 | a5e4a9d8d52c5637ac2ea3a15e707aa801bce12b | refs/heads/master | 2023-08-04T09:11:07.940900 | 2023-08-01T08:22:51 | 2023-08-01T08:22:51 | 330,207,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,078 | java | package com.shuyu.gsyvideoplayer.video;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.shuyu.gsyvideoplayer.R;
import com.shuyu.gsyvideoplayer.listener.GSYVideoShotListener;
import com.shuyu.gsyvideoplayer.listener.GSYVideoShotSaveListener;
import com.shuyu.gsyvideoplayer.utils.Debuger;
import com.shuyu.gsyvideoplayer.utils.NetworkUtils;
import com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer;
import com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer;
import java.io.File;
import moe.codeest.enviews.ENDownloadView;
import moe.codeest.enviews.ENPlayView;
/**
* 标准播放器,继承之后实现一些ui显示效果,如显示/隐藏ui,播放按键等
* Created by shuyu on 2016/11/11.
*/
public class StandardGSYVideoPlayer extends GSYVideoPlayer {
//亮度dialog
protected Dialog mBrightnessDialog;
//音量dialog
protected Dialog mVolumeDialog;
//触摸进度dialog
protected Dialog mProgressDialog;
//触摸进度条的progress
protected ProgressBar mDialogProgressBar;
//音量进度条的progress
protected ProgressBar mDialogVolumeProgressBar;
//亮度文本
protected TextView mBrightnessDialogTv;
//触摸移动显示文本
protected TextView mDialogSeekTime;
//触摸移动显示全部时间
protected TextView mDialogTotalTime;
//触摸移动方向icon
protected ImageView mDialogIcon;
protected Drawable mBottomProgressDrawable;
protected Drawable mBottomShowProgressDrawable;
protected Drawable mBottomShowProgressThumbDrawable;
protected Drawable mVolumeProgressDrawable;
protected Drawable mDialogProgressBarDrawable;
protected int mDialogProgressHighLightColor = -11;
protected int mDialogProgressNormalColor = -11;
/**
* 1.5.0开始加入,如果需要不同布局区分功能,需要重载
*/
public StandardGSYVideoPlayer(Context context, Boolean fullFlag) {
super(context, fullFlag);
}
public StandardGSYVideoPlayer(Context context) {
super(context);
}
public StandardGSYVideoPlayer(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void init(Context context) {
super.init(context);
//增加自定义ui
if (mBottomProgressDrawable != null) {
mBottomProgressBar.setProgressDrawable(mBottomProgressDrawable);
}
if (mBottomShowProgressDrawable != null) {
mProgressBar.setProgressDrawable(mBottomProgressDrawable);
}
if (mBottomShowProgressThumbDrawable != null) {
mProgressBar.setThumb(mBottomShowProgressThumbDrawable);
}
}
/**
* 继承后重写可替换为你需要的布局
*
* @return
*/
@Override
public int getLayoutId() {
return R.layout.video_layout_standard;
}
/**
* 开始播放
*/
@Override
public void startPlayLogic() {
if (mVideoAllCallBack != null) {
Debuger.printfLog("onClickStartThumb");
mVideoAllCallBack.onClickStartThumb(mOriginUrl, mTitle, StandardGSYVideoPlayer.this);
}
prepareVideo();
startDismissControlViewTimer();
}
/**
* 显示wifi确定框,如需要自定义继承重写即可
*/
@Override
protected void showWifiDialog() {
if (!NetworkUtils.isAvailable(mContext)) {
//Toast.makeText(mContext, getResources().getString(R.string.no_net), Toast.LENGTH_LONG).show();
startPlayLogic();
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getActivityContext());
builder.setMessage(getResources().getString(R.string.tips_not_wifi));
builder.setPositiveButton(getResources().getString(R.string.tips_not_wifi_confirm), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
startPlayLogic();
}
});
builder.setNegativeButton(getResources().getString(R.string.tips_not_wifi_cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.create().show();
}
/**
* 触摸显示滑动进度dialog,如需要自定义继承重写即可,记得重写dismissProgressDialog
*/
@Override
@SuppressWarnings("ResourceType")
protected void showProgressDialog(float deltaX, String seekTime, int seekTimePosition, String totalTime, int totalTimeDuration) {
if (mProgressDialog == null) {
View localView = LayoutInflater.from(getActivityContext()).inflate(getProgressDialogLayoutId(), null);
if (localView.findViewById(getProgressDialogProgressId()) instanceof ProgressBar) {
mDialogProgressBar = ((ProgressBar) localView.findViewById(getProgressDialogProgressId()));
if (mDialogProgressBarDrawable != null) {
mDialogProgressBar.setProgressDrawable(mDialogProgressBarDrawable);
}
}
if (localView.findViewById(getProgressDialogCurrentDurationTextId()) instanceof TextView) {
mDialogSeekTime = ((TextView) localView.findViewById(getProgressDialogCurrentDurationTextId()));
}
if (localView.findViewById(getProgressDialogAllDurationTextId()) instanceof TextView) {
mDialogTotalTime = ((TextView) localView.findViewById(getProgressDialogAllDurationTextId()));
}
if (localView.findViewById(getProgressDialogImageId()) instanceof ImageView) {
mDialogIcon = ((ImageView) localView.findViewById(getProgressDialogImageId()));
}
mProgressDialog = new Dialog(getActivityContext(), R.style.video_style_dialog_progress);
mProgressDialog.setContentView(localView);
mProgressDialog.getWindow().addFlags(Window.FEATURE_ACTION_BAR);
mProgressDialog.getWindow().addFlags(32);
mProgressDialog.getWindow().addFlags(16);
mProgressDialog.getWindow().setLayout(getWidth(), getHeight());
if (mDialogProgressNormalColor != -11 && mDialogTotalTime != null) {
mDialogTotalTime.setTextColor(mDialogProgressNormalColor);
}
if (mDialogProgressHighLightColor != -11 && mDialogSeekTime != null) {
mDialogSeekTime.setTextColor(mDialogProgressHighLightColor);
}
WindowManager.LayoutParams localLayoutParams = mProgressDialog.getWindow().getAttributes();
localLayoutParams.gravity = Gravity.TOP;
localLayoutParams.width = getWidth();
localLayoutParams.height = getHeight();
int location[] = new int[2];
getLocationOnScreen(location);
localLayoutParams.x = location[0];
localLayoutParams.y = location[1];
mProgressDialog.getWindow().setAttributes(localLayoutParams);
}
if (!mProgressDialog.isShowing()) {
mProgressDialog.show();
}
if (mDialogSeekTime != null) {
mDialogSeekTime.setText(seekTime);
}
if (mDialogTotalTime != null) {
mDialogTotalTime.setText(" / " + totalTime);
}
if (totalTimeDuration > 0)
if (mDialogProgressBar != null) {
mDialogProgressBar.setProgress(seekTimePosition * 100 / totalTimeDuration);
}
if (deltaX > 0) {
if (mDialogIcon != null) {
mDialogIcon.setBackgroundResource(R.drawable.video_forward_icon);
}
} else {
if (mDialogIcon != null) {
mDialogIcon.setBackgroundResource(R.drawable.video_backward_icon);
}
}
}
@Override
protected void dismissProgressDialog() {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
}
/**
* 触摸音量dialog,如需要自定义继承重写即可,记得重写dismissVolumeDialog
*/
@Override
protected void showVolumeDialog(float deltaY, int volumePercent) {
if (mVolumeDialog == null) {
View localView = LayoutInflater.from(getActivityContext()).inflate(getVolumeLayoutId(), null);
if (localView.findViewById(getVolumeProgressId()) instanceof ProgressBar) {
mDialogVolumeProgressBar = ((ProgressBar) localView.findViewById(getVolumeProgressId()));
if (mVolumeProgressDrawable != null && mDialogVolumeProgressBar != null) {
mDialogVolumeProgressBar.setProgressDrawable(mVolumeProgressDrawable);
}
}
mVolumeDialog = new Dialog(getActivityContext(), R.style.video_style_dialog_progress);
mVolumeDialog.setContentView(localView);
mVolumeDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
mVolumeDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
mVolumeDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
mVolumeDialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
WindowManager.LayoutParams localLayoutParams = mVolumeDialog.getWindow().getAttributes();
localLayoutParams.gravity = Gravity.TOP | Gravity.START;
localLayoutParams.width = getWidth();
localLayoutParams.height = getHeight();
int location[] = new int[2];
getLocationOnScreen(location);
localLayoutParams.x = location[0];
localLayoutParams.y = location[1];
mVolumeDialog.getWindow().setAttributes(localLayoutParams);
}
if (!mVolumeDialog.isShowing()) {
mVolumeDialog.show();
}
if (mDialogVolumeProgressBar != null) {
mDialogVolumeProgressBar.setProgress(volumePercent);
}
}
@Override
protected void dismissVolumeDialog() {
if (mVolumeDialog != null) {
mVolumeDialog.dismiss();
mVolumeDialog = null;
}
}
/**
* 触摸亮度dialog,如需要自定义继承重写即可,记得重写dismissBrightnessDialog
*/
@Override
protected void showBrightnessDialog(float percent) {
if (mBrightnessDialog == null) {
View localView = LayoutInflater.from(getActivityContext()).inflate(getBrightnessLayoutId(), null);
if (localView.findViewById(getBrightnessTextId()) instanceof TextView) {
mBrightnessDialogTv = (TextView) localView.findViewById(getBrightnessTextId());
}
mBrightnessDialog = new Dialog(getActivityContext(), R.style.video_style_dialog_progress);
mBrightnessDialog.setContentView(localView);
mBrightnessDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
mBrightnessDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
mBrightnessDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
mBrightnessDialog.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
mBrightnessDialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
WindowManager.LayoutParams localLayoutParams = mBrightnessDialog.getWindow().getAttributes();
localLayoutParams.gravity = Gravity.TOP | Gravity.END;
localLayoutParams.width = getWidth();
localLayoutParams.height = getHeight();
int location[] = new int[2];
getLocationOnScreen(location);
localLayoutParams.x = location[0];
localLayoutParams.y = location[1];
mBrightnessDialog.getWindow().setAttributes(localLayoutParams);
}
if (!mBrightnessDialog.isShowing()) {
mBrightnessDialog.show();
}
if (mBrightnessDialogTv != null)
mBrightnessDialogTv.setText((int) (percent * 100) + "%");
}
@Override
protected void dismissBrightnessDialog() {
if (mBrightnessDialog != null) {
mBrightnessDialog.dismiss();
mBrightnessDialog = null;
}
}
@Override
protected void cloneParams(GSYBaseVideoPlayer from, GSYBaseVideoPlayer to) {
super.cloneParams(from, to);
StandardGSYVideoPlayer sf = (StandardGSYVideoPlayer) from;
StandardGSYVideoPlayer st = (StandardGSYVideoPlayer) to;
if (st.mProgressBar != null && sf.mProgressBar != null) {
st.mProgressBar.setProgress(sf.mProgressBar.getProgress());
st.mProgressBar.setSecondaryProgress(sf.mProgressBar.getSecondaryProgress());
}
if (st.mTotalTimeTextView != null && sf.mTotalTimeTextView != null) {
st.mTotalTimeTextView.setText(sf.mTotalTimeTextView.getText());
}
if (st.mCurrentTimeTextView != null && sf.mCurrentTimeTextView != null) {
st.mCurrentTimeTextView.setText(sf.mCurrentTimeTextView.getText());
}
}
/**
* 将自定义的效果也设置到全屏
*
* @param context
* @param actionBar 是否有actionBar,有的话需要隐藏
* @param statusBar 是否有状态bar,有的话需要隐藏
* @return
*/
@Override
public GSYBaseVideoPlayer startWindowFullscreen(Context context, boolean actionBar, boolean statusBar) {
GSYBaseVideoPlayer gsyBaseVideoPlayer = super.startWindowFullscreen(context, actionBar, statusBar);
if (gsyBaseVideoPlayer != null) {
StandardGSYVideoPlayer gsyVideoPlayer = (StandardGSYVideoPlayer) gsyBaseVideoPlayer;
gsyVideoPlayer.setLockClickListener(mLockClickListener);
gsyVideoPlayer.setNeedLockFull(isNeedLockFull());
initFullUI(gsyVideoPlayer);
//比如你自定义了返回案件,但是因为返回按键底层已经设置了返回事件,所以你需要在这里重新增加的逻辑
}
return gsyBaseVideoPlayer;
}
/********************************各类UI的状态显示*********************************************/
/**
* 点击触摸显示和隐藏逻辑
*/
@Override
protected void onClickUiToggle() {
if (mIfCurrentIsFullscreen && mLockCurScreen && mNeedLockFull) {
setViewShowState(mLockScreen, VISIBLE);
return;
}
if (mCurrentState == CURRENT_STATE_PREPAREING) {
if (mBottomContainer != null) {
if (mBottomContainer.getVisibility() == View.VISIBLE) {
changeUiToPrepareingClear();
} else {
changeUiToPreparingShow();
}
}
} else if (mCurrentState == CURRENT_STATE_PLAYING) {
if (mBottomContainer != null) {
if (mBottomContainer.getVisibility() == View.VISIBLE) {
changeUiToPlayingClear();
} else {
changeUiToPlayingShow();
}
}
} else if (mCurrentState == CURRENT_STATE_PAUSE) {
if (mBottomContainer != null) {
if (mBottomContainer.getVisibility() == View.VISIBLE) {
changeUiToPauseClear();
} else {
changeUiToPauseShow();
}
}
} else if (mCurrentState == CURRENT_STATE_AUTO_COMPLETE) {
if (mBottomContainer != null) {
if (mBottomContainer.getVisibility() == View.VISIBLE) {
changeUiToCompleteClear();
} else {
changeUiToCompleteShow();
}
}
} else if (mCurrentState == CURRENT_STATE_PLAYING_BUFFERING_START) {
if (mBottomContainer != null) {
if (mBottomContainer.getVisibility() == View.VISIBLE) {
changeUiToPlayingBufferingClear();
} else {
changeUiToPlayingBufferingShow();
}
}
}
}
@Override
protected void hideAllWidget() {
setViewShowState(mBottomContainer, INVISIBLE);
setViewShowState(mTopContainer, INVISIBLE);
setViewShowState(mBottomProgressBar, VISIBLE);
setViewShowState(mStartButton, INVISIBLE);
}
@Override
protected void changeUiToNormal() {
Debuger.printfLog("changeUiToNormal");
setViewShowState(mTopContainer, VISIBLE);
setViewShowState(mBottomContainer, INVISIBLE);
setViewShowState(mStartButton, VISIBLE);
setViewShowState(mLoadingProgressBar, INVISIBLE);
setViewShowState(mThumbImageViewLayout, VISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, (mIfCurrentIsFullscreen && mNeedLockFull) ? VISIBLE : GONE);
updateStartImage();
if (mLoadingProgressBar instanceof ENDownloadView) {
((ENDownloadView) mLoadingProgressBar).reset();
}
}
@Override
protected void changeUiToPreparingShow() {
Debuger.printfLog("changeUiToPreparingShow");
setViewShowState(mTopContainer, VISIBLE);
setViewShowState(mBottomContainer, VISIBLE);
setViewShowState(mStartButton, INVISIBLE);
setViewShowState(mLoadingProgressBar, VISIBLE);
setViewShowState(mThumbImageViewLayout, INVISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
ENDownloadView enDownloadView = (ENDownloadView) mLoadingProgressBar;
if (enDownloadView.getCurrentState() == ENDownloadView.STATE_PRE) {
((ENDownloadView) mLoadingProgressBar).start();
}
}
}
@Override
protected void changeUiToPlayingShow() {
Debuger.printfLog("changeUiToPlayingShow");
setViewShowState(mTopContainer, VISIBLE);
setViewShowState(mBottomContainer, VISIBLE);
setViewShowState(mStartButton, VISIBLE);
setViewShowState(mLoadingProgressBar, INVISIBLE);
setViewShowState(mThumbImageViewLayout, INVISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, (mIfCurrentIsFullscreen && mNeedLockFull) ? VISIBLE : GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
((ENDownloadView) mLoadingProgressBar).reset();
}
updateStartImage();
}
@Override
protected void changeUiToPauseShow() {
Debuger.printfLog("changeUiToPauseShow");
setViewShowState(mTopContainer, VISIBLE);
setViewShowState(mBottomContainer, VISIBLE);
setViewShowState(mStartButton, VISIBLE);
setViewShowState(mLoadingProgressBar, INVISIBLE);
setViewShowState(mThumbImageViewLayout, INVISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, (mIfCurrentIsFullscreen && mNeedLockFull) ? VISIBLE : GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
((ENDownloadView) mLoadingProgressBar).reset();
}
updateStartImage();
updatePauseCover();
}
@Override
protected void changeUiToPlayingBufferingShow() {
Debuger.printfLog("changeUiToPlayingBufferingShow");
setViewShowState(mTopContainer, VISIBLE);
setViewShowState(mBottomContainer, VISIBLE);
setViewShowState(mStartButton, INVISIBLE);
setViewShowState(mLoadingProgressBar, VISIBLE);
setViewShowState(mThumbImageViewLayout, INVISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
ENDownloadView enDownloadView = (ENDownloadView) mLoadingProgressBar;
if (enDownloadView.getCurrentState() == ENDownloadView.STATE_PRE) {
((ENDownloadView) mLoadingProgressBar).start();
}
}
}
@Override
protected void changeUiToCompleteShow() {
Debuger.printfLog("changeUiToCompleteShow");
setViewShowState(mTopContainer, VISIBLE);
setViewShowState(mBottomContainer, VISIBLE);
setViewShowState(mStartButton, VISIBLE);
setViewShowState(mLoadingProgressBar, INVISIBLE);
setViewShowState(mThumbImageViewLayout, VISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, (mIfCurrentIsFullscreen && mNeedLockFull) ? VISIBLE : GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
((ENDownloadView) mLoadingProgressBar).reset();
}
updateStartImage();
}
@Override
protected void changeUiToError() {
Debuger.printfLog("changeUiToError");
setViewShowState(mTopContainer, INVISIBLE);
setViewShowState(mBottomContainer, INVISIBLE);
setViewShowState(mStartButton, VISIBLE);
setViewShowState(mLoadingProgressBar, INVISIBLE);
setViewShowState(mThumbImageViewLayout, INVISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, (mIfCurrentIsFullscreen && mNeedLockFull) ? VISIBLE : GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
((ENDownloadView) mLoadingProgressBar).reset();
}
updateStartImage();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
dismissVolumeDialog();
dismissBrightnessDialog();
}
/**
* 触摸进度dialog的layoutId
* 继承后重写可返回自定义
* 有自定义的实现逻辑可重载showProgressDialog方法
*/
protected int getProgressDialogLayoutId() {
return R.layout.video_progress_dialog;
}
/**
* 触摸进度dialog的进度条id
* 继承后重写可返回自定义,如果没有可返回空
* 有自定义的实现逻辑可重载showProgressDialog方法
*/
protected int getProgressDialogProgressId() {
return R.id.duration_progressbar;
}
/**
* 触摸进度dialog的当前时间文本
* 继承后重写可返回自定义,如果没有可返回空
* 有自定义的实现逻辑可重载showProgressDialog方法
*/
protected int getProgressDialogCurrentDurationTextId() {
return R.id.tv_current;
}
/**
* 触摸进度dialog全部时间文本
* 继承后重写可返回自定义,如果没有可返回空
* 有自定义的实现逻辑可重载showProgressDialog方法
*/
protected int getProgressDialogAllDurationTextId() {
return R.id.tv_duration;
}
/**
* 触摸进度dialog的图片id
* 继承后重写可返回自定义,如果没有可返回空
* 有自定义的实现逻辑可重载showProgressDialog方法
*/
protected int getProgressDialogImageId() {
return R.id.duration_image_tip;
}
/**
* 音量dialog的layoutId
* 继承后重写可返回自定义
* 有自定义的实现逻辑可重载showVolumeDialog方法
*/
protected int getVolumeLayoutId() {
return R.layout.video_volume_dialog;
}
/**
* 音量dialog的百分比进度条 id
* 继承后重写可返回自定义,如果没有可返回空
* 有自定义的实现逻辑可重载showVolumeDialog方法
*/
protected int getVolumeProgressId() {
return R.id.volume_progressbar;
}
/**
* 亮度dialog的layoutId
* 继承后重写可返回自定义
* 有自定义的实现逻辑可重载showBrightnessDialog方法
*/
protected int getBrightnessLayoutId() {
return R.layout.video_brightness;
}
/**
* 亮度dialog的百分比text id
* 继承后重写可返回自定义,如果没有可返回空
* 有自定义的实现逻辑可重载showBrightnessDialog方法
*/
protected int getBrightnessTextId() {
return R.id.app_video_brightness;
}
protected void changeUiToPrepareingClear() {
Debuger.printfLog("changeUiToPrepareingClear");
setViewShowState(mTopContainer, INVISIBLE);
setViewShowState(mBottomContainer, INVISIBLE);
setViewShowState(mStartButton, INVISIBLE);
setViewShowState(mLoadingProgressBar, INVISIBLE);
setViewShowState(mThumbImageViewLayout, INVISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
((ENDownloadView) mLoadingProgressBar).reset();
}
}
protected void changeUiToPlayingClear() {
Debuger.printfLog("changeUiToPlayingClear");
changeUiToClear();
setViewShowState(mBottomProgressBar, VISIBLE);
}
protected void changeUiToPauseClear() {
Debuger.printfLog("changeUiToPauseClear");
changeUiToClear();
setViewShowState(mBottomProgressBar, VISIBLE);
updatePauseCover();
}
protected void changeUiToPlayingBufferingClear() {
Debuger.printfLog("changeUiToPlayingBufferingClear");
setViewShowState(mTopContainer, INVISIBLE);
setViewShowState(mBottomContainer, INVISIBLE);
setViewShowState(mStartButton, INVISIBLE);
setViewShowState(mLoadingProgressBar, VISIBLE);
setViewShowState(mThumbImageViewLayout, INVISIBLE);
setViewShowState(mBottomProgressBar, VISIBLE);
setViewShowState(mLockScreen, GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
ENDownloadView enDownloadView = (ENDownloadView) mLoadingProgressBar;
if (enDownloadView.getCurrentState() == ENDownloadView.STATE_PRE) {
((ENDownloadView) mLoadingProgressBar).start();
}
}
updateStartImage();
}
protected void changeUiToClear() {
Debuger.printfLog("changeUiToClear");
setViewShowState(mTopContainer, INVISIBLE);
setViewShowState(mBottomContainer, INVISIBLE);
setViewShowState(mStartButton, INVISIBLE);
setViewShowState(mLoadingProgressBar, INVISIBLE);
setViewShowState(mThumbImageViewLayout, INVISIBLE);
setViewShowState(mBottomProgressBar, INVISIBLE);
setViewShowState(mLockScreen, GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
((ENDownloadView) mLoadingProgressBar).reset();
}
}
protected void changeUiToCompleteClear() {
Debuger.printfLog("changeUiToCompleteClear");
setViewShowState(mTopContainer, INVISIBLE);
setViewShowState(mBottomContainer, INVISIBLE);
setViewShowState(mStartButton, VISIBLE);
setViewShowState(mLoadingProgressBar, INVISIBLE);
setViewShowState(mThumbImageViewLayout, VISIBLE);
setViewShowState(mBottomProgressBar, VISIBLE);
setViewShowState(mLockScreen, (mIfCurrentIsFullscreen && mNeedLockFull) ? VISIBLE : GONE);
if (mLoadingProgressBar instanceof ENDownloadView) {
((ENDownloadView) mLoadingProgressBar).reset();
}
updateStartImage();
}
/**
* 定义开始按键显示
*/
protected void updateStartImage() {
if (mStartButton instanceof ENPlayView) {
ENPlayView enPlayView = (ENPlayView) mStartButton;
enPlayView.setDuration(500);
if (mCurrentState == CURRENT_STATE_PLAYING) {
enPlayView.play();
} else if (mCurrentState == CURRENT_STATE_ERROR) {
enPlayView.pause();
} else {
enPlayView.pause();
}
} else if (mStartButton instanceof ImageView) {
ImageView imageView = (ImageView) mStartButton;
if (mCurrentState == CURRENT_STATE_PLAYING) {
imageView.setImageResource(R.drawable.video_click_pause_selector);
} else if (mCurrentState == CURRENT_STATE_ERROR) {
imageView.setImageResource(R.drawable.video_click_error_selector);
} else {
imageView.setImageResource(R.drawable.video_click_play_selector);
}
}
}
/**
* 全屏的UI逻辑
*/
private void initFullUI(StandardGSYVideoPlayer standardGSYVideoPlayer) {
if (mBottomProgressDrawable != null) {
standardGSYVideoPlayer.setBottomProgressBarDrawable(mBottomProgressDrawable);
}
if (mBottomShowProgressDrawable != null && mBottomShowProgressThumbDrawable != null) {
standardGSYVideoPlayer.setBottomShowProgressBarDrawable(mBottomShowProgressDrawable,
mBottomShowProgressThumbDrawable);
}
if (mVolumeProgressDrawable != null) {
standardGSYVideoPlayer.setDialogVolumeProgressBar(mVolumeProgressDrawable);
}
if (mDialogProgressBarDrawable != null) {
standardGSYVideoPlayer.setDialogProgressBar(mDialogProgressBarDrawable);
}
if (mDialogProgressHighLightColor >= 0 && mDialogProgressNormalColor >= 0) {
standardGSYVideoPlayer.setDialogProgressColor(mDialogProgressHighLightColor, mDialogProgressNormalColor);
}
}
/**
* 底部进度条-弹出的
*/
public void setBottomShowProgressBarDrawable(Drawable drawable, Drawable thumb) {
mBottomShowProgressDrawable = drawable;
mBottomShowProgressThumbDrawable = thumb;
if (mProgressBar != null) {
mProgressBar.setProgressDrawable(drawable);
mProgressBar.setThumb(thumb);
}
}
/**
* 底部进度条-非弹出
*/
public void setBottomProgressBarDrawable(Drawable drawable) {
mBottomProgressDrawable = drawable;
if (mBottomProgressBar != null) {
mBottomProgressBar.setProgressDrawable(drawable);
}
}
/**
* 声音进度条
*/
public void setDialogVolumeProgressBar(Drawable drawable) {
mVolumeProgressDrawable = drawable;
}
/**
* 中间进度条
*/
public void setDialogProgressBar(Drawable drawable) {
mDialogProgressBarDrawable = drawable;
}
/**
* 中间进度条字体颜色
*/
public void setDialogProgressColor(int highLightColor, int normalColor) {
mDialogProgressHighLightColor = highLightColor;
mDialogProgressNormalColor = normalColor;
}
/************************************* 关于截图的 ****************************************/
/**
* 获取截图
*/
public void taskShotPic(GSYVideoShotListener gsyVideoShotListener) {
this.taskShotPic(gsyVideoShotListener, false);
}
/**
* 获取截图
*
* @param high 是否需要高清的
*/
public void taskShotPic(GSYVideoShotListener gsyVideoShotListener, boolean high) {
if (getCurrentPlayer().getRenderProxy() != null) {
getCurrentPlayer().getRenderProxy().taskShotPic(gsyVideoShotListener, high);
}
}
/**
* 保存截图
*/
public void saveFrame(final File file, GSYVideoShotSaveListener gsyVideoShotSaveListener) {
saveFrame(file, false, gsyVideoShotSaveListener);
}
/**
* 保存截图
*
* @param high 是否需要高清的
*/
public void saveFrame(final File file, final boolean high, final GSYVideoShotSaveListener gsyVideoShotSaveListener) {
if (getCurrentPlayer().getRenderProxy() != null) {
getCurrentPlayer().getRenderProxy().saveFrame(file, high, gsyVideoShotSaveListener);
}
}
/**
* 重新开启进度查询以及控制view消失的定时任务
* 用于解决GSYVideoHelper中通过removeview方式做全屏切换导致的定时任务停止的问题
* GSYVideoControlView onDetachedFromWindow()
*/
public void restartTimerTask() {
startProgressTimer();
startDismissControlViewTimer();
}
}
| [
"xjxliuxing@163.com"
] | xjxliuxing@163.com |
7cfaef17c25066164abbc50429c3a689ab732374 | 20f82399d6285fe04753877b1dc4619b8572a7ce | /OMC/src/main/java/com/a/omc/initializer/OMCInitializer.java | 4e67c0e4ca4347aaee81e10b9d7ee6da42e2953e | [] | no_license | jklopp11/OMC | 9866ca7349702bf2605fe5a25e2cabb41808f683 | 04ba1787eff754d41462a302227d847c3a771bbb | refs/heads/master | 2020-06-23T05:45:13.873775 | 2019-07-24T03:22:30 | 2019-07-24T03:22:30 | 198,529,156 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 869 | java | package com.a.omc.initializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.a.omc.handler.OMCServerHandler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.codec.serialization.ClassResolvers;
import io.netty.handler.codec.serialization.ObjectDecoder;
import io.netty.handler.codec.serialization.ObjectEncoder;
@Component
public class OMCInitializer extends ChannelInitializer<Channel> {
@Autowired
private OMCServerHandler omcServerHandler;
@Override
protected void initChannel(Channel sc) throws Exception {
sc.pipeline().addLast(new ObjectEncoder());
sc.pipeline().addLast(new ObjectDecoder(Integer.MAX_VALUE, ClassResolvers.cacheDisabled(null)));
sc.pipeline().addLast(omcServerHandler);
}
}
| [
"1624118004@qq.com"
] | 1624118004@qq.com |
eb2213f5455e690ca8e335907600d6f31d385ca0 | 407a5a94092e23be91303b15fa8be687bb657cdd | /app/src/main/java/com/example/e_softwarica/testing.java | 5583e75c2cc41a74eca5a8fc9e23845da7a73925 | [] | no_license | Gobinda3134/Test-master-master | 4236e8562b18fd4d606eb7ebebd6015b076f5cd9 | ca89a75213ca9687e1b4ce818b44d59372e35546 | refs/heads/master | 2021-01-04T08:33:38.905225 | 2020-02-24T15:50:44 | 2020-02-24T15:50:44 | 240,467,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package com.example.e_softwarica;
public class testing {
public String login(String Username, String Password)
{
return Username+Password;
}
}
| [
"bprajwol10@gmail.com"
] | bprajwol10@gmail.com |
fa554a249a05fe9e46e74b1a3ff18af71c294ca5 | 51cb5b254c68472ee67cc4147472506b477fc4b2 | /src/test/java/com/cybertek/pages/zContactInfoPage.java | 4a35712ee199fe9c979c8b924803110e1251a998 | [] | no_license | selmanland/EU5TestNGSelenium | acdab04b0b6fb4ba3711deac70ed9097fbb91a48 | 07a6a322039463b9aa0f54b874d130a9db2e9040 | refs/heads/master | 2023-07-18T04:36:31.150763 | 2021-08-24T22:04:46 | 2021-08-24T22:04:55 | 394,937,417 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package com.cybertek.pages;
import com.cybertek.utilities.Driver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.PageFactory;
public class zContactInfoPage extends BasePage{
public zContactInfoPage (){
PageFactory.initElements(Driver.get(),this);
}
public WebElement getName(String name){
return Driver.get().findElement(By.xpath("//h1[text()='"+name+"']"));
}
}
| [
"selmanlanka@gmail.com"
] | selmanlanka@gmail.com |
4fd6f517c095dd6c0838ad7c71771e98c5b0a0f0 | fee12418e40ec6590de3a6d6379cc7bafa997d79 | /AdventOfCode/src/aoc20/Day4.java | b32d1dfec7897c9856ea08680fa43b507e6b29c0 | [
"MIT"
] | permissive | melonhead901/programming-competition | 02681d864d3175fc13dbe0ce34fa44265399a9f4 | 42c574f680ccbc0f1247c7eb45c8cbb0dac1248e | refs/heads/master | 2022-12-22T07:05:29.277453 | 2022-12-14T05:42:36 | 2022-12-14T05:42:36 | 25,145,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,990 | java | package aoc20;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Day4 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int count = 0;
while (in.hasNextLine()) {
if (processCase(in)) {
count++;
}
System.out.println(count);
}
}
private static boolean processCase(Scanner in) {
List<String> words = new ArrayList<>();
String line = in.nextLine();
while (!line.isEmpty()) {
words.addAll(Arrays.asList(line.split(" ")));
line = in.nextLine();
}
boolean valid = validateWords(words);
return valid;
}
private static boolean part1(List<String> words) {
Set<String> prefixes = new HashSet<>();
for (String word : words) {
prefixes.add(word.split(":")[0]);
}
return isSuccessful(prefixes);
}
private static boolean validateWords(List<String> words) {
/*
byr (Birth Year) - four digits; at least 1920 and at most 2002.
iyr (Issue Year) - four digits; at least 2010 and at most 2020.
eyr (Expiration Year) - four digits; at least 2020 and at most 2030.
hgt (Height) - a number followed by either cm or in:
If cm, the number must be at least 150 and at most 193.
If in, the number must be at least 59 and at most 76.
hcl (Hair Color) - a # followed by exactly six characters 0-9 or a-f.
ecl (Eye Color) - exactly one of: amb blu brn gry grn hzl oth.
pid (Passport ID) - a nine-digit number, including leading zeroes.
cid (Country ID) - ignored, missing or not.
*/
int countValid = 0;
Map<String, String> mapping = new HashMap<>(words.size());
for (String word : words) {
String[] splits = word.split(":");
mapping.put(splits[0], splits[1]);
}
for (Map.Entry<String, String> entry : mapping.entrySet()) {
String value = entry.getValue();
switch (entry.getKey()) {
case "byr":
if (validateInt(value, 1920, 2002)) {
countValid++;
}
break;
case "iyr":
if (validateInt(value, 2010, 2020)) {
countValid++;
}
break;
case "eyr":
if (validateInt(value, 2020, 2030)) {
countValid++;
}
break;
case "hgt":
if (value.endsWith("cm")) {
if (validateInt(value.substring(0, 3), 150, 193)) {
countValid++;
}
} else if (value.endsWith("in")) {
if (validateInt(value.substring(0, 2), 59, 76)) {
countValid++;
}
}
break;
case "hcl":
if (regexMatch(value, "#[0-9a-f]{6}")) {
countValid++;
}
break;
case "ecl":
if (ImmutableList.of("amb", "blu", "brn", "gry", "grn", "hzl", "oth")
.contains(value)) {
countValid++;
}
break;
case "pid":
if (regexMatch(value, "[0-9]{9}")) {
countValid++;
}
break;
}
}
if (!(countValid >= 7)) {
// System.err.println(String.format("%s: %s", countValid, words));
}
return countValid >= 7;
}
private static boolean regexMatch(String value, String regex) {
Pattern pattern = Pattern.compile("^" + regex + "$");
Matcher matcher = pattern.matcher(value);
boolean result = matcher.find();
return result;
}
private static boolean validateInt(String value, int min, int max) {
try {
int val = Integer.parseInt(value);
return (val >= min) && (val <= max);
} catch (NumberFormatException ignored) {
}
return false;
}
private static boolean isSuccessful(Set<String> prefixes) {
Set<String> requiredPrefixes = new HashSet<>(ImmutableSet.of("byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"));
prefixes.retainAll(requiredPrefixes);
return prefixes.size() >= 7;
}
}
| [
"kdonohue@palantir.com"
] | kdonohue@palantir.com |
dc3540588cdb363f6ec94936a2626db4a5367347 | ff99b4349b799f45ac2bbbd23f4a31188b63b987 | /iMessenger/app/src/main/java/com/instigatemobile/imessenger/models/Conversation.java | 518a62c7f4c5d823b84d221f5e1304145816c0d4 | [] | no_license | AlbertAghajanyan/Projects | 880ad4f335b207e20e1840f98b344ad81da9da57 | 0ca46a92f967769c62469533dfe7d49d4cfb7243 | refs/heads/master | 2021-09-02T01:13:02.002293 | 2017-12-29T15:10:01 | 2017-12-29T15:10:01 | 115,730,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.instigatemobile.imessenger.models;
import java.util.ArrayList;
public class Conversation {
private ArrayList<Message> listMessageData;
public Conversation() {
listMessageData = new ArrayList<>();
}
public ArrayList<Message> getListMessageData() {
return listMessageData;
}
}
| [
"albert93aghajanyan@mail.ru"
] | albert93aghajanyan@mail.ru |
c14533517af09289b27549ea4c105f756b4c5cb1 | a23b0c79672b59b7fee2f0730269318d8959ee18 | /src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java | b4d5e9833cb69b80127f4bbdadfe6d87e6aaf4e8 | [
"Apache-2.0"
] | permissive | lemonJun/ESHunt | 1d417fc3605be8c5b384c66a5b623dea6ba77a6a | d66ed11d64234e783f67699e643daa77c9d077e3 | refs/heads/master | 2021-01-19T08:30:47.171304 | 2017-04-09T06:08:58 | 2017-04-09T06:08:58 | 87,639,997 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,636 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.rest.action.cat;
import com.carrotsearch.hppc.ObjectLongMap;
import com.carrotsearch.hppc.ObjectLongOpenHashMap;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static org.elasticsearch.rest.RestRequest.Method.GET;
/**
* Cat API class to display information about the size of fielddata fields per node
*/
public class RestFielddataAction extends AbstractCatAction {
@Inject
public RestFielddataAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
controller.registerHandler(GET, "/_cat/fielddata", this);
controller.registerHandler(GET, "/_cat/fielddata/{fields}", this);
}
@Override
void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
nodesStatsRequest.clear();
nodesStatsRequest.indices(true);
String[] fields = request.paramAsStringArray("fields", null);
nodesStatsRequest.indices().fieldDataFields(fields == null ? new String[] { "*" } : fields);
client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
@Override
public RestResponse buildResponse(NodesStatsResponse nodeStatses) throws Exception {
return RestTable.buildResponse(buildTable(request, nodeStatses), channel);
}
});
}
@Override
void documentation(StringBuilder sb) {
sb.append("/_cat/fielddata\n");
sb.append("/_cat/fielddata/{fields}\n");
}
@Override
Table getTableWithHeader(RestRequest request) {
Table table = new Table();
table.startHeaders().addCell("id", "desc:node id").addCell("host", "alias:h;desc:host name").addCell("ip", "desc:ip address").addCell("node", "alias:n;desc:node name").addCell("total", "text-align:right;desc:total field data usage").endHeaders();
return table;
}
private Table buildTable(final RestRequest request, final NodesStatsResponse nodeStatses) {
Set<String> fieldNames = new HashSet<>();
Map<NodeStats, ObjectLongMap<String>> nodesFields = new HashMap<>();
// Collect all the field names so a new table can be built
for (NodeStats ns : nodeStatses.getNodes()) {
ObjectLongOpenHashMap<String> fields = ns.getIndices().getFieldData().getFields();
nodesFields.put(ns, fields);
if (fields != null) {
for (String key : fields.keys().toArray(String.class)) {
fieldNames.add(key);
}
}
}
// The table must be rebuilt because it has dynamic headers based on the fields
Table table = new Table();
table.startHeaders().addCell("id", "desc:node id").addCell("host", "alias:h;desc:host name").addCell("ip", "desc:ip address").addCell("node", "alias:n;desc:node name").addCell("total", "text-align:right;desc:total field data usage");
// The table columns must be built dynamically since the number of fields is unknown
for (String fieldName : fieldNames) {
table.addCell(fieldName, "text-align:right;desc:" + fieldName + " field");
}
table.endHeaders();
for (Map.Entry<NodeStats, ObjectLongMap<String>> statsEntry : nodesFields.entrySet()) {
table.startRow();
// add the node info and field data total before each individual field
NodeStats ns = statsEntry.getKey();
table.addCell(ns.getNode().id());
table.addCell(ns.getNode().getHostName());
table.addCell(ns.getNode().getHostAddress());
table.addCell(ns.getNode().getName());
table.addCell(ns.getIndices().getFieldData().getMemorySize());
ObjectLongMap<String> fields = statsEntry.getValue();
for (String fieldName : fieldNames) {
table.addCell(new ByteSizeValue(fields == null ? 0L : fields.getOrDefault(fieldName, 0L)));
}
table.endRow();
}
return table;
}
}
| [
"506526593@qq.com"
] | 506526593@qq.com |
6be1e7c263a36e9e4d659f8cb4cce7cd86d26b09 | a3edd6d1d63b169222c109d799a34f93c6411f1d | /mybatisplus/src/main/java/com/chr/mybatisplus/netty/HttpServer.java | 9b2cabb1e8e8076ff5c6a2e837b51dc89c933884 | [] | no_license | RAY-chr/oauth2 | f90f1c8f708806f9b53f711fcebe1a8e807126fe | 78d9ab3231a83fabb8762033363fd6663166ca04 | refs/heads/master | 2021-07-09T04:32:20.376445 | 2020-08-14T03:02:40 | 2020-08-14T03:02:40 | 238,162,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,714 | java | package com.chr.mybatisplus.netty;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
import io.netty.handler.stream.ChunkedWriteHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author RAY
* @descriptions Netty的Handler必须是多例的
* @since 2020/3/29
*/
@Component
public class HttpServer {
/*@Autowired
private HttpServerHandler serverHandler;*/
/** Autowired默认单例,多例使用需如下
* 1、在需要多例调用的类上加@Scope("prototype")
2、在进行注入时,不能直接使用@Autowired,否则注入的还是单例,需要使用工厂,最简单的是用
@Autowired
private ObjectFactory<T> objectFactory;
对象进行注入(T为你要注入的类),想要使用该多例对象时,用
T t = objectFactory.getObject();
*/
@Autowired
private ObjectFactory<HttpServerHandler> objectFactory;
private static final Logger logger = LoggerFactory.getLogger(HttpServer.class);
private static class Inner{
private static final HttpServer INSTANCE = new HttpServer();
}
public static HttpServer getInstance(){
return Inner.INSTANCE;
}
public void start()throws Exception{
EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();
ServerBootstrap bootstrap = new ServerBootstrap();
try {
bootstrap.group(bossGroup,workerGroup) //设置链接和工作线程组
.channel(NioServerSocketChannel.class) //设置服务端
.option(ChannelOption.SO_BACKLOG,128) //设置客户端连接队列的链接个数
.childOption(ChannelOption.SO_KEEPALIVE,true) //设置保持活动链接状态
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel sc) throws Exception {
ChannelPipeline pipeline = sc.pipeline();
// websocket 基于http协议,所以要有http编解码器
pipeline.addLast(new HttpServerCodec());
// 对写大数据流的支持
pipeline.addLast(new ChunkedWriteHandler());
// 对httpMessage进行聚合,聚合成FullHttpRequest或FullHttpResponse
// 几乎在netty中的编程,都会使用到此hanler
pipeline.addLast(new HttpObjectAggregator(1024*64));
/*
* websocket 服务器处理的协议,用于指定给客户端连接访问的路由 : /ws
* 本handler会帮你处理一些繁重的复杂的事
* 会帮你处理握手动作: handshaking(close, ping, pong) ping + pong = 心跳
* 对于websocket来讲,都是以frames进行传输的,不同的数据类型对应的frames也不同
*/
pipeline.addLast(new WebSocketServerProtocolHandler("/ws"));
System.out.println(objectFactory.getObject());
pipeline.addLast(objectFactory.getObject());
}
}); //给workerGroup的 EventLoop对应的管道设置处理器
logger.info("服务器 is ready");
//启动服务器绑定端口 用作http长连接的话,端口最好取80开头的,例如6667就不行
ChannelFuture fu = bootstrap.bind(8088).sync();
fu.addListener(future->{
if (future.isSuccess()){
logger.info("监听端口成功");
}else {
System.out.println("监听失败");
}
});
//监听通道
fu.channel().closeFuture().sync();
} finally {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
}
| [
"428447121@qq.com"
] | 428447121@qq.com |
cb5c04af74e77971e5327be03439eeb9f3902d78 | ca5e1627ef3b81d79d50fbf41e821dbcc0b4e4aa | /src/main/java/com/example/producer/controller/TestController.java | 9fe56fdb84acefbb453777cebf55cc7ef3487588 | [] | no_license | ymgczh/producer | 2ba3ea09d381f0b278d5b8231ca36d4ded14b252 | 523bec3d2d2cd7e976138e51bbb65e2978037a3c | refs/heads/master | 2020-06-18T12:45:17.460626 | 2019-07-11T02:40:52 | 2019-07-11T02:40:52 | 196,307,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.example.producer.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* simple description
*
* @Description: java class description
* @Author: 张昊
* @CreateDate: 2019/7/11 8:34
* @Version: 1.0
* <p>Copyright: 内蒙古金财信息技术有限公司 (c) 2019</p>
*/
@RestController
public class TestController {
@RequestMapping("/helloPerson")
public String helloPerson(@RequestParam String name){
return "hello " + name + " welcome our home";
}
}
| [
"1026467712@qq.com"
] | 1026467712@qq.com |
7cc0c7d52289beb15d7b1bdff76b1d159c39e493 | c7571421f7808c1426185578b764860dc93396f0 | /src/main/java/yte/etkinlikyonetim/BasvuruPK.java | 213b9d469676c944c952aae601e1f04c612f2675 | [] | no_license | rabiaonal/YTE-etkinlik-yonetim | 9439f1d9987027d80d5eab076c5bc2916fd18b87 | cc733c2f30fbd539a3317f5a76f92e7a3a36eedf | refs/heads/master | 2022-12-25T06:54:23.133186 | 2020-10-02T14:10:15 | 2020-10-02T14:10:15 | 300,630,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package yte.etkinlikyonetim;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;
@Embeddable
@AllArgsConstructor
@ToString
@Getter
@Setter
@NoArgsConstructor
public class BasvuruPK implements Serializable {
@Column(name = "ETKINLIK_ID")
private Long etkinlik_id;
@Column(name = "KATILIMCI_ID")
private Long katilimci_id;
}
| [
"nur.onal@ug.bilkent.edu.tr"
] | nur.onal@ug.bilkent.edu.tr |
446a5e0424d2f356d4bfa7bd7278ab03046f38d7 | a36241da3efd087345ac422f2ab58274952f2b47 | /app/src/main/java/com/example/day10jigunag/BaseApp.java | 531cd420a8ffaa354405ed019f3bca6849c6ca9a | [] | no_license | 546547tete/Day10jigunag | d33ada1d445441b9753efa14a42c63487ee06f23 | 4d0544e3455cf7d6d97f4e2c2172a7efa4b86771 | refs/heads/master | 2022-11-20T02:15:50.309088 | 2020-07-21T08:03:40 | 2020-07-21T08:03:40 | 281,334,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package com.example.day10jigunag;
import android.app.Application;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.helper.Logger;
/**
* For developer startup JPush SDK
*
* 一般建议在自定义 Application 类里初始化。也可以在主 Activity 里。
*/
public class BaseApp extends Application {
private static final String TAG = "JIGUANG-Example";
@Override
public void onCreate() {
// Logger.d(TAG, "[ExampleApplication] onCreate");
super.onCreate();
JPushInterface.setDebugMode(true); // 设置开启日志,发布时请关闭日志
JPushInterface.init(this); // 初始化 JPush
}
}
| [
"2506969944@qq.com"
] | 2506969944@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.