blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
920035770fcae60b9a805e495151df6b47568144 | 8036c5c6da8d8a5037fcf9a9740fa8e5fa9c511f | /src/InterfacesAndInheritance/CirclePlus.java | fab2638dcf97999d6d69c6355db9922d0f915d90 | [] | no_license | gsmith83/training_java | 50e409d74f5f256c4f6df8f1c587aeb75a82ea55 | d39d9de1d70f1e556d534df76db4f7543d98e036 | refs/heads/master | 2021-01-17T14:46:17.265916 | 2016-08-05T17:15:18 | 2016-08-05T17:15:18 | 50,052,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package InterfacesAndInheritance;
public class CirclePlus implements Relatable {
int radius = 0;
public CirclePlus(){}
public CirclePlus(int radius){
this.radius = radius;
}
@Override
public int isLargerThan(Relatable other) {
CirclePlus otherCircle = (CirclePlus)other;
if(this.getArea() > otherCircle.getArea())
return 1;
else if(this.getArea() < otherCircle.getArea())
return -1;
else
return 0;
}
// Calculates a circles area rounded to nearest integer
@Override
public int getArea() {
return (int) (Math.PI * this.radius * this.radius);
}
}
| [
"gregory.smith@us.panasonic.com"
] | gregory.smith@us.panasonic.com |
38c6bedc150c957fe334f77c04b9065590f3c911 | 1b1128fd9f967b5c8a31de8c7842cad19a331898 | /project/src/main/java/com/xml/project/controller/DbController.java | 986b4499e35066e87c57df0e71281a2647c65f8b | [] | no_license | mirkovana/XML_i_Web_servisi_tim9 | af19fa2aa3f923c3f77a547b35aad61f6233ccc8 | ca345bb048753e662a05ccf58df90fe7f28aa6ff | refs/heads/master | 2023-03-05T04:38:26.456206 | 2021-02-06T22:51:02 | 2021-02-06T22:51:02 | 310,620,718 | 0 | 0 | null | 2021-02-06T22:38:43 | 2020-11-06T14:33:58 | Java | UTF-8 | Java | false | false | 1,066 | java | package com.xml.project.controller;
import java.io.IOException;
import java.net.URI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xmldb.api.base.XMLDBException;
import com.xml.project.database.DbManager;
@RestController
@RequestMapping("/api/db")
@CrossOrigin
public class DbController {
@Autowired
public DbManager dbManager;
@GetMapping(value = "/init")
public void init()
throws ClassNotFoundException, InstantiationException, IllegalAccessException, XMLDBException, IOException {
System.out.println("initiate data");
Resource resource = new ClassPathResource("data");
dbManager.store("/db/XmlProject/users", "Users.xml", resource.getURI().getPath() + "/Users.xml");
}
}
| [
"alenmujo10@gmail.com"
] | alenmujo10@gmail.com |
1ed1f265b589e8c54b4ecebdcecb2a977cd70b58 | 9458c7fe5de050694714b1b8fe48779a9f5ffbc5 | /SKEyeSDKDemo/app/src/androidTest/java/com/interjoy/skeyesdkdemo/ApplicationTest.java | ebb89cbaf1055027da0997d33cede043ac8e0a6b | [] | no_license | interjoy/SKEye-Android-SDK | a0686ecfb2f3f8986aa6f67e2aaa72823d783ac8 | f59cf940aa4061ccdda769730cfa5d897a26670a | refs/heads/master | 2021-01-20T01:42:54.715071 | 2017-09-23T09:46:51 | 2017-09-23T09:46:51 | 89,318,774 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.interjoy.skeyesdkdemo;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"zfguo@interjoy.com.cn"
] | zfguo@interjoy.com.cn |
27677cba947bd5d5d70ca7ee4ff097b042c1d67a | eb9c3dac0dca0ecd184df14b1fda62e61cc8c7d7 | /google/ads/googleads/v4/googleads-java/gapic-googleads-java/src/test/java/com/google/ads/googleads/v4/services/LanguageConstantServiceClientTest.java | b82830a84b3c07dc672c8ddaaf98f6033d385bb3 | [
"Apache-2.0"
] | permissive | Tryweirder/googleapis-gen | 2e5daf46574c3af3d448f1177eaebe809100c346 | 45d8e9377379f9d1d4e166e80415a8c1737f284d | refs/heads/master | 2023-04-05T06:30:04.726589 | 2021-04-13T23:35:20 | 2021-04-13T23:35:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,447 | java | /*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.ads.googleads.v4.services;
import com.google.ads.googleads.v4.resources.LanguageConstant;
import com.google.ads.googleads.v4.resources.LanguageConstantName;
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.BoolValue;
import com.google.protobuf.Int64Value;
import com.google.protobuf.StringValue;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@Generated("by gapic-generator-java")
public class LanguageConstantServiceClientTest {
private static MockLanguageConstantService mockLanguageConstantService;
private static MockServiceHelper mockServiceHelper;
private LanguageConstantServiceClient client;
private LocalChannelProvider channelProvider;
@BeforeClass
public static void startStaticServer() {
mockLanguageConstantService = new MockLanguageConstantService();
mockServiceHelper =
new MockServiceHelper(
UUID.randomUUID().toString(),
Arrays.<MockGrpcService>asList(mockLanguageConstantService));
mockServiceHelper.start();
}
@AfterClass
public static void stopServer() {
mockServiceHelper.stop();
}
@Before
public void setUp() throws IOException {
mockServiceHelper.reset();
channelProvider = mockServiceHelper.createChannelProvider();
LanguageConstantServiceSettings settings =
LanguageConstantServiceSettings.newBuilder()
.setTransportChannelProvider(channelProvider)
.setCredentialsProvider(NoCredentialsProvider.create())
.build();
client = LanguageConstantServiceClient.create(settings);
}
@After
public void tearDown() throws Exception {
client.close();
}
@Test
public void getLanguageConstantTest() throws Exception {
LanguageConstant expectedResponse =
LanguageConstant.newBuilder()
.setResourceName(LanguageConstantName.of("[LANGUAGE_CONSTANT]").toString())
.setId(Int64Value.newBuilder().build())
.setCode(StringValue.newBuilder().build())
.setName(StringValue.newBuilder().build())
.setTargetable(BoolValue.newBuilder().build())
.build();
mockLanguageConstantService.addResponse(expectedResponse);
LanguageConstantName resourceName = LanguageConstantName.of("[LANGUAGE_CONSTANT]");
LanguageConstant actualResponse = client.getLanguageConstant(resourceName);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLanguageConstantService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetLanguageConstantRequest actualRequest = ((GetLanguageConstantRequest) actualRequests.get(0));
Assert.assertEquals(resourceName.toString(), actualRequest.getResourceName());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void getLanguageConstantExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockLanguageConstantService.addException(exception);
try {
LanguageConstantName resourceName = LanguageConstantName.of("[LANGUAGE_CONSTANT]");
client.getLanguageConstant(resourceName);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void getLanguageConstantTest2() throws Exception {
LanguageConstant expectedResponse =
LanguageConstant.newBuilder()
.setResourceName(LanguageConstantName.of("[LANGUAGE_CONSTANT]").toString())
.setId(Int64Value.newBuilder().build())
.setCode(StringValue.newBuilder().build())
.setName(StringValue.newBuilder().build())
.setTargetable(BoolValue.newBuilder().build())
.build();
mockLanguageConstantService.addResponse(expectedResponse);
String resourceName = "resourceName-384566343";
LanguageConstant actualResponse = client.getLanguageConstant(resourceName);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLanguageConstantService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetLanguageConstantRequest actualRequest = ((GetLanguageConstantRequest) actualRequests.get(0));
Assert.assertEquals(resourceName, actualRequest.getResourceName());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
@Test
public void getLanguageConstantExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockLanguageConstantService.addException(exception);
try {
String resourceName = "resourceName-384566343";
client.getLanguageConstant(resourceName);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
] | bazel-bot-development[bot]@users.noreply.github.com |
648d6c12f9da1b1e74218fb77ac4d4c44f572c21 | f43d5de70d14179639192e091c923ccd27112faa | /src/com/codeHeap/threads/daemons/DaemonFromFactory.java | d5e1449deb1570898fe5d6b13f70fa3f98e24350 | [] | no_license | basumatarau/trainingJavaCore | 2c80d02d539fc6e2e599f6e9240e8f6543ef1bdf | 1efc944b77b1ac7aea44bee89b84daa843670630 | refs/heads/master | 2020-04-04T23:13:47.929352 | 2019-01-09T09:51:35 | 2019-01-09T09:51:35 | 156,351,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | package com.codeHeap.threads.daemons;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class DaemonFromFactory implements Runnable {
@Override
public void run() {
try {
while (true) {
TimeUnit.MILLISECONDS.sleep(100);
System.out.println(Thread.currentThread() + " " + this);
}
}catch (InterruptedException e){
throw new RuntimeException(e);
}
}
public static void main(String[] args) {
ExecutorService executorService = Executors.newCachedThreadPool(new DaemonThreadFactory());
for (int i = 0; i < 10; i++) {
executorService.execute(new DaemonFromFactory());
}
try {
TimeUnit.MILLISECONDS.sleep(1500);
}catch (InterruptedException e){
throw new RuntimeException(e);
}
System.out.println(Thread.currentThread());
}
}
| [
"basumatarau@gmail.com"
] | basumatarau@gmail.com |
b7e04d22560142a7d10379678e3eb03bdabff0de | aa9c4615170434a326d1ea652f3b2675ef5a2d4a | /Encryption-Decryption/Encryption-Decryption/task/src/encryptdecrypt/ShiftService.java | 5812921172d78948b3f5dffbc93610596090c80f | [] | no_license | turych/hyperskill | 245884c1e4dcf1e357a271fff8da6ddcd88f5cb1 | 698d569155c92181fe9f5fdc72fdba698ce94d11 | refs/heads/master | 2021-01-05T03:50:40.031566 | 2020-12-22T17:00:30 | 2020-12-22T17:00:30 | 240,869,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package encryptdecrypt;
public class ShiftService {
StringShift stringShift;
public ShiftService(StringShift stringShift) {
this.stringShift = stringShift;
}
public String shift(String string, int shift) {
return stringShift.execute(string, shift);
}
}
| [
"creo.green@gmail.com"
] | creo.green@gmail.com |
af09b7450546f30f7d749abac4d04fa03ea5e779 | 41154e952cb237c49b6af8045ce29cc10c1fb065 | /gateway/src/main/java/com/example/jhipster/web/rest/RegionResource.java | bd64446712915730c23c16cfb5b1229b23e9255c | [] | no_license | p-stav/jhipster_microservices_test | e6e00dae333288b2ce6a2cb9f608ab3b13037ce1 | 0250b6f58d6223c7335dad2b23f0276aa23d0463 | refs/heads/master | 2021-01-20T00:08:35.718618 | 2017-04-22T18:10:15 | 2017-04-22T18:10:15 | 89,086,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,493 | java | package com.example.jhipster.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.example.jhipster.service.RegionService;
import com.example.jhipster.web.rest.util.HeaderUtil;
import com.example.jhipster.service.dto.RegionDTO;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* REST controller for managing Region.
*/
@RestController
@RequestMapping("/api")
public class RegionResource {
private final Logger log = LoggerFactory.getLogger(RegionResource.class);
private static final String ENTITY_NAME = "region";
private final RegionService regionService;
public RegionResource(RegionService regionService) {
this.regionService = regionService;
}
/**
* POST /regions : Create a new region.
*
* @param regionDTO the regionDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new regionDTO, or with status 400 (Bad Request) if the region has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/regions")
@Timed
public ResponseEntity<RegionDTO> createRegion(@RequestBody RegionDTO regionDTO) throws URISyntaxException {
log.debug("REST request to save Region : {}", regionDTO);
if (regionDTO.getId() != null) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new region cannot already have an ID")).body(null);
}
RegionDTO result = regionService.save(regionDTO);
return ResponseEntity.created(new URI("/api/regions/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /regions : Updates an existing region.
*
* @param regionDTO the regionDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated regionDTO,
* or with status 400 (Bad Request) if the regionDTO is not valid,
* or with status 500 (Internal Server Error) if the regionDTO couldnt be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/regions")
@Timed
public ResponseEntity<RegionDTO> updateRegion(@RequestBody RegionDTO regionDTO) throws URISyntaxException {
log.debug("REST request to update Region : {}", regionDTO);
if (regionDTO.getId() == null) {
return createRegion(regionDTO);
}
RegionDTO result = regionService.save(regionDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, regionDTO.getId().toString()))
.body(result);
}
/**
* GET /regions : get all the regions.
*
* @return the ResponseEntity with status 200 (OK) and the list of regions in body
*/
@GetMapping("/regions")
@Timed
public List<RegionDTO> getAllRegions() {
log.debug("REST request to get all Regions");
return regionService.findAll();
}
/**
* GET /regions/:id : get the "id" region.
*
* @param id the id of the regionDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the regionDTO, or with status 404 (Not Found)
*/
@GetMapping("/regions/{id}")
@Timed
public ResponseEntity<RegionDTO> getRegion(@PathVariable Long id) {
log.debug("REST request to get Region : {}", id);
RegionDTO regionDTO = regionService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(regionDTO));
}
/**
* DELETE /regions/:id : delete the "id" region.
*
* @param id the id of the regionDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/regions/{id}")
@Timed
public ResponseEntity<Void> deleteRegion(@PathVariable Long id) {
log.debug("REST request to delete Region : {}", id);
regionService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}
| [
"paulstavropoulos@gmail.com"
] | paulstavropoulos@gmail.com |
18d7284fba4d4af33be1d74870542c53b84a1c8b | b1c91b5a1d9adc53c371e845ca0351d8d5b19871 | /src/main/java/org/launchcode/javawebdevtechjobsauthentication/AuthenticationFilter.java | 19662f7eca30dc16aae698491727fc2d05bbb4c6 | [] | no_license | Esha2021/java-web-dev-techjobs-authentication | 9c22bdfcdf29bda31d84a0bf4eb490bef0134ca4 | a0aea337ae2e1506373d15ccd41821a730295779 | refs/heads/master | 2023-09-03T17:09:30.913889 | 2021-10-31T04:46:00 | 2021-10-31T04:46:00 | 422,604,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,918 | java | package org.launchcode.javawebdevtechjobsauthentication;
import org.launchcode.javawebdevtechjobsauthentication.controllers.AuthenticationController;
import org.launchcode.javawebdevtechjobsauthentication.models.User;
import org.launchcode.javawebdevtechjobsauthentication.models.data.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
public class AuthenticationFilter extends HandlerInterceptorAdapter {
@Autowired
UserRepository userRepository;
@Autowired
AuthenticationController authenticationController;
private static final List<String> whitelist = Arrays.asList("/login", "/register", "/logout", "/css");
private static boolean isWhitelisted(String path) {
for (String pathRoot : whitelist) {
if (path.startsWith(pathRoot)) {
return true;
}
}
return false;
}
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response,
Object handler) throws IOException {
// Don't require sign-in for whitelisted pages
if (isWhitelisted(request.getRequestURI())) {
// returning true indicates that the request may proceed
return true;
}
HttpSession session = request.getSession();
User user = authenticationController.getUserFromSession(session);
// The user is logged in
if (user != null) {
return true;
}
// The user is NOT logged in
response.sendRedirect("/login");
return false;
}
}
| [
"eeswaricse@gmail.com"
] | eeswaricse@gmail.com |
b8f6cd3e7c169d7cf8828e76956d2a60d3b78850 | 8557e248859c8805c2e36f524911894f9cf7c7f3 | /src/com/leetcode1/N20.java | 034d40aeceba20611a04c89810c81259e4726158 | [] | no_license | duminqing/leetcode | 93bc5011b91d99941687d42519496923c600cd9c | bd1206b075f01bc4bc728ac8c9e22aff3270031e | refs/heads/master | 2021-06-22T02:26:30.449830 | 2020-12-30T02:07:32 | 2020-12-30T02:07:32 | 175,217,455 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,565 | java | package com.leetcode1;
import java.util.Stack;
public class N20 {
/**
* 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。
* <p>
* 有效字符串需满足:
* <p>
* 左括号必须用相同类型的右括号闭合。
* 左括号必须以正确的顺序闭合。
* 注意空字符串可被认为是有效字符串。
* <p>
* 示例 1:
* <p>
* 输入: "()"
* 输出: true
* 示例 2:
* <p>
* 输入: "()[]{}"
* 输出: true
* 示例 3:
* <p>
* 输入: "(]"
* 输出: false
* 示例 4:
* <p>
* 输入: "([)]"
* 输出: false
* 示例 5:
* <p>
* 输入: "{[]}"
* 输出: true
* <p>
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/valid-parentheses
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public static boolean isValid(String s) {
char[] array = s.toCharArray();
Stack<Character> stack = new Stack<>();
for (char c : array) {
if (!stack.isEmpty() && ((c == ')' && stack.peek() == '(') || (c == ']' && stack.peek() == '[') || (c == '}' && stack.peek() == '{'))) {
stack.pop();
} else {
stack.push(c);
}
}
return stack.isEmpty();
}
public static void main(String[] args) {
System.out.println(isValid("([)]"));
}
}
| [
"duminqing@outlook.com"
] | duminqing@outlook.com |
89980e1e94ddb680085af7361aa5ccb12d36edaf | 2b3208608e9b5ec0f9abb667a550b8f1217e8894 | /FlyweightVisitorPattern/src/wordCount/util/MyLogger.java | e9f013fd5e8a44516d471a9abd057ead7c890c70 | [] | no_license | deshpandekartik/DesignPatterns | 17253292c675cd071cd751eb505860860dcef0c2 | 30aee16dd5553eaa1260b1a66dbd7922ea77b0eb | refs/heads/master | 2020-03-26T22:29:52.595285 | 2018-08-20T19:55:32 | 2018-08-20T19:55:32 | 145,463,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,248 | java | package wordCount.util;
public class MyLogger
{
public static enum DebugLevel { RESULTS, ERROR, CONSTRUCTOR, FILE_PROCESSOR, DEBUG, NONE, INFO
};
private static DebugLevel debugLevel;
public static void setDebugValue (int levelIn) {
switch (levelIn)
{
case 6:
debugLevel = DebugLevel.INFO; break;
case 5:
debugLevel = DebugLevel.DEBUG; break;
case 4:
debugLevel = DebugLevel.ERROR; break;
case 3:
debugLevel = DebugLevel.RESULTS; break;
case 2:
debugLevel = DebugLevel.CONSTRUCTOR; break;
case 1:
debugLevel = DebugLevel.FILE_PROCESSOR; break;
case 0:
debugLevel = DebugLevel.NONE; break;
}
}
public static void setDebugValue (DebugLevel levelIn) {
debugLevel = levelIn;
}
public static void writeMessage (String message ,
DebugLevel levelIn ) {
if (levelIn == debugLevel)
System.out.println(message);
}
public String toString() {
return "The debug level has been set to the following " + debugLevel;
}
};
| [
"kartikdeshpande18@gmail.com"
] | kartikdeshpande18@gmail.com |
0a0fa776e76a17079b16ae4db05bb666cf66d64d | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/17/org/apache/commons/math3/analysis/differentiation/DerivativeStructure_DerivativeStructure_150.java | a9e0a5a11281a30d6a6b2638b5ca1e5d6a922c3d | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 2,769 | java |
org apach common math3 analysi differenti
class repres differenti function
workhors differenti
implement extens rall'
number dan kalman' paper
href http www math american peopl kalman pdffile mmgautodiff pdf doubli
recurs multivari automat differenti mathemat magazin vol
june rall' number extens real number
mathemat express hold deriv
function dan kalman' deriv structur hold partial deriv
order respect number free paramet rall'
number deriv structur order deriv
free paramet real number deriv structur
order deriv free paramet
link deriv structur derivativestructur instanc directli
arithmet oper mathemat function provid
method sin co
implement complex express hand class
tediou error prone task advantag limit
deriv order requir user comput deriv
implement complex express develop comput
code standard primit valu link
univari function differenti univariatefunctiondifferenti differenti creat link
deriv structur derivativestructur base instanc method simpler limit
accuraci deriv order computation intens
typic link finit differ differenti finitedifferencesdifferenti finit differ
differenti
instanc guarante immut
compil dscompil
version
deriv structur derivativestructur field element fieldel deriv structur derivativestructur serializ
linear combin constructor
deriv structur built ds1 ds2 ds3
param scale factor
param ds1 base unscal deriv structur
param scale factor
param ds2 base unscal deriv structur
param scale factor
param ds3 base unscal deriv structur
except dimens mismatch except dimensionmismatchexcept number free paramet order inconsist
deriv structur derivativestructur deriv structur derivativestructur ds1
deriv structur derivativestructur ds2
deriv structur derivativestructur ds3
dimens mismatch except dimensionmismatchexcept
ds1 compil
compil check compat checkcompat ds2 compil
compil check compat checkcompat ds3 compil
compil linear combin linearcombin ds1 data ds2 data ds3 data data
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
9437df0a5a9a307ab7bec45b94a1d45b77995675 | 684f45abbd1012da80410f174cbf7dc5e8b032ed | /QueueUsingTwoStacks.java | 88087086235d0f1b290569926929ab6d667e2908 | [] | no_license | shreeharshas/DataStructures | d8f38e46378d369bd7d9247600c815cf91f7e0be | ad067f41a1dd76baaf4a7bb40533029e2e754e1b | refs/heads/master | 2021-01-12T04:55:14.022999 | 2017-02-21T04:53:19 | 2017-02-21T04:53:19 | 77,809,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,316 | java | import java.util.Stack;
/**
* @author ShreeHarsha
*
*/
public class QueueUsingTwoStacks {
/**
* private variables
*/
private Stack s1, s2;
private Integer count;
public queueUsingTwoStacks() {
this.s1 = new Stack();
this.s2 = new Stack();
this.count = new Integer(0);
}
public int size(){
return this.count.intValue();
}
public void append(int x){
if(s2.isEmpty()){
this.s1.push(new Integer(x));
}
else{
while(!this.s2.isEmpty()){//for(int i=0;i<s2.size(); i++)
s1.push(s2.pop());
}
s1.push(new Integer(x));
}
int z = this.count.intValue();
this.count = new Integer(++z);
}
public Integer extract(){
int z = this.count.intValue();
this.count = new Integer(--z);
if(!this.s1.isEmpty()){
while(!this.s1.isEmpty()){
s2.push(s1.pop());
}
Integer temp = (Integer) s2.pop();
return temp;
//return (Integer)this.s2.pop();
}
else{
if(this.s2.size()>0){
Integer temp = (Integer) this.s2.pop();
return temp;
}
return null;
}
/*return null;*/
}
private void disp(){
if(s2.isEmpty()){
System.out.println("Queue Empty");
}
else{
Stack tempDisplay = new Stack();
while(!this.s2.isEmpty()){
Integer intg = (Integer)s2.pop();
System.out.println(intg);
tempDisplay.push(intg);
s1.push(intg);
}
}
}
public void display(){
System.out.println("Size: " + this.size()+"\nContents:");
if(this.s1.isEmpty())
this.disp();
else{
while(!this.s1.isEmpty()){
s2.push(s1.pop());
}
this.disp();
}
System.out.println("");
}
/**
* program start
*/
public static void main(String[] args) {
queueUsingTwoStacks q = new queueUsingTwoStacks();
q.append(10);
q.append(14);
q.append(13);
q.append(1700);
q.append(1650);
q.append(67);
q.append(99);
q.append(787);
q.append(-456);
q.display();
System.out.println(q.extract());
System.out.println(q.extract());
System.out.println(q.extract());
System.out.println(q.extract());
System.out.println(q.extract());
System.out.println(q.extract());
System.out.println(q.extract());
System.out.println(q.extract());
System.out.println(q.extract());
q.append(77777);
q.append(88888);
q.display();
q.extract();
q.display();
q.extract();
q.display();
}
}
| [
"noreply@github.com"
] | shreeharshas.noreply@github.com |
b8a2cfa6e43833783fdef47f03b8d9bfbe8d7f39 | c66c364506d50116b2d89083296b4f6da8df2c40 | /src/java/dao/DaoImplClient.java | 0f364fa2f0b1e9fa28fb279f79522f48d6368215 | [] | no_license | saidfeddaoui/PFE | d37f846792fc39e27fc9fd890f6922e38f797709 | c3c8886621eb844ad56e79137dfb1748dc2317f2 | refs/heads/master | 2020-12-02T05:25:46.030831 | 2017-07-12T16:24:57 | 2017-07-12T16:24:57 | 96,903,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,396 | 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 dao;
import model.Client;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import util.SessionFactoryUtile;
/**
*
* @author HP
*/
public class DaoImplClient implements IDaoClient{
@Override
public List<Client> list_clients() {
SessionFactory sf=SessionFactoryUtile.getSessf();
Transaction tx = null;
List<Client> clients = null;
try {
System.out.println("debut");
Session s=sf.openSession();
tx=s.beginTransaction();
Query query= s.createQuery("from Client");
clients=query.list();
tx.commit();
//r=true;
System.out.println("out");
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
tx.rollback();
}
finally {
sf.close();
//Connexion_manager.getInstance().fermerconnection(c);
}
return clients;
}
@Override
public Client ajout_client(Client client) {
SessionFactory sf=SessionFactoryUtile.getSessf();
Transaction tx = null;
try {
//System.out.println("Test action add !!");
System.out.println("debut");
Session s=sf.openSession();
tx=s.beginTransaction();
s.save(client);
tx.commit();
System.out.println("out");
} catch (Exception e) {
//e.printStackTrace();
// TODO: handle exception
tx.rollback();
}
finally {
sf.close();
//Connexion_manager.getInstance().fermerconnection(c);
}
return client;
}
@Override
public Client modifier_client(Client client) {
SessionFactory sf=SessionFactoryUtile.getSessf();
Transaction tx = null;
Client c1=null;
try {
System.out.println("debut");
Session s=sf.openSession();
c1=(Client)s.get(Client.class, client.getId_clt());
//User u1=new User(u.getId());
//System.out.println(u.getNom());
c1.setAdresse_clt(client.getAdresse_clt());
c1.setNom_clt(client.getNom_clt());
c1.setFax_clt(client.getFax_clt());
c1.setMail_clt(client.getMail_clt());
c1.setRc_clt(client.getRc_clt());
c1.setTel1_clt(client.getTel1_clt());
c1.setTel_clt(client.getTel_clt());
c1.setVille_clt(client.getVille_clt());
tx=s.beginTransaction();
s.update(c1);
tx.commit();
System.out.println("out");
} catch (Exception e) {
//e.printStackTrace();
// TODO: handle exception
tx.rollback();
}
finally {
sf.close();
}
return c1;
}
@Override
public boolean supprimer_client(int id) {
SessionFactory sf=SessionFactoryUtile.getSessf();
Transaction tx = null;
boolean bool=false;
try {
//System.out.println("Test action add !!");
System.out.println("debut");
Session s=sf.openSession();
tx=s.beginTransaction();
Client c = (Client)s.get(Client.class, id);
if(c != null){
s.delete(c);
}
tx.commit();
System.out.println("out");
} catch (Exception e) {
//e.printStackTrace();
// TODO: handle exception
tx.rollback();
}
finally {
bool=true;
sf.close();
//Connexion_manager.getInstance().fermerconnection(c);
}
return bool;
}
@Override
public List<Client> rechercher_client(String cle) {
SessionFactory sf=SessionFactoryUtile.getSessf();
Transaction tx = null;
List<Client> lc = null;
try {
System.out.println("debut");
Session s=sf.openSession();
tx=s.beginTransaction();
Query query= s.createQuery("From Client where code='"+cle+"' or societe_nom='"+cle+"' or forme_juridique='"+cle+"' or ville='"+cle+"' or tel='"+cle+"' or fax='"+cle+"'");
lc=query.list();
tx.commit();
System.out.println("out");
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
tx.rollback();
}
finally {
sf.close();
}
return lc;
}
@Override
public Client client_by_id(int id) {
SessionFactory sf=SessionFactoryUtile.getSessf();
Transaction tx = null;
Client client=null;
try {
System.out.println("debut");
Session s=sf.openSession();
tx=s.beginTransaction();
Client c = (Client)s.get(Client.class, id);
if(c != null){
client=c;
}
tx.commit();
System.out.println("out");
} catch (Exception e) {
e.printStackTrace();
tx.rollback();
}
finally {
sf.close();
}
return client;
}
}
| [
"said@said-PC.apef.com"
] | said@said-PC.apef.com |
51e50cb4d8eff160f44c9b4f09b13a4fc59efdd4 | a4e2c46af3c52b48b7ba55eba87efdc046e1aca2 | /movie-on/src/main/java/edu/asu/websemantics/controller/TrendsController.java | 5b874bc5fc1fffdffb4358db9591244325a6bb6c | [] | no_license | rathnakar14/MovieOnApp | 669e50c0d1f23f951619a3a1928e2d6c1eedae7d | 31dc02311e51a98b40d7e365721e96ea67c42b45 | refs/heads/master | 2021-01-10T04:59:28.450475 | 2016-01-03T03:01:44 | 2016-01-03T03:01:44 | 48,931,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,028 | java | package edu.asu.websemantics.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import edu.asu.websemantics.model.MovieDetails;
import edu.asu.websemantics.service.IMDBService;
@Controller
public class TrendsController {
@Autowired
private IMDBService imdbService;
private static List<MovieDetails> horrorList;
private static List<MovieDetails> actionList;
private static List<MovieDetails> comedyList;
private static List<MovieDetails> adventureList;
private static List<MovieDetails> animationList;
@RequestMapping(value = "/trends", method = RequestMethod.GET)
public ModelAndView getTrends() throws IOException {
ModelAndView model = new ModelAndView();
if (horrorList == null) {
horrorList = imdbService.getMovieDetails(new ArrayList<String>() {
{
add("Horror");
}
});
}
if (actionList == null) {
actionList = imdbService.getMovieDetails(new ArrayList<String>() {
{
add("Action");
}
});
}
if (comedyList == null) {
comedyList = imdbService.getMovieDetails(new ArrayList<String>() {
{
add("Comedy");
}
});
}
if (adventureList == null) {
adventureList = imdbService.getMovieDetails(new ArrayList<String>() {
{
add("Adventure");
}
});
}
if (animationList == null) {
animationList = imdbService.getMovieDetails(new ArrayList<String>() {
{
add("Animation");
}
});
}
model.addObject("horrorList", horrorList);
model.addObject("actionList", actionList);
model.addObject("animationList", animationList);
model.addObject("adventureList", adventureList);
model.addObject("comedyList", comedyList);
model.setViewName("movietrends");
return model;
}
}
| [
"rathnakar.kallamadi@gmail.com"
] | rathnakar.kallamadi@gmail.com |
d2530f1dad4d0b2c3026fb8c9f7ad3d2330980c5 | 94f6ec2718721f2b23a6eeec634d90d84f3145fc | /src/beanpojo/V_analysis_jtgx.java | 7b06b0105d0beb3b604514adec15434e2a04dbc0 | [] | no_license | hzzgit/hzzgit-Personnelrelationship_neo4j | 5942d1cfce510f41074ec3f5cec539221da8c0e8 | 48ba50277f9de8f96802946d92457302b2302402 | refs/heads/master | 2020-08-08T17:24:43.852955 | 2019-10-09T09:35:12 | 2019-10-09T09:35:12 | 213,877,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,661 | java | package beanpojo;
/**
* 家庭关系类
* @author Administrator
*
*/
public class V_analysis_jtgx {
private String hu_id;
private String hu_id_new;
private String master_relation;
private String name;
private String pid;
private String gender;
private String fa_person_id;
private String fa_pid;
private String fa_name;
private String ma_person_id;
private String ma_pid;
private String ma_name;
private String po_person_id;
private String po_pid;
private String po_name;
private String gurardian_1_id;
private String gurardian_1_pid;
private String gurardian_1;
private String wardship_1;
private String gurardian_2_id;
private String gurardian_2_pid;
private String gurardian_2;
private String wardship_2;
private String dob;
private String nation;
private String native_place;
private String when_operated;
public String getWhen_operated() {
return when_operated;
}
public void setWhen_operated(String when_operated) {
this.when_operated = when_operated;
}
public String getHu_id() {
return hu_id;
}
public void setHu_id(String hu_id) {
this.hu_id = hu_id;
}
public String getHu_id_new() {
return hu_id_new;
}
public void setHu_id_new(String hu_id_new) {
this.hu_id_new = hu_id_new;
}
public String getMaster_relation() {
return master_relation;
}
public void setMaster_relation(String master_relation) {
this.master_relation = master_relation;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getFa_person_id() {
return fa_person_id;
}
public void setFa_person_id(String fa_person_id) {
this.fa_person_id = fa_person_id;
}
public String getFa_pid() {
return fa_pid;
}
public void setFa_pid(String fa_pid) {
this.fa_pid = fa_pid;
}
public String getFa_name() {
return fa_name;
}
public void setFa_name(String fa_name) {
this.fa_name = fa_name;
}
public String getMa_person_id() {
return ma_person_id;
}
public void setMa_person_id(String ma_person_id) {
this.ma_person_id = ma_person_id;
}
public String getMa_pid() {
return ma_pid;
}
public void setMa_pid(String ma_pid) {
this.ma_pid = ma_pid;
}
public String getMa_name() {
return ma_name;
}
public void setMa_name(String ma_name) {
this.ma_name = ma_name;
}
public String getPo_person_id() {
return po_person_id;
}
public void setPo_person_id(String po_person_id) {
this.po_person_id = po_person_id;
}
public String getPo_pid() {
return po_pid;
}
public void setPo_pid(String po_pid) {
this.po_pid = po_pid;
}
public String getPo_name() {
return po_name;
}
public void setPo_name(String po_name) {
this.po_name = po_name;
}
public String getGurardian_1_id() {
return gurardian_1_id;
}
public void setGurardian_1_id(String gurardian_1_id) {
this.gurardian_1_id = gurardian_1_id;
}
public String getGurardian_1_pid() {
return gurardian_1_pid;
}
public void setGurardian_1_pid(String gurardian_1_pid) {
this.gurardian_1_pid = gurardian_1_pid;
}
public String getGurardian_1() {
return gurardian_1;
}
public void setGurardian_1(String gurardian_1) {
this.gurardian_1 = gurardian_1;
}
public String getWardship_1() {
return wardship_1;
}
public void setWardship_1(String wardship_1) {
this.wardship_1 = wardship_1;
}
public String getGurardian_2_id() {
return gurardian_2_id;
}
public void setGurardian_2_id(String gurardian_2_id) {
this.gurardian_2_id = gurardian_2_id;
}
public String getGurardian_2_pid() {
return gurardian_2_pid;
}
public void setGurardian_2_pid(String gurardian_2_pid) {
this.gurardian_2_pid = gurardian_2_pid;
}
public String getGurardian_2() {
return gurardian_2;
}
public void setGurardian_2(String gurardian_2) {
this.gurardian_2 = gurardian_2;
}
public String getWardship_2() {
return wardship_2;
}
public void setWardship_2(String wardship_2) {
this.wardship_2 = wardship_2;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation;
}
public String getNative_place() {
return native_place;
}
public void setNative_place(String native_place) {
this.native_place = native_place;
}
@Override
public String toString() {
return "V_analysis_jtgx [hu_id=" + hu_id + ", hu_id_new=" + hu_id_new
+ ", master_relation=" + master_relation + ", name=" + name
+ ", pid=" + pid + ", gender=" + gender + ", fa_person_id="
+ fa_person_id + ", fa_pid=" + fa_pid + ", fa_name=" + fa_name
+ ", ma_person_id=" + ma_person_id + ", ma_pid=" + ma_pid
+ ", ma_name=" + ma_name + ", po_person_id=" + po_person_id
+ ", po_pid=" + po_pid + ", po_name=" + po_name
+ ", gurardian_1_id=" + gurardian_1_id + ", gurardian_1_pid="
+ gurardian_1_pid + ", gurardian_1=" + gurardian_1
+ ", wardship_1=" + wardship_1 + ", gurardian_2_id="
+ gurardian_2_id + ", gurardian_2_pid=" + gurardian_2_pid
+ ", gurardian_2=" + gurardian_2 + ", wardship_2=" + wardship_2
+ ", dob=" + dob + ", nation=" + nation + ", native_place="
+ native_place + "]";
}
}
| [
"605198347@qq.com"
] | 605198347@qq.com |
cbd8cb2a0406fadbafbbaee4bbd6737b8e0298bb | 627c2dfbea1896657f971ad06545eb4b3060b64b | /masters/src/main/java/uni/fmi/masters/beans/TFTStatsBean.java | 5b0452f4ae28850107e5767589d666e06083da3f | [] | no_license | determinedslav/TFTViewer | 2f20877c407e53769734d07954bc2896f3513aa7 | ae0e092f1db8a0ab0981144d9319b4598905b9ce | refs/heads/master | 2020-12-10T17:39:52.195860 | 2020-01-15T12:27:11 | 2020-01-15T12:27:11 | 233,663,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,516 | java | package uni.fmi.masters.beans;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "tftstats")
public class TFTStatsBean {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column (name = "summonerRegion", nullable = false, length = 30)
private String summonerRegion;
@Column (name = "summonerName", nullable = false, length = 30)
private String summonerName;
@Column (name = "rank", nullable = false, length = 20)
private String rank;
@Column (name = "division", nullable = false, length = 10)
private String division;
@Column (name = "wins", nullable = false, length = 10)
private int wins;
@Column (name = "lp", nullable = false, length = 10)
private int lp;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "user_id")
private UserBean user;
public TFTStatsBean() {
}
public TFTStatsBean(String summonerRegion, String summonerName, String rank, String division, int wins, int lp, UserBean user) {
this.summonerRegion = summonerRegion;
this.summonerName = summonerName;
this.rank = rank;
this.division = division;
this.wins = wins;
this.lp = lp;
this.user = user;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSummonerRegion() {
return summonerRegion;
}
public void setSummonerRegion(String summonerRegion) {
this.summonerRegion = summonerRegion;
}
public String getSummonerName() {
return summonerName;
}
public void setSummonerName(String summonerName) {
this.summonerName = summonerName;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
public String getDivision() {
return division;
}
public void setDivision(String division) {
this.division = division;
}
public int getWins() {
return wins;
}
public void setWins(int wins) {
this.wins = wins;
}
public int getLp() {
return lp;
}
public void setLp(int lp) {
this.lp = lp;
}
public UserBean getUser() {
return user;
}
public void setUser(UserBean user) {
this.user = user;
}
}
| [
"noreply@github.com"
] | determinedslav.noreply@github.com |
4ff52f6d67feec6890e90fd209c9b5d6ff13de0e | e58a8e0fb0cfc7b9a05f43e38f1d01a4d8d8cf1f | /MazeMode/src/com/puttysoftware/mazemode/objects/Exit.java | 400bf10976f71f756a9b09260c56bd0085d74c54 | [
"Unlicense"
] | permissive | retropipes/older-java-games | 777574e222f30a1dffe7936ed08c8bfeb23a21ba | 786b0c165d800c49ab9977a34ec17286797c4589 | refs/heads/master | 2023-04-12T14:28:25.525259 | 2021-05-15T13:03:54 | 2021-05-15T13:03:54 | 235,693,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,269 | java | /* MazeMode: A Maze-Solving Game
Copyright (C) 2008-2010 Eric Ahnell
Any questions should be directed to the author via email at: products@puttysoftware.com
*/
package com.puttysoftware.mazemode.objects;
import com.puttysoftware.mazemode.Application;
import com.puttysoftware.mazemode.MazeMode;
import com.puttysoftware.mazemode.game.ObjectInventory;
import com.puttysoftware.mazemode.resourcemanagers.SoundConstants;
import com.puttysoftware.mazemode.resourcemanagers.SoundManager;
public class Exit extends FinishTo {
// Constructors
public Exit() {
super();
}
// Scriptability
@Override
public void postMoveAction(final boolean ie, final int dirX, final int dirY,
final ObjectInventory inv) {
final Application app = MazeMode.getApplication();
SoundManager.playSound(SoundConstants.SOUND_CATEGORY_SOLVING_MAZE,
SoundConstants.SOUND_DOWN);
app.getGameManager().goToLevel(this.getDestinationLevel());
}
@Override
public String getName() {
return "Exit";
}
@Override
public String getPluralName() {
return "Exits";
}
@Override
public String getDescription() {
return "Exits send you outside when walked on.";
}
} | [
"eric.ahnell@puttysoftware.com"
] | eric.ahnell@puttysoftware.com |
5c35d523284054c872787c9d979d8b5279189e4b | 5eae683a6df0c4b97ab1ebcd4724a4bf062c1889 | /bin/ext-accelerator/b2bpunchout/src/de/hybris/platform/b2b/punchout/PunchOutException.java | 87d03dacd6bb0b2645f1baa21a287a35d7c26e7a | [] | no_license | sujanrimal/GiftCardProject | 1c5e8fe494e5c59cca58bbc76a755b1b0c0333bb | e0398eec9f4ec436d20764898a0255f32aac3d0c | refs/heads/master | 2020-12-11T18:05:17.413472 | 2020-01-17T18:23:44 | 2020-01-17T18:23:44 | 233,911,127 | 0 | 0 | null | 2020-06-18T15:26:11 | 2020-01-14T18:44:18 | null | UTF-8 | Java | false | false | 984 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.b2b.punchout;
/**
* Business exception representing PunchOut issues
*/
public class PunchOutException extends RuntimeException
{
public static final String PUNCHOUT_EXCEPTION_MESSAGE = "PunchOut Exception";
private final String errorCode;
public PunchOutException(final String errorCode, final String message)
{
this(errorCode, message, null);
}
public PunchOutException(final String errorCode, final String message, final Throwable cause)
{
super(message, cause);
this.errorCode = errorCode;
}
public String getErrorCode()
{
return errorCode;
}
}
| [
"travis.d.crawford@accenture.com"
] | travis.d.crawford@accenture.com |
73e648eda7198bd76af52f3c6b915dff1648f368 | 024d66dea20fc5252ab3b3dcaa9b8188073b14fd | /game/src/main/java/com/game/logic/player/domain/PlayerSkill.java | 36dd3673b2f88fdb9e42a8306327557bf8177c2d | [] | no_license | ruigame/GameServer | 4b4ca17cbbd73af92f1f368647bc3a9c96c9e47e | 694c5f1505a370b4ccfee4c5bbc160ab757e48d2 | refs/heads/master | 2023-02-28T01:55:54.327972 | 2021-02-04T07:19:52 | 2021-02-04T07:19:52 | 330,602,083 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,193 | java | package com.game.logic.player.domain;
import com.game.framework.JSONUtils;
import com.game.framework.TypeReference;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: liguorui
* @Date: 2021/1/18 下午11:51
*/
public class PlayerSkill {
private Map<Integer, Map<Integer, Skill>> skillMap = new HashMap<>();
public PlayerSkill() {
}
public PlayerSkill(Map<Integer, Map<Integer, Skill>> skillMap) {
super();
this.skillMap = skillMap;
if (this.skillMap == null) {
this.skillMap = Maps.newHashMap();
}
}
public PlayerSkill(String skill) {
super();
if (StringUtils.isNotBlank(skill)) {
this.skillMap = JSONUtils.toObject(skill, TypeReference.MAP_SKILL);
}
}
public Skill getSkill(int index, int skillId) {
Map<Integer, Skill> skills = getSkillMap(index);
return skills.get(skillId);
}
public Map<Integer, Skill> getSkillMap(int index) {
Map<Integer, Skill> map = skillMap.get(index);
if (map == null) {
map = Maps.newHashMap();
skillMap.put(index, map);
}
return map;
}
public Skill getMinSkillLevel(int index) {
int minLevel = 0;
Skill minSKill = null;
for (Skill skill : getSkillMap(index).values()) {
if (minLevel == 0 || minLevel > skill.getLevel()) {
minLevel = skill.getLevel();
minSKill = skill;
}
}
return minSKill;
}
public Map<Integer, Map<Integer, Skill>> getAllSkillMap() {
return skillMap;
}
public Skill addSkill(int index, int skillId) {
Map<Integer, Skill> skills = getSkillMap(index);
if (skills.containsKey(skillId)) {
return null;
}
Skill skill = new Skill(skillId, 1);
skills.put(skillId, skill);
return skill;
}
public boolean containsSkill(int index, int skillId) {
Map<Integer, Skill> skills = getSkillMap(index);
return skills.containsKey(skillId);
}
}
| [
"46314777@qq.com"
] | 46314777@qq.com |
1d1020d3d092b05a83543d8deb866f55e924736f | d106875e56999185d42e31dbf433d96ffb9aff72 | /app/src/main/java/com/begoat/newsapp/retrofit/RetrofitClient.java | 71b90365e9e6b4180d91790ebd9863c016daada2 | [] | no_license | rongbangye/Android-News-App | 190fb3a47aefa1214c14568fdb11977da83a1430 | 3e0a4ead83c19032c7701586112c7f01f8a0265c | refs/heads/master | 2022-08-10T01:46:22.534441 | 2020-05-19T07:14:33 | 2020-05-19T07:14:33 | 265,166,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package com.begoat.newsapp.retrofit;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitClient {
private static String BASE_URL = "https://newsapi.org/v2/"; //top-headlines?sources=techcrunch&apiKey=API_KEY
private static Retrofit retrofit = null;
public static Retrofit getRetrofit() {
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(getHttpClient())
.build();
}
return retrofit;
}
public static OkHttpClient getHttpClient() {
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS);
return builder.build();
}
}
| [
"rongbang.ye@gmail.com"
] | rongbang.ye@gmail.com |
e1051f7beca0142149e073c0f2b236a6c811090a | 9953f561e5377c10ec18ee36f4e86cf11bb9dcd5 | /app/src/main/java/com/jularic/dominik/recreationassistant/YouTube.java | 1b94a19da05d77f5e6576bb1acd60e96fa7de52e | [] | no_license | adrianzgaljic/RecreationAssistant | 2ae73ef39da1e42099324319598908bc65fe6404 | 91fc75af8e9bfc30ac290216067c9515be61fd62 | refs/heads/master | 2021-01-11T10:46:17.931533 | 2017-01-16T08:43:05 | 2017-01-16T08:43:05 | 79,100,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.jularic.dominik.recreationassistant;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
public class YouTube extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_youtube);
WebView webView = (WebView) findViewById(R.id.wv_youtube);
webView.loadUrl("https://www.youtube.com");
}
}
| [
"jularic.dominik@gmail.com"
] | jularic.dominik@gmail.com |
af933120e09b19b7b31bc4ce5d0aff39c6ceebf0 | 52ce6f25203cd884b7697b9fcff9b2e2ecb08755 | /src/test/java/com/example/kafkademo/KafkademoApplicationTests.java | 17e50cf0245b4186afd965572c15ebe7cd772497 | [] | no_license | amolmande26-code/kafkademo | 0e176c746859f207378a9fac0d5c36a059f516e6 | d6788ef9ecb7aa1e4d29ee1a0eefc1280ff97d97 | refs/heads/master | 2022-11-14T05:11:32.175938 | 2020-07-03T02:53:47 | 2020-07-03T02:53:47 | 276,791,022 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | /*
package com.example.kafkademo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class KafkademoApplicationTests {
@Test
void contextLoads() {
}
}
*/
| [
"amol.mande@amdocs.com"
] | amol.mande@amdocs.com |
c5862840a957f1751285acc094b4fb8f82d7282a | 7521eaca7fed5785d3ce48ca5dce7e412161bf8e | /src/java/controller/CadastrarCursoController.java | ef5aeb0a6210a1a4bbd287488c1ff49788c3b5a8 | [] | no_license | RosiFlores/SCP | dbce15f7b9f0b1d1e3fc55935d1fe9bf49b3f0bb | ae1d652c0d5bda66e666265f4f0769db5df8a000 | refs/heads/master | 2021-01-20T21:59:10.024622 | 2014-10-02T12:51:15 | 2014-10-02T12:51:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,476 | java | package controller;
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;
/**
*
* @author Angelo
*/
public class CadastrarCursoController extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet CadastrarCurso</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet CadastrarCurso at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"contato.angelomendes@gmail.com"
] | contato.angelomendes@gmail.com |
1c7aa09e8e98e4aec5c7aecd3d7596b990c4c928 | 89482948d78aaea3effca1367b1d6a4ace062f9b | /old/src/core/Traceable.java | f43f9b2ead6210e39f1c1aac6543c6a956871af3 | [] | no_license | w00tzenheimer/ccl-2 | e453edf09d25bbf3cbdca7a1e2e48612dccc0be4 | 14eb4835abc48162bb1088c700553762333588fc | refs/heads/master | 2021-06-03T02:57:53.956633 | 2016-04-16T19:30:50 | 2016-04-16T19:30:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89 | java | package com.ccl.core;
public interface Traceable {
public String getTraceMessage();
}
| [
"math4tots@gmail.com"
] | math4tots@gmail.com |
0b71bf9e195c47580be1210c3e7dad60a4eec179 | f5dad0aeebb75cd591d76282b265c687babaa0b9 | /src/main/java/nl/highway/iungomain/Controllers/SystemController.java | e405dfb9e295d37837eb5e3ce8046c540dd46741 | [] | no_license | Suwappertjes/SpringSample | e5e02dba8e76e11dbe29538d42b8628deeb4988a | 7c676c59dbfe1dc678a01de685103a35ff11d3f3 | refs/heads/master | 2020-06-03T19:52:26.055666 | 2019-06-13T07:46:58 | 2019-06-13T07:46:58 | 191,710,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package nl.highway.iungomain.Controllers;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import java.net.HttpURLConnection;
import java.net.URL;
@RestController
@RequestMapping(path = "/iungo/system")
public class SystemController {
@Value("${spring.application.version}")
private String version;
@RequestMapping
public String index() {
return "Iungo backend is up and running. Use /ping and /version for more information";
}
@RequestMapping(path="/ping")
public String ping() {
String status1 = getStatus("https://www.google.com");
String status2 = getStatus("http://www.google.com");
return String.format("Google https is: %s and Google http is: %s.", status1, status2);
}
@RequestMapping(path="/version")
public String version(){
return version;
}
public static String getStatus(String url){
String result = "";
try {
URL urlObj = new URL(url);
HttpURLConnection con = (HttpURLConnection) urlObj.openConnection();
con.setRequestMethod("GET");
// Set connection timeout
con.setConnectTimeout(3000);
con.connect();
int code = con.getResponseCode();
if (code == 200) {
result = "On";
}
} catch (Exception e) {
result = "Off";
}
return result;
}
} | [
"bramblaauwendraad@gmail.com"
] | bramblaauwendraad@gmail.com |
0b87e192f6d016a317d6ee7a97830d1f45962370 | fefcda2fc791fe0b7d6d3966f4f399e2fd90bb74 | /TextAnalysis/src/langanal/word/processing/WordProcessing.java | 679fa7d169a8289a8f7a68f95e981f2f7894247c | [] | no_license | Tytynguyen/nwapw-english-analysis | 376ee72f6111547a684003f2fdf14897ecf665a2 | be0c6e7c1d15199366d976b4f84083c17674697c | refs/heads/master | 2021-01-17T20:42:56.208284 | 2016-08-05T19:59:22 | 2016-08-05T19:59:22 | 64,153,776 | 3 | 0 | null | 2016-08-11T20:14:13 | 2016-07-25T17:20:03 | Java | UTF-8 | Java | false | false | 6,664 | java | package langanal.word.processing;
import java.util.ArrayList;
import java.util.LinkedList;
import langanal.word.base.Word;
import langanal.word.base.WordInfo;
public class WordProcessing {
//Weights
public static float definitionWeight = .5f;
public static float POSWeight = 0.2f;
public static float synonymWeight = 1;
public static float antonymWeight = 1;
public static boolean debugging = false;
private static String[] commonWords =
new String[]{
"the", "be", "to", "of", "and", "a", "in","that", "have", "i","it","for","not","not","on","with",
"or", "is"
};
/**
* Compares, processes, and returns the relevancy of the two words
*
* @param word1
* @param word2
* @return The % relevancy
*/
public static float compareWords(String word1, String word2){
float relevancy = 0; //in %
//Stores the words with the same spelling into one LinkedList
LinkedList<Word> allWord1 = new LinkedList<Word>();
LinkedList<Word> allWord2 = new LinkedList<Word>();
allWord1 = WordInfo.getFullInfoWords(word1);
allWord2 = WordInfo.getFullInfoWords(word2);
if(allWord1.size() != 0 && allWord2.size() != 0){
for(Word curWord1 : allWord1){
for(Word curWord2 : allWord2){
float definitionValue = checkDefinition(curWord1, curWord2)*definitionWeight;
float POSValue = checkPOS(curWord1, curWord2)*POSWeight;
float synonymValue = checkSynonyms(curWord1,curWord2)*synonymWeight;
float antonymValue = checkAntonyms(curWord1,curWord2)*antonymWeight;
if(debugging){
System.out.println("Compare:");
System.out.println("\tdefinition: " + definitionValue);
System.out.println("\tPOS: " + POSValue);
System.out.println("\tsynonym: " + synonymValue);
System.out.println("\tantonym: " + antonymValue);
}
relevancy += (definitionValue + POSValue + synonymValue + antonymValue);
}
}
/*
* Plots the rough weighted data from before on a sigmoid function.
* This is used to transfer the earlier rough numbers into a percentage number
*/
relevancy = (float) (200*(1/(1+Math.pow(Math.E,-(relevancy/5)))-0.5));
}else{
System.err.println("ERROR: One of the words was not found in the dictionary or thesaurus. Check your spelling.");
}
return relevancy;
}
/**
* Counts the repetition of words in each definition
*
* @param word1
* @param word2
* @return The number of repetitions
*/
public static int checkDefinition(Word word1, Word word2){
ArrayList<String> definitionWords1 = new ArrayList<String>();
ArrayList<String> definitionWords2 = new ArrayList<String>();
int definitionRepeats = 0;
//Fills definitionWords1
for(String fullDefW1 : word1.getDefinitions()){
ArrayList<String> defWordList1 = definitionToWords(fullDefW1);
for(String curWord : defWordList1){
definitionWords1.add(curWord);
}
}
//Fills definitionWords2
for(String fullDefW2 : word2.getDefinitions()){
ArrayList<String> defWordList2 = definitionToWords(fullDefW2);
for(String curWord : defWordList2){
definitionWords2.add(curWord);
}
}
//Clears common words
for(int i = 0;i<definitionWords1.size();i++){
}
//Checks for repetitions
for(String persistWord : definitionWords1){
for(String checkingWord : definitionWords2){
if(persistWord.equals(checkingWord)){
if(!isCommonWord(persistWord)){
definitionRepeats++;
}
}
}
}
return definitionRepeats;
}
/**
* Returns an ArrayList of words that are formatted for checkDefinition()
* @param definition
* @return
*/
private static ArrayList<String> definitionToWords(String definition){
ArrayList<String> returnList = new ArrayList<String>();
for(String word : definition.replaceAll("[^a-zA-Z ]", "").toLowerCase().trim().split(" ")){
returnList.add(word.trim());
}
return returnList;
}
/**
* Determines whether the inputted word is a common one
*
* @param word
* @return Boolean whether the inputted word is a common word
*/
private static Boolean isCommonWord(String word){
boolean isIn = false;
for(String s : commonWords){
if(word.equals(s)){
isIn = true;
}
}
return isIn;
}
/**
* Checks to see if the POS is the same between two words
*
* @param word1
* @param word2
* @return 1 if they share the same POS, 0 if they do not share the same POS
*/
public static int checkPOS(Word word1, Word word2){
if(word1.getPOS().equals(word2.getPOS())){
return 1;
}else{
return 0;
}
}
/**
* Checks to see if two words share any synonyms
* @param word1
* @param word2
* @return The # of shared synonyms
*/
public static int checkSynonyms(Word word1, Word word2){
ArrayList<String> synonymsWord1 = new ArrayList<String>(word1.getSynonyms().size());
ArrayList<String> synonymsWord2 = new ArrayList<String>(word2.getSynonyms().size());
int repeatedSynonyms = 0; //holds the # of repeated pairs of similarity words
for(String s : splitThesaurusWords(word1.getSynonyms())){
synonymsWord1.add(s);
}
for(String s : splitThesaurusWords(word2.getSynonyms())){
synonymsWord2.add(s);
}
for(String curSynonymWord1 : synonymsWord1){
for(String curSynonymWord2 : synonymsWord2) {
if(curSynonymWord1.equals(curSynonymWord2)){
repeatedSynonyms++;
}
}
}
return repeatedSynonyms;
}
/**
* Checks to see if two words share any antonyms
* @param word1
* @param word2
* @return The # of shared antonyms
*/
public static int checkAntonyms(Word word1, Word word2){
ArrayList<String> antonymsWord1 = new ArrayList<String>(word1.getAntonyms().size());
ArrayList<String> antonymsWord2 = new ArrayList<String>(word2.getAntonyms().size());
int repeatedAntonyms = 0; //holds the # of repeated pairs of similarity words
for(String s : splitThesaurusWords(word1.getAntonyms())){
antonymsWord1.add(s);
}
for(String s : splitThesaurusWords(word2.getAntonyms())){
antonymsWord2.add(s);
}
for(String curWord1 : antonymsWord1){
for(String curWord2 : antonymsWord2) {
if(curWord1.equals(curWord2)){
repeatedAntonyms++;
}
}
}
return repeatedAntonyms;
}
/**
* Splits the words in input linkedlist by spaces, meaning that
* each item in the returned linkedlist is one word.
* @param list
* @return cleaned and formatted list. Each object is a single word with no spaces
*/
private static ArrayList<String> splitThesaurusWords(LinkedList<String> list){
ArrayList<String> returnList = new ArrayList<String>();
for(String s : list){
for(String x : s.split(" ")){
returnList.add(x);
}
}
return returnList;
}
}
| [
"tytynguyens2000@yahoo.com"
] | tytynguyens2000@yahoo.com |
0ddcf90c4a0b8d7ee66a14365c752da9ae1846cd | 0967082328c0ae2a41a086b4912b4ebae95b5fb4 | /material-web/src/main/java/com/dongyu/company/web/order/form/ExportOrderQueryForm.java | 161c7fbc10a6f173c34c4cc837ef684699a6cc58 | [] | no_license | yuefantang/material-manage | 7f96613b8469dc890da4aecfe47be40494d3bd70 | 8e1b1f769c79fbc72b27e0a775b93bcc31eb47d2 | refs/heads/master | 2022-10-22T13:36:44.030235 | 2022-09-22T09:50:19 | 2022-09-22T09:50:19 | 157,304,689 | 0 | 0 | null | 2022-06-29T17:03:26 | 2018-11-13T01:57:34 | Java | UTF-8 | Java | false | false | 854 | java | package com.dongyu.company.web.order.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 下单导出查询Form
*
* @author TYF
* @date 2019/1/6
* @since 1.0.0
*/
@Data
@ApiModel("下单导出查询Form")
public class ExportOrderQueryForm {
@ApiModelProperty(value = "DY编号")
private String orderDyCode;
@ApiModelProperty(value = "投产单号")
private String commissioningCode;
@ApiModelProperty(value = "是否完成状态(0:未完成,1:完成)")
private Integer completeState;
@ApiModelProperty(value = "订单是否删除(0:未删除,1:已删除),默认0")
private Integer deleted;
@ApiModelProperty("收费开单(0:未收费开单,1:已收费开单)默认0")
private Integer chargeOpening;
}
| [
"1603099869@qq.com"
] | 1603099869@qq.com |
951fac482712aeafd52a3f166d2258be1b316571 | 1f965e7efa33a9de076fcf32d93c3f5e3325e639 | /app/src/main/java/simplicity_an/simplicity_an/Tamil/Tamilentertainmentmovies.java | a1aa5bd486c906c036dd224259c767f1449742dd | [] | no_license | SimplesGroup/Simplicity_android | b4c2e090d2dac10a6e1c8017e3db9efef126c3cf | ea7f76bdbc5c8b84dd6e8d1912ba0d2464af953d | refs/heads/master | 2020-04-11T21:38:46.035911 | 2018-12-19T08:39:46 | 2018-12-19T08:39:46 | 162,112,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 137,875 | java | package simplicity_an.simplicity_an.Tamil;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Cache;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.NetworkImageView;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import simplicity_an.simplicity_an.AdvertisementPage;
import simplicity_an.simplicity_an.AppControllers;
import simplicity_an.simplicity_an.Columnsdetailpage;
import simplicity_an.simplicity_an.DividerItemDecoration;
import simplicity_an.simplicity_an.LifestyleDetail;
import simplicity_an.simplicity_an.LikeListFragment;
import simplicity_an.simplicity_an.MusicPlayer.RadioNotificationplayer;
import simplicity_an.simplicity_an.MySingleton;
import simplicity_an.simplicity_an.OnLoadMoreListener;
import simplicity_an.simplicity_an.PhotoStoriesDetail;
import simplicity_an.simplicity_an.R;
import simplicity_an.simplicity_an.RecyclerView_OnClickListener;
import simplicity_an.simplicity_an.SigninpageActivity;
import simplicity_an.simplicity_an.SimplicitySearchview;
import simplicity_an.simplicity_an.Tamil.Activity.AdvertisementPageTamil;
import simplicity_an.simplicity_an.Tamil.Activity.Columnistdetailtamil;
import simplicity_an.simplicity_an.Tamil.Activity.DoitDescriptiontamil;
import simplicity_an.simplicity_an.Tamil.Activity.EducationDescriptiontamil;
import simplicity_an.simplicity_an.Tamil.Activity.Farmingdescriptiontamil;
import simplicity_an.simplicity_an.Tamil.Activity.FoodAndCookDescriptionPagetamil;
import simplicity_an.simplicity_an.Tamil.Activity.Govtdescriptiontamil;
import simplicity_an.simplicity_an.Tamil.Activity.Healthdescriptiontamil;
import simplicity_an.simplicity_an.Tamil.Activity.JobsDetailPagetamil;
import simplicity_an.simplicity_an.Tamil.Activity.ReportNewsOrComplaintsTamil;
import simplicity_an.simplicity_an.Tamil.Activity.ScienceandTechnologyDescriptiontamil;
import simplicity_an.simplicity_an.Tamil.Activity.TamilEventsDescription;
import simplicity_an.simplicity_an.Tamil.Activity.TamilNewsDescription;
import simplicity_an.simplicity_an.Tamil.Activity.TamilSportsnewsDescription;
import simplicity_an.simplicity_an.Tamil.Activity.TipsDescriptionTamil;
import simplicity_an.simplicity_an.Tamil.Activity.TravelsDescriptiontamil;
import simplicity_an.simplicity_an.Utils.Configurl;
import simplicity_an.simplicity_an.Utils.Fonts;
import simplicity_an.simplicity_an.YoutubeVideoPlayer;
/**
* Created by kuppusamy on 10/3/2016.
*/
public class Tamilentertainmentmovies extends Fragment {
RecyclerView recyclerview_tab_all_news;
String URL="http://simpli-city.in/request2.php?rtype=ent_alldatatest&key=simples&qtype=theatre&language=2";
String URLLIKES="http://simpli-city.in/request2.php?rtype=add-liketest&key=simples"; String URLSAVE="http://simpli-city.in/request2.php?rtype=addfav&key=simples";
String URLALL;
RequestQueue requestQueue;
private int requestCount = 1;
JsonObjectRequest jsonReq;
ProgressDialog pdialog;
protected Handler handler;
private final String TAG_REQUEST = "MY_TAG";
SharedPreferences sharedpreferences;
public static final String mypreference = "mypref";
public static final String MYUSERID = "myprofileid";
public static final String backgroundcolor = "color";
public static final String USERID="user_id";
public static final String QID="qid";
public static final String QTYPE="qtype";
public static final String GcmId = "gcmid";
FloatingActionButton fabnews,fabplus;
String myprofileid,colorcodes;
LinearLayoutManager lLayout;
Recyclerviewtaballadapter recyclerview_tab_all_adapter;
List<ItemModel> modelList=new ArrayList<ItemModel>();
private boolean isFragmentLoaded=false;
String Tokenid;
public static final String Activity = "activity";
public static final String CONTENTID = "contentid";
int post_likes_count=0,save_item_count,like_finalvalues;
private Boolean isFabOpen = false;
OnFragmentInteractionListener mListener;
FloatingActionButton fabsearch,fabinnerplus;
private Animation fab_open,fab_close,rotate_forward,rotate_backward;
SwipeRefreshLayout swipeRefresh;
String fontname;
Typeface tf;
public static final String FONT= "font";
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser && !isFragmentLoaded ) {
isFragmentLoaded = true;
Log.e("TAB:","TamilMovies");
}
}
public Tamilentertainmentmovies() {
// Required empty public constructor
// setUserVisibleHint(false);
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.tad_all,container,false);
sharedpreferences = getActivity().getSharedPreferences(mypreference,
Context.MODE_PRIVATE);
if (sharedpreferences.contains(MYUSERID)) {
myprofileid = sharedpreferences.getString(MYUSERID, "");
myprofileid = myprofileid.replaceAll("\\D+","");
}
colorcodes=sharedpreferences.getString(backgroundcolor,"");
Tokenid=sharedpreferences.getString(GcmId,"");
Log.e("coloR",colorcodes);
requestQueue = Volley.newRequestQueue(getActivity());
fontname=sharedpreferences.getString(Fonts.FONT,"");
lLayout = new LinearLayoutManager(getActivity());
recyclerview_tab_all_news = (RecyclerView) view.findViewById(R.id.tab_all_recyclerview);
recyclerview_tab_all_news.addItemDecoration(new DividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL));
recyclerview_tab_all_news.setLayoutManager(lLayout);
pdialog = new ProgressDialog(getActivity());
pdialog.show();
pdialog.setContentView(R.layout.custom_progressdialog);
pdialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
fabnews=(FloatingActionButton)view.findViewById(R.id.fabButton) ;
if(colorcodes.equals("#FFFFFFFF")){
fabnews.setImageResource(R.mipmap.uptamil);
}
else{
fabnews.setImageResource(R.mipmap.uparrow);
}
fabnews.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
recyclerview_tab_all_news.smoothScrollToPosition(0);
}
});
fabplus=(FloatingActionButton)getActivity().findViewById(R.id.fabButtonplus) ;
fabinnerplus=(FloatingActionButton)getActivity().findViewById(R.id.fabinnerplus) ;
fabsearch=(FloatingActionButton)getActivity().findViewById(R.id.fabsearch) ;
fab_open = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_open);
fab_close = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_close);
rotate_forward = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_forward);
rotate_backward = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_backward);
fabplus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/*Intent report=new Intent(getActivity(),ReportNewsOrComplaints.class);
startActivity(report);*/
animateFAB();
}
});
fabinnerplus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent report=new Intent(getActivity(),ReportNewsOrComplaintsTamil.class);
startActivity(report);
}
});
fabsearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent report=new Intent(getActivity(),SimplicitySearchview.class);
startActivity(report);
}
});
if(colorcodes.length()==0){
}else {
if(colorcodes.equalsIgnoreCase("004")){
Log.e("Msg","hihihi");
}else {
if(colorcodes.equalsIgnoreCase("#262626")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme1button));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme1button));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme1button));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme1button));
}else if(colorcodes.equalsIgnoreCase("#59247c")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme2));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme2));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme2));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme2));
}else if(colorcodes.equalsIgnoreCase("#1d487a")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme3));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme3));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme3));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme3));
}else if(colorcodes.equalsIgnoreCase("#7A4100")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme4));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme4));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme4));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme4));
}else if(colorcodes.equalsIgnoreCase("#6E0138")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme5));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme5));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme5));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme5));
}else if(colorcodes.equalsIgnoreCase("#00BFD4")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme6));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme6));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme6));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme6));
}else if(colorcodes.equalsIgnoreCase("#185546")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme7));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme7));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme7));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme7));
}else if(colorcodes.equalsIgnoreCase("#D0A06F")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme8));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme8));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme8));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme8));
}else if(colorcodes.equalsIgnoreCase("#82C6E6")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme9));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme9));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme9));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme9));
}else if(colorcodes.equalsIgnoreCase("#339900")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme10));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme10));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme10));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme10));
}else if(colorcodes.equalsIgnoreCase("#CC9C00")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme11));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme11));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme11));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme11));
}else if(colorcodes.equalsIgnoreCase("#00B09B")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme12));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme12));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme12));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme12));
}
else if(colorcodes.equalsIgnoreCase("#FFFFFFFF")){
fabnews.setBackgroundTintList(getResources().getColorStateList(R.color.theme13));
fabplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme13));
fabinnerplus.setBackgroundTintList(getResources().getColorStateList(R.color.theme13));
fabsearch.setBackgroundTintList(getResources().getColorStateList(R.color.theme13));
}
}
}
swipeRefresh = (SwipeRefreshLayout)view.findViewById(R.id.swipe);
swipeRefresh.setColorSchemeResources(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
swipeRefresh.setRefreshing(true); modelList.clear(); recyclerview_tab_all_adapter.notifyDataSetChanged(); requestCount=0; getData(); ( new Handler()).postDelayed(new Runnable() { @Override public void run() { swipeRefresh.setRefreshing(false); } }, 3000);
}
});
getData();
recyclerview_tab_all_adapter = new Recyclerviewtaballadapter(modelList,recyclerview_tab_all_news);
recyclerview_tab_all_news.setAdapter(recyclerview_tab_all_adapter);
recyclerview_tab_all_adapter.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore() {
Log.e("haint", "Load More");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Log.e("haint", "Load More 2");
getData();
recyclerview_tab_all_adapter.setLoaded();
}
}, 2000);
}
});
return view;
}
public void animateFAB(){
if(isFabOpen){
fabplus.startAnimation(rotate_backward);
fabinnerplus.startAnimation(fab_close);
fabsearch.startAnimation(fab_close);
fabinnerplus.setClickable(true);
fabsearch.setClickable(true);
isFabOpen = false;
Log.d("Raj", "close");
} else {
fabplus.startAnimation(rotate_forward);
fabinnerplus.startAnimation(fab_open);
fabsearch.startAnimation(fab_open);
fabinnerplus.setClickable(true);
fabsearch.setClickable(true);
isFabOpen = true;
Log.d("Raj","open");
}
}
private void getData() {
//Adding the method to the queue by calling the method getDataFromServer
requestQueue.add(getDataFromTheServer(requestCount));
// getDataFromTheServer();
//Incrementing the request counter
requestCount++;
}
StringRequest getDataFromTheServer(final int requestCount) {
if (myprofileid != null) {
URLALL = URL + "&page=" + requestCount + "&user_id=" + myprofileid;
} else {
URLALL = URL + "&page=" + requestCount;
}
StringRequest request = new StringRequest(Request.Method.POST, Configurl.api_new_url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("Response", response.toString());
try {
JSONObject object = new JSONObject(response.toString());
JSONArray array = object.getJSONArray("result");
String data = array.optString(1);
JSONArray jsonArray = new JSONArray(data.toString());
Log.e("Response", data.toString());
if (response != null) {
dissmissDialog();
parseJsonFeed(jsonArray);
}
} catch (JSONException e) {
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> param = new HashMap<>();
param.put("Key", "Simplicity");
Log.e("Response", "token" + Tokenid);
param.put("Token", "8d83cef3923ec6e4468db1b287ad3fa7");
param.put("language", "2");
param.put("rtype", "alldata");
param.put("qtype", "theatre");
param.put("page", String.valueOf(requestCount));
if(myprofileid!=null){
param.put("user_id",myprofileid);
}else {
}
return param;
}
};
request.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 3, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
requestQueue.add(request);
return request;
}
public interface OnFragmentInteractionListener { public void onFragmentInteraction(String playurl, String title, String image); }
private void parseJsonFeed(JSONArray response){
try {
// JSONArray feedArray = response.getJSONArray("");
for (int i = 0; i < response.length(); i++) {
JSONObject obj = (JSONObject) response.get(i);
ItemModel model = new ItemModel();
//FeedItem model=new FeedItem();
String image = obj.isNull("image") ? null : obj
.getString("image");
model.setImage(image);
model.setId(obj.getString("id"));
String date = obj.isNull("date") ? null : obj
.getString("date");
model.setPdate(date);
// model.setPdate(obj.getString("pdate"));
model.setTitle(obj.getString("title"));
model.setQtype(obj.getString("qtype"));
model.setLikescount(obj.getInt("likes_count"));
model.setCommentscount(obj.getInt("commentscount"));
// model.setFavcount(obj.getInt("fav"));
model.setSharingurl(obj.getString("sharingurl"));
model.setQtypemain(obj.getString("qtypemain"));
model.setAds(obj.getString("url"));
String reportername = obj.isNull("reporter_name") ? null : obj
.getString("reporter_name");
model.setEditername(reportername);
String shortdesc = obj.isNull("short_description") ? null : obj
.getString("short_description");
model.setShortdescription(shortdesc);
// model.setEditername(obj.getString("reporter_name"));
// model.setShortdescription(obj.getString("short_description"));
// model.setDislikecount(obj.getInt("dislikes_count"));
model.setCounttype(obj.getInt("like_type"));
model.setPlayurl(obj.getString("radio_file"));
model.setYoutubelink(obj.getString("youtube_link"));
int typevalue = obj.isNull("album_count") ? null : obj
.getInt("album_count");
model.setAlibumcount(typevalue);
List<ItemModel> albums = new ArrayList<>();
ArrayList<String> album = new ArrayList<String>();
try {
JSONArray feedArraygallery = obj.getJSONArray("album");
for (int k = 0; k < feedArraygallery.length(); k++) {
JSONObject object = (JSONObject) feedArraygallery.get(k);
ItemModel models = new ItemModel();
models.setAlbumimage(object.getString("image"));
albums.add(models);
String images=object.getString("image");
album.add(images);
}
}catch (JSONException e){
}
model.setAlbumlist(albums);
model.setAlbum(album);
modelList.add(model);
}
// notify data changes to list adapater
recyclerview_tab_all_adapter.notifyDataSetChanged();
// notify data changes to list adapater
} catch (JSONException e) {
e.printStackTrace();
}
}
public void onStop() {
super.onStop();
if (requestQueue != null) {
requestQueue.cancelAll(TAG_REQUEST);
}
}
public void dissmissDialog() {
// TODO Auto-generated method stub
if (pdialog != null) {
if (pdialog.isShowing()) {
pdialog.dismiss();
}
pdialog = null;
}
}
class ItemModel{
private int typeid;
private String name;
private String image;
private String pdate;
private String description;
private String title;
int alibumcount;
String playurl,albumimage;
private ArrayList<String> album;
private List<ItemModel> albumlist;
/******** start the Food category names****/
private String id;
/******** start the Food category names****/
private String qtype,qtypemain;
int favcount;
String sharingurl;
int likescount,dislikecount,counttype,commentscount;
public String getPlayurl() {
return playurl;
}
String ads;
String shortdescription,editername,youtubelink;
public String getAlbumimage() {
return albumimage;
}
public void setAlbumimage(String albumimage) {
this.albumimage = albumimage;
}
public List<ItemModel> getAlbumlist() {
return albumlist;
}
public void setAlbumlist(List<ItemModel> albumlist) {
this.albumlist = albumlist;
}
public String getYoutubelink() {
return youtubelink;
}
public void setYoutubelink(String youtubelink) {
this.youtubelink = youtubelink;
}
public String getEditername() {
return editername;
}
public void setEditername(String editername) {
this.editername = editername;
}
public String getShortdescription() {
return shortdescription;
}
public void setShortdescription(String shortdescription) {
this.shortdescription = shortdescription;
}
public String getAds() {
return ads;
}
public void setAds(String ads) {
this.ads = ads;
}
public void setPlayurl(String playurl) {
this.playurl = playurl;
}
public ArrayList<String> getAlbum() {
return album;
}
public void setAlbum(ArrayList<String> album) {
this.album = album;
}
public int getAlibumcount() {
return alibumcount;
}
public void setAlibumcount(int alibumcount) {
this.alibumcount = alibumcount;
}
public String getQtypemain() {
return qtypemain;
}
public void setQtypemain(String qtypemain) {
this.qtypemain = qtypemain;
}
public int getFavcount() {
return favcount;
}
public void setFavcount(int favcount) {
this.favcount = favcount;
}
public String getSharingurl() {
return sharingurl;
}
public void setSharingurl(String sharingurl) {
this.sharingurl = sharingurl;
}
public int getCommentscount() {
return commentscount;
}
public int getCounttype() {
return counttype;
}
public int getDislikecount() {
return dislikecount;
}
public int getLikescount() {
return likescount;
}
public void setCommentscount(int commentscount) {
this.commentscount = commentscount;
}
public void setCounttype(int counttype) {
this.counttype = counttype;
}
public void setDislikecount(int dislikecount) {
this.dislikecount = dislikecount;
}
public void setLikescount(int likescount) {
this.likescount = likescount;
}
public String getQtype() {
return qtype;
}
public void setQtype(String qtype) {
this.qtype = qtype;
}
public int getTypeid() {
return typeid;
}
public void setTypeid(int typeid) {
this.typeid = typeid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getDescription(){return description;}
public void setDescription(String description){
this.description=description;
}
public String getPdate(){return pdate;}
public void setPdate(String pdate) {
this.pdate = pdate;
}
public String getTitle(){return title;}
public void setTitle(String title) {
this.title = title;
}
/******** start the Food category names****/
public String getId(){return id;}
public void setId(String id) {
this.id = id;
}
}
@Override
public void onDestroy() {
super.onDestroy();
dissmissDialog();
}
static class Userviewholdertaball extends RecyclerView.ViewHolder implements View.OnClickListener{
public TextView likescount,dislikescount,commentscount,title_item,item_type_name,date;
TextView shortdescription,editername;
ImageButton share_imagebutton,like_imagebutton,comment_imagebutton,arrow_imagebutton;
public Button share_button,comment_button,likes_button,save_button;
public NetworkImageView item_image;
public RelativeLayout countlayout,listLayout;
ImageButton play;
RecyclerView_OnClickListener.OnClickListener onClickListener;
View line;
public Userviewholdertaball(View itemView) {
super(itemView);
this.title_item=(TextView)itemView.findViewById(R.id.item_title_taball);
this. item_type_name=(TextView)itemView.findViewById(R.id.qtypetitle_taball);
this. date=(TextView)itemView.findViewById(R.id.date_taball);
this. likescount=(TextView)itemView.findViewById(R.id.alltab_likescount);
this.play=(ImageButton)itemView.findViewById(R.id.taball_play_pause_main);
this. commentscount=(TextView)itemView.findViewById(R.id.alltab_commentscount);
this. likes_button=(Button)itemView.findViewById(R.id.taball_likes);
this. save_button=(Button)itemView.findViewById(R.id.taball_savepage);
this. share_button=(Button)itemView.findViewById(R.id.taball_sharepost);
this. comment_button=(Button)itemView.findViewById(R.id.taball_comment);
this. item_image=(NetworkImageView)itemView.findViewById(R.id.image_alltab);
this.listLayout=(RelativeLayout) itemView.findViewById(R.id.listlayout_taball);
this.countlayout=(RelativeLayout)itemView.findViewById(R.id.counts_layout);
this.likes_button.setOnClickListener(this);
this.comment_button.setOnClickListener(this);
this.save_button.setOnClickListener(this);
this.share_button.setOnClickListener(this);
this.listLayout.setOnClickListener(this);
this.play.setOnClickListener(this);
likescount.setOnClickListener(this);
this.line = itemView.findViewById(R.id.line_separter);
this.arrow_imagebutton=(ImageButton)itemView.findViewById(R.id.arrow);
this.editername=(TextView)itemView.findViewById(R.id.qtypetitle_sourcename);
this.shortdescription=(TextView)itemView.findViewById(R.id.textview_shortdescription) ;
this.comment_imagebutton=(ImageButton)itemView.findViewById(R.id.button_comment);
this.like_imagebutton=(ImageButton)itemView.findViewById(R.id.button_likes) ;
this.share_imagebutton=(ImageButton)itemView.findViewById(R.id.button_share) ;
this.shortdescription.setOnClickListener(this);
this.editername.setOnClickListener(this);
this.like_imagebutton.setOnClickListener(this);
this.comment_imagebutton.setOnClickListener(this);
this.share_imagebutton.setOnClickListener(this);
}
public void onClick(View v) {
// setting custom listener
if (onClickListener != null) {
onClickListener.OnItemClick(v, getAdapterPosition());
}
}
// Setter for listener
public void setClickListener(
RecyclerView_OnClickListener.OnClickListener onClickListener) {
this.onClickListener = onClickListener;
}
}
static class UserViewHolderphotostories extends RecyclerView.ViewHolder implements View.OnClickListener {
public TextView likescount,dislikescount,commentscount,title_item,item_type_name,date,moreimagescount_textview;
TextView shortdescription,editername;
ImageButton share_imagebutton,like_imagebutton,comment_imagebutton,arrow_imagebutton;
public Button share_button,comment_button,likes_button,save_button;
NetworkImageView feedImageView;
NetworkImageView feedImageView_typetwo_one,feedImageView_typetwo_two;
NetworkImageView feed_typethree_ones,feed_typethree_twos,feed_typethree_threes;
NetworkImageView feedImageView_typefour_one,feedImageView_typefour_two,feedImageView_typefour_three,feedImageView_typefour_four;
public RelativeLayout countlayout,listLayout;
// LinearLayout ;
RecyclerView_OnClickListener.OnClickListener onClickListener;
public UserViewHolderphotostories(View itemView) {
super(itemView);
this.title_item=(TextView)itemView.findViewById(R.id.item_title_taball);
this. item_type_name=(TextView)itemView.findViewById(R.id.qtypetitle_taball);
this. date=(TextView)itemView.findViewById(R.id.date_taball);
this. likescount=(TextView)itemView.findViewById(R.id.alltab_likescount);
this. commentscount=(TextView)itemView.findViewById(R.id.alltab_commentscount);
this. likes_button=(Button)itemView.findViewById(R.id.taball_likes);
this. save_button=(Button)itemView.findViewById(R.id.taball_savepage);
this. share_button=(Button)itemView.findViewById(R.id.taball_sharepost);
this. comment_button=(Button)itemView.findViewById(R.id.taball_comment);
likescount.setOnClickListener(this);
this.listLayout=(RelativeLayout) itemView.findViewById(R.id.listlayout_taball);
this.countlayout=(RelativeLayout)itemView.findViewById(R.id.counts_layout);
this.likes_button.setOnClickListener(this);
this.comment_button.setOnClickListener(this);
this.save_button.setOnClickListener(this);
this.share_button.setOnClickListener(this);
this.listLayout.setOnClickListener(this);
moreimagescount_textview=(TextView)itemView.findViewById(R.id.more_images);
this. feedImageView = (NetworkImageView) itemView
.findViewById(R.id.feedImage_photostory);
this. feedImageView_typetwo_one=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_type_two_one) ;
this. feedImageView_typetwo_two=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_type_two_two) ;
this. feed_typethree_ones=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_three_one) ;
this. feed_typethree_twos=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_three_two) ;
this. feed_typethree_threes=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_three_three) ;
this. feedImageView_typefour_one=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_type_four_one) ;
this. feedImageView_typefour_two=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_type_four_two) ;
this. feedImageView_typefour_three=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_type_four_three) ;
this. feedImageView_typefour_four=(NetworkImageView)itemView.findViewById(R.id.feedImage_photostory_type_four_four) ;
this.arrow_imagebutton=(ImageButton)itemView.findViewById(R.id.arrow);
this.editername=(TextView)itemView.findViewById(R.id.qtypetitle_sourcename);
this.shortdescription=(TextView)itemView.findViewById(R.id.textview_shortdescription) ;
this.comment_imagebutton=(ImageButton)itemView.findViewById(R.id.button_comment);
this.like_imagebutton=(ImageButton)itemView.findViewById(R.id.button_likes) ;
this.share_imagebutton=(ImageButton)itemView.findViewById(R.id.button_share) ;
this.shortdescription.setOnClickListener(this);
this.editername.setOnClickListener(this);
this.like_imagebutton.setOnClickListener(this);
this.comment_imagebutton.setOnClickListener(this);
this.share_imagebutton.setOnClickListener(this);
}
public void onClick(View v) {
// setting custom listener
if (onClickListener != null) {
onClickListener.OnItemClick(v, getAdapterPosition());
}
}
// Setter for listener
public void setClickListener(
RecyclerView_OnClickListener.OnClickListener onClickListener) {
this.onClickListener = onClickListener;
}
}
static class LoadingViewHolder extends RecyclerView.ViewHolder {
public ProgressBar progressBar;
public LoadingViewHolder(View itemView) {
super(itemView);
progressBar = (ProgressBar) itemView.findViewById(R.id.progressBar1);
}
}
class Recyclerviewtaballadapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
LayoutInflater inflater;
ImageLoader mImageLoader;
private final int VIEW_TYPE_ITEM = 1;
private final int VIEW_TYPE_LOADING = 3;
MediaPlayer mediaPlayer;
boolean loading;
OnLoadMoreListener onLoadMoreListener;
private final int VIEW_TYPE_PHOTOSTORY = 2;
private int visibleThreshold = 5;
private int lastVisibleItem, totalItemCount;
Context context;
@Override
public int getItemCount() {
return modelList.size();
}
public Recyclerviewtaballadapter(List<ItemModel> students, RecyclerView recyclerView) {
modelList = students;
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
final LinearLayoutManager linearLayoutManager = (LinearLayoutManager) recyclerView
.getLayoutManager();
recyclerView
.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView,
int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
totalItemCount = linearLayoutManager.getItemCount();
lastVisibleItem = linearLayoutManager
.findLastVisibleItemPosition();
if(lastVisibleItem>=10){
fabnews.setVisibility(View.VISIBLE);
}else {
fabnews.setVisibility(View.GONE);
}
if (!loading
&& totalItemCount <= (lastVisibleItem + visibleThreshold)) {
// End has been reached
// Do something
if (onLoadMoreListener != null) {
onLoadMoreListener.onLoadMore();
}
loading = true;
}
}
});
}
}
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater mInflater = LayoutInflater.from ( parent.getContext () );
switch ( viewType ) {
case VIEW_TYPE_ITEM:
ViewGroup vImage = (ViewGroup) mInflater.inflate ( R.layout.feed_item_versionfour_tamil, parent, false );
Userviewholdertaball vhImage = new Userviewholdertaball ( vImage );
return vhImage;
case VIEW_TYPE_PHOTOSTORY:
ViewGroup vImages = (ViewGroup) mInflater.inflate ( R.layout.feed_item_versionfour_photostory_tamil, parent, false );
UserViewHolderphotostories vhImages = new UserViewHolderphotostories ( vImages );
return vhImages;
/*case VIEW_TYPE_RADIO:
ViewGroup vImageradio = ( ViewGroup ) mInflater.inflate ( R.layout.feed_item_taball_radio, parent, false );
Userviewholdertaball vhImageradio = new Userviewholdertaball ( vImageradio );
return vhImageradio;*/
case VIEW_TYPE_LOADING:
ViewGroup vImageloading = (ViewGroup) mInflater.inflate ( R.layout.layout_loading_item, parent, false );
Userviewholdertaball vhImageloading = new Userviewholdertaball ( vImageloading );
return vhImageloading;
}
return null;
}
@SuppressLint("ResourceAsColor")
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof Userviewholdertaball) {
final Userviewholdertaball userViewHolder = (Userviewholdertaball) holder;
String simplycity_title_fontPath = "fonts/TAU_Elango_Madhavi.TTF";;
final Typeface seguiregular = Typeface.createFromAsset(getActivity().getAssets(), simplycity_title_fontPath);
if (mImageLoader == null)
mImageLoader = MySingleton.getInstance(getActivity()).getImageLoader();
final ItemModel itemmodel = modelList.get(position);
userViewHolder.comment_button.setText("கருத்து");
userViewHolder.comment_button.setTypeface(seguiregular);
userViewHolder.comment_button.setTransformationMethod(null);
userViewHolder.share_button.setText("பகிரவும்");
userViewHolder.share_button.setTypeface(seguiregular);
userViewHolder.share_button.setTransformationMethod(null);
post_likes_count=itemmodel.getCounttype();
save_item_count=itemmodel.getFavcount();
if(colorcodes.equals("#FFFFFFFF"))
{
userViewHolder.shortdescription.setTextColor(Color.GRAY);
userViewHolder.title_item.setTextColor(Color.BLACK);
userViewHolder.item_type_name.setTextColor(Color.GRAY);
userViewHolder.date.setTextColor(Color.GRAY);
userViewHolder.likescount.setTextColor(Color.BLACK);
userViewHolder.commentscount.setTextColor(Color.BLACK);
userViewHolder.line.setBackgroundColor(Color.LTGRAY);
}
else if(colorcodes.equals("#00B09B")){
userViewHolder.shortdescription.setTextColor(Color.WHITE);
userViewHolder.title_item.setTextColor(Color.WHITE);
userViewHolder.item_type_name.setTextColor(Color.WHITE);
userViewHolder.likescount.setTextColor(Color.WHITE);
userViewHolder.commentscount.setTextColor(Color.WHITE);
userViewHolder.line.setBackgroundColor(R.color.whitefood);
userViewHolder.date.setTextColor(Color.WHITE);
}
final String likecount=String.valueOf(itemmodel.getCounttype());
if(likecount.equals("0")){
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heart);
userViewHolder.like_imagebutton.setTag("heart");
}else {
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heartfullred);
userViewHolder.like_imagebutton.setTag("heartfullred");
}
if(itemmodel.getCounttype()==1){
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heartfullred);
userViewHolder.like_imagebutton.setTag("heartfullred");
/* userViewHolder.likes_button.setText("விருப்பு");
userViewHolder.likes_button.setCompoundDrawablesRelativeWithIntrinsicBounds(R.mipmap.likered,0,0,0);
userViewHolder.likes_button.setTextColor(getResources().getColor(R.color.red));
userViewHolder.likes_button.setTypeface(seguiregular);
userViewHolder.likes_button.setTransformationMethod(null);*/
}else {
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heartfullred);
userViewHolder.like_imagebutton.setTag("heart");
/*userViewHolder.likes_button.setText("விருப்பு");
userViewHolder.likes_button.setCompoundDrawablesRelativeWithIntrinsicBounds(R.mipmap.like,0,0,0);
userViewHolder.likes_button.setTextColor(getResources().getColor(R.color.white));
userViewHolder.likes_button.setTypeface(seguiregular);
userViewHolder.likes_button.setTransformationMethod(null);*/
}
if(itemmodel.getFavcount()==1){
userViewHolder.save_button.setText("சேமிக்க");
userViewHolder.likes_button.setTextColor(getResources().getColor(R.color.red));
userViewHolder.save_button.setTypeface(seguiregular);
userViewHolder.save_button.setTransformationMethod(null);
}else {
userViewHolder.save_button.setText("சேமிக்க");
userViewHolder.save_button.setTypeface(seguiregular);
userViewHolder.save_button.setTransformationMethod(null);
userViewHolder.likes_button.setTextColor(getResources().getColor(R.color.white));
}
if(itemmodel.getQtypemain().equalsIgnoreCase("radio")){
userViewHolder.play.setVisibility(View.VISIBLE);
}else {
userViewHolder.play.setVisibility(View.GONE);
}
mediaPlayer=new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
String simplycity_title = "fonts/robotoSlabRegular.ttf";
final Typeface tf_play = Typeface.createFromAsset(getActivity().getAssets(), simplycity_title);
userViewHolder.shortdescription.setTypeface(tf_play);
if(itemmodel.getPdate().equals("null")||itemmodel.getPdate().equals("")){ userViewHolder.shortdescription.setText(Html.fromHtml( itemmodel.getShortdescription())); }else { if(itemmodel.getShortdescription().equals("")){ userViewHolder.shortdescription.setText(Html.fromHtml(itemmodel.getPdate())); }else { userViewHolder.shortdescription.setText(Html.fromHtml(itemmodel.getPdate()+" "+"|"+" "+itemmodel.getShortdescription())); } }
userViewHolder.editername.setTypeface(seguiregular);
userViewHolder.editername.setText(itemmodel.getEditername());
userViewHolder.title_item.setText(Html.fromHtml(itemmodel.getTitle()));
if(fontname.equals("playfair")){
String simplycity_title_reugular= "fonts/TAU_Elango_Madhavi.TTF";
tf= Typeface.createFromAsset(getActivity().getAssets(), simplycity_title_reugular);
userViewHolder.title_item.setTypeface(tf);
userViewHolder.title_item.setTextSize(25);
userViewHolder.title_item.setLineSpacing(0,0.8f);
}else {
tf=Typeface.createFromAsset(getActivity().getAssets(),Fonts.muktamalar);
userViewHolder.title_item.setTypeface(tf);
userViewHolder.title_item.setTextSize(20);
}
String font_ad_tamil= "fonts/Oxygen-Bold.ttf";
Typeface tf_ad= Typeface.createFromAsset(getActivity().getAssets(), font_ad_tamil);
if(itemmodel.getQtypemain().equals("job")){
userViewHolder.editername.setTypeface(tf_ad);
userViewHolder.title_item.setTypeface(tf_ad);
userViewHolder.title_item.setTextSize(21);
userViewHolder.item_type_name.setTypeface(tf_ad);
userViewHolder.shortdescription.setTypeface(tf_ad);
}else if(itemmodel.getQtypemain().equals("event")){
userViewHolder.editername.setTypeface(tf_ad);
userViewHolder.title_item.setTypeface(tf_ad);
userViewHolder.title_item.setTextSize(21);
userViewHolder.item_type_name.setTypeface(tf_ad);
userViewHolder.shortdescription.setTypeface(tf_ad);
}else if(itemmodel.getQtypemain().equals("Sponsered")||itemmodel.getQtype().equals("Sponsored")){
userViewHolder.editername.setTypeface(tf_ad);
userViewHolder.title_item.setTypeface(tf_ad);
userViewHolder.title_item.setTextSize(21);
userViewHolder.item_type_name.setTypeface(tf_ad);
userViewHolder.shortdescription.setTypeface(tf_ad);
}
if(itemmodel.getEditername().equals("")){ userViewHolder.item_type_name.setText(Html.fromHtml(itemmodel.getQtype())); }else { userViewHolder.item_type_name.setText(Html.fromHtml(itemmodel.getQtype() + " "+" "+" " + "|" + " "+" "+" " + itemmodel.getEditername())); }
userViewHolder.item_type_name.setTypeface(tf_play);
// userViewHolder.date.setText(itemmodel.getPdate());
userViewHolder.likescount.setTypeface(tf_play);
userViewHolder.commentscount.setTypeface(tf_play);
userViewHolder.date.setTypeface(seguiregular);
if(itemmodel.getLikescount()==0){ userViewHolder.commentscount.setText(Html.fromHtml("0"+" " +"விருப்பு")); }else { userViewHolder.likescount.setText(Html.fromHtml(itemmodel.getLikescount()+" "+"விருப்பு")); } if(itemmodel.getCommentscount()==0){ userViewHolder.commentscount.setText(Html.fromHtml("0"+" " +"கருத்து")); }else { userViewHolder.commentscount.setText(Html.fromHtml(itemmodel.getCommentscount()+" " +"கருத்து")); } userViewHolder.countlayout.setVisibility(View.VISIBLE);
if(itemmodel.getImage()!=null){
userViewHolder.item_image.setImageUrl(itemmodel.getImage(),mImageLoader);
}else {
userViewHolder.item_image.setVisibility(View.GONE);
}
userViewHolder.setClickListener(new RecyclerView_OnClickListener.OnClickListener() {
@Override
public void OnItemClick(View view, int position) {
switch (view.getId()) {
case R.id.listlayout_taball:
// Show a toast on clicking layout
String type = ((ItemModel) modelList.get(position)).getQtypemain();
String qtype = ((ItemModel) modelList.get(position)).getQtype();
String ids = ((ItemModel) modelList.get(position)).getId();
if(type.equals("news")||type.equals("National")||type.equals("International")) {
Intent intent = new Intent(getActivity(), TamilNewsDescription.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("article")){
Intent intent = new Intent(getActivity(), TamilArticledescription.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if (type.equals("doit")){
Intent intent = new Intent(getActivity(), DoitDescriptiontamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("farming")){
Intent intent = new Intent(getActivity(), Farmingdescriptiontamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("food")||type.equals("foodtip")){
if(type.equals("food")){
Intent intent = new Intent(getActivity(), FoodAndCookDescriptionPagetamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else {
Intent intent = new Intent(getActivity(), TipsDescriptionTamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}
}else if(type.equals("govt")){
Intent intent = new Intent(getActivity(), Govtdescriptiontamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("health")){
Intent intent = new Intent(getActivity(), Healthdescriptiontamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("science")){
Intent intent = new Intent(getActivity(), ScienceandTechnologyDescriptiontamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("sports")){
Intent intent = new Intent(getActivity(), TamilSportsnewsDescription.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("travels")){
Intent intent = new Intent(getActivity(), TravelsDescriptiontamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("event")){
Intent intent = new Intent(getActivity(), TamilEventsDescription.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equalsIgnoreCase("Radio")){
Intent intent = new Intent(getActivity(), RadioNotificationplayer.class);
intent.putExtra("URL", itemmodel.getPlayurl());
intent.putExtra("TITLE", itemmodel.getTitle());
intent.putExtra("PAGE", "story");
intent.putExtra("IMAGE", itemmodel.getImage());
startActivity(intent);
}else if(type.equalsIgnoreCase("Music")){
Intent intent = new Intent(getActivity(), RadioNotificationplayer.class);
intent.putExtra("URL", itemmodel.getPlayurl());
intent.putExtra("TITLE", itemmodel.getTitle());
intent.putExtra("IMAGE", itemmodel.getImage());
intent.putExtra("PAGE", "story");
startActivity(intent);
}else if(type.equalsIgnoreCase("Job")){
Intent intent = new Intent(getActivity(), JobsDetailPagetamil.class);
intent.putExtra("ID", ids);
intent.putExtra("TITLE", itemmodel.getTitle());
startActivity(intent);
}
else if(type.equalsIgnoreCase("theatre")){
Intent intent = new Intent(getActivity(), YoutubeVideoPlayer.class);
intent.putExtra("ID", ids);
intent.putExtra("TITLE",itemmodel.getTitle());
intent.putExtra("URL",itemmodel.getYoutubelink());
startActivity(intent);
} else if(type.equalsIgnoreCase("columns")){
Intent intent = new Intent(getActivity(), Columnsdetailpage.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if (type.equals("columnist")){
Intent intent = new Intent(getActivity(), Columnistdetailtamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}
else if(type.equalsIgnoreCase("education")){
Intent intent = new Intent(getActivity(), EducationDescriptiontamil.class);
intent.putExtra("ID", ids);
startActivity(intent);
}else if(type.equals("lifestyle")){
Intent intent = new Intent(getActivity(), LifestyleDetail.class);
intent.putExtra("ID", ids);
startActivity(intent);
}
else if(itemmodel.getQtype().equals("Sponsered")||itemmodel.getQtype().equals("Sponsored")){
if(itemmodel.getAds().startsWith("http://simpli")){
Intent intent = new Intent(getActivity(), AdvertisementPageTamil.class);
intent.putExtra("ID", itemmodel.getAds());
startActivity(intent);
}else {
Intent intent = new Intent(getActivity(), AdvertisementPage.class); intent.putExtra("ID", itemmodel.getAds()); startActivity(intent);
}
}
break;
case R.id.alltab_likescount:
FragmentTransaction ftlike = getChildFragmentManager().beginTransaction();
LikeListFragment frags;
frags = new LikeListFragment();
Bundle argss = new Bundle();
argss.putString("ID", itemmodel.getId());
argss.putString("QTYPE",itemmodel.getQtypemain());
frags.setArguments(argss);
frags.show(ftlike, "txn_tag");
break;
case R.id.taball_play_pause_main:
Log.e("CLick","MainRaio");
if(itemmodel.getQtype().equals("Independent Movies")||itemmodel.getQtypemain().equals("theatre")){
Intent intent = new Intent(getActivity(), YoutubeVideoPlayer.class); intent.putExtra("ID", itemmodel.getId()); intent.putExtra("TITLE",itemmodel.getTitle()); intent.putExtra("URL",itemmodel.getYoutubelink()); startActivity(intent);
}else {
String url = itemmodel.getPlayurl();
onButtonPressed(itemmodel.getPlayurl(), itemmodel.getTitle(),itemmodel.getImage());
userViewHolder.play.setVisibility(View.GONE);
}
break;
case R.id.button_likes:
if(myprofileid!=null) {
String backgroundImageName = String.valueOf(userViewHolder.like_imagebutton.getTag());
Log.e("RUN","with"+backgroundImageName);
if(backgroundImageName.equals("heart")){
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heartfullred);
userViewHolder.like_imagebutton.setTag("heartfullred");
}else if(backgroundImageName.equals("heartfullred")) {
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heart);
userViewHolder.like_imagebutton.setTag("heart");
}else {
}
StringRequest likes=new StringRequest(Request.Method.POST, Configurl.api_new_url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("RES",response.toString());
try {
Log.e("RES", "START");
JSONObject object=new JSONObject(response.toString());
JSONArray array=object.getJSONArray("result");
String data=array.optString(1);
Log.d("RES", data);
// JSONArray jsonArray=new JSONArray(data.toString());
/*JSONObject data = new JSONObject(response.toString());
String dir = data.getString("result");
Log.d("RES", dir);
JSONObject object=new JSONObject(dir);
String dir2=object.getString("message");
Log.d("RES", dir2);*/
// for (int i = 0; i < jsonArray.length(); i++) {
JSONObject obj = new JSONObject(data.toString());
String res=obj.getString("like_type");
like_finalvalues=Integer.parseInt(likecount);
if(res.equals("Liked")){
// System.out.println(itemmodel.getId());
String likescount=obj.getString("like_count");
like_finalvalues=Integer.parseInt(likescount);
Log.e("RESS",String.valueOf(like_finalvalues));
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heartfullred); userViewHolder.like_imagebutton.setTag("heartfullred");
}else if(res.equals("Like")){
like_finalvalues=Integer.parseInt(obj.getString("like_count"));
Log.e("RES","dis"+String.valueOf(like_finalvalues));
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heart); userViewHolder.like_imagebutton.setTag("heart");
}
userViewHolder. likescount.setText(Html.fromHtml(like_finalvalues + " " + "விருப்பு"));
}catch (JSONException e){
} }
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}){
protected Map<String,String> getParams()throws AuthFailureError{
Map<String,String> param=new Hashtable<String, String>();
String ids=itemmodel.getId();
param.put("Key","Simplicity");
param.put("Token","8d83cef3923ec6e4468db1b287ad3fa7");
param.put("rtype","like");
param.put("id", ids);
Log.e("RESS",myprofileid);
param.put("user_id", myprofileid);
param.put("qtype", itemmodel.getQtypemain());
return param;
}
};
RequestQueue likesqueue=Volley.newRequestQueue(getActivity());
likes.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 2, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
likesqueue.add(likes);
}else {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Activity, "mainversiontamil");
editor.putString(CONTENTID, "0");
editor.commit();
Intent sign=new Intent(getActivity(),SigninpageActivity.class);
startActivity(sign);
}
break;
case R.id.taball_savepage:
if(myprofileid!=null) {
if (save_item_count == 1) {
userViewHolder.save_button.setText("சேமிக்க");
userViewHolder.save_button.setTextColor(getResources().getColor(R.color.white));
userViewHolder.save_button.setTypeface(seguiregular);
userViewHolder.save_button.setTransformationMethod(null);
save_item_count--;
StringRequest stringRequest = new StringRequest(Request.Method.POST, URLSAVE,
new Response.Listener<String>() {
@Override
public void onResponse(String s) {
//Disimissing the progress dialog
//Showing toast message of the response
if (s.equalsIgnoreCase("no")) {
//Toast.makeText(getActivity(), s, Toast.LENGTH_LONG).show() ;
} else {
Log.e("response:", s);
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
//Dismissing the progress dialog
//loading.dismiss();
//Showing toast
// Toast.makeText(CityCenterCommentPage.this, volleyError.getMessage().toString(), Toast.LENGTH_LONG).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new Hashtable<String, String>();
//Adding parameters
params.put(QID, itemmodel.getId());
params.put(USERID, myprofileid);
params.put(QTYPE, itemmodel.getQtypemain());
return params;
}
};
//Creating a Request Queue
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
//Adding request to the queue
requestQueue.add(stringRequest);
} else {
userViewHolder.save_button.setText("சேமிக்க");
userViewHolder.save_button.setTextColor(getResources().getColor(R.color.red));
userViewHolder.save_button.setTypeface(seguiregular);
userViewHolder.save_button.setTransformationMethod(null);
save_item_count++;
StringRequest stringRequest = new StringRequest(Request.Method.POST, URLSAVE,
new Response.Listener<String>() {
@Override
public void onResponse(String s) {
//Disimissing the progress dialog
//Showing toast message of the response
if (s.equalsIgnoreCase("no")) {
//Toast.makeText(getActivity(), s, Toast.LENGTH_LONG).show() ;
} else {
Log.e("response:", s);
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
//Dismissing the progress dialog
//loading.dismiss();
//Showing toast
// Toast.makeText(CityCenterCommentPage.this, volleyError.getMessage().toString(), Toast.LENGTH_LONG).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
//Converting Bitmap to String
//Getting Image Name
//Creating parameters
Map<String, String> params = new Hashtable<String, String>();
//Adding parameters
params.put(QID, itemmodel.getId());
params.put(USERID, myprofileid);
params.put(QTYPE, itemmodel.getQtypemain());
return params;
}
};
//Creating a Request Queue
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
//Adding request to the queue
requestQueue.add(stringRequest);
//Toast.makeText(getActivity(),count,Toast.LENGTH_LONG).show();
}
}else {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Activity, "mainversiontamil");
editor.putString(CONTENTID, "0");
editor.commit();
Intent signin=new Intent(getActivity(),SigninpageActivity.class);
startActivity(signin);
}
break;
case R.id.button_comment:
if(myprofileid!=null) {
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
MyDialogFragment frag;
frag = new MyDialogFragment();
Bundle args = new Bundle();
args.putString("POSTID", itemmodel.getId());
args.putString("USERID", myprofileid);
args.putString("QTYPE",itemmodel.getQtypemain());
frag.setArguments(args);
frag.show(ft, "txn_tag");
}else {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Activity, "mainversiontamil");
editor.putString(CONTENTID, "0");
editor.commit();
Intent signin=new Intent(getActivity(),SigninpageActivity.class);
startActivity(signin);
}
break;
case R.id.button_share:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
if(itemmodel.getSharingurl().equals("")){
sendIntent.putExtra(Intent.EXTRA_TEXT, itemmodel.getTitle()+ "\n" + itemmodel.getAds()+"\n"+"\n"+"\n"+"Receive instant updates by installing Simplicity for iPhone/iPad,Android and Windows 10(desktop & Mobile)(http://goo.gl/Sv3vfc)");
}else {
sendIntent.putExtra(Intent.EXTRA_TEXT, itemmodel.getTitle() + "\n" + itemmodel.getSharingurl() + "\n" + "\n" + "\n" + "Receive instant updates by installing Simplicity for iPhone/iPad,Android and Windows 10(desktop & Mobile)(http://goo.gl/Sv3vfc)");
} sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share using"));
break;
}
}
});
}else if(holder instanceof UserViewHolderphotostories){
final UserViewHolderphotostories userViewHolder = (UserViewHolderphotostories) holder;
String simplycity_title_fontPath = "fonts/TAU_Elango_Madhavi.TTF";;
final Typeface seguiregular = Typeface.createFromAsset(getActivity().getAssets(), simplycity_title_fontPath);
if (mImageLoader == null)
mImageLoader = MySingleton.getInstance(getActivity()).getImageLoader();
final ItemModel itemmodel = modelList.get(position);
userViewHolder.comment_button.setText("கருத்து");
userViewHolder.comment_button.setTypeface(seguiregular);
userViewHolder.comment_button.setTransformationMethod(null);
userViewHolder.share_button.setText("பகிரவும்");
userViewHolder.share_button.setTypeface(seguiregular);
userViewHolder.share_button.setTransformationMethod(null);
post_likes_count=itemmodel.getCounttype();
save_item_count=itemmodel.getFavcount();
if(itemmodel.getCounttype()==1){
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heartfullred);
userViewHolder.like_imagebutton.setTag("heartfullred");
/*userViewHolder.likes_button.setText("விருப்பு");
userViewHolder.likes_button.setTextColor(getResources().getColor(R.color.red));
userViewHolder.likes_button.setCompoundDrawablesRelativeWithIntrinsicBounds(R.mipmap.likered,0,0,0);
userViewHolder.likes_button.setTypeface(seguiregular);
userViewHolder.likes_button.setTransformationMethod(null);*/
}else {
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heart);
userViewHolder.like_imagebutton.setTag("heart");
/*userViewHolder.likes_button.setText("விருப்பு");
userViewHolder.likes_button.setCompoundDrawablesRelativeWithIntrinsicBounds(R.mipmap.like,0,0,0);
userViewHolder.likes_button.setTextColor(getResources().getColor(R.color.white));
userViewHolder.likes_button.setTypeface(seguiregular);
userViewHolder.likes_button.setTransformationMethod(null);*/
}
if(itemmodel.getFavcount()==1){
userViewHolder.save_button.setText("சேமிக்க");
userViewHolder.likes_button.setTextColor(getResources().getColor(R.color.red));
userViewHolder.save_button.setTypeface(seguiregular);
userViewHolder.save_button.setTransformationMethod(null);
}else {
userViewHolder.save_button.setText("சேமிக்க");
userViewHolder.save_button.setTypeface(seguiregular);
userViewHolder.save_button.setTransformationMethod(null);
userViewHolder.likes_button.setTextColor(getResources().getColor(R.color.white));
}
String simplycity_title = "fonts/robotoSlabRegular.ttf";
final Typeface tf_play = Typeface.createFromAsset(getActivity().getAssets(), simplycity_title);
userViewHolder.shortdescription.setTypeface(tf_play);
if(itemmodel.getPdate().equals("null")||itemmodel.getPdate().equals("")){ userViewHolder.shortdescription.setText(Html.fromHtml( itemmodel.getShortdescription())); }else { if(itemmodel.getShortdescription().equals("")){ userViewHolder.shortdescription.setText(Html.fromHtml(itemmodel.getPdate())); }else { userViewHolder.shortdescription.setText(Html.fromHtml(itemmodel.getPdate()+" "+"|"+" "+itemmodel.getShortdescription())); } }
userViewHolder.editername.setTypeface(seguiregular);
userViewHolder.editername.setText(itemmodel.getEditername());
userViewHolder.title_item.setText(itemmodel.getTitle());
if(fontname.equals("playfair")){
String simplycity_title_reugular= "fonts/TAU_Elango_Madhavi.TTF";
tf= Typeface.createFromAsset(getActivity().getAssets(), simplycity_title_reugular);
userViewHolder.title_item.setTypeface(tf);
userViewHolder.title_item.setTextSize(25);
userViewHolder.title_item.setLineSpacing(0,0.8f);
}else {
tf=Typeface.createFromAsset(getActivity().getAssets(),Fonts.muktamalar);
userViewHolder.title_item.setTypeface(tf);
userViewHolder.title_item.setTextSize(20);
}
if(itemmodel.getEditername().equals("")){ userViewHolder.item_type_name.setText(Html.fromHtml(itemmodel.getQtype())); }else { userViewHolder.item_type_name.setText(Html.fromHtml(itemmodel.getQtype() + " "+" "+" " + "|" + " "+" "+" " + itemmodel.getEditername())); }
userViewHolder.item_type_name.setTypeface(tf_play);
//userViewHolder.date.setText(itemmodel.getPdate());
userViewHolder.likescount.setTypeface(tf_play);
userViewHolder.commentscount.setTypeface(tf_play);
userViewHolder.date.setTypeface(seguiregular);
if(itemmodel.getLikescount()==0){ userViewHolder.commentscount.setText(Html.fromHtml("0"+" " +"விருப்பு")); }else { userViewHolder.likescount.setText(Html.fromHtml(itemmodel.getLikescount()+" "+"விருப்பு")); } if(itemmodel.getCommentscount()==0){ userViewHolder.commentscount.setText(Html.fromHtml("0"+" " +"கருத்து")); }else { userViewHolder.commentscount.setText(Html.fromHtml(itemmodel.getCommentscount()+" " +"கருத்து")); } userViewHolder.countlayout.setVisibility(View.VISIBLE);
String powers = "";
String powerstwo = "";
// Chcek for empty status message
if (itemmodel.getAlibumcount()==0) {
userViewHolder.feedImageView.setImageUrl(itemmodel.getImage(), mImageLoader);
userViewHolder.feedImageView.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feedImageView.setVisibility(View.VISIBLE);
userViewHolder.feedImageView_typetwo_one.setVisibility(View.GONE);
userViewHolder.feedImageView_typetwo_two.setVisibility(View.GONE);
userViewHolder.feed_typethree_ones.setVisibility(View.GONE);
userViewHolder.feed_typethree_twos.setVisibility(View.GONE);
userViewHolder.feed_typethree_threes.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_one.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_two.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_three.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_four.setVisibility(View.GONE);
}else if(itemmodel.getAlibumcount()==2){
int j;
for( j=0;j<itemmodel.getAlbum().size();j++) {
powerstwo = itemmodel.getAlbum().get(j);
if(j==0) {
System.out.println("two1 -->"+itemmodel.getAlbum().get(j));
userViewHolder.feedImageView_typetwo_one.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feedImageView_typetwo_one.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feedImageView_typetwo_one.setVisibility(View.VISIBLE);
}else if(j==1) {
System.out.println(" two2-->"+itemmodel.getAlbum().get(j));
userViewHolder.feedImageView_typetwo_two.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feedImageView_typetwo_two.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feedImageView_typetwo_two.setVisibility(View.VISIBLE);
}
userViewHolder.feedImageView.setVisibility(View.GONE);
userViewHolder.feed_typethree_ones.setVisibility(View.GONE);
userViewHolder.feed_typethree_twos.setVisibility(View.GONE);
userViewHolder.feed_typethree_threes.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_one.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_two.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_three.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_four.setVisibility(View.GONE);
}
}else if(itemmodel.getAlibumcount()==3){
int j;
for( j=0;j<itemmodel.getAlbum().size();j++) {
powerstwo = itemmodel.getAlbum().get(j);
if(j==0) {
System.out.println("three -->"+itemmodel.getAlbum().get(j));
userViewHolder.feed_typethree_ones.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feed_typethree_ones.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feed_typethree_ones.setVisibility(View.VISIBLE);
}else if(j==1) {
System.out.println(" three2-->"+itemmodel.getAlbum().get(j));
userViewHolder.feed_typethree_twos.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feed_typethree_twos.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feed_typethree_twos.setVisibility(View.VISIBLE);
}else if (j==2) {
System.out.println("three3 -->"+itemmodel.getAlbum().get(j));
userViewHolder.feed_typethree_threes.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feed_typethree_threes.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feed_typethree_threes.setVisibility(View.VISIBLE);
}
userViewHolder.feedImageView_typetwo_one.setVisibility(View.GONE);
userViewHolder.feedImageView_typetwo_two.setVisibility(View.GONE);
userViewHolder.feedImageView.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_one.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_two.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_three.setVisibility(View.GONE);
userViewHolder.feedImageView_typefour_four.setVisibility(View.GONE);
}
}else {
int j;
for (j = 0; j < itemmodel.getAlbum().size(); j++) {
powerstwo = itemmodel.getAlbum().get(j);
if (j == 0) {
System.out.println("four -->" + itemmodel.getAlbum().get(j));
userViewHolder.feedImageView_typefour_one.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feedImageView_typefour_one.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feedImageView_typefour_one.setVisibility(View.VISIBLE);
} else if (j == 1) {
System.out.println("four2 -->" + itemmodel.getAlbum().get(j));
userViewHolder.feedImageView_typefour_two.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feedImageView_typefour_two.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feedImageView_typefour_two.setVisibility(View.VISIBLE);
} else if (j == 2) {
System.out.println("four3 -->" + itemmodel.getAlbum().get(j));
userViewHolder.feedImageView_typefour_three.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feedImageView_typefour_three.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feedImageView_typefour_three.setVisibility(View.VISIBLE);
} else if (j == 3) {
System.out.println("four4 -->" + itemmodel.getAlbum().get(j));
userViewHolder.feedImageView_typefour_four.setImageUrl(powerstwo, mImageLoader);
userViewHolder.feedImageView_typefour_four.setDefaultImageResId(R.mipmap.ic_launcher);
userViewHolder.feedImageView_typefour_four.setVisibility(View.VISIBLE);
}
userViewHolder.feedImageView_typetwo_one.setVisibility(View.GONE);
userViewHolder.feedImageView_typetwo_two.setVisibility(View.GONE);
userViewHolder.feed_typethree_ones.setVisibility(View.GONE);
userViewHolder.feed_typethree_twos.setVisibility(View.GONE);
userViewHolder.feed_typethree_threes.setVisibility(View.GONE);
userViewHolder.feedImageView.setVisibility(View.GONE);
}
}
int albumcountsdata=itemmodel.getAlibumcount();
if(albumcountsdata>4){
userViewHolder.moreimagescount_textview.setVisibility(View.VISIBLE);
int result=albumcountsdata-4;
userViewHolder.moreimagescount_textview.setText(Html.fromHtml("+"+result+" "+"Images"));
}else {
userViewHolder.moreimagescount_textview.setVisibility(View.GONE);
}
userViewHolder.setClickListener(new RecyclerView_OnClickListener.OnClickListener() {
@Override
public void OnItemClick(View view, int position) {
switch (view.getId()) {
case R.id.listlayout_taball:
Intent photostory=new Intent(getActivity(),PhotoStoriesDetail.class);
photostory.putExtra("Image", itemmodel.getId());
photostory.putExtra("TITLE",itemmodel.getTitle());
photostory.putExtra("DATE",itemmodel.getPdate());
startActivity(photostory);
/*if(itemmodel.getAlibumcount()==0){
Log.e("IMAGE:", itemmodel.getImage());
FragmentTransaction fts = getChildFragmentManager().beginTransaction();
MyDialogFragmentviewone frags;
frags = new MyDialogFragmentviewone();
Bundle argss = new Bundle();
argss.putString("Image", itemmodel.getImage());
argss.putString("TITLE",itemmodel.getTitle());
argss.putString("DATE",itemmodel.getPdate());
frags.setArguments(argss);
frags.show(fts, "txn_tag");
}else {
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
MyDialogFragmentmultiple frag;
frag = new MyDialogFragmentmultiple();
Bundle args = new Bundle();
args.putString("Image", itemmodel.getId());
args.putString("TITLE",itemmodel.getTitle());
args.putString("DATE",itemmodel.getPdate());
frag.setArguments(args);
frag.show(ft, "txn_tag");
}*/
// Show a toast on clicking layout
// String type = ((ItemModel) modelList.get(position)).getQtype();
// String ids = ((ItemModel) modelList.get(position)).getId();
// Intent intent = new Intent(getActivity(), NewsDescription.class);
// intent.putExtra("ID", ids);
// startActivity(intent);
break;
case R.id.alltab_likescount:
FragmentTransaction ftlike = getChildFragmentManager().beginTransaction();
LikeListFragment frags;
frags = new LikeListFragment();
Bundle argss = new Bundle();
argss.putString("ID", itemmodel.getId());
argss.putString("QTYPE",itemmodel.getQtypemain());
frags.setArguments(argss);
frags.show(ftlike, "txn_tag");
break;
case R.id.button_likes:
if(myprofileid!=null) {
String backgroundImageName = String.valueOf(userViewHolder.like_imagebutton.getTag());
Log.e("RUN","with"+backgroundImageName);
if(backgroundImageName.equals("heart")){
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heartfullred);
userViewHolder.like_imagebutton.setTag("heartfullred");
}else if(backgroundImageName.equals("heartfullred")) {
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heart);
userViewHolder.like_imagebutton.setTag("heart");
}else {
}
StringRequest likes=new StringRequest(Request.Method.POST, Configurl.api_new_url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
String res;
try {
Log.e("RES", "START");
JSONObject object=new JSONObject(response.toString());
JSONArray array=object.getJSONArray("result");
String data=array.optString(1);
JSONArray jsonArray=new JSONArray(data.toString());
/*JSONObject data = new JSONObject(response.toString());
String dir = data.getString("result");
Log.d("RES", dir);
JSONObject object=new JSONObject(dir);
String dir2=object.getString("message");
Log.d("RES", dir2);*/
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject obj = (JSONObject) jsonArray.get(i);
String dirs = obj.getString("like_type");
Log.d("RES", dirs);
res=object.getString("like_type");
like_finalvalues=object.getInt("like_count");
Log.e("RES",res.toString());
if(res.equals("Liked")){
System.out.println(itemmodel.getId());
like_finalvalues=object.getInt("like_count");
Log.e("RES",String.valueOf(like_finalvalues));
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heartfullred); userViewHolder.like_imagebutton.setTag("heartfullred");
}else if(res.equals("Like")){
like_finalvalues=object.getInt("like_count");
Log.e("RES","dis"+String.valueOf(like_finalvalues));
userViewHolder.like_imagebutton.setImageResource(R.mipmap.heart); userViewHolder.like_imagebutton.setTag("heart");
}
userViewHolder. likescount.setText(Html.fromHtml(like_finalvalues + " " + "விருப்பு"));
}
}catch (JSONException e){
}}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}){
protected Map<String,String> getParams()throws AuthFailureError{
Map<String,String> param=new Hashtable<String, String>();
String ids=itemmodel.getId();
param.put("Key","Simplicity");
param.put("Token","8d83cef3923ec6e4468db1b287ad3fa7");
param.put("rtype","like");
param.put("id", ids);
Log.e("RESS",myprofileid);
param.put("user_id", myprofileid);
param.put("qtype", itemmodel.getQtypemain());
return param;
}
};
RequestQueue likesqueue=Volley.newRequestQueue(getActivity());
likes.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 2, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
likesqueue.add(likes);
}else {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Activity, "mainversion");
editor.putString(CONTENTID, "0");
editor.commit();
Intent sign=new Intent(getActivity(),SigninpageActivity.class);
startActivity(sign);
}
break;
case R.id.taball_savepage:
if(myprofileid!=null) {
if (save_item_count == 1) {
userViewHolder.save_button.setText("சேமிக்க");
userViewHolder.save_button.setTextColor(getResources().getColor(R.color.white));
userViewHolder.save_button.setTypeface(seguiregular);
userViewHolder.save_button.setTransformationMethod(null);
save_item_count--;
StringRequest stringRequest = new StringRequest(Request.Method.POST, URLSAVE,
new Response.Listener<String>() {
@Override
public void onResponse(String s) {
//Disimissing the progress dialog
//Showing toast message of the response
if (s.equalsIgnoreCase("no")) {
//Toast.makeText(getActivity(), s, Toast.LENGTH_LONG).show() ;
} else {
Log.e("response:", s);
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
//Dismissing the progress dialog
//loading.dismiss();
//Showing toast
// Toast.makeText(CityCenterCommentPage.this, volleyError.getMessage().toString(), Toast.LENGTH_LONG).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new Hashtable<String, String>();
//Adding parameters
params.put(QID, itemmodel.getId());
params.put(USERID, myprofileid);
params.put(QTYPE, itemmodel.getQtypemain());
return params;
}
};
//Creating a Request Queue
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
//Adding request to the queue
requestQueue.add(stringRequest);
} else {
userViewHolder.save_button.setText("சேமிக்க");
userViewHolder.save_button.setTextColor(getResources().getColor(R.color.red));
userViewHolder.save_button.setTypeface(seguiregular);
userViewHolder.save_button.setTransformationMethod(null);
save_item_count++;
StringRequest stringRequest = new StringRequest(Request.Method.POST, URLSAVE,
new Response.Listener<String>() {
@Override
public void onResponse(String s) {
//Disimissing the progress dialog
//Showing toast message of the response
if (s.equalsIgnoreCase("no")) {
//Toast.makeText(getActivity(), s, Toast.LENGTH_LONG).show() ;
} else {
Log.e("response:", s);
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
//Dismissing the progress dialog
//loading.dismiss();
//Showing toast
// Toast.makeText(CityCenterCommentPage.this, volleyError.getMessage().toString(), Toast.LENGTH_LONG).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
//Converting Bitmap to String
//Getting Image Name
//Creating parameters
Map<String, String> params = new Hashtable<String, String>();
//Adding parameters
params.put(QID, itemmodel.getId());
params.put(USERID, myprofileid);
params.put(QTYPE, itemmodel.getQtypemain());
return params;
}
};
//Creating a Request Queue
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
//Adding request to the queue
requestQueue.add(stringRequest);
//Toast.makeText(getActivity(),count,Toast.LENGTH_LONG).show();
}
}else {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Activity, "mainversion");
editor.putString(CONTENTID, "0");
editor.commit();
Intent signin=new Intent(getActivity(),SigninpageActivity.class);
startActivity(signin);
}
break;
case R.id.button_comment:
if(myprofileid!=null) {
FragmentTransaction ftcom = getChildFragmentManager().beginTransaction();
MyDialogFragment fragcom;
fragcom = new MyDialogFragment();
Bundle argscom = new Bundle();
argscom.putString("POSTID", itemmodel.getId());
argscom.putString("USERID", myprofileid);
argscom.putString("QTYPE",itemmodel.getQtypemain());
fragcom.setArguments(argscom);
fragcom.show(ftcom, "txn_tag");
}else {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Activity, "mainversion");
editor.putString(CONTENTID, "0");
editor.commit();
Intent signin=new Intent(getActivity(),SigninpageActivity.class);
startActivity(signin);
}
break;
case R.id.button_share:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
if(itemmodel.getSharingurl().equals("")){
sendIntent.putExtra(Intent.EXTRA_TEXT, itemmodel.getTitle()+ "\n" + itemmodel.getAds()+"\n"+"\n"+"\n"+"Receive instant updates by installing Simplicity for iPhone/iPad,Android and Windows 10(desktop & Mobile)(http://goo.gl/Sv3vfc)");
}else {
sendIntent.putExtra(Intent.EXTRA_TEXT, itemmodel.getTitle() + "\n" + itemmodel.getSharingurl() + "\n" + "\n" + "\n" + "Receive instant updates by installing Simplicity for iPhone/iPad,Android and Windows 10(desktop & Mobile)(http://goo.gl/Sv3vfc)");
} sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share using"));
break;
}
}
});
}
else {
if (holder instanceof LoadingViewHolder) {
LoadingViewHolder loadingViewHolder = (LoadingViewHolder) holder;
loadingViewHolder.progressBar.setIndeterminate(true);
}
}
}
public int getItemViewType(int position) {
ItemModel item = modelList.get(position);
if(item.getQtypemain().equalsIgnoreCase("photostories")){
return VIEW_TYPE_PHOTOSTORY;
}/*else if(item.getQtypemain().equalsIgnoreCase("radio")){
return VIEW_TYPE_RADIO;
}*/ else{
return modelList.get(position) == null ? VIEW_TYPE_LOADING : VIEW_TYPE_ITEM;
}
}
public void setOnLoadMoreListener(OnLoadMoreListener onLoadMoreListener) {
this.onLoadMoreListener = onLoadMoreListener;
}
public void setLoaded() {
loading = false;
}
public void onButtonPressed(String playurl, String title,String image) { if (mListener != null) { mListener.onFragmentInteraction(playurl,title,image); } }
}
public static class MyDialogFragment extends DialogFragment {
private String KEY_COMMENT = "comment";
private String KEY_TYPE = "qtype";
private String KEY_MYUID = "user_id";
private String KEY_POSTID = "id";
String URLCOMMENT = "http://simpli-city.in/request2.php?rtype=viewcomment&key=simples&id=";
String urlpost = "http://simpli-city.in/request2.php?rtype=comments&key=simples";
EditText commentbox;
Button post_review;
Button close_back;
JSONObject obj, objtwo;
JSONArray feedArray;
int ii, i;
TextView titles;
CoordinatorLayout mCoordinator;
private final String TAG_REQUEST = "MY_TAG";
List<ItemModels> commentlist = new ArrayList<ItemModels>();
//Need this to set the title of the app bar
CollapsingToolbarLayout mCollapsingToolbarLayout;
RecyclerViewAdapter rcAdapter;
ProgressDialog pdialog;
RequestQueue requestQueue;
private int requestCount = 1;
JsonObjectRequest jsonReq;
String URLTWO;
String bimage;
RecyclerView recycler;
LinearLayoutManager mLayoutManager;
String postid, myuserid,qtypevalue;
String description_comment;
SharedPreferences sharedpreferences;
public static final String mypreference = "mypref";
public static final String MYUSERID= "myprofileid";
public static final String USERNAME= "myprofilename";
public static final String USERIMAGE= "myprofileimage";
String my_profilename,my_profileimage,myprofileid;
public MyDialogFragment() {
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.MY_DIALOG);
}
@Override
public void onStart() {
super.onStart();
Dialog d = getDialog();
if (d != null) {
int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
d.getWindow().setLayout(width, height);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.taballcomments, container, false);
sharedpreferences = getActivity(). getSharedPreferences(mypreference,
Context.MODE_PRIVATE);
if (sharedpreferences.contains(MYUSERID)) {
myprofileid=sharedpreferences.getString(MYUSERID,"");
myprofileid = myprofileid.replaceAll("\\D+","");
}
if (sharedpreferences.contains(USERNAME)) {
my_profilename=sharedpreferences.getString(USERNAME,"");
}
if (sharedpreferences.contains(USERIMAGE)) {
my_profileimage=sharedpreferences.getString(USERIMAGE,"");
}
// titles = (TextView) root.findViewById(R.id.comments_title);
requestQueue = Volley.newRequestQueue(getActivity());
postid = getArguments().getString("POSTID");
myuserid = getArguments().getString("USERID");
qtypevalue=getArguments().getString("QTYPE");
String simplycity_title_fontPath = "fonts/Lora-Regular.ttf";;
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), simplycity_title_fontPath);
commentbox = (EditText) root.findViewById(R.id.comment_description);
post_review = (Button) root.findViewById(R.id.post_button);
close_back = (Button) root.findViewById(R.id.cancel_button);
// mCoordinator = (CoordinatorLayout) root.findViewById(R.id.root_coordinator); mCollapsingToolbarLayout = (CollapsingToolbarLayout) root.findViewById(R.id.collapsing_toolbar_layout);
recycler = (RecyclerView) root.findViewById(R.id.commentpagelist_recyclerview);
recycler.addItemDecoration(new DividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL));
recycler.setHasFixedSize(true);
recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
recycler.setNestedScrollingEnabled(false);
pdialog = new ProgressDialog(getActivity());
pdialog.show();
pdialog.setContentView(R.layout.custom_progressdialog);
pdialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// titles.setTypeface(tf);
// titles.setText("Comments");
post_review.setTypeface(tf);
post_review.setText("POST");
close_back.setTypeface(tf);
close_back.setText("Cancel");
close_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MyDialogFragment.this.dismiss();
}
});
post_review.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(myuserid!=null) {
pdialog = new ProgressDialog(getActivity());
pdialog.show();
pdialog.setContentView(R.layout.custom_progressdialog);
pdialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
try {
StringRequest comment_post_request = new StringRequest(Request.Method.POST, Configurl.api_new_url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("Res", response.toString().trim());
pdialog.dismiss();
if (response.equalsIgnoreCase("error")) {
Toast.makeText(getActivity(), response, Toast.LENGTH_LONG).show();
} else {
AddnewCommnent();
/*commentbox_editext.setText("");
AddnewCommnent();
scrollView.post(new Runnable() {
public void run() {
scrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});*/
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
description_comment = commentbox.getText().toString().trim();
Map<String, String> param = new Hashtable<String, String>();
String keytepe = "article";
Log.e("qty", keytepe);
param.put("Key", "Simplicity");
param.put("Token", "8d83cef3923ec6e4468db1b287ad3fa7");
param.put("rtype", "comment");
param.put("language", "2");
param.put("id", postid);
param.put("user_id", myuserid);
param.put("comment", description_comment);
param.put("qtype", qtypevalue);
return param;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
requestQueue.add(comment_post_request);
} catch (Exception e) {
}
}else {
Intent signin=new Intent(getActivity(),SigninpageActivity.class);
startActivity(signin);
getActivity().finish();
}
}
});
rcAdapter = new RecyclerViewAdapter(commentlist,recycler);
recycler.setAdapter(rcAdapter);
getData();
rcAdapter.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore() {
Log.e("haint", "Load More");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Log.e("haint", "Load More 2");
getData();
rcAdapter.setLoaded();
}
}, 2000);
}
});
return root;
}
public void AddnewCommnent(){
int curSize = rcAdapter.getItemCount();
ItemModels models=new ItemModels();
models.setName(my_profilename);
models.setProfilepic(my_profileimage);
models.setComment(description_comment);
commentlist.add(models);
recycler.setVisibility(View.VISIBLE);
rcAdapter.notifyDataSetChanged();
rcAdapter.notifyItemRangeInserted(curSize, commentlist.size());
}
public void dissmissDialog() {
// TODO Auto-generated method stub
if (pdialog != null) {
if (pdialog.isShowing()) {
pdialog.dismiss();
}
pdialog = null;
}
}
public void onDestroy() {
super.onDestroy();
dissmissDialog();
}
static class UserViewHolder extends RecyclerView.ViewHolder {
public TextView name, locations,commentsdecription;
public NetworkImageView imageview;
public UserViewHolder(View itemView) {
super(itemView);
// im = (ImageView) itemView.findViewById(R.id.imageViewlitle);
imageview = (NetworkImageView) itemView.findViewById(R.id.thumbnailfoodcategory);
name = (TextView) itemView.findViewById(R.id.name);
locations = (TextView) itemView.findViewById(R.id.location);
commentsdecription = (TextView) itemView.findViewById(R.id.all_page_descriptions);
}
}
static class LoadingViewHolder extends RecyclerView.ViewHolder {
public ProgressBar progressBar;
public LoadingViewHolder(View itemView) {
super(itemView);
progressBar = (ProgressBar) itemView.findViewById(R.id.progressBar1);
}
}
private void getData() {
StringRequest request=new StringRequest(Request.Method.POST, Configurl.api_new_url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("Res",response.toString());
try {
JSONObject object = new JSONObject(response.toString());
JSONArray array = object.getJSONArray("result");
String data = array.optString(1);
JSONArray jsonArray = new JSONArray(data.toString());
parseJsonFeed(jsonArray);
}catch (JSONException e){
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String>param=new HashMap<>();
param.put("Key", "Simplicity");
param.put("Token", "8d83cef3923ec6e4468db1b287ad3fa7");
param.put("rtype", "viewcomment");
param.put("language","2");
param.put("qtype",qtypevalue);
param.put("id",postid);
return param;
}
};
request.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 2, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
requestQueue.add(request);
}
private void parseJsonFeed(JSONArray response) {
try {
// feedArray = response.getJSONArray("result");
for (ii = 0; ii < response.length(); ii++) {
obj = (JSONObject) response.get(ii);
ItemModels model = new ItemModels();
//FeedItem model=new FeedItem();
String image = obj.isNull("image") ? null : obj
.getString("image");
model.setProfilepic(image);
model.setComment(obj.getString("comment"));
model.setPadate(obj.getString("date"));
model.setName(obj.getString("name"));
model.setId(obj.getString("user_id"));
commentlist.add(model);
}
// notify data changes to list adapater
rcAdapter.notifyDataSetChanged();
// notify data changes to list adapater
} catch (JSONException e) {
e.printStackTrace();
}
}
class ItemModels{
private String id,comment,padate,name,profilepic;
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPadate() {
return padate;
}
public void setPadate(String padate) {
this.padate = padate;
}
public String getProfilepic() {
return profilepic;
}
public void setProfilepic(String profilepic) {
this.profilepic = profilepic;
}
}
class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private LayoutInflater inflater;
ImageLoader mImageLoader;
private final int VIEW_TYPE_ITEM = 1;
private final int VIEW_TYPE_LOADING = 2;
private final int VIEW_TYPE_FEATURE = 0;
private boolean loading;
private OnLoadMoreListener onLoadMoreListener;
private int visibleThreshold = 5;
private int lastVisibleItem, totalItemCount;
Context context;
public RecyclerViewAdapter(List<ItemModels> students, RecyclerView recyclerView) {
commentlist = students;
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
final LinearLayoutManager linearLayoutManager = (LinearLayoutManager) recyclerView
.getLayoutManager();
recyclerView
.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView,
int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
totalItemCount = linearLayoutManager.getItemCount();
lastVisibleItem = linearLayoutManager
.findLastVisibleItemPosition();
if (!loading
&& totalItemCount <= (lastVisibleItem + visibleThreshold)) {
// End has been reached
// Do something
if (onLoadMoreListener != null) {
onLoadMoreListener.onLoadMore();
}
loading = true;
}
}
});
}
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater mInflater = LayoutInflater.from(parent.getContext());
if (viewType == VIEW_TYPE_ITEM) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.feed_item_comment_all, parent, false);
return new UserViewHolder(view);
} else if (viewType == VIEW_TYPE_LOADING) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.layout_loading_item, parent, false);
return new LoadingViewHolder(view);
}
return null;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof UserViewHolder) {
final UserViewHolder userViewHolder = (UserViewHolder) holder;
String simplycity_title_fontPath = "fonts/Lora-Regular.ttf";;
Typeface seguiregular = Typeface.createFromAsset(getActivity().getAssets(), simplycity_title_fontPath);
if (mImageLoader == null)
mImageLoader = MySingleton.getInstance(getActivity()).getImageLoader();
ItemModels itemmodel = commentlist.get(position);
userViewHolder.name.setText(itemmodel.getName());
userViewHolder.name.setTypeface(seguiregular);
userViewHolder.commentsdecription.setText(itemmodel.getComment());
userViewHolder.imageview.setDefaultImageResId(R.drawable.iconlogo);
userViewHolder.imageview.setErrorImageResId(R.drawable.iconlogo);
userViewHolder.imageview.setImageUrl(itemmodel.getProfilepic(), mImageLoader);
// userViewHolder.im.setVisibility(View.VISIBLE);
} else if (holder instanceof LoadingViewHolder) {
LoadingViewHolder loadingViewHolder = (LoadingViewHolder) holder;
loadingViewHolder.progressBar.setIndeterminate(true);
}
}
public void setOnLoadMoreListener(OnLoadMoreListener onLoadMoreListener) {
this.onLoadMoreListener = onLoadMoreListener;
}
public int getItemViewType(int position) {
return commentlist.get(position) == null ? VIEW_TYPE_LOADING : VIEW_TYPE_ITEM;
}
public void setLoaded() {
loading = false;
}
public int getItemCount() {
return commentlist.size();
}
}
}
}
| [
"kuppusamykaliyappan@gmail.com"
] | kuppusamykaliyappan@gmail.com |
5f6ecc9b5964ef43df6b7ea88c14d3e5bfb0f652 | a85627079a6f2c0653eb2f1f81686280faa8480c | /navbrid/src/test/java/com/zs/android/navbrid/ExampleUnitTest.java | 368152eb31d2460eda6951abfe76847a72bc4e6c | [] | no_license | zorosteven/AnTuerTuer | 2b237e030edbe5bb2259f8f6a5f2ebbbbc891b5f | 9f21a98a6bcca41455eb2634f2342f9c43e04665 | refs/heads/master | 2021-01-10T21:58:25.174663 | 2015-11-25T10:24:58 | 2015-11-25T10:24:58 | 42,656,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.zs.android.navbrid;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"zorosteven@gmail.com"
] | zorosteven@gmail.com |
2006bf3b42f3b17f63709e4a09def0f2d32315cd | 36b22198fbda941e8fe519ba48deb7b305999ad2 | /src/com/javarush/test/level36/lesson10/task01/Solution.java | d22db60ae68cdd76ba4a9e13b6201d160d97f141 | [] | no_license | VladislavKrets/JavaRushHomeWork | d44cac84c0a4b9637e9fd95a4fbc623c29afb301 | 97048dad0075d79a4746f73fb7e1511c2cc428f6 | refs/heads/master | 2021-01-21T16:48:06.256024 | 2017-05-20T18:07:43 | 2017-05-20T18:07:43 | 91,831,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package com.javarush.test.level36.lesson10.task01;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.DelayQueue;
/* Найти класс по описанию
1. Реализует интерфейс Queue
2. Используется при работе с трэдами
3. Из этой очереди элементы могут быть взяты только тогда, когда они заэкспарятся, их время задержки истекло
4. Головой очереди является элемент, который заэкспарился раньше всех
*/
public class Solution {
public static void main(String[] args) {
System.out.println(getExpectedClass());
}
public static Class getExpectedClass() {
return DelayQueue.class;
}
}
| [
"vlad-lollipop@ro.ru"
] | vlad-lollipop@ro.ru |
db9febd707ff16bb76bab47eb07160dbf6ff852a | 981e47db0716e21c4627b2928fad5fa7024030db | /src/com/class10/ArrayTask.java | c7d4383d5631e80d5e039d6f2525705cd46b6566 | [] | no_license | jerrytran/JavaBatchIV | 79dce8b11e9aa971f233a7ab813835b6e53decd0 | ef2c268b21f00a3770790a8c2f6b179c0dac910f | refs/heads/master | 2020-05-27T11:17:02.805200 | 2019-05-28T02:38:36 | 2019-05-28T02:38:36 | 179,190,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package com.class10;
public class ArrayTask {
public static void main(String[] args) {
String[] words= {"Java", "Saturday", "day", "coding", "Is"};
System.out.println(words[1] +" "+words[4] +" "+words[0] +" "+words[3]);
}
}
| [
"jerrytran3011@gmail.com"
] | jerrytran3011@gmail.com |
a8c9a2b2bdc6010272a2d30edaa8602d5b99b5c5 | 84e156edb40800866b625d3541119e970acad1e1 | /bitcamp-java-application4-server/v57_3/src/main/java/com/eomcs/lms/servlet/LessonAddServlet.java | 7ea565de571421cd6a28aefa1716db96ace8d1db | [] | no_license | Hecklebot/bitcamp-java-20190527 | c063803b02015ca0a45ef590b3d5ca1c25201285 | c22f695c788ab8da21f7148aa09ec477c57b2a50 | refs/heads/master | 2020-06-13T20:15:46.420583 | 2019-10-21T08:12:55 | 2019-10-21T08:12:55 | 194,775,337 | 2 | 0 | null | 2020-04-30T11:58:11 | 2019-07-02T02:41:01 | Java | UTF-8 | Java | false | false | 2,115 | java | package com.eomcs.lms.servlet;
import java.io.IOException;
import java.sql.Date;
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 org.springframework.context.ApplicationContext;
import com.eomcs.lms.dao.LessonDao;
import com.eomcs.lms.domain.Lesson;
@WebServlet("/lesson/add")
public class LessonAddServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private LessonDao lessonDao;
@Override
public void init() throws ServletException {
ApplicationContext appCtx =
(ApplicationContext) getServletContext().getAttribute("iocContainer");
lessonDao = appCtx.getBean(LessonDao.class);
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
response.setContentType("text/html;charset=UTF-8");
request.getRequestDispatcher("/jsp/lesson/form.jsp").include(request, response);
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
try {
Lesson lesson = new Lesson();
lesson.setTitle(request.getParameter("title"));
lesson.setContents(request.getParameter("contents"));
lesson.setStartDate(Date.valueOf(request.getParameter("startDate")));
lesson.setEndDate(Date.valueOf(request.getParameter("endDate")));
lesson.setTotalHours(Integer.parseInt(request.getParameter("totalHours")));
lesson.setDayHours(Integer.parseInt(request.getParameter("dayHours")));
lessonDao.insert(lesson);
response.sendRedirect("/lesson/list");
} catch (Exception e) {
request.setAttribute("message", "데이터 저장에 실패했습니다!");
request.setAttribute("refresh", "/lesson/list");
request.setAttribute("error", e);
request.getRequestDispatcher("/jsp/error.jsp").forward(request, response);
}
}
}
| [
"iuehakdrk@gmail.com"
] | iuehakdrk@gmail.com |
6fff1e28a9a900a41b29ae885c2d758472c7a001 | f209c6151b5f9199c739a7c2b600ff672f951440 | /MasteSlaveConn/src/main/com/app/connection/Server.java | c93976593c892f11bcd01bdaa639ec1f1ac913d4 | [] | no_license | mackap1/TestProj1 | 11c03b4a2fea419fc533f1d901e7a2d507ed4d80 | 06dd02c1f10ead3516e20c5a5eafdbd175d756b6 | refs/heads/master | 2021-02-09T02:07:42.528578 | 2020-03-03T11:47:45 | 2020-03-03T11:47:45 | 244,226,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package com.app.connection;
public class Server {
private String url;
private String user;
private String password;
private boolean isMaster;
public Server(String url, String user, String password, boolean isMaster) {
super();
this.url = url;
this.user = user;
this.password = password;
this.isMaster = isMaster;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isMaster() {
return isMaster;
}
public void setMaster(boolean isMaster) {
this.isMaster = isMaster;
}
}
| [
"mackap1@gmail.com"
] | mackap1@gmail.com |
6d70eb8356404f4000d4134ba1325f956341629f | 908c4519a4cf8b0ee18c84bf4d770d074f375944 | /src/Lab/Lab_6/BallWriter.java | aa0e46799ac227063eb9ae3c257ea942518e3f9b | [] | no_license | Jaejuna/Program_Component_Structure | b655d1bb6438dde98c3a107d86356692758ed9c0 | f8ed17c88c8321f343d88b667926e56fbe70c293 | refs/heads/master | 2023-02-12T08:51:16.694069 | 2021-01-01T11:38:10 | 2021-01-01T11:38:10 | 295,087,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package Lab.Lab_6;
import java.awt.*;
/** BallWriter - 움직이는 공을 그림 */
public class BallWriter {
private MovingBall ball_1, ball_2;
private Color balls_color_1; // 공의 색깔
private Color balls_color_2;
/** Constructor BallWriter
* @param x1 - 공 객체
* @param c1 - 공의 색깔 */
public BallWriter(MovingBall x1,MovingBall x2, Color c1, Color c2) {
ball_1 = x1;
ball_2 = x2;
balls_color_1 = c1;
balls_color_2 = c2;
}
/** paint - 공 그리기
* @param g - 그래픽스 펜 */
public void paintComponent(Graphics g) {
g.setColor(balls_color_1);
int radius1 = ball_1.radiusOf();
g.fillOval(ball_1.xPosition() - radius1, ball_1.yPosition() - radius1,
radius1 * 2, radius1 * 2);
g.setColor(balls_color_2);
int radius2 = ball_2.radiusOf();
g.fillOval(ball_2.xPosition() - radius2, ball_2.yPosition() - radius2,
radius2 * 2, radius2 * 2);
}
}
| [
"anayana9988@gmail.com"
] | anayana9988@gmail.com |
4f46e47d481fbb3652350070d79a09d979084ebb | 2456e8e95b28cb5afcd4e84e8cbb925a8a06818b | /src/main/java/hw7/RoboCat.java | b6e95ac2294d246181ac062f58b7e4d0283114eb | [] | no_license | IsmailovaFidan/HomeWork | 0b1d800729cf740916afbfa964679c2b5d4007e8 | 41afc654e73455df5ead3bc211770ea403d29a61 | refs/heads/master | 2021-04-21T05:38:12.609034 | 2020-03-27T18:42:57 | 2020-03-27T18:42:57 | 249,753,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package hw7;
public class RoboCat extends Pet implements Foul {
public Species species;
public RoboCat(Species species, String nickname, int age, int trickLevel, String[] habits){
super(nickname,age,trickLevel);
this.species=species;
}
@Override
public void response() {
System.out.println("I'm Robo Cat");
}
@Override
public void foul() {
System.out.println("I'm Robo Cat and i do foul");
}
}
| [
"fidan97ismailova@gmail.com"
] | fidan97ismailova@gmail.com |
436fad5959de9a7eddd46dd0048b1ba4724e493b | b36535b1ae576b90464b47e09c9f3f8547eeb7a5 | /language/src/main/java/com/atuldwivedi/jid/language/immutability/ImmutabilityTest2Problem1.java | 03b3c7c164e813f6ff48f1a49bb2d79dda187e1f | [] | no_license | AtulDwivedi/java-in-depth | 72fd03d91c18d0032f9b9b1e313140684f653900 | 0be64037eb7ffb1124e0f186ca8e72c97bba2448 | refs/heads/master | 2021-06-17T07:28:28.923598 | 2019-09-10T02:24:27 | 2019-09-10T02:24:27 | 182,778,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,764 | java | package com.atuldwivedi.jid.language.immutability;
public class ImmutabilityTest2Problem1 {
public static void main(String[] args) {
Address2 address = new Address2("Bangalore", "India");
Employee2 immutableEmployee = new Employee2(1001l, "Atul", address);
System.out.println("Before: " + immutableEmployee);
address.setCity("Mysore");
System.out.println("After: " + immutableEmployee);
}
}
final class Employee2 {
private final long id;
private final String name;
private final Address2 address;
public Employee2(long id, String name, Address2 address) {
this.id = id;
this.name = name;
this.address = address;
}
public long getId() {
return id;
}
public String getName() {
return name;
}
public Address2 getAddress() {
return address;
}
@Override
public String toString() {
return "Employee{" +
"id=" + id +
", name='" + name + '\'' +
", address=" + address +
'}';
}
}
class Address2 {
private String city;
private String country;
public Address2(String city, String country) {
this.city = city;
this.country = country;
}
public String getCity() {
return city;
}
public String getCountry() {
return country;
}
public void setCity(String city) {
this.city = city;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public String toString() {
return "Address{" +
"city='" + city + '\'' +
", country='" + country + '\'' +
'}';
}
}
| [
"atul16dwivedi@gmail.com"
] | atul16dwivedi@gmail.com |
11fe20845d812e53932323fa38b58aab82774fcf | 894ab7cfa570caf5a163eb11bd0415a8e108cb3d | /src/main/java/bits/draw3d/actor/Actor.java | 7901c191df3b8c146783b063f3b1d2c18409717c | [] | no_license | decamp/adraw | 2594f81ec4f13442d7a6a6135ad90fd188137628 | 206e5fa6c9fecd9a956c38e58f710905540b0dd9 | refs/heads/master | 2021-01-21T05:01:08.290546 | 2016-04-03T18:32:26 | 2016-04-03T18:32:26 | 42,014,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,001 | java | /*
* Copyright (c) 2014. Massachusetts Institute of Technology
* Released under the BSD 2-Clause License
* http://opensource.org/licenses/BSD-2-Clause
*/
package bits.draw3d.actor;
import bits.vec.*;
/**
* Represents an object with basic spatial properties.
*
* @author decamp
*/
public class Actor extends Trans3 implements DepthSortable, TransObject {
private static final int ROTATIONS_PER_NORMALIZATION = 100;
/**
* Local scaling 3-vector.
*/
public final Vec3 mScale = new Vec3( 1, 1, 1 );
/**
* 3-vector that may be used to hold position in
* normalized device coordinates for sorting.
*/
public final Vec3 mNormPos = new Vec3();
protected final Mat4 mWorkMat = new Mat4();
int mRotationCount = 0;
/**
* Translates object.
*/
public void translate( float tx, float ty, float tz ) {
Vec.addTo( tx, ty, tz, mPos );
}
/**
* Rotates the object about the specified axis.
* Rotation is applied AFTER existing rotation.
*
* @param rads Angle of rotation in radians.
* @param rx x-component of axis
* @param ry y-component of axis
* @param rz z-component of axis
*/
public void rotate( float rads, float rx, float ry, float rz ) {
if( Tol.approxZero( rads, Ang.PI ) ) {
return;
}
Mat.rotate( mRot, rads, rx, ry, rz, mRot );
if( ++mRotationCount > ROTATIONS_PER_NORMALIZATION ) {
normalizeRotation();
}
}
/**
* Rotates the object about the specified axis.
* Rotation is applied BEFORE existing rotation.
*
* @param rads Angle of rotation in radians.
* @param rx x-component of axis
* @param ry y-component of axis
* @param rz z-component of axis
*/
public void preRotate( float rads, float rx, float ry, float rz ) {
if( Tol.approxZero( rads, Ang.PI ) ) {
return;
}
Mat.preRotate( rads, rx, ry, rz, mRot, mRot );
if( ++mRotationCount > ROTATIONS_PER_NORMALIZATION ) {
normalizeRotation();
}
}
/**
* Scales the object size by the specified amount.
*/
public void scale( float sx, float sy, float sz ) {
mScale.x *= sx;
mScale.y *= sy;
mScale.z *= sz;
}
/**
* Computes full transform for this object: <br>
* translation * rotation * scaling. <br>
* This method is computes the transform directly and efficiently,
* using only 9 scalar multiplications.
*
* @param out Receives output 4x4 transform.
*/
public void computeTransform( Mat4 out ) {
Mat3 rot = mRot;
Vec3 pos = mPos;
out.m00 = mScale.x * rot.m00;
out.m10 = mScale.x * rot.m10;
out.m20 = mScale.x * rot.m20;
out.m30 = 0;
out.m01 = mScale.y * rot.m01;
out.m11 = mScale.y * rot.m11;
out.m21 = mScale.y * rot.m21;
out.m31 = 0;
out.m02 = mScale.z * rot.m02;
out.m12 = mScale.z * rot.m12;
out.m22 = mScale.z * rot.m22;
out.m32 = 0;
out.m03 = pos.x;
out.m13 = pos.y;
out.m23 = pos.z;
out.m33 = 1;
}
/**
* Normalize the current rotation matrix, ensuring
* transformation contains orthogonal axes and
* contains no translation or scaling.
* <p>
* This method is called automatically after every hundred rotations.
*/
public void normalizeRotation() {
mRotationCount = 0;
Mat.normalizeRotationMatrix( mRot );
}
public Vec3 normPosRef() {
return mNormPos;
}
public float normDepth() {
return mNormPos.z;
}
public void updateNormPos( Mat4 projViewMat ) {
Mat.mult( projViewMat, mPos, mNormPos );
}
public Vec3 pos() {
return mPos;
}
public Mat3 rot() {
return mRot;
}
}
| [
"decamp@users.noreply.github.com"
] | decamp@users.noreply.github.com |
a6eb1ff98e645a6d7a69851e7f4dcf2a91113708 | b0b852464cb878920428cbed63fa017ec62676ee | /src/com/nauj27/android/cylondetector/Utils.java | 7801b2ea0e8284462e50e52fa06fd3aaadfdb36e | [] | no_license | DraXus/cylon-detector | bf33a1bf71890a6c785379038e5d78cefec52835 | b9c762285f424a3664731d46b6294afa8f4003d1 | refs/heads/master | 2020-04-05T02:57:26.811824 | 2015-03-15T17:57:25 | 2015-03-15T17:57:25 | 32,275,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | /**
*
*/
package com.nauj27.android.cylondetector;
import android.graphics.Bitmap;
/**
* @author nauj27
* The Utils class contains utilities for CylonDetector.
*/
public class Utils {
/**
* See http://www.fourcc.org/yuv.php#NV21 for more information.
* We only read luminance for speed up the whole process.
* All colors of the image are set to the luminance value and
* this way we obtains a black and white image for processing.
*
* @param data The data array in NV21 (YCbCr_420_SP) format.
* @param width The photo width.
* @param height The photo height.
* @param bitmapConfig The desired Bitmap.Config format.
* @return Black and white bitmap decoded from NV21 input data.
*/
public static Bitmap getBitmapFromNV21(byte[] data, int width, int height, Bitmap.Config bitmapConfig) {
int grey = 0;
int pixelsNumber = width * height;
int[] colors = new int[pixelsNumber];
for (int pixel = 0; pixel < pixelsNumber; pixel++) {
grey = data[pixel] & 0xff;
colors[pixel] = 0xff000000 | (grey * 0x00010101);
}
Bitmap bitmap = Bitmap.createBitmap(colors, width, height, bitmapConfig);
return bitmap;
}
}
| [
"android@nauj27.com"
] | android@nauj27.com |
a1f39776b40c3768dd38b8d0ac6d6ee0b7e5c486 | b7dbeaca0cfee8033d0771c0aada27f001240d39 | /leyou-cart/src/main/java/com/leyou/controller/CartController.java | e5c720074042ca7a73d7140e765e12f7a7876da7 | [] | no_license | Xiaoshenshe/leyou2 | 4387b287c511798220117d215b2fecce9cd5d606 | cb966beae3aa9f4fc0b9b88883a355ac6f00bafa | refs/heads/master | 2022-12-23T03:28:36.864619 | 2021-01-27T03:18:45 | 2021-01-27T03:18:45 | 219,453,968 | 1 | 0 | null | 2022-12-16T00:39:20 | 2019-11-04T08:37:54 | Java | UTF-8 | Java | false | false | 1,590 | java | package com.leyou.controller;
import com.leyou.pojo.Cart;
import com.leyou.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.xml.ws.Action;
import java.util.List;
@Controller
public class CartController {
@Autowired
private CartService cartService;
/**
* 添加购物车
*
* @return
*/
@PostMapping
public ResponseEntity<Void> addCart(@RequestBody Cart cart) {
this.cartService.addCart(cart);
return ResponseEntity.ok().build();
}
/**
* 查询购物车列表
*
* @return
*/
@GetMapping
public ResponseEntity<List<Cart>> queryCartList() {
List<Cart> carts = this.cartService.queryCartList();
if (carts == null) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
}
return ResponseEntity.ok(carts);
}
@PutMapping
public ResponseEntity<Void> updateNum(@RequestBody Cart cart){
this.cartService.updateCarts(cart);
return ResponseEntity.noContent().build();
}
@DeleteMapping("{skuId}")
public ResponseEntity<Void> deleteCart(@PathVariable("skuId") String skuId) {
System.out.println("删除执行");
this.cartService.deleteCart(skuId);
return ResponseEntity.ok().build();
}
}
| [
"874403535@qq.com"
] | 874403535@qq.com |
195a9748c81a770c4334f598acccbedefbe92a0d | 145dcce397c327fea5f4ae9aa586e00566e1b231 | /src/main/java/com/letsave/finance/model/TransactionDTO.java | 3546a8a187758db477bd62bccd2d7cbf734fbc2c | [] | no_license | hoagnhat/LetSave | 29489bf57c73dbf92abb3dbc691cb37548c6c048 | 5554602156780bce0a302a5b0d00b5e009a6a5ab | refs/heads/master | 2023-06-23T15:17:28.724790 | 2021-07-24T05:07:06 | 2021-07-24T05:07:06 | 379,537,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package com.letsave.finance.model;
/*
@Created: 23 / 06 / 2021 - 11:58 AM
@Author: Dummy
*/
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TransactionDTO {
private long id;
private String type;
private float amount;
private long categoryId;
private String date;
private String note;
private String categoryName;
private String categoryImage;
}
| [
"hahng.nhat@gmail.com"
] | hahng.nhat@gmail.com |
c7392542eadf21789ebf08e49e027a005146ede8 | 13c2d3db2d49c40c74c2e6420a9cd89377f1c934 | /program_data/JavaProgramData/50/1057.java | 1bc3c10628c36a14da22dfd68a50aedbcfe73fd9 | [
"MIT"
] | permissive | qiuchili/ggnn_graph_classification | c2090fefe11f8bf650e734442eb96996a54dc112 | 291ff02404555511b94a4f477c6974ebd62dcf44 | refs/heads/master | 2021-10-18T14:54:26.154367 | 2018-10-21T23:34:14 | 2018-10-21T23:34:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package <missing>;
public class GlobalMembers
{
public static int Dijitian(int month,int day)
{
int days = 0;
int i;
for (i = 1;i < month;i++)
{
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
{
days += 31;
}
else
{
if (i == 2)
{
days += 28;
}
else
{
days += 30;
}
}
}
days += day;
return days;
}
public static int Main()
{
int w;
int i;
String tempVar = ConsoleInput.scanfRead();
if (tempVar != null)
{
w = Integer.parseInt(tempVar);
}
for (i = 1;i < 13;i++)
{
if ((Dijitian(i, 13) - 1) % 7 + w == 5 || (Dijitian(i, 13) - 1) % 7 + w == 12)
{
System.out.printf("%d\n",i);
}
}
return 0;
}
}
| [
"y.yu@open.ac.uk"
] | y.yu@open.ac.uk |
29bee5d10cce37091c901b0cfc175725865e1451 | a58c4186ecd588879cbcb4e273637a3746b55281 | /Projeto-Integrador/src/com/yourcodelab/bean/EmpregadoManagedBean.java | a07f180050d9a272c03e04fc92d0d84d8a6fe57b | [
"MIT"
] | permissive | jccr2017/MeuEmpregado | c0842a1e6151cd277987472f21bf90a32be68c06 | fd156dc00308c93f82e1963bebafcec12f3655ae | refs/heads/master | 2021-01-20T22:51:40.202026 | 2017-11-19T01:54:22 | 2017-11-19T01:54:22 | 101,826,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,440 | java | package com.yourcodelab.bean;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import com.yourcodelab.model.Empregado;
import com.yourcodelab.model.Status;
import com.yourcodelab.service.EmpregadoService;
@ManagedBean(name="empregadoManagedBean")
@SessionScoped
public class EmpregadoManagedBean {
private Empregado empregado;
private List<Empregado> listEmpregado;
private EmpregadoService serviceempregado;
private Status status;
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public EmpregadoManagedBean() throws ClassNotFoundException, SQLException, IOException{
serviceempregado = new EmpregadoService();
empregado = new Empregado(0, "", "","", "","", "","", "","", "","", "","", "","",status,"");
listEmpregado = serviceempregado.listAll();
}
//////////////////////////////////////////
/*
public String searchByNameAction() throws SQLException, ClassNotFoundException, IOException{
System.out.println("Searching...");
this.listCustomer = service.findCustomerByName(customer.getName());
return "index";
}
public String insertCustomerAction() throws SQLException, ClassNotFoundException, IOException{
System.out.println("Saving...");
service.insertCustomer(customer);
this.listCustomer = service.listAll();
return "index";
}
public String updateCustomerAction() throws SQLException, ClassNotFoundException, IOException{
System.out.println("Updating...");
service.updateCustomer(customer);
this.listCustomer = service.listAll();
return "index";
}
public String deleteCustomerAction() throws SQLException, ClassNotFoundException, IOException {
System.out.println("Deleting...");
service.deleteCustomer(customer);
listCustomer = service.listAll();
return "index";
}
*/
/////////////////////////////////////////////
public Empregado getEmpregado() {
return empregado;
}
public void setEmpregado(Empregado Empregado) {
this.empregado = Empregado;
}
public List<Empregado> getListEmpregado() {
return listEmpregado;
}
public void setListEmpregado(List<Empregado> listEmpregado) {
this.listEmpregado = listEmpregado;
}
}
| [
"Programador@192.168.88.132"
] | Programador@192.168.88.132 |
b172ce111cf961cdbc9b5286587437120ccc5d91 | 076b8e079f885488d74ad9209429c6ed964bd171 | /servlet_demo/src/com/servlet/entity/User.java | 1fd43b2a4e4904d4abed34cb5821134d704ceba4 | [] | no_license | jinrenyu/JavaEE | b987cddb53ee9cf9f58de60aa15c7fa5053579bd | 6d6d4bd62160958d55167e59103e9768cc172396 | refs/heads/master | 2020-03-20T09:12:46.597602 | 2018-06-14T08:56:31 | 2018-06-14T08:56:31 | 137,331,180 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,979 | java | package com.servlet.entity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 实体类一般都要求是一个标准的JavaBean(4个基本要求):
* 1. 所有的成员都必须使用private(私有)进行修饰
* 2. 私有的成员必须提供public(公共的)修饰的set/get方法, 并且
* 命名必须满足(比如成员名叫abc): setAba()/getAbc()
* 3. 如果成员类型是boolean类型: 可以使用isAbc()代替getAbc()(不推荐)
* 4. 必须提供一个无参的构造函数
* 本类用来演示
* @author Chris
*
* 2017年5月10日上午9:25:37
*/
@Entity
@Table(name="t_user")
public class User implements Serializable {
private static final long serialVersionUID = -81127870535360488L;
/*
* 用户主键ID
*/
private Integer id;
/*
* 用户名
*/
private String username;
/*
* 用户密码
*/
private String password;
public User() {
super();
}
public User(String username, String password) {
super();
this.username = username;
this.password = password;
}
public User(Integer id, String username, String password) {
super();
this.id = id;
this.username = username;
this.password = password;
}
@Id
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Column
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("User [id=");
builder.append(id);
builder.append(", username=");
builder.append(username);
builder.append(", password=");
builder.append(password);
builder.append("]");
return builder.toString();
}
}
| [
"1526118253@qq.com"
] | 1526118253@qq.com |
f67d2fc68b1a35f9f57fcfec39dcf2fb9c0e087f | f7de8016aad6a655303e176b924b2edde16646fa | /medinin-app-android-master/app/src/main/java/com/medinin/medininapp/activities/UserSignUpPasscode.java | 57d8beae040c854cf7f8d1e20054a633bb4506ea | [] | no_license | medinin/andrepo | c65fe8aa6016b60c25f5c67c1195322eabe5b940 | 74e70be4004266ac2e8687d9101923cbd6d1492f | refs/heads/master | 2020-06-18T08:36:30.546078 | 2019-07-10T14:14:16 | 2019-07-10T14:14:16 | 196,235,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,812 | java | package com.medinin.medininapp.activities;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.medinin.medininapp.R;
public class UserSignUpPasscode extends AppCompatActivity {
private EditText passCode1, passCode2, passCode3, passCode4,
confirmPassCode1, confirmPassCode2, confirmPassCode3, confirmPassCode4;
private TextView nextBtn, skipBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_sign_up_passcode);
//tab links
TextView loginTabLink = (TextView) findViewById(R.id.loginTabLink);
loginTabLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), UserPassCodeLogin.class);
startActivity(intent);
}
});
//current page events
nextBtn = (TextView) findViewById(R.id.nextBtn);
skipBtn = (TextView) findViewById(R.id.skipBtn);
nextBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), AllPatients.class);
startActivity(intent);
}
});
skipBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), AllPatients.class);
startActivity(intent);
}
});
}
}
| [
"sumeeth@pinlab.in"
] | sumeeth@pinlab.in |
043a71f094847b07f9051305357e442d469be727 | 3e2cadcfc0cc89615e530e8cb388aa9d717ede1d | /src/test/java/org/hamster/weixinmp/test/service/WxGroupServceTest.java | e3077d3c5649a111857c19ebf6b830c0f8638648 | [
"Apache-2.0"
] | permissive | sugarbyheart/weixin-shopping | edbb45a80a79f87352fdfed273bb07f88c36ce5e | ea8d9b537b0ccb850eb1da9d83db413f9c0c3aee | refs/heads/master | 2020-03-14T01:22:34.861240 | 2018-05-24T15:34:34 | 2018-05-24T15:34:34 | 131,375,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,246 | java | /**
*
*/
package org.hamster.weixinmp.test.service;
import java.util.List;
import org.hamster.weixinmp.dao.entity.user.WxGroupEntity;
import org.hamster.weixinmp.exception.WxException;
import org.hamster.weixinmp.service.WxAuthService;
import org.hamster.weixinmp.service.WxUserGroupService;
import org.hamster.weixinmp.test.base.AbstractWxServiceTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author grossopaforever@gmail.com
* @version Jan 1, 2014
*
*/
public class WxGroupServceTest extends AbstractWxServiceTest {
@Autowired
private WxAuthService authService;
@Autowired
private WxUserGroupService userGroupService;
@Test
public void testAll() throws WxException {
WxGroupEntity newgroup = userGroupService.remoteGroupsCreate(accessToken, "API测试组");
List<WxGroupEntity> groups = userGroupService.remoteGroupsGet(accessToken);
boolean found = false;
for (WxGroupEntity group : groups) {
if (group.getName().equals(newgroup.getName())) {
found = true;
}
}
if (found == false) {
throw new WxException("not found newly created group!");
}
userGroupService.remoteGroupsUpdate(accessToken, newgroup.getWxId(), "API测试组2");
}
}
| [
"subaihua.tom@gmail.com"
] | subaihua.tom@gmail.com |
8c5941329e4861d4fe3c5c55d36a21dc10e6dcac | e57327d8549de9bdd5e0942f4a3ce12089e1e90a | /mvp02/src/main/java/com/example/mvp02/model/RegisterModel.java | c9b7fa460ed6b0b1574079e0f4963098088d4582 | [] | no_license | qinmingxu/MyApplication | 4f42c26a932faee667e858e5cb38319f254ac246 | 5291201e472f38c03c043aec6838cf24167265e7 | refs/heads/master | 2021-08-27T21:23:29.783247 | 2017-12-10T11:17:27 | 2017-12-10T11:17:27 | 108,837,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,211 | java | package com.example.mvp02.model;
import android.os.Handler;
import android.util.Log;
import com.example.mvp02.net.OkHttpUtils;
import com.example.mvp02.net.onNetListener;
import com.example.mvp02.presenter.Api;
import java.io.IOException;
import java.util.Map;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
/**
* Created by wan on 2017/12/9.
*/
public class RegisterModel implements RegisterListener{
private Handler handler = new Handler();
public void register(Map<String,String> parms, final onNetListener onNetListener){
OkHttpUtils.getOkHttpUtils().doPost(Api.REGISTER, parms, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
onNetListener.onfailue(e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
final String string = response.body().string();
handler.post(new Runnable() {
@Override
public void run() {
onNetListener.onSuccess(string);
}
});
}
});
}
}
| [
"921273884@qq.com"
] | 921273884@qq.com |
ac59737929577cc7d0f2052bceb0938cf55382cd | 9ecf9cca090d089ea719a05616c9915ef440b6e6 | /geektime-xmg-lessons-studying/stage-0/user-platform-V1/my-cache/src/test/java/cache/event/TestCacheEntryListener.java | 5410c5697da1afe33c3b308541a5749c707c4c41 | [
"Apache-2.0"
] | permissive | XJWen/geektime-lessons-stduying | 0a64252618829158be765ca605982c1c2150486a | 0613b963b2d3cc3f636c2fd0d359867bb8108a39 | refs/heads/master | 2023-08-06T06:05:55.974241 | 2021-10-07T15:30:53 | 2021-10-07T15:30:53 | 343,988,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,623 | 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 cache.event;
import javax.cache.configuration.CacheEntryListenerConfiguration;
import javax.cache.configuration.Factory;
import javax.cache.event.*;
/**
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
* @since
*/
public class TestCacheEntryListener<K, V> implements CacheEntryCreatedListener<K, V>, CacheEntryUpdatedListener<K, V>,
CacheEntryExpiredListener<K, V>, CacheEntryRemovedListener<K, V>, CacheEntryListenerConfiguration<K, V> {
private CacheEntryEvent<K, V> cacheEntryEvent;
private boolean oldValueRequired = true;
private boolean synchronous = true;
public TestCacheEntryListener() {
}
@Override
public void onCreated(Iterable<CacheEntryEvent<? extends K, ? extends V>> cacheEntryEvents) throws CacheEntryListenerException {
handleEvents("onCreated", cacheEntryEvents);
}
@Override
public void onExpired(Iterable<CacheEntryEvent<? extends K, ? extends V>> cacheEntryEvents) throws CacheEntryListenerException {
handleEvents("onExpired", cacheEntryEvents);
}
@Override
public void onRemoved(Iterable<CacheEntryEvent<? extends K, ? extends V>> cacheEntryEvents) throws CacheEntryListenerException {
handleEvents("onRemoved", cacheEntryEvents);
}
@Override
public void onUpdated(Iterable<CacheEntryEvent<? extends K, ? extends V>> cacheEntryEvents) throws CacheEntryListenerException {
handleEvents("onUpdated", cacheEntryEvents);
}
private void handleEvents(String source, Iterable<CacheEntryEvent<? extends K, ? extends V>> cacheEntryEvents) {
cacheEntryEvents.forEach(event -> handleEvent(source, event));
}
private void handleEvent(String source, CacheEntryEvent<? extends K, ? extends V> event) {
this.cacheEntryEvent = (CacheEntryEvent<K, V>) event;
System.out.printf("[Thread : %s] %s - %s\n", Thread.currentThread().getName(), source, event);
}
public CacheEntryEvent<K, V> getCacheEntryEvent() {
CacheEntryEvent<K, V> event = cacheEntryEvent;
this.cacheEntryEvent = null;
return event;
}
@Override
public Factory<CacheEntryListener<? super K, ? super V>> getCacheEntryListenerFactory() {
return () -> this;
}
@Override
public boolean isOldValueRequired() {
return oldValueRequired;
}
@Override
public Factory<CacheEntryEventFilter<? super K, ? super V>> getCacheEntryEventFilterFactory() {
return () -> e -> true;
}
@Override
public boolean isSynchronous() {
return synchronous;
}
public void setOldValueRequired(boolean oldValueRequired) {
this.oldValueRequired = oldValueRequired;
}
public void setSynchronous(boolean synchronous) {
this.synchronous = synchronous;
}
}
| [
"13640396937@163.com"
] | 13640396937@163.com |
3f023e847d0e7645220700ca333a775fdca37ab6 | 8c31c6738813d754df999a91546bbfb0acfd9dbf | /witkey-tools/src/main/java/co/zhenxi/tools/rest/UnifiedorderController.java | 76146b1e70ad6df534e83965dc9b15eeb8d779c3 | [
"Apache-2.0"
] | permissive | edjian/witkey | 760062576c84e78ca5da108a49fc389169fe70e9 | 4b32d0c4c321bc56483851d0444c03d66aa8be0d | refs/heads/master | 2023-01-10T10:35:59.911949 | 2020-11-09T06:25:26 | 2020-11-09T06:25:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,110 | java | /**
* Copyright (C) 2018-2020
* All rights reserved, Designed By 臻希
* 注意:
* 本软件为臻希开发研制
*/
package co.zhenxi.tools.rest;
import java.util.Arrays;
import co.zhenxi.dozer.service.IGenerator;
import lombok.AllArgsConstructor;
import co.zhenxi.logging.aop.log.Log;
import co.zhenxi.tools.domain.Unifiedorder;
import co.zhenxi.tools.service.UnifiedorderService;
import co.zhenxi.tools.service.dto.UnifiedorderQueryCriteria;
import co.zhenxi.tools.service.dto.UnifiedorderDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @author Guoxm
* @date 2020-07-18
*/
@AllArgsConstructor
@Api(tags = "微信统一服务管理")
@RestController
@RequestMapping("/api/unifiedorder")
public class UnifiedorderController {
private final UnifiedorderService unifiedorderService;
private final IGenerator generator;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('admin','unifiedorder:list')")
public void download(HttpServletResponse response, UnifiedorderQueryCriteria criteria) throws IOException {
unifiedorderService.download(generator.convert(unifiedorderService.queryAll(criteria), UnifiedorderDto.class), response);
}
@GetMapping
@Log("查询微信统一服务")
@ApiOperation("查询微信统一服务")
@PreAuthorize("@el.check('admin','unifiedorder:list')")
public ResponseEntity<Object> getUnifiedorders(UnifiedorderQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(unifiedorderService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增微信统一服务")
@ApiOperation("新增微信统一服务")
@PreAuthorize("@el.check('admin','unifiedorder:add')")
public ResponseEntity<Object> create(@Validated @RequestBody Unifiedorder resources){
return new ResponseEntity<>(unifiedorderService.save(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改微信统一服务")
@ApiOperation("修改微信统一服务")
@PreAuthorize("@el.check('admin','unifiedorder:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody Unifiedorder resources){
unifiedorderService.updateById(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除微信统一服务")
@ApiOperation("删除微信统一服务")
@PreAuthorize("@el.check('admin','unifiedorder:del')")
@DeleteMapping
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
Arrays.asList(ids).forEach(id->{
unifiedorderService.removeById(id);
});
return new ResponseEntity<>(HttpStatus.OK);
}
}
| [
"guoxinming1001@163.com"
] | guoxinming1001@163.com |
e181dbbe4bd243f2c0c1839d38ceeeac04e1e69e | 3219082f7d4b8c7a2367fb762f779d31211d5303 | /src/nssc/server/NsscServiceImpl.java | 1db1a553a518d6f44ad105a052906c08cad37a2f | [] | no_license | GraceTBC/Nssc | f667290b27b92029dd4f7feee9c9db5d76eac492 | 6eb43e2e3b706741d37e104b3bd6e6d6bdea993a | refs/heads/master | 2021-01-18T04:08:20.472153 | 2012-10-22T14:10:30 | 2012-10-22T14:10:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,650 | java | package nssc.server;
import java.util.List;
import nssc.client.NsscService;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.FetchOptions;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.datastore.Query.Filter;
import com.google.appengine.api.datastore.Query.FilterPredicate;
import com.google.appengine.api.datastore.Query.FilterOperator;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@SuppressWarnings("serial")
public class NsscServiceImpl extends RemoteServiceServlet implements
NsscService {
private DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
@Override
public String getText(String text) {
return text + " from the server side";
}
@Override
public Boolean dataSetUp() {
try {
setUpDataStore();
return true;
} catch (Exception e) {
return false;
}
}
private void setUpDataStore() {
this.addToDataStore("disclaimer", "All results are merely estimates and the actual expenditure might be different. ");
this.addToDataStore("note", "All formulars for calculations are taken from the sample calculator on Blackboard. ");
this.addNumbersToDataStore("sunlight", 4.67, 4.44, 4.81, 4.12, 4.62);
this.addNumbersToDataStore("feedInAGL", 0.0862, 0.0685, 0.08, 0.08, 0.098);
this.addNumbersToDataStore("rateAGL", 0.274, 0.2905, 0.2327, 0.2241, 0.3487);
this.addNumbersToDataStore("feedInOrigin", 0.0795, 0.06, 0.08, 0.08, 0.098);
this.addNumbersToDataStore("rateOrigin", 0.2702, 0.2721, 0.2450, 0.2093, 0.3543);
}
private void addToDataStore(String name, String content) {
Entity entity = new Entity("info", name);
entity.setProperty("name", name);
entity.setProperty("content", content);
datastore.put(entity);
}
private void addNumbersToDataStore(String name, Double other, Double nsw, Double qld, Double vic, Double sa) {
Entity entity = new Entity("dataSet", name);
entity.setProperty("name", name);
entity.setProperty("other", other);
entity.setProperty("nsw", nsw);
entity.setProperty("qld", qld);
entity.setProperty("vic", vic);
entity.setProperty("sa", sa);
datastore.put(entity);
}
@Override
public String getInfo() {
Query query = new Query("info");
StringBuilder sb = new StringBuilder();
// Filter filter =
// new FilterPredicate("name", FilterOperator.EQUAL, "disclaimer");
//
// query.setFilter(filter);
List<Entity> infos = datastore.prepare(query).asList(FetchOptions.Builder.withDefaults());
for (Entity info : infos) {
sb.append(info.getProperty("content").toString());
}
return sb.toString();
}
@Override
public Double[] getDataSet(String name) {
Query query = new Query("dataSet");
Double[] temp = new Double[5];
Filter filter =
new FilterPredicate("name", FilterOperator.EQUAL, name);
query.setFilter(filter);
List<Entity> dataSets = datastore.prepare(query).asList(FetchOptions.Builder.withDefaults());
for (Entity info : dataSets) {
temp[0] = Double.parseDouble(info.getProperty("other").toString());
temp[1] = Double.parseDouble(info.getProperty("nsw").toString());
temp[2] = Double.parseDouble(info.getProperty("qld").toString());
temp[3] = Double.parseDouble(info.getProperty("vic").toString());
temp[4] = Double.parseDouble(info.getProperty("sa").toString());
}
return temp;
}
}
| [
"zhouxixin@gmail.com"
] | zhouxixin@gmail.com |
e778ef0a23fd5c90c8194be0c3e0f2e169f9143b | 24cbf77ac22d15f10925e5ff381be584f126cc20 | /做题调试/src/InversePairs.java | 9a7aebd72756f69051d1fea5b3beb1ced3c9c502 | [] | no_license | wly000/Algorithms_Data_Structure | 06c34a90fc0ac3131e13b35f43738fcae694b8ff | 1c947cdf1b4044812e994dbe6d4baaff45ea5588 | refs/heads/master | 2020-09-12T12:57:19.002063 | 2019-11-19T12:07:20 | 2019-11-19T12:07:20 | 222,432,511 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | /**
* @author leahy(583310958 @ qq.com)
* @date 2019/11/18 15:10
*/
public class InversePairs {
public static void main(String[] args) {
}
public int InversePairs(int [] array) {
if(array==null||array.length==0)
{
return 0;
}
int[] copy = new int[array.length];
for(int i=0;i<array.length;i++)
{
copy[i] = array[i];
}
int count = InversePairsCore(array,copy,0,array.length-1);//数值过大求余
return count;
}
private int InversePairsCore(int[] array,int[] copy,int low,int high)
{
if(low==high)
{
return 0;
}
int mid = (low+high)>>1;
int leftCount = InversePairsCore(array,copy,low,mid)%1000000007;
int rightCount = InversePairsCore(array,copy,mid+1,high)%1000000007;
int count = 0;
int i=mid;
int j=high;
int locCopy = high;
while(i>=low&&j>mid)
{
if(array[i]>array[j])
{
count += j-mid;
copy[locCopy--] = array[i--];
if(count>=1000000007)//数值过大求余
{
count%=1000000007;
}
}
else
{
copy[locCopy--] = array[j--];
}
}
for(;i>=low;i--)
{
copy[locCopy--]=array[i];
}
for(;j>mid;j--)
{
copy[locCopy--]=array[j];
}
for(int s=low;s<=high;s++)
{
array[s] = copy[s];
}
return (leftCount+rightCount+count)%1000000007;
}
} | [
"583310958@qq.com"
] | 583310958@qq.com |
470a6895eaada7bb55cf1e878eb1f67005a68fd5 | cd5722a3b5d3bc61eb6c2ef032bf6199f850e320 | /spring-example/spring-orm-mybatis/src/main/java/org/michaelliu/demo/spring/mybatis/handler/DateTypeHandler.java | be6f7a6337cf20a20417382b54d625432cd5573e | [] | no_license | techgeeker/spring | 9f36f8e339c22c03aaa27df6cca69c4d0b9585ee | 77485462d91b512ade3464cd40e01a2fad6c2253 | refs/heads/master | 2021-01-23T16:05:08.350669 | 2016-08-11T15:03:27 | 2016-08-11T15:03:27 | 54,457,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package org.michaelliu.demo.spring.mybatis.handler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.TypeHandler;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
/**
* Created by Michael on 7/12/16.
*/
public class DateTypeHandler implements TypeHandler {
private static final Log log = LogFactory.getLog(DateTypeHandler.class);
@Override
public void setParameter(PreparedStatement preparedStatement, int i, Object o, JdbcType jdbcType) throws SQLException {
}
@Override
public Object getResult(ResultSet resultSet, String s) throws SQLException {
return timestampFormat(resultSet.getTimestamp(s));
}
@Override
public Object getResult(ResultSet resultSet, int i) throws SQLException {
return timestampFormat(resultSet.getTimestamp(i));
}
@Override
public Object getResult(CallableStatement callableStatement, int i) throws SQLException {
return timestampFormat(callableStatement.getTimestamp(i));
}
private Object timestampFormat(Timestamp timestamp) {
log.info("timestamp is: " + timestamp);
String dateString = "";
if (timestamp != null) {
dateString = timestamp.toString().substring(0, 19);
}
log.info("date converts to string: " + dateString);
return dateString;
}
}
| [
"baidu@MacBook-Pro.local"
] | baidu@MacBook-Pro.local |
c253fd2a14e55252320e69206fadb446edc35931 | 2374799f0a702720a566babd4497c37cc30ddb31 | /src/main/java/com/astontech/hr/controllers/IndexController.java | d142bec51b47b3ad1a9c28e5581b4cfe05986d14 | [] | no_license | carloszubiran/com.astontech.hr | cbf78785d95240031c2e5120da0179c479f3e069 | 3bcb1b3b8a480fa9e1fede96f5d3257436461d67 | refs/heads/master | 2021-01-19T00:25:14.404130 | 2016-06-21T21:52:48 | 2016-06-21T21:52:48 | 60,190,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.astontech.hr.controllers;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by Carlos Zubiran on 5/31/2016.
*/
@org.springframework.stereotype.Controller
public class IndexController {
@RequestMapping(value = "/")
public String index() {
return "index";
}
@RequestMapping(value = "/login")
public String login() {
return "login";
}
}
| [
"carloszubiran@gmail.com"
] | carloszubiran@gmail.com |
a830d2400fe3f94a332a20ca0ecf5c48c45e02b2 | 8de5f7c64cff4ac0c0dc99f132682956ad383ee9 | /src/main/java/com/miinaroland/dao/PersonSearchDAO.java | 2a96621da4389b1382b274505b7504aca05afec4 | [] | no_license | RolandTalvar/subjects | 4ec6df6fa0e35c5e4587b6727a8125f11b954452 | 80a6bb1860059787504c2dec0e7bd5c813326915 | refs/heads/master | 2021-01-18T16:32:52.805595 | 2016-06-16T13:00:17 | 2016-06-16T13:00:17 | 59,360,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,754 | java | package com.miinaroland.dao;
import com.miinaroland.model.Person;
import org.springframework.stereotype.Repository;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by miinaroland on 06/06/16.
*/
@Repository
public class PersonSearchDAO {
static final String JDBC_DRIVER = "org.postgresql.Driver";
static final String DB_URL = "jdbc:postgresql://localhost:5432/dkf6fokg3qu1e";
static final String USER = "xeaizttgmawsfi";
static final String PASS = "YaUL6jwiwodWgre75rugIUyRac";
List<Person> personList;
List<Long> personIdList;
public List<Long> getPersonIdsBySearch(String firstName, String lastName, String identityCode, java.sql.Date birthDate,
String country, String county, String townVillage, String streetAddress, String zipcode,
String contactValueText, String attributeValueText, Long attributeValueNumber, java.sql.Date attributeValueDate, int subjectType) {
personIdList = new ArrayList<>();
Connection connection = null;
Statement statement = null;
try {
Class.forName(JDBC_DRIVER);
connection = DriverManager.getConnection(DB_URL, USER, PASS);
statement = connection.createStatement();
String sql = "";
if(subjectType == 1) {
sql = "SELECT P.person FROM " +
"(SELECT * " +
"FROM person " +
"INNER JOIN address " +
"ON person.person=address.subject_fk " +
"INNER JOIN contact " +
"ON person.person=contact.subject_fk " +
"INNER JOIN subject_attribute " +
"ON person.person=subject_attribute.subject_fk " +
"WHERE address.subject_type_fk=1" +
" AND contact.subject_type_fk=1" +
" AND subject_attribute.subject_type_fk=" + subjectType +
" AND ";
} else if (subjectType == 3) {
sql = "SELECT P.person FROM " +
"(SELECT * " +
"FROM employee " +
"INNER JOIN person ON person.person=employee.person_fk " +
"INNER JOIN address ON person.person=address.subject_fk " +
"INNER JOIN contact ON person.person=contact.subject_fk " +
"INNER JOIN subject_attribute ON employee.employee=subject_attribute.subject_fk " +
"WHERE address.subject_type_fk=1 " +
"AND contact.subject_type_fk=1 " +
"AND subject_attribute.subject_type_fk=3 " +
"AND ";
} else if (subjectType == 4) {
sql = "SELECT P.person FROM " +
"(SELECT * " +
"FROM customer " +
"INNER JOIN person ON person.person=customer.subject_fk " +
"INNER JOIN address ON person.person=address.subject_fk " +
"INNER JOIN contact ON person.person=contact.subject_fk " +
"INNER JOIN subject_attribute ON customer.customer=subject_attribute.subject_fk " +
"WHERE address.subject_type_fk=1 " +
"AND contact.subject_type_fk=1 " +
"AND subject_attribute.subject_type_fk=4 " +
"AND ";
}
// Person fields
if (firstName != null) {
sql = sql.concat(" UPPER(person.first_name) LIKE UPPER('" + firstName + "%') AND ");
}
if (lastName != null) {
sql = sql.concat(" UPPER(person.last_name) LIKE UPPER('" + lastName + "%') AND ");
}
if (identityCode != null) {
sql = sql.concat(" UPPER(person.identity_code) LIKE UPPER('" + identityCode + "%') AND ");
}
if (birthDate != null) {
sql = sql.concat(" person.birth_date='" + birthDate + "' AND ");
}
// Address fields
if (country != null) {
sql = sql.concat(" UPPER(address.country) LIKE UPPER('" + country + "%') AND ");
}
if (county != null) {
sql = sql.concat(" UPPER(address.county) LIKE UPPER('" + county + "%') AND ");
}
if (townVillage != null) {
sql = sql.concat(" UPPER(address.town_village) LIKE UPPER('" + townVillage + "%') AND ");
}
if (streetAddress != null) {
sql = sql.concat(" UPPER(address.street_address) LIKE UPPER('" + streetAddress + "%') AND ");
}
if (zipcode != null) {
sql = sql.concat(" UPPER(address.zipcode) LIKE UPPER('" + zipcode + "%') AND ");
}
// Contact fields
if (contactValueText != null) {
sql = sql.concat(" UPPER(contact.value_text) LIKE UPPER('" + contactValueText + "%') AND ");
}
// Subject attribute fields
if (attributeValueText != null) {
sql = sql.concat(" UPPER(subject_attribute.value_text) LIKE UPPER('" + attributeValueText + "%') AND ");
}
if (attributeValueNumber != null) {
sql = sql.concat(" subject_attribute.value_number='" + attributeValueNumber + "' AND ");
}
if (attributeValueDate != null) {
sql = sql.concat(" subject_attribute.value_date='" + attributeValueDate + "' AND ");
}
// WHERE clauses ending
if (sql.endsWith("AND ")) {
sql = sql.substring(0, sql.length() - 4);
}
sql = sql.concat(") AS P GROUP BY P.person ORDER BY P.person;");
ResultSet rs = statement.executeQuery(sql);
while (rs.next()){
personIdList.add(rs.getLong("person"));
}
rs.close();
statement.close();
connection.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (statement != null)
statement.close();
} catch (SQLException se2) {
se2.printStackTrace();
}
try {
if (connection != null)
connection.close();
} catch (SQLException se) {
se.printStackTrace();
}
}
return personIdList;
}
public List<Person> search(String firstName, String lastName, String identityCode, java.sql.Date birthDate) {
personList = new ArrayList<>();
Connection connection = null;
Statement statement = null;
try {
Class.forName(JDBC_DRIVER);
connection = DriverManager.getConnection(DB_URL, USER, PASS);
statement = connection.createStatement();
String sql;
sql = "SELECT * FROM person WHERE ";
if (firstName != null) {
sql = sql.concat(" UPPER(first_name) LIKE UPPER('" + firstName + "%') AND ");
}
if (lastName != null) {
sql = sql.concat(" UPPER(last_name) LIKE UPPER('" + lastName + "%') AND ");
}
if (identityCode != null) {
sql = sql.concat(" UPPER(identity_code) LIKE UPPER('" + identityCode + "%') AND ");
}
if (birthDate != null) {
sql = sql.concat(" birth_date='" + birthDate + "' AND ");
}
if (sql.endsWith("AND ")) {
sql = sql.substring(0, sql.length() - 4);
}
sql = sql.concat(";");
ResultSet rs = statement.executeQuery(sql);
while (rs.next()){
Person person = new Person();
person.setPerson(rs.getLong("person"));
person.setFirstName(rs.getString("first_name"));
person.setLastName(rs.getString("last_name"));
person.setIdentityCode(rs.getString("identity_code"));
person.setBirthDate(rs.getDate("birth_date"));
person.setCreatedBy(rs.getLong("created_by"));
person.setUpdatedBy(rs.getLong("updated_by"));
person.setCreated(rs.getDate("created"));
person.setUpdated(rs.getDate("updated"));
personList.add(person);
}
rs.close();
statement.close();
connection.close();
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (statement != null)
statement.close();
} catch (SQLException se2) {
se2.printStackTrace();
}
try {
if (connection != null)
connection.close();
} catch (SQLException se) {
se.printStackTrace();
}
}
return personList;
}
}
| [
"talvar.roland@gmail.com"
] | talvar.roland@gmail.com |
ee35988db408e094a267bc6475f50c2a9c5f569e | d874b26a846b58f0c95ae235cb3cf621c6ca5eac | /app/src/main/java/com/checkintalk/m/android/parser/JsonReaderUtil.java | 74ea8e29936e90ec32285e8f3967817e048356fc | [] | no_license | ceerlepy/ChatInTalk | 6ef554910edb25c1c6a5f3bf7ec1d301387cbf34 | 3c03be2105355c3731cc3a38ce118637c3997813 | refs/heads/master | 2016-09-06T06:52:58.706921 | 2015-03-08T12:59:47 | 2015-03-08T12:59:47 | 31,847,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,688 | java | package com.checkintalk.m.android.parser;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.checkintalk.m.android.model.User;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
public class JsonReaderUtil {
private static JsonReaderUtil instance = null;
public static synchronized JsonReaderUtil getInstance() {
if (instance == null)
instance = new JsonReaderUtil();
return instance;
}
public List<User> jListReader(FileReader file) throws IOException {
BufferedReader bufferReader = new BufferedReader(file);
StringBuilder sb = new StringBuilder();
String line = "";
while ((line = bufferReader.readLine()) != null)
sb.append(line + "\n");
JsonElement json = new JsonParser().parse(sb.toString());
JsonArray array = json.getAsJsonArray();
Iterator<JsonElement> iterator = array.iterator();
List<User> users = new ArrayList<User>();
Gson gson;
User user = new User();
while (iterator.hasNext()) {
gson = new Gson();
user = gson.fromJson((JsonElement) iterator.next(), User.class);
users.add(user);
}
return users;
}
public User jReader(FileReader file) throws IOException {
BufferedReader bufferReader = new BufferedReader(file);
StringBuilder sb = new StringBuilder();
String line = "";
while ((line = bufferReader.readLine()) != null) {
sb.append(line + "\n");
}
JsonElement json = new JsonParser().parse(sb.toString());
Gson gson = new Gson();
return gson.fromJson(json, User.class);
}
}
| [
"veyseltosun.vt@gmail.com"
] | veyseltosun.vt@gmail.com |
276d5c3a535825a2fdeda081dd157ba51203d62b | 572135ef88006d89b42690f6675ad9d523fc2581 | /server/src/org/xmlsoap/schemas/soap/encoding/Duration.java | 80d1e4c522d451ee0e47f8087846d6f239af15d8 | [] | no_license | AlessandroMx/IPtvProveedorSeleccion | d2b7dd6a8b4b421aed219c956e87685cf9604607 | a86e317a0793679d734bcd195dc82d5c0946ccff | refs/heads/master | 2020-04-06T13:14:30.571377 | 2018-11-19T16:35:06 | 2018-11-19T16:35:06 | 157,490,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,123 | java | /*
* XML Type: duration
* Namespace: http://schemas.xmlsoap.org/soap/encoding/
* Java type: org.xmlsoap.schemas.soap.encoding.Duration
*
* Automatically generated - do not modify.
*/
package org.xmlsoap.schemas.soap.encoding;
/**
* An XML duration(@http://schemas.xmlsoap.org/soap/encoding/).
*
* This is an atomic type that is a restriction of org.xmlsoap.schemas.soap.encoding.Duration.
*/
public interface Duration extends org.apache.xmlbeans.XmlDuration
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(Duration.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.sAF08758AFEF52EC15ACACF41B231DAF2").resolveHandle("durationd81atype");
/**
* Gets the "id" attribute
*/
java.lang.String getId();
/**
* Gets (as xml) the "id" attribute
*/
org.apache.xmlbeans.XmlID xgetId();
/**
* True if has "id" attribute
*/
boolean isSetId();
/**
* Sets the "id" attribute
*/
void setId(java.lang.String id);
/**
* Sets (as xml) the "id" attribute
*/
void xsetId(org.apache.xmlbeans.XmlID id);
/**
* Unsets the "id" attribute
*/
void unsetId();
/**
* Gets the "href" attribute
*/
java.lang.String getHref();
/**
* Gets (as xml) the "href" attribute
*/
org.apache.xmlbeans.XmlAnyURI xgetHref();
/**
* True if has "href" attribute
*/
boolean isSetHref();
/**
* Sets the "href" attribute
*/
void setHref(java.lang.String href);
/**
* Sets (as xml) the "href" attribute
*/
void xsetHref(org.apache.xmlbeans.XmlAnyURI href);
/**
* Unsets the "href" attribute
*/
void unsetHref();
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static org.xmlsoap.schemas.soap.encoding.Duration newInstance() {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Duration newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Duration parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.xmlsoap.schemas.soap.encoding.Duration parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.xmlsoap.schemas.soap.encoding.Duration parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.xmlsoap.schemas.soap.encoding.Duration) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}
| [
"alessandromx@outlook.com"
] | alessandromx@outlook.com |
ddf622b953ca930544e1f1a73c3d00c3c59da0f4 | 6e28cde8f25ae9b04bdd7be3a5a572a0dacf4bb5 | /src/main/java/alexp/blog/model/Tag.java | 8cf883d0e0c251c428e203303a123309535d6681 | [
"MIT"
] | permissive | KiranSai16/JavaSpringMvcBlog | d72b97de84b398f8278e50cdd5dd26c6b5dd287a | 1645e0d8f6aec7af45a99a18f99d2c68153d3f11 | refs/heads/master | 2022-01-31T13:36:36.219009 | 2022-01-08T10:45:23 | 2022-01-08T10:45:23 | 184,516,731 | 1 | 10 | MIT | 2021-11-13T11:17:13 | 2019-05-02T03:41:06 | Java | UTF-8 | Java | false | false | 1,070 | java | package alexp.blog.model;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
@Entity
@Table(name = "tags")
public class Tag {
@Id
@GeneratedValue
private Long Id;
@Column(length = 30, nullable = false, unique = true)
private String name;
@ManyToMany(mappedBy = "tags")
private Collection<Post> posts = new ArrayList<>();
public Tag() {
}
public Tag(String name) {
this.name = name;
}
public Long getId() {
return Id;
}
public void setId(Long id) {
Id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Collection<Post> getPosts() {
return posts;
}
public void setPosts(Collection<Post> posts) {
this.posts = posts;
}
@Override
public String toString() {
return "Tag{" +
"name='" + name + '\'' +
'}';
}
}
| [
"alex.pantec@gmail.com"
] | alex.pantec@gmail.com |
ebd5bb265a3a4dc1956a6616c3c8e35e0aa65986 | ce7d17963c3157a93e93014d310251d604e62a18 | /app/src/main/java/com/example/webcontent/FileUtils.java | 5b2b34d37b2632938e61936ef4a388488c592f5c | [] | no_license | Basmoirak/Team11_AndroidProject | 6dd9edceb933206fac942cbdac995bb9c9e619a8 | 2abcbf7d5095f95ac02e65fe4d56f4511fb9ea37 | refs/heads/master | 2020-11-26T10:44:25.797813 | 2019-12-23T06:35:45 | 2019-12-23T06:35:45 | 229,048,163 | 0 | 1 | null | 2019-12-23T03:11:21 | 2019-12-19T12:16:59 | Java | UTF-8 | Java | false | false | 899 | java | package com.example.webcontent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class FileUtils {
public static void close(InputStream stream) {
if(stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void close(InputStreamReader stream) {
if(stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void close(BufferedReader stream) {
if(stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
| [
"daniel_yn@yahoo.com.sg"
] | daniel_yn@yahoo.com.sg |
b569915e2ec18989cae0a19b727984ea71c74e08 | 68cb72949d7cd61cc13e437b1302ade0a0a90739 | /src/java/com/astoev/cave/survey/service/bluetooth/device/ble/AbstractBluetoothLEDevice.java | e7d12eb7f22f72f10b3ff7d8db5c815b6ae7149c | [
"MIT"
] | permissive | cuulee/CaveSurvey | e861c0748ebe626d33a58d2b44e52e321918565e | cf669557e56d16e5e77f4c60e45ac0a6e033c296 | refs/heads/master | 2020-04-06T18:03:00.049478 | 2018-11-03T20:04:15 | 2018-11-03T20:04:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,722 | java | package com.astoev.cave.survey.service.bluetooth.device.ble;
import android.annotation.TargetApi;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.os.Build;
import com.astoev.cave.survey.Constants;
import com.astoev.cave.survey.exception.DataException;
import com.astoev.cave.survey.service.bluetooth.Measure;
import com.astoev.cave.survey.service.bluetooth.device.AbstractBluetoothDevice;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.List;
import java.util.UUID;
/**
* Bluetooth device using Bluetooth 4 LTE communication.
*/
public abstract class AbstractBluetoothLEDevice extends AbstractBluetoothDevice {
// abstract methods to define the LE device
public abstract List<UUID> getServices() ;
public abstract List<UUID> getCharacteristics();
public abstract List<UUID> getDescriptors();
public abstract UUID getService(Constants.MeasureTypes aMeasureType);
public abstract UUID getCharacteristic(Constants.MeasureTypes aMeasureType);
public abstract Measure characteristicToMeasure(BluetoothGattCharacteristic aCharacteristic, List<Constants.MeasureTypes> aMeasureTypes) throws DataException;
// not sure why, some devices use notifications (e.g. Mileseey) and others indication (e.g. Leica)
public boolean needCharacteristicNotification() {
return false;
}
public boolean needCharacteristicIndication() {
return false;
}
// helper methods to reuse between the LE devices
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
protected Float asFloat(BluetoothGattCharacteristic aCharacteristic, ByteOrder anOrder) {
return asFloat(aCharacteristic.getValue(), anOrder);
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
protected Float asFloat(BluetoothGattDescriptor aDescriptor, ByteOrder anOrder) {
return asFloat(aDescriptor.getValue(), anOrder);
}
private Float asFloat(byte[] buff, ByteOrder anOrder) {
/* // log the bytes
if (buff != null) {
String description = "[";
for (int i = 0; i < buff.length; i++) {
description += ", " + buff[i];
}
description += "]";
Log.d(Constants.LOG_TAG_BT, description);
}*/
ByteBuffer buffer = ByteBuffer.wrap(buff);
if (anOrder != null) {
buffer.order(anOrder);
}
return buffer.getFloat();
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
protected Integer asInt(BluetoothGattCharacteristic aCharacteristic, int dataFormat) {
return aCharacteristic.getIntValue(dataFormat, 0).intValue();
}
}
| [
"cave.survey.project@gmail.com"
] | cave.survey.project@gmail.com |
f822c05065eeef3876bfec81b3e5adceab0de196 | 62d44cb9256e243ea591fc8662db737ac7a7e10d | /app/src/main/java/com/farm/farm2fork/ui/farmscreen/AddFarmFragmentView.java | 6176c01ea0823649956a153090cae78dcb0afa7a | [] | no_license | apgapg/Farm2Fork | 412c207728b54e3abf61935c8a4a1815679475b3 | 45335f2e740172db1ce7421a4feb2801860a842f | refs/heads/master | 2021-04-09T16:26:17.859913 | 2018-07-03T08:48:33 | 2018-07-03T08:48:33 | 125,871,671 | 0 | 0 | null | 2020-04-08T06:18:38 | 2018-03-19T14:34:38 | Java | UTF-8 | Java | false | false | 181 | java | package com.farm.farm2fork.ui.farmscreen;
import com.farm.farm2fork.BaseView;
/**
* Created by master on 7/4/18.
*/
public interface AddFarmFragmentView extends BaseView {
}
| [
"ayushpguptaapg@gmail.com"
] | ayushpguptaapg@gmail.com |
937698f2f4f1f5eb01e768926281bb0212d2ea22 | c28a0ec0b2d5e0d6f286c9c2a9abe6fbd832072e | /eisbw/src/main/java/eisbw/percepts/ChokepointRegionPercept.java | 7152e47edd4aeba04820a2705ec029ec7c139069 | [] | no_license | ElwinDuinkerken/Starcraft | 61c6f86a148d6c47a86bd595945ed8f02b28cde5 | 16547aea8d564303caf536d25ca72ab2282cadfc | refs/heads/master | 2022-02-10T06:46:45.197663 | 2019-09-17T11:28:11 | 2019-09-17T11:28:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,046 | java | package eisbw.percepts;
import eis.iilang.Numeral;
/**
* @author Danny & Harm - The Chokepoint percept.
*
*/
public class ChokepointRegionPercept extends StarcraftPercept {
private static final long serialVersionUID = 1L;
/**
* @param xpos1
* The x coordinate of the first side of the chokepoint.
* @param ypos1
* The y coordinate of the first side of the chokepoint.
* @param xpos2
* The x coordinate of the second side of the chokepoint.
* @param ypos2
* The y coordinate of the second side of the chokepoint.
* @param region1
* The identifier of the region at one side of the chokepoint.
* @param region2
* The identifier of the region at the other side of the chokepoint.
*/
public ChokepointRegionPercept(int xpos1, int ypos1, int xpos2, int ypos2, int region1, int region2) {
super(Percepts.CHOKEPOINT, new Numeral(xpos1), new Numeral(ypos1), new Numeral(xpos2), new Numeral(ypos2),
new Numeral(region1), new Numeral(region2));
}
}
| [
"v.j.koeman@tudelft.nl"
] | v.j.koeman@tudelft.nl |
b920d996b477b6b3f7264eae0939649ac34eaad2 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a026/A026089Test.java | 505a9bfc62d36a7aca01997796b3616e3b13d1af | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a026;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A026089Test extends AbstractSequenceTest {
}
| [
"sairvin@gmail.com"
] | sairvin@gmail.com |
ff8a32a83f1202a1929a556cc21e8bf4afda0673 | b472178e989fb51956ad082a4532a400be9085e4 | /springbuckscustomer/src/main/java/com/example/springbuckscustomer/support/MoneySerializabler.java | aea3cff85d37936bdfa70b5e126c32ae7b370c42 | [] | no_license | datou-leo/JAVA_TEST | e4db450d5dbe8883034bc1746045012ba8e904f6 | 7234875713f5f406c5e95b4b2ec387cfb010aad3 | refs/heads/master | 2022-11-26T20:36:12.243454 | 2020-01-11T09:41:54 | 2020-01-11T09:41:54 | 227,584,601 | 0 | 0 | null | 2022-11-16T10:37:45 | 2019-12-12T10:52:43 | Java | UTF-8 | Java | false | false | 685 | java | package com.example.springbuckscustomer.support;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.joda.money.Money;
import org.springframework.boot.jackson.JsonComponent;
import java.io.IOException;
@JsonComponent
public class MoneySerializabler extends StdSerializer<Money> {
protected MoneySerializabler(){
super(Money.class);
}
@Override
public void serialize(Money money, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeNumber(money.getAmount());
}
}
| [
"2323178881@qq.com"
] | 2323178881@qq.com |
974a5077acf45b137c189966857ea72fb2477bef | e9ef896e47453e0167a63f29bf0eab3f58374027 | /src/main/java/service/EquipmentServiceImpl.java | 6ad68755db913406ce143235d90cc0c29caf0f82 | [] | no_license | Lexei4/CoffeeShop2 | f9233d524c241e7e53d8f9060bee70ec3b8f40a3 | b2200105ee5ce1fd3e907b182bd2b3dd1b1bef48 | refs/heads/master | 2023-01-31T04:03:36.352274 | 2020-10-26T17:50:20 | 2020-10-26T17:50:20 | 305,792,550 | 0 | 0 | null | 2020-12-15T18:13:22 | 2020-10-20T18:02:32 | Java | UTF-8 | Java | false | false | 844 | java | package service;
import dao.EquipmentDAO;
import model.Equipment;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class EquipmentServiceImpl implements EquipmentService{
private static final Logger log = LogManager.getLogger(EquipmentServiceImpl.class.getName());
private EquipmentDAO equipmentDAO;
public EquipmentServiceImpl(EquipmentDAO equipmentDAO) {
log.info("createService");
this.equipmentDAO = equipmentDAO;
}
@Override
public void addEquipment(Equipment equipment) {
equipmentDAO.save(equipment);
}
@Override
public void deleteEquipment(Equipment equipment) {
equipmentDAO.delete(equipment);
}
@Override
public void updateEquipment(Equipment equipment) {
equipmentDAO.update(equipment);
}
}
| [
"47830617+Lexei4@users.noreply.github.com"
] | 47830617+Lexei4@users.noreply.github.com |
a629dfff9ae58b9af9f07875c55f22dc9e9de141 | 50750fbff439ace4a514c18ab825b9e13a24b0aa | /pegasus-spyware-decompiled/sample3/recompiled_java/sources/android/support/v7/app/WindowDecorActionBar.java | bcc2e169b9715f422c00488fa89e52dd9e66578a | [
"MIT"
] | permissive | GypsyBud/pegasus_spyware | 3066ae7d217a7d4b23110326f75bf6cf63737105 | b40f5e4bdf5bd01c21e8ef90ebe755b29c2daa68 | refs/heads/master | 2023-06-24T05:44:01.354811 | 2021-07-31T18:59:26 | 2021-07-31T18:59:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48,828 | java | package android.support.v7.app;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.RestrictTo;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v4.view.ViewPropertyAnimatorListener;
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
import android.support.v4.view.ViewPropertyAnimatorUpdateListener;
import android.support.v7.app.ActionBar;
import android.support.v7.appcompat.R;
import android.support.v7.content.res.AppCompatResources;
import android.support.v7.view.ActionBarPolicy;
import android.support.v7.view.ActionMode;
import android.support.v7.view.SupportMenuInflater;
import android.support.v7.view.ViewPropertyAnimatorCompatSet;
import android.support.v7.view.menu.MenuBuilder;
import android.support.v7.view.menu.MenuPopupHelper;
import android.support.v7.view.menu.SubMenuBuilder;
import android.support.v7.widget.ActionBarContainer;
import android.support.v7.widget.ActionBarContextView;
import android.support.v7.widget.ActionBarOverlayLayout;
import android.support.v7.widget.DecorToolbar;
import android.support.v7.widget.ScrollingTabContainerView;
import android.support.v7.widget.Toolbar;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.SpinnerAdapter;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@RestrictTo({RestrictTo.Scope.GROUP_ID})
public class WindowDecorActionBar extends ActionBar implements ActionBarOverlayLayout.ActionBarVisibilityCallback {
static final /* synthetic */ boolean $assertionsDisabled = (!WindowDecorActionBar.class.desiredAssertionStatus());
private static final boolean ALLOW_SHOW_HIDE_ANIMATIONS;
private static final long FADE_IN_DURATION_MS = 200;
private static final long FADE_OUT_DURATION_MS = 100;
private static final int INVALID_POSITION = -1;
private static final String TAG = "WindowDecorActionBar";
private static final Interpolator sHideInterpolator = new AccelerateInterpolator();
private static final Interpolator sShowInterpolator = new DecelerateInterpolator();
ActionModeImpl mActionMode;
private Activity mActivity;
ActionBarContainer mContainerView;
boolean mContentAnimations = true;
View mContentView;
Context mContext;
ActionBarContextView mContextView;
private int mCurWindowVisibility = 0;
ViewPropertyAnimatorCompatSet mCurrentShowAnim;
DecorToolbar mDecorToolbar;
ActionMode mDeferredDestroyActionMode;
ActionMode.Callback mDeferredModeDestroyCallback;
private Dialog mDialog;
private boolean mDisplayHomeAsUpSet;
private boolean mHasEmbeddedTabs;
boolean mHiddenByApp;
boolean mHiddenBySystem;
final ViewPropertyAnimatorListener mHideListener = new ViewPropertyAnimatorListenerAdapter() {
/* class android.support.v7.app.WindowDecorActionBar.AnonymousClass1 */
@Override // android.support.v4.view.ViewPropertyAnimatorListenerAdapter, android.support.v4.view.ViewPropertyAnimatorListener
public void onAnimationEnd(View view) {
if (WindowDecorActionBar.this.mContentAnimations && WindowDecorActionBar.this.mContentView != null) {
ViewCompat.setTranslationY(WindowDecorActionBar.this.mContentView, 0.0f);
ViewCompat.setTranslationY(WindowDecorActionBar.this.mContainerView, 0.0f);
}
WindowDecorActionBar.this.mContainerView.setVisibility(8);
WindowDecorActionBar.this.mContainerView.setTransitioning(false);
WindowDecorActionBar.this.mCurrentShowAnim = null;
WindowDecorActionBar.this.completeDeferredDestroyActionMode();
if (WindowDecorActionBar.this.mOverlayLayout != null) {
ViewCompat.requestApplyInsets(WindowDecorActionBar.this.mOverlayLayout);
}
}
};
boolean mHideOnContentScroll;
private boolean mLastMenuVisibility;
private ArrayList<ActionBar.OnMenuVisibilityListener> mMenuVisibilityListeners = new ArrayList<>();
private boolean mNowShowing = true;
ActionBarOverlayLayout mOverlayLayout;
private int mSavedTabPosition = -1;
private TabImpl mSelectedTab;
private boolean mShowHideAnimationEnabled;
final ViewPropertyAnimatorListener mShowListener = new ViewPropertyAnimatorListenerAdapter() {
/* class android.support.v7.app.WindowDecorActionBar.AnonymousClass2 */
@Override // android.support.v4.view.ViewPropertyAnimatorListenerAdapter, android.support.v4.view.ViewPropertyAnimatorListener
public void onAnimationEnd(View view) {
WindowDecorActionBar.this.mCurrentShowAnim = null;
WindowDecorActionBar.this.mContainerView.requestLayout();
}
};
private boolean mShowingForMode;
ScrollingTabContainerView mTabScrollView;
private ArrayList<TabImpl> mTabs = new ArrayList<>();
private Context mThemedContext;
final ViewPropertyAnimatorUpdateListener mUpdateListener = new ViewPropertyAnimatorUpdateListener() {
/* class android.support.v7.app.WindowDecorActionBar.AnonymousClass3 */
@Override // android.support.v4.view.ViewPropertyAnimatorUpdateListener
public void onAnimationUpdate(View view) {
((View) WindowDecorActionBar.this.mContainerView.getParent()).invalidate();
}
};
static {
boolean z = true;
if (Build.VERSION.SDK_INT < 14) {
z = false;
}
ALLOW_SHOW_HIDE_ANIMATIONS = z;
}
public WindowDecorActionBar(Activity activity, boolean overlayMode) {
this.mActivity = activity;
View decor = activity.getWindow().getDecorView();
init(decor);
if (!overlayMode) {
this.mContentView = decor.findViewById(16908290);
}
}
public WindowDecorActionBar(Dialog dialog) {
this.mDialog = dialog;
init(dialog.getWindow().getDecorView());
}
@RestrictTo({RestrictTo.Scope.GROUP_ID})
public WindowDecorActionBar(View layout) {
if ($assertionsDisabled || layout.isInEditMode()) {
init(layout);
return;
}
throw new AssertionError();
}
private void init(View decor) {
boolean homeAsUp;
boolean z;
this.mOverlayLayout = (ActionBarOverlayLayout) decor.findViewById(R.id.decor_content_parent);
if (this.mOverlayLayout != null) {
this.mOverlayLayout.setActionBarVisibilityCallback(this);
}
this.mDecorToolbar = getDecorToolbar(decor.findViewById(R.id.action_bar));
this.mContextView = (ActionBarContextView) decor.findViewById(R.id.action_context_bar);
this.mContainerView = (ActionBarContainer) decor.findViewById(R.id.action_bar_container);
if (this.mDecorToolbar == null || this.mContextView == null || this.mContainerView == null) {
throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + "with a compatible window decor layout");
}
this.mContext = this.mDecorToolbar.getContext();
if ((this.mDecorToolbar.getDisplayOptions() & 4) != 0) {
homeAsUp = true;
} else {
homeAsUp = false;
}
if (homeAsUp) {
this.mDisplayHomeAsUpSet = true;
}
ActionBarPolicy abp = ActionBarPolicy.get(this.mContext);
if (abp.enableHomeButtonByDefault() || homeAsUp) {
z = true;
} else {
z = false;
}
setHomeButtonEnabled(z);
setHasEmbeddedTabs(abp.hasEmbeddedTabs());
TypedArray a = this.mContext.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
if (a.getBoolean(R.styleable.ActionBar_hideOnContentScroll, false)) {
setHideOnContentScrollEnabled(true);
}
int elevation = a.getDimensionPixelSize(R.styleable.ActionBar_elevation, 0);
if (elevation != 0) {
setElevation((float) elevation);
}
a.recycle();
}
private DecorToolbar getDecorToolbar(View view) {
if (view instanceof DecorToolbar) {
return (DecorToolbar) view;
}
if (view instanceof Toolbar) {
return ((Toolbar) view).getWrapper();
}
throw new IllegalStateException(new StringBuilder().append("Can't make a decor toolbar out of ").append(view).toString() != null ? view.getClass().getSimpleName() : "null");
}
@Override // android.support.v7.app.ActionBar
public void setElevation(float elevation) {
ViewCompat.setElevation(this.mContainerView, elevation);
}
@Override // android.support.v7.app.ActionBar
public float getElevation() {
return ViewCompat.getElevation(this.mContainerView);
}
@Override // android.support.v7.app.ActionBar
public void onConfigurationChanged(Configuration newConfig) {
setHasEmbeddedTabs(ActionBarPolicy.get(this.mContext).hasEmbeddedTabs());
}
private void setHasEmbeddedTabs(boolean hasEmbeddedTabs) {
boolean isInTabMode;
boolean z;
boolean z2 = true;
this.mHasEmbeddedTabs = hasEmbeddedTabs;
if (!this.mHasEmbeddedTabs) {
this.mDecorToolbar.setEmbeddedTabView(null);
this.mContainerView.setTabContainer(this.mTabScrollView);
} else {
this.mContainerView.setTabContainer(null);
this.mDecorToolbar.setEmbeddedTabView(this.mTabScrollView);
}
if (getNavigationMode() == 2) {
isInTabMode = true;
} else {
isInTabMode = false;
}
if (this.mTabScrollView != null) {
if (isInTabMode) {
this.mTabScrollView.setVisibility(0);
if (this.mOverlayLayout != null) {
ViewCompat.requestApplyInsets(this.mOverlayLayout);
}
} else {
this.mTabScrollView.setVisibility(8);
}
}
DecorToolbar decorToolbar = this.mDecorToolbar;
if (this.mHasEmbeddedTabs || !isInTabMode) {
z = false;
} else {
z = true;
}
decorToolbar.setCollapsible(z);
ActionBarOverlayLayout actionBarOverlayLayout = this.mOverlayLayout;
if (this.mHasEmbeddedTabs || !isInTabMode) {
z2 = false;
}
actionBarOverlayLayout.setHasNonEmbeddedTabs(z2);
}
private void ensureTabsExist() {
if (this.mTabScrollView == null) {
ScrollingTabContainerView tabScroller = new ScrollingTabContainerView(this.mContext);
if (this.mHasEmbeddedTabs) {
tabScroller.setVisibility(0);
this.mDecorToolbar.setEmbeddedTabView(tabScroller);
} else {
if (getNavigationMode() == 2) {
tabScroller.setVisibility(0);
if (this.mOverlayLayout != null) {
ViewCompat.requestApplyInsets(this.mOverlayLayout);
}
} else {
tabScroller.setVisibility(8);
}
this.mContainerView.setTabContainer(tabScroller);
}
this.mTabScrollView = tabScroller;
}
}
/* access modifiers changed from: package-private */
public void completeDeferredDestroyActionMode() {
if (this.mDeferredModeDestroyCallback != null) {
this.mDeferredModeDestroyCallback.onDestroyActionMode(this.mDeferredDestroyActionMode);
this.mDeferredDestroyActionMode = null;
this.mDeferredModeDestroyCallback = null;
}
}
@Override // android.support.v7.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void onWindowVisibilityChanged(int visibility) {
this.mCurWindowVisibility = visibility;
}
@Override // android.support.v7.app.ActionBar
public void setShowHideAnimationEnabled(boolean enabled) {
this.mShowHideAnimationEnabled = enabled;
if (!enabled && this.mCurrentShowAnim != null) {
this.mCurrentShowAnim.cancel();
}
}
@Override // android.support.v7.app.ActionBar
public void addOnMenuVisibilityListener(ActionBar.OnMenuVisibilityListener listener) {
this.mMenuVisibilityListeners.add(listener);
}
@Override // android.support.v7.app.ActionBar
public void removeOnMenuVisibilityListener(ActionBar.OnMenuVisibilityListener listener) {
this.mMenuVisibilityListeners.remove(listener);
}
@Override // android.support.v7.app.ActionBar
public void dispatchMenuVisibilityChanged(boolean isVisible) {
if (isVisible != this.mLastMenuVisibility) {
this.mLastMenuVisibility = isVisible;
int count = this.mMenuVisibilityListeners.size();
for (int i = 0; i < count; i++) {
this.mMenuVisibilityListeners.get(i).onMenuVisibilityChanged(isVisible);
}
}
}
@Override // android.support.v7.app.ActionBar
public void setCustomView(int resId) {
setCustomView(LayoutInflater.from(getThemedContext()).inflate(resId, this.mDecorToolbar.getViewGroup(), false));
}
@Override // android.support.v7.app.ActionBar
public void setDisplayUseLogoEnabled(boolean useLogo) {
setDisplayOptions(useLogo ? 1 : 0, 1);
}
@Override // android.support.v7.app.ActionBar
public void setDisplayShowHomeEnabled(boolean showHome) {
setDisplayOptions(showHome ? 2 : 0, 2);
}
@Override // android.support.v7.app.ActionBar
public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) {
setDisplayOptions(showHomeAsUp ? 4 : 0, 4);
}
@Override // android.support.v7.app.ActionBar
public void setDisplayShowTitleEnabled(boolean showTitle) {
setDisplayOptions(showTitle ? 8 : 0, 8);
}
@Override // android.support.v7.app.ActionBar
public void setDisplayShowCustomEnabled(boolean showCustom) {
setDisplayOptions(showCustom ? 16 : 0, 16);
}
@Override // android.support.v7.app.ActionBar
public void setHomeButtonEnabled(boolean enable) {
this.mDecorToolbar.setHomeButtonEnabled(enable);
}
@Override // android.support.v7.app.ActionBar
public void setTitle(int resId) {
setTitle(this.mContext.getString(resId));
}
@Override // android.support.v7.app.ActionBar
public void setSubtitle(int resId) {
setSubtitle(this.mContext.getString(resId));
}
@Override // android.support.v7.app.ActionBar
public void setSelectedNavigationItem(int position) {
switch (this.mDecorToolbar.getNavigationMode()) {
case 1:
this.mDecorToolbar.setDropdownSelectedPosition(position);
return;
case 2:
selectTab(this.mTabs.get(position));
return;
default:
throw new IllegalStateException("setSelectedNavigationIndex not valid for current navigation mode");
}
}
@Override // android.support.v7.app.ActionBar
public void removeAllTabs() {
cleanupTabs();
}
private void cleanupTabs() {
if (this.mSelectedTab != null) {
selectTab(null);
}
this.mTabs.clear();
if (this.mTabScrollView != null) {
this.mTabScrollView.removeAllTabs();
}
this.mSavedTabPosition = -1;
}
@Override // android.support.v7.app.ActionBar
public void setTitle(CharSequence title) {
this.mDecorToolbar.setTitle(title);
}
@Override // android.support.v7.app.ActionBar
public void setWindowTitle(CharSequence title) {
this.mDecorToolbar.setWindowTitle(title);
}
@Override // android.support.v7.app.ActionBar
public boolean requestFocus() {
ViewGroup viewGroup = this.mDecorToolbar.getViewGroup();
if (viewGroup == null || viewGroup.hasFocus()) {
return false;
}
viewGroup.requestFocus();
return true;
}
@Override // android.support.v7.app.ActionBar
public void setSubtitle(CharSequence subtitle) {
this.mDecorToolbar.setSubtitle(subtitle);
}
@Override // android.support.v7.app.ActionBar
public void setDisplayOptions(int options) {
if ((options & 4) != 0) {
this.mDisplayHomeAsUpSet = true;
}
this.mDecorToolbar.setDisplayOptions(options);
}
@Override // android.support.v7.app.ActionBar
public void setDisplayOptions(int options, int mask) {
int current = this.mDecorToolbar.getDisplayOptions();
if ((mask & 4) != 0) {
this.mDisplayHomeAsUpSet = true;
}
this.mDecorToolbar.setDisplayOptions((options & mask) | ((mask ^ -1) & current));
}
@Override // android.support.v7.app.ActionBar
public void setBackgroundDrawable(Drawable d) {
this.mContainerView.setPrimaryBackground(d);
}
@Override // android.support.v7.app.ActionBar
public void setStackedBackgroundDrawable(Drawable d) {
this.mContainerView.setStackedBackground(d);
}
@Override // android.support.v7.app.ActionBar
public void setSplitBackgroundDrawable(Drawable d) {
}
@Override // android.support.v7.app.ActionBar
public View getCustomView() {
return this.mDecorToolbar.getCustomView();
}
@Override // android.support.v7.app.ActionBar
public CharSequence getTitle() {
return this.mDecorToolbar.getTitle();
}
@Override // android.support.v7.app.ActionBar
public CharSequence getSubtitle() {
return this.mDecorToolbar.getSubtitle();
}
@Override // android.support.v7.app.ActionBar
public int getNavigationMode() {
return this.mDecorToolbar.getNavigationMode();
}
@Override // android.support.v7.app.ActionBar
public int getDisplayOptions() {
return this.mDecorToolbar.getDisplayOptions();
}
@Override // android.support.v7.app.ActionBar
public ActionMode startActionMode(ActionMode.Callback callback) {
if (this.mActionMode != null) {
this.mActionMode.finish();
}
this.mOverlayLayout.setHideOnContentScrollEnabled(false);
this.mContextView.killMode();
ActionModeImpl mode = new ActionModeImpl(this.mContextView.getContext(), callback);
if (!mode.dispatchOnCreate()) {
return null;
}
this.mActionMode = mode;
mode.invalidate();
this.mContextView.initForMode(mode);
animateToMode(true);
this.mContextView.sendAccessibilityEvent(32);
return mode;
}
private void configureTab(ActionBar.Tab tab, int position) {
TabImpl tabi = (TabImpl) tab;
if (tabi.getCallback() == null) {
throw new IllegalStateException("Action Bar Tab must have a Callback");
}
tabi.setPosition(position);
this.mTabs.add(position, tabi);
int count = this.mTabs.size();
for (int i = position + 1; i < count; i++) {
this.mTabs.get(i).setPosition(i);
}
}
@Override // android.support.v7.app.ActionBar
public void addTab(ActionBar.Tab tab) {
addTab(tab, this.mTabs.isEmpty());
}
@Override // android.support.v7.app.ActionBar
public void addTab(ActionBar.Tab tab, int position) {
addTab(tab, position, this.mTabs.isEmpty());
}
@Override // android.support.v7.app.ActionBar
public void addTab(ActionBar.Tab tab, boolean setSelected) {
ensureTabsExist();
this.mTabScrollView.addTab(tab, setSelected);
configureTab(tab, this.mTabs.size());
if (setSelected) {
selectTab(tab);
}
}
@Override // android.support.v7.app.ActionBar
public void addTab(ActionBar.Tab tab, int position, boolean setSelected) {
ensureTabsExist();
this.mTabScrollView.addTab(tab, position, setSelected);
configureTab(tab, position);
if (setSelected) {
selectTab(tab);
}
}
@Override // android.support.v7.app.ActionBar
public ActionBar.Tab newTab() {
return new TabImpl();
}
@Override // android.support.v7.app.ActionBar
public void removeTab(ActionBar.Tab tab) {
removeTabAt(tab.getPosition());
}
@Override // android.support.v7.app.ActionBar
public void removeTabAt(int position) {
if (this.mTabScrollView != null) {
int selectedTabPosition = this.mSelectedTab != null ? this.mSelectedTab.getPosition() : this.mSavedTabPosition;
this.mTabScrollView.removeTabAt(position);
TabImpl removedTab = this.mTabs.remove(position);
if (removedTab != null) {
removedTab.setPosition(-1);
}
int newTabCount = this.mTabs.size();
for (int i = position; i < newTabCount; i++) {
this.mTabs.get(i).setPosition(i);
}
if (selectedTabPosition == position) {
selectTab(this.mTabs.isEmpty() ? null : this.mTabs.get(Math.max(0, position - 1)));
}
}
}
@Override // android.support.v7.app.ActionBar
public void selectTab(ActionBar.Tab tab) {
FragmentTransaction trans;
int i = -1;
if (getNavigationMode() != 2) {
this.mSavedTabPosition = tab != null ? tab.getPosition() : -1;
return;
}
if (!(this.mActivity instanceof FragmentActivity) || this.mDecorToolbar.getViewGroup().isInEditMode()) {
trans = null;
} else {
trans = ((FragmentActivity) this.mActivity).getSupportFragmentManager().beginTransaction().disallowAddToBackStack();
}
if (this.mSelectedTab != tab) {
ScrollingTabContainerView scrollingTabContainerView = this.mTabScrollView;
if (tab != null) {
i = tab.getPosition();
}
scrollingTabContainerView.setTabSelected(i);
if (this.mSelectedTab != null) {
this.mSelectedTab.getCallback().onTabUnselected(this.mSelectedTab, trans);
}
this.mSelectedTab = (TabImpl) tab;
if (this.mSelectedTab != null) {
this.mSelectedTab.getCallback().onTabSelected(this.mSelectedTab, trans);
}
} else if (this.mSelectedTab != null) {
this.mSelectedTab.getCallback().onTabReselected(this.mSelectedTab, trans);
this.mTabScrollView.animateToTab(tab.getPosition());
}
if (trans != null && !trans.isEmpty()) {
trans.commit();
}
}
@Override // android.support.v7.app.ActionBar
public ActionBar.Tab getSelectedTab() {
return this.mSelectedTab;
}
@Override // android.support.v7.app.ActionBar
public int getHeight() {
return this.mContainerView.getHeight();
}
@Override // android.support.v7.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void enableContentAnimations(boolean enabled) {
this.mContentAnimations = enabled;
}
@Override // android.support.v7.app.ActionBar
public void show() {
if (this.mHiddenByApp) {
this.mHiddenByApp = false;
updateVisibility(false);
}
}
private void showForActionMode() {
if (!this.mShowingForMode) {
this.mShowingForMode = true;
if (this.mOverlayLayout != null) {
this.mOverlayLayout.setShowingForActionMode(true);
}
updateVisibility(false);
}
}
@Override // android.support.v7.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void showForSystem() {
if (this.mHiddenBySystem) {
this.mHiddenBySystem = false;
updateVisibility(true);
}
}
@Override // android.support.v7.app.ActionBar
public void hide() {
if (!this.mHiddenByApp) {
this.mHiddenByApp = true;
updateVisibility(false);
}
}
private void hideForActionMode() {
if (this.mShowingForMode) {
this.mShowingForMode = false;
if (this.mOverlayLayout != null) {
this.mOverlayLayout.setShowingForActionMode(false);
}
updateVisibility(false);
}
}
@Override // android.support.v7.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void hideForSystem() {
if (!this.mHiddenBySystem) {
this.mHiddenBySystem = true;
updateVisibility(true);
}
}
@Override // android.support.v7.app.ActionBar
public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) {
if (!hideOnContentScroll || this.mOverlayLayout.isInOverlayMode()) {
this.mHideOnContentScroll = hideOnContentScroll;
this.mOverlayLayout.setHideOnContentScrollEnabled(hideOnContentScroll);
return;
}
throw new IllegalStateException("Action bar must be in overlay mode (Window.FEATURE_OVERLAY_ACTION_BAR) to enable hide on content scroll");
}
@Override // android.support.v7.app.ActionBar
public boolean isHideOnContentScrollEnabled() {
return this.mOverlayLayout.isHideOnContentScrollEnabled();
}
@Override // android.support.v7.app.ActionBar
public int getHideOffset() {
return this.mOverlayLayout.getActionBarHideOffset();
}
@Override // android.support.v7.app.ActionBar
public void setHideOffset(int offset) {
if (offset == 0 || this.mOverlayLayout.isInOverlayMode()) {
this.mOverlayLayout.setActionBarHideOffset(offset);
return;
}
throw new IllegalStateException("Action bar must be in overlay mode (Window.FEATURE_OVERLAY_ACTION_BAR) to set a non-zero hide offset");
}
static boolean checkShowingFlags(boolean hiddenByApp, boolean hiddenBySystem, boolean showingForMode) {
if (showingForMode) {
return true;
}
if (hiddenByApp || hiddenBySystem) {
return false;
}
return true;
}
private void updateVisibility(boolean fromSystem) {
if (checkShowingFlags(this.mHiddenByApp, this.mHiddenBySystem, this.mShowingForMode)) {
if (!this.mNowShowing) {
this.mNowShowing = true;
doShow(fromSystem);
}
} else if (this.mNowShowing) {
this.mNowShowing = false;
doHide(fromSystem);
}
}
public void doShow(boolean fromSystem) {
if (this.mCurrentShowAnim != null) {
this.mCurrentShowAnim.cancel();
}
this.mContainerView.setVisibility(0);
if (this.mCurWindowVisibility != 0 || !ALLOW_SHOW_HIDE_ANIMATIONS || (!this.mShowHideAnimationEnabled && !fromSystem)) {
ViewCompat.setAlpha(this.mContainerView, 1.0f);
ViewCompat.setTranslationY(this.mContainerView, 0.0f);
if (this.mContentAnimations && this.mContentView != null) {
ViewCompat.setTranslationY(this.mContentView, 0.0f);
}
this.mShowListener.onAnimationEnd(null);
} else {
ViewCompat.setTranslationY(this.mContainerView, 0.0f);
float startingY = (float) (-this.mContainerView.getHeight());
if (fromSystem) {
int[] topLeft = {0, 0};
this.mContainerView.getLocationInWindow(topLeft);
startingY -= (float) topLeft[1];
}
ViewCompat.setTranslationY(this.mContainerView, startingY);
ViewPropertyAnimatorCompatSet anim = new ViewPropertyAnimatorCompatSet();
ViewPropertyAnimatorCompat a = ViewCompat.animate(this.mContainerView).translationY(0.0f);
a.setUpdateListener(this.mUpdateListener);
anim.play(a);
if (this.mContentAnimations && this.mContentView != null) {
ViewCompat.setTranslationY(this.mContentView, startingY);
anim.play(ViewCompat.animate(this.mContentView).translationY(0.0f));
}
anim.setInterpolator(sShowInterpolator);
anim.setDuration(250);
anim.setListener(this.mShowListener);
this.mCurrentShowAnim = anim;
anim.start();
}
if (this.mOverlayLayout != null) {
ViewCompat.requestApplyInsets(this.mOverlayLayout);
}
}
public void doHide(boolean fromSystem) {
if (this.mCurrentShowAnim != null) {
this.mCurrentShowAnim.cancel();
}
if (this.mCurWindowVisibility != 0 || !ALLOW_SHOW_HIDE_ANIMATIONS || (!this.mShowHideAnimationEnabled && !fromSystem)) {
this.mHideListener.onAnimationEnd(null);
return;
}
ViewCompat.setAlpha(this.mContainerView, 1.0f);
this.mContainerView.setTransitioning(true);
ViewPropertyAnimatorCompatSet anim = new ViewPropertyAnimatorCompatSet();
float endingY = (float) (-this.mContainerView.getHeight());
if (fromSystem) {
int[] topLeft = {0, 0};
this.mContainerView.getLocationInWindow(topLeft);
endingY -= (float) topLeft[1];
}
ViewPropertyAnimatorCompat a = ViewCompat.animate(this.mContainerView).translationY(endingY);
a.setUpdateListener(this.mUpdateListener);
anim.play(a);
if (this.mContentAnimations && this.mContentView != null) {
anim.play(ViewCompat.animate(this.mContentView).translationY(endingY));
}
anim.setInterpolator(sHideInterpolator);
anim.setDuration(250);
anim.setListener(this.mHideListener);
this.mCurrentShowAnim = anim;
anim.start();
}
@Override // android.support.v7.app.ActionBar
public boolean isShowing() {
int height = getHeight();
return this.mNowShowing && (height == 0 || getHideOffset() < height);
}
public void animateToMode(boolean toActionMode) {
ViewPropertyAnimatorCompat fadeIn;
ViewPropertyAnimatorCompat fadeOut;
if (toActionMode) {
showForActionMode();
} else {
hideForActionMode();
}
if (shouldAnimateContextView()) {
if (toActionMode) {
fadeOut = this.mDecorToolbar.setupAnimatorToVisibility(4, FADE_OUT_DURATION_MS);
fadeIn = this.mContextView.setupAnimatorToVisibility(0, FADE_IN_DURATION_MS);
} else {
fadeIn = this.mDecorToolbar.setupAnimatorToVisibility(0, FADE_IN_DURATION_MS);
fadeOut = this.mContextView.setupAnimatorToVisibility(8, FADE_OUT_DURATION_MS);
}
ViewPropertyAnimatorCompatSet set = new ViewPropertyAnimatorCompatSet();
set.playSequentially(fadeOut, fadeIn);
set.start();
} else if (toActionMode) {
this.mDecorToolbar.setVisibility(4);
this.mContextView.setVisibility(0);
} else {
this.mDecorToolbar.setVisibility(0);
this.mContextView.setVisibility(8);
}
}
private boolean shouldAnimateContextView() {
return ViewCompat.isLaidOut(this.mContainerView);
}
@Override // android.support.v7.app.ActionBar
public Context getThemedContext() {
if (this.mThemedContext == null) {
TypedValue outValue = new TypedValue();
this.mContext.getTheme().resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
int targetThemeRes = outValue.resourceId;
if (targetThemeRes != 0) {
this.mThemedContext = new ContextThemeWrapper(this.mContext, targetThemeRes);
} else {
this.mThemedContext = this.mContext;
}
}
return this.mThemedContext;
}
@Override // android.support.v7.app.ActionBar
public boolean isTitleTruncated() {
return this.mDecorToolbar != null && this.mDecorToolbar.isTitleTruncated();
}
@Override // android.support.v7.app.ActionBar
public void setHomeAsUpIndicator(Drawable indicator) {
this.mDecorToolbar.setNavigationIcon(indicator);
}
@Override // android.support.v7.app.ActionBar
public void setHomeAsUpIndicator(int resId) {
this.mDecorToolbar.setNavigationIcon(resId);
}
@Override // android.support.v7.app.ActionBar
public void setHomeActionContentDescription(CharSequence description) {
this.mDecorToolbar.setNavigationContentDescription(description);
}
@Override // android.support.v7.app.ActionBar
public void setHomeActionContentDescription(int resId) {
this.mDecorToolbar.setNavigationContentDescription(resId);
}
@Override // android.support.v7.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void onContentScrollStarted() {
if (this.mCurrentShowAnim != null) {
this.mCurrentShowAnim.cancel();
this.mCurrentShowAnim = null;
}
}
@Override // android.support.v7.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void onContentScrollStopped() {
}
@Override // android.support.v7.app.ActionBar
public boolean collapseActionView() {
if (this.mDecorToolbar == null || !this.mDecorToolbar.hasExpandedActionView()) {
return false;
}
this.mDecorToolbar.collapseActionView();
return true;
}
@RestrictTo({RestrictTo.Scope.GROUP_ID})
public class ActionModeImpl extends ActionMode implements MenuBuilder.Callback {
private final Context mActionModeContext;
private ActionMode.Callback mCallback;
private WeakReference<View> mCustomView;
private final MenuBuilder mMenu;
public ActionModeImpl(Context context, ActionMode.Callback callback) {
this.mActionModeContext = context;
this.mCallback = callback;
this.mMenu = new MenuBuilder(context).setDefaultShowAsAction(1);
this.mMenu.setCallback(this);
}
@Override // android.support.v7.view.ActionMode
public MenuInflater getMenuInflater() {
return new SupportMenuInflater(this.mActionModeContext);
}
@Override // android.support.v7.view.ActionMode
public Menu getMenu() {
return this.mMenu;
}
@Override // android.support.v7.view.ActionMode
public void finish() {
if (WindowDecorActionBar.this.mActionMode == this) {
if (!WindowDecorActionBar.checkShowingFlags(WindowDecorActionBar.this.mHiddenByApp, WindowDecorActionBar.this.mHiddenBySystem, false)) {
WindowDecorActionBar.this.mDeferredDestroyActionMode = this;
WindowDecorActionBar.this.mDeferredModeDestroyCallback = this.mCallback;
} else {
this.mCallback.onDestroyActionMode(this);
}
this.mCallback = null;
WindowDecorActionBar.this.animateToMode(false);
WindowDecorActionBar.this.mContextView.closeMode();
WindowDecorActionBar.this.mDecorToolbar.getViewGroup().sendAccessibilityEvent(32);
WindowDecorActionBar.this.mOverlayLayout.setHideOnContentScrollEnabled(WindowDecorActionBar.this.mHideOnContentScroll);
WindowDecorActionBar.this.mActionMode = null;
}
}
@Override // android.support.v7.view.ActionMode
public void invalidate() {
if (WindowDecorActionBar.this.mActionMode == this) {
this.mMenu.stopDispatchingItemsChanged();
try {
this.mCallback.onPrepareActionMode(this, this.mMenu);
} finally {
this.mMenu.startDispatchingItemsChanged();
}
}
}
public boolean dispatchOnCreate() {
this.mMenu.stopDispatchingItemsChanged();
try {
return this.mCallback.onCreateActionMode(this, this.mMenu);
} finally {
this.mMenu.startDispatchingItemsChanged();
}
}
@Override // android.support.v7.view.ActionMode
public void setCustomView(View view) {
WindowDecorActionBar.this.mContextView.setCustomView(view);
this.mCustomView = new WeakReference<>(view);
}
@Override // android.support.v7.view.ActionMode
public void setSubtitle(CharSequence subtitle) {
WindowDecorActionBar.this.mContextView.setSubtitle(subtitle);
}
@Override // android.support.v7.view.ActionMode
public void setTitle(CharSequence title) {
WindowDecorActionBar.this.mContextView.setTitle(title);
}
@Override // android.support.v7.view.ActionMode
public void setTitle(int resId) {
setTitle(WindowDecorActionBar.this.mContext.getResources().getString(resId));
}
@Override // android.support.v7.view.ActionMode
public void setSubtitle(int resId) {
setSubtitle(WindowDecorActionBar.this.mContext.getResources().getString(resId));
}
@Override // android.support.v7.view.ActionMode
public CharSequence getTitle() {
return WindowDecorActionBar.this.mContextView.getTitle();
}
@Override // android.support.v7.view.ActionMode
public CharSequence getSubtitle() {
return WindowDecorActionBar.this.mContextView.getSubtitle();
}
@Override // android.support.v7.view.ActionMode
public void setTitleOptionalHint(boolean titleOptional) {
super.setTitleOptionalHint(titleOptional);
WindowDecorActionBar.this.mContextView.setTitleOptional(titleOptional);
}
@Override // android.support.v7.view.ActionMode
public boolean isTitleOptional() {
return WindowDecorActionBar.this.mContextView.isTitleOptional();
}
@Override // android.support.v7.view.ActionMode
public View getCustomView() {
if (this.mCustomView != null) {
return this.mCustomView.get();
}
return null;
}
@Override // android.support.v7.view.menu.MenuBuilder.Callback
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
if (this.mCallback != null) {
return this.mCallback.onActionItemClicked(this, item);
}
return false;
}
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
}
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
if (this.mCallback == null) {
return false;
}
if (!subMenu.hasVisibleItems()) {
return true;
}
new MenuPopupHelper(WindowDecorActionBar.this.getThemedContext(), subMenu).show();
return true;
}
public void onCloseSubMenu(SubMenuBuilder menu) {
}
@Override // android.support.v7.view.menu.MenuBuilder.Callback
public void onMenuModeChange(MenuBuilder menu) {
if (this.mCallback != null) {
invalidate();
WindowDecorActionBar.this.mContextView.showOverflowMenu();
}
}
}
@RestrictTo({RestrictTo.Scope.GROUP_ID})
public class TabImpl extends ActionBar.Tab {
private ActionBar.TabListener mCallback;
private CharSequence mContentDesc;
private View mCustomView;
private Drawable mIcon;
private int mPosition = -1;
private Object mTag;
private CharSequence mText;
public TabImpl() {
}
@Override // android.support.v7.app.ActionBar.Tab
public Object getTag() {
return this.mTag;
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setTag(Object tag) {
this.mTag = tag;
return this;
}
public ActionBar.TabListener getCallback() {
return this.mCallback;
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setTabListener(ActionBar.TabListener callback) {
this.mCallback = callback;
return this;
}
@Override // android.support.v7.app.ActionBar.Tab
public View getCustomView() {
return this.mCustomView;
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setCustomView(View view) {
this.mCustomView = view;
if (this.mPosition >= 0) {
WindowDecorActionBar.this.mTabScrollView.updateTab(this.mPosition);
}
return this;
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setCustomView(int layoutResId) {
return setCustomView(LayoutInflater.from(WindowDecorActionBar.this.getThemedContext()).inflate(layoutResId, (ViewGroup) null));
}
@Override // android.support.v7.app.ActionBar.Tab
public Drawable getIcon() {
return this.mIcon;
}
@Override // android.support.v7.app.ActionBar.Tab
public int getPosition() {
return this.mPosition;
}
public void setPosition(int position) {
this.mPosition = position;
}
@Override // android.support.v7.app.ActionBar.Tab
public CharSequence getText() {
return this.mText;
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setIcon(Drawable icon) {
this.mIcon = icon;
if (this.mPosition >= 0) {
WindowDecorActionBar.this.mTabScrollView.updateTab(this.mPosition);
}
return this;
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setIcon(int resId) {
return setIcon(AppCompatResources.getDrawable(WindowDecorActionBar.this.mContext, resId));
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setText(CharSequence text) {
this.mText = text;
if (this.mPosition >= 0) {
WindowDecorActionBar.this.mTabScrollView.updateTab(this.mPosition);
}
return this;
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setText(int resId) {
return setText(WindowDecorActionBar.this.mContext.getResources().getText(resId));
}
@Override // android.support.v7.app.ActionBar.Tab
public void select() {
WindowDecorActionBar.this.selectTab(this);
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setContentDescription(int resId) {
return setContentDescription(WindowDecorActionBar.this.mContext.getResources().getText(resId));
}
@Override // android.support.v7.app.ActionBar.Tab
public ActionBar.Tab setContentDescription(CharSequence contentDesc) {
this.mContentDesc = contentDesc;
if (this.mPosition >= 0) {
WindowDecorActionBar.this.mTabScrollView.updateTab(this.mPosition);
}
return this;
}
@Override // android.support.v7.app.ActionBar.Tab
public CharSequence getContentDescription() {
return this.mContentDesc;
}
}
@Override // android.support.v7.app.ActionBar
public void setCustomView(View view) {
this.mDecorToolbar.setCustomView(view);
}
@Override // android.support.v7.app.ActionBar
public void setCustomView(View view, ActionBar.LayoutParams layoutParams) {
view.setLayoutParams(layoutParams);
this.mDecorToolbar.setCustomView(view);
}
@Override // android.support.v7.app.ActionBar
public void setListNavigationCallbacks(SpinnerAdapter adapter, ActionBar.OnNavigationListener callback) {
this.mDecorToolbar.setDropdownParams(adapter, new NavItemSelectedListener(callback));
}
@Override // android.support.v7.app.ActionBar
public int getSelectedNavigationIndex() {
switch (this.mDecorToolbar.getNavigationMode()) {
case 1:
return this.mDecorToolbar.getDropdownSelectedPosition();
case 2:
if (this.mSelectedTab != null) {
return this.mSelectedTab.getPosition();
}
return -1;
default:
return -1;
}
}
@Override // android.support.v7.app.ActionBar
public int getNavigationItemCount() {
switch (this.mDecorToolbar.getNavigationMode()) {
case 1:
return this.mDecorToolbar.getDropdownItemCount();
case 2:
return this.mTabs.size();
default:
return 0;
}
}
@Override // android.support.v7.app.ActionBar
public int getTabCount() {
return this.mTabs.size();
}
@Override // android.support.v7.app.ActionBar
public void setNavigationMode(int mode) {
boolean z;
boolean z2 = true;
int oldMode = this.mDecorToolbar.getNavigationMode();
switch (oldMode) {
case 2:
this.mSavedTabPosition = getSelectedNavigationIndex();
selectTab(null);
this.mTabScrollView.setVisibility(8);
break;
}
if (!(oldMode == mode || this.mHasEmbeddedTabs || this.mOverlayLayout == null)) {
ViewCompat.requestApplyInsets(this.mOverlayLayout);
}
this.mDecorToolbar.setNavigationMode(mode);
switch (mode) {
case 2:
ensureTabsExist();
this.mTabScrollView.setVisibility(0);
if (this.mSavedTabPosition != -1) {
setSelectedNavigationItem(this.mSavedTabPosition);
this.mSavedTabPosition = -1;
break;
}
break;
}
DecorToolbar decorToolbar = this.mDecorToolbar;
if (mode != 2 || this.mHasEmbeddedTabs) {
z = false;
} else {
z = true;
}
decorToolbar.setCollapsible(z);
ActionBarOverlayLayout actionBarOverlayLayout = this.mOverlayLayout;
if (mode != 2 || this.mHasEmbeddedTabs) {
z2 = false;
}
actionBarOverlayLayout.setHasNonEmbeddedTabs(z2);
}
@Override // android.support.v7.app.ActionBar
public ActionBar.Tab getTabAt(int index) {
return this.mTabs.get(index);
}
@Override // android.support.v7.app.ActionBar
public void setIcon(int resId) {
this.mDecorToolbar.setIcon(resId);
}
@Override // android.support.v7.app.ActionBar
public void setIcon(Drawable icon) {
this.mDecorToolbar.setIcon(icon);
}
public boolean hasIcon() {
return this.mDecorToolbar.hasIcon();
}
@Override // android.support.v7.app.ActionBar
public void setLogo(int resId) {
this.mDecorToolbar.setLogo(resId);
}
@Override // android.support.v7.app.ActionBar
public void setLogo(Drawable logo) {
this.mDecorToolbar.setLogo(logo);
}
public boolean hasLogo() {
return this.mDecorToolbar.hasLogo();
}
@Override // android.support.v7.app.ActionBar
public void setDefaultDisplayHomeAsUpEnabled(boolean enable) {
if (!this.mDisplayHomeAsUpSet) {
setDisplayHomeAsUpEnabled(enable);
}
}
}
| [
"jonathanvill00@gmail.com"
] | jonathanvill00@gmail.com |
45122693ddf6e0cd3ec941033215e604e12a4d1e | 2b294d593a2c2f03b52e14abd86786c0e7f9125b | /src/java/converters/SangueConverter.java | 27fac48febc1d0fb32f913e751a799aa55d9dfe5 | [] | no_license | gleywsonribeiro/sgpm3 | c80884d010f6c9934442b265a28401386ce74b6f | bff36f4aeeb3f2e7876df08ad4968e6981657c24 | refs/heads/master | 2021-01-10T21:35:49.058187 | 2014-06-03T09:39:31 | 2014-06-03T09:39:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,738 | java | package converters;
import modelo.Sangue;
import controllers.SangueFacade;
import beans.util.JsfUtil;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.inject.Inject;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
@FacesConverter(value = "sangueConverter")
public class SangueConverter implements Converter {
@Inject
private SangueFacade ejbFacade;
@Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0 || JsfUtil.isDummySelectItem(component, value)) {
return null;
}
return this.ejbFacade.find(getKey(value));
}
java.lang.Long getKey(String value) {
java.lang.Long key;
key = Long.valueOf(value);
return key;
}
String getStringKey(java.lang.Long value) {
StringBuffer sb = new StringBuffer();
sb.append(value);
return sb.toString();
}
@Override
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null
|| (object instanceof String && ((String) object).length() == 0)) {
return null;
}
if (object instanceof Sangue) {
Sangue o = (Sangue) object;
return getStringKey(o.getId());
} else {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "object {0} is of type {1}; expected type: {2}", new Object[]{object, object.getClass().getName(), Sangue.class.getName()});
return null;
}
}
}
| [
"Gleywson@Gleywson-PC"
] | Gleywson@Gleywson-PC |
dc180195109b4e6338980581a14e059603d5b117 | 59e9d60e65ed89baa06df1aa1773165fa78cbc39 | /src/test/java/hu/wirthandras/firefly/service/PDFGeneratorTest.java | 37e660512e4a26b066030f2b5a2862318d959e5a | [] | no_license | wirthandras/firefly | b6172ded904805454c0b50c2ea32d7aa839b2b34 | 0f44877cae037603b42480a83fd03b4d3fd9a0f0 | refs/heads/master | 2021-06-24T05:59:30.629794 | 2019-09-09T19:19:31 | 2019-09-09T19:19:31 | 150,847,542 | 0 | 0 | null | 2021-06-15T15:59:32 | 2018-09-29T09:18:48 | Java | UTF-8 | Java | false | false | 1,697 | java | package hu.wirthandras.firefly.service;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.IOException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import hu.wirthandras.firefly.domain.Input;
public class PDFGeneratorTest {
private PDFGenerator classToTest;
private Input input;
@Before
public void setUp() {
classToTest = new PDFGenerator();
input = mock(Input.class);
when(input.getValid()).thenReturn("2018.01.01");
when(input.getApplicable()).thenReturn("2018.02.02");
when(input.getAuthorizingPersonName()).thenReturn("John");
when(input.getProxyPersonName()).thenReturn("Billy");
when(input.getCondition()).thenReturn("Condition");
when(input.getWitness1Address()).thenReturn("Witness1Address");
when(input.getWitness2Address()).thenReturn("Witness2Address");
when(input.getWitness1Name()).thenReturn("Witness1Name");
when(input.getWitness2Name()).thenReturn("Witness2Name");
}
private void verification() {
verify(input, times(1)).getValid();
verify(input, times(1)).getApplicable();
verify(input, times(1)).getAuthorizingPersonName();
verify(input, times(1)).getProxyPersonName();
verify(input, times(1)).getCondition();
verify(input, times(1)).getWitness1Address();
verify(input, times(1)).getWitness2Address();
verify(input, times(1)).getWitness1Name();
verify(input, times(1)).getWitness2Name();
}
@Test
public void testGenerate() throws IOException {
classToTest.addData(input);
Assert.assertNotNull(classToTest.generate());
verification();
}
}
| [
"agrippa.wia@gmail.com"
] | agrippa.wia@gmail.com |
07f8dc57c24eb318a12c6944678295b35ac4c1bd | 4416bdf8bc17132d010cb6a3d9da6a1e5551a24d | /src/main/java/repositories/UserRepository.java | 1bdf5e31cf7edf3148d88f1fc9f61e4a31731d1e | [] | no_license | alisabudur/Final-project-AOP | 826fd82a40f7d1c1812a44d071c2bc542bea3131 | a1ff7764b2626977270cda98a6c41f2ba46bf97c | refs/heads/master | 2020-12-30T14:20:21.262108 | 2017-05-15T08:24:34 | 2017-05-15T08:24:34 | 91,312,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package repositories;
import domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import repositories.interfaces.IUserRepository;
import java.util.List;
/**
* Created by Alisa on 5/14/2017.
*/
@Repository
public class UserRepository implements IUserRepository {
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List<User> getAll() {
String sql = "select * from Users";
return jdbcTemplate.query(sql, (rs, i) -> new User(rs.getInt("id"), rs.getString("name"), rs.getInt("eventId")));
}
@Override
public void save(User user) {
String sql = "insert into Users (name) values (?)";
jdbcTemplate.update(sql, user.getName());
}
@Override
public User findOne(Integer id) {
String sql = "select * from Users where id=?";
User user = jdbcTemplate.queryForObject(sql, BeanPropertyRowMapper.newInstance(User.class), id);
return user;
}
}
| [
"alisabudur@gmail.com"
] | alisabudur@gmail.com |
e16132a345c4ca68bbf558f684b0514662760b06 | 158f70c9876502caea4202b7b5aca89e343ccb3f | /v4o6/app/src/main/java/com/yangyr17/v4o6/JNIUtils.java | 0ed6a103541026166325e12a2fe8430d34d12f83 | [] | no_license | dylanyang17/4over6 | 443fbb179e700634a0e406ff9a651d14ec9a72b3 | 45199f9b52e122004d0f0be228557c3316841a14 | refs/heads/master | 2022-11-03T22:54:58.394931 | 2020-06-07T04:40:50 | 2020-06-07T04:40:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package com.yangyr17.v4o6;
public class JNIUtils {
// ipv6: The ipv6 address of the server.
// ipFifoPath: The path of fifo for obtaining ipv4 address, route and dns.
// statFifoPath: The path of fifo for obtaining statistics information.
static public native String startBackend(String ipv6, int port, String ipFifoPath, String tunFifoPath, String statFifoPath, String debugFifoPath, String FBFifoPath);
static {
System.loadLibrary("hellojni");
}
} | [
"315629555@qq.com"
] | 315629555@qq.com |
c5691fb63a67ef17380c2977d3d67340b860b0af | 1a983ef9baafddaa3b9dd968339f7c86da470484 | /src/main/java/siso/edu/cn/service/ViewGetDeviceLastLocationService.java | 016f397c3076fcd61b802a90f6efee8e5f2cddd6 | [
"MIT"
] | permissive | ouyushan/ElectricIOTServer | e10ef535d696d60c7cc6c9c68c77076b503fdc67 | 80e690a8ee7a31b7378b1e7f6d622e3481820775 | refs/heads/master | 2022-05-11T21:38:11.542731 | 2019-09-15T15:11:08 | 2019-09-15T15:11:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 839 | java | package siso.edu.cn.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import siso.edu.cn.dao.IDaoImpl;
import siso.edu.cn.dao.ViewGetDeviceLastLocationDao;
import siso.edu.cn.entity.ViewGetDeviceLastLocationEntity;
@Service
@Transactional
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public class ViewGetDeviceLastLocationService extends IServiceImpl<ViewGetDeviceLastLocationEntity> {
private ViewGetDeviceLastLocationDao dao;
@Autowired
public ViewGetDeviceLastLocationService(ViewGetDeviceLastLocationDao dao) {
super(dao);
this.dao = dao;
}
}
| [
"wenyin.tao@163.com"
] | wenyin.tao@163.com |
8e9f746c579ca6edc80e11bf705e37caee3bbf77 | fb60f58fd41d9fd52a821519c507e464cb591f68 | /Amazon/src/test/java/homepagetests/SingOutTest.java | 7a19a98b1f91c8e681cb0db6da37b3bc970fa069 | [] | no_license | jamiskyblue/SEL_BootCamp | 6473885435e24e86b30d08cc67fe0d49d0c59cc2 | 920fe052edb1470201dd9ba0e86f6043d5e73113 | refs/heads/master | 2022-07-02T19:39:50.799113 | 2019-10-27T22:57:37 | 2019-10-27T22:57:37 | 217,657,536 | 0 | 0 | null | 2022-06-21T02:07:07 | 2019-10-26T04:50:59 | Java | UTF-8 | Java | false | false | 419 | java | package homepagetests;
import homepage.HomePage;
import org.testng.annotations.Test;
public class SingOutTest extends HomePage {
@Test(enabled = false)
public void validateSignOut(){
login();
validateEmailField();
typeOnEmailField("jarifboksh@gmail.com");
clickOnContinue();
validatePasswordField("jarifjamil");
clickOnSignInButton();
signOut();
}
} | [
"jamilboksh@gmail.com"
] | jamilboksh@gmail.com |
4ea068e3e3e0353b6894f2c12eb370e24622b645 | 56d6fa60f900fb52362d4cce950fa81f949b7f9b | /aws-sdk-java/src/main/java/com/amazonaws/services/elastictranscoder/model/ListPipelinesResult.java | ea0a2d252615703aa68e8c9e2d90a80805c988e3 | [
"JSON",
"Apache-2.0"
] | permissive | TarantulaTechnology/aws | 5f9d3981646e193c89f1c3fa746ec3db30252913 | 8ce079f5628334f83786c152c76abd03f37281fe | refs/heads/master | 2021-01-19T11:14:53.050332 | 2013-09-15T02:37:02 | 2013-09-15T02:37:02 | 12,839,311 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,684 | java | /*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.elastictranscoder.model;
import java.io.Serializable;
/**
* <p>
* A list of the pipelines associated with the current AWS account.
* </p>
*/
public class ListPipelinesResult implements Serializable {
/**
* An array of <code>Pipeline</code> objects.
*/
private com.amazonaws.internal.ListWithAutoConstructFlag<Pipeline> pipelines;
/**
* An array of <code>Pipeline</code> objects.
*
* @return An array of <code>Pipeline</code> objects.
*/
public java.util.List<Pipeline> getPipelines() {
if (pipelines == null) {
pipelines = new com.amazonaws.internal.ListWithAutoConstructFlag<Pipeline>();
pipelines.setAutoConstruct(true);
}
return pipelines;
}
/**
* An array of <code>Pipeline</code> objects.
*
* @param pipelines An array of <code>Pipeline</code> objects.
*/
public void setPipelines(java.util.Collection<Pipeline> pipelines) {
if (pipelines == null) {
this.pipelines = null;
return;
}
com.amazonaws.internal.ListWithAutoConstructFlag<Pipeline> pipelinesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Pipeline>(pipelines.size());
pipelinesCopy.addAll(pipelines);
this.pipelines = pipelinesCopy;
}
/**
* An array of <code>Pipeline</code> objects.
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param pipelines An array of <code>Pipeline</code> objects.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ListPipelinesResult withPipelines(Pipeline... pipelines) {
if (getPipelines() == null) setPipelines(new java.util.ArrayList<Pipeline>(pipelines.length));
for (Pipeline value : pipelines) {
getPipelines().add(value);
}
return this;
}
/**
* An array of <code>Pipeline</code> objects.
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param pipelines An array of <code>Pipeline</code> objects.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ListPipelinesResult withPipelines(java.util.Collection<Pipeline> pipelines) {
if (pipelines == null) {
this.pipelines = null;
} else {
com.amazonaws.internal.ListWithAutoConstructFlag<Pipeline> pipelinesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<Pipeline>(pipelines.size());
pipelinesCopy.addAll(pipelines);
this.pipelines = pipelinesCopy;
}
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getPipelines() != null) sb.append("Pipelines: " + getPipelines() );
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getPipelines() == null) ? 0 : getPipelines().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (obj instanceof ListPipelinesResult == false) return false;
ListPipelinesResult other = (ListPipelinesResult)obj;
if (other.getPipelines() == null ^ this.getPipelines() == null) return false;
if (other.getPipelines() != null && other.getPipelines().equals(this.getPipelines()) == false) return false;
return true;
}
}
| [
"TarantulaTechnology@users.noreply.github.com"
] | TarantulaTechnology@users.noreply.github.com |
a947f20b7517a0cfcf7011e08ab39fff35ce21f8 | 89c5b8b050f0afa186f26423a546a72c2e376d91 | /src/rules/UpgradablePiece.java | 3cdc4382b20c1b740400fc7d69f0f3d96bf2cf04 | [] | no_license | GiuMaz/JavaChess | eb8b170f070bfbd67508251fabc7b0b8735de03c | 6fd01cdc42160badf9d867b9d03cde9c6c3a6b59 | refs/heads/master | 2020-05-19T11:15:53.735965 | 2015-03-03T12:26:31 | 2015-03-03T12:26:31 | 31,407,562 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package rules;
/**
* interfaccia che identifica un pezzo che può essere promosso ad un altro pezzo.
*/
public interface UpgradablePiece {
/**
* ritrona vero se il pezzo è in posizione di promozione
* @return true se e solo se il pezzo è in posizione di promozione
*/
public boolean isInUpgradePosition();
}
| [
"mazzi.giulio2@gmail.com"
] | mazzi.giulio2@gmail.com |
3dc6ed62fa175f8d0e54300bd6b026e65623a120 | 1d24681f9d5a78a2c835ca9c62fbfd82c97ecd83 | /src/sql/DaoWorker.java | 1181bd2b151c3b610f021862a827bf07bc24b837 | [] | no_license | vatvalusha/smallProject | 2a21315a8ccd74cee0a823db373ce255d6975534 | 8adb5b3d7943fb6d2d9759efe90abd768b74e25a | refs/heads/master | 2020-09-22T03:12:16.171133 | 2016-08-20T09:56:04 | 2016-08-20T09:56:04 | 66,139,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,765 | java | package sql;
import java.sql.SQLException;
import manager.Connect;
public class DaoWorker {
String sqlInspectio="Select * from employer WHERE email_emp = ? and pass_emp = ?";
String sqlInsert = "insert into employer (name_emp,secondname_emp,pass_emp,email_emp,specialty_emp) value(?,?,?,?,?);";
Connect connect = new Connect();
public void AddWorker(String name, String surname,
String password, String email, String company) throws SQLException
{
try{
connect.preparedStatement = connect.connection.prepareStatement(sqlInsert);
connect.preparedStatement.setString(1, name);
connect.preparedStatement.setString(2, surname);
connect.preparedStatement.setString(3, password);
connect.preparedStatement.setString(4, email);
connect.preparedStatement.setString(5, company);
connect.preparedStatement.executeUpdate();
}catch (SQLException e) {
e.printStackTrace();
}finally {
connect.preparedStatement.close();
connect.connection.close();
}
}
public boolean inspectio(String email, String password) throws SQLException{
try{
connect.preparedStatement = connect.connection.prepareStatement(sqlInspectio);
connect.preparedStatement.setString(1, email);
connect.preparedStatement.setString(2, password);
try {
connect.resultSet = connect.preparedStatement.executeQuery();
return connect.resultSet.next();
}finally{
if(connect.resultSet != null) connect.resultSet.close();
if(connect.preparedStatement != null) connect.preparedStatement.close();
if(connect.connection != null) connect.connection.close();
}
}catch(SQLException e){
e.printStackTrace();
return false;
}
}
}
| [
"vatvalusha2gmail.com"
] | vatvalusha2gmail.com |
d35e33a557ce3ddbfafd414267744b7c64243303 | fe4bb635c5cde371c0612a28656fa365b5d9cd45 | /HelpTools/src/main/java/com/csc/model/Fresher.java | 2d1cf9797e8e286211fa2ed1137cd34cace9cdfb | [] | no_license | HelpToolTeam/HelpTool | 22ea60a9e776e36a9e9c75f11138b10fc731252d | e19e06ff11b13bc4ce0ffb6ca91f25b83b88054a | refs/heads/master | 2021-01-18T16:51:41.942564 | 2017-03-31T04:00:13 | 2017-03-31T04:00:13 | 86,775,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,255 | java | package com.csc.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity(name="FRESHER")
public class Fresher implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@Column(name="FRESHER_ID")
private int fresherId;
@Column(name="FULLNAME")
private String fullName;
@Column(name="EMAIl")
private String email;
@Column(name="PROFESSION")
private String profession;
public int getFresherId() {
return fresherId;
}
public void setFresherId(int fresherId) {
this.fresherId = fresherId;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
}
@Override
public String toString() {
return "Fresher [fresherId=" + fresherId + ", fullName=" + fullName + ", email=" + email + ", profession="
+ profession + "]";
}
}
| [
"changtraixubienvungtau@gmail.com"
] | changtraixubienvungtau@gmail.com |
22f3c17de8a9b42720b5960e6600c220a1ebc352 | a1c11e8817a1de8a4494909c8c3c8e420d5b124e | /sample.permission/src/main/java/com/sample/permission/dto/RoleDto.java | 3edeaeffff259965451fe4e5d4c7e45866c41c3b | [] | no_license | mysticalmountain/sample | 51011376efc02b4b5204a43f544ac6416b6cd0d6 | c80c7ecc05413721858cc3bd6b55f3b55b9b0969 | refs/heads/master | 2020-04-15T06:55:31.635205 | 2017-10-28T15:38:28 | 2017-10-28T15:38:28 | 68,129,193 | 0 | 0 | null | 2016-11-18T03:12:48 | 2016-09-13T17:03:14 | Java | UTF-8 | Java | false | false | 661 | java | package com.sample.permission.dto;
import java.util.Set;
/**
* Created by andongxu on 16-11-21.
*/
public class RoleDto {
private Long id;
private String name;
private Set<PermissionDto> permissions;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<PermissionDto> getPermissions() {
return permissions;
}
public void setPermissions(Set<PermissionDto> permissions) {
this.permissions = permissions;
}
}
| [
"dongxudotan@163.com"
] | dongxudotan@163.com |
45d584906a007b085e201de054c4bc2399fbc5a9 | 7dd7c127d44add582b3f16d91a5b6c592ad87e1d | /src/main/java/com/projects/testMax/entity/Users.java | 50aca0bf577c7750ff445d2b9ca7df7858d67a65 | [] | no_license | pnisarg/testMax | 6ad852ddbd3836b4615f1bcb437f283331a0448e | cf540ae35797c7d951f3cd4ecba85d4e186e0478 | refs/heads/master | 2021-01-10T06:16:04.027009 | 2015-11-22T22:06:56 | 2015-11-22T22:06:56 | 46,638,139 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,356 | java | package com.projects.testMax.entity;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Users {
@Id
private String username;
private String password;
private String firstName;
private String lastName;
private String email;
//can include some more fields as per requirements
private String privilege;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPrivilege() {
return privilege;
}
public void setPrivilege(String privilege) {
this.privilege = privilege;
}
@Override
public String toString() {
return "Users [username=" + username + ", password=" + password
+ ", firstName=" + firstName + ", lastName=" + lastName
+ ", email=" + email + ", privilege=" + privilege + "]";
}
}
| [
"pnisarg26@yahoo.com"
] | pnisarg26@yahoo.com |
3318d7680a1317ee3efa731738484eb6d8780ced | 4caa9817ddbfc8f0497d645fbd0aa25fcca351c5 | /CreatingServlet_Re/src/java/NewServlet.java | 43ea08c8288e0d4604ed227381bac0b1ab92d663 | [] | no_license | coderbrains/Server-Side-Programming-JSP | c636bdc85b6b39925e89b0a07a91f21e4e6ce18c | c6c48e388393707730960d22e07df0bc7f836984 | refs/heads/master | 2023-04-28T16:44:12.428492 | 2021-05-17T14:41:57 | 2021-05-17T14:41:57 | 365,470,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,905 | 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.
*/
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;
/**
*
* @author Awanish kumar singh
*/
public class NewServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet NewServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>This is me overridding the service method</h1>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"awanishkumarsingh03@gmail.com"
] | awanishkumarsingh03@gmail.com |
a9d9009d8c124b9af630acb3c3bb73448f20a4a0 | 58df8f5ab6f4952077c0a63440d50dd88ed69524 | /src/java/wng/http/GetTime.java | 5d0dc93ca95891b8409a4a59ba492d464e00c52c | [] | no_license | talentdeveloper/wng-server | 37277846b72dbee5140c1d012e67da8d43aadac8 | 6dc187f22f4e5d61a8ff4fab64e3f18529b9fe6f | refs/heads/master | 2020-04-10T08:07:36.261011 | 2018-12-08T03:04:34 | 2018-12-08T03:04:34 | 160,898,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java | /******************************************************************************
* Copyright © 2013-2016 The Nxt Core Developers. *
* *
* See the AUTHORS.txt, DEVELOPER-AGREEMENT.txt and LICENSE.txt files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* Nxt software, including this file, may be copied, modified, propagated, *
* or distributed except according to the terms contained in the LICENSE.txt *
* file. *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
package wng.http;
import wng.Wng;
import org.json.simple.JSONObject;
import org.json.simple.JSONStreamAware;
import javax.servlet.http.HttpServletRequest;
public final class GetTime extends APIServlet.APIRequestHandler {
static final GetTime instance = new GetTime();
private GetTime() {
super(new APITag[] {APITag.INFO});
}
@Override
protected JSONStreamAware processRequest(HttpServletRequest req) {
JSONObject response = new JSONObject();
response.put("time", Wng.getEpochTime());
return response;
}
@Override
protected boolean allowRequiredBlockParameters() {
return false;
}
}
| [
"root@sg.wang-coin.com"
] | root@sg.wang-coin.com |
0303107b961e135060be317b1ae1c7c7cc2ed52d | 7500c3a8132d7a83e6dc72a0d845b1bb00d13317 | /recast-client/src/main/java/fr/guddy/recastclient/bot/SimpleButton.java | a0d17a1baedcee6598d1bf29aa9d60e10fef6fd3 | [
"Apache-2.0"
] | permissive | RoRoche/ChatbotGateway | bde0e19b5f37fffc90ff033dec60e1547fc9f866 | ce27ad337586d2450084b7bd8b39cda41b5466c9 | refs/heads/master | 2021-07-24T05:30:41.039664 | 2019-02-14T19:43:15 | 2019-02-14T19:43:15 | 158,445,664 | 0 | 0 | Apache-2.0 | 2020-04-26T16:51:11 | 2018-11-20T20:13:07 | Java | UTF-8 | Java | false | false | 605 | java | package fr.guddy.recastclient.bot;
import com.fasterxml.jackson.annotation.JsonInclude;
@JsonInclude(JsonInclude.Include.NON_NULL)
public final class SimpleButton implements Button {
private final String title;
private final String value;
public SimpleButton(final String title, final String value) {
this.title = title;
this.value = value;
}
public SimpleButton(final Text text, final String value) {
this(text.value(), value);
}
public String getTitle() {
return title;
}
public String getValue() {
return value;
}
}
| [
"romain.rochegude@gmail.com"
] | romain.rochegude@gmail.com |
3438e4877f2b2da8093a25fcb89882c6d7de297d | 57e5837106afc702672f7f799ea3d98ec4c8f7bc | /CDYNE4j/src/main/java/org/productivity/cdyne4j/cdyne/smsnotify/SMSIncomingMessage.java | 73f68bbcdf0e76428d01c144bbdd6e84519edfda | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | bpatterson971/cdyne4j | 677933ed1a62b8a736aff296add56140008cbc86 | 229c1b67b3c5074b97eee8c86af186a63014a401 | refs/heads/master | 2020-04-28T08:13:32.535985 | 2019-05-19T21:25:09 | 2019-05-19T21:25:09 | 175,119,075 | 0 | 0 | Apache-2.0 | 2019-03-12T14:26:39 | 2019-03-12T02:24:23 | Java | UTF-8 | Java | false | false | 5,064 | java | package org.productivity.cdyne4j.cdyne.smsnotify;
import java.io.Reader;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.productivity.cdyne4j.CDYNEException;
import org.productivity.cdyne4j.CDYNERuntimeException;
/**
* SMSIncomingMessage implements: https://www.cdyne.com/sms/
*
* <pre>
* 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.
* </pre>
*
* @author Justin Yunke <justin-github@yunke.us>
*/
@XmlRootElement(name="SMSIncomingMessage")
public class SMSIncomingMessage implements Serializable {
private static final long serialVersionUID = -7819173726600564571L;
public static JAXBContext SMS_INCOMING_MESSAGE_JAXB_CONTEXT = null;
@XmlRootElement(name="ArrayOfSMSIncomingMessage",namespace="http://sms2.cdyne.com")
public static final class ArrayOfSMSIncomingMessage implements Serializable {
private static final long serialVersionUID = 1L;
private static JAXBContext ARRAY_OF_SMS_INCOMING_MESSAGE_JAXB_CONTEXT = null;
static {
try {
ARRAY_OF_SMS_INCOMING_MESSAGE_JAXB_CONTEXT = JAXBContext.newInstance(ArrayOfSMSIncomingMessage.class);
} catch (JAXBException jaxbe) {
throw new CDYNERuntimeException(jaxbe);
}
}
protected List<SMSIncomingMessage> smsIncomingMessages = null;
@XmlElement(name="SMSIncomingMessage")
public List<SMSIncomingMessage> getSmsIncomingMessages() {
if (smsIncomingMessages == null) {
smsIncomingMessages = new ArrayList<SMSIncomingMessage>();
}
return smsIncomingMessages;
}
public void setSmsResponses(List<SMSIncomingMessage> smsIncomingMessages) {
this.smsIncomingMessages = smsIncomingMessages;
}
public static ArrayOfSMSIncomingMessage parse(Reader reader) throws CDYNEException {
try {
Unmarshaller u = ARRAY_OF_SMS_INCOMING_MESSAGE_JAXB_CONTEXT.createUnmarshaller();
ArrayOfSMSIncomingMessage response = (ArrayOfSMSIncomingMessage) u.unmarshal(reader);
return response;
} catch (JAXBException e) {
throw new CDYNEException(e);
}
}
}
static {
try {
SMS_INCOMING_MESSAGE_JAXB_CONTEXT = JAXBContext.newInstance(SMSIncomingMessage.class);
} catch (Exception e) {
throw new CDYNERuntimeException(e);
}
}
protected String fromPhoneNumber = null;
protected String incomingMessageID = null;
protected String matchedMessageID = null;
protected String message = null;
protected String responseReceiveDate = null;
protected String toPhoneNumber = null;
protected static SMSIncomingMessage parse(Reader reader) throws CDYNEException {
try {
Unmarshaller u = SMS_INCOMING_MESSAGE_JAXB_CONTEXT.createUnmarshaller();
SMSIncomingMessage response = (SMSIncomingMessage) u.unmarshal(reader);
return response;
} catch (JAXBException e) {
throw new CDYNEException(e);
}
}
@XmlElement(name="FromPhoneNumber")
public String getFromPhoneNumber() {
return fromPhoneNumber;
}
public void setFromPhoneNumber(String fromPhoneNumber) {
this.fromPhoneNumber = fromPhoneNumber;
}
@XmlElement(name="IncomingMessageID")
public String getIncomingMessageID() {
return incomingMessageID;
}
public void setIncomingMessageID(String incomingMessageID) {
this.incomingMessageID = incomingMessageID;
}
@XmlElement(name="MatchedMessageID")
public String getMatchedMessageID() {
return matchedMessageID;
}
public void setMatchedMessageID(String matchedMessageID) {
this.matchedMessageID = matchedMessageID;
}
@XmlElement(name="Message")
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@XmlElement(name="ResponseReceiveDate")
public String getResponseReceiveDate() {
return responseReceiveDate;
}
public void setResponseReceiveDate(String responseReceiveDate) {
this.responseReceiveDate = responseReceiveDate;
}
@XmlElement(name="ToPhoneNumber")
public String getToPhoneNumber() {
return toPhoneNumber;
}
public void setToPhoneNumber(String toPhoneNumber) {
this.toPhoneNumber = toPhoneNumber;
}
@Override
public String toString() {
return
"FromPhoneNumber=" + this.fromPhoneNumber + " " +
"IncomingMessageID=" + this.incomingMessageID + " " +
"MatchedMessageID=" + this.matchedMessageID + " " +
"Message=" + this.message + " " +
"ToPhoneNumber=" + this.toPhoneNumber;
}
}
| [
"justin-cdyne4j@yunke.us"
] | justin-cdyne4j@yunke.us |
101ba7e15e0022cf3c00471313f9eaf1ecf72843 | 63f25094da2e8f95681f5f647a6b7c6851550e6e | /src/main/java/pl/kolban/SpringCarRental/model/CarType.java | 720d2e579f442476c966ee8f74c2d8854ff4ae2c | [] | no_license | MichalKolban/SpringCarRental | 4644a78faa5966832f71cead69624cc17ed9ba49 | d67379cac682a572b74c13ba36f45d185dd79486 | refs/heads/master | 2022-07-09T06:23:37.999012 | 2020-03-16T16:55:16 | 2020-03-16T16:55:16 | 241,434,046 | 0 | 0 | null | 2022-06-21T02:49:23 | 2020-02-18T18:16:29 | Java | UTF-8 | Java | false | false | 122 | java | package pl.kolban.SpringCarRental.model;
public enum CarType {
SUV,
SPORT,
CLASSIC,
VAN;
}
| [
"michal.kolban@gmail.com"
] | michal.kolban@gmail.com |
0b5a7c65b8c19fab69a6f6dd9c42e05148b4032b | a89d8bf76cc5b1f20699e6155fe4609163bd5d79 | /01_MyFirstHelloWorld/app/src/main/java/com/example/matri/myfirsthelloworld/MainActivity.java | 064bc8e843e3f5ef97b251f3cdee0f543579cb8d | [] | no_license | Crushedkrz78/BasicAndroidApps | fa174132cd7c357b7ced81db73eb3677d6037854 | 487de652414900fa71205853dc6a418612a3648b | refs/heads/master | 2021-05-01T13:37:31.466098 | 2018-02-16T17:45:19 | 2018-02-16T17:45:19 | 121,080,726 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package com.example.matri.myfirsthelloworld;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
public static final String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/** Method called when user taps Send Button**/
public void sendMessage(View view){
//Do Something in response to Button
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editText);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
}
| [
"matrix_kriztyan@live.com.mx"
] | matrix_kriztyan@live.com.mx |
a16831f8f58e039fdca6ae679643741ffbae9b44 | 6c243f319bc140981c9fac5be5beef39133441dd | /app/src/main/java/com/radioknit/testmmi/Const.java | 1befa029913891097c11e7c87f6b2fe676d26978 | [] | no_license | AndroidPayal/MMIDec_4Sep18 | 185c351bafb7d4899935689af397ee3a035b1297 | e31d286e110f048e944afe7f72e467ef913f21ad | refs/heads/master | 2020-04-24T09:19:52.684533 | 2019-04-03T11:05:24 | 2019-04-03T11:05:24 | 171,859,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package com.radioknit.testmmi;
/**
*/
public class Const {
static final String TAG = "SPP_TERMINAL";
public static final int NO_OF_FLOORS = 16;
}
| [
"payalagrawal2311@gmail.com"
] | payalagrawal2311@gmail.com |
9dc546498f7273ffa33524adb990529a31d9ed85 | a5a7e06fe569be4ecc3f6eee2704f6f6f4d8a3eb | /plugin/src/main/java/com/craftmend/openaudiomc/generic/voicechat/DefaultVoiceServiceImpl.java | 34939adbabeb4d5de82cc963e14448658c2d354b | [] | permissive | ApocalypsjeNL/OpenAudioMc | 48ae4f148033ba2cc6d6a9ca5d318d871b06eb1a | 3dd1f48c11995897a67f03c8e6a0261d503e79c4 | refs/heads/master | 2021-07-17T05:55:50.470889 | 2021-01-25T12:41:15 | 2021-01-25T12:41:15 | 115,910,912 | 0 | 0 | Apache-2.0 | 2021-01-25T12:41:16 | 2018-01-01T09:46:13 | Java | UTF-8 | Java | false | false | 1,509 | java | package com.craftmend.openaudiomc.generic.voicechat;
import com.craftmend.openaudiomc.generic.logging.OpenAudioLogger;
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
import com.craftmend.openaudiomc.generic.voicechat.driver.VoiceServerDriver;
public class DefaultVoiceServiceImpl implements VoiceService {
private VoiceServerDriver driver;
private String host;
private String password;
private boolean enabled = false;
public DefaultVoiceServiceImpl() {
this.host = StorageKey.AUTH_VOICE_SERVER.getString();
this.password = StorageKey.AUTH_VOICE_PASSWORD.getString();
if (this.host != null && !this.host.equals("not-a-partner")) {
connect(this.host, this.password);
this.enabled = true;
}
}
@Override
public void connect(String host, String password) {
this.host = host;
this.password = password;
driver = new VoiceServerDriver(host, password, this);
driver.setBlockRadius(StorageKey.SETTINGS_VC_RADIUS.getInt());
}
@Override
public void requestRestart() {
OpenAudioLogger.toConsole("Restarting voice driver...");
if (driver != null) {
driver.shutdown();
}
this.connect(this.host, this.password);
}
@Override
public void shutdown() {
if (driver != null) {
driver.shutdown();
}
}
@Override
public boolean isEnabled() {
return enabled;
}
}
| [
"noreply@github.com"
] | ApocalypsjeNL.noreply@github.com |
4b3e3fac0b0d0c5b53a31370beb27d08986d2bea | 6f581e209761374a5fa4d49730cff4e8fedc06cb | /src/main/java/ru/epam/javacore/lesson_24_db_web/homework/carrier/repo/impl/jdbc/CarrierRelationalDbRepoImpl.java | ea49c027174e45a2492c2c4c2a969336f2fe48c2 | [] | no_license | DmitryYusupov/epamjavacore | b4cfe78ba608e05d855568704b13d696d357474a | 6f5009c89d372dbeb7dd5daffaed47e383ad93c0 | refs/heads/master | 2022-02-14T00:42:11.032705 | 2020-02-13T08:31:15 | 2020-02-13T08:31:15 | 225,563,013 | 0 | 10 | null | 2022-01-21T23:37:23 | 2019-12-03T07:59:48 | Java | UTF-8 | Java | false | false | 3,371 | java | package ru.epam.javacore.lesson_24_db_web.homework.carrier.repo.impl.jdbc;
import ru.epam.javacore.lesson_24_db_web.homework.carrier.domain.Carrier;
import ru.epam.javacore.lesson_24_db_web.homework.carrier.repo.CarrierRepo;
import ru.epam.javacore.lesson_24_db_web.homework.common.solutions.repo.jdbc.QueryWrapper;
import ru.epam.javacore.lesson_24_db_web.homework.common.solutions.repo.jdbc.ResultSetExtractor;
import ru.epam.javacore.lesson_24_db_web.homework.storage.IdGenerator;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
public class CarrierRelationalDbRepoImpl implements CarrierRepo {
private static final String INSERT_CARRIER = "INSERT INTO CARRIER (ID,NAME,ADDRESS, ENTITY_TYPE) VALUES (?,?,?,?)";
@Override
public void save(Carrier carrier) {
carrier.setId(IdGenerator.generateId());
QueryWrapper.executeUpdate(INSERT_CARRIER, ps -> {
mapCarrierToPreparedStatement(ps, carrier);
});
}
private void mapCarrierToPreparedStatement(PreparedStatement ps, Carrier carrier) throws SQLException {
int index = 0;
ps.setLong(++index, carrier.getId());
ps.setString(++index, carrier.getName());
ps.setString(++index, carrier.getAddress());
ps.setString(++index, carrier.getCarrierType().toString());
}
@Override
public void save(Collection<Carrier> carriers) {
carriers.forEach(c -> c.setId(IdGenerator.generateId()));
QueryWrapper.executeUpdateAsBatch(INSERT_CARRIER, carriers, this::mapCarrierToPreparedStatement);
}
@Override
public void save(Collection<Carrier> carriers, Connection connection) {
carriers.forEach(c -> c.setId(IdGenerator.generateId()));
QueryWrapper.executeUpdateAsBatch(INSERT_CARRIER, connection,
false, carriers, this::mapCarrierToPreparedStatement);
}
@Override
public Optional<Carrier> findById(Long id) {
String sql = "SELECT * FROM CARRIER WHERE ID = ?";
return QueryWrapper.selectOne(sql,
CarrierMapper::mapCarrier,
ps -> {
ps.setLong(1, id);
});
}
@Override
public Optional<Carrier> getByIdFetchingTransportations(long id) {
return findById(id);
}
@Override
public Carrier[] findByName(String name) {
String sql = "SELECT * FROM CARRIER WHERE NAME = ?";
return QueryWrapper.select(sql, CarrierMapper::mapCarrier, ps -> {
ps.setString(1, name);
}).toArray(new Carrier[0]);
}
@Override
public boolean deleteById(Long id) {
int affected = QueryWrapper.executeUpdate("DELETE FROM CARRIER WHERE ID = ?", ps -> {
ps.setLong(1, id);
});
return affected > 0;
}
@Override
public List<Carrier> getAll() {
return QueryWrapper
.select("SELECT * FROM CARRIER", (ResultSetExtractor<Carrier>) CarrierMapper::mapCarrier);
}
@Override
public int countAll() {
return QueryWrapper.selectOne("SELECT COUNT(*) AS CNT FROM CARRIER",
(rs) -> rs.getInt("CNT")).orElse(0);
}
@Override
public boolean update(Carrier carrier) {
return true;
}
}
| [
"Dmitry_Yusupov@epam.com"
] | Dmitry_Yusupov@epam.com |
7816641ef46b03cd72f4c5d922c8a8a0ac0833dd | 84aa2372c3a23d752188ae30d564f19f9a86094c | /app/src/main/java/com/mmyz/mvvmprojectframe/mvpvm/m/MvvmModel.java | ddd13e1c4ec4e6f1ebdbc68bc452703631a18521 | [] | no_license | ms-liu/MvvmFrame | b4330393cb88e700b120531050fa23f0db1216f0 | 92f145ee57e0c9c54807cd17a847875d94b81c05 | refs/heads/master | 2021-01-19T07:22:03.545557 | 2017-04-07T11:17:13 | 2017-04-07T11:17:13 | 87,538,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package com.mmyz.mvvmprojectframe.mvpvm.m;
import com.mmyz.mvvmprojectframe.mvpvm.m.bean.MvpVMBean;
/**
* ==============================================
* <p>
* 类名:MvvmModel
* <p>
* 作者:M-Liu
* <p>
* 时间:2017/4/6
* <p>
* 邮箱:ms_liu163@163.com
* <p>
* ==============================================
*/
public class MvvmModel implements IModel<MvpVMBean> {
private MvpVMBean bean ;
@Override
public void addModel(MvpVMBean mvpVMBean) {
this.bean = mvpVMBean;
}
@Override
public MvpVMBean getModel() {
return this.bean;
}
@Override
public boolean checkModel(MvpVMBean mvpVMBean) {
return mvpVMBean != null;
}
}
| [
"ms_liu163@163.com"
] | ms_liu163@163.com |
2daf2aa730448a926f33842919a427dfb5a86c09 | 0915b39458bf947a804f25c73304baf8fd96e3c1 | /graphwalkwithprobabilities-java/GraphWalkWithProbabilities.java | 931dd20d984c1c08e1af42a72c6eb7c3a47cf4ef | [] | no_license | rafalio/topcoder | 28fa2fb33d0565ddaf305cc26193ff49613d10f8 | f1325e248660c006cb2b10502ead2dfaf2c27e4d | refs/heads/master | 2021-01-02T09:07:21.532953 | 2014-09-03T17:08:10 | 2014-09-03T17:08:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | import java.util.*;
public class GraphWalkWithProbabilities {
public double findprob(String[] graph, int[] winprob, int[] looseprob, int start) {
boolean[] visited = new boolean[graph.length];
double[] costs = new double[graph.length];
Arrays.fill(costs, Double.MAX_VALUE);
costs[start] = 0;
int bestNode = start;
double bestP = winprob[start]/(double)(winprob[start] + looseprob[start]);
Queue<Integer> q = new LinkedList<Integer>();
q.add(start);
while(!q.isEmpty()){
int node = q.poll();
double score = winprob[node]/(double)(winprob[node] + looseprob[node]);
if(score > bestP){
bestP = score;
bestNode = node;
}
visited[node] = true;
for(int i = 0; i < graph[node].length(); i++){
if(graph[node].charAt(i) == '1' && !visited[i]){
q.add(i);
}
}
}
return 0.0;
}
}
| [
"me@rafal.io"
] | me@rafal.io |
0b8a64db06a982a9f37e3503eeaa24a876ed0efd | 1636ed7d18ca81eeb6150cbbc5b608fd57f7207b | /Object_Oriented_Programming_Lab/10TH/src/Layout/Second.java | 7fce5cd277a62f14e192bc3322d36ab47b9b2500 | [] | no_license | md-abu-shahan/Class_Lab | 2f10b9bda811daa08b3c9205968123805f335eef | df917af0a263deee0e15d64ffdd3fca772bdfd1a | refs/heads/main | 2023-03-12T12:35:04.527034 | 2021-03-02T14:02:10 | 2021-03-02T14:02:10 | 323,980,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | package Layout;
import java.awt.Color;
import java.awt.Container;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Second extends JFrame {
private Container c;
private JPanel p, p2, p3, p4;
private JButton b1, b2, b3;
Second() {
c = getContentPane();
c.setLayout(null);
p = new JPanel();
p.setLayout(null);
p.setBounds(100, 100, 200, 200);
p.setBackground(Color.red);
c.add(p);
p2 = new JPanel();
p2.setLayout(null);
p2.setBounds(310, 100, 200, 200);
p2.setBackground(Color.BLUE);
c.add(p2);
p3 = new JPanel();
p3.setLayout(null);
p3.setBounds(100, 310, 200, 200);
p3.setBackground(Color.green);
c.add(p3);
p4 = new JPanel();
p4.setLayout(null);
p4.setBounds(310, 310, 200, 200);
p4.setBackground(Color.yellow);
c.add(p4);
}
public static void main(String[] args) {
Second f = new Second();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setBounds(10, 50, 600, 600);
f.setTitle("panel ");
}
}
| [
"52712036+md-abu-shahan@users.noreply.github.com"
] | 52712036+md-abu-shahan@users.noreply.github.com |
d08ecc5a0a591cee867f6c9c174a9fbf4c590751 | 2cef96355f91ec16459584716278478ed579c850 | /Hello-World/src/test/java/id/co/bca/spring/helloworld/HelloWorldApplicationTests.java | 2ff0358998e27da8725c3625ae1cc4a2c4032eff | [] | no_license | Henkky/belajargit | 19487577b82b3780a5f2a6d98ac3af6de2418b17 | 7904f232d0948b70ba83ed805d917d0d02f9aeff | refs/heads/main | 2023-05-13T22:57:47.707374 | 2023-05-02T12:00:04 | 2023-05-02T12:00:04 | 356,880,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package id.co.bca.spring.helloworld;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class HelloWorldApplicationTests {
@Test
void contextLoads() {
}
}
| [
"henkky888@gmail.com"
] | henkky888@gmail.com |
8c78a242c63c65eeded68e50e904944fc6d267b4 | f538b87135717096f3d1f29fb160836a977ac063 | /src/main/java/com/mgrobelak/exceprions/NumberToBigException.java | 97b993f7d425b3cea7c01d7d1285ecad2d9d8c4d | [
"Apache-2.0"
] | permissive | MarcinGrobelak/DivisorMapping | 872f79a1d10b1909082626225f43d9956fdae5c0 | 5e8361e505624ca789d55a9b9a0df7d990f317db | refs/heads/master | 2022-11-24T17:37:33.517019 | 2020-07-29T23:22:29 | 2020-07-29T23:22:29 | 283,621,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package com.mgrobelak.exceprions;
/**
* @author Marcin Grobelak
*/
public class NumberToBigException extends Exception {
private static final long serialVersionUID = -1932490691198389874L;
@Override
public String getMessage() {
return "Number has to be in 1 to 10 range.";
}
}
| [
"martin.grobelak@gmail.com"
] | martin.grobelak@gmail.com |
65991de290e620dbd781179480edb8ad6a70c5f4 | 842813a1fa1b6f0408f7bf24877b074a10df78c7 | /src/main/java/dev/marksman/gauntlet/GeneratorTest.java | 0f63412d34306bf5c86d98a60d7126e2427f33f5 | [
"MIT"
] | permissive | fossabot/gauntlet | 4148594f6a76c6a24b7b618a3e3763ab0a43f7ad | 1c98c29984f9566499c1d70b330a014553c2bddd | refs/heads/master | 2022-12-26T01:35:45.300756 | 2020-10-03T04:02:05 | 2020-10-03T04:02:05 | 300,791,857 | 0 | 0 | MIT | 2020-10-03T04:02:00 | 2020-10-03T04:01:59 | null | UTF-8 | Java | false | false | 1,071 | java | package dev.marksman.gauntlet;
public final class GeneratorTest<A> extends Test<A> {
private final Arbitrary<A> arbitrary;
private final Prop<A> property;
private final GeneratorTestSettingsAdjustments settings;
private GeneratorTest(Arbitrary<A> arbitrary, Prop<A> property, GeneratorTestSettingsAdjustments settingsAdjustments) {
this.arbitrary = arbitrary;
this.property = property;
this.settings = settingsAdjustments;
}
static <A> GeneratorTest<A> generatorTest(Arbitrary<A> arbitrary, Prop<A> property, GeneratorTestSettingsAdjustments settingsAdjustments) {
return new GeneratorTest<>(arbitrary, property, settingsAdjustments);
}
public Arbitrary<A> getArbitrary() {
return this.arbitrary;
}
public Prop<A> getProperty() {
return this.property;
}
public GeneratorTestSettingsAdjustments getSettingsAdjustments() {
return settings;
}
@Override
public PrettyPrinter<A> getPrettyPrinter() {
return arbitrary.getPrettyPrinter();
}
}
| [
"schuetzk@gmail.com"
] | schuetzk@gmail.com |
4cf44db40c353b337ae2ea963f535bff18b9f426 | 9486fbb937256e9edfe11c20a1455978c8529631 | /src/rs/ac/bg/etf/pp1/ast/CondFactAndDerived1.java | f94a2cf951d6d6c113259eb11628c329d21619d9 | [] | no_license | Djordje1995/MJCompiler | 162b6a5c942d2ad7ea27c790eaee4f355de4f8e4 | b34222e0e4e2d09fccba0d821b2286c07a517761 | refs/heads/master | 2020-05-16T06:56:45.537414 | 2019-06-13T18:36:38 | 2019-06-13T18:36:38 | 182,860,394 | 0 | 0 | null | 2019-06-13T18:36:39 | 2019-04-22T20:11:05 | Java | UTF-8 | Java | false | false | 797 | java | // generated with ast extension for cup
// version 0.8
// 13/5/2019 19:21:6
package rs.ac.bg.etf.pp1.ast;
public class CondFactAndDerived1 extends CondFactAnd {
public CondFactAndDerived1 () {
}
public void accept(Visitor visitor) {
visitor.visit(this);
}
public void childrenAccept(Visitor visitor) {
}
public void traverseTopDown(Visitor visitor) {
accept(visitor);
}
public void traverseBottomUp(Visitor visitor) {
accept(visitor);
}
public String toString(String tab) {
StringBuffer buffer=new StringBuffer();
buffer.append(tab);
buffer.append("CondFactAndDerived1(\n");
buffer.append(tab);
buffer.append(") [CondFactAndDerived1]");
return buffer.toString();
}
}
| [
"bozovic.djole@yahoo.com"
] | bozovic.djole@yahoo.com |
6d10241b8a9148c54294d50811c911eb3839dba5 | f57699553d02ee2ee1bbf3e07dc01d073739cb41 | /src/main/java/com/chris/framework/builder/libs/springboot/service/BaseService.java | 04726311d3367e6528db8a8c757c620e164efa59 | [] | no_license | kalychen/ObjectBuilder | dc4661d4b22ea689c7e8f32b6b9254f58103f3c1 | a8e8b24c1da4586118e24c50a64d3634622e372c | refs/heads/master | 2018-12-19T11:25:45.666561 | 2018-09-15T20:55:36 | 2018-09-15T20:55:36 | 119,159,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,314 | java | package com.chris.framework.builder.libs.springboot.service;
import com.chris.framework.builder.libs.springboot.repository.BaseRepository;
import com.chris.framework.builder.model.PageModel;
import com.chris.framework.builder.model.PageParams;
import com.chris.framework.builder.utils.EntityUtils;
import com.chris.framework.builder.utils.JsonUtils;
import com.chris.framework.builder.utils.MsgUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field;
import java.util.List;
/**
* CustomRepositoryDemo
* library.custom
* Created by Chris Chen
* 2017/9/15
* Explain:封装最基本的Service
*/
public abstract class BaseService<T, R extends BaseRepository<T>> {
@Autowired
public R dao;
//1. 查询:一条数据
//@Provider
public T getOne(Integer id) {
return id == null ? null : dao.findOne(id);
}
//2. 查询:数据列表 按照id升序排列
//@Provider
public List<T> getList() {
return dao.findAll(new Sort(Sort.Direction.ASC, "id"));
}
//3. 查询:数据分页 按照id升序排列
//@Provider
public PageModel<T> getPage(int page, int pageSize) {
if (page <= 0 || pageSize <= 0) {
return null;
}
//数据库分页查询起始id是从0开始的,请求的页码是从1开始的,所以处理的时候要减一
return dao.getPage(new PageRequest(page > 0 ? page - 1 : 0, pageSize, new Sort(Sort.Direction.ASC, "id")));
}
//4. 查询:数据分页 按照id升序排列
//@Provider
public PageModel<T> getPage(PageParams pageParams) {
if (pageParams==null) {
return null;
}
int page = pageParams.getPage();
int pageSize = pageParams.getPageSize();
//数据库分页查询起始id是从0开始的,请求的页码是从1开始的,所以处理的时候要减一
return dao.getPage(new PageRequest(page > 0 ? page - 1 : 0, pageSize, new Sort(Sort.Direction.ASC, "id")));
}
//4. 增加:增加一条数据
@Transactional
public Integer addOne(T t) {
try {
//查找是否包含一个叫"id"的字段,有这个字段我们就把它视作主键
Field indexField = t.getClass().getDeclaredField("id");
if (indexField != null) {
indexField.setAccessible(true);
indexField.set(t, 0);//主键清零
indexField.setAccessible(false);
}
dao.saveAndFlush(t);
} catch (Exception e) {
e.printStackTrace();
}
return dao.getLastInsertId();
}
/**
* 留给chris框架保存数据的默认方法
*
* @param t
* @return
*/
@Transactional
public Integer save(T t) {
return addOne(t);
}
//5. 删除:删除一条记录
@Transactional
public boolean removeOne(Integer id) {
try {
dao.delete(id);
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
//6. 修改:修改一条记录 对象必须包含id
@Transactional
public boolean updateOne(T t) {
try {
dao.saveAndFlush(t);
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
* 更新对象
*
* @param entity
* @return
*/
@Transactional
public boolean updateEntity(T entity) {
try {
//1. 获得id字段
Field idField = entity.getClass().getDeclaredField("id");
//2. 如果没有这个字段,则不进行更新
if (idField == null) {
return false;
}
//3. 取得id的值
idField.setAccessible(true);
Integer id = (Integer) idField.get(entity);
idField.setAccessible(false);
//4. 如果id为空或者为0,则抛出异常,不进行更新
if (id == null || id == 0) {
try {
throw new Exception("update entity need id");
} catch (Exception e) {
e.printStackTrace();
}
}
//5. 根据id读取数据库中原来的数据
T dataEntity = getOne(id);
//6. 执行更新操作
EntityUtils.copyUpdateObject(entity, dataEntity);
//7. 更新持久化
updateOne(dataEntity);
return true;
} catch (NoSuchFieldException e) {
e.printStackTrace();
return false;
} catch (IllegalAccessException e) {
e.printStackTrace();
return false;
}
}
public abstract T getEntity(Integer id);//获取一个对象
public abstract List<T> getAll();//获取所有对象的集合
}
| [
"chrischen2018@163.com"
] | chrischen2018@163.com |
8c5c2d348d73d74a47630f5918cca2fbc75399ea | 695e0f31e468d0a0e74907bce9eb636a085d056b | /com/leetcode/normal/QueueReconstructByHeight.java | 6d5ef7dc63c3e6b1e55711185a56ca0d4ba48cf3 | [] | no_license | karimohsen/LeetCode | 2176178878cac024d5a34d0a0cbd92cd06aaf1e1 | 67219c69df9ce4b9f3a9ad38ec81d47ad7ed7209 | refs/heads/master | 2021-01-11T03:54:01.736412 | 2017-09-04T06:53:23 | 2017-09-04T06:53:23 | 71,277,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | package com.leetcode.normal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
public class QueueReconstructByHeight {
public int[][] reconstructQueue(int[][] people) {
if (people.length == 0)
return people;
Arrays.sort(people, new CustomComparator());
List<int[]> list = new ArrayList<>();
for (int i = 0; i < people.length; i++) {
list.add(people[i][1], people[i]);
}
for (int i = 0; i < list.size(); i++) {
people[i] = list.get(i);
}
return people;
}
class CustomComparator implements Comparator<int[]> {
@Override
public int compare(int[] o1, int[] o2) {
if (o1[0] > o2[0])
return -1;
else if (o1[0] < o2[0])
return 1;
else {
return o1[1] - o2[1];
}
}
}
}
| [
"karim.abdelmohsen.1992@gmail.com"
] | karim.abdelmohsen.1992@gmail.com |
ea22a2ba9042f8e23e123e6bbd4e7fd445e316b3 | 8144fa57f9b29e27cbb471c261d20780f87594ba | /app/src/main/java/com/example/connect3game/MainActivity.java | 443bd6d698cb2d81b347571af9d663265d382899 | [] | no_license | vincedudey/Connect3Game | 776d76c695fddde5d9c80f73e89f032c2d11d392 | 44a9217436a7d81a97322192ac50feddf96961ca | refs/heads/master | 2020-12-26T11:43:22.327914 | 2020-01-31T19:06:24 | 2020-01-31T19:06:24 | 237,494,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,384 | java | package com.example.connect3game;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
boolean player1 = true;
ImageView red1, red2, red3, red4, red5, red6, red7, red8, red9;
ImageView yellow1, yellow2, yellow3, yellow4, yellow5, yellow6, yellow7, yellow8, yellow9;
char [] setCell = {'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'};
TextView txt;
Button b;
boolean winOrTie = false;
public void toastNotice(){
if(winOrTie)
Toast.makeText(this, "Please start a new game!", Toast.LENGTH_SHORT).show();
else
Toast.makeText(this, "Please select a new cell!", Toast.LENGTH_SHORT).show();
}
public void isWinner(boolean player){
if(setCell[0]!='X' && setCell[0] == setCell[1] && setCell[1] == setCell[2])declareWinner(player);
else if(setCell[3]!='X' && setCell[3] == setCell[4] && setCell[4] == setCell[5])declareWinner(player);
else if(setCell[6]!='X' && setCell[6] == setCell[7] && setCell[7] == setCell[8])declareWinner(player);
else if(setCell[0]!='X' && setCell[0] == setCell[3] && setCell[3] == setCell[6])declareWinner(player);
else if(setCell[1]!='X' && setCell[1] == setCell[4] && setCell[4] == setCell[7])declareWinner(player);
else if(setCell[2]!='X' && setCell[2] == setCell[5] && setCell[5] == setCell[8])declareWinner(player);
else if(setCell[0]!='X' && setCell[0] == setCell[4] && setCell[4] == setCell[8])declareWinner(player);
else if(setCell[2]!='X' && setCell[2] == setCell[4] && setCell[4] == setCell[6])declareWinner(player);
}
public void declareWinner(boolean player){
if(player) txt.setText("Red has won!");
else txt.setText("Yellow has won!");
txt.animate().alpha(1).setDuration(3000);//.setAlpha(1);
b.animate().alpha(1).setDuration(3000);
winOrTie = true;
}
public void isTie(){
int filled = 0;
for(char c: setCell){
if(c != 'X')++filled;
}
if(filled==9){
txt.setText("Tie!");
txt.animate().alpha(1).setDuration(3000);
b.animate().alpha(1).setDuration(3000);
winOrTie = true;
}
}
public void update00(View view){
if(setCell[0]=='X' && !winOrTie){
if(player1)red1.animate().alpha(1).translationY(0).setDuration(1000);
else yellow1.animate().alpha(1).translationY(0).setDuration(1000);
if(player1) setCell[0]='R';
else setCell[0]='Y';
isWinner(player1);
isTie();
player1 = !player1;
}
else toastNotice();
}
public void update01(View view){
if(setCell[1]=='X' && !winOrTie){
if(player1)red2.animate().alpha(1).translationY(0).setDuration(1000);
else yellow2.animate().alpha(1).translationY(0).setDuration(1000);
if(player1) setCell[1]='R';
else setCell[1]='Y';
isWinner(player1);
isTie();
player1 = !player1;
}
else toastNotice();
}
public void update02(View view){
if(setCell[2]=='X' && !winOrTie){
if(player1)red3.animate().alpha(1).translationY(0).setDuration(1000);
else yellow3.animate().alpha(1).translationY(0).setDuration(1000);
if(player1) setCell[2]='R';
else setCell[2]='Y';
isWinner(player1);
isTie();
player1 = !player1;
}
else toastNotice();
}
public void update10(View view){
if(setCell[3]=='X' && !winOrTie){
if(player1)red4.animate().alpha(1).translationY(0).setDuration(1000);
else yellow4.animate().alpha(1).translationY(0).setDuration(1000);
if(player1) setCell[3]='R';
else setCell[3]='Y';
isWinner(player1);
isTie();
player1 = !player1;
}
else toastNotice();
}
public void update11(View view){
if(setCell[4]=='X' && !winOrTie){
if(player1)red5.animate().alpha(1).translationY(0).setDuration(1000);
else yellow5.animate().alpha(1).translationY(0).setDuration(1000);
if(player1) setCell[4]='R';
else setCell[4]='Y';
isWinner(player1);
isTie();
player1 = !player1;
}
else toastNotice();
}
public void update12(View view){
if(setCell[5]=='X' && !winOrTie){
if(player1)red6.animate().alpha(1).translationY(0).setDuration(1000);
else yellow6.animate().alpha(1).translationY(0).setDuration(1000);
if(player1) setCell[5]='R';
else setCell[5]='Y';
isWinner(player1);
isTie();
player1 = !player1;
}
else toastNotice();
}
public void update20(View view){
if(setCell[6]=='X' && !winOrTie){
if(player1)red7.animate().alpha(1).translationY(0).setDuration(1000);
else yellow7.animate().alpha(1).translationY(0).setDuration(1000);
if(player1) setCell[6]='R';
else setCell[6]='Y';
isWinner(player1);
isTie();
player1 = !player1;
}
else toastNotice();
}
public void update21(View view){
if(setCell[7]=='X' && !winOrTie){
if(player1)red8.animate().alpha(1).translationY(0).setDuration(1000);
else yellow8.animate().alpha(1).translationY(0).setDuration(1000);
if(player1) setCell[7]='R';
else setCell[7]='Y';
isWinner(player1);
isTie();
player1 = !player1;
}
else toastNotice();
}
public void update22(View view) {
if (setCell[8] == 'X' && !winOrTie) {
if (player1) red9.animate().alpha(1).translationY(0).setDuration(1000);
else yellow9.animate().alpha(1).translationY(0).setDuration(1000);
if (player1) setCell[8] = 'R';
else setCell[8] = 'Y';
isWinner(player1);
isTie();
player1 = !player1;
} else toastNotice();
}
public void resetBoard(View view){
red1 = (ImageView)findViewById(R.id.imageView1); red1.animate().translationY(-1500).setDuration(1000);
red2 = (ImageView)findViewById(R.id.imageView2); red2.animate().translationY(-1500).setDuration(1000);
red3 = (ImageView)findViewById(R.id.imageView3); red3.animate().translationY(-1500).setDuration(1000);
red4 = (ImageView)findViewById(R.id.imageView4); red4.animate().translationY(-1500).setDuration(1000);
red5 = (ImageView)findViewById(R.id.imageView5); red5.animate().translationY(-1500).setDuration(1000);
red6 = (ImageView)findViewById(R.id.imageView6); red6.animate().translationY(-1500).setDuration(1000);
red7 = (ImageView)findViewById(R.id.imageView7); red7.animate().translationY(-1500).setDuration(1000);
red8 = (ImageView)findViewById(R.id.imageView8); red8.animate().translationY(-1500).setDuration(1000);
red9 = (ImageView)findViewById(R.id.imageView9); red9.animate().translationY(-1500).setDuration(1000);
yellow1 = (ImageView)findViewById(R.id.imageView11); yellow1.animate().translationY(-1500).setDuration(1000);
yellow2 = (ImageView)findViewById(R.id.imageView12); yellow2.animate().translationY(-1500).setDuration(1000);
yellow3 = (ImageView)findViewById(R.id.imageView13); yellow3.animate().translationY(-1500).setDuration(1000);
yellow4 = (ImageView)findViewById(R.id.imageView14); yellow4.animate().translationY(-1500).setDuration(1000);
yellow5 = (ImageView)findViewById(R.id.imageView15); yellow5.animate().translationY(-1500).setDuration(1000);
yellow6 = (ImageView)findViewById(R.id.imageView16); yellow6.animate().translationY(-1500).setDuration(1000);
yellow7 = (ImageView)findViewById(R.id.imageView17); yellow7.animate().translationY(-1500).setDuration(1000);
yellow8 = (ImageView)findViewById(R.id.imageView18); yellow8.animate().translationY(-1500).setDuration(1000);
yellow9 = (ImageView)findViewById(R.id.imageView19); yellow9.animate().translationY(-1500).setDuration(1000);
for(int i=0; i<setCell.length; ++i)
setCell[i] = 'X';
txt.setAlpha(0);
b.setAlpha(0);
winOrTie = false;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txt = (TextView)findViewById(R.id.textView);
b = (Button)findViewById(R.id.button);
red1 = (ImageView)findViewById(R.id.imageView1); red1.setY(-1500);
red2 = (ImageView)findViewById(R.id.imageView2); red2.setY(-1500);
red3 = (ImageView)findViewById(R.id.imageView3); red3.setY(-1500);
red4 = (ImageView)findViewById(R.id.imageView4); red4.setY(-1500);
red5 = (ImageView)findViewById(R.id.imageView5); red5.setY(-1500);
red6 = (ImageView)findViewById(R.id.imageView6); red6.setY(-1500);
red7 = (ImageView)findViewById(R.id.imageView7); red7.setY(-1500);
red8 = (ImageView)findViewById(R.id.imageView8); red8.setY(-1500);
red9 = (ImageView)findViewById(R.id.imageView9); red9.setY(-1500);
yellow1 = (ImageView)findViewById(R.id.imageView11); yellow1.setY(-1500);
yellow2 = (ImageView)findViewById(R.id.imageView12); yellow2.setY(-1500);
yellow3 = (ImageView)findViewById(R.id.imageView13); yellow3.setY(-1500);
yellow4 = (ImageView)findViewById(R.id.imageView14); yellow4.setY(-1500);
yellow5 = (ImageView)findViewById(R.id.imageView15); yellow5.setY(-1500);
yellow6 = (ImageView)findViewById(R.id.imageView16); yellow6.setY(-1500);
yellow7 = (ImageView)findViewById(R.id.imageView17); yellow7.setY(-1500);
yellow8 = (ImageView)findViewById(R.id.imageView18); yellow8.setY(-1500);
yellow9 = (ImageView)findViewById(R.id.imageView19); yellow9.setY(-1500);
}
}
| [
"vzhu@cpp.edu"
] | vzhu@cpp.edu |
0607d2aef2c9ba5c19638ffdb5c56c618a4865b3 | d21c9d6de4ff20f5195588f7b2151ca2d415c556 | /trunk/ZTCJ_server_02/src/com/wm927/interceptor/MethodCacheInterceptor.java | d1dbf9ea19952087889218982d5382707c7329a2 | [] | no_license | BGCX262/ztcj-server-svn-to-git | 5cbe4c028d97a616ef46937ec2571a0eeb8a87f7 | cc09b7d47909f237d75443e58fbd5793372c7583 | refs/heads/master | 2021-01-20T11:30:56.282954 | 2015-08-23T06:57:22 | 2015-08-23T06:57:22 | 41,248,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,595 | java | package com.wm927.interceptor;
import java.io.Serializable;
import net.sf.ehcache.Cache;
import net.sf.ehcache.Element;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
/**
* AOP事务 获取与保存缓存
* @author chen
* 已废弃
*/
public class MethodCacheInterceptor implements MethodInterceptor,InitializingBean {
private static final Logger logger = Logger.getLogger(MethodCacheInterceptor.class);
private Cache cache;
public void setCache(Cache cache) {
this.cache = cache;
}
public MethodCacheInterceptor() {
super();
System.out.println("111");
logger.debug("CACHE IS START ----->>>>"+this.getClass().getSimpleName());
}
/**
*
*
* 拦截Service/DAO的方法,并查找该结果是否存在,如果存在就返回cache中的值, 否则,返回数据库查询结果,并将查询结果放入cache
*/
public Object invoke(MethodInvocation invocation) throws Throwable {
String targetName = invocation.getThis().getClass().getName();
String methodName = invocation.getMethod().getName();
Object[] arguments = invocation.getArguments();
Object result;
logger.debug("Find object from cache is " + cache.getName());
String cacheKey = getCacheKey(targetName, methodName, arguments);
System.out.println(cacheKey);
Element element = cache.get(cacheKey);
if (element == null) {
logger
.debug("Hold up method , Get method result and create cache........!");
result = invocation.proceed();
element = new Element(cacheKey, (Serializable) result);
cache.put(element);
}
return element.getValue();
}
/**
*
*
* 获得cache key的方法,cache key是Cache中一个Element的唯一标识 cache key包括
* 包名+类名+方法名,如com.wm927.Service.MiddlewareServiceImpl.find
*/
private String getCacheKey(String targetName, String methodName,
Object[] arguments) {
StringBuffer sb = new StringBuffer();
sb.append(targetName).append(".").append(methodName);
if ((arguments != null) && (arguments.length != 0)) {
for (int i = 0; i < arguments.length; i++) {
sb.append(".").append(arguments[i]);
}
}
return sb.toString();
}
public void afterPropertiesSet() throws Exception {
Assert.notNull(cache, "Need a cache, please setCache(cache) create it");
}
}
| [
"you@example.com"
] | you@example.com |
3e5e19e0589ec9e486290b317e463739cccfeb87 | 26db0cbcbb8bbf9c363dad765610888feddf0dfd | /src/Lehrer.java | ced26d9064deffc3ef299c7b7b14d501ebd162c6 | [] | no_license | Galulik/UniverLosi | 0acb5370861407b1745ea2be0298003745cb8953 | c22a99a292bd12092e4c7c1be928f363f3168481 | refs/heads/master | 2021-08-18T21:59:00.963176 | 2017-11-21T13:17:40 | 2017-11-21T13:17:40 | 111,400,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | public class Lehrer {
private int id;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Lehrer(int id, String name) {
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
| [
"Galulik"
] | Galulik |
59eaefc5e42f26442cbcef414272fa5000b7262e | e1ae630d1f6a39921dd80a47f47f7cb4d772eb6a | /src/main/java/com/GoldFinancial.java | 7dfd5b0d2ab2f4e6904443057acf7eebefaf0edb | [] | no_license | laiStronger/laisq-financial | c19949a23042639f0fcc906f15be175c86e35b03 | 07dcd7212ee3503051e330df18a903f267f7d1d7 | refs/heads/master | 2021-01-18T18:51:13.978956 | 2017-04-01T05:33:27 | 2017-04-01T05:33:27 | 86,874,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,967 | java | package com;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import net.sf.json.JSONObject;
/**
*黄金数据调用示例代码 - 聚合数据
*在线接口文档:http://www.juhe.cn/docs/29
**/
public class GoldFinancial {
//配置您申请的KEY
public static final String APPKEY ="b562193a50e03ebd519d6213f98ef899";
public static void main(String[] args) {
getRequest3();
}
//1.上海黄金交易所
public static void getRequest1(){
String result =null;
String url ="http://web.juhe.cn:8080/finance/gold/shgold";//请求接口地址
Map params = new HashMap();//请求参数
params.put("key",APPKEY);//APP Key
params.put("v","");//JSON格式版本(0或1)默认为0
try {
result =Utils.net(url, params, "GET");
JSONObject object = JSONObject.fromObject(result);
if(object.getInt("error_code")==0){
System.out.println(object.get("result"));
}else{
System.out.println(object.get("error_code")+":"+object.get("reason"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
//2.上海期货交易所
public static void getRequest2(){
String result =null;
String url ="http://web.juhe.cn:8080/finance/gold/shfuture";//请求接口地址
Map params = new HashMap();//请求参数
params.put("key",APPKEY);//APP Key
params.put("v","");//JSON格式版本(0或1)默认为0
try {
result =Utils.net(url, params, "GET");
JSONObject object = JSONObject.fromObject(result);
if(object.getInt("error_code")==0){
System.out.println(object.get("result"));
}else{
System.out.println(object.get("error_code")+":"+object.get("reason"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
//3.银行账户黄金
public static void getRequest3(){
String result =null;
String url ="http://web.juhe.cn:8080/finance/gold/bankgold";//请求接口地址
Map params = new HashMap();//请求参数
params.put("key",APPKEY);//APP Key
try {
result =Utils.net(url, params, "GET");
JSONObject object = JSONObject.fromObject(result);
if(object.getInt("error_code")==0){
System.out.println(object.get("result"));
}else{
System.out.println(object.get("error_code")+":"+object.get("reason"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
} | [
"laishaoqiang@youanmi.com"
] | laishaoqiang@youanmi.com |
3b895e07e69a681c94388e7620e57f0e928f2c3b | 55da4857d83d018163cd34fe7d192bb54ca15870 | /app/src/main/java/com/unbounded/video/ZXing/camera/CameraManager.java | 5306c8ad7e9ecdf1e2d5c41cc142b637173c89ed | [] | no_license | 584532675/3DUnBound | 100200c06a5824e270ee8e4aea29b220e2649f92 | 8cfd958c552a4c88f849ffb65c4ff3d58a67a72f | refs/heads/master | 2020-04-16T03:11:19.903352 | 2019-01-11T10:09:30 | 2019-01-11T10:09:30 | 165,219,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,522 | java | /*
* Copyright (C) 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.unbounded.video.ZXing.camera;
import android.content.Context;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.Camera;
import android.os.Build;
import android.os.Handler;
import android.util.Log;
import android.view.SurfaceHolder;
import java.io.IOException;
/**
* This object wraps the Camera service object and expects to be the only one talking to it. The
* implementation encapsulates the steps needed to take preview-sized images, which are used for
* both preview and decoding.
*
*/
public final class CameraManager {
private static final String TAG = CameraManager.class.getSimpleName();
private static final int MIN_FRAME_WIDTH = 240;
private static final int MIN_FRAME_HEIGHT = 240;
private static final int MAX_FRAME_WIDTH = 480;
private static final int MAX_FRAME_HEIGHT = 480;
private static CameraManager cameraManager;
static final int SDK_INT; // Later we can use Build.VERSION.SDK_INT
static {
int sdkInt;
try {
sdkInt = Integer.parseInt(Build.VERSION.SDK);
} catch (NumberFormatException nfe) {
// Just to be safe
sdkInt = 10000;
}
SDK_INT = sdkInt;
}
private final Context context;
private final CameraConfigurationManager configManager;
private Camera camera;
private Rect framingRect;
private Rect framingRectInPreview;
private boolean initialized;
private boolean previewing;
private final boolean useOneShotPreviewCallback;
/**
* Preview frames are delivered here, which we pass on to the registered handler. Make sure to
* clear the handler so it will only receive one message.
*/
private final PreviewCallback previewCallback;
/** Autofocus callbacks arrive here, and are dispatched to the Handler which requested them. */
private final AutoFocusCallback autoFocusCallback;
/**
* Initializes this static object with the Context of the calling Activity.
*
* @param context The Activity which wants to use the camera.
*/
public static void init(Context context) {
if (cameraManager == null) {
cameraManager = new CameraManager(context);
}
}
/**
* Gets the CameraManager singleton instance.
*
* @return A reference to the CameraManager singleton.
*/
public static CameraManager get() {
return cameraManager;
}
private CameraManager(Context context) {
this.context = context;
this.configManager = new CameraConfigurationManager(context);
// Camera.setOneShotPreviewCallback() has a race condition in Cupcake, so we use the older
// Camera.setPreviewCallback() on 1.5 and earlier. For Donut and later, we need to use
// the more efficient one shot callback, as the older one can swamp the system and cause it
// to run out of memory. We can't use SDK_INT because it was introduced in the Donut SDK.
//useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > Build.VERSION_CODES.CUPCAKE;
useOneShotPreviewCallback = Integer.parseInt(Build.VERSION.SDK) > 3; // 3 = Cupcake
previewCallback = new PreviewCallback(configManager, useOneShotPreviewCallback);
autoFocusCallback = new AutoFocusCallback();
}
/**
* Opens the camera driver and initializes the hardware parameters.
*
* @param holder The surface object which the camera will draw preview frames into.
* @throws IOException Indicates the camera driver failed to open.
*/
public void openDriver(SurfaceHolder holder) throws IOException {
if (camera == null) {
camera = Camera.open();
if (camera == null) {
throw new IOException();
}
camera.setPreviewDisplay(holder);
if (!initialized) {
initialized = true;
configManager.initFromCameraParameters(camera);
}
configManager.setDesiredCameraParameters(camera);
//FIXME
// SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
//�Ƿ�ʹ��ǰ��
// if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
// FlashlightManager.enableFlashlight();
// }
FlashlightManager.enableFlashlight();
}
}
/**
* Closes the camera driver if still in use.
*/
public void closeDriver() {
if (camera != null) {
FlashlightManager.disableFlashlight();
camera.release();
camera = null;
}
}
/**
* Asks the camera hardware to begin drawing preview frames to the screen.
*/
public void startPreview() {
if (camera != null && !previewing) {
camera.startPreview();
previewing = true;
}
}
/**
* Tells the camera to stop drawing preview frames.
*/
public void stopPreview() {
if (camera != null && previewing) {
if (!useOneShotPreviewCallback) {
camera.setPreviewCallback(null);
}
camera.stopPreview();
previewCallback.setHandler(null, 0);
autoFocusCallback.setHandler(null, 0);
previewing = false;
}
}
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public void requestPreviewFrame(Handler handler, int message) {
if (camera != null && previewing) {
previewCallback.setHandler(handler, message);
if (useOneShotPreviewCallback) {
camera.setOneShotPreviewCallback(previewCallback);
} else {
camera.setPreviewCallback(previewCallback);
}
}
}
/**
* Asks the camera hardware to perform an autofocus.
*
* @param handler The Handler to notify when the autofocus completes.
* @param message The message to deliver.
*/
public void requestAutoFocus(Handler handler, int message) {
if (camera != null && previewing) {
autoFocusCallback.setHandler(handler, message);
//Log.d(TAG, "Requesting auto-focus callback");
camera.autoFocus(autoFocusCallback);
}
}
/**
* Calculates the framing rect which the UI should draw to show the user where to place the
* barcode. This target helps with alignment as well as forces the user to hold the device
* far enough away to ensure the image will be in focus.
*
* @return The rectangle to draw on screen in window coordinates.
*/
public Rect getFramingRect() {
Point screenResolution = configManager.getScreenResolution();
if (framingRect == null) {
if (camera == null) {
return null;
}
int width = screenResolution.x * 3 / 4;
if (width < MIN_FRAME_WIDTH) {
width = MIN_FRAME_WIDTH;
} else if (width > MAX_FRAME_WIDTH) {
width = MAX_FRAME_WIDTH;
}
int height = screenResolution.y * 3 / 4;
if (height < MIN_FRAME_HEIGHT) {
height = MIN_FRAME_HEIGHT;
} else if (height > MAX_FRAME_HEIGHT) {
height = MAX_FRAME_HEIGHT;
}
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
Log.d(TAG, "Calculated framing rect: " + framingRect);
}
return framingRect;
}
/**
* Like {@link #getFramingRect} but coordinates are in terms of the preview frame,
* not UI / screen.
*/
public Rect getFramingRectInPreview() {
if (framingRectInPreview == null) {
Rect rect = new Rect(getFramingRect());
Point cameraResolution = configManager.getCameraResolution();
Point screenResolution = configManager.getScreenResolution();
//modify here
// rect.left = rect.left * cameraResolution.x / screenResolution.x;
// rect.right = rect.right * cameraResolution.x / screenResolution.x;
// rect.top = rect.top * cameraResolution.y / screenResolution.y;
// rect.bottom = rect.bottom * cameraResolution.y / screenResolution.y;
rect.left = rect.left * cameraResolution.y / screenResolution.x;
rect.right = rect.right * cameraResolution.y / screenResolution.x;
rect.top = rect.top * cameraResolution.x / screenResolution.y;
rect.bottom = rect.bottom * cameraResolution.x / screenResolution.y;
framingRectInPreview = rect;
}
return framingRectInPreview;
}
/**
* Converts the result points from still resolution coordinates to screen coordinates.
*
* @param points The points returned by the Reader subclass through Result.getResultPoints().
* @return An array of Points scaled to the size of the framing rect and offset appropriately
* so they can be drawn in screen coordinates.
*/
/*
public Point[] convertResultPoints(ResultPoint[] points) {
Rect frame = getFramingRectInPreview();
int count = points.length;
Point[] output = new Point[count];
for (int x = 0; x < count; x++) {
output[x] = new Point();
output[x].x = frame.left + (int) (points[x].getX() + 0.5f);
output[x].y = frame.top + (int) (points[x].getY() + 0.5f);
}
return output;
}
*/
/**
* A factory method to build the appropriate LuminanceSource object based on the format
* of the preview buffers, as described by Camera.Parameters.
*
* @param data A preview frame.
* @param width The width of the image.
* @param height The height of the image.
* @return A PlanarYUVLuminanceSource instance.
*/
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
Rect rect = getFramingRectInPreview();
int previewFormat = configManager.getPreviewFormat();
String previewFormatString = configManager.getPreviewFormatString();
switch (previewFormat) {
// This is the standard Android format which all devices are REQUIRED to support.
// In theory, it's the only one we should ever care about.
case PixelFormat.YCbCr_420_SP:
// This format has never been seen in the wild, but is compatible as we only care
// about the Y channel, so allow it.
case PixelFormat.YCbCr_422_SP:
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height());
default:
// The Samsung Moment incorrectly uses this variant instead of the 'sp' version.
// Fortunately, it too has all the Y data up front, so we can read it.
if ("yuv420p".equals(previewFormatString)) {
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height());
}
}
throw new IllegalArgumentException("Unsupported picture format: " +
previewFormat + '/' + previewFormatString);
}
public Context getContext() {
return context;
}
}
| [
"584532675@qq.com"
] | 584532675@qq.com |
00128a76990939dea136e244704253f0a6f31209 | c29a0350d89f705ee5ca4b699390b8629a1742ac | /symbolic.regression.deterministic/src/symbolic/regression/deterministic/util/Operator.java | 84a16916ee4d4ceb6d409e38ab38edffa4e8a32b | [] | no_license | wrwei/DAASE | 9b3812831a060c6f3aefc107b22697b3f18214b4 | fa3e0e380197f41dc8856fb925efa83fdfea1afe | refs/heads/master | 2020-05-22T04:14:53.950010 | 2017-01-26T11:10:14 | 2017-01-26T11:10:14 | 58,636,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package symbolic.regression.deterministic.util;
public enum Operator {
INVALID(-1), ADD(0), SUB(1), MUL(2), DIV(3);
private final int op;
private Operator(int op) {
this.op = op;
}
}
| [
"ran.wei@york.ac.uk"
] | ran.wei@york.ac.uk |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.