blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4935cb5becce2a94110a95a5c069b9bdf44f103e | de265f93fb8e487d644bd7ab477bead552a96a37 | /java/p072.java | 174b3711c068e5e2024ab714f5b9342e4cd2ce91 | [] | no_license | deepdc19/euler | 5d114af7b1d0895ae9280e0b8335b73926a548cf | 28f5230b6176770c7fd3e5c685467492b00601ff | refs/heads/master | 2021-01-18T03:54:42.926400 | 2017-02-24T15:45:50 | 2017-02-24T15:45:50 | 85,776,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | /*
* Solution to Project Euler problem 72
*
*/
public final class p072 implements EulerSolution {
public static void main(String[] args) {
System.out.println(new p072().run());
}
private static final int LIMIT = Library.pow(10, 6);
public String run() {
long sum = 0;
int[] totients = Library.listTotients(LIMIT);
for (int i = 2; i < totients.length; i++)
sum += totients[i];
return Long.toString(sum);
}
}
| [
"[email protected]"
] | |
b9bb1152ed4c1630e87820ec7ee56c83442c2ccb | e2980ceba7a60bf6b37a84d00ca582c96e67c1e6 | /src/main/java/com/eickstaedtdjessica/workshopmongo/config/Instantiation.java | 2a9344ae30bcd3115c4be2a52199e56443aeba09 | [] | no_license | Djessica/workshop_spring_mongo | b5af5f71d61183e0cee9839b5175e63a408ce6ec | 08c73342f8d5c804de91bc00c9e76015fbf6b7b2 | refs/heads/master | 2020-05-31T19:48:44.157625 | 2019-07-10T20:53:52 | 2019-07-10T20:53:52 | 190,461,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,169 | java | package com.eickstaedtdjessica.workshopmongo.config;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.TimeZone;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Configuration;
import com.eickstaedtdjessica.workshopmongo.domain.Post;
import com.eickstaedtdjessica.workshopmongo.domain.User;
import com.eickstaedtdjessica.workshopmongo.dto.AuthorDTO;
import com.eickstaedtdjessica.workshopmongo.dto.CommentDTO;
import com.eickstaedtdjessica.workshopmongo.repository.PostRepository;
import com.eickstaedtdjessica.workshopmongo.repository.UserRepository;
//deixa claro para o spring que é uma configuração
@Configuration
public class Instantiation implements CommandLineRunner{
@Autowired
private UserRepository userRepo;
@Autowired
private PostRepository postRepo;
@Override
public void run(String... args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
userRepo.deleteAll();
User maria = new User(null, "Maria Brown", "[email protected]");
User alex = new User(null, "Alex Green", "[email protected]");
User bob = new User(null, "Bob Grey", "[email protected]");
//salva primeiro para que o usuario tenha um id proprio
userRepo.saveAll(Arrays.asList(maria,alex,bob));
Post post1 = new Post(null, sdf.parse("10/06/2019"),"teste", "testeeeeeee",new AuthorDTO(maria));
Post post2 = new Post(null, sdf.parse("10/06/2019"),"teste2", "testeeeeeee2",new AuthorDTO(alex));
CommentDTO com1 = new CommentDTO("Boa viagem mano!",sdf.parse("11/06/2019"), new AuthorDTO(alex));
CommentDTO com2 = new CommentDTO("Aproveite!",sdf.parse("22/03/2018"),new AuthorDTO(bob));
CommentDTO com3 = new CommentDTO("Tenha um ótimo dia!",sdf.parse("23/03/2018"),new AuthorDTO(alex));
post1.getComments().addAll(Arrays.asList(com1,com2));
post2.getComments().addAll(Arrays.asList(com3));
postRepo.saveAll(Arrays.asList(post1,post2));
maria.getPost().addAll(Arrays.asList(post1,post2));
userRepo.save(maria);
}
}
| [
"[email protected]"
] | |
62847f5da162e46bb39daa88e1378b80c1900b58 | 5483be3ef33f55b865aff5813d673a4ab7c8e187 | /src/main/java/com/example/SpringCRUDUpdate/entity/CustomErrorType.java | e4e6bff37bb025ea23c1e91dcd0577db4219b262 | [] | no_license | Mtt-linh/ExamIASF | a3f152a2fc2ad6f50828e9cd681511a8e538304f | 3b6f70f54f5841f3ad040d6a7ea12a2bc50f5cc7 | refs/heads/master | 2023-04-01T06:57:00.341055 | 2021-04-02T03:30:01 | 2021-04-02T03:30:01 | 353,872,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.example.SpringCRUDUpdate.entity;
public class CustomErrorType {
private String errorMessage;
public CustomErrorType(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getErrorMessage() {
return errorMessage;
}
}
| [
"[email protected]"
] | |
7fb7a870ca2d5b0f17e28a1b7de5e58c3e44def4 | f4bc229c9afba3d2cee7b084abd42a5e3d06618b | /TimeTableGenerator/src/com/company/Division.java | a2525f5bc4ed1cd313174a35045cc6810309ff96 | [] | no_license | Varun-Jethanandani/AutomaticTimeTableGenerator | bc8c33566f9ae23c7b7aeab081af3961622ca05f | dac149ad2afecec1b416c5faf9a573ffdbed36f8 | refs/heads/master | 2021-07-11T17:29:32.964609 | 2020-07-08T02:45:56 | 2020-07-08T02:45:56 | 173,763,090 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,305 | java | import java.util.Map;
import java.util.ArrayList;
import java.util.Random;
import java.util.Set;
import java.util.HashMap;
public class Division{
String divisionName;
public ArrayList<Subject> subjectList;
String startTime;
Map<Subject,Teacher> divSubTeacher;
private Map<Teacher,Integer> subjectTeacher;
public Division(String divisionName,ArrayList<Subject> subjectList,String startTime){
this.divisionName = divisionName;
this.subjectList = subjectList;
this.startTime = startTime;
this.divSubTeacher = new HashMap<Subject,Teacher>();
}
public String getdivisionName(){
return this.divisionName;
}
public void setdivisionName(String divisionName){
this.divisionName = divisionName;
}
public ArrayList<Subject> getsubjectList(){
return new ArrayList<Subject>(this.subjectList);
}
public void setsubjectList(ArrayList<Subject> subjectList){
this.subjectList = subjectList;
}
public String getstartTime(){
return this.startTime;
}
public void setstartTime(String startTime){
this.startTime = startTime;
}
public Map<Subject,Teacher> getSubjectTeacher(){
try{
for (int i=0;i<subjectList.size() ;i++ ) {
Subject subject = subjectList.get(i);
subjectTeacher = subject.getSubjectTeachers();
Set<Teacher> teachers = subjectTeacher.keySet();
ArrayList<Teacher> availableTeachers = new ArrayList<>();
Random selectSubjectTeacher = new Random();
for (Teacher teacher : teachers) {
if (subjectTeacher.get(teacher)>0 && (Integer.parseInt(this.getstartTime().split(":")[0])+6)>(Integer.parseInt(teacher.getReportingTime().split(":")[0]))) {
availableTeachers.add(teacher);
}
}
if (availableTeachers.size()>0) {
int index = selectSubjectTeacher.nextInt(availableTeachers.size());
Teacher selectedTeacher = availableTeachers.get(index);
subjectTeacher.put(selectedTeacher,subjectTeacher.get(selectedTeacher)-1);
subject.setSubjectTeachers(subjectTeacher);
divSubTeacher.put(subject,selectedTeacher);
}else{
System.out.println("We need more teachers for subject " + subject.getName());
}
}
}catch(Exception e){
System.out.println("Division ke andar" + e);
}
return divSubTeacher;
}
}
| [
"[email protected]"
] | |
0095dac83e4e18d52bd8962b82a84ac38133d228 | 4f46ebe5e05645dc6a4a34a45d8ce60c08c74c57 | /AccessSpecifiersTutorial/src/accessSpecifiersTutorial/PublicClassExample.java | 676051727ca80d00c4a14268fe8be51f64f97f80 | [] | no_license | VinuthCS/TekAndCo-Git | e533810e5250e09a08dc5667d7097f9857240235 | 27792a54953721ea51809c07eb9fd294db221347 | refs/heads/master | 2021-01-02T19:58:18.787823 | 2020-02-28T03:58:51 | 2020-02-28T03:58:51 | 239,777,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package accessSpecifiersTutorial;
public class PublicClassExample {
/***
* This class is used to demonstrate the scope of public
* data member and method
***/
//Creating a private data member of type String
public static String publicString = "Public Member of PublicClassExample";
//Creating a public method to access the data member
public static void publicMethod() {
System.out.println("This is a public method in PublicClassExample "
+ "trying to access the public data member");
System.out.println(publicString);
}
}
| [
"[email protected]"
] | |
68ce3d8ce0b60956ade1347369582025742f281c | 4193b23b6f01af0380c3fd2ef659400d432da2f1 | /src/main/java/constant/MoveStatus.java | c38747c55e2876c7733ee91b9b8687b0eef5e47b | [] | no_license | erin0331/java-racingcar-precourse | f64c7f1639a04a993ed4916ae27c4e205f552113 | 086bc24082c58e82148726d2d825e921e99a4daa | refs/heads/master | 2023-04-16T08:31:41.801829 | 2021-05-03T15:35:13 | 2021-05-03T15:35:13 | 362,803,557 | 0 | 0 | null | 2021-05-03T15:35:14 | 2021-04-29T12:06:11 | Java | UTF-8 | Java | false | false | 109 | java | package constant;
public enum MoveStatus {
STOP, GO;
public boolean isGone() {
return this == GO;
}
}
| [
"[email protected]"
] | |
91d1a488e38e417643fe54d913de1f6753d0df9d | 790462d83341c9a8e051f0b548078201165c7c75 | /src/main/java/com/ks/hrms/core/context/DoSystemContext.java | 5a3032b2e0736a2d09715d23715b09f8f762c4dd | [] | no_license | ModelKaiSir/HousingRentalMS | 2eafc822e741ecd38f18b8bb8986137309c9c9e2 | 9b385c7339f7fe9958d2f935ff8692715b440d46 | refs/heads/master | 2022-12-22T00:48:20.841078 | 2019-10-25T10:59:35 | 2019-10-25T10:59:35 | 189,582,222 | 0 | 0 | null | 2022-12-16T08:00:29 | 2019-05-31T11:21:19 | Java | UTF-8 | Java | false | false | 1,437 | java | package com.ks.hrms.core.context;
import com.ks.hrms.dao.SystemDao;
import javafx.beans.property.SimpleStringProperty;
import org.springframework.beans.factory.annotation.Autowired;
public abstract class DoSystemContext implements AppContext{
static final String DEF_VER = "1.0.1";
protected SimpleStringProperty ver = new SimpleStringProperty(DEF_VER);
protected SimpleStringProperty appName = new SimpleStringProperty();
protected SimpleStringProperty about = new SimpleStringProperty();
protected SystemDao dao;
protected SystemDao.SystemInfomation infomation;
public DoSystemContext() {
}
@Override
public void init() {
infomation = dao.getSysInfo();
appName.set(infomation.getCompanyName());
ver.set(infomation.getVer());
about.set(infomation.getAbout());
}
@Autowired
public void setDao(SystemDao dao) {
this.dao = dao;
}
@Override
public boolean checkVer(String old) {
return old.compareTo(ver.get()) > 0;
}
@Override
public void updateSystemInfomation(SystemDao.SystemInfomation infomation) {
dao.update(infomation);
}
@Override
public SimpleStringProperty getVer() {
return ver;
}
@Override
public SimpleStringProperty about() {
return about;
}
@Override
public SimpleStringProperty getAppName() {
return appName;
}
}
| [
"[email protected]"
] | |
0e06860f200f9f76c6cd1ab60a9f3462e0b71a36 | 0d80f3761882447faab4f419ad994fad3e27004b | /app/src/main/java/com/allintask/lingdao/ui/activity/user/AboutUsActivity.java | cca964be712e1f4f7f6dd2fa2270f1cf61b552c3 | [
"Apache-2.0"
] | permissive | TanJiaJunBeyond/Allintask | f60330fb955bad704b30bfec250f67bccb0a039f | aa8e3ab7c2615e135f12a6a71cf7e5a9c297717d | refs/heads/master | 2020-07-05T19:03:51.593867 | 2019-11-23T18:37:34 | 2019-11-23T18:37:34 | 202,739,684 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,243 | java | package com.allintask.lingdao.ui.activity.user;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;
import com.allintask.lingdao.R;
import com.allintask.lingdao.presenter.user.AboutUsPresenter;
import com.allintask.lingdao.ui.activity.BaseActivity;
import com.allintask.lingdao.ui.adapter.user.AboutUsAdapter;
import com.allintask.lingdao.view.user.IAboutUsView;
import com.allintask.lingdao.widget.CommonRecyclerView;
import butterknife.BindView;
import cn.tanjiajun.sdk.common.utils.DensityUtils;
/**
* Created by TanJiaJun on 2018/2/26.
*/
public class AboutUsActivity extends BaseActivity<IAboutUsView, AboutUsPresenter> implements IAboutUsView {
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.tv_title)
TextView titleTv;
@BindView(R.id.recycler_view)
CommonRecyclerView recyclerView;
private AboutUsAdapter aboutUsAdapter;
@Override
protected int getLayoutResId() {
return R.layout.activity_about_us;
}
@Override
protected AboutUsPresenter CreatePresenter() {
return new AboutUsPresenter();
}
@Override
protected void init() {
initToolbar();
initUI();
}
private void initToolbar() {
toolbar.setBackgroundColor(getResources().getColor(R.color.white));
toolbar.setNavigationIcon(R.mipmap.ic_arrow_back);
toolbar.setTitle("");
titleTv.setText(getString(R.string.about_us));
setSupportActionBar(toolbar);
}
private void initUI() {
recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.set(0, 0, 0, DensityUtils.dip2px(getParentContext(), 1));
}
});
aboutUsAdapter = new AboutUsAdapter(getParentContext());
recyclerView.setAdapter(aboutUsAdapter);
showContentView();
}
}
| [
"[email protected]"
] | |
b9ac530f6017c6a54c42a629be49a417825586a7 | ba3077de3a763e1e0fa06f53fd299b1fa768aaac | /src/main/java/com/github/liaochong/myexcel/core/XSSFSaxReadHandler.java | 3c69aaf819867f1363be600e1c6212e22d6566c6 | [
"Apache-2.0"
] | permissive | liaochong/myexcel | 0a5af43f0611afcd551a7f884d18d2aa5cd92b94 | 35ecd885a07fa6a4b91bf8c98ecf531cad8734f0 | refs/heads/master | 2023-08-05T05:09:29.996472 | 2023-07-29T06:38:49 | 2023-07-29T06:38:49 | 113,136,737 | 1,599 | 337 | Apache-2.0 | 2023-07-28T10:39:43 | 2017-12-05T05:25:20 | Java | UTF-8 | Java | false | false | 2,312 | java | /*
* Copyright 2019 liaochong
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.liaochong.myexcel.core;
import com.github.liaochong.myexcel.core.context.Hyperlink;
import org.apache.poi.ss.util.CellAddress;
import org.slf4j.Logger;
import java.util.Collections;
import java.util.List;
/**
* sax处理
*
* @author liaochong
* @version 1.0
*/
class XSSFSaxReadHandler<T> extends AbstractReadHandler<T> implements XSSFSheetXMLHandler.SheetContentsHandler {
private static final Logger log = org.slf4j.LoggerFactory.getLogger(XSSFSaxReadHandler.class);
private int count;
private final XSSFSheetPreXMLHandler.XSSFPreData xssfPreData;
public XSSFSaxReadHandler(
List<T> result,
SaxExcelReader.ReadConfig<T> readConfig, XSSFSheetPreXMLHandler.XSSFPreData xssfPreData) {
super(false, result, readConfig, xssfPreData != null ? xssfPreData.mergeCellMapping : Collections.emptyMap());
this.xssfPreData = xssfPreData;
}
@Override
public void startRow(int rowNum, boolean newInstance) {
newRow(rowNum, newInstance);
}
@Override
public void endRow(int rowNum) {
handleResult();
count++;
}
@Override
public void cell(CellAddress cellAddress, String formattedValue) {
if (xssfPreData != null) {
Hyperlink hyperlink = xssfPreData.hyperlinkMapping.get(cellAddress);
if (hyperlink != null) {
hyperlink.setLabel(formattedValue);
}
this.readContext.setHyperlink(hyperlink);
}
int thisCol = cellAddress.getColumn();
handleField(thisCol, formattedValue);
}
@Override
public void endSheet() {
log.info("Import completed, total number of rows {}.", count);
}
}
| [
"[email protected]"
] | |
cd26e2742e66eb3040b3675ac16b5f34a5d73335 | b288464d9f023eb2d0801871d97ba5e310c4b61b | /ImageSlider/src/main/java/com/hangox/slider/Transformers/DepthPageTransformer.java | ab96815e606062765f3d71a46675723be73e1b8d | [
"MIT"
] | permissive | hangox/AndroidImageSlider | 08bac6f37d659967b50f95d90b996df194dc31ba | d8f259bd954bfed7ccf58262ecb33a8a31a04a88 | refs/heads/master | 2020-12-31T07:33:07.136399 | 2015-06-19T01:18:58 | 2015-06-19T01:18:58 | 34,798,574 | 0 | 0 | null | 2015-04-29T14:29:40 | 2015-04-29T14:29:39 | null | UTF-8 | Java | false | false | 937 | java | package com.hangox.slider.Transformers;
import android.view.View;
import com.nineoldandroids.view.ViewHelper;
public class DepthPageTransformer extends BaseTransformer {
private static final float MIN_SCALE = 0.75f;
@Override
protected void onTransform(View view, float position) {
if (position <= 0f) {
ViewHelper.setTranslationX(view,0f);
ViewHelper.setScaleX(view,1f);
ViewHelper.setScaleY(view,1f);
} else if (position <= 1f) {
final float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
ViewHelper.setAlpha(view,1-position);
ViewHelper.setPivotY(view,0.5f * view.getHeight());
ViewHelper.setTranslationX(view,view.getWidth() * - position);
ViewHelper.setScaleX(view,scaleFactor);
ViewHelper.setScaleY(view,scaleFactor);
}
}
@Override
protected boolean isPagingEnabled() {
return true;
}
}
| [
"[email protected]"
] | |
f1cde36e41f5a62ea35164a4f49f4b8d7713bf1d | 7f57b906a9b1b01e163afba710bd727fa8d3cb92 | /src/main/java/org/zjn/myplant/service/MqttOutboundService.java | 0007b86ce6dcf6328c31243e24faaf59966f2269 | [] | no_license | hatshepsut-working/myplant | 4c245cf62c63c036d4cddaa2bba62fad951e387b | 241ef035f0bbbbe216cd72335d65e9c42990b4cb | refs/heads/master | 2020-03-21T10:42:15.939194 | 2018-06-24T09:28:45 | 2018-06-24T09:28:45 | 138,466,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | package org.zjn.myplant.service;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.IntegrationComponentScan;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
//@IntegrationComponentScan
public interface MqttOutboundService {
//void sendMqtt(String string);
MqttPahoClientFactory mqttClientFactory();
//@ServiceActivator(inputChannel = "mqttOutboundChannel")
MessageHandler mqttOutbound();
MessageChannel mqttOutboundChannel();
}
| [
"[email protected]"
] | |
145ddcc25301b12a2646649bb6a49d59bbcba0a7 | 7773ea6f465ffecfd4f9821aad56ee1eab90d97a | /plugins/sh/gen/com/intellij/sh/psi/impl/ShLiteralConditionImpl.java | e6d80091d4070b283bb4bc91da2dbcdd1bcff248 | [
"Apache-2.0"
] | permissive | aghasyedbilal/intellij-community | 5fa14a8bb62a037c0d2764fb172e8109a3db471f | fa602b2874ea4eb59442f9937b952dcb55910b6e | refs/heads/master | 2023-04-10T20:55:27.988445 | 2020-05-03T22:00:26 | 2020-05-03T22:26:23 | 261,074,802 | 2 | 0 | Apache-2.0 | 2020-05-04T03:48:36 | 2020-05-04T03:48:35 | null | UTF-8 | Java | false | true | 2,110 | java | // This is a generated file. Not intended for manual editing.
package com.intellij.sh.psi.impl;
import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static com.intellij.sh.ShTypes.*;
import com.intellij.sh.psi.*;
public class ShLiteralConditionImpl extends ShConditionImpl implements ShLiteralCondition {
public ShLiteralConditionImpl(ASTNode node) {
super(node);
}
public void accept(@NotNull ShVisitor visitor) {
visitor.visitLiteralCondition(this);
}
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof ShVisitor) accept((ShVisitor)visitor);
else super.accept(visitor);
}
@Override
@Nullable
public ShArithmeticExpansion getArithmeticExpansion() {
return findChildByClass(ShArithmeticExpansion.class);
}
@Override
@Nullable
public ShBraceExpansion getBraceExpansion() {
return findChildByClass(ShBraceExpansion.class);
}
@Override
@NotNull
public List<ShCommand> getCommandList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, ShCommand.class);
}
@Override
@Nullable
public ShNumber getNumber() {
return findChildByClass(ShNumber.class);
}
@Override
@Nullable
public ShShellParameterExpansion getShellParameterExpansion() {
return findChildByClass(ShShellParameterExpansion.class);
}
@Override
@Nullable
public ShString getString() {
return findChildByClass(ShString.class);
}
@Override
@Nullable
public ShVariable getVariable() {
return findChildByClass(ShVariable.class);
}
@Override
@Nullable
public PsiElement getBang() {
return findChildByType(BANG);
}
@Override
@Nullable
public PsiElement getDollar() {
return findChildByType(DOLLAR);
}
@Override
@Nullable
public PsiElement getFiledescriptor() {
return findChildByType(FILEDESCRIPTOR);
}
@Override
@Nullable
public PsiElement getWord() {
return findChildByType(WORD);
}
}
| [
"[email protected]"
] | |
6b1abc1bfbc0ad354f858057310f399cdfea54bb | 4ec82e4d063194e16c1ce4473999ef908e41270c | /common-orm/src/main/java/jef/database/wrapper/populator/ResultSetExtractor.java | 0850b1f68022c5d28d855888b7f1045a5589b0db | [
"Apache-2.0"
] | permissive | wecup/ef-orm | 4ff0e41b03a9600de66c3b2492d8732af812119e | ca8e9a4ceff9181e1d2f5015650953d432bc36d0 | refs/heads/master | 2020-12-11T06:13:55.717959 | 2014-11-05T10:19:26 | 2014-11-05T10:19:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,344 | java | /*
* JEF - Copyright 2009-2010 Jiyi ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jef.database.wrapper.populator;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
import jef.database.wrapper.result.IResultSet;
/**
* 直接对JDBC结果集进行操作的转换器
*
* @author jiyi
*
* @param <T>
*/
public interface ResultSetExtractor<T> {
T transformer(IResultSet rs) throws SQLException;
int getMaxRows();
int getFetchSize();
int getQueryTimeout();
ResultSetExtractor<T> setMaxRows(int maxRows);
ResultSetExtractor<T> setFetchSize(int fetchSize);
ResultSetExtractor<T> setQueryTimeout(int timeout);
void apply(Statement st) throws SQLException;
boolean autoClose();
public static final ResultSetExtractor<Long> GET_FIRST_LONG = new AbstractResultSetTransformer<Long>() {
public Long transformer(IResultSet rs) throws SQLException {
if (rs.next()) {
return rs.getLong(1);
} else {
throw new SQLException("Result incorrect.count result must not be empty.");
}
}
}.setMaxRows(1);
public static final ResultSetExtractor<Integer> GET_FIRST_INT = new AbstractResultSetTransformer<Integer>() {
public Integer transformer(IResultSet rs) throws SQLException {
if (rs.next()) {
return rs.getInt(1);
} else {
throw new SQLException("Result incorrect.count result must not be empty.");
}
}
}.setMaxRows(1);
public static final ResultSetExtractor<Date> GET_FIRST_TIMESTAMP = new AbstractResultSetTransformer<Date>() {
public Date transformer(IResultSet rs) throws SQLException {
if (rs.next()) {
java.sql.Timestamp ts = rs.getTimestamp(1);
return new java.util.Date(ts.getTime());
} else {
throw new SQLException("Result incorrect.count result must not be empty.");
}
}
};
}
| [
"[email protected]"
] | |
a6cb06a1a210237ff9b89229e884cbade038785e | 019212e4c454c97533f8069a81dc987e34ebeee6 | /src/test/java/test/nebula/FooTest.java | 1473d51fb742a352dcd3c1ac56eb006991e8427f | [] | no_license | nebula-plugins/buildscan-test | 2fa7155f0184d8337175e999b516a7f83121809e | be21686775ea4a3b88b72893743f105d2f5ce0e5 | refs/heads/master | 2021-01-25T06:25:06.226281 | 2017-06-06T22:57:20 | 2017-06-06T22:57:20 | 93,569,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package test.nebula;
import org.junit.Test;
import static org.junit.Assert.*;
public class FooTest {
@Test
public void canary() {
assertEquals("1 == 1", 1,1);
}
}
| [
"[email protected]"
] | |
a7f6ceb94ba275f7ddf48f38d598db1d4fc14182 | a78ed654f82355aff8667d0e31f6dbab535c1997 | /app/src/main/java/com/olebokolo/wordstack/core/events/StackDeleteCalledEvent.java | 1f83e7b026875ba9463ffae91a184c1ca25d99b4 | [] | no_license | apricoder/WordStack | d023e4d284a447721d79223494c9e76ab0e19885 | e49c6196359e516b778ea32a53e0aa0dd30f7437 | refs/heads/master | 2022-05-24T11:11:38.968194 | 2017-04-07T20:46:50 | 2017-04-07T20:46:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package com.olebokolo.wordstack.core.events;
import com.olebokolo.wordstack.core.model.Stack;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@AllArgsConstructor(suppressConstructorProperties = true)
@EqualsAndHashCode(callSuper = true)
public class StackDeleteCalledEvent extends BaseStackEvent {
private Stack stack;
}
| [
"[email protected]"
] | |
541949c7b226a432f96c176db09744c88f9dc35f | f3b1219424deda912dad4bfaab810ed3d2dfcd64 | /sitech-strategy-main/sitech-strategy-recommend/src/main/java/com/sitech/strategy/recommend/base/.svn/text-base/BaseClass.java.svn-base | 376b0279db123bc5a1bc0d1d155a47b72a786d0a | [] | no_license | apollochen123/myPersonalworkspace | 9cc47100eb4a7c31940261961f28962ddde27000 | 56cbf5593a53b0d1ab67dd8767b186517c24a600 | refs/heads/master | 2021-08-30T01:26:06.993935 | 2017-12-15T14:30:20 | 2017-12-15T14:30:20 | 97,134,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | package com.sitech.strategy.recommend.base;
import com.sitech.strategy.common.utils.LogSlf4jUtil;
import com.sitech.strategy.common.utils.LogUtil;
/**
* 推荐中心基类
* @date: 2016-9-5
* @author: sunliang
* @title: BaseClass
* @version: 1.0
* @description:
* update_version: update_date: update_author: update_note:
*/
public class BaseClass {
/**
* 日志工具对象
*/
protected LogUtil log = new LogUtil(this.getClass());
//protected LogSlf4jUtil log = new LogSlf4jUtil(this.getClass());
}
| [
"[email protected]"
] | ||
ef556ac483055e211d2d688a2a8cef88a14a7d6f | 5034c8d7fe79b0c5855791fd6674bcd899f22d9d | /eureka_client_node_three/src/main/java/com/company/web/controller/controller/AddController.java | 17f2676b4b400e16e780c3557c41d31dcb884087 | [] | no_license | qingw/cloud-demo | 00fe5ca3397ceae3515abcd4d919df9ad8d5d784 | 0a73c4619b9307290bfbcb3235378a27670da1ee | refs/heads/master | 2021-01-15T12:37:31.602717 | 2017-02-07T12:30:21 | 2017-02-07T12:30:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,499 | java | package com.company.web.controller.controller;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
*/
@RestController
public class AddController {
private final Logger logger = Logger.getLogger(getClass());
@Autowired
private DiscoveryClient discoveryClient;
/**
* 计算服务
* @param a
* @param b
* @return
*/
@RequestMapping(value = "/add" ,method = RequestMethod.GET)
public String add(@RequestParam Integer a, @RequestParam Integer b) {
ServiceInstance instance = discoveryClient.getLocalServiceInstance();
Integer result = a + b;
logger.info("host:" + instance.getHost() + ",端口"+instance.getPort()+" service_id:" + instance.getServiceId() + ", result:" + result+",实例元数据:"+instance.getMetadata());
String infos = "当前响应的服务实例主机:"+instance.getHost()+",端口"+instance.getPort()+", 实例的ID:"+instance.getServiceId()+",实例元数据:"+instance.getMetadata()
+" 计算结果:"+result;
return infos ;
}
}
| [
"[email protected]"
] | |
44e501ce8c02c120a1cc36372b1d24b38ed92d71 | d41be80cccafe633ba382fcb0734758c13be1e73 | /knowledge-store-parent/java-backend-module/src/main/java/com/exception/GenericException.java | 39682f6819c35a1e56d6fd8158b4fd0c457ebf88 | [] | no_license | anshulatasingh/Knowledge-store | d4d7ee746a40d4f87ac3b96a163f104cabaaa13a | 2b131a54b0f6babc4ccad778bfda810c8eeba318 | refs/heads/master | 2021-01-22T11:10:45.090365 | 2017-07-03T05:45:45 | 2017-07-03T05:45:45 | 92,674,036 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.exception;
public class GenericException extends RuntimeException{
/**
*
*/
private static final long serialVersionUID = 1L;
public GenericException(){
super();
}
public GenericException(String classname, String message, Throwable thr){
super(classname+" : "+message,thr);
}
public GenericException(String classname, String message){
super(classname+" : "+message);
}
public GenericException(String className,Throwable th){
super(className,th);
}
}
| [
"[email protected]"
] | |
fe8e5bb1c5fd11cd445078fe18d5f81a8b8a994c | 219b6bad8eafe89a5a800245d9e0e8f0a8ecee80 | /app/src/main/java/com/hbl/sandbox1/RetroListFragment.java | ee171595ebf920778bdbd5e54e83ae96a20bccc0 | [] | no_license | masterofpun-HBL/Sandbox1 | 36d98c8dd6cdc32394d66c0ce0795f1da4d6c339 | ca88ceaf7250354b51cc55a8d1077034503246fd | refs/heads/master | 2021-01-19T00:28:03.144018 | 2017-04-04T12:40:16 | 2017-04-04T12:40:16 | 87,172,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,519 | java | package com.hbl.sandbox1;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.hbl.sandbox1.models.BannersWrapper;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;
public class RetroListFragment extends Fragment {
String baseUrl = "http://www.nutrients-supplements.com";
BannerListAdapter adapter;
public RetroListFragment() {
// Required empty public constructor
}
public static RetroListFragment newInstance() {
return new RetroListFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View itemView = inflater.inflate(R.layout.fragment_retro_list, container, false);
final RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(baseUrl).build();
NuSupAPI nuSupAPI = restAdapter.create(NuSupAPI.class);
final RecyclerView bannerListView = (RecyclerView) itemView.findViewById(R.id.tab1);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
bannerListView.setHasFixedSize(true);
bannerListView.setLayoutManager(layoutManager);
adapter = new BannerListAdapter();
bannerListView.setAdapter(adapter);
nuSupAPI.getBanners(new Callback<BannersWrapper>() {
@Override
public void success(BannersWrapper bannersWrapper, Response response) {
Log.d("retro", "done " + bannersWrapper.getBanners());
adapter.addBanners(bannersWrapper.getBanners());
adapter.notifyDataSetChanged();
}
@Override
public void failure(RetrofitError error) {
Log.d("retro", "fail" + error.getLocalizedMessage());
}
});
return itemView;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onDetach() {
super.onDetach();
}
}
| [
"[email protected]"
] | |
88771aabcdf884efe0a36257533553727cc72a4d | 6556a69b9e020c17309a3bd1c50eeb2e14a5c098 | /gps/map/src/sasha/offline/info/Edge.java | a0a447eb7e437bb851b31b5b581d892cbd0a6270 | [] | no_license | tomkek/projects | 4dd4798fda72638dc3ff511cb07e63dca72025a4 | ab0ab86f823ee500b4cab9c06e220bebcdc88354 | refs/heads/master | 2020-04-04T12:06:01.526688 | 2014-07-10T10:51:40 | 2014-07-10T10:51:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package sasha.offline.info;
public class Edge {
private long startPoint;
private long endPoint;
private double weight;
public long getStart(){
return startPoint;
}
public long getEnd(){
return endPoint;
}
public void setStart(long newId){
startPoint = newId;
}
public void setEnd(long newId){
endPoint = newId;
}
public double getWeight(){
return weight;
}
public void setWeight(double newWeight){
weight = newWeight;
}
public Edge(){
long startPoint = 0;
long endPoint = 0;
double weight = 0;
}
}
| [
"[email protected],se"
] | |
00614abb5dee7f2ae150d3f3480dc66356eb76c1 | 1a7d0ccab7a221e94cdb941ec3f0190f1d18f973 | /GIt/SpringBoot_Secure/src/main/java/com/boot/RestWithSpringBoot/security/ResourceServerConfiguration.java | 4dfd9858e8f4f2013d59c667c1122bdd8850d93d | [] | no_license | ashish097/Spring-Boot-Projects | 3800e266ba17930f824c0a582cc5a02a85562e18 | 06345a30c45911d80430817d1968cbf555307411 | refs/heads/master | 2020-03-26T21:09:57.587915 | 2018-08-20T05:47:12 | 2018-08-20T05:47:12 | 145,370,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,288 | java | package com.boot.RestWithSpringBoot.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
@Configuration
@EnableResourceServer
public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
private static final String RESOURCE_ID = "my_rest_api";
@Override
public void configure(ResourceServerSecurityConfigurer resources) {
resources.resourceId(RESOURCE_ID).stateless(false);
}
@Override
public void configure(HttpSecurity http) throws Exception {
http.
anonymous().disable()
.requestMatchers()
.antMatchers("/packages/**")
.and()
.authorizeRequests()
.antMatchers("/packages/**")
.access("hasRole('ADMIN')")
.and().exceptionHandling().accessDeniedHandler(new OAuth2AccessDeniedHandler());
}
} | [
"[email protected]"
] | |
43bb6bcb882e9eb68a2a132f6e96007abfdc42d9 | 5aa497634a2fbe6b3d3f2df3d532ba584f3e4334 | /src/day07/Ex04.java | 4fb846627b7a2d55db1729c2d9353f505aa61019 | [] | no_license | ladieslog/day07 | 6c836fe66f5a5a5cd50f00068744f3082e0e121e | 3d867ec11f702f0387ac33d1b8eef5001a6d6475 | refs/heads/master | 2023-06-29T22:26:43.344376 | 2021-08-02T04:39:17 | 2021-08-02T04:39:17 | 391,770,301 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 535 | java | package day07;
import java.util.ArrayList;
import java.util.Scanner;
public class Ex04 {
public static void main(String[] args) {
Scanner input =new Scanner(System.in);
ArrayList food =new ArrayList();
food.add("설탕");
food.add("소금");
food.add("라면");
food.add("계란");
System.out.println(food);
System.out.println("찾을 값 입력: ");
String n=input.next();
System.out.println(n+" 위치 : "+food.indexOf(n));
System.out.println(food);
food.set(2, "당근");
System.out.println(food);
}
}
| [
"[email protected]"
] | |
9c097982b34fd76d68925c6e6a663ceb0b16ff38 | bbf526bca24e395fcc87ef627f6c196d30a1844f | /longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/Solution.java | 4fd363f957bb21f105a5ffe54b9b8866da7b3845 | [] | no_license | charles-wangkai/leetcode | 864e39505b230ec056e9b4fed3bb5bcb62c84f0f | 778c16f6cbd69c0ef6ccab9780c102b40731aaf8 | refs/heads/master | 2023-08-31T14:44:52.850805 | 2023-08-31T03:04:02 | 2023-08-31T03:04:02 | 25,644,039 | 52 | 18 | null | 2021-06-05T00:02:50 | 2014-10-23T15:29:44 | Java | UTF-8 | Java | false | false | 795 | java | import java.util.SortedMap;
import java.util.TreeMap;
class Solution {
public int longestSubarray(int[] nums, int limit) {
int result = 0;
SortedMap<Integer, Integer> valueToCount = new TreeMap<>();
int beginIndex = 0;
for (int endIndex = 0; endIndex < nums.length; ++endIndex) {
valueToCount.put(nums[endIndex], valueToCount.getOrDefault(nums[endIndex], 0) + 1);
while (valueToCount.lastKey() - valueToCount.firstKey() > limit) {
valueToCount.put(nums[beginIndex], valueToCount.get(nums[beginIndex]) - 1);
valueToCount.remove(nums[beginIndex], 0);
++beginIndex;
}
result = Math.max(result, endIndex - beginIndex + 1);
}
return result;
}
} | [
"[email protected]"
] | |
9be7babd996194b9df7c458e0a143775017de332 | a7da47a2032dc6a58517598a348787c2a463b6f0 | /Windsor/src/visibiltyTwo/v4.java | 4a34032f635d336411b124ddc5a66bffad598d7f | [] | no_license | alvinmukiibi/college_java_projects | f86f4d147dc6f4a72c3a676a936e424daa5b27f0 | fa2d88092aae6368b84a6558416902f5c76796ab | refs/heads/master | 2020-09-27T09:55:02.733806 | 2019-12-07T10:06:01 | 2019-12-07T10:06:01 | 226,490,301 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package visibiltyTwo;
/**
*
* @author ALVIN
*/
public class v4 {
public static void main(String args[])
{
visibility.v1 obj = new visibility.v1();
obj.sayHello();
//obj.sayHi(); //this method is protected so it cant be accessed from a different package of u are not a subclass
}
}
| [
"[email protected]"
] | |
49cfe3dba1fc35852424650ae216cf46967c7fb7 | dc0afaa5b63e1bf4ee195fa1bf56629a32d8d57a | /java/spring/first-drools/my-app/src/main/java/test/generated/tables/AirbusJobResultInfo.java | 7e21befa8d19591c98444a87dc5c072209bb9122 | [] | no_license | btpka3/btpka3.github.com | 370e6954af485bd6aee35fa5944007aab131e416 | e5435d201641a2f21c632a28eae5ef408d2e799c | refs/heads/master | 2023-08-23T18:37:31.643843 | 2023-08-16T11:48:38 | 2023-08-16T11:48:38 | 8,571,000 | 19 | 19 | null | 2021-04-12T10:01:13 | 2013-03-05T03:08:08 | Java | UTF-8 | Java | false | true | 9,373 | java | /*
* This file is generated by jOOQ.
*/
package test.generated.tables;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.TableImpl;
import org.jooq.types.ULong;
import test.generated.Indexes;
import test.generated.Keys;
import test.generated.SmetaApp;
import test.generated.tables.records.AirbusJobResultInfoRecord;
/**
* 基于odps的instance
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.5"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class AirbusJobResultInfo extends TableImpl<AirbusJobResultInfoRecord> {
private static final long serialVersionUID = 1865371615;
/**
* The reference instance of <code>SMETA_APP.airbus_job_result_info</code>
*/
public static final AirbusJobResultInfo AIRBUS_JOB_RESULT_INFO = new AirbusJobResultInfo();
/**
* The class holding records for this type
*/
@Override
public Class<AirbusJobResultInfoRecord> getRecordType() {
return AirbusJobResultInfoRecord.class;
}
/**
* The column <code>SMETA_APP.airbus_job_result_info.id</code>. 主键
*/
public final TableField<AirbusJobResultInfoRecord, ULong> ID = createField("id", org.jooq.impl.SQLDataType.BIGINTUNSIGNED.nullable(false).identity(true), this, "主键");
/**
* The column <code>SMETA_APP.airbus_job_result_info.gmt_create</code>. 创建时间
*/
public final TableField<AirbusJobResultInfoRecord, Timestamp> GMT_CREATE = createField("gmt_create", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false), this, "创建时间");
/**
* The column <code>SMETA_APP.airbus_job_result_info.gmt_modified</code>. 修改时间
*/
public final TableField<AirbusJobResultInfoRecord, Timestamp> GMT_MODIFIED = createField("gmt_modified", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false), this, "修改时间");
/**
* The column <code>SMETA_APP.airbus_job_result_info.no</code>. 序号
*/
public final TableField<AirbusJobResultInfoRecord, String> NO = createField("no", org.jooq.impl.SQLDataType.VARCHAR(1024), this, "序号");
/**
* The column <code>SMETA_APP.airbus_job_result_info.sic_result_table_partition</code>. 分区
*/
public final TableField<AirbusJobResultInfoRecord, String> SIC_RESULT_TABLE_PARTITION = createField("sic_result_table_partition", org.jooq.impl.SQLDataType.VARCHAR(128), this, "分区");
/**
* The column <code>SMETA_APP.airbus_job_result_info.status</code>. 状态
*/
public final TableField<AirbusJobResultInfoRecord, String> STATUS = createField("status", org.jooq.impl.SQLDataType.VARCHAR(10), this, "状态");
/**
* The column <code>SMETA_APP.airbus_job_result_info.release_job_id</code>. 对应的job id
*/
public final TableField<AirbusJobResultInfoRecord, ULong> RELEASE_JOB_ID = createField("release_job_id", org.jooq.impl.SQLDataType.BIGINTUNSIGNED.nullable(false), this, "对应的job id");
/**
* The column <code>SMETA_APP.airbus_job_result_info.sic_result_table</code>. 结果表名
*/
public final TableField<AirbusJobResultInfoRecord, String> SIC_RESULT_TABLE = createField("sic_result_table", org.jooq.impl.SQLDataType.VARCHAR(512), this, "结果表名");
/**
* The column <code>SMETA_APP.airbus_job_result_info.sic_calc_code</code>. 计算编码
*/
public final TableField<AirbusJobResultInfoRecord, String> SIC_CALC_CODE = createField("sic_calc_code", org.jooq.impl.SQLDataType.VARCHAR(50), this, "计算编码");
/**
* The column <code>SMETA_APP.airbus_job_result_info.creator</code>. instance创建者
*/
public final TableField<AirbusJobResultInfoRecord, String> CREATOR = createField("creator", org.jooq.impl.SQLDataType.VARCHAR(512), this, "instance创建者");
/**
* The column <code>SMETA_APP.airbus_job_result_info.begin_time</code>. 开始时间
*/
public final TableField<AirbusJobResultInfoRecord, Timestamp> BEGIN_TIME = createField("begin_time", org.jooq.impl.SQLDataType.TIMESTAMP, this, "开始时间");
/**
* The column <code>SMETA_APP.airbus_job_result_info.end_time</code>. 结束时间
*/
public final TableField<AirbusJobResultInfoRecord, Timestamp> END_TIME = createField("end_time", org.jooq.impl.SQLDataType.TIMESTAMP, this, "结束时间");
/**
* The column <code>SMETA_APP.airbus_job_result_info.cost_time</code>. 执行时长
*/
public final TableField<AirbusJobResultInfoRecord, Long> COST_TIME = createField("cost_time", org.jooq.impl.SQLDataType.BIGINT, this, "执行时长");
/**
* The column <code>SMETA_APP.airbus_job_result_info.operator</code>. 执行人
*/
public final TableField<AirbusJobResultInfoRecord, String> OPERATOR = createField("operator", org.jooq.impl.SQLDataType.VARCHAR(20), this, "执行人");
/**
* The column <code>SMETA_APP.airbus_job_result_info.handle_count</code>. 处理量
*/
public final TableField<AirbusJobResultInfoRecord, Long> HANDLE_COUNT = createField("handle_count", org.jooq.impl.SQLDataType.BIGINT, this, "处理量");
/**
* The column <code>SMETA_APP.airbus_job_result_info.hit_count</code>. 命中量
*/
public final TableField<AirbusJobResultInfoRecord, Long> HIT_COUNT = createField("hit_count", org.jooq.impl.SQLDataType.BIGINT, this, "命中量");
/**
* The column <code>SMETA_APP.airbus_job_result_info.uf_rule_id</code>. 规则id
*/
public final TableField<AirbusJobResultInfoRecord, Long> UF_RULE_ID = createField("uf_rule_id", org.jooq.impl.SQLDataType.BIGINT, this, "规则id");
/**
* The column <code>SMETA_APP.airbus_job_result_info.uf_rule_set_id</code>. 规则集id
*/
public final TableField<AirbusJobResultInfoRecord, Long> UF_RULE_SET_ID = createField("uf_rule_set_id", org.jooq.impl.SQLDataType.BIGINT, this, "规则集id");
/**
* The column <code>SMETA_APP.airbus_job_result_info.sic_stats_table</code>. 原始表名
*/
public final TableField<AirbusJobResultInfoRecord, String> SIC_STATS_TABLE = createField("sic_stats_table", org.jooq.impl.SQLDataType.VARCHAR(512), this, "原始表名");
/**
* The column <code>SMETA_APP.airbus_job_result_info.schedule_type</code>. 任务类型
*/
public final TableField<AirbusJobResultInfoRecord, Short> SCHEDULE_TYPE = createField("schedule_type", org.jooq.impl.SQLDataType.SMALLINT, this, "任务类型");
/**
* Create a <code>SMETA_APP.airbus_job_result_info</code> table reference
*/
public AirbusJobResultInfo() {
this(DSL.name("airbus_job_result_info"), null);
}
/**
* Create an aliased <code>SMETA_APP.airbus_job_result_info</code> table reference
*/
public AirbusJobResultInfo(String alias) {
this(DSL.name(alias), AIRBUS_JOB_RESULT_INFO);
}
/**
* Create an aliased <code>SMETA_APP.airbus_job_result_info</code> table reference
*/
public AirbusJobResultInfo(Name alias) {
this(alias, AIRBUS_JOB_RESULT_INFO);
}
private AirbusJobResultInfo(Name alias, Table<AirbusJobResultInfoRecord> aliased) {
this(alias, aliased, null);
}
private AirbusJobResultInfo(Name alias, Table<AirbusJobResultInfoRecord> aliased, Field<?>[] parameters) {
super(alias, null, aliased, parameters, "基于odps的instance");
}
/**
* {@inheritDoc}
*/
@Override
public Schema getSchema() {
return SmetaApp.SMETA_APP;
}
/**
* {@inheritDoc}
*/
@Override
public List<Index> getIndexes() {
return Arrays.<Index>asList(Indexes.AIRBUS_JOB_RESULT_INFO_IDX_RELEASE_JOB_ID, Indexes.AIRBUS_JOB_RESULT_INFO_PRIMARY);
}
/**
* {@inheritDoc}
*/
@Override
public Identity<AirbusJobResultInfoRecord, ULong> getIdentity() {
return Keys.IDENTITY_AIRBUS_JOB_RESULT_INFO;
}
/**
* {@inheritDoc}
*/
@Override
public UniqueKey<AirbusJobResultInfoRecord> getPrimaryKey() {
return Keys.KEY_AIRBUS_JOB_RESULT_INFO_PRIMARY;
}
/**
* {@inheritDoc}
*/
@Override
public List<UniqueKey<AirbusJobResultInfoRecord>> getKeys() {
return Arrays.<UniqueKey<AirbusJobResultInfoRecord>>asList(Keys.KEY_AIRBUS_JOB_RESULT_INFO_PRIMARY);
}
/**
* {@inheritDoc}
*/
@Override
public AirbusJobResultInfo as(String alias) {
return new AirbusJobResultInfo(DSL.name(alias), this);
}
/**
* {@inheritDoc}
*/
@Override
public AirbusJobResultInfo as(Name alias) {
return new AirbusJobResultInfo(alias, this);
}
/**
* Rename this table
*/
@Override
public AirbusJobResultInfo rename(String name) {
return new AirbusJobResultInfo(DSL.name(name), null);
}
/**
* Rename this table
*/
@Override
public AirbusJobResultInfo rename(Name name) {
return new AirbusJobResultInfo(name, null);
}
}
| [
"[email protected]"
] | |
2119b65d73811174304d1e80771dbfadc230d4f1 | 1f513fcf30bbda468cfef3459ad55a9be25bb081 | /vkefu03/src/main/java/com/yxm/web/entity/agent/Agent.java | 7f68d8babda1c57831024566541f3bddd85b2677 | [] | no_license | startshineye/vkefu | 146cfef97f8af8d709d6e613afc58c5d6ee67237 | ab77cab23756439213b35d6f5e8bd45a50c86aab | refs/heads/master | 2021-03-19T06:20:33.513625 | 2017-10-29T15:50:43 | 2017-10-29T15:50:43 | 105,330,224 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,619 | java | package com.yxm.web.entity.agent;
/**
* 坐席
* @author yxm
* @date 2017-6-12
*/
public class Agent{
private String agentId;//坐席工号
private String agentName;//姓名
private String loginTime;// 登陆时间
private String status;// 当前状态
private String login;//登录与否(on:登录 off:注销)
private String groups;// 技能组
private Integer serUsernum;//坐席当前服务数量
private Integer maxUsers;//坐席最大服务数量
private Integer entId;//企业Id
public String getAgentId() {
return agentId;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public String getLoginTime() {
return loginTime;
}
public void setLoginTime(String loginTime) {
this.loginTime = loginTime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getGroups() {
return groups;
}
public void setGroups(String groups) {
this.groups = groups;
}
public Integer getSerUsernum() {
return serUsernum;
}
public void setSerUsernum(Integer serUsernum) {
this.serUsernum = serUsernum;
}
public Integer getMaxUsers() {
return maxUsers;
}
public void setMaxUsers(Integer maxUsers) {
this.maxUsers = maxUsers;
}
public Integer getEntId() {
return entId;
}
public void setEntId(Integer entId) {
this.entId = entId;
}
}
| [
"[email protected]"
] | |
63d23e45e1e7a081c745d437104fbc57bf28bfb3 | 09bee98e15ee80879d6cc5004827c40d1fe463c5 | /app/src/test/java/com/example/desy/todoapp/ExampleUnitTest.java | 44f0f910f34c38941958a0725548057d1ee2591a | [
"Apache-2.0"
] | permissive | desyoo/ToDoApp_Project | e23f6ccf539eaf5308b273e881f582a2253857c4 | e3615241baf0fb132a4a27eee79a7fecd9009207 | refs/heads/master | 2020-12-04T12:43:35.317532 | 2016-09-28T00:15:47 | 2016-09-28T00:15:49 | 67,841,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.example.desy.todoapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
0a881d650ca606b16a8ddeb070e9534d830019eb | d5e65d9bf89da249f66faba1d441abd07d05a8ed | /upaas/common/src/main/java/one/ulord/upaas/common/api/APIResult.java | 49ba5851716c08ab2ef009782db9b3fbf2f50e52 | [
"MIT"
] | permissive | UlordChain/Ulord-platform | de39b877ca6ff8885c170c461b1188422ba67be2 | 04ae23155373c13d68e984308e44bd40878a7eb8 | refs/heads/master | 2021-05-26T08:03:09.528299 | 2019-02-01T06:42:56 | 2019-02-01T06:42:56 | 128,003,018 | 28 | 4 | MIT | 2018-12-30T08:16:58 | 2018-04-04T03:40:12 | JavaScript | UTF-8 | Java | false | false | 2,044 | java | /**
* Copyright(c) 2018
* Ulord core developers
*/
package one.ulord.upaas.common.api;
import one.ulord.upaas.common.UPaaSErrorCode;
/**
* API Result
* @author haibo
* @since 5/26/18
*/
public class APIResult {
private int errorcode;
private String reason;
private Object result;
public int getErrorcode() {
return errorcode;
}
public void setErrorcode(int errorcode) {
this.errorcode = errorcode;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
/**
* Build a error result
* @param errorCode error code
* @param reason error message
* @return 消息对象
*/
public static APIResult buildError(int errorCode, String reason){
APIResult result = new APIResult();
result.setErrorcode(errorCode);
result.setReason(reason);
return result;
}
/**
* 通过异常构建一个错误对象(服务异常)
* @param e 异常对象
* @return
*/
public static APIResult buildError(Exception e){
return buildError(UPaaSErrorCode.SYSERR_SERVER_EXCEPTION,
"Service exception, please retry. More detail is:" + e.getMessage());
}
/**
* 构建一个正确返回值对象
* @param result 消息结果对象
* @param reason 消息提示信息
* @return 消息对象
*/
public static APIResult buildResult(Object result, String reason){
APIResult r = new APIResult();
r.setResult(result);
r.setErrorcode(UPaaSErrorCode.SUCCESS);
return r;
}
/**
* 构建一个正确返回值对象
* @param result 消息结果对象
* @return 消息对象
*/
public static APIResult buildResult(Object result){
return buildResult(result, "");
}
}
| [
"[email protected]"
] | |
b53238727377b25e9de139648647bfbb90885db1 | 696aa05ec959063d58807051902d8e2c48a989b9 | /ole-app/olefs/src/main/java/org/kuali/ole/coa/document/web/OrgDerivedValuesSetter.java | 0b7170fc982156de27ce58443c7e0e320d98ac59 | [] | no_license | sheiksalahudeen/ole-30-sprint-14-intermediate | 3e8bcd647241eeb741d7a15ff9aef72f8ad34b33 | 2aef659b37628bd577e37077f42684e0977e1d43 | refs/heads/master | 2023-01-09T00:59:02.123787 | 2017-01-26T06:09:02 | 2017-01-26T06:09:02 | 80,089,548 | 0 | 0 | null | 2023-01-02T22:05:38 | 2017-01-26T05:47:58 | PLSQL | UTF-8 | Java | false | false | 2,874 | java | /*
* Copyright 2007-2009 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* 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.kuali.ole.coa.document.web;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.kuali.ole.coa.businessobject.Organization;
import org.kuali.ole.sys.context.SpringContext;
import org.kuali.rice.kns.document.MaintenanceDocumentBase;
import org.kuali.rice.kns.web.derivedvaluesetter.DerivedValuesSetter;
import org.kuali.rice.kns.web.struts.form.KualiForm;
import org.kuali.rice.kns.web.struts.form.KualiMaintenanceForm;
import org.kuali.rice.krad.util.KRADConstants;
import org.kuali.rice.krad.util.ObjectUtils;
import org.kuali.rice.location.api.postalcode.PostalCode;
import org.kuali.rice.location.api.postalcode.PostalCodeService;
/**
* This is a description of what this class does - wliang don't forget to fill this in.
*
* @author Kuali Rice Team ([email protected])
*
*/
public class OrgDerivedValuesSetter implements DerivedValuesSetter {
public void setDerivedValues(KualiForm form, HttpServletRequest request){
KualiMaintenanceForm maintenanceForm = (KualiMaintenanceForm) form;
MaintenanceDocumentBase maintenanceDocument = (MaintenanceDocumentBase) maintenanceForm.getDocument();
Organization newOrg = (Organization) maintenanceDocument.getNewMaintainableObject().getBusinessObject();
String organizationZipCode = newOrg.getOrganizationZipCode();
String organizationCountryCode = newOrg.getOrganizationCountryCode();
if (StringUtils.isNotBlank(organizationZipCode) && StringUtils.isNotBlank(organizationCountryCode)) {
PostalCode postalZipCode = SpringContext.getBean(PostalCodeService.class).getPostalCode(organizationCountryCode, organizationZipCode);
if (ObjectUtils.isNotNull(postalZipCode)) {
newOrg.setOrganizationCityName(postalZipCode.getCityName());
newOrg.setOrganizationStateCode(postalZipCode.getStateCode());
}
else {
newOrg.setOrganizationCityName(KRADConstants.EMPTY_STRING);
newOrg.setOrganizationStateCode(KRADConstants.EMPTY_STRING);
}
}
else {
newOrg.setOrganizationCityName(KRADConstants.EMPTY_STRING);
newOrg.setOrganizationStateCode(KRADConstants.EMPTY_STRING);
}
}
}
| [
"[email protected]"
] | |
c3bae7895f239453162ad963d0f4b482f8234623 | 36bd08b7bc9c9f585bbc3277f6f99c3a9c2df4ce | /FengYeApp/src/com/alan/fengye/bean/PersonalCenterAttentionDrawboardCellData.java | bbf62abc1def64ddc280ef8d38dde59f8f00aae2 | [] | no_license | Alan-GitHub/FengYe-Backend | ab3cdcf4b470c52d886219fc1141864259e315cf | 3e221859a8e08b8d731aaa592745d1e14ccb1e2c | refs/heads/master | 2020-03-15T12:35:18.557595 | 2018-06-11T14:52:25 | 2018-06-11T14:52:25 | 132,147,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,192 | java | package com.alan.fengye.bean;
public class PersonalCenterAttentionDrawboardCellData {
private String coverImageURL;
private int coverImageWidth;
private int coverImageHeight;
private String drawboardName;
private String descriptionText;
private String ownerHeadIcon;
private String ownerUserName;
private int picNums;
private int attentionNum;
public PersonalCenterAttentionDrawboardCellData() {
this.coverImageURL = "";
this.coverImageWidth = 0;
this.coverImageHeight = 0;
this.ownerUserName = "";
this.drawboardName = "";
this.descriptionText = "";
this.ownerHeadIcon = "";
this.picNums = 0;
this.attentionNum = 0;
}
//method
public String getCoverImageURL() {
return this.coverImageURL;
}
public void setCoverImageURL(String imageURL) {
this.coverImageURL = imageURL;
}
public int getCoverImageWidth() {
return this.coverImageWidth;
}
public void setCoverImageWidth(int coverImageWidth) {
this.coverImageWidth = coverImageWidth;
}
public int getCoverImageHeight() {
return this.coverImageHeight;
}
public void setCoverImageHeight(int coverImageHeight) {
this.coverImageHeight = coverImageHeight;
}
public String getOwnerUserName() {
return this.ownerUserName;
}
public void setOwnerUserName(String ownerUserName) {
this.ownerUserName = ownerUserName;
}
public String getDrawboardName() {
return this.drawboardName;
}
public void setDrawboardName(String drawboardName) {
this.drawboardName = drawboardName;
}
public String getDescriptionText() {
return this.descriptionText;
}
public void setDescriptionText(String descriptionText) {
this.descriptionText = descriptionText;
}
public String getOwnerHeadIcon() {
return this.ownerHeadIcon;
}
public void setOwnerHeadIcon(String ownerHeadIcon) {
this.ownerHeadIcon = ownerHeadIcon;
}
public int getPicNums() {
return this.picNums;
}
public void setPicNums(int picNums) {
this.picNums = picNums;
}
public int getAttentionNum() {
return this.attentionNum;
}
public void setAttentionNum(int attentionNum) {
this.attentionNum = attentionNum;
}
}
| [
"[email protected]"
] | |
5bc4bd8d13285d378d551b40a507e78711bfe311 | 8d1c7fba7cd15f8a1e33fd27d11eefd1c67d579f | /src/test/java/com/google/devtools/build/lib/skyframe/rewinding/RewindingTest.java | af201a58e36c8154decf64c9426c3d7adbeeeed1 | [
"Apache-2.0"
] | permissive | bazelbuild/bazel | 5896162455f032efc899b8de60aa39b9d2cad4a6 | 171aae3f9c57b41089e25ec61fc84c35baa3079d | refs/heads/master | 2023-08-22T22:52:48.714735 | 2023-08-22T18:01:53 | 2023-08-22T18:01:53 | 20,773,773 | 20,294 | 4,383 | Apache-2.0 | 2023-09-14T18:38:44 | 2014-06-12T16:00:38 | Java | UTF-8 | Java | false | false | 7,466 | java | // Copyright 2022 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.skyframe.rewinding;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.TruthJUnit.assume;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.util.AnalysisMock;
import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase;
import com.google.devtools.build.lib.includescanning.IncludeScanningModule;
import com.google.devtools.build.lib.runtime.BlazeRuntime;
import com.google.devtools.build.lib.testutil.ActionEventRecorder;
import com.google.testing.junit.testparameterinjector.TestParameter;
import com.google.testing.junit.testparameterinjector.TestParameterInjector;
import org.junit.Test;
import org.junit.runner.RunWith;
/** Tests for action rewinding on non-incremental builds. */
// TODO(b/228090759): Add back actionFromPreviousBuildReevaluated when incrementality is supported.
@RunWith(TestParameterInjector.class)
public final class RewindingTest extends BuildIntegrationTestCase {
@TestParameter private boolean keepGoing;
private final ActionEventRecorder actionEventRecorder = new ActionEventRecorder();
private final RewindingTestsHelper helper = new RewindingTestsHelper(this, actionEventRecorder);
@Override
protected BlazeRuntime.Builder getRuntimeBuilder() throws Exception {
return super.getRuntimeBuilder()
.addBlazeModule(new IncludeScanningModule())
.addBlazeModule(helper.makeControllableActionStrategyModule("standalone"));
}
@Override
protected void setupOptions() throws Exception {
super.setupOptions();
addOptions(
"--spawn_strategy=standalone",
"--notrack_incremental_state",
"--nouse_action_cache",
"--rewind_lost_inputs",
"--features=cc_include_scanning",
"--experimental_remote_include_extraction_size_threshold=0",
"--keep_going=" + keepGoing);
runtimeWrapper.registerSubscriber(actionEventRecorder);
// Tell Skyframe to ignore RepositoryHelpersHolder so that we don't trigger
// RepoMappingManifestAction to preserve the expected order of Actions.
this.getSkyframeExecutor().ignoreRepositoryHelpersHolderForTesting();
}
/**
* Skips test cases that cannot run with bazel.
*
* <p>{@link BuildIntegrationTestCase} currently does not support CPP compilation on bazel.
*/
// TODO(b/195425240): Remove once CPP compilation on bazel is supported. Assumptions that
// generated headers are always under k8-opt will need to be relaxed to support other platforms.
private static void skipIfBazel() {
assume().that(AnalysisMock.get().isThisBazel()).isFalse();
}
@Test
public void noLossSmokeTest() throws Exception {
helper.runNoLossSmokeTest();
}
@Test
public void buildingParentFoundUndoneChildNotToleratedWithoutRewinding() throws Exception {
helper.runBuildingParentFoundUndoneChildNotToleratedWithoutRewinding();
}
@Test
public void dependentActionsReevaluated() throws Exception {
helper.runDependentActionsReevaluated_spawnFailed();
}
@Test
public void multipleLostInputsForRewindPlan() throws Exception {
helper.runMultipleLostInputsForRewindPlan();
}
@Test
public void multiplyLosingInputsFails() throws Exception {
helper.runMultiplyLosingInputsFails();
assertOutputForRule2NotCreated();
}
@Test
public void interruptedDuringRewindStopsNormally() throws Exception {
helper.runInterruptedDuringRewindStopsNormally();
assertOutputForRule2NotCreated();
}
@Test
public void failureDuringRewindStopsNormally() throws Exception {
helper.runFailureDuringRewindStopsNormally();
assertOutputForRule2NotCreated();
}
/**
* Because this test infrastructure allows builds to write outputs to the filesystem, these
* "fail"/"stops normally" tests can assert that the build's output file was not written.
*/
private void assertOutputForRule2NotCreated() throws Exception {
Artifact output =
Iterables.getOnlyElement(
getFilesToBuild(getExistingConfiguredTarget("//test:rule2")).toList());
assertThat(output.getPath().exists()).isFalse();
}
@Test
public void intermediateActionRewound() throws Exception {
helper.runIntermediateActionRewound();
}
@Test
public void chainOfActionsRewound() throws Exception {
helper.runChainOfActionsRewound();
}
@Test
public void nondeterministicActionRewound() throws Exception {
helper.runNondeterministicActionRewound();
}
@Test
public void parallelTrackSharedActionsRewound() throws Exception {
helper.runParallelTrackSharedActionsRewound();
}
@Test
public void treeFileArtifactRewound() throws Exception {
skipIfBazel();
helper.runTreeFileArtifactRewound_spawnFailed();
}
@Test
public void treeArtifactRewound_allFilesLost() throws Exception {
skipIfBazel();
helper.runTreeArtifactRewound_allFilesLost_spawnFailed();
}
@Test
public void treeArtifactRewound_oneFileLost() throws Exception {
skipIfBazel();
helper.runTreeArtifactRewound_oneFileLost_spawnFailed();
}
@Test
public void generatedRunfilesRewound_allFilesLost() throws Exception {
helper.runGeneratedRunfilesRewound_allFilesLost_spawnFailed();
}
@Test
public void generatedRunfilesRewound_oneFileLost() throws Exception {
helper.runGeneratedRunfilesRewound_oneFileLost_spawnFailed();
}
@Test
public void dupeDirectAndRunfilesDependencyRewound() throws Exception {
helper.runDupeDirectAndRunfilesDependencyRewound_spawnFailed();
}
@Test
public void treeInRunfilesRewound() throws Exception {
helper.runTreeInRunfilesRewound_spawnFailed();
}
@Test
public void inputsFromSameGeneratingActionSplitAmongNestedSetChildren() throws Exception {
helper.runInputsFromSameGeneratingActionSplitAmongNestedSetChildren();
}
@Test
public void generatedHeaderRewound_lostInInputDiscovery() throws Exception {
skipIfBazel();
helper.runGeneratedHeaderRewound_lostInInputDiscovery_spawnFailed();
}
@Test
public void generatedHeaderRewound_lostInActionExecution() throws Exception {
skipIfBazel();
helper.runGeneratedHeaderRewound_lostInActionExecution_spawnFailed();
}
@Test
public void generatedTransitiveHeaderRewound_lostInInputDiscovery() throws Exception {
skipIfBazel();
helper.runGeneratedTransitiveHeaderRewound_lostInInputDiscovery_spawnFailed();
}
@Test
public void generatedTransitiveHeaderRewound_lostInActionExecution() throws Exception {
skipIfBazel();
helper.runGeneratedTransitiveHeaderRewound_lostInActionExecution_spawnFailed();
}
@Test
public void doneToDirtyDepForNodeInError() throws Exception {
helper.runDoneToDirtyDepForNodeInError();
}
}
| [
"[email protected]"
] | |
e4eda0c8199cc56f98f65e4cfdd7f44b61e123b1 | 086401d50df124164bc8c914c1d5b0710a0effb4 | /jeecms/src/com/jeecms/cms/manager/assist/impl/CmsSiteFlowMngImpl.java | c8535c19c09f68fc9f1ce5f70a9f23d77824aa05 | [] | no_license | leoRui/jeecms | 2ba6453e8c4cfdec1b816a0d971e433c6964d97d | dcba632bd340f51beeaa761ebba614102d0f5282 | refs/heads/master | 2021-01-11T04:41:57.276283 | 2016-10-17T07:24:56 | 2016-10-17T07:24:56 | 71,110,852 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,962 | java | package com.jeecms.cms.manager.assist.impl;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeecms.cms.dao.assist.CmsSiteFlowDao;
import com.jeecms.cms.entity.assist.CmsSiteFlow;
import com.jeecms.cms.entity.main.CmsSite;
import com.jeecms.cms.manager.assist.CmsSiteFlowMng;
import com.jeecms.cms.statistic.FlowBean;
import com.jeecms.common.util.DateFormatUtils;
@Service
@Transactional
public class CmsSiteFlowMngImpl implements CmsSiteFlowMng {
public CmsSiteFlow save(CmsSite site, String ip, String page,
String sessionId) {
CmsSiteFlow cmsSiteFlow = new CmsSiteFlow();
Date now = new Timestamp(System.currentTimeMillis());
cmsSiteFlow.setSite(site);
cmsSiteFlow.setAccessIp(ip);
cmsSiteFlow.setAccessPage(page);
cmsSiteFlow.setAccessTime(now);
cmsSiteFlow.setAccessDate(DateFormatUtils.formatDate(now));
cmsSiteFlow.setSessionId(sessionId);
return dao.save(cmsSiteFlow);
}
@Transactional(readOnly = true)
public CmsSiteFlow findUniqueByProperties(Integer siteId,
String accessDate, String sessionId, String page) {
return dao.findUniqueByProperties(siteId, accessDate, sessionId, page);
}
@SuppressWarnings("unchecked")
public int freshCacheToDB(Ehcache cache) {
int count = 0;
List<String> list = cache.getKeys();
for (String uuid : list) {
Element element = cache.get(uuid);
if (element == null) {
return count;
}
CmsSiteFlow cmsSiteFlow = (CmsSiteFlow) element.getValue();
if (cmsSiteFlow.getId() == null
&& cmsSiteFlow.getSessionId() != null) {
dao.save(cmsSiteFlow);
}
}
return count;
}
@Autowired
private CmsSiteFlowDao dao;
}
| [
"Administrator@USERUSE-5P6AB6M"
] | Administrator@USERUSE-5P6AB6M |
21de0fd8e8dcc4b1b21458f665cfb73d6346d539 | 1df555a191e7599d2abd8ec6a74a15e85dca686b | /src/com/prediction/HMM/HMMState/State.java | 4597b806a589a10fee4786527d8e29c2ebb6e43f | [
"Apache-2.0"
] | permissive | mukeshjr/IDPrS | 0c1fcb87033c795ab43ea2dfecac0a5ba99e0625 | 9339cf950bc3f60fef624739ffae0709321c8edb | refs/heads/master | 2021-01-17T13:27:03.826321 | 2016-07-25T12:22:38 | 2016-07-25T12:22:43 | 55,954,006 | 0 | 0 | null | 2016-04-18T03:11:39 | 2016-04-11T08:15:09 | null | UTF-8 | Java | false | false | 741 | java | package com.prediction.HMM.HMMState;
import java.util.Iterator;
public class State extends StateComponent {
double pi;
int obsTypeNum;
double[] emissionProb;
public State(double pi, double[] emissionProb) {
this.pi = pi;
this.emissionProb = emissionProb;
this.obsTypeNum = emissionProb.length;
}
public void setPi(double pi) {
this.pi = pi;
}
public void setEmissionProb(double[] emissionProb) {
this.emissionProb = emissionProb;
}
public double getPi() {
return pi;
}
public double[] getEmissionProb() {
return emissionProb;
}
@Override
public Iterator createIterator() {
return new NullIterator();
}
}
| [
"[email protected]"
] | |
2aaab8d032a2b445540de8dbb70db9a241ff0251 | 71e3c3b07738023da5a8f35bded9fa096dd301db | /src/test/java/com/ravi/recipemongoapp/repositories/reactive/CategoryReactiveRepositoryTest.java | 3be77b70f19361805f112f105e82b3d94a9add77 | [] | no_license | vcheruk2/recipe-mongo-app | 415f360263ffb89ce80ec287f6bcb4a8377d55fe | dc1a18ac33302030313e2a49bd3547f803188a17 | refs/heads/master | 2022-07-02T18:51:23.773663 | 2020-05-10T18:36:23 | 2020-05-10T18:36:23 | 261,025,439 | 0 | 0 | null | 2020-05-03T21:47:23 | 2020-05-03T21:35:04 | Java | UTF-8 | Java | false | false | 1,201 | java | package com.ravi.recipemongoapp.repositories.reactive;
import com.ravi.recipemongoapp.domain.Category;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTest;
import static org.junit.jupiter.api.Assertions.*;
@DataMongoTest
class CategoryReactiveRepositoryTest {
@Autowired
CategoryReactiveRepository categoryReactiveRepository;
@BeforeEach
void setUp() {
categoryReactiveRepository.deleteAll().block();
}
@Test
void testSave() {
Category category = new Category();
category.setDescription("Test Category");
categoryReactiveRepository.save(category).block();
assertEquals(1L, categoryReactiveRepository.count().block());
}
@Test
void findByDescription() {
String desc = "Test Category";
Category category = new Category();
category.setDescription(desc);
categoryReactiveRepository.save(category).block();
assertEquals(desc, categoryReactiveRepository.findByDescription(desc).block().getDescription());
}
} | [
"[email protected]"
] | |
d0c79b60f51b9fafc8aaa52678dcc47e822c8022 | f6869b90ec1252d8574c97deea2c4adadecace25 | /base/src/main/java/com/rq/ctr/ui/FragmentSaveTabHost.java | 1b27a136111a364bcb7c7f21343cb0ccf4ea61c2 | [] | no_license | RomenQueen/BaseController | bfda3a7691f2bc8e3c98ae548549696e5329dad7 | c5eb743a4e4692add2cfb7c27ffb5e5c90872a54 | refs/heads/master | 2020-09-24T13:00:03.044529 | 2020-06-16T12:48:16 | 2020-06-16T12:48:16 | 225,764,069 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,056 | java | package com.rq.ctr.ui;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.TabWidget;
import com.rq.ctr.controller_part.BaseController;
import java.util.ArrayList;
public class FragmentSaveTabHost<C extends BaseController> extends TabHost implements TabHost.OnTabChangeListener {
private final ArrayList<FragmentTabInfo> mTabs = new ArrayList<>();
private FrameLayout mRealTabContent;
private Context mContext;
private FragmentManager mFragmentManager;
private int mContainerId;
private OnTabChangeListener mOnTabChangeListener;
private FragmentTabInfo mLastTab;
private boolean mAttached;
public FragmentSaveTabHost(Context context) {
// Note that we call through to the version that takes an AttributeSet,
// because the simple Context construct can result in a broken object!
super(context, null);
initFragmentTabHost(context, null);
}
public FragmentSaveTabHost(Context context, AttributeSet attrs) {
super(context, attrs);
initFragmentTabHost(context, attrs);
}
private void initFragmentTabHost(Context context, AttributeSet attrs) {
final TypedArray a = context.obtainStyledAttributes(attrs,
new int[]{android.R.attr.inflatedId}, 0, 0);
mContainerId = a.getResourceId(0, 0);
a.recycle();
super.setOnTabChangedListener(this);
}
private void ensureHierarchy(Context context) {
// If owner hasn't made its own view hierarchy, then as a convenience
// we will construct a standard one here.
if (findViewById(android.R.id.tabs) == null) {
LinearLayout ll = new LinearLayout(context);
ll.setOrientation(LinearLayout.VERTICAL);
TabWidget tw = new TabWidget(context);
tw.setId(android.R.id.tabs);
tw.setOrientation(TabWidget.HORIZONTAL);
ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0));
FrameLayout fl = new FrameLayout(context);
fl.setId(android.R.id.tabcontent);
ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0));
mRealTabContent = fl = new FrameLayout(context);
mRealTabContent.setId(mContainerId);
ll.addView(fl, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1));
addView(ll, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
}
/**
* @deprecated Don't call the original TabHost setup, you must instead
* call {@link #setup(Context, FragmentManager)} or
* {@link #setup(Context, FragmentManager, int)}.
*/
@Override
@Deprecated
public void setup() {
throw new IllegalStateException(
"Must call setup() that takes a Context and FragmentManager");
}
public void setup(Context context, FragmentManager manager) {
ensureHierarchy(context); // Ensure views required by super.setup()
super.setup();
mContext = context;
mFragmentManager = manager;
ensureContent();
}
public void setup(Context context, FragmentManager manager, int containerId) {
ensureHierarchy(context); // Ensure views required by super.setup()
super.setup();
mContext = context;
mFragmentManager = manager;
mContainerId = containerId;
ensureContent();
mRealTabContent.setId(containerId);
}
private void ensureContent() {
if (mRealTabContent == null) {
mRealTabContent = findViewById(mContainerId);
if (mRealTabContent == null) {
throw new IllegalStateException(
"No tab content FrameLayout found for id " + mContainerId);
}
}
}
@Override
public void setOnTabChangedListener(OnTabChangeListener l) {
mOnTabChangeListener = l;
}
public void addTab(@NonNull TabSpec tabSpec, Class<? extends BaseController> controller, @Nullable Bundle args, int position) {
tabSpec.setContent(new DummyTabFactory(mContext));
final String tag = tabSpec.getTag();
// if (controller == null) {
// mTabs.add(null);
// addTab(tabSpec);
// LOG.e("FragmentSaveTabHost", "LINE:202");
// return;
// }
final FragmentTabInfo info = new FragmentTabInfo(tag, controller, args, position);
if (mAttached) {
// If we are already attached to the window, then check to make
// sure this tab's fragment is inactive if it exists. This shouldn't
// normally happen.
info.fragment = mFragmentManager.findFragmentByTag(tag);
if (info.fragment != null && !info.fragment.isDetached()) {
final FragmentTransaction ft = mFragmentManager.beginTransaction();
ft.detach(info.fragment);
ft.commit();
}
}
mTabs.add(info);
addTab(tabSpec);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
final String currentTag = getCurrentTabTag();
// Go through all tabs and make sure their fragments match
// the correct state.
FragmentTransaction ft = null;
for (int i = 0, count = mTabs.size(); i < count; i++) {
final FragmentTabInfo tab = mTabs.get(i);
// if (tab == null) {
// continue;
// }
tab.fragment = mFragmentManager.findFragmentByTag(tab.tag);
if (tab.fragment != null && !tab.fragment.isDetached()) {
if (tab.tag.equals(currentTag)) {
mLastTab = tab;
} else {
if (ft == null) {
ft = mFragmentManager.beginTransaction();
}
ft.detach(tab.fragment);
}
}
}
// We are now ready to go. Make sure we are switched to the
// correct tab.
mAttached = true;
ft = doTabChanged(currentTag, ft);
if (ft != null) {
ft.commitAllowingStateLoss();
mFragmentManager.executePendingTransactions();
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mAttached = false;
}
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.curTab = getCurrentTabTag();
return ss;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
}
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
setCurrentTabByTag(ss.curTab);
}
public interface OnChangeInterceptor {
boolean changeAble(String tabId, int position);
}
OnChangeInterceptor mOnChangeInterceptor;
public void setChangeInterceptor(OnChangeInterceptor interceptor) {
mOnChangeInterceptor = interceptor;
}
@Override
public void setCurrentTab(int index) {
if (mOnChangeInterceptor != null && !mOnChangeInterceptor.changeAble("",index)) {
return ;
}
super.setCurrentTab(index);
}
@Override
public void onTabChanged(String tabId) {
if (mAttached) {
final FragmentTransaction ft = doTabChanged(tabId, null);
if (ft != null) {
try {
ft.commitAllowingStateLoss();
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
}
if (mOnTabChangeListener != null) {
mOnTabChangeListener.onTabChanged(tabId);
}
}
@Nullable
private FragmentTransaction doTabChanged(@Nullable String tag, @Nullable FragmentTransaction ft) {
final FragmentTabInfo newTab = getTabInfoForTag(tag);
if (mLastTab != newTab) {
if (ft == null) {
ft = mFragmentManager.beginTransaction();
}
if (mLastTab != null) {
if (mLastTab.fragment != null) {
ft.hide(mLastTab.fragment);
}
}
if (newTab != null) {
if (newTab.fragment == null) {
newTab.fragment = CommonFragment.instance(newTab._class);
if (newTab.args != null) {
newTab.fragment.setArguments(newTab.args);
}
ft.add(mContainerId, newTab.fragment, newTab.tag);
} else {
ft.show(newTab.fragment);
}
}
mLastTab = newTab;
}
return ft;
}
@Nullable
private FragmentTabInfo getTabInfoForTag(String tabId) {
for (int i = 0, count = mTabs.size(); i < count; i++) {
final FragmentTabInfo tab = mTabs.get(i);
if (tab.tag.equals(tabId)) {
return tab;
}
}
return null;
}
static final class FragmentTabInfo {
final @NonNull
String tag;
final @NonNull
Class<? extends BaseController> _class;
final @Nullable
Bundle args;
int position;
Fragment fragment;
FragmentTabInfo(@NonNull String _tag, Class<? extends BaseController> _class, @Nullable Bundle _args, int position) {
this.tag = _tag;
this._class = _class;
this.args = _args;
this.position = position;
}
}
public void move2Tab(String tag) {
onTabChanged(tag);
}
static class DummyTabFactory implements TabContentFactory {
private final Context mContext;
public DummyTabFactory(Context context) {
mContext = context;
}
@Override
public View createTabContent(String tag) {
View v = new View(mContext);
v.setMinimumWidth(0);
v.setMinimumHeight(0);
return v;
}
}
static class SavedState extends BaseSavedState {
public static final Creator<SavedState> CREATOR
= new Creator<SavedState>() {
@Override
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
String curTab;
SavedState(Parcelable superState) {
super(superState);
}
SavedState(Parcel in) {
super(in);
curTab = in.readString();
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeString(curTab);
}
@Override
public String toString() {
return "FragmentTabHost.SavedState{"
+ Integer.toHexString(System.identityHashCode(this))
+ " curTab=" + curTab + "}";
}
}
}
| [
"rq08414947"
] | rq08414947 |
1b2fa8b6c17daab5f841a83f847ae565eb6956cb | ca4a62e938d6b0a9ce69ac34d38bbae5616c55af | /src/main/java/SAYAV2/SAYAV2/bussines/Alarma.java | feb67e5ebe96aa00814b3b76ab4636a315489211 | [] | no_license | isaiasarza/Sayav | 79c06ab002a26d6480664d0a9b836665d13d563b | c6081bb966b97a3e965b365952484c391de7bc7b | refs/heads/Mensajeria | 2022-11-20T16:18:43.113137 | 2019-07-03T19:12:51 | 2019-07-03T19:12:51 | 70,096,571 | 0 | 0 | null | 2022-11-16T04:43:00 | 2016-10-05T20:25:39 | Java | UTF-8 | Java | false | false | 1,120 | java | package SAYAV2.SAYAV2.bussines;
import java.util.ArrayList;
import java.util.List;
import SAYAV2.SAYAV2.model.DispositivoM;
import SAYAV2.SAYAV2.model.Sector;
import SAYAV2.SAYAV2.model.Usuario;
public class Alarma {
public static void notificar(Usuario usuario){
String mensaje = usuario.toString();
List<Sector> sensoresActivos = getSectoresActivos(usuario.getSectores());
mensaje += "Sectores activos: " + sensoresActivos.toString();
System.out.println(mensaje);
notificarMoviles(usuario.getDispositivosMoviles(),mensaje);
}
public static void notificarMoviles(List<DispositivoM> dispositivosMoviles, String mensaje){
for(DispositivoM d: dispositivosMoviles){
notificarMovil(d,mensaje);
}
}
private static void notificarMovil(DispositivoM d, String mensaje) {
// TODO Auto-generated method stub
System.out.println(mensaje);
}
private static List<Sector> getSectoresActivos(List<Sector> sensores) {
List<Sector> sensoresActivos= new ArrayList<Sector>();
for(Sector s: sensores){
if(s.isActivado()){
sensoresActivos.add(s);
}
}
return sensoresActivos;
}
}
| [
"[email protected]"
] | |
45c6a63e59992633768aa8f8a0000d4bf00f7429 | 61053c06b471e778a866cef6d8afb802253e8aec | /fancyfoods-dept-chocolate/src/main/java/fancyfoods/chocolate/Chocolate.java | a1a5f58d18d8691522bd15306620825117db6508 | [
"Apache-2.0"
] | permissive | jkorab/smx-ent-osgi | 386f6b5b34a14ba995b0580ca9eeb61421405923 | d1f0432aedf7f6f4857369c65eacb927ffba0328 | refs/heads/master | 2021-01-17T05:37:49.583233 | 2014-10-08T16:00:44 | 2014-10-08T16:00:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package fancyfoods.chocolate;
import fancyfoods.food.Food;
class Chocolate implements Food {
@Override
public String getName() {
return "Chocolate";
}
@Override
public double getPrice() {
return 1.49;
}
@Override
public int getQuantityInStock() {
return 20;
}
}
| [
"[email protected]"
] | |
f78a944641c5a73f51ef7c1eff63ff9ed5d9264e | 1e7e6f3b0a6d3945c0ed8de847bcd34f232dc92b | /src/main/java/ru/javaproject/loansystem/web/creaditapplicationlistproduct/CreditApplicationListProductAxaxController.java | 791e1c4b952c16c0f3f01079c7dc218d1465e4a9 | [] | no_license | bortmex/LoanSystem | c6f0d8156eadba63bfd78a4ab5150a8bdabdccd7 | 62858b966a5271835dc4330702274c43e85ede44 | refs/heads/master | 2018-09-30T18:58:40.808244 | 2018-06-07T20:40:35 | 2018-06-07T20:40:35 | 108,326,710 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package ru.javaproject.loansystem.web.creaditapplicationlistproduct;
import org.springframework.web.bind.annotation.*;
import ru.javaproject.loansystem.model.CreditApplicationListProduct;
@RestController
@RequestMapping("/ajax/user/credapplistprod")
public class CreditApplicationListProductAxaxController extends AbstractCreditApplicationListProductController {
@PostMapping("/{idcred}/{idprod}")
public void create(@PathVariable("idcred") Integer idcred,
@PathVariable("idprod") Integer idprod) {
CreditApplicationListProduct creditApplicationListProd = new CreditApplicationListProduct(idcred, idprod);
super.create(creditApplicationListProd);
}
}
| [
"[email protected]"
] | |
5ddf3cad03fb144623b199ce793dc435436798f8 | bf3a2be2c285dc8083d3398f67eff55f59a590fb | /symja/src/main/java/edu/jas/gbmod/ModGroebnerBasePar.java | 86ef5c8559fb8fd2037b8af730923b5049c6cc06 | [] | no_license | tranleduy2000/symja_java7 | 9efaa4ab3e968de27bb0896ff64e6d71d6e315a1 | cc257761258e443fe3613ce681be3946166584d6 | refs/heads/master | 2021-09-07T01:45:50.664082 | 2018-02-15T09:33:51 | 2018-02-15T09:33:51 | 105,413,861 | 2 | 1 | null | 2017-10-03T08:14:56 | 2017-10-01T02:17:38 | Java | UTF-8 | Java | false | false | 1,171 | java | /*
* $Id$
*/
package edu.jas.gbmod;
import edu.jas.gb.GroebnerBaseAbstract;
import edu.jas.gbufd.GBFactory;
import edu.jas.structure.GcdRingElem;
import edu.jas.structure.RingFactory;
/**
* Module Groebner Bases sequential algorithm. Implements Groebner bases and GB
* test.
*
* @author Heinz Kredel
* @deprecated use respective methods from GroebnerBaseParallel
*/
@Deprecated
public class ModGroebnerBasePar<C extends GcdRingElem<C>> extends ModGroebnerBaseSeq<C> {
//private static final Logger logger = Logger.getLogger(ModGroebnerBasePar.class);
/**
* Constructor.
*
* @param cf coefficient ring.
*/
public ModGroebnerBasePar(RingFactory<C> cf) {
this(GBFactory.getProxy(cf));
}
/**
* Constructor.
*
* @param bb Groebner base algorithm.
*/
public ModGroebnerBasePar(GroebnerBaseAbstract<C> bb) {
super(bb);
}
/**
* Cleanup and terminate ThreadPool.
*/
@Override
public void terminate() {
bb.terminate();
}
/**
* Cancel ThreadPool.
*/
@Override
public int cancel() {
return bb.cancel();
}
}
| [
"[email protected]"
] | |
713af0d0af21cd4c099d9676423cb7f065b3a348 | 25950ee0fe311b2762623e6e430cda73fdfb2302 | /src/conexionHibernate/GuardaClientePrueba.java | 08793266fae7065dbc51af47d08244fd7f8f7606 | [] | no_license | AxelCCp/4-SPRING-CON-HIBERNATE | e8956983eb047619930c434fa7ea263baca62119 | afda4c2317bd7998a0703bce184ea3fb3c6ade37 | refs/heads/master | 2023-07-14T19:40:23.393326 | 2021-09-06T15:06:43 | 2021-09-06T15:06:43 | 340,088,210 | 0 | 0 | null | null | null | null | ISO-8859-3 | Java | false | false | 1,883 | java | package conexionHibernate;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class GuardaClientePrueba {
public static void main(String []args) {
//PASO 1:
//CREAMOS OBJ SESSIONFACTORY PARA QUE LEA EL ARCHIVO DE CONFIGURACIÓN Y SEA CAPAZ DE CONSTRUIR UN SESSIONFACTORY.
//CONFIGURE(): PARA LEER ARCHIVO DE CONFIGURACION.(INDICAMOS EL ARCHIVO DE CONFIG QUE LEA)
//addAnnotatedClass():INDICAMOS LA CLASE CON LA QUE VAMOS A TRABAJAR.
//buildSessionFactory():INDICAMOS QUE COSNTRUYA ESTE SESSION FACTORY.
SessionFactory miFactory = new Configuration().configure("hibernate.cfg.xml").addAnnotatedClass(Clientes.class).buildSessionFactory();
//PASO 2:
//CREAR OBJ DE TIPO SESSION.
//miFactory.openSession(): ABRIMOS LA SESSION.
Session miSession = miFactory.openSession();
try {
//PASO 3:
//CREAMOS OBJ DE TIPO CLIENTES.
Clientes cliente1 = new Clientes("Julia","Ann", "xxxxxxx n°123");
//PASO 4:
//beginTransaction(): EJECUTAR TRANSACCIÓN.
//save(cliente1): LA TRANSACCIÓN GUARDA AL OBJ CLIENTES EN LA BBDD.
//getTransaction().commit(): RESCATAMOS LA TRANSACCIÓN QUE HEMOS HECHO, Y CON COMMIT() FIJAMOS LA OPERACIÓN.
miSession.beginTransaction();
miSession.save(cliente1);
miSession.getTransaction().commit();
System.out.println("REGISTRO INSERTADO CORRECTAMENTE");
//CLASE 50 / LECTURA DE REGISTRO
miSession.beginTransaction();
System.out.println("Lectura del registro con Id: " + cliente1.getId());
Clientes clienteInsertado = miSession.get(Clientes.class, cliente1.getId());
System.out.println("Registro: " + clienteInsertado);
miSession.getTransaction().commit();
System.out.println("Terminado");
miSession.close();
}finally{
miFactory.close();
}
}
}
| [
"[email protected]"
] | |
d8e29580a21fff11b012c708de1e39f36b282dd1 | 0dd0168da66b20a7a42ae759f039ed41d55d469e | /src/tetris/Field.java | 08c9b3cb3b61d04e00ab33926a45b4e7386f80d9 | [] | no_license | paha141/JavaRushProjects | 5501d73a0097ec04dc612b58d620349835c59c05 | 5e858f141496435fd953c4151e8fd8332202d987 | refs/heads/master | 2023-04-25T04:01:23.587947 | 2021-05-14T14:07:41 | 2021-05-14T14:07:41 | 367,381,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,495 | java | package tetris;
import java.util.ArrayList;
/**
* Класс Field описывает "поле клеток" игры Тетрис
*/
public class Field {
//ширина и высота
private int width;
private int height;
//матрица поля: 1 - клетка занята, 0 - свободна
private int[][] matrix;
public Field(int width, int height) {
this.width = width;
this.height = height;
matrix = new int[height][width];
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public int[][] getMatrix() {
return matrix;
}
/**
* Метод возвращает значение, которое содержится в матрице с координатами (x,y)
* Если координаты за пределами матрицы, метод возвращает null.
*/
public Integer getValue(int x, int y) {
if (x >= 0 && x < width && y >= 0 && y < height)
return matrix[y][x];
return null;
}
/**
* Метод устанавливает переданное значение(value) в ячейку матрицы с координатами (x,y)
*/
public void setValue(int x, int y, int value) {
if (x >= 0 && x < width && y >= 0 && y < height)
matrix[y][x] = value;
}
/**
* Метод печатает на экран текущее содержание матрицы
*/
public void print() {
//Создаем массив, куда будем "рисовать" текущее состояние игры
int[][] canvas = new int[height][width];
//Копируем "матрицу поля" в массив
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
canvas[i][j] = matrix[i][j];
}
}
//Копируем фигурку в массив, только непустые клетки
int left = Tetris.game.getFigure().getX();
int top = Tetris.game.getFigure().getY();
int[][] brickMatrix = Tetris.game.getFigure().getMatrix();
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (top + i >= height || left + j >= width) continue;
if (brickMatrix[i][j] == 1)
canvas[top + i][left + j] = 2;
}
}
//Выводим "нарисованное" на экран, но начинаем с "границы кадра".
System.out.println("---------------------------------------------------------------------------\n");
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
int index = canvas[i][j];
if (index == 0)
System.out.print(" . ");
else if (index == 1)
System.out.print(" X ");
else if (index == 2)
System.out.print(" X ");
else
System.out.print("???");
}
System.out.println();
}
System.out.println();
System.out.println();
}
/**
* Удаляем заполненные линии
*/
public void removeFullLines() {
//Создаем список для хранения линий
ArrayList<int[]> lines = new ArrayList<int[]>();
//Копируем все непустые линии в список.
for (int i = 0; i < height; i++) {
//подсчитываем количество единиц в строке - просто суммируем все ее значения
int count = 0;
for (int j = 0; j < width; j++) {
count += matrix[i][j];
}
//Если сумма строки не равна ее ширине - добавляем в список
if (count != width)
lines.add(matrix[i]);
}
//Добавляем недостающие строки в начало списка.
while (lines.size() < height) {
lines.add(0, new int[width]);
}
//Преобразуем список обратно в матрицу
matrix = lines.toArray(new int[height][width]);
}
}
| [
"[email protected]"
] | |
8f81f3d0a1fcf0088f3bfd23d0a2c58ccb0f201d | cef93bc765c0d27c3afb4db45ec6ee2892630f90 | /src/main/java/com/miamato/PropertyManager.java | b734123958bb34416731caeee39b9b3d34c3ec52 | [] | no_license | KatiaAndrusiak/AT_HT_5 | 968de1293e446df2ecc0592d4d76c04fb61ae327 | 1d7612556fedb92d80375f925b79d903cab06edd | refs/heads/main | 2023-04-18T04:51:46.991274 | 2021-04-27T12:32:35 | 2021-04-27T12:32:35 | 362,104,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,310 | java | package com.miamato;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class PropertyManager {
private static final Logger logger = LogManager.getLogger(PropertyManager.class.getSimpleName());
private static PropertyManager instance = null;
private static final Properties properties = new Properties();
private PropertyManager() {
loadProperties("testdata/amazon.properties");
}
public static String getProperty(String propertyName){
if(instance == null)
instance = new PropertyManager();
return properties.getProperty(propertyName);
}
private void loadProperties(String filePath) {
logger.info("Trying to access property file: " + filePath);
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(filePath)) {
properties.load(inputStream);
} catch (FileNotFoundException e) {
LogUtil.logStackTrace(e, logger);
} catch (IOException e) {
LogUtil.logStackTrace(e, logger);
} catch (NullPointerException e) {
LogUtil.logStackTrace(e, logger);
}
}
}
| [
"[email protected]"
] | |
bce339519c27b47bb1552767289f33a075487da3 | 30e329ae5429df2145cccc4abc7b8434a8ef488f | /order_pay_detect/src/main/java/com/shuanghe/orderoaydetect/model/OrderResult.java | 12a7ccf55184b0c9fcdc37bf56d14dd22ad40844 | [] | no_license | yushuanghe/user_behavior_analysis | 05d7bd2eb0d482eac3e44413be6a2d6cf8606799 | 6acdfce047d8a3c7b750f64886a530e778c5d672 | refs/heads/master | 2023-03-31T18:02:46.803494 | 2021-04-07T13:16:58 | 2021-04-07T13:16:58 | 351,168,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | package com.shuanghe.orderoaydetect.model;
import java.io.Serializable;
/**
* @author yushu
*/
public class OrderResult implements Serializable {
private String orderId;
private String resultMsg;
public OrderResult(String orderId, String resultMsg) {
this.orderId = orderId;
this.resultMsg = resultMsg;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getResultMsg() {
return resultMsg;
}
public void setResultMsg(String resultMsg) {
this.resultMsg = resultMsg;
}
@Override
public String toString() {
return "OrderResult{" +
"orderId='" + orderId + '\'' +
", resultMsg='" + resultMsg + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
3e798f779f51e2e107a9fc903aafbf011b43d52d | 7c199b111dca785773d51e264419ee0e9e48068f | /src/main/java/cn/mesie/dataStructure/list/Node.java | 2bd4987672cace8fe8f0cebc3918599380d11129 | [] | no_license | littlemesie/Javalearn | 0e071f32340bcc67fd16957acd952c4aebf262ba | 70c5b55815baf7b98977079e4d391b681e64b1e5 | refs/heads/master | 2020-04-27T01:21:35.086091 | 2019-05-19T14:45:17 | 2019-05-19T14:45:17 | 173,962,770 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package cn.mesie.dataStructure.list;
/**
* Created by 2019-03-24 13:45
* 结点类
* @author: mesie
*/
public class Node<T> {
/**新元素与链表结合节点**/
Node<T> next;
/**新元素数据**/
T data;
public Node() {
}
public Node(T data) {
this.data = data;
}
@Override
public String toString() {
return data.toString();
}
}
| [
"[email protected]"
] | |
32b36d72e3f44545cdec3fba63d71ac46487d271 | be278214be5034837eb1d3ed12ea877c701a6ac9 | /app/src/main/java/com/example/droidcafe/OrderActivity.java | 263e0203620392cd05667b66ba568dd62be33130 | [] | no_license | Theosuccess/Droid_Cafe | 1437e2a09d83ad8535fb79299b7852ce0745c841 | b8de6f199292fa156c4010cd020af28568fd7f6a | refs/heads/master | 2022-12-21T07:19:41.505246 | 2020-09-28T19:24:35 | 2020-09-28T19:24:35 | 299,410,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,783 | java | package com.example.droidcafe;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class OrderActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
public void displayToast(String message){
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
}
//for datePicker
public void processDatePickerResult(int year, int month, int day){
String year_string = Integer.toString(year);
String month_string = Integer.toString(month+1);
String day_string = Integer.toString(day);
String dateMessage = (day_string + "/" + month_string + "/" + year_string);
Toast.makeText(this, "Date: " + dateMessage, Toast.LENGTH_LONG).show();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_order);
TextView textView = findViewById(R.id.order_textView);
Intent intent = getIntent();
String message = "Order: " + intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
textView.setText(message);
// Create the spinner.
Spinner spinner = (findViewById(R.id.label_spinner));
if (spinner!=null){
spinner.setOnItemSelectedListener(this);
}
// Create ArrayAdapter using the string array and default spinner layout.
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.label_array, android.R.layout.simple_spinner_item);
// Specify the layout to use when the list of choices appears.
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner.
if (spinner!=null){
spinner.setAdapter(adapter);
}
}
public void onRadioButtonClicked(View view) {
// Is the button now checked?
boolean checked = ((RadioButton) view).isChecked();
// Check which radio button was clicked.
switch (view.getId()){
case R.id.sameDay:
if (checked);
// Same day service
displayToast(getString(R.string.same_day_messenger_service));
break;
case R.id.nextday:
if (checked);
//next day
displayToast(getString(R.string.next_day_ground_delivery));
break;
case R.id.pickup:
if (checked);
//pick up
displayToast(getString(R.string.pick_up));
break;
// do nothing
default:
break;
}
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
// to retrieve the user's selected item using getItemAtPosition(), and assign it to spinnerLabel
//You can also add a call to the displayToast() method you already added to OrderActivity:
String spinnerLabel = adapterView.getItemAtPosition(i).toString();
displayToast(spinnerLabel);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
public void onDatePickerClick(View view) {
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getSupportFragmentManager(), "DatePicker");
}
} | [
"[email protected]"
] | |
9cc9293d054539dd2f828d2934e364313507f429 | f3bb9e8806db3db77a8079988d74ffce847593f9 | /org.alloytools.kodkod.core/src/main/java/kodkod/util/ints/AbstractSparseSequence.java | 04516a8b317b93278fb9ca18f7bd92409a12101a | [
"MIT",
"Apache-2.0"
] | permissive | danielleberre/org.alloytools.alloy | de673f3d078083f3a3d8c6e55b5d067404c4420d | dcc3d4d04ef7970dca35047cb3f51945922f9e8f | refs/heads/master | 2021-04-03T04:49:03.932626 | 2018-03-12T07:35:13 | 2018-03-12T07:35:13 | 125,003,790 | 0 | 1 | Apache-2.0 | 2018-03-13T06:34:15 | 2018-03-13T06:34:15 | null | UTF-8 | Java | false | false | 14,059 | java | /*
* Kodkod -- Copyright (c) 2005-present, Emina Torlak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package kodkod.util.ints;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* A skeletal implementation of the SparseSequence interface. The class provides
* an implementation for the <code>isEmpty</code>, <code>putAll</code>,
* <code>contains</code>, <code>indices</code>, <code>equals</code>,
* <code>hashCode</code>, and <code>toString</code> methods. All other methods
* must be implemented by the subclasses.
*
* @specfield entries: int -> lone V
* @author Emina Torlak
*/
public abstract class AbstractSparseSequence<V> implements SparseSequence<V> {
/**
* Constructs a sparse sequence
*
* @ensures no this.entries'
*/
protected AbstractSparseSequence() {}
/**
* Returns true if the size of this sequence is 0.
*
* @return this.size()==0
*/
public boolean isEmpty() {
return size() == 0;
}
/**
* Returns an iterator over the entries in this sequence in the ascending
* order of indeces, starting at this.first(). This method calls
* this.iterator(Integer.MIN_VALUE, Integer.MAX_VALUE).
*
* @return an iterator over this.entries starting at the entry with the
* smallest index
*/
public Iterator<IndexedEntry<V>> iterator() {
return iterator(Integer.MIN_VALUE, Integer.MAX_VALUE);
}
/**
* Returns the first element in this sequence, if any. This method first
* checks that the sequence is not empty, and if not, returns
* this.iterator().next(); {@inheritDoc}
*
* @see kodkod.util.ints.SparseSequence#first()
*/
public IndexedEntry<V> first() {
return isEmpty() ? null : iterator().next();
}
/**
* Returns the last element in this sequence, if any. This method first
* checks that the sequence is not empty, and if not, returns
* this.iterator(Integer.MAX_VALUE, Integer.MIN_VALUE).next(); {@inheritDoc}
*
* @see kodkod.util.ints.SparseSequence#last()
*/
public IndexedEntry<V> last() {
return isEmpty() ? null : iterator(Integer.MAX_VALUE, Integer.MIN_VALUE).next();
}
/**
* Returns the entry whose index is the ceiling of the given index in this
* sequence. This method calls this.iterator(index, Integer.MAX_VALUE), and
* if the resulting iterator has a next element returns it. {@inheritDoc}
*
* @see kodkod.util.ints.SparseSequence#ceil(int)
*/
public IndexedEntry<V> ceil(int index) {
final Iterator<IndexedEntry<V>> itr = iterator(index, Integer.MAX_VALUE);
return itr.hasNext() ? itr.next() : null;
}
/**
* Returns the entry whose index is the floor of the given index in this
* sequence. This method calls this.iterator(index, Integer.MIN_VALUE), and
* if the resulting iterator has a next element returns it. {@inheritDoc}
*
* @see kodkod.util.ints.SparseSequence#floor(int)
*/
public IndexedEntry<V> floor(int index) {
final Iterator<IndexedEntry<V>> itr = iterator(index, Integer.MIN_VALUE);
return itr.hasNext() ? itr.next() : null;
}
/**
* Returns the set of all indices mapped by this sparse sequence. The
* returned set supports removal iff this is not an unmodifiable sparse
* sequence.
*
* @return {s: IntSet | s.ints = this.entries.V}
*/
public IntSet indices() {
return new AbstractIntSet() {
public IntIterator iterator(final int from, final int to) {
return new IntIterator() {
Iterator<IndexedEntry<V>> iter = AbstractSparseSequence.this.iterator(from, to);
public boolean hasNext() {
return iter.hasNext();
}
public int next() {
return iter.next().index();
}
public void remove() {
iter.remove();
}
};
}
public int size() {
return AbstractSparseSequence.this.size();
}
public boolean contains(int i) {
return containsIndex(i);
}
public int min() {
final IndexedEntry<V> first = AbstractSparseSequence.this.first();
if (first == null)
throw new NoSuchElementException();
return first.index();
}
public int max() {
final IndexedEntry<V> last = AbstractSparseSequence.this.last();
if (last == null)
throw new NoSuchElementException();
return last.index();
}
public boolean remove(int i) {
final boolean isMapped = containsIndex(i);
AbstractSparseSequence.this.remove(i);
return isMapped;
}
public int floor(int i) {
final IndexedEntry<V> floor = AbstractSparseSequence.this.floor(i);
if (floor == null)
throw new NoSuchElementException();
return floor.index();
}
public int ceil(int i) {
final IndexedEntry<V> ceil = AbstractSparseSequence.this.ceil(i);
if (ceil == null)
throw new NoSuchElementException();
return ceil.index();
}
public void clear() {
AbstractSparseSequence.this.clear();
}
public IntSet clone() throws CloneNotSupportedException {
final IntSet s;
if (size() == 0)
s = Ints.bestSet(Integer.MIN_VALUE, Integer.MAX_VALUE);
else
s = Ints.bestSet(min(), max());
s.addAll(this);
return s;
}
};
}
/**
* {@inheritDoc}
*
* @see kodkod.util.ints.SparseSequence#values()
*/
public Collection<V> values() {
return new AbstractCollection<V>() {
public int size() {
return AbstractSparseSequence.this.size();
}
public boolean isEmpty() {
return AbstractSparseSequence.this.isEmpty();
}
public boolean contains(Object arg0) {
return AbstractSparseSequence.this.contains(arg0);
}
public Iterator<V> iterator() {
return new Iterator<V>() {
Iterator<IndexedEntry<V>> iter = AbstractSparseSequence.this.iterator();
public boolean hasNext() {
return iter.hasNext();
}
public V next() {
return iter.next().value();
}
public void remove() {
iter.remove();
}
};
}
public void clear() {
AbstractSparseSequence.this.clear();
}
};
}
/**
* Returns true if this sparse sequence has an entry for the given index;
* otherwise returns false. This method returns the value of
* this.iterator(index,index).hasNext(); {@inheritDoc}
*
* @see kodkod.util.ints.SparseSequence#containsIndex(int)
*/
public boolean containsIndex(int index) {
return iterator(index, index).hasNext();
}
/**
* Iterates through all the entries in this sequence and returns true if one
* of the encountered entries has the given object as its value.
*
* @return {@inheritDoc}
* @see kodkod.util.ints.SparseSequence#contains(java.lang.Object)
*/
public boolean contains(Object value) {
for (IndexedEntry< ? > v : this) {
if (equal(value, v.value()))
return true;
}
return false;
}
/**
* Returns the result of calling super.clone().
*
* @see java.lang.Object#clone()
*/
@SuppressWarnings("unchecked")
public SparseSequence<V> clone() throws CloneNotSupportedException {
return (SparseSequence<V>) super.clone();
}
/*---------- adapted from java.util.AbstractMap -----------*/
/**
* Removes the entry with the given index, if it exists, and returns the
* value previously stored at the index. If the sequence had no previous
* mapping for the index, null is returned. This method obtains an iterator
* from index to index and removes its sole element, if any. {@inheritDoc}
*
* @see kodkod.util.ints.SparseSequence#remove(int)
*/
public V remove(int index) {
final Iterator<IndexedEntry<V>> itr = iterator(index, index);
if (itr.hasNext()) {
final V ret = itr.next().value();
itr.remove();
return ret;
}
return null;
}
/**
* Removes all entries from this sequences. This method obtains an iterator
* over the sequences and calls remove() after each call to next().
* {@inheritDoc}
*
* @see kodkod.util.ints.SparseSequence#clear()
*/
public void clear() {
final Iterator<IndexedEntry<V>> itr = iterator();
while (itr.hasNext()) {
itr.next();
itr.remove();
}
}
/**
* Throws an UnsupportedOperationException.
*
* @throws UnsupportedOperationException
*/
public V put(int index, V value) {
throw new UnsupportedOperationException();
}
/**
* Copies all of the entries from the specified sparse sequence to this
* sequence. This implementation calls put(e.index, e.value) on this
* sequence once for each entry e in the specified sequence.
*
* @ensures this.entries' = this.entries ++ s.entries
*/
public void putAll(SparseSequence< ? extends V> s) {
Iterator< ? extends IndexedEntry< ? extends V>> i = s.iterator();
while (i.hasNext()) {
IndexedEntry< ? extends V> e = i.next();
put(e.index(), e.value());
}
}
/**
* Returns true if both o1 and o2 are null, or o1.equals(o2)
*
* @return o1 and o2 are equal
*/
static boolean equal(Object o1, Object o2) {
return o1 == null ? o2 == null : o1.equals(o2);
}
/**
* Returns true if the indexed entries e0 and e1 are equal to each other.
*
* @requires e0 != null && e1 != null
* @return e0.index = e1.index && e0.value = e1.value
*/
static boolean equal(IndexedEntry< ? > e0, IndexedEntry< ? > e1) {
return e0.index() == e1.index() && equal(e0.value(), e1.value());
}
/**
* Compares the specified object with this sequence for equality. Returns
* <tt>true</tt> if the given object is also a sequence and the two
* sequences represent the same function from integers to E.
* <p>
* This implementation first checks if the specified object is this
* sequence; if so it returns <tt>true</tt>. Then, it checks if the
* specified object is a sequence whose size is identical to the size of
* this set; if not, it returns <tt>false</tt>. If so, it iterates over this
* sequences's entries, and checks that the specified sequence contains each
* entry that this sequence contains. If the specified sequence fails to
* contain such an entry, <tt>false</tt> is returned. If the iteration
* completes, <tt>true</tt> is returned.
*
* @return o in SparseSequence && o.entries = this.entries
*/
@SuppressWarnings("unchecked")
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof SparseSequence))
return false;
SparseSequence<V> s = (SparseSequence<V>) o;
if (s.size() != size())
return false;
try {
final Iterator<IndexedEntry<V>> i1 = iterator(), i2 = s.iterator();
while (i1.hasNext()) {
if (!equal(i1.next(), i2.next()))
return false;
}
} catch (ClassCastException unused) {
return false;
} catch (NullPointerException unused) {
return false;
}
return true;
}
/**
* Returns the hashcode for an indexed entry.
*
* @requires e != null
* @return e.index ^ e.value.hashCode()
*/
static int hashCode(IndexedEntry< ? > e) {
return e.index() ^ (e.value() == null ? 0 : e.value().hashCode());
}
/**
* Returns the hash code value for this sparse sequence. The hash code of a
* sparse sequence is defined to be the sum of the hashCodes of each entry
* of its entries. This ensures that t1.equals(t2) implies that
* t1.hashCode()==t2.hashCode() for any two sequences t1 and t2, as required
* by the general contract of Object.hashCode. This implementation iterates
* over this.entries, calling <tt>hashCode</tt> on each IndexedEntry in the
* sequence, and adding up the results.
*
* @return sum(this.entries.hashCode())
*/
public int hashCode() {
int h = 0;
for (IndexedEntry<V> e : this)
h += hashCode(e);
return h;
}
/**
* Returns a string representation of this sequence. The string
* representation consists of a list of index-value mappings in the order
* returned by the sequences <tt>iterator</tt>, enclosed in brackets
* (<tt>"[]"</tt>). Adjacent entries are separated by the characters
* <tt>", "</tt> (comma and space). Each index-value mapping is rendered as
* the index followed by an equals sign (<tt>"="</tt>) followed by the
* associated value. Elements are converted to strings as by
* <tt>String.valueOf(Object)</tt>.
* <p>
* This implementation creates an empty string buffer, appends a left
* bracket, and iterates over the map's entries, appending the string
* representation of each <tt>IndexedEntry</tt> in turn. After appending
* each entry except the last, the string <tt>", "</tt> is appended. Finally
* a right bracket is appended. A string is obtained from the stringbuffer,
* and returned.
*
* @return a String representation of this map.
*/
public String toString() {
final StringBuilder buf = new StringBuilder();
buf.append("[");
final Iterator<IndexedEntry<V>> i = iterator();
boolean hasNext = i.hasNext();
while (hasNext) {
IndexedEntry<V> e = i.next();
buf.append(e.index());
buf.append("=");
if (e.value() == this)
buf.append("(this sequence)");
else
buf.append(e.value());
hasNext = i.hasNext();
if (hasNext)
buf.append(", ");
}
buf.append("]");
return buf.toString();
}
}
| [
"[email protected]"
] | |
498b2bbbad4efa7237d274bba6cbf7782ba3be1d | f43598db6001c9d6e40e71631fabfd0641cbcdb5 | /dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/visualization/impl/DefaultVisualizationServiceTest.java | f237ff2189ed66006af99d7cde4c9236c3ac1303 | [
"BSD-3-Clause"
] | permissive | abyot/sun-pmt-234 | e839850591393fba02fc1fa00f953724a810e66a | 12e09e544e9a702b4511ef6cfc7025180a56bdd5 | refs/heads/master | 2023-03-08T18:17:27.860300 | 2022-12-03T10:37:12 | 2022-12-03T10:37:12 | 265,843,044 | 2 | 1 | null | 2023-02-22T08:28:52 | 2020-05-21T12:29:03 | Java | UTF-8 | Java | false | false | 9,757 | java | package org.hisp.dhis.visualization.impl;
/*
* Copyright (c) 2004-2020, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hisp.dhis.analytics.AnalyticsService;
import org.hisp.dhis.common.AnalyticalObjectStore;
import org.hisp.dhis.common.BaseDimensionalItemObject;
import org.hisp.dhis.common.DimensionalItemObject;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.GridHeader;
import org.hisp.dhis.i18n.I18nManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.visualization.Visualization;
import org.hisp.dhis.visualization.VisualizationStore;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
public class DefaultVisualizationServiceTest
{
@Mock
private AnalyticalObjectStore<Visualization> visualizationStore;
@Mock
private AnalyticsService analyticsService;
@Mock
private OrganisationUnitService organisationUnitService;
@Mock
private CurrentUserService currentUserService;
@Mock
private I18nManager i18nManager;
@Rule
public MockitoRule rule = MockitoJUnit.rule();
private DefaultVisualizationService defaultVisualizationService;
@Before
public void setUp()
{
defaultVisualizationService = new DefaultVisualizationService( analyticsService, visualizationStore,
organisationUnitService, currentUserService, i18nManager );
}
@Test
public void getVisualizationGridByUserWhenItHasOrganisationUnitLevels()
{
// Given
final String anyVisualizationUid = "adbet5RTs";
final Date anyRelativePeriodDate = new Date();
final String anyOrganisationUnitUid = "ouiRzW5e";
final User userStub = userStub();
final List<Integer> orgUnitLevels = asList( 1, 2 );
final List<OrganisationUnit> orgUnits = asList( new OrganisationUnit() );
final Map<String, Object> valueMap = valueMapStub();
final Visualization visualizationStub = visualizationStub( "abc123xy" );
visualizationStub.setOrganisationUnitLevels( orgUnitLevels );
visualizationStub.setOrganisationUnits( orgUnits );
final Visualization visualizationSpy = spy( visualizationStub );
// When
when( visualizationStore.getByUid( anyVisualizationUid ) ).thenReturn( visualizationSpy );
when( analyticsService.getAggregatedDataValueMapping( visualizationSpy ) ).thenReturn( valueMap );
final Grid expectedGrid = defaultVisualizationService.getVisualizationGridByUser( anyVisualizationUid,
anyRelativePeriodDate, anyOrganisationUnitUid, userStub );
// Then
assertThat( expectedGrid.getRows(), hasSize( 1 ) );
assertThat( expectedGrid.getRows().get( 0 ), hasSize( 7 ) );
assertThat( expectedGrid.getRows().get( 0 ), hasItem( "abc123xy" ) );
assertThat( expectedGrid.getHeaders(), hasSize( 7 ) );
assertThat( expectedGrid.getMetaColumnIndexes(), hasSize( 7 ) );
assertThatHeadersAreTheExpectedOnes( expectedGrid );
verify( organisationUnitService, times( 1 ) ).getOrganisationUnitsAtLevels( orgUnitLevels, orgUnits );
verify( visualizationSpy, times( 1 ) ).clearTransientState();
}
@Test
public void getVisualizationGridByUserWhenItHasItemOrganisationUnitGroups()
{
// Given
final String anyVisualizationUid = "adbet5RTs";
final Date anyRelativePeriodDate = new Date();
final String anyOrganisationUnitUid = "ouiRzW5e";
final User userStub = userStub();
final List<OrganisationUnit> orgUnits = asList( new OrganisationUnit() );
final List<OrganisationUnitGroup> orgUnitGroups = asList( new OrganisationUnitGroup() );
final Map<String, Object> valueMap = valueMapStub();
final Visualization visualizationStub = visualizationStub( "abc123xy" );
visualizationStub.setOrganisationUnits( orgUnits );
visualizationStub.setItemOrganisationUnitGroups( orgUnitGroups );
final Visualization visualizationSpy = spy( visualizationStub );
// When
when( visualizationStore.getByUid( anyVisualizationUid ) ).thenReturn( visualizationSpy );
when( analyticsService.getAggregatedDataValueMapping( visualizationSpy ) ).thenReturn( valueMap );
final Grid expectedGrid = defaultVisualizationService.getVisualizationGridByUser( anyVisualizationUid,
anyRelativePeriodDate, anyOrganisationUnitUid, userStub );
// Then
assertThat( expectedGrid.getRows(), hasSize( 1 ) );
assertThat( expectedGrid.getRows().get( 0 ), hasSize( 7 ) );
assertThat( expectedGrid.getRows().get( 0 ), hasItem( "abc123xy" ) );
assertThat( expectedGrid.getHeaders(), hasSize( 7 ) );
assertThat( expectedGrid.getMetaColumnIndexes(), hasSize( 7 ) );
assertThatHeadersAreTheExpectedOnes( expectedGrid );
verify( organisationUnitService, times( 1 ) ).getOrganisationUnits( orgUnitGroups, orgUnits );
verify( visualizationSpy, times( 1 ) ).clearTransientState();
}
private void assertThatHeadersAreTheExpectedOnes( Grid expectedGrid )
{
final List<GridHeader> gridHeaders = expectedGrid.getHeaders();
assertThat( "Header must be present: dataid", gridContains( gridHeaders, "dataid" ) );
assertThat( "Header must be present: dataname", gridContains( gridHeaders, "dataname" ) );
assertThat( "Header must be present: datacode", gridContains( gridHeaders, "datacode" ) );
assertThat( "Header must be present: datadescription", gridContains( gridHeaders, "datadescription" ) );
assertThat( "Header must be present: reporting_month_name",
gridContains( gridHeaders, "reporting_month_name" ) );
assertThat( "Header must be present: param_organisationunit_name",
gridContains( gridHeaders, "param_organisationunit_name" ) );
assertThat( "Header must be present: organisation_unit_is_parent",
gridContains( gridHeaders, "organisation_unit_is_parent" ) );
}
private boolean gridContains( final List<GridHeader> gridHeaders, final String columnHeader )
{
return gridHeaders.removeIf( gridHeader -> gridHeader.getColumn().equals( columnHeader ) );
}
private User userStub()
{
final User userStub = new User();
userStub.setName( "John" );
userStub.setSurname( "Rambo" );
return userStub;
}
private Visualization visualizationStub( final String dimensionItem )
{
final List<String> rowsDimensions = asList( "dx" );
final List<DimensionalItemObject> dimensionalItemObjects = asList(
baseDimensionalItemObjectStub( dimensionItem ) );
final Visualization visualization = new Visualization();
visualization.setRowDimensions( rowsDimensions );
visualization.setGridRows( asList( dimensionalItemObjects ) );
return visualization;
}
private Map<String, Object> valueMapStub()
{
final Map<String, Object> valueMap = new HashMap<>();
valueMap.put( "key1", "value1" );
return valueMap;
}
private BaseDimensionalItemObject baseDimensionalItemObjectStub( final String dimensionItem )
{
final BaseDimensionalItemObject baseDimensionalItemObject = new BaseDimensionalItemObject( dimensionItem );
baseDimensionalItemObject.setDisplayDescription( "display " + dimensionItem );
return baseDimensionalItemObject;
}
} | [
"[email protected]"
] | |
ca92f84207b4641e73a8ea4cfe13f131b3cc17c0 | ddd51aecb2c5c0055d14248e9a314579256ab8ee | /Stc.java | 00c4f89d79a8d1a21b88f2e6996c474c4bceaa0d | [] | no_license | DiegoPortillo13/EDD_PRAC_EVA-2_16550508 | f724b6e0cf65ad83a37eef7aab1fcf8da6af4ab3 | b6b9d03e91d62a9d3fe330f5417f92f0918bcccb | refs/heads/master | 2021-08-23T00:48:34.717804 | 2017-12-02T00:15:08 | 2017-12-02T00:15:08 | 112,797,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java |
import java.util.Stack;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Familia
*/
public class Stc {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Stack <Double> sMipila = new Stack();
sMipila.push(20.0);
sMipila.push(25.0);
sMipila.push(30.0);
sMipila.push(35.0);
sMipila.push(40.0);
sMipila.push(45.0);
System.out.println(sMipila.pop());
System.out.println(sMipila.pop());
System.out.println(sMipila.peek());
}
}
| [
"[email protected]"
] | |
32b955a8195b4b70dd3dd8bae3cb1ecf7b3d173a | fafa9f6332c8725a4a0bc2cf602e0444ca0fea81 | /person-command/src/main/java/org/bull/examples/karaf/person/command/ListPersonsCommand.java | c453d101e781ee95df29428da58792d5cec0ae9c | [] | no_license | guillaumelamirand/Karaf-POC | a37e65ea5ac3d2de45df80f6ea182083cdaeabd9 | beaaa203c0dd746cb4cc74aca1bbf7acd1e0eb0b | refs/heads/master | 2021-05-27T15:48:59.696878 | 2013-05-02T21:31:35 | 2013-05-02T21:31:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,641 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.bull.examples.karaf.person.command;
import java.util.List;
import org.apache.felix.service.command.CommandSession;
import org.apache.karaf.shell.commands.Action;
import org.apache.karaf.shell.commands.Command;
import org.bull.examples.karaf.person.model.PersonDAO;
import org.bull.examples.karaf.person.model.PersonModel;
@Command(scope = "person", name = "list", description = "Lists all persons")
public class ListPersonsCommand implements Action
{
private PersonDAO personDAO;
public void setPersonDAO(final PersonDAO pPersonDAO)
{
personDAO = pPersonDAO;
}
@Override
public Object execute(final CommandSession session) throws Exception
{
final List<PersonModel> persons = personDAO.getAll();
for (final PersonModel person : persons)
{
System.out.println(person.toString());
}
return null;
}
}
| [
"[email protected]"
] | |
e33d6944fb979d76c7c59728adcf1a62a3fa9858 | 9abf822c4d16bbfb9852ddd955b10fdaf7605e20 | /src/main/java/com/wj/bookmanager/utils/UuidUtils.java | dffc4d9801e1f7133885ee57e1f63368d5eb8697 | [] | no_license | xhuwanjia/BookManager | 979ea9b2f05faa79b4bfd2c932335358adc74b97 | fb68a4d8fa82293ce2cb3ae1c2ada46aae85f0a5 | refs/heads/master | 2022-04-25T09:48:18.959380 | 2020-04-24T14:23:04 | 2020-04-24T14:23:04 | 258,528,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package com.wj.bookmanager.utils;
import java.util.UUID;
public class UuidUtils {
public static String next(){
return UUID.randomUUID().toString().replace("-","a");
}
}
| [
"[email protected]"
] | |
edac6879e0c258115ae92bd0b427461751cfe65a | 7694b874bf37c39173380706158f76931fa553ab | /app/src/androidTest/java/com/abhro/braintrainer/ExampleInstrumentedTest.java | dc78e1c429fb63bc835cbe0ac22dae34e985233f | [] | no_license | abhrodeep/BrainTrainer | 421ee27fa9ce178bc2f64647279d5a74a04a19bf | ce09dc680a00a8d9d67019657b7f95fdc65cb7e2 | refs/heads/master | 2021-04-12T12:10:47.307667 | 2018-03-21T14:38:37 | 2018-03-21T14:38:37 | 126,191,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package com.abhro.braintrainer;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.abhro.braintrainer", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
62151c7167a4af09c923f2e60d091107d9b4d3a7 | 1f76574bb6012e681d5c6aa6e42781fe76691142 | /src/java/Facade/AtencioncursoFacade.java | 5a658578c84999ea4d6422c35d92823bb03d2fdc | [] | no_license | santiagorozo/POVG7 | 0bc821ae585ab9f685741adf7a589a27eba58d28 | 83b39b82859e97217663441885a7bc76b2af6f8a | refs/heads/master | 2022-12-18T21:41:06.290910 | 2020-06-14T18:56:55 | 2020-06-14T18:56:55 | 272,268,596 | 0 | 0 | null | 2020-06-14T19:21:58 | 2020-06-14T19:21:57 | null | UTF-8 | Java | false | false | 1,034 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Facade;
import Entidades.Atencioncurso;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
/**
*
* @author kesgr
*/
@Stateless
public class AtencioncursoFacade extends AbstractFacade<Atencioncurso> {
@PersistenceContext(unitName = "POV_Gaes7PU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public AtencioncursoFacade() {
super(Atencioncurso.class);
}
public List<Atencioncurso> consultarAtencioncurso(int estado){
Query q = em.createQuery("SELECT acur FROM Atencioncurso acur WHERE acur.estado=:estado");
q.setParameter("estado", estado);
return q.getResultList();
}
}
| [
"[email protected]"
] | |
904a12b7db4c6ee32ac7136d8c089c126465346b | 59ee8e11931d794428a829e94b412c77eb339fac | /patrimonio-api/src/main/java/com/api/patrimonio/PatrimonioApiApplication.java | eec2646f9b5d9254c6a5e7731912aadebd6e2e00 | [] | no_license | ealvess/App-Angular4-e-Spring-Boot | 4aec7b8bb40bf7e8f3d1a1ceb9ef19e860d65ae9 | 2d4304111c209866b7d7428a2daf5c7d2910c0fb | refs/heads/master | 2023-03-07T08:18:19.180442 | 2018-03-27T19:03:44 | 2018-03-27T19:03:44 | 127,032,515 | 0 | 0 | null | 2023-03-01T19:01:51 | 2018-03-27T18:56:12 | TypeScript | UTF-8 | Java | false | false | 324 | java | package com.api.patrimonio;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class PatrimonioApiApplication {
public static void main(String[] args) {
SpringApplication.run(PatrimonioApiApplication.class, args);
}
}
| [
"[email protected]"
] | |
4fe130ccda76c908d75fbf7a1edcc8384d3b1451 | 334027b209869f2f1102efdd004f2a980c473401 | /src/test/java/SampleClientTest.java | 5a1835b76f501dfa9e7f362f93d61ca2196691fc | [
"Apache-2.0"
] | permissive | abhisheksontakke7/playground-basic | 4f1f6454d0d977ae6a92b456c1d30c7983d7adf4 | cb08b9dd37380d1e2aa3121e81c1e0dfdf42d28c | refs/heads/main | 2023-04-19T00:51:42.832624 | 2021-05-04T12:58:31 | 2021-05-04T12:58:31 | 363,159,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | import java.util.List;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import com.playground.basic.util.FileUtil;
public class SampleClientTest {
@Test
public void testMain() throws Exception{
FileUtil fileUtil = new FileUtil();
List<String> list = SampleClient.getFileContents("D:/test", "test.txt", fileUtil);
SampleClient.main(new String[]{""});
assertTrue(list.size() > 0);
}
}
| [
"[email protected]"
] | |
236af6af1db3173cc35b958ad5e5658c92c031fd | 30980517b45cdd0c4fb536f18cfc1f2588e86486 | /rnd/create-lib/Android-lib/fb-like/src/main/java/com/inthecheesefactory/lib/fblike/widget/FBLikeView.java | 4dcb7ab0ea02f343ec59b6f64b3c3fca8f37c9f5 | [
"Apache-2.0"
] | permissive | prashant31191/alldemos | e05214dd4432febb7f68cfef528baaa1c757d7ac | fb3e323ade134a9b2bf17b57c7c2e0a37b121b64 | refs/heads/master | 2021-09-08T02:53:11.675499 | 2018-03-06T07:29:07 | 2018-03-06T07:29:07 | 113,139,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,760 | java | package com.inthecheesefactory.lib.fblike.widget;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.facebook.share.widget.LikeView;
import com.inthecheesefactory.lib.fblike.R;
import com.inthecheesefactory.lib.fblike.bus.BusEventCallbackManagerActivityResult;
import com.inthecheesefactory.lib.fblike.bus.BusEventLoginStatusUpdated;
import com.inthecheesefactory.lib.fblike.bus.FBLikeBus;
import com.squareup.otto.Subscribe;
import java.util.Arrays;
/**
* Created by nuuneoi on 4/25/2015.
*/
public class FBLikeView extends FrameLayout {
LinearLayout btnLoginToLike;
LikeView likeView;
TextView tvLogin;
public FBLikeView(Context context) {
super(context);
initInflate();
initInstances();
}
public FBLikeView(Context context, AttributeSet attrs) {
super(context, attrs);
initInflate();
initInstances();
initWithAttrs(attrs, 0, 0);
}
public FBLikeView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initInflate();
initInstances();
initWithAttrs(attrs, defStyleAttr, 0);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public FBLikeView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initInflate();
initInstances();
initWithAttrs(attrs, defStyleAttr, defStyleRes);
}
private void initInflate() {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.login_to_like, this);
}
private void initWithAttrs(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
int[] set = {
android.R.attr.text // idx 0
};
TypedArray a = getContext().obtainStyledAttributes(attrs, set, defStyleAttr, defStyleRes);
try {
if (a.hasValue(0)) {
String text = a.getString(0);
setText(text);
}
} finally {
a.recycle();
}
}
private void initInstances() {
btnLoginToLike = (LinearLayout) findViewById(R.id.btnLoginToLike);
tvLogin = (TextView) findViewById(R.id.tvLogin);
likeView = (LikeView) findViewById(R.id.internalLikeView);
likeView.setLikeViewStyle(LikeView.Style.STANDARD);
likeView.setAuxiliaryViewPosition(LikeView.AuxiliaryViewPosition.INLINE);
btnLoginToLike.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (getContext() != null && getContext() instanceof Activity)
LoginManager.getInstance().logInWithReadPermissions((Activity) getContext(), Arrays.asList("public_profile"));
}
});
initializeCallbackManager();
refreshButtonsState();
}
public LikeView getLikeView() {
return likeView;
}
public void setText(@Nullable CharSequence text) {
tvLogin.setText(text);
}
public void setText(@Nullable CharSequence text, @Nullable TextView.BufferType type) {
tvLogin.setText(text, type);
}
public void setText(char[] text, int start, int len) {
tvLogin.setText(text, start, len);
}
public void setText(@StringRes int resId) {
tvLogin.setText(resId);
}
public void setText(@StringRes int resId, @Nullable TextView.BufferType type) {
tvLogin.setText(resId, type);
}
public CharSequence getText() {
return tvLogin.getText();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
refreshButtonsState();
FBLikeBus.getInstance().register(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
FBLikeBus.getInstance().unregister(this);
}
@Subscribe
public void busReceived(BusEventLoginStatusUpdated event) {
refreshButtonsState();
}
@Subscribe
public void busReceived(BusEventCallbackManagerActivityResult event) {
_onActivityResult(event.getRequestCode(), event.getResultCode(), event.getData());
}
private void refreshButtonsState() {
if (!isLoggedIn()) {
btnLoginToLike.setVisibility(View.VISIBLE);
likeView.setVisibility(View.GONE);
} else {
btnLoginToLike.setVisibility(View.GONE);
likeView.setVisibility(View.VISIBLE);
}
}
private static CallbackManager callbackManager;
private static void initializeCallbackManager() {
if (callbackManager == null) {
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
FBLikeView.loginStatusChanged();
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException e) {
}
});
}
}
public static void loginStatusChanged() {
FBLikeBus.getInstance().post(new BusEventLoginStatusUpdated());
}
public static void onActivityResult(int requestCode, int resultCode, Intent data) {
FBLikeBus.getInstance().post(new BusEventCallbackManagerActivityResult(requestCode, resultCode, data));
}
public static void _onActivityResult(int requestCode, int resultCode, Intent data) {
if (callbackManager != null)
callbackManager.onActivityResult(requestCode, resultCode, data);
}
public static boolean isLoggedIn() {
return AccessToken.getCurrentAccessToken() != null;
}
public static void logout() {
LoginManager.getInstance().logOut();
FBLikeView.loginStatusChanged();
}
}
| [
"[email protected]"
] | |
76d80b3aed6a9344d3e13f669a68481b24d41f4b | a2e37e9fac245226ab9fe6bca9f9a0f3e9174059 | /src/main/java/net/brewspberry/dao/SimpleYeastDAOImpl.java | 51eab3087bc7b4711226955bf953e08009388be3 | [] | no_license | biologeek/brewspberry-core | 80ce27c807ee7555ddb08c0fb0a7b9e5b7c461ee | 06184abec329e706d2b6f5127be1f2525a4db010 | refs/heads/master | 2021-01-21T03:46:12.907029 | 2016-05-08T12:34:52 | 2016-05-08T12:34:52 | 43,710,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,014 | java | package net.brewspberry.dao;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.StatelessSession;
import org.hibernate.Transaction;
import net.brewspberry.business.IGenericDao;
import net.brewspberry.business.beans.SimpleLevure;
import net.brewspberry.exceptions.DAOException;
import net.brewspberry.util.HibernateUtil;
public class SimpleYeastDAOImpl implements IGenericDao<SimpleLevure> {
Session session = HibernateUtil.getSession();
StatelessSession statelessSession = HibernateUtil.getStatelessSession();
@Override
public void deleteElement(long arg0) {
session.delete((SimpleLevure) session.get(SimpleLevure.class, arg0));
HibernateUtil.closeSession();
}
@Override
public void deleteElement(SimpleLevure arg0) {
session.delete(arg0);
HibernateUtil.closeSession();
}
@SuppressWarnings("unchecked")
@Override
public List<SimpleLevure> getAllDistinctElements() {
List<SimpleLevure> result = new ArrayList<SimpleLevure>();
result = session.createQuery("from SimpleLevure group by ing_desc")
.list();
HibernateUtil.closeSession();
return result;
}
@SuppressWarnings("unchecked")
@Override
public List<SimpleLevure> getAllElements() {
long resultId;
List<SimpleLevure> result = new ArrayList<SimpleLevure>();
result = (List<SimpleLevure>) session.createQuery("from SimpleLevure")
.list();
HibernateUtil.closeSession();
return result;
}
@Override
public SimpleLevure getElementById(long arg0) {
SimpleLevure lev = (SimpleLevure) session.get(SimpleLevure.class, arg0);
HibernateUtil.closeSession();
return lev;
}
@Override
public SimpleLevure save(SimpleLevure arg0) throws DAOException {
Transaction tx = session.beginTransaction();
SimpleLevure result = new SimpleLevure();
try {
long resultId = (long) session.save(arg0);
result = (SimpleLevure) session.get(SimpleLevure.class, resultId);
tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
tx.rollback();
} finally {
HibernateUtil.closeSession();
}
return result;
}
@Override
public SimpleLevure update(SimpleLevure arg0) {
Transaction tx = session.beginTransaction();
SimpleLevure result = new SimpleLevure();
if (arg0.getIng_id() != 0) {
try {
session.update(arg0);
tx.commit();
result = arg0;
} catch (HibernateException e) {
e.printStackTrace();
tx.rollback();
} finally {
HibernateUtil.closeSession();
}
} else {
try {
result = this.save(arg0);
} catch (HibernateException | DAOException e) {
e.printStackTrace();
tx.rollback();
} finally {
HibernateUtil.closeSession();
}
}
return result;
}
@Override
public SimpleLevure getElementByName(String name) {
SimpleLevure result = (SimpleLevure) session.createQuery(
"from SimpleLevure where ing_desc = '" + name + "'")
.uniqueResult();
HibernateUtil.closeSession();
return result;
}
}
| [
"[email protected]"
] | |
de3d292bd6e08db7b89875f08da9bd8fec656da7 | f7b077acebd54c792e772f952fff5f2c016c1e20 | /SpringOpenProject/src/main/java/com/openproject/controller/member/MemberLogoutController.java | 6cc982164944097a9b5211984f0353fb30aaadff | [] | no_license | JChan0102/OpenProjectSpring | f3f794316386c436838de4bd9fb704a000935780 | 402ce67ebd931a52676d86dcbe1cf67049be72f9 | refs/heads/master | 2020-04-01T20:31:52.754540 | 2018-12-06T10:11:25 | 2018-12-06T10:11:25 | 153,608,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package com.openproject.controller.member;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MemberLogoutController {
@RequestMapping(value="/member/logout")
public String delSession(HttpServletRequest request) {
request.getSession(false).invalidate();
return "index";
}
}
| [
"[email protected]"
] | |
f7127da5494965743d006efdf58cbf536d9cc4f1 | 9ef66583b9180936eee9169857f16c87bdfd76f8 | /src/com/coursera/ita/rn/TopicoRN.java | b4ef1c8935466d8c7b469cddcd8fb67485a5641e | [] | no_license | leonardoleal/courseraITAForum | d8507ec392bb527562fa2ac29060ea76abb45eae | 1232f74cff1781f5298e1505f0d0bb7c8d2635f1 | refs/heads/master | 2021-01-09T07:03:57.318425 | 2016-09-25T16:54:09 | 2016-09-25T17:02:12 | 68,427,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,539 | java | package com.coursera.ita.rn;
import java.util.List;
import com.coursera.ita.entity.Pontos;
import com.coursera.ita.entity.Topico;
import com.coursera.ita.exception.FalhaInserirTopico;
import com.coursera.ita.exception.FalhaSelecionarTopico;
import com.coursera.ita.persistence.TopicoPostgreDAO;
import com.coursera.ita.persistence.UsuarioPostgreDAO;
import com.coursera.ita.persistence.dao.TopicoDAO;
import com.coursera.ita.persistence.dao.UsuarioDAO;
public class TopicoRN {
public List<Topico> buscarTodosCabecalhos() {
TopicoDAO topicoDAO = new TopicoPostgreDAO();
return topicoDAO.buscarTodosCabecalhos();
}
public void cadastrar(Topico topico) throws FalhaInserirTopico {
TopicoDAO topicoDAO = new TopicoPostgreDAO();
UsuarioDAO usuarioDAO = new UsuarioPostgreDAO();
if (topico.getTitulo() == null || topico.getTitulo().isEmpty()
|| topico.getConteudo() == null || topico.getConteudo().isEmpty()
|| topico.getUsuario().getLogin() == null || topico.getUsuario().getLogin().isEmpty()) {
throw new FalhaInserirTopico("Todos os campos devem ser preenchidos.");
}
topicoDAO.inserir(topico);
usuarioDAO.adcionarPontos(topico.getUsuario(),
Pontos.NOVO_TOPICO.getValue());
}
public Topico buscarPorId(String id) throws FalhaSelecionarTopico {
TopicoDAO topicoDAO = new TopicoPostgreDAO();
try {
Integer id_topico = Integer.parseUnsignedInt(id);
return topicoDAO.buscarPorId(id_topico);
} catch (Exception e) {
throw new FalhaSelecionarTopico("Parâmetro inválido!!");
}
}
}
| [
"[email protected]"
] | |
0a704bfad37b3da25668a117a64e05b5f410cb2f | d6d55de3037420a0c47f9c2a3d7ee74d4a1dc768 | /container/openejb-core/src/main/java/org/apache/openejb/junit/ContainerRule.java | 56224f954156725aaa34bd694124fbdce4b66e85 | [
"Apache-2.0",
"W3C-19980720",
"W3C",
"BSD-3-Clause",
"CDDL-1.0",
"MIT"
] | permissive | apache/tomee | 9ae551e2f44d55b23d35a34aec392b86be2ca28e | a6acf05faf0931e71a45b52941d9b8e1ee7aa4c5 | refs/heads/main | 2023-08-25T11:56:17.487455 | 2023-08-08T14:27:16 | 2023-08-08T14:27:16 | 7,748,336 | 426 | 806 | Apache-2.0 | 2023-09-05T20:52:17 | 2013-01-22T08:00:16 | Java | UTF-8 | Java | false | false | 2,166 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.openejb.junit;
import org.apache.openejb.testing.ApplicationComposers;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import java.util.Objects;
public class ContainerRule implements TestRule {
private final Object instance;
public ContainerRule(final Object instance) {
this.instance = Objects.requireNonNull(instance);
}
public <T> T getInstance(final Class<T> as) {
return as.cast(instance);
}
@Override
public Statement apply(final Statement statement, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
final ApplicationComposers composers = new ContainerApplicationComposers(instance);
composers.startContainer(instance);
try {
statement.evaluate();
} finally {
composers.after();
}
}
};
}
public static class ContainerApplicationComposers extends ApplicationComposers {
public ContainerApplicationComposers(final Object modules) {
super(modules);
}
@Override
protected boolean isApplication() {
return false;
}
}
}
| [
"[email protected]"
] | |
e368da4fdf309dd1f70f8a516a1a211e770dd732 | 5342e985f7c8b4606d393d2bd21e6a5cb543d079 | /ADSProjSP17HoffmanTree/src/edu/ufl/alexgre/project/threestructure/FourWayHeap.java | d4ed16bfcafce0c6eac5723b75c3b74316f3bc05 | [] | no_license | bugface/cop5536sp17HuffmanCoding | 16c0b97c0dafdda14bf46aaa691cb027eb9e6083 | fe6bccaac9f0f67d13c0c1abcdeba72e8dbc77d4 | refs/heads/master | 2021-06-17T15:28:19.526364 | 2017-05-16T15:06:44 | 2017-05-16T15:06:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,101 | java | package edu.ufl.alexgre.project.threestructure;
import java.util.ArrayList;
public class FourWayHeap extends Heap{
ArrayList<HuffmanNode> heap = new ArrayList<HuffmanNode>();
private static final int dary = 4;
@Override
public void add(HuffmanNode node) {
if(node == null)
return;
HuffmanNode fNode = node;
heap.add(fNode);
heafyUp(heap.size() - 1, fNode);
}
private void heafyUp(int index, HuffmanNode fNode) {
for(; index > 0;){
int pIndex = (index - 1) / dary;
if(fNode.compareTo(heap.get(pIndex)) >= 0){
break;
}
swap(heap, pIndex, index);
index = pIndex;
}
}
private void heafydown(int index, HuffmanNode fNode) {
int size = heap.size();
HuffmanNode cMin = null;
for(;;){
int cIndex = index * dary + 1;
if(cIndex >= size)
break;
cMin = heap.get(cIndex);
int increment = 0;
for(int k = 1; k < dary; k++){
if((cIndex + k) >= size)
break;
HuffmanNode curChild = heap.get(cIndex + k);
if(cMin.compareTo(curChild) > 0){
cMin = curChild;
increment = k;
}
}
cIndex = cIndex + increment;
if(fNode.compareTo(cMin) < 0)
break;
swap(heap, index, cIndex);
index = cIndex;
}
}
private void swap(ArrayList<HuffmanNode> heap, int pIndex, int cIndex){
HuffmanNode temp = heap.get(pIndex);
heap.set(pIndex, heap.get(cIndex));
heap.set(cIndex, temp);
}
@Override
public HuffmanNode deletMin() {
int size = heap.size();
if(size == 0)
throw new UnderflowException("The heap is empty!");
if(size == 1)
return heap.remove(0);
HuffmanNode min = heap.get(0);
heap.set(0, heap.remove(size - 1));
heafydown(0, heap.get(0));
return min;
}
@Override
public int size() {
return heap.size();
}
@Override
public HuffmanNode getRoot() {
return heap.size() == 0 ? null : heap.get(0);
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
for(HuffmanNode hn: heap){
sb.append(hn.tag + " : " + hn.freq + " ");
}
sb.append("\n");
return sb.toString();
}
}
| [
"[email protected]"
] | |
4055cff3b96448c690b66df1ed28398173c1bd9e | c5e7916e5c89f494135fffe1e2031c2d926a068a | /thuchanhtichmatranvachuyenvi/src/main/java/MAIN.java | c7f4a34b4eb1734e8c7d8aa0b252d8b0e5b3169c | [] | no_license | ngochuy2901/Lap-Trinh-Huong-Doi-Tuong | d7743c15fd84f533907609065937298ce5d7a826 | 3edfa4642e2acabe1b4721bee825baf0dcb39e56 | refs/heads/master | 2023-09-06T08:24:03.894339 | 2021-10-27T07:21:00 | 2021-10-27T07:21:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,198 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author huy
*/
import java.util.Scanner;
public class MAIN {
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
// Scanner sc=new Scanner(System.in);
int test = sc.nextInt();
int n = sc.nextInt();
int m = sc.nextInt();
int a[][] = new int[100][100];
int b[][] = new int[100][100];
int c[][] = new int[100][100];
for(int i=0;i<n;i++)
for(int j=0;j<m;j++){
a[i][j] = sc.nextInt();
b[j][i] = a[i][j];
}
for(int i=1;i<=test;i++) {
System.out.println("Test " + i + ":");
}
for(int i=0;i<n;i++) {
for(int j=0;j<n;j++) {
c[i][j]=0;
for(int k=0;k<m;k++) {
c[i][j]+= a[i][k]*b[k][j];
}
System.out.print(c[i][j]+ " ");
}
System.out.println();
}
}
}
| [
"[email protected]"
] | |
b6b410574acf87949cf8d25e469bf84fd7db5771 | ee0662bc9a4370d1dfda2906f7c8dc164def6b8d | /MortgageCalculator/src/com/example/mortgagecalculator/MainActivity.java | 1fe99deafd468bdf0c32de702a6897390a971dfc | [] | no_license | HaiYangShen/331Homework2 | b5641b11b54c3ed2484cdf18e38e49a872eea00d | 2e5eee534722f129620bbffd79c9b37d146be1dd | refs/heads/master | 2021-01-10T00:52:59.545264 | 2015-03-15T18:21:53 | 2015-03-15T18:21:53 | 32,276,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,284 | java | package com.example.mortgagecalculator;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import java.text.NumberFormat; // for currency formatting
import android.text.Editable; // for EditText event handling
import android.text.TextWatcher; // EditText listener
import android.widget.EditText; // for bill amount input
import android.widget.SeekBar; // for changing custom tip percentage
import android.widget.SeekBar.OnSeekBarChangeListener; // SeekBar listener
import android.widget.TextView; // for displaying text
public class MainActivity extends Activity {
private static final NumberFormat currencyFormat =
NumberFormat.getCurrencyInstance();
private static final NumberFormat percentFormat =
NumberFormat.getPercentInstance();
private static final NumberFormat intFormat =
NumberFormat.getIntegerInstance();
private double purchasePriceAmount = 0.0;
private double downPaymentAmount = 0.0;
private double interestRateAmount = 0.0;
private int customYear = 15;
private TextView purchasePriceAmountView;
private TextView downPaymentAmountView;
private TextView interestRateAmountView;
private TextView customMonthlyView;
private TextView year10MonthlyAmountView;
private TextView year20MonthlyAmountView;
private TextView year30MonthlyAmountView;
private TextView customMonthlyAmountView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
purchasePriceAmountView =
(TextView) findViewById(R.id.purchasePriceAmountView);
downPaymentAmountView =
(TextView) findViewById(R.id.downPaymentAmountView);
interestRateAmountView =
(TextView) findViewById(R.id.interestRateAmountView);
customMonthlyView =
(TextView) findViewById(R.id.customMonthlyView);
year10MonthlyAmountView =
(TextView) findViewById(R.id.year10MonthlyAmountView);
year20MonthlyAmountView =
(TextView) findViewById(R.id.year20MonthlyAmountView);
year30MonthlyAmountView =
(TextView) findViewById(R.id.year30MonthlyAmountView);
customMonthlyAmountView =
(TextView) findViewById(R.id.customMonthlyAmountView);
purchasePriceAmountView.setText(
currencyFormat.format(purchasePriceAmount));
downPaymentAmountView.setText(
currencyFormat.format(downPaymentAmount));
interestRateAmountView.setText(
percentFormat.format(interestRateAmount));
updateStandard();
updateCustom();
EditText purchasePriceEditAmount =
(EditText) findViewById(R.id.purchasePriceEditAmount);
purchasePriceEditAmount.addTextChangedListener(purchasePriceEditAmountWatcher);
EditText downPaymentEditAmount =
(EditText) findViewById(R.id.downPaymentEditAmount);
downPaymentEditAmount.addTextChangedListener(downPaymentEditAmountWatcher);
EditText interestRateEditAmount =
(EditText) findViewById(R.id.interestRateEditAmount);
interestRateEditAmount.addTextChangedListener(interestRateEditAmountWatcher);
SeekBar periodAmountSeekBar =
(SeekBar) findViewById(R.id.periodAmountSeekBar);
periodAmountSeekBar.setOnSeekBarChangeListener(periodAmountSeekBarListener);
}
private void updateStandard(){
double year10MonthlyAmount = ((purchasePriceAmount-downPaymentAmount)
* (interestRateAmount*Math.pow((1+interestRateAmount),120))
/(Math.pow((1+interestRateAmount),120)-1));
double year20MonthlyAmount = ((purchasePriceAmount-downPaymentAmount)
* (interestRateAmount*Math.pow((1+interestRateAmount),240))
/(Math.pow((1+interestRateAmount),240)-1));
double year30MonthlyAmount = ((purchasePriceAmount-downPaymentAmount)
* (interestRateAmount*Math.pow((1+interestRateAmount),360))
/(Math.pow((1+interestRateAmount),360)-1));
year10MonthlyAmountView.setText(currencyFormat.format(year10MonthlyAmount));
year20MonthlyAmountView.setText(currencyFormat.format(year20MonthlyAmount));
year30MonthlyAmountView.setText(currencyFormat.format(year30MonthlyAmount));
}
private void updateCustom(){
customMonthlyView.setText(intFormat.format(customYear)+"years");
double customMonthlyAmount = ((purchasePriceAmount-downPaymentAmount)
* (interestRateAmount*Math.pow((1+interestRateAmount),customYear*12))
/(Math.pow((1+interestRateAmount),customYear*12)-1));
customMonthlyAmountView.setText(currencyFormat.format(customMonthlyAmount));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
private TextWatcher purchasePriceEditAmountWatcher = new TextWatcher()
{
// called when the user enters a number
@Override
public void onTextChanged(CharSequence s, int start,
int before, int count)
{
// convert amountEditText's text to a double
try
{
purchasePriceAmount = Double.parseDouble(s.toString());
} // end try
catch (NumberFormatException e)
{
purchasePriceAmount = 0.0; // default if an exception occurs
} // end catch
// display currency formatted bill amount
purchasePriceAmountView.setText(currencyFormat.format(purchasePriceAmount));
updateStandard(); // update the 15% tip TextViews
updateCustom(); // update the custom tip TextViews
} // end method onTextChanged
@Override
public void afterTextChanged(Editable s)
{
} // end method afterTextChanged
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after)
{
} // end method beforeTextChanged
};// end purchasePriceEditTextWatcher
private TextWatcher downPaymentEditAmountWatcher = new TextWatcher()
{
// called when the user enters a number
@Override
public void onTextChanged(CharSequence s, int start,
int before, int count)
{
// convert amountEditText's text to a double
try
{
downPaymentAmount = Double.parseDouble(s.toString());
} // end try
catch (NumberFormatException e)
{
downPaymentAmount = 0.0; // default if an exception occurs
} // end catch
// display currency formatted bill amount
downPaymentAmountView.setText(currencyFormat.format(downPaymentAmount));
updateStandard(); // update the 15% tip TextViews
updateCustom(); // update the custom tip TextViews
} // end method onTextChanged
@Override
public void afterTextChanged(Editable s)
{
} // end method afterTextChanged
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after)
{
} // end method beforeTextChanged
};
private TextWatcher interestRateEditAmountWatcher = new TextWatcher()
{
// called when the user enters a number
@Override
public void onTextChanged(CharSequence s, int start,
int before, int count)
{
// convert amountEditText's text to a double
try
{
interestRateAmount = (Double.parseDouble(s.toString()) / 100.0)/12;
} // end try
catch (NumberFormatException e)
{
interestRateAmount = 0.0; // default if an exception occurs
} // end catch
// display currency formatted bill amount
interestRateAmountView.setText(percentFormat.format(interestRateAmount*12));
updateStandard(); // update the 15% tip TextViews
updateCustom(); // update the custom tip TextViews
} // end method onTextChanged
@Override
public void afterTextChanged(Editable s)
{
} // end method afterTextChanged
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after)
{
} // end method beforeTextChanged
};
private OnSeekBarChangeListener periodAmountSeekBarListener =
new OnSeekBarChangeListener()
{
// update customPercent, then call updateCustom
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser)
{
// sets customPercent to position of the SeekBar's thumb
customYear = progress;
updateCustom(); // update the custom tip TextViews
} // end method onProgressChanged
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
} // end method onStartTrackingTouch
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
} // end method onStopTrackingTouch
};
}
| [
"[email protected]"
] | |
f3da532bb6612f47419e74aa22f87eb0aeab1888 | 2869fc39e2e63d994d5dd8876476e473cb8d3986 | /Super_clutter/src/java/com/lvmama/clutter/service/client/v4_0_1/ClientUserServiceV401.java | 5e2404d7b99984d5a743eb61c50be3dae138e741 | [] | no_license | kavt/feiniu_pet | bec739de7c4e2ee896de50962dbd5fb6f1e28fe9 | 82963e2e87611442d9b338d96e0343f67262f437 | refs/heads/master | 2020-12-25T17:45:16.166052 | 2016-06-13T10:02:42 | 2016-06-13T10:02:42 | 61,026,061 | 0 | 0 | null | 2016-06-13T10:02:01 | 2016-06-13T10:02:01 | null | UTF-8 | Java | false | false | 23,066 | java | package com.lvmama.clutter.service.client.v4_0_1;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
import net.sf.json.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Logger;
import com.kayak.telpay.mpi.util.StringUtils;
import com.lvmama.clutter.exception.LogicException;
import com.lvmama.clutter.model.MobileOrder;
import com.lvmama.clutter.model.MobilePayment;
import com.lvmama.clutter.model.MobilePersonItem;
import com.lvmama.clutter.model.sumsang.Alert;
import com.lvmama.clutter.model.sumsang.Data;
import com.lvmama.clutter.model.sumsang.DateAlert;
import com.lvmama.clutter.model.sumsang.ElementDataBarcode;
import com.lvmama.clutter.model.sumsang.ElementDataImage;
import com.lvmama.clutter.model.sumsang.ElementDataText;
import com.lvmama.clutter.model.sumsang.GeofenceAlert;
import com.lvmama.clutter.model.sumsang.Head;
import com.lvmama.clutter.model.sumsang.P;
import com.lvmama.clutter.model.sumsang.Partner;
import com.lvmama.clutter.model.sumsang.ValidUntil;
import com.lvmama.clutter.model.sumsang.View;
import com.lvmama.clutter.service.client.v3_2.ClientUserServiceV321;
import com.lvmama.clutter.service.impl.ClientUserServiceImpl;
import com.lvmama.clutter.utils.ArgCheckUtils;
import com.lvmama.clutter.utils.JSONUtil;
import com.lvmama.comm.pet.po.mobile.MobileOrderRelationSamsung;
import com.lvmama.comm.pet.po.user.UserCooperationUser;
import com.lvmama.comm.vo.Constant;
public class ClientUserServiceV401 extends ClientUserServiceV321 {
//private static final Log log = LogFactory.getLog(ClientUserServiceImpl.class);
private final Logger logger = Logger.getLogger(this.getClass());
@Override
public MobileOrder getOrder(Map<String, Object> param) {
ArgCheckUtils.validataRequiredArgs("orderId", param);
MobileOrder mo = super.getMobileOrderByOrderId(
Long.valueOf(param.get("orderId").toString()),
String.valueOf(param.get("userNo")));
boolean isTrain = isTrain(mo.getMainProductType(),
mo.getMainSubProductType());
// 如果不是火车票
if (!isTrain) {
super.initBonus(mo);
}
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("userId", param.get("userId"));
List<UserCooperationUser> list = userCooperationUserService
.getCooperationUsers(parameters);
String channel = "";
if (list != null && !list.isEmpty()) {
UserCooperationUser cu = list.get(0);
channel = cu.getCooperation();
}
MobilePayment mpalipay = new MobilePayment(
Constant.PAYMENT_GATEWAY.ALIPAY_APP.name(), Constant
.getInstance().getAliPayAppUrl());
MobilePayment mpwap = new MobilePayment(
Constant.PAYMENT_GATEWAY.ALIPAY_WAP.name(), Constant
.getInstance().getAliPayWapUrl());
MobilePayment mpupompTest = new MobilePayment("UPOMP_OTHER", Constant
.getInstance().getUpompPayUrl());
MobilePayment mpupomp = new MobilePayment(
Constant.PAYMENT_GATEWAY.UPOMP.name(), Constant.getInstance()
.getUpompPayUrl());
MobilePayment tenpayWap = new MobilePayment("TENPAY_WAP", Constant
.getInstance().getTenpayWapUrl());
mo.getPaymentChannels().add(mpalipay);
mo.getPaymentChannels().add(mpwap);
mo.getPaymentChannels().add(mpupompTest);
mo.getPaymentChannels().add(tenpayWap);
mo.getPaymentChannels().add(mpupomp);
// isTrain 如果是火车票 - 屏蔽银联支付 ,isWP8 屏蔽银联支付
if ("ALIPAY".equals(channel) || "CLIENT_ANONYMOUS".equals(channel)
|| isTrain || this.isHopeChannel(param, Constant.MOBILE_PLATFORM.WP8.name())) {
mo.getPaymentChannels().remove(mpupomp);
mo.getPaymentChannels().remove(mpupompTest);
if ("ALIPAY".equals(channel)) {
mo.getPaymentChannels().remove(tenpayWap);
}
}
return mo;
}
/**
* 是否想要的渠道
* @param params 请求参数
* @param channel 想要的渠道
* @return
*/
public boolean isHopeChannel(Map<String,Object> params,String channel) {
boolean b = false;
try {
if(null != params && null != params.get("firstChannel")
&& StringUtils.isNotEmpty(params.get("firstChannel").toString())
&& channel.equalsIgnoreCase(params.get("firstChannel").toString())) {
b = true;
}
}catch(Exception e) {
e.printStackTrace();
}
return b;
}
/**
* 发布ticket
*
* @param param
* @return
*/
public Map<String, Object> issueTicket(Map<String, Object> param) {
Map<String, Object> resultMap = new HashMap<String, Object>();
MobileOrder mobileOrder = this.getOrder(param);
String serial = (String) param.get("serial");
long orderId = Long.parseLong((String)param.get("orderId"));
String mainProduceType = mobileOrder.getMainProductType();
String ticketId = null;
if(Constant.PRODUCT_TYPE.ROUTE.name().equals(mainProduceType)){
ticketId = this.sendRoute(mobileOrder,serial);
}else if(Constant.PRODUCT_TYPE.TICKET.name().equals(mainProduceType)){
ticketId = this.sendTicket(mobileOrder,serial);
}else{
}
//TODO 保存到数据库ticketId serial orderId
MobileOrderRelationSamsung result = mobileClientService.selectByOrderId(orderId);
if(null!=result){
}else{
MobileOrderRelationSamsung record = new MobileOrderRelationSamsung();
record.setTicketid(ticketId);
record.setSerial(serial);
record.setOrderid(orderId);
record.setCreateDate(Calendar.getInstance().getTime());
record.setUpdateDate(Calendar.getInstance().getTime());
mobileClientService.insert(record);
}
resultMap.put("ticketId", ticketId);
return resultMap;
}
private String sendRoute(MobileOrder mobileOrder,String serial) {
Data data = new Data();
Head head = new Head();
head.setVersion("1.1");
if(!StringUtils.isEmpty(serial)){
head.setSerial(serial);
}else{
head.setSerial(String.valueOf(System.currentTimeMillis()));
}
head.setSkinId("1646c78f-e61b-3823-a329-1c3fe04b5d4b");
head.setKeywords(new String[] { "lvmama", "route" });
head.setStorable(true);
String arrivalDateStr = mobileOrder.getVisitTime();
String format = "yyyy/MM/dd HH:mm";
if(!StringUtils.isEmpty(arrivalDateStr)){
try {
ValidUntil validUntil = new ValidUntil();
Date arrivalDateAddOne = DateUtils.addDays(DateUtils.parseDate(arrivalDateStr, "yyyy-MM-dd"), 1);
validUntil.setValue(DateFormatUtils.format(arrivalDateAddOne,
format));
validUntil.setFormat(format);
head.setValidUntil(validUntil);
} catch (ParseException e) {
e.printStackTrace();
}
}
data.setHead(head);
// views
List<View> views = new ArrayList<View>();
// barcode
View main_barcode_a = new View();
main_barcode_a.setId("MAIN_BARCODE_a");
ElementDataBarcode barcode = new ElementDataBarcode();
barcode.setCaption(String.valueOf(mobileOrder.getOrderId()));
barcode.setType("QRCODE");
barcode.setValue(String.valueOf(mobileOrder.getOrderId()));
main_barcode_a.setBarcode(barcode);
views.add(main_barcode_a);
// image
// String icon = mobileOrder.getImgUrl();
// if(!StringUtils.isEmpty(icon)){
// // image
// View main_middle_image_a = new View();
// main_middle_image_a.setId("MAIN_MIDDLE_IMAGE_a");
//
// ElementDataImage image = new ElementDataImage();
// String imgUrl = "http://pic.lvmama.com/pics/" + icon;
// image.setValue(this.getBase64Image(imgUrl));
// image.setType("jpg;base64");
// image.setAlign("middle");
//
// main_middle_image_a.setImage(image);
// views.add(main_middle_image_a);
// }
//list text1
View abstract_value2 = new View();
abstract_value2.setId("ABSTRACT_VALUE2");
ElementDataText abstract_value2Text = new ElementDataText();
abstract_value2Text.setValue(mobileOrder.getVisitTime());
abstract_value2Text.setAlign("middle");
abstract_value2.setText(abstract_value2Text);
views.add(abstract_value2);
//list text2
View abstract_value1 = new View();
abstract_value1.setId("ABSTRACT_VALUE1");
ElementDataText abstract_value1Text = new ElementDataText();
abstract_value1Text.setValue(mobileOrder.getCityName()+"游玩");
abstract_value1Text.setAlign("middle");
abstract_value1.setText(abstract_value1Text);
views.add(abstract_value1);
// 订单号
View main_top_value1_a = new View();
main_top_value1_a.setId("MAIN_TOP_VALUE1_a");
ElementDataText leftTopText = new ElementDataText();
leftTopText.setValue(String.valueOf(mobileOrder.getOrderId()));
leftTopText.setAlign("left");
main_top_value1_a.setText(leftTopText);
views.add(main_top_value1_a);
// from text
View main_middle_value1_a = new View();
main_middle_value1_a.setId("MAIN_MIDDLE_VALUE2_a");
ElementDataText leftMiddleText = new ElementDataText();
leftMiddleText.setValue(mobileOrder.getFromPlaceName());
leftMiddleText.setAlign("left");
main_middle_value1_a.setText(leftMiddleText);
views.add(main_middle_value1_a);
// dest text
View main_middle_value1_c = new View();
main_middle_value1_c.setId("MAIN_MIDDLE_VALUE2_c");
ElementDataText rightMiddleText = new ElementDataText();
String cityName = mobileOrder.getCityName();
if(StringUtils.isEmpty(cityName)){
cityName = mobileOrder.getDestPlaceName();
}
rightMiddleText.setValue(cityName);
rightMiddleText.setAlign("left");
main_middle_value1_c.setText(rightMiddleText);
views.add(main_middle_value1_c);
// 游玩人
List<MobilePersonItem> persons = mobileOrder.getListPerson();
StringBuffer buffer = new StringBuffer();
if(null!=persons&&persons.size()>0){//默认显示两个游玩人,如果大于2个则后面加“等”字
for(int i=0;i<persons.size();i++){
MobilePersonItem person = persons.get(i);
if("TRAVELLER".equals(person.getPersonType())){
buffer.append(person.getPersonName()+",");
if(i>=2){
buffer.append("等");
break;
}
}
}
if(buffer.lastIndexOf(",")!=-1){//订单信息中包含游玩人
buffer.deleteCharAt(buffer.lastIndexOf(","));
}else{//订单信息中包含游玩人,显示订单联系人
for(int i=0;i<persons.size();i++){
MobilePersonItem person = persons.get(i);
if("CONTACT".equals(person.getPersonType())){
buffer.append(person.getPersonName());
}
}
}
}
View main_bottom_value1_a = new View();
main_bottom_value1_a.setId("MAIN_BOTTOM_VALUE1_a");
ElementDataText leftBottomText1 = new ElementDataText();
leftBottomText1.setValue(buffer.toString());
leftBottomText1.setAlign("left");
main_bottom_value1_a.setText(leftBottomText1);
views.add(main_bottom_value1_a);
// 游玩时间
View main_aux1_value1_c = new View();
main_aux1_value1_c.setId("MAIN_AUX1_VALUE1_a");
ElementDataText rightText = new ElementDataText();
rightText.setValue(mobileOrder.getVisitTime());
rightText.setAlign("left");
main_aux1_value1_c.setText(rightText);
views.add(main_aux1_value1_c);
data.setView(views);
List<Alert> alerts = new ArrayList<Alert>();
Alert geofenceAlert = new Alert();
GeofenceAlert geofence = new GeofenceAlert();
geofence.setAltitude(null);
geofence.setLatitude(mobileOrder.getBaiduLatitude());
geofence.setLongitude(mobileOrder.getBaiduLongitude());
geofence.setRangeinmeter(10);
geofenceAlert.setId("ALERT1");
geofenceAlert.setGeofence(geofence);
alerts.add(geofenceAlert);
Alert timeAlert = new Alert();
DateAlert date = new DateAlert();
date.setBeforeinmin(5);
date.setFormat(format);
String visitTime = mobileOrder.getVisitTime();
Date visitDate = null;
try {
visitDate = DateUtils.parseDate(visitTime, "yyyy-MM-dd");
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (null != visitDate) {
date.setValue(DateFormatUtils.format(
DateUtils.addDays(visitDate, -2), format));
}
timeAlert.setDate(date);
alerts.add(timeAlert);
data.setAlerts(alerts);
List<Partner> partners = new ArrayList<Partner>();
Partner partner = new Partner();
P p = new P();
partner.setPartner(p);
partners.add(partner);
data.setPartners(partners);
System.out.println(data);
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod(
"https://api.wallet.samsung.com/tkt/tickets");
String authorization = new String(
Base64.encodeBase64("28bc72a1026d4239900235983ce17961:b0bd12e3b7b74b2fa11f4492504f1675"
.getBytes()));
System.out.println(authorization);
postMethod.setRequestHeader("X-TKT-Protocol-Version", "1.1");
postMethod.setRequestHeader("Authorization", "Basic " + authorization);
postMethod.setRequestHeader("Content-Type", "application/json");
postMethod.setRequestHeader("charset", "UTF-8");
String jsonDataStr = JSONUtil.jsonPropertyFilter(data).toString();
System.out.println(jsonDataStr);
RequestEntity requestEntity = new ByteArrayRequestEntity(
jsonDataStr.getBytes());
postMethod.setRequestEntity(requestEntity);
try {
int statusCode = httpClient.executeMethod(postMethod);
System.out.println(statusCode);
String strResponseBody = new String(postMethod.getResponseBody());
try {
JSONObject responseJsonObject = JSONObject.fromObject(strResponseBody);
String ticketId = (String) responseJsonObject.get("ticketId");
return ticketId;
} catch (Exception e) {
throw new LogicException("线路同步失败");
}
} catch (Exception e) {
throw new LogicException("线路同步失败");
} finally {
postMethod.releaseConnection();
}
}
private String sendTicket(MobileOrder mobileOrder,String serial) {
Data data = new Data();
Head head = new Head();
head.setVersion("1.1");
if(!StringUtils.isEmpty(serial)){
head.setSerial(serial);
}else{
head.setSerial(String.valueOf(System.currentTimeMillis()));
}
//head.setSkinId("edf1cae5-3a44-3c44-bd0d-42bed0844bc8");//之前的会员卡模板
head.setSkinId("5add1e22-c284-36fe-a4f1-cd92edd689ac");
head.setKeywords(new String[] { "lvmama", "ticket" });
head.setStorable(true);
String arrivalDateStr = mobileOrder.getVisitTime();
String format = "yyyy/MM/dd HH:mm";
if(!StringUtils.isEmpty(arrivalDateStr)){
try {
ValidUntil validUntil = new ValidUntil();
Date arrivalDateAddOne = DateUtils.addDays(DateUtils.parseDate(arrivalDateStr, "yyyy-MM-dd"), 1);
validUntil.setValue(DateFormatUtils.format(arrivalDateAddOne,
format));
validUntil.setFormat(format);
head.setValidUntil(validUntil);
} catch (ParseException e) {
e.printStackTrace();
}
}
data.setHead(head);
// views
List<View> views = new ArrayList<View>();
// barcode
View main_barcode_a = new View();
main_barcode_a.setId("MAIN_BARCODE_a");
ElementDataBarcode barcode = new ElementDataBarcode();
barcode.setCaption(String.valueOf(mobileOrder.getOrderId()));
barcode.setType("QRCODE");
barcode.setValue(String.valueOf(mobileOrder.getOrderId()));
main_barcode_a.setBarcode(barcode);
views.add(main_barcode_a);
// image
String icon = mobileOrder.getImgUrl();
if(!StringUtils.isEmpty(icon)){
// image
View main_middle_image_a = new View();
main_middle_image_a.setId("MAIN_MIDDLE_IMAGE_a");
ElementDataImage image = new ElementDataImage();
String imgUrl = "http://pic.lvmama.com/pics/" + icon;
image.setValue(this.getBase64Image(imgUrl));
image.setType("jpg;base64");
image.setAlign("middle");
main_middle_image_a.setImage(image);
views.add(main_middle_image_a);
}
//list text1
View abstract_value2 = new View();
abstract_value2.setId("ABSTRACT_VALUE2");
ElementDataText abstract_value2Text = new ElementDataText();
abstract_value2Text.setValue(mobileOrder.getVisitTime());
abstract_value2Text.setAlign("middle");
abstract_value2.setText(abstract_value2Text);
views.add(abstract_value2);
//list text2
View abstract_value1 = new View();
abstract_value1.setId("ABSTRACT_VALUE1");
ElementDataText abstract_value1Text = new ElementDataText();
abstract_value1Text.setValue(mobileOrder.getDestPlaceName()+"门票");
abstract_value1Text.setAlign("middle");
abstract_value1.setText(abstract_value1Text);
views.add(abstract_value1);
// top text
View main_top_value1_a = new View();
main_top_value1_a.setId("MAIN_TOP_VALUE1_a");
ElementDataText middleText = new ElementDataText();
String productName = mobileOrder.getProductName();
if(!StringUtils.isEmpty(productName)){//门票名称去掉门票类型
int index1 = productName.indexOf("(");
if(index1!=-1){
productName = productName.substring(0, index1);
}
int index2 = productName.indexOf("(");
if(index2!=-1){
productName = productName.substring(0, index2);
}
}
middleText.setValue(productName);
middleText.setAlign("middle");
main_top_value1_a.setText(middleText);
views.add(main_top_value1_a);
// 游玩时间
View main_middle_value1_a = new View();
main_middle_value1_a.setId("MAIN_BOTTOM_VALUE1_a");
ElementDataText leftText = new ElementDataText();
leftText.setValue(mobileOrder.getVisitTime());
leftText.setAlign("left");
main_middle_value1_a.setText(leftText);
views.add(main_middle_value1_a);
// 开园时间
View main_middle_value1_c = new View();
main_middle_value1_c.setId("MAIN_BOTTOM_VALUE1_c");
ElementDataText rightBottomText = new ElementDataText();
rightBottomText.setValue(mobileOrder.getScenicOpenTime());
rightBottomText.setAlign("left");
main_middle_value1_c.setText(rightBottomText);
views.add(main_middle_value1_c);
// 联系人
List<MobilePersonItem> persons = mobileOrder.getListPerson();
StringBuffer buffer = new StringBuffer();
if(null!=persons&&persons.size()>0){//联系人
for(int i=0;i<persons.size();i++){
MobilePersonItem person = persons.get(i);
if("CONTACT".equals(person.getPersonType())){
buffer.append(person.getPersonName());
}
}
}
View main_aux1_value1_a = new View();
main_aux1_value1_a.setId("MAIN_AUX1_VALUE1_a");
ElementDataText leftBottomText = new ElementDataText();
leftBottomText.setValue(buffer.toString());
leftBottomText.setAlign("left");
main_aux1_value1_a.setText(leftBottomText);
views.add(main_aux1_value1_a);
// 景区地址
View main_aux2_value1_a = new View();
main_aux2_value1_a.setId("MAIN_AUX2_VALUE1_a");
ElementDataText leftAux1Text = new ElementDataText();
leftAux1Text.setValue(mobileOrder.getAddress());
leftAux1Text.setAlign("left");
main_aux2_value1_a.setText(leftAux1Text);
views.add(main_aux2_value1_a);
data.setView(views);
List<Alert> alerts = new ArrayList<Alert>();
Alert geofenceAlert = new Alert();
GeofenceAlert geofence = new GeofenceAlert();
geofence.setAltitude(null);
geofence.setLatitude(mobileOrder.getBaiduLatitude());
geofence.setLongitude(mobileOrder.getBaiduLongitude());
geofence.setRangeinmeter(10);
geofenceAlert.setId("ALERT1");
geofenceAlert.setGeofence(geofence);
alerts.add(geofenceAlert);
Alert timeAlert = new Alert();
DateAlert date = new DateAlert();
date.setBeforeinmin(5);
date.setFormat(format);
String visitTime = mobileOrder.getVisitTime();
Date visitDate = null;
try {
visitDate = DateUtils.parseDate(visitTime, "yyyy-MM-dd");
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (null != visitDate) {
date.setValue(DateFormatUtils.format(
DateUtils.addDays(visitDate, -2), format));
}
timeAlert.setDate(date);
alerts.add(timeAlert);
data.setAlerts(alerts);
List<Partner> partners = new ArrayList<Partner>();
Partner partner = new Partner();
P p = new P();
partner.setPartner(p);
partners.add(partner);
data.setPartners(partners);
System.out.println(data);
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod(
"https://api.wallet.samsung.com/tkt/tickets");
// String authorization = new String(
// Base64.encodeBase64("b425124d16124697a6d54f3dd1b501ef:8cbf2d40b8dc48dc994680455445cd35"
// .getBytes()));
String authorization = new String(
Base64.encodeBase64("c364ee866cdd4eea8e90dd51f5e64fca:0d9daf4c620e408988f2eae4da5901ae"
.getBytes()));
System.out.println(authorization);
postMethod.setRequestHeader("X-TKT-Protocol-Version", "1.1");
postMethod.setRequestHeader("Authorization", "Basic " + authorization);
postMethod.setRequestHeader("Content-Type", "application/json");
postMethod.setRequestHeader("charset", "UTF-8");
String jsonDataStr = JSONUtil.jsonPropertyFilter(data).toString();
System.out.println(jsonDataStr);
RequestEntity requestEntity = new ByteArrayRequestEntity(
jsonDataStr.getBytes());
postMethod.setRequestEntity(requestEntity);
try {
int statusCode = httpClient.executeMethod(postMethod);
System.out.println(statusCode);
String strResponseBody = new String(postMethod.getResponseBody());
try {
JSONObject responseJsonObject = JSONObject.fromObject(strResponseBody);
String ticketId = (String) responseJsonObject.get("ticketId");
return ticketId;
} catch (Exception e) {
throw new LogicException("门票同步失败");
}
} catch (Exception e) {
throw new LogicException("门票同步失败");
} finally {
postMethod.releaseConnection();
}
}
private String getBase64Image(String imgUrl) {
try {
URL url = new URL(imgUrl);
InputStream is = url.openStream();
BufferedImage bi = ImageIO.read(is);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(bi, "jpg", baos);
byte[] bytes = baos.toByteArray();
return new String(Base64.encodeBase64(bytes)).trim();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
| [
"[email protected]"
] | |
a6e9bfa195b8c9fad298c7aaf1372ecafb8f4ad2 | 64283a30bc5d584ac0a66162d7268f48848d955b | /src/main/java/org/drw/ps/PatientServiceApplication.java | 9256268dbfa3839963a7b47acbacf090db730877 | [] | no_license | dumindarw/patient-service | 6675c665bf2a292406790d3f7bd1de3fe7e4e162 | 462e8ac81232a6832f0c54d909b9cf56b7912ae7 | refs/heads/main | 2023-08-23T09:00:55.460699 | 2021-10-21T03:59:14 | 2021-10-21T03:59:14 | 419,574,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | package org.drw.ps;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
//@NativeHint(trigger = FlywayAutoConfiguration.class)
//@NativeHint(trigger = JdbcTemplateAutoConfiguration.class)
public class PatientServiceApplication {
public static void main(String[] args) {
SpringApplication.run(PatientServiceApplication.class, args);
}
}
| [
"[email protected]"
] | |
1d98cdf35ca1f464fbc40a8266de6eec3ab2236c | ddcf1d31fb637d7144f51e89bc8b1bc0645d65bd | /src/main/java/cgd/hj/routines/Mhjj200a.java | d1d45c37b0ead1da15ff6edfc52bfcd96606c36c | [] | no_license | joao-goncalves-morphis/CodeGuru | 6b90a2fed061941a7020d143d9167f7434880cd4 | 3643af0dc69ed5b8a09ba89311b9b3afd27ca0e1 | refs/heads/master | 2022-09-02T23:29:10.586712 | 2020-05-06T14:31:03 | 2020-05-06T14:31:03 | 259,694,187 | 0 | 0 | null | 2020-05-27T13:40:19 | 2020-04-28T16:36:36 | Java | UTF-8 | Java | false | false | 244 | java | package cgd.hj.routines;
import cgd.framework.CgdExternalRoutine ;
import morphis.framework.datatypes.annotations.Data ;
/**
*
* migrated from [GH]
*
* @version 2.0
*
*/
public abstract class Mhjj200a extends CgdExternalRoutine {
}
| [
"[email protected]"
] | |
b5f72a1f594f94b27168d0d9cf0ea57d26e22e63 | 3af6590741c81b4f664fa9e824394b40953cfcf7 | /app/src/main/java/com/archive/jordiie/onboardingscreen/onBoarding/screen4_fragment.java | 6647f9edb3964f25382da950ee3111fe3ff29f3e | [] | no_license | abhinav-adtechs/project-archive-1.1 | c9becff59508085e790b8e52e2e0a0ed84cc6fc4 | 510e7315de598cd974379c480afd83092cbbad31 | refs/heads/master | 2016-08-12T08:23:58.340344 | 2016-01-09T17:55:52 | 2016-01-09T17:55:52 | 47,389,953 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | package com.archive.jordiie.onboardingscreen.onBoarding;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.archive.jordiie.onboardingscreen.R;
/**
* Created by jordiie on 22/9/15.
*/
public class screen4_fragment extends android.support.v4.app.Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle s) {
return inflater.inflate(
R.layout.screen4,
container,
false
);
}
}
| [
"[email protected]"
] | |
8c0a70eea05b5f846b25cdd480b3428ac1a31466 | 81771d9ed4b802c6a9828ad46c1099b9ee495d62 | /src/main/java/com/jxj/jdoctorassistant/health/PluseChartActivity.java | bf4f7506983845b6a4c2b4fc5896b831b300486d | [] | no_license | zeroys0/jdoctorassistant | 7191252fb08d9de0ef1793dd4e259c23fa1dd92c | 200b4906c440c248d5dbceca4242f0752791230b | refs/heads/master | 2020-11-25T16:22:23.484459 | 2019-12-18T05:12:33 | 2019-12-18T05:12:33 | 228,753,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,273 | java | package com.jxj.jdoctorassistant.health;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Paint.Align;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.jxj.jdoctorassistant.R;
import com.jxj.jdoctorassistant.app.ApiConstant;
import com.jxj.jdoctorassistant.app.AppConstant;
import com.jxj.jdoctorassistant.thread.JAssistantAPIThread;
import com.jxj.jdoctorassistant.util.UiUtil;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import net.sf.json.JSONObject;
import org.achartengine.ChartFactory;
import org.achartengine.GraphicalView;
import org.achartengine.chart.PointStyle;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.model.XYSeries;
import org.achartengine.renderer.XYMultipleSeriesRenderer;
import org.achartengine.renderer.XYSeriesRenderer;
import java.util.Arrays;
import java.util.Timer;
import java.util.TimerTask;
public class PluseChartActivity extends Activity {
@ViewInject(value= R.id.title_tv, parentId=R.id.pluse_chart_title)
TextView titleTv;
@ViewInject(R.id.datedata_chart)
private LinearLayout datedataChartLL;
@ViewInject(R.id.pluse_info_ll)
private LinearLayout pluseInfoLL;
@ViewInject(R.id.dd_testdate)
private TextView ddTestDate;
@ViewInject(R.id.dd_pr)
private TextView ddPR;
@ViewInject(R.id.dd_ps)
private TextView ddPS;
@ViewInject(R.id.dd_pd)
private TextView ddPD;
@ViewInject(R.id.dd_sv)
private TextView ddSV;
@ViewInject(R.id.dd_co)
private TextView ddCO;
@ViewInject(R.id.dd_tpr)
private TextView ddTPR;
@ViewInject(R.id.dd_ac)
private TextView ddAC;
@OnClick({R.id.back_igv})
private void onClick(View view){
switch (view.getId()) {
case R.id.back_igv:
finish();
break;
default:
break;
}
}
JAssistantAPIThread getPriDataThread;
Context context;
private XYSeries series;// XY数据点
private XYMultipleSeriesDataset mDataset;// XY轴数据集
private GraphicalView mViewChart;// 用于显示现行统计图
private XYMultipleSeriesRenderer mXYRenderer;// 线性统计图主描绘器
private Handler handler;
boolean Tag = true;
private int Ymin = 0;
private int Ymax = 0;
private String title = " ";
private String dataId;
private String result = null;
private int[] resultData = null;
private int[] resultDataCopy = null;
int len = 0;
int t = 1;
private Timer timer = new Timer();// 定时器
private TimerTask task;// 任务
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_pluse_chart);
ViewUtils.inject(this);
context = this;
titleTv.setText(getResources().getString(R.string.detailed_info));
Bundle bundle = this.getIntent().getExtras();
/* 获取Bundle中的数据,注意类型和key */
String jsonSendStr = bundle.getString("pluseInfo");
String jwotchModel=bundle.getString("jwotchModel");
JSONObject jsonSend = JSONObject.fromObject(jsonSendStr);
ddPS.setText(jsonSend.getString("PS") +"\n\n"+
getResources().getString(R.string.ps) +"\n" +
"mmHg");
ddPD.setText(jsonSend.getString("PD") +"\n\n"+
getResources().getString(R.string.pd) +"\n" +
"mmHg");
if(jwotchModel.equals(AppConstant.JWOTCHMODEL_041)){
ddPR.setText(jsonSend.getString("HR") +"\n\n"+
getResources().getString(R.string.pr) +"\n" +
getResources().getString(R.string.pr_unit));
ddTestDate.setText(getResources().getString(R.string.test_time) + ":"
+ jsonSend.getString("TestTime"));
dataId = jsonSend.getString("Id");
pluseInfoLL.setVisibility(View.GONE);
int stype=jsonSend.getInt("SType");
ddAC.setVisibility(View.GONE);
if(stype==1){
ddAC.setText(getResources().getString(R.string.stype) +"\n" +
getResources().getString(R.string.manual));
}else{
ddAC.setText(getResources().getString(R.string.stype) +"\n" +
getResources().getString(R.string.auto));
}
}else{
ddTestDate.setText(getResources().getString(R.string.test_time) + ":"
+ jsonSend.getString("TestDate"));
ddPR.setText(jsonSend.getString("PR") +"\n\n"+
getResources().getString(R.string.pr) +"\n" +
getResources().getString(R.string.pr_unit));
ddSV.setText(jsonSend.getString("SV") +"\n\n"+
getResources().getString(R.string.sv) +"\n" +
"ml");
ddCO.setText(jsonSend.getString("CO") +"\n\n"+
getResources().getString(R.string.co) +"\n" +
"ml");
ddTPR.setText(jsonSend.getString("TPR") +"\n\n"+
getResources().getString(R.string.tpr) +"\n" +
"ml");
ddAC.setText(jsonSend.getString("AC") +"\n\n"+
getResources().getString(R.string.ac) +"\n" +
"ml");
dataId = jsonSend.getString("DataId");
}
drawChart();
}
void drawChart() {
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
}
};
getPriDataThread = new JAssistantAPIThread(
ApiConstant.GETPRIMITIVEDATA, handler, context);
getPriDataThread.setDataId(dataId);
try {
getPriDataThread.start();
getPriDataThread.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result = null;
result = getPriDataThread.getResult();
if (UiUtil.isResultSuccess(context, result)) {
try {
len = result.length() / 4;
resultData = new int[len];
for (int i = 0; i < len; i++) {
resultData[i] = Integer.parseInt(
result.substring(i * 4, (i + 1) * 4), 16);
System.out.println("resultdata " + i + ":" + resultData[i]);
}
resultDataCopy = resultData.clone();
Arrays.sort(resultDataCopy);
Ymin = resultDataCopy[0];
Ymax = resultDataCopy[resultDataCopy.length - 1];
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(
this,
getResources()
.getString(R.string.pr_data_ana_exception),
Toast.LENGTH_SHORT).show();
}
context = getApplicationContext();// 获取上下文对象
// 这里获得xy_chart的布局,下面会把图表画在这个布局里面
series = new XYSeries(title);// 这个类用来放置曲线上的所有点,是一个点的集合,根据这些点画出曲线
mDataset = new XYMultipleSeriesDataset(); // 创建一个数据集的实例,这个数据集将被用来创建图表
mDataset.addSeries(series);// 将点集添加到这个数据集中
int color = Color.BLUE;// 设置线条颜色
PointStyle style = PointStyle.CIRCLE;// 设置外观周期性显示
mXYRenderer = buildRenderer(color, style, true);
mXYRenderer.setShowGrid(true);// 显示表格
mXYRenderer.setGridColor(Color.BLACK);// 据说绿色代表健康色调,不过我比较喜欢灰色,表格线颜色
mXYRenderer.setMarginsColor(Color.WHITE);// 设置空白区的颜色
mXYRenderer.setApplyBackgroundColor(true);// 是否采用背景色,false下默认chart背景色为黑色,默认false
mXYRenderer.setBackgroundColor(Color.WHITE);// 设置chart的背景颜色,不包括空白区
// mXYRenderer.setAxesColor(Color.BLACK);//坐标轴颜色
// mXYRenderer.setLabelsColor(Color.WHITE);//坐标名称以及标题颜色
mXYRenderer.setXLabelsColor(Color.WHITE);// 设置X轴刻度颜色
mXYRenderer.setYLabelsColor(0, Color.WHITE);// 设置Y轴刻度颜色
mXYRenderer.setXLabels(20);
mXYRenderer.setYLabels(10);
mXYRenderer.setYLabelsAlign(Align.RIGHT);// 右对齐
mXYRenderer.setShowLegend(false);// 不显示图例
mXYRenderer.setZoomEnabled(false);
mXYRenderer.setPanEnabled(true, false);
mXYRenderer.setClickEnabled(false);
setChartSettings(mXYRenderer, title, " ", " ", 0, len / 3 + 1,
Ymin, Ymax, Color.BLACK, Color.GREEN);
mViewChart = ChartFactory.getLineChartView(context, mDataset,
mXYRenderer);// 通过ChartFactory生成图表
datedataChartLL.addView(mViewChart, new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));// 将图表添加到布局中去
t = 1;
gif();
// updateChart();
}
}
protected XYMultipleSeriesRenderer buildRenderer(int color,
PointStyle style, boolean fill) {// 设置图表中曲线本身的样式,包括颜色、点的大小以及线的粗细等
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
XYSeriesRenderer r = new XYSeriesRenderer();
r.setColor(color);
r.setPointStyle(style);
r.setFillPoints(fill);
r.setLineWidth(3);
renderer.addSeriesRenderer(r);
return renderer;
}
protected void setChartSettings(XYMultipleSeriesRenderer renderer,
String title, String xTitle, String yTitle, double xMin,
double xMax, double yMin, double yMax, int axesColor,
int labelsColor) {// 设置主描绘器的各项属性,详情可阅读官方API文档
renderer.setChartTitle(title);
renderer.setXTitle(xTitle);
renderer.setYTitle(yTitle);
renderer.setXAxisMin(xMin);
renderer.setXAxisMax(xMax);
renderer.setYAxisMin(yMin);
renderer.setYAxisMax(yMax);
renderer.setAxesColor(axesColor);
renderer.setLabelsColor(labelsColor);
renderer.setMargins(new int[] { 20, 20, 0, 20 });
}
private void updateChart(int i) {// 主要工作是每隔1000ms刷新整个统计图
int ii = resultData.length;
mDataset.removeSeries(series);// 移除数据集中旧的点集
series.clear();// 点集先清空,为了做成新的点集而准备
for (int k = 0; k < ii / 3; k++) {// 实际项目中这些数据最好是由线程搞定,可以从WebService中获取
int y = resultData[k + (ii * t) / 3];
series.add(k, y);
}
mDataset.addSeries(series);// 在数据集中添加新的点集
mViewChart.invalidate();// 视图更新,没有这一步,曲线不会呈现动态
}
void gif() {
handler = new Handler() {// 简单的通过Handler+Task形成一个定时任务,从而完成定时更新图表的功能
@Override
public void handleMessage(Message msg) {
if (msg.what == 1) {
Log.i("qiuzhping", "Handler handleMessage");
updateChart(t); // 刷新图表,handler的作用是将此方法并入主线程,在非主线程是不能修改UI的
super.handleMessage(msg);
}
}
};
task = new TimerTask() {// 定时器
@Override
public void run() {
Message message = new Message();
message.what = 1;// 设置标志
handler.sendMessage(message);
Log.i("qiuzhping", t + " ");
t++;
if (t > 2) {
t = 1;
}
}
};
timer.schedule(task, 500, 1000);// 运行时间和间隔都是1000ms
}
@Override
public void onDestroy() {
if (timer != null) {// 当结束程序时关掉Timer
timer.cancel();
Log.i("qiuzhping", "onDestroy timer cancel");
super.onDestroy();
}
}
}
| [
"[email protected]"
] | |
947f95972183b9fd7fe56a05ab3ddff4965b8c7c | 963136bb46ab31b6a6ee2bb50e40afe996f1a386 | /src/main/java/com/lardi/dal/impl/RecordDaoMysqlImpl.java | 2219cc64d1bd5767d4e13379aae5efb544f1b01a | [] | no_license | koorneeyy/PhoneBook | d9e48b3bd1d937e86ccfd5824eb178f68cd1110e | 42ef1cce9c4e2b10108ed174375374be81cd2d5d | refs/heads/master | 2021-01-11T08:00:20.050072 | 2016-10-27T20:25:39 | 2016-10-27T20:25:39 | 72,136,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,936 | java | package com.lardi.dal.impl;
import com.lardi.config.ConnectToDB;
import com.lardi.dal.interfaces.RecordDaoInterface;
import com.lardi.dal.pojo.RecordPojo;
import org.apache.log4j.Logger;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
public class RecordDaoMysqlImpl implements RecordDaoInterface {
final static private Logger logger = Logger.getLogger(RecordDaoMysqlImpl.class);
@Override
public List<RecordPojo> getAllRecords(String userName) {
if (logger.isDebugEnabled()) { logger.debug("Get all records for user "+userName); }
Connection connection = ConnectToDB.getInstance();
ArrayList<RecordPojo> recordPojos=new ArrayList<>();
try {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * from records where user_id=(select id from users where login ='"+userName+"')");
while (resultSet.next()){
RecordPojo record=new RecordPojo();
record.setfName(resultSet.getString("fName"));
record.setsName(resultSet.getString("sName"));
record.setmName(resultSet.getString("mName"));
record.setAdress(resultSet.getString("adress"));
record.setMail(resultSet.getString("mail"));
record.setmPhone(resultSet.getString("mPhone"));
record.sethPhone(resultSet.getString("hPhone"));
record.setId(resultSet.getInt("id"));
recordPojos.add(record);
}
} catch (SQLException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
return recordPojos;
}
@Override
public List<RecordPojo> getFiltered(String keyword, String userName) {
if (logger.isDebugEnabled()) { logger.debug("Get filter records for user "+userName+" and filter keyword "+keyword); }
Connection connection = ConnectToDB.getInstance();
ArrayList<RecordPojo> recordPojos=new ArrayList<>();
try {
PreparedStatement stmt = connection.prepareStatement("SELECT * from records where user_id=(select id from users where login =?) and (fName like ? or sName like ? or mPhone like ?)");
stmt.setString(1, userName);
stmt.setString(2,"%"+keyword+"%");
stmt.setString(3,"%"+keyword+"%");
stmt.setString(4,"%"+keyword+"%");
ResultSet resultSet =stmt.executeQuery();
while (resultSet.next()){
RecordPojo record=new RecordPojo();
record.setfName(resultSet.getString("fName"));
record.setsName(resultSet.getString("sName"));
record.setmName(resultSet.getString("mName"));
record.setAdress(resultSet.getString("adress"));
record.setMail(resultSet.getString("mail"));
record.setmPhone(resultSet.getString("mPhone"));
record.sethPhone(resultSet.getString("hPhone"));
record.setId(resultSet.getInt("id"));
recordPojos.add(record);
}
} catch (SQLException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
return recordPojos;
}
@Override
public void addRecord(RecordPojo recordPojo, String userName) {
if (logger.isDebugEnabled()) { logger.debug("Add record for user "+userName); }
Connection connection = ConnectToDB.getInstance();
try {
PreparedStatement stmt = connection.prepareStatement("insert into records (user_id,fName,sName,mName,mPhone,hPhone,adress,mail)values((select id from users where login =?),?,?,?,?,?,?,?)");
stmt.setString(1, userName);
stmt.setString(2, recordPojo.getfName());
stmt.setString(3, recordPojo.getsName());
stmt.setString(4, recordPojo.getmName());
stmt.setString(5, recordPojo.getmPhone());
stmt.setString(6, recordPojo.gethPhone());
stmt.setString(7, recordPojo.getAdress());
stmt.setString(8, recordPojo.getMail());
stmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void deleteRecord(int recordId, String userName) {
if (logger.isDebugEnabled()) { logger.debug("Delete record for user "+userName+" and record id"+recordId); }
Connection connection = ConnectToDB.getInstance();
try {
Statement statement = connection.createStatement();
statement.execute("delete from records where id='"+recordId+"'");
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void editRecord(RecordPojo recordPojo, String userName) {
if (logger.isDebugEnabled()) { logger.debug("Edit record for user "+userName+" and record id"+recordPojo.getId()); }
Connection connection = ConnectToDB.getInstance();
try {
PreparedStatement stmt = connection.prepareStatement("update records set fName=?,sName=?,mName=?,mPhone=?,hPhone=?,adress=?,mail=? where id=?");
stmt.setString(1, recordPojo.getfName());
stmt.setString(2, recordPojo.getsName());
stmt.setString(3, recordPojo.getmName());
stmt.setString(4, recordPojo.getmPhone());
stmt.setString(5, recordPojo.gethPhone());
stmt.setString(6, recordPojo.getAdress());
stmt.setString(7, recordPojo.getMail());
stmt.setInt(8, recordPojo.getId());
stmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public RecordPojo getRecordById(int recordId, String userName) {
if (logger.isDebugEnabled()) { logger.debug("Get record by id for user "+userName+" and record id"+recordId); }
Connection connection = ConnectToDB.getInstance();
RecordPojo record=new RecordPojo();
try {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * from records where id='"+recordId+"'");
while (resultSet.next()){
record.setfName(resultSet.getString("fName"));
record.setsName(resultSet.getString("sName"));
record.setmName(resultSet.getString("mName"));
record.setAdress(resultSet.getString("adress"));
record.setMail(resultSet.getString("mail"));
record.setmPhone(resultSet.getString("mPhone"));
record.sethPhone(resultSet.getString("hPhone"));
record.setId(resultSet.getInt("id"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return record;
}
}
| [
"[email protected]"
] | |
9c655874972d5b6ce547bb9edb51359a385cc41f | f44b2451b532495c8148a1f4ac30429477293ff0 | /src/main/java/org/mule/module/dxpath/i18n/DxpathMessages.java | c729b780f1c36e910c11406bf43de8183de14582 | [
"Apache-2.0"
] | permissive | skjolber/mule-module-dxpath | fe03f3c95875fc0d9fdc0a9dfb241ea8c7d9fc49 | e6d478749fc8a141f053144e56e8904171fd4c55 | refs/heads/master | 2021-01-23T03:21:42.589243 | 2014-10-06T20:44:13 | 2014-10-06T20:44:13 | 11,876,052 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,040 | java | /***************************************************************************
*
* This file is part of the 'dxpath mule module' project at
* https://github.com/skjolber/mule-module-dxpath
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
****************************************************************************/
package org.mule.module.dxpath.i18n;
import org.mule.config.i18n.MessageFactory;
public class DxpathMessages extends MessageFactory {
private static final String BUNDLE_PATH = getBundlePath("dxpath");
}
| [
"[email protected]"
] | |
50d2fc86e55367dec6f7b32cd48ddbfe3c42327c | 22c8113b0ecba4a2d9bae43602a168e8838be662 | /wechat/client/app/src/main/java/cn/john/sy1027/User.java | 959cdb507d34ca4b9b46bedae53d54559018b76d | [] | no_license | ZYX223/chatter | b8091125e74bc176648f0619479fdb1cd997e8a1 | b5d574c9ac2657210df1b58ca0de375463e0bd9c | refs/heads/master | 2020-04-17T18:17:36.671679 | 2019-01-22T15:28:18 | 2019-01-22T15:28:18 | 166,819,974 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package cn.john.sy1027;
public class User {
private String uname;
private String upassword;
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
public String getPassword() {
return upassword;
}
public void setPassword(String password) {
this.upassword = password;
}
}
| [
"[email protected]"
] | |
7fb388962d6a13dc2183d20a900d944aff1d3ac3 | 05b3e5ad846c91bbfde097c32d5024dced19aa1d | /JavaProgramming/src/ch07/exam09/CarExample.java | c2fc29a8bf87111cb0cc0a0786bbc5723fe2397b | [] | no_license | yjs0511/MyRepository | 4c2b256cb8ac34869cce8dfe2b1d2ab163b0e5ec | 63bbf1f607f9d91374649bb7cacdf532b52e613b | refs/heads/master | 2020-04-12T03:05:29.993060 | 2016-11-17T04:34:51 | 2016-11-17T04:34:51 | 65,808,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package ch07.exam09;
public class CarExample {
public static void main(String[] args) {
Car car = new Car(); //Car 객체 생성
for(int i=1; i<=5; i++){
int problemLocation = car.run();
if(problemLocation != 0){
System.out.println(car.tires[problemLocation-1].location+" HankookTire로 교체");
car.tires[problemLocation-1] = new HankookTire(car.tires[problemLocation-1].location, 15);
}
System.out.println("----------------------------------");
}
}
}
| [
"[email protected]"
] | |
9b980b20a52edc81270527826577eaf0153a5c6f | bbe3ad0628695cd1d51bfa60e3117f6fb362db24 | /src/app/abms/comprobante/pago/PagoFiltroView.java | fdc3dd6893bd47b1a1dcdf3a066ee116631313e6 | [] | no_license | pgarello/inmobiliaria | c23731f5f7b151fcfdb77904af74be39b5904e00 | c9e2a2848d4a716db1800d511be466cbd7602c13 | refs/heads/master | 2023-08-04T10:05:53.132028 | 2021-02-01T15:19:28 | 2021-02-01T15:19:28 | 61,242,269 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 11,195 | java | package app.abms.comprobante.pago;
import java.util.Date;
import app.busquedas.inmueble.InmuebleFindListadoView;
import app.busquedas.persona.PersonaFindListadoView;
import ccecho2.base.CCColumn;
import ccecho2.base.CCLabel;
import ccecho2.base.CCButton;
import ccecho2.base.CCCheckBox;
import ccecho2.base.CCDateField;
import ccecho2.base.CCRow;
import ccecho2.base.CCTextField;
import datos.contrato_actor.ContratoActor;
import datos.inmueble.Inmueble;
import datos.persona.Persona;
import nextapp.echo2.app.Alignment;
import nextapp.echo2.app.ApplicationInstance;
import nextapp.echo2.app.Color;
import nextapp.echo2.app.Extent;
import nextapp.echo2.app.ImageReference;
import nextapp.echo2.app.Insets;
import nextapp.echo2.app.ResourceImageReference;
import nextapp.echo2.app.event.ActionEvent;
import framework.nr.generales.busquedas.FWBusquedas;
import framework.ui.generales.FWWindowPaneMensajes;
import framework.ui.generales.abms.ABMListadoFilterView;
import framework.ui.principal.FWContentPanePrincipal;
@SuppressWarnings("serial")
public class PagoFiltroView extends ABMListadoFilterView implements FWBusquedas {
public PagoFiltroView () {
super();
// Seteo el título de la ventana
this.setTitle("Filtro para el listado de Comprobantes de Pago - Liquidación Pago");
this.setHeight(new Extent(550, Extent.PX));
this.setWidth(new Extent(700, Extent.PX));
CPPrincipal = ((FWContentPanePrincipal) ApplicationInstance.getActive().getDefaultWindow().getContent());
oInmueble = null;
oPropietario = null;
// Agrego los componentes de la pantalla
crearObjetos();
renderObjetos();
}
private FWContentPanePrincipal CPPrincipal;
private CCColumn _cPrincipal, cLabels, cTexts;
private CCRow rPrincipal, rMensaje, rPropietario, rInmueble, rFechaDesde, rFechaHasta;
private CCLabel lInmueble, lPropietario, lInquilino;
private CCTextField tInmueble, tPropietario, tInquilino;
private CCLabel lMensaje;
private CCLabel lNroRecibo, lFechaDesde, lFechaHasta;
private CCTextField tNroRecibo;
CCDateField dfFecha_desde, dfFecha_hasta;
CCCheckBox cbFecha_desde, cbFecha_hasta;
private ImageReference iInmueble = new ResourceImageReference("/resources/crystalsvg22x22/actions/gohome.png");
private CCButton btnInmueble;
private Inmueble oInmueble;
private ImageReference iPropietario = new ResourceImageReference("/resources/crystalsvg22x22/actions/kontact_contacts.png");
private CCButton btnPropietario;
private Persona oPropietario;
// Tengo que cargar un combooooo el de localidades (dinámico) -- LISTO
// Tengo otro combo - el de tipo de documento (estático) -- LISTO
// Y la fecha de nacimiento ????? calendar -- LISTO
// Falta el campo observaciones
private void crearObjetos() {
_cPrincipal = new CCColumn();
_cPrincipal.setCellSpacing(new Extent(20));
_cPrincipal.setInsets(new Insets(10));
rPrincipal = new CCRow();
rInmueble = new CCRow(22);
rPropietario = new CCRow(22);
cLabels = new CCColumn();
cLabels.setCellSpacing(new Extent(10, Extent.PX));
cLabels.setInsets(new Insets(10));
cTexts = new CCColumn();
cTexts.setCellSpacing(new Extent(10, Extent.PX));
cTexts.setInsets(new Insets(10));
/* Configuro el boton del Inmueble */
btnInmueble = new CCButton(iInmueble);
this.btnInmueble.setActionCommand("inmueble");
this.btnInmueble.setToolTipText("Asignar Inmueble");
this.btnInmueble.setStyleName(null);
this.btnInmueble.setInsets(new Insets(10, 0));
this.btnInmueble.addActionListener(this);
/* Configuro el boton del propietario */
btnPropietario = new CCButton(iPropietario);
this.btnPropietario.setActionCommand("propietario");
this.btnPropietario.setToolTipText("Asignar Propietario");
this.btnPropietario.setStyleName(null);
this.btnPropietario.setInsets(new Insets(10, 0));
this.btnPropietario.addActionListener(this);
/*******************************************************************/
lInmueble = new CCLabel("Inmueble:",22);
tInmueble = new CCTextField(300, false);
tInmueble.setEnabled(false);
lPropietario = new CCLabel("Propietario:",22);
tPropietario = new CCTextField(300,false);
tPropietario.setEnabled(false);
lInquilino = new CCLabel("Inquilino:",22);
tInquilino = new CCTextField(300,false);
tInquilino.setEnabled(false);
/*******************************************************************/
lNroRecibo = new CCLabel("Nro. de Recibo:",22);
tNroRecibo = new CCTextField(100,22,10,true);
tNroRecibo.setRegex("^[0-9]{1,8}$");
tNroRecibo.setText("0");
lFechaDesde = new CCLabel("Fecha Desde:",22);
rFechaDesde = new CCRow(22);
dfFecha_desde = new CCDateField();
dfFecha_desde.setEnabled(false);
cbFecha_desde = new CCCheckBox(" ");
cbFecha_desde.addActionListener(this);
cbFecha_desde.setActionCommand("desde");
lFechaHasta = new CCLabel("Fecha Hasta:",22);
rFechaHasta = new CCRow(22);
dfFecha_hasta = new CCDateField();
dfFecha_hasta.setEnabled(false);
cbFecha_hasta = new CCCheckBox(" ");
cbFecha_hasta.addActionListener(this);
cbFecha_hasta.setActionCommand("hasta");
/*******************************************************************/
rBotones = new CCRow();
rBotones.setInsets(new Insets(10));
rBotones.setAlignment(Alignment.ALIGN_CENTER);
/*******************************************************************/
rMensaje = new CCRow();
rMensaje.setAlignment(Alignment.ALIGN_CENTER);
lMensaje = new CCLabel();
lMensaje.setForeground(Color.RED);
}
private void renderObjetos() {
// Agrego la columna al ContentPane Principal
cpPrincipal.add(_cPrincipal);
_cPrincipal.add(rPrincipal);
rPrincipal.add(cLabels);
rPrincipal.add(cTexts);
//rPrincipal.setBorder(new Border(1, Color.BLUE,Border.STYLE_DASHED));
_cPrincipal.add(rMensaje);
_cPrincipal.add(rBotones);
rInmueble.add(tInmueble);
rInmueble.add(btnInmueble);
rPropietario.add(tPropietario);
rPropietario.add(btnPropietario);
// -------------------------------------------
cLabels.add(lInmueble);
cLabels.add(lPropietario);
//cLabels.add(lInquilino);
cTexts.add(rInmueble);
//cTexts.add(tPropietario);
cTexts.add(rPropietario);
cLabels.add(lNroRecibo);
cLabels.add(lFechaDesde);
cLabels.add(lFechaHasta);
// ------------------------------------------
cTexts.add(tNroRecibo);
rFechaDesde.add(dfFecha_desde);
rFechaDesde.add(cbFecha_desde);
cTexts.add(rFechaDesde);
rFechaHasta.add(dfFecha_hasta);
rFechaHasta.add(cbFecha_hasta);
cTexts.add(rFechaHasta);
rMensaje.add(lMensaje);
ApplicationInstance.getActive().setFocusedComponent(tInmueble);
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() instanceof CCCheckBox) {
CCCheckBox obj = (CCCheckBox)ae.getSource();
if (obj.getActionCommand().equals("desde")) {
if (obj.isSelected()) dfFecha_desde.setEnabled(true);
else dfFecha_desde.setEnabled(false);
} else {
if (obj.isSelected()) dfFecha_hasta.setEnabled(true);
else dfFecha_hasta.setEnabled(false);
}
} else {
// Es un BOTON el objeto que lanzó el evento
if (ae.getActionCommand().equals("propietario")){
CPPrincipal.abrirVentanaMensaje(new PersonaFindListadoView("Propietario", this, ContratoActor.ActorTipoPropietario));
} else if (ae.getActionCommand().equals("inmueble")){
CPPrincipal.abrirVentanaMensaje(new InmuebleFindListadoView(this, false));
}
// Tiro el evento para arriba en la gerarquia de objetos
super.actionPerformed(ae);
}
}
public void find() {
/*
La idea es buscar los datos y pasarselo a la pantalla LISTADO
que tiene que ser una nueva ventana.
La otra posibilidad es pasar los filtros y realizar la consulta
de datos directamente en la otra pantalla
*/
/** LLamo a PagoListadoView */
int filtroIdPropietario = 0;
if (oPropietario != null) filtroIdPropietario = oPropietario.getIdPersona();
int filtroIdPropiedad = 0;
if (oInmueble != null) filtroIdPropiedad = oInmueble.getIdInmueble();
int filtroNroRecibo = 0;
if (!tNroRecibo.getText().equals("")) filtroNroRecibo = Integer.parseInt(tNroRecibo.getText());
Date filtroFechaDesde = null;
if (dfFecha_desde.isEnabled()) filtroFechaDesde = dfFecha_desde.getSelectedDate().getTime();
Date filtroFechaHasta = null;
if (dfFecha_hasta.isEnabled()) filtroFechaHasta = dfFecha_hasta.getSelectedDate().getTime();
PagoListadoView oPantallaListado = new PagoListadoView(filtroNroRecibo, filtroIdPropietario, filtroIdPropiedad, filtroFechaDesde, filtroFechaHasta);
((FWContentPanePrincipal) ApplicationInstance.getActive().getDefaultWindow().getContent()).abrirVentana(oPantallaListado);
}
public void setResultado(Object object) {
if (object instanceof Persona) {
tPropietario.setText(((Persona)object).getDescripcion());
oPropietario = (Persona) object;
/* Puede ser propietario de muchas propiedades */
} else if (object instanceof Inmueble) {
oInmueble = (Inmueble)object;
// Evaluo si el inmueble seleccionado tiene propietario
try {
if (oInmueble.getPropietario().getDescripcion().equals("")) {}
} catch(NullPointerException npe) {
// salgo
new FWWindowPaneMensajes("El inmueble seleccionado debe tener asignado un PROPIETARIO", "ERROR");
return;
}
tInmueble.setText(oInmueble.getDireccion_completa());
tPropietario.setText(oInmueble.getPropietario().getDescripcion());
// La propiedad puede tener muchos inquilinos en distintos contratos
}
}
public void clear() {
tInmueble.setText("");
tInquilino.setText("");
tPropietario.setText("");
tNroRecibo.setText("0");
oInmueble = null;
oPropietario = null;
dfFecha_desde.setEnabled(false);
cbFecha_desde.setSelected(false);
dfFecha_hasta.setEnabled(false);
cbFecha_hasta.setSelected(false);
}
} | [
"[email protected]"
] | |
21a4f5c04b1306c2bd39d4a3dcaeb3a595d19e54 | 797b64bde877aa077fe74330d02806abcca218f4 | /app/src/main/java/com/itis/android/lessontwo/ui/comicslist/ComicsListView.java | 48e5d116994a1383bef51f5dd575c582344650c8 | [] | no_license | AlexTilinina/lessonTwo | 0fbbc4eec9d40b8117c157730b4206f20e40ade5 | fd9c7c8c1e3d0361cc3a4d9838632aea45a04824 | refs/heads/master | 2021-01-25T14:16:18.052869 | 2018-04-03T18:38:34 | 2018-04-03T18:38:34 | 123,674,624 | 0 | 1 | null | 2018-04-03T18:38:35 | 2018-03-03T08:40:53 | Java | UTF-8 | Java | false | false | 977 | java | package com.itis.android.lessontwo.ui.comicslist;
import android.support.annotation.NonNull;
import com.arellomobile.mvp.MvpView;
import com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy;
import com.arellomobile.mvp.viewstate.strategy.OneExecutionStateStrategy;
import com.arellomobile.mvp.viewstate.strategy.StateStrategyType;
import com.itis.android.lessontwo.model.comics.Comics;
import java.util.List;
import io.reactivex.disposables.Disposable;
/**
* Created by Nail Shaykhraziev on 26.02.2018.
*/
@StateStrategyType(AddToEndSingleStrategy.class)
public interface ComicsListView extends MvpView {
void showItems(@NonNull List<Comics> items);
@StateStrategyType(OneExecutionStateStrategy.class)
void handleError(Throwable error);
void addMoreItems(List<Comics> items);
void setNotLoading();
void showLoading(Disposable disposable);
void hideLoading();
//* Navigation methods*/
void showDetails(Comics item);
}
| [
"[email protected]"
] | |
0b5349605f45999e1871c47b93323812fcff3235 | 97faab88539c707483d7de5aaedbf7e1a551889e | /src/com/leetcode/NumberCompliment.java | 42b14b3cb23b623b54205eab3625c80101c9239d | [] | no_license | syedirfan33/ProblemSolving | 83cf047c1f08ed089553401e61561e7e560e4712 | 07f0e565f3f6d39d10d3464f2aafe5b6de6bc3e5 | refs/heads/master | 2023-08-15T12:53:53.922113 | 2021-09-25T04:04:26 | 2021-09-25T04:04:26 | 261,063,747 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.leetcode;
public class NumberCompliment {
public int findComplement(int num) {
if (num == 0) return 1;
int i = 0;
int res = 0;
while (num > 0) {
int mul = num % 2 == 1 ? 0 : 1;
res += mul * Math.pow(2, i++);
num /= 2;
}
return res;
}
}
| [
"[email protected]"
] | |
79edef627e941ec8b048820b96259990a037b4a6 | 5398527005bd31bb3f507709e74283fb1979680b | /core/src/ru/geekbrains/stargame/screen/GameScreen.java | 64a57bab8907b8a505bc93561ee56ca9bd402649 | [] | no_license | MishanyG/StarGame | 7e2b7c23186f16a1ce69c39937bd51f09e42127b | 2fd66dd5b48d12e755802d1fe90f8e9023a56ebe | refs/heads/master | 2021-08-01T17:02:18.196061 | 2021-07-26T13:45:22 | 2021-07-26T13:45:22 | 248,732,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,233 | java | package ru.geekbrains.stargame.screen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import java.util.List;
import ru.geekbrains.stargame.base.BaseScreen;
import ru.geekbrains.stargame.base.Font;
import ru.geekbrains.stargame.exception.GameException;
import ru.geekbrains.stargame.math.Rect;
import ru.geekbrains.stargame.math.Rnd;
import ru.geekbrains.stargame.pool.BulletPool;
import ru.geekbrains.stargame.pool.EnemyPool;
import ru.geekbrains.stargame.pool.ExplosionPool;
import ru.geekbrains.stargame.sprites.Background;
import ru.geekbrains.stargame.sprites.Bullet;
import ru.geekbrains.stargame.sprites.ButtonNewGame;
import ru.geekbrains.stargame.sprites.Enemy;
import ru.geekbrains.stargame.sprites.FirstAid;
import ru.geekbrains.stargame.sprites.GameOver;
import ru.geekbrains.stargame.sprites.ShipHero;
import ru.geekbrains.stargame.sprites.Star;
import ru.geekbrains.stargame.utils.EnemyEmitter;
public class GameScreen extends BaseScreen
{
private enum State {PLAYING, PAUSE, GAME_OVER}
private static final int STAR_COUNT = 64;
private static final float FONT_MARGIN = 0.01f;
private static final float FONT_SIZE = 0.02f;
private static final String FRAGS = "Frags: ";
private static final String HP = "HP: ";
private static final String LEVEL = "Level: ";
private Texture bg;
private Background background;
private GameOver gameOver;
private ButtonNewGame buttonNewGame;
private Music fonMus;
private Sound shootSound;
private Sound bulletSound;
private Sound explosion;
private TextureAtlas atlas;
private TextureAtlas atlasNew;
private Star[] stars;
private FirstAid firstAid;
private BulletPool bulletPool;
private ShipHero shipHero;
private EnemyPool enemyPool;
private EnemyEmitter enemyEmitter;
private ExplosionPool explosionPool;
private State state;
private State prevState;
private int frags;
private Font font;
private StringBuilder sbFrags;
private StringBuilder sbHP;
private StringBuilder sbLevel;
private float animateInterval;
private float animateTimer;
private boolean aid;
@Override
public void show() {
super.show();
bg = new Texture("textures/bg.png");
atlas = new TextureAtlas(Gdx.files.internal("textures/mainAtlas.tpack"));
atlasNew = new TextureAtlas(Gdx.files.internal("textures/Atlas/mainAtlasNew.tpack"));
font = new Font("font/font.fnt", "font/font.png");
shootSound = Gdx.audio.newSound(Gdx.files.internal("sounds/laser.wav"));
bulletSound = Gdx.audio.newSound(Gdx.files.internal("sounds/bullet.wav"));
explosion = Gdx.audio.newSound(Gdx.files.internal("sounds/explosion.wav"));
fonMus = Gdx.audio.newMusic(Gdx.files.internal("sounds/music.mp3"));
font.setSize(FONT_SIZE);
sbFrags = new StringBuilder();
sbHP = new StringBuilder();
sbLevel = new StringBuilder();
bulletPool = new BulletPool();
explosionPool = new ExplosionPool(atlasNew, explosion);
enemyPool = new EnemyPool(bulletPool, explosionPool, worldBounds);
enemyEmitter = new EnemyEmitter(atlasNew, enemyPool, worldBounds, bulletSound);
fonMus.setLooping(true);
fonMus.play();
initSprites();
state = State.PLAYING;
prevState = State.PLAYING;
frags = 0;
animateInterval = Rnd.nextFloat(10f, 100f);
animateTimer = Rnd.nextFloat(0f, 5f);
aid = false;
}
public void startNewGame()
{
state = State.PLAYING;
shipHero.startNewGame(worldBounds);
frags = 0;
bulletPool.freeAllActiveObjects();
enemyPool.freeAllActiveObjects();
explosionPool.freeAllActiveObjects();
aid = true;
}
@Override
public void pause()
{
prevState = state;
state = State.PAUSE;
fonMus.pause();
aid = false;
}
@Override
public void resume()
{
state = prevState;
fonMus.play();
}
@Override
public void render(float delta)
{
super.render(delta);
update(delta);
checkCollisions();
freeAllDestroyed();
draw();
}
@Override
public void resize(Rect worldBounds)
{
super.resize(worldBounds);
background.resize(worldBounds);
for (Star star : stars)
{
star.resize(worldBounds);
}
firstAid.resize(worldBounds);
shipHero.resize(worldBounds);
gameOver.resize(worldBounds);
buttonNewGame.resize(worldBounds);
}
@Override
public void dispose()
{
bg.dispose();
atlas.dispose();
atlasNew.dispose();
bulletPool.dispose();
enemyPool.dispose();
fonMus.dispose();
shootSound.dispose();
explosion.dispose();
font.dispose();
super.dispose();
}
@Override
public boolean keyDown(int keycode)
{
if (state == State.PLAYING)
shipHero.keyDown(keycode);
return false;
}
@Override
public boolean keyUp(int keycode)
{
if (state == State.PLAYING)
shipHero.keyUp(keycode);
return false;
}
@Override
public boolean touchDown(Vector2 touch, int pointer, int button)
{
if (state == State.PLAYING)
shipHero.touchDown(touch, pointer, button);
else if (state == State.GAME_OVER)
buttonNewGame.touchDown(touch, pointer, button);
return false;
}
@Override
public boolean touchUp(Vector2 touch, int pointer, int button)
{
if (state == State.PLAYING)
shipHero.touchUp(touch, pointer, button);
else if (state == State.GAME_OVER)
buttonNewGame.touchUp(touch, pointer, button);
return false;
}
private void initSprites()
{
try {
background = new Background(bg);
stars = new Star[STAR_COUNT];
for (int i = 0; i < STAR_COUNT; i++)
{
stars[i] = new Star(atlas);
}
firstAid = new FirstAid(atlasNew);
gameOver = new GameOver(atlas);
buttonNewGame = new ButtonNewGame(atlasNew, this);
shipHero = new ShipHero(atlasNew, bulletPool, explosionPool, shootSound);
} catch (GameException e)
{
throw new RuntimeException(e);
}
}
private void update(float delta)
{
for (Star star : stars)
{
star.update(delta);
}
explosionPool.updateActiveSprites(delta);
if (state == State.PLAYING)
{
shipHero.update(delta);
enemyPool.updateActiveSprites(delta);
bulletPool.updateActiveSprites(delta);
enemyEmitter.generate(delta, frags);
}
else if (state == State.GAME_OVER)
buttonNewGame.update(delta);
if (!aid)
{
animateTimer += delta;
if (animateTimer >= animateInterval)
{
animateInterval = Rnd.nextFloat(5f, 100f);
animateTimer = Rnd.nextFloat(0f, 5f);
aid = true;
}
firstAid.update(delta, false);
}
else firstAid.update(delta, true);
if (firstAid.pos.y < worldBounds.getBottom())
aid = false;
}
private void checkCollisions()
{
if (state != State.PLAYING) return;
List<Enemy> enemyList = enemyPool.getActiveObjects();
List<Bullet> bulletList = bulletPool.getActiveObjects();
for (Enemy enemy : enemyList)
{
if (enemy.isDestroyed()) continue;
float minDist = enemy.getHalfWidth() + shipHero.getHalfWidth();
if (shipHero.pos.dst(enemy.pos) < minDist)
{
enemy.destroy();
frags++;
shipHero.damage(enemy.getDamage());
}
for (Bullet bullet : bulletList)
{
if (bullet.getOwner() != shipHero || bullet.isDestroyed()) continue;
if (enemy.isBulletCollision(bullet))
{
enemy.damage(bullet.getDamage());
bullet.destroy();
if (enemy.isDestroyed()) frags++;
}
}
}
for (Bullet bullet : bulletList)
{
if (bullet.getOwner() == shipHero || bullet.isDestroyed()) continue;
if (shipHero.isBulletCollision(bullet))
{
shipHero.damage(bullet.getDamage());
bullet.destroy();
}
}
if (shipHero.isDestroyed()) state = State.GAME_OVER;
if (!(firstAid.getOwner() == shipHero) && aid)
{
if (shipHero.isBulletCollision(firstAid))
{
shipHero.aid(FirstAid.getAid());
aid = false;
}
}
}
private void freeAllDestroyed()
{
bulletPool.freeAllDestroyedActiveObjects();
enemyPool.freeAllDestroyedActiveObjects();
explosionPool.freeAllDestroyedActiveObjects();
}
private void draw() {
Gdx.gl.glClearColor(0.5f, 0.7f, 0.8f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
background.draw(batch);
for (Star star : stars) {
star.draw(batch);
}
switch (state)
{
case PLAYING:
bulletPool.drawActiveSprites(batch);
if (aid)
firstAid.draw(batch);
shipHero.draw(batch);
enemyPool.drawActiveSprites(batch);
break;
case GAME_OVER:
gameOver.draw(batch);
buttonNewGame.draw(batch);
break;
}
explosionPool.drawActiveSprites(batch);
printInfo();
batch.end();
}
private void printInfo()
{
sbFrags.setLength(0);
sbHP.setLength(0);
sbLevel.setLength(0);
font.draw(batch, sbFrags.append(FRAGS).append(frags), worldBounds.getLeft() + FONT_MARGIN, worldBounds.getTop() - FONT_MARGIN);
font.draw(batch, sbHP.append(HP).append(shipHero.getHp()), worldBounds.pos.x, worldBounds.getTop() - FONT_MARGIN, Align.center);
font.draw(batch, sbLevel.append(LEVEL).append(enemyEmitter.getLevel()), worldBounds.getRight() - FONT_MARGIN, worldBounds.getTop() - FONT_MARGIN, Align.right);
}
}
| [
"[email protected]"
] | |
0749aa7b781fa7f9e32540d509c1d424316cf2d9 | 0d4f05c9909695a166e97b8958680945ea5c1266 | /src/minecraft/net/minecraft/entity/IEntityLivingData.java | dcda910b718e06583665a8a3db6af344b48881ca | [] | no_license | MertDundar1/ETB-0.6 | 31f3f42f51064ffd7facaa95cf9b50d0c2d71995 | 145d008fed353545157cd0e73daae8bc8d7f50b9 | refs/heads/master | 2022-01-15T08:42:12.762634 | 2019-05-15T23:37:33 | 2019-05-15T23:37:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package net.minecraft.entity;
public abstract interface IEntityLivingData {}
| [
"[email protected]"
] | |
939656ff1c2e25982d1b8f38905eafa5ab91e533 | 5e3fad491f274d8348f25086ecd5d89ec59c0b53 | /Pathfinder-master/app/src/main/java/com/group12/utils/PermissionChecker.java | 6efa9b603d0d59a4669e728e76c2a5766ffda60d | [] | no_license | wallnutc/pathfinding-UI | 6bc7034345fb3919d124d9dd124e956774c8d7b6 | 58c4a4e1efd8f12de6c23110cdd1fc40e7ec3c0b | refs/heads/master | 2021-04-05T18:58:01.213210 | 2020-04-10T15:17:03 | 2020-04-10T15:17:03 | 248,589,258 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 951 | java | package com.group12.utils;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
public class PermissionChecker {
public static boolean checkPermission(Activity activity,String permission){
int result = ContextCompat.checkSelfPermission(activity, permission);
return result == PackageManager.PERMISSION_GRANTED;
}
public static void requestPermission(Activity activity, final int code,String permission){
if (ActivityCompat.shouldShowRequestPermissionRationale(activity,permission)){
Toast.makeText(activity,"GPS permission allows us to access location data. Please allow in App Settings for additional functionality.",Toast.LENGTH_LONG).show();
} else {
ActivityCompat.requestPermissions(activity,new String[]{permission},code);
}
}
}
| [
"[email protected]"
] | |
ac5543bb5d56ae891b7b1531b3a1d08e7d436b87 | eebe7ea49de7cccdb44b6ec1d56e79d4ec3726e3 | /2019.11/2019.11.14 - Educational Codeforces Round 76 (Rated for Div. 2)/CDominatedSubarray.java | 874e9361c2d074eb23ed68c8ff70f1a37bb219f2 | [] | no_license | m1kit/cc-archive | 6dfbe702680230240491a7af4e7ad63f372df312 | 66ba7fb9e5b1c61af4a016f800d6c90f6f594ed2 | refs/heads/master | 2021-06-28T21:54:02.658741 | 2020-09-08T09:38:58 | 2020-09-08T09:38:58 | 150,690,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package dev.mikit.atcoder;
import dev.mikit.atcoder.lib.io.LightScanner;
import dev.mikit.atcoder.lib.io.LightWriter;
import dev.mikit.atcoder.lib.debug.Debug;
import java.util.HashMap;
import java.util.Map;
public class CDominatedSubarray {
private static final int MOD = (int) 1e9 + 7;
public void solve(int testNumber, LightScanner in, LightWriter out) {
// out.setBoolLabel(LightWriter.BoolLabel.YES_NO_FIRST_UP);
int testCases = in.ints();
for (int testCase = 0; testCase < testCases; testCase++) {
int n = in.ints();
int[] a = in.ints(n);
int ans = Integer.MAX_VALUE;
Map<Integer, Integer> index = new HashMap<>();
for (int i = 0; i < n; i++) {
if (index.containsKey(a[i])) ans = Math.min(ans, i - index.get(a[i]) + 1);
index.put(a[i], i);
}
out.ans(ans == Integer.MAX_VALUE ? -1 : ans).ln();
}
}
}
| [
"[email protected]"
] | |
da3958529d8081d3d47040800d75fed2adb212ab | d59c531c1d9d69eda37b00a1b3b526516f2cba37 | /src/main/java/com/easypump/model/common/HttpResponseStatusEnum.java | 8bd0ee185a1bea667b78f7ddaea1471fe6feac56 | [
"MIT"
] | permissive | juliuspetero/easypump-server | badceda7c3b4cdd2c05b1cb55b163780de981b70 | 1b67ca46614c03a139b580aa3927cc11bf5159a9 | refs/heads/main | 2023-07-10T03:30:57.127805 | 2021-08-22T22:18:19 | 2021-08-22T22:38:09 | 398,912,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package com.easypump.model.common;
public enum HttpResponseStatusEnum {
SUCCESS,
FAILED,
PENDING,
UNKNOWN
}
| [
"[email protected]"
] | |
445f2c2829bb163861128d25991d82d5c0952a39 | 3d711f583c23a4f3c2cad7b518ec202db3e58d86 | /src/java/dataDAO/ProductDAO.java | 6d1d2c865bfba8be5a21e56108e175f58889842f | [] | no_license | doanhhoang7798/A | 7a541b4faedc0fdeaf5277a2db6b9085685164d5 | 263cca78fbd4dba5b2eccf4f2064cef8e146ad70 | refs/heads/master | 2022-04-26T08:52:00.041199 | 2020-04-28T22:06:28 | 2020-04-28T22:06:28 | 259,761,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,334 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dataDAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import model.Product;
/**
*
* @author Hp-Pc
*/
public class ProductDAO extends DataConfig {
public ArrayList<Product> getAll() throws SQLException {
ArrayList<Product> arrlist = new ArrayList<>();
Connection conn = null;
PreparedStatement pre = null;
ResultSet rs = null;
String query = "select * from menu";
conn = this.getConnection();
pre = conn.prepareStatement(query);
rs = pre.executeQuery();
while (rs.next()) {
Product pro = new Product();
pro.setId(rs.getInt("id"));
pro.setName(rs.getString("name"));
pro.setFulldescription(rs.getString("fulldescription"));
pro.setShortdescription(rs.getString("shortdescription"));
pro.setImg(rs.getString("img"));
arrlist.add(pro);
}
this.closeData(conn, pre, rs);
return arrlist;
}
public ArrayList<Product> getPros(int pageSize, int pageIndex){
Connection conn = this.getConnection();
PreparedStatement pre = null;
ResultSet rs = null;
ArrayList<Product> arrlist = new ArrayList<>();
//get the row number(rn) of table menu
String query = "select * from(select row_number() over "
+ "(order by id asc) as rn,*from menu) "
+ "as x where rn between ? * (?-1)+1 and ? * ?";
try {
pre = conn.prepareStatement(query);
pre.setInt(1, pageSize);
pre.setInt(2, pageIndex);
pre.setInt(3, pageSize);
pre.setInt(4, pageIndex);
rs = pre.executeQuery();
while(rs.next()){
Product pro = new Product();
pro.setId(rs.getInt("id"));
pro.setName(rs.getString("name"));
pro.setFulldescription(rs.getString("fulldescription"));
pro.setShortdescription(rs.getString("shortdescription"));
pro.setImg(rs.getString("img"));
pro.setIndex(rs.getInt("rn"));
arrlist.add(pro);
}
} catch (SQLException ex) {
Logger.getLogger(ProductDAO.class.getName()).log(Level.SEVERE, null, ex);
}finally{
this.closeData(conn, pre, rs);
}
return arrlist;
}
public int getTotalPros(){
Connection conn = this.getConnection();
PreparedStatement pre = null;
ResultSet rs = null;
String query = "select count(*) as total from menu";
try {
pre = conn.prepareStatement(query);
rs = pre.executeQuery();
if(rs.next()){
return rs.getInt("total");
}
} catch (SQLException ex) {
Logger.getLogger(ProductDAO.class.getName()).log(Level.SEVERE, null, ex);
}finally{
this.closeData(conn, pre, rs);
}
return 0;
}
public Product getProById(int id) throws SQLException{
String query = "Select * from menu where id= ? ";
Connection conn = this.getConnection();
PreparedStatement pre = conn.prepareCall(query);
pre.setInt(1, id);
ResultSet rs = null;
rs = pre.executeQuery();
Product pro = new Product();
if(rs.next()){
pro.setId(id);
pro.setImg(rs.getString("img"));
pro.setShortdescription(rs.getString("shortdescription"));
pro.setName(rs.getString("name"));
pro.setFulldescription(rs.getString("fulldescription"));
}
this.closeData(conn, pre, rs);
return pro;
}
}
| [
"[email protected]"
] | |
752fd33a958c57211adac7d01536ef0fe479faaa | 79073777d07f5a2c26ea976247f50c1835c5d38e | /src/main/java/com/canerkorkmaz/monopoly/constants/BoardConfiguration.java | ae9a280416d2f3b68491ed2da252601db7fef5fe | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | YigitErturk/Comp302-Fall2018-Monopoly-Individual | d70aa65ca9a951e42cd5770002e447f7fbffd7b4 | c634e24e6f6276ce80c67a3f53d451be17fa1b87 | refs/heads/master | 2020-06-11T17:27:25.495535 | 2018-12-24T12:35:08 | 2018-12-24T12:35:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,110 | java | package com.canerkorkmaz.monopoly.constants;
import com.canerkorkmaz.monopoly.data.model.*;
import java.awt.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public final class BoardConfiguration {
private BoardConfiguration() {
}
public static final Color BLUE = new Color(0x87, 0xA5, 0xD7);
public static final Color PINK = new Color(0xEF, 0x38, 0x78);
public static final Color ORANGE = new Color(0xF5, 0x80, 0x23);
public static final Color GREEN = new Color(0x09, 0x87, 0x33);
public final static List<TileModel> tileTypes = Collections.unmodifiableList(Arrays.asList(
new FreeParkingModel(),
new PropertyTileModel(ORANGE, "St. James Place", 180),
new KocSquareModel(),
new PropertyTileModel(ORANGE, "Tennessee Ave", 180),
new PropertyTileModel(ORANGE, "New York Ave", 200),
new SqueezePlayModel(),
new PropertyTileModel(GREEN, "Pacific Ave", 300),
new PropertyTileModel(GREEN, "North Carolina Ave", 300),
new ReverseSquareModel(),
new PropertyTileModel(GREEN, "Pennsylvania Ave", 320),
new GoTileModel(),
new PropertyTileModel(BLUE, "Oriental Ave", 100),
new FreeParkingModel(),
new PropertyTileModel(BLUE, "Vermont Ave", 100),
new PropertyTileModel(BLUE, "Connecticut Ave", 120),
new RollOnceModel(),
new PropertyTileModel(PINK, "St. Charles Place", 140),
new BonusModel(),
new PropertyTileModel(PINK, "States Ave", 140),
new PropertyTileModel(PINK, "Virginia Ave", 160)));
public static PropertyTileModel getPropertyTileModel(PropertyTileModel p) {
for (TileModel model : tileTypes) {
if (model instanceof PropertyTileModel) {
PropertyTileModel propertyTileModel = (PropertyTileModel) model;
if(propertyTileModel.equals(p)) {
return propertyTileModel;
}
}
}
return p;
}
}
| [
"[email protected]"
] | |
6ce326b26e82f6d301771683dc252ea0c4ca1d7a | c5bfae1d6f8dff8ff9a22f1f8370e54b2ca3cd3b | /app/src/androidTest/java/com/iigo/diceloadingview/ExampleInstrumentedTest.java | a869c9ceca4bb752adfa7069c56c21e1ebf21bea | [
"MIT"
] | permissive | newPersonKing/DiceLoadingView | 3a041580d2bf4758cf826b4f3cb3af08cd50b916 | 7cfbafc1de6f9d3d67a91393fa3bb919ec19431f | refs/heads/master | 2023-03-15T11:49:17.769562 | 2018-12-28T02:20:36 | 2018-12-28T02:20:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package com.iigo.diceloadingview;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.iigo.diceloadingview", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
0d452944d77d24dbf7c7fa70e98363c5f714621b | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /src/irvine/oeis/a322/A322460.java | 8b25c1cb49b32a321ad4bf61991390b2fc1368a2 | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package irvine.oeis.a322;
// Generated by gen_linrec.pl - DO NOT EDIT here!
import irvine.oeis.LinearRecurrence;
/**
* A322460 Sum of n-th powers of the roots of <code>x^3 + 95*x^2 - 88*x - 1</code>.
* @author Georg Fischer
*/
public class A322460 extends LinearRecurrence {
/** Construct the sequence. */
public A322460() {
super(new long[] {1L, 88L, -95L}, new long[] {3L, -95L, 9201L});
} // constructor()
} // A322460
| [
"[email protected]"
] | |
f539c6b0ed60af62f835f6b96ea44ded6214cbfc | 5d968f9ceab6b118a65e107cfddd503af3807a9a | /City.java | f0672bc6cf2db2381edd328053ac3cc05ea6e682 | [] | no_license | Dodyputra/Tugas | 2e1e2f42469121b7d11233cccf8385d3d26c825c | 8cced46fedb6eb77e8bf6597c28f9392f864525f | refs/heads/master | 2021-03-24T13:01:00.855779 | 2017-09-26T03:02:01 | 2017-09-26T03:02:01 | 104,828,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | package com.smk.bi.ticketing.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* // TODO Comment
*/
// Nama Dody putra
// NIS 16.10.1.067
@Entity
@Table(name = "city")
public class City {
@Id
@GeneratedValue(stategy = GenerationType.IDENTITY)
private Long cityId;
private String cityName;
private String isValid;
public Long getCityId() {
return cityId;
}
public void setCityId(Long cityId) {
this.cityId = cityId;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getIsValid() {
return isValid;
}
public void setIsValid(String isValid) {
this.isValid = isValid;
}
}
| [
"[email protected]"
] | |
db837f72875ba801c892eafa6517a846c90dbd85 | 7b733d7be68f0fa4df79359b57e814f5253fc72d | /projects/sitemanage/src/main/java/com/percussion/packagemanagement/IPSStartupPkgInstaller.java | 62099c968ef3d567c273ff6d23f9254fd5d92efb | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0",
"OFL-1.1",
"LGPL-2.0-or-later"
] | permissive | percussion/percussioncms | 318ac0ef62dce12eb96acf65fc658775d15d95ad | c8527de53c626097d589dc28dba4a4b5d6e4dd2b | refs/heads/development | 2023-08-31T14:34:09.593627 | 2023-08-31T14:04:23 | 2023-08-31T14:04:23 | 331,373,975 | 18 | 6 | Apache-2.0 | 2023-09-14T21:29:25 | 2021-01-20T17:03:38 | Java | UTF-8 | Java | false | false | 799 | java | /*
* Copyright 1999-2023 Percussion Software, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.percussion.packagemanagement;
/**
* Manages installation of packages at server-startup
*
* @author JaySeletz
*
*/
public interface IPSStartupPkgInstaller
{
}
| [
"[email protected]"
] | |
158fd64c7527cf3a470e5f17d740ebeac09303f7 | f5db18eff6a5cdf0d8fff32864a761b69e591f70 | /Production.java | 89e0bb0343aa34ade67d4bf02c9e1138d31b0431 | [] | no_license | kotvagoudoungou/pro | 25dc8d2016b20db04cd80104e14337f80e5ac6d5 | d0a8f0ff569779f721072fca8faa76aa88831dad | refs/heads/master | 2021-08-17T01:53:44.146150 | 2017-11-20T16:55:47 | 2017-11-20T16:55:47 | 111,438,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 889 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package miniprojet;
/**
*
* @author emmanuel
*/
public class Production extends Employe{
public int nombreUnite;
public int unites;
public final static int SalaireBase=110000;
public Production(String nom,String prenom,String matricule,String dateEmbauche,int age,int nombreUnite){
super(nom,prenom,matricule,dateEmbauche,age);
this.nombreUnite=nombreUnite;
}
public double getNombreHeure(){
return nombreUnite;
}
public void setNombreHeure(int h){
this.nombreUnite=h;
}
public double calculerSalaire(){
return (nombreUnite* unites)+SalaireBase;
}
}
| [
"[email protected]"
] | |
86c39e8acf88a7da68e9e5ba7815805515d3f375 | 33c6ab5ad73c3e560a32beec9df23f030df59dd5 | /app/src/main/java/com/whitebird/parcel/Transporter/TransporterProfile/ActTransProfileDisplay.java | 83096d3ce9da150bc09379cacde864a8f9ac8de2 | [] | no_license | amsmid/Parcel | 126f693d4e60171186cc6895f1a2c764f4b1c878 | 9d36c1c738577cb2ee3f01a95e30b4f8d772b9d8 | refs/heads/master | 2020-03-19T06:00:44.686775 | 2017-04-12T08:15:34 | 2017-04-12T08:15:34 | 135,982,719 | 0 | 1 | null | 2018-06-04T06:49:41 | 2018-06-04T06:49:41 | null | UTF-8 | Java | false | false | 3,896 | java | package com.whitebird.parcel.Transporter.TransporterProfile;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import com.whitebird.parcel.Owner.Profile.ProfileActivity.EditProfileActivity;
import com.whitebird.parcel.R;
import com.whitebird.parcel.SharedPreferenceUserData;
public class ActTransProfileDisplay extends AppCompatActivity {
TextView editTextName,editTextEmail,editTextMobNo,editTextPsswd,editTextAddress,editTextPinCode,editTextState,editTextCity,textViewCityArea,textViewVehicleType;
SharedPreferenceUserData sharedPreferenceUserData;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_act_trans_profile_display);
editTextName = (TextView) findViewById(R.id.trans_profile_view_profile_o_name);
editTextEmail = (TextView)findViewById(R.id.trans_profile_view_profile_o_email);
editTextMobNo = (TextView)findViewById(R.id.trans_profile_view_profile_o_mobile_no);
editTextAddress = (TextView)findViewById(R.id.trans_profile_view_profile_o_address);
editTextPinCode = (TextView)findViewById(R.id.trans_profile_view_profile_o_pincode);
editTextState = (TextView)findViewById(R.id.trans_profile_view_profile_o_state);
editTextCity = (TextView)findViewById(R.id.trans_profile_view_profile_o_city);
textViewCityArea = (TextView)findViewById(R.id.trans_profile_view_profile_o_city_area);
textViewVehicleType = (TextView)findViewById(R.id.trans_profile_view_profile_o_vehicle);
//If Result Needs To Be Recheck Before Profile Display Put Store All Data Cls Here
//Get All Need Data From Share Preference
sharedPreferenceUserData = new SharedPreferenceUserData(this);
editTextName.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_name)));
editTextEmail.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_email)));
editTextMobNo.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_mobileNo)));
editTextAddress.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_address)));
editTextPinCode.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_pincode)));
editTextState.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_stateName)));
editTextCity.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_cityName)));
textViewCityArea.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_interCity)));
textViewVehicleType.setText(sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_vehicle)));
switch (sharedPreferenceUserData.getMyLoginUserData(getResources().getString(R.string.key_interCity))){
case "0":
textViewCityArea.setText("Inter-City");
break;
case "1":
textViewCityArea.setText("Intra-City");
break;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.profile_menu_for_edit,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id==R.id.menu_edit_profile){
Intent intentEditProfile = new Intent(this,ActTransProfileEdit.class);
startActivity(intentEditProfile);
finish();
}
return true;
}
}
| [
"[email protected]"
] | |
62e69fa74b86ce35ea2a59cdd6c916862f553d2e | 0ac7c33b0bfd133885a89d64c637cd48aa176fca | /app/src/main/java/com/findtech/threePomelos/home/presenter/UserFragmentPresent.java | 9e284f04e93dacf421da8295ad856011f870997c | [] | no_license | AlexTiti/threeGrapefruit | 8f6a19f70eece257ec021a7c4f5b5ffda51be0cd | be5b549e1c1112a0eb77893cc27c787703b306b4 | refs/heads/master | 2020-03-18T12:11:59.833602 | 2018-06-26T11:17:26 | 2018-06-26T11:17:36 | 134,657,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,656 | java | package com.findtech.threePomelos.home.presenter;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.animation.CycleInterpolator;
import com.findtech.threePomelos.R;
import com.findtech.threePomelos.database.OperateDBUtils;
import com.findtech.threePomelos.entity.BabyInfoEntity;
import com.findtech.threePomelos.home.fragment.UserFragment;
import com.findtech.threePomelos.home.model.UserFragmentModelImpl;
import com.findtech.threePomelos.music.model.MusicCollectModelImpl;
import com.findtech.threePomelos.mydevices.bean.DeviceCarBean;
import com.findtech.threePomelos.sdk.MyApplication;
import com.findtech.threePomelos.sdk.base.mvp.BasePresenterMvp;
import com.findtech.threePomelos.sdk.manger.RxHelper;
import com.findtech.threePomelos.user.bean.UserInfo;
import com.findtech.threePomelos.utils.PicOperator;
import com.findtech.threePomelos.utils.SpUtils;
import java.util.ArrayList;
import io.reactivex.functions.Consumer;
/**
* @author : Alex
* @version : V 2.0.0
* @email : [email protected]
* @date : 2018/05/05
*/
public class UserFragmentPresent extends BasePresenterMvp<UserFragment, UserFragmentModelImpl> {
@Override
public UserFragmentModelImpl createModel() {
return new UserFragmentModelImpl();
}
public void getUserDevice() {
if (model == null || mView == null) {
return;
}
mRxManager.register(model.getUserDeviceArray().compose(
RxHelper.<ArrayList<DeviceCarBean>>rxSchedulerHelper())
.subscribe(new Consumer<ArrayList<DeviceCarBean>>() {
@Override
public void accept(ArrayList<DeviceCarBean> beanArrayList) throws Exception {
mView.getDeviceSuccess(beanArrayList);
UserInfo.getInstance().setCarBeanArrayList(beanArrayList);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
mView.getDeviceFailed(throwable.getMessage());
}
}));
}
public void getBabyList(Context context) {
if (model == null || mView == null) {
return;
}
mRxManager.register(model.getBabyList(context).compose(
RxHelper.<ArrayList<BabyInfoEntity>>rxSchedulerHelper()
).subscribe(new Consumer<ArrayList<BabyInfoEntity>>() {
@Override
public void accept(ArrayList<BabyInfoEntity> strings) throws Exception {
mView.loadSuccess(strings);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
mView.loadFailed(throwable.getMessage());
}
}));
}
public void queryBabyList(Context context) {
if (model == null || mView == null) {
return;
}
mRxManager.register(model.getDataBaseObservable(context).compose(
RxHelper.<ArrayList<BabyInfoEntity>>rxSchedulerHelper()
).subscribe(new Consumer<ArrayList<BabyInfoEntity>>() {
@Override
public void accept(ArrayList<BabyInfoEntity> strings) throws Exception {
mView.loadSuccess(strings);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
mView.loadFailed(throwable.getMessage());
}
}));
}
public void getCollectMusicCount(Context context) {
if (model == null || mView == null) {
return;
}
final MusicCollectModelImpl model = new MusicCollectModelImpl();
mRxManager.register(model.getMusicCollectCount(context)
.compose(RxHelper.<String>rxSchedulerHelper())
.subscribe(new Consumer<String>() {
@Override
public void accept(String aDouble) throws Exception {
mView.getCollectMusic(aDouble);
UserInfo.getInstance().setCollectOnlyNumber(Integer.valueOf(aDouble));
}
}));
}
public void deleteDevice(String deviceNumAddress) {
if (model == null || mView == null) {
return;
}
mRxManager.register(model.deleteDevice(deviceNumAddress)
.compose(RxHelper.<String>rxSchedulerHelper())
.subscribe(new Consumer<String>() {
@Override
public void accept(String o) throws Exception {
mView.deleteDeviceSuccess(o);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
mView.deleteDeviceFailed(throwable.getMessage());
}
}));
}
public void saveBabyName(final String name, final Context context) {
if (name == null) {
return;
}
if (model == null || mView == null) {
return;
}
mRxManager.register(model.sendBabyName(name).compose(RxHelper.<String>rxSchedulerHelper())
.subscribe(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
UserInfo.getInstance().setNickName(name);
mView.changeNickNameSuccess(s);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
mView.changeNickNameFailed(throwable.getMessage());
}
}));
}
public void saveHeadImage(final Bitmap bitmap, final Context context) {
if (bitmap == null) {
return;
}
if (model == null || mView == null) {
return;
}
mRxManager.register(model.saveFileHeadImage(bitmap).compose(RxHelper.<Bitmap>rxSchedulerHelper())
.subscribe(new Consumer<Bitmap>() {
@Override
public void accept(Bitmap s) throws Exception {
mView.changePictureSuccess(bitmap);
PicOperator.saveToData(context, bitmap, MyApplication.getInstance().getHeadIconPath());
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
mView.changePictureFailed(throwable.getMessage());
}
}));
}
public void deleteBaby(int position, Context context) {
if (model == null || mView == null) {
return;
}
mRxManager.register(model.deleteBaby(position, context)
.compose(RxHelper.<String>rxSchedulerHelper())
.subscribe(new Consumer() {
@Override
public void accept(Object o) throws Exception {
mView.deleteBabySuccess();
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
mView.deleteBabyFailed(throwable.getMessage());
}
}));
}
}
| [
"[email protected]"
] | |
eec84bb67b3dd4570dc9f39badcf7b48f6901cc7 | 81f6f7871e464e96464710f5ee1e381047bf47c2 | /Desktop/Gradle Packages/Shuftipro /shuftipro/src/main/java/com/shutipro/sdk/custom_views/CameraPreview.java | e14f59c4729148ad4d53d640d67747169386a75f | [] | no_license | Saudali009/learning | f2136508440188ff56401f7757f1433a936efe47 | 0a6b1cd58fa049d99cb274aaf712a24b6f19028d | refs/heads/master | 2020-04-28T05:10:02.714614 | 2019-03-11T13:48:49 | 2019-03-11T13:48:49 | 175,009,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,600 | java | package com.shutipro.sdk.custom_views;
import android.content.Context;
import android.content.res.Configuration;
import android.hardware.Camera;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import com.shutipro.sdk.utils.Screens;
import java.io.IOException;
import java.util.List;
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
private static final String TAG = "CameraPreview";
private SurfaceHolder mHolder;
private Camera mCamera;
private Context mContext;
private String flashMode = Camera.Parameters.FLASH_MODE_OFF;
public CameraPreview(Context context, Camera camera) {
super(context);
mCamera = camera;
mContext = context;
mHolder = getHolder();
mHolder.addCallback(this);
// deprecated setting, but required on Android versions prior to 3.0
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
public void surfaceCreated(SurfaceHolder holder) {
try {
// create the surface and start camera preview
if (mCamera != null) {
mCamera.setPreviewDisplay(holder);
optimizeCameraDimens(mCamera);
mCamera.startPreview();
}
} catch (IOException e) {
Log.d(VIEW_LOG_TAG, "Error setting camera preview: " + e.getMessage());
}
}
public void refreshCamera(Camera camera) {
if (mHolder.getSurface() == null) {
// preview surface does not exist
return;
}
// stop preview before making changes
try {
mCamera.stopPreview();
} catch (Exception e) {
// ignore: tried to stop a non-existent preview
}
// set preview size and make any resize, rotate or
// reformatting changes here
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
if (camera != null) {
camera.setDisplayOrientation(90);
}
}
// start preview with new settings
setCamera(camera);
try {
mCamera.setPreviewDisplay(mHolder);
optimizeCameraDimens(mCamera);
mCamera.startPreview();
} catch (Exception e) {
Log.d(VIEW_LOG_TAG, "Error starting camera preview: " + e.getMessage());
}
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// If your preview can change or rotate, take care of those events here.
// Make sure to stop the preview before resizing or reformatting it.
refreshCamera(mCamera);
}
public void setCamera(Camera camera) {
//method to set a camera instance
mCamera = camera;
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
// mCamera.release();
}
private void optimizeCameraDimens(Camera mCamera) {
final int width = Screens.getScreenWidth(mContext);
final int height = Screens.getScreenHeight(mContext);
final List<Camera.Size> mSupportedPreviewSizes = mCamera.getParameters().getSupportedPreviewSizes();
for(Camera.Size str: mSupportedPreviewSizes)
Log.e(TAG, str.width + "/" + str.height);
Camera.Size mPreviewSize;
if (mSupportedPreviewSizes != null) {
mPreviewSize = getOptimalPreviewSize(mSupportedPreviewSizes, width, height);
float ratio;
if(mPreviewSize.height >= mPreviewSize.width)
ratio = (float) mPreviewSize.height / (float) mPreviewSize.width;
else
ratio = (float) mPreviewSize.width / (float) mPreviewSize.height;
// One of these methods should be used, second method squishes preview slightly
setMeasuredDimension(width, (int) (width * ratio));
Camera.Parameters parameters = mCamera.getParameters();
//parameters.setPreviewSize(mPreviewSize.width, mPreviewSize.height);
parameters.setFlashMode(flashMode);
mCamera.setParameters(parameters);
}
}
private Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h) {
final double ASPECT_TOLERANCE = 0.1;
double targetRatio = (double) h / w;
if (w > h)
targetRatio = (double) w / h;
if (sizes == null)
return null;
Camera.Size optimalSize = null;
double minDiff = Double.MAX_VALUE;
int targetHeight = h;
for (Camera.Size size : sizes) {
double ratio = (double) size.width / size.height;
if(size.height >= size.width)
ratio = (float) size.height/size.width;
if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE)
continue;
if (Math.abs(size.height - targetHeight) < minDiff) {
optimalSize = size;
minDiff = Math.abs(size.height - targetHeight);
}
}
if (optimalSize == null) {
minDiff = Double.MAX_VALUE;
for (Camera.Size size : sizes) {
if (Math.abs(size.height - targetHeight) < minDiff) {
optimalSize = size;
minDiff = Math.abs(size.height - targetHeight);
}
}
}
return optimalSize;
}
public void setFlashMode(String mode) {
flashMode = mode;
}
} | [
"[email protected]"
] | |
0482981843e05422d591f352f9d35196e1670461 | 962d9282046eb504f4027d9161e73b2729202e58 | /Doctor Suggestion/Admin.java | f51e01b7afac67d73e9810c2b9e8c683862a6220 | [] | no_license | MusabbirIslam/Doctor-Suggestion-Java- | 15931d9131d27706b685db145040e3c272a669b3 | 3f2271cd90433cfd80a2c2b6d75f119d8a125fdb | refs/heads/master | 2020-05-07T18:04:58.748784 | 2019-04-11T10:27:13 | 2019-04-11T10:27:13 | 180,753,675 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import java.text.*;
import java.util.Arrays;
class Admin extends JFrame implements ActionListener{
private JPasswordField passwordField;
private JLabel passwordLavel;
private JButton submitButton;
private char [] password;
private JLabel massageLabel;
public Admin()
{
//password
password=new char[] {'s','h','a','m','i','k'};
//label
massageLabel = new JLabel ("Wrong Password");
massageLabel.setBounds(250,320,100,20);
massageLabel.setVisible(false);
add(massageLabel);
passwordLavel=new JLabel("Password : ");
passwordLavel.setBounds(150,200,100,20);
add(passwordLavel);
//password
passwordField = new JPasswordField(20);
passwordField.setBounds(250,200,100,25);
add(passwordField);
//button
submitButton=new JButton("Submit");
submitButton.addActionListener(this);
submitButton.setBounds(220,250,100,45);
add(submitButton);
//window close
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
System.exit(0);
}
});
setTitle("Smart Doctor");
setSize(600,600);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
if (e.getSource()==submitButton){
if (Arrays.equals(password, passwordField.getPassword())) {
AdminPanel a=new AdminPanel();
}
else {
massageLabel.setVisible(true);
}
}
}
} | [
"[email protected]"
] | |
c89a7fa61113d25068a16207200e601dd17153db | 5439076995fdcbbca55a80ea58317d37f66d8823 | /TechAJain/src/patterns/decorator/ColumnPopupDecorator.java | f69d26a1bb5c84318328451a978ccc3ed130636f | [] | no_license | akasjain/datastructure | 8b29b73ea1a18417b372a151e216252d90854c0a | b090eb8139c65fe30a84a767609e23c359e76fe5 | refs/heads/master | 2021-04-27T09:38:38.888301 | 2020-08-29T10:24:21 | 2020-08-29T10:24:21 | 122,518,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package patterns.decorator;
public class ColumnPopupDecorator extends ColumnDecorator {
public ColumnPopupDecorator(Report report) {
super(report);
}
@Override
public String getFirstColumnData() {
return designPopup(super.getFirstColumnData());
}
private String designPopup(String firstColumnData) {
return firstColumnData + "Popup decorated";
}
}
| [
"[email protected]"
] | |
5a7f67007116faaaca66e9da7c1e49eeba561b22 | 2358ad6ebfaf9ccc04efde767873f9a1538d2e8b | /Module1/bean/AppProducts.java | 54180da5868d97556807a03fa5531877d9e5e1e2 | [] | no_license | Shwetha-PS/TY_CG_HTD_BangaloreNovember_JFS_ShwethaPS | 1984724f491c4bd2e393581845beb43e91cdd041 | 491a6ca336def7c87baaab933964ab8e341b829e | refs/heads/master | 2023-01-11T03:00:51.062160 | 2020-06-10T13:36:45 | 2020-06-10T13:36:45 | 225,846,329 | 0 | 0 | null | 2023-01-07T19:00:40 | 2019-12-04T11:02:02 | Java | UTF-8 | Java | false | false | 181 | java | package com.capgemini.module1.bean;
import com.capgemini.module1.controller.HomePage;
public class AppProducts {
public static void main(String[] args) {
HomePage.home();
}
}
| [
"[email protected]"
] | |
2c3e7dd5ea34602ab7890e1d2fbbadb5de2d6194 | 61236b5bd10434aaeba8802f935b861ca1b41624 | /android/app/src/main/java/com/entertainerJatt/app/android/adapters/viewholder/RecyclerHeaderViewHolder.java | 19486dd5d81a69c8cf515a19170f81c9c75cc1e5 | [] | no_license | Entaitainerjatt/app | b2d0450e2bc6ee5af120e5508f3700ac2a2d877a | 4c306e84075188befb30e1786f8437976092dc17 | refs/heads/master | 2021-01-20T10:18:24.833714 | 2017-05-05T06:42:18 | 2017-05-05T06:42:18 | 90,342,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package com.entertainerJatt.app.android.adapters.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class RecyclerHeaderViewHolder extends RecyclerView.ViewHolder {
public RecyclerHeaderViewHolder(View itemView) {
super(itemView);
}
}
| [
"[email protected]"
] | |
ac3751a0d4a595880d8afadc67b975cc3c391723 | dc653c8937a75b5de7cb3175a02b13585a04750b | /src/com/xiaweizi/design/p05_adapter/classadapter/VoltAdapter.java | 6c05e193e149943679ca445cfe9c7506d3caf931 | [] | no_license | xiaweizi/DesignPattern | 34fcbda645fd4c806cab2dc0fbe5c95479ecdc98 | 3b7a6c225316ddd7560deeeb075d6ea39fa2d7e6 | refs/heads/master | 2020-03-22T17:35:21.878235 | 2018-07-13T10:17:43 | 2018-07-13T10:17:43 | 140,403,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.xiaweizi.design.p05_adapter.classadapter;
/**
* <pre>
* author : xiaweizi
* class : com.xiaweizi.design.p05_adapter.classadapter.VoltAdapter
* e-mail : [email protected]
* time : 2018/07/11
* desc :
* </pre>
*/
class VoltAdapter extends Volt220 implements Volt5{
@Override
public int getVolt5() {
return 5;
}
}
| [
"[email protected]"
] | |
382fea74f8ca8be3b9d1ed8b9d7d6a93eaa89bcf | 7094b816ca6eb0d4752de8a75f155311ed56e52b | /three_bears/quotor-academy/quotor-academy-biz/src/main/java/com/quotorcloud/quotor/academy/controller/TestController.java | 5bd86cafc855a0d05a73e36605d621de8736d466 | [] | no_license | a97659096/quotor | ebce8bb5a61d082abf882aabff4d7a5e167c4da7 | 7ebe9a3ef906110fb155114a199351dd033a3b17 | refs/heads/master | 2023-08-10T05:33:02.055405 | 2019-12-25T01:23:07 | 2019-12-25T01:23:07 | 229,431,115 | 0 | 0 | null | 2023-07-23T00:58:58 | 2019-12-21T13:27:33 | Java | UTF-8 | Java | false | false | 767 | java | package com.quotorcloud.quotor.academy.controller;
import com.quotorcloud.quotor.academy.service.TestDataService;
import com.quotorcloud.quotor.common.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("test")
public class TestController {
@Autowired
private TestDataService testDataService;
@GetMapping("product")
public R listProduct(){
return R.ok(testDataService.listProduct());
}
@GetMapping("shop")
public R listShop(){
return R.ok(testDataService.listShop());
}
}
| [
"[email protected]"
] | |
8398e47b9dec45b2cce89f54d71cff0cff1c1a0f | 1c98a3c20845a9d795e2b8acbc7fd0e6939c3aaa | /src/main/java/com/tiago/cursomc/repositories/CidadeRepository.java | 9a9584d0ade8a2f3bd5f969d7448db00ffd916d2 | [] | no_license | Tiagohs199/cursomc | b3e779620fba9dfae6c7b68973a59be26d4360c8 | dc717e854f4fcf8aa55814fbc29c451b1e55b91a | refs/heads/master | 2023-09-05T15:10:32.402300 | 2021-11-02T15:45:17 | 2021-11-02T15:45:17 | 385,086,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package com.tiago.cursomc.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.tiago.cursomc.domain.Cidade;
@Repository
public interface CidadeRepository extends JpaRepository<Cidade, Integer> {
}
| [
"[email protected]"
] | |
0aad188fccf47aad3fd8e7aa89b44d5a0ce8c5a9 | a730dfef2622fb77e790d150b601f0ad223f156d | /src/ru/dager/storage/AbstractFileStorage.java | f86e7f95dbf61b1b35896d444249e732ff9cd956 | [] | no_license | DagerPro/basejava | 5c6c8b2e5f2b82ea9be45fa03c98f7a4e0db19c1 | 32d210255d3e3a13fb81661273395f108065e80b | refs/heads/master | 2020-04-05T18:19:38.710855 | 2019-01-05T21:49:13 | 2019-01-05T21:49:13 | 157,097,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,011 | java | package ru.dager.storage;
import ru.dager.exeption.StorageException;
import ru.dager.model.Resume;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public abstract class AbstractFileStorage extends AbstractStorage<File> {
private File directory;
protected abstract void doWrite(Resume r, OutputStream os) throws IOException;
protected abstract Resume doRead(InputStream is) throws IOException;
protected AbstractFileStorage(File directory) {
Objects.requireNonNull(directory, "directory must not be null");
if (!directory.isDirectory()) {
throw new IllegalArgumentException(directory.getAbsolutePath() + " is not directory");
}
if (!directory.canRead() || !directory.canWrite()) {
throw new IllegalArgumentException(directory.getAbsolutePath() + " is not readable/writable");
}
this.directory = directory;
}
@Override
public void clear() {
File[] files = directory.listFiles();
if (files != null) {
for (File file : files) {
doDelete(file);
}
}
}
@Override
public int size() {
String[] list = directory.list();
if (list == null) {
throw new StorageException("Directory read error", null);
}
return list.length;
}
@Override
protected File getSearchKey(String uuid) {
return new File(directory, uuid);
}
@Override
protected void doUpdate(Resume r, File file) {
try {
doWrite(r, new BufferedOutputStream(new FileOutputStream(file)));
} catch (IOException e) {
throw new StorageException("File write error", r.getUuid(), e);
}
}
@Override
protected boolean isExist(File file) {
return file.exists();
}
@Override
protected void doSave(Resume r, File file) {
try {
file.createNewFile();
} catch (IOException e) {
throw new StorageException("Couldn't create file " + file.getAbsolutePath(), file.getName(), e);
}
doUpdate(r, file);
}
@Override
protected Resume doGet(File file) {
try {
return doRead(new BufferedInputStream(new FileInputStream(file)));
} catch (IOException e) {
throw new StorageException("File read error", file.getName(), e);
}
}
@Override
protected void doDelete(File file) {
if (!file.delete()) {
throw new StorageException("File delete error", file.getName());
}
}
@Override
protected List<Resume> doCopyAll() {
File[] files = directory.listFiles();
if (files == null) {
throw new StorageException("Directory read error", null);
}
List<Resume> list = new ArrayList<>(files.length);
for (File file : files) {
list.add(doGet(file));
}
return list;
}
}
| [
"[email protected]"
] | |
e03eb45609a86eb46465f8a4b2a70d2a7dc2698b | 30380706e9ca4d682c650725209e75f5a772a63f | /ALGO3/Cappo/tarea6/ejercicio1/Puntos1.java | b78a6806a1cec339d0254f1df6fe04d3e2a5e73c | [] | no_license | CamilaAlderete/Caja | 333be260c29d217bdee318a9e6d90954d99ad759 | c0ea1b675240c181c5a997859bb648a43d333d94 | refs/heads/master | 2023-08-21T21:00:47.193095 | 2021-04-24T01:14:38 | 2021-04-24T01:14:38 | 361,040,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 469 | java |
/*
G16
Luis Pereira
Eric Ruiz Diaz
Trabajo hecho con la participacion y cooperacion de G03
*/
public class Puntos1 implements Comparable<Puntos1>{
public int x;
public int y;
Puntos1(int px,int py){
this.x=px;
this.y=py;
}
@Override
public int compareTo(final Puntos1 punto1){
if ( (this.x - punto1.x)==0) {
return punto1.y -this.y;// ascendente
//return this.y - punto1.y;//descendente
}
return this.x - punto1.x;
}
}
| [
"[email protected]"
] | |
5eb41ff36b8d9650b11493154efc133ae84e9d40 | 1284d1bf621fd21afcc9bec698d471e86146395b | /java-fundamentals/src/com/adruy/collections/SortingMapByValue.java | 1f7be607b90fb3f6e4823eb749331f796d5ff8ed | [] | no_license | adi4387/Learning | 7d64aec3dc70f0558753674e5e3f4dfa3c6ac28d | d3d7651e23f32d95350c6e4d82a348f0e28a92ae | refs/heads/main | 2023-03-04T10:44:02.466759 | 2023-02-10T04:18:45 | 2023-02-10T04:18:45 | 303,966,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,480 | java | package com.adruy.collections;
// Java program to sort hashmap by values
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class SortingMapByValue {
// function to sort hashmap by values
public static Map<String, Integer> sortByValue(Map<String, Integer> hm)
{
// Create a list from elements of HashMap
List<Map.Entry<String, Integer> > list =
new LinkedList<>(hm.entrySet());
// Sort the list
list.sort(Map.Entry.comparingByValue());
// put data from sorted list to hashmap
HashMap<String, Integer> temp = new LinkedHashMap<>();
for (Map.Entry<String, Integer> aa : list) {
temp.put(aa.getKey(), aa.getValue());
}
return temp;
}
// Driver Code
public static void main(String[] args)
{
HashMap<String, Integer> hm = new HashMap<>();
// enter data into hashmap
hm.put("Math", 98);
hm.put("Data Structure", 85);
hm.put("Database", 91);
hm.put("Java", 95);
hm.put("Operating System", 79);
hm.put("Networking", 80);
Map<String, Integer> hm1 = sortByValue(hm);
// print the sorted hashmap
for (Map.Entry<String, Integer> en : hm1.entrySet()) {
System.out.println("Key = " + en.getKey() +
", Value = " + en.getValue());
}
}
}
| [
"[email protected]"
] | |
de3c47aeceb00e4bb46744468ae2977c40b00faa | 038eb3f5b90365c4f9f19d1f2db3f9baf4e047c2 | /app/src/main/java/com/example/android/moviestrends/MainActivity.java | b0783a36c138c6daf6c4a56bf82007a5c8442efc | [] | no_license | pravs0510/MoviesTrends | f57cc88ac9a471c6fd3f21df0299de8eb4ecd44f | 554f087c26350e95e0cbb4a51add5a4db0adfb96 | refs/heads/master | 2020-05-26T06:15:43.949862 | 2015-11-23T23:33:17 | 2015-11-23T23:33:17 | 41,284,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,890 | java | /*
* Copyright (C) 2013 The Android Open Source Project
*/
package com.example.android.moviestrends;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.example.android.moviestrends.AdapterPackage.ArrayObj;
public class MainActivity extends AppCompatActivity implements MainActivityFragment.Callback {
private boolean mTwoPane;
// private String mLocation;
private static final String DETAILFRAGMENT_TAG = "DFTAG";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (findViewById(R.id.move_detail_container) != null) {
// The detail container view will be present only in the large-screen layouts
// (res/layout-sw600dp). If this view is present, then the activity should be
// in two-pane mode.
mTwoPane = true;
// In two-pane mode, show the detail view in this activity by
// adding or replacing the detail fragment using a
// fragment transaction.
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.move_detail_container, new DetailActivityFragment(), DETAILFRAGMENT_TAG)
.commit();
}
} else {
mTwoPane = false;
}
}
@Override
public void onItemSelected(ArrayObj movieItem,boolean favMovies) {
if (mTwoPane) {
// In two-pane mode, show the detail view in this activity by
// adding or replacing the detail fragment using a
// fragment transaction.
Bundle args = new Bundle();
args.putParcelable(DetailActivityFragment.DETAIL_URI, movieItem);
args.putBoolean(DetailActivityFragment.FAV,favMovies);
DetailActivityFragment fragment = new DetailActivityFragment();
fragment.setArguments(args);
getSupportFragmentManager().beginTransaction()
.replace(R.id.move_detail_container, fragment, DETAILFRAGMENT_TAG)
.commit();
} else {
Intent intent = new Intent(this, DetailActivity.class).putExtra(Intent.EXTRA_TEXT, movieItem.original_title)
.putExtra(getString(R.string.poster_path), movieItem.poster_path)
.putExtra(getString(R.string.id), movieItem.id)
.putExtra(getString(R.string.favMovie), favMovies);
startActivity(intent);
}
}
@Override
protected void onResume() {
super.onResume();
MainActivityFragment mf = (MainActivityFragment)getSupportFragmentManager().findFragmentById(R.id.fragment_main);
mf.updateMovie();
}
}
| [
"[email protected]"
] |
Subsets and Splits