blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
7079b46b191a16bd85aed91eb173d2c86bca2e43
a112b1b6ae1a435211dc5c3c682ba082c01c8be3
/TestReptile1/src/main/java/com/wdx/utils/MyInitialize.java
c950b31f9a04859a06d3913e7c578f2a6bab3f38
[]
no_license
wdx-7929/testReptile
267cfc3d1a5eb0a68771d29bb1c1497bcb624840
7c8c55d6b77570e86e244a07ba1ed6b465cb9108
refs/heads/master
2022-09-27T00:35:25.433702
2019-09-10T09:18:49
2019-09-10T09:18:49
206,728,861
0
0
null
2022-09-01T23:12:34
2019-09-06T06:34:43
Java
UTF-8
Java
false
false
1,571
java
package com.wdx.utils; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; class MyInitialize { private final static String[] str = { "1","2","3","4","5","6","7","8","9","0", "q","w","e","r","t","y","u","i","o","p", "a","s","d","f","g","h","j","k","l","z", "x","c","v","b","n","m","Q","W","E","R", "T","Y","U","I","O","P","A","S","D","F", "G","H","J","K","L","Z","X","C","V","B","N","M"}; static int count = 0; private List<Queue<StringBuffer>> queueList = new ArrayList<Queue<StringBuffer>>(); private Queue<String> qBuffers = new ConcurrentLinkedQueue<String>(); private FileWriter fw; public MyInitialize() throws IOException { for(int i = 0;i < 6; i++){ queueList.add(new ConcurrentLinkedQueue<StringBuffer>()); } } public List<Queue<StringBuffer>> getQueueList() { return queueList; } public void setQueueList(List<Queue<StringBuffer>> queueList) { this.queueList = queueList; } public FileWriter getfw() throws IOException { fw = new FileWriter("Text.txt",true); return fw; } public void setfw(FileWriter fw) { this.fw = fw; } public static String[] getStr() { return str; } public Queue<String> getqBuffers() { return qBuffers; } public void setqBuffers(Queue<String> qBuffers) { this.qBuffers = qBuffers; } public void close() throws IOException{ this.fw.flush(); this.fw.close(); } }
[ "792973226@qq.com" ]
792973226@qq.com
834a7fbd546c7a42ed7804dd70bd289af28fc4cb
11628c171eb21c1fbfc267cbb2e7d9de7e1a2bb9
/src/AlternativeBody.java
8b15f506f1fd16acec2be559beeab1ddc76edfc8
[]
no_license
gezelligheid/TitanIntellij
6833f8d090479d8fbc062c0cf65326ffeee73e70
5f91abfd721a1c9dfc1e8a952c8a4157eb084f0a
refs/heads/master
2020-05-09T10:25:29.338982
2019-07-15T12:00:54
2019-07-15T12:00:54
181,041,629
0
0
null
null
null
null
UTF-8
Java
false
false
6,038
java
import java.util.List; public class AlternativeBody { String name; // bodyName Vector position; // meters private Vector velocity; // meters per second private double mass; // kilograms private double radius; // meters private double fuelMass; // private final double SPECIFIC_IMPULSE = 3000; // m/s public AlternativeBody(String name, Vector position, Vector velocity, double mass, double radius) { this.name = name; this.position = position; this.velocity = velocity; this.mass = mass; this.radius = radius; } /** * computes total acceleration influence from a list of bodies on the body passed as a parameter * * @param solarSystem all body influencing this body * @return acceleration resulting from all gravitational forces */ public Vector compute_acceleration(List<AlternativeBody> solarSystem) throws CloneNotSupportedException { Vector resultAcceleration = new Vector(0, 0, 0); for (AlternativeBody body : solarSystem ) { if (!this.name.equals(body.name)) { final Vector distances = ((Vector) body.position.clone()).subtract(this.position); Vector normDistances = ((Vector) distances.clone()).normalize(); Vector currentAcceleration = normDistances.multiply((Physics.G * body.mass) / distances.squareLength()); resultAcceleration.add(currentAcceleration); } } return resultAcceleration; } /** * moves the body under influence of a list of other mass objects * * @param dt time step * @param alternativeBodies the other mass objects */ public void step(double dt, List<AlternativeBody> alternativeBodies) throws CloneNotSupportedException { final Vector k1Pos = (Vector) this.velocity.clone(); // k1 for the change in position vector final Vector k1Vel = this.compute_acceleration(alternativeBodies);// k1 for the change velocity vector final Vector k2Pos = ((Vector) this.velocity.clone()).sum(((Vector) k1Vel.clone()).multiply(dt / 2)); // object is introduced for the accelaration method to work AlternativeBody k1StateBody = new AlternativeBody(this.name, ((Vector) this.position.clone()).sum(((Vector) k1Pos.clone()).multiply(dt / 2)), this.velocity, this.mass, this.radius); final Vector k2Vel = k1StateBody.compute_acceleration(alternativeBodies); final Vector k3Pos = ((Vector) this.velocity.clone()).sum(((Vector) k2Vel.clone()).multiply(dt / 2)); AlternativeBody k2StateBody = new AlternativeBody(this.name, ((Vector) this.position.clone()).sum(((Vector) k2Pos.clone()).multiply(dt / 2)), this.velocity, this.mass, this.radius); final Vector k3Vel = k2StateBody.compute_acceleration(alternativeBodies); final Vector k4Pos = ((Vector) this.velocity.clone()).sum(((Vector) k3Vel.clone()).multiply(dt)); AlternativeBody k3StateBody = new AlternativeBody(this.name, ((Vector) this.position.clone()).sum(((Vector) k3Pos.clone()).multiply(dt)), this.velocity, this.mass, this.radius); final Vector k4Vel = k3StateBody.compute_acceleration(alternativeBodies); Vector kPosTotal = new Vector(0, 0, 0); Vector kVelTotal = new Vector(0, 0, 0); kPosTotal.add(k1Pos); // Runge-Kutta coefficient sums kPosTotal.add(((Vector) k2Pos.clone()).multiply(2.0)); kPosTotal.add(((Vector) k3Pos.clone()).multiply(2.0)); kPosTotal.add(k4Pos); kPosTotal.scale((double) dt / 6); kVelTotal.add(k1Vel); kVelTotal.add(((Vector) k2Vel.clone()).multiply(2.0)); kVelTotal.add(((Vector) k3Vel.clone()).multiply(2.0)); kVelTotal.add(k4Vel); kVelTotal.scale((double) dt / 6); this.position.add(kPosTotal); // add the change this.velocity.add(kVelTotal); } /** * verifies that a closeness between bodies is reached * * @param distance threshold distance * @param body1 * @param body2 */ public boolean isWithinDistance(double distance, AlternativeBody body1, AlternativeBody body2) throws CloneNotSupportedException { Vector position1 = (Vector) body1.getPosition().clone(); Vector position2 = (Vector) body2.getPosition().clone(); return position1.distance(position2) <= distance; } /** * manipulates the velocity of the spacecraft in specified x, y, z directions. * additionally calculates the fuel consumed to accomplish this according to the Tsiolkovski * equation * * @param d2x change in x speed * @param d2y change in y speed * @param d2z change in z speed */ public void addImpulse(double d2x, double d2y, double d2z) { double absoluteTotalVelChange = Math.sqrt(Math.pow(d2x, 2) + Math.pow(d2y, 2) + Math.pow(d2z, 2)); double newMassTotal = (mass + fuelMass) * Math.exp(-(absoluteTotalVelChange / SPECIFIC_IMPULSE)); // check if sufficient fuel is available try { if (newMassTotal >= mass) { fuelMass = newMassTotal - mass; this.velocity.setX(velocity.getX() + d2x); this.velocity.setY(velocity.getY() + d2y); this.velocity.setZ(velocity.getZ() + d2z); } else throw new ArithmeticException(); } catch (ArithmeticException exception) { System.out.println("not enough fuel"); } } public Vector getPosition() { return position; } public String getName() { return name; } public Vector getVelocity() { return velocity; } public void setVelocity(Vector velocity) { this.velocity = velocity; } public double getFuelMass() { return fuelMass; } public void setFuelMass(double fuelMass) { this.fuelMass = fuelMass; } }
[ "ayvr015@gmail.com" ]
ayvr015@gmail.com
d8fca6ccba1c1d6a9737533b6545ae2072747aec
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
/src/number_of_direct_superinterfaces/i19330.java
606689b09856f182195f81a5192212748089610e
[]
no_license
vincentclee/jvm-limits
b72a2f2dcc18caa458f1e77924221d585f23316b
2fd1c26d1f7984ea8163bc103ad14b6d72282281
refs/heads/master
2020-05-18T11:18:41.711400
2014-09-14T04:25:18
2014-09-14T04:25:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
69
java
package number_of_direct_superinterfaces; public interface i19330 {}
[ "vincentlee.dolbydigital@yahoo.com" ]
vincentlee.dolbydigital@yahoo.com
b8611e603d4cf83db8913e923c4d9472ef59b106
faa7cf126d648c54ee4ec741f3af74b86a64c2be
/src/test/java/com/kodebyt/api/web/rest/CustomerResourceIT.java
926f6ace2e03b9874be543dccdb4f7fa9a7a806d
[]
no_license
techragesh/springdemojhipster
34408d7056f872522a503183f923ff389c68a738
9fe7064bce2a75d89cf1f7348a5542a16c13111e
refs/heads/master
2023-01-31T08:53:12.885374
2020-12-17T14:24:52
2020-12-17T14:24:52
322,318,474
0
0
null
null
null
null
UTF-8
Java
false
false
17,308
java
package com.kodebyt.api.web.rest; import com.kodebyt.api.SpringdemojhipsterApp; import com.kodebyt.api.domain.Customer; import com.kodebyt.api.repository.CustomerRepository; import com.kodebyt.api.service.CustomerService; import com.kodebyt.api.service.dto.CustomerDTO; import com.kodebyt.api.service.mapper.CustomerMapper; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.servlet.MockMvc; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.time.LocalDate; import java.time.ZoneId; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import com.kodebyt.api.domain.enumeration.Gender; /** * Integration tests for the {@link CustomerResource} REST controller. */ @SpringBootTest(classes = SpringdemojhipsterApp.class) @AutoConfigureMockMvc @WithMockUser public class CustomerResourceIT { private static final String DEFAULT_NAME = "AAAAAAAAAA"; private static final String UPDATED_NAME = "BBBBBBBBBB"; private static final String DEFAULT_EMAIL = "AAAAAAAAAA"; private static final String UPDATED_EMAIL = "BBBBBBBBBB"; private static final String DEFAULT_PHONE_NUMBER = "AAAAAAAAAA"; private static final String UPDATED_PHONE_NUMBER = "BBBBBBBBBB"; private static final Gender DEFAULT_GENDER = Gender.FEMALE; private static final Gender UPDATED_GENDER = Gender.MALE; private static final String DEFAULT_DOB = "AAAAAAAAAA"; private static final String UPDATED_DOB = "BBBBBBBBBB"; private static final String DEFAULT_ADDRESS_LINE_1 = "AAAAAAAAAA"; private static final String UPDATED_ADDRESS_LINE_1 = "BBBBBBBBBB"; private static final String DEFAULT_ADDRESS_LINE_2 = "AAAAAAAAAA"; private static final String UPDATED_ADDRESS_LINE_2 = "BBBBBBBBBB"; private static final String DEFAULT_ADDRESS_LINE_3 = "AAAAAAAAAA"; private static final String UPDATED_ADDRESS_LINE_3 = "BBBBBBBBBB"; private static final String DEFAULT_ADDRESS_LINE_4 = "AAAAAAAAAA"; private static final String UPDATED_ADDRESS_LINE_4 = "BBBBBBBBBB"; private static final String DEFAULT_TOWN_CITY = "AAAAAAAAAA"; private static final String UPDATED_TOWN_CITY = "BBBBBBBBBB"; private static final String DEFAULT_ZIP = "AAAAAAAAAA"; private static final String UPDATED_ZIP = "BBBBBBBBBB"; private static final String DEFAULT_STATE = "AAAAAAAAAA"; private static final String UPDATED_STATE = "BBBBBBBBBB"; private static final String DEFAULT_COUNTRY = "AAAAAAAAAA"; private static final String UPDATED_COUNTRY = "BBBBBBBBBB"; private static final LocalDate DEFAULT_CREATE_DATE = LocalDate.ofEpochDay(0L); private static final LocalDate UPDATED_CREATE_DATE = LocalDate.now(ZoneId.systemDefault()); private static final LocalDate DEFAULT_MODIFIED_DATE = LocalDate.ofEpochDay(0L); private static final LocalDate UPDATED_MODIFIED_DATE = LocalDate.now(ZoneId.systemDefault()); @Autowired private CustomerRepository customerRepository; @Autowired private CustomerMapper customerMapper; @Autowired private CustomerService customerService; @Autowired private EntityManager em; @Autowired private MockMvc restCustomerMockMvc; private Customer customer; /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Customer createEntity(EntityManager em) { Customer customer = new Customer() .name(DEFAULT_NAME) .email(DEFAULT_EMAIL) .phoneNumber(DEFAULT_PHONE_NUMBER) .gender(DEFAULT_GENDER) .dob(DEFAULT_DOB) .addressLine1(DEFAULT_ADDRESS_LINE_1) .addressLine2(DEFAULT_ADDRESS_LINE_2) .addressLine3(DEFAULT_ADDRESS_LINE_3) .addressLine4(DEFAULT_ADDRESS_LINE_4) .townCity(DEFAULT_TOWN_CITY) .zip(DEFAULT_ZIP) .state(DEFAULT_STATE) .country(DEFAULT_COUNTRY) .createDate(DEFAULT_CREATE_DATE) .modifiedDate(DEFAULT_MODIFIED_DATE); return customer; } /** * Create an updated entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Customer createUpdatedEntity(EntityManager em) { Customer customer = new Customer() .name(UPDATED_NAME) .email(UPDATED_EMAIL) .phoneNumber(UPDATED_PHONE_NUMBER) .gender(UPDATED_GENDER) .dob(UPDATED_DOB) .addressLine1(UPDATED_ADDRESS_LINE_1) .addressLine2(UPDATED_ADDRESS_LINE_2) .addressLine3(UPDATED_ADDRESS_LINE_3) .addressLine4(UPDATED_ADDRESS_LINE_4) .townCity(UPDATED_TOWN_CITY) .zip(UPDATED_ZIP) .state(UPDATED_STATE) .country(UPDATED_COUNTRY) .createDate(UPDATED_CREATE_DATE) .modifiedDate(UPDATED_MODIFIED_DATE); return customer; } @BeforeEach public void initTest() { customer = createEntity(em); } @Test @Transactional public void createCustomer() throws Exception { int databaseSizeBeforeCreate = customerRepository.findAll().size(); // Create the Customer CustomerDTO customerDTO = customerMapper.toDto(customer); restCustomerMockMvc.perform(post("/api/customers") .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(customerDTO))) .andExpect(status().isCreated()); // Validate the Customer in the database List<Customer> customerList = customerRepository.findAll(); assertThat(customerList).hasSize(databaseSizeBeforeCreate + 1); Customer testCustomer = customerList.get(customerList.size() - 1); assertThat(testCustomer.getName()).isEqualTo(DEFAULT_NAME); assertThat(testCustomer.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(testCustomer.getPhoneNumber()).isEqualTo(DEFAULT_PHONE_NUMBER); assertThat(testCustomer.getGender()).isEqualTo(DEFAULT_GENDER); assertThat(testCustomer.getDob()).isEqualTo(DEFAULT_DOB); assertThat(testCustomer.getAddressLine1()).isEqualTo(DEFAULT_ADDRESS_LINE_1); assertThat(testCustomer.getAddressLine2()).isEqualTo(DEFAULT_ADDRESS_LINE_2); assertThat(testCustomer.getAddressLine3()).isEqualTo(DEFAULT_ADDRESS_LINE_3); assertThat(testCustomer.getAddressLine4()).isEqualTo(DEFAULT_ADDRESS_LINE_4); assertThat(testCustomer.getTownCity()).isEqualTo(DEFAULT_TOWN_CITY); assertThat(testCustomer.getZip()).isEqualTo(DEFAULT_ZIP); assertThat(testCustomer.getState()).isEqualTo(DEFAULT_STATE); assertThat(testCustomer.getCountry()).isEqualTo(DEFAULT_COUNTRY); assertThat(testCustomer.getCreateDate()).isEqualTo(DEFAULT_CREATE_DATE); assertThat(testCustomer.getModifiedDate()).isEqualTo(DEFAULT_MODIFIED_DATE); } @Test @Transactional public void createCustomerWithExistingId() throws Exception { int databaseSizeBeforeCreate = customerRepository.findAll().size(); // Create the Customer with an existing ID customer.setId(1L); CustomerDTO customerDTO = customerMapper.toDto(customer); // An entity with an existing ID cannot be created, so this API call must fail restCustomerMockMvc.perform(post("/api/customers") .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(customerDTO))) .andExpect(status().isBadRequest()); // Validate the Customer in the database List<Customer> customerList = customerRepository.findAll(); assertThat(customerList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void checkNameIsRequired() throws Exception { int databaseSizeBeforeTest = customerRepository.findAll().size(); // set the field null customer.setName(null); // Create the Customer, which fails. CustomerDTO customerDTO = customerMapper.toDto(customer); restCustomerMockMvc.perform(post("/api/customers") .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(customerDTO))) .andExpect(status().isBadRequest()); List<Customer> customerList = customerRepository.findAll(); assertThat(customerList).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void getAllCustomers() throws Exception { // Initialize the database customerRepository.saveAndFlush(customer); // Get all the customerList restCustomerMockMvc.perform(get("/api/customers?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME))) .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL))) .andExpect(jsonPath("$.[*].phoneNumber").value(hasItem(DEFAULT_PHONE_NUMBER))) .andExpect(jsonPath("$.[*].gender").value(hasItem(DEFAULT_GENDER.toString()))) .andExpect(jsonPath("$.[*].dob").value(hasItem(DEFAULT_DOB))) .andExpect(jsonPath("$.[*].addressLine1").value(hasItem(DEFAULT_ADDRESS_LINE_1))) .andExpect(jsonPath("$.[*].addressLine2").value(hasItem(DEFAULT_ADDRESS_LINE_2))) .andExpect(jsonPath("$.[*].addressLine3").value(hasItem(DEFAULT_ADDRESS_LINE_3))) .andExpect(jsonPath("$.[*].addressLine4").value(hasItem(DEFAULT_ADDRESS_LINE_4))) .andExpect(jsonPath("$.[*].townCity").value(hasItem(DEFAULT_TOWN_CITY))) .andExpect(jsonPath("$.[*].zip").value(hasItem(DEFAULT_ZIP))) .andExpect(jsonPath("$.[*].state").value(hasItem(DEFAULT_STATE))) .andExpect(jsonPath("$.[*].country").value(hasItem(DEFAULT_COUNTRY))) .andExpect(jsonPath("$.[*].createDate").value(hasItem(DEFAULT_CREATE_DATE.toString()))) .andExpect(jsonPath("$.[*].modifiedDate").value(hasItem(DEFAULT_MODIFIED_DATE.toString()))); } @Test @Transactional public void getCustomer() throws Exception { // Initialize the database customerRepository.saveAndFlush(customer); // Get the customer restCustomerMockMvc.perform(get("/api/customers/{id}", customer.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) .andExpect(jsonPath("$.id").value(customer.getId().intValue())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME)) .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL)) .andExpect(jsonPath("$.phoneNumber").value(DEFAULT_PHONE_NUMBER)) .andExpect(jsonPath("$.gender").value(DEFAULT_GENDER.toString())) .andExpect(jsonPath("$.dob").value(DEFAULT_DOB)) .andExpect(jsonPath("$.addressLine1").value(DEFAULT_ADDRESS_LINE_1)) .andExpect(jsonPath("$.addressLine2").value(DEFAULT_ADDRESS_LINE_2)) .andExpect(jsonPath("$.addressLine3").value(DEFAULT_ADDRESS_LINE_3)) .andExpect(jsonPath("$.addressLine4").value(DEFAULT_ADDRESS_LINE_4)) .andExpect(jsonPath("$.townCity").value(DEFAULT_TOWN_CITY)) .andExpect(jsonPath("$.zip").value(DEFAULT_ZIP)) .andExpect(jsonPath("$.state").value(DEFAULT_STATE)) .andExpect(jsonPath("$.country").value(DEFAULT_COUNTRY)) .andExpect(jsonPath("$.createDate").value(DEFAULT_CREATE_DATE.toString())) .andExpect(jsonPath("$.modifiedDate").value(DEFAULT_MODIFIED_DATE.toString())); } @Test @Transactional public void getNonExistingCustomer() throws Exception { // Get the customer restCustomerMockMvc.perform(get("/api/customers/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateCustomer() throws Exception { // Initialize the database customerRepository.saveAndFlush(customer); int databaseSizeBeforeUpdate = customerRepository.findAll().size(); // Update the customer Customer updatedCustomer = customerRepository.findById(customer.getId()).get(); // Disconnect from session so that the updates on updatedCustomer are not directly saved in db em.detach(updatedCustomer); updatedCustomer .name(UPDATED_NAME) .email(UPDATED_EMAIL) .phoneNumber(UPDATED_PHONE_NUMBER) .gender(UPDATED_GENDER) .dob(UPDATED_DOB) .addressLine1(UPDATED_ADDRESS_LINE_1) .addressLine2(UPDATED_ADDRESS_LINE_2) .addressLine3(UPDATED_ADDRESS_LINE_3) .addressLine4(UPDATED_ADDRESS_LINE_4) .townCity(UPDATED_TOWN_CITY) .zip(UPDATED_ZIP) .state(UPDATED_STATE) .country(UPDATED_COUNTRY) .createDate(UPDATED_CREATE_DATE) .modifiedDate(UPDATED_MODIFIED_DATE); CustomerDTO customerDTO = customerMapper.toDto(updatedCustomer); restCustomerMockMvc.perform(put("/api/customers") .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(customerDTO))) .andExpect(status().isOk()); // Validate the Customer in the database List<Customer> customerList = customerRepository.findAll(); assertThat(customerList).hasSize(databaseSizeBeforeUpdate); Customer testCustomer = customerList.get(customerList.size() - 1); assertThat(testCustomer.getName()).isEqualTo(UPDATED_NAME); assertThat(testCustomer.getEmail()).isEqualTo(UPDATED_EMAIL); assertThat(testCustomer.getPhoneNumber()).isEqualTo(UPDATED_PHONE_NUMBER); assertThat(testCustomer.getGender()).isEqualTo(UPDATED_GENDER); assertThat(testCustomer.getDob()).isEqualTo(UPDATED_DOB); assertThat(testCustomer.getAddressLine1()).isEqualTo(UPDATED_ADDRESS_LINE_1); assertThat(testCustomer.getAddressLine2()).isEqualTo(UPDATED_ADDRESS_LINE_2); assertThat(testCustomer.getAddressLine3()).isEqualTo(UPDATED_ADDRESS_LINE_3); assertThat(testCustomer.getAddressLine4()).isEqualTo(UPDATED_ADDRESS_LINE_4); assertThat(testCustomer.getTownCity()).isEqualTo(UPDATED_TOWN_CITY); assertThat(testCustomer.getZip()).isEqualTo(UPDATED_ZIP); assertThat(testCustomer.getState()).isEqualTo(UPDATED_STATE); assertThat(testCustomer.getCountry()).isEqualTo(UPDATED_COUNTRY); assertThat(testCustomer.getCreateDate()).isEqualTo(UPDATED_CREATE_DATE); assertThat(testCustomer.getModifiedDate()).isEqualTo(UPDATED_MODIFIED_DATE); } @Test @Transactional public void updateNonExistingCustomer() throws Exception { int databaseSizeBeforeUpdate = customerRepository.findAll().size(); // Create the Customer CustomerDTO customerDTO = customerMapper.toDto(customer); // If the entity doesn't have an ID, it will throw BadRequestAlertException restCustomerMockMvc.perform(put("/api/customers") .contentType(MediaType.APPLICATION_JSON) .content(TestUtil.convertObjectToJsonBytes(customerDTO))) .andExpect(status().isBadRequest()); // Validate the Customer in the database List<Customer> customerList = customerRepository.findAll(); assertThat(customerList).hasSize(databaseSizeBeforeUpdate); } @Test @Transactional public void deleteCustomer() throws Exception { // Initialize the database customerRepository.saveAndFlush(customer); int databaseSizeBeforeDelete = customerRepository.findAll().size(); // Delete the customer restCustomerMockMvc.perform(delete("/api/customers/{id}", customer.getId()) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNoContent()); // Validate the database contains one less item List<Customer> customerList = customerRepository.findAll(); assertThat(customerList).hasSize(databaseSizeBeforeDelete - 1); } }
[ "techragesh@gmail.com" ]
techragesh@gmail.com
55d10e3967bc0c3ef78f126b00755564362f3c4c
0483090d65d8628aaf3ff506ff793190c8e28952
/src/edge.java
9898e4699394b9f7887f1f645ce284237bb0da3a
[]
no_license
18anandn/3D-shapes
d041d16d9e0a86615699837726922d410f0e714d
136d4ac6bfd94bd67dfc8f1c50a57a5e7335e1ac
refs/heads/master
2022-12-16T11:37:50.311755
2020-09-23T08:55:38
2020-09-23T08:55:38
297,910,025
0
0
null
null
null
null
UTF-8
Java
false
false
1,564
java
public class edge implements EdgeInterface,Comparable<edge>{ public point pt1; public point pt2; public int counter=1; public arraylist<triangle> mytriangles; public edge( point pt1, point pt2){ this.pt1=pt1; this.pt2=pt2; mytriangles=new arraylist<triangle>(); } public edge() { mytriangles=new arraylist<triangle>(); } public PointInterface [] edgeEndPoints() { PointInterface edge[]=null; edge[0]=pt1; edge[1]=pt2; return edge; } public double lengthofedge() { double f1= pt1.getX()-pt2.getX(); double f2= pt1.getY()-pt2.getY(); double f3= pt1.getZ()-pt2.getZ(); double d = f1*f1 + f2*f2 + f3*f3; return d; } public int compareTo(edge edge) { int count=0; if(lengthofedge()>edge.lengthofedge()) { count=-1; return count; } else if(lengthofedge()<edge.lengthofedge()) { count=1; return count; } else if(lengthofedge()==edge.lengthofedge()) { if(equalto(edge)!=0) { count=-1; return count; } } return count; } public int equalto(edge edge) { int count=0; if(pt1.equal(edge.pt1)==0 && pt2.equal(edge.pt2)==0) { return count; } else if(pt1.equal(edge.pt2)==0 && pt2.equal(edge.pt1)==0) { return count; } else { count=1; return count; }} public String toString(edge edge) { String str= String.valueOf(edge.pt1.x); return str; } public void print() { System.out.println(pt1.x); System.out.println(pt2.x); System.out.println(counter); } }
[ "noreply@github.com" ]
noreply@github.com
35ca46efd215b4c922f3b0966cf52c4faa533746
392e624ea2d6886bf8e37167ebbda0387e7e4a9a
/uxcrm-ofbiz/generated-entity-service/src/main/java/org/apache/ofbiz/content/content/service/base/ContentAttributeBaseService.java
94da1690d4943e4b3f3cebe091d74f2ce9e814a8
[ "Apache-2.0" ]
permissive
yuri0x7c1/uxcrm
11eee75f3a9cffaea4e97dedc8bc46d8d92bee58
1a0bf4649bee0a3a62e486a9d6de26f1d25d540f
refs/heads/master
2018-10-30T07:29:54.123270
2018-08-26T18:25:35
2018-08-26T18:25:35
104,251,350
0
0
null
null
null
null
UTF-8
Java
false
false
5,160
java
package org.apache.ofbiz.content.content.service.base; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.apache.ofbiz.common.ExecuteFindService.In; import org.apache.ofbiz.common.ExecuteFindService.Out; import org.apache.ofbiz.common.ExecuteFindService; import java.util.Arrays; import java.util.ArrayList; import java.util.List; import java.util.Collections; import org.apache.commons.collections4.CollectionUtils; import java.util.Optional; import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.condition.EntityConditionList; import org.apache.ofbiz.entity.condition.EntityExpr; import org.apache.ofbiz.entity.condition.EntityOperator; import com.github.yuri0x7c1.uxcrm.util.OfbizUtil; import org.apache.ofbiz.content.content.ContentAttribute; import org.springframework.beans.factory.annotation.Autowired; import org.apache.ofbiz.content.content.Content; import org.apache.ofbiz.content.content.ContentTypeAttr; @Slf4j @Component @SuppressWarnings("unchecked") public class ContentAttributeBaseService { protected ExecuteFindService executeFindService; @Autowired public ContentAttributeBaseService(ExecuteFindService executeFindService) { this.executeFindService = executeFindService; } /** * Count ContentAttributes */ public Integer count(EntityConditionList conditions) { In in = new In(); in.setEntityName(ContentAttribute.NAME); if (conditions == null) { in.setNoConditionFind(OfbizUtil.Y); } else { in.setEntityConditionList(conditions); } Out out = executeFindService.runSync(in); return out.getListSize(); } /** * Find ContentAttributes */ public List<ContentAttribute> find(Integer start, Integer number, List<String> orderBy, EntityConditionList conditions) { List<ContentAttribute> entityList = Collections.emptyList(); In in = new In(); in.setEntityName(ContentAttribute.NAME); if (start == null) { start = OfbizUtil.DEFAULT_FIND_START; } if (number == null) { number = OfbizUtil.DEFAULT_FIND_NUMBER; } in.setOrderByList(orderBy); if (conditions == null) { in.setNoConditionFind(OfbizUtil.Y); } else { in.setEntityConditionList(conditions); } Out out = executeFindService.runSync(in); try { if (out.getListIt() != null) { entityList = ContentAttribute.fromValues(out.getListIt() .getPartialList(start, number)); out.getListIt().close(); } } catch (GenericEntityException e) { log.error(e.getMessage(), e); } return entityList; } /** * Find one ContentAttribute */ public Optional<ContentAttribute> findOne(Object contentId, Object attrName) { List<ContentAttribute> entityList = null; In in = new In(); in.setEntityName(ContentAttribute.NAME); in.setEntityConditionList(new EntityConditionList<>(Arrays.asList( new EntityExpr("contentId", EntityOperator.EQUALS, contentId), new EntityExpr("attrName", EntityOperator.EQUALS, attrName)), EntityOperator.AND)); Out out = executeFindService.runSync(in); try { if (out.getListIt() != null) { entityList = ContentAttribute.fromValues(out.getListIt() .getCompleteList()); out.getListIt().close(); } } catch (GenericEntityException e) { log.error(e.getMessage(), e); } if (CollectionUtils.isNotEmpty(entityList)) { return Optional.of(entityList.get(0)); } return Optional.empty(); } /** * Get content */ public Optional<Content> getContent(ContentAttribute contentAttribute) { List<Content> entityList = null; In in = new In(); in.setEntityName(Content.NAME); in.setEntityConditionList(new EntityConditionList<>(Arrays .asList(new EntityExpr("contentId", EntityOperator.EQUALS, contentAttribute.getContentId())), EntityOperator.AND)); Out out = executeFindService.runSync(in); try { if (out.getListIt() != null) { entityList = Content.fromValues(out.getListIt() .getCompleteList()); out.getListIt().close(); } } catch (GenericEntityException e) { log.error(e.getMessage(), e); } if (CollectionUtils.isNotEmpty(entityList)) { return Optional.of(entityList.get(0)); } return Optional.empty(); } /** * Get content type attrs */ public List<ContentTypeAttr> getContentTypeAttrs( ContentAttribute contentAttribute, Integer start, Integer number, List<String> orderBy) { List<ContentTypeAttr> entityList = Collections.emptyList(); In in = new In(); in.setEntityName(ContentTypeAttr.NAME); if (start == null) { start = OfbizUtil.DEFAULT_FIND_START; } if (number == null) { number = OfbizUtil.DEFAULT_FIND_NUMBER; } in.setOrderByList(orderBy); in.setEntityConditionList(new EntityConditionList<>(Arrays .asList(new EntityExpr("attrName", EntityOperator.EQUALS, contentAttribute.getAttrName())), EntityOperator.AND)); Out out = executeFindService.runSync(in); try { if (out.getListIt() != null) { entityList = ContentTypeAttr.fromValues(out.getListIt() .getPartialList(start, number)); out.getListIt().close(); } } catch (GenericEntityException e) { log.error(e.getMessage(), e); } return entityList; } }
[ "yuri0x7c1@gmail.com" ]
yuri0x7c1@gmail.com
dbb931f8562fdb88950ee7853b957eff2a9734f8
afd0bc7d0817d3c1205e5088f1b8a16ce02d7842
/test/jkit/io/csv/CSVTest.java
86efcd0122a24a03c2c4ddf46cf9fee9420fa45b
[ "MIT" ]
permissive
JosuaKrause/JKit
160065161eba5f5d76704e8080104bac95061975
c3cecdccb55553029ed307d15f0ebd2a7e5768ff
refs/heads/master
2020-06-03T06:33:37.343277
2012-04-14T11:14:56
2012-04-19T18:53:08
2,111,749
0
0
null
null
null
null
UTF-8
Java
false
false
11,204
java
/** * */ package jkit.io.csv; import static jkit.io.csv.CSVTest.EventType.*; import java.io.IOException; import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; import org.junit.Test; /** * Tests for the csv reader. * * @author Joschi <josua.krause@googlemail.com> */ public class CSVTest { /** * The event type. * * @author Joschi <josua.krause@googlemail.com> */ public static enum EventType { /** Start. */ START, /** End. */ END, /** New row. */ ROW, /** New column. */ COL, /** Next cell. */ CELL, /* end of declaration */; } private static final class Event { private final EventType type; private final String content; private final String row; private final String col; private final int r; private final int c; public Event(final EventType type, final int r, final int c) { this(type, r, c, null); } public Event(final EventType type, final int r, final int c, final String content) { this(type, r, c, content, null, null); } public Event(final EventType type, final int r, final int c, final String content, final String row, final String col) { this.type = type; this.content = content; this.row = row; this.col = col; this.r = r; this.c = c; } @Override public boolean equals(final Object obj) { if(obj == this) return true; if(obj == null) return false; if(!(obj instanceof Event)) return false; final Event e = (Event) obj; if(e.type != type) return false; if(e.r != r) return false; if(e.c != c) return false; if(row != null && e.row != null && !row.equals(e.row)) return false; if(col != null && e.col != null && !col.equals(e.col)) return false; if(content == null) return e.content == null; return content.equals(e.content); } @Override public int hashCode() { return toString().hashCode(); } @Override public String toString() { return type + "[" + r + "," + c + "]" + (content != null ? "(\"" + content + "\")" : "") + (row != null ? "{r:" + row + "}" : "") + (col != null ? "{c:" + col + "}" : ""); } } private final class TestHandler implements CSVHandler { private final List<Event> events; public TestHandler() { events = new ArrayList<Event>(); } public void test(final Event[] es) { for(int i = 0; i < es.length; ++i) { if(events.size() <= i) { final StringBuilder res = new StringBuilder( "missing events: "); for(int j = i; j < es.length; ++j) { if(j != i) { res.append(", "); } res.append(es[j]); } throw new IllegalStateException(res.toString()); } if(!es[i].equals(events.get(i))) throw new IllegalStateException( "expected " + es[i] + " got " + events.get(i)); } } @Override public void cell(final CSVContext ctx, final String content) { events.add(new Event(CELL, ctx.row(), ctx.col(), content, ctx.rowName(), ctx.colName())); } @Override public void colTitle(final CSVContext ctx, final String title) { events.add(new Event(COL, ctx.row(), ctx.col(), title, ctx.rowName(), ctx.colName())); } @Override public void row(final CSVContext ctx) { events.add(new Event(ROW, ctx.row(), ctx.col(), null, ctx.rowName(), ctx.colName())); } @Override public void rowTitle(final CSVContext ctx, final String title) { events.add(new Event(ROW, ctx.row(), ctx.col(), title, ctx.rowName(), ctx.colName())); } @Override public void start(final CSVContext ctx) { events.add(new Event(START, ctx.row(), ctx.col(), null, null, null)); } @Override public void end(final CSVContext ctx) { events.add(new Event(END, -2, -2, null, ctx.rowName(), ctx.colName())); } } private static final String NL = System.getProperty("line.separator"); private static final String STR_TEST0 = "hallo;\"abc\"; buh ;\r\nbello;;" + "\"ab\"\"cd\";\"wu\r\nff\"\r\ngrr" + "rh;\"te;st\"\rblubb\nblubb;;"; private static final Event[] EV_TEST0 = new Event[] { new Event(START, 0, 0), new Event(ROW, 0, 0), new Event(CELL, 0, 0, "hallo"), new Event(CELL, 0, 1, "abc"), new Event(CELL, 0, 2, " buh "), new Event(CELL, 0, 3, ""), new Event(ROW, 1, 0), new Event(CELL, 1, 0, "bello"), new Event(CELL, 1, 1, ""), new Event(CELL, 1, 2, "ab\"cd"), new Event(CELL, 1, 3, "wu" + NL + "ff"), new Event(ROW, 2, 0), new Event(CELL, 2, 0, "grrrh"), new Event(CELL, 2, 1, "te;st"), new Event(ROW, 3, 0), new Event(CELL, 3, 0, "blubbblubb"), new Event(CELL, 3, 1, ""), new Event(END, -2, -2)}; private static final String STR_TEST1R = "abc;def;ghi\rjkl;mno;pqr\rstu;vwx;yz_"; private static final String STR_TEST1RN = "abc;def;ghi\r\njkl;mno;pqr\r\nstu;vwx;yz_\r\n"; private static final String STR_TEST1N = "abc;def;ghi\njkl;mno;pqr\nstu;vwx;yz_\n"; private static final Event[] EV_TEST1 = new Event[] { new Event(START, 0, 0), new Event(ROW, 0, 0), new Event(CELL, 0, 0, "abc"), new Event(CELL, 0, 1, "def"), new Event(CELL, 0, 2, "ghi"), new Event(ROW, 1, 0), new Event(CELL, 1, 0, "jkl"), new Event(CELL, 1, 1, "mno"), new Event(CELL, 1, 2, "pqr"), new Event(ROW, 2, 0), new Event(CELL, 2, 0, "stu"), new Event(CELL, 2, 1, "vwx"), new Event(CELL, 2, 2, "yz_"), new Event(END, -2, -2)}; private static final String STR_TEST2 = "a\"b;c\"d;e\"f;\"gh\""; private static final Event[] EV_TEST2 = new Event[] { new Event(START, 0, 0), new Event(ROW, 0, 0), new Event(CELL, 0, 0, "a\"b"), new Event(CELL, 0, 1, "c\"d"), new Event(CELL, 0, 2, "e\"f"), new Event(CELL, 0, 3, "gh"), new Event(END, -2, -2)}; private static final String STR_TEST3 = "-;c1;\"c2\";c3\nr1;1;2;3\n\"r2\";4;5;\"6\"\n\"r3\";7;8;9\n"; private static final Event[] EV_TEST3R = new Event[] { new Event(START, 0, -1), new Event(ROW, 0, -1, "-"), new Event(ROW, 0, 0), new Event(CELL, 0, 0, "c1"), new Event(CELL, 0, 1, "c2"), new Event(CELL, 0, 2, "c3"), new Event(ROW, 1, -1, "r1"), new Event(ROW, 1, 0), new Event(CELL, 1, 0, "1", "r1", null), new Event(CELL, 1, 1, "2", "r1", null), new Event(CELL, 1, 2, "3", "r1", null), new Event(ROW, 2, -1, "r2"), new Event(ROW, 2, 0), new Event(CELL, 2, 0, "4", "r2", null), new Event(CELL, 2, 1, "5", "r2", null), new Event(CELL, 2, 2, "6", "r2", null), new Event(ROW, 3, -1, "r3"), new Event(ROW, 3, 0), new Event(CELL, 3, 0, "7", "r3", null), new Event(CELL, 3, 1, "8", "r3", null), new Event(CELL, 3, 2, "9", "r3", null), new Event(END, -2, -2)}; private static final Event[] EV_TEST3C = new Event[] { new Event(START, -1, 0), new Event(COL, -1, 0, "-"), new Event(COL, -1, 1, "c1"), new Event(COL, -1, 2, "c2"), new Event(COL, -1, 3, "c3"), new Event(ROW, 0, 0), new Event(CELL, 0, 0, "r1", null, "-"), new Event(CELL, 0, 1, "1", null, "c1"), new Event(CELL, 0, 2, "2", null, "c2"), new Event(CELL, 0, 3, "3", null, "c3"), new Event(ROW, 1, 0), new Event(CELL, 1, 0, "r2", null, "-"), new Event(CELL, 1, 1, "4", null, "c1"), new Event(CELL, 1, 2, "5", null, "c2"), new Event(CELL, 1, 3, "6", null, "c3"), new Event(ROW, 2, 0), new Event(CELL, 2, 0, "r3", null, "-"), new Event(CELL, 2, 1, "7", null, "c1"), new Event(CELL, 2, 2, "8", null, "c2"), new Event(CELL, 2, 3, "9", null, "c3"), new Event(END, -2, -2)}; private static final Event[] EV_TEST3RC = new Event[] { new Event(START, -1, -1), new Event(COL, -1, 0, "c1"), new Event(COL, -1, 1, "c2"), new Event(COL, -1, 2, "c3"), new Event(ROW, 0, -1, "r1"), new Event(ROW, 0, 0, null, "r1", null), new Event(CELL, 0, 0, "1", "r1", "c1"), new Event(CELL, 0, 1, "2", "r1", "c2"), new Event(CELL, 0, 2, "3", "r1", "c3"), new Event(ROW, 1, -1, "r2"), new Event(ROW, 1, 0, null, "r2", null), new Event(CELL, 1, 0, "4", "r2", "c1"), new Event(CELL, 1, 1, "5", "r2", "c2"), new Event(CELL, 1, 2, "6", "r2", "c3"), new Event(ROW, 2, -1, "r3"), new Event(ROW, 2, 0, null, "r3", null), new Event(CELL, 2, 0, "7", "r3", "c1"), new Event(CELL, 2, 1, "8", "r3", "c2"), new Event(CELL, 2, 2, "9", "r3", "c3"), new Event(END, -2, -2)}; private void doTest(final CSVReader reader, final String in, final Event[] valid) throws Exception { final TestHandler th = new TestHandler(); reader.setHandler(th); reader.read(new StringReader(in)); th.test(valid); } /** * Tests types of cells. * * @throws Exception Exception. */ @Test public void test0() throws Exception { doTest(new CSVReader(), STR_TEST0, EV_TEST0); } /** * Tests different line endings. * * @throws Exception Exception. */ @Test public void test1() throws Exception { doTest(new CSVReader(), STR_TEST1R, EV_TEST1); doTest(new CSVReader(), STR_TEST1RN, EV_TEST1); doTest(new CSVReader(), STR_TEST1N, EV_TEST1); } /** * Tests delimiters in cells. * * @throws Exception Exception. */ @Test public void test2() throws Exception { doTest(new CSVReader(), STR_TEST2, EV_TEST2); } /** * Tests different title modes. * * @throws Exception Exception. */ @Test public void test3() throws Exception { final CSVReader csv = new CSVReader(); csv.setReadRowTitles(true); doTest(csv, STR_TEST3, EV_TEST3R); csv.setReadColTitles(true); doTest(csv, STR_TEST3, EV_TEST3RC); csv.setReadRowTitles(false); doTest(csv, STR_TEST3, EV_TEST3C); } /** * Tests csv writing. * * @throws Exception Exception. */ @Test public void test4() throws Exception { final CSVReader csv = new CSVReader(); final String test = "abc;\";\";\"\"\"\"" + NL + "def;ghu;\"" + NL + "\";" + NL; final StringWriter out = new StringWriter(); final CSVWriter cw = new CSVWriter(new PrintWriter(out)); csv.setHandler(new CSVAdapter() { @Override public void cell(final CSVContext ctx, final String content) { cw.writeCell(content); } @Override public void row(final CSVContext ctx) { if(ctx.row() > 0) { cw.writeRow(); } } @Override public void end(final CSVContext ctx) { try { cw.close(); } catch(final IOException e) { throw new RuntimeException(e); } } }); csv.read(new StringReader(test)); if(!out.toString().equals(test)) throw new IllegalStateException( "expected \"" + test + "\" got \"" + out.toString() + "\""); } }
[ "josua.krause@googlemail.com" ]
josua.krause@googlemail.com
5e2c7ceadab48d346e29f076a3ac5231955ebcbc
47b2131fbf473054aae7a8699549f7a754367601
/src/main/java/org/chiwooplatform/incident/core/config/S3Configuration.java
cc70de3b2a25a82fda3ee91db7e89591485e89db
[]
no_license
lampjava/incident-sample-service
027865cbc5e365b0e1f22b6c18a1229e0dab4f61
35a8d456e3f33c40b55f9f366cd22a5736abb0e9
refs/heads/master
2021-01-21T21:28:55.667070
2017-06-21T05:23:42
2017-06-21T05:23:42
94,850,208
0
0
null
null
null
null
UTF-8
Java
false
false
5,972
java
package org.chiwooplatform.incident.core.config; import java.io.InputStream; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.http.MediaType; import org.springframework.integration.aws.outbound.S3MessageHandler; import org.springframework.integration.dsl.channel.MessageChannels; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessageHandler; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.AmazonS3Encryption; import com.amazonaws.services.s3.AmazonS3EncryptionClientBuilder; import com.amazonaws.services.s3.model.EncryptionMaterialsProvider; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.transfer.TransferManager; import com.amazonaws.services.s3.transfer.TransferManagerBuilder; @Configuration public class S3Configuration { @Value("${aws.s3.bucket}") private String bucket; @Autowired private Regions region; @Autowired public AWSCredentialsProvider credentialsProvider; private static final String S3_SEND_CHANNEL = "s3SendChannel"; @Bean(name = S3_SEND_CHANNEL) public MessageChannel s3SendChannel() { return MessageChannels.direct( S3_SEND_CHANNEL ).get(); } @Bean public AmazonS3 amazonS3() { AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard(); builder.withRegion( region.getName() ); builder.setCredentials( credentialsProvider ); final AmazonS3 s3 = builder.build(); return s3; } @Bean public S3MessageHandler.UploadMetadataProvider uploadMetadataProvider() { return new S3MessageHandler.UploadMetadataProvider() { @Override public void populateMetadata( ObjectMetadata metadata, Message<?> message ) { if ( message.getPayload() instanceof InputStream ) { metadata.setContentLength( 1 ); metadata.setContentType( MediaType.APPLICATION_JSON_VALUE ); /// metadata.setContentDisposition("test.json"); } } }; } private final ExpressionParser spelParser = new SpelExpressionParser(); @Bean public S3MessageHandler s3MessageHandler( final AmazonS3 amazonS3 ) { final TransferManager transferManager = TransferManagerBuilder.standard().withS3Client( amazonS3 ).build(); S3MessageHandler messageHandler = new S3MessageHandler( transferManager, bucket ); Expression keyExpression = spelParser.parseExpression( "payload instanceof T(java.io.File) ? payload.name : headers.get('integration.message.key')" ); messageHandler.setKeyExpression( keyExpression ); // messageHandler.setCommandExpression( new ValueExpression<>( Command.UPLOAD ) ); // default is Command.UPLOAD. // messageHandler.setUploadMetadataProvider( uploadMetadataProvider() ); // messageHandler.setCommand( Command.UPLOAD ); // messageHandler.setOutputChannel( s3SendChannel() ); // messageHandler.setLoggingEnabled( true ); // messageHandler.setShouldTrack( true ); // messageHandler.setCountsEnabled( true ); // messageHandler.setStatsEnabled( true ); // messageHandler.setSendTimeout( sendTimeout ); // milliseconds // messageHandler.setAsync( true ); return messageHandler; } // @Bean public AmazonS3Encryption amazonS3Encryption( EncryptionMaterialsProvider encryptionMaterialsProvider ) { AmazonS3Encryption amazonS3Encryption = AmazonS3EncryptionClientBuilder.standard() .withRegion( region.getName() ) .withEncryptionMaterials( encryptionMaterialsProvider ) .build(); return amazonS3Encryption; } @Value("${aws.s3.ssebucket:securedBucket}") private String sseBucket; // @Bean public MessageHandler sseS3MessageHandler( AmazonS3 amazonS3 ) { final TransferManager transferManager = TransferManagerBuilder.standard().withS3Client( amazonS3 ).build(); // transferManager.upload( bucketName, key, input, objectMetadata ) S3MessageHandler s3MessageHandler = new S3MessageHandler( transferManager, sseBucket ); s3MessageHandler.setUploadMetadataProvider( ( metadata, message ) -> metadata.setSSEAlgorithm( ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION ) ); return s3MessageHandler; } // // @Bean(name = PollerMetadata.DEFAULT_POLLER) // public PollerMetadata poller() { // return Pollers.fixedRate(5000).get(); // } // // @Bean // public MessageSource<InputStream> s3InboundStreamingMessageSource() { // S3StreamingMessageSource messageSource = new S3StreamingMessageSource(new S3RemoteFileTemplate(amazonS3())); // messageSource.setRemoteDirectory(bucket); // messageSource.setFilter(new S3SimplePatternFileListFilter(bucketPrefix)); // return messageSource; // } }
[ "seonbo.shim@SeonBoShim.hwk.net" ]
seonbo.shim@SeonBoShim.hwk.net
d25013ced7c1c49ed2177c99fabddfddfe37ca6e
37e9babadd8557acb19fc38f04c5f16168c4f08f
/little-hotel-web/src/main/java/com/kevin/little/hotel/api/coupon/service/impl/CouponServiceImpl.java
d80084bd5f794f860b0a0a68d2553c14a7e16ecf
[ "Apache-2.0" ]
permissive
hadesvip/little-hotel
2566c18d6fea94ff4abc2467c0b17c13282fa840
685bb34108e63ccfcb03e27a9b7681119792ac3b
refs/heads/master
2023-08-01T10:14:12.159518
2021-09-26T06:23:51
2021-09-26T06:23:51
349,099,743
0
0
null
null
null
null
UTF-8
Java
false
false
3,485
java
package com.kevin.little.hotel.api.coupon.service.impl; import com.alibaba.fastjson.JSON; import com.google.common.collect.Lists; import com.kevin.little.hotel.api.coupon.service.CouponService; import com.kevin.little.hotel.common.utils.DateUtil; import com.kevin.little.hotel.common.utils.DateUtil.DateFormatEnum; import com.ruyuan.little.project.common.dto.CommonResponse; import com.ruyuan.little.project.common.enums.LittleProjectTypeEnum; import com.ruyuan.little.project.mysql.api.MysqlApi; import com.ruyuan.little.project.mysql.dto.MysqlRequestDTO; import java.util.Date; import java.util.List; import org.apache.commons.lang.time.DateUtils; import org.apache.dubbo.config.annotation.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; /** * 优惠券服务具体实现 * * @author wangyong */ @Service public class CouponServiceImpl implements CouponService { private static final Logger logger = LoggerFactory.getLogger(CouponService.class); @Reference(version = "1.0.0", interfaceClass = MysqlApi.class, cluster = "failfast") private MysqlApi mysqlApi; @Override public void distributeCoupon(Integer beId, Integer userId, Integer couponConfigId, Integer validDay, Integer sourceOrderId, String phoneNumber) { MysqlRequestDTO mysqlRequestDTO = buildMysqlRequestDTO(beId, userId, couponConfigId, validDay, sourceOrderId, phoneNumber); logger.info("分发优惠券给用户,request:{}", JSON.toJSONString(mysqlRequestDTO)); CommonResponse<Integer> response = mysqlApi.insert(mysqlRequestDTO); logger.info("分发优惠券给用户成功,response:{}", JSON.toJSONString(response)); } /** * 构建mysql请求参数 */ private MysqlRequestDTO buildMysqlRequestDTO(Integer beId, Integer userId, Integer couponConfigId, Integer validDay, Integer sourceOrderId, String phoneNumber) { MysqlRequestDTO mysqlRequestDTO = new MysqlRequestDTO(); mysqlRequestDTO.setSql("INSERT INTO t_coupon_user (" + " coupon_id," + " beid," + " uid," + " begin_date," + " end_date, " + " source_order_id " + ") " + "VALUES " + "(" + " ?," + " ?," + " ?," + " ?," + " ?, " + " ? " + ")"); List<Object> paramList = buildSaveCouponUserParam(beId, userId, couponConfigId, validDay, sourceOrderId); mysqlRequestDTO.setParams(paramList); mysqlRequestDTO.setPhoneNumber(phoneNumber); mysqlRequestDTO.setProjectTypeEnum(LittleProjectTypeEnum.ROCKETMQ); return mysqlRequestDTO; } /** * 构建保存优惠券优化参数 */ private List<Object> buildSaveCouponUserParam(Integer beId, Integer userId, Integer couponConfigId, Integer validDay, Integer sourceOrderId) { List<Object> paramList = Lists.newArrayList(); paramList.add(couponConfigId); paramList.add(beId); paramList.add(userId); Date currDate = new Date(); //开始时间 paramList.add(DateUtil.getDateFormat(currDate, DateFormatEnum.Y_M_D_PATTERN.getPattern())); //结束时间 paramList.add( DateUtil.getDateFormat(DateUtils.addDays(currDate, validDay), DateFormatEnum.Y_M_D_PATTERN.getPattern())); paramList.add(sourceOrderId); return paramList; } }
[ "yundan_wy@126.com" ]
yundan_wy@126.com
042a5b7cb88ff2fa2351e8a430e16ba22ce8de7f
cb218d84b1f42277e9b39b5374818e851f65645a
/src/main/java/gc/G1GCViewerLogParser.java
29d793a5928ba5cb603a08d1d9b1f26f25b0a998
[]
no_license
jerryliu306/SparkProfiler
22351e01d93362fd83d1eaa2e6ed54fb120ac116
fedc3ba627dd81fabed543a9762ee77a7c3b3b08
refs/heads/master
2020-03-25T09:22:17.790357
2018-07-31T13:14:37
2018-07-31T13:14:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,411
java
package gc; import generalGC.HeapUsage; import util.FileTextWriter; import util.JsonFileReader; import java.util.List; /** * Created by xulijie on 18-4-5. */ public class G1GCViewerLogParser { private HeapUsage usage = new HeapUsage(); private double STWPauseTime = 0; private double youngGCTime = 0; private double fullGCTime = 0; public void parse(String logFile) { List<String> lines = JsonFileReader.readFileLines(logFile); for (String line : lines) { line = line.trim(); if (line.startsWith("[2017-")) parseGCRecord(line); } display(); } public GCStatistics parseStatistics(String logFile) { List<String> lines = JsonFileReader.readFileLines(logFile); for (String line : lines) { line = line.trim(); if (line.startsWith("[2017-")) parseGCRecord(line); } return new GCStatistics(STWPauseTime, youngGCTime, fullGCTime, 0); } private void parseGCRecord(String line) { String gcType = ""; if (line.contains("[GC pause") && line.contains("(young)")) { gcType = "YGC"; } if (line.contains("[Full GC") || line.contains("(young) (initial-mark)") || line.contains("[GC cleanup") || line.contains("[GC remark") || line.contains("[GC concurrent") || line.contains("(mixed)")) { gcType = "FGC"; } if (line.contains("[Eden")) { // [2017-11-20T18:54:36.579+0800][9.032] int endTime = line.indexOf(']', line.indexOf("][") + 2); // 9.032 double offsetTime = Double.parseDouble(line.substring(line.indexOf("][") + 2, endTime)); int gcCauseIndex = line.indexOf("] [") + 3; // GC (Allocation Failure) String gcCause = line.substring(gcCauseIndex, line.indexOf('[', gcCauseIndex) - 1); int EdenIndex = line.indexOf("Eden") + 6; // 735138K->257048K(1514496K) String Eden = line.substring(EdenIndex, line.indexOf(',', EdenIndex)); double yBeforeMB = computeMB(Eden.substring(0, Eden.indexOf('K'))); double yAfterMB = computeMB(Eden.substring(Eden.indexOf('>') + 1, Eden.indexOf("K("))); double youngMB = computeMB(Eden.substring(Eden.indexOf('(') + 1, Eden.indexOf("K)"))); // System.out.println(PSYoungGen); // System.out.println(" yBeforeMB = " + yBeforeMB + ", yAfterMB = " + yAfterMB + ", youngMB = " + youngMB); // 129024K->15319K(494592K) int heapUsageIndex = line.lastIndexOf("] ") + 2; // int heapUsageIndex = line.indexOf("] ", EdenIndex) + 2; String heapUsage = line.substring(heapUsageIndex, line.indexOf(',', heapUsageIndex)); double heapBeforeMB = computeMB(heapUsage.substring(0, heapUsage.indexOf('K'))); double heapAfterMB = computeMB(heapUsage.substring(heapUsage.indexOf('>') + 1, heapUsage.indexOf("K("))); double heapMB = computeMB(heapUsage.substring(heapUsage.indexOf('(') + 1, heapUsage.indexOf("K)"))); double oldBeforeMB = heapBeforeMB - yBeforeMB; double oldAfterMB = heapAfterMB - yAfterMB; double oldMB = heapMB - youngMB; double gcSeconds = Double.parseDouble(line.substring(line.lastIndexOf(", ") + 2, line.lastIndexOf(" secs"))); usage.addUsage(gcType, offsetTime, yBeforeMB, yAfterMB, youngMB, oldBeforeMB, oldAfterMB, oldMB, gcSeconds, gcCause); STWPauseTime += gcSeconds; if (gcType.equals("FGC")) fullGCTime += gcSeconds; else youngGCTime += gcSeconds; } } /* 2017-11-22T10:03:14.403+0800: 596.322: [GC pause (G1 Evacuation Pause) (young) 596.322: [G1Ergonomics (CSet Construction) start choosing CSet, _pending_cards: 64042, predicted base time: 43.99 ms, remaining time: 156.01 ms, target pause time: 200.00 ms] */ public double computeMB(String KB) { return (double) Long.parseLong(KB) / 1024; } public void outputUsage(String outputFile) { FileTextWriter.write(outputFile, usage.toString()); } public void display() { System.out.println(usage.toString()); } }
[ "csxulijie@gmail.com" ]
csxulijie@gmail.com
3f306e9bb02f8a843e9fea263b02c6b1d4f5c9cb
930c207e245c320b108e9699bbbb036260a36d6a
/BRICK-RDF4J/generatedCode/src/main/java/brickschema/org/schema/_1_0_2/Brick/IHot_Water_Differential_Pressure_Integral_Time_Setpoint.java
b01d14fa2bff73aa41ca64e955eb9705db2aeb8f
[]
no_license
InnovationSE/BRICK-Generated-By-OLGA
24d278f543471e1ce622f5f45d9e305790181fff
7874dfa450a8a2b6a6f9927c0f91f9c7d2abd4d2
refs/heads/master
2021-07-01T14:13:11.302860
2017-09-21T12:44:17
2017-09-21T12:44:17
104,251,784
1
0
null
null
null
null
UTF-8
Java
false
false
650
java
/** * This file is automatically generated by OLGA * @author OLGA * @version 1.0 */ package brickschema.org.schema._1_0_2.Brick; import java.util.ArrayList; import java.util.List; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.vocabulary.RDF; import brickschema.org.schema._1_0_2.Brick.IHot_Water_Differential_Pressure_Setpoint; import brickschema.org.schema._1_0_2.Brick.IDifferential_Pressure_Integral_Time_Setpoint; public interface IHot_Water_Differential_Pressure_Integral_Time_Setpoint extends IHot_Water_Differential_Pressure_Setpoint, IDifferential_Pressure_Integral_Time_Setpoint { public IRI iri(); }
[ "Andre.Ponnouradjane@non.schneider-electric.com" ]
Andre.Ponnouradjane@non.schneider-electric.com
314444630ef3c0fd64490febd65e3db3013c70e4
d1b1f893026bee0684b4e94b2b450471a1d55147
/src/main/java/com/thoughtworks/test/tomwang/model/User.java
bbc3fad15bca044a2bdd0b0f103211dce2775ea1
[]
no_license
AScodersWH/graphql
72c3e9c40b1e85cced2e613ae665a6fcf275c66a
7ed389d904287c499edbf9a2de6b9368b88c9b06
refs/heads/master
2020-03-29T02:07:39.025992
2018-09-19T08:56:58
2018-09-19T08:56:58
149,421,589
1
0
null
null
null
null
UTF-8
Java
false
false
996
java
package com.thoughtworks.test.controller.model; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import java.util.List; @Data @AllArgsConstructor @NoArgsConstructor @Builder @Entity public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @JsonProperty private int id; @JsonProperty private String userName; @JsonProperty private String passWord; @JsonProperty private String phone; @JsonProperty private String mail; @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name = "user_id") @JsonProperty private List<Product> products; }
[ "895052253@qq.com" ]
895052253@qq.com
32470259dd0029daa4f70669bd00e1a72a492abc
a33aac97878b2cb15677be26e308cbc46e2862d2
/data/libgdx/HieroSettings_getGamma.java
e26f474c029589b03d7c9557a58792b776a80081
[]
no_license
GabeOchieng/ggnn.tensorflow
f5d7d0bca52258336fc12c9de6ae38223f28f786
7c62c0e8427bea6c8bec2cebf157b6f1ea70a213
refs/heads/master
2022-05-30T11:17:42.278048
2020-05-02T11:33:31
2020-05-02T11:33:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
46
java
public float getGamma() { return gamma; }
[ "bdqnghi@gmail.com" ]
bdqnghi@gmail.com
e11de411eeb5d76728e7542469a31e63b85bf513
800bf5298ef2cd3a54f6e5272ec36014a09ef30f
/criminalintentapp/src/main/java/stark/a/is/zhang/criminalintentapp/database/CrimeCursorWrapper.java
931e62ea6325216b300b05fcc2b4ad50293c84ff
[]
no_license
ZhangJianIsAStark/AndroidCommonLib
410687d82cbde6cf58416770ae5f540f7d5c2eb7
fdf055487e8325f642a0b2ab9d0e6d40ffa69986
refs/heads/master
2021-01-11T22:39:39.087334
2017-03-01T11:58:23
2017-03-01T11:58:23
79,010,748
2
0
null
null
null
null
UTF-8
Java
false
false
1,191
java
package stark.a.is.zhang.criminalintentapp.database; import android.database.Cursor; import android.database.CursorWrapper; import java.util.Date; import java.util.UUID; import stark.a.is.zhang.criminalintentapp.data.Crime; import stark.a.is.zhang.criminalintentapp.database.CrimeDbSchema.CrimeTable; public class CrimeCursorWrapper extends CursorWrapper{ public CrimeCursorWrapper(Cursor cursor) { super(cursor); } public Crime getCrime() { String uuidString = getString(getColumnIndex(CrimeTable.Cols.UUID)); String title = getString(getColumnIndex(CrimeTable.Cols.TITLE)); long date = getLong(getColumnIndex(CrimeTable.Cols.DATE)); int isSolved = getInt(getColumnIndex(CrimeTable.Cols.SOLVED)); String suspect = getString(getColumnIndex(CrimeTable.Cols.SUSPECT)); String contactId = getString(getColumnIndex(CrimeTable.Cols.CONTACT_ID)); Crime crime = new Crime(UUID.fromString(uuidString)); crime.setTitle(title); crime.setDate(new Date(date)); crime.setSolved(isSolved != 0); crime.setSuspect(suspect); crime.setContactId(contactId); return crime; } }
[ "zhangjian10@le.com" ]
zhangjian10@le.com
19756e43bf4e1d07e9983c5666e9f0acc7e2ee0e
236ad9f8ca8fae749daad5aab460c3307aaaeee4
/app/src/main/java/sf/orderfoodclient/model/firebase/Sender.java
5c7b4303cbef698fbf239a586ac1ae3b6e297e2f
[]
no_license
developersancho/OrderFoodClient
93be9e662582084efc14c094b7e410a79a8b11ee
26bfc4b2f167527355304146cc2214e9ff2aeb6c
refs/heads/master
2021-05-14T02:04:19.810667
2018-01-27T13:26:37
2018-01-27T13:26:37
116,582,176
0
0
null
null
null
null
UTF-8
Java
false
false
644
java
package sf.orderfoodclient.model.firebase; /** * Created by mesutgenc on 24.01.2018. */ public class Sender { private String to; private Notification notification; public Sender() { } public Sender(String to, Notification notification) { this.to = to; this.notification = notification; } public String getTo() { return to; } public void setTo(String to) { this.to = to; } public Notification getNotification() { return notification; } public void setNotification(Notification notification) { this.notification = notification; } }
[ "developersancho@gmail.com" ]
developersancho@gmail.com
a64e54142732f047e70a3e0862f89043e18bf540
fd91dba79e1ea0ee44fd446d85a85fddab968026
/android/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/core/R.java
a712d2c2f1cf1f00419c260918f23354a46a09a7
[]
no_license
OsamaQureshi147/Vegantify
c754621faec08bdc95d7dd0c7d395c1d10cca6ae
060bb4f2785e4e554ce14f09c8c4b2027b4691cc
refs/heads/master
2023-03-25T07:08:04.989005
2021-03-07T11:50:19
2021-03-07T11:50:19
337,447,193
1
0
null
2021-02-09T16:58:41
2021-02-09T15:22:16
Java
UTF-8
Java
false
false
13,473
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.core; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f03002b; public static final int font = 0x7f03012b; public static final int fontProviderAuthority = 0x7f03012d; public static final int fontProviderCerts = 0x7f03012e; public static final int fontProviderFetchStrategy = 0x7f03012f; public static final int fontProviderFetchTimeout = 0x7f030130; public static final int fontProviderPackage = 0x7f030131; public static final int fontProviderQuery = 0x7f030132; public static final int fontStyle = 0x7f030133; public static final int fontVariationSettings = 0x7f030134; public static final int fontWeight = 0x7f030135; public static final int ttcIndex = 0x7f030286; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f0500b1; public static final int notification_icon_bg_color = 0x7f0500b2; public static final int ripple_material_light = 0x7f0500bc; public static final int secondary_text_default_material_light = 0x7f0500be; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f060053; public static final int compat_button_inset_vertical_material = 0x7f060054; public static final int compat_button_padding_horizontal_material = 0x7f060055; public static final int compat_button_padding_vertical_material = 0x7f060056; public static final int compat_control_corner_material = 0x7f060057; public static final int compat_notification_large_icon_max_height = 0x7f060058; public static final int compat_notification_large_icon_max_width = 0x7f060059; public static final int notification_action_icon_size = 0x7f06012e; public static final int notification_action_text_size = 0x7f06012f; public static final int notification_big_circle_margin = 0x7f060130; public static final int notification_content_margin_start = 0x7f060131; public static final int notification_large_icon_height = 0x7f060132; public static final int notification_large_icon_width = 0x7f060133; public static final int notification_main_column_padding_top = 0x7f060134; public static final int notification_media_narrow_margin = 0x7f060135; public static final int notification_right_icon_size = 0x7f060136; public static final int notification_right_side_padding_top = 0x7f060137; public static final int notification_small_icon_background_padding = 0x7f060138; public static final int notification_small_icon_size_as_large = 0x7f060139; public static final int notification_subtext_size = 0x7f06013a; public static final int notification_top_pad = 0x7f06013b; public static final int notification_top_pad_large_text = 0x7f06013c; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f0700a1; public static final int notification_bg = 0x7f0700a2; public static final int notification_bg_low = 0x7f0700a3; public static final int notification_bg_low_normal = 0x7f0700a4; public static final int notification_bg_low_pressed = 0x7f0700a5; public static final int notification_bg_normal = 0x7f0700a6; public static final int notification_bg_normal_pressed = 0x7f0700a7; public static final int notification_icon_background = 0x7f0700a8; public static final int notification_template_icon_bg = 0x7f0700a9; public static final int notification_template_icon_low_bg = 0x7f0700aa; public static final int notification_tile_bg = 0x7f0700ab; public static final int notify_panel_notification_icon_bg = 0x7f0700ac; } public static final class id { private id() {} public static final int accessibility_action_clickable_span = 0x7f08000a; public static final int accessibility_custom_action_0 = 0x7f08000c; public static final int accessibility_custom_action_1 = 0x7f08000d; public static final int accessibility_custom_action_10 = 0x7f08000e; public static final int accessibility_custom_action_11 = 0x7f08000f; public static final int accessibility_custom_action_12 = 0x7f080010; public static final int accessibility_custom_action_13 = 0x7f080011; public static final int accessibility_custom_action_14 = 0x7f080012; public static final int accessibility_custom_action_15 = 0x7f080013; public static final int accessibility_custom_action_16 = 0x7f080014; public static final int accessibility_custom_action_17 = 0x7f080015; public static final int accessibility_custom_action_18 = 0x7f080016; public static final int accessibility_custom_action_19 = 0x7f080017; public static final int accessibility_custom_action_2 = 0x7f080018; public static final int accessibility_custom_action_20 = 0x7f080019; public static final int accessibility_custom_action_21 = 0x7f08001a; public static final int accessibility_custom_action_22 = 0x7f08001b; public static final int accessibility_custom_action_23 = 0x7f08001c; public static final int accessibility_custom_action_24 = 0x7f08001d; public static final int accessibility_custom_action_25 = 0x7f08001e; public static final int accessibility_custom_action_26 = 0x7f08001f; public static final int accessibility_custom_action_27 = 0x7f080020; public static final int accessibility_custom_action_28 = 0x7f080021; public static final int accessibility_custom_action_29 = 0x7f080022; public static final int accessibility_custom_action_3 = 0x7f080023; public static final int accessibility_custom_action_30 = 0x7f080024; public static final int accessibility_custom_action_31 = 0x7f080025; public static final int accessibility_custom_action_4 = 0x7f080026; public static final int accessibility_custom_action_5 = 0x7f080027; public static final int accessibility_custom_action_6 = 0x7f080028; public static final int accessibility_custom_action_7 = 0x7f080029; public static final int accessibility_custom_action_8 = 0x7f08002a; public static final int accessibility_custom_action_9 = 0x7f08002b; public static final int action_container = 0x7f080038; public static final int action_divider = 0x7f08003a; public static final int action_image = 0x7f08003b; public static final int action_text = 0x7f080041; public static final int actions = 0x7f080042; public static final int async = 0x7f08004b; public static final int blocking = 0x7f08004e; public static final int chronometer = 0x7f08005c; public static final int dialog_button = 0x7f080072; public static final int forever = 0x7f08008c; public static final int icon = 0x7f080096; public static final int icon_group = 0x7f080097; public static final int info = 0x7f08009b; public static final int italic = 0x7f08009c; public static final int line1 = 0x7f0800a2; public static final int line3 = 0x7f0800a3; public static final int normal = 0x7f0800c9; public static final int notification_background = 0x7f0800ca; public static final int notification_main_column = 0x7f0800cb; public static final int notification_main_column_container = 0x7f0800cc; public static final int right_icon = 0x7f0800db; public static final int right_side = 0x7f0800dc; public static final int tag_accessibility_actions = 0x7f080113; public static final int tag_accessibility_clickable_spans = 0x7f080114; public static final int tag_accessibility_heading = 0x7f080115; public static final int tag_accessibility_pane_title = 0x7f080116; public static final int tag_screen_reader_focusable = 0x7f080117; public static final int tag_transition_group = 0x7f080118; public static final int tag_unhandled_key_event_manager = 0x7f080119; public static final int tag_unhandled_key_listeners = 0x7f08011a; public static final int text = 0x7f08011e; public static final int text2 = 0x7f08011f; public static final int time = 0x7f080129; public static final int title = 0x7f08012a; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f090017; } public static final class layout { private layout() {} public static final int custom_dialog = 0x7f0b001f; public static final int notification_action = 0x7f0b004d; public static final int notification_action_tombstone = 0x7f0b004e; public static final int notification_template_custom_big = 0x7f0b004f; public static final int notification_template_icon_group = 0x7f0b0050; public static final int notification_template_part_chronometer = 0x7f0b0051; public static final int notification_template_part_time = 0x7f0b0052; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0f0095; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f100161; public static final int TextAppearance_Compat_Notification_Info = 0x7f100162; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f100163; public static final int TextAppearance_Compat_Notification_Time = 0x7f100164; public static final int TextAppearance_Compat_Notification_Title = 0x7f100165; public static final int Widget_Compat_NotificationActionContainer = 0x7f10024b; public static final int Widget_Compat_NotificationActionText = 0x7f10024c; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f03002b }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f03012d, 0x7f03012e, 0x7f03012f, 0x7f030130, 0x7f030131, 0x7f030132 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f03012b, 0x7f030133, 0x7f030134, 0x7f030135, 0x7f030286 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "osamahsan@gmail.com" ]
osamahsan@gmail.com
6a1a3ea6d812754f215bcc72350cd9839c3264f6
901e5eec3246fbc6b6f75bec497a4f5dc18022df
/eclipse-ws/.metadata/.plugins/.plugins_bkp/org.eclipse.team.core/.cache/org.eclipse.team.svn.core.resource.IRemoteStorage/9
2367a4d687eec6637cc51101537a105207170234
[]
no_license
pranav-t/master-thesis
dafb79f9cdb7c84172ce589de03c446cf11600e2
34b305b11001c401113f1158232b896e90ddd684
refs/heads/master
2021-01-18T18:52:35.094676
2017-01-26T11:14:41
2017-01-26T11:19:01
80,107,510
0
1
null
2023-03-20T11:47:25
2017-01-26T11:02:36
HTML
UTF-8
Java
false
false
8,085
package de.webdataplatform.master; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import de.webdataplatform.log.Log; import de.webdataplatform.message.Message; import de.webdataplatform.message.MessageClient; import de.webdataplatform.message.MessageUtil; import de.webdataplatform.message.SystemID; import de.webdataplatform.settings.SystemConfig; import de.webdataplatform.system.Command; import de.webdataplatform.system.Event; public class MasterSender { private Log log; private Master master; public MasterSender(Log log, Master master) { super(); this.log = log; this.master = master; } /** VIEW MANAGER MESSAGES */ // public void assignViewManager(SystemID viewManager, SystemID regionServer){ // // log.message(this.getClass(),"command assign vm:"+viewManager+" to rs:"+regionServer); // // Message message = new Message(master.getSystemID(), Command.VIEWMANAGER_ASSIGN, regionServer.toString()); // // MessageClient.sendMessage(log, viewManager, message); // } // // // public void withdrawViewManager(SystemID viewManager){ // // log.message(this.getClass(),"command withdraw vm:"+viewManager); // // Message message = new Message(master.getSystemID(), Command.VIEWMANAGER_WITHDRAW, ""); // // MessageClient.sendMessage(log, viewManager, message); // } public void reassignViewManager(SystemID viewManager, SystemID newRegionServer){ log.message(this.getClass(),"command reassign vm:"+viewManager+" to rs:"+newRegionServer); Message message = new Message(master.getSystemID(), Command.VIEWMANAGER_REASSIGN, newRegionServer.toString()); MessageClient.sendMessage(log, viewManager, message); } public void shutdownViewManager(SystemID viewManager){ log.message(this.getClass(),"command shutdown vm:"+viewManager); Message message = new Message(master.getSystemID(), Command.VIEWMANAGER_SHUTDOWN, ""); MessageClient.sendMessage(log, viewManager, message); } public void sendRefreshQueryTable(SystemID viewManager){ // for(SystemID vm : master.getMetaData().getViewManagers()){ log.message(this.getClass(),"command refresh query vm:"+viewManager); Message message = new Message(master.getSystemID(), Command.VIEWMANAGER_REFRESH_QUERYTABLE, ""); MessageClient.sendMessage(log, viewManager , message); // } } /** REGION SERVER MESSAGES */ public void sendAssignViewManager(SystemID receiver, SystemID viewManager){ log.message(this.getClass(),"command assign vm:"+viewManager+" to:"+receiver); Message message = new Message(master.getSystemID(), Command.VIEWMANAGER_ASSIGN, viewManager.toString()); MessageClient.sendMessage(log, receiver, message); } public void sendWithdrawViewManager(SystemID regionServer, SystemID viewManager){ log.message(this.getClass(),"command withdraw vm:"+viewManager); Message message = new Message(master.getSystemID(), Command.VIEWMANAGER_WITHDRAW, viewManager.toString()); MessageClient.sendMessage(log, regionServer, message); } // public void withdrawCrashedViewManager(SystemID viewManager, SystemID regionServer){ // // log.message(this.getClass(),"command withdraw crashed vm:"+viewManager); // // Message message = new Message(master.getSystemID(), Command.REGIONSERVER_WITHDRAW_CRASHED_VM, viewManager.toString()); // // MessageClient.sendMessage(log, regionServer, message); // } // // public void replayWriteAheadLog(SystemID regionServer, String seqNo){ // // log.message(this.getClass(),"command replay wal:"+seqNo); // // Message message = new Message(master.getSystemID(), Command.REGIONSERVER_REPLAY_WRITEAHEADLOG, seqNo+""); // // MessageClient.sendMessage(log, regionServer, message); // } /** CLIENT MESSAGES */ public void sendStatusReport(SystemID clientID){ String statusReport = " system status: " +SystemConfig.MESSAGES_SPLITCONTENTSEQUENCE+master.getMetaData().getViewManagers().size()+" view manager online; " +SystemConfig.MESSAGES_SPLITCONTENTSEQUENCE+master.getMetaData().getRegionServers().size()+" region server online " +SystemConfig.MESSAGES_SPLITCONTENTSEQUENCE+" assignments:"; Message message = new Message(master.getSystemID(), Event.VMS_STATUS_REPORT, statusReport ); MessageClient.sendMessage(log, clientID, message); } public List<Integer> computeSum(Map<SystemID, List<Integer>> map){ List<Integer> result = new ArrayList<Integer>(); for (SystemID systemID : map.keySet()) { List<Integer> temp = map.get(systemID); for (int i = 0; i < temp.size(); i++) { if(result.size() < temp.size()){ result.add(temp.get(i)); }else{ result.set(i, result.get(i) + temp.get(i)); } } } return result; } public void sendThroughputReport(SystemID clientID, boolean regionServers){ String throughputReport = ""; if(!regionServers){ throughputReport = MessageUtil.translateMap(master.getMetaData().getVMReports()); }else{ throughputReport = MessageUtil.translateMap(master.getMetaData().getRSReports()); } Message message = new Message(master.getSystemID(), Event.VMS_THROUGHPUT_REPORT, throughputReport); MessageClient.sendMessage(log, clientID, message); } public void sendThroughputSummary(SystemID clientID, boolean regionServers){ Map<SystemID, List<Integer>> result = new HashMap<SystemID, List<Integer>>(); if(!regionServers){ result.put(new SystemID("Sum", "Sum", "localhost", 2344), computeSum(master.getMetaData().getVMReports())); }else{ result.put(new SystemID("Sum", "Sum", "localhost", 2344), computeSum(master.getMetaData().getRSReports())); } String throughputReport = MessageUtil.translateMap(result); Message message = new Message(master.getSystemID(), Event.VMS_THROUGHPUT_SUMMARY, throughputReport); MessageClient.sendMessage(log, clientID, message); } public void sendQueryAdded(SystemID clientID, String queryName, boolean successful){ Message message = null; if(successful)message = new Message(master.getSystemID(), Event.VMS_QUERY_ADDED, queryName+" added to table"); else message = new Message(master.getSystemID(), Event.VMS_QUERY_ADDED, queryName+" failed"); MessageClient.sendMessage(log, clientID, message); } public void sendQueryRemoved(SystemID clientID, String queryName, boolean successful){ Message message = null; if(successful)message = new Message(master.getSystemID(), Event.VMS_QUERY_REMOVED, queryName+" removed from table"); else message = new Message(master.getSystemID(), Event.VMS_QUERY_REMOVED, "removing "+queryName+" failed"); MessageClient.sendMessage(log, clientID, message); } public void sendQueryReloaded(SystemID clientID, String queryName, boolean successful){ Message message = null; if(successful)message = new Message(master.getSystemID(), Event.VMS_QUERY_REMOVED, queryName+" reloaded"); else message = new Message(master.getSystemID(), Event.VMS_QUERY_REMOVED, "reloading "+queryName+" failed"); MessageClient.sendMessage(log, clientID, message); } public void sendQueryList(SystemID clientID){ master.getQueryManager().loadQueries(); String queryList=""; for (String queryName : master.getQueryManager().getQueryTable().getRawQueries().keySet()) { queryList += queryName+": "+master.getQueryManager().getQueryTable().getRawQueries().get(queryName)+SystemConfig.MESSAGES_SPLITCONTENTSEQUENCE; } Message message = new Message(master.getSystemID(), Event.VMS_QUERY_LIST, queryList); MessageClient.sendMessage(log, clientID , message); } }
[ "pranav@zyncd.com" ]
pranav@zyncd.com
80a33675a4843514ac52e89ccd966b383d4187aa
6145b0683715ef08d337e50ef415256980d502cf
/app/src/main/java/com/yieryi/gladtohear/listener/CommoditySelectedListener.java
9818eed1c3aa7097fe15e0ac165bdee9378d02b9
[]
no_license
WeekGeng/GladtoHear
613a3b4db0f184463a54ab719c155ca9f68824b1
163fc563a3b1b5c8b2f50fce68835d4fb84746cc
refs/heads/master
2021-01-01T20:34:55.631818
2015-10-08T23:57:59
2015-10-08T23:58:03
41,421,255
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package com.yieryi.gladtohear.listener; import com.yieryi.gladtohear.bean.commodity.SelRecord; /** * Created by Administrator on 2015/9/29 0029. */ public interface CommoditySelectedListener { void onItemLongClick(SelRecord record); }
[ "13162833922@163.com" ]
13162833922@163.com
17182f90ed775e9fa09e333f3a6ad3d1ada1ef08
f21e996e45ca34ecca012f652e10ba3342cacd61
/SgaWeb/src/java/mx/com/gm/sga/eis/PersonaDaoImpl.java
7596742ce4b98394f701f5c3e201d16f3e620d3c
[]
no_license
jamhir789/Sga-Servicesweb-Restful
bacaac4dfa04211a991fc05026e647b87a73bd97
c2d9fc971d4001408580dbb925a7ee06ebce69f6
refs/heads/master
2020-04-02T23:13:57.301826
2018-10-30T16:43:52
2018-10-30T16:43:52
154,860,348
0
0
null
null
null
null
UTF-8
Java
false
false
1,461
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package mx.com.gm.sga.eis; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import mx.com.gm.sga.domain.Persona; @Stateless public class PersonaDaoImpl implements PersonaDao { @PersistenceContext(unitName = "PersonaPU") EntityManager em; @Override public List<Persona> findAllPersonas() { return em.createNamedQuery("Persona.findAll").getResultList(); } @Override public Persona findPersonaById(Persona persona) { return em.find(Persona.class, persona.getIdPersona()); } @Override public Persona findPersonaByEmail(Persona persona) { Query query = em.createQuery("from Persona p where p.email =: email"); query.setParameter("email", persona.getEmail()); return (Persona) query.getSingleResult(); } @Override public void insertPersona(Persona persona) { em.persist(persona); } @Override public void updatePersona(Persona persona) { em.merge(persona); } @Override public void deletePersona(Persona persona) { persona = em.getReference(Persona.class, persona.getIdPersona()); em.remove(persona); } }
[ "erick.medina@itspanuco.edu.mx" ]
erick.medina@itspanuco.edu.mx
7a50862509a2200ac8d441552a5c202a49270f7a
316545d4bae1894dc909225944982e3860776c26
/hystrix/src/main/java/com/springcloud/HystrixServiceApplication.java
39ddd824db9b2e368716468156d809d1fee98846
[]
no_license
JKLeGend/springcloud-demo
cb3e8504d19b0fd0392aaf76a30f5d1ee84dfcd3
b51e101e28b79dde736e801c68221c6f702c7659
refs/heads/master
2023-02-06T01:00:19.453985
2020-12-29T05:30:44
2020-12-29T05:37:36
324,677,065
0
0
null
null
null
null
UTF-8
Java
false
false
531
java
package com.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @EnableCircuitBreaker @EnableDiscoveryClient @SpringBootApplication public class HystrixServiceApplication { public static void main(String[] args) { SpringApplication.run(HystrixServiceApplication.class, args); } }
[ "zhangjukai@gmail.com" ]
zhangjukai@gmail.com
aad3de8d017967f05ce00d6514f0ccf2467b1f37
106ec70574954e52c144b6b083209c87b43c5561
/app/src/main/java/wjx/classmanager/presenter/ClassPhotoPresenter.java
b9eb685b04214af12bd8e22fa7d464e533bee8d2
[]
no_license
WJX2015/ClassManager
3ce4dd9b4e9d456a76f475318199ae1b93bdb33c
21c053f2d0a3036b7e0e24b078c3f571524cfc34
refs/heads/master
2021-07-24T04:29:56.504535
2017-11-06T07:39:06
2017-11-06T07:39:06
104,696,928
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
package wjx.classmanager.presenter; import android.app.Activity; import android.content.Intent; import android.net.Uri; /** * Created by wjx on 2017/10/18. */ public interface ClassPhotoPresenter { void loadPicFromBmob(); void handleAlbumImage(Activity activity, Intent data); void handleCameraImage(Activity activity, Uri imageUri); void handleSelectorImage(String[] stringExtra); void updatePhotoList(String obejctId); }
[ "550481089@qq.com" ]
550481089@qq.com
be68100bc3b0617e026ff3211ad077ea6c5a3113
5aeb1249b494059bb36e02962220b7636edfad2f
/app/src/main/java/com/example/tzj12306/MyActionBar/MyActionbar.java
749a7e884f5ede299172c591b4127928758fbebd
[ "Apache-2.0" ]
permissive
TangZhengJ/12306
57e0118659cf1b2e278ecce29f24ffab7f1eb5e5
5f698291bbd5ac8d285b9d9f22ce08b50d6e2b64
refs/heads/master
2020-03-14T22:36:40.853287
2018-06-01T09:00:48
2018-06-01T09:00:48
131,824,969
1
0
null
null
null
null
UTF-8
Java
false
false
4,902
java
package com.example.tzj12306.MyActionBar; import android.content.Context; import android.support.v4.graphics.ColorUtils; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.example.tzj12306.R; import com.example.tzj12306.impl.ActionBarClickListener; public final class MyActionbar extends LinearLayout { private View layRoot; private View myStatusBar; private View layLeft; private View layRight; private Button btTitle; private TextView tvLeft; private TextView tvRight; private View iconLeft; private View iconRight; public MyActionbar(Context context){ this(context,null); } public MyActionbar(Context context, AttributeSet attrs){ super(context,attrs); init(); } public MyActionbar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } private void init(){ setOrientation(HORIZONTAL); View contentView = inflate(getContext(), R.layout.my_actionbar,this); layRoot = contentView.findViewById(R.id.lay_transroot); myStatusBar = contentView.findViewById(R.id.my_statusbar); btTitle = contentView.findViewById(R.id.tv_actionbar_title); tvLeft = contentView.findViewById(R.id.tv_actionbar_left); tvRight = contentView.findViewById(R.id.tv_actionbar_right); iconLeft = contentView.findViewById(R.id.iv_actionbar_left); iconRight = contentView.findViewById(R.id.iv_actionbar_right); } /** * 设置状态栏高度 * * @param statusBarHeight */ public void setStatusBarHeight(int statusBarHeight) { ViewGroup.LayoutParams params = myStatusBar.getLayoutParams(); params.height = statusBarHeight; myStatusBar.setLayoutParams(params); } /** * 设置是否需要渐变 * * @param translucent */ public void setNeedTranslucent(boolean translucent) { if (translucent) { layRoot.setBackgroundDrawable(null); } } /** * 设置标题 * * @param strTitle */ public void setTitle(String strTitle) { if (!TextUtils.isEmpty(strTitle)) { btTitle.setText(strTitle); btTitle.setVisibility(View.VISIBLE); } else { btTitle.setVisibility(View.GONE); } } /** * 设置透明度 * * @param transAlpha 0-255 之间 */ public void setTranslucent(int transAlpha) { layRoot.setBackgroundColor(ColorUtils.setAlphaComponent(getResources().getColor(R.color.primary), transAlpha)); btTitle.setAlpha(transAlpha); tvLeft.setAlpha(transAlpha); tvRight.setAlpha(transAlpha); iconLeft.setAlpha(transAlpha); iconRight.setAlpha(transAlpha); } /** * 设置数据 * * @param strTitle * @param resIdLeft * @param strLeft * @param resIdRight * @param strRight * @param listener */ public void setData(String strTitle, int resIdLeft, String strLeft, int resIdRight, String strRight, final ActionBarClickListener listener) { if (!TextUtils.isEmpty(strTitle)) { btTitle.setText(strTitle); } else { btTitle.setVisibility(View.GONE); } if (!TextUtils.isEmpty(strLeft)) { tvLeft.setText(strLeft); tvLeft.setVisibility(View.VISIBLE); } else { tvLeft.setVisibility(View.GONE); } if (!TextUtils.isEmpty(strRight)) { tvRight.setText(strRight); tvRight.setVisibility(View.VISIBLE); } else { tvRight.setVisibility(View.GONE); } if (resIdLeft == 0) { iconLeft.setVisibility(View.GONE); } else { iconLeft.setBackgroundResource(resIdLeft); iconLeft.setVisibility(View.VISIBLE); } if (resIdRight == 0) { iconRight.setVisibility(View.GONE); } else { iconRight.setBackgroundResource(resIdRight); iconRight.setVisibility(View.VISIBLE); } if (listener != null) { layLeft = findViewById(R.id.lay_actionbar_left); layRight = findViewById(R.id.lay_actionbar_right); layLeft.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { listener.onLeftClick(); } }); layRight.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { listener.onRightClick(); } }); } } }
[ "1315244780@qq.com" ]
1315244780@qq.com
555f43b9ef8b9a81f1b20ed43cfbd6455fd055e2
14e2f68d73537c0a9446ccec1d662bb730f10832
/src/tienda/Venta.java
267b79af27c60bacd2a801e885baa2e4c3d99790
[]
no_license
Rosa22/tiendita
309e15eccc8a97f2d7b9fca6636d52571a8f18a0
d2a0944be2ff3cc6260d0f0a608cfb3d3663090c
refs/heads/master
2021-04-12T03:25:44.407310
2018-03-19T03:56:41
2018-03-19T03:56:41
125,796,799
0
0
null
null
null
null
UTF-8
Java
false
false
846
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package tienda; /** * * @author rosac */ public class Venta { private String Fechaventa; private float Montoventa; public Venta(String Fechaventa, float Montoventa){ this.Fechaventa = Fechaventa; this.Montoventa = Montoventa; }//constructor public String getFechaventa() { return Fechaventa; } public void setFechaventa(String Fechaventa) { this.Fechaventa = Fechaventa; } public float getMontoventa() { return Montoventa; } public void setMontoventa(float Montoventa) { this.Montoventa = Montoventa; } }//class
[ "termecaronte@hotmail.com" ]
termecaronte@hotmail.com
b0670cbfc0554522e75fd8f0dfd917c09e4bfc1e
87136706a8de841c6ab1110b50cf44b3845b676f
/src/main/java/com/ptbc/simpleproject/service/MstUsersService.java
f42f0b079cb9b9aeb0eab1b8a8706645542703e2
[]
no_license
iankh58/ptbc-simple-project
b7358d4e5a70d03877d4750a4c0ba431847a7b57
f432b42a58bc7fc1508063ee3cd7088ad3bc2d5f
refs/heads/master
2023-03-04T19:08:42.249277
2021-02-11T12:40:03
2021-02-11T12:40:03
338,024,736
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.ptbc.simpleproject.service; import com.ptbc.simpleproject.dto.Response; import com.ptbc.simpleproject.dto.UserRequest; public interface MstUsersService { public Response findAll(); public Response save(UserRequest request); public Response update(UserRequest request); public Response delete(int id); }
[ "delvianchristoperkho@gmail.com" ]
delvianchristoperkho@gmail.com
006abca8e483ae96f937d48fe1003688e7a1bd51
37c11a7fa33e0461dc2c19ffdbd0c50014553b15
/lib_sdk/timchat/src/main/java/com/tencent/qcloud/timchat/model/GroupManageConversation.java
07e1ec1e321082c2939d0bbfff42f2a9c3dbfb51
[]
no_license
SetAdapter/KMYYAPP
5010d4e8a3dd60240236db15b34696bb443914b7
57eeba04cb5ae57911d1fa47ef4b2320eb1f9cbf
refs/heads/master
2020-04-23T13:56:33.078507
2019-02-18T04:39:40
2019-02-18T04:39:40
171,215,008
0
2
null
null
null
null
UTF-8
Java
false
false
4,807
java
package com.tencent.qcloud.timchat.model; import android.content.Context; import android.content.Intent; import android.util.Log; import com.tencent.TIMCallBack; import com.tencent.TIMGroupPendencyItem; import com.tencent.qcloud.presentation.presenter.GroupManagerPresenter; import com.tencent.qcloud.timchat.TimApplication; import com.tencent.qcloud.timchat.R; import com.tencent.qcloud.timchat.ui.GroupManageMessageActivity; import java.util.Calendar; /** * 群管理会话 */ public class GroupManageConversation extends Conversation { private final String TAG = "GroupManageConversation"; private TIMGroupPendencyItem lastMessage; private long unreadCount; public GroupManageConversation(TIMGroupPendencyItem message){ lastMessage = message; name = TimApplication.getContext().getString(R.string.conversation_system_group); } /** * 获取最后一条消息的时间 */ @Override public long getLastMessageTime() { return lastMessage.getAddTime(); } /** * 获取未读消息数量 */ @Override public long getUnreadNum() { return unreadCount; } /** * 将所有消息标记为已读 */ @Override public void readAllMessage() { //不能传入最后一条消息时间,由于消息时间戳的单位是秒 GroupManagerPresenter.readGroupManageMessage(Calendar.getInstance().getTimeInMillis(), new TIMCallBack() { @Override public void onError(int i, String s) { Log.i(TAG, "read all message error,code " + i); } @Override public void onSuccess() { Log.i(TAG, "read all message succeed"); } }); } /** * 获取头像 */ @Override public int getAvatar() { return R.drawable.ic_news; } /** * 跳转到聊天界面或会话详情 * * @param context 跳转上下文 */ @Override public void navToDetail(Context context) { readAllMessage(); Intent intent = new Intent(context, GroupManageMessageActivity.class); context.startActivity(intent); } /** * 获取最后一条消息摘要 */ @Override public String getLastMessageSummary() { if (lastMessage == null) return ""; String from = lastMessage.getFromUser(); String to = lastMessage.getToUser(); boolean isSelf = from.equals(UserInfo.getInstance().getId()); switch (lastMessage.getPendencyType()){ case INVITED_BY_OTHER: if (isSelf){ return TimApplication.getContext().getResources().getString(R.string.summary_me)+ TimApplication.getContext().getResources().getString(R.string.summary_group_invite)+ to+ TimApplication.getContext().getResources().getString(R.string.summary_group_add); }else{ if (to.equals(UserInfo.getInstance().getId())){ return from+ TimApplication.getContext().getResources().getString(R.string.summary_group_invite)+ TimApplication.getContext().getResources().getString(R.string.summary_me)+ TimApplication.getContext().getResources().getString(R.string.summary_group_add); }else{ return from+ TimApplication.getContext().getResources().getString(R.string.summary_group_invite)+ to+ TimApplication.getContext().getResources().getString(R.string.summary_group_add); } } case APPLY_BY_SELF: if (isSelf){ return TimApplication.getContext().getResources().getString(R.string.summary_me)+ TimApplication.getContext().getResources().getString(R.string.summary_group_apply)+ GroupInfo.getInstance().getGroupName(lastMessage.getGroupId()); }else{ return from+ TimApplication.getContext().getResources().getString(R.string.summary_group_apply)+GroupInfo.getInstance().getGroupName(lastMessage.getGroupId()); } default: return ""; } } /** * 设置最后一条消息 */ public void setLastMessage(TIMGroupPendencyItem message){ lastMessage = message; } /** * 设置未读数量 * * @param count 未读数量 */ public void setUnreadCount(long count){ unreadCount = count; } }
[ "383411934@qq.com" ]
383411934@qq.com
d3478dc06ff843c4ac4a591b86b9d4ad1f37feaa
953afe3a9be830b72cb5ab7851bebb55d9f095f5
/programs/generics/S.java
e330d133ad19bff7f2e2c6433e4b6f82e5bed5b3
[]
no_license
davidgries/JavaAndDS
e7d90dc279ba6c86380c35d042d2f812b12e3f08
3f116f3ebf020f7737af659af16dbb4e877089b7
refs/heads/master
2022-07-01T18:06:14.177102
2022-06-14T09:59:42
2022-06-14T09:59:42
116,155,230
1
0
null
null
null
null
UTF-8
Java
false
false
45
java
public class S extends C implements I1, I2 {}
[ "gries@cs.cornell.edu" ]
gries@cs.cornell.edu
f1ed16edb0792b8e35bc4175f23c7c071340ea38
ac4c00ee6eea58394a3494e295246f2c4589b31e
/wrongDirections.java
8684d6b89f3efbe2e4f3f6bbc2813bfde05b7e67
[]
no_license
EShi538/USACO-Silver
679ed9a45caa5b44b2a49b6ee8bedf96f6796211
31684fe2a9a734080acfb14b77f5164f7db4444b
refs/heads/master
2023-07-23T06:30:28.015943
2021-09-04T18:00:51
2021-09-04T18:00:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,327
java
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class App { static Scanner in = new Scanner(System.in); static String instruction = in.next(); static int[] x = new int[instruction.length() + 1]; static int[] y = new int[instruction.length() + 1]; static int[] dir = new int[instruction.length() + 1]; static int[] dx = {0, 1, 0, -1}; static int[] dy = {1, 0, -1, 0}; public static void main(String[] args) throws Exception { x[0] = 0; y[0] = 0; dir[0] = 0; //prefix sums for(int i = 1; i <= instruction.length(); i++){ if(instruction.charAt(i - 1) == 'F'){ x[i] = x[i - 1] + dx[dir[i - 1]]; y[i] = y[i - 1] + dy[dir[i - 1]]; dir[i] = dir[i - 1]; } else if(instruction.charAt(i - 1) == 'R'){ x[i] = x[i - 1]; y[i] = y[i - 1]; dir[i] = (dir[i - 1] + 1) % 4; } else{ x[i] = x[i - 1]; y[i] = y[i - 1]; dir[i] = ((dir[i - 1] + 4) - 1) % 4; } } //transform Set <point> ans = new HashSet<point>(); for(int i = 0; i < instruction.length(); i++){ if(instruction.charAt(i) == 'F'){ //F -> R int newX = x[i] + (y[instruction.length()] - y[i + 1]); int newY = y[i] - (x[instruction.length()] - x[i + 1]); ans.add(new point(newX, newY)); //F -> L newX = x[i] - (y[instruction.length()] - y[i + 1]); newY = y[i] + (x[instruction.length()] - x[i + 1]); ans.add(new point(newX, newY)); } else if(instruction.charAt(i) == 'R'){ //R -> L int newX = 2 * x[i + 1] - x[instruction.length()]; int newY = 2 * y[i + 1] - y[instruction.length()]; ans.add(new point(newX, newY)); //R -> F newX = x[i + 1] + dx[dir[i]] - (y[instruction.length()] - y[i + 1]); newY = y[i + 1] + dy[dir[i]] + (x[instruction.length()] - x[i + 1]); ans.add(new point(newX, newY)); } else{ //L -> R int newX = 2 * x[i + 1] - x[instruction.length()]; int newY = 2 * y[i + 1] - y[instruction.length()]; ans.add(new point(newX, newY)); //L -> F newX = x[i + 1] + dx[dir[i]] + (y[instruction.length()] - y[i + 1]); newY = y[i + 1] + dy[dir[i]] - (x[instruction.length()] - x[i + 1]); ans.add(new point(newX, newY)); } } System.out.println(ans.size()); } } class point{ int x; int y; public point(int x, int y){ this.x = x; this.y = y; } @Override public boolean equals(Object o){ if(!(o instanceof point)){ return false; } point p = (point) o; return this.x == p.x && this.y == p.y; } @Override public int hashCode(){ return (100000 * x) + y; } }
[ "noreply@github.com" ]
noreply@github.com
5f3bcb0faf5324a815e63e9b434cc9b2681815dc
940405ba6161e6add4ccc79c5d520f81ff9f7433
/geonetwork-domain-ebrim/src/main/java/org/geonetwork/domain/ebrim/extensionpackage/coreisometadata/classificationscheme/citedresponsibleparty/classificationnode/.svn/text-base/Originator.java.svn-base
4a5fa3ffe1b09615481ba78250c372edfb6383f2
[]
no_license
isabella232/ebrim
e5276b1fc9a084811b3384b2e66b70337fdbe05c
949e6bad1f1db4dc089a0025e332aaf04ce14a84
refs/heads/master
2023-03-15T20:18:13.577538
2012-06-13T15:25:15
2012-06-13T15:25:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,116
package org.geonetwork.domain.ebrim.extensionpackage.coreisometadata.classificationscheme.citedresponsibleparty.classificationnode; import java.util.HashSet; import java.util.Set; import org.geonetwork.domain.ebrim.informationmodel.classification.ClassificationNode; import org.geonetwork.domain.ebrim.informationmodel.core.datatype.InternationalString; import org.geonetwork.domain.ebrim.informationmodel.core.datatype.Language; import org.geonetwork.domain.ebrim.informationmodel.core.datatype.LocalizedString; import org.geonetwork.domain.ebrim.informationmodel.core.datatype.LongName; import org.geonetwork.domain.ebrim.informationmodel.core.datatype.URI; import org.geonetwork.domain.ebrim.informationmodel.core.datatype.URN; /** * * @author heikki doeleman * */ public class Originator extends ClassificationNode { public Originator() { super(); this.objectType = new URI("urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ClassificationNode"); this.setParent(new URI("urn:ogc:def:ebRIM-ClassificationScheme:CitedResponsibleParty")); this.setCode(new LongName("originator")); this.setId(new URN("urn:ogc:def:ebRIM-ClassificationNode:CitedResponsibleParty:originator")); LocalizedString localizedName = new LocalizedString(); localizedName.setValue("originator"); Language english = new Language("en"); localizedName.setLang(english); Set<LocalizedString> localizedNames = new HashSet<LocalizedString>(); localizedNames.add(localizedName); InternationalString name = new InternationalString(); name.setLocalizedStrings(localizedNames); this.name = name; LocalizedString localizedDescription = new LocalizedString(); localizedDescription.setValue("party who created the resource"); localizedDescription.setLang(english); Set<LocalizedString> localizedDescriptions = new HashSet<LocalizedString>(); localizedDescriptions.add(localizedDescription); InternationalString description = new InternationalString(); description.setLocalizedStrings(localizedDescriptions); this.description = description; } }
[ "jesse.eichar@camptocamp.com" ]
jesse.eichar@camptocamp.com
449f5fce6d0d543e642c1f8df07a5f3ffaaa0992
d7c5121237c705b5847e374974b39f47fae13e10
/airspan.netspan/src/main/java/Netspan/NBI_14_0/API/Status/NodeTemperatureGetResponse.java
fa0d2a738ef3406f3082599fd3857d33102f8bf2
[]
no_license
AirspanNetworks/SWITModules
8ae768e0b864fa57dcb17168d015f6585d4455aa
7089a4b6456621a3abd601cc4592d4b52a948b57
refs/heads/master
2022-11-24T11:20:29.041478
2020-08-09T07:20:03
2020-08-09T07:20:03
184,545,627
1
0
null
2022-11-16T12:35:12
2019-05-02T08:21:55
Java
UTF-8
Java
false
false
1,758
java
package Netspan.NBI_14_0.API.Status; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="NodeTemperatureGetResult" type="{http://Airspan.Netspan.WebServices}NodeSensorGetResult" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "nodeTemperatureGetResult" }) @XmlRootElement(name = "NodeTemperatureGetResponse") public class NodeTemperatureGetResponse { @XmlElement(name = "NodeTemperatureGetResult") protected NodeSensorGetResult nodeTemperatureGetResult; /** * Gets the value of the nodeTemperatureGetResult property. * * @return * possible object is * {@link NodeSensorGetResult } * */ public NodeSensorGetResult getNodeTemperatureGetResult() { return nodeTemperatureGetResult; } /** * Sets the value of the nodeTemperatureGetResult property. * * @param value * allowed object is * {@link NodeSensorGetResult } * */ public void setNodeTemperatureGetResult(NodeSensorGetResult value) { this.nodeTemperatureGetResult = value; } }
[ "build.Airspan.com" ]
build.Airspan.com
7842f17c8264a15ee9cac26c99fd437b07293c30
2e525b8b8e565061df6e8b4cdf1985b5e8ad1de3
/VehicleMoniter/src/com/stduy/vehicle/Main.java
bb08e3ba919c8a571baa472a0deff54c3dbc2596
[]
no_license
chenguan0405/JavaText
5574006d332d57d636a0da92f309ca9a0be49d5c
fa43e4f78cf5bee10f85e0de2568a3bd24fb92d0
refs/heads/master
2020-08-31T19:21:16.736033
2019-10-31T12:56:42
2019-10-31T12:56:42
218,765,311
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package com.stduy.vehicle; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Menu menu = new Menu(); menu.menu(); } }
[ "chenguan@DESKTOP-SEGORQL" ]
chenguan@DESKTOP-SEGORQL
398904687e11a61bfa34edabafa2c508b83136dd
d871e3910fedc14da596715418f6b693058e3840
/SAndH/test/cn/edu/jxnu/service/impl/TestAdminDaoImpl.java
b6c5b3c26e9491ddece6cf9a859034347c07ed2e
[]
no_license
zyuangui/SAndH
8f688ee8523d22dbbfc14df8fae0d88a3a05b7e2
c64545435e87737af51f3d4da61ef1750bb2f7f9
refs/heads/master
2021-01-15T17:50:40.188917
2016-06-01T02:58:28
2016-06-01T02:58:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
453
java
package cn.edu.jxnu.service.impl; import junit.framework.Assert; import org.junit.Test; import cn.edu.jxnu.entity.Admin; import cn.edu.jxnu.service.AdminDao; public class TestAdminDaoImpl { @Test public void testAdminLogin(){ Admin u = new Admin(1,"zhangsan","123456"); /* u.setUseruame("zhangsan"); u.setPassword("123456");*/ AdminDao udao = new AdminDaoImpl(); udao.userLogin(u); //Assert.assertEquals(true, udao.userLogin(u)); } }
[ "2685376026@qq.com" ]
2685376026@qq.com
5fb9fc1a027d86dcec45ebcf4a2c85f971af403a
e014b2498cfe45107f60e7d5c025c17cbfcd7f15
/Data Structures/LinkedLists/Palindrom_6/Palindrom.java
7ab9b5edc6fbdfaddb574795668a4acba703061d
[]
no_license
skydi17/Algorithms-and-Data-structures
4bc441cfe0d2730f76e3317917d534aeb3445c83
5efab7274d7864dde43aee41bbd82eb3ca6c7930
refs/heads/master
2021-06-06T03:25:25.363106
2019-01-11T14:17:48
2019-01-11T14:17:48
133,856,443
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
import java.io.BufferedReader; import java.io.InputStreamReader; // O(N) time // TODO what if DoublyLinkedList is not allowed? public class Palindrom { public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { int size = Integer.parseInt((reader.readLine())); DoublyLinkedList list = new DoublyLinkedList((char) size); char[] input = reader.readLine().toCharArray(); for (int i = 0; i < size; i++) { list.appendToTail(input[i]); } System.out.println(list.isPalindrom()); } catch(Exception e) { System.out.println("Something went wrong: " + e); } } }
[ "skyd96@gmail.com" ]
skyd96@gmail.com
e653ae38b8cab9b06a6d20ce2b715a72d49490fe
d215625ccccc0ea2f944a1ab8898a0b5e150d4c2
/CBot/src/buildingOrderModule/scoringDirector/gameState/GameStateFocused_Expansion.java
97c54ace2586f260539ac082154d777e4b1c8d24
[ "MIT" ]
permissive
plee30/CBot
59f19ed1ae03c732854c35aa070d4eeacc709b60
d144eb04c8fdfd5a6c9693b0b99addfdc85d976c
refs/heads/master
2023-01-20T22:31:20.086582
2020-12-01T00:29:43
2020-12-01T00:29:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
939
java
package buildingOrderModule.scoringDirector.gameState; import buildingOrderModule.buildActionManagers.BuildActionManager; import buildingOrderModule.scoringDirector.ScoringDirector; /** * GameStateFocused_Expansion.java --- A GameState focused on expansion. * * @author P H - 16.07.2017 * */ class GameStateFocused_Expansion extends GameState { // -------------------- Functions @Override protected double generateScore(ScoringDirector scoringDirector, BuildActionManager manager) { return scoringDirector.getScoreGeneratorFactory().generateExpansionFocusedScoreGenerator().generateScore(this, this.updateFramesPassedScore); } @Override protected int generateDivider(ScoringDirector scoringDirector, BuildActionManager manager) { return scoringDirector.getScoreGeneratorFactory().generateExpansionFocusedScoreGenerator().generateDivider(this, this.updateFramesPassedDivider); } }
[ "ph1387@t-online.de" ]
ph1387@t-online.de
7cdd2b25ee98adeabd8032ab57246f6f35c672f1
884196468e037ab45c22783827124c7c6185069e
/src/main/java/com/doart/rabbitmq/consumer/FanoutReceiverA.java
079bac74e4baf637f8273ce5958733eaec58f00f
[]
no_license
jiangchris/SpringBootDemo
3bdde12fb11653fbce7e915045e47049b2f1e5d8
0465687b5564c003541e5d2449b5cf863b7caa2c
refs/heads/master
2023-01-25T03:36:14.187174
2020-11-27T05:29:49
2020-11-27T05:29:49
316,392,603
0
0
null
null
null
null
UTF-8
Java
false
false
491
java
package com.doart.rabbitmq.consumer; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; import java.util.Map; @Component @RabbitListener(queues = "TestFanout.A") public class FanoutReceiverA { @RabbitHandler public void process(Map testMessage) { System.out.println("FanoutReceiverA消费者收到消息 : " +testMessage.toString()); } }
[ "346255525@qq.com" ]
346255525@qq.com
3667b155847830ba2930f967f62c958647bca799
010b8b232008d71633e165b0745d54d5ea5e490a
/DataStructures/src/code/graphs/TopologicalSort.java
d6d6a7eec95bb0df6e681c93078a1cc79dd8f0d7
[]
no_license
duggi8/per-proj
1778221a5c8de0ccee645a2bbc87d9ca9278f932
5008535ff282ff7c3d216c3582009ff736f88658
refs/heads/master
2020-04-08T03:18:28.553517
2019-05-15T06:25:11
2019-05-15T06:25:11
158,970,416
0
0
null
null
null
null
UTF-8
Java
false
false
1,187
java
package code.graphs; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; public class TopologicalSort { public static void main(String[] args) { } public static List<Integer> sort(Graph g){ LinkedList<Integer> queue = new LinkedList<>(); Map<Integer,Integer> indegreeMap = new HashMap<>(); for(int vertex =0;vertex<g.getNumVertices();vertex++) { int indegree = g.getIndegree(vertex); indegreeMap.put(vertex, indegree); if(indegree==0) { queue.add(vertex); } } List<Integer> sortedList = new ArrayList<>(); while(!queue.isEmpty()) { int vertex = queue.pollLast(); sortedList.add(vertex); List<Integer> adjacentVertices = g.getAdjacentVertices(vertex); for(int adjacentVertex :adjacentVertices) { int updatedIndegree = indegreeMap.get(adjacentVertex)-1; indegreeMap.remove(adjacentVertex); indegreeMap.put(adjacentVertex, updatedIndegree); if(updatedIndegree==0) { queue.add(adjacentVertex); } } } if(sortedList.size()!=g.getNumVertices()) throw new RuntimeException("Graph is cyclic"); return sortedList; } }
[ "duggirala.tejareddy@gmail.com" ]
duggirala.tejareddy@gmail.com
7447fc34287ce3a49fe93dba54d6d75e5611dc12
b2e433b728ec436623e1a464f74839f7299b16ff
/src/main/java/io/shadowrealm/skyprime/command/CommandSave.java
f05550179e6490bd95f5e82859c1059a1a92e462
[]
no_license
cyberpwnn/SkyPrime
2f2fa0b11cca1d9237aaf1a812de5b0eed8bfe32
4dc26e659ce0908bd4c9d88c332c4f468e1bb39d
refs/heads/master
2023-02-06T09:37:08.425478
2020-12-27T11:27:04
2020-12-27T11:27:04
136,788,092
0
0
null
null
null
null
UTF-8
Java
false
false
1,147
java
package io.shadowrealm.skyprime.command; import java.util.concurrent.TimeUnit; import io.shadowrealm.skyprime.SkyMaster; import mortar.bukkit.command.MortarCommand; import mortar.bukkit.command.MortarSender; import mortar.compute.math.M; import mortar.logic.format.F; public class CommandSave extends MortarCommand { public CommandSave() { super("save", "sav"); } @Override public boolean handle(MortarSender sender, String[] args) { if(!SkyMaster.hasIsland(sender.player())) { sender.sendMessage("You cant save an island you dont have. Use /sky create"); return true; } if(!SkyMaster.hasIslandLoaded(sender.player())) { sender.sendMessage("You cant save your island. It isnt loaded. Use /sky."); return true; } if(M.ms() - SkyMaster.getIsland(sender.player()).getIsland().getLastSave() > TimeUnit.MINUTES.toMillis(5)) { SkyMaster.getIsland(sender.player()).saveAll(); sender.sendMessage("Island Saved"); } else { sender.sendMessage("Your island was just saved " + F.timeLong(M.ms() - SkyMaster.getIsland(sender.player()).getIsland().getLastSave(), 0) + " ago."); } return true; } }
[ "danielmillst@gmail.com" ]
danielmillst@gmail.com
ba3699ca64e7901298089bf07009e6be41133ba7
28acf9b5281398bc2aeba8072ddb80d650aef807
/Server/MessageType.java
f80883164720aabbaf0abbca297f95eb0b393814
[]
no_license
erhss/LANOMS
741bb3308eac0391a6db8489c3f1cbfd122bd78c
444ae7f5bcece8ede7de898e71314c9a34c21095
refs/heads/main
2023-04-04T14:02:48.592166
2021-04-16T14:53:45
2021-04-16T14:53:45
358,632,300
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
public final class MessageType { public static final int AUTH_MESSAGE = 1; public static final int STRING_MESSAGE = 2; public static final int KEY_VALUE_MESSAGE = 3; public static final int BYTE_MESSAGE = 4; }
[ "shreejanp@gmail.com" ]
shreejanp@gmail.com
e6dc92cd23bf7a29307768b6cbb1732fae8ae293
2f933effd3edc1eb94fc1b041bb1772f8b9fd8a3
/src/main/renwu/wechat_business/action/AddressAction.java
117f527b8d16210f09e785621b001f676c69c4c1
[]
no_license
chensha00/java_practice4
1d1ca9e5d433f2af4047f6684eb8700ead5c6b07
33c92dddf862d9805bb3fa4e7e51975af38079e5
refs/heads/master
2021-05-02T15:40:50.574242
2018-03-12T13:31:32
2018-03-12T13:31:32
120,701,212
0
1
null
null
null
null
UTF-8
Java
false
false
6,490
java
package wechat_business.action;/******************************************************************** /** * @Project: Team4 * @Package wechat_business.action * @author hehongju * @date 2018/3/8 17:10 * @Copyright: 2018 www.zyht.com Inc. All rights reserved. * @version V1.0 */ import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import org.apache.struts2.ServletActionContext; import org.apache.struts2.convention.annotation.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import wechat_business.dao.AddressDao; import wechat_business.entity.Address; import wechat_business.service.AddressServiceImpl; import java.sql.SQLException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author hehongju * @ClassName AddressAction * @Description 类描述 * @date 2018/3/8 */ @Action(value = "addressAction") @Results({ @Result(name = "addressInfo",location = "/jsp/address_info.jsp") }) public class AddressAction extends BaseAction{ @Autowired private AddressServiceImpl addressService; private Address address; private List<Address> addressList; private String addres; private String name; private String tel; private String strId; private Long id; private Boolean indexAddress=false; private Integer index; ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml"); public AddressAction(){ System.out.println("地址"); addressService= (AddressServiceImpl) applicationContext.getBean("addressService"); } /** * @Title: * @Description: 地址加载 * @author hehongju * @date 2018-03-08 */ public String open(){ Map<String,Object> stringObjectMap=new HashMap<String, Object>(); stringObjectMap.put("ADDRESS_TYPE",(byte)1); // stringObjectMap.put("TAOBAO_ACCOUNT_ID",taobaoAccount.getId()); stringObjectMap.put("TAOBAO_ACCOUNT_ID",(long)2); try { //根据条件查询出地址 addressList=addressService.findByCondtion(stringObjectMap); index=addressList.size(); } catch (SQLException e) { e.printStackTrace(); } System.out.println("地址个数" + addressList.size()); ActionContext.getContext().put("list", addressList); ActionContext.getContext().put("indexAddress",indexAddress); ActionContext.getContext().put("index",index); return "addressInfo"; } /** * @Title: * @Description: 更新地址 * @author hehongju * @date 2018-03-08 */ public void update(){ id=Long.valueOf(strId); try { //根据id查询出地址信息 address=addressService.findById(id); address.setAddress(addres); address.setLinkmanContacts(name); address.setTelephone(tel); //更新查出地址的信息 addressService.update(address); } catch (SQLException e) { e.printStackTrace(); } open(); } /** * @Title: * @Description: 保存地址 * @author hehongju * @date 2018-03-08 */ public void save(){ address.setAddress(addres); address.setLinkmanContacts(name); address.setTelephone(tel); address.setCreateTime(new Date()); address.setUpdateTime(new Date()); address.setAddressType((byte) 1); address.setIsDefault(false); try { //保存新得地址信息 addressService.save(address); } catch (SQLException e) { e.printStackTrace(); } System.out.println("保存地址"); open(); } /** * @Title: * @Description: 选择地址 * @author hehongju * @date 2018-03-08 */ public void select(){ id=Long.valueOf(strId); try { //根据id查询地址信息 address=addressService.findById(id); } catch (SQLException e) { e.printStackTrace(); } indexAddress=true; ActionContext.getContext().put("address",address); // ServletActionContext.getRequest().setAttribute("address",address); System.out.println("选择"); open(); } /** * @Title: * @Description: 删除地址 * @author hehongju * @date 2018-03-08 */ public void del(){ id=Long.valueOf(strId); try { //根据id删除地址信息 addressService.deleteById(id); } catch (SQLException e) { e.printStackTrace(); } open(); } /** * @Title: * @Description: 设置默认地址 * @author hehongju * @date 2018-03-08 */ public void is(){ id=Long.valueOf(strId); Map<String,Object> stringObjectMapIs=new HashMap<String, Object>(); stringObjectMapIs.put("ADDRESS_TYPE",(byte)1); // stringObjectMap.put("TAOBAO_ACCOUN_ID",taobaoAccount.getId()); stringObjectMapIs.put("TAOBAO_ACCOUNT_ID",(long)2); addressService= (AddressServiceImpl) applicationContext.getBean("addressService"); try { addressList=addressService.findByCondtion(stringObjectMapIs); for (int i=0;i<addressList.size();i++){ addressList.get(i).setIsDefault(false); addressService.update(addressList.get(i)); } //设置默认地址 address=addressService.findById(id); address.setIsDefault(true); addressService.update(address); } catch (SQLException e) { e.printStackTrace(); } open(); } public String getStrId() { return strId; } public void setStrId(String strId) { this.strId = strId; } public String getAddres() { return addres; } public void setAddres(String addres) { this.addres = addres; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } }
[ "36066081+15984129672fanyuxin@users.noreply.github.com" ]
36066081+15984129672fanyuxin@users.noreply.github.com
bb69b5decbd437b2b9e3261e1c7ed9b8dca3e361
8e051d5d0ce1754884c59f31e37437d7ee87c643
/OverrideAndHide/src/com/company/A.java
3e4181ba87b497bb10bc8d299142caaa691614f6
[]
no_license
ao9-demos/java-learning
6c76855bf96afeb02d5833e4b9c1ae928550c435
2acca1f65b4a54ffef2897b59cb1478def9e3ec1
refs/heads/master
2022-04-28T01:22:21.118910
2020-03-30T16:29:58
2020-03-30T16:29:58
245,455,837
0
0
null
null
null
null
UTF-8
Java
false
false
179
java
package com.company; public class A { private int bb = 1; public int getBb() { return bb; } public void setBb(int bb) { this.bb = bb; } }
[ "aodong99@gmail.com" ]
aodong99@gmail.com
1bfcaba0efe5e360a264733d70c9129639d01fb3
53e448b22e35fcae9971da56ce67feb7eb9e7ac9
/defa-service/src/main/java/com/defa/service/role/RoleServiceImpl.java
e8923452b992b44ffef7e3523c4a027c9d9c8e67
[]
no_license
lzdn/defa-solution
30562ce2f8d4c3254859b2499cd47f8890807bcb
fddac7594744bc89032194685a42c8a0a040244e
refs/heads/master
2021-05-10T22:22:04.861465
2018-01-21T15:42:43
2018-01-21T15:42:43
118,254,639
0
0
null
null
null
null
UTF-8
Java
false
false
2,240
java
package com.defa.service.role; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import com.defa.data.core.RoleMapper; import com.defa.data.core.RoleRightRelationMapper; import com.defa.iservice.role.IRole; import com.defa.model.core.Role; import com.defa.model.core.RoleRightRelationKey; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; @Service public class RoleServiceImpl implements IRole { @Autowired private RoleMapper roleMapper; @Autowired private RoleRightRelationMapper roleRightRelationMapper; @Override public Page<Role> findPage(int pageNo, int pageSize) { PageHelper.startPage(pageNo, pageSize); return roleMapper.findPage(); } @Override public Role findByRoleId(Integer roleId) { // TODO Auto-generated method stub return roleMapper.selectByPrimaryKey(roleId); } @Override public List<Role> findAll() { // TODO Auto-generated method stub return roleMapper.findAll(); } @Override @Transactional(value = "coreTransactionManager") public int updateRole(Role role) { // TODO Auto-generated method stub return roleMapper.updateByPrimaryKeySelective(role); } @Override @Transactional(value = "coreTransactionManager") public int addRole(Role role) { // TODO Auto-generated method stub return roleMapper.insertSelective(role); } @Override @Transactional(value = "coreTransactionManager") public int insertBatch(List<RoleRightRelationKey> list) { if(CollectionUtils.isEmpty(list)) { return 0; } roleRightRelationMapper.deleteByRoleId(list.get(0).getRoleId()); return roleRightRelationMapper.insertBatch(list); } @Override @Transactional(value = "coreTransactionManager") public int deleteByRoleId(Integer roleId) { // TODO Auto-generated method stub return roleRightRelationMapper.deleteByRoleId(roleId); } @Override @Transactional(value = "coreTransactionManager") public int adminRoleAddRight(List<RoleRightRelationKey> list) { // TODO Auto-generated method stub return roleRightRelationMapper.insertBatch(list); } }
[ "415656544@qq.com" ]
415656544@qq.com
441b5e4191342f2f08959879a69a105b911734ae
a342c199388cbf355f02c0b12319eff357f6ae4d
/lib-resource/src/main/java/com/nutanix/resource/Resource.java
9904d111872dfd8db9315f49fc4916f4fd73f9fb
[]
no_license
ppoddar/measure
76e7e2884fe67b079bcd51470b61de16879f0a23
ae88b3e6550e04b96a7484e5f28e09c6600be8c8
refs/heads/master
2022-11-26T17:38:30.152885
2019-10-15T14:08:04
2019-10-15T14:08:04
203,217,772
0
0
null
2022-11-16T08:33:10
2019-08-19T17:21:18
Java
UTF-8
Java
false
false
1,519
java
package com.nutanix.resource; import java.util.Map; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.nutanix.bpg.utils.Identifable; import com.nutanix.capacity.Capacity; import com.nutanix.capacity.Quantity; import com.nutanix.capacity.ResourceKind; import com.nutanix.capacity.Unit; import com.nutanix.capacity.Utilization; import com.nutanix.resource.model.Cluster; /** * A resource represents capacity -- * a collection of quantities * (e.g. 10GB memory, 2 CPUs and 10GB storage) * that are allocated/deallocated atomically. * * <p> * A resource is immutable. Any mutation (e.g. adding new * storage capacity) results into a new resource. * * * @author pinaki.poddar * */ @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=As.PROPERTY, property="class") @JsonSubTypes({ @JsonSubTypes.Type(Cluster.class) }) public interface Resource extends Identifable { /** * get capacity of all kinds. * each quantity in returned capacity is expressed in * {@link #getUnit(Kind) preferred unit} for the quantity. * * @return a collection of capacities */ Quantity getAvailable(ResourceKind kind); Quantity getTotal(ResourceKind kind); Utilization getUtilization(ResourceKind kind); Capacity getAvailableCapacity(); Capacity getTotalCapacity(); Map<ResourceKind, Utilization> getUtilization(); boolean acquire(Capacity q); boolean release(Capacity q); }
[ "pinaki.poddar@gmail.com" ]
pinaki.poddar@gmail.com
684dc9d91829c34573859b0c9ed5f826784e6088
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/18/18_3fa20087a8c8b81475c4ee9b93f9e8b8219ab3cb/TrialSceneJump/18_3fa20087a8c8b81475c4ee9b93f9e8b8219ab3cb_TrialSceneJump_s.java
9b2ab3740f36cee992f7c6e1986ddbe1d1749be6
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
46,378
java
/* * Ninja Trials is an old school style Android Game developed for OUYA & using * AndEngine. It features several minigames with simple gameplay. * Copyright 2013 Mad Gear Games <madgeargames@gmail.com> * * 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.madgear.ninjatrials.trials; import org.andengine.engine.camera.Camera; import org.andengine.engine.handler.IUpdateHandler; import org.andengine.engine.handler.timer.ITimerCallback; import org.andengine.engine.handler.timer.TimerHandler; import org.andengine.entity.Entity; import org.andengine.entity.modifier.DelayModifier; import org.andengine.entity.modifier.FadeInModifier; import org.andengine.entity.modifier.FadeOutModifier; import org.andengine.entity.modifier.JumpModifier; import org.andengine.entity.modifier.MoveModifier; import org.andengine.entity.modifier.ParallelEntityModifier; import org.andengine.entity.modifier.PathModifier; import org.andengine.entity.modifier.PathModifier.Path; import org.andengine.entity.modifier.RotationByModifier; import org.andengine.entity.modifier.SequenceEntityModifier; import org.andengine.entity.primitive.Rectangle; import org.andengine.entity.scene.Scene; import org.andengine.entity.scene.background.SpriteBackground; import org.andengine.entity.sprite.AnimatedSprite; import org.andengine.entity.sprite.AnimatedSprite.IAnimationListener; import org.andengine.entity.sprite.Sprite; import org.andengine.entity.text.Text; import org.andengine.entity.text.TextOptions; import org.andengine.opengl.vbo.VertexBufferObjectManager; import org.andengine.util.adt.align.HorizontalAlign; import android.test.PerformanceTestCase; import android.util.Log; import android.view.KeyEvent; import com.madgear.ninjatrials.managers.GameManager; import com.madgear.ninjatrials.GameScene; import com.madgear.ninjatrials.MainMenuScene; import com.madgear.ninjatrials.R; import com.madgear.ninjatrials.ResultLoseScene; import com.madgear.ninjatrials.ResultWinScene; import com.madgear.ninjatrials.managers.ResourceManager; import com.madgear.ninjatrials.managers.SceneManager; import com.madgear.ninjatrials.hud.Chronometer; import com.madgear.ninjatrials.hud.GameHUD; import com.madgear.ninjatrials.hud.PrecisionAngleBar; import com.madgear.ninjatrials.hud.PrecisionBar; import com.madgear.ninjatrials.test.TestingScene; import com.madgear.ninjatrials.utils.ParallaxBackground2d; import com.madgear.ninjatrials.utils.ParallaxBackground2d.ParallaxBackground2dEntity; /** * Jump trial scene. * * @author Madgear Games * */ public class TrialSceneJump extends GameScene { public static final int SCORE_THUG = 5000; public static final int SCORE_NINJA = 7000; public static final int SCORE_NINJA_MASTER = 9000; public static final int SCORE_GRAND_MASTER = 9500; private float timeRound; // tiempo para ciclo de powerbar private float timeMax = 10; // Tiempo máximo para corte: private float timeCounter = timeMax; // Tiempo total que queda para el corte private int frameNum = 0; // Contador para la animación private float timerStartedIn = 0; // control de tiempo private float origX, origY = 0.0f; private boolean jumpMessage = true; private boolean firstJump = false; private boolean falling = false; private float seconds = 0.0f; private boolean die = false; private boolean finalAnimation = false; private int numberPerfectJumps = 0; private int numberPerfectJumpsInARow = 0; private int numberPerfectJumpsInARowMax = 0; private boolean comboActive = true; private float[] destinyg = {0, 0}; private float[] lastDestinyg = {0, 0}; private float WIDTH = ResourceManager.getInstance().cameraWidth; private float HEIGHT = ResourceManager.getInstance().cameraHeight; private float[] origin = {WIDTH / 2 - 120, HEIGHT / 2}; private SpriteBackground bg; private Statue mStatue; // Basurillas JJ: private final VertexBufferObjectManager vertexBufferObjectManager = ResourceManager.getInstance().engine.getVertexBufferObjectManager(); // Así me ahorro esta llamada cada 2x3 private ParallaxBackground2d parallaxLayer; // capa parallax // Sprites BG private Sprite mSpr_bg01_statues, mSpr_bg01_bamboo_low1, mSpr_bg01_bamboo_mid1_a, mSpr_bg01_bamboo_mid1_b, mSpr_bg01_bamboo_mid1_c, mSpr_bg01_bamboo_high1, mSpr_bg01_bamboo_low2, mSpr_bg01_bamboo_mid2_a, mSpr_bg01_bamboo_mid2_b, mSpr_bg01_bamboo_mid2_c, mSpr_bg01_bamboo_high2, // 2º tronco de bambú mSpr_bg02_forest1_low, mSpr_bg02_forest1_mid1, mSpr_bg02_forest1_mid2, mSpr_bg02_forest1_high, mSpr_bg03_forest2_low, mSpr_bg03_forest2_mid, mSpr_bg03_forest2_high, mSpr_bg04_mount, mSpr_bg05_pagoda, mSpr_bg06_clouds, mSpr_bg07_lake, mSpr_bg08_fuji, mSpr_bg09_sky; // Factor de las capas Parallax (según el factor parallax las capas se mueven a diferente velocidad) // fFPL = floatFactorParallaxLayer private final float fFPL01 =-10.0f; // Bambu rebotable private final float fFPL02 = -9.0f; // Bosque bambu cercano private final float fFPL03 = -5.5f; // Bosque bambu lejano // HABR�A QUE CREAR OTRO BOSQUE de BAMBÚ M�S private final float fFPL04 = -4.5f; // montaña cercana private final float fFPL05 = -4.0f; // pagoda private final float fFPL06 = -2.0f; // nubes private final float fFPL07 = -2.0f; // lago private final float fFPL08 = -1.8f; // m. fuji private final float fFPL09 = -0.5f; // cielo // Posición inicial de los sprites del fondo private int pBX1 = 150; // posición bambú ancho 1 private int pBX2 = 1700; // posición bambú ancho 2 private float jumpLeft = 350f; //posicion ninja izq private float jumpRight = 1570f; //posicion ninja dcha private int pMY = 800; // posición montaña cercana private int pPX = 1400; private int pPY = 1200; // posición pagoda private int pCY = 1600; // posición nubes private int pLY = 400; // posicion lago private int pFY = 850; // posición fuji // CHAPUZA PARA HACER EL BAMBÚ (hago que se cambie la variable "repetición" en la entidad paralax bambú dependiendo de a qué altura estemos ^^U): // Sólo necesitaríamos variables en los objetos ParallaxBackground2dEntity a los que vamos a cambiar alguna propiedad // Como hay un problema con los bucles, no se está usando esto como se havcía en el ejemplo de GitHub private ParallaxBackground2dEntity pBE01, pBE02;//...Estoy pensando que símplemente se podría cambiar la visibilidad del sprite, pero también sería una chapuza así que lo dejo así por ahora ^^U private final int repBamboo = 10; // Veces que se repite el cuerpo del bambu private float desplazamientoParallaxVertical = 0; private float desplazamientoParallaxHorizontal = 0; private boolean autoScroll = false; // Bucle de actualización. Lo usaba para la chapuza de repetir verticalmente o no los dos bambús en los que se rebota. // Es una chapuza horrible, lo dejo sólo de momento, si podemos encontrar otra forma de hacerlo mejor que mejor /* private float actualizacionesPorSegundo = 60.0f; final private IUpdateHandler bucleActualizaciones = new TimerHandler(1 / actualizacionesPorSegundo, true, new ITimerCallback() { @Override public void onTimePassed(final TimerHandler pTimerHandler) { System.out.println("ParallaxValX="+parallaxLayer.getParallaxValueX() ); System.out.println("ParallaxValY="+parallaxLayer.getParallaxValueY() ); parallaxLayer.offsetParallaxValue( parallaxLayer.getParallaxValueX() + desplazamientoParallaxHorizontal, parallaxLayer.getParallaxValueY() + desplazamientoParallaxVertical); int altoBambu = 77*repBamboo; // Chapuza (a ojimetro) if (parallaxLayer.getParallaxValueY() < 0) {autoScrollUp();} if (parallaxLayer.getParallaxValueY() > 820) { autoScrollDown();} if (parallaxLayer.getParallaxValueY() > 0 && parallaxLayer.getParallaxValueY() < 50 && pBE01.getmRepeatY()){ // este "if" es innecesario en la fase rel, lo tengo sólo para pruebas pBE01.setmRepeatY(false); mSpr_bg01_bamboo_mid1_b.setY( mSpr_bg01_bamboo_low1.getHeight() + mSpr_bg01_bamboo_mid1_a.getHeight() ); pBE02.setmRepeatY(false); mSpr_bg01_bamboo_mid2_b.setY( mSpr_bg01_bamboo_low2.getHeight() + mSpr_bg01_bamboo_mid2_a.getHeight() ); Log.v("parallaxLayer.mParallaxValueY ", "no repite" ); } if (parallaxLayer.getParallaxValueY() >= 50 && parallaxLayer.getParallaxValueY() < altoBambu && !pBE01.getmRepeatY()){ // altoBambu era 200 pBE01.setmRepeatY(true); mSpr_bg01_bamboo_mid1_b.setY( mSpr_bg01_bamboo_low1.getHeight() + mSpr_bg01_bamboo_mid1_a.getHeight()*(repBamboo-2) ); pBE02.setmRepeatY(true); mSpr_bg01_bamboo_mid2_b.setY( mSpr_bg01_bamboo_low2.getHeight() + mSpr_bg01_bamboo_mid2_a.getHeight()*(repBamboo-2) ); Log.v("parallaxLayer.mParallaxValueY ", "repite" ); } if (parallaxLayer.getParallaxValueY() >= altoBambu && pBE01.getmRepeatY()){ pBE01.setmRepeatY(false); Log.v("parallaxLayer.mParallaxValueY ", "no repite" ); pBE02.setmRepeatY(false); } } }); */ private Camera mCamera; private GameHUD gameHUD; private PrecisionAngleBar angleBar; private Chronometer chrono; private Character mCharacter; private ShineOnFloor mShineOnFloor; private boolean cutEnabled = false; public TimerHandler trialTimerHandler; // era private, esto es una chapuza para poder salir de aquí pulsando Back private IUpdateHandler trialUpdateHandler; private final float readyTime = 4f; private final float endingTime = 6f; private int score = 0; private float[] scoreJump; /** * Calls the super class constructor. */ public TrialSceneJump() { super(); } @Override public Scene onLoadingScreenLoadAndShown() { Scene loadingScene = new Scene(); // Provisional, sera una clase externa loadingScene.getBackground().setColor(0.3f, 0.3f, 0.6f); // Añadimos algo de texto: final Text loadingText = new Text( ResourceManager.getInstance().cameraWidth * 0.5f, ResourceManager.getInstance().cameraHeight * 0.3f, ResourceManager.getInstance().fontBig, ResourceManager.getInstance().loadAndroidRes().getString(R.string.app_loading), new TextOptions(HorizontalAlign.CENTER), ResourceManager.getInstance().engine.getVertexBufferObjectManager()); loadingScene.attachChild(loadingText); return loadingScene; } @Override public void onLoadingScreenUnloadAndHidden() {} /** * Loads all the Scene resources and create the main objects. */ @Override public void onLoadScene() { ResourceManager.getInstance().loadJumpSceneResources(); setTrialDiff(GameManager.getSelectedDiff()); GameManager.setCurrentTrial(3); //jumpTrial // bg = new SpriteBackground(new Sprite(width * 0.5f, height * 0.5f, // ResourceManager.getInstance().cutBackground, // ResourceManager.getInstance().engine.getVertexBufferObjectManager())); // setBackground(bg); mStatue = new Statue(); mCharacter = new Character(WIDTH / 2 - 300, 320); //(WIDTH / 2 - 120, HEIGHT / 2); //destinyg[1] = HEIGHT / 2; //lastDestinyg[1] = HEIGHT / 2; mCamera = ResourceManager.getInstance().engine.getCamera(); gameHUD = new GameHUD(); angleBar = new PrecisionAngleBar(200f, 200f, timeRound); chrono = new Chronometer(WIDTH - 200, HEIGHT - 200, 0, 50); mShineOnFloor = new ShineOnFloor(WIDTH / 2 - 300, 150); mShineOnFloor.activate(); } /** * Put all the objects in the scene. */ @Override public void onShowScene() { setBackgroundEnabled(true); loadBackgroundParallax(); // cargamos el fondo // attachChild(mStatue); // descomentado attachChild(mCharacter); attachChild(mShineOnFloor); ResourceManager.getInstance().engine.getCamera().setHUD(gameHUD); gameHUD.attachChild(angleBar); gameHUD.attachChild(chrono); readySequence(); } @Override public void onHideScene() {} /** * Unloads all the scene resources. */ @Override public void onUnloadScene() { // ResourceManager.getInstance().unloadCutSceneResources(); ResourceManager.getInstance().unloadJumpSceneResources(); } /** * Shows a Ready Message, then calls actionSecuence(). * "Ready" is displayed 1 sec after the scene is shown and ends 1 secs before the * action secuence begins. */ private void readySequence() { gameHUD.showMessage(ResourceManager.getInstance().loadAndroidRes().getString(R.string.trial_jump_ready), 1, readyTime - 1); mCharacter.start(); // <- mShineOnFloor.shine(); timerStartedIn = ResourceManager.getInstance().engine.getSecondsElapsedTotal(); trialUpdateHandler = new IUpdateHandler() { @Override public void onUpdate(float pSecondsElapsed) { if(ResourceManager.getInstance().engine.getSecondsElapsedTotal() > timerStartedIn + readyTime) { TrialSceneJump.this.unregisterUpdateHandler(trialUpdateHandler); actionSequence(); } } @Override public void reset() {} }; registerUpdateHandler(trialUpdateHandler); } /** * Main trial secuence. Shows a "Jump!" message, starts the Chronometer and enables the cut. */ protected void actionSequence() { trialUpdateHandler = new IUpdateHandler() { @Override public void onUpdate(float pSecondsElapsed) { seconds += pSecondsElapsed; //System.out.println("pSecondsElapsed="+seconds); //ESTE BUCLE SE EST� EJECUTANDO "DE GRATIS" //System.out.println("ParallaxValX="+parallaxLayer.getParallaxValueX() ); //System.out.println("ParallaxValY="+parallaxLayer.getParallaxValueY() ); //here the camera and the parallax are updated if (lastDestinyg[1] <= destinyg[1] && firstJump && seconds >= 0.1f && destinyg[1] != 0f && !die) { lastDestinyg[1] += (destinyg[1] - lastDestinyg[1]) * 0.05f + pSecondsElapsed * 100; parallaxLayer.setParallaxValue(0, lastDestinyg[1] / 10f); mCamera.setCenter(WIDTH / 2, lastDestinyg[1] + 200); //System.out.println("destiny"+lastDestinyg[1]); seconds = 0f; } else if (lastDestinyg[1] > destinyg[1] && scoreJump [2] == -1 && lastDestinyg[1] != 0f && !die) { lastDestinyg[1] += (destinyg[1] - lastDestinyg[1]) * 0.05f - pSecondsElapsed * 100f; parallaxLayer.setParallaxValue(0, lastDestinyg[1] / 10f); mCamera.setCenter(WIDTH / 2, lastDestinyg[1] + 200); } if (seconds >= 0.5f && jumpMessage) { gameHUD.showMessage(ResourceManager.getInstance().loadAndroidRes().getString(R.string.trial_jump_go), 0, 1); // Dani, lo de "Jump!" sólo tiene que mostrarse una vez al principio, no cada vez que se salte :) chrono.stop(); chrono.setTimeValue(0f); jumpMessage = false; cutEnabled = true; } if (angleBar.getJumpValue() == -1) jumpSequence(); if (chrono.isTimeOut()) { cutEnabled = false; angleBar.stop(); chrono.stop(); GameManager.player1result.jumpTime = 50f; endingSequence(); } if (destinyg[1] > 0) mShineOnFloor.setVisible(false); else { mShineOnFloor.setVisible(true); mShineOnFloor.shine(); } } @Override public void reset() {} }; registerUpdateHandler(trialUpdateHandler); // precisionBar.start(); angleBar.setAlpha(0); } public void jumpSequence() { firstJump = true; cutEnabled = false; angleBar.setAlpha(1); chrono.stop(); // precisionBar.stop(); angleBar.stop(); scoreJump = getScoreJump(); frameNum = 0; if (scoreJump[2] == 1) origin = mCharacter.jump(origin, scoreJump); // <- else origin = mCharacter.fall(origin, scoreJump); trialTimerHandler = new TimerHandler(0.1f, new ITimerCallback() { @Override public void onTimePassed(final TimerHandler pTimerHandler) { pTimerHandler.reset(); // new frame each 0.1 second ! if (frameNum == 10) frameNum++; } }); chrono.start(); seconds = 0.0f; if (destinyg[1] < 9040f && !falling) actionSequence(); else { //actionSequence(); endingAnimationSequence(); } registerUpdateHandler(trialTimerHandler); } /** * Calculates the trial score. * Score = 100 - abs(precision bar power value) - precision bar semicycle number * 3 * @return The Trial Score (int from 0 to 100). */ public float[] getScoreJump() { float[] trialScore; //trialScore = 100 - Math.abs(precisionBar.getPowerValue()) - precisionBar.getSemicycle() * 3; trialScore = angleBar.getPowerValue(); //if direction is -1 it means it went too far if (trialScore[2] == -1 && !firstJump) falling = true; //max score in x is 195 (capped if above) if (trialScore[0] == angleBar.getMaxScore() && comboActive) { numberPerfectJumps++; numberPerfectJumpsInARow++; if (numberPerfectJumpsInARow > numberPerfectJumpsInARowMax) numberPerfectJumpsInARowMax = numberPerfectJumpsInARow; } else if (trialScore[0] == angleBar.getMaxScore()) { numberPerfectJumps++; numberPerfectJumpsInARow++; comboActive = true; } else { numberPerfectJumpsInARow = 0; comboActive = false; } return trialScore; } public void endingAnimationSequence() { //do something chrono.stop(); if (!falling) saveTrialResults(); else GameManager.player1result.jumpTime = 50; endingSequence(); } public void saveTrialResults() { GameManager.player1result.jumpTime = chrono.getTimeValue(); GameManager.player1result.jumpPerfectJumpCombo = numberPerfectJumps; GameManager.player1result.jumpMaxPerfectJumpCombo = numberPerfectJumpsInARowMax; } /** * Calculates the trial score. * Score = 100 - abs(precision bar power value) - precision bar semicycle number * 3 * @return The Trial Score (int from 0 to 100). */ public static int getScore() { return getTimeScore() + getPerfectJumpScore() + getMaxPerfectJumpScore(); } public static int getStamp(int score) { int stamp = ResultWinScene.STAMP_THUG; if(score >= SCORE_GRAND_MASTER) stamp = ResultWinScene.STAMP_GRAND_MASTER; else if(score >= SCORE_NINJA_MASTER) stamp = ResultWinScene.STAMP_NINJA_MASTER; else if(score >= SCORE_NINJA) stamp = ResultWinScene.STAMP_NINJA; return stamp; } public static int getTimeScore() { //maybe add a factor. 13 secs + 9 perfect + 9 combo = 9800 aprox //TODO: poner cabeza. poner efectos graficos de suelo (buscar sitio para segunda vez) y de pared si perfect // . sonidos. musica int timeScore = Math.round((50 - (GameManager.player1result.jumpTime - 8)) * 100); //8 seg es el minimo System.out.println("time="+(int) GameManager.player1result.jumpTime); return (int) timeScore; } public static int getPerfectJumpScore() { System.out.println("perfects"+GameManager.player1result.jumpPerfectJumpCombo); return GameManager.player1result.jumpPerfectJumpCombo * 100; } public static int getMaxPerfectJumpScore() { System.out.println("MaxPerfects"+GameManager.player1result.jumpMaxPerfectJumpCombo); return GameManager.player1result.jumpMaxPerfectJumpCombo * 500; } /** * Shows the score and the final animation. Clean the HUD and calls to the next scene. */ private void endingSequence() { //GameManager.incrementScore(score); score = getScore(); //different animations when winning in the future if(score >= SCORE_GRAND_MASTER) { //endingSequencePerfect(); //gameHUD.showMessage(ResourceManager.getInstance().loadAndroidRes().getString(R.string.trial_jump_go), 0, 1); } else if(score >= SCORE_NINJA_MASTER) { //gameHUD.showMessage(ResourceManager.getInstance().loadAndroidRes().getString(R.string.trial_jump_go), 0, 1); } else if(score >= SCORE_THUG) { //gameHUD.showMessage(ResourceManager.getInstance().loadAndroidRes().getString(R.string.trial_jump_go), 0, 1); } else { //gameHUD.showMessage(ResourceManager.getInstance().loadAndroidRes().getString(R.string.trial_jump_go), 0, 1); } trialTimerHandler= new TimerHandler(endingTime, new ITimerCallback() { @Override public void onTimePassed(final TimerHandler pTimerHandler) { TrialSceneJump.this.unregisterUpdateHandler(trialTimerHandler); gameHUD.detachChildren(); if(score < SCORE_THUG) SceneManager.getInstance().showScene(new ResultLoseScene()); else SceneManager.getInstance().showScene(new ResultWinScene()); } }); registerUpdateHandler(trialTimerHandler); } /** * When time is out the cut is not enabled. Calls ending secuence. */ private void timeOut() { cutEnabled = false; // precisionBar.stop(); angleBar.stop(); score = 0; endingSequence(); } /** * When the action button is pressed launch the cut if enabled. */ @Override public void onPressButtonO() { if (cutEnabled) { // cutSequence(); jumpSequence(); } } /* // Para salir del trial y volver al menu de selección de escenas public void onPressDpadLeft() { TrialSceneJump.this.unregisterUpdateHandler(trialTimerHandler); gameHUD.detachChildren(); SceneManager.getInstance().showScene(new TestingScene()); } public void onPressDpadDown() { // AQUIIIII parallaxLayer.offsetParallaxValue(0, -2); } public void onPressDpadUp() { parallaxLayer.offsetParallaxValue(0, 2); } */ // Lo siguiente evita el funcionamiento de onPressDpadLeft(), onPressDpadUp() y onPressDpadDown() de // arriba, por eso los comento y dejo sólo el onKeyDown @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)){ parallaxLayer.offsetParallaxValue(0, -2); } if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP)){ parallaxLayer.offsetParallaxValue(0, 2); } if ((keyCode == KeyEvent.KEYCODE_DPAD_DOWN)){ parallaxLayer.offsetParallaxValue(0, -2); } if ((keyCode == KeyEvent.KEYCODE_DPAD_UP)){ parallaxLayer.offsetParallaxValue(0, 2); } if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME || keyCode == KeyEvent.KEYCODE_DPAD_LEFT)){ // Salir del trial y volver al menu de selección de escenas TrialSceneJump.this.unregisterUpdateHandler(trialTimerHandler); gameHUD.detachChildren(); SceneManager.getInstance().showScene(new TestingScene()); } return true; } // Para salir del trial y volver al menu de selección de escenas @Override public void onPressButtonA () { TrialSceneJump.this.unregisterUpdateHandler(trialTimerHandler); gameHUD.detachChildren(); SceneManager.getInstance().showScene(new TestingScene()); } /* @Override public void onBackPressed() { // Esto hay que hacerlo desde una actividad o no nos comemos nada ^^U }*/ /** * Adjust the trial parameters using the game difficulty as base. * @param diff The game difficulty. */ private void setTrialDiff(int diff) { if(diff == GameManager.DIFF_EASY) timeRound = 4; else if(diff == GameManager.DIFF_MEDIUM) timeRound = 2; else if(diff == GameManager.DIFF_HARD) timeRound = 1; } // Auxiliary Classes /** * Controls the character object in the scene * @author Madgear Games */ private class Character extends Entity { private AnimatedSprite charSprite; public Character(float posX, float posY) { charSprite = new AnimatedSprite(posX, posY, ResourceManager.getInstance().jumpChSho, ResourceManager.getInstance().engine.getVertexBufferObjectManager()); charSprite.setScale(2.91f); attachChild(charSprite); } public void start() { charSprite.animate(new long[] { 300, 300 }, new int[] {1, 2}, true); numberPerfectJumps = 0; numberPerfectJumpsInARow = 0; // Path path = new Path(2).to(0f, 0f).to(0f,0f); // charSprite.registerEntityModifier(new PathModifier(.0f, path)); } public float[] fall(float[] origin, float[] score) { angleBar.setJumpValue(1); float[] destiny = new float[] {0, 0}; if (origin[0] == jumpLeft){ //if he falls, it will land a little bit right destiny[0] = jumpLeft + 200f; //put this on the correct place for the shine to show in the right place charSprite.setFlippedHorizontal(false); } else{ destiny[0] = jumpRight - 200f; mShineOnFloor.setX(mCharacter.getX()); mShineOnFloor.setY(mCharacter.getY() - 170f); charSprite.setFlippedHorizontal(true); } if (origin[1] > 2000f){ //fall and lose falling = true; die = true; angleBar.ActivateTooHigh(); destiny[1] = origin[1] - 1000f; charSprite.animate(new long[] { 125, 125, 125, 125, 125, 125, 125, 125}, new int[] {20, 21, 20, 21, 22, 23, 22, 23}, false); Path path = new Path(2).to(origin[0], origin[1]) .to(destiny[0],destiny[1]); charSprite.registerEntityModifier(new PathModifier(1f, path)); } else{ //fall and continue playing destiny[1] = 0f; charSprite.animate(new long[] { 125, 125, 125, 125, 125, 125, 125, 125}, new int[] {20, 21, 20, 21, 22, 23, 22, 23}, false, new IAnimationListener(){ @Override public void onAnimationFinished(AnimatedSprite pAnimatedSprite){ start(); angleBar.setCursorValueToBeginning(); cutEnabled = true; //TODO: search the correct place for this mShineOnFloor.setX(mCharacter.getX()); mShineOnFloor.setY(mCharacter.getY() - 170f); } @Override public void onAnimationStarted( AnimatedSprite pAnimatedSprite, int pInitialLoopCount) { } @Override public void onAnimationFrameChanged( AnimatedSprite pAnimatedSprite, int pOldFrameIndex, int pNewFrameIndex) { } @Override public void onAnimationLoopFinished( AnimatedSprite pAnimatedSprite, int pRemainingLoopCount, int pInitialLoopCount) { } }); Path path = new Path(2).to(origin[0], origin[1]) .to(destiny[0],destiny[1]); charSprite.registerEntityModifier(new PathModifier(1f, path)); } destinyg = destiny; return destiny; } public float[] jump(float[] origin, float[] score) { float angle = (float) Math.atan(score[0]/score[1]); //float xDistance = 1270f; // x will be 0 or 100 always float[] destiny = new float[] {0, 0}; if (origin[0] == jumpLeft){ destiny[0] = jumpRight; charSprite.setFlippedHorizontal(false); } else{ destiny[0] = jumpLeft; charSprite.setFlippedHorizontal(true); } destiny[1] = ((float) (Math.tan(angle) * jumpRight)) * 0.1f + origin[1]; // its correct (float) (Math.tan(angle) * xDistance) + origin[1]; if (destiny[1] - origin[1] > 1000f) destiny[1] = origin[1] + 1000f; if (destiny[1] > 9050f) { destiny[1] = 9050f; finalAnimation = true;//do another animation } if (!finalAnimation) { charSprite.animate(new long[] { 75, 75, 75, 75, 75 , 75, 75, 75}, new int[] {8, 9, 10, 11, 12, 13, 14, 15}, false, new IAnimationListener(){ @Override public void onAnimationFinished(AnimatedSprite pAnimatedSprite){ } @Override public void onAnimationStarted( AnimatedSprite pAnimatedSprite, int pInitialLoopCount) { } @Override public void onAnimationFrameChanged( AnimatedSprite pAnimatedSprite, int pOldFrameIndex, int pNewFrameIndex) { if (pNewFrameIndex == 6 && destinyg[1] < 9040f) { angleBar.setCursorValueToBeginning(); angleBar.start(); cutEnabled = true; } } @Override public void onAnimationLoopFinished( AnimatedSprite pAnimatedSprite, int pRemainingLoopCount, int pInitialLoopCount) { } }); } else { charSprite.animate(new long[] { 75, 75, 75, 75, 75 , 75, 75, 75}, new int[] {8, 9, 10, 11, 16, 17, 18, 19}, false); if (destiny[0] == jumpRight) { destiny[0] += 160f; //if i take this two lines it holds the bamboo with the hand destiny[1] += 130f; //with this two it puts the foot on top of the bamboo } else { destiny[0] -= 160f; destiny[1] += 130f; } } Path path = new Path(2).to(origin[0], origin[1]) .to(destiny[0],destiny[1]); charSprite.registerEntityModifier(new PathModifier(.3f, path)); if (Double.isNaN(destiny[0]) || Double.isNaN(destiny[1])) destiny = origin; destinyg = destiny; return destiny; } } private class ShineOnFloor extends Entity { private final static long SPARK_TIME = 200; private AnimatedSprite shineSprite; private boolean active = false; public ShineOnFloor(float posX, float posY) { shineSprite = new AnimatedSprite(posX, posY, ResourceManager.getInstance().jumpEffectPreparation, ResourceManager.getInstance().engine.getVertexBufferObjectManager()); shineSprite.setVisible(false); attachChild(shineSprite); } public void activate() { active = true; } public void shine() { if (active) { active = false; shineSprite.setVisible(true); shineSprite.animate( new long[] {SPARK_TIME, SPARK_TIME, SPARK_TIME, SPARK_TIME}, new int[] {0,1,2,3}, true, new IAnimationListener(){ @Override public void onAnimationStarted(AnimatedSprite pAnimatedSprite, int pInitialLoopCount) {} @Override public void onAnimationFrameChanged(AnimatedSprite pAnimatedSprite, int pOldFrameIndex, int pNewFrameIndex) {} @Override public void onAnimationLoopFinished(AnimatedSprite pAnimatedSprite, int pRemainingLoopCount, int pInitialLoopCount) {} @Override public void onAnimationFinished(AnimatedSprite pAnimatedSprite) {} }); } } } private class Statue extends Entity { private Sprite statueSprite; public Statue() { statueSprite = new Sprite(500, 500, ResourceManager.getInstance().jumpBg1StoneStatues, ResourceManager.getInstance().engine.getVertexBufferObjectManager()); attachChild(statueSprite); } } public void loadBackgroundParallax() { // Creamos los sprites de las entidades parallax // Sprite Cielo mSpr_bg09_sky = new Sprite(0, 0, ResourceManager.getInstance().jumpBg9Sky, ResourceManager.getInstance().engine.getVertexBufferObjectManager()); mSpr_bg09_sky.setOffsetCenter(0, 0); // Si no hacemos esto, los sprites tienen su offset en el centro, así los colocamos abajo a la izquierda de la imagen mSpr_bg09_sky.setPosition(0, 0); // top = new Sprite(posX, posY, ResourceManager.getInstance().cutTreeTop, ResourceManager.getInstance().engine.getVertexBufferObjectManager()); // Sprite M. Fuji mSpr_bg08_fuji = new Sprite(0, 0, ResourceManager.getInstance().jumpBg8MountFuji , vertexBufferObjectManager); mSpr_bg08_fuji.setOffsetCenter(0, 0); mSpr_bg08_fuji.setPosition(0, pFY); // Sprite Lago mSpr_bg07_lake= new Sprite(0, 0, ResourceManager.getInstance().jumpBg7Lake, vertexBufferObjectManager); mSpr_bg07_lake.setOffsetCenter(0, 0); mSpr_bg07_lake.setPosition(0, pLY); // Sprite nubes mSpr_bg06_clouds = new Sprite(0, 0, ResourceManager.getInstance().jumpBg6Clouds, vertexBufferObjectManager); mSpr_bg06_clouds.setOffsetCenter(0, 0); mSpr_bg06_clouds.setPosition(0, pCY); // Sprite Pagoda mSpr_bg05_pagoda = new Sprite(0, 0, ResourceManager.getInstance().jumpBg5Pagoda, vertexBufferObjectManager); mSpr_bg05_pagoda.setOffsetCenter(0, 0); mSpr_bg05_pagoda.setPosition(pPX, pPY); // Sprite Montaña cercana mSpr_bg04_mount= new Sprite(0, 0, ResourceManager.getInstance().jumpBg4Mount, vertexBufferObjectManager); mSpr_bg04_mount.setOffsetCenter(0, 0); mSpr_bg04_mount.setPosition(0, pMY); // Sprites Bosque Bambu lejos mSpr_bg03_forest2_low = new Sprite(0, 0, ResourceManager.getInstance().jumpBg3BambooForest2Bottom, vertexBufferObjectManager); mSpr_bg03_forest2_low.setOffsetCenter(0, 0); mSpr_bg03_forest2_low.setPosition(0, 0); mSpr_bg03_forest2_mid = new Sprite(0, 0, ResourceManager.getInstance().jumpBg3BambooForest2Middle, vertexBufferObjectManager); mSpr_bg03_forest2_mid.setOffsetCenter(0, 0); mSpr_bg03_forest2_mid.setPosition(0, mSpr_bg03_forest2_low.getHeight()); mSpr_bg03_forest2_high = new Sprite(0, 0, ResourceManager.getInstance().jumpBg3BambooForest2Top, vertexBufferObjectManager); mSpr_bg03_forest2_high.setOffsetCenter(0, 0); mSpr_bg03_forest2_high.setPosition(0, mSpr_bg03_forest2_low.getHeight() + mSpr_bg03_forest2_mid.getHeight() ); // Sprites Bosque Bambu cerca mSpr_bg02_forest1_low = new Sprite(0, 0, ResourceManager.getInstance().jumpBg2BambooForest1Bottom, vertexBufferObjectManager); mSpr_bg02_forest1_low.setOffsetCenter(0, 0); mSpr_bg02_forest1_low.setPosition(0, 0); mSpr_bg02_forest1_mid1 = new Sprite(0, 0, ResourceManager.getInstance().jumpBg2BambooForest1Middle, vertexBufferObjectManager); mSpr_bg02_forest1_mid1.setOffsetCenter(0, 0); mSpr_bg02_forest1_mid1.setPosition(0, mSpr_bg02_forest1_low.getHeight()); mSpr_bg02_forest1_mid2 = new Sprite(0, 0, ResourceManager.getInstance().jumpBg2BambooForest1Middle, vertexBufferObjectManager); mSpr_bg02_forest1_mid2.setOffsetCenter(0, 0); mSpr_bg02_forest1_mid2.setPosition(0, mSpr_bg02_forest1_low.getHeight() + mSpr_bg02_forest1_mid1.getHeight() ); mSpr_bg02_forest1_high = new Sprite(0, 0, ResourceManager.getInstance().jumpBg2BambooForest1Top, vertexBufferObjectManager); mSpr_bg02_forest1_high.setOffsetCenter(0, 0); mSpr_bg02_forest1_high.setPosition(0, mSpr_bg02_forest1_low.getHeight() + mSpr_bg02_forest1_mid1.getHeight()*2 ); // Sprites Rebounding Bamboo trunk (left) mSpr_bg01_bamboo_low1 = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooBottom, vertexBufferObjectManager); mSpr_bg01_bamboo_low1.setOffsetCenter(0, 0); mSpr_bg01_bamboo_low1.setPosition(pBX1, 0); mSpr_bg01_bamboo_mid1_a = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooMiddle, vertexBufferObjectManager); mSpr_bg01_bamboo_mid1_a.setOffsetCenter(0, 0); mSpr_bg01_bamboo_mid1_a.setPosition(pBX1, mSpr_bg01_bamboo_low1.getHeight()); //68); //mSpr_bg01_bamboo_mid1_b = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooMiddle, vertexBufferObjectManager); //mSpr_bg01_bamboo_mid1_b.setOffsetCenter(0, 0); //mSpr_bg01_bamboo_mid1_b.setPosition(pBX1, mSpr_bg01_bamboo_low1.getHeight() + mSpr_bg01_bamboo_mid1_a.getHeight() ); //mSpr_bg01_bamboo_mid1_c = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooMiddle, vertexBufferObjectManager); //mSpr_bg01_bamboo_mid1_c.setOffsetCenter(0, 0); //mSpr_bg01_bamboo_mid1_c.setPosition(pBX1, mSpr_bg01_bamboo_low1.getHeight() + mSpr_bg01_bamboo_mid1_a.getHeight()*(repBamboo-1) ); mSpr_bg01_bamboo_high1 = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooTop, vertexBufferObjectManager); mSpr_bg01_bamboo_high1.setOffsetCenter(0, 0); mSpr_bg01_bamboo_high1.setPosition(pBX1, mSpr_bg01_bamboo_low1.getHeight()+ mSpr_bg01_bamboo_mid1_a.getHeight()*repBamboo); // 989); // Sprites Rebounding Bamboo trunk (right) mSpr_bg01_bamboo_low2 = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooBottom, vertexBufferObjectManager); mSpr_bg01_bamboo_low2.setOffsetCenter(0, 0); mSpr_bg01_bamboo_low2.setPosition(pBX2, 0); mSpr_bg01_bamboo_mid2_a = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooMiddle, vertexBufferObjectManager); mSpr_bg01_bamboo_mid2_a.setOffsetCenter(0, 0); mSpr_bg01_bamboo_mid2_a.setPosition(pBX2, mSpr_bg01_bamboo_low2.getHeight()); //68); //mSpr_bg01_bamboo_mid2_b = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooMiddle, vertexBufferObjectManager); //mSpr_bg01_bamboo_mid2_b.setOffsetCenter(0, 0); //mSpr_bg01_bamboo_mid2_b.setPosition(pBX2, mSpr_bg01_bamboo_low2.getHeight() + mSpr_bg01_bamboo_mid1_a.getHeight() ); //mSpr_bg01_bamboo_mid2_c = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooMiddle, vertexBufferObjectManager); //mSpr_bg01_bamboo_mid2_c.setOffsetCenter(0, 0); //mSpr_bg01_bamboo_mid2_c.setPosition(pBX2, mSpr_bg01_bamboo_low2.getHeight() + mSpr_bg01_bamboo_mid1_a.getHeight()*(repBamboo-1) ); mSpr_bg01_bamboo_high2 = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1BambooTop, vertexBufferObjectManager); mSpr_bg01_bamboo_high2.setOffsetCenter(0, 0); mSpr_bg01_bamboo_high2.setPosition(pBX2, mSpr_bg01_bamboo_low2.getHeight()+ mSpr_bg01_bamboo_mid1_a.getHeight()*repBamboo); // 989); // Sprites Statues mSpr_bg01_statues = new Sprite(0, 0, ResourceManager.getInstance().jumpBg1StoneStatues, vertexBufferObjectManager); mSpr_bg01_statues.setOffsetCenter(0, 0); mSpr_bg01_statues.setPosition(0, 0); // Creamos el fondo parallax y a continuación le asignamos las entidades parallax parallaxLayer = new ParallaxBackground2d(0, 0, 0); // Cielo parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL09, fFPL09, mSpr_bg09_sky, false, false)); // Fuji parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL08, fFPL08, mSpr_bg08_fuji, false, false)); // Bosque de bambú lejano parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL07, fFPL07, mSpr_bg07_lake, false, false)); // Nubes parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL06, fFPL06, mSpr_bg06_clouds, false, false)); // Pagoda parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL05, fFPL05, mSpr_bg05_pagoda, false, false)); // Montaña parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL04, fFPL04, mSpr_bg04_mount, false, false)); // Bosque de bambú lejano parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL03, fFPL03, mSpr_bg03_forest2_low, false, false)); parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL03, fFPL03, mSpr_bg03_forest2_mid, false, false)); parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL03, fFPL03, mSpr_bg03_forest2_high, false, false)); // Bosque de bambú cercano parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL02, fFPL02, mSpr_bg02_forest1_low, false, false)); parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL02, fFPL02, mSpr_bg02_forest1_mid1, false, false)); parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL02, fFPL02, mSpr_bg02_forest1_mid2, false, false)); parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL02, fFPL02, mSpr_bg02_forest1_high, false, false)); // Bambu rebotable izquierdo parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_low1, false, false)); pBE01 = new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_mid1_a, false, true, -1, 10); parallaxLayer.attachParallaxEntity(pBE01); //parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_mid1_b, false, false)); //pBE01); //parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_mid1_c, false, false)); // Bambu rebotable derecho parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_low2, false, false)); pBE02 = new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_mid2_a, false, true, -1, 10); parallaxLayer.attachParallaxEntity(pBE02); //parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_mid2_b, false, false)); //parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_mid2_c, false, false)); parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_high1, false, false)); parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_bamboo_high2, false, false)); // Estatuas parallaxLayer.attachParallaxEntity(new ParallaxBackground2d.ParallaxBackground2dEntity(fFPL01, fFPL01, mSpr_bg01_statues, false, false)); // Añadimos el fondo parallax a la escena this.setBackground(parallaxLayer); // Registramos el manejador de actualizaciones // this.registerUpdateHandler(bucleActualizaciones); // Iniciamos el autoscroll, para que pueda verse en dispositivos sin controles Ouya // autoScroll = true; // autoScrollUp(); // return this; } // Basurillas para que el scroll se mueva automáticamente sin necesidad de usar las clases Auto---ParallaxBackground public void autoScrollUp(){ if (autoScroll) desplazamientoParallaxVertical = 1; } public void autoScrollDown(){ if (autoScroll) desplazamientoParallaxVertical = -1; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
0362ad05bdfc383bc6b342fd2dad6fb44b1d0de6
da200c2c34cfb417fd24f05d6a3f4945db1f04d5
/api/src/main/java/org/openmrs/module/pihcore/setup/LocationTagSetup.java
06bd6aa0a468bd6686dc202ac09b628c0724d476
[]
no_license
Pnjiru/openmrs-module-pihcore
ea3e75f890301e493a442f1883a217eb872dbe11
e737dd0e7e8605635906aa58e9da4ea6748de960
refs/heads/master
2020-12-25T04:18:35.277265
2015-09-08T21:35:48
2015-09-08T21:35:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,565
java
package org.openmrs.module.pihcore.setup; import org.openmrs.Location; import org.openmrs.LocationTag; import org.openmrs.api.LocationService; import org.openmrs.module.pihcore.config.Config; import org.openmrs.module.pihcore.config.ConfigDescriptor; import org.openmrs.module.pihcore.descriptor.LocationDescriptor; import org.openmrs.module.pihcore.descriptor.LocationTagDescriptor; import org.openmrs.module.pihcore.metadata.core.LocationTags; import org.openmrs.module.pihcore.metadata.haiti.HaitiLocations; import org.openmrs.module.pihcore.metadata.haiti.mirebalais.MirebalaisLocations; import org.openmrs.module.pihcore.metadata.liberia.LiberiaLocations; import java.util.Arrays; import java.util.Collection; public class LocationTagSetup { // TODO make this less if-then based // TODO actually, when we get rid of these, we can probably set most of the tags in the bundles? public static void setupLocationTags(LocationService locationService, Config config) { if (config.getCountry().equals(ConfigDescriptor.Country.LIBERIA)) { if (config.getSite().equals(ConfigDescriptor.Site.PLEEBO)) { setupLocationTagsForPleebo(locationService); } } else if (config.getCountry().equals(ConfigDescriptor.Country.HAITI)) { if (config.getSite().equals(ConfigDescriptor.Site.LACOLLINE)) { setupLocationTagsForLacolline(locationService); } else if (config.getSite().equals(ConfigDescriptor.Site.MIREBALAIS)) { setupLocationTagsForMirebalais(locationService); } } } private static void setupLocationTagsForPleebo(LocationService locationService) { setLocationTagsFor(locationService, LocationTags.LOGIN_LOCATION, Arrays.asList(LiberiaLocations.PLEEBO)); setLocationTagsFor(locationService, LocationTags.CHECKIN_LOCATION, Arrays.asList(LiberiaLocations.PLEEBO)); setLocationTagsFor(locationService, LocationTags.REGISTRATION_LOCATION, Arrays.asList(LiberiaLocations.PLEEBO)); } private static void setupLocationTagsForLacolline(LocationService locationService) { setLocationTagsFor(locationService, LocationTags.LOGIN_LOCATION, Arrays.asList(HaitiLocations.LACOLLINE)); setLocationTagsFor(locationService, LocationTags.CONSULT_NOTE_LOCATION, Arrays.asList(HaitiLocations.LACOLLINE)); setLocationTagsFor(locationService, LocationTags.VITALS_LOCATION, Arrays.asList(HaitiLocations.LACOLLINE)); setLocationTagsFor(locationService, LocationTags.CHECKIN_LOCATION, Arrays.asList(HaitiLocations.LACOLLINE)); setLocationTagsFor(locationService, LocationTags.REGISTRATION_LOCATION, Arrays.asList(HaitiLocations.LACOLLINE)); setLocationTagsFor(locationService, LocationTags.MEDICAL_RECORD_LOCATION, Arrays.asList(HaitiLocations.LACOLLINE)); setLocationTagsFor(locationService, LocationTags.ADMISSION_LOCATION, null); setLocationTagsFor(locationService, LocationTags.TRANSFER_LOCAITON, null); setLocationTagsFor(locationService, LocationTags.ED_NOTE_LOCATION, null); setLocationTagsFor(locationService, LocationTags.SURGERY_NOTE_LOCATION, null); setLocationTagsFor(locationService, LocationTags.APPOINTMENT_LOCATION, null); setLocationTagsFor(locationService, LocationTags.DISPENSING_LOCATION, null); setLocationTagsFor(locationService, LocationTags.INPATIENTS_APP_LOCATION, null); setLocationTagsFor(locationService, LocationTags.ORDER_RADIOLOGY_STUDY_LOCATION, null); } private static void setupLocationTagsForMirebalais(LocationService locationService) { setLocationTagsFor(locationService, LocationTags.LOGIN_LOCATION, Arrays.asList( MirebalaisLocations.CLINIC_REGISTRATION, MirebalaisLocations.EMERGENCY_DEPARTMENT_RECEPTION, MirebalaisLocations.CENTRAL_ARCHIVES, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.EMERGENCY, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.DENTAL, MirebalaisLocations.WOMENS_CLINIC, MirebalaisLocations.WOMENS_TRIAGE, MirebalaisLocations.LABOR_AND_DELIVERY, MirebalaisLocations.ANTEPARTUM_WARD, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.OPERATING_ROOMS, MirebalaisLocations.PRE_OP_PACU, MirebalaisLocations.MAIN_LABORATORY, MirebalaisLocations.WOMENS_OUTPATIENT_LABORATORY, MirebalaisLocations.RADIOLOGY, MirebalaisLocations.MENS_INTERNAL_MEDICINE, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE, MirebalaisLocations.PEDIATRICS, MirebalaisLocations.ICU, MirebalaisLocations.NICU, MirebalaisLocations.ISOLATION, MirebalaisLocations.CHEMOTHERAPY, MirebalaisLocations.OUTPATIENT_CLINIC_PHARMACY, MirebalaisLocations.WOMENS_AND_CHILDRENS_PHARMACY, MirebalaisLocations.REHABILITATION, MirebalaisLocations.FAMILY_PLANNING, MirebalaisLocations.BLOOD_BANK, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.ADMISSION_LOCATION, Arrays.asList( MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.ANTEPARTUM_WARD, MirebalaisLocations.LABOR_AND_DELIVERY, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.PEDIATRICS, MirebalaisLocations.NICU, MirebalaisLocations.MENS_INTERNAL_MEDICINE, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE, MirebalaisLocations.ISOLATION, MirebalaisLocations.REHABILITATION, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.ICU )); setLocationTagsFor(locationService, LocationTags.TRANSFER_LOCAITON, Arrays.asList( MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.ANTEPARTUM_WARD, MirebalaisLocations.LABOR_AND_DELIVERY, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.EMERGENCY, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.WOMENS_CLINIC, MirebalaisLocations.WOMENS_TRIAGE, MirebalaisLocations.PEDIATRICS, MirebalaisLocations.NICU, MirebalaisLocations.DENTAL, MirebalaisLocations.MENS_INTERNAL_MEDICINE, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE, MirebalaisLocations.ISOLATION, MirebalaisLocations.REHABILITATION, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.ICU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL )); setLocationTagsFor(locationService, LocationTags.CONSULT_NOTE_LOCATION, Arrays.asList( MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.WOMENS_CLINIC, MirebalaisLocations.PRE_OP_PACU, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.ISOLATION, MirebalaisLocations.DENTAL, MirebalaisLocations.MENS_INTERNAL_MEDICINE, MirebalaisLocations.MENS_INTERNAL_MEDICINE_A, MirebalaisLocations.MENS_INTERNAL_MEDICINE_B, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_A, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_B, MirebalaisLocations.PEDIATRICS, MirebalaisLocations.PEDIATRICS_A, MirebalaisLocations.PEDIATRICS_B, MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.NICU, MirebalaisLocations.WOMENS_TRIAGE, MirebalaisLocations.ICU, MirebalaisLocations.LABOR_AND_DELIVERY, MirebalaisLocations.CHEMOTHERAPY, MirebalaisLocations.REHABILITATION, MirebalaisLocations.FAMILY_PLANNING, MirebalaisLocations.ANTEPARTUM_WARD, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.ED_NOTE_LOCATION, Arrays.asList( MirebalaisLocations.EMERGENCY )); setLocationTagsFor(locationService, LocationTags.SURGERY_NOTE_LOCATION, Arrays.asList( MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.OPERATING_ROOMS, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.POST_OP_GYN )); // TODO: update the following tags to remove unnecessary/unsupported CDI locations setLocationTagsFor(locationService, LocationTags.ADMISSION_NOTE_LOCATION, Arrays.asList( MirebalaisLocations.ANTEPARTUM_WARD, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.PRE_OP_PACU, MirebalaisLocations.MENS_INTERNAL_MEDICINE, MirebalaisLocations.MENS_INTERNAL_MEDICINE_A, MirebalaisLocations.MENS_INTERNAL_MEDICINE_B, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_A, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_B, MirebalaisLocations.PEDIATRICS, MirebalaisLocations.PEDIATRICS_A, MirebalaisLocations.PEDIATRICS_B, MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.NICU, MirebalaisLocations.OPERATING_ROOMS, MirebalaisLocations.WOMENS_TRIAGE, MirebalaisLocations.ICU, MirebalaisLocations.LABOR_AND_DELIVERY, MirebalaisLocations.ISOLATION, MirebalaisLocations.REHABILITATION, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.DISPENSING_LOCATION, Arrays.asList( MirebalaisLocations.WOMENS_AND_CHILDRENS_PHARMACY, MirebalaisLocations.OUTPATIENT_CLINIC_PHARMACY, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI )); setLocationTagsFor(locationService, LocationTags.APPOINTMENT_LOCATION, Arrays.asList( MirebalaisLocations.CHEMOTHERAPY, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.WOMENS_CLINIC, MirebalaisLocations.MAIN_LABORATORY, MirebalaisLocations.WOMENS_OUTPATIENT_LABORATORY, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.DENTAL, MirebalaisLocations.FAMILY_PLANNING, MirebalaisLocations.WOMENS_AND_CHILDRENS_PHARMACY, MirebalaisLocations.RADIOLOGY, MirebalaisLocations.OUTPATIENT_CLINIC_PHARMACY, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.VITALS_LOCATION, Arrays.asList( MirebalaisLocations.ANTEPARTUM_WARD, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.WOMENS_CLINIC, MirebalaisLocations.EMERGENCY, MirebalaisLocations.PRE_OP_PACU, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.DENTAL, MirebalaisLocations.MENS_INTERNAL_MEDICINE, MirebalaisLocations.MENS_INTERNAL_MEDICINE_A, MirebalaisLocations.MENS_INTERNAL_MEDICINE_B, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_A, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_B, MirebalaisLocations.PEDIATRICS, MirebalaisLocations.PEDIATRICS_A, MirebalaisLocations.PEDIATRICS_B, MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.NICU, MirebalaisLocations.OPERATING_ROOMS, MirebalaisLocations.WOMENS_TRIAGE, MirebalaisLocations.ICU, MirebalaisLocations.LABOR_AND_DELIVERY, MirebalaisLocations.CHEMOTHERAPY, MirebalaisLocations.REHABILITATION, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.INPATIENTS_APP_LOCATION, Arrays.asList( MirebalaisLocations.ANTEPARTUM_WARD, MirebalaisLocations.MAIN_LABORATORY, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.WOMENS_CLINIC, MirebalaisLocations.RADIOLOGY, MirebalaisLocations.EMERGENCY, MirebalaisLocations.PRE_OP_PACU, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.ISOLATION, MirebalaisLocations.DENTAL, MirebalaisLocations.MENS_INTERNAL_MEDICINE, MirebalaisLocations.MENS_INTERNAL_MEDICINE_A, MirebalaisLocations.MENS_INTERNAL_MEDICINE_B, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_A, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_B, MirebalaisLocations.PEDIATRICS, MirebalaisLocations.PEDIATRICS_A, MirebalaisLocations.PEDIATRICS_B, MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.NICU, MirebalaisLocations.CLINIC_REGISTRATION, MirebalaisLocations.OPERATING_ROOMS, MirebalaisLocations.WOMENS_TRIAGE, MirebalaisLocations.ICU, MirebalaisLocations.LABOR_AND_DELIVERY, MirebalaisLocations.CENTRAL_ARCHIVES, MirebalaisLocations.WOMENS_OUTPATIENT_LABORATORY, MirebalaisLocations.EMERGENCY_DEPARTMENT_RECEPTION, MirebalaisLocations.CHEMOTHERAPY, MirebalaisLocations.BLOOD_BANK, MirebalaisLocations.REHABILITATION, MirebalaisLocations.FAMILY_PLANNING, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.CHECKIN_LOCATION, Arrays.asList( MirebalaisLocations.WOMENS_CLINIC, MirebalaisLocations.EMERGENCY, MirebalaisLocations.PRE_OP_PACU, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.DENTAL, MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.WOMENS_TRIAGE, MirebalaisLocations.CHEMOTHERAPY, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.FAMILY_PLANNING, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.REGISTRATION_LOCATION, Arrays.asList( MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.CLINIC_REGISTRATION, MirebalaisLocations.CENTRAL_ARCHIVES, MirebalaisLocations.EMERGENCY_DEPARTMENT_RECEPTION, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.ED_REGISTRATION_LOCATION, Arrays.asList( MirebalaisLocations.EMERGENCY, MirebalaisLocations.PRE_OP_PACU, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.DENTAL, MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); setLocationTagsFor(locationService, LocationTags.ORDER_RADIOLOGY_STUDY_LOCATION, Arrays.asList( MirebalaisLocations.ANTEPARTUM_WARD, MirebalaisLocations.POSTPARTUM_WARD, MirebalaisLocations.WOMENS_CLINIC, MirebalaisLocations.PRE_OP_PACU, MirebalaisLocations.OUTPATIENT_CLINIC, MirebalaisLocations.RADIOLOGY, MirebalaisLocations.EMERGENCY, MirebalaisLocations.ISOLATION, MirebalaisLocations.DENTAL, MirebalaisLocations.MENS_INTERNAL_MEDICINE, MirebalaisLocations.MENS_INTERNAL_MEDICINE_A, MirebalaisLocations.MENS_INTERNAL_MEDICINE_B, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_A, MirebalaisLocations.WOMENS_INTERNAL_MEDICINE_B, MirebalaisLocations.PEDIATRICS, MirebalaisLocations.PEDIATRICS_A, MirebalaisLocations.PEDIATRICS_B, MirebalaisLocations.SURGICAL_WARD, MirebalaisLocations.POST_OP_GYN, MirebalaisLocations.COMMUNITY_HEALTH, MirebalaisLocations.NICU, MirebalaisLocations.OPERATING_ROOMS, MirebalaisLocations.WOMENS_TRIAGE, MirebalaisLocations.ICU, MirebalaisLocations.LABOR_AND_DELIVERY, MirebalaisLocations.CHEMOTHERAPY, MirebalaisLocations.REHABILITATION, MirebalaisLocations.FAMILY_PLANNING, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_ACHIV_SANTRAL, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_BIWO_RANDEVOU, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_FAMASI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_LABORATWA, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_RADYOGRAFI, MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL_SAL_PWOSEDI )); } private static void setLocationTagsFor(LocationService service, LocationTagDescriptor locationTag, Collection<LocationDescriptor> locationsThatGetTag) { LocationTag tag = service.getLocationTagByUuid(locationTag.uuid()); for (Location candidate : service.getAllLocations()) { boolean expected = false; if (locationsThatGetTag != null) { for (LocationDescriptor d : locationsThatGetTag) { if (d != null && d.uuid().equals(candidate.getUuid())) { expected = true; } } } boolean actual = candidate.hasTag(tag.getName()); if (actual && !expected) { candidate.removeTag(tag); service.saveLocation(candidate); } else if (!actual && expected) { candidate.addTag(tag); service.saveLocation(candidate); } } } }
[ "mgoodrich@pih.org" ]
mgoodrich@pih.org
22efe149e94d7e3c88a8869ecd4148bbd3407485
a6ee43db1ecf659c47967d3334ba15e504947a5e
/src/test/java/com/leetcode/minimum_number_of_k_consecutive_bit_flips/TesterRunner.java
8ca864a19eab61ebac00ce059dbe590c6a0caf22
[ "MIT" ]
permissive
magnetic1/leetcode
fa3d640b640b4626705272bbcafc31c082fa6138
4577439aac13f095bc1f20adec5521520b3bef70
refs/heads/master
2023-04-21T10:28:10.320263
2021-05-06T12:22:57
2021-05-06T12:22:57
230,269,263
2
0
null
null
null
null
UTF-8
Java
false
false
1,489
java
/** * Leetcode - minimum_number_of_k_consecutive_bit_flips */ package com.leetcode.minimum_number_of_k_consecutive_bit_flips; // basic util import java.util.*; import com.ciaoshen.leetcode.util.*; // leetcode-helper library import com.ciaoshen.leetcode.helper.PropertyScanner; // junit import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; // log4j import org.apache.log4j.PropertyConfigurator; // slf4j import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * In most case you DO NOT NEED TO CHANGE ANYTHING in this class. */ public class TesterRunner { // use this Object to print the log (call from slf4j facade) private static final Logger LOGGER = LoggerFactory.getLogger(TesterRunner.class); // both log4j and slf4j are included in leetcode-helper.jar private static final String LOG4J = "log4j.properties"; public static void main(String[] args) { // use log4j as Logger implementation Properties log4jProps = PropertyScanner.load(LOG4J); // PropertyScanner load "log4j.properties" for us PropertyConfigurator.configure(log4jProps); // run Tester.class Result result = JUnitCore.runClasses(Tester.class); for (Failure failure : result.getFailures()) { System.out.println(failure); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Pass all JUnit test? {}", result.wasSuccessful()); } } }
[ "1228740123@qq.com" ]
1228740123@qq.com
ae0ac26f766292387202524bccfbdfd3fea8e549
c38d28206047d000024e00d59e00322e375b2ea6
/src/main/java/com/example/demo/designer/strategy/EntBStrategy.java
af1ed04b2e3445a8820620db3b2abac1c7e55488
[]
no_license
aliantony/springboot-plus-demo
ab5a03d35167097788a9a00e1bcb5231e0309ce5
54619bc57741716e798d8c2df458ddc5f607c1a3
refs/heads/master
2022-07-06T20:18:11.485637
2020-06-11T08:04:06
2020-06-11T08:04:06
204,858,051
0
0
null
2022-06-21T01:45:45
2019-08-28T05:52:14
Java
UTF-8
Java
false
false
430
java
package com.example.demo.designer.strategy; import org.springframework.stereotype.Component; @Component public class EntBStrategy implements EntStrategy { @Override public String getStuff() { return "企业B"; } @Override public void send() { System.out.println("发送B标准的报文给对应企业"); } @Override public String toString() { return getStuff(); } }
[ "wangqian@antiy.cn" ]
wangqian@antiy.cn
48af60f17c1580b77002c961609646a06e495950
ed6950d145b127bf24082d779d37ce170f092591
/src/com/gui/FormularioPanel.java
755fe45740caff96d8d51382273b117fc1a4464f
[]
no_license
bryanvargas/generador_frases_TPI
b1f252a5e9ed35aed23c96c14dbef03a2ff0f6ff
f6f728ce06221e4964530cf9a710b3caffa11e1a
refs/heads/master
2016-09-16T02:42:43.561191
2015-07-16T21:24:28
2015-07-16T21:24:28
39,218,694
0
0
null
null
null
null
UTF-8
Java
false
false
6,683
java
package com.gui; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JSlider; import javax.swing.border.Border; public class FormularioPanel extends JPanel{ private static final long serialVersionUID = 1671891217834203461L; private JLabel $temaFrase_jl, $cantidadFrase_jl, $nivelAgresiv_jl, $agresiv_jl; @SuppressWarnings("rawtypes") private JComboBox $listaTema_jcb, $cantFrases_jcb; private JSlider $nivelAgresibidad_s; @SuppressWarnings("rawtypes") private JList ageList; private JButton generar_btn; private JRadioButton bajoRadio; private JRadioButton altoRadio; private ButtonGroup agresibidadGroup; private FormularioListener formListener; static final int FPS_INIT = 5; int delay; public FormularioPanel() { setLayout(null); Dimension dim = getPreferredSize(); dim.width = 257; setPreferredSize(dim); setMinimumSize(dim); inicializarComponentes(); /** ******************************************************************************* **/ /** **************************** Eventos del Boton Generar ************************ **/ /** ******************************************************************************* **/ generar_btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GramCategoria categoriaGram = (GramCategoria)ageList.getSelectedValue(); String tema = (String)$listaTema_jcb.getSelectedItem(); String nivel = (String) $cantFrases_jcb.getSelectedItem(); int nivelInteger = Integer.parseInt(nivel); String agresibidad = agresibidadGroup.getSelection().getActionCommand(); //crea un evento donde le pasa como argumentos los datos del formPanel FormularioEvent ev = new FormularioEvent(this, tema, nivelInteger, agresibidad, categoriaGram.id); if (formListener != null) { formListener.formEventOccurred(ev); } } }); } /** ******************************************************************************* **/ /** **************************** Inicializar Componentes ************************ **/ /** ******************************************************************************* **/ @SuppressWarnings({ "unchecked", "rawtypes" }) private void inicializarComponentes() { //Set Up $temaFrase_jl $temaFrase_jl = new JLabel("Seleccione Tema"); $temaFrase_jl.setBounds(20,40, 120, 25); //Set Up $listaTema_jcb $listaTema_jcb = new JComboBox(); DefaultComboBoxModel modelo = new DefaultComboBoxModel(); modelo.addElement("Amor"); modelo.addElement("Deporte"); modelo.addElement("Tristeza"); modelo.addElement("Alegria"); modelo.addElement("Dolor"); modelo.addElement("Odio"); $listaTema_jcb.setModel(modelo); $listaTema_jcb.setSelectedItem(0); $listaTema_jcb.setEditable(false); $listaTema_jcb.setBounds(120, 40, 85, 25); //$cantidadFrase_jl $cantidadFrase_jl = new JLabel("Cantidad: "); $cantidadFrase_jl.setBounds(20, 80, 120, 25); add($cantidadFrase_jl); $cantFrases_jcb = new JComboBox(); for(int f=1;f<=50;f++) { $cantFrases_jcb.addItem(String.valueOf(f)); } $cantFrases_jcb.setMaximumRowCount(5); $cantFrases_jcb.setBounds(120, 80, 85, 25); //Set Up $nivelAgresibidad_s $nivelAgresibidad_s = new JSlider(JSlider.VERTICAL, 0, 10, FPS_INIT); $nivelAgresibidad_s.setMajorTickSpacing(1); $nivelAgresibidad_s.setMinorTickSpacing(1); $nivelAgresibidad_s.setPaintTicks(true); //Set Up $$nivelAgresibidad_s $nivelAgresibidad_s.setPaintLabels(true); $nivelAgresibidad_s.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); $nivelAgresibidad_s.setMinimum(1); //ageList ageList = new JList(); DefaultListModel ageModel = new DefaultListModel(); ageModel.addElement(new GramCategoria(0,"Baja")); ageModel.addElement(new GramCategoria(1,"Medio")); ageModel.addElement(new GramCategoria(2,"Alta")); ageList.setModel(ageModel); ageList.setPreferredSize(new Dimension(110,66)); ageList.setBorder(BorderFactory.createEtchedBorder()); ageList.setSelectedIndex(1); ageList.setBounds(120, 200, 88, 65); $nivelAgresiv_jl = new JLabel("Complejidad"); $nivelAgresiv_jl.setBounds(20, 200, 80, 30); $agresiv_jl = new JLabel("Agresibidad"); $agresiv_jl.setBounds(20, 110, 100, 50); add($agresiv_jl); bajoRadio = new JRadioButton("bajo"); bajoRadio.setActionCommand("bajo"); bajoRadio.setSelected(true); bajoRadio.setBounds(120, 110, 100, 50); altoRadio = new JRadioButton("alto"); altoRadio.setActionCommand("alto"); altoRadio.setBounds(120, 150, 100, 50); agresibidadGroup = new ButtonGroup(); agresibidadGroup.add(bajoRadio); agresibidadGroup.add(altoRadio); generar_btn = new JButton("Generar frase"); generar_btn.setBounds(70, 580, 120, 30); generar_btn.setMnemonic(KeyEvent.VK_O); add($temaFrase_jl); add($listaTema_jcb); add($cantFrases_jcb); add(ageList); add($nivelAgresiv_jl); add(bajoRadio); add(altoRadio); add(generar_btn); Border innerBorder = BorderFactory.createTitledBorder(null, "Generador de Frases", delay, delay, new Font("Thaoma", Font.BOLD, 17), Color.GRAY); Border outerBorder = BorderFactory.createEmptyBorder(7, 7, 7, 7); setBorder(BorderFactory.createCompoundBorder(innerBorder, outerBorder)); // setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Generador de Frases", //javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, // new Font("Tahoma", Font.BOLD, 16))); } class GramCategoria{ private String texto; private int id; public GramCategoria(int id, String texto){ this.id = id; this.texto = texto; } @Override public String toString() { return this.texto; } public int getId() { return id; } } public void setFormListener(FormularioListener formListener) { this.formListener = formListener; } // //este metodo borrar public void addListener(Action addAction) { generar_btn.addActionListener(addAction); } }
[ "bryanprsvar@gmail.com" ]
bryanprsvar@gmail.com
5358a97d91b2c29cc277b1ff8baaf75f1c58bd5a
4540ae0c0ad1ab8b18127dd248bd317f5c38a38e
/src/com/pr/im/activites/WelcomeActivity.java
39fbc86654bf4f5b4fec8a0c532a314a3e44ef76
[]
no_license
pryh354896/IM
cdd9b4d795ea9be24657707e11f7175ce798b004
d1bbb7c3b9c548e900c0ef5e881ba6fb2005b68d
refs/heads/master
2021-01-11T20:01:55.740214
2017-01-19T12:35:54
2017-01-19T12:35:54
79,452,049
1
1
null
null
null
null
UTF-8
Java
false
false
837
java
package com.pr.im.activites; import com.pr.im.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.Window; public class WelcomeActivity extends Activity{ private Handler hander; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.welcome); hander = new Handler(); hander.postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub goLoginActivity(); } }, 1200); } public void goLoginActivity() { Intent intent = new Intent(); intent.setClass(this, LoginActivity.class); startActivity(intent); finish(); } }
[ "puriyouhua@gmail.com" ]
puriyouhua@gmail.com
d1d9a5501b701d414026a2aeea242bfd6bee4592
f01056564edb939537bf97e6d8452fe118702855
/src/test/java/com/dzkd/website/service/NewsServiceImplTest.java
88503a79b52df1889023863225719fb207b72710
[]
no_license
fzk19996/website
36b3fa751b4d1a25e59f8ba671bdde9ee5663a0f
e38519e8c1d11674a5a0fc8c472be2f8ccd113cc
refs/heads/master
2021-09-20T18:29:30.816782
2018-08-14T01:01:31
2018-08-14T01:01:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package com.dzkd.website.service; import com.dzkd.website.dao.NewsMapper; import com.dzkd.website.pojo.News; import com.dzkd.website.pojo.R; import com.dzkd.website.service.Impl.NewsServiceImpl; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.Comparator; import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest public class NewsServiceImplTest { @Autowired private NewsServiceImpl newsService; @Autowired private NewsMapper newsMapper; @Test public void showNews() { R r = newsService.showAll(1,5,1); System.out.println(r.toString()); } @Test public void sortedList() { List<News> newsList = newsMapper.selectAll(null); newsList.sort(Comparator.comparing(News::getNewsTime).reversed()); newsList.forEach(item -> System.out.println(item.getNewsTypeName()+ item.getNewsTitle() + item.getNewsTime())); } }
[ "alex.zhao1023@gmail.com" ]
alex.zhao1023@gmail.com
45a1a1f789d012a827fa78497a753bc9b5bce98b
5207d062f8e874b7eac28a66e14c79989df111c1
/JavaSE/src/APILearn/SystemLearn.java
7913386a91054b44199b095e24e6ceaceed2b355
[]
no_license
ruyanxi/JavaLearn
035c6be9c3d0a619a5cefde138a09a1189f98d37
a37f75530a3fccc6493579e879ba83d36c4621ee
refs/heads/master
2023-08-08T02:17:28.814982
2021-09-13T06:26:09
2021-09-13T06:26:09
405,845,703
0
0
null
null
null
null
UTF-8
Java
false
false
980
java
package APILearn; /** * @author: 朢曐(雷杨一凡) * @Title: SystemLearn * @ProjectName: java-se-learning * @Description: * @date: 2021/8/27 10:58 */ public class SystemLearn { public static void main(String[] args) { //|public static void exit(int status)|---------->终止当前运行的Java虚拟机,非零表示异常终止| System.out.println("beginning"); // System.exit(0); System.out.println("ending"); System.out.println("-----------------"); //|public static long currentTimeMillis()|---------->返回当前时间(以毫秒为单位)| System.out.println(System.currentTimeMillis()); System.out.println("-----------------"); long start = System.currentTimeMillis(); for (int i = 0;i < 10000;i++){ System.out.println(i); } long end = System.currentTimeMillis(); System.out.println("共耗时:"+(end-start)+"毫秒"); } }
[ "ruyanxi@gmail.com" ]
ruyanxi@gmail.com
2b3ec2a64254239959320848bde1c50897615c19
bf117a44c34f4341b41e43e4e11752a9332008f1
/src/Singleton/Singleton_3.java
f54a548c21a9d1a961ab762c7c1aea8f0f96b76d
[]
no_license
coder-zhw/DesignPattern
c0e4cace55ce545e3d6da8335f1e26d11bca781a
f1c174aa5773786e3488b05c80609cc49f31c900
refs/heads/master
2016-09-12T23:51:53.815437
2016-05-14T13:33:48
2016-05-14T13:33:48
59,119,817
0
1
null
null
null
null
UTF-8
Java
false
false
454
java
package Singleton; /** * (饿汉,变种): 表面上看起来差别挺大,其实更第三种方式差不多,都是在类初始化即实例化instance。 * @author Administrator * */ public class Singleton_3 { private static Singleton_3 instance = null; static { instance = new Singleton_3(); } private Singleton_3 (){} public static Singleton_3 getInstance() { return instance; } }
[ "coder.zhw@qq.com" ]
coder.zhw@qq.com
bf1276decf0b2737ab0c4658ad8d3f93d0025cba
620190e436d4c029c9d3e170b02a9f5f30ba25c5
/src/main/java/poker/decks/DeckStandardShuffled.java
19b7527158158660fd551d2ee5759606b0c937e8
[]
no_license
fennJam/testPokerStrategies
03a8e52c234c8b7895611cf8078cbdc663b078a1
df0fb141b119c654d1f27af982fd06080a36234a
refs/heads/master
2021-06-22T05:15:54.763424
2017-08-21T17:40:12
2017-08-21T17:40:12
100,249,035
0
1
null
null
null
null
UTF-8
Java
false
false
2,757
java
package poker.decks; import java.util.ArrayList; import java.util.Collections; import poker.Card; public class DeckStandardShuffled implements Deck { // Copyright 2014 theaigames.com (developers@theaigames.com) // 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. // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. /** * Class representing a single deck of cards, which is shuffled in random * order. Cards can be drawn from the deck. */ private ArrayList<Integer> cardOrder; // private ArrayList<Integer> cardOrderSavePoint; /** * Creates a new deck of 52 cards, represented by integers 0 to 51, which * are then shuffled. */ public DeckStandardShuffled() { cardOrder = new ArrayList<Integer>(); for (int i = 0; i < 52; i++) cardOrder.add(i); Collections.shuffle(cardOrder); } /** * Refreshes the deck such that it is a shuffled deck of 52 cards again. */ @Override public void resetDeck() { cardOrder = new ArrayList<Integer>(); for (int i = 0; i < 52; i++) cardOrder.add(i); Collections.shuffle(cardOrder); } /** * Set a save point for the deck status, can be used for trying multiple * random draws from a non-complete deck. */ // @Override // public void setSavePoint() { // cardOrderSavePoint = (ArrayList<Integer>) cardOrder.clone(); // } // // /** // * Set the deck back to the status of the last restore point, reshuffling // * the remaining cards. // */ // @Override // public void restoreToSavePoint() { // cardOrder = (ArrayList<Integer>) cardOrderSavePoint.clone(); // Collections.shuffle(cardOrder); // } /** * Pushes and returns the next card from the deck. */ @Override public Card nextCard() { if (cardOrder.size() <= 0) { System.err.println("The deck is empty"); return null; } int nextCardNumber = cardOrder.remove(cardOrder.size() - 1); Card card = new Card(nextCardNumber); return card; } @Override public Card peekAtNextCard() { return new Card(cardOrder.get(cardOrder.size() - 1)); } @Override public Deck unShuffleDeck() { cardOrder = new ArrayList<Integer>(); for (int i = 0; i < 52; i++) cardOrder.add(i); return this; } }
[ "James@james.James" ]
James@james.James
1d8739d248b2257021a44807fa1437e7c640d79a
a0f3e47e90740b77ed70d484b8c6cc7546ceed33
/src/main/java/com/fh/model/Product.java
420a16aa9ac3dc9b70a5d0e6a1def9a5042e848f
[]
no_license
peng2222/shop-admin
187fb1096fad0f283258d9c1bd2b538a93f09082
394201301c7a59713ba11f2fefc118822d6e4fc8
refs/heads/master
2022-12-22T10:57:23.605656
2020-01-12T01:27:12
2020-01-12T01:27:12
233,321,806
0
0
null
2022-12-16T11:08:46
2020-01-12T01:26:57
JavaScript
UTF-8
Java
false
false
2,954
java
package com.fh.model; import java.math.BigDecimal; public class Product { private Integer id; private String name; //商品名称 private String title; //标题 private Integer brandId; //品牌id private String brandName; //品牌名称 private Integer status; //状态: 1代表上架 2代表下架 private Integer isHot; //是否热销商品: 1代表是 2代表否 private BigDecimal price; //商品均价,在前台门户系统商品列表也中显示使用 private String filePath; //商品主图 private String remark; //商品描述 private Integer classifyId1; //商品一级分类id private Integer classifyId2; //商品二级分类id private Integer classifyId3; //商品三级分类id private String classifyName; //电子产品/手机/智能手机 public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getBrandName() { return brandName; } public void setBrandName(String brandName) { this.brandName = brandName; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Integer getBrandId() { return brandId; } public void setBrandId(Integer brandId) { this.brandId = brandId; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Integer getIsHot() { return isHot; } public void setIsHot(Integer isHot) { this.isHot = isHot; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public Integer getClassifyId1() { return classifyId1; } public void setClassifyId1(Integer classifyId1) { this.classifyId1 = classifyId1; } public Integer getClassifyId2() { return classifyId2; } public void setClassifyId2(Integer classifyId2) { this.classifyId2 = classifyId2; } public Integer getClassifyId3() { return classifyId3; } public void setClassifyId3(Integer classifyId3) { this.classifyId3 = classifyId3; } public String getClassifyName() { return classifyName; } public void setClassifyName(String classifyName) { this.classifyName = classifyName; } }
[ "954183427@qq.com" ]
954183427@qq.com
eb22bab1d29de7897c48ab0b1ed417be5ddcf807
b96e0ce1aa6a57b94f6e51b5487d68d8eed00174
/ Factory/src/Dealer.java
0db3ada22acdd0a30fc378df087b271c83f2af68
[]
no_license
hellianet/Java-OOP
db6ef4ac5058036041aa232f1c7fe94d187b3031
6b9c1ac5b20c2773462dd3fe1e1985d4099b3e34
refs/heads/master
2021-02-08T07:40:12.648985
2020-06-14T17:16:41
2020-06-14T17:16:41
244,125,095
0
0
null
null
null
null
UTF-8
Java
false
false
661
java
public class Dealer extends Thread { private final int time; private final CarFactory factory; public Dealer(CarFactory factory, int time){ this.time = time; this.factory = factory; } @Override public void run(){ while (!isInterrupted()){ try { Car car = factory.getCar(); System.out.println("Car №" + car.getId() + " (Engine=" + car.getEngineId() + ", Body=" + car.getBodyId()+ ", Accessory=" + car.getAccessoryId() +")"); Thread.sleep(time); } catch (InterruptedException e) { break; } } } }
[ "kristina.lanchukovskaya@gmail.com" ]
kristina.lanchukovskaya@gmail.com
9e6057db7150816b26a091aeb3b19cfdff21fc7b
b5bc05649f984c8127357f5776cd86409f741555
/src/main/java/hiber/config/AppConfig.java
1b5b6b49901848621e4034446af1ab2f6e6cf271
[]
no_license
ads1383/Spring_hibernate
cb5db116fe8bbf1cfb30c4e1050a02099d6961fd
2438b2bbd17fae30fb1f5ca73351b744e364ee91
refs/heads/master
2023-03-02T11:26:36.883687
2021-02-13T16:37:59
2021-02-13T16:37:59
338,618,742
0
0
null
null
null
null
UTF-8
Java
false
false
2,182
java
package hiber.config; import hiber.model.Car; import hiber.model.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.orm.hibernate5.HibernateTransactionManager; import org.springframework.orm.hibernate5.LocalSessionFactoryBean; import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.sql.DataSource; import java.util.Properties; @Configuration @PropertySource("classpath:db.properties") @EnableTransactionManagement @ComponentScan(value = "hiber") public class AppConfig { @Autowired private Environment env; @Bean public DataSource getDataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName(env.getProperty("db.driver")); dataSource.setUrl(env.getProperty("db.url")); dataSource.setUsername(env.getProperty("db.username")); dataSource.setPassword(env.getProperty("db.password")); return dataSource; } @Bean public LocalSessionFactoryBean getSessionFactory() { LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean(); factoryBean.setDataSource(getDataSource()); Properties props=new Properties(); props.put("hibernate.show_sql", env.getProperty("hibernate.show_sql")); props.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); factoryBean.setHibernateProperties(props); factoryBean.setAnnotatedClasses(User.class, Car.class); return factoryBean; } @Bean public HibernateTransactionManager getTransactionManager() { HibernateTransactionManager transactionManager = new HibernateTransactionManager(); transactionManager.setSessionFactory(getSessionFactory().getObject()); return transactionManager; } }
[ "ads83@yandex.ru" ]
ads83@yandex.ru
b928e9e1495b4c11eb7d82e9ca45b687e4de8331
5149b7de9c66fcf4919ad2888783227eaeb3a3e7
/rocketmq-demo/src/main/java/com/itheima/mq/rocketmq/order/Consumer.java
5fbb9efe6cc6f0b8535d7ba991594bc75fb12845
[]
no_license
liqiang321/RocketMq
0585d8f44fbb12c73b70c6ccc4d781962ab09f0c
4411adcd0802e52c21e68cc57dbdb0d6c7dd8eed
refs/heads/master
2022-12-22T10:08:14.392544
2020-09-14T07:06:38
2020-09-14T07:06:38
295,332,718
0
0
null
null
null
null
UTF-8
Java
false
false
1,504
java
package com.itheima.mq.rocketmq.order; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.ConsumeOrderlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeOrderlyStatus; import org.apache.rocketmq.client.consumer.listener.MessageListenerOrderly; import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.common.message.MessageExt; import java.util.List; public class Consumer { public static void main(String[] args) throws MQClientException { //1.创建消费者Consumer,制定消费者组名 DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("group1"); //2.指定Nameserver地址 consumer.setNamesrvAddr("127.0.0.1:9876"); //3.订阅主题Topic和Tag consumer.subscribe("OrderTopic", "*"); //4.注册消息监听器 consumer.registerMessageListener(new MessageListenerOrderly() { @Override public ConsumeOrderlyStatus consumeMessage(List<MessageExt> msgs, ConsumeOrderlyContext context) { for (MessageExt msg : msgs) { System.out.println("线程名称:【" + Thread.currentThread().getName() + "】:" + new String(msg.getBody())); } return ConsumeOrderlyStatus.SUCCESS; } }); //5.启动消费者 consumer.start(); System.out.println("消费者启动"); } }
[ "15901355259@163.com" ]
15901355259@163.com
5557119ce82ce13acb7b4a58e84f9a8b9180511f
957afe420caed563921d3a90354b34487f1b6adf
/AddressBook/PersonPopupController.java
0743c06818706c6475064b70f734c302467baefa
[]
no_license
BrettMerrillX/Computer_Science_Projects
298169aa2c2244a70318815fb0089c7d2d93276a
9e09135a2cbe0e120925a64ebd959ce8454d9c3b
refs/heads/master
2021-01-11T05:58:51.817212
2018-04-27T16:25:59
2018-04-27T16:25:59
94,951,733
0
0
null
null
null
null
UTF-8
Java
false
false
3,867
java
package edu.uoregon.teamwon; import javafx.fxml.FXML; import javafx.scene.control.TextField; import javafx.stage.Stage; /** * @author Sherry Ma * @revision Yehui Yehui Jan 28 * > Changed State input box to a choice box. Now this application only accepts U.S. States. * > Implemented inputValidation method. For now, if any fields has invalid data, an alert will pop up when user is trying to save the change. */ public class PersonPopupController { @FXML private TextField firstNameField; @FXML private TextField lastNameField; @FXML private TextField firstAddressField; @FXML private TextField secondAddressField; @FXML private TextField cityField; @FXML private TextField stateField; @FXML private TextField zipCodeField; @FXML private TextField phoneField; @FXML private TextField emailField; private Stage dialogStage; private Person person; private boolean okClicked = false; /** * Sets the stage of this dialog. * @param dialogStage */ public void setDialogStage(Stage dialogStage) { this.dialogStage = dialogStage; } /** * Sets the person to be edited in the dialog. * * @param person */ public void setPerson(Person person) { this.person = person; firstNameField.setText(person.getFirstName()); lastNameField.setText(person.getLastName()); firstAddressField.setText(person.getStreetAddress1()); secondAddressField.setText(person.getStreetAddress2()); cityField.setText(person.getCity()); stateField.setText(person.getState()); zipCodeField.setText(person.getZip()); phoneField.setText(person.getPhoneNumber()); emailField.setText(person.getEmail()); } /** * Returns true if the user clicked OK, false otherwise. * @return */ public boolean isOkClicked(){ return okClicked; } public PersonPopupController() { } /** * Called when the user clicks ok. */ @FXML private void handleOk() { Person p = new Person(); p.setFirstName(firstNameField.getText()); p.setLastName(lastNameField.getText()); p.setStreetAddress1(firstAddressField.getText()); p.setStreetAddress2(secondAddressField.getText()); p.setCity(cityField.getText()); String state_reform = reformatState(stateField.getText()); p.setState(state_reform); p.setZip(zipCodeField.getText()); p.setPhoneNumber(phoneField.getText()); p.setEmail(emailField.getText()); String validationOutput = p.validationStatus(); if(validationOutput.length() == 0){ person.copyValues(p); okClicked = true; dialogStage.close(); } else{ Boolean saveAnyway = AlertBox.confirmationBox("Invalid Input values", "We have detected that following fields are " + "either missing or do not follow the our input standards.\n" + "Please refer to the user's manual for details. \n\n\n" + validationOutput, "Do you want to proceed and save?"); if(saveAnyway){ //this.person = p; person.copyValues(p); okClicked = true; dialogStage.close(); } } } /** * Called when user clicks cancel. */ @FXML private void handleCancel(){ dialogStage.close(); } /** * Return the person created or edited. */ private Person getPerson(){ return person; } //TODO: Reformat State private String reformatState(String state){ return state; } }
[ "noreply@github.com" ]
noreply@github.com
3658c5d41a6aeea72ad0b425713ae070e6566286
253ac4599bdf7fb27ca3356856637a2c21d5a20a
/BufferManager/src/hashtable/HashEntry.java
8f70d5aa555bee2a30aedf2342b2f3ed7ccf02d5
[]
no_license
srypher/CS448_Project2
a7d282df5d35a00ff231124711804eb223e8cdee
c7acf2f4de87ce9e2030fd90c0aad7359e3f6ea3
refs/heads/master
2021-01-10T03:26:48.114278
2016-02-19T04:19:40
2016-02-19T04:19:40
51,335,705
0
1
null
2016-02-19T02:53:59
2016-02-08T23:44:56
Java
UTF-8
Java
false
false
625
java
package hashtable; public class HashEntry { private int key; private int value; private HashEntry nextEntry; HashEntry(int key, int value) { this.key = key; this.value = value; nextEntry = null; } public int getKey() { return key; } public int getValue() { return value; } public HashEntry getNextEntry() { return nextEntry; } public void setValue(int newValue) { value = newValue; } public void setNextEntry(HashEntry newNext) { nextEntry = newNext; } }
[ "lazarm@purdue.edu" ]
lazarm@purdue.edu
462e4f532c2ae0a99591ca540ca99a08a96cf6fa
947b025cc8585a79889c1464ab8a55d78a15411d
/ContactManager/src/net/codejava/contact/model/Contact.java
f30e770c109a7e09bfd7ce53c5a8d4d88f7fc226
[]
no_license
agnesvarga89/Beadando
8376f1acd829c0d22bf546d465cf3dfbaf5f5f32
7ee63d64a5d36b0e56030e3114c26a4f3c31ca8a
refs/heads/master
2023-01-02T06:24:11.654143
2019-12-01T16:36:36
2019-12-01T16:36:36
225,192,488
0
0
null
2022-12-16T00:41:19
2019-12-01T16:28:51
Java
UTF-8
Java
false
false
1,319
java
package net.codejava.contact.model; public class Contact { private Integer id; private String name; private String email; private String address; private String phone; public Contact() { } public Contact(Integer id, String name, String email, String address, String phone) { this(name, email, address, phone); this.id = id; } public Contact(String name, String email, String address, String phone) { this.name = name; this.email = email; this.address = address; this.phone = phone; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @Override public String toString() { return "Contact [id=" + id + ", name=" + name + ", email=" + email + ", address=" + address + ", phone=" + phone + "]"; } }
[ "Varga Ágnes@192.168.0.52" ]
Varga Ágnes@192.168.0.52
b2198f27f540603cf13cca1bb7b6c48bb811aa15
c5f3dc91a167aba7bad1d55d43bd2b92b866ec90
/src/main/java/com/atguigu/netty/websocket/MyServer.java
2dc470506c8cafc346b0d06c1abf4c3538c7767f
[]
no_license
JerioHou/NettyLearn
2bb240ffba9b0074a6cb7837824263c28f84841a
1020ea5f2448410bbc68b6935b0771c8cacb22e1
refs/heads/main
2023-04-01T11:58:18.359994
2021-04-12T14:18:39
2021-04-12T14:18:39
312,002,421
0
0
null
null
null
null
UTF-8
Java
false
false
3,361
java
package com.atguigu.netty.websocket; import com.atguigu.netty.heartbeat.MyServerHandler; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpServerCodec; import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; import io.netty.handler.stream.ChunkedWriteHandler; import io.netty.handler.timeout.IdleStateHandler; import java.util.concurrent.TimeUnit; public class MyServer { public static void main(String[] args) throws Exception{ //创建两个线程组 EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); //8个NioEventLoop try { ServerBootstrap serverBootstrap = new ServerBootstrap(); serverBootstrap.group(bossGroup, workerGroup); serverBootstrap.channel(NioServerSocketChannel.class); serverBootstrap.handler(new LoggingHandler(LogLevel.INFO)); serverBootstrap.childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); //因为基于http协议,使用http的编码和解码器 pipeline.addLast(new HttpServerCodec()); //是以块方式写,添加ChunkedWriteHandler处理器 pipeline.addLast(new ChunkedWriteHandler()); /* 说明 1. http数据在传输过程中是分段, HttpObjectAggregator ,就是可以将多个段聚合 2. 这就是为什么,当浏览器发送大量数据时,就会发出多次http请求 */ pipeline.addLast(new HttpObjectAggregator(8192)); /* 说明 1. 对应websocket ,它的数据是以 帧(frame) 形式传递 2. 可以看到WebSocketFrame 下面有六个子类 3. 浏览器请求时 ws://localhost:7000/hello 表示请求的uri 4. WebSocketServerProtocolHandler 核心功能是将 http协议升级为 ws协议 , 保持长连接 5. 是通过一个 状态码 101 */ pipeline.addLast(new WebSocketServerProtocolHandler("/hello2")); //自定义的handler ,处理业务逻辑 pipeline.addLast(new MyTextWebSocketFrameHandler()); } }); //启动服务器 ChannelFuture channelFuture = serverBootstrap.bind(7000).sync(); channelFuture.channel().closeFuture().sync(); }finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } } }
[ "houjie20@gmail.com" ]
houjie20@gmail.com
16da96a150fe78307d30631d8249eb88e1ab0af8
7801af9916925c3c06e950f2d0a2373a34caa272
/src/dynamic_beat_16/DynamicBeat.java
ab9cbfe942c50ededfa0ab61b6ac88bf28c5bd8f
[]
no_license
lizill/RhythmGame
3b79389d55bf84ef7eb845723ed9d573cb5bd6f4
175d6499d679dabf0c7fd662a863284513d73785
refs/heads/master
2023-08-03T06:02:05.450163
2021-09-16T13:52:55
2021-09-16T13:52:55
329,503,886
2
0
null
null
null
null
UTF-8
Java
false
false
14,923
java
package dynamic_beat_16; import java.awt.Color; import java.awt.Cursor; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; public class DynamicBeat extends JFrame { private Image screenImage; private Graphics screenGraphic; private Image background = new ImageIcon(Main.class.getResource("../images/introBackground.jpg")).getImage(); private JLabel menuBar = new JLabel(new ImageIcon(Main.class.getResource("../images/menuBar.png"))); private ImageIcon exitButtonEnteredImage = new ImageIcon(Main.class.getResource("../images/exitButtonEntered.png")); private ImageIcon exitButtonBasicImage = new ImageIcon(Main.class.getResource("../images/exitButtonBasic.png")); private ImageIcon startButtonEnteredImage = new ImageIcon( Main.class.getResource("../images/startButtonEntered.png")); private ImageIcon startButtonBasicImage = new ImageIcon(Main.class.getResource("../images/startButtonBasic.png")); private ImageIcon quitButtonEnteredImage = new ImageIcon(Main.class.getResource("../images/quitButtonEntered.png")); private ImageIcon quitButtonBasicImage = new ImageIcon(Main.class.getResource("../images/quitButtonBasic.png")); private ImageIcon leftButtonEnteredImage = new ImageIcon(Main.class.getResource("../images/leftButtonEntered.png")); private ImageIcon leftButtonBasicImage = new ImageIcon(Main.class.getResource("../images/leftButtonBasic.png")); private ImageIcon rightButtonEnteredImage = new ImageIcon( Main.class.getResource("../images/rightButtonEntered.png")); private ImageIcon rightButtonBasicImage = new ImageIcon(Main.class.getResource("../images/rightButtonBasic.png")); private ImageIcon easyButtonEnteredImage = new ImageIcon(Main.class.getResource("../images/easyButtonEntered.png")); private ImageIcon easyButtonBasicImage = new ImageIcon(Main.class.getResource("../images/easyButtonBasic.png")); private ImageIcon hardButtonEnteredImage = new ImageIcon( Main.class.getResource("../images/hardButtonEntered.png")); private ImageIcon hardButtonBasicImage = new ImageIcon(Main.class.getResource("../images/hardButtonBasic.png")); private ImageIcon backButtonEnteredImage = new ImageIcon( Main.class.getResource("../images/backButtonEntered.png")); private ImageIcon backButtonBasicImage = new ImageIcon(Main.class.getResource("../images/backButtonBasic.png")); private JButton exitButton = new JButton(exitButtonBasicImage); private JButton startButton = new JButton(startButtonBasicImage); private JButton quitButton = new JButton(quitButtonBasicImage); private JButton leftButton = new JButton(leftButtonBasicImage); private JButton rightButton = new JButton(rightButtonBasicImage); private JButton easyButton = new JButton(easyButtonBasicImage); private JButton hardButton = new JButton(hardButtonBasicImage); private JButton backButton = new JButton(backButtonBasicImage); private int mouseX, mouseY; private boolean isMainScreen = false; private boolean isGameScreen = false; ArrayList<Track> trackList = new ArrayList<Track>(); private Image titleImage; private Image selectedImage; private Music selectedMusic; private Music introMusic = new Music("introMusic.mp3", true); private int nowSelected = 0; public static Game game; public DynamicBeat() { // trackList trackList.add(new Track("neo_aspect_title.png", "neo_aspect.png", "03_neo_aspect_selected.mp3", "03_neo_aspect.mp3", "Neo-Aspect")); trackList.add(new Track("happy_happy_party_title.png", "happy_happy_party.png", "01_happy_happy_party_selected.mp3", "01_happy_happy_party.mp3", "Happy Happy Party !!")); trackList.add(new Track("romeo_title.png", "romeo.png", "02_romeo_selected.mp3", "02_romeo.mp3", "Romeo")); setUndecorated(true); setTitle("Dynamic Beat"); setSize(Main.SCREEN_WIDTH, Main.SCREEN_HEIGHT); setResizable(false); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); setBackground(new Color(0, 0, 0, 0)); setLayout(null); addKeyListener(new KeyListener()); introMusic.start(); exitButton.setBounds(1240, 0, 30, 30); exitButton.setBorderPainted(false); exitButton.setContentAreaFilled(false); exitButton.setFocusPainted(false); exitButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { exitButton.setIcon(exitButtonEnteredImage); exitButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); Music buttonEnteredMusic = new Music("buttonEnteredMusic.mp3", false); buttonEnteredMusic.start(); } @Override public void mouseExited(MouseEvent e) { exitButton.setIcon(exitButtonBasicImage); exitButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonPressedMusic = new Music("buttonPressedMusic.mp3", false); buttonPressedMusic.start(); try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } System.exit(0); } }); add(exitButton); startButton.setBounds(440, 260, 400, 100); startButton.setBorderPainted(false); startButton.setContentAreaFilled(false); startButton.setFocusPainted(false); startButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { startButton.setIcon(startButtonEnteredImage); startButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); Music buttonEnteredMusic = new Music("buttonEnteredMusic.mp3", false); buttonEnteredMusic.start(); } @Override public void mouseExited(MouseEvent e) { startButton.setIcon(startButtonBasicImage); startButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonPressedMusic = new Music("buttonPressedMusic.mp3", false); buttonPressedMusic.start(); enterMain(); } }); add(startButton); quitButton.setBounds(440, 400, 400, 100); quitButton.setBorderPainted(false); quitButton.setContentAreaFilled(false); quitButton.setFocusPainted(false); quitButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { quitButton.setIcon(quitButtonEnteredImage); quitButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); Music buttonEnteredMusic = new Music("buttonEnteredMusic.mp3", false); buttonEnteredMusic.start(); } @Override public void mouseExited(MouseEvent e) { quitButton.setIcon(quitButtonBasicImage); quitButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonPressedMusic = new Music("buttonPressedMusic.mp3", false); buttonPressedMusic.start(); try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } System.exit(0); } }); add(quitButton); leftButton.setVisible(false); leftButton.setBounds(140, 310, 60, 60); leftButton.setBorderPainted(false); leftButton.setContentAreaFilled(false); leftButton.setFocusPainted(false); leftButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { leftButton.setIcon(leftButtonEnteredImage); leftButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); Music buttonEnteredMusic = new Music("buttonEnteredMusic.mp3", false); buttonEnteredMusic.start(); } @Override public void mouseExited(MouseEvent e) { leftButton.setIcon(leftButtonBasicImage); leftButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonPressedMusic = new Music("buttonPressedMusic.mp3", false); buttonPressedMusic.start(); selectLeft(); } }); add(leftButton); rightButton.setVisible(false); rightButton.setBounds(1080, 310, 60, 60); rightButton.setBorderPainted(false); rightButton.setContentAreaFilled(false); rightButton.setFocusPainted(false); rightButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { rightButton.setIcon(rightButtonEnteredImage); rightButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); Music buttonEnteredMusic = new Music("buttonEnteredMusic.mp3", false); buttonEnteredMusic.start(); } @Override public void mouseExited(MouseEvent e) { rightButton.setIcon(rightButtonBasicImage); rightButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonPressedMusic = new Music("buttonPressedMusic.mp3", false); buttonPressedMusic.start(); selectRight(); } }); add(rightButton); easyButton.setVisible(false); easyButton.setBounds(375, 580, 250, 67); easyButton.setBorderPainted(false); easyButton.setContentAreaFilled(false); easyButton.setFocusPainted(false); easyButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { easyButton.setIcon(easyButtonEnteredImage); easyButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); Music buttonEnteredMusic = new Music("buttonEnteredMusic.mp3", false); buttonEnteredMusic.start(); } @Override public void mouseExited(MouseEvent e) { easyButton.setIcon(easyButtonBasicImage); easyButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonPressedMusic = new Music("buttonPressedMusic.mp3", false); buttonPressedMusic.start(); gameStart(nowSelected, "Easy"); } }); add(easyButton); hardButton.setVisible(false); hardButton.setBounds(655, 580, 250, 67); hardButton.setBorderPainted(false); hardButton.setContentAreaFilled(false); hardButton.setFocusPainted(false); hardButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { hardButton.setIcon(hardButtonEnteredImage); hardButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); Music buttonEnteredMusic = new Music("buttonEnteredMusic.mp3", false); buttonEnteredMusic.start(); } @Override public void mouseExited(MouseEvent e) { hardButton.setIcon(hardButtonBasicImage); hardButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonPressedMusic = new Music("buttonPressedMusic.mp3", false); buttonPressedMusic.start(); gameStart(nowSelected, "Hard"); } }); add(hardButton); backButton.setVisible(false); backButton.setBounds(25, 55, 50, 50); backButton.setBorderPainted(false); backButton.setContentAreaFilled(false); backButton.setFocusPainted(false); backButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { backButton.setIcon(backButtonEnteredImage); backButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); Music buttonEnteredMusic = new Music("buttonEnteredMusic.mp3", false); buttonEnteredMusic.start(); } @Override public void mouseExited(MouseEvent e) { backButton.setIcon(backButtonBasicImage); backButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @Override public void mousePressed(MouseEvent e) { Music buttonPressedMusic = new Music("buttonPressedMusic.mp3", false); buttonPressedMusic.start(); backMain(); } }); add(backButton); menuBar.setBounds(0, 0, 1280, 30); menuBar.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { mouseX = e.getX(); mouseY = e.getY(); } }); menuBar.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { int x = e.getXOnScreen(); int y = e.getYOnScreen(); setLocation(x - mouseX, y - mouseY); } }); add(menuBar); } public void paint(Graphics g) { screenImage = createImage(Main.SCREEN_WIDTH, Main.SCREEN_HEIGHT); screenGraphic = screenImage.getGraphics(); screenDraw((Graphics2D)screenGraphic); g.drawImage(screenImage, 0, 0, null); } public void screenDraw(Graphics2D g) { g.drawImage(background, 0, 0, null); if(isMainScreen) { g.drawImage(selectedImage, 340, 100, null); g.drawImage(titleImage, 340, 70, null); } if(isGameScreen) { game.screenDraw(g); } paintComponents(g); try { Thread.sleep(5); } catch (Exception e) { e.printStackTrace(); } this.repaint(); } public void selectTrack(int nowSelected) { if(selectedMusic != null) { selectedMusic.close(); } titleImage = new ImageIcon(Main.class.getResource("../images/" + trackList.get(nowSelected).getTitleImage())).getImage(); selectedImage = new ImageIcon(Main.class.getResource("../images/" + trackList.get(nowSelected).getStartImage())).getImage(); selectedMusic = new Music(trackList.get(nowSelected).getStartMusic(), true); selectedMusic.start(); } public void selectLeft() { if(nowSelected == 0) { nowSelected = trackList.size() - 1; } else { nowSelected--; } selectTrack(nowSelected); } public void selectRight() { if(nowSelected == trackList.size() - 1) { nowSelected = 0; } else { nowSelected++; } selectTrack(nowSelected); } public void gameStart(int nowSelected, String difficulty) { if(selectedMusic != null) selectedMusic.close(); isMainScreen = false; leftButton.setVisible(false); rightButton.setVisible(false); easyButton.setVisible(false); hardButton.setVisible(false); // background = new ImageIcon(Main.class.getResource("../images/ingameImage.jpg")).getImage(); backButton.setVisible(true); isGameScreen = true; game = new Game(trackList.get(nowSelected).getTitleName(), difficulty, trackList.get(nowSelected).getGameMusic()); game.start(); setFocusable(true); } public void backMain() { isMainScreen = true; leftButton.setVisible(true); rightButton.setVisible(true); easyButton.setVisible(true); hardButton.setVisible(true); // background = new ImageIcon(Main.class.getResource("../images/mainBackground.jpg")).getImage(); backButton.setVisible(false); selectTrack(nowSelected); isGameScreen = false; game.close(); } public void enterMain() { startButton.setVisible(false); quitButton.setVisible(false); background = new ImageIcon(Main.class.getResource("../images/mainBackground.jpg")).getImage(); isMainScreen = true; leftButton.setVisible(true); rightButton.setVisible(true); easyButton.setVisible(true); hardButton.setVisible(true); introMusic.close(); selectTrack(0); } }
[ "68741593+Park-Donghyeon@users.noreply.github.com" ]
68741593+Park-Donghyeon@users.noreply.github.com
bb8215c75f4e5efff80443e891daa56c7d5e8602
95883c9f118213524e4c228fdb5b6c025d9f91a7
/src/biz/ezcom/checkstyle/annotations/SuppressWarning.java
de002e56606f20d41ad220b15190d6e5da419f60
[]
no_license
FelixSaladin/checkstyle
140fca4ed7bcc9838fb62e210878e9717ac6db1f
b605d6d69a9688c154b7c446a58499364d15446d
refs/heads/master
2021-01-18T14:09:50.648581
2013-05-05T11:14:27
2013-05-05T11:14:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
400
java
package biz.ezcom.checkstyle.annotations; import java.util.ArrayList; /** * */ public class SuppressWarning { /** * */ @SuppressWarnings(value = {"rawtypes" }) public SuppressWarning() { new ArrayList(); } /** * */ @SuppressWarnings(value = {"rawtypes" }) public final void p1() { new ArrayList(); } }
[ "felix.saladin@gmail.com" ]
felix.saladin@gmail.com
57dd56f8703ee3d272e1f793036837058e5be3a4
943635f3470a6c27b867f9284c402f53a83e55c3
/gedi-geode-extensions-core/src/main/java/gedi/solutions/geode/operations/stats/BitExplicitIntInterval.java
a208a4eb006edaa935e793f4b07f6251c67283e6
[ "Apache-2.0" ]
permissive
nyla-solutions/gedi-geode
1045d1d0907fed51256ff10562410a5eac4d4e41
d5508a027bd00e125b0b2e2ef808a8a51c084ece
refs/heads/master
2020-12-30T15:41:10.320607
2019-05-08T13:05:53
2019-05-08T13:05:53
91,156,311
2
1
null
null
null
null
UTF-8
Java
false
false
2,662
java
package gedi.solutions.geode.operations.stats; import java.io.PrintWriter; class BitExplicitIntInterval extends BitInterval { long firstValue; long lastValue; int[] bitIntervals = null; @Override int getMemoryUsed() { int result = super.getMemoryUsed() + 4 + 8 + 8 + 4; if (bitIntervals != null) { result += bitIntervals.length * 4; } return result; } @Override int fill(double[] values, int valueOffset, int typeCode, int skipCount) { int fillcount = values.length - valueOffset; // space left in values int maxCount = count - skipCount; // maximum values this interval can produce if (fillcount > maxCount) { fillcount = maxCount; } long bitValue = firstValue; for (int i = 0; i < skipCount; i++) { bitValue += bitIntervals[i]; } for (int i = 0; i < fillcount; i++) { bitValue += bitIntervals[skipCount + i]; values[valueOffset + i] = GfStatsReader.bitsToDouble(typeCode, bitValue); } return fillcount; } @Override void dump(PrintWriter stream) { stream.print("(intIntervalCount=" + count + " start=" + firstValue); for (int i = 0; i < count; i++) { if (i != 0) { stream.print(", "); } stream.print(bitIntervals[i]); } stream.print(")"); } BitExplicitIntInterval(long bits, long interval, int addCount) { count = addCount; firstValue = bits; lastValue = bits + (interval * (addCount - 1)); bitIntervals = new int[count * 2]; bitIntervals[0] = 0; for (int i = 1; i < count; i++) { bitIntervals[i] = (int) interval; } } @Override boolean attemptAdd(long addBits, long addInterval, int addCount) { // addCount >= 2; count >= 2 if (addCount <= 4) { if (addInterval <= Integer.MAX_VALUE && addInterval >= Integer.MIN_VALUE) { long firstInterval = addBits - lastValue; if (firstInterval <= Integer.MAX_VALUE && firstInterval >= Integer.MIN_VALUE) { lastValue = addBits + (addInterval * (addCount - 1)); if ((count + addCount) >= bitIntervals.length) { int[] tmp = new int[(count + addCount) * 2]; System.arraycopy(bitIntervals, 0, tmp, 0, bitIntervals.length); bitIntervals = tmp; } bitIntervals[count++] = (int) firstInterval; for (int i = 1; i < addCount; i++) { bitIntervals[count++] = (int) addInterval; } return true; } } } return false; } }
[ "ggreen@pivotal.io" ]
ggreen@pivotal.io
22f079bcd2c9cc3e45202d57e21dc5af5c324b91
6aca027f2b7638024b8444956653ab9f0cbd6e64
/model/src/main/java/com/myst3ry/model/AccountBaseItem.java
170a39df6c00178998107cbfbaa5079d9140a09a
[]
no_license
sergon146/FinanceManager
22b234477b8ec5883408d9e18976ce6fcdbcf988
063aa69754167f2992c4a2fd68517be45d205db8
refs/heads/master
2020-03-25T00:21:21.863749
2018-08-10T05:57:55
2018-08-10T05:57:55
143,181,739
2
0
null
2018-08-10T05:57:55
2018-08-01T16:30:23
Java
UTF-8
Java
false
false
569
java
package com.myst3ry.model; import android.arch.persistence.room.Ignore; import com.example.delegateadapter.delegate.diff.IComparableItem; public class AccountBaseItem implements IComparableItem { @Ignore private long id; @Ignore private boolean isSelected; public boolean isSelected() { return isSelected; } public void setSelected(boolean selected) { isSelected = selected; } @Override public Object id() { return id; } @Override public Object content() { return null; } }
[ "sergon146@gmail.com" ]
sergon146@gmail.com
e65c8ec7945cd06db4db50aff8c20e110e6e623c
567212aa058dcc27073aefb5397a09e7fcbb2142
/src/main/java/com/sunvsoft/wedding/service/mapper/package-info.java
c68c3ef2d42fc9ef3798df2685d1cb4365a9aa6d
[]
no_license
yangliubin/wedding-bk
c0eac74bbeb12c247c1c6e14e4abe88ccf565666
1bb1100ba1253556ff284439d5ca3015d22cfe47
refs/heads/master
2021-08-19T07:06:48.147368
2017-11-24T07:28:16
2017-11-24T07:28:16
111,973,497
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
/** * MapStruct mappers for mapping domain objects and Data Transfer Objects. */ package com.sunvsoft.wedding.service.mapper;
[ "renwenqiang@f6848f2b-db82-49f4-a46f-57bc13dda0ea" ]
renwenqiang@f6848f2b-db82-49f4-a46f-57bc13dda0ea
b34ff8cd82bd13ad5843a3a142ac6b0232d4b52d
60fc5f2cb58e8e56280850003959be6b5b0382c0
/src/mgs/client/Client.java
b8197c80a6e40c82b929b6276b4e0ce2d921fab8
[]
no_license
alacret/tarea-distribuida
271951d61e055943948349b1846811ba08c3dd1d
1f7f782c53ae200088e849c368ea87dcca03452b
refs/heads/master
2021-01-10T14:58:40.180542
2016-02-03T16:03:57
2016-02-03T16:03:57
51,011,298
0
0
null
null
null
null
UTF-8
Java
false
false
4,619
java
package mgs.client; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintStream; import java.io.PrintWriter; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import java.util.PriorityQueue; import java.util.concurrent.atomic.AtomicInteger; import javax.xml.parsers.ParserConfigurationException; import mgs.server.GroupMember; import mgs.utils.Message; import mgs.utils.Toilet; import org.xml.sax.SAXException; public class Client extends Thread implements Toilet { private String serverIp; private int serverSocket; private PrintStream out; private int clientSocket; private boolean run = true; private List<GroupMember> peers; private boolean isConnected = false; private Object peersLock = new Object(); private AtomicInteger time = new AtomicInteger(); private PriorityQueue<Message> messageQueque = new PriorityQueue<Message>(); public Client(String serverIp, int serverSocket, int clientSocket, PrintStream out) { this.serverIp = serverIp; this.serverSocket = serverSocket; this.clientSocket = clientSocket; this.out = out; this.peers = new ArrayList<GroupMember>(); } @Override public void run() { flush("Client started at " + clientSocket + "..."); try { ServerSocket server = new ServerSocket(clientSocket); try { while (run) { Socket accept = server.accept(); ClientResponse response = new ClientResponse(accept, this); response.start(); } } catch (Exception e) { flush(e.getMessage()); server.close(); } flush("Stopping client at " + clientSocket + "..."); server.close(); } catch (IOException e) { flush(e.getMessage()); } } public void connect(String groupName) throws UnknownHostException, IOException, ParserConfigurationException, SAXException { if (isConnected) throw new UnsupportedOperationException( "The client is already connected to a server"); start(); Socket socket = new Socket(serverIp, serverSocket); PrintWriter writer = new PrintWriter(socket.getOutputStream(), true); writer.println("<mgs><action>connect</action><group>" + groupName + "</group><listenPort>" + clientSocket + "</listenPort></mgs>"); writer.close(); socket.close(); isConnected = true; } public void flush(String msg) { out.println(msg); } public void stopClient() { try { run = false; Socket socket = new Socket("127.0.0.1", clientSocket); OutputStreamWriter out = new OutputStreamWriter( socket.getOutputStream()); out.write("stop"); out.flush(); out.close(); socket.close(); } catch (UnknownHostException e1) { flush(e1.getMessage()); } catch (IOException e1) { flush(e1.getMessage()); } flush("Client Stopped"); } public void addPeer(GroupMember groupMember) { synchronized (peersLock) { peers.add(groupMember); } } public void send(String string) throws UnknownHostException, IOException { List<GroupMember> tmpPeers; synchronized (peersLock) { tmpPeers = new ArrayList<GroupMember>(peers); } int count = time.incrementAndGet(); messageQueque.add( new mgs.utils.Message(count, string, new GroupMember(InetAddress.getLocalHost().getHostAddress(), clientSocket),peers.size())); for (GroupMember groupMember : tmpPeers) send(string, groupMember, count); } private void send(String string, GroupMember groupMember, int count) throws UnknownHostException, IOException { Socket socket = new Socket(groupMember.getIp(), groupMember.getPort()); PrintWriter writer = new PrintWriter(socket.getOutputStream(), true); writer.println("<mgs><action>message</action><message>" + string + "</message><clockCount>" + count + "</clockCount>" + "<ip>" + InetAddress.getLocalHost().getHostAddress() + "</ip>" + "<port>" + clientSocket + "</port></mgs>"); writer.close(); socket.close(); } public void addPeers(List<GroupMember> peersLocal) { synchronized (peersLock) { peers.addAll(peersLocal); } } public List<GroupMember> getPeers(){ return peers; } public PriorityQueue<Message> getMessageQueque() { return messageQueque; } public AtomicInteger getTime() { return time; } public void checkMessages() { synchronized (messageQueque) { Message peek = messageQueque.peek(); if(peek.isReadyForConsume()){ doSomething(peek); messageQueque.remove(peek); } } } private void doSomething(Message peek) { System.out.println("Reading: " + peek.getMessage()); } }
[ "alacret@gmail.com" ]
alacret@gmail.com
addb1236d81aacd8af4cc981afdf3df25dcfbf00
c650d1dd449f84173a2e5d14189947807d24c927
/uc-jwt-security/src/main/java/com/b2c/ucjwtsecurity/queue/ProductDefaultPriceTaskComponent.java
9426816230bdf4755ba3c122123e264eb843a732
[]
no_license
Fnwang/study-springcloud
a5c6f97393d863ca19beaa7e4fe72947e0047a8f
97b809117170617a14f84979e83ceda1d4376190
refs/heads/master
2020-12-26T18:38:10.492804
2020-01-06T10:43:06
2020-01-06T10:43:06
237,599,684
1
0
null
2020-02-01T10:44:11
2020-02-01T10:44:10
null
UTF-8
Java
false
false
1,902
java
package com.b2c.ucjwtsecurity.queue; import com.b2c.ucjwtsecurity.base.TaskExecuteComponent; import com.b2c.ucjwtsecurity.entity.User; import com.b2c.ucjwtsecurity.repository.UserRepository; import com.b2c.ucjwtsecurity.util.ApplicationUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; /** * @FileName: ProductDefaultPriceTaskComponent * @Author: zhaoxinguo * @Date: 2019/3/20 17:44 * @Description: 更新商品默认价格队列处理 */ @Service public class ProductDefaultPriceTaskComponent extends ProductDefaultPriceTaskQueueClient { public ProductDefaultPriceTaskComponent() { super(); RETRY_EXCEPTION = false; //异常不重试 consumer = true; //队列运行模式,设置为消费者 } public static class UpdateProductDefaultPriceTask implements TaskExecuteComponent { private static Logger logger = LoggerFactory.getLogger(UpdateProductDefaultPriceTask.class); private String taskId; private UserRepository userRepository; @Override public void setTask(String taskId) { this.taskId = taskId; userRepository = ApplicationUtil.getBean("userRepository"); } @Override public void execute(){ Long startTime = System.currentTimeMillis(); logger.info("[UpdateProductDefaultPriceTask:{}] start.",taskId); try { Thread.sleep(5000); User user = userRepository.findByUsername("aaa"); logger.info("user:{}", user); logger.info("执行任务:{}",taskId); } catch (InterruptedException e) { e.printStackTrace(); } logger.info("[UpdateProductDefaultPriceTask:{}] end, time:{}ms", taskId, System.currentTimeMillis() - startTime); } } }
[ "272038088@qq.com" ]
272038088@qq.com
b38b8b1bfab71db86da27becab51328fb10594c5
93c580d9137ee5476d260c136b2a60277ff10801
/schema-registry/spring-cloud-stream-schema-registry-client/src/main/java/org/springframework/cloud/stream/schema/registry/avro/QualifiedSubjectNamingStrategy.java
01216d60af76ca118ee306aa827332b00e9fe8ef
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
spring-cloud/spring-cloud-stream
9d3bf27a267d74122072cd02bf2db5931bda7ce5
fbecaaa5ca9a3e5c4685e9b147254bc715b80475
refs/heads/main
2023-08-29T03:46:09.610816
2023-08-11T08:25:03
2023-08-15T19:36:49
38,764,029
1,004
656
Apache-2.0
2023-09-14T14:33:08
2015-07-08T15:51:38
Java
UTF-8
Java
false
false
1,139
java
/* * Copyright 2016-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.cloud.stream.schema.registry.avro; import org.apache.avro.Schema; import org.springframework.util.StringUtils; /** * @author José A. Íñigo * @since 2.2.0 */ public class QualifiedSubjectNamingStrategy implements SubjectNamingStrategy { @Override public String toSubject(String subjectNamePrefix, Schema schema) { return StringUtils.hasText(subjectNamePrefix) ? subjectNamePrefix + "-" + schema.getFullName().toLowerCase() : schema.getFullName().toLowerCase(); } }
[ "ozhurakousky@vmware.com" ]
ozhurakousky@vmware.com
83a91c84ff0b9f8ae69cf700d83ea1c5b1c625ae
13100427d2e693c6a35ca12e147d8922229e4089
/app/src/main/java/com/hatenablog/techium/android_dagger2_sample/CarModule.java
99ae3f1f21bbd7f48ec504e7586128888dd9fade
[]
no_license
KimuraTakaumi/android-jack-dagger-sample
b421b0da28858537073bb19698008237aa21313d
29e2898326c859fde39a5a3e1721d5836cda4b71
refs/heads/master
2021-01-09T20:35:27.933467
2016-06-04T17:29:30
2016-06-04T17:29:30
60,422,105
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
package com.hatenablog.techium.android_dagger2_sample; import dagger.Module; import dagger.Provides; @Module public class CarModule { @Provides public IMortor provideCar() { // return new CarA(); return new CarB(); } }
[ "muchiki0226@kimuratakashikai-no-MacBook-Pro.local" ]
muchiki0226@kimuratakashikai-no-MacBook-Pro.local
c3539cc290b01828333b9f117d441d45e2a9f575
53c13348842a1a7a25fb3a8f67c0aad81cab0aef
/src/main/java/com/app/mvc/captcha/CaptchaService.java
44be03835cf9cec902304acf884740d08cbc6975
[]
no_license
xuxiaoguang1/funiture
529f52d0b4515553fb119add92000cdcd1514090
9180def715753e8c2af80fdecf641feff9f1e167
refs/heads/master
2021-06-21T18:47:14.907415
2016-04-16T16:53:15
2016-04-16T16:53:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,735
java
package com.app.mvc.captcha; import com.app.mvc.acl.enums.Status; import com.app.mvc.common.ThreadPool; import com.app.mvc.configuration.DatabaseConfig; import com.google.common.base.Preconditions; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; /** * Created by jimin on 16/3/9. */ @Slf4j @Service public class CaptchaService { @Resource private CaptchaCodeDao captchaCodeDao; public void saveCaptchaCode(String code, String sessionId) { Preconditions.checkNotNull(code, "数据非法"); Preconditions.checkArgument(canGenerate(sessionId), "请求次数过于频繁,请稍后重试"); Date expireTime = DateUtils.addMinutes(new Date(), DatabaseConfig.getIntValue("captcha_code.invalid.minutes", 5)); CaptchaCode captchaCode = CaptchaCode.builder().code(code).sessionId(sessionId).expireTime(expireTime).build(); captchaCodeDao.save(captchaCode); } public boolean validCaptchaCode(final String code, final String sessionId) { Preconditions.checkNotNull(code); Preconditions.checkNotNull(sessionId); CaptchaCode captchaCode = captchaCodeDao.findLastBySessionId(sessionId); if (captchaCode == null || captchaCode.getExpireTime().getTime() < System.currentTimeMillis() || captchaCode.getStatus() != Status.AVAILABLE .getCode()) { return false; } if (captchaCode.getCode().equalsIgnoreCase(code)) { // 一旦验证码验证通过,则将其置为不可用状态,之后不再允许被使用 // 如果后面需要使用,则须生成新的验证码 asyncInvalidCaptchaCode(code, sessionId); return true; } return false; } /** * 检测一段时间内该session生成验证码的数量是否超出正常范围 */ private boolean canGenerate(String sessionId) { Preconditions.checkNotNull(sessionId, "数据非法"); Date targetDate = DateUtils.addMinutes(new Date(), -1); int maxTimes = DatabaseConfig.getIntValue("captcha_code.one_minute.max", 2); return captchaCodeDao.countBySessionIdAndCreateTime(sessionId, targetDate) < maxTimes; } private void asyncInvalidCaptchaCode(final String code, final String sessionId) { ThreadPool.execute(new Runnable() { @Override public void run() { try { captchaCodeDao.invalidCaptchaCode(sessionId, code); } catch (Throwable e) { log.error("invalid captcha code error, code: {}, sessionId: {}", code, sessionId, e); } } }); } public void asyncFailTry(final String sessionId) { ThreadPool.execute(new Runnable() { @Override public void run() { try { failTry(sessionId); } catch (Throwable e) { log.error("update captcha code tryTimes error, sessionId: {}", sessionId, e); } } }); } private void failTry(String sessionId) { if (StringUtils.isBlank(sessionId)) { return; } CaptchaCode captchaCode = captchaCodeDao.findLastBySessionId(sessionId); if (captchaCode == null || captchaCode.getExpireTime().getTime() < System.currentTimeMillis() || captchaCode.getStatus() != Status.AVAILABLE .getCode()) { return; } captchaCodeDao.incrTryTimes(captchaCode.getId()); } }
[ "jimin.zheng@qunar.com" ]
jimin.zheng@qunar.com
64d1f1d81a940451eb41ea538a2f4b6dca60a668
3cbc8419c819b82cfa069bedf2e95bcbd704dd70
/Serializable_test/Serializable_test.java
a8d9cb0c07f54f078d389c4a4d244b81f4f05ce9
[]
no_license
githubybx/Clone
e8d979b230845ea4f349557537f27af3215ef3cb
caaad968484b4676220a8fa1394fd19b73a926f9
refs/heads/master
2022-01-20T15:45:38.702625
2019-07-20T19:53:18
2019-07-20T19:53:18
198,000,844
1
0
null
null
null
null
UTF-8
Java
false
false
960
java
package Serializable_test; import deep_clone.Address; import deep_clone.Stu; import java.io.*; import java.time.LocalDate; public class Serializable_test { public static void main(String[] args) throws IOException, ClassNotFoundException { Address address = new Address("23"); Stu stu = new Stu("李四","23",address); ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream("D:\\Stu.obj")); outputStream.writeObject(stu); LocalDate now = LocalDate.now(); outputStream.writeObject(now); ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream("D:\\Stu.obj")); Stu stu1 = (Stu) objectInputStream.readObject(); LocalDate localDate = (LocalDate) (objectInputStream.readObject()); System.out.println(stu1.getAddress().getId() + " " + stu1.getAge() + " " + stu1.getName()); System.out.println(localDate.toString()); } }
[ "401129874@qq.com" ]
401129874@qq.com
fdedd2c1ab90c68d7f73e727fae94c18f44aece3
97dd4ec8c7253fbdc951643c8694c0d361c23aaa
/app/src/test/java/com/example/krishesh/notel_demo/ExampleUnitTest.java
beccbf157d4e6c5194ae128d7c93a3671be98238
[ "Unlicense" ]
permissive
Krishesh/Notel_demo
8c1508df3f2f0f27170e5927681139d5cff00f28
d08fac4ac066986d8329ff8c0f61b7fb0ebbc207
refs/heads/master
2020-04-13T04:45:23.234664
2018-12-24T08:49:56
2018-12-24T08:49:56
162,970,475
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package com.example.krishesh.notel_demo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "shrestha.krishesh@gmail.com" ]
shrestha.krishesh@gmail.com
51f02d83ca8422691245fa7127ebc51e0e204e40
a5a34aa8653c348c515f0e43bc705fa57c6a30bd
/library/src/main/java/com/centerm/epos/utils/OnCallListener.java
c0aa15e46336f17e3f4724bc604252e8ebb72592
[]
no_license
bitian123/HandSetWisdomCashier
e36e5c06954a498cca6efdae7852a9835c32dcb2
c5379bcdb2aab19b96d20c83b1da4d1444b667d4
refs/heads/master
2022-12-13T05:25:29.541238
2020-09-12T00:59:03
2020-09-12T00:59:03
294,842,298
1
0
null
null
null
null
UTF-8
Java
false
false
188
java
package com.centerm.epos.utils; import java.util.Map; /** * create by liubit on 2019-09-04 */ public interface OnCallListener { void onCall(Map<String,Object> result); }
[ "1178370904@qq.com" ]
1178370904@qq.com
6cb4c86dd895dd4469709a6c1513b116d1c9263f
221cb83334902ab6de03acd79b474d84085b494a
/srb/service-core/src/main/java/com/xyf/srb/core/controller/api/BorrowInfoController.java
c90a246e38823b2fc5164f97aebd3717d6ef4ccd
[]
no_license
aexftf/srb
d6050b8ba950d69f08af3091484b257629f445f1
4d1f2ee343f6459eb673db82ad73fac8e5248d5a
refs/heads/master
2023-06-03T18:11:11.687541
2021-06-23T00:25:01
2021-06-23T00:25:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,925
java
package com.xyf.srb.core.controller.api; import com.xyf.common.result.R; import com.xyf.srb.base.util.JwtUtils; import com.xyf.srb.core.pojo.entity.BorrowInfo; import com.xyf.srb.core.service.BorrowInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; /** * <p> * 借款信息表 前端控制器 * </p> * * @author XYF * @since 2021-05-06 */ @Api(tags = "借款信息") @RestController @RequestMapping("/api/core/borrowInfo") @Slf4j public class BorrowInfoController { @Resource private BorrowInfoService borrowInfoService; @ApiOperation("获取借款额度") @GetMapping("/auth/getBorrowAmount") public R getBorrowAmount(HttpServletRequest request) { String token = request.getHeader("token"); Long userId = JwtUtils.getUserId(token); BigDecimal borrowAmount = borrowInfoService.getBorrowAmount(userId); return R.ok().data("borrowAmount", borrowAmount); } @ApiOperation("提交借款申请") @PostMapping("/auth/save") public R save(@RequestBody BorrowInfo borrowInfo, HttpServletRequest request) { String token = request.getHeader("token"); Long userId = JwtUtils.getUserId(token); borrowInfoService.saveBorrowInfo(borrowInfo, userId); return R.ok().message("提交成功"); } @ApiOperation("获取借款申请审批状态") @GetMapping("/auth/getBorrowInfoStatus") public R getBorrowerStatus(HttpServletRequest request){ String token = request.getHeader("token"); Long userId = JwtUtils.getUserId(token); Integer status = borrowInfoService.getStatusByUserId(userId); return R.ok().data("borrowInfoStatus", status); } }
[ "xyf527725@163.com" ]
xyf527725@163.com
69db2d0bbe79e9395f5618d32baf4f20f325d803
a83a457bfe7d93be03aff6700689d23f1616adfc
/AdvancedDataStructures/src/triesStructure/BinaryTries.java
f2c7bf1be166b12fbf6783881ee6d73609607fa1
[]
no_license
rahul10992/AdvancedDataStructure-DynamicRoutingUsingFibonacciHeapsAndBinaryTries
a2dc7383e8a45714515543b4a17c6906bcb588d8
bf2cf0ba2a4cbe001198927829da536f28175358
refs/heads/master
2021-01-15T10:17:41.356544
2015-05-21T00:03:36
2015-05-21T00:03:36
35,980,100
1
0
null
null
null
null
UTF-8
Java
false
false
3,003
java
package triesStructure; import java.util.ArrayList; public class BinaryTries { TreeNode root=new TreeNode(); //ArrayList<TreeNode> nodeList=new ArrayList<TreeNode>(); public void insert(String ip, int data){ //System.out.println("entering insert"); //TreeNode iter=new TreeNode(); TreeNode iter=root; for(int i=0;i<ip.length()-1;i++){//go upto 31 int bin=Integer.parseInt(ip.charAt(i)+"");//take ith character //System.out.println("bin: "+bin); if(bin==0){//go left if(iter.left!=null){ iter=iter.left; } else{//make new node if you are about to fall off. TreeNode temp=new TreeNode(); temp.data=0; temp.parent=iter; iter.left=temp; iter=iter.left; //iter.right=temp; } } else if(bin==1){//go right if(iter.right!=null){ iter=iter.right; } else{//make new node to not fall off TreeNode temp=new TreeNode(); temp.data=1; temp.parent=iter; iter.right=temp; iter=iter.right; } } else{//you come here then its really really messed up. what did you do? The horror! System.out.println("ERROR!!! in tries insert"); System.exit(1); } } //last bit do it all again. int bin=Integer.parseInt(ip.charAt(ip.length()-1)+""); if(bin==0){//me go left. make leaf. give data. TreeNode tempNode=new TreeNode(); tempNode.data=data; tempNode.parent=iter; tempNode.isleaf=true; iter.left=tempNode; } else if(bin==1){ TreeNode tempNode=new TreeNode(); tempNode.data=data; tempNode.parent=iter; tempNode.isleaf=true; iter.right=tempNode; } } public void compressTrie(TreeNode root){ //post order traversal if(root==null){ return; } if(root.left!=null) compressTrie(root.left); if(root.right!=null) compressTrie(root.right); //3 cases. if right subtree is null //if left subtree is null //if both the subtrees have the same node. if(root.left==null && root.right!=null && root.right.isleaf==true){ if(root.data==0){ root.parent.left=root.right; } else{ root.parent.right=root.right; } root.right.parent=root.parent; } else if(root.left!=null && root.right==null && root.left.isleaf==true){ if(root.data==0){ root.parent.left=root.left; } else{ root.parent.right=root.left; } root.left.parent=root.parent; } else if(root.right!=null && root.left!=null && root.left.data==root.right.data && root.left.isleaf==true && root.right.isleaf==true){ if(root.data==0){ root.parent.left=root.left; } else{ root.parent.right=root.left; } root.left.parent=root.parent; } } public String traverse(String OpBin){ TreeNode iter=root; int i=0; for(i=0;i<OpBin.length();i++){ if(iter.isleaf==true){ break; } else{ if(Integer.parseInt(OpBin.charAt(i)+"")==0){ iter=iter.left; } else{ iter=iter.right; } } } String s=OpBin.substring(0, i); //s=iter.data+""; return s; } }
[ "rahul10992@gmail.com" ]
rahul10992@gmail.com
4f553a2962dceebf9c05e96328a41876b39b98fc
d9f8562352ddf6e7070616ec8e990ca2c1c58a65
/src/main/java/io/zipcoder/pets/Fish.java
7680e5203e01b0d05250969b5c8ca1b9912d7c41
[]
no_license
Gabba42/ZCW-Polymorphism
a25d8734f78d809dc9efaccde1a7753acfb50086
7058eff153634b46266eb25b0c71713046e2c229
refs/heads/master
2021-08-06T18:22:07.296859
2017-11-06T18:01:49
2017-11-06T18:01:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
203
java
package io.zipcoder.pets; public class Fish extends Pets { public Fish(String name) { super(name); } @Override public String speak() { return "bloop bloop..."; } }
[ "gabriela@zipcoders-MacBook-Pro-6.local" ]
gabriela@zipcoders-MacBook-Pro-6.local
a4fea08a15ab4daa5c4db81bfb23c7b133451e0f
08c0bd54a95fb5516745aa6edeb782a4c7f53eb7
/src/main/java/com/tardin/desafio/solucionando_desafios_matematicos_em_java/FolhaDePagamento.java
db686e9b76014b8dce598bee13b710cf18e73ca7
[]
no_license
Didafe/dio-java
b704dc6955ba975e023310f606209ffdfa0201de
3e366ba3c5f7a38de41c09383deb98dfc25e2711
refs/heads/master
2023-07-15T12:45:44.133269
2021-08-13T13:59:06
2021-08-13T13:59:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,010
java
package com.tardin.desafio.solucionando_desafios_matematicos_em_java; import java.util.Scanner; public class FolhaDePagamento { private final int workedHours, workerNumber; private final double hourValue; public FolhaDePagamento(int workerNumber, int workedHours, double hourValue) { this.workedHours = workedHours; this.workerNumber = workerNumber; this.hourValue = hourValue; } public static void main(String[] args){ FolhaDePagamento payCheck = readEntries(); System.out.printf("NUMBER = %d\nSALARY = U$ %.2f", payCheck.getWorkerNumber(), payCheck.getSalary()); } private static FolhaDePagamento readEntries(){ Scanner scanner = new Scanner(System.in); return new FolhaDePagamento(scanner.nextInt(), scanner.nextInt(), scanner.nextDouble()); } public double getSalary(){ return this.workedHours * this.hourValue * 1f; } public int getWorkerNumber (){ return this.workerNumber; } }
[ "brunotardin20@gmail.com" ]
brunotardin20@gmail.com
0d17a8d712c85c59d358b3e0a16849a769a589b8
a22d8e6f81d3bbcc828b205be80fea39e34ffc0b
/InterfaceAbstractStarterProgram/MarkovModel.java
d3f39c5bbe20bf963d116910bb32cdb89746bc8e
[]
no_license
pjones006/javaAssignments
1d431af204af2374e7877b7aeb48801708f8a717
4bc2d87bfca3dc63f756af2879def5dfe78a2de7
refs/heads/master
2020-10-02T05:40:52.625952
2020-01-29T21:59:23
2020-01-29T21:59:23
227,713,530
0
0
null
null
null
null
UTF-8
Java
false
false
1,070
java
import java.util.ArrayList; import java.util.Random; public class MarkovModel extends AbstractMarkovModel{ private int myNum; public MarkovModel(int n) { myNum = n; } public void setRandom(int seed){ myRandom = new Random(seed); } public String toString() { return ("MarkovModel of order " + myNum); } public String getRandomText(int numChars){ if (myText == null){ return ""; } StringBuilder sb = new StringBuilder(); int index = myRandom.nextInt(myText.length()-myNum); String key = myText.substring(index, index + myNum); sb.append(key); for(int k=0; k < numChars-myNum; k++){ ArrayList<String> follows = getFollows(key); if (follows.size() == 0) { break; } index = myRandom.nextInt(follows.size()); String next = follows.get(index); sb.append(next); key = key.substring(1) + next; } return sb.toString(); } }
[ "pjones006@att.net" ]
pjones006@att.net
adfb95c1cca3cc8d1576aa173bcd3ee6f067bd03
02ebac56a263f5b31e008c2e6856e412fca8eae0
/app/build/generated/source/r/debug/android/support/graphics/drawable/animated/R.java
082bab406ca93193771211b3026928f6c6c10419
[]
no_license
akhilsurnedi5479/Birthday_Card
d6bbe26886f10ac1ad888247647e36e0b3695444
202ca61242c57081922bec636cead95d9c6a279f
refs/heads/master
2020-03-06T18:43:40.335933
2018-03-27T16:12:24
2018-03-27T16:12:24
127,012,801
1
0
null
null
null
null
UTF-8
Java
false
false
7,630
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.graphics.drawable.animated; public final class R { public static final class attr { public static final int font = 0x7f020070; public static final int fontProviderAuthority = 0x7f020072; public static final int fontProviderCerts = 0x7f020073; public static final int fontProviderFetchStrategy = 0x7f020074; public static final int fontProviderFetchTimeout = 0x7f020075; public static final int fontProviderPackage = 0x7f020076; public static final int fontProviderQuery = 0x7f020077; public static final int fontStyle = 0x7f020078; public static final int fontWeight = 0x7f020079; } public static final class bool { public static final int abc_action_bar_embed_tabs = 0x7f030000; } public static final class color { public static final int notification_action_color_filter = 0x7f04003e; public static final int notification_icon_bg_color = 0x7f04003f; public static final int ripple_material_light = 0x7f04004a; public static final int secondary_text_default_material_light = 0x7f04004c; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f05004a; public static final int compat_button_inset_vertical_material = 0x7f05004b; public static final int compat_button_padding_horizontal_material = 0x7f05004c; public static final int compat_button_padding_vertical_material = 0x7f05004d; public static final int compat_control_corner_material = 0x7f05004e; public static final int notification_action_icon_size = 0x7f050058; public static final int notification_action_text_size = 0x7f050059; public static final int notification_big_circle_margin = 0x7f05005a; public static final int notification_content_margin_start = 0x7f05005b; public static final int notification_large_icon_height = 0x7f05005c; public static final int notification_large_icon_width = 0x7f05005d; public static final int notification_main_column_padding_top = 0x7f05005e; public static final int notification_media_narrow_margin = 0x7f05005f; public static final int notification_right_icon_size = 0x7f050060; public static final int notification_right_side_padding_top = 0x7f050061; public static final int notification_small_icon_background_padding = 0x7f050062; public static final int notification_small_icon_size_as_large = 0x7f050063; public static final int notification_subtext_size = 0x7f050064; public static final int notification_top_pad = 0x7f050065; public static final int notification_top_pad_large_text = 0x7f050066; } public static final class drawable { public static final int notification_action_background = 0x7f060057; public static final int notification_bg = 0x7f060058; public static final int notification_bg_low = 0x7f060059; public static final int notification_bg_low_normal = 0x7f06005a; public static final int notification_bg_low_pressed = 0x7f06005b; public static final int notification_bg_normal = 0x7f06005c; public static final int notification_bg_normal_pressed = 0x7f06005d; public static final int notification_icon_background = 0x7f06005e; public static final int notification_template_icon_bg = 0x7f06005f; public static final int notification_template_icon_low_bg = 0x7f060060; public static final int notification_tile_bg = 0x7f060061; public static final int notify_panel_notification_icon_bg = 0x7f060062; } public static final class id { public static final int action_container = 0x7f07000e; public static final int action_divider = 0x7f070010; public static final int action_image = 0x7f070011; public static final int action_text = 0x7f070017; public static final int actions = 0x7f070018; public static final int async = 0x7f07001e; public static final int blocking = 0x7f070021; public static final int chronometer = 0x7f070027; public static final int forever = 0x7f070034; public static final int icon = 0x7f070037; public static final int icon_group = 0x7f070038; public static final int info = 0x7f07003b; public static final int italic = 0x7f07003c; public static final int line1 = 0x7f07003d; public static final int line3 = 0x7f07003e; public static final int normal = 0x7f070047; public static final int notification_background = 0x7f070048; public static final int notification_main_column = 0x7f070049; public static final int notification_main_column_container = 0x7f07004a; public static final int right_icon = 0x7f070051; public static final int right_side = 0x7f070052; public static final int text = 0x7f070071; public static final int text2 = 0x7f070072; public static final int time = 0x7f070075; public static final int title = 0x7f070076; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { public static final int notification_action = 0x7f09001c; public static final int notification_action_tombstone = 0x7f09001d; public static final int notification_template_custom_big = 0x7f090024; public static final int notification_template_icon_group = 0x7f090025; public static final int notification_template_part_chronometer = 0x7f090029; public static final int notification_template_part_time = 0x7f09002a; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0b0021; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0c00fa; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00fb; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00fd; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c0100; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c0102; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c016b; public static final int Widget_Compat_NotificationActionText = 0x7f0c016c; } public static final class styleable { public static final int[] FontFamily = { 0x7f020072, 0x7f020073, 0x7f020074, 0x7f020075, 0x7f020076, 0x7f020077 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x7f020070, 0x7f020078, 0x7f020079 }; public static final int FontFamilyFont_font = 0; public static final int FontFamilyFont_fontStyle = 1; public static final int FontFamilyFont_fontWeight = 2; } }
[ "akhilsurnedi5479@gmail.com" ]
akhilsurnedi5479@gmail.com
bdf3d79b6597f90f4981de6dec29b1cbd3e60ada
7295fc41d315b0e845e10c3fa76be680f63fab3a
/WebSocket/src/main/java/MessageFormat.java
b6cac2c8d7640bcff745de573684cdb50475acf6
[]
no_license
gkiran315/A-High-Performance-Scalable-Event-Bus-System-for-Distributed-Data-Synchronization-
65ae47a4b839ae51e6d445acad36a4af23129737
21a337b7dbd034475d7398cf16ac178b4726f864
refs/heads/master
2021-01-22T12:18:27.807441
2017-05-29T07:36:03
2017-05-29T07:36:03
92,716,850
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
import java.sql.Timestamp; public class MessageFormat implements java.io.Serializable { public String Topic; public int Type; public String Message; public Timestamp Time; }
[ "kiran-patrudu.gopalasetty@ttu.edu" ]
kiran-patrudu.gopalasetty@ttu.edu
adec19d039e517e9f6f39a7ef8c3f4b41edea4f6
3b4bde682eeb119132ba8b377cca45ed6fecb454
/Framework_IIANLP/src/vettoricontesto/VettoreIDF.java
39da2a9b2ab0d05572d89f46166a377c95dd2f26
[]
no_license
swapUniba/musicando
52027b2296089a7b9fef762efcf3d22e02e58269
2ca745c64c88439a5c440214268ce160aa67a6fb
refs/heads/main
2023-03-06T17:09:12.487656
2021-02-15T22:19:03
2021-02-15T22:19:03
339,219,413
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
7,933
java
package vettoricontesto; import main.Configurazione; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; import java.util.StringTokenizer; import java.util.TreeMap; /*La classe VettoreIDF calcola l'IDF dei lemmi contenuti nelle frasi annotate come n frasi comnteneti quel lemma in tutto il dataset. Gli altri attributi sono: HashMap<String, Double> lemmiIDF che per ogni lemma associa lo score IDF del lemma e HashSet<String> insiemeLemmi HashSet<Integer> idFraseLemmi */ public class VettoreIDF{ public static int numeroFrasi = 0; public static HashSet<Integer> idFrasi = new HashSet<>(); public static HashSet<String> insiemeLemmi = new HashSet<>();//650 public static TreeMap<Integer, ArrayList<String>> idFraseLemmi = new TreeMap<>(); public static HashMap<String, Double> lemmiIDF = new HashMap<>();//AD OGNI LEMMA ASSEGNA IDF /*Il metodo calcolaInsiemeLemmi() che partendo dalle FRASI ANNOTATE, //6;war, film, film;3 1) inserisce i lemmi all'interno del set insiemeLemmi */ public static void calcolaInsiemeLemmi() throws Exception{ Scanner frasi = new Scanner(new File( Configurazione.path + "filesFilmando2\\" + Configurazione.tecnica + "\\" + Configurazione.TipoLemmi + "\\idFraseLemmi.txt")); while (frasi.hasNextLine()){ String riga = frasi.nextLine(); //6;war, film, film;1 StringTokenizer st = new StringTokenizer(riga, ";"); // Lettura id e lemmi int idFrase = Integer.parseInt(st.nextToken()); //6 String testo = st.nextToken(); //war, film, film StringTokenizer st2 = new StringTokenizer(testo, ","); while (st2.hasMoreTokens()){ //TRIM RIMUOVE SPAZI PRIMA E DOPO STRINGA String lemma = st2.nextToken().trim();//war, film, film ---> war insiemeLemmi.add(lemma);//CREO LISTA LEMMI DI CUI CALCOLARE IDF escluse stopwords } } frasi.close(); } //LEGGO FRASI DI TUTTI I FILM /*Il metodo leggiDataset(): 1) legge tutte le frasi del //6;war, film, film 2) Conta le frasi lette 3) Inserisce nella mappa idFraseLemmi l'idfrase e i lemmi letti nella frase.*/ public static void leggiDataset() throws FileNotFoundException{ int totfrasi=0; for(int locale=1; locale <=Configurazione.numeroLocali; locale++) { Scanner inLemmi = new Scanner(new File( Configurazione.path + "filesFilmando2\\frasi singoli items\\" + Configurazione.TipoLemmi + "\\" + locale + ".txt")); while (inLemmi.hasNextLine()){ String riga = inLemmi.nextLine(); //I:8493;15;honesty, amazing, film, be, day, nothing numeroFrasi++;//tot frasi dataset StringTokenizer st = new StringTokenizer(riga, ";"); String loc = st.nextToken(); //I:8493 int idFrase = Integer.parseInt(st.nextToken()); //15 String testo = st.nextToken(); //honesty, amazing, film, be, day, nothing ArrayList<String> tokens = new ArrayList<>();//INSERISCO LEMMI StringTokenizer st2 = new StringTokenizer(testo, ","); while (st2.hasMoreTokens()) { //TRIM RIMUOVE SPAZI PRIMA E DOPO STRINGA String lemma = st2.nextToken().trim(); tokens.add(lemma); } idFraseLemmi.put(totfrasi + idFrase, tokens); //AGGIUNGO LA COPPIA IDFRASE TOKENS ALLA MAPPA } inLemmi.close(); totfrasi= numeroFrasi; //System.out.println(locale + ": " + totfrasi); } } /*Il metodo calcolaIDF(), per ogni LEMMA dell'insieme dei lemmi: 1) calcola l’IDF rispetto all’intero dataset di frasi: IDF(l) = # frasi dataset / # frasi dataset contenenti il lemma l 2) inserisce la coppia lemma + IDFlemma nella mappa lemmiIDF. */ public static void calcolaIDF() throws Exception { calcolaInsiemeLemmi(); leggiDataset(); // PER OGNI LEMMA nell'insieme dei lemmi, calcolato prima da generalemmi: [song, set, cool, historical, cold, film, robbe for (String lemma : insiemeLemmi) { //[song, set, cool, historical, cold, film, robbery] double idf = 0; //CALCOLO IDF(l) int contatoreFrasiContenentiLemma = 0; //DENOMINATORE for(int idFrase: idFraseLemmi.keySet()) { //LEGGO TUTTE LE FRASI DATASET boolean presente = false; for(String lemma2: idFraseLemmi.get(idFrase)) //PER OGNI LEMMA FRASE if (lemma.equals(lemma2)){ presente = true; //se presente break; } if (presente){ contatoreFrasiContenentiLemma++; //DENOMINATORE IDF++ } } if (contatoreFrasiContenentiLemma==0) idf=0; else idf = Math.log((double) numeroFrasi / (double) contatoreFrasiContenentiLemma); //calcolo IDF System.out.printf("%-16s %d\n", lemma,contatoreFrasiContenentiLemma);//AGGIUNTO DA ME //System.out.printf(lemma + "\t IDF = " + "ln(" + numeroFrasi + "/" + contatoreFrasiContenentiLemma + ") = " + "%.3f\n", idf);//AGGIUNTO DA ME lemmiIDF.put(lemma, idf); //film; 6,42 } idFraseLemmi.clear(); //pulisco tutte le frasi del dataset insiemeLemmi.clear(); //pulisco lista lemmi delle annotate } /////////////////////////////////////////////////////////////////////////////////////// //Annullo lo score delle stop words public static void annullamentoScoreStopWordsIDF() throws Exception { Scanner stopLemmi = new Scanner(new File( Configurazione.path + "filesFilmando2\\" + Configurazione.tecnica + "\\" + Configurazione.TipoLemmi +"\\stoplemmi.txt")); //ORIGINALE while(stopLemmi.hasNextLine()){ String stopLemma = stopLemmi.nextLine();//LEGGO STOPLEMMA if(lemmiIDF.get(stopLemma)!=null){ //SOLO SE LEMMA PRESENTE NEI LEMMIidf lemmiIDF.put(stopLemma, 0.0); } } stopLemmi.close(); } ////////////////////////////////////////////////////////STAMPE////////////////////////////////////////////////////////// //STAMPA A VIDEO VETTORE IDF public static void stampaIDF(){ for (String lemma : lemmiIDF.keySet()){ System.out.printf("%-23s\t\t%.2f\n", lemma, lemmiIDF.get(lemma)); } } //STAMPA SU FILE VETTORE IDF public static void stampaIDFFile() throws Exception{ PrintWriter out = new PrintWriter(new File( Configurazione.path + "filesFilmando2\\" + Configurazione.tecnica + "\\" + Configurazione.TipoLemmi +"\\strutture\\IDF_Lemmi.txt")); for (String lemma : lemmiIDF.keySet()){ out.printf("%-12s\t%.3f\n", lemma, lemmiIDF.get(lemma)); } out.flush(); out.close(); } ///////////////////////////////////////////////SERIALIZZAZIONI/////////////////////////////////////////////////////// //SERIALIZZAZIONE lemmiIDF su file public static void scriviIDFDAT() throws Exception{ ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream( Configurazione.path + "filesFilmando2\\" + Configurazione.tecnica + "\\" + Configurazione.TipoLemmi + "\\serialized\\lemmiIDF.dat")); oos.writeObject(lemmiIDF); oos.flush(); oos.close(); } //DESERIALIZZAZIONE lemmiIDF public static void leggiIDFDAT() throws Exception{ ObjectInputStream ois = new ObjectInputStream(new FileInputStream( Configurazione.path + "filesFilmando2\\" + Configurazione.tecnica + "\\" + Configurazione.TipoLemmi + "\\serialized\\lemmiIDF.dat")); lemmiIDF = (HashMap<String, Double>) ois.readObject(); ois.close(); } }
[ "noreply@github.com" ]
noreply@github.com
057c127307698bce42fd8c8064a0c39d076fbcc5
27e38480d254be9e664637f362211df0eda57778
/ISA_JAVA/src/main/java/com/example/service/UserServiceBean.java
13d90f8e34787e924de02622fba59cfacbf9ddd0
[]
no_license
djukadjuka/ISA_2016
482b8e868f6fb17572099f97a0e75c2e6698e1a7
f510cd48fd2d7f61b324512069585db4e7ff4e92
refs/heads/master
2020-07-26T00:53:01.136063
2017-03-01T22:03:20
2017-03-01T22:03:20
73,642,170
0
0
null
null
null
null
UTF-8
Java
false
false
2,254
java
package com.example.service; import java.util.Collection; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.example.domain.EmployeeEnum; import com.example.domain.UserBean; import com.example.repository.UserRepository; @Service public class UserServiceBean implements UserService{ @Autowired UserRepository userRepo; @Override public UserBean findOne(Long id) { return userRepo.findOne(id); } @Override public Collection<UserBean> findAll() { return userRepo.findAll(); } @Override public UserBean update(UserBean user) { UserBean u = userRepo.findOne(user.getId()); if(u == null) return null; return userRepo.save(user); } @Override public UserBean create(UserBean user) { if(user.getId() != null){ return null; } return userRepo.save(user); } @Override public void delete(Long id) { userRepo.delete(id); } public Collection<UserBean> getUsersNotManagingOrNotManagersForRestaurant(Long rest_id){ return userRepo.getUsersNotManagingOrNotManagersForRestaurant(rest_id); } public Collection<UserBean> getManagersForRestaurantNoCurrentManager(Long rest_id, Long mgr_id){ return userRepo.getManagersForRestaurantNoCurrentManager(rest_id, mgr_id); } @Override public Collection<UserBean> getUsersThatWorkForARestaurant(Long rest_id) { return userRepo.getUsersThatWorkForARestaurant(rest_id); } @Override public Collection<UserBean> getusersThatDoNotWorkForARestaurant() { return userRepo.getusersThatDoNotWorkForARestaurant(); } @Override public Collection<UserBean> getPossibleDeliverers() { return userRepo.getPossibleDeliverers(); } @Override public Collection<UserBean> getTiesToRestaurantByThisManager(Long manager_id) { return this.userRepo.getTiesToRestaurantByThisManager(manager_id); } @Override public void destroyManagerRestaurantTies(Long manager_id, Long rest_id) { this.userRepo.destroyManagerRestaurantTies(manager_id, rest_id); } @Override public void fireManagerAllTogether(Long user_id) { this.userRepo.fireManagerAllTogether(user_id); } @Override public UserBean findUserByAuthCodeYo(String auth_code) { return this.userRepo.findUserByAuthCodeYo(auth_code); } }
[ "milanns@live.com" ]
milanns@live.com
57d465aa1bfe766a042b2060655418e35226a2f3
1e5be978c24c359a7c4b858370d183b45e168420
/proj.android/app/src/main/java/com/amazon/iap/SQLiteHelper.java
4973c1e069e6e4ce59d1f8fe500b250f09473229
[]
no_license
JeremyAzoomee/Azoomee2
d752ea7512e048d7b22db38be2ec21ab046520e5
f57292c18de9a9138bd3635893bcd23fc171a21f
refs/heads/master
2021-05-18T14:51:23.389050
2020-03-13T15:59:09
2020-03-13T15:59:09
251,271,764
0
0
null
null
null
null
UTF-8
Java
false
false
2,498
java
package com.amazon.iap; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; /** * Sample SQLiteHelper for the purchase record table * */ public class SQLiteHelper extends SQLiteOpenHelper { //table name public static final String TABLE_SUBSCRIPTIONS = "subscriptions"; //receipt id public static final String COLUMN_RECEIPT_ID = "receipt_id"; //amazon user id public static final String COLUMN_USER_ID = "user_id"; //subscription valid from date public static final String COLUMN_DATE_FROM = "date_from"; //subscription valid to date public static final String COLUMN_DATE_TO = "date_to"; //subscription sku public static final String COLUMN_SKU = "sku"; private static final String DATABASE_NAME = "subscriptions.db"; private static final int DATABASE_VERSION = 1; // Database creation sql statement private static final String DATABASE_CREATE = "create table " + TABLE_SUBSCRIPTIONS + "(" + COLUMN_RECEIPT_ID + " text primary key not null, " + COLUMN_USER_ID + " text not null, " + COLUMN_DATE_FROM + " integer not null, " + COLUMN_DATE_TO + " integer, " + COLUMN_SKU + " text not null" + ");"; public SQLiteHelper(final Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(final SQLiteDatabase database) { database.execSQL(DATABASE_CREATE); } @Override public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) { Log .w(SQLiteHelper.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion); // do nothing in the sample } }
[ "tamas.bonis@azoomee.com" ]
tamas.bonis@azoomee.com
de7acf5939b2415e8bfdab3ec7cb37ec26b01a19
b5d7fd9459a3779eb9a13bf8cc2c9326c23a11c7
/AttendenceCalculateServer/src/MainService/CalculateAttendence.java
8b0bacd7e9e8e8b4a1ee53d445822a3b428e8007
[]
no_license
violinandchess/FingerPrintAttendence
40f19de4e7cc634407645fa87d1af1f9399eb003
3d5598e4752b37cc84e9f44316a448f34600cc1a
refs/heads/master
2021-09-10T12:32:37.649483
2018-03-26T10:03:27
2018-03-26T10:03:27
113,834,092
0
0
null
null
null
null
UTF-8
Java
false
false
14,450
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package MainService; import Models.AttendLecture; import Models.LectureSession; import Models.StoredAttendenceFile; import Models.WeeklyAttendence; import ServiceLayer.AttendLectureService; import ServiceLayer.SessionService; import ServiceLayer.WeeklyAttendenceService; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Vibavi */ public class CalculateAttendence { private static Date StartDate; private static Date EndDate; private static final Logger LOGGER = Logger.getLogger(WeeklyAttendenceService.class.getName()); public static void main(String[] args) throws ParseException { WeeklyAttendenceService weeklyattendence = new WeeklyAttendenceService(); StoredAttendenceFile[] storedFiles = weeklyattendence.GetWeeklyFiles(false);//get unprocessed files if (storedFiles != null) { for (StoredAttendenceFile file : storedFiles) { GenarateWeeklyAttendenceFromRAWVersion2(file); } } else { LOGGER.log(Level.INFO, "No_Files_To_Process", "No weekly files uploaded to process"); } SimpleDateFormat dateonly = new SimpleDateFormat("yyyy-MM-dd"); StartDate = dateonly.parse(storedFiles[0].getWeekStartDate()); EndDate = dateonly.parse("2018-01-08"); EndDate = dateonly.parse("2018-02-25"); // StartDate = dateonly.parse(storedFiles[0].getWeekStartDate()); // EndDate = dateonly.parse(storedFiles[0].getWeekEndDate()); CalculateAbsentPresent(dateonly.format(EndDate.getTime()) + 1); } private static void GenarateWeeklyAttendenceFromRAWVersion2(StoredAttendenceFile file) { System.out.println("File name " + file.getFileName()); System.out.println("File Path " + file.getFilePath()); List<String> readbuffer = new ArrayList<>(); String readfilefullpath = file.getFilePath() + file.getFileName(); File readFile = new File(readfilefullpath); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(readFile)); String line; int lineno = 1; while ((line = reader.readLine()) != null) { if (lineno == 1) { lineno++; continue; } if (!line.trim().isEmpty()) { readbuffer.add(line); } } } catch (IOException e) { e.printStackTrace(); } finally { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } WeeklyAttendenceService weeklyattendence = new WeeklyAttendenceService(); StoredAttendenceFile[] lastprocessedfile = weeklyattendence.GetWeeklyFiles(true); WeeklyAttendence[] filterdData = new WeeklyAttendence[readbuffer.size()]; int i = 0; Date updatednextprocess = new Date(); for (String record : readbuffer) { String recordArray[] = record.split("\t"); //System.out.println("recordArray[0]" + recordArray[0]); WeeklyAttendence tempFillData = new WeeklyAttendence(); String datetimestring = recordArray[8]; String[] datetimeArray = datetimestring.split(" "); tempFillData.setDeviceID(recordArray[2]); String datepartArray[] = datetimeArray[0].split("/"); int tempint; String converteddatepart = ""; for (int k = 0; k < datepartArray.length; k++) { try { System.out.println("" + datepartArray[k].length()); for (int l = 0; l < datepartArray[k].length(); l++) { try { String tempstring = datepartArray[k].charAt(l) + ""; tempint = Integer.parseInt(tempstring); converteddatepart += tempint; } catch (NumberFormatException ex) { System.out.println("unreadable Charater"); } } if (k != 2) { converteddatepart += "/"; } } catch (Exception ex) { System.out.println("outot"); } } String timearray[] = datetimeArray[1].split(":"); String convertedtime = ""; for (int k = 0; k < timearray.length; k++) { System.out.println("" + timearray[k].length()); for (int l = 0; l < timearray[k].length(); l++) { try { String tempstring = timearray[k].charAt(l) + ""; tempint = Integer.parseInt(tempstring); convertedtime += tempint; } catch (NumberFormatException ex) { System.out.println("unreadable Charater"); } } if (k != 2) { convertedtime += ":"; } } tempFillData.setWeekDate(converteddatepart); tempFillData.setWeekTime(convertedtime); if (lastprocessedfile == null || lastprocessedfile[0].getNextProcessDate() == null) { filterdData[i] = tempFillData; i++; } else { try { String output = lastprocessedfile[0].getNextProcessDate(); DateFormat toFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); DateFormat toFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); toFormat.setLenient(false); Date dateRead = toFormat.parse(converteddatepart + " " + convertedtime); Date dateNext = toFormat2.parse(output); if (dateRead.compareTo(dateNext) >= 0) { filterdData[i] = tempFillData; i++; } } catch (Exception ex) { System.out.println("" + ex); } } } try { SimpleDateFormat dateonly = new SimpleDateFormat("yyyy-MM-dd"); updatednextprocess = dateonly.parse(file.getWeekEndDate()); Calendar c = Calendar.getInstance(); c.setTime(updatednextprocess); c.add(Calendar.DATE, 1); AddWeeklyAttendence(filterdData); // StartDate = dateonly.parse(file.getWeekStartDate()); // EndDate = dateonly.parse(file.getWeekEndDate()); } catch (ParseException ex) { System.out.println("Exception 3 " + ex); } } private static void AddWeeklyAttendence(WeeklyAttendence[] filteredDate) { int i = 0; WeeklyAttendenceService weeklyattendence = new WeeklyAttendenceService(); boolean isupdated = false; for (WeeklyAttendence entry : filteredDate) { if (entry != null) { String weekdstring = entry.getWeekDate(); Date weekd = new Date(); SimpleDateFormat dateonly2 = new SimpleDateFormat("yyy/MM/dd"); SimpleDateFormat localDateFormat = new SimpleDateFormat("HH:mm:ss"); Date time = new Date(); try { time = localDateFormat.parse(entry.getWeekTime()); weekd = dateonly2.parse(weekdstring); } catch (ParseException ex) { System.out.println("ex" + ex.getMessage()); } dateonly2 = new SimpleDateFormat("yyyy-MM-dd"); String aftertime = localDateFormat.format(time); String afterdate = dateonly2.format(weekd); WeeklyAttendence weeklyrecord = new WeeklyAttendence(); String filteredid = ""; for (int k = 0; k < entry.getDeviceID().length(); k++) { try { String tempstring = "" + entry.getDeviceID().charAt(k); int tempno = Integer.parseInt(tempstring); filteredid += tempstring; } catch (NumberFormatException ex) { System.out.println("number"); } } weeklyrecord.setDeviceID(Integer.parseInt(filteredid) + ""); weeklyrecord.setWeekDate(afterdate); weeklyrecord.setWeekTime(aftertime); isupdated = weeklyattendence.AddWeekendAttendence(weeklyrecord); } // isupdated = weeklyattendence.AddWeekendAttendence(entry.getDeviceID(), s, entry.getWeekTime()); if (!isupdated) { break; } } if (isupdated) { System.out.println("updated"); } else { System.out.println("not updated"); } } private static void CalculateAbsentPresent(String nextprocessdate) { Date startTempWeek = StartDate; Date endTempWeek = EndDate; Calendar c = Calendar.getInstance(); c.setTime(startTempWeek); Date tempDate = c.getTime(); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd"); WeeklyAttendenceService service = new WeeklyAttendenceService(); SessionService session = new SessionService(); AttendLectureService attendservice = new AttendLectureService(); do { int day = c.get(Calendar.DAY_OF_WEEK); int passday = getDay(day); WeeklyAttendence[] attendence = service.GetTodayAttendence(dateformat.format(tempDate)); LectureSession[] todaysession = session.GetTodaySession(dateformat.format(tempDate)); if (attendence != null && todaysession != null) { for (LectureSession today : todaysession) { for (WeeklyAttendence attend : attendence) { if (today.getCode().equals(attend.getSubCode())) { String studenttime = attend.getWeekTime(); String lecturestarttime = today.getStartTime(); String lectureendtime = today.getEndTime(); if (studenttime.compareTo(lecturestarttime) >= 0 && studenttime.compareTo(lectureendtime) <= 0) { AttendLecture templecture = new AttendLecture(); templecture.setRegNo(attend.getRegNo()); templecture.setDeviceID(attend.getDeviceID()); templecture.setSessionID(today.getSessionID()); templecture.setIDate(dateformat.format(tempDate)); templecture.setITime(today.getStartTime()); templecture.setAB_P("Present"); attendservice.AddWeekendAttendence(templecture); } else { AttendLecture templecture = new AttendLecture(); templecture.setRegNo(attend.getRegNo()); templecture.setDeviceID(attend.getDeviceID()); templecture.setSessionID(today.getSessionID()); templecture.setIDate(dateformat.format(tempDate)); templecture.setITime(today.getStartTime()); templecture.setAB_P("Absent"); attendservice.AddWeekendAttendence(templecture); } } } WeeklyAttendence[] totalregister = service.GetAbsenties(today.getCode()); for (WeeklyAttendence absent : totalregister) { AttendLecture templecture = new AttendLecture(); templecture.setRegNo(absent.getRegNo()); templecture.setDeviceID(absent.getDeviceID()); templecture.setSessionID(today.getSessionID()); templecture.setIDate(dateformat.format(tempDate)); templecture.setITime(today.getStartTime()); templecture.setAB_P("Absent"); attendservice.AddWeekendAttendence(templecture); } } } c.add(Calendar.DATE, 1); tempDate = c.getTime(); } while ((tempDate.compareTo(startTempWeek) >= 0) && (tempDate.compareTo(endTempWeek) <= 0)); WeeklyAttendenceService weeklyattendence = new WeeklyAttendenceService(); //boolean isupdated = weeklyattendence.UpdateNextProcessDate(id, nextprocessdate); } private static int getDay(int day) { switch (day) { case Calendar.SUNDAY: return 7; case Calendar.MONDAY: return 1; case Calendar.TUESDAY: return 2; case Calendar.WEDNESDAY: return 3; case Calendar.THURSDAY: return 4; case Calendar.FRIDAY: return 5; case Calendar.SATURDAY: return 6; default: return 0; } } }
[ "vibaviattigala@gmail.com" ]
vibaviattigala@gmail.com
24c106e51b34bb96be7b9d057bf9100752f21549
b60b20483eeccdc6e0f67d685fba02a9ee92e528
/Ass_10_Rohit_Gupta/src/com/rohit/assignment_10/DBConnection.java
52e5c09a07251fa08164e6a4eae4af8615f3ed19
[]
no_license
rohit-gupta55/Assignment_10
659095c66e96a31c546bd76156aa67f82c4e1d8a
01f0116fe730d604b7335628057dceca4056fed2
refs/heads/master
2023-03-20T21:56:05.010698
2021-03-04T09:24:43
2021-03-04T09:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
510
java
package com.rohit.assignment_10; import java.sql.Connection; import java.sql.DriverManager; public class DBConnection { private static Connection con ; private DBConnection(){} static { try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","manager"); } catch(Exception e) { e.printStackTrace(); } } public static Connection getcon() { return con; } }
[ "rohit_gupta2@persistent.com" ]
rohit_gupta2@persistent.com
437585c63556bc0915b258b0a47903ccd4f02ca0
f99b204f67c83840d762c6328c0b0a2654c4824f
/aliyun-java-sdk-push/src/main/java/com/aliyuncs/push/model/v20160801/QueryPushDetailResponse.java
76a9f841affebee257d910f86d08a14fb9bf6e17
[ "Apache-2.0" ]
permissive
huanmengmie/aliyun-openapi-java-sdk
1182efee7ef06751427e46f89edbc79f527e3676
0ee6d4d975fb2e51984c9e0423f304d044b0f445
refs/heads/master
2021-01-02T08:55:05.600370
2017-08-01T07:53:54
2017-08-01T07:53:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,369
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.aliyuncs.push.model.v20160801; import com.aliyuncs.AcsResponse; import com.aliyuncs.push.transform.v20160801.QueryPushDetailResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class QueryPushDetailResponse extends AcsResponse { private String requestId; private Long appKey; private String target; private String targetValue; private String pushType; private String deviceType; private String title; private String body; private String pushTime; private String expireTime; private Integer antiHarassStartTime; private Integer antiHarassDuration; private Boolean storeOffline; private String batchNumber; private String provinceId; private String iOSApnsEnv; private Boolean iOSRemind; private String iOSRemindBody; private Integer iOSBadge; private String iOSMusic; private String iOSSubtitle; private String iOSNotificationCategory; private Boolean iOSMutableContent; private String iOSExtParameters; private String androidNotifyType; private String androidOpenType; private String androidActivity; private String androidMusic; private String androidOpenUrl; private String androidXiaoMiActivity; private String androidXiaoMiNotifyTitle; private String androidXiaoMiNotifyBody; private Integer androidNotificationBarType; private Integer androidNotificationBarPriority; private String androidExtParameters; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public Long getAppKey() { return this.appKey; } public void setAppKey(Long appKey) { this.appKey = appKey; } public String getTarget() { return this.target; } public void setTarget(String target) { this.target = target; } public String getTargetValue() { return this.targetValue; } public void setTargetValue(String targetValue) { this.targetValue = targetValue; } public String getPushType() { return this.pushType; } public void setPushType(String pushType) { this.pushType = pushType; } public String getDeviceType() { return this.deviceType; } public void setDeviceType(String deviceType) { this.deviceType = deviceType; } public String getTitle() { return this.title; } public void setTitle(String title) { this.title = title; } public String getBody() { return this.body; } public void setBody(String body) { this.body = body; } public String getPushTime() { return this.pushTime; } public void setPushTime(String pushTime) { this.pushTime = pushTime; } public String getExpireTime() { return this.expireTime; } public void setExpireTime(String expireTime) { this.expireTime = expireTime; } public Integer getAntiHarassStartTime() { return this.antiHarassStartTime; } public void setAntiHarassStartTime(Integer antiHarassStartTime) { this.antiHarassStartTime = antiHarassStartTime; } public Integer getAntiHarassDuration() { return this.antiHarassDuration; } public void setAntiHarassDuration(Integer antiHarassDuration) { this.antiHarassDuration = antiHarassDuration; } public Boolean getStoreOffline() { return this.storeOffline; } public void setStoreOffline(Boolean storeOffline) { this.storeOffline = storeOffline; } public String getBatchNumber() { return this.batchNumber; } public void setBatchNumber(String batchNumber) { this.batchNumber = batchNumber; } public String getProvinceId() { return this.provinceId; } public void setProvinceId(String provinceId) { this.provinceId = provinceId; } public String getiOSApnsEnv() { return this.iOSApnsEnv; } public void setiOSApnsEnv(String iOSApnsEnv) { this.iOSApnsEnv = iOSApnsEnv; } public Boolean getiOSRemind() { return this.iOSRemind; } public void setiOSRemind(Boolean iOSRemind) { this.iOSRemind = iOSRemind; } public String getiOSRemindBody() { return this.iOSRemindBody; } public void setiOSRemindBody(String iOSRemindBody) { this.iOSRemindBody = iOSRemindBody; } public Integer getiOSBadge() { return this.iOSBadge; } public void setiOSBadge(Integer iOSBadge) { this.iOSBadge = iOSBadge; } public String getiOSMusic() { return this.iOSMusic; } public void setiOSMusic(String iOSMusic) { this.iOSMusic = iOSMusic; } public String getiOSSubtitle() { return this.iOSSubtitle; } public void setiOSSubtitle(String iOSSubtitle) { this.iOSSubtitle = iOSSubtitle; } public String getiOSNotificationCategory() { return this.iOSNotificationCategory; } public void setiOSNotificationCategory(String iOSNotificationCategory) { this.iOSNotificationCategory = iOSNotificationCategory; } public Boolean getiOSMutableContent() { return this.iOSMutableContent; } public void setiOSMutableContent(Boolean iOSMutableContent) { this.iOSMutableContent = iOSMutableContent; } public String getiOSExtParameters() { return this.iOSExtParameters; } public void setiOSExtParameters(String iOSExtParameters) { this.iOSExtParameters = iOSExtParameters; } public String getAndroidNotifyType() { return this.androidNotifyType; } public void setAndroidNotifyType(String androidNotifyType) { this.androidNotifyType = androidNotifyType; } public String getAndroidOpenType() { return this.androidOpenType; } public void setAndroidOpenType(String androidOpenType) { this.androidOpenType = androidOpenType; } public String getAndroidActivity() { return this.androidActivity; } public void setAndroidActivity(String androidActivity) { this.androidActivity = androidActivity; } public String getAndroidMusic() { return this.androidMusic; } public void setAndroidMusic(String androidMusic) { this.androidMusic = androidMusic; } public String getAndroidOpenUrl() { return this.androidOpenUrl; } public void setAndroidOpenUrl(String androidOpenUrl) { this.androidOpenUrl = androidOpenUrl; } public String getAndroidXiaoMiActivity() { return this.androidXiaoMiActivity; } public void setAndroidXiaoMiActivity(String androidXiaoMiActivity) { this.androidXiaoMiActivity = androidXiaoMiActivity; } public String getAndroidXiaoMiNotifyTitle() { return this.androidXiaoMiNotifyTitle; } public void setAndroidXiaoMiNotifyTitle(String androidXiaoMiNotifyTitle) { this.androidXiaoMiNotifyTitle = androidXiaoMiNotifyTitle; } public String getAndroidXiaoMiNotifyBody() { return this.androidXiaoMiNotifyBody; } public void setAndroidXiaoMiNotifyBody(String androidXiaoMiNotifyBody) { this.androidXiaoMiNotifyBody = androidXiaoMiNotifyBody; } public Integer getAndroidNotificationBarType() { return this.androidNotificationBarType; } public void setAndroidNotificationBarType(Integer androidNotificationBarType) { this.androidNotificationBarType = androidNotificationBarType; } public Integer getAndroidNotificationBarPriority() { return this.androidNotificationBarPriority; } public void setAndroidNotificationBarPriority(Integer androidNotificationBarPriority) { this.androidNotificationBarPriority = androidNotificationBarPriority; } public String getAndroidExtParameters() { return this.androidExtParameters; } public void setAndroidExtParameters(String androidExtParameters) { this.androidExtParameters = androidExtParameters; } @Override public QueryPushDetailResponse getInstance(UnmarshallerContext context) { return QueryPushDetailResponseUnmarshaller.unmarshall(this, context); } }
[ "zhangw@alibaba-inc.com" ]
zhangw@alibaba-inc.com
2721c556cccece95ebc9c91ed48f632228a39b3d
2a5ea91ba2b333adaf44f5932ab85d1445da80eb
/shsxt_xmjf_web/src/main/java/com/shsxt/xmjf/controller/IndexController.java
5218407de6ec0becb0f22ddef1fc162c67228255
[]
no_license
2289589441/shsxt_xmjf_par
66488aad7814e393913fd4656a88b6f625c65686
c1e36f96c213bbaef68c76e203da2278ed012fd4
refs/heads/master
2020-04-05T12:26:13.065451
2018-11-09T14:04:49
2018-11-09T14:04:49
156,869,708
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
package com.shsxt.xmjf.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; /** * @auther: 康晓伟 * @date: 2018/11/08 19:57 * @description: shsxt_xmjf_par */ @Controller public class IndexController { @RequestMapping("index") public String index(HttpServletRequest request){ request.setAttribute("ctx",request.getContextPath()); return "index"; } @RequestMapping("login") public String login(HttpServletRequest request){ request.setAttribute("ctx",request.getContextPath()); return "login"; } @RequestMapping("quickLogin") public String quickLogin(HttpServletRequest request){ request.setAttribute("ctx",request.getContextPath()); return "quick_login"; } @RequestMapping("register") public String register(HttpServletRequest request){ request.setAttribute("ctx",request.getContextPath()); return "register"; } }
[ "2289589441@qq.com" ]
2289589441@qq.com
7949d7c7dc9912b21eb64fa872af29ded9ef35e6
2e29699f2df837308b5954f7ec9e9d4efad35a1f
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/GoldMineralDetector.java
caf4590d33f8078541b09d3ee4d41d2c8ecc1da2
[ "BSD-3-Clause" ]
permissive
DeadlyiPod/TFLTesting
ee34ba3cd7a74c825286355f13d6ca9b60c7dbf2
604102df059ef58cd3faf2aa661f8c0194fde78e
refs/heads/master
2020-04-04T00:30:33.802028
2019-02-25T12:55:07
2019-02-25T12:55:07
155,652,284
0
0
null
2019-02-20T17:05:40
2018-11-01T02:43:47
Java
UTF-8
Java
false
false
5,971
java
package org.firstinspires.ftc.teamcode; import com.disnodeteam.dogecv.DogeCV; import com.disnodeteam.dogecv.detectors.DogeCVDetector; import com.disnodeteam.dogecv.filters.DogeCVColorFilter; import com.disnodeteam.dogecv.filters.LeviColorFilter; import com.disnodeteam.dogecv.scoring.MaxAreaScorer; import com.disnodeteam.dogecv.scoring.PerfectAreaScorer; import com.disnodeteam.dogecv.scoring.RatioScorer; import org.opencv.core.Mat; import org.opencv.core.MatOfPoint; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.imgproc.Imgproc; import java.util.ArrayList; import java.util.List; /** * Created by Victo on 9/10/2018. */ public class GoldMineralDetector extends DogeCVDetector { // Defining Mats to be used. private Mat displayMat = new Mat(); // Display debug info to the screen (this is what is returned) private Mat workingMat = new Mat(); // Used for preprocessing and working with (blurring as an example) private Mat mask = new Mat(); // Mask returned by color filter private Mat hierarchy = new Mat(); // hierarchy used by coutnours // Results of the detector private boolean found = false; // Is the gold mineral found private Point screenPosition = new Point(); // Screen position of the mineral private Rect foundRect = new Rect(); // Found rect //X and Y Values int xValue; int yValue; public DogeCV.AreaScoringMethod areaScoringMethod = DogeCV.AreaScoringMethod.PERFECT_AREA; // Setting to decide to use MaxAreaScorer or PerfectAreaScorer //Create the default filters and scorers public DogeCVColorFilter colorFilter = new LeviColorFilter(LeviColorFilter.ColorPreset.YELLOW); //Default Yellow filter public RatioScorer ratioScorer = new RatioScorer(1.0, 3); // Used to find perfect squares public MaxAreaScorer maxAreaScorer = new MaxAreaScorer( 0.01); // Used to find largest objects public PerfectAreaScorer perfectAreaScorer = new PerfectAreaScorer(5000,0.05); // Used to find objects near a tuned area value /** * Simple constructor */ public GoldMineralDetector() { super(); detectorName = "Generic Detector"; // Set the detector name } @Override public Mat process(Mat input) { // Copy the input mat to our working mats, then release it for memory input.copyTo(displayMat); input.copyTo(workingMat); input.release(); //Preprocess the working Mat (blur it then apply a color filter) Imgproc.GaussianBlur(workingMat,workingMat,new Size(5,5),0); colorFilter.process(workingMat.clone(),mask ); //Find contours of the yellow mask and draw them to the display mat for viewing List<MatOfPoint> contoursYellow = new ArrayList<>(); Imgproc.findContours(mask , contoursYellow, hierarchy, Imgproc.RETR_TREE, Imgproc.CHAIN_APPROX_SIMPLE); Imgproc.drawContours(displayMat,contoursYellow,-1,new Scalar(230,70,70),2); // Current result Rect bestRect = null; double bestDiffrence = Double.MAX_VALUE; // MAX_VALUE since less diffrence = better // Loop through the contours and score them, searching for the best result for(MatOfPoint cont : contoursYellow){ double score = calculateScore(cont); // Get the diffrence score using the scoring API // Get bounding rect of contour Rect rect = Imgproc.boundingRect(cont); Imgproc.rectangle(displayMat, rect.tl(), rect.br(), new Scalar(0,0,255),2); // Draw rect // If the result is better then the previously tracked one, set this rect as the new best if(score < bestDiffrence){ bestDiffrence = score; bestRect = rect; } } if(bestRect != null){ // Show chosen result Imgproc.rectangle(displayMat, bestRect.tl(), bestRect.br(), new Scalar(255,0,0),4); Imgproc.putText(displayMat, "Chosen", bestRect.tl(),0,1,new Scalar(255,255,255)); screenPosition = new Point(bestRect.x, bestRect.y); xValue = bestRect.x; yValue = bestRect.y; foundRect = bestRect; found = true; }else{ found = false; } //Print result Imgproc.putText(displayMat,"Result: " + screenPosition.x +"/"+screenPosition.y,new Point(10,getAdjustedSize().height - 30),0,1, new Scalar(255,255,0),1); return displayMat; } @Override public void useDefaults() { addScorer(ratioScorer); // Add diffrent scoreres depending on the selected mode if(areaScoringMethod == DogeCV.AreaScoringMethod.MAX_AREA){ addScorer(maxAreaScorer); } if (areaScoringMethod == DogeCV.AreaScoringMethod.PERFECT_AREA){ addScorer(perfectAreaScorer); } } /** * Returns the element's last position in screen pixels * @return position in screen pixels */ public Point getScreenPosition(){ return screenPosition; } /** * Returns the gold element's last position's x value in pixels. * @return x position in screen pixels of the best value. */ public int getxValue() {return xValue;} /** * Returns the gold element's last position's y value in pixels. * @return y position in screen pixels of the best value. */ public int getyValue() {return yValue;} /** * Returns the element's found rectangle * @return gold element rect */ public Rect getFoundRect() { return foundRect; } /** * Returns if a mineral is being tracked/detected * @return if a mineral is being tracked/detected */ public boolean isFound() { return found; } }
[ "robertcartier00@gmail.com" ]
robertcartier00@gmail.com
221764beae209ce5d56e621385085b0b5d75eb07
b8f8de320e76d82eb9ed36696b5eb1ba16098b33
/MyService/musicService/src/main/java/com/example/musicservice/MusicListAdapter.java
7fe1c2ce1c8c60a3e7bcf7a4add6f04cfcc90c58
[]
no_license
cngmsy/18yearSecondTask
d33baa1965fff2128667533cc52a07459de53c41
0a1fde2d0e9964a61f33d05131f3d9db97319a58
refs/heads/master
2021-05-11T09:05:17.184318
2018-03-26T08:55:47
2018-03-26T08:55:47
118,067,081
3
0
null
null
null
null
UTF-8
Java
false
false
3,711
java
package com.example.musicservice; import java.util.ArrayList; import java.util.List; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; public class MusicListAdapter extends BaseAdapter { private Context context; private Handler handler; private LayoutInflater inflater; private ArrayList<Song> song_list; public MusicListAdapter(Context context,ArrayList<Song> song_list) { this.song_list=song_list; this.context=context; inflater=LayoutInflater.from(context); } public MusicListAdapter(Context context,Handler handler) { this.context=context; this.handler=handler; inflater=LayoutInflater.from(context); } public MusicListAdapter(Context context) { this.context=context; inflater=LayoutInflater.from(context); } public void setData(ArrayList<Song> song_list){ this.song_list=song_list; } @Override public int getCount() { return song_list.size(); } public Object getItem(int position) { return song_list.get(position); } public long getItemId(int position) { return position; } /* * 以下方法可以通知适配器重新刷新数据,而不用通知ACTIVITY更新 */ public void updateData(ArrayList<Song> song_list){ Log.i("MusicListAdapter:", "能够启动更新列表的方法"); this.song_list=song_list; notifyDataSetChanged(); } public View getView(final int position, View convertView, ViewGroup parent) { Holder holder; final Song song=song_list.get(position); if (convertView == null) { convertView = inflater.inflate(R.layout.local_music_list_item, null); holder=new Holder(convertView); convertView.setTag(holder); }else{ holder=(Holder) convertView.getTag(); } holder.songnum_tv.setText(""+(position+1)); holder.songname_tv.setText(song.getSongName()); holder.more_img.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO 自动生成的方法存根 Message msg=Message.obtain(); msg.arg1=LocalMusicActivity.MUSIC_OPTIONS; msg.what=position; handler.sendMessage(msg); } }); holder.song_layout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO 自动生成的方法存根 Message msg=Message.obtain(); msg.arg1=LocalMusicActivity.MUSIC_PLAY; msg.what=position; handler.sendMessage(msg); Intent intent=new Intent(context,MusicService.class); intent.setAction(MusicService.ACTION_PLAY_LOCAL_MUSIC); intent.putExtra("position", position); context.startService(intent); } }); return convertView; } class Holder{ public TextView songname_tv; public TextView songnum_tv; public ImageView more_img; public LinearLayout song_layout; public Holder(View view){ songname_tv=(TextView) view.findViewById(R.id.id_songname_tv); songnum_tv=(TextView) view.findViewById(R.id.id_songnum_tv); more_img=(ImageView) view.findViewById(R.id.id_more_img); song_layout=(LinearLayout) view.findViewById(R.id.id_song_layout); } } }
[ "18210098144@163.com" ]
18210098144@163.com
913a85cc324229d4575f4fdd9ca1efab84506d60
0b4632d4e73d999243fbfd6ba0560cd9ddf942bc
/app/src/androidTest/java/com/iqbalhood/palmtree/monitoring/ApplicationTest.java
32a4594fc6e8631d7cdf95b1f560c18ad877826b
[ "MIT" ]
permissive
iqbalhood/PalmGardenMonitoring
b9f19ae17f0881a28a5bb0261946a25e46b60bef
dcef67cc9cb5e5a2a549a869b8173efd8289ead3
refs/heads/master
2018-07-15T06:23:01.142988
2018-06-01T15:01:26
2018-06-01T15:01:26
118,776,085
0
0
MIT
2018-06-01T15:01:27
2018-01-24T14:28:05
Java
UTF-8
Java
false
false
376
java
package com.iqbalhood.palmtree.monitoring; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "iqbalhood@gmail.com" ]
iqbalhood@gmail.com
028541fcd7378b87b8bd3deee0e844e851bb1aea
21eb1166f59959fdcb83950fa0020fba185b97f1
/src/基础/数列特征.java
fe19258ce82353f6dc34535ef17a3998f8960fae
[]
no_license
Code-Lark/LanQiaoBei
6ecee4b4ffd20aa8c6b3893465910953b26b7b99
92348b96739ddc9b7e8fc0fc8dec314bb351d160
refs/heads/master
2022-12-12T15:07:51.860252
2020-09-20T03:36:11
2020-09-20T03:36:11
277,465,041
2
0
null
null
null
null
GB18030
Java
false
false
507
java
package 基础; import java.util.Scanner; public class 数列特征 { public static void main(String[] args) { // TODO 自动生成的方法存根 Scanner sc =new Scanner(System.in); int n=sc.nextInt(); int t=0; int max=0; int min=0; int sum=0; t=sc.nextInt(); max=t; min=t; sum+=t; for(int i=0;i<n-1;i++) { t=sc.nextInt(); if(t>max) max=t; if(t<min) min=t; sum+=t; } System.out.println(max); System.out.println(min); System.out.println(sum); } }
[ "l15251807030@126.com" ]
l15251807030@126.com
e9ce3256b7b95165d93da10bbcfd8e6461cbd19b
a50f393c4915ce4c61548243c0171289d160fcc6
/presto-resource-group-managers/src/test/java/com/facebook/presto/resourceGroups/db/TestResourceGroupsDao.java
1d3c9de8ec6e6cff266d97874d37863c2e79f4e5
[]
no_license
luotianran/prosto-root
5865f13f3deb2ba6f5048118dfd5435129eb77e9
3e96b397bf802f650198a5587187968129140631
refs/heads/master
2020-03-28T03:14:05.827301
2018-09-06T07:14:59
2018-09-06T07:14:59
147,629,440
0
1
null
null
null
null
UTF-8
Java
false
false
10,916
java
/* * 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.facebook.presto.resourceGroups.db; import com.facebook.presto.resourceGroups.ResourceGroupNameTemplate; import com.google.common.collect.ImmutableList; import io.airlift.json.JsonCodec; import io.airlift.units.Duration; import org.h2.jdbc.JdbcSQLException; import org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException; import org.testng.annotations.Test; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.regex.Pattern; import static io.airlift.json.JsonCodec.listJsonCodec; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; public class TestResourceGroupsDao { private static final String ENVIRONMENT = "test"; private static final JsonCodec<List<String>> LIST_STRING_CODEC = listJsonCodec(String.class); static H2ResourceGroupsDao setup(String prefix) { DbResourceGroupConfig config = new DbResourceGroupConfig().setConfigDbUrl("jdbc:h2:mem:test_" + prefix + System.nanoTime()); return new H2DaoProvider(config).get(); } @Test public void testResourceGroups() { H2ResourceGroupsDao dao = setup("resource_groups"); dao.createResourceGroupsTable(); Map<Long, ResourceGroupSpecBuilder> map = new HashMap<>(); testResourceGroupInsert(dao, map); testResourceGroupUpdate(dao, map); testResourceGroupDelete(dao, map); } private static void testResourceGroupInsert(H2ResourceGroupsDao dao, Map<Long, ResourceGroupSpecBuilder> map) { dao.insertResourceGroup(1, "global", "100%", 100, 100, 100, null, null, null, null, null, null, null, null, ENVIRONMENT); dao.insertResourceGroup(2, "bi", "50%", 50, 50, 50, null, null, null, null, null, null, null, 1L, ENVIRONMENT); List<ResourceGroupSpecBuilder> records = dao.getResourceGroups(ENVIRONMENT); assertEquals(records.size(), 2); map.put(1L, new ResourceGroupSpecBuilder(1, new ResourceGroupNameTemplate("global"), "100%", 100, Optional.of(100), 100, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), null)); map.put(2L, new ResourceGroupSpecBuilder(2, new ResourceGroupNameTemplate("bi"), "50%", 50, Optional.of(50), 50, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(1L))); compareResourceGroups(map, records); } private static void testResourceGroupUpdate(H2ResourceGroupsDao dao, Map<Long, ResourceGroupSpecBuilder> map) { dao.updateResourceGroup(2, "bi", "40%", 40, 30, 30, null, null, true, null, null, null, null, 1L, ENVIRONMENT); ResourceGroupSpecBuilder updated = new ResourceGroupSpecBuilder(2, new ResourceGroupNameTemplate("bi"), "40%", 40, Optional.of(30), 30, Optional.empty(), Optional.empty(), Optional.of(true), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(1L)); map.put(2L, updated); compareResourceGroups(map, dao.getResourceGroups(ENVIRONMENT)); } private static void testResourceGroupDelete(H2ResourceGroupsDao dao, Map<Long, ResourceGroupSpecBuilder> map) { dao.deleteResourceGroup(2); map.remove(2L); compareResourceGroups(map, dao.getResourceGroups(ENVIRONMENT)); } @Test public void testSelectors() { H2ResourceGroupsDao dao = setup("selectors"); dao.createResourceGroupsTable(); dao.createSelectorsTable(); Map<Long, SelectorRecord> map = new HashMap<>(); testSelectorInsert(dao, map); testSelectorUpdate(dao, map); testSelectorUpdateNull(dao, map); testSelectorDelete(dao, map); testSelectorDeleteNull(dao, map); testSelectorMultiDelete(dao, map); } private static void testSelectorInsert(H2ResourceGroupsDao dao, Map<Long, SelectorRecord> map) { map.put(2L, new SelectorRecord( 2L, Optional.of(Pattern.compile("ping_user")), Optional.of(Pattern.compile(".*")), Optional.empty())); map.put(3L, new SelectorRecord( 3L, Optional.of(Pattern.compile("admin_user")), Optional.of(Pattern.compile(".*")), Optional.of(ImmutableList.of("tag1", "tag2")))); dao.insertResourceGroup(1, "admin", "100%", 100, 100, 100, null, null, null, null, null, null, null, null, ENVIRONMENT); dao.insertResourceGroup(2, "ping_query", "50%", 50, 50, 50, null, null, null, null, null, null, null, 1L, ENVIRONMENT); dao.insertResourceGroup(3, "config", "50%", 50, 50, 50, null, null, null, null, null, null, null, 1L, ENVIRONMENT); dao.insertSelector(2, "ping_user", ".*", null); dao.insertSelector(3, "admin_user", ".*", LIST_STRING_CODEC.toJson(ImmutableList.of("tag1", "tag2"))); List<SelectorRecord> records = dao.getSelectors(); compareSelectors(map, records); } private static void testSelectorUpdate(H2ResourceGroupsDao dao, Map<Long, SelectorRecord> map) { dao.updateSelector(2, "ping.*", "ping_source", LIST_STRING_CODEC.toJson(ImmutableList.of("tag1")), "ping_user", ".*", null); SelectorRecord updated = new SelectorRecord( 2, Optional.of(Pattern.compile("ping.*")), Optional.of(Pattern.compile("ping_source")), Optional.of(ImmutableList.of("tag1"))); map.put(2L, updated); compareSelectors(map, dao.getSelectors()); } private static void testSelectorUpdateNull(H2ResourceGroupsDao dao, Map<Long, SelectorRecord> map) { SelectorRecord updated = new SelectorRecord(2, Optional.empty(), Optional.empty(), Optional.empty()); map.put(2L, updated); dao.updateSelector(2, null, null, null, "ping.*", "ping_source", LIST_STRING_CODEC.toJson(ImmutableList.of("tag1"))); compareSelectors(map, dao.getSelectors()); updated = new SelectorRecord( 2, Optional.of(Pattern.compile("ping.*")), Optional.of(Pattern.compile("ping_source")), Optional.of(ImmutableList.of("tag1", "tag2"))); map.put(2L, updated); dao.updateSelector(2, "ping.*", "ping_source", LIST_STRING_CODEC.toJson(ImmutableList.of("tag1", "tag2")), null, null, null); compareSelectors(map, dao.getSelectors()); } private static void testSelectorDelete(H2ResourceGroupsDao dao, Map<Long, SelectorRecord> map) { map.remove(2L); dao.deleteSelector(2, "ping.*", "ping_source", LIST_STRING_CODEC.toJson(ImmutableList.of("tag1", "tag2"))); compareSelectors(map, dao.getSelectors()); } private static void testSelectorDeleteNull(H2ResourceGroupsDao dao, Map<Long, SelectorRecord> map) { dao.updateSelector(3, null, null, null, "admin_user", ".*", LIST_STRING_CODEC.toJson(ImmutableList.of("tag1", "tag2"))); SelectorRecord nullRegexes = new SelectorRecord(3L, Optional.empty(), Optional.empty(), Optional.empty()); map.put(3L, nullRegexes); compareSelectors(map, dao.getSelectors()); dao.deleteSelector(3, null, null, null); map.remove(3L); compareSelectors(map, dao.getSelectors()); } private static void testSelectorMultiDelete(H2ResourceGroupsDao dao, Map<Long, SelectorRecord> map) { if (dao != null) { return; } dao.insertSelector(3, "user1", "pipeline", null); map.put(3L, new SelectorRecord( 3L, Optional.of(Pattern.compile("user1")), Optional.of(Pattern.compile("pipeline")), Optional.empty())); compareSelectors(map, dao.getSelectors()); dao.deleteSelectors(3L); map.remove(3L); compareSelectors(map, dao.getSelectors()); } @Test public void testGlobalResourceGroupProperties() { H2ResourceGroupsDao dao = setup("global_properties"); dao.createResourceGroupsGlobalPropertiesTable(); dao.insertResourceGroupsGlobalProperties("cpu_quota_period", "1h"); ResourceGroupGlobalProperties globalProperties = new ResourceGroupGlobalProperties(Optional.of(Duration.valueOf("1h"))); ResourceGroupGlobalProperties records = dao.getResourceGroupGlobalProperties().get(0); assertEquals(globalProperties, records); try { dao.insertResourceGroupsGlobalProperties("invalid_property", "1h"); } catch (UnableToExecuteStatementException ex) { assertTrue(ex.getCause() instanceof JdbcSQLException); assertTrue(ex.getCause().getMessage().startsWith("Check constraint violation:")); } try { dao.updateResourceGroupsGlobalProperties("invalid_property_name"); } catch (UnableToExecuteStatementException ex) { assertTrue(ex.getCause() instanceof JdbcSQLException); assertTrue(ex.getCause().getMessage().startsWith("Check constraint violation:")); } } private static void compareResourceGroups(Map<Long, ResourceGroupSpecBuilder> map, List<ResourceGroupSpecBuilder> records) { assertEquals(map.size(), records.size()); for (ResourceGroupSpecBuilder record : records) { ResourceGroupSpecBuilder expected = map.get(record.getId()); assertEquals(record.build(), expected.build()); } } private static void compareSelectors(Map<Long, SelectorRecord> map, List<SelectorRecord> records) { assertEquals(map.size(), records.size()); for (SelectorRecord record : records) { SelectorRecord expected = map.get(record.getResourceGroupId()); assertEquals(record.getResourceGroupId(), expected.getResourceGroupId()); assertEquals(record.getUserRegex().map(Pattern::pattern), expected.getUserRegex().map(Pattern::pattern)); assertEquals(record.getSourceRegex().map(Pattern::pattern), expected.getSourceRegex().map(Pattern::pattern)); } } }
[ "tianran.luo@mime.com" ]
tianran.luo@mime.com
9678202ae86714637b1b5c856716188e85c3d334
d2135b63264ef44a36be87e291e39ff1c46d39ff
/calculator/src/calculator/Calculator.java
0aedd265d7a47af5a598fbb5260a3a621ed55fb6
[]
no_license
durreshehwar/softwareconstruction
ae6026b65e1d2d9bc75c6f026958fddc5bc03070
367a4da27888ec0eaa7b2d0aee5a20da7efab070
refs/heads/master
2023-01-23T12:53:02.476610
2020-11-30T18:27:36
2020-11-30T18:27:36
317,273,545
0
0
null
null
null
null
UTF-8
Java
false
false
503
java
package calculator; public class Calculator { public int add (int x,int y){ return x+y; } public double add (double x,double y){ return x+y; } public int sub (int x,int y){ return x-y; } public double sub (double x,double y){ return x-y; } public int mul (int x,int y){ return x*y; } public double mul (double x,double y){ return x*y; } public int div (int x,int y){ return x/y; } public double div (double x,double y){ return x/y; } }
[ "mega tec@megatec-PC" ]
mega tec@megatec-PC
06252b56cfeeb91acf54670f1f4ea1aa4e7f09ca
f2dfcdc8f99b40a05122cf2d856d947ead01e092
/mmr/src/at/ac/univie/philo/mmr/shared/operators/ExistenceQuantor.java
6133c56350af2a9519a33efee3aaf98caa351bc4
[]
no_license
TheProjecter/moeglichsein
8b134caf40f9ed0a1bf34ff6db2ccc713fa6436f
c8c113e41257b4b107ae64e5ee601786278168ef
refs/heads/master
2021-01-10T15:10:03.592695
2011-08-02T22:27:08
2011-08-02T22:27:08
43,161,395
0
0
null
null
null
null
UTF-8
Java
false
false
1,189
java
package at.ac.univie.philo.mmr.shared.operators; import java.util.Collection; import com.google.gwt.user.client.rpc.IsSerializable; import at.ac.univie.philo.mmr.shared.evaluation.EvaluationResult; import at.ac.univie.philo.mmr.shared.exceptions.NotASentenceException; import at.ac.univie.philo.mmr.shared.expressions.ConstantExpression; import at.ac.univie.philo.mmr.shared.expressions.Expression; import at.ac.univie.philo.mmr.shared.expressions.TruthExpression; import at.ac.univie.philo.mmr.shared.expressions.TruthValue; import at.ac.univie.philo.mmr.shared.expressions.Variable; import at.ac.univie.philo.mmr.shared.expressions.VariableExpression; import at.ac.univie.philo.mmr.shared.semantic.Individual; import at.ac.univie.philo.mmr.shared.semantic.Universe; import at.ac.univie.philo.mmr.shared.semantic.World; import at.ac.univie.philo.mmr.shared.visitors.ExpressionEvaluationVisitor; import at.ac.univie.philo.mmr.shared.visitors.IExpressionVisitor; public class ExistenceQuantor implements IQuantor,IsSerializable { public EnumQuantor getQuantor() { return EnumQuantor.EXISTS; } public String getName() { return "\u2203"; } }
[ "akalypse@gmail.com" ]
akalypse@gmail.com
cf25f788e602d0abccaef9b7a9036dc97a3a9d35
642a9bb4e6e68917da66ef098f9a16b7cc0f6367
/date0118/T4.java
04b5045eb67653c02b8152cb4da21e589a34b119
[]
no_license
charleslin826/JAVA
a509d9560de145d733626acd4a41b4f0a594a431
073c805a4ea3ffbfc653dbf0e5a58ee2f9031f25
refs/heads/master
2020-03-18T11:28:38.112369
2018-05-24T07:13:29
2018-05-24T07:13:29
134,674,106
0
0
null
null
null
null
BIG5
Java
false
false
824
java
package date0118; import java.util.Scanner; public class T4 { public static void main(String[] args) { // 輸入某整數判斷是否為質數 (除1與本身能整除其餘均不能只除它) boolean isPrime=true; Scanner scn = new Scanner(System.in); System.out.print("Please input any integer to see if it is a prime:\n"); int n = scn.nextInt(); for(int i=2;i<n;i++){ // 從2開始除以該數,直到該數前一個數 if(n%i ==0) { //若整除 [例如91,除到7&13的時候7*13=91 餘數為0 則isPrime從true被改為false了] isPrime=false; //不是質數 break; //有false就停止,速度比較快 } }if (isPrime == false) { System.out.print("It's not prime.\n"); } else { System.out.print("It's prime.\n");} // EX:"15872953" scn.close(); } }
[ "noreply@github.com" ]
noreply@github.com
40113f405fd4d0133e20f4dd5e214f9a7dad52af
5fa4fa9b5a8eaf1609f112e5a778935d98e65985
/app/src/main/java/com/letv/leauto/ecolink/ui/LocalMusicFragment/LocalPopWindow.java
6241d3a45f40c414f67eec13a61e7021287392f0
[]
no_license
xingfeng2010/LinkProject
fbde6052101626a87b164ac20e501c69ed6771e0
7fc5b1f451cf609cc919e2d8280c2393f8e6449f
refs/heads/master
2021-01-22T13:03:18.510617
2017-09-16T12:57:52
2017-09-16T12:57:52
102,362,315
0
2
null
null
null
null
UTF-8
Java
false
false
1,468
java
package com.letv.leauto.ecolink.ui.LocalMusicFragment; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.PopupWindow; import com.letv.leauto.ecolink.R; /** * Created by Administrator on 2016/8/8. */ public class LocalPopWindow extends PopupWindow{ private final LayoutInflater inflate; private Context context; private int width; private ListView listview; public LocalPopWindow (Context context,int width){ super(); this.context=context; this.width=width; inflate=LayoutInflater.from(context); initViews(); } private void initViews() { View view=inflate.inflate(R.layout.local_select_listview,null); listview=(ListView) view.findViewById(R.id.listview_pop); view.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); setContentView(view); setWidth(width); setHeight(LinearLayout.LayoutParams.WRAP_CONTENT); ColorDrawable cd = new ColorDrawable(Color.TRANSPARENT); this.setBackgroundDrawable(cd); setFocusable(true); setOutsideTouchable(true); } public ListView getListView(){ return listview; } }
[ "583354000@qq.com" ]
583354000@qq.com
a5f8548fb34af4843cd4f0a5cb20fb88ffbf82be
5b82e2f7c720c49dff236970aacd610e7c41a077
/QueryReformulation-master 2/data/processed/SWTMutableObservableValueContractTest.java
06789518e62d435d5ea93a9a824d6f24dd4cd21c
[]
no_license
shy942/EGITrepoOnlineVersion
4b157da0f76dc5bbf179437242d2224d782dd267
f88fb20497dcc30ff1add5fe359cbca772142b09
refs/heads/master
2021-01-20T16:04:23.509863
2016-07-21T20:43:22
2016-07-21T20:43:22
63,737,385
0
0
null
null
null
null
UTF-8
Java
false
false
2,277
java
/***/ package org.eclipse.jface.databinding.conformance.swt; import junit.framework.Test; import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.jface.databinding.conformance.MutableObservableValueContractTest; import org.eclipse.jface.databinding.conformance.delegate.IObservableValueContractDelegate; import org.eclipse.jface.databinding.conformance.util.DelegatingRealm; import org.eclipse.jface.databinding.conformance.util.SuiteBuilder; import org.eclipse.jface.databinding.swt.DisplayRealm; import org.eclipse.swt.widgets.Display; /** * Mutability tests for IObservableValue for a SWT widget. * * <p> * This class is experimental and can change at any time. It is recommended to * not subclass or assume the test names will not change. The only API that is * guaranteed to not change are the constructors. The tests will remain public * and not final in order to allow for consumers to turn off a test if needed by * subclassing. * </p> * * @since 3.2 */ public class SWTMutableObservableValueContractTest extends MutableObservableValueContractTest { private IObservableValueContractDelegate delegate; public SWTMutableObservableValueContractTest(IObservableValueContractDelegate delegate) { this(null, delegate); } /** * @param testName * @param delegate */ public SWTMutableObservableValueContractTest(String testName, IObservableValueContractDelegate delegate) { super(testName, delegate); this.delegate = delegate; } /** * Creates a new observable passing the realm for the current display. * * @return observable */ @Override protected IObservable doCreateObservable() { Display display = Display.getCurrent(); if (display == null) { display = new Display(); } DelegatingRealm delegateRealm = new DelegatingRealm(DisplayRealm.getRealm(display)); delegateRealm.setCurrent(true); return delegate.createObservable(delegateRealm); } public static Test suite(IObservableValueContractDelegate delegate) { return new SuiteBuilder().addObservableContractTest(SWTMutableObservableValueContractTest.class, delegate).addObservableContractTest(SWTObservableValueContractTest.class, delegate).build(); } }
[ "muktacseku@gmail.com" ]
muktacseku@gmail.com
f5b7b6578f7eaada20466141b28d1b83100a1927
225c3af0f0d0206c70799263b5e9a94725f0b509
/src/main/java/com/K8lyN/controller/GetMax.java
c6a43c73618c9fb8ebc2557ca9be8428261ef3f6
[]
no_license
ThreePeopleTogether/Dazzle-colour-weather-web
8ed9902ccdf4c06974c5279b227ab8e43a424c5a
4e070e11312739eaedc7e366b2ea1625b48cc0a7
refs/heads/main
2023-05-14T03:30:09.309256
2021-06-05T13:18:47
2021-06-05T13:18:47
374,026,090
0
0
null
null
null
null
UTF-8
Java
false
false
1,662
java
package com.K8lyN.controller; /** * @Author K8lyN * @Date 2021/04/10 9:53 * @Version 1.0 */ import com.K8lyN.config.CityCountConfig; import com.K8lyN.model.CityCount; import com.K8lyN.service.CityCountService; import com.K8lyN.utils.HttpClientUtil; import com.google.gson.Gson; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.List; @WebServlet(name = "GetMax", value = "/GetMax") public class GetMax extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpClientUtil.initResponse(response); PrintWriter out = response.getWriter(); String num = request.getParameter("cityNum"); ApplicationContext context = new AnnotationConfigApplicationContext(CityCountConfig.class); CityCountService cityCountService = context.getBean("cityCountService", CityCountService.class); List<CityCount> list = cityCountService.getMax(Integer.parseInt(num)); Gson gson = new Gson(); // 返回json数组 out.print(gson.toJson(list)); } }
[ "942518321@qq.com" ]
942518321@qq.com
ab67d8f231fdc1da2d9476d55c109559445b7cbc
6e808b10126ab4de90a88459c23705422472a4ec
/app/src/main/java/ir/jahanshahloo/evmis/di/modules/RegisterModule.java
967c7909fcbfacc80bbd7cef2789dafd4be17024
[]
no_license
a-jahanshahlo/evmis-android
9abc3032991e7b1d4f63285af7247433437b7626
a3d058c02902d467f4f06573bfc7b3a06565003a
refs/heads/master
2021-03-27T15:22:30.469131
2017-11-10T16:21:49
2017-11-10T16:21:49
110,264,718
1
1
null
null
null
null
UTF-8
Java
false
false
659
java
package ir.jahanshahloo.evmis.di.modules; import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import ir.jahanshahloo.evmis.Service.Contract.IHouseService; import ir.jahanshahloo.evmis.Service.Contract.IRegisterService; import ir.jahanshahloo.evmis.di.scopes.LoginRetrofit; import ir.jahanshahloo.evmis.di.scopes.UserScope; import retrofit2.Retrofit; @Module public class RegisterModule { @Provides @UserScope @LoginRetrofit public IRegisterService provideRegisterService ( Retrofit retrofit){ return retrofit.create(IRegisterService.class); } }
[ "a.jahanshahlo@gmail.com" ]
a.jahanshahlo@gmail.com
57e7add43285d7a7643804e143d469c02b23a80e
4e3c0018a6ec19b11d7d9803bd252b8ba01bf5b5
/proto-google-cloud-recommender-v1beta1/src/main/java/com/google/cloud/recommender/v1beta1/Operation.java
5aacdaa92ad9df2a5f6f36d1b8034f3cf3a724f1
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
pmakani/java-recommender
e00b1ff71fc458a70743e0b652a6fcd06d1182dd
10d2b5c319582ce966158492b96a9937b4f3163e
refs/heads/master
2020-11-25T09:17:26.740520
2019-12-09T19:45:45
2019-12-09T19:45:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
104,516
java
/* * Copyright 2019 Google LLC * * 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. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/recommender/v1beta1/recommendation.proto package com.google.cloud.recommender.v1beta1; /** * * * <pre> * Contains an operation for a resource loosely based on the JSON-PATCH format * with support for: * * Custom filters for describing partial array patch. * * Extended path values for describing nested arrays. * * Custom fields for describing the resource for which the operation is being * described. * * Allows extension to custom operations not natively supported by RFC6902. * See https://tools.ietf.org/html/rfc6902 for details on the original RFC. * </pre> * * Protobuf type {@code google.cloud.recommender.v1beta1.Operation} */ public final class Operation extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.recommender.v1beta1.Operation) OperationOrBuilder { private static final long serialVersionUID = 0L; // Use Operation.newBuilder() to construct. private Operation(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Operation() { action_ = ""; resourceType_ = ""; resource_ = ""; path_ = ""; sourceResource_ = ""; sourcePath_ = ""; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Operation( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { java.lang.String s = input.readStringRequireUtf8(); action_ = s; break; } case 18: { java.lang.String s = input.readStringRequireUtf8(); resourceType_ = s; break; } case 26: { java.lang.String s = input.readStringRequireUtf8(); resource_ = s; break; } case 34: { java.lang.String s = input.readStringRequireUtf8(); path_ = s; break; } case 42: { java.lang.String s = input.readStringRequireUtf8(); sourceResource_ = s; break; } case 50: { java.lang.String s = input.readStringRequireUtf8(); sourcePath_ = s; break; } case 58: { com.google.protobuf.Value.Builder subBuilder = null; if (pathValueCase_ == 7) { subBuilder = ((com.google.protobuf.Value) pathValue_).toBuilder(); } pathValue_ = input.readMessage(com.google.protobuf.Value.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom((com.google.protobuf.Value) pathValue_); pathValue_ = subBuilder.buildPartial(); } pathValueCase_ = 7; break; } case 66: { if (!((mutable_bitField0_ & 0x00000100) != 0)) { pathFilters_ = com.google.protobuf.MapField.newMapField( PathFiltersDefaultEntryHolder.defaultEntry); mutable_bitField0_ |= 0x00000100; } com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> pathFilters__ = input.readMessage( PathFiltersDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); pathFilters_.getMutableMap().put(pathFilters__.getKey(), pathFilters__.getValue()); break; } case 82: { com.google.cloud.recommender.v1beta1.ValueMatcher.Builder subBuilder = null; if (pathValueCase_ == 10) { subBuilder = ((com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_).toBuilder(); } pathValue_ = input.readMessage( com.google.cloud.recommender.v1beta1.ValueMatcher.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom( (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_); pathValue_ = subBuilder.buildPartial(); } pathValueCase_ = 10; break; } case 90: { if (!((mutable_bitField0_ & 0x00000200) != 0)) { pathValueMatchers_ = com.google.protobuf.MapField.newMapField( PathValueMatchersDefaultEntryHolder.defaultEntry); mutable_bitField0_ |= 0x00000200; } com.google.protobuf.MapEntry< java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> pathValueMatchers__ = input.readMessage( PathValueMatchersDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); pathValueMatchers_ .getMutableMap() .put(pathValueMatchers__.getKey(), pathValueMatchers__.getValue()); break; } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.recommender.v1beta1.RecommendationOuterClass .internal_static_google_cloud_recommender_v1beta1_Operation_descriptor; } @SuppressWarnings({"rawtypes"}) @java.lang.Override protected com.google.protobuf.MapField internalGetMapField(int number) { switch (number) { case 8: return internalGetPathFilters(); case 11: return internalGetPathValueMatchers(); default: throw new RuntimeException("Invalid map field number: " + number); } } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.recommender.v1beta1.RecommendationOuterClass .internal_static_google_cloud_recommender_v1beta1_Operation_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.recommender.v1beta1.Operation.class, com.google.cloud.recommender.v1beta1.Operation.Builder.class); } private int bitField0_; private int pathValueCase_ = 0; private java.lang.Object pathValue_; public enum PathValueCase implements com.google.protobuf.Internal.EnumLite { VALUE(7), VALUE_MATCHER(10), PATHVALUE_NOT_SET(0); private final int value; private PathValueCase(int value) { this.value = value; } /** @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated public static PathValueCase valueOf(int value) { return forNumber(value); } public static PathValueCase forNumber(int value) { switch (value) { case 7: return VALUE; case 10: return VALUE_MATCHER; case 0: return PATHVALUE_NOT_SET; default: return null; } } public int getNumber() { return this.value; } }; public PathValueCase getPathValueCase() { return PathValueCase.forNumber(pathValueCase_); } public static final int ACTION_FIELD_NUMBER = 1; private volatile java.lang.Object action_; /** * * * <pre> * Type of this operation. Contains one of 'and', 'remove', 'replace', 'move', * 'copy', 'test' and 'custom' operations. This field is case-insensitive and * always populated. * </pre> * * <code>string action = 1;</code> */ public java.lang.String getAction() { java.lang.Object ref = action_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); action_ = s; return s; } } /** * * * <pre> * Type of this operation. Contains one of 'and', 'remove', 'replace', 'move', * 'copy', 'test' and 'custom' operations. This field is case-insensitive and * always populated. * </pre> * * <code>string action = 1;</code> */ public com.google.protobuf.ByteString getActionBytes() { java.lang.Object ref = action_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); action_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int RESOURCE_TYPE_FIELD_NUMBER = 2; private volatile java.lang.Object resourceType_; /** * * * <pre> * Type of GCP resource being modified/tested. This field is always populated. * Example: cloudresourcemanager.googleapis.com/Project, * compute.googleapis.com/Instance * </pre> * * <code>string resource_type = 2;</code> */ public java.lang.String getResourceType() { java.lang.Object ref = resourceType_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); resourceType_ = s; return s; } } /** * * * <pre> * Type of GCP resource being modified/tested. This field is always populated. * Example: cloudresourcemanager.googleapis.com/Project, * compute.googleapis.com/Instance * </pre> * * <code>string resource_type = 2;</code> */ public com.google.protobuf.ByteString getResourceTypeBytes() { java.lang.Object ref = resourceType_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); resourceType_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int RESOURCE_FIELD_NUMBER = 3; private volatile java.lang.Object resource_; /** * * * <pre> * Contains the fully qualified resource name. This field is always populated. * ex: //cloudresourcemanager.googleapis.com/projects/foo. * </pre> * * <code>string resource = 3;</code> */ public java.lang.String getResource() { java.lang.Object ref = resource_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); resource_ = s; return s; } } /** * * * <pre> * Contains the fully qualified resource name. This field is always populated. * ex: //cloudresourcemanager.googleapis.com/projects/foo. * </pre> * * <code>string resource = 3;</code> */ public com.google.protobuf.ByteString getResourceBytes() { java.lang.Object ref = resource_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); resource_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int PATH_FIELD_NUMBER = 4; private volatile java.lang.Object path_; /** * * * <pre> * Path to the target field being operated on. If the operation is at the * resource level, then path should be "/". This field is always populated. * </pre> * * <code>string path = 4;</code> */ public java.lang.String getPath() { java.lang.Object ref = path_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); path_ = s; return s; } } /** * * * <pre> * Path to the target field being operated on. If the operation is at the * resource level, then path should be "/". This field is always populated. * </pre> * * <code>string path = 4;</code> */ public com.google.protobuf.ByteString getPathBytes() { java.lang.Object ref = path_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); path_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int SOURCE_RESOURCE_FIELD_NUMBER = 5; private volatile java.lang.Object sourceResource_; /** * * * <pre> * Can be set with action 'copy' to copy resource configuration across * different resources of the same type. Example: A resource clone can be * done via action = 'copy', path = "/", from = "/", * source_resource = &lt;source&gt; and resource_name = &lt;target&gt;. * This field is empty for all other values of `action`. * </pre> * * <code>string source_resource = 5;</code> */ public java.lang.String getSourceResource() { java.lang.Object ref = sourceResource_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); sourceResource_ = s; return s; } } /** * * * <pre> * Can be set with action 'copy' to copy resource configuration across * different resources of the same type. Example: A resource clone can be * done via action = 'copy', path = "/", from = "/", * source_resource = &lt;source&gt; and resource_name = &lt;target&gt;. * This field is empty for all other values of `action`. * </pre> * * <code>string source_resource = 5;</code> */ public com.google.protobuf.ByteString getSourceResourceBytes() { java.lang.Object ref = sourceResource_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); sourceResource_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int SOURCE_PATH_FIELD_NUMBER = 6; private volatile java.lang.Object sourcePath_; /** * * * <pre> * Can be set with action 'copy' or 'move' to indicate the source field within * resource or source_resource, ignored if provided for other operation types. * </pre> * * <code>string source_path = 6;</code> */ public java.lang.String getSourcePath() { java.lang.Object ref = sourcePath_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); sourcePath_ = s; return s; } } /** * * * <pre> * Can be set with action 'copy' or 'move' to indicate the source field within * resource or source_resource, ignored if provided for other operation types. * </pre> * * <code>string source_path = 6;</code> */ public com.google.protobuf.ByteString getSourcePathBytes() { java.lang.Object ref = sourcePath_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); sourcePath_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int VALUE_FIELD_NUMBER = 7; /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public boolean hasValue() { return pathValueCase_ == 7; } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public com.google.protobuf.Value getValue() { if (pathValueCase_ == 7) { return (com.google.protobuf.Value) pathValue_; } return com.google.protobuf.Value.getDefaultInstance(); } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public com.google.protobuf.ValueOrBuilder getValueOrBuilder() { if (pathValueCase_ == 7) { return (com.google.protobuf.Value) pathValue_; } return com.google.protobuf.Value.getDefaultInstance(); } public static final int VALUE_MATCHER_FIELD_NUMBER = 10; /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public boolean hasValueMatcher() { return pathValueCase_ == 10; } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public com.google.cloud.recommender.v1beta1.ValueMatcher getValueMatcher() { if (pathValueCase_ == 10) { return (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_; } return com.google.cloud.recommender.v1beta1.ValueMatcher.getDefaultInstance(); } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public com.google.cloud.recommender.v1beta1.ValueMatcherOrBuilder getValueMatcherOrBuilder() { if (pathValueCase_ == 10) { return (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_; } return com.google.cloud.recommender.v1beta1.ValueMatcher.getDefaultInstance(); } public static final int PATH_FILTERS_FIELD_NUMBER = 8; private static final class PathFiltersDefaultEntryHolder { static final com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> defaultEntry = com.google.protobuf.MapEntry .<java.lang.String, com.google.protobuf.Value>newDefaultInstance( com.google.cloud.recommender.v1beta1.RecommendationOuterClass .internal_static_google_cloud_recommender_v1beta1_Operation_PathFiltersEntry_descriptor, com.google.protobuf.WireFormat.FieldType.STRING, "", com.google.protobuf.WireFormat.FieldType.MESSAGE, com.google.protobuf.Value.getDefaultInstance()); } private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> pathFilters_; private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetPathFilters() { if (pathFilters_ == null) { return com.google.protobuf.MapField.emptyMapField(PathFiltersDefaultEntryHolder.defaultEntry); } return pathFilters_; } public int getPathFiltersCount() { return internalGetPathFilters().getMap().size(); } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public boolean containsPathFilters(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } return internalGetPathFilters().getMap().containsKey(key); } /** Use {@link #getPathFiltersMap()} instead. */ @java.lang.Deprecated public java.util.Map<java.lang.String, com.google.protobuf.Value> getPathFilters() { return getPathFiltersMap(); } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public java.util.Map<java.lang.String, com.google.protobuf.Value> getPathFiltersMap() { return internalGetPathFilters().getMap(); } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public com.google.protobuf.Value getPathFiltersOrDefault( java.lang.String key, com.google.protobuf.Value defaultValue) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetPathFilters().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public com.google.protobuf.Value getPathFiltersOrThrow(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetPathFilters().getMap(); if (!map.containsKey(key)) { throw new java.lang.IllegalArgumentException(); } return map.get(key); } public static final int PATH_VALUE_MATCHERS_FIELD_NUMBER = 11; private static final class PathValueMatchersDefaultEntryHolder { static final com.google.protobuf.MapEntry< java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> defaultEntry = com.google.protobuf.MapEntry .<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> newDefaultInstance( com.google.cloud.recommender.v1beta1.RecommendationOuterClass .internal_static_google_cloud_recommender_v1beta1_Operation_PathValueMatchersEntry_descriptor, com.google.protobuf.WireFormat.FieldType.STRING, "", com.google.protobuf.WireFormat.FieldType.MESSAGE, com.google.cloud.recommender.v1beta1.ValueMatcher.getDefaultInstance()); } private com.google.protobuf.MapField< java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> pathValueMatchers_; private com.google.protobuf.MapField< java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> internalGetPathValueMatchers() { if (pathValueMatchers_ == null) { return com.google.protobuf.MapField.emptyMapField( PathValueMatchersDefaultEntryHolder.defaultEntry); } return pathValueMatchers_; } public int getPathValueMatchersCount() { return internalGetPathValueMatchers().getMap().size(); } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public boolean containsPathValueMatchers(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } return internalGetPathValueMatchers().getMap().containsKey(key); } /** Use {@link #getPathValueMatchersMap()} instead. */ @java.lang.Deprecated public java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> getPathValueMatchers() { return getPathValueMatchersMap(); } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> getPathValueMatchersMap() { return internalGetPathValueMatchers().getMap(); } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public com.google.cloud.recommender.v1beta1.ValueMatcher getPathValueMatchersOrDefault( java.lang.String key, com.google.cloud.recommender.v1beta1.ValueMatcher defaultValue) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> map = internalGetPathValueMatchers().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public com.google.cloud.recommender.v1beta1.ValueMatcher getPathValueMatchersOrThrow( java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> map = internalGetPathValueMatchers().getMap(); if (!map.containsKey(key)) { throw new java.lang.IllegalArgumentException(); } return map.get(key); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getActionBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, action_); } if (!getResourceTypeBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, resourceType_); } if (!getResourceBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, resource_); } if (!getPathBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, path_); } if (!getSourceResourceBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, sourceResource_); } if (!getSourcePathBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 6, sourcePath_); } if (pathValueCase_ == 7) { output.writeMessage(7, (com.google.protobuf.Value) pathValue_); } com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( output, internalGetPathFilters(), PathFiltersDefaultEntryHolder.defaultEntry, 8); if (pathValueCase_ == 10) { output.writeMessage(10, (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_); } com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( output, internalGetPathValueMatchers(), PathValueMatchersDefaultEntryHolder.defaultEntry, 11); unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getActionBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, action_); } if (!getResourceTypeBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, resourceType_); } if (!getResourceBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, resource_); } if (!getPathBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, path_); } if (!getSourceResourceBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, sourceResource_); } if (!getSourcePathBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, sourcePath_); } if (pathValueCase_ == 7) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 7, (com.google.protobuf.Value) pathValue_); } for (java.util.Map.Entry<java.lang.String, com.google.protobuf.Value> entry : internalGetPathFilters().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> pathFilters__ = PathFiltersDefaultEntryHolder.defaultEntry .newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, pathFilters__); } if (pathValueCase_ == 10) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 10, (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_); } for (java.util.Map.Entry<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> entry : internalGetPathValueMatchers().getMap().entrySet()) { com.google.protobuf.MapEntry< java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> pathValueMatchers__ = PathValueMatchersDefaultEntryHolder.defaultEntry .newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, pathValueMatchers__); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.recommender.v1beta1.Operation)) { return super.equals(obj); } com.google.cloud.recommender.v1beta1.Operation other = (com.google.cloud.recommender.v1beta1.Operation) obj; if (!getAction().equals(other.getAction())) return false; if (!getResourceType().equals(other.getResourceType())) return false; if (!getResource().equals(other.getResource())) return false; if (!getPath().equals(other.getPath())) return false; if (!getSourceResource().equals(other.getSourceResource())) return false; if (!getSourcePath().equals(other.getSourcePath())) return false; if (!internalGetPathFilters().equals(other.internalGetPathFilters())) return false; if (!internalGetPathValueMatchers().equals(other.internalGetPathValueMatchers())) return false; if (!getPathValueCase().equals(other.getPathValueCase())) return false; switch (pathValueCase_) { case 7: if (!getValue().equals(other.getValue())) return false; break; case 10: if (!getValueMatcher().equals(other.getValueMatcher())) return false; break; case 0: default: } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ACTION_FIELD_NUMBER; hash = (53 * hash) + getAction().hashCode(); hash = (37 * hash) + RESOURCE_TYPE_FIELD_NUMBER; hash = (53 * hash) + getResourceType().hashCode(); hash = (37 * hash) + RESOURCE_FIELD_NUMBER; hash = (53 * hash) + getResource().hashCode(); hash = (37 * hash) + PATH_FIELD_NUMBER; hash = (53 * hash) + getPath().hashCode(); hash = (37 * hash) + SOURCE_RESOURCE_FIELD_NUMBER; hash = (53 * hash) + getSourceResource().hashCode(); hash = (37 * hash) + SOURCE_PATH_FIELD_NUMBER; hash = (53 * hash) + getSourcePath().hashCode(); if (!internalGetPathFilters().getMap().isEmpty()) { hash = (37 * hash) + PATH_FILTERS_FIELD_NUMBER; hash = (53 * hash) + internalGetPathFilters().hashCode(); } if (!internalGetPathValueMatchers().getMap().isEmpty()) { hash = (37 * hash) + PATH_VALUE_MATCHERS_FIELD_NUMBER; hash = (53 * hash) + internalGetPathValueMatchers().hashCode(); } switch (pathValueCase_) { case 7: hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); break; case 10: hash = (37 * hash) + VALUE_MATCHER_FIELD_NUMBER; hash = (53 * hash) + getValueMatcher().hashCode(); break; case 0: default: } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.recommender.v1beta1.Operation parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.recommender.v1beta1.Operation parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.recommender.v1beta1.Operation parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.recommender.v1beta1.Operation parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.cloud.recommender.v1beta1.Operation prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Contains an operation for a resource loosely based on the JSON-PATCH format * with support for: * * Custom filters for describing partial array patch. * * Extended path values for describing nested arrays. * * Custom fields for describing the resource for which the operation is being * described. * * Allows extension to custom operations not natively supported by RFC6902. * See https://tools.ietf.org/html/rfc6902 for details on the original RFC. * </pre> * * Protobuf type {@code google.cloud.recommender.v1beta1.Operation} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.recommender.v1beta1.Operation) com.google.cloud.recommender.v1beta1.OperationOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.recommender.v1beta1.RecommendationOuterClass .internal_static_google_cloud_recommender_v1beta1_Operation_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField(int number) { switch (number) { case 8: return internalGetPathFilters(); case 11: return internalGetPathValueMatchers(); default: throw new RuntimeException("Invalid map field number: " + number); } } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMutableMapField(int number) { switch (number) { case 8: return internalGetMutablePathFilters(); case 11: return internalGetMutablePathValueMatchers(); default: throw new RuntimeException("Invalid map field number: " + number); } } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.recommender.v1beta1.RecommendationOuterClass .internal_static_google_cloud_recommender_v1beta1_Operation_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.recommender.v1beta1.Operation.class, com.google.cloud.recommender.v1beta1.Operation.Builder.class); } // Construct using com.google.cloud.recommender.v1beta1.Operation.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} } @java.lang.Override public Builder clear() { super.clear(); action_ = ""; resourceType_ = ""; resource_ = ""; path_ = ""; sourceResource_ = ""; sourcePath_ = ""; internalGetMutablePathFilters().clear(); internalGetMutablePathValueMatchers().clear(); pathValueCase_ = 0; pathValue_ = null; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.recommender.v1beta1.RecommendationOuterClass .internal_static_google_cloud_recommender_v1beta1_Operation_descriptor; } @java.lang.Override public com.google.cloud.recommender.v1beta1.Operation getDefaultInstanceForType() { return com.google.cloud.recommender.v1beta1.Operation.getDefaultInstance(); } @java.lang.Override public com.google.cloud.recommender.v1beta1.Operation build() { com.google.cloud.recommender.v1beta1.Operation result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.recommender.v1beta1.Operation buildPartial() { com.google.cloud.recommender.v1beta1.Operation result = new com.google.cloud.recommender.v1beta1.Operation(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.action_ = action_; result.resourceType_ = resourceType_; result.resource_ = resource_; result.path_ = path_; result.sourceResource_ = sourceResource_; result.sourcePath_ = sourcePath_; if (pathValueCase_ == 7) { if (valueBuilder_ == null) { result.pathValue_ = pathValue_; } else { result.pathValue_ = valueBuilder_.build(); } } if (pathValueCase_ == 10) { if (valueMatcherBuilder_ == null) { result.pathValue_ = pathValue_; } else { result.pathValue_ = valueMatcherBuilder_.build(); } } result.pathFilters_ = internalGetPathFilters(); result.pathFilters_.makeImmutable(); result.pathValueMatchers_ = internalGetPathValueMatchers(); result.pathValueMatchers_.makeImmutable(); result.bitField0_ = to_bitField0_; result.pathValueCase_ = pathValueCase_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.recommender.v1beta1.Operation) { return mergeFrom((com.google.cloud.recommender.v1beta1.Operation) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.recommender.v1beta1.Operation other) { if (other == com.google.cloud.recommender.v1beta1.Operation.getDefaultInstance()) return this; if (!other.getAction().isEmpty()) { action_ = other.action_; onChanged(); } if (!other.getResourceType().isEmpty()) { resourceType_ = other.resourceType_; onChanged(); } if (!other.getResource().isEmpty()) { resource_ = other.resource_; onChanged(); } if (!other.getPath().isEmpty()) { path_ = other.path_; onChanged(); } if (!other.getSourceResource().isEmpty()) { sourceResource_ = other.sourceResource_; onChanged(); } if (!other.getSourcePath().isEmpty()) { sourcePath_ = other.sourcePath_; onChanged(); } internalGetMutablePathFilters().mergeFrom(other.internalGetPathFilters()); internalGetMutablePathValueMatchers().mergeFrom(other.internalGetPathValueMatchers()); switch (other.getPathValueCase()) { case VALUE: { mergeValue(other.getValue()); break; } case VALUE_MATCHER: { mergeValueMatcher(other.getValueMatcher()); break; } case PATHVALUE_NOT_SET: { break; } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.recommender.v1beta1.Operation parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.recommender.v1beta1.Operation) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int pathValueCase_ = 0; private java.lang.Object pathValue_; public PathValueCase getPathValueCase() { return PathValueCase.forNumber(pathValueCase_); } public Builder clearPathValue() { pathValueCase_ = 0; pathValue_ = null; onChanged(); return this; } private int bitField0_; private java.lang.Object action_ = ""; /** * * * <pre> * Type of this operation. Contains one of 'and', 'remove', 'replace', 'move', * 'copy', 'test' and 'custom' operations. This field is case-insensitive and * always populated. * </pre> * * <code>string action = 1;</code> */ public java.lang.String getAction() { java.lang.Object ref = action_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); action_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Type of this operation. Contains one of 'and', 'remove', 'replace', 'move', * 'copy', 'test' and 'custom' operations. This field is case-insensitive and * always populated. * </pre> * * <code>string action = 1;</code> */ public com.google.protobuf.ByteString getActionBytes() { java.lang.Object ref = action_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); action_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Type of this operation. Contains one of 'and', 'remove', 'replace', 'move', * 'copy', 'test' and 'custom' operations. This field is case-insensitive and * always populated. * </pre> * * <code>string action = 1;</code> */ public Builder setAction(java.lang.String value) { if (value == null) { throw new NullPointerException(); } action_ = value; onChanged(); return this; } /** * * * <pre> * Type of this operation. Contains one of 'and', 'remove', 'replace', 'move', * 'copy', 'test' and 'custom' operations. This field is case-insensitive and * always populated. * </pre> * * <code>string action = 1;</code> */ public Builder clearAction() { action_ = getDefaultInstance().getAction(); onChanged(); return this; } /** * * * <pre> * Type of this operation. Contains one of 'and', 'remove', 'replace', 'move', * 'copy', 'test' and 'custom' operations. This field is case-insensitive and * always populated. * </pre> * * <code>string action = 1;</code> */ public Builder setActionBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); action_ = value; onChanged(); return this; } private java.lang.Object resourceType_ = ""; /** * * * <pre> * Type of GCP resource being modified/tested. This field is always populated. * Example: cloudresourcemanager.googleapis.com/Project, * compute.googleapis.com/Instance * </pre> * * <code>string resource_type = 2;</code> */ public java.lang.String getResourceType() { java.lang.Object ref = resourceType_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); resourceType_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Type of GCP resource being modified/tested. This field is always populated. * Example: cloudresourcemanager.googleapis.com/Project, * compute.googleapis.com/Instance * </pre> * * <code>string resource_type = 2;</code> */ public com.google.protobuf.ByteString getResourceTypeBytes() { java.lang.Object ref = resourceType_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); resourceType_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Type of GCP resource being modified/tested. This field is always populated. * Example: cloudresourcemanager.googleapis.com/Project, * compute.googleapis.com/Instance * </pre> * * <code>string resource_type = 2;</code> */ public Builder setResourceType(java.lang.String value) { if (value == null) { throw new NullPointerException(); } resourceType_ = value; onChanged(); return this; } /** * * * <pre> * Type of GCP resource being modified/tested. This field is always populated. * Example: cloudresourcemanager.googleapis.com/Project, * compute.googleapis.com/Instance * </pre> * * <code>string resource_type = 2;</code> */ public Builder clearResourceType() { resourceType_ = getDefaultInstance().getResourceType(); onChanged(); return this; } /** * * * <pre> * Type of GCP resource being modified/tested. This field is always populated. * Example: cloudresourcemanager.googleapis.com/Project, * compute.googleapis.com/Instance * </pre> * * <code>string resource_type = 2;</code> */ public Builder setResourceTypeBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); resourceType_ = value; onChanged(); return this; } private java.lang.Object resource_ = ""; /** * * * <pre> * Contains the fully qualified resource name. This field is always populated. * ex: //cloudresourcemanager.googleapis.com/projects/foo. * </pre> * * <code>string resource = 3;</code> */ public java.lang.String getResource() { java.lang.Object ref = resource_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); resource_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Contains the fully qualified resource name. This field is always populated. * ex: //cloudresourcemanager.googleapis.com/projects/foo. * </pre> * * <code>string resource = 3;</code> */ public com.google.protobuf.ByteString getResourceBytes() { java.lang.Object ref = resource_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); resource_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Contains the fully qualified resource name. This field is always populated. * ex: //cloudresourcemanager.googleapis.com/projects/foo. * </pre> * * <code>string resource = 3;</code> */ public Builder setResource(java.lang.String value) { if (value == null) { throw new NullPointerException(); } resource_ = value; onChanged(); return this; } /** * * * <pre> * Contains the fully qualified resource name. This field is always populated. * ex: //cloudresourcemanager.googleapis.com/projects/foo. * </pre> * * <code>string resource = 3;</code> */ public Builder clearResource() { resource_ = getDefaultInstance().getResource(); onChanged(); return this; } /** * * * <pre> * Contains the fully qualified resource name. This field is always populated. * ex: //cloudresourcemanager.googleapis.com/projects/foo. * </pre> * * <code>string resource = 3;</code> */ public Builder setResourceBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); resource_ = value; onChanged(); return this; } private java.lang.Object path_ = ""; /** * * * <pre> * Path to the target field being operated on. If the operation is at the * resource level, then path should be "/". This field is always populated. * </pre> * * <code>string path = 4;</code> */ public java.lang.String getPath() { java.lang.Object ref = path_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); path_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Path to the target field being operated on. If the operation is at the * resource level, then path should be "/". This field is always populated. * </pre> * * <code>string path = 4;</code> */ public com.google.protobuf.ByteString getPathBytes() { java.lang.Object ref = path_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); path_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Path to the target field being operated on. If the operation is at the * resource level, then path should be "/". This field is always populated. * </pre> * * <code>string path = 4;</code> */ public Builder setPath(java.lang.String value) { if (value == null) { throw new NullPointerException(); } path_ = value; onChanged(); return this; } /** * * * <pre> * Path to the target field being operated on. If the operation is at the * resource level, then path should be "/". This field is always populated. * </pre> * * <code>string path = 4;</code> */ public Builder clearPath() { path_ = getDefaultInstance().getPath(); onChanged(); return this; } /** * * * <pre> * Path to the target field being operated on. If the operation is at the * resource level, then path should be "/". This field is always populated. * </pre> * * <code>string path = 4;</code> */ public Builder setPathBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); path_ = value; onChanged(); return this; } private java.lang.Object sourceResource_ = ""; /** * * * <pre> * Can be set with action 'copy' to copy resource configuration across * different resources of the same type. Example: A resource clone can be * done via action = 'copy', path = "/", from = "/", * source_resource = &lt;source&gt; and resource_name = &lt;target&gt;. * This field is empty for all other values of `action`. * </pre> * * <code>string source_resource = 5;</code> */ public java.lang.String getSourceResource() { java.lang.Object ref = sourceResource_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); sourceResource_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Can be set with action 'copy' to copy resource configuration across * different resources of the same type. Example: A resource clone can be * done via action = 'copy', path = "/", from = "/", * source_resource = &lt;source&gt; and resource_name = &lt;target&gt;. * This field is empty for all other values of `action`. * </pre> * * <code>string source_resource = 5;</code> */ public com.google.protobuf.ByteString getSourceResourceBytes() { java.lang.Object ref = sourceResource_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); sourceResource_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Can be set with action 'copy' to copy resource configuration across * different resources of the same type. Example: A resource clone can be * done via action = 'copy', path = "/", from = "/", * source_resource = &lt;source&gt; and resource_name = &lt;target&gt;. * This field is empty for all other values of `action`. * </pre> * * <code>string source_resource = 5;</code> */ public Builder setSourceResource(java.lang.String value) { if (value == null) { throw new NullPointerException(); } sourceResource_ = value; onChanged(); return this; } /** * * * <pre> * Can be set with action 'copy' to copy resource configuration across * different resources of the same type. Example: A resource clone can be * done via action = 'copy', path = "/", from = "/", * source_resource = &lt;source&gt; and resource_name = &lt;target&gt;. * This field is empty for all other values of `action`. * </pre> * * <code>string source_resource = 5;</code> */ public Builder clearSourceResource() { sourceResource_ = getDefaultInstance().getSourceResource(); onChanged(); return this; } /** * * * <pre> * Can be set with action 'copy' to copy resource configuration across * different resources of the same type. Example: A resource clone can be * done via action = 'copy', path = "/", from = "/", * source_resource = &lt;source&gt; and resource_name = &lt;target&gt;. * This field is empty for all other values of `action`. * </pre> * * <code>string source_resource = 5;</code> */ public Builder setSourceResourceBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); sourceResource_ = value; onChanged(); return this; } private java.lang.Object sourcePath_ = ""; /** * * * <pre> * Can be set with action 'copy' or 'move' to indicate the source field within * resource or source_resource, ignored if provided for other operation types. * </pre> * * <code>string source_path = 6;</code> */ public java.lang.String getSourcePath() { java.lang.Object ref = sourcePath_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); sourcePath_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Can be set with action 'copy' or 'move' to indicate the source field within * resource or source_resource, ignored if provided for other operation types. * </pre> * * <code>string source_path = 6;</code> */ public com.google.protobuf.ByteString getSourcePathBytes() { java.lang.Object ref = sourcePath_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); sourcePath_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Can be set with action 'copy' or 'move' to indicate the source field within * resource or source_resource, ignored if provided for other operation types. * </pre> * * <code>string source_path = 6;</code> */ public Builder setSourcePath(java.lang.String value) { if (value == null) { throw new NullPointerException(); } sourcePath_ = value; onChanged(); return this; } /** * * * <pre> * Can be set with action 'copy' or 'move' to indicate the source field within * resource or source_resource, ignored if provided for other operation types. * </pre> * * <code>string source_path = 6;</code> */ public Builder clearSourcePath() { sourcePath_ = getDefaultInstance().getSourcePath(); onChanged(); return this; } /** * * * <pre> * Can be set with action 'copy' or 'move' to indicate the source field within * resource or source_resource, ignored if provided for other operation types. * </pre> * * <code>string source_path = 6;</code> */ public Builder setSourcePathBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); sourcePath_ = value; onChanged(); return this; } private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Value, com.google.protobuf.Value.Builder, com.google.protobuf.ValueOrBuilder> valueBuilder_; /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public boolean hasValue() { return pathValueCase_ == 7; } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public com.google.protobuf.Value getValue() { if (valueBuilder_ == null) { if (pathValueCase_ == 7) { return (com.google.protobuf.Value) pathValue_; } return com.google.protobuf.Value.getDefaultInstance(); } else { if (pathValueCase_ == 7) { return valueBuilder_.getMessage(); } return com.google.protobuf.Value.getDefaultInstance(); } } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public Builder setValue(com.google.protobuf.Value value) { if (valueBuilder_ == null) { if (value == null) { throw new NullPointerException(); } pathValue_ = value; onChanged(); } else { valueBuilder_.setMessage(value); } pathValueCase_ = 7; return this; } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public Builder setValue(com.google.protobuf.Value.Builder builderForValue) { if (valueBuilder_ == null) { pathValue_ = builderForValue.build(); onChanged(); } else { valueBuilder_.setMessage(builderForValue.build()); } pathValueCase_ = 7; return this; } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public Builder mergeValue(com.google.protobuf.Value value) { if (valueBuilder_ == null) { if (pathValueCase_ == 7 && pathValue_ != com.google.protobuf.Value.getDefaultInstance()) { pathValue_ = com.google.protobuf.Value.newBuilder((com.google.protobuf.Value) pathValue_) .mergeFrom(value) .buildPartial(); } else { pathValue_ = value; } onChanged(); } else { if (pathValueCase_ == 7) { valueBuilder_.mergeFrom(value); } valueBuilder_.setMessage(value); } pathValueCase_ = 7; return this; } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public Builder clearValue() { if (valueBuilder_ == null) { if (pathValueCase_ == 7) { pathValueCase_ = 0; pathValue_ = null; onChanged(); } } else { if (pathValueCase_ == 7) { pathValueCase_ = 0; pathValue_ = null; } valueBuilder_.clear(); } return this; } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public com.google.protobuf.Value.Builder getValueBuilder() { return getValueFieldBuilder().getBuilder(); } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ public com.google.protobuf.ValueOrBuilder getValueOrBuilder() { if ((pathValueCase_ == 7) && (valueBuilder_ != null)) { return valueBuilder_.getMessageOrBuilder(); } else { if (pathValueCase_ == 7) { return (com.google.protobuf.Value) pathValue_; } return com.google.protobuf.Value.getDefaultInstance(); } } /** * * * <pre> * Value for the `path` field. Will be set for actions:'add'/'replace'. * Maybe set for action: 'test'. Either this or `value_matcher` will be set * for 'test' operation. An exact match must be performed. * </pre> * * <code>.google.protobuf.Value value = 7;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Value, com.google.protobuf.Value.Builder, com.google.protobuf.ValueOrBuilder> getValueFieldBuilder() { if (valueBuilder_ == null) { if (!(pathValueCase_ == 7)) { pathValue_ = com.google.protobuf.Value.getDefaultInstance(); } valueBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Value, com.google.protobuf.Value.Builder, com.google.protobuf.ValueOrBuilder>( (com.google.protobuf.Value) pathValue_, getParentForChildren(), isClean()); pathValue_ = null; } pathValueCase_ = 7; onChanged(); ; return valueBuilder_; } private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.recommender.v1beta1.ValueMatcher, com.google.cloud.recommender.v1beta1.ValueMatcher.Builder, com.google.cloud.recommender.v1beta1.ValueMatcherOrBuilder> valueMatcherBuilder_; /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public boolean hasValueMatcher() { return pathValueCase_ == 10; } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public com.google.cloud.recommender.v1beta1.ValueMatcher getValueMatcher() { if (valueMatcherBuilder_ == null) { if (pathValueCase_ == 10) { return (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_; } return com.google.cloud.recommender.v1beta1.ValueMatcher.getDefaultInstance(); } else { if (pathValueCase_ == 10) { return valueMatcherBuilder_.getMessage(); } return com.google.cloud.recommender.v1beta1.ValueMatcher.getDefaultInstance(); } } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public Builder setValueMatcher(com.google.cloud.recommender.v1beta1.ValueMatcher value) { if (valueMatcherBuilder_ == null) { if (value == null) { throw new NullPointerException(); } pathValue_ = value; onChanged(); } else { valueMatcherBuilder_.setMessage(value); } pathValueCase_ = 10; return this; } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public Builder setValueMatcher( com.google.cloud.recommender.v1beta1.ValueMatcher.Builder builderForValue) { if (valueMatcherBuilder_ == null) { pathValue_ = builderForValue.build(); onChanged(); } else { valueMatcherBuilder_.setMessage(builderForValue.build()); } pathValueCase_ = 10; return this; } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public Builder mergeValueMatcher(com.google.cloud.recommender.v1beta1.ValueMatcher value) { if (valueMatcherBuilder_ == null) { if (pathValueCase_ == 10 && pathValue_ != com.google.cloud.recommender.v1beta1.ValueMatcher.getDefaultInstance()) { pathValue_ = com.google.cloud.recommender.v1beta1.ValueMatcher.newBuilder( (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_) .mergeFrom(value) .buildPartial(); } else { pathValue_ = value; } onChanged(); } else { if (pathValueCase_ == 10) { valueMatcherBuilder_.mergeFrom(value); } valueMatcherBuilder_.setMessage(value); } pathValueCase_ = 10; return this; } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public Builder clearValueMatcher() { if (valueMatcherBuilder_ == null) { if (pathValueCase_ == 10) { pathValueCase_ = 0; pathValue_ = null; onChanged(); } } else { if (pathValueCase_ == 10) { pathValueCase_ = 0; pathValue_ = null; } valueMatcherBuilder_.clear(); } return this; } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public com.google.cloud.recommender.v1beta1.ValueMatcher.Builder getValueMatcherBuilder() { return getValueMatcherFieldBuilder().getBuilder(); } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ public com.google.cloud.recommender.v1beta1.ValueMatcherOrBuilder getValueMatcherOrBuilder() { if ((pathValueCase_ == 10) && (valueMatcherBuilder_ != null)) { return valueMatcherBuilder_.getMessageOrBuilder(); } else { if (pathValueCase_ == 10) { return (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_; } return com.google.cloud.recommender.v1beta1.ValueMatcher.getDefaultInstance(); } } /** * * * <pre> * Can be set for action 'test' for advanced matching for the value of * 'path' field. Either this or `value` will be set for 'test' operation. * </pre> * * <code>.google.cloud.recommender.v1beta1.ValueMatcher value_matcher = 10;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.recommender.v1beta1.ValueMatcher, com.google.cloud.recommender.v1beta1.ValueMatcher.Builder, com.google.cloud.recommender.v1beta1.ValueMatcherOrBuilder> getValueMatcherFieldBuilder() { if (valueMatcherBuilder_ == null) { if (!(pathValueCase_ == 10)) { pathValue_ = com.google.cloud.recommender.v1beta1.ValueMatcher.getDefaultInstance(); } valueMatcherBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.recommender.v1beta1.ValueMatcher, com.google.cloud.recommender.v1beta1.ValueMatcher.Builder, com.google.cloud.recommender.v1beta1.ValueMatcherOrBuilder>( (com.google.cloud.recommender.v1beta1.ValueMatcher) pathValue_, getParentForChildren(), isClean()); pathValue_ = null; } pathValueCase_ = 10; onChanged(); ; return valueMatcherBuilder_; } private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> pathFilters_; private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetPathFilters() { if (pathFilters_ == null) { return com.google.protobuf.MapField.emptyMapField( PathFiltersDefaultEntryHolder.defaultEntry); } return pathFilters_; } private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetMutablePathFilters() { onChanged(); ; if (pathFilters_ == null) { pathFilters_ = com.google.protobuf.MapField.newMapField(PathFiltersDefaultEntryHolder.defaultEntry); } if (!pathFilters_.isMutable()) { pathFilters_ = pathFilters_.copy(); } return pathFilters_; } public int getPathFiltersCount() { return internalGetPathFilters().getMap().size(); } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public boolean containsPathFilters(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } return internalGetPathFilters().getMap().containsKey(key); } /** Use {@link #getPathFiltersMap()} instead. */ @java.lang.Deprecated public java.util.Map<java.lang.String, com.google.protobuf.Value> getPathFilters() { return getPathFiltersMap(); } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public java.util.Map<java.lang.String, com.google.protobuf.Value> getPathFiltersMap() { return internalGetPathFilters().getMap(); } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public com.google.protobuf.Value getPathFiltersOrDefault( java.lang.String key, com.google.protobuf.Value defaultValue) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetPathFilters().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public com.google.protobuf.Value getPathFiltersOrThrow(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetPathFilters().getMap(); if (!map.containsKey(key)) { throw new java.lang.IllegalArgumentException(); } return map.get(key); } public Builder clearPathFilters() { internalGetMutablePathFilters().getMutableMap().clear(); return this; } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public Builder removePathFilters(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } internalGetMutablePathFilters().getMutableMap().remove(key); return this; } /** Use alternate mutation accessors instead. */ @java.lang.Deprecated public java.util.Map<java.lang.String, com.google.protobuf.Value> getMutablePathFilters() { return internalGetMutablePathFilters().getMutableMap(); } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public Builder putPathFilters(java.lang.String key, com.google.protobuf.Value value) { if (key == null) { throw new java.lang.NullPointerException(); } if (value == null) { throw new java.lang.NullPointerException(); } internalGetMutablePathFilters().getMutableMap().put(key, value); return this; } /** * * * <pre> * Set of filters to apply if `path` refers to array elements or nested array * elements in order to narrow down to a single unique element that is being * tested/modified. * This is intended to be an exact match per filter. To perform advanced * matching, use path_value_matchers. * * Example: { * "/versions/&#42;&#47;name" : "it-123" * "/versions/&#42;&#47;targetSize/percent": 20 * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;condition" : null * } * * Example: { * "/bindings/&#42;&#47;role": "roles/admin" * "/bindings/&#42;&#47;members/&#42;" : ["x&#64;google.com", "y&#64;google.com"] * } * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code>map&lt;string, .google.protobuf.Value&gt; path_filters = 8;</code> */ public Builder putAllPathFilters( java.util.Map<java.lang.String, com.google.protobuf.Value> values) { internalGetMutablePathFilters().getMutableMap().putAll(values); return this; } private com.google.protobuf.MapField< java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> pathValueMatchers_; private com.google.protobuf.MapField< java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> internalGetPathValueMatchers() { if (pathValueMatchers_ == null) { return com.google.protobuf.MapField.emptyMapField( PathValueMatchersDefaultEntryHolder.defaultEntry); } return pathValueMatchers_; } private com.google.protobuf.MapField< java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> internalGetMutablePathValueMatchers() { onChanged(); ; if (pathValueMatchers_ == null) { pathValueMatchers_ = com.google.protobuf.MapField.newMapField( PathValueMatchersDefaultEntryHolder.defaultEntry); } if (!pathValueMatchers_.isMutable()) { pathValueMatchers_ = pathValueMatchers_.copy(); } return pathValueMatchers_; } public int getPathValueMatchersCount() { return internalGetPathValueMatchers().getMap().size(); } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public boolean containsPathValueMatchers(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } return internalGetPathValueMatchers().getMap().containsKey(key); } /** Use {@link #getPathValueMatchersMap()} instead. */ @java.lang.Deprecated public java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> getPathValueMatchers() { return getPathValueMatchersMap(); } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> getPathValueMatchersMap() { return internalGetPathValueMatchers().getMap(); } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public com.google.cloud.recommender.v1beta1.ValueMatcher getPathValueMatchersOrDefault( java.lang.String key, com.google.cloud.recommender.v1beta1.ValueMatcher defaultValue) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> map = internalGetPathValueMatchers().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public com.google.cloud.recommender.v1beta1.ValueMatcher getPathValueMatchersOrThrow( java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> map = internalGetPathValueMatchers().getMap(); if (!map.containsKey(key)) { throw new java.lang.IllegalArgumentException(); } return map.get(key); } public Builder clearPathValueMatchers() { internalGetMutablePathValueMatchers().getMutableMap().clear(); return this; } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public Builder removePathValueMatchers(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } internalGetMutablePathValueMatchers().getMutableMap().remove(key); return this; } /** Use alternate mutation accessors instead. */ @java.lang.Deprecated public java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> getMutablePathValueMatchers() { return internalGetMutablePathValueMatchers().getMutableMap(); } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public Builder putPathValueMatchers( java.lang.String key, com.google.cloud.recommender.v1beta1.ValueMatcher value) { if (key == null) { throw new java.lang.NullPointerException(); } if (value == null) { throw new java.lang.NullPointerException(); } internalGetMutablePathValueMatchers().getMutableMap().put(key, value); return this; } /** * * * <pre> * Similar to path_filters, this contains set of filters to apply if `path` * field referes to array elements. This is meant to support value matching * beyond exact match. To perform exact match, use path_filters. * When both path_filters and path_value_matchers are set, an implicit AND * must be performed. * </pre> * * <code> * map&lt;string, .google.cloud.recommender.v1beta1.ValueMatcher&gt; path_value_matchers = 11; * </code> */ public Builder putAllPathValueMatchers( java.util.Map<java.lang.String, com.google.cloud.recommender.v1beta1.ValueMatcher> values) { internalGetMutablePathValueMatchers().getMutableMap().putAll(values); return this; } @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.recommender.v1beta1.Operation) } // @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.Operation) private static final com.google.cloud.recommender.v1beta1.Operation DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.recommender.v1beta1.Operation(); } public static com.google.cloud.recommender.v1beta1.Operation getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Operation> PARSER = new com.google.protobuf.AbstractParser<Operation>() { @java.lang.Override public Operation parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Operation(input, extensionRegistry); } }; public static com.google.protobuf.Parser<Operation> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Operation> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.recommender.v1beta1.Operation getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
[ "chingor@google.com" ]
chingor@google.com
a063ca18855e295581af6c2b7480f07acc032d10
7cd7986d8288c8ac6d4cb62e8db87d181711d27d
/src/bitwise_demo.java
8e64643c95a96f3d1049eb2a04cc60be708ba7b8
[]
no_license
dineshbsomala/codeit_java
bc65e7a9a71ca5a26e9f0d17d82e225869783c66
75f28b7c2cf43f0eacd8e137981dd46b4d1dfb2f
refs/heads/master
2021-01-20T05:34:23.395690
2017-08-26T01:14:46
2017-08-26T01:14:46
101,452,633
0
0
null
null
null
null
UTF-8
Java
false
false
596
java
public class bitwise_demo { public static void main(String[] args) { // TODO Auto-generated method stub int a=10; int b=11; int c=25; System.out.println("a&b is:"+(a&b)); System.out.println("a|b is:"+(a|b)); System.out.println("a^b is :"+(a^b)); int crypt = (c<<2); System.out.println("c is crypted as:"+crypt); System.out.println("a<<2 is:"+(a<<2)); System.out.println("a>>2 is:"+(a>>2)); System.out.println("decrpt:"+(crypt>>2)); } }
[ "dines@Dinesh-PC" ]
dines@Dinesh-PC