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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
96547493eaf2d16ab2efa40fc130f39130bb2ce7 | ee0e6159736e1a0d6f6f70d6aec2ef2db7029e1c | /java/com/warestone_company/NCprojects/java/oop1/Employee.java | f162ddc6e2a89b17aae83dc3a50b515df3e595a9 | [] | no_license | Warestone/Netcracker_projects | d49beb762f243a167ee893e2ec9d14ba5a97c2f4 | e4dba3bc8c6003c5647d03daef2a56496d4114af | refs/heads/main | 2023-02-24T07:06:20.970639 | 2021-02-05T21:50:17 | 2021-02-05T21:50:17 | 320,681,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,100 | java | package com.warestone_company.NCprojects.java.oop1;
import java.util.InputMismatchException;
import java.util.Objects;
public class Employee {
private int id,salary;
private String firstName, lastName;
public Employee(int id, String firstName, String lastName, int salary){
if (id<0) throw new InputMismatchException("ID must be above zero");
if (firstName == null || lastName == null) throw new InputMismatchException("Firstname & lastname is required");
setSalary(salary);
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
public int getId(){
return id;
}
public String getFirstName(){
return firstName;
}
public String getLastName(){
return lastName;
}
public String getName(){
return firstName+' '+lastName;
}
public int getSalary(){
return salary;
}
public void setSalary(int salary){
if (salary>0) this.salary = salary;
else throw new InputMismatchException("Salary must be above zero (Nice joke over workman)");
}
public int getAnnualSalary(){
return salary*12;
}
public int raiseSalary(int percent){
return salary += (salary/100)*percent;
}
@Override
public String toString() {
return "Employee{" + "id=" + id + ", salary=" + salary + ", name='" + firstName + ' ' + lastName + "'}";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Employee employee = (Employee) o;
return this.id == employee.id && this.salary == employee.salary && Objects.equals(this.firstName, employee.firstName) && Objects.equals(this.lastName, employee.lastName);
}
@Override
public int hashCode() {
final int hash = 8;
final int multiplier = 2;
return (hash * multiplier + Objects.hash(firstName, lastName) + id + salary);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
d3f1935c940a3d519668aa1b18f0ec5d69bcfc84 | 9af7173796e0a41fc7d35d954058d9a35d0e88a6 | /src/rider/core/browser/IBrowser.java | ab088d24cce2078c453ad7b12887dedce82972c8 | [] | no_license | rinat/rider | 1838f4673bc9726642f32a00e8f527dbb7ae4639 | 6aa8de66c016c331682ae9c698d654455f9851a1 | refs/heads/master | 2021-01-20T09:41:45.634900 | 2012-02-19T14:33:18 | 2012-02-19T14:33:18 | 3,485,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rider.core.browser;
import rider.view.MIDletThreadSafe;
import javax.microedition.io.ConnectionNotFoundException;
/**
* @author Shaihutdinov Rinat; Mari State University, Yoshkar-Ola 2010; PS-41
*/
public interface IBrowser {
/**
* provider internet browser interface
*
* @param link must be not null
* @param midlet must be not null
* @throws NullPointerException
* @throws ConnectionNotFoundException
*/
void Open(String link, MIDletThreadSafe midlet)
throws NullPointerException, ConnectionNotFoundException;
}
| [
"rinat.shaikhutdinov@gmail.com"
] | rinat.shaikhutdinov@gmail.com |
677ddef2665a7e3b4ba025a5838e80bcf9ece987 | 4119e25833c3ed2f615f6a1fbef90d704dc22c81 | /src/main/java/com/chipsolutions/geotools/catparser/CatRecord16.java | be734096258480a8cb2feb939801b2e54deb8c49 | [] | no_license | lfern/catparser | 7eebd4b5d5438b60a6e5e9dce05f9bd094ffeeb8 | d07a626aa32dfcba226c3c2d3cd5bf8e93610b66 | refs/heads/master | 2021-01-19T09:46:21.934696 | 2017-05-30T08:25:43 | 2017-05-30T08:25:43 | 87,781,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,399 | 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 com.chipsolutions.geotools.catparser;
/**
*
* @author luis
*/
public class CatRecord16 extends CatRecord{
//Identificación del elemento a repartir
public String ieCodigoDelegacionMeh ;
public String ieCodigoMunicipio ;
public String ieParcelaCatastral ;
public String ieNumeroOrdenElementoReparto ;
public String ieCalificacionCatastralSubparcela ;
//Bloque que se repetirá hasta 15 veces
public String brBloqueRepetitivo15 ;
public CatRecord16(){
ieCodigoDelegacionMeh = "";
ieCodigoMunicipio = "";
ieParcelaCatastral = "";
ieNumeroOrdenElementoReparto = "";
ieCalificacionCatastralSubparcela = "";
brBloqueRepetitivo15 = "";
}
@Override
public void parseFromString(String line) throws CatParserException {
ieCodigoDelegacionMeh = line.substring(23,25);
ieCodigoMunicipio = line.substring(25,28);
ieParcelaCatastral = line.substring(30,44);
ieNumeroOrdenElementoReparto = line.substring(44,48);
ieCalificacionCatastralSubparcela = line.substring(48,50);
brBloqueRepetitivo15 = line.substring(50,999);
}
}
| [
"lfern@gmail.com"
] | lfern@gmail.com |
ab8c1e30cbc25e368286f9cc4fda74d0f35aec93 | 26445bdcf7f1cb688bf49cf89e6bbab5b5d33520 | /testData/inspection/UnmappedTargetPropertiesReportPolicyStaticImport.java | 2440a00737f1e3e4f433684f5731d3321292397b | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | mapstruct/mapstruct-idea | f943443096c6c39354f2191984fb455bcb42d189 | 5168fbab259c968771f2944a98eb0187b55f5ade | refs/heads/main | 2023-08-27T05:45:14.343350 | 2023-08-19T08:11:41 | 2023-08-19T08:11:41 | 99,418,951 | 124 | 39 | NOASSERTION | 2023-09-08T22:04:48 | 2017-08-05T11:32:24 | Java | UTF-8 | Java | false | false | 1,571 | java | /*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0
*/
import org.example.data.UnmappedTargetPropertiesData.Target;
import org.example.data.UnmappedTargetPropertiesData.Source;
import org.mapstruct.*;
import static org.mapstruct.ReportingPolicy.ERROR;
@Mapper(unmappedTargetPolicy = ERROR)
interface SingleMappingMapper {
@Mapping(target = "testName", source = "name")
Target <error descr="Unmapped target property: moreTarget">map</error>(Source source);
}
@Mapper(unmappedTargetPolicy = ERROR)
interface NoMappingMapper {
Target <error descr="Unmapped target properties: moreTarget, testName">map</error>(Source source);
@InheritInverseConfiguration
Source reverse(Target target);
}
@MapperConfig(unmappedTargetPolicy = ERROR)
interface AllMappingsMapperConfig {
@Mappings({
@Mapping(target = "testName", source = "name"),
@Mapping(target = "moreTarget", source = "moreSource")
})
Target mapWithAllMappings(Source source);
}
@Mapper(unmappedTargetPolicy = ERROR)
interface UpdateMapper {
@Mapping(target = "moreTarget", source = "moreSource")
void <error descr="Unmapped target property: testName">update</error>(@MappingTarget Target target, Source source);
}
@Mapper(unmappedTargetPolicy = ERROR)
interface MultiSourceUpdateMapper {
void <error descr="Unmapped target property: moreTarget">update</error>(@MappingTarget Target moreTarget, Source source, String testName, @Context String matching);
}
| [
"noreply@github.com"
] | noreply@github.com |
1151192f1347cb1a9ba48a88d911176628925ec4 | 76a8d0e853d5746aab45839869ba904e3433389b | /ggdj/src/com/iotek/dao/impl/orderDaoImpl.java | 50f82c3ac47c41b63e6673224dbcd27cd5e7c59c | [] | no_license | linyong18376778615/test | 346d47581369a75c07d8f4014494263f16a28512 | df0e10760a488427f1b6f06a4860c70432d86d51 | refs/heads/master | 2020-12-03T02:27:24.900129 | 2017-07-01T03:59:40 | 2017-07-01T03:59:40 | 95,940,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,829 | java | package com.iotek.dao.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import com.iotek.dao.orderDao;
import com.iotek.entity.goods;
import com.iotek.entity.order;
import com.iotek.entity.trolley;
import com.iotek.entity.user;
public class orderDaoImpl extends BaseDao implements orderDao {
@Override
//添加订单
public boolean saveOrder(order order) throws Exception{
String sql="insert into oder(orderId,userId,userAddress,price,memo)values(?,?,?,?,?)";
List<Object> params=new ArrayList<Object>();
params.add(order.getOrderId());
params.add(order.getUserId());
params.add(order.getUserAddress());
params.add(order.getPrice());
params.add(order.getMemo());
return this.operUpdate(sql, params);
}
@Override
//删除订单
public boolean delOrder(String orderId) throws Exception{
String sql="delete from oder where orderId=?";
List<Object> params=new ArrayList<Object>();
params.add(orderId);
return this.operUpdate(sql, params);
}
@Override
//查询所有订单
public List<order> queryAllOrder() throws Exception{
String sql="select orderId,userId,userAddress,price,memo,time from oder ";
List<order> oList=null;
try {
oList=this.operQuery(sql, null, order.class);
} catch (Exception e) {
e.printStackTrace();
}
return oList;
}
/*
* 根据用户的ID号查询该用户的所拥有的订单
*/
public List<order> queryUserOrder(int userId) throws Exception{
String sql="select orderId,price,memo,time from oder where userId=?";
List<order> list=new ArrayList<order>();
Connection conn=null;
PreparedStatement pstmt=null;
ResultSet rs=null;
try {
conn= getConnection();
pstmt=conn.prepareStatement(sql);
pstmt.setInt(1,userId);
rs=pstmt.executeQuery();
while(rs.next()){
list.add(load(rs));
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
private order load(ResultSet rs) {
order order=new order();
try{
order.setOrderId(rs.getString(1));
order.setPrice(rs.getDouble(2));
order.setMemo(rs.getString(3));
order.setTime(rs.getTimestamp(4));
}catch(Exception e){
e.printStackTrace();
}
return order;
}
@Override
public order queryOrder(String orderId) throws Exception {
// 根据订单号查询订单表
Connection conn=null;
PreparedStatement pstmt=null;
ResultSet rs=null;
String sql="select * from oder where orderId=?";
try {
conn= getConnection();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,orderId);
rs=pstmt.executeQuery();
if(rs.next()){
load1(rs);
}
} catch (Exception e) {
e.printStackTrace();
}
return load1(rs);
}
private order load1(ResultSet rs) {
order order=new order();
try{
order.setOrderId(rs.getString(1));
order.setUserId(rs.getInt(2));
order.setUserAddress(rs.getString(3));
order.setPrice(rs.getDouble(4));
order.setMemo(rs.getString(5));
order.setTime(rs.getTimestamp(6));
}catch(Exception e){
e.printStackTrace();
}
return order;
}
@Override
//修改订单
public boolean updateOrder(order order) throws Exception{
// TODO Auto-generated method stub
String sql="update oder set price=?,memo=?,userAddress=? where orderId=?";
List<Object> params=new ArrayList<Object>();
params.add(order.getPrice());
params.add(order.getMemo());
params.add(order.getUserAddress());
params.add(order.getOrderId());
return this.operUpdate(sql, params);
}
@Override
//根据用户ID号,日期查询该用户当天的订单
public List<order> queryOrderByUserDate(String date,int userId) throws Exception{
String sql="select * from oder where time like '%"+date+"%' and userId=?";
List<order> list=new ArrayList<order>();
Connection conn=null;
PreparedStatement pstmt=null;
ResultSet rs=null;
try {
conn= getConnection();
pstmt=conn.prepareStatement(sql);
pstmt.setInt(1,userId);
rs=pstmt.executeQuery();
while(rs.next()){
list.add(load1(rs));
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
@Override
public List<order> queryOrderByDate(String date) throws Exception{
// TODO Auto-generated method stub
String sql="select * from oder where time like '%"+date+"%'";
List<order> list=new ArrayList<order>();
Connection conn=null;
PreparedStatement pstmt=null;
ResultSet rs=null;
try {
conn= getConnection();
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
while(rs.next()){
list.add(load1(rs));
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
}
| [
"122548110@qq.com"
] | 122548110@qq.com |
939e4bdf481bad34bdcea3734ee295318630996b | 0416a77aa1eca1b2401551ce9765ba047e11ec7b | /TallerAPedales/Modulo1/src/main/java/org/Modulo1/Taller.java | 33301ecf6fdb7cc5e8b1d283c21c26ee112f95f8 | [] | no_license | Gerole10/JuciyCode | 5d5e60abca7b073361aa102a7b8caeb9673761f3 | e3ec0109d541f118b52fd3b2f167256274bf8b39 | refs/heads/master | 2021-07-13T13:10:25.475229 | 2019-12-02T22:08:13 | 2019-12-02T22:08:13 | 213,679,355 | 2 | 0 | null | 2020-10-13T17:36:20 | 2019-10-08T15:17:38 | Java | UTF-8 | Java | false | false | 639 | java | package org.Modulo1;
public class Taller {
private String nombreTaller;
private Box[] boxes;
public Taller() {
this.nombreTaller= "TallerAPedales";
boxes = new Box[3];
for(int i=0; i<boxes.length; i++) {
boxes[i] = new Box(i);
}
}
public String getNombreTaller() {
return nombreTaller;
}
public void setNombreTaller(String nombreTaller) {
this.nombreTaller = nombreTaller;
}
public Box[] getBoxes() {
return boxes;
}
public Box getBox(int i) {
return boxes[i];
}
public void setBoxes(Box[] boxes) {
this.boxes = boxes;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
7fd3dc9912ffb7e09338f7a587adfe7fe9fd229f | d9ad49c79e941e74e807525c9d11f76fec8fe6c9 | /WarehouseApp/src/main/java/in/nareshit/somu/controller/ShipmentTypeController.java | 70aaee7e6386001b5fb8755d0ecd842ff2427a81 | [] | no_license | saswatmeher05/SpringProjects | 1535902cbc9e04daa059c704bc2df8bec06b2cbd | eb905a11cf8f5584ae452d691acd663012ffaf65 | refs/heads/master | 2023-03-07T08:49:24.706891 | 2021-02-26T12:57:07 | 2021-02-26T12:57:07 | 337,438,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,332 | java | package in.nareshit.somu.controller;
import java.util.List;
import java.util.Optional;
import javax.servlet.ServletContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import in.nareshit.somu.model.ShipmentType;
import in.nareshit.somu.service.IShipmentTypeService;
import in.nareshit.somu.util.ShipmentTypeUtil;
import in.nareshit.somu.view.ShipmentTypeExcelOneView;
import in.nareshit.somu.view.ShipmentTypeExcelView;
import in.nareshit.somu.view.ShipmentTypePdfView;
@Controller
@RequestMapping("/st")
public class ShipmentTypeController {
@Autowired
private IShipmentTypeService service;
@Autowired
private ShipmentTypeUtil util;
@Autowired
private ServletContext sc;
//1.Show register page
@GetMapping("/register")
public String showReg() {
return "ShipmentTypeRegister";
}
//2. on click submit button read form data
@PostMapping("/save")
public String saveShipmentType(@ModelAttribute ShipmentType shipmentType,Model model) {
//call service
Integer id=service.saveShipmentType(shipmentType);
//create message
String message="Shipment Type "+id+" Saved";
//send message to ui
model.addAttribute("message", message);
//go back to same page
return "ShipmentTypeRegister";
}
//3. Display all rows
@GetMapping("/all")
public String showAllShipmentTypes(Model model) {
//call service
List<ShipmentType> list = service.getAllShipmentTypes();
//send data to ui
model.addAttribute("list",list);
//go back to ui;
return "ShipmentTypeData";
}
//4. Delete by id
@GetMapping("/delete")
public String deleteShipmentType(
@RequestParam("id")Integer sid, Model model
)
{
if(service.isShipmentTypeExist(sid)) {
//call service
service.deleteShipmentType(sid);
//create message
String message=new StringBuffer() .append("Shipment Type '")
.append(sid) .append("' Deleted").toString();
//send data to ui
model.addAttribute("message",message);
} else {
model.addAttribute("message",sid+" Not Found!");
}
//latest data
model.addAttribute("list", service.getAllShipmentTypes());
return "ShipmentTypeData";
}
//5. show edit page
@GetMapping("/edit")
public String showShipmentTypeEdit(
@RequestParam("id")Integer sid,
Model model
){
String page="null";
//call service
Optional<ShipmentType> opt=service.getOneShipmentType(sid);
if(opt.isPresent()) {
model.addAttribute("shipmentType",opt.get());
page="ShipmentTypeEdit";
}else {
page="redirect:all";
}
return page;
}
//6. update ShipmentType
@PostMapping("/update")
public String doUpdateShipmentType(
@ModelAttribute ShipmentType shipmentType,Model model
) {
//call service to update
service.saveShipmentType(shipmentType);
//send message to ui
model.addAttribute("message","ShipmentType '"+shipmentType.getId() +"' Updated");
//call service layer for latest data
List<ShipmentType> list=service.getAllShipmentTypes();
//send data to ui
model.addAttribute("list", list);
//go back to ui page
return "ShipmentTypeData";
}
//7.AJAX Validation
//8.Excel Export
@GetMapping("/excel")
public ModelAndView showExcelExport() {
//fetch data(all rows) from database
List<ShipmentType> list=service.getAllShipmentTypes();
//create ModelAndView object
ModelAndView m=new ModelAndView();
m.addObject("list", list);
m.setView(new ShipmentTypeExcelView());
//return model and view
return m;
}
//9.Excel Export One View
@GetMapping("/excelone")
public ModelAndView showExcelOneExport(
@RequestParam("id")Integer sid
) {
//fetch data from database
Optional<ShipmentType> opt=service.getOneShipmentType(sid);
//create ModelAndView object
ModelAndView m=new ModelAndView();
m.addObject("st", opt.get());
m.setView(new ShipmentTypeExcelOneView());
//return model and view
return m;
}
//10.pdf export
@GetMapping("/pdf")
public ModelAndView exportToPdf() {
//fetch data from database
List<ShipmentType> list=service.getAllShipmentTypes();
//create ModelAndView
ModelAndView m=new ModelAndView();
m.addObject("list",list);
m.setView(new ShipmentTypePdfView());
return m;
}
//11. Charts generation
@GetMapping("/charts")
public String showCharts() {
// call service for data
List<Object[]> list =
service.getShipmentTypeModeCount();
// dynamic path inside server(runtime location)
String path = sc.getRealPath("/"); //root location
System.out.println("Runtime location=>" + path);
// call util method for generation
util.generatePieChart(path, list);
util.generateBarChart(path, list);
return "ShipmentTypeCharts.html";
}
}
| [
"saswa@DESKTOP-0F3M21B"
] | saswa@DESKTOP-0F3M21B |
f103ed1b8199e5479fc38a114a4374fe22c14cd4 | 7f14df5c7c5bc6175db1ea9f1d9b66c39142a006 | /src/test/java/eu/redzoo/article/javaworld/http2/HighLevelHttp2ClientTest.java | 8f311fe7349090046d6235a180a25c61aa6d37ae | [
"Apache-2.0"
] | permissive | rongfengliang/http2 | 3295ee5d4f3308e11d178ad432dbe2bdb3ea98b7 | c225360650c542df6122883d40d57e9e6a76f820 | refs/heads/master | 2021-05-30T23:48:25.537803 | 2015-06-15T08:37:15 | 2015-06-15T08:37:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,506 | java | /*
* Copyright (c) 2015 Gregor Roth
*
* 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 eu.redzoo.article.javaworld.http2;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
import org.junit.Assert;
import org.junit.Test;
@SuppressWarnings("serial")
public class HighLevelHttp2ClientTest {
@Test
public void highLevelApiTest() throws Exception {
// start the test server
class MyServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.getOutputStream().write("...my body data...".getBytes());
}
};
WebServer server = WebServer.servlet(new MyServlet())
.start();
// create a low-level jetty HTTP/2 client
HTTP2Client lowLevelClient = new HTTP2Client();
lowLevelClient.start();
// create a high-level jetty HTTP/2 client
HttpClient client = new HttpClient(new HttpClientTransportOverHTTP2(lowLevelClient), null);
client.start();
// and perform the http transaction
ContentResponse response = client.GET("http://localhost:" + server.getLocalport());
System.out.println(response.getVersion() + " " + response.getStatus() + " ");
Assert.assertEquals("...my body data...", new String(response.getContent()));
// shut down the client and server
client.stop();
server.stop();
}
}
| [
"gregor.roth@web.de"
] | gregor.roth@web.de |
8e47a713d812cc0939ebeef44f23b5ac9cb710b0 | f40a9ea8fcc5cf34e132181aed9076978161dc45 | /l2-tools/groundworks/src/oliver/tree/treetable/AbstractCellEditor.java | a9a305f34275f7d62851cc69e37db6676f7715a5 | [] | no_license | azeroman/Livingstone-2 | 7cb7373e58457ab09f979a966eed2ae043285dee | c422a8264900860ff6255c676e254004766486ec | refs/heads/master | 2022-04-12T20:35:36.050943 | 2020-04-08T14:58:50 | 2020-04-08T14:58:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,229 | java | //
// * See the file "l2-tools/disclaimers-and-notices.txt" for
// * information on usage and redistribution of this file,
// * and for a DISCLAIMER OF ALL WARRANTIES.
//
package oliver.tree.treetable;
import java.awt.Component;
import java.awt.event.*;
import java.awt.AWTEvent;
import javax.swing.*;
import javax.swing.event.*;
import java.util.EventObject;
import java.io.Serializable;
public class AbstractCellEditor implements CellEditor {
protected EventListenerList listenerList = new EventListenerList();
public Object getCellEditorValue() { return null; }
public boolean isCellEditable(EventObject e) { return true; }
public boolean shouldSelectCell(EventObject anEvent) { return false; }
public boolean stopCellEditing() { return true; }
public void cancelCellEditing() {}
public void addCellEditorListener(CellEditorListener l) {
listenerList.add(CellEditorListener.class, l);
}
public void removeCellEditorListener(CellEditorListener l) {
listenerList.remove(CellEditorListener.class, l);
}
/*
* Notify all listeners that have registered interest for
* notification on this event type.
* @see EventListenerList
*/
protected void fireEditingStopped() {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==CellEditorListener.class) {
((CellEditorListener)listeners[i+1]).editingStopped(new ChangeEvent(this));
}
}
}
/*
* Notify all listeners that have registered interest for
* notification on this event type.
* @see EventListenerList
*/
protected void fireEditingCanceled() {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==CellEditorListener.class) {
((CellEditorListener)listeners[i+1]).editingCanceled(new ChangeEvent(this));
}
}
}
}
| [
"kbshah1998@outlook.com"
] | kbshah1998@outlook.com |
18ee49466d472b9d42fadf8062324f559d017455 | 329b2cb3c91a0c953458efd253c4fcdce6f539c4 | /graphsdk/src/main/java/com/microsoft/graph/extensions/WorkbookFunctionsTrimMeanRequestBuilder.java | 87837a70282db265c020f6685018e137a8a5bac8 | [
"MIT"
] | permissive | sbolotovms/msgraph-sdk-android | 255eeddf19c1b15f04ee3b1549f0cae70d561fdd | 1320795ba1c0b5eb36ef8252b73799d15fc46ba1 | refs/heads/master | 2021-01-20T05:09:00.148739 | 2017-04-28T23:20:23 | 2017-04-28T23:20:23 | 89,751,501 | 1 | 0 | null | 2017-04-28T23:20:37 | 2017-04-28T23:20:37 | null | UTF-8 | Java | false | false | 1,521 | java | // ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.extensions;
import com.microsoft.graph.concurrency.*;
import com.microsoft.graph.core.*;
import com.microsoft.graph.extensions.*;
import com.microsoft.graph.http.*;
import com.microsoft.graph.generated.*;
import com.microsoft.graph.options.*;
import com.microsoft.graph.serializer.*;
import java.util.Arrays;
import java.util.List;
// This file is available for extending, afterwards please submit a pull request.
/**
* The class for the Workbook Functions Trim Mean Request Builder.
*/
public class WorkbookFunctionsTrimMeanRequestBuilder extends BaseWorkbookFunctionsTrimMeanRequestBuilder implements IWorkbookFunctionsTrimMeanRequestBuilder {
/**
* The request builder for this WorkbookFunctionsTrimMean
*
* @param requestUrl The request url
* @param client The service client
* @param requestOptions The options for this request
*/
public WorkbookFunctionsTrimMeanRequestBuilder(final String requestUrl, final IBaseClient client, final List<Option> requestOptions, final com.google.gson.JsonElement array, final com.google.gson.JsonElement percent) {
super(requestUrl, client, requestOptions, array, percent);
}
}
| [
"brianmel@microsoft.com"
] | brianmel@microsoft.com |
1748c123069471c43a74c44b647c97de81c0c691 | 27f0a9ee89197fb697f7f22d358a4695a1f0c246 | /service/service_vod/src/main/java/com/dwl/service_vod/entity/from/UploadFileFrom.java | b4000c2c4e50b395daf703667d2e8092a7b5b949 | [] | no_license | duweibaolei/guli_parent | cc11b74765bcf942ce8ac06f92fe62fafc86963a | 8e0e15bed22f9a7a682de146398c9ccbf5b7e38c | refs/heads/master | 2023-03-17T14:23:36.759987 | 2021-03-14T10:02:33 | 2021-03-14T10:02:33 | 313,196,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,699 | java | package com.dwl.service_vod.entity.from;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 文件上传实体类
*/
@ApiModel("文件上传实体类")
@Data
public class UploadFileFrom {
/**
* 阿里云ossAccessKeyId
*/
@ApiModelProperty(value = "阿里云ossAccessKeyId")
private String accessKeyId;
/**
* 阿里云oss密钥
*/
@ApiModelProperty(value = "阿里云oss密钥")
private String accessKeySecret;
/**
* 文件标题
*/
@ApiModelProperty(value = "文件标题")
private String title;
/**
* 文件名称
*/
@ApiModelProperty(value = "文件名称")
private String fileName;
/**
* 是否使用默认水印(可选),指定模板组ID时,根据模板组配置确定是否使用默认水印
*/
@ApiModelProperty(value = "是否使用默认水印(可选),指定模板组ID时,根据模板组配置确定是否使用默认水印")
private boolean showWaterMark;
/**
* 自定义消息回调设置,参数说明参考文档 https://help.aliyun.com/document_detail/86952.html#UserData
*/
@ApiModelProperty(value = "自定义消息回调设置,参数说明参考文档 https://help.aliyun.com/document_detail/86952.html#UserData")
private String UserData;
/**
* 视频分类ID(可选)
*/
@ApiModelProperty(value = "视频分类ID(可选)")
private Long cateId;
/**
* 视频标签,多个用逗号分隔(可选)
*/
@ApiModelProperty(value = "视频标签,多个用逗号分隔(可选)")
private String tags;
/**
* 视频描述(可选)
*/
@ApiModelProperty(value = "视频描述(可选)")
private String description;
/**
* 封面图片(可选)
*/
@ApiModelProperty(value = "封面图片(可选)")
private String coverURL;
/**
* 模板组ID(可选)
*/
@ApiModelProperty(value = "模板组ID(可选)")
private String templateGroupId;
/**
* 工作流ID(可选)
*/
@ApiModelProperty(value = "工作流ID(可选)")
private String workflowId;
/**
* 存储区域(可选)
*/
@ApiModelProperty(value = "存储区域(可选)")
private String storageLocation;
/**
* 应用ID(可选)
*/
@ApiModelProperty(value = "应用ID(可选)")
private String appId;
/**
* 点播服务接入点
*/
@ApiModelProperty(value = "点播服务接入点")
private String apiRegionId;
/**
* ECS部署区域
*/
@ApiModelProperty(value = "ECS部署区域")
private String ecsRegionId;
}
| [
"849639984@qq.com"
] | 849639984@qq.com |
592d0ce528dcce821fe3f07682462c0127fb996b | 6f2d09698a0f660924512121640096e475061c89 | /app/src/main/java/com/firstappandroid/nativeandroidcodemagic/FirstFragment.java | d3514bd25922983f074ab32ec66bcca0dcee65cc | [] | no_license | icarusdust/native-android-codemagic | 3a86b916d7772de28aa021e9d02119a25db748f3 | ad35eb62f0e5fd6ff877f7f520862449f265875b | refs/heads/master | 2023-06-02T18:56:02.858638 | 2021-06-24T14:22:15 | 2021-06-24T14:22:15 | 379,377,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,316 | java | package com.firstappandroid.nativeandroidcodemagic;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.firstappandroid.nativeandroidcodemagic.databinding.FragmentFirstBinding;
public class FirstFragment extends Fragment {
private FragmentFirstBinding binding;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentFirstBinding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.buttonFirst.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(FirstFragment.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment);
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
} | [
"nihalagazade@gmail.com"
] | nihalagazade@gmail.com |
1571c3a1b6f9942651685fa62c93b0e23c753a9d | b98b04b03b49eba133a3cb44ee4c9096054aed38 | /collector/src/main/java/com/bfxy/collector/web/IndexCollector.java | cb16f92c83afcde744e87e7aeef6d89e10311490 | [] | no_license | zhaojh0610/kafak | eb899bc0d614f3ff2ec64e04905688e5c4d94dae | af0cd525dd7ccadffa3a0c7d82dd6dd436d35b59 | refs/heads/master | 2023-01-03T04:07:43.758287 | 2020-11-01T12:22:27 | 2020-11-01T12:22:27 | 293,462,608 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,070 | java | package com.bfxy.collector.web;
import com.bfxy.collector.util.InputMDC;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zhaojh
* @date 2020/10/31 12:47
*/
@RestController
@Slf4j
public class IndexCollector {
/**
* [%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ}]
* [%level{length=5}]
* [%thread-%tid]
* [%logger]
* [%X{hostName}]
* [%X{ip}]
* [%X{applicationName}]
* [%F,%L,%C,%M]
* [%m] ## '%ex'%n
*
* @return
*/
@RequestMapping(value = "/index")
public String index() {
InputMDC.putMDC();
log.info("我是一条info日志");
log.warn("我是一条warn日志");
log.error("我是一条error日志");
return "idx";
}
@RequestMapping("/err")
public String error() {
try {
int i = 1 / 0;
} catch (Exception exception) {
log.error("算术异常");
}
return "error";
}
}
| [
"zhaojh0610@163.com"
] | zhaojh0610@163.com |
9b760553ca4f0407ff81848fbf09150ee827c285 | 087fc3e084171dbc2d72356378292a561be690e5 | /src/ast/expressions/Identifier.java | 587c3fc51f16fdc576ce23d38b7d24186a867353 | [] | no_license | inzize/streamit-tae | c165a29f7a6185b069f5bdf1772ed83d8772865b | 2ba51e0fa73be6804bcb2c64300e26c49f9f654a | refs/heads/master | 2021-01-19T04:24:32.111007 | 2016-08-11T04:52:56 | 2016-08-11T04:52:56 | 65,161,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,965 | java | package ast.expressions;
import ast.AbstractCode;
import ast.Decl;
import ast.members.Function;
import ast.statements.VarDecl;
import ast.Program;
import ast.types.Type;
import hierarchicalGraph.FilterInstance;
public class Identifier extends Expression0
{
String name;
public Decl declaration;
public Identifier(String name)
{
this.name = name;
}
@Override
public void Print()
{
if (declaration != null)
if (GenerateC)
writer.print("("+declaration.Name()+")"); //Don't trust this line
else
writer.print(declaration.Name()); //() doesn't work for function calls like sin() -> (sin)() <-
else
writer.print(name);
}
@Override
public Type AnalyseExpression(AbstractCode parent)
{
this.parent = parent;
if ("pi".equals(name))
declaration = Program.pi;
else
declaration = Resolve(name);
// just for debugging
//if (declaration == null)
// declaration = Resolve(name);
return type = ((VarDecl)declaration).type;
}
@Override
public Function AnalyseFunction(AbstractCode parent)
{
this.parent = parent;
declaration = parent.ResolveFunction(name);
return (Function)declaration;
}
@Override
public int AnalyseConstant(AbstractCode parent, FilterInstance filter)
{
AnalyseExpression(parent);
Expression value = ((VarDecl)declaration).value;
if (value != null)
return value.AnalyseConstant(parent, filter);
else
{
for (int i=0; i< filter.filter.params.size(); i++)
if (filter.filter.params.get(i) == declaration)
return (int)filter.args[i];
throw new UnsupportedOperationException("Can't resolve array size" + declaration.Name());
}
}
}
| [
"pongsena@hotmail.com"
] | pongsena@hotmail.com |
653db44a7caf6385461ed5e21f7b8d94e626c0c5 | ba552bd81c3785bff1fd584f1c30846aac4a4da5 | /source/javaservletprogramming/src/chr08/ProtectedResourceServlet.java | 857fff6650f91047ae9022dff889e406fb69c283 | [] | no_license | closing/mydatabase | fe56dd3d43db296ef561ff3106f1bff34d6bd880 | 5730293d916a2a69028ce2bddb1caeb971656140 | refs/heads/master | 2021-05-12T06:13:42.540175 | 2019-04-10T00:34:28 | 2019-04-10T00:34:28 | 117,212,682 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package chr08;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpUtils;
public class ProtectedResourceServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
// Get the session
HttpSession session = req.getSession();
// Does the session indicate this user already logged in?
Object done = session.getAttribute("logon.isDone"); // marker object
if (done == null) {
// No logon.isDone means she hasn't logged in.
// Save the request URL as the true target and redirect to the login page.
session.setAttribute("login.target", HttpUtils.getRequestURL(req).toString());
res.sendRedirect("/example/chr08/login.html");
return;
}
// If we get here, the user has logged in and can see the goods
out.println("Unpublished O'Reilly book manuscripts await you!");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
710fe469d22cf2dbc2e6db38982edeb67ac54500 | 55e97145f7f906f977b35636e7f3a19fd17c995a | /src/ast/ActualPar.java | 0749617d2806a818621af21d2ea61efb0d665a1a | [] | no_license | brunocarneiro/obe-compiler | 57a9ebda7047ebada08c717d638d3f658a18a6a7 | 62863f33f9b6c1e61044bfda1175d3484f44fe1f | refs/heads/master | 2016-09-02T02:37:14.976371 | 2011-09-28T02:30:57 | 2011-09-28T02:30:57 | 2,472,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package ast;
import java.util.List;
import static util.WriterHelper.getTabulacao;
public class ActualPar extends Node {
private List<Expression> expressions;
public List<Expression> getExpressions() {
return expressions;
}
public void setExpressions(List<Expression> expressions) {
this.expressions = expressions;
}
public ActualPar(List<Expression> expressions) {
super();
this.expressions = expressions;
}
@Override
public String toString() {
return getTabulacao()+"ActualPar: " +expressions.toString();
}
}
| [
"bj.carneiro@gmail.com"
] | bj.carneiro@gmail.com |
f65461e5acd99f8dbdac606fcd36838e75aec86e | 025d7aed9f7b5a2829c97fcbf387b2c47043516d | /src/club/AddClubIntroduction.java | 6ff13beb0a97f31bc45286e7a6c2fbcf6f3d848d | [] | no_license | LZ0616/ECLUBS | 71ff157ec205931093486629f014c85fdd86ec12 | c17e83c4857e05ec6dfc297cdd2d30f5dac5c1e1 | refs/heads/master | 2020-06-24T09:16:55.018036 | 2019-07-26T09:02:33 | 2019-07-26T09:18:39 | 198,926,567 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,964 | java | package club;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
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 javax.servlet.http.HttpSession;
import exper.DBHelper;
/**
* Servlet implementation class AddClubIntroduction
*/
@WebServlet("/AddClubIntroduction")
public class AddClubIntroduction extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AddClubIntroduction() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("utf-8");
HttpSession session = request.getSession(true);
String account;
account=(String)session.getAttribute("account");
String sname =null;
String cname = String.valueOf(request.getParameter("cname"));
String master = String.valueOf(request.getParameter("master"));
String time = String.valueOf(request.getParameter("time"));
String intro = String.valueOf(request.getParameter("intro"));
String rules = String.valueOf(request.getParameter("rules"));
try {
Connection conn = new DBHelper().getConn();
ResultSet rs = null;
String sql1 = "select * from club_info where cname=?";
PreparedStatement pstmt=conn.prepareStatement(sql1);
pstmt.setString(1, cname);
rs = pstmt.executeQuery();
if(rs.next()){
request.setAttribute("error","注册失败!社团名已被占用,请重新输入社团名!");
request.getRequestDispatcher("AddClub.jsp").forward(request,response);
}
int sum = 0;
String sql = "select count(*) from club_info";
try {
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next()) {
sum += rs.getInt(1);
}
} catch (Exception e) {
e.printStackTrace();
}
sql="select sname from student where account='"+account+"'";
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
if(rs.next()){
sname=rs.getString("sname");
}
sql = "insert into club_info(id,cname,master,time,intro,rules) values(?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, sum+1);
pstmt.setString(2, cname);
pstmt.setString(3, master);
pstmt.setString(4, time);
pstmt.setString(5, intro);
pstmt.setString(6, rules);
pstmt.execute();
int sum1=0;
sql="select count(*) from club_member";
try{
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
while(rs.next()){
sum1+=rs.getInt(1);
}
}catch (Exception e){
e.printStackTrace();
}
sql="insert into club_member(id,cid,cname,master,account,pos,date) values(?,?,?,?,?,?,?,?)";
pstmt=conn.prepareStatement(sql);
pstmt.setInt(1, sum1+1);
pstmt.setInt(2, sum+1);
pstmt.setString(3, cname);
pstmt.setString(4, master);
pstmt.setString(5, account);
pstmt.setString(6, sname);
pstmt.setString(7, "社长");
pstmt.setString(8, time);
pstmt.execute();
rs.close();
pstmt.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
request.getRequestDispatcher("ListClubServlet").forward(request, response);
}
}
| [
"740562234@qq.com"
] | 740562234@qq.com |
e4b0cf03539a5bce7ebdd1207e1752ed7bace099 | 3c0fd00c3ed98b3d61ba76984e3b7425e7b3a45d | /aad/src/main/java/com/jex/aad/support/viewpager/transforms/RotateDownTransformer.java | 1762de0d7de98e98c17eb7fa552af26ce632dc55 | [] | no_license | JexLib/JexAAd | 2d879f33f1f01bb0db4a766d3f4557101a0a67f6 | abf321653b13737e61e75cd4a4d02f160cddc6c9 | refs/heads/master | 2021-07-10T06:31:02.062337 | 2017-10-06T15:08:19 | 2017-10-06T15:08:19 | 106,016,648 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | /*
* Copyright 2014 Toxic Bakery
*
* 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.jex.aad.support.viewpager.transforms;
import android.view.View;
public class RotateDownTransformer extends ABaseTransformer {
private static final float ROT_MOD = -15f;
@Override
protected void onTransform(View view, float position) {
final float width = view.getWidth();
final float height = view.getHeight();
final float rotation = ROT_MOD * position * -1.25f;
view.setPivotX(width * 0.5f);
view.setPivotY(height);
view.setRotation(rotation);
}
@Override
protected boolean isPagingEnabled() {
return true;
}
}
| [
"Justin Huang"
] | Justin Huang |
8370395bcd023d1d805b8ddd7898c9dbce2f8dda | 78e041d66650c4dc7bf481a2b7a461e14a7bf25d | /divergents/divergents-common/src/main/java/com/sih/msde/divergents/controller/FeedbackController.java | 50923ea15c8afb627d00dd4c9869b26f4772c154 | [] | no_license | ruchipareek5/team-divergents | 45d6aee5c4baa1bcc5f84cea4d51e2009409219f | d987c3c0a9f79d54eec673bf45090a1896858623 | refs/heads/master | 2021-04-15T10:00:18.225365 | 2018-07-03T12:12:05 | 2018-07-03T12:12:05 | 126,136,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,347 | java | package com.sih.msde.divergents.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.sih.msde.divergents.dto.FeedbackDto;
import com.sih.msde.divergents.service.FeedbackService;
import ch.qos.logback.classic.Logger;
@RestController
public class FeedbackController {
@Autowired
private FeedbackService feedbackService;
@RequestMapping(value="/submitFeedback",method=RequestMethod.POST,consumes=MediaType.ALL_VALUE)
public Integer submitthefeedback(@RequestParam("name") String name, @RequestParam("aadharnumber") String aadharnumber, @RequestParam("email") String email, @RequestParam("suggestion") String suggestion){
FeedbackDto feedbackDto = new FeedbackDto(name,aadharnumber,email,suggestion);
feedbackDto.setName(name);
feedbackDto.setAadharnumber(aadharnumber);
feedbackDto.setEmail(email);
feedbackDto.setSuggestion(suggestion);
return feedbackService.submitFeedback(feedbackDto);
}
}
| [
"priyanka@smaltandberyl.com"
] | priyanka@smaltandberyl.com |
fe4d669d4acf044da707dd034da37401f1182d53 | df98f849e437f37cbea3cda5979343e6962f525e | /src/main/java/pl/sda/advanced/oop2/OOP2.java | bf2090e55162c99d06ab35f426b5b5bef80d0255 | [] | no_license | maciejgruba/Advanced31 | 9516fa17e7051d5f0dc4629379b4f70be6f37e54 | f0e9ab908ef67730a16d45cf36d0738401fc2867 | refs/heads/master | 2022-11-30T12:44:27.944676 | 2020-08-07T17:20:22 | 2020-08-07T17:20:22 | 281,467,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,443 | java | package pl.sda.advanced.oop2;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.Arrays;
public class OOP2 {
public static void main(String[] args) {
personBasics();
Polymorfizm();
interfaces();
Countries poland = Countries.POLAND; // instancja enuma - obiekt Poland
System.out.println(poland.name());
System.out.println(poland.toString());
System.out.println(poland); // toString jest domyslnie odpalany
Countries[] values = Countries.values();
System.out.println(Arrays.toString(values));// wyswietlenie w tablicy
String polandText = "Poland";
Countries countries = Countries.valueOf(polandText.toUpperCase());
System.out.println(countries); // mozna go wylapac ze stringa
}
private static void interfaces() {
ageHolder studentPerson1 = new Student("Jan", "Kowalski", BigDecimal.valueOf(200), Countries.POLAND);
ageHolder dog = new Dog(5);
ageHolder[] ageHolders = new ageHolder[]{studentPerson1, dog};
for (ageHolder ageHolder : ageHolders) {
System.out.println(ageHolder.getAge());
}
}
private static void Polymorfizm() {
Person studentPerson = new Student("Jan", "Kowalski", BigDecimal.valueOf(200), Countries.POLAND);
Person workerPerson = new Worker("Kuba", "Nowak", BigDecimal.valueOf(5000), Countries.POLAND);
printIncome(studentPerson);
printIncome(workerPerson);
Person[] people = new Person[]{studentPerson, workerPerson};
for (int i = 0; i < people.length; i++) {
Person person = people[i];
String name = person.introduceMyself();
System.out.println(name);
if (person instanceof Student) { // sprawdzanie czy obiekt na ktory wskazuje zmienna jest typu student
BigDecimal moneyFromMum = ((Student) person).getMoneyFromMum();// jezeli jest to mozemy rzutowac ( Student)
System.out.println(moneyFromMum);
}
if (person instanceof Worker) {
BigDecimal moneyFromWork = ((Worker) person).getMoneyFromWork();
System.out.println(moneyFromWork);
}
}
}
// przyklad przypisania studenta/workera do klasy Person(zduplikowany kod)
// public static void printIncome(Student student){
// System.out.println(student.getIncome());
// }
// public static void printIncome(Worker worker){
// System.out.println(worker.getIncome());
// }
public static void printIncome(Person person) {
System.out.println(person.getIncome() + "tu");
}
private static void personBasics() {
Student student = new Student("Jan", "Kowalski", BigDecimal.valueOf(200), Countries.POLAND);
Worker worker = new Worker("Kuba", "Nowak", BigDecimal.valueOf(5000), Countries.POLAND);
// Person person = new Person("Jakiś", "Człowiek");// nie da sie utworzyc obiektu klasy abstrakcyjnej
System.out.println(student);
System.out.println(worker);
System.out.println(student.introduceMyself());
System.out.println(worker.introduceMyself());
System.out.println(student.getIncome());
System.out.println(worker.getIncome());
System.out.println(student.getMoneyFromMum());
System.out.println(worker.getMoneyFromWork());
}
}
| [
"gruba.maciej@gmail.com"
] | gruba.maciej@gmail.com |
1c3cd97b4a5750e88fb651cb682c2bcf2511cc4a | 25820da6b91f8b270fd9490f1de013d7207388d2 | /graph-dc/graph-dc-core/src/main/java/com/haizhi/graph/dc/core/bean/SchemaField.java | 512d4a5f7bd5374e9f9da02146649e803a2089db | [] | no_license | Joegxx/graphplatform | d784da9d5475a84d836974474bc00263b06a4ad0 | b9341937406f5cfc946ded3ecac5126114c977c0 | refs/heads/master | 2022-04-01T14:01:43.466782 | 2019-10-15T16:27:41 | 2019-10-15T16:27:41 | 272,382,227 | 0 | 1 | null | 2020-06-15T08:24:19 | 2020-06-15T08:24:18 | null | UTF-8 | Java | false | false | 1,277 | java | package com.haizhi.graph.dc.core.bean;
import com.haizhi.graph.common.constant.FieldType;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Created by chengmo on 2018/1/17.
*/
@Data
@NoArgsConstructor
public class SchemaField implements Serializable {
private long graphId;
private String graphName;
private long schemaId;
private String schemaName;
private String field;
private String fieldCnName;
private FieldType type;
private boolean useSearch;
private boolean useGraphDb;
private boolean isMain;
private float searchWeight = 1.0F;
public SchemaField(String schemaName, String field, String fieldCnName, FieldType type, boolean useSearch) {
this.schemaName = schemaName;
this.field = field;
this.fieldCnName = fieldCnName;
this.type = type;
this.useSearch = useSearch;
}
public SchemaField(String schemaName, String field, String fieldCnName, FieldType type, boolean useSearch, float
searchWeight) {
this.schemaName = schemaName;
this.field = field;
this.fieldCnName = fieldCnName;
this.type = type;
this.useSearch = useSearch;
this.searchWeight = searchWeight;
}
}
| [
"geektcp@163.com"
] | geektcp@163.com |
dd7bbb01dc05e2feb2678b90bbfb74141b6548a1 | 3f7e62870f1fdd1c65649ae8efc3502390462478 | /pongeService/src/hr/ponge/pfa/axis/core/operations/UpdateDocumentResp.java | f2da12ece8de29773f424721a5a20917f2f4c15d | [] | no_license | krunoslav/pongePFA | 1f046542f00e3c7f10828e08228abd5bb956019a | abf33c09b23c97db51fbdd9c085899def2204196 | refs/heads/master | 2021-01-23T04:09:28.657930 | 2014-10-14T15:53:14 | 2014-10-14T15:53:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,692 | java | package hr.ponge.pfa.axis.core.operations;
/**
* UpdateDocumentResp bean class
*/
@java.lang.SuppressWarnings(value = {"unchecked" ,"unused"})
public class UpdateDocumentResp implements hr.ponge.pfa.service.core.document.UpdateDocumentRespDTO , org.apache.axis2.databinding.ADBBean {
/**
* field for Document
*/
protected hr.ponge.pfa.axis.core.Document localDocument;
protected boolean localDocumentTracker = false;
public boolean isDocumentSpecified() {
return localDocumentTracker;
}
/**
* Auto generated getter method
* @return hr.ponge.pfa.axis.core.Document
*/
public hr.ponge.pfa.axis.core.Document getDocument() {
return localDocument;
}
/**
* Auto generated setter method
* @param param Document
*/
public void setDocument(hr.ponge.pfa.axis.core.Document param) {
localDocumentTracker = param != null;
this.localDocument = param;
}
/**
* field for Errors
* This was an Array!
*/
protected hr.ponge.pfa.axis.base.ErrorType[] localErrors;
protected boolean localErrorsTracker = false;
public boolean isErrorsSpecified() {
return localErrorsTracker;
}
/**
* Auto generated getter method
* @return hr.ponge.pfa.axis.base.ErrorType[]
*/
public hr.ponge.pfa.axis.base.ErrorType[] getErrors() {
return localErrors;
}
/**
* validate the array for Errors
*/
protected void validateErrors(hr.ponge.pfa.axis.base.ErrorType[] param) {
}
/**
* Auto generated setter method
* @param param Errors
*/
public void setErrors(hr.ponge.pfa.axis.base.ErrorType[] param) {
validateErrors(param);
localErrorsTracker = param != null;
this.localErrors = param;
}
/**
* Auto generated add method for the array for convenience
* @param param hr.ponge.pfa.axis.base.ErrorType
*/
public void addErrors(hr.ponge.pfa.axis.base.ErrorType param) {
if ((localErrors) == null) {
localErrors = new hr.ponge.pfa.axis.base.ErrorType[]{ };
}
localErrorsTracker = true;
java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(localErrors);
list.add(param);
this.localErrors = ((hr.ponge.pfa.axis.base.ErrorType[])(list.toArray(new hr.ponge.pfa.axis.base.ErrorType[list.size()])));
}
/**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException {
org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this , parentQName);
return factory.createOMElement(dataSource ,parentQName);
}
public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException {
serialize(parentQName ,xmlWriter ,false);
}
public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException {
java.lang.String prefix = null;
java.lang.String namespace = null;
prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix ,namespace ,parentQName.getLocalPart() ,xmlWriter);
if (serializeType) {
java.lang.String namespacePrefix = registerPrefix(xmlWriter ,"http://ponge.hr/pfa/axis/core/operations");
if ((namespacePrefix != null) && ((namespacePrefix.trim().length()) > 0)) {
writeAttribute("xsi" ,"http://www.w3.org/2001/XMLSchema-instance" ,"type" ,(namespacePrefix + ":UpdateDocumentResp") ,xmlWriter);
} else {
writeAttribute("xsi" ,"http://www.w3.org/2001/XMLSchema-instance" ,"type" ,"UpdateDocumentResp" ,xmlWriter);
}
}
if (localDocumentTracker) {
if ((localDocument) == null) {
throw new org.apache.axis2.databinding.ADBException("document cannot be null!!");
}
localDocument.serialize(new javax.xml.namespace.QName("http://ponge.hr/pfa/axis/core/operations" , "document") ,xmlWriter);
}
if (localErrorsTracker) {
if ((localErrors) != null) {
for (int i = 0 ; i < (localErrors.length) ; i++) {
if ((localErrors[i]) != null) {
localErrors[i].serialize(new javax.xml.namespace.QName("http://ponge.hr/pfa/axis/core/operations" , "errors") ,xmlWriter);
} else {
}
}
} else {
throw new org.apache.axis2.databinding.ADBException("errors cannot be null!!");
}
}
xmlWriter.writeEndElement();
}
private static java.lang.String generatePrefix(java.lang.String namespace) {
if (namespace.equals("http://ponge.hr/pfa/axis/core/operations")) {
return "ns5";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace ,localPart);
} else {
if ((namespace.length()) == 0) {
prefix = "";
} else if (prefix == null) {
prefix = hr.ponge.pfa.axis.core.operations.UpdateDocumentResp.generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix ,localPart ,namespace);
xmlWriter.writeNamespace(prefix ,namespace);
xmlWriter.setPrefix(prefix ,namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix, java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if ((xmlWriter.getPrefix(namespace)) == null) {
xmlWriter.writeNamespace(prefix ,namespace);
xmlWriter.setPrefix(prefix ,namespace);
}
xmlWriter.writeAttribute(namespace ,attName ,attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName ,attValue);
} else {
registerPrefix(xmlWriter ,namespace);
xmlWriter.writeAttribute(namespace ,attName ,attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter ,attributeNamespace);
}
java.lang.String attributeValue;
if ((attributePrefix.trim().length()) > 0) {
attributeValue = (attributePrefix + ":") + (qname.getLocalPart());
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName ,attributeValue);
} else {
registerPrefix(xmlWriter ,namespace);
xmlWriter.writeAttribute(namespace ,attName ,attributeValue);
}
}
/**
* method to handle Qnames
*/
private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = hr.ponge.pfa.axis.core.operations.UpdateDocumentResp.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix ,namespaceURI);
xmlWriter.setPrefix(prefix ,namespaceURI);
}
if ((prefix.trim().length()) > 0) {
xmlWriter.writeCharacters(((prefix + ":") + (org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname))));
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null;
for (int i = 0 ; i < (qnames.length) ; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || ((prefix.length()) == 0)) {
prefix = hr.ponge.pfa.axis.core.operations.UpdateDocumentResp.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix ,namespaceURI);
xmlWriter.setPrefix(prefix ,namespaceURI);
}
if ((prefix.trim().length()) > 0) {
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = hr.ponge.pfa.axis.core.operations.UpdateDocumentResp.generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if ((uri == null) || ((uri.length()) == 0)) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix ,namespace);
xmlWriter.setPrefix(prefix ,namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException {
java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();
if (localDocumentTracker) {
elementList.add(new javax.xml.namespace.QName("http://ponge.hr/pfa/axis/core/operations" , "document"));
if ((localDocument) == null) {
throw new org.apache.axis2.databinding.ADBException("document cannot be null!!");
}
elementList.add(localDocument);
}
if (localErrorsTracker) {
if ((localErrors) != null) {
for (int i = 0 ; i < (localErrors.length) ; i++) {
if ((localErrors[i]) != null) {
elementList.add(new javax.xml.namespace.QName("http://ponge.hr/pfa/axis/core/operations" , "errors"));
elementList.add(localErrors[i]);
} else {
}
}
} else {
throw new org.apache.axis2.databinding.ADBException("errors cannot be null!!");
}
}
return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName , elementList.toArray() , attribList.toArray());
}
/**
* Factory class that keeps the parse method
*/
public static class Factory {
/**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static hr.ponge.pfa.axis.core.operations.UpdateDocumentResp parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
hr.ponge.pfa.axis.core.operations.UpdateDocumentResp object = new hr.ponge.pfa.axis.core.operations.UpdateDocumentResp();
int event;
java.lang.String nillableValue = null;
java.lang.String prefix = "";
java.lang.String namespaceuri = "";
try {
while ((!(reader.isStartElement())) && (!(reader.isEndElement())))
reader.next();
if ((reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance" ,"type")) != null) {
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance" ,"type");
if (fullTypeName != null) {
java.lang.String nsPrefix = null;
if ((fullTypeName.indexOf(":")) > (-1)) {
nsPrefix = fullTypeName.substring(0 ,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix == null ? "" : nsPrefix;
java.lang.String type = fullTypeName.substring(((fullTypeName.indexOf(":")) + 1));
if (!("UpdateDocumentResp".equals(type))) {
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return ((hr.ponge.pfa.axis.core.operations.UpdateDocumentResp)(hr.ponge.pfa.axis.ExtensionMapper.getTypeObject(nsUri ,type ,reader)));
}
}
}
java.util.Vector handledAttributes = new java.util.Vector();
reader.next();
java.util.ArrayList list2 = new java.util.ArrayList();
while ((!(reader.isStartElement())) && (!(reader.isEndElement())))
reader.next();
if ((reader.isStartElement()) && (new javax.xml.namespace.QName("http://ponge.hr/pfa/axis/core/operations" , "document").equals(reader.getName()))) {
object.setDocument(hr.ponge.pfa.axis.core.Document.Factory.parse(reader));
reader.next();
} else {
}
while ((!(reader.isStartElement())) && (!(reader.isEndElement())))
reader.next();
if ((reader.isStartElement()) && (new javax.xml.namespace.QName("http://ponge.hr/pfa/axis/core/operations" , "errors").equals(reader.getName()))) {
list2.add(hr.ponge.pfa.axis.base.ErrorType.Factory.parse(reader));
boolean loopDone2 = false;
while (!loopDone2) {
while (!(reader.isEndElement()))
reader.next();
reader.next();
while ((!(reader.isStartElement())) && (!(reader.isEndElement())))
reader.next();
if (reader.isEndElement()) {
loopDone2 = true;
} else {
if (new javax.xml.namespace.QName("http://ponge.hr/pfa/axis/core/operations" , "errors").equals(reader.getName())) {
list2.add(hr.ponge.pfa.axis.base.ErrorType.Factory.parse(reader));
} else {
loopDone2 = true;
}
}
}
object.setErrors(((hr.ponge.pfa.axis.base.ErrorType[])(org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(hr.ponge.pfa.axis.base.ErrorType.class ,list2))));
} else {
}
while ((!(reader.isStartElement())) && (!(reader.isEndElement())))
reader.next();
if (reader.isStartElement())
throw new org.apache.axis2.databinding.ADBException(("Unexpected subelement " + (reader.getName())));
} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}
public void addErrors_(hr.ponge.pfa.service.base.ErrorType arg) {
addErrors((hr.ponge.pfa.axis.base.ErrorType)arg);
}
public void setErrors_(hr.ponge.pfa.service.base.ErrorType[] arg) {
hr.ponge.pfa.axis.base.ErrorType[] er = new hr.ponge.pfa.axis.base.ErrorType[arg.length];
for(int i=0;i<arg.length;i++){
er[i]=(hr.ponge.pfa.axis.base.ErrorType) arg[i];
}
setErrors(er);
}
public hr.ponge.pfa.service.base.ErrorType[] getErrors_() {
return getErrors();
}
public void setDocument_(hr.ponge.pfa.service.core.document.DocumentDTO arg) {
setDocument((hr.ponge.pfa.axis.core.Document)arg);
}
public hr.ponge.pfa.service.core.document.DocumentDTO getDocument_() {
return getDocument();
}
}
| [
"kruno.samardzic@orka.hr"
] | kruno.samardzic@orka.hr |
fc2cc5c382d023e884cd2f2449a0e0a9702021b2 | 1246c5baf0bed38e69b5f71e3b06cc8431f2aa47 | /src/com/qlhui/thoughtlight/utils/FileUtiles.java | 5f204f89b010991c9987c5127846c394ee11cf53 | [] | no_license | zhanpeng111/wenhuaquan | 87c61e49d249bda4d1d4fe6c2aa6b121c2ddec0f | 5f74490341d4fba9a03536b93d3762eb16dca797 | refs/heads/master | 2021-01-12T05:46:28.323357 | 2016-12-23T03:40:31 | 2016-12-23T03:40:31 | 77,194,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,566 | java | package com.qlhui.thoughtlight.utils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Environment;
/**
* 把网络图片保存到本地 1.强引用,正常实例化一个对象。 jvm无论内存是否够用系统都不会释放这块内存
* 2.软引用(softReference):当我们系统内存不够时,会释放掉 3.弱引用:当我们系统清理内存时发现是一个弱引用对象,直接清理掉
* 4.虚引用:当我们清理内存时会 把虚引用对象放入一个清理队列当中, 让我们程序员保存当前对象的状态
*
* FileUtiles 作用: 用来向我们的sdcard保存网络接收来的图片
* */
public class FileUtiles {
private Context ctx;
public FileUtiles(Context ctx) {
this.ctx = ctx;
}
// 获取手机在sdcard保存图片的地址
public String getAbsolutePath() {
File root = ctx.getExternalFilesDir(null);
// 返回手机端的绝对路径,当我们软件卸载,以及清理缓存时会被清理掉
if (root != null)
return root.getAbsolutePath();
return null;
}
public static boolean isSdCardAvailable() {
return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
}
// 判断图片在本地缓存当中是否存在,如果存在返回一个true
public boolean isBitmap(String name) {
File root = ctx.getExternalFilesDir(null);
// file地址拼接
File file = new File(root, name);
return file.exists();
}
// 添加到本地缓存当中
public void saveBitmap(String name, Bitmap bitmap) {
if (bitmap == null)
return;
// 如果sdcard不能使用
if (!Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
return;
}
// 拼接图片要保存到sd卡的地址
String BitPath = getAbsolutePath() + "/" + name;
// mtn/sdcard/android/com.qlhui.thoughtlight.zhangxinyi/files/
try {
FileOutputStream fos = new FileOutputStream(BitPath);
/**
* bitmap.compress把图片通过输出流保存到本地 Bitmap.CompressFormat.JPEG 保存图片的格式
* 100 保存到本地的图片质量,需要压缩时适当调整大小
*
* */
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"389663696@qq.com"
] | 389663696@qq.com |
4abc4f536e12772190b6fbce6bc9ab8ba9afef34 | ed60b60073048951fd12b2cd77b834f4d84213e4 | /app/src/main/java/com/xmyunyou/wcd/ui/gaizhuang/StoreDatailCommentFragement.java | 86757ca44a9e08c772f2208b6591cc34c6368855 | [] | no_license | jimohuishangyin/myproject | 3e46612bf1b855278d6f1d582ddb7c237aff3df3 | af46ef716b00bec02b6bd9a1fc56a7dd8d701960 | refs/heads/master | 2021-01-23T15:50:58.448991 | 2015-04-17T09:39:20 | 2015-04-17T09:39:20 | 34,107,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,851 | java | package com.xmyunyou.wcd.ui.gaizhuang;
import android.app.ActionBar;
import android.app.Service;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RadioButton;
import android.widget.RatingBar;
import android.widget.TextView;
import com.baidu.mapapi.map.MapView;
import com.xmyunyou.wcd.R;
import com.xmyunyou.wcd.model.Gaizhuang_stop_comment;
import com.xmyunyou.wcd.model.json.Gaizhuang_shop_commentlist;
import com.xmyunyou.wcd.ui.gaizhuang.adapter.ShopCommentAdapter;
import com.xmyunyou.wcd.ui.gaizhuang.adapter.storeDatailCommentAdapter;
import com.xmyunyou.wcd.ui.view.LoadMoreListView;
import com.xmyunyou.wcd.ui.view.LoadMoreView;
import com.xmyunyou.wcd.utils.Constants;
import com.xmyunyou.wcd.utils.DataUtils;
import com.xmyunyou.wcd.utils.Globals;
import com.xmyunyou.wcd.utils.net.RequestListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by 95 on 2015/4/8.
*/
public class StoreDatailCommentFragement extends Fragment {
public static final String PARAMS_SHOPID = "PARAMS_SHOPID";
private String shopid;
private GaizhuangStopDetailActivity mActivity;
private LoadMoreListView mListView;
private List<Gaizhuang_stop_comment> mCommentList;
private storeDatailCommentAdapter mAdapter;
private int mPage = 1;
private boolean isClear = false;
private TextView mCommentNumTextView;
private LinearLayout mSubmitCommentLinearLayout;
private PopupWindow mPopupWindow;
private RatingBar mRattingBar;
private RadioButton mGoodRadioButton;
private RadioButton mBadRadioButton;
private EditText mContentEditText;
private Button mSubmitButton;
private int StarNum;
//1表示好评,2表示差评
private int PingJia;
//输入内容
private String content;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity = (GaizhuangStopDetailActivity) getActivity();
shopid = getArguments().getString(PARAMS_SHOPID);
mCommentList = new ArrayList<Gaizhuang_stop_comment>();
mAdapter = new storeDatailCommentAdapter(mActivity, mCommentList);
requestShopComment();
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_gaizhuang_store_datailcomment, container, false);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mListView = (LoadMoreListView) getView().findViewById(R.id.gaizhuang_store_ditail_comment);
mCommentNumTextView = (TextView) getView().findViewById(R.id.comment_num);
mSubmitCommentLinearLayout = (LinearLayout) getView().findViewById(R.id.submit_comment);
mSubmitCommentLinearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showPopWindowComment(v);
}
});
mListView.setAdapter(mAdapter);
mListView.setOnLoadMoreListener(new LoadMoreListView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
isClear = false;
mPage++;
requestShopComment();
}
});
}
private void showPopWindowComment(View v) {
LayoutInflater layoutInflater = LayoutInflater.from(mActivity);
View view = layoutInflater.inflate(R.layout.popwindow_comment, null);
mRattingBar = (RatingBar) view.findViewById(R.id.RatingBar);
mGoodRadioButton = (RadioButton) view.findViewById(R.id.store_good);
mBadRadioButton = (RadioButton) view.findViewById(R.id.store_bad);
mContentEditText = (EditText) view.findViewById(R.id.submit_content);
mSubmitButton = (Button) view.findViewById(R.id.submit_button);
mRattingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
StarNum = (int) mRattingBar.getRating();
}
});
mGoodRadioButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PingJia = 1;
mGoodRadioButton.setBackgroundResource(R.drawable.store_detail_zan_selected);
mBadRadioButton.setBackgroundResource(R.drawable.store_detail_bad);
}
});
mBadRadioButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PingJia = 2;
mBadRadioButton.setBackgroundResource(R.drawable.store_detail_bad_selected);
mGoodRadioButton.setBackgroundResource(R.drawable.store_detail_zan);
}
});
mSubmitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
content = mActivity.getEditTextStr(mContentEditText);
if(StarNum ==0){
mActivity.showToast("请选择星级数");
}else if(PingJia ==0){
mActivity.showToast("请为商家店铺做出评价");
}else if(TextUtils.isEmpty(content) ){
mActivity.showToast("请输入内容");
}else {
submitShopComment();
}
}
});
mPopupWindow = new PopupWindow(view, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT,true);
mPopupWindow.setFocusable(true);
mPopupWindow.setOutsideTouchable(false);
mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
mPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
mPopupWindow.showAtLocation(v, Gravity.BOTTOM, 0, 0);
}
//提交评论内容
public void submitShopComment() {
String name = DataUtils.getLoginUser(mActivity).getName();
Map<String, String> params = new HashMap<String, String>();
params.put("Content", content);
params.put("shopid", shopid + "");
params.put("UserName", name);
params.put("DeviceName", Globals.getDeviceName());
params.put("From", "Android");
params.put("PingJia", PingJia + "");
params.put("Star", StarNum + "");
params.put("DeviceID", Globals.getDeviceID(mActivity));
mActivity.requestPost(Constants.GAIZHUANG_STOP_COMMENT, params, boolean.class, new RequestListener() {
@Override
public void onSuccess(Object result) {
boolean b = (boolean) result;
if (b) {
mActivity.showToast("提交成功");
} else {
mActivity.showToast("提交失败");
}
}
@Override
public void onFailure(String errorMsg) {
}
});
}
//请求评论
private void requestShopComment() {
Map<String, String> params = new HashMap<String, String>();
params.put("page", mPage + "");
params.put("size", Constants.PAGE_SIZE + "");
params.put("shopid", shopid + "");
mActivity.requestGet(Constants.GAIZHUANG_SHOP_COMMENT, params, Gaizhuang_shop_commentlist.class, new RequestListener() {
@Override
public void onSuccess(Object result) {
Gaizhuang_shop_commentlist c = (Gaizhuang_shop_commentlist) result;
if (isClear) {
mCommentList.clear();
}
mCommentList.addAll(c.getList());
mAdapter.notifyDataSetChanged();
mCommentNumTextView.setText(c.getTotalCount() + "评");
mListView.onLoadMoreComplete(mCommentList.size() == c.getTotalCount());
}
@Override
public void onFailure(String errorMsg) {
}
});
}
}
| [
"492727008@qq.com"
] | 492727008@qq.com |
079f666fe60f164b1fd820f7cfd809040e619e9e | 52dab375550cc6111979945bc2881f211f4ff2bc | /subsequence.java | 26113c301ccc735c721afd67c3b5ef60eb5f0b7c | [] | no_license | patricktanna/java-sample-problems | dc45fe29290320f09f964ce1c133b1a55c071152 | cd7bdc82bf46966cd114b3def7468b63b4c66326 | refs/heads/master | 2021-04-30T10:02:34.871280 | 2018-02-21T05:17:58 | 2018-02-21T05:17:58 | 121,325,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,522 | java | import java.util.*;
public class SubsequenceChecker{
/* **********************************************************
This method sorts an input array of strings by length
in decending order.
************************************************************/
public static void lengthSort(String[] D) {
Arrays.sort(D, new Comparator<String>() {
public int compare(String s1,String s2) {
return s2.length() - s1.length();
}
});
/*
for (int i = 0; i < D.length; i++) {
System.out.println(D[i]);
}
*/
}
/* **********************************************************
This method returns the index of the first dictionary
word that is at least the length of the input string,
given a dictionary that has been sorted in decending
order.
This is necessary as word A cannot be a subsquence of
word B if A is longer than B.
************************************************************/
public static int findIndex(String[] D, String S) {
int i = 0;
while (D[i].length() > S.length() && i < D.length-1) {
i = i + 1;
}
return i;
}
/* **********************************************************
This method checks each word in the dictionary for
a subsequence by starting with the first letter of
the dictionary word and searching for a match in the
input string.
i = the current word being analyzed from the dictionary
j = the current character of the dictionary word
k = the current character of the input string
c = the running count of matching letters
If the characters at the j & k indexes of their
respective words match, j, k, & c are incremented.
If the characters do not match, then k is incremented.
If not all of the characters in the dictionary word
cannot be found in order in the input string, the
method moves onto the next word by incrementing i.
This continues until either all words in the dictionary
has been analyzed OR c equals the number of letters
in the dictionary word, indicating all characters have
been found in the input string.
************************************************************/
public static String checkSub(String[] D, String S, int i) {
String maxSub = "No subsequences found.";
int j = 0;
int k = 0;
int c = 0;
while (i < D.length && c <= D[i].length()-1) {
// System.out.println("i:"+i+" j:"+j+" k:"+k+" c:"+c);
if (j > D[i].length()-1 || k > S.length()-1) {
i = i + 1;
j = 0;
k = 0;
c = 0;
} else if (D[i].charAt(j) == S.charAt(k)) {
j = j + 1;
k = k + 1;
c = c + 1;
} else {
k = k + 1;
}
}
// System.out.println("i:"+i+" j:"+j+" k:"+k+" c:"+c);
if (c != 0) {
maxSub = "Max subsequence = "+D[i];
}
return maxSub;
}
public static void main(String []args){
// input string
String S = "abppplee";
// Dictionary test cases
String[] D = {"pat", "able", "ale", "apple","bale", "kangaroo", "looooongword"};
// String[] D = {"patgfasggsdffg", "applepatgfasggsdffg"};
// String[] D = {"pat", "ae"};
// String[] D = {"e"};
// String[] D = {"z"};
// String[] D = {"abppplee", "abppplee", "abppplee"};
// Sort by length
lengthSort(D);
// Check if all words in D are longer than S. If so, then a subsequence isn't possible.
if (D[D.length-1].length() > S.length()) {
System.out.println("All dictionary words are longer than the input string.");
} else {
// Jump to first word where length equals input string length (right to left)
int i = findIndex(D, S);
// Check dictionary for subsequence
String W = checkSub(D, S, i);
System.out.println(W);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
fa0441942146eabaa4c837e45532262a28d67567 | ad6990b75e23fae08ecc0da76da2072a08121004 | /SmallestSubString2.java | 79b71aaea628ee26c1852cb25ba2519a9f701b5e | [] | no_license | Avanish-git/Avanish_test | ea9bf19b2bdfb232a59f07a33bf8d98e45fba673 | d3c0ee6eaa64135924c7e408960fdcdf5a27d273 | refs/heads/master | 2020-08-20T05:31:50.870646 | 2019-10-18T10:27:55 | 2019-10-18T10:27:55 | 215,986,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;
public class SmallestSubString2 {
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
String inputString=sc.nextLine();
int result=smallestSubString(inputString);//method call
System.out.println(result);
}
/*
Method to find smallest Substring
*/
private static int smallestSubString(String inputString)
{
char[] inputStringCharArray=inputString.toCharArray();//to convert string into charArray
Set<Character> set=new LinkedHashSet<>();// set for unique character
for(Character character:inputStringCharArray)
{
set.add(character);
}
return set.size();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ebbc327d8f3d57c4a24636c6836c366637997419 | 5ddba37292b4bfaa4dd7b914b23dcc8f747f9c86 | /org/jfree/chart/demo/BarChartDemo1.java | 92edb8398fafa81c3a258d09b262a72e0e5de019 | [] | no_license | micahnut/CMSC-105 | 974a4ffde5c5aa3d9813d47a3ec2a340068d05ec | e736fe1aa68fcf63890c49a6eb36fe967bf11a4e | refs/heads/master | 2021-07-06T22:51:39.008350 | 2019-06-26T16:23:35 | 2019-06-26T16:23:35 | 191,587,894 | 0 | 0 | null | 2020-10-13T13:51:30 | 2019-06-12T14:32:16 | Java | UTF-8 | Java | false | false | 4,238 | java | /* */ package org.jfree.chart.demo;
/* */
/* */ import java.awt.Color;
/* */ import java.awt.Dimension;
/* */ import org.jfree.chart.ChartFactory;
/* */ import org.jfree.chart.ChartPanel;
/* */ import org.jfree.chart.JFreeChart;
/* */ import org.jfree.chart.StandardChartTheme;
/* */ import org.jfree.chart.axis.NumberAxis;
/* */ import org.jfree.chart.block.BlockBorder;
/* */ import org.jfree.chart.plot.CategoryPlot;
/* */ import org.jfree.chart.renderer.category.BarRenderer;
/* */ import org.jfree.chart.title.TextTitle;
/* */ import org.jfree.data.category.CategoryDataset;
/* */ import org.jfree.data.category.DefaultCategoryDataset;
/* */ import org.jfree.ui.ApplicationFrame;
/* */ import org.jfree.ui.RefineryUtilities;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class BarChartDemo1
/* */ extends ApplicationFrame
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */
/* */ static {
/* 72 */ ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public BarChartDemo1(String title) {
/* 82 */ super(title);
/* 83 */ CategoryDataset dataset = createDataset();
/* 84 */ JFreeChart chart = createChart(dataset);
/* 85 */ ChartPanel chartPanel = new ChartPanel(chart);
/* 86 */ chartPanel.setFillZoomRectangle(true);
/* 87 */ chartPanel.setMouseWheelEnabled(true);
/* 88 */ chartPanel.setPreferredSize(new Dimension('Ǵ', 'Ď'));
/* 89 */ setContentPane(chartPanel);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private static CategoryDataset createDataset() {
/* 98 */ dataset = new DefaultCategoryDataset();
/* 99 */ dataset.addValue(7445.0D, "JFreeSVG", "Warm-up");
/* 100 */ dataset.addValue(24448.0D, "Batik", "Warm-up");
/* 101 */ dataset.addValue(4297.0D, "JFreeSVG", "Test");
/* 102 */ dataset.addValue(21022.0D, "Batik", "Test");
/* 103 */ return dataset;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private static JFreeChart createChart(CategoryDataset dataset) {
/* 114 */ JFreeChart chart = ChartFactory.createBarChart("Performance: JFreeSVG vs Batik", null, "Milliseconds", dataset);
/* */
/* */
/* 117 */ chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG format (lower bars = better performance)"));
/* */
/* 119 */ chart.setBackgroundPaint(Color.white);
/* 120 */ CategoryPlot plot = (CategoryPlot)chart.getPlot();
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 130 */ NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
/* 131 */ rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
/* 132 */ BarRenderer renderer = (BarRenderer)plot.getRenderer();
/* 133 */ renderer.setDrawBarOutline(false);
/* 134 */ chart.getLegend().setFrame(BlockBorder.NONE);
/* 135 */ return chart;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void main(String[] args) {
/* 144 */ BarChartDemo1 demo = new BarChartDemo1("JFreeChart: BarChartDemo1.java");
/* 145 */ demo.pack();
/* 146 */ RefineryUtilities.centerFrameOnScreen(demo);
/* 147 */ demo.setVisible(true);
/* */ }
/* */ }
/* Location: /Users/micahnut/Downloads/MiniSP.jar!/org/jfree/chart/demo/BarChartDemo1.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.0.3
*/ | [
"noreply@github.com"
] | noreply@github.com |
3efc2fbfbb983d7ec1318f4e548aacfe48ae460a | dbdc78b0e43e79bc99f06ac7dfbdf2fad98129b1 | /core/src/main/java/org/juzu/impl/utils/Tools.java | db12a5ca54e15909c06da12927c419b5d06cea19 | [] | no_license | edpzjh/juzu | beb49ba9c304400933658a194d5766a41f7c7995 | 538dff0c06e5fd3fbcd78e972085797dd8118a01 | refs/heads/master | 2021-01-17T07:09:32.737047 | 2012-02-13T16:49:48 | 2012-02-13T16:50:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,102 | java | /*
* Copyright (C) 2011 eXo Platform SAS.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.juzu.impl.utils;
import javax.lang.model.element.Element;
import javax.xml.bind.DatatypeConverter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
/** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
public class Tools
{
/** . */
public static Pattern EMPTY_NO_RECURSE = Pattern.compile("");
/** . */
public static Pattern EMPTY_RECURSE = Pattern.compile(".*");
public static Pattern getPackageMatcher(String packageName, boolean recurse)
{
// PackageName -> Identifier
// PackageName -> PackageName . Identifier
// Identifier -> IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral
// IdentifierChars -> JavaLetter
// IdentifierChars -> IdentifierChars JavaLetterOrDigit
// JavaLetter -> any Unicode character that is a Java letter
// JavaLetterOrDigit -> any Unicode character that is a Java letter-or-digit
if (packageName.length() == 0)
{
return recurse ? EMPTY_RECURSE : EMPTY_NO_RECURSE;
}
else
{
String regex;
if (recurse)
{
regex = Pattern.quote(packageName) + "(\\..*)?";
}
else
{
regex = Pattern.quote(packageName);
}
return Pattern.compile(regex);
}
}
public static void escape(CharSequence s, StringBuilder appendable)
{
for (int i = 0;i < s.length();i++)
{
char c = s.charAt(i);
if (c == '\n')
{
appendable.append("\\n");
}
else if (c == '\'')
{
appendable.append("\\\'");
}
else
{
appendable.append(c);
}
}
}
public static boolean safeEquals(Object o1, Object o2)
{
return o1 == null ? o2 == null : (o2 != null && o1.equals(o2));
}
public static void safeClose(Closeable closeable)
{
if (closeable != null)
{
try
{
closeable.close();
}
catch (IOException ignore)
{
}
}
}
public static Method safeGetMethod(Class<?> type, String name, Class<?>... parameterTypes)
{
try
{
return type.getDeclaredMethod(name, parameterTypes);
}
catch (NoSuchMethodException e)
{
return null;
}
}
public static <T> List<T> safeUnmodifiableList(T... list)
{
return safeUnmodifiableList(Arrays.asList(list));
}
public static <T> List<T> safeUnmodifiableList(List<T> list)
{
if (list == null || list.isEmpty())
{
return Collections.emptyList();
}
else
{
return Collections.unmodifiableList(new ArrayList<T>(list));
}
}
public static byte[] bytes(InputStream in) throws IOException
{
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream(in.available());
copy(in, baos);
return baos.toByteArray();
}
finally
{
safeClose(in);
}
}
public static void write(String content, File f) throws IOException
{
FileOutputStream out = new FileOutputStream(f);
try
{
copy(new ByteArrayInputStream(content.getBytes()), out);
}
finally
{
safeClose(out);
}
}
public static String read(URL url) throws IOException
{
return read(url.openStream());
}
public static String read(File f) throws IOException
{
return read(new FileInputStream(f));
}
public static String read(InputStream in) throws IOException
{
return read(in, "UTF-8");
}
public static String read(InputStream in, String charsetName) throws IOException
{
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
copy(in, baos);
return baos.toString();
}
finally
{
safeClose(in);
}
}
public static void copy(InputStream in, OutputStream out) throws IOException
{
byte[] buffer = new byte[256];
for (int l;(l = in.read(buffer)) != -1;)
{
out.write(buffer, 0, l);
}
}
public static String unquote(String s) throws NullPointerException
{
if (s == null)
{
throw new NullPointerException("Can't unquote null string");
}
if (s.length() > 1)
{
char c1 = s.charAt(0);
char c2 = s.charAt(s.length() - 1);
if ((c1 == '\'' || c1 == '"') && c1 == c2)
{
return s.substring(1, s.length() - 1);
}
}
return s;
}
public static String join(char separator, String... names)
{
switch (names.length)
{
case 0:
return "";
case 1:
return names[0];
default:
StringBuilder sb = new StringBuilder();
for (String name : names)
{
if (sb.length() > 0)
{
sb.append(separator);
}
sb.append(name);
}
return sb.toString();
}
}
public static String getImport(Class<?> clazz)
{
if (clazz.isLocalClass() || clazz.isAnonymousClass())
{
throw new IllegalArgumentException("Cannot use local or anonymous class");
}
else if (clazz.isMemberClass())
{
StringBuilder sb = new StringBuilder();
while (clazz.isMemberClass())
{
sb.insert(0, clazz.getSimpleName());
sb.insert(0, '.');
clazz = clazz.getEnclosingClass();
}
sb.insert(0, clazz.getSimpleName());
String pkg = clazz.getPackage().getName();
if (pkg.length() > 0)
{
sb.insert(0, '.');
sb.insert(0, pkg);
}
return sb.toString();
}
else
{
return clazz.getName();
}
}
public static <E> HashSet<E> set(E... elements)
{
HashSet<E> set = new HashSet<E>(elements.length);
Collections.addAll(set, elements);
return set;
}
public static <E> ArrayList<E> list(Iterable<E> elements)
{
return list(elements.iterator());
}
public static <E> ArrayList<E> list(Iterator<E> elements)
{
ArrayList<E> list = new ArrayList<E>();
while (elements.hasNext())
{
list.add(elements.next());
}
return list;
}
public static <S extends Serializable> S unserialize(Class<S> expectedType, File f) throws IOException, ClassNotFoundException
{
return unserialize(expectedType, new FileInputStream(f));
}
public static <S> S unserialize(Class<S> expectedType, InputStream in) throws IOException, ClassNotFoundException
{
try
{
ObjectInputStream ois = new ObjectInputStream(in);
Object o = ois.readObject();
return expectedType.cast(o);
}
finally
{
safeClose(in);
}
}
public static <S extends Serializable> void serialize(S value, File f) throws IOException
{
serialize(value, new FileOutputStream(f));
}
public static <T extends Serializable> void serialize(T value, OutputStream out) throws IOException
{
ObjectOutputStream ois = new ObjectOutputStream(out);
try
{
ois.writeObject(value);
}
finally
{
safeClose(out);
}
}
/**
* Parses a date formatted as ISO 8601.
*
* @param date the date
* @return the time in millis corresponding to the date
*/
public static long parseISO8601(String date)
{
return DatatypeConverter.parseDateTime(date).getTimeInMillis();
}
/**
* Format the time millis as an ISO 8601 date.
*
* @param timeMillis the time to format
* @return the ISO 8601 corresponding dat
*/
public static String formatISO8601(long timeMillis)
{
Calendar c = Calendar.getInstance();
c.setTimeInMillis(timeMillis);
return DatatypeConverter.printDateTime(c);
}
public static long handle(Element te)
{
long hash = 0;
for (Element enclosed : te.getEnclosedElements())
{
hash = 31 * hash + handle(enclosed);
}
hash = 31 * hash + te.getSimpleName().toString().hashCode();
return hash;
}
public static String[] split(CharSequence s, char separator)
{
return foo(s, separator, 0, 0, 0);
}
public static String[] split(CharSequence s, char separator, int rightPadding)
{
if (rightPadding < 0)
{
throw new IllegalArgumentException("Right padding cannot be negative");
}
return foo(s, separator, 0, 0, rightPadding);
}
private static String[] foo(CharSequence s, char separator, int count, int from, int rightPadding)
{
int len = s.length();
if (from < len)
{
int to = from;
while (to < len && s.charAt(to) != separator)
{
to++;
}
String[] ret;
if (to == len - 1)
{
ret = new String[count + 2 + rightPadding];
ret[count + 1] = "";
}
else
{
ret = to == len ? new String[count + 1 + rightPadding] : foo(s, separator, count + 1, to + 1, rightPadding);
}
ret[count] = from == to ? "" : s.subSequence(from, to).toString();
return ret;
}
else if (from == len)
{
return new String[count + rightPadding];
}
else
{
throw new AssertionError();
}
}
}
| [
"julien@julienviet.com"
] | julien@julienviet.com |
723c070ebdd187216e4cb0037d999dc983d2a7b2 | 6bb7bdc325b34469b65c648b52072ac77ba14e17 | /takin-webapp/tro-cloud/tro-cloud-common/src/main/java/io/shulie/tro/cloud/common/enums/PressureModeEnums.java | 66426a5834934abcd0fa1a8ea61cdb9244750f83 | [
"Apache-2.0"
] | permissive | NijaCN/Takin | c2ac00e528d7b78d7340a901d45891f59d5d7f8c | 93a03997ddfe0993d013185787eb471ab5d90995 | refs/heads/main | 2023-06-26T05:22:50.919980 | 2021-07-27T05:57:01 | 2021-07-27T05:57:01 | 389,866,134 | 1 | 0 | Apache-2.0 | 2021-07-27T06:01:36 | 2021-07-27T06:01:35 | null | UTF-8 | Java | false | false | 1,143 | java | /*
* Copyright 2021 Shulie Technology, Co.Ltd
* Email: shulie@shulie.io
* 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,
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.shulie.tro.cloud.common.enums;
import lombok.Getter;
/**
* @author shiyajian
* create: 2020-07-30
*/
public enum PressureModeEnums {
/**
* 固定模式
*/
FIXED("fixed", 1),
/**
* 线性增长
*/
LINEAR("linear", 2),
/**
* 阶梯增长
*/
STAIR("stair", 3);
/**
* 名称
*/
@Getter
private final String text;
/**
* 编码
*/
@Getter
private final int code;
PressureModeEnums(String text, int code) {
this.text = text;
this.code = code;
}
}
| [
"576425673@qq.com"
] | 576425673@qq.com |
786efae035104b9df0f21fcd67b2a5f68bd349ac | 7510f578e54a9872fdef05a3fbd05f68d247e8a9 | /android/app/src/main/java/com/imdb/MainApplication.java | 20200125f2da49ad3e30b06daedc058506a89323 | [] | no_license | Nilavarasi/IMDB-React-Native | 203316d680ddf1bda6ef87e2ec3f914942f567da | dd1e4c8f3a2a119b0d075744d6031b5c823e3f6a | refs/heads/master | 2023-04-11T00:56:08.846424 | 2021-04-22T15:09:13 | 2021-04-22T15:09:13 | 360,560,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,150 | java | package com.imdb;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNGestureHandlerPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"nilavarasisivasankaran@Nilavarasis-MacBook-Pro.local"
] | nilavarasisivasankaran@Nilavarasis-MacBook-Pro.local |
14d39c67c930fb2da58af94fb90ec2437bfad3b6 | 2f3ec1cec5f79409e4757008f8be4522d789dd53 | /app/src/main/java/br/edu/ifsp/scl/sdm/listacontatossdm/view/ContatoActivity.java | 30fad250273d10955d0a704d07b4b08e7b0ff7a6 | [] | no_license | joaolutzSDM/ListaContatosSDM | 74d5c55d1e16de7fd89d0229e79380b05b40bd1c | 2265a55f96150286ddffd05f4385ec601172520b | refs/heads/master | 2020-03-28T17:24:44.604261 | 2018-09-15T16:03:58 | 2018-09-15T16:03:58 | 148,786,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,033 | java | package br.edu.ifsp.scl.sdm.listacontatossdm.view;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import br.edu.ifsp.scl.sdm.listacontatossdm.R;
import br.edu.ifsp.scl.sdm.listacontatossdm.model.Contato;
import static br.edu.ifsp.scl.sdm.listacontatossdm.view.ListaContatosActivity.EDITAR_CONTATO;
public class ContatoActivity extends AppCompatActivity {
private EditText nomeEditText;
private EditText enderecoEditText;
private EditText telefoneEditText;
private EditText emailEditText;
private Button cancelarButton;
private Button salvarButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contato);
nomeEditText = findViewById(R.id.nomeEditText);
enderecoEditText = findViewById(R.id.enderecoEditText);
telefoneEditText = findViewById(R.id.telefoneEditText);
emailEditText = findViewById(R.id.emailEditText);
cancelarButton = findViewById(R.id.cancelarButton);
salvarButton = findViewById(R.id.salvarButton);
// setando listeners dos botões
cancelarButton.setOnClickListener(cancelarClickListener);
salvarButton.setOnClickListener(salvarClickListener);
String subtitulo;
Contato contato = (Contato) getIntent().getSerializableExtra(ListaContatosActivity.CONTATO_EXTRA);
if(contato != null) {
boolean edicao = getIntent().getBooleanExtra(ListaContatosActivity.EDITAR_CONTATO, false);
if(edicao) {
//Modo edição
subtitulo = "Editar contato";
modoDetalheEdicao(contato, true);
} else {
//Modo detalhes
subtitulo = "Detalhes do contato";
modoDetalheEdicao(contato, false);
}
} else {
//Modo cadastro
subtitulo = "Novo contato";
}
// Setando subtítulo
getSupportActionBar().setSubtitle(subtitulo);
}
private void modoDetalheEdicao(Contato contato, boolean edicao) {
nomeEditText.setText(contato.getNome());
nomeEditText.setEnabled(edicao);
enderecoEditText.setText(contato.getEndereco());
enderecoEditText.setEnabled(edicao);
telefoneEditText.setText(contato.getTelefone());
telefoneEditText.setEnabled(edicao);
emailEditText.setText(contato.getEmail());
emailEditText.setEnabled(edicao);
if (edicao) {
salvarButton.setVisibility(View.VISIBLE);
} else {
salvarButton.setVisibility(View.GONE);
}
}
private View.OnClickListener cancelarClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
setResult(RESULT_CANCELED);
finish();
}
};
private View.OnClickListener salvarClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Contato novoContato = getContato();
Intent resultadoIntent = new Intent();
resultadoIntent.putExtra(ListaContatosActivity.CONTATO_EXTRA, novoContato);
int position = getIntent().getIntExtra(ListaContatosActivity.CONTATO_POSITION, -1);
resultadoIntent.putExtra(ListaContatosActivity.CONTATO_POSITION, position);
setResult(RESULT_OK, resultadoIntent);
finish();
}
};
private Contato getContato() {
Contato novoContato = new Contato();
novoContato.setNome(nomeEditText.getText().toString());
novoContato.setEndereco(enderecoEditText.getText().toString());
novoContato.setTelefone(telefoneEditText.getText().toString());
novoContato.setEmail(emailEditText.getText().toString());
return novoContato;
}
}
| [
"joao.lutz@aluno.ifsp.edu.br"
] | joao.lutz@aluno.ifsp.edu.br |
bb66f83bb10b75dd225c074dc11e75cd2f098c33 | db0e32f1ac9b1ae9cdfb0a7019a35a28acb79836 | /src/djikistraShortPath/Edge.java | 1b1c87d23340d79a795a94c547bfcdfc31875276 | [] | no_license | hsine55/Algorithms | 32e563482d810ee97f9801810371aa2ab8e04ebe | 2ef5a9e946ef04d9d943a0b50fc28ca08a5293c6 | refs/heads/master | 2021-01-10T23:00:28.823964 | 2017-01-07T14:59:59 | 2017-01-07T14:59:59 | 70,433,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | package djikistraShortPath;
import java.util.ArrayList;
import java.util.List;
import djikistraShortPath.Vertex;
public class Edge {
private List<Vertex> endPoints = new ArrayList<Vertex>();
private int weigh;
public Edge(int weigh, Vertex endPoint1, Vertex endPoint2) {
this.weigh = weigh;
endPoints.add(endPoint1);
endPoints.add(endPoint2);
}
public int getWeigh() {
return weigh;
}
public void setWeigh(int weigh) {
this.weigh = weigh;
}
public List<Vertex> getEndPoints() {
return endPoints;
}
public void setEndPoints(List<Vertex> endPoints) {
this.endPoints = endPoints;
}
public boolean contains(Vertex v1, Vertex v2) {
return endPoints.contains(v1) && endPoints.contains(v2);
}
public Vertex getOppositePoint(Vertex v1) {
return endPoints.get(1- endPoints.indexOf(v1));
}
public void replaceEndPoint(Vertex v1, Vertex v2) {
endPoints.remove(v1);
endPoints.add(v2);
}
@Override
public String toString() {
return "Edge ["+endPoints.get(0).getLabel() + " => "+endPoints.get(1).getLabel()+", weigh=" + weigh + "]";
}
}
| [
"hsine.benmessaoud@gmail.com"
] | hsine.benmessaoud@gmail.com |
33037649b94d1880fa32ea2b3fb8b2a8f6461dc4 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_1002487abd842699813a50fc0483a68923586754/TextStroke/11_1002487abd842699813a50fc0483a68923586754_TextStroke_t.java | d48b4ca7036b88ebe3a90299926939eae8069fc7 | [] | 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 | 22,128 | java | /*----------------------------------------------------------------------------
This file is part of deegree, http://deegree.org/
Copyright (C) 2001-2009 by:
Department of Geography, University of Bonn
and
lat/lon GmbH
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact information:
lat/lon GmbH
Aennchenstr. 19, 53177 Bonn
Germany
http://lat-lon.de/
Department of Geography, University of Bonn
Prof. Dr. Klaus Greve
Postfach 1147, 53001 Bonn
Germany
http://www.geographie.uni-bonn.de/deegree/
e-mail: info@deegree.org
----------------------------------------------------------------------------*/
/*
Copyright 2006 Jerry Huxtable
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.deegree.rendering.r2d.strokes;
import static java.awt.geom.PathIterator.SEG_CLOSE;
import static java.awt.geom.PathIterator.SEG_LINETO;
import static java.awt.geom.PathIterator.SEG_MOVETO;
import static java.lang.Math.atan2;
import static java.lang.Math.sqrt;
import static java.util.Arrays.asList;
import static org.deegree.commons.utils.math.MathUtils.isZero;
import static org.deegree.geometry.utils.GeometryUtils.measurePathLengths;
import static org.slf4j.LoggerFactory.getLogger;
import java.awt.Font;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.geom.FlatteningPathIterator;
import java.awt.geom.GeneralPath;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.LinkedList;
import java.util.ListIterator;
import org.deegree.commons.annotations.LoggingNotes;
import org.deegree.style.styling.components.LinePlacement;
import org.slf4j.Logger;
/**
* <code>TextStroke</code>
*
* @author Jerry Huxtable
* @author <a href="mailto:schmitz@lat-lon.de">Andreas Schmitz</a>
* @author last edited by: $Author$
*
* @version $Revision$, $Date$
*/
@LoggingNotes(debug = "logs which text is rendered how", trace = "logs implementation/code debugging details about text strokes")
public class TextStroke implements Stroke {
private static final Logger LOG = getLogger( TextStroke.class );
private static final double H_PI = Math.PI / 2;
private String text;
private Font font;
private FontRenderContext frc;
private double lineHeight;
private static final float FLATNESS = 1;
private final LinePlacement linePlacement;
/**
* @param text
* @param font
* @param linePlacement
*/
public TextStroke( String text, Font font, LinePlacement linePlacement ) {
this.text = text;
this.font = font;
this.linePlacement = linePlacement;
frc = new FontRenderContext( null, false, false );
lineHeight = font.getLineMetrics( text, frc ).getHeight();
}
// the code for this function may benefit from a good refactoring idea
// I had none that was practical.
// the method returns (true, path) if rendering word wise is possible
// and (false, null) if not
private GeneralPath tryWordWise( Shape shape ) {
// two steps: first a list is prepared that describes what to render where
// second the list is rendered
// first step: iterates over the segment lengths and the words to render
LinkedList<String> words = extractWords();
LinkedList<String> wordsCopy = new LinkedList<String>();
wordsCopy.addAll( words );
LinkedList<StringOrGap> wordsToRender = new LinkedList<StringOrGap>();
// things to consider: initial gaps, gaps, whether to repeat the string
// algorithm sketch:
// try to match as many words on each line segment as possible (taking into account gap length)
// if a segment is encountered that is smaller than the current word length, return false
// (even if maybe the next segment would be fitting, the empty segment would just not look nice, so better abort
// here)
// the list will contain StringOrGap objects (a choice between a String, a gap or a end of line tag)
// So if some gap[1]/word[1-*] combination fits the segment, all of them are added to the list, as well as an
// end of line tag. Then, the next segment is considered. If repeat is on, the words list will never be empty
// and the loop will run until the segment lengths list is empty.
// TODO: Optimization: do not add Strings, add the GlyphVectors
if ( !prepareWordsToRender( words, wordsToRender, shape, wordsCopy ) ) {
return null;
}
LOG.trace( "Rendering the word/gap list: " + wordsToRender );
// prepare for second run - now actually doing something
// this just iterates over the path and creates the final shape to render.
GeneralPath result = new GeneralPath();
PathIterator it = new FlatteningPathIterator( shape.getPathIterator( null ), FLATNESS );
double points[] = new double[6];
double movex = 0, movey = 0, lastx = 0, lasty = 0;
while ( !it.isDone() ) {
int type = it.currentSegment( points );
switch ( type ) {
case SEG_MOVETO:
movex = lastx = points[0];
movey = lasty = points[1];
result.moveTo( movex, movey );
break;
case SEG_CLOSE:
points[0] = movex;
points[1] = movey;
// Fall into....
case SEG_LINETO:
if ( wordsToRender.isEmpty() ) {
break;
}
double px = points[0];
double py = points[1];
double dx = px - lastx;
double dy = py - lasty;
double angle = atan2( dy, dx );
// render all pieces until the next EOL
renderUntilEol( wordsToRender, lastx, lasty, angle, result );
lastx = px;
lasty = py;
break;
}
it.next();
}
return result;
}
private void renderUntilEol( LinkedList<StringOrGap> wordsToRender, double lastx, double lasty, double angle,
GeneralPath result ) {
double length = 0;
StringOrGap sog = wordsToRender.poll();
while ( !sog.newLine ) {
double gap = 0;
// add all gaps in the list (will normally only be one)
while ( sog.string == null && !sog.newLine ) {
gap += sog.gap;
sog = wordsToRender.poll();
}
if ( sog.string == null ) {
break;
}
GlyphVector vec = font.createGlyphVector( frc, sog.string );
Shape text = vec.getOutline();
// straightforward: move to the beginning of the segment
// rotate so text direction fits the line
// move to current position of part
// the lineHeight / 4 centers the text center line on the line
AffineTransform t = new AffineTransform();
t.setToTranslation( lastx, lasty );
t.rotate( angle );
t.translate( gap + length, lineHeight / 4 );
result.append( t.createTransformedShape( text ), false );
length += gap + text.getBounds2D().getWidth();
sog = wordsToRender.poll();
}
}
private LinkedList<String> extractWords() {
LinkedList<String> words = new LinkedList<String>( asList( text.split( "\\s" ) ) );
ListIterator<String> list = words.listIterator();
while ( list.hasNext() ) {
if ( list.next().trim().equals( "" ) ) {
list.remove();
}
}
return words;
}
private boolean prepareWordsToRender( LinkedList<String> words, LinkedList<StringOrGap> wordsToRender, Shape shape,
LinkedList<String> wordsCopy ) {
LinkedList<Double> lengths = measurePathLengths( shape );
double currentGap = isZero( linePlacement.initialGap ) ? 0 : linePlacement.initialGap;
if ( !isZero( currentGap ) ) {
StringOrGap sog = new StringOrGap();
sog.gap = currentGap;
wordsToRender.add( sog );
}
while ( words.size() > 0 && lengths.size() > 0 ) {
String word = words.poll();
GlyphVector vec = font.createGlyphVector( frc, word );
double vecLength = currentGap + vec.getOutline().getBounds2D().getWidth();
double segLength = lengths.poll() - font.getSize2D(); // at least it works for line angles < 90°
if ( vecLength > segLength ) {
return false;
}
currentGap = 0;
newWords( words, wordsCopy, word, wordsToRender, vecLength, segLength );
StringOrGap sog = new StringOrGap();
sog.newLine = true;
// the next segment will be considered, so add a end of line tag. If the last StringOrGap was a gap, insert
// the end of line BEFORE the gap.
if ( wordsToRender.getLast().string == null ) {
wordsToRender.add( wordsToRender.size() - 1, sog );
} else {
wordsToRender.add( sog );
}
}
return true;
}
private void newWords( LinkedList<String> words, LinkedList<String> wordsCopy, String word,
LinkedList<StringOrGap> wordsToRender, double vecLength, double segLength ) {
String newWord = word;
words.addFirst( word );
double totalLength = 0;
do { // do/while because at least one word has to be added
words.poll();
boolean justInserted = false;
if ( words.isEmpty() && linePlacement.repeat ) {
// in this case, the words list has to be filled again. Also the gap has to be considered.
words.addAll( wordsCopy );
StringOrGap sog = new StringOrGap();
sog.string = newWord;
wordsToRender.add( sog );
justInserted = true; // set this flag so the adding at the end of the loop won't happen again with
// the same string.
totalLength += font.createGlyphVector( frc, word ).getOutline().getBounds2D().getWidth();
newWord = "";
if ( !isZero( linePlacement.gap ) ) {
sog = new StringOrGap();
sog.gap = linePlacement.gap;
totalLength += sog.gap;
wordsToRender.add( sog );
}
} else if ( words.isEmpty() ) {
// in this case, the last word can be rendered, and the loop terminates
StringOrGap sog = new StringOrGap();
sog.string = newWord;
wordsToRender.add( sog );
break;
}
newWord = ( newWord.equals( "" ) ? "" : newWord + " " ) + words.peek();
vecLength = font.createGlyphVector( frc, newWord ).getOutline().getBounds2D().getWidth();
if ( !justInserted && ( totalLength + vecLength >= segLength ) ) {
// the normal case, one or more words have been fit, and the current word does overflow the length
// -> add the word
StringOrGap sog = new StringOrGap();
sog.string = word;
wordsToRender.add( sog );
}
word = newWord;
} while ( totalLength + vecLength < segLength );
}
private boolean isUpsideDown( Shape shape ) {
PathIterator it = new FlatteningPathIterator( shape.getPathIterator( null ), FLATNESS );
double points[] = new double[6];
double moveX = 0, moveY = 0;
double lastX = 0, lastY = 0;
double thisX = 0, thisY = 0;
double upsideDown = 0, total = 0;
while ( !it.isDone() ) {
int type = it.currentSegment( points );
switch ( type ) {
case PathIterator.SEG_MOVETO:
moveX = lastX = points[0];
moveY = lastY = points[1];
break;
case PathIterator.SEG_CLOSE:
points[0] = moveX;
points[1] = moveY;
// Fall into....
case PathIterator.SEG_LINETO:
thisX = points[0];
thisY = points[1];
double dx = thisX - lastX;
double dy = thisY - lastY;
double distance = sqrt( dx * dx + dy * dy );
double angle = atan2( dy, dx );
if ( Math.abs( angle ) > H_PI ) {
upsideDown += distance;
}
total += distance;
lastX = thisX;
lastY = thisY;
break;
}
it.next();
}
return total - upsideDown < upsideDown;
}
private double getShapeLength( Shape shape ) {
PathIterator it = new FlatteningPathIterator( shape.getPathIterator( null ), FLATNESS );
double points[] = new double[6];
double moveX = 0, moveY = 0;
double lastX = 0, lastY = 0;
double thisX = 0, thisY = 0;
double total = 0;
while ( !it.isDone() ) {
int type = it.currentSegment( points );
switch ( type ) {
case PathIterator.SEG_MOVETO:
moveX = lastX = points[0];
moveY = lastY = points[1];
break;
case PathIterator.SEG_CLOSE:
points[0] = moveX;
points[1] = moveY;
// Fall into....
case PathIterator.SEG_LINETO:
thisX = points[0];
thisY = points[1];
double dx = thisX - lastX;
double dy = thisY - lastY;
double distance = sqrt( dx * dx + dy * dy );
total += distance;
lastX = thisX;
lastY = thisY;
break;
}
it.next();
}
return total;
}
public Shape createStrokedShape( Shape shape ) {
GlyphVector glyphVector = font.createGlyphVector( frc, text );
if ( glyphVector.getLogicalBounds().getWidth() > getShapeLength( shape ) ) {
return new GeneralPath();
}
shape = handleUpsideDown( shape );
GeneralPath path = tryWordWise( shape );
if ( path != null ) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Rendered text '" + text + "' word wise." );
}
return path;
}
return renderCharacterWise( shape, glyphVector );
}
private Shape renderCharacterWise( Shape shape, GlyphVector glyphVector ) {
GeneralPath result = new GeneralPath();
PathIterator it = new FlatteningPathIterator( shape.getPathIterator( null ), FLATNESS );
double points[] = new double[6];
double moveX = 0, moveY = 0;
double lastX = 0, lastY = 0;
double thisX = 0, thisY = 0;
int type = 0;
int length = glyphVector.getNumGlyphs();
if ( length == 0 )
return result;
CharacterWiseState state = new CharacterWiseState();
while ( state.currentChar < length && !it.isDone() ) {
type = it.currentSegment( points );
switch ( type ) {
case PathIterator.SEG_MOVETO:
moveX = lastX = points[0];
moveY = lastY = points[1];
result.moveTo( moveX, moveY );
state.nextAdvance = glyphVector.getGlyphMetrics( state.currentChar ).getAdvance() * 0.5f;
state.next = state.nextAdvance + linePlacement.initialGap;
break;
case PathIterator.SEG_CLOSE:
points[0] = moveX;
points[1] = moveY;
// Fall into....
case PathIterator.SEG_LINETO:
thisX = points[0];
thisY = points[1];
double dx = thisX - lastX;
double dy = thisY - lastY;
double distance = sqrt( dx * dx + dy * dy );
if ( distance >= state.next ) {
double r = 1.0f / distance;
double angle = atan2( dy, dx );
nextSegment( state, length, distance, glyphVector, lastX, lastY, dx, dy, r, angle, result );
}
state.next -= distance;
lastX = thisX;
lastY = thisY;
break;
}
it.next();
}
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Rendered text '" + text + "' character wise." );
}
return result;
}
private void nextSegment( CharacterWiseState state, int length, double distance, GlyphVector glyphVector,
double lastX, double lastY, double dx, double dy, double r, double angle,
GeneralPath result ) {
while ( state.currentChar < length && distance >= state.next ) {
Shape glyph = glyphVector.getGlyphOutline( state.currentChar );
Point2D p = glyphVector.getGlyphPosition( state.currentChar );
double px = p.getX();
double py = p.getY();
double x = lastX + state.next * dx * r;
double y = lastY + state.next * dy * r;
double advance = state.nextAdvance;
state.nextAdvance = state.currentChar < length - 1 ? glyphVector.getGlyphMetrics( state.currentChar + 1 ).getAdvance() * 0.5f
: advance;
AffineTransform t = new AffineTransform();
t.setToTranslation( x, y );
t.rotate( angle );
t.translate( -px - advance, -py + lineHeight / 4 );
result.append( t.createTransformedShape( glyph ), false );
state.next += ( advance + state.nextAdvance );
state.currentChar++;
if ( linePlacement.repeat && state.currentChar >= length ) {
state.currentChar = 0;
state.next += linePlacement.gap;
}
}
}
private Shape handleUpsideDown( Shape shape ) {
if ( linePlacement.preventUpsideDown && isUpsideDown( shape ) ) {
final Shape originalShape = shape;
shape = (Shape) Proxy.newProxyInstance( Thread.currentThread().getContextClassLoader(),
new Class[] { Shape.class }, new InvocationHandler() {
@Override
public Object invoke( Object proxy, Method method, Object[] args )
throws Throwable {
Object retval = method.invoke( originalShape, args );
if ( method.getName().equals( "getPathIterator" ) ) {
return new ReversePathIterator( (PathIterator) retval );
}
return retval;
}
} );
}
return shape;
}
static class CharacterWiseState {
double nextAdvance, next;
int currentChar;
}
static class StringOrGap {
String string;
double gap;
boolean newLine;
@Override
public String toString() {
return newLine ? "[eol]" : ( string == null ? "" + gap : string );
}
}
/**
* @return the calculated line height
*/
public double getLineHeight() {
return lineHeight;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
edeaa4bec0a634e9904464f80e85da3d9de0e636 | d1bf5f1ce00bbe843cd99319f3e14d3539e29a1b | /pet-clinic-web/src/main/java/com/petclinic/petclinictutorial/Bootstrap/DataLoader.java | 31dc8203d89bc6bdaf2b0e37e69848ab943be12b | [] | no_license | krompac/spring-pet-clinic-tutorial | dd6ca197e4a27b48f3587cd558746c3f6d1afa4f | ac6ffe47d4aced5fdee85a61d59741807a950f1f | refs/heads/master | 2020-06-23T14:37:44.356681 | 2019-09-05T15:08:54 | 2019-09-05T15:08:54 | 198,651,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,494 | java | package com.petclinic.petclinictutorial.Bootstrap;
import com.petclinic.petclinictutorial.model.*;
import com.petclinic.petclinictutorial.services.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.util.Arrays;
@Component
public class DataLoader implements CommandLineRunner {
private final OwnerService ownerService;
private final VetService vetService;
private final SpecialtyService specialtyService;
private final PetTypeService petTypeService;
private final VisitService visitService;
@Autowired
public DataLoader(OwnerService ownerService, VetService vetService, SpecialtyService specialtyService, PetTypeService petTypeService, VisitService visitService) {
this.ownerService = ownerService;
this.vetService = vetService;
this.specialtyService = specialtyService;
this.petTypeService = petTypeService;
this.visitService = visitService;
}
@Override
public void run(String... args) throws Exception {
if (petTypeService.findAll().size() == 0) {
loadData();
}
}
private void loadData() {
Specialty radiology = new Specialty();
radiology.setDescription("Radiology");
Specialty surgery = new Specialty();
surgery.setDescription("Surgery");
Specialty dentistry = new Specialty();
dentistry.setDescription("Dentistry");
Arrays.asList(new Specialty[]{radiology, surgery, dentistry}).forEach(specialtyService::save);
PetType dog = new PetType("Dog");
PetType savedDogPetType = petTypeService.save(dog);
PetType cat = new PetType("Cat");
PetType savedCatType = petTypeService.save(cat);
Owner pero = new Owner();
pero.setFirstName("Pero");
pero.setLastName("Peric");
pero.setAddress("Ulica1");
pero.setCity("Grad1");
pero.setTelephone("12345");
Pet perosDog = new Pet();
perosDog.setPetType(savedDogPetType);
perosDog.setOwner(pero);
perosDog.setName("Medo");
perosDog.setBirthDate(LocalDate.now());
pero.getPets().add(perosDog);
Owner ivan = new Owner();
ivan.setFirstName("Ivan");
ivan.setLastName("Ivic");
ivan.setAddress("Ulica2");
ivan.setCity("Grad2");
ivan.setTelephone("543341");
Pet ivansCat = new Pet();
ivansCat.setPetType(savedCatType);
ivansCat.setOwner(ivan);
ivansCat.setName("mica");
ivansCat.setBirthDate(LocalDate.now());
ivan.getPets().add(ivansCat);
ownerService.save(pero);
ownerService.save(ivan);
Visit visit = new Visit();
visit.setPet(ivansCat);
visit.setDate(LocalDate.now());
visit.setDescription("Boli ju sapa");
visitService.save(visit);
System.out.println("Loaded owners...");
Vet vet1 = new Vet();
vet1.setFirstName("Marko");
vet1.setLastName("Maric");
vet1.getSpecialties().add(radiology);
Vet vet2 = new Vet();
vet2.setFirstName("Ivan");
vet2.setLastName("Horvat");
vet2.getSpecialties().add(surgery);
vet2.getSpecialties().add(dentistry);
vetService.save(vet1);
vetService.save(vet2);
System.out.println("Loaded vets...");
}
} | [
"t.podunaj@gmail.com"
] | t.podunaj@gmail.com |
bc2e31a78023d8427201c14c09d1f26258b7e8d3 | 25abb3e2162d8219ab5c4697f2f25c5d8239a15b | /multithreading_course/src/main/java/net/golovach/_5_lecture15_forkjoin/App00_iterative_2.java | b5e7a7370f3b09af3897c846b9af7c48da714f34 | [] | no_license | kruart/concurrency_learning | 6821a35a1712efec8f9c7420aac8a22eb03b0d82 | 151e4c5b2543c859844ab06bb33e35a851cd1adc | refs/heads/master | 2021-08-14T17:15:07.107383 | 2017-10-28T10:45:33 | 2017-10-28T10:45:33 | 110,950,978 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,459 | java | package net.golovach._5_lecture15_forkjoin;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicLong;
/**
* Created by kruart on 06.10.2017.
*/
public class App00_iterative_2 {
public static void main(String[] args) throws InterruptedException {
AtomicLong result = new AtomicLong(0);
int cpuCount = Runtime.getRuntime().availableProcessors();
ExecutorService pool = Executors.newFixedThreadPool(cpuCount);
final CountDownLatch latch = new CountDownLatch(100);
long a = System.currentTimeMillis();
for (int k = 0; k < 100; k++) {
final int finalK = k;
pool.submit(() -> {
//[0 ... 9999], [10000 ... 19999], ...
long localResult = calc(10_000 * finalK, 10_000 * (finalK + 1));
result.addAndGet(localResult);
latch.countDown();
});
}
//final barrier
latch.await();
System.out.println(System.currentTimeMillis() - a);
System.out.println(result);
pool.shutdown();
}
private static long calc(int from, int to) {
long result = 0;
for (int index = from; index < to; index++) {
if (index % 3 != 0 && index % 5 != 0) {
result += index;
}
}
return result;
}
}
| [
"weoz@ukr.net"
] | weoz@ukr.net |
2e4fb6e4df77e0773ecbefb3b149d92419934586 | 6d60f562040af8c33162511a57e840098783cd9c | /src/main/java/demo/design/constant/ResponseConstant.java | 611f5eeef9adb10ba39994a99b3759310919e0ec | [] | no_license | ashutosh0188/RestApiCustomResponseDesign | 0a14e2671b758ff0b23bf01bd3341882d863e25e | f2a489081cf3d4f77201a826e4e5216e743ffa99 | refs/heads/master | 2022-05-26T18:36:04.752658 | 2020-05-02T16:21:47 | 2020-05-02T16:21:47 | 256,458,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 509 | java | package demo.design.constant;
public enum ResponseConstant
{
SUCCESS(200), FAILURE(400), INTERNAL_SERVER_ERROR(500), UNDER_MAINTENANCE(503);
private int code;
ResponseConstant(int i)
{
this.code = i;
}
public String code()
{
return Integer.toString(code);
}
public static ResponseConstant fromValue(int val)
{
for(ResponseConstant r : ResponseConstant.values())
{
if(val == r.code)
{
return r;
}
}
throw new IllegalArgumentException("Illegal enum constant "+val);
}
}
| [
"as011r@att.com"
] | as011r@att.com |
a8f40d631184cbd923fd082d24a0fae623fc5657 | a8e498096b5f3ab2d74320cf1b049dea237c5dc6 | /Best Computer Managment/Presentation/ValidateData.java | 90d01ca8c1771f4042690f55c016b354256a0e5a | [] | no_license | noarrassam/BestComputerManagment | df1b466558d728eae83232290d1beccbbf62ae4c | a5112c0f9171870c017555105b580aab726d5da8 | refs/heads/master | 2023-05-04T10:38:19.652303 | 2021-05-21T04:56:12 | 2021-05-21T04:56:12 | 368,334,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,161 | java | package Presentation;
import java.sql.Date;
import javax.swing.JCheckBox;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.text.JTextComponent;
import com.toedter.calendar.JDateChooser;
public class ValidateData {
public static boolean isPresent(JTextComponent c, String title) {
if (c.getText().length() == 0) {
showMessage(c, title + " is a required field.\nPlease re-enter. ");
c.requestFocusInWindow();
return false;
}
return true;
}
public static boolean isInt(JTextComponent c, String title) {
try {
int d = Integer.parseInt(c.getText());
return true;
} catch (NumberFormatException e) {
showMessage(c, title + " must be valid number.\n Please re-enter. ");
c.requestFocusInWindow();
return false;
}
}
public static boolean isDate(JDateChooser c, String title) {
try {
if(
((JTextField)c.getDateEditor().getUiComponent()).getText().isEmpty())
{
showMessage(c, title + " is Invalid" );
return false;
}
return true;
} catch (NumberFormatException e) {
c.requestFocusInWindow();
return false;
}
}
public static boolean isChecked(JCheckBox c, String title) {
try {
c.setSelected(true);
return true;
} catch (NumberFormatException e) {
showMessageCheckBox(c, title + " must be valid number.\n Please re-enter. ");
c.requestFocusInWindow();
return false;
}
}
private static void showMessage(JDateChooser c, String message) {
JOptionPane.showMessageDialog(c, message, "Invalid Entry", JOptionPane.ERROR_MESSAGE);
}
private static void showMessage(JTextField c, char[] message) {
JOptionPane.showMessageDialog(c, message, "Invalid Entry", JOptionPane.ERROR_MESSAGE);
}
private static void showMessage(JTextComponent c, String message) {
JOptionPane.showMessageDialog(c, message, "Invalid Entry", JOptionPane.ERROR_MESSAGE);
}
private static void showMessageCheckBox(JCheckBox c, String message) {
JOptionPane.showMessageDialog(c, message, "Invalid Entry", JOptionPane.ERROR_MESSAGE);
}
} | [
"“noor.s.rassam@gmail.com”"
] | “noor.s.rassam@gmail.com” |
044333b91fa98d80389f61a9b6a31a4fc7fe1528 | 020a39f299da4773aa6958c93953d1f257848819 | /app/build/generated/source/kapt/debug/hilt_aggregated_deps/com_hh_coffeevenues_ui_vanuesList_VenuesListViewModel_HiltModuleModuleDeps.java | 236bd7a8464f9c37f4ca5bb7bf5ae9b2b55c43d5 | [] | no_license | heliahs/VenuesNearMe | f65103425df5207f42d8b7673aeda996f1965632 | a7c39be944af3cd2ed9774244f7f2e22b131631b | refs/heads/main | 2023-04-05T01:31:08.903941 | 2021-04-12T17:42:33 | 2021-04-12T17:42:33 | 357,278,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package hilt_aggregated_deps;
import dagger.hilt.processor.internal.aggregateddeps.AggregatedDeps;
import javax.annotation.Generated;
/**
* Generated class to pass information through multiple javac runs.
*/
@AggregatedDeps(
components = "dagger.hilt.android.components.ActivityRetainedComponent",
modules = "com.hh.coffeevenues.ui.vanuesList.VenuesListViewModel_HiltModule"
)
@Generated("dagger.hilt.processor.internal.aggregateddeps.AggregatedDepsGenerator")
class com_hh_coffeevenues_ui_vanuesList_VenuesListViewModel_HiltModuleModuleDeps {
}
| [
"helia.hosseinioun@gmail.com"
] | helia.hosseinioun@gmail.com |
f922aec563571500f8273ccfb3edbe4436f27544 | b5de937de273585c5293d24cd39493bc381699ad | /src/main/java/cww/world/mapper/trace/ModuleOperationTraceMapper.java | 1752990b1424437de1cbda90ec9a1782bcba5009 | [] | no_license | mxfdsy/cww.wrold | 742d7996f603e84d2af4b05ad61940c5bbca1889 | 8d9a5c009a1b1e83bbf1f83fd3a73b83e6c4658b | refs/heads/master | 2020-03-26T05:31:45.346812 | 2018-09-06T09:18:50 | 2018-09-06T09:18:50 | 144,561,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package cww.world.mapper.trace;
import cww.world.pojo.po.trace.ModuleOperationTracePO;
import org.apache.ibatis.annotations.Mapper;
/**
* @author cww
*/
@Mapper
public interface ModuleOperationTraceMapper {
int insertModuleOperationTrace(ModuleOperationTracePO brandOperationTracePO);
}
| [
"chengww@lmfun.cn"
] | chengww@lmfun.cn |
9ec2b832412a32e3fe7932cd0603559ff104c9f3 | 58d7ff7c645c26771faae523e4ccb1e8f932b3e8 | /MUD/model/world/OgreCave.java | af2837a7a7f2bea795d3ec65b5310381bf4c818e | [] | no_license | djeisenberg/Academic | c0ac2de7462498db0edbce91a0265e6460506637 | c5d0c0c9b57b74d11472b79986f7c16e06e60771 | refs/heads/master | 2021-01-18T18:31:58.782391 | 2015-04-23T18:59:03 | 2015-04-23T18:59:03 | 24,281,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,498 | java | package model.world;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CopyOnWriteArrayList;
import model.creatures.Monster;
import model.creatures.ogredungeon.Beast;
import model.creatures.ogredungeon.Chieftain1;
import model.creatures.ogredungeon.Chieftain2;
import model.creatures.ogredungeon.Chieftain3;
import model.creatures.ogredungeon.Chieftain4;
import model.creatures.ogredungeon.Chieftain5;
import model.creatures.ogredungeon.Ogre;
import model.creatures.ogredungeon.Rager;
import model.creatures.ogredungeon.Shaman;
public class OgreCave implements Serializable, Zone{
private static final long serialVersionUID = 1L;
private int dID;
private Room entrance;
private ArrayList<Room> dungeon;
private ArrayList<Room> bossroom;
private ArrayList<Room> movablerooms;
private CopyOnWriteArrayList<Monster> mobs;
public OgreCave(int size)
{
dungeon = new ArrayList<Room>();
bossroom = new ArrayList<Room>();
mobs = new CopyOnWriteArrayList<Monster>();
movablerooms = new ArrayList<Room>();
dID = 300;
Random x = new Random();
int number = 0;
int temp = 0;
dungeon.add(new Room(300, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(301, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(302, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(303, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(304, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(305, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(306, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(307, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(308, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(309, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(310, "", "icons" + File.separator + "default.png"));
dungeon.add(new Room(311, "", "icons" + File.separator + "default.png"));
entrance = dungeon.get(0);
dungeon.get(0).setSouth(dungeon.get(1));
dungeon.get(1).setNorth(dungeon.get(0));
dungeon.get(1).setWest(dungeon.get(2));
dungeon.get(1).setEast(dungeon.get(7));
dungeon.get(2).setEast(dungeon.get(1));
dungeon.get(2).setSouth(dungeon.get(3));
dungeon.get(2).setDown(dungeon.get(8));
dungeon.get(2).setUp(dungeon.get(10));
dungeon.get(3).setNorth(dungeon.get(2));
dungeon.get(3).setSouth(dungeon.get(4));
dungeon.get(3).setEast(dungeon.get(5));
dungeon.get(4).setNorth(dungeon.get(3));
dungeon.get(4).setDown(dungeon.get(9));
dungeon.get(5).setWest(dungeon.get(3));
dungeon.get(5).setSouth(dungeon.get(6));
dungeon.get(6).setNorth(dungeon.get(5));
dungeon.get(6).setSouth(dungeon.get(11));
dungeon.get(7).setWest(dungeon.get(1));
dungeon.get(8).setSouth(dungeon.get(9));
dungeon.get(8).setUp(dungeon.get(2));
dungeon.get(9).setNorth(dungeon.get(8));
dungeon.get(9).setUp(dungeon.get(4));
dungeon.get(10).setNorth(dungeon.get(2));
dungeon.get(11).setNorth(dungeon.get(6));
bossroom.add(dungeon.get(11));
movablerooms = dungeon;
movablerooms.remove(11);
movablerooms.remove(0);
switch(size){
case 1:
mobs.add(new Chieftain1());
number = 10;
temp = x.nextInt(1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Shaman(movablerooms));
temp = x.nextInt((1) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Rager(movablerooms));
temp = x.nextInt((1) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Beast(movablerooms));
for(int i = 0; i < number; i++)
mobs.add(new Ogre(movablerooms));
break;
case 2:
mobs.add(new Chieftain2());
number = 15;
temp = x.nextInt(2);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Shaman(movablerooms));
temp = x.nextInt((2) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Rager(movablerooms));
temp = x.nextInt((2) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Beast(movablerooms));
for(int i = 0; i < number; i++)
mobs.add(new Ogre(movablerooms));
break;
case 3:
mobs.add(new Chieftain3());
number = 20;
temp = x.nextInt((2) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Shaman(movablerooms));
temp = x.nextInt((3) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Rager(movablerooms));
temp = x.nextInt((5) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Beast(movablerooms));
for(int i = 0; i < number; i++)
mobs.add(new Ogre(movablerooms));
break;
case 4:
mobs.add(new Chieftain4());
number = 25;
temp = x.nextInt((2) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Shaman(movablerooms));
temp = x.nextInt((5) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Rager(movablerooms));
temp = x.nextInt((7) + 1);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Beast(movablerooms));
for(int i = 0; i < number; i++)
mobs.add(new Ogre(movablerooms));
break;
case 5:
mobs.add(new Chieftain5());
number = 30;
temp = x.nextInt((3) + 2);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Shaman(movablerooms));
temp = x.nextInt((5) + 3);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Rager(movablerooms));
temp = x.nextInt((5) + 3);
number -= temp;
for(int i = 0; i < temp; i++)
mobs.add(new Beast(movablerooms));
for(int i = 0; i < number; i++)
mobs.add(new Ogre(movablerooms));
break;
}
mobs.get(0).setRoom(bossroom.get(0));
for(int i = 1; i < mobs.size(); i++)
{
Collections.shuffle(movablerooms);
mobs.get(i).setRoom(movablerooms.get(0));
}
}
@Override
public int getDungeonID(){
return dID;
}
public ArrayList<Room> listBossRooms(){
return bossroom;
}
public ArrayList<Room> listNotBossRooms(){
return movablerooms;
}
@Override
public List<Monster> listMobs(){
return mobs;
}
public ArrayList<Room> listRooms() {
return dungeon;
}
@Override
public Room getEntrance() {
return entrance;
}
}
| [
"eisenberg.d.j@gmail.com"
] | eisenberg.d.j@gmail.com |
ab80957789ec293922b3ddc3ee2d04df92a99431 | fa817fe270944adbf59979244effb8344e0e844e | /src/main/java/com/malintha/thread/signaling/FireMessage.java | 8764188c9ce231de33823eb30e30558ff971e627 | [] | no_license | malinthasa/java_threading | d58e423689c249aebc0eef01601653950aa505ac | 993171b311f5f221377de3453c25377133b4f3f2 | refs/heads/master | 2021-01-10T07:51:42.632390 | 2015-12-21T05:13:28 | 2015-12-21T05:13:28 | 48,127,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.malintha.thread.signaling;
/**
* Created by malintha on 12/17/15.
*/
public class FireMessage {
private String message;
public FireMessage(String fm){
message=fm;
}
public void setMessage(String fm){
message=fm;
}
public String getMessage(){
return message;
}
}
| [
"malintha@wso2.com"
] | malintha@wso2.com |
b9a9676e5ac82ee1bd1452612b8d5271083a59e2 | aa001d2eb58cf558c3cc6da47e0377ea4f29e9e6 | /app/src/main/java/com/example/capstonedesign/schedule/ItemClickListener.java | 4bcba079fd0bd1ef5eb15e3c5ac8063951c1284b | [] | no_license | Capstone-Medium-Distance-App/Capstone-MDA-Android | ceac2810b3cee8acfdab8db0588749748323ec31 | cc9dc44534391bed759cf12b67d8e4907cc42708 | refs/heads/master | 2023-06-03T19:37:35.960796 | 2021-06-17T07:29:52 | 2021-06-17T07:29:52 | 355,448,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 164 | java | package com.example.capstonedesign.schedule;
import android.view.View;
public interface ItemClickListener {
void onItemClickListener(View v, int position);
}
| [
"ysw8160@naver.com"
] | ysw8160@naver.com |
e9eb30f76db011dc24425e39878e34a4afbe054e | d9ea338dfde4b3124ed1f805adf968514ff32731 | /interview-prep/src/main/java/com/interview/algos/arrays/PairsCountDistinctSubArrays.java | 642a5cf404538e108503baaad7d1ec8dc7c309cf | [] | no_license | ramcode/Coding-Practice | e88d6cecd8870fe6947a797180d20786c9b9a10c | 7f317d090901e5053b38896011d1a8c7a9950910 | refs/heads/master | 2021-01-12T06:25:39.282933 | 2017-01-19T07:20:30 | 2017-01-19T07:20:30 | 77,358,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package com.interview.algos.arrays;
public class PairsCountDistinctSubArrays {
public static int countPairsFormedFromDistinctSubArrays(int[] input){
int count = 0;
int l=0, r=0;
boolean[] visited = new boolean[input.length];
while(r<input.length){
while(r<input.length && !visited[input[r]]){
count = count + (r-l);
visited[input[r]] = true;
r++;
}
while(l<r && r<input.length && visited[input[r]]){
visited[input[l]] = false;
l++;
}
}
return count;
}
public static void main(String[] args){
System.out.println(countPairsFormedFromDistinctSubArrays(new int[]{1,1,1,1,1,1,1}));
}
}
| [
"ramesh.thetakali@gmail.com"
] | ramesh.thetakali@gmail.com |
225759b0862f112b73e5b98890d099c34054bd88 | 87873856a23cd5ebdcd227ef39386fb33f5d6b13 | /codingame/src/main/java/io/jsd/training/codingame/bender/PathFromXObstacle.java | 6774035d5400c4b0aa14d3816de87333202e5581 | [] | no_license | jsdumas/java-training | da204384223c3e7871ccbb8f4a73996ae55536f3 | 8df1da57ea7a5dd596fea9b70c6cd663534d9d18 | refs/heads/master | 2022-06-28T16:08:47.529631 | 2019-06-06T07:49:30 | 2019-06-06T07:49:30 | 113,677,424 | 0 | 0 | null | 2022-06-20T23:48:24 | 2017-12-09T14:55:56 | Java | UTF-8 | Java | false | false | 358 | java | package io.jsd.training.codingame.bender;
public class PathFromXObstacle implements PathFinder {
private final NextCase nextCase;
public PathFromXObstacle(CaseArea area, boolean isInverted, boolean isXBreaker) {
this.nextCase = new NextCase(area, isInverted, isXBreaker);
}
@Override
public Case getNextCase() {
return nextCase.getCase();
}
}
| [
"jsdumas@free.fr"
] | jsdumas@free.fr |
38b662e27aae73aa218e3200ee5e0608616c1026 | f4c47e7f7ddaba7a2769bf1ad3322b6d958c37a3 | /Chapter07/testEmployee.java | e060686c5266d8641c28c36722b4484c01496742 | [] | no_license | gingerbeardman/introduction-to-programming-using-java | ec37ee10b68b76902500ee357bd8d8287700fb52 | 97079f3b765e14e88528ee51ab3bcd3b1a0bb938 | refs/heads/master | 2023-03-04T14:04:52.269402 | 2021-02-20T13:18:25 | 2021-02-20T13:18:25 | 340,658,881 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | //------------
// Introduction to Programming Using Java: An Object-Oriented Approach
// Arnow/Weiss
//------------
//------------
// Chapter / Section / Page
//
//------------
//------------
// Notes
// - This program requires the Employee class containing
// a testDriver method
//------------
class testEmployee {
public static void main(String[] a) {
Employee.testDriver();
}
} | [
"matt@gingerbeardman.com"
] | matt@gingerbeardman.com |
70ac2207d7f35e10f3bf77a72bb7ce77ed922d9c | f610795b98b84641cc312686316fa08589fece13 | /helidon-se-reactive/src/main/java/org/neo4j/examples/jvm/helidon/se/reactive/package-info.java | ac2e147ea6eacec778aae9e23692c1097df7f08e | [] | no_license | quantum-adrenaline-1/neo4j-from-the-jvm-ecosystem | 6873743307f5b8fb4ced4c2880e03d375ad6ae09 | 9a31916ccdf97c648230b763c935d23fb1f7b5b8 | refs/heads/master | 2023-02-11T20:43:34.633651 | 2021-01-06T20:34:21 | 2021-01-06T20:34:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java |
package org.neo4j.examples.jvm.helidon.se.reactive;
| [
"michael.simons@neo4j.com"
] | michael.simons@neo4j.com |
c996594befbd985766beb9483578669a56a94cb5 | f2e0b144739a8bcd1eceb9fef30de821c8fc7f08 | /core/src/com/allsopg/game/utility/UniversalResource.java | e39ec50e9104a43477a996d201c9cc8d5cdf5b0e | [] | no_license | BradleyTesterSpratt/2017_18_A1-UTweenManager | 08a1d9c462e94ed59feea5ff50de1b4be4cdbe55 | 9cc9cef3e1668df2b46fa68aa28ad8e906c55dba | refs/heads/master | 2021-04-30T04:03:13.969276 | 2018-02-19T17:23:56 | 2018-02-19T17:23:56 | 121,527,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package com.allsopg.game.utility;
import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenManager;
/**
* Created by gja10 on 13/11/2017.
*/
public class UniversalResource {
public TweenManager tweenManager;
private static UniversalResource instance;
public static UniversalResource getInstance(){
if(instance==null){
instance = new UniversalResource();
}
return instance;
}
private UniversalResource(){configure();}
public void configure(){
Tween.setCombinedAttributesLimit(4);
tweenManager = new TweenManager();
Tween.registerAccessor(TweenData.class,
new TweenDataAccessor());
}
}
| [
"B.Tester1@uni.brighton.ac.uk"
] | B.Tester1@uni.brighton.ac.uk |
e928324642bc00937d79451050fb928ae0ca5c47 | 65423f57d25e34d9440bf894584b92be29946825 | /target/generated-sources/xjc/com/clincab/web/app/eutils/jaxb/e2br3/MCCIMT100200UV01EntityRsp.java | db738ae712f70a8333109bff91aeb85bd2f3de3c | [] | no_license | kunalcabcsi/toolsr3 | 0b518cfa6813a88a921299ab8b8b5d6cbbd362fe | 5071990dc2325bc74c34a3383792ad5448dee1b0 | refs/heads/master | 2021-08-31T04:20:23.924815 | 2017-12-20T09:25:33 | 2017-12-20T09:25:33 | 114,867,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,159 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.12.20 at 02:30:39 PM IST
//
package com.clincab.web.app.eutils.jaxb.e2br3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for MCCI_MT100200UV01.EntityRsp complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="MCCI_MT100200UV01.EntityRsp">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <group ref="{urn:hl7-org:v3}InfrastructureRootElements"/>
* <element name="id" type="{urn:hl7-org:v3}II"/>
* <element name="name" type="{urn:hl7-org:v3}EN" maxOccurs="unbounded" minOccurs="0"/>
* <element name="telecom" type="{urn:hl7-org:v3}TEL" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attGroup ref="{urn:hl7-org:v3}InfrastructureRootAttributes"/>
* <attribute name="nullFlavor" type="{urn:hl7-org:v3}NullFlavor" />
* <attribute name="classCode" use="required" type="{urn:hl7-org:v3}EntityClassRoot" />
* <attribute name="determinerCode" use="required" type="{urn:hl7-org:v3}EntityDeterminerSpecific" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MCCI_MT100200UV01.EntityRsp", propOrder = {
"realmCode",
"typeId",
"templateId",
"id",
"name",
"telecom"
})
public class MCCIMT100200UV01EntityRsp {
protected List<CS> realmCode;
protected II typeId;
protected List<II> templateId;
@XmlElement(required = true)
protected II id;
protected List<EN> name;
protected List<TEL> telecom;
@XmlAttribute(name = "nullFlavor")
protected NullFlavor nullFlavor;
@XmlAttribute(name = "classCode", required = true)
protected EntityClassRoot classCode;
@XmlAttribute(name = "determinerCode", required = true)
protected EntityDeterminerSpecific determinerCode;
/**
* Gets the value of the realmCode property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the realmCode property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRealmCode().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CS }
*
*
*/
public List<CS> getRealmCode() {
if (realmCode == null) {
realmCode = new ArrayList<CS>();
}
return this.realmCode;
}
/**
* Gets the value of the typeId property.
*
* @return
* possible object is
* {@link II }
*
*/
public II getTypeId() {
return typeId;
}
/**
* Sets the value of the typeId property.
*
* @param value
* allowed object is
* {@link II }
*
*/
public void setTypeId(II value) {
this.typeId = value;
}
/**
* Gets the value of the templateId property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the templateId property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getTemplateId().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link II }
*
*
*/
public List<II> getTemplateId() {
if (templateId == null) {
templateId = new ArrayList<II>();
}
return this.templateId;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link II }
*
*/
public II getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link II }
*
*/
public void setId(II value) {
this.id = value;
}
/**
* Gets the value of the name property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the name property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getName().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link EN }
*
*
*/
public List<EN> getName() {
if (name == null) {
name = new ArrayList<EN>();
}
return this.name;
}
/**
* Gets the value of the telecom property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the telecom property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getTelecom().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link TEL }
*
*
*/
public List<TEL> getTelecom() {
if (telecom == null) {
telecom = new ArrayList<TEL>();
}
return this.telecom;
}
/**
* Gets the value of the nullFlavor property.
*
* @return
* possible object is
* {@link NullFlavor }
*
*/
public NullFlavor getNullFlavor() {
return nullFlavor;
}
/**
* Sets the value of the nullFlavor property.
*
* @param value
* allowed object is
* {@link NullFlavor }
*
*/
public void setNullFlavor(NullFlavor value) {
this.nullFlavor = value;
}
/**
* Gets the value of the classCode property.
*
* @return
* possible object is
* {@link EntityClassRoot }
*
*/
public EntityClassRoot getClassCode() {
return classCode;
}
/**
* Sets the value of the classCode property.
*
* @param value
* allowed object is
* {@link EntityClassRoot }
*
*/
public void setClassCode(EntityClassRoot value) {
this.classCode = value;
}
/**
* Gets the value of the determinerCode property.
*
* @return
* possible object is
* {@link EntityDeterminerSpecific }
*
*/
public EntityDeterminerSpecific getDeterminerCode() {
return determinerCode;
}
/**
* Sets the value of the determinerCode property.
*
* @param value
* allowed object is
* {@link EntityDeterminerSpecific }
*
*/
public void setDeterminerCode(EntityDeterminerSpecific value) {
this.determinerCode = value;
}
}
| [
"ksingh@localhost.localdomain"
] | ksingh@localhost.localdomain |
d3d1529e9edcb6095c6f3146ed83dda27cbbf986 | f5013bb8f8fd2fbbb70d487a09a55a4db2e25aef | /src/main/java/space/gatt/kbb/commands/user/IsStreamingCommand.java | 0f6ede39525f7324f32123b30c5d5e3b483bc7ad | [] | no_license | megadrive/BajosPantsBot | 228f7c71c4fc7cf9c431027fb04518d56679a537 | e3f70bf6e0224fb97b95128c44ac19ca4a1dca12 | refs/heads/master | 2020-12-03T01:56:22.586611 | 2017-05-17T09:11:56 | 2017-05-17T09:11:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,910 | java | package space.gatt.kbb.commands.user;
import com.google.gson.JsonElement;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.Message;
import space.gatt.kbb.KingMain;
import space.gatt.kbb.annotations.*;
import space.gatt.kbb.commandmanager.ReturnMessage;
import space.gatt.kbb.streamtracker.StreamTracker;
import java.awt.*;
@Command("isstreaming")
@Syntax("isstreaming")
@Permissions(ranks = {"309931902612144128"}, ranksById = true)
@Usage("isstreaming")
@Description("Is the guy streaming?")
@Group("user")
public class IsStreamingCommand {
@IMethod
public static ReturnMessage command(Message message, Member user, String[] args) {
StreamTracker tracker = KingMain.getStreamTracker();
JsonElement check = tracker.getStreamData(args[0].replaceAll("#", "").toLowerCase());
boolean isStreaming = tracker.isStreamLive(check);
if (isStreaming) {
return new ReturnMessage().setColor(Color.GREEN).setMessage(KingMain.getEmoteStorage().get("gasp")
.getAsMention() + " Oh wow, " + args[0] + " is streaming! Here's their information!\n" +
"\n\n__**[Now Playing:]()**__ " + check.getAsJsonObject().get("game")
.getAsString()
+ "\n__**[Stream Title:]()**__ " + check.getAsJsonObject().get(
"channel").getAsJsonObject().get("status").getAsString()
+ "\n__**[Viewers:]()**__ " + check.getAsJsonObject().get("viewers")
.getAsString())
.setThumbnailURL(check.getAsJsonObject().get("channel").getAsJsonObject()
.get("logo").getAsString())
.setDisplayURL("https://twitch.tv/" + args[0]).setTitle("Twitch.TV Updates")
.setImageURL(check.getAsJsonObject().get("preview").getAsJsonObject()
.get("large").getAsString());
} else {
return new ReturnMessage().setColor(Color.RED).setMessage(KingMain.getEmoteStorage().get("gasp")
.getAsMention() + " " + args[0] + " isn't streaming currently...");
}
}
}
| [
"zacharygatt@me.com"
] | zacharygatt@me.com |
06e45b941f57d3a7a366622ad78e9e154ac47585 | 0f99cbf58c5643b7cd60e7664062e80102c45891 | /JQFZest/GregorianCalendar/CalendarLogic.java | 7b9c514ebfcdde8f92f1979195c24e468c559e83 | [] | no_license | alexissa32/SWTestingFinalProject | 8a4784547dbebf8290483686aaf4b09f2e5162eb | ba9cf4e84af313fd3112981cf8aeab2ef1cce013 | refs/heads/master | 2020-09-29T04:03:44.791659 | 2019-12-09T19:19:14 | 2019-12-09T19:19:14 | 226,945,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,507 | java | import java.util.GregorianCalendar;
import static java.util.GregorianCalendar.*;
/* Application logic */
public class CalendarLogic {
// Returns true iff cal is in a leap year
public static boolean isLeapYear(GregorianCalendar cal) {
int year = cal.get(YEAR);
if (year % 4 == 0) {
if (year % 100 == 0) {
return false;
}
return true;
}
return false;
}
// Returns either of -1, 0, 1 depending on whether c1 is <, =, > than c2
public static int compare(GregorianCalendar c1, GregorianCalendar c2) {
int cmp;
cmp = Integer.compare(c1.get(YEAR), c2.get(YEAR));
if (cmp == 0) {
cmp = Integer.compare(c1.get(MONTH), c2.get(MONTH));
if (cmp == 0) {
cmp = Integer.compare(c1.get(DAY_OF_MONTH), c2.get(DAY_OF_MONTH));
if (cmp == 0) {
cmp = Integer.compare(c1.get(HOUR), c2.get(HOUR));
if (cmp == 0) {
cmp = Integer.compare(c1.get(MINUTE), c2.get(MINUTE));
if (cmp == 0) {
cmp = Integer.compare(c1.get(SECOND), c2.get(SECOND));
if (cmp == 0) {
cmp = Integer.compare(c1.get(MILLISECOND), c2.get(MILLISECOND));
}
}
}
}
}
}
return cmp;
}
} | [
"alex.issa32@utexas.edu"
] | alex.issa32@utexas.edu |
f0ffe2e5ad5b511e0e830f3d1ec8551124de610a | 04a650ab22f0d55f7071af79b911fd7d9d31a21d | /src/test/java/com/xgj/cache/initData2CacheByOriginalMap/InitData2CacheTest.java | f16d0db78ba52532b0295169acfdc3db86058d30 | [] | no_license | edidada/SpringMaster | ae77dc484b51c65ce23983f52082bb62c675cb74 | de924112a0aa184100bbfade3b9da12086598832 | refs/heads/master | 2020-11-30T07:45:39.826035 | 2019-12-27T08:10:34 | 2019-12-27T08:10:34 | 230,350,216 | 0 | 0 | null | 2019-12-27T01:16:16 | 2019-12-27T01:16:15 | null | GB18030 | Java | false | false | 1,076 | java | package com.xgj.cache.initData2CacheByOriginalMap;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.xgj.cache.initData2CacheByOriginalMap.domain.LittleArtisan;
import com.xgj.cache.initData2CacheByOriginalMap.service.ArtisanService;
public class InitData2CacheTest {
ClassPathXmlApplicationContext ctx = null;
ArtisanService service = null;
@Before
public void initContext() {
// 启动Spring 容器
ctx = new ClassPathXmlApplicationContext(
"classpath:com/xgj/cache/initData2CacheByOriginalMap/conf_spring.xml");
System.out.println("initContext successfully");
}
@Test
public void testInit2Cache() {
// 从Map中获取保存的缓存数据
LittleArtisan artisan = ArtisanService.artisanMap.get("littleArtisan");
System.out.println(artisan.getArtisanId() + "||"
+ artisan.getArtisanDesc());
}
@After
public void closeContext() {
if (ctx != null) {
ctx.close();
}
System.out.println("close context successfully");
}
}
| [
"815150141@qq.com"
] | 815150141@qq.com |
bd24c2c0f2dc4ed5b0794f98fbe92a0ba4bf8aab | 1d0a11e2ae7bfd48dacf96eb176c46a8b4691265 | /app/src/androidTest/java/com/threemoji/threemoji/TestRegistrationIntentService.java | 67826fa0ca9b380aaaafe95d965318000b8aced9 | [] | no_license | threemoji/threemoji | 88ef0d779d3a620fa36c009d6ba28eda7a291bf5 | 20d43056ab4a374d83be0aa972f62e815c0c8ce2 | refs/heads/master | 2020-04-06T03:50:38.442549 | 2015-08-12T09:02:18 | 2015-08-12T09:02:18 | 35,469,143 | 7 | 0 | null | 2015-07-03T08:26:24 | 2015-05-12T05:41:52 | Java | UTF-8 | Java | false | false | 732 | java | package com.threemoji.threemoji;
import com.threemoji.threemoji.service.RegistrationIntentService;
import android.test.AndroidTestCase;
public class TestRegistrationIntentService extends AndroidTestCase {
public static final String LOG_TAG = TestRegistrationIntentService.class.getSimpleName();
public void testGetNextMsgId() {
String token = "d9gdez4BpZo:APA91bEMAiAOZgi6HYtVVPlrS1dLrknh7gN9JdUMnGe9zkBKZ_SX2kyG8OTngxrKtUBbJuzBAIJ5dzWSVICk0ShokuoditzYqJQCCYt7IlG3juA8I7HIBOc";
RegistrationIntentService service = new RegistrationIntentService();
String msgId = service.getNextMsgId(token);
assertEquals(msgId.substring(0, 5), "HIBOc");
assertEquals(msgId.length(), 18);
}
}
| [
"sebq13@gmail.com"
] | sebq13@gmail.com |
416f86a01f2af3a93e51e4ce4c55eceaa501151d | b0e8a10ce7df875636538c978e0c88300236106e | /weindex.weibo4j/src/main/java/ca/weindex/weibo4j/Favorite.java | 0ee06f7a63a6326399de056560f0ca6a579e6bb5 | [] | no_license | yuz835/weindex | 0a9bbd927d7aba2804726db50affdc9775145aa2 | f0307d479ada7c71e69d1994d073dfe10908b013 | refs/heads/master | 2021-01-10T00:57:50.139197 | 2015-12-31T06:22:40 | 2015-12-31T06:22:40 | 48,835,086 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,423 | java | package ca.weindex.weibo4j;
import java.util.List;
import ca.weindex.weibo4j.model.Favorites;
import ca.weindex.weibo4j.model.FavoritesTag;
import ca.weindex.weibo4j.model.Paging;
import ca.weindex.weibo4j.model.PostParameter;
import ca.weindex.weibo4j.model.Tag;
import ca.weindex.weibo4j.model.WeiboException;
import ca.weindex.weibo4j.org.json.JSONException;
import ca.weindex.weibo4j.org.json.JSONObject;
import ca.weindex.weibo4j.util.WeiboConfig;
public class Favorite extends Weibo{
/**
*
*/
private static final long serialVersionUID = 2298934944028795652L;
/*----------------------------收藏接口----------------------------------------*/
/**
* 获取当前登录用户的收藏列表
*
* @return list of the Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.1
* @see <a href="http://open.weibo.com/wiki/2/favorites">favorites</a>
* @since JDK 1.5
*/
public List<Favorites> getFavorites() throws WeiboException {
return Favorites.constructFavorites(client.get(WeiboConfig
.getValue("baseURL") + "favorites.json"));
}
/**
* 获取当前登录用户的收藏列表
*
* @param page
* 、count
* @return list of the Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.1
* @see <a href="http://open.weibo.com/wiki/2/favorites">favorites</a>
* @since JDK 1.5
*/
public List<Favorites> getFavorites(Paging page) throws WeiboException {
return Favorites.constructFavorites(client.get(
WeiboConfig.getValue("baseURL") + "favorites.json",
null, page));
}
/**
* 获取当前登录用户的收藏列表ID
*
* @return list of the Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.1
* @see <a href="http://open.weibo.com/wiki/2/favorites">favorites</a>
* @since JDK 1.5
*/
public JSONObject getFavoritesIds() throws WeiboException {
return client.get(WeiboConfig
.getValue("baseURL") + "favorites/ids.json").asJSONObject();
}
/**
* 获取当前登录用户的收藏列表ID
*
* @return list of the Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.1
* @see <a href="http://open.weibo.com/wiki/2/favorites">favorites</a>
* @since JDK 1.5
*/
public JSONObject getFavoritesIds(Paging page) throws WeiboException {
return client.get(WeiboConfig
.getValue("baseURL") + "favorites/ids.json",null,page).asJSONObject();
}
/**
* 根据收藏ID获取指定的收藏信息
*
* @param id
* @return Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.1
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/show">favorites/show</a>
* @since JDK 1.5
*/
public Favorites showFavorites(String id) throws WeiboException {
return new Favorites(client.get(WeiboConfig.getValue("baseURL")
+ "favorites/show.json",
new PostParameter[] { new PostParameter("id", id) }));
}
/**
* 根据标签获取当前登录用户该标签下的收藏列表
*
* @param tid
* @return list of the favorite Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.1
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/by_tags">favorites/by_tags</a>
* @since JDK 1.5
*/
public List<Favorites> getFavoritesByTags(String tid) throws WeiboException {
return Favorites.constructFavorites(client.get(
WeiboConfig.getValue("baseURL") + "favorites/by_tags.json",
new PostParameter[] { new PostParameter("tid", tid) }));
}
/**
* 根据标签获取当前登录用户该标签下的收藏列表
*
* @param tid
* @param page
* @return list of the favorite Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.0
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/show">favorites/show</a>
* @since JDK 1.5
*/
public List<Favorites> getFavoritesByTags(String tid, Paging page)
throws WeiboException {
return Favorites.constructFavorites(client.get(
WeiboConfig.getValue("baseURL") + "favorites/by_tags.json",
new PostParameter[] { new PostParameter("tid", tid) }, page));
}
/**
* 获取当前登录用户的收藏标签列表
*
* @param page
* @return list of the favorite tags
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.1
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/tags">favorites/tags</a>
* @since JDK 1.5
*/
public List<FavoritesTag> getFavoritesTags() throws WeiboException {
return Tag.constructTag(client.get(WeiboConfig
.getValue("baseURL") + "favorites/tags.json"));
}
/**
* 添加一条微博到收藏里
*
* @param 要收藏的微博ID
* 。
* @return Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.0
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/create">favorites/create</a>
* @since JDK 1.5
*/
public Favorites createFavorites(String id) throws WeiboException {
return new Favorites(client.post(WeiboConfig.getValue("baseURL")
+ "favorites/create.json",
new PostParameter[] { new PostParameter("id", id) }));
}
/**
* 取消收藏一条微博
*
* @param 要取消收藏的微博ID
* 。
* @return Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.0
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/destroy">favorites/destroy</a>
* @since JDK 1.5
*/
public Favorites destroyFavorites(String id) throws WeiboException {
return new Favorites(client.post(WeiboConfig.getValue("baseURL")
+ "favorites/destroy.json",
new PostParameter[] { new PostParameter("id", id) }));
}
/**
* 批量删除收藏
*
* @param ids
* 要取消收藏的收藏ID,用半角逗号分隔,最多不超过10个。
* @return destroy list of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.0
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/destroy_batch">favorites/destroy_batch</a>
* @since JDK 1.5
*/
public Boolean destroyFavoritesBatch(String ids) throws WeiboException {
try {
return client
.post(WeiboConfig.getValue("baseURL")
+ "favorites/destroy_batch.json",
new PostParameter[] { new PostParameter("ids", ids) })
.asJSONObject().getBoolean("result");
} catch (JSONException e) {
throw new WeiboException(e);
}
}
/**
* 更新一条收藏的收藏标签
*
* @param id
* 要需要更新的收藏ID
* @return update tag of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.0
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/tags/update">favorites/tags/update</a>
* @since JDK 1.5
*/
public Favorites updateFavoritesTags(String id) throws WeiboException {
return new Favorites(client.post(WeiboConfig.getValue("baseURL")
+ "favorites/tags/update.json",
new PostParameter[] { new PostParameter("id", id) }));
}
/**
* 更新一条收藏的收藏标签
*
* @param id
* 要需要更新的收藏ID
* @param tags
* 需要更新的标签内容,必须做URLencode,用半角逗号分隔,最多不超过2条。
* @return update tag of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.0
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/tags/update">favorites/tags/update</a>
* @since JDK 1.5
*/
public Favorites updateFavoritesTags(String id, String tags)
throws WeiboException {
return new Favorites(client.post(WeiboConfig.getValue("baseURL")
+ "favorites/tags/update.json", new PostParameter[] {
new PostParameter("id", id), new PostParameter("tags", tags) }));
}
/**
* 更新当前登录用户所有收藏下的指定标签
*
* @param id
* 需要更新的标签ID。
* @return update tags of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.0
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/tags/update_batch">favorites/tags/update_batch</a>
* @since JDK 1.5
*/
public JSONObject updateFavoritesTagsBatch(String tid, String tag)
throws WeiboException {
return client.post(
WeiboConfig.getValue("baseURL")
+ "favorites/tags/update_batch.json",
new PostParameter[] { new PostParameter("tid", tid),
new PostParameter("tag", tag) }).asJSONObject();
}
/**
* 删除当前登录用户所有收藏下的指定标签
*
* @param id
* 需要删除的标签ID。。
* @return destroy tags of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version ca.weindex.weibo4j-V2 1.0.0
* @see <a
* href="http://open.weibo.com/wiki/2/favorites/tags/destroy_batch">favorites/tags/destroy_batch</a>
* @since JDK 1.5
*/
public Boolean destroyFavoritesTagsBatch(String ids) throws WeiboException {
try {
return client
.post(WeiboConfig.getValue("baseURL")
+ "favorites/destroy_batch.json",
new PostParameter[] { new PostParameter("ids", ids) })
.asJSONObject().getBoolean("result");
} catch (JSONException e) {
throw new WeiboException(e);
}
}
}
| [
"weindex.ca@gmail.com"
] | weindex.ca@gmail.com |
4d993b76efe30c87aaa53235fb5961ed6a741ab3 | 09373d32b0c2b1cde09ff7e0beddda86627dc334 | /src/main/java/org/mvelx/optimizers/AbstractOptimizer.java | b087e86339354f24684086dde622cc70455b8e8e | [] | no_license | flym/mvelx | ba4a7e2d8ad4a151699d106a1c7fe9445afa3ac3 | 18c9eb7635f285a769c443107220e02c898e1b6b | refs/heads/master | 2020-07-10T20:18:00.570137 | 2019-03-11T01:49:43 | 2019-03-11T01:49:43 | 74,010,079 | 12 | 8 | null | null | null | null | UTF-8 | Java | false | false | 13,622 | java | package org.mvelx.optimizers;
import org.mvelx.CompileException;
import org.mvelx.MVEL;
import org.mvelx.ParserContext;
import org.mvelx.compiler.AbstractParser;
import java.lang.reflect.Method;
import static java.lang.Thread.currentThread;
import static org.mvelx.util.ParseTools.*;
/**
* 抽象的优化解析器,用于定义一些公用的信息,以及定义一些公用的方法,通用的逻辑处理等
*
* @author Christopher Brock
*/
public class AbstractOptimizer extends AbstractParser {
/** 表示属性访问 */
protected static final int BEAN = 0;
/** 表示方法访问 */
protected static final int METH = 1;
/** 表示集合访问 */
protected static final int COL = 2;
/** 当前处理是否是集合 */
protected boolean collection = false;
/** 当前处理是否是null安全的 */
protected boolean nullSafe = false;
/** 当前处理属性的类型 */
protected Class currType = null;
/** 当前是否是静态方法,即静态访问字段,类等 */
protected boolean staticAccess = false;
/** 当前处理的表达式在整个语句中的起始下标,为一个在处理过程中会变化的下标位,其可认为在start和end当中作于其它作用的临时变量 */
protected int tkStart;
protected AbstractOptimizer() {
}
protected AbstractOptimizer(ParserContext pCtx) {
super(pCtx);
}
/**
* 尝试静态访问此属性,此属性可能是字段,类或者对象本身
* Try static access of the property, and return an instance of the Field, Method of Class if successful.
*
* @return - Field, Method or Class instance.
*/
protected Object tryStaticAccess() {
int begin = cursor;
try{
/**
* Try to resolve this *smartly* as a static class reference.
*
* This starts at the end of the token and starts to step backwards to figure out whether
* or not this may be a static class reference. We search for method calls simply by
* inspecting for ()'s. The first union area we come to where no brackets are present is our
* test-point for a class reference. If we find a class, we pass the reference to the
* property accessor along with trailing methods (if any).
* 这里查找方式为从后往前进行查找
*
*/
boolean meth = false;
// int end = start + length;
int last = end;
for(int i = end - 1; i > start; i--) {
switch(expr[i]) {
case '.':
//找到一个.符号,表示可能直接是字段访问或者是方法读取 ,如 a.b 这种方式,那么下面的处理直接处理a,而忽略b,因此后面再处理b属性
if(!meth) {
//这里的last和i可能并不相同,如last可能直接为 end属性,即表示直接就是 a.b 处理
//而另一种情况就是 a.b()属性,这里last和i就是相同的
ClassLoader classLoader = pCtx != null ? pCtx.getClassLoader() : currentThread().getContextClassLoader();
String test = new String(expr, start, (cursor = last) - start);
try{
//先处理类后面直接带.class的类
if(MVEL.COMPILER_OPT_SUPPORT_JAVA_STYLE_CLASS_LITERALS && test.endsWith(".class"))
test = test.substring(0, test.length() - 6);
//尝试直接加载此类
return Class.forName(test, true, classLoader);
} catch(ClassNotFoundException cnfe) {
try{
//因为上面加载失败了,那么可能是内部类,这里尝试加载内部类
return findInnerClass(test, classLoader, cnfe);
} catch(ClassNotFoundException e) { /* ignore */ }
//这里可能处理的数据了 a.b 而a为类,b为字段或方法,因此尝试使用i 处理a 类
Class cls = forNameWithInner(new String(expr, start, i - start), classLoader);
//认为剩下的数据为字段或方法,尝试进行加载处理
String name = new String(expr, i + 1, end - i - 1);
try{
return cls.getField(name);
} catch(NoSuchFieldException nfe) {
for(Method m : cls.getMethods()) {
if(name.equals(m.getName())) return m;
}
return null;
}
}
}
//这里是因为找到(),则相应的标记置true,这里将last重新进行处理,表示a.b()先由last到(处,这里再到a的后面的下标处
//然后在这里将last和i置为一样
meth = false;
last = i;
break;
//这里表示碰到代码块,无其它作用,先直接跳过,可能为内部类初始化块
case '}':
i--;
for(int d = 1; i > start && d != 0; i--) {
switch(expr[i]) {
case '}':
d++;
break;
case '{':
d--;
break;
case '"':
case '\'':
char s = expr[i];
while(i > start && (expr[i] != s && expr[i - 1] != '\\')) i--;
}
}
break;
//碰到),表示肯定是方法调用,但这里仅用于查找相应的方法实例,而并不是方法调用本身,因此将跳过相应的方法参数信息
case ')':
i--;
//采用相应的d作为深度,一直找到相匹配的 (为止
for(int d = 1; i > start && d != 0; i--) {
switch(expr[i]) {
case ')':
d++;
break;
case '(':
d--;
break;
//跳过字符串
case '"':
case '\'':
char s = expr[i];
while(i > start && (expr[i] != s && expr[i - 1] != '\\')) i--;
}
}
//这里作相应的标记,表示为字符串,并且相应的last标记往前推进
meth = true;
last = i++;
break;
//碰到字符串,跳过
case '\'':
while(--i > start) {
if(expr[i] == '\'' && expr[i - 1] != '\\') {
break;
}
}
break;
//碰到字符串,跳过
case '"':
while(--i > start) {
if(expr[i] == '"' && expr[i - 1] != '\\') {
break;
}
}
break;
}
}
} catch(Exception cnfe) {
cursor = begin;
}
return null;
}
/**
* 读取可能的操作属性,通过查找当前字符串中可能存在的特殊符号来进行定位.
* <p/>
* 操作属性的读取是通过读取最接近的操作来完成的,而并不是一步一步来完成的.如a.b[2]则会定义为集合访问,即最终为(a.b)[2]这种操作,然后先处理a.b,再处理[2]操作
*/
protected int nextSubToken() {
skipWhitespace();
nullSafe = false;
//先通过首字符来判定,可能是集合,属性或者其它调用
switch(expr[tkStart = cursor]) {
//集合调用
case '[':
return COL;
//属性调用,如果.后接一个?号,表示当前属性的值结果可能是null的
case '.':
if((start + 1) != end) {
switch(expr[cursor = ++tkStart]) {
case '?':
skipWhitespace();
if((cursor = ++tkStart) == end) {
throw new CompileException("unexpected end of statement", expr, start);
}
nullSafe = true;
fields = -1;
break;
default:
if(isWhitespace(expr[tkStart])) {
skipWhitespace();
tkStart = cursor;
}
}
} else {
throw new CompileException("unexpected end of statement", expr, start);
}
break;
//这里直接在最前台加一个?,即表示访问这个属性,并且这个属性值可能为null
case '?':
if(start == cursor) {
tkStart++;
cursor++;
nullSafe = true;
}
}
//表示没有特殊字段,则是正常的字符,则继续找到下一个非字符处理
//noinspection StatementWithEmptyBody
while(++cursor < end && isIdentifierPart(expr[cursor])) ;
//在跳过一堆字段之后,还没有到达末尾,表示中间有类似操作符存在,则通过第一个非字段点来进行判断
skipWhitespace();
if(cursor < end) {
switch(expr[cursor]) {
case '[':
return COL;
case '(':
return METH;
default:
return BEAN;
}
}
//默认为bean操作,即读取属性
return 0;
}
/** 当前捕获的属性名(字符串),即在刚才的处理过程中处理的字符串 */
protected String capture() {
/*
* Trim off any whitespace.
*/
return new String(expr, tkStart = trimRight(tkStart), trimLeft(cursor) - tkStart);
}
/**
* 跳过相应的空白块
* Skip to the next non-whitespace position.
*/
protected void whiteSpaceSkip() {
if(cursor < length)
//noinspection StatementWithEmptyBody
while(isWhitespace(expr[cursor]) && ++cursor != length) ;
}
/**
* 查找指定的字符,直到找到为止,同时相应的相应的下标会往前递进
*
* @param c - character to scan to.
* @return - returns true is end of statement is hit, false if the scan scar is countered.
*/
protected boolean scanTo(char c) {
for(; cursor < end; cursor++) {
switch(expr[cursor]) {
case '\'':
case '"':
cursor = captureStringLiteral(expr[cursor], expr, cursor, end);
default:
if(expr[cursor] == c) {
return false;
}
}
}
return true;
}
/** 从后往前找到最后一个用于处理联合操作的下标值,如 a.b.c, 将找到c前面的位置。而a.b{{1+2}},将找到b后面的大括号的位置 */
protected int findLastUnion() {
int split = -1;
int depth = 0;
int end = start + length;
for(int i = end - 1; i != start; i--) {
switch(expr[i]) {
//因为是从后往前,因此对后右括号需要深度加1,表示需要从前找到相匹配的符号
case '}':
case ']':
depth++;
break;
case '{':
case '[':
//归0表示找到相匹配的信息,否则继续
if(--depth == 0) {
split = i;
//因为碰到{ [,表示是集合访问
collection = true;
}
break;
// . 符号,正常的调用访问
case '.':
if(depth == 0) {
split = i;
}
break;
}
//找到数据,直接退出
if(split != -1) break;
}
return split;
}
}
| [
"www@iflym.com"
] | www@iflym.com |
2d0c97e7fb6da02c79bb12533b45638a73886bcc | 6f27ba4fc2b32fc23e8d2eadcf1186abab782a9f | /kbq-core/src/main/java/com/xike/kbq/core/net/RestClient.java | 9633a9469ec86bd853c319a1752a342f52d45352 | [] | no_license | kbq670554802/EC | 9c5bbf2197d362c8a9a5c1fc9423478c91dd2139 | 0455576ec25d1a56407a5c784a4abdab1728524d | refs/heads/master | 2020-03-28T15:37:14.640803 | 2018-09-20T01:38:15 | 2018-09-20T01:38:15 | 148,610,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,184 | java | package com.xike.kbq.core.net;
import android.content.Context;
import com.xike.kbq.core.net.callback.IError;
import com.xike.kbq.core.net.callback.IFailure;
import com.xike.kbq.core.net.callback.IRequest;
import com.xike.kbq.core.net.callback.ISuccess;
import com.xike.kbq.core.net.callback.RequestCallbacks;
import com.xike.kbq.core.net.download.DownloadHandler;
import com.xike.kbq.core.ui.KbqLoader;
import com.xike.kbq.core.ui.LoaderStyle;
import java.io.File;
import java.util.Map;
import java.util.WeakHashMap;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.Callback;
/**
* Author: 柯葆青
* Date: 2018/9/14
* Description: 网络请求客户端
*/
public class RestClient {
private final String URL;
private static final WeakHashMap<String, Object> PARAMS = RestCreator.getParams();
private final IRequest REQUEST;
private final String DOWNLOAD_DIR;
private final String EXTENSION;
private final String NAME;
private final ISuccess SUCCESS;
private final IFailure FAILURE;
private final IError ERROR;
private final RequestBody BODY;
private final File FILE;
private final LoaderStyle LOADER_STYLE;
private final Context CONTEXT;
public RestClient(String url,
Map<String, Object> params,
String downloadDir,
String extension,
String name,
IRequest request,
ISuccess success,
IFailure failure,
IError error,
RequestBody body,
File file,
Context context,
LoaderStyle loaderStyle
) {
this.URL = url;
PARAMS.putAll(params);
this.DOWNLOAD_DIR = downloadDir;
this.EXTENSION = extension;
this.NAME = name;
this.REQUEST = request;
this.SUCCESS = success;
this.FAILURE = failure;
this.ERROR = error;
this.BODY = body;
this.FILE = file;
this.CONTEXT = context;
this.LOADER_STYLE = loaderStyle;
}
public static RestClientBuilder builder() {
return new RestClientBuilder();
}
private void request(HttpMethod method) {
final RestService service = RestCreator.getRestService();
Call<String> call = null;
if (REQUEST != null) {
REQUEST.onRequestStart();
}
if (LOADER_STYLE != null) {
KbqLoader.showLoading(CONTEXT, LOADER_STYLE);
}
switch (method) {
case GET:
call = service.get(URL, PARAMS);
break;
case POST:
call = service.post(URL, PARAMS);
break;
case POST_RAW:
call = service.postRaw(URL, BODY);
break;
case PUT:
call = service.put(URL, PARAMS);
break;
case PUT_RAW:
call = service.putRaw(URL, BODY);
break;
case DELETE:
call = service.delete(URL, PARAMS);
break;
case UPLOAD:
// final RequestBody requestBody = RequestBody.create(MediaType.parse(MultipartBody.FORM.toString()), FILE);
final RequestBody requestBody = RequestBody.create(MultipartBody.FORM, FILE);
final MultipartBody.Part body =
MultipartBody.Part.createFormData("file", FILE.getName(), requestBody);
call = RestCreator.getRestService().upload(URL, body);
break;
default:
break;
}
if (call != null) {
call.enqueue(getRequestCallback());
}
}
private Callback<String> getRequestCallback() {
return new RequestCallbacks(
REQUEST,
SUCCESS,
FAILURE,
ERROR,
LOADER_STYLE
);
}
public final void get() {
request(HttpMethod.GET);
}
public final void post() {
if (BODY == null) {
request(HttpMethod.POST);
} else {
if (!PARAMS.isEmpty()) {
throw new RuntimeException("params must be null");
}
request(HttpMethod.POST_RAW);
}
}
public final void put() {
if (BODY == null) {
request(HttpMethod.PUT);
} else {
if (!PARAMS.isEmpty()) {
throw new RuntimeException("params must be null");
}
request(HttpMethod.PUT_RAW);
}
}
public final void delete() {
request(HttpMethod.DELETE);
}
public final void upload() {
request(HttpMethod.UPLOAD);
}
public final void download() {
new DownloadHandler(URL,
REQUEST,
DOWNLOAD_DIR,
EXTENSION,
NAME,
SUCCESS,
FAILURE,
ERROR).handleDownload();
}
}
| [
"670554802@qq.com"
] | 670554802@qq.com |
05358da319443c4e50a153a99dda76c12238419c | 9572b7f803a6638e04dc140e489c146a5e32d413 | /pces/src/main/java/com/ouc/pces/mapper/CommentMapper.java | ca5105deaede8cde5b379ce46f9a8fae941251cf | [] | no_license | sun1127-coder/PCES | 0d4cddcb8bdd2cb165d6e037872276de09df92d1 | 90d7c09d2db57b92cb611550d16cbb20e2d927a8 | refs/heads/master | 2020-09-02T05:26:01.496594 | 2019-11-26T01:08:42 | 2019-11-26T01:08:42 | 219,141,872 | 0 | 0 | null | 2019-12-03T00:31:02 | 2019-11-02T11:05:30 | HTML | UTF-8 | Java | false | false | 129 | java | package com.ouc.pces.mapper;
import org.springframework.stereotype.Repository;
@Repository
public interface CommentMapper {
}
| [
"sunshine2285@163.com"
] | sunshine2285@163.com |
a4eb4b80ceb1a426d4de8c428dbd4db1271b5f7c | 0c4648270584fd7b83dde4f821abc5aadc863a51 | /src/com/android/indigo/fragment/base/ListFragmentBase.java | 24593480dad6cb0ee5c89a0ba58db17db1487a52 | [] | no_license | hoangnam1503/todolist | 886f7ffcbbd6556e3921d4c339f94217a08a0212 | f3c8135fffe3989a6cf1517f4b041a78dd4f1bff | refs/heads/master | 2021-01-19T13:30:26.332419 | 2014-05-22T11:20:11 | 2014-05-22T11:20:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,339 | java | package com.android.indigo.fragment.base;
import java.util.ArrayList;
import com.android.indigo.R;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
public class ListFragmentBase extends ListFragment {
protected View mView;
protected Context mContext;
protected ListView mListView;
protected ArrayList<Integer> mArrayList;
protected View rootView, footerView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.mContext = getActivity();
}
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup container, Bundle savedInstanceState) {
mView = layoutInflater.inflate(R.layout.fragment_list, container, false);
return mView;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mListView = (ListView) getListView();
}
public Object getItem(int position) {
return mArrayList.get(position);
}
protected ArrayList<Integer> getItems() {
mArrayList = new ArrayList<Integer>();
for (int i = 0; i < 10; i++) {
mArrayList.add(i);
}
return mArrayList;
}
}
| [
"hoang.nam@aainc.co.jp"
] | hoang.nam@aainc.co.jp |
93220b096ae99b7702e2d49dbe464e89a80af1f1 | 99e812358ad09af178a3502c239dfeab21b42eb6 | /DataSetGen.java | 609e442de7fb585170d7beaaa03a252e997df76e | [] | no_license | Nicomello/repo | 30bb5b0c660b80d0bd28c92812260d9396bc1e87 | 63e5f6fd18ce87ba77cb7cc70d43f0f969bb3528 | refs/heads/main | 2023-05-02T05:01:44.644201 | 2021-05-06T02:26:52 | 2021-05-06T02:26:52 | 335,490,506 | 0 | 0 | null | 2021-02-14T04:29:17 | 2021-02-03T02:59:21 | Java | UTF-8 | Java | false | false | 958 | java | package application;
/**
Computes the average of a set of data values.
*/
//The Generic class of DataSet.
public class DataSetGen <T extends Measurable>
{
private double sum;
private int count;
private T maximum;
/**
construct an empty data set.
*/
public DataSetGen()
{
count = 0;
sum = 0;
maximum = null;
}
/**
Adds a data value to the data set
@param x is a data value
*/
public void add(T x)
{
sum = sum + x.getMeasure();
if (count==0 || maximum.getMeasure() < x.getMeasure())
maximum = x;
count++;
}
/**
Gets the average of the added data
@return the average or 0 if no data has been added
*/
public double getAverage()
{
if (count ==0) return 0;
else return sum / count;
}
/**
Gets the largest of the added data
@return the maximum or 0 if no data has been added
*/
public T getMaximum()
{
return maximum;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
dc63748939a3743c12799b9c8b471af0e37e7913 | 602d81043c5d47d8c8a2ebe99732828a657721f8 | /app/src/main/java/com/it/xzr/mothersonhealth/activity/yunqian/FangShiActivity.java | 85e15208ef865932a2296ccf5564858015859aa6 | [] | no_license | Brucening/MotherSonHealth33333 | 2a195a583beb28f19866ef9ec88c54c2a4ad770b | ecf58bf5308b4d4626988ddadfee6e8d77cd52e1 | refs/heads/master | 2021-01-02T09:16:26.850191 | 2017-06-29T03:29:14 | 2017-06-29T03:29:14 | 99,175,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package com.it.xzr.mothersonhealth.activity.yunqian;
import android.os.Bundle;
import com.it.xzr.mothersonhealth.R;
import com.it.xzr.mothersonhealth.base.BaseActivity;
/**
* Created by GN on 2017/6/27.
*/
public class FangShiActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fangshi);
}
}
| [
"guolima1233@163.com"
] | guolima1233@163.com |
f37b25152db5ff7ab421eb323e3ee843e8c80592 | e7dcfcf9f21058712fac939e0b6c963599ff59d8 | /0626,2020/CharacterTest.java | 300fb1803733dc4874ec1e8919e5870ac18ecbb9 | [] | no_license | yurimnim/JAVA_101 | 6a54c50841eeb990b87c277f14501c47d09d0ea0 | 9b1d90af3c37ae46cfe35d65e0dd78b6eeef0e6f | refs/heads/master | 2023-01-07T00:38:08.884511 | 2020-11-09T01:41:40 | 2020-11-09T01:41:40 | 272,456,275 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | class CharacterTest {
public static void main(String[] args) {
System.out.println('a' - 'A');
/*
String data = "abc";
char ch = data.charAt(0);
System.out.println(ch);
System.out.println((int)ch);
System.out.println(ch+1);
*/
}
}
| [
"noreply@github.com"
] | noreply@github.com |
8c40ed82071dbe2ca1505c4355c936155c2ca454 | ff7adea18f723560a055f845b414ad5349829106 | /src/main/java/com/xj/sample/utils/MathUtils.java | 6aa704733b223b8f0a1285602d11cd47e701796e | [] | no_license | SkyXj/maptile | 8e7a03e69c94e340b540eae1a79ab317bf5fa96e | 642e78020d316afde2aefce115b5e5353aff3d78 | refs/heads/master | 2022-09-22T18:26:20.922824 | 2020-08-26T05:34:41 | 2020-08-26T05:34:41 | 216,023,522 | 0 | 0 | null | 2022-09-01T23:14:21 | 2019-10-18T12:53:02 | Java | UTF-8 | Java | false | false | 381 | java | package com.xj.sample.utils;
import java.util.Random;
/**
* Copyright © 广州禾信仪器股份有限公司. All rights reserved.
*
* @Author hxsdd-20
* @Date 2020/8/26 13:28
* @Version 1.0
*/
public class MathUtils {
public static Integer getRandom(Integer start,Integer end) {
Random random=new Random();
return (random.nextInt(end)+start);
}
}
| [
"j.xia@hxmass.com"
] | j.xia@hxmass.com |
cae45233a469382085ec9c7cfc2414d448c79b48 | b0f28a99c22790065814c955402efe694123fd94 | /java/src/javaprgms/PrintDistinctElementinArray.java | 5a55fe7a2fdc0b41ee83dc6087b75321df5ef174 | [] | no_license | shobhark/automation | 0a7f210c7e37e7a2e836106f7739abe6682d09d7 | 20b7e76bfbbe6f03c1e826e6b8515ecbb12252be | refs/heads/master | 2020-04-05T16:02:25.430096 | 2018-11-20T00:44:53 | 2018-11-20T00:44:53 | 156,994,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package javaprgms;
public class PrintDistinctElementinArray {
public static void main(String[] args) {
int arr[] = {5,2,7,8,8,6,9,5};
boolean isDistinct = false;
for(int i=0; i<arr.length;i++)
{
for(int j=0;j<i;j++)
{
if(arr[i]==arr[j])
{
isDistinct=true;
break;
}
}
if(!isDistinct)
{
System.out.print(arr[i]+",");
}
}
}
}
| [
"shobhark@gmail.com"
] | shobhark@gmail.com |
da3b392d7ebdfa0104a66690180d097071648fb4 | 764aa2c7f8cdbf07a2ce0af64295d5ee3a2bfb25 | /Main.java | 7d017c7df194f24d9aa4a2390e05b9109a6f6ef2 | [] | no_license | ladislavracz/projectRectangle | e2d6c0352f8372e15691abc39d6917b437a027c3 | 8b8c6266c899a4ac1c7c3e290506414792591838 | refs/heads/master | 2020-08-07T07:20:07.662413 | 2019-10-08T09:17:28 | 2019-10-08T09:17:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | public class Asd {public void Uloha 8() {
int x = 1;
for (int rows = 1; rows <= 8; rows++)
{
for (int spaces = 1; spaces <= 4; spaces++)
{
if (rows==1||rows==8||spaces==1||spaces==4)
{
System.out.print(" *");
}
else
{
System.out.print(" ");
}
}
System.out.println();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
606b8d2307118405ffe07cc6a7147385f7af1f32 | 580a2ad243341f4e68690602538d7c6a69f924d1 | /app/src/main/java/com/skeleton/model/Geo.java | efb030c813941d9f68cab3f5d475255b4b64f915 | [] | no_license | gpachauri3/ServerLogin | eacbd90baa344ef91de4dac94927c4385d7e5320 | 8c7ed2b6af23efdb5257c22e93d465dd3643e41f | refs/heads/master | 2020-12-30T14:45:01.141166 | 2017-05-12T11:19:45 | 2017-05-12T11:19:45 | 91,083,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package com.skeleton.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by mark-42 on 4/5/17.
*/
public class Geo {
@SerializedName("lat")
@Expose
private String lat;
@SerializedName("lng")
@Expose
private String lng;
/**
* @return lat
*/
public String getLat() {
return lat;
}
/**
* @param lat String
*/
public void setLat(final String lat) {
this.lat = lat;
}
/**
* @return lng
*/
public String getLng() {
return lng;
}
/**
* @param lng String
*/
public void setLng(final String lng) {
this.lng = lng;
}
}
| [
"gpachauri13113@gmail.com"
] | gpachauri13113@gmail.com |
fa06eb39bf503809dbbe3f1c495a641a4960f961 | 2b9036ad64c2139a4402fe449b4093080f26dbc1 | /src/BinaryTree/StringfromBST.java | 73ef6afbaa083b0a07997749e00b640ac69739b0 | [] | no_license | harshaks23/DS | e40b7cdb62a04b67169ad8d6e38bb784883cf0ce | 2342a761cd68ac1110731f6944b41252bfdf8024 | refs/heads/master | 2020-03-18T17:10:05.344303 | 2018-09-21T06:13:42 | 2018-09-21T06:13:42 | 96,051,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | package BinaryTree;
public class StringfromBST {
public class Solution {
public String tree2str(TreeNode t) {
return helper(t);
}
String helper(TreeNode t){
if(t == null) return "";
String res=t.val+"";
if(t.left==null && t.right!=null)
{
return res+"()"+"("+ helper(t.right)+")";
}
if(t.left!=null && t.right==null)
{
return res+"("+ helper(t.left)+")";
}
if(t.left!=null && t.right!=null)
{
return res+"("+helper(t.left)+")"+"("+ helper(t.right)+")";
}
return res;
}}
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) { val = x; }
}
}
| [
"harshaksabbur@gmail.com"
] | harshaksabbur@gmail.com |
16630bb522b870750f0e8f6a220b97e6a7dfe59a | d2cf3e382c2ae347c6d43ac8a54ca4ad2590cc36 | /src/main/java/ar/edu/ucc/arqSoft/common/dao/GenericDaoImp.java | 4f693acb37829da065b22fcd2a8dcdae9ce6b517 | [] | no_license | franluque2/ArqSoftI_Trabajo_FranLuque | b9cd0b72ac44fa6fb5ceca9680affb4c0cfa3a1b | ffd252ab28c75a67f40a8b41beee30074882f131 | refs/heads/master | 2023-01-04T06:40:50.097238 | 2020-10-23T17:23:35 | 2020-10-23T17:23:35 | 306,687,429 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,535 | java | package ar.edu.ucc.arqSoft.common.dao;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public abstract class GenericDaoImp<E, ID extends Serializable> implements GenericDao<E, ID> {
@Autowired
protected EntityManager em;
protected Class<? extends E> daoType;
@SuppressWarnings("unchecked")
public GenericDaoImp() {
Type t = getClass().getGenericSuperclass();
ParameterizedType pt = (ParameterizedType) t;
daoType = (Class<? extends E>) pt.getActualTypeArguments()[0];
}
public void insert(E entity) {
em.persist(entity);
}
public void saveOrUpdate(E entity) {
em.persist(entity);
}
public void update(E entity) {
em.persist(entity);
}
public void remove(E entity) {
em.remove(entity);
}
public E load(ID key) {
return em.find(daoType, key);
}
@SuppressWarnings("unchecked")
public List<E> getAll() {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<E> criteria = (CriteriaQuery<E>) builder.createQuery(daoType);
Root<E> member = (Root<E>) criteria.from(daoType);
criteria.select(member);
return em.createQuery(criteria).getResultList();
}
} | [
"1033629@ucc.edu.ar"
] | 1033629@ucc.edu.ar |
8a3437af64c18f8df67302f08a99f8bf14f526af | bcd2d445500256fc91a5f21e2e3c73557e5816a3 | /src/main/java/ru/los/exception/ValidateException.java | 0936442f3d5ef30afa8db54c6f2de735756fa197 | [] | no_license | OlgaLugacheva/calc-service | 541d747a5d6b1a5e63f8916bdab0fa0efa73102e | dd5fa9864caf33172b5c2604a59bd12e3893e6c3 | refs/heads/master | 2022-12-20T22:15:39.300231 | 2019-08-27T13:14:55 | 2019-08-27T13:14:55 | 204,706,331 | 0 | 0 | null | 2022-12-16T00:36:33 | 2019-08-27T13:12:02 | Java | UTF-8 | Java | false | false | 519 | java | package ru.los.exception;
import lombok.Getter;
import lombok.Setter;
public class ValidateException extends Exception {
@Getter
@Setter
private int typeId;
public ValidateException() { super(); }
public ValidateException(String message) { super(message); }
public ValidateException(String message, Throwable cause) { super(message, cause); }
public ValidateException(Throwable cause) { super(cause); }
public ValidateException(String message, int typeId)
{
super(message);
this.typeId = typeId;
}
}
| [
"lugachevaolga@gmail.com"
] | lugachevaolga@gmail.com |
af6bda854f8110f3aacbc69fb2026ab3d4ff4524 | 2869fc39e2e63d994d5dd8876476e473cb8d3986 | /Super_clutter/src/java/com/lvmama/clutter/web/place/AppApiAction.java | f30e13864bb7427007705ee132e93685ba80c356 | [] | no_license | kavt/feiniu_pet | bec739de7c4e2ee896de50962dbd5fb6f1e28fe9 | 82963e2e87611442d9b338d96e0343f67262f437 | refs/heads/master | 2020-12-25T17:45:16.166052 | 2016-06-13T10:02:42 | 2016-06-13T10:02:42 | 61,026,061 | 0 | 0 | null | 2016-06-13T10:02:01 | 2016-06-13T10:02:01 | null | UTF-8 | Java | false | false | 26,773 | java | package com.lvmama.clutter.web.place;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.convention.annotation.Action;
import org.springframework.util.StringUtils;
import com.lvmama.clutter.utils.ClutterConstant;
import com.lvmama.comm.pet.client.UserClient;
import com.lvmama.comm.pet.po.client.ClientGroupon2;
import com.lvmama.comm.pet.po.client.ClientPlace;
import com.lvmama.comm.pet.po.client.ClientProduct;
import com.lvmama.comm.pet.po.client.ClientTimePrice;
import com.lvmama.comm.pet.po.client.ClientUser;
import com.lvmama.comm.pet.po.mark.MarkCoupon;
import com.lvmama.comm.pet.po.mark.MarkCouponCode;
import com.lvmama.comm.pet.po.money.CashAccount;
import com.lvmama.comm.pet.po.user.UserCooperationUser;
import com.lvmama.comm.pet.po.user.UserUser;
import com.lvmama.comm.pet.service.mark.MarkCouponService;
import com.lvmama.comm.pet.service.user.UserActionCollectionService;
import com.lvmama.comm.pet.service.user.UserCooperationUserService;
import com.lvmama.comm.pet.service.user.UserUserProxy;
import com.lvmama.comm.spring.SpringBeanProxy;
import com.lvmama.comm.utils.ClientConstants;
import com.lvmama.comm.utils.DateUtil;
import com.lvmama.comm.utils.InternetProtocol;
import com.lvmama.comm.utils.PriceUtil;
import com.lvmama.comm.utils.StringUtil;
import com.lvmama.comm.utils.UserLevelUtils;
import com.lvmama.comm.utils.UserUserUtil;
import com.lvmama.comm.vo.Constant;
import com.lvmama.comm.vo.comment.DicCommentLatitudeVO;
/**
* 普通客户端api 无需用户登陆
* @author dengcheng
*
*/
public class AppApiAction extends AppBaseAction{
/**
*
*/
private static final long serialVersionUID = 1L;
String keyword;
/**
* UserClient
*/
private UserClient userClient;
private MarkCouponService markCouponService;
/**
* 第三方用户服务
*/
private UserCooperationUserService userCooperationUserService;
/**
* 获得place 信息
*/
@Action("/client/api/v2/getPlaceDetails")
public void getPlaceDetails(){
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(placeId);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
ClientPlace cp = null;
try {
cp = super.appService.getPlaceDetails(placeId);
}catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, cp,false);
}
}
@Action("/client/api/v2/getMainProdTimePrice")
public void getMainProdTimePrice () {
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(productId);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",true);
return;
}
List<ClientTimePrice> list = null;
try {
list = appService.getMainProdTimePrice(productId, branchId);
if(list.isEmpty()){
this.putErrorMessage(resultMap, "产品库存不足");
}
}catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, list,true);
}
}
@Action("/client/api/v2/queryGroupProductList")
public void queryGroupProductList () {
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(placeId);
requiredArgList.add(stage);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
Map<String,Object> map = null;
try {
map = appService.queryGroupProductList(placeId, stage);
}catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, map,false);
}
}
@Action("/client/api/v2/queryGroupOnProductListForSh")
public void queryGroupOnProductListForSh () {
Map<String,Object> resultMap = super.resultMapCreator();
List<ClientProduct> list= null;
try {
list = appService.queryGroupOnListForSh();
}catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, list,true);
}
}
@Action("/client/api/v2/getProductList")
public void getProductList(){
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(placeId);
requiredArgList.add(stage);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",true);
return;
}
List<?> list = null;
try {
list = appService.getProductList(placeId, stage);
}catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, list,true);
}
}
@Action("/client/api/v2/getProductDetails")
public void getProductDetails(){
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(productId);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
ClientProduct cp = null;
try {
cp = appService.getProductDetails(productId);
} catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, cp,false);
}
}
@Action("/client/api/v2/getNameByLocation")
public void getNameByLocation () {
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(keyword);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
ClientPlace cp = null;
try {
cp = appService.getPlaceByName(keyword);
} catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, cp,false);
}
}
@Action("/client/api/v2/queryCommentListByPlaceId")
public void queryCommentListByPlaceId () {
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(placeId);
requiredArgList.add(page);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",true);
return;
}
// UserUser user = this.getUser();
//
//
// if(userId ==null){
// userId = user.getUserId();
// }
List<?> list = null;
try {
Map<String,Object> map = appService.queryPlaceComments(userId, placeId, page);
list = (List<?>)map.get("list");
resultMap.put("isLastPage", map.get("isLastPage"));
} catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, list,true);
}
}
@Action("/client/api/v2/userShareLog")
public void userShareLog () {
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(uid);
requiredArgList.add(screenName);
requiredArgList.add(shareChannel);
requiredArgList.add(shareTarget);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
try {
appService.insertShareLog(uid, screenName, shareChannel, shareTarget);
} catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally{
this.sendResult(resultMap, null,false);
}
}
@Action("/client/api/v2/validateCode")
public void validateCode(){
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(mobile);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
boolean b = StringUtil.validMobileNumber(mobile);
String message="";
if (!b) {
message = "mobileValidateError";
} else {
try {
boolean flag = userUserProxy.isUserRegistrable(UserUserProxy.USER_IDENTITY_TYPE.MOBILE,mobile);
if (flag) {
UserUser userUser = new UserUser();
userUser.setMobileNumber(mobile);
String code = userClient.sendAuthenticationCode(UserUserProxy.USER_IDENTITY_TYPE.MOBILE, userUser, com.lvmama.comm.vo.Constant.SMS_SSO_TEMPLATE.SMS_REGIST_AUTHENTICATION_CODE.name());
if (code != null) {
message = "";
} else {
message = "error";
}
} else {
message = "mobile_in_users";
}
} catch (Exception e) {
this.setExceptionResult(resultMap);
e.printStackTrace();
} finally{
if(!StringUtil.isEmptyString(message)) {
this.sendResult(this.putErrorMessage(resultMap, ClientConstants.getErrorInfo().get(message)), "",false);
} else {
this.sendResult(resultMap, "",false);
}
}
}
}
@Action("/client/api/v2/reg")
public void subRegist(){
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(mobile);
requiredArgList.add(validateCode);
requiredArgList.add(firstChannel);
requiredArgList.add(password);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
String message = "";
ClientUser cu = new ClientUser();
UserUser user = null;
try {
boolean b = validateAuthenticationCode(mobile, StringUtils.trimAllWhitespace(validateCode), firstChannel);
boolean isUserRegistrable=false;
isUserRegistrable = userUserProxy.isUserRegistrable(UserUserProxy.USER_IDENTITY_TYPE.MOBILE, mobile);
log.error("b: " + b + ", isUserRegistrable: " + isUserRegistrable);
if (b&&isUserRegistrable) {
user = UserUserUtil.genDefaultUserByMobile(mobile);
user.setRealPass(password);
user.setGroupId(firstChannel);
user.setChannel(firstChannel);
try {
user.setUserPassword(UserUserUtil.encodePassword(user.getRealPass()));
} catch (NoSuchAlgorithmException e1) {
log.error(this.getClass(),e1);
}
try {
user.setRegisterIp(InternetProtocol.getRemoteAddr(getRequest()));
user.setRegisterPort(InternetProtocol.getRemotePort(getRequest()));
user = this.userUserProxy.register(user);
} catch (Exception e) {
e.printStackTrace();
}
cu.setPoint(100L);
if (user != null) {
super.getUserByMap(user, cu);
String couponCode = this.subCouponCodeByRegister(cu.getUserId());
userUserProxy.addUserPoint(user.getId(), "POINT_FOR_NORMAL_REGISTER", null, "客户端注册");
if(isIos()){
if (couponCode != null) {
cu.setCouponInfo("8");
}
}
message = "";
} else {
message = "mobileValidateError";
}
} else {
if(!isUserRegistrable){
message = "mobileIsUsed";
} else {
message = "validateCodeError";
}
}
}catch (Exception e) {
this.setExceptionResult(resultMap);
e.printStackTrace();
} finally{
if(!StringUtil.isEmptyString(message)) {
this.sendResult(this.putErrorMessage(resultMap, ClientConstants.getErrorInfo().get(message)), "",false);
} else {
this.regClientBugServerFixModel(cu, resultMap);
}
}
}
private void regClientBugServerFixModel (ClientUser cu ,Map<String,Object> resultMap){
Long version = 0L;
if (!StringUtil.isEmptyString(lvversion)) {
version = Long.valueOf(lvversion.replace(".", ""));
}
if(!StringUtil.isEmptyString(cu.getCouponInfo())){
if(!isIos()){
cu.setCouponInfo("1。获得优惠券,价值8元 \n 2.获得100积分");
} else if(isIos()&&version>=261L){
cu.setCouponInfo("1。获得优惠券,价值8元 \n 2.获得100积分");
}
} else {
if(!isIos()){
cu.setCouponInfo("1.获得100积分");
} else if(isIos()&&version>=261L){
cu.setCouponInfo("1.获得100积分");
}
}
this.sendResult(resultMap, cu,false);
}
private UserUser registByCooperationInfo(UserUser users) {
UserUser user = UserUserUtil.genDefaultUser();
user.setChannel(firstChannel);
if(isAndroid()){
try {
screenName = new String(screenName.getBytes("iso-8859-1"), "utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
user.setUserName("From "+loginChannel.toLowerCase()+" weibo " + (null !=screenName ? screenName : "") + "("
+ uid + ")");
UserCooperationUser cu = new UserCooperationUser();
cu.setCooperation(loginChannel);
cu.setCooperationUserAccount(uid);
userUserProxy.registerUserCooperationUser(user, cu);
users = userUserProxy.getUserUserByUserNo(user.getUserNo());
return users;
}
private List<UserCooperationUser> getCooperationUserByChannelUID (String channel,String uid) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("cooperationUserAccount", uid);
parameters.put("cooperation", channel);
List<UserCooperationUser> cooperationUseres = userCooperationUserService.getCooperationUsers(parameters);
return cooperationUseres;
}
private UserUser registByUser(UserUser users) {
UserUser user = UserUserUtil.genDefaultUser();
user.setChannel(firstChannel);
if(isAndroid()){
try {
screenName = new String(screenName.getBytes("iso-8859-1"), "utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
user.setUserName("From "+loginChannel.toLowerCase()+" weibo " + (null != screenName ? screenName : "") + "("
+ uid + ")");
user.setRegisterIp(InternetProtocol.getRemoteAddr(getRequest()));
user.setRegisterPort(InternetProtocol.getRemotePort(getRequest()));
userUserProxy.register(user);
users = userUserProxy.getUserUserByUserNo(user.getUserNo());
return users;
}
private ClientUser loginByCooperationChanel(){
try {
if ("SINA".equals(loginChannel)||"TENCENT".equals(loginChannel)) {
UserUser users = null;
List<UserCooperationUser> cooperationUseres = this.getCooperationUserByChannelUID(loginChannel,uid);
if (null == cooperationUseres || cooperationUseres.isEmpty()) {
users = this.registByCooperationInfo(users);
} else {
UserCooperationUser ucu = cooperationUseres.get(0);
users = userUserProxy.getUserUserByPk(ucu.getUserId());
if("N".equals(users.getIsValid())) {
users = this.registByUser(users);
ucu.setUserId(users.getId());
userCooperationUserService.update(ucu);
}
}
ClientUser cu = new ClientUser();
cu.setUserId(users.getUserId());
cu.setEmail(users.getEmail());
cu.setImageUrl(Constant.PIC_HOST + users.getImageUrl());
cu.setMobileNumber(StringUtil.trimNullValue(users.getMobileNumber()));
cu.setNickName(StringUtil.trimNullValue(users.getNickName()));
cu.setRealName(StringUtil.trimNullValue(users.getRealName()));
cu.setUserName(StringUtil.trimNullValue(users.getUserName()));
cu.setPoint(users.getPoint());
cu.setLastLoginTime(DateUtil.getFormatDate(users.getLastLoginDate(), "yyyy-MM-dd HH:mm:ss"));
Long point = 0L;
if (users.getPoint() != null) {
point = users.getPoint();
}
this.checkUserLoginDate(users, cu);
cu.setLevel(UserLevelUtils.getLevel(point));
cu.setWithdraw(users.getWithdraw() == null ? "0元" : PriceUtil
.convertToYuan(users.getWithdraw())
+ "元");
CashAccount ba = cashAccountService.queryCashAccountByUserId(users.getId());
if(ba!=null) {
cu.setAwardBalance(ba.getBonusBalanceFloat()+"元");
} else {
cu.setAwardBalance("0元");
}
cu.setCashBalance(ba.getTotalCashBalanceYuan() + "元");
return cu;
}
} catch(Exception ex){
ex.printStackTrace();
return null;
}
return null;
}
private void checkUserLoginDate (UserUser user,ClientUser cu) {
Date lastLoginDate = user.getLastLoginDate();
Date currentDate = new Date();
if (lastLoginDate!=null&&com.lvmama.comm.utils.DateUtil.compareDateLessOneDayMore(currentDate, lastLoginDate)) {
user.setLastLoginDate(new Date());
userUserProxy.update(user);//设置上次登录时间
UserActionCollectionService userActionCollectionService = (UserActionCollectionService) SpringBeanProxy.getBean("userActionCollectionService");
if (null != userActionCollectionService) {
userActionCollectionService.save(user.getId(), InternetProtocol.getRemoteAddr(getRequest()),InternetProtocol.getRemotePort(getRequest()), "LOGIN", null);
}
userUserProxy.addUserPoint(user.getId(), "POINT_FOR_LOGIN", null, "客户端登陆");
// SSOMessageProducer producer = (SSOMessageProducer)SpringBeanProxy.getBean("ssoMessageProducer");
// producer.sendMsg(new SSOMessage(SSO_EVENT.LOGIN, SSO_SUB_EVENT.NORMAL, user.getId()));
cu.setPoint(5L);
} else {
cu.setPoint(0L);
}
}
@Action("/client/api/v2/login")
public void login(){
Map<String,Object> resultMap = super.resultMapCreator();
ClientUser cu = new ClientUser();
UserUser user = null;
try {
if (!StringUtil.isEmptyString(loginChannel)) {
requiredArgList.add(uid);
requiredArgList.add(screenName);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
cu = this.loginByCooperationChanel();
} else {
requiredArgList.add(userName);
requiredArgList.add(password);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
user = userUserProxy.login(StringUtils.trimAllWhitespace(userName), StringUtils.trimAllWhitespace(password));
if (user != null) {
this.getUserByMap(user, cu);
} else {
this.putErrorMessage(resultMap, "用户名或者密码错误");
}
}
} catch (Exception ex){
this.setExceptionResult(resultMap);
ex.printStackTrace();
} finally{
if(cu!=null){
//检测是否是今天第一次 登陆并添加积分
if (user != null) {
this.checkUserLoginDate(user, cu);
}
this.sendResult(resultMap, cu,false);
}
}
}
@Action("/client/api/v2/proxyLogin")
public void proxySsoLogin(){
Map<String,Object> resultMap = super.resultMapCreator();
requiredArgList.add(userName);
requiredArgList.add(password);
requiredArgList.add(lvSessionId);
requiredArgList.add(udid);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
String jsons = "{}";
try {
//jsons = HttpsUtil.requestGet(ClutterConstant.getLoginURL()+"?mobileOrEMail="+userName+"&password="+password+"&"+Constant.LV_SESSION_ID+"="+lvSessionId);
getRequest().setAttribute(Constant.LV_SESSION_ID, lvSessionId);
this.getResponse().sendRedirect(ClutterConstant.getLoginURL()+"?mobileOrEMail="+userName+"&password="+password+"&"+Constant.LV_SESSION_ID+"="+lvSessionId);
} catch (Exception ex){
ex.printStackTrace();
} finally{
}
}
@Action("/client/api/v2/changeDest")
public void changeDest() {
String url = ClutterConstant.getSearchHost()+"/search/clientSearch!getChinaTreeByHasProduct.do?fromPage=isClient&productType=hasTicket";
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/hotelCities")
public void hotelCities () {
String url = ClutterConstant.getSearchHost()+"/search/clientSearch!getCityListByHasProduct.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/getAutoCompleteHotelSpot")
public void getAutoCompleteHotelSpot(){
String url = ClutterConstant.getSearchHost()+"/search/clientSearch!getAutoCompleteHotelSpot.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/getAutoCompletePlace")
public void getAutoCompletePlace(){
String url = ClutterConstant.getSearchHost()+"/search/clientSearch!getAutoCompletePlace.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/getClientSubjectByCity")
public void getClientSubjectByCity(){
String url = ClutterConstant.getSearchHost()+"/search/clientSearch!getClientSubjectByCity.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/getAutoCompleteHotelCity")
public void getAutoCompleteHotelCity () {
String url = ClutterConstant.getSearchHost()+"/search/clientSearch!getAutoCompleteHotelCity.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/routeSearch")
public void routeSearch(){
String url = ClutterConstant.getSearchHost()+"/search/clientRouteSearch!routeSearch.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/getRouteSubject")
public void getRouteSubject(){
String url = ClutterConstant.getSearchHost()+"/search/clientRouteSearch!getRouteSubject.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/nearSearch")
public void nearSearch(){
String url = ClutterConstant.getSearchHost()+"/search/clientSearch!nearSearch.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/placeSearch")
public void placeSearch(){
String url = ClutterConstant.getSearchHost()+"/search/clientSearch!placeSearch.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/getAutoComplete")
public void getAutoComplete(){
String url = ClutterConstant.getSearchHost()+"/search/clientRouteSearch!getAutoComplete.do?"+this.getRequest().getQueryString();
try {
this.getResponse().sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}
@Action("/client/api/v2/queryGrouponList")
public void queryGrouponList() {
Map<String,Object> resultMap = super.resultMapCreator();
List<ClientGroupon2> list = null;
try {
list = appService.queryGrouponList();
} catch (Exception ex) {
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally {
this.sendResult(resultMap, list,true);
}
}
@Action("/client/api/v2/getCommentLatitudeInfos")
public void getCommentLatitudeInfos () {
Map<String,Object> resultMap = super.resultMapCreator();
if(StringUtil.isEmptyString(orderId)){
requiredArgList.add(placeId);
}
if(placeId==null){
requiredArgList.add(orderId);
}
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",true);
return;
}
List<DicCommentLatitudeVO> list = null;
try {
list = appService.getCommentLatitudeInfos(placeId, orderId);
} catch (Exception ex) {
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally {
this.sendResult(resultMap, list,true);
}
}
//重发短信凭证信息
private String subCouponCodeByRegister(String userId){
UserUser user = userUserProxy.getUserUserByUserNo(userId);
String couponId = ClutterConstant.getClientRegisterCouponId();
MarkCoupon mc = markCouponService.selectMarkCouponByPk(Long.valueOf(couponId));
if(!mc.isOverDue()) {
MarkCouponCode markCouponCode = markCouponService.generateSingleMarkCouponCodeByCouponId(Long.valueOf(couponId));
markCouponService.bindingUserAndCouponCode(user, markCouponCode.getCouponCode());
return markCouponCode.getCouponCode();
}
return null;
}
@Action("/client/api/v2/feedback")
public void commitFeedBack () {
Map<String,Object> resultMap = super.resultMapCreator();
/**
* 处理android 乱码
*/
if(isAndroid()){
try {
content = new String(content.getBytes("iso-8859-1"), "utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
requiredArgList.add(content);
requiredArgList.add(email);
requiredArgList.add(firstChannel);
this.checkArgs(requiredArgList, resultMap);
if(!resultMap.get("code").equals("1")){
super.sendResult(resultMap, "",false);
return;
}
try {
appService.addfeedBack(content, email, userId, firstChannel);
} catch(Exception ex){
ex.printStackTrace();
this.setExceptionResult(resultMap);
} finally {
super.sendResult(resultMap, "",false);
}
}
private boolean validateAuthenticationCode(String mobile, String code, String channel){
boolean flag = userUserProxy.validateAuthenticationCode(UserUserProxy.USER_IDENTITY_TYPE.MOBILE, code, mobile);
if(flag){
return true;
}
return false;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public void setUserClient(UserClient userClient) {
this.userClient = userClient;
}
public void setMarkCouponService(MarkCouponService markCouponService) {
this.markCouponService = markCouponService;
}
public void setUserCooperationUserService(
UserCooperationUserService userCooperationUserService) {
this.userCooperationUserService = userCooperationUserService;
}
}
| [
"feiniu7903@163.com"
] | feiniu7903@163.com |
c63221d39bac25ee540d7b63c836cf5b11083112 | 0757abb67be639ccf73507c9068226a5bb1c1aa8 | /app/src/androidTest/java/com/example/lab5real/ExampleInstrumentedTest.java | 3b9471221f324f474c71b68c01371bf114a84ca7 | [] | no_license | akoscik/Lab5Real | d83b8272b1c992dfe262bb55f0d6c668f1f39cc4 | 1ace8bbecd6a41c54f1eb14af45a118516143353 | refs/heads/master | 2023-09-04T23:27:49.958872 | 2021-10-18T17:32:07 | 2021-10-18T17:32:07 | 418,233,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package com.example.lab5real;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.lab5real", appContext.getPackageName());
}
} | [
"akoscik@wisc.edu"
] | akoscik@wisc.edu |
7e9ff9d096af3167f8e0e5fde63032010b21b313 | 313f8e3094daeaa209021298c7c58e6d70b92077 | /app/src/main/java/com/example/movieapp/MovieAdapter.java | e66c8711bb7735c6a3b7a52c2d99af4e92cc2d88 | [] | no_license | mirojurisic/Movie_app | 092a9454c38fa285aff7c2f4b416c543601af671 | e1b784fba99d3375de32c64c679a0118bc5c0120 | refs/heads/master | 2020-09-01T16:35:23.647006 | 2019-11-08T06:09:22 | 2019-11-08T06:09:22 | 219,005,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,526 | java | package com.example.movieapp;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.squareup.picasso.Picasso;
import java.util.List;
class MovieAdapter extends RecyclerView.Adapter<MovieAdapter.MovieViewHolder> {
final static String TAG = MovieAdapter.class.toString();
final static String IMAGE_BASE = "https://image.tmdb.org/t/p/w185/";
final int NUM_OF_MOVIES =20;
List<Movie> list_of_movies= null;
ListItemClickListener listItemClickListener;
public MovieAdapter(List<Movie> list_of_movies,ListItemClickListener listItemClickListener)
{
super();
this.list_of_movies = list_of_movies;
this.listItemClickListener = listItemClickListener;
}
public interface ListItemClickListener{
void onListItemClick(int index);
}
@NonNull
@Override
public MovieViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
Context context = parent.getContext();
int layoutIdForSingleItem = R.layout.single_item;
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater.inflate(layoutIdForSingleItem,parent,false);
return new MovieViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MovieViewHolder holder, int position) {
holder.bind(position);
}
@Override
public int getItemCount() {
return NUM_OF_MOVIES;
}
public class MovieViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
ImageView movie_poster;
Context context;
MovieViewHolder(View view){
super(view);
context = view.getContext();
movie_poster = view.findViewById(R.id.movie_image);
view.setOnClickListener(this); // because it extends View.OnClickListener
}
void bind(int index){
Log.v(TAG,IMAGE_BASE+list_of_movies.get(index).getImageUrl());
Picasso.get().load(IMAGE_BASE+list_of_movies.get(index).getImageUrl())
.placeholder(R.drawable.movie_placeholder)
.into(movie_poster);
}
@Override
public void onClick(View v) {
listItemClickListener.onListItemClick(getAdapterPosition());
}
}
}
| [
"mirojurisic@hotmail.com"
] | mirojurisic@hotmail.com |
3bc49e289b4c677f168a6eec6af0e286a0f37473 | 331ec70982c9845edf44a31ea8aa9ff85107fd95 | /Wallpaper/src/com/iproda/wallpapers/Receiver.java | a6512cfd3b7a76fefccef5aa870bd22e060ddf90 | [] | no_license | linshixiong/Wallpaper365 | 20ab962690638a8e9ab716a347be141ae64f080b | 2fa87f7127d5b5e5e53d84208c47d9586de6488c | refs/heads/master | 2016-09-05T12:31:51.123969 | 2015-08-22T08:06:47 | 2015-08-22T08:06:47 | 40,355,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package com.iproda.wallpapers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class Receiver extends BroadcastReceiver {
@Override
public void onReceive(Context arg0, Intent arg1) {
if (WallpaperService.ACTION_ALARM_WAKEUP.equals(arg1.getAction())) {
Intent service = new Intent("com.iproda.wallpapers.WALLPAPER_SERVICE");
service.putExtra("action", 1);
arg0.startService(service);
} else if (Intent.ACTION_BOOT_COMPLETED.equals(arg1.getAction())) {
Intent service = new Intent("com.iproda.wallpapers.WALLPAPER_SERVICE");
service.putExtra("action", 2);
arg0.startService(service);
}
}
}
| [
"linsx.lin@emdoor.com"
] | linsx.lin@emdoor.com |
be671ffa375a9e75a5a42a57844f29aade481e62 | 2efe7e6b40996fe7e9bc69a50b1d4643729fe6f7 | /graduation/src/main/java/qcj/graduation/model/SignIn.java | b8de1ce60fadd4ac046983a058b1c7d2e55f79f3 | [] | no_license | qiaocj/graduation-project | 56bbf3f0dceb13e1bc602deafd6eb6c7a1351651 | 811e2983ede9b336eb8a521eca6e60f29edd4872 | refs/heads/master | 2021-06-01T04:46:56.873450 | 2016-04-17T12:31:38 | 2016-04-17T12:31:38 | 55,974,154 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package qcj.graduation.model;
import lombok.Data;
import java.io.Serializable;
/**
* Created by Administrator on 2016/4/10.
*/
@Data
public class SignIn implements Serializable {
private Long id;
private Long code;
private Long classCode;
}
| [
"524310169@qq.com"
] | 524310169@qq.com |
d2a41e12f88d2317b73f00f3d7bf4d2c74348567 | 7ff3675b3433ae41a100846a8dd5eec45bcea233 | /library/src/androidTest/java/com/github/ksoichiro/android/observablescrollview/test/HeaderGridViewActivityTest.java | 9f43a692fd15128c4ced644d6d44b59a2b0f0620 | [] | no_license | Shankar1056/etodo | 18cb7dd6a6100226af9d04c6616c7b51bcd55348 | bb6413c76998be8fe5b98bf7c23193da624f0126 | refs/heads/master | 2021-10-10T15:31:21.352234 | 2019-01-13T06:39:31 | 2019-01-13T06:39:31 | 104,873,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,718 | java | package com.github.ksoichiro.android.observablescrollview.test;
import android.test.ActivityInstrumentationTestCase2;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ListAdapter;
import android.widget.SimpleAdapter;
import com.github.ksoichiro.android.observablescrollview.ObservableGridView;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class HeaderGridViewActivityTest extends ActivityInstrumentationTestCase2<HeaderGridViewActivity> {
private HeaderGridViewActivity activity;
private ObservableGridView scrollable;
public HeaderGridViewActivityTest() {
super(HeaderGridViewActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
setActivityInitialTouchMode(true);
activity = getActivity();
scrollable = (ObservableGridView) activity.findViewById(R.id.scrollable);
}
public void testScroll() throws Throwable {
UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP);
getInstrumentation().waitForIdleSync();
UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.DOWN);
getInstrumentation().waitForIdleSync();
}
public void testSaveAndRestoreInstanceState() throws Throwable {
UiTestUtils.saveAndRestoreInstanceState(this, activity);
testScroll();
}
public void testScrollVerticallyTo() throws Throwable {
final DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
runTestOnUiThread(new Runnable() {
@Override
public void run() {
scrollable.scrollVerticallyTo((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, metrics));
}
});
getInstrumentation().waitForIdleSync();
runTestOnUiThread(new Runnable() {
@Override
public void run() {
scrollable.scrollVerticallyTo(0);
}
});
getInstrumentation().waitForIdleSync();
}
public void testHeaderViewFeatures() throws Throwable {
runTestOnUiThread(new Runnable() {
@Override
public void run() {
assertEquals(1, scrollable.getHeaderViewCount());
assertEquals(1, scrollable.getFooterViewCount());
ListAdapter adapter = scrollable.getAdapter();
assertTrue(adapter instanceof ObservableGridView.HeaderViewGridAdapter);
ObservableGridView.HeaderViewGridAdapter hvgAdapter = (ObservableGridView.HeaderViewGridAdapter) adapter;
assertEquals(1, hvgAdapter.getHeadersCount());
assertEquals(1, hvgAdapter.getFootersCount());
assertNotNull(hvgAdapter.getWrappedAdapter());
assertTrue(hvgAdapter.areAllItemsEnabled());
assertFalse(hvgAdapter.isEmpty());
Object data = hvgAdapter.getItem(0);
assertNull(data);
assertNotNull(hvgAdapter.getView(0, null, scrollable));
assertNotNull(hvgAdapter.getView(1, null, scrollable));
assertNotNull(hvgAdapter.getFilter());
assertTrue(scrollable.removeHeaderView(activity.headerView));
assertEquals(0, scrollable.getHeaderViewCount());
assertEquals(0, hvgAdapter.getHeadersCount());
assertFalse(scrollable.removeHeaderView(activity.headerView));
activity.headerView = new View(activity);
final int flexibleSpaceImageHeight = activity.getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
flexibleSpaceImageHeight);
activity.headerView.setLayoutParams(lp);
// This is required to disable header's list selector effect
activity.headerView.setClickable(true);
scrollable.addHeaderView(activity.headerView);
assertEquals(100/* items */ + 2/* header */ + 2/* footer */, hvgAdapter.getCount());
assertEquals(1, hvgAdapter.getHeadersCount());
assertEquals(2, hvgAdapter.getNumColumns());
// If the header is added by addHeader(View),
// HeaderViewGridAdapter doesn't contain any associated data.
// headerData does NOT mean the view.
// If we want to get the view, we should use getView().
assertNull(hvgAdapter.getItem(0));
assertNull(hvgAdapter.getItem(1));
assertEquals(1, hvgAdapter.getFootersCount());
assertNull(hvgAdapter.getItem(100/* items */ + 2/* header */ + 2/* footer */ - 1 - 1));
assertNull(hvgAdapter.getItem(100/* items */ + 2/* header */ + 2/* footer */ - 1));
}
});
// Scroll to bottom and try removing re-adding the footer view.
for (int i = 0; i < 10; i++) {
UiTestUtils.swipeVertically(this, scrollable, UiTestUtils.Direction.UP);
}
getInstrumentation().waitForIdleSync();
runTestOnUiThread(new Runnable() {
@Override
public void run() {
ListAdapter adapter = scrollable.getAdapter();
ObservableGridView.HeaderViewGridAdapter hvgAdapter = (ObservableGridView.HeaderViewGridAdapter) adapter;
assertTrue(scrollable.removeFooterView(activity.footerView));
assertEquals(0, scrollable.getFooterViewCount());
assertEquals(0, hvgAdapter.getFootersCount());
assertFalse(scrollable.removeFooterView(activity.footerView));
activity.footerView = new View(activity);
final int flexibleSpaceImageHeight = activity.getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
FrameLayout.LayoutParams lpf = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
flexibleSpaceImageHeight);
activity.footerView.setLayoutParams(lpf);
scrollable.addFooterView(activity.footerView);
}
});
}
public void testHeaderViewGridExceptions() throws Throwable {
runTestOnUiThread(new Runnable() {
@Override
public void run() {
try {
new ObservableGridView.HeaderViewGridAdapter(null, null, null);
} catch (IllegalArgumentException e) {
fail();
}
ListAdapter adapter = scrollable.getAdapter();
ObservableGridView.HeaderViewGridAdapter hvgAdapter = (ObservableGridView.HeaderViewGridAdapter) adapter;
try {
hvgAdapter.setNumColumns(0);
} catch (IllegalArgumentException e) {
fail();
}
ArrayList<ObservableGridView.FixedViewInfo> headerViewInfos = new ArrayList<>();
ObservableGridView.HeaderViewGridAdapter adapter1 = new ObservableGridView.HeaderViewGridAdapter(headerViewInfos, null, null);
assertTrue(adapter1.isEmpty());
try {
adapter1.isEnabled(-1);
fail();
} catch (ArrayIndexOutOfBoundsException ignore) {
}
try {
adapter1.getItem(-1);
fail();
} catch (ArrayIndexOutOfBoundsException ignore) {
}
try {
adapter1.getView(0, null, null);
fail();
} catch (ArrayIndexOutOfBoundsException ignore) {
}
try {
adapter1.getView(-1, null, scrollable);
fail();
} catch (ArrayIndexOutOfBoundsException ignore) {
}
}
});
}
public void testHeaderViewGridAdapter() throws Throwable {
runTestOnUiThread(new Runnable() {
@Override
public void run() {
try {
new ObservableGridView.HeaderViewGridAdapter(null, null, null);
} catch (IllegalArgumentException ignore) {
fail();
}
}
});
runTestOnUiThread(new Runnable() {
@Override
public void run() {
ArrayList<ObservableGridView.FixedViewInfo> list = new ArrayList<>();
Map<String, String> map = new LinkedHashMap<>();
map.put("text", "A");
List<Map<String, ?>> data = new ArrayList<>();
data.add(map);
ObservableGridView.HeaderViewGridAdapter adapter =
new ObservableGridView.HeaderViewGridAdapter(
list,
null,
new SimpleAdapter(
activity,
data,
android.R.layout.simple_list_item_1,
new String[]{"text"},
new int[]{android.R.id.text1}));
assertFalse(adapter.removeHeader(null));
assertEquals(1, adapter.getCount());
}
});
runTestOnUiThread(new Runnable() {
@Override
public void run() {
ArrayList<ObservableGridView.FixedViewInfo> list = new ArrayList<>();
ObservableGridView.HeaderViewGridAdapter adapter =
new ObservableGridView.HeaderViewGridAdapter(
list,
null,
null);
assertEquals(0, adapter.getCount());
try {
adapter.isEnabled(1);
fail();
} catch (IndexOutOfBoundsException ignore) {
}
try {
adapter.getItem(1);
fail();
} catch (IndexOutOfBoundsException ignore) {
}
}
});
}
}
| [
"shankar@spotsoon.com"
] | shankar@spotsoon.com |
3684b3b0b029c01b5803e40e3c00081fa214d686 | 54cb375acab715549c9a5b15f65f3d9ac0deef91 | /src/test/java/com/github/alexeylapin/oca/g02_working_with_java_data_types/t05_wrapper_classes/T_Boolean.java | 41c0ee6e1b5850beb7b098d6b8ee58eb88c65105 | [
"MIT"
] | permissive | alexey-lapin/java-prep-8-oca | 9f364ef9eb6144086b9e7e1add6449a57255de6e | 4f07482ac958f97af6247e05dc41d8e57dc1b3bb | refs/heads/master | 2023-03-12T19:42:21.115172 | 2021-03-05T18:07:04 | 2021-03-05T18:07:04 | 337,149,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,070 | java | package com.github.alexeylapin.oca.g02_working_with_java_data_types.t05_wrapper_classes;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* new Boolean(boolean)
* new Boolean(String)
*
* parseBoolean()
*
*/
public class T_Boolean {
@Test
void name() {
Boolean v = new Boolean(true);
}
@Test
void name2() {
Boolean v = new Boolean("true");
assertThat(v).isTrue();
}
@Test
void name3() {
assertThat(new Boolean(null)).isFalse();
assertThat(new Boolean("")).isFalse();
assertThat(new Boolean(" ")).isFalse();
assertThat(new Boolean("true ")).isFalse();
}
@Test
void name4() {
assertThat(Boolean.parseBoolean("true")).isTrue();
}
@Test
void name5() {
assertThat(Boolean.parseBoolean(null)).isFalse();
assertThat(Boolean.parseBoolean("")).isFalse();
assertThat(Boolean.parseBoolean(" ")).isFalse();
assertThat(Boolean.parseBoolean("true ")).isFalse();
}
}
| [
"alexey-lapin@protonmail.com"
] | alexey-lapin@protonmail.com |
bb608900c5165449cd8ce778067cf28d5842de5a | 2b34910acadd2864cadb12afe6bcf595f1918bf1 | /src/main/java/com/commerceiq/scraper/dto/RequestDto.java | 201d7bdfefdb832583df72951218cc6104a85634 | [] | no_license | srivkrnt/commerceiq-task | 648a87862c4993a1a5e594c2b7391585cd57a81f | bc7b26617ea2b7268ad0f37d2c7ae56acffc2c03 | refs/heads/main | 2023-04-21T07:49:27.410220 | 2021-05-20T09:34:01 | 2021-05-20T09:34:01 | 369,103,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package com.commerceiq.scraper.dto;
import org.springframework.stereotype.Component;
@Component
public class RequestDto {
private String urlOrSku;
}
| [
"sri.vkrnt@gmail.com"
] | sri.vkrnt@gmail.com |
4eaae68ede3493ac44c6c1d7184e9ad5ea8dd95a | 2e8362c1b1490dd720e727bea452d7529913db79 | /MyXiangMu/app/src/main/java/com/hhzmy/myxiangmu/adpter/MySouYePagerAdapter.java | 2ccce8e19f1219c2477c2106d63bdce58f9807e5 | [] | no_license | zhangzuan/1510b | 49f6ed4201794add199761ce66bc3218e9eada5a | c4a1d7f8311c66fe573220626b6f4f4ce3b24814 | refs/heads/master | 2021-01-12T06:28:25.224000 | 2016-12-26T07:35:56 | 2016-12-26T07:35:56 | 77,366,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,273 | java | package com.hhzmy.myxiangmu.adpter;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2016/11/9.
*/
public class MySouYePagerAdapter extends PagerAdapter {
private List<ImageView> imglist;
public MySouYePagerAdapter(List<ImageView> imglist) {
this.imglist = imglist;
}
@Override
public int getCount() {
return imglist.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view==object;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(imglist.get(position));
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView=imglist.get(position);
ViewParent parent= imageView.getParent();
if (parent!=null)
{
ViewGroup group= (ViewGroup) parent;
group.removeView(imageView);
}
container.addView(imageView);
return imageView;
}
}
| [
"461934487@qq.com"
] | 461934487@qq.com |
8427f5efe1b302c4a2554d418a6f06f7454f9dd1 | 11dcb436d35a0c8d950a1aefc8ca44da97b840b8 | /jdk-source/org/omg/DynamicAny/DynFixed.java | 5e5ff0f4521be83eeff616686eae623cf0366717 | [] | no_license | StaticWalk/jdk8 | ea4724fb572ce5c5164f25259dfd9589a5e6ed7d | 935dbbd1438b83e5a2c6d9d5e98059e525ad0c38 | refs/heads/master | 2022-01-08T01:14:45.477914 | 2019-05-23T08:26:28 | 2019-05-23T08:26:28 | 125,055,346 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package org.omg.DynamicAny;
/**
* org/omg/DynamicAny/DynFixed.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u112/7884/corba/src/share/classes/org/omg/DynamicAny/DynamicAny.idl
* Thursday, September 22, 2016 9:33:09 PM PDT
*/
/**
* DynFixed objects support the manipulation of IDL fixed values.
* Because IDL does not have a generic type that can represent fixed types with arbitrary
* number of digits and arbitrary scale, the operations use the IDL string type.
*/
public interface DynFixed extends DynFixedOperations, org.omg.DynamicAny.DynAny, org.omg.CORBA.portable.IDLEntity
{
} // interface DynFixed
| [
"957400829@qq.com"
] | 957400829@qq.com |
6f3b5f289f166c8284393902fd0e0bf72076f050 | 29a5e9c479d947b2eb084581428062fabf9a5290 | /drools-wb-screens/drools-wb-guided-dtable-editor/drools-wb-guided-dtable-editor-client/src/main/java/org/drools/workbench/screens/guided/dtable/client/widget/analysis/DecisionTableAnalyzer.java | 1ed78409cbcdd298310612a59b36af638ec9ec23 | [
"Apache-2.0"
] | permissive | hasys/drools-wb | f65ad98a41e0603cadc3575d31e861276946ce27 | 930652c9f5a77eb4c47d382024dd718fe9d63493 | refs/heads/master | 2020-05-29T12:30:01.668024 | 2015-06-25T16:21:26 | 2015-06-26T08:38:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,376 | java | /*
* Copyright 2011 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.workbench.screens.guided.dtable.client.widget.analysis;
import java.util.ArrayList;
import java.util.List;
import com.google.gwt.event.shared.EventBus;
import org.drools.workbench.models.guided.dtable.shared.model.Analysis;
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
import org.drools.workbench.screens.guided.dtable.client.widget.analysis.cache.RowInspectorCache;
import org.drools.workbench.screens.guided.dtable.client.widget.analysis.checks.base.Check;
import org.drools.workbench.screens.guided.dtable.client.widget.analysis.checks.base.Checks;
import org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle;
import org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue;
import org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.AfterColumnDeleted;
import org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.AfterColumnInserted;
import org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.AppendRowEvent;
import org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.DeleteRowEvent;
import org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.InsertRowEvent;
import org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.UpdateColumnDataEvent;
public class DecisionTableAnalyzer
implements ValidateEvent.Handler,
DeleteRowEvent.Handler,
AfterColumnDeleted.Handler,
UpdateColumnDataEvent.Handler,
AppendRowEvent.Handler,
InsertRowEvent.Handler,
AfterColumnInserted.Handler {
private final RowInspectorCache cache;
private final GuidedDecisionTable52 model;
private final EventBus eventBus;
private final Checks checks = new Checks();
private final EventManager eventManager = new EventManager();
public DecisionTableAnalyzer( AsyncPackageDataModelOracle oracle,
GuidedDecisionTable52 model,
EventBus eventBus ) {
this.model = model;
this.eventBus = eventBus;
cache = new RowInspectorCache( oracle,
model,
new UpdateHandler() {
@Override
public void updateRow( RowInspector oldRowInspector,
RowInspector newRowInspector ) {
checks.update( oldRowInspector, newRowInspector );
}
} );
eventBus.addHandler( ValidateEvent.TYPE,
this );
eventBus.addHandler( DeleteRowEvent.TYPE,
this );
eventBus.addHandler( AfterColumnDeleted.TYPE,
this );
eventBus.addHandler( UpdateColumnDataEvent.TYPE,
this );
eventBus.addHandler( AppendRowEvent.TYPE,
this );
eventBus.addHandler( InsertRowEvent.TYPE,
this );
eventBus.addHandler( AfterColumnInserted.TYPE,
this );
}
private void resetChecks() {
for ( RowInspector rowInspector : cache.all() ) {
checks.add( rowInspector );
}
}
private List<Analysis> analyze() {
final List<Analysis> analysisData = new ArrayList<Analysis>();
this.checks.run();
for ( RowInspector rowInspector : cache.all() ) {
Analysis analysis = new Analysis();
for ( Check check : checks.get( rowInspector ) ) {
if ( check.hasIssues() ) {
analysis.addRowMessage( check.getIssue() );
}
}
analysisData.add( analysis );
}
return analysisData;
}
private void updateAnalysisColumn() {
model.getAnalysisData().clear();
model.getAnalysisData().addAll(analyze());
eventBus.fireEvent(new UpdateColumnDataEvent(getAnalysisColumnIndex(),
getAnalysisColumnData()));
}
// Retrieve the data for the analysis column
private List<CellValue<? extends Comparable<?>>> getAnalysisColumnData() {
List<CellValue<? extends Comparable<?>>> columnData = new ArrayList<CellValue<? extends Comparable<?>>>();
List<Analysis> analysisData = model.getAnalysisData();
for ( int i = 0; i < analysisData.size(); i++ ) {
Analysis analysis = analysisData.get( i );
CellValue<Analysis> cell = new CellValue<Analysis>( analysis );
columnData.add( cell );
}
return columnData;
}
private int getAnalysisColumnIndex() {
return model.getExpandedColumns().indexOf( model.getAnalysisCol() );
}
@Override
public void onValidate( ValidateEvent event ) {
if ( event.getUpdates().isEmpty() || checks.isEmpty() ) {
resetChecks();
} else {
cache.updateRowInspectors( event.getUpdates().keySet(),
model.getData() );
}
updateAnalysisColumn();
}
@Override
public void onAfterDeletedColumn( AfterColumnDeleted event ) {
cache.reset();
resetChecks();
updateAnalysisColumn();
}
@Override
public void onAfterColumnInserted( AfterColumnInserted event ) {
cache.reset();
resetChecks();
updateAnalysisColumn();
}
@Override
public void onUpdateColumnData( UpdateColumnDataEvent event ) {
if ( hasTheRowCountIncreased( event ) ) {
addRow( eventManager.getNewIndex() );
updateAnalysisColumn();
} else if ( hasTheRowCountDecreased( event ) ) {
RowInspector removed = cache.removeRow( eventManager.rowDeleted );
checks.remove( removed );
updateAnalysisColumn();
}
eventManager.clear();
}
private boolean hasTheRowCountDecreased( UpdateColumnDataEvent event ) {
return cache.all().size() > event.getColumnData().size();
}
private boolean hasTheRowCountIncreased( UpdateColumnDataEvent event ) {
return cache.all().size() < event.getColumnData().size();
}
private void addRow( int index ) {
RowInspector rowInspector = cache.addRow( index,
model.getData().get( index ) );
checks.add(rowInspector);
}
@Override
public void onDeleteRow( DeleteRowEvent event ) {
eventManager.rowDeleted = event.getIndex();
}
@Override
public void onAppendRow( AppendRowEvent event ) {
eventManager.rowAppended = true;
}
@Override
public void onInsertRow( InsertRowEvent event ) {
eventManager.rowInserted = event.getIndex();
}
class EventManager {
boolean rowAppended = false;
Integer rowInserted = null;
Integer rowDeleted = null;
public void clear() {
rowAppended = false;
rowInserted = null;
rowDeleted = null;
}
int getNewIndex() {
if ( eventManager.rowAppended ) {
return model.getData().size() - 1;
} else if ( eventManager.rowInserted != null ) {
return eventManager.rowInserted;
}
throw new IllegalStateException( "There is no active updates" );
}
}
}
| [
"michael.anstis@gmail.com"
] | michael.anstis@gmail.com |
f1708e46af63b5f01f992428f6eaebd368d4348c | f673e7cc942656f334f04f1b2e9fce0677f54ea4 | /NisiraCore/src/com/nisira/core/dao/DocIdentidadDao.java | a131beb8d10ccbf63220ee8093164846fc148c1b | [] | no_license | aburgosd91/WSPSS | c59e9d40c1dc63eef95b048a95bde55f48b01bee | 13ca0d5c2c6b4a2764e8510d2ba0dec66c632d7e | refs/heads/master | 2020-12-31T06:09:26.027290 | 2018-02-20T23:42:22 | 2018-02-20T23:42:22 | 80,635,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,664 | 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 com.nisira.core.dao;
import com.nisira.core.entity.DocIdentidad;
import com.nisira.framework.core.dao.EntityDao;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author alejndro zamora
*/
public class DocIdentidadDao extends EntityDao<DocIdentidad> {
@Override
public DocIdentidad find(DocIdentidad e) throws Exception {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<DocIdentidad> findAll(Object e) throws Exception {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<DocIdentidad> findAll() throws Exception {
ArrayList<DocIdentidad> l = new ArrayList<DocIdentidad>();
try {
String sql = "GETTABLES_RETURNDOCIDENTIDAD";
cn = obtenerConexionJTDS();
cl = cn.prepareCall("{CALL " + sql + "}");
rs = cl.executeQuery();
while (rs.next()) {
DocIdentidad di = new DocIdentidad();
di.setIddocidentidad(rs.getString("IDDOCIDENTIDAD"));
di.setDescripcion(rs.getString("DESCRIPCION"));
l.add(di);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
cerrar(cn, cl, rs);
}
return l;
}
public List<Object[]> lstDepartamentos() throws Exception {
List<Object[]> lst = new ArrayList<Object[]>();
String sql = "select * from DEPARTAMENTO";
cn = obtenerConexionJTDS();
pr = cn.prepareStatement(sql);
// pr.setString(1, e.toString());
rs = pr.executeQuery();
while (rs.next()) {
Object[] r = new Object[2];
r[0] = rs.getString("IDDEPARTAMENTO");
r[1] = rs.getString("DESCRIPCION");
lst.add(r);
}
return lst;
}
public Object[] lstDepartamentos(String filtro) throws Exception {
Object[] r = null;
String sql = "select * from DEPARTAMENTO where '"+filtro.trim()+"' like '%'+DESCRIPCION+'%'";
cn = obtenerConexionJTDS();
pr = cn.prepareStatement(sql);
// pr.setString(1, e.toString());
rs = pr.executeQuery();
while (rs.next()) {
r = new Object[2];
r[0] = rs.getString("IDDEPARTAMENTO");
r[1] = rs.getString("DESCRIPCION");
}
return r;
}
public List<Object[]> lstProvincia(Object e) throws Exception {
List<Object[]> lst = new ArrayList<Object[]>();
String sql = "select * from PROVINCIAS where IDDEPARTAMENTO = ?";
cn = obtenerConexionJTDS();
pr = cn.prepareStatement(sql);
pr.setString(1, e.toString());
rs = pr.executeQuery();
while (rs.next()) {
Object[] r = new Object[2];
r[0] = rs.getString("IDPROVINCIA");
r[1] = rs.getString("DESCRIPCION");
lst.add(r);
}
return lst;
}
public List<Object[]> lstCiudad(Object e1,Object e2) throws Exception {
List<Object[]> lst = new ArrayList<Object[]>();
String sql = "select * from UBIGEO where IDDEPARTAMENTO = ? AND IDPROVINCIA = ?";
cn = obtenerConexionJTDS();
pr = cn.prepareStatement(sql);
pr.setString(1, e1.toString());
pr.setString(2, e2.toString());
rs = pr.executeQuery();
while (rs.next()) {
Object[] r = new Object[2];
r[0] = rs.getString("IDUBIGEO").substring(rs.getString("IDUBIGEO").length()-2, rs.getString("IDUBIGEO").length());
r[1] = rs.getString("DESCRIPCION");
lst.add(r);
}
return lst;
}
public List<Object[]> lstCiudad(Object e) throws Exception {
List<Object[]> lst = new ArrayList<Object[]>();
String sql = "select * from UBIGEO where IDUBIGEO like ?";
cn = obtenerConexionJTDS();
pr = cn.prepareStatement(sql);
pr.setString(1, e.toString()+ "%");
rs = pr.executeQuery();
while (rs.next()) {
Object[] r = new Object[2];
r[0] = rs.getString("IDUBIGEO");
r[1] = rs.getString("DESCRIPCION");
lst.add(r);
}
return lst;
}
}
| [
"aburgos@aburgos.NISIRACORP.LOCAL"
] | aburgos@aburgos.NISIRACORP.LOCAL |
34dc548931e02b0ea04bd06b4bf1a0726f4b77e2 | ac663c0e3e37208074b9aa7e5509da018fa36460 | /NimGame/Model/model/Referee.java | 4f897bfd30f8e7d92e9dc4a6f54bb6bf0d4a9420 | [] | no_license | HugoChambefort/NimGame | 58405feb03288bbea7eeb6b437f37fb4b9868b2a | 50cd3f3e4d14667d08bfa31576767356229378eb | refs/heads/master | 2020-03-22T09:18:14.903655 | 2018-07-05T10:14:03 | 2018-07-05T10:14:03 | 139,828,124 | 0 | 0 | null | null | null | null | ISO-8859-2 | Java | false | false | 3,116 | java | package model;
import java.util.Scanner;
import controller.*;
public class Referee{
private int restart;
private boolean gagnant;
private boolean bonBaton;
private Batons batons;
private Player player;
private Player IA;
public Referee() {
restart = 1;
batons = new Batons();
player = new Player(batons);
IA = new Player(batons);
}
public void EnleverBaton(int nbBatonEnlever) {
batons.EnleverBaton(nbBatonEnlever);
}
public int getNbBaton() {
return batons.getNbBaton();
}
public void setNbBaton(int nbBaton) {
batons.setNbBaton(nbBaton);
}
public boolean getBonBaton() {
return bonBaton;
}
public void setBonBaton(boolean bonBaton) {
this.bonBaton = bonBaton;
}
public void setRestart(int restart) {
this.restart = restart;
}
public int getRestart() {
return restart;
}
public void rejouer() {
System.out.println("\nVoulez-vous recommencer ? [1 pour oui/0 pour non]");
Scanner sc2 = new Scanner(System.in);
this.setRestart(sc2.nextInt());
if(getRestart() < 0 || getRestart() > 1) {
System.out.println("\n Vous vous etes tromper vous de pouvez pas entrer la valeur " + getRestart());
rejouer();
}
}
public void setGagnant(boolean i) {
gagnant = i;
}
private boolean getGagnant() {
return gagnant;
}
public void annonceGagnant() {
if(this.getGagnant() == false) {
System.out.println("Bravo! Vous avez gagner\n");
}else {
System.out.println("Désolé... Vous avez perdu\n");
}
}
public int DebutPartie() {
this.setRestart(1);
this.setNbBaton(21);
System.out.println("\n\n Il y a " + this.getNbBaton() + " que le meilleur gagne");
return batons.getNbBaton();
}
public int afficherBatonDeLIa(int batonIA) {
System.out.println("\n C'est au tour de l'IA il reste " + this.getNbBaton() + " \n\n L'IA a retiré " + batonIA);
return batonIA;
}
public void afficherBaton() {
System.out.println("\n L'IA a jouer et il reste " + this.getNbBaton() + "\n");
}
public int verifierJeu(int nb_baton_enlever) {
this.setBonBaton(true);
if(nb_baton_enlever < 1 || nb_baton_enlever > 3) {
System.out.println(" Vous vous etes trompé veuillez entrer un nombre entre 1 et 3.");
this.setBonBaton(false);
}
if(nb_baton_enlever > this.getNbBaton()) {
System.out.println(" Vous ne pouvez pas enlever plus de baton qu'il n'en reste.\n Il en reste : " + this.getNbBaton());
this.setBonBaton(false);
}
return nb_baton_enlever;
}
public void demanderBaton() {
System.out.println("\nEntrez un nombre entre 1 et 3: ");
}
public void setNbDeBatonAEnlever(int nbDeBatonAEnlever) {
player.setNbDeBatonAEnlever(nbDeBatonAEnlever);
}
public int getNbDeBatonAEnlever() {
return player.getNbDeBatonAEnlever();
}
public int demanderBatonJoueur() {
return player.demanderBatonJoueur();
}
public int demanderBatonIA() {
return IA.demanderBaton(batons.getNbBaton());
}
} | [
"hugo.chambefort@laposte.net"
] | hugo.chambefort@laposte.net |
4eb3832b7413072f12fa8d4569d01afbf2182764 | 527c2f6722c8f2cd6768ec2e82756c96f4568b71 | /DemoWeb/src/main/java/com/testautomation/framework/driverconfig/drivers/SafariBrowser.java | 7971434ec8e662bb84f20d79b566b71d5ea9fadc | [] | no_license | BharathVatrapu/WebFramework | 9485aa7197c1d2760193ebd09cca4fb39f12bc56 | b576d9f70870e254e7a8188ae825ecc3ad4ef200 | refs/heads/master | 2020-04-02T20:50:37.395304 | 2018-10-26T11:04:21 | 2018-10-26T11:04:21 | 154,780,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,795 | java | package com.testautomation.framework.driverconfig.drivers;
import com.testautomation.framework.base.DataConfig;
import com.testautomation.framework.driverconfig.BaseWebDriver;
import com.testautomation.framework.utils.Prop;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.safari.SafariOptions;
public class SafariBrowser extends BaseWebDriver<RemoteWebDriver, DesiredCapabilities, SafariBrowser> {
private DataConfig dataConfig=null;
public SafariBrowser(DataConfig dataConfig) {
this.dataConfig = dataConfig;
}
@Override
protected SafariBrowser setDriverPath() {
return null;
}
@Override
public DesiredCapabilities getDefaultOptions() {
DesiredCapabilities capabilities = new DesiredCapabilities();
SafariOptions safarioptions = new SafariOptions();
// options.setUseCleanSession(true);
capabilities = DesiredCapabilities.safari();
capabilities.setCapability(SafariOptions.CAPABILITY, safarioptions);
capabilities.setBrowserName(DesiredCapabilities.safari().getBrowserName());
capabilities.setPlatform(Platform.WINDOWS);
return capabilities;
}
protected DesiredCapabilities getOptions(DesiredCapabilities capabilities) {
return capabilities == null ? getDefaultOptions() : capabilities;
}
@Override
public RemoteWebDriver buildWebDriver(DesiredCapabilities options)
throws MalformedURLException {
dataConfig.safariDriver = setWebDriverManage(new RemoteWebDriver(new URL(Prop.getProperty("localGridHub")), getOptions(options)));
return dataConfig.safariDriver;
}
}
| [
"bharath.kumar@safeway.com"
] | bharath.kumar@safeway.com |
f437364c119a5dde82863eaaef69ed8bcb94103d | da5b7202e3016c7ae541c5b907ec08eda63df834 | /src/main/java/kakao/Runner.java | 1ca7b49e4003e29580f2993c023b0b9e44ad3d76 | [] | no_license | josungyeon/AlgorithmStudy | 3306829daea780367defdd9450ee104ceadc9445 | a3535a868490873d039839dc89506318cbf37c5f | refs/heads/master | 2021-07-13T05:15:12.711063 | 2019-08-22T04:24:25 | 2019-08-22T04:24:25 | 80,689,977 | 0 | 0 | null | 2021-04-26T16:46:53 | 2017-02-02T03:31:20 | Java | UTF-8 | Java | false | false | 667 | java | package kakao;
import java.util.*;
/**
* 해시 > 완주하지 못한 선수
* Created by sungyeon on 07/12/2018.
*/
public class Runner {
public String solution(String[] participant, String[] completion) {
String answer = "";
Map<String, Integer> hashMap = new HashMap<>();
for (String player: participant) hashMap.put(player, hashMap.getOrDefault(player, 0) + 1);
for (String player: completion) hashMap.put(player, hashMap.get(player) -1);
for (String keySet : hashMap.keySet()) {
if (hashMap.get(keySet) != 0) {
answer = keySet;
}
}
return answer;
}
}
| [
"Whtjd6475^"
] | Whtjd6475^ |
b28b9f1300903df4a5ae6039bb01ea3384eeff34 | e108d65747c07078ae7be6dcd6369ac359d098d7 | /org/apache/poi/ss/formula/OperationEvaluationContext.java | e7f968c30b7042ae200457e34db2eeddce5386b3 | [
"MIT"
] | permissive | kelu124/pyS3 | 50f30b51483bf8f9581427d2a424e239cfce5604 | 86eb139d971921418d6a62af79f2868f9c7704d5 | refs/heads/master | 2020-03-13T01:51:42.054846 | 2018-04-24T21:03:03 | 2018-04-24T21:03:03 | 130,913,008 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,744 | java | package org.apache.poi.ss.formula;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.ExternalNameEval;
import org.apache.poi.ss.formula.eval.FunctionNameEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.apache.poi.ss.formula.ptg.Area3DPtg;
import org.apache.poi.ss.formula.ptg.Area3DPxg;
import org.apache.poi.ss.formula.ptg.NameXPtg;
import org.apache.poi.ss.formula.ptg.NameXPxg;
import org.apache.poi.ss.formula.ptg.Ptg;
import org.apache.poi.ss.formula.ptg.Ref3DPtg;
import org.apache.poi.ss.formula.ptg.Ref3DPxg;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.ss.util.CellReference.NameType;
public final class OperationEvaluationContext {
public static final FreeRefFunction UDF = UserDefinedFunction.instance;
private final WorkbookEvaluator _bookEvaluator;
private final int _columnIndex;
private final int _rowIndex;
private final int _sheetIndex;
private final EvaluationTracker _tracker;
private final EvaluationWorkbook _workbook;
public OperationEvaluationContext(WorkbookEvaluator bookEvaluator, EvaluationWorkbook workbook, int sheetIndex, int srcRowNum, int srcColNum, EvaluationTracker tracker) {
this._bookEvaluator = bookEvaluator;
this._workbook = workbook;
this._sheetIndex = sheetIndex;
this._rowIndex = srcRowNum;
this._columnIndex = srcColNum;
this._tracker = tracker;
}
public EvaluationWorkbook getWorkbook() {
return this._workbook;
}
public int getRowIndex() {
return this._rowIndex;
}
public int getColumnIndex() {
return this._columnIndex;
}
SheetRangeEvaluator createExternSheetRefEvaluator(ExternSheetReferenceToken ptg) {
return createExternSheetRefEvaluator(ptg.getExternSheetIndex());
}
SheetRangeEvaluator createExternSheetRefEvaluator(String firstSheetName, String lastSheetName, int externalWorkbookNumber) {
return createExternSheetRefEvaluator(this._workbook.getExternalSheet(firstSheetName, lastSheetName, externalWorkbookNumber));
}
SheetRangeEvaluator createExternSheetRefEvaluator(int externSheetIndex) {
return createExternSheetRefEvaluator(this._workbook.getExternalSheet(externSheetIndex));
}
SheetRangeEvaluator createExternSheetRefEvaluator(EvaluationWorkbook$ExternalSheet externalSheet) {
WorkbookEvaluator targetEvaluator;
int otherFirstSheetIndex;
int otherLastSheetIndex = -1;
if (externalSheet == null || externalSheet.getWorkbookName() == null) {
targetEvaluator = this._bookEvaluator;
if (externalSheet == null) {
otherFirstSheetIndex = 0;
} else {
otherFirstSheetIndex = this._workbook.getSheetIndex(externalSheet.getSheetName());
}
if (externalSheet instanceof EvaluationWorkbook$ExternalSheetRange) {
otherLastSheetIndex = this._workbook.getSheetIndex(((EvaluationWorkbook$ExternalSheetRange) externalSheet).getLastSheetName());
}
} else {
String workbookName = externalSheet.getWorkbookName();
try {
targetEvaluator = this._bookEvaluator.getOtherWorkbookEvaluator(workbookName);
otherFirstSheetIndex = targetEvaluator.getSheetIndex(externalSheet.getSheetName());
if (externalSheet instanceof EvaluationWorkbook$ExternalSheetRange) {
otherLastSheetIndex = targetEvaluator.getSheetIndex(((EvaluationWorkbook$ExternalSheetRange) externalSheet).getLastSheetName());
}
if (otherFirstSheetIndex < 0) {
throw new RuntimeException("Invalid sheet name '" + externalSheet.getSheetName() + "' in bool '" + workbookName + "'.");
}
} catch (CollaboratingWorkbooksEnvironment$WorkbookNotFoundException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
if (otherLastSheetIndex == -1) {
otherLastSheetIndex = otherFirstSheetIndex;
}
SheetRefEvaluator[] evals = new SheetRefEvaluator[((otherLastSheetIndex - otherFirstSheetIndex) + 1)];
for (int i = 0; i < evals.length; i++) {
evals[i] = new SheetRefEvaluator(targetEvaluator, this._tracker, i + otherFirstSheetIndex);
}
return new SheetRangeEvaluator(otherFirstSheetIndex, otherLastSheetIndex, evals);
}
private SheetRefEvaluator createExternSheetRefEvaluator(String workbookName, String sheetName) {
WorkbookEvaluator targetEvaluator;
if (workbookName == null) {
targetEvaluator = this._bookEvaluator;
} else if (sheetName == null) {
throw new IllegalArgumentException("sheetName must not be null if workbookName is provided");
} else {
try {
targetEvaluator = this._bookEvaluator.getOtherWorkbookEvaluator(workbookName);
} catch (CollaboratingWorkbooksEnvironment$WorkbookNotFoundException e) {
return null;
}
}
int otherSheetIndex = sheetName == null ? this._sheetIndex : targetEvaluator.getSheetIndex(sheetName);
if (otherSheetIndex < 0) {
return null;
}
return new SheetRefEvaluator(targetEvaluator, this._tracker, otherSheetIndex);
}
public SheetRangeEvaluator getRefEvaluatorForCurrentSheet() {
return new SheetRangeEvaluator(this._sheetIndex, new SheetRefEvaluator(this._bookEvaluator, this._tracker, this._sheetIndex));
}
public ValueEval getDynamicReference(String workbookName, String sheetName, String refStrPart1, String refStrPart2, boolean isA1Style) {
if (isA1Style) {
SheetRefEvaluator se = createExternSheetRefEvaluator(workbookName, sheetName);
if (se == null) {
return ErrorEval.REF_INVALID;
}
SheetRangeEvaluator sre = new SheetRangeEvaluator(this._sheetIndex, se);
SpreadsheetVersion ssVersion = ((FormulaParsingWorkbook) this._workbook).getSpreadsheetVersion();
NameType part1refType = classifyCellReference(refStrPart1, ssVersion);
switch (part1refType) {
case BAD_CELL_OR_NAMED_RANGE:
return ErrorEval.REF_INVALID;
case NAMED_RANGE:
EvaluationName nm = ((FormulaParsingWorkbook) this._workbook).getName(refStrPart1, this._sheetIndex);
if (nm.isRange()) {
return this._bookEvaluator.evaluateNameFormula(nm.getNameDefinition(), this);
}
throw new RuntimeException("Specified name '" + refStrPart1 + "' is not a range as expected.");
default:
CellReference cr;
if (refStrPart2 == null) {
switch (part1refType) {
case COLUMN:
case ROW:
return ErrorEval.REF_INVALID;
case CELL:
cr = new CellReference(refStrPart1);
return new LazyRefEval(cr.getRow(), cr.getCol(), sre);
default:
throw new IllegalStateException("Unexpected reference classification of '" + refStrPart1 + "'.");
}
}
NameType part2refType = classifyCellReference(refStrPart1, ssVersion);
switch (part2refType) {
case BAD_CELL_OR_NAMED_RANGE:
return ErrorEval.REF_INVALID;
case NAMED_RANGE:
throw new RuntimeException("Cannot evaluate '" + refStrPart1 + "'. Indirect evaluation of defined names not supported yet");
default:
if (part2refType != part1refType) {
return ErrorEval.REF_INVALID;
}
int firstRow;
int lastRow;
int firstCol;
int lastCol;
switch (part1refType) {
case COLUMN:
firstRow = 0;
if (!part2refType.equals(NameType.COLUMN)) {
lastRow = ssVersion.getLastRowIndex();
firstCol = parseColRef(refStrPart1);
lastCol = parseColRef(refStrPart2);
break;
}
lastRow = ssVersion.getLastRowIndex();
firstCol = parseRowRef(refStrPart1);
lastCol = parseRowRef(refStrPart2);
break;
case ROW:
firstCol = 0;
if (!part2refType.equals(NameType.ROW)) {
lastCol = ssVersion.getLastColumnIndex();
firstRow = parseRowRef(refStrPart1);
lastRow = parseRowRef(refStrPart2);
break;
}
firstRow = parseColRef(refStrPart1);
lastRow = parseColRef(refStrPart2);
lastCol = ssVersion.getLastColumnIndex();
break;
case CELL:
cr = new CellReference(refStrPart1);
firstRow = cr.getRow();
firstCol = cr.getCol();
cr = new CellReference(refStrPart2);
lastRow = cr.getRow();
lastCol = cr.getCol();
break;
default:
throw new IllegalStateException("Unexpected reference classification of '" + refStrPart1 + "'.");
}
return new LazyAreaEval(firstRow, firstCol, lastRow, lastCol, sre);
}
}
}
throw new RuntimeException("R1C1 style not supported yet");
}
private static int parseRowRef(String refStrPart) {
return CellReference.convertColStringToIndex(refStrPart);
}
private static int parseColRef(String refStrPart) {
return Integer.parseInt(refStrPart) - 1;
}
private static NameType classifyCellReference(String str, SpreadsheetVersion ssVersion) {
if (str.length() < 1) {
return NameType.BAD_CELL_OR_NAMED_RANGE;
}
return CellReference.classifyCellReference(str, ssVersion);
}
public FreeRefFunction findUserDefinedFunction(String functionName) {
return this._bookEvaluator.findUserDefinedFunction(functionName);
}
public ValueEval getRefEval(int rowIndex, int columnIndex) {
return new LazyRefEval(rowIndex, columnIndex, getRefEvaluatorForCurrentSheet());
}
public ValueEval getRef3DEval(Ref3DPtg rptg) {
return new LazyRefEval(rptg.getRow(), rptg.getColumn(), createExternSheetRefEvaluator(rptg.getExternSheetIndex()));
}
public ValueEval getRef3DEval(Ref3DPxg rptg) {
return new LazyRefEval(rptg.getRow(), rptg.getColumn(), createExternSheetRefEvaluator(rptg.getSheetName(), rptg.getLastSheetName(), rptg.getExternalWorkbookNumber()));
}
public ValueEval getAreaEval(int firstRowIndex, int firstColumnIndex, int lastRowIndex, int lastColumnIndex) {
return new LazyAreaEval(firstRowIndex, firstColumnIndex, lastRowIndex, lastColumnIndex, getRefEvaluatorForCurrentSheet());
}
public ValueEval getArea3DEval(Area3DPtg aptg) {
return new LazyAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn(), createExternSheetRefEvaluator(aptg.getExternSheetIndex()));
}
public ValueEval getArea3DEval(Area3DPxg aptg) {
return new LazyAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn(), createExternSheetRefEvaluator(aptg.getSheetName(), aptg.getLastSheetName(), aptg.getExternalWorkbookNumber()));
}
public ValueEval getNameXEval(NameXPtg nameXPtg) {
EvaluationWorkbook$ExternalSheet externSheet = this._workbook.getExternalSheet(nameXPtg.getSheetRefIndex());
if (externSheet == null || externSheet.getWorkbookName() == null) {
return getLocalNameXEval(nameXPtg);
}
return getExternalNameXEval(this._workbook.getExternalName(nameXPtg.getSheetRefIndex(), nameXPtg.getNameIndex()), externSheet.getWorkbookName());
}
public ValueEval getNameXEval(NameXPxg nameXPxg) {
EvaluationWorkbook$ExternalSheet externSheet = this._workbook.getExternalSheet(nameXPxg.getSheetName(), null, nameXPxg.getExternalWorkbookNumber());
if (externSheet == null || externSheet.getWorkbookName() == null) {
return getLocalNameXEval(nameXPxg);
}
return getExternalNameXEval(this._workbook.getExternalName(nameXPxg.getNameName(), nameXPxg.getSheetName(), nameXPxg.getExternalWorkbookNumber()), externSheet.getWorkbookName());
}
private ValueEval getLocalNameXEval(NameXPxg nameXPxg) {
int sIdx = -1;
if (nameXPxg.getSheetName() != null) {
sIdx = this._workbook.getSheetIndex(nameXPxg.getSheetName());
}
String name = nameXPxg.getNameName();
EvaluationName evalName = this._workbook.getName(name, sIdx);
if (evalName != null) {
return new ExternalNameEval(evalName);
}
return new FunctionNameEval(name);
}
private ValueEval getLocalNameXEval(NameXPtg nameXPtg) {
EvaluationName evalName;
String name = this._workbook.resolveNameXText(nameXPtg);
int sheetNameAt = name.indexOf(33);
if (sheetNameAt > -1) {
String sheetName = name.substring(0, sheetNameAt);
evalName = this._workbook.getName(name.substring(sheetNameAt + 1), this._workbook.getSheetIndex(sheetName));
} else {
evalName = this._workbook.getName(name, -1);
}
if (evalName != null) {
return new ExternalNameEval(evalName);
}
return new FunctionNameEval(name);
}
public int getSheetIndex() {
return this._sheetIndex;
}
private ValueEval getExternalNameXEval(EvaluationWorkbook$ExternalName externName, String workbookName) {
try {
WorkbookEvaluator refWorkbookEvaluator = this._bookEvaluator.getOtherWorkbookEvaluator(workbookName);
EvaluationName evaluationName = refWorkbookEvaluator.getName(externName.getName(), externName.getIx() - 1);
if (evaluationName != null && evaluationName.hasFormula()) {
if (evaluationName.getNameDefinition().length > 1) {
throw new RuntimeException("Complex name formulas not supported yet");
}
OperationEvaluationContext refWorkbookContext = new OperationEvaluationContext(refWorkbookEvaluator, refWorkbookEvaluator.getWorkbook(), -1, -1, -1, this._tracker);
Ptg ptg = evaluationName.getNameDefinition()[0];
if (ptg instanceof Ref3DPtg) {
return refWorkbookContext.getRef3DEval((Ref3DPtg) ptg);
}
if (ptg instanceof Ref3DPxg) {
return refWorkbookContext.getRef3DEval((Ref3DPxg) ptg);
}
if (ptg instanceof Area3DPtg) {
return refWorkbookContext.getArea3DEval((Area3DPtg) ptg);
}
if (ptg instanceof Area3DPxg) {
return refWorkbookContext.getArea3DEval((Area3DPxg) ptg);
}
}
return ErrorEval.REF_INVALID;
} catch (CollaboratingWorkbooksEnvironment$WorkbookNotFoundException e) {
return ErrorEval.REF_INVALID;
}
}
}
| [
"kelu124@gmail.com"
] | kelu124@gmail.com |
4dc4e96729882061ffc1aacd1fd94011a85a09d6 | 0458c6412c4c1b6c45559f3736c587a3057016b4 | /app/src/main/java/com/simbirsoft/igorverbkin/mycards/ui/adapter/RecyclerViewClickListener.java | 8b4812818e7e97dc001c2d6b0de7e98ec20b6fe6 | [] | no_license | Quintessencion/cards | 8183e04531980ddd62acee85e6a3f558b3e847d0 | a654025a6e8e91e1b8f419fd92fffa33ef89e191 | refs/heads/master | 2021-05-02T18:30:53.132836 | 2018-02-07T20:08:18 | 2018-02-07T20:08:18 | 120,665,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package com.simbirsoft.igorverbkin.mycards.ui.adapter;
public interface RecyclerViewClickListener {
void enableButton(String id, String price, int position);
void disableButton();
int getNumbSelectedItem();
void setNumbSelectedItem(int value);
}
| [
"igor.verbkin@simbirsoft.com"
] | igor.verbkin@simbirsoft.com |
c2339462645f8c087716ba9d7d253cae3430969c | 1f72651e1fffebb244654e4a134a312c8a633850 | /Baselibrary/src/main/java/com/library/weight/TipView.java | a0b39d00e4163a2ddb690f101616c8ecfb793527 | [] | no_license | 13616632061/ksApp | 337fc9ab5a29c1afaf20ab545217f6266a692bce | 729a42a142e4fe009c548c87139650e4c9606f36 | refs/heads/master | 2023-01-16T07:13:58.962960 | 2020-11-30T10:58:20 | 2020-11-30T10:58:20 | 284,247,538 | 1 | 2 | null | 2020-10-14T00:06:22 | 2020-08-01T11:33:45 | Java | UTF-8 | Java | false | false | 4,534 | java | package com.library.weight;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.blankj.utilcode.util.ConvertUtils;
import com.library.R;
/**
* Created by Administrator on 2019/5/6.
* 顶部提示的View
*/
public class TipView extends LinearLayout {
private Context mContext;
private int mBackGroundColor;
private int mTextColor;
private String mText;
private int mTextSize;
private TextView mTvTip;
//显示所停留的时间
private int mStayTime = 2000;
private boolean isShowing;
private Handler mHandler = new Handler();
public TipView(Context context) {
this(context,null);
}
public TipView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs,0);
}
public TipView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TipView);
mBackGroundColor = ta.getColor(R.styleable.TipView_tipBackgroundColor, Color.parseColor("#ffffff"));
mTextColor = ta.getColor(R.styleable.TipView_tipTextColor, Color.parseColor("#666666"));
mText = ta.getString(R.styleable.TipView_tipText);
mTextSize = ta.getDimensionPixelSize(R.styleable.TipView_tipTextSize, ConvertUtils.sp2px(12));
ta.recycle();
init();
}
private void init() {
setGravity(Gravity.CENTER);
setBackgroundColor(mBackGroundColor);//设置背景色
mTvTip = new TextView(mContext);
mTvTip.setGravity(Gravity.CENTER);
mTvTip.getPaint().setTextSize(mTextSize);
mTvTip.setTextColor(mTextColor);
mTvTip.setText(mText);
addView(mTvTip);
}
public void show(String content){
if (TextUtils.isEmpty(content)){
show();
return;
}
mTvTip.setText(content);//设置内容
show();
}
public void show(){
if (isShowing){
return;
}
isShowing = true;
setVisibility(VISIBLE);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator scaleX = ObjectAnimator.ofFloat(mTvTip, "scaleX", 0, 1f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(mTvTip, "scaleY", 0, 1f);
animatorSet.setDuration(500);
animatorSet.play(scaleX).with(scaleY);
animatorSet.start();
animatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
hide();
}
},mStayTime);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
}
/**隐藏,收起*/
private void hide() {
TranslateAnimation hideAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF
,0.0f,Animation.RELATIVE_TO_SELF,-1.0f);
hideAnim.setDuration(300);
startAnimation(hideAnim);
hideAnim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
setVisibility(GONE);
isShowing = false;
mTvTip.setText(mText); //重新设置回原来的内容
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
}
| [
"13530531749@163.com"
] | 13530531749@163.com |
4fbbf9f9111b6feeb3ad2c86f0509d05568af1f7 | 00e0ad2c31263b1ad468d7891171c81a6554d690 | /MyProjects/Individual_work/MyJavaExercises/src/main/java/Fundamentals1Scanners/AllTheTrivia.java | fdd6dd3bfaec0449da824b005c0bbc2c4dc3ef9c | [] | no_license | bolohori/software-guild-projects | 9e4774bb0487bdf3345feaaafa03c849a0e91325 | 7ed4e5cb58c586874d0a534dd26493e4f6ff462a | refs/heads/master | 2023-03-18T07:06:55.151946 | 2017-01-09T22:58:56 | 2017-01-09T22:58:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | 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 Fundamentals1Scanners;
import java.util.Scanner;
/**
*
* @author apprentice
*/
public class AllTheTrivia {
public static void main(String[] args) {
Scanner inputReader = new Scanner (System.in);
System.out.println("What is the closest planet to the sun?");
String planet = inputReader.next();
System.out.println("Interesting, who sings 'Bohemian Rhapsody'?");
String musician = inputReader.next();
System.out.println("What city are we in right now?");
String city = inputReader.next();
System.out.println("What country borders us to the north?");
String country = inputReader.next();
System.out.println(city + ", must get very hot!");
System.out.println(planet + " has an incredible vocal range!");
System.out.println("I hope " + country + " is treating you well!");
System.out.println("I wonder how cold " + musician + " gets?");
}
}
| [
"floydchris@hotmail.com"
] | floydchris@hotmail.com |
6ad249084ccb55b0266c4eccb2744814bb907178 | 64bf35ecc3cd05f8571895299775de59b5c31b24 | /src/main/java/pt/tecnico/myDrive/exception/CannotModifyLinkContentException.java | 3661cbb4705986b005b7ddc9f4b8862dc61da4d7 | [] | no_license | mglsilva578/esproject | 1d8a1f0cc2757644f5304351c12fc9bfc649c452 | 67795232867ec644866aaaed04c850047a47f634 | refs/heads/master | 2020-06-27T03:41:08.154526 | 2017-07-13T14:13:18 | 2017-07-13T14:13:18 | 97,043,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package pt.tecnico.myDrive.exception;
public class CannotModifyLinkContentException extends MyDriveException {
private static final long serialVersionUID = 1L;
public CannotModifyLinkContentException(){
super();
}
public CannotModifyLinkContentException(String linkName){
super("Permission denied - cannot alter the contents of link with name <"+ linkName +">");
}
}
| [
"jose.luis.vf.tagus@gmail.com"
] | jose.luis.vf.tagus@gmail.com |
02c4ad4b708574d03fb7f42d92a9c49b9670c812 | c6eb0c55edc5fb86e1be0f9a4e5c5e0d4fa9d9c0 | /src/com/concurrency/Semaphore/ProducerConsumer.java | 6be7c8d5456034812fa3b4691e277cdbfa615a55 | [] | no_license | Monk428/JavaSE | 3b5d39d85dc9defbd59bb7f57f04799fa28f0502 | 81a13cb9b467c24804cdadef380401d4094c4fb7 | refs/heads/master | 2021-04-27T02:04:22.235147 | 2018-03-20T14:49:37 | 2018-03-20T14:49:37 | 122,689,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,105 | java | package com.concurrency.Semaphore;
// 生产消费者
public class ProducerConsumer {
public static void main(String[] args) {
SyncStack ss = new SyncStack();
Producer p = new Producer(ss);
Consumer c = new Consumer(ss);
new Thread(p).start();
new Thread(c).start();
}
}
class WoTou {
int id;
WoTou(int id) {
this.id = id;
}
public String toString() {
return "WoTou: " + id;
}
}
class SyncStack {
int index = 0;
WoTou[] arrWT = new WoTou[6];
public synchronized void push(WoTou wt) {
while (index == arrWT.length) {
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
this.notify();
arrWT[index] = wt;
index++;
}
public synchronized WoTou pop() {
while (index == 0) {
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
this.notify();
index--;
return arrWT[index];
}
}
class Producer implements Runnable {
SyncStack ss = null;
Producer(SyncStack ss) {
this.ss = ss;
}
public void run() {
for (int i = 0; i < 20; i ++ ) {
WoTou wt = new WoTou(i);
ss.push(wt);
System.out.println("生产了: "+ wt);
try {
Thread.sleep((int)Math.random() * 2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
class Consumer implements Runnable {
SyncStack ss = null;
Consumer(SyncStack ss) {
this.ss = ss;
}
public void run() {
for (int i = 0; i < 20; i ++ ) {
WoTou wt = ss.pop();
System.out.println("消费了: " + wt);
try {
Thread.sleep((int)Math.random() * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| [
"464493571@qq.com"
] | 464493571@qq.com |
b3af16546450e48fa10d9cc383dadd9b4def45c8 | 809b0e78d1665230a2c3df179501fd6d4f3e089a | /datastructure-amazonQuestions/Generic/src/com/generic/producerconsumer/NotifyNotifyAllDemo.java | 77db1c91059de649dc6a1eb951f43ca3a76170a1 | [] | no_license | vinay25788/datastructure-amazonQuestions | c4b67cbd783c9990e7335c1dce1225b4bce988a5 | 7de42100f3b70492984b98aebc9fd44dfa17a415 | refs/heads/master | 2020-05-20T04:25:02.347694 | 2020-01-19T08:23:13 | 2020-01-19T08:23:13 | 185,382,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,244 | java | package com.generic.producerconsumer;
class MyRunnable1 extends Thread{
public void run(){
synchronized (this) {
System.out.println(Thread.currentThread().getName()+" started");
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+" has been notified");
}
}
}
class MyRunnable2 extends Thread{
MyRunnable1 myRunnable1;
MyRunnable2(MyRunnable1 MyRunnable1){
this.myRunnable1=MyRunnable1;
}
public void run(){
synchronized (this.myRunnable1) {
System.out.println(Thread.currentThread().getName()+ " started");
try {
this.myRunnable1.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+" has been notified");
}
}
}
class MyRunnable3 extends Thread{
MyRunnable1 myRunnable1;
MyRunnable3(MyRunnable1 MyRunnable1){
this.myRunnable1=MyRunnable1;
}
public void run(){
synchronized (this.myRunnable1) {
System.out.println(Thread.currentThread().getName()+ " started");
// this.myRunnable1.notify(); // Wakes up a single thread that is
//waiting on this object's monitor.
//If any threads are waiting on this object,
//one of them is chosen to be awakened.
//The choice is random and occurs at the
//discretion of the implementation.
this.myRunnable1.notifyAll(); // Will wake up all threads
//waiting on object's monitor.
System.out.println(Thread.currentThread().getName()+
" has notified waiting threads");
}
}
}
/** Copyright (c), AnkitMittal JavaMadeSoEasy.com */
public class NotifyNotifyAllDemo {
public static void main(String[] args) throws InterruptedException {
MyRunnable1 myRunnable1=new MyRunnable1();
MyRunnable2 myRunnable2=new MyRunnable2(myRunnable1);
MyRunnable3 myRunnable3=new MyRunnable3(myRunnable1);
Thread t1=new Thread(myRunnable1,"Thread-1");
Thread t2=new Thread(myRunnable2,"Thread-2");
Thread t3=new Thread(myRunnable3,"Thread-3");
t1.start();
t2.start();
Thread.sleep(100); //Used to ensure that thread1 and thread2 starts before thread-3
//because thread-1 and 2 calls wait(), while thread-3 calls notify or notifyAll()
t3.start();
}
} | [
"vinay25788@gmail.com"
] | vinay25788@gmail.com |
0a79a6449dec3b4b0b8016e0e7a65c3259429ef8 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/neo4j/2017/12/LockWaitEvent.java | 45a95e8cf6991ab9d8a2c73b2e6f97ef61b359d4 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 970 | java | /*
* Copyright (c) 2002-2017 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.locking;
public interface LockWaitEvent extends AutoCloseable
{
@Override
void close();
LockWaitEvent NONE = () ->
{
};
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
5f5ce2928489c31e74451741c68d0dc86dcb0636 | 38b1fffac77669bb2b0dbea58c95d53b7d3f3240 | /src/model/User.java | 4082bad056e8d516fc422d809ced80904e0bf002 | [] | no_license | ajromerop/learning-Java | 2f2609caa5ff491255faa9136e94abd681735fba | 8fef23b2ddb01c1d680c0d4b162eda9f8544a2ac | refs/heads/master | 2023-06-19T05:33:59.604469 | 2021-07-21T20:33:22 | 2021-07-21T20:33:22 | 381,200,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | //package model;
public class User {
private int estado;
private String nombre;
public int getEstado() {
return estado;
}
public String getNombre() {
return nombre;
}
public void setEstado(int estado) {
this.estado = estado;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
} | [
"ajromerop@unal.edu.co"
] | ajromerop@unal.edu.co |
e1f49efcc62ef6645acc3aa6e96b404081714274 | db6f04f26946329f679a53997281fdc5504bb630 | /mesh-worker-service/src/main/java/io/functionmesh/compute/util/KubernetesUtils.java | bed68e4237e1e0820ddcac5f9506d6c63dc4799c | [
"Apache-2.0"
] | permissive | darwin-systems/function-mesh | d018dee478a166f4f319be9023de04d28937a853 | 33d2d25bca36417a78767e5e43dc97f24dcfacfd | refs/heads/master | 2023-04-27T05:49:28.778013 | 2021-05-14T07:28:47 | 2021-05-14T07:28:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,321 | 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 io.functionmesh.compute.util;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.V1ConfigMap;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.pulsar.functions.runtime.kubernetes.KubernetesRuntimeFactoryConfig;
import org.apache.pulsar.functions.utils.Actions;
import org.apache.pulsar.functions.worker.WorkerConfig;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import static java.net.HttpURLConnection.HTTP_CONFLICT;
@Slf4j
public class KubernetesUtils {
private static final String KUBERNETES_NAMESPACE_PATH = "/var/run/secrets/kubernetes.io/serviceaccount/namespace";
private static final int NUM_RETRIES = 5;
private static final long SLEEP_BETWEEN_RETRIES_MS = 500;
private static final String CLIENT_AUTHENTICATION_PLUGIN_CLAIM = "clientAuthenticationPlugin";
private static final String CLIENT_AUTHENTICATION_PLUGIN_NAME = "org.apache.pulsar.client.impl.auth.AuthenticationToken";
private static final String CLIENT_AUTHENTICATION_PARAMETERS_CLAIM = "clientAuthenticationParameters";
private static final String TLS_TRUST_CERTS_FILE_PATH_CLAIM = "tlsTrustCertsFilePath";
private static final String USE_TLS_CLAIM = "useTls";
private static final String TLS_ALLOW_INSECURE_CONNECTION_CLAIM = "tlsAllowInsecureConnection";
private static final String TLS_HOSTNAME_VERIFICATION_ENABLE_CLAIM = "tlsHostnameVerificationEnable";
public static String getNamespace() {
String namespace = null;
try {
File file = new File(KUBERNETES_NAMESPACE_PATH);
namespace = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
} catch (java.io.IOException e) {
log.error("Get namespace from kubernetes path {}, message: {}", KUBERNETES_NAMESPACE_PATH, e.getMessage());
}
// Use the default namespace
if (namespace == null) {
return "default";
}
return namespace;
}
public static String getNamespace(KubernetesRuntimeFactoryConfig kubernetesRuntimeFactoryConfig) {
if (kubernetesRuntimeFactoryConfig == null) {
return KubernetesUtils.getNamespace();
}
String namespace = kubernetesRuntimeFactoryConfig.getJobNamespace();
if (namespace == null) {
return KubernetesUtils.getNamespace();
}
return namespace;
}
public static String getConfigMapName(String type, String tenant, String namespace, String name) {
return "function-mesh-configmap-" + type + "-" + tenant + "-" + namespace + "-" + name ;
}
private static Map<String, String> buildConfigMap(WorkerConfig workerConfig) {
Map<String, String> valueMap = new HashMap<>();
valueMap.put(CLIENT_AUTHENTICATION_PLUGIN_CLAIM, workerConfig.getBrokerClientAuthenticationPlugin());
valueMap.put(CLIENT_AUTHENTICATION_PARAMETERS_CLAIM, workerConfig.getBrokerClientAuthenticationParameters());
valueMap.put(TLS_TRUST_CERTS_FILE_PATH_CLAIM, workerConfig.getTlsCertificateFilePath());
valueMap.put(USE_TLS_CLAIM, String.valueOf(workerConfig.getTlsEnabled()));
valueMap.put(TLS_ALLOW_INSECURE_CONNECTION_CLAIM, String.valueOf(workerConfig.isTlsAllowInsecureConnection()));
valueMap.put(TLS_HOSTNAME_VERIFICATION_ENABLE_CLAIM, String.valueOf(workerConfig.isTlsEnableHostnameVerification()));
return valueMap;
}
public static String createConfigMap(
String type,
String tenant,
String namespace,
String name,
WorkerConfig workerConfig,
CoreV1Api coreV1Api,
KubernetesRuntimeFactoryConfig factoryConfig) throws ApiException, InterruptedException {
String configMapName = getConfigMapName(type, tenant, namespace, name);
StringBuilder sb = new StringBuilder();
Actions.Action createAuthConfigMap = Actions.Action.builder()
.actionName(String.format("Creating authentication config map for function %s/%s/%s", tenant, namespace, name))
.numRetries(NUM_RETRIES)
.sleepBetweenInvocationsMs(SLEEP_BETWEEN_RETRIES_MS)
.supplier(() -> {
String id = RandomStringUtils.random(5, true, true).toLowerCase();
V1ConfigMap v1ConfigMap = new V1ConfigMap()
.metadata(new V1ObjectMeta().name(configMapName))
.data(buildConfigMap(workerConfig));
try {
coreV1Api.createNamespacedConfigMap(KubernetesUtils.getNamespace(factoryConfig), v1ConfigMap, null, null, null);
} catch (ApiException e) {
// already exists
if (e.getCode() == HTTP_CONFLICT) {
return Actions.ActionResult.builder()
.errorMsg(String.format("ConfigMap %s already present", id))
.success(false)
.build();
}
String errorMsg = e.getResponseBody() != null ? e.getResponseBody() : e.getMessage();
return Actions.ActionResult.builder()
.success(false)
.errorMsg(errorMsg)
.build();
}
sb.append(id.toCharArray());
return Actions.ActionResult.builder().success(true).build();
})
.build();
AtomicBoolean success = new AtomicBoolean(false);
Actions.newBuilder()
.addAction(createAuthConfigMap.toBuilder()
.onSuccess(ignore -> success.set(true))
.build())
.run();
if (!success.get()) {
throw new RuntimeException(String.format("Failed to create authentication configmap for function %s/%s/%s", tenant, namespace, name));
}
return sb.toString();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f7fae341e3c110da6c0788cdf015975963d6742c | 0e06e096a9f95ab094b8078ea2cd310759af008b | /classes56-dex2jar/com/unity/purchasing/common/StoreDeserializer.java | 945eecfa9dc297ce2fa245d7bb01b12136a3530a | [] | no_license | Manifold0/adcom_decompile | 4bc2907a057c73703cf141dc0749ed4c014ebe55 | fce3d59b59480abe91f90ba05b0df4eaadd849f7 | refs/heads/master | 2020-05-21T02:01:59.787840 | 2019-05-10T00:36:27 | 2019-05-10T00:36:27 | 185,856,424 | 1 | 2 | null | 2019-05-10T00:36:28 | 2019-05-09T19:04:28 | Java | UTF-8 | Java | false | false | 1,969 | java | //
// Decompiled by Procyon v0.5.34
//
package com.unity.purchasing.common;
import org.json.JSONObject;
import org.json.JSONException;
import java.util.ArrayList;
import org.json.JSONArray;
import java.util.List;
public abstract class StoreDeserializer implements INativeStore, IStore
{
public static List<ProductDefinition> DeserializeProducts(final String s) {
ArrayList<ProductDefinition> list;
try {
final JSONArray jsonArray = new JSONArray(s);
list = new ArrayList<ProductDefinition>();
for (int i = 0; i < jsonArray.length(); ++i) {
list.add(GetProductDefinition(jsonArray.getJSONObject(i)));
}
}
catch (JSONException ex) {
throw new RuntimeException((Throwable)ex);
}
return list;
}
public static ProductDefinition GetProductDefinition(final String s) {
if (s == null) {
return null;
}
try {
return GetProductDefinition(new JSONObject(s));
}
catch (JSONException ex) {
throw new RuntimeException((Throwable)ex);
}
}
private static ProductDefinition GetProductDefinition(final JSONObject jsonObject) {
try {
return new ProductDefinition(jsonObject.getString("id"), jsonObject.getString("storeSpecificId"), ProductType.valueOf(jsonObject.getString("type")));
}
catch (JSONException ex) {
throw new RuntimeException((Throwable)ex);
}
}
@Override
public void FinishTransaction(final String s, final String s2) {
this.FinishTransaction(GetProductDefinition(s), s2);
}
@Override
public void Purchase(final String s, final String s2) {
this.Purchase(GetProductDefinition(s), s2);
}
@Override
public void RetrieveProducts(final String s) {
this.RetrieveProducts(DeserializeProducts(s));
}
}
| [
"querky1231@gmail.com"
] | querky1231@gmail.com |
f359ea642260edc7c0d8efe7aafa3154d7462f92 | 8681a1bb93032a8f2c4e716e7e1fc7c991a9bc5b | /app/src/main/java/com/example/rm/androidbaseexemplo/components/TextViewDrawableSize.java | cf42a141b6ba6e9b1a3f0f6d6d66d94c8b887ca7 | [] | no_license | roger8b/AndroidBaseExemplo | fe449235d5c81c5f646f770ac81dd736e43a4b4f | 7af71d1ae40e2863bc5d5d574f48d5da5ba968f0 | refs/heads/master | 2020-03-22T23:05:35.801387 | 2018-08-28T03:33:30 | 2018-08-28T03:33:30 | 140,789,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,312 | java | package com.example.rm.androidbaseexemplo.components;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.TextView;
import com.example.rm.androidbaseexemplo.R;
public class TextViewDrawableSize extends android.support.v7.widget.AppCompatTextView {
private static final int DEFAULT_COMPOUND_DRAWABLE_SIZE = -1;
private int compoundDrawableWidth;
private int compoundDrawableHeight;
public TextViewDrawableSize(Context context) {
this(context, null);
}
public TextViewDrawableSize(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TextViewDrawableSize(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
final TypedArray typedArray =
context.obtainStyledAttributes(attrs, R.styleable.TextViewDrawableSize);
compoundDrawableWidth =
typedArray.getDimensionPixelSize(R.styleable.TextViewDrawableSize_compoundDrawableWidth,
DEFAULT_COMPOUND_DRAWABLE_SIZE);
compoundDrawableHeight =
typedArray.getDimensionPixelSize(R.styleable.TextViewDrawableSize_compoundDrawableHeight,
DEFAULT_COMPOUND_DRAWABLE_SIZE);
typedArray.recycle();
resizeCompoundDrawables();
}
private void resizeCompoundDrawables() {
Drawable[] drawables = getCompoundDrawables();
if (compoundDrawableWidth > 0 || compoundDrawableHeight > 0) {
for (Drawable drawable : drawables) {
if (drawable == null) {
continue;
}
Rect realBounds = drawable.getBounds();
float scaleFactor = realBounds.height() / (float) realBounds.width();
float drawableWidth = realBounds.width();
float drawableHeight = realBounds.height();
if (this.compoundDrawableWidth > 0) {
if (drawableWidth > this.compoundDrawableWidth) {
drawableWidth = this.compoundDrawableWidth;
drawableHeight = drawableWidth * scaleFactor;
}
}
if (this.compoundDrawableHeight > 0) {
if (drawableHeight > this.compoundDrawableHeight) {
drawableHeight = this.compoundDrawableHeight;
drawableWidth = drawableHeight / scaleFactor;
}
}
realBounds.right = realBounds.left + Math.round(drawableWidth);
realBounds.bottom = realBounds.top + Math.round(drawableHeight);
drawable.setBounds(realBounds);
}
}
super.setCompoundDrawables(drawables[0], drawables[1], drawables[2], drawables[3]);
}
public int getCompoundDrawableWidth() {
return compoundDrawableWidth;
}
public void setCompoundDrawableWidth(int compoundDrawableWidth) {
this.compoundDrawableWidth = compoundDrawableWidth;
}
public int getCompoundDrawableHeight() {
return compoundDrawableHeight;
}
public void setCompoundDrawableHeight(int compoundDrawableHeight) {
this.compoundDrawableHeight = compoundDrawableHeight;
}
@Override
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
super.setCompoundDrawables(left, top, right, bottom);
resizeCompoundDrawables();
}
@Override
public void setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom) {
super.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
resizeCompoundDrawables();
}
@Override
public void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right,
Drawable bottom) {
super.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);
resizeCompoundDrawables();
}
@Override public void setCompoundDrawablesRelative(Drawable start, Drawable top, Drawable end,
Drawable bottom) {
super.setCompoundDrawablesRelative(start, top, end, bottom);
resizeCompoundDrawables();
}
@Override public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end,
int bottom) {
super.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom);
resizeCompoundDrawables();
}
@Override
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start, Drawable top,
Drawable end, Drawable bottom) {
super.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom);
resizeCompoundDrawables();
}
}
| [
"roger.8b@gmail.com"
] | roger.8b@gmail.com |
d96f0348839b2a0b2a5ff08269de05bf73b9b219 | 76600a8112c9bc05af7e98fff943f96dbf6443bd | /sandbox/antdsl/trunk/org.apache.ant.antdsl.ui/src/org/apache/ant/antdsl/xtext/ui/labeling/AntDSLDescriptionLabelProvider.java | 18760f78bc9a0c85da301ac68cf0468ba1e364f1 | [] | no_license | BeatrizTercero/repoSvnAnt | 222a360bc83cdcde6fb6ab60c2a5962320a4b607 | 326ec26c2e5d7bbaedfd4d33a85c7a87773864be | refs/heads/master | 2021-01-11T10:06:10.493081 | 2016-12-17T19:36:24 | 2016-12-17T19:36:24 | 77,481,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,452 | 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.
*
*/
/*
* generated by Xtext
*/
package org.apache.ant.antdsl.xtext.ui.labeling;
import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
/**
* Provides labels for a IEObjectDescriptions and IResourceDescriptions.
*
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class AntDSLDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
/*
//Labels and icons can be computed like this:
String text(IEObjectDescription ele) {
return "my "+ele.getName();
}
String image(IEObjectDescription ele) {
return ele.getEClass().getName() + ".gif";
}
*/
}
| [
"hibou@13f79535-47bb-0310-9956-ffa450edef68"
] | hibou@13f79535-47bb-0310-9956-ffa450edef68 |
52bfcb6db50536680c028edc3743ca987610482f | 4627d514d6664526f58fbe3cac830a54679749cd | /results/evosuite5/lang-org.apache.commons.lang3.math.NumberUtils-3/org/apache/commons/lang3/math/NumberUtils_ESTest.java | c6cbc1e0b75f92dbd957f75a7001c15ea5597aa7 | [] | no_license | STAMP-project/Cling-application | c624175a4aa24bb9b29b53f9b84c42a0f18631bd | 0ff4d7652b434cbfd9be8d8bb38cfc8d8eaa51b5 | refs/heads/master | 2022-07-27T09:30:16.423362 | 2022-07-19T12:01:46 | 2022-07-19T12:01:46 | 254,310,667 | 2 | 2 | null | 2021-07-12T12:29:50 | 2020-04-09T08:11:35 | null | UTF-8 | Java | false | false | 35,307 | java | /*
* This file was automatically generated by EvoSuite
* Tue Aug 20 21:28:12 GMT 2019
*/
package org.apache.commons.lang3.math;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.apache.commons.lang3.math.NumberUtils;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = false, useJEE = true)
public class NumberUtils_ESTest extends NumberUtils_ESTest_scaffolding {
@Test(timeout = 4000)
public void test000() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("L");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test001() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("4F");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test002() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("2f");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test003() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("D");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test004() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("d");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test005() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0e?");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test006() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0.");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test007() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("..");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test008() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("E");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test009() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0e");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test010() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0+x");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test011() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("1eeP,->x0kB");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test012() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("EWZN~`ON~K%.G");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test013() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("...");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test014() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0.l");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test015() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("-----0xIllegalArgumentException occurred");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test016() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("-");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test017() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0xCn 17^AX/l_J59B?Pg");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test018() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0x0.!x");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test019() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("-0xd");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test020() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0e.");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test021() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("0x");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test022() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("3");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test023() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("k5=@n");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test024() throws Throwable {
boolean boolean0 = NumberUtils.isNumber((String) null);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test025() throws Throwable {
boolean boolean0 = NumberUtils.isNumber("-1l");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test026() throws Throwable {
byte byte0 = NumberUtils.max((byte) (-73), (byte)1, (byte) (-69));
assertEquals((byte)1, byte0);
}
@Test(timeout = 4000)
public void test027() throws Throwable {
byte byte0 = NumberUtils.max((byte) (-73), (byte) (-73), (byte) (-69));
assertEquals((byte) (-69), byte0);
}
@Test(timeout = 4000)
public void test028() throws Throwable {
short short0 = NumberUtils.max((short)97, (short) (-3506), (short)3996);
assertEquals((short)3996, short0);
}
@Test(timeout = 4000)
public void test029() throws Throwable {
short short0 = NumberUtils.max((short)2, (short)1148, (short)64);
assertEquals((short)1148, short0);
}
@Test(timeout = 4000)
public void test030() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
int int0 = NumberUtils.max((int) numberUtils0.BYTE_ONE, 5595, (int) numberUtils0.SHORT_ZERO);
assertEquals(5595, int0);
}
@Test(timeout = 4000)
public void test031() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
int int0 = NumberUtils.max((int) numberUtils0.SHORT_ZERO, (int) numberUtils0.SHORT_MINUS_ONE, (int) numberUtils0.BYTE_ONE);
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test032() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
long long0 = NumberUtils.max(80L, (long) 1163, (long) numberUtils0.INTEGER_ONE);
assertEquals(1163L, long0);
}
@Test(timeout = 4000)
public void test033() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
long long0 = NumberUtils.max(80L, (long) numberUtils0.INTEGER_ONE, (long) 5595);
assertEquals(5595L, long0);
}
@Test(timeout = 4000)
public void test034() throws Throwable {
byte byte0 = NumberUtils.min((byte)3, (byte)1, (byte)38);
assertEquals((byte)1, byte0);
}
@Test(timeout = 4000)
public void test035() throws Throwable {
byte byte0 = NumberUtils.min((byte)3, (byte)3, (byte) (-4));
assertEquals((byte) (-4), byte0);
}
@Test(timeout = 4000)
public void test036() throws Throwable {
short short0 = NumberUtils.min((short)705, (short)705, (short)665);
assertEquals((short)665, short0);
}
@Test(timeout = 4000)
public void test037() throws Throwable {
short short0 = NumberUtils.min((short)1166, (short) (-1573), (short)0);
assertEquals((short) (-1573), short0);
}
@Test(timeout = 4000)
public void test038() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
int int0 = NumberUtils.min((int) numberUtils0.SHORT_ONE, (int) numberUtils0.BYTE_MINUS_ONE, (int) numberUtils0.BYTE_ZERO);
assertEquals((-1), int0);
}
@Test(timeout = 4000)
public void test039() throws Throwable {
int int0 = NumberUtils.min(32, 32, 26);
assertEquals(26, int0);
}
@Test(timeout = 4000)
public void test040() throws Throwable {
long long0 = NumberUtils.min(914L, 914L, 914L);
assertEquals(914L, long0);
}
@Test(timeout = 4000)
public void test041() throws Throwable {
long long0 = NumberUtils.min((long) (byte)1, (-698L), (-2923L));
assertEquals((-2923L), long0);
}
@Test(timeout = 4000)
public void test042() throws Throwable {
float[] floatArray0 = new float[9];
floatArray0[0] = (-7463.0F);
float float0 = NumberUtils.max(floatArray0);
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test043() throws Throwable {
float[] floatArray0 = new float[3];
floatArray0[1] = Float.NaN;
float float0 = NumberUtils.max(floatArray0);
assertEquals(Float.NaN, float0, 0.01F);
}
@Test(timeout = 4000)
public void test044() throws Throwable {
float[] floatArray0 = new float[0];
// Undeclared exception!
try {
NumberUtils.max(floatArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test045() throws Throwable {
// Undeclared exception!
try {
NumberUtils.max((float[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test046() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
double[] doubleArray0 = new double[5];
doubleArray0[0] = (double) (int)numberUtils0.INTEGER_MINUS_ONE;
double double0 = NumberUtils.max(doubleArray0);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test047() throws Throwable {
double[] doubleArray0 = new double[8];
doubleArray0[6] = Double.NaN;
double double0 = NumberUtils.max(doubleArray0);
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test048() throws Throwable {
double[] doubleArray0 = new double[0];
// Undeclared exception!
try {
NumberUtils.max(doubleArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test049() throws Throwable {
// Undeclared exception!
try {
NumberUtils.max((double[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test050() throws Throwable {
byte[] byteArray0 = new byte[7];
byteArray0[6] = (byte)70;
byte byte0 = NumberUtils.max(byteArray0);
assertEquals((byte)70, byte0);
}
@Test(timeout = 4000)
public void test051() throws Throwable {
byte[] byteArray0 = new byte[0];
// Undeclared exception!
try {
NumberUtils.max(byteArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test052() throws Throwable {
// Undeclared exception!
try {
NumberUtils.max((byte[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test053() throws Throwable {
short[] shortArray0 = new short[9];
shortArray0[3] = (short)48;
short short0 = NumberUtils.max(shortArray0);
assertEquals((short)48, short0);
}
@Test(timeout = 4000)
public void test054() throws Throwable {
short[] shortArray0 = new short[0];
// Undeclared exception!
try {
NumberUtils.max(shortArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test055() throws Throwable {
// Undeclared exception!
try {
NumberUtils.max((short[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test056() throws Throwable {
int[] intArray0 = new int[3];
intArray0[2] = 8;
int int0 = NumberUtils.max(intArray0);
assertEquals(8, int0);
}
@Test(timeout = 4000)
public void test057() throws Throwable {
int[] intArray0 = new int[0];
// Undeclared exception!
try {
NumberUtils.max(intArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test058() throws Throwable {
// Undeclared exception!
try {
NumberUtils.max((int[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test059() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
long[] longArray0 = new long[3];
longArray0[2] = (long) numberUtils0.LONG_ONE;
long long0 = NumberUtils.max(longArray0);
assertEquals(1L, long0);
}
@Test(timeout = 4000)
public void test060() throws Throwable {
long[] longArray0 = new long[0];
// Undeclared exception!
try {
NumberUtils.max(longArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test061() throws Throwable {
// Undeclared exception!
try {
NumberUtils.max((long[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test062() throws Throwable {
float[] floatArray0 = new float[16];
floatArray0[0] = (float) 135;
float float0 = NumberUtils.min(floatArray0);
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test063() throws Throwable {
float[] floatArray0 = new float[9];
floatArray0[3] = Float.NaN;
float float0 = NumberUtils.min(floatArray0);
assertEquals(Float.NaN, float0, 0.01F);
}
@Test(timeout = 4000)
public void test064() throws Throwable {
float[] floatArray0 = new float[0];
// Undeclared exception!
try {
NumberUtils.min(floatArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test065() throws Throwable {
// Undeclared exception!
try {
NumberUtils.min((float[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test066() throws Throwable {
double[] doubleArray0 = new double[7];
doubleArray0[2] = (double) (short) (-7463);
double double0 = NumberUtils.min(doubleArray0);
assertEquals((-7463.0), double0, 0.01);
}
@Test(timeout = 4000)
public void test067() throws Throwable {
double[] doubleArray0 = new double[7];
doubleArray0[3] = Double.NaN;
double double0 = NumberUtils.min(doubleArray0);
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test068() throws Throwable {
double[] doubleArray0 = new double[0];
// Undeclared exception!
try {
NumberUtils.min(doubleArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test069() throws Throwable {
// Undeclared exception!
try {
NumberUtils.min((double[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test070() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
byte[] byteArray0 = new byte[2];
byteArray0[0] = (byte) numberUtils0.BYTE_ONE;
byte byte0 = NumberUtils.min(byteArray0);
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test071() throws Throwable {
byte[] byteArray0 = new byte[0];
// Undeclared exception!
try {
NumberUtils.min(byteArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test072() throws Throwable {
// Undeclared exception!
try {
NumberUtils.min((byte[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test073() throws Throwable {
byte[] byteArray0 = new byte[2];
byte byte0 = NumberUtils.min(byteArray0);
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test074() throws Throwable {
short[] shortArray0 = new short[15];
shortArray0[1] = (short) (-4765);
short short0 = NumberUtils.min(shortArray0);
assertEquals((short) (-4765), short0);
}
@Test(timeout = 4000)
public void test075() throws Throwable {
short[] shortArray0 = new short[0];
// Undeclared exception!
try {
NumberUtils.min(shortArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test076() throws Throwable {
// Undeclared exception!
try {
NumberUtils.min((short[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test077() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
int[] intArray0 = new int[4];
intArray0[0] = (int) (short)numberUtils0.SHORT_ONE;
int int0 = NumberUtils.min(intArray0);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test078() throws Throwable {
// Undeclared exception!
try {
NumberUtils.min((int[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test079() throws Throwable {
int[] intArray0 = new int[0];
// Undeclared exception!
try {
NumberUtils.min(intArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test080() throws Throwable {
long[] longArray0 = new long[6];
longArray0[0] = (long) 1306;
long long0 = NumberUtils.min(longArray0);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test081() throws Throwable {
// Undeclared exception!
try {
NumberUtils.min((long[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// The Array must not be null
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test082() throws Throwable {
long[] longArray0 = new long[0];
// Undeclared exception!
try {
NumberUtils.min(longArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Array cannot be empty.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test083() throws Throwable {
BigDecimal bigDecimal0 = NumberUtils.createBigDecimal((String) null);
assertNull(bigDecimal0);
}
@Test(timeout = 4000)
public void test084() throws Throwable {
BigInteger bigInteger0 = NumberUtils.createBigInteger((String) null);
assertNull(bigInteger0);
}
@Test(timeout = 4000)
public void test085() throws Throwable {
Long long0 = NumberUtils.createLong((String) null);
assertNull(long0);
}
@Test(timeout = 4000)
public void test086() throws Throwable {
Integer integer0 = NumberUtils.createInteger((String) null);
assertNull(integer0);
}
@Test(timeout = 4000)
public void test087() throws Throwable {
Double double0 = NumberUtils.createDouble((String) null);
assertNull(double0);
}
@Test(timeout = 4000)
public void test088() throws Throwable {
Float float0 = NumberUtils.createFloat((String) null);
assertNull(float0);
}
@Test(timeout = 4000)
public void test089() throws Throwable {
try {
NumberUtils.createNumber("e(xS)VF,`$~zos^34of");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// e(xS)VF,`$~zos^34of is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test090() throws Throwable {
Number number0 = NumberUtils.createNumber("0.");
assertEquals(0.0F, number0);
}
@Test(timeout = 4000)
public void test091() throws Throwable {
Number number0 = NumberUtils.createNumber("0e6");
assertEquals((short)0, number0.shortValue());
}
@Test(timeout = 4000)
public void test092() throws Throwable {
Number number0 = NumberUtils.createNumber("0l");
assertEquals(0L, number0);
}
@Test(timeout = 4000)
public void test093() throws Throwable {
try {
NumberUtils.createNumber("-l");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// -l is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test094() throws Throwable {
try {
NumberUtils.createNumber("Strings must not be null");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// Strings must not be null is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test095() throws Throwable {
Number number0 = NumberUtils.createNumber("0f");
assertEquals((byte)0, number0.byteValue());
}
@Test(timeout = 4000)
public void test096() throws Throwable {
try {
NumberUtils.createNumber("d");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// d is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test097() throws Throwable {
try {
NumberUtils.createNumber("LAAL");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// LAAL is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test098() throws Throwable {
Number number0 = NumberUtils.createNumber("4F");
assertEquals(4.0F, number0);
}
@Test(timeout = 4000)
public void test099() throws Throwable {
Number number0 = NumberUtils.createNumber("3D");
assertEquals(3.0, number0);
}
@Test(timeout = 4000)
public void test100() throws Throwable {
try {
NumberUtils.createNumber("0.!x");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// 0.!x is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test101() throws Throwable {
try {
NumberUtils.createNumber("0e6!");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// 0e6! is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test102() throws Throwable {
try {
NumberUtils.createNumber("normalize");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// normalize is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test103() throws Throwable {
Number number0 = NumberUtils.createNumber("60.");
assertEquals(60.0F, number0);
}
@Test(timeout = 4000)
public void test104() throws Throwable {
try {
NumberUtils.createNumber("&nGyWE^e*");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// &nGyWE^e* is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test105() throws Throwable {
try {
NumberUtils.createNumber("E0e6");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// For input string: \"E0e6\"
//
verifyException("java.lang.NumberFormatException", e);
}
}
@Test(timeout = 4000)
public void test106() throws Throwable {
try {
NumberUtils.createNumber("sun.text.Normalizer is not available");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// sun.text.Normalizer is not available is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test107() throws Throwable {
try {
NumberUtils.createNumber(" is not a valid number.");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// is not a valid number. is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test108() throws Throwable {
try {
NumberUtils.createNumber("f.l");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// f.l is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test109() throws Throwable {
try {
NumberUtils.createNumber("sun.texZ.NormalizEr");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// sun.texZ.NormalizEr is not a valid number.
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test110() throws Throwable {
try {
NumberUtils.createNumber("-0x!Pb%bitfEfu4");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// For input string: \"-!Pb%bitfEfu4\"
//
verifyException("java.lang.NumberFormatException", e);
}
}
@Test(timeout = 4000)
public void test111() throws Throwable {
try {
NumberUtils.createNumber("0xMinimum abreviation width is 4");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// For input string: \"Minimum abreviation width is 4\"
//
verifyException("java.lang.NumberFormatException", e);
}
}
@Test(timeout = 4000)
public void test112() throws Throwable {
Number number0 = NumberUtils.createNumber("--org.apache.commons.lang3.math.NumberUtils");
assertNull(number0);
}
@Test(timeout = 4000)
public void test113() throws Throwable {
try {
NumberUtils.createNumber("");
fail("Expecting exception: NumberFormatException");
} catch(NumberFormatException e) {
//
// A blank string is not a valid number
//
verifyException("org.apache.commons.lang3.math.NumberUtils", e);
}
}
@Test(timeout = 4000)
public void test114() throws Throwable {
Number number0 = NumberUtils.createNumber((String) null);
assertNull(number0);
}
@Test(timeout = 4000)
public void test115() throws Throwable {
Number number0 = NumberUtils.createNumber("-1l");
assertEquals((-1L), number0);
}
@Test(timeout = 4000)
public void test116() throws Throwable {
short short0 = NumberUtils.toShort((String) null, (short) (byte)110);
assertEquals((short)110, short0);
}
@Test(timeout = 4000)
public void test117() throws Throwable {
byte byte0 = NumberUtils.toByte("EM");
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test118() throws Throwable {
double double0 = NumberUtils.toDouble((String) null, 0.0);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test119() throws Throwable {
long long0 = NumberUtils.toLong((String) null, 1L);
assertEquals(1L, long0);
}
@Test(timeout = 4000)
public void test120() throws Throwable {
int int0 = NumberUtils.toInt((String) null, (-196328591));
assertEquals((-196328591), int0);
}
@Test(timeout = 4000)
public void test121() throws Throwable {
short short0 = NumberUtils.toShort("G");
assertEquals((short)0, short0);
}
@Test(timeout = 4000)
public void test122() throws Throwable {
float float0 = NumberUtils.toFloat((String) null);
assertEquals(0.0F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test123() throws Throwable {
int int0 = NumberUtils.toInt(";tU&");
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test124() throws Throwable {
long long0 = NumberUtils.toLong("");
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test125() throws Throwable {
double double0 = NumberUtils.max((-3984.1973942528), (-3984.1973942528), 0.0);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test126() throws Throwable {
byte byte0 = NumberUtils.toByte((String) null);
assertEquals((byte)0, byte0);
}
@Test(timeout = 4000)
public void test127() throws Throwable {
NumberUtils numberUtils0 = new NumberUtils();
float float0 = NumberUtils.toFloat("EM", (float) numberUtils0.FLOAT_MINUS_ONE);
assertEquals((-1.0F), float0, 0.01F);
}
@Test(timeout = 4000)
public void test128() throws Throwable {
double double0 = NumberUtils.min((double) 0, 1555.0287866109468, (double) 2550L);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test129() throws Throwable {
double double0 = NumberUtils.toDouble("G");
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test130() throws Throwable {
float float0 = NumberUtils.min(3836.54F, 3836.54F, 3836.54F);
assertEquals(3836.54F, float0, 0.01F);
}
@Test(timeout = 4000)
public void test131() throws Throwable {
float float0 = NumberUtils.max(1426.3506F, (-1436.2F), (float) (byte) (-99));
assertEquals(1426.3506F, float0, 0.01F);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
d7652f602514440be93bd294794ea888b59aac2d | 5c6862dd4819e67e948bcef02aaa0818ae03d748 | /app/src/main/java/com/tang/trade/tang/zxing/android/IntentSource.java | f9000377464893441c0b6484c72eb7cb64526d75 | [] | no_license | OnClickListener2048/tang8 | 5416dcf99df3cef98f06e6799afabe0a0fdf4257 | f4aecc996d2b208a1bea6b84371aa3292dab2f3a | refs/heads/master | 2021-07-17T02:29:29.052200 | 2017-10-11T16:23:57 | 2017-10-11T16:23:57 | 106,579,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 140 | java | package com.tang.trade.tang.zxing.android;
public enum IntentSource {
NATIVE_APP_INTENT,
PRODUCT_SEARCH_LINK,
ZXING_LINK,
NONE
}
| [
"55997027@qq.com"
] | 55997027@qq.com |
bb90f91a72aec09c91a312d4312e92239edc7aba | aded9c5e99d627b6ff7090c13b55bb91f31fb26e | /app/src/main/java/com/haoche51/sales/custom/HCPullToRefresh.java | 2e568850f16485dc37180d4dcb0cf5bb53e15888 | [] | no_license | pengxinaglin/maiche | f47964884393bcd7823550b8392ee4621c78fa5e | 4b36e2ef5f45df9879843e2ce98acdacc4f7eb33 | refs/heads/master | 2021-01-21T10:12:33.595132 | 2017-02-28T05:08:54 | 2017-02-28T05:08:54 | 83,391,921 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 10,166 | java | package com.haoche51.sales.custom;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AbsListView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.haoche51.sales.R;
import com.haoche51.sales.util.HCLogUtil;
import com.nostra13.universalimageloader.core.ImageLoader;
import java.lang.reflect.Method;
import in.srain.cube.views.ptr.PtrClassicDefaultHeader;
import in.srain.cube.views.ptr.PtrClassicFrameLayout;
import in.srain.cube.views.ptr.PtrFrameLayout;
import in.srain.cube.views.ptr.PtrHandler;
/**
* Created by lightman_mac on 8/6/15.
* <p/>
* 怎么在这个类里设置footer的状态 而不用每次都在使用的时候设置?
*/
public class HCPullToRefresh extends LinearLayout implements AbsListView.OnScrollListener, View.OnTouchListener {
public HCPullToRefresh(Context context) {
this(context, null, 0);
}
public HCPullToRefresh(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public HCPullToRefresh(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
doInitViews();
}
private final static String TAG = "HCPULL";
private PtrClassicFrameLayout mPtrFrame;
private ListView mInnerLv;
private OnRefreshCallback mOnRefreshCallback;
private onUIRefreshCompleteCallback mOnUIRefreshCompleteCallback;
private View footerView;
private TextView mFooterTv;
private ProgressBar mFooterPb;
/**
* 标识是否正在加载更多
*/
private boolean isLoadingMore = false;
/**
* 标识是否 没有更多数据了
*/
private boolean isNoMoreData = false;
/**
* 控制是否可以下拉 默认可以
*/
private boolean canPull = true;
private View emptyView;
/***
* 控制当可见条目数等于总条目数,不能下拉
*/
private boolean isVisibleLessTotal = false;
/**
* 控制当有筛选栏隐藏时,不能下拉
*/
private boolean isFilterBarVisible = true;
private void doInitViews() {
int res = R.layout.hc_pull_to_refresh;
View rootView = LayoutInflater.from(getContext()).inflate(res, this);
mPtrFrame = (PtrClassicFrameLayout) rootView.findViewById(R.id.ptr_frame_base);
mPtrFrame.addPtrUIHandler(new PtrClassicDefaultHeader(getContext()) {
public void onUIRefreshComplete(PtrFrameLayout frame) {
super.onUIRefreshComplete(frame);
if (mInnerLv.getEmptyView() == null && emptyView != null) {
mInnerLv.setEmptyView(emptyView);
}
if (mOnUIRefreshCompleteCallback != null) {
mOnUIRefreshCompleteCallback.onUIRefreshComplete();
}
}
});
mPtrFrame.setPtrHandler(new PtrHandler() {
@Override
public boolean checkCanDoRefresh(PtrFrameLayout ptrFrameLayout, View view, View view1) {
/* if(isVisibleLessTotal){
return false;
}*/
if (!isFilterBarVisible) {
return false;
}
if (isLvOnTop()) {
return canPull;
} else {
return false;
}
}
@Override
public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
if (mOnRefreshCallback != null) {
mOnRefreshCallback.onPullDownRefresh();
}
}
});
mInnerLv = (ListView) rootView.findViewById(R.id.ptr_lv_base);
//移出默认holder
try {
Method method = AbsListView.class.getDeclaredMethod("setOverScrollMode", int.class);
method.setAccessible(true);
method.invoke(mInnerLv, 2);// View.OVER_SCROLL_NEVER
} catch (Exception e) {
e.printStackTrace();
}
mInnerLv.setOnScrollListener(this);
initFooterView();
}
private void initFooterView() {
int footerRes = R.layout.pulldown_footer;
footerView = LayoutInflater.from(getContext()).inflate(footerRes, null);
footerView.setVisibility(View.GONE);
mFooterTv = (TextView) footerView.findViewById(R.id.pulldown_footer_text);
mFooterPb = (ProgressBar) footerView.findViewById(R.id.pulldown_footer_loading);
mInnerLv.addFooterView(footerView);
footerView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//底部加载更多点击
seeIfNeedLoadMore();
}
});
}
public void setFirstAutoRefresh() {
autoRefresh();
}
public void setCanPull(boolean canPull) {
this.canPull = canPull;
}
public ListView getListView() {
return mInnerLv;
}
public PtrClassicFrameLayout getPtrClassicFrameLayout() {
return mPtrFrame;
}
public void autoRefresh() {
this.postDelayed(new Runnable() {
@Override
public void run() {
mPtrFrame.autoRefresh();
}
}, 100);
}
public void setFooterStatus(boolean isNoMoreData) {
this.isNoMoreData = isNoMoreData;
if (footerView.getVisibility() != View.VISIBLE) {
footerView.setVisibility(View.VISIBLE);
}
mFooterPb.setVisibility(View.GONE);
int textRes = isNoMoreData ? R.string.hc_nomore_data : R.string.hc_loadmore;
mFooterTv.setText(textRes);
mFooterTv.setTextSize(10);
mFooterTv.setTextColor(getResources().getColor(R.color.hc_self_gray_hint));
isLoadingMore = false;
}
public void hideFooter() {
if (footerView.getVisibility() != View.GONE) {
footerView.setVisibility(View.GONE);
}
}
public void finishRefresh() {
mPtrFrame.refreshComplete();
}
public void setEmptyView(View view) {
this.emptyView = view;
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case SCROLL_STATE_FLING:
ImageLoader.getInstance().pause();
break;
case SCROLL_STATE_IDLE:
ImageLoader.getInstance().resume();
//在idle时候检查是否到了最底部.
seeIfNeedLoadMore();
break;
case SCROLL_STATE_TOUCH_SCROLL:
break;
}
}
private boolean isLvOnTop() {
if (mInnerLv.getChildCount() == 0) return true;
return mInnerLv.getChildAt(0).getTop() == 0;
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
isVisibleLessTotal = visibleItemCount == totalItemCount;
}
private void seeIfNeedLoadMore() {
if (mInnerLv.getAdapter() == null || isLoadingMore || isNoMoreData)
return;
if (mInnerLv.getLastVisiblePosition() == mInnerLv.getAdapter().getCount() - 1
&& mInnerLv.getChildAt(mInnerLv.getChildCount() - 1).getBottom() <= mInnerLv.getHeight()) {
if (mOnRefreshCallback != null) {
mOnRefreshCallback.onLoadMoreRefresh();
mFooterPb.setVisibility(View.VISIBLE);
mFooterTv.setText(R.string.hc_loading);
isLoadingMore = true;
}
}
}
public void setFilterBarVisible(boolean isFilterBarVisible) {
this.isFilterBarVisible = isFilterBarVisible;
}
public void setOnRefreshCallback(OnRefreshCallback callback) {
this.mOnRefreshCallback = callback;
}
public void setmOnUIRefreshCompleteCallback(onUIRefreshCompleteCallback calback) {
this.mOnUIRefreshCompleteCallback = calback;
}
public interface OnRefreshCallback {
void onPullDownRefresh();
void onLoadMoreRefresh();
}
public interface onUIRefreshCompleteCallback {
void onUIRefreshComplete();
}
//-----------------------touch listener ---------------------------------//
public interface OnPullUpDetector {
void isPullUp(boolean isMovingUp);
}
private OnPullUpDetector mPullDetector;
public void setPullUpDetector(OnPullUpDetector detector) {
mPullDetector = detector;
this.mInnerLv.setOnTouchListener(this);
}
private float downRawY;
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_CANCEL:
HCLogUtil.d(TAG, "------ACTION_CANCEL getRawY::::::" + event.getY());
mPullDetector.isPullUp(false);
break;
case MotionEvent.ACTION_UP:
HCLogUtil.d(TAG, "------ACTION_UP getRawY::::::" + event.getY());
float currentRawY = event.getY();
float diffY = currentRawY - downRawY;
HCLogUtil.d(TAG, "------ACTION_UP diffY::::::" + diffY);
if (Math.abs(diffY) > 15) {
if (diffY > 0) { //下拉
mPullDetector.isPullUp(false);
return true;
} else { //上拉
mPullDetector.isPullUp(true);
return true;
}
}
break;
case MotionEvent.ACTION_MOVE:
break;
case MotionEvent.ACTION_DOWN:
HCLogUtil.d(TAG, "------ACTION_DOWN getRawY::::::" + event.getY());
downRawY = event.getY();
break;
}
return false;
}
//-----------------------touch listener ---------------------------------//
}
| [
"pengxianglin@haoche51.com"
] | pengxianglin@haoche51.com |
0829cbd7ba30e5b4b8855ceed33403db9006b985 | 2d13c3c53af732b37c79c336767ea78eebda81d1 | /project/Frontend/src/main/java/com/test/utils/Check.java | eb2774f7161a3d659df231aafe22743e76662fc6 | [] | no_license | Likun-Code/ASmallSalaryManagementSystem | b63bd0cc373c2fc7ccc21b0e291babc6cb1a0928 | 1767501df3916b79f6ee6bf370bb3a487bff7e91 | refs/heads/master | 2022-12-01T08:43:25.091349 | 2020-08-12T11:26:04 | 2020-08-12T11:26:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,425 | java | package com.test.utils;
import com.test.constant.ReturnCode;
import com.test.entity.Worker;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Pattern;
public class Check {
private static final String getAll = "*";
public static <T> boolean isEmpty(T value)
{
return value == null;
}
public static boolean isEmpty(Integer value)
{
return value == null;
}
public static boolean isEmpty(Integer [] value)
{
return value == null || value.length == 0;
}
public static <K,V> boolean isEmpty(HashMap<K,V> map)
{
return map == null || map.isEmpty();
}
public static boolean isEmpty(Double value)
{
return value == null || value.isInfinite() || value.isNaN();
}
public static <T> boolean isEmpty(ArrayList<T> value)
{
return value == null || value.isEmpty();
}
public static boolean isEmpty(Path path)
{
return path == null || !Files.exists(path);
}
public static boolean isEmpty(Worker worker)
{
return worker == null || isEmpty(worker.getCellphone()) || isEmpty(worker.getPassword());
}
public static boolean isEmpty(File file)
{
return file == null || file.isDirectory() || file.length() == 0 || Check.isEmpty(file.getName());
}
public static boolean isEmpty(String t)
{
return t == null || t.isEmpty();
}
public static <T> boolean isEmpty(List<T> t)
{
return t == null || t.isEmpty();
}
public static boolean isSendSmsFailed(String code)
{
return ReturnCode.UNKNOWN_ERROR.name().equals(code) || ReturnCode.INVALID_CELLPHONE.name().equals(code)
|| ReturnCode.EMPTY_CELLPHONE.name().equals(code);
}
public static boolean isInvalidCellphone(String cellphone)
{
if(Check.isGetAll(cellphone))
return false;
String reg = "^[1][358][0-9]{9}$";
return !(Pattern.compile(reg).matcher(cellphone).matches());
}
public static String getAll()
{
return getAll;
}
public static boolean isGetAll(String cellphone)
{
return getAll.equals(cellphone);
}
}
| [
"2293736867@qq.com"
] | 2293736867@qq.com |
140ccb23aa5f88ed827e1c881075e6194bcf5291 | cc24a71bf74a74e3776252a1926e6bf5f0207766 | /src/main/java/com/murilomartins/cursomc/domain/PagamentoComCartao.java | a6e44c52837fb47bfefaf846f61cbe308b1142fa | [] | no_license | murilomts/sprint-boot-ionic-backend | 4461eef3bf921ccfab40b706dd5aa3f8537a86ee | e0588da9b2f8fd6323e3c6474914248dab73d596 | refs/heads/master | 2020-12-06T23:20:46.052006 | 2020-11-25T02:47:10 | 2020-11-25T02:47:10 | 232,578,501 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package com.murilomartins.cursomc.domain;
import javax.persistence.Entity;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.murilomartins.cursomc.domain.enums.EstadoPagamento;
@Entity
@JsonTypeName("pagamentoComCartao")
public class PagamentoComCartao extends Pagamento{
private static final long serialVersionUID = 1L;
private Integer numeroDeParcelas;
public PagamentoComCartao() {
}
public PagamentoComCartao(Integer id, EstadoPagamento estado, Pedido pedido, Integer numeroDeParcelas) {
super(id, estado, pedido);
this.numeroDeParcelas = numeroDeParcelas;
}
public Integer getNumeroDeParcelas() {
return numeroDeParcelas;
}
public void setNumeroDeParcelas(Integer numeroDeParcelas) {
this.numeroDeParcelas = numeroDeParcelas;
}
}
| [
"murilo.mtds@gmail.com"
] | murilo.mtds@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.