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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4e188c3b01bbf1a5085c5dfdec00066b9cb40320 | ef8f74b2e9437cf61c8f9b8de8a422d2a0b7f507 | /src/main/java/com/wojciech/gaudnik/spock_test/SpockTestApplication.java | 8f5054c460dc7d789a84ca744c157c5414f850ab | [] | no_license | wojciechGaudnik/spock_test | 4eabe0d69a4e72a227596dcb542cd96de3fb0d89 | 6e6556333a7a73024cc7933dc56b18d2f4ef07a6 | refs/heads/master | 2022-12-23T12:47:24.617269 | 2020-10-04T20:24:37 | 2020-10-04T20:24:37 | 294,956,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.wojciech.gaudnik.spock_test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
@SpringBootApplication
@EnableCaching
public class SpockTestApplication {
public static void main(String[] args) {
SpringApplication.run(SpockTestApplication.class, args);
}
}
| [
"[email protected]"
] | |
4899610237a0bb089e095730009282ad1a1605b5 | 40951f7e3de12d69f3116116cbe5010cf7678792 | /src/main/java/cn/sibu/codegen/interfaces/ColumnMetaService.java | d54e07dec8c5540503519160e79477e306bdab48 | [] | no_license | liuqi007/CodeGen | 4bdccc56e1c55ca6540921180620e08c095cab88 | 50a4d4a63cc6e724c67ed8cff12c34a30439632d | refs/heads/master | 2021-01-10T08:12:41.290751 | 2015-11-04T09:17:10 | 2015-11-04T09:17:10 | 43,069,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | package cn.sibu.codegen.interfaces;
import java.util.List;
import cn.sibu.codegen.vo.ColumnMeta;
/**
* 数据库表描述接口
* @author liuqi
*
*/
public interface ColumnMetaService {
public List<ColumnMeta> getAllColumnName(String tableName);
}
| [
"[email protected]"
] | |
74d047d72948a1095f4a0d384694ad771f859f1d | 5d4fc6b8081950a540250e6575a3b9c7c4c1e8ca | /src/main/java/model/Definition.java | 005c856146e7df41defbfddaa63c69091c3a98a7 | [] | no_license | aminmansour/pushdown-automata | cf12fce8fdf624f05ecb167c7ccf54589e7d7485 | 2fb6d63ee334cf4b7d65d138150485ca63e74dad | refs/heads/master | 2020-03-27T11:52:04.656352 | 2018-08-28T21:12:59 | 2018-08-28T21:12:59 | 146,510,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,031 | java | package model;
import java.util.ArrayList;
/**
* Definition is the item specification which is loaded into the PDAMachine instance. It describes
* the structure of the PDA and holds all the transitions which are possible.
*/
public class Definition {
private String identifier;
private ArrayList<ControlState> states;
private boolean isAcceptByFinalState;
private ArrayList<Transition> transitions;
private ControlState initialState;
private String exampleHint;
/**
* An in-depth constructor for a Definition object
*
* @param identifier the id assigned to definition (for saving purposes)
* @param states the control states
* @param initialState the initial state
* @param transitions the transitions which the PDA will be able to make
* @param isAcceptByFinalState the accepting criterion of the PDA
*/
public Definition(String identifier, ArrayList<ControlState> states, ControlState initialState, ArrayList<Transition> transitions, boolean isAcceptByFinalState) {
this.identifier = identifier;
this.states = states;
this.isAcceptByFinalState = isAcceptByFinalState;
this.transitions = transitions;
this.initialState = initialState;
initialState.markAsInitial();
}
/**
* A empty Definition constructor
*/
public Definition() { }
public void setStates(ArrayList<ControlState> states) {
this.states = states;
}
public boolean isAcceptByFinalState() {
return isAcceptByFinalState;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public ArrayList<ControlState> getStates() {
return states;
}
public ArrayList<Transition> getTransitions() {
return transitions;
}
public ControlState getInitialState() {
return initialState;
}
public void setInitialState(ControlState initialState) {
this.initialState = initialState;
}
public void setAcceptByFinalState(boolean acceptByFinalState) {
isAcceptByFinalState = acceptByFinalState;
}
public void setTransitions(ArrayList<Transition> transitions) {
this.transitions = transitions;
}
@Override
public boolean equals(Object obj) {
return identifier.equals(((Definition) obj).identifier);
}
/**
* A method which adds a transition to the already existing transitions
* @param newTransition the new transition to add
*/
public void addTransition(Transition newTransition) {
transitions.add(newTransition);
}
public String getExampleHint() {
return exampleHint;
}
public void setExampleHint(String exampleHint) {
this.exampleHint = exampleHint;
}
}
| [
"[email protected]"
] | |
442461c8b9d1091baf9810ef2649635456fdf461 | f9e41917e5323a247d42829563f60bf6f235770e | /spring-cloud-gcp-data-firestore/src/test/java/com/google/cloud/spring/data/firestore/repository/query/FirestoreRepositoryTests.java | dc2757222b4ff3c20540a2bc035e2537129e4c7e | [
"Apache-2.0"
] | permissive | melburne/spring-cloud-gcp | 6c75b6adcfeb1cba0ade45122cb532d6e40c3c1c | f30730d0c8c0698dcdd1788adbe4a29995386554 | refs/heads/main | 2023-04-08T18:55:52.774978 | 2021-04-20T18:02:11 | 2021-04-20T20:15:22 | 355,817,735 | 1 | 0 | Apache-2.0 | 2021-04-08T08:10:57 | 2021-04-08T08:10:56 | null | UTF-8 | Java | false | false | 4,179 | java | /*
* Copyright 2017-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.spring.data.firestore.repository.query;
import com.google.cloud.spring.data.firestore.FirestoreTemplate;
import com.google.cloud.spring.data.firestore.entities.User;
import com.google.cloud.spring.data.firestore.entities.UserRepository;
import com.google.cloud.spring.data.firestore.mapping.FirestoreClassMapper;
import com.google.cloud.spring.data.firestore.mapping.FirestoreDefaultClassMapper;
import com.google.cloud.spring.data.firestore.mapping.FirestoreMappingContext;
import com.google.cloud.spring.data.firestore.repository.config.EnableReactiveFirestoreRepositories;
import com.google.cloud.spring.data.firestore.repository.query.FirestoreRepositoryTests.FirestoreRepositoryTestsConfiguration;
import com.google.firestore.v1.StructuredQuery;
import com.google.firestore.v1.StructuredQuery.Direction;
import com.google.firestore.v1.StructuredQuery.FieldReference;
import com.google.firestore.v1.StructuredQuery.Order;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.Sort;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = FirestoreRepositoryTestsConfiguration.class)
public class FirestoreRepositoryTests {
@Autowired
private UserRepository userRepository;
@Autowired
private FirestoreTemplate template;
@Test
public void testSortQuery() {
userRepository.findByAgeGreaterThan(0, Sort.by("name")).blockLast();
ArgumentCaptor<StructuredQuery.Builder> captor =
ArgumentCaptor.forClass(StructuredQuery.Builder.class);
verify(template).execute(captor.capture(), eq(User.class));
StructuredQuery.Builder result = captor.getValue();
assertThat(result.getOrderByList()).containsExactly(
Order.newBuilder()
.setDirection(Direction.ASCENDING)
.setField(
FieldReference.newBuilder().setFieldPath("name"))
.build());
}
@Configuration
@EnableReactiveFirestoreRepositories(basePackageClasses = UserRepository.class)
static class FirestoreRepositoryTestsConfiguration {
private static final String DEFAULT_PARENT = "projects/my-project/databases/(default)/documents";
@Bean
public FirestoreMappingContext firestoreMappingContext() {
return new FirestoreMappingContext();
}
@Bean
public FirestoreTemplate firestoreTemplate(
FirestoreClassMapper classMapper, FirestoreMappingContext firestoreMappingContext) {
FirestoreTemplate template = Mockito.mock(FirestoreTemplate.class);
Mockito.when(template.getClassMapper()).thenReturn(classMapper);
Mockito.when(template.getMappingContext()).thenReturn(firestoreMappingContext);
Mockito.when(template.execute(any(), any())).thenReturn(Flux.empty());
return template;
}
@Bean
@ConditionalOnMissingBean
public FirestoreClassMapper getClassMapper(FirestoreMappingContext mappingContext) {
return new FirestoreDefaultClassMapper(mappingContext);
}
}
}
| [
"[email protected]"
] | |
3141a6341d667124ef9d484d829736cfba26d178 | 2b51f9dee4b34216bdd0010c828acf231a325856 | /src/com/reckitBekinser/activity/main/transaksiKeluar/GantiJumlahSparepartKeluarViewImpl.java | 356abb0ea4ffb63b29683e7f2614adfc6c413cf8 | [] | no_license | dikawardani24/Sistem-informasi-Sparepart | 7edbbb5ae9e0ba8ff458dea782857396a22bc78a | 5e2a19e7304af02ba22087d6ba6babe9fc447eb5 | refs/heads/master | 2020-03-19T12:27:04.768877 | 2018-06-19T14:32:05 | 2018-06-19T14:32:05 | 136,517,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,680 | java | /*
* Copyright (c) 2018 dika.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* dika - initial API and implementation and/or initial documentation
*/
package com.reckitBekinser.activity.main.transaksiKeluar;
import com.dika.view.component.Button;
import com.dika.view.component.Dialog;
import com.dika.view.component.Label;
import com.dika.view.component.TextField;
import com.dika.view.component.custom.DecimalFormattedTextField;
/**
*
* @author dika
*/
public class GantiJumlahSparepartKeluarViewImpl extends Dialog implements GantiJumlahSparepartKeluarView {
/**
* Creates new form GantiJumlahSparepartKeluarViewImpl
*/
public GantiJumlahSparepartKeluarViewImpl() {
super();
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
com.dika.view.component.Panel panel1 = new com.dika.view.component.Panel();
com.dika.view.component.custom.HeaderLabel headerLabel1 = new com.dika.view.component.custom.HeaderLabel();
jmlMaksLabel = new com.dika.view.component.Label();
com.dika.view.component.Label label2 = new com.dika.view.component.Label();
jumlahKeluarField = new com.dika.view.component.custom.RequireDecimalFormattedTextField();
saveButton1 = new com.dika.view.component.custom.SaveButton();
cancelButton1 = new com.dika.view.component.custom.CancelButton();
headerLabel1.setText("Ganti Jumlah Keluar");
jmlMaksLabel.setText("Jumlah Maksimum : ");
label2.setText("Masukkan Jumlah ");
javax.swing.GroupLayout panel1Layout = new javax.swing.GroupLayout(panel1);
panel1.setLayout(panel1Layout);
panel1Layout.setHorizontalGroup(
panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel1Layout.createSequentialGroup()
.addComponent(headerLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
.addComponent(jmlMaksLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panel1Layout.createSequentialGroup()
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jumlahKeluarField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(cancelButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(saveButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
panel1Layout.setVerticalGroup(
panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(headerLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jmlMaksLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jumlahKeluarField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cancelButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(panel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(panel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private com.dika.view.component.custom.CancelButton cancelButton1;
private com.dika.view.component.Label jmlMaksLabel;
private com.dika.view.component.custom.RequireDecimalFormattedTextField jumlahKeluarField;
private com.dika.view.component.custom.SaveButton saveButton1;
// End of variables declaration//GEN-END:variables
@Override
public Label getJmlMaxLabel() {
return jmlMaksLabel;
}
@Override
public DecimalFormattedTextField getJumlahField() {
return jumlahKeluarField;
}
@Override
public Button getSaveButton() {
return saveButton1;
}
@Override
public Button getCancelButton() {
return cancelButton1;
}
@Override
public Dialog getRoot() {
return this;
}
}
| [
"[email protected]"
] | |
deb4ee7592995123ac9d41e33f1af87bfa08b48d | 9f61aeb5c3049f7c4a705c290c6fce708a179742 | /springboot-service-pokeapi/src/main/java/com/alea/springboot/app/pokeapi/entity/resource/NamedAPIResource.java | 85a0195e4235eb744584060b4dc9ccedcedcb750 | [] | no_license | lordzuzen/pokeapi | 96739c133b82362a0d8320b6f68e15bde185b539 | 9d8be7b0a9d8d99cc0f0c51d153db5158ec78f3a | refs/heads/master | 2022-06-12T00:29:24.539344 | 2019-07-21T18:41:22 | 2019-07-21T18:41:22 | 197,946,720 | 0 | 0 | null | 2022-05-20T21:03:18 | 2019-07-20T15:13:47 | Java | UTF-8 | Java | false | false | 370 | java | package com.alea.springboot.app.pokeapi.entity.resource;
import java.io.Serializable;
import lombok.Data;
@Data
public class NamedAPIResource implements Serializable {
// The name of the referenced resource.
private String name;
// The URL of the referenced resource.
private String url;
private static final long serialVersionUID = 8375569723311021346L;
}
| [
"[email protected]"
] | |
2645e83c8f026bea4e41dbe78ab9e23f7c82d4cd | 1ee736ca765d7b70726c54b9c69be7b9b0a4a57b | /src/main/java/com/restservice/restService/RestServiceApplication.java | ac6bffdb6acf4808036c408b4cc1887cf1076558 | [] | no_license | kevinliangsgithub/restService | 245e7bce572b1853afd27751748c87b8a643533e | 357b8612794f53930e2afa7140fd47843db31965 | refs/heads/master | 2020-05-18T05:22:22.515129 | 2019-05-06T05:56:48 | 2019-05-06T05:56:48 | 184,204,150 | 0 | 0 | null | 2019-05-06T05:56:49 | 2019-04-30T06:24:53 | Java | UTF-8 | Java | false | false | 330 | java | package com.restservice.restService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RestServiceApplication {
public static void main(String[] args) {
SpringApplication.run(RestServiceApplication.class, args);
}
}
| [
"[email protected]"
] | |
7e8b8f6ed75e0787593f2dd5aa1582b877499c3b | 5ec9fb408734f9df5056cb90e4ee5a35c04aa3f7 | /app/src/main/java/com/example/pupquiz/Question8FragmentBreed.java | c963c79045a334b51e136d0b714c31299d3b5529 | [] | no_license | cb4kas17/PupQuizAndroidApp | 8bcd3c07ccadd4e163356632ac6573dc4df3933b | b4e140c54782fddc5d5435d4cc6c02a67bac4048 | refs/heads/master | 2023-01-22T19:18:13.731699 | 2020-12-04T15:07:32 | 2020-12-04T15:07:32 | 306,853,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,617 | java | package com.example.pupquiz;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
public class Question8FragmentBreed extends Fragment {
Button btn1, btn2, btn3, btn4;
String ans = "Siberian Husky";
public static int scorePerc;
public static int score;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_question8_breed, container, false);
perform(view);
QuizPageBreed.next.setEnabled(false);
QuizPageBreed.next.setVisibility(View.INVISIBLE);
return view;
}
public void perform(View view){
btn1 = view.findViewById(R.id.choice1BreedBtn8);
btn2 = view.findViewById(R.id.choice2BreedBtn8);
btn3 = view.findViewById(R.id.choice3BreedBtn8);
btn4 = view.findViewById(R.id.choice4BreedBtn8);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
btn1.setSelected(!btn1.isSelected());
QuizPageBreed.next.setVisibility(View.VISIBLE);
QuizPageBreed.next.setEnabled(true);
if(btn1.isSelected()){
if(btn1.getText().toString().equals(ans)){
scorePerc = 10;
score = 1;
btn1.setBackgroundResource(R.color.rightAns);
btn1.setEnabled(false);
Fragment fragmentCorrect = new CorrectFragment();
transit(fragmentCorrect);
}
else{
scorePerc = 0;
score = 0;
btn1.setBackgroundResource(R.color.wrongAns);
btn1.setEnabled(false);
Fragment fragmentWrong = new WrongFragment();
transit(fragmentWrong);
}
btn2.setEnabled(false);
btn3.setEnabled(false);
btn4.setEnabled(false);
}
}
});
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
btn2.setSelected(!btn2.isSelected());
QuizPageBreed.next.setVisibility(View.VISIBLE);
QuizPageBreed.next.setEnabled(true);
if(btn2.isSelected()){
if(btn2.getText().toString().equals(ans)){
scorePerc = 10;
score = 1;
btn2.setBackgroundResource(R.color.rightAns);
btn2.setEnabled(false);
Fragment fragmentCorrect = new CorrectFragment();
transit(fragmentCorrect);
}
else{
scorePerc = 0;
score = 0;
btn2.setBackgroundResource(R.color.wrongAns);
btn2.setEnabled(false);
Fragment fragmentWrong = new WrongFragment();
transit(fragmentWrong);
}
btn1.setEnabled(false);
btn3.setEnabled(false);
btn4.setEnabled(false);
}
}
});
btn3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
btn3.setSelected(!btn3.isSelected());
QuizPageBreed.next.setVisibility(View.VISIBLE);
QuizPageBreed.next.setEnabled(true);
if(btn3.isSelected()){
if(btn3.getText().toString().equals(ans)){
scorePerc = 10;
score = 1;
btn3.setBackgroundResource(R.color.rightAns);
btn3.setEnabled(false);
Fragment fragmentCorrect = new CorrectFragment();
transit(fragmentCorrect);
}
else{
scorePerc = 0;
score = 0;
btn3.setBackgroundResource(R.color.wrongAns);
btn3.setEnabled(false);
Fragment fragmentWrong = new WrongFragment();
transit(fragmentWrong);
}
btn1.setEnabled(false);
btn2.setEnabled(false);
btn4.setEnabled(false);
}
}
});
btn4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
btn4.setSelected(!btn4.isSelected());
QuizPageBreed.next.setVisibility(View.VISIBLE);
QuizPageBreed.next.setEnabled(true);
if(btn4.isSelected()){
if(btn4.getText().toString().equals(ans)){
scorePerc = 10;
score = 1;
btn4.setBackgroundResource(R.color.rightAns);
btn4.setEnabled(false);
Fragment fragmentCorrect = new CorrectFragment();
transit(fragmentCorrect);
}
else{
scorePerc = 0;
score = 0;
btn4.setBackgroundResource(R.color.wrongAns);
btn4.setEnabled(false);
Fragment fragmentWrong = new WrongFragment();
transit(fragmentWrong);
}
btn1.setEnabled(false);
btn2.setEnabled(false);
btn3.setEnabled(false);
}
}
});
}
void transit(Fragment fragment) {
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction()
.setCustomAnimations(R.anim.animate_fade_enter, R.anim.animate_fade_exit);
transaction.replace(R.id.statusLayout, fragment);
transaction.commit();
}
} | [
"[email protected]"
] | |
f918e922b893cd83fd6da22708760882306a2379 | d13b5669fd94e6498a1cb40492c26c38f80a1620 | /code/src/main/java/org/thekiddos/faith/repositories/ProjectRepository.java | fb3b6f3c91cd314fb7198da6281c4eac10088728 | [
"MIT"
] | permissive | ibrahimalia/faith | b434f5674cd0055433d18e854610311725c5ff21 | 0d0b12958313f45284349e37eeedd2c2b9a7d787 | refs/heads/main | 2023-03-25T06:09:22.417918 | 2021-03-14T20:09:20 | 2021-03-14T20:09:20 | 348,053,050 | 1 | 0 | MIT | 2021-03-15T16:56:21 | 2021-03-15T16:56:21 | null | UTF-8 | Java | false | false | 285 | java | package org.thekiddos.faith.repositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import org.thekiddos.faith.models.Project;
@Repository
public interface ProjectRepository extends CrudRepository<Project, Long> {
}
| [
"[email protected]"
] | |
d2a0aabbd75bb25907037dbe75d01294cad91e84 | b4167a982e98df7d8a9fc6df56296c0b4ae59118 | /src/mapper/Schoolroom.java | 5bf48aff6a52a5845b7c8aec6e3f799eaf64c52b | [] | no_license | Tan-zhong-sheng/SSMStuSystem | f8f553c2f0a77046f29257c5d48a75ee59238595 | 13929944361ab8d96cf9b58ab51edacea3bdbe47 | refs/heads/main | 2023-04-27T05:25:22.560192 | 2021-05-11T12:56:35 | 2021-05-11T12:56:35 | 366,259,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package mapper;
import java.util.List;
import pojo.SchoolRoom;
public interface Schoolroom {
public void Scinsert(SchoolRoom sc);
public List<SchoolRoom> SelectSchoolRoom(Integer start,Integer end);
public Integer Count();
public void DeleteSchoolRoom(Integer Scid);
public Void UpdateSchoolRoom(Integer Scid,String Management);
}
| [
"“[email protected]”"
] | |
72b59f7bd5e0e1f91dde48a8ba1c46dde8e73fd5 | 6f307632140dc0e61645ed9fbd4d6b3c0e517412 | /QuickSort.java | af1f93f8af0fc669e6c71e5d48a271c6fd157b5a | [] | no_license | shareeye/freshBird | 014be5fe5616746d1fb9639e8dff769b18f315de | 317967f89a2d5a54cbf45430281728dc5bb7fbea | refs/heads/main | 2023-08-01T08:21:12.231241 | 2021-09-13T15:08:00 | 2021-09-13T15:08:00 | 406,017,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,185 | java | package com.xiawei.algorithms;
import java.util.Arrays;
/*
快速排序:冒泡+分治+递归
*/
public class QuickSort {
public static void main(String[] args) {
int[] arr = {72, 6, 57, 88, 60, 42, 83, 73, 48, 85};
System.out.println(Arrays.toString(arr));
//快速排序
quickSrot(arr);
System.out.println(Arrays.toString(arr));
}
public static void quickSrot(int[] arr) {
int low = 0;
int high = arr.length - 1;
quickSrot(arr, low, high);
}
private static void quickSrot(int[] arr, int low, int high) {
//递归结束,low和high是同一个数递归结束
if (low < high) {
//分区操作,返回分区界限的索引
int index = partition(arr, low, high);
//对左分区快排
quickSrot(arr, low, index - 1);
//对右分区快排
quickSrot(arr, index + 1, high);
}
}
private static int partition(int[] arr, int low, int high) {
//制定左指针和右指针
int i = low;
int j = high;
//将第一个数作为基准值,挖坑
int x = arr[i];
//实现分区
while (i < j) {
//1.从右向左移动j,找到第一个小于基准值的arr[j]
while (arr[j] >= x && i < j) {
j--;
}
//2.将右侧找到小于基准值的数加入到左边(坑)位置,左指针向中间移动一个位置i++
if (i < j) {
arr[i] = arr[j];
i++;
}
//3.从左向右移动i,找到第一个大于基准值的arr[i]
while (arr[i] < x && i < j) {
i++;
}
//4.将左侧找到大于基准值的数加入到右边(坑)位置,右指针向中间移动一个位置j--
if (i < j) {
arr[j] = arr[i];
j--;
}
}
//使用基准值填坑
arr[i] = x;
//返回索引
return i;
}
}
| [
"[email protected]"
] | |
d74155e7be6bb3b3774a6583ca7f1ec975dd1935 | 7c8d57da8958a38711000228751cf23203406be0 | /app/src/main/java/com/kodman/mynotifications/Adapters/MyFragmetnPagerAdapter.java | 14dce47c3a873b1733720c53cb449959b55599bb | [] | no_license | CodmanD/MyNotifications | 1b29355bb6c0b583f4771271d1081ad0b43b32dd | 5de11c71182106eef873fd263bcad859551b92b6 | refs/heads/master | 2020-03-19T12:04:05.546706 | 2018-06-07T14:59:51 | 2018-06-07T14:59:51 | 136,493,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package com.kodman.mynotifications.Adapters;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.PagerAdapter;
import android.support.v4.app.FragmentPagerAdapter;
import com.kodman.mynotifications.Fragments.PageFragment;
import java.util.ArrayList;
public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
private long baseId = 0;
private ArrayList<String> listFragments;
public MyFragmentPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
Fragment f = PageFragment.newInstance(position);
Bundle b = new Bundle();
//b.putParcelable("sd", selectedDate);
//f.getArguments().putParcelable("sd", selectedDate);
return f;
}
@Override
public int getCount() {
return listFragments.size();
}
@Override
public int getItemPosition(Object object) {
return PagerAdapter.POSITION_NONE;
}
@Override
public long getItemId(int position) {
return baseId + position;
}
public void notifyChangeInPosition(int n) {
baseId += getCount() + n;
//Log.d(TAG, "baseId = " + baseId + " n = " + n + " getCount" + getCount());
}
}
| [
"[email protected]"
] | |
176bcfce2b6ed4c0fd03b72e033aca88b8635672 | 447520f40e82a060368a0802a391697bc00be96f | /apks/malware/app81/source/com/tencent/android/tpush/service/channel/b/i.java | b978dbe1e83ecc680805c754bf4eb32a1e25b784 | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 1,242 | java | package com.tencent.android.tpush.service.channel.b;
public abstract class i
extends f
{
protected short d;
protected int e;
protected long f;
protected long g;
protected short h;
protected short i;
protected short k;
protected short l;
protected short m;
protected byte[] n = new byte[0];
static
{
if (!i.class.desiredAssertionStatus()) {}
for (boolean bool = true;; bool = false)
{
o = bool;
return;
}
}
public i() {}
public void a(short paramShort)
{
this.h = paramShort;
}
public void a(byte[] paramArrayOfByte)
{
this.n = paramArrayOfByte;
}
public void b(short paramShort)
{
this.k = paramShort;
}
public boolean e()
{
return (this.h & 0x80) != 0;
}
public short f()
{
return this.h;
}
public int g()
{
return this.e;
}
public short h()
{
return this.k;
}
public byte[] i()
{
return this.n;
}
public short j()
{
return this.m;
}
public String toString()
{
return getClass().getSimpleName() + "(p:" + this.k + "|v:" + this.l + "|r:" + this.g + "|s:" + this.e + "|c:" + Integer.toHexString(this.h) + "|r:" + this.m + "|l:" + this.f + ")";
}
}
| [
"[email protected]"
] | |
369afe44857dbfd90f966df14229039af535668a | 52fc4d9ac6233b60ca70e59152b5a3b0b755e8d4 | /src/test/java/com/imooc/ioc/aop/AspectBizTest.java | ef47c15419d07c4c0e8f6d1f09e537454c192d4d | [] | no_license | huxiaolei1997/Spring | 94ed033ee7172feeef79b2baeffa29676f0ca562 | b039ec689750d0d0b99c8bec7bf1d6bacf02a40f | refs/heads/master | 2022-12-22T05:03:05.589915 | 2021-03-21T02:46:19 | 2021-03-21T02:46:19 | 127,395,112 | 0 | 0 | null | 2022-12-16T03:20:14 | 2018-03-30T07:14:51 | Java | UTF-8 | Java | false | false | 1,308 | java | package com.imooc.ioc.aop;
import com.imooc.ioc.aop.biz.AspectBiz;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class AspectBizTest {
@Test
public void testBiz() {
String springXmlPath = "classpath*:spring/spring-aop-schema-advice.xml";
// 非web应用使用AbstractApplicationContext初始化bean容器
// 在非Web应用中,手工加载Spring IoC容器,不能用ApplicationContext,
// 要用AbstractApplicationContext。用完以后要记得调用ctx.close()关闭容器。
// 如果不记得关闭容器,最典型的问题就是数据库连接不能释放。
AbstractApplicationContext abstractApplicationContext = new ClassPathXmlApplicationContext(springXmlPath);
abstractApplicationContext.start();
AspectBiz biz = abstractApplicationContext.getBean("aspectBiz", AspectBiz.class);
//JsrService jsrService = abstractApplicationContext.getBean("jsrService", JsrService.class);
//jsrService.save();
//biz.biz();
biz.init("moocService", 3);
//System.out.println(myDriverManager.getClass().getName());
abstractApplicationContext.close();
}
} | [
"[email protected]"
] | |
551dc6ab223e743ba487b59c4dc3bd3df0fa8850 | 8e7f3961baee776120f363aaf8d42bf92f70cd45 | /src/main/java/com/crtf/ssm/util/constant/ConstantQuantity.java | 4a467b403dd5a56de6540183f5330c4f0366dd48 | [] | no_license | RedEarListeningWind/SSM | 10117b645db831258660db4e020510438e4fdfdb | 8468177f41a948a034b38375f833321a2bd6fed2 | refs/heads/main | 2023-05-29T13:59:43.454765 | 2021-06-14T10:55:24 | 2021-06-14T10:55:24 | 376,763,665 | 1 | 1 | null | 2021-06-14T10:55:25 | 2021-06-14T09:05:00 | Java | UTF-8 | Java | false | false | 685 | java | package com.crtf.ssm.util.constant;
/**
* @author crtf
* @version V1.0
* @className ConstantQuantity
* @description 常量
* @date 21.6.14 0:13
*/
public class ConstantQuantity {
/**
* session 中存储的用户信息key SESSION_USER
*/
public static final String SESSION_USER = "SESSION_USER";
/**
* session 中存储的登录验证码key SESSION_LOGIN_CODE
*/
public static final String SESSION_LOGIN_CODE = "SESSION_LOGIN_CODE";
/**
* session 中存储的注册验证码key SESSION_REGISTER_CODE
*/
public static final String SESSION_REGISTER_CODE = "SESSION_REGISTER_CODE";
private ConstantQuantity() {
}
}
| [
"[email protected]"
] | |
fa35d703561686746899140e59f1424b6bc1d7d8 | 33a72f79863bf17d83fd8421f8ba92ed297d601b | /src/test/java/model/F6factory/method/BenzCar.java | d576a425ad08001a095ae4e67c8b602a4244b917 | [] | no_license | xiaobiao123/spring-mongodb-redis | 8ed530f22078e8567365ef2ea850f6aa1bca6e1d | b597a0a046374b28610d9f4fa1ae9fa181a93f87 | refs/heads/master | 2022-12-26T15:51:53.043064 | 2019-08-29T07:42:40 | 2019-08-29T07:42:40 | 84,541,404 | 1 | 0 | null | 2022-12-16T10:32:08 | 2017-03-10T09:11:09 | Java | UTF-8 | Java | false | false | 152 | java | package model.F6factory.method;
//奔驰车
class BenzCar implements ICar{
public void run(){
System.out.println("Benz car run");
}
} | [
"[email protected]"
] | |
088a9ab9882de4f0705350670e75fbf8583a7fdc | 6c4b0ed178e4da50adaf906f630e6af65c6f948d | /app/src/main/java/com/mingmay/bulan/ui/ChatListpage.java | 34c72dab99aa68b4db799bb917becbd35ffec298 | [] | no_license | zah5897/BuLan | af97737b23567ca196151a5706a60b76e28bfde4 | c170c3c3533d25b87ad8b3fe277433a3c7b79fa0 | refs/heads/master | 2021-01-21T17:29:30.571105 | 2016-12-17T10:15:40 | 2016-12-17T10:15:40 | 73,704,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,890 | java | package com.mingmay.bulan.ui;
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListView;
import com.mingmay.bulan.R;
import com.mingmay.bulan.adapter.FriendAdapter;
import com.mingmay.bulan.model.User;
import com.mingmay.bulan.task.LatestChatFriendTask;
public class ChatListpage extends Activity implements OnClickListener {
private ListView mListView;
// private ArrayList<User> mData;
private FriendAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_latest_chat);
initView();
loadData();
}
private void initView() {
ImageView back = (ImageView) findViewById(R.id.left_btn);
back.setImageResource(R.drawable.back_selector);
back.setOnClickListener(this);
mListView = (ListView) findViewById(R.id.list_view);
if (adapter != null) {
mListView.setAdapter(adapter);
}
}
private void loadData() {
LatestChatFriendTask task = new LatestChatFriendTask(this);
task.execute();
}
public void loadDataBallBack(ArrayList<User> data) {
if (adapter == null && data != null) {
adapter = new FriendAdapter(this, data);
mListView.setAdapter(adapter);
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
User f = adapter.getItem(arg2);
toChat(f);
}
});
} else if (adapter != null) {
adapter.clear();
}
if (adapter != null && adapter.getCount() > 0) {
findViewById(R.id.loading).setVisibility(View.GONE);
} else {
findViewById(R.id.loading).setVisibility(View.VISIBLE);
}
}
public void toChat(final User friend) {
// final String USERID = CCApplication.loginUser.loginName;
// final String PWD = CCApplication.loginUser.ccukey;
// Thread t = new Thread(new Runnable() {
// public void run() {
// try {
// XmppTool.getConnection().login(USERID, PWD);
// // Log.i("XMPPClient", "Logged in as " +
// // XmppTool.getConnection().getUser());
// Presence presence = new Presence(Presence.Type.available);
// XmppTool.getConnection().sendPacket(presence);
//
// Intent intent = new Intent();
// intent.setClass(ChatListpage.this, FormClient.class);
// intent.putExtra("USERID", USERID);
// intent.putExtra("friend", friend);
// startActivity(intent);
// } catch (XMPPException e) {
// XmppTool.closeConnection();
// }
// }
// });
// t.start();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
default:
break;
}
}
}
| [
"[email protected]"
] | |
3e91edd4cc7a7e3009d11441c1adc2c2e0e37a83 | 2a19b2f3eb1ed8a5393676724c77b4f03206dad8 | /src/main/java/org/acord/standards/life/_2/SecurityCredentialType.java | 432aee5f47edae8ad0e4caf5327a1c8953345266 | [] | no_license | SamratChatterjee/xsdTowsdl | 489777c2d7d66e8e5379fec49dffe15a19cb5650 | 807f1c948490f2c021dd401ff9dd5937688a24b2 | refs/heads/master | 2021-05-15T03:45:56.250598 | 2017-11-15T10:55:24 | 2017-11-15T10:55:24 | 110,820,957 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,117 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.11.13 at 07:49:02 PM IST
//
package org.acord.standards.life._2;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <p>Java class for SecurityCredential_Type complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SecurityCredential_Type">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://ACORD.org/Standards/Life/2}SecurityCredentialKey" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}SecurityCredentialSysKey" maxOccurs="unbounded" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}UserLoginName" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}UserDomain" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}Description" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}Comments" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}ActivationDate" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}ActivationTime" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}SecCredStatus" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}SecCredStatusReason" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}StatusDesc" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}SecurityAccessLevel" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}SecurityAccessLevelDesc" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}ExpDate" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}CreationDate" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}CreationTime" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}LastUpdate" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}LastUpdateTime" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}DaysToExpiration" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}LastSignInDate" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}LastSignInTime" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}LastSignInDayOfWeekTC" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}InvalidSignOnCount" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}UserCode" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}UserPswd" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}UserAuthentication" maxOccurs="unbounded" minOccurs="0"/>
* <element ref="{http://ACORD.org/Standards/Life/2}OLifEExtension" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* <attribute name="DataRep" type="{http://ACORD.org/Standards/Life/2}DATAREP_TYPES" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SecurityCredential_Type", propOrder = {
"securityCredentialKey",
"securityCredentialSysKey",
"userLoginName",
"userDomain",
"description",
"comments",
"activationDate",
"activationTime",
"secCredStatus",
"secCredStatusReason",
"statusDesc",
"securityAccessLevel",
"securityAccessLevelDesc",
"expDate",
"creationDate",
"creationTime",
"lastUpdate",
"lastUpdateTime",
"daysToExpiration",
"lastSignInDate",
"lastSignInTime",
"lastSignInDayOfWeekTC",
"invalidSignOnCount",
"userCode",
"userPswd",
"userAuthentication",
"oLifEExtension"
})
public class SecurityCredentialType {
@XmlElement(name = "SecurityCredentialKey")
protected PERSISTKEY securityCredentialKey;
@XmlElement(name = "SecurityCredentialSysKey")
protected List<SYSKEY> securityCredentialSysKey;
@XmlElement(name = "UserLoginName")
protected String userLoginName;
@XmlElement(name = "UserDomain")
protected String userDomain;
@XmlElement(name = "Description")
protected String description;
@XmlElement(name = "Comments")
protected String comments;
@XmlElement(name = "ActivationDate")
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar activationDate;
@XmlElement(name = "ActivationTime")
@XmlSchemaType(name = "time")
protected XMLGregorianCalendar activationTime;
@XmlElement(name = "SecCredStatus")
protected OLILUSECCREDSTAT secCredStatus;
@XmlElement(name = "SecCredStatusReason")
protected OLILUSECCREDSTATREASON secCredStatusReason;
@XmlElement(name = "StatusDesc")
protected String statusDesc;
@XmlElement(name = "SecurityAccessLevel")
protected String securityAccessLevel;
@XmlElement(name = "SecurityAccessLevelDesc")
protected String securityAccessLevelDesc;
@XmlElement(name = "ExpDate")
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar expDate;
@XmlElement(name = "CreationDate")
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar creationDate;
@XmlElement(name = "CreationTime")
@XmlSchemaType(name = "time")
protected XMLGregorianCalendar creationTime;
@XmlElement(name = "LastUpdate")
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar lastUpdate;
@XmlElement(name = "LastUpdateTime")
@XmlSchemaType(name = "time")
protected XMLGregorianCalendar lastUpdateTime;
@XmlElement(name = "DaysToExpiration")
protected BigInteger daysToExpiration;
@XmlElement(name = "LastSignInDate")
@XmlSchemaType(name = "date")
protected XMLGregorianCalendar lastSignInDate;
@XmlElement(name = "LastSignInTime")
@XmlSchemaType(name = "time")
protected XMLGregorianCalendar lastSignInTime;
@XmlElement(name = "LastSignInDayOfWeekTC")
protected OLILUDAY lastSignInDayOfWeekTC;
@XmlElement(name = "InvalidSignOnCount")
protected BigInteger invalidSignOnCount;
@XmlElement(name = "UserCode")
protected String userCode;
@XmlElement(name = "UserPswd")
protected UserPswdType userPswd;
@XmlElement(name = "UserAuthentication")
protected List<UserAuthenticationType> userAuthentication;
@XmlElement(name = "OLifEExtension")
protected List<OLifEExtensionType> oLifEExtension;
@XmlAttribute(name = "id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
@XmlAttribute(name = "DataRep")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String dataRep;
/**
* Gets the value of the securityCredentialKey property.
*
* @return
* possible object is
* {@link PERSISTKEY }
*
*/
public PERSISTKEY getSecurityCredentialKey() {
return securityCredentialKey;
}
/**
* Sets the value of the securityCredentialKey property.
*
* @param value
* allowed object is
* {@link PERSISTKEY }
*
*/
public void setSecurityCredentialKey(PERSISTKEY value) {
this.securityCredentialKey = value;
}
/**
* Gets the value of the securityCredentialSysKey property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the securityCredentialSysKey property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSecurityCredentialSysKey().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SYSKEY }
*
*
*/
public List<SYSKEY> getSecurityCredentialSysKey() {
if (securityCredentialSysKey == null) {
securityCredentialSysKey = new ArrayList<SYSKEY>();
}
return this.securityCredentialSysKey;
}
/**
* Gets the value of the userLoginName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserLoginName() {
return userLoginName;
}
/**
* Sets the value of the userLoginName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserLoginName(String value) {
this.userLoginName = value;
}
/**
* Gets the value of the userDomain property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserDomain() {
return userDomain;
}
/**
* Sets the value of the userDomain property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserDomain(String value) {
this.userDomain = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the comments property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getComments() {
return comments;
}
/**
* Sets the value of the comments property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setComments(String value) {
this.comments = value;
}
/**
* Gets the value of the activationDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getActivationDate() {
return activationDate;
}
/**
* Sets the value of the activationDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setActivationDate(XMLGregorianCalendar value) {
this.activationDate = value;
}
/**
* Gets the value of the activationTime property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getActivationTime() {
return activationTime;
}
/**
* Sets the value of the activationTime property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setActivationTime(XMLGregorianCalendar value) {
this.activationTime = value;
}
/**
* Gets the value of the secCredStatus property.
*
* @return
* possible object is
* {@link OLILUSECCREDSTAT }
*
*/
public OLILUSECCREDSTAT getSecCredStatus() {
return secCredStatus;
}
/**
* Sets the value of the secCredStatus property.
*
* @param value
* allowed object is
* {@link OLILUSECCREDSTAT }
*
*/
public void setSecCredStatus(OLILUSECCREDSTAT value) {
this.secCredStatus = value;
}
/**
* Gets the value of the secCredStatusReason property.
*
* @return
* possible object is
* {@link OLILUSECCREDSTATREASON }
*
*/
public OLILUSECCREDSTATREASON getSecCredStatusReason() {
return secCredStatusReason;
}
/**
* Sets the value of the secCredStatusReason property.
*
* @param value
* allowed object is
* {@link OLILUSECCREDSTATREASON }
*
*/
public void setSecCredStatusReason(OLILUSECCREDSTATREASON value) {
this.secCredStatusReason = value;
}
/**
* Gets the value of the statusDesc property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStatusDesc() {
return statusDesc;
}
/**
* Sets the value of the statusDesc property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStatusDesc(String value) {
this.statusDesc = value;
}
/**
* Gets the value of the securityAccessLevel property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSecurityAccessLevel() {
return securityAccessLevel;
}
/**
* Sets the value of the securityAccessLevel property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSecurityAccessLevel(String value) {
this.securityAccessLevel = value;
}
/**
* Gets the value of the securityAccessLevelDesc property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSecurityAccessLevelDesc() {
return securityAccessLevelDesc;
}
/**
* Sets the value of the securityAccessLevelDesc property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSecurityAccessLevelDesc(String value) {
this.securityAccessLevelDesc = value;
}
/**
* Gets the value of the expDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getExpDate() {
return expDate;
}
/**
* Sets the value of the expDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setExpDate(XMLGregorianCalendar value) {
this.expDate = value;
}
/**
* Gets the value of the creationDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getCreationDate() {
return creationDate;
}
/**
* Sets the value of the creationDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setCreationDate(XMLGregorianCalendar value) {
this.creationDate = value;
}
/**
* Gets the value of the creationTime property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getCreationTime() {
return creationTime;
}
/**
* Sets the value of the creationTime property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setCreationTime(XMLGregorianCalendar value) {
this.creationTime = value;
}
/**
* Gets the value of the lastUpdate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getLastUpdate() {
return lastUpdate;
}
/**
* Sets the value of the lastUpdate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setLastUpdate(XMLGregorianCalendar value) {
this.lastUpdate = value;
}
/**
* Gets the value of the lastUpdateTime property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getLastUpdateTime() {
return lastUpdateTime;
}
/**
* Sets the value of the lastUpdateTime property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setLastUpdateTime(XMLGregorianCalendar value) {
this.lastUpdateTime = value;
}
/**
* Gets the value of the daysToExpiration property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getDaysToExpiration() {
return daysToExpiration;
}
/**
* Sets the value of the daysToExpiration property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setDaysToExpiration(BigInteger value) {
this.daysToExpiration = value;
}
/**
* Gets the value of the lastSignInDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getLastSignInDate() {
return lastSignInDate;
}
/**
* Sets the value of the lastSignInDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setLastSignInDate(XMLGregorianCalendar value) {
this.lastSignInDate = value;
}
/**
* Gets the value of the lastSignInTime property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getLastSignInTime() {
return lastSignInTime;
}
/**
* Sets the value of the lastSignInTime property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setLastSignInTime(XMLGregorianCalendar value) {
this.lastSignInTime = value;
}
/**
* Gets the value of the lastSignInDayOfWeekTC property.
*
* @return
* possible object is
* {@link OLILUDAY }
*
*/
public OLILUDAY getLastSignInDayOfWeekTC() {
return lastSignInDayOfWeekTC;
}
/**
* Sets the value of the lastSignInDayOfWeekTC property.
*
* @param value
* allowed object is
* {@link OLILUDAY }
*
*/
public void setLastSignInDayOfWeekTC(OLILUDAY value) {
this.lastSignInDayOfWeekTC = value;
}
/**
* Gets the value of the invalidSignOnCount property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getInvalidSignOnCount() {
return invalidSignOnCount;
}
/**
* Sets the value of the invalidSignOnCount property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setInvalidSignOnCount(BigInteger value) {
this.invalidSignOnCount = value;
}
/**
* Gets the value of the userCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUserCode() {
return userCode;
}
/**
* Sets the value of the userCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUserCode(String value) {
this.userCode = value;
}
/**
* Gets the value of the userPswd property.
*
* @return
* possible object is
* {@link UserPswdType }
*
*/
public UserPswdType getUserPswd() {
return userPswd;
}
/**
* Sets the value of the userPswd property.
*
* @param value
* allowed object is
* {@link UserPswdType }
*
*/
public void setUserPswd(UserPswdType value) {
this.userPswd = value;
}
/**
* Gets the value of the userAuthentication property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the userAuthentication property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getUserAuthentication().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link UserAuthenticationType }
*
*
*/
public List<UserAuthenticationType> getUserAuthentication() {
if (userAuthentication == null) {
userAuthentication = new ArrayList<UserAuthenticationType>();
}
return this.userAuthentication;
}
/**
* Gets the value of the oLifEExtension property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the oLifEExtension property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getOLifEExtension().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link OLifEExtensionType }
*
*
*/
public List<OLifEExtensionType> getOLifEExtension() {
if (oLifEExtension == null) {
oLifEExtension = new ArrayList<OLifEExtensionType>();
}
return this.oLifEExtension;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the dataRep property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDataRep() {
return dataRep;
}
/**
* Sets the value of the dataRep property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDataRep(String value) {
this.dataRep = value;
}
}
| [
"[email protected]"
] | |
2b79ebcf7cb77f3f8fbcfd80a46a840e0ef5ff18 | 024858afe9167703c7ba6a554526145061d98b70 | /src/year2020/cs40s/gridgameadvanced/tools/Reactor.java | a6b15e5358501b7dfe855ad134b5fe5fcd0a8b53 | [] | no_license | mrLWachs/FinalExample | 590a326f0638196fbe06591b2c13999b2a7187be | e01f62d21014cd7a04c103387cc3a4c5431781b7 | refs/heads/master | 2023-01-27T11:24:04.479012 | 2023-01-19T14:20:06 | 2023-01-19T14:20:06 | 135,295,510 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,969 | java |
/** required package class namespace */
package year2020.cs40s.gridgameadvanced.tools;
/**
* Reactor.java - methods to react to collisions in various ways
*
* @author Mr. Wachs
* @since 14-May-2019
*/
public class Reactor
{
private Coordinates source;
private Coordinates target;
private int numberOfDirections;
private Detector detector;
/**
* Constructor for the class, sets class properties
*
* @param coordinates the coordinate data to assign to this class
* @param numberOfDirections the number of movements in this game
*/
public Reactor(Coordinates coordinates,
int numberOfDirections,
Detector detector) {
this.source = coordinates;
this.numberOfDirections = numberOfDirections;
this.detector = detector;
}
/**
* Positions the coordinate data correctly against (sticks to) the target
* coordinate data
*
* @param hitbox the other game object to stick to
*/
public void stickTo(GameObject hitbox) {
if (numberOfDirections == Directions.TWO_DIRECTIONS ||
numberOfDirections == Directions.FOUR_DIRECTIONS) {
if (source.direction == Directions.LEFT) stickToRight(hitbox);
else if (source.direction == Directions.RIGHT) stickToLeft(hitbox);
else if (source.direction == Directions.UP) stickToBottom(hitbox);
else if (source.direction == Directions.DOWN) stickToTop(hitbox);
}
else if (numberOfDirections == Directions.EIGHT_DIRECTIONS) {
if (source.direction == Directions.NORTH) stickToBottom(hitbox);
else if (source.direction == Directions.SOUTH) stickToTop(hitbox);
else if (source.direction == Directions.EAST) stickToLeft(hitbox);
else if (source.direction == Directions.WEST) stickToRight(hitbox);
else if (source.direction == Directions.NORTH_EAST) {
if (detector.isBelow(hitbox)) stickToBottom(hitbox);
else if (detector.isLeftOf(hitbox)) stickToLeft(hitbox);
}
else if (source.direction == Directions.SOUTH_EAST) {
if (detector.isAbove(hitbox)) stickToTop(hitbox);
else if (detector.isLeftOf(hitbox)) stickToLeft(hitbox);
}
else if (source.direction == Directions.SOUTH_WEST) {
if (detector.isAbove(hitbox)) stickToTop(hitbox);
else if (detector.isRightOf(hitbox)) stickToRight(hitbox);
}
else if (source.direction == Directions.NORTH_WEST) {
if (detector.isBelow(hitbox)) stickToBottom(hitbox);
else if (detector.isRightOf(hitbox)) stickToRight(hitbox);
}
}
}
/**
* Positions the coordinate data correctly against (sticks to) the targets
* bottom edge coordinate data
*
* @param hitbox the other game object to stick to
*/
public void stickToBottom(GameObject hitbox) {
target = hitbox.coordinates;
source.y = target.bottom + 1;
source.recalculate();
}
/**
* Positions the coordinate data correctly against (sticks to) the targets
* top edge coordinate data
*
* @param hitbox the other game object to stick to
*/
public void stickToTop(GameObject hitbox) {
target = hitbox.coordinates;
source.y = target.top - source.height - 1;
source.recalculate();
}
/**
* Positions the coordinate data correctly against (sticks to) the targets
* left edge coordinate data
*
* @param hitbox the other game object to stick to
*/
public void stickToLeft(GameObject hitbox) {
target = hitbox.coordinates;
source.x = target.left - source.width - 1;
source.recalculate();
}
/**
* Positions the coordinate data correctly against (sticks to) the targets
* right edge coordinate data
*
* @param hitbox the other game object to stick to
*/
public void stickToRight(GameObject hitbox) {
target = hitbox.coordinates;
source.x = target.right + 1;
source.recalculate();
}
/**
* Changes current direction and bounces off the target coordinate data
*
* @param hitbox the other game object to stick to
*/
public void bounceOff(GameObject hitbox) {
stickTo(hitbox);
if (numberOfDirections == Directions.TWO_DIRECTIONS ||
numberOfDirections == Directions.FOUR_DIRECTIONS) {
if (source.direction == Directions.LEFT) source.direction = Directions.RIGHT;
else if (source.direction == Directions.RIGHT) source.direction = Directions.LEFT;
else if (source.direction == Directions.UP) source.direction = Directions.DOWN;
else if (source.direction == Directions.DOWN) source.direction = Directions.UP;
}
else if (numberOfDirections == Directions.EIGHT_DIRECTIONS) {
if (source.direction == Directions.NORTH) source.direction = Directions.SOUTH;
else if (source.direction == Directions.SOUTH) source.direction = Directions.NORTH;
else if (source.direction == Directions.EAST) source.direction = Directions.WEST;
else if (source.direction == Directions.WEST) source.direction = Directions.EAST;
else if (source.direction == Directions.NORTH_EAST) {
if (detector.isBelow(hitbox)) source.direction = Directions.SOUTH_EAST;
else if (detector.isLeftOf(hitbox)) source.direction = Directions.NORTH_WEST;
}
else if (source.direction == Directions.SOUTH_EAST) {
if (detector.isAbove(hitbox)) source.direction = Directions.NORTH_EAST;
else if (detector.isLeftOf(hitbox)) source.direction = Directions.SOUTH_WEST;
}
else if (source.direction == Directions.SOUTH_WEST) {
if (detector.isAbove(hitbox)) source.direction = Directions.NORTH_WEST;
else if (detector.isRightOf(hitbox)) source.direction = Directions.SOUTH_EAST;
}
else if (source.direction == Directions.NORTH_WEST) {
if (detector.isBelow(hitbox)) source.direction = Directions.SOUTH_WEST;
else if (detector.isRightOf(hitbox)) source.direction = Directions.NORTH_EAST;
}
}
}
/**
* Puts this object's position in the middle both horizontally and
* vertically to the target
*
* @param hitbox the other game object to stick to
*/
public void centerOn(GameObject hitbox) {
target = hitbox.coordinates;
if (target.width > source.width) source.x = target.centerX - (source.width / 2);
else if (source.width > target.width) source.x = target.centerX + (source.width / 2);
if (target.height > source.height) source.y = target.centerY - (source.height / 2);
else if (source.height > target.height) source.y = target.centerY + (source.height / 2);
source.recalculate();
}
/**
* Centers this object's position in the center and above the top of
* the target
*
* @param hitbox the other game object to stick to
*/
public void centerOnTop(GameObject hitbox) {
target = hitbox.coordinates;
centerOn(hitbox);
source.y = target.top - source.height - 1;
source.recalculate();
}
/**
* Centers this object's position in the center and below the bottom of
* the target
*
* @param hitbox the other game object to stick to
*/
public void centerOnBottom(GameObject hitbox) {
target = hitbox.coordinates;
centerOn(hitbox);
source.y = target.bottom + 1;
source.recalculate();
}
/**
* Centers this object's position in the center and to the left of the
* target
*
* @param hitbox the other game object to stick to
*/
public void centerOnLeft(GameObject hitbox) {
target = hitbox.coordinates;
centerOn(hitbox);
source.x = target.left - source.width - 1;
source.recalculate();
}
/**
* Centers this object's position in the center and to the right of the
* target
*
* @param hitbox the other game object to stick to
*/
public void centerOnRight(GameObject hitbox) {
target = hitbox.coordinates;
centerOn(hitbox);
source.x = target.right + 1;
source.recalculate();
}
} | [
"[email protected]"
] | |
88db850e6bad0093cffcdaa6c87049d08a975be7 | aab885cf4d58fe840dc01f96fa8a62c595e298b5 | /app/src/main/java/com/group6/babytime/pojo/Story.java | d092b7dc0dd8b316de1f1815447200417c08df60 | [
"Apache-2.0"
] | permissive | cxy950705/Group6Project | 800c0e75437d323ee598244bac658b706591aa68 | c8a9913a1afc3d46e2a5c961f3ba9beeebf7531b | refs/heads/master | 2021-01-17T15:23:08.665860 | 2016-10-26T02:58:39 | 2016-10-26T02:58:39 | 70,442,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,316 | java | package com.group6.babytime.pojo;
import android.os.Parcel;
import android.os.Parcelable;
public class Story implements Parcelable {
private Integer story_id;
private String story_name;
private String story_type;
private String story_cover;
private Integer story_clicknum;
private String story_introduction;
private Integer story_episode;
private String story_content;
public Story(){
}
public Story(Integer story_id, String story_name, String story_type,
String story_cover, Integer story_clicknum,
String story_introduction, Integer story_episode,
String story_content) {
super();
this.story_id = story_id;
this.story_name = story_name;
this.story_type = story_type;
this.story_cover = story_cover;
this.story_clicknum = story_clicknum;
this.story_introduction = story_introduction;
this.story_episode = story_episode;
this.story_content = story_content;
}
public Integer getStory_id() {
return story_id;
}
public void setStory_id(Integer story_id) {
this.story_id = story_id;
}
public String getStory_name() {
return story_name;
}
public void setStory_name(String story_name) {
this.story_name = story_name;
}
public String getStory_type() {
return story_type;
}
public void setStory_type(String story_type) {
this.story_type = story_type;
}
public String getStory_cover() {
return story_cover;
}
public void setStory_cover(String story_cover) {
this.story_cover = story_cover;
}
public Integer getStory_clicknum() {
return story_clicknum;
}
public void setStory_clicknum(Integer story_clicknum) {
this.story_clicknum = story_clicknum;
}
public String getStory_introduction() {
return story_introduction;
}
public void setStory_introduction(String story_introduction) {
this.story_introduction = story_introduction;
}
public Integer getStory_episode() {
return story_episode;
}
public void setStory_episode(Integer story_episode) {
this.story_episode = story_episode;
}
public String getStory_content() {
return story_content;
}
public void setStory_content(String story_content) {
this.story_content = story_content;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(this.story_id);
dest.writeString(this.story_name);
dest.writeString(this.story_type);
dest.writeString(this.story_cover);
dest.writeValue(this.story_clicknum);
dest.writeString(this.story_introduction);
dest.writeValue(this.story_episode);
dest.writeString(this.story_content);
}
protected Story(Parcel in) {
this.story_id = (Integer) in.readValue(Integer.class.getClassLoader());
this.story_name = in.readString();
this.story_type = in.readString();
this.story_cover = in.readString();
this.story_clicknum = (Integer) in.readValue(Integer.class.getClassLoader());
this.story_introduction = in.readString();
this.story_episode = (Integer) in.readValue(Integer.class.getClassLoader());
this.story_content = in.readString();
}
public static final Parcelable.Creator<Story> CREATOR = new Parcelable.Creator<Story>() {
@Override
public Story createFromParcel(Parcel source) {
return new Story(source);
}
@Override
public Story[] newArray(int size) {
return new Story[size];
}
};
}
| [
"[email protected]"
] | |
37eb711584877f1028bda86663c7ba128e62520b | eb66c3a302f49823fcbf34a49514642e2db0f4d0 | /rsb/methods/Account.java | ed7740d64b21bab98950af476f125832c23a4f5d | [
"BSD-3-Clause"
] | permissive | kjax139/RSB | b8afa310e68ba9e89809dc3a395fc3694f638217 | 9481c39f7bf673e12029c05ad2dd15267022f36c | refs/heads/master | 2022-12-22T07:43:30.901967 | 2020-08-18T07:07:32 | 2020-08-18T07:07:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 996 | java | package net.runelite.client.rsb.methods;
import net.runelite.client.rsb.gui.AccountManager;
import java.util.logging.Logger;
/**
* Selected account information.
*/
public class Account extends MethodProvider {
Logger log = Logger.getLogger(getClass().getName());
public Account(MethodContext ctx) {
super(ctx);
}
/**
* The account name.
*
* @return The currently selected account's name.
*/
public String getName() {
return methods.runeLite.getAccountName();
}
/**
* The account password.
*
* @return The currently selected account's password.
*/
public String getPassword() {
return AccountManager.getPassword(getName());
}
/**
* The account pin.
*
* @return The currently selected account's pin.
*/
public String getPin() {
return AccountManager.getPin(getName());
}
/**
* The account reward.
*
* @return The currently selected account's reward.
*/
public String getReward() {
return AccountManager.getReward(getName());
}
}
| [
"[email protected]"
] | |
0488013c984aca2f92bcb464b8d6fcab973fd279 | fb4da55f1bb05481a7e512345929d25328e46e36 | /ChatNow/app/src/main/java/com/jin10/chatnow/Chat.java | 281a370e81a097482fa4ea7d605d5b48a5bd4171 | [] | no_license | jinesh1077/RecorderApp | a88e0e480d21953aed032dc82d9aacb80bdb486e | b78dc5de3642cb655166f077793c5a783c6d6b40 | refs/heads/master | 2020-05-24T13:00:14.837805 | 2019-05-17T21:04:28 | 2019-05-17T21:04:28 | 187,280,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 759 | java | package com.jin10.chatnow;
public class Chat {
private String sender;
private String receiver;
private String message;
public Chat(String _sender,String _receiver,String _message){
sender=_sender;
receiver=_receiver;
message=_message;
}
public Chat() {
}
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"[email protected]"
] | |
7e7ff9031d02f455db52c951dab802c32ae575e7 | 7935cc5c2cb800debf057e3520e03c50fa6f5c75 | /app/src/main/java/com/glens/jksd/bean/repair_task_bean/RepairGroundBean.java | 235866374bc51eb4ee162febe32279591797558e | [] | no_license | hetaoyuan-android/jksd_code | c46b90535cf5d7736dd7bf96d9d4c942ce60a558 | 440fdca9b075f2451657e0471a5c1eba13bb1673 | refs/heads/master | 2020-06-16T05:22:29.351060 | 2019-07-06T02:45:16 | 2019-07-06T02:45:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,190 | java | package com.glens.jksd.bean.repair_task_bean;
import java.util.List;
/**
* Created by wkc on 2019/6/20.
*/
public class RepairGroundBean {
/**
* total : 1
* records : [{"checkTime":"2019-06-05 17:55","checker":"王斌","createTime":"2019-06-05 17:46","demolitionPerson":"王斌","demolitionTime":"2019-06-05 17:56","fixPerson":"王斌","fixTime":"2019-06-05 17:55","groudWireName":"20190605174601","groudWireType":5,"recordCode":"17769947a7274099bc5b2b8c9c21ea2f","returnTime":"2019-06-05 17:57","returner":"王斌","takedTime":"2019-06-05 17:46","takenPerson":"王斌","taskCode":"1"}]
*/
private int total;
private List<RecordsBean> records;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<RecordsBean> getRecords() {
return records;
}
public void setRecords(List<RecordsBean> records) {
this.records = records;
}
public static class RecordsBean {
/**
* checkTime : 2019-06-05 17:55
* checker : 王斌
* createTime : 2019-06-05 17:46
* demolitionPerson : 王斌
* demolitionTime : 2019-06-05 17:56
* fixPerson : 王斌
* fixTime : 2019-06-05 17:55
* groudWireName : 20190605174601
* groudWireType : 5
* recordCode : 17769947a7274099bc5b2b8c9c21ea2f
* returnTime : 2019-06-05 17:57
* returner : 王斌
* takedTime : 2019-06-05 17:46
* takenPerson : 王斌
* taskCode : 1
*/
private String checkTime;
private String checker;
private String createTime;
private String demolitionPerson;
private String demolitionTime;
private String fixPerson;
private String fixTime;
private String groudWireName;
private int groudWireType;
private String recordCode;
private String returnTime;
private String returner;
private String takedTime;
private String takenPerson;
private String taskCode;
public String getCheckTime() {
return checkTime;
}
public void setCheckTime(String checkTime) {
this.checkTime = checkTime;
}
public String getChecker() {
return checker;
}
public void setChecker(String checker) {
this.checker = checker;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getDemolitionPerson() {
return demolitionPerson;
}
public void setDemolitionPerson(String demolitionPerson) {
this.demolitionPerson = demolitionPerson;
}
public String getDemolitionTime() {
return demolitionTime;
}
public void setDemolitionTime(String demolitionTime) {
this.demolitionTime = demolitionTime;
}
public String getFixPerson() {
return fixPerson;
}
public void setFixPerson(String fixPerson) {
this.fixPerson = fixPerson;
}
public String getFixTime() {
return fixTime;
}
public void setFixTime(String fixTime) {
this.fixTime = fixTime;
}
public String getGroudWireName() {
return groudWireName;
}
public void setGroudWireName(String groudWireName) {
this.groudWireName = groudWireName;
}
public int getGroudWireType() {
return groudWireType;
}
public void setGroudWireType(int groudWireType) {
this.groudWireType = groudWireType;
}
public String getRecordCode() {
return recordCode;
}
public void setRecordCode(String recordCode) {
this.recordCode = recordCode;
}
public String getReturnTime() {
return returnTime;
}
public void setReturnTime(String returnTime) {
this.returnTime = returnTime;
}
public String getReturner() {
return returner;
}
public void setReturner(String returner) {
this.returner = returner;
}
public String getTakedTime() {
return takedTime;
}
public void setTakedTime(String takedTime) {
this.takedTime = takedTime;
}
public String getTakenPerson() {
return takenPerson;
}
public void setTakenPerson(String takenPerson) {
this.takenPerson = takenPerson;
}
public String getTaskCode() {
return taskCode;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
@Override
public String toString() {
return "RecordsBean{" +
"checkTime='" + checkTime + '\'' +
", checker='" + checker + '\'' +
", createTime='" + createTime + '\'' +
", demolitionPerson='" + demolitionPerson + '\'' +
", demolitionTime='" + demolitionTime + '\'' +
", fixPerson='" + fixPerson + '\'' +
", fixTime='" + fixTime + '\'' +
", groudWireName='" + groudWireName + '\'' +
", groudWireType=" + groudWireType +
", recordCode='" + recordCode + '\'' +
", returnTime='" + returnTime + '\'' +
", returner='" + returner + '\'' +
", takedTime='" + takedTime + '\'' +
", takenPerson='" + takenPerson + '\'' +
", taskCode='" + taskCode + '\'' +
'}';
}
}
@Override
public String toString() {
return "RepairGroundBean{" +
"total=" + total +
", records=" + records +
'}';
}
}
| [
"[email protected]"
] | |
7dc2d400cb8e4941ed66f2bf4309d074aba61f1a | cc4eb6bf0f4b29a9acfd83918eaf24304476952f | /src/main/java/stu/learning/service/products/services/PriceChangeService.java | 294c9f0a1c339ffd2a2c80cd34f5ccae7d4f8dd6 | [] | no_license | Stu-P/products-service | 694aa8c0f2d62aeb5b5b301ec5fea7bcfef0f55d | 97558adccb2f77ee40bce4dff44b846d0aea3145 | refs/heads/master | 2022-12-03T13:50:16.636648 | 2020-08-26T05:36:57 | 2020-08-26T05:36:57 | 288,311,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,700 | java | package stu.learning.service.products.services;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Instant;
import java.util.*;
import stu.learning.service.products.entities.Product;
import stu.learning.service.products.events.PriceChangedEvent;
import stu.learning.service.products.persistence.IProductsRepository;
@Service
public class PriceChangeService implements CommandLineRunner {
Logger logger = LoggerFactory.getLogger(PriceChangeService.class);
private final IProductsRepository repo;
private final IEventPublisher publisher;
private final FeatureFlagProvider flags;
private final Random randomGen;
private List<Product> products;
@Autowired
public PriceChangeService(
IProductsRepository repo,
FeatureFlagProvider flags,
@Qualifier("kafka") IEventPublisher publisher
) {
this.repo = repo;
this.flags = flags;
this.publisher = publisher;
this.randomGen = new Random();
}
@Override
public void run(String... args) throws Exception {
// get all products
products = repo.findAll();
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
products = repo.findAll();
}
}, 1 * 60 * 1000, 1 * 60 * 1000);
while (true) {
boolean isEnabled = flags.isPricePublishEnabled();
if (isEnabled) {
for (Product p : products) {
try {
var event = new PriceChangedEvent(
UUID.randomUUID(),
Instant.now(),
p.getId(),
generateNewPrice());
logger.info("publish price change *** product: {} | price: {}", event.getProductId(), event.getNewPrice());
publisher.Publish(event);
} catch (Exception ex) {
logger.error("error publishing {} | {}", ex.getMessage(), ex.getCause());
}
}
}
// Thread.sleep(0);
}
}
private BigDecimal generateNewPrice() {
return new BigDecimal(randomGen.nextDouble() * 100).setScale(2, RoundingMode.HALF_EVEN);
}
}
| [
"[email protected]"
] | |
c7e07de87ba22a77181abf45a20d446a73aeeae5 | 362f059a3d7303d05f49021b39a51eddd5549d67 | /Programacao Orientada a Objetos/Alambique/src/main/java/com/mycompany/alambique/MenuAlambique.java | 2bd31ef5e897bb387e0b687cca01e99d9163833b | [] | no_license | HenriqueRohrig/Projetos-Faculdade | 42d2a4a09e7eee47c241b7aad97f590837c05550 | 02991ff11a9013fa1a874b6f631f5f2fdb94ae78 | refs/heads/main | 2023-07-18T07:14:42.547870 | 2021-09-10T16:55:41 | 2021-09-10T16:55:41 | 404,975,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,580 | java | package com.mycompany.alambique;
//abastecer o reservatório com caldo de cana (não precisa completar), limpar (jogar fora) o reservatório de resíduos (sempre esvaziar completamente),
//engarrafar a cachaça produzida (ou parte da cachaça produzida, conforme o tamanho das garrafas). Você também poderá produzir cachaça com o líquido (caldo de cana) existente no primeiro reservatório,
//mas para isso é preciso saber se há espaço para os resíduos e para o líquido que será produzido. A qualquer tempo é possível consultar o nível de cada reservatório;
//o número de garrafas produzidas no estoque da fábrica de cachaça e o número de vezes que a máquina foi usada (contador de bateladas).
import java.util.Scanner;
public class MenuAlambique {
private Alambique a;
public MenuAlambique(Alambique a) {
this.a = a;
}
public void exibir()
{
Scanner input = new Scanner(System.in);
int opcao = 0;
while (opcao != 10)
{
System.out.println ("1) Abastecer o reservatório com caldo de cana.");
System.out.println ("2) Limpar reservatório de resíduos.");
System.out.println ("3) Engarrafar produção.");
System.out.println ("4) Produzir cachaça utilizando o reservatório com caldo de cana.");
System.out.println ("5) Checar reservatório do caldo de cana.");
System.out.println ("6) Checar reservatório de cachaça.");
System.out.println ("7) Checar reservatório de resíduos.");
System.out.println ("8) Ver quantidade de garrafas de cachaça produzidas.");
System.out.println ("9) Ver o número de bateladas.");
System.out.println ("10) Desligar a máquina. (encerrar programa)");
opcao = input.nextInt();
if (opcao == 1)
{
System.out.println("Digite quantos litros deseja abastecer. (capacidade máxima atual: "+(a.getCapacidadeCachaca()-a.getCaldo())+")");
int quant1 = input.nextInt();
a.setCaldo(quant1);
System.out.println("Abastecido com sucesso!");
}
if (opcao == 2)
{
a.setSobra();
System.out.println("Limpeza do reservatório efetuada com sucesso!");
}
if (opcao == 3)
{
a.engarrafarCachaca();
System.out.println("Cachaça engarrafada com sucesso!");
}
if (opcao == 4)
{
a.produzirReservatorio1();
System.out.println("Sucesso. A cachaça foi produzida utilizando apenas o reservatório de cana.");
}
if (opcao == 5)
{
System.out.println("Reservatório de cana: "+a.getCaldo());
}
if (opcao == 6)
{
System.out.println("Reservatório de cachaça: "+a.getCachaca());
}
if (opcao == 7)
{
System.out.println("Reservatório de resíduos: "+a.getSobra());
}
if (opcao == 8)
{
System.out.println("Foram produzidas "+a.Garrafas()+" garrafas.");
}
if (opcao == 9)
{
System.out.println("Número de bateladas: "+a.bateladas());
}
}
}
}
| [
"[email protected]"
] | |
9cffc417fce84693a64fb6f2de20880f00606823 | 5c21ab6e2cbcc4469c9965f720f214a8cccae4b3 | /sso-server/src/main/java/com/xjbg/sso/server/config/WebMvcConfig.java | 60318f5a79d5ef3a4f4cd682503f0804831c334f | [
"Apache-2.0"
] | permissive | Kestrong/sso | ff62be1d2bb0947879c936a99a44aaa4d69f5ef8 | 36ebb9d02dc35a1b33955b49aaea6dec896c447e | refs/heads/master | 2023-02-24T00:05:48.974189 | 2021-06-11T02:16:55 | 2021-06-11T02:16:55 | 188,661,393 | 15 | 8 | Apache-2.0 | 2023-02-22T07:28:21 | 2019-05-26T09:04:20 | Java | UTF-8 | Java | false | false | 4,279 | java | package com.xjbg.sso.server.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xjbg.sso.core.util.CollectionUtil;
import com.xjbg.sso.core.util.CustomObjectMapper;
import com.xjbg.sso.server.properties.EnvProperties;
import com.xjbg.sso.server.service.oauth.AuthTokenInterceptor;
import com.xjbg.sso.server.service.oauth.OauthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.util.*;
/**
* @author kesc
* @since 2019/2/27
*/
@Configuration
@EnableConfigurationProperties(EnvProperties.class)
public class WebMvcConfig extends WebMvcConfigurationSupport {
@Autowired
private EnvProperties envProperties;
@Autowired
private LocalValidatorFactoryBean validator;
@Autowired
private OauthService oauthService;
@Bean
public AuthTokenInterceptor authTokenInterceptor() {
AuthTokenInterceptor authTokenInterceptor = new AuthTokenInterceptor();
authTokenInterceptor.setOauthService(oauthService);
return authTokenInterceptor;
}
@Override
protected void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authTokenInterceptor()).addPathPatterns("/user/**");
super.addInterceptors(registry);
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
Map<String, String> resourceMapping = envProperties.getResourceMapping();
if (CollectionUtil.isNotEmpty(resourceMapping)) {
for (Map.Entry<String, String> entry : resourceMapping.entrySet()) {
registry.addResourceHandler(entry.getKey()).addResourceLocations(entry.getValue());
}
}
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.addAll(messageConverters());
}
private List<HttpMessageConverter<?>> messageConverters() {
List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
jsonConverter.setObjectMapper(createDefaultObjectMapper());
messageConverters.add(jsonConverter);
return messageConverters;
}
private ObjectMapper createDefaultObjectMapper() {
CustomObjectMapper mapper = new CustomObjectMapper();
mapper.setCamelCaseToLowerCaseWithUnderscores(false);
mapper.setDateFormatPattern("yyyy-MM-dd HH:mm:ss");
mapper.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
mapper.init();
return mapper;
}
@Bean
public HttpMessageConverters getHttpMessageConverters() {
return new HttpMessageConverters(Collections.emptyList());
}
@Bean
@Primary
public CommonsMultipartResolver getCommonsMultipartResolver() {
CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
commonsMultipartResolver.setMaxUploadSize(1024 * 1024 * 100);
commonsMultipartResolver.setMaxInMemorySize(1024 * 2);
commonsMultipartResolver.setDefaultEncoding("UTF-8");
commonsMultipartResolver.setResolveLazily(Boolean.TRUE);
return commonsMultipartResolver;
}
@Override
protected Validator getValidator() {
return validator;
}
}
| [
"[email protected]"
] | |
7242fe5bdeda51b1dfa15aa8e6e4b197f8e2c0c1 | 25d6db7b451c2ba1f9af5cfdc9e6be81995ca71b | /monitrack-commons/src/main/java/com/monitrack/enumeration/RequestSender.java | 95490ca1f9cbcb3c2df3560c61e69ef3d02955cc | [] | no_license | KONE-Yaya/monitrack | e8c05b6ac8ba2597323eaf27d0930b169dd1ac4f | 09343d2d74accd5b27651d0eb63dfd08d8509f1b | refs/heads/master | 2023-02-18T16:41:35.562905 | 2019-05-14T16:07:53 | 2019-05-14T16:07:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.monitrack.enumeration;
public enum RequestSender {
CLIENT,
CLIENT_FOR_SENSOR_STATE,
CLIENT_FOR_ACTIVE_SENSOR,
SENSOR;
public static RequestSender getValueOf(String sender) {
RequestSender[] values = RequestSender.values();
for(RequestSender value : values) {
if(value.toString().equalsIgnoreCase(sender))
return value;
}
return null;
}
}
| [
"[email protected]"
] | |
214e2f6f47566bddd7d6053bce8664a6b7b2df9d | 7033d33d0ce820499b58da1d1f86f47e311fd0e1 | /org/newdawn/slick/openal/DeferredSound.java | 91c8c07155f1437498959152235693bd2381eecd | [
"MIT"
] | permissive | gabrielvicenteYT/melon-client-src | 1d3f1f65c5a3bf1b6bc3e1cb32a05bf1dd56ee62 | e0bf34546ada3afa32443dab838b8ce12ce6aaf8 | refs/heads/master | 2023-04-04T05:47:35.053136 | 2021-04-19T18:34:36 | 2021-04-19T18:34:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,681 | java | package org.newdawn.slick.openal;
import org.newdawn.slick.loading.*;
import org.newdawn.slick.util.*;
import java.io.*;
public class DeferredSound extends AudioImpl implements DeferredResource
{
public static final int OGG = 1;
public static final int WAV = 2;
public static final int MOD = 3;
public static final int AIF = 4;
private int type;
private String ref;
private Audio target;
private InputStream in;
public DeferredSound(final String ref, final InputStream in, final int type) {
this.ref = ref;
this.type = type;
if (ref.equals(in.toString())) {
this.in = in;
}
LoadingList.get().add(this);
}
private void checkTarget() {
if (this.target == null) {
throw new RuntimeException("Attempt to use deferred sound before loading");
}
}
@Override
public void load() throws IOException {
final boolean before = SoundStore.get().isDeferredLoading();
SoundStore.get().setDeferredLoading(false);
if (this.in != null) {
switch (this.type) {
case 1: {
this.target = SoundStore.get().getOgg(this.in);
break;
}
case 2: {
this.target = SoundStore.get().getWAV(this.in);
break;
}
case 3: {
this.target = SoundStore.get().getMOD(this.in);
break;
}
case 4: {
this.target = SoundStore.get().getAIF(this.in);
break;
}
default: {
Log.error("Unrecognised sound type: " + this.type);
break;
}
}
}
else {
switch (this.type) {
case 1: {
this.target = SoundStore.get().getOgg(this.ref);
break;
}
case 2: {
this.target = SoundStore.get().getWAV(this.ref);
break;
}
case 3: {
this.target = SoundStore.get().getMOD(this.ref);
break;
}
case 4: {
this.target = SoundStore.get().getAIF(this.ref);
break;
}
default: {
Log.error("Unrecognised sound type: " + this.type);
break;
}
}
}
SoundStore.get().setDeferredLoading(before);
}
@Override
public boolean isPlaying() {
this.checkTarget();
return this.target.isPlaying();
}
@Override
public int playAsMusic(final float pitch, final float gain, final boolean loop) {
this.checkTarget();
return this.target.playAsMusic(pitch, gain, loop);
}
@Override
public int playAsSoundEffect(final float pitch, final float gain, final boolean loop) {
this.checkTarget();
return this.target.playAsSoundEffect(pitch, gain, loop);
}
@Override
public int playAsSoundEffect(final float pitch, final float gain, final boolean loop, final float x, final float y, final float z) {
this.checkTarget();
return this.target.playAsSoundEffect(pitch, gain, loop, x, y, z);
}
@Override
public void stop() {
this.checkTarget();
this.target.stop();
}
@Override
public String getDescription() {
return this.ref;
}
}
| [
"[email protected]"
] | |
c2c67da366becf64a42fe20f635b5694595fe917 | 3ccc3cedfd71942692b66b189e21079f93e4fe4c | /AL-Game/src/com/aionemu/gameserver/dataholders/ConquestPortalData.java | 8dd6995dfe0d33ba2fdfc9030f7ba91eae61adf2 | [] | no_license | Ritchiee/Aion-Lightning-5.0-SRC | 5a4d4ce0bb5c88c05d05c9eb1132409e0dcf1c50 | 6a2f3f6e75572d05f299661373a5a34502f192ab | refs/heads/master | 2020-03-10T03:44:00.991145 | 2018-02-27T17:20:53 | 2018-02-27T17:20:53 | 129,173,070 | 1 | 0 | null | 2018-04-12T01:06:26 | 2018-04-12T01:06:26 | null | UTF-8 | Java | false | false | 1,623 | java | /**
c * This file is part of Aion-Lightning <aion-lightning.org>.
*
* Aion-Lightning is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Aion-Lightning is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License
* along with Aion-Lightning.
* If not, see <http://www.gnu.org/licenses/>.
*/
package com.aionemu.gameserver.dataholders;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.aionemu.gameserver.model.templates.portal.ConquestPortal;
import javolution.util.FastList;
/**
* @author CoolyT
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "conquest_portals")
public class ConquestPortalData
{
@XmlElement(name = "portal")
public FastList<ConquestPortal> portals = new FastList<ConquestPortal>();
public int size()
{
return portals.size();
}
public ConquestPortal getPortalbyNpcId(int id)
{
for (ConquestPortal portal : portals)
{
if (portal.npcId == id)
return portal;
}
return null;
}
public FastList<ConquestPortal> getPortals()
{
return portals;
}
}
| [
"[email protected]"
] | |
7a11a4abfcbba742a24d48707ec48be15b14b950 | 384f3a10e4c788f1b1dfecf9c2537890b1390b3f | /src/main/java/com/tinderjob/TinderJobCrud/Model/Endereco.java | 85f7f72b7df7b01f0370c741fd924a5d377daf22 | [
"MIT"
] | permissive | instereo4/TinderJob2.0 | 682a92969768750b5f2df96522934def1177653b | d7759ecb68527a1361d601934d69d262c449aed7 | refs/heads/main | 2023-05-16T20:34:36.489217 | 2021-06-08T18:28:41 | 2021-06-08T18:28:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,402 | java | package com.tinderjob.TinderJobCrud.Model;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "endereco")
public class Endereco {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String CEP;
private String numeroCasa;
private String rua;
private String bairro;
private String cidade;
private String estado;
private String complemento;
@OneToOne
@JoinColumn(name = "usuario_id")
private Usuario usuario;
@ManyToMany
@JoinColumn(name = "dadosPessoais_id")
private List<DadosPessoais> dadosPessoais;
public Endereco(int id, String cEP, String numeroCasa, String rua, String bairro, String cidade, String estado,
String complemento) {
this.id = id;
CEP = cEP;
this.numeroCasa = numeroCasa;
this.rua = rua;
this.bairro = bairro;
this.cidade = cidade;
this.estado = estado;
this.complemento = complemento;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCEP() {
return CEP;
}
public void setCEP(String cEP) {
CEP = cEP;
}
public String getNumeroCasa() {
return numeroCasa;
}
public void setNumeroCasa(String numeroCasa) {
this.numeroCasa = numeroCasa;
}
public String getRua() {
return rua;
}
public void setRua(String rua) {
this.rua = rua;
}
public String getBairro() {
return bairro;
}
public void setBairro(String bairro) {
this.bairro = bairro;
}
public String getCidade() {
return cidade;
}
public void setCidade(String cidade) {
this.cidade = cidade;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
public String getComplemento() {
return complemento;
}
public void setComplemento(String complemento) {
this.complemento = complemento;
}
}
| [
"[email protected]"
] | |
e689e2a9e1b2ba98f9f3a302fca5155b913a6f75 | 686eb567137c9f4232d3b3bd68255c41ba4e890d | /src/main/java/com/example/review/config/WebSecurityConfig.java | fe00e6f4be310cf3828ee99499188c1ee03f1902 | [] | no_license | tareksfouda/simple-spring-boot-app | a2500cdec8930c442bba4414873c0eed55e7667b | 31f68f6735396728d269bb316ddd504713a59cc5 | refs/heads/master | 2020-05-25T14:38:05.165996 | 2019-05-21T14:05:59 | 2019-05-21T14:05:59 | 187,849,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,977 | java | package com.example.review.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserDetailsService customUserDetailsService;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
public void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(customUserDetailsService)
.passwordEncoder(passwordEncoder);
}
@Override
public void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/oauth/token").permitAll()
.anyRequest().authenticated()
.and()
.httpBasic()
.and()
.csrf().disable();
}
/**
* See: https://github.com/spring-projects/spring-boot/issues/11136
*
* @return
* @throws Exception
*/
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
}
| [
"[email protected]"
] | |
833f4363b65c7aa44fc0486667916dc0a7177b64 | 722a98119e564db7383470d4b49273a517e90a1a | /src/snap/util/Node.java | 1985a36b64b8cd817513e2b22f7fb519e23bd2a4 | [] | no_license | BEAST2-Dev/SNAPP | 52f3c3b21e9e5777ac94a72370371d3e0363da38 | 4261c543727c061b1a56a500cee0dc1fa6a34616 | refs/heads/master | 2023-06-01T17:42:05.212989 | 2023-05-22T00:12:26 | 2023-05-22T00:12:26 | 32,816,326 | 4 | 10 | null | 2022-12-14T01:37:56 | 2015-03-24T18:12:35 | Java | UTF-8 | Java | false | false | 8,556 | java | package snap.util;
import java.text.DecimalFormat;
import java.util.Vector;
/** class for nodes in building tree data structure **/
public class Node {
/** length of branch in the tree **/
public float m_fLength = -1;
/** height of the node. This is a derived variable from m_fLength **/
//float m_fHeight = -1;
/** x & y coordinate of node **/
public float m_fPosX = 0;
public float m_fPosY = 0;
/** label nr of node, only used when this is a leaf **/
public int m_iLabel;
public int getNr() {return m_iLabel;}
/** metadata contained in square brackers in Newick **/
public String m_sMetaData;
/** user data generated by other applications (e.g. DensiTreeG)**/
public Object m_data = null;
/** list of children of this node **/
public Node m_left;
public Node m_right;
//Node[] m_children;
/** parent node in the tree, null if root **/
Node m_Parent = null;
/** return parent node, or null if this is root **/
public Node getParent() {
return m_Parent;
}
public void setParent(Node parent) {
m_Parent = parent;
}
/** check if current node is root node **/
public boolean isRoot() {
return m_Parent == null;
}
/** check if current node is a leaf node **/
public boolean isLeaf() {
return m_left == null;
}
/** count number of nodes in tree, starting with current node **/
int getNodeCount() {
if (isLeaf()) {
return 1;
}
return 1 + m_left.getNodeCount() + m_right.getNodeCount();
}
/**
* print tree in Newick format, without any length or meta data
* information
**/
public String toShortNewick() {
StringBuffer buf = new StringBuffer();
if (m_left != null) {
buf.append("(");
buf.append(m_left.toShortNewick());
buf.append(',');
buf.append(m_right.toShortNewick());
buf.append(")");
} else {
buf.append(m_iLabel);
}
return buf.toString();
}
/**
* print tree in long Newick format, with all length and meta data
* information
**/
public String toNewick() {
StringBuffer buf = new StringBuffer();
if (m_left != null) {
buf.append("(");
buf.append(m_left.toNewick());
buf.append(',');
buf.append(m_right.toNewick());
buf.append(")");
} else {
buf.append(m_iLabel);
}
if (m_sMetaData != null) {
buf.append('[');
buf.append(m_sMetaData);
buf.append(']');
}
buf.append(":" + m_fLength);
return buf.toString();
}
/**
* print tree in long Newick format, with position meta data
* information
**/
public String toNewickWithPos(double fMinLat, double fMaxLat, double fMinLong) {
StringBuffer buf = new StringBuffer();
if (m_left != null) {
buf.append("(");
buf.append(m_left.toNewickWithPos(fMinLat, fMaxLat, fMinLong));
buf.append(',');
buf.append(m_right.toNewickWithPos(fMinLat, fMaxLat, fMinLong));
buf.append(")");
} else {
buf.append(m_iLabel);
}
buf.append("[pos=");
DecimalFormat df = new DecimalFormat("#.##");
buf.append(df.format(toLongitude(m_fPosX, fMinLat, fMaxLat)) + "x" + df.format(toLatitude(m_fPosY, fMinLong)));
buf.append(']');
buf.append(":" + m_fLength);
return buf.toString();
}
double toLongitude(double fPosX, double fMinLat, double fMaxLat) {
return fMaxLat - fPosX + (fMaxLat-fMinLat) / 100.0f;
}
double toLatitude(double fPosY, double fMinLong) {
return fPosY + fMinLong;
}
/**
* print tree in long Newick format, with all length and meta data
* information, but with leafs labelled with their names
**/
public String toString(Vector<String> sLabels) {
StringBuffer buf = new StringBuffer();
if (m_left != null) {
buf.append("(");
buf.append(m_left.toString(sLabels));
buf.append(',');
buf.append(m_right.toString(sLabels));
buf.append(")");
} else {
if (sLabels == null) {
buf.append(m_iLabel);
} else {
buf.append(sLabels.elementAt(m_iLabel));
}
}
if (sLabels != null) {
if (m_sMetaData != null) {
buf.append('[');
buf.append(m_sMetaData);
buf.append(']');
}
buf.append(":" + m_fLength);
}
return buf.toString();
}
public String toString() {
return toNewick();
}
/**
* 'draw' tree into an array of x & positions. This draws the tree as
* block diagram.
*
* @param nX
* @param nY
* @param iPos
* @return
*/
public int drawDry(float[] nX, float[] nY, int iPos, boolean[] bNeedsDrawing, boolean [] bSelection, float fOffset, float fScale) {
if (isLeaf()) {
bNeedsDrawing[0] = bSelection[m_iLabel];
} else {
boolean[] bChildNeedsDrawing = new boolean[2];
iPos = m_left.drawDry(nX, nY, iPos, bNeedsDrawing, bSelection, fOffset, fScale);
bChildNeedsDrawing[0] = bNeedsDrawing[0];
iPos = m_right.drawDry(nX, nY, iPos, bNeedsDrawing, bSelection, fOffset, fScale);
bChildNeedsDrawing[1] = bNeedsDrawing[0];
bNeedsDrawing[0] = false;
if (bChildNeedsDrawing[0]) {
nX[iPos] = m_left.m_fPosX;
nY[iPos] = (m_left.m_fPosY - fOffset) * fScale;
iPos++;
nX[iPos] = nX[iPos - 1];
nY[iPos] = (m_fPosY - fOffset) * fScale;
bNeedsDrawing[0] = true;
} else {
nX[iPos] = m_fPosX;
nY[iPos] = (m_fPosY - fOffset) * fScale;
iPos++;
nX[iPos] = m_fPosX;
nY[iPos] = (m_fPosY - fOffset) * fScale;
}
iPos++;
if (bChildNeedsDrawing[1]) {
nX[iPos] = m_right.m_fPosX;
nY[iPos] = nY[iPos - 1];
iPos++;
nX[iPos] = nX[iPos - 1];
nY[iPos] = (m_right.m_fPosY - fOffset) * fScale;
bNeedsDrawing[0] = true;
} else {
nX[iPos] = m_fPosX;
nY[iPos] = (m_fPosY - fOffset) * fScale;
iPos++;
nX[iPos] = m_fPosX;
nY[iPos] = (m_fPosY - fOffset) * fScale;
}
iPos++;
if (isRoot()) {
nX[iPos] = m_fPosX;
nY[iPos] = (m_fPosY - fOffset) * fScale;
iPos++;
nX[iPos] = m_fPosX;
nY[iPos] = (m_fPosY - m_fLength - fOffset) * fScale;
iPos++;
}
}
return iPos;
}
// /**
// * 'draw' tree into an array of x & positions. This draws the tree using
// * triangles
// *
// * @param nX
// * @param nY
// * @param iPos
// * @return
// */
// public int drawDryTriangle(float[] nX, float[] nY, int iPos, boolean[] bNeedsDrawing, boolean [] bSelection) {
// if (isLeaf()) {
// bNeedsDrawing[0] = bSelection[m_iLabel];
// } else {
// boolean[] bChildNeedsDrawing = new boolean[2];
// iPos = m_left.drawDryTriangle(nX, nY, iPos, bNeedsDrawing, bSelection);
// bChildNeedsDrawing[0] = bNeedsDrawing[0];
// iPos = m_right.drawDryTriangle(nX, nY, iPos, bNeedsDrawing, bSelection);
// bChildNeedsDrawing[1] = bNeedsDrawing[0];
// bNeedsDrawing[0] = false;
// if (bChildNeedsDrawing[0]) {
// nX[iPos] = m_left.m_fPosX;
// nY[iPos] = m_left.m_fPosY;
// bNeedsDrawing[0] = true;
// } else {
// nX[iPos] = m_fPosX;
// nY[iPos] = m_fPosY;
// }
// iPos++;
// nX[iPos] = m_fPosX;
// nY[iPos] = m_fPosY;
// iPos++;
// if (bChildNeedsDrawing[1]) {
// nX[iPos] = m_right.m_fPosX;
// nY[iPos] = m_right.m_fPosY;
// bNeedsDrawing[0] = true;
// } else {
// nX[iPos] = m_fPosX;
// nY[iPos] = m_fPosY;
// }
// iPos++;
// }
// if (isRoot()) {
// nX[iPos] = m_fPosX;
// nY[iPos] = m_fPosY;
// iPos++;
// nX[iPos] = m_fPosX;
// nY[iPos] = m_fPosY - m_fLength;
// iPos++;
// }
// return iPos;
// }
/**
* sorts nodes in children according to lowest numbered label in subtree
**/
int sort() {
if (m_left != null) {
int iChild1 = m_left.sort();
int iChild2 = m_right.sort();
if (iChild1 > iChild2) {
Node tmp = m_left;
m_left = m_right;
m_right = tmp;
return iChild2;
}
return iChild1;
}
// this is a leaf node, just return the label nr
return m_iLabel;
} // sort
/** during parsing, leaf nodes are numbered 0...m_nNrOfLabels-1
* but internal nodes are left to zero. After labeling internal
* nodes, m_iLabel uniquely identifies a node in a tree.
*/
int labelInternalNodes(int iLabel) {
if (isLeaf()) {
return iLabel;
} else {
iLabel = m_left.labelInternalNodes(iLabel);
iLabel = m_right.labelInternalNodes(iLabel);
m_iLabel = iLabel++;
}
return iLabel;
} // labelInternalNodes
/** create deep copy **/
Node copy() {
Node node = new Node();
node.m_fLength = m_fLength;
node.m_fPosX = m_fPosX;
node.m_fPosY = m_fPosY;
node.m_iLabel = m_iLabel;
node.m_sMetaData = m_sMetaData;
node.m_Parent = null;
if (m_left != null) {
node.m_left = m_left.copy();
node.m_right = m_right.copy();
node.m_left.m_Parent = node;
node.m_right.m_Parent = node;
}
return node;
} // copy
} // class Node
| [
"[email protected]"
] | |
0befa26e5542c1feff5e71e9db25a32c8ee86e7e | 4c99fa62a3079504ca7a6cd74e06eb5cf2946aa3 | /lib/Excel/src/testcases/org/apache/poi/ss/formula/functions/TestEDate.java | 96cc31c1becbc1ba511556ae175143027a7e7371 | [] | no_license | chenyurong/XINPINHUIV | 68d9a77fe80389fb41d1d303a365e12095fb1973 | 6d5dee74235600c76841a1acf366a5d7f7fc4f2c | refs/heads/master | 2021-05-30T20:01:34.634555 | 2016-03-25T09:11:35 | 2016-03-25T09:11:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,987 | 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.poi.ss.formula.functions;
import junit.framework.TestCase;
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.ErrorConstants;
import java.util.Calendar;
import java.util.Date;
public class TestEDate extends TestCase{
public void testEDateProperValues() {
EDate eDate = new EDate();
NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[]{new NumberEval(1000), new NumberEval(0)}, null);
assertEquals(1000d, result.getNumberValue());
}
public void testEDateInvalidValues() {
EDate eDate = new EDate();
ErrorEval result = (ErrorEval) eDate.evaluate(new ValueEval[]{new NumberEval(1000)}, null);
assertEquals(ErrorConstants.ERROR_VALUE, result.getErrorCode());
}
public void testEDateIncrease() {
EDate eDate = new EDate();
Date startDate = new Date();
int offset = 2;
NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[]{new NumberEval(DateUtil.getExcelDate(startDate)), new NumberEval(offset)}, null);
Date resultDate = DateUtil.getJavaDate(result.getNumberValue());
Calendar instance = Calendar.getInstance();
instance.setTime(startDate);
instance.add(Calendar.MONTH, offset);
assertEquals(resultDate, instance.getTime());
}
public void testEDateDecrease() {
EDate eDate = new EDate();
Date startDate = new Date();
int offset = -2;
NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[]{new NumberEval(DateUtil.getExcelDate(startDate)), new NumberEval(offset)}, null);
Date resultDate = DateUtil.getJavaDate(result.getNumberValue());
Calendar instance = Calendar.getInstance();
instance.setTime(startDate);
instance.add(Calendar.MONTH, offset);
assertEquals(resultDate, instance.getTime());
}
}
| [
"[email protected]"
] | |
04a6dffeb7de47191baf976d8affd157621e2322 | 0d6572d242f741ca10b08d1ac0ee246685f60967 | /IBDP/src/com/sdu/AnalyseMethods/CorrelationMethod.java | 9e290dd8aa1136b327e456e7786d81e9c17ebf55 | [] | no_license | luckyyangz/IBDP2.0 | f2b5bb08188be3608fcfc15838b30c491bd845aa | 5e1a50e2f66ff74ad06a5caeb12cbec9eca833f8 | refs/heads/master | 2021-08-20T06:46:06.382147 | 2017-11-28T12:02:07 | 2017-11-28T12:02:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,537 | java | package com.sdu.AnalyseMethods;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import org.json.JSONArray;
import org.json.JSONObject;
import org.rosuda.REngine.REXP;
import org.rosuda.REngine.REXPMismatchException;
import org.rosuda.REngine.Rserve.RConnection;
import org.rosuda.REngine.Rserve.RserveException;
import com.sdu.ToolsUse.AdviceHibernate;
import com.sdu.ToolsUse.DataFileHibernate;
import com.sdu.ToolsUse.HDFSTools;
import com.sdu.entity.Admin;
import com.sdu.entity.Advice;
import com.sdu.entity.DataFile;
import com.sdu.entity.Project;
public class CorrelationMethod extends BasicMethod{
public DataFile beiginAnalyse(int index, DataFile dataFile, Admin user, Project project, JSONObject projectJSON, JSONArray algorithmJSON)
{
System.out.println("compute correlation");
String filepath=dataFile.getD_localpath();
String dataFileName=dataFile.getD_name();
JSONObject algorithm_obj=algorithmJSON.getJSONObject(index);
JSONArray params= algorithm_obj.getJSONArray("param");
String chosecolumn=params.getJSONObject(1).getString("value");
String chosework=params.getJSONObject(0).getString("value");
DataFile resultFile=null;
//开始执行分析相关性
try {
RConnection c = new RConnection();
REXP x = c.eval("R.version.string");
System.out.println(x.asString());
String cor_method="pearson";
if(chosework.equals("kendall"))
cor_method="kendall";
else if(chosework.equals("spearman"))
cor_method="spearman";
String savePath=filepath.substring(0,filepath.lastIndexOf('/'));
System.out.println(savePath);
System.out.println("setwd(\""+savePath+"\")");
c.eval("setwd(\""+savePath+"\")");
c.eval("library(openxlsx)");
String aa = dataFileName.substring(dataFileName.lastIndexOf("."));
if(aa.equals(".xlsx"))
{
c.eval("datafile <- read.xlsx(\""+dataFileName+"\",1)");
}else if (aa.equals(".txt"))
{
c.eval("datafile <- read.table(\""+dataFileName+"\",header="+dataFile.getD_hasheader()+")");
}else if (aa.equals(".csv"))
{
c.eval("datafile<-read.csv(\""+dataFileName+"\",header="+dataFile.getD_hasheader()+",sep=\",\")");
}else if(aa.equals(".Rdata"))
{
c.eval("load(\""+dataFileName+"\")");
}
double [][]cormatrix=c.eval("res<-cor(datafile[,c("+chosecolumn+")],method='"+cor_method+"')").asDoubleMatrix();
//double [][]cormatrix=c.eval("round(cor(cordata[,c("+chosecolumn+")],method='"+cor_method+"'),6)").asDoubleMatrix();
System.out.println("matrix计算完成");
String resultFileName=dataFileName.substring(0,dataFileName.lastIndexOf('.'))+"_correlation";
System.out.println("开始写入结果文件:"+resultFileName);
c.eval("png(file=\""+resultFileName+".png\", bg=\"transparent\")");
c.eval("print(GGally::ggpairs(datafile[,c("+chosecolumn+")]))");
c.eval("dev.off()");
//保存图像
resultFile=FormResultFileAndAdvice.formFile(user, project, resultFileName+".png", savePath+"/"+resultFileName+".png");
resultFile.setD_type("ResultFile");
DataFileHibernate.saveDataFile(resultFile);
HDFSTools.LoadSingleFileToHDFS(resultFile);
if(index==algorithmJSON.length()-1)
{
resultFileName=resultFileName+".txt";
c.eval("sink(\""+resultFileName+"\")");
c.eval("print(res)");
c.eval("sink()");
resultFile=FormResultFileAndAdvice.formFile(user, project, resultFileName, savePath+"/"+resultFileName);
resultFile.setD_type("ResultFile");
DataFileHibernate.saveDataFile(resultFile);
HDFSTools.LoadSingleFileToHDFS(resultFile);
//通知分析完成
FormResultFileAndAdvice.FormAdvice(user, project);
}
else
{
resultFileName=resultFileName+".Rdata";
c.eval("save(res,\""+resultFileName+"\" )");
resultFile=FormResultFileAndAdvice.formFile(user, project, resultFileName, savePath+"/"+resultFileName+".png");
resultFile.setD_type("IntermediateFile");
}
c.close();
System.out.println("Rserve连接关闭");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return resultFile;
}
}
| [
"[email protected]"
] | |
191deb09d72f06886cc6c058be5a5b6c6c935e24 | 438023f985c56bbbef6bc5994101c7bde4b2d3c8 | /src/test/TestChi.java | 2515ef98bce3c346ef03e251edfdbcc3a986d501 | [] | no_license | DiegoBuitrago/Taller13 | 93a6fc5fe666cf6da10919a53599a02b4f938520 | f4b0e92868cc64c3599c6e06ef200cefa672e3bd | refs/heads/master | 2023-01-24T00:29:40.561140 | 2020-12-03T03:41:42 | 2020-12-03T03:41:42 | 315,823,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,303 | java | package test;
import methodsTest.Chi;
import models.Intro;
import models.LineChiTest;
import java.util.ArrayList;
public class TestChi {
public static void main(String[] args) {
p1();
}
private static void p1(){
ArrayList<Intro> list = new ArrayList<Intro>();
list.add(new Intro(0.1214));
list.add(new Intro(0.4267));
list.add(new Intro(0.1379));
list.add(new Intro(0.7385));
list.add(new Intro(0.8432));
list.add(new Intro(0.5801));
list.add(new Intro(0.0100));
list.add(new Intro(0.3703));
list.add(new Intro(0.7205));
list.add(new Intro(0.5427));
list.add(new Intro(0.3795));
list.add(new Intro(0.7389));
list.add(new Intro(0.1266));
list.add(new Intro(0.6429));
list.add(new Intro(0.8298));
int numIntervalos = 8;
Chi chi = new Chi(list, numIntervalos);
ArrayList<LineChiTest> lines = chi.getLines();
for (int i=0;i<lines.size();i++) {
System.out.println(lines.get(i).toString());
}
System.out.println(chi.getTotalChi2());
System.out.println(chi.getLibertyGrade());
System.out.println(chi.getDistributionChi());
System.out.println(chi.isResult());
}
} | [
"[email protected]"
] | |
2a860d641b9ef4161d99c2fa057d1f383c8cf69e | 5a48cc960cec688fce1f5dc753207e29ea08eb72 | /Poseiden-skeleton/src/main/java/com/nnk/springboot/domain/CurvePoint.java | 151f80d02f0ae92b1341432685af2b1cd941a5a9 | [] | no_license | OpenClassrooms-Student-Center/JavaDA_PROJECT7_RESTAPI | 8f73d0f88956af420ad9de12ba10e4527c6fcde0 | c9cc2ec4b8745adf55766ac6ffd10bbddb0ff2f2 | refs/heads/master | 2023-07-07T12:38:47.312319 | 2023-07-05T14:16:18 | 2023-07-05T14:16:18 | 181,696,307 | 5 | 218 | null | 2023-09-14T12:41:00 | 2019-04-16T13:37:12 | HTML | UTF-8 | Java | false | false | 396 | java | package com.nnk.springboot.domain;
import org.hibernate.validator.constraints.Length;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
@Entity
@Table(name = "curvepoint")
public class CurvePoint {
// TODO: Map columns in data table CURVEPOINT with corresponding java fields
}
| [
"[email protected]"
] | |
4c7a23a450826647a7f241e26f2a11855e042511 | 5a11ad4d2c044cd9e290bbcd8581f13a54ad1090 | /zimuapi/src/main/java/com/zimu/my2018/quyouapi/data/scenic/scenicattention/ScenicFocalBean.java | edcc63daa2529a616460a83139307fbcfb26ceff | [] | no_license | zimuL/myProject | d979dd66908308e098269c3acc1ec1305629d707 | 7be94e24462e25541e4bc9dfec00e66f3e05a548 | refs/heads/master | 2020-03-19T07:36:07.845713 | 2018-12-05T07:55:26 | 2018-12-05T07:55:26 | 136,129,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package com.zimu.my2018.quyouapi.data.scenic.scenicattention;
import java.io.Serializable;
/**
* 功能:
* 描述:
* Created by hxl on 2018/10/26
*/
public class ScenicFocalBean implements Serializable {
private int scenic_id;
private int user_id;
private long focus_time;
public int getScenic_id() {
return scenic_id;
}
public void setScenic_id(int scenic_id) {
this.scenic_id = scenic_id;
}
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_id;
}
public long getFocus_time() {
return focus_time;
}
public void setFocus_time(long focus_time) {
this.focus_time = focus_time;
}
}
| [
"[email protected]"
] | |
8dde175778e8dcc9aa13eb0722a28f0f405c4c04 | 0f9b55bd76a9dca62a720788ed43bbdc710a065e | /hardware1112/src/main/java/com/controller/SoilphController.java | 3f67dc0eaa9758fe972ce25f7ce267352f0a2095 | [] | no_license | Oceantears/IntelIDEAwork | 9559da89b6d5769bbd8ef40468a7f31f8539138c | ab74382b4fb9e16e24ac635275d47902bae45e7c | refs/heads/master | 2022-12-22T11:03:19.488413 | 2021-08-26T14:57:49 | 2021-08-26T14:57:49 | 208,036,056 | 0 | 0 | null | 2022-12-16T00:35:11 | 2019-09-12T11:32:58 | JavaScript | UTF-8 | Java | false | false | 2,325 | java | package com.controller;
import com.bean.Soilph;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
import com.interfaces.AirpressureInterface;
import com.interfaces.SoilphInterface;
import com.mapper.QxpreMapper;
import com.mapper.SoilphMapper;
import com.utils.InterfacesUtils;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SoilphController {
private static final Logger log = LoggerFactory.getLogger(SoilphController.class);
public static void dop(ArrayList<String> array, Soilph soilph, SoilphMapper SoilphMapper, QxpreMapper qxpreMapper) throws IOException {
array = InterfacesUtils.dop(qxpreMapper);
//进行设备SN迭代
for (String s : array) {
System.out.println(s);
//调用风速工具类
List<String> aa = SoilphInterface.dop(s, qxpreMapper);
for (String a : aa) {
//接受json data数组
JSONObject jb = JSONObject.fromObject(a);
//进行主体信息判断是否存在data
if (jb.containsKey("data")) {
//data数组
JsonArray userArray = new JsonParser().parse(a).getAsJsonObject().get("data").getAsJsonArray();
for (int i = 0; i < userArray.size(); i++) {
soilph.setKEYID(SoilphMapper.idPlusSoilph());
Date date = new Date(System.currentTimeMillis()+28800000);
soilph.setSO_DATE(date);
soilph.setSOILPH(userArray.get(i).getAsJsonObject().get("value").getAsDouble());
soilph.setSN(s);
//执行数据存入操作
SoilphMapper.insertSoilph(soilph);
log.info("土壤ph数据入库成功===-----");
}
}else{
/*soilph.setKEYID(SoilphMapper.idPlusSoilph());
soilph.setSO_DATE(null);
soilph.setSN(s);
soilph.setSOILPH(0);
SoilphMapper.insertSoilph(soilph);
*/ continue;
}
}
}
}
}
| [
"[email protected]"
] | |
48837531103820c3150e4d3251665440235f9eaf | e1a83f768c43886877182b70ba5914068f48efcf | /app/src/main/java/com/yitahutu/cn/wxapi/AppRegister.java | 07ba209058ceff6aa1f27be535f7ce0830685af1 | [] | no_license | MrChangc/Yitahutu | 5480efd699f2dfb6b4c01bff605e9234ea4ae4cf | 628756f9719f546cd028d1ac0c47799ca7b25479 | refs/heads/master | 2021-09-15T02:06:48.138706 | 2018-05-24T02:08:59 | 2018-05-24T02:08:59 | 110,082,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package com.yitahutu.cn.wxapi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
public class AppRegister extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
final IWXAPI msgApi = WXAPIFactory.createWXAPI(context, null);
// ����appע�ᵽ��
msgApi.registerApp("wx4bd3c0ec831f0b78");
}
}
| [
"[email protected]"
] | |
775ce6ffe41a5d0f260b6a51eaa0bf5019f66066 | e11e0be27bd187b211e730a144688f4711608447 | /app/src/main/java/cn/hwwwwh/taoxiang/dagger/PresenterComponent.java | f898c8d80206773604e8a804629285e68617ab9c | [] | no_license | sudoconf/taoxiang | 542d4d76376c8e82d676e9ce30053c51ee369af4 | 06d063029076084c5d654055d34aec3718432222 | refs/heads/master | 2020-04-19T04:42:43.307173 | 2019-01-23T03:12:47 | 2019-01-23T03:12:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package cn.hwwwwh.taoxiang.dagger;
import javax.inject.Singleton;
import cn.hwwwwh.taoxiang.base.BaseActivity;
import cn.hwwwwh.taoxiang.dagger.module.PresenterModule;
import cn.hwwwwh.taoxiang.view.activity.AliSdkWebViewProxyActivity;
import cn.hwwwwh.taoxiang.view.activity.CollectActivity;
import cn.hwwwwh.taoxiang.view.activity.MainActivity;
import cn.hwwwwh.taoxiang.view.activity.TmrActivity;
import dagger.Component;
/**
* Created by 97481 on 2017/10/5/ 0005.
*/
@Singleton
@Component(modules = {PresenterModule.class})
public interface PresenterComponent {
/**
* 注入点
* @param activity 表示需要使用DaggerPresenterComponent.create().inject(this);注入的地方,
* 注意,此处一定不要使用Activity,需要使用MainActivity,否则的话会报空指针异常。
* 因为这里的注入点是什么,就会到该类里面去找。如果写Activity,就会到Activity里面去找,
* 而Activity中并没有@inject,即没有需要注入的地方,所以在生成的DaggerPresenterComponent
* 中,方法就不会被调用。
*/
void inject( MainActivity activity);
void inject(TmrActivity activity);
void inject(AliSdkWebViewProxyActivity activity);
void inject(CollectActivity collectActivity);
void inject(BaseActivity baseActivity);
}
| [
"[email protected]"
] | |
724df4dd3ffd5fbbf547d2911d342df1de864408 | 44ca3cf84dd9802dea2327e9d6a15065301db520 | /src/orm/MedicoDetachedCriteria.java | 6415729fb9a15743d1b6b4c52e948d2dd7c8a0d7 | [] | no_license | rcarrasco02/HospitalWS | cb5f7a2f40710f6d9aef0912cd015cb0f01d02c1 | 9be031793f38161f088405bbb81a91b2fb6a811e | refs/heads/master | 2021-01-10T05:01:19.658029 | 2015-05-28T11:25:19 | 2015-05-28T11:25:19 | 36,203,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,761 | java | /**
* "Visual Paradigm: DO NOT MODIFY THIS FILE!"
*
* This is an automatic generated file. It will be regenerated every time
* you generate persistence class.
*
* Modifying its content may cause the program not work, or your work may lost.
*/
/**
* Licensee: Universidad de La Frontera
* License Type: Academic
*/
package orm;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.orm.PersistentSession;
import org.orm.criteria.*;
public class MedicoDetachedCriteria extends AbstractORMDetachedCriteria {
public final IntegerExpression id;
public final IntegerExpression personaId;
public final AssociationExpression persona;
public final IntegerExpression especialidadId;
public final AssociationExpression especialidad;
public final CollectionExpression hora_medica;
public MedicoDetachedCriteria() {
super(orm.Medico.class, orm.MedicoCriteria.class);
id = new IntegerExpression("id", this.getDetachedCriteria());
personaId = new IntegerExpression("persona.id", this.getDetachedCriteria());
persona = new AssociationExpression("persona", this.getDetachedCriteria());
especialidadId = new IntegerExpression("especialidad.id", this.getDetachedCriteria());
especialidad = new AssociationExpression("especialidad", this.getDetachedCriteria());
hora_medica = new CollectionExpression("ORM_hora_medica", this.getDetachedCriteria());
}
public MedicoDetachedCriteria(DetachedCriteria aDetachedCriteria) {
super(aDetachedCriteria, orm.MedicoCriteria.class);
id = new IntegerExpression("id", this.getDetachedCriteria());
personaId = new IntegerExpression("persona.id", this.getDetachedCriteria());
persona = new AssociationExpression("persona", this.getDetachedCriteria());
especialidadId = new IntegerExpression("especialidad.id", this.getDetachedCriteria());
especialidad = new AssociationExpression("especialidad", this.getDetachedCriteria());
hora_medica = new CollectionExpression("ORM_hora_medica", this.getDetachedCriteria());
}
public PersonaDetachedCriteria createPersonaCriteria() {
return new PersonaDetachedCriteria(createCriteria("persona"));
}
public EspecialidadDetachedCriteria createEspecialidadCriteria() {
return new EspecialidadDetachedCriteria(createCriteria("especialidad"));
}
public Hora_medicaDetachedCriteria createHora_medicaCriteria() {
return new Hora_medicaDetachedCriteria(createCriteria("ORM_hora_medica"));
}
public Medico uniqueMedico(PersistentSession session) {
return (Medico) super.createExecutableCriteria(session).uniqueResult();
}
public Medico[] listMedico(PersistentSession session) {
List list = super.createExecutableCriteria(session).list();
return (Medico[]) list.toArray(new Medico[list.size()]);
}
}
| [
"[email protected]"
] | |
b9570a3341388943746dd22e5a283c467f53a930 | b74e2ca3c95bc5781c84d71c24b708bc6048cbe9 | /app/src/androidTest/java/com/itla/mudat/test/testUsuarios.java | de4ebba648ac88c8cdd6b3a71dc5548a81419c68 | [] | no_license | FrandyJavier/mudat | bd6250194b56e87f23bb1d7dec52276e246dc163 | b4738c75ae1978db7b8a31285d1ccc312f8b6960 | refs/heads/master | 2021-08-24T11:49:35.684240 | 2017-12-09T16:32:29 | 2017-12-09T16:32:29 | 110,348,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package com.itla.mudat.test;
import android.content.Context;
import android.test.InstrumentationTestCase;
import com.itla.mudat.dao.UsuariosDbo;
import com.itla.mudat.entity.TipoUsuario;
import com.itla.mudat.entity.Usuario;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Frandy Javier AP on 11/28/2017.
*/
public class testUsuarios extends InstrumentationTestCase {
public void test_Crear() {
Usuario usuario = new Usuario();
UsuariosDbo db = new UsuariosDbo(getInstrumentation().getTargetContext());
usuario.setNombre("Prueba");
usuario.setTipoUsuario(TipoUsuario.CLIENTE);
usuario.setIdentificacion(1);
usuario.setEmail("[email protected]");
usuario.setTelefono("809-000-0000");
usuario.setClave("123");
usuario.setEstatus(true);
assertTrue(db.crear(usuario) > 0);
}
public void testListar() {
UsuariosDbo db = new UsuariosDbo(getInstrumentation().getTargetContext());
List<Usuario> usuarios = new ArrayList<>();
usuarios = db.listar();
assertTrue(usuarios.size() > 0);
}
}
| [
"[email protected]"
] | |
01258b6af70fe726560937a36d43f7c05ce241ce | a8e26a187623a17973144a1636a0088a1828fb23 | /opb-plsql/src/test/java/com/butterfill/opb/plsql/translation/PlsqlTreeParserTest.java | 12965862219644b5e9fec1ab1547f7bbdff612a6 | [] | no_license | pete88b/object-procedural-bridge | c49670df7ca59a82e6c35e5a3089f2506c48b9bd | 3afa96a7b068612b0318c7185fb183282f59d577 | refs/heads/master | 2020-05-27T10:44:02.617094 | 2015-11-02T11:39:16 | 2015-11-02T11:39:16 | 32,593,520 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,797 | java | /**
* Copyright (C) 2008 Peter Butterfill.
*
* 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.butterfill.opb.plsql.translation;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
*
* @author Peter Butterfill
*/
public class PlsqlTreeParserTest extends TestCase {
public PlsqlTreeParserTest(String testName) {
super(testName);
}
public static Test suite() {
TestSuite suite = new TestSuite(PlsqlTreeParserTest.class);
return suite;
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
/**
* Test of getTokenNames method, of class PlsqlTreeParser.
*/
public void testGetTokenNames() {
// No need to test this method
}
/**
* Test of getGrammarFileName method, of class PlsqlTreeParser.
*/
public void testGetGrammarFileName() {
// No need to test this method
}
/**
* Test of startRule method, of class PlsqlTreeParser.
*/
public void testStartRule() throws Exception {
// No need to test this method
}
/**
* Test of createOrReplacePackage method, of class PlsqlTreeParser.
*/
public void testCreateOrReplacePackage() throws Exception {
// No need to test this method
}
/**
* Test of element method, of class PlsqlTreeParser.
*/
public void testElement() throws Exception {
// No need to test this method
}
/**
* Test of mlComment method, of class PlsqlTreeParser.
*/
public void testMlComment() throws Exception {
// No need to test this method
}
/**
* Test of constantDeclaration method, of class PlsqlTreeParser.
*/
public void testConstantDeclaration() throws Exception {
// No need to test this method
}
/**
* Test of literal method, of class PlsqlTreeParser.
*/
public void testLiteral() throws Exception {
// No need to test this method
}
/**
* Test of function method, of class PlsqlTreeParser.
*/
public void testFunction() throws Exception {
// No need to test this method
}
/**
* Test of procedure method, of class PlsqlTreeParser.
*/
public void testProcedure() throws Exception {
// No need to test this method
}
/**
* Test of ignore method, of class PlsqlTreeParser.
*/
public void testIgnore() throws Exception {
// No need to test this method
}
/**
* Test of param method, of class PlsqlTreeParser.
*/
public void testParam() throws Exception {
// No need to test this method
}
/**
* Test of dataType method, of class PlsqlTreeParser.
*/
public void testDataType() throws Exception {
// No need to test this method
}
/**
* Test of id method, of class PlsqlTreeParser.
*/
public void testId() throws Exception {
// No need to test this method
}
}
| [
"[email protected]"
] | |
1fe137ce1dc519a6003edf9594e299f9c614b492 | 801ea23bf1e788dee7047584c5c26d99a4d0b2e3 | /com/planet_ink/coffee_mud/Libraries/layouts/AbstractLayout.java | be8132b6ee69c1a67996eab136c61a610672975f | [
"Apache-2.0"
] | permissive | Tearstar/CoffeeMud | 61136965ccda651ff50d416b6c6af7e9a89f5784 | bb1687575f7166fb8418684c45f431411497cef9 | refs/heads/master | 2021-01-17T20:23:57.161495 | 2014-10-18T08:03:37 | 2014-10-18T08:03:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,293 | java | package com.planet_ink.coffee_mud.Libraries.layouts;
import java.util.*;
import com.planet_ink.coffee_mud.core.CMStrings;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.AreaGenerationLibrary.LayoutNode;
import com.planet_ink.coffee_mud.Libraries.interfaces.AreaGenerationLibrary.*;
import com.planet_ink.coffee_mud.core.Directions;
/*
Copyright 2007-2014 Bo Zimmerman
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.
*/
/**
* Abstract area layout pattern
* node tags:
* nodetype: surround, leaf, offleaf, street, square, interior
* nodeexits: n,s,e,w, n,s, e,w, n,e,w, etc
* nodeflags: corner, gate, intersection, tee
* NODEGATEEXIT: (for gate, offleaf, square): n s e w etc
* noderun: (for surround, street): n,s e,w
*
* @author Bo Zimmerman
*/
public abstract class AbstractLayout implements LayoutManager
{
Random r = new Random();
public int diff(int width, int height, int num) {
final int x = width * height;
return (x<num) ? (num - x) : (x - num);
}
@Override
public abstract String name();
@Override
public abstract List<LayoutNode> generate(int num, int dir);
public static int getDirection(LayoutNode from, LayoutNode to)
{
if(to.coord()[1]<from.coord()[1]) return Directions.NORTH;
if(to.coord()[1]>from.coord()[1]) return Directions.SOUTH;
if(to.coord()[0]<from.coord()[0]) return Directions.WEST;
if(to.coord()[0]>from.coord()[0]) return Directions.EAST;
return -1;
}
public static LayoutRuns getRunDirection(int dirCode)
{
switch(dirCode)
{
case Directions.NORTH:
case Directions.SOUTH:
return LayoutRuns.ns;
case Directions.EAST:
case Directions.WEST:
return LayoutRuns.ew;
}
return LayoutRuns.ns;
}
}
| [
"[email protected]"
] | |
274c58398fad4ce3a2cc1fd35a46dcc8d664b559 | c9018fc3bac96e82392e78e844cb8d3931d5c188 | /_05Hibernate/src/main/java/cn/hibernate/day10Priviliege/Privilege.java | ebf1c8b4aee8c6f8ef96bbb949ecec4c3fc5c5c8 | [] | no_license | yufanfan/ssm | 43fdc6fa2ba69b8b142046e0c5ea163bf2e4eabd | 45f3b8397a08d395eb320f0ec0f0e015edf7d014 | refs/heads/master | 2021-09-03T00:24:15.728832 | 2018-01-04T08:56:33 | 2018-01-04T08:56:34 | 111,258,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package cn.hibernate.day10Priviliege;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
/**
* Created by yu fan on 2018/1/4.
*/
@Entity
@Table(name = "PRIVILEGE2")
public class Privilege {
@Id
@GeneratedValue
private Integer pid;
@Column
private String pname;
@ManyToMany(mappedBy = "privileges")
private Set<Role> roles=new HashSet<Role>();
public Set<Role> getRoles() {
return roles;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
public Integer getPid() {
return pid;
}
public void setPid(Integer pid) {
this.pid = pid;
}
public String getPname() {
return pname;
}
public void setPname(String pname) {
this.pname = pname;
}
}
| [
"[email protected]"
] | |
fb5324ed8bf476baaf25771e225a5d75f4bfcac5 | d17c2ff5922b71dbfd1a330d11ec004c595afab1 | /src/main/java/br/com/rodolfocugler/dtos/ResponseDTO.java | 8718f0b6132200d25669fb4e5f81bd82adb92b37 | [] | no_license | rodolfocugler/radioactive-game | 25138d55619a401005b034870d676ad81227e0a9 | ad66a1b952750baf518bd6eccb03f181e2c88955 | refs/heads/main | 2023-03-02T16:41:37.314217 | 2021-02-07T11:24:13 | 2021-02-07T11:24:13 | 323,475,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package br.com.rodolfocugler.dtos;
import lombok.*;
@Builder
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class ResponseDTO {
private String account;
private String response;
private long timestamp;
}
| [
"[email protected]"
] | |
a0ab78d91e7a3ee4edaf067514ed86680aee5551 | 72300177cbf06804b025b363d08770abe2e8f8b7 | /src/main/java/me/earth/phobos/mixin/mixins/MixinEntityPlayerSP.java | 4a945c30316f855397d5cb10aee2a05e9c0620ff | [] | no_license | IceCruelStuff/Phobos-1.9.0-BUILDABLE-SRC | b1f0e5dd8e12d681d3496b556ded70575bc6a331 | cabebefe13a9ca747288a0abc1aaa9ff3c49a3fd | refs/heads/main | 2023-03-24T18:43:55.223380 | 2021-03-21T02:05:21 | 2021-03-21T02:05:21 | 349,879,386 | 1 | 0 | null | 2021-03-21T02:06:44 | 2021-03-21T02:05:00 | Java | UTF-8 | Java | false | false | 5,617 | java |
package me.earth.phobos.mixin.mixins;
import me.earth.phobos.Phobos;
import me.earth.phobos.event.events.ChatEvent;
import me.earth.phobos.event.events.MoveEvent;
import me.earth.phobos.event.events.PushEvent;
import me.earth.phobos.event.events.UpdateWalkingPlayerEvent;
import me.earth.phobos.features.modules.misc.BetterPortals;
import me.earth.phobos.features.modules.movement.Speed;
import me.earth.phobos.features.modules.movement.Sprint;
import me.earth.phobos.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.MoverType;
import net.minecraft.stats.RecipeBook;
import net.minecraft.stats.StatisticsManager;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Event;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value={EntityPlayerSP.class}, priority=9998)
public abstract class MixinEntityPlayerSP
extends AbstractClientPlayer {
public MixinEntityPlayerSP(Minecraft p_i47378_1_, World p_i47378_2_, NetHandlerPlayClient p_i47378_3_, StatisticsManager p_i47378_4_, RecipeBook p_i47378_5_) {
super(p_i47378_2_, p_i47378_3_.getGameProfile());
}
@Inject(method={"sendChatMessage"}, at={@At(value="HEAD")}, cancellable=true)
public void sendChatMessage(String message, CallbackInfo callback) {
ChatEvent chatEvent = new ChatEvent(message);
MinecraftForge.EVENT_BUS.post((Event)chatEvent);
}
@Redirect(method={"onLivingUpdate"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/entity/EntityPlayerSP;closeScreen()V"))
public void closeScreenHook(EntityPlayerSP entityPlayerSP) {
if (!BetterPortals.getInstance().isOn() || !BetterPortals.getInstance().portalChat.getValue().booleanValue()) {
entityPlayerSP.closeScreen();
}
}
@Redirect(method={"onLivingUpdate"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V"))
public void displayGuiScreenHook(Minecraft mc, GuiScreen screen) {
if (!BetterPortals.getInstance().isOn() || !BetterPortals.getInstance().portalChat.getValue().booleanValue()) {
mc.displayGuiScreen(screen);
}
}
@Redirect(method={"onLivingUpdate"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/entity/EntityPlayerSP;setSprinting(Z)V", ordinal=2))
public void onLivingUpdate(EntityPlayerSP entityPlayerSP, boolean sprinting) {
if (Sprint.getInstance().isOn() && Sprint.getInstance().mode.getValue() == Sprint.Mode.RAGE && (Util.mc.player.movementInput.moveForward != 0.0f || Util.mc.player.movementInput.moveStrafe != 0.0f)) {
entityPlayerSP.setSprinting(true);
} else {
entityPlayerSP.setSprinting(sprinting);
}
}
@Inject(method={"pushOutOfBlocks"}, at={@At(value="HEAD")}, cancellable=true)
private void pushOutOfBlocksHook(double x, double y, double z, CallbackInfoReturnable<Boolean> info) {
PushEvent event = new PushEvent(1);
MinecraftForge.EVENT_BUS.post((Event)event);
if (event.isCanceled()) {
info.setReturnValue(false);
}
}
@Inject(method={"onUpdateWalkingPlayer"}, at={@At(value="HEAD")}, cancellable=true)
private void preMotion(CallbackInfo info) {
UpdateWalkingPlayerEvent event = new UpdateWalkingPlayerEvent(0);
MinecraftForge.EVENT_BUS.post((Event)event);
if (event.isCanceled()) {
info.cancel();
}
}
@Redirect(method={"onUpdateWalkingPlayer"}, at=@At(value="FIELD", target="net/minecraft/util/math/AxisAlignedBB.minY:D"))
private double minYHook(AxisAlignedBB bb) {
if (Speed.getInstance().isOn() && Speed.getInstance().mode.getValue() == Speed.Mode.VANILLA && Speed.getInstance().changeY) {
Speed.getInstance().changeY = false;
return Speed.getInstance().minY;
}
return bb.minY;
}
@Inject(method={"onUpdateWalkingPlayer"}, at={@At(value="RETURN")})
private void postMotion(CallbackInfo info) {
UpdateWalkingPlayerEvent event = new UpdateWalkingPlayerEvent(1);
MinecraftForge.EVENT_BUS.post((Event)event);
}
@Inject(method={"Lnet/minecraft/client/entity/EntityPlayerSP;setServerBrand(Ljava/lang/String;)V"}, at={@At(value="HEAD")})
public void getBrand(String brand, CallbackInfo callbackInfo) {
if (Phobos.serverManager != null) {
Phobos.serverManager.setServerBrand(brand);
}
}
@Redirect(method={"move"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/entity/AbstractClientPlayer;move(Lnet/minecraft/entity/MoverType;DDD)V"))
public void move(AbstractClientPlayer player, MoverType moverType, double x, double y, double z) {
MoveEvent event = new MoveEvent(0, moverType, x, y, z);
MinecraftForge.EVENT_BUS.post((Event)event);
if (!event.isCanceled()) {
super.move(event.getType(), event.getX(), event.getY(), event.getZ());
}
}
}
| [
"[email protected]"
] | |
78a019ad080c151630d738ebdaec5dcb6a5a5b05 | b8683adbe20ccb78884bd7bba2e5a5f22553ef24 | /src/main/java/uk/co/jemos/podam/typeManufacturers/FloatTypeManufacturerImpl.java | 59a96cec0e27f7764fb374b78b3e61d0684bbcd8 | [
"MIT"
] | permissive | jmhanna/podam | edd55b3297406061a08e4577a450b5dc56c87e49 | e256e415db08940de0df3b3fbdf01ec6548cbae4 | refs/heads/master | 2022-07-22T11:26:58.317090 | 2016-07-02T15:57:53 | 2016-07-02T15:57:53 | 62,456,982 | 0 | 0 | MIT | 2022-07-07T22:43:38 | 2016-07-02T15:22:29 | Java | UTF-8 | Java | false | false | 2,447 | java | package uk.co.jemos.podam.typeManufacturers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.co.jemos.podam.api.DataProviderStrategy;
import uk.co.jemos.podam.common.PodamConstants;
import uk.co.jemos.podam.common.PodamFloatValue;
import java.lang.annotation.Annotation;
/**
* Default float type manufacturer.
*
* Created by tedonema on 17/05/2015.
*
* @since 6.0.0.RELEASE
*/
public class FloatTypeManufacturerImpl extends AbstractTypeManufacturer {
/** The application logger */
private static final Logger LOG = LoggerFactory.getLogger(FloatTypeManufacturerImpl.class);
/**
* {@inheritDoc}
*/
@Override
public Float getType(TypeManufacturerParamsWrapper wrapper) {
super.checkWrapperIsValid(wrapper);
DataProviderStrategy strategy = wrapper.getDataProviderStrategy();
Float retValue = null;
for (Annotation annotation : wrapper.getAttributeMetadata().getAttributeAnnotations()) {
if (PodamFloatValue.class.isAssignableFrom(annotation.getClass())) {
PodamFloatValue floatStrategy = (PodamFloatValue) annotation;
String numValueStr = floatStrategy.numValue();
if (null != numValueStr && !"".equals(numValueStr)) {
try {
retValue = Float.valueOf(numValueStr);
} catch (NumberFormatException nfe) {
String errMsg = PodamConstants.THE_ANNOTATION_VALUE_STR
+ numValueStr
+ " could not be converted to a Float. An exception will be thrown.";
LOG.error(errMsg);
throw new IllegalArgumentException(errMsg, nfe);
}
} else {
float minValue = floatStrategy.minValue();
float maxValue = floatStrategy.maxValue();
// Sanity check
if (minValue > maxValue) {
maxValue = minValue;
}
retValue = strategy.getFloatInRange(minValue, maxValue,
wrapper.getAttributeMetadata());
}
break;
}
}
if (retValue == null) {
retValue = strategy.getFloat(wrapper.getAttributeMetadata());
}
return retValue;
}
}
| [
"[email protected]"
] | |
5cc8af233a63d7801743255301b52b75fc19f40d | b82ac609cb6773f65e283247f673c0f07bf09c6a | /week-07/day-1/src/main/java/spring/sql/practice/repository/ToDo.java | 19d101cf9b171f222b3fcc50830217dfbb2d67a1 | [] | no_license | green-fox-academy/scerios | 03b2c2cc611a02f332b3ce1edd9743446b0a8a12 | f829d62bdf1518e3e01dc125a98f90e484c9dce4 | refs/heads/master | 2020-04-02T22:36:36.470006 | 2019-01-07T16:38:20 | 2019-01-07T16:38:20 | 154,839,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package spring.sql.practice.repository;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class ToDo {
@Id
@GeneratedValue
private long ID;
private String title;
private boolean isUrgent;
private boolean isDone;
public ToDo(String title) {
this.title = title;
this.isUrgent = false;
this.isDone = false;
}
public long getID() {
return ID;
}
public String getTitle() {
return title;
}
public boolean isUrgent() {
return isUrgent;
}
public boolean isDone() {
return isDone;
}
}
| [
"[email protected]"
] | |
33b5d1659d30b5ebddd12e87d298ba925cea9011 | d33a195fc7e9d343682b357a4a8a1459936516ea | /src/main/java/com/qa/ExtentReportListener/ExtentReporterNG.java | 8bcfd913968d1e88cc3c6bb4252c7209be6bcd2a | [] | no_license | sumantug/GitDemo | 2feb55f57b426e21f4187da75a041e23058f0643 | 2786de8f4603725b7a9e35ba857dcffa5ff740db | refs/heads/master | 2023-08-18T21:16:00.438423 | 2021-10-11T11:10:12 | 2021-10-11T11:10:12 | 415,494,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,043 | java | package com.qa.ExtentReportListener;
import java.util.List;
import org.testng.IReporter;
import java.io.File;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import org.testng.IResultMap;
import org.testng.ISuite;
import org.testng.ISuiteResult;
import org.testng.ITestContext;
import org.testng.ITestResult;
import org.testng.xml.XmlSuite;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
public class ExtentReporterNG implements IReporter {
private ExtentReports extent;
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites,
String outputDirectory) {
extent = new ExtentReports(outputDirectory + File.separator
+ "Extent.html", true);
for (ISuite suite : suites) {
Map<String, ISuiteResult> result = suite.getResults();
for (ISuiteResult r : result.values()) {
ITestContext context = r.getTestContext();
buildTestNodes(context.getPassedTests(), LogStatus.PASS);
buildTestNodes(context.getFailedTests(), LogStatus.FAIL);
buildTestNodes(context.getSkippedTests(), LogStatus.SKIP);
}
}
extent.flush();
extent.close();
}
private void buildTestNodes(IResultMap tests, LogStatus status) {
ExtentTest test;
if (tests.size() > 0) {
for (ITestResult result : tests.getAllResults()) {
test = extent.startTest(result.getMethod().getMethodName());
test.setStartedTime(getTime(result.getStartMillis()));
test.setEndedTime(getTime(result.getEndMillis()));
for (String group : result.getMethod().getGroups())
test.assignCategory(group);
if (result.getThrowable() != null) {
test.log(status, result.getThrowable());
} else {
test.log(status, "Test " + status.toString().toLowerCase()
+ "ed");
}
extent.endTest(test);
}
}
}
private Date getTime(long millis) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(millis);
return calendar.getTime();
}
} | [
"[email protected]"
] | |
ef6f00e3511b5ea693ff269efab271fa6a669c3c | ea954f862714e132dfb0d2db8bc9c52da8dcda64 | /frame/src/main/java/com/lvqingyang/frame/helper/DrawableHelper.java | 16372b162116120e95c88123b274096c58708534 | [] | no_license | biloba123/iWuster | 3edf4393efbdd5526ee5434ee620f2d294ad9b42 | 43d1c657b87c53590b4541a5da2a6cfedaaf3690 | refs/heads/master | 2021-05-05T17:05:36.187670 | 2018-05-26T08:26:02 | 2018-05-26T08:26:02 | 117,342,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,601 | java | package com.lvqingyang.frame.helper;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.LightingColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.annotation.FloatRange;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatDrawableManager;
import android.view.View;
import android.widget.ImageView;
/**
* @author cginechen
* @date 2016-03-17
*/
public class DrawableHelper {
private static final String TAG = DrawableHelper.class.getSimpleName();
//节省每次创建时产生的开销,但要注意多线程操作synchronized
private static final Canvas sCanvas = new Canvas();
/**
* 从一个view创建Bitmap。
* 注意点:绘制之前要清掉 View 的焦点,因为焦点可能会改变一个 View 的 UI 状态。
* 来源:https://github.com/tyrantgit/ExplosionField
*
* @param view 传入一个 View,会获取这个 View 的内容创建 Bitmap。
* @param scale 缩放比例,对创建的 Bitmap 进行缩放,数值支持从 0 到 1。
*/
public static Bitmap createBitmapFromView(View view, float scale) {
if (view instanceof ImageView) {
Drawable drawable = ((ImageView) view).getDrawable();
if (drawable != null && drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
}
view.clearFocus();
Bitmap bitmap = createBitmapSafely((int) (view.getWidth() * scale),
(int) (view.getHeight() * scale), Bitmap.Config.ARGB_8888, 1);
if (bitmap != null) {
synchronized (sCanvas) {
Canvas canvas = sCanvas;
canvas.setBitmap(bitmap);
canvas.save();
canvas.drawColor(Color.WHITE); // 防止 View 上面有些区域空白导致最终 Bitmap 上有些区域变黑
canvas.scale(scale, scale);
view.draw(canvas);
canvas.restore();
canvas.setBitmap(null);
}
}
return bitmap;
}
public static Bitmap createBitmapFromView(View view) {
return createBitmapFromView(view, 1f);
}
/**
* 从一个view创建Bitmap。把view的区域截掉leftCrop/topCrop/rightCrop/bottomCrop
*/
public static Bitmap createBitmapFromView(View view, int leftCrop, int topCrop, int rightCrop, int bottomCrop) {
Bitmap originBitmap = createBitmapFromView(view);
if (originBitmap == null) {
return null;
}
Bitmap cutBitmap = createBitmapSafely(view.getWidth() - rightCrop - leftCrop, view.getHeight() - topCrop - bottomCrop, Bitmap.Config.ARGB_8888, 1);
if (cutBitmap == null) {
return null;
}
Canvas canvas = new Canvas(cutBitmap);
Rect src = new Rect(leftCrop, topCrop, view.getWidth() - rightCrop, view.getHeight() - bottomCrop);
Rect dest = new Rect(0, 0, view.getWidth() - rightCrop - leftCrop, view.getHeight() - topCrop - bottomCrop);
canvas.drawColor(Color.WHITE); // 防止 View 上面有些区域空白导致最终 Bitmap 上有些区域变黑
canvas.drawBitmap(originBitmap, src, dest, null);
originBitmap.recycle();
return cutBitmap;
}
/**
* 安全的创建bitmap。
* 如果新建 Bitmap 时产生了 OOM,可以主动进行一次 GC - System.gc(),然后再次尝试创建。
*
* @param width Bitmap 宽度。
* @param height Bitmap 高度。
* @param config 传入一个 Bitmap.Config。
* @param retryCount 创建 Bitmap 时产生 OOM 后,主动重试的次数。
* @return 返回创建的 Bitmap。
*/
public static Bitmap createBitmapSafely(int width, int height, Bitmap.Config config, int retryCount) {
try {
return Bitmap.createBitmap(width, height, config);
} catch (OutOfMemoryError e) {
e.printStackTrace();
if (retryCount > 0) {
System.gc();
return createBitmapSafely(width, height, config, retryCount - 1);
}
return null;
}
}
/**
* 创建一张指定大小的纯色图片,支持圆角
*
* @param resources Resources对象,用于创建BitmapDrawable
* @param width 图片的宽度
* @param height 图片的高度
* @param cornerRadius 图片的圆角,不需要则传0
* @param filledColor 图片的填充色
* @return 指定大小的纯色图片
*/
public static BitmapDrawable createDrawableWithSize(Resources resources, int width, int height, int cornerRadius, @ColorInt int filledColor) {
Bitmap output = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
if (filledColor == 0) {
filledColor = Color.TRANSPARENT;
}
if (cornerRadius > 0) {
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL);
paint.setColor(filledColor);
canvas.drawRoundRect(new RectF(0, 0, width, height), cornerRadius, cornerRadius, paint);
} else {
canvas.drawColor(filledColor);
}
return new BitmapDrawable(resources, output);
}
/**
* 设置Drawable的颜色
* <b>这里不对Drawable进行mutate(),会影响到所有用到这个Drawable的地方,如果要避免,请先自行mutate()</b>
*/
public static ColorFilter setDrawableTintColor(Drawable drawable, @ColorInt int tintColor) {
LightingColorFilter colorFilter = new LightingColorFilter(Color.argb(255, 0, 0, 0), tintColor);
drawable.setColorFilter(colorFilter);
return colorFilter;
}
/**
* 由一个drawable生成bitmap
*/
public static Bitmap drawableToBitmap(Drawable drawable) {
if (drawable == null)
return null;
else if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
int intrinsicWidth = drawable.getIntrinsicWidth();
int intrinsicHeight = drawable.getIntrinsicHeight();
if (!(intrinsicWidth > 0 && intrinsicHeight > 0))
return null;
try {
Bitmap bitmap = Bitmap.createBitmap(intrinsicWidth, intrinsicHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
} catch (OutOfMemoryError e) {
return null;
}
}
/**
* 创建一张渐变图片,支持韵脚。
*
* @param startColor 渐变开始色
* @param endColor 渐变结束色
* @param radius 圆角大小
* @param centerX 渐变中心点 X 轴坐标
* @param centerY 渐变中心点 Y 轴坐标
* @return 返回所创建的渐变图片。
*/
@TargetApi(16)
public static GradientDrawable createCircleGradientDrawable(@ColorInt int startColor,
@ColorInt int endColor, int radius,
@FloatRange(from = 0f, to = 1f) float centerX,
@FloatRange(from = 0f, to = 1f) float centerY) {
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setColors(new int[]{
startColor,
endColor
});
gradientDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
gradientDrawable.setGradientRadius(radius);
gradientDrawable.setGradientCenter(centerX, centerY);
return gradientDrawable;
}
/**
* 动态创建带上分隔线或下分隔线的Drawable。
*
* @param separatorColor 分割线颜色。
* @param bgColor Drawable 的背景色。
* @param top true 则分割线为上分割线,false 则为下分割线。
* @return 返回所创建的 Drawable。
*/
public static LayerDrawable createItemSeparatorBg(@ColorInt int separatorColor, @ColorInt int bgColor, int separatorHeight, boolean top) {
ShapeDrawable separator = new ShapeDrawable();
separator.getPaint().setStyle(Paint.Style.FILL);
separator.getPaint().setColor(separatorColor);
ShapeDrawable bg = new ShapeDrawable();
bg.getPaint().setStyle(Paint.Style.FILL);
bg.getPaint().setColor(bgColor);
Drawable[] layers = {separator, bg};
LayerDrawable layerDrawable = new LayerDrawable(layers);
layerDrawable.setLayerInset(1, 0, top ? separatorHeight : 0, 0, top ? 0 : separatorHeight);
return layerDrawable;
}
/////////////// VectorDrawable /////////////////////
@SuppressLint("RestrictedApi")
public static
@Nullable
Drawable getVectorDrawable(Context context, @DrawableRes int resVector) {
try {
return AppCompatDrawableManager.get().getDrawable(context, resVector);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Bitmap vectorDrawableToBitmap(Context context, @DrawableRes int resVector) {
Drawable drawable = getVectorDrawable(context, resVector);
if (drawable != null) {
Bitmap b = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
drawable.setBounds(0, 0, c.getWidth(), c.getHeight());
drawable.draw(c);
return b;
}
return null;
}
/////////////// VectorDrawable /////////////////////
}
| [
"[email protected]"
] | |
5514c31909a1d3f775e2a56529798a095a439bd5 | 463cc04423def1f47f1e7ea31750244916f27631 | /PracticeApplication/javase/src/main/java/wxj/me/javase/concurrency/exercise/E5Callable.java | 03f8f54f69e3b5202a44d59ec289558f0fa5ce6d | [] | no_license | wangxuejiaome/LearningNotes | 89df50eff6c57a7c64350ee0d17399e2e63f7dbf | bf90cd5536dbb40240e379c2a8317a856798da23 | refs/heads/master | 2022-03-09T08:25:44.367008 | 2022-02-17T03:00:45 | 2022-02-17T03:00:45 | 140,399,320 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,488 | java | package wxj.me.javase.concurrency.exercise;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
class FibonacciSeqCallable implements Callable<Integer> {
public static int count;
public final int id = ++count;
public int n;
public FibonacciSeqCallable(int n) {
this.n = n;
}
public int fibonacciSeq(int n) {
if (n < 2) {
return n;
} else {
return fibonacciSeq(n - 1) + fibonacciSeq(n - 2);
}
}
@Override
public Integer call() {
return fibonacciSeq(n);
}
}
public class E5Callable {
public static void main(String[] args) {
ExecutorService executorService = Executors.newCachedThreadPool();
List<Future<Integer>> futures = new ArrayList<>();
for (int i = 0; i < 10; i++) {
futures.add(executorService.submit(new FibonacciSeqCallable(i)));
}
for (Future<Integer> future : futures){
try {
System.out.println(future.get());
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} finally {
executorService.shutdown();
}
}
}
}
| [
"12W15X92J"
] | 12W15X92J |
c485471d9ab2ebf3fb09f62ce297e2eeda58bc8f | 5b8f0cbd2076b07481bd62f26f5916d09a050127 | /src/B1358.java | d92af6a49632539adac8800efc42d7add5cba6d7 | [] | no_license | micgogi/micgogi_algo | b45664de40ef59962c87fc2a1ee81f86c5d7c7ba | 7cffe8122c04059f241270bf45e033b1b91ba5df | refs/heads/master | 2022-07-13T00:00:56.090834 | 2022-06-15T14:02:51 | 2022-06-15T14:02:51 | 209,986,655 | 7 | 3 | null | 2020-10-20T07:41:03 | 2019-09-21T13:06:43 | Java | UTF-8 | Java | false | false | 976 | java | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Arrays;
/**
* @author Micgogi
* on 7/1/2020 5:32 PM
* Rahul Gogyani
*/
public class B1358 {
public static void main(String[] args) {
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
while(t--!=0){
int n = Integer.parseInt(br.readLine());
int a[];
String s[] = br.readLine().split(" ");
a = Arrays.stream(s).mapToInt(Integer::parseInt).toArray();
Arrays.sort(a);
System.out.println(ans(a));
}
}catch (Exception e){
}
}
public static int ans(int a[]){
for (int i = a.length-1; i >=0 ; i--) {
if(a[i]<=i+1){
return i+2;
}
}
return 1;
}
}
| [
"[email protected]"
] | |
dd930d6affbf84f130f0e836a71160741b7f2411 | a504fe39e5999c60eb6c8cf5091ae2514c8d9cd0 | /src/main/java/eu/zomtec/em2012/updater/League.java | c5a57f2676e097ab8190912bf74afaa5729beb54 | [
"MIT"
] | permissive | z0mt3c/euro-bet | 13375c461cc02da2ffad9be97f82c10e4fee1bd7 | 46eb36042c36a8b7a1751904419688dd5695fb49 | refs/heads/master | 2021-06-02T22:26:07.163797 | 2018-06-19T07:58:23 | 2018-06-19T07:58:23 | 20,211,198 | 0 | 1 | null | 2018-06-19T07:58:24 | 2014-05-27T07:36:23 | AspectJ | UTF-8 | Java | false | false | 763 | java | package eu.zomtec.em2012.updater;
import java.util.Date;
import java.util.Map;
public class League {
private boolean tournament;
private Long leagueId;
private Date timestamp;
private Map<Long, Match> matches;
public boolean isTournament() {
return tournament;
}
public void setTournament(boolean tournament) {
this.tournament = tournament;
}
public Long getLeagueId() {
return leagueId;
}
public void setLeagueId(Long leagueId) {
this.leagueId = leagueId;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public Map<Long, Match> getMatches() {
return matches;
}
public void setMatches(Map<Long, Match> matches) {
this.matches = matches;
}
}
| [
"[email protected]"
] | |
bbc4b5def926e4896a4972933f5303a8d6a16e0b | 24487cdfa5a41d5a5c969ba5002cb49454ff8420 | /src/main/java/com/jgw/supercodeplatform/project/zaoyangpeach/service/FarmInfoService.java | c38ec460bd3fb175375a3b3e4711d2baa4d83846 | [] | no_license | jiangtingfeng/tttttttttttttttttttttttttttttttttttttt | 3d85a515c5d229d6b6d44bcab93a1ba24cb162a9 | 7f7dee932a084d54c469d24792e2b3429379a9d9 | refs/heads/master | 2022-10-09T06:02:47.823332 | 2019-07-03T10:56:07 | 2019-07-03T10:56:07 | 197,173,501 | 0 | 0 | null | 2022-10-04T23:53:25 | 2019-07-16T10:33:04 | Java | UTF-8 | Java | false | false | 1,485 | java | package com.jgw.supercodeplatform.project.zaoyangpeach.service;
import com.jgw.supercodeplatform.trace.common.model.ObjectUniqueValueResult;
import com.jgw.supercodeplatform.trace.common.model.ReturnParamsMap;
import com.jgw.supercodeplatform.trace.common.model.page.AbstractPageService;
import com.jgw.supercodeplatform.trace.dao.mapper1.zaoyangpeach.FarmInfoMapper;
import com.jgw.supercodeplatform.trace.pojo.zaoyangpeach.FarmInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class FarmInfoService extends AbstractPageService {
@Autowired
private FarmInfoMapper farmInfoMapper;
public Map<String, Object> listFarmInfo(Map<String, Object> map) throws Exception {
ReturnParamsMap returnParamsMap=null;
Map<String, Object> dataMap=null;
Integer total=null;
total=farmInfoMapper.getCountByCondition(map);
returnParamsMap = getPageAndRetuanMap(map, total);
List<FarmInfo> testingTypes= farmInfoMapper.selectFarmInfo(map);
List<ObjectUniqueValueResult> objectUniqueValueResults= testingTypes.stream().map(e->new ObjectUniqueValueResult(String.valueOf(e.getId()),e.getFarmName())).collect(Collectors.toList());
dataMap = returnParamsMap.getReturnMap();
getRetunMap(dataMap, objectUniqueValueResults);
return dataMap;
}
}
| [
"[email protected]"
] | |
2a9a38ae1c4f11a9dbab3688bd13d08a7f40eb13 | 3e7f810ec56e88abdcdf75c0d58a84a0526ab2c5 | /src/main/java/com/wq/xxx/utils/date/DateUtil.java | 7d03089186733b8efe7d9dd2fc66ca40814702e1 | [] | no_license | siyawu/commonUtils | 3eec0c38fa54d815fda71e112aa51b5a489b34b3 | 60ae46d2dbd2ebbf02bda51381366df5ab7cd50d | refs/heads/master | 2023-04-13T17:19:50.957531 | 2022-02-07T11:00:03 | 2022-02-07T11:00:03 | 148,906,942 | 0 | 0 | null | 2023-03-27T22:22:04 | 2018-09-15T14:01:52 | FreeMarker | UTF-8 | Java | false | false | 19,068 | java | package com.wq.xxx.utils.date;
import com.wq.xxx.utils.StringUtil;
import org.apache.commons.lang.time.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Jason on 2017/11/22.
*/
public class DateUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(DateUtil.class);
//可能出现的时间格式
private static final String[] patterns = {
"yyyy-MM-dd HH:mm:ss",
"yyyy-MM-dd HH:mm",
"yyyy/MM/dd HH:mm:ss",
"yyyy/MM/dd HH:mm",
"yyyy年MM月dd日",
"yyyy-MM-dd",
"yyyy/MM/dd",
"yyyyMMdd"
};
/**
* 格式化日期
*
* @param format 日期格式模板 yyyy-MM-dd yyyy/MM/dd
* @param date 日期
*/
public static String formatStr(String format, Date date) {
if (null != date && !StringUtil.isNullOrEmpty(format)) {
SimpleDateFormat simpleFormat = new SimpleDateFormat(format);
return simpleFormat.format(date);
}
return StringUtil.EMPTY;
}
/**
* 格式化日期
*
* @param format 日期格式模板 yyyy-MM-dd yyyy/MM/dd
* @param date 日期
*/
public static Date formatDate(String format, Date date) throws ParseException {
if (null != date && !StringUtil.isNullOrEmpty(format)) {
SimpleDateFormat simpleFormat = new SimpleDateFormat(format);
String dateStr = simpleFormat.format(date);
return simpleFormat.parse(dateStr);
}
return date;
}
/**
* 格式化日期
*
* @param format 日期格式模板
* @param strDate 日期
*/
public static Date parse(String format, String strDate) throws ParseException {
if (null != strDate && !StringUtil.isNullOrEmpty(format)) {
SimpleDateFormat simpleFormat = new SimpleDateFormat(format);
return simpleFormat.parse(strDate);
}
return null;
}
/**
* @param inputDate 要解析的字符串
* @return 解析出来的日期,如果没有匹配的返回null
*/
public static Date parseDate(String inputDate) {
SimpleDateFormat df = new SimpleDateFormat();
for (String pattern : patterns) {
df.applyPattern(pattern);
df.setLenient(false);//设置解析日期格式是否严格解析日期
ParsePosition pos = new ParsePosition(0);
Date date = df.parse(inputDate, pos);
if (date != null) {
return date;
}
}
return null;
}
/**
* 获取标准日期,忽略时间 yyyy-MM-dd
*
* @param date 原始日期
* @return 处理后的日期
*/
public static Date getNormalDate(Date date) throws ParseException {
return formatDate(DatePattern.NORM_DATE_FORMAT, date);
}
/**
* 获取标准日期,忽略时间 yyyy-MM-dd
*
* @param date 原始日期
* @return 处理后的日期
*/
public static Date getNormalDate(String date) throws ParseException {
return parse(DatePattern.NORM_DATE_FORMAT, date);
}
/**
* 转换字符串为标准日期+时间 yyyy-MM-dd HH:mm:ss
*
* @param date 原始日期
* @return 处理后的日期
*/
public static Date getNormalDateTime(String date) throws ParseException {
return parse(DatePattern.NORM_DATETIME_FORMAT, date);
}
/**
* 获取月份标识
*
* @param date 日期
* @return 月份
*/
public static Integer getDataMonthNumber(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.MONTH) + 1;
}
/**
* 转换格式 yyyyMM
*
* @param date 日期
* @return
*/
public static Integer getSimpleMonth(Date date) {
String month = formatStr(DatePattern.SIMPLE_MONTH_FORMAT, date);
return Integer.parseInt(month);
}
/**
* 转换格式 yyyyMMdd
*
* @param date 日期
* @return
*/
public static Integer getSimpleDate(Date date) {
if (date == null) {
return -1;
}
String month = formatStr(DatePattern.SIMPLE_DATE_FORMAT, date);
return Integer.parseInt(month);
}
/**
* 转换格式 yyyyMMdd
*
* @param date 日期
* @return
*/
public static Date getSimpleDate(Integer date, Date defaultDate) throws ParseException {
if (date == null) {
return defaultDate;
}
return parse(DatePattern.SIMPLE_DATE_FORMAT, String.valueOf(date));
}
/**
* 转换格式 yyyyMM
*
* @param date
* @param defaultDate
* @return
*/
public static Date getSimpleMonth(Integer date, Date defaultDate) throws ParseException {
if (date == null) {
return defaultDate;
}
return parse(DatePattern.SIMPLE_MONTH_FORMAT, String.valueOf(date));
}
/**
* 格式转换 yyyyMMdd
*
* @param date 数字格式
* @return 日期格式
*/
public static Date getSimpleDate(Integer date) throws ParseException {
return parse(DatePattern.SIMPLE_DATE_FORMAT, String.valueOf(date));
}
public static boolean timeMatch(Date startTime, Date endTime, Date targetStartTime, Date targetEndTime) {
return (targetStartTime.compareTo(startTime) <= 0 && targetEndTime.compareTo(startTime) >= 0)
|| (targetStartTime.compareTo(endTime) <= 0 && targetEndTime.compareTo(endTime) >= 0)
|| (targetStartTime.compareTo(startTime) >= 0 && targetEndTime.compareTo(endTime) <= 0);
}
/**
* 格式化日期(当前时间)
*
* @param format 日期格式模板
*/
public static String formatNow(String format) {
return formatStr(format, new Date());
}
/**
* 获取日期之间天数差
*
* @param lessDate
* @param bigDate
* @return
*/
public static Integer daysBetween(Date lessDate, Date bigDate) {
if (null == lessDate || null == bigDate) {
return 0;
}
Calendar cNow = Calendar.getInstance();
Calendar cReturnDate = Calendar.getInstance();
cNow.setTime(lessDate);
cReturnDate.setTime(bigDate);
setTimeToMidnight(cNow);
setTimeToMidnight(cReturnDate);
Long todayMs = cNow.getTimeInMillis();
Long returnMs = cReturnDate.getTimeInMillis();
long intervalMs = Math.abs(todayMs - returnMs);
long days = (intervalMs / (1000 * 86400));
return (int) days;
}
public static boolean sameDate(Date d1, Date d2) {
LocalDate localDate1 = ZonedDateTime.ofInstant(d1.toInstant(), ZoneId.systemDefault()).toLocalDate();
LocalDate localDate2 = ZonedDateTime.ofInstant(d2.toInstant(), ZoneId.systemDefault()).toLocalDate();
return localDate1.isEqual(localDate2);
}
/**
* 获取日期之间小时差
*
* @param lessDate
* @param bigDate
* @return
*/
public static Double hourBetween(Date lessDate, Date bigDate) {
if (null == lessDate || null == bigDate) {
return 0D;
}
Calendar cNow = Calendar.getInstance();
Calendar cReturnDate = Calendar.getInstance();
cNow.setTime(lessDate);
cReturnDate.setTime(bigDate);
long todayMs = cNow.getTimeInMillis();
long returnMs = cReturnDate.getTimeInMillis();
long intervalMs = Math.abs(todayMs - returnMs);
return intervalMs / (1000 * 3600.0);
}
private static void setTimeToMidnight(Calendar calendar) {
changeTimeDetail(calendar, 0, 0);
}
/**
* 获取给定日期所在的年
*
* @param dateTime 给定的日期
* @return yyyy
*/
public static int getYearByDate(Date dateTime) {
Calendar cal = Calendar.getInstance();
cal.setTime(dateTime);
return cal.get(Calendar.YEAR);
}
/**
* 获取昨天日期
*
* @return
*/
public static Date getYesterday() {
return getYesterday(null);
}
/**
* 获取昨天日期
*
* @return
*/
public static Date getYesterday(Date date) {
Calendar cNow = Calendar.getInstance();
//获取前一天
cNow.setTime(date == null ? new Date() : date);
cNow.add(Calendar.DAY_OF_MONTH, -1);
return cNow.getTime();
}
public static Date addDay(Date date) {
int amount = 1;
return addDay(date, amount, Calendar.DAY_OF_MONTH);
}
public static Date addDay(Date date, int amount, int dayOfMonth) {
Calendar cNow = Calendar.getInstance();
cNow.setTime(date);
cNow.add(dayOfMonth, amount);
return cNow.getTime();
}
/**
* 是否是月初第一天
*
* @param date 日期
* @return
*/
public static boolean monthStart(Date date) {
Calendar cNow = Calendar.getInstance();
cNow.setTime(date);
int day = cNow.get(Calendar.DAY_OF_MONTH);
int first = cNow.getMinimum(Calendar.DAY_OF_MONTH);
return day == first;
}
/**
* 获取今天结束
*
* @return 结束
*/
public static String getCurrentDayEnd() {
Calendar cNow = Calendar.getInstance();
changeTimeDetail(cNow, 0, 0);
return Long.toString(cNow.getTimeInMillis());
}
private static void changeTimeDetail(Calendar cNow, int dayHour, int minute) {
cNow.set(Calendar.HOUR_OF_DAY, dayHour);
cNow.set(Calendar.MINUTE, minute);
cNow.set(Calendar.SECOND, minute);
cNow.set(Calendar.MILLISECOND, 0);
}
public static Date changeTimeDetail(Date date, int dayHour, int minute) {
Calendar cNow = Calendar.getInstance();
cNow.setTime(date);
changeTimeDetail(cNow, dayHour, minute);
return cNow.getTime();
}
/**
* 获取gps对接时间
*
* @param currentDate 数据日期
* @param forEnd 是否获取结束时间(结束时间日期往后延一天)
* @return gps对接时间
*/
public static Date convertToGpsDockTime(Date currentDate, boolean forEnd) {
Calendar cNow = Calendar.getInstance();
cNow.setTime(currentDate);
if (forEnd) {
//如果是结束时间则时间跳转到次日
cNow.add(Calendar.DAY_OF_MONTH, 1);
}
changeTimeDetail(cNow, 0, 0);
return cNow.getTime();
}
/**
* 获取月份最后一天
*
* @param reportMonth
* @return
*/
public static Date getEndOfMonth(Date reportMonth) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(reportMonth);
calendar.set(Calendar.DAY_OF_MONTH, 1);
changeTimeDetail(calendar, 0, 0);
calendar.add(Calendar.MONTH, 1);
calendar.add(Calendar.SECOND, -1);
return calendar.getTime();
}
/**
* 获取月份第一天
*
* @param reportMonth
* @return
*/
public static Date getStartOfMonth(Date reportMonth) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(reportMonth);
calendar.set(Calendar.DAY_OF_MONTH, 1);
changeTimeDetail(calendar, 0, 0);
return calendar.getTime();
}
public static Date getStartOfYear(Date reportMonth) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(reportMonth);
calendar.set(Calendar.DAY_OF_YEAR, 1);
changeTimeDetail(calendar, 0, 0);
return calendar.getTime();
}
/**
* 获取一天的开始时间
*
* @param date 日期
* @return 当天的最后时间
*/
public static Date getStartOfDay(Date date) throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat(DatePattern.NORM_DATE_FORMAT);
String endStr = dateFormat.format(date) + " 00:00:00";
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(endStr);
}
/**
* 获取一天的结束时间
*
* @param date 日期
* @return 当天的最后时间
*/
public static Date getEndOfDay(Date date) throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat(DatePattern.NORM_DATE_FORMAT);
String endStr = dateFormat.format(date) + " 23:59:59";
return new SimpleDateFormat(DatePattern.NORM_DATETIME_FORMAT).parse(endStr);
}
public static boolean isTimeFormat(String timeSting) {
String regExp = "([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$";
return checkFormat(timeSting, regExp);
}
public static boolean isMonthFormat(String timeSting) {
String regExp = "(?!0000)[0-9]{4}-((0[1-9]|1[0-2]))$";
return checkFormat(timeSting, regExp);
}
public static boolean checkFormat(String timeSting, String regExp) {
if (timeSting == null) {
return false;
}
Pattern p = Pattern.compile(regExp);
Matcher m = p.matcher(timeSting);
return m.matches();
}
/**
* 时间加减
*
* @param date 时间
* @param field 加减字段
* @param amount 加减值
* @return 处理后日期
*/
public static Date timeAdd(Date date, int field, int amount) {
return addDay(date, amount, field);
}
/**
* 获取今天结束
*
* @return 结束
*/
public static String getFileDataTag() {
Calendar cNow = Calendar.getInstance();
return formatStr(DatePattern.SIMPLE_DATETIME_MS_FORMAT, cNow.getTime());
}
//获取两个时间点最小的时间
public static Date getLatestDate(Date firstDate, Date secondDate) {
//无法比较返回null
if (Objects.isNull(firstDate) || Objects.isNull(secondDate)) {
return null;
}
return 0 > firstDate.compareTo(secondDate) ? firstDate : secondDate;
}
public static List<String> getYearMonthDayList(Date startTime, Date endTime, String formatted) {
return getDateForMatList(startTime, endTime, formatted, calendar -> calendar.add(Calendar.DAY_OF_MONTH, 1));
}
/**
* 获取一天所在月份的所有日期
*
* @param date
* @return
*/
public static List<String> getYearMonthDayList(Date date) {
Date startOfDay = DateUtil.getStartOfMonth(date);
Date endOfMonth = DateUtil.getEndOfMonth(date);
return getYearMonthDayList(startOfDay, endOfMonth);
}
/**
* 获取两个时间的日期列表 yyyy-MM-dd
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
public static List<String> getYearMonthDayList(Date startTime, Date endTime) {
return getYearMonthDayList(startTime, endTime, DatePattern.NORM_DATE_FORMAT);
}
/**
* 获取两个时间的年月列表 yyyyMM
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
public static List<String> calcYearMonthList(Date startTime, Date endTime) {
return getDateForMatList(startTime, endTime, DatePattern.SIMPLE_MONTH_FORMAT,
calendar -> calendar.add(Calendar.MONTH, 1));
}
/**
* 获取两个时间的年列表 yyyy
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
public static List<String> calcYearList(Date startTime, Date endTime) {
return getDateForMatList(startTime, endTime, DatePattern.YEAR_FORMAT, calendar -> calendar.add(Calendar.YEAR, 1));
}
public static List<String> getDateForMatList(Date startTime, Date endTime, String formatString,
Consumer<Calendar> nextConsumer) {
List<String> dateList = new ArrayList<>();
if (Objects.isNull(startTime) || Objects.isNull(endTime)) {
return dateList;
}
Date calcStartTime;
Date calcEndTime;
if (startTime.compareTo(endTime) < 0) {
calcStartTime = startTime;
calcEndTime = endTime;
} else {
calcStartTime = endTime;
calcEndTime = startTime;
}
Calendar calendarStart = Calendar.getInstance();
calendarStart.setTime(calcStartTime);
calendarStart.set(Calendar.HOUR_OF_DAY, 0);
calendarStart.set(Calendar.MINUTE, 0);
calendarStart.set(Calendar.SECOND, 0);
Calendar calendarEnd = Calendar.getInstance();
calendarEnd.setTime(calcEndTime);
calendarEnd.set(Calendar.HOUR_OF_DAY, 23);
calendarEnd.set(Calendar.MINUTE, 59);
calendarEnd.set(Calendar.SECOND, 59);
while (calendarStart.compareTo(calendarEnd) <= 0) {
dateList.add(DateUtil.formatStr(formatString, calendarStart.getTime()));
nextConsumer.accept(calendarStart);
}
return dateList;
}
/**
* 比较两个日期,按天比较(不考虑时间)
*
* @param srcDate 源日期
* @param desDate 目标日期
* @return srcDate>desDate 1, srcDate==desDate 0 ,stcDate<DesDate -1
*/
public static int compareDateByDay(Date srcDate, Date desDate) {
if (srcDate == null) {
if (desDate == null) {
return 0;
} else {
return -1;
}
} else {
if (desDate == null) {
return 1;
} else {
srcDate = changeTimeDetail(srcDate, 0, 0);
desDate = changeTimeDetail(desDate, 0, 0);
return DateUtils.isSameDay(srcDate, desDate) ? 0 : srcDate.compareTo(desDate);
}
}
}
public static boolean isInDateRange(Date checkDate, Date startDate, Date endDate) {
if (Objects.isNull(checkDate)) {
checkDate = new Date();
}
List<String> rangeDateList = getYearMonthDayList(startDate, endDate);
return rangeDateList.contains(formatStr(DatePattern.NORM_DATE_FORMAT, checkDate));
}
/**
* yyyyMMddHHmmssSSS
*
* @return {@link String}
*/
public static String getSecondTimeStr() {
return formatStr(DatePattern.SIMPLE_DATETIME_MS_FORMAT, new Date());
}
} | [
"[email protected]"
] | |
58514ab2f0daa057402e3a2b01bf305505322e6b | 605a14887506b9d68d7b5a38d12a7c7aded9a024 | /labs/lab03/lab03/src/exec04/GenericPhone.java | d1bb24409b5fbf5e350440d2d9d57e6ae113b1a7 | [] | no_license | eduardohferreiras/ces28_2017_eduardo.silva | 6ad70927f147468a0d652b5e273bbcf4eae7f862 | 2cb8ccd946700119c55a05e73fc9626aae448061 | refs/heads/master | 2021-01-16T19:49:13.080470 | 2017-11-27T21:40:02 | 2017-11-27T21:40:02 | 100,188,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | java | package exec04;
import java.util.HashMap;
public class GenericPhone {
GenericPhone(int areaCode, int number)
{
areaCode_ = areaCode;
number_ = number;
}
protected int areaCode_;
protected int number_;
public String toPrint() {
return null;
}
public GenericPhone getSpecificPhone(String idiom)
{
if(idiom.equals("EN_US"))
{
return new EN_USPPhone(areaCode_, number_);
}
else if(idiom.equals("PT_BR"))
{
return new PT_BRPhone1(areaCode_, number_);
}
else return null;
}
}
| [
"[email protected]"
] | |
93238d75ba3330ccd47ac28aaf2c039129f87567 | 9e4494c107ebf0c7fb1d2d6b4ef012f4a056df1a | /Dineout-Search/src/main/java/com/dineout/search/service/YouMayLikeRecommendationService.java | fda472d07b2b925273032fa1d75a822c24300d17 | [] | no_license | krishan111284/Test | e7fd873f0e25cf798f45da011caf35edc9ddbbd7 | b44d22bbc7a15d4393dee7d3bd01904086efb266 | refs/heads/master | 2021-01-17T07:43:24.877367 | 2016-04-27T14:00:07 | 2016-04-27T14:00:07 | 17,359,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,430 | java | package com.dineout.search.service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.log4j.Logger;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dineout.search.exception.ErrorCode;
import com.dineout.search.exception.SearchError;
import com.dineout.search.exception.SearchErrors;
import com.dineout.search.query.DORestQueryCreator;
import com.dineout.search.query.QueryParam;
import com.dineout.search.query.RecommendationQueryCreator;
import com.dineout.search.request.RecommendationRequest;
import com.dineout.search.response.DORecoResult;
import com.dineout.search.server.SolrConnectionUtils;
@Service("youMayLikeRecommendationService")
public class YouMayLikeRecommendationService implements RecommendationService{
Logger logger = Logger.getLogger(YouMayLikeRecommendationService.class);
@Autowired
RecommendationQueryCreator recommendationQueryCreator;
@Autowired
DORestQueryCreator restQueryCreator;
@Autowired
SolrConnectionUtils solrConnectionUtils;
@Autowired
SimilarVisitedRecommendationService similarVisitedRecommendationService;
@SuppressWarnings("unchecked")
@Override
public List<DORecoResult> getRecommendedResults(RecommendationRequest request, SearchErrors errors) {
QueryParam doqp = null;
QueryResponse qres = null;
List<DORecoResult> finalresultList = new ArrayList<DORecoResult>();
try {
String[] restaurantIds = null;
SolrServer server = solrConnectionUtils.getDinerSolrServer();
doqp = recommendationQueryCreator.getDinerIdSearchQuery(request);
qres = server.query(doqp);
if(qres!=null){
Iterator<SolrDocument> resultIterator = qres.getResults().iterator();
while(resultIterator.hasNext()){
SolrDocument solrDoc = resultIterator.next();
if(solrDoc.get("restaurants_booked")!=null)
restaurantIds = ((List<DORecoResult>) solrDoc.get("restaurants_booked")).toArray(new String[0]);
}
}
if(restaurantIds!=null && restaurantIds.length>0){
DORecoResult result = getRecommendedRestaurants(request,restaurantIds,errors);
finalresultList.add(result);
}
} catch (SolrServerException e) {
logger.error(e.getMessage(),e);
SearchError error = new SearchError(ErrorCode.SOLR_ERROR_CODE, e.getMessage());
errors.add(error);
}catch (Exception e) {
logger.error(e.getMessage(),e);
SearchError error = new SearchError(ErrorCode.SOLR_ERROR_CODE, e.getMessage());
errors.add(error);
}
return finalresultList;
}
private DORecoResult getRecommendedRestaurants(RecommendationRequest request, String[] restaurantIds, SearchErrors errors) {
List<Map<Object, Object>> resultList = new ArrayList<Map<Object,Object>>();
request.setRestIds(restaurantIds);
for (String restId: restaurantIds) {
request.setRestId(restId);
List<DORecoResult> result = similarVisitedRecommendationService.getRecommendedResults(request, errors);
for (Map<Object, Object> map : result.get(0).getDocs()) {
resultList.add(map);
}
}
Map<Integer,Integer> countMap = new HashMap<Integer, Integer>();
for(Map<Object,Object> m:resultList){
Integer count = countMap.get(m.get("r_id"));
if(count==null){
Integer newCount = new Integer(1);
Integer id = (Integer)m.get("r_id");
countMap.put(id,newCount);
continue;
}
count++;
}
Map<Map<Object,Object>,Integer> uniqueMap = new HashMap<Map<Object,Object>, Integer>();
for(Map<Object,Object> m:resultList){
Integer count = countMap.remove(m.get("r_id"));
if(count!=null){
uniqueMap.put(m, count);
}
}
List<Entry<Map<Object, Object>, Integer>> listOfSortedResults = sortByValue(uniqueMap);
List<Map<Object, Object>> result = new ArrayList<Map<Object,Object>>();
for(Entry<Map<Object, Object>, Integer> entry:listOfSortedResults){
result.add(entry.getKey());
}
DORecoResult finalResult = new DORecoResult();
finalResult.setDocs(new ArrayList<Map<Object,Object>>(result).subList(0, 10));
return finalResult;
}
public static List<Map.Entry<Map<Object,Object>, Integer>>
sortByValue( Map<Map<Object,Object>, Integer> map ){
List<Map.Entry<Map<Object,Object>, Integer>> list =
new LinkedList<>( map.entrySet() );
Collections.sort( list, new Comparator<Map.Entry<Map<Object,Object>, Integer>>(){
@Override
public int compare( Map.Entry<Map<Object,Object>, Integer> o1, Map.Entry<Map<Object,Object>, Integer> o2 )
{
return ((Float) o1.getKey().get("eucledianDistance")).compareTo((Float) o2.getKey().get("eucledianDistance"));
}
} );
Collections.sort( list, new Comparator<Map.Entry<Map<Object,Object>, Integer>>(){
@Override
public int compare( Map.Entry<Map<Object,Object>, Integer> o1, Map.Entry<Map<Object,Object>, Integer> o2 )
{
return (o1.getValue()).compareTo(o2.getValue());
}
} );
return list;
}
}
| [
"[email protected]"
] | |
8c19584cb731a7d51ff93df0cbc970d28f0645a5 | 451a88553fd93a3d5364cf7323f8344c4eec50ed | /src/main/java/io/swagger/client/model/ClusterMetadataPortInfo.java | 4fa2342d972b7bdcd96eccc997f4cdd3a6caf280 | [
"Apache-2.0"
] | permissive | aravindputrevu/ess-cloud-sdk-java | c5bbc15b15f1eaf4c799e9687db683548f7bb82b | d6abda92d896fd41ace86802158d4d5c497299b6 | refs/heads/master | 2022-09-09T04:01:00.777907 | 2020-06-03T10:08:57 | 2020-06-03T10:08:57 | 249,352,663 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,183 | java | /*
* Elastic Cloud API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.IOException;
/**
* Information about the ports that allow communication between the Elasticsearch cluster and various protocols.
*/
@Schema(description = "Information about the ports that allow communication between the Elasticsearch cluster and various protocols.")
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2020-03-10T16:33:30.970+05:30[Asia/Kolkata]")
public class ClusterMetadataPortInfo {
@SerializedName("http")
private Integer http = null;
@SerializedName("https")
private Integer https = null;
public ClusterMetadataPortInfo http(Integer http) {
this.http = http;
return this;
}
/**
* Port where the cluster listens for HTTP traffic
* @return http
**/
@Schema(required = true, description = "Port where the cluster listens for HTTP traffic")
public Integer getHttp() {
return http;
}
public void setHttp(Integer http) {
this.http = http;
}
public ClusterMetadataPortInfo https(Integer https) {
this.https = https;
return this;
}
/**
* Port where the cluster listens for HTTPS traffic
* @return https
**/
@Schema(required = true, description = "Port where the cluster listens for HTTPS traffic")
public Integer getHttps() {
return https;
}
public void setHttps(Integer https) {
this.https = https;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ClusterMetadataPortInfo clusterMetadataPortInfo = (ClusterMetadataPortInfo) o;
return Objects.equals(this.http, clusterMetadataPortInfo.http) &&
Objects.equals(this.https, clusterMetadataPortInfo.https);
}
@Override
public int hashCode() {
return Objects.hash(http, https);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ClusterMetadataPortInfo {\n");
sb.append(" http: ").append(toIndentedString(http)).append("\n");
sb.append(" https: ").append(toIndentedString(https)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
a009a10f45f06f0d0b1b2d1d266289905ed53279 | d9f6304a82dd3423b8f212671cff7910f289cc12 | /src/com/java24hours/Point3D.java | 1c1d34d62584a80e670947f6e2141b79eda28751 | [] | no_license | kdotzenrod517/Java24Hours | 39ea0260fc61c36c38648d4a73211c8f22fd746d | 67a915073ca6b272143efa65f17c3f86f5ca8142 | refs/heads/master | 2020-12-02T09:55:02.818459 | 2017-07-09T03:37:43 | 2017-07-09T03:37:43 | 96,659,042 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.java24hours;
import java.awt.*;
public class Point3D extends Point{
public int z;
public Point3D(int x, int y, int z){
super(x, y);
this.z = z;
}
public void move(int x, int y, int z){
this.z = z;
super.move(x, y);
}
public void translate(int x, int y, int z){
this.z = z;
super.translate(x, y);
}
}
| [
"[email protected]"
] | |
376fe749b6ed46c0aeb881efd992e2feca633a4f | b045a3975623e719e7a5f0d57d90172a4792673a | /api/src/main/java/codes/writeonce/deltastore/api/map/BooleanDescendingSimpleIterator.java | 98562ad0bd2b036b658455404debefae138289b9 | [
"Apache-2.0"
] | permissive | trade-mate/deltastore | e08f55395841f5e15751fad5b0faa68030d4b5cc | fdf2b64183f39c0cc75d9fda09a04c4d883b6f8e | refs/heads/main | 2023-08-25T01:15:17.182513 | 2021-10-27T03:26:57 | 2021-10-27T03:26:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,289 | java | package codes.writeonce.deltastore.api.map;
import codes.writeonce.deltastore.api.ArrayPool;
final class BooleanDescendingSimpleIterator<V> extends AbstractBooleanDescendingSimpleIterator<V> {
@SuppressWarnings("rawtypes")
private static final ArrayPool<BooleanDescendingSimpleIterator> POOL =
new ArrayPool<>(POOL_SIZE, BooleanDescendingSimpleIterator::new);
@SuppressWarnings("unchecked")
public static <V> BooleanDescendingSimpleIterator<V> create() {
final BooleanDescendingSimpleIterator<V> value = POOL.get();
value.init();
return value;
}
@SuppressWarnings("unchecked")
public static <V> BooleanDescendingSimpleIterator<V> create(boolean exclusive, boolean fromKey) {
final BooleanDescendingSimpleIterator<V> value = POOL.get();
value.init(exclusive, fromKey);
return value;
}
private BooleanDescendingSimpleIterator() {
// empty
}
@Override
protected boolean ended() {
return false;
}
@Override
protected boolean nullEnded() {
return false;
}
@Override
protected boolean ended(boolean key) {
return false;
}
@Override
public void close() {
super.close();
POOL.put(this);
}
}
| [
"[email protected]"
] | |
4c7cd21e90d1a429bcb47717054d18772e99efef | 9803ad5f92bef8cf79da6a27d7e2f4e9a9a6db74 | /src/main/java/application/controller/web/ProductCategoryController.java | 996d750d91299a163a1364be7aa1479d08d78844 | [] | no_license | DucHiep/demo_product | 417379a90e6986a4d1ee5914b7e198ad9c67c285 | b2ad1c96f9a189f10ed8d1500cb91a35961dcaf9 | refs/heads/master | 2020-09-14T11:28:52.463736 | 2019-11-21T07:49:47 | 2019-11-21T07:49:47 | 223,116,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,040 | java | package application.controller.web;
import application.data.model.Cart;
import application.data.model.Order;
import application.data.model.Product;
import application.data.model.User;
import application.data.service.CartService;
import application.data.service.OrderService;
import application.data.service.ProductCategoryService;
import application.data.service.UserService;
import application.extension.ProductPriceComparatorDecrease;
import application.extension.ProductPriceComparatorIncrease;
import application.viewmodel.list_product_category.ListProductCategoryViewModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.Principal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
@Controller
public class ProductCategoryController {
@Autowired
private ProductCategoryService productCategoryService;
@Autowired
private CartService cartService;
@GetMapping(path="/")
public String index(Model model,
@RequestParam(value = "categoryId", required = false)
String productCategoryId,
@RequestParam(value = "sortBy", required = false)
String sortBy,
HttpServletResponse response,
HttpServletRequest request,
final Principal principal){
String username = SecurityContextHolder.getContext().getAuthentication().getName();
if(principal == null) System.out.println("an danh");
else System.out.println(username);
ListProductCategoryViewModel vm = new ListProductCategoryViewModel();
if(principal!=null){
Cookie cookie[] = request.getCookies();
int kt1 = 0;
int kt2 = 0;
int kt3 = 0;
String guid_1 = "";
for(Cookie c : cookie){
if(c.getName().equals("username")){
kt1 = 1;
}
if(c.getName().equals("guid")){
kt2 = 1;
guid_1 = c.getValue();
}
if(c.getName().equals("cartid")){
kt3 = 1;
}
}
if(kt1 == 0){
Cookie cookie1 = new Cookie("username",username);
response.addCookie(cookie1);
List<Cart> carts = cartService.findByUserName(username);
if(carts.size()>0){
String guid_2 = carts.get(0).getGuid();
Cookie cookie2 = new Cookie("guid",guid_2);
response.addCookie(cookie2);
Cookie cookie3 = new Cookie("cartid",Integer.toString(carts.get(0).getId()));
response.addCookie(cookie3);
}else {
UUID uuid = UUID.randomUUID();
String guid = uuid.toString();
Cart cart = new Cart();
cart.setUserName(username);
cart.setGuid(guid);
cartService.addNewCart(cart);
System.out.println(cart.getUserName());
System.out.println(cart.getGuid());
Cookie cookie2 = new Cookie("guid", guid);
response.addCookie(cookie2);
Cookie cookie3 = new Cookie("cartid",Integer.toString(cart.getId()));
response.addCookie(cookie3);
}
}else {
if (kt2 == 0 ){
UUID uuid = UUID.randomUUID();
String guid = uuid.toString();
Cart cart = new Cart();
cart.setUserName(username);
cart.setGuid(guid);
cartService.addNewCart(cart);
Cookie cookie1 = new Cookie("guid", guid);
response.addCookie(cookie1);
Cookie cookie2 = new Cookie("cartid",Integer.toString(cart.getId()));
response.addCookie(cookie2);
}
}
if(kt1!=0&&kt2!=0&&kt3==0){
Cart cart = new Cart();
cart.setUserName(username);
cart.setGuid(guid_1);
cartService.addNewCart(cart);
Cookie cookie2 = new Cookie("cartid",Integer.toString(cart.getId()));
response.addCookie(cookie2);
}
}else {
Cookie cookie[] = request.getCookies();
int kt1=0;
int kt2=0;
String guid2 ="";
if(cookie!=null){
for (Cookie c : cookie){
if(c.getName().equals("guid")){
kt1=1;
guid2= c.getValue();
}
if(c.getName().equals("cartid")){
kt2=1;
}
}
}
if(kt1==0){
UUID uuid = UUID.randomUUID();
String guid = uuid.toString();
Cart cart = new Cart();
cart.setGuid(guid);
cartService.addNewCart(cart);
Cookie cookie1 = new Cookie("guid",guid);
response.addCookie(cookie1);
Cookie cookie2 = new Cookie("cartid", Integer.toString(cart.getId()));
response.addCookie(cookie2);
}
if(kt1==1&&kt2==0){
Cart cart = new Cart();
cart.setGuid(guid2);
cartService.addNewCart(cart);
Cookie cookie2 = new Cookie("cartid", Integer.toString(cart.getId()));
response.addCookie(cookie2);
}
}
int categoryId;
if(productCategoryId!=null) categoryId = Integer.parseInt(productCategoryId);
else categoryId=1;
vm.setProductCategory(productCategoryService.findOne(categoryId));
List<Product> products = vm.getProductCategory().getListProducts();
if(sortBy!=null){
if(sortBy.equals("increase")){
Collections.sort(products, new ProductPriceComparatorIncrease());
}else {
Collections.sort(products, new ProductPriceComparatorDecrease());
}
}
vm.setProductList(products);
vm.setProductCategoryList(productCategoryService.getListAllProductCategories());
model.addAttribute("vm",vm);
return "/menu";
}
}
| [
"[email protected]"
] | |
2513e1b8391fe6cfc768d8695a5b0d969e31ac8e | bcfc7e3b77ca8b41d42df9476041d5157e622b7a | /Project_Koback_Client/src/kr/or/kosta/koback/util/GUIUtil.java | 730548c4956fd7d166ab7b25dfc91211efc7807a | [] | no_license | moyaiori/biningChatProject | df9b22dbec83e90e0f6400d1ff1ee5f2d647d1d4 | 222dfe0862772fbb38a9a1450fd390ba034b1297 | refs/heads/master | 2016-09-16T13:37:24.631898 | 2015-08-26T01:01:40 | 2015-08-26T01:01:40 | 41,134,148 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,936 | java | package kr.or.kosta.koback.util;
import java.awt.Container;
import java.awt.Toolkit;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
/**
* GUI 관련된 공통 유틸리티 메소드
*
* @author AS
*
*/
public class GUIUtil {
/** 화면 중앙 배치 */
public static void setCenterScreen(Container con) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
int x = (toolkit.getScreenSize().width - con.getWidth()) / 2;;
int y = (toolkit.getScreenSize().height - con.getHeight()) / 2;;
con.setLocation(x, y); // 프레임의 위치염
}
/** 화면 풀 배치 */
public static void setFullScreen(Container con){
Toolkit toolkit = Toolkit.getDefaultToolkit();
// Dimension dimension = toolkit.getScreenSize();
con.setSize(toolkit.getScreenSize());; // 프레임의 위치염
}
public static final String THEME_SWING = "javax.swing.plaf.metal.MetalLookAndFeel";
public static final String THEME_WINDOW = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
public static final String THEME_UNIX = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
public static final String THEME_NIMBUS = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";
public static final String THEME_OS = "UIManager.getSystemLookAndFeelClassName()";
/** Look&Feel 설정*/
public static void setLookAndFeel(Container component,String className){
try {
UIManager.setLookAndFeel(className);
} catch (Exception e) {
e.printStackTrace();
}
SwingUtilities.updateComponentTreeUI(component);
}
/** 일반 메세지 출력 메소드 */
public static void showMessage(String message) {
JOptionPane.showMessageDialog(null, message, "알 림", JOptionPane.DEFAULT_OPTION);
}
/** 에러 메세지 출력 메소드 */
public static void showErrorMessage(String message) {
JOptionPane.showMessageDialog(null, message, "경 고", JOptionPane.ERROR_MESSAGE);
}
}
| [
"[email protected]"
] | |
94ffde86a9b1e1dc3486828dc3f9d75754ba40c5 | 1349a70213bf2ebe13d7a11e7fa2f34009b44294 | /src/main/java/javaguru/sunday/teacher/lesson_15/homework/level_6_middle/videostore/Movie.java | 4f60fbc8d53f7843ce446d8dee0902faec329f87 | [] | no_license | AlexJavaGuru/java_1_sunday_2020_september | 4a72519dfe643eaea417df65429d2ef4e9aff882 | 1539f396311c28d2e625f3b18427ae4586f078a7 | refs/heads/master | 2023-03-12T03:27:43.378963 | 2021-02-19T07:39:40 | 2021-02-19T07:39:40 | 298,872,670 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | java | package javaguru.sunday.teacher.lesson_15.homework.level_6_middle.videostore;
class Movie {
public static final String REGULAR = "REGULAR";
public static final String NEW_RELEASE = "NEW_RELEASE";
public static final String CHILDRENS = "CHILDRENS";
private String title;
private String priceCode;
public Movie(String title, String priceCode) {
this.title = title;
this.priceCode = priceCode;
}
public String getTitle () {
return title;
}
public String getPriceCode() {
return priceCode;
}
} | [
"[email protected]"
] | |
9c7142d419b63e98366f07bdccb8f1d1ac451461 | 88fba1850edaee8d7dcebb9313b2759557848081 | /pixmm-manager/pixmm-manager-web/src/main/java/com/ydhd/pixmm/controller/ContentCategoryController.java | 90dafc5c87863becb0bfbf609c37e7767d26f4e6 | [] | no_license | victorWangpb/pixmm | 210a6c482d31f68cf85edbc67dd25cfbe7eaf79c | 744e45a29c9432fa2770383d61ede8dd4eddbcda | refs/heads/master | 2021-01-18T17:06:02.429829 | 2017-08-17T12:06:22 | 2017-08-17T12:06:22 | 100,481,816 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,212 | java | package com.ydhd.pixmm.controller;
import com.ydhd.pixmm.pojo.EasyUITreeNode;
import com.ydhd.pixmm.service.ContentCategoryService;
import com.ydhd.pixmm.utils.PixmmResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Created by 王朋波 on 13/08/2017.
*/
@Controller
@RequestMapping("/content/category")
public class ContentCategoryController {
@Autowired
private ContentCategoryService contentCategoryService;
@RequestMapping("/list")
@ResponseBody
public List<EasyUITreeNode> getContentCatList(@RequestParam(value="id", defaultValue="0")Long parentId) {
List<EasyUITreeNode> list = contentCategoryService.getContentCatList(parentId);
return list;
}
@RequestMapping("/create")
@ResponseBody
public PixmmResult createNode(Long parentId, String name) {
PixmmResult result = contentCategoryService.insertCatgory(parentId, name);
return result;
}
}
| [
"[email protected]"
] | |
317d214147652b249a658482413a16aea71ff59c | 030585fcfdec43597c0a81dfefdc841c547d3751 | /src/window/ventanaDebug.java | c2d4e05bfc874b3d9b468f48529d3384fd3da960 | [] | no_license | ridv0ver/0ver | 2ec7b741803749619431e37517bdcae578a1d4d0 | 25eceb63f562e803332919d421162bebcb654a47 | refs/heads/main | 2023-02-07T16:27:57.654534 | 2021-01-04T06:44:43 | 2021-01-04T06:44:43 | 324,018,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,408 | java | package src.window;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ventanaDebug extends JFrame implements ActionListener{
JTextField debug;
JButton button;
/**
*
*/
private static final long serialVersionUID = 1L;
public ventanaDebug(){
setTitle("Over");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
setSize(1200, 600);
setLocationRelativeTo(null);
this.setIconImage(new ImageIcon(getClass().getResource("/icon.png")).getImage());
}
public void debugger(){
debug = new JTextField();
debug.setBounds(200,300,500,50);
add(debug);
button = new JButton("1001010");
button.addActionListener(this);
button.setBounds(750, 250, 200, 200);
add(button);
setVisible(true);
}
public void debugsCodes(String code){
if(code.equalsIgnoreCase("1432")){
dispose();
fullAdmin ventana = new fullAdmin();
ventana.setVisible(true);
}
if(code.equalsIgnoreCase("0")){
dispose();
ventanaPrincipal ventana = new ventanaPrincipal();
ventana.setVisible(true);
}
}
@Override
public void actionPerformed(ActionEvent e) {
debugsCodes(debug.getText());
}
}
| [
"[email protected]"
] | |
cacb9ce965e399c0336801fbc6d583b240893d11 | ceaf02b284566cf1c6c75e739a812f7edb232fe4 | /Implementation/src/main/java/de/kumpelblase2/remoteentities/api/goals/DesirePanic.java | 96a85843449bd81077f88621cbddacefd3d68961 | [
"MIT"
] | permissive | kumpelblase2/remote-entities-nxt | a0dff1ee9288416eb34209968da2003047af4263 | 17f706041eb26170737a588f8dbea03168e64fba | refs/heads/master | 2021-01-15T22:29:25.424070 | 2014-12-14T11:55:30 | 2014-12-14T11:55:30 | 24,538,107 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,039 | java | package de.kumpelblase2.remoteentities.api.goals;
import de.kumpelblase2.remoteentities.api.RemoteEntity;
import de.kumpelblase2.remoteentities.api.thinking.DesireBase;
import de.kumpelblase2.remoteentities.api.thinking.DesireType;
import de.kumpelblase2.remoteentities.nms.RandomPositionGenerator;
import de.kumpelblase2.remoteentities.persistence.ParameterData;
import de.kumpelblase2.remoteentities.persistence.SerializeAs;
import de.kumpelblase2.remoteentities.utilities.ReflectionUtil;
import net.minecraft.server.v1_7_R1.Vec3D;
import org.bukkit.Location;
/**
* Using this desire the entity will move around in panic when it gets damaged.
*/
public class DesirePanic extends DesireBase
{
protected double m_x;
protected double m_y;
protected double m_z;
@SerializeAs(pos = 1)
protected double m_speed;
@Deprecated
public DesirePanic(RemoteEntity inEntity)
{
super(inEntity);
this.m_type = DesireType.PRIMAL_INSTINCT;
}
public DesirePanic()
{
this(-1);
}
public DesirePanic(double inSpeed)
{
super();
this.m_speed = inSpeed;
this.m_type = DesireType.PRIMAL_INSTINCT;
}
@Override
public boolean shouldExecute()
{
if(this.getEntityHandle() == null || (this.getEntityHandle().getLastDamager() == null && !this.getEntityHandle().isBurning()))
return false;
else
{
Vec3D vec = RandomPositionGenerator.a(this.getEntityHandle(), 5, 4);
if(vec == null)
return false;
else
{
this.m_x = vec.c;
this.m_y = vec.d;
this.m_z = vec.e;
Vec3D.a.release(vec);
return true;
}
}
}
@Override
public void startExecuting()
{
this.getRemoteEntity().move(new Location(this.getRemoteEntity().getBukkitEntity().getWorld(), this.m_x, this.m_y, this.m_z), (this.m_speed == -1 ? this.getRemoteEntity().getSpeed() : this.m_speed));
}
@Override
public boolean canContinue()
{
return !this.getNavigation().g();
}
@Override
public ParameterData[] getSerializableData()
{
return ReflectionUtil.getParameterDataForClass(this).toArray(new ParameterData[0]);
}
} | [
"[email protected]"
] | |
708a84386765434350ecce2ae3417a979ba9f0dd | dc8094cceac6d43e8b771ad278b58931bb92d709 | /2020/src/test/java/net/jjshanks/InputReaderTest.java | 10a72af39266dc094ded1bdfa5deefaa1cd6f463 | [] | no_license | jjshanks/adventofcode-legacy | c54bb6ab1ef98131a26efb6d9d9a474175b00239 | 9278208a284fb32996dc183c6cdcece7049475db | refs/heads/master | 2023-01-27T15:56:09.768986 | 2020-12-07T05:27:46 | 2020-12-07T05:27:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,147 | java | package net.jjshanks;
import java.util.List;
import java.util.function.Function;
import junit.framework.TestCase;
import net.jjshanks.error.JollyException;
public class InputReaderTest extends TestCase {
public void testStringReader() throws JollyException {
InputReader<String> ir = new InputReader<>("testInput1");
List<String> actual = ir.getInput(Function.identity());
List<String> expected = List.of("2", "3", "5", "7");
assertEquals(expected, actual);
}
public void testFunctionReader() throws JollyException {
InputReader<Integer> ir = new InputReader<>("testInput1");
List<Integer> actual = ir.getInput(Integer::parseInt);
List<Integer> expected = List.of(2, 3, 5, 7);
assertEquals(expected, actual);
}
public void testReaderWithScannerInput() throws JollyException {
InputReader<String> ir = new InputReader<>("testInput2");
List<String> actual = ir.getInput(Function.identity(), ir.DEFAULT_COLLECTOR, "[\r\n][\r\n]+");
List<String> expected = List.of("1\n2", "3\n4", "123");
assertEquals(expected, actual);
}
}
| [
"[email protected]"
] | |
1252e14c7f0bc7379791e41952a65165df1320bd | 8a43ca36a71b430096c609e96889aae94e93ddc9 | /spincast-plugins/spincast-plugins-jdbc-parent/spincast-plugins-jdbc/src/main/java/org/spincast/plugins/jdbc/utils/ItemsAndTotalCountDefault.java | 219769027886484ea695779dd59359f388ab8d31 | [
"Apache-2.0"
] | permissive | spincast/spincast-framework | 18163ee0d5ed3571113ad6f3112cf7f951eee910 | fc25e6e61f1d20643662ed94e42003b23fe651f6 | refs/heads/master | 2022-10-20T11:20:43.008571 | 2022-10-11T23:21:41 | 2022-10-11T23:21:41 | 56,924,959 | 48 | 0 | null | null | null | null | UTF-8 | Java | false | false | 709 | java | package org.spincast.plugins.jdbc.utils;
import java.util.ArrayList;
import java.util.List;
public class ItemsAndTotalCountDefault<T> implements ItemsAndTotalCount<T> {
private final List<T> items;
private final long totalCount;
/**
* Empty result.
*/
public ItemsAndTotalCountDefault() {
this.items = new ArrayList<T>();
this.totalCount = 0;
}
public ItemsAndTotalCountDefault(List<T> items, long totalCount) {
this.items = items;
this.totalCount = totalCount;
}
@Override
public List<T> getItems() {
return this.items;
}
@Override
public long getTotalCount() {
return this.totalCount;
}
}
| [
"[email protected]"
] | |
f855718590188eae3464cd200b2fdaad307e939b | 2b63ea53d6cc2f62663880118f1dcfc16a673ab2 | /src/concurrent/DiningPhilosophers.java | 99997ddbfac47c8edbbb653d38501a308f1530c6 | [] | no_license | smagellan/interview | 9ea602a212405db7346b5e1dba0e155ed684f960 | 8767c7c7be31651280bfee45ae44637aadc000d7 | refs/heads/master | 2021-01-20T05:40:10.303291 | 2012-11-15T06:30:21 | 2012-11-15T06:30:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,373 | java | package concurrent;
import java.util.concurrent.locks.*;
public class DiningPhilosophers
{
public static void main(String[] args)
{
int count = 5;
Chopstick[] chopsticks = new Chopstick[count];
for (int i = 0; i < count; i++)
chopsticks[i] = new Chopstick();
Philosopher[] profs = new Philosopher[count];
for (int i = 0; i < count; i++)
{
profs[i] = new SmartPhilosopher(i, chopsticks[i], chopsticks[(i + 1) % count]);
Thread t = new Thread(profs[i]);
t.start();
}
}
}
// will cause deadlock
class Philosopher implements Runnable
{
protected Chopstick _left;
protected Chopstick _right;
protected String _name;
protected int _count = 10;
public Philosopher(int name, Chopstick left, Chopstick right)
{
_left = left;
_right = right;
_name = "Prof. " + name;
}
protected boolean Eat()
{
System.out.println(_name + " try to pickup.");
Pickup();
System.out.println(_name + " eating.");
try
{
Thread.sleep(1000);
} catch (InterruptedException e)
{
e.printStackTrace();
}
System.out.println(_name + " putdown.");
Putdown();
System.out.println(_name + " leave.");
return true;
}
protected void Pickup()
{
_left.Pickup();
_right.Pickup();
}
protected void Putdown()
{
_left.Putdown();
_right.Putdown();
}
@Override
public void run()
{
for (int i = 0; i < _count; i++)
{
if(!Eat())
i++;
}
}
}
class SmartPhilosopher extends Philosopher
{
public SmartPhilosopher(int name, Chopstick left, Chopstick right)
{
super(name, left, right);
}
protected boolean Eat()
{
System.out.println(_name + " try to pickup.");
if (tryPickup())
{
System.out.println(_name + " eating.");
try
{
Thread.sleep(1000);
} catch (InterruptedException e)
{
e.printStackTrace();
}
System.out.println(_name + " putdown.");
Putdown();
System.out.println(_name + " leave.");
return true;
}
return false;
}
protected boolean tryPickup()
{
if (!_left.tryPickup())
return false;
else if (!_right.tryPickup())
{
_left.Putdown();
return false;
}
return true;
}
}
class Chopstick
{
private Lock _lock;
public Chopstick()
{
_lock = new ReentrantLock();
}
public void Pickup()
{
_lock.lock();
}
public boolean tryPickup()
{
return _lock.tryLock();
}
public void Putdown()
{
_lock.unlock();
}
}
| [
"[email protected]"
] | |
80caebd44ac255b57eecaa93dcc2c14214801545 | 96539ab1c9944cf66a90975a35087fab9913a0b9 | /src/main/java/model/Qr.java | 2b5fad70cbe0af20b112f96d9e0751b3caed996d | [] | no_license | HoracioMM/reservation | a3ddac0a5b7ef366c4635d49bc601ca3b249ca31 | 226f25df12885e67a010c09799e3403ad15de6a2 | refs/heads/master | 2021-01-15T10:45:51.283081 | 2016-09-18T18:14:14 | 2016-09-18T18:14:14 | 68,538,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package model;
import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
@Entity
public class Qr implements Serializable {
private static final long serialVersionUID = -2817403522882362922L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private int qrId;
private String qrCode;
private String alarmTrigger;
@OneToOne(mappedBy = "qr", cascade = CascadeType.ALL)
private Traveller traveller;
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
public String getAlarmTrigger() {
return alarmTrigger;
}
public void setAlarmTrigger(String alarmTrigger) {
this.alarmTrigger = alarmTrigger;
}
public Traveller getTraveller() {
return traveller;
}
public void setTraveller(Traveller traveller) {
this.traveller = traveller;
}
public int getQrId() {
return qrId;
}
@Override
public String toString() {
return "Qr [qrId=" + qrId + ", qrCode=" + qrCode + ", alarmTrigger=" + alarmTrigger + ", traveller=" + traveller
+ "]";
}
}
| [
"HoracioMM@HoracioMM-PC"
] | HoracioMM@HoracioMM-PC |
c0607ccb1a974937949f80a56fd08511350457f7 | b80b63956bd7167159efa1f41cf65bd7a2290287 | /Unique Paths II-2.java | a4dc04ce2f50f0ac3d8c39e5ddac5e8b0d623a0b | [] | no_license | winterfly/Lintcode | 6a3ea3ce0748a3edc7f7257d5b65e94ff514dbe8 | 9ff0375f24b2241341b21f19f8937177e973ab42 | refs/heads/master | 2021-01-21T04:55:44.308851 | 2016-06-22T03:17:20 | 2016-06-22T03:17:20 | 55,869,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | public class Solution {
/**
* @param obstacleGrid: A list of lists of integers
* @return: An integer
*/
public int uniquePathsWithObstacles(int[][] obstacleGrid) {
if (obstacleGrid == null || obstacleGrid.length == 0) return 0;
int m = obstacleGrid.length;
if (obstacleGrid[0] == null || obstacleGrid[0].length == 0) return 0;
int n = obstacleGrid[0].length;
if (obstacleGrid[m-1][n-1] == 1) {
return 0;
}
int[] dp = new int[n];
dp[0] = 1 - obstacleGrid[0][0];
for (int j = 1; j < n; j++) {
dp[j] = obstacleGrid[0][j] == 0 ? dp[j-1] : 0;
}
for (int i = 1; i < m; i++) {
dp[0] = obstacleGrid[i][0] == 0 ? dp[0] : 0;
for (int j = 1; j < n; j++) {
dp[j] = obstacleGrid[i][j] == 0 ? dp[j] + dp[j-1] : 0;
}
}
return dp[n-1];
}
}
| [
"[email protected]"
] | |
5e83c6b7c4d60f4464b50556b10ad0be75f83907 | ac481da2fb839e9a8455cad3868dc375be9d133c | /producer/src/main/java/com/rongyixuan/producer/ProducerApplication.java | 97fbfca1cba6d7751db4879f4569c9efa305d232 | [] | no_license | rongyixuan2019/demo11 | c5b91a4432666c77de7c979b96d86972c5c6512f | d4d6d59db984c967005194f0381b9bbfb588b1e1 | refs/heads/master | 2022-04-25T21:09:49.742807 | 2020-04-19T09:34:42 | 2020-04-19T09:34:42 | 256,961,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package com.rongyixuan.producer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@EnableEurekaClient
@SpringBootApplication
public class ProducerApplication {
public static void main(String[] args) {
SpringApplication.run(ProducerApplication.class, args);
}
}
| [
"[email protected]"
] | |
ae134f3a2c6ab21702a69f97bc4abd4886a38d93 | 06f233236143781954e18772d0b75689a99d9410 | /ewaiter/src/main/java/com/ewaiter/model/Product.java | 98427f9e6f7b5a1ac3a07e1bd1d5b39415ead05a | [] | no_license | klaskowski/SDAcademyProjects | 6b9876d58100025799575458f8a3f93583dfa325 | 2c1e042846cd5f6432402b17d2c3003969b498a2 | refs/heads/master | 2020-12-20T23:35:17.612215 | 2018-10-11T20:22:26 | 2018-10-11T20:22:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 725 | java | package com.ewaiter.model;
import javax.persistence.*;
@Entity
@javax.persistence.Table(name = "product")
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long productId;
@Column
private String name;
@Column
private Double price;
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
}
| [
"[email protected]"
] | |
8883400e3d5ffc5cf905a7b91826729d0245973c | dabc84aeaafa2eb63ffe0397e370ae3794079bba | /src/main/java/cc/before30/service/SchedulerService.java | 5ad366b4645c2004d38c57f3e684c312b7b6b752 | [] | no_license | before30/ddul-scheduler | 3379b3df08693a1a8ff8b6cc5fde8914e2f9e6f5 | 20b5345b5d8a5e55e89f21bbc45b42a59e0047db | refs/heads/master | 2021-01-20T08:36:59.886304 | 2019-02-15T01:36:20 | 2019-02-15T01:36:20 | 89,929,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,750 | java | package cc.before30.service;
import cc.before30.config.DdulProperties;
import com.github.seratch.jslack.Slack;
import com.github.seratch.jslack.api.webhook.Payload;
import com.github.seratch.jslack.api.webhook.WebhookResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.time.ZoneId;
import java.time.ZonedDateTime;
/**
* Created by before30 on 01/05/2017.
*/
@Slf4j
@Component
public class SchedulerService {
@Autowired
private Slack slack;
@Autowired
private DdulProperties ddulProperties;
@Autowired
private RestTemplate restTemplate;
@Scheduled(cron = "0 1 7-23 * * *", zone = "Asia/Seoul")
public void requestToWriteWhatDidUDo() {
int hour = ZonedDateTime.now(ZoneId.of("Asia/Seoul")).getHour();
log.info("current hour : {}", hour);
hour = (hour-1)>0?(hour-1)%24:23;
Payload payload = Payload.builder()
.channel(ddulProperties.getSlackChannelName())
.username("coach")
.iconEmoji(":smile_cat:")
.text("[" + hour + ":00-" + hour + ":59]: What did you do??" )
.build();
try {
WebhookResponse send = slack.send(ddulProperties.getSlackWebhookUrl(), payload);
log.info("{}", ddulProperties.getSlackWebhookUrl());
log.info("response {} {}", send.getCode(), send.getBody());
} catch (IOException e) {
log.error("exception in sending message", e.getMessage());
}
}
}
| [
"[email protected]"
] | |
bd5eba3a4fd5f8264f5858c4eb93ea2af704d473 | 6c8987d48d600fe9ad2640174718b68932ed4a22 | /OpenCylocs-Gradle/src/main/java/nl/strohalm/cyclos/dao/access/PasswordHistoryLogDAO.java | 8339c0ca115850c440b6f00f71d8863014a48078 | [] | no_license | hvarona/ocwg | f89140ee64c48cf52f3903348349cc8de8d3ba76 | 8d4464ec66ea37e6ad10255efed4236457b1eacc | refs/heads/master | 2021-01-11T20:26:38.515141 | 2017-03-04T19:49:40 | 2017-03-04T19:49:40 | 79,115,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java | /*
This file is part of Cyclos (www.cyclos.org).
A project of the Social Trade Organisation (www.socialtrade.org).
Cyclos is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Cyclos is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Cyclos; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package nl.strohalm.cyclos.dao.access;
import nl.strohalm.cyclos.dao.BaseDAO;
import nl.strohalm.cyclos.dao.InsertableDAO;
import nl.strohalm.cyclos.entities.access.PasswordHistoryLog;
import nl.strohalm.cyclos.entities.access.PasswordHistoryLog.PasswordType;
import nl.strohalm.cyclos.entities.access.User;
/**
* DAO interface for PasswordHistoryLog
*
* @author luis
*/
public interface PasswordHistoryLogDAO extends BaseDAO<PasswordHistoryLog>, InsertableDAO<PasswordHistoryLog> {
/**
* Checks whether the given password was already used for the given user
*/
public boolean wasAlreadyUsed(User user, PasswordType type, String password);
}
| [
"[email protected]"
] | |
e76eb16786ccb5aba1f013d17f5e1bf6314a616a | 5b14625d9a7851ec40c14a209af9e90acef51e0e | /mahjong/src/main/java/com/rafo/chess/model/battle/BattleStep.java | ae6fa94fc3a9fd7ff685b929a784df42ccc290f2 | [] | no_license | leroyBoys/ChaoShanMaJiang | 3d5807fac4cbd64e13800ddb5dd8e220fa96ea38 | bd2364ed92abc8580f516427735ec9c3e3647bad | refs/heads/master | 2020-03-08T02:02:18.317518 | 2018-05-16T08:37:06 | 2018-05-16T08:37:06 | 127,847,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,731 | java | package com.rafo.chess.model.battle;
import com.rafo.chess.utils.MathUtils;
import com.smartfoxserver.v2.entities.data.SFSObject;
import org.apache.commons.lang.StringUtils;
import java.util.*;
/**
* Created by Administrator on 2016/9/17.
*/
public class BattleStep {
private int ownerId ; // 出牌玩家id
private int targetId ; // 目标玩家id
private int playType ; // 战斗类型
private List<Integer> card = new ArrayList<>(); // 牌值
private int remainCardCount ; // 剩余牌数
private boolean ignoreOther;
private boolean auto =false; //是否自动打牌
private boolean isBettwenEnter = false;//是否中途进入
private boolean sendClient=true;
/** 扩展字段*/
private SFSObject ex=new SFSObject();
public BattleStep(){
}
public BattleStep(int ownerId, int targetId, int playType){
this.ownerId = ownerId;
this.targetId = targetId;
this.playType = playType;
}
public int getOwnerId() {
return ownerId;
}
public void setOwnerId(int ownerId) {
this.ownerId = ownerId;
}
public int getTargetId() {
return targetId;
}
public boolean isSendClient() {
return sendClient;
}
public void setSendClient(boolean sendClient) {
this.sendClient = sendClient;
}
public boolean isBettwenEnter() {
return isBettwenEnter;
}
public void setBettwenEnter(boolean bettwenEnter) {
this.isBettwenEnter = bettwenEnter;
}
public void setTargetId(int targetId) {
this.targetId = targetId;
}
public int getPlayType() {
return playType;
}
public void setPlayType(int playType) {
this.playType = playType;
}
public List<Integer> getCard() {
return card;
}
public void setCard(List<Integer> card) {
this.card = card;
}
public int getRemainCardCount() {
return remainCardCount;
}
public void setRemainCardCount(int remainCardCount) {
this.remainCardCount = remainCardCount;
}
public void addCard(Integer card) {
this.card.add(card);
}
public boolean isIgnoreOther() {
return ignoreOther;
}
public void setIgnoreOther(boolean ignoreOther) {
this.ignoreOther = ignoreOther;
}
public boolean isAuto() {
return auto;
}
public void setAuto(boolean auto) {
this.auto = auto;
}
public void addExValueInt(exEnum key,int value){
ex.putInt(key.name(), value);
}
public SFSObject getEx() {
return ex;
}
public void setEx(SFSObject ex) {
this.ex = ex;
}
public BattleStep clone(){
BattleStep step = new BattleStep();
step.setOwnerId(ownerId);
step.setTargetId(targetId);
step.setPlayType(playType);
List<Integer> nCards = new ArrayList<>();
for(Integer c : card){
nCards.add(c);
}
step.setAuto(auto);
step.setCard(nCards);
step.setRemainCardCount(remainCardCount);
step.setEx(this.ex);
step.setBettwenEnter(isBettwenEnter);
return step;
}
public SFSObject toSFSObject(){
SFSObject obj = new SFSObject();
obj.putInt("oid",ownerId);
obj.putInt("tid",targetId);
obj.putInt("pt",playType);
/* if(gangTingTypeCards.size() > 0){
obj.putSFSObject("cd", gangTingCardsToArray());
}else {*/
obj.putIntArray("cd", card);
//}
obj.putInt("rc",remainCardCount);
if(auto) {
obj.putInt("auto", 1);
}
obj.putBool("enter",isBettwenEnter);
obj.putSFSObject("ex",ex);
return obj;
}
public String toFormatString(){
StringBuffer sb = new StringBuffer("{");
sb.append("oid=").append(ownerId).append(",");
sb.append("tid=").append(targetId).append(",");
sb.append("pt=").append(playType).append(",");
sb.append("rc=").append(remainCardCount).append(",");
if(card != null){
sb.append("cd={").append(StringUtils.join(card, ",")).append("}").append(",");
}
if(!ex.getKeys().isEmpty()){
sb.append("ex=").append(MathUtils.FormateStringForLua(ex)).append(",");
}
if(auto){
sb.append("auto=").append(1).append(",");
}
sb.append("}");
return sb.toString();
}
public enum exEnum{
/**
* 抢杠胡
*/
ht,
/**
* 抢杠胡的牌的剩余数量
*/
qg,
/**
* 胡牌
*/
hi,
}
}
| [
"[email protected]"
] | |
e0a7907696cd9746235cae082d626eadf4a44b59 | 745142e46466b5ceb4c798644405dfa0a70b9f84 | /app/src/main/java/any/audio/Activity/UpdateThemedActivity.java | dec4ae75376adaee4dfc3b009e4c07aec9431220 | [] | no_license | yibulaxi/AnyAudio | c686e819c6709cd82124fa798e6c021b351b86fa | 9a2f305defa250f2f584af60372c8f898f04032b | refs/heads/master | 2021-06-10T23:33:09.518457 | 2017-01-17T05:49:00 | 2017-01-17T05:49:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,613 | java | package any.audio.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import any.audio.Config.Constants;
import any.audio.Managers.FontManager;
import any.audio.R;
import any.audio.SharedPreferences.SharedPrefrenceUtils;
public class UpdateThemedActivity extends AppCompatActivity {
TextView tvUpdateMessage;
TextView tvUpdateDescription;
TextView btnCancel;
TextView btnDownload;
Typeface tf;
CheckBox mUpdateCheckBox;
private String newInThisUpdateDescription;
private String newAppDownloadUrl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_update_themed);
tf = FontManager.getInstance(this).getTypeFace(FontManager.FONT_RALEWAY_REGULAR);
tvUpdateMessage = (TextView) findViewById(R.id.updateMsg);
tvUpdateDescription = (TextView) findViewById(R.id.updateDescription);
btnCancel = (TextView) findViewById(R.id.cancel_update_msg_dialog);
btnDownload = (TextView) findViewById(R.id.download_btn_update_msg);
mUpdateCheckBox = (CheckBox) findViewById(R.id.checkedConfirmation);
mUpdateCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean byUser) {
if (byUser) {
if (compoundButton.isChecked()) {
SharedPrefrenceUtils.getInstance(UpdateThemedActivity.this).setDoNotRemindMeAgainForAppUpdate(true);
} else {
SharedPrefrenceUtils.getInstance(UpdateThemedActivity.this).setDoNotRemindMeAgainForAppUpdate(false);
}
}
}
});
//Regular TypeFace
btnDownload.setTypeface(tf);
btnCancel.setTypeface(tf);
tvUpdateMessage.setTypeface(tf);
tvUpdateDescription.setTypeface(tf);
// data setters
newInThisUpdateDescription = getIntent().getExtras().getString(Constants.EXTRAA_NEW_UPDATE_DESC);
newAppDownloadUrl = getIntent().getExtras().getString(Constants.KEY_NEW_UPDATE_URL);
tvUpdateDescription.setText(newInThisUpdateDescription);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_update_themed, 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();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void download(View view) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(newAppDownloadUrl));
startActivity(intent);
finish();
}
public void cancel(View view) {
finish();
}
}
| [
"[email protected]"
] | |
46f3d1a9de5e7d09ae6a808f3acb84a49185df0e | 3af6963d156fc1bf7409771d9b7ed30b5a207dc1 | /runtime/src/main/java/apple/eventkitui/EKCalendarChooserDelegateAdapter.java | 5ed120c6b8c6aa57364fa638069764f7efcbc63d | [
"Apache-2.0"
] | permissive | yava555/j2objc | 1761d7ffb861b5469cf7049b51f7b73c6d3652e4 | dba753944b8306b9a5b54728a40ca30bd17bdf63 | refs/heads/master | 2020-12-30T23:23:50.723961 | 2015-09-03T06:57:20 | 2015-09-03T06:57:20 | 48,475,187 | 0 | 0 | null | 2015-12-23T07:08:22 | 2015-12-23T07:08:22 | null | UTF-8 | Java | false | false | 1,073 | java | package apple.eventkitui;
import java.io.*;
import java.nio.*;
import java.util.*;
import com.google.j2objc.annotations.*;
import com.google.j2objc.runtime.*;
import com.google.j2objc.runtime.block.*;
import apple.audiotoolbox.*;
import apple.corefoundation.*;
import apple.coregraphics.*;
import apple.coreservices.*;
import apple.foundation.*;
import apple.eventkit.*;
import apple.uikit.*;
/*<javadoc>*/
/*</javadoc>*/
@Adapter
public abstract class EKCalendarChooserDelegateAdapter
extends Object
implements EKCalendarChooserDelegate {
@NotImplemented("calendarChooserSelectionDidChange:")
public void didChangeSelection(EKCalendarChooser calendarChooser) { throw new UnsupportedOperationException(); }
@NotImplemented("calendarChooserDidFinish:")
public void didFinish(EKCalendarChooser calendarChooser) { throw new UnsupportedOperationException(); }
@NotImplemented("calendarChooserDidCancel:")
public void didCancel(EKCalendarChooser calendarChooser) { throw new UnsupportedOperationException(); }
}
| [
"[email protected]"
] | |
24194d6f262f293556eb64b72829707754dc43b7 | de810c12d77476b44d74146f35169210e2c7d944 | /ExternalController/src/AgentEnvironment.java | 31f43010e6ddf2bd3d3d2536c42cbb9af3b52a96 | [] | no_license | adhnous/BookTradingDemo | 6e1dfe60bc4c27fe4f42bff1f19d0484f94a00bb | 9e416a6c3e0eca3c3fc3e9f4c3313b4e889cf5ca | refs/heads/master | 2020-07-02T15:04:57.041890 | 2019-08-10T02:11:47 | 2019-08-10T02:11:47 | 201,566,661 | 0 | 0 | null | 2019-08-10T02:09:53 | 2019-08-10T02:09:52 | null | UTF-8 | Java | false | false | 9,258 | java | import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.wrapper.ContainerController;
import jade.wrapper.StaleProxyException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import bookTrading.IO.interpreter.BookAgentInterpreter;
import bookTrading.IO.interpreter.BookBuyerInterpreter;
import bookTrading.IO.interpreter.BookSellerInterpreter;
/**
* Command-line arguments:
* -agentcontainer
* if this is specified, run the platform as an agent container and
* connect to another main container; otherwise, run as a main container.
* -mainhost [hostname]
* the host name of the MAIN container to connect to (default is
* localhost)
* -mainport [port]
* the port number of the MAIN container to connect to (default 1099)
* -buyers [buyer1;buyer2]
* any buyer agents to instantiate (separated by semi-colons)
* -sellers [seller1;seller2]
* any seller agents to instantiate (separated by semi-colons)
* @author peter
*
*/
public class AgentEnvironment {
// arguments
public static final String S_AGENTCONTAINER = "ac";
public static final String L_AGENTCONTAINER = "agentcontainer";
public static final String S_MAINHOST = "mh";
public static final String L_MAINHOST = "mainhost";
public static final String S_MAINPORT = "mp";
public static final String L_MAINPORT = "mainport";
public static final String S_BUYERS = "b";
public static final String L_BUYERS = "buyers";
public static final String S_SELLERS = "s";
public static final String L_SELLERS = "sellers";
// default values
public static final boolean AGENTCONTAINER = false;
public static final String MAINHOST = "localhost";
public static final String MAINPORT = "1099";
public static final List<String> BUYERS = new ArrayList<String>();
public static final List<String> SELLERS = new ArrayList<String>();
public static Options defineOptions() {
// create Options object
Options options = new Options();
// add the options
options.addOption(
S_AGENTCONTAINER,
L_AGENTCONTAINER,
false,
"run the platform as an agent container (rather than a main container)"
);
options.addOption(
S_MAINHOST,
L_MAINHOST,
true,
"the host name of the main container to connect to (default is " + MAINHOST + ")"
);
options.addOption(
S_MAINPORT,
L_MAINPORT,
true,
"the port number of the main container to connect to (default is " + MAINPORT + ")"
);
options.addOption(
S_BUYERS,
L_BUYERS,
true,
"any buyer agents to instantiate (separated by ;) - eg. buyer1;buyer2;buyer3"
);
options.addOption(
S_SELLERS,
L_SELLERS,
true,
"any seller agents to instantiate (separated by ;) - eg. seller1;seller2;seller3"
);
// return these options
return options;
}
public static CommandLine parseArguments(Options options, String args[]) throws ParseException {
// very simply, parse the arguments and return an object containing them
CommandLineParser parser = new BasicParser();
return parser.parse(options, args);
}
public static Settings interpretArguments(CommandLine cl) {
Settings settings = new Settings();
// if the agent container argument is there then run that way
settings.setAgentContainer(cl.hasOption(S_AGENTCONTAINER));
// host and port stuff
if(cl.hasOption(S_MAINHOST)) {
settings.setMainHost(cl.getOptionValue(S_MAINHOST));
}
if(cl.hasOption(S_MAINPORT)) {
settings.setMainPort(cl.getOptionValue(S_MAINPORT));
}
// buyer and seller agents
if(cl.hasOption(S_BUYERS)) {
settings.setBuyers(Arrays.asList(cl.getOptionValue(S_BUYERS).split(";")));
}
if(cl.hasOption(S_SELLERS)) {
settings.setSellers(Arrays.asList(cl.getOptionValue(S_SELLERS).split(";")));
}
// return the overriden settings
return settings;
}
private ContainerController container;
private List<ExternalAgent> agents;
private Map<String, BookAgentInterpreter> interpreters;
private Thread interpreterThread;
/**
* Start a new container with the given settings.
*/
private void startContainer(Settings settings) {
// get the JADE runtime singleton instance
Runtime rt = Runtime.instance();
// prepare the settings for the platform that we want to get onto
Profile p = new ProfileImpl();
p.setParameter(Profile.MAIN_HOST, settings.getMainHost());
p.setParameter(Profile.MAIN_PORT, settings.getMainPort());
// create a container
container = settings.isAgentContainer() ? rt.createAgentContainer(p) : rt.createMainContainer(p);
}
public AgentEnvironment(Settings settings) {
// create a new container
startContainer(settings);
// create some new agents and interpreters
agents = new ArrayList<ExternalAgent>(settings.getBuyers().size() + settings.getSellers().size());
interpreters = new HashMap<String, BookAgentInterpreter>(agents.size());
for(String buyerName : settings.getBuyers()) {
ExternalAgent buyer;
// create a new external agent for each buyer
buyer = new ExternalAgent(container, buyerName, ExternalAgent.BUYER_CLASS_NAME);
// add them to the list of agents
agents.add(buyer);
// create and add an interpreter for them
interpreters.put(buyerName.toLowerCase(), new BookBuyerInterpreter(buyer));
}
for(String sellerName : settings.getSellers()) {
ExternalAgent seller;
// create a new external agent for each seller
seller = new ExternalAgent(container, sellerName, ExternalAgent.SELLER_CLASS_NAME);
// add them to the list of agents
agents.add(seller);
// create and add an interpreter for them
interpreters.put(sellerName.toLowerCase(), new BookSellerInterpreter(seller));
}
// start the RMA
agents.add(new ExternalAgent(container, "rma" + (settings.isAgentContainer() ? "-agent" : ""), "jade.tools.rma.rma"));
// start interpreting user input
interpreterThread = new Thread(new Runnable() {
@Override
public void run() {
boolean continuePolling = true;
// get input from stdin
Scanner s = new Scanner(System.in);
// keep interpreting until there's no more input, or until
// neither agents want to continue
while(s.hasNextLine() && continuePolling) {
try {
// get the next line
String line = s.nextLine();
// if the line includes a colon (:)
if(line.contains(":")) {
// split it at the colon
String[] tokens = line.split(":");
// the first token should say which agent is meant by this message
String agent = tokens[0].toLowerCase();
// let the agent meant by it interpret it
continuePolling = interpreters.get(agent).interpret(tokens[1]);
// otherwise
} else {
// let all the agents interpret it
for(BookAgentInterpreter interpreter : interpreters.values()) {
if(!interpreter.interpret(line)) {
continuePolling = false;
}
}
}
} catch(Exception e) {
// do nothing
}
}
// close the scanner
s.close();
}
});
interpreterThread.start();
}
public void kill() {
// stop the interpreter thread
interpreterThread.interrupt();
// kill the agents
for(ExternalAgent agent : agents) {
agent.kill();
}
// kill the container
try {
container.kill();
} catch (StaleProxyException e) {
// do nothing
}
// free all the memory
agents = null;
container = null;
interpreters = null;
interpreterThread = null;
}
public static void main(String[] args) {
// work through the command-line arguments
try {
// read and parse them
Options options = defineOptions();
CommandLine cl = parseArguments(options, args);
// start a new environment based on them
new AgentEnvironment(interpretArguments(cl));
} catch(ParseException e) {
System.err.println("Invalid arguments provided! Type -h for help.");
return;
}
}
// a bean for the settings of the environment
static class Settings {
// default settings
private boolean agentContainer = AGENTCONTAINER;
private String mainHost = MAINHOST;
private String mainPort = MAINPORT;
private List<String> buyers = BUYERS;
private List<String> sellers = SELLERS;
public boolean isAgentContainer() {
return agentContainer;
}
public void setAgentContainer(boolean agentContainer) {
this.agentContainer = agentContainer;
}
public String getMainHost() {
return mainHost;
}
public void setMainHost(String mainHost) {
this.mainHost = mainHost;
}
public String getMainPort() {
return mainPort;
}
public void setMainPort(String mainPort) {
this.mainPort = mainPort;
}
public List<String> getBuyers() {
return buyers;
}
public void setBuyers(List<String> buyers) {
this.buyers = buyers;
}
public List<String> getSellers() {
return sellers;
}
public void setSellers(List<String> sellers) {
this.sellers = sellers;
}
}
}
| [
"[email protected]"
] | |
86f161d20b7080c48119f4c06be9c009e8ccdd9c | 0f72e71884e8bb07b40e0eeb243cb12107dced6e | /cs355/Lab6/Lab6/src/cs355/controller/CircleState.java | 1a892808b3c000056f8ed6c3c89f988a7696d3c7 | [] | no_license | PaulCloward/cs355 | 4ccb65f7b103f85bde0852a10d38c78473bc8f5c | 176db48b577f73bbeb6034b9f39772e60fecf02f | refs/heads/master | 2021-01-01T05:15:54.630613 | 2016-05-05T20:03:38 | 2016-05-05T20:03:38 | 58,155,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,855 | java | package cs355.controller;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import cs355.model.drawing.Circle;
import cs355.model.drawing.Ellipse;
import cs355.model.drawing.MyModel;
public class CircleState extends State {
protected Circle currentCircle;
protected Point2D.Double firstPoint;
public CircleState(MyModel model) {
super(model);
}
@Override
public void mousePress(Point2D.Double e) {
this.firstPoint = new Point2D.Double(e.getX(),e.getY());
currentCircle= new Circle(color, this.firstPoint,0);
model.addShape(currentCircle);
}
@Override
public void mouseDragged(Point2D.Double e) {
int mouseX = (int)e.getX();
int mouseY = (int)e.getY();
double height = mouseY - this.firstPoint.getY();
double width = mouseX - this.firstPoint.getX();
Point2D.Double center;
double radius = 0.0;
if(Math.abs(height) > Math.abs(width)) {
radius = (Math.abs(width)/2);
} else {
radius = (Math.abs(height)/2);
}
if(height > 0 && width > 0) {
center = new Point2D.Double(this.firstPoint.getX() + radius, this.firstPoint.getY() + radius);
} else if (height <= 0 && width > 0) {
center = new Point2D.Double(this.firstPoint.getX() + radius, this.firstPoint.getY() - radius);
} else if(height <= 0 && width <= 0) {
center = new Point2D.Double(this.firstPoint.getX() - radius,this.firstPoint.getY() - radius);
} else {
center = new Point2D.Double(this.firstPoint.getX() - radius, this.firstPoint.getY() + radius);
}
this.currentCircle.setCenter(center);
this.currentCircle.setRadius(radius);
model.update();
}
@Override
public void mouseRelease(Point2D.Double e) {
this.currentCircle = null;
this.firstPoint = null;
}
@Override
public void mouseClicked(Point2D.Double e) {
// TODO Auto-generated method stub
}
} | [
"[email protected]"
] | |
024fabd9c8d537fafac8508362f86a9dac8c48a3 | 2b3c91ef240f972d3f7ac3077fcfc3e8e03e3064 | /src/main/java/com/clesun/web/skyland/entity/ZhnyNsglXqExample.java | 86b893e783253ae1802fee4bbc0574b2ce5933b4 | [] | no_license | MrQunZhu/skyland | 1b9d67fa28ab0b7e3854efd36ea614108548618b | bb5e0723a0c3263ba560b7d906686b35a812e924 | refs/heads/master | 2022-07-26T12:28:16.583846 | 2020-03-01T07:21:02 | 2020-03-01T07:21:02 | 196,967,340 | 0 | 0 | null | 2022-07-06T20:41:28 | 2019-07-15T09:25:49 | JavaScript | UTF-8 | Java | false | false | 37,663 | java | package com.clesun.web.skyland.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ZhnyNsglXqExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
protected List<Criteria> oredCriteria;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
protected int offset = -1;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
protected int limit = -1;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public ZhnyNsglXqExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public void setOffset(int offset) {
this.offset=offset;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public int getOffset() {
return offset;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public void setLimit(int limit) {
this.limit=limit;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public int getLimit() {
return limit;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
public void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
public void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNsglIdIsNull() {
addCriterion("NSGL_ID is null");
return (Criteria) this;
}
public Criteria andNsglIdIsNotNull() {
addCriterion("NSGL_ID is not null");
return (Criteria) this;
}
public Criteria andNsglIdEqualTo(Integer value) {
addCriterion("NSGL_ID =", value, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdNotEqualTo(Integer value) {
addCriterion("NSGL_ID <>", value, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdGreaterThan(Integer value) {
addCriterion("NSGL_ID >", value, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdGreaterThanOrEqualTo(Integer value) {
addCriterion("NSGL_ID >=", value, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdLessThan(Integer value) {
addCriterion("NSGL_ID <", value, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdLessThanOrEqualTo(Integer value) {
addCriterion("NSGL_ID <=", value, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdIn(List<Integer> values) {
addCriterion("NSGL_ID in", values, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdNotIn(List<Integer> values) {
addCriterion("NSGL_ID not in", values, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdBetween(Integer value1, Integer value2) {
addCriterion("NSGL_ID between", value1, value2, "nsglId");
return (Criteria) this;
}
public Criteria andNsglIdNotBetween(Integer value1, Integer value2) {
addCriterion("NSGL_ID not between", value1, value2, "nsglId");
return (Criteria) this;
}
public Criteria andCzrIsNull() {
addCriterion("CZR is null");
return (Criteria) this;
}
public Criteria andCzrIsNotNull() {
addCriterion("CZR is not null");
return (Criteria) this;
}
public Criteria andCzrEqualTo(String value) {
addCriterion("CZR =", value, "czr");
return (Criteria) this;
}
public Criteria andCzrNotEqualTo(String value) {
addCriterion("CZR <>", value, "czr");
return (Criteria) this;
}
public Criteria andCzrGreaterThan(String value) {
addCriterion("CZR >", value, "czr");
return (Criteria) this;
}
public Criteria andCzrGreaterThanOrEqualTo(String value) {
addCriterion("CZR >=", value, "czr");
return (Criteria) this;
}
public Criteria andCzrLessThan(String value) {
addCriterion("CZR <", value, "czr");
return (Criteria) this;
}
public Criteria andCzrLessThanOrEqualTo(String value) {
addCriterion("CZR <=", value, "czr");
return (Criteria) this;
}
public Criteria andCzrLike(String value) {
addCriterion("CZR like", value, "czr");
return (Criteria) this;
}
public Criteria andCzrNotLike(String value) {
addCriterion("CZR not like", value, "czr");
return (Criteria) this;
}
public Criteria andCzrIn(List<String> values) {
addCriterion("CZR in", values, "czr");
return (Criteria) this;
}
public Criteria andCzrNotIn(List<String> values) {
addCriterion("CZR not in", values, "czr");
return (Criteria) this;
}
public Criteria andCzrBetween(String value1, String value2) {
addCriterion("CZR between", value1, value2, "czr");
return (Criteria) this;
}
public Criteria andCzrNotBetween(String value1, String value2) {
addCriterion("CZR not between", value1, value2, "czr");
return (Criteria) this;
}
public Criteria andCzlxIsNull() {
addCriterion("CZLX is null");
return (Criteria) this;
}
public Criteria andCzlxIsNotNull() {
addCriterion("CZLX is not null");
return (Criteria) this;
}
public Criteria andCzlxEqualTo(String value) {
addCriterion("CZLX =", value, "czlx");
return (Criteria) this;
}
public Criteria andCzlxNotEqualTo(String value) {
addCriterion("CZLX <>", value, "czlx");
return (Criteria) this;
}
public Criteria andCzlxGreaterThan(String value) {
addCriterion("CZLX >", value, "czlx");
return (Criteria) this;
}
public Criteria andCzlxGreaterThanOrEqualTo(String value) {
addCriterion("CZLX >=", value, "czlx");
return (Criteria) this;
}
public Criteria andCzlxLessThan(String value) {
addCriterion("CZLX <", value, "czlx");
return (Criteria) this;
}
public Criteria andCzlxLessThanOrEqualTo(String value) {
addCriterion("CZLX <=", value, "czlx");
return (Criteria) this;
}
public Criteria andCzlxLike(String value) {
addCriterion("CZLX like", value, "czlx");
return (Criteria) this;
}
public Criteria andCzlxNotLike(String value) {
addCriterion("CZLX not like", value, "czlx");
return (Criteria) this;
}
public Criteria andCzlxIn(List<String> values) {
addCriterion("CZLX in", values, "czlx");
return (Criteria) this;
}
public Criteria andCzlxNotIn(List<String> values) {
addCriterion("CZLX not in", values, "czlx");
return (Criteria) this;
}
public Criteria andCzlxBetween(String value1, String value2) {
addCriterion("CZLX between", value1, value2, "czlx");
return (Criteria) this;
}
public Criteria andCzlxNotBetween(String value1, String value2) {
addCriterion("CZLX not between", value1, value2, "czlx");
return (Criteria) this;
}
public Criteria andCzlbIsNull() {
addCriterion("CZLB is null");
return (Criteria) this;
}
public Criteria andCzlbIsNotNull() {
addCriterion("CZLB is not null");
return (Criteria) this;
}
public Criteria andCzlbEqualTo(String value) {
addCriterion("CZLB =", value, "czlb");
return (Criteria) this;
}
public Criteria andCzlbNotEqualTo(String value) {
addCriterion("CZLB <>", value, "czlb");
return (Criteria) this;
}
public Criteria andCzlbGreaterThan(String value) {
addCriterion("CZLB >", value, "czlb");
return (Criteria) this;
}
public Criteria andCzlbGreaterThanOrEqualTo(String value) {
addCriterion("CZLB >=", value, "czlb");
return (Criteria) this;
}
public Criteria andCzlbLessThan(String value) {
addCriterion("CZLB <", value, "czlb");
return (Criteria) this;
}
public Criteria andCzlbLessThanOrEqualTo(String value) {
addCriterion("CZLB <=", value, "czlb");
return (Criteria) this;
}
public Criteria andCzlbLike(String value) {
addCriterion("CZLB like", value, "czlb");
return (Criteria) this;
}
public Criteria andCzlbNotLike(String value) {
addCriterion("CZLB not like", value, "czlb");
return (Criteria) this;
}
public Criteria andCzlbIn(List<String> values) {
addCriterion("CZLB in", values, "czlb");
return (Criteria) this;
}
public Criteria andCzlbNotIn(List<String> values) {
addCriterion("CZLB not in", values, "czlb");
return (Criteria) this;
}
public Criteria andCzlbBetween(String value1, String value2) {
addCriterion("CZLB between", value1, value2, "czlb");
return (Criteria) this;
}
public Criteria andCzlbNotBetween(String value1, String value2) {
addCriterion("CZLB not between", value1, value2, "czlb");
return (Criteria) this;
}
public Criteria andCzkssjIsNull() {
addCriterion("CZKSSJ is null");
return (Criteria) this;
}
public Criteria andCzkssjIsNotNull() {
addCriterion("CZKSSJ is not null");
return (Criteria) this;
}
public Criteria andCzkssjEqualTo(Date value) {
addCriterion("CZKSSJ =", value, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjNotEqualTo(Date value) {
addCriterion("CZKSSJ <>", value, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjGreaterThan(Date value) {
addCriterion("CZKSSJ >", value, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjGreaterThanOrEqualTo(Date value) {
addCriterion("CZKSSJ >=", value, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjLessThan(Date value) {
addCriterion("CZKSSJ <", value, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjLessThanOrEqualTo(Date value) {
addCriterion("CZKSSJ <=", value, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjIn(List<Date> values) {
addCriterion("CZKSSJ in", values, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjNotIn(List<Date> values) {
addCriterion("CZKSSJ not in", values, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjBetween(Date value1, Date value2) {
addCriterion("CZKSSJ between", value1, value2, "czkssj");
return (Criteria) this;
}
public Criteria andCzkssjNotBetween(Date value1, Date value2) {
addCriterion("CZKSSJ not between", value1, value2, "czkssj");
return (Criteria) this;
}
public Criteria andCzjssjIsNull() {
addCriterion("CZJSSJ is null");
return (Criteria) this;
}
public Criteria andCzjssjIsNotNull() {
addCriterion("CZJSSJ is not null");
return (Criteria) this;
}
public Criteria andCzjssjEqualTo(Date value) {
addCriterion("CZJSSJ =", value, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjNotEqualTo(Date value) {
addCriterion("CZJSSJ <>", value, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjGreaterThan(Date value) {
addCriterion("CZJSSJ >", value, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjGreaterThanOrEqualTo(Date value) {
addCriterion("CZJSSJ >=", value, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjLessThan(Date value) {
addCriterion("CZJSSJ <", value, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjLessThanOrEqualTo(Date value) {
addCriterion("CZJSSJ <=", value, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjIn(List<Date> values) {
addCriterion("CZJSSJ in", values, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjNotIn(List<Date> values) {
addCriterion("CZJSSJ not in", values, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjBetween(Date value1, Date value2) {
addCriterion("CZJSSJ between", value1, value2, "czjssj");
return (Criteria) this;
}
public Criteria andCzjssjNotBetween(Date value1, Date value2) {
addCriterion("CZJSSJ not between", value1, value2, "czjssj");
return (Criteria) this;
}
public Criteria andTpdzIsNull() {
addCriterion("TPDZ is null");
return (Criteria) this;
}
public Criteria andTpdzIsNotNull() {
addCriterion("TPDZ is not null");
return (Criteria) this;
}
public Criteria andTpdzEqualTo(String value) {
addCriterion("TPDZ =", value, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzNotEqualTo(String value) {
addCriterion("TPDZ <>", value, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzGreaterThan(String value) {
addCriterion("TPDZ >", value, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzGreaterThanOrEqualTo(String value) {
addCriterion("TPDZ >=", value, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzLessThan(String value) {
addCriterion("TPDZ <", value, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzLessThanOrEqualTo(String value) {
addCriterion("TPDZ <=", value, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzLike(String value) {
addCriterion("TPDZ like", value, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzNotLike(String value) {
addCriterion("TPDZ not like", value, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzIn(List<String> values) {
addCriterion("TPDZ in", values, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzNotIn(List<String> values) {
addCriterion("TPDZ not in", values, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzBetween(String value1, String value2) {
addCriterion("TPDZ between", value1, value2, "tpdz");
return (Criteria) this;
}
public Criteria andTpdzNotBetween(String value1, String value2) {
addCriterion("TPDZ not between", value1, value2, "tpdz");
return (Criteria) this;
}
public Criteria andCzbzIsNull() {
addCriterion("CZBZ is null");
return (Criteria) this;
}
public Criteria andCzbzIsNotNull() {
addCriterion("CZBZ is not null");
return (Criteria) this;
}
public Criteria andCzbzEqualTo(String value) {
addCriterion("CZBZ =", value, "czbz");
return (Criteria) this;
}
public Criteria andCzbzNotEqualTo(String value) {
addCriterion("CZBZ <>", value, "czbz");
return (Criteria) this;
}
public Criteria andCzbzGreaterThan(String value) {
addCriterion("CZBZ >", value, "czbz");
return (Criteria) this;
}
public Criteria andCzbzGreaterThanOrEqualTo(String value) {
addCriterion("CZBZ >=", value, "czbz");
return (Criteria) this;
}
public Criteria andCzbzLessThan(String value) {
addCriterion("CZBZ <", value, "czbz");
return (Criteria) this;
}
public Criteria andCzbzLessThanOrEqualTo(String value) {
addCriterion("CZBZ <=", value, "czbz");
return (Criteria) this;
}
public Criteria andCzbzLike(String value) {
addCriterion("CZBZ like", value, "czbz");
return (Criteria) this;
}
public Criteria andCzbzNotLike(String value) {
addCriterion("CZBZ not like", value, "czbz");
return (Criteria) this;
}
public Criteria andCzbzIn(List<String> values) {
addCriterion("CZBZ in", values, "czbz");
return (Criteria) this;
}
public Criteria andCzbzNotIn(List<String> values) {
addCriterion("CZBZ not in", values, "czbz");
return (Criteria) this;
}
public Criteria andCzbzBetween(String value1, String value2) {
addCriterion("CZBZ between", value1, value2, "czbz");
return (Criteria) this;
}
public Criteria andCzbzNotBetween(String value1, String value2) {
addCriterion("CZBZ not between", value1, value2, "czbz");
return (Criteria) this;
}
public Criteria andBy1IsNull() {
addCriterion("BY1 is null");
return (Criteria) this;
}
public Criteria andBy1IsNotNull() {
addCriterion("BY1 is not null");
return (Criteria) this;
}
public Criteria andBy1EqualTo(String value) {
addCriterion("BY1 =", value, "by1");
return (Criteria) this;
}
public Criteria andBy1NotEqualTo(String value) {
addCriterion("BY1 <>", value, "by1");
return (Criteria) this;
}
public Criteria andBy1GreaterThan(String value) {
addCriterion("BY1 >", value, "by1");
return (Criteria) this;
}
public Criteria andBy1GreaterThanOrEqualTo(String value) {
addCriterion("BY1 >=", value, "by1");
return (Criteria) this;
}
public Criteria andBy1LessThan(String value) {
addCriterion("BY1 <", value, "by1");
return (Criteria) this;
}
public Criteria andBy1LessThanOrEqualTo(String value) {
addCriterion("BY1 <=", value, "by1");
return (Criteria) this;
}
public Criteria andBy1Like(String value) {
addCriterion("BY1 like", value, "by1");
return (Criteria) this;
}
public Criteria andBy1NotLike(String value) {
addCriterion("BY1 not like", value, "by1");
return (Criteria) this;
}
public Criteria andBy1In(List<String> values) {
addCriterion("BY1 in", values, "by1");
return (Criteria) this;
}
public Criteria andBy1NotIn(List<String> values) {
addCriterion("BY1 not in", values, "by1");
return (Criteria) this;
}
public Criteria andBy1Between(String value1, String value2) {
addCriterion("BY1 between", value1, value2, "by1");
return (Criteria) this;
}
public Criteria andBy1NotBetween(String value1, String value2) {
addCriterion("BY1 not between", value1, value2, "by1");
return (Criteria) this;
}
public Criteria andBy2IsNull() {
addCriterion("BY2 is null");
return (Criteria) this;
}
public Criteria andBy2IsNotNull() {
addCriterion("BY2 is not null");
return (Criteria) this;
}
public Criteria andBy2EqualTo(String value) {
addCriterion("BY2 =", value, "by2");
return (Criteria) this;
}
public Criteria andBy2NotEqualTo(String value) {
addCriterion("BY2 <>", value, "by2");
return (Criteria) this;
}
public Criteria andBy2GreaterThan(String value) {
addCriterion("BY2 >", value, "by2");
return (Criteria) this;
}
public Criteria andBy2GreaterThanOrEqualTo(String value) {
addCriterion("BY2 >=", value, "by2");
return (Criteria) this;
}
public Criteria andBy2LessThan(String value) {
addCriterion("BY2 <", value, "by2");
return (Criteria) this;
}
public Criteria andBy2LessThanOrEqualTo(String value) {
addCriterion("BY2 <=", value, "by2");
return (Criteria) this;
}
public Criteria andBy2Like(String value) {
addCriterion("BY2 like", value, "by2");
return (Criteria) this;
}
public Criteria andBy2NotLike(String value) {
addCriterion("BY2 not like", value, "by2");
return (Criteria) this;
}
public Criteria andBy2In(List<String> values) {
addCriterion("BY2 in", values, "by2");
return (Criteria) this;
}
public Criteria andBy2NotIn(List<String> values) {
addCriterion("BY2 not in", values, "by2");
return (Criteria) this;
}
public Criteria andBy2Between(String value1, String value2) {
addCriterion("BY2 between", value1, value2, "by2");
return (Criteria) this;
}
public Criteria andBy2NotBetween(String value1, String value2) {
addCriterion("BY2 not between", value1, value2, "by2");
return (Criteria) this;
}
public Criteria andBy3IsNull() {
addCriterion("BY3 is null");
return (Criteria) this;
}
public Criteria andBy3IsNotNull() {
addCriterion("BY3 is not null");
return (Criteria) this;
}
public Criteria andBy3EqualTo(String value) {
addCriterion("BY3 =", value, "by3");
return (Criteria) this;
}
public Criteria andBy3NotEqualTo(String value) {
addCriterion("BY3 <>", value, "by3");
return (Criteria) this;
}
public Criteria andBy3GreaterThan(String value) {
addCriterion("BY3 >", value, "by3");
return (Criteria) this;
}
public Criteria andBy3GreaterThanOrEqualTo(String value) {
addCriterion("BY3 >=", value, "by3");
return (Criteria) this;
}
public Criteria andBy3LessThan(String value) {
addCriterion("BY3 <", value, "by3");
return (Criteria) this;
}
public Criteria andBy3LessThanOrEqualTo(String value) {
addCriterion("BY3 <=", value, "by3");
return (Criteria) this;
}
public Criteria andBy3Like(String value) {
addCriterion("BY3 like", value, "by3");
return (Criteria) this;
}
public Criteria andBy3NotLike(String value) {
addCriterion("BY3 not like", value, "by3");
return (Criteria) this;
}
public Criteria andBy3In(List<String> values) {
addCriterion("BY3 in", values, "by3");
return (Criteria) this;
}
public Criteria andBy3NotIn(List<String> values) {
addCriterion("BY3 not in", values, "by3");
return (Criteria) this;
}
public Criteria andBy3Between(String value1, String value2) {
addCriterion("BY3 between", value1, value2, "by3");
return (Criteria) this;
}
public Criteria andBy3NotBetween(String value1, String value2) {
addCriterion("BY3 not between", value1, value2, "by3");
return (Criteria) this;
}
public Criteria andCzrbhIsNull() {
addCriterion("CZRBH is null");
return (Criteria) this;
}
public Criteria andCzrbhIsNotNull() {
addCriterion("CZRBH is not null");
return (Criteria) this;
}
public Criteria andCzrbhEqualTo(String value) {
addCriterion("CZRBH =", value, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhNotEqualTo(String value) {
addCriterion("CZRBH <>", value, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhGreaterThan(String value) {
addCriterion("CZRBH >", value, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhGreaterThanOrEqualTo(String value) {
addCriterion("CZRBH >=", value, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhLessThan(String value) {
addCriterion("CZRBH <", value, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhLessThanOrEqualTo(String value) {
addCriterion("CZRBH <=", value, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhLike(String value) {
addCriterion("CZRBH like", value, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhNotLike(String value) {
addCriterion("CZRBH not like", value, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhIn(List<String> values) {
addCriterion("CZRBH in", values, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhNotIn(List<String> values) {
addCriterion("CZRBH not in", values, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhBetween(String value1, String value2) {
addCriterion("CZRBH between", value1, value2, "czrbh");
return (Criteria) this;
}
public Criteria andCzrbhNotBetween(String value1, String value2) {
addCriterion("CZRBH not between", value1, value2, "czrbh");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated do_not_delete_during_merge Mon Jan 21 10:33:42 CST 2019
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table ZHNY_NSGL_XQ
*
* @mbggenerated Mon Jan 21 10:33:42 CST 2019
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
dbf3d6dbc8c4b482dc6914a78d20d30161d4fb2f | 1ae6abc37d7844879916e8f612ba1d616bc0c3cb | /src/public/nc/bs/pf/changedir/CHGXC77TOXC69.java | 6c61a8ad6a3c3bc51af371f1f18d031242d82990 | [] | no_license | menglingrui/xcgl | 7a3b3f03f14b21fbd25334042f87fa570758a7ad | 525b4e38cf52bb75c83762a9c27862b4f86667e8 | refs/heads/master | 2020-06-05T20:10:09.263291 | 2014-09-11T11:00:34 | 2014-09-11T11:00:34 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 7,680 | java | package nc.bs.pf.changedir;
import nc.bs.pf.change.ConversionPolicyEnum;
import nc.vo.pf.change.UserDefineFunction;
/**
* 从精粉调拨单到其它入库单的
* 取调入信息
* 后台交换类
* @author Jay
*
*/
public class CHGXC77TOXC69 extends nc.bs.pf.change.VOConversion{
public CHGXC77TOXC69(){
super();
}
/**
* 获得交换后处理类 全名称
* @return java.lang.String
*/
public String getAfterClassName() {
return null;
}
/**
* 获得交换后处理类 全名称
* @return java.lang.String
*/
public String getOtherClassName() {
return null;
}
/**
* 返回交换类型枚举ConversionPolicyEnum,默认为单据项目-单据项目
* @return ConversionPolicyEnum
* @since 5.5
*/
public ConversionPolicyEnum getConversionPolicy() {
return ConversionPolicyEnum.BILLITEM_BILLITEM;
}
/**
* 获得映射类型的交换规则
* @return java.lang.String[]
*/
public String[] getField() {
return new String[] {
"H_pk_corp->H_pk_corp",
"H_pk_factory->H_pk_factory1",//调入选厂
//"H_pk_beltline->H_pk_beltline",//生产线
//"H_pk_classorder->H_pk_classorder",//班次
//"H_pk_minarea->H_pk_minarea",//部门--取样单位
"H_pk_stordoc->H_pk_stordoc1",//调入仓库
"H_pk_minarea->B_pk_deptdoc1",//调入部门--取样单位
"B_pk_invmandoc->B_pk_invmandoc",
"B_pk_father->B_pk_invmandoc",
"B_pk_invbasdoc->B_pk_invbasdoc",
//"H_dweighdate->H_dbilldate",
"H_dbilldate->H_dbilldate",//单据日期
"H_pk_busitype->H_pk_busitype",//业务流程
//"H_pk_vehicle->B_pk_vehicle",
"B_nwetweight->B_ndryweight",//数量
"H_vmemo->H_vmemo",
"B_vmemo->B_vmemo",
"H_ireserve1->H_ireserve1",
"H_ireserve10->H_ireserve10",
"H_ireserve2->H_ireserve2",
"H_ireserve3->H_ireserve3",
"H_ireserve4->H_ireserve4",
"H_ireserve5->H_ireserve5",
"H_ireserve6->H_ireserve6",
"H_ireserve7->H_ireserve7",
"H_ireserve8->H_ireserve8",
"H_ireserve9->H_ireserve9",
"H_nreserve1->H_nreserve1",
"H_nreserve10->H_nreserve10",
"H_nreserve2->H_nreserve2",
"H_nreserve3->H_nreserve3",
"H_nreserve4->H_nreserve4",
"H_nreserve5->H_nreserve5",
"H_nreserve6->H_nreserve6",
"H_nreserve7->H_nreserve7",
"H_nreserve8->H_nreserve8",
"H_nreserve9->H_nreserve9",
"H_pk_defdoc1->H_pk_defdoc1",
"H_pk_defdoc10->H_pk_defdoc10",
"H_pk_defdoc11->H_pk_defdoc11",
"H_pk_defdoc12->H_pk_defdoc12",
"H_pk_defdoc13->H_pk_defdoc13",
"H_pk_defdoc14->H_pk_defdoc14",
"H_pk_defdoc15->H_pk_defdoc15",
"H_pk_defdoc16->H_pk_defdoc16",
"H_pk_defdoc17->H_pk_defdoc17",
"H_pk_defdoc18->H_pk_defdoc18",
"H_pk_defdoc19->H_pk_defdoc19",
"H_pk_defdoc2->H_pk_defdoc2",
"H_pk_defdoc20->H_pk_defdoc20",
"H_pk_defdoc3->H_pk_defdoc3",
"H_pk_defdoc4->H_pk_defdoc4",
"H_pk_defdoc5->H_pk_defdoc5",
"H_pk_defdoc6->H_pk_defdoc6",
"H_pk_defdoc7->H_pk_defdoc7",
"H_pk_defdoc8->H_pk_defdoc8",
"H_pk_defdoc9->H_pk_defdoc9",
//"H_pk_deptdoc->H_pk_deptdoc",//部门档案
"H_ureserve1->H_ureserve1",
"H_ureserve10->H_ureserve10",
"H_ureserve2->H_ureserve2",
"H_ureserve3->H_ureserve3",
"H_ureserve4->H_ureserve4",
"H_ureserve5->H_ureserve5",
"H_ureserve6->H_ureserve6",
"H_ureserve7->H_ureserve7",
"H_ureserve8->H_ureserve8",
"H_ureserve9->H_ureserve9",
"H_vdef1->H_vdef1",
"H_vdef10->H_vdef10",
"H_vdef11->H_vdef11",
"H_vdef12->H_vdef12",
"H_vdef13->H_vdef13",
"H_vdef14->H_vdef14",
"H_vdef15->H_vdef15",
"H_vdef16->H_vdef16",
"H_vdef17->H_vdef17",
"H_vdef18->H_vdef18",
"H_vdef19->H_vdef19",
"H_vdef2->H_vdef2",
"H_vdef20->H_vdef20",
"H_vdef3->H_vdef3",
"H_vdef4->H_vdef4",
"H_vdef5->H_vdef5",
"H_vdef6->H_vdef6",
"H_vdef7->H_vdef7",
"H_vdef8->H_vdef8",
"H_vdef9->H_vdef9",
"H_vreserve1->H_vreserve1",
"H_vreserve10->H_vreserve10",
"H_vreserve2->H_vreserve2",
"H_vreserve3->H_vreserve3",
"H_vreserve4->H_vreserve4",
"H_vreserve5->H_vreserve5",
"H_vreserve6->H_vreserve6",
"H_vreserve7->H_vreserve7",
"H_vreserve8->H_vreserve8",
"H_vreserve9->H_vreserve9",
"B_ireserve1->B_ireserve1",
"B_ireserve10->B_ireserve10",
"B_ireserve2->B_ireserve2",
"B_ireserve3->B_ireserve3",
"B_ireserve4->B_ireserve4",
"B_ireserve5->B_ireserve5",
"B_ireserve6->B_ireserve6",
"B_ireserve7->B_ireserve7",
"B_ireserve8->B_ireserve8",
"B_ireserve9->B_ireserve9",
"B_nreserve1->B_nreserve1",
"B_nreserve10->B_nreserve10",
"B_nreserve2->B_nreserve2",
"B_nreserve3->B_nreserve3",
"B_nreserve4->B_nreserve4",
"B_nreserve5->B_nreserve5",
"B_nreserve6->B_nreserve6",
"B_nreserve7->B_nreserve7",
"B_nreserve8->B_nreserve8",
"B_nreserve9->B_nreserve9",
"B_pk_defdoc1->B_pk_defdoc1",
"B_pk_defdoc10->B_pk_defdoc10",
"B_pk_defdoc11->B_pk_defdoc11",
"B_pk_defdoc12->B_pk_defdoc12",
"B_pk_defdoc13->B_pk_defdoc13",
"B_pk_defdoc14->B_pk_defdoc14",
"B_pk_defdoc15->B_pk_defdoc15",
"B_pk_defdoc16->B_pk_defdoc16",
"B_pk_defdoc17->B_pk_defdoc17",
"B_pk_defdoc18->B_pk_defdoc18",
"B_pk_defdoc19->B_pk_defdoc19",
"B_pk_defdoc2->B_pk_defdoc2",
"B_pk_defdoc20->B_pk_defdoc20",
"B_pk_defdoc3->B_pk_defdoc3",
"B_pk_defdoc4->B_pk_defdoc4",
"B_pk_defdoc5->B_pk_defdoc5",
"B_pk_defdoc6->B_pk_defdoc6",
"B_pk_defdoc7->B_pk_defdoc7",
"B_pk_defdoc8->B_pk_defdoc8",
"B_pk_defdoc9->B_pk_defdoc9",
"B_ureserve1->B_ureserve1",
"B_ureserve10->B_ureserve10",
"B_ureserve2->B_ureserve2",
"B_ureserve3->B_ureserve3",
"B_ureserve4->B_ureserve4",
"B_ureserve5->B_ureserve5",
"B_ureserve6->B_ureserve6",
"B_ureserve7->B_ureserve7",
"B_ureserve8->B_ureserve8",
"B_ureserve9->B_ureserve9",
"B_vdef1->B_vdef1",
"B_vdef10->B_vdef10",
"B_vdef11->B_vdef11",
"B_vdef12->B_vdef12",
"B_vdef13->B_vdef13",
"B_vdef14->B_vdef14",
"B_vdef15->B_vdef15",
"B_vdef16->B_vdef16",
"B_vdef17->B_vdef17",
"B_vdef18->B_vdef18",
"B_vdef19->B_vdef19",
"B_vdef2->B_vdef2",
"B_vdef20->B_vdef20",
"B_vdef3->B_vdef3",
"B_vdef4->B_vdef4",
"B_vdef5->B_vdef5",
"B_vdef6->B_vdef6",
"B_vdef7->B_vdef7",
"B_vdef8->B_vdef8",
"B_vdef9->B_vdef9",
"B_vreserve1->B_vreserve1",
"B_vreserve10->B_vreserve10",
"B_vreserve2->B_vreserve2",
"B_vreserve3->B_vreserve3",
"B_vreserve4->B_vreserve4",
"B_vreserve5->B_vreserve5",
"B_vreserve6->B_vreserve6",
"B_vreserve7->B_vreserve7",
"B_vreserve8->B_vreserve8",
"B_vreserve9->B_vreserve9",
"B_vlastbillcode->H_vbillno",
"B_vlastbillid->B_pk_general_h",
"B_vlastbillrowid->B_pk_general_b",
"B_vlastbilltype->H_pk_billtype",
"B_csourcebillcode->H_vbillno",
"B_vsourcebillid->B_pk_general_h",
"B_vsourcebillrowid->B_pk_general_b",
"B_vsourcebilltype->H_pk_billtype",
};
}
/**
* 获得赋值类型的交换规则
* @return java.lang.String[]
*/
public String[] getAssign() {
return null;
}
/**
* 获得公式类型的交换规则
* @return java.lang.String[]
*/
public String[] getFormulas() {
return null;
}
/**
* 返回用户自定义函数
*/
public UserDefineFunction[] getUserDefineFunction() {
return null;
}
}
| [
"[email protected]"
] | |
62ac7ddb5d39a247f56e1f369df9252b45d35d8e | fd2767083209bd7e2b639c88b0c8fae591e8985f | /src/main/java/com/awesome/pro/db/mysql/WrappedConnection.java | c74edf61e8c82e09bcdeee6b7abb2206d93ad2ce | [
"MIT"
] | permissive | siddharth-sahoo/SQLDatabaseQuery | 63797a9b01fdc04d6882e3ae5c6e8a1208f600fd | c09d93b7b7737cebbd47e110c8e2d34c51a0bcdf | refs/heads/master | 2020-12-25T19:15:17.718939 | 2014-12-01T09:51:49 | 2014-12-01T09:51:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,324 | java | package com.awesome.pro.db.mysql;
import java.sql.Connection;
import java.sql.SQLException;
import org.apache.log4j.Logger;
import com.awesome.pro.pool.WrappedResource;
/**
* Wrapper class for JDBC MySQL connection.
* @author siddharth.s
*
*/
public class WrappedConnection implements WrappedResource<Connection> {
/**
* JDBC connection.
*/
private final Connection connection;
/**
* Root logger instance.
*/
private static final Logger LOGGER = Logger.getLogger(WrappedConnection.class);
/**
* @param connection JDBC connection to be wrapped.
*/
public WrappedConnection(final Connection connection) {
this.connection = connection;
}
/* (non-Javadoc)
* @see com.awesome.pro.pool.IResource#close()
*/
@Override
public void close() {
try {
connection.close();
} catch (SQLException e) {
LOGGER.error("Unable to close connection.", e);
System.exit(1);
}
}
/* (non-Javadoc)
* @see com.awesome.pro.pool.IResource#isClosed()
*/
@Override
public boolean isClosed() {
if (connection == null) {
return true;
}
try {
return connection.isClosed();
} catch (SQLException e) {
return true;
}
}
/* (non-Javadoc)
* @see com.awesome.pro.pool.WrappedResource#getResource()
*/
@Override
public Connection getResource() {
return connection;
}
}
| [
"[email protected]"
] | |
ab9eb25eb538875f2f2fd8bca4e38b2487b8f389 | a0a3e155a459e7f1f0259332c2511e071c6d4bc8 | /src/com/aop/service/aspect/MyAspect2.java | b276130ce58514b6ebf1c716b33f9ddcb2b72c27 | [] | no_license | JimmyYangMJ/MyAOPSpring | dc0bdebc3ba1c14829539c5a8f5a53efc5f5382f | 7cf61b50230b9882d7931663109f10e8adab3e09 | refs/heads/master | 2020-06-26T15:52:58.737066 | 2019-07-30T15:29:15 | 2019-07-30T15:29:15 | 199,678,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package com.aop.service.aspect;
/**
* 切面类:增加代码 与 切入点 结合
*/
public class MyAspect2 {
public void before(){
System.out.println("开启事务...");
}
public void after(){
System.out.println("提交事务...");
}
}
| [
"[email protected]"
] | |
8681f66a06f107f39332134c6c7fb0e507465491 | 3093fda798dc4f4f5a8cb6e92364829edd23984e | /src/main/java/me/stonerivers/leetcode/hard/MedianOfTwoSortedArrays_4.java | 14e180f9be8a724390acfffb50ed775ea934a6d4 | [] | no_license | StoneRivers/LeetCode | 938faba405abb34c0e25addbbefa775ba6a18e1c | a004d9090b497ece0b691526bcc778433ddae05c | refs/heads/master | 2020-03-31T09:05:40.502359 | 2019-07-22T14:53:06 | 2019-07-22T14:53:06 | 152,082,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,334 | java | package me.stonerivers.leetcode.hard;
/**
* @author Zhangyuanan
* @version 1.0
* @since 2019-06-30
*/
public class MedianOfTwoSortedArrays_4 {
public double findMedianSortedArrays(int[] nums1, int[] nums2) {
int len1 = nums1.length;
int len2 = nums2.length;
int start = (len1 + len2 + 1) / 2 - 1;
int end = (len1 + len2) / 2 + 1 - 1;
return merge(nums1, nums2, start, end);
}
private double merge(int[] nums1, int[] nums2, int aimIndex1, int aimIndex2) {
int len1 = nums1.length;
int len2 = nums2.length;
boolean success = false;
int aim1 = 0, aim2 = 0;
int index1 = 0, index2 = 0, index = 0;
while (index1 < len1 && index2 < len2 && !success) {
if (nums1[index1] < nums2[index2]) {
if (index == aimIndex1) {
aim1 = nums1[index1];
}
if (index == aimIndex2) {
aim2 = nums1[index1];
success = true;
}
index++;
index1++;
} else {
if (index == aimIndex1) {
aim1 = nums2[index2];
}
if (index == aimIndex2) {
aim2 = nums2[index2];
success = true;
}
index++;
index2++;
}
}
while (index1 < len1 && !success) {
if (index == aimIndex1) {
aim1 = nums1[index1];
}
if (index == aimIndex2) {
aim2 = nums1[index1];
success = true;
}
index++;
index1++;
}
while (index2 < len2 && !success) {
if (index == aimIndex1) {
aim1 = nums2[index2];
}
if (index == aimIndex2) {
aim2 = nums2[index2];
success = true;
}
index++;
index2++;
}
return ((double) (aim1 + aim2)) / 2;
}
public static void main(String[] args) {
int[] num1 = new int[]{1, 2};
int[] num2 = new int[]{3, 4};
System.out.println(new MedianOfTwoSortedArrays_4().findMedianSortedArrays(num1, num2));
}
}
| [
"[email protected]"
] | |
9c776e9cfc491af87608c5f4dbf46a889002bdaf | 725b0c33af8b93b557657d2a927be1361256362b | /com/planet_ink/coffee_mud/MOBS/GenDeity.java | 124579d6559e2a7263c92ab3c270e1c42125fcb6 | [
"Apache-2.0"
] | permissive | mcbrown87/CoffeeMud | 7546434750d1ae0418ac2c76d27f872106d2df97 | 0d4403d466271fe5d75bfae8f33089632ac1ddd6 | refs/heads/master | 2020-12-30T19:23:07.758257 | 2014-06-25T00:01:20 | 2014-06-25T00:01:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,423 | java | package com.planet_ink.coffee_mud.MOBS;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
/*
Copyright 2000-2014 Bo Zimmerman
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.
*/
public class GenDeity extends StdDeity
{
@Override public String ID(){return "GenDeity";}
public GenDeity()
{
super();
username="a generic deity";
setDescription("He is a run-of-the-mill deity.");
setDisplayText("A generic deity stands here.");
basePhyStats().setAbility(11); // his only off-default
recoverMaxState();
resetToMaxState();
recoverPhyStats();
recoverCharStats();
}
@Override public boolean isGeneric(){return true;}
@Override
public String text()
{
if(CMProps.getBoolVar(CMProps.Bool.MOBCOMPRESS))
miscText=CMLib.encoder().compressString(CMLib.coffeeMaker().getPropertiesStr(this,false));
else
miscText=CMLib.coffeeMaker().getPropertiesStr(this,false);
return super.text();
}
@Override
public void setMiscText(String newText)
{
super.setMiscText(newText);
CMLib.coffeeMaker().resetGenMOB(this,newText);
}
private final static String[] MYCODES={"CLERREQ","CLERRIT","WORREQ","WORRIT","SVCRIT"};
@Override
public String getStat(String code)
{
if(CMLib.coffeeMaker().getGenMobCodeNum(code)>=0)
return CMLib.coffeeMaker().getGenMobStat(this,code);
switch(getCodeNum(code))
{
case 0: return getClericRequirements();
case 1: return getClericRitual();
case 2: return getWorshipRequirements();
case 3: return getWorshipRitual();
case 4: return getServiceRitual();
default:
return CMProps.getStatCodeExtensionValue(getStatCodes(), xtraValues, code);
}
}
@Override
public void setStat(String code, String val)
{
if(CMLib.coffeeMaker().getGenMobCodeNum(code)>=0)
CMLib.coffeeMaker().setGenMobStat(this,code,val);
else
switch(getCodeNum(code))
{
case 0: setClericRequirements(val); break;
case 1: setClericRitual(val); break;
case 2: setWorshipRequirements(val); break;
case 3: setWorshipRitual(val); break;
case 4: setServiceRitual(val); break;
default:
CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
break;
}
}
@Override
protected int getCodeNum(String code)
{
for(int i=0;i<MYCODES.length;i++)
if(code.equalsIgnoreCase(MYCODES[i])) return i;
return -1;
}
private static String[] codes=null;
@Override
public String[] getStatCodes()
{
if(codes!=null) return codes;
final String[] MYCODES=CMProps.getStatCodesList(GenDeity.MYCODES,this);
final String[] superCodes=GenericBuilder.GENMOBCODES;
codes=new String[superCodes.length+MYCODES.length];
int i=0;
for(;i<superCodes.length;i++)
codes[i]=superCodes[i];
for(int x=0;x<MYCODES.length;i++,x++)
codes[i]=MYCODES[x];
return codes;
}
@Override
public boolean sameAs(Environmental E)
{
if(!(E instanceof GenDeity)) return false;
final String[] codes=getStatCodes();
for(int i=0;i<codes.length;i++)
if(!E.getStat(codes[i]).equals(getStat(codes[i])))
return false;
return true;
}
}
| [
"bo@0d6f1817-ed0e-0410-87c9-987e46238f29"
] | bo@0d6f1817-ed0e-0410-87c9-987e46238f29 |
7b4468322f60217d943e76f4872dabe02a861af8 | be54b2f131efe010ab55400810a07b9e512582cc | /demo/Jee/Spring_Hibernate/RestaurantManager/src/java/entities/Categorizetable.java | dbbad13a3df8b39310cc8799f0e1af1e9670392c | [] | no_license | phuongGH/java | 4572ef8b96aac0e2a3abb039b371f6ecfbc33db3 | b8230dadfb8c79e69198d8351bdf3566533a5aa2 | refs/heads/master | 2021-01-02T08:39:53.308836 | 2015-03-30T22:58:57 | 2015-03-30T22:58:57 | 33,132,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package entities;
// Generated Jul 30, 2014 10:45:27 PM by Hibernate Tools 3.6.0
import java.util.HashSet;
import java.util.Set;
/**
* Categorizetable generated by hbm2java
*/
public class Categorizetable implements java.io.Serializable {
private Integer categorizeTableId;
private String categorizeTableName;
private String description;
private Set tableTs = new HashSet(0);
public Categorizetable() {
}
public Categorizetable(String description) {
this.description = description;
}
public Categorizetable(String categorizeTableName, String description, Set tableTs) {
this.categorizeTableName = categorizeTableName;
this.description = description;
this.tableTs = tableTs;
}
public Integer getCategorizeTableId() {
return this.categorizeTableId;
}
public void setCategorizeTableId(Integer categorizeTableId) {
this.categorizeTableId = categorizeTableId;
}
public String getCategorizeTableName() {
return this.categorizeTableName;
}
public void setCategorizeTableName(String categorizeTableName) {
this.categorizeTableName = categorizeTableName;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public Set getTableTs() {
return this.tableTs;
}
public void setTableTs(Set tableTs) {
this.tableTs = tableTs;
}
}
| [
"[email protected]"
] | |
801526001ecb2737dc2261ca466ad1d9e2c24782 | 5de63a6ea4a86c68ee6dcee6133cb3610d87ad8e | /wxxr-mobile-client/wxxr-mobile-communicationhelper-android-quanguo/src/com/wxxr/callhelper/qg/widget/ResizeLayout.java | 5b8b9bb497d734e16971cc84aa93ada8db575e7f | [] | no_license | richie1412/git_hub_rep | 487702601cc655f0213c6a601440a66fba14080b | 633be448911fed685139e19e66c6c54d21df7fe3 | refs/heads/master | 2016-09-05T14:37:19.096475 | 2014-07-18T01:52:03 | 2014-07-18T01:52:03 | 21,963,815 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,029 | java | package com.wxxr.callhelper.qg.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
/**
*
* 自定义的view,为了监听高度的变化,来判断键盘的显示和隐藏
*
* @since 1.0
*/
public class ResizeLayout extends LinearLayout{
private OnResizeListener mListener;
private static final int BIGGER = 1;
private static final int SMALLER = 2;
private static final int MSG_RESIZE = 1;
public interface OnResizeListener {
void OnResize(int w, int h, int oldw, int oldh);
}
public void setOnResizeListener(OnResizeListener l) {
mListener = l;
}
public ResizeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (mListener != null) {
mListener.OnResize(w, h, oldw, oldh);
}
}
} | [
"[email protected]"
] | |
a0e8ca8a30e386b3153beee6c19753d1e86726df | 7761c124eaec8e60504fc7bb27dbf136dde0bd4b | /map_application_android/app/src/main/java/finki/ukim/mk/map_application/DeleteAlertDialog.java | 8d46b70e81ca3e1c4b113a0eb99aa84aeba53766 | [] | no_license | vblazhes/map-app-stack | c45f4ccf297a8c8f4a4ccced0fc15a03ffdecfee | 47d40a54050ae5fa4bbe4572f011cd1db91a4eff | refs/heads/master | 2022-12-21T10:06:18.940338 | 2020-09-22T19:25:44 | 2020-09-22T19:25:44 | 297,743,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,179 | java | package finki.ukim.mk.map_application;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDialogFragment;
public class DeleteAlertDialog extends AppCompatDialogFragment {
private DeleteAlertDialogListener listener;
private int POSITION;
public static DeleteAlertDialog newInstance(int position) {
Bundle args = new Bundle();
args.putInt("position", position);
DeleteAlertDialog fragment = new DeleteAlertDialog();
fragment.setArguments(args);
return fragment;
}
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
// return super.onCreateDialog(savedInstanceState);
POSITION = getArguments().getInt("position");
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Delete")
.setMessage("Are you sure you want to delete this map?")
.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setPositiveButton("yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
listener.onYesClicked(POSITION);
}
});
return builder.create();
}
public interface DeleteAlertDialogListener{
void onYesClicked(int position);
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
try {
listener = (DeleteAlertDialogListener) context;
}catch (ClassCastException e){
throw new ClassCastException(context.toString()
+" must implement DeleteAlertDialogListener");
}
}
}
| [
"[email protected]"
] | |
0b24cc26d755186e1d78588ee93b080f0200e569 | 26639ec8cc9e12a3f3aa4911f217a2a5d381a870 | /.svn/pristine/0b/0b24cc26d755186e1d78588ee93b080f0200e569.svn-base | cf6f5d8428da33e6c63bd778aab99399a5e4f63d | [] | no_license | shaojava/v3.6.3 | a8b4d587a48ec166d21bfe791897c6bacced2119 | 8c2352d67c2282fc587fc90686936e6ce451eb00 | refs/heads/master | 2021-12-15T02:59:25.593407 | 2017-07-24T05:55:49 | 2017-07-24T05:55:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,600 | /*
Copyright (c) 2011 Rapture In Venice
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 com.jinr.graph_view;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.animation.AlphaAnimation;
import android.widget.*;
public class WebImageView extends ImageView {
public String urlString;
AlphaAnimation animation;
private SharedPreferences shared;
private SharedPreferences.Editor editor;
public WebImageView(Context context) {
super(context);
}
public WebImageView(Context context, AttributeSet attSet) {
super(context, attSet);
animation = new AlphaAnimation(0, 1);
animation.setDuration(500);//设置动画持续时间
}
public WebImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public static void setMemoryCachingEnabled(boolean enabled) {
WebImageCache.setMemoryCachingEnabled(enabled);
}
public static void setDiskCachingEnabled(boolean enabled) {
WebImageCache.setDiskCachingEnabled(enabled);
}
public static void setDiskCachingDefaultCacheTimeout(int seconds) {
WebImageCache.setDiskCachingDefaultCacheTimeout(seconds);
}
@Override
public void onDetachedFromWindow() {
// cancel loading if view is removed
cancelCurrentLoad();
}
public void setImageWithURL(Context context, String urlString, Drawable placeholderDrawable, int diskCacheTimeoutInSeconds) {
if (urlString != null )
{
if (null != this.urlString && urlString.compareTo(this.urlString) == 0)
{
return;
}
final WebImageManager mgr = WebImageManager.getInstance();
if(null != this.urlString)
{
cancelCurrentLoad();
}
setImageDrawable(placeholderDrawable);
this.urlString = urlString;
mgr.downloadURL(context, urlString, WebImageView.this, diskCacheTimeoutInSeconds);
}
}
public void setImageWithURL(Context context, String urlString, Drawable placeholderDrawable) {
setImageWithURL(context, urlString, placeholderDrawable, -1);
}
// public void setImageWithURL(final Context context, final String urlString, int diskCacheTimeoutInSeconds) {
// setImageWithURL(context, urlString, null, diskCacheTimeoutInSeconds);
// }
public void setImageWithURL(final Context context, final String urlString, int resId)
{
Resources rsrc = this.getResources();
Drawable placeholderDrawable = rsrc.getDrawable(resId);
setImageWithURL(context, urlString, placeholderDrawable, -1);
}
public void setImageWithURL(final Context context, final String urlString, int resId,int diskCacheTimeoutInSeconds)
{
Resources rsrc = this.getResources();
Drawable placeholderDrawable = rsrc.getDrawable(resId);
setImageWithURL(context, urlString, placeholderDrawable, diskCacheTimeoutInSeconds);
}
public void setImageWithURL(final Context context, final String urlString) {
setImageWithURL(context, urlString, null, -1);
}
public void cancelCurrentLoad() {
WebImageManager mgr = WebImageManager.getInstance();
// cancel any existing request
mgr.cancelForWebImageView(this);
}
@Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
this.startAnimation(animation);
}
}
| [
"[email protected]"
] | ||
8fc6508c7689edd96ac0bde9daa7459d320b8013 | bac897b6c61d8c4e31e3542da20bd4d360cda98c | /src/main/java/daily_coding_challenges/Prob118_Sorted_Squares_List.java | 1e98989b4b5f7f0b220e775cd9fb811d9a204c55 | [] | no_license | prathameshtajane/java-coding-practice | 9dd76cd9b038e66058877d1264fa8a349ace20ec | 4b03be0c65d4eee21e20a7a7c19e4271e268b15b | refs/heads/master | 2020-04-03T17:44:39.522101 | 2019-02-14T03:47:00 | 2019-02-14T03:47:00 | 155,457,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,965 | java | package daily_coding_challenges;
/*
This problem was asked by Google.
Given a sorted list of integers, square the elements and give the output in sorted order.
For example, given [-9, -2, 0, 2, 3], return [0, 4, 4, 9, 81].
*/
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Prob118_Sorted_Squares_List {
//Brute force approach
//Time complexity : O(nlogn)
//Space complexity : O(1)
private static List<Integer> sortedSquresList(List<Integer> input_list){
//calculate squares of each number in list
for(int i = 0;i<input_list.size() ;i++){
input_list.set(i,(int) Math.pow(input_list.get(i),2));
}
//sorting
Collections.sort(input_list);
return input_list;
}
//Linear approach
//Time complexity : O(n)
//Space complexity : O(n)
private static List<Integer> sortedSquresListLinear(List<Integer> input_list){
int p1 = 0;
int p2 = input_list.size()-1;
int op_list_index = input_list.size();
Integer[] op_arr = new Integer[op_list_index];
--op_list_index;
while(p2 >= p1){
if(Math.abs(input_list.get(p1)) >= Math.abs(input_list.get(p2))){
op_arr[op_list_index]=(int)Math.pow(input_list.get(p1),2);
p1++;
}else{
op_arr[op_list_index]=(int)Math.pow(input_list.get(p2),2);
p2--;
}
op_list_index--;
}
return Arrays.asList(op_arr);
}
public static void main(String[] args) {
System.out.println("Sorted Squares List");
Integer[] input = {-9, -2, 0, 2, 3};
// for(Integer each :sortedSquresList(Arrays.asList(input))){
// System.out.println(each);
// }
for(Integer each :sortedSquresListLinear(Arrays.asList(input))){
System.out.println(each);
}
}
}
| [
"[email protected]"
] | |
3b92be5f4d072686fd5f0eb6ab113c4f44000dd4 | ef3632a70d37cfa967dffb3ddfda37ec556d731c | /aws-java-sdk-omics/src/main/java/com/amazonaws/services/omics/model/transform/ImportReadSetSourceItemMarshaller.java | c3c84fc4b4eec08a543cfe2e6c3486c61bab222e | [
"Apache-2.0"
] | permissive | ShermanMarshall/aws-sdk-java | 5f564b45523d7f71948599e8e19b5119f9a0c464 | 482e4efb50586e72190f1de4e495d0fc69d9816a | refs/heads/master | 2023-01-23T16:35:51.543774 | 2023-01-19T03:21:46 | 2023-01-19T03:21:46 | 134,658,521 | 0 | 0 | Apache-2.0 | 2019-06-12T21:46:58 | 2018-05-24T03:54:38 | Java | UTF-8 | Java | false | false | 5,237 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.omics.model.transform;
import java.util.Map;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.omics.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* ImportReadSetSourceItemMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ImportReadSetSourceItemMarshaller {
private static final MarshallingInfo<String> DESCRIPTION_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("description").build();
private static final MarshallingInfo<String> GENERATEDFROM_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("generatedFrom").build();
private static final MarshallingInfo<String> NAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("name").build();
private static final MarshallingInfo<String> REFERENCEARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("referenceArn").build();
private static final MarshallingInfo<String> SAMPLEID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("sampleId").build();
private static final MarshallingInfo<String> SOURCEFILETYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("sourceFileType").build();
private static final MarshallingInfo<StructuredPojo> SOURCEFILES_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("sourceFiles").build();
private static final MarshallingInfo<String> STATUS_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("status").build();
private static final MarshallingInfo<String> STATUSMESSAGE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("statusMessage").build();
private static final MarshallingInfo<String> SUBJECTID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("subjectId").build();
private static final MarshallingInfo<Map> TAGS_BINDING = MarshallingInfo.builder(MarshallingType.MAP).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("tags").build();
private static final ImportReadSetSourceItemMarshaller instance = new ImportReadSetSourceItemMarshaller();
public static ImportReadSetSourceItemMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(ImportReadSetSourceItem importReadSetSourceItem, ProtocolMarshaller protocolMarshaller) {
if (importReadSetSourceItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(importReadSetSourceItem.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getGeneratedFrom(), GENERATEDFROM_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getName(), NAME_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getReferenceArn(), REFERENCEARN_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getSampleId(), SAMPLEID_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getSourceFileType(), SOURCEFILETYPE_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getSourceFiles(), SOURCEFILES_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getStatusMessage(), STATUSMESSAGE_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getSubjectId(), SUBJECTID_BINDING);
protocolMarshaller.marshall(importReadSetSourceItem.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
81ac8fb6f5194eaae5994f90854fe7064fcddce6 | cd4d970e33f963512005dccbae10e445e7f518d4 | /src/com/hy/xp/app/XApplication.java | 7d9fa2bb8d568f16981aea42697ba92cf75975be | [] | no_license | tianqiwangpai/xprivacy_mastor | ea9139e2b88dcefb5a2dd3b814d373c949130de4 | 38b18c357071bcebde3ccfe08d1c93a57f7e6761 | refs/heads/master | 2016-08-03T23:07:02.058757 | 2015-10-22T11:50:58 | 2015-10-22T11:50:58 | 40,159,189 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,707 | java | package com.hy.xp.app;
import java.util.ArrayList;
import java.util.List;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Process;
import android.util.Log;
public class XApplication extends XHook
{
private Methods mMethod;
private static boolean mReceiverInstalled = false;
public static String cAction = "Action";
public static String cActionKillProcess = "Kill";
public static String cActionFlush = "Flush";
public static String ACTION_MANAGE_PACKAGE = "com.hy.xp.app.ACTION_MANAGE_PACKAGE";
public static String PERMISSION_MANAGE_PACKAGES = "com.hy.xp.app.MANAGE_PACKAGES";
public XApplication(Methods method, String restrictionName, String actionName)
{
super(restrictionName, method.name(), actionName);
mMethod = method;
}
@Override
public String getClassName()
{
return "android.app.Application";
}
// public void onCreate()
// frameworks/base/core/java/android/app/Application.java
// http://developer.android.com/reference/android/app/Application.html
private enum Methods {
onCreate
};
public static List<XHook> getInstances()
{
List<XHook> listHook = new ArrayList<XHook>();
listHook.add(new XApplication(Methods.onCreate, null, null));
return listHook;
}
@Override
protected void before(XParam param) throws Throwable
{
// do nothing
}
@Override
protected void after(XParam param) throws Throwable
{
switch (mMethod) {
case onCreate:
// Install receiver for package management
if (PrivacyManager.isApplication(Process.myUid()) && !mReceiverInstalled)
try {
Application app = (Application) param.thisObject;
if (app != null) {
mReceiverInstalled = true;
Util.log(this, Log.INFO, "Installing receiver uid=" + Process.myUid());
app.registerReceiver(new Receiver(app), new IntentFilter(ACTION_MANAGE_PACKAGE), PERMISSION_MANAGE_PACKAGES, null);
}
} catch (SecurityException ignored) {
} catch (Throwable ex) {
Util.bug(this, ex);
}
break;
}
}
public static void manage(Context context, int uid, String action)
{
if (uid == 0)
manage(context, null, action);
else {
String[] packageName = context.getPackageManager().getPackagesForUid(uid);
if (packageName != null && packageName.length > 0)
manage(context, packageName[0], action);
else
Util.log(null, Log.WARN, "No packages uid=" + uid + " action=" + action);
}
}
public static void manage(Context context, String packageName, String action)
{
Util.log(null, Log.INFO, "Manage package=" + packageName + " action=" + action);
if (packageName == null && XApplication.cActionKillProcess.equals(action)) {
Util.log(null, Log.WARN, "Kill all");
return;
}
Intent manageIntent = new Intent(XApplication.ACTION_MANAGE_PACKAGE);
manageIntent.putExtra(XApplication.cAction, action);
if (packageName != null)
manageIntent.setPackage(packageName);
context.sendBroadcast(manageIntent);
}
private class Receiver extends BroadcastReceiver
{
public Receiver(Application app)
{
}
@Override
public void onReceive(Context context, Intent intent)
{
try {
String action = intent.getExtras().getString(cAction);
Util.log(null, Log.WARN, "Managing uid=" + Process.myUid() + " action=" + action);
if (cActionKillProcess.equals(action))
android.os.Process.killProcess(Process.myPid());
else if (cActionFlush.equals(action)) {
PrivacyManager.flush();
} else
Util.log(null, Log.WARN, "Unknown management action=" + action);
} catch (Throwable ex) {
Util.bug(null, ex);
}
}
}
}
| [
"[email protected]"
] | |
72ce9d5243d0430c19a9cf97f084b9284c02c4fb | 4ab1b890fcfcdbe2f29990f151b3d491b7a68958 | /EngineerMode/src/com/mediatek/engineermode/dualtalknetworkinfo/NetworkInfoSimType.java | 61230af4717fc58f55768508d3d33657e9a296d9 | [
"Apache-2.0"
] | permissive | Herrie82/android_device_wileyfox_porridge_x32 | 4455d5262fc984e2af547a7d540da4a63c625dc9 | e9d017148265859f43b75a851b5bbaaeab608fda | refs/heads/master | 2020-07-24T00:47:06.761679 | 2019-09-11T07:43:02 | 2019-09-11T07:43:02 | 207,752,981 | 0 | 0 | Apache-2.0 | 2019-09-11T07:42:21 | 2019-09-11T07:42:21 | null | UTF-8 | Java | false | false | 4,589 | java | /* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
package com.mediatek.engineermode.dualtalknetworkinfo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.android.internal.telephony.PhoneConstants;
import com.mediatek.engineermode.R;
import java.util.ArrayList;
public class NetworkInfoSimType extends Activity implements OnItemClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dualtalk_networkinfo);
ListView simTypeListView = (ListView) findViewById(R.id.ListView_dualtalk_networkinfo);
ArrayList<String> items = new ArrayList<String>();
items.add(getString(R.string.networkinfo_sim1));
items.add(getString(R.string.networkinfo_sim2));
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, items);
simTypeListView.setAdapter(adapter);
simTypeListView.setOnItemClickListener(this);
}
/**
* @see android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget.AdapterView,
* android.view.View, int, long)
* @param arg0
* the Adapter for parent
* @param arg1
* the View to display
* @param position
* the integer of item position
* @param arg3
* the long of ignore
*/
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
Intent intent = new Intent();
int simType;
switch (position) {
case 0:
intent.setClassName(this,
"com.mediatek.engineermode.networkinfo.NetworkInfo");
simType = PhoneConstants.SIM_ID_1;
intent.putExtra("mSimType", simType);
break;
case 1:
intent.setClassName(this,
"com.mediatek.engineermode.networkinfo.NetworkInfo");
simType = PhoneConstants.SIM_ID_2;
intent.putExtra("mSimType", simType);
break;
default:
break;
}
this.startActivity(intent);
}
}
| [
"[email protected]"
] | |
b5cdefb60d421430e5d8f481bba9e632d544118b | 59e6dc1030446132fb451bd711d51afe0c222210 | /components/webapp-mgt/org.wso2.carbon.jaxws.webapp.mgt.ui/4.2.0/src/main/java/org/wso2/carbon/jaxws/webapp/mgt/ui/JaxwsWebappAdminClient.java | 63e8544946f00c36941bdf53948df1e941606506 | [] | no_license | Alsan/turing-chunk07 | 2f7470b72cc50a567241252e0bd4f27adc987d6e | e9e947718e3844c07361797bd52d3d1391d9fb5e | refs/heads/master | 2020-05-26T06:20:24.554039 | 2014-02-07T12:02:53 | 2014-02-07T12:02:53 | 38,284,349 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,722 | java | /*
* Copyright 2004,2005 The Apache Software Foundation.
*
* 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.wso2.carbon.jaxws.webapp.mgt.ui;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.webapp.mgt.stub.WebappAdminStub;
import org.wso2.carbon.webapp.mgt.stub.types.carbon.SessionsWrapper;
import org.wso2.carbon.webapp.mgt.stub.types.carbon.WebappMetadata;
import org.wso2.carbon.webapp.mgt.stub.types.carbon.WebappUploadData;
import org.wso2.carbon.webapp.mgt.stub.types.carbon.WebappsWrapper;
import javax.activation.DataHandler;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.rmi.RemoteException;
import java.util.Locale;
import java.util.ResourceBundle;
/**
* Client which communicates with the JaxwsWebappAdmin service
*/
public class JaxwsWebappAdminClient {
public static final String BUNDLE = "org.wso2.carbon.jaxws.webapp.mgt.ui.i18n.Resources";
public static final int MILLISECONDS_PER_MINUTE = 60 * 1000;
private static final Log log = LogFactory.getLog(JaxwsWebappAdminClient.class);
private ResourceBundle bundle;
public WebappAdminStub stub;
public JaxwsWebappAdminClient(String cookie,
String backendServerURL,
ConfigurationContext configCtx,
Locale locale) throws AxisFault {
String serviceURL = backendServerURL + "JaxwsWebappAdmin";
bundle = ResourceBundle.getBundle(BUNDLE, locale);
stub = new WebappAdminStub(configCtx, serviceURL);
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
option.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
}
public void uploadWebapp(WebappUploadData [] webappUploadDataList) throws AxisFault {
try {
stub.uploadWebapp(webappUploadDataList);
} catch (RemoteException e) {
handleException("cannot.upload.webapps", e);
}
}
private void handleException(String msgKey, Exception e) throws AxisFault {
String msg = bundle.getString(msgKey);
log.error(msg, e);
throw new AxisFault(msg, e);
}
}
| [
"[email protected]"
] | |
73ad88858890df10f40f1d67aa2950f9641d3ef9 | 075fcfbbb498f8cd7373a9c165cd56b952af25b8 | /src/Work/PR_work_8/State/Developer.java | 385a5f4f6bca0c0ae80bbda4fcbdd6023259c828 | [] | no_license | gmom-cyber/newJava | ab0b02b55d7d5c6d5495a1ec6438cacba781b54f | e1d42fd3ccc27167385644de313231a9b46a6361 | refs/heads/main | 2023-05-07T01:48:18.207083 | 2021-06-03T15:20:54 | 2021-06-03T15:20:54 | 338,027,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package Work.PR_work_8.State;
public class Developer {
Activity activity;
public Developer() {
}
public void setActivity(Activity activity) {
this.activity = activity;
}
public void changeActivity(){
if(activity instanceof Sleeping){
setActivity(new Training());
}else if(activity instanceof Training){
setActivity(new Writing());
}else if (activity instanceof Writing){
setActivity(new Reading());
}else if (activity instanceof Reading){
setActivity(new Sleeping());
}
}
void justDoIt(){
activity.jastDoIt();
}
}
| [
"[email protected]"
] | |
8b65a9a938980ad342bed060bdb6a8962ad38a87 | 94e335aac5905bdcbcfc86988bfaa7c7086d4322 | /src/JavaStart10/homework/pojazdyWypozyczalnia/Person.java | 64c842bded99b031eb0d7dbbb924cde77b3996af | [] | no_license | ToFatToBat/JavaStart | da6ddaae9ef44f6a336f7367b7e1859b7d995c92 | 5486660206df70a55079e517ca09eb3f17ae9c45 | refs/heads/master | 2022-11-25T15:31:52.899955 | 2020-07-28T20:04:20 | 2020-07-28T20:04:20 | 275,402,585 | 0 | 0 | null | 2020-07-28T20:04:21 | 2020-06-27T15:41:59 | Java | UTF-8 | Java | false | false | 681 | java | package JavaStart10.homework.pojazdyWypozyczalnia;
public class Person {
private String firsName;
private String lastName;
private int id;
public String getFirsName() {
return firsName;
}
public String getLastName() {
return lastName;
}
public int getId() {
return id;
}
public Person(String firsName, String lastName, int id) {
this.firsName = firsName;
this.lastName = lastName;
this.id = id;
}
@Override
public String toString() {
return "firsName= " + firsName + '\n' +
"lastName= " + lastName + '\n' +
"id= " + id + '\n';
}
}
| [
"[email protected]"
] | |
54c6b0e2485f97bbcdc41192d1d864d147f1ea66 | 650f7ce2090a2e91c11b2a42b3c85f3d4ef5a36b | /src/main/java/com/allcoolboys/flyweight/v2/Character.java | a3bfbfed7ac1b6331986b39698a2ee9586d173c1 | [
"Apache-2.0"
] | permissive | cokestewpotato/DesignPatterns | 04cb142eb4ca4a48ba5f638b429eb4bdb43d3a5d | a56575699acc684c23d33e51e10011209bb46db7 | refs/heads/main | 2022-12-31T13:01:34.712503 | 2020-10-25T14:18:50 | 2020-10-25T14:18:50 | 306,099,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.allcoolboys.flyweight.v2;
/**
* 享元抽象:字符
* 单纯享元模式:FlyWeight子类都可以被共享,那就是所有的享元对象都可以被共享
* @author coolboy
*/
public abstract class Character {
/**
* 抽象的业务逻辑方法,接受外部状态作为参数
* @param outerState
*/
abstract void display(String outerState);
}
| [
"[email protected]"
] | |
ca3eb5e6459d322a8a87ec6951fdd87f0da61750 | 79cc848fc081f2f2b1eb42d229ef380890e9bc4f | /Falling-Ball/src/Box.java | 13ed3c9efa5359682d402ee9eadf16ca441000ea | [] | no_license | papanmanna/My_Code | 4367db81d854eff89b4529c719ba13c2ec373863 | c7943e4e47957696d23b8553968404a65c9be765 | refs/heads/master | 2021-01-21T11:49:46.520293 | 2017-08-31T17:29:44 | 2017-08-31T17:29:44 | 102,025,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 174 | java | import java.awt.Color;
import java.awt.Graphics;
public class Box {
public void paint(Graphics g) {
g.setColor(Color.red);
g.fillRect(145,300, 80, 80);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.